Index: trunk/zoo-project/zoo-kernel/service_internal.c
===================================================================
--- trunk/zoo-project/zoo-kernel/service_internal.c	(revision 578)
+++ trunk/zoo-project/zoo-kernel/service_internal.c	(revision 579)
@@ -1,3 +1,3 @@
-/**
+/*
  * Author : Gérald FENOY
  *
@@ -43,4 +43,12 @@
 #define ERROR_MSG_MAX_LENGTH 1024
 
+/**
+ * Verify if a given language is listed in the lang list defined in the [main] 
+ * section of the main.cfg file.
+ * 
+ * @param conf the map containing the settings from the main.cfg file
+ * @param str the specific language
+ * @return 1 if the specific language is listed, -1 in other case.
+ */
 int isValidLang(maps* conf,const char *str){
   map *tmpMap=getMapFromMaps(conf,"main","lang");
@@ -59,4 +67,9 @@
 }
 
+/**
+ * Print the HTTP headers based on a map.
+ * 
+ * @param m the map containing the headers informations
+ */
 void printHeaders(maps* m){
   maps *_tmp=getMaps(m,"headers");
@@ -70,4 +83,10 @@
 }
 
+/**
+ * Add a land attribute to a XML node
+ *
+ * @param n the XML node to add the attribute
+ * @param m the map containing the language key to add as xml:lang
+ */
 void addLangAttr(xmlNodePtr n,maps *m){
   map *tmpLmap=getMapFromMaps(m,"main","language");
@@ -78,10 +97,20 @@
 }
 
-/* Converts a hex character to its integer value */
+/**
+ * Converts a hex character to its integer value 
+ *
+ * @param ch the char to convert
+ * @return the converted char 
+ */
 char from_hex(char ch) {
   return isdigit(ch) ? ch - '0' : tolower(ch) - 'a' + 10;
 }
 
-/* Converts an integer value to its hex character*/
+/**
+ * Converts an integer value to its hec character 
+ *
+ * @param code the char to convert
+ * @return the converted char 
+ */
 char to_hex(char code) {
   static char hex[] = "0123456789abcdef";
@@ -89,4 +118,11 @@
 }
 
