Require `stdint.h` & `inttypes.h` 1484/head
authormayeut <mayeut@users.noreply.github.com>
Sun, 24 Sep 2023 11:54:28 +0000 (13:54 +0200)
committermayeut <mayeut@users.noreply.github.com>
Sun, 24 Sep 2023 11:54:28 +0000 (13:54 +0200)
With #1450 which goes with 480cc9d49775d018c19ce0e01f6be27858d63d39 "Remove support for non-C99 compilers (like VS2010) that don't support snprintf()",
support for MSVC versions prior to vs2015 is dropped: https://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010

This means that all supported MSVC versions do have `stdint.h` & `inttypes.h` now.
For non windows platforms, those headers were already mandatory.

Make them mandatory for all builds.

26 files changed:
CMakeLists.txt
src/bin/jp2/converttif.c
src/bin/jp2/index.c
src/lib/openjp2/CMakeLists.txt
src/lib/openjp2/openjpeg.h
src/lib/openjp2/opj_config.h.cmake.in
src/lib/openjp2/opj_config_private.h.cmake.in
src/lib/openjp2/opj_includes.h
src/lib/openjp2/opj_inttypes.h [deleted file]
src/lib/openjp2/opj_stdint.h [deleted file]
src/lib/openjp2/t1_ht_generate_luts.c
src/lib/openjpip/box_manager.c
src/lib/openjpip/boxheader_manager.c
src/lib/openjpip/byte_manager.h
src/lib/openjpip/cachemodel_manager.c
src/lib/openjpip/codestream_manager.c
src/lib/openjpip/dec_clientmsg_handler.c
src/lib/openjpip/faixbox_manager.c
src/lib/openjpip/index_manager.c
src/lib/openjpip/jp2k_encoder.c
src/lib/openjpip/metadata_manager.c
src/lib/openjpip/mhixbox_manager.c
src/lib/openjpip/msgqueue_manager.c
src/lib/openjpip/placeholder_manager.c
src/lib/openjpip/query_parser.c
src/lib/openjpip/sock_manager.h

index 8acca1663628967e0804e78c291de5c3bbf39ceb..c6dd7080463857543166fc2b37cac4fcdfae3313 100644 (file)
@@ -184,20 +184,18 @@ endif()
 # Check if some include files are provided by the system
 include(EnsureFileInclude)
 # These files are mandatory
-ensure_file_include("string.h"   HAVE_STRING_H YES)
-ensure_file_include("memory.h"   HAVE_MEMORY_H YES)
-ensure_file_include("stdlib.h"   HAVE_STDLIB_H YES)
-ensure_file_include("stdio.h"    HAVE_STDIO_H  YES)
-ensure_file_include("math.h"     HAVE_MATH_H   YES)
-ensure_file_include("float.h"    HAVE_FLOAT_H  YES)
-ensure_file_include("time.h"     HAVE_TIME_H   YES)
-ensure_file_include("stdarg.h"   HAVE_STDARG_H YES)
-ensure_file_include("ctype.h"    HAVE_CTYPE_H  YES)
-ensure_file_include("assert.h"   HAVE_ASSERT_H YES)
-
-# For the following files, we provide an alternative, they are not mandatory
-ensure_file_include("stdint.h"   OPJ_HAVE_STDINT_H   NO)
-ensure_file_include("inttypes.h" OPJ_HAVE_INTTYPES_H NO)
+ensure_file_include("string.h"   HAVE_STRING_H   YES)
+ensure_file_include("memory.h"   HAVE_MEMORY_H   YES)
+ensure_file_include("stdlib.h"   HAVE_STDLIB_H   YES)
+ensure_file_include("stdio.h"    HAVE_STDIO_H    YES)
+ensure_file_include("math.h"     HAVE_MATH_H     YES)
+ensure_file_include("float.h"    HAVE_FLOAT_H    YES)
+ensure_file_include("time.h"     HAVE_TIME_H     YES)
+ensure_file_include("stdarg.h"   HAVE_STDARG_H   YES)
+ensure_file_include("ctype.h"    HAVE_CTYPE_H    YES)
+ensure_file_include("assert.h"   HAVE_ASSERT_H   YES)
+ensure_file_include("stdint.h"   HAVE_STDINT_H   YES)
+ensure_file_include("inttypes.h" HAVE_INTTYPES_H YES)
 
 # why check this one ? for openjpip ?
 include (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)
index c2e7d1cbcb77bef70b2d8f9583b6e056f148799d..e47a48d78a713cc12d6c4fde31be6b836bd1b376 100644 (file)
@@ -43,6 +43,7 @@
 #include <string.h>
 #include <ctype.h>
 #include <limits.h>
+#include <inttypes.h>
 
 #ifndef OPJ_HAVE_LIBTIFF
 # error OPJ_HAVE_LIBTIFF_NOT_DEFINED
