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>
This commit is contained in:
parent
c803af5167
commit
bd94a46f61
@ -235,8 +235,10 @@ static QVariant qtValue(CFPropertyListRef cfvalue)
|
|||||||
int i;
|
int i;
|
||||||
qint64 ll;
|
qint64 ll;
|
||||||
|
|
||||||
if (CFNumberGetValue(cfnumber, kCFNumberIntType, &i))
|
if (CFNumberGetType(cfnumber) == kCFNumberIntType) {
|
||||||
|
CFNumberGetValue(cfnumber, kCFNumberIntType, &i);
|
||||||
return i;
|
return i;
|
||||||
|
}
|
||||||
CFNumberGetValue(cfnumber, kCFNumberLongLongType, &ll);
|
CFNumberGetValue(cfnumber, kCFNumberLongLongType, &ll);
|
||||||
return ll;
|
return ll;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user