From cdd3bd1d2cb3f5c23159a987c19b6919f08d68b7 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Tue, 11 Dec 2018 18:01:35 +0100 Subject: [PATCH] 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 --- src/corelib/tools/qcollator_macx.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/corelib/tools/qcollator_macx.cpp b/src/corelib/tools/qcollator_macx.cpp index 9998ec4cdaf..ff127a041d5 100644 --- a/src/corelib/tools/qcollator_macx.cpp +++ b/src/corelib/tools/qcollator_macx.cpp @@ -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; }