[mapserver-commits] r12193 - trunk/mapserver/mapcache/src

svn at osgeo.org svn at osgeo.org
Fri Aug 26 07:05:54 EDT 2011


Author: tbonfort
Date: 2011-08-26 04:05:54 -0700 (Fri, 26 Aug 2011)
New Revision: 12193

Modified:
   trunk/mapserver/mapcache/src/http.c
Log:
add WMTS stub
thomas.bonfort | 2011-01-03 19:21:27 +0100 (Mon, 03 Jan 2011)

Modified: trunk/mapserver/mapcache/src/http.c
===================================================================
--- trunk/mapserver/mapcache/src/http.c	2011-08-26 11:05:49 UTC (rev 12192)
+++ trunk/mapserver/mapcache/src/http.c	2011-08-26 11:05:54 UTC (rev 12193)
@@ -33,11 +33,13 @@
    curl_handle = curl_easy_init();
    int ret;
    char error_msg[CURL_ERROR_SIZE];
+
+#ifdef DEBUG
+   ctx->log(ctx, GEOCACHE_DEBUG ,"##### START #####curl requesting url %s",url);
+#endif
    /* specify URL to get */
    curl_easy_setopt(curl_handle, CURLOPT_URL, url);
-#ifdef DEBUG
-   ctx->log(ctx, GEOCACHE_DEBUG, "##### START #####\ncurl requesting url %s",url);
-#endif
+
    /* send all data to this function  */ 
    curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, _geocache_curl_memory_callback);
 
@@ -67,7 +69,10 @@
 
 /* calculate the length of the string formed by key=value&, and add it to cnt */
 static APR_DECLARE_NONSTD(int) _geocache_key_value_strlen_callback(void *cnt, const char *key, const char *value) {
-   *((int*)cnt) += strlen(key) + ((value && *value) ? strlen(value)+2 : 1);
+   int valLength = 2;
+   if((value && *value))
+      valLength += strlen(value);
+   *((int*)cnt) += strlen(key) + valLength;
    return 1;
 }
 
@@ -75,8 +80,8 @@
 static APR_DECLARE_NONSTD(int) _geocache_key_value_append_callback(void *cnt, const char *key, const char *value) {
 #define _mystr *((char**)cnt)
    _mystr = apr_cpystrn(_mystr,key,MAX_STRING_LEN);
+   *((_mystr)++) = '=';
    if(value && *value) {
-      *((_mystr)++) = '=';
       _mystr = apr_cpystrn(_mystr,value,MAX_STRING_LEN);
    }
    *((_mystr)++) = '&';
@@ -161,9 +166,14 @@
       }
 
       /* add final \0 and eventual separator to add ('?' or '&') */
-      stringLength += baseLength + (charToAppend)?2:1;
+      stringLength += baseLength;
+      if(charToAppend) {
+         stringLength += 2;
+      } else {
+         stringLength += 1;
+      }
 
-      builtUrl = builtUrlPtr = apr_palloc(r->pool, stringLength);
+      builtUrl = builtUrlPtr = apr_pcalloc(r->pool, stringLength);
 
       builtUrlPtr = apr_cpystrn(builtUrlPtr,base,MAX_STRING_LEN);
       if(charToAppend)



More information about the mapserver-commits mailing list