build: aïlla la implementació de stb_image_write en un TU propi
screenshot.cpp ara només inclou les declaracions de stb_image_write.h; la macro STB_IMAGE_WRITE_IMPLEMENTATION viu a un .cpp nou dins de source/external/, que ja està exclòs del pre-commit hook (clang-format i clang-tidy) i cobert pel seu .clang-tidy amb Checks: '-*'. Així podem retirar la desactivació global de clang-analyzer-optin.portability .UnixAPI i el check queda actiu arreu del nostre propi codi.
This commit is contained in:
1 parent
dc8a7723e3
commit
6c1c042637
4 files changed
+17
-8
No files matched your search
@@ -7,7 +7,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
||||
#include "external/stb_image_write.h"
|
||||
|
||||
namespace Screenshot {
|
||||
@@ -43,7 +42,6 @@ namespace Screenshot {
|
||||
const std::uint32_t B = P & 0xFF;
|
||||
buffer[i] = R | (G << 8) | (B << 16) | (A << 24);
|
||||
}
|
||||
// NOLINTNEXTLINE(clang-analyzer-optin.portability.UnixAPI) — fals positiu dins de stb_image_write
|
||||
return stbi_write_png(filepath.c_str(), width, height, 4, buffer, width * 4) != 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user