From dd509097513d17ad74013df2c5a037b1b1b48173 Mon Sep 17 00:00:00 2001
From: Patrick Reynolds <cpreynolds@gmail.com>
Date: Thu, 1 Jul 2010 18:45:24 -0400
Subject: Fixing a warning in ezxml.

Assignment as used in the prefix ++ results in undefined behavior when the
variable is used in a function call later in the while loop condition. Most of
the time this works, but the behavior is technically undefined.
---
 libezxml/src/ezxml.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'libezxml')

diff --git a/libezxml/src/ezxml.c b/libezxml/src/ezxml.c
index 52deb95..967d535 100644
--- a/libezxml/src/ezxml.c
+++ b/libezxml/src/ezxml.c
@@ -426,7 +426,8 @@ static short ezxml_internal_dtd(ezxml_root_t root, char *s, size_t len)
             else *s = '\0'; // null terminate tag name
             for (i = 0; root->attr[i] && strcmp(n, root->attr[i][0]); i++);
 
-            while (*(n = ++s + strspn(s, EZXML_WS)) && *n != '>') {
+            ++s; // ansi cpr
+            while (*(n = s + strspn(s, EZXML_WS)) && *n != '>') {
                 if (*(s = n + strcspn(n, EZXML_WS))) *s = '\0'; // attr name
                 else { ezxml_err(root, t, "malformed <!ATTLIST"); break; }
 
@@ -467,6 +468,7 @@ static short ezxml_internal_dtd(ezxml_root_t root, char *s, size_t len)
                 root->attr[i][j + 1] = (v) ? ezxml_decode(v, root->ent, *c)
                                            : NULL;
                 root->attr[i][j] = n; // attribute name 
+                ++s;
             }
         }
         else if (! strncmp(s, "<!--", 4)) s = strstr(s + 4, "-->"); // comments
-- 
cgit v1.2.3