Ignore:
Timestamp:
May 29, 2015, 1:31:23 PM (9 years ago)
Author:
djay
Message:

Migrate readVSIFile from server_internal to zoo_service shared library.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/service_internal.c

    r640 r649  
    2525#include "fcgi_stdio.h"
    2626#include "service_internal.h"
     27#ifdef USE_MS
     28#include "service_internal_ms.h"
     29#else
     30#include "cpl_vsi.h"
     31#endif
    2732
    2833#ifndef TRUE
     
    606611
    607612/**
     613 * Read a file using the GDAL VSI API
     614 *
     615 * @param conf the maps containing the settings of the main.cfg file
     616 * @param dataSource the datasource name to read
     617 * @warning make sure to free ressources returned by this function
     618 */
     619char *readVSIFile(maps* conf,const char* dataSource){
     620    VSILFILE * fichier=VSIFOpenL(dataSource,"rb");
     621    VSIStatBufL file_status;
     622    VSIStatL(dataSource, &file_status);
     623    if(fichier==NULL){
     624      char tmp[1024];
     625      sprintf(tmp,"Failed to open file %s for reading purpose. File seems empty %lld.",
     626              dataSource,file_status.st_size);
     627      setMapInMaps(conf,"lenv","message",tmp);
     628      return NULL;
     629    }
     630    char *res1=(char *)malloc(file_status.st_size*sizeof(char));
     631    VSIFReadL(res1,1,file_status.st_size*sizeof(char),fichier);
     632    res1[file_status.st_size-1]=0;
     633    VSIFCloseL(fichier);
     634    VSIUnlink(dataSource);
     635    return res1;
     636}
     637
     638/**
    608639 * Set an output value
    609640 *
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