Changeset 944


Ignore:
Timestamp:
Feb 14, 2007 1:45:08 AM (13 years ago)
Author:
bennylp
Message:

Fixed bug in Python module's normalize_stun_config(), and added Makefile for building Python module

Location:
pjproject/trunk/pjsip-apps/src/py_pjsua
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/py_pjsua/py_pjsua.c

    r934 r944  
    31313131    PyObject * tmpObj; 
    31323132    stun_config_Object *obj; 
    3133     pjsua_stun_config *cfg; 
     3133    pjsua_stun_config cfg; 
    31343134 
    31353135    if (!PyArg_ParseTuple(pArgs, "O", &tmpObj)) 
     
    31373137        return NULL; 
    31383138    } 
    3139     if (tmpObj != Py_None) 
    3140     { 
    3141         obj = (stun_config_Object *) tmpObj; 
    3142         cfg = (pjsua_stun_config *)malloc(sizeof(pjsua_stun_config)); 
    3143         cfg->stun_port1 = obj->stun_port1; 
    3144         cfg->stun_port2 = obj->stun_port2; 
    3145         cfg->stun_srv1.ptr = PyString_AsString(obj->stun_srv1); 
    3146         cfg->stun_srv1.slen = strlen(PyString_AsString(obj->stun_srv1)); 
    3147         cfg->stun_srv2.ptr = PyString_AsString(obj->stun_srv2); 
    3148         cfg->stun_srv2.slen = strlen(PyString_AsString(obj->stun_srv2)); 
    3149     } else { 
    3150         cfg = NULL; 
    3151     } 
    3152     pjsua_normalize_stun_config(cfg); 
    3153     obj->stun_port1 = cfg->stun_port1; 
    3154     obj->stun_port2 = cfg->stun_port2; 
     3139 
     3140    if (tmpObj == Py_None) { 
     3141        Py_INCREF(Py_None); 
     3142        return Py_None; 
     3143    } 
     3144 
     3145    obj = (stun_config_Object *) tmpObj; 
     3146    cfg.stun_port1 = obj->stun_port1; 
     3147    cfg.stun_port2 = obj->stun_port2; 
     3148    cfg.stun_srv1.ptr = PyString_AsString(obj->stun_srv1); 
     3149    cfg.stun_srv1.slen = strlen(PyString_AsString(obj->stun_srv1)); 
     3150    cfg.stun_srv2.ptr = PyString_AsString(obj->stun_srv2); 
     3151    cfg.stun_srv2.slen = strlen(PyString_AsString(obj->stun_srv2)); 
     3152 
     3153    pjsua_normalize_stun_config(&cfg); 
     3154    obj->stun_port1 = cfg.stun_port1; 
     3155    obj->stun_port2 = cfg.stun_port2; 
    31553156    Py_XDECREF(obj->stun_srv1); 
    31563157    obj->stun_srv1 =  
    3157         PyString_FromStringAndSize(cfg->stun_srv1.ptr, cfg->stun_srv1.slen); 
     3158        PyString_FromStringAndSize(cfg.stun_srv1.ptr, cfg.stun_srv1.slen); 
    31583159    Py_XDECREF(obj->stun_srv2); 
    31593160    obj->stun_srv2 =  
    3160         PyString_FromStringAndSize(cfg->stun_srv2.ptr, cfg->stun_srv2.slen); 
    3161     if (cfg != NULL) 
    3162     { 
    3163         free(cfg); 
    3164     } 
     3161        PyString_FromStringAndSize(cfg.stun_srv2.ptr, cfg.stun_srv2.slen); 
     3162 
    31653163    Py_INCREF(Py_None); 
    31663164    return Py_None; 
Note: See TracChangeset for help on using the changeset viewer.