Fixed games count when there is no parent directory (fixes #807)

This commit is contained in:
Thomas Jentzsch 2021-08-25 17:34:44 +02:00
parent cace55868c
commit d761df9c49
2 changed files with 10 additions and 9 deletions

View File

@ -284,7 +284,7 @@ void ZipHandler::ZipFile::readEcd()
// Find the ECD signature
Int32 offset;
for(offset = Int32(buflen - EcdReader::minimumLength()); offset >= 0; --offset)
for(offset = Int32(buflen - EcdReader::minimumLength()); offset >= 0; --offset)
{
EcdReader reader(buffer.get() + offset);
if(reader.signatureCorrect() && ((reader.totalLength() + offset) <= buflen))
@ -445,13 +445,13 @@ void ZipHandler::ZipFile::decompressDataType8(
uInt64 input_remaining = myHeader.compressedLength;
// Reset the stream
z_stream stream;
stream.zalloc = Z_NULL;
stream.zfree = Z_NULL;
stream.opaque = Z_NULL;
stream.avail_in = 0;
stream.next_out = reinterpret_cast<Bytef *>(out.get());
stream.avail_out = uInt32(length); // TODO - use zip64
z_stream stream;
stream.zalloc = Z_NULL;
stream.zfree = Z_NULL;
stream.opaque = Z_NULL;
stream.avail_in = 0;
stream.next_out = reinterpret_cast<Bytef *>(out.get());
stream.avail_out = uInt32(length); // TODO - use zip64
// Initialize the decompressor
int zerr = inflateInit2(&stream, -MAX_WBITS);

View File

@ -422,8 +422,9 @@ void LauncherDialog::updateUI()
myDir->setText(myList->currentDir().getShortPath());
// Indicate how many files were found
bool hasParent = *myList->getList().begin() == " [..]";
ostringstream buf;
buf << (myList->getList().size() - 1) << (myShortCount ? " found" : " items found");
buf << (myList->getList().size() - (hasParent ? 1 : 0)) << (myShortCount ? " found" : " items found");
myRomCount->setLabel(buf.str());
// Update ROM info UI item