ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/ezxml.c
(Generate patch)

Comparing ray/src/common/ezxml.c (file contents):
Revision 2.3 by greg, Thu Jun 9 17:09:39 2011 UTC vs.
Revision 2.6 by greg, Sun Oct 26 17:35:53 2014 UTC

# Line 40 | Line 40 | static const char RCSid[] = "$Id$";
40  
41   #ifdef _WIN32
42   #include <io.h>
43 #define snprintf        printf_s
43   #define read            _read
44   #define open            _open
45   #define close           _close  
# Line 151 | Line 150 | ezxml_t ezxml_err(ezxml_root_t root, char *s, const ch
150      char *t, fmt[EZXML_ERRL];
151      
152      for (t = root->s; t < s; t++) if (*t == '\n') line++;
153 <    snprintf(fmt, EZXML_ERRL, "[error near line %d]: %s", line, err);
153 >    sprintf(fmt, "[error near line %d]: %s", line, err);
154  
155      va_start(ap, err);
156      vsnprintf(root->err, EZXML_ERRL, fmt, ap);
# Line 171 | Line 170 | char *ezxml_decode(char *s, char **ent, char t)
170      char *e, *r = s, *m = s;
171      long b, c, d, l;
172  
173 <    for (; *s; s++) { /* normalize line endings */
174 <        while (*s == '\r') {
175 <            *(s++) = '\n';
176 <            if (*s == '\n') memmove(s, (s + 1), strlen(s));
177 <        }
178 <    }
173 >    for (; *s; s++)     /* normalize line endings */
174 >        if (*s == '\r') {
175 >            char *s2 = s+1;
176 >            do {
177 >                while (*s2 == '\r')
178 >                    ++s2;
179 >                *s++ = *s2;
180 >            } while (*s2++);
181 >            break;
182 >        }
183      
184      for (s = r; ; ) {
185          while (*s && *s != '&' && (*s != '%' || t != '%') && !isspace(*s)) s++;
# Line 371 | Line 374 | short ezxml_internal_dtd(ezxml_root_t root, char *s, s
374              if (*(s = t + strcspn(t, EZXML_WS ">")) == '>') continue;
375              else *s = '\0'; /* null terminate tag name */
376              for (i = 0; root->attr[i] && strcmp(n, root->attr[i][0]); i++);
377 <
378 <            while (*(n = ++s + strspn(s, EZXML_WS)) && *n != '>') {
377 >            ++s;
378 >            while (*(n = s + strspn(s, EZXML_WS)) && *n != '>') {
379                  if (*(s = n + strcspn(n, EZXML_WS))) *s = '\0'; /* attr name */
380                  else { ezxml_err(root, t, "malformed <!ATTLIST"); break; }
381  
# Line 413 | Line 416 | short ezxml_internal_dtd(ezxml_root_t root, char *s, s
416                  root->attr[i][j + 1] = (v) ? ezxml_decode(v, root->ent, *c)
417                                             : NULL;
418                  root->attr[i][j] = n; /* attribute name  */
419 +                ++s;
420              }
421          }
422          else if (! strncmp(s, "<!--", 4)) s = strstr(s + 4, "-->"); /* comments */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines