mirror of
https://github.com/Rosalie241/RMG.git
synced 2026-09-08 05:12:44 +02:00
RMG-Core: minor code fixes
This commit is contained in:
@@ -175,7 +175,7 @@ static std::string join_split_string(std::vector<std::string> splitStr, char sep
|
||||
std::string joinedString;
|
||||
std::string element;
|
||||
int skippedElements = 0;
|
||||
for (int i = 0; i < splitStr.size(); i++)
|
||||
for (uint32_t i = 0; i < splitStr.size(); i++)
|
||||
{
|
||||
// allow for skipping elements
|
||||
if (skippedElements++ < skip)
|
||||
@@ -201,7 +201,7 @@ static bool parse_cheat(std::vector<std::string> lines, int startIndex, CoreChea
|
||||
{
|
||||
std::string error;
|
||||
std::string line;
|
||||
for (int i = startIndex; i < lines.size(); i++)
|
||||
for (uint32_t i = startIndex; i < lines.size(); i++)
|
||||
{
|
||||
line = lines.at(i);
|
||||
|
||||
@@ -340,7 +340,7 @@ static bool parse_cheat_file(std::vector<std::string> lines, CoreCheatFile& chea
|
||||
bool readHeader = false;
|
||||
bool readHeaderName = false;
|
||||
|
||||
for (int index = 0; index < lines.size(); index++)
|
||||
for (uint32_t index = 0; index < lines.size(); index++)
|
||||
{
|
||||
line = lines.at(index);
|
||||
|
||||
@@ -911,7 +911,7 @@ bool CoreGetCheatOption(CoreCheat cheat, CoreCheatOption& option)
|
||||
|
||||
for (CoreCheatOption& cheatOption : cheat.CheatOptions)
|
||||
{
|
||||
if (cheatOption.Value == value)
|
||||
if (cheatOption.Value == (uint32_t)value)
|
||||
{
|
||||
option = cheatOption;
|
||||
return true;
|
||||
|
||||
@@ -27,7 +27,6 @@ std::string CoreConvertStringEncoding(std::string str, CoreStringEncoding encodi
|
||||
|
||||
iconv_t cd;
|
||||
|
||||
char inputBuf[256] = {0};
|
||||
char outputBuf[256] = {0};
|
||||
|
||||
char* inputBufPtr = (char*)str.c_str();
|
||||
@@ -56,7 +55,7 @@ std::string CoreConvertStringEncoding(std::string str, CoreStringEncoding encodi
|
||||
}
|
||||
|
||||
size_t ret = iconv(cd, &inputBufPtr, &inputBufSize, &outputBufPtr, &outputBufSize);
|
||||
if (ret == -1)
|
||||
if (ret == (size_t)-1)
|
||||
{
|
||||
error = "CoreConvertStringEncoding Failed: ";
|
||||
error += "iconv Failed: ";
|
||||
|
||||
@@ -138,8 +138,6 @@ static bool read_zip_file(std::filesystem::path file, std::filesystem::path* ext
|
||||
{
|
||||
std::string error;
|
||||
std::fstream fileStream;
|
||||
int fileStreamLen;
|
||||
char* fileStreamBuf;
|
||||
|
||||
unzFile zipFile;
|
||||
unz_global_info64 zipInfo;
|
||||
@@ -181,7 +179,7 @@ static bool read_zip_file(std::filesystem::path file, std::filesystem::path* ext
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < zipInfo.number_entry; i++)
|
||||
for (uint64_t i = 0; i < zipInfo.number_entry; i++)
|
||||
{
|
||||
unz_file_info fileInfo;
|
||||
char fileName[PATH_MAX];
|
||||
@@ -377,7 +375,7 @@ static bool read_7zip_file(std::filesystem::path file, std::filesystem::path* ex
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < db.NumFiles; i++)
|
||||
for (uint32_t i = 0; i < db.NumFiles; i++)
|
||||
{
|
||||
size_t filename_size = 0;
|
||||
uint16_t fileName[PATH_MAX];
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
// replaces all occurences of any chars in replace with c inside str
|
||||
static void str_replace_chars(std::string& str, const std::string replace, const char c)
|
||||
{
|
||||
for (int i = 0; i < str.size(); i++)
|
||||
for (uint32_t i = 0; i < str.size(); i++)
|
||||
{
|
||||
char str_char = str.at(i);
|
||||
if (replace.find(str_char) != std::string::npos)
|
||||
|
||||
@@ -1495,7 +1495,7 @@ static bool config_option_default_set(std::string section, std::string key, m64p
|
||||
|
||||
static bool int_list_to_string(std::vector<int> intList, std::string& string)
|
||||
{
|
||||
for (int i = 0; i < intList.size(); i++)
|
||||
for (uint32_t i = 0; i < intList.size(); i++)
|
||||
{
|
||||
int num = intList.at(i);
|
||||
string += std::to_string(num);
|
||||
@@ -1539,7 +1539,7 @@ static bool string_list_to_string(std::vector<std::string> stringList, std::stri
|
||||
{
|
||||
std::string error;
|
||||
|
||||
for (int i = 0; i < stringList.size(); i++)
|
||||
for (uint32_t i = 0; i < stringList.size(); i++)
|
||||
{
|
||||
std::string str = stringList.at(i);
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ bool CoreUnzip(std::filesystem::path file, std::filesystem::path path)
|
||||
unz_global_info zipInfo;
|
||||
std::ofstream outputStream;
|
||||
char* read_buffer = (char*)malloc(UNZIP_READ_SIZE);
|
||||
size_t bytes_read = 0;
|
||||
int bytes_read = 0;
|
||||
|
||||
if (read_buffer == nullptr)
|
||||
{
|
||||
@@ -60,7 +60,7 @@ bool CoreUnzip(std::filesystem::path file, std::filesystem::path path)
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < zipInfo.number_entry; i++)
|
||||
for (uint64_t i = 0; i < zipInfo.number_entry; i++)
|
||||
{
|
||||
unz_file_info fileInfo;
|
||||
char fileName[PATH_MAX];
|
||||
|
||||
Reference in New Issue
Block a user