From: "Brian Norris" <computersforpeace@gmail.com>
To: linux-mtd@lists.infradead.org
Cc: Brian Norris <computersforpeace@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
Mike Frysinger <vapier.adi@gmail.com>,
Artem Bityutskiy <dedekind1@gmail.com>
Subject: [PATCH 4/8] nanddump: change "unsigned" to "signed"
Date: Mon, 29 Nov 2010 00:01:58 -0800 [thread overview]
Message-ID: <1291017722-23985-4-git-send-email-computersforpeace@gmail.com> (raw)
In-Reply-To: <1291017722-23985-1-git-send-email-computersforpeace@gmail.com>
For consistency between nanddump and nandwrite and in order to provide
better means for checking for negative inputs, the "offset" and "length"
types in nanddump should be changed to signed integer types. This also
solves a signed/unsigned comparison warning.
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
nanddump.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/nanddump.c b/nanddump.c
index 14a8816..b0dd7dc 100644
--- a/nanddump.c
+++ b/nanddump.c
@@ -82,8 +82,8 @@ static bool pretty_print = false; // print nice
static bool noecc = false; // don't error correct
static bool noskipbad = false; // don't skip bad blocks
static bool omitoob = false; // omit oob data
-static unsigned long long start_addr; // start address
-static unsigned long long length; // dump length
+static long long start_addr; // start address
+static long long length; // dump length
static const char *mtddev; // mtd device name
static const char *dumpfile; // dump file name
static bool omitbad = false;
@@ -136,7 +136,7 @@ static void process_options(int argc, char * const argv[])
omitbad = true;
break;
case 's':
- start_addr = simple_strtoull(optarg, &error);
+ start_addr = simple_strtoll(optarg, &error);
break;
case 'f':
if (!(dumpfile = strdup(optarg))) {
@@ -145,7 +145,7 @@ static void process_options(int argc, char * const argv[])
}
break;
case 'l':
- length = simple_strtoull(optarg, &error);
+ length = simple_strtoll(optarg, &error);
break;
case 'o':
omitoob = true;
@@ -273,8 +273,8 @@ nil:
*/
int main(int argc, char * const argv[])
{
- unsigned long long ofs, end_addr = 0;
- unsigned long long blockstart = 1;
+ long long ofs, end_addr = 0;
+ long long blockstart = 1;
int ret, i, fd, ofd = 0, bs, badblock = 0;
struct mtd_dev_info mtd;
char pretty_buf[PRETTY_BUF_LEN];
--
1.7.0.4
next prev parent reply other threads:[~2010-11-29 8:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-29 8:01 [PATCH 1/8] nanddump/nandwrite: use "simple_" str functions Brian Norris
2010-11-29 8:01 ` [PATCH 2/8] mtd-utils: common.h: Add MAX() macro, fix MIN() Brian Norris
2010-11-29 8:01 ` [PATCH 3/8] nanddump: Refactor pretty print code into an sprintf() Brian Norris
2010-11-29 8:01 ` Brian Norris [this message]
2010-11-29 8:01 ` [PATCH 5/8] nanddump: check for negative inputs Brian Norris
2010-12-01 6:18 ` [PATCH v2 " Brian Norris
2010-12-01 7:12 ` [PATCH v3 " Brian Norris
2010-11-29 8:02 ` [PATCH 6/8] nanddump: choose correct "printf" format-specifier Brian Norris
2010-11-29 8:02 ` [PATCH 7/8] nandwrite: add check for negative blockalign Brian Norris
2010-11-29 8:05 ` Mike Frysinger
2010-12-01 6:11 ` Brian Norris
2010-12-01 6:19 ` [PATCH v2 " Brian Norris
2010-11-29 8:02 ` [PATCH 8/8] nandwrite: use common.h "errmsg_die" Brian Norris
2010-12-01 6:20 ` [PATCH v2 " Brian Norris
2010-12-02 3:27 ` [PATCH 1/8] nanddump/nandwrite: use "simple_" str functions Artem Bityutskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1291017722-23985-4-git-send-email-computersforpeace@gmail.com \
--to=computersforpeace@gmail.com \
--cc=dedekind1@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=vapier.adi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.