aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-06-12 14:41:25 +0000
committerChristian Grothoff <christian@grothoff.org>2010-06-12 14:41:25 +0000
commit21ca135e01d859bdbc8197072f388edffbbba0cc (patch)
treefda49044a2c6cc96ceef3fb90658d080b8ee2889
parentb0cab4e85aed43031a0210f2a31742bbcef7e734 (diff)
downloadlibextractor-21ca135e01d859bdbc8197072f388edffbbba0cc.tar.gz
libextractor-21ca135e01d859bdbc8197072f388edffbbba0cc.zip
pass unsigned chars only to isXXXX functions and simplify code
-rw-r--r--src/common/pack.c4
-rw-r--r--src/main/extract.c36
-rw-r--r--src/plugins/exiv2_extractor.cc6
3 files changed, 9 insertions, 37 deletions
diff --git a/src/common/pack.c b/src/common/pack.c
index af79a1c..82ac7fe 100644
--- a/src/common/pack.c
+++ b/src/common/pack.c
@@ -79,7 +79,7 @@ EXTRACTOR_common_cat_pack (void *buf, const char *fmt, ...)
79 { 79 {
80 nreps = 0; 80 nreps = 0;
81 81
82 if (isdigit (*fmt)) 82 if (isdigit ( (unsigned char) *fmt))
83 { 83 {
84 /* We use cp instead of fmt to keep the 'const' qualifier of fmt */ 84 /* We use cp instead of fmt to keep the 'const' qualifier of fmt */
85 nreps = strtoul (fmt, &cp, 0); 85 nreps = strtoul (fmt, &cp, 0);
@@ -274,7 +274,7 @@ EXTRACTOR_common_cat_unpack (const void *buf, const char *fmt, ...)
274 { 274 {
275 nreps = 1; 275 nreps = 1;
276 276
277 if (isdigit (*fmt)) 277 if (isdigit ( (unsigned char) *fmt))
278 { 278 {
279 /* We use cp instead of format to keep the 'const' qualifier of fmt */ 279 /* We use cp instead of format to keep the 'const' qualifier of fmt */
280 nreps = strtoul (fmt, &cp, 0); 280 nreps = strtoul (fmt, &cp, 0);
diff --git a/src/main/extract.c b/src/main/extract.c
index 0df0abf..68b2fff 100644
--- a/src/main/extract.c
+++ b/src/main/extract.c
@@ -353,32 +353,6 @@ print_selected_keywords_grep_friendly (void *cls,
353 353
354 354
355/** 355/**
356 * Take title, auth, year and return a string
357 */
358static char *
359str_splice(const char * title,
360 const char * year,
361 const char * auth) {
362 char * temp = malloc(16);
363 int i = 0;
364
365 snprintf(temp,
366 15,
367 "%.5s%.5s%.5s",
368 auth,
369 year,
370 title);
371 for (i=0;i<strlen(temp);i++ ) {
372 if (! isalnum(temp[i]) )
373 temp[i] = '_';
374 else
375 temp[i] = tolower( (unsigned int) temp[i]);
376 }
377 return temp;
378}
379
380
381/**
382 * Entry in the map we construct for each file. 356 * Entry in the map we construct for each file.
383 */ 357 */
384struct BibTexMap 358struct BibTexMap
@@ -513,14 +487,12 @@ finish_bibtex (const char *fn)
513 fn); 487 fn);
514 else 488 else
515 { 489 {
516 tya = str_splice (btm[0].value,
517 btm[1].value,
518 btm[2].value);
519 fprintf (stdout, 490 fprintf (stdout,
520 "@%s %s { ", 491 "@%s %.5s%.5s%.5s { ",
521 et, 492 et,
522 tya); 493 btm[2].value,
523 free (tya); 494 btm[1].value,
495 btm[0].value);
524 } 496 }
525 497
526 498
diff --git a/src/plugins/exiv2_extractor.cc b/src/plugins/exiv2_extractor.cc
index a666d08..c3bd91a 100644
--- a/src/plugins/exiv2_extractor.cc
+++ b/src/plugins/exiv2_extractor.cc
@@ -54,7 +54,7 @@ addExiv2Tag(const Exiv2::ExifData& exifData,
54 if (md != exifData.end()) { 54 if (md != exifData.end()) {
55 std::string ccstr = Exiv2::toString(*md); 55 std::string ccstr = Exiv2::toString(*md);
56 str = ccstr.c_str(); 56 str = ccstr.c_str();
57 while ( (strlen(str) > 0) && isspace(str[0])) str++; 57 while ( (strlen(str) > 0) && isspace((unsigned char) str[0])) str++;
58 if (strlen(str) > 0) 58 if (strlen(str) > 0)
59 ADD (str, type); 59 ADD (str, type);
60 md++; 60 md++;
@@ -80,7 +80,7 @@ addIptcData(const Exiv2::IptcData& iptcData,
80 break; 80 break;
81 std::string ccstr = Exiv2::toString(*md); 81 std::string ccstr = Exiv2::toString(*md);
82 str = ccstr.c_str(); 82 str = ccstr.c_str();
83 while ( (strlen(str) > 0) && isspace(str[0])) str++; 83 while ( (strlen(str) > 0) && isspace( (unsigned char) str[0])) str++;
84 if (strlen(str) > 0) 84 if (strlen(str) > 0)
85 ADD (str, type); 85 ADD (str, type);
86 md++; 86 md++;
@@ -106,7 +106,7 @@ addXmpData(const Exiv2::XmpData& xmpData,
106 break; 106 break;
107 std::string ccstr = Exiv2::toString(*md); 107 std::string ccstr = Exiv2::toString(*md);
108 str = ccstr.c_str(); 108 str = ccstr.c_str();
109 while ( (strlen(str) > 0) && isspace(str[0])) str++; 109 while ( (strlen(str) > 0) && isspace( (unsigned char) str[0])) str++;
110 if (strlen(str) > 0) 110 if (strlen(str) > 0)
111 ADD (str, type); 111 ADD (str, type);
112 md++; 112 md++;