From 0f5df0c739eaed0558515cea472a3e05751bb8d3 Mon Sep 17 00:00:00 2001 From: Peter Keresztes Schmidt Date: Tue, 2 Feb 2021 17:51:22 +0100 Subject: [PATCH] zm: Typedef C++11 int types to make them easier to use In order to clearly state the intended length of an integer variable all usages of other integer types (short int, int, long int, ...) should be converted. --- src/zm.h | 6 +++--- src/zm_define.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 src/zm_define.h diff --git a/src/zm.h b/src/zm.h index 60fa67711..f22bc5b2e 100644 --- a/src/zm.h +++ b/src/zm.h @@ -21,6 +21,8 @@ #ifndef ZM_H #define ZM_H +#include "zm_define.h" + #include "zm_config.h" #include "zm_signal.h" #ifdef SOLARIS @@ -29,10 +31,8 @@ #endif #include "zm_logger.h" -#include - #include -extern const char* self; +extern const char *self; #endif // ZM_H diff --git a/src/zm_define.h b/src/zm_define.h new file mode 100644 index 000000000..a3372ddba --- /dev/null +++ b/src/zm_define.h @@ -0,0 +1,33 @@ +/* + * This file is part of the ZoneMinder Project. + * + * 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 (at your option) 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, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +#ifndef ZONEMINDER_SRC_ZM_DEFINE_H_ +#define ZONEMINDER_SRC_ZM_DEFINE_H_ + +#include + +typedef std::int64_t int64; +typedef std::int32_t int32; +typedef std::int16_t int16; +typedef std::int8_t int8; +typedef std::uint64_t uint64; +typedef std::uint32_t uint32; +typedef std::uint16_t uint16; +typedef std::uint8_t uint8; + +#endif // ZONEMINDER_SRC_ZM_DEFINE_H_