diff --git a/es-app/src/SystemData.cpp b/es-app/src/SystemData.cpp index dd8f008ab..941879c76 100644 --- a/es-app/src/SystemData.cpp +++ b/es-app/src/SystemData.cpp @@ -289,7 +289,7 @@ bool SystemData::loadConfig() std::vector platformStrs = readList(platformList); std::vector platformIds; for (auto it = platformStrs.cbegin(); it != platformStrs.cend(); it++) { - std::string str = it->c_str(); + std::string str = *it; PlatformIds::PlatformId platformId = PlatformIds::getPlatformId(str); if (platformId == PlatformIds::PLATFORM_IGNORE) { diff --git a/es-core/src/CECInput.cpp b/es-core/src/CECInput.cpp index df9469c0d..9a4b4a28d 100644 --- a/es-core/src/CECInput.cpp +++ b/es-core/src/CECInput.cpp @@ -95,7 +95,6 @@ void CECInput::deinit() CECInput::CECInput() : mlibCEC(nullptr) { - #if defined(HAVE_LIBCEC) #if defined(_RPI_) // Restart vchi tv and CEC in case we just came back from another app using CEC (like Kodi). diff --git a/es-core/src/components/DateTimeComponent.cpp b/es-core/src/components/DateTimeComponent.cpp index 12550a0a9..8d1913fd3 100644 --- a/es-core/src/components/DateTimeComponent.cpp +++ b/es-core/src/components/DateTimeComponent.cpp @@ -76,16 +76,20 @@ std::string DateTimeComponent::getDisplayString() const Utils::Time::DateTime now(Utils::Time::now()); Utils::Time::Duration dur(now.getTime() - mTime.getTime()); - char buf[64]; + std::string buf; if (dur.getDays() > 0) - sprintf(buf, "%d day%s ago", dur.getDays(), (dur.getDays() > 1) ? "s" : ""); + buf = std::to_string(dur.getDays()) + " day" + + (dur.getDays() > 1 ? "s" : "") + " ago"; else if (dur.getHours() > 0) - sprintf(buf, "%d hour%s ago", dur.getHours(), (dur.getHours() > 1) ? "s" : ""); + buf = std::to_string(dur.getHours()) + " hour" + + (dur.getHours() > 1 ? "s" : "") + " ago"; else if (dur.getMinutes() > 0) - sprintf(buf, "%d minute%s ago", dur.getMinutes(), (dur.getMinutes() > 1) ? "s" : ""); + buf = std::to_string(dur.getMinutes()) + " minute" + + (dur.getMinutes() > 1 ? "s" : "") + " ago"; else - sprintf(buf, "%d second%s ago", dur.getSeconds(), (dur.getSeconds() > 1) ? "s" : ""); + buf = std::to_string(dur.getSeconds()) + " second" + + (dur.getSeconds() > 1 || dur.getSeconds() == 0 ? "s" : "") + " ago"; return std::string(buf); } diff --git a/es-core/src/components/DateTimeEditComponent.cpp b/es-core/src/components/DateTimeEditComponent.cpp index 707c38cb4..49017128d 100644 --- a/es-core/src/components/DateTimeEditComponent.cpp +++ b/es-core/src/components/DateTimeEditComponent.cpp @@ -231,18 +231,20 @@ std::string DateTimeEditComponent::getDisplayString(DisplayMode mode) const Utils::Time::DateTime now(Utils::Time::now()); Utils::Time::Duration dur(now.getTime() - mTime.getTime()); - char buf[64]; + std::string buf; if (dur.getDays() > 0) - sprintf(buf, "%d day%s ago", dur.getDays(), (dur.getDays() > 1) ? "s" : ""); + buf = std::to_string(dur.getDays()) + " day" + + (dur.getDays() > 1 ? "s" : "") + " ago"; else if (dur.getHours() > 0) - sprintf(buf, "%d hour%s ago", dur.getHours(), (dur.getHours() > 1) ? "s" : ""); + buf = std::to_string(dur.getHours()) + " hour" + + (dur.getHours() > 1 ? "s" : "") + " ago"; else if (dur.getMinutes() > 0) - sprintf(buf, "%d minute%s ago", dur.getMinutes(), - (dur.getMinutes() > 1) ? "s" : ""); + buf = std::to_string(dur.getMinutes()) + " minute" + + (dur.getMinutes() > 1 ? "s" : "") + " ago"; else - sprintf(buf, "%d second%s ago", dur.getSeconds(), - (dur.getSeconds() > 1) ? "s" : ""); + buf = std::to_string(dur.getSeconds()) + " second" + + (dur.getSeconds() > 1 || dur.getSeconds() == 0 ? "s" : "") + " ago"; return std::string(buf); }