aboutsummaryrefslogtreecommitdiff
path: root/c
diff options
context:
space:
mode:
authorEvgenii Kliuchnikov <eustas@google.com>2023-07-30 03:44:38 -0700
committerCopybara-Service <copybara-worker@google.com>2023-07-30 03:45:11 -0700
commit27a9a80992e2308ef60bc6d840c8b59293c32d67 (patch)
treecb33f99de2956d231ba24cd509132aa09c45acee /c
parent0300be36ba019c55d2edc48353270fa18008d49c (diff)
downloadbrotli-27a9a80992e2308ef60bc6d840c8b59293c32d67.zip
brotli-27a9a80992e2308ef60bc6d840c8b59293c32d67.tar.gz
brotli-27a9a80992e2308ef60bc6d840c8b59293c32d67.tar.bz2
simplify CMake build
PiperOrigin-RevId: 552238545
Diffstat (limited to 'c')
-rw-r--r--c/common/version.h25
-rw-r--r--c/include/brotli/decode.h2
-rw-r--r--c/include/brotli/encode.h2
-rw-r--r--c/tools/brotli.c6
4 files changed, 24 insertions, 11 deletions
diff --git a/c/common/version.h b/c/common/version.h
index 01b2998..0939eb8 100644
--- a/c/common/version.h
+++ b/c/common/version.h
@@ -9,18 +9,31 @@
#ifndef BROTLI_COMMON_VERSION_H_
#define BROTLI_COMMON_VERSION_H_
-/* This macro should only be used when library is compiled together with client.
- If library is dynamically linked, use BrotliDecoderVersion and
+/* Compose 3 components into a single number. In a hexadecimal representation
+ B and C components occupy exactly 3 digits. */
+#define BROTLI_MAKE_HEX_VERSION(A, B, C) ((A << 24) | (B << 12) | C)
+
+/* Those macros should only be used when library is compiled together with
+ the client. If library is dynamically linked, use BrotliDecoderVersion and
BrotliEncoderVersion methods. */
-/* Semantic version, calculated as (MAJOR << 24) | (MINOR << 12) | PATCH */
-#define BROTLI_VERSION 0x1000009
+#define BROTLI_VERSION_MAJOR 1
+#define BROTLI_VERSION_MINOR 0
+#define BROTLI_VERSION_PATCH 9
+
+#define BROTLI_VERSION BROTLI_MAKE_HEX_VERSION( \
+ BROTLI_VERSION_MAJOR, BROTLI_VERSION_MINOR, BROTLI_VERSION_PATCH)
/* This macro is used by build system to produce Libtool-friendly soname. See
https://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html
+ Version evolution rules:
+ - interfaces added (or change is compatible) -> current+1:0:age+1
+ - interfaces removed (or changed is incompatible) -> current+1:0:0
+ - interfaces not changed -> current:revision+1:age
*/
-/* ABI version, calculated as (CURRENT << 24) | (REVISION << 12) | AGE */
-#define BROTLI_ABI_VERSION 0x1009000
+#define BROTLI_ABI_CURRENT 1
+#define BROTLI_ABI_REVISION 9
+#define BROTLI_ABI_AGE 0
#endif /* BROTLI_COMMON_VERSION_H_ */
diff --git a/c/include/brotli/decode.h b/c/include/brotli/decode.h
index 3c473d6..af1aa23 100644
--- a/c/include/brotli/decode.h
+++ b/c/include/brotli/decode.h
@@ -357,7 +357,7 @@ BROTLI_DEC_API const char* BrotliDecoderErrorString(BrotliDecoderErrorCode c);
/**
* Gets a decoder library version.
*
- * Look at BROTLI_VERSION for more information.
+ * Look at BROTLI_MAKE_HEX_VERSION for more information.
*/
BROTLI_DEC_API uint32_t BrotliDecoderVersion(void);
diff --git a/c/include/brotli/encode.h b/c/include/brotli/encode.h
index 7247d3d..dea9931 100644
--- a/c/include/brotli/encode.h
+++ b/c/include/brotli/encode.h
@@ -490,7 +490,7 @@ BROTLI_ENC_EXTRA_API size_t BrotliEncoderGetPreparedDictionarySize(
/**
* Gets an encoder library version.
*
- * Look at BROTLI_VERSION for more information.
+ * Look at BROTLI_MAKE_HEX_VERSION for more information.
*/
BROTLI_ENC_API uint32_t BrotliEncoderVersion(void);
diff --git a/c/tools/brotli.c b/c/tools/brotli.c
index b7afae3..f7e531e 100644
--- a/c/tools/brotli.c
+++ b/c/tools/brotli.c
@@ -561,9 +561,9 @@ static Command ParseParams(Context* params) {
}
static void PrintVersion(void) {
- int major = BROTLI_VERSION >> 24;
- int minor = (BROTLI_VERSION >> 12) & 0xFFF;
- int patch = BROTLI_VERSION & 0xFFF;
+ int major = BROTLI_VERSION_MAJOR;
+ int minor = BROTLI_VERSION_MINOR;
+ int patch = BROTLI_VERSION_PATCH;
fprintf(stdout, "brotli %d.%d.%d\n", major, minor, patch);
}