@@ -51,7 +52,6 @@
 #include <tiffio.h>
 #include "openjpeg.h"
 #include "convert.h"
-#include "opj_inttypes.h"
 
 /* -->> -->> -->> -->>
 
index 3eae2f974af1226a1480fcd67c9f0c4a127b1383..100945bf40887ca8dcba8608c854beda7fbb8a73 100644 (file)
@@ -34,9 +34,9 @@
 #include <stdio.h>
 #include <math.h>
 #include <string.h>
+#include <inttypes.h>
 #include "openjpeg.h"
 #include "index.h"
-#include "opj_inttypes.h"
 
 /* ------------------------------------------------------------------------------------ */
 
index f92044e8b82f0ad1b03dd30d2227a6e0a57bf363..8fda14dc4f332c140c77a2faf76aa30c13dcc380 100644 (file)
@@ -54,7 +54,6 @@ set(OPENJPEG_SRCS
   ${CMAKE_CURRENT_SOURCE_DIR}/opj_intmath.h
   ${CMAKE_CURRENT_SOURCE_DIR}/opj_malloc.c
   ${CMAKE_CURRENT_SOURCE_DIR}/opj_malloc.h
-  ${CMAKE_CURRENT_SOURCE_DIR}/opj_stdint.h
   ${CMAKE_CURRENT_SOURCE_DIR}/sparse_array.c
   ${CMAKE_CURRENT_SOURCE_DIR}/sparse_array.h
 )
@@ -123,7 +122,7 @@ install(TARGETS ${INSTALL_LIBS}
 )
 
 # Install includes files
