Skip to content

Commit

Permalink
Tidy: Replace "typedef" with "using" in header files.
Browse files Browse the repository at this point in the history
The clang-tidy modernize "use using" checker pointed out a number of
places where the older style of "typedef a b;" should be replaced with
the modern construct of "using b = a;", but it didn't point out many
instances in header files, only in cpp files.  Make these replacements
by hand in header files.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-using.html
  • Loading branch information
linuxdude42 committed Nov 29, 2019
1 parent 1df26a1 commit 0f384b1
Show file tree
Hide file tree
Showing 181 changed files with 364 additions and 367 deletions.
2 changes: 1 addition & 1 deletion mythplugins/mytharchive/mytharchive/videoselector.cpp
Expand Up @@ -381,7 +381,7 @@ void VideoSelector::updateVideoList(void)
vector<VideoInfo *> *VideoSelector::getVideoListFromDB(void)
{
// get a list of category's
typedef QMap<int, QString> CategoryMap;
using CategoryMap = QMap<int, QString>;
CategoryMap categoryMap;
MSqlQuery query(MSqlQuery::InitCon());
query.prepare("SELECT intid, category FROM videocategory");
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythgame/mythgame/gamehandler.h
Expand Up @@ -49,7 +49,7 @@ class GameScan

Q_DECLARE_METATYPE(GameScan)

typedef QMap<QString, GameScan> GameScanMap;
using GameScanMap = QMap<QString, GameScan>;

class MythUIProgressDialog;
class GameHandler : public QObject
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythgame/mythgame/gamescan.h
Expand Up @@ -26,7 +26,7 @@ struct RomFileInfo
bool indb;
};

typedef QList< RomFileInfo > RomFileInfoList;
using RomFileInfoList = QList< RomFileInfo >;

class GameScannerThread : public MThread
{
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythgame/mythgame/rom_metadata.h
Expand Up @@ -42,7 +42,7 @@ class RomData
QString m_version;
};

typedef QMap <QString, RomData> RomDBMap;
using RomDBMap = QMap <QString, RomData>;

QString crcStr(int crc);

