1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-24 07:40:22 +01:00
imgui/misc
Bartosz Taudul 6469b94304
Silence memset warning. (#3505)
Compiling the code as-is results in the following warning:

-->8--
imgui_freetype.cpp:341:72: warning: ‘void* memset(void*, int, size_t)’
        clearing an object of type ‘struct ImFontBuildSrcDataFT’ with no
        trivial copy-assignment; use assignment or value-initialization
        instead [-Wclass-memaccess]
  341 |     memset(src_tmp_array.Data, 0, (size_t)src_tmp_array.size_in_bytes());
      |                                                                        ^
imgui_freetype.cpp:302:8: note: ‘struct ImFontBuildSrcDataFT’ declared here
  302 | struct ImFontBuildSrcDataFT
      |        ^~~~~~~~~~~~~~~~~~~~
--8<--

This is caused by presence of ImVector<> directly in ImFontBuildSrcDataFT data
structure, as well as in the child ImBitVector. Since ImVector<> has a
constructor, the compiler infers that initialization by memset is not valid.
Such initialization is not a bug, however, as the default ImVector<> ctor just
sets the structure data members to 0, which is exactly what the memset does.

Casting the data structure address to void* pointer silences this warning.
2020-10-02 19:12:53 +02:00
..
cpp Fixed stray end of line blanks, added comments in .editorconfig, tweaked some headers. 2020-04-07 14:46:46 +02:00
fonts Misc: Bunch of code formatting changes suggested by a pass running 'astyle' 2020-06-30 16:37:21 +02:00
freetype Silence memset warning. (#3505) 2020-10-02 19:12:53 +02:00
natvis Removed trailing spaces from text files. (#2038, #2299) 2019-01-20 22:23:29 +01:00
single_file Fixed stray end of line blanks, added comments in .editorconfig, tweaked some headers. 2020-04-07 14:46:46 +02:00
README.txt Comments + minor moving 2020-01-11 16:08:17 +01:00

misc/cpp/
  InputText() wrappers for C++ standard library (STL) type: std::string.
  This is also an example of how you may wrap your own similar types.

misc/fonts/
  Fonts loading/merging instructions (e.g. How to handle glyph ranges, how to merge icons fonts).
  Command line tool "binary_to_compressed_c" to create compressed arrays to embed data in source code.
  Suggested fonts and links.

misc/freetype/
  Font atlas builder/rasterizer using FreeType instead of stb_truetype.
  Benefit from better FreeType rasterization, in particular for small fonts.

misc/natvis/
  Natvis file to describe dear imgui types in the Visual Studio debugger.
  With this, types like ImVector<> will be displayed nicely in the debugger.
  You can include this file a Visual Studio project file, or install it in Visual Studio folder.

misc/single_file/
  Single-file header stub.
  We use this to validate compiling all *.cpp files in a same compilation unit.
  Users of that technique (also called "Unity builds") can generally provide this themselves,
  so we don't really recommend you use this in your projects.