[PATCH] Fix overflow in TextParam.

Dmitri Paduchikh dpaduchikh на gmail.com
Вс Фев 17 12:08:57 MSK 2013


---
 daemon/core/TextParam.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/daemon/core/TextParam.cpp b/daemon/core/TextParam.cpp
index 0abf57e..b1ee400 100644
--- a/daemon/core/TextParam.cpp
+++ b/daemon/core/TextParam.cpp
@@ -53,10 +53,10 @@ double TextParam::getValue(double min, double aver, double max) const
 
 const TextParam& TextParam::operator +=(size_t step)
 {
-  const size_t oldValue = m_value;
-  m_value += step;
-  if (m_value < oldValue)
+  if (step >= 100 || m_value + step >= 100)
     m_value = 100;
+  else
+    m_value += step;
   return *this;
 }
 
-- 
1.8.1.3


--=-=-=--


Подробная информация о списке рассылки Homeros