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

Bug/cppcheck errors (3 ,4 ,7 ,10,11) WIP
This commit is contained in:
Konstantinos Margaritis
2024-04-25 10:17:23 +03:00
committed by GitHub
11 changed files with 32 additions and 35 deletions

View File

@@ -79,21 +79,18 @@ static UNUSED
const platform_t hs_current_platform_no_avx2 = {
HS_PLATFORM_NOAVX2 |
HS_PLATFORM_NOAVX512 |
HS_PLATFORM_NOAVX512VBMI |
0,
HS_PLATFORM_NOAVX512VBMI
};
static UNUSED
const platform_t hs_current_platform_no_avx512 = {
HS_PLATFORM_NOAVX512 |
HS_PLATFORM_NOAVX512VBMI |
0,
HS_PLATFORM_NOAVX512VBMI
};
static UNUSED
const platform_t hs_current_platform_no_avx512vbmi = {
HS_PLATFORM_NOAVX512VBMI |
0,
HS_PLATFORM_NOAVX512VBMI
};
/*

View File

@@ -52,14 +52,14 @@ u32 TeddyEngineDescription::getDefaultFloodSuffixLength() const {
void getTeddyDescriptions(vector<TeddyEngineDescription> *out) {
static const TeddyEngineDef defns[] = {
{ 3, 0 | HS_CPU_FEATURES_AVX2, 1, 16, false },
{ 4, 0 | HS_CPU_FEATURES_AVX2, 1, 16, true },
{ 5, 0 | HS_CPU_FEATURES_AVX2, 2, 16, false },
{ 6, 0 | HS_CPU_FEATURES_AVX2, 2, 16, true },
{ 7, 0 | HS_CPU_FEATURES_AVX2, 3, 16, false },
{ 8, 0 | HS_CPU_FEATURES_AVX2, 3, 16, true },
{ 9, 0 | HS_CPU_FEATURES_AVX2, 4, 16, false },
{ 10, 0 | HS_CPU_FEATURES_AVX2, 4, 16, true },
{ 3, HS_CPU_FEATURES_AVX2, 1, 16, false },
{ 4, HS_CPU_FEATURES_AVX2, 1, 16, true },
{ 5, HS_CPU_FEATURES_AVX2, 2, 16, false },
{ 6, HS_CPU_FEATURES_AVX2, 2, 16, true },
{ 7, HS_CPU_FEATURES_AVX2, 3, 16, false },
{ 8, HS_CPU_FEATURES_AVX2, 3, 16, true },
{ 9, HS_CPU_FEATURES_AVX2, 4, 16, false },
{ 10, HS_CPU_FEATURES_AVX2, 4, 16, true },
{ 11, 0, 1, 8, false },
{ 12, 0, 1, 8, true },
{ 13, 0, 2, 8, false },

View File

@@ -1572,7 +1572,7 @@ u32 findMaxVarShift(const build_info &args, u32 nShifts) {
static
int getLimexScore(const build_info &args, u32 nShifts) {
const NGHolder &h = args.h;
u32 maxVarShift = nShifts;
u32 maxVarShift;
int score = 0;
score += SHIFT_COST * nShifts;

View File

@@ -512,7 +512,7 @@ size_t find_last_bad(const struct mpv_kilopuff *kp, const u8 *buf,
verm_restart:;
assert(buf[curr] == kp->u.verm.c);
size_t test = curr;
size_t test;
if (curr + min_rep < length) {
test = curr + min_rep;
} else {
@@ -534,7 +534,7 @@ size_t find_last_bad(const struct mpv_kilopuff *kp, const u8 *buf,
m128 hi = kp->u.shuf.mask_hi;
shuf_restart:
assert(do_single_shufti(lo, hi, buf[curr]));
size_t test = curr;
size_t test;
if (curr + min_rep < length) {
test = curr + min_rep;
} else {
@@ -556,7 +556,7 @@ size_t find_last_bad(const struct mpv_kilopuff *kp, const u8 *buf,
const m128 mask1 = kp->u.truffle.mask1;
const m128 mask2 = kp->u.truffle.mask2;
truffle_restart:;
size_t test = curr;
size_t test;
if (curr + min_rep < length) {
test = curr + min_rep;
} else {
@@ -582,7 +582,7 @@ size_t find_last_bad(const struct mpv_kilopuff *kp, const u8 *buf,
nverm_restart:;
assert(buf[curr] != kp->u.verm.c);
size_t test = curr;
size_t test;
if (curr + min_rep < length) {
test = curr + min_rep;
} else {

View File

@@ -165,9 +165,9 @@ void reformAnchoredRepeatsComponent(NGHolder &g,
return;
}
NFAVertex dotV = NGHolder::null_vertex();
set<NFAVertex> otherV;
dotV = findReformable(g, compAnchoredStarts, otherV);
NFAVertex dotV = findReformable(g, compAnchoredStarts, otherV);
if (dotV == NGHolder::null_vertex()) {
DEBUG_PRINTF("no candidate reformable dot found.\n");
return;
@@ -268,9 +268,9 @@ void reformUnanchoredRepeatsComponent(NGHolder &g,
}
while (true) {
NFAVertex dotV = NGHolder::null_vertex();
set<NFAVertex> otherV;
dotV = findReformable(g, compUnanchoredStarts, otherV);
NFAVertex dotV = findReformable(g, compUnanchoredStarts, otherV);
if (dotV == NGHolder::null_vertex()) {
DEBUG_PRINTF("no candidate reformable dot found.\n");
return;

View File

@@ -1292,8 +1292,8 @@ bool doTreePlanningIntl(NGHolder &g,
DEBUG_PRINTF("add mapped reporters for region %u\n", it->first);
addMappedReporterVertices(it->second, g, copy_to_orig,
plan.back().reporters);
} while (it->second.optional && it != info.rend() &&
(++it)->first > furthest->first);
} while (it != info.rend() && it->second.optional &&
(++it)->first > furthest->first);
return true;
}
@@ -1551,7 +1551,7 @@ bool doSomPlanning(NGHolder &g, bool stuck_in,
DEBUG_PRINTF("region %u contributes reporters to last plan\n",
it->first);
addReporterVertices(it->second, g, plan.back().reporters);
} while (it->second.optional && it != info.rend() &&
} while (it != info.rend() && it->second.optional &&
(++it)->first > furthest->first);
DEBUG_PRINTF("done!\n");

View File

@@ -320,7 +320,7 @@ void ComponentRepeat::wireRepeats(GlushkovBuildState &bs) {
}
}
DEBUG_PRINTF("wiring up %d optional repeats\n", copies - m_min);
DEBUG_PRINTF("wiring up %u optional repeats\n", copies - m_min);
for (u32 rep = MAX(m_min, 1); rep < copies; rep++) {
vector<PositionInfo> lasts = m_lasts[rep - 1];
if (rep != m_min) {