From d761df9c49c192117a9f0dbad6f57b78b29b8852 Mon Sep 17 00:00:00 2001 From: Thomas Jentzsch Date: Wed, 25 Aug 2021 17:34:44 +0200 Subject: [PATCH] Fixed games count when there is no parent directory (fixes #807) --- src/common/ZipHandler.cxx | 16 ++++++++-------- src/gui/LauncherDialog.cxx | 3 ++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/common/ZipHandler.cxx b/src/common/ZipHandler.cxx index b81e050e8..a3151833d 100644 --- a/src/common/ZipHandler.cxx +++ b/src/common/ZipHandler.cxx @@ -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(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(out.get()); + stream.avail_out = uInt32(length); // TODO - use zip64 // Initialize the decompressor int zerr = inflateInit2(&stream, -MAX_WBITS); diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index 473c92b1d..68017f1f0 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -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