Changeset 2129
- Timestamp:
- 04/15/08 10:29:48 (1 month ago)
- Files:
-
- libswish3/trunk/src/libswish3/header.c (modified) (1 diff)
- libswish3/trunk/src/libswish3/parser.c (modified) (5 diffs)
- libswish3/trunk/src/libswish3/swish.c (modified) (1 diff)
- libswish3/trunk/src/swish_header.c (modified) (1 diff)
- libswish3/trunk/src/swish_isw.c (modified) (2 diffs)
- libswish3/trunk/src/swish_lint.c (modified) (1 diff)
- libswish3/trunk/src/xapian/swish_xapian.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
libswish3/trunk/src/libswish3/header.c
r2125 r2129 373 373 374 374 if (xmlStrEqual(attr, (xmlChar *)"ignore_case")) { 375 prop->ignore_case = (boolean)s trtol((char *)attr_val, (char **)NULL, 10);375 prop->ignore_case = (boolean)swish_string_to_int((char *)attr_val); 376 376 } 377 377 else if (xmlStrEqual(attr, (xmlChar *)"max")) { 378 prop->max = (int)strtol((char *)attr_val, (char **)NULL, 10);378 prop->max = swish_string_to_int((char *)attr_val); 379 379 } 380 380 else if (xmlStrEqual(attr, (xmlChar *)"verbatim")) { 381 prop->verbatim = (boolean)s trtol((char *)attr_val, (char **)NULL, 10);381 prop->verbatim = (boolean)swish_string_to_int((char *)attr_val); 382 382 } 383 383 else if (xmlStrEqual(attr, (xmlChar *)"sort")) { 384 prop->sort = (boolean)s trtol((char *)attr_val, (char **)NULL, 10);384 prop->sort = (boolean)swish_string_to_int((char *)attr_val); 385 385 } 386 386 else if (xmlStrEqual(attr, (xmlChar *)"id")) { libswish3/trunk/src/libswish3/parser.c
r2128 r2129 1302 1302 SWISH_WARN("Failed to parse Content-Length header '%s'", line); 1303 1303 1304 info->size = s trtol((char *)val, NULL, 10);1304 info->size = swish_string_to_int((char *)val); 1305 1305 continue; 1306 1306 } … … 1310 1310 SWISH_WARN("Failed to parse Last-Modified header '%s'", line); 1311 1311 1312 info->mtime = s trtol((char *)val, NULL, 10);1312 info->mtime = swish_string_to_int((char *)val); 1313 1313 continue; 1314 1314 } … … 1320 1320 SWISH_WARN("Failed to parse Last-Mtime header '%s'", line); 1321 1321 1322 info->mtime = s trtol((char *)val, NULL, 10);1322 info->mtime = swish_string_to_int((char *)val); 1323 1323 continue; 1324 1324 } … … 1464 1464 1465 1465 setenv("SWISH_PARSER_ERROR", "0", 0); 1466 SWISH_PARSER_ERROR = (int)strtol(getenv("SWISH_PARSER_ERROR"), (char **)NULL, 10);1466 SWISH_PARSER_ERROR = swish_string_to_int(getenv("SWISH_PARSER_ERROR")); 1467 1467 1468 1468 setenv("SWISH_PARSER_WARNING", "0", 0); 1469 SWISH_PARSER_WARNING = (int)strtol(getenv("SWISH_PARSER_WARNING"), (char **)NULL, 10);1469 SWISH_PARSER_WARNING = swish_string_to_int(getenv("SWISH_PARSER_WARNING")); 1470 1470 1471 1471 setenv("SWISH_PARSER_FATAL", "0", 0); 1472 SWISH_PARSER_FATAL = (int)strtol(getenv("SWISH_PARSER_FATAL"), (char **)NULL, 10);1472 SWISH_PARSER_FATAL = swish_string_to_int(getenv("SWISH_PARSER_FATAL")); 1473 1473 1474 1474 if (SWISH_DEBUG) { … … 1479 1479 } 1480 1480 1481 /*1482 * TODO there's a memory leak somewhere in here. one more malloc than free1483 */1484 1481 int 1485 1482 swish_parse_fh( libswish3/trunk/src/libswish3/swish.c
r2104 r2129 96 96 if (!SWISH_DEBUG) { 97 97 98 SWISH_DEBUG += (int)strtol(getenv("SWISH_DEBUG"), (char **)NULL, 10);98 SWISH_DEBUG += swish_string_to_int(getenv("SWISH_DEBUG")); 99 99 100 100 /* additional env vars just increase the global var value */ 101 101 102 if ( (int)strtol(getenv("SWISH_DEBUG_MEMORY"), (char **)NULL, 10)) {102 if (swish_string_to_int(getenv("SWISH_DEBUG_MEMORY"))) { 103 103 SWISH_DEBUG += SWISH_DEBUG_MEMORY; 104 104 } 105 if ( (int)strtol(getenv("SWISH_DEBUG_CONFIG"), (char **)NULL, 10)) {105 if (swish_string_to_int(getenv("SWISH_DEBUG_CONFIG"))) { 106 106 SWISH_DEBUG += SWISH_DEBUG_CONFIG; 107 107 } 108 if ( (int)strtol(getenv("SWISH_DEBUG_DOCINFO"), (char **)NULL, 10)) {108 if (swish_string_to_int(getenv("SWISH_DEBUG_DOCINFO"))) { 109 109 SWISH_DEBUG += SWISH_DEBUG_DOCINFO; 110 110 } 111 if ( (int)strtol(getenv("SWISH_DEBUG_WORDLIST"), (char **)NULL, 10)) {111 if (swish_string_to_int(getenv("SWISH_DEBUG_WORDLIST"))) { 112 112 SWISH_DEBUG += SWISH_DEBUG_WORDLIST; 113 113 } 114 if ( (int)strtol(getenv("SWISH_DEBUG_PARSER"), (char **)NULL, 10)) {114 if (swish_string_to_int(getenv("SWISH_DEBUG_PARSER"))) { 115 115 SWISH_DEBUG += SWISH_DEBUG_PARSER; 116 116 } 117 if ( (int)strtol(getenv("SWISH_DEBUG_NAMEDBUFFER"), (char **)NULL, 10)) {117 if (swish_string_to_int(getenv("SWISH_DEBUG_NAMEDBUFFER"))) { 118 118 SWISH_DEBUG += SWISH_DEBUG_NAMEDBUFFER; 119 119 } libswish3/trunk/src/swish_header.c
r2097 r2129 86 86 err(1, "-d option requires a positive integer as argument\n"); 87 87 88 SWISH_DEBUG = (int) strtol(optarg, (char **) NULL, 10);88 SWISH_DEBUG = swish_string_to_int(optarg); 89 89 break; 90 90 libswish3/trunk/src/swish_isw.c
r2105 r2129 34 34 #include <ctype.h> 35 35 #include <locale.h> 36 37 #include "libswish3.h" 36 38 37 39 void report( … … 76 78 err(1, "arg %s is not a positive integer\n", argv[i]); 77 79 78 n = (int)strtol(argv[i], (char **)NULL, 10);80 n = swish_string_to_int(argv[i]); 79 81 80 82 report(curlocale, n); libswish3/trunk/src/swish_lint.c
r2121 r2129 181 181 err(1, "-d option requires a positive integer as argument\n"); 182 182 183 SWISH_DEBUG = (int)strtol(optarg, (char **)NULL, 10);183 SWISH_DEBUG = swish_string_to_int(optarg); 184 184 break; 185 185 libswish3/trunk/src/xapian/swish_xapian.cpp
r2112 r2129 622 622 err(1, "-d option requires a positive integer as argument\n"); 623 623 624 SWISH_DEBUG = (int)strtol(optarg, (char **)NULL, 10);624 SWISH_DEBUG = swish_string_to_int(optarg); 625 625 break; 626 626 … … 634 634 635 635 case 's': 636 skip_duplicates = (int)strtol(optarg, (char **)NULL, 10);636 skip_duplicates = swish_string_to_int(optarg); 637 637 break; 638 638
