diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/db.c | 32 | ||||
-rw-r--r-- | src/common/sql.c | 4 | ||||
-rw-r--r-- | src/common/strlib.c | 9 | ||||
-rw-r--r-- | src/common/strlib.h | 2 |
4 files changed, 26 insertions, 21 deletions
diff --git a/src/common/db.c b/src/common/db.c index 537f26e6a..4dcf1d0b0 100644 --- a/src/common/db.c +++ b/src/common/db.c @@ -2229,10 +2229,10 @@ DBComparator db_default_cmp(DBType type) { DB_COUNTSTAT(db_default_cmp); switch (type) { - case DB_INT: return db_int_cmp; - case DB_UINT: return db_uint_cmp; - case DB_STRING: return db_string_cmp; - case DB_ISTRING: return db_istring_cmp; + case DB_INT: return &db_int_cmp; + case DB_UINT: return &db_uint_cmp; + case DB_STRING: return &db_string_cmp; + case DB_ISTRING: return &db_istring_cmp; default: ShowError("db_default_cmp: Unknown database type %u\n", type); return NULL; @@ -2253,10 +2253,10 @@ DBHasher db_default_hash(DBType type) { DB_COUNTSTAT(db_default_hash); switch (type) { - case DB_INT: return db_int_hash; - case DB_UINT: return db_uint_hash; - case DB_STRING: return db_string_hash; - case DB_ISTRING: return db_istring_hash; + case DB_INT: return &db_int_hash; + case DB_UINT: return &db_uint_hash; + case DB_STRING: return &db_string_hash; + case DB_ISTRING: return &db_istring_hash; default: ShowError("db_default_hash: Unknown database type %u\n", type); return NULL; @@ -2284,12 +2284,12 @@ DBReleaser db_default_release(DBType type, DBOptions options) options = db_fix_options(type, options); if (options&DB_OPT_RELEASE_DATA) { // Release data, what about the key? if (options&(DB_OPT_DUP_KEY|DB_OPT_RELEASE_KEY)) - return db_release_both; // Release both key and data - return db_release_data; // Only release data + return &db_release_both; // Release both key and data + return &db_release_data; // Only release data } if (options&(DB_OPT_DUP_KEY|DB_OPT_RELEASE_KEY)) - return db_release_key; // Only release key - return db_release_nothing; // Release nothing + return &db_release_key; // Only release key + return &db_release_nothing; // Release nothing } /** @@ -2307,10 +2307,10 @@ DBReleaser db_custom_release(DBRelease which) { DB_COUNTSTAT(db_custom_release); switch (which) { - case DB_RELEASE_NOTHING: return db_release_nothing; - case DB_RELEASE_KEY: return db_release_key; - case DB_RELEASE_DATA: return db_release_data; - case DB_RELEASE_BOTH: return db_release_both; + case DB_RELEASE_NOTHING: return &db_release_nothing; + case DB_RELEASE_KEY: return &db_release_key; + case DB_RELEASE_DATA: return &db_release_data; + case DB_RELEASE_BOTH: return &db_release_both; default: ShowError("db_custom_release: Unknown release options %u\n", which); return NULL; diff --git a/src/common/sql.c b/src/common/sql.c index c0668d17c..f7c45c631 100644 --- a/src/common/sql.c +++ b/src/common/sql.c @@ -489,8 +489,8 @@ static int Sql_P_BindSqlDataType(MYSQL_BIND* bind, enum SqlDataType buffer_type, buffer_len = sizeof(long); break; case SQLDT_ULONGLONG: bind->is_unsigned = 1; - case SQLDT_LONGLONG: bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(long long)); - buffer_len = sizeof(long long); + case SQLDT_LONGLONG: bind->buffer_type = Sql_P_SizeToMysqlIntType(sizeof(int64)); + buffer_len = sizeof(int64); break; // floating point case SQLDT_FLOAT: bind->buffer_type = MYSQL_TYPE_FLOAT; diff --git a/src/common/strlib.c b/src/common/strlib.c index c388f949a..7a6c134e7 100644 --- a/src/common/strlib.c +++ b/src/common/strlib.c @@ -253,9 +253,9 @@ size_t strnlen (const char* string, size_t maxlen) #endif #if defined(WIN32) && defined(_MSC_VER) && _MSC_VER <= 1200 -unsigned long long strtoull(const char* str, char** endptr, int base) +uint64 strtoull(const char* str, char** endptr, int base) { - unsigned long long result; + uint64 result; int count; int n; @@ -266,8 +266,13 @@ unsigned long long strtoull(const char* str, char** endptr, int base) else if( str[0] == '0' ) base = 8; + else + base = 10; } + if( base == 8 ) + count = sscanf(str, "%I64o%n", &result, &n); + else if( base == 10 ) count = sscanf(str, "%I64u%n", &result, &n); else diff --git a/src/common/strlib.h b/src/common/strlib.h index 29af06015..23f1e191a 100644 --- a/src/common/strlib.h +++ b/src/common/strlib.h @@ -29,7 +29,7 @@ size_t strnlen (const char* string, size_t maxlen); #endif #if defined(WIN32) && defined(_MSC_VER) && _MSC_VER <= 1200 -unsigned long long strtoull(const char* str, char** endptr, int base); +uint64 strtoull(const char* str, char** endptr, int base); #endif int e_mail_check(char* email); |