Merge pull request #259 from gtsoul-tech/bug/cppcheckErrors

Bug/cppcheck errors (32,35) WIP
This commit is contained in:
Konstantinos Margaritis
2024-04-30 10:27:47 +03:00
committed by GitHub
24 changed files with 81 additions and 93 deletions

View File

@@ -488,7 +488,6 @@ TEST_P(FDRFloodp, StreamingMask) {
Grey());
CHECK_WITH_TEDDY_OK_TO_FAIL(fdr, hint);
hwlm_error_t fdrStatus;
const u32 cnt4 = dataSize - 4 + 1;
for (u32 streamChunk = 1; streamChunk <= 16; streamChunk *= 2) {
@@ -496,7 +495,7 @@ TEST_P(FDRFloodp, StreamingMask) {
const u8 *d = data.data();
// reference past the end of fake history to allow headroom
const u8 *fhist = fake_history.data() + fake_history_size;
fdrStatus = fdrExecStreaming(fdr.get(), fhist, 0, d, streamChunk, 0,
hwlm_error_t fdrStatus = fdrExecStreaming(fdr.get(), fhist, 0, d, streamChunk, 0,
countCallback, &scratch,
HWLM_ALL_GROUPS);
ASSERT_EQ(0, fdrStatus);

View File

@@ -277,10 +277,9 @@ TEST_P(RepeatTest, FillRing) {
}
// We should be able to see matches for all of these (beyond the last top offset).
enum TriggerResult rv;
for (u64a i = offset + info.repeatMax;
i <= offset + info.repeatMax + info.repeatMin; i++) {
rv = processTugTrigger(&info, ctrl, state, i);
enum TriggerResult rv = processTugTrigger(&info, ctrl, state, i);
if (rv == TRIGGER_SUCCESS_CACHE) {
rv = TRIGGER_SUCCESS;
}
@@ -998,16 +997,14 @@ TEST_P(SparseOptimalTest, FillTops) {
repeatStore(info, ctrl, state, offset, 0);
ASSERT_EQ(offset, repeatLastTop(info, ctrl, state));
u64a offset2;
for (u32 i = min_period; i < patch_count * patch_size; i += min_period) {
offset2 = offset + i;
u64a offset2 = offset + i;
repeatStore(info, ctrl, state, offset2, 1);
ASSERT_EQ(offset2, repeatLastTop(info, ctrl, state));
}
u64a exit2;
for (u32 i = 0; i < patch_count * patch_size; i += min_period) {
exit2 = exit + i;
u64a exit2 = exit + i;
for (u32 j = exit2 + info->repeatMin;
j <= offset + info->repeatMax; j++) {
ASSERT_EQ(REPEAT_MATCH, repeatHasMatch(info, ctrl, state, j));

View File

@@ -87,12 +87,11 @@ static int initLegalValidMasks(u64a validMasks[]) {
*/
static int initLegalNegMasks(u64a negMasks[]) {
u64a data = 0;
u64a offset;
int num = 0;
while (data != ONES64) {
negMasks[num] = data;
num++;
offset = (data | (data +1)) ^ data;
u64a offset = (data | (data +1)) ^ data;
data += 0xfeULL * offset + 1;
}
negMasks[num] = data;

View File

@@ -194,10 +194,9 @@ TEST(ValidateMask32, testMask32_3) {
u32 valid_mask = ONES32 << (left + right) >> left;
for (int i = 0; i < test_len; i++) {
const auto &t = testBasic[i];
int bool_result;
for (int j = 0; j < 5000; j++) {
u32 neg_mask = neg_mask_rand.Generate(1u << 31);
bool_result = (neg_mask & valid_mask) ==
int bool_result = (neg_mask & valid_mask) ==
(t.neg_mask & valid_mask);
EXPECT_EQ(bool_result, validateMask32(t.data.a256,
valid_mask,