Minor tweaks to reduce false positive of PVS Studio static analyzer.

This commit is contained in:
omar
2019-02-06 13:08:30 +01:00
parent 5bdc7d7a6f
commit f366828dd2
5 changed files with 13 additions and 10 deletions

View File

@ -225,7 +225,7 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
for (int n = 0; n < draw_data->CmdListsCount; n++)
{
const ImDrawList* cmd_list = draw_data->CmdLists[n];
const ImDrawIdx* idx_buffer_offset = 0;
size_t idx_buffer_offset = 0;
glBindBuffer(GL_ARRAY_BUFFER, g_VboHandle);
glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)cmd_list->VtxBuffer.Size * sizeof(ImDrawVert), (const GLvoid*)cmd_list->VtxBuffer.Data, GL_STREAM_DRAW);
@ -254,10 +254,10 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data)
// Bind texture, Draw
glBindTexture(GL_TEXTURE_2D, (GLuint)(intptr_t)pcmd->TextureId);
glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer_offset);
glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, (void*)idx_buffer_offset);
}
}
idx_buffer_offset += pcmd->ElemCount;
idx_buffer_offset += pcmd->ElemCount * sizeof(ImDrawIdx);
}
}
glDeleteVertexArrays(1, &vao_handle);