summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2020-08-03 10:13:44 -0400
committerGravatar Lioncash2020-08-03 10:42:38 -0400
commit04ca1ed2bdc583bea223ada766f56529fa36aa4e (patch)
tree1bc5191e8a1f2175784911282ca0efef4f35086a /src
parentipc: Allow all trivially copyable objects to be passed directly into WriteBuf... (diff)
downloadyuzu-04ca1ed2bdc583bea223ada766f56529fa36aa4e.tar.gz
yuzu-04ca1ed2bdc583bea223ada766f56529fa36aa4e.tar.xz
yuzu-04ca1ed2bdc583bea223ada766f56529fa36aa4e.zip
time_zone_binary: Make use of designated initializers
Diffstat (limited to 'src')
-rw-r--r--src/core/file_sys/system_archive/time_zone_binary.cpp42
1 files changed, 25 insertions, 17 deletions
diff --git a/src/core/file_sys/system_archive/time_zone_binary.cpp b/src/core/file_sys/system_archive/time_zone_binary.cpp
index 9806bd197..d1de63f20 100644
--- a/src/core/file_sys/system_archive/time_zone_binary.cpp
+++ b/src/core/file_sys/system_archive/time_zone_binary.cpp
@@ -2,6 +2,9 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <array>
6#include <vector>
7
5#include "common/swap.h" 8#include "common/swap.h"
6#include "core/file_sys/system_archive/time_zone_binary.h" 9#include "core/file_sys/system_archive/time_zone_binary.h"
7#include "core/file_sys/vfs_vector.h" 10#include "core/file_sys/vfs_vector.h"
@@ -615,31 +618,36 @@ static constexpr std::array<u8, 9633> LOCATION_NAMES{
615 0x0a}; 618 0x0a};
616 619
617static VirtualFile GenerateDefaultTimeZoneFile() { 620static VirtualFile GenerateDefaultTimeZoneFile() {
618 struct { 621 struct TimeZoneInfo {
619 s64_be at; 622 s64_be at;
620 INSERT_PADDING_BYTES(7); 623 std::array<u8, 7> padding1;
621 std::array<char, 4> time_zone_chars; 624 std::array<char, 4> time_zone_chars;
622 INSERT_PADDING_BYTES(2); 625 std::array<u8, 2> padding2;
623 std::array<char, 6> time_zone_name; 626 std::array<char, 6> time_zone_name;
624 } time_zone_info{}; 627 };
625 628
626 const VirtualFile file{std::make_shared<VectorVfsFile>( 629 VirtualFile file{std::make_shared<VectorVfsFile>(
627 std::vector<u8>(sizeof(Service::Time::TimeZone::TzifHeader) + sizeof(time_zone_info)), 630 std::vector<u8>(sizeof(Service::Time::TimeZone::TzifHeader) + sizeof(TimeZoneInfo)),
628 "GMT")}; 631 "GMT")};
629 632
630 Service::Time::TimeZone::TzifHeader header{}; 633 const Service::Time::TimeZone::TzifHeader header{
631 header.magic = 0x545a6966; 634 .magic = 0x545a6966,
632 header.version = 0x32; 635 .version = 0x32,
633 header.ttis_gmt_count = 0x1; 636 .ttis_gmt_count = 1,
634 header.ttis_std_count = 0x1; 637 .ttis_std_count = 1,
635 header.time_count = 0x1; 638 .time_count = 1,
636 header.type_count = 0x1; 639 .type_count = 1,
637 header.char_count = 0x4; 640 .char_count = 4,
641 };
638 file->WriteObject(header, 0); 642 file->WriteObject(header, 0);
639 643
640 time_zone_info.at = 0xf8; 644 const TimeZoneInfo time_zone_info{
641 time_zone_info.time_zone_chars = {'G', 'M', 'T', '\0'}; 645 .at = 0xf8,
642 time_zone_info.time_zone_name = {'\n', 'G', 'M', 'T', '0', '\n'}; 646 .padding1 = {},
647 .time_zone_chars = {'G', 'M', 'T', '\0'},
648 .padding2 = {},
649 .time_zone_name = {'\n', 'G', 'M', 'T', '0', '\n'},
650 };
643 file->WriteObject(time_zone_info, sizeof(Service::Time::TimeZone::TzifHeader)); 651 file->WriteObject(time_zone_info, sizeof(Service::Time::TimeZone::TzifHeader));
644 652
645 return file; 653 return file;