Skip to content

Commit

Permalink
Fix AppleClang warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
petervwyatt committed Sep 30, 2021
1 parent e49ff03 commit 99d744d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
9 changes: 6 additions & 3 deletions TestGrammar/src/CheckGrammar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,17 +407,20 @@ void ValidateGrammarFolder(const fs::path& grammar_folder, bool verbose, std::os
std::string all_links = remove_link_predicates(vc[TSV_LINK]);
if (all_links != "") {
std::vector<std::string> links = split(all_links, ';');
for (auto& type_link : links)
if ((type_link != "") && (type_link != "[]"))
for (auto& type_link : links) {
if ((type_link != "") && (type_link != "[]")) {
if ((type_link[0] == '[') && type_link[type_link.size()-1] == ']') {
std::vector<std::string> direct_links = split(type_link.substr(1, type_link.size() - 2), ','); // strip [ and ] then split by COMMA
for (auto& lnk : direct_links)
if (lnk != "")
if (lnk != "") {
to_process.push_back(lnk + ".tsv");
}
}
else {
ofs << "Error: " << gfile << " has bad link '" << type_link << "' - missing enclosing [ ]" << std::endl;
}
}
} // for
}
} // for
}
Expand Down
2 changes: 2 additions & 0 deletions TestGrammar/src/PredicateProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,8 @@ bool check_key_value(ArlPDFDictionary* dict, const std::wstring& key, const std:
if (val == i)
return true;
break;
default: /* fallthrough */
break;
} // switch
}
return false;
Expand Down
9 changes: 6 additions & 3 deletions TestGrammar/src/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,15 +368,18 @@ bool check_valid_array_definition(const std::string& fname, const std::vector<st
assert(keys.size() > 0);

// Trivial cases special-cased
if (keys.size() == 1)
if ((keys[0] == "*") || (keys[0] == "0"))
if (keys.size() == 1) {
if ((keys[0] == "*") || (keys[0] == "0")) {
return true;
}
else if (keys[0] == "0*") {
ofs << "Warning: single element array with '0*' should use '*' " << fname << std::endl;
return true;
}
else
else {
return false;
}
}

int idx;
int first_wildcard = -1;
Expand Down

0 comments on commit 99d744d

Please sign in to comment.