From e0ca4d83991d80865781c1dbbbfa1f92259a366a Mon Sep 17 00:00:00 2001 From: Bond-009 Date: Sun, 11 Aug 2019 11:39:43 +0200 Subject: Fix building with clang 8.0 (#4346) --- src/Protocol/Protocol_1_9.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/Protocol/Protocol_1_9.cpp') diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp index 00b233af5..f9a018a5c 100644 --- a/src/Protocol/Protocol_1_9.cpp +++ b/src/Protocol/Protocol_1_9.cpp @@ -70,10 +70,12 @@ static const UInt32 OFF_HAND = 1; #define HANDLE_READ(ByteBuf, Proc, Type, Var) \ Type Var; \ - if (!ByteBuf.Proc(Var))\ - {\ - return;\ - } + do { \ + if (!ByteBuf.Proc(Var))\ + {\ + return;\ + } \ + } while (false) @@ -81,14 +83,16 @@ static const UInt32 OFF_HAND = 1; #define HANDLE_PACKET_READ(ByteBuf, Proc, Type, Var) \ Type Var; \ - { \ - if (!ByteBuf.Proc(Var)) \ + do { \ { \ + if (!ByteBuf.Proc(Var)) \ + { \ + ByteBuf.CheckValid(); \ + return false; \ + } \ ByteBuf.CheckValid(); \ - return false; \ } \ - ByteBuf.CheckValid(); \ - } + } while (false) @@ -2922,7 +2926,7 @@ void cProtocol_1_9_0::HandleVanillaPluginMessage(cByteBuffer & a_ByteBuffer, con { if (a_Channel == "MC|AdvCdm") { - HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, Mode) + HANDLE_READ(a_ByteBuffer, ReadBEUInt8, UInt8, Mode); switch (Mode) { case 0x00: -- cgit v1.2.3