- Timestamp:
- Feb 1, 2018, 11:27:28 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/prototype-v0/zoo-project/zoo-kernel/server_internal.c
r858 r862 377 377 struct stat file_status; 378 378 stat(filename, &file_status); 379 map* tmpMap1=getMap(content,"value"); 380 if(tmpMap1==NULL){ 381 addToMap(content,"value",""); 382 tmpMap1=getMap(content,"value"); 383 } 384 free(tmpMap1->value); 385 tmpMap1->value=(char*) malloc((count+1)*sizeof(char)); 386 fread(tmpMap1->value,1,count,file); 387 tmpMap1->value[count]=0; 379 if(getMap(content,"storage")==NULL){ 380 map* tmpMap1=getMap(content,"value"); 381 if(tmpMap1==NULL){ 382 addToMap(content,"value",""); 383 tmpMap1=getMap(content,"value"); 384 } 385 free(tmpMap1->value); 386 tmpMap1->value=(char*) malloc((count+1)*sizeof(char)); 387 if(tmpMap1->value==NULL){ 388 setMapInMaps(m,"lenv","message","Unable to allocate the memory required to read the produced file."); 389 } 390 fread(tmpMap1->value,1,count,file); 391 tmpMap1->value[count]=0; 392 } 388 393 fclose(file); 389 394 char rsize[1000]; … … 423 428 void dumpMapsValuesToFiles(maps** main_conf,maps** in){ 424 429 map* tmpPath=getMapFromMaps(*main_conf,"main","tmpPath"); 430 map* tmpUrl=getMapFromMaps(*main_conf,"main","tmpUrl"); 425 431 map* tmpSid=getMapFromMaps(*main_conf,"lenv","usid"); 426 432 maps* inputs=*in; … … 450 456 setMapArray(cMap,"cache_file",k,val); 451 457 free(val); 458 val=(char*)malloc((strlen(tmpUrl->value)+strlen(inputs->name)+strlen(tmpSid->value)+strlen(file_ext)+16)*sizeof(char)); 459 sprintf(val,"%s/Input_%s_%s_%d.%s",tmpUrl->value,inputs->name,tmpSid->value,k,file_ext); 460 setMapArray(cMap,"cache_url",k,val); 461 setMapArray(cMap,"byValue",k,"true"); 462 free(val); 452 463 } 453 464 }else{ … … 467 478 addToMap(cMap,"cache_file",val); 468 479 free(val); 469 } 470 addToMap(inputs->content,"byValue","true"); 480 val=(char*)malloc((strlen(tmpUrl->value)+strlen(inputs->name)+strlen(tmpSid->value)+strlen(file_ext)+16)*sizeof(char)); 481 sprintf(val,"%s/Input_%s_%s_%d.%s",tmpUrl->value,inputs->name,tmpSid->value,0,file_ext); 482 addToMap(cMap,"cache_url",val); 483 addToMap(cMap,"byValue",val); 484 free(val); 485 } 471 486 } 472 487 inputs=inputs->next; … … 641 656 } 642 657 if(res==NULL){ 658 map* tmpMaxO0=getMap(tmpInputs->content,"useMapserver"); 659 if(tmpMaxO0!=NULL){ 660 if(tmpMaps2->content==NULL) 661 tmpMaps2->content=createMap("useMapserver",tmpMaxO0->value); 662 else 663 addToMap(tmpMaps2->content,"useMapserver",tmpMaxO0->value); 664 } 643 665 map* tmpMaxO=getMap(tmpInputs->content,"maxOccurs"); 644 666 if(tmpMaxO!=NULL){ … … 714 736 * content map. 715 737 */ 716 map* tmpMap1=getMap(tmpInputs->content,"minOccurs"); 717 if(tmpMap1!=NULL){ 718 if(tmpMaps->content==NULL) 719 tmpMaps->content=createMap("minOccurs",tmpMap1->value); 720 else 721 addToMap(tmpMaps->content,"minOccurs",tmpMap1->value); 722 } 723 map* tmpMaxO=getMap(tmpInputs->content,"maxOccurs"); 724 if(tmpMaxO!=NULL){ 725 if(tmpMaps->content==NULL) 726 tmpMaps->content=createMap("maxOccurs",tmpMaxO->value); 727 else 728 addToMap(tmpMaps->content,"maxOccurs",tmpMaxO->value); 729 } 730 map* tmpMaxMB=getMap(tmpInputs->content,"maximumMegabytes"); 731 if(tmpMaxMB!=NULL){ 732 if(tmpMaps->content==NULL) 733 tmpMaps->content=createMap("maximumMegabytes",tmpMaxMB->value); 734 else 735 addToMap(tmpMaps->content,"maximumMegabytes",tmpMaxMB->value); 738 char* keys[4]={ 739 "minOccurs", 740 "maxOccurs", 741 "maximumMegabytes", 742 "useMapserver" 743 }; 744 int i=0; 745 for(i=0;i<4;i++){ 746 map* tmpMap1=getMap(tmpInputs->content,keys[i]); 747 if(tmpMap1!=NULL){ 748 addToMap(tmpMaps->content,keys[i],tmpMap1->value); 749 } 736 750 } 737 751 /** … … 812 826 if(tmpCheck!=NULL && strncasecmp(tmpCheck->value,"true",4)==0){ 813 827 // Get the default value 828 addToMap(tmpMaps->content,"useMapserver","true"); 814 829 tmpIoType=getIoTypeFromElement(tmpInputs,tmpInputs->name,NULL); 815 830 tmpCheck=getMap(tmpMaps->content,"mimeType");
Note: See TracChangeset
for help on using the changeset viewer.