diff --git a/commandline.c b/commandline.c index faff07bd..c50b244b 100644 --- a/commandline.c +++ b/commandline.c @@ -121,9 +121,9 @@ static int app_echo(const struct cli_parsed *parsed, struct cli_context *context const char *arg = parsed->args[i]; DEBUGF(verbose, "echo:argv[%d]=\"%s\"", i, arg); if (escapes) { - unsigned char buf[strlen(arg)]; + char buf[strlen(arg)]; size_t len = strn_fromprint(buf, sizeof buf, arg, 0, '\0', NULL); - cli_write(context, (char *)buf, len); + cli_write(context, buf, len); } else cli_puts(context, arg); cli_delim(context, NULL); diff --git a/keyring.c b/keyring.c index 2b568339..1e348290 100644 --- a/keyring.c +++ b/keyring.c @@ -744,7 +744,7 @@ static int load_did_name(keypair *kp, const char *text) return WHY("duplicate DID"); const char *e = NULL; bzero(kp->private_key, kp->private_key_len); - strn_fromprint(kp->private_key, kp->private_key_len, t, 0, '"', &e); + strn_fromprint((char *)kp->private_key, kp->private_key_len, t, 0, '"', &e); if (*e != '"') return WHY("malformed DID quoted string"); t = e + 1; @@ -754,7 +754,7 @@ static int load_did_name(keypair *kp, const char *text) return WHY("duplicate Name"); const char *e = NULL; bzero(kp->public_key, kp->public_key_len); - strn_fromprint(kp->public_key, kp->public_key_len, t, 0, '"', &e); + strn_fromprint((char *)kp->public_key, kp->public_key_len, t, 0, '"', &e); if (*e != '"') return WHY("malformed Name quoted string"); t = e + 1; diff --git a/str.c b/str.c index ed9e42a2..1ce54094 100644 --- a/str.c +++ b/str.c @@ -521,10 +521,10 @@ size_t toprint_str_len(const char *srcStr, const char quotes[2]) return srcStr ? strbuf_count(strbuf_toprint_quoted(strbuf_local(NULL, 0), quotes, srcStr)) : 4; } -size_t strn_fromprint(unsigned char *dst, size_t dstsiz, const char *src, size_t srclen, char endquote, const char **afterp) +size_t strn_fromprint(char *dst, size_t dstsiz, const char *src, size_t srclen, char endquote, const char **afterp) { - unsigned char *const odst = dst; - unsigned char *const edst = dst + dstsiz; + char *const odst = dst; + char *const edst = dst + dstsiz; const char *const esrc = srclen ? src + srclen : NULL; while ((src < esrc || !esrc) && *src && *src != endquote && dst < edst) { switch (*src) { diff --git a/str.h b/str.h index e85bb164..2dc521d0 100644 --- a/str.h +++ b/str.h @@ -235,7 +235,7 @@ char *toprint(char *dstStr, ssize_t dstBufSiz, const char *srcBuf, size_t srcByt char *toprint_str(char *dstStr, ssize_t dstBufSiz, const char *srcStr, const char quotes[2]); size_t toprint_len(const char *srcBuf, size_t srcBytes, const char quotes[2]); size_t toprint_str_len(const char *srcStr, const char quotes[2]); -size_t strn_fromprint(unsigned char *dst, size_t dstsiz, const char *src, size_t srclen, char endquote, const char **afterp); +size_t strn_fromprint(char *dst, size_t dstsiz, const char *src, size_t srclen, char endquote, const char **afterp); #define alloca_toprint_quoted(dstsiz,buf,len,quotes) toprint((char *)alloca((dstsiz) == -1 ? toprint_len((const char *)(buf),(len), (quotes)) + 1 : (size_t)(dstsiz)), (size_t)(dstsiz), (const char *)(buf), (len), (quotes)) #define alloca_toprint(dstsiz,buf,len) alloca_toprint_quoted(dstsiz,buf,len,"``")