Applied requested changes

This commit is contained in:
djack1010 2017-04-24 11:41:21 +02:00
parent fe14c0386c
commit 41dcaefdd0

View File

@ -279,17 +279,17 @@ static void nsvg__parseElement(char* s,
// Get attribs // Get attribs
while (!end && *s && nattr < NSVG_XML_MAX_ATTRIBS-3) { while (!end && *s && nattr < NSVG_XML_MAX_ATTRIBS-3) {
char* attr_ptr = NULL; char* name = NULL;
char* value_ptr = NULL; char* value = NULL;
// Skip white space before the attrib name // Skip white space before the attrib char* name = NULL;
while (*s && nsvg__isspace(*s)) s++; while (*s && nsvg__isspace(*s)) s++;
if (!*s) break; if (!*s) break;
if (*s == '/') { if (*s == '/') {
end = 1; end = 1;
break; break;
} }
attr_ptr = s; name = s;
// Find end of the attrib name. // Find end of the attrib name.
while (*s && !nsvg__isspace(*s) && *s != '=') s++; while (*s && !nsvg__isspace(*s) && *s != '=') s++;
if (*s) { *s++ = '\0'; } if (*s) { *s++ = '\0'; }
@ -299,14 +299,14 @@ static void nsvg__parseElement(char* s,
quote = *s; quote = *s;
s++; s++;
// Store value and find the end of it. // Store value and find the end of it.
value_ptr = s; value = s;
while (*s && *s != quote) s++; while (*s && *s != quote) s++;
if (*s) { *s++ = '\0'; } if (*s) { *s++ = '\0'; }
// Store only well formed attributes // Store only well formed attributes
if (attr_ptr && value_ptr) { if (name && value) {
attr[nattr++] = attr_ptr; attr[nattr++] = name;
attr[nattr++] = value_ptr; attr[nattr++] = value;
} }
} }