mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-30 17:01:08 +02:00
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:
@@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user