Use the size_t type instead of "unsigned long" for variables that hold the result of a find() call

This commit is contained in:
Username404-59 2021-12-15 13:31:39 +01:00
parent 07d836da64
commit 77d984cb45
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
2 changed files with 4 additions and 4 deletions

View File

@ -26,7 +26,7 @@ class ArgumentAssignable: public Argument {
vector<string_view> values;
public:
static string_view getValueFor(const string_view& str) {
unsigned long definePos = str.find_last_of('=') + 1;
const size_t definePos = str.find_last_of('=') + 1;
return str.size() > definePos ? str.substr(definePos) : string_view();
}
ArgumentAssignable(string name, const span<string_view>& possibleValues): Argument(move(name)), values() {

View File

@ -64,11 +64,11 @@ int main(int argc, char* argv[]) {
try {
resultingPair.first = compile(fileName);
} catch (const Yerbacon::Exception& error) {
unsigned long lastSlash = 0;
const unsigned long position1 = fileName.find_last_of('/');
size_t lastSlash = 0;
const size_t position1 = fileName.find_last_of('/');
if (cmp_not_equal(position1, string_view::npos)) lastSlash = position1;
if constexpr(filesystem::path::preferred_separator != '/') {
const unsigned long position2 = fileName.find_last_of(filesystem::path::preferred_separator);
const size_t position2 = fileName.find_last_of(filesystem::path::preferred_separator);
if (cmp_not_equal(position2, string_view::npos)) {
lastSlash = max(lastSlash, position2);
}