aboutsummaryrefslogtreecommitdiff
path: root/tests/server/getpart.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2008-10-02 14:44:18 +0000
committerYang Tse <yangsita@gmail.com>2008-10-02 14:44:18 +0000
commit9cea2dfb8fc65868d054a87041feb6f778918fc3 (patch)
tree2a28ea82053ade1420659f70356ddf520c335611 /tests/server/getpart.c
parent00dec36c725a0ce934ab0668ac8cb9822557c606 (diff)
fix compiler warning: dereferencing type-punned pointer will break strict-aliasing rules
Diffstat (limited to 'tests/server/getpart.c')
-rw-r--r--tests/server/getpart.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/tests/server/getpart.c b/tests/server/getpart.c
index d32f480d2..1a2a3ca12 100644
--- a/tests/server/getpart.c
+++ b/tests/server/getpart.c
@@ -61,14 +61,20 @@ char *appendstring(char *string, /* original string */
size_t *stralloc, /* allocated size */
char base64) /* 1 if base64 encoded */
{
+ union {
+ unsigned char * as_uchar;
+ char * as_char;
+ } buf64;
+
size_t len = strlen(buffer);
size_t needed_len = len + *stringlen + 1;
- char *buf64=NULL;
+
+ buf64.as_char = NULL;
if(base64) {
/* decode the given buffer first */
- len = Curl_base64_decode(buffer, (unsigned char**)&buf64); /* updated len */
- buffer = buf64;
+ len = Curl_base64_decode(buffer, &buf64.as_uchar); /* updated len */
+ buffer = buf64.as_char;
needed_len = len + *stringlen + 1; /* recalculate */
}
@@ -82,8 +88,8 @@ char *appendstring(char *string, /* original string */
*stralloc = newsize;
}
else {
- if(buf64)
- free(buf64);
+ if(buf64.as_char)
+ free(buf64.as_char);
return NULL;
}
}
@@ -92,8 +98,8 @@ char *appendstring(char *string, /* original string */
*stringlen += len;
string[*stringlen]=0;
- if(buf64)
- free(buf64);
+ if(buf64.as_char)
+ free(buf64.as_char);
return string;
}