[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r8174 - in Extractor: doc src/main src/plugins src/test
From: |
gnunet |
Subject: |
[GNUnet-SVN] r8174 - in Extractor: doc src/main src/plugins src/test |
Date: |
Mon, 2 Feb 2009 22:06:42 -0700 (MST) |
Author: grothoff
Date: 2009-02-02 22:06:41 -0700 (Mon, 02 Feb 2009)
New Revision: 8174
Modified:
Extractor/doc/version.texi
Extractor/src/main/extractor.c
Extractor/src/plugins/filenameextractor.c
Extractor/src/test/mt_plugintest2.c
Log:
fixing #1430
Modified: Extractor/doc/version.texi
===================================================================
--- Extractor/doc/version.texi 2009-02-03 03:29:21 UTC (rev 8173)
+++ Extractor/doc/version.texi 2009-02-03 05:06:41 UTC (rev 8174)
@@ -1,4 +1,4 @@
address@hidden UPDATED 26 November 2008
address@hidden UPDATED-MONTH November 2008
address@hidden UPDATED 30 December 2008
address@hidden UPDATED-MONTH December 2008
@set EDITION 0.5.21
@set VERSION 0.5.21
Modified: Extractor/src/main/extractor.c
===================================================================
--- Extractor/src/main/extractor.c 2009-02-03 03:29:21 UTC (rev 8173)
+++ Extractor/src/main/extractor.c 2009-02-03 05:06:41 UTC (rev 8174)
@@ -1311,7 +1311,7 @@
if (-1 == file)
return NULL;
- size = fstatbuf.st_size;
+ size = (fstatbuf.st_size > 0xFFFFFFFF) ? 0xFFFFFFFF : fstatbuf.st_size;
if (size == 0) {
close(file);
return NULL;
Modified: Extractor/src/plugins/filenameextractor.c
===================================================================
--- Extractor/src/plugins/filenameextractor.c 2009-02-03 03:29:21 UTC (rev
8173)
+++ Extractor/src/plugins/filenameextractor.c 2009-02-03 05:06:41 UTC (rev
8174)
@@ -30,47 +30,43 @@
size_t size, struct EXTRACTOR_Keywords *prev)
{
EXTRACTOR_KeywordList *keyword;
+ struct stat fstatbuf;
const char *filenameRoot = filename;
int res;
/* get filename */
- if (filename != NULL)
- {
- for (res = strlen (filename) - 1; res >= 0; res--)
- if (filename[res] == DIR_SEPARATOR)
- {
- filenameRoot = &filename[res + 1];
- break;
- }
- keyword = malloc (sizeof (EXTRACTOR_KeywordList));
- keyword->next = prev;
- keyword->keyword = EXTRACTOR_common_convert_to_utf8 (filenameRoot,
- strlen (filenameRoot),
- nl_langinfo (CODESET));
- keyword->keywordType = EXTRACTOR_FILENAME;
- prev = keyword;
- }
-
- /* get file size */
- if (size > 0)
- {
- keyword = malloc (sizeof (EXTRACTOR_KeywordList));
- keyword->next = prev;
- keyword->keyword = malloc (14);
- keyword->keywordType = EXTRACTOR_FILE_SIZE;
-
- if (size >= 1000000000)
- snprintf (keyword->keyword, 13, "%.2f %s", size / 1000000000.0,
- _("GB"));
- else if (size >= 1000000)
- snprintf (keyword->keyword, 13, "%.2f %s", size / 1000000.0, _("MB"));
- else if (size >= 1000)
- snprintf (keyword->keyword, 13, "%.2f %s", size / 1000.0, _("KB"));
- else
- snprintf (keyword->keyword, 13, "%.2f %s", (double) size, _("Bytes"));
-
- prev = keyword;
- }
-
+ if (filename == NULL)
+ return prev;
+ for (res = strlen (filename) - 1; res >= 0; res--)
+ if (filename[res] == DIR_SEPARATOR)
+ {
+ filenameRoot = &filename[res + 1];
+ break;
+ }
+ keyword = malloc (sizeof (EXTRACTOR_KeywordList));
+ keyword->next = prev;
+ keyword->keyword = EXTRACTOR_common_convert_to_utf8 (filenameRoot,
+ strlen (filenameRoot),
+ nl_langinfo (CODESET));
+ keyword->keywordType = EXTRACTOR_FILENAME;
+ prev = keyword;
+ if (-1 == STAT(filename, &fstatbuf))
+ return prev;
+ keyword = malloc (sizeof (EXTRACTOR_KeywordList));
+ keyword->next = prev;
+ keyword->keyword = malloc (14);
+ keyword->keywordType = EXTRACTOR_FILE_SIZE;
+
+ if (size >= 1000000000)
+ snprintf (keyword->keyword, 14, "%.2f %s", fstatbuf.st_size / 1000000000.0,
+ _("GB"));
+ else if (size >= 1000000)
+ snprintf (keyword->keyword, 14, "%.2f %s", fstatbuf.st_size / 1000000.0,
_("MB"));
+ else if (size >= 1000)
+ snprintf (keyword->keyword, 14, "%.2f %s", fstatbuf.st_size / 1000.0,
_("KB"));
+ else
+ snprintf (keyword->keyword, 14, "%.2f %s", (double) fstatbuf.st_size,
_("Bytes"));
+
+ prev = keyword;
return prev;
}
Modified: Extractor/src/test/mt_plugintest2.c
===================================================================
--- Extractor/src/test/mt_plugintest2.c 2009-02-03 03:29:21 UTC (rev 8173)
+++ Extractor/src/test/mt_plugintest2.c 2009-02-03 05:06:41 UTC (rev 8174)
@@ -1,3 +1,22 @@
+/*
+ This file is part of libextractor.
+ (C) 2007, 2008, 2009 Vidyut Samanta and Christian Grothoff
+
+ libextractor is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ libextractor is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with libextractor; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+ */
/**
* @file test/mt-plugintest1.c
* @brief test extractor plugin load/unload from multiple threads
@@ -22,7 +41,6 @@
{
struct TaskData *td = (struct TaskData *) arg;
EXTRACTOR_ExtractorList *el;
- int i;
while (!done)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r8174 - in Extractor: doc src/main src/plugins src/test,
gnunet <=