diff options
author | Patrick Monnerat <patrick@monnerat.net> | 2019-02-16 02:04:24 +0100 |
---|---|---|
committer | Patrick Monnerat <patrick@monnerat.net> | 2019-02-16 02:04:24 +0100 |
commit | 188036ca58e63443f4430e035f5c535dce772e40 (patch) | |
tree | 285c1d1582ea74594cf83a97cf67a69d0847fb0f /src/tool_convert.c | |
parent | c52620c249c47a7a916435647155abf4bbfd8018 (diff) | |
download | curl-188036ca58e63443f4430e035f5c535dce772e40.tar.gz |
cli tool: refactor encoding conversion sequence for switch case fallthrough.
Diffstat (limited to 'src/tool_convert.c')
-rw-r--r-- | src/tool_convert.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/tool_convert.c b/src/tool_convert.c index ec9d7ac7c..3969130c1 100644 --- a/src/tool_convert.c +++ b/src/tool_convert.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -122,15 +122,13 @@ char convert_char(curl_infotype infotype, char this_char) case CURLINFO_SSL_DATA_IN: case CURLINFO_SSL_DATA_OUT: /* data, treat as ASCII */ - if((this_char >= 0x20) && (this_char < 0x7f)) { - /* printable ASCII hex value: convert to host encoding */ - (void)convert_from_network(&this_char, 1); - } - else { + if(this_char < 0x20 || this_char >= 0x7f) { /* non-printable ASCII, use a replacement character */ return UNPRINTABLE_CHAR; } - /* fall through to default */ + /* printable ASCII hex value: convert to host encoding */ + (void)convert_from_network(&this_char, 1); + /* FALLTHROUGH */ default: /* treat as host encoding */ if(ISPRINT(this_char) |