From d31001a193ac93f05f3b5ee49c720785afefd66a Mon Sep 17 00:00:00 2001 From: vanhofen Date: Fri, 11 Jun 2021 21:16:22 +0200 Subject: [PATCH] lcd4linux: code formatation using astyle Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/47df64ae060d15b1971870b25af5f6d14c843501 Author: vanhofen Date: 2021-06-11 (Fri, 11 Jun 2021) Origin message was: ------------------ - lcd4linux: code formatation using astyle --- src/driver/lcd4l.cpp | 88 ++++++++++++++++++++++---------------------- src/driver/lcd4l.h | 2 +- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/driver/lcd4l.cpp b/src/driver/lcd4l.cpp index b983baa2d..de6b682c2 100644 --- a/src/driver/lcd4l.cpp +++ b/src/driver/lcd4l.cpp @@ -137,7 +137,7 @@ void CLCD4l::InitLCD4l() { if (thrLCD4l) { - dprintf(DEBUG_NORMAL,"\033[32m[CLCD4l] [%s - %d] initializing CLCD4l \033[0m\n", __func__, __LINE__); + dprintf(DEBUG_NORMAL, "\033[32m[CLCD4l] [%s - %d] initializing CLCD4l \033[0m\n", __func__, __LINE__); Init(); } } @@ -146,11 +146,11 @@ void CLCD4l::StartLCD4l() { if (!thrLCD4l) { - dprintf(DEBUG_NORMAL,"\033[32m[CLCD4l] [%s - %d] starting thread with mode %d \033[0m\n", __func__, __LINE__, g_settings.lcd4l_support); + dprintf(DEBUG_NORMAL, "\033[32m[CLCD4l] [%s - %d] starting thread with mode %d \033[0m\n", __func__, __LINE__, g_settings.lcd4l_support); exit_proc = false; - thrLCD4l = new std::thread (LCD4lProc, this); - dprintf(DEBUG_NORMAL,"\033[32m[CLCD4l] [%s - %d] thread [%p] is running\033[0m\n", __func__, __LINE__, thrLCD4l); + thrLCD4l = new std::thread(LCD4lProc, this); + dprintf(DEBUG_NORMAL, "\033[32m[CLCD4l] [%s - %d] thread [%p] is running\033[0m\n", __func__, __LINE__, thrLCD4l); } if (g_settings.lcd4l_support) exec_initscript("lcd4linux", "start"); @@ -160,15 +160,15 @@ void CLCD4l::StopLCD4l() { if (thrLCD4l) { - dprintf(DEBUG_NORMAL,"\033[32m[CLCD4l] [%s - %d] stopping thread [%p]\033[0m\n", __func__, __LINE__, thrLCD4l); + dprintf(DEBUG_NORMAL, "\033[32m[CLCD4l] [%s - %d] stopping thread [%p]\033[0m\n", __func__, __LINE__, thrLCD4l); exit_proc = true; thrLCD4l->join(); - dprintf(DEBUG_NORMAL,"\033[32m[CLCD4l] [%s - %d] thread [%p] joined\033[0m\n", __func__, __LINE__, thrLCD4l); + dprintf(DEBUG_NORMAL, "\033[32m[CLCD4l] [%s - %d] thread [%p] joined\033[0m\n", __func__, __LINE__, thrLCD4l); delete thrLCD4l; thrLCD4l = NULL; - dprintf(DEBUG_NORMAL,"\033[32m[CLCD4l] [%s - %d] thread [%p] terminated\033[0m\n", __func__, __LINE__, thrLCD4l); + dprintf(DEBUG_NORMAL, "\033[32m[CLCD4l] [%s - %d] thread [%p] terminated\033[0m\n", __func__, __LINE__, thrLCD4l); } exec_initscript("lcd4linux", "stop"); } @@ -252,7 +252,7 @@ void CLCD4l::Init() m_ModeTshift = -1; m_ModeTimer = -1; m_ModeEcm = -1; - m_ModeCamPresent= false; + m_ModeCamPresent = false; m_ModeCam = -1; m_Service = "n/a"; @@ -283,9 +283,9 @@ void CLCD4l::Init() wait4daemon = true; } -void* CLCD4l::LCD4lProc(void* arg) +void *CLCD4l::LCD4lProc(void *arg) { - CLCD4l *PLCD4l = static_cast(arg); + CLCD4l *PLCD4l = static_cast(arg); PLCD4l->Init(); @@ -296,9 +296,9 @@ void* CLCD4l::LCD4lProc(void* arg) bool NewParseID = false; //printf("[CLCD4l] %s: starting loop\n", __FUNCTION__); - while(!PLCD4l->exit_proc) + while (!PLCD4l->exit_proc) { - if ( (!access(PIDFILE, F_OK) == 0) && (!FirstRun) ) + if ((!access(PIDFILE, F_OK) == 0) && (!FirstRun)) { if (g_settings.lcd4l_support == 1) // automatic { @@ -347,10 +347,10 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) /* ----------------------------------------------------------------- */ - std::string fgcolor = hexStr(t.infobar_Text_red) - + hexStr(t.infobar_Text_green) - + hexStr(t.infobar_Text_blue) - + hexStrA2A(t.infobar_Text_alpha); + std::string fgcolor = hexStr(t.infobar_Text_red) + + hexStr(t.infobar_Text_green) + + hexStr(t.infobar_Text_blue) + + hexStrA2A(t.infobar_Text_alpha); if (m_fgcolor.compare(fgcolor)) { @@ -360,10 +360,10 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) /* ----------------------------------------------------------------- */ - std::string bgcolor = hexStr(t.infobar_red) - + hexStr(t.infobar_green) - + hexStr(t.infobar_blue) - + hexStrA2A(t.infobar_alpha); + std::string bgcolor = hexStr(t.infobar_red) + + hexStr(t.infobar_green) + + hexStr(t.infobar_blue) + + hexStrA2A(t.infobar_alpha); if (m_bgcolor.compare(bgcolor)) { @@ -373,10 +373,10 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) /* ----------------------------------------------------------------- */ - std::string fcolor1 = hexStr(t.infobar_Text_red) - + hexStr(t.infobar_Text_green) - + hexStr(t.infobar_Text_blue) - + hexStr(t.infobar_Text_alpha); + std::string fcolor1 = hexStr(t.infobar_Text_red) + + hexStr(t.infobar_Text_green) + + hexStr(t.infobar_Text_blue) + + hexStr(t.infobar_Text_alpha); if (m_fcolor1.compare(fcolor1)) { @@ -386,10 +386,10 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) /* ----------------------------------------------------------------- */ - std::string fcolor2 = hexStr(t.colored_events_red) - + hexStr(t.colored_events_green) - + hexStr(t.colored_events_blue) - + hexStr(t.colored_events_alpha); + std::string fcolor2 = hexStr(t.colored_events_red) + + hexStr(t.colored_events_green) + + hexStr(t.colored_events_blue) + + hexStr(t.colored_events_alpha); if (!t.colored_events_infobar) fcolor2 = fcolor1; @@ -402,10 +402,10 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) /* ----------------------------------------------------------------- */ - std::string pbcolor = hexStr(t.menu_Content_Selected_red) - + hexStr(t.menu_Content_Selected_green) - + hexStr(t.menu_Content_Selected_blue) - + hexStrA2A(t.menu_Content_Selected_alpha); + std::string pbcolor = hexStr(t.menu_Content_Selected_red) + + hexStr(t.menu_Content_Selected_green) + + hexStr(t.menu_Content_Selected_blue) + + hexStrA2A(t.menu_Content_Selected_alpha); if (m_pbcolor.compare(pbcolor)) { @@ -657,7 +657,7 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) else if (parseID == NeutrinoModes::mode_audio) { const CAudioMetaData meta = CAudioPlayer::getInstance()->getMetaData(); - if ( (!meta.sc_station.empty()) && (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP)) + if ((!meta.sc_station.empty()) && (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP)) Service = meta.sc_station; else { @@ -836,7 +836,7 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) const char *buf = "service lcd4linux reload"; //printf("[CLCD4l] %s: executing '%s'\n", __FUNCTION__, buf); - if (my_system(3,"service", "lcd4linux", "reload") != 0) + if (my_system(3, "service", "lcd4linux", "reload") != 0) printf("[CLCD4l] %s: executing '%s' failed\n", __FUNCTION__, buf); } } @@ -856,7 +856,7 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) { t_channel_id channel_id = parseID & 0xFFFFFFFFFFFFULL; - CZapitChannel * channel = CZapit::getInstance()->GetCurrentChannel(); + CZapitChannel *channel = CZapit::getInstance()->GetCurrentChannel(); if (channel) channel_id = channel->getEpgID(); @@ -920,11 +920,11 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) else { const CAudioMetaData meta = CAudioPlayer::getInstance()->getMetaData(); - if ( !meta.artist.empty() ) + if (!meta.artist.empty()) Event += meta.artist; - if ( !meta.artist.empty() && !meta.title.empty() ) + if (!meta.artist.empty() && !meta.title.empty()) Event += " - "; - if ( !meta.title.empty() ) + if (!meta.title.empty()) Event += meta.title; if (!meta.album.empty()) @@ -936,7 +936,7 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) time_t total = meta.total_time; time_t done = CAudioPlayer::getInstance()->getTimePlayed(); - if ( (total > 0) && (done > 0) ) + if ((total > 0) && (done > 0)) { Progress = 100 * done / total; snprintf(Duration, sizeof(Duration), "%ld:%02ld/%ld:%02ld", done / 60, done % 60, total / 60, total % 60); @@ -982,13 +982,13 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) } time_t sTime = time(NULL); - sTime -= (CMoviePlayerGui::getInstance().GetPosition()/1000); + sTime -= (CMoviePlayerGui::getInstance().GetPosition() / 1000); tm_struct = localtime(&sTime); snprintf(Start, sizeof(Start), "%02d:%02d", tm_struct->tm_hour, tm_struct->tm_min); time_t eTime = time(NULL); - eTime +=(CMoviePlayerGui::getInstance().GetDuration()/1000) - (CMoviePlayerGui::getInstance().GetPosition()/1000); + eTime += (CMoviePlayerGui::getInstance().GetDuration() / 1000) - (CMoviePlayerGui::getInstance().GetPosition() / 1000); tm_struct = localtime(&eTime); snprintf(End, sizeof(End), "%02d:%02d", tm_struct->tm_hour, tm_struct->tm_min); @@ -1043,7 +1043,7 @@ void CLCD4l::ParseInfo(uint64_t parseID, bool newID, bool firstRun) WriteFile(PROGRESS, to_string(Progress)); m_Progress = Progress; } - + if (strcmp(m_Duration, Duration)) { WriteFile(DURATION, (std::string)Duration); @@ -1221,9 +1221,9 @@ std::string CLCD4l::hexStrA2A(unsigned char data) int a = 100 - data; int ret = a * 0xFF / 100; - if(data == 0) + if (data == 0) ret = 0xFF; - else if(data >= 100) + else if (data >= 100) ret = 0x00; snprintf(hexstr, sizeof hexstr, "%02x", ret); diff --git a/src/driver/lcd4l.h b/src/driver/lcd4l.h index 09f687229..cb1fb4445 100644 --- a/src/driver/lcd4l.h +++ b/src/driver/lcd4l.h @@ -64,7 +64,7 @@ class CLCD4l private: std::thread *thrLCD4l; - static void* LCD4lProc(void *arg); + static void *LCD4lProc(void *arg); bool exit_proc; struct tm *tm_struct;