[*] Solve a few compiler warnings. Mostly unrealistic u32 <-> u64 casts in element iteration and string operations we can reasonably ignore

This commit is contained in:
Reece Wilson 2022-06-14 16:59:37 +01:00
parent f166849e9f
commit 17b1a738ca
21 changed files with 79 additions and 78 deletions

View File

@ -62,6 +62,8 @@ namespace Aurora::IO
* IOPipeRequest * IOPipeRequest
*/ */
bool bShouldReadUntilZero {}; bool bShouldReadUntilZero {};
bool bFlush {true};
}; };
struct IOPipeRequest struct IOPipeRequest
@ -103,7 +105,7 @@ namespace Aurora::IO
AuSPtr<IStreamWriter> writer; AuSPtr<IStreamWriter> writer;
bool shouldReadUntilZero; bool shouldReadUntilZero {};
}; };
struct IIOPipeWork struct IIOPipeWork

View File

@ -69,7 +69,7 @@ namespace Aurora::Compression
out.resize(startingSize + ret); out.resize(startingSize + ret);
read += deflatedLength; read += AuUInt32(deflatedLength);
} }
return true; return true;

View File

@ -73,8 +73,8 @@ namespace Aurora::Compression
AuStreamReadWrittenPair_t Ingest_s(AuUInt32 input) override AuStreamReadWrittenPair_t Ingest_s(AuUInt32 input) override
{ {
AuUInt32 length = ZSTD_DStreamInSize(); AuUInt32 length = AuUInt32(ZSTD_DStreamInSize());
AuUInt32 outFrameLength = ZSTD_DStreamOutSize(); AuUInt32 outFrameLength = AuUInt32(ZSTD_DStreamOutSize());
AuUInt32 done {}, read {}; AuUInt32 done {}, read {};
while (read < input) while (read < input)
@ -96,20 +96,20 @@ namespace Aurora::Compression
if (ZSTD_isError(ret)) if (ZSTD_isError(ret))
{ {
SysPushErrorIO("Compression error: {}", ZSTD_getErrorName(ret)); SysPushErrorIO("Compression error: {}", ZSTD_getErrorName(ret));
this->availIn_ -= output.pos; this->availIn_ -= AuUInt32(output.pos);
return AuMakePair(read, 0); return AuMakePair(read, 0);
} }
done += output.pos; done += AuUInt32(output.pos);
if (!Write(reinterpret_cast<const AuUInt8 *>(output.dst), if (!Write(reinterpret_cast<const AuUInt8 *>(output.dst),
output.pos)) AuUInt32(output.pos)))
{ {
return AuMakePair(read, 0); return AuMakePair(read, 0);
} }
} }
this->availIn_ -= this->input_.pos; this->availIn_ -= AuUInt32(this->input_.pos);
} }
return {read, done}; return {read, done};
@ -127,8 +127,8 @@ namespace Aurora::Compression
bool RunFlush(ZSTD_EndDirective type) bool RunFlush(ZSTD_EndDirective type)
{ {
AuUInt32 length = ZSTD_DStreamInSize(); AuUInt32 length = AuUInt32(ZSTD_DStreamInSize());
AuUInt32 outFrameLength = ZSTD_DStreamOutSize(); AuUInt32 outFrameLength = AuUInt32(ZSTD_DStreamOutSize());
if (!this->availIn_) if (!this->availIn_)
{ {
@ -145,18 +145,18 @@ namespace Aurora::Compression
if (ZSTD_isError(ret)) if (ZSTD_isError(ret))
{ {
SysPushErrorIO("Compression error: {}", ZSTD_getErrorName(ret)); SysPushErrorIO("Compression error: {}", ZSTD_getErrorName(ret));
this->availIn_ -= output.pos; this->availIn_ -= AuUInt32(output.pos);
return {}; return {};
} }
if (!Write(reinterpret_cast<const AuUInt8 *>(output.dst), if (!Write(reinterpret_cast<const AuUInt8 *>(output.dst),
output.pos)) AuUInt32(output.pos)))
{ {
return false; return false;
} }
} }
this->availIn_ -= this->input_.pos; this->availIn_ -= AuUInt32(this->input_.pos);
return true; return true;
} }
@ -164,11 +164,11 @@ namespace Aurora::Compression
private: private:
AuSPtr<IO::IStreamReader> reader_; AuSPtr<IO::IStreamReader> reader_;
ZSTD_CCtx *cctx_; ZSTD_CCtx *cctx_ {};
char din_[ZSTD_BLOCKSIZE_MAX]; char din_[ZSTD_BLOCKSIZE_MAX];
char dout_[ZSTD_BLOCKSIZE_MAX + 3 /*ZSTD_BLOCKHEADERSIZE*/]; char dout_[ZSTD_BLOCKSIZE_MAX + 3 /*ZSTD_BLOCKHEADERSIZE*/];
char *curPtr_; char *curPtr_ {};
AuUInt32 availIn_; AuUInt32 availIn_ {};
ZSTD_inBuffer input_; ZSTD_inBuffer input_;
}; };
} }

