Ported the Python module for usage of 64-bit numbers.
[doldaconnect.git] / lib / python / dolmod.c
index 4f46682..fd026fa 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Dolda Connect - Modular multiuser Direct Connect-style client
- *  Copyright (C) 2004 Fredrik Tolf (fredrik@dolda2000.com)
+ *  Copyright (C) 2004 Fredrik Tolf <fredrik@dolda2000.com>
  *  
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -90,6 +90,9 @@ static PyObject *resp_intresp(struct respobj *self)
            case 3:
                PyList_SetItem(sl, i, PyFloat_FromDouble(ires->argv[i].val.flnum));
                break;
+           case 4:
+               PyList_SetItem(sl, i, PyLong_FromLongLong(ires->argv[i].val.lnum));
+               break;
            }
        }
        dc_freeires(ires);
@@ -189,11 +192,11 @@ static PyObject *mod_select(PyObject *self, PyObject *args)
        return(NULL);
     }
     if(((pfd.revents & POLLIN) && dc_handleread()) || ((pfd.revents & POLLOUT) && dc_handlewrite())) {
-       if(errno == 0) {
-           fd = -1;
+       fd = -1;
+       if(errno == 0)
            Py_RETURN_FALSE;
-       }
        PyErr_SetFromErrno(PyExc_OSError);
+       return(NULL);
     }
     if(ret > 0)
        Py_RETURN_TRUE;
@@ -402,7 +405,7 @@ static PyObject *mod_checkproto(PyObject *self, PyObject *args)
        PyErr_SetString(PyExc_TypeError, "first argument must be a response object");
        return(NULL);
     }
-    resp = tmp;
+    resp = (struct respobj *)tmp;
     if(dc_checkprotocol(resp->resp, version))
        Py_RETURN_FALSE;
     else