[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r11688 - in Extractor/src: common main plugins
From: |
gnunet |
Subject: |
[GNUnet-SVN] r11688 - in Extractor/src: common main plugins |
Date: |
Sat, 12 Jun 2010 16:41:25 +0200 |
Author: grothoff
Date: 2010-06-12 16:41:25 +0200 (Sat, 12 Jun 2010)
New Revision: 11688
Modified:
Extractor/src/common/pack.c
Extractor/src/main/extract.c
Extractor/src/plugins/exiv2_extractor.cc
Log:
pass unsigned chars only to isXXXX functions and simplify code
Modified: Extractor/src/common/pack.c
===================================================================
--- Extractor/src/common/pack.c 2010-06-12 14:23:43 UTC (rev 11687)
+++ Extractor/src/common/pack.c 2010-06-12 14:41:25 UTC (rev 11688)
@@ -79,7 +79,7 @@
{
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 @@
{
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);
Modified: Extractor/src/main/extract.c
===================================================================
--- Extractor/src/main/extract.c 2010-06-12 14:23:43 UTC (rev 11687)
+++ Extractor/src/main/extract.c 2010-06-12 14:41:25 UTC (rev 11688)
@@ -353,32 +353,6 @@
/**
- * 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<strlen(temp);i++ ) {
- if (! isalnum(temp[i]) )
- temp[i] = '_';
- else
- temp[i] = tolower( (unsigned int) temp[i]);
- }
- return temp;
-}
-
-
-/**
* Entry in the map we construct for each file.
*/
struct BibTexMap
@@ -513,14 +487,12 @@
fn);
else
{
- tya = str_splice (btm[0].value,
- btm[1].value,
- btm[2].value);
fprintf (stdout,
- "@%s %s { ",
+ "@%s %.5s%.5s%.5s { ",
et,
- tya);
- free (tya);
+ btm[2].value,
+ btm[1].value,
+ btm[0].value);
}
Modified: Extractor/src/plugins/exiv2_extractor.cc
===================================================================
--- Extractor/src/plugins/exiv2_extractor.cc 2010-06-12 14:23:43 UTC (rev
11687)
+++ Extractor/src/plugins/exiv2_extractor.cc 2010-06-12 14:41:25 UTC (rev
11688)
@@ -54,7 +54,7 @@
if (md != exifData.end()) {
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++;
@@ -80,7 +80,7 @@
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 @@
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++;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r11688 - in Extractor/src: common main plugins,
gnunet <=