Changeset 944 for pjproject/trunk
- Timestamp:
- Feb 14, 2007 1:45:08 AM (18 years ago)
- 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 3131 3131 PyObject * tmpObj; 3132 3132 stun_config_Object *obj; 3133 pjsua_stun_config *cfg;3133 pjsua_stun_config cfg; 3134 3134 3135 3135 if (!PyArg_ParseTuple(pArgs, "O", &tmpObj)) … … 3137 3137 return NULL; 3138 3138 } 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; 3155 3156 Py_XDECREF(obj->stun_srv1); 3156 3157 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); 3158 3159 Py_XDECREF(obj->stun_srv2); 3159 3160 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 3165 3163 Py_INCREF(Py_None); 3166 3164 return Py_None;
Note: See TracChangeset
for help on using the changeset viewer.