Changeset 100 for trunk/zoo-kernel


Ignore:
Timestamp:
Jan 30, 2011, 11:58:32 PM (14 years ago)
Author:
djay
Message:

Detect the size of outputed binary string for the value key then add the size in the correspoding output maps. Solve raster storage on server side when returned from Python Services.

Location:
trunk/zoo-kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-kernel/service_conf.l

    r57 r100  
    4141
    4242attname [a-zA-Z0-9_\-]+
    43 attvalue1       [\*\+,;@a-zA-Z0-9_\-::.:" "\"\'/\\\(\)]+
     43attvalue1       [\^\*\+,;@a-zA-Z0-9_\-::.:" "\"\'/\\\(\)]+
    4444
    4545attvalue                \"[^"]*\"|\'[^']*\'\(\)
  • trunk/zoo-kernel/service_internal_python.c

    r75 r100  
    305305  for(i=0;i<nb;i++){
    306306    PyObject* key=PyList_GetItem(list,i);
    307     if(strcmp(PyString_AsString(key),"size")==0){
    308       PyObject* value=PyDict_GetItem((PyObject*)t,key);
    309       sizeValue=atoi(PyString_AsString(value));
    310       Py_DECREF(value);
    311       Py_DECREF(key);   
    312       break;
    313     }
    314     Py_DECREF(key);   
    315   }
    316   for(i=0;i<nb;i++){
    317     PyObject* key=PyList_GetItem(list,i);
    318307    PyObject* value=PyDict_GetItem((PyObject*)t,key);
    319308#ifdef DEBUG
     
    321310            PyString_AsString(key),PyString_AsString(value));
    322311#endif
    323     if(sizeValue>=0 && strcmp(PyString_AsString(key),"value")==0){
    324       char *buffer=NULL;//(char*)malloc((sizeValue+1)*sizeof(char));
     312    if(strcmp(PyString_AsString(key),"value")==0){
     313      char *buffer=NULL;
    325314      Py_ssize_t size;
    326315      PyString_AsStringAndSize(value,&buffer,&size);
     316      fprintf(stderr,"SIZE %d\n",size);
    327317      if(res!=NULL){
    328318        addToMap(res,PyString_AsString(key),"");
     
    332322      map* tmpR=getMap(res,"value");
    333323      free(tmpR->value);
    334       tmpR->value=(char*)malloc((sizeValue+1)*sizeof(char));
    335       memmove(tmpR->value,buffer,sizeValue*sizeof(char));
    336       tmpR->value[sizeValue]=0;
     324      tmpR->value=(char*)malloc((size+1)*sizeof(char));
     325      memmove(tmpR->value,buffer,size*sizeof(char));
     326      tmpR->value[size]=0;
     327      char sin[1024];
     328      sprintf(sin,"%d",size);
     329      addToMap(res,"size",sin);
    337330    }else{
    338331      if(res!=NULL)
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