Просмотр исходного кода

Replaced old style casts (issue #28)

Benoit Blanchon 11 лет назад
Родитель
Сommit
dae0dc5ebb

+ 1 - 1
JsonGenerator/JsonValue.h

@@ -76,7 +76,7 @@ namespace ArduinoJson
 
             operator float()
             {
-                return (float)_content.asDouble;
+                return static_cast<float>(_content.asDouble);
             }
 
             operator int()

+ 1 - 1
JsonGeneratorTests/JsonArrayTests.cpp

@@ -26,7 +26,7 @@ namespace JsonGeneratorTests
 
         TEST_METHOD(Null)
         {
-            array.add((char*) 0);
+            array.add(static_cast<char*>(0));
 
             outputMustBe("[null]");
         }

+ 1 - 1
JsonGeneratorTests/JsonObject_PrintTo_Tests.cpp

@@ -102,7 +102,7 @@ namespace JsonGeneratorTests
 
         TEST_METHOD(OneNull)
         {
-            object["key"] = (char*) 0;
+            object["key"] = static_cast<char*>(0);
             outputMustBe("{\"key\":null}");
         }
 

+ 3 - 1
JsonGeneratorTests/JsonValue_Cast_Tests.cpp

@@ -72,7 +72,9 @@ namespace JsonGeneratorTests
         {
             value = expected;
             const Printable& actual = value;
-            Assert::AreEqual((void*) &expected, (void*) &actual);
+            Assert::AreEqual(
+                reinterpret_cast<const void*>(&expected), 
+                reinterpret_cast<const void*>(&actual));
         }
     };
 }

+ 1 - 1
JsonGeneratorTests/JsonValue_PrintTo_Tests.cpp

@@ -70,7 +70,7 @@ namespace JsonGeneratorTests
 
         TEST_METHOD(Short)
         {
-            setValueTo((short)314);
+            setValueTo(static_cast<short>(314));
             outputMustBe("314");
         }