1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-12 10:04:14 +02:00

Remove UNCONSTIFY() from gz compression module.

The ZLIB_CONST macro may be used since 1.2.5.2 (17 Dec 2011) to specify that the input buffers are const. This is sufficiently old to cover all non-EOL distributions, i.e. everything we test on.

Compiling on older distributions may generate warnings but will continue to work.
This commit is contained in:
David Steele 2023-08-07 12:38:33 +01:00
parent 6c75c99d0b
commit cbafcfabf2
4 changed files with 7 additions and 2 deletions

View File

@ -165,6 +165,8 @@ lib_yaml = dependency('yaml-0.1')
# Find required gz library
lib_z = dependency('zlib')
configuration.set('ZLIB_CONST', true, description: 'Require zlib const input buffer')
# Find optional libssh2 library
lib_ssh2 = dependency('libssh2', required: false)

View File

@ -29,6 +29,9 @@ Build Flags Generated by Configure
// Configuration path
#undef CFGOPTDEF_CONFIG_PATH
// Require zlib const input buffer
#define ZLIB_CONST
// Indicate that a function does not return
#define FN_NO_RETURN __attribute__((__noreturn__))

View File

@ -104,7 +104,7 @@ gzCompressProcess(THIS_VOID, const Buffer *uncompressed, Buffer *compressed)
this->stream.avail_in = (unsigned int)bufUsed(uncompressed);
// Not all versions of zlib (and none by default) will accept const input buffers
this->stream.next_in = UNCONSTIFY(unsigned char *, bufPtrConst(uncompressed));
this->stream.next_in = bufPtrConst(uncompressed);
}
}

View File

@ -90,7 +90,7 @@ gzDecompressProcess(THIS_VOID, const Buffer *compressed, Buffer *uncompressed)
this->stream.avail_in = (unsigned int)bufUsed(compressed);
// Not all versions of zlib (and none by default) will accept const input buffers
this->stream.next_in = UNCONSTIFY(unsigned char *, bufPtrConst(compressed));
this->stream.next_in = bufPtrConst(compressed);
}
this->stream.avail_out = (unsigned int)bufRemains(uncompressed);