From 6679a7236cf510a0f3a624c04a42e3d2c9e3b5a9 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 6 Jan 2020 22:22:41 +0100 Subject: [PATCH] cam_menu: reduce dub code, avoid possible format-truncation error Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/7bb23d2347d56916832aac0843c56e62ea56abb6 Author: Thilo Graf Date: 2020-01-06 (Mon, 06 Jan 2020) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/cam_menu.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/gui/cam_menu.cpp b/src/gui/cam_menu.cpp index 5d963f1f5..36dbfbe92 100644 --- a/src/gui/cam_menu.cpp +++ b/src/gui/cam_menu.cpp @@ -343,23 +343,19 @@ int CCAMMenuHandler::handleCamMsg(const neutrino_msg_t msg, neutrino_msg_data_t #endif if (in_menu) msgret = messages_return::cancel_all; - } else if(MsgId == CA_MESSAGE_MSG_INIT_OK) { + } else if ((MsgId == CA_MESSAGE_MSG_INIT_OK) || (MsgId == CA_MESSAGE_MSG_INIT_FAILED)) { char name[255] = "Unknown"; + if (ca) ca->ModuleName(SlotType, curslot, name); - snprintf(str, sizeof(str), "%s %d: %s", - g_Locale->getText(SlotType == CA_SLOT_TYPE_CI ? LOCALE_CI_INIT_OK : LOCALE_SC_INIT_OK), (int)curslot+1, name); - printf("CCAMMenuHandler::handleCamMsg: %s\n", str); - CCamManager::getInstance()->Start(CZapit::getInstance()->GetCurrentChannelID(), CCamManager::PLAY, true); - ShowHint(LOCALE_MESSAGEBOX_INFO, str, 450, 3); - } else if(MsgId == CA_MESSAGE_MSG_INIT_FAILED) { - char name[255] = "Unknown"; - if (ca) - ca->ModuleName(SlotType, curslot, name); + if(MsgId == CA_MESSAGE_MSG_INIT_OK) { + snprintf(str, sizeof(str) + sizeof(name), "%s %d: %s", g_Locale->getText(SlotType == CA_SLOT_TYPE_CI ? LOCALE_CI_INIT_OK : LOCALE_SC_INIT_OK), (int)curslot+1, name); + CCamManager::getInstance()->Start(CZapit::getInstance()->GetCurrentChannelID(), CCamManager::PLAY, true); + } - snprintf(str, sizeof(str), "%s %d: %s", - g_Locale->getText(SlotType == CA_SLOT_TYPE_CI ? LOCALE_CI_INIT_FAILED : LOCALE_SC_INIT_FAILED), (int)curslot+1, name); + if(MsgId == CA_MESSAGE_MSG_INIT_FAILED) + snprintf(str, sizeof(str) + sizeof(name), "%s %d: %s", g_Locale->getText(SlotType == CA_SLOT_TYPE_CI ? LOCALE_CI_INIT_FAILED : LOCALE_SC_INIT_FAILED), (int)curslot+1, name); printf("CCAMMenuHandler::handleCamMsg: %s\n", str); ShowHint(LOCALE_MESSAGEBOX_INFO, str, 450, 3);