stringinput: fix last commit

the fix for bounded input fields broke unbounded ones...


Origin commit data
------------------
Branch: ni/coolstream
Commit: 38f2d7d0ee
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2012-04-06 (Fri, 06 Apr 2012)



------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2012-04-06 19:08:53 +02:00
parent 42cf748b66
commit e2d40f2aa2

View File

@@ -194,12 +194,15 @@ void CStringInput::NormalKeyPressed(const neutrino_msg_t key)
value[selected] = validchars[CRCInput::getNumericValue(key)];
int current_value = atoi(value);
int tmp = current_value;
if (current_value <= lower_bound)
current_value = lower_bound + 1;
else if (current_value >= upper_bound)
current_value = upper_bound - 1;
if (tmp != current_value) /* size + 1 is correct, snprintf includes always '\0' */
snprintf(value, size + 1, "%*d", size, current_value);
if (lower_bound != -1 || upper_bound != -1)
{
if (current_value <= lower_bound)
current_value = lower_bound + 1;
else if (current_value >= upper_bound)
current_value = upper_bound - 1;
if (tmp != current_value) /* size + 1 is correct, snprintf includes always '\0' */
snprintf(value, size + 1, "%*d", size, current_value);
}
if( (lower_bound == -1 || upper_bound == -1) || (current_value > 0 && current_value > lower_bound && current_value < upper_bound) ){
if (selected < (size - 1))
{
@@ -292,12 +295,15 @@ void CStringInput::keyUpPressed()
int current_value = atoi(value);
int tmp = current_value;
if (current_value <= lower_bound)
current_value = lower_bound + 1;
else if (current_value >= upper_bound)
current_value = upper_bound - 1;
if (tmp != current_value) /* size + 1 is correct, snprintf includes always '\0' */
snprintf(value, size + 1, "%*d", size, current_value);
if (lower_bound != -1 || upper_bound != -1)
{
if (current_value <= lower_bound)
current_value = lower_bound + 1;
else if (current_value >= upper_bound)
current_value = upper_bound - 1;
if (tmp != current_value) /* size + 1 is correct, snprintf includes always '\0' */
snprintf(value, size + 1, "%*d", size, current_value);
}
if( (lower_bound == -1 || upper_bound == -1) || (current_value > 0 && current_value > lower_bound && current_value < upper_bound) ){
if (tmp != current_value)
{
@@ -325,12 +331,15 @@ void CStringInput::keyDownPressed()
int current_value = atoi(value);
int tmp = current_value;
if (current_value <= lower_bound)
current_value = lower_bound + 1;
else if (current_value >= upper_bound)
current_value = upper_bound - 1;
if (tmp != current_value) /* size + 1 is correct, snprintf includes always '\0' */
snprintf(value, size + 1, "%*d", size, current_value);
if (lower_bound != -1 || upper_bound != -1)
{
if (current_value <= lower_bound)
current_value = lower_bound + 1;
else if (current_value >= upper_bound)
current_value = upper_bound - 1;
if (tmp != current_value) /* size + 1 is correct, snprintf includes always '\0' */
snprintf(value, size + 1, "%*d", size, current_value);
}
if( (lower_bound == -1 || upper_bound == -1) || (current_value > 0 && current_value > lower_bound && current_value < upper_bound) ){
if (tmp != current_value)
{