Skip to content

Commit

Permalink
Fix readLen() return type error (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yida-Lin authored May 9, 2020
1 parent c7dd99b commit 1ed0efd
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions xdf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -714,20 +714,26 @@ uint64_t Xdf::readLength(std::ifstream &file)
{
uint8_t bytes;
Xdf::readBin(file, &bytes);
uint64_t length = 0;

switch (bytes)
{
case 1:
return readBin<uint8_t>(file);
length = readBin<uint8_t>(file);
break;
case 4:
return readBin<uint32_t>(file);
length = readBin<uint32_t>(file);
break;
case 8:
return readBin<uint64_t>(file);
length = readBin<uint64_t>(file);
break;
default:
std::cout << "Invalid variable-length integer length ("
<< static_cast<int>(bytes) << ") encountered.\n";
<< static_cast<int>(bytes) << ") encountered.\n";
return 0;
}

return length;
}

void Xdf::findMinMax()
Expand Down

0 comments on commit 1ed0efd

Please sign in to comment.