M module-services/service-desktop/endpoints/calllog/CalllogHelper.cpp => module-services/service-desktop/endpoints/calllog/CalllogHelper.cpp +8 -7
@@ 153,15 153,16 @@ auto CalllogHelper::requestCount(Context &context) -> sys::ReturnCodes
}
auto CalllogHelper::to_json(CalllogRecord record) -> json11::Json
{
- std::stringstream ss;
- ss << record.date;
- std::string date = ss.str();
+ std::unique_ptr<std::stringstream> ss = std::make_unique<std::stringstream>();
- ss.clear();
- ss.str(std::string{});
+ (*ss) << record.date;
+ std::string date = ss->str();
- ss << record.duration;
- std::string duration = ss.str();
+ ss->clear();
+ ss->str(std::string{});
+
+ (*ss) << record.duration;
+ std::string duration = ss->str();
auto recordEntry = json11::Json::object{{json::calllog::presentation, static_cast<int>(record.presentation)},
{json::calllog::date, date},
M module-services/service-desktop/endpoints/deviceInfo/DeviceInfoEndpoint.cpp => module-services/service-desktop/endpoints/deviceInfo/DeviceInfoEndpoint.cpp +5 -5
@@ 37,13 37,13 @@ auto DeviceInfoEndpoint::getDeviceInfo(Context &context) -> bool
return false;
}
json11::Json updateHistory = static_cast<ServiceDesktop *>(ownerServicePtr)->updateOS->getUpdateHistory();
- struct statvfs vfstat;
- if (statvfs(purefs::dir::getRootDiskPath().c_str(), &vfstat) < 0) {
+ std::unique_ptr<struct statvfs> vfstat = std::make_unique<struct statvfs>();
+ if ((*statvfs)(purefs::dir::getRootDiskPath().c_str(), vfstat.get()) < 0) {
return false;
}
- auto totalMbytes = (vfstat.f_frsize * vfstat.f_blocks) / 1024LLU / 1024LLU;
- auto freeMbytes = (vfstat.f_bfree * vfstat.f_bsize) / 1024LLU / 1024LLU;
- auto freePercent = (freeMbytes * 100) / totalMbytes;
+ unsigned long totalMbytes = (vfstat->f_frsize * vfstat->f_blocks) / 1024LLU / 1024LLU;
+ unsigned long freeMbytes = (vfstat->f_bfree * vfstat->f_bsize) / 1024LLU / 1024LLU;
+ unsigned long freePercent = (freeMbytes * 100) / totalMbytes;
context.setResponseBody(json11::Json::object(
{{json::batteryLevel, std::to_string(Store::Battery::get().level)},
M module-services/service-desktop/service-desktop/ServiceDesktop.hpp => module-services/service-desktop/service-desktop/ServiceDesktop.hpp +1 -1
@@ 22,7 22,7 @@ namespace settings
namespace sdesktop
{
- inline constexpr auto service_stack = 8192;
+ inline constexpr auto service_stack = 4096;
inline constexpr auto cdc_queue_len = 32;
inline constexpr auto cdc_queue_object_size = 1024;
inline constexpr auto irq_queue_object_size = sizeof(bsp::USBDeviceStatus);