From 35e3c6802832f7396a04603edca9434acc6d3972 Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 30 Jan 2024 02:27:27 -0500 Subject: service: use const references for input raw data --- src/core/hle/service/glue/time/static.cpp | 6 +++--- src/core/hle/service/glue/time/static.h | 6 +++--- src/core/hle/service/glue/time/time_zone.cpp | 9 ++++++--- src/core/hle/service/glue/time/time_zone.h | 10 ++++++---- src/core/hle/service/glue/time/time_zone_binary.cpp | 6 +++--- src/core/hle/service/glue/time/time_zone_binary.h | 6 +++--- 6 files changed, 24 insertions(+), 19 deletions(-) (limited to 'src/core/hle/service/glue/time') diff --git a/src/core/hle/service/glue/time/static.cpp b/src/core/hle/service/glue/time/static.cpp index f56db76e1..f8c1218f3 100644 --- a/src/core/hle/service/glue/time/static.cpp +++ b/src/core/hle/service/glue/time/static.cpp @@ -200,7 +200,7 @@ Result StaticService::GetStandardUserSystemClockAutomaticCorrectionUpdatedTime( } Result StaticService::CalculateMonotonicSystemClockBaseTimePoint( - Out out_time, Service::PSC::Time::SystemClockContext& context) { + Out out_time, const Service::PSC::Time::SystemClockContext& context) { SCOPE_EXIT({ LOG_DEBUG(Service_Time, "called. context={} out_time={}", context, *out_time); }); R_RETURN(m_wrapped_service->CalculateMonotonicSystemClockBaseTimePoint(out_time, context)); @@ -216,8 +216,8 @@ Result StaticService::GetClockSnapshot(OutClockSnapshot out_snapshot, Result StaticService::GetClockSnapshotFromSystemClockContext( Service::PSC::Time::TimeType type, OutClockSnapshot out_snapshot, - Service::PSC::Time::SystemClockContext& user_context, - Service::PSC::Time::SystemClockContext& network_context) { + const Service::PSC::Time::SystemClockContext& user_context, + const Service::PSC::Time::SystemClockContext& network_context) { SCOPE_EXIT({ LOG_DEBUG(Service_Time, "called. type={} out_snapshot={} user_context={} network_context={}", type, diff --git a/src/core/hle/service/glue/time/static.h b/src/core/hle/service/glue/time/static.h index d3cc0fdd6..5d3623182 100644 --- a/src/core/hle/service/glue/time/static.h +++ b/src/core/hle/service/glue/time/static.h @@ -58,12 +58,12 @@ public: Result GetStandardUserSystemClockAutomaticCorrectionUpdatedTime( Out out_time_point); Result CalculateMonotonicSystemClockBaseTimePoint( - Out out_time, Service::PSC::Time::SystemClockContext& context); + Out out_time, const Service::PSC::Time::SystemClockContext& context); Result GetClockSnapshot(OutClockSnapshot out_snapshot, Service::PSC::Time::TimeType type); Result GetClockSnapshotFromSystemClockContext( Service::PSC::Time::TimeType type, OutClockSnapshot out_snapshot, - Service::PSC::Time::SystemClockContext& user_context, - Service::PSC::Time::SystemClockContext& network_context); + const Service::PSC::Time::SystemClockContext& user_context, + const Service::PSC::Time::SystemClockContext& network_context); Result CalculateStandardUserSystemClockDifferenceByUser(Out out_difference, InClockSnapshot a, InClockSnapshot b); Result CalculateSpanBetween(Out out_time, InClockSnapshot a, InClockSnapshot b); diff --git a/src/core/hle/service/glue/time/time_zone.cpp b/src/core/hle/service/glue/time/time_zone.cpp index 98d928697..36f163419 100644 --- a/src/core/hle/service/glue/time/time_zone.cpp +++ b/src/core/hle/service/glue/time/time_zone.cpp @@ -62,7 +62,8 @@ Result TimeZoneService::GetDeviceLocationName( R_RETURN(m_wrapped_service->GetDeviceLocationName(out_location_name)); } -Result TimeZoneService::SetDeviceLocationName(Service::PSC::Time::LocationName& location_name) { +Result TimeZoneService::SetDeviceLocationName( + const Service::PSC::Time::LocationName& location_name) { LOG_DEBUG(Service_Time, "called. location_name={}", location_name); R_UNLESS(m_can_write_timezone_device_location, Service::PSC::Time::ResultPermissionDenied); @@ -110,7 +111,8 @@ Result TimeZoneService::LoadLocationNameList( R_RETURN(GetTimeZoneLocationList(*out_count, out_names, out_names.size(), index)); } -Result TimeZoneService::LoadTimeZoneRule(OutRule out_rule, Service::PSC::Time::LocationName& name) { +Result TimeZoneService::LoadTimeZoneRule(OutRule out_rule, + const Service::PSC::Time::LocationName& name) { LOG_DEBUG(Service_Time, "called. name={}", name); std::scoped_lock l{m_mutex}; @@ -139,7 +141,8 @@ Result TimeZoneService::GetDeviceLocationNameAndUpdatedTime( } Result TimeZoneService::SetDeviceLocationNameWithTimeZoneRule( - Service::PSC::Time::LocationName& location_name, InBuffer binary) { + const Service::PSC::Time::LocationName& location_name, + InBuffer binary) { LOG_DEBUG(Service_Time, "called. location_name={}", location_name); R_UNLESS(m_can_write_timezone_device_location, Service::PSC::Time::ResultPermissionDenied); diff --git a/src/core/hle/service/glue/time/time_zone.h b/src/core/hle/service/glue/time/time_zone.h index 9c1530966..beb54ddde 100644 --- a/src/core/hle/service/glue/time/time_zone.h +++ b/src/core/hle/service/glue/time/time_zone.h @@ -46,18 +46,20 @@ public: ~TimeZoneService() override; Result GetDeviceLocationName(Out out_location_name); - Result SetDeviceLocationName(Service::PSC::Time::LocationName& location_name); + Result SetDeviceLocationName(const Service::PSC::Time::LocationName& location_name); Result GetTotalLocationNameCount(Out out_count); Result LoadLocationNameList( Out out_count, OutArray out_names, u32 index); - Result LoadTimeZoneRule(OutRule out_rule, Service::PSC::Time::LocationName& location_name); + Result LoadTimeZoneRule(OutRule out_rule, + const Service::PSC::Time::LocationName& location_name); Result GetTimeZoneRuleVersion(Out out_rule_version); Result GetDeviceLocationNameAndUpdatedTime( Out location_name, Out out_time_point); - Result SetDeviceLocationNameWithTimeZoneRule(Service::PSC::Time::LocationName& location_name, - InBuffer binary); + Result SetDeviceLocationNameWithTimeZoneRule( + const Service::PSC::Time::LocationName& location_name, + InBuffer binary); Result ParseTimeZoneBinary(OutRule out_rule, InBuffer binary); Result GetDeviceLocationNameOperationEventReadableHandle( OutCopyHandle out_event); diff --git a/src/core/hle/service/glue/time/time_zone_binary.cpp b/src/core/hle/service/glue/time/time_zone_binary.cpp index cc50b6b7b..d5f7ca3d2 100644 --- a/src/core/hle/service/glue/time/time_zone_binary.cpp +++ b/src/core/hle/service/glue/time/time_zone_binary.cpp @@ -98,7 +98,7 @@ void GetTimeZoneBinaryVersionPath(std::string& out_path) { out_path = "/version.txt"; } -void GetTimeZoneZonePath(std::string& out_path, Service::PSC::Time::LocationName& name) { +void GetTimeZoneZonePath(std::string& out_path, const Service::PSC::Time::LocationName& name) { if (g_time_zone_binary_mount_result != ResultSuccess) { return; } @@ -106,7 +106,7 @@ void GetTimeZoneZonePath(std::string& out_path, Service::PSC::Time::LocationName out_path = fmt::format("/zoneinfo/{}", name.data()); } -bool IsTimeZoneBinaryValid(Service::PSC::Time::LocationName& name) { +bool IsTimeZoneBinaryValid(const Service::PSC::Time::LocationName& name) { std::string path{}; GetTimeZoneZonePath(path, name); @@ -155,7 +155,7 @@ Result GetTimeZoneVersion(Service::PSC::Time::RuleVersion& out_rule_version) { } Result GetTimeZoneRule(std::span& out_rule, size_t& out_rule_size, - Service::PSC::Time::LocationName& name) { + const Service::PSC::Time::LocationName& name) { std::string path{}; GetTimeZoneZonePath(path, name); diff --git a/src/core/hle/service/glue/time/time_zone_binary.h b/src/core/hle/service/glue/time/time_zone_binary.h index 461f4577e..9d0a8dfe9 100644 --- a/src/core/hle/service/glue/time/time_zone_binary.h +++ b/src/core/hle/service/glue/time/time_zone_binary.h @@ -19,12 +19,12 @@ void ResetTimeZoneBinary(); Result MountTimeZoneBinary(Core::System& system); void GetTimeZoneBinaryListPath(std::string& out_path); void GetTimeZoneBinaryVersionPath(std::string& out_path); -void GetTimeZoneZonePath(std::string& out_path, Service::PSC::Time::LocationName& name); -bool IsTimeZoneBinaryValid(Service::PSC::Time::LocationName& name); +void GetTimeZoneZonePath(std::string& out_path, const Service::PSC::Time::LocationName& name); +bool IsTimeZoneBinaryValid(const Service::PSC::Time::LocationName& name); u32 GetTimeZoneCount(); Result GetTimeZoneVersion(Service::PSC::Time::RuleVersion& out_rule_version); Result GetTimeZoneRule(std::span& out_rule, size_t& out_rule_size, - Service::PSC::Time::LocationName& name); + const Service::PSC::Time::LocationName& name); Result GetTimeZoneLocationList(u32& out_count, std::span out_names, size_t max_names, u32 index); -- cgit v1.2.3