From 1f23a7838000e6fd5f7a1ae6bb85791ce7c08ad7 Mon Sep 17 00:00:00 2001
From: Luigi 'Comio' Mantellini <luigi.mantellini@gmail.com>
Date: Mon, 24 Mar 2014 13:44:04 +0100
Subject: [PATCH] Remove some warning.

---
 Foundation/src/NumericString.cpp | 15 +++++++++------
 Foundation/src/utils.h           |  7 ++++++-
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/Foundation/src/NumericString.cpp b/Foundation/src/NumericString.cpp
index 37ecf7f..e5dc939 100644
--- a/Foundation/src/NumericString.cpp
+++ b/Foundation/src/NumericString.cpp
@@ -48,6 +48,9 @@ void pad(std::string& str, int precision, int width, char prefix = ' ', char dec
 	poco_assert_dbg (precision > 0);
 	poco_assert_dbg (str.length());
 
+	std::string::size_type _precision = static_cast<std::string::size_type>(precision);
+	std::string::size_type _width = static_cast<std::string::size_type>(width);
+	
 	std::string::size_type decSepPos = str.find(decSep);
 	if (decSepPos == std::string::npos)
 	{
@@ -66,15 +66,15 @@ void pad(std::string& str, int precision, int width, char prefix = ' ', char dec
 		str = str.substr(0, str.length() - eStr->length());
 	}
 
-	if (frac != precision)
+	if (frac != _precision)
 	{
-		if (frac < precision)
+		if (frac < _precision)
 		{
-			str.append(precision - frac, '0');
+			str.append(_precision - frac, '0');
 		}
-		else if ((frac > precision) && (decSepPos != std::string::npos))
+		else if ((frac > _precision) && (decSepPos != std::string::npos))
 		{
-			int pos = static_cast<int>(decSepPos) + 1 + precision;
+			int pos = static_cast<int>(decSepPos) + 1 + _precision;
 			if (str[pos] >= '5') // we must round up
 			{
 				char carry = 0;
@@ -107,13 +107,13 @@ void pad(std::string& str, int precision, int width, char prefix = ' ', char dec
 				}
 				if (carry) str.insert(str.begin(), 1, '1');
 			}
-			str = str.substr(0, decSepPos + 1 + precision);
+			str = str.substr(0, decSepPos + 1 + _precision);
 		}
 	}
 
 	if (eStr.get()) str += *eStr;
 
-	if (width && (str.length() < width)) str.insert(str.begin(), width - str.length(), prefix);
+	if (width && (str.length() < width)) str.insert(str.begin(), _width - str.length(), prefix);
 }
 
 
diff --git a/Foundation/src/utils.h b/Foundation/src/utils.h
index 767094b..6465e84 100644
--- a/Foundation/src/utils.h
+++ b/Foundation/src/utils.h
@@ -35,6 +35,11 @@
 #ifndef ASSERT
 #define ASSERT(condition)      (assert(condition))
 #endif
+#if __cplusplus >= 201103L
+#define STATIC_ASSERT(b, str) static_assert(b, str)
+#else
+#define STATIC_ASSERT(b, str) typedef char __StaticAssertCheck[b ? 1 : -1]
+#endif
 #ifndef UNIMPLEMENTED
 #define UNIMPLEMENTED() (abort())
 #endif
@@ -296,8 +301,7 @@ template <class Dest, class Source>
 inline Dest BitCast(const Source& source) {
   // Compile time assertion: sizeof(Dest) == sizeof(Source)
   // A compile error here means your Dest and Source have different sizes.
-  DOUBLE_CONVERSION_UNUSED
-      typedef char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1];
+      STATIC_ASSERT(sizeof(Dest) == sizeof(Source), "Dest and Source must have the same size");
 
   Dest dest;
   memmove(&dest, &source, sizeof(dest));
