X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=util%2Fhex-escape.c;h=81534a8cb95f0faec19a3661f98e9bd7ecde9f00;hp=b7e2e07aaa7d8d4e3aa692523ff7c7b6781b8404;hb=HEAD;hpb=902f2e19bdb649baee4e07cdb9cc9e7785f209b5 diff --git a/util/hex-escape.c b/util/hex-escape.c index b7e2e07a..81534a8c 100644 --- a/util/hex-escape.c +++ b/util/hex-escape.c @@ -13,7 +13,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see http://www.gnu.org/licenses/ . + * along with this program. If not, see https://www.gnu.org/licenses/ . * * Author: David Bremner */ @@ -25,8 +25,6 @@ #include "error_util.h" #include "hex-escape.h" -static const size_t default_buf_size = 1024; - static const char *output_charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-_@=.,"; @@ -74,7 +72,7 @@ hex_encode (void *ctx, const char *in, char **out, size_t *out_size) if (*out == NULL) *out_size = 0; - if (!maybe_realloc (ctx, needed, out, out_size)) + if (! maybe_realloc (ctx, needed, out, out_size)) return HEX_OUT_OF_MEMORY; q = *out; @@ -84,7 +82,7 @@ hex_encode (void *ctx, const char *in, char **out, size_t *out_size) if (is_output (*p)) { *q++ = *p++; } else { - sprintf (q, "%%%02x", (unsigned char)*p++); + sprintf (q, "%%%02x", (unsigned char) *p++); q += 3; } } @@ -107,8 +105,8 @@ hex_decode_internal (const char *in, unsigned char *out) char *endp; /* This also handles unexpected end-of-string. */ - if (!isxdigit ((unsigned char) in[1]) || - !isxdigit ((unsigned char) in[2])) + if (! isxdigit ((unsigned char) in[1]) || + ! isxdigit ((unsigned char) in[2])) return HEX_SYNTAX_ERROR; buf[0] = in[1]; @@ -141,10 +139,10 @@ hex_decode_inplace (char *s) } hex_status_t -hex_decode (void *ctx, const char *in, char **out, size_t * out_size) +hex_decode (void *ctx, const char *in, char **out, size_t *out_size) { const char *p; - size_t needed = 1; /* for the NUL */ + size_t needed = 1; /* for the NUL */ assert (ctx); assert (in); assert (out); assert (out_size); @@ -154,7 +152,7 @@ hex_decode (void *ctx, const char *in, char **out, size_t * out_size) else needed += 1; - if (!maybe_realloc (ctx, needed, out, out_size)) + if (! maybe_realloc (ctx, needed, out, out_size)) return HEX_OUT_OF_MEMORY; return hex_decode_internal (in, (unsigned char *) *out);