]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hexdump: get rid of redundant typecasts
authorOndrej Oprala <ooprala@redhat.com>
Mon, 23 Sep 2013 13:39:31 +0000 (15:39 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 8 Nov 2013 12:51:19 +0000 (13:51 +0100)
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
text-utils/conv.c
text-utils/parse.c

index abb62d06de2e49c44d4ad27d35ded3685a748862..e17acc4fee922914a42aebb154251741dab5e817 100644 (file)
@@ -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);
        }
 }
index 810528b22148be396411a40219cd5091da506a1f..3098db4db92e78f5706670a4975864aee719c6fd 100644 (file)
@@ -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))
                                        ;
                        }