Changeset 453 for trunk/zoo-project
- Timestamp:
- Feb 12, 2014, 3:25:15 PM (11 years ago)
- Location:
- trunk/zoo-project/zoo-kernel
- Files:
-
- 2 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-kernel/main_conf_read.y
r446 r453 249 249 //====================================================== 250 250 251 pair: PAIR {curr_key= strdup($1);/*printf("START 0 PAIR FOUND !! \n [%s]\n",$1);*/}251 pair: PAIR {curr_key=zStrdup($1);/*printf("START 0 PAIR FOUND !! \n [%s]\n",$1);*/} 252 252 | EPAIR { 253 253 if(current_content==NULL) … … 262 262 free(curr_key); 263 263 } 264 | SPAIR {curr_key= strdup($1);if(debug) printf("SPAIR FOUND !!\n"); }264 | SPAIR {curr_key=zStrdup($1);if(debug) printf("SPAIR FOUND !!\n"); } 265 265 ; 266 266 … … 274 274 current_maps->next=NULL; 275 275 current_maps->next=(maps*)malloc(MAPS_SIZE); 276 current_maps->next->name= strdup($1);276 current_maps->next->name=zStrdup($1); 277 277 current_maps->next->content=NULL; 278 278 current_maps->next->next=NULL; -
trunk/zoo-project/zoo-kernel/makefile.vc
r451 r453 43 43 $(CPP) /c $(CFLAGS) service_internal_java.c 44 44 45 service_internal_ruby.obj: service_internal_ruby.c service_internal_ruby.h service.h 46 $(CPP) /c $(CFLAGS) service_internal_ruby.c 47 45 48 service_internal_python.obj: service_internal_python.c service.h 46 49 $(CPP) /c $(CFLAGS) service_internal_python.c … … 61 64 $(CPP) /EHsc /c $(CFLAGS) ..\..\thirds\dirent-win32\dirent.c 62 65 63 zoo_loader.cgi: zoo_loader.obj zoo_service_loader.obj service_internal.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) ulinet.obj lex.cr.obj lex.sr.obj service_conf.tab.obj main_conf_read.tab.obj dirent.obj64 link zoo_loader.obj dirent.obj service_internal.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) ulinet.obj main_conf_read.tab.obj lex.cr.obj service_conf.tab.obj lex.sr.obj zoo_service_loader.obj /out:zoo_loader.cgi $(LDFLAGS) $(LDFLAGSCGI)66 zoo_loader.cgi: zoo_loader.obj zoo_service_loader.obj service_internal.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) $(RUBY_FILE) ulinet.obj lex.cr.obj lex.sr.obj service_conf.tab.obj main_conf_read.tab.obj dirent.obj 67 link zoo_loader.obj dirent.obj service_internal.obj $(PY_FILE) $(JAVA_FILE) $(MS_FILE) $(JS_FILE) $(RUBY_FILE) ulinet.obj main_conf_read.tab.obj lex.cr.obj service_conf.tab.obj lex.sr.obj zoo_service_loader.obj /out:zoo_loader.cgi $(LDFLAGS) $(LDFLAGSCGI) 65 68 66 69 clean: -
trunk/zoo-project/zoo-kernel/nmake.opt
r451 r453 32 32 !ENDIF 33 33 34 !IFDEF RUBY_DIR 35 ################################################################# 36 #RUBY 1.8.7 37 ZRUBY_VERSION=1 38 RUBY_CFLAGS=-DZRUBY_VERSION=1 -DUSE_RUBY -I$(RUBY_DIR) 39 RUBY_LDFLAGS="$(RUBY_DIR)/msvcr100-ruby18.lib" 40 ################################################################# 41 #RUBY 1.9.3 42 #ZRUBY_VERSION=2 43 #RUBY_CFLAGS=-DZRUBY_VERSION=2 -DUSE_RUBY -I$(RUBY_DIR)/include/ruby-1.9.1/ -I$(RUBY_DIR)/include/ruby-1.9.1/i386-mswin32_100 44 #RUBY_LDFLAGS="$(RUBY_DIR)/lib/msvcr100-ruby191.lib" 45 #RUBY 2.1.0 46 #ZRUBY_VERSION=2 47 #RUBY_CFLAGS=-DZRUBY_VERSION=2 -DUSE_RUBY -I$(RUBY_DIR)/include/ruby-2.1.0/ -I$(RUBY_DIR)/include/ruby-2.1.0/i386-mswin32_100 48 #RUBY_LDFLAGS="$(RUBY_DIR)/lib/msvcr100-ruby210.lib" 49 ################################################################# 50 RUBY_FILE=service_internal_ruby.obj 51 !IFDEF MS_DIR 52 RUBY_CFLAGS=$(RUBY_CFLAGS) -DHAVE_ROUND 53 !ENDIF 54 !ENDIF 55 34 56 !IFNDEF ZOOK_DIR 35 57 ZOOK_DIR=. … … 41 63 PYTHON_CPATH=$(PY_DIR) 42 64 43 CFLAGS= /traceback $(MS_DEFS) $(INCLUDES) $(CFLAGS1) /nologo /MD /W3 /EHsc /Ox /D_CRT_SECURE_NO_WARNINGS /DWIN32 $(CJFLAGS) -I$(ZOOK_DIR) -I./ $(JAVA_CFLAGS) $(MS_CFLAGS) -I$(TROOT)\..\..\thirds\dirent-win32 -I$(INTL_DIR) -I$(CURL_DIR)\include -I$(XML2_DIR)\include -I$(GDAL_DIR)\port $(JS_CFLAGS) -I$(GDAL_DIR)\ogr -I$(GDAL_DIR)\gcore -I$(GD_DIR) -I$(ICONV_DIR) -I$(TROOT)\..\..\thirds\include -I$(TROOT)\..\..\thirds\cgic206 -I$(PYTHON_CPATH)\include -I$(SSL_DIR)/inc32 -I$(FCGI_DIR)\include $(PY_CFLAGS) -DLINUX_FREE_ISSUE #-DDEBUG #-DDEBUG_SERVICE_CONF65 CFLAGS= $(MS_DEFS) $(INCLUDES) $(CFLAGS1) /nologo /MD /W3 /EHsc /Ox /D_CRT_SECURE_NO_WARNINGS /DWIN32 $(CJFLAGS) -I$(ZOOK_DIR) $(RUBY_CFLAGS) -I./ $(JAVA_CFLAGS) $(MS_CFLAGS) -I$(TROOT)\..\..\thirds\dirent-win32 -I$(INTL_DIR) -I$(CURL_DIR)\include -I$(XML2_DIR)\include -I$(GDAL_DIR)\port $(JS_CFLAGS) -I$(GDAL_DIR)\ogr -I$(GDAL_DIR)\gcore -I$(GD_DIR) -I$(ICONV_DIR) -I$(TROOT)\..\..\thirds\include -I$(TROOT)\..\..\thirds\cgic206 -I$(PYTHON_CPATH)\include -I$(SSL_DIR)/inc32 -I$(FCGI_DIR)\include $(PY_CFLAGS) -DLINUX_FREE_ISSUE #-DDEBUG #-DDEBUG_SERVICE_CONF 44 66 45 67 LDFLAGSCGI=$(TROOT)/../../thirds/cgic206/libcgic.lib 46 LDFLAGS=$(FCGI_DIR)/libfcgi/Release/libfcgi.lib $(CURL_LIBRARY) $(PY_LDFLAGS) $(XML2_LIBRARY) $(SSL_DIR)/out32dll/libeay32.lib $(JAVA_LDFLAGS) $(SSL_DIR)/out32dll/ssleay32.lib $(MS_LDFLAGS) $(INTL_DIR)/intl.lib $(XML2_DIR)/win32/bin.msvc/libxml2.lib $(GDAL_DIR)/gdal_i.lib $(CURL_DIR)/lib/libcurl.lib $(JS_LDFLAGS) /machine:i38668 LDFLAGS=$(FCGI_DIR)/libfcgi/Release/libfcgi.lib $(CURL_LIBRARY) $(PY_LDFLAGS) $(XML2_LIBRARY) $(SSL_DIR)/out32dll/libeay32.lib $(JAVA_LDFLAGS) $(SSL_DIR)/out32dll/ssleay32.lib $(MS_LDFLAGS) $(INTL_DIR)/intl.lib $(XML2_DIR)/win32/bin.msvc/libxml2.lib $(GDAL_DIR)/gdal_i.lib $(CURL_DIR)/lib/libcurl.lib $(JS_LDFLAGS) $(RUBY_LDFLAGS) /machine:i386 -
trunk/zoo-project/zoo-kernel/service.h
r446 r453 35 35 #ifndef snprintf 36 36 #define snprintf sprintf_s 37 #endif 38 #define zStrdup _strdup 39 #define zMkdir _mkdir 40 #define zOpen _open 41 #define zWrite _write 37 42 #else 38 39 # endif43 #define zStrdup strdup 44 #define zMkdir mkdir 40 45 #endif 41 46 … … 53 58 #include <stdio.h> 54 59 #include <string.h> 55 56 60 #ifndef WIN32 57 61 #define bool int … … 176 180 static map* createMap(const char* name,const char* value){ 177 181 map* tmp=(map *)malloc(MAP_SIZE); 178 tmp->name= strdup(name);179 tmp->value= strdup(value);182 tmp->name=zStrdup(name); 183 tmp->value=zStrdup(value); 180 184 tmp->next=NULL; 181 185 return tmp; … … 253 257 int i=0; 254 258 while(curs!=NULL){ 255 if(i==0) 256 if(type==0) 257 sprintf(dataInputsKVP,"%s=",curs->name); 258 else 259 sprintf(dataInputsKVP,"%s",curs->name); 260 else{ 261 char *temp=strdup(dataInputsKVP); 262 if(type==0) 263 sprintf(dataInputsKVP,"%s;%s=",temp,curs->name); 264 else 265 sprintf(dataInputsKVP,"%s;%s",temp,curs->name); 266 free(temp); 267 } 268 map* icurs=curs->content; 269 if(type==0){ 270 char *temp=strdup(dataInputsKVP); 271 if(getMap(m->content,"xlink:href")!=NULL) 272 sprintf(dataInputsKVP,"%sReference",temp); 273 else 274 sprintf(dataInputsKVP,"%s%s",temp,icurs->value); 275 free(temp); 276 } 277 while(icurs!=NULL){ 278 if(strcasecmp(icurs->name,"value")!=0 && 279 strcasecmp(icurs->name,"Reference")!=0 && 280 strcasecmp(icurs->name,"minOccurs")!=0 && 281 strcasecmp(icurs->name,"maxOccurs")!=0 && 282 strcasecmp(icurs->name,"inRequest")!=0){ 283 char *itemp=strdup(dataInputsKVP); 284 sprintf(dataInputsKVP,"%s@%s=%s",itemp,icurs->name,icurs->value); 285 free(itemp); 259 map *inRequest=getMap(curs->content,"inRequest"); 260 if(strncasecmp(inRequest->value,"true",4)==0){ 261 if(i==0) 262 if(type==0) 263 sprintf(dataInputsKVP,"%s=",curs->name); 264 else 265 sprintf(dataInputsKVP,"%s",curs->name); 266 else{ 267 char *temp=zStrdup(dataInputsKVP); 268 if(type==0) 269 sprintf(dataInputsKVP,"%s;%s=",temp,curs->name); 270 else 271 sprintf(dataInputsKVP,"%s;%s",temp,curs->name); 272 free(temp); 286 273 } 287 icurs=icurs->next; 274 map* icurs=curs->content; 275 if(type==0){ 276 char *temp=zStrdup(dataInputsKVP); 277 if(getMap(m->content,"xlink:href")!=NULL) 278 sprintf(dataInputsKVP,"%sReference",temp); 279 else 280 sprintf(dataInputsKVP,"%s%s",temp,icurs->value); 281 free(temp); 282 } 283 while(icurs!=NULL){ 284 if(strcasecmp(icurs->name,"value")!=0 && 285 strcasecmp(icurs->name,"Reference")!=0 && 286 strcasecmp(icurs->name,"minOccurs")!=0 && 287 strcasecmp(icurs->name,"maxOccurs")!=0 && 288 strcasecmp(icurs->name,"inRequest")!=0){ 289 char *itemp=zStrdup(dataInputsKVP); 290 sprintf(dataInputsKVP,"%s@%s=%s",itemp,icurs->name,icurs->value); 291 free(itemp); 292 } 293 icurs=icurs->next; 294 } 288 295 } 289 296 curs=curs->next; … … 469 476 if(tmp->value!=NULL) 470 477 free(tmp->value); 471 tmp->value= strdup(v);478 tmp->value=zStrdup(v); 472 479 } 473 480 } … … 574 581 if(_cursor!=NULL){ 575 582 res=(maps*)malloc(MAPS_SIZE); 576 res->name= strdup(_cursor->name);583 res->name=zStrdup(_cursor->name); 577 584 res->content=NULL; 578 585 res->next=NULL; … … 723 730 if(_ztmpm->value!=NULL) 724 731 free(_ztmpm->value); 725 _ztmpm->value= strdup(value);732 _ztmpm->value=zStrdup(value); 726 733 }else{ 727 734 addToMap(_tmpm->content,subkey,value); … … 729 736 }else{ 730 737 maps *tmp=(maps*)malloc(MAPS_SIZE); 731 tmp->name= strdup(key);738 tmp->name=zStrdup(key); 732 739 tmp->content=createMap(subkey,value); 733 740 tmp->next=NULL; … … 779 786 #endif 780 787 tmp=(elements*)malloc(ELEMENTS_SIZE); 781 tmp->name= strdup(e->name);788 tmp->name=zStrdup(e->name); 782 789 tmp->content=NULL; 783 790 addMapToMap(&tmp->content,e->content); 784 791 tmp->metadata=NULL; 785 792 addMapToMap(&tmp->metadata,e->metadata); 786 tmp->format= strdup(e->format);793 tmp->format=zStrdup(e->format); 787 794 if(e->defaults!=NULL){ 788 795 tmp->defaults=(iotype*)malloc(IOTYPE_SIZE); -
trunk/zoo-project/zoo-kernel/service_conf.y
r393 r453 283 283 current_element->next=NULL; 284 284 if($2!=NULL) 285 current_element->format= strdup($2);285 current_element->format=zStrdup($2); 286 286 287 287 current_element->defaults=NULL; … … 298 298 current_element->next=NULL; 299 299 if($2!=NULL) 300 current_element->format= strdup($2);300 current_element->format=zStrdup($2); 301 301 current_element->defaults=NULL; 302 302 current_element->supported=NULL; … … 549 549 } 550 550 } 551 | SPAIR { if(curr_key!=NULL) {free(curr_key);curr_key=NULL;} if($1!=NULL) curr_key= strdup($1);if(debug) fprintf(stderr,"SPAIR FOUND !!\n"); }551 | SPAIR { if(curr_key!=NULL) {free(curr_key);curr_key=NULL;} if($1!=NULL) curr_key=zStrdup($1);if(debug) fprintf(stderr,"SPAIR FOUND !!\n"); } 552 552 ; 553 553 … … 561 561 data=1; 562 562 if($1!=NULL){ 563 char *cen= strdup($1);563 char *cen=zStrdup($1); 564 564 my_service->name=(char*)malloc((strlen(cen)-1)*sizeof(char*)); 565 565 cen[strlen(cen)-1]=0; … … 615 615 #endif 616 616 if($1!=NULL){ 617 char *cen= strdup($1);617 char *cen=zStrdup($1); 618 618 current_element->name=(char*)malloc((strlen(cen)-1)*sizeof(char*)); 619 619 cen[strlen(cen)-1]=0; … … 677 677 #endif 678 678 if($1!=NULL){ 679 char *cen= strdup($1);679 char *cen=zStrdup($1); 680 680 current_element->name=(char*)malloc((strlen(cen)-1)*sizeof(char)); 681 681 cen[strlen(cen)-1]=0; … … 709 709 current_element=NULL; 710 710 current_element=(elements*)malloc(ELEMENTS_SIZE); 711 char *cen= strdup($1);711 char *cen=zStrdup($1); 712 712 current_element->name=(char*)malloc((strlen(cen)-1)*sizeof(char)); 713 713 cen[strlen(cen)-1]=0; … … 729 729 #endif 730 730 if($1!=NULL){ 731 char *cen= strdup($1);731 char *cen=zStrdup($1); 732 732 current_element->name=(char*)malloc((strlen(cen))*sizeof(char*)); 733 733 cen[strlen(cen)-1]=0; -
trunk/zoo-project/zoo-kernel/service_internal.c
r452 r453 1212 1212 map* tmpm2=getMap(tmp_maps->content,"tmpUrl"); 1213 1213 if(tmpm1!=NULL && tmpm2!=NULL){ 1214 if(strncasecmp(tmpm2->value,"http://",7)==0){ 1214 if( strncasecmp( tmpm2->value, "http://", 7) == 0 || 1215 strncasecmp( tmpm2->value, "https://", 8 ) == 0 ){ 1215 1216 sprintf(url,"%s/%s_%i.xml",tmpm2->value,service,pid); 1216 1217 }else … … 1892 1893 map * errormap = createMap("text",tmpMsg); 1893 1894 addToMap(errormap,"code", "InternalError"); 1895 1894 1896 printExceptionReportResponse(m,errormap); 1895 1897 freeMap(&errormap); … … 1903 1905 } 1904 1906 1907 if(res==SERVICE_FAILED){ 1908 map * errormap; 1909 map *lenv; 1910 lenv=getMapFromMaps(m,"lenv","message"); 1911 char *tmp0; 1912 if(lenv!=NULL){ 1913 tmp0=(char*)malloc((strlen(lenv->value)+strlen(_("Unable to run the Service. The message returned back by the Service was the following: "+1)))*sizeof(char)); 1914 sprintf(tmp0,_("Unable to run the Service. The message returned back by the Service was the following: %s"),lenv->value); 1915 } 1916 else{ 1917 tmp0=(char*)malloc((strlen(_("Unable to run the Service. No more information was returned back by the Service."))+1)*sizeof(char)); 1918 sprintf(tmp0,_("Unable to run the Service. No more information was returned back by the Service.")); 1919 } 1920 errormap = createMap("text",tmp0); 1921 free(tmp0); 1922 addToMap(errormap,"code", "InternalError"); 1923 printExceptionReportResponse(m,errormap); 1924 freeMap(&errormap); 1925 free(errormap); 1926 return; 1927 } 1928 1905 1929 if(asRaw==0){ 1906 1930 #ifdef DEBUG … … 1915 1939 toto=getMap(tmpI->content,"asReference"); 1916 1940 #ifdef USE_MS 1917 if(toto!=NULL && strcasecmp(toto->value,"true")==0 && testMap==NULL) {1941 if(toto!=NULL && strcasecmp(toto->value,"true")==0 && testMap==NULL) 1918 1942 #else 1919 if(toto!=NULL && strcasecmp(toto->value,"true")==0){ 1920 #endif 1943 if(toto!=NULL && strcasecmp(toto->value,"true")==0) 1944 #endif 1945 { 1921 1946 elements* in=getElements(s->outputs,tmpI->name); 1922 1947 char *format=NULL; … … 1933 1958 map *ext=getMap(tmpI->content,"extension"); 1934 1959 map *tmp1=getMapFromMaps(m,"main","tmpPath"); 1935 char *file_name ;1960 char *file_name,*file_path; 1936 1961 bool hasExt=true; 1937 1962 if(ext==NULL){ … … 1957 1982 hasExt=false; 1958 1983 } 1959 file_name=(char*)malloc((strlen(tmp1->value)+strlen(s->name)+strlen(ext->value)+strlen(tmpI->name)+13)*sizeof(char)); 1960 sprintf(file_name,"%s/%s_%s_%i.%s",tmp1->value,s->name,tmpI->name,cpid+100000,ext->value); 1961 FILE *ofile=fopen(file_name,"wb"); 1984 file_name=(char*)malloc((strlen(s->name)+strlen(ext->value)+strlen(tmpI->name)+1024)*sizeof(char)); 1985 int cpid0=cpid+time(NULL); 1986 sprintf(file_name,"%s_%s_%i.%s",s->name,tmpI->name,cpid0,ext->value); 1987 file_path=(char*)malloc((strlen(tmp1->value)+strlen(file_name)+2)*sizeof(char)); 1988 sprintf(file_path,"%s/%s",tmp1->value,file_name); 1989 FILE *ofile=fopen(file_path,"wb"); 1962 1990 if(ofile==NULL){ 1963 1991 char tmpMsg[1024]; … … 1968 1996 freeMap(&errormap); 1969 1997 free(errormap); 1998 free(file_name); 1999 free(file_path); 1970 2000 return; 1971 2001 } 2002 free(file_path); 1972 2003 map *tmp2=getMapFromMaps(m,"main","tmpUrl"); 1973 2004 map *tmp3=getMapFromMaps(m,"main","serverAddress"); 1974 2005 char *file_url; 1975 2006 if(strncasecmp(tmp2->value,"http://",7)==0){ 1976 file_url=(char*)malloc((strlen(tmp2->value)+strlen( s->name)+strlen(ext->value)+strlen(tmpI->name)+13)*sizeof(char));1977 sprintf(file_url,"%s/%s _%s_%i.%s",tmp2->value,s->name,tmpI->name,cpid+100000,ext->value);2007 file_url=(char*)malloc((strlen(tmp2->value)+strlen(file_name))*sizeof(char)); 2008 sprintf(file_url,"%s/%s",tmp2->value,file_name); 1978 2009 }else{ 1979 file_url=(char*)malloc((strlen(tmp3->value)+strlen(tmp2->value)+strlen( s->name)+strlen(ext->value)+strlen(tmpI->name)+13)*sizeof(char));1980 sprintf(file_url,"%s/%s/%s _%s_%i.%s",tmp3->value,tmp2->value,s->name,tmpI->name,cpid+100000,ext->value);2010 file_url=(char*)malloc((strlen(tmp3->value)+strlen(tmp2->value)+strlen(file_name))*sizeof(char)); 2011 sprintf(file_url,"%s/%s/%s",tmp3->value,tmp2->value,file_name); 1981 2012 } 1982 2013 addToMap(tmpI->content,"Reference",file_url); … … 2019 2050 request_inputs, 2020 2051 request_outputs); 2021 } 2022 else 2023 if(res!=SERVICE_FAILED){ 2052 } 2053 else{ 2024 2054 /** 2025 2055 * We get the requested output or fallback to the first one if the … … 2083 2113 #endif 2084 2114 } 2085 }else{2086 char tmp[1024];2087 map * errormap;2088 map *lenv;2089 lenv=getMapFromMaps(m,"lenv","message");2090 if(lenv!=NULL)2091 sprintf(tmp,_("Unable to run the Service. The message returned back by the Service was the following : %s"),lenv->value);2092 else2093 sprintf(tmp,_("Unable to run the Service. No more information was returned back by the Service."));2094 errormap = createMap("text",tmp);2095 addToMap(errormap,"code", "InternalError");2096 printExceptionReportResponse(m,errormap);2097 freeMap(&errormap);2098 free(errormap);2099 2115 } 2100 2116 } -
trunk/zoo-project/zoo-kernel/service_internal.h
r446 r453 45 45 #endif 46 46 #include <stdio.h> 47 #include <unistd.h>48 47 #include <time.h> 49 48 #include <ctype.h> 49 #ifdef WIN32 50 #ifndef USE_RUBY 51 #include <unistd.h> 52 #endif 53 #endif 50 54 #ifndef WIN32 51 55 #include <xlocale.h> … … 72 76 #include "service_internal_js.h" 73 77 #endif 78 74 79 75 80 #ifdef __cplusplus -
trunk/zoo-project/zoo-kernel/service_internal_js.c
r410 r453 483 483 484 484 tres=(maps*)malloc(MAPS_SIZE); 485 tres->name= strdup(JS_EncodeString(cx,jsmsg));485 tres->name=zStrdup(JS_EncodeString(cx,jsmsg)); 486 486 tres->content=NULL; 487 487 tres->next=NULL; … … 578 578 #endif 579 579 if(strcasecmp(JS_EncodeString(cx,jsmsg1),"[object Object]")==0){ 580 tres->name= strdup(JS_EncodeString(cx,jsmsg));580 tres->name=zStrdup(JS_EncodeString(cx,jsmsg)); 581 581 tres->content=mapFromJSObject(cx,nvp1j); 582 582 } 583 583 else 584 584 if(strcasecmp(JS_EncodeString(cx,jsmsg),"name")==0){ 585 tres->name= strdup(JS_EncodeString(cx,jsmsg1));585 tres->name=zStrdup(JS_EncodeString(cx,jsmsg1)); 586 586 } 587 587 else{ … … 775 775 } 776 776 else{ 777 method= strdup("GET");777 method=zStrdup("GET"); 778 778 url=JSValToChar(cx,argv); 779 779 } -
trunk/zoo-project/zoo-kernel/service_internal_ms.c
r451 r453 109 109 map *msOgcVersion=getMapFromMaps(m,"main","msOgcVersion"); 110 110 map *dataPath=getMapFromMaps(m,"main","dataPath"); 111 map *sid=getMapFromMaps(m,"lenv"," sid");111 map *sid=getMapFromMaps(m,"lenv","usid"); 112 112 map* format=getMap(tmpI->content,"mimeType"); 113 113 map* rformat=getMap(tmpI->content,"requestedMimeType"); … … 371 371 OGRSFDriverH *poDriver1 = NULL; 372 372 char *dsName=(char*)malloc((8+strlen(pszDataSource)+1)*sizeof(char)); 373 char *odsName= strdup(pszDataSource);374 char *sdsName= strdup(pszDataSource);373 char *odsName=zStrdup(pszDataSource); 374 char *sdsName=zStrdup(pszDataSource); 375 375 char *demo=strstr(odsName,"."); 376 376 sdsName[strlen(sdsName)-(strlen(demo)-1)]='d'; … … 414 414 char** demo=VSIReadDir(dsName); 415 415 int i=0; 416 mkdir(sdsName416 zMkdir(sdsName 417 417 #ifndef WIN32 418 418 ,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH … … 432 432 #endif 433 433 VSIFSeekL(vsif,0,SEEK_END); 434 int size=VSIFTellL(vsif);434 vsi_l_offset size=VSIFTellL(vsif); 435 435 #ifdef DEBUGMS 436 436 fprintf(stderr,"size : %d\n",size); 437 437 #endif 438 438 VSIFSeekL(vsif,0,SEEK_SET); 439 char *vsifcontent=(char*) malloc(( size+1)*sizeof(char));440 VSIFReadL(vsifcontent,1, size,vsif);439 char *vsifcontent=(char*) malloc(((int)size+1)*sizeof(char)); 440 VSIFReadL(vsifcontent,1,(size_t)size,vsif); 441 441 char *fpath=(char*) malloc((strlen(sdsName)+strlen(demo[1])+2)*sizeof(char)); 442 442 sprintf(fpath,"%s/%s",sdsName,demo[i]); 443 int f= open(fpath,O_WRONLY|O_CREAT,S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);444 write(f,vsifcontent,size);443 int f=zOpen(fpath,O_WRONLY|O_CREAT,S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH); 444 zWrite(f,vsifcontent,(int)size); 445 445 close(f); 446 446 chmod(fpath,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH); … … 511 511 dumpMaps(output); 512 512 #endif 513 myLayer->name = strdup(output->name);513 myLayer->name = zStrdup(output->name); 514 514 myLayer->tileitem=NULL; 515 myLayer->data = strdup(OGR_L_GetName(poLayer));516 myLayer->connection = strdup(pszDataSource);515 myLayer->data = zStrdup(OGR_L_GetName(poLayer)); 516 myLayer->connection = zStrdup(pszDataSource); 517 517 myLayer->index = m->numlayers; 518 518 myLayer->dump = MS_TRUE; … … 699 699 700 700 layerObj* myLayer=m->layers[m->numlayers]; 701 myLayer->name = strdup(output->name);701 myLayer->name = zStrdup(output->name); 702 702 myLayer->tileitem=NULL; 703 myLayer->data = strdup(pszFilename);703 myLayer->data = zStrdup(pszFilename); 704 704 myLayer->index = m->numlayers; 705 705 myLayer->dump = MS_TRUE; … … 734 734 const char *tRef=GDALGetProjectionRef( hDataset ); 735 735 if( tRef != NULL && strlen(tRef)>0 ){ 736 OGRSpatialReferenceH hSRS;737 736 char *pszProjection; 738 737 pszProjection = (char *) GDALGetProjectionRef( hDataset ); 739 #ifdef DEBUGMS738 //#ifdef DEBUGMS 740 739 fprintf(stderr,"Accessing the DataSource %s\n",GDALGetProjectionRef( hDataset )); 741 #endif740 //#endif 742 741 setSrsInformations(output,m,myLayer,pszProjection); 743 } 742 }else{ 743 fprintf(stderr,"NO SRS FOUND ! %s\n",GDALGetProjectionRef( hDataset )); 744 } 744 745 745 746 … … 792 793 }else{ 793 794 if(iBand<4){ 794 char *tmpS= strdup(nameBands);795 char *tmpS=zStrdup(nameBands); 795 796 nameBands=(char*)realloc(nameBands,(strlen(nameBands)+strlen(lBands)+1)*sizeof(char)); 796 797 sprintf(nameBands,"%s %s",tmpS,lBands); … … 805 806 */ 806 807 for( iBand = 0; iBand < nBandsI; iBand++ ){ 807 int bGotNodata, bSuccess;808 double adfCMinMax[2] , dfNoData;809 int nBlockXSize, nBlockYSize, nMaskFlags;810 double dfMean, dfStdDev;808 //int bGotNodata;//, bSuccess; 809 double adfCMinMax[2]/*, dfNoData*/; 810 //int nBlockXSize, nBlockYSize, nMaskFlags; 811 //double /*dfMean, dfStdDev*/; 811 812 hBand = GDALGetRasterBand( hDataset, iBand+1 ); 812 813 … … 863 864 char className[7]; 864 865 sprintf(className,"class%d",i); 865 myLayer->CLASS[myLayer->numclasses]->name= strdup(className);866 myLayer->CLASS[myLayer->numclasses]->name=zStrdup(className); 866 867 867 868 /** … … 924 925 925 926 map* tmpMap=getMapFromMaps(conf,"main","dataPath"); 926 map* sidMap=getMapFromMaps(conf,"lenv"," sid");927 map* sidMap=getMapFromMaps(conf,"lenv","usid"); 927 928 char *pszDataSource=(char*)malloc((strlen(tmpMap->value)+strlen(sidMap->value)+strlen(outputs->name)+17)*sizeof(char)); 928 929 sprintf(pszDataSource,"%s/ZOO_DATA_%s_%s.%s",tmpMap->value,outputs->name,sidMap->value,ext); … … 945 946 mapObj *myMap=msNewMapObj(); 946 947 free(myMap->name); 947 myMap->name= strdup("ZOO-Project_WXS_Server");948 myMap->name=zStrdup("ZOO-Project_WXS_Server"); 948 949 msMapSetSize(myMap,2048,2048); 949 950 msMapSetExtent(myMap,-1,-1,1,1); … … 953 954 */ 954 955 map *tmp1=getMapFromMaps(conf,"main","tmpPath"); 955 myMap->web.imagepath= strdup(tmp1->value);956 myMap->web.imagepath=zStrdup(tmp1->value); 956 957 tmp1=getMapFromMaps(conf,"main","tmpUrl"); 957 myMap->web.imageurl= strdup(tmp1->value);958 myMap->web.imageurl=zStrdup(tmp1->value); 958 959 959 960 /* … … 1084 1085 sprintf(tmpPath,"%s/symbols.sym",tmp1->value); 1085 1086 msInitSymbolSet(&myMap->symbolset); 1086 myMap->symbolset.filename= strdup(tmpPath);1087 myMap->symbolset.filename=zStrdup(tmpPath); 1087 1088 free(tmpPath); 1088 1089 1089 map* sid=getMapFromMaps(conf,"lenv"," sid");1090 map* sid=getMapFromMaps(conf,"lenv","usid"); 1090 1091 char *mapPath= 1091 1092 (char*)malloc((16+strlen(outputs->name)+strlen(tmp1->value))*sizeof(char)); -
trunk/zoo-project/zoo-kernel/service_internal_python.c
r451 r453 2 2 * Author : Gérald FENOY 3 3 * 4 * Copyright (c) 2009-201 3GeoLabs SARL4 * Copyright (c) 2009-2014 GeoLabs SARL 5 5 * 6 6 * Permission is hereby granted, free of charge, to any person obtaining a copy … … 31 31 #if PY_MAJOR_VERSION >= 3 32 32 #define GETSTATE(m) ((struct module_state*)PyModule_GetState(m)) 33 #define PyInt_FromLong PyLong_FromLong 34 #define PyInt_AsLong PyLong_AsLong 35 #define PyString_FromString PyUnicode_FromString 36 #define PyString_FromStringAndSize PyUnicode_FromStringAndSize 37 #define PyString_Check PyUnicode_Check 38 #define PyString_AsString _PyUnicode_AsString 39 #define PyString_Size PyUnicode_GetSize 33 40 #else 34 41 #define GETSTATE(m) (&_state) … … 88 95 89 96 d = PyModule_GetDict(module); 90 #if PY_MAJOR_VERSION >= 391 tmp = PyLong_FromLong(3);92 #else93 97 tmp = PyInt_FromLong(3); 94 #endif95 98 PyDict_SetItemString(d, "SERVICE_SUCCEEDED", tmp); 96 99 Py_DECREF(tmp); 97 100 98 #if PY_MAJOR_VERSION >= 399 tmp = PyLong_FromLong(4);100 #else101 101 tmp = PyInt_FromLong(4); 102 #endif103 102 PyDict_SetItemString(d, "SERVICE_FAILED", tmp); 104 103 Py_DECREF(tmp); … … 191 190 tmp=getMap(s->content,"serviceProvider"); 192 191 if(tmp!=NULL) 193 pName = 194 #if PY_MAJOR_VERSION >= 3 195 PyUnicode_FromString(tmp->value); 196 #else 197 PyString_FromString(tmp->value); 198 #endif 192 pName = PyString_FromString(tmp->value); 199 193 else{ 200 194 map* err=createMap("text","Unable to parse serviceProvider please check your zcfg file."); … … 218 212 PyTuple_SetItem(pArgs, 1, (PyObject *)arg2); 219 213 PyTuple_SetItem(pArgs, 2, (PyObject *)arg3); 220 tmp=getMap(request,"storeExecuteResponse");221 #ifdef DEBUG222 fprintf(stderr,"RUN IN NORMAL MODE \n");223 fflush(stderr);224 #endif225 214 pValue = PyObject_CallObject(pFunc, pArgs); 226 215 if (pValue != NULL) { 227 #if PY_MAJOR_VERSION >= 3228 res=PyLong_AsLong(pValue);229 #else230 216 res=PyInt_AsLong(pValue); 231 #endif232 217 freeMaps(real_outputs); 233 218 free(*real_outputs); … … 237 222 *real_outputs=mapsFromPyDict(arg3); 238 223 #ifdef DEBUG 239 #if PY_MAJOR_VERSION >= 3240 fprintf(stderr,"Result of call: %i\n", PyLong_AsLong(pValue));241 #else242 224 fprintf(stderr,"Result of call: %i\n", PyInt_AsLong(pValue)); 243 #endif244 225 dumpMaps(inputs); 245 226 dumpMaps(*real_outputs); … … 250 231 PyObject *trace=PyObject_Str(pvalue); 251 232 char pbt[10240]; 252 #if PY_MAJOR_VERSION >= 3253 if(PyUnicode_Check(trace))254 sprintf(pbt,"TRACE : %s",_PyUnicode_AsString(trace));255 #else256 233 if(PyString_Check(trace)) 257 234 sprintf(pbt,"TRACE : %s",PyString_AsString(trace)); 258 #endif259 235 else 260 236 fprintf(stderr,"EMPTY TRACE ?"); 261 237 trace=NULL; 262 238 trace=PyObject_Str(ptype); 263 #if PY_MAJOR_VERSION >= 3264 if(PyUnicode_Check(trace)){265 #else266 239 if(PyString_Check(trace)){ 267 #endif 268 char *tpbt=strdup(pbt); 269 #if PY_MAJOR_VERSION >= 3 270 sprintf(pbt,"%s\n%s\0",tpbt,_PyUnicode_AsString(trace)); 271 #else 240 char *tpbt=zStrdup(pbt); 272 241 sprintf(pbt,"%s\n%s\0",tpbt,PyString_AsString(trace)); 273 #endif274 242 free(tpbt); 275 243 } … … 277 245 fprintf(stderr,"EMPTY TRACE ?"); 278 246 279 char *tpbt=strdup(pbt); 280 #if PY_MAJOR_VERSION >= 3 281 pName = PyUnicode_FromString("traceback"); 282 #else 247 char *tpbt=zStrdup(pbt); 283 248 pName = PyString_FromString("traceback"); 284 #endif285 249 pModule = PyImport_Import(pName); 286 250 pArgs = PyTuple_New(1); … … 290 254 trace=NULL; 291 255 trace=PyObject_Str(pValue); 292 #if PY_MAJOR_VERSION >= 3293 if(PyUnicode_Check(trace))294 sprintf(pbt,"%s\nUnable to run your python process properly. Please check the following messages : %s",tpbt,_PyUnicode_AsString(trace));295 #else296 256 if(PyString_Check(trace)) 297 257 sprintf(pbt,"%s\nUnable to run your python process properly. Please check the following messages : %s",tpbt,PyString_AsString(trace)); 298 #endif299 258 else 300 259 sprintf(pbt,"%s \n Unable to run your python process properly. Unable to provide any futher informations. %s",tpbt); … … 338 297 while(tmp!=NULL){ 339 298 PyObject* value=(PyObject*)PyDict_FromMap(tmp->content); 340 PyObject* name= 341 #if PY_MAJOR_VERSION >= 3 342 PyUnicode_FromString(tmp->name); 343 #else 344 PyString_FromString(tmp->name); 345 #endif 299 PyObject* name=PyString_FromString(tmp->name); 346 300 if(PyDict_SetItem(res,name,value)<0){ 347 301 fprintf(stderr,"Unable to set map value ..."); … … 362 316 map* tmap=getMapType(tmp); 363 317 while(tmp!=NULL){ 364 PyObject* name= 365 #if PY_MAJOR_VERSION >= 3 366 PyUnicode_FromString(tmp->name); 367 #else 368 PyString_FromString(tmp->name); 369 #endif 318 PyObject* name=PyString_FromString(tmp->name); 370 319 if(strcasecmp(tmp->name,"value")==0) { 371 320 if(isArray!=NULL){ … … 386 335 PyObject* lsvalue; 387 336 if(sMap==NULL){ 388 #if PY_MAJOR_VERSION >= 3389 lvalue=PyUnicode_FromString(vMap->value);390 #else391 337 lvalue=PyString_FromString(vMap->value); 392 #endif393 338 lsvalue=Py_None; 394 339 } 395 else{ 396 #if PY_MAJOR_VERSION >= 3 397 lvalue=PyUnicode_FromStringAndSize(vMap->value,atoi(sMap->value)); 398 lsvalue=PyUnicode_FromString(sMap->value); 399 #else 340 else{ 400 341 lvalue=PyString_FromStringAndSize(vMap->value,atoi(sMap->value)); 401 342 lsvalue=PyString_FromString(sMap->value); 402 #endif403 343 hasSize=1; 404 344 } … … 417 357 PyObject* lmvalue; 418 358 if(mMap!=NULL){ 419 #if PY_MAJOR_VERSION >= 3420 lmvalue=PyUnicode_FromString(mMap->value);421 #else422 359 lmvalue=PyString_FromString(mMap->value); 423 #endif424 360 }else 425 361 lmvalue=Py_None; … … 436 372 return NULL; 437 373 } 438 #if PY_MAJOR_VERSION >= 3439 if(PyDict_SetItem(res,PyUnicode_FromString(tmap->name),mvalue)<0){440 #else441 374 if(PyDict_SetItem(res,PyString_FromString(tmap->name),mvalue)<0){ 442 #endif443 375 fprintf(stderr,"Unable to set key value pair..."); 444 376 return NULL; 445 377 } 446 378 if(hasSize>0) 447 #if PY_MAJOR_VERSION >= 3448 if(PyDict_SetItem(res,PyUnicode_FromString("size"),svalue)<0){449 #else450 379 if(PyDict_SetItem(res,PyString_FromString("size"),svalue)<0){ 451 #endif452 380 fprintf(stderr,"Unable to set key value pair..."); 453 381 return NULL; … … 455 383 } 456 384 else if(size!=NULL){ 457 PyObject* value= 458 #if PY_MAJOR_VERSION >= 3 459 PyUnicode_FromStringAndSize(tmp->value,atoi(size->value)); 460 #else 461 PyString_FromStringAndSize(tmp->value,atoi(size->value)); 462 #endif 385 PyObject* value=PyString_FromStringAndSize(tmp->value,atoi(size->value)); 463 386 if(PyDict_SetItem(res,name,value)<0){ 464 387 fprintf(stderr,"Unable to set key value pair..."); … … 467 390 } 468 391 else{ 469 PyObject* value= 470 #if PY_MAJOR_VERSION >= 3 471 PyUnicode_FromString(tmp->value); 472 #else 473 PyString_FromString(tmp->value); 474 #endif 392 PyObject* value=PyString_FromString(tmp->value); 475 393 if(PyDict_SetItem(res,name,value)<0){ 476 394 fprintf(stderr,"Unable to set key value pair..."); … … 481 399 else{ 482 400 if(PyDict_GetItem(res,name)==NULL){ 483 PyObject* value= 484 #if PY_MAJOR_VERSION >= 3 485 PyUnicode_FromString(tmp->value); 486 #else 487 PyString_FromString(tmp->value); 488 #endif 401 PyObject* value=PyString_FromString(tmp->value); 489 402 if(PyDict_SetItem(res,name,value)<0){ 490 403 fprintf(stderr,"Unable to set key value pair..."); … … 516 429 #endif 517 430 cursor=(maps*)malloc(MAPS_SIZE); 518 #if PY_MAJOR_VERSION >= 3519 cursor->name=_PyUnicode_AsString(key);520 #else521 431 cursor->name=PyString_AsString(key); 522 #endif523 432 cursor->content=mapFromPyDict((PyDictObject*)value); 524 433 #ifdef DEBUG … … 553 462 PyString_AsString(key),PyString_AsString(value)); 554 463 #endif 555 #if PY_MAJOR_VERSION >= 3 556 if(strcmp(_PyUnicode_AsString(key),"value")==0){ 557 #else 464 558 465 if(strcmp(PyString_AsString(key),"value")==0){ 559 #endif560 466 char *buffer=NULL; 561 467 Py_ssize_t size; … … 566 472 #endif 567 473 if(res!=NULL){ 568 #if PY_MAJOR_VERSION >= 3569 addToMap(res,_PyUnicode_AsString(key),"");570 #else571 474 addToMap(res,PyString_AsString(key),""); 572 #endif573 475 }else{ 574 #if PY_MAJOR_VERSION >= 3575 res=createMap(_PyUnicode_AsString(key),"");576 #else577 476 res=createMap(PyString_AsString(key),""); 578 #endif579 477 } 580 478 map* tmpR=getMap(res,"value"); … … 589 487 if(res!=NULL){ 590 488 if(PyString_Size(value)>0) 591 #if PY_MAJOR_VERSION >= 3592 addToMap(res,_PyUnicode_AsString(key),_PyUnicode_AsString(value));593 #else594 489 addToMap(res,PyString_AsString(key),PyString_AsString(value)); 595 #endif596 490 } 597 491 else{ 598 492 if(PyString_Size(value)>0) 599 res= 600 #if PY_MAJOR_VERSION >= 3 601 createMap(_PyUnicode_AsString(key),_PyUnicode_AsString(value)); 602 #else 603 createMap(PyString_AsString(key),PyString_AsString(value)); 604 #endif 493 res=createMap(PyString_AsString(key),PyString_AsString(value)); 605 494 } 606 495 } … … 619 508 return NULL; 620 509 } 621 #if PY_MAJOR_VERSION >= 3622 return PyUnicode_FromString(_ss(str));623 #else624 510 return PyString_FromString(_ss(str)); 625 #endif626 511 } 627 512 … … 645 530 char tmpStatus[4]; 646 531 snprintf(tmpStatus, 4, "%i", istatus); 647 status = strdup(tmpStatus);532 status = zStrdup(tmpStatus); 648 533 } 649 534 /* now update the map */ … … 651 536 PyObject* lenv = PyMapping_GetItemString(confdict, "lenv"); 652 537 if (lenv && PyMapping_Check(lenv)){ 653 PyObject* valobj = 654 #if PY_MAJOR_VERSION >= 3 655 PyUnicode_FromString(status); 656 #else 657 PyString_FromString(status); 658 #endif 538 PyObject* valobj = PyString_FromString(status); 659 539 PyMapping_SetItemString(lenv, "status", valobj); 660 540 Py_DECREF(valobj); -
trunk/zoo-project/zoo-kernel/ulinet.h
r446 r453 26 26 #define _ULINET_H 27 27 28 #include " fcgi_stdio.h"28 #include "stdio.h" 29 29 #include <stdlib.h> 30 30 #include <fcntl.h> … … 37 37 #ifdef USE_JS 38 38 #ifdef WIN32 39 # define XP_WIN39 #define XP_WIN 1 40 40 #else 41 41 #define XP_UNIX 0 -
trunk/zoo-project/zoo-kernel/zoo_loader.c
r403 r453 86 86 char *strQuery=NULL; 87 87 if(cgiQueryString!=NULL) 88 strQuery= strdup(cgiQueryString);88 strQuery=zStrdup(cgiQueryString); 89 89 map* tmpMap=NULL; 90 90 … … 104 104 else{ 105 105 res=(char*)realloc(res,(cgiContentLength+1)*sizeof(char)); 106 char *tmp= strdup(res);106 char *tmp=zStrdup(res); 107 107 sprintf(res,"%s%s",tmp,buffer); 108 108 free(tmp); … … 136 136 sprintf(buffer,"%s",tmpValueFinal); 137 137 }else{ 138 char *tmp= strdup(buffer);138 char *tmp=zStrdup(buffer); 139 139 sprintf(buffer,"%s&%s",tmp,tmpValueFinal); 140 140 free(tmp); … … 240 240 #endif 241 241 if(req!=NULL && req->nodeNr==1){ 242 t1->value= strdup(requests[j]);242 t1->value=zStrdup(requests[j]); 243 243 j=2; 244 244 } … … 271 271 xmlChar* content=xmlNodeListGetString(doc, id->nodeTab[k]->xmlChildrenNode,1); 272 272 if(strlen(identifiers)>0){ 273 char *tmp= strdup(identifiers);273 char *tmp=zStrdup(identifiers); 274 274 snprintf(identifiers,strlen(tmp)+xmlStrlen(content)+2,"%s,%s",tmp,content); 275 275 free(tmp); … … 303 303 while(token1!=NULL){ 304 304 if(name==NULL) 305 name= strdup(token1);305 name=zStrdup(token1); 306 306 else 307 value= strdup(token1);307 value=zStrdup(token1); 308 308 token1=strtok_r(NULL,"=",&saveptr1); 309 309 } -
trunk/zoo-project/zoo-kernel/zoo_service_loader.c
r452 r453 64 64 #endif 65 65 66 #ifdef USE_RUBY 67 #include "service_internal_ruby.h" 68 #endif 69 66 70 #ifdef USE_PERL 67 71 #include "service_internal_perl.h" … … 91 95 #ifndef USE_MS 92 96 { 93 char *x=_ strdup(a);94 char *y=_ strdup(b);97 char *x=_zStrdup(a); 98 char *y=_zStrdup(b); 95 99 96 100 x=_strlwr(x); … … 250 254 else 251 255 sprintf(tmps1,"%s/",ntmp); 252 char *altPath= strdup(tmps1);256 char *altPath=zStrdup(tmps1); 253 257 r_inputs=getMap(s1->content,"ServiceProvider"); 254 258 sprintf(tmps1,"%s/%s",altPath,r_inputs->value); … … 419 423 else 420 424 #endif 425 426 #ifdef USE_RUBY 427 if(strncasecmp(r_inputs->value,"Ruby",4)==0){ 428 *eres=zoo_ruby_support(&m,request_inputs,s1,&request_input_real_format,&request_output_real_format); 429 } 430 else 431 #endif 432 421 433 { 422 434 char tmpv[1024]; … … 479 491 free(r_inputs1); 480 492 } 481 char *tmp1= strdup(tmp);493 char *tmp1=zStrdup(tmp); 482 494 sprintf(tmp,"zoo_loader.cgi %s \"%s\"",tmp1,sid->value); 483 495 … … 594 606 r_inputs=getMapFromMaps(m,"main","language"); 595 607 if(r_inputs!=NULL){ 596 char *tmp= strdup(r_inputs->value);608 char *tmp=zStrdup(r_inputs->value); 597 609 setMapInMaps(m,"main","language",tmp); 598 610 translateChar(tmp,'-','_'); … … 650 662 } 651 663 else{ 652 REQUEST= strdup(r_inputs->value);664 REQUEST=zStrdup(r_inputs->value); 653 665 if(strncasecmp(r_inputs->value,"GetCapabilities",15)!=0 654 666 && strncasecmp(r_inputs->value,"DescribeProcess",15)!=0 … … 689 701 map* tmpm=getMapFromMaps(m,"main","serverAddress"); 690 702 if(tmpm!=NULL) 691 SERVICE_URL= strdup(tmpm->value);703 SERVICE_URL=zStrdup(tmpm->value); 692 704 else 693 SERVICE_URL= strdup(DEFAULT_SERVICE_URL);705 SERVICE_URL=zStrdup(DEFAULT_SERVICE_URL); 694 706 695 707 service* s1; … … 883 895 snprintf(tmps1,1024,"%s/",ntmp); 884 896 r_inputs=getMap(request_inputs,"Identifier"); 885 char *ttmp= strdup(tmps1);897 char *ttmp=zStrdup(tmps1); 886 898 snprintf(tmps1,1024,"%s/%s.zcfg",ttmp,r_inputs->value); 887 899 free(ttmp); … … 956 968 #endif 957 969 char cursor_output[10240]; 958 char *cotmp= strdup(r_inputs->value);970 char *cotmp=zStrdup(r_inputs->value); 959 971 snprintf(cursor_output,10240,"%s",cotmp); 960 972 free(cotmp); … … 990 1002 } 991 1003 for(j=0;j<i;j++){ 992 char *tmp= strdup(outputs_as_text[j]);1004 char *tmp=zStrdup(outputs_as_text[j]); 993 1005 free(outputs_as_text[j]); 994 1006 char *tmpc; … … 1002 1014 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1003 1015 } 1004 tmp_output->name= strdup(tmpc);1016 tmp_output->name=zStrdup(tmpc); 1005 1017 tmp_output->content=NULL; 1006 1018 tmp_output->next=NULL; … … 1072 1084 * Put each DataInputs into the inputs_as_text array 1073 1085 */ 1074 char *tmp1= strdup(cursor_input);1086 char *tmp1=zStrdup(cursor_input); 1075 1087 char * pToken; 1076 1088 pToken=strtok(cursor_input,";"); … … 1106 1118 1107 1119 for(j=0;j<i;j++){ 1108 char *tmp= strdup(inputs_as_text[j]);1120 char *tmp=zStrdup(inputs_as_text[j]); 1109 1121 free(inputs_as_text[j]); 1110 1122 char *tmpc; … … 1133 1145 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1134 1146 } 1135 tmpmaps->name= strdup(tmpn);1147 tmpmaps->name=zStrdup(tmpn); 1136 1148 if(tmpv!=NULL){ 1137 1149 char *tmpvf=url_decode(tmpv+1); … … 1166 1178 sprintf(tmpValue,"%s@%s",tmpv+1,tmpc); 1167 1179 free(lmap->value); 1168 lmap->value= strdup(tmpValue);1180 lmap->value=zStrdup(tmpValue); 1169 1181 free(tmpValue); 1170 1182 tmpc=strtok(NULL,"@"); … … 1181 1193 char *tmpx2=url_decode(tmpv1+1); 1182 1194 if(strncasecmp(tmpx2,"http://",7)!=0 && 1183 strncasecmp(tmpx2,"ftp://",6)!=0){ 1195 strncasecmp(tmpx2,"ftp://",6)!=0 && 1196 strncasecmp(tmpx2,"https://",8)!=0){ 1184 1197 char emsg[1024]; 1185 1198 sprintf(emsg,_("Unable to find a valid protocol to download the remote file %s"),tmpv1+1); … … 1303 1316 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1304 1317 } 1305 tmpmaps->name= strdup((char*)val);1318 tmpmaps->name=zStrdup((char*)val); 1306 1319 tmpmaps->content=NULL; 1307 1320 tmpmaps->next=NULL; … … 1321 1334 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1322 1335 } 1323 tmpmaps->name= strdup("missingIndetifier");1336 tmpmaps->name=zStrdup("missingIndetifier"); 1324 1337 tmpmaps->content=createMap((char*)cur2->name,(char*)val); 1325 1338 tmpmaps->next=NULL; … … 1563 1576 */ 1564 1577 char *list[2]; 1565 list[0]= strdup("dataType");1566 list[1]= strdup("uom");1578 list[0]=zStrdup("dataType"); 1579 list[1]=zStrdup("uom"); 1567 1580 for(int l=0;l<2;l++){ 1568 1581 #ifdef DEBUG … … 1656 1669 } 1657 1670 free(tmpv->value); 1658 tmpv->value= strdup(res);1671 tmpv->value=zStrdup(res); 1659 1672 free(res); 1660 1673 xmlFree(tmp); … … 1741 1754 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1742 1755 } 1743 tmpmaps->name= strdup("unknownIdentifier");1756 tmpmaps->name=zStrdup("unknownIdentifier"); 1744 1757 tmpmaps->content=NULL; 1745 1758 tmpmaps->next=NULL; … … 1783 1796 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1784 1797 } 1785 tmpmaps->name= strdup((char*)val);1798 tmpmaps->name=zStrdup((char*)val); 1786 1799 tmpmaps->content=NULL; 1787 1800 tmpmaps->next=NULL; … … 1789 1802 else{ 1790 1803 //free(tmpmaps->name); 1791 tmpmaps->name= strdup((char*)val);1804 tmpmaps->name=zStrdup((char*)val); 1792 1805 } 1793 1806 if(asRaw==true) … … 1798 1811 else{ 1799 1812 map* tt=getMap(request_inputs,"ResponseDocument"); 1800 char* tmp= strdup(tt->value);1813 char* tmp=zStrdup(tt->value); 1801 1814 free(tt->value); 1802 1815 tt->value=(char*)malloc((strlen(tmp)+strlen((char*)val)+1)*sizeof(char)); … … 1820 1833 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1821 1834 } 1822 tmpmaps->name= strdup("missingIndetifier");1835 tmpmaps->name=zStrdup("missingIndetifier"); 1823 1836 tmpmaps->content=createMap((char*)cur1->name,(char*)val); 1824 1837 tmpmaps->next=NULL; … … 1869 1882 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1870 1883 } 1871 tmpmaps->name= strdup((char*)val);1884 tmpmaps->name=zStrdup((char*)val); 1872 1885 tmpmaps->content=NULL; 1873 1886 tmpmaps->next=NULL; … … 1876 1889 if(tmpmaps->name!=NULL) 1877 1890 free(tmpmaps->name); 1878 tmpmaps->name= strdup((char*)val);;1891 tmpmaps->name=zStrdup((char*)val);; 1879 1892 } 1880 1893 xmlFree(val); … … 1892 1905 return errorException(m, _("Unable to allocate memory."), "InternalError"); 1893 1906 } 1894 tmpmaps->name= strdup("missingIndetifier");1907 tmpmaps->name=zStrdup("missingIndetifier"); 1895 1908 tmpmaps->content=createMap((char*)cur2->name,(char*)val); 1896 1909 tmpmaps->next=NULL; … … 2125 2138 int cpid=getpid(); 2126 2139 2140 /** 2141 * Initialize the specific [lenv] section which contains runtime variables: 2142 * 2143 * - usid : it is an unique identification number 2144 * - sid : it is the process idenfitication number (OS) 2145 * - status : value between 0 and 100 to express the completude of 2146 * the operations of the running service 2147 * - message : is a string where you can store error messages, in case 2148 * service is failing, or o provide details on the ongoing operation. 2149 * - cwd : is the current working directory 2150 * - soap : is a boolean value, true if the request was contained in a SOAP 2151 * Envelop 2152 * - sessid : string storing the session identifier (only when cookie is 2153 * used) 2154 * - cgiSid : only defined on Window platforms (for being able to identify 2155 * the created process) 2156 * 2157 */ 2127 2158 maps *_tmpMaps=(maps*)malloc(MAPS_SIZE); 2128 _tmpMaps->name= strdup("lenv");2159 _tmpMaps->name=zStrdup("lenv"); 2129 2160 char tmpBuff[100]; 2161 sprintf(tmpBuff,"%i",(cpid+(int)time(NULL))); 2162 _tmpMaps->content=createMap("usid",tmpBuff); 2163 _tmpMaps->next=NULL; 2130 2164 sprintf(tmpBuff,"%i",cpid); 2131 _tmpMaps->content=createMap("sid",tmpBuff); 2132 _tmpMaps->next=NULL; 2165 addToMap(_tmpMaps->content,"sid",tmpBuff); 2133 2166 addToMap(_tmpMaps->content,"status","0"); 2167 addToMap(_tmpMaps->content,"message",_("No message provided")); 2134 2168 addToMap(_tmpMaps->content,"cwd",ntmp); 2135 2169 map* ltmp=getMap(request_inputs,"soap"); … … 2140 2174 if(cgiCookie!=NULL && strlen(cgiCookie)>0){ 2141 2175 int hasValidCookie=-1; 2142 char *tcook= strdup(cgiCookie);2176 char *tcook=zStrdup(cgiCookie); 2143 2177 char *tmp=NULL; 2144 2178 int hasVal=-1; 2145 2179 map* testing=getMapFromMaps(m,"main","cookiePrefix"); 2146 2180 if(testing==NULL){ 2147 tmp= strdup("ID=");2181 tmp=zStrdup("ID="); 2148 2182 }else{ 2149 2183 tmp=(char*)malloc((strlen(testing->value)+2)*sizeof(char)); … … 2158 2192 if(tcook!=NULL) 2159 2193 free(tcook); 2160 tcook= strdup(token);2194 tcook=zStrdup(token); 2161 2195 hasValidCookie=1; 2162 2196 } … … 2165 2199 }else{ 2166 2200 if(strstr(cgiCookie,"=")!=NULL && strcasestr(cgiCookie,tmp)!=NULL){ 2167 tcook= strdup(cgiCookie);2201 tcook=zStrdup(cgiCookie); 2168 2202 hasValidCookie=1; 2169 2203 }
Note: See TracChangeset
for help on using the changeset viewer.