Skip to content

Commit d3a8d5f

Browse files
committed
DecodeHints: provide c++ ABI backward compatibility with 2.1.0
This might end up in a 2.2.1 release.
1 parent d940d91 commit d3a8d5f

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

core/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ if (BUILD_READERS)
105105
src/Content.h
106106
src/Content.cpp
107107
src/DecodeHints.h
108+
src/DecodeHints.cpp
108109
src/DecoderResult.h
109110
src/DetectorResult.h
110111
src/Error.h

core/src/DecodeHints.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright 2023 Axel Waggershauser
3+
*/
4+
// SPDX-License-Identifier: Apache-2.0
5+
6+
#define HIDE_DECODE_HINTS_ALIAS
7+
8+
#include "ReadBarcode.h"
9+
10+
namespace ZXing {
11+
12+
// Provide a struct that is binary compatible with ReaderOptions and is actually called DecodeHints so that
13+
// the compiler generates a correctly mangled pair of ReadBarcode(s) symbols to keep backward ABI compatibility.
14+
15+
struct DecodeHints
16+
{
17+
char data[sizeof(ReaderOptions)];
18+
};
19+
20+
Result ReadBarcode(const ImageView& image, const DecodeHints& hints = {})
21+
{
22+
return ReadBarcode(image, reinterpret_cast<const ReaderOptions&>(hints));
23+
}
24+
25+
Results ReadBarcodes(const ImageView& image, const DecodeHints& hints = {})
26+
{
27+
return ReadBarcodes(image, reinterpret_cast<const ReaderOptions&>(hints));
28+
}
29+
30+
} // ZXing

core/src/ReaderOptions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ class ReaderOptions
172172
bool hasFormat(BarcodeFormats f) const noexcept { return _formats.testFlags(f) || _formats.empty(); }
173173
};
174174

175+
#ifndef HIDE_DECODE_HINTS_ALIAS
175176
using DecodeHints [[deprecated]] = ReaderOptions;
177+
#endif
176178

177179
} // ZXing

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy