Application: use iterators for TextUnformatted calls.
Corrade's string views aren't guaranteed to be null-terminated, though most of them come from strings, which _are_ null-terminated. Still, safety first.
This commit is contained in:
parent
7ce726f933
commit
22f5fc947c
6 changed files with 11 additions and 10 deletions
|
@ -421,7 +421,7 @@ Application::drawTooltip(Containers::StringView text, float wrap_pos) {
|
||||||
if(wrap_pos > 0.0f) {
|
if(wrap_pos > 0.0f) {
|
||||||
ImGui::PushTextWrapPos(wrap_pos);
|
ImGui::PushTextWrapPos(wrap_pos);
|
||||||
}
|
}
|
||||||
ImGui::TextUnformatted(text.data());
|
ImGui::TextUnformatted(text.cbegin(), text.cend());
|
||||||
if(wrap_pos > 0.0f) {
|
if(wrap_pos > 0.0f) {
|
||||||
ImGui::PopTextWrapPos();
|
ImGui::PopTextWrapPos();
|
||||||
}
|
}
|
||||||
|
|
|
@ -360,7 +360,7 @@ Application::drawMaterialRow(Containers::StringView name, std::int32_t tier, Gam
|
||||||
ImGui::TableSetColumnIndex(0);
|
ImGui::TableSetColumnIndex(0);
|
||||||
ImGui::Text("T%i", tier);
|
ImGui::Text("T%i", tier);
|
||||||
ImGui::TableSetColumnIndex(1);
|
ImGui::TableSetColumnIndex(1);
|
||||||
ImGui::TextUnformatted(name.data());
|
ImGui::TextUnformatted(name.cbegin(), name.cend());
|
||||||
ImGui::TableSetColumnIndex(2);
|
ImGui::TableSetColumnIndex(2);
|
||||||
ImGui::Text("%i", _currentProfile->material(id));
|
ImGui::Text("%i", _currentProfile->material(id));
|
||||||
if(conf().cheatMode()) {
|
if(conf().cheatMode()) {
|
||||||
|
@ -387,7 +387,7 @@ Application::drawUnavailableMaterialRow(Containers::StringView name, std::int32_
|
||||||
ImGui::TableSetColumnIndex(0);
|
ImGui::TableSetColumnIndex(0);
|
||||||
ImGui::Text("T%i", tier);
|
ImGui::Text("T%i", tier);
|
||||||
ImGui::TableSetColumnIndex(1);
|
ImGui::TableSetColumnIndex(1);
|
||||||
ImGui::TextUnformatted(name.begin(), name.end());
|
ImGui::TextUnformatted(name.cbegin(), name.cend());
|
||||||
ImGui::TableSetColumnIndex(2);
|
ImGui::TableSetColumnIndex(2);
|
||||||
ImGui::TextDisabled("Unavailable as of game version " SAVETOOL_SUPPORTED_GAME_VERSION);
|
ImGui::TextDisabled("Unavailable as of game version " SAVETOOL_SUPPORTED_GAME_VERSION);
|
||||||
}
|
}
|
||||||
|
@ -480,7 +480,8 @@ Application::drawMassManager() {
|
||||||
ImGui::TextDisabled("<invalid>");
|
ImGui::TextDisabled("<invalid>");
|
||||||
break;
|
break;
|
||||||
case GameObjects::Mass::State::Valid:
|
case GameObjects::Mass::State::Valid:
|
||||||
ImGui::TextUnformatted(_massManager->hangar(i).name().data());
|
ImGui::TextUnformatted(_massManager->hangar(i).name().cbegin(),
|
||||||
|
_massManager->hangar(i).name().cend());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -319,7 +319,7 @@ Application::drawCustomStyle(GameObjects::CustomStyle& style) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ImGui::BeginMenuBar()) {
|
if(ImGui::BeginMenuBar()) {
|
||||||
ImGui::TextUnformatted(style.name.data());
|
ImGui::TextUnformatted(style.name.cbegin(), style.name.cend());
|
||||||
|
|
||||||
static Containers::StaticArray<33, char> name_buf{ValueInit};
|
static Containers::StaticArray<33, char> name_buf{ValueInit};
|
||||||
if(ImGui::SmallButton(ICON_FA_EDIT " Rename")) {
|
if(ImGui::SmallButton(ICON_FA_EDIT " Rename")) {
|
||||||
|
|
|
@ -257,7 +257,7 @@ Application::drawWeaponCategory(Containers::StringView name, Containers::ArrayVi
|
||||||
{
|
{
|
||||||
ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
|
ImGui::TableNextRow(ImGuiTableRowFlags_Headers);
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::TextUnformatted(name.data());
|
ImGui::TextUnformatted(name.cbegin(), name.cend());
|
||||||
|
|
||||||
ImGui::PushID(payload_type.data());
|
ImGui::PushID(payload_type.data());
|
||||||
|
|
||||||
|
@ -458,7 +458,7 @@ Application::drawWeaponEditor(GameObjects::Weapon& weapon) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(map->find(part.id) != map->cend()) {
|
if(map->find(part.id) != map->cend()) {
|
||||||
ImGui::TextUnformatted(map->at(part.id).data());
|
ImGui::TextUnformatted(map->at(part.id).cbegin(), map->at(part.id).cend());
|
||||||
}
|
}
|
||||||
else if(part.id == -1) {
|
else if(part.id == -1) {
|
||||||
ImGui::TextUnformatted("<none>");
|
ImGui::TextUnformatted("<none>");
|
||||||
|
|
|
@ -266,11 +266,11 @@ Application::drawBackupListPopup() {
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
|
|
||||||
ImGui::TableSetColumnIndex(0);
|
ImGui::TableSetColumnIndex(0);
|
||||||
ImGui::TextUnformatted(backup.company.data());
|
ImGui::TextUnformatted(backup.company.cbegin(), backup.company.cend());
|
||||||
if(ImGui::IsItemHovered()) {
|
if(ImGui::IsItemHovered()) {
|
||||||
ImGui::BeginTooltip();
|
ImGui::BeginTooltip();
|
||||||
for(const auto& file : backup.includedFiles) {
|
for(const auto& file : backup.includedFiles) {
|
||||||
ImGui::TextUnformatted(file.data());
|
ImGui::TextUnformatted(file.cbegin());
|
||||||
}
|
}
|
||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ Application::drawAbout() {
|
||||||
if(ImGui::BeginChild("##GPL", {0.0f, float(windowSize().y()) * 0.3f}, ImGuiChildFlags_Border)) {
|
if(ImGui::BeginChild("##GPL", {0.0f, float(windowSize().y()) * 0.3f}, ImGuiChildFlags_Border)) {
|
||||||
static auto licence = _rs.getRaw("COPYING");
|
static auto licence = _rs.getRaw("COPYING");
|
||||||
ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
|
ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]);
|
||||||
ImGui::TextUnformatted(licence.begin(), licence.end());
|
ImGui::TextUnformatted(licence.cbegin(), licence.cend());
|
||||||
ImGui::PopFont();
|
ImGui::PopFont();
|
||||||
}
|
}
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
|
|
Loading…
Reference in a new issue