Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix format-security warnings (again) #4721

Merged
merged 2 commits into from
Aug 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMake/unix_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ message(STATUS "Setting Unix configurations")
macro(os_set_flags)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -pedantic -g -D_BSD_SOURCE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -pedantic -g -Wno-missing-field-initializers")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch -Wno-multichar -Wsequence-point -Wformat-security")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch -Wno-multichar -Wsequence-point -Wformat -Wformat-security")

execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpmachine OUTPUT_VARIABLE MACHINE)
if(${MACHINE} MATCHES "arm-linux-gnueabihf")
Expand Down
6 changes: 3 additions & 3 deletions common/model-views.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2408,7 +2408,7 @@ namespace rs2
ImColor(alpha(sensor_bg, 0.1f)));

ImGui::PushStyleColor(ImGuiCol_Text, redish);
ImGui::Text(text);
ImGui::Text("%s", text);
ImGui::PopStyleColor();

line_y += ImGui::GetTextLineHeight() + 3;
Expand All @@ -2425,13 +2425,13 @@ namespace rs2
ImColor(alpha(sensor_bg, 0.1f)));

ImGui::PushStyleColor(ImGuiCol_Text, white);
ImGui::Text(text.c_str()); ImGui::SameLine();
ImGui::Text("%s", text.c_str()); ImGui::SameLine();

if (at.description != "")
{
if (ImGui::IsItemHovered())
{
ImGui::SetTooltip(at.description.c_str());
ImGui::SetTooltip("%s", at.description.c_str());
}
}

Expand Down
2 changes: 1 addition & 1 deletion common/notifications.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ namespace rs2
std::string txt = to_string() << "librealsense " << RS2_API_VERSION_STR << "!";

ImGui::PushStyleColor(ImGuiCol_Text, alpha(white, 1.f - t));
ImGui::Text(txt.c_str());
ImGui::Text("%s", txt.c_str());
ImGui::PopStyleColor();
ImGui::PopFont();

Expand Down
16 changes: 8 additions & 8 deletions common/on-chip-calib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ namespace rs2
ImGui::SetCursorScreenPos({ float(x + 9), float(y + 47) });

ImGui::PushStyleColor(ImGuiCol_Text, white);
ImGui::Text(message.c_str());
ImGui::Text("%s", message.c_str());
ImGui::PopStyleColor();

ImGui::SetCursorScreenPos({ float(x + 9), float(y + 65) });
Expand Down Expand Up @@ -835,7 +835,7 @@ namespace rs2
}
else if (update_state == RS2_CALIB_STATE_FAILED)
{
ImGui::Text(_error_message.c_str());
ImGui::Text("%s", _error_message.c_str());

auto sat = 1.f + sin(duration_cast<milliseconds>(system_clock::now() - created_time).count() / 700.f) * 0.1f;

Expand Down Expand Up @@ -906,19 +906,19 @@ namespace rs2

ImGui::SetCursorScreenPos({ float(x + 12), float(y + 90) });
ImGui::PushFont(win.get_large_font());
ImGui::Text(textual_icons::check);
ImGui::Text("%s", static_cast<const char *>(textual_icons::check));
ImGui::PopFont();

ImGui::SetCursorScreenPos({ float(x + 35), float(y + 92) });
ImGui::Text(txt.c_str());
ImGui::Text("%s", txt.c_str());

if (use_new_calib)
{
ImGui::SameLine();

ImGui::PushStyleColor(ImGuiCol_Text, white);
txt = to_string() << " ( +" << std::fixed << std::setprecision(0) << fr_improvement << "%% )";
ImGui::Text(txt.c_str());
ImGui::Text("%s", txt.c_str());
ImGui::PopStyleColor();
}

Expand All @@ -935,19 +935,19 @@ namespace rs2

ImGui::SetCursorScreenPos({ float(x + 12), float(y + 90 + ImGui::GetTextLineHeight() + 6) });
ImGui::PushFont(win.get_large_font());
ImGui::Text(textual_icons::check);
ImGui::Text("%s", static_cast<const char *>(textual_icons::check));
ImGui::PopFont();

ImGui::SetCursorScreenPos({ float(x + 35), float(y + 92 + ImGui::GetTextLineHeight() + 6) });
ImGui::Text(txt.c_str());
ImGui::Text("%s", txt.c_str());

if (use_new_calib)
{
ImGui::SameLine();

ImGui::PushStyleColor(ImGuiCol_Text, white);
txt = to_string() << " ( -" << std::setprecision(0) << std::fixed << rms_improvement << "%% )";
ImGui::Text(txt.c_str());
ImGui::Text("%s", txt.c_str());
ImGui::PopStyleColor();
}
}
Expand Down