diff --git a/xdf.cpp b/xdf.cpp index bce66ab..96c3c81 100644 --- a/xdf.cpp +++ b/xdf.cpp @@ -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(file); + length = readBin(file); + break; case 4: - return readBin(file); + length = readBin(file); + break; case 8: - return readBin(file); + length = readBin(file); + break; default: std::cout << "Invalid variable-length integer length (" - << static_cast(bytes) << ") encountered.\n"; + << static_cast(bytes) << ") encountered.\n"; return 0; } + + return length; } void Xdf::findMinMax()