Changeset 471
- Timestamp:
- May 10, 2014, 4:23:03 PM (10 years ago)
- Location:
- trunk/zoo-project
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/service.h
r469 r471 423 423 if(hasKey(m,n)==false){ 424 424 map* _cursor=m; 425 while(_cursor->next!=NULL) 426 _cursor=_cursor->next; 427 _cursor->next=createMap(n,v); 425 if(_cursor->next!=NULL){ 426 addToMap(_cursor->next,n,v); 427 }else 428 _cursor->next=createMap(n,v); 428 429 } 429 430 else{ … … 455 456 } 456 457 else{ 457 if(tmp1->value!=NULL) 458 free(tmp1->value); 459 tmp1->value=zStrdup(tmp->value); 458 addToMap(*mo,tmp->name,tmp->value); 460 459 } 461 460 } … … 480 479 } 481 480 482 static map* getMapOrFill(map* m,const char *key,char* value){483 map* tmp= m;481 static map* getMapOrFill(map** m,const char *key,char* value){ 482 map* tmp=*m; 484 483 map* tmpMap=getMap(tmp,key); 485 484 if(tmpMap==NULL){ 486 485 if(tmp!=NULL) 487 addToMap( tmp,key,value);486 addToMap(*m,key,value); 488 487 else 489 tmp=createMap(key,value);490 tmpMap=getMap( tmp,key);488 (*m)=createMap(key,value); 489 tmpMap=getMap(*m,key); 491 490 } 492 491 return tmpMap; … … 611 610 fprintf(stderr,"%s\n",tmpSize->value); 612 611 #endif 613 map* ptr=getMapOrFill( m,tmp,(char *)"");612 map* ptr=getMapOrFill(&m,tmp,(char *)""); 614 613 free(ptr->value); 615 614 ptr->value=(char*)malloc((atoi(tmpSize->value)+1)*sizeof(char)); -
trunk/zoo-project/zoo-kernel/service_internal.c
r470 r471 77 77 static HANDLE hMapObjectG = NULL; // handle to file mapping 78 78 79 voidupdateStatus(maps *conf){79 int _updateStatus(maps *conf){ 80 80 LPWSTR lpszTmp; 81 81 BOOL fInit; … … 94 94 if (hMapObjectG == NULL){ 95 95 fprintf(stderr,"Unable to create share memory segment %s !! \n",tmpMap->value); 96 return ;96 return -2; 97 97 } 98 98 fInit = (GetLastError() != ERROR_ALREADY_EXISTS); … … 106 106 if (lpvMemG == NULL){ 107 107 fprintf(stderr,"Unable to create or access the shared memory segment %s !! \n",tmpMap->value); 108 return ;108 return -1; 109 109 } 110 110 memset(lpvMemG, '\0', SHMEMSIZE); … … 120 120 *lpszTmp++ = '\0'; 121 121 free(final_string); 122 return 0; 122 123 } 123 124 … … 200 201 } 201 202 202 voidupdateStatus(maps *conf){203 int _updateStatus(maps *conf){ 203 204 int shmid,i; 204 205 key_t key; … … 212 213 fprintf(stderr,"shmget failed to create new Shared memory segment\n"); 213 214 #endif 215 return -2; 214 216 }else{ 215 217 if ((shm = (char*) shmat(shmid, NULL, 0)) == (char *) -1) { … … 217 219 fprintf(stderr,"shmat failed to update value\n"); 218 220 #endif 221 return -1; 219 222 } 220 223 else{ … … 235 238 } 236 239 } 240 return 0; 237 241 } 238 242 … … 293 297 else 294 298 setMapInMaps(conf,"lenv","status","15"); 295 updateStatus(conf);299 _updateStatus(conf); 296 300 } 297 301 freeMaps(&conf); … … 904 908 } 905 909 906 nc1 = xmlNewNode(NULL, BAD_CAST "DataInputs"); 907 elements* e=serv->inputs; 908 printFullDescription(e,"Input",ns_ows,nc1); 909 xmlAddChild(nc,nc1); 910 if(serv->inputs!=NULL){ 911 nc1 = xmlNewNode(NULL, BAD_CAST "DataInputs"); 912 elements* e=serv->inputs; 913 printFullDescription(e,"Input",ns_ows,nc1); 914 xmlAddChild(nc,nc1); 915 } 910 916 911 917 nc1 = xmlNewNode(NULL, BAD_CAST "ProcessOutputs"); 912 e =serv->outputs;918 elements* e=serv->outputs; 913 919 printFullDescription(e,"Output",ns_ows,nc1); 914 920 xmlAddChild(nc,nc1); … … 934 940 orderedFields[12]="rangeSpace"; 935 941 936 xmlNodePtr nc2,nc3,nc4,nc5,nc6,nc7,nc8 ;942 xmlNodePtr nc2,nc3,nc4,nc5,nc6,nc7,nc8,nc9; 937 943 elements* e=elem; 944 938 945 map* tmp1=NULL; 939 946 while(e!=NULL){ … … 941 948 int isAnyValue=1; 942 949 nc2 = xmlNewNode(NULL, BAD_CAST type); 943 tmp1=getMap(e->content,"minOccurs"); 944 if(tmp1){ 945 xmlNewProp(nc2,BAD_CAST tmp1->name,BAD_CAST tmp1->value); 946 } 947 tmp1=getMap(e->content,"maxOccurs"); 948 if(tmp1){ 949 xmlNewProp(nc2,BAD_CAST tmp1->name,BAD_CAST tmp1->value); 950 if(strncmp(type,"Input",5)==0){ 951 tmp1=getMap(e->content,"minOccurs"); 952 if(tmp1!=NULL){ 953 xmlNewProp(nc2,BAD_CAST tmp1->name,BAD_CAST tmp1->value); 954 }else 955 xmlNewProp(nc2,BAD_CAST "minOccurs",BAD_CAST "0"); 956 tmp1=getMap(e->content,"maxOccurs"); 957 if(tmp1!=NULL){ 958 if(strcasecmp(tmp1->value,"unbounded")!=0) 959 xmlNewProp(nc2,BAD_CAST tmp1->name,BAD_CAST tmp1->value); 960 else 961 xmlNewProp(nc2,BAD_CAST "maxOccurs",BAD_CAST "1000"); 962 }else 963 xmlNewProp(nc2,BAD_CAST "maxOccurs",BAD_CAST "1"); 950 964 } 951 965 952 966 printDescription(nc2,ns_ows,e->name,e->content); 953 967 968 /** 969 * Build the (Literal/Complex/BoundingBox)Data node 970 */ 954 971 if(strncmp(type,"Output",6)==0){ 955 972 if(strncasecmp(e->format,"LITERALDATA",strlen(e->format))==0) … … 972 989 nc3 = xmlNewNode(NULL, BAD_CAST e->format); 973 990 } 991 974 992 iotype* _tmp0=NULL; 975 993 iotype* _tmp=e->defaults; … … 977 995 bool hasDefault=false; 978 996 bool hasUOM=false; 997 bool hasUOM1=false; 979 998 if(_tmp!=NULL){ 980 999 if(strcmp(e->format,"LiteralOutput")==0 || … … 987 1006 strcmp(e->format,"BoundingBoxData")==0){ 988 1007 datatype=2; 989 //nc4 = xmlNewNode(NULL, BAD_CAST "BoundingBoxOutput");990 1008 nc5 = xmlNewNode(NULL, BAD_CAST "Default"); 991 1009 } … … 996 1014 997 1015 tmp1=_tmp->content; 998 int avcnt=0; 999 int dcnt=0; 1000 int oI=0; 1001 for(oI=0;oI<13;oI++) 1002 if((tmp1=getMap(_tmp->content,orderedFields[oI]))!=NULL){ 1003 //while(tmp1!=NULL){ 1004 #ifdef DEBUG 1005 printf("DATATYPE DEFAULT ? %s\n",tmp1->name); 1006 #endif 1007 if(strncasecmp(tmp1->name,"DataType",8)==0){ 1008 nc6 = xmlNewNode(ns_ows, BAD_CAST "DataType"); 1009 xmlAddChild(nc6,xmlNewText(BAD_CAST tmp1->value)); 1010 char tmp[1024]; 1011 sprintf(tmp,"http://www.w3.org/TR/xmlschema-2/#%s",tmp1->value); 1012 xmlNewNsProp(nc6,ns_ows,BAD_CAST "reference",BAD_CAST tmp); 1013 xmlAddChild(nc3,nc6); 1014 tmp1=tmp1->next; 1015 datatype=1; 1016 continue; 1016 1017 if((tmp1=getMap(_tmp->content,"DataType"))!=NULL){ 1018 nc8 = xmlNewNode(ns_ows, BAD_CAST "DataType"); 1019 xmlAddChild(nc8,xmlNewText(BAD_CAST tmp1->value)); 1020 char tmp[1024]; 1021 sprintf(tmp,"http://www.w3.org/TR/xmlschema-2/#%s",tmp1->value); 1022 xmlNewNsProp(nc8,ns_ows,BAD_CAST "reference",BAD_CAST tmp); 1023 xmlAddChild(nc3,nc8); 1024 datatype=1; 1025 } 1026 1027 if(strncmp(type,"Input",5)==0){ 1028 1029 if((tmp1=getMap(_tmp->content,"AllowedValues"))!=NULL){ 1030 nc6 = xmlNewNode(ns_ows, BAD_CAST "AllowedValues"); 1031 char *token,*saveptr1; 1032 token=strtok_r(tmp1->value,",",&saveptr1); 1033 while(token!=NULL){ 1034 nc7 = xmlNewNode(ns_ows, BAD_CAST "Value"); 1035 char *tmps=strdup(token); 1036 tmps[strlen(tmps)]=0; 1037 xmlAddChild(nc7,xmlNewText(BAD_CAST tmps)); 1038 free(tmps); 1039 xmlAddChild(nc6,nc7); 1040 token=strtok_r(NULL,",",&saveptr1); 1017 1041 } 1018 if(strcmp(tmp1->name,"asReference")!=0 && 1019 strncasecmp(tmp1->name,"DataType",8)!=0 && 1020 strcasecmp(tmp1->name,"extension")!=0 && 1021 strcasecmp(tmp1->name,"value")!=0 && 1022 strncasecmp(tmp1->name,"AllowedValues",13)!=0&& 1023 strncasecmp(tmp1->name,"range",5)!=0){ 1024 if(datatype!=1){ 1025 char *tmp2=zCapitalize1(tmp1->name); 1026 nc6 = xmlNewNode(NULL, BAD_CAST tmp2); 1027 free(tmp2); 1028 } 1029 else{ 1030 char *tmp2=zCapitalize(tmp1->name); 1031 nc6 = xmlNewNode(ns_ows, BAD_CAST tmp2); 1032 free(tmp2); 1033 } 1034 xmlAddChild(nc6,xmlNewText(BAD_CAST tmp1->value)); 1035 xmlAddChild(nc5,nc6); 1036 hasUOM=true; 1037 }else 1038 if(strncmp(type,"Input",5)==0){ 1039 1040 if(strcmp(tmp1->name,"value")==0){ 1041 nc7 = xmlNewNode(NULL, BAD_CAST "DefaultValue"); 1042 xmlAddChild(nc7,xmlNewText(BAD_CAST tmp1->value)); 1043 default1=1; 1044 hasDefault=true; 1045 } 1046 if(strncasecmp(tmp1->name,"AllowedValues",13)==0){ 1047 nc6 = xmlNewNode(ns_ows, BAD_CAST "AllowedValues"); 1048 char *token,*saveptr1; 1049 token=strtok_r(tmp1->value,",",&saveptr1); 1050 while(token!=NULL){ 1051 nc7 = xmlNewNode(ns_ows, BAD_CAST "Value"); 1052 char *tmps=strdup(token); 1053 tmps[strlen(tmps)]=0; 1054 xmlAddChild(nc7,xmlNewText(BAD_CAST tmps)); 1055 xmlAddChild(nc6,nc7); 1056 token=strtok_r(NULL,",",&saveptr1); 1042 if(getMap(_tmp->content,"range")!=NULL || 1043 getMap(_tmp->content,"rangeMin")!=NULL || 1044 getMap(_tmp->content,"rangeMax")!=NULL || 1045 getMap(_tmp->content,"rangeClosure")!=NULL ) 1046 goto doRange; 1047 xmlAddChild(nc3,nc6); 1048 isAnyValue=-1; 1049 } 1050 1051 tmp1=getMap(_tmp->content,"range"); 1052 if(tmp1==NULL) 1053 tmp1=getMap(_tmp->content,"rangeMin"); 1054 if(tmp1==NULL) 1055 tmp1=getMap(_tmp->content,"rangeMax"); 1056 1057 if(tmp1!=NULL && isAnyValue==1){ 1058 nc6 = xmlNewNode(ns_ows, BAD_CAST "AllowedValues"); 1059 doRange: 1060 1061 /** 1062 * Range: Table 46 OGC Web Services Common Standard 1063 */ 1064 nc8 = xmlNewNode(ns_ows, BAD_CAST "Range"); 1065 1066 map* tmp0=getMap(tmp1,"range"); 1067 if(tmp0!=NULL){ 1068 char* pToken; 1069 char* orig=zStrdup(tmp0->value); 1070 /** 1071 * RangeClosure: Table 47 OGC Web Services Common Standard 1072 */ 1073 char *tmp="closed"; 1074 if(orig[0]=='[' && orig[strlen(orig)-1]=='[') 1075 tmp="closed-open"; 1076 else 1077 if(orig[0]==']' && orig[strlen(orig)-1]==']') 1078 tmp="open-closed"; 1079 else 1080 if(orig[0]==']' && orig[strlen(orig)-1]=='[') 1081 tmp="open"; 1082 xmlNewNsProp(nc8,ns_ows,BAD_CAST "rangeClosure",BAD_CAST tmp); 1083 pToken=strtok(orig,","); 1084 int nci0=0; 1085 while(pToken!=NULL){ 1086 char *tmpStr=(char*) malloc((strlen(pToken))*sizeof(char)); 1087 if(nci0==0){ 1088 nc7 = xmlNewNode(ns_ows, BAD_CAST "MinimumValue"); 1089 int nci=1; 1090 for(nci=1;nci<strlen(pToken);nci++){ 1091 tmpStr[nci-1]=pToken[nci]; 1057 1092 } 1058 if(getMap(_tmp->content,"range")!=NULL || 1059 getMap(_tmp->content,"rangeMin")!=NULL || 1060 getMap(_tmp->content,"rangeMax")!=NULL || 1061 getMap(_tmp->content,"rangeClosure")!=NULL ) 1062 goto doRange; 1063 xmlAddChild(nc3,nc6); 1064 isAnyValue=-1; 1065 } 1066 if(strncasecmp(tmp1->name,"range",5)==0){ 1067 if(isAnyValue==1){ 1068 nc6 = xmlNewNode(ns_ows, BAD_CAST "AllowedValues"); 1069 doRange: 1070 1071 /** 1072 * Range: Table 46 OGC Web Services Common Standard 1073 */ 1074 nc8 = xmlNewNode(ns_ows, BAD_CAST "Range"); 1075 1076 map* tmp0=getMap(tmp1,"range"); 1077 if(tmp0!=NULL){ 1078 char* pToken; 1079 char* orig=zStrdup(tmp0->value); 1080 /** 1081 * RangeClosure: Table 47 OGC Web Services Common Standard 1082 */ 1083 char *tmp="closed"; 1084 if(orig[0]=='[' && orig[strlen(orig)-1]=='[') 1085 tmp="closed-open"; 1086 else 1087 if(orig[0]==']' && orig[strlen(orig)-1]==']') 1088 tmp="open-closed"; 1089 else 1090 if(orig[0]==']' && orig[strlen(orig)-1]=='[') 1091 tmp="open"; 1092 xmlNewNsProp(nc8,ns_ows,BAD_CAST "rangeClosure",BAD_CAST tmp); 1093 pToken=strtok(orig,","); 1094 int nci0=0; 1095 while(pToken!=NULL){ 1096 char *tmpStr=(char*) malloc((strlen(pToken))*sizeof(char)); 1097 if(nci0==0){ 1098 nc7 = xmlNewNode(ns_ows, BAD_CAST "MinimumValue"); 1099 int nci=1; 1100 for(nci=1;nci<strlen(pToken);nci++){ 1101 tmpStr[nci-1]=pToken[nci]; 1102 } 1103 }else{ 1104 nc7 = xmlNewNode(ns_ows, BAD_CAST "MaximumValue"); 1105 int nci=0; 1106 for(nci=0;nci<strlen(pToken)-1;nci++){ 1107 tmpStr[nci]=pToken[nci]; 1108 } 1109 } 1110 xmlAddChild(nc7,xmlNewText(BAD_CAST tmpStr)); 1111 xmlAddChild(nc8,nc7); 1112 nci0++; 1113 pToken = strtok(NULL,","); 1114 } 1115 if(getMap(tmp1,"rangeSpacing")==NULL){ 1116 nc7 = xmlNewNode(ns_ows, BAD_CAST "Spacing"); 1117 xmlAddChild(nc7,xmlNewText(BAD_CAST "1")); 1118 xmlAddChild(nc8,nc7); 1119 } 1120 }else{ 1121 1122 tmp0=getMap(tmp1,"rangeMin"); 1123 if(tmp0!=NULL){ 1124 nc7 = xmlNewNode(ns_ows, BAD_CAST "MinimumValue"); 1125 xmlAddChild(nc7,xmlNewText(BAD_CAST tmp0->value)); 1126 xmlAddChild(nc8,nc7); 1127 }else{ 1128 nc7 = xmlNewNode(ns_ows, BAD_CAST "MinimumValue"); 1129 xmlAddChild(nc8,nc7); 1130 } 1131 tmp0=getMap(tmp1,"rangeMax"); 1132 if(tmp0!=NULL){ 1133 nc7 = xmlNewNode(ns_ows, BAD_CAST "MaximumValue"); 1134 xmlAddChild(nc7,xmlNewText(BAD_CAST tmp0->value)); 1135 xmlAddChild(nc8,nc7); 1136 }else{ 1137 nc7 = xmlNewNode(ns_ows, BAD_CAST "MaximumValue"); 1138 xmlAddChild(nc8,nc7); 1139 } 1140 tmp0=getMap(tmp1,"rangeSpacing"); 1141 if(tmp0!=NULL){ 1142 nc7 = xmlNewNode(ns_ows, BAD_CAST "Spacing"); 1143 xmlAddChild(nc7,xmlNewText(BAD_CAST tmp0->value)); 1144 xmlAddChild(nc8,nc7); 1145 } 1146 tmp0=getMap(tmp1,"rangeClosure"); 1147 if(tmp0!=NULL){ 1148 char *tmp="closed"; 1149 if(strcasecmp(tmp0->value,"co")==0) 1150 tmp="closed-open"; 1151 else 1152 if(strcasecmp(tmp0->value,"oc")==0) 1153 tmp="open-closed"; 1154 else 1155 if(strcasecmp(tmp0->value,"o")==0) 1156 tmp="open"; 1157 xmlNewNsProp(nc8,ns_ows,BAD_CAST "rangeClosure",BAD_CAST tmp); 1158 }else 1159 xmlNewNsProp(nc8,ns_ows,BAD_CAST "rangeClosure",BAD_CAST "closed"); 1160 } 1161 if(_tmp0==NULL){ 1162 xmlAddChild(nc6,nc8); 1163 _tmp0=e->supported; 1164 tmp1=_tmp0->content; 1165 goto doRange; 1166 }else{ 1167 _tmp0=_tmp0->next; 1168 if(_tmp0!=NULL){ 1169 xmlAddChild(nc6,nc8); 1170 tmp1=_tmp0->content; 1171 goto doRange; 1172 } 1173 1174 } 1175 xmlAddChild(nc6,nc8); 1176 xmlAddChild(nc3,nc6); 1177 isAnyValue=-1; 1093 }else{ 1094 nc7 = xmlNewNode(ns_ows, BAD_CAST "MaximumValue"); 1095 int nci=0; 1096 for(nci=0;nci<strlen(pToken)-1;nci++){ 1097 tmpStr[nci]=pToken[nci]; 1178 1098 } 1179 1099 } 1100 xmlAddChild(nc7,xmlNewText(BAD_CAST tmpStr)); 1101 free(tmpStr); 1102 xmlAddChild(nc8,nc7); 1103 nci0++; 1104 pToken = strtok(NULL,","); 1105 } 1106 if(getMap(tmp1,"rangeSpacing")==NULL){ 1107 nc7 = xmlNewNode(ns_ows, BAD_CAST "Spacing"); 1108 xmlAddChild(nc7,xmlNewText(BAD_CAST "1")); 1109 xmlAddChild(nc8,nc7); 1180 1110 } 1181 tmp1=tmp1->next; 1182 if(datatype!=2){ 1183 if(hasUOM==true){ 1184 xmlAddChild(nc4,nc5); 1185 xmlAddChild(nc3,nc4); 1111 free(orig); 1112 }else{ 1113 1114 tmp0=getMap(tmp1,"rangeMin"); 1115 if(tmp0!=NULL){ 1116 nc7 = xmlNewNode(ns_ows, BAD_CAST "MinimumValue"); 1117 xmlAddChild(nc7,xmlNewText(BAD_CAST tmp0->value)); 1118 xmlAddChild(nc8,nc7); 1119 }else{ 1120 nc7 = xmlNewNode(ns_ows, BAD_CAST "MinimumValue"); 1121 xmlAddChild(nc8,nc7); 1186 1122 } 1123 tmp0=getMap(tmp1,"rangeMax"); 1124 if(tmp0!=NULL){ 1125 nc7 = xmlNewNode(ns_ows, BAD_CAST "MaximumValue"); 1126 xmlAddChild(nc7,xmlNewText(BAD_CAST tmp0->value)); 1127 xmlAddChild(nc8,nc7); 1128 }else{ 1129 nc7 = xmlNewNode(ns_ows, BAD_CAST "MaximumValue"); 1130 xmlAddChild(nc8,nc7); 1131 } 1132 tmp0=getMap(tmp1,"rangeSpacing"); 1133 if(tmp0!=NULL){ 1134 nc7 = xmlNewNode(ns_ows, BAD_CAST "Spacing"); 1135 xmlAddChild(nc7,xmlNewText(BAD_CAST tmp0->value)); 1136 xmlAddChild(nc8,nc7); 1137 } 1138 tmp0=getMap(tmp1,"rangeClosure"); 1139 if(tmp0!=NULL){ 1140 char *tmp="closed"; 1141 if(strcasecmp(tmp0->value,"co")==0) 1142 tmp="closed-open"; 1143 else 1144 if(strcasecmp(tmp0->value,"oc")==0) 1145 tmp="open-closed"; 1146 else 1147 if(strcasecmp(tmp0->value,"o")==0) 1148 tmp="open"; 1149 xmlNewNsProp(nc8,ns_ows,BAD_CAST "rangeClosure",BAD_CAST tmp); 1150 }else 1151 xmlNewNsProp(nc8,ns_ows,BAD_CAST "rangeClosure",BAD_CAST "closed"); 1152 } 1153 if(_tmp0==NULL){ 1154 xmlAddChild(nc6,nc8); 1155 _tmp0=e->supported; 1156 tmp1=_tmp0->content; 1157 goto doRange; 1187 1158 }else{ 1188 xmlAddChild(nc3,nc5);1189 }1190 if(strncmp(type,"Input",5)==0){1191 if(datatype==1 && isAnyValue==1 && default1>0){1192 xmlAddChild(nc3,nc7);1159 _tmp0=_tmp0->next; 1160 if(_tmp0!=NULL){ 1161 xmlAddChild(nc6,nc8); 1162 tmp1=_tmp0->content; 1163 goto doRange; 1193 1164 } 1194 1165 } 1195 1196 } 1197 if(strncmp(type,"Input",5)==0){ 1198 if(datatype==1 && isAnyValue==1 && avcnt==0){ 1199 xmlAddChild(nc3,xmlNewNode(ns_ows, BAD_CAST "AnyValue")); 1200 hasDefault=true; 1201 avcnt++; 1202 } 1203 } 1166 xmlAddChild(nc6,nc8); 1167 xmlAddChild(nc3,nc6); 1168 isAnyValue=-1; 1169 } 1170 1171 } 1172 1204 1173 1174 int avcnt=0; 1175 int dcnt=0; 1176 int oI=0; 1177 for(oI=0;oI<13;oI++) 1178 if((tmp1=getMap(_tmp->content,orderedFields[oI]))!=NULL){ 1179 #ifdef DEBUG 1180 printf("DATATYPE DEFAULT ? %s\n",tmp1->name); 1181 #endif 1182 if(strcmp(tmp1->name,"asReference")!=0 && 1183 strncasecmp(tmp1->name,"DataType",8)!=0 && 1184 strcasecmp(tmp1->name,"extension")!=0 && 1185 strcasecmp(tmp1->name,"value")!=0 && 1186 strcasecmp(tmp1->name,"AllowedValues")!=0 && 1187 strncasecmp(tmp1->name,"range",5)!=0){ 1188 if(datatype!=1){ 1189 char *tmp2=zCapitalize1(tmp1->name); 1190 nc9 = xmlNewNode(NULL, BAD_CAST tmp2); 1191 free(tmp2); 1192 } 1193 else{ 1194 char *tmp2=zCapitalize(tmp1->name); 1195 nc9 = xmlNewNode(ns_ows, BAD_CAST tmp2); 1196 free(tmp2); 1197 } 1198 xmlAddChild(nc9,xmlNewText(BAD_CAST tmp1->value)); 1199 xmlAddChild(nc5,nc9); 1200 if(strcasecmp(tmp1->name,"uom")==0) 1201 hasUOM1=true; 1202 hasUOM=true; 1203 }else 1204 1205 tmp1=tmp1->next; 1206 } 1207 1208 1209 if(datatype!=2){ 1210 if(hasUOM==true){ 1211 xmlAddChild(nc4,nc5); 1212 xmlAddChild(nc3,nc4); 1213 }else{ 1214 if(hasUOM1==false){ 1215 xmlFreeNode(nc5); 1216 if(datatype==1) 1217 xmlFreeNode(nc4); 1218 } 1219 } 1220 }else{ 1221 xmlAddChild(nc3,nc5); 1222 } 1223 1224 if(datatype!=1 && default1<0){ 1225 xmlFreeNode(nc5); 1226 if(datatype!=2) 1227 xmlFreeNode(nc4); 1228 } 1229 1205 1230 map* metadata=e->metadata; 1206 1231 xmlNodePtr n; … … 1209 1234 1210 1235 while(metadata!=NULL){ 1211 nc6=xmlNewNode(ns_ows, BAD_CAST "Meta Data");1236 nc6=xmlNewNode(ns_ows, BAD_CAST "Metadata"); 1212 1237 xmlNewNsProp(nc6,ns_xlink,BAD_CAST metadata->name,BAD_CAST metadata->value); 1213 1238 xmlAddChild(nc2,nc6); 1214 1239 metadata=metadata->next; 1215 1240 } 1241 1216 1242 } 1217 1243 1218 1244 _tmp=e->supported; 1219 if(_tmp==NULL && (getMap(e->defaults->content,"uom")!=NULL || datatype!=1))1245 if(_tmp==NULL && datatype!=1) 1220 1246 _tmp=e->defaults; 1221 1247 1222 1248 int hasSupported=-1; 1249 1223 1250 while(_tmp!=NULL){ 1224 1251 if(hasSupported<0){ … … 1241 1268 #endif 1242 1269 if(strcmp(tmp1->name,"asReference")!=0 && 1270 strcmp(tmp1->name,"value")!=0 && 1243 1271 strcmp(tmp1->name,"DataType")!=0 && 1244 1272 strcasecmp(tmp1->name,"extension")!=0){ … … 1258 1286 while(tmps){ 1259 1287 xmlAddChild(nc6,xmlNewText(BAD_CAST tmps)); 1260 xmlAddChild(nc5,nc6);1261 1288 tmps=strtok_r(NULL,",",&tmpv); 1262 1289 if(tmps){ … … 1269 1296 else{ 1270 1297 xmlAddChild(nc6,xmlNewText(BAD_CAST tmp1->value)); 1271 xmlAddChild(nc5,nc6);1272 1298 } 1299 xmlAddChild(nc5,nc6); 1273 1300 } 1274 1301 tmp1=tmp1->next; 1275 1302 } 1276 1303 if(hasSupported<=0){ 1277 if(datatype !=2){1304 if(datatype==0){ 1278 1305 xmlAddChild(nc4,nc5); 1279 1306 xmlAddChild(nc3,nc4); 1280 }else 1281 xmlAddChild(nc3,nc5); 1307 }else{ 1308 if(datatype!=1) 1309 xmlAddChild(nc3,nc5); 1310 } 1282 1311 hasSupported=1; 1283 1312 } 1284 1313 else 1285 if(datatype !=2){1314 if(datatype==0){ 1286 1315 xmlAddChild(nc4,nc5); 1316 xmlAddChild(nc3,nc4); 1287 1317 } 1288 1318 else 1289 xmlAddChild(nc3,nc5); 1319 if(datatype!=1) 1320 xmlAddChild(nc3,nc5); 1321 1290 1322 _tmp=_tmp->next; 1291 1323 } 1324 1325 if(hasSupported==0){ 1326 if(datatype==0) 1327 xmlFreeNode(nc4); 1328 xmlFreeNode(nc5); 1329 } 1330 1331 _tmp=e->defaults; 1332 if(datatype==1 && hasUOM1==true){ 1333 xmlAddChild(nc4,nc5); 1334 xmlAddChild(nc3,nc4); 1335 } 1336 1337 if(datatype==1 && 1338 getMap(_tmp->content,"AllowedValues")==NULL && 1339 getMap(_tmp->content,"range")==NULL && 1340 getMap(_tmp->content,"rangeMin")==NULL && 1341 getMap(_tmp->content,"rangeMax")==NULL && 1342 getMap(_tmp->content,"rangeClosure")==NULL ){ 1343 tmp1=getMap(_tmp->content,"dataType"); 1344 if(tmp1!=NULL) 1345 if(strcasecmp(tmp1->value,"boolean")==0){ 1346 nc6 = xmlNewNode(ns_ows, BAD_CAST "AllowedValues"); 1347 nc7 = xmlNewNode(ns_ows, BAD_CAST "Value"); 1348 xmlAddChild(nc7,xmlNewText(BAD_CAST "true")); 1349 xmlAddChild(nc6,nc7); 1350 nc7 = xmlNewNode(ns_ows, BAD_CAST "Value"); 1351 xmlAddChild(nc7,xmlNewText(BAD_CAST "false")); 1352 xmlAddChild(nc6,nc7); 1353 xmlAddChild(nc3,nc6); 1354 } 1355 xmlAddChild(nc3,xmlNewNode(ns_ows, BAD_CAST "AnyValue")); 1356 } 1357 1358 if((tmp1=getMap(_tmp->content,"value"))!=NULL){ 1359 nc7 = xmlNewNode(NULL, BAD_CAST "DefaultValue"); 1360 xmlAddChild(nc7,xmlNewText(BAD_CAST tmp1->value)); 1361 xmlAddChild(nc3,nc7); 1362 } 1363 1292 1364 xmlAddChild(nc2,nc3); 1293 1294 if(datatype!=2 && hasUOM==true){1295 xmlAddChild(nc3,nc4);1296 xmlAddChild(nc2,nc3);1297 }/*else if(datatype!=2){1298 if(hasDefault!=true && strncmp(type,"Input",5)==0 && isAnyValue==1)1299 xmlAddChild(nc3,xmlNewNode(ns_ows, BAD_CAST "AnyValue"));1300 }*/1301 1365 1302 1366 xmlAddChild(nc1,nc2); … … 1568 1632 freeMap(&errormap); 1569 1633 free(errormap); 1634 xmlFreeDoc(doc); 1570 1635 xmlCleanupParser(); 1571 1636 zooXmlCleanupNs(); … … 1800 1865 NULL,NULL, 0); 1801 1866 testMap=getMap(m->content,"Reference"); 1802 loadRemoteFile( m,m->content,hInternet,testMap->value);1867 loadRemoteFile(&m,&m->content,hInternet,testMap->value); 1803 1868 InternetCloseHandle(hInternet); 1804 1869 } … … 1997 2062 xmlCleanupParser(); 1998 2063 zooXmlCleanupNs(); 1999 setMapInMaps(m,"lenv","hasPrinted","true"); 2064 if(m!=NULL) 2065 setMapInMaps(m,"lenv","hasPrinted","true"); 2000 2066 } 2001 2067 … … 2766 2832 #endif 2767 2833 FILE* fo=fopen(fname,"w+"); 2834 if(fo==NULL){ 2835 fprintf (stderr, "Failed to open %s for writting: %s\n",fname, strerror(errno)); 2836 return; 2837 } 2768 2838 fwrite(content,sizeof(char),length,fo); 2769 2839 fclose(fo); … … 2807 2877 * Try to load file from cache or download a remote file if not in cache 2808 2878 */ 2809 int loadRemoteFile(maps* m,map* content,HINTERNET hInternet,char *url){2879 int loadRemoteFile(maps** m,map** content,HINTERNET hInternet,char *url){ 2810 2880 HINTERNET res; 2811 2881 char* fcontent; 2812 char* cached=isInCache( m,url);2882 char* cached=isInCache(*m,url); 2813 2883 char *mimeType=NULL; 2814 2884 int fsize; … … 2838 2908 fcontent=(char*)malloc((res.nDataLen+1)*sizeof(char)); 2839 2909 if(fcontent == NULL){ 2840 return errorException( m, _("Unable to allocate memory."), "InternalError",NULL);2910 return errorException(*m, _("Unable to allocate memory."), "InternalError",NULL); 2841 2911 } 2842 2912 size_t dwRead; … … 2847 2917 } 2848 2918 if(fsize==0){ 2849 return errorException( m, _("Unable to download the file."), "InternalError",NULL);2919 return errorException(*m, _("Unable to download the file."), "InternalError",NULL); 2850 2920 } 2851 2921 2852 2922 if(mimeType!=NULL){ 2853 addToMap( content,"fmimeType",mimeType);2923 addToMap(*content,"fmimeType",mimeType); 2854 2924 } 2855 2925 … … 2865 2935 char ltmp1[256]; 2866 2936 sprintf(ltmp1,"%d",fsize); 2867 addToMap( content,"size",ltmp1);2937 addToMap(*content,"size",ltmp1); 2868 2938 if(cached==NULL) 2869 addToCache( m,url,fcontent,mimeType,fsize);2939 addToCache(*m,url,fcontent,mimeType,fsize); 2870 2940 else{ 2871 2941 free(fcontent); … … 2965 3035 } 2966 3036 3037 3038 int updateStatus( maps* conf, const int percentCompleted, const char* message ){ 3039 char tmp[4]; 3040 snprintf(tmp,4,"%d",percentCompleted); 3041 setMapInMaps( conf, "lenv", "status", tmp ); 3042 setMapInMaps( conf, "lenv", "message", message); 3043 return _updateStatus( conf ); 3044 } 3045 3046 char* getInputValue( maps* inputs, const char* parameterName, size_t* numberOfBytes){ 3047 map* res=getMapFromMaps(inputs,parameterName,"value"); 3048 if(res!=NULL){ 3049 map* size=getMapFromMaps(inputs,parameterName,"size"); 3050 if(size!=NULL){ 3051 *numberOfBytes=(size_t)atoi(size->value); 3052 return res->value; 3053 }else{ 3054 *numberOfBytes=strlen(res->value); 3055 return res->value; 3056 } 3057 } 3058 return NULL; 3059 } 3060 3061 int setOutputValue( maps* outputs, const char* parameterName, char* data, size_t numberOfBytes ){ 3062 if(numberOfBytes==-1){ 3063 setMapInMaps(outputs,parameterName,"value",data); 3064 }else{ 3065 char size[1024]; 3066 map* tmp=getMapFromMaps(outputs,parameterName,"value"); 3067 free(tmp->value); 3068 tmp->value=(char*) malloc((numberOfBytes+1)*sizeof(char)); 3069 memcpy(tmp->value,data,numberOfBytes); 3070 sprintf(size,"%d",numberOfBytes); 3071 setMapInMaps(outputs,parameterName,"size",size); 3072 } 3073 return 0; 3074 } -
trunk/zoo-project/zoo-kernel/service_internal.h
r469 r471 31 31 #define TIME_SIZE 40 32 32 33 #include "fcgi_stdio.h" 33 34 #include <libintl.h> 34 35 #include <locale.h> … … 96 97 void printHeaders(maps*); 97 98 void unhandleStatus(maps*); 98 voidupdateStatus(maps*);99 int _updateStatus(maps*); 99 100 char* getStatus(int); 100 101 … … 143 144 void addToCache(maps*,char*,char*,char*,int); 144 145 char* isInCache(maps*,char*); 145 int loadRemoteFile(maps* ,map*,HINTERNET,char*);146 int loadRemoteFile(maps**,map**,HINTERNET,char*); 146 147 147 148 #ifdef USE_MS … … 149 150 #endif 150 151 void parseIdentifier(maps*,char*,char*,char*); 152 int updateStatus( maps*,const int,const char*); 153 char* getInputValue( maps*,const char*,size_t*); 154 int setOutputValue( maps*, const char*, char*, size_t); 151 155 152 156 #ifdef __cplusplus -
trunk/zoo-project/zoo-kernel/service_internal_js.c
r453 r471 39 39 for(i=0;i<argc;i++){ 40 40 JSString* jsmsg = JS_ValueToString(cx,argv[i]); 41 fprintf(stderr,"[ZOO-API:JS] %s\n",JS_EncodeString(cx,jsmsg)); 41 char *tmp=JS_EncodeString(cx,jsmsg); 42 fprintf(stderr,"[ZOO-API:JS] %s\n",tmp); 43 free(tmp); 42 44 } 43 45 JS_MaybeGC(cx); … … 69 71 #endif 70 72 JSObject *api_script1=loadZooApiFile(cx,JS_GetGlobalObject(cx),api0); 73 free(api0); 71 74 } 72 75 JS_MaybeGC(cx); … … 158 161 #endif 159 162 JSObject *api_script1=loadZooApiFile(cx,global,api0); 163 free(api0); 160 164 fflush(stderr); 161 165 … … 166 170 #endif 167 171 JSObject *api_script2=loadZooApiFile(cx,global,api1); 172 free(api1); 168 173 fflush(stderr); 169 174 … … 183 188 struct stat file_status; 184 189 stat(filename, &file_status); 185 char *source=(char*)malloc(file_status.st_size);190 //char *source=(char*)malloc(file_status.st_size); 186 191 uint16 lineno; 187 192 jsval rval; … … 194 199 char tmp1[1024]; 195 200 sprintf(tmp1,"Unable to load JavaScript file %s",filename); 201 free(filename); 196 202 map* err=createMap("text",tmp1); 197 add MapToMap(&err,createMap("code","NoApplicableCode"));203 addToMap(err,"code","NoApplicableCode"); 198 204 printExceptionReportResponse(mc,err); 205 freeMap(&err); 206 free(err); 207 JS_MaybeGC(cx); 199 208 JS_DestroyContext(cx); 200 209 JS_DestroyRuntime(rt); 201 210 JS_ShutDown(); 202 exit(-1); 203 } 211 return -1; 212 } 213 204 214 205 215 /* Call a function in obj's scope. */ … … 243 253 freeMap(&err); 244 254 free(err); 255 free(filename); 256 JS_MaybeGC(cx); 245 257 JS_DestroyContext(cx); 246 258 JS_DestroyRuntime(rt); 247 259 JS_ShutDown(); 248 260 // Should return -1 here but the unallocation won't work from zoo_service_loader.c line 1847 249 exit(-1);261 return -1; 250 262 } 251 263 … … 344 356 JS_DestroyRuntime(rt); 345 357 JS_ShutDown(); 358 free(filename); 346 359 #ifdef JS_DEBUG 347 360 fprintf(stderr,"Returned value %d\n",res); … … 481 494 jsmsg = JS_ValueToString(cx,vp); 482 495 len1 = JS_GetStringLength(jsmsg); 483 496 497 tmp=JS_EncodeString(cx,jsmsg); 484 498 tres=(maps*)malloc(MAPS_SIZE); 485 tres->name=zStrdup( JS_EncodeString(cx,jsmsg));499 tres->name=zStrdup(tmp); 486 500 tres->content=NULL; 487 501 tres->next=NULL; 488 502 489 503 jsval nvp=JSVAL_NULL; 490 if((JS_GetProperty(cx, tt, JS_EncodeString(cx,jsmsg), &nvp)==JS_FALSE)){491 #ifdef JS_DEBUG 492 fprintf(stderr,"Enumerate id : %d => %s => No more value\n",oi, JS_EncodeString(cx,jsmsg));504 if((JS_GetProperty(cx, tt, tmp, &nvp)==JS_FALSE)){ 505 #ifdef JS_DEBUG 506 fprintf(stderr,"Enumerate id : %d => %s => No more value\n",oi,tmp); 493 507 #endif 494 508 } 495 509 free(tmp); 496 510 JSObject *nvp1=JSVAL_TO_OBJECT(JSVAL_NULL); 497 511 JS_ValueToObject(cx,nvp,&nvp1); … … 510 524 511 525 } 526 JS_DestroyIdArray(cx,idp); 512 527 } 513 528 } … … 550 565 jsmsg = JS_ValueToString(cx,vp); 551 566 len1 = JS_GetStringLength(jsmsg); 552 #ifdef JS_DEBUG 553 fprintf(stderr,"Enumerate id : %d => %s\n",oi,JS_EncodeString(cx,jsmsg)); 567 tmp=JS_EncodeString(cx,jsmsg); 568 #ifdef JS_DEBUG 569 fprintf(stderr,"Enumerate id : %d => %s\n",oi,tmp); 554 570 #endif 555 571 jsval nvp=JSVAL_NULL; 556 if((JS_GetProperty(cx, JSVAL_TO_OBJECT(tmp1), JS_EncodeString(cx,jsmsg), &nvp)==JS_FALSE)){557 #ifdef JS_DEBUG 558 fprintf(stderr,"Enumerate id : %d => %s => No more value\n",oi, JS_EncodeString(cx,jsmsg));572 if((JS_GetProperty(cx, JSVAL_TO_OBJECT(tmp1), tmp, &nvp)==JS_FALSE)){ 573 #ifdef JS_DEBUG 574 fprintf(stderr,"Enumerate id : %d => %s => No more value\n",oi,tmp); 559 575 #endif 560 576 } 561 577 free(tmp); 562 578 if(JSVAL_IS_OBJECT(nvp)){ 563 579 #ifdef JS_DEBUG … … 571 587 if(JSVAL_IS_OBJECT(nvp1j)){ 572 588 JSString *jsmsg1; 589 char *tmp1, *tmp2; 573 590 JSObject *nvp2=JSVAL_TO_OBJECT(JSVAL_NULL); 574 591 jsmsg1 = JS_ValueToString(cx,nvp1j); 575 592 len1 = JS_GetStringLength(jsmsg1); 576 #ifdef JS_DEBUG 577 fprintf(stderr,"JSVAL NVP1J IS OBJECT %s = %s\n",JS_EncodeString(cx,jsmsg),JS_EncodeString(cx,jsmsg1)); 578 #endif 579 if(strcasecmp(JS_EncodeString(cx,jsmsg1),"[object Object]")==0){ 580 tres->name=zStrdup(JS_EncodeString(cx,jsmsg)); 593 tmp1=JS_EncodeString(cx,jsmsg1); 594 tmp2=JS_EncodeString(cx,jsmsg); 595 #ifdef JS_DEBUG 596 fprintf(stderr,"JSVAL NVP1J IS OBJECT %s = %s\n",JS_EncodeString(cx,jsmsg),tmp1); 597 #endif 598 if(strcasecmp(tmp1,"[object Object]")==0){ 599 tres->name=zStrdup(tmp2); 581 600 tres->content=mapFromJSObject(cx,nvp1j); 582 601 } 583 602 else 584 if(strcasecmp( JS_EncodeString(cx,jsmsg),"name")==0){585 tres->name=zStrdup( JS_EncodeString(cx,jsmsg1));603 if(strcasecmp(tmp2,"name")==0){ 604 tres->name=zStrdup(tmp1); 586 605 } 587 606 else{ 588 607 if(tres->content==NULL) 589 tres->content=createMap( JS_EncodeString(cx,jsmsg),JS_EncodeString(cx,jsmsg1));608 tres->content=createMap(tmp2,tmp1); 590 609 else 591 addToMap(tres->content, JS_EncodeString(cx,jsmsg),JS_EncodeString(cx,jsmsg1));610 addToMap(tres->content,tmp2,tmp1); 592 611 } 612 free(tmp1); 613 free(tmp2); 593 614 } 594 615 #ifdef JS_DEBUG … … 607 628 free(tres); 608 629 tres=NULL; 609 630 JS_DestroyIdArray(cx,idp); 610 631 } 611 632 } … … 633 654 JSString* str; 634 655 JS_IdToValue(cx,id,&vp); 635 char *c, *tmp ;656 char *c, *tmp, *tmp1; 636 657 JSString *jsmsg,*jsmsg1; 637 658 size_t len,len1; … … 639 660 len = JS_GetStringLength(jsmsg); 640 661 jsval nvp; 641 JS_GetProperty(cx, JSVAL_TO_OBJECT(t), JS_EncodeString(cx,jsmsg), &nvp); 662 tmp=JS_EncodeString(cx,jsmsg); 663 JS_GetProperty(cx, JSVAL_TO_OBJECT(t), tmp, &nvp); 642 664 jsmsg1 = JS_ValueToString(cx,nvp); 643 665 len1 = JS_GetStringLength(jsmsg1); 644 #ifdef JS_DEBUG 645 fprintf(stderr,"Enumerate id : %d [ %s => %s ]\n",index,JS_EncodeString(cx,jsmsg),JS_EncodeString(cx,jsmsg1)); 666 tmp1=JS_EncodeString(cx,jsmsg1); 667 #ifdef JS_DEBUG 668 fprintf(stderr,"Enumerate id : %d [ %s => %s ]\n",index,tmp,tmp1); 646 669 #endif 647 670 if(res!=NULL){ 648 671 #ifdef JS_DEBUG 649 fprintf(stderr,"%s - %s\n", JS_EncodeString(cx,jsmsg),JS_EncodeString(cx,jsmsg1));650 #endif 651 addToMap(res, JS_EncodeString(cx,jsmsg),JS_EncodeString(cx,jsmsg1));672 fprintf(stderr,"%s - %s\n",tmp,tmp1); 673 #endif 674 addToMap(res,tmp,tmp1); 652 675 } 653 676 else{ 654 res=createMap( JS_EncodeString(cx,jsmsg),JS_EncodeString(cx,jsmsg1));677 res=createMap(tmp,tmp1); 655 678 res->next=NULL; 656 679 } 680 free(tmp); 681 free(tmp1); 657 682 #ifdef JS_DEBUG 658 683 dumpMap(res); 659 684 #endif 660 685 } 686 JS_DestroyIdArray(cx,idp); 661 687 } 662 688 #ifdef JS_DEBUG -
trunk/zoo-project/zoo-kernel/service_internal_python.c
r469 r471 389 389 PyObject* value=PyString_FromStringAndSize(tmp->value,atoi(size->value)); 390 390 if(PyDict_SetItem(res,name,value)<0){ 391 Py_DECREF(value); 391 392 fprintf(stderr,"Unable to set key value pair..."); 392 393 return NULL; 393 394 } 395 Py_DECREF(value); 394 396 } 395 397 else{ 396 398 PyObject* value=PyString_FromString(tmp->value); 397 399 if(PyDict_SetItem(res,name,value)<0){ 400 Py_DECREF(value); 398 401 fprintf(stderr,"Unable to set key value pair..."); 399 402 return NULL; 400 403 } 404 Py_DECREF(value); 401 405 } 402 406 } … … 405 409 PyObject* value=PyString_FromString(tmp->value); 406 410 if(PyDict_SetItem(res,name,value)<0){ 411 Py_DECREF(value); 407 412 fprintf(stderr,"Unable to set key value pair..."); 408 413 return NULL; 409 414 } 415 Py_DECREF(value); 410 416 } 411 417 } … … 446 452 free(cursor->content); 447 453 free(cursor); 454 Py_DECREF(key); 448 455 #ifdef DEBUG 449 456 dumpMaps(res); … … 489 496 addToMap(res,"size",sin); 490 497 }else{ 498 char* lkey=PyString_AsString(key); 499 char* lvalue=PyString_AsString(value); 491 500 if(res!=NULL){ 492 501 if(PyString_Size(value)>0) 493 addToMap(res, PyString_AsString(key),PyString_AsString(value));502 addToMap(res,lkey,lvalue); 494 503 } 495 504 else{ 496 505 if(PyString_Size(value)>0) 497 res=createMap(PyString_AsString(key),PyString_AsString(value)); 498 } 499 } 506 res=createMap(lkey,lvalue); 507 } 508 } 509 Py_DECREF(value); 510 Py_DECREF(key); 500 511 } 501 512 return res; … … 554 565 else 555 566 setMapInMaps(conf,"lenv","status","15"); 556 updateStatus(conf);567 _updateStatus(conf); 557 568 } 558 569 freeMaps(&conf); -
trunk/zoo-project/zoo-kernel/ulinet.c
r470 r471 170 170 ret.mimeType = NULL; 171 171 172 ret.handle=curl_share_init(); 173 174 curl_share_setopt(ret.handle, CURLOPT_COOKIEFILE, "ALL"); 172 curl_global_init(CURL_GLOBAL_ALL|CURL_GLOBAL_SSL|CURL_GLOBAL_WIN32); 173 ret.handle=curl_easy_init(); 174 175 curl_easy_setopt(ret.handle, CURLOPT_COOKIEFILE, "ALL"); 175 176 #ifndef TIGER 176 curl_ share_setopt(ret.handle, CURLOPT_COOKIELIST, "ALL");177 #endif 178 curl_ share_setopt(ret.handle, CURLOPT_USERAGENT, lpszAgent);179 180 curl_ share_setopt(ret.handle,CURLOPT_FOLLOWLOCATION,1);181 curl_ share_setopt(ret.handle,CURLOPT_MAXREDIRS,3);177 curl_easy_setopt(ret.handle, CURLOPT_COOKIELIST, "ALL"); 178 #endif 179 curl_easy_setopt(ret.handle, CURLOPT_USERAGENT, lpszAgent); 180 181 curl_easy_setopt(ret.handle,CURLOPT_FOLLOWLOCATION,1); 182 curl_easy_setopt(ret.handle,CURLOPT_MAXREDIRS,3); 182 183 183 184 header.memory=NULL; 184 185 header.size = 0; 185 186 186 curl_ share_setopt(ret.handle, CURLOPT_HEADERFUNCTION, header_write_data);187 curl_ share_setopt(ret.handle, CURLOPT_WRITEHEADER, (void *)&header);188 189 #ifdef MSG_LAF_VERBOSE 190 curl_ share_setopt(ret.handle, CURLOPT_VERBOSE, 1);187 curl_easy_setopt(ret.handle, CURLOPT_HEADERFUNCTION, header_write_data); 188 curl_easy_setopt(ret.handle, CURLOPT_WRITEHEADER, (void *)&header); 189 190 #ifdef MSG_LAF_VERBOSE 191 curl_easy_setopt(ret.handle, CURLOPT_VERBOSE, 1); 191 192 #endif 192 193 … … 206 207 } 207 208 if(handle.handle) 208 curl_ share_cleanup(handle.handle);209 curl_easy_cleanup(handle.handle); 209 210 curl_global_cleanup(); 210 211 } … … 222 223 case INTERNET_FLAG_NO_CACHE_WRITE: 223 224 hInternet.hasCacheFile=-1; 224 curl_ share_setopt(hInternet.handle, CURLOPT_WRITEFUNCTION, write_data_into);225 curl_ share_setopt(hInternet.handle, CURLOPT_WRITEDATA, &hInternet);225 curl_easy_setopt(hInternet.handle, CURLOPT_WRITEFUNCTION, write_data_into); 226 curl_easy_setopt(hInternet.handle, CURLOPT_WRITEDATA, &hInternet); 226 227 break; 227 228 default: … … 236 237 237 238 hInternet.hasCacheFile=1; 238 curl_ share_setopt(hInternet.handle, CURLOPT_WRITEFUNCTION, NULL);239 curl_ share_setopt(hInternet.handle, CURLOPT_WRITEDATA, hInternet.file);239 curl_easy_setopt(hInternet.handle, CURLOPT_WRITEFUNCTION, NULL); 240 curl_easy_setopt(hInternet.handle, CURLOPT_WRITEDATA, hInternet.file); 240 241 hInternet.nDataLen=0; 241 242 break; … … 250 251 #endif 251 252 //curl_easy_setopt(hInternet.handle,CURLOPT_COOKIE,lpszHeaders); 252 curl_ share_setopt(hInternet.handle,CURLOPT_POST,1);253 curl_easy_setopt(hInternet.handle,CURLOPT_POST,1); 253 254 #ifdef ULINET_DEBUG 254 255 fprintf(stderr,"** (%s) %d **\n",lpszHeaders,dwHeadersLength); 255 curl_ share_setopt(hInternet.handle,CURLOPT_VERBOSE,1);256 #endif 257 curl_ share_setopt(hInternet.handle,CURLOPT_POSTFIELDS,lpszHeaders);256 curl_easy_setopt(hInternet.handle,CURLOPT_VERBOSE,1); 257 #endif 258 curl_easy_setopt(hInternet.handle,CURLOPT_POSTFIELDS,lpszHeaders); 258 259 //curl_easy_setopt(hInternet.handle,CURLOPT_POSTFIELDSIZE,dwHeadersLength+1); 259 260 if(hInternet.header!=NULL) 260 curl_ share_setopt(hInternet.handle,CURLOPT_HTTPHEADER,hInternet.header);261 } 262 263 curl_ share_setopt(hInternet.handle,CURLOPT_URL,lpszUrl);261 curl_easy_setopt(hInternet.handle,CURLOPT_HTTPHEADER,hInternet.header); 262 } 263 264 curl_easy_setopt(hInternet.handle,CURLOPT_URL,lpszUrl); 264 265 curl_easy_perform(hInternet.handle); 265 266 curl_easy_getinfo(hInternet.handle,CURLINFO_CONTENT_TYPE,&hInternet.mimeType); … … 273 274 memset(&CCookie[0],0,1024); 274 275 #ifndef TIGER 275 curl_ share_setopt(hInternet.handle, CURLOPT_COOKIELIST, "ALL");276 curl_easy_setopt(hInternet.handle, CURLOPT_COOKIELIST, "ALL"); 276 277 #endif 277 278 return 1; -
trunk/zoo-project/zoo-kernel/ulinet.h
r470 r471 26 26 #define _ULINET_H 27 27 28 #include " stdio.h"28 #include "fcgi_stdio.h" 29 29 #include <stdlib.h> 30 30 #include <fcntl.h> -
trunk/zoo-project/zoo-kernel/zoo_service_loader.c
r469 r471 504 504 printExceptionReportResponse(m,tmps1); 505 505 *eres=-1; 506 freeMap(&tmps1); 507 free(tmps1); 506 508 } 507 509 } … … 683 685 _getcwd(ntmp,1024); 684 686 #endif 685 r_inputs=getMapOrFill( request_inputs,"metapath","");687 r_inputs=getMapOrFill(&request_inputs,"metapath",""); 686 688 687 689 … … 783 785 freeMaps(&m); 784 786 free(m); 787 if(request_inputs!=NULL){ 788 freeMap(&request_inputs); 789 free(request_inputs); 790 } 785 791 return 1; 786 792 } … … 972 978 setMapInMaps(m,"lenv","level","0"); 973 979 } 980 free(corig); 974 981 975 982 memset(buff,0,256); … … 1395 1402 #endif 1396 1403 { 1397 if(loadRemoteFile( m,tmpmaps->content,hInternet,tmpx2)<0){1404 if(loadRemoteFile(&m,&tmpmaps->content,hInternet,tmpx2)<0){ 1398 1405 freeMaps(&m); 1399 1406 free(m); … … 1557 1564 if(!(ltmp!=NULL && strncmp(ltmp->value,"POST",4)==0) 1558 1565 && CHECK_INET_HANDLE(hInternet)){ 1559 if(loadRemoteFile( m,tmpmaps->content,hInternet,(char*)val)!=0){1566 if(loadRemoteFile(&m,&tmpmaps->content,hInternet,(char*)val)!=0){ 1560 1567 freeMaps(&m); 1561 1568 free(m); -
trunk/zoo-project/zoo-services/gdal/profile/cgi-env/GdalExtractProfile.zcfg
r106 r471 6 6 statusSupported = true 7 7 serviceType = C 8 serviceProvider = gdal_profile_service.zo8 serviceProvider = profile_service.zo 9 9 <MetaData> 10 10 title = My Demo -
trunk/zoo-project/zoo-services/qrencode/Makefile
r385 r471 5 5 6 6 cgi-env/qrencode.zo: qrenc-service.c 7 g++ -DZOO_SERVICE_PROVIDER ${CFLAGS} -shared -fpic -o cgi-env/qrencode.zo ./qrenc-service.c -lqrencode ${GDAL_LIBS} ${MACOS_LD_FLAGS}7 g++ -DZOO_SERVICE_PROVIDER ${CFLAGS} -shared -fpic -o cgi-env/qrencode.zo ./qrenc-service.c -lqrencode ${GDAL_LIBS} -lpng ${MACOS_LD_FLAGS} 8 8 9 9 clean: -
trunk/zoo-project/zoo-services/qrencode/cgi-env/QREncode.zcfg
r385 r471 29 29 <LiteralData> 30 30 dataType = string 31 <Default /> 31 <Default> 32 value=000000 33 </Default> 32 34 </LiteralData> 33 35 [bgcolor] … … 38 40 <LiteralData> 39 41 dataType = string 40 <Default /> 42 <Default> 43 value=ffffff 44 </Default> 41 45 </LiteralData> 42 46 [size] … … 47 51 <LiteralData> 48 52 dataType = integer 49 <Default /> 53 <Default> 54 value=3 55 </Default> 50 56 </LiteralData> 51 57 </DataInputs> -
trunk/zoo-project/zoo-services/utils/status/service.c
r467 r471 104 104 */ 105 105 char *tmpStr=getStatus(atoi(tmpMap->value)); 106 fprintf(stderr,"DEBUG: %s \n",tmpStr); 106 107 if(tmpStr!=NULL && strncmp(tmpStr,"-1",2)!=0){ 107 108 char *tmpStr1=strdup(tmpStr); … … 121 122 setMapInMaps(outputs,"Result","value",(char*)xmlbuff); 122 123 xmlFree(xmlbuff); 123 free(tmpStr);124 124 free(tmpStr1); 125 125 free(tmpStr0); … … 154 154 int i=0; 155 155 while(i<100){ 156 char tmp[4];157 156 char message[10]; 158 sprintf(tmp,"%i",i);159 map* tmpMap=NULL;160 tmpMap=getMapFromMaps(conf,"lenv","sid");161 if(tmpMap!=NULL)162 fprintf(stderr,"Status %s %s\n",tmpMap->value,tmp);163 157 sprintf(message,"Step %d",i); 164 setMapInMaps(conf,"lenv","status",tmp); 165 setMapInMaps(conf,"lenv","message",message); 166 updateStatus(conf); 158 updateStatus(conf,i,message); 167 159 #ifndef WIN32 168 160 sleep(1); … … 172 164 i+=5; 173 165 } 174 set MapInMaps(outputs,"Result","value","\"Running long process successfully\"");166 setOutputValue(outputs,"Result","\"Long process run successfully\"",-1); 175 167 return SERVICE_SUCCEEDED; 176 168 }
Note: See TracChangeset
for help on using the changeset viewer.