[Expat-checkins] CVS: expat/lib xmlparse.c,1.25,1.26
Fred L. Drake
fdrake@users.sourceforge.net
Fri Apr 19 13:53:06 2002
Update of /cvsroot/expat/expat/lib
In directory usw-pr-cvs1:/tmp/cvs-serv16286/lib
Modified Files:
xmlparse.c
Log Message:
Check in SF patch #476929: Fix XML_SetReturnNSTriplet().
This is slightly modified from the submitted patch to ensure a variable is
never used uninitialized.
Patch contributed by Karl Waclawek.
Index: xmlparse.c
===================================================================
RCS file: /cvsroot/expat/expat/lib/xmlparse.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** xmlparse.c 16 Nov 2001 20:57:30 -0000 1.25
--- xmlparse.c 19 Apr 2002 20:52:39 -0000 1.26
***************
*** 1766,1775 ****
--tagLevel;
if (endElementHandler && tag->name.str) {
- if (tag->name.localPart) {
- XML_Char *to = (XML_Char *)tag->name.str + tag->name.uriLen;
- const XML_Char *from = tag->name.localPart;
- while ((*to++ = *from++) != 0)
- ;
- }
endElementHandler(handlerArg, tag->name.str);
}
--- 1766,1769 ----
***************
*** 1921,1926 ****
--- 1915,1922 ----
const XML_Char **appAtts; /* the attribute list for the application */
int attIndex = 0;
+ int prefixLen = 0;
int i;
int n;
+ XML_Char *uri;
int nPrefixes = 0;
BINDING *binding;
***************
*** 2125,2128 ****
--- 2121,2131 ----
}
else
+ localPart = NULL;
+ if (ns && ns_triplets && binding->prefix->name) {
+ for (prefixLen = 0; binding->prefix->name[prefixLen++];)
+ ;
+ n += prefixLen;
+ }
+ else
return XML_ERROR_NONE;
tagNamePtr->localPart = localPart;
***************
*** 2133,2137 ****
if (n > binding->uriAlloc) {
TAG *p;
! XML_Char *uri = MALLOC((n + EXPAND_SPARE) * sizeof(XML_Char));
if (!uri)
return XML_ERROR_NO_MEMORY;
--- 2136,2140 ----
if (n > binding->uriAlloc) {
TAG *p;
! uri = MALLOC((n + EXPAND_SPARE) * sizeof(XML_Char));
if (!uri)
return XML_ERROR_NO_MEMORY;
***************
*** 2144,2148 ****
binding->uri = uri;
}
! memcpy(binding->uri + binding->uriLen, localPart, i * sizeof(XML_Char));
tagNamePtr->str = binding->uri;
return XML_ERROR_NONE;
--- 2147,2157 ----
binding->uri = uri;
}
! uri = binding->uri + binding->uriLen;
! memcpy(uri, localPart, i * sizeof(XML_Char));
! if (prefixLen) {
! uri = uri + (i - 1);
! if (namespaceSeparator) { *(uri) = namespaceSeparator; }
! memcpy(uri + 1, binding->prefix->name, prefixLen * sizeof(XML_Char));
! }
tagNamePtr->str = binding->uri;
return XML_ERROR_NONE;