summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qsettings_mac.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2014-10-22 12:03:33 +0200
committerChristian Kandeler <christian.kandeler@digia.com>2014-10-27 09:52:30 +0100
commitbd94a46f619395032ef48b2a53db294488738532 (patch)
treee58fb67f817f04481ce429183302293e64c52793 /src/corelib/io/qsettings_mac.cpp
parentc803af51677c31ec7010f5c481ad59272694f138 (diff)
QSettings: Fix handling of long long ints with CFPreferences back-end.
The CFNumberGetValue() function does not work as advertised: For some (but not all) CFNumbers containing a long long value outside the range of int, it returns true when asked to convert to an int, so the wrong value is extracted from the CFNumber. As a workaround, use CFNumberGetType() to find out whether the value is actually an int. Task-number: QTBUG-42017 Change-Id: Ib95395491d0db61d2bdc0f058a6a2f6be05da432 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
Diffstat (limited to 'src/corelib/io/qsettings_mac.cpp')
-rw-r--r--src/corelib/io/qsettings_mac.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp
index 4752077f87..344bec0309 100644
--- a/src/corelib/io/qsettings_mac.cpp
+++ b/src/corelib/io/qsettings_mac.cpp
@@ -235,8 +235,10 @@ static QVariant qtValue(CFPropertyListRef cfvalue)
int i;
qint64 ll;
- if (CFNumberGetValue(cfnumber, kCFNumberIntType, &i))
+ if (CFNumberGetType(cfnumber) == kCFNumberIntType) {
+ CFNumberGetValue(cfnumber, kCFNumberIntType, &i);
return i;
+ }
CFNumberGetValue(cfnumber, kCFNumberLongLongType, &ll);
return ll;
}