Skip to content

Commit

Permalink
fgklm
Browse files Browse the repository at this point in the history
  • Loading branch information
bansan85 committed Nov 3, 2023
1 parent 661228b commit 454faba
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/attr-non-resident.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,15 @@ std::optional<ULONGLONG>
ULONGLONG bufLen = buffer.size();
BYTE* buf = buffer.data();

size_t nbpart = 0;

ULONGLONG actural = 0;
if (bufLen == 0)
{
if (nbpart > 1)
{
return actural;
}
return actural;
}

Expand All @@ -288,6 +294,7 @@ std::optional<ULONGLONG>
std::span<BYTE> unaligned_buf_first = this->volume_.GetClusterBuffer();
std::optional<ULONGLONG> lenc =
ReadVirtualClusters(start_vcn, 1, unaligned_buf_first);
nbpart++;
if (!lenc || *lenc != this->GetClusterSize())
{
return {};
Expand All @@ -303,6 +310,10 @@ std::optional<ULONGLONG>
}
if (bufLen == 0)
{
if (nbpart > 1)
{
return actural;
}
return actural;
}

Expand All @@ -314,6 +325,7 @@ std::optional<ULONGLONG>

std::optional<ULONGLONG> lenc =
ReadVirtualClusters(start_vcn, alignedClusters, {buf, alignedSize});
nbpart++;
if (!lenc || *lenc != alignedSize)
{
return {};
Expand All @@ -326,6 +338,10 @@ std::optional<ULONGLONG>

if (bufLen == 0)
{
if (nbpart > 1)
{
return actural;
}
return actural;
}
}
Expand All @@ -334,6 +350,7 @@ std::optional<ULONGLONG>
std::span<BYTE> unaligned_buf_last = this->volume_.GetClusterBuffer();
std::optional<ULONGLONG> lenc =
ReadVirtualClusters(start_vcn, 1, unaligned_buf_last);
nbpart++;
if (!lenc || *lenc != this->GetClusterSize())
{
return {};
Expand All @@ -342,6 +359,10 @@ std::optional<ULONGLONG>
memcpy(buf, unaligned_buf_last.data(), bufLen);
actural += bufLen;

if (nbpart > 1)
{
return actural;
}
return actural;
}

Expand Down

0 comments on commit 454faba

Please sign in to comment.