From 0c4623a39fa5dec8eac1c45f358e0fd45fd2f1df Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Mon, 17 Feb 2020 07:43:47 -0300 Subject: [PATCH] Replace typedef aliasing by using (#10712) --- .../drawing/engines/opengl/OpenGLAPI.h | 46 +++++++++---------- .../drawing/engines/opengl/TextureCache.h | 8 ++-- .../engines/opengl/TransparencyDepth.cpp | 4 +- src/openrct2/core/CircularBuffer.h | 14 +++--- src/openrct2/core/Crypt.h | 2 +- src/openrct2/core/Endianness.h | 10 ++-- src/openrct2/core/JobPool.hpp | 2 +- src/openrct2/ride/Track.h | 2 +- src/openrct2/world/Location.hpp | 2 +- src/openrct2/world/Map.h | 2 +- src/openrct2/world/TileElement.h | 2 +- 11 files changed, 47 insertions(+), 47 deletions(-) diff --git a/src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.h b/src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.h index a426f2058c..fe9f2dd4cf 100644 --- a/src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.h +++ b/src/openrct2-ui/drawing/engines/opengl/OpenGLAPI.h @@ -74,36 +74,36 @@ # undef glGetTexImage // 1.1 function signatures -typedef void(APIENTRYP PFNGLBEGINPROC)(GLenum mode); -typedef void(APIENTRYP PFNGLBINDTEXTUREPROC)(GLenum target, GLuint texture); -typedef void(APIENTRYP PFNGLBLENDFUNCPROC)(GLenum sfactor, GLenum dfactor); -typedef void(APIENTRYP PFNGLCLEARPROC)(GLbitfield mask); -typedef void(APIENTRYP PFNGLCLEARCOLORPROC)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode); -typedef void(APIENTRYP PFNGLDELETETEXTURESPROC)(GLsizei n, const GLuint* textures); -typedef void(APIENTRYP PFNGLDEPTHFUNCPROC)(GLenum func); -typedef void(APIENTRYP PFNGLDISABLEPROC)(GLenum cap); -typedef void(APIENTRYP PFNGLDRAWARRAYSPROC)(GLenum mode, GLint first, GLsizei count); -typedef void(APIENTRYP PFNGLENABLEPROC)(GLenum cap); -typedef void(APIENTRYP PFNGLENDPROC)(void); -typedef GLenum(APIENTRYP PFNGLGETERRORPROC)(void); -typedef void(APIENTRYP PFNGLGENTEXTURESPROC)(GLsizei n, GLuint* textures); -typedef void(APIENTRYP PFNGLPIXELSTOREIPROC)(GLenum pname, GLint param); -typedef void(APIENTRYP PFNGLREADPIXELSPROC)( +using PFNGLBEGINPROC = void(APIENTRYP)(GLenum mode); +using PFNGLBINDTEXTUREPROC = void(APIENTRYP)(GLenum target, GLuint texture); +using PFNGLBLENDFUNCPROC = void(APIENTRYP)(GLenum sfactor, GLenum dfactor); +using PFNGLCLEARPROC = void(APIENTRYP)(GLbitfield mask); +using PFNGLCLEARCOLORPROC = void(APIENTRYP)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +using PFNGLCULLFACEPROC = void(APIENTRYP)(GLenum mode); +using PFNGLDELETETEXTURESPROC = void(APIENTRYP)(GLsizei n, const GLuint* textures); +using PFNGLDEPTHFUNCPROC = void(APIENTRYP)(GLenum func); +using PFNGLDISABLEPROC = void(APIENTRYP)(GLenum cap); +using PFNGLDRAWARRAYSPROC = void(APIENTRYP)(GLenum mode, GLint first, GLsizei count); +using PFNGLENABLEPROC = void(APIENTRYP)(GLenum cap); +using PFNGLENDPROC = void(APIENTRYP)(void); +using PFNGLGETERRORPROC = GLenum(APIENTRYP)(void); +using PFNGLGENTEXTURESPROC = void(APIENTRYP)(GLsizei n, GLuint* textures); +using PFNGLPIXELSTOREIPROC = void(APIENTRYP)(GLenum pname, GLint param); +using PFNGLREADPIXELSPROC = void(APIENTRYP)( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); -typedef void(APIENTRYP PFNGLTEXIMAGE2DPROC)( +using PFNGLTEXIMAGE2DPROC = void(APIENTRYP)( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels); -typedef void(APIENTRYP PFNGLTEXPARAMETERIPROC)(GLenum target, GLenum pname, GLint param); -typedef void(APIENTRYP PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height); -typedef void(APIENTRYP PFNGLTEXSUBIMAGE3DPROC)( +using PFNGLTEXPARAMETERIPROC = void(APIENTRYP)(GLenum target, GLenum pname, GLint param); +using PFNGLVIEWPORTPROC = void(APIENTRYP)(GLint x, GLint y, GLsizei width, GLsizei height); +using PFNGLTEXSUBIMAGE3DPROC = void(APIENTRYP)( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* data); -typedef void(APIENTRYP PFNGLTEXIMAGE3DPROC)( +using PFNGLTEXIMAGE3DPROC = void(APIENTRYP)( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* data); -typedef void(APIENTRYP PFNGLGETINTERGERVPROC)(GLenum pname, GLint* data); -typedef void(APIENTRYP PFNGLGETTEXIMAGEPROC)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid* img); +using PFNGLGETINTERGERVPROC = void(APIENTRYP)(GLenum pname, GLint* data); +using PFNGLGETTEXIMAGEPROC = void(APIENTRYP)(GLenum target, GLint level, GLenum format, GLenum type, GLvoid* img); # define OPENGL_PROC(TYPE, PROC) extern TYPE PROC; # include "OpenGLAPIProc.h" diff --git a/src/openrct2-ui/drawing/engines/opengl/TextureCache.h b/src/openrct2-ui/drawing/engines/opengl/TextureCache.h index 851d035094..5ee5a7417c 100644 --- a/src/openrct2-ui/drawing/engines/opengl/TextureCache.h +++ b/src/openrct2-ui/drawing/engines/opengl/TextureCache.h @@ -205,12 +205,12 @@ private: #ifndef __MACOSX__ std::shared_mutex _mutex; - typedef std::shared_lock shared_lock; - typedef std::unique_lock unique_lock; + using shared_lock = std::shared_lock; + using unique_lock = std::unique_lock; #else std::mutex _mutex; - typedef std::unique_lock shared_lock; - typedef std::unique_lock unique_lock; + using shared_lock = std::unique_lock; + using unique_lock = std::unique_lock; #endif public: diff --git a/src/openrct2-ui/drawing/engines/opengl/TransparencyDepth.cpp b/src/openrct2-ui/drawing/engines/opengl/TransparencyDepth.cpp index ebfbb2739a..ed76b9ffae 100644 --- a/src/openrct2-ui/drawing/engines/opengl/TransparencyDepth.cpp +++ b/src/openrct2-ui/drawing/engines/opengl/TransparencyDepth.cpp @@ -24,7 +24,7 @@ struct XData bool begin; int32_t top, bottom; }; -typedef std::vector SweepLine; +using SweepLine = std::vector; /* * Creates a list of vertical bounding box edges, stored as xdata and sorted @@ -76,7 +76,7 @@ struct YData { int32_t count, depth; }; -typedef std::map IntervalTree; +using IntervalTree = std::map; /* * Inserts the interval's top endpoint into the interval tree. If the endpoint diff --git a/src/openrct2/core/CircularBuffer.h b/src/openrct2/core/CircularBuffer.h index c7c4f1cec9..d435b540be 100644 --- a/src/openrct2/core/CircularBuffer.h +++ b/src/openrct2/core/CircularBuffer.h @@ -14,13 +14,13 @@ template class CircularBuffer { public: - typedef _TType value_type; - typedef _TType* pointer; - typedef const _TType* const_pointer; - typedef _TType& reference; - typedef const _TType& const_reference; - typedef size_t size_type; - typedef ptrdiff_t difference_type; + using value_type = _TType; + using pointer = _TType*; + using const_pointer = const _TType*; + using reference = _TType&; + using const_reference = const _TType&; + using size_type = size_t; + using difference_type = ptrdiff_t; reference front() { diff --git a/src/openrct2/core/Crypt.h b/src/openrct2/core/Crypt.h index f3c32cf00a..ce271e3308 100644 --- a/src/openrct2/core/Crypt.h +++ b/src/openrct2/core/Crypt.h @@ -19,7 +19,7 @@ namespace Crypt template class HashAlgorithm { public: - typedef std::array Result; + using Result = std::array; virtual ~HashAlgorithm() = default; virtual HashAlgorithm* Clear() = 0; diff --git a/src/openrct2/core/Endianness.h b/src/openrct2/core/Endianness.h index e0d065f512..40335745e5 100644 --- a/src/openrct2/core/Endianness.h +++ b/src/openrct2/core/Endianness.h @@ -17,7 +17,7 @@ template struct ByteSwapT template<> struct ByteSwapT<1> { - typedef uint8_t UIntType; + using UIntType = uint8_t; static uint8_t SwapBE(uint8_t value) { return value; @@ -26,7 +26,7 @@ template<> struct ByteSwapT<1> template<> struct ByteSwapT<2> { - typedef uint16_t UIntType; + using UIntType = uint16_t; static uint16_t SwapBE(uint16_t value) { return (uint16_t)((value << 8) | (value >> 8)); @@ -35,7 +35,7 @@ template<> struct ByteSwapT<2> template<> struct ByteSwapT<4> { - typedef uint32_t UIntType; + using UIntType = uint32_t; static uint32_t SwapBE(uint32_t value) { return (uint32_t)(((value << 24) | ((value << 8) & 0x00FF0000) | ((value >> 8) & 0x0000FF00) | (value >> 24))); @@ -44,7 +44,7 @@ template<> struct ByteSwapT<4> template<> struct ByteSwapT<8> { - typedef uint64_t UIntType; + using UIntType = uint64_t; static uint64_t SwapBE(uint64_t value) { value = (value & 0x00000000FFFFFFFF) << 32 | (value & 0xFFFFFFFF00000000) >> 32; @@ -56,7 +56,7 @@ template<> struct ByteSwapT<8> template static T ByteSwapBE(const T& value) { - typedef ByteSwapT ByteSwap; + using ByteSwap = ByteSwapT; typename ByteSwap::UIntType result = ByteSwap::SwapBE(reinterpret_cast(value)); return *reinterpret_cast(&result); } diff --git a/src/openrct2/core/JobPool.hpp b/src/openrct2/core/JobPool.hpp index 957a81412a..4550f5f691 100644 --- a/src/openrct2/core/JobPool.hpp +++ b/src/openrct2/core/JobPool.hpp @@ -43,7 +43,7 @@ private: std::condition_variable _condComplete; std::mutex _mutex; - typedef std::unique_lock unique_lock; + using unique_lock = std::unique_lock; public: JobPool(size_t maxThreads = 255) diff --git a/src/openrct2/ride/Track.h b/src/openrct2/ride/Track.h index 2055d95957..27c141c8ad 100644 --- a/src/openrct2/ride/Track.h +++ b/src/openrct2/ride/Track.h @@ -13,7 +13,7 @@ #include "../object/Object.h" #include "Ride.h" -typedef uint16_t track_type_t; +using track_type_t = uint16_t; #pragma pack(push, 1) struct rct_trackdefinition diff --git a/src/openrct2/world/Location.hpp b/src/openrct2/world/Location.hpp index 411a177cd8..0ce2ba1f54 100644 --- a/src/openrct2/world/Location.hpp +++ b/src/openrct2/world/Location.hpp @@ -398,7 +398,7 @@ struct TileCoordsXYZ : public TileCoordsXY * 3 is Y-decreasing * Direction is not used to model up/down, or diagonal directions. */ -typedef uint8_t Direction; +using Direction = uint8_t; const Direction INVALID_DIRECTION = 0xFF; diff --git a/src/openrct2/world/Map.h b/src/openrct2/world/Map.h index 12a43951da..023b242cf5 100644 --- a/src/openrct2/world/Map.h +++ b/src/openrct2/world/Map.h @@ -41,7 +41,7 @@ constexpr const int32_t LAND_HEIGHT_STEP = 2 * COORDS_Z_STEP; #define TILE_UNDEFINED_TILE_ELEMENT NULL -typedef CoordsXYZD PeepSpawn; +using PeepSpawn = CoordsXYZD; struct CoordsXYE : public CoordsXY { diff --git a/src/openrct2/world/TileElement.h b/src/openrct2/world/TileElement.h index f2de976a2e..65f1aafe86 100644 --- a/src/openrct2/world/TileElement.h +++ b/src/openrct2/world/TileElement.h @@ -18,7 +18,7 @@ struct Banner; struct rct_scenery_entry; struct rct_footpath_entry; -typedef uint16_t track_type_t; +using track_type_t = uint16_t; #pragma pack(push, 1)