Changeset 933 for branches/prototype-v0


Ignore:
Timestamp:
May 31, 2019, 3:03:21 PM (5 years ago)
Author:
knut
Message:

Resolve certain string-related type conflicts, e.g., char* vs. const char* or char[N], that may cause errors in some build environments. Resolve a problem with the include order of fcgi_stdio.h (note: should verify that this harmonizes with resolution of same problem in trunk).

Location:
branches/prototype-v0/zoo-project/zoo-kernel
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/prototype-v0/zoo-project/zoo-kernel/mimetypes.h

    r854 r933  
    839839
    840840static int isGeographic(const char* mimeType){
    841   char* imageMimeType[4]={
     841  const char* imageMimeType[4]={
    842842    "image/tiff",
    843843    "image/png",
     
    845845    "application/vnd.google-earth.kmz"
    846846  };
    847   char* vectorMimeType[5]={
     847  const char* vectorMimeType[5]={
    848848    "text/xml",
    849849    "application/json",
  • branches/prototype-v0/zoo-project/zoo-kernel/request_parser.c

    r908 r933  
    783783                                maps *tmpConf=createMaps("main");
    784784                                tmpConf->content=createMap("memory","load");
     785        static char PROC_NAME[] = "ZooWPSClient";
    785786                                bInternet = InternetOpen (
    786787#ifndef WIN32
    787788                                                          (LPCTSTR)
    788789#endif
    789                                                           "ZooWPSClient\0",
     790                                                          PROC_NAME,
    790791                                                          INTERNET_OPEN_TYPE_PRECONFIG,
    791792                                                          NULL, NULL, 0);
  • branches/prototype-v0/zoo-project/zoo-kernel/server_internal.c

    r910 r933  
    601601 */
    602602char* addDefaultValues(maps** out,elements* in,maps* m,int type,map** err){
     603  static char EMPTY[] = "";
    603604  map *res=*err;
    604605  elements* tmpInputs=in;
     
    738739           * content map.
    739740           */
    740           char* keys[4]={
     741          const char* keys[4]={
    741742            "minOccurs",
    742743            "maxOccurs",
     
    882883    return result;
    883884  }
    884   return "";
     885  return EMPTY;
    885886}
    886887
     
    11331134    map* statusInfo=createMap("JobID",pid);
    11341135    addToMap(statusInfo,"Status","Dismissed");
    1135     printStatusInfo(conf,statusInfo,"Dismiss");
     1136    printStatusInfo(conf,statusInfo, (char*) "Dismiss");
    11361137    free(statusInfo);
    11371138  }
  • branches/prototype-v0/zoo-project/zoo-kernel/service_callback.c

    r899 r933  
    127127    maps* tmpConf=createMaps("main");
    128128    tmpConf->content=createMap("memory","load");
    129     hInternet=InternetOpen("ZooWPSClient\0",
     129    static char PROC_NAME[] = "ZooWPSClient";
     130    hInternet=InternetOpen(PROC_NAME,
    130131                           INTERNET_OPEN_TYPE_PRECONFIG,
    131132                           NULL,NULL, 0);
     
    435436      maps* curs=inputs;
    436437      dumpMaps(curs);
    437       char *keys[11][2]={
     438      const char *keys[11][2]={
    438439        {
    439440          "xlink:href",
     
    614615      maps* curs=outputs;
    615616      dumpMaps(curs);
    616       char *keys[10][2]={
     617      const char *keys[10][2]={
    617618        {
    618619          "Reference",
     
    656657        }       
    657658      };
    658       char* specifics[5][2]={
     659      const char* specifics[5][2]={
    659660        {
    660661          "download_link",
     
    767768    case 6: {
    768769      // Finalize HPC
    769       char *keys[6][2]={
     770      const char *keys[6][2]={
    770771        {
    771772          //"SubmitTime",
  • branches/prototype-v0/zoo-project/zoo-kernel/service_internal.c

    r899 r933  
    9999  struct zooLock* myLock=(struct zooLock*)malloc(sizeof(struct flock)+sizeof(FILE*)+sizeof(char*));
    100100  int len=6;
    101   char *myTemplate="%s.lock";
     101  static const char myTemplate[] = "%s.lock";
    102102  int res=-1;
    103103 retryLockFile:
     
    172172    }
    173173    if(res<0){
    174       char *tmp;
    175       if(errno==EBADF)
    176         tmp="Either: the filedes argument is invalid; you requested a read lock but the filedes is not open for read access; or, you requested a write lock but the filedes is not open for write access.";
     174      char tmp[512];
     175      if (errno == EBADF)
     176        strncpy(tmp, "Either: the filedes argument is invalid; you requested a read lock but the filedes is not open for read access; or, you requested a write lock but the filedes is not open for write access.", 512);
    177177      else
    178         if(errno==EINVAL)
    179           tmp="Either the lockp argument doesn’t specify valid lock information, or the file associated with filedes doesn’t support locks.";
    180         else
    181           tmp="The system has run out of file lock resources; there are already too many file locks in place.";
     178        if (errno == EINVAL)
     179          strncpy(tmp, "Either the lockp argument doesn’t specify valid lock information, or the file associated with filedes doesn’t support locks.", 512);
     180        else
     181          strncpy(tmp, "The system has run out of file lock resources; there are already too many file locks in place.", 512);
    182182#ifdef DEBUG
    183183      fprintf(stderr,"Unable to get the lock on %s due to the following error: %s\n",myLock->filename,tmp);
     
    317317  }
    318318  if(hasFile>0){
    319     semid lockid;
     319    semid lockid = NULL; // knut: add initialization
    320320    char* stat=getStatusId(conf,pid);
    321321    if(stat!=NULL){
     
    505505
    506506semid getShmLockId(maps* conf, int nsems){
    507   semid sem_id;
     507  semid sem_id; 
    508508  char key[MAX_PATH];
    509509  getKeyValue(conf, key, MAX_PATH);
    510510 
    511   sem_id = CreateSemaphore( NULL, nsems, nsems+1, key);
     511  //sem_id = CreateSemaphore( NULL, nsems, nsems+1, key); knut: CreateSemaphore may alias to wide-character version CreateSemaphoreW
     512  sem_id = CreateSemaphoreA( NULL, nsems, nsems+1, key);
    512513  if(sem_id==NULL){
    513514#ifdef DEBUG
     
    564565
    565566char* getStatus(int pid){
     567  static char err[] = "-1";
     568
    566569  char *lpszBuf=(char*) malloc(SHMEMSIZE*sizeof(char));
    567570  int i=0;
     
    584587    fprintf(stderr,"ERROR on line %d\n",__LINE__);
    585588#endif
    586     return "-1";
     589    //return "-1";
     590    return err;
    587591  }
    588592  if((GetLastError() != ERROR_ALREADY_EXISTS)){
     
    593597    fIgnore = UnmapViewOfFile(lpvMem);
    594598    fIgnore = CloseHandle(hMapObject);
    595     return "-1";
     599    //return "-1";
     600    return err;
    596601  }
    597602  fInit=TRUE;
     
    608613    fprintf(stderr,"READING STRING S %s\n", getLastErrorMessage());
    609614#endif
    610     return "-1";
     615    //return "-1";
     616    return err;
    611617  }
    612618  lpszTmp = (LPWSTR) lpvMem;
  • branches/prototype-v0/zoo-project/zoo-kernel/service_internal.h

    r900 r933  
    6767#include <sys/stat.h>
    6868#include <sys/types.h>
     69#include "cgic.h"
    6970#ifndef WIN32
    7071#include <sys/ipc.h>
  • branches/prototype-v0/zoo-project/zoo-kernel/service_internal_mono.c

    r896 r933  
    5555  MonoImage* monoImage;
    5656
    57   char* libPath="/usr/lib";
    58   char* etcPath="/etc";
     57  static char LIB[] = "/usr/lib";
     58  static char ETC[] = "/etc";
     59 
     60  char* libPath = LIB;
     61  char* etcPath = ETC;
    5962  map* libPathMap=getMapFromMaps(*main_conf,"mono","lib");
    6063  map* etcPathMap=getMapFromMaps(*main_conf,"mono","etc");
     
    8487  //MonoDomain* monoDomain = mono_jit_init("ZOO_Embedded_Domain"); 
    8588
    86   char* ZMapsLib = "ZMaps.dll";
     89  const char* ZMapsLib = "ZMaps.dll";
    8790  char *zooAssembly = NULL;
    8891 
  • branches/prototype-v0/zoo-project/zoo-kernel/service_internal_ms.c

    r898 r933  
    12881288   * First store the value on disk
    12891289   */
     1290  static char DATA[] = "data";
     1291  static char JSON[] = "json";
    12901292  int imyIndex=getPublishedId(outputs);
    12911293  map* mime=getMapArray(outputs->content,"mimeType",imyIndex);
    12921294  map* msUrl=getMapFromMaps(conf,"main","mapserverAddress");
    12931295  map* dataPath=getMapFromMaps(conf,"main","dataPath");
    1294   char *ext="data";
    1295   if(mime!=NULL)
    1296     if(strncasecmp(mime->value,"application/json",16)==0)
    1297       ext="json";
     1296  char *ext = DATA;
     1297  if (mime != NULL)
     1298    if (strncasecmp(mime->value, "application/json", 16) == 0)
     1299      ext = JSON;
    12981300
    12991301  map* storage=getMapArray(outputs->content,"storage",imyIndex);
  • branches/prototype-v0/zoo-project/zoo-kernel/service_internal_python.c

    r896 r933  
    151151
    152152#ifdef WIN32
    153   char* os_pathsep = ";";
     153  const char* os_pathsep = ";";
    154154#else
    155   char* os_pathsep = ":";
    156 #endif
     155  const char* os_pathsep = ":";
     156#endif
     157  static char EMPTY[] = "";
    157158
    158159  maps* m=*main_conf;
     
    171172  }
    172173  else {
    173           libPath = "";
     174          //libPath = "";
     175    libPath = EMPTY;
    174176  }
    175177
  • branches/prototype-v0/zoo-project/zoo-kernel/sqlapi.c

    r890 r933  
    7171  maps* cconf=getMaps(conf,key);
    7272  if(cconf==NULL){
    73     fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
    74     return "-1";
     73    fprintf(stderr,"%s %d\n",__FILE__,__LINE__);   
     74    static char err[] = "-1";
     75    return err;
    7576  }
    7677  int len=0;
  • branches/prototype-v0/zoo-project/zoo-kernel/ulinet.c

    r899 r933  
    3232#include <assert.h>
    3333#include <ctype.h>
    34 #include "fcgi_stdio.h"
    3534
    3635/**
     
    270269char* getProvenance(maps* conf,const char* url){
    271270  map* sharedCache=getMapFromMaps(conf,"security","shared");
    272   char *res="OTHER";
    273   char *paths[2]={
     271  //char *res="OTHER";
     272  static char OTHER[] = "OTHER";
     273  static char SHARED[] = "SHARED";
     274  static char LOCAL[] = "LOCAL";
     275  const char *paths[2]={
    274276    "mapserverAddress",
    275277    "tmpUrl"
     
    280282    while(curs!=NULL){
    281283      if(strstr(url,curs)==NULL){
    282         return "SHARED";
     284        return SHARED;
    283285      }
    284286      curs=strtok(NULL,",");
     
    289291    if(sharedCache!=NULL){
    290292      if(strstr(url,sharedCache->value)!=NULL){
    291         return "LOCAL";
    292       }
    293     }
    294   }
    295   return res;
     293        return LOCAL;
     294      }
     295    }
     296  }
     297  //return res;
     298  return OTHER;
    296299}
    297300
  • branches/prototype-v0/zoo-project/zoo-kernel/ulinet.h

    r899 r933  
    2525#ifndef _ULINET_H
    2626#define _ULINET_H
     27
     28#include "fcgi_stdio.h"
    2729
    2830#include <stdlib.h>
     
    7779    struct curl_slist *header; //!< the headers to send
    7880    char* filename; //!< the cached file name
    79     FILE* file; //!< the file pointer
     81    FILE* file; //!< the file pointer   
    8082    unsigned char *pabyData; //!< the downloaded content
    8183    char *url; //!< the url used to access the server
  • branches/prototype-v0/zoo-project/zoo-kernel/zoo_service_loader.c

    r914 r933  
    854854    char* filepath = kvp + strlen(key);
    855855    strncpy(kvp, key, strlen(key));
    856     addToCache(m, tmpReq->value, tmpReq->value, "text/xml", strlen(tmpReq->value),
     856    addToCache(m, tmpReq->value, tmpReq->value, (char*) "text/xml", strlen(tmpReq->value),
    857857               filepath, FILENAME_MAX);
    858858    if (filepath == NULL) {
     
    20012001#ifndef WIN32
    20022002                            (LPCTSTR)
     2003#else
     2004          (char*)
    20032005#endif
    20042006                            "ZooWPSClient\0",
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