commit 0216b233628801bb44952242d9afb39fa8b1e386 Author: Zsolt Parragi Date: Thu Mar 15 10:48:30 2018 +0100 Fix bug 90111 / PS-3893 (Fix warnings about incorrect enum usage in log_event) (cherry picked from commit a9fde2b9d993cab59a764cfa6ae6e83c0517815a) diff --git a/sql/log_event.cc b/sql/log_event.cc index 03a12fd6d3d..a0707b5da00 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -6724,7 +6724,7 @@ int User_var_log_event::pack_info(Protocol *protocol) { event_len = val_offset + 4; } else { switch (type) { - case REAL_RESULT: + case REAL_TYPE: double real_val; float8get(&real_val, val); if (!(buf = (char *)my_malloc(key_memory_log_event, @@ -6734,7 +6734,7 @@ int User_var_log_event::pack_info(Protocol *protocol) { event_len += my_gcvt(real_val, MY_GCVT_ARG_DOUBLE, MY_GCVT_MAX_FIELD_WIDTH, buf + val_offset, NULL); break; - case INT_RESULT: + case INT_TYPE: if (!(buf = (char *)my_malloc(key_memory_log_event, val_offset + 22, MYF(MY_WME)))) return 1; @@ -6743,7 +6743,7 @@ int User_var_log_event::pack_info(Protocol *protocol) { ((flags & User_var_log_event::UNSIGNED_F) ? 10 : -10)) - buf; break; - case DECIMAL_RESULT: { + case DECIMAL_TYPE: { if (!(buf = (char *)my_malloc(key_memory_log_event, val_offset + DECIMAL_MAX_STR_LENGTH + 1, MYF(MY_WME)))) @@ -6757,7 +6757,7 @@ int User_var_log_event::pack_info(Protocol *protocol) { event_len = str.length() + val_offset; break; } - case STRING_RESULT: + case STRING_TYPE: /* 15 is for 'COLLATE' and other chars */ buf = (char *)my_malloc( key_memory_log_event, @@ -6824,14 +6824,14 @@ bool User_var_log_event::write(IO_CACHE *file) { int4store(buf1 + 2, charset_number); switch (type) { - case REAL_RESULT: + case REAL_TYPE: float8store(buf2, *(double *)val); break; - case INT_RESULT: + case INT_TYPE: int8store(buf2, *(longlong *)val); unsigned_len = 1; break; - case DECIMAL_RESULT: { + case DECIMAL_TYPE: { my_decimal *dec = (my_decimal *)val; dec->sanity_check(); buf2[0] = (char)(dec->intg + dec->frac); @@ -6840,10 +6840,10 @@ bool User_var_log_event::write(IO_CACHE *file) { val_len = decimal_bin_size(buf2[0], buf2[1]) + 2; break; } - case STRING_RESULT: + case STRING_TYPE: pos = (uchar *)val; break; - case ROW_RESULT: + case ROW_TYPE: default: DBUG_ASSERT(false); return 0; @@ -6892,21 +6892,21 @@ void User_var_log_event::print(FILE *, PRINT_EVENT_INFO *print_event_info) { my_b_printf(head, ":=NULL%s\n", print_event_info->delimiter); } else { switch (type) { - case REAL_RESULT: + case REAL_TYPE: double real_val; char real_buf[FMT_G_BUFSIZE(14)]; float8get(&real_val, val); sprintf(real_buf, "%.14g", real_val); my_b_printf(head, ":=%s%s\n", real_buf, print_event_info->delimiter); break; - case INT_RESULT: + case INT_TYPE: char int_buf[22]; longlong10_to_str( uint8korr(val), int_buf, ((flags & User_var_log_event::UNSIGNED_F) ? 10 : -10)); my_b_printf(head, ":=%s%s\n", int_buf, print_event_info->delimiter); break; - case DECIMAL_RESULT: { + case DECIMAL_TYPE: { char str_buf[200]; int str_len = sizeof(str_buf) - 1; int precision = (int)val[0]; @@ -6922,7 +6922,7 @@ void User_var_log_event::print(FILE *, PRINT_EVENT_INFO *print_event_info) { my_b_printf(head, ":=%s%s\n", str_buf, print_event_info->delimiter); break; } - case STRING_RESULT: { + case STRING_TYPE: { /* Let's express the string in hex. That's the most robust way. If we print it in character form instead, we need to escape it with @@ -6962,7 +6962,7 @@ void User_var_log_event::print(FILE *, PRINT_EVENT_INFO *print_event_info) { cs->name, print_event_info->delimiter); my_free(hex_str); } break; - case ROW_RESULT: + case ROW_TYPE: default: DBUG_ASSERT(false); return; @@ -7010,7 +7010,7 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli) { it = new Item_null(); } else { switch (type) { - case REAL_RESULT: + case REAL_TYPE: if (val_len != 8) { rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, ER_THD(thd, ER_SLAVE_FATAL_ERROR), @@ -7022,7 +7022,7 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli) { val = (char *)&real_val; // Pointer to value in native format val_len = 8; break; - case INT_RESULT: + case INT_TYPE: if (val_len != 8) { rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, ER_THD(thd, ER_SLAVE_FATAL_ERROR), @@ -7034,7 +7034,7 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli) { val = (char *)&int_val; // Pointer to value in native format val_len = 8; break; - case DECIMAL_RESULT: { + case DECIMAL_TYPE: { if (val_len < 3) { rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, ER_THD(thd, ER_SLAVE_FATAL_ERROR), @@ -7047,10 +7047,10 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli) { val_len = sizeof(my_decimal); break; } - case STRING_RESULT: + case STRING_TYPE: it = new Item_string(val, val_len, charset); break; - case ROW_RESULT: + case ROW_TYPE: default: DBUG_ASSERT(false); DBUG_RETURN(0);