Skip to content

Commit

Permalink
Fixed Mac OS compilation errors/warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
MelindaShore committed Aug 25, 2014
1 parent d6af1a4 commit b5081a5
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 35 deletions.
30 changes: 15 additions & 15 deletions context.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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);
Expand Down Expand Up @@ -937,21 +937,21 @@ 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;

if ((context = PyCapsule_GetPointer(self->py_context, "context")) == NULL) {
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);
Expand All @@ -976,15 +976,15 @@ 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;

if ((context = PyCapsule_GetPointer(self->py_context, "context")) == NULL) {
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);
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down
26 changes: 13 additions & 13 deletions getdns.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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)

{
Expand Down Expand Up @@ -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)

{
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;

Expand Down
8 changes: 2 additions & 6 deletions pygetdns.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 */
2 changes: 1 addition & 1 deletion pygetdns_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit b5081a5

Please sign in to comment.