1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

PR feedback changes

This commit is contained in:
moneyl 2021-03-17 10:32:01 -04:00
parent a1e15ecb73
commit b1dc76ba11

View file

@ -81,24 +81,24 @@ namespace System.IO
Seek(Position + count, .Absolute); Seek(Position + count, .Absolute);
} }
//Write count null bytes to stream //Write count bytes to stream
public void WriteNullBytes(int64 count) public void Write(uint8 byte, int64 count)
{ {
if(count <= 0) if(count <= 0)
return; return;
int64 nullBytesRemaining = count; int64 nullBytesRemaining = count;
int64 emptyData = 0; uint8[8] writeData = .(byte, byte, byte, byte, byte, byte, byte, byte);
while (nullBytesRemaining > 0) while (nullBytesRemaining > 0)
{ {
int64 writeSize = Math.Min(nullBytesRemaining, sizeof(decltype(emptyData))); int64 writeSize = Math.Min(nullBytesRemaining, writeData.Count * sizeof(uint8));
TryWrite(.((uint8*)&emptyData, (int)writeSize)); TryWrite(.(&writeData[0], (int)writeSize));
nullBytesRemaining -= writeSize; nullBytesRemaining -= writeSize;
} }
} }
//Read sized string from stream //Read sized string from stream
public Result<void> ReadSizedString(int64 size, String output) public Result<void> ReadStrSized32(int64 size, String output)
{ {
if (size <= 0) if (size <= 0)
return .Err; return .Err;
@ -116,7 +116,7 @@ namespace System.IO
} }
//Reads null terminated ASCII string from the stream. Null terminator is read from stream but isn't appended to output string //Reads null terminated ASCII string from the stream. Null terminator is read from stream but isn't appended to output string
public Result<void> ReadNullTerminatedString(String output) public Result<void> ReadStrC(String output)
{ {
Result<char8> char0; Result<char8> char0;
while(true) while(true)