Fix more warnings. (#3101)

* Fix warnings

* Submodule
This commit is contained in:
louist103 2023-08-30 10:02:07 -07:00 committed by GitHub
parent 738172d9ed
commit 4aadf4c14c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 49 additions and 49 deletions

View File

@ -1666,7 +1666,7 @@ void DrawCosmeticRow(CosmeticOption& cosmeticOption) {
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
}
ImGui::SameLine();
ImGui::Text(cosmeticOption.label.c_str());
ImGui::Text("%s", cosmeticOption.label.c_str());
ImGui::SameLine((ImGui::CalcTextSize("Mirror Shield Mirror").x * 1.0f) + 60.0f);
if (ImGui::Button(("Random##" + cosmeticOption.label).c_str())) {
RandomizeColor(cosmeticOption);
@ -1701,7 +1701,7 @@ void DrawCosmeticRow(CosmeticOption& cosmeticOption) {
void DrawCosmeticGroup(CosmeticGroup cosmeticGroup) {
std::string label = groupLabels.at(cosmeticGroup);
ImGui::Text(label.c_str());
ImGui::Text("%s", label.c_str());
ImGui::SameLine((ImGui::CalcTextSize("Mirror Shield Mirror").x * 1.0f) + 60.0f);
if (ImGui::Button(("Random##" + label).c_str())) {
for (auto& [id, cosmeticOption] : cosmeticOptions) {

View File

@ -316,7 +316,7 @@ void ActorViewerWindow::DrawElement() {
if (ImGui::TreeNode("New...")) {
ImGui::PushItemWidth(ImGui::GetFontSize() * 10);
ImGui::Text(GetActorDescription(newActor.id).c_str());
ImGui::Text("%s", GetActorDescription(newActor.id).c_str());
ImGui::InputScalar("ID", ImGuiDataType_S16, &newActor.id, &one);
ImGui::InputScalar("params", ImGuiDataType_S16, &newActor.params, &one);

View File

@ -1094,7 +1094,7 @@ void DrawFlagsTab() {
if (ImGui::TreeNode(flagTable.name)) {
for (int j = 0; j < flagTable.size + 1; j++) {
DrawGroupWithBorder([&]() {
ImGui::Text(fmt::format("{:<2x}", j).c_str());
ImGui::Text("%s", fmt::format("{:<2x}", j).c_str());
switch (flagTable.flagTableType) {
case EVENT_CHECK_INF:
DrawFlagTableArray16(flagTable, j, gSaveContext.eventChkInf[j]);

View File

@ -279,8 +279,8 @@ std::string formatHexOnlyGameplayStat(uint32_t value) {
extern "C" char* GameplayStats_GetCurrentTime() {
std::string timeString = formatTimestampGameplayStat(GAMEPLAYSTAT_TOTAL_TIME).c_str();
const int stringLength = timeString.length();
char* timeChar = new char[stringLength + 1];
const size_t stringLength = timeString.length();
char* timeChar = (char*)malloc(stringLength + 1); // We need to use malloc so we can free this from a C file.
strcpy(timeChar, timeString.c_str());
return timeChar;
}
@ -383,11 +383,11 @@ void SaveStats(SaveContext* saveContext, int sectionID, bool fullSave) {
});
}
void GameplayStatsRow(const char* label, std::string value, ImVec4 color = COLOR_WHITE) {
void GameplayStatsRow(const char* label, const std::string& value, ImVec4 color = COLOR_WHITE) {
ImGui::PushStyleColor(ImGuiCol_Text, color);
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::Text(label);
ImGui::Text("%s", label);
ImGui::SameLine(ImGui::GetContentRegionAvail().x - (ImGui::CalcTextSize(value.c_str()).x - 8.0f));
ImGui::Text("%s", value.c_str());
ImGui::PopStyleColor();

View File

@ -127,7 +127,7 @@ public:
return IsAdvancement();
}
const uint32_t GetHintKey() const {
uint32_t GetHintKey() const {
return hintKey;
}

View File

@ -208,7 +208,7 @@ public:
addedToPool = true;
}
const uint32_t GetHintKey() const {
uint32_t GetHintKey() const {
return hintKey;
}
@ -319,7 +319,7 @@ public:
return &excludedOption;
}
const uint32_t Getuint32_t() const {
uint32_t Getuint32_t() const {
return hintKey;
}

View File

@ -3180,7 +3180,7 @@ void RandomizerSettingsWindow::DrawElement() {
ImGui::PushItemWidth(-FLT_MIN);
// Forest
ImGui::Text(Settings::OpenForest.GetName().c_str());
ImGui::Text("%s", Settings::OpenForest.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Closed - Kokiri sword & shield are required to access "
"the Deku Tree, and completing the Deku Tree is required to "
@ -3198,7 +3198,7 @@ void RandomizerSettingsWindow::DrawElement() {
UIWidgets::PaddedSeparator();
// Kakariko Gate
ImGui::Text(Settings::OpenKakariko.GetName().c_str());
ImGui::Text("%s", Settings::OpenKakariko.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Closed - The gate will remain closed until Zelda's letter "
"is shown to the guard.\n"
@ -3211,7 +3211,7 @@ void RandomizerSettingsWindow::DrawElement() {
UIWidgets::PaddedSeparator();
// Door of Time
ImGui::Text(Settings::OpenDoorOfTime.GetName().c_str());
ImGui::Text("%s", Settings::OpenDoorOfTime.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Closed - The Ocarina of Time, the Song of Time and all "
"three spiritual stones are required to open the Door of Time.\n"
@ -3226,7 +3226,7 @@ void RandomizerSettingsWindow::DrawElement() {
UIWidgets::PaddedSeparator();
// Zora's Fountain
ImGui::Text(Settings::ZorasFountain.GetName().c_str());
ImGui::Text("%s", Settings::ZorasFountain.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Closed - King Zora obstructs the way to Zora's Fountain. "
"Ruto's letter must be shown as child Link in order to move "
@ -3257,7 +3257,7 @@ void RandomizerSettingsWindow::DrawElement() {
(CVarGetInteger("gRandomizeShuffleOcarinas", RO_GENERIC_OFF) == RO_GENERIC_OFF)); // closed door of time with ocarina shuffle off
static const char* disableRandoStartingAgeText = "This option is disabled due to other options making the game unbeatable.";
ImGui::Text(Settings::StartingAge.GetName().c_str());
ImGui::Text("%s", Settings::StartingAge.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Choose which age Link will start as.\n\n"
"Starting as adult means you start with the Master Sword in your inventory.\n"
@ -3697,7 +3697,7 @@ void RandomizerSettingsWindow::DrawElement() {
ImGui::PushItemWidth(-FLT_MIN);
// Shuffle Songs
ImGui::Text(Settings::ShuffleSongs.GetName().c_str());
ImGui::Text("%s", Settings::ShuffleSongs.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Song locations - Songs will only appear at locations that normally teach songs.\n"
"\n"
@ -3715,7 +3715,7 @@ void RandomizerSettingsWindow::DrawElement() {
UIWidgets::PaddedSeparator();
// Shuffle Tokens
ImGui::Text(Settings::Tokensanity.GetName().c_str());
ImGui::Text("%s", Settings::Tokensanity.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Shuffles Golden Skulltula Tokens into the item pool. This means "
"Golden Skulltulas can contain other items as well.\n"
@ -3808,7 +3808,7 @@ void RandomizerSettingsWindow::DrawElement() {
ImGui::PushItemWidth(-FLT_MIN);
// Shopsanity
ImGui::Text(Settings::Shopsanity.GetName().c_str());
ImGui::Text("%s", Settings::Shopsanity.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Off - All shop items will be the same as vanilla.\n"
"\n"
@ -3826,7 +3826,7 @@ void RandomizerSettingsWindow::DrawElement() {
case RO_SHOPSANITY_ZERO_ITEMS: // no need to show it if there aren't shop slots in the pool
break;
default:
ImGui::Text(Settings::ShopsanityPrices.GetName().c_str());
ImGui::Text("%s", Settings::ShopsanityPrices.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Balanced - The default randomization. Shop prices for shopsanity items will range between 0 to 300 rupees, "
"with a bias towards values slightly below the middle of the range, in multiples of 5.\n "
@ -3845,7 +3845,7 @@ void RandomizerSettingsWindow::DrawElement() {
UIWidgets::PaddedSeparator();
// Shuffle Scrubs
ImGui::Text(Settings::Scrubsanity.GetName().c_str());
ImGui::Text("%s", Settings::Scrubsanity.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Off - Scrubs will not be shuffled. The 3 Scrubs that give one-time items in the vanilla game "
"(PoH, Deku Nut capacity, and Deku Stick capacity) will have random items.\n"
@ -3874,7 +3874,7 @@ void RandomizerSettingsWindow::DrawElement() {
UIWidgets::PaddedSeparator();
// Shuffle Merchants
ImGui::Text(Settings::ShuffleMerchants.GetName().c_str());
ImGui::Text("%s", Settings::ShuffleMerchants.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Enabling this changes Medigoron, Granny and the Carpet Salesman to sell a random item "
"once at a high price (100 for Granny, 200 for the others).\n"
@ -3944,7 +3944,7 @@ void RandomizerSettingsWindow::DrawElement() {
ImGui::PushItemWidth(-FLT_MIN);
// Shuffle Dungeon Rewards
ImGui::Text(Settings::ShuffleRewards.GetName().c_str());
ImGui::Text("%s", Settings::ShuffleRewards.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Shuffles the location of spiritual stones and medallions.\n"
"\n"
@ -3962,7 +3962,7 @@ void RandomizerSettingsWindow::DrawElement() {
UIWidgets::PaddedSeparator();
// Maps & Compasses
ImGui::Text(Settings::MapsAndCompasses.GetName().c_str());
ImGui::Text("%s", Settings::MapsAndCompasses.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Start with - You will start with Maps & Compasses from all dungeons.\n"
"\n"
@ -3981,7 +3981,7 @@ void RandomizerSettingsWindow::DrawElement() {
UIWidgets::PaddedSeparator();
// Keysanity
ImGui::Text(Settings::Keysanity.GetName().c_str());
ImGui::Text("%s", Settings::Keysanity.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Start with - You will start with all Small Keys from all dungeons.\n"
"\n"
@ -4002,7 +4002,7 @@ void RandomizerSettingsWindow::DrawElement() {
UIWidgets::PaddedSeparator();
// Key Rings
ImGui::Text(Settings::KeyRings.GetName().c_str());
ImGui::Text("%s", Settings::KeyRings.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Keyrings will replace all small keys from a particular dungeon with a single keyring that awards all keys for it's associated dungeon\n"
"\n"
@ -4057,7 +4057,7 @@ void RandomizerSettingsWindow::DrawElement() {
UIWidgets::PaddedSeparator();
// Gerudo Keys
ImGui::Text(Settings::GerudoKeys.GetName().c_str());
ImGui::Text("%s", Settings::GerudoKeys.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Vanilla - Thieve's Hideout Keys will appear in their vanilla locations.\n"
"\n"
@ -4072,7 +4072,7 @@ void RandomizerSettingsWindow::DrawElement() {
UIWidgets::PaddedSeparator();
// Boss Keysanity
ImGui::Text(Settings::BossKeysanity.GetName().c_str());
ImGui::Text("%s", Settings::BossKeysanity.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Start with - You will start with Boss keys from all dungeons.\n"
"\n"
@ -4091,7 +4091,7 @@ void RandomizerSettingsWindow::DrawElement() {
UIWidgets::PaddedSeparator();
// Ganon's Boss Key
ImGui::Text(Settings::GanonsBossKey.GetName().c_str());
ImGui::Text("%s", Settings::GanonsBossKey.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Vanilla - Ganon's Boss Key will appear in the vanilla location.\n"
"\n"
@ -4338,7 +4338,7 @@ void RandomizerSettingsWindow::DrawElement() {
ImGui::PushItemWidth(-FLT_MIN);
// Item Pool Settings
ImGui::Text(Settings::ItemPoolValue.GetName().c_str());
ImGui::Text("%s", Settings::ItemPoolValue.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Sets how many major items appear in the item pool.\n"
"\n"
@ -4354,7 +4354,7 @@ void RandomizerSettingsWindow::DrawElement() {
UIWidgets::PaddedSeparator();
// Ice Traps
ImGui::Text(Settings::IceTrapValue.GetName().c_str());
ImGui::Text("%s", Settings::IceTrapValue.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Sets how many items are replaced by ice traps.\n"
"\n"
@ -4374,7 +4374,7 @@ void RandomizerSettingsWindow::DrawElement() {
UIWidgets::PaddedSeparator();
// Gossip Stone Hints
ImGui::Text(Settings::GossipStoneHints.GetName().c_str());
ImGui::Text("%s", Settings::GossipStoneHints.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Allows Gossip Stones to provide hints on item locations. Hints mentioning "
"\"Way of the Hero\" indicate a location that holds an item required to beat "
@ -4392,7 +4392,7 @@ void RandomizerSettingsWindow::DrawElement() {
// Hint Clarity
UIWidgets::Spacer(0);
ImGui::Indent();
ImGui::Text(Settings::ClearerHints.GetName().c_str());
ImGui::Text("%s", Settings::ClearerHints.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Sets the difficulty of hints.\n"
"\n"
@ -4409,7 +4409,7 @@ void RandomizerSettingsWindow::DrawElement() {
// Hint Distribution
UIWidgets::Spacer(0);
ImGui::Text(Settings::HintDistribution.GetName().c_str());
ImGui::Text("%s", Settings::HintDistribution.GetName().c_str());
UIWidgets::InsertHelpHoverText(
"Sets how many hints will be useful.\n"
"\n"
@ -4581,7 +4581,7 @@ void RandomizerSettingsWindow::DrawElement() {
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
}
ImGui::SameLine();
ImGui::Text(rcObject->rcShortName.c_str());
ImGui::Text("%s", rcObject->rcShortName.c_str());
}
}
ImGui::TreePop();
@ -4622,7 +4622,7 @@ void RandomizerSettingsWindow::DrawElement() {
LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
}
ImGui::SameLine();
ImGui::Text(rcObject->rcShortName.c_str());
ImGui::Text("%s", rcObject->rcShortName.c_str());
}
}
ImGui::TreePop();
@ -4931,7 +4931,7 @@ void RandomizerSettingsWindow::DrawElement() {
}
DrawTagChips(*rtObject.rtTags);
ImGui::SameLine();
ImGui::Text(rtObject.rtShortName.c_str());
ImGui::Text("%s", rtObject.rtShortName.c_str());
UIWidgets::InsertHelpHoverText(rtObject.rtDesc.c_str());
}
}
@ -5043,7 +5043,7 @@ void RandomizerSettingsWindow::DrawElement() {
}
DrawTagChips(*rtObject.rtTags);
ImGui::SameLine();
ImGui::Text(rtObject.rtShortName.c_str());
ImGui::Text("%s", rtObject.rtShortName.c_str());
UIWidgets::InsertHelpHoverText(rtObject.rtDesc.c_str());
}
}
@ -5096,7 +5096,7 @@ void RandomizerSettingsWindow::DrawElement() {
// Don't display this option if Dungeon Rewards are Shuffled to End of Dungeon.
// TODO: Show this but disabled when we have options for disabled Comboboxes.
if (CVarGetInteger("gRandomizeShuffleDungeonReward", RO_DUNGEON_REWARDS_END_OF_DUNGEON) != RO_DUNGEON_REWARDS_END_OF_DUNGEON) {
ImGui::Text(Settings::LinksPocketItem.GetName().c_str());
ImGui::Text("%s", Settings::LinksPocketItem.GetName().c_str());
UIWidgets::EnhancementCombobox("gRandomizeLinksPocket", randoLinksPocket, RO_LINKS_POCKET_DUNGEON_REWARD);
UIWidgets::PaddedSeparator();
}

View File

@ -397,11 +397,11 @@ void DrawItemCount(ItemTrackerItem item) {
ImGui::SetCursorScreenPos(ImVec2(p.x + (iconSize / 2) - (ImGui::CalcTextSize((currentString + maxString).c_str()).x / 2), p.y - 14));
ImGui::PushStyleColor(ImGuiCol_Text, currentColor);
ImGui::Text(currentString.c_str());
ImGui::Text("%s", currentString.c_str());
ImGui::PopStyleColor();
ImGui::SameLine(0, 0.0f);
ImGui::PushStyleColor(ImGuiCol_Text, maxColor);
ImGui::Text(maxString.c_str());
ImGui::Text("%s", maxString.c_str());
ImGui::PopStyleColor();
} else if (currentAndMax.currentCapacity > 0 && trackerNumberDisplayMode != ITEM_TRACKER_NUMBER_NONE && IsValidSaveFile()) {
std::string currentString = "";
@ -454,11 +454,11 @@ void DrawItemCount(ItemTrackerItem item) {
ImGui::SetCursorScreenPos(ImVec2(x, p.y - 14));
ImGui::PushStyleColor(ImGuiCol_Text, currentColor);
ImGui::Text(currentString.c_str());
ImGui::Text("%s", currentString.c_str());
ImGui::PopStyleColor();
ImGui::SameLine(0, 0.0f);
ImGui::PushStyleColor(ImGuiCol_Text, maxColor);
ImGui::Text(maxString.c_str());
ImGui::Text("%s", maxString.c_str());
ImGui::PopStyleColor();
} else {
ImGui::SetCursorScreenPos(ImVec2(p.x, p.y - 14));
@ -593,7 +593,7 @@ void DrawDungeonItem(ItemTrackerItem item) {
std::string dungeonName = itemTrackerDungeonShortNames[item.data];
ImGui::SetCursorScreenPos(ImVec2(p.x + (iconSize / 2) - (ImGui::CalcTextSize(dungeonName.c_str()).x / 2), p.y - (iconSize + 16)));
ImGui::PushStyleColor(ImGuiCol_Text, dungeonColor);
ImGui::Text(dungeonName.c_str());
ImGui::Text("%s", dungeonName.c_str());
ImGui::PopStyleColor();
}
@ -604,7 +604,7 @@ void DrawDungeonItem(ItemTrackerItem item) {
std::string dungeonName = itemTrackerDungeonShortNames[item.data];
ImGui::SetCursorScreenPos(ImVec2(p.x + (iconSize / 2) - (ImGui::CalcTextSize(dungeonName.c_str()).x / 2), p.y - (iconSize + 13)));
ImGui::PushStyleColor(ImGuiCol_Text, dungeonColor);
ImGui::Text(dungeonName.c_str());
ImGui::Text("%s", dungeonName.c_str());
ImGui::PopStyleColor();
}
ImGui::EndGroup();

View File

@ -266,7 +266,7 @@ namespace UIWidgets {
}
bool LabeledRightAlignedEnhancementCombobox(const char* label, const char* cvarName, std::span<const char*, std::dynamic_extent> comboArray, uint8_t defaultIndex, bool disabled, const char* disabledTooltipText, uint8_t disabledValue) {
ImGui::Text(label);
ImGui::Text("%s", label);
s32 currentValue = CVarGetInteger(cvarName, defaultIndex);
#ifdef __WIIU__

View File

@ -6185,11 +6185,10 @@ void Interface_DrawTotalGameplayTimer(PlayState* play) {
G_AC_NONE | G_ZS_PRIM | G_RM_XLU_SURF | G_RM_XLU_SURF2);
char* totalTimeText = GameplayStats_GetCurrentTime();
char* textPointer = &totalTimeText[0];
uint8_t textLength = strlen(textPointer);
size_t textLength = strlen(totalTimeText);
uint16_t textureIndex = 0;
for (uint16_t i = 0; i < textLength; i++) {
for (size_t i = 0; i < textLength; i++) {
if (totalTimeText[i] == ':' || totalTimeText[i] == '.') {
textureIndex = 10;
} else {
@ -6234,6 +6233,7 @@ void Interface_DrawTotalGameplayTimer(PlayState* play) {
gSPWideTextureRectangle(OVERLAY_DISP++, rectLeft << 2, rectTop << 2, (rectLeft + rectWidth) << 2,
(rectTop + rectHeight) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10);
}
free(totalTimeText);
CLOSE_DISPS(play->state.gfxCtx);
}