diff options
author | Daniel Stenberg <daniel@haxx.se> | 2011-04-20 00:48:20 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2011-04-20 00:50:07 +0200 |
commit | c828646f60b5bffb2bfcf924eba36da767bf08bf (patch) | |
tree | a13db5750b3927a2dea67364fbafba4b91fa7e9f /lib/http_chunks.c | |
parent | eb65a49befa040746b222e693bba19ee56814e85 (diff) | |
download | curl-c828646f60b5bffb2bfcf924eba36da767bf08bf.tar.gz |
CURL_DOES_CONVERSIONS: cleanup
Massively reduce #ifdefs all over (23 #ifdef lines less so far)
Moved conversion-specific code to non-ascii.c
Diffstat (limited to 'lib/http_chunks.c')
-rw-r--r-- | lib/http_chunks.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/http_chunks.c b/lib/http_chunks.c index e955b945e..821a861f4 100644 --- a/lib/http_chunks.c +++ b/lib/http_chunks.c @@ -35,7 +35,7 @@ #include "content_encoding.h" #include "http.h" #include "curl_memory.h" -#include "easyif.h" /* for Curl_convert_to_network prototype */ +#include "non-ascii.h" /* for Curl_convert_to_network prototype */ #define _MPRINTF_REPLACE /* use our functions only */ #include <curl/mprintf.h> @@ -153,17 +153,16 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn, } /* length and datap are unmodified */ ch->hexbuffer[ch->hexindex]=0; -#ifdef CURL_DOES_CONVERSIONS + /* convert to host encoding before calling strtoul */ - result = Curl_convert_from_network(conn->data, - ch->hexbuffer, + result = Curl_convert_from_network(conn->data, ch->hexbuffer, ch->hexindex); - if(result != CURLE_OK) { + if(result) { /* Curl_convert_from_network calls failf if unsuccessful */ /* Treat it as a bad hex character */ return(CHUNKE_ILLEGAL_HEX); } -#endif /* CURL_DOES_CONVERSIONS */ + ch->datasize=strtoul(ch->hexbuffer, NULL, 16); ch->state = CHUNK_POSTHEX; } @@ -297,17 +296,14 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn, conn->trailer[conn->trlPos++]=0x0a; conn->trailer[conn->trlPos]=0; -#ifdef CURL_DOES_CONVERSIONS /* Convert to host encoding before calling Curl_client_write */ - result = Curl_convert_from_network(conn->data, - conn->trailer, + result = Curl_convert_from_network(conn->data, conn->trailer, conn->trlPos); - if(result != CURLE_OK) + if(result) /* Curl_convert_from_network calls failf if unsuccessful */ /* Treat it as a bad chunk */ return CHUNKE_BAD_CHUNK; -#endif /* CURL_DOES_CONVERSIONS */ if(!data->set.http_te_skip) { result = Curl_client_write(conn, CLIENTWRITE_HEADER, conn->trailer, conn->trlPos); |