Project "Tuxbox-GIT: apps":

The branch, master has been updated
       via  76e2683e7dfb66736ec60452fae5b2195edca7eb (commit)
      from  ac506b8080684e05d10462dcbd89e0195cdb361f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 76e2683e7dfb66736ec60452fae5b2195edca7eb
Author: martii <m4r...@gmx.de>
Date:   Tue May 26 17:46:49 2015 +0200

    driver/rcinput: let getUnicodeValue() return const char *
    
    Signed-off-by: GetAway <get-a...@t-online.de>

diff --git a/tuxbox/neutrino/src/driver/rcinput.cpp 
b/tuxbox/neutrino/src/driver/rcinput.cpp
index 4a5b6dc..a3bd64f 100644
--- a/tuxbox/neutrino/src/driver/rcinput.cpp
+++ b/tuxbox/neutrino/src/driver/rcinput.cpp
@@ -1914,21 +1914,21 @@ unsigned int CRCInput::convertDigitToKey(const unsigned 
int digit)
 }
 
 /**************************************************************************
-*       getUnicodeValue - return unicode value of the key or -1
+*       getUnicodeValue - return unicode value of the key or \0
 *
 **************************************************************************/
 #define UNICODE_VALUE_SIZE 58
-static const int unicode_value[UNICODE_VALUE_SIZE] = {-1 , -1 , '1', '2', '3', 
'4', '5', '6', '7', '8', '9', '0', '-', '=', -1 , -1 ,
-                                                     'Q', 'W', 'E', 'R', 'T', 
'Y', 'U', 'I', 'O', 'P', '{', '}', -1 , -1 , 'A', 'S',
-                                                     'D', 'F', 'G', 'H', 'J', 
'K', 'L', ';', -1 /* FIXME */, -1 /* FIXME */, -1 , '\\', 'Z', 'X', 'C', 'V',
-                                                     'B', 'N', 'M', ',', '.', 
'/', -1, -1, -1, ' '};
+static const char unicode_value[UNICODE_VALUE_SIZE * 2] =
+       "\0\0" "\0\0" "1\0"  "2\0" "3\0" "4\0"  "5\0"  "6\0"  "7\0"    "8\0"  
"9\0"  "0\0"  "-\0"  "=\0" "\0\0" "\0\0"
+        "Q\0"  "W\0" "E\0"  "R\0" "T\0" "Y\0"  "U\0"  "I\0"  "O\0"    "P\0"  
"{\0"  "}\0" "\0\0" "\0\0"  "A\0"  "S\0"
+        "D\0"  "F\0" "G\0"  "H\0" "J\0" "K\0"  "L\0"  ";\0"  "'\0" "\140\0" 
"\0\0" "\\\0"  "Z\0"  "X\0"  "C\0"  "V\0"
+        "B\0"  "N\0" "M\0" "\0\0" ".\0" "/\0" "\0\0" "\0\0" "\0\0"      " ";
 
