浏览代码

Replaced old style casts (issue #28)

Benoit Blanchon 11 年之前
父节点
当前提交
dae0dc5ebb

+ 1 - 1
JsonGenerator/JsonValue.h

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

+ 1 - 1
JsonGeneratorTests/JsonArrayTests.cpp

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

+ 1 - 1
JsonGeneratorTests/JsonObject_PrintTo_Tests.cpp

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

+ 3 - 1
JsonGeneratorTests/JsonValue_Cast_Tests.cpp

@@ -72,7 +72,9 @@ namespace JsonGeneratorTests
         {
         {
             value = expected;
             value = expected;
             const Printable& actual = value;
             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)
         TEST_METHOD(Short)
         {
         {
-            setValueTo((short)314);
+            setValueTo(static_cast<short>(314));
             outputMustBe("314");
             outputMustBe("314");
         }
         }