Commit 225f2111 authored by John (J5) Palmieri's avatar John (J5) Palmieri
Browse files

fix most warnings

* remove some unused vars
* correctly cast vars
* handle deprecated enums in switch statments by using default:
* unused wanrings still remain in some places
parent 9a70f012
......@@ -1775,7 +1775,7 @@ _pygi_argument_to_object (GIArgument *arg,
break;
}
case GI_TYPE_TAG_ERROR:
if (pyglib_error_check (&arg->v_pointer)) {
if (pyglib_error_check ( (GError **) &arg->v_pointer)) {
PyObject *err_type;
PyObject *err_value;
PyObject *err_trace;
......
......@@ -150,7 +150,6 @@ _sequence_cache_new (GITypeInfo *type_info,
{
PyGISequenceCache *sc;
GITypeInfo *item_type_info;
GITypeTag item_type_tag;
GITransfer item_transfer;
sc = g_slice_new0 (PyGISequenceCache);
......@@ -243,6 +242,8 @@ _callback_cache_new (GIArgInfo *arg_info,
PyGICallbackCache *cc;
cc = g_slice_new0 (PyGICallbackCache);
( (PyGIArgCache *)cc)->destroy_notify = (GDestroyNotify)_callback_cache_free_func;
cc->user_data_index = g_arg_info_get_closure (arg_info);
if (cc->user_data_index != -1)
cc->user_data_index += child_offset;
......@@ -736,8 +737,6 @@ _arg_cache_new_for_interface (GIInterfaceInfo *iface_info,
(callable_cache->function_type == PYGI_FUNCTION_TYPE_METHOD ||
callable_cache->function_type == PYGI_FUNCTION_TYPE_VFUNC) ? 1: 0;
GI_IS_INTERFACE_INFO (iface_info);
info_type = g_base_info_get_type ( (GIBaseInfo *)iface_info);
/* Callbacks are special cased */
......@@ -861,8 +860,6 @@ _arg_cache_new (GITypeInfo *type_info,
gssize child_offset = 0;
GITypeTag type_tag;
GI_IS_TYPE_INFO (type_info);
type_tag = g_type_info_get_tag (type_info);
if (callable_cache != NULL)
......
......@@ -192,6 +192,9 @@ _pygi_info_new (GIBaseInfo *info)
case GI_INFO_TYPE_UNRESOLVED:
type = &PyGIUnresolvedInfo_Type;
break;
default:
g_assert_not_reached();
break;
}
self = (PyGIBaseInfo *) type->tp_alloc (type, 0);
......@@ -484,6 +487,7 @@ _pygi_g_type_info_size (GITypeInfo *type_info)
case GI_INFO_TYPE_ARG:
case GI_INFO_TYPE_TYPE:
case GI_INFO_TYPE_UNRESOLVED:
default:
g_assert_not_reached();
break;
}
......@@ -862,7 +866,9 @@ pygi_g_struct_info_is_simple (GIStructInfo *struct_info)
case GI_INFO_TYPE_ARG:
case GI_INFO_TYPE_TYPE:
case GI_INFO_TYPE_UNRESOLVED:
default:
g_assert_not_reached();
break;
}
g_base_info_unref (info);
......
......@@ -472,7 +472,7 @@ _invoke_marshal_in_args (PyGIInvokeState *state, PyGICallableCache *cache)
if (arg_cache->from_py_marshaller != NULL) {
if (!arg_cache->allow_none && py_arg == Py_None) {
PyErr_Format (PyExc_TypeError,
"Argument %i does not allow None as a value",
"Argument %zd does not allow None as a value",
i);
pygi_marshal_cleanup_args_from_py_parameter_fail (state,
......
......@@ -25,8 +25,6 @@
#include <string.h>
#include <time.h>
#include <datetime.h>
#include <pygobject.h>
#include <pyglib-python-compat.h>
......@@ -406,7 +404,7 @@ _pygi_marshal_from_py_uint64 (PyGIInvokeState *state,
if (PyInt_Check (py_long)) {
long long_ = PyInt_AsLong (py_long);
if (long_ < 0) {
PyErr_Format (PyExc_ValueError, "%ld not in range %d to %llu",
PyErr_Format (PyExc_ValueError, "%ld not in range %d to %lu",
long_, 0, G_MAXUINT64);
return FALSE;
}
......@@ -444,7 +442,7 @@ _pygi_marshal_from_py_uint64 (PyGIInvokeState *state,
Py_DECREF (py_str);
PyErr_Format (PyExc_ValueError, "%s not in range %d to %llu",
PyErr_Format (PyExc_ValueError, "%s not in range %d to %lu",
long_str, 0, G_MAXUINT64);
g_free (long_str);
......@@ -452,7 +450,7 @@ _pygi_marshal_from_py_uint64 (PyGIInvokeState *state,
}
if (ulong_ > G_MAXUINT64) {
PyErr_Format (PyExc_ValueError, "%llu not in range %d to %llu", ulong_, 0, G_MAXUINT64);
PyErr_Format (PyExc_ValueError, "%lu not in range %d to %lu", ulong_, 0, G_MAXUINT64);
return FALSE;
}
......@@ -898,10 +896,11 @@ _pygi_marshal_from_py_glist (PyGIInvokeState *state,
list_ = g_list_append (list_, item.v_pointer);
continue;
err:
/* FIXME: clean up list
if (sequence_cache->item_cache->from_py_cleanup != NULL) {
PyGIMarshalCleanupFunc cleanup = sequence_cache->item_cache->from_py_cleanup;
}
*/
g_list_free (list_);
_PyGI_ERROR_PREFIX ("Item %i: ", i);
return FALSE;
......@@ -964,9 +963,11 @@ _pygi_marshal_from_py_gslist (PyGIInvokeState *state,
list_ = g_slist_append (list_, item.v_pointer);
continue;
err:
/* FIXME: Clean up list
if (sequence_cache->item_cache->from_py_cleanup != NULL) {
PyGIMarshalCleanupFunc cleanup = sequence_cache->item_cache->from_py_cleanup;
}
*/
g_slist_free (list_);
_PyGI_ERROR_PREFIX ("Item %i: ", i);
......@@ -1316,13 +1317,13 @@ _pygi_marshal_from_py_interface_struct (PyGIInvokeState *state,
arg->v_pointer = value;
return TRUE;
} else if (iface_cache->is_foreign) {
gboolean success;
PyObject *success;
success = pygi_struct_foreign_convert_to_g_argument (py_arg,
iface_cache->interface_info,
arg_cache->transfer,
arg);
return success;
return (success == Py_None);
} else if (!PyObject_IsInstance (py_arg, iface_cache->py_type)) {
PyErr_Format (PyExc_TypeError, "Expected %s, but got %s",
iface_cache->type_name,
......
......@@ -26,7 +26,6 @@
#include <string.h>
#include <time.h>
#include <datetime.h>
#include <pygobject.h>
#include <pyglib-python-compat.h>
......@@ -276,7 +275,7 @@ _pygi_marshal_to_py_array (PyGIInvokeState *state,
if (seq_cache->fixed_size >= 0) {
len = seq_cache->fixed_size;
} else if (seq_cache->is_zero_terminated) {
len = g_strv_length (arg->v_string);
len = g_strv_length ((gchar **)arg->v_pointer);
} else {
GIArgument *len_arg = state->args[seq_cache->len_arg_index];
len = len_arg->v_long;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment