r18675 by fschmid - Fixed reading of filenames.

scribus-commit scribus-commit at lists.scribus.net
Mon Jan 6 16:15:57 UTC 2014


Author: fschmid
Date: Mon Jan  6 16:15:57 2014
New Revision: 18675

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18675
Log:
Fixed reading of filenames.

Modified:
    trunk/Scribus/scribus/third_party/zip/unzip.cpp

Modified: trunk/Scribus/scribus/third_party/zip/unzip.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18675&path=/trunk/Scribus/scribus/third_party/zip/unzip.cpp
==============================================================================
--- trunk/Scribus/scribus/third_party/zip/unzip.cpp (original)
+++ trunk/Scribus/scribus/third_party/zip/unzip.cpp Mon Jan  6 16:15:57 2014
@@ -236,8 +236,7 @@
     }
 
     if (ec != UnZip::Ok)
-        closeArchive();
-
+		closeArchive();
     return ec;
 }
 
@@ -323,10 +322,17 @@
     if (szName == 0)
         return UnZip::HeaderConsistencyError;
 
+	memset(buffer2, 0, szName);
     if (device->read(buffer2, szName) != szName)
         return UnZip::ReadFailed;
 
-    QString filename = QString::fromLatin1(buffer2, szName);
+	QString filename = "";
+	for (quint16 fc = 0; fc < szName; fc++)
+	{
+		if (buffer2[fc] > 0)
+			filename.append(QChar(buffer2[fc]));
+	}
+//    QString filename = QString::fromLatin1(buffer2, szName);
     if (filename != path) {
         qDebug() << "Filename in local header mismatches.";
         return UnZip::HeaderConsistencyError;
@@ -551,11 +557,19 @@
     }
 
     QString filename;
+	memset(buffer2, 0, szName);
     if (device->read(buffer2, szName) != szName) {
         ec = UnZip::ReadFailed;
         skipEntry = true;
-    } else {
-        filename = QString::fromLatin1(buffer2, szName);
+	}
+	else
+	{
+		filename = "";
+		for (quint16 fc = 0; fc < szName; fc++)
+		{
+			if (buffer2[fc] > 0)
+				filename.append(QChar(buffer2[fc]));
+		}
     }
 
     // Unsupported features if version is bigger than UNZIP_VERSION




More information about the scribus-commit mailing list