diff --git a/context.c b/context.c index eaa2639..9192791 100644 --- a/context.c +++ b/context.c @@ -106,13 +106,13 @@ int context_set_resolution_type(getdns_context *context, PyObject *py_value) { getdns_return_t ret; - uint64_t value; + getdns_resolution_t value; if (!PyInt_Check(py_value)) { PyErr_SetString(PyExc_AttributeError, GETDNS_RETURN_INVALID_PARAMETER_TEXT); return -1; } - if ((long)(value = PyInt_AsLong(py_value)) < 0) { + if ((long long)(value = (getdns_resolution_t)PyInt_AsLong(py_value)) < 0) { PyErr_SetString(PyExc_AttributeError, GETDNS_RETURN_INVALID_PARAMETER_TEXT); return -1; } @@ -134,13 +134,13 @@ int context_set_dns_transport(getdns_context *context, PyObject *py_value) { getdns_return_t ret; - uint64_t value; + getdns_transport_t value; if (!PyInt_Check(py_value)) { PyErr_SetString(PyExc_AttributeError, GETDNS_RETURN_INVALID_PARAMETER_TEXT); return -1; } - if ((long)(value = PyInt_AsLong(py_value)) < 0) { + if ((long long)(value = (getdns_transport_t)PyInt_AsLong(py_value)) < 0) { PyErr_SetString(PyExc_AttributeError, GETDNS_RETURN_INVALID_PARAMETER_TEXT); return -1; } @@ -296,7 +296,7 @@ context_set_dnssec_allowed_skew(getdns_context *context, PyObject *py_value) PyErr_SetString(PyExc_AttributeError, GETDNS_RETURN_INVALID_PARAMETER_TEXT); return -1; } - if ((long)(value = PyInt_AsLong(py_value)) < 0) { + if ((long)(value = (uint32_t)PyInt_AsLong(py_value)) < 0) { PyErr_SetString(PyExc_AttributeError, GETDNS_RETURN_INVALID_PARAMETER_TEXT); return -1; } @@ -314,7 +314,7 @@ int context_set_edns_maximum_udp_payload_size(getdns_context *context, PyObject *py_value) { getdns_return_t ret; - uint32_t value; + uint16_t value; if (!PyInt_Check(py_value)) { PyErr_SetString(PyExc_AttributeError, GETDNS_RETURN_INVALID_PARAMETER_TEXT); @@ -937,7 +937,7 @@ context_general(getdns_ContextObject *self, PyObject *args, PyObject *keywds) uint16_t request_type; PyDictObject *extensions_obj = 0; void *userarg; - long tid = 0; + getdns_transaction_t tid = 0; char *callback = 0; PyObject *resp; @@ -945,13 +945,13 @@ context_general(getdns_ContextObject *self, PyObject *args, PyObject *keywds) PyErr_SetString(getdns_error, GETDNS_RETURN_GENERIC_ERROR_TEXT); return NULL; } - if (!PyArg_ParseTupleAndKeywords(args, keywds, "sH|Osls", kwlist, + if (!PyArg_ParseTupleAndKeywords(args, keywds, "sH|OsLs", kwlist, &name, &request_type, &extensions_obj, &userarg, &tid, &callback)) { return NULL; } if ((resp = do_query(self->py_context, name, request_type, extensions_obj, userarg, - (long)tid, callback)) == 0) { + tid, callback)) == 0) { PyObject *err_type, *err_value, *err_traceback; PyErr_Fetch(&err_type, &err_value, &err_traceback); PyErr_Restore(err_type, err_value, err_traceback); @@ -976,7 +976,7 @@ context_address(getdns_ContextObject *self, PyObject *args, PyObject *keywds) char *name; PyDictObject *extensions_obj = 0; void *userarg; - long tid; + getdns_transaction_t tid; char *callback = 0; PyObject *resp; @@ -984,7 +984,7 @@ context_address(getdns_ContextObject *self, PyObject *args, PyObject *keywds) PyErr_SetString(getdns_error, GETDNS_RETURN_GENERIC_ERROR_TEXT); return NULL; } - if (!PyArg_ParseTupleAndKeywords(args, keywds, "s|OsHs", kwlist, + if (!PyArg_ParseTupleAndKeywords(args, keywds, "s|OsLs", kwlist, &name, &extensions_obj, &userarg, &tid, &callback)) { PyErr_SetString(getdns_error, GETDNS_RETURN_INVALID_PARAMETER_TEXT); @@ -1014,7 +1014,7 @@ context_hostname(getdns_ContextObject *self, PyObject *args, PyObject *keywds) void *address; PyDictObject *extensions_obj = 0; void *userarg; - long tid; + getdns_transaction_t tid; char * callback = 0; PyObject *resp; getdns_context *context; @@ -1023,7 +1023,7 @@ context_hostname(getdns_ContextObject *self, PyObject *args, PyObject *keywds) PyErr_SetString(getdns_error, GETDNS_RETURN_GENERIC_ERROR_TEXT); return NULL; } - if (!PyArg_ParseTupleAndKeywords(args, keywds, "O|Osls", kwlist, + if (!PyArg_ParseTupleAndKeywords(args, keywds, "O|OsLs", kwlist, &address, &extensions_obj, &userarg, &tid, &callback)) { PyErr_SetString(getdns_error, GETDNS_RETURN_INVALID_PARAMETER_TEXT); @@ -1054,7 +1054,7 @@ context_service(getdns_ContextObject *self, PyObject *args, PyObject *keywds) char *name; PyDictObject *extensions_obj = 0; void *userarg; - long tid; + getdns_transaction_t tid; char *callback = 0; PyObject *resp; getdns_context *context; @@ -1063,7 +1063,7 @@ context_service(getdns_ContextObject *self, PyObject *args, PyObject *keywds) PyErr_SetString(getdns_error, GETDNS_RETURN_GENERIC_ERROR_TEXT); return NULL; } - if (!PyArg_ParseTupleAndKeywords(args, keywds, "s|Osls", kwlist, + if (!PyArg_ParseTupleAndKeywords(args, keywds, "s|OsLs", kwlist, &name, &extensions_obj, &userarg, &tid, &callback)) { PyErr_SetString(getdns_error, GETDNS_RETURN_INVALID_PARAMETER_TEXT); diff --git a/getdns.c b/getdns.c index 3698a55..78a52be 100644 --- a/getdns.c +++ b/getdns.c @@ -178,8 +178,8 @@ callback_shim(getdns_context *context, getdns_callback_type_t type, getdns_dict /* Python callback prototype: */ /* callback(context, callback_type, response, userarg, tid) */ state = PyGILState_Ensure(); - PyObject_CallFunction(getdns_runner, "OHOsi", context, type, response, - callback_data->userarg, (int)tid); + PyObject_CallFunction(getdns_runner, "OHOsL", context, type, response, + callback_data->userarg, tid); PyGILState_Release(state); } @@ -256,7 +256,7 @@ dispatch_query(PyObject *context_capsule, uint16_t request_type, PyDictObject *extensions_obj, void *userarg, - int tid, + getdns_transaction_t tid, char *callback) { @@ -396,7 +396,7 @@ do_query(PyObject *context_capsule, uint16_t request_type, PyDictObject *extensions_obj, void *userarg, - long tid, + getdns_transaction_t tid, char *callback) { @@ -456,9 +456,9 @@ cancel_callback(PyObject *self, PyObject *args, PyObject *keywds) PyObject *context_capsule; struct getdns_context *context; getdns_return_t ret; - long tid; + getdns_transaction_t tid; - if (!PyArg_ParseTupleAndKeywords(args, keywds, "Ol", kwlist, + if (!PyArg_ParseTupleAndKeywords(args, keywds, "OL", kwlist, &context_capsule, &tid)) { return NULL; } @@ -493,17 +493,17 @@ general(PyObject *self, PyObject *args, PyObject *keywds) uint16_t request_type; PyDictObject *extensions_obj = 0; void *userarg; - long tid = 0; + getdns_transaction_t tid = 0; char *callback = 0; PyObject *my_ret; - if (!PyArg_ParseTupleAndKeywords(args, keywds, "OsH|Osls", kwlist, + if (!PyArg_ParseTupleAndKeywords(args, keywds, "OsH|OsLs", kwlist, &context_capsule, &name, &request_type, &extensions_obj, &userarg, &tid, &callback)) { return NULL; } if ((my_ret = do_query(context_capsule, name, request_type, extensions_obj, userarg, - (long)tid, callback)) == 0) { + tid, callback)) == 0) { PyErr_SetString(getdns_error, GETDNS_RETURN_GENERIC_ERROR_TEXT); return NULL; } @@ -527,7 +527,7 @@ service(PyObject *self, PyObject *args, PyObject *keywds) char *name; PyDictObject *extensions_obj = 0; void *userarg; - long tid; + getdns_transaction_t tid; char *callback = 0; PyObject *my_ret; @@ -564,11 +564,11 @@ address(PyObject *self, PyObject *args, PyObject *keywds) char *name; PyDictObject *extensions_obj = 0; void *userarg; - long tid; + getdns_transaction_t tid; char * callback = 0; PyObject *my_ret; - if (!PyArg_ParseTupleAndKeywords(args, keywds, "Os|OsHs", kwlist, + if (!PyArg_ParseTupleAndKeywords(args, keywds, "Os|OsLs", kwlist, &context_capsule, &name, &extensions_obj, &userarg, &tid, &callback)) { PyErr_SetString(getdns_error, GETDNS_RETURN_INVALID_PARAMETER_TEXT); @@ -597,7 +597,7 @@ hostname(PyObject *self, PyObject *args, PyObject *keywds) void *address; PyDictObject *extensions_obj = 0; void *userarg; - long tid; + getdns_transaction_t tid; char * callback = 0; PyObject *my_ret; diff --git a/pygetdns.h b/pygetdns.h index 5710312..f70e6c9 100644 --- a/pygetdns.h +++ b/pygetdns.h @@ -110,7 +110,7 @@ PyObject *context_hostname(getdns_ContextObject *self, PyObject *args, PyObject PyObject *context_service(getdns_ContextObject *self, PyObject *args, PyObject *keywds); PyObject *do_query(PyObject *context_capsule, void *name, uint16_t request_type, - PyDictObject *extensions_obj, void *userarg, long tid, char *callback); + PyDictObject *extensions_obj, void *userarg, getdns_transaction_t tid, char *callback); PyObject *pythonify_address_list(getdns_list *list); PyObject *glist_to_plist(struct getdns_list *list); PyObject *gdict_to_pdict(struct getdns_dict *dict); @@ -127,10 +127,6 @@ getdns_dict *getdnsify_addressdict(PyObject *pydict); void context_dealloc(getdns_ContextObject *self); void marshall_query(pygetdns_async_args_blob *blog); PyObject *dispatch_query(PyObject *context_capsule, void *name, uint16_t request_type, - PyDictObject *extensions_obj, void *userarg, int tid, char *callback); -#if 0 -PyObject *dispatch_query(PyObject *context_capsule, void *name, uint16_t request_type, - PyDictObject *extensions_obj, void *userarg, long tid, char *callback); -#endif + PyDictObject *extensions_obj, void *userarg, getdns_transaction_t tid, char *callback); #endif /* PYGETDNS_H */ diff --git a/pygetdns_util.c b/pygetdns_util.c index 472bca7..e9738e7 100644 --- a/pygetdns_util.c +++ b/pygetdns_util.c @@ -143,7 +143,7 @@ extensions_to_getdnsdict(PyDictObject *pydict) } optionslist = getdns_list_create(); - optionlistsize = PyList_Size(opt_value); + optionlistsize = (int)PyList_Size(opt_value); for ( i = 0 ; i < optionlistsize ; i++) { tmpoptions_list_dict = getdns_dict_create();