summaryrefslogtreecommitdiff
path: root/node/Utils.hpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2013-09-07 12:23:53 -0400
committerAdam Ierymenko <adam.ierymenko@gmail.com>2013-09-07 12:23:53 -0400
commitcdb96726df0f383c20bc83448a4e2427317371c0 (patch)
treeba4956bd41941b8268736a32c44b9314d8f788b9 /node/Utils.hpp
parent56d8bbf780240be34759c5f6c9ff67d09d231468 (diff)
downloadinfinitytier-cdb96726df0f383c20bc83448a4e2427317371c0.tar.gz
infinitytier-cdb96726df0f383c20bc83448a4e2427317371c0.zip
updateAndCheckMulticastBalance and friends
Diffstat (limited to 'node/Utils.hpp')
-rw-r--r--node/Utils.hpp45
1 files changed, 42 insertions, 3 deletions
diff --git a/node/Utils.hpp b/node/Utils.hpp
index 15121e28..329d4c4c 100644
--- a/node/Utils.hpp
+++ b/node/Utils.hpp
@@ -461,45 +461,84 @@ 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)
throw()
{
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)
throw()
{