From a9fde2b9d993cab59a764cfa6ae6e83c0517815a Mon Sep 17 00:00:00 2001 From: Zsolt Parragi Date: Thu, 15 Mar 2018 10:48:30 +0100 Subject: [PATCH] PS-3893: Fix warnings about incorrect enum usage in log_event --- sql/log_event.cc | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index 36b73d3965e..3198e95127d 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -7726,7 +7726,7 @@ int User_var_log_event::pack_info(Protocol* protocol) 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, @@ -7736,7 +7736,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; @@ -7744,7 +7744,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, @@ -7758,7 +7758,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, event_len+val_len*2+1+2*MY_CS_NAME_SIZE+15, @@ -7779,7 +7779,7 @@ int User_var_log_event::pack_info(Protocol* protocol) event_len= p-buf; } break; - case ROW_RESULT: + case ROW_TYPE: default: DBUG_ASSERT(1); return 1; @@ -7833,14 +7833,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(); @@ -7850,10 +7850,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(1); return 0; @@ -7908,20 +7908,20 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) 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; @@ -7938,7 +7938,7 @@ void User_var_log_event::print(FILE* 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 @@ -7981,7 +7981,7 @@ void User_var_log_event::print(FILE* file, PRINT_EVENT_INFO* print_event_info) my_free(hex_str); } break; - case ROW_RESULT: + case ROW_TYPE: default: DBUG_ASSERT(1); return; @@ -8033,19 +8033,19 @@ int User_var_log_event::do_apply_event(Relay_log_info const *rli) else { switch (type) { - case REAL_RESULT: + case REAL_TYPE: float8get(&real_val, val); it= new Item_float(real_val, 0); val= (char*) &real_val; // Pointer to value in native format val_len= 8; break; - case INT_RESULT: + case INT_TYPE: int_val= (longlong) uint8korr(val); it= new Item_int(int_val); val= (char*) &int_val; // Pointer to value in native format val_len= 8; break; - case DECIMAL_RESULT: + case DECIMAL_TYPE: { Item_decimal *dec= new Item_decimal((uchar*) val+2, val[0], val[1]); it= dec; @@ -8053,10 +8053,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(1); DBUG_RETURN(0);