commit 9e58928780f9fd78346bc50380fd72ea91ccc9ff
parent 0074a0a3e70af5f0611063da3b197a529f741426
Author: Christian Grothoff <christian@grothoff.org>
Date: Mon, 30 Jul 2012 12:59:43 +0000
misc minor fixes
Diffstat:
8 files changed, 82 insertions(+), 13 deletions(-)
diff --git a/src/main/Makefile.am b/src/main/Makefile.am
@@ -58,10 +58,6 @@ extract_SOURCES = \
LDADD = \
$(top_builddir)/src/main/libextractor.la
-if HAVE_ZZUF
- fuzz_tests=fuzz_default.sh fuzz_thumbnail.sh
-endif
-
TESTS_ENVIRONMENT = testdatadir=$(top_srcdir)/test
TESTS_ENVIRONMENT += bindir=${bindir}
@@ -70,7 +66,7 @@ check_PROGRAMS = \
test_plugin_loading \
test_plugin_load_multi
-TESTS = $(check_PROGRAMS) $(fuzz_tests)
+TESTS = $(check_PROGRAMS)
test_trivial_SOURCES = \
test_trivial.c
diff --git a/src/main/extractor_plugins.c b/src/main/extractor_plugins.c
@@ -237,6 +237,7 @@ EXTRACTOR_plugin_add (struct EXTRACTOR_PluginList *prev,
}
if (NULL == (result = malloc (sizeof (struct EXTRACTOR_PluginList))))
return prev;
+ memset (result, 0, sizeof (struct EXTRACTOR_PluginList));
result->next = prev;
if (NULL == (result->short_libname = strdup (library)))
{
diff --git a/src/main/test_plugin_load_multi.c b/src/main/test_plugin_load_multi.c
@@ -1,3 +1,22 @@
+/*
+ This file is part of libextractor.
+ (C) 2002, 2003, 2004, 2005, 2006, 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 3, 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 main/test_plugin_load_multi.c
* @brief testcase for libextractor plugin loading that loads the same
@@ -8,6 +27,7 @@
#include "platform.h"
#include "extractor.h"
+
static int
testLoadPlugins ()
{
@@ -16,13 +36,13 @@ testLoadPlugins ()
el1 = EXTRACTOR_plugin_add_defaults (EXTRACTOR_OPTION_DEFAULT_POLICY);
el2 = EXTRACTOR_plugin_add_defaults (EXTRACTOR_OPTION_DEFAULT_POLICY);
- if ((el1 == NULL) || (el2 == NULL))
+ if ((NULL == el1) || (NULL == el2))
{
fprintf (stderr,
"Failed to load default plugins!\n");
- if (el1 != NULL)
+ if (NULL != el1)
EXTRACTOR_plugin_remove_all (el1);
- if (el2 != NULL)
+ if (NULL != el2)
EXTRACTOR_plugin_remove_all (el2);
return 1;
}
@@ -31,6 +51,7 @@ testLoadPlugins ()
return 0;
}
+
int
main (int argc, char *argv[])
{
@@ -40,3 +61,5 @@ main (int argc, char *argv[])
ret += testLoadPlugins ();
return ret;
}
+
+/* end of test_plugin_load_multi.c */
diff --git a/src/main/test_plugin_loading.c b/src/main/test_plugin_loading.c
@@ -1,3 +1,23 @@
+/*
+ This file is part of libextractor.
+ (C) 2002, 2003, 2004, 2005, 2006, 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 3, 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 main/test_plugin_loading.c
* @brief testcase for dynamic loading and unloading of plugins
@@ -17,20 +37,19 @@ main (int argc, char *argv[])
arg = EXTRACTOR_plugin_remove (arg, "mime");
arg = EXTRACTOR_plugin_remove (arg, "zip");
arg = EXTRACTOR_plugin_remove (arg, "png");
- if (arg != NULL)
+ if (NULL != arg)
{
fprintf (stderr,
"add-remove test failed!\n");
return -1;
}
-
arg = EXTRACTOR_plugin_add (NULL, "mime", NULL, EXTRACTOR_OPTION_DEFAULT_POLICY);
arg = EXTRACTOR_plugin_add (arg, "png", NULL, EXTRACTOR_OPTION_DEFAULT_POLICY);
arg = EXTRACTOR_plugin_add (arg, "zip", NULL, EXTRACTOR_OPTION_DEFAULT_POLICY);
arg = EXTRACTOR_plugin_remove (arg, "zip");
arg = EXTRACTOR_plugin_remove (arg, "mime");
arg = EXTRACTOR_plugin_remove (arg, "png");
- if (arg != NULL)
+ if (NULL != arg)
{
fprintf (stderr,
"add-remove test failed!\n");
@@ -38,3 +57,5 @@ main (int argc, char *argv[])
}
return 0;
}
+
+/* end of test_plugin_loading.c */
diff --git a/src/main/test_trivial.c b/src/main/test_trivial.c
@@ -1,3 +1,23 @@
+/*
+ This file is part of libextractor.
+ (C) 2002, 2003, 2004, 2005, 2006, 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 3, 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 main/test_trivial.c
* @brief trivial testcase for libextractor plugin loading
@@ -11,8 +31,7 @@ testLoadPlugins (enum EXTRACTOR_Options policy)
{
struct EXTRACTOR_PluginList *pl;
- pl = EXTRACTOR_plugin_add_defaults (policy);
- if (pl == NULL)
+ if (NULL == (pl = EXTRACTOR_plugin_add_defaults (policy)))
{
fprintf (stderr,
"Failed to load default plugins!\n");
@@ -33,3 +52,5 @@ main (int argc, char *argv[])
ret += testLoadPlugins (EXTRACTOR_OPTION_OUT_OF_PROCESS_NO_RESTART);
return ret;
}
+
+/* end of test_trivial.c */
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
@@ -82,3 +82,9 @@ libextractor_png_la_LIBADD = \
$(top_builddir)/src/common/libextractor_common.la
EXTRA_DIST = template_extractor.c
+
+if HAVE_ZZUF
+ fuzz_tests=fuzz_default.sh fuzz_thumbnail.sh
+endif
+
+TESTS = $(fuzz_tests)
+\ No newline at end of file
diff --git a/src/main/fuzz_default.sh b/src/plugins/fuzz_default.sh
diff --git a/src/main/fuzz_thumbnail.sh b/src/plugins/fuzz_thumbnail.sh