Report status codes in warnings about API failures

Also reuse the status variable, since the value saved in the one
previously declared int was an OSStatus, too.

Change-Id: I8e8fe308ae71df51e8057d89bc76cab0c6bbedb2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Edward Welbourne 2018-12-11 18:01:35 +01:00
parent a769ab62cb
commit cdd3bd1d2c

View File

@ -65,9 +65,10 @@ void QCollatorPrivate::init()
return;
LocaleRef localeRef;
int rc = LocaleRefFromLocaleString(QLocalePrivate::get(locale)->bcp47Name().constData(), &localeRef);
if (rc != 0)
qWarning("couldn't initialize the locale");
OSStatus status =
LocaleRefFromLocaleString(QLocalePrivate::get(locale)->bcp47Name().constData(), &localeRef);
if (status != 0)
qWarning("Couldn't initialize the locale (%d)", int(status));
UInt32 options = 0;
@ -78,14 +79,9 @@ void QCollatorPrivate::init()
if (!ignorePunctuation)
options |= kUCCollatePunctuationSignificantMask;
OSStatus status = UCCreateCollator(
localeRef,
0,
options,
&collator
);
status = UCCreateCollator(localeRef, 0, options, &collator);
if (status != 0)
qWarning("Couldn't initialize the collator");
qWarning("Couldn't initialize the collator (%d)", int(status));
dirty = false;
}