Skip to content

Commit 3e214c6

Browse files
committed
xex1tool: fix some clang warnings
1 parent e18f38b commit 3e214c6

File tree

3 files changed

+16
-15
lines changed

3 files changed

+16
-15
lines changed

xdbf/xdbf.cc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ namespace kernel {
1717
namespace xam {
1818
namespace xdbf {
1919

20-
constexpr uint32_t kXdbfMagicXdbf = 'XDBF';
21-
2220
bool XdbfFile::Read(const uint8_t* data, size_t data_size) {
2321
if (!data || data_size <= sizeof(X_XDBF_HEADER)) {
2422
return false;

xdbf/xdbf.hpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ namespace xdbf {
2323
// https://github.com/oukiar/freestyledash/blob/master/Freestyle/Tools/XEX/SPA.h
2424
// https://github.com/oukiar/freestyledash/blob/master/Freestyle/Tools/XEX/SPA.cpp
2525

26+
constexpr uint32_t kXdbfMagicXdbf = 0x46424458; // XDBF
27+
2628
enum class SpaID : uint64_t {
27-
Xach = 'XACH',
28-
Xstr = 'XSTR',
29-
Xstc = 'XSTC',
30-
Xthd = 'XTHD',
29+
Xach = 0x48434158, // XACH
30+
Xstr = 0x52545358, // XSTR
31+
Xstc = 0x43545358, // XSTC
32+
Xthd = 0x44485458, // XTHD
3133
Title = 0x8000,
3234
};
3335

@@ -161,7 +163,7 @@ struct Entry {
161163
class XdbfFile {
162164
public:
163165
XdbfFile() {
164-
header_.magic = 'XDBF';
166+
header_.magic = kXdbfMagicXdbf;
165167
header_.version = 1;
166168
}
167169

xex1tool.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <iostream>
55
#include <cstdio>
66
#include <filesystem>
7+
#include <cinttypes>
78

89
#include "3rdparty/cxxopts.hpp"
910
#include "3rdparty/date.hpp"
@@ -98,9 +99,9 @@ void PrintImports(XEXFile& xex) {
9899
{
99100
auto& table_header = tables.at(libname);
100101

101-
printf("# %s v%d.%d.%d.%d\n# (min v%d.%d.%d.%d, %llu imports)\n", libname.c_str(),
102+
printf("# %s v%d.%d.%d.%d\n# (min v%d.%d.%d.%d, %d imports)\n", libname.c_str(),
102103
table_header.Version.Major, table_header.Version.Minor, table_header.Version.Build, table_header.Version.QFE,
103-
table_header.VersionMin.Major, table_header.VersionMin.Minor, table_header.VersionMin.Build, table_header.VersionMin.QFE, lib.second.size());
104+
table_header.VersionMin.Major, table_header.VersionMin.Minor, table_header.VersionMin.Build, table_header.VersionMin.QFE, int(lib.second.size()));
104105

105106
version = table_header.Version.Build;
106107
}
@@ -603,13 +604,13 @@ void PrintInfo(XEXFile& xex, bool print_mem_pages)
603604
// TODO: print these as strings!
604605
if (time_range)
605606
{
606-
printf(" Start Date: %llX\n", (uint64_t)time_range->Start);
607-
printf(" End Date: %llX\n", (uint64_t)time_range->End);
607+
printf(" Start Date: %" PRIX64 "\n", (uint64_t)time_range->Start);
608+
printf(" End Date: %" PRIX64 "\n", (uint64_t)time_range->End);
608609
}
609610
if (kv_privs)
610611
{
611-
printf(" KeyVault Mask: %llX\n", (uint64_t)kv_privs->Mask);
612-
printf(" KeyVault Value: %llX\n", (uint64_t)kv_privs->Match);
612+
printf(" KeyVault Mask: %" PRIX64 "\n", (uint64_t)kv_privs->Mask);
613+
printf(" KeyVault Value: %" PRIX64 "\n", (uint64_t)kv_privs->Match);
613614
}
614615
// TODO: consoleID table
615616
}
@@ -896,15 +897,15 @@ int main(int argc, char* argv[])
896897

897898
if (!result.count("positional"))
898899
{
899-
printf(options.help().c_str());
900+
printf("%s", options.help().c_str());
900901
return 0;
901902
}
902903

903904
auto& positional = result["positional"].as<std::vector<std::string>>();
904905

905906
if (!positional.size())
906907
{
907-
printf(options.help().c_str());
908+
printf("%s", options.help().c_str());
908909
return 0;
909910
}
910911

0 commit comments

Comments
 (0)