-install(FILES openjpeg.h opj_stdint.h
+install(FILES openjpeg.h
   DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${OPENJPEG_INSTALL_SUBDIR} COMPONENT Headers
 )
 
index ebe784440e916ec1d308ff2aec104f021354a88c..a421143a53f0c09299ea7f84226ff557bcf56c8d 100644 (file)
@@ -122,7 +122,7 @@ typedef float         OPJ_FLOAT32;
 typedef double        OPJ_FLOAT64;
 typedef unsigned char OPJ_BYTE;
 
-#include "opj_stdint.h"
+#include <stdint.h>
 
 typedef int8_t   OPJ_INT8;
 typedef uint8_t  OPJ_UINT8;
index 5f762ca3daa939d9dcc9f9698c471055f2fc9e58..50015fb9a25b452c634715de9c54ac2148a77fb0 100644 (file)
@@ -1,5 +1,4 @@
 /* create opj_config.h for CMake */
-#cmakedefine OPJ_HAVE_STDINT_H                 @OPJ_HAVE_STDINT_H@
 
 /*--------------------------------------------------------------------------*/
 /* OpenJPEG Versioning                                                      */
index c41f9066242d7318b89beab7a33132007cfff3fc..c559282c578bca2c41a2009b1c825b8c485bebdf 100644 (file)
@@ -1,5 +1,4 @@
 /* create opj_config_private.h for CMake */
-#cmakedefine OPJ_HAVE_INTTYPES_H       @OPJ_HAVE_INTTYPES_H@
 
 #define OPJ_PACKAGE_VERSION "@PACKAGE_VERSION@"
 
@@ -11,6 +10,8 @@
 /*#cmakedefine HAVE_SYS_STAT_H @HAVE_SYS_STAT_H@*/
 /*#cmakedefine HAVE_SYS_TYPES_H @HAVE_SYS_TYPES_H@ */
 /*#cmakedefine HAVE_UNISTD_H @HAVE_UNISTD_H@*/
+/*#cmakedefine HAVE_INTTYPES_H @HAVE_INTTYPES_H@ */
+/*#cmakedefine HAVE_STDINT_H @HAVE_STDINT_H@ */
 
 #cmakedefine _LARGEFILE_SOURCE
 #cmakedefine _LARGE_FILES
index 0a8628c96b3043f2d1635f32dca2be7b08340881..13613ce521c1034e8f7b2a74f0dfd1f749e01706 100644 (file)
@@ -55,6 +55,8 @@
 #include <ctype.h>
 #include <assert.h>
 #include <limits.h>
+#include <stdint.h>
+#include <inttypes.h>
 
 /*
   Use fseeko() and ftello() if they are available since they use
@@ -218,7 +220,6 @@ typedef unsigned int OPJ_BITFIELD;
 
 #define OPJ_UNUSED(x) (void)x
 
-#include "opj_inttypes.h"
 #include "opj_clock.h"
 #include "opj_malloc.h"
 #include "event.h"
diff --git a/src/lib/openjp2/opj_inttypes.h b/src/lib/openjp2/opj_inttypes.h
deleted file mode 100644 (file)
index 2c9749a..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * The copyright in this software is being made available under the 2-clauses
- * BSD License, included below. This software may be subject to other third
- * party and contributor rights, including patent rights, and no such rights
- * are granted under this license.
- *
- * Copyright (c) 2012, Mathieu Malaterre <mathieu.malaterre@gmail.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef OPJ_INTTYPES_H
-#define OPJ_INTTYPES_H
-
-#include "opj_config_private.h"
-#ifdef OPJ_HAVE_INTTYPES_H
-#include <inttypes.h>
-#else
-#if defined(_WIN32)
-#define PRId64 "I64d"
-#define PRIi64 "I64i"
-#define PRIu64 "I64u"
-#define PRIx64 "I64x"
-#else
-#error unsupported platform
-#endif
-#endif
-
-#endif /* OPJ_INTTYPES_H */
diff --git a/src/lib/openjp2/opj_stdint.h b/src/lib/openjp2/opj_stdint.h
deleted file mode 100644 (file)
index f26c921..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * The copyright in this software is being made available under the 2-clauses
- * BSD License, included below. This software may be subject to other third
- * party and contributor rights, including patent rights, and no such rights
- * are granted under this license.
- *
- * Copyright (c) 2012, Mathieu Malaterre <mathieu.malaterre@gmail.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef OPJ_STDINT_H
-#define OPJ_STDINT_H
-
-#include "opj_config.h"
-#ifdef OPJ_HAVE_STDINT_H
-#include <stdint.h>
-#else
-#if defined(_WIN32)
-typedef   signed __int8   int8_t;
-typedef unsigned __int8   uint8_t;
-typedef   signed __int16  int16_t;
-typedef unsigned __int16  uint16_t;
-typedef   signed __int32  int32_t;
-typedef unsigned __int32  uint32_t;
-typedef   signed __int64  int64_t;
-typedef unsigned __int64  uint64_t;
-#else
-#error unsupported platform
-#endif
-#endif
-
-#endif /* OPJ_STDINT_H */
index 6876e3fd7f0a5cd2b268cbafec4f323b37fa57e9..22382a5a4af52355f3298e1388cf35c20b054c55 100644 (file)
 #include <string.h>
 #include <stdio.h>
 #include <assert.h>
-
-typedef int OPJ_BOOL;
-#define OPJ_TRUE 1
-#define OPJ_FALSE 0
-
-#include "opj_stdint.h"
+#include <stdint.h>
 
 typedef int8_t   OPJ_INT8;
 typedef uint8_t  OPJ_UINT8;
@@ -53,6 +48,9 @@ typedef int32_t  OPJ_INT32;
 typedef uint32_t OPJ_UINT32;
 typedef int64_t  OPJ_INT64;
 typedef uint64_t OPJ_UINT64;
+typedef int OPJ_BOOL;
+#define OPJ_TRUE 1
+#define OPJ_FALSE 0
 
 //************************************************************************/
 /** @brief HT decoding tables, as given in the standard
index eb6b9d4c11679bc26b18046f4dd6a3d6a35cb221..fc3550a7ace3e89d7d413d465189e4d593ef0799 100644 (file)
@@ -33,8 +33,8 @@
 #include <stdlib.h>
 #include <ctype.h>
 #include <assert.h>
+#include <inttypes.h>
 #include "box_manager.h"
-#include "opj_inttypes.h"
 
 #ifdef SERVER
 #include "fcgi_stdio.h"
index f5958f64f52f7a94d83d744aac2c3ade2e2e139a..d8f6ae6fe16ed1058ef85289bbd9622a6110a346 100644 (file)
@@ -32,8 +32,8 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdlib.h>
+#include <inttypes.h>
 #include "boxheader_manager.h"
-#include "opj_inttypes.h"
 
 #ifdef SERVER
 #include "fcgi_stdio.h"
index 57a7d5015d191bf36de2faffc5d09bbbfc6fe8af..02c806e0b3f1485db20ae32b1669d56e0c4d0025 100644 (file)
@@ -32,8 +32,8 @@
 #define     BYTE_MANAGER_H_
 
 #include <stddef.h>
+#include <stdint.h>
 #include "openjpeg.h"
-#include "opj_stdint.h"
 typedef uint8_t Byte_t;
 typedef uint16_t Byte2_t;
 typedef uint32_t Byte4_t;
index 0888fc9c2f4c422d36969682adf666fcf44a80b0..3e825b8eb791920a2fb6b4ffa2e015bf54b55b8f 100644 (file)
@@ -30,9 +30,9 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <inttypes.h>
 #include "cachemodel_manager.h"
 #include "faixbox_manager.h"
-#include "opj_inttypes.h"
 
 #ifdef SERVER
 #include "fcgi_stdio.h"
index 76a1a34ff9638c1dab718c4943c6068832d41f45..56ddd39c9f41c13a4132be1251660030ffb616c8 100644 (file)
@@ -29,8 +29,8 @@
  */
 
 #include <stdio.h>
+#include <inttypes.h>
 #include "codestream_manager.h"
-#include "opj_inttypes.h"
 
 #ifdef SERVER
 #include "fcgi_stdio.h"
index c257255a9c1bbb9d138358a51d6487919c092ba6..07d51630f425cdb9e465ba8a93044afe0fbbcccd 100644 (file)
 #include <string.h>
 #include <assert.h>
 #include <limits.h>
+#include <inttypes.h>
 #include "dec_clientmsg_handler.h"
 #include "ihdrbox_manager.h"
 #include "jpipstream_manager.h"
 #include "jp2k_encoder.h"
-#include "opj_inttypes.h"
 
 void handle_JPIPstreamMSG(SOCKET connected_socket, cachelist_param_t *cachelist,
                           Byte_t **jpipstream, OPJ_SIZE_T *streamlen, msgqueue_param_t *msgqueue)
index d0b410a25c0687d0cce6493b4b4ad07cdd27e4fc..55253afad0f69b27e5e6fd1600e9972d42fc8cfc 100644 (file)
@@ -30,8 +30,8 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <inttypes.h>
 #include "faixbox_manager.h"
-#include "opj_inttypes.h"
 
 #ifdef SERVER
 #include "fcgi_stdio.h"
index 64e760d772a843030031ec3bd920871efea03f89..17f5887ae097238200d9f3830192784c8dde016c 100644 (file)
@@ -32,8 +32,8 @@
 #include <stdlib.h>
 #include <math.h>
 #include <string.h>
+#include <inttypes.h>
 
-#include "opj_inttypes.h"
 #include "index_manager.h"
 #include "box_manager.h"
 #include "manfbox_manager.h"
index 80b98c7ec97c5dbf7369719ee4de614880e189c3..296c1efb0ac799fcad5ef85bb65d9a3ff738c179 100644 (file)
 #include <string.h>
 #include <math.h>
 #include <assert.h>
+#include <inttypes.h>
 #include "jp2k_encoder.h"
 #include "j2kheader_manager.h"
 #include "imgreg_manager.h"
-#include "opj_inttypes.h"
 
 
 #ifdef SERVER
index d7128b9442025c178f1edd9c2e8eeb5478b4a8d7..697f96fb01b797e3307021e755a3fbec44e807e3 100644 (file)
@@ -29,7 +29,7 @@
  */
 
 #include "metadata_manager.h"
-#include "opj_inttypes.h"
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 1a8eaa0863f7e483bd12efae4787d92fc68859a5..5f3bdfd613a4974c55e42d139fd51c072a23bdf1 100644 (file)
@@ -31,8 +31,8 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <inttypes.h>
 #include "mhixbox_manager.h"
-#include "opj_inttypes.h"
 
 #ifdef SERVER
 #include "fcgi_stdio.h"
index c65962710fcb2ec766678e3e8532226bdb9676db..5f939a9591e4f676633f156463250a27ae3ad74e 100644 (file)
@@ -37,6 +37,7 @@
 #include <ctype.h>
 #include <assert.h>
 #include <limits.h>
+#include <inttypes.h>
 #ifdef _WIN32
 #include <io.h>
 #else
@@ -45,7 +46,6 @@
 #include "msgqueue_manager.h"
 #include "metadata_manager.h"
 #include "index_manager.h"
-#include "opj_inttypes.h"
 
 #ifdef SERVER
 #include "fcgi_stdio.h"
index 2ffa20348672ec4aade23341e9986657c777903a..9d73567f29a0f62ef6419490e326855caf5dea27 100644 (file)
@@ -31,8 +31,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <inttypes.h>
 #include "placeholder_manager.h"
-#include "opj_inttypes.h"
 
 #ifdef SERVER
 #include "fcgi_stdio.h"
index 9b2fac2d2fbbcc5f5dc2897448307bfae65674e1..e192c73c218734a4d66f6847a5620ff6d30f4992 100644 (file)
@@ -42,8 +42,8 @@
 #include <assert.h>
 #include <string.h>
 #include <stdlib.h>
+#include <stdint.h>
 #include "query_parser.h"
-#include "opj_stdint.h"
 
 #ifdef SERVER
 #include "fcgi_stdio.h"
index 01d975749e924f2b1e6a31041c8e049ebe9dec0d..f33306c02f175aa6f44d0f0225e221904e4df58c 100644 (file)
@@ -32,7 +32,7 @@
 # define    SOCK_MANAGER_H_
 
 #include "byte_manager.h"
-#include "opj_stdint.h"
+#include <stdint.h>
 
 #ifdef _WIN32
 #include <winsock.h>