X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fmodules%2Fswfcgi.c;h=21ca7ff8eef59013cb0fa3f7b661315b5a9ad7ed;hb=6c3ab5574d31504d24710c2756899d49275c1a37;hp=a1656e5087b0fe86f91efdc015d759ceeae07a9a;hpb=aee9de2c6eb23628e54b6896f5b441d9b39317c1;p=swftools.git diff --git a/lib/modules/swfcgi.c b/lib/modules/swfcgi.c index a1656e5..21ca7ff 100644 --- a/lib/modules/swfcgi.c +++ b/lib/modules/swfcgi.c @@ -69,15 +69,15 @@ static void swf_cgienv(unsigned char * var) // fprintf(stderr,"%s\n",var); - buf = (unsigned char*)malloc(strlen(var) + sizeof(PREFIX) + 2); + buf = (unsigned char*)rfx_alloc(strlen((const char*)var) + sizeof(PREFIX) + 2); if (!buf) return; - strcpy(buf, PREFIX); + strcpy((char*)buf, (const char*)PREFIX); if (var[0] == '_') - { strcpy(&buf[sizeof(PREFIX)-1], &var[1]); + { strcpy((char*)&buf[sizeof(PREFIX)-1], (const char*)&var[1]); despace = 1; } - else strcpy(&buf[sizeof(PREFIX)-1], var); + else strcpy((char*)&buf[sizeof(PREFIX)-1], (const char*)var); for (c = buf; c[0] ; c++) { if (c[0] == '.') c[0] = '_'; @@ -106,26 +106,26 @@ static void swf_cgienv(unsigned char * var) t[1] = 0; } - if ((oldval = getenv(buf))) - { newval = (unsigned char*)malloc(strlen(oldval) + strlen(buf) + strlen(&c[1]) + 3); + if ((oldval = (unsigned char*)getenv((const char*)buf))) + { newval = (unsigned char*)rfx_alloc(strlen((const char*)oldval) + strlen((const char *)buf) + strlen((const char*)&c[1]) + 3); if (!newval) return; c[0] = '='; - sprintf(newval, "%s#%s", buf, oldval); + sprintf((char*)newval, "%s#%s", buf, oldval); c[0] = 0; - oldval -= strlen(buf) + 1; // skip past VAR= + oldval -= strlen((const char*)buf) + 1; // skip past VAR= } else { c[0] = '='; newval = buf; } - putenv(newval); + putenv((const char *)newval); if (oldval) - { free(oldval); - free(buf); + { rfx_free(oldval); + rfx_free(buf); } } @@ -136,7 +136,7 @@ static void swf_scanquery(char * q) while (next) { next = strchr(q, '&'); if (next) next[0] = 0; - swf_cgienv(q); + swf_cgienv((unsigned char*)q); if (next) { next[0] = '&'; q = next+1; @@ -155,7 +155,7 @@ char * swf_postread() if (!buf) return NULL; size = atoi(buf); - buf = (unsigned char*)malloc(size + 1); + buf = (char*)rfx_alloc(size + 1); if (buf) { do { got = fread(buf + sofar, 1, size - sofar, stdin); @@ -174,14 +174,14 @@ void swf_uncgi() if ((query) && strlen(query)) { dupquery = strdup(query); swf_scanquery(dupquery); - free(dupquery); + rfx_free(dupquery); } method = getenv("REQUEST_METHOD"); if ((method) && ! strcmp(method, "POST")) { query = swf_postread(); if ((query)&&(query[0]!=0)) swf_scanquery(query); - free(query); + rfx_free(query); } }