View File

@ -51,8 +51,8 @@ namespace Aurora::Compression
AuStreamReadWrittenPair_t Ingest_s(AuUInt32 input) override AuStreamReadWrittenPair_t Ingest_s(AuUInt32 input) override
{ {
AuUInt32 length = ZSTD_DStreamInSize(); AuUInt32 length = AuUInt32(ZSTD_DStreamInSize());
AuUInt32 outFrameLength = ZSTD_DStreamOutSize(); AuUInt32 outFrameLength = AuUInt32(ZSTD_DStreamOutSize());
AuUInt32 done {}, read {}; AuUInt32 done {}, read {};
while (read < input) while (read < input)
@ -74,20 +74,20 @@ namespace Aurora::Compression
if (ZSTD_isError(ret)) if (ZSTD_isError(ret))
{ {
SysPushErrorIO("Compression error: {}", ZSTD_getErrorName(ret)); SysPushErrorIO("Compression error: {}", ZSTD_getErrorName(ret));
this->availIn_ -= output.pos; this->availIn_ -= AuUInt32(output.pos);
return AuMakePair(read, 0); return AuMakePair(read, 0);
} }
done += output.pos; done += AuUInt32(output.pos);
if (!Write(reinterpret_cast<const AuUInt8 *>(output.dst), if (!Write(reinterpret_cast<const AuUInt8 *>(output.dst),
output.pos)) AuUInt32(output.pos)))
{ {
return AuMakePair(read, 0); return AuMakePair(read, 0);
} }
} }
this->availIn_ -= this->input_.pos; this->availIn_ -= AuUInt32(this->input_.pos);
} }
return {read, done}; return {read, done};
@ -96,11 +96,11 @@ namespace Aurora::Compression
private: private:
AuSPtr<IO::IStreamReader> reader_; AuSPtr<IO::IStreamReader> reader_;
ZSTD_DCtx *dctx_; ZSTD_DCtx *dctx_ {};
char din_[ZSTD_BLOCKSIZE_MAX + 3 /*ZSTD_BLOCKHEADERSIZE*/]; char din_[ZSTD_BLOCKSIZE_MAX + 3 /*ZSTD_BLOCKHEADERSIZE*/];
char dout_[ZSTD_BLOCKSIZE_MAX]; char dout_[ZSTD_BLOCKSIZE_MAX];
char *curPtr_; char *curPtr_ {};
AuUInt32 availIn_; AuUInt32 availIn_ {};
ZSTD_inBuffer input_; ZSTD_inBuffer input_;
}; };
} }

View File

