Silence a compiler warning, fix an uninitialized variable

This commit is contained in:
Henrik Rydgård committed 2019-02-27 10:33:27 +01:00
1 parent b689c68221
commit e49c488c6f
2 files changed
+14 -14

No files matched your search

+8 -8
View File
@@ -403,7 +403,7 @@ void PSPSaveDialog::DisplaySaveDataInfo1()
char saveDetail[1024];
char am_pm[] = "AM";
char hour_time[10] ;
char hour_time[32];
int hour = param.GetFileInfo(currentSelectedSave).modif_time.tm_hour;
int min = param.GetFileInfo(currentSelectedSave).modif_time.tm_min;
switch (g_Config.iTimeFormat) {
@@ -412,17 +412,17 @@ void PSPSaveDialog::DisplaySaveDataInfo1()
strcpy(am_pm, "PM");
hour -= 12;
}
snprintf(hour_time,10,"%02d:%02d %s", hour, min, am_pm);
snprintf(hour_time, sizeof(hour_time), "%02d:%02d %s", hour, min, am_pm);
break;
case 2:
snprintf(hour_time,10,"%02d:%02d", hour, min);
snprintf(hour_time, sizeof(hour_time), "%02d:%02d", hour, min);
break;
default:
if (hour > 12) {
strcpy(am_pm, "PM");
hour -= 12;
}
snprintf(hour_time,10,"%02d:%02d %s", hour, min, am_pm);
snprintf(hour_time, sizeof(hour_time), "%02d:%02d %s", hour, min, am_pm);
}
snprintf(title, sizeof(title), "%s", param.GetFileInfo(currentSelectedSave).title);
@@ -485,7 +485,7 @@ void PSPSaveDialog::DisplaySaveDataInfo2(bool showNewData) {
char date[256];
char am_pm[] = "AM";
char hour_time[10] ;
char hour_time[32];
int hour = modif_time.tm_hour;
int min = modif_time.tm_min;
switch (g_Config.iTimeFormat) {
@@ -494,17 +494,17 @@ void PSPSaveDialog::DisplaySaveDataInfo2(bool showNewData) {
strcpy(am_pm, "PM");
hour -= 12;
}
snprintf(hour_time, 10, "%02d:%02d %s", hour, min, am_pm);
snprintf(hour_time, sizeof(hour_time), "%02d:%02d %s", hour, min, am_pm);
break;
case 2:
snprintf(hour_time, 10, "%02d:%02d", hour, min);
snprintf(hour_time, sizeof(hour_time), "%02d:%02d", hour, min);
break;
default:
if (hour > 12) {
strcpy(am_pm, "PM");
hour -= 12;
}
snprintf(hour_time, 10, "%02d:%02d %s", hour, min, am_pm);
snprintf(hour_time, sizeof(hour_time), "%02d:%02d %s", hour, min, am_pm);
}
int day = modif_time.tm_mday;
+6 -6
View File
@@ -114,8 +114,8 @@ static bool IsTempPath(const std::string &str) {
class GameButton : public UI::Clickable {
public:
GameButton(const std::string &gamePath, bool gridStyle, UI::LayoutParams *layoutParams = 0)
: UI::Clickable(layoutParams), gridStyle_(gridStyle), gamePath_(gamePath), holdStart_(0), holdEnabled_(true) {}
GameButton(const std::string &gamePath, bool gridStyle, UI::LayoutParams *layoutParams = 0)
: UI::Clickable(layoutParams), gridStyle_(gridStyle), gamePath_(gamePath) {}
void Draw(UIContext &dc) override;
void GetContentDimensions(const UIContext &dc, float &w, float &h) const override {
@@ -206,9 +206,9 @@ private:
std::string gamePath_;
std::string title_;
double holdStart_;
bool holdEnabled_;
bool hovering_;
double holdStart_ = 0.0;
bool holdEnabled_ = true;
bool hovering_ = false;
};
void GameButton::Draw(UIContext &dc) {
@@ -404,7 +404,7 @@ void DirButton::Draw(UIContext &dc) {
if (text == "..") {
image = I_UP_DIRECTORY;
}
float tw, th;
dc.MeasureText(dc.GetFontStyle(), 1.0f, 1.0f, text.c_str(), &tw, &th, 0);