Skip to content

Commit

Permalink
Convert to std::array and std::string. (libmythtv/mpeg 5)
Browse files Browse the repository at this point in the history
Convert dvb date routines from C arrays to C+++ arrays.
  • Loading branch information
linuxdude42 committed Aug 28, 2020
1 parent c9f78fa commit 2ae8807
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/mpeg/dishdescriptors.cpp
Expand Up @@ -140,7 +140,7 @@ QString DishEventTagsDescriptor::seriesid(void) const

QDate DishEventTagsDescriptor::originalairdate(void) const
{
unsigned char mjd[5];
std::array<uint8_t,5> mjd {};

if (DescriptorLength() != 8)
return {};
Expand Down
9 changes: 9 additions & 0 deletions mythtv/libs/libmythtv/mpeg/dvbtables.h
Expand Up @@ -14,6 +14,15 @@ MTV_PUBLIC QDateTime dvbdate2qt(const unsigned char *buf);
MTV_PUBLIC time_t dvbdate2unix(const unsigned char *buf);
uint32_t dvbdate2key(const unsigned char *buf);

static inline QDateTime dvbdate2qt(const std::array<uint8_t,5> buf)
{
return dvbdate2qt(buf.data());
}
static inline time_t dvbdate2unix(const std::array<uint8_t,5> buf)
{
return dvbdate2unix(buf.data());
}

/** \class NetworkInformationTable
* \brief This table tells the decoder on which PIDs to find other tables.
* \todo This is just a stub.
Expand Down
Expand Up @@ -125,7 +125,7 @@ void TestMPEGTables::pat_test(void)

void TestMPEGTables::dvbdate(void)
{
unsigned char dvbdate_data[] = {
const std::array<uint8_t,5> dvbdate_data {
0xdc, 0xa9, 0x12, 0x33, 0x37 /* day 0xdca9, 12:33:37 UTC */
};

Expand Down

0 comments on commit 2ae8807

Please sign in to comment.