Added Werror=format to catch errors in printf formatting
diff --git a/build/premake5.lua b/build/premake5.lua index 70a4d2a..6e1c83c 100644 --- a/build/premake5.lua +++ b/build/premake5.lua
@@ -11,7 +11,7 @@ files {"../src/**.cpp"} - buildoptions {"-Wall", "-fno-exceptions", "-fno-rtti"} + buildoptions {"-Wall", "-fno-exceptions", "-fno-rtti", "-Werror=format"} filter "system:windows" defines {"_USE_MATH_DEFINES"}
diff --git a/src/file.cpp b/src/file.cpp index 009da9e..976daf6 100644 --- a/src/file.cpp +++ b/src/file.cpp
@@ -25,6 +25,17 @@ // Default namespace for Rive Cpp code using namespace rive; +#if !defined(RIVE_FMT_U64) + #if defined(__ANDROID__) + #define RIVE_FMT_U64 "%llu" + #define RIVE_FMT_I64 "%lld" + #else + #include <inttypes.h> + #define RIVE_FMT_U64 "%" PRIu64 + #define RIVE_FMT_I64 "%" PRId64 + #endif +#endif + // Import a single Rive runtime object. // Used by the file importer. static Core* readRuntimeObject(BinaryReader& reader, @@ -62,7 +73,7 @@ // Still couldn't find it, give up. fprintf( stderr, - "Unknown property key %llu, missing from property ToC.\n", + "Unknown property key " RIVE_FMT_U64 ", missing from property ToC.\n", propertyKey); delete object; return nullptr; @@ -88,7 +99,7 @@ if (object == nullptr) { // fprintf(stderr, - // "File contains an unknown object with coreType %llu, which " + // "File contains an unknown object with coreType " RIVE_FMT_U64 ", which " // "this runtime doesn't understand.\n", // coreObjectKey); return nullptr;