[Libreoffice-commits] core.git: opencl/inc opencl/source

Stephan Bergmann sbergman at redhat.com
Fri Apr 22 11:45:03 UTC 2016


 opencl/inc/opencl_device.hxx         |    2 +-
 opencl/inc/opencl_device_selection.h |    4 ++--
 opencl/source/opencl_device.cxx      |   16 +++++++---------
 3 files changed, 10 insertions(+), 12 deletions(-)

New commits:
commit 92f10ad9bcc9b24401a730175ae5a5252b803b06
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Apr 22 13:44:38 2016 +0200

    Various loplugin warnings in opencl/
    
    Change-Id: Ia6254777bc7972e2272dba542e315a8d3bd0fdf0

diff --git a/opencl/inc/opencl_device.hxx b/opencl/inc/opencl_device.hxx
index 7b5b79a..0963304 100644
--- a/opencl/inc/opencl_device.hxx
+++ b/opencl/inc/opencl_device.hxx
@@ -14,7 +14,7 @@
 
 namespace opencl {
 
-ds_device getDeviceSelection(OUString pFileName, bool bForceSelection = false);
+ds_device getDeviceSelection(OUString const & pFileName, bool bForceSelection = false);
 
 }
 
diff --git a/opencl/inc/opencl_device_selection.h b/opencl/inc/opencl_device_selection.h
index cf57b31..6ec506d 100644
--- a/opencl/inc/opencl_device_selection.h
+++ b/opencl/inc/opencl_device_selection.h
@@ -402,7 +402,7 @@ inline ds_status writeProfile(const OUString& rStreamName, std::unique_ptr<ds_pr
 
     XmlWriter aXmlWriter(pStream.get());
 
-    if (aXmlWriter.startDocument() == false)
+    if (!aXmlWriter.startDocument())
         return DS_FILE_ERROR;
 
     aXmlWriter.startElement("profile");
@@ -440,7 +440,7 @@ inline ds_status writeProfile(const OUString& rStreamName, std::unique_ptr<ds_pr
         }
 
         aXmlWriter.startElement("time");
-        if (rDevice.fTime == DBL_MAX)
+        if (rtl::math::approxEqual(rDevice.fTime, DBL_MAX))
             aXmlWriter.content("max");
         else
             aXmlWriter.content(OString::number(rDevice.fTime));
diff --git a/opencl/source/opencl_device.cxx b/opencl/source/opencl_device.cxx
index af3bc18..907d551 100644
--- a/opencl/source/opencl_device.cxx
+++ b/opencl/source/opencl_device.cxx
@@ -381,7 +381,8 @@ ds_status pickBestDevice(std::unique_ptr<ds_profile>& profile, int& rBestDeviceI
 
     rBestDeviceIndex = -1;
 
-    for (unsigned int d = 0; d < profile->devices.size(); d++)
+    for (std::vector<ds_device>::size_type d = 0; d < profile->devices.size();
+         d++)
     {
         ds_device& device = profile->devices[d];
 
@@ -410,7 +411,8 @@ ds_status pickBestDevice(std::unique_ptr<ds_profile>& profile, int& rBestDeviceI
         }
 
         double fScore = DBL_MAX;
-        if (device.fTime >= 0.0 || device.fTime == DBL_MAX)
+        if (device.fTime >= 0.0
+            || rtl::math::approxEqual(device.fTime, DBL_MAX))
         {
             fScore = device.fTime;
         }
@@ -481,11 +483,6 @@ public:
         maStream.WriteChar('\n');
     }
 
-    void log(const OString& rKey, const OUString& rValue)
-    {
-        log(rKey, OUStringToOString(rValue, RTL_TEXTENCODING_UTF8));
-    }
-
     void log(const OString& rKey, int rValue)
     {
         log(rKey, OString::number(rValue));
@@ -536,7 +533,8 @@ void writeDevicesLog(std::unique_ptr<ds_profile>& rProfile, OUString sProfilePat
 
 } // end anonymous namespace
 
-ds_device getDeviceSelection(OUString sProfilePath, bool bForceSelection)
+ds_device getDeviceSelection(
+    OUString const & sProfilePath, bool bForceSelection)
 {
     /* Run only if device is not yet selected */
     if (!bIsDeviceSelected || bForceSelection)
@@ -554,7 +552,7 @@ ds_device getDeviceSelection(OUString sProfilePath, bool bForceSelection)
         }
 
         /* Try reading scores from file */
-        OUString sFilePath = sProfilePath + OUString("opencl_profile.xml");
+        OUString sFilePath = sProfilePath + "opencl_profile.xml";
 
         if (!bForceSelection)
         {


More information about the Libreoffice-commits mailing list