diff options
author | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-05-14 17:51:23 +0000 |
---|---|---|
committer | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-05-14 17:51:23 +0000 |
commit | 706f6212c60dd8861a0ae922a77c455a08360aa3 (patch) | |
tree | 659a17427fdbb4b15a49ba7766c0fc8dafadd228 | |
parent | 6f31a3b7d7996e4126fde27dbf7ee1f4852cb537 (diff) |
Fixes for Windows Release compiler complaints (overflow in const arith)
http://codereview.appspot.com/6210056/
git-svn-id: http://skia.googlecode.com/svn/trunk@3926 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | samplecode/SampleFuzz.cpp | 11 | ||||
-rw-r--r-- | src/animator/SkDisplayNumber.cpp | 11 | ||||
-rw-r--r-- | tests/ScalarTest.cpp | 11 |
3 files changed, 33 insertions, 0 deletions
diff --git a/samplecode/SampleFuzz.cpp b/samplecode/SampleFuzz.cpp index 36149c391a..6966d0dcd9 100644 --- a/samplecode/SampleFuzz.cpp +++ b/samplecode/SampleFuzz.cpp @@ -38,12 +38,23 @@ static int R(float x) { return (int)floor(SkScalarToFloat(gRand.nextUScalar1()) * x); } +#if defined _WIN32 +#pragma warning ( push ) +// we are intentionally causing an overflow here +// (warning C4756: overflow in constant arithmetic) +#pragma warning ( disable : 4756 ) +#endif + static float huge() { double d = 1e100; float f = (float)d; return f; } +#if defined _WIN32 +#pragma warning ( pop ) +#endif + static float make_number() { float v = 0; int sel; diff --git a/src/animator/SkDisplayNumber.cpp b/src/animator/SkDisplayNumber.cpp index 282dab6ad5..ed24ce861c 100644 --- a/src/animator/SkDisplayNumber.cpp +++ b/src/animator/SkDisplayNumber.cpp @@ -31,6 +31,13 @@ const SkMemberInfo SkDisplayNumber::fInfo[] = { DEFINE_GET_MEMBER(SkDisplayNumber); +#if defined _WIN32 +#pragma warning ( push ) +// we are intentionally causing an overflow here +// (warning C4756: overflow in constant arithmetic) +#pragma warning ( disable : 4756 ) +#endif + bool SkDisplayNumber::getProperty(int index, SkScriptValue* value) const { SkScalar constant; switch (index) { @@ -57,3 +64,7 @@ bool SkDisplayNumber::getProperty(int index, SkScriptValue* value) const { value->fType = SkType_Float; return true; } + +#if defined _WIN32 +#pragma warning ( pop ) +#endif
\ No newline at end of file diff --git a/tests/ScalarTest.cpp b/tests/ScalarTest.cpp index cc88e7420f..ef7db324c8 100644 --- a/tests/ScalarTest.cpp +++ b/tests/ScalarTest.cpp @@ -58,6 +58,13 @@ static void test_floatclass(skiatest::Reporter* reporter, float value, FloatClas REPORTER_ASSERT(reporter, !!sk_float_isnan(value) == (fc == kNaN)); } +#if defined _WIN32 +#pragma warning ( push ) +// we are intentionally causing an overflow here +// (warning C4756: overflow in constant arithmetic) +#pragma warning ( disable : 4756 ) +#endif + static void test_isfinite(skiatest::Reporter* reporter) { #ifdef SK_CAN_USE_FLOAT struct Rec { @@ -128,6 +135,10 @@ static void test_isfinite(skiatest::Reporter* reporter) { #endif } +#if defined _WIN32 +#pragma warning ( pop ) +#endif + static void TestScalar(skiatest::Reporter* reporter) { test_isfinite(reporter); } |