From cdb96726df0f383c20bc83448a4e2427317371c0 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Sat, 7 Sep 2013 12:23:53 -0400 Subject: updateAndCheckMulticastBalance and friends --- node/Utils.hpp | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) (limited to 'node/Utils.hpp') diff --git a/node/Utils.hpp b/node/Utils.hpp index 15121e28..329d4c4c 100644 --- a/node/Utils.hpp +++ b/node/Utils.hpp @@ -461,24 +461,44 @@ public: #endif } - // String to number converters + // String to number converters -- defined here to permit portability + // ifdefs for platforms that lack some of the strtoXX functions. static inline unsigned int strToUInt(const char *s) throw() { return (unsigned int)strtoul(s,(char **)0,10); } + static inline int strToInt(const char *s) + throw() + { + return (int)strtol(s,(char **)0,10); + } static inline unsigned long strToULong(const char *s) throw() { return strtoul(s,(char **)0,10); } + static inline long strToLong(const char *s) + throw() + { + return strtol(s,(char **)0,10); + } static inline unsigned long long strToU64(const char *s) throw() { #ifdef __WINDOWS__ - return _strtoui64(s,(char **)0,10); + return (unsigned long long)_strtoui64(s,(char **)0,10); #else return strtoull(s,(char **)0,10); +#endif + } + static inline long long strTo64(const char *s) + throw() + { +#ifdef __WINDOWS__ + return (long long)_strtoi64(s,(char **)0,10); +#else + return strtoll(s,(char **)0,10); #endif } static inline unsigned int hexStrToUInt(const char *s) @@ -486,18 +506,37 @@ public: { return (unsigned int)strtoul(s,(char **)0,16); } + static inline int hexStrToInt(const char *s) + throw() + { + return (int)strtol(s,(char **)0,16); + } static inline unsigned long hexStrToULong(const char *s) throw() { return strtoul(s,(char **)0,16); } + static inline long hexStrToLong(const char *s) + throw() + { + return strtol(s,(char **)0,16); + } static inline unsigned long long hexStrToU64(const char *s) throw() { #ifdef __WINDOWS__ - return _strtoui64(s,(char **)0,16); + return (unsigned long long)_strtoui64(s,(char **)0,16); #else return strtoull(s,(char **)0,16); +#endif + } + static inline long long hexStrTo64(const char *s) + throw() + { +#ifdef __WINDOWS__ + return (long long)_strtoi64(s,(char **)0,16); +#else + return strtoll(s,(char **)0,16); #endif } static inline double strToDouble(const char *s) -- cgit v1.2.3