From 653c2fe9e173e2661c1bd4a6e20c37b6e35d0e16 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 16 Sep 2023 00:06:14 -0700 Subject: [PATCH] clang-tidy: use using instead of typedef (#1120) Signed-off-by: Rosen Penev --- taglib/ape/apetag.h | 3 +-- taglib/asf/asftag.h | 4 ++-- taglib/flac/flacpicture.h | 2 +- taglib/mp4/mp4atom.h | 4 ++-- taglib/mp4/mp4coverart.h | 2 +- taglib/mp4/mp4tag.h | 2 +- taglib/mpeg/id3v1/id3v1genres.h | 2 +- .../mpeg/id3v2/frames/eventtimingcodesframe.h | 2 +- .../id3v2/frames/synchronizedlyricsframe.h | 2 +- .../id3v2/frames/textidentificationframe.h | 2 +- taglib/mpeg/id3v2/id3v2tag.h | 4 ++-- taglib/ogg/vorbis/vorbisfile.h | 6 +++++- taglib/ogg/vorbis/vorbisproperties.h | 6 +++++- taglib/ogg/xiphcomment.h | 2 +- taglib/riff/wav/infotag.h | 2 +- taglib/toolkit/taglib.h | 18 +++++++++--------- taglib/toolkit/tbytevector.h | 8 ++++---- taglib/toolkit/tfilestream.cpp | 6 +++--- taglib/toolkit/tiostream.h | 2 +- taglib/toolkit/tlist.h | 4 ++-- taglib/toolkit/tmap.h | 8 ++++---- taglib/toolkit/tpropertymap.h | 7 +++---- taglib/toolkit/tstring.h | 4 ++-- 23 files changed, 54 insertions(+), 48 deletions(-) diff --git a/taglib/ape/apetag.h b/taglib/ape/apetag.h index 6bf019f0..d6bf8579 100644 --- a/taglib/ape/apetag.h +++ b/taglib/ape/apetag.h @@ -48,8 +48,7 @@ namespace TagLib { * * \see APE::Tag::itemListMap() */ - typedef Map ItemListMap; - + using ItemListMap = Map; //! An APE tag implementation diff --git a/taglib/asf/asftag.h b/taglib/asf/asftag.h index 7c8bd03c..ad1f95dd 100644 --- a/taglib/asf/asftag.h +++ b/taglib/asf/asftag.h @@ -36,8 +36,8 @@ namespace TagLib { namespace ASF { - typedef List AttributeList; - typedef Map AttributeListMap; + using AttributeList = List; + using AttributeListMap = Map; class TAGLIB_EXPORT Tag : public TagLib::Tag { diff --git a/taglib/flac/flacpicture.h b/taglib/flac/flacpicture.h index 089adeca..24f5edc4 100644 --- a/taglib/flac/flacpicture.h +++ b/taglib/flac/flacpicture.h @@ -197,7 +197,7 @@ namespace TagLib { std::unique_ptr d; }; - typedef List PictureList; + using PictureList = List; } // namespace FLAC } // namespace TagLib #endif diff --git a/taglib/mp4/mp4atom.h b/taglib/mp4/mp4atom.h index 48e80a8e..d536d9b4 100644 --- a/taglib/mp4/mp4atom.h +++ b/taglib/mp4/mp4atom.h @@ -38,7 +38,7 @@ namespace TagLib { namespace MP4 { class Atom; - typedef TagLib::List AtomList; + using AtomList = TagLib::List; enum AtomDataType { TypeImplicit = 0, // for use with tags for which no type needs to be indicated because only one type is allowed @@ -72,7 +72,7 @@ namespace TagLib { ByteVector data; }; - typedef TagLib::List AtomDataList; + using AtomDataList = TagLib::List; class TAGLIB_EXPORT Atom { diff --git a/taglib/mp4/mp4coverart.h b/taglib/mp4/mp4coverart.h index 621e4754..b6d5af83 100644 --- a/taglib/mp4/mp4coverart.h +++ b/taglib/mp4/mp4coverart.h @@ -73,7 +73,7 @@ namespace TagLib { std::shared_ptr d; }; - typedef List CoverArtList; + using CoverArtList = List; } // namespace MP4 } // namespace TagLib #endif diff --git a/taglib/mp4/mp4tag.h b/taglib/mp4/mp4tag.h index 7e3112d4..186c8ab8 100644 --- a/taglib/mp4/mp4tag.h +++ b/taglib/mp4/mp4tag.h @@ -37,7 +37,7 @@ namespace TagLib { namespace MP4 { - typedef TagLib::Map ItemMap; + using ItemMap = TagLib::Map; class TAGLIB_EXPORT Tag: public TagLib::Tag { diff --git a/taglib/mpeg/id3v1/id3v1genres.h b/taglib/mpeg/id3v1/id3v1genres.h index 92feb340..888c00d0 100644 --- a/taglib/mpeg/id3v1/id3v1genres.h +++ b/taglib/mpeg/id3v1/id3v1genres.h @@ -33,7 +33,7 @@ namespace TagLib { namespace ID3v1 { - typedef Map GenreMap; + using GenreMap = Map; /*! * Returns the list of canonical ID3v1 genre names in the order that they diff --git a/taglib/mpeg/id3v2/frames/eventtimingcodesframe.h b/taglib/mpeg/id3v2/frames/eventtimingcodesframe.h index 458eeee2..e044102b 100644 --- a/taglib/mpeg/id3v2/frames/eventtimingcodesframe.h +++ b/taglib/mpeg/id3v2/frames/eventtimingcodesframe.h @@ -116,7 +116,7 @@ namespace TagLib { /*! * List of synchronized events. */ - typedef TagLib::List SynchedEventList; + using SynchedEventList = TagLib::List; /*! * Construct an empty event timing codes frame. diff --git a/taglib/mpeg/id3v2/frames/synchronizedlyricsframe.h b/taglib/mpeg/id3v2/frames/synchronizedlyricsframe.h index 5fe8b7f3..849f3bd9 100644 --- a/taglib/mpeg/id3v2/frames/synchronizedlyricsframe.h +++ b/taglib/mpeg/id3v2/frames/synchronizedlyricsframe.h @@ -94,7 +94,7 @@ namespace TagLib { /*! * List of synchronized lyrics. */ - typedef TagLib::List SynchedTextList; + using SynchedTextList = TagLib::List; /*! * Construct an empty synchronized lyrics frame that will use the text diff --git a/taglib/mpeg/id3v2/frames/textidentificationframe.h b/taglib/mpeg/id3v2/frames/textidentificationframe.h index 2746105f..9b53fb83 100644 --- a/taglib/mpeg/id3v2/frames/textidentificationframe.h +++ b/taglib/mpeg/id3v2/frames/textidentificationframe.h @@ -36,7 +36,7 @@ namespace TagLib { namespace ID3v2 { class Tag; - typedef Map KeyConversionMap; + using KeyConversionMap = Map; //! An ID3v2 text identification frame implementation diff --git a/taglib/mpeg/id3v2/id3v2tag.h b/taglib/mpeg/id3v2/id3v2tag.h index d1e1f1bd..8d23d3e3 100644 --- a/taglib/mpeg/id3v2/id3v2tag.h +++ b/taglib/mpeg/id3v2/id3v2tag.h @@ -44,8 +44,8 @@ namespace TagLib { class Header; class ExtendedHeader; - typedef List FrameList; - typedef Map FrameListMap; + using FrameList = List; + using FrameListMap = Map; //! An abstraction for the ISO-8859-1 string to data encoding in ID3v2 tags. diff --git a/taglib/ogg/vorbis/vorbisfile.h b/taglib/ogg/vorbis/vorbisfile.h index adf1c46f..64fd25d4 100644 --- a/taglib/ogg/vorbis/vorbisfile.h +++ b/taglib/ogg/vorbis/vorbisfile.h @@ -152,7 +152,11 @@ namespace TagLib { #ifdef DOXYGEN } #else - namespace Ogg { namespace Vorbis { typedef TagLib::Vorbis::File File; } } + namespace Ogg { + namespace Vorbis { + using File = TagLib::Vorbis::File; + } + } #endif } // namespace TagLib diff --git a/taglib/ogg/vorbis/vorbisproperties.h b/taglib/ogg/vorbis/vorbisproperties.h index 7bf82ff6..7241f7bd 100644 --- a/taglib/ogg/vorbis/vorbisproperties.h +++ b/taglib/ogg/vorbis/vorbisproperties.h @@ -136,7 +136,11 @@ namespace TagLib { #ifdef DOXYGEN } #else - namespace Ogg { namespace Vorbis { typedef TagLib::Vorbis::Properties Properties; } } + namespace Ogg { + namespace Vorbis { + using Properties = TagLib::Vorbis::Properties; + } + } #endif } // namespace TagLib diff --git a/taglib/ogg/xiphcomment.h b/taglib/ogg/xiphcomment.h index 1aac1650..e28e13f8 100644 --- a/taglib/ogg/xiphcomment.h +++ b/taglib/ogg/xiphcomment.h @@ -50,7 +50,7 @@ namespace TagLib { * * \see XiphComment::fieldListMap() */ - typedef Map FieldListMap; + using FieldListMap = Map; //! Ogg Vorbis comment implementation diff --git a/taglib/riff/wav/infotag.h b/taglib/riff/wav/infotag.h index 78f9bd05..efe29880 100644 --- a/taglib/riff/wav/infotag.h +++ b/taglib/riff/wav/infotag.h @@ -41,7 +41,7 @@ namespace TagLib { namespace RIFF { namespace Info { - typedef Map FieldListMap; + using FieldListMap = Map; //! A abstraction for the string to data encoding in Info tags. diff --git a/taglib/toolkit/taglib.h b/taglib/toolkit/taglib.h index 3cbf8ea6..c212968f 100644 --- a/taglib/toolkit/taglib.h +++ b/taglib/toolkit/taglib.h @@ -62,26 +62,26 @@ namespace TagLib { // These integer types are deprecated. Do not use them. - typedef wchar_t wchar; // Assumed to be sufficient to store a UTF-16 char. - typedef unsigned char uchar; - typedef unsigned short ushort; - typedef unsigned int uint; - typedef unsigned long ulong; - typedef unsigned long long ulonglong; + using wchar = wchar_t; // Assumed to be sufficient to store a UTF-16 char. + using uchar = unsigned char; + using ushort = unsigned short; + using uint = unsigned int; + using ulong = unsigned long; + using ulonglong = unsigned long long; // Offset or length type for I/O streams. // In Win32, always 64bit. Otherwise, equivalent to off_t. #ifdef _WIN32 - typedef long long offset_t; + using offset_t = long long; #else - typedef off_t offset_t; + using offset_t = off_t; #endif /*! * Unfortunately std::wstring isn't defined on some systems, (i.e. GCC < 3) * so I'm providing something here that should be constant. */ - typedef std::basic_string wstring; + using wstring = std::basic_string; } // namespace TagLib /*! diff --git a/taglib/toolkit/tbytevector.h b/taglib/toolkit/tbytevector.h index 61973c3a..ca9c60fa 100644 --- a/taglib/toolkit/tbytevector.h +++ b/taglib/toolkit/tbytevector.h @@ -47,10 +47,10 @@ namespace TagLib { { public: #ifndef DO_NOT_DOCUMENT - typedef std::vector::iterator Iterator; - typedef std::vector::const_iterator ConstIterator; - typedef std::vector::reverse_iterator ReverseIterator; - typedef std::vector::const_reverse_iterator ConstReverseIterator; + using Iterator = std::vector::iterator; + using ConstIterator = std::vector::const_iterator; + using ReverseIterator = std::vector::reverse_iterator; + using ConstReverseIterator = std::vector::const_reverse_iterator; #endif /*! diff --git a/taglib/toolkit/tfilestream.cpp b/taglib/toolkit/tfilestream.cpp index 7fe6acf4..31ce47ef 100644 --- a/taglib/toolkit/tfilestream.cpp +++ b/taglib/toolkit/tfilestream.cpp @@ -43,8 +43,8 @@ namespace // Uses Win32 native API instead of POSIX API to reduce the resource consumption. - typedef FileName FileNameHandle; - typedef HANDLE FileHandle; + using FileNameHandle = FileName; + using FileHandle = HANDLE; const FileHandle InvalidFileHandle = INVALID_HANDLE_VALUE; @@ -93,7 +93,7 @@ namespace operator FileName () const { return c_str(); } }; - typedef FILE* FileHandle; + using FileHandle = FILE *; const FileHandle InvalidFileHandle = nullptr; diff --git a/taglib/toolkit/tiostream.h b/taglib/toolkit/tiostream.h index f99fcbd3..6f2878ac 100644 --- a/taglib/toolkit/tiostream.h +++ b/taglib/toolkit/tiostream.h @@ -51,7 +51,7 @@ namespace TagLib { const std::wstring m_wname; }; #else - typedef const char *FileName; + using FileName = const char *; #endif //! An abstract class that provides operations on a sequence of bytes diff --git a/taglib/toolkit/tlist.h b/taglib/toolkit/tlist.h index 6a6cce8a..98324606 100644 --- a/taglib/toolkit/tlist.h +++ b/taglib/toolkit/tlist.h @@ -55,8 +55,8 @@ namespace TagLib { { public: #ifndef DO_NOT_DOCUMENT - typedef typename std::list::iterator Iterator; - typedef typename std::list::const_iterator ConstIterator; + using Iterator = typename std::list::iterator; + using ConstIterator = typename std::list::const_iterator; #endif /*! diff --git a/taglib/toolkit/tmap.h b/taglib/toolkit/tmap.h index 4ced6854..13229417 100644 --- a/taglib/toolkit/tmap.h +++ b/taglib/toolkit/tmap.h @@ -54,11 +54,11 @@ namespace TagLib { // Not all the specializations of Map can use the class keyword // (when T is not actually a class type), so don't apply this // generally. - typedef typename std::map::iterator Iterator; - typedef typename std::map::const_iterator ConstIterator; + using Iterator = typename std::map::iterator; + using ConstIterator = typename std::map::const_iterator; #else - typedef typename std::map::iterator Iterator; - typedef typename std::map::const_iterator ConstIterator; + using Iterator = typename std::map::iterator; + using ConstIterator = typename std::map::const_iterator; #endif #endif diff --git a/taglib/toolkit/tpropertymap.h b/taglib/toolkit/tpropertymap.h index ed090615..5d390788 100644 --- a/taglib/toolkit/tpropertymap.h +++ b/taglib/toolkit/tpropertymap.h @@ -36,7 +36,7 @@ extern template class TAGLIB_EXPORT TagLib::Map SimplePropertyMap; + using SimplePropertyMap = Map; //! A map for format-independent tag representations. @@ -118,9 +118,8 @@ namespace TagLib { class TAGLIB_EXPORT PropertyMap: public SimplePropertyMap { public: - - typedef SimplePropertyMap::Iterator Iterator; - typedef SimplePropertyMap::ConstIterator ConstIterator; + using Iterator = SimplePropertyMap::Iterator; + using ConstIterator = SimplePropertyMap::ConstIterator; PropertyMap(); diff --git a/taglib/toolkit/tstring.h b/taglib/toolkit/tstring.h index a39df2c2..c4caf098 100644 --- a/taglib/toolkit/tstring.h +++ b/taglib/toolkit/tstring.h @@ -86,8 +86,8 @@ namespace TagLib { public: #ifndef DO_NOT_DOCUMENT - typedef TagLib::wstring::iterator Iterator; - typedef TagLib::wstring::const_iterator ConstIterator; + using Iterator = TagLib::wstring::iterator; + using ConstIterator = TagLib::wstring::const_iterator; #endif /**