r14488 by jghali - #8679 : Modified font found at every startup In some case, file modification time appears to be stored with precision up to msecs whereas our cache stored time only with precision up to the seconds. Fix by rounding file modifications times to seconds.

scribus-commit scribus-commit at lists.scribus.net
Wed Jan 6 22:15:33 CET 2010


Revision: 14488
Author: jghali
Date: 2010-01-06T08:16:29.188900Z
Commit message: #8679 : Modified font found at every startup
In some case, file modification time appears to be stored with precision up to msecs whereas our cache stored time only with precision up to the seconds. Fix by rounding file modifications times to seconds.

Changeset: 
M  /trunk/Scribus/scribus/scfonts.cpp

Diffs:
Index: scribus/scfonts.cpp
===================================================================
--- scribus/scfonts.cpp	(revision 14487)
+++ scribus/scfonts.cpp	(revision 14488)
@@ -310,9 +310,16 @@
 	FT_Face         face = NULL;
 	struct testCache foCache;
 	QFileInfo fic(filename);
+	QDateTime lastMod = fic.lastModified();
+	QTime lastModTime = lastMod.time();
+	if (lastModTime.msec() != 0)  //Sometime file time is stored with precision up to msecs
+	{
+		lastModTime.setHMS(lastModTime.hour(), lastModTime.minute(), lastModTime.second());
+		lastMod.setTime(lastModTime);
+	}
 	foCache.isOK = false;
 	foCache.isChecked = true;
-	foCache.lastMod = fic.lastModified();
+	foCache.lastMod = lastMod;
 	if (checkedFonts.count() == 0)
 	{
 		firstRun = true;
@@ -377,7 +384,7 @@
 				checkedFonts[filename].isChecked = true;
 				return true;
 			}
-			if (checkedFonts[filename].lastMod != fic.lastModified())
+			if (checkedFonts[filename].lastMod != foCache.lastMod)
 			{
 				ScCore->setSplashStatus( QObject::tr("Modified Font found, checking...") );
 				FT_UInt gindex = 0;




More information about the scribus-commit mailing list