Diff for /XML/entities.c between versions 1.68 and 1.69

version 1.68, 2000/10/23 18:59:50 version 1.69, 2000/10/25 19:26:52
Line 21 Line 21
 #include <libxml/hash.h>  #include <libxml/hash.h>
 #include <libxml/entities.h>  #include <libxml/entities.h>
 #include <libxml/parser.h>  #include <libxml/parser.h>
   #include <libxml/xmlerror.h>
   
 #define DEBUG_ENT_REF /* debugging of cross entities dependancies */  #define DEBUG_ENT_REF /* debugging of cross entities dependancies */
 #define ENTITY_HASH_SIZE 256 /* modify xmlEntityComputeHash accordingly */  #define ENTITY_HASH_SIZE 256 /* modify xmlEntityComputeHash accordingly */
Line 122  xmlAddEntity(xmlDtdPtr dtd, const xmlCha Line 123  xmlAddEntity(xmlDtdPtr dtd, const xmlCha
         return(NULL);          return(NULL);
     ret = (xmlEntityPtr) xmlMalloc(sizeof(xmlEntity));      ret = (xmlEntityPtr) xmlMalloc(sizeof(xmlEntity));
     if (ret == NULL) {      if (ret == NULL) {
         fprintf(stderr, "xmlAddEntity: out of memory\n");          xmlGenericError(xmlGenericErrorContext,
                   "xmlAddEntity: out of memory\n");
         return(NULL);          return(NULL);
     }      }
     memset(ret, 0, sizeof(xmlEntity));      memset(ret, 0, sizeof(xmlEntity));
Line 236  xmlAddDtdEntity(xmlDocPtr doc, const xml Line 238  xmlAddDtdEntity(xmlDocPtr doc, const xml
     xmlDtdPtr dtd;      xmlDtdPtr dtd;
   
     if (doc == NULL) {      if (doc == NULL) {
         fprintf(stderr,          xmlGenericError(xmlGenericErrorContext,
                 "xmlAddDtdEntity: doc == NULL !\n");                  "xmlAddDtdEntity: doc == NULL !\n");
         return(NULL);          return(NULL);
     }      }
     if (doc->extSubset == NULL) {      if (doc->extSubset == NULL) {
         fprintf(stderr,          xmlGenericError(xmlGenericErrorContext,
                 "xmlAddDtdEntity: document without external subset !\n");                  "xmlAddDtdEntity: document without external subset !\n");
         return(NULL);          return(NULL);
     }      }
Line 285  xmlAddDocEntity(xmlDocPtr doc, const xml Line 287  xmlAddDocEntity(xmlDocPtr doc, const xml
     xmlDtdPtr dtd;      xmlDtdPtr dtd;
   
     if (doc == NULL) {      if (doc == NULL) {
         fprintf(stderr,          xmlGenericError(xmlGenericErrorContext,
                 "xmlAddDocEntity: document is NULL !\n");                  "xmlAddDocEntity: document is NULL !\n");
         return(NULL);          return(NULL);
     }      }
     if (doc->intSubset == NULL) {      if (doc->intSubset == NULL) {
         fprintf(stderr,          xmlGenericError(xmlGenericErrorContext,
                 "xmlAddDtdEntity: document without internal subset !\n");                  "xmlAddDtdEntity: document without internal subset !\n");
         return(NULL);          return(NULL);
     }      }
Line 465  xmlEncodeEntities(xmlDocPtr doc, const x Line 467  xmlEncodeEntities(xmlDocPtr doc, const x
   
   
     if (warning) {      if (warning) {
     fprintf(stderr, "Deprecated API xmlEncodeEntities() used\n");      xmlGenericError(xmlGenericErrorContext,
     fprintf(stderr, "   change code to use xmlEncodeEntitiesReentrant()\n");              "Deprecated API xmlEncodeEntities() used\n");
       xmlGenericError(xmlGenericErrorContext,
               "   change code to use xmlEncodeEntitiesReentrant()\n");
     warning = 0;      warning = 0;
     }      }
   
Line 561  xmlEncodeEntities(xmlDocPtr doc, const x Line 565  xmlEncodeEntities(xmlDocPtr doc, const x
              * default case, this is not a valid char !               * default case, this is not a valid char !
              * Skip it...               * Skip it...
              */               */
             fprintf(stderr, "xmlEncodeEntities: invalid char %d\n", (int) *cur);              xmlGenericError(xmlGenericErrorContext,
                       "xmlEncodeEntities: invalid char %d\n", (int) *cur);
         }          }
 #endif  #endif
         cur++;          cur++;
Line 688  xmlEncodeEntitiesReentrant(xmlDocPtr doc Line 693  xmlEncodeEntitiesReentrant(xmlDocPtr doc
                 int val = 0, l = 1;                  int val = 0, l = 1;
   
                 if (*cur < 0xC0) {                  if (*cur < 0xC0) {
                     fprintf(stderr,                      xmlGenericError(xmlGenericErrorContext,
                             "xmlEncodeEntitiesReentrant : input not UTF-8\n");                              "xmlEncodeEntitiesReentrant : input not UTF-8\n");
                     doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1");                      doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1");
 #ifdef HAVE_SNPRINTF  #ifdef HAVE_SNPRINTF
Line 723  xmlEncodeEntitiesReentrant(xmlDocPtr doc Line 728  xmlEncodeEntitiesReentrant(xmlDocPtr doc
                     l = 4;                      l = 4;
                 }                  }
                 if ((l == 1) || (!IS_CHAR(val))) {                  if ((l == 1) || (!IS_CHAR(val))) {
                     fprintf(stderr,                      xmlGenericError(xmlGenericErrorContext,
                         "xmlEncodeEntitiesReentrant : char out of range\n");                          "xmlEncodeEntitiesReentrant : char out of range\n");
                     doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1");                      doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1");
 #ifdef HAVE_SNPRINTF  #ifdef HAVE_SNPRINTF
Line 769  xmlEncodeEntitiesReentrant(xmlDocPtr doc Line 774  xmlEncodeEntitiesReentrant(xmlDocPtr doc
              * default case, this is not a valid char !               * default case, this is not a valid char !
              * Skip it...               * Skip it...
              */               */
             fprintf(stderr, "xmlEncodeEntities: invalid char %d\n", (int) *cur);              xmlGenericError(xmlGenericErrorContext,
                       "xmlEncodeEntities: invalid char %d\n", (int) *cur);
         }          }
 #endif  #endif
         cur++;          cur++;
Line 895  xmlCopyEntity(xmlEntityPtr ent) { Line 901  xmlCopyEntity(xmlEntityPtr ent) {
   
     cur = (xmlEntityPtr) xmlMalloc(sizeof(xmlEntity));      cur = (xmlEntityPtr) xmlMalloc(sizeof(xmlEntity));
     if (cur == NULL) {      if (cur == NULL) {
         fprintf(stderr, "xmlCopyEntity: out of memory !\n");          xmlGenericError(xmlGenericErrorContext,
                   "xmlCopyEntity: out of memory !\n");
         return(NULL);          return(NULL);
     }      }
     memset(cur, 0, sizeof(xmlEntity));      memset(cur, 0, sizeof(xmlEntity));
Line 1008  xmlDumpEntityDecl(xmlBufferPtr buf, xmlE Line 1015  xmlDumpEntityDecl(xmlBufferPtr buf, xmlE
             xmlBufferWriteChar(buf, ">\n");              xmlBufferWriteChar(buf, ">\n");
             break;              break;
         default:          default:
             fprintf(stderr,              xmlGenericError(xmlGenericErrorContext,
                 "xmlDumpEntitiesTable: internal: unknown type %d\n",                  "xmlDumpEntitiesTable: internal: unknown type %d\n",
                     ent->etype);                      ent->etype);
     }      }

Removed from v.1.68  
changed lines
  Added in v.1.69


Webmaster