OSDN Git Service

replace inline if with switch in QColormap::size() statement
authorIvailo Monev <xakepa10@laimg.moc>
Wed, 25 Mar 2020 18:51:28 +0000 (18:51 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Wed, 25 Mar 2020 21:05:33 +0000 (21:05 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/gui/painting/qcolormap_x11.cpp

index 752c3ac..4ede583 100644 (file)
@@ -599,11 +599,15 @@ int QColormap::depth() const
 
 int QColormap::size() const
 {
-    return (d->mode == Gray
-            ? d->r_max
-            : (d->mode == Indexed
-               ? d->r_max * d->g_max * d->b_max
-               : -1));
+    switch (d->mode) {
+        case Gray:
+            return d->r_max;
+        case Indexed:
+            return d->r_max * d->g_max * d->b_max;
+        case Direct:
+            return -1;
+    }
+    Q_UNREACHABLE();
 }
 
 uint QColormap::pixel(const QColor &color) const