Changeset 105 for trunk/zoo-kernel/zoo_service_loader.c
- Timestamp:
- Feb 1, 2011, 8:32:02 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-kernel/zoo_service_loader.c
r95 r105 101 101 xmlXPathFreeContext(xpathCtx); 102 102 return xpathObj; 103 } 104 105 void donothing(int sig){ 106 fprintf(stderr,"Signal %d after the ZOO-Kernel returned result !\n",sig); 107 exit(0); 103 108 } 104 109 … … 1417 1422 xmlXPathFreeObject(tmpsptr); 1418 1423 //xmlFree(tmps); 1424 1419 1425 tmpsptr=extractFromDoc(doc,"/*/*/*[local-name()='ResponseDocument']"); 1426 bool asRaw=false; 1420 1427 tmps=tmpsptr->nodesetval; 1428 if(tmps->nodeNr==0){ 1429 tmpsptr=extractFromDoc(doc,"/*/*/*[local-name()='RawDataOutput']"); 1430 tmps=tmpsptr->nodesetval; 1431 asRaw=true; 1432 } 1421 1433 #ifdef DEBUG 1422 1434 fprintf(stderr,"*****%d*****\n",tmps->nodeNr); 1423 1435 #endif 1424 1436 for(int k=0;k<tmps->nodeNr;k++){ 1425 addToMap(request_inputs,"ResponseDocument",""); 1437 if(asRaw==true) 1438 addToMap(request_inputs,"RawDataOutput",""); 1439 else 1440 addToMap(request_inputs,"ResponseDocument",""); 1426 1441 request_output_real_format; 1427 1442 maps *tmpmaps=NULL; … … 1550 1565 //xmlFree(cur); 1551 1566 if(request_output_real_format==NULL) 1552 request_output_real_format= tmpmaps;1567 request_output_real_format=dupMaps(&tmpmaps); 1553 1568 else 1554 1569 addMapsToMaps(&request_output_real_format,tmpmaps); … … 1556 1571 dumpMaps(tmpmaps); 1557 1572 #endif 1573 freeMaps(&tmpmaps); 1574 free(tmpmaps); 1558 1575 } 1559 xmlXPathFreeObject(tmpsptr); 1560 //xmlFree(tmps); 1561 tmpsptr=extractFromDoc(doc,"/*/*/*[local-name()='RawDataOutput']"); 1562 tmps=tmpsptr->nodesetval; 1563 #ifdef DEBUG 1564 fprintf(stderr,"*****%d*****\n",tmps->nodeNr); 1565 #endif 1566 for(int k=0;k<tmps->nodeNr;k++){ 1567 addToMap(request_inputs,"RawDataOutput",""); 1568 xmlNodePtr cur1=tmps->nodeTab[k]; 1569 xmlChar *val; 1570 /** 1571 * Get every attribute from a Output node 1572 * mimeType, encoding, schema, uom, asReference 1573 */ 1574 char *outs[4]; 1575 outs[0]="mimeType"; 1576 outs[1]="encoding"; 1577 outs[2]="schema"; 1578 outs[3]="uom"; 1579 for(int l=0;l<4;l++){ 1580 #ifdef DEBUG 1581 fprintf(stderr,"*** %s ***\t",outs[l]); 1582 #endif 1583 val=xmlGetProp(cur1,BAD_CAST outs[l]); 1584 if(val!=NULL && strlen((char*)val)>0){ 1585 if(tmpmaps==NULL){ 1586 tmpmaps=(maps*)calloc(1,MAPS_SIZE); 1587 if(tmpmaps == NULL){ 1588 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1589 } 1590 tmpmaps->name="unknownIdentifier"; 1591 tmpmaps->content=createMap(outs[l],(char*)val); 1592 tmpmaps->next=NULL; 1593 } 1594 else 1595 addToMap(tmpmaps->content,outs[l],(char*)val); 1596 } 1597 #ifdef DEBUG 1598 fprintf(stderr,"%s\n",val); 1599 #endif 1600 xmlFree(val); 1601 } 1602 1603 xmlNodePtr cur2=cur1->children; 1604 while(cur2){ 1605 /** 1606 * Indentifier 1607 */ 1608 if(xmlStrncasecmp(cur2->name,BAD_CAST "Identifier",xmlStrlen(cur2->name))==0){ 1609 val= 1610 xmlNodeListGetString(doc,cur2->xmlChildrenNode,1); 1611 if(tmpmaps==NULL){ 1612 tmpmaps=(maps*)calloc(1,MAPS_SIZE); 1613 if(tmpmaps == NULL){ 1614 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1615 } 1616 tmpmaps->name=strdup((char*)val); 1617 tmpmaps->content=NULL; 1618 tmpmaps->next=NULL; 1619 } 1620 else 1621 tmpmaps->name=strdup((char*)val);; 1622 xmlFree(val); 1623 } 1624 cur2=cur2->next; 1625 } 1626 if(request_output_real_format==NULL) 1627 request_output_real_format=tmpmaps; 1628 else 1629 addMapsToMaps(&request_output_real_format,tmpmaps); 1630 #ifdef DEBUG 1631 dumpMaps(tmpmaps); 1632 #endif 1633 } 1576 1634 1577 xmlXPathFreeObject(tmpsptr); 1635 1578 //xmlFree(tmps); 1636 1579 xmlCleanupParser(); 1637 1580 } 1638 1581 1639 1582 //if(CHECK_INET_HANDLE(hInternet)) 1640 1583 InternetCloseHandle(hInternet); … … 1875 1818 request_output_real_format,request_inputs, 1876 1819 cpid,m,eres); 1820 /** 1821 * Ensure that if error occurs when freeing memory, no signal will return 1822 * an ExceptionReport document as the result was already returned to the 1823 * client. 1824 */ 1825 #ifndef USE_GDB 1826 (void) signal(SIGSEGV,donothing); 1827 (void) signal(SIGTERM,donothing); 1828 (void) signal(SIGINT,donothing); 1829 (void) signal(SIGILL,donothing); 1830 (void) signal(SIGFPE,donothing); 1831 (void) signal(SIGABRT,donothing); 1832 #endif 1877 1833 1878 1834 if(((int)getpid())!=cpid){
Note: See TracChangeset
for help on using the changeset viewer.