From ab8f9a55d637561a5057772329a4d7dda08fc7a9 Mon Sep 17 00:00:00 2001 From: Mordred Admin Date: Tue, 19 Sep 2017 10:59:42 +0200 Subject: [PATCH] Wrapping helpers in util namespace --- src/servers/Server_Common/Database/ResultSet.cpp | 2 +- src/servers/Server_Common/Database/mysql_util.cpp | 6 +++--- src/servers/Server_Common/Database/mysql_util.h | 12 +++++++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/servers/Server_Common/Database/ResultSet.cpp b/src/servers/Server_Common/Database/ResultSet.cpp index 92fc85b6..8d2c4b62 100644 --- a/src/servers/Server_Common/Database/ResultSet.cpp +++ b/src/servers/Server_Common/Database/ResultSet.cpp @@ -197,7 +197,7 @@ long double Core::Db::ResultSet::getDouble( uint32_t columnIndex ) const if( getFieldMeta(columnIndex)->type == MYSQL_TYPE_BIT ) return static_cast< long double >( getInt64( columnIndex ) ); - return strtonum( m_row[columnIndex - 1] ); + return Util::strtonum( m_row[columnIndex - 1] ); } long double Core::Db::ResultSet::getDouble( const std::string &columnLabel ) const diff --git a/src/servers/Server_Common/Database/mysql_util.cpp b/src/servers/Server_Common/Database/mysql_util.cpp index 160b193f..c0f75898 100644 --- a/src/servers/Server_Common/Database/mysql_util.cpp +++ b/src/servers/Server_Common/Database/mysql_util.cpp @@ -1,6 +1,6 @@ #include "mysql_util.h" -long double strtold(const char *nptr, char **endptr) +long double Util::strtold(const char *nptr, char **endptr) { /* * Experienced odd compilation errors on one of windows build hosts - @@ -29,7 +29,7 @@ long double strtold(const char *nptr, char **endptr) } -long double strtonum( const std::string &str, int radix ) +long double Util::strtonum( const std::string &str, int radix ) { typedef std::istreambuf_iterator< char > iter_t; static std::locale c_locale( "C" ); @@ -56,4 +56,4 @@ long double strtonum( const std::string &str, int radix ) cvt.get( beg, end, inp, err, val ); return val; -} \ No newline at end of file +} diff --git a/src/servers/Server_Common/Database/mysql_util.h b/src/servers/Server_Common/Database/mysql_util.h index 66fffd13..8421c4d1 100644 --- a/src/servers/Server_Common/Database/mysql_util.h +++ b/src/servers/Server_Common/Database/mysql_util.h @@ -48,11 +48,11 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef _WIN32 # ifndef HAVE_FUNCTION_STRTOLL -# define strtoll(__a, __b, __c) static_cast(strtold((__a), NULL)) +# define strtoll(__a, __b, __c) static_cast(Util::strtold((__a), NULL)) # define HAVE_FUNCTION_STRTOLL 1 # endif # ifndef HAVE_FUNCTION_STRTOULL -# define strtoull(__a, __b, __c) static_cast(strtold((__a), NULL)) +# define strtoull(__a, __b, __c) static_cast(Util::strtold((__a), NULL)) # define HAVE_FUNCTION_STRTOULL 1 # endif #else @@ -105,7 +105,9 @@ with this program; if not, write to the Free Software Foundation, Inc., (((uint32_t) (((unsigned char*) (A))[1])) << 16) +\ (((uint32_t) (((unsigned char*) (A))[0])) << 24))) <<\ 32)) - -long double strtold(const char *nptr, char **endptr); -long double strtonum( const std::string &str, int radix = 10); +namespace Util +{ + long double strtold(const char *nptr, char **endptr); + long double strtonum( const std::string &str, int radix = 10); +} #endif //SAPPHIRE_MYSQL_UTIL_H