Skip to content

Commit 2ac0e64

Browse files
committed
MDEV-21174: Fix the 32-bit build
mtr_t::write(): Add explicit narrowing type casts to avoid warnings about lossy implicit conversions.
1 parent af5947f commit 2ac0e64

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

storage/innobase/include/mtr0log.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,20 @@ inline void mtr_t::write(const buf_block_t &block, byte *ptr, V val)
109109
case 1:
110110
if (w == OPT && mach_read_from_1(ptr) == val) return;
111111
ut_ad(w != NORMAL || mach_read_from_1(ptr) != val);
112-
mach_write_to_1(ptr, val);
112+
ut_ad(val == static_cast<byte>(val));
113+
*ptr= static_cast<byte>(val);
113114
break;
114115
case 2:
116+
ut_ad(val == static_cast<uint16_t>(val));
115117
if (w == OPT && mach_read_from_2(ptr) == val) return;
116118
ut_ad(w != NORMAL || mach_read_from_2(ptr) != val);
117-
mach_write_to_2(ptr, val);
119+
mach_write_to_2(ptr, static_cast<uint16_t>(val));
118120
break;
119121
case 4:
122+
ut_ad(val == static_cast<uint32_t>(val));
120123
if (w == OPT && mach_read_from_4(ptr) == val) return;
121124
ut_ad(w != NORMAL || mach_read_from_4(ptr) != val);
122-
mach_write_to_4(ptr, val);
125+
mach_write_to_4(ptr, static_cast<uint32_t>(val));
123126
break;
124127
case 8:
125128
if (w == OPT && mach_read_from_8(ptr) == val) return;

0 commit comments

Comments
 (0)