@ -168,7 +168,7 @@ namespace Aurora::Console::ConsoleStd
gCanonicalBuffer.reserve(4096); gCanonicalBuffer.reserve(4096);
for (int i = 0; i < dwRecords; i++) for (auto i = 0u; i < dwRecords; i++)
{ {
int z; int z;
bool dBreak = false; bool dBreak = false;
@ -697,7 +697,7 @@ namespace Aurora::Console::ConsoleStd
} }
#elif defined(AURORA_IS_MODERNNT_DERIVED) #elif defined(AURORA_IS_MODERNNT_DERIVED)
WriteStdOut(writeLine.data(), writeLine.size()); WriteStdOut(writeLine.data(), AuUInt32(writeLine.size()));
#endif #endif
} }
@ -806,7 +806,7 @@ namespace Aurora::Console::ConsoleStd
{ {
AU_LOCK_GUARD(gRingLock); AU_LOCK_GUARD(gRingLock);
auto ret = stream.DecodeUTF8(gLineEncodedBuffer, gEncodedIndex, gLineBuffer.data() + gLineIndex, gLineBuffer.size() - gLineIndex); auto ret = stream.DecodeUTF8(gLineEncodedBuffer, gEncodedIndex, gLineBuffer.data() + gLineIndex, AuUInt32(gLineBuffer.size() - gLineIndex));
// increment backline buffer // increment backline buffer
{ {

View File

@ -214,7 +214,7 @@ namespace Aurora::Console::ConsoleTTY
} }
SetConsoleTextAttribute(hConsole, attrib); SetConsoleTextAttribute(hConsole, attrib);
TTYWrite(string, strlen(string)); TTYWrite(string, AuUInt32(strlen(string)));
SetConsoleTextAttribute(hConsole, FOREGROUND_WHITE); SetConsoleTextAttribute(hConsole, FOREGROUND_WHITE);
} }
@ -416,9 +416,9 @@ namespace Aurora::Console::ConsoleTTY
} }
SMALL_RECT screen = {0, 0, res.first - 1, res.second - 1}; SMALL_RECT screen = {0, 0, AuInt16(res.first - 1), AuInt16(res.second - 1)};
SetConsoleScreenBufferSize(gConsoles[0].h, COORD {(short)res.first, (short)res.second}); SetConsoleScreenBufferSize(gConsoles[0].h, COORD {(AuInt16)res.first, (AuInt16)res.second});
SetConsoleScreenBufferSize(gConsoles[1].h, COORD {(short)res.first, (short)res.second}); SetConsoleScreenBufferSize(gConsoles[1].h, COORD {(AuInt16)res.first, (AuInt16)res.second});
SetConsoleWindowInfo(gConsoles[0].h, true, &screen); SetConsoleWindowInfo(gConsoles[0].h, true, &screen);
SetConsoleWindowInfo(gConsoles[1].h, true, &screen); SetConsoleWindowInfo(gConsoles[1].h, true, &screen);
@ -457,9 +457,9 @@ namespace Aurora::Console::ConsoleTTY
} }
SMALL_RECT screen = {0, 0, res.first - 1, res.second - 1}; SMALL_RECT screen = {0, 0, AuInt16(res.first - 1), AuInt16(res.second - 1)};
SetConsoleScreenBufferSize(gConsoles[0].h, COORD {(short)res.first, (short)res.second}); SetConsoleScreenBufferSize(gConsoles[0].h, COORD {(AuInt16)res.first, (AuInt16)res.second});
SetConsoleScreenBufferSize(gConsoles[1].h, COORD {(short)res.first, (short)res.second}); SetConsoleScreenBufferSize(gConsoles[1].h, COORD {(AuInt16)res.first, (AuInt16)res.second});
SetConsoleWindowInfo(gConsoles[0].h, true, &screen); SetConsoleWindowInfo(gConsoles[0].h, true, &screen);
SetConsoleWindowInfo(gConsoles[1].h, true, &screen); SetConsoleWindowInfo(gConsoles[1].h, true, &screen);

View File

