OSDN Git Service

kioslave: make use of qAbs()
authorIvailo Monev <xakepa10@gmail.com>
Tue, 22 Jun 2021 16:54:11 +0000 (19:54 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Tue, 22 Jun 2021 16:54:11 +0000 (19:54 +0300)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
kioslave/thumbnail/icoutils_common.cpp

index 28ed567..5524948 100644 (file)
@@ -21,8 +21,6 @@
 #include <QImage>
 #include <QImageReader>
 
-#define abs(n) ( ( n < 0 ) ? -n : n )
-
 bool IcoUtils::loadIcoImageFromExe(QIODevice * inputDevice, QImage &image, int needWidth, int needHeight, const qint32 iconNumber)
 {
 
@@ -80,8 +78,8 @@ bool IcoUtils::loadIcoImage(QImageReader &reader, QImage &image, int needWidth,
         const QImage &icon = icons.at(i_index);
         int i_width = icon.width();
         int i_height = icon.height();
-        int i_w = abs(i_width - needWidth);
-        int i_h = abs(i_height - needHeight);
+        int i_w = qAbs(i_width - needWidth);
+        int i_h = qAbs(i_height - needHeight);
 
         if ( i_w < min_w || ( i_w == min_w && i_h < min_h ) )
         {