linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd-utils: common.h: simple_strtoll type usage
@ 2011-02-16  1:47 Brian Norris
  2011-02-16  2:48 ` Mike Frysinger
  2011-02-25  8:49 ` Artem Bityutskiy
  0 siblings, 2 replies; 3+ messages in thread
From: Brian Norris @ 2011-02-16  1:47 UTC (permalink / raw)
  To: linux-mtd
  Cc: Kevin Cernekee, Brian Norris, David Woodhouse, Mike Frysinger,
	Artem Bityutskiy

We must use "long long" and "unsigned long long" types when
implementing the functions "simple_strtoll()" and "simple_strtoull()",
respectively. This prevents casting/truncation errors on systems where
"long" is not the same size as "long long" (that is, on most systems).

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 include/common.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/common.h b/include/common.h
index eb8d5fc..2e5c2a0 100644
--- a/include/common.h
+++ b/include/common.h
@@ -108,9 +108,9 @@ static inline type simple_##func(const char *snum, int *error) \
 	return ret; \
 }
 simple_strtoX(strtol, long int)
-simple_strtoX(strtoll, long int)
+simple_strtoX(strtoll, long long int)
 simple_strtoX(strtoul, unsigned long int)
-simple_strtoX(strtoull, unsigned long int)
+simple_strtoX(strtoull, unsigned long long int)
 
 #include "xalloc.h"
 
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-02-25  8:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-16  1:47 [PATCH] mtd-utils: common.h: simple_strtoll type usage Brian Norris
2011-02-16  2:48 ` Mike Frysinger
2011-02-25  8:49 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).