Index: /branches/prototype-v0/zoo-project/zoo-kernel/mimetypes.h
===================================================================
--- /branches/prototype-v0/zoo-project/zoo-kernel/mimetypes.h	(revision 932)
+++ /branches/prototype-v0/zoo-project/zoo-kernel/mimetypes.h	(revision 933)
@@ -839,5 +839,5 @@
 
 static int isGeographic(const char* mimeType){
-  char* imageMimeType[4]={
+  const char* imageMimeType[4]={
     "image/tiff",
     "image/png",
@@ -845,5 +845,5 @@
     "application/vnd.google-earth.kmz"
   };
-  char* vectorMimeType[5]={
+  const char* vectorMimeType[5]={
     "text/xml",
     "application/json",
Index: /branches/prototype-v0/zoo-project/zoo-kernel/request_parser.c
===================================================================
--- /branches/prototype-v0/zoo-project/zoo-kernel/request_parser.c	(revision 932)
+++ /branches/prototype-v0/zoo-project/zoo-kernel/request_parser.c	(revision 933)
@@ -783,9 +783,10 @@
 				maps *tmpConf=createMaps("main");
 				tmpConf->content=createMap("memory","load");
+        static char PROC_NAME[] = "ZooWPSClient";
 				bInternet = InternetOpen (
 #ifndef WIN32
 							  (LPCTSTR)
 #endif
-							  "ZooWPSClient\0",
+							  PROC_NAME,
 							  INTERNET_OPEN_TYPE_PRECONFIG,
 							  NULL, NULL, 0);
Index: /branches/prototype-v0/zoo-project/zoo-kernel/server_internal.c
===================================================================
--- /branches/prototype-v0/zoo-project/zoo-kernel/server_internal.c	(revision 932)
+++ /branches/prototype-v0/zoo-project/zoo-kernel/server_internal.c	(revision 933)
@@ -601,4 +601,5 @@
  */
 char* addDefaultValues(maps** out,elements* in,maps* m,int type,map** err){
+  static char EMPTY[] = "";
   map *res=*err;
   elements* tmpInputs=in;
@@ -738,5 +739,5 @@
 	   * content map.
 	   */
-	  char* keys[4]={
+	  const char* keys[4]={
 	    "minOccurs",
 	    "maxOccurs",
@@ -882,5 +883,5 @@
     return result;
   }
-  return "";
+  return EMPTY;
 }
 
@@ -1133,5 +1134,5 @@
     map* statusInfo=createMap("JobID",pid);
     addToMap(statusInfo,"Status","Dismissed");
-    printStatusInfo(conf,statusInfo,"Dismiss");
+    printStatusInfo(conf,statusInfo, (char*) "Dismiss");
     free(statusInfo);
   }
Index: /branches/prototype-v0/zoo-project/zoo-kernel/service_callback.c
===================================================================
--- /branches/prototype-v0/zoo-project/zoo-kernel/service_callback.c	(revision 932)
+++ /branches/prototype-v0/zoo-project/zoo-kernel/service_callback.c	(revision 933)
@@ -127,5 +127,6 @@
     maps* tmpConf=createMaps("main");
     tmpConf->content=createMap("memory","load");
-    hInternet=InternetOpen("ZooWPSClient\0",
+    static char PROC_NAME[] = "ZooWPSClient";
+    hInternet=InternetOpen(PROC_NAME,
 			   INTERNET_OPEN_TYPE_PRECONFIG,
 			   NULL,NULL, 0);
@@ -435,5 +436,5 @@
       maps* curs=inputs;
       dumpMaps(curs);
-      char *keys[11][2]={
+      const char *keys[11][2]={
 	{
 	  "xlink:href",
@@ -614,5 +615,5 @@
       maps* curs=outputs;
       dumpMaps(curs);
-      char *keys[10][2]={
+      const char *keys[10][2]={
 	{
 	  "Reference",
@@ -656,5 +657,5 @@
 	}	
       };
-      char* specifics[5][2]={
+      const char* specifics[5][2]={
 	{
 	  "download_link",
@@ -767,5 +768,5 @@
     case 6: {
       // Finalize HPC
-      char *keys[6][2]={
+      const char *keys[6][2]={
 	{
 	  //"SubmitTime",
Index: /branches/prototype-v0/zoo-project/zoo-kernel/service_internal.c
===================================================================
--- /branches/prototype-v0/zoo-project/zoo-kernel/service_internal.c	(revision 932)
+++ /branches/prototype-v0/zoo-project/zoo-kernel/service_internal.c	(revision 933)
@@ -99,5 +99,5 @@
   struct zooLock* myLock=(struct zooLock*)malloc(sizeof(struct flock)+sizeof(FILE*)+sizeof(char*));
   int len=6;
-  char *myTemplate="%s.lock";
+  static const char myTemplate[] = "%s.lock";
   int res=-1;
  retryLockFile:
@@ -172,12 +172,12 @@
     }
     if(res<0){
-      char *tmp;
-      if(errno==EBADF)
-	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.";
+      char tmp[512];
+      if (errno == EBADF)
+        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);
       else
-	if(errno==EINVAL)
-	  tmp="Either the lockp argument doesn’t specify valid lock information, or the file associated with filedes doesn’t support locks.";
-	else
-	  tmp="The system has run out of file lock resources; there are already too many file locks in place.";
+        if (errno == EINVAL)
+          strncpy(tmp, "Either the lockp argument doesn’t specify valid lock information, or the file associated with filedes doesn’t support locks.", 512);
+        else
+          strncpy(tmp, "The system has run out of file lock resources; there are already too many file locks in place.", 512);
 #ifdef DEBUG
       fprintf(stderr,"Unable to get the lock on %s due to the following error: %s\n",myLock->filename,tmp);
@@ -317,5 +317,5 @@
   }
   if(hasFile>0){
-    semid lockid;
+    semid lockid = NULL; // knut: add initialization
     char* stat=getStatusId(conf,pid);
     if(stat!=NULL){
@@ -505,9 +505,10 @@
 
 semid getShmLockId(maps* conf, int nsems){
-  semid sem_id;
+  semid sem_id; 
   char key[MAX_PATH];
   getKeyValue(conf, key, MAX_PATH);
   
-  sem_id = CreateSemaphore( NULL, nsems, nsems+1, key);
+  //sem_id = CreateSemaphore( NULL, nsems, nsems+1, key); knut: CreateSemaphore may alias to wide-character version CreateSemaphoreW
+  sem_id = CreateSemaphoreA( NULL, nsems, nsems+1, key);
   if(sem_id==NULL){
 #ifdef DEBUG
@@ -564,4 +565,6 @@
 
 char* getStatus(int pid){
+  static char err[] = "-1";
+
   char *lpszBuf=(char*) malloc(SHMEMSIZE*sizeof(char));
   int i=0;
@@ -584,5 +587,6 @@
     fprintf(stderr,"ERROR on line %d\n",__LINE__);
 #endif
-    return "-1";
+    //return "-1";
+    return err;
   }
   if((GetLastError() != ERROR_ALREADY_EXISTS)){
@@ -593,5 +597,6 @@
     fIgnore = UnmapViewOfFile(lpvMem); 
     fIgnore = CloseHandle(hMapObject);
-    return "-1";
+    //return "-1";
+    return err;
   }
   fInit=TRUE;
@@ -608,5 +613,6 @@
     fprintf(stderr,"READING STRING S %s\n", getLastErrorMessage());
 #endif
-    return "-1"; 
+    //return "-1"; 
+    return err;
   }
   lpszTmp = (LPWSTR) lpvMem;
Index: /branches/prototype-v0/zoo-project/zoo-kernel/service_internal.h
===================================================================
--- /branches/prototype-v0/zoo-project/zoo-kernel/service_internal.h	(revision 932)
+++ /branches/prototype-v0/zoo-project/zoo-kernel/service_internal.h	(revision 933)
@@ -67,4 +67,5 @@
 #include <sys/stat.h>
 #include <sys/types.h>
+#include "cgic.h"
 #ifndef WIN32
 #include <sys/ipc.h>
Index: /branches/prototype-v0/zoo-project/zoo-kernel/service_internal_mono.c
===================================================================
--- /branches/prototype-v0/zoo-project/zoo-kernel/service_internal_mono.c	(revision 932)
+++ /branches/prototype-v0/zoo-project/zoo-kernel/service_internal_mono.c	(revision 933)
@@ -55,6 +55,9 @@
   MonoImage* monoImage;
 
-  char* libPath="/usr/lib";
-  char* etcPath="/etc";
+  static char LIB[] = "/usr/lib";
+  static char ETC[] = "/etc";
+ 
+  char* libPath = LIB;
+  char* etcPath = ETC;
   map* libPathMap=getMapFromMaps(*main_conf,"mono","lib");
   map* etcPathMap=getMapFromMaps(*main_conf,"mono","etc");
@@ -84,5 +87,5 @@
   //MonoDomain* monoDomain = mono_jit_init("ZOO_Embedded_Domain");  
 
-  char* ZMapsLib = "ZMaps.dll";
+  const char* ZMapsLib = "ZMaps.dll";
   char *zooAssembly = NULL;
   
Index: /branches/prototype-v0/zoo-project/zoo-kernel/service_internal_ms.c
===================================================================
--- /branches/prototype-v0/zoo-project/zoo-kernel/service_internal_ms.c	(revision 932)
+++ /branches/prototype-v0/zoo-project/zoo-kernel/service_internal_ms.c	(revision 933)
@@ -1288,12 +1288,14 @@
    * First store the value on disk
    */
+  static char DATA[] = "data";
+  static char JSON[] = "json";
   int imyIndex=getPublishedId(outputs);
   map* mime=getMapArray(outputs->content,"mimeType",imyIndex);
   map* msUrl=getMapFromMaps(conf,"main","mapserverAddress");
   map* dataPath=getMapFromMaps(conf,"main","dataPath");
-  char *ext="data";
-  if(mime!=NULL)
-    if(strncasecmp(mime->value,"application/json",16)==0)
-      ext="json";
+  char *ext = DATA;
+  if (mime != NULL)
+    if (strncasecmp(mime->value, "application/json", 16) == 0)
+      ext = JSON;
 
   map* storage=getMapArray(outputs->content,"storage",imyIndex);
Index: /branches/prototype-v0/zoo-project/zoo-kernel/service_internal_python.c
===================================================================
--- /branches/prototype-v0/zoo-project/zoo-kernel/service_internal_python.c	(revision 932)
+++ /branches/prototype-v0/zoo-project/zoo-kernel/service_internal_python.c	(revision 933)
@@ -151,8 +151,9 @@
 
 #ifdef WIN32
-  char* os_pathsep = ";";
+  const char* os_pathsep = ";";
 #else
-  char* os_pathsep = ":";
-#endif
+  const char* os_pathsep = ":";
+#endif
+  static char EMPTY[] = "";
 
   maps* m=*main_conf;
@@ -171,5 +172,6 @@
   }
   else {
-	  libPath = "";
+	  //libPath = "";
+    libPath = EMPTY;
   }
 
Index: /branches/prototype-v0/zoo-project/zoo-kernel/sqlapi.c
===================================================================
--- /branches/prototype-v0/zoo-project/zoo-kernel/sqlapi.c	(revision 932)
+++ /branches/prototype-v0/zoo-project/zoo-kernel/sqlapi.c	(revision 933)
@@ -71,6 +71,7 @@
   maps* cconf=getMaps(conf,key);
   if(cconf==NULL){
-    fprintf(stderr,"%s %d\n",__FILE__,__LINE__);
-    return "-1";
+    fprintf(stderr,"%s %d\n",__FILE__,__LINE__);    
+    static char err[] = "-1";
+    return err;
   }
   int len=0;
Index: /branches/prototype-v0/zoo-project/zoo-kernel/ulinet.c
===================================================================
--- /branches/prototype-v0/zoo-project/zoo-kernel/ulinet.c	(revision 932)
+++ /branches/prototype-v0/zoo-project/zoo-kernel/ulinet.c	(revision 933)
@@ -32,5 +32,4 @@
 #include <assert.h>
 #include <ctype.h>
-#include "fcgi_stdio.h"
 
 /**
@@ -270,6 +269,9 @@
 char* getProvenance(maps* conf,const char* url){
   map* sharedCache=getMapFromMaps(conf,"security","shared");
-  char *res="OTHER";
-  char *paths[2]={
+  //char *res="OTHER"; 
+  static char OTHER[] = "OTHER"; 
+  static char SHARED[] = "SHARED";
+  static char LOCAL[] = "LOCAL";
+  const char *paths[2]={ 
     "mapserverAddress",
     "tmpUrl"
@@ -280,5 +282,5 @@
     while(curs!=NULL){
       if(strstr(url,curs)==NULL){
-	return "SHARED";
+        return SHARED;
       }
       curs=strtok(NULL,",");
@@ -289,9 +291,10 @@
     if(sharedCache!=NULL){
       if(strstr(url,sharedCache->value)!=NULL){
-	return "LOCAL";
-      }
-    }
-  }
-  return res;
+        return LOCAL;
+      }
+    }
+  }
+  //return res;
+  return OTHER;
 }
 
Index: /branches/prototype-v0/zoo-project/zoo-kernel/ulinet.h
===================================================================
--- /branches/prototype-v0/zoo-project/zoo-kernel/ulinet.h	(revision 932)
+++ /branches/prototype-v0/zoo-project/zoo-kernel/ulinet.h	(revision 933)
@@ -25,4 +25,6 @@
 #ifndef _ULINET_H
 #define _ULINET_H
+
+#include "fcgi_stdio.h"
 
 #include <stdlib.h>
@@ -77,5 +79,5 @@
     struct curl_slist *header; //!< the headers to send
     char* filename; //!< the cached file name
-    FILE* file; //!< the file pointer
+    FILE* file; //!< the file pointer    
     unsigned char *pabyData; //!< the downloaded content
     char *url; //!< the url used to access the server
Index: /branches/prototype-v0/zoo-project/zoo-kernel/zoo_service_loader.c
===================================================================
--- /branches/prototype-v0/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 932)
+++ /branches/prototype-v0/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 933)
@@ -854,5 +854,5 @@
     char* filepath = kvp + strlen(key);
     strncpy(kvp, key, strlen(key));
-    addToCache(m, tmpReq->value, tmpReq->value, "text/xml", strlen(tmpReq->value), 
+    addToCache(m, tmpReq->value, tmpReq->value, (char*) "text/xml", strlen(tmpReq->value), 
 	       filepath, FILENAME_MAX);
     if (filepath == NULL) {
@@ -2001,4 +2001,6 @@
 #ifndef WIN32
 			    (LPCTSTR)
+#else
+          (char*)
 #endif
 			    "ZooWPSClient\0",
