Skip to content

Commit

Permalink
RMG-Core: use int instead of int32_t for CoreStringToInt()
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosalie241 committed Feb 25, 2025
1 parent 88a6685 commit 4416343
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Source/RMG-Core/String.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ std::string CoreLowerString(std::string str)
return resultString;
}

bool CoreStringToInt(std::string str, int32_t& num)
bool CoreStringToInt(std::string str, int& num)
{
char* endptr;
num = (int32_t)std::strtol(str.c_str(), &endptr, 10);
num = (int)std::strtol(str.c_str(), &endptr, 10);
return errno != ERANGE && endptr == (str.c_str() + str.size());
}

3 changes: 1 addition & 2 deletions Source/RMG-Core/String.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
#ifndef CORE_STRING_HPP
#define CORE_STRING_HPP

#include <cstdint>
#include <string>

// returns lowercase string
std::string CoreLowerString(std::string str);

// attempts to parse int32_t from string
bool CoreStringToInt(std::string str, int32_t& num);
bool CoreStringToInt(std::string str, int& num);

#endif // CORE_STRING_HPP

0 comments on commit 4416343

Please sign in to comment.