Skip to content

Commit da219d1

Browse files
authored
Fix[BMQ,MQB]: cppcheck warnings (#844)
Signed-off-by: Evgeny Malygin <emalygin@bloomberg.net>
1 parent 691dfeb commit da219d1

4 files changed

Lines changed: 17 additions & 10 deletions

File tree

src/groups/bmq/bmqst/bmqst_printutil.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ const char* memoryHelper(bsls::Types::Int64* num,
114114
}
115115

116116
bsls::Types::Int64 shift = level * 10;
117-
118-
bsls::Types::Int64 div = 1 << shift;
117+
bsls::Types::Int64 div = 1LL << shift;
119118
*num = bytes >> shift;
120119
*remainder = static_cast<int>(
121120
bsl::floor(((static_cast<double>(bytes - (*num << shift)) /

src/groups/mqb/mqbblp/mqbblp_routers.t.cpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,22 +202,22 @@ static void test2_priority()
202202
bmqp_ctrlmsg::Expression(bmqtst::TestHelperUtil::allocator()),
203203
mqbblp::Routers::Expression());
204204

205-
mqbi::QueueHandle* handle = 0;
206-
++handle;
205+
bsls::ObjectBuffer<mqbmock::QueueHandle> handle;
206+
207207
const bmqp_ctrlmsg::StreamParameters streamParameters(
208208
bmqtst::TestHelperUtil::allocator());
209209
mqbblp::Routers::Consumers consumers(bmqtst::TestHelperUtil::allocator());
210210
const unsigned int subQueueId = 13;
211211
mqbblp::Routers::Consumers::SharedItem consumer = consumers.record(
212-
handle,
212+
handle.address(),
213213
mqbblp::Routers::Consumer(streamParameters,
214214
subQueueId,
215215
bmqtst::TestHelperUtil::allocator()));
216216

217217
mqbblp::Routers::Priority priority(bmqtst::TestHelperUtil::allocator());
218218

219219
priority.d_subscribers.record(
220-
handle,
220+
handle.address(),
221221
mqbblp::Routers::Subscriber(consumer,
222222
bmqtst::TestHelperUtil::allocator()));
223223
}
@@ -463,7 +463,6 @@ static void test4_generate()
463463
bsl::string appId("foo", bmqtst::TestHelperUtil::allocator());
464464
int priorityCount = 2;
465465
int priority = 2;
466-
mqbmock::QueueHandle* handle = 0;
467466
unsigned int subQueueId = 13;
468467

469468
in.appId() = appId;
@@ -487,10 +486,16 @@ static void test4_generate()
487486
}
488487
}
489488

490-
appContext
491-
.load(++handle, &errorStream, subQueueId, upstreamSubQueueId, in, 0);
489+
bsls::ObjectBuffer<mqbmock::QueueHandle> handle1, handle2;
490+
491+
appContext.load(handle1.address(),
492+
&errorStream,
493+
subQueueId,
494+
upstreamSubQueueId,
495+
in,
496+
0);
492497
BMQTST_ASSERT_EQ(errorStream.str(), "");
493-
appContext.load(++handle,
498+
appContext.load(handle2.address(),
494499
&errorStream,
495500
subQueueId + 1,
496501
upstreamSubQueueId,

src/groups/mqb/mqbc/mqbc_clusterstatemanager.t.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ struct Tester {
469469
}
470470
}
471471

472+
BSLS_ASSERT_OPT(highestLSNFollower);
472473
BSLS_ASSERT_OPT(highestLSNFollower->nodeId() !=
473474
d_cluster_mp->netCluster().selfNodeId());
474475

src/groups/mqb/mqbc/mqbc_incoreclusterstateledger.t.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,8 @@ struct Tester {
493493
}
494494
}
495495

496+
BSLS_ASSERT_OPT(blob);
497+
496498
bdlbb::Blob record(d_cluster_mp->bufferFactory(),
497499
bmqtst::TestHelperUtil::allocator());
498500
bdlbb::BlobUtil::append(&record, *blob, sizeof(bmqp::EventHeader));

0 commit comments

Comments
 (0)