Changeset 114 for trunk/zoo-kernel
- Timestamp:
- Feb 12, 2011, 4:14:17 PM (14 years ago)
- Location:
- trunk/zoo-kernel
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-kernel/Makefile.in
r77 r114 93 93 94 94 zoo_service_loader.o: zoo_service_loader.c service.h 95 g++ -g -O2 -Wall${XML2CFLAGS} ${CFLAGS} ${PYTHONCFLAGS} ${JAVACFLAGS} ${JSCFLAGS} ${PERLCFLAGS} ${PHPCFLAGS} ${PYTHON_ENABLED} ${JS_ENABLED} ${PHP_ENABLED} ${PERL_ENABLED} ${JAVA_ENABLED} -c zoo_service_loader.c -fno-common -DPIC -o zoo_service_loader.o95 g++ -g -O2 ${XML2CFLAGS} ${CFLAGS} ${PYTHONCFLAGS} ${JAVACFLAGS} ${JSCFLAGS} ${PERLCFLAGS} ${PHPCFLAGS} ${PYTHON_ENABLED} ${JS_ENABLED} ${PHP_ENABLED} ${PERL_ENABLED} ${JAVA_ENABLED} -c zoo_service_loader.c -fno-common -DPIC -o zoo_service_loader.o 96 96 97 97 zoo_loader.cgi: zoo_loader.c zoo_service_loader.o ulinet.o service.h lex.sr.o service_conf.tab.o service_conf.y ulinet.o main_conf_read.tab.o lex.cr.o service_internal.o ${PYTHON_FILE} ${PHP_FILE} ${JAVA_FILE} ${JS_FILE} ${PERL_FILE} 98 g++ -g -O2 -Wall${JSCFLAGS} ${PHPCFLAGS} ${PERLCFLAGS} ${JAVACFLAGS} ${XML2CFLAGS} ${PYTHONCFLAGS} ${CFLAGS} -c zoo_loader.c -fno-common -DPIC -o zoo_loader.o98 g++ -g -O2 ${JSCFLAGS} ${PHPCFLAGS} ${PERLCFLAGS} ${JAVACFLAGS} ${XML2CFLAGS} ${PYTHONCFLAGS} ${CFLAGS} -c zoo_loader.c -fno-common -DPIC -o zoo_loader.o 99 99 g++ ${JSCFLAGS} ${GDAL_CFLAGS} ${XML2CFLAGS} ${PHPCFLAGS} ${PERLCFLAGS} ${JAVACFLAGS} ${PYTHONCFLAGS} ${CFLAGS} zoo_loader.o zoo_service_loader.o service_internal.o ${PYTHON_FILE} ${PERL_FILE} ${PHP_FILE} ${JS_FILE} ${JAVA_FILE} ulinet.o lex.cr.o lex.sr.o service_conf.tab.o main_conf_read.tab.o -o zoo_loader.cgi -lcurl -L../thirds/cgic206 -lcgic -lcurl ${GDAL_LIBS} ${XML2LDFLAGS} ${PYTHONLDFLAGS} ${PERLLDFLAGS} ${PHPLDFLAGS} ${JAVALDFLAGS} ${JSLDFLAGS} -lfcgi -lcrypto ${MACOS_LD_FLAGS} 100 100 -
trunk/zoo-kernel/main_conf_read.y
r9 r114 25 25 using namespace std; 26 26 27 extern void crerror(c har *s);27 extern void crerror(const char *s); 28 28 29 29 void usage(void) ; … … 304 304 /* fonction qui affiche l erreur si il y en a une */ 305 305 //====================================================== 306 void crerror(c har *s)306 void crerror(const char *s) 307 307 { 308 308 if(debug) … … 314 314 /* fonction principale : entrée dans le programme */ 315 315 //====================================================== 316 int conf_read(c har* file,maps* my_map){316 int conf_read(const char* file,maps* my_map){ 317 317 318 318 crin = fopen(file,"r"); -
trunk/zoo-kernel/service.h
r109 r114 55 55 #define SHMSZ 27 56 56 57 58 /** 59 * \struct map 60 * \brief KVP linked list 61 * 62 * Deal with WPS KVP (name,value). 63 * A map is defined as: 64 * - name : a key, 65 * - value: a value, 66 * - next : a pointer to the next map if any. 67 */ 68 typedef struct map{ 69 char* name; 70 char* value; 71 struct map* next; 72 } map; 73 74 #ifdef WIN32 75 #define NULLMAP ((map*) 0) 76 #else 77 #define NULLMAP NULL 78 #endif 79 57 80 /** 58 81 * \struct maps … … 60 83 * 61 84 * Small object to store WPS KVP set. 85 * Maps is defined as: 86 * - a name, 87 * - a content map, 88 * - a pointer to the next maps if any. 62 89 */ 63 90 typedef struct maps{ … … 68 95 69 96 /** 70 * \struct map 71 * \brief KVP linked list 72 * 73 * Deal with WPS KVP (name,value). 97 * \brief Dump a map on stderr 74 98 */ 75 typedef struct map{76 char* name; /* The key */77 char* value; /* The value */78 struct map* next; /* Next couple */79 } map;80 81 #ifdef WIN3282 #define NULLMAP ((map*) 0)83 #else84 #define NULLMAP NULL85 #endif86 87 99 static void _dumpMap(map* t){ 88 100 if(t!=NULL){ … … 181 193 } 182 194 183 static map* getMapFromMaps(maps* m,c har* key,char* subkey){195 static map* getMapFromMaps(maps* m,const char* key,const char* subkey){ 184 196 maps* _tmpm=getMaps(m,key); 185 197 if(_tmpm!=NULL){ … … 224 236 } 225 237 238 /** 239 * \brief Not named linked list 240 * 241 * Used to store informations about formats, such as mimeType, encoding ... 242 * 243 * An iotype is defined as : 244 * - a content map, 245 * - a pointer to the next iotype if any. 246 */ 226 247 typedef struct iotype{ 227 248 struct map* content; … … 229 250 } iotype; 230 251 252 /** 253 * \brief Metadata information about input or output. 254 * 255 * The elements are used to store metadata informations defined in the ZCFG. 256 * 257 * An elements is defined as : 258 * - a name, 259 * - a content map, 260 * - a metadata map, 261 * - a format (possible values are LiteralData, ComplexData or 262 * BoundingBoxData), 263 * - a default iotype, 264 * - a pointer to the next elements id any. 265 */ 231 266 typedef struct elements{ 232 267 char* name; … … 252 287 } services; 253 288 254 static bool hasElement(elements* e,c har* key){289 static bool hasElement(elements* e,const char* key){ 255 290 elements* tmp=e; 256 291 while(tmp!=NULL){ … … 476 511 477 512 478 static void setMapInMaps(maps* m,c har* key,char* subkey,char *value){513 static void setMapInMaps(maps* m,const char* key,const char* subkey,const char *value){ 479 514 maps* _tmpm=getMaps(m,key); 480 515 if(_tmpm!=NULL){ -
trunk/zoo-kernel/service_conf.y
r104 r114 36 36 static int previous_data=0; 37 37 static int current_data=0; 38 static char* myFinalObjectAsJSON="{";39 38 // namespace 40 39 using namespace std; … … 42 41 43 42 // srerror 44 void srerror(c har *s);43 void srerror(const char *s); 45 44 //====================================================== 46 45 … … 713 712 /* fonction qui affiche l erreur si il y en a une */ 714 713 //====================================================== 715 void srerror(c har *s)714 void srerror(const char *s) 716 715 { 717 716 if(debug) … … 724 723 * definition file. 725 724 */ 726 int getServiceFromFile(c har* file,service** service){725 int getServiceFromFile(const char* file,service** service){ 727 726 728 727 freeMap(&previous_content); -
trunk/zoo-kernel/service_internal.c
r94 r114 130 130 tmpMap=getMapFromMaps(conf,"lenv","status"); 131 131 s1=shm; 132 for(s=tmpMap->value; *s!=NULL;s++)132 for(s=tmpMap->value;s!=NULL;s++) 133 133 *s1++=*s; 134 134 shmdt((void *)shm); … … 216 216 217 217 218 int zooXmlSearchForNs(c har* name){218 int zooXmlSearchForNs(const char* name){ 219 219 int i; 220 220 int res=-1; … … 227 227 } 228 228 229 int zooXmlAddNs(xmlNodePtr nr,c har* url,char* name){229 int zooXmlAddNs(xmlNodePtr nr,const char* url,const char* name){ 230 230 #ifdef DEBUG 231 231 fprintf(stderr,"zooXmlAddNs %d \n",nbNs); … … 266 266 } 267 267 268 xmlNodePtr printGetCapabilitiesHeader(xmlDocPtr doc,c har* service,maps* m){268 xmlNodePtr printGetCapabilitiesHeader(xmlDocPtr doc,const char* service,maps* m){ 269 269 270 270 xmlNsPtr ns,ns_ows,ns_xlink,ns_xsi; … … 618 618 } 619 619 620 xmlNodePtr printDescribeProcessHeader(xmlDocPtr doc,c har* service,maps* m){620 xmlNodePtr printDescribeProcessHeader(xmlDocPtr doc,const char* service,maps* m){ 621 621 622 622 xmlNsPtr ns,ns_ows,ns_xlink,ns_xsi; … … 711 711 } 712 712 713 void printFullDescription(elements *elem,c har* type,xmlNsPtr ns_ows,xmlNodePtr nc1){713 void printFullDescription(elements *elem,const char* type,xmlNsPtr ns_ows,xmlNodePtr nc1){ 714 714 char *orderedFields[7]; 715 715 orderedFields[0]="mimeType"; … … 957 957 } 958 958 959 void printProcessResponse(maps* m,map* request, int pid,service* serv,c har* service,int status,maps* inputs,maps* outputs){959 void printProcessResponse(maps* m,map* request, int pid,service* serv,const char* service,int status,maps* inputs,maps* outputs){ 960 960 xmlNsPtr ns,ns_ows,ns_xlink,ns_xsi; 961 961 xmlNodePtr nr,n,nc,nc1,nc2,nc3,pseudor; … … 1217 1217 */ 1218 1218 xmlDocDumpFormatMemoryEnc(doc, &xmlbuff, &buffersize, encoding, 1); 1219 printf( (char *)xmlbuff);1219 printf("%s",xmlbuff); 1220 1220 //fflush(stdout); 1221 1221 /* … … 1228 1228 } 1229 1229 1230 void printOutputDefinitions1(xmlDocPtr doc,xmlNodePtr nc,xmlNsPtr ns_wps,xmlNsPtr ns_ows,elements* e,maps* m,c har* type){1230 void printOutputDefinitions1(xmlDocPtr doc,xmlNodePtr nc,xmlNsPtr ns_wps,xmlNsPtr ns_ows,elements* e,maps* m,const char* type){ 1231 1231 xmlNodePtr nc1; 1232 1232 nc1=xmlNewNode(ns_wps, BAD_CAST type); … … 1260 1260 } 1261 1261 1262 void printOutputDefinitions(xmlDocPtr doc,xmlNodePtr nc,xmlNsPtr ns_wps,xmlNsPtr ns_ows,elements* e,map* m,c har* type){1262 void printOutputDefinitions(xmlDocPtr doc,xmlNodePtr nc,xmlNsPtr ns_wps,xmlNsPtr ns_ows,elements* e,map* m,const char* type){ 1263 1263 xmlNodePtr nc1,nc2,nc3; 1264 1264 nc1=xmlNewNode(ns_wps, BAD_CAST type); … … 1288 1288 } 1289 1289 1290 void printIOType(xmlDocPtr doc,xmlNodePtr nc,xmlNsPtr ns_wps,xmlNsPtr ns_ows,xmlNsPtr ns_xlink,elements* e,maps* m,c har* type){1290 void printIOType(xmlDocPtr doc,xmlNodePtr nc,xmlNsPtr ns_wps,xmlNsPtr ns_ows,xmlNsPtr ns_xlink,elements* e,maps* m,const char* type){ 1291 1291 xmlNodePtr nc1,nc2,nc3; 1292 1292 nc1=xmlNewNode(ns_wps, BAD_CAST type); … … 1443 1443 } 1444 1444 1445 void printDescription(xmlNodePtr root,xmlNsPtr ns_ows,c har* identifier,map* amap){1445 void printDescription(xmlNodePtr root,xmlNsPtr ns_ows,const char* identifier,map* amap){ 1446 1446 xmlNodePtr nc2 = xmlNewNode(ns_ows, BAD_CAST "Identifier"); 1447 1447 xmlAddChild(nc2,xmlNewText(BAD_CAST identifier)); … … 1708 1708 freeMap(&errormap); 1709 1709 free(errormap); 1710 return 1;1710 return; 1711 1711 } 1712 1712 char mime[1024]; … … 1972 1972 * Note : support only 2D bounding box. 1973 1973 */ 1974 map* parseBoundingBox(c har* value){1974 map* parseBoundingBox(const char* value){ 1975 1975 map *res=NULL; 1976 1976 if(value!=NULL){ 1977 1977 char *cv,*cvp; 1978 cv=strtok_r( value,",",&cvp);1978 cv=strtok_r((char*) value,",",&cvp); 1979 1979 int cnt=0; 1980 1980 int icnt=0; … … 2089 2089 xmlDocDumpFormatMemoryEnc(doc, &xmlbuff, &buffersize, encoding, 1); 2090 2090 if(file==NULL) 2091 printf( (char *)xmlbuff);2091 printf("%s",xmlbuff); 2092 2092 else{ 2093 2093 fprintf(file,"%s",xmlbuff); -
trunk/zoo-kernel/service_internal.h
r88 r114 54 54 #include <openssl/buffer.h> 55 55 56 extern int getServiceFromFile(c har*,service**);57 extern int conf_read(c har*,maps*);56 extern int getServiceFromFile(const char*,service**); 57 extern int conf_read(const char*,maps*); 58 58 59 59 #ifdef USE_JS … … 84 84 char* getEncoding(maps*); 85 85 86 int zooXmlSearchForNs(c har*);87 int zooXmlAddNs(xmlNodePtr,c har*,char*);86 int zooXmlSearchForNs(const char*); 87 int zooXmlAddNs(xmlNodePtr,const char*,const char*); 88 88 void zooXmlCleanupNs(); 89 89 90 90 void printExceptionReportResponse(maps*,map*); 91 91 xmlNodePtr createExceptionReportNode(maps*,map*,int); 92 void printProcessResponse(maps*,map*,int,service*,c har*,int,maps*,maps*);93 xmlNodePtr printGetCapabilitiesHeader(xmlDocPtr,c har*,maps*);92 void printProcessResponse(maps*,map*,int,service*,const char*,int,maps*,maps*); 93 xmlNodePtr printGetCapabilitiesHeader(xmlDocPtr,const char*,maps*); 94 94 void printGetCapabilitiesForProcess(maps*,xmlNodePtr,service*); 95 xmlNodePtr printDescribeProcessHeader(xmlDocPtr,c har*,maps*);95 xmlNodePtr printDescribeProcessHeader(xmlDocPtr,const char*,maps*); 96 96 void printDescribeProcessForProcess(maps*,xmlNodePtr,service*,int); 97 void printFullDescription(elements*,c har*,xmlNsPtr,xmlNodePtr);97 void printFullDescription(elements*,const char*,xmlNsPtr,xmlNodePtr); 98 98 void printDocument(maps*,xmlDocPtr,int); 99 void printDescription(xmlNodePtr,xmlNsPtr,c har*,map*);100 void printIOType(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,xmlNsPtr,elements*,maps*,c har*);101 map* parseBoundingBox(c har*);99 void printDescription(xmlNodePtr,xmlNsPtr,const char*,map*); 100 void printIOType(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*); 101 map* parseBoundingBox(const char*); 102 102 void printBoundingBox(xmlNsPtr,xmlNodePtr,map*); 103 103 void printBoundingBoxDocument(maps*,maps*,FILE*); 104 void printOutputDefinitions1(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,elements*,maps*,c har*);104 void printOutputDefinitions1(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*); 105 105 106 106 void outputResponse(service*,maps*,maps*,map*,int,maps*,int); -
trunk/zoo-kernel/service_internal_java.c
r68 r114 2 2 * Author : Gérald FENOY 3 3 * 4 * Copyright (c) 2009-201 0GeoLabs SARL4 * Copyright (c) 2009-2011 GeoLabs SARL 5 5 * 6 6 * Permission is hereby granted, free of charge, to any person obtaining a copy … … 118 118 119 119 pValue=(*env)->CallStaticIntMethod(env,cls,pmid,arg1,arg2,arg3); 120 if (pValue != NULL){120 if (pValue != (jint)NULL){ 121 121 res=pValue; 122 122 m=mapsFromHashMap(env,arg1,scHashMapClass); … … 233 233 jobject scObject,scObject1; 234 234 if(scHashMapClass==NULL){ 235 #ifdef DEBUG 235 236 fprintf(stderr,"Unable to load java.util.HashMap\n"); 237 #endif 236 238 return NULL; 237 239 } … … 239 241 containsKey_mid = (*env)->GetMethodID(env, scHashMapClass, "containsKey", "(Ljava/lang/Object;)Z"); 240 242 get_mid = (*env)->GetMethodID(env, scHashMapClass, "get", "(Ljava/lang/Object;)Ljava/lang/Object;"); 243 241 244 if(containsKey_mid==0){ 245 #ifdef DEBUG 242 246 fprintf(stderr,"unable to load containsKey from HashMap object (%d) \n",entrySet_mid); 247 #endif 248 return NULL; 243 249 } 244 250 if(get_mid==0){ 251 #ifdef DEBUG 245 252 fprintf(stderr,"unable to load get from HashMap object (%d) \n",entrySet_mid); 253 #endif 254 return NULL; 246 255 } 247 256 if(entrySet_mid==0){ 257 #ifdef DEBUG 248 258 fprintf(stderr,"unable to load entrySet from HashMap object (%d) \n",entrySet_mid); 259 #endif 249 260 return NULL; 250 261 } … … 296 307 if((*env)->CallBooleanMethod(env,imap,containsKey_mid,(*env)->NewStringUTF(env,"size"))){ 297 308 jobject sizeV=(*env)->CallObjectMethod(env, imap, get_mid,(*env)->NewStringUTF(env,"size")); 298 jstringsizeVS=(*env)->GetStringUTFChars(env, sizeV, NULL);309 const char* sizeVS=(*env)->GetStringUTFChars(env, sizeV, NULL); 299 310 size=atoi(sizeVS); 300 311 fprintf(stderr,"SIZE : %s\n",sizeVS); 312 (*env)->ReleaseStringUTFChars(env, sizeV, sizeVS); 301 313 } 302 314 … … 306 318 jobject jv=(*env)->CallObjectMethod(env,tmp1,getValue_mid); 307 319 308 jstringjkd=(*env)->GetStringUTFChars(env, jk, NULL);320 const char* jkd=(*env)->GetStringUTFChars(env, jk, NULL); 309 321 if(size>=0 && strcmp(jkd,"value")==0){ 310 fprintf(stderr,"%s\n",jkd);311 322 jobject value=(*env)->GetByteArrayElements(env, jv, NULL); 312 323 if(res==NULL){ … … 315 326 addToMap(res,jkd,""); 316 327 } 317 fprintf(stderr,"/%s\n",jkd);318 328 map* tmpR=getMap(res,"value"); 319 329 free(tmpR->value); … … 321 331 memmove(tmpR->value,value,size*sizeof(char)); 322 332 tmpR->value[size]=0; 323 fprintf(stderr,"/%s\n",jkd); 333 char tmp[128]; 334 sprintf(tmp,"%d",size); 335 addToMap(res,"size",tmp); 324 336 } 325 337 else{ 326 jstringjvd=(*env)->GetStringUTFChars(env, jv, NULL);338 const char* jvd=(*env)->GetStringUTFChars(env, jv, NULL); 327 339 if(res==NULL){ 328 340 res=createMap(jkd,jvd); … … 330 342 addToMap(res,jkd,jvd); 331 343 } 332 (*env)->ReleaseString Chars(env, jv, jvd);344 (*env)->ReleaseStringUTFChars(env, jv, jvd); 333 345 } 334 346 … … 337 349 #endif 338 350 339 (*env)->ReleaseString Chars(env, jk, jkd);351 (*env)->ReleaseStringUTFChars(env, jk, jkd); 340 352 341 353 } -
trunk/zoo-kernel/service_internal_python.c
r108 r114 86 86 } 87 87 pModule = PyImport_Import(pName); 88 int i;89 88 int res=SERVICE_FAILED; 90 int cpid=getpid();91 89 if (pModule != NULL) { 92 90 pFunc=PyObject_GetAttrString(pModule,s->name); 93 91 if (pFunc && PyCallable_Check(pFunc)){ 92 PyObject *pValue; 94 93 PyDictObject* arg1=PyDict_FromMaps(m); 95 94 PyDictObject* arg2=PyDict_FromMaps(inputs); 96 95 PyDictObject* arg3=PyDict_FromMaps(outputs); 97 96 PyObject *pArgs=PyTuple_New(3); 98 PyObject *pValue; 97 if (!pArgs) 98 return -1; 99 99 PyTuple_SetItem(pArgs, 0, (PyObject *)arg1); 100 100 PyTuple_SetItem(pArgs, 1, (PyObject *)arg2); … … 130 130 PyErr_Fetch(&ptype, &pvalue, &ptraceback); 131 131 PyObject *trace=PyObject_Str(pvalue); 132 char tb[1024];133 132 char pbt[10240]; 134 133 if(PyString_Check(trace)) … … 145 144 else 146 145 fprintf(stderr,"EMPTY TRACE ?"); 147 PyObject *t;148 146 pName = PyString_FromString("traceback"); 149 147 pModule = PyImport_Import(pName); … … 302 300 int nb=PyList_Size(list); 303 301 int i; 304 int sizeValue=-1;305 302 for(i=0;i<nb;i++){ 306 303 PyObject* key=PyList_GetItem(list,i); -
trunk/zoo-kernel/zoo_loader.c
r99 r114 45 45 } 46 46 47 xmlXPathObjectPtr extractFromDoc(xmlDocPtr,c har*);47 xmlXPathObjectPtr extractFromDoc(xmlDocPtr,const char*); 48 48 int runRequest(map*); 49 49 … … 192 192 addToMap(tmpMap,"language",tval); 193 193 194 c har* requests[3];194 const char* requests[3]; 195 195 requests[0]="GetCapabilities"; 196 196 requests[1]="DescribeProcess"; … … 206 206 #endif 207 207 if(req!=NULL && req->nodeNr==1){ 208 t1->value= requests[j];208 t1->value=strdup(requests[j]); 209 209 j=2; 210 210 } -
trunk/zoo-kernel/zoo_service_loader.c
r109 r114 94 94 } 95 95 96 xmlXPathObjectPtr extractFromDoc(xmlDocPtr doc,c har* search){96 xmlXPathObjectPtr extractFromDoc(xmlDocPtr doc,const char* search){ 97 97 xmlXPathContextPtr xpathCtx; 98 98 xmlXPathObjectPtr xpathObj; … … 110 110 void sig_handler(int sig){ 111 111 char tmp[100]; 112 c har *ssig;112 const char *ssig; 113 113 switch(sig){ 114 114 case SIGSEGV: … … 153 153 map* r_inputs=NULL; 154 154 #ifndef WIN32 155 getcwd(ntmp,1024);155 char* pntmp=getcwd(ntmp,1024); 156 156 #else 157 157 _getcwd(ntmp,1024); … … 360 360 #endif 361 361 362 map* r_inputs=NULL ,*tmps=NULL;362 map* r_inputs=NULL; 363 363 maps* m=NULL; 364 int argc=count(request_inputs);365 364 366 365 char* REQUEST=NULL; … … 374 373 char ntmp[1024]; 375 374 #ifndef WIN32 376 getcwd(ntmp,1024);375 char *pntmp=getcwd(ntmp,1024); 377 376 #else 378 377 _getcwd(ntmp,1024); … … 470 469 } 471 470 472 map* outputs=NULL;473 471 maps* request_output_real_format=NULL; 474 472 map* tmpm=getMapFromMaps(m,"main","serverAddress"); … … 478 476 SERVICE_URL=strdup(DEFAULT_SERVICE_URL); 479 477 480 service* s[100];481 478 service* s1; 482 479 int scount=0; … … 497 494 498 495 if(strncasecmp(REQUEST,"GetCapabilities",15)==0){ 499 int i=0;500 496 struct dirent *dp; 501 497 #ifdef DEBUG … … 510 506 r_inputs=getMap(request_inputs,"ServiceProvider"); 511 507 xmlNodePtr n; 512 //dumpMap(request_inputs);513 508 if(r_inputs!=NULL) 514 509 n = printGetCapabilitiesHeader(doc,r_inputs->value,m); … … 595 590 char buff[256]; 596 591 char buff1[1024]; 597 int i=0;598 int j=0;599 int end=-1;600 592 int saved_stdout = dup(fileno(stdout)); 601 593 dup2(fileno(stderr),fileno(stdout)); … … 611 603 memset(buff1,0,1024); 612 604 snprintf(buff1,1024,"%s/%s",conf_dir,dp->d_name); 613 //s1=(service*)malloc(sizeof(service*));614 605 s1=(service*)calloc(1,SERVICE_SIZE); 615 606 if(s1 == NULL){ … … 640 631 free(SERVICE_URL); 641 632 fflush(stdout); 642 //xmlFree(n);643 633 #ifndef LINUX_FREE_ISSUE 644 634 if(s1) … … 654 644 #endif 655 645 closedir(dirp); 656 free(s);657 646 return 0; 658 647 } … … 703 692 dumpService(s1); 704 693 #endif 705 map* inputs=NULL;706 elements* c_inputs=s1->inputs;707 694 int j; 708 695 … … 747 734 fprintf(stderr,"OUTPUT Parsing start now ... \n"); 748 735 #endif 749 char current_output_as_string[10240];750 736 char cursor_output[10240]; 751 737 char *cotmp=strdup(r_inputs->value); … … 753 739 free(cotmp); 754 740 j=0; 755 map* request_kvp_outputs=NULL;756 741 757 742 /** … … 834 819 fflush(stderr); 835 820 #endif 836 //tmp_output=tmp_output->next;837 821 free(tmp); 838 822 } … … 848 832 fprintf(stderr,"DATA INPUTS [%s]\n",r_inputs->value); 849 833 #endif 850 char current_input_as_string[40960];851 834 char cursor_input[40960]; 852 835 if(r_inputs!=NULL) … … 864 847 } 865 848 j=0; 866 map* request_kvp_inputs=NULL;867 849 868 850 /** … … 907 889 strncpy(tmpn,tmpc,(strlen(tmpc)-strlen(tmpv))*sizeof(char)); 908 890 tmpn[strlen(tmpc)-strlen(tmpv)]=0; 909 int cnt=0;910 891 #ifdef DEBUG 911 892 fprintf(stderr,"***\n*** %s = %s ***\n",tmpn,tmpv+1); … … 1010 991 fflush(stderr); 1011 992 #endif 1012 xmlNodePtr cur = xmlDocGetRootElement(doc);1013 993 /** 1014 994 * Parse every Input in DataInputs node. 1015 995 */ 1016 maps* tempMaps=NULL;1017 996 xmlXPathObjectPtr tmpsptr=extractFromDoc(doc,"/*/*/*[local-name()='Input']"); 1018 997 xmlNodeSet* tmps=tmpsptr->nodesetval; … … 1064 1043 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1065 1044 } 1066 tmpmaps->name= "missingIndetifier";1045 tmpmaps->name=strdup("missingIndetifier"); 1067 1046 tmpmaps->content=createMap((char*)cur2->name,(char*)val); 1068 1047 tmpmaps->next=NULL; … … 1093 1072 fprintf(stderr,"REFERENCE\n"); 1094 1073 #endif 1095 map* referenceMap=NULL; 1096 char *refs[5]; 1074 const char *refs[5]; 1097 1075 refs[0]="mimeType"; 1098 1076 refs[1]="encoding"; … … 1100 1078 refs[3]="method"; 1101 1079 refs[4]="href"; 1102 char*url;1103 1080 for(int l=0;l<5;l++){ 1104 1081 #ifdef DEBUG … … 1142 1119 while(cur3){ 1143 1120 if(xmlStrcasecmp(cur3->name,BAD_CAST "Header")==0 ){ 1144 xmlNodePtr cur4=cur3; 1145 char *tmp=new char[cgiContentLength]; 1146 char *ha[2]; 1121 const char *ha[2]; 1147 1122 ha[0]="key"; 1148 1123 ha[1]="value"; … … 1170 1145 } 1171 1146 hInternet.header=curl_slist_append(hInternet.header, has); 1172 //free(has);1147 free(has); 1173 1148 } 1174 1149 else{ … … 1302 1277 * dataType , uom 1303 1278 */ 1304 char *li ts[2];1305 li ts[0]="dataType";1306 li ts[1]="uom";1279 char *list[2]; 1280 list[0]=strdup("dataType"); 1281 list[1]=strdup("uom"); 1307 1282 for(int l=0;l<2;l++){ 1308 1283 #ifdef DEBUG 1309 fprintf(stderr,"*** LiteralData %s ***",li ts[l]);1310 #endif 1311 xmlChar *val=xmlGetProp(cur4,BAD_CAST li ts[l]);1284 fprintf(stderr,"*** LiteralData %s ***",list[l]); 1285 #endif 1286 xmlChar *val=xmlGetProp(cur4,BAD_CAST list[l]); 1312 1287 if(val!=NULL && strlen((char*)val)>0){ 1313 1288 if(tmpmaps->content!=NULL) 1314 addToMap(tmpmaps->content,li ts[l],(char*)val);1289 addToMap(tmpmaps->content,list[l],(char*)val); 1315 1290 else 1316 tmpmaps->content=createMap(li ts[l],(char*)val);1291 tmpmaps->content=createMap(list[l],(char*)val); 1317 1292 } 1318 1293 #ifdef DEBUG … … 1320 1295 #endif 1321 1296 xmlFree(val); 1297 free(list[l]); 1322 1298 } 1323 1299 } … … 1327 1303 * mimeType, encoding, schema 1328 1304 */ 1329 c har *coms[3];1305 const char *coms[3]; 1330 1306 coms[0]="mimeType"; 1331 1307 coms[1]="encoding"; … … 1368 1344 char *res=NULL; 1369 1345 char *curs=tmpv->value; 1370 int i=0;1371 1346 for(int i=0;i<=strlen(tmpv->value)/64;i++) { 1372 1347 if(res==NULL) … … 1421 1396 #endif 1422 1397 xmlXPathFreeObject(tmpsptr); 1423 //xmlFree(tmps);1424 1398 1425 1399 tmpsptr=extractFromDoc(doc,"/*/*/*[local-name()='ResponseDocument']"); … … 1439 1413 else 1440 1414 addToMap(request_inputs,"ResponseDocument",""); 1441 request_output_real_format;1442 1415 maps *tmpmaps=NULL; 1443 1416 xmlNodePtr cur=tmps->nodeTab[k]; … … 1451 1424 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1452 1425 } 1453 tmpmaps->name= "unknownIdentifier";1426 tmpmaps->name=strdup("unknownIdentifier"); 1454 1427 tmpmaps->next=NULL; 1455 1428 } … … 1458 1431 * storeExecuteResponse, lineage, status 1459 1432 */ 1460 c har *ress[3];1433 const char *ress[3]; 1461 1434 ress[0]="storeExecuteResponse"; 1462 1435 ress[1]="lineage"; … … 1487 1460 * mimeType, encoding, schema, uom, asReference 1488 1461 */ 1489 c har *outs[5];1462 const char *outs[5]; 1490 1463 outs[0]="mimeType"; 1491 1464 outs[1]="encoding"; … … 1543 1516 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1544 1517 } 1545 tmpmaps->name= "missingIndetifier";1518 tmpmaps->name=strdup("missingIndetifier"); 1546 1519 tmpmaps->content=createMap((char*)cur2->name,(char*)val); 1547 1520 tmpmaps->next=NULL; … … 1563 1536 } 1564 1537 } 1565 //xmlFree(cur);1566 1538 if(request_output_real_format==NULL) 1567 1539 request_output_real_format=dupMaps(&tmpmaps); … … 1576 1548 1577 1549 xmlXPathFreeObject(tmpsptr); 1578 //xmlFree(tmps);1579 1550 xmlCleanupParser(); 1580 1551 }
Note: See TracChangeset
for help on using the changeset viewer.