Skip to content

Commit f11d425

Browse files
committed
MDEV-20591: Follow-up fix
calc_field_event_length(): For type=MYSQL_TYPE_BLOB and meta==0, return 0 instead of *ptr+1. This was noted by -Wimplicit-fallthrough.
1 parent 896b869 commit f11d425

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

sql/log_event.cc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3423,16 +3423,18 @@ static size_t calc_field_event_length(const uchar *ptr, uint type, uint meta)
34233423
case MYSQL_TYPE_SET:
34243424
return meta & 0xFF;
34253425
case MYSQL_TYPE_BLOB:
3426-
if (meta > 4 )
3426+
switch (meta) {
3427+
default:
34273428
return 0;
3428-
if (meta == 1)
3429+
case 1:
34293430
return *ptr + 1;
3430-
if (meta == 2)
3431+
case 2:
34313432
return uint2korr(ptr) + 2;
3432-
if (meta == 3)
3433+
case 3:
34333434
return uint3korr(ptr) + 3;
3434-
if (meta == 4)
3435+
case 4:
34353436
return uint4korr(ptr) + 4;
3437+
}
34363438
case MYSQL_TYPE_VARCHAR:
34373439
case MYSQL_TYPE_VAR_STRING:
34383440
length= meta;

0 commit comments

Comments
 (0)