summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2013-03-01 09:20:43 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2013-03-01 09:20:43 (GMT)
commit80a2bc2ab0f8f831a45bba4bbbbad4b15cbf0645 (patch)
tree704e87f3f08b88606e559869d1c32c7e8b418d04 /plugins
parentf95e0761e1284b7ab48244452f56d96803c48b87 (diff)
Fixed GCC warnings.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@342 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'plugins')
-rw-r--r--plugins/pychrysa/Makefile.am3
-rw-r--r--plugins/pychrysa/analysis/roptions.c6
-rw-r--r--plugins/pychrysa/arch/processor.c4
-rw-r--r--plugins/pychrysa/plugin.c129
-rw-r--r--plugins/pychrysa/quirks.c2
5 files changed, 55 insertions, 89 deletions
diff --git a/plugins/pychrysa/Makefile.am b/plugins/pychrysa/Makefile.am
index 4fe8a4e..148104f 100644
--- a/plugins/pychrysa/Makefile.am
+++ b/plugins/pychrysa/Makefile.am
@@ -22,7 +22,8 @@ pychrysa_la_LDFLAGS = -module -avoid-version $(LIBGTK_LIBS) $(LIBXML_LIBS) $(LIB
-L../../src/plugins/.libs -lplugins
-INCLUDES = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_CFLAGS) $(LIBPYGOBJECT_CFLAGS)
+INCLUDES = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) $(LIBPYTHON_CFLAGS) $(LIBPYGOBJECT_CFLAGS) \
+ -I../../src
AM_CPPFLAGS =
diff --git a/plugins/pychrysa/analysis/roptions.c b/plugins/pychrysa/analysis/roptions.c
index a2b72e1..5423f93 100644
--- a/plugins/pychrysa/analysis/roptions.c
+++ b/plugins/pychrysa/analysis/roptions.c
@@ -25,6 +25,9 @@
#include "roptions.h"
+#include <pygobject.h>
+
+
#include "../format/executable.h"
@@ -89,7 +92,8 @@ static PyObject *py_rendering_options_new(PyTypeObject *type, PyObject *args, Py
result = (py_rendering_options *)type->tp_alloc(type, 0);
- _executable = py_executable_get_glib_instance(executable);
+ _executable = G_EXE_FORMAT(pygobject_get(executable));
+ if (_executable == NULL) return NULL;
g_object_ref(G_OBJECT(_executable));
result->glib = g_rendering_options_new(_executable);
diff --git a/plugins/pychrysa/arch/processor.c b/plugins/pychrysa/arch/processor.c
index cc1113a..f36b7f0 100644
--- a/plugins/pychrysa/arch/processor.c
+++ b/plugins/pychrysa/arch/processor.c
@@ -138,7 +138,7 @@ bool add_arch_processor_type_to_python_module(PyObject *module)
Py_INCREF(&py_arch_processor_type_type);
ret = PyModule_AddObject(module, "ArchProcessorType", (PyObject *)&py_arch_processor_type_type);
- __test = &py_arch_processor_type_type;
+ __test = (PyObject *)&py_arch_processor_type_type;
return (ret == 0);
@@ -283,6 +283,6 @@ bool add_arch_processor_to_python_module(PyObject *module)
result = add_arch_processor_type_to_python_module(module);
- return (ret == 0);
+ return (ret == 0 && result);
}
diff --git a/plugins/pychrysa/plugin.c b/plugins/pychrysa/plugin.c
index e2ba78b..dd2517b 100644
--- a/plugins/pychrysa/plugin.c
+++ b/plugins/pychrysa/plugin.c
@@ -28,6 +28,8 @@
#include <pygobject.h>
+#include <common/extstr.h>
+
#include "../../src/analysis/binary.h"
#include "../../src/plugins/plugin-int.h"
@@ -310,10 +312,10 @@ GPluginModule *g_python_plugin_new(const char *modname, const char *filename)
G_PLUGIN_MODULE(result)->name = stradd(G_PLUGIN_MODULE(result)->name, ".py");
G_PLUGIN_MODULE(result)->filename = strdup(G_PLUGIN_MODULE(result)->name);
- G_PLUGIN_MODULE(result)->init = g_python_plugin_do_init;
- G_PLUGIN_MODULE(result)->get_action = g_python_plugin_get_action;
+ G_PLUGIN_MODULE(result)->init = (init_plugin_fc)g_python_plugin_do_init;
+ G_PLUGIN_MODULE(result)->get_action = (get_plugin_action_fc)g_python_plugin_get_action;
- G_PLUGIN_MODULE(result)->is_matching = g_python_plugin_is_matching;
+ G_PLUGIN_MODULE(result)->is_matching = (is_matching_fc)g_python_plugin_is_matching;
result->module = module;
result->instance = instance;
@@ -436,7 +438,7 @@ static MatchingFormatAction g_python_plugin_is_matching(const GPythonPlugin *plu
args = PyTuple_New(2);
PyTuple_SetItem(args, 0, PyString_FromString(*filename));
- PyTuple_SetItem(args, 1, PyByteArray_FromStringAndSize(*data, *length));
+ PyTuple_SetItem(args, 1, PyByteArray_FromStringAndSize((char *)*data, *length));
value = run_python_method(plugin->instance, "is_matching", args);
@@ -836,102 +838,61 @@ bool add_plugin_to_python_module(PyObject *module)
{
int ret; /* Bilan d'un appel */
+ static PyMethodDef pychrysa_plugin_methods[] = {
+ {
+ "init", (PyCFunction)pychrysa_plugin_init,
+ METH_VARARGS,
+ "Initialize the plugin."
+ },
+ {
+ "get_action", (PyCFunction)pychrysa_plugin_get_action,
+ METH_NOARGS,
+ "Register the plugin for given actions."
+ },
+ {
+ "is_matching", (PyCFunction)pychrysa_plugin_is_matching,
+ METH_VARARGS,
+ "Define if the given file can be handled."
+ },
+ {
+ "handle_debugger", (PyCFunction)pychrysa_plugin_handle_debugger,
+ METH_VARARGS,
+ "Be notify about debugger attaching or detaching."
+ },
+ {
+ "run", (PyCFunction)pychrysa_plugin_run,
+ METH_VARARGS,
+ "Run the plugin for a specific action."
+ },
+ { NULL }
+ };
-static PyMethodDef pychrysa_plugin_methods[] = {
- {
- "init", (PyCFunction)pychrysa_plugin_init,
- METH_VARARGS,
- "Initialize the plugin."
- },
- {
- "get_action", (PyCFunction)pychrysa_plugin_get_action,
- METH_NOARGS,
- "Register the plugin for given actions."
- },
- {
- "is_matching", (PyCFunction)pychrysa_plugin_is_matching,
- METH_VARARGS,
- "Define if the given file can be handled."
- },
- {
- "handle_debugger", (PyCFunction)pychrysa_plugin_handle_debugger,
- METH_VARARGS,
- "Be notify about debugger attaching or detaching."
- },
- {
- "run", (PyCFunction)pychrysa_plugin_run,
- METH_VARARGS,
- "Run the plugin for a specific action."
- },
- NULL
-};
-
+ static PyTypeObject pychrysa_plugin_type = {
-static PyTypeObject pychrysa_plugin_type = {
+ PyObject_HEAD_INIT(NULL)
- PyObject_HEAD_INIT(NULL)
+ .tp_name = "plugin.Plugin",
+ .tp_basicsize = sizeof(pychrysa_plugin),
-#if PY_VERSION_HEX < 0x03000000
- 0, /*ob_size*/
-#endif
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- "plugin.Plugin", /* tp_name */
- sizeof(pychrysa_plugin), /* tp_basicsize */
- 0, /* tp_itemsize */
- 0, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_reserved / tp_compare */
- 0, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
- "PyCHRYSA Plugin objects", /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
- 0, /* tp_iter */
- 0, /* tp_iternext */
- pychrysa_plugin_methods, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- 0, /* tp_alloc */
- (newfunc)pychrysa_plugin_new, /* tp_new */
-};
+ .tp_doc = "PyChrysalide plugin objects",
+ .tp_methods = pychrysa_plugin_methods,
+ .tp_new = (newfunc)pychrysa_plugin_new
+ };
if (PyType_Ready(&pychrysa_plugin_type) < 0)
return false;
-
if (!pychrysa_plugin_define_constants(pychrysa_plugin_type.tp_dict))
return false;
-
-
-
Py_INCREF(&pychrysa_plugin_type);
- PyModule_AddObject(module, "Plugin", (PyObject *)&pychrysa_plugin_type);
-
-
- return true; /* FIXME */
+ ret = PyModule_AddObject(module, "Plugin", (PyObject *)&pychrysa_plugin_type);
+ return (ret == 0);
}
diff --git a/plugins/pychrysa/quirks.c b/plugins/pychrysa/quirks.c
index 2813fb2..eee4027 100644
--- a/plugins/pychrysa/quirks.c
+++ b/plugins/pychrysa/quirks.c
@@ -56,7 +56,7 @@ static GQuark pygobject_wrapper_key_fake = 0;
static void pygobject_data_free_fake(PyGObjectData_fake *data)
{
- PyGILState_STATE state; /* Etat interne de Python */
+ //PyGILState_STATE state; /* Etat interne de Python */
GSList *iter; /* Boucle de parcours */
GSList *old; /* Sauvegarde avant libération */