]> granicus.if.org Git - libexpat/commitdiff
When returning a status value through the public API, use
authorFred L. Drake, Jr. <fdrake@users.sourceforge.net>
Mon, 30 Dec 2002 20:02:28 +0000 (20:02 +0000)
committerFred L. Drake, Jr. <fdrake@users.sourceforge.net>
Mon, 30 Dec 2002 20:02:28 +0000 (20:02 +0000)
XML_STATUS_OK / XML_STATUS_ERROR.  Internal status returns are not
affected.

expat/lib/xmlparse.c

index 0ff94bde86ade045cd2fbd208ccad662b5b49535..b02514617611935f70adaecfd1bb6ee36c3a48e0 100644 (file)
@@ -873,17 +873,20 @@ XML_ParserReset(XML_Parser parser, const XML_Char *encodingName)
 int
 XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName)
 {
-  /* block after XML_Parse()/XML_ParseBuffer() has been called */
+  /* Block after XML_Parse()/XML_ParseBuffer() has been called.
+     XXX There's no way for the caller to determine which of the
+     XXX possible error cases caused the XML_STATUS_ERROR return.
+  */
   if (parsing)
-    return 0;
+    return XML_STATUS_ERROR;
   if (encodingName == NULL)
     protocolEncodingName = NULL;
   else {
     protocolEncodingName = poolCopyString(&tempPool, encodingName);
     if (!protocolEncodingName)
-      return 0;
+      return XML_STATUS_ERROR;
   }
-  return 1;
+  return XML_STATUS_OK;
 }
 
 XML_Parser
@@ -1116,12 +1119,12 @@ XML_SetBase(XML_Parser parser, const XML_Char *p)
   if (p) {
     p = poolCopyString(&_dtd->pool, p);
     if (!p)
-      return 0;
+      return XML_STATUS_ERROR;
     curBase = p;
   }
   else
     curBase = NULL;
-  return 1;
+  return XML_STATUS_OK;
 }
 
 const XML_Char *