mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-24 05:19:02 +08:00
Persistently fixing some PVS-Studio static analyzer false positive warnings.
This commit is contained in:
parent
ee3b4f2bf1
commit
4e8e177cac
@ -882,7 +882,7 @@ static void ShowDemoWindowWidgets()
|
||||
// Note: We _unnecessarily_ test for both x/y and i here only to silence some static analyzer. The second part of each test is unnecessary.
|
||||
int x = i % 4;
|
||||
int y = i / 4;
|
||||
if (x > 0 && i > 0) { selected[i - 1] ^= 1; }
|
||||
if (x > 0) { selected[i - 1] ^= 1; }
|
||||
if (x < 3 && i < 15) { selected[i + 1] ^= 1; }
|
||||
if (y > 0 && i > 3) { selected[i - 4] ^= 1; }
|
||||
if (y < 3 && i < 12) { selected[i + 4] ^= 1; }
|
||||
|
@ -689,7 +689,7 @@ void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32
|
||||
PrimReserve(idx_count, vtx_count);
|
||||
|
||||
// Temporary buffer
|
||||
ImVec2* temp_normals = (ImVec2*)alloca(points_count * (thick_line ? 5 : 3) * sizeof(ImVec2));
|
||||
ImVec2* temp_normals = (ImVec2*)alloca(points_count * (thick_line ? 5 : 3) * sizeof(ImVec2)); //-V630
|
||||
ImVec2* temp_points = temp_normals + points_count;
|
||||
|
||||
for (int i1 = 0; i1 < count; i1++)
|
||||
@ -880,7 +880,7 @@ void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_coun
|
||||
}
|
||||
|
||||
// Compute normals
|
||||
ImVec2* temp_normals = (ImVec2*)alloca(points_count * sizeof(ImVec2));
|
||||
ImVec2* temp_normals = (ImVec2*)alloca(points_count * sizeof(ImVec2)); //-V630
|
||||
for (int i0 = points_count-1, i1 = 0; i1 < points_count; i0 = i1++)
|
||||
{
|
||||
const ImVec2& p0 = points[i0];
|
||||
|
@ -4007,7 +4007,7 @@ bool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flag
|
||||
{
|
||||
if (const ImGuiPayload* payload = AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_3F))
|
||||
{
|
||||
memcpy((float*)col, payload->Data, sizeof(float) * 3); // Preserve alpha if any
|
||||
memcpy((float*)col, payload->Data, sizeof(float) * 3); // Preserve alpha if any //-V512
|
||||
value_changed = true;
|
||||
}
|
||||
if (const ImGuiPayload* payload = AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_4F))
|
||||
@ -5485,7 +5485,7 @@ bool ImGui::BeginMainMenuBar()
|
||||
End();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return true; //-V1020
|
||||
}
|
||||
|
||||
void ImGui::EndMainMenuBar()
|
||||
|
@ -1828,7 +1828,7 @@ static int stbtt__GetGlyphShapeTT(const stbtt_fontinfo *info, int glyph_index, s
|
||||
if (comp_verts) STBTT_free(comp_verts, info->userdata);
|
||||
return 0;
|
||||
}
|
||||
if (num_vertices > 0) STBTT_memcpy(tmp, vertices, num_vertices*sizeof(stbtt_vertex));
|
||||
if (num_vertices > 0) STBTT_memcpy(tmp, vertices, num_vertices*sizeof(stbtt_vertex)); //-V595
|
||||
STBTT_memcpy(tmp+num_vertices, comp_verts, comp_num_verts*sizeof(stbtt_vertex));
|
||||
if (vertices) STBTT_free(vertices, info->userdata);
|
||||
vertices = tmp;
|
||||
@ -2199,7 +2199,7 @@ static int stbtt__run_charstring(const stbtt_fontinfo *info, int glyph_index, st
|
||||
} break;
|
||||
|
||||
default:
|
||||
if (b0 != 255 && b0 != 28 && (b0 < 32 || b0 > 254))
|
||||
if (b0 != 255 && b0 != 28 && (b0 < 32 || b0 > 254)) //-V560
|
||||
return STBTT__CSERR("reserved operator");
|
||||
|
||||
// push immediate
|
||||
|
Loading…
Reference in New Issue
Block a user