Ignore:
Timestamp:
Feb 12, 2011, 4:14:17 PM (13 years ago)
Author:
djay
Message:

Code cleanup to avoid most of the warning messages at compilation time.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-kernel/zoo_service_loader.c

    r109 r114  
    9494}
    9595
    96 xmlXPathObjectPtr extractFromDoc(xmlDocPtr doc,char* search){
     96xmlXPathObjectPtr extractFromDoc(xmlDocPtr doc,const char* search){
    9797  xmlXPathContextPtr xpathCtx;
    9898  xmlXPathObjectPtr xpathObj;
     
    110110void sig_handler(int sig){
    111111  char tmp[100];
    112   char *ssig;
     112  const char *ssig;
    113113  switch(sig){
    114114  case SIGSEGV:
     
    153153  map* r_inputs=NULL;
    154154#ifndef WIN32
    155   getcwd(ntmp,1024);
     155  char* pntmp=getcwd(ntmp,1024);
    156156#else
    157157  _getcwd(ntmp,1024);
     
    360360#endif
    361361
    362   map* r_inputs=NULL,*tmps=NULL;
     362  map* r_inputs=NULL;
    363363  maps* m=NULL;
    364   int argc=count(request_inputs);
    365364
    366365  char* REQUEST=NULL;
     
    374373  char ntmp[1024];
    375374#ifndef WIN32
    376   getcwd(ntmp,1024);
     375  char *pntmp=getcwd(ntmp,1024);
    377376#else
    378377  _getcwd(ntmp,1024);
     
    470469  }
    471470
    472   map* outputs=NULL;
    473471  maps* request_output_real_format=NULL;
    474472  map* tmpm=getMapFromMaps(m,"main","serverAddress");
     
    478476    SERVICE_URL=strdup(DEFAULT_SERVICE_URL);
    479477
    480   service* s[100];
    481478  service* s1;
    482479  int scount=0;
     
    497494
    498495  if(strncasecmp(REQUEST,"GetCapabilities",15)==0){
    499     int i=0;
    500496    struct dirent *dp;
    501497#ifdef DEBUG
     
    510506    r_inputs=getMap(request_inputs,"ServiceProvider");
    511507    xmlNodePtr n;
    512     //dumpMap(request_inputs);
    513508    if(r_inputs!=NULL)
    514509      n = printGetCapabilitiesHeader(doc,r_inputs->value,m);
     
    595590      char buff[256];
    596591      char buff1[1024];
    597       int i=0;
    598       int j=0;
    599       int end=-1;
    600592      int saved_stdout = dup(fileno(stdout));
    601593      dup2(fileno(stderr),fileno(stdout));
     
    611603            memset(buff1,0,1024);
    612604            snprintf(buff1,1024,"%s/%s",conf_dir,dp->d_name);
    613             //s1=(service*)malloc(sizeof(service*));
    614605            s1=(service*)calloc(1,SERVICE_SIZE);
    615606            if(s1 == NULL){
     
    640631      free(SERVICE_URL);
    641632      fflush(stdout);
    642       //xmlFree(n);
    643633#ifndef LINUX_FREE_ISSUE
    644634      if(s1)
     
    654644#endif 
    655645        closedir(dirp);
    656         free(s);
    657646        return 0;
    658647      }
     
    703692  dumpService(s1);
    704693#endif
    705   map* inputs=NULL;
    706   elements* c_inputs=s1->inputs;
    707694  int j;
    708695 
     
    747734      fprintf(stderr,"OUTPUT Parsing start now ... \n");
    748735#endif
    749       char current_output_as_string[10240];
    750736      char cursor_output[10240];
    751737      char *cotmp=strdup(r_inputs->value);
     
    753739      free(cotmp);
    754740      j=0;
    755       map* request_kvp_outputs=NULL;
    756741       
    757742      /**
     
    834819        fflush(stderr);
    835820#endif
    836         //tmp_output=tmp_output->next;
    837821        free(tmp);
    838822      }
     
    848832    fprintf(stderr,"DATA INPUTS [%s]\n",r_inputs->value);
    849833#endif
    850     char current_input_as_string[40960];
    851834    char cursor_input[40960];
    852835    if(r_inputs!=NULL)
     
    864847    }
    865848    j=0;
    866     map* request_kvp_inputs=NULL;
    867849 
    868850    /**
     
    907889        strncpy(tmpn,tmpc,(strlen(tmpc)-strlen(tmpv))*sizeof(char));
    908890        tmpn[strlen(tmpc)-strlen(tmpv)]=0;
    909         int cnt=0;
    910891#ifdef DEBUG
    911892        fprintf(stderr,"***\n*** %s = %s ***\n",tmpn,tmpv+1);
     
    1010991    fflush(stderr);
    1011992#endif
    1012     xmlNodePtr cur = xmlDocGetRootElement(doc);
    1013993    /**
    1014994     * Parse every Input in DataInputs node.
    1015995     */
    1016     maps* tempMaps=NULL;
    1017996    xmlXPathObjectPtr tmpsptr=extractFromDoc(doc,"/*/*/*[local-name()='Input']");
    1018997    xmlNodeSet* tmps=tmpsptr->nodesetval;
     
    10641043                return errorException(m, _("Unable to allocate memory."), "InternalError");
    10651044              }
    1066               tmpmaps->name="missingIndetifier";
     1045              tmpmaps->name=strdup("missingIndetifier");
    10671046              tmpmaps->content=createMap((char*)cur2->name,(char*)val);
    10681047              tmpmaps->next=NULL;
     
    10931072            fprintf(stderr,"REFERENCE\n");
    10941073#endif
    1095             map* referenceMap=NULL;
    1096             char *refs[5];
     1074            const char *refs[5];
    10971075            refs[0]="mimeType";
    10981076            refs[1]="encoding";
     
    11001078            refs[3]="method";
    11011079            refs[4]="href";
    1102             char*url;
    11031080            for(int l=0;l<5;l++){
    11041081#ifdef DEBUG
     
    11421119            while(cur3){
    11431120              if(xmlStrcasecmp(cur3->name,BAD_CAST "Header")==0 ){
    1144                 xmlNodePtr cur4=cur3;
    1145                 char *tmp=new char[cgiContentLength];
    1146                 char *ha[2];
     1121                const char *ha[2];
    11471122                ha[0]="key";
    11481123                ha[1]="value";
     
    11701145                }
    11711146                hInternet.header=curl_slist_append(hInternet.header, has);
    1172                 //free(has);
     1147                free(has);
    11731148              }
    11741149              else{
     
    13021277                 * dataType , uom
    13031278                 */
    1304                 char *lits[2];
    1305                 lits[0]="dataType";
    1306                 lits[1]="uom";
     1279                char *list[2];
     1280                list[0]=strdup("dataType");
     1281                list[1]=strdup("uom");
    13071282                for(int l=0;l<2;l++){
    13081283#ifdef DEBUG
    1309                   fprintf(stderr,"*** LiteralData %s ***",lits[l]);
    1310 #endif
    1311                   xmlChar *val=xmlGetProp(cur4,BAD_CAST lits[l]);
     1284                  fprintf(stderr,"*** LiteralData %s ***",list[l]);
     1285#endif
     1286                  xmlChar *val=xmlGetProp(cur4,BAD_CAST list[l]);
    13121287                  if(val!=NULL && strlen((char*)val)>0){
    13131288                    if(tmpmaps->content!=NULL)
    1314                       addToMap(tmpmaps->content,lits[l],(char*)val);
     1289                      addToMap(tmpmaps->content,list[l],(char*)val);
    13151290                    else
    1316                       tmpmaps->content=createMap(lits[l],(char*)val);
     1291                      tmpmaps->content=createMap(list[l],(char*)val);
    13171292                  }
    13181293#ifdef DEBUG
     
    13201295#endif
    13211296                  xmlFree(val);
     1297                  free(list[l]);
    13221298                }
    13231299              }
     
    13271303                 * mimeType, encoding, schema
    13281304                 */
    1329                 char *coms[3];
     1305                const char *coms[3];
    13301306                coms[0]="mimeType";
    13311307                coms[1]="encoding";
     
    13681344                char *res=NULL;
    13691345                char *curs=tmpv->value;
    1370                 int i=0;
    13711346                for(int i=0;i<=strlen(tmpv->value)/64;i++) {
    13721347                  if(res==NULL)
     
    14211396#endif
    14221397    xmlXPathFreeObject(tmpsptr);
    1423     //xmlFree(tmps);
    14241398   
    14251399    tmpsptr=extractFromDoc(doc,"/*/*/*[local-name()='ResponseDocument']");
     
    14391413      else
    14401414        addToMap(request_inputs,"ResponseDocument","");
    1441       request_output_real_format;
    14421415      maps *tmpmaps=NULL;
    14431416      xmlNodePtr cur=tmps->nodeTab[k];
     
    14511424            return errorException(m, _("Unable to allocate memory."), "InternalError");
    14521425          }
    1453           tmpmaps->name="unknownIdentifier";
     1426          tmpmaps->name=strdup("unknownIdentifier");
    14541427          tmpmaps->next=NULL;
    14551428        }
     
    14581431         * storeExecuteResponse, lineage, status
    14591432         */
    1460         char *ress[3];
     1433        const char *ress[3];
    14611434        ress[0]="storeExecuteResponse";
    14621435        ress[1]="lineage";
     
    14871460             * mimeType, encoding, schema, uom, asReference
    14881461             */
    1489             char *outs[5];
     1462            const char *outs[5];
    14901463            outs[0]="mimeType";
    14911464            outs[1]="encoding";
     
    15431516                    return errorException(m, _("Unable to allocate memory."), "InternalError");
    15441517                  }
    1545                   tmpmaps->name="missingIndetifier";
     1518                  tmpmaps->name=strdup("missingIndetifier");
    15461519                  tmpmaps->content=createMap((char*)cur2->name,(char*)val);
    15471520                  tmpmaps->next=NULL;
     
    15631536        }
    15641537      }
    1565       //xmlFree(cur);
    15661538      if(request_output_real_format==NULL)
    15671539        request_output_real_format=dupMaps(&tmpmaps);
     
    15761548
    15771549    xmlXPathFreeObject(tmpsptr);
    1578     //xmlFree(tmps);
    15791550    xmlCleanupParser();
    15801551  }
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