Changeset 114 for trunk/zoo-kernel/zoo_service_loader.c
- Timestamp:
- Feb 12, 2011, 4:14:17 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.