-int CRCInput::getUnicodeValue(const neutrino_msg_t key)
+const char *CRCInput::getUnicodeValue(const neutrino_msg_t key)
 {
        if (key < UNICODE_VALUE_SIZE)
-               return unicode_value[key];
-       else
-               return -1;
+               return unicode_value + key * 2;
+       return "";
 }
 
 /**************************************************************************
@@ -2132,16 +2132,16 @@ const char * CRCInput::getSpecialKeyName(const unsigned 
int key)
 
 std::string CRCInput::getKeyName(const unsigned int key)
 {
-       int uc_value = getUnicodeValue(key);
-       if (uc_value == -1)
-               return getSpecialKeyName(key);
-       else
-       {
-               char tmp[2];
-               tmp[0] = uc_value;
-               tmp[1] = 0;
-               return std::string(tmp);
-       }
+       std::string res(getKeyNameC(key));
+       return res;
+}
+
+const char *CRCInput::getKeyNameC(const unsigned int key)
+{
+       const char *lunicode_value = getUnicodeValue(key);
+       if (*lunicode_value)
+               return lunicode_value;
+       return getSpecialKeyName(key);
 }
 
 /**************************************************************************
diff --git a/tuxbox/neutrino/src/driver/rcinput.h 
b/tuxbox/neutrino/src/driver/rcinput.h
index b00b229..85c9cc2 100644
--- a/tuxbox/neutrino/src/driver/rcinput.h
+++ b/tuxbox/neutrino/src/driver/rcinput.h
@@ -360,9 +360,10 @@ class CRCInput
                static bool isNumeric(const neutrino_msg_t key);
                static int getNumericValue(const neutrino_msg_t key);
                static unsigned int convertDigitToKey(const unsigned int digit);
-               static int getUnicodeValue(const neutrino_msg_t key);
+               static const char *getUnicodeValue(const neutrino_msg_t key);
 
                static const char * getSpecialKeyName(const unsigned int key);
+               static const char *getKeyNameC(const unsigned int key);
                static std::string getKeyName(const unsigned int key);
 
                int addTimer(unsigned long long Interval, bool oneshot= true, 
bool correct_time= true );
diff --git a/tuxbox/neutrino/src/gui/widget/stringinput.cpp 
b/tuxbox/neutrino/src/gui/widget/stringinput.cpp
index 8d9a626..7729519 100644
--- a/tuxbox/neutrino/src/gui/widget/stringinput.cpp
+++ b/tuxbox/neutrino/src/gui/widget/stringinput.cpp
@@ -362,7 +362,7 @@ int CStringInput::exec( CMenuTarget* parent, const 
std::string & )
                {
                        keyRightPressed();
                }
-               else if (CRCInput::getUnicodeValue(msg) != -1)
+               else if (*CRCInput::getUnicodeValue(msg))
                {
                        NormalKeyPressed(msg);
                }
@@ -611,7 +611,7 @@ void CStringInputSMS::NormalKeyPressed(const neutrino_msg_t 
key)
        }
        else
        {
-               value[selected] = (char)CRCInput::getUnicodeValue(key);
+               valueString->at(selected) = *CRCInput::getUnicodeValue(key);
                keyRedPressed();   /* to lower, paintChar */
                keyRightPressed(); /* last_digit = -1, move to next position */
        }
diff --git a/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp 
b/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp
index 7db7e6b..27ebf5e 100644
--- a/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp
+++ b/tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp
@@ -210,7 +210,7 @@ int CExtendedInput::exec( CMenuTarget* parent, const 
std::string & )
                                }
                        }
                }
-               else if ((CRCInput::getUnicodeValue(msg) != -1) || (msg == 
CRCInput::RC_red)
+               else if ((*CRCInput::getUnicodeValue(msg)) || (msg == 
CRCInput::RC_red)
                        || (msg == CRCInput::RC_green) || (msg == 
CRCInput::RC_blue) || (msg == CRCInput::RC_yellow)
                        || (msg_repeatok == CRCInput::RC_up) || (msg_repeatok 
== CRCInput::RC_down))
                {
@@ -365,12 +365,12 @@ int CExtendedInput_Item_Char::getCharID( char ch )
 
 void CExtendedInput_Item_Char::keyPressed(const int key)
 {
-       int value = CRCInput::getUnicodeValue(key);
-       if (value != -1)
+       const char *value = CRCInput::getUnicodeValue(key);
+       if (*value)
        {
-               if (isAllowedChar((char)value))
+               if (isAllowedChar(*value))
                {
-                       *data = (char)value;
+                       *data = *value;
                        g_RCInput->postMsg( CRCInput::RC_right, 0 );
                }
        }

-----------------------------------------------------------------------

Summary of changes:
 tuxbox/neutrino/src/driver/rcinput.cpp             |   38 ++++++++++----------
 tuxbox/neutrino/src/driver/rcinput.h               |    3 +-
 tuxbox/neutrino/src/gui/widget/stringinput.cpp     |    4 +-
 tuxbox/neutrino/src/gui/widget/stringinput_ext.cpp |   10 +++---
 4 files changed, 28 insertions(+), 27 deletions(-)


-- 
Tuxbox-GIT: apps

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Tuxbox-cvs-commits mailing list
Tuxbox-cvs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tuxbox-cvs-commits

Reply via email to