| OLD | NEW |
| 1 /* | 1 /* |
| 2 * dict.c: dictionary of reusable strings, just used to avoid allocation | 2 * dict.c: dictionary of reusable strings, just used to avoid allocation |
| 3 * and freeing operations. | 3 * and freeing operations. |
| 4 * | 4 * |
| 5 * Copyright (C) 2003-2012 Daniel Veillard. | 5 * Copyright (C) 2003-2012 Daniel Veillard. |
| 6 * | 6 * |
| 7 * Permission to use, copy, modify, and distribute this software for any | 7 * Permission to use, copy, modify, and distribute this software for any |
| 8 * purpose with or without fee is hereby granted, provided that the above | 8 * purpose with or without fee is hereby granted, provided that the above |
| 9 * copyright notice and this permission notice appear in all copies. | 9 * copyright notice and this permission notice appear in all copies. |
| 10 * | 10 * |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 const xmlChar *name, int len, int seed) | 479 const xmlChar *name, int len, int seed) |
| 480 { | 480 { |
| 481 unsigned long value = (unsigned long) seed; | 481 unsigned long value = (unsigned long) seed; |
| 482 | 482 |
| 483 if (plen == 0) | 483 if (plen == 0) |
| 484 value += 30 * (unsigned long) ':'; | 484 value += 30 * (unsigned long) ':'; |
| 485 else | 485 else |
| 486 value += 30 * (*prefix); | 486 value += 30 * (*prefix); |
| 487 | 487 |
| 488 if (len > 10) { | 488 if (len > 10) { |
| 489 value += name[len - (plen + 1 + 1)]; | 489 int offset = len - (plen + 1 + 1); |
| 490 » if (offset < 0) |
| 491 » offset = len - (10 + 1); |
| 492 » value += name[offset]; |
| 490 len = 10; | 493 len = 10; |
| 491 if (plen > 10) | 494 if (plen > 10) |
| 492 plen = 10; | 495 plen = 10; |
| 493 } | 496 } |
| 494 switch (plen) { | 497 switch (plen) { |
| 495 case 10: value += prefix[9]; | 498 case 10: value += prefix[9]; |
| 496 case 9: value += prefix[8]; | 499 case 9: value += prefix[8]; |
| 497 case 8: value += prefix[7]; | 500 case 8: value += prefix[7]; |
| 498 case 7: value += prefix[6]; | 501 case 7: value += prefix[6]; |
| 499 case 6: value += prefix[5]; | 502 case 6: value += prefix[5]; |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1250 pool = dict->strings; | 1253 pool = dict->strings; |
| 1251 while (pool != NULL) { | 1254 while (pool != NULL) { |
| 1252 limit += pool->size; | 1255 limit += pool->size; |
| 1253 pool = pool->next; | 1256 pool = pool->next; |
| 1254 } | 1257 } |
| 1255 return(limit); | 1258 return(limit); |
| 1256 } | 1259 } |
| 1257 | 1260 |
| 1258 #define bottom_dict | 1261 #define bottom_dict |
| 1259 #include "elfgcchack.h" | 1262 #include "elfgcchack.h" |
| OLD | NEW |