Skip to content

Commit

Permalink
Continue to tidy for the UFS/UFS2 file system image readonly support …
Browse files Browse the repository at this point in the history
…in NanaZip.Codecs.
  • Loading branch information
MouriNaruto committed Feb 1, 2025
1 parent 4d655b7 commit 301a25a
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions NanaZip.Codecs/NanaZip.Codecs.Archive.Ufs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,38 @@ namespace NanaZip::Codecs::Archive
return static_cast<std::int64_t>(this->ReadUInt64(BaseAddress));
}

HRESULT ReadFileStream(
_In_ INT64 Offset,
_Out_ PVOID Buffer,
_In_ SIZE_T NumberOfBytesToRead)
{
if (!this->m_FileStream)
{
return S_FALSE;
}

if (SUCCEEDED(this->m_FileStream->Seek(
Offset,
STREAM_SEEK_SET,
nullptr)))
{
SIZE_T NumberOfBytesRead = 0;
if (SUCCEEDED(::NanaZipCodecsReadInputStream(
this->m_FileStream,
Buffer,
NumberOfBytesToRead,
&NumberOfBytesRead)))
{
if (NumberOfBytesToRead == NumberOfBytesRead)
{
return S_OK;
}
}
}

return S_FALSE;
}

private:

std::uint64_t GetTotalBlocks()
Expand Down Expand Up @@ -304,38 +336,6 @@ namespace NanaZip::Codecs::Archive
return Result;
}

HRESULT ReadFileStream(
_In_ INT64 Offset,
_Out_ PVOID Buffer,
_In_ SIZE_T NumberOfBytesToRead)
{
if (!this->m_FileStream)
{
return S_FALSE;
}

if (SUCCEEDED(this->m_FileStream->Seek(
Offset,
STREAM_SEEK_SET,
nullptr)))
{
SIZE_T NumberOfBytesRead = 0;
if (SUCCEEDED(::NanaZipCodecsReadInputStream(
this->m_FileStream,
Buffer,
NumberOfBytesToRead,
&NumberOfBytesRead)))
{
if (NumberOfBytesToRead == NumberOfBytesRead)
{
return S_OK;
}
}
}

return S_FALSE;
}

bool GetInodeInformation(
std::uint32_t const& Inode,
UfsInodeInformation& Information)
Expand Down

0 comments on commit 301a25a

Please sign in to comment.