diff options
-rw-r--r-- | include/my_global.h | 2 | ||||
-rw-r--r-- | libmysql/libmysql.c | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/include/my_global.h b/include/my_global.h index 8e2e8e0eb6a..f6200830ee3 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -713,7 +713,7 @@ typedef void *gptr; /* Generic pointer */ typedef char *gptr; /* Generic pointer */ #endif #ifndef HAVE_INT_8_16_32 -typedef char int8; /* Signed integer >= 8 bits */ +typedef signed char int8; /* Signed integer >= 8 bits */ typedef short int16; /* Signed integer >= 16 bits */ #endif #ifndef HAVE_UCHAR diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index b8e53cf92bb..ef926e2f93d 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -3611,9 +3611,10 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field, switch (field_type) { case MYSQL_TYPE_TINY: { - char value= (char) **row; - longlong data= field_is_unsigned ? (longlong) (unsigned char) value : - (longlong) value; + uchar value= **row; + /* sic: we need to cast to 'signed char' as 'char' may be unsigned */ + longlong data= field_is_unsigned ? (longlong) value : + (longlong) (signed char) value; fetch_long_with_conversion(param, field, data); *row+= 1; break; |