r14487 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:17 CET 2010


Revision: 14487
Author: jghali
Date: 2010-01-06T08:16:03.368936Z
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  /branches/Version135/Scribus/scribus/scfonts.cpp

Diffs:
Index: scribus/scfonts.cpp
===================================================================
--- scribus/scfonts.cpp	(revision 14486)
+++ scribus/scfonts.cpp	(revision 14487)
@@ -309,9 +309,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;
@@ -376,7 +383,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