cmake+ci: run clang-tidy (#512)

* cmake+ci: run clang-tidy

* Remove DESCRIPTION from LEGO1/LegoOmni.mingw.def

* Add initial .clang-tidy and fixes

* fix file perms

* Comment out DESCRIPTION

* Remove LegoEntity::~LegoEntity and MxPresenter::~MxPresenter from mingw's LEGO1.def

* Looks like clang is allergic to the libs in the directx5 SDK

* Update .clang-tidy

* Fix typo in .clang-tidy

* Attempt to generate an action error

* Revert "Attempt to generate an action error"

This reverts commit 96c4c65fed.

* cmake: test with -Wparentheses + optionally with -Werror

* ci: -k0 is a Ninja argument

* Use -Werror only for msys2 builds

* cmake: only emit warnings for specific warnings

* cmake: and don't do -Werror/-WX anymore

* Fix warnings

* Fix mingw warnings

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Anonymous Maarten
2024-02-01 21:42:10 +01:00
committed by GitHub
parent 97d1ba7c71
commit 9e686e2a87
308 changed files with 2863 additions and 1995 deletions

View File

@@ -25,12 +25,15 @@ MxBitmap::MxBitmap()
// FUNCTION: LEGO1 0x100bca10
MxBitmap::~MxBitmap()
{
if (this->m_info)
if (this->m_info) {
delete m_info;
if (this->m_data)
}
if (this->m_data) {
delete m_data;
if (this->m_palette)
}
if (this->m_palette) {
delete m_palette;
}
}
// FUNCTION: LEGO1 0x100bcaa0
@@ -152,11 +155,13 @@ MxLong MxBitmap::Read(const char* p_filename)
HANDLE handle =
CreateFileA(p_filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (handle != INVALID_HANDLE_VALUE && !LoadFile(handle))
if (handle != INVALID_HANDLE_VALUE && !LoadFile(handle)) {
result = SUCCESS;
}
if (handle)
if (handle) {
CloseHandle(handle);
}
return result;
}
@@ -280,8 +285,9 @@ void MxBitmap::BitBltTransparent(
for (MxS32 h = 0; h < p_height; h++) {
for (MxS32 w = 0; w < p_width; w++) {
if (*srcStart)
if (*srcStart) {
*dstStart = *srcStart;
}
srcStart++;
dstStart++;
}
@@ -302,15 +308,17 @@ MxPalette* MxBitmap::CreatePalette()
case FALSE:
palette = new MxPalette(this->m_paletteData);
if (!palette)
if (!palette) {
goto done;
}
break;
case TRUE:
palette = this->m_palette->Clone();
if (!palette)
if (!palette) {
goto done;
}
break;
default:
@@ -361,8 +369,9 @@ MxResult MxBitmap::SetBitDepth(MxBool p_isHighColor)
switch (p_isHighColor) {
case FALSE:
ImportColorsToPalette(m_paletteData, m_palette);
if (m_palette)
if (m_palette) {
delete m_palette;
}
m_palette = NULL;
break;
@@ -370,8 +379,9 @@ MxResult MxBitmap::SetBitDepth(MxBool p_isHighColor)
pal = NULL;
pal = new MxPalette(m_paletteData);
if (!pal)
if (!pal) {
goto done;
}
m_palette = pal;
@@ -392,8 +402,9 @@ MxResult MxBitmap::SetBitDepth(MxBool p_isHighColor)
done:
// If we were unsuccessful overall but did manage to alloc
// the MxPalette, free it.
if (ret && pal)
if (ret && pal) {
delete pal;
}
return ret;
}
@@ -438,13 +449,15 @@ MxResult MxBitmap::ImportColorsToPalette(RGBQUAD* p_rgbquad, MxPalette* p_palett
PALETTEENTRY entries[256];
if (p_palette) {
if (p_palette->GetEntries(entries))
if (p_palette->GetEntries(entries)) {
goto done;
}
}
else {
MxPalette palette;
if (palette.GetEntries(entries))
if (palette.GetEntries(entries)) {
goto done;
}
}
MxS32 i;