From 36c45ae7d8d2577a900ec266b64448d4b488013d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 29 Jun 2017 20:13:40 +0300 Subject: Move cast macroses into separate file. --- src/utils/base64.cpp | 2 ++ src/utils/buildhex.h | 2 ++ src/utils/cast.h | 33 +++++++++++++++++++++++++++++++++ src/utils/mathutils.h | 2 ++ src/utils/mathutils_unittest.cc | 1 + src/utils/sdlpixel.h | 2 ++ src/utils/stringutils.cpp | 1 + src/utils/stringutils_unittest.cc | 1 + 8 files changed, 44 insertions(+) create mode 100644 src/utils/cast.h (limited to 'src/utils') diff --git a/src/utils/base64.cpp b/src/utils/base64.cpp index 9f1c2a1d4..62ba76f21 100644 --- a/src/utils/base64.cpp +++ b/src/utils/base64.cpp @@ -29,6 +29,8 @@ #include "utils/base64.h" +#include "utils/cast.h" + #include "debug.h" static char base64_table[] = diff --git a/src/utils/buildhex.h b/src/utils/buildhex.h index 0a4349bac..777d19784 100644 --- a/src/utils/buildhex.h +++ b/src/utils/buildhex.h @@ -21,6 +21,8 @@ #ifndef UTILS_BUILDHEX_H #define UTILS_BUILDHEX_H +#include "utils/cast.h" + #include "localconsts.h" PRAGMA48(GCC diagnostic push) diff --git a/src/utils/cast.h b/src/utils/cast.h new file mode 100644 index 000000000..9b6289ebc --- /dev/null +++ b/src/utils/cast.h @@ -0,0 +1,33 @@ +/* + * The ManaPlus Client + * Copyright (C) 2011-2017 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef UTILS_CAST_H +#define UTILS_CAST_H + +#define CAST_8 static_cast +#define CAST_S8 static_cast +#define CAST_U8 static_cast +#define CAST_S16 static_cast +#define CAST_U16 static_cast +#define CAST_S32 static_cast +#define CAST_U32 static_cast +#define CAST_SIZE static_cast + +#endif // UTILS_CAST_H diff --git a/src/utils/mathutils.h b/src/utils/mathutils.h index b82ad3065..045feb10a 100644 --- a/src/utils/mathutils.h +++ b/src/utils/mathutils.h @@ -23,6 +23,8 @@ #ifndef UTILS_MATHUTILS_H #define UTILS_MATHUTILS_H +#include "utils/cast.h" + #include #ifndef USE_SDL2 diff --git a/src/utils/mathutils_unittest.cc b/src/utils/mathutils_unittest.cc index 187accf74..c7a545f87 100644 --- a/src/utils/mathutils_unittest.cc +++ b/src/utils/mathutils_unittest.cc @@ -20,6 +20,7 @@ #include "test/unittests.h" +#include "utils/cast.h" #include "utils/mathutils.h" #include "debug.h" diff --git a/src/utils/sdlpixel.h b/src/utils/sdlpixel.h index 920ad4164..54e7e0b41 100644 --- a/src/utils/sdlpixel.h +++ b/src/utils/sdlpixel.h @@ -66,6 +66,8 @@ #include "gui/color.h" +#include "utils/cast.h" + PRAGMA48(GCC diagnostic push) PRAGMA48(GCC diagnostic ignored "-Wshadow") #include diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index 201ffc0c4..71a82f16f 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -30,6 +30,7 @@ #include "resources/db/itemdb.h" #endif // DYECMD +#include "utils/cast.h" #include "utils/gettext.h" #include "utils/foreach.h" diff --git a/src/utils/stringutils_unittest.cc b/src/utils/stringutils_unittest.cc index 354232965..19670db99 100644 --- a/src/utils/stringutils_unittest.cc +++ b/src/utils/stringutils_unittest.cc @@ -27,6 +27,7 @@ #include "fs/virtfs/fs.h" +#include "utils/cast.h" #include "utils/delete2.h" #include "utils/dtor.h" -- cgit v1.2.3-60-g2f50