From d1fc0591a5bdfe24a62b795cec1f52617ee0d633 Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Tue, 21 Apr 2015 14:39:37 +0100 Subject: [PATCH] Silence Windows compiler warnings #19 --- binding.gyp | 5 +++++ src/resize.cc | 16 ++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/binding.gyp b/binding.gyp index 0764838c..892153aa 100755 --- a/binding.gyp +++ b/binding.gyp @@ -68,6 +68,11 @@ '-O3' ], 'MACOSX_DEPLOYMENT_TARGET': '10.7' + }, + 'msvs_settings': { + 'VCCLCompilerTool': { + 'ExceptionHandling': 1 # /EHsc + } } }] } diff --git a/src/resize.cc b/src/resize.cc index d104b02c..93ade321 100755 --- a/src/resize.cc +++ b/src/resize.cc @@ -283,19 +283,19 @@ class ResizeWorker : public NanAsyncWorker { break; case Canvas::MAX: if (xfactor > yfactor) { - baton->height = round(static_cast(inputHeight) / xfactor); + baton->height = static_cast(round(static_cast(inputHeight) / xfactor)); yfactor = xfactor; } else { - baton->width = round(static_cast(inputWidth) / yfactor); + baton->width = static_cast(round(static_cast(inputWidth) / yfactor)); xfactor = yfactor; } break; case Canvas::MIN: if (xfactor < yfactor) { - baton->height = round(static_cast(inputHeight) / xfactor); + baton->height = static_cast(round(static_cast(inputHeight) / xfactor)); yfactor = xfactor; } else { - baton->width = round(static_cast(inputWidth) / yfactor); + baton->width = static_cast(round(static_cast(inputWidth) / yfactor)); xfactor = yfactor; } break; @@ -311,7 +311,7 @@ class ResizeWorker : public NanAsyncWorker { } else { // Auto height yfactor = xfactor; - baton->height = floor(static_cast(inputHeight) / yfactor); + baton->height = static_cast(floor(static_cast(inputHeight) / yfactor)); } } else if (baton->height > 0) { // Fixed height @@ -321,7 +321,7 @@ class ResizeWorker : public NanAsyncWorker { } else { // Auto width xfactor = yfactor; - baton->width = floor(static_cast(inputWidth) / xfactor); + baton->width = static_cast(floor(static_cast(inputWidth) / xfactor)); } } else { // Identity transform @@ -1086,9 +1086,9 @@ class ResizeWorker : public NanAsyncWorker { int shrink = 1; if (factor >= 2 && interpolatorWindowSize > 3) { // Shrink less, affine more with interpolators that use at least 4x4 pixel window, e.g. bicubic - shrink = floor(factor * 3.0 / interpolatorWindowSize); + shrink = static_cast(floor(factor * 3.0 / interpolatorWindowSize)); } else { - shrink = floor(factor); + shrink = static_cast(floor(factor)); } if (shrink < 1) { shrink = 1;