60 lines
2.1 KiB
Diff
60 lines
2.1 KiB
Diff
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);
|
|
}
|