Changeset 59
- Timestamp:
- Jan 6, 2011, 10:50:56 PM (14 years ago)
- Location:
- trunk/zoo-kernel
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-kernel/service.h
r57 r59 418 418 res->next=NULL; 419 419 map* mc=_cursor->content; 420 map* tmp=getMap(mc,"size"); 421 char* tmpSized=NULL; 422 if(tmp!=NULL){ 423 map* tmpV=getMap(mc,"value"); 424 tmpSized=(char*)malloc((atoi(tmp->value)+1)*sizeof(char)); 425 memmove(tmpSized,tmpV->value,atoi(tmp->value)*sizeof(char)); 426 } 420 427 if(mc!=NULL){ 421 428 addMapToMap(&res->content,mc); 429 } 430 if(tmp!=NULL){ 431 map* tmpV=getMap(res->content,"value"); 432 free(tmpV->value); 433 tmpV->value=(char*)malloc(atoi(tmp->value)*sizeof(char)); 434 memmove(tmpV->value,tmpSized,atoi(tmp->value)*sizeof(char)); 435 free(tmpSized); 422 436 } 423 437 res->next=dupMaps(&_cursor->next); -
trunk/zoo-kernel/service_internal.c
r58 r59 1105 1105 addToMap(errorMap,"text",_("No more information available")); 1106 1106 nc3=createExceptionReportNode(m,errorMap,0); 1107 freeMap(&errorMap); 1108 free(errorMap); 1107 1109 xmlAddChild(nc1,nc3); 1108 1110 break; … … 1327 1329 || strncmp(tmp2->value,"application/",6)==0)) ){ 1328 1330 map* rs=getMap(m->content,"size"); 1331 bool isSized=true; 1329 1332 if(rs==NULL){ 1330 1333 char tmp1[1024]; 1331 1334 sprintf(tmp1,"%d",strlen(toto->value)); 1332 1335 rs=createMap("z",tmp1); 1336 isSized=false; 1333 1337 } 1334 1338 xmlAddChild(nc3,xmlNewText(BAD_CAST base64((const unsigned char*)toto->value,atoi(rs->value)))); 1339 if(!isSized){ 1340 freeMap(&rs); 1341 free(rs); 1342 } 1335 1343 } 1336 1344 else if(tmp!=NULL){ … … 1646 1654 while(tmpInputs!=NULL){ 1647 1655 maps *tmpMaps=getMaps(out1,tmpInputs->name); 1648 /*fprintf(stderr,"IN LOOP\n");1649 dumpElements(tmpInputs);1650 dumpMaps(tmpMaps);1651 fprintf(stderr,"/ IN LOOP\n");*/1652 1656 if(tmpMaps==NULL){ 1653 1657 map* tmpMap1=getMap(tmpInputs->content,"minOccurs"); -
trunk/zoo-kernel/service_internal_java.c
r57 r59 62 62 options[1].optionString = "-Djava.compiler=NONE"; 63 63 64 vm_args.version = JNI_VERSION_1_4; 64 vm_args.version = JNI_VERSION_1_2; 65 JNI_GetDefaultJavaVMInitArgs(&vm_args); 65 66 vm_args.options = options; 66 67 vm_args.nOptions = 2; … … 284 285 jobject jv=(*env)->CallObjectMethod(env,tmp1,getValue_mid); 285 286 286 #ifdef DEBUG287 287 jstring jkd=(*env)->GetStringUTFChars(env, jk, NULL); 288 288 jstring jvd=(*env)->GetStringUTFChars(env, jv, NULL); 289 290 #ifdef DEBUG 289 291 fprintf(stderr,"%s %s\n",jkd,jvd); 290 292 #endif 291 293 292 294 if(res==NULL){ 293 res=createMap((*env)->GetStringUTFChars(env, jk, NULL), 294 (*env)->GetStringUTFChars(env, jv, NULL)); 295 res=createMap(jkd,jvd); 295 296 }else{ 296 addToMap(res,(*env)->GetStringUTFChars(env, jk, NULL), 297 (*env)->GetStringUTFChars(env, jv, NULL)); 297 addToMap(res,jkd,jvd); 298 298 } 299 (*env)->ReleaseStringChars(env, jk, jkd); 300 (*env)->ReleaseStringChars(env, jv, jvd); 301 299 302 } 300 303 jobject jk=(*env)->CallObjectMethod(env,tmp,getKey_mid); -
trunk/zoo-kernel/service_internal_python.c
r58 r59 106 106 freeMaps(real_outputs); 107 107 free(*real_outputs); 108 //*real_inputs=mapsFromPyDict(arg2);109 //createMapsFromPyDict(real_outputs,arg3);108 freeMaps(main_conf); 109 free(*main_conf); 110 110 *main_conf=mapsFromPyDict(arg1); 111 111 *real_outputs=mapsFromPyDict(arg3); … … 134 134 trace=NULL; 135 135 trace=PyObject_Str(ptype); 136 if(PyString_Check(trace)) 137 sprintf(pbt,"%s\nTRACE : %s",strdup(pbt),PyString_AsString(trace)); 136 if(PyString_Check(trace)){ 137 char *tpbt=strdup(pbt); 138 sprintf(pbt,"%s\nTRACE : %s",tpbt,PyString_AsString(trace)); 139 free(tpbt); 140 } 138 141 else 139 142 fprintf(stderr,"EMPTY TRACE ?"); … … 148 151 trace=PyObject_Str(pValue); 149 152 if(PyString_Check(trace)) 150 sprintf(pbt,"%s\nUnable to run your python process properly. Please check the following messages : %s", strdup(pbt),PyString_AsString(trace));153 sprintf(pbt,"%s\nUnable to run your python process properly. Please check the following messages : %s",pbt,PyString_AsString(trace)); 151 154 else 152 sprintf(pbt,"%s \n Unable to run your python process properly. Unable to provide any futher informations.", strdup(pbt));155 sprintf(pbt,"%s \n Unable to run your python process properly. Unable to provide any futher informations.",pbt); 153 156 map* err=createMap("text",pbt); 154 157 addToMap(err,"code","NoApplicableCode"); 155 158 printExceptionReportResponse(m,err); 159 Py_DECREF(arg1); 160 Py_DECREF(arg2); 161 Py_DECREF(arg3); 156 162 Py_XDECREF(pFunc); 157 163 Py_DECREF(pArgs); 158 164 Py_DECREF(pModule); 165 Py_DECREF(ptraceback); 166 Py_DECREF(ptype); 167 Py_DECREF(pValue); 168 Py_Finalize(); 159 169 exit(-1); 160 170 } … … 178 188 exit(-1); 179 189 } 180 #ifndef DEBUG181 // Failed when DEBUG is defined182 190 Py_Finalize(); 183 #endif184 191 return res; 185 192 } … … 189 196 maps* tmp=t; 190 197 while(tmp!=NULL){ 191 if(PyDict_SetItem(res,PyString_FromString(tmp->name),(PyObject*)PyDict_FromMap(tmp->content))<0){ 198 PyObject* subc=PyDict_FromMap(tmp->content); 199 if(PyDict_SetItem(res,PyString_FromString(tmp->name),subc)<0){ 192 200 fprintf(stderr,"Unable to parse params..."); 193 201 exit(1); 194 202 } 203 Py_DECREF(subc); 195 204 tmp=tmp->next; 196 205 } … … 202 211 map* tmp=t; 203 212 map* size=getMap(tmp,"size"); 204 dumpMap(t);205 213 while(tmp!=NULL){ 206 fprintf(stderr,"%s => %s\n"),tmp->name,tmp->value;214 PyObject* name=PyString_FromString(tmp->name); 207 215 if(strcasecmp(tmp->name,"value")==0){ 208 216 if(size!=NULL){ 209 if(PyDict_SetItem(res,PyString_FromString(tmp->name),PyString_FromStringAndSize(tmp->value,(Py_ssize_t) atoi(size->value)))<0){ 217 PyObject* value=PyString_FromStringAndSize(tmp->value,atoi(size->value)); 218 if(PyDict_SetItem(res,name,value)<0){ 210 219 fprintf(stderr,"Unable to parse params..."); 211 220 exit(1); 212 221 } 222 Py_DECREF(value); 213 223 } 214 else 215 if(PyDict_SetItem(res,PyString_FromString(tmp->name),PyString_FromString(tmp->value))<0){ 224 else{ 225 PyObject* value=PyString_FromString(tmp->value); 226 if(PyDict_SetItem(res,name,value)<0){ 216 227 fprintf(stderr,"Unable to parse params..."); 217 228 exit(1); 218 229 } 219 } 220 else 221 if(PyDict_SetItem(res,PyString_FromString(tmp->name),PyString_FromString(tmp->value))<0){ 230 Py_DECREF(value); 231 } 232 } 233 else{ 234 PyObject* value=PyString_FromString(tmp->value); 235 if(PyDict_SetItem(res,name,value)<0){ 222 236 fprintf(stderr,"Unable to parse params..."); 223 237 exit(1); 224 238 } 239 Py_DECREF(value); 240 } 241 Py_DECREF(name); 225 242 tmp=tmp->next; 226 243 } … … 244 261 PyString_AsString(key),PyString_AsString(value)); 245 262 #endif 246 while(cursor!=NULL){247 cursor=cursor->next;248 }249 263 cursor=(maps*)malloc(MAPS_SIZE); 250 264 cursor->name=PyString_AsString(key); … … 255 269 cursor->next=NULL; 256 270 if(res==NULL) 257 res= cursor;271 res=dupMaps(&cursor); 258 272 else 259 273 addMapsToMaps(&res,cursor); 274 freeMap(&cursor->content); 275 free(cursor->content); 276 free(cursor); 260 277 #ifdef DEBUG 261 278 dumpMaps(res); … … 263 280 #endif 264 281 } 282 Py_DECREF(list); 265 283 return res; 266 284 } -
trunk/zoo-kernel/zoo_service_loader.c
r58 r59 954 954 map* tmpMap=getMap(tmpmaps->content,"value"); 955 955 if(tmpMap!=NULL){ 956 free(tmpMap->value); 956 957 tmpMap->value=(char*)malloc((res.nDataLen+1)*sizeof(char)); 957 958 memmove(tmpMap->value,tmpContent,(res.nDataLen)*sizeof(char)); 958 959 tmpMap->value[res.nDataLen]=0; 959 fprintf(stderr,"%d = %d ?\n",res.nDataLen/sizeof(char),strlen(tmpContent)); 960 if(strlen(tmpContent)!=res.nDataLen/sizeof(char)){ 960 if(strlen(tmpContent)!=res.nDataLen){ 961 961 char tmp[256]; 962 sprintf(tmp,"%d",res.nDataLen );962 sprintf(tmp,"%d",res.nDataLen*sizeof(char)); 963 963 addToMap(tmpmaps->content,"size",tmp); 964 964 } 965 /*FILE* fd=fopen("/tmp/test.png","w");966 fwrite(tmpContent,1,(res.nDataLen)*sizeof(char),fd);967 fclose(fd);968 dumpMap(tmpMap);*/969 965 } 970 966 free(tmpContent); … … 982 978 else 983 979 addMapsToMaps(&request_input_real_format,tmpmaps); 984 /*freeMap(&tmpmaps->content);985 free(tmpmaps->content);986 tmpmaps->content=NULL;*/987 980 freeMaps(&tmpmaps); 988 981 free(tmpmaps); 989 //}990 982 tmpmaps=NULL; 991 983 free(tmp); … … 1805 1797 freeService(&s1); 1806 1798 free(s1); 1807 //For Python language support only 1808 //freeMaps(&m); 1799 freeMaps(&m); 1809 1800 free(m); 1810 1801 … … 1812 1803 free(request_input_real_format); 1813 1804 1814 /* The following is requested but get issue using with Python support :/ */ 1815 /* freeMaps(&request_output_real_format); 1816 free(request_output_real_format);*/ 1805 freeMaps(&request_output_real_format); 1806 free(request_output_real_format); 1817 1807 1818 1808 free(REQUEST);
Note: See TracChangeset
for help on using the changeset viewer.