Expand Down
10 changes: 5 additions & 5 deletions mythplugins/mythmusic/mythmusic/cddb.h
Expand Up @@ -10,7 +10,7 @@
*/
struct Cddb
{
typedef unsigned long discid_t;
using discid_t = unsigned long;
struct Album;

// A CDDB query match
Expand Down Expand Up @@ -38,7 +38,7 @@ struct Cddb
{
discid_t discID; // discID of query
bool isExact;
typedef QVector< Match > match_t;
using match_t = QVector< Match >;
match_t matches;

Matches() : discID(0), isExact(false) {}
Expand All @@ -49,7 +49,7 @@ struct Cddb
int min, sec, frame;
Msf(int m = 0, int s = 0, int f = 0) : min(m), sec(s), frame(f) {}
};
typedef QVector< Msf > Toc;
using Toc = QVector< Msf >;

struct Track
{
Expand All @@ -69,10 +69,10 @@ struct Cddb
QString submitter;
int rev;
bool isCompilation;
typedef QVector< Track > track_t;
using track_t = QVector< Track >;
track_t tracks;
QString extd;
typedef QVector< QString > ext_t;
using ext_t = QVector< QString >;
ext_t ext;
Toc toc;

Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythmusic/mythmusic/playlist.h
Expand Up @@ -37,7 +37,7 @@ struct PlaylistOptions
PlayPLOption playPLOption;
};

typedef QList<MusicMetadata::IdType> SongList;
using SongList = QList<MusicMetadata::IdType>;

class Playlist : public QObject
{
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythnetvision/mythnetvision/nettree.cpp
Expand Up @@ -175,7 +175,7 @@ void NetTree::LoadData(void)

MythGenericTree *selectedNode = m_currentNode->getSelectedChild();

typedef QList<MythGenericTree *> MGTreeChildList;
using MGTreeChildList = QList<MythGenericTree *>;
MGTreeChildList *lchildren = m_currentNode->getAllChildren();

for (MGTreeChildList::const_iterator p = lchildren->begin();
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythnews/mythnews/newsarticle.h
Expand Up @@ -11,7 +11,7 @@ using namespace std;
class NewsArticle
{
public:
typedef vector<NewsArticle> List;
using List = vector<NewsArticle>;

NewsArticle(QString title, QString desc, QString articleURL,
QString thumbnail, QString mediaURL, QString enclosure);
Expand Down
4 changes: 2 additions & 2 deletions mythplugins/mythnews/mythnews/newssite.h
Expand Up @@ -25,7 +25,7 @@ using namespace std;
class NewsSiteItem
{
public:
typedef vector<NewsSiteItem> List;
using List = vector<NewsSiteItem>;

QString m_name;
QString m_category;
Expand All @@ -39,7 +39,7 @@ Q_DECLARE_METATYPE(NewsSiteItem*)
class NewsCategory
{
public:
typedef vector<NewsCategory> List;
using List = vector<NewsCategory>;

QString m_name;
NewsSiteItem::List m_siteList;
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythweather/mythweather/sourceManager.h
Expand Up @@ -13,7 +13,7 @@

class WeatherScreen;
class ScriptInfo;
typedef QMultiMap<long, const WeatherSource*> SourceMap;
using SourceMap = QMultiMap<long, const WeatherSource*>;

class SourceManager : public QObject
{
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythweather/mythweather/weather.h
Expand Up @@ -15,7 +15,7 @@
class SourceManager;
class WeatherScreen;

typedef QList<WeatherScreen*> ScreenList;
using ScreenList = QList<WeatherScreen*>;

class Weather : public MythScreenType
{
Expand Down
2 changes: 1 addition & 1 deletion mythplugins/mythweather/mythweather/weatherSetup.h
Expand Up @@ -130,7 +130,7 @@ struct ResultListInfo

Q_DECLARE_METATYPE(ResultListInfo *)

typedef QMultiHash<QString, QList<ScriptInfo*> > CacheMap;
using CacheMap = QMultiHash<QString, QList<ScriptInfo*> >;

class LocationDialog : public MythScreenType
{
Expand Down
8 changes: 4 additions & 4 deletions mythplugins/mythweather/mythweather/weatherUtils.h
Expand Up @@ -19,8 +19,8 @@

class ScriptInfo;

typedef unsigned char units_t;
typedef QMap<QString, QString> DataMap;
using units_t = unsigned char;
using DataMap = QMap<QString, QString>;

class TypeListInfo
{
Expand All @@ -41,7 +41,7 @@ class TypeListInfo
QString m_location;
ScriptInfo *m_src {nullptr};
};
typedef QMultiHash<QString, TypeListInfo> TypeListMap;
using TypeListMap = QMultiHash<QString, TypeListInfo>;

class ScreenListInfo
{
Expand Down Expand Up @@ -76,7 +76,7 @@ class ScreenListInfo

Q_DECLARE_METATYPE(ScreenListInfo *);

typedef QMap<QString, ScreenListInfo> ScreenListMap;
using ScreenListMap = QMap<QString, ScreenListInfo>;

ScreenListMap loadScreens();
QStringList loadScreen(const QDomElement& ScreenListInfo);
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/audio/audiooutput.h
Expand Up @@ -42,7 +42,7 @@ class MPUBLIC AudioOutput : public VolumeBase, public OutputListeners
AudioDeviceConfig &operator= (AudioDeviceConfig &&) = default;
};

typedef QVector<AudioDeviceConfig> ADCVect;
using ADCVect = QVector<AudioDeviceConfig>;

static void Cleanup(void);
static ADCVect* GetOutputList(void);
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmyth/audio/audiooutputdigitalencoder.h
Expand Up @@ -13,8 +13,8 @@ extern "C" {

class AudioOutputDigitalEncoder
{
typedef int16_t inbuf_t;
typedef int16_t outbuf_t;
using inbuf_t = int16_t;
using outbuf_t = int16_t;

public:
AudioOutputDigitalEncoder(void);
Expand Down
5 changes: 3 additions & 2 deletions mythtv/libs/libmyth/audio/audiooutputdx.cpp
Expand Up @@ -30,7 +30,7 @@ DEFINE_GUID(IID_IDirectSoundNotify, 0xb0210783, 0x89cd, 0x11d0,
#endif

#ifndef _WAVEFORMATEXTENSIBLE_
typedef struct {
struct WAVEFORMATEXTENSIBLE {
WAVEFORMATEX Format;
union {
WORD wValidBitsPerSample; // bits of precision
Expand All @@ -39,7 +39,8 @@ typedef struct {
} Samples;
DWORD dwChannelMask; // which channels are present in stream
GUID SubFormat;
} WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE;
};
using PWAVEFORMATEXTENSIBLE = WAVEFORMATEXTENSIBLE*;
#endif

DEFINE_GUID(_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, WAVE_FORMAT_IEEE_FLOAT,
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/audio/audiooutputopensles.h
Expand Up @@ -10,7 +10,7 @@
// MythTV headers
#include "audiooutputbase.h"

typedef SLresult (*slCreateEngine_t)(
using slCreateEngine_t = SLresult (*)(
SLObjectItf*, SLuint32, const SLEngineOption*, SLuint32,
const SLInterfaceID*, const SLboolean*);

Expand Down
5 changes: 3 additions & 2 deletions mythtv/libs/libmyth/audio/audiooutputwin.cpp
Expand Up @@ -24,7 +24,7 @@ using namespace std;
#endif

#ifndef _WAVEFORMATEXTENSIBLE_
typedef struct {
struct WAVEFORMATEXTENSIBLE {
WAVEFORMATEX Format;
union {
WORD wValidBitsPerSample; // bits of precision
Expand All @@ -33,7 +33,8 @@ typedef struct {
} Samples;
DWORD dwChannelMask; // which channels are present in stream
GUID SubFormat;
} WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE;
};
using PWAVEFORMATEXTENSIBLE = WAVEFORMATEXTENSIBLE*;
#endif

const uint AudioOutputWin::kPacketCnt = 4;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/backendselect.h
Expand Up @@ -25,7 +25,7 @@ const QString kDefaultMFE = "UPnP/MythFrontend/DefaultBackend/";
const QString kDefaultPIN = kDefaultMFE + "SecurityPin";
const QString kDefaultUSN = kDefaultMFE + "USN";

typedef QMap <QString, DeviceLocation*> ItemMap;
using ItemMap = QMap <QString, DeviceLocation*>;

/**
* \class BackendSelection
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/mythrssmanager.h
Expand Up @@ -48,7 +48,7 @@ class MPUBLIC RSSSite : public QObject

~RSSSite() = default;

typedef QList<RSSSite *> rssList;
using rssList = QList<RSSSite *>;

const QString& GetTitle() const { return m_title; }
const QString& GetSortTitle() const { return m_sortTitle; }
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/netgrabbermanager.h
Expand Up @@ -43,7 +43,7 @@ class MPUBLIC GrabberScript : public QObject, public MThread

void run(void) override; // MThread

typedef QList<GrabberScript *> scriptList;
using scriptList = QList<GrabberScript *>;

signals:

Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/output.h
Expand Up @@ -90,7 +90,7 @@ class MPUBLIC OutputEvent : public MythEvent
int m_chan {0};
};

typedef std::vector<MythTV::Visual*> Visuals;
using Visuals = std::vector<MythTV::Visual*>;

class MPUBLIC OutputListeners : public MythObservable
{
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmyth/programinfo.h
Expand Up @@ -27,7 +27,7 @@
#define NUMPROGRAMLINES 52

class ProgramInfo;
typedef AutoDeleteDeque<ProgramInfo*> ProgramList;
using ProgramList = AutoDeleteDeque<ProgramInfo*>;

/** \class ProgramInfo
* \brief Holds information on recordings and videos.
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmyth/programtypes.h
Expand Up @@ -43,7 +43,7 @@ MPUBLIC extern const char *kJobQueueInUseID;
MPUBLIC extern const char *kCCExtractorInUseID;

/// Frame # -> File offset map
typedef QMap<long long, long long> frm_pos_map_t;
using frm_pos_map_t = QMap<long long, long long>;

enum MarkTypes {
MARK_ALL = -100,
Expand Down Expand Up @@ -78,7 +78,7 @@ enum MarkTypes {
MPUBLIC QString toString(MarkTypes type);

/// Frame # -> Mark map
typedef QMap<uint64_t, MarkTypes> frm_dir_map_t;
using frm_dir_map_t = QMap<uint64_t, MarkTypes>;

enum CommFlagStatus {
COMM_FLAG_NOT_FLAGGED = 0,
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmyth/rssparse.h
Expand Up @@ -111,8 +111,8 @@ class MPUBLIC ResultItem

public:

typedef QList<ResultItem *> resultList;
typedef std::vector<ResultItem> List;
using resultList = QList<ResultItem *>;
using List = std::vector<ResultItem>;

ResultItem(const QString& title, const QString& sortTitle,
const QString& subtitle, const QString& sortSubtitle,
Expand Down
10 changes: 5 additions & 5 deletions mythtv/libs/libmythbase/autodeletedeque.h
Expand Up @@ -11,11 +11,11 @@ class AutoDeleteDeque
explicit AutoDeleteDeque(bool auto_delete = true) : m_autodelete(auto_delete) {}
~AutoDeleteDeque() { clear(); }

typedef typename std::deque< T > List;
typedef typename List::iterator iterator;
typedef typename List::const_iterator const_iterator;
typedef typename List::reverse_iterator reverse_iterator;
typedef typename List::const_reverse_iterator const_reverse_iterator;
using List = typename std::deque< T >;
using iterator = typename List::iterator;
using const_iterator = typename List::const_iterator;
using reverse_iterator = typename List::reverse_iterator;
using const_reverse_iterator = typename List::const_reverse_iterator;

T operator[](uint index)
{
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/cleanupguard.h
Expand Up @@ -6,7 +6,7 @@
class MBASE_PUBLIC CleanupGuard
{
public:
typedef void (*CleanupFunc)();
using CleanupFunc = void (*)();

public:
explicit CleanupGuard(CleanupFunc cleanFunction);
Expand Down
14 changes: 7 additions & 7 deletions mythtv/libs/libmythbase/compat.h
Expand Up @@ -73,9 +73,9 @@
#define snprintf _snprintf

#ifdef _WIN64
typedef __int64 ssize_t;
using ssize_t = __int64;
#else
typedef int ssize_t;
using ssize_t = int;
#endif

// Check for execute, only checking existance in MSVC
Expand Down Expand Up @@ -120,7 +120,7 @@
# endif
#endif

typedef uint32_t mode_t;
using mode_t = uint32_t;

#if !defined(__cplusplus) && !defined( inline )
# define inline __inline
Expand All @@ -137,7 +137,7 @@
//used in videodevice only - that code is not windows-compatible anyway
# define minor(X) 0

typedef unsigned int uint;
using uint = unsigned int;
#endif

#if defined(__cplusplus) && defined(_WIN32)
Expand Down Expand Up @@ -328,7 +328,7 @@ static __inline struct tm *localtime_r(const time_t *timep, struct tm *result)
# define WEXITSTATUS(w) (((w) >> 8) & 0xff)
# define WTERMSIG(w) ((w) & 0x7f)

typedef long suseconds_t;
using suseconds_t = long;

#endif // _WIN32

Expand All @@ -337,13 +337,13 @@ static __inline struct tm *localtime_r(const time_t *timep, struct tm *result)
#include "mythconfig.h"

#if CONFIG_DARWIN && ! defined (_SUSECONDS_T)
typedef int32_t suseconds_t; // 10.3 or earlier don't have this
using suseconds_t = int32_t; // 10.3 or earlier don't have this
#endif

// Libdvdnav now uses off64_t lseek64(), which BSD/Darwin doesn't have.
// Luckily, its lseek() is already 64bit compatible
#ifdef BSD
typedef off_t off64_t;
typedef off_t off64_t; //NOLINT(modernize-use-using)included from C code
#define lseek64(f,o,w) lseek(f,o,w)
#endif

Expand Down

0 comments on commit 0f384b1

Please sign in to comment.