From 1c51b1157eff6bdbb32010503d5eea861ba2fc01 Mon Sep 17 00:00:00 2001 From: axxel Date: Sat, 16 Mar 2024 00:10:39 +0100 Subject: [PATCH] cmake: rename ZXING_HAS_... to ZXING_... This brings the cmake option in line with the #define in Version.h --- core/CMakeLists.txt | 2 -- core/Version.h.in | 4 ++-- core/src/ZXingC.cpp | 6 +++--- core/src/ZXingC.h | 18 +++++++++--------- wrappers/c/ZXingCTest.c | 2 +- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 27b762b70d..eaa940b8d4 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -607,8 +607,6 @@ install ( PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/ZXing" ) -set(ZXING_HAS_READERS ${ZXING_READERS}) -set(ZXING_HAS_WRITERS ${ZXING_WRITERS}) configure_file (Version.h.in Version.h) install ( diff --git a/core/Version.h.in b/core/Version.h.in index 40678ccec2..09105fca9c 100644 --- a/core/Version.h.in +++ b/core/Version.h.in @@ -6,8 +6,8 @@ #pragma once -#cmakedefine ZXING_HAS_READERS -#cmakedefine ZXING_HAS_WRITERS +#cmakedefine ZXING_READERS +#cmakedefine ZXING_WRITERS // Version numbering #define ZXING_VERSION_MAJOR @PROJECT_VERSION_MAJOR@ diff --git a/core/src/ZXingC.cpp b/core/src/ZXingC.cpp index 53a9b36221..37dc6f02b2 100644 --- a/core/src/ZXingC.cpp +++ b/core/src/ZXingC.cpp @@ -65,7 +65,7 @@ static uint8_t* copy(const ByteArray& ba, int* len) noexcept } \ ZX_CATCH({}) -#ifdef ZXING_HAS_READERS +#ifdef ZXING_READERS static std::tuple ReadBarcodesAndSetLastError(const ZXing_ImageView* iv, const ZXing_ReaderOptions* opts, int maxSymbols) { @@ -250,7 +250,7 @@ ZXing_Barcode* ZXing_Barcodes_move(ZXing_Barcodes* barcodes, int i) ZX_TRY(new Barcode(std::move((*barcodes)[i]))); } -#ifdef ZXING_HAS_READERS +#ifdef ZXING_READERS /* * ZXing/ReaderOptions.h @@ -319,7 +319,7 @@ ZXing_Barcodes* ZXing_ReadBarcodes(const ZXing_ImageView* iv, const ZXing_Reader #endif -#ifdef ZXING_HAS_WRITERS +#ifdef ZXING_WRITERS #ifdef ZXING_EXPERIMENTAL_API /* * ZXing/WriteBarcode.h diff --git a/core/src/ZXingC.h b/core/src/ZXingC.h index fbc5021a4e..49d0305f4c 100644 --- a/core/src/ZXingC.h +++ b/core/src/ZXingC.h @@ -13,7 +13,7 @@ #if __has_include("Version.h") #include "Version.h" #else -#define ZXING_HAS_READERS +#define ZXING_READERS #endif #ifdef __cplusplus @@ -26,14 +26,14 @@ typedef ZXing::Barcodes ZXing_Barcodes; typedef ZXing::ImageView ZXing_ImageView; typedef ZXing::Image ZXing_Image; -#ifdef ZXING_HAS_READERS +#ifdef ZXING_READERS #include "ReaderOptions.h" typedef ZXing::ReaderOptions ZXing_ReaderOptions; #endif #ifdef ZXING_EXPERIMENTAL_API -#ifdef ZXING_HAS_WRITERS +#ifdef ZXING_WRITERS #include "WriteBarcode.h" typedef ZXing::CreatorOptions ZXing_CreatorOptions; typedef ZXing::WriterOptions ZXing_WriterOptions; @@ -52,11 +52,11 @@ typedef struct ZXing_Barcodes ZXing_Barcodes; typedef struct ZXing_ImageView ZXing_ImageView; typedef struct ZXing_Image ZXing_Image; -#ifdef ZXING_HAS_READERS +#ifdef ZXING_READERS typedef struct ZXing_ReaderOptions ZXing_ReaderOptions; #endif -#ifdef ZXING_HAS_WRITERS +#ifdef ZXING_WRITERS typedef struct ZXing_CreatorOptions ZXing_CreatorOptions; typedef struct ZXing_WriterOptions ZXing_WriterOptions; #endif @@ -201,7 +201,7 @@ const ZXing_Barcode* ZXing_Barcodes_at(const ZXing_Barcodes* barcodes, int i); ZXing_Barcode* ZXing_Barcodes_move(ZXing_Barcodes* barcodes, int i); -#ifdef ZXING_HAS_READERS +#ifdef ZXING_READERS /* * ZXing/ReaderOptions.h @@ -268,9 +268,9 @@ int ZXing_ReaderOptions_getMaxNumberOfSymbols(const ZXing_ReaderOptions* opts); ZXing_Barcode* ZXing_ReadBarcode(const ZXing_ImageView* iv, const ZXing_ReaderOptions* opts); ZXing_Barcodes* ZXing_ReadBarcodes(const ZXing_ImageView* iv, const ZXing_ReaderOptions* opts); -#endif /* ZXING_HAS_READERS */ +#endif /* ZXING_READERS */ -#ifdef ZXING_HAS_WRITERS +#ifdef ZXING_WRITERS #ifdef ZXING_EXPERIMENTAL_API /* @@ -319,7 +319,7 @@ ZXing_Barcode* ZXing_CreateBarcodeFromBytes(const void* data, int size, const ZX char* ZXing_WriteBarcodeToSVG(const ZXing_Barcode* barcode, const ZXing_WriterOptions* opts); ZXing_Image* ZXing_WriteBarcodeToImage(const ZXing_Barcode* barcode, const ZXing_WriterOptions* opts); -#endif /* ZXING_HAS_WRITERS */ +#endif /* ZXING_WRITERS */ #endif /* ZXING_EXPERIMENTAL_API */ /* ZXing_LastErrorMsg() returns NULL in case there is no last error and a copy of the string otherwise. */ diff --git a/wrappers/c/ZXingCTest.c b/wrappers/c/ZXingCTest.c index 1dd7080842..52f6d06a83 100644 --- a/wrappers/c/ZXingCTest.c +++ b/wrappers/c/ZXingCTest.c @@ -74,7 +74,7 @@ int main(int argc, char** argv) CHECK(iv) } else { fprintf(stderr, "Could not read image '%s'\n", filename); -#if defined(ZXING_EXPERIMENTAL_API) && defined(ZXING_HAS_WRITERS) +#if defined(ZXING_EXPERIMENTAL_API) && defined(ZXING_WRITERS) if (formats == ZXing_BarcodeFormat_Invalid) return 2; fprintf(stderr, "Using '%s' as text input to create barcode\n", filename);