Ignore:
Timestamp:
Feb 12, 2014, 3:25:15 PM (8 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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));
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