diff options
Diffstat (limited to 'dict.c')
-rw-r--r-- | dict.c | 41 |
1 files changed, 35 insertions, 6 deletions
@@ -48,7 +48,7 @@ #else #ifdef HAVE_INTTYPES_H #include <inttypes.h> -#elif defined(WIN32) +#elif defined(_WIN32) typedef unsigned __int32 uint32_t; #endif #endif @@ -249,7 +249,7 @@ xmlDictAddString(xmlDictPtr dict, const xmlChar *name, unsigned int namelen) { #endif pool = dict->strings; while (pool != NULL) { - if (pool->end - pool->free > namelen) + if ((size_t)(pool->end - pool->free) > namelen) goto found_pool; if (pool->size > size) size = pool->size; limit += pool->size; @@ -317,7 +317,7 @@ xmlDictAddQString(xmlDictPtr dict, const xmlChar *prefix, unsigned int plen, #endif pool = dict->strings; while (pool != NULL) { - if (pool->end - pool->free > namelen + plen + 1) + if ((size_t)(pool->end - pool->free) > namelen + plen + 1) goto found_pool; if (pool->size > size) size = pool->size; limit += pool->size; @@ -453,14 +453,23 @@ xmlDictComputeFastKey(const xmlChar *name, int namelen, int seed) { } switch (namelen) { case 10: value += name[9]; + /* Falls through. */ case 9: value += name[8]; + /* Falls through. */ case 8: value += name[7]; + /* Falls through. */ case 7: value += name[6]; + /* Falls through. */ case 6: value += name[5]; + /* Falls through. */ case 5: value += name[4]; + /* Falls through. */ case 4: value += name[3]; + /* Falls through. */ case 3: value += name[2]; + /* Falls through. */ case 2: value += name[1]; + /* Falls through. */ default: break; } return(value); @@ -496,15 +505,25 @@ xmlDictComputeFastQKey(const xmlChar *prefix, int plen, } switch (plen) { case 10: value += prefix[9]; + /* Falls through. */ case 9: value += prefix[8]; + /* Falls through. */ case 8: value += prefix[7]; + /* Falls through. */ case 7: value += prefix[6]; + /* Falls through. */ case 6: value += prefix[5]; + /* Falls through. */ case 5: value += prefix[4]; + /* Falls through. */ case 4: value += prefix[3]; + /* Falls through. */ case 3: value += prefix[2]; + /* Falls through. */ case 2: value += prefix[1]; + /* Falls through. */ case 1: value += prefix[0]; + /* Falls through. */ default: break; } len -= plen; @@ -514,15 +533,25 @@ xmlDictComputeFastQKey(const xmlChar *prefix, int plen, } switch (len) { case 10: value += name[9]; + /* Falls through. */ case 9: value += name[8]; + /* Falls through. */ case 8: value += name[7]; + /* Falls through. */ case 7: value += name[6]; + /* Falls through. */ case 6: value += name[5]; + /* Falls through. */ case 5: value += name[4]; + /* Falls through. */ case 4: value += name[3]; + /* Falls through. */ case 3: value += name[2]; + /* Falls through. */ case 2: value += name[1]; + /* Falls through. */ case 1: value += name[0]; + /* Falls through. */ default: break; } return(value); @@ -533,7 +562,7 @@ xmlDictComputeFastQKey(const xmlChar *prefix, int plen, * * Create a new dictionary * - * Returns the newly created dictionary, or NULL if an error occured. + * Returns the newly created dictionary, or NULL if an error occurred. */ xmlDictPtr xmlDictCreate(void) { @@ -580,7 +609,7 @@ xmlDictCreate(void) { * new dictionary, then in @sub, and if not found are created in the * new dictionary. * - * Returns the newly created dictionary, or NULL if an error occured. + * Returns the newly created dictionary, or NULL if an error occurred. */ xmlDictPtr xmlDictCreateSub(xmlDictPtr sub) { @@ -699,7 +728,7 @@ xmlDictGrow(xmlDictPtr dict, size_t size) { } else { /* * we don't have much ways to alert from herei - * result is loosing an entry and unicity garantee + * result is losing an entry and unicity guarantee */ ret = -1; } |