+/**
+ * Get the ongoing status of a running service 
+ *
+ * @param conf the maps containing the setting of the main.cfg file
+ * @param pid the service identifier (usid key from the [lenv] section)
+ * @return the reported status char* (MESSAGE|POURCENTAGE)
+ */
 char* _getStatus(maps* conf,int pid){
   char lid[1024];
@@ -131,8 +167,7 @@
 
 size_t getKeyValue(maps* conf, char* key, size_t length){
-  
   if(conf==NULL) {
-	 strncpy(key, "700666", length);
-	 return strlen(key);
+    strncpy(key, "700666", length);
+    return strlen(key);
   }
   
@@ -148,5 +183,7 @@
   }
   return strlen(key);
-} 
+}
+
+
 semid getShmLockId(maps* conf, int nsems){
     semid sem_id;
@@ -336,5 +373,8 @@
 
 #else
-
+/**
+ * Number of time to try to access a semaphores set
+ * @see getShmLockId
+ */
 #define MAX_RETRIES 10
 
@@ -347,4 +387,10 @@
 #endif
 
+/**
+ * Set in the pre-allocated key the zoo_sem_[SID] string 
+ * where [SID] is the lid (if any) or usid value from the [lenv] section.
+ *
+ * @param conf the map containing the setting of the main.cfg file
+ */
 int getKeyValue(maps* conf){
   if(conf==NULL)
@@ -359,4 +405,12 @@
 }
 
+/**
+ * Try to create or access a semaphore set.
+ *
+ * @see getKeyValue
+ * @param conf the map containing the setting of the main.cfg file
+ * @param nsems number of semaphores
+ * @return a semaphores set indentifier on success, -1 in other case
+ */
 int getShmLockId(maps* conf, int nsems){
     int i;
@@ -422,4 +476,11 @@
 }
 
+/**
+ * Try to remove a semaphore set.
+ *
+ * @param conf the map containing the setting of the main.cfg file
+ * @param nsems number of semaphores
+ * @return 0 if the semaphore can be removed, -1 in other case.
+ */
 int removeShmLock(maps* conf, int nsems){
   union semun arg;
@@ -432,4 +493,10 @@
 }
 
+/**
+ * Lock a semaphore set.
+ *
+ * @param id the semaphores set indetifier
+ * @return 0 if the semaphore can be locked, -1 in other case.
+ */
 int lockShm(int id){
   struct sembuf sb;
@@ -444,4 +511,10 @@
 }
 
+/**
+ * unLock a semaphore set.
+ *
+ * @param id the semaphores set indetifier
+ * @return 0 if the semaphore can be locked, -1 in other case.
+ */
 int unlockShm(int id){
   struct sembuf sb;
@@ -456,4 +529,9 @@
 }
 
+/**
+ * Stop handling status repport.
+ *
+ * @param conf the map containing the setting of the main.cfg file
+ */
 void unhandleStatus(maps *conf){
   int shmid;
@@ -481,4 +559,11 @@
 }
 
+/**
+ * Update the current of the running service.
+ *
+ * @see getKeyValue, getShmLockId, lockShm
+ * @param conf the map containing the setting of the main.cfg file
+ * @return 0 on success, -2 if shmget failed, -1 if shmat failed
+ */
 int _updateStatus(maps *conf){
   int shmid;
@@ -528,4 +613,11 @@
 }
 
+/**
+ * Update the current of the running service.
+ *
+ * @see getKeyValue, getShmLockId, lockShm
+ * @param pid the semaphores 
+ * @return 0 on success, -2 if shmget failed, -1 if shmat failed
+ */
 char* getStatus(int pid){
   int shmid;
@@ -594,7 +686,11 @@
 
 
-
-/* Returns a url-encoded version of str */
-/* IMPORTANT: be sure to free() the returned string after use */
+/**
+ * URLEncode an url
+ *
+ * @param str the url to encode
+ * @return a url-encoded version of str
+ * @warning be sure to free() the returned string after use
+ */
 char *url_encode(char *str) {
   char *pstr = str, *buf = (char*) malloc(strlen(str) * 3 + 1), *pbuf = buf;
@@ -612,6 +708,11 @@
 }
 
-/* Returns a url-decoded version of str */
-/* IMPORTANT: be sure to free() the returned string after use */
+/**
+ * Decode an URLEncoded url
+ *
+ * @param str the URLEncoded url to decode
+ * @return a url-decoded version of str
+ * @warning be sure to free() the returned string after use
+ */
 char *url_decode(char *str) {
   char *pstr = str, *buf = (char*) malloc(strlen(str) + 1), *pbuf = buf;
@@ -633,4 +734,11 @@
 }
 
+/**
+ * Replace the first letter by its upper case version in a new char array
+ *
+ * @param tmp the char*
+ * @return a new char* with first letter in upper case
+ * @warning be sure to free() the returned string after use
+ */
 char *zCapitalize1(char *tmp){
   char *res=zStrdup(tmp);
@@ -640,4 +748,11 @@
 }
 
+/**
+ * Replace all letters by their upper case version in a new char array
+ *
+ * @param tmp the char*
+ * @return a new char* with first letter in upper case
+ * @warning be sure to free() the returned string after use
+ */
 char *zCapitalize(char *tmp){
   int i=0;
@@ -649,5 +764,10 @@
 }
 
-
+/**
+ * Search for an existing XML namespace in usedNS.
+ * 
+ * @param name the name of the XML namespace to search
+ * @return the index of the XML namespace found or -1 if not found.
+ */
 int zooXmlSearchForNs(const char* name){
   int i;
@@ -661,4 +781,12 @@
 }
 
+/**
+ * Add an XML namespace to the usedNS if it was not already used.
+ * 
+ * @param nr the xmlNodePtr to attach the XML namspace (can be NULL)
+ * @param url the url of the XML namespace to add
+ * @param name the name of the XML namespace to add
+ * @return the index of the XML namespace added.
+ */
 int zooXmlAddNs(xmlNodePtr nr,const char* url,const char* name){
 #ifdef DEBUG
@@ -683,4 +811,7 @@
 }
 
+/**
+ * Free allocated memory to store used XML namespace.
+ */
 void zooXmlCleanupNs(){
   int j;
@@ -700,5 +831,10 @@
 }
 
-
+/**
+ * Add a XML document to the iDocs.
+ * 
+ * @param value the string containing the XML document
+ * @return the index of the XML document added.
+ */
 int zooXmlAddDoc(const char* value){
   int currId=0;
@@ -709,4 +845,7 @@
 }
 
+/**
+ * Free allocated memort to store XML documents
+ */
 void zooXmlCleanupDocs(){
   int j;
@@ -716,9 +855,4 @@
   nbDocs=0;
 }
-
-
-/************************************************************************/
-/*                             soapEnvelope()                           */
-/************************************************************************/
 
 /**
@@ -755,8 +889,4 @@
 }
 
-/************************************************************************/
-/*                            printWPSHeader()                          */
-/************************************************************************/
-
 /**
  * Generate a WPS header.
@@ -794,8 +924,4 @@
   return n;
 }
-
-/************************************************************************/
-/*                     printGetCapabilitiesHeader()                     */
-/************************************************************************/
 
 /**
@@ -1095,5 +1221,11 @@
 }
 
-
+/**
+ * Add prefix to the service name.
+ * 
+ * @param conf the conf maps containing the main.cfg settings
+ * @param level the map containing the level information
+ * @param serv the service structure created from the zcfg file
+ */
 void addPrefix(maps* conf,map* level,service* serv){
   if(level!=NULL){
@@ -1128,4 +1260,12 @@
 }
 
+/**
+ * Generate a wps:Process node for a servie and add it to a given node.
+ * 
+ * @param m the conf maps containing the main.cfg settings
+ * @param nc the XML node to add the Process node
+ * @param serv the service structure created from the zcfg file
+ * @return the generated wps:ProcessOfferings xmlNodePtr 
+ */
 void printGetCapabilitiesForProcess(maps* m,xmlNodePtr nc,service* serv){
   xmlNsPtr ns,ns_ows,ns_xlink;
@@ -1161,4 +1301,12 @@
 }
 
+/**
+ * Generate a ProcessDescription node for a servie and add it to a given node.
+ * 
+ * @param m the conf maps containing the main.cfg settings
+ * @param nc the XML node to add the Process node
+ * @param serv the servive structure created from the zcfg file
+ * @return the generated wps:ProcessOfferings xmlNodePtr 
+ */
 void printDescribeProcessForProcess(maps* m,xmlNodePtr nc,service* serv){
   xmlNsPtr ns,ns_ows,ns_xlink;
@@ -1230,4 +1378,14 @@
 }
 
+/**
+ * Generate the required XML tree for the detailled metadata informations of 
+ * inputs or outputs
+ *
+ * @param in 1 in case of inputs, 0 for outputs
+ * @param elem the elements structure containing the metadata informations
+ * @param type the name ("Input" or "Output") of the XML node to create
+ * @param ns_ows the ows XML namespace
+ * @param nc1 the XML node to use to add the created tree
+ */
 void printFullDescription(int in,elements *elem,const char* type,xmlNsPtr ns_ows,xmlNodePtr nc1){
   const char *orderedFields[13];
@@ -1686,4 +1844,16 @@
 }
 
+/**
+ * Generate a wps:Execute XML document.
+ * 
+ * @param m the conf maps containing the main.cfg settings
+ * @param request the map representing the HTTP request
+ * @param pid the process identifier linked to a service
+ * @param serv the serv structure created from the zcfg file
+ * @param service the service name
+ * @param status the status returned by the service
+ * @param inputs the inputs provided
+ * @param outputs the outputs generated by the service
+ */
 void printProcessResponse(maps* m,map* request, int pid,service* serv,const char* service,int status,maps* inputs,maps* outputs){
   xmlNsPtr ns,ns_ows,ns_xlink;
@@ -1966,5 +2136,11 @@
 }
 
-
+/**
+ * Print a XML document.
+ * 
+ * @param m the conf maps containing the main.cfg settings
+ * @param doc the XML document
+ * @param pid the process identifier linked to a service
+ */
 void printDocument(maps* m, xmlDocPtr doc,int pid){
   char *encoding=getEncoding(m);
@@ -1992,4 +2168,15 @@
 }
 
+/**
+ * Print a XML document.
+ * 
+ * @param doc the XML document (unused)
+ * @param nc the XML node to add the output definition
+ * @param ns_wps the wps XML namespace
+ * @param ns_ows the ows XML namespace
+ * @param e the output elements 
+ * @param m the conf maps containing the main.cfg settings
+ * @param type the type (unused)
+ */
 void printOutputDefinitions(xmlDocPtr doc,xmlNodePtr nc,xmlNsPtr ns_wps,xmlNsPtr ns_ows,elements* e,maps* m,const char* type){
   xmlNodePtr nc1;
@@ -2024,4 +2211,16 @@
 }
 
+/**
+ * Generate XML nodes describing inputs or outputs metadata.
+ * 
+ * @param doc the XML document 
+ * @param nc the XML node to add the definition
+ * @param ns_wps the wps namespace
+ * @param ns_ows the ows namespace
+ * @param ns_xlink the xlink namespace
+ * @param e the output elements 
+ * @param m the conf maps containing the main.cfg settings
+ * @param type the type
+ */
 void printIOType(xmlDocPtr doc,xmlNodePtr nc,xmlNsPtr ns_wps,xmlNsPtr ns_ows,xmlNsPtr ns_xlink,elements* e,maps* m,const char* type){
   xmlNodePtr nc1,nc2,nc3;
@@ -2258,4 +2457,12 @@
 }
 
+/**
+ * Create XML node with basic ows metadata informations (Identifier,Title,Abstract)
+ *
+ * @param root the root XML node to add the description
+ * @param ns_ows the ows XML namespace
+ * @param identifier the identifier to use
+ * @param amap the map containing the ows metadata informations 
+ */
 void printDescription(xmlNodePtr root,xmlNsPtr ns_ows,const char* identifier,map* amap){
   xmlNodePtr nc2 = xmlNewNode(ns_ows, BAD_CAST "Identifier");
@@ -2278,4 +2485,11 @@
 }
 
+/**
+ * Access the value of the encoding key in a maps
+ *
+ * @param m the maps to search for the encoding key
+ * @return the value of the encoding key in a maps if encoding key exists,
+ *  "UTF-8" in other case.
+ */
 char* getEncoding(maps* m){
   if(m!=NULL){
@@ -2291,4 +2505,11 @@
 }
 
+/**
+ * Access the value of the version key in a maps
+ *
+ * @param m the maps to search for the version key
+ * @return the value of the version key in a maps if encoding key exists,
+ *  "1.0.0" in other case.
+ */
 char* getVersion(maps* m){
   if(m!=NULL){
@@ -2304,8 +2525,4 @@
 }
 
-/************************************************************************/
-/*                    printExceptionReportResponse()                    */
-/************************************************************************/
-
 /**
  * Print an OWS ExceptionReport Document and HTTP headers (when required) 
@@ -2313,5 +2530,5 @@
  * Set hasPrinted value to true in the [lenv] section.
  * 
- * @param m the conf maps
+ * @param m the maps containing the settings of the main.cfg file
  * @param s the map containing the text,code,locator keys
  */
@@ -2375,8 +2592,4 @@
     setMapInMaps(m,"lenv","hasPrinted","true");
 }
-
-/************************************************************************/
-/*                      createExceptionReportNode()                     */
-/************************************************************************/
 
 /**
@@ -2448,8 +2661,4 @@
 }
 
-/************************************************************************/
-/*                           errorException()                           */
-/************************************************************************/
-
 /**
  * Print an OWS ExceptionReport.
@@ -2474,8 +2683,4 @@
 }
 
-/************************************************************************/
-/*                          readGeneratedFile()                         */
-/************************************************************************/
-
 /**
  * Read a file generated by a service.
@@ -2511,4 +2716,15 @@
 }
 
+/**
+ * Generate the output response (RawDataOutput or ResponseDocument)
+ *
+ * @param s the service structure containing the metadata informations
+ * @param request_inputs the inputs provided to the service for execution
+ * @param request_outputs the outputs updated by the service execution
+ * @param request_inputs1 the map containing the HTTP request
+ * @param cpid the process identifier attached to a service execution
+ * @param m the conf maps containing the main.cfg settings
+ * @param res the value returned by the service execution
+ */
 void outputResponse(service* s,maps* request_inputs,maps* request_outputs,
 		    map* request_inputs1,int cpid,maps* m,int res){
@@ -2795,4 +3011,13 @@
 }
 
+
+/**
+ * Base64 encoding of a char*
+ *
+ * @param input the value to encode
+ * @param length the value length
+ * @return the buffer containing the base64 value
+ * @warning make sure to free the returned value
+ */
 char *base64(const char *input, int length)
 {
@@ -2817,4 +3042,13 @@
 }
 
+/**
+ * Base64 decoding of a char*
+ *
+ * @param input the value to decode
+ * @param length the value length
+ * @param red the value length
+ * @return the buffer containing the base64 value 
+ * @warning make sure to free the returned value
+ */
 char *base64d(const char *input, int length,int* red)
 {
@@ -2836,4 +3070,9 @@
 }
 
+/**
+ * Make sure that each value encoded in base64 in a maps is decoded.
+ *
+ * @param in the maps containing the values
+ */
 void ensureDecodedBase64(maps **in){
   maps* cursor=*in;
@@ -2856,4 +3095,17 @@
 }
 
+/**
+ * Add the default values defined in the zcfg to a maps.
+ *
+ * @param out the maps containing the inputs or outputs given in the initial
+ *  HTTP request
+ * @param in the description of all inputs or outputs available for a service
+ * @param m the maps containing the settings of the main.cfg file
+ * @param type 0 for inputs and 1 for outputs
+ * @param err the map to store potential missing mandatory input parameters or
+ *  wrong output names depending on the type.
+ * @return "" if no error was detected, the name of last input or output causing
+ *  an error.
+ */
 char* addDefaultValues(maps** out,elements* in,maps* m,int type,map** err){
   map *res=*err;
@@ -3095,12 +3347,14 @@
 
 /**
- * parseBoundingBox : parse a BoundingBox string
- *
- * OGC 06-121r3 : 10.2 Bounding box
- *
- * value is provided as : lowerCorner,upperCorner,crs,dimension
- * exemple : 189000,834000,285000,962000,urn:ogc:def:crs:OGC:1.3:CRS84
- *
- * Need to create a map to store boundingbox informations :
+ * Parse a BoundingBox string
+ *
+ * [OGC 06-121r3](http://portal.opengeospatial.org/files/?artifact_id=20040):
+ *  10.2 Bounding box
+ * 
+ *
+ * Value is provided as : lowerCorner,upperCorner,crs,dimension
+ * Exemple : 189000,834000,285000,962000,urn:ogc:def:crs:OGC:1.3:CRS84
+ *
+ * A map to store boundingbox informations should contain:
  *  - lowerCorner : double,double (minimum within this bounding box)
  *  - upperCorner : double,double (maximum within this bounding box)
@@ -3109,4 +3363,7 @@
  * 
  * Note : support only 2D bounding box.
+ *
+ * @param value the char* containing the KVP bouding box
+ * @return a map containing all the bounding box keys
  */
 map* parseBoundingBox(const char* value){
@@ -3156,7 +3413,9 @@
 
 /**
- * printBoundingBox : fill a BoundingBox node (ows:BoundingBox or 
- * wps:BoundingBoxData). Set crs and dimensions attributes, add 
- * Lower/UpperCorner nodes to a pre-existing XML node.
+ * Create required XML nodes for boundingbox and update the current XML node
+ *
+ * @param ns_ows the ows XML namespace
+ * @param n the XML node to update
+ * @param boundingbox the map containing the boundingbox definition
  */
 void printBoundingBox(xmlNsPtr ns_ows,xmlNodePtr n,map* boundingbox){
@@ -3191,4 +3450,12 @@
 }
 
+/**
+ * Print an ows:BoundingBox XML document
+ *
+ * @param m the maps containing the settings of the main.cfg file
+ * @param boundingbox the maps containing the boundingbox definition
+ * @param file the file to print the BoundingBox (if NULL then print on stdout)
+ * @see parseBoundingBox, printBoundingBox
+ */
 void printBoundingBoxDocument(maps* m,maps* boundingbox,FILE* file){
   if(file==NULL)
@@ -3243,5 +3510,11 @@
 }
 
-
+/**
+ * Compute md5
+ * 
+ * @param url the char* 
+ * @return a char* representing the md5 of the url
+ * @warning make sure to free ressources returned by this function
+ */
 char* getMd5(char* url){
   EVP_MD_CTX md5ctx;
@@ -3267,5 +3540,13 @@
 
 /**
- * Cache a file for a given request
+ * Cache a file for a given request.
+ * For each cached file, the are two files stored, a .zca and a .zcm containing
+ * the downloaded content and the mimeType respectively. 
+ *
+ * @param conf the maps containing the settings of the main.cfg file
+ * @param request the url used too fetch the content
+ * @param content the downloaded content
+ * @param mimeType the content mimeType 
+ * @param length the content size
  */
 void addToCache(maps* conf,char* request,char* content,char* mimeType,int length){
@@ -3300,4 +3581,12 @@
 }
 
+/**
+ * Verify if a url is available in the cache
+ *
+ * @param conf the maps containing the settings of the main.cfg file
+ * @param request the url
+ * @return the full name of the cached file if any, NULL in other case
+ * @warning make sure to free ressources returned by this function (if not NULL)
+ */
 char* isInCache(maps* conf,char* request){
   map* tmpM=getMapFromMaps(conf,"main","cacheDir");
@@ -3321,4 +3610,13 @@
 }
 
+/**
+ * Effectively run all the HTTP requests in the queue
+ *
+ * @param m the maps containing the settings of the main.cfg file
+ * @param inputs the maps containing the inputs (defined in the requests+added
+ *  per default based on the zcfg file)
+ * @param hInternet the HINTERNET pointer
+ * @return 0 on success
+ */
 int runHttpRequests(maps** m,maps** inputs,HINTERNET* hInternet){
   if(hInternet->nb>0){
@@ -3427,6 +3725,11 @@
 
 /**
- * loadRemoteFile:
  * Try to load file from cache or download a remote file if not in cache
+ *
+ * @param m the maps containing the settings of the main.cfg file
+ * @param content the map to update
+ * @param hInternet the HINTERNET pointer
+ * @param url the url to fetch
+ * @return 0
  */
 int loadRemoteFile(maps** m,map** content,HINTERNET* hInternet,char *url){
@@ -3523,4 +3826,11 @@
 }
 
+/**
+ * Read a file using the GDAL VSI API 
+ *
+ * @param conf the maps containing the settings of the main.cfg file
+ * @param dataSource the datasource name to read
+ * @warning make sure to free ressources returned by this function
+ */
 char *readVSIFile(maps* conf,const char* dataSource){
     VSILFILE * fichier=VSIFOpenL(dataSource,"rb");
@@ -3542,4 +3852,16 @@
 }
 
+/**
+ * Extract the service identifier from the full service identifier
+ * ie: 
+ *  - Full service name: OTB.BandMath
+ *  - Service name: BandMath
+ *
+ * @param conf the maps containing the settings of the main.cfg file
+ * @param conf_dir the full path to the ZOO-Kernel directory
+ * @param identifier the full service name (potentialy including a prefix, ie:
+ *  Prefix.MyService)
+ * @param buffer the resulting service identifier (without any prefix)
+ */
 void parseIdentifier(maps* conf,char* conf_dir,char *identifier,char* buffer){
   setMapInMaps(conf,"lenv","oIdentifier",identifier);
@@ -3607,4 +3929,13 @@
 }
 
+/**
+ * Update the status of an ongoing service 
+ *
+ * @param conf the maps containing the settings of the main.cfg file
+ * @param percentCompleted percentage of completude of execution of the service
+ * @param message information about the current step executed
+ * @return the value of _updateStatus
+ * @see _updateStatus
+ */
 int updateStatus( maps* conf, const int percentCompleted, const char* message ){
   char tmp[4];
@@ -3615,4 +3946,13 @@
 }
 
+/**
+ * Access an input value 
+ *
+ * @param inputs the maps to search for the input value
+ * @param parameterName the input name to fetch the value
+ * @param numberOfBytes the resulting size of the value to add (for binary
+ *  values), -1 for basic char* data
+ * @return a pointer to the input value if found, NULL in other case.
+ */
 char* getInputValue( maps* inputs, const char* parameterName, size_t* numberOfBytes){
   map* res=getMapFromMaps(inputs,parameterName,"value");
@@ -3630,4 +3970,14 @@
 }
 
+/**
+ * Set an output value 
+ *
+ * @param outputs the maps to define the output value
+ * @param parameterName the output name to set the value
+ * @param data the value to set
+ * @param numberOfBytes size of the value to add (for binary values), -1 for
+ *  basic char* data
+ * @return 0
+ */
 int  setOutputValue( maps* outputs, const char* parameterName, char* data, size_t numberOfBytes ){
   if(numberOfBytes==-1){
@@ -3649,8 +3999,4 @@
 }
 
-/************************************************************************/
-/*                           checkValidValue()                          */
-/************************************************************************/
-
 /**
  * Verify if a parameter value is valid.
@@ -3658,4 +4004,5 @@
  * @param request the request map
  * @param res the error map potentially generated
+ * @param toCheck the parameter to use
  * @param avalues the acceptable values (or null if testing only for presence)
  * @param mandatory verify the presence of the parameter if mandatory > 0 
@@ -3740,38 +4087,42 @@
 }
 
-/* 
- * The character string returned from getLastErrorMessage resides
+/**
+ * Access the last error message returned by the OS when trying to dynamically
+ * load a shared library.
+ *
+ * @return the last error message
+ * @warning The character string returned from getLastErrorMessage resides
  * in a static buffer. The application should not write to this
  * buffer or attempt to free() it.
  */ 
-char* getLastErrorMessage() {                                                                                                                                                    
-#ifdef WIN32	
-	LPVOID lpMsgBuf;
-	DWORD errCode = GetLastError();
-	static char msg[ERROR_MSG_MAX_LENGTH];
-	size_t i;
-
-	DWORD length = FormatMessage(
-					 FORMAT_MESSAGE_ALLOCATE_BUFFER | 
-					 FORMAT_MESSAGE_FROM_SYSTEM |
-					 FORMAT_MESSAGE_IGNORE_INSERTS,
-					 NULL,
-					 errCode,
-					 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-					 (LPTSTR) &lpMsgBuf,
-					 0, NULL );	
-	
-	#ifdef UNICODE		
-		wcstombs_s( &i, msg, ERROR_MSG_MAX_LENGTH,
-					(wchar_t*) lpMsgBuf, _TRUNCATE );
-	#else
-		strcpy_s( msg, ERROR_MSG_MAX_LENGTH,
-	              (char *) lpMsgBuf );		
-	#endif	
-	LocalFree(lpMsgBuf);
-	
-	return msg;
+char* getLastErrorMessage() {                                              
+#ifdef WIN32
+  LPVOID lpMsgBuf;
+  DWORD errCode = GetLastError();
+  static char msg[ERROR_MSG_MAX_LENGTH];
+  size_t i;
+  
+  DWORD length = FormatMessage(
+			       FORMAT_MESSAGE_ALLOCATE_BUFFER | 
+			       FORMAT_MESSAGE_FROM_SYSTEM |
+			       FORMAT_MESSAGE_IGNORE_INSERTS,
+			       NULL,
+			       errCode,
+			       MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+			       (LPTSTR) &lpMsgBuf,
+			       0, NULL );	
+  
+#ifdef UNICODE		
+  wcstombs_s( &i, msg, ERROR_MSG_MAX_LENGTH,
+	      (wchar_t*) lpMsgBuf, _TRUNCATE );
 #else
-	return dlerror();
-#endif
-}
+  strcpy_s( msg, ERROR_MSG_MAX_LENGTH,
+	    (char *) lpMsgBuf );		
+#endif	
+  LocalFree(lpMsgBuf);
+  
+  return msg;
+#else
+  return dlerror();
+#endif
+}
