warning message

37 views
Skip to first unread message

craste...@gmail.com

unread,
Oct 15, 2023, 9:36:08 PM10/15/23
to emscripten-discuss
I am seeing an annoying warning by the emscripten compiler, that the MSVC compiler doesn't give.

It has to do with some code that is calling a function that takes (const char[]) as a parameter while the variable being fed to it is a (const char*).

MSVC is fine with that, and emscripten is too. (it compiles)
But emscripten gives a series of ugly warnings about this being "unsafe".

I tried casting the char pointer to a (const char[]) but then MSVC was unhappy about that.

Can you think of an alternate approach?
I don't have to do anything about this, but the warnings are ugly and annoying.

craste...@gmail.com

unread,
Oct 16, 2023, 9:04:46 AM10/16/23
to emscripten-discuss
Warning is:

./Components/Igc.Bdl.Lib/Renderer.cpp:120:19: warning: format string is not a string literal (potentially insecure) [-Wformat-security]

         SkDebugf((const char*)u32ToStringAsHex(*((uint32_t*)(matrix_values + 4))).c_str());

                        ^            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Jukka Jylänki

unread,
Oct 16, 2023, 11:54:29 AM10/16/23
to emscripte...@googlegroups.com
Try

Debug("%s", (const char*)u32ToStringAsHex(*((uint32_t*)(matrix_values + 4))).c_str());

if that helps?

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/d72d7f53-e05d-462c-a616-c814bdbc9551n%40googlegroups.com.

craste...@gmail.com

unread,
Oct 16, 2023, 12:13:20 PM10/16/23
to emscripten-discuss
You are a gentleman and a scholar sir.
That worked.

Reply all
Reply to author
Forward
0 new messages