Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit67c0ef9

Browse files
committed
Improve const use in zlib-using code
If we define ZLIB_CONST before including zlib.h, zlib augments someinterfaces with const decorations. By doing that we can keep our owninterfaces cleaner and can remove some unconstify calls.ZLIB_CONST was introduced in zlib 1.2.5.2 (17 Dec 2011). Whencompiling with older zlib releases, you might now get compilerwarnings about discarding qualifiers.CentOS 6 has zlib 1.2.3, but in8e278b6, we removed support for theOpenSSL release in CentOS 6, so it seems ok to de-support the zlibrelease in CentOS 6 as well.Reviewed-by: Tristan Partin <tristan@neon.tech>Discussion:https://www.postgresql.org/message-id/flat/33462926-bb1e-7cc9-8d92-d86318e8ed1d%40eisentraut.org
1 parentfdd79d8 commit67c0ef9

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

‎contrib/pgcrypto/pgp-compress.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ compress_process(PushFilter *next, void *priv, const uint8 *data, int len)
113113
/*
114114
* process data
115115
*/
116-
st->stream.next_in=unconstify(uint8*,data);
116+
st->stream.next_in=data;
117117
st->stream.avail_in=len;
118118
while (st->stream.avail_in>0)
119119
{

‎src/bin/pg_basebackup/bbstreamer_gzip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ bbstreamer_gzip_decompressor_content(bbstreamer *streamer,
269269
mystreamer= (bbstreamer_gzip_decompressor*)streamer;
270270

271271
zs=&mystreamer->zstream;
272-
zs->next_in= (uint8*)data;
272+
zs->next_in= (constuint8*)data;
273273
zs->avail_in=len;
274274

275275
/* Process the current chunk */

‎src/bin/pg_basebackup/walmethods.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ typedef struct TarMethodData
705705

706706
#ifdefHAVE_LIBZ
707707
staticbool
708-
tar_write_compressed_data(TarMethodData*tar_data,void*buf,size_tcount,
708+
tar_write_compressed_data(TarMethodData*tar_data,constvoid*buf,size_tcount,
709709
boolflush)
710710
{
711711
tar_data->zp->next_in=buf;
@@ -782,8 +782,7 @@ tar_write(Walfile *f, const void *buf, size_t count)
782782
#ifdefHAVE_LIBZ
783783
elseif (f->wwmethod->compression_algorithm==PG_COMPRESSION_GZIP)
784784
{
785-
if (!tar_write_compressed_data(tar_data,unconstify(void*,buf),
786-
count, false))
785+
if (!tar_write_compressed_data(tar_data,buf,count, false))
787786
return-1;
788787
f->currpos+=count;
789788
returncount;

‎src/include/c.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@
7575
#include<libintl.h>
7676
#endif
7777

78+
/* Define before including zlib.h to add const decorations to zlib API. */
79+
#ifdefHAVE_LIBZ
80+
#defineZLIB_CONST
81+
#endif
82+
7883

7984
/* ----------------------------------------------------------------
8085
*Section 1: compiler characteristics

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp