r21055 by craig -

scribus-commit scribus-commit at lists.scribus.net
Fri Mar 4 21:29:43 UTC 2016


Author: craig
Date: Fri Mar  4 21:29:43 2016
New Revision: 21055

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21055
Log:
Switch to QIODevice for creation of large file checksums

Modified:
    trunk/Scribus/scribus/util_file.cpp

Modified: trunk/Scribus/scribus/util_file.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21055&path=/trunk/Scribus/scribus/util_file.cpp
==============================================================================
--- trunk/Scribus/scribus/util_file.cpp	(original)
+++ trunk/Scribus/scribus/util_file.cpp	Fri Mar  4 21:29:43 2016
@@ -288,18 +288,22 @@
 {
 	//In a single directory, make a hash of filename, and compare it to the string for that file in hashFilename
 	//Assumption is that the hash file only has one line for now
-	QByteArray ba_fileData;
-	if (loadRawText(directory + filename, ba_fileData))
-	{
-		QByteArray ba_hash;
-		if (loadRawText(directory + hashFilename, ba_hash))
-		{
-			QCryptographicHash ch(method);
-			ch.addData(ba_fileData);
+	QByteArray ba_hash;
+	if (loadRawText(directory + hashFilename, ba_hash))
+	{
+		QFile source(directory + filename);
+		if (source.open(QIODevice::ReadOnly))
+		{
 			ba_hash = ba_hash.simplified();
 			QList<QByteArray> fileData(ba_hash.split(' '));
+			QCryptographicHash ch(method);
+			ch.addData(&source);
 			if (fileData[0] == ch.result().toHex() && fileData[1] == filename)
+			{
+				//qDebug()<<"checkFileHash: checksum successful for"<<directory<<filename;
+				source.close();
 				return true;
+			}
 			else
 				qDebug()<<"checkFileHash: checksum failed for"<<directory<<filename;
 		}




More information about the scribus-commit mailing list