From 21ca135e01d859bdbc8197072f388edffbbba0cc Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 12 Jun 2010 14:41:25 +0000 Subject: pass unsigned chars only to isXXXX functions and simplify code --- src/common/pack.c | 4 ++-- src/main/extract.c | 36 ++++-------------------------------- src/plugins/exiv2_extractor.cc | 6 +++--- 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, ...) { nreps = 0; - if (isdigit (*fmt)) + if (isdigit ( (unsigned char) *fmt)) { /* We use cp instead of fmt to keep the 'const' qualifier of fmt */ nreps = strtoul (fmt, &cp, 0); @@ -274,7 +274,7 @@ EXTRACTOR_common_cat_unpack (const void *buf, const char *fmt, ...) { nreps = 1; - if (isdigit (*fmt)) + if (isdigit ( (unsigned char) *fmt)) { /* We use cp instead of format to keep the 'const' qualifier of fmt */ 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 @@ -352,32 +352,6 @@ print_selected_keywords_grep_friendly (void *cls, } -/** - * Take title, auth, year and return a string - */ -static char * -str_splice(const char * title, - const char * year, - const char * auth) { - char * temp = malloc(16); - int i = 0; - - snprintf(temp, - 15, - "%.5s%.5s%.5s", - auth, - year, - title); - for (i=0;i 0) && isspace(str[0])) str++; + while ( (strlen(str) > 0) && isspace((unsigned char) str[0])) str++; if (strlen(str) > 0) ADD (str, type); md++; @@ -80,7 +80,7 @@ addIptcData(const Exiv2::IptcData& iptcData, break; std::string ccstr = Exiv2::toString(*md); str = ccstr.c_str(); - while ( (strlen(str) > 0) && isspace(str[0])) str++; + while ( (strlen(str) > 0) && isspace( (unsigned char) str[0])) str++; if (strlen(str) > 0) ADD (str, type); md++; @@ -106,7 +106,7 @@ addXmpData(const Exiv2::XmpData& xmpData, break; std::string ccstr = Exiv2::toString(*md); str = ccstr.c_str(); - while ( (strlen(str) > 0) && isspace(str[0])) str++; + while ( (strlen(str) > 0) && isspace( (unsigned char) str[0])) str++; if (strlen(str) > 0) ADD (str, type); md++; -- cgit v1.2.3