Ignore:
Timestamp:
Sep 8, 2020, 4:51:09 PM (4 years ago)
Author:
djay
Message:

Make sure not to try accessing mimetype and provenance in case a local file is used. Fix issue with addMapsToMaps. Produce value string only when memory=load for Python support. Make gdal/profile service usable in case memory=protect.

Location:
trunk/zoo-project/zoo-kernel
Files:
5 edited

Legend:

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

    r955 r961  
    403403  if(strncasecmp(request,"file://",7)==0){
    404404    char* tmpStr=zStrdup(request+7);
    405     fprintf(stderr,"**** %s %d %s \n",__FILE__,__LINE__,tmpStr);
     405    setMapInMaps(conf,"lenv",tmpStr,"local");
    406406    return tmpStr;
    407407  }
     
    709709      unlockFile(*m,lck);
    710710    }
    711     cached[strlen(cached)-1]='m';
    712     s=zStat(cached, &f_status);
    713     if(s==0){
    714       zooLock* lck=lockFile(*m,cached,'r');
    715       if(lck==NULL)
    716         return -1;
    717       mimeType=(char*)malloc(sizeof(char)*(f_status.st_size+1));
    718       FILE* f=fopen(cached,"rb");
    719       fread(mimeType,f_status.st_size,1,f);
    720       mimeType[f_status.st_size]=0;
    721       fclose(f);
    722       unlockFile(*m,lck);
    723     }
    724     cached[strlen(cached)-1]='p';
    725     s=zStat(cached, &f_status);
    726     if(s==0){
    727       zooLock* lck=lockFile(*m,cached,'r');
    728       if(lck==NULL)
    729         return -1;
    730       origin=(char*)malloc(sizeof(char)*(f_status.st_size+1));
    731       FILE* f=fopen(cached,"rb");
    732       fread(origin,f_status.st_size,1,f);
    733       mimeType[f_status.st_size]=0;
    734       fclose(f);
    735       unlockFile(*m,lck);
    736     }
     711    map* isLocalFile=getMapFromMaps(*m,"lenv",cached);
     712    if(isLocalFile==NULL){
     713      cached[strlen(cached)-1]='m';
     714      s=zStat(cached, &f_status);
     715      if(s==0){
     716        zooLock* lck=lockFile(*m,cached,'r');
     717        if(lck==NULL)
     718          return -1;
     719        mimeType=(char*)malloc(sizeof(char)*(f_status.st_size+1));
     720        FILE* f=fopen(cached,"rb");
     721        fread(mimeType,f_status.st_size,1,f);
     722        mimeType[f_status.st_size]=0;
     723        fclose(f);
     724        unlockFile(*m,lck);
     725      }
     726      cached[strlen(cached)-1]='p';
     727      s=zStat(cached, &f_status);
     728      if(s==0){
     729        zooLock* lck=lockFile(*m,cached,'r');
     730        if(lck==NULL)
     731          return -1;
     732        origin=(char*)malloc(sizeof(char)*(f_status.st_size+1));
     733        FILE* f=fopen(cached,"rb");
     734        fread(origin,f_status.st_size,1,f);
     735        mimeType[f_status.st_size]=0;
     736        fclose(f);
     737        unlockFile(*m,lck);
     738      }
     739    }   
    737740  }else{   
    738741    addRequestToQueue(m,hInternet,url,true);
  • trunk/zoo-project/zoo-kernel/main_conf_read.y

    r917 r961  
    162162    freeMap(&current_content);
    163163    free(current_content);
     164  }else{
     165    current_maps->next=NULL;
    164166  }
    165167  if(curr_key!=NULL){
  • trunk/zoo-project/zoo-kernel/server_internal.c

    r921 r961  
    373373    return ;
    374374  }
    375   fseek(file, 0, SEEK_END);
    376375  zStatStruct f_status;
    377376  int s=zStat(filename, &f_status);
    378377  sprintf(rsize,"%lld",f_status.st_size);
    379   rewind(file);
    380378  if(getMap(content,"storage")==NULL){
    381379    map* memUse=getMapFromMaps(m,"main","memory");
     
    390388      if(tmpMap1->value==NULL){
    391389        setMapInMaps(m,"lenv","message","Unable to allocate the memory required to read the produced file.");
     390        return;
    392391      }
    393392      fread(&tmpMap1->value,1,f_status.st_size,file);
     
    395394    }
    396395  }
    397   fclose(file); 
    398   addToMap(content,"size",rsize);
     396  fclose(file);
     397  if(content!=NULL)
     398    addToMap(content,"size",rsize);
    399399}
    400400
  • trunk/zoo-project/zoo-kernel/service.c

    r957 r961  
    328328    fprintf(stderr,"freeMap\n");
    329329#endif
    330     free(_cursor->name);
    331     free(_cursor->value);
     330    if(_cursor->name!=NULL)
     331      free(_cursor->name);
     332    if(_cursor->value!=NULL)
     333      free(_cursor->value);
    332334    if(_cursor->next!=NULL){
    333335      freeMap(&_cursor->next);
    334       free(_cursor->next);
     336      if(_cursor->next!=NULL)
     337        free(_cursor->next);
    335338    }
    336339  }
     
    825828    else{
    826829      maps* tmp1=getMaps(*mo,tmp->name);
    827       while(_cursor->next!=NULL)
    828         _cursor=_cursor->next;
    829830      if(tmp1==NULL){
     831        while(_cursor->next!=NULL)
     832          _cursor=_cursor->next;
    830833        _cursor->next=dupMaps(&tmp);
    831834        if(tmp->child!=NULL)
  • trunk/zoo-project/zoo-kernel/service_internal_python.c

    r943 r961  
    468468  while(tmp!=NULL){
    469469    PyObject* name=PyString_FromString(tmp->name);
    470     if(strcasecmp(tmp->name,"value")==0) {
     470    if(strcasecmp(tmp->name,"value")==0 && strlen(tmp->value)>0) {
    471471      if(isArray!=NULL){
    472472        map* len=getMap(tmp,"length");
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