From 45ecb6f86d852008f2a9ba29fc619af596c5f5f4 Mon Sep 17 00:00:00 2001 From: Daniel Thor Kristjansson Date: Wed, 12 Dec 2012 09:23:29 -0500 Subject: [PATCH] Convert gcc struct initializers in dvbci.cpp to C++ code (clang++) Note: The tTime struct also looks to be both endian unsafe and is used in a reinterpreting cast unsafely a couple lines later. --- .../libs/libmythtv/recorders/dvbdev/dvbci.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/mythtv/libs/libmythtv/recorders/dvbdev/dvbci.cpp b/mythtv/libs/libmythtv/recorders/dvbdev/dvbci.cpp index 6a0c890f88b..6cc320dcc00 100644 --- a/mythtv/libs/libmythtv/recorders/dvbdev/dvbci.cpp +++ b/mythtv/libs/libmythtv/recorders/dvbdev/dvbci.cpp @@ -1102,13 +1102,13 @@ bool cCiDateTime::SendDateTime(void) int MJD = 14956 + D + int((Y - L) * 365.25) + int((M + 1 + L * 12) * 30.6001); #define DEC2BCD(d) (uint8_t(((d / 10) << 4) + (d % 10))) struct tTime { unsigned short mjd; uint8_t h, m, s; short offset; }; - tTime T = { - mjd : htons(MJD), - h : DEC2BCD(tm_gmt.tm_hour), - m : DEC2BCD(tm_gmt.tm_min), - s : DEC2BCD(tm_gmt.tm_sec), - offset : static_cast(htons(tm_loc.tm_gmtoff / 60)) - }; + tTime T; + T.mjd = htons(MJD); + T.h = DEC2BCD(tm_gmt.tm_hour); + T.m = DEC2BCD(tm_gmt.tm_min); + T.s = DEC2BCD(tm_gmt.tm_sec); + T.offset = static_cast(htons(tm_loc.tm_gmtoff / 60)); + dbgprotocol("%d: ==> Date Time\n", SessionId()); SendData(AOT_DATE_TIME, 7, (uint8_t*)&T); //XXX return value of all SendData() calls??? @@ -1245,7 +1245,9 @@ bool cCiMMI::Process(int Length, const uint8_t *Data) case DCC_SET_MMI_MODE: if (l == 2 && *++d == MM_HIGH_LEVEL) { struct tDisplayReply { uint8_t id; uint8_t mode; }; - tDisplayReply dr = { id : DRI_MMI_MODE_ACK, mode : MM_HIGH_LEVEL }; + tDisplayReply dr; + dr.id = DRI_MMI_MODE_ACK; + dr.mode = MM_HIGH_LEVEL; dbgprotocol("%d: ==> Display Reply\n", SessionId()); SendData(AOT_DISPLAY_REPLY, 2, (uint8_t *)&dr); }