From 717ec7c3303267d182152559a80c333255e86267 Mon Sep 17 00:00:00 2001 From: jbleyel Date: Mon, 23 Sep 2024 22:28:28 +0200 Subject: [PATCH] Use C++11 struct initializer --- lib/actions/action.cpp | 4 ++-- lib/base/console.cpp | 2 +- lib/base/ebase.cpp | 6 +++--- lib/base/ebase.h | 14 ++++++------- lib/base/eerror.cpp | 6 +++--- lib/base/esimpleconfig.cpp | 2 +- lib/base/etpm.cpp | 2 +- lib/base/internetcheck.cpp | 2 +- lib/base/rawfile.cpp | 2 +- lib/base/thread.cpp | 2 +- lib/base/wrappers.cpp | 10 +++++----- lib/components/file_eraser.cpp | 2 +- lib/driver/avcontrol.cpp | 2 +- lib/driver/hdmi_cec.cpp | 12 +++++------ lib/driver/rc.cpp | 2 +- lib/driver/rcconsole.cpp | 2 +- lib/driver/rcdreambox2.cpp | 2 +- lib/driver/rcinput.cpp | 2 +- lib/dvb/decoder.cpp | 20 +++++++++---------- lib/dvb/epgcache.cpp | 2 +- lib/dvb/epgchanneldata.cpp | 18 ++++++++--------- lib/dvb/esection.h | 2 +- lib/dvb/fbc.h | 4 ++-- lib/dvb/fcc.h | 3 +-- lib/dvb/fccdecoder.cpp | 2 +- lib/dvb/filepush.cpp | 17 ++++++++-------- lib/dvb/filepush.h | 4 ++-- lib/dvb/frontend.cpp | 33 +++++++++++++++---------------- lib/dvb/metaparser.cpp | 4 ++-- lib/dvb/pmt.cpp | 2 +- lib/dvb/rtspstreamserver.cpp | 2 +- lib/dvb/streamserver.cpp | 12 +++++------ lib/dvb_ci/descrambler.cpp | 2 +- lib/dvb_ci/dvbci_ccmgr.cpp | 4 ++-- lib/dvb_ci/dvbci_ccmgr_helper.cpp | 2 +- lib/gdi/epng.cpp | 4 ++-- lib/gdi/fb.cpp | 8 ++++---- lib/gdi/picload.cpp | 10 +++++----- lib/gdi/pixmapcache.cpp | 4 ++-- lib/timeshift/createapscfiles.cc | 2 +- main/bsod.cpp | 6 +++--- main/enigma.cpp | 4 ++-- tools/convert_argb_png.c | 4 ++-- 43 files changed, 123 insertions(+), 128 deletions(-) diff --git a/lib/actions/action.cpp b/lib/actions/action.cpp index f32596d2a6d..606b7d35fd6 100644 --- a/lib/actions/action.cpp +++ b/lib/actions/action.cpp @@ -303,8 +303,8 @@ void eActionMap::keyPressed(const std::string &device, int key, int flags) (k->second.m_device == device || k->second.m_device == "generic")) { ePyObject pArgs = PyTuple_New(2); - PyTuple_SET_ITEM(pArgs, 0, PyString_FromString(k->first.c_str())); - PyTuple_SET_ITEM(pArgs, 1, PyString_FromString(k->second.m_action.c_str())); + PyTuple_SET_ITEM(pArgs, 0, PyUnicode_FromString(k->first.c_str())); + PyTuple_SET_ITEM(pArgs, 1, PyUnicode_FromString(k->second.m_action.c_str())); Py_INCREF(c->second.m_fnc); call_list.push_back(call_entry(c->second.m_fnc, pArgs)); } diff --git a/lib/base/console.cpp b/lib/base/console.cpp index e9e1bc3d822..90c10310f83 100644 --- a/lib/base/console.cpp +++ b/lib/base/console.cpp @@ -75,7 +75,7 @@ eConsoleAppContainer::eConsoleAppContainer(): int eConsoleAppContainer::setCWD( const char *path ) { - struct stat dir_stat; + struct stat dir_stat = {}; if (stat(path, &dir_stat) == -1) return -1; diff --git a/lib/base/ebase.cpp b/lib/base/ebase.cpp index f9365e80e86..70c77b524a1 100644 --- a/lib/base/ebase.cpp +++ b/lib/base/ebase.cpp @@ -187,7 +187,7 @@ int eMainloop::processOneEvent(long user_timeout, PyObject **res, ePyObject addi { eTimer *tmr = *it; /* get current time */ - timespec now; + timespec now = {}; clock_gettime(CLOCK_MONOTONIC, &now); /* process all timers which are ready. first remove them out of the list. */ while (tmr->needsActivation(now)) @@ -223,7 +223,7 @@ int eMainloop::processOneEvent(long user_timeout, PyObject **res, ePyObject addi fdcount += PyDict_Size(additional); // build the poll aray - pollfd pfd[fdcount]; // make new pollfd array + pollfd pfd[fdcount] = {}; // make new pollfd array std::map::iterator it = notifiers.begin(); int i=0; @@ -335,7 +335,7 @@ int eMainloop::iterate(unsigned int twisted_timeout, PyObject **res, ePyObject d int to = -1; if (twisted_timeout) { - timespec now, timeout; + timespec now = {}, timeout = {}; clock_gettime(CLOCK_MONOTONIC, &now); if (m_twisted_timer<=now) // timeout return 0; diff --git a/lib/base/ebase.h b/lib/base/ebase.h index 79be15b9f76..35e7bfd91b1 100644 --- a/lib/base/ebase.h +++ b/lib/base/ebase.h @@ -46,7 +46,7 @@ static inline timespec &operator+=( timespec &t1, const timespec &t2 ) static inline timespec operator+( const timespec &t1, const timespec &t2 ) { - timespec tmp; + timespec tmp = {}; tmp.tv_sec = t1.tv_sec + t2.tv_sec; if ( (tmp.tv_nsec = t1.tv_nsec + t2.tv_nsec) >= 1000000000 ) { @@ -58,7 +58,7 @@ static inline timespec operator+( const timespec &t1, const timespec &t2 ) static inline timespec operator-( const timespec &t1, const timespec &t2 ) { - timespec tmp; + timespec tmp = {}; tmp.tv_sec = t1.tv_sec - t2.tv_sec; if ( (tmp.tv_nsec = t1.tv_nsec - t2.tv_nsec) < 0 ) { @@ -92,7 +92,7 @@ static inline timespec &operator+=( timespec &t1, const long msek ) static inline timespec operator+( const timespec &t1, const long msek ) { - timespec tmp; + timespec tmp = {}; tmp.tv_sec = t1.tv_sec + msek / 1000; if ( (tmp.tv_nsec = t1.tv_nsec + (msek % 1000) * 1000000) >= 1000000000 ) { @@ -104,7 +104,7 @@ static inline timespec operator+( const timespec &t1, const long msek ) static inline timespec operator-( const timespec &t1, const long msek ) { - timespec tmp; + timespec tmp = {}; tmp.tv_sec = t1.tv_sec - msek / 1000; if ( (tmp.tv_nsec = t1.tv_nsec - (msek % 1000)*1000000) < 0 ) { @@ -127,7 +127,7 @@ static inline timespec operator-=( timespec &t1, const long msek ) static inline long timeout_usec ( const timespec & orig ) { - timespec now, diff; + timespec now = {}, diff = {}; clock_gettime(CLOCK_MONOTONIC, &now); diff = orig - now; if (diff.tv_sec > 2000) @@ -194,7 +194,7 @@ class eMainloop int retval; eSocketNotifier *m_inActivate; int m_interrupt_requested; - timespec m_twisted_timer; + timespec m_twisted_timer = {}; /* user_timeout < 0 - forever * user_timeout = 0 - immediately @@ -279,7 +279,7 @@ class eTimer: iObject friend class eMainloop; eMainloop &context; - timespec nextActivation; + timespec nextActivation = {}; long interval; bool bSingleShot; bool bActive; diff --git a/lib/base/eerror.cpp b/lib/base/eerror.cpp index 214a26eb9f0..57c96456d88 100644 --- a/lib/base/eerror.cpp +++ b/lib/base/eerror.cpp @@ -143,8 +143,8 @@ int formatTime(char *buf, int bufferSize, int flags) { if (debugTime & 6) { - struct tm loctime; - struct timeval tim; + struct tm loctime = {}; + struct timeval tim = {}; gettimeofday(&tim, NULL); localtime_r(&tim.tv_sec, &loctime); if (debugTime & 4) @@ -159,7 +159,7 @@ int formatTime(char *buf, int bufferSize, int flags) } if (debugTime & 1) { - struct timespec tp; + struct timespec tp = {}; clock_gettime(CLOCK_MONOTONIC, &tp); // Cast to (long long) is to cater for older 32-bit time fields pos += snprintf(buf + pos, bufferSize - pos, "<%6lld.%06lld> ", (long long)tp.tv_sec, (long long)tp.tv_nsec / 1000); diff --git a/lib/base/esimpleconfig.cpp b/lib/base/esimpleconfig.cpp index 88ff188126d..4c7e82225a1 100644 --- a/lib/base/esimpleconfig.cpp +++ b/lib/base/esimpleconfig.cpp @@ -20,7 +20,7 @@ namespace eSimpleConfig { std::string file = eEnv::resolve("${sysconfdir}/enigma2/settings"); - struct stat settings_stat; + struct stat settings_stat = {}; if (stat(file.c_str(), &settings_stat) == -1 || settings_stat.st_mtime <= lastModified) return; diff --git a/lib/base/etpm.cpp b/lib/base/etpm.cpp index a4124f048cd..144a21aed6d 100644 --- a/lib/base/etpm.cpp +++ b/lib/base/etpm.cpp @@ -14,7 +14,7 @@ eTPM::eTPM() { - struct sockaddr_un addr; + struct sockaddr_un addr = {}; unsigned char buf[8]; unsigned int tag; size_t len; diff --git a/lib/base/internetcheck.cpp b/lib/base/internetcheck.cpp index 1b8e0ab9b86..399fc3f327b 100644 --- a/lib/base/internetcheck.cpp +++ b/lib/base/internetcheck.cpp @@ -59,7 +59,7 @@ int checkLinkStatus() } int sock; - struct ifreq ifr; + struct ifreq ifr = {}; // Create a socket sock = socket(AF_INET, SOCK_DGRAM, 0); if (sock < 0) diff --git a/lib/base/rawfile.cpp b/lib/base/rawfile.cpp index adbd7235a0a..e0ef7060e47 100644 --- a/lib/base/rawfile.cpp +++ b/lib/base/rawfile.cpp @@ -162,7 +162,7 @@ off_t eRawFile::length() } else { - struct stat st; + struct stat st = {}; if (::fstat(m_fd, &st) < 0) return -1; return st.st_size; diff --git a/lib/base/thread.cpp b/lib/base/thread.cpp index f64eb4c19a1..10e437f4c11 100644 --- a/lib/base/thread.cpp +++ b/lib/base/thread.cpp @@ -55,7 +55,7 @@ int eThread::runAsync(int prio, int policy) if (prio || policy) { - struct sched_param p; + struct sched_param p = {}; p.__sched_priority=prio; pthread_attr_setschedpolicy(&attr, policy); pthread_attr_setschedparam(&attr, &p); diff --git a/lib/base/wrappers.cpp b/lib/base/wrappers.cpp index f69b2e1613e..eed4a431f89 100644 --- a/lib/base/wrappers.cpp +++ b/lib/base/wrappers.cpp @@ -18,7 +18,7 @@ int Select(int maxfd, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, stru { int retval; fd_set rset, wset, xset; - timeval interval; + timeval interval = {}; /* make a backup of all fd_set's and timeval struct */ if (readfds) rset = *readfds; @@ -64,7 +64,7 @@ ssize_t singleRead(int fd, void *buf, size_t count) if (retval < 0) { if (errno == EINTR) continue; - eDebug("[singleRead] error: %m"); + eDebug("[singleRead] error: %d (%m)", errno); } return retval; } @@ -73,7 +73,7 @@ ssize_t singleRead(int fd, void *buf, size_t count) ssize_t timedRead(int fd, void *buf, size_t count, int initialtimeout, int interbytetimeout) { fd_set rset; - struct timeval timeout; + struct timeval timeout = {}; int result; size_t totalread = 0; @@ -132,7 +132,7 @@ int Connect(const char *hostname, int port, int timeoutsec) int sd = -1; std::vector addresses; struct addrinfo *info = NULL; - struct addrinfo hints; + struct addrinfo hints = {}; memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; /* both ipv4 and ipv6 */ hints.ai_socktype = SOCK_STREAM; @@ -188,7 +188,7 @@ int Connect(const char *hostname, int port, int timeoutsec) { int error; socklen_t len = sizeof(error); - timeval timeout; + timeval timeout = {}; fd_set wset; FD_ZERO(&wset); FD_SET(sd, &wset); diff --git a/lib/components/file_eraser.cpp b/lib/components/file_eraser.cpp index 77ad1292bfa..83c3b631f9f 100644 --- a/lib/components/file_eraser.cpp +++ b/lib/components/file_eraser.cpp @@ -95,7 +95,7 @@ void eBackgroundFileEraser::gotMessage(const Message &msg ) if ((((erase_flags & ERASE_FLAG_HDD) != 0) && (strncmp(c_filename, "/media/hdd/", 11) == 0)) || ((erase_flags & ERASE_FLAG_OTHER) != 0)) { - struct stat st; + struct stat st = {} int i = ::stat(c_filename, &st); // truncate only if the file exists and does not have any hard links if ((i == 0) && (st.st_nlink == 1)) diff --git a/lib/driver/avcontrol.cpp b/lib/driver/avcontrol.cpp index ee7b9c68a97..8a16617c009 100644 --- a/lib/driver/avcontrol.cpp +++ b/lib/driver/avcontrol.cpp @@ -75,7 +75,7 @@ eAVControl *eAVControl::m_instance = nullptr; eAVControl::eAVControl() { - struct stat buffer; + struct stat buffer = {}; #ifdef HAVE_HDMIIN_DM m_b_has_proc_hdmi_rx_monitor = (stat(proc_hdmi_rx_monitor, &buffer) == 0); diff --git a/lib/driver/hdmi_cec.cpp b/lib/driver/hdmi_cec.cpp index 705d2b9ca0a..eb65f2e82ba 100644 --- a/lib/driver/hdmi_cec.cpp +++ b/lib/driver/hdmi_cec.cpp @@ -176,7 +176,7 @@ eHdmiCEC *eHdmiCEC::getInstance() void eHdmiCEC::reportPhysicalAddress() { - struct cec_message txmessage; + struct cec_message txmessage = {}; memset(&txmessage, 0, sizeof(txmessage)); txmessage.address = 0x0f; /* broadcast */ txmessage.data[0] = 0x84; /* report address */ @@ -192,7 +192,7 @@ void eHdmiCEC::getAddressInfo() if (hdmiFd >= 0) { bool hasdata = false; - struct addressinfo addressinfo; + struct addressinfo addressinfo = {}; if (linuxCEC) { @@ -330,7 +330,7 @@ void eHdmiCEC::hdmiEvent(int what) { if (linuxCEC) { - struct cec_event cecevent; + struct cec_event cecevent = {}; ::ioctl(hdmiFd, CEC_DQEVENT, &cecevent); if (cecevent.event == CEC_EVENT_STATE_CHANGE) { @@ -343,10 +343,10 @@ void eHdmiCEC::hdmiEvent(int what) if (what & eSocketNotifier::Read) { bool hasdata = false; - struct cec_rx_message rxmessage; + struct cec_rx_message rxmessage = {}; if (linuxCEC) { - struct cec_msg msg; + struct cec_msg msg = {}; if (::ioctl(hdmiFd, CEC_RECEIVE, &msg) >= 0) { rxmessage.length = msg.len - 1; @@ -565,7 +565,7 @@ void eHdmiCEC::sendMessage(struct cec_message &message) void eHdmiCEC::sendMessage(unsigned char address, unsigned char cmd, char *data, int length) { - struct cec_message message; + struct cec_message message = {}; message.address = address; if (length > (int)(sizeof(message.data) - 1)) length = sizeof(message.data) - 1; message.length = length + 1; diff --git a/lib/driver/rc.cpp b/lib/driver/rc.cpp index db157caf3be..3d8f6b8128a 100644 --- a/lib/driver/rc.cpp +++ b/lib/driver/rc.cpp @@ -96,7 +96,7 @@ eRCShortDriver::~eRCShortDriver() void eRCInputEventDriver::keyPressed(int) { - struct input_event ev; + struct input_event ev = {}; while (1) { if (read(handle, &ev, sizeof(struct input_event))!=sizeof(struct input_event)) diff --git a/lib/driver/rcconsole.cpp b/lib/driver/rcconsole.cpp index dc9d3fa0b0d..e4b3e680c00 100644 --- a/lib/driver/rcconsole.cpp +++ b/lib/driver/rcconsole.cpp @@ -21,7 +21,7 @@ eRCConsoleDriver::eRCConsoleDriver(const char *filename): eRCDriver(eRCInput::ge if (handle >= 0) { /* set console mode */ - struct termios t; + struct termios t = {}; tcgetattr(handle, &t); ot = t; t.c_lflag &= ~(ECHO | ICANON | ECHOK | ECHOE | ECHONL); diff --git a/lib/driver/rcdreambox2.cpp b/lib/driver/rcdreambox2.cpp index 9afdd5c2e49..39a05c44187 100644 --- a/lib/driver/rcdreambox2.cpp +++ b/lib/driver/rcdreambox2.cpp @@ -215,7 +215,7 @@ class eRCDeviceDreambox2Init eRCDeviceDreambox2Init() : m_driver(NULL), m_device(NULL), m_buttondriver(NULL), m_buttondevice(NULL) { - struct stat s; + struct stat s = {}; if (::access("/dev/rawir2", R_OK) >= 0) { m_driver = new eRCShortDriver("/dev/rawir2"); diff --git a/lib/driver/rcinput.cpp b/lib/driver/rcinput.cpp index 31951988360..a927138dd5d 100644 --- a/lib/driver/rcinput.cpp +++ b/lib/driver/rcinput.cpp @@ -77,7 +77,7 @@ void eRCDeviceInputDev::handleCode(long rccode) { if (consoleFd >= 0) { - struct kbentry ke; + struct kbentry ke = {}; /* off course caps is not the same as shift, but this will have to do for now */ ke.kb_table = (shiftState || capsState) ? K_SHIFTTAB : K_NORMTAB; ke.kb_index = ev->code; diff --git a/lib/dvb/decoder.cpp b/lib/dvb/decoder.cpp index d2eefe817de..e00a882fa62 100644 --- a/lib/dvb/decoder.cpp +++ b/lib/dvb/decoder.cpp @@ -79,7 +79,7 @@ int eDVBAudio::startPid(int pid, int type) { if (m_fd_demux >= 0) { - dmx_pes_filter_params pes; + dmx_pes_filter_params pes = {}; memset(&pes, 0, sizeof(pes)); pes.pid = pid; @@ -376,7 +376,7 @@ eDVBVideo::eDVBVideo(eDVBDemux *demux, int dev, bool fcc_enable) if (eDVBVideo::m_debug < 0) eDVBVideo::m_debug = eSimpleConfig::getBool("config.crash.debugDVB", false) ? 1 : 0; - char filename[128]; + char filename[128] = {}; sprintf(filename, "/dev/dvb/adapter%d/video%d", demux ? demux->adapter : 0, dev); m_fd = ::open(filename, O_RDWR | O_CLOEXEC); if (m_fd < 0) @@ -431,8 +431,6 @@ eDVBVideo::eDVBVideo(eDVBDemux *demux, int dev, bool fcc_enable) readApiSize(m_fd, m_width, m_height, m_aspect); m_close_invalidates_attributes = (m_width == -1) ? 1 : 0; } - - } // not finally values i think.. !! @@ -504,7 +502,7 @@ int eDVBVideo::startPid(int pid, int type) if (m_fd_demux >= 0) { - dmx_pes_filter_params pes; + dmx_pes_filter_params pes = {}; memset(&pes, 0, sizeof(pes)); pes.pid = pid; @@ -727,13 +725,13 @@ void eDVBVideo::video_event(int) while (m_fd >= 0) { int retval; - pollfd pfd[1]; + pollfd pfd[1] = {}; pfd[0].fd = m_fd; pfd[0].events = POLLPRI; retval = ::poll(pfd, 1, 0); if (retval < 0 && errno == EINTR) continue; if (retval <= 0) break; - struct video_event evt; + struct video_event evt = {}; if(eDVBVideo::m_debug) eDebugNoNewLineStart("[eDVBVideo%d] VIDEO_GET_EVENT ", m_dev); if (::ioctl(m_fd, VIDEO_GET_EVENT, &evt) < 0) @@ -989,7 +987,7 @@ int eDVBVideo::getGamma() { if (m_gamma == -1) { - char tmp[64]; + char tmp[64] = {}; sprintf(tmp, "/proc/stb/vmpeg/%d/gamma", m_dev); CFile::parseIntHex(&m_gamma, tmp); } @@ -1093,7 +1091,7 @@ int eDVBTText::m_debug = -1; eDVBTText::eDVBTText(eDVBDemux *demux, int dev) :m_demux(demux), m_dev(dev) { - char filename[128]; + char filename[128] = {}; sprintf(filename, "/dev/dvb/adapter%d/demux%d", demux->adapter, demux->demux); m_fd_demux = ::open(filename, O_RDWR | O_CLOEXEC); if (m_fd_demux < 0) @@ -1106,7 +1104,7 @@ int eDVBTText::startPid(int pid) { if (m_fd_demux < 0) return -1; - dmx_pes_filter_params pes; + dmx_pes_filter_params pes = {}; memset(&pes, 0, sizeof(pes)); pes.pid = pid; @@ -1599,7 +1597,7 @@ RESULT eTSMPEGDecoder::showSinglePic(const char *filename) int f = open(filename, O_RDONLY); if (f >= 0) { - struct stat s; + struct stat s = {}; fstat(f, &s); #if HAVE_HISILICON if (m_video_clip_fd >= 0) diff --git a/lib/dvb/epgcache.cpp b/lib/dvb/epgcache.cpp index 11614c5ad2e..7ef0c95430c 100644 --- a/lib/dvb/epgcache.cpp +++ b/lib/dvb/epgcache.cpp @@ -1094,7 +1094,7 @@ void eEPGCache::save() if(m_debug) eDebug("[eEPGCache] Store EPG to realpath '%s'.", buf); - struct statfs st; + struct statfs st = {}; off64_t tmp; if (statfs(buf, &st) < 0) { eDebug("[eEPGCache] Applying statfs '%s' failed in save! (%m)", buf); diff --git a/lib/dvb/epgchanneldata.cpp b/lib/dvb/epgchanneldata.cpp index 2d117219182..7fc19a02cfd 100644 --- a/lib/dvb/epgchanneldata.cpp +++ b/lib/dvb/epgchanneldata.cpp @@ -1143,7 +1143,7 @@ void eEPGChannelData::log_add (const char *message, ...) va_list args; char msg[16*1024]; time_t now_time; - struct tm loctime; + struct tm loctime = {}; now_time = time (NULL); localtime_r(&now_time, &loctime); @@ -1227,7 +1227,7 @@ void eEPGChannelData::readMHWData(const uint8_t *data) char dated[22]; time_t now_time; - struct tm loctime; + struct tm loctime = {}; now_time = time (NULL); localtime_r(&now_time, &loctime); strftime (dated, 21, "%d/%m/%Y %H:%M:%S", &loctime); @@ -1451,7 +1451,7 @@ void eEPGChannelData::readMHWData2(const uint8_t *data) char dated[22]; time_t now_time; - struct tm loctime; + struct tm loctime = {}; now_time = time (NULL); localtime_r(&now_time, &loctime); strftime (dated, 21, "%d/%m/%Y %H:%M:%S", &loctime); @@ -1764,7 +1764,7 @@ void eEPGChannelData::readMHWData2(const uint8_t *data) int chid = it->second.channel_id - 1; time_t ndate, edate; - struct tm next_date; + struct tm next_date = {}; u_char mhw2_mjd_hi = data[pos+10]; u_char mhw2_mjd_lo = data[pos+11]; u_char mhw2_hours = data[pos+12]; @@ -1877,7 +1877,7 @@ void eEPGChannelData::readMHWData2_old(const uint8_t *data) char dated[22]; time_t now_time; - struct tm loctime; + struct tm loctime = {}; now_time = time (NULL); localtime_r(&now_time, &loctime); strftime (dated, 21, "%d/%m/%Y %H:%M:%S", &loctime); @@ -2166,7 +2166,7 @@ void eEPGChannelData::readMHWData2_old(const uint8_t *data) char const *const days[] = {"D", "L", "M", "M", "J", "V", "S", "D"}; time_t ndate, edate; - struct tm next_date; + struct tm next_date = {}; ndate = replay_time[n]; edate = MjdToEpochTime(itTitle->second.mhw2_mjd) + (((itTitle->second.mhw2_hours&0xf0)>>4)*10+(itTitle->second.mhw2_hours&0x0f)) * 3600 @@ -2457,7 +2457,7 @@ void eEPGChannelData::ATSC_EITsection(const uint8_t *d) uint32_t etm = ((eit.getTableIdExtension() & 0xffff) << 16) | (((*ev)->getEventId() & 0x3fff) << 2) | 0x2; if (m_ATSC_EIT_map.find(etm) == m_ATSC_EIT_map.end()) { - struct atsc_event event; + struct atsc_event event = {}; event.title = (*ev)->getTitle("---"); event.eventId = (*ev)->getEventId(); event.startTime = (*ev)->getStartTime() + (time_t)315964800; /* ATSC GPS system time epoch is 00:00 Jan 6th 1980 */ @@ -2623,7 +2623,7 @@ void eEPGChannelData::OPENTV_ChannelsSection(const uint8_t *d) { if (m_OPENTV_channels_map.find((*channel)->getChannelId()) == m_OPENTV_channels_map.end()) { - struct opentv_channel otc; + struct opentv_channel otc = {}; otc.originalNetworkId = (*channel)->getOriginalNetworkId(); otc.transportStreamId = (*channel)->getTransportStreamId(); otc.serviceId = (*channel)->getServiceId(); @@ -2644,7 +2644,7 @@ void eEPGChannelData::OPENTV_TitlesSection(const uint8_t *d) if (m_OPENTV_EIT_map.find(etm) == m_OPENTV_EIT_map.end()) { - struct opentv_event ote; + struct opentv_event ote = {}; ote.eventId = (*title)->getEventId(); ote.startTime = (*title)->getStartTime(); ote.duration = (*title)->getDuration(); diff --git a/lib/dvb/esection.h b/lib/dvb/esection.h index e9409533b99..c8060fc20e0 100644 --- a/lib/dvb/esection.h +++ b/lib/dvb/esection.h @@ -109,7 +109,7 @@ class eAUTable: public eAUGTable eMainloop *ml; /* needed to detect broken table version handling (seen on some m2ts files) */ - struct timespec m_prev_table_update; + struct timespec m_prev_table_update = {}; int m_table_cnt; void begin(eMainloop *m) diff --git a/lib/dvb/fbc.h b/lib/dvb/fbc.h index 1f5694921d2..0ea73cf1875 100644 --- a/lib/dvb/fbc.h +++ b/lib/dvb/fbc.h @@ -46,7 +46,7 @@ class eFBCTunerManager: public iObject, public sigc::trackable static void SetProcFBCID(int, int, bool); static int FESlotID(eDVBRegisteredFrontend *); static bool IsLinked(eDVBRegisteredFrontend *); - static bool isUnicable(eDVBRegisteredFrontend *fe); + static bool isUnicable(eDVBRegisteredFrontend *); static eDVBRegisteredFrontend* FrontendGetLinkPtr(eDVBFrontend *, link_ptr_t); static eDVBRegisteredFrontend* FrontendGetLinkPtr(eDVBRegisteredFrontend *, link_ptr_t); static void FrontendSetLinkPtr(eDVBRegisteredFrontend *, link_ptr_t, eDVBRegisteredFrontend *); @@ -57,7 +57,7 @@ class eFBCTunerManager: public iObject, public sigc::trackable static void UpdateLNBSlotMask(int, int, bool); bool IsSameFBCSet(int, int) const; bool IsRootFE(eDVBRegisteredFrontend *) const; - bool IsFEUsed(eDVBRegisteredFrontend *, bool) const; + bool IsFEUsed(eDVBRegisteredFrontend *, bool) const; int GetFBCID(int) const; int GetDefaultFBCID(int) const; diff --git a/lib/dvb/fcc.h b/lib/dvb/fcc.h index 051b4df2a28..a2012925abd 100644 --- a/lib/dvb/fcc.h +++ b/lib/dvb/fcc.h @@ -53,8 +53,7 @@ class eFCCServiceManager : public iObject, public sigc::trackable fcc_state_decoding, fcc_state_failed }; - SWIG_VOID(RESULT) - playFCCService(const eServiceReference &ref, ePtr &SWIG_OUTPUT); + SWIG_VOID(RESULT) playFCCService(const eServiceReference &ref, ePtr &SWIG_OUTPUT); RESULT stopFCCService(const eServiceReference &sref); RESULT stopFCCService(); RESULT cleanupFCCService(); diff --git a/lib/dvb/fccdecoder.cpp b/lib/dvb/fccdecoder.cpp index 68e9af2a408..f50c7cefeb7 100644 --- a/lib/dvb/fccdecoder.cpp +++ b/lib/dvb/fccdecoder.cpp @@ -14,7 +14,7 @@ eFCCDecoder::eFCCDecoder() eDebug("[eFCCDecoder] Scanning for FCC device files.."); while(1) { - struct stat s; + struct stat s = {}; char filename[128]; sprintf(filename, "/dev/fcc%d", index); if (stat(filename, &s)) diff --git a/lib/dvb/filepush.cpp b/lib/dvb/filepush.cpp index 65f666120cf..1bdc869502f 100644 --- a/lib/dvb/filepush.cpp +++ b/lib/dvb/filepush.cpp @@ -82,8 +82,8 @@ void eFilePushThread::thread() if (maxread && !m_sof) { #ifdef SHOW_WRITE_TIME - struct timeval starttime; - struct timeval now; + struct timeval starttime = {}; + struct timeval now = {}; gettimeofday(&starttime, NULL); #endif buf_end = m_source->read(m_current_position, m_buffer, maxread); @@ -124,7 +124,7 @@ void eFilePushThread::thread() /* on EOF, try COMMITting once. */ if (m_send_pvr_commit) { - struct pollfd pfd; + struct pollfd pfd = {}; pfd.fd = m_fd_dest; pfd.events = POLLIN; switch (poll(&pfd, 1, 250)) // wait for 250ms @@ -325,7 +325,7 @@ eFilePushThreadRecorder::eFilePushThreadRecorder(unsigned char *buffer, size_t b m_buffer(buffer), m_overflow_count(0), m_stop(1), - m_messagepump(eApp, 0) + m_messagepump(eApp, 0, "eFilePushThreadRecorder") { m_protocol = m_stream_id = m_session_id = m_packet_no = 0; CONNECT(m_messagepump.recv_msg, eFilePushThreadRecorder::recvEvent); @@ -357,7 +357,7 @@ static int errs; int64_t eFilePushThreadRecorder::getTick() { //ms - struct timespec ts; + struct timespec ts = {}; clock_gettime(CLOCK_MONOTONIC, &ts); return (ts.tv_nsec / 1000000) + (ts.tv_sec * 1000); } @@ -393,6 +393,7 @@ int eFilePushThreadRecorder::read_ts(int fd, unsigned char *buf, int size) return bytes; } + int eFilePushThreadRecorder::read_dmx(int fd, void *m_buffer, int size) { unsigned char *buf; @@ -481,7 +482,7 @@ void eFilePushThreadRecorder::thread() eDebug("[eFilePushThreadRecorder] THREAD START"); /* we set the signal to not restart syscalls, so we can detect our signal. */ - struct sigaction act; + struct sigaction act = {}; memset(&act, 0, sizeof(act)); act.sa_handler = signal_handler; // no, SIG_IGN doesn't do it. we want to receive the -EINTR act.sa_flags = 0; @@ -530,8 +531,8 @@ void eFilePushThreadRecorder::thread() } #ifdef SHOW_WRITE_TIME - struct timeval starttime; - struct timeval now; + struct timeval starttime = {}; + struct timeval now = {}; gettimeofday(&starttime, NULL); #endif int w = writeData(bytes); diff --git a/lib/dvb/filepush.h b/lib/dvb/filepush.h index 19ca064c72b..849fd905373 100644 --- a/lib/dvb/filepush.h +++ b/lib/dvb/filepush.h @@ -76,8 +76,8 @@ class eFilePushThreadRecorder: public eThread, public sigc::trackable sigc::signal1 m_event; int getProtocol() { return m_protocol;} - void setProtocol(int i){ m_protocol = i;} - void setSession(int se, int st) { m_session_id = se; m_stream_id = st;} + void setProtocol(int i){ m_protocol = i;} + void setSession(int se, int st) { m_session_id = se; m_stream_id = st;} int read_dmx(int fd, void *m_buffer, int size); int pushReply(void *buf, int len); void sendEvent(int evt); diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index 59767dbf372..3adff7ff27b 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -545,7 +545,6 @@ RESULT eDVBFrontendParameters::calcLockTimeout(unsigned int &timeout) const { /* high symbol rate transponders tune faster, due to requiring less zigzag and giving more symbols faster. - 5s are definitely not enough on really low SR when zigzag has to find the exact frequency first. */ @@ -737,9 +736,9 @@ int eDVBFrontend::openFrontend() { m_dvbversion = DVB_VERSION(3, 0); #if defined DTV_API_VERSION - struct dtv_property p; + struct dtv_property p = {}; memset(&p, 0, sizeof(p)); - struct dtv_properties cmdseq; + struct dtv_properties cmdseq = {}; cmdseq.props = &p; cmdseq.num = 1; p.cmd = DTV_API_VERSION; @@ -770,7 +769,7 @@ int eDVBFrontend::openFrontend() struct dtv_property p[1]; memset(p, 0, sizeof(p)); p[0].cmd = DTV_ENUM_DELSYS; - struct dtv_properties cmdseq; + struct dtv_properties cmdseq = {}; cmdseq.num = 1; cmdseq.props = p; ioctlMeasureStart; @@ -1039,7 +1038,7 @@ void eDVBFrontend::feEvent(int w) } while (1) { - dvb_frontend_event event; + dvb_frontend_event event = {}; int res; int state; res = ::ioctl(m_fd, FE_GET_EVENT, &event); @@ -1754,7 +1753,7 @@ int eDVBFrontend::readFrontendData(int type) #if DVB_API_VERSION > 5 || DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR >= 10 if (m_dvbversion >= DVB_VERSION(5, 10) && !eSimpleConfig::getBool(force_legacy_signal_stats, false)) { - dtv_property prop[1]; + dtv_property prop[1] = {}; memset(prop, 0, sizeof(prop)); prop[0].cmd = DTV_STAT_SIGNAL_STRENGTH; dtv_properties props; @@ -1809,9 +1808,9 @@ int eDVBFrontend::readFrontendData(int type) } case iFrontendInformation_ENUMS::frequency: { - struct dtv_property p; + struct dtv_property p = {}; memset(&p, 0, sizeof(p)); - struct dtv_properties cmdseq; + struct dtv_properties cmdseq = {}; oparm.getSystem(type); cmdseq.props = &p; cmdseq.num = 1; @@ -1838,9 +1837,9 @@ void eDVBFrontend::getFrontendStatus(ePtr &dest) void eDVBFrontend::getTransponderData(ePtr &dest, bool original) { int type = -1; - struct dtv_property p[18]; + struct dtv_property p[18] = {}; memset(p, 0, sizeof(p)); - struct dtv_properties cmdseq; + struct dtv_properties cmdseq = {}; oparm.getSystem(type); cmdseq.props = p; cmdseq.num = 0; @@ -1941,7 +1940,7 @@ int eDVBFrontend::readInputpower() if (m_simulate) return 0; int power=m_slotid; // this is needed for read inputpower from the correct tuner ! - char proc_name[64]; + char proc_name[64] = {}; sprintf(proc_name, "/proc/stb/frontend/%d/lnb_sense", m_slotid); if (CFile::parseInt(&power, proc_name) == 0) @@ -2390,7 +2389,7 @@ int eDVBFrontend::tuneLoopInt() // called by m_tuneTimer { if (!m_simulate) { - char proc_name[64]; + char proc_name[64] = {}; sprintf(proc_name, "/proc/stb/frontend/%d/static_current_limiting", sec_fe->m_dvbid); CFile f(proc_name, "w"); if (f) // new interface exist? @@ -2403,7 +2402,7 @@ int eDVBFrontend::tuneLoopInt() // called by m_tuneTimer } else if (sec_fe->m_need_rotor_workaround) { - char dev[32]; + char dev[32] = {}; int slotid = sec_fe->m_slotid; // FIXMEEEEEE hardcoded i2c devices for dm8000 if (slotid < 2) @@ -2603,9 +2602,9 @@ void eDVBFrontend::setFrontend(bool recvEvents) if (recvEvents) m_sn->start(); feEvent(-1); // flush events - struct dtv_property p[18]; + struct dtv_property p[18] = {}; memset(p, 0, sizeof(p)); - struct dtv_properties cmdseq; + struct dtv_properties cmdseq = {}; cmdseq.props = p; cmdseq.num = 0; p[cmdseq.num].cmd = DTV_CLEAR, cmdseq.num++; @@ -3733,7 +3732,7 @@ bool eDVBFrontend::changeType(int type) char mode[4]; struct dtv_property p[2]; memset(p, 0, sizeof(p)); - struct dtv_properties cmdseq; + struct dtv_properties cmdseq = {}; cmdseq.props = p; cmdseq.num = 2; p[0].cmd = DTV_CLEAR; @@ -3870,7 +3869,7 @@ bool eDVBFrontend::setDeliverySystem(fe_delivery_system_t delsys) eTrace("[eDVBFrontend] frontend %d setDeliverySystem %d", m_slotid, delsys); struct dtv_property p[2]; memset(p, 0, sizeof(p)); - struct dtv_properties cmdseq; + struct dtv_properties cmdseq = {}; cmdseq.props = p; cmdseq.num = 2; p[0].cmd = DTV_CLEAR; diff --git a/lib/dvb/metaparser.cpp b/lib/dvb/metaparser.cpp index 68891ef4cc3..47f124e59b5 100644 --- a/lib/dvb/metaparser.cpp +++ b/lib/dvb/metaparser.cpp @@ -17,7 +17,7 @@ eDVBMetaParser::eDVBMetaParser() static int getctime(const std::string &basename) { - struct stat s; + struct stat s = {}; if (::stat(basename.c_str(), &s) == 0) { return s.st_ctime; @@ -30,7 +30,7 @@ static long long fileSize(const std::string &basename) long long filesize = 0; char buf[8]; std::string splitname; - struct stat64 s; + struct stat64 s = {}; /* get filesize */ if (!stat64(basename.c_str(), &s)) diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp index a741627f0e0..8c02a4373ea 100644 --- a/lib/dvb/pmt.cpp +++ b/lib/dvb/pmt.cpp @@ -449,7 +449,7 @@ void eDVBServicePMTHandler::AITready(int error) if(!hbbtvUrl.empty()) { const char* uu = hbbtvUrl.c_str(); - struct aitInfo aitinfo; + struct aitInfo aitinfo = {}; aitinfo.id = appid; aitinfo.name = applicationName; aitinfo.url = hbbtvUrl; diff --git a/lib/dvb/rtspstreamserver.cpp b/lib/dvb/rtspstreamserver.cpp index 2e10a08ac46..cfa97356d7e 100644 --- a/lib/dvb/rtspstreamserver.cpp +++ b/lib/dvb/rtspstreamserver.cpp @@ -828,7 +828,7 @@ void eRTSPStreamClient::http_response(int sock, int rc, const std::string &ah, c } else { - struct timespec tv, rem; + struct timespec tv = {}, rem = {}; tv.tv_sec = 0; tv.tv_nsec = 5000000; int times = 20; diff --git a/lib/dvb/streamserver.cpp b/lib/dvb/streamserver.cpp index 69a1ea07a38..cf617f8b793 100644 --- a/lib/dvb/streamserver.cpp +++ b/lib/dvb/streamserver.cpp @@ -101,7 +101,7 @@ void eStreamClient::notifier(int what) char *buffer = (char*)malloc(4096); if (buffer) { - struct passwd pwd; + struct passwd pwd = {}; struct passwd *pwdresult = NULL; std::string crypt; username = authentication.substr(0, pos); @@ -109,13 +109,13 @@ void eStreamClient::notifier(int what) getpwnam_r(username.c_str(), &pwd, buffer, 4096, &pwdresult); if (pwdresult) { - struct crypt_data cryptdata; + struct crypt_data cryptdata = {}; char *cryptresult = NULL; cryptdata.initialized = 0; crypt = pwd.pw_passwd; if (crypt == "*" || crypt == "x") { - struct spwd spwd; + struct spwd spwd = {}; struct spwd *spwdresult = NULL; getspnam_r(username.c_str(), &spwd, buffer, 4096, &spwdresult); if (spwdresult) @@ -460,8 +460,6 @@ PyObject *eStreamServer::getConnectedClientDetails(int index) } - - PyObject *eStreamServer::getConnectedClients() { ePyObject ret; @@ -471,8 +469,8 @@ PyObject *eStreamServer::getConnectedClients() for (eSmartPtrList::iterator it = clients.begin(); it != clients.end(); ++it) { ePyObject tuple = PyTuple_New(3); - PyTuple_SET_ITEM(tuple, 0, PyString_FromString((char *)it->getRemoteHost().c_str())); - PyTuple_SET_ITEM(tuple, 1, PyString_FromString((char *)it->getServiceref().c_str())); + PyTuple_SET_ITEM(tuple, 0, PyUnicode_FromString((char *)it->getRemoteHost().c_str())); + PyTuple_SET_ITEM(tuple, 1, PyUnicode_FromString((char *)it->getServiceref().c_str())); PyTuple_SET_ITEM(tuple, 2, PyLong_FromLong(it->isUsingEncoder())); PyList_SET_ITEM(ret, idx++, tuple); } diff --git a/lib/dvb_ci/descrambler.cpp b/lib/dvb_ci/descrambler.cpp index f7fea6ccfc7..d97edfa2f9a 100644 --- a/lib/dvb_ci/descrambler.cpp +++ b/lib/dvb_ci/descrambler.cpp @@ -135,7 +135,7 @@ int descrambler_set_key(int& desc_fd, eDVBCISlot *slot, int parity, unsigned cha int descrambler_set_pid(int desc_fd, int index, int enable, int pid) { - struct ca_pid p; + struct ca_pid p = {}; unsigned int flags = 0x80; if (desc_fd < 0) diff --git a/lib/dvb_ci/dvbci_ccmgr.cpp b/lib/dvb_ci/dvbci_ccmgr.cpp index 7b9f4229a48..df9a9848dca 100644 --- a/lib/dvb_ci/dvbci_ccmgr.cpp +++ b/lib/dvb_ci/dvbci_ccmgr.cpp @@ -846,7 +846,7 @@ int eDVBCICcSession::generate_SAK_SEK() bool eDVBCICcSession::sac_check_auth(const uint8_t *data, unsigned int len) { - struct aes_xcbc_mac_ctx ctx; + struct aes_xcbc_mac_ctx ctx = {}; uint8_t calced_signature[16]; if (len < 16) @@ -873,7 +873,7 @@ bool eDVBCICcSession::sac_check_auth(const uint8_t *data, unsigned int len) int eDVBCICcSession::sac_gen_auth(uint8_t *out, uint8_t *in, unsigned int len) { - struct aes_xcbc_mac_ctx ctx; + struct aes_xcbc_mac_ctx ctx = {}; aes_xcbc_mac_init(&ctx, m_sak); aes_xcbc_mac_process(&ctx, (uint8_t *)"\x04", 1); /* header len */ diff --git a/lib/dvb_ci/dvbci_ccmgr_helper.cpp b/lib/dvb_ci/dvbci_ccmgr_helper.cpp index 369e6d75747..c49512b4d7b 100644 --- a/lib/dvb_ci/dvbci_ccmgr_helper.cpp +++ b/lib/dvb_ci/dvbci_ccmgr_helper.cpp @@ -341,7 +341,7 @@ int verify_cb(int ok, X509_STORE_CTX *ctx) if (X509_STORE_CTX_get_error(ctx) == X509_V_ERR_CERT_NOT_YET_VALID) { time_t now = time(NULL); - struct tm t; + struct tm t = {}; localtime_r(&now, &t); if (t.tm_year < 2024) { diff --git a/lib/gdi/epng.cpp b/lib/gdi/epng.cpp index 3586b67b2f5..f2d8a98597c 100644 --- a/lib/gdi/epng.cpp +++ b/lib/gdi/epng.cpp @@ -221,8 +221,8 @@ int loadJPG(ePtr &result, const char *filename, ePtr alpha, in if (cached && (result = PixmapCache::Get(filename))) return 0; - struct jpeg_decompress_struct cinfo; - struct my_error_mgr jerr; + struct jpeg_decompress_struct cinfo = {}; + struct my_error_mgr jerr = {}; JSAMPARRAY buffer; int row_stride; CFile infile(filename, "rb"); diff --git a/lib/gdi/fb.cpp b/lib/gdi/fb.cpp index a17acae1003..d40c8f74aa2 100644 --- a/lib/gdi/fb.cpp +++ b/lib/gdi/fb.cpp @@ -81,10 +81,10 @@ fbClass::fbClass(const char *fb) ion = open("/dev/ion", O_RDWR | O_CLOEXEC); if (ion >= 0) { - struct ion_allocation_data alloc_data; - struct ion_fd_data share_data; - struct ion_handle_data free_data; - struct ion_phys_data phys_data; + struct ion_allocation_data alloc_data = {}; + struct ion_fd_data share_data = {}; + struct ion_handle_data free_data = {}; + struct ion_phys_data phys_data = {}; int ret; unsigned char *lion; diff --git a/lib/gdi/picload.cpp b/lib/gdi/picload.cpp index cffc1068d40..6097b72bfec 100644 --- a/lib/gdi/picload.cpp +++ b/lib/gdi/picload.cpp @@ -24,7 +24,7 @@ DEFINE_REF(ePicLoad); static std::string getSize(const char* file) { - struct stat64 s; + struct stat64 s = {}; if (stat64(file, &s) < 0) return ""; char tmp[21]; @@ -570,9 +570,9 @@ void jpeg_cb_error_exit(j_common_ptr cinfo) static unsigned char *jpeg_load(const char *file, int *ox, int *oy, unsigned int max_x, unsigned int max_y) { - struct jpeg_decompress_struct cinfo; + struct jpeg_decompress_struct cinfo = {}; struct jpeg_decompress_struct *ciptr = &cinfo; - struct r_jpeg_error_mgr emgr; + struct r_jpeg_error_mgr emgr = {}; unsigned char *pic_buffer=NULL; CFile fh(file, "rb"); @@ -630,8 +630,8 @@ static unsigned char *jpeg_load(const char *file, int *ox, int *oy, unsigned int static int jpeg_save(const char * filename, int ox, int oy, unsigned char *pic_buffer) { - struct jpeg_compress_struct cinfo; - struct jpeg_error_mgr jerr; + struct jpeg_compress_struct cinfo = {}; + struct jpeg_error_mgr jerr = {}; JSAMPROW row_pointer[1]; int row_stride; CFile outfile(filename, "wb"); diff --git a/lib/gdi/pixmapcache.cpp b/lib/gdi/pixmapcache.cpp index 1e07fee7ed9..151a35411e1 100644 --- a/lib/gdi/pixmapcache.cpp +++ b/lib/gdi/pixmapcache.cpp @@ -85,7 +85,7 @@ gPixmap* PixmapCache::Get(const char *filename) { // find out whether the image has been modified // if so, it'll need to be reloaded from disk - struct stat img_stat; + struct stat img_stat = {}; if (stat(filename, &img_stat) == 0 && img_stat.st_mtime == it->second.modifiedDate && img_stat.st_size == it->second.filesize) { // file still exists and hasn't been modified @@ -114,7 +114,7 @@ void PixmapCache::Set(const char *filename, gPixmap* pixmap) gPixmap* disposePixmap = NULL; { eSingleLocker lock(pixmapCacheLock); - struct stat img_stat; + struct stat img_stat = {}; if (stat(filename, &img_stat) == 0) { NameToPixmap::iterator it = pixmapCache.find(filename); diff --git a/lib/timeshift/createapscfiles.cc b/lib/timeshift/createapscfiles.cc index 049d2349cef..02cbba6afa3 100644 --- a/lib/timeshift/createapscfiles.cc +++ b/lib/timeshift/createapscfiles.cc @@ -206,7 +206,7 @@ int do_movie(char* inname) { int f_ts=-1, f_sc=-1, f_ap=-1, f_tmp=-1; unsigned long long filesize; - struct stat fp; + struct stat fp = {}; const char *innameext = getext(inname); diff --git a/main/bsod.cpp b/main/bsod.cpp index fb06866236b..50af934200e 100644 --- a/main/bsod.cpp +++ b/main/bsod.cpp @@ -155,7 +155,7 @@ void bsodFatal(const char *component) char dated[22]; time_t now_time = time(0); - struct tm loctime; + struct tm loctime = {}; localtime_r(&now_time, &loctime); strftime (dated, 21, "%Y%m%d-%H%M%S", &loctime); @@ -186,7 +186,7 @@ void bsodFatal(const char *component) if (f) { time_t t = time(0); - struct tm tm; + struct tm tm = {}; char tm_str[32]; localtime_r(&t, &tm); @@ -430,7 +430,7 @@ void handleFatalSignal(int signum, siginfo_t *si, void *ctx) void bsodCatchSignals() { - struct sigaction act; + struct sigaction act = {}; act.sa_sigaction = handleFatalSignal; act.sa_flags = SA_RESTART | SA_SIGINFO; if (sigemptyset(&act.sa_mask) == -1) diff --git a/main/enigma.cpp b/main/enigma.cpp index ab8c2f05a32..d3b9a1245a3 100644 --- a/main/enigma.cpp +++ b/main/enigma.cpp @@ -253,7 +253,7 @@ static void sigterm_handler(int num) void catchTermSignal() { - struct sigaction act; + struct sigaction act = {}; act.sa_handler = sigterm_handler; act.sa_flags = SA_RESTART; @@ -360,7 +360,7 @@ int main(int argc, char **argv) snprintf(filename, sizeof(filename), "%s/wait%d.png", userpath.c_str(), i + 1); rfilename = eEnv::resolve(filename); - struct stat st; + struct stat st = {}; if (::stat(rfilename.c_str(), &st) == 0) { def = true; diff --git a/tools/convert_argb_png.c b/tools/convert_argb_png.c index 9c2c0e503c5..8985b957728 100644 --- a/tools/convert_argb_png.c +++ b/tools/convert_argb_png.c @@ -99,8 +99,8 @@ int main(int argc, char **argv) fclose(fpin); /* now write jpeg */ - struct jpeg_compress_struct cinfo; - struct jpeg_error_mgr jerr; + struct jpeg_compress_struct cinfo = {}; + struct jpeg_error_mgr jerr = {}; JSAMPROW jrow_pointer[1]; FILE *outfp;