diff options
author | Rodrigo Arias Mallo <rodarima@gmail.com> | 2025-05-02 00:18:00 +0200 |
---|---|---|
committer | Rodrigo Arias Mallo <rodarima@gmail.com> | 2025-05-02 00:18:00 +0200 |
commit | 2ed969fdec0f14798abb91184cbb95115d2f6c71 (patch) | |
tree | a07685839c2ac2e3cc7431e6663466f1543cdc99 | |
parent | 5ee0fdce3f5b219b8d5d9fc894a222f3a6127074 (diff) |
Print brotli version with -v
-rw-r--r-- | src/version.cc | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/src/version.cc b/src/version.cc index 88031d19..18eb5019 100644 --- a/src/version.cc +++ b/src/version.cc @@ -1,7 +1,7 @@ /* * Dillo web browser * - * Copyright 2024 Rodrigo Arias Mallo <rodarima@gmail.com> + * Copyright 2024-2025 Rodrigo Arias Mallo <rodarima@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,6 +28,10 @@ #include <FL/Fl.H> #include <zlib.h> +#ifdef ENABLE_BROTLI +#include <brotli/decode.h> +#endif + #include <stdio.h> static void print_libs() @@ -51,8 +55,6 @@ static void print_libs() printf(" fltk/%d.%d.%d", fltk_maj, fltk_min, fltk_pat); } - printf(" zlib/%s", zlibVersion()); - #ifdef ENABLE_JPEG printf(" jpeg/%s", a_Jpeg_version()); #endif @@ -65,6 +67,28 @@ static void print_libs() printf(" webp/%s", a_Webp_version(buf, 256)); #endif + printf(" zlib/%s", zlibVersion()); + +#ifdef ENABLE_BROTLI + /* From brotli: + * + * 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) + */ + { + /* Decode the version into each component */ + uint32_t br_ver = BrotliDecoderVersion(); + int br_maj = (br_ver >> 24) & 0x7ff; + int br_min = (br_ver >> 12) & 0x7ff; + int br_pat = (br_ver >> 0) & 0x7ff; + + printf(" brotli/%d.%d.%d", br_maj, br_min, br_pat); + } +#endif + + #ifdef ENABLE_TLS /* TLS prints the name/version format, as it determines which SSL * library is in use */ @@ -102,6 +126,11 @@ static void print_features() #else " -WEBP" #endif +#ifdef ENABLE_BROTLI + " +BROTLI" +#else + " -BROTLI" +#endif #if !( defined(DISABLE_XEMBED) || defined(WIN32) || defined(__APPLE__) ) " +XEMBED" #else |