Merge pull request #3128 from Carbenium/int-type-macros

Consolidate __STDC_FORMAT_MACROS and __STDC_CONSTANT_MACROS definition
pull/3134/head
Isaac Connor 2021-02-04 14:44:51 -05:00 committed by GitHub
commit 2ee097c5f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 24 additions and 20 deletions

View File

@ -61,12 +61,12 @@ endif(NOT HOST_OS)
set (CMAKE_CXX_STANDARD 11) set (CMAKE_CXX_STANDARD 11)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
# Default CLFAGS and CXXFLAGS: # Default CLFAGS and CXXFLAGS:
set(CMAKE_C_FLAGS_RELEASE "-Wall -D__STDC_CONSTANT_MACROS -O2") set(CMAKE_C_FLAGS_RELEASE "-Wall -O2")
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -D__STDC_CONSTANT_MACROS -O2") set(CMAKE_CXX_FLAGS_RELEASE "-Wall -O2")
set(CMAKE_C_FLAGS_DEBUG "-Wall -D__STDC_CONSTANT_MACROS -g") set(CMAKE_C_FLAGS_DEBUG "-Wall -g")
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -D__STDC_CONSTANT_MACROS -g") set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g")
set(CMAKE_C_FLAGS_OPTIMISED "-Wall -D__STDC_CONSTANT_MACROS -O3") set(CMAKE_C_FLAGS_OPTIMISED "-Wall -O3")
set(CMAKE_CXX_FLAGS_OPTIMISED "-Wall -D__STDC_CONSTANT_MACROS -O3") set(CMAKE_CXX_FLAGS_OPTIMISED "-Wall -O3")
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
set (CMAKE_CXX_STANDARD 11) set (CMAKE_CXX_STANDARD 11)

View File

@ -15,7 +15,6 @@ DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
CFLAGS = -Wall CFLAGS = -Wall
CPPFLAGS = -D__STDC_CONSTANT_MACROS
CXXFLAGS = -DHAVE_LIBCRYPTO CXXFLAGS = -DHAVE_LIBCRYPTO
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))

View File

@ -19,6 +19,15 @@
#ifndef ZONEMINDER_SRC_ZM_DEFINE_H_ #ifndef ZONEMINDER_SRC_ZM_DEFINE_H_
#define ZONEMINDER_SRC_ZM_DEFINE_H_ #define ZONEMINDER_SRC_ZM_DEFINE_H_
// These macros have not been adopted by the C++11 standard.
// However glibc 2.17 (CentOS 7) still depends on them to provide the macros which are guarded by these defines.
#if !defined(__STDC_FORMAT_MACROS)
# define __STDC_FORMAT_MACROS
#endif
#if !defined(__STDC_CONSTANT_MACROS)
# define __STDC_CONSTANT_MACROS
#endif
#include <cinttypes> #include <cinttypes>
typedef std::int64_t int64; typedef std::int64_t int64;

View File

@ -20,6 +20,7 @@
#ifndef ZM_EVENT_H #ifndef ZM_EVENT_H
#define ZM_EVENT_H #define ZM_EVENT_H
#include "zm_define.h"
#include "zm_storage.h" #include "zm_storage.h"
#include <map> #include <map>
#include <queue> #include <queue>

View File

@ -20,10 +20,11 @@
#ifndef ZM_EVENTSTREAM_H #ifndef ZM_EVENTSTREAM_H
#define ZM_EVENTSTREAM_H #define ZM_EVENTSTREAM_H
#include "zm_stream.h" #include "zm_define.h"
#include "zm_ffmpeg_input.h" #include "zm_ffmpeg_input.h"
#include "zm_monitor.h" #include "zm_monitor.h"
#include "zm_storage.h" #include "zm_storage.h"
#include "zm_stream.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -1,6 +1,8 @@
#ifndef ZM_FFMPEG_INPUT_H #ifndef ZM_FFMPEG_INPUT_H
#define ZM_FFMPEG_INPUT_H #define ZM_FFMPEG_INPUT_H
#include "zm_define.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@ -20,6 +20,7 @@
#ifndef ZM_MONITOR_H #ifndef ZM_MONITOR_H
#define ZM_MONITOR_H #define ZM_MONITOR_H
#include "zm_define.h"
#include "zm_event.h" #include "zm_event.h"
#include "zm_image.h" #include "zm_image.h"
#include "zm_packet.h" #include "zm_packet.h"

View File

@ -10,6 +10,7 @@
#define ZM_RTSP_SERVER_DEVICE_SOURCE_H #define ZM_RTSP_SERVER_DEVICE_SOURCE_H
#include "zm_config.h" #include "zm_config.h"
#include "zm_define.h"
#include "zm_monitor.h" #include "zm_monitor.h"
#include <list> #include <list>
#include <string> #include <string>

View File

@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// //
#define __STDC_FORMAT_MACROS 1
#include "zm_videostore.h" #include "zm_videostore.h"
#include "zm_logger.h" #include "zm_logger.h"

View File

@ -2,6 +2,7 @@
#define ZM_VIDEOSTORE_H #define ZM_VIDEOSTORE_H
#include "zm_config.h" #include "zm_config.h"
#include "zm_define.h"
#include "zm_ffmpeg.h" #include "zm_ffmpeg.h"
#include "zm_swscale.h" #include "zm_swscale.h"

View File

@ -17,7 +17,6 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
// //
#define __STDC_FORMAT_MACROS 1
#include "zm_zone.h" #include "zm_zone.h"
#include "zm_fifo.h" #include "zm_fifo.h"

View File

@ -22,6 +22,7 @@
#include "zm_box.h" #include "zm_box.h"
#include "zm_coord.h" #include "zm_coord.h"
#include "zm_define.h"
#include "zm_config.h" #include "zm_config.h"
#include "zm_poly.h" #include "zm_poly.h"
#include "zm_rgb.h" #include "zm_rgb.h"

View File

@ -64,16 +64,6 @@ possible, this should run at more or less constant speed.
#include <getopt.h> #include <getopt.h>
#include <iostream> #include <iostream>
#if defined(__FreeBSD__)
#include <limits.h>
#else
#include <values.h>
#endif
#if !defined(MAXINT)
#define MAXINT INT_MAX
#endif
void Usage() { void Usage() {
fprintf(stderr, "zmc -d <device_path> or -r <proto> -H <host> -P <port> -p <path> or -f <file_path> or -m <monitor_id>\n"); fprintf(stderr, "zmc -d <device_path> or -r <proto> -H <host> -P <port> -p <path> or -f <file_path> or -m <monitor_id>\n");