From 01f5ba006eb8b7910b36909727c7b1a0b053ea09 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Mon, 29 Sep 2014 15:30:08 +0200 Subject: [PATCH] Fix patching of installation date Marking qt_eval_expiry_date alone as volatile apparently didn't stop the compiler from optimizing away the calculation of the expiry date. Task-number: QTBUG-41612 Change-Id: Ia51fb83f03250346952a76c8a1a641096b4ff9e7 Reviewed-by: Oswald Buddenhagen Reviewed-by: Friedemann Kleint Reviewed-by: Kalle Viironen Reviewed-by: Iikka Eklund --- src/corelib/kernel/qtcore_eval.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qtcore_eval.cpp b/src/corelib/kernel/qtcore_eval.cpp index c0f8897b3b..eb1019534c 100644 --- a/src/corelib/kernel/qtcore_eval.cpp +++ b/src/corelib/kernel/qtcore_eval.cpp @@ -111,10 +111,11 @@ static EvaluationStatus qt_eval_is_supported() static int qt_eval_days_left() { - const char *expiry_date = const_cast(qt_eval_expiry_date + 12); + const volatile char *const expiry_date = qt_eval_expiry_date + 12; QDate today = QDate::currentDate(); - QDate lastday = QDate::fromString(QString::fromLatin1(expiry_date), Qt::ISODate); + QDate lastday = QDate::fromString( + QString::fromLatin1(const_cast(expiry_date)), Qt::ISODate); return today.daysTo(lastday); }