Skip to content

glib-compile-resources: Fix generated code compiling with C++ compilers

Philip Withnall requested to merge pwithnall/glib:compile-resources-cxx into master

With 0d685b49, we now encode resource data as a string. Strings have trailing nul terminators. A C compiler will happily ignore the fact that the nul terminator exceeds the stated array length, and will drop it — but a C++ compiler won’t, and will raise:

error: initializer-string for array of chars is too long [-fpermissive]

Fix that by increasing the array length by 1, and subtracting it again in the GStaticResource struct.

Signed-off-by: Philip Withnall withnall@endlessm.com


This fixes a build failure with VTE.

Merge request reports