[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r4311 - in Extractor/src: main plugins plugins/ole2 plugins
From: |
grothoff |
Subject: |
[GNUnet-SVN] r4311 - in Extractor/src: main plugins plugins/ole2 plugins/printable plugins/rpm |
Date: |
Fri, 19 Jan 2007 15:45:02 -0800 (PST) |
Author: grothoff
Date: 2007-01-19 15:44:56 -0800 (Fri, 19 Jan 2007)
New Revision: 4311
Modified:
Extractor/src/main/extract.c
Extractor/src/main/extractor.c
Extractor/src/plugins/lowerextractor.c
Extractor/src/plugins/nsfeextractor.c
Extractor/src/plugins/ole2/ole2extractor.c
Extractor/src/plugins/printable/dictionary-builder.c
Extractor/src/plugins/qtextractor.c
Extractor/src/plugins/rpm/rpmextractor.c
Extractor/src/plugins/tarextractor.c
Extractor/src/plugins/zipextractor.c
Log:
minor bugfixes
Modified: Extractor/src/main/extract.c
===================================================================
--- Extractor/src/main/extract.c 2007-01-19 22:14:29 UTC (rev 4310)
+++ Extractor/src/main/extract.c 2007-01-19 23:44:56 UTC (rev 4311)
@@ -405,7 +405,10 @@
if ( pages )
fprintf(handle, " pages = \"%s\"%s\n", pages,
(last == pages)?"":",");
-
+ if (month != NULL)
+ free(month);
+ if (year != NULL)
+ free(year);
fprintf(handle, "}\n\n");
}
}
Modified: Extractor/src/main/extractor.c
===================================================================
--- Extractor/src/main/extractor.c 2007-01-19 22:14:29 UTC (rev 4310)
+++ Extractor/src/main/extractor.c 2007-01-19 23:44:56 UTC (rev 4311)
@@ -1247,8 +1247,7 @@
const EXTRACTOR_KeywordType type,
const unsigned int options,
EXTRACTOR_KeywordList ** list,
- EXTRACTOR_KeywordList * current)
-{
+ EXTRACTOR_KeywordList * current) {
EXTRACTOR_KeywordList *first;
EXTRACTOR_KeywordList *pos;
EXTRACTOR_KeywordList *prev;
@@ -1257,37 +1256,32 @@
first = *list;
pos = first;
prev = NULL;
- while (pos != NULL)
- {
- if (pos == current)
- {
- prev = pos;
- pos = current->next;
- }
- if (pos == NULL)
- break;
- if ( (0 == strcmp (pos->keyword, keyword)) &&
- ( (pos->keywordType == type) ||
- (((options & EXTRACTOR_DUPLICATES_TYPELESS) > 0)) ||
- ( ((options & EXTRACTOR_DUPLICATES_REMOVE_UNKNOWN) > 0) &&
- (pos->keywordType == EXTRACTOR_UNKNOWN)) ) )
- {
- /* remove! */
- if (prev == NULL)
- first = pos->next;
- else
- prev->next = pos->next;
- next = pos->next;
- free (pos->keyword);
- free (pos);
- pos = next;
- }
+ while (pos != NULL) {
+ if (pos == current) {
+ prev = pos;
+ pos = current->next;
+ }
+ if (pos == NULL)
+ break;
+ if ( (0 == strcmp (pos->keyword, keyword)) &&
+ ( (pos->keywordType == type) ||
+ (((options & EXTRACTOR_DUPLICATES_TYPELESS) > 0)) ||
+ ( ((options & EXTRACTOR_DUPLICATES_REMOVE_UNKNOWN) > 0) &&
+ (pos->keywordType == EXTRACTOR_UNKNOWN)) ) ) {
+ /* remove! */
+ if (prev == NULL)
+ first = pos->next;
else
- {
- prev = pos;
- pos = pos->next;
- }
- } /* end while */
+ prev->next = pos->next;
+ next = pos->next;
+ free (pos->keyword);
+ free (pos);
+ pos = next;
+ } else {
+ prev = pos;
+ pos = pos->next;
+ }
+ } /* end while */
*list = first;
}
Modified: Extractor/src/plugins/lowerextractor.c
===================================================================
--- Extractor/src/plugins/lowerextractor.c 2007-01-19 22:14:29 UTC (rev
4310)
+++ Extractor/src/plugins/lowerextractor.c 2007-01-19 23:44:56 UTC (rev
4311)
@@ -43,7 +43,7 @@
unsigned int mem, needed, i;
pos = prev;
- lower = 0;
+ lower = NULL;
mem = 0;
while (pos != NULL)
@@ -51,7 +51,7 @@
needed = strlen(pos->keyword) + 1;
if (needed > mem)
{
- lower = (char *) (lower) ? realloc(lower, needed) : malloc(needed);
+ lower = (lower == NULL) ? realloc(lower, needed) : malloc(needed);
mem = needed;
}
Modified: Extractor/src/plugins/nsfeextractor.c
===================================================================
--- Extractor/src/plugins/nsfeextractor.c 2007-01-19 22:14:29 UTC (rev
4310)
+++ Extractor/src/plugins/nsfeextractor.c 2007-01-19 23:44:56 UTC (rev
4311)
@@ -88,10 +88,7 @@
s = malloc( length + 1 );
- if( data != NULL )
- {
- strncpy( s, data, length );
- }
+ strncpy( s, data, length );
s[ strlen( data ) ] = '\0';
Modified: Extractor/src/plugins/ole2/ole2extractor.c
===================================================================
--- Extractor/src/plugins/ole2/ole2extractor.c 2007-01-19 22:14:29 UTC (rev
4310)
+++ Extractor/src/plugins/ole2/ole2extractor.c 2007-01-19 23:44:56 UTC (rev
4311)
@@ -156,11 +156,11 @@
/* convert other formats? */
contents = g_strdup_value_contents(gval);
}
+ if (contents == NULL)
+ return;
if ( (strlen(contents) > 0) &&
(contents[strlen(contents)-1] == '\n') )
contents[strlen(contents)-1] = '\0';
- if (contents == NULL)
- return;
pos = 0;
while (tmap[pos].text != NULL) {
if (0 == strcmp(tmap[pos].text,
@@ -412,8 +412,10 @@
where += length * 2 + 1;
length = lbuffer[where++];
if ( (where + 2 * length >= lcbSttbSavedBy) ||
- (where + 2 * length + 1 <= where) )
+ (where + 2 * length + 1 <= where) ) {
+ free(author);
break;
+ }
filename = convertToUtf8((const char*) &lbuffer[where],
length * 2,
"UTF-16BE");
Modified: Extractor/src/plugins/printable/dictionary-builder.c
===================================================================
--- Extractor/src/plugins/printable/dictionary-builder.c 2007-01-19
22:14:29 UTC (rev 4310)
+++ Extractor/src/plugins/printable/dictionary-builder.c 2007-01-19
23:44:56 UTC (rev 4311)
@@ -127,10 +127,10 @@
words[cnt] = strdup(line);
cnt++;
memset(&line[0], 0, 2048);
- if (cnt > ALLOCSIZE) {
+ if (cnt >= ALLOCSIZE) {
fprintf(stderr,
_("Increase ALLOCSIZE (in %s).\n"),
- __FILE__);
+ __FILE__);
exit(-1);
}
}
@@ -206,5 +206,6 @@
bn,
ADDR_PER_ELEMENT,
bf.bitArraySize);
+ free(charset);
return 0;
}
Modified: Extractor/src/plugins/qtextractor.c
===================================================================
--- Extractor/src/plugins/qtextractor.c 2007-01-19 22:14:29 UTC (rev 4310)
+++ Extractor/src/plugins/qtextractor.c 2007-01-19 23:44:56 UTC (rev 4311)
@@ -558,7 +558,7 @@
if (len + sizeof(InternationalText) > as)
return 0; /* invalid */
lang = ntohs(txt->language);
- if (lang > 138)
+ if (lang >= sizeof(languages) / sizeof(char*))
return 0; /* invalid */
addKeyword(EXTRACTOR_LANGUAGE,
languages[lang],
Modified: Extractor/src/plugins/rpm/rpmextractor.c
===================================================================
--- Extractor/src/plugins/rpm/rpmextractor.c 2007-01-19 22:14:29 UTC (rev
4310)
+++ Extractor/src/plugins/rpm/rpmextractor.c 2007-01-19 23:44:56 UTC (rev
4311)
@@ -2705,7 +2705,7 @@
int_32 pFlags = RPMSENSE_EQUAL;
const char ** provides = NULL;
const char ** providesEVR = NULL;
- rpmTagType pnt, pvt;
+ rpmTagType pnt, pvt = RPM_NULL_TYPE;
int_32 * provideFlags = NULL;
int providesCount;
int i;
Modified: Extractor/src/plugins/tarextractor.c
===================================================================
--- Extractor/src/plugins/tarextractor.c 2007-01-19 22:14:29 UTC (rev
4310)
+++ Extractor/src/plugins/tarextractor.c 2007-01-19 23:44:56 UTC (rev
4311)
@@ -805,6 +805,7 @@
strcpy(format + format_length, " TAR");
prev = addKeyword(EXTRACTOR_FORMAT, format, prev);
}
+ free(format);
}
}
}
Modified: Extractor/src/plugins/zipextractor.c
===================================================================
--- Extractor/src/plugins/zipextractor.c 2007-01-19 22:14:29 UTC (rev
4310)
+++ Extractor/src/plugins/zipextractor.c 2007-01-19 23:44:56 UTC (rev
4311)
@@ -372,16 +372,16 @@
/* note: this free()'s the info list as it goes */
info = start;
while (NULL != info) {
- if (strlen(info->filename)){
- EXTRACTOR_KeywordList * keyword = malloc(sizeof(EXTRACTOR_KeywordList));
- keyword->next = prev;
- keyword->keyword = strdup(info->filename);
- keyword->keywordType = EXTRACTOR_FILENAME;
- prev = keyword;
- }
- if (info->filename != NULL)
+ if (info->filename != NULL) {
+ if (strlen(info->filename)){
+ EXTRACTOR_KeywordList * keyword = malloc(sizeof(EXTRACTOR_KeywordList));
+ keyword->next = prev;
+ keyword->keyword = strdup(info->filename);
+ keyword->keywordType = EXTRACTOR_FILENAME;
+ prev = keyword;
+ }
free(info->filename);
-
+ }
if (strlen(info->comment)){
EXTRACTOR_KeywordList * keyword = malloc(sizeof(EXTRACTOR_KeywordList));
keyword->next = prev;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r4311 - in Extractor/src: main plugins plugins/ole2 plugins/printable plugins/rpm,
grothoff <=