Title: [264534] trunk/Source/WebCore
Revision
264534
Author
[email protected]
Date
2020-07-17 14:28:44 -0700 (Fri, 17 Jul 2020)

Log Message

Fix -Wformat= warnings when passing enum to integer specifiers
https://bugs.webkit.org/show_bug.cgi?id=214441

Reviewed by Darin Adler.

Covered by existing tests.

* platform/mediastream/MediaConstraints.cpp:
(WebCore::MediaConstraint::log const):
(WebCore::BooleanConstraint::logAsBoolean const):
(WebCore::DoubleConstraint::logAsDouble const):
(WebCore::IntConstraint::logAsInt const):
* platform/mediastream/MediaConstraints.h: Made uint8_t the underlying
type for MediaConstraints::DataType.
* platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::selectSettings):
* platform/mediastream/RealtimeMediaSourceSupportedConstraints.h: Made
uint8_t the underlying type for MediaConstraintType.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (264533 => 264534)


--- trunk/Source/WebCore/ChangeLog	2020-07-17 21:19:05 UTC (rev 264533)
+++ trunk/Source/WebCore/ChangeLog	2020-07-17 21:28:44 UTC (rev 264534)
@@ -1,3 +1,24 @@
+2020-07-17  Lauro Moura  <[email protected]>
+
+        Fix -Wformat= warnings when passing enum to integer specifiers
+        https://bugs.webkit.org/show_bug.cgi?id=214441
+
+        Reviewed by Darin Adler.
+
+        Covered by existing tests.
+
+        * platform/mediastream/MediaConstraints.cpp:
+        (WebCore::MediaConstraint::log const):
+        (WebCore::BooleanConstraint::logAsBoolean const):
+        (WebCore::DoubleConstraint::logAsDouble const):
+        (WebCore::IntConstraint::logAsInt const):
+        * platform/mediastream/MediaConstraints.h: Made uint8_t the underlying
+        type for MediaConstraints::DataType.
+        * platform/mediastream/RealtimeMediaSource.cpp:
+        (WebCore::RealtimeMediaSource::selectSettings):
+        * platform/mediastream/RealtimeMediaSourceSupportedConstraints.h: Made
+        uint8_t the underlying type for MediaConstraintType.
+
 2020-07-17  Fujii Hironori  <[email protected]>
 
         Don't include <wtf/text/WTFString.h> in SVGParserUtilities.h

Modified: trunk/Source/WebCore/platform/mediastream/MediaConstraints.cpp (264533 => 264534)


--- trunk/Source/WebCore/platform/mediastream/MediaConstraints.cpp	2020-07-17 21:19:05 UTC (rev 264533)
+++ trunk/Source/WebCore/platform/mediastream/MediaConstraints.cpp	2020-07-17 21:28:44 UTC (rev 264534)
@@ -419,23 +419,23 @@
         break;
     case DataType::None:
     case DataType::String:
-        WTFLogAlways("MediaConstraint %d of type %d", constraintType(), dataType());
+        WTFLogAlways("MediaConstraint %d of type %d", static_cast<int>(constraintType()), static_cast<int>(dataType()));
     }
 }
 
 void BooleanConstraint::logAsBoolean() const
 {
-    WTFLogAlways("BooleanConstraint %d, exact %d, ideal %d", constraintType(), m_exact ? *m_exact : -1, m_ideal ? *m_ideal : -1);
+    WTFLogAlways("BooleanConstraint %d, exact %d, ideal %d", static_cast<int>(constraintType()), m_exact ? *m_exact : -1, m_ideal ? *m_ideal : -1);
 }
 
 void DoubleConstraint::logAsDouble() const
 {
-    WTFLogAlways("DoubleConstraint %d, min %f, max %f, exact %f, ideal %f", constraintType(), m_min ? *m_min : -1, m_max ? *m_max : -1, m_exact ? *m_exact : -1, m_ideal ? *m_ideal : -1);
+    WTFLogAlways("DoubleConstraint %d, min %f, max %f, exact %f, ideal %f", static_cast<int>(constraintType()), m_min ? *m_min : -1, m_max ? *m_max : -1, m_exact ? *m_exact : -1, m_ideal ? *m_ideal : -1);
 }
 
 void IntConstraint::logAsInt() const
 {
-    WTFLogAlways("IntConstraint %d, min %d, max %d, exact %d, ideal %d", constraintType(), m_min ? *m_min : -1, m_max ? *m_max : -1, m_exact ? *m_exact : -1, m_ideal ? *m_ideal : -1);
+    WTFLogAlways("IntConstraint %d, min %d, max %d, exact %d, ideal %d", static_cast<int>(constraintType()), m_min ? *m_min : -1, m_max ? *m_max : -1, m_exact ? *m_exact : -1, m_ideal ? *m_ideal : -1);
 }
 
 

Modified: trunk/Source/WebCore/platform/mediastream/MediaConstraints.h (264533 => 264534)


--- trunk/Source/WebCore/platform/mediastream/MediaConstraints.h	2020-07-17 21:19:05 UTC (rev 264533)
+++ trunk/Source/WebCore/platform/mediastream/MediaConstraints.h	2020-07-17 21:28:44 UTC (rev 264534)
@@ -43,7 +43,7 @@
     
 class MediaConstraint {
 public:
-    enum class DataType { None, Integer, Double, Boolean, String };
+    enum class DataType : uint8_t { None, Integer, Double, Boolean, String };
 
     bool isInt() const { return m_dataType == DataType::Integer; }
     bool isDouble() const { return m_dataType == DataType::Double; }

Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp (264533 => 264534)


--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp	2020-07-17 21:19:05 UTC (rev 264533)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp	2020-07-17 21:28:44 UTC (rev 264534)
@@ -682,7 +682,7 @@
 
         double constraintDistance = fitnessDistance(constraint);
         if (std::isinf(constraintDistance)) {
-            WTFLogAlways("RealtimeMediaSource::selectSettings failed constraint %d", constraint.constraintType());
+            WTFLogAlways("RealtimeMediaSource::selectSettings failed constraint %d", static_cast<int>(constraint.constraintType()));
             failedConstraint = constraint.name();
             return true;
         }

Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceSupportedConstraints.h (264533 => 264534)


--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceSupportedConstraints.h	2020-07-17 21:19:05 UTC (rev 264533)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSourceSupportedConstraints.h	2020-07-17 21:28:44 UTC (rev 264534)
@@ -36,7 +36,7 @@
 
 namespace WebCore {
 
-enum class MediaConstraintType {
+enum class MediaConstraintType : uint8_t {
     Unknown,
     Width,
     Height,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to