expat/lib xmlparse.c,1.96,1.97

"Karl Waclawek" <[email protected]>
Newsgroups gmane.text.xml.expat.cvs
Message-ID <[email protected]>
Update of /cvsroot/expat/expat/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv5318

Modified Files:
	xmlparse.c 
Log Message:
Added additional patch for bug #644334. Includes workaround for
bad API typedef of externalEntityRefHandler.

Index: xmlparse.c
===================================================================
RCS file: /cvsroot/expat/expat/lib/xmlparse.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- xmlparse.c	27 Nov 2002 04:03:31 -0000	1.96
+++ xmlparse.c	27 Nov 2002 17:11:32 -0000	1.97
@@ -452,7 +452,7 @@
   XML_EndNamespaceDeclHandler m_endNamespaceDeclHandler;
   XML_NotStandaloneHandler m_notStandaloneHandler;
   XML_ExternalEntityRefHandler m_externalEntityRefHandler;
-  void *m_externalEntityRefHandlerArg;
+  XML_Parser m_externalEntityRefHandlerArg;
   XML_SkippedEntityHandler m_skippedEntityHandler;
   XML_UnknownEncodingHandler m_unknownEncodingHandler;
   XML_ElementDeclHandler m_elementDeclHandler;
@@ -673,7 +673,7 @@
 
   if (memsuite) {
     XML_Memory_Handling_Suite *mtemp;
-    parser = (struct XML_ParserStruct*)
+    parser = (XML_Parser)
       memsuite->malloc_fcn(sizeof(struct XML_ParserStruct));
     if (parser != NULL) {
       mtemp = (XML_Memory_Handling_Suite *)&(parser->m_mem);
@@ -684,7 +684,7 @@
   }
   else {
     XML_Memory_Handling_Suite *mtemp;
-    parser = (struct XML_ParserStruct*)malloc(sizeof(struct XML_ParserStruct));
+    parser = (XML_Parser)malloc(sizeof(struct XML_ParserStruct));
     if (parser != NULL) {
       mtemp = (XML_Memory_Handling_Suite *)&(parser->m_mem);
       mtemp->malloc_fcn = malloc;
@@ -700,12 +700,12 @@
   bufferLim = NULL;
 
   attsSize = INIT_ATTS_SIZE;
-  atts = (ATTRIBUTE*)MALLOC(attsSize * sizeof(ATTRIBUTE));
+  atts = (ATTRIBUTE *)MALLOC(attsSize * sizeof(ATTRIBUTE));
   if (atts == NULL) {
     FREE(parser);
     return NULL;
   }
-  dataBuf = (XML_Char*)MALLOC(INIT_DATA_BUF_SIZE * sizeof(XML_Char));
+  dataBuf = (XML_Char *)MALLOC(INIT_DATA_BUF_SIZE * sizeof(XML_Char));
   if (dataBuf == NULL) {
     FREE(atts);
     FREE(parser);
@@ -927,9 +927,9 @@
   void *oldUserData = userData;
   void *oldHandlerArg = handlerArg;
   XML_Bool oldDefaultExpandInternalEntities = defaultExpandInternalEntities;
-  void *oldExternalEntityRefHandlerArg = externalEntityRefHandlerArg;
+  XML_Parser oldExternalEntityRefHandlerArg = externalEntityRefHandlerArg;
 #ifdef XML_DTD
-  int oldParamEntityParsing = paramEntityParsing;
+  enum XML_ParamEntityParsing oldParamEntityParsing = paramEntityParsing;
   int oldInEntityValue = prologState.inEntityValue;
 #endif
   XML_Bool oldns_triplets = ns_triplets;
@@ -1295,7 +1295,7 @@
 XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg)
 {
   if (arg)
-    externalEntityRefHandlerArg = arg;
+    externalEntityRefHandlerArg = (XML_Parser)arg;
   else
     externalEntityRefHandlerArg = parser;
 }
@@ -1399,8 +1399,8 @@
         /* FIXME avoid integer overflow */
         char *temp;
         temp = (buffer == NULL
-                ? (char*)MALLOC(len * 2)
-                : (char*)REALLOC(buffer, len * 2));
+                ? (char *)MALLOC(len * 2)
+                : (char *)REALLOC(buffer, len * 2));
         if (temp == NULL) {
           errorCode = XML_ERROR_NO_MEMORY;
           return XML_STATUS_ERROR;
@@ -1488,7 +1488,7 @@
       do {
         bufferSize *= 2;
       } while (bufferSize < neededSize);
-      newBuf = (char*)MALLOC(bufferSize);
+      newBuf = (char *)MALLOC(bufferSize);
       if (newBuf == 0) {
         errorCode = XML_ERROR_NO_MEMORY;
         return NULL;
@@ -1715,7 +1715,7 @@
     */
     bufSize = nameLen + ROUND_UP(tag->rawNameLength, sizeof(XML_Char));
     if (bufSize > tag->bufEnd - tag->buf) {
-      char *temp = (char*)REALLOC(tag->buf, bufSize);
+      char *temp = (char *)REALLOC(tag->buf, bufSize);
       if (temp == NULL)
         return XML_FALSE;
       /* if tag->name.str points to tag->buf (only when namespace
@@ -2033,10 +2033,10 @@
           freeTagList = freeTagList->parent;
         }
         else {
-          tag = (TAG*)MALLOC(sizeof(TAG));
+          tag = (TAG *)MALLOC(sizeof(TAG));
           if (!tag)
             return XML_ERROR_NO_MEMORY;
-          tag->buf = (char*)MALLOC(INIT_TAG_BUF_SIZE);
+          tag->buf = (char *)MALLOC(INIT_TAG_BUF_SIZE);
           if (!tag->buf) {
             FREE(tag);
             return XML_ERROR_NO_MEMORY;
@@ -2068,7 +2068,7 @@
             }
             bufSize = (tag->bufEnd - tag->buf) << 1;
             {
-              char *temp = (char*)REALLOC(tag->buf, bufSize);
+              char *temp = (char *)REALLOC(tag->buf, bufSize);
               if (temp == NULL)
                 return XML_ERROR_NO_MEMORY;
               tag->buf = temp;
@@ -2587,8 +2587,8 @@
   if (freeBindingList) {
     b = freeBindingList;
     if (len > b->uriAlloc) {
-      XML_Char *temp = (XML_Char*)REALLOC(b->uri,
-                               sizeof(XML_Char) * (len + EXPAND_SPARE));
+      XML_Char *temp = (XML_Char *)REALLOC(b->uri,
+                          sizeof(XML_Char) * (len + EXPAND_SPARE));
       if (temp == NULL)
         return 0;
       b->uri = temp;
@@ -2597,10 +2597,10 @@
     freeBindingList = b->nextTagBinding;
   }
   else {
-    b = (BINDING*)MALLOC(sizeof(BINDING));
+    b = (BINDING *)MALLOC(sizeof(BINDING));
     if (!b)
       return 0;
-    b->uri = (XML_Char*)MALLOC(sizeof(XML_Char) * (len + EXPAND_SPARE));
+    b->uri = (XML_Char *)MALLOC(sizeof(XML_Char) * (len + EXPAND_SPARE));
     if (!b->uri) {
       FREE(b);
       return 0;
@@ -3798,20 +3798,20 @@
     case XML_ROLE_GROUP_OPEN:
       if (prologState.level >= groupSize) {
         if (groupSize) {
-          char *temp = (char*)REALLOC(groupConnector, groupSize *= 2);
+          char *temp = (char *)REALLOC(groupConnector, groupSize *= 2);
           if (temp == NULL)
             return XML_ERROR_NO_MEMORY;
           groupConnector = temp;
           if (dtd->scaffIndex) {
-            int *temp = (int*)REALLOC(dtd->scaffIndex, 
-                                      groupSize * sizeof(int));
+            int *temp = (int *)REALLOC(dtd->scaffIndex,
+                          groupSize * sizeof(int));
             if (temp == NULL)
               return XML_ERROR_NO_MEMORY;
             dtd->scaffIndex = temp;
           }
         }
         else {
-          groupConnector = (char*)MALLOC(groupSize = 32);
+          groupConnector = (char *)MALLOC(groupSize = 32);
           if (!groupConnector)
             return XML_ERROR_NO_MEMORY;
         }
@@ -4640,16 +4640,16 @@
   if (type->nDefaultAtts == type->allocDefaultAtts) {
     if (type->allocDefaultAtts == 0) {
       type->allocDefaultAtts = 8;
-      type->defaultAtts = (DEFAULT_ATTRIBUTE*)MALLOC(type->allocDefaultAtts 
-                                 * sizeof(DEFAULT_ATTRIBUTE));
+      type->defaultAtts = (DEFAULT_ATTRIBUTE *)MALLOC(type->allocDefaultAtts 
+                            * sizeof(DEFAULT_ATTRIBUTE));
       if (!type->defaultAtts)
         return 0;
     }
     else {
       DEFAULT_ATTRIBUTE *temp;
       int count = type->allocDefaultAtts * 2;
-      temp = (DEFAULT_ATTRIBUTE*)
-	REALLOC(type->defaultAtts, (count * sizeof(DEFAULT_ATTRIBUTE)));
+      temp = (DEFAULT_ATTRIBUTE *)
+        REALLOC(type->defaultAtts, (count * sizeof(DEFAULT_ATTRIBUTE)));
       if (temp == NULL)
         return 0;
       type->allocDefaultAtts = count;
@@ -4912,7 +4912,7 @@
 static DTD *
 dtdCreate(const XML_Memory_Handling_Suite *ms)
 {
-  DTD *p = ms->malloc_fcn(sizeof(DTD));
+  DTD *p = (DTD *)ms->malloc_fcn(sizeof(DTD));
   if (p == NULL)
     return p;
   poolInit(&(p->pool), ms);
@@ -5251,7 +5251,7 @@
     if (!createSize)
       return NULL;
     tsize = INIT_SIZE * sizeof(NAMED *);
-    table->v = (NAMED**)table->mem->malloc_fcn(tsize);
+    table->v = (NAMED **)table->mem->malloc_fcn(tsize);
     if (!table->v)
       return NULL;
     memset(table->v, 0, tsize);
@@ -5273,7 +5273,7 @@
       /* check for overflow */
       size_t newSize = table->size * 2;
       size_t tsize = newSize * sizeof(NAMED *);
-      NAMED **newV = (NAMED**)table->mem->malloc_fcn(tsize);
+      NAMED **newV = (NAMED **)table->mem->malloc_fcn(tsize);
       if (!newV)
         return NULL;
       memset(newV, 0, tsize);
@@ -5296,7 +5296,7 @@
         ;
     }
   }
-  table->v[i] = (NAMED*)table->mem->malloc_fcn(createSize);
+  table->v[i] = (NAMED *)table->mem->malloc_fcn(createSize);
   if (!table->v[i])
     return NULL;
   memset(table->v[i], 0, createSize);
@@ -5502,7 +5502,7 @@
   }
   if (pool->blocks && pool->start == pool->blocks->s) {
     int blockSize = (pool->end - pool->start)*2;
-    pool->blocks = (BLOCK*)
+    pool->blocks = (BLOCK *)
       pool->mem->realloc_fcn(pool->blocks,
 			     (offsetof(BLOCK, s)
 			      + blockSize * sizeof(XML_Char)));
@@ -5520,7 +5520,7 @@
       blockSize = INIT_BLOCK_SIZE;
     else
       blockSize *= 2;
-    tem = (BLOCK*)pool->mem->malloc_fcn(offsetof(BLOCK, s)
+    tem = (BLOCK *)pool->mem->malloc_fcn(offsetof(BLOCK, s)
 					+ blockSize * sizeof(XML_Char));
     if (!tem)
       return XML_FALSE;
@@ -5545,7 +5545,7 @@
   int next;
 
   if (!dtd->scaffIndex) {
-    dtd->scaffIndex = (int*)MALLOC(groupSize * sizeof(int));
+    dtd->scaffIndex = (int *)MALLOC(groupSize * sizeof(int));
     if (!dtd->scaffIndex)
       return -1;
     dtd->scaffIndex[0] = 0;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.