[*] Fix recent regression in f401c6f750 and fix two ignored return values

This commit is contained in:
Reece Wilson 2024-03-13 10:36:48 +00:00
parent dbd2ec78b3
commit b3f1ef8bc2
3 changed files with 18 additions and 9 deletions

View File

@ -355,8 +355,9 @@ namespace Aurora::IO::FS
bOk = pStream->Write(AuMemoryViewStreamRead { bom });
if (auto uLength = str.length())
{
bOk &= pStream->Write(AuMemoryViewStreamRead { str, uLength });
bOk &= uLength == uLength;
AuUInt uOutLength {};
bOk &= pStream->Write(AuMemoryViewStreamRead { str, uOutLength });
bOk &= uOutLength == uLength;
}
else
{
@ -378,7 +379,6 @@ namespace Aurora::IO::FS
{
AuIO::IOHandle handle;
AuUInt uLength {};
auto createRequest = AuIO::IIOHandle::HandleCreate::ReadWrite(path);
createRequest.bAlwaysCreateDirTree = true;
@ -397,8 +397,9 @@ namespace Aurora::IO::FS
bOk = pStream->Write(AuMemoryViewStreamRead { bom });
if (auto uLength = str.length())
{
bOk &= pStream->Write(AuMemoryViewStreamRead { str, uLength });
bOk &= uLength == uLength;
AuUInt uOutLength {};
bOk &= pStream->Write(AuMemoryViewStreamRead { str, uOutLength });
bOk &= uOutLength == uLength;
}
else
{
@ -418,7 +419,6 @@ namespace Aurora::IO::FS
bool bOk {};
{
AuUInt uLength {};
AuIO::IOHandle handle;
auto createRequest = AuIO::IIOHandle::HandleCreate::ReadWrite(path);
@ -438,6 +438,7 @@ namespace Aurora::IO::FS
if (blob.length)
{
AuUInt uLength {};
bOk = pStream->Write(AuMemoryViewStreamRead { blob, uLength });
bOk &= uLength == blob.length;
}
@ -457,7 +458,6 @@ namespace Aurora::IO::FS
AUKN_SYM bool WriteFile(const AuString &path, const Memory::MemoryViewRead &blob)
{
bool bOk {};
AuUInt uLength {};
AuIO::IOHandle handle;
auto createRequest = AuIO::IIOHandle::HandleCreate::ReadWrite(path);
createRequest.bAlwaysCreateDirTree = true;
@ -476,6 +476,7 @@ namespace Aurora::IO::FS
if (blob.length)
{
AuUInt uLength {};
bOk = pStream->Write(AuMemoryViewStreamRead { blob, uLength });
bOk &= uLength == blob.length;
}

View File

@ -527,7 +527,11 @@ namespace Aurora::IO::FS
auto pOld = pIOHandle;
pIOHandle = AuMakeShared<AFileHandle>();
SysCheckNotNullMemory(pIOHandle, {});
pIOHandle->InitFromPair(pOld->GetOSReadHandleSafe(), pOld->GetOSWriteHandle());
if (!pIOHandle->InitFromPair(pOld->GetOSReadHandleSafe(), pOld->GetOSWriteHandle()))
{
SysPushErrorIOResourceFailure();
return {};
}
}
pStream->Init(pIOHandle);

View File

@ -397,7 +397,11 @@ namespace Aurora::IO::FS
auto pOld = pIOHandle;
pIOHandle = AuMakeShared<AFileHandle>();
SysCheckNotNullMemory(pIOHandle, {});
pIOHandle->InitFromPair(pOld->GetOSReadHandleSafe(), pOld->GetOSWriteHandle());
if (!pIOHandle->InitFromPair(pOld->GetOSReadHandleSafe(), pOld->GetOSWriteHandle()))
{
SysPushErrorIOResourceFailure();
return {};
}
}
pStream->Init(pIOHandle);