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

* Re: [PATCH] mtd-utils: common.h: simple_strtoll type usage
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Frysinger @ 2011-02-16  2:48 UTC (permalink / raw)
  To: Brian Norris; +Cc: David Woodhouse, Kevin Cernekee, linux-mtd, Artem Bityutskiy

On Tue, Feb 15, 2011 at 20:47, Brian Norris wrote:
> 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).

Acked-by: Mike Frysinger <vapier@gentoo.org>
-mike

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

* Re: [PATCH] mtd-utils: common.h: simple_strtoll type usage
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Artem Bityutskiy @ 2011-02-25  8:49 UTC (permalink / raw)
  To: Brian Norris; +Cc: David Woodhouse, Kevin Cernekee, linux-mtd, Mike Frysinger

On Tue, 2011-02-15 at 17:47 -0800, Brian Norris wrote:
> 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>

Pushed, thank you!

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

^ permalink raw reply	[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).