s4/torture/raw: cppcheck: Fix shiftTooManyBitsSigned error
authorNoel Power <noel.power@suse.com>
Wed, 22 May 2019 11:24:43 +0000 (11:24 +0000)
committerAndreas Schneider <asn@cryptomilk.org>
Tue, 4 Jun 2019 22:13:07 +0000 (22:13 +0000)
Fix

source4/torture/raw/notify.c:831: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:838: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:849: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:861: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:869: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:882: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:892: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:903: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:914: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:929: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:941: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:951: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:961: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:972: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]
source4/torture/raw/notify.c:982: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
source4/torture/raw/notify.c

index fa32c6b5e21886c0c062a0ca7db4701affc06d67..881ad6b71ccf2ff1bddc49800f45a057c60a39f0 100644 (file)
@@ -768,7 +768,7 @@ static bool test_notify_mask(struct torture_context *tctx,
                fnum = io.ntcreatex.out.file.fnum; \
                setup \
                notify.nttrans.in.file.fnum = fnum;     \
-               notify.nttrans.in.completion_filter = (1<<i); \
+               notify.nttrans.in.completion_filter = ((uint32_t)1<<i); \
                req = smb_raw_changenotify_send(cli->tree, &notify); \
                smb_raw_chkpath(cli->tree, &chkpath); \
                op \
@@ -817,7 +817,7 @@ static bool test_notify_mask(struct torture_context *tctx,
                                        notify.nttrans.in.completion_filter, \
                                        notify.nttrans.out.changes[0].name.s));\
                } \
-               mask |= (1<<i); \
+               mask |= ((uint32_t)1<<i); \
        } \
        if ((expected) != mask) { \
                torture_assert_int_not_equal_goto(tctx, ((expected) & ~mask), \