summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Andres <ma@suse.de>2011-10-12 12:27:17 +0200
committerMichael Andres <ma@suse.de>2011-10-12 12:27:17 +0200
commit4512f5ad4442808f75e649c7ce008f818ca1757f (patch)
tree7e2dacf587498736e308422af0490d559ed70fd7
parent376721d9a011b4aad82e6db428e47565e070df15 (diff)
downloadlibzypp-bindings-4512f5ad4442808f75e649c7ce008f818ca1757f.tar.gz
libzypp-bindings-4512f5ad4442808f75e649c7ce008f818ca1757f.tar.bz2
libzypp-bindings-4512f5ad4442808f75e649c7ce008f818ca1757f.zip
Fix random data returned in a function
-rw-r--r--CMakeLists.txt2
-rw-r--r--libzypp-bindings.spec.cmake2
-rw-r--r--swig/Callbacks.i43
3 files changed, 27 insertions, 20 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 08365d7..622e8cc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 2.8)
ENABLE_TESTING()
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fno-strict-aliasing")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -fno-strict-aliasing")
#
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
diff --git a/libzypp-bindings.spec.cmake b/libzypp-bindings.spec.cmake
index 474884f..0630059 100644
--- a/libzypp-bindings.spec.cmake
+++ b/libzypp-bindings.spec.cmake
@@ -41,7 +41,7 @@ cmake -DCMAKE_INSTALL_PREFIX=%{prefix} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SKIP_RPATH=1 \
..
-# the swig compile jobs take a lot of memory, so don't use %jobs here
+# the swig compile jobs take a lot of memory, so don't use jobs here
make -j1
%check
diff --git a/swig/Callbacks.i b/swig/Callbacks.i
index 12c28a1..9a91ddb 100644
--- a/swig/Callbacks.i
+++ b/swig/Callbacks.i
@@ -20,7 +20,7 @@
* Helpers
*
*/
-
+
/*
* Action
* Symbol representation of :abort, :retry, and :ignore
@@ -35,6 +35,7 @@ static Target_Type action_abort()
value = ID2SYM(rb_intern("abort"));
return value;
#endif
+ return 0; // fallback
}
static Target_Type action_retry()
@@ -45,6 +46,7 @@ static Target_Type action_retry()
value = ID2SYM(rb_intern("retry"));
return value;
#endif
+ return 0; // fallback
}
static Target_Type action_ignore()
@@ -55,6 +57,7 @@ static Target_Type action_ignore()
value = ID2SYM(rb_intern("ignore"));
return value;
#endif
+ return 0; // fallback
}
/*
@@ -74,6 +77,7 @@ static Target_Type error_no_error()
#if defined(SWIGPYTHON)
return Target_String("no_error");
#endif
+ return 0; // fallback
}
static Target_Type error_not_found()
@@ -87,6 +91,7 @@ static Target_Type error_not_found()
#if defined(SWIGPYTHON)
return Target_String("not_found");
#endif
+ return 0; // fallback
}
static Target_Type error_io()
@@ -100,6 +105,7 @@ static Target_Type error_io()
#if defined(SWIGPYTHON)
return Target_String("io");
#endif
+ return 0; // fallback
}
static Target_Type error_invalid()
@@ -113,6 +119,7 @@ static Target_Type error_invalid()
#if defined(SWIGPYTHON)
return Target_String("invalid");
#endif
+ return 0; // fallback
}
/*
@@ -263,41 +270,41 @@ target_call(Target_Type instance, const char *name, int argc, ... )
/*
* Python call with multiple args is like Array
*/
- Target_Type argv = PyTuple_New(argc);
- int i;
+ Target_Type argv = PyTuple_New(argc);
+ int i;
for (i = 0; i < argc; ++i)
{
- PyObject* arg = va_arg(ap, PyObject*);
+ PyObject* arg = va_arg(ap, PyObject*);
if (arg == NULL)
{
- arg = Py_None;
- Py_IncRef(arg);
+ arg = Py_None;
+ Py_IncRef(arg);
}
- PyTuple_SET_ITEM(argv, i, arg);
+ PyTuple_SET_ITEM(argv, i, arg);
}
- PyObject *pyfunc = PyObject_GetAttrString(instance, name);
+ PyObject *pyfunc = PyObject_GetAttrString(instance, name);
PyObject *result = NULL;
if (pyfunc == NULL)
{
- PyErr_Print();
- PyErr_Clear();
+ PyErr_Print();
+ PyErr_Clear();
goto cleanup;
}
- if (! PyCallable_Check(pyfunc))
+ if (! PyCallable_Check(pyfunc))
{
fprintf(stderr,"%s not callable\n", name);
- goto cleanup;
+ goto cleanup;
}
-
+
result = PyObject_CallObject(pyfunc, argv);
if (PyErr_Occurred())
{
fprintf(stderr,"%s returned error\n", name);
- PyErr_Print();
- PyErr_Clear();
- goto cleanup;
+ PyErr_Print();
+ PyErr_Clear();
+ goto cleanup;
}
cleanup:
@@ -426,7 +433,7 @@ struct PatchScriptReportReceiver : public zypp::callback::ReceiveReport<zypp::ta
{
Action result;
Target_Type str = Target_String(description.c_str());
- Target_Type res = target_call(instance, "patch_script_problem", 1, str );
+ Target_Type res = target_call(instance, "patch_script_problem", 1, str );
result = target2patch_script_action(res);
#if defined(SWIGPYTHON)
Py_DecRef(str);
@@ -438,7 +445,7 @@ struct PatchScriptReportReceiver : public zypp::callback::ReceiveReport<zypp::ta
/** Patch script finish. */
virtual void finish()
{
- Target_Type res = target_call(instance, "patch_script_finish", 0 );
+ Target_Type res = target_call(instance, "patch_script_finish", 0 );
#if defined(SWIGPYTHON)
if (res) Py_DecRef(res);
#endif