Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
VioletXF committed May 1, 2024
1 parent 65df464 commit bb213ab
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CC=g++
CCFLAGS=-std=c++17 -O2 -DBMS_PARSER_VERBOSE=0
CCFLAGS=-Wall -Werror -std=c++17 -O2 -DBMS_PARSER_VERBOSE=0
SRC_FILES = $(wildcard src/*.cpp)
OBJ_PATH=obj
BUILD_PATH=build
Expand Down
6 changes: 3 additions & 3 deletions src/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ namespace bms_parser
}

const auto dataCount = data.length() / 2;
for (auto j = 0; j < dataCount; ++j)
for (size_t j = 0; j < dataCount; ++j)
{
if (bCancelled)
{
Expand Down Expand Up @@ -1150,7 +1150,7 @@ namespace bms_parser
inline int Parser::ParseHex(std::wstring_view Str)
{
auto result = 0;
for (auto i = 0; i < Str.length(); ++i)
for (size_t i = 0; i < Str.length(); ++i)
{
auto c = Str[i];
if (c >= '0' && c <= '9')
Expand All @@ -1177,7 +1177,7 @@ namespace bms_parser
}

auto result = 0;
for (auto i = 0; i < Str.length(); ++i)
for (size_t i = 0; i < Str.length(); ++i)
{
auto c = Str[i];
if (c >= '0' && c <= '9')
Expand Down
2 changes: 1 addition & 1 deletion src/SHA256.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ namespace bms_parser

char buf[2 * SHA256::DIGEST_SIZE + 1];
buf[2 * SHA256::DIGEST_SIZE] = 0;
for (int i = 0; i < SHA256::DIGEST_SIZE; i++)
for (unsigned int i = 0; i < SHA256::DIGEST_SIZE; i++)
{
sprintf(buf + i * 2, "%02x", digest[i]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ShiftJISConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "ShiftJISConverter.h"
namespace bms_parser
{
void ShiftJISConverter::BytesToUTF8(const unsigned char *input, int size, std::wstring &result)
void ShiftJISConverter::BytesToUTF8(const unsigned char *input, size_t size, std::wstring &result)
{
// ShiftJis won't give 4byte UTF8, so max. 3 byte per input char are needed
result.resize(size * 3, ' ');
Expand Down
4 changes: 2 additions & 2 deletions src/ShiftJISConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace bms_parser
{
namespace ShiftJISConverter
{
void BytesToUTF8(const unsigned char *input, int size, std::wstring &result);
void BytesToUTF8(const unsigned char *input, size_t size, std::wstring &result);
}

static const unsigned char shiftJIS_convTable[25088] = {
Expand Down Expand Up @@ -3148,4 +3148,4 @@ namespace bms_parser
0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20,
0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20,
};
}
}
4 changes: 2 additions & 2 deletions src/md5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ namespace bms_parser
// F, G, H and I are basic MD5 functions.
inline MD5::uint4 MD5::F(uint4 x, uint4 y, uint4 z)
{
return x & y | ~x & z;
return (x & y) | (~x & z);
}

inline MD5::uint4 MD5::G(uint4 x, uint4 y, uint4 z)
{
return x & z | y & ~z;
return (x & z) | (y & ~z);
}

inline MD5::uint4 MD5::H(uint4 x, uint4 y, uint4 z)
Expand Down

0 comments on commit bb213ab

Please sign in to comment.