|
@@ -1480,27 +1480,27 @@ ImU32 ImHashData(const void* data_p, size_t data_size, ImU32 seed)
|
|
// - If we reach ### in the string we discard the hash so far and reset to the seed.
|
|
// - If we reach ### in the string we discard the hash so far and reset to the seed.
|
|
// - We don't do 'current += 2; continue;' after handling ### to keep the code smaller/faster (measured ~10% diff in Debug build)
|
|
// - We don't do 'current += 2; continue;' after handling ### to keep the code smaller/faster (measured ~10% diff in Debug build)
|
|
// FIXME-OPT: Replace with e.g. FNV1a hash? CRC32 pretty much randomly access 1KB. Need to do proper measurements.
|
|
// FIXME-OPT: Replace with e.g. FNV1a hash? CRC32 pretty much randomly access 1KB. Need to do proper measurements.
|
|
-ImU32 ImHashStr(const char* data, size_t data_size, ImU32 seed)
|
|
|
|
|
|
+ImU32 ImHashStr(const char* data_p, size_t data_size, ImU32 seed)
|
|
{
|
|
{
|
|
seed = ~seed;
|
|
seed = ~seed;
|
|
ImU32 crc = seed;
|
|
ImU32 crc = seed;
|
|
- const unsigned char* src = (const unsigned char*)data;
|
|
|
|
|
|
+ const unsigned char* data = (const unsigned char*)data_p;
|
|
const ImU32* crc32_lut = GCrc32LookupTable;
|
|
const ImU32* crc32_lut = GCrc32LookupTable;
|
|
if (data_size != 0)
|
|
if (data_size != 0)
|
|
{
|
|
{
|
|
while (data_size-- != 0)
|
|
while (data_size-- != 0)
|
|
{
|
|
{
|
|
- unsigned char c = *src++;
|
|
|
|
- if (c == '#' && src[0] == '#' && src[1] == '#')
|
|
|
|
|
|
+ unsigned char c = *data++;
|
|
|
|
+ if (c == '#' && data_size >= 2 && data[0] == '#' && data[1] == '#')
|
|
crc = seed;
|
|
crc = seed;
|
|
crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ c];
|
|
crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ c];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- while (unsigned char c = *src++)
|
|
|
|
|
|
+ while (unsigned char c = *data++)
|
|
{
|
|
{
|
|
- if (c == '#' && src[0] == '#' && src[1] == '#')
|
|
|
|
|
|
+ if (c == '#' && data[0] == '#' && data[1] == '#')
|
|
crc = seed;
|
|
crc = seed;
|
|
crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ c];
|
|
crc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ c];
|
|
}
|
|
}
|
|
@@ -3368,12 +3368,13 @@ void ImGui::NewFrame()
|
|
// (We pass an error message in the assert expression to make it visible to programmers who are not using a debugger, as most assert handlers display their argument)
|
|
// (We pass an error message in the assert expression to make it visible to programmers who are not using a debugger, as most assert handlers display their argument)
|
|
IM_ASSERT(g.Initialized);
|
|
IM_ASSERT(g.Initialized);
|
|
IM_ASSERT((g.IO.DeltaTime > 0.0f || g.FrameCount == 0) && "Need a positive DeltaTime!");
|
|
IM_ASSERT((g.IO.DeltaTime > 0.0f || g.FrameCount == 0) && "Need a positive DeltaTime!");
|
|
|
|
+ IM_ASSERT((g.FrameCount == 0 || g.FrameCountEnded == g.FrameCount) && "Forgot to call Render() or EndFrame() at the end of the previous frame?");
|
|
IM_ASSERT(g.IO.DisplaySize.x >= 0.0f && g.IO.DisplaySize.y >= 0.0f && "Invalid DisplaySize value!");
|
|
IM_ASSERT(g.IO.DisplaySize.x >= 0.0f && g.IO.DisplaySize.y >= 0.0f && "Invalid DisplaySize value!");
|
|
IM_ASSERT(g.IO.Fonts->Fonts.Size > 0 && "Font Atlas not built. Did you call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8() ?");
|
|
IM_ASSERT(g.IO.Fonts->Fonts.Size > 0 && "Font Atlas not built. Did you call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8() ?");
|
|
IM_ASSERT(g.IO.Fonts->Fonts[0]->IsLoaded() && "Font Atlas not built. Did you call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8() ?");
|
|
IM_ASSERT(g.IO.Fonts->Fonts[0]->IsLoaded() && "Font Atlas not built. Did you call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8() ?");
|
|
IM_ASSERT(g.Style.CurveTessellationTol > 0.0f && "Invalid style setting!");
|
|
IM_ASSERT(g.Style.CurveTessellationTol > 0.0f && "Invalid style setting!");
|
|
IM_ASSERT(g.Style.Alpha >= 0.0f && g.Style.Alpha <= 1.0f && "Invalid style setting. Alpha cannot be negative (allows us to avoid a few clamps in color computations)!");
|
|
IM_ASSERT(g.Style.Alpha >= 0.0f && g.Style.Alpha <= 1.0f && "Invalid style setting. Alpha cannot be negative (allows us to avoid a few clamps in color computations)!");
|
|
- IM_ASSERT((g.FrameCount == 0 || g.FrameCountEnded == g.FrameCount) && "Forgot to call Render() or EndFrame() at the end of the previous frame?");
|
|
|
|
|
|
+ IM_ASSERT(g.Style.WindowMinSize.x >= 1.0f && g.Style.WindowMinSize.y >= 1.0f && "Invalid style setting.");
|
|
for (int n = 0; n < ImGuiKey_COUNT; n++)
|
|
for (int n = 0; n < ImGuiKey_COUNT; n++)
|
|
IM_ASSERT(g.IO.KeyMap[n] >= -1 && g.IO.KeyMap[n] < IM_ARRAYSIZE(g.IO.KeysDown) && "io.KeyMap[] contains an out of bound value (need to be 0..512, or -1 for unmapped key)");
|
|
IM_ASSERT(g.IO.KeyMap[n] >= -1 && g.IO.KeyMap[n] < IM_ARRAYSIZE(g.IO.KeysDown) && "io.KeyMap[] contains an out of bound value (need to be 0..512, or -1 for unmapped key)");
|
|
|
|
|