diff options
-rw-r--r-- | myisam/mi_check.c | 2 | ||||
-rw-r--r-- | mysql-test/r/func_sapdb.result | 4 | ||||
-rw-r--r-- | sql/item_func.cc | 1 | ||||
-rw-r--r-- | sql/item_timefunc.cc | 4 | ||||
-rw-r--r-- | sql/item_timefunc.h | 1 | ||||
-rw-r--r-- | sql/spatial.cc | 39 |
6 files changed, 29 insertions, 22 deletions
diff --git a/myisam/mi_check.c b/myisam/mi_check.c index 8783a5fef54..15d1cceebfe 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -1839,7 +1839,7 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo, if (sort_one_index(param,info,keyinfo,next_page,new_file)) { DBUG_PRINT("error", - ("From page: %ld, keyoffset: 0x%lx used_length: %d", + ("From page: %ld, keyoffset: %lu used_length: %d", (ulong) pagepos, (ulong) (keypos - buff), (int) used_length)); DBUG_DUMP("buff",(byte*) buff,used_length); diff --git a/mysql-test/r/func_sapdb.result b/mysql-test/r/func_sapdb.result index 68c3baa7bde..ea40e1559fd 100644 --- a/mysql-test/r/func_sapdb.result +++ b/mysql-test/r/func_sapdb.result @@ -170,8 +170,8 @@ Field Type Null Key Default Extra f1 date 0000-00-00 f2 datetime YES NULL f3 time YES NULL -f4 time 00:00:00 -f5 time 00:00:00 +f4 time YES NULL +f5 time YES NULL f6 time 00:00:00 f7 datetime YES NULL f8 date YES NULL diff --git a/sql/item_func.cc b/sql/item_func.cc index aff4adb788a..df32672e12b 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -766,7 +766,6 @@ void Item_func_abs::fix_length_and_dec() hybrid_type= REAL_RESULT; if (args[0]->result_type() == INT_RESULT) hybrid_type= INT_RESULT; - maybe_null= 1; } diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 7398b1746da..eb58b180ed7 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -2381,6 +2381,7 @@ void Item_func_add_time::fix_length_and_dec() enum_field_types arg0_field_type; decimals=0; max_length=MAX_DATETIME_FULL_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; + maybe_null= 1; /* The field type for the result of an Item_func_add_time function is defined @@ -2742,7 +2743,8 @@ Field *Item_func_str_to_date::tmp_table_field(TABLE *t_arg) void Item_func_str_to_date::fix_length_and_dec() { char format_buff[64]; - String format_str(format_buff, sizeof(format_buff), &my_charset_bin), *format; + String format_str(format_buff, sizeof(format_buff), &my_charset_bin); + String *format; maybe_null= 1; decimals=0; cached_field_type= MYSQL_TYPE_STRING; diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 0df84d14bea..16c64620369 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -808,6 +808,7 @@ public: { decimals=0; max_length=MAX_TIME_WIDTH*MY_CHARSET_BIN_MB_MAXLEN; + maybe_null= 1; } Field *tmp_table_field(TABLE *t_arg) { diff --git a/sql/spatial.cc b/sql/spatial.cc index 9e72dfb9130..684f7e9ecf3 100644 --- a/sql/spatial.cc +++ b/sql/spatial.cc @@ -127,15 +127,14 @@ Geometry *Geometry::construct(Geometry_buffer *buffer, Geometry *result; char byte_order; - if (data_len < SRID_SIZE + 1 + 4) + if (data_len < SRID_SIZE + WKB_HEADER_SIZE) // < 4 + (1 + 4) return NULL; byte_order= data[SRID_SIZE]; geom_type= uint4korr(data + SRID_SIZE + 1); - data+= SRID_SIZE + WKB_HEADER_SIZE; if (!(result= create_by_typeid(buffer, (int) geom_type))) return NULL; - result->m_data= data; - result->m_data_end= data + (data_len - (SRID_SIZE + WKB_HEADER_SIZE)); + result->m_data= data+ SRID_SIZE + WKB_HEADER_SIZE; + result->m_data_end= data + data_len; return result; } @@ -737,7 +736,7 @@ uint Gis_polygon::init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, wkb+= ls_len; } - return wkb - wkb_orig; + return (uint) (wkb - wkb_orig); } @@ -1182,7 +1181,8 @@ uint Gis_multi_line_string::init_from_wkb(const char *wkb, uint len, return 0; res->q_append(n_line_strings); - for (wkb+=4; n_line_strings; n_line_strings--) + wkb+= 4; + while (n_line_strings--) { Gis_line_string ls; int ls_len; @@ -1197,10 +1197,11 @@ uint Gis_multi_line_string::init_from_wkb(const char *wkb, uint len, if (!(ls_len= ls.init_from_wkb(wkb + WKB_HEADER_SIZE, len, (wkbByteOrder) wkb[0], res))) return 0; - wkb+= (ls_len + WKB_HEADER_SIZE); - len-= (ls_len + WKB_HEADER_SIZE); + ls_len+= WKB_HEADER_SIZE;; + wkb+= ls_len; + len-= ls_len; } - return wkb-wkb_orig; + return (uint) (wkb - wkb_orig); } @@ -1434,7 +1435,8 @@ uint Gis_multi_polygon::init_from_wkb(const char *wkb, uint len, return 0; res->q_append(n_poly); - for (wkb+=4; n_poly; n_poly--) + wkb+=4; + while (n_poly--) { Gis_polygon p; int p_len; @@ -1448,10 +1450,11 @@ uint Gis_multi_polygon::init_from_wkb(const char *wkb, uint len, if (!(p_len= p.init_from_wkb(wkb + WKB_HEADER_SIZE, len, (wkbByteOrder) wkb[0], res))) return 0; - wkb+= (p_len + WKB_HEADER_SIZE); - len-= (p_len + WKB_HEADER_SIZE); + p_len+= WKB_HEADER_SIZE; + wkb+= p_len; + len-= p_len; } - return wkb-wkb_orig; + return (uint) (wkb - wkb_orig); } @@ -1731,7 +1734,8 @@ uint Gis_geometry_collection::init_from_wkb(const char *wkb, uint len, return 0; res->q_append(n_geom); - for (wkb+=4; n_geom; n_geom--) + wkb+= 4; + while (n_geom--) { Geometry_buffer buffer; Geometry *geom; @@ -1750,10 +1754,11 @@ uint Gis_geometry_collection::init_from_wkb(const char *wkb, uint len, !(g_len= geom->init_from_wkb(wkb + WKB_HEADER_SIZE, len, (wkbByteOrder) wkb[0], res))) return 0; - wkb+= (g_len + WKB_HEADER_SIZE); - len-= (g_len + WKB_HEADER_SIZE); + g_len+= WKB_HEADER_SIZE; + wkb+= g_len; + len-= g_len; } - return wkb-wkb_orig; + return (uint) (wkb - wkb_orig); } |