Skip to content

Commit

Permalink
Match FileAbstraction::WriteByte
Browse files Browse the repository at this point in the history
  • Loading branch information
toadster172 committed Nov 7, 2024
1 parent 23d2ccd commit 09eee19
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
18 changes: 13 additions & 5 deletions src/pbg3/FileAbstraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,24 @@ i32 FileAbstraction::ReadByte()
}
}

i32 FileAbstraction::WriteByte(u8 b)
i32 FileAbstraction::WriteByte(u32 b)
{
u8 res;
u8 outByte;
u32 outBytesWritten;

if (this->Write(&b, 1, &outBytesWritten) == FALSE)

outByte = b;
if (this->Write(&outByte, 1, &outBytesWritten) == FALSE)
{
return -1;
}
return outBytesWritten != 0 ? b : -1;
else
{
if (outBytesWritten == 0)
{
return -1;
}
return b;
}
}

i32 FileAbstraction::Seek(u32 amount, u32 seekFrom)
Expand Down
4 changes: 2 additions & 2 deletions src/pbg3/FileAbstraction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class IFileAbstraction
virtual i32 Read(u8 *data, u32 dataLen, u32 *numBytesRead) = 0;
virtual i32 Write(u8 *data, u32 dataLen, u32 *outWritten) = 0;
virtual i32 ReadByte() = 0;
virtual i32 WriteByte(u8 b) = 0;
virtual i32 WriteByte(u32 b) = 0;
virtual i32 Seek(u32 amount, u32 seekFrom) = 0;
virtual u32 Tell() = 0;
virtual u32 GetSize() = 0;
Expand All @@ -32,7 +32,7 @@ class FileAbstraction : public IFileAbstraction
virtual i32 Read(u8 *data, u32 dataLen, u32 *numBytesRead);
virtual i32 Write(u8 *data, u32 dataLen, u32 *outWritten);
virtual i32 ReadByte();
virtual i32 WriteByte(u8 b);
virtual i32 WriteByte(u32 b);
virtual i32 Seek(u32 amount, u32 seekFrom);
virtual u32 Tell();
virtual u32 GetSize();
Expand Down

0 comments on commit 09eee19

Please sign in to comment.