From: Ondrej Oprala Date: Mon, 23 Sep 2013 13:39:31 +0000 (+0200) Subject: hexdump: get rid of redundant typecasts X-Git-Tag: v2.25-rc1~751 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cb986008310b702558c27f8ff4d0724446f7a9fd;p=thirdparty%2Futil-linux.git hexdump: get rid of redundant typecasts Signed-off-by: Ondrej Oprala --- diff --git a/text-utils/conv.c b/text-utils/conv.c index abb62d06de..e17acc4fee 100644 --- a/text-utils/conv.c +++ b/text-utils/conv.c @@ -76,7 +76,7 @@ conv_c(PR *pr, u_char *p) *pr->cchar = 'c'; printf(pr->fmt, *p); } else { - xasprintf(&buf, "%03o", (int)*p); + xasprintf(&buf, "%03o", *p); str = buf; strpr: *pr->cchar = 's'; printf(pr->fmt, str); @@ -106,6 +106,6 @@ conv_u(PR *pr, u_char *p) printf(pr->fmt, *p); } else { *pr->cchar = 'x'; - printf(pr->fmt, (int)*p); + printf(pr->fmt, *p); } } diff --git a/text-utils/parse.c b/text-utils/parse.c index 810528b221..3098db4db9 100644 --- a/text-utils/parse.c +++ b/text-utils/parse.c @@ -82,7 +82,7 @@ void addfile(char *name) void add(const char *fmt) { - const unsigned char *p, *savep; + const char *p, *savep; FS *tfs; FU *tfu; @@ -93,7 +93,7 @@ void add(const char *fmt) list_add_tail(&tfs->fslist, &fshead); /* Take the format string and break it up into format units. */ - p = (unsigned char *)fmt; + p = fmt; while (TRUE) { /* Skip leading white space. */ while (isspace(*p) && ++p) @@ -117,7 +117,7 @@ void add(const char *fmt) if (!isspace(*p) && *p != '/') badfmt(fmt); /* may overwrite either white space or slash */ - tfu->reps = atoi((char *)savep); + tfu->reps = atoi(savep); tfu->flags = F_SETREP; /* skip trailing white space */ while (isspace(*++p)) @@ -136,7 +136,7 @@ void add(const char *fmt) ; if (!isspace(*p)) badfmt(fmt); - tfu->bcnt = atoi((char *)savep); + tfu->bcnt = atoi(savep); /* skip trailing white space */ while (isspace(*++p)) ; @@ -151,7 +151,7 @@ void add(const char *fmt) badfmt(fmt); } tfu->fmt = xmalloc(p - savep + 1); - xstrncpy(tfu->fmt, (char *)savep, p - savep + 1); + xstrncpy(tfu->fmt, savep, p - savep + 1); escape(tfu->fmt); ++p; } @@ -163,7 +163,7 @@ int block_size(FS *fs) { FU *fu; int bcnt, prec, cursize = 0; - unsigned char *fmt; + char *fmt; struct list_head *p; /* figure out the data block size needed for each format unit */ @@ -174,7 +174,7 @@ int block_size(FS *fs) continue; } bcnt = prec = 0; - fmt = (unsigned char *)fu->fmt; + fmt = fu->fmt; while (*fmt) { if (*fmt != '%') { ++fmt; @@ -187,7 +187,7 @@ int block_size(FS *fs) while (strchr(spec + 1, *++fmt)) ; if (*fmt == '.' && isdigit(*++fmt)) { - prec = atoi((char *)fmt); + prec = atoi(fmt); while (isdigit(*++fmt)) ; }