@ -208,7 +208,7 @@ namespace Aurora::Console::ConsoleTTY
} }
this->noncanonicalCursorPos += GuessWidth(input); this->noncanonicalCursorPos += GuessWidth(input);
this->noncanonicalCursorPosInBytes += input.size(); this->noncanonicalCursorPosInBytes += (int)input.size();
RedrawInput(true); RedrawInput(true);
NoncanonicalSetCursor(); NoncanonicalSetCursor();
@ -434,7 +434,7 @@ namespace Aurora::Console::ConsoleTTY
if (locked) if (locked)
{ {
this->noncanonicalCursorPos = GuessWidth(this->inputField); this->noncanonicalCursorPos = GuessWidth(this->inputField);
this->noncanonicalCursorPosInBytes = this->inputField.size(); this->noncanonicalCursorPosInBytes = (int)this->inputField.size();
NoncanonicalSetCursor(); NoncanonicalSetCursor();
} }
} }
@ -478,7 +478,7 @@ namespace Aurora::Console::ConsoleTTY
if (locked) if (locked)
{ {
this->noncanonicalCursorPos = GuessWidth(this->inputField); this->noncanonicalCursorPos = GuessWidth(this->inputField);
this->noncanonicalCursorPosInBytes = this->inputField.size(); this->noncanonicalCursorPosInBytes = (int)this->inputField.size();
NoncanonicalSetCursor(); NoncanonicalSetCursor();
} }
} }
@ -486,7 +486,7 @@ namespace Aurora::Console::ConsoleTTY
void TTYConsole::HistoryUpdateCursor() void TTYConsole::HistoryUpdateCursor()
{ {
this->noncanonicalCursorPos = AuMin<AuUInt32>(this->noncanonicalCursorPos, GuessWidth(this->inputField)); this->noncanonicalCursorPos = AuMin<AuUInt32>(this->noncanonicalCursorPos, GuessWidth(this->inputField));
this->noncanonicalCursorPosInBytes = AuMin<AuUInt32>(this->noncanonicalCursorPosInBytes, this->inputField.size()); this->noncanonicalCursorPosInBytes = AuMin<AuUInt32>(this->noncanonicalCursorPosInBytes, AuUInt32(this->inputField.size()));
RedrawInput(true); RedrawInput(true);
NoncanonicalSetCursor(); NoncanonicalSetCursor();
} }
@ -716,7 +716,7 @@ namespace Aurora::Console::ConsoleTTY
{ {
int XOffset = GetLeftBorder() + this->leftLogPadding; int XOffset = GetLeftBorder() + this->leftLogPadding;
auto itr = 0; auto itr = str.npos;
itr = str.find('\t', itr); itr = str.find('\t', itr);
while (itr != str.npos) while (itr != str.npos)
@ -740,7 +740,7 @@ namespace Aurora::Console::ConsoleTTY
AuTryInsert(this->screenBuffer, append); AuTryInsert(this->screenBuffer, append);
str = str.substr(idx); str = str.substr(idx);
this->bScreenBufferDoesntMap |= str.size(); this->bScreenBufferDoesntMap |= bool(str.size());
} }
} }
@ -1004,7 +1004,7 @@ namespace Aurora::Console::ConsoleTTY
#if defined(AURORA_IS_MODERNNT_DERIVED) #if defined(AURORA_IS_MODERNNT_DERIVED)
DWORD idc; DWORD idc;
WriteConsoleA(GetTTYHandle(), in.data(), in.size(), &idc, NULL); WriteConsoleA(GetTTYHandle(), in.data(), AuUInt32(in.size()), &idc, NULL);
#else #else
ConsoleStd::WriteStdOutBlocking2(in.data(), in.size()); ConsoleStd::WriteStdOutBlocking2(in.data(), in.size());
#endif #endif
@ -1049,7 +1049,7 @@ namespace Aurora::Console::ConsoleTTY
#if defined(AURORA_IS_MODERNNT_DERIVED) #if defined(AURORA_IS_MODERNNT_DERIVED)
DWORD idc; DWORD idc;
WriteConsoleA(GetTTYHandle(), in.data(), in.size(), &idc, NULL); WriteConsoleA(GetTTYHandle(), in.data(), AuUInt32(in.size()), &idc, NULL);
#else #else
ConsoleStd::WriteStdOutBlocking2(in.data(), in.size()); ConsoleStd::WriteStdOutBlocking2(in.data(), in.size());
#endif #endif
@ -1204,7 +1204,7 @@ namespace Aurora::Console::ConsoleTTY
AuUInt32 TTYConsole::GuessWidth(const AuString &referenceLine) AuUInt32 TTYConsole::GuessWidth(const AuString &referenceLine)
{ {
return AuLocale::ConvertFromUTF8(referenceLine).size() ; return AuUInt32(AuLocale::ConvertFromUTF8(referenceLine).size());
} }
const AuString &TTYConsole::Stringify(const AuString &referenceLine, const AlignedString &string, bool spacing, bool brackets, bool extraPadding) const AuString &TTYConsole::Stringify(const AuString &referenceLine, const AlignedString &string, bool spacing, bool brackets, bool extraPadding)
@ -1326,21 +1326,21 @@ namespace Aurora::Console::ConsoleTTY
} }
// kanker // kanker
int toWrite = (brackets * stride) + DECOverheadA + spacing + string.str.size() + spacing + DECOverheadB + (brackets * stride); AuUInt toWrite = (brackets * stride) + DECOverheadA + spacing + string.str.size() + spacing + DECOverheadB + (brackets * stride);
int toSlice = stride * ((spacing * 2) + (brackets * 2) + string.str.size()); AuUInt toSlice = stride * ((spacing * 2) + (brackets * 2) + string.str.size());
// brrr // brrr
if (toWrite <= toSlice) if (toWrite <= toSlice)
{ {
// Fast path, pog. We dont need to allocate. // Fast path, pog. We dont need to allocate.
int strideTwo = brackets * stride; AuUInt strideTwo = brackets * stride;
if (toWrite < toSlice) if (toWrite < toSlice)
{ {
int second = start + strideTwo + DECOverheadA + spacing + string.str.size() + spacing + DECOverheadB + right.size(); AuUInt second = start + strideTwo + DECOverheadA + spacing + string.str.size() + spacing + DECOverheadB + right.size();
int two = start + (length * strideTwo); AuUInt two = start + (length * strideTwo);
int count = this->tempMemory.size() - two; AuUInt count = this->tempMemory.size() - two;
AuMemmove(this->tempMemory.data() + second, AuMemmove(this->tempMemory.data() + second,
this->tempMemory.data() + two, this->tempMemory.size() - two); this->tempMemory.data() + two, this->tempMemory.size() - two);
@ -1550,7 +1550,7 @@ namespace Aurora::Console::ConsoleTTY
ETTYAlign TTYConsole::SetTitleAlignment(ETTYAlign newValue) ETTYAlign TTYConsole::SetTitleAlignment(ETTYAlign newValue)
{ {
return AuExchange(this->headerTitle.align, newValue); return AuExchange(this->headerTitle.align, newValue);
} }
ETTYAlign TTYConsole::GetLogBoxTitleAlignment() ETTYAlign TTYConsole::GetLogBoxTitleAlignment()
{ {

View File

@ -40,7 +40,7 @@ namespace Aurora::Console::Hooks
void WriteLoggerFailedWarning() void WriteLoggerFailedWarning()
{ {
static AuString kLoggerError = "Something went from while dispatching a log line\n"; static AuString kLoggerError = "Something went from while dispatching a log line\n";
Console::WriteStdOut(kLoggerError.data(), kLoggerError.size()); Console::WriteStdOut(kLoggerError.data(), (AuUInt32)kLoggerError.size());
#if defined(AURORA_IS_MODERNNT_DERIVED) #if defined(AURORA_IS_MODERNNT_DERIVED)
OutputDebugStringA(kLoggerError.c_str()); OutputDebugStringA(kLoggerError.c_str());

View File

@ -33,7 +33,6 @@ namespace Aurora::Crypto::ECC
EHashType method, EHashType method,
AuByteBuffer &out) AuByteBuffer &out)
{ {
prng_state yarrow_prng;
const int salt = 0; const int salt = 0;
if (!plainText.HasMemory()) if (!plainText.HasMemory())

View File

@ -23,7 +23,7 @@ extern "C"
AUKN_SYM mp_err s_mp_rand_platform(void *p, size_t n) AUKN_SYM mp_err s_mp_rand_platform(void *p, size_t n)
{ {
Aurora::RNG::ReadSecureRNG(p, n); Aurora::RNG::ReadSecureRNG(p, AuUInt32(n));
return MP_OKAY; return MP_OKAY;
} }
} }

View File

@ -12,7 +12,7 @@ extern "C"
{ {
AUKN_SYM int mbedtls_platform_entropy_poll(void *data, unsigned char *output, size_t len, size_t *olen) AUKN_SYM int mbedtls_platform_entropy_poll(void *data, unsigned char *output, size_t len, size_t *olen)
{ {
Aurora::RNG::ReadSecureRNG(output, len); Aurora::RNG::ReadSecureRNG(output, AuUInt32(len));
*olen = len; *olen = len;
return 0; return 0;
} }

View File

@ -364,7 +364,7 @@ namespace Aurora::HWInfo
auto cpuInfo = cpuid(0); auto cpuInfo = cpuid(0);
auto nIds = cpuInfo.eax; auto nIds = cpuInfo.eax;
for (int i = 0; i <= nIds; ++i) for (AuUInt i = 0; i <= nIds; ++i)
{ {
data.push_back(cpuid(i)); data.push_back(cpuid(i));
} }
@ -407,7 +407,7 @@ namespace Aurora::HWInfo
char brand[0x40]; char brand[0x40];
AuMemset(brand, 0, sizeof(brand)); AuMemset(brand, 0, sizeof(brand));
for (int i = 0x80000000; i <= nExIds; ++i) for (AuUInt i = 0x80000000u; i <= nExIds; ++i)
{ {
extdata.push_back(cpuid(i)); extdata.push_back(cpuid(i));
} }

View File

@ -36,7 +36,7 @@ namespace Aurora::HWInfo
AuBST<AuUInt8, CpuInfo> cpuThreads; AuBST<AuUInt8, CpuInfo> cpuThreads;
AuUInt8 cpuCount; AuUInt8 cpuCount;
cpuCount = length / sizeof(decltype(*cpuSetInfo)); cpuCount = AuUInt8(length / sizeof(decltype(*cpuSetInfo)));
for (int i = 0; i < cpuCount; i++) for (int i = 0; i < cpuCount; i++)
{ {
@ -99,7 +99,7 @@ namespace Aurora::HWInfo
gCpuInfo.uSocket = 1; gCpuInfo.uSocket = 1;
gCpuInfo.uThreads = cpuCount; gCpuInfo.uThreads = cpuCount;
gCpuInfo.uCores = cpuThreads.size(); gCpuInfo.uCores = AuUInt8(cpuThreads.size());
if (!GetLogicalProcessorInformation(sysinfo, &length)) if (!GetLogicalProcessorInformation(sysinfo, &length))
{ {
@ -109,7 +109,7 @@ namespace Aurora::HWInfo
gCpuInfo.uSocket = 0; gCpuInfo.uSocket = 0;
length /= sizeof(*sysinfo); length /= sizeof(*sysinfo);
for (auto i = 0; i < length; i++) for (auto i = 0u; i < length; i++)
{ {
if (sysinfo[i].Relationship == RelationProcessorPackage) if (sysinfo[i].Relationship == RelationProcessorPackage)
{ {
@ -170,7 +170,7 @@ namespace Aurora::HWInfo
bool sparse = false; bool sparse = false;
bool hasHTCores = false; bool hasHTCores = false;
for (auto i = 0; i < length; i++) for (auto i = 0u; i < length; i++)
{ {
if (sysinfo[i].Relationship == RelationProcessorCore) if (sysinfo[i].Relationship == RelationProcessorCore)
{ {

View File

@ -352,7 +352,7 @@ namespace Aurora::IO::Loop
this->handleArrayAnd_.reserve(this->loopSourceExs_.size() + this->addedSources_.size()); this->handleArrayAnd_.reserve(this->loopSourceExs_.size() + this->addedSources_.size());
this->handleArrayOr_.reserve(this->loopSourceExs_.size() + this->addedSources_.size()); this->handleArrayOr_.reserve(this->loopSourceExs_.size() + this->addedSources_.size());
bShouldRebuild |= this->addedSources_.size(); bShouldRebuild |= bool(this->addedSources_.size());
// //
for (auto &[source, timeout, callbacks] : this->addedSources_) for (auto &[source, timeout, callbacks] : this->addedSources_)
@ -690,7 +690,7 @@ namespace Aurora::IO::Loop
else else
{ {
AuUInt uHandles = (source.source->Singular() ? 1 : source.source->GetHandles().size()); AuUInt uHandles = (source.source->Singular() ? 1 : source.source->GetHandles().size());
int sOffset = -(uHandles); int sOffset = -((int)uHandles);
if (this->handleArrayOr_.size() > MAXIMUM_WAIT_OBJECTS) if (this->handleArrayOr_.size() > MAXIMUM_WAIT_OBJECTS)
{ {
this->RemoveSourceNB(source.source); this->RemoveSourceNB(source.source);

View File

@ -77,7 +77,7 @@ namespace Aurora::Locale::Encoding
{ {
auto preemptive = EncodeUTF8(binary, binaryLength, nullptr, 0); auto preemptive = EncodeUTF8(binary, binaryLength, nullptr, 0);
if (!AuTryResize(out, preemptive.second)) return {}; if (!AuTryResize(out, preemptive.second)) return {};
auto main = EncodeUTF8(binary, preemptive.second, out.data(), out.size()); auto main = EncodeUTF8(binary, preemptive.second, out.data(), AuUInt32(out.size()));
if (main.second == 0) return {}; if (main.second == 0) return {};
if (!AuTryResize(out, main.second)) return {}; if (!AuTryResize(out, main.second)) return {};
out.shrink_to_fit(); out.shrink_to_fit();

View File

@ -21,7 +21,7 @@ namespace Aurora::Parse
return false; return false;
} }
auto status = base32_decode(in.data(), in.size(), reinterpret_cast<unsigned char *>(&decoded[0]), &length, BASE32_RFC4648); auto status = base32_decode(in.data(), (unsigned long)in.size(), reinterpret_cast<unsigned char *>(&decoded[0]), &length, BASE32_RFC4648);
if (!AuTryResize(decoded, length)) if (!AuTryResize(decoded, length))
{ {
SysPushErrorMem(); SysPushErrorMem();
@ -41,7 +41,7 @@ namespace Aurora::Parse
return false; return false;
} }
auto status = base32_encode(reinterpret_cast<const unsigned char *>(buffer), length, &encoded[0], &outLength, BASE32_RFC4648); auto status = base32_encode(reinterpret_cast<const unsigned char *>(buffer), (unsigned long)length, &encoded[0], &outLength, BASE32_RFC4648);
if (!AuTryResize(encoded, length)) if (!AuTryResize(encoded, length))
{ {
SysPushErrorMem(); SysPushErrorMem();

View File

@ -13,7 +13,7 @@ namespace Aurora::Parse
{ {
AUKN_SYM bool Base64Decode(const AuString &in, AuByteBuffer &decoded, bool url) AUKN_SYM bool Base64Decode(const AuString &in, AuByteBuffer &decoded, bool url)
{ {
unsigned long length = in.size(); unsigned long length = (unsigned long)in.size();
if (!AuTryResize(decoded, length)) if (!AuTryResize(decoded, length))
{ {
@ -24,11 +24,11 @@ namespace Aurora::Parse
int status; int status;
if (url) if (url)
{ {
status = base64url_decode(in.data(), in.size(), reinterpret_cast<unsigned char *>(&decoded[0]), &length); status = base64url_decode(in.data(), (unsigned long)in.size(), reinterpret_cast<unsigned char *>(&decoded[0]), &length);
} }
else else
{ {
status = base64_decode(in.data(), in.size(), reinterpret_cast<unsigned char *>(&decoded[0]), &length); status = base64_decode(in.data(), (unsigned long)in.size(), reinterpret_cast<unsigned char *>(&decoded[0]), &length);
} }
if (!AuTryResize(decoded, length)) if (!AuTryResize(decoded, length))
@ -53,11 +53,11 @@ namespace Aurora::Parse
int status; int status;
if (url) if (url)
{ {
status = base64url_encode(reinterpret_cast<const unsigned char*>(input.ptr), input.length, &encoded[0], &outLength); status = base64url_encode(reinterpret_cast<const unsigned char*>(input.ptr), (unsigned long)input.length, &encoded[0], &outLength);
} }
else else
{ {
status = base64_encode(reinterpret_cast<const unsigned char*>(input.ptr), input.length, &encoded[0], &outLength); status = base64_encode(reinterpret_cast<const unsigned char*>(input.ptr), (unsigned long)input.length, &encoded[0], &outLength);
} }
if (!AuTryResize(encoded, outLength)) if (!AuTryResize(encoded, outLength))

View File

@ -233,7 +233,7 @@ namespace Aurora::Parse
in.insert(in.size(), newLine); in.insert(in.size(), newLine);
} }
for (int i = 0; i < length; ) for (auto i = 0u; i < length; )
{ {
AuUInt32 x, rowMax; AuUInt32 x, rowMax;

View File

@ -46,7 +46,7 @@ namespace Aurora::Process
return {}; return {};
} }
auto length = GetModuleFileNameW(handle, &file[0], file.size()); auto length = GetModuleFileNameW(handle, &file[0], DWORD(file.size()));
if (!length) if (!length)
{ {
return {}; return {};

View File

@ -259,7 +259,7 @@ namespace Aurora::Processes
if (handle != INVALID_HANDLE_VALUE && handle) if (handle != INVALID_HANDLE_VALUE && handle)
{ {
SetHandleInformation(handle, HANDLE_FLAG_INHERIT, 1); SetHandleInformation(handle, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT);
this->bDontRelOut_ = true; this->bDontRelOut_ = true;
this->pipeStdOutWrite_ = handle; this->pipeStdOutWrite_ = handle;
@ -289,7 +289,7 @@ namespace Aurora::Processes
if (handle != INVALID_HANDLE_VALUE && handle) if (handle != INVALID_HANDLE_VALUE && handle)
{ {
SetHandleInformation(handle, HANDLE_FLAG_INHERIT, 1); SetHandleInformation(handle, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT);
this->bDontRelErr_ = true; this->bDontRelErr_ = true;
this->pipeStdErrWrite_ = handle; this->pipeStdErrWrite_ = handle;
@ -319,7 +319,7 @@ namespace Aurora::Processes
if (handle != INVALID_HANDLE_VALUE && handle) if (handle != INVALID_HANDLE_VALUE && handle)
{ {
SetHandleInformation(handle, HANDLE_FLAG_INHERIT, 1); SetHandleInformation(handle, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT);
this->bDontRelIn_ = true; this->bDontRelIn_ = true;
this->pipeStdInRead_ = handle; this->pipeStdInRead_ = handle;

View File

@ -76,7 +76,7 @@ namespace Aurora::RNG
AuString RandomDevice::NextString(AuUInt32 length, ERngStringCharacters type) AuString RandomDevice::NextString(AuUInt32 length, ERngStringCharacters type)
{ {
AuString ret(length, '\00'); AuString ret(length, '\00');
NextString(ret.data(), ret.size(), type); NextString(ret.data(), AuUInt32(ret.size()), type);
return ret; return ret;
} }
@ -102,7 +102,7 @@ namespace Aurora::RNG
const auto &pair = rngSequence[static_cast<int>(type)]; const auto &pair = rngSequence[static_cast<int>(type)];
for (auto i = 0; i < length; i++) for (auto i = 0u; i < length; i++)
{ {
string[i] = pair.first[reinterpret_cast<const AuUInt8 *>(string)[i] % static_cast<int>(pair.second)]; string[i] = pair.first[reinterpret_cast<const AuUInt8 *>(string)[i] % static_cast<int>(pair.second)];
} }