Changeset 453


Ignore:
Timestamp:
Feb 12, 2014, 3:25:15 PM (10 years ago)
Author:
djay
Message:

Add the optional Ruby Language Support to the ZOO-Kernel with an API similar to the Python ZOO-API. Small rewrite of Python support. Fix issue #86 and #87. Add usid in [lenv] section, this value is used to generate an unique identifier based on time and the process identifier. This usid is now used to name the stored result or the mapfile generated. Remove *some* warning messages displayed at compilation time.

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  
    249249//======================================================
    250250
    251 pair: PAIR {curr_key=strdup($1);/*printf("START 0 PAIR FOUND !! \n [%s]\n",$1);*/}
     251pair: PAIR {curr_key=zStrdup($1);/*printf("START 0 PAIR FOUND !! \n [%s]\n",$1);*/}
    252252| EPAIR {
    253253  if(current_content==NULL)
     
    262262  free(curr_key);
    263263  }
    264 | SPAIR  {curr_key=strdup($1);if(debug) printf("SPAIR FOUND !!\n"); }
     264| SPAIR  {curr_key=zStrdup($1);if(debug) printf("SPAIR FOUND !!\n"); }
    265265 ;
    266266
     
    274274     current_maps->next=NULL;
    275275     current_maps->next=(maps*)malloc(MAPS_SIZE);
    276      current_maps->next->name=strdup($1);
     276     current_maps->next->name=zStrdup($1);
    277277     current_maps->next->content=NULL;
    278278     current_maps->next->next=NULL;
  • trunk/zoo-project/zoo-kernel/makefile.vc

    r451 r453  
    4343        $(CPP) /c $(CFLAGS) service_internal_java.c
    4444
     45service_internal_ruby.obj: service_internal_ruby.c service_internal_ruby.h service.h
     46        $(CPP) /c $(CFLAGS) service_internal_ruby.c
     47
    4548service_internal_python.obj: service_internal_python.c service.h
    4649        $(CPP) /c $(CFLAGS) service_internal_python.c
     
    6164        $(CPP) /EHsc /c $(CFLAGS) ..\..\thirds\dirent-win32\dirent.c
    6265
    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.obj
    64         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)
     66zoo_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)
    6568
    6669clean:
  • trunk/zoo-project/zoo-kernel/nmake.opt

    r451 r453  
    3232!ENDIF
    3333
     34!IFDEF RUBY_DIR
     35#################################################################
     36#RUBY 1.8.7
     37ZRUBY_VERSION=1
     38RUBY_CFLAGS=-DZRUBY_VERSION=1 -DUSE_RUBY -I$(RUBY_DIR)
     39RUBY_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#################################################################
     50RUBY_FILE=service_internal_ruby.obj
     51!IFDEF MS_DIR
     52RUBY_CFLAGS=$(RUBY_CFLAGS) -DHAVE_ROUND
     53!ENDIF
     54!ENDIF
     55
    3456!IFNDEF ZOOK_DIR
    3557ZOOK_DIR=.
     
    4163PYTHON_CPATH=$(PY_DIR)
    4264
    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_CONF
     65CFLAGS= $(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
    4466
    4567LDFLAGSCGI=$(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:i386
     68LDFLAGS=$(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  
    3535#ifndef snprintf
    3636#define snprintf sprintf_s
     37#endif
     38#define zStrdup _strdup
     39#define zMkdir _mkdir
     40#define zOpen _open
     41#define zWrite _write
    3742#else
    38 
    39 #endif
     43#define zStrdup strdup
     44#define zMkdir mkdir
    4045#endif
    4146
     
    5358#include <stdio.h>
    5459#include <string.h>
    55 
    5660#ifndef WIN32
    5761#define bool int
     
    176180  static map* createMap(const char* name,const char* value){
    177181    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);
    180184    tmp->next=NULL;
    181185    return tmp;
     
    253257    int i=0;
    254258    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);
    286273        }
    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        }
    288295      }
    289296      curs=curs->next;
     
    469476      if(tmp->value!=NULL)
    470477        free(tmp->value);
    471       tmp->value=strdup(v);
     478      tmp->value=zStrdup(v);
    472479    }
    473480  }
     
    574581    if(_cursor!=NULL){
    575582      res=(maps*)malloc(MAPS_SIZE);
    576       res->name=strdup(_cursor->name);
     583      res->name=zStrdup(_cursor->name);
    577584      res->content=NULL;
    578585      res->next=NULL;
     
    723730        if(_ztmpm->value!=NULL)
    724731          free(_ztmpm->value);
    725         _ztmpm->value=strdup(value);
     732        _ztmpm->value=zStrdup(value);
    726733      }else{
    727734        addToMap(_tmpm->content,subkey,value);
     
    729736    }else{
    730737      maps *tmp=(maps*)malloc(MAPS_SIZE);
    731       tmp->name=strdup(key);
     738      tmp->name=zStrdup(key);
    732739      tmp->content=createMap(subkey,value);
    733740      tmp->next=NULL;
     
    779786#endif
    780787      tmp=(elements*)malloc(ELEMENTS_SIZE);
    781       tmp->name=strdup(e->name);
     788      tmp->name=zStrdup(e->name);
    782789      tmp->content=NULL;
    783790      addMapToMap(&tmp->content,e->content);
    784791      tmp->metadata=NULL;
    785792      addMapToMap(&tmp->metadata,e->metadata);
    786       tmp->format=strdup(e->format);
     793      tmp->format=zStrdup(e->format);
    787794      if(e->defaults!=NULL){
    788795        tmp->defaults=(iotype*)malloc(IOTYPE_SIZE);
  • trunk/zoo-project/zoo-kernel/service_conf.y

    r393 r453  
    283283              current_element->next=NULL;
    284284              if($2!=NULL)
    285                 current_element->format=strdup($2);
     285                current_element->format=zStrdup($2);
    286286             
    287287              current_element->defaults=NULL;
     
    298298            current_element->next=NULL;
    299299            if($2!=NULL)
    300               current_element->format=strdup($2);
     300              current_element->format=zStrdup($2);
    301301            current_element->defaults=NULL;
    302302            current_element->supported=NULL;
     
    549549  }
    550550  }
    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"); }
    552552 ;
    553553
     
    561561    data=1;
    562562    if($1!=NULL){
    563       char *cen=strdup($1);
     563      char *cen=zStrdup($1);
    564564      my_service->name=(char*)malloc((strlen(cen)-1)*sizeof(char*));
    565565      cen[strlen(cen)-1]=0;
     
    615615#endif
    616616        if($1!=NULL){
    617           char *cen=strdup($1);
     617          char *cen=zStrdup($1);
    618618          current_element->name=(char*)malloc((strlen(cen)-1)*sizeof(char*));
    619619          cen[strlen(cen)-1]=0;
     
    677677#endif
    678678            if($1!=NULL){
    679               char *cen=strdup($1);
     679              char *cen=zStrdup($1);
    680680              current_element->name=(char*)malloc((strlen(cen)-1)*sizeof(char));
    681681              cen[strlen(cen)-1]=0;
     
    709709            current_element=NULL;
    710710            current_element=(elements*)malloc(ELEMENTS_SIZE);
    711             char *cen=strdup($1);
     711            char *cen=zStrdup($1);
    712712            current_element->name=(char*)malloc((strlen(cen)-1)*sizeof(char));
    713713            cen[strlen(cen)-1]=0;
     
    729729#endif
    730730            if($1!=NULL){
    731               char *cen=strdup($1);
     731              char *cen=zStrdup($1);
    732732              current_element->name=(char*)malloc((strlen(cen))*sizeof(char*));
    733733              cen[strlen(cen)-1]=0;
  • trunk/zoo-project/zoo-kernel/service_internal.c

    r452 r453  
    12121212      map* tmpm2=getMap(tmp_maps->content,"tmpUrl");
    12131213      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 ){
    12151216          sprintf(url,"%s/%s_%i.xml",tmpm2->value,service,pid);
    12161217        }else
     
    18921893      map * errormap = createMap("text",tmpMsg);
    18931894      addToMap(errormap,"code", "InternalError");
     1895     
    18941896      printExceptionReportResponse(m,errormap);
    18951897      freeMap(&errormap);
     
    19031905  }
    19041906 
     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
    19051929  if(asRaw==0){
    19061930#ifdef DEBUG
     
    19151939      toto=getMap(tmpI->content,"asReference");
    19161940#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)
    19181942#else
    1919       if(toto!=NULL && strcasecmp(toto->value,"true")==0){
    1920 #endif
     1943      if(toto!=NULL && strcasecmp(toto->value,"true")==0)
     1944#endif
     1945        {
    19211946        elements* in=getElements(s->outputs,tmpI->name);
    19221947        char *format=NULL;
     
    19331958        map *ext=getMap(tmpI->content,"extension");
    19341959        map *tmp1=getMapFromMaps(m,"main","tmpPath");
    1935         char *file_name;
     1960        char *file_name,*file_path;
    19361961        bool hasExt=true;
    19371962        if(ext==NULL){
     
    19571982          hasExt=false;
    19581983        }
    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");
    19621990        if(ofile==NULL){
    19631991          char tmpMsg[1024];
     
    19681996          freeMap(&errormap);
    19691997          free(errormap);
     1998          free(file_name);
     1999          free(file_path);
    19702000          return;
    19712001        }
     2002        free(file_path);
    19722003        map *tmp2=getMapFromMaps(m,"main","tmpUrl");
    19732004        map *tmp3=getMapFromMaps(m,"main","serverAddress");
    19742005        char *file_url;
    19752006        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);
    19782009        }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);
    19812012        }
    19822013        addToMap(tmpI->content,"Reference",file_url);
     
    20192050                         request_inputs,
    20202051                         request_outputs);
    2021   }
    2022   else
    2023     if(res!=SERVICE_FAILED){
     2052    }
     2053    else{
    20242054      /**
    20252055       * We get the requested output or fallback to the first one if the
     
    20832113#endif
    20842114      }
    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       else
    2093         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);
    20992115    }
    21002116}
  • trunk/zoo-project/zoo-kernel/service_internal.h

    r446 r453  
    4545#endif
    4646#include <stdio.h>
    47 #include <unistd.h>
    4847#include <time.h>
    4948#include <ctype.h>
     49#ifdef WIN32
     50#ifndef USE_RUBY
     51#include <unistd.h>
     52#endif
     53#endif
    5054#ifndef WIN32
    5155#include <xlocale.h>
     
    7276#include "service_internal_js.h"
    7377#endif
     78
    7479
    7580#ifdef __cplusplus
  • trunk/zoo-project/zoo-kernel/service_internal_js.c

    r410 r453  
    483483
    484484        tres=(maps*)malloc(MAPS_SIZE);
    485         tres->name=strdup(JS_EncodeString(cx,jsmsg));
     485        tres->name=zStrdup(JS_EncodeString(cx,jsmsg));
    486486        tres->content=NULL;
    487487        tres->next=NULL;
     
    578578#endif
    579579          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));
    581581            tres->content=mapFromJSObject(cx,nvp1j);
    582582          }
    583583          else
    584584            if(strcasecmp(JS_EncodeString(cx,jsmsg),"name")==0){
    585               tres->name=strdup(JS_EncodeString(cx,jsmsg1));
     585              tres->name=zStrdup(JS_EncodeString(cx,jsmsg1));
    586586            }
    587587            else{
     
    775775  }
    776776  else{
    777     method=strdup("GET");
     777    method=zStrdup("GET");
    778778    url=JSValToChar(cx,argv);
    779779  }
  • trunk/zoo-project/zoo-kernel/service_internal_ms.c

    r451 r453  
    109109  map *msOgcVersion=getMapFromMaps(m,"main","msOgcVersion");
    110110  map *dataPath=getMapFromMaps(m,"main","dataPath");
    111   map *sid=getMapFromMaps(m,"lenv","sid");
     111  map *sid=getMapFromMaps(m,"lenv","usid");
    112112  map* format=getMap(tmpI->content,"mimeType");
    113113  map* rformat=getMap(tmpI->content,"requestedMimeType");
     
    371371  OGRSFDriverH *poDriver1 = NULL;
    372372  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);
    375375  char *demo=strstr(odsName,".");
    376376  sdsName[strlen(sdsName)-(strlen(demo)-1)]='d';
     
    414414    char** demo=VSIReadDir(dsName);
    415415    int i=0;
    416     mkdir(sdsName
     416    zMkdir(sdsName
    417417#ifndef WIN32
    418418                ,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH
     
    432432#endif
    433433      VSIFSeekL(vsif,0,SEEK_END);
    434       int size=VSIFTellL(vsif);
     434      vsi_l_offset size=VSIFTellL(vsif);
    435435#ifdef DEBUGMS
    436436      fprintf(stderr,"size : %d\n",size);
    437437#endif
    438438      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);
    441441      char *fpath=(char*) malloc((strlen(sdsName)+strlen(demo[1])+2)*sizeof(char));
    442442      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);
    445445      close(f);
    446446      chmod(fpath,S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH);
     
    511511    dumpMaps(output);
    512512#endif
    513     myLayer->name = strdup(output->name);
     513    myLayer->name = zStrdup(output->name);
    514514    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);
    517517    myLayer->index = m->numlayers;
    518518    myLayer->dump = MS_TRUE;
     
    699699
    700700  layerObj* myLayer=m->layers[m->numlayers];
    701   myLayer->name = strdup(output->name);
     701  myLayer->name = zStrdup(output->name);
    702702  myLayer->tileitem=NULL;
    703   myLayer->data = strdup(pszFilename);
     703  myLayer->data = zStrdup(pszFilename);
    704704  myLayer->index = m->numlayers;
    705705  myLayer->dump = MS_TRUE;
     
    734734  const char *tRef=GDALGetProjectionRef( hDataset );
    735735  if( tRef != NULL && strlen(tRef)>0 ){
    736     OGRSpatialReferenceH  hSRS;
    737736    char *pszProjection;
    738737    pszProjection = (char *) GDALGetProjectionRef( hDataset );
    739 #ifdef DEBUGMS
     738    //#ifdef DEBUGMS
    740739    fprintf(stderr,"Accessing the DataSource %s\n",GDALGetProjectionRef( hDataset ));
    741 #endif
     740    //#endif
    742741    setSrsInformations(output,m,myLayer,pszProjection);
    743     }
     742  }else{
     743    fprintf(stderr,"NO SRS FOUND ! %s\n",GDALGetProjectionRef( hDataset ));   
     744  }
    744745
    745746
     
    792793    }else{
    793794      if(iBand<4){
    794         char *tmpS=strdup(nameBands);
     795        char *tmpS=zStrdup(nameBands);
    795796        nameBands=(char*)realloc(nameBands,(strlen(nameBands)+strlen(lBands)+1)*sizeof(char));
    796797        sprintf(nameBands,"%s %s",tmpS,lBands);
     
    805806   */
    806807  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*/;
    811812    hBand = GDALGetRasterBand( hDataset, iBand+1 );
    812813
     
    863864            char className[7];
    864865            sprintf(className,"class%d",i);
    865             myLayer->CLASS[myLayer->numclasses]->name=strdup(className);
     866            myLayer->CLASS[myLayer->numclasses]->name=zStrdup(className);
    866867           
    867868            /**
     
    924925 
    925926  map* tmpMap=getMapFromMaps(conf,"main","dataPath");
    926   map* sidMap=getMapFromMaps(conf,"lenv","sid");
     927  map* sidMap=getMapFromMaps(conf,"lenv","usid");
    927928  char *pszDataSource=(char*)malloc((strlen(tmpMap->value)+strlen(sidMap->value)+strlen(outputs->name)+17)*sizeof(char));
    928929  sprintf(pszDataSource,"%s/ZOO_DATA_%s_%s.%s",tmpMap->value,outputs->name,sidMap->value,ext);
     
    945946  mapObj *myMap=msNewMapObj();
    946947  free(myMap->name);
    947   myMap->name=strdup("ZOO-Project_WXS_Server");
     948  myMap->name=zStrdup("ZOO-Project_WXS_Server");
    948949  msMapSetSize(myMap,2048,2048);
    949950  msMapSetExtent(myMap,-1,-1,1,1);
     
    953954   */
    954955  map *tmp1=getMapFromMaps(conf,"main","tmpPath");
    955   myMap->web.imagepath=strdup(tmp1->value);
     956  myMap->web.imagepath=zStrdup(tmp1->value);
    956957  tmp1=getMapFromMaps(conf,"main","tmpUrl");
    957   myMap->web.imageurl=strdup(tmp1->value);
     958  myMap->web.imageurl=zStrdup(tmp1->value);
    958959 
    959960  /*
     
    10841085  sprintf(tmpPath,"%s/symbols.sym",tmp1->value);
    10851086  msInitSymbolSet(&myMap->symbolset);
    1086   myMap->symbolset.filename=strdup(tmpPath);
     1087  myMap->symbolset.filename=zStrdup(tmpPath);
    10871088  free(tmpPath);
    10881089
    1089   map* sid=getMapFromMaps(conf,"lenv","sid");
     1090  map* sid=getMapFromMaps(conf,"lenv","usid");
    10901091  char *mapPath=
    10911092    (char*)malloc((16+strlen(outputs->name)+strlen(tmp1->value))*sizeof(char));
  • trunk/zoo-project/zoo-kernel/service_internal_python.c

    r451 r453  
    22 * Author : Gérald FENOY
    33 *
    4  * Copyright (c) 2009-2013 GeoLabs SARL
     4 * Copyright (c) 2009-2014 GeoLabs SARL
    55 *
    66 * Permission is hereby granted, free of charge, to any person obtaining a copy
     
    3131#if PY_MAJOR_VERSION >= 3
    3232#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
    3340#else
    3441#define GETSTATE(m) (&_state)
     
    8895
    8996  d = PyModule_GetDict(module);
    90 #if PY_MAJOR_VERSION >= 3
    91   tmp = PyLong_FromLong(3);
    92 #else
    9397  tmp = PyInt_FromLong(3);
    94 #endif
    9598  PyDict_SetItemString(d, "SERVICE_SUCCEEDED", tmp);
    9699  Py_DECREF(tmp);
    97100
    98 #if PY_MAJOR_VERSION >= 3
    99   tmp = PyLong_FromLong(4);
    100 #else
    101101  tmp = PyInt_FromLong(4);
    102 #endif
    103102  PyDict_SetItemString(d, "SERVICE_FAILED", tmp);
    104103  Py_DECREF(tmp);
     
    191190  tmp=getMap(s->content,"serviceProvider");
    192191  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);
    199193  else{
    200194    map* err=createMap("text","Unable to parse serviceProvider please check your zcfg file.");
     
    218212      PyTuple_SetItem(pArgs, 1, (PyObject *)arg2);
    219213      PyTuple_SetItem(pArgs, 2, (PyObject *)arg3);
    220       tmp=getMap(request,"storeExecuteResponse");
    221 #ifdef DEBUG
    222       fprintf(stderr,"RUN IN NORMAL MODE \n");
    223       fflush(stderr);
    224 #endif
    225214      pValue = PyObject_CallObject(pFunc, pArgs);
    226215      if (pValue != NULL) {
    227 #if PY_MAJOR_VERSION >= 3
    228         res=PyLong_AsLong(pValue);
    229 #else
    230216        res=PyInt_AsLong(pValue);
    231 #endif
    232217        freeMaps(real_outputs);
    233218        free(*real_outputs);
     
    237222        *real_outputs=mapsFromPyDict(arg3);
    238223#ifdef DEBUG
    239 #if PY_MAJOR_VERSION >= 3
    240         fprintf(stderr,"Result of call: %i\n", PyLong_AsLong(pValue));
    241 #else
    242224        fprintf(stderr,"Result of call: %i\n", PyInt_AsLong(pValue));
    243 #endif
    244225        dumpMaps(inputs);
    245226        dumpMaps(*real_outputs);
     
    250231        PyObject *trace=PyObject_Str(pvalue);
    251232        char pbt[10240];
    252 #if PY_MAJOR_VERSION >= 3
    253         if(PyUnicode_Check(trace))
    254           sprintf(pbt,"TRACE : %s",_PyUnicode_AsString(trace));
    255 #else
    256233        if(PyString_Check(trace))
    257234          sprintf(pbt,"TRACE : %s",PyString_AsString(trace));
    258 #endif
    259235        else
    260236          fprintf(stderr,"EMPTY TRACE ?");
    261237        trace=NULL;
    262238        trace=PyObject_Str(ptype);
    263 #if PY_MAJOR_VERSION >= 3
    264         if(PyUnicode_Check(trace)){
    265 #else
    266239        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);
    272241          sprintf(pbt,"%s\n%s\0",tpbt,PyString_AsString(trace));
    273 #endif
    274242          free(tpbt);
    275243        }
     
    277245          fprintf(stderr,"EMPTY TRACE ?");
    278246       
    279         char *tpbt=strdup(pbt);
    280 #if PY_MAJOR_VERSION >= 3
    281         pName = PyUnicode_FromString("traceback");
    282 #else
     247        char *tpbt=zStrdup(pbt);
    283248        pName = PyString_FromString("traceback");
    284 #endif
    285249        pModule = PyImport_Import(pName);
    286250        pArgs = PyTuple_New(1);
     
    290254        trace=NULL;
    291255        trace=PyObject_Str(pValue);
    292 #if PY_MAJOR_VERSION >= 3
    293         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 #else
    296256        if(PyString_Check(trace))
    297257          sprintf(pbt,"%s\nUnable to run your python process properly. Please check the following messages : %s",tpbt,PyString_AsString(trace));
    298 #endif
    299258        else
    300259          sprintf(pbt,"%s \n Unable to run your python process properly. Unable to provide any futher informations. %s",tpbt);
     
    338297  while(tmp!=NULL){
    339298    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);
    346300    if(PyDict_SetItem(res,name,value)<0){
    347301      fprintf(stderr,"Unable to set map value ...");
     
    362316  map* tmap=getMapType(tmp);
    363317  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);
    370319    if(strcasecmp(tmp->name,"value")==0) {
    371320      if(isArray!=NULL){
     
    386335            PyObject* lsvalue;
    387336            if(sMap==NULL){
    388 #if PY_MAJOR_VERSION >= 3
    389               lvalue=PyUnicode_FromString(vMap->value);
    390 #else
    391337              lvalue=PyString_FromString(vMap->value);
    392 #endif
    393338              lsvalue=Py_None;
    394339            }
    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{   
    400341              lvalue=PyString_FromStringAndSize(vMap->value,atoi(sMap->value));
    401342              lsvalue=PyString_FromString(sMap->value);
    402 #endif
    403343              hasSize=1;
    404344            }
     
    417357          PyObject* lmvalue;
    418358          if(mMap!=NULL){
    419 #if PY_MAJOR_VERSION >= 3
    420             lmvalue=PyUnicode_FromString(mMap->value);
    421 #else
    422359            lmvalue=PyString_FromString(mMap->value);
    423 #endif
    424360          }else
    425361            lmvalue=Py_None;
     
    436372          return NULL;
    437373        }
    438 #if PY_MAJOR_VERSION >= 3
    439         if(PyDict_SetItem(res,PyUnicode_FromString(tmap->name),mvalue)<0){
    440 #else
    441374        if(PyDict_SetItem(res,PyString_FromString(tmap->name),mvalue)<0){
    442 #endif
    443375          fprintf(stderr,"Unable to set key value pair...");
    444376          return NULL;
    445377        }
    446378        if(hasSize>0)
    447 #if PY_MAJOR_VERSION >= 3
    448           if(PyDict_SetItem(res,PyUnicode_FromString("size"),svalue)<0){
    449 #else
    450379          if(PyDict_SetItem(res,PyString_FromString("size"),svalue)<0){
    451 #endif
    452380            fprintf(stderr,"Unable to set key value pair...");
    453381            return NULL;
     
    455383      }
    456384      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));
    463386        if(PyDict_SetItem(res,name,value)<0){
    464387          fprintf(stderr,"Unable to set key value pair...");
     
    467390      }
    468391      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);
    475393        if(PyDict_SetItem(res,name,value)<0){
    476394          fprintf(stderr,"Unable to set key value pair...");
     
    481399    else{
    482400      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);
    489402        if(PyDict_SetItem(res,name,value)<0){
    490403          fprintf(stderr,"Unable to set key value pair...");
     
    516429#endif
    517430    cursor=(maps*)malloc(MAPS_SIZE);
    518 #if PY_MAJOR_VERSION >= 3
    519     cursor->name=_PyUnicode_AsString(key);
    520 #else
    521431    cursor->name=PyString_AsString(key);
    522 #endif
    523432    cursor->content=mapFromPyDict((PyDictObject*)value);
    524433#ifdef DEBUG
     
    553462            PyString_AsString(key),PyString_AsString(value));
    554463#endif
    555 #if PY_MAJOR_VERSION >= 3
    556     if(strcmp(_PyUnicode_AsString(key),"value")==0){
    557 #else
     464   
    558465    if(strcmp(PyString_AsString(key),"value")==0){
    559 #endif
    560466      char *buffer=NULL;
    561467      Py_ssize_t size;
     
    566472#endif
    567473      if(res!=NULL){
    568 #if PY_MAJOR_VERSION >= 3
    569         addToMap(res,_PyUnicode_AsString(key),"");
    570 #else
    571474        addToMap(res,PyString_AsString(key),"");
    572 #endif
    573475      }else{
    574 #if PY_MAJOR_VERSION >= 3
    575         res=createMap(_PyUnicode_AsString(key),"");
    576 #else
    577476        res=createMap(PyString_AsString(key),"");
    578 #endif
    579477      }
    580478      map* tmpR=getMap(res,"value");
     
    589487      if(res!=NULL){
    590488        if(PyString_Size(value)>0)
    591 #if PY_MAJOR_VERSION >= 3
    592           addToMap(res,_PyUnicode_AsString(key),_PyUnicode_AsString(value));
    593 #else
    594489          addToMap(res,PyString_AsString(key),PyString_AsString(value));
    595 #endif
    596490      }
    597491      else{
    598492        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));
    605494      }
    606495    }
     
    619508    return NULL;
    620509  }
    621 #if PY_MAJOR_VERSION >= 3
    622   return PyUnicode_FromString(_ss(str));
    623 #else
    624510  return PyString_FromString(_ss(str));
    625 #endif
    626511}
    627512
     
    645530     char tmpStatus[4];
    646531     snprintf(tmpStatus, 4, "%i", istatus);
    647      status = strdup(tmpStatus);
     532     status = zStrdup(tmpStatus);
    648533  }
    649534  /* now update the map */
     
    651536    PyObject* lenv = PyMapping_GetItemString(confdict, "lenv");
    652537    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);
    659539      PyMapping_SetItemString(lenv, "status", valobj);
    660540      Py_DECREF(valobj);
  • trunk/zoo-project/zoo-kernel/ulinet.h

    r446 r453  
    2626#define _ULINET_H
    2727
    28 #include "fcgi_stdio.h"
     28#include "stdio.h"
    2929#include <stdlib.h>
    3030#include <fcntl.h>
     
    3737#ifdef USE_JS
    3838#ifdef WIN32
    39 # define XP_WIN
     39#define XP_WIN 1
    4040#else
    4141#define XP_UNIX 0
  • trunk/zoo-project/zoo-kernel/zoo_loader.c

    r403 r453  
    8686  char *strQuery=NULL;
    8787  if(cgiQueryString!=NULL)
    88     strQuery=strdup(cgiQueryString);
     88    strQuery=zStrdup(cgiQueryString);
    8989  map* tmpMap=NULL;
    9090
     
    104104         else{
    105105           res=(char*)realloc(res,(cgiContentLength+1)*sizeof(char));
    106            char *tmp=strdup(res);
     106           char *tmp=zStrdup(res);
    107107           sprintf(res,"%s%s",tmp,buffer);
    108108           free(tmp);
     
    136136            sprintf(buffer,"%s",tmpValueFinal);
    137137          }else{
    138             char *tmp=strdup(buffer);
     138            char *tmp=zStrdup(buffer);
    139139            sprintf(buffer,"%s&%s",tmp,tmpValueFinal);
    140140            free(tmp);
     
    240240#endif
    241241          if(req!=NULL && req->nodeNr==1){
    242             t1->value=strdup(requests[j]);
     242            t1->value=zStrdup(requests[j]);
    243243            j=2;
    244244          }
     
    271271              xmlChar* content=xmlNodeListGetString(doc, id->nodeTab[k]->xmlChildrenNode,1);
    272272              if(strlen(identifiers)>0){
    273                 char *tmp=strdup(identifiers);
     273                char *tmp=zStrdup(identifiers);
    274274                snprintf(identifiers,strlen(tmp)+xmlStrlen(content)+2,"%s,%s",tmp,content);
    275275                free(tmp);
     
    303303      while(token1!=NULL){
    304304        if(name==NULL)
    305           name=strdup(token1);
     305          name=zStrdup(token1);
    306306        else
    307           value=strdup(token1);
     307          value=zStrdup(token1);
    308308        token1=strtok_r(NULL,"=",&saveptr1);
    309309      }
  • trunk/zoo-project/zoo-kernel/zoo_service_loader.c

    r452 r453  
    6464#endif
    6565
     66#ifdef USE_RUBY
     67#include "service_internal_ruby.h"
     68#endif
     69
    6670#ifdef USE_PERL
    6771#include "service_internal_perl.h"
     
    9195#ifndef USE_MS
    9296 {
    93   char *x=_strdup(a);
    94   char *y=_strdup(b);
     97  char *x=_zStrdup(a);
     98  char *y=_zStrdup(b);
    9599 
    96100  x=_strlwr(x);
     
    250254    else
    251255      sprintf(tmps1,"%s/",ntmp);
    252     char *altPath=strdup(tmps1);
     256    char *altPath=zStrdup(tmps1);
    253257    r_inputs=getMap(s1->content,"ServiceProvider");
    254258    sprintf(tmps1,"%s/%s",altPath,r_inputs->value);
     
    419423            else
    420424#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
    421433              {
    422434                char tmpv[1024];
     
    479491    free(r_inputs1);
    480492  }
    481   char *tmp1=strdup(tmp);
     493  char *tmp1=zStrdup(tmp);
    482494  sprintf(tmp,"zoo_loader.cgi %s \"%s\"",tmp1,sid->value);
    483495 
     
    594606    r_inputs=getMapFromMaps(m,"main","language");
    595607  if(r_inputs!=NULL){
    596     char *tmp=strdup(r_inputs->value);
     608    char *tmp=zStrdup(r_inputs->value);
    597609    setMapInMaps(m,"main","language",tmp);
    598610    translateChar(tmp,'-','_');
     
    650662  }
    651663  else{
    652     REQUEST=strdup(r_inputs->value);
     664    REQUEST=zStrdup(r_inputs->value);
    653665    if(strncasecmp(r_inputs->value,"GetCapabilities",15)!=0
    654666       && strncasecmp(r_inputs->value,"DescribeProcess",15)!=0
     
    689701  map* tmpm=getMapFromMaps(m,"main","serverAddress");
    690702  if(tmpm!=NULL)
    691     SERVICE_URL=strdup(tmpm->value);
     703    SERVICE_URL=zStrdup(tmpm->value);
    692704  else
    693     SERVICE_URL=strdup(DEFAULT_SERVICE_URL);
     705    SERVICE_URL=zStrdup(DEFAULT_SERVICE_URL);
    694706
    695707  service* s1;
     
    883895    snprintf(tmps1,1024,"%s/",ntmp);
    884896  r_inputs=getMap(request_inputs,"Identifier");
    885   char *ttmp=strdup(tmps1);
     897  char *ttmp=zStrdup(tmps1);
    886898  snprintf(tmps1,1024,"%s/%s.zcfg",ttmp,r_inputs->value);
    887899  free(ttmp);
     
    956968#endif
    957969      char cursor_output[10240];
    958       char *cotmp=strdup(r_inputs->value);
     970      char *cotmp=zStrdup(r_inputs->value);
    959971      snprintf(cursor_output,10240,"%s",cotmp);
    960972      free(cotmp);
     
    9901002      }
    9911003      for(j=0;j<i;j++){
    992         char *tmp=strdup(outputs_as_text[j]);
     1004        char *tmp=zStrdup(outputs_as_text[j]);
    9931005        free(outputs_as_text[j]);
    9941006        char *tmpc;
     
    10021014                return errorException(m, _("Unable to allocate memory."), "InternalError");
    10031015              }
    1004               tmp_output->name=strdup(tmpc);
     1016              tmp_output->name=zStrdup(tmpc);
    10051017              tmp_output->content=NULL;
    10061018              tmp_output->next=NULL;
     
    10721084     * Put each DataInputs into the inputs_as_text array
    10731085     */
    1074     char *tmp1=strdup(cursor_input);
     1086    char *tmp1=zStrdup(cursor_input);
    10751087    char * pToken;
    10761088    pToken=strtok(cursor_input,";");
     
    11061118
    11071119    for(j=0;j<i;j++){
    1108       char *tmp=strdup(inputs_as_text[j]);
     1120      char *tmp=zStrdup(inputs_as_text[j]);
    11091121      free(inputs_as_text[j]);
    11101122      char *tmpc;
     
    11331145            return errorException(m, _("Unable to allocate memory."), "InternalError");
    11341146          }
    1135           tmpmaps->name=strdup(tmpn);
     1147          tmpmaps->name=zStrdup(tmpn);
    11361148          if(tmpv!=NULL){
    11371149            char *tmpvf=url_decode(tmpv+1);
     
    11661178            sprintf(tmpValue,"%s@%s",tmpv+1,tmpc);
    11671179            free(lmap->value);
    1168             lmap->value=strdup(tmpValue);
     1180            lmap->value=zStrdup(tmpValue);
    11691181            free(tmpValue);
    11701182            tmpc=strtok(NULL,"@");
     
    11811193              char *tmpx2=url_decode(tmpv1+1);
    11821194              if(strncasecmp(tmpx2,"http://",7)!=0 &&
    1183                  strncasecmp(tmpx2,"ftp://",6)!=0){
     1195                 strncasecmp(tmpx2,"ftp://",6)!=0 &&
     1196                 strncasecmp(tmpx2,"https://",8)!=0){
    11841197                char emsg[1024];
    11851198                sprintf(emsg,_("Unable to find a valid protocol to download the remote file %s"),tmpv1+1);
     
    13031316                return errorException(m, _("Unable to allocate memory."), "InternalError");
    13041317              }
    1305               tmpmaps->name=strdup((char*)val);
     1318              tmpmaps->name=zStrdup((char*)val);
    13061319              tmpmaps->content=NULL;
    13071320              tmpmaps->next=NULL;
     
    13211334                return errorException(m, _("Unable to allocate memory."), "InternalError");
    13221335              }
    1323               tmpmaps->name=strdup("missingIndetifier");
     1336              tmpmaps->name=zStrdup("missingIndetifier");
    13241337              tmpmaps->content=createMap((char*)cur2->name,(char*)val);
    13251338              tmpmaps->next=NULL;
     
    15631576                 */
    15641577                char *list[2];
    1565                 list[0]=strdup("dataType");
    1566                 list[1]=strdup("uom");
     1578                list[0]=zStrdup("dataType");
     1579                list[1]=zStrdup("uom");
    15671580                for(int l=0;l<2;l++){
    15681581#ifdef DEBUG
     
    16561669                }
    16571670                free(tmpv->value);
    1658                 tmpv->value=strdup(res);
     1671                tmpv->value=zStrdup(res);
    16591672                free(res);
    16601673                xmlFree(tmp);
     
    17411754            return errorException(m, _("Unable to allocate memory."), "InternalError");
    17421755          }
    1743           tmpmaps->name=strdup("unknownIdentifier");
     1756          tmpmaps->name=zStrdup("unknownIdentifier");
    17441757          tmpmaps->content=NULL;
    17451758          tmpmaps->next=NULL;
     
    17831796                return errorException(m, _("Unable to allocate memory."), "InternalError");
    17841797              }
    1785               tmpmaps->name=strdup((char*)val);
     1798              tmpmaps->name=zStrdup((char*)val);
    17861799              tmpmaps->content=NULL;
    17871800              tmpmaps->next=NULL;
     
    17891802            else{
    17901803              //free(tmpmaps->name);
    1791               tmpmaps->name=strdup((char*)val);
     1804              tmpmaps->name=zStrdup((char*)val);
    17921805            }
    17931806            if(asRaw==true)
     
    17981811              else{
    17991812                map* tt=getMap(request_inputs,"ResponseDocument");
    1800                 char* tmp=strdup(tt->value);
     1813                char* tmp=zStrdup(tt->value);
    18011814                free(tt->value);
    18021815                tt->value=(char*)malloc((strlen(tmp)+strlen((char*)val)+1)*sizeof(char));
     
    18201833                return errorException(m, _("Unable to allocate memory."), "InternalError");
    18211834              }
    1822               tmpmaps->name=strdup("missingIndetifier");
     1835              tmpmaps->name=zStrdup("missingIndetifier");
    18231836              tmpmaps->content=createMap((char*)cur1->name,(char*)val);
    18241837              tmpmaps->next=NULL;
     
    18691882                    return errorException(m, _("Unable to allocate memory."), "InternalError");
    18701883                  }
    1871                   tmpmaps->name=strdup((char*)val);
     1884                  tmpmaps->name=zStrdup((char*)val);
    18721885                  tmpmaps->content=NULL;
    18731886                  tmpmaps->next=NULL;
     
    18761889                  if(tmpmaps->name!=NULL)
    18771890                    free(tmpmaps->name);
    1878                   tmpmaps->name=strdup((char*)val);;
     1891                  tmpmaps->name=zStrdup((char*)val);;
    18791892                }
    18801893                xmlFree(val);
     
    18921905                    return errorException(m, _("Unable to allocate memory."), "InternalError");
    18931906                  }
    1894                   tmpmaps->name=strdup("missingIndetifier");
     1907                  tmpmaps->name=zStrdup("missingIndetifier");
    18951908                  tmpmaps->content=createMap((char*)cur2->name,(char*)val);
    18961909                  tmpmaps->next=NULL;
     
    21252138  int cpid=getpid();
    21262139
     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   */
    21272158  maps *_tmpMaps=(maps*)malloc(MAPS_SIZE);
    2128   _tmpMaps->name=strdup("lenv");
     2159  _tmpMaps->name=zStrdup("lenv");
    21292160  char tmpBuff[100];
     2161  sprintf(tmpBuff,"%i",(cpid+(int)time(NULL)));
     2162  _tmpMaps->content=createMap("usid",tmpBuff);
     2163  _tmpMaps->next=NULL;
    21302164  sprintf(tmpBuff,"%i",cpid);
    2131   _tmpMaps->content=createMap("sid",tmpBuff);
    2132   _tmpMaps->next=NULL;
     2165  addToMap(_tmpMaps->content,"sid",tmpBuff);
    21332166  addToMap(_tmpMaps->content,"status","0");
     2167  addToMap(_tmpMaps->content,"message",_("No message provided"));
    21342168  addToMap(_tmpMaps->content,"cwd",ntmp);
    21352169  map* ltmp=getMap(request_inputs,"soap");
     
    21402174  if(cgiCookie!=NULL && strlen(cgiCookie)>0){
    21412175    int hasValidCookie=-1;
    2142     char *tcook=strdup(cgiCookie);
     2176    char *tcook=zStrdup(cgiCookie);
    21432177    char *tmp=NULL;
    21442178    int hasVal=-1;
    21452179    map* testing=getMapFromMaps(m,"main","cookiePrefix");
    21462180    if(testing==NULL){
    2147       tmp=strdup("ID=");
     2181      tmp=zStrdup("ID=");
    21482182    }else{
    21492183      tmp=(char*)malloc((strlen(testing->value)+2)*sizeof(char));
     
    21582192          if(tcook!=NULL)
    21592193            free(tcook);
    2160           tcook=strdup(token);
     2194          tcook=zStrdup(token);
    21612195          hasValidCookie=1;
    21622196        }
     
    21652199    }else{
    21662200      if(strstr(cgiCookie,"=")!=NULL && strcasestr(cgiCookie,tmp)!=NULL){
    2167         tcook=strdup(cgiCookie);
     2201        tcook=zStrdup(cgiCookie);
    21682202        hasValidCookie=1;
    21692203      }
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png