diff --git a/Core/Dialog/PSPSaveDialog.cpp b/Core/Dialog/PSPSaveDialog.cpp index c06a436152..d078382897 100755 --- a/Core/Dialog/PSPSaveDialog.cpp +++ b/Core/Dialog/PSPSaveDialog.cpp @@ -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; diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index 46b80d64be..3385d49af8 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -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);