From c3e5215e06bd8ff394a9911b5573969cc55681a0 Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 3 May 2014 18:01:22 +1000 Subject: Turn on MSVC 'possible loss of data' warnings and add explicit casts. --- include/Platform.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'include/Platform.h') diff --git a/include/Platform.h b/include/Platform.h index 5f8c2f2a1..c9156fc0c 100644 --- a/include/Platform.h +++ b/include/Platform.h @@ -105,6 +105,8 @@ public: } explicit Point(int x_, int y_) : x(static_cast(x_)), y(static_cast(y_)) { } + explicit Point(long x_, long y_) : x(static_cast(x_)), y(static_cast(y_)) { + } // Other automatically defined methods (assignment, copy constructor, destructor) are fine @@ -123,10 +125,14 @@ public: XYPOSITION right; XYPOSITION bottom; - PRectangle(XYPOSITION left_=0, XYPOSITION top_=0, XYPOSITION right_=0, XYPOSITION bottom_ = 0) : + explicit PRectangle(XYPOSITION left_=0, XYPOSITION top_=0, XYPOSITION right_=0, XYPOSITION bottom_ = 0) : left(left_), top(top_), right(right_), bottom(bottom_) { } - PRectangle(int left_, int top_, int right_, int bottom_) : + explicit PRectangle(int left_, int top_, int right_, int bottom_) : + left(static_cast(left_)), top(static_cast(top_)), + right(static_cast(right_)), bottom(static_cast(bottom_)) { + } + explicit PRectangle(long left_, long top_, long right_, long bottom_) : left(static_cast(left_)), top(static_cast(top_)), right(static_cast(right_)), bottom(static_cast(bottom_)) { } @@ -524,12 +530,6 @@ public: } #endif -// Shut up annoying Visual C++ warnings: -#ifdef _MSC_VER -// This is: conversion from X to Y, possible loss of data -#pragma warning(disable: 4244) -#endif - #if defined(__GNUC__) && defined(SCINTILLA_QT) #pragma GCC diagnostic ignored "-Wmissing-field-initializers" #endif -- cgit v1.2.3