mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-29 16:31:05 +02:00
add CRCInput::getKeyNameC to fix lifetime issues
in menu.cpp, getKeyName().c_str()'s destructor was already invoked
when the value was used, triggering a valgrind warning.
Origin commit data
------------------
Branch: ni/coolstream
Commit: d5d136f6c1
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2012-10-31 (Wed, 31 Oct 2012)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -1567,16 +1567,21 @@ const char * CRCInput::getSpecialKeyName(const unsigned int key)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string CRCInput::getKeyName(const unsigned int key)
|
std::string CRCInput::getKeyName(const unsigned int key)
|
||||||
|
{
|
||||||
|
return (std::string)getKeyNameC(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *CRCInput::getKeyNameC(const unsigned int key)
|
||||||
{
|
{
|
||||||
int lunicode_value = getUnicodeValue(key);
|
int lunicode_value = getUnicodeValue(key);
|
||||||
if (lunicode_value == -1)
|
if (lunicode_value == -1)
|
||||||
return getSpecialKeyName(key);
|
return getSpecialKeyName(key);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char tmp[2];
|
static char tmp[2];
|
||||||
tmp[0] = lunicode_value;
|
tmp[0] = lunicode_value;
|
||||||
tmp[1] = 0;
|
tmp[1] = 0;
|
||||||
return std::string(tmp);
|
return tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -282,6 +282,7 @@ class CRCInput
|
|||||||
static int getUnicodeValue(const neutrino_msg_t key);
|
static int getUnicodeValue(const neutrino_msg_t key);
|
||||||
|
|
||||||
static const char * getSpecialKeyName(const unsigned int 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);
|
static std::string getKeyName(const unsigned int key);
|
||||||
|
|
||||||
int addTimer(uint64_t Interval, bool oneshot= true, bool correct_time= true );
|
int addTimer(uint64_t Interval, bool oneshot= true, bool correct_time= true );
|
||||||
|
@@ -858,7 +858,7 @@ void CMenuWidget::calcSize()
|
|||||||
{
|
{
|
||||||
const char *tmp;
|
const char *tmp;
|
||||||
if (items[i]->iconName.empty())
|
if (items[i]->iconName.empty())
|
||||||
tmp = CRCInput::getKeyName(items[i]->directKey).c_str();
|
tmp = CRCInput::getKeyNameC(items[i]->directKey);
|
||||||
else
|
else
|
||||||
tmp = items[i]->iconName.c_str();
|
tmp = items[i]->iconName.c_str();
|
||||||
int w, h;
|
int w, h;
|
||||||
|
Reference in New Issue
Block a user