Changeset 621 for trunk/zoo-project/zoo-kernel/service_internal.c
- Timestamp:
- Apr 9, 2015, 5:23:06 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service_internal.c
r620 r621 1249 1249 if(tmp1!=NULL) 1250 1250 xmlNewNsProp(nc1,ns,BAD_CAST "processVersion",BAD_CAST tmp1->value); 1251 else 1252 xmlNewNsProp(nc1,ns,BAD_CAST "processVersion",BAD_CAST "1"); 1251 1253 map* tmp3=getMapFromMaps(m,"lenv","level"); 1252 1254 addPrefix(m,tmp3,serv); … … 1301 1303 else{ 1302 1304 if(j>0) 1303 xmlNewProp(nc,BAD_CAST tmp4[j],BAD_CAST "false"); 1305 xmlNewProp(nc,BAD_CAST tmp4[j],BAD_CAST "true"); 1306 else 1307 xmlNewNsProp(nc,ns,BAD_CAST "processVersion",BAD_CAST "1"); 1304 1308 } 1305 1309 } … … 1452 1456 datatype=1; 1453 1457 } 1454 1458 1455 1459 if(strncmp(type,"Input",5)==0){ 1456 1460 … … 1521 1525 const char* bkt; 1522 1526 if ( ( bkt = strchr(pToken, '[') ) != NULL || ( bkt = strchr(pToken, ']') ) != NULL ){ 1523 1524 1525 1527 strncpy( tmpStr, pToken, bkt - pToken ); 1528 tmpStr[bkt - pToken] = '\0'; 1529 } 1526 1530 } 1527 1531 xmlAddChild(nc7,xmlNewText(BAD_CAST tmpStr)); … … 1608 1612 1609 1613 } 1610 1611 1614 1612 int oI=0;1613 for(oI=0;oI<13;oI++)1614 1615 int oI=0; 1616 for(oI=0;oI<13;oI++) 1617 if((tmp1=getMap(_tmp->content,orderedFields[oI]))!=NULL){ 1615 1618 #ifdef DEBUG 1616 printf("DATATYPE DEFAULT ? %s\n",tmp1->name);1617 #endif 1618 if(strcmp(tmp1->name,"asReference")!=0 &&1619 strncasecmp(tmp1->name,"DataType",8)!=0 &&1620 strcasecmp(tmp1->name,"extension")!=0 &&1621 strcasecmp(tmp1->name,"value")!=0 &&1622 strcasecmp(tmp1->name,"AllowedValues")!=0 &&1623 strncasecmp(tmp1->name,"range",5)!=0){1624 if(datatype!=1){1625 char *tmp2=zCapitalize1(tmp1->name);1626 nc9 = xmlNewNode(NULL, BAD_CAST tmp2);1627 free(tmp2);1628 }1629 else{1630 char *tmp2=zCapitalize(tmp1->name);1631 nc9 = xmlNewNode(ns_ows, BAD_CAST tmp2);1632 free(tmp2);1633 }1634 xmlAddChild(nc9,xmlNewText(BAD_CAST tmp1->value));1635 xmlAddChild(nc5,nc9);1636 if(strcasecmp(tmp1->name,"uom")==0)1637 hasUOM1=true;1638 hasUOM=true;1639 }else1619 printf("DATATYPE DEFAULT ? %s\n",tmp1->name); 1620 #endif 1621 if(strcmp(tmp1->name,"asReference")!=0 && 1622 strncasecmp(tmp1->name,"DataType",8)!=0 && 1623 strcasecmp(tmp1->name,"extension")!=0 && 1624 strcasecmp(tmp1->name,"value")!=0 && 1625 strcasecmp(tmp1->name,"AllowedValues")!=0 && 1626 strncasecmp(tmp1->name,"range",5)!=0){ 1627 if(datatype!=1){ 1628 char *tmp2=zCapitalize1(tmp1->name); 1629 nc9 = xmlNewNode(NULL, BAD_CAST tmp2); 1630 free(tmp2); 1631 } 1632 else{ 1633 char *tmp2=zCapitalize(tmp1->name); 1634 nc9 = xmlNewNode(ns_ows, BAD_CAST tmp2); 1635 free(tmp2); 1636 } 1637 xmlAddChild(nc9,xmlNewText(BAD_CAST tmp1->value)); 1638 xmlAddChild(nc5,nc9); 1639 if(strcasecmp(tmp1->name,"uom")==0) 1640 hasUOM1=true; 1641 hasUOM=true; 1642 }else 1640 1643 1641 tmp1=tmp1->next;1642 1644 tmp1=tmp1->next; 1645 } 1643 1646 1644 1647 … … 1792 1795 } 1793 1796 1794 if( (tmp1=getMap(_tmp->content,"value"))!=NULL){1797 if(_tmp!=NULL && (tmp1=getMap(_tmp->content,"value"))!=NULL){ 1795 1798 nc7 = xmlNewNode(NULL, BAD_CAST "DefaultValue"); 1796 1799 xmlAddChild(nc7,xmlNewText(BAD_CAST tmp1->value)); … … 3200 3203 * cf. parseBoundingBox 3201 3204 */ 3202 if( strcasecmp(tmpInputs->format,"BoundingBoxData")==0){3205 if(tmpInputs->format!=NULL && strcasecmp(tmpInputs->format,"BoundingBoxData")==0){ 3203 3206 maps* tmpI=getMaps(*out,tmpInputs->name); 3204 3207 if(tmpI!=NULL){ … … 3518 3521 FILE* fo=fopen(fname,"w+"); 3519 3522 if(fo==NULL){ 3520 #ifdef DEBUG 3523 #ifdef DEBUG 3521 3524 fprintf (stderr, "Failed to open %s for writing: %s\n",fname, strerror(errno)); 3522 3525 #endif … … 3600 3603 } 3601 3604 for(int i=0;i<atoi(length->value);i++){ 3602 3603 3605 char* fcontent; 3604 3606 char *mimeType=NULL; … … 3608 3610 char vname1[11]; 3609 3611 char sname[9]; 3612 char mname[15]; 3610 3613 char icname[14]; 3611 3614 char xname[16]; … … 3620 3623 sprintf(vname,"value_%d",i); 3621 3624 sprintf(sname,"size_%d",i); 3625 sprintf(mname,"mimeType_%d",i); 3622 3626 sprintf(icname,"isCached_%d",i); 3623 3627 sprintf(xname,"Reference_%d",i); … … 3625 3629 sprintf(cname,"cache_file"); 3626 3630 sprintf(vname,"value"); 3631 sprintf(sname,"size"); 3632 sprintf(mname,"mimeType"); 3627 3633 sprintf(icname,"isCached"); 3628 sprintf(sname,"size");3629 3634 sprintf(xname,"Reference"); 3630 3635 } 3631 3636 3632 3637 map* tmap=getMapFromMaps(*m,"orequests",vname1); 3633 if((tmp1=getMap(content->content,xname))!=NULL && strcasecmp(tmap->value,tmp1->value)==0 ){ 3638 if((tmp1=getMap(content->content,xname))!=NULL /*&& ((tmap!=NULL && strcasecmp(tmap->value,tmp1->value)==0) )*/){ 3639 3634 3640 if(getMap(content->content,icname)==NULL){ 3635 3641 … … 3648 3654 mimeType=strdup("none"); 3649 3655 else 3650 3656 mimeType=strdup(hInternet->ihandle[index].mimeType); 3651 3657 3652 3658 map* tmpMap=getMapOrFill(&content->content,vname,""); … … 3669 3675 } 3670 3676 addToMap(content->content,sname,ltmp1); 3677 addToMap(content->content,mname,mimeType); 3671 3678 addToCache(*m,tmp1->value,fcontent,mimeType,fsize, NULL, 0); 3672 3679 free(fcontent); 3673 3680 free(mimeType); 3674 dumpMaps(content);3675 3681 index++; 3676 3682 … … 3688 3694 } 3689 3695 return 0; 3696 } 3697 3698 /** 3699 * Add a request in the download queue 3700 * 3701 * @param m the maps containing the settings of the main.cfg file 3702 * @param url the url to add to the queue 3703 */ 3704 void addRequestToQueue(maps** m,HINTERNET* hInternet,const char* url,bool req){ 3705 hInternet->waitingRequests[hInternet->nb]=strdup(url); 3706 if(req) 3707 InternetOpenUrl(hInternet,hInternet->waitingRequests[hInternet->nb],NULL,0,INTERNET_FLAG_NO_CACHE_WRITE,0); 3708 maps *oreq=getMaps(*m,"orequests"); 3709 if(oreq==NULL){ 3710 oreq=(maps*)malloc(MAPS_SIZE); 3711 oreq->name=zStrdup("orequests"); 3712 oreq->content=createMap("value",url); 3713 oreq->next=NULL; 3714 addMapsToMaps(m,oreq); 3715 freeMaps(&oreq); 3716 free(oreq); 3717 }else{ 3718 setMapArray(oreq->content,"value",hInternet->nb-1,url); 3719 } 3690 3720 } 3691 3721 … … 3734 3764 } 3735 3765 3736 }else{ 3737 hInternet->waitingRequests[hInternet->nb]=strdup(url); 3738 InternetOpenUrl(hInternet,hInternet->waitingRequests[hInternet->nb],NULL,0,INTERNET_FLAG_NO_CACHE_WRITE,0); 3739 maps *oreq=getMaps(*m,"orequests"); 3740 if(oreq==NULL){ 3741 oreq=(maps*)malloc(MAPS_SIZE); 3742 oreq->name=zStrdup("orequests"); 3743 oreq->content=createMap("value",url); 3744 oreq->next=NULL; 3745 addMapsToMaps(m,oreq); 3746 freeMaps(&oreq); 3747 free(oreq); 3748 }else{ 3749 setMapArray(oreq->content,"value",hInternet->nb-1,url); 3750 } 3766 }else{ 3767 addRequestToQueue(m,hInternet,url,true); 3751 3768 return 0; 3752 3769 } … … 3775 3792 else{ 3776 3793 addToMap(*content,"isCached","true"); 3777 3778 3794 map* tmp=getMapFromMaps(*m,"main","cacheDir"); 3779 3795 if(tmp!=NULL){
Note: See TracChangeset
for help on using the changeset viewer.