[*] Update consistency in 895ef058

This commit is contained in:
Reece Wilson 2024-03-11 17:13:27 +00:00
parent ac1501c357
commit f401c6f750

View File

@ -337,13 +337,21 @@ namespace Aurora::IO::FS
return false; return false;
} }
bool ok {}; bool bOk {};
ok = pStream->Write(AuMemoryViewStreamRead { bom }); bOk = pStream->Write(AuMemoryViewStreamRead { bom });
ok &= pStream->Write(AuMemoryViewStreamRead { str }); if (auto uLength = str.length())
{
bOk &= pStream->Write(AuMemoryViewStreamRead { str, uLength });
bOk &= uLength == uLength;
}
else
{
bOk = true;
}
pStream->Flush(); pStream->Flush();
pStream->WriteEoS(); pStream->WriteEoS();
return ok; return bOk;
} }
AUKN_SYM bool WriteNewString(const AuString &path, const AuString &str) AUKN_SYM bool WriteNewString(const AuString &path, const AuString &str)
@ -373,10 +381,15 @@ namespace Aurora::IO::FS
} }
bOk = pStream->Write(AuMemoryViewStreamRead { bom }); bOk = pStream->Write(AuMemoryViewStreamRead { bom });
bOk &= pStream->Write(AuMemoryViewStreamRead { str, uLength }); if (auto uLength = str.length())
{
bOk &= uLength == str.length(); bOk &= pStream->Write(AuMemoryViewStreamRead { str, uLength });
bOk &= uLength == uLength;
}
else
{
bOk = true;
}
pStream->WriteEoS(); pStream->WriteEoS();
pStream->Flush(); pStream->Flush();
} }
@ -409,11 +422,17 @@ namespace Aurora::IO::FS
return false; return false;
} }
bOk = pStream->Write(AuMemoryViewStreamRead { blob, uLength }); if (blob.length)
{
bOk = pStream->Write(AuMemoryViewStreamRead { blob, uLength });
bOk &= uLength == blob.length;
}
else
{
bOk = true;
}
pStream->WriteEoS(); pStream->WriteEoS();
pStream->Flush(); pStream->Flush();
bOk &= uLength == blob.length;
} }
RuntimeWaitForSecondaryTick(); RuntimeWaitForSecondaryTick();