jasper/jasper-3.0.0-class-cplusplus-keyword.patch

49 lines
2.0 KiB
Diff
Raw Normal View History

From 39047be58de0f7f1e58b9866ef7f78722fba9bf1 Mon Sep 17 00:00:00 2001
From: Michael Adams <mdadams@ece.uvic.ca>
Date: Sat, 12 Feb 2022 07:36:21 -0800
Subject: [PATCH] Fixes #318.
Eliminated the use of "class" as an identifier, as this will clearly cause
problems if JasPer headers are used in C++ source code.
In order to catch incompatibilities with C++ in the future, a trivial C++
test program has been added.
The CMake build process was adjusted to (optionally) allow the use of a
C++ compiler.
Each use of add_compile_options that sets C compiler options was changed
to use a new function called add_c_compile_options that only sets options
for the C compiler.
Some changes to the CMake module for code sanitizers were made in order to
handle the C++ compiler case.
Several new options were added to the build script.
---
CMakeLists.txt | 61 ++++++++++++++++----------
build/build | 26 +++++++++++
build/build_all | 36 +++++++++++++++
build/cmake/modules/Sanitizers.cmake | 6 +++
src/app/CMakeLists.txt | 8 ++++
src/app/test_2.cpp | 21 +++++++++
src/libjasper/include/jasper/jas_log.h | 6 +--
7 files changed, 137 insertions(+), 27 deletions(-)
create mode 100644 src/app/test_2.cpp
diff --git a/src/libjasper/include/jasper/jas_log.h b/src/libjasper/include/jasper/jas_log.h
index e2ef5b61..dc4228b5 100644
--- a/src/libjasper/include/jasper/jas_log.h
+++ b/src/libjasper/include/jasper/jas_log.h
@@ -119,11 +119,11 @@ typedef int (jas_vlogmsgf_t)(jas_logtype_t, const char *, va_list);
/*!
@brief Create an instance of a logtype.
*/
-static inline jas_logtype_t jas_logtype_init(int class, int priority)
+static inline jas_logtype_t jas_logtype_init(int clas, int priority)
{
- assert(class >= 0 && class < JAS_LOGTYPE_NUM_CLASSES);
+ assert(clas >= 0 && clas < JAS_LOGTYPE_NUM_CLASSES);
assert(priority >= 0 && priority <= JAS_LOGTYPE_MAX_PRIORITY);
- return (class & 0xf) | (priority << 4);
+ return (clas & 0xf) | (priority << 4);
}
/*!