mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 14:37:44 +00:00
Fix linux build, needs some love for the warnings
This commit is contained in:
parent
40bc05cf71
commit
3f524dc08c
2 changed files with 32 additions and 2 deletions
|
@ -1,5 +1,34 @@
|
||||||
#include "mysql_util.h"
|
#include "mysql_util.h"
|
||||||
|
|
||||||
|
long double strtold(const char *nptr, char **endptr)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Experienced odd compilation errors on one of windows build hosts -
|
||||||
|
* cmake reported there is strold function. Since double and long double on windows
|
||||||
|
* are of the same size - we are using strtod on those platforms regardless
|
||||||
|
* to the HAVE_FUNCTION_STRTOLD value
|
||||||
|
*/
|
||||||
|
#ifdef _WIN32
|
||||||
|
return ::strtod(nptr, endptr);
|
||||||
|
#else
|
||||||
|
# ifndef HAVE_FUNCTION_STRTOLD
|
||||||
|
return ::strtod(nptr, endptr);
|
||||||
|
# else
|
||||||
|
# if defined(__hpux) && defined(_LONG_DOUBLE)
|
||||||
|
union {
|
||||||
|
long_double l_d;
|
||||||
|
long double ld;
|
||||||
|
} u;
|
||||||
|
u.l_d = ::strtold( nptr, endptr);
|
||||||
|
return u.ld;
|
||||||
|
# else
|
||||||
|
return ::strtold(nptr, endptr);
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
long double strtonum( const std::string &str, int radix )
|
long double strtonum( const std::string &str, int radix )
|
||||||
{
|
{
|
||||||
typedef std::istreambuf_iterator< char > iter_t;
|
typedef std::istreambuf_iterator< char > iter_t;
|
||||||
|
|
|
@ -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>(sql::mysql::util::strtold((__a), NULL))
|
# define strtoll(__a, __b, __c) static_cast<long long>(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>(sql::mysql::util::strtold((__a), NULL))
|
# define strtoull(__a, __b, __c) static_cast<unsigned long long>(strtold((__a), NULL))
|
||||||
# define HAVE_FUNCTION_STRTOULL 1
|
# define HAVE_FUNCTION_STRTOULL 1
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
|
@ -106,5 +106,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
(((uint32_t) (((unsigned char*) (A))[0])) << 24))) <<\
|
(((uint32_t) (((unsigned char*) (A))[0])) << 24))) <<\
|
||||||
32))
|
32))
|
||||||
|
|
||||||
|
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
|
||||||
|
|
Loading…
Add table
Reference in a new issue