Windows build fixes and warning avoidance

This commit is contained in:
Jack Andersen 2018-05-24 20:38:06 -10:00
parent 51a15e474e
commit d5f5db440c
7 changed files with 30 additions and 28 deletions

View File

@ -46,10 +46,8 @@ public:
size_t m_fileSz; size_t m_fileSz;
bool m_isDir; bool m_isDir;
private: Entry(const SystemString& path, const SystemChar* name, size_t sz, bool isDir)
friend class DirectoryEnumerator; : m_path(path), m_name(name), m_fileSz(sz), m_isDir(isDir) {}
Entry(SystemString&& path, const SystemChar* name, size_t sz, bool isDir)
: m_path(std::move(path)), m_name(name), m_fileSz(sz), m_isDir(isDir) {}
}; };
private: private:

View File

@ -17,7 +17,6 @@ public:
class DiscBuilderWii : public DiscBuilderBase class DiscBuilderWii : public DiscBuilderBase
{ {
bool m_dualLayer;
public: public:
DiscBuilderWii(SystemStringView outPath, bool dualLayer, FProgress progressCB); DiscBuilderWii(SystemStringView outPath, bool dualLayer, FProgress progressCB);
EBuildResult buildFromDirectory(SystemStringView dirIn); EBuildResult buildFromDirectory(SystemStringView dirIn);

View File

@ -51,7 +51,7 @@ DirectoryEnumerator::DirectoryEnumerator(SystemStringView path, Mode mode,
else else
continue; continue;
m_entries.push_back(std::move(Entry(std::move(fp), d.cFileName, sz, isDir))); m_entries.push_back(Entry(fp, d.cFileName, sz, isDir));
} while (FindNextFileW(dir, &d)); } while (FindNextFileW(dir, &d));
break; break;
case Mode::DirsThenFilesSorted: case Mode::DirsThenFilesSorted:
@ -70,7 +70,7 @@ DirectoryEnumerator::DirectoryEnumerator(SystemStringView path, Mode mode,
Sstat st; Sstat st;
if (Stat(fp.c_str(), &st) || !S_ISDIR(st.st_mode)) if (Stat(fp.c_str(), &st) || !S_ISDIR(st.st_mode))
continue; continue;
sort.emplace(std::make_pair(d.cFileName, Entry(std::move(fp), d.cFileName, 0, true))); sort.emplace(std::make_pair(d.cFileName, Entry(fp, d.cFileName, 0, true)));
} while (FindNextFileW(dir, &d)); } while (FindNextFileW(dir, &d));
m_entries.reserve(sort.size()); m_entries.reserve(sort.size());
@ -106,7 +106,7 @@ DirectoryEnumerator::DirectoryEnumerator(SystemStringView path, Mode mode,
Sstat st; Sstat st;
if (Stat(fp.c_str(), &st) || !S_ISREG(st.st_mode)) if (Stat(fp.c_str(), &st) || !S_ISREG(st.st_mode))
continue; continue;
sort.emplace(std::make_pair(st.st_size, Entry(std::move(fp), d.cFileName, st.st_size, false))); sort.emplace(std::make_pair(st.st_size, Entry(fp, d.cFileName, st.st_size, false)));
} while (FindNextFileW(dir, &d)); } while (FindNextFileW(dir, &d));
m_entries.reserve(sort.size()); m_entries.reserve(sort.size());
@ -132,7 +132,7 @@ DirectoryEnumerator::DirectoryEnumerator(SystemStringView path, Mode mode,
Sstat st; Sstat st;
if (Stat(fp.c_str(), &st) || !S_ISREG(st.st_mode)) if (Stat(fp.c_str(), &st) || !S_ISREG(st.st_mode))
continue; continue;
sort.emplace(std::make_pair(d.cFileName, Entry(std::move(fp), d.cFileName, st.st_size, false))); sort.emplace(std::make_pair(d.cFileName, Entry(fp, d.cFileName, st.st_size, false)));
} while (FindNextFileW(dir, &d)); } while (FindNextFileW(dir, &d));
m_entries.reserve(sort.size()); m_entries.reserve(sort.size());
@ -180,7 +180,7 @@ DirectoryEnumerator::DirectoryEnumerator(SystemStringView path, Mode mode,
else else
continue; continue;
m_entries.push_back(Entry(std::move(fp), d->d_name, sz, isDir)); m_entries.push_back(Entry(fp, d->d_name, sz, isDir));
} }
break; break;
case Mode::DirsThenFilesSorted: case Mode::DirsThenFilesSorted:
@ -199,7 +199,7 @@ DirectoryEnumerator::DirectoryEnumerator(SystemStringView path, Mode mode,
Sstat st; Sstat st;
if (Stat(fp.c_str(), &st) || !S_ISDIR(st.st_mode)) if (Stat(fp.c_str(), &st) || !S_ISDIR(st.st_mode))
continue; continue;
sort.emplace(std::make_pair(d->d_name, Entry(std::move(fp), d->d_name, 0, true))); sort.emplace(std::make_pair(d->d_name, Entry(fp, d->d_name, 0, true)));
} }
m_entries.reserve(sort.size()); m_entries.reserve(sort.size());
@ -234,7 +234,7 @@ DirectoryEnumerator::DirectoryEnumerator(SystemStringView path, Mode mode,
Sstat st; Sstat st;
if (Stat(fp.c_str(), &st) || !S_ISREG(st.st_mode)) if (Stat(fp.c_str(), &st) || !S_ISREG(st.st_mode))
continue; continue;
sort.emplace(std::make_pair(st.st_size, Entry(std::move(fp), d->d_name, st.st_size, false))); sort.emplace(std::make_pair(st.st_size, Entry(fp, d->d_name, st.st_size, false)));
} }
m_entries.reserve(sort.size()); m_entries.reserve(sort.size());
@ -260,7 +260,7 @@ DirectoryEnumerator::DirectoryEnumerator(SystemStringView path, Mode mode,
Sstat st; Sstat st;
if (Stat(fp.c_str(), &st) || !S_ISREG(st.st_mode)) if (Stat(fp.c_str(), &st) || !S_ISREG(st.st_mode))
continue; continue;
sort.emplace(std::make_pair(d->d_name, Entry(std::move(fp), d->d_name, st.st_size, false))); sort.emplace(std::make_pair(d->d_name, Entry(fp, d->d_name, st.st_size, false)));
} }
m_entries.reserve(sort.size()); m_entries.reserve(sort.size());

View File

@ -283,8 +283,8 @@ public:
} }
return _build( return _build(
[this, &bootIn](IPartWriteStream& ws, uint32_t dolOff, uint32_t fstOff, uint32_t fstSz, [&bootIn](IPartWriteStream& ws, uint32_t dolOff, uint32_t fstOff, uint32_t fstSz,
uint32_t userOff, uint32_t userSz) -> bool uint32_t userOff, uint32_t userSz) -> bool
{ {
std::unique_ptr<IFileIO::IReadStream> rs = NewFileIO(bootIn.c_str())->beginReadStream(); std::unique_ptr<IFileIO::IReadStream> rs = NewFileIO(bootIn.c_str())->beginReadStream();
if (!rs) if (!rs)
@ -300,7 +300,7 @@ public:
header.write(ws); header.write(ws);
return true; return true;
}, },
[this, &bi2In](IPartWriteStream& ws) -> bool [&bi2In](IPartWriteStream& ws) -> bool
{ {
std::unique_ptr<IFileIO::IReadStream> rs = NewFileIO(bi2In.c_str())->beginReadStream(); std::unique_ptr<IFileIO::IReadStream> rs = NewFileIO(bi2In.c_str())->beginReadStream();
if (!rs) if (!rs)
@ -346,8 +346,8 @@ public:
return false; return false;
return _build( return _build(
[this, partIn](IPartWriteStream& ws, uint32_t dolOff, uint32_t fstOff, uint32_t fstSz, [partIn](IPartWriteStream& ws, uint32_t dolOff, uint32_t fstOff, uint32_t fstSz,
uint32_t userOff, uint32_t userSz) -> bool uint32_t userOff, uint32_t userSz) -> bool
{ {
Header header = partIn->getHeader(); Header header = partIn->getHeader();
header.m_dolOff = dolOff; header.m_dolOff = dolOff;
@ -359,7 +359,7 @@ public:
header.write(ws); header.write(ws);
return true; return true;
}, },
[this, partIn](IPartWriteStream& ws) -> bool [partIn](IPartWriteStream& ws) -> bool
{ {
partIn->getBI2().write(ws); partIn->getBI2().write(ws);
return true; return true;

View File

@ -1135,7 +1135,7 @@ public:
return true; return true;
}, },
[this, &bootIn](IPartWriteStream& cws, uint32_t dolOff, uint32_t fstOff, uint32_t fstSz) -> bool [&bootIn](IPartWriteStream& cws, uint32_t dolOff, uint32_t fstOff, uint32_t fstSz) -> bool
{ {
std::unique_ptr<IFileIO::IReadStream> rs = NewFileIO(bootIn.c_str())->beginReadStream(); std::unique_ptr<IFileIO::IReadStream> rs = NewFileIO(bootIn.c_str())->beginReadStream();
if (!rs) if (!rs)
@ -1149,7 +1149,7 @@ public:
header.write(cws); header.write(cws);
return true; return true;
}, },
[this, &bi2In](IPartWriteStream& cws) -> bool [&bi2In](IPartWriteStream& cws) -> bool
{ {
std::unique_ptr<IFileIO::IReadStream> rs = NewFileIO(bi2In.c_str())->beginReadStream(); std::unique_ptr<IFileIO::IReadStream> rs = NewFileIO(bi2In.c_str())->beginReadStream();
if (!rs) if (!rs)
@ -1216,7 +1216,7 @@ public:
return true; return true;
}, },
[this, partIn](IPartWriteStream& cws, uint32_t dolOff, uint32_t fstOff, uint32_t fstSz) -> bool [partIn](IPartWriteStream& cws, uint32_t dolOff, uint32_t fstOff, uint32_t fstSz) -> bool
{ {
Header header = partIn->getHeader(); Header header = partIn->getHeader();
header.m_dolOff = uint32_t(dolOff >> uint64_t(2)); header.m_dolOff = uint32_t(dolOff >> uint64_t(2));
@ -1226,7 +1226,7 @@ public:
header.write(cws); header.write(cws);
return true; return true;
}, },
[this, partIn](IPartWriteStream& cws) -> bool [partIn](IPartWriteStream& cws) -> bool
{ {
partIn->getBI2().write(cws); partIn->getBI2().write(cws);
return true; return true;
@ -1371,7 +1371,7 @@ uint64_t DiscBuilderWii::CalculateTotalSizeRequired(SystemStringView dirIn, bool
} }
DiscBuilderWii::DiscBuilderWii(SystemStringView outPath, bool dualLayer, FProgress progressCB) DiscBuilderWii::DiscBuilderWii(SystemStringView outPath, bool dualLayer, FProgress progressCB)
: DiscBuilderBase(outPath, dualLayer ? 0x1FB4E0000 : 0x118240000, progressCB), m_dualLayer(dualLayer) : DiscBuilderBase(outPath, dualLayer ? 0x1FB4E0000 : 0x118240000, progressCB)
{ {
PartitionBuilderWii* partBuilder = new PartitionBuilderWii(*this, PartitionKind::Data, 0x200000); PartitionBuilderWii* partBuilder = new PartitionBuilderWii(*this, PartitionKind::Data, 0x200000);
m_partitions.emplace_back(partBuilder); m_partitions.emplace_back(partBuilder);

View File

@ -8,6 +8,10 @@
#include <cpuid.h> #include <cpuid.h>
#endif #endif
#if __AES__ || (!defined(__clang__) && _MSC_VER >= 1800)
#define _AES_NI 1
#endif
namespace nod namespace nod
{ {
@ -468,7 +472,7 @@ void SoftwareAES::encrypt(const uint8_t* iv, const uint8_t* inbuf, uint8_t* outb
} }
} }
#if __AES__ || _MSC_VER >= 1800 #if _AES_NI
#include <wmmintrin.h> #include <wmmintrin.h>
@ -583,12 +587,13 @@ public:
} }
}; };
static int HAS_AES_NI = -1;
#endif #endif
static int HAS_AES_NI = -1;
std::unique_ptr<IAES> NewAES() std::unique_ptr<IAES> NewAES()
{ {
#if __AES__ || _MSC_VER >= 1800 #if _AES_NI
if (HAS_AES_NI == -1) if (HAS_AES_NI == -1)
{ {
#if _MSC_VER #if _MSC_VER

@ -1 +1 @@
Subproject commit 71bbb3d0829948bdc1c20926bc254bed1985d134 Subproject commit 073cf1473bde254516f7637fcb787478aab47d6c