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

Bug/cppcheck errors WIP
This commit is contained in:
Konstantinos Margaritis 2024-04-24 10:55:51 +03:00 committed by GitHub
commit 08942348c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 11 additions and 10 deletions

View File

@ -321,7 +321,7 @@ struct DAccelScheme {
bool cd_a = buildDvermMask(a.double_byte);
bool cd_b = buildDvermMask(b.double_byte);
if (cd_a != cd_b) {
return cd_a > cd_b;
return cd_a;
}
}

View File

@ -589,7 +589,7 @@ void getHighlanderReporters(const NGHolder &g, const NFAVertex accept,
verts.insert(v);
next_vertex:
continue;
;
}
}

View File

@ -314,7 +314,7 @@ void duplicateReport(NGHolder &g, ReportID r_old, ReportID r_new);
/** Construct a reversed copy of an arbitrary NGHolder, mapping starts to
* accepts. */
void reverseHolder(const NGHolder &g, NGHolder &out);
void reverseHolder(const NGHolder &g_in, NGHolder &g);
/** \brief Returns the delay or ~0U if the graph cannot match with
* the trailing literal. */

View File

@ -284,7 +284,7 @@ void ParsedLogical::parseLogicalCombination(unsigned id, const char *logical,
if (logical[i] == '(') {
paren += 1;
} else if (logical[i] == ')') {
if (paren <= 0) {
if (paren == 0) {
throw LocatedParseError("Not enough left parentheses");
}
paren -= 1;

View File

@ -1599,7 +1599,8 @@ void dedupeLeftfixesVariableLag(RoseBuildImpl &build) {
continue;
}
}
engine_groups[DedupeLeftKey(build, std::move(preds), left)].emplace_back(left);
auto preds_copy = std::move(preds);
engine_groups[DedupeLeftKey(build, preds_copy , left)].emplace_back(left);
}
/* We don't bother chunking as we expect deduping to be successful if the

View File

@ -68,7 +68,7 @@ namespace ue2 {
#endif
void *aligned_malloc_internal(size_t size, size_t align) {
void *mem;
void *mem= nullptr;;
int rv = posix_memalign(&mem, align, size);
if (rv != 0) {
DEBUG_PRINTF("posix_memalign returned %d when asked for %zu bytes\n",

View File

@ -102,9 +102,9 @@ public:
using category = boost::read_write_property_map_tag;
small_color_map(size_t n_in, const IndexMap &index_map_in)
: n(n_in), index_map(index_map_in) {
size_t num_bytes = (n + entries_per_byte - 1) / entries_per_byte;
data = std::make_shared<std::vector<unsigned char>>(num_bytes);
: n(n_in),
index_map(index_map_in),
data(std::make_shared<std::vector<unsigned char>>((n_in + entries_per_byte - 1) / entries_per_byte)) {
fill(small_color::white);
}