1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 06:27:45 +00:00

Wrapping helpers in util namespace

This commit is contained in:
Mordred Admin 2017-09-19 10:59:42 +02:00
parent 1031d66522
commit dad2e255f5
3 changed files with 11 additions and 9 deletions

View file

@ -197,7 +197,7 @@ long double Core::Db::ResultSet::getDouble( uint32_t columnIndex ) const
if( getFieldMeta(columnIndex)->type == MYSQL_TYPE_BIT ) if( getFieldMeta(columnIndex)->type == MYSQL_TYPE_BIT )
return static_cast< long double >( getInt64( columnIndex ) ); 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 long double Core::Db::ResultSet::getDouble( const std::string &columnLabel ) const

View file

@ -1,6 +1,6 @@
#include "mysql_util.h" #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 - * 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; typedef std::istreambuf_iterator< char > iter_t;
static std::locale c_locale( "C" ); static std::locale c_locale( "C" );

View file

@ -48,11 +48,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#ifndef _WIN32 #ifndef _WIN32
# ifndef HAVE_FUNCTION_STRTOLL # ifndef HAVE_FUNCTION_STRTOLL
# define strtoll(__a, __b, __c) static_cast<long long>(strtold((__a), NULL)) # define strtoll(__a, __b, __c) static_cast<long long>(Util::strtold((__a), NULL))
# define HAVE_FUNCTION_STRTOLL 1 # define HAVE_FUNCTION_STRTOLL 1
# endif # endif
# ifndef HAVE_FUNCTION_STRTOULL # ifndef HAVE_FUNCTION_STRTOULL
# define strtoull(__a, __b, __c) static_cast<unsigned long long>(strtold((__a), NULL)) # define strtoull(__a, __b, __c) static_cast<unsigned long long>(Util::strtold((__a), NULL))
# define HAVE_FUNCTION_STRTOULL 1 # define HAVE_FUNCTION_STRTOULL 1
# endif # endif
#else #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))[1])) << 16) +\
(((uint32_t) (((unsigned char*) (A))[0])) << 24))) <<\ (((uint32_t) (((unsigned char*) (A))[0])) << 24))) <<\
32)) 32))
namespace Util
{
long double strtold(const char *nptr, char **endptr); long double strtold(const char *nptr, char **endptr);
long double strtonum( const std::string &str, int radix = 10); long double strtonum( const std::string &str, int radix = 10);
}
#endif //SAPPHIRE_MYSQL_UTIL_H #endif //SAPPHIRE_MYSQL_UTIL_H