mirror of
https://github.com/ScrelliCopter/tmx2gba.git
synced 2025-02-21 03:29:25 +11:00
clang warning pass
This commit is contained in:
@@ -15,9 +15,9 @@ set_target_properties(tmx2gba PROPERTIES
|
||||
|
||||
# Enable strong warnings
|
||||
target_compile_options(tmx2gba PRIVATE
|
||||
$<$<CXX_COMPILER_ID:MSVC>:/Wall>
|
||||
$<$<CXX_COMPILER_ID:MSVC>:/Wall>
|
||||
$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-Wall -Wextra -pedantic>
|
||||
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Weverything>)
|
||||
$<$<CXX_COMPILER_ID:Clang,AppleClang>:-Weverything -Wno-c++98-compat>)
|
||||
|
||||
target_link_libraries(tmx2gba
|
||||
External::base64
|
||||
|
||||
@@ -151,8 +151,6 @@ bool ArgParse::ArgParser::CheckParse(ArgParse::ParseErr err) const
|
||||
case ParseErr::ARG_RANGE:
|
||||
DisplayError("Argument out of range.", false);
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,18 +16,18 @@ namespace ArgParse
|
||||
{
|
||||
struct Option
|
||||
{
|
||||
char flag;
|
||||
bool required;
|
||||
const char* argumentName;
|
||||
const char* helpString;
|
||||
char flag;
|
||||
bool required;
|
||||
|
||||
static constexpr Option Optional(char flag, const char* name, const char* help)
|
||||
{
|
||||
return { flag, false, name, help };
|
||||
return { name, help, flag, false };
|
||||
}
|
||||
static constexpr Option Required(char flag, const char* name, const char* help)
|
||||
{
|
||||
return { flag, true, name, help };
|
||||
return { name, help, flag, false };
|
||||
}
|
||||
};
|
||||
|
||||
@@ -66,10 +66,10 @@ namespace ArgParse
|
||||
|
||||
class ParserState
|
||||
{
|
||||
bool expectArg = false;
|
||||
int flagChar;
|
||||
HandleOption handler;
|
||||
const Options& options;
|
||||
int flagChar;
|
||||
bool expectArg = false;
|
||||
|
||||
public:
|
||||
ParserState(HandleOption handler, const Options& options) noexcept
|
||||
|
||||
@@ -37,7 +37,7 @@ class SWriter
|
||||
if (col == 0)
|
||||
aOut << "\t" << GccIsDumb::DatType<T>() << " ";
|
||||
|
||||
aOut << std::hex << (int)element;
|
||||
aOut << std::hex << static_cast<int>(element);
|
||||
|
||||
if (i < aDat.size() - 1)
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
const std::string versionStr = "tmx2gba version 0.3, (c) 2015-2022 a dinosaur";
|
||||
static const char* versionStr = "tmx2gba version 0.3, (c) 2015-2022 a dinosaur";
|
||||
|
||||
struct Arguments
|
||||
{
|
||||
@@ -195,7 +195,9 @@ int main(int argc, char** argv)
|
||||
|
||||
// Get name from file
|
||||
//TODO: properly sanitise
|
||||
int slashPos = std::max((int)p.outPath.find_last_of('/'), (int)p.outPath.find_last_of('\\'));
|
||||
int slashPos = std::max(
|
||||
static_cast<int>(p.outPath.find_last_of('/')),
|
||||
static_cast<int>(p.outPath.find_last_of('\\')));
|
||||
std::string name = p.outPath;
|
||||
if (slashPos != -1)
|
||||
name = name.substr(slashPos + 1);
|
||||
@@ -223,7 +225,7 @@ int main(int argc, char** argv)
|
||||
{
|
||||
uint32_t read = (*gfxTiles++);
|
||||
|
||||
uint16_t tile = (uint16_t)std::max<int32_t>(0, tmx.LidFromGid(read & ~TmxLayer::FLIP_MASK) + p.offset);
|
||||
uint16_t tile = std::max<uint16_t>(0, tmx.LidFromGid(read & ~TmxLayer::FLIP_MASK) + p.offset);
|
||||
uint8_t flags = 0x0;
|
||||
|
||||
// Get flipped!
|
||||
@@ -255,7 +257,7 @@ int main(int argc, char** argv)
|
||||
gfxTiles = layerCls->GetData();
|
||||
for (int i = 0; i < layerCls->GetWidth() * layerCls->GetHeight(); ++i)
|
||||
{
|
||||
uint8_t ucTile = (uint8_t)tmx.LidFromGid((*gfxTiles++) & ~TmxLayer::FLIP_MASK);
|
||||
uint8_t ucTile = static_cast<uint8_t>(tmx.LidFromGid((*gfxTiles++) & ~TmxLayer::FLIP_MASK));
|
||||
collisionDat.push_back(ucTile);
|
||||
}
|
||||
|
||||
@@ -285,8 +287,8 @@ int main(int argc, char** argv)
|
||||
float x, y;
|
||||
obj->GetPos(x, y);
|
||||
objDat.push_back(it->second);
|
||||
objDat.push_back((int)(x * 256.0f));
|
||||
objDat.push_back((int)(y * 256.0f));
|
||||
objDat.push_back(static_cast<int>(x * 256.0f));
|
||||
objDat.push_back(static_cast<int>(y * 256.0f));
|
||||
}
|
||||
|
||||
// Write objects
|
||||
|
||||
@@ -43,7 +43,7 @@ bool TmxReader::DecodeMap(uint32_t* aOut, size_t aOutSize, const std::string& aB
|
||||
// Decompress compressed data
|
||||
auto dstSize = static_cast<mz_ulong>(aOutSize);
|
||||
int res = uncompress(
|
||||
(unsigned char*)aOut,
|
||||
reinterpret_cast<unsigned char*>(aOut),
|
||||
&dstSize,
|
||||
reinterpret_cast<const unsigned char*>(decoded.data()),
|
||||
static_cast<mz_ulong>(decoded.size()));
|
||||
@@ -172,7 +172,7 @@ void TmxReader::Open(std::istream& aIn)
|
||||
|
||||
// Parse document
|
||||
rapidxml::xml_document<> xDoc;
|
||||
xDoc.parse<0>((char*)strXml.c_str());
|
||||
xDoc.parse<0>(const_cast<char*>(strXml.c_str()));
|
||||
|
||||
// Get map node
|
||||
auto xMap = xDoc.first_node("map");
|
||||
|
||||
@@ -23,7 +23,6 @@ private:
|
||||
std::string mName;
|
||||
std::string mSource;
|
||||
uint32_t mFirstGid;
|
||||
|
||||
};
|
||||
|
||||
#endif//TMXTILESET_HPP
|
||||
|
||||
Reference in New Issue
Block a user