Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit d923125

Browse files
committed
Fix incorrect uses of gzFile
gzFile is already a pointer, so code like gzFile *handle = gzopen(...) is wrong. This used to pass silently because gzFile used to be defined as void*, and you can assign a void* to a void**. But somewhere between zlib versions 1.2.3.4 and 1.2.6, the definition of gzFile was changed to struct gzFile_s *, and with that new definition this usage causes compiler warnings. So remove all those extra pointer decorations. There is a related issue in pg_backup_archiver.h, where FILE *FH; /* General purpose file handle */ is used throughout pg_dump as sometimes a real FILE* and sometimes a gzFile handle, which also causes warnings now. This is not yet fixed here, because it might need more code restructuring.
1 parent 8e5f430 commit d923125

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static bool segment_callback(XLogRecPtr segendpos, uint32 timeline);
8282

8383
#ifdef HAVE_LIBZ
8484
static const char *
85-
get_gz_error(gzFile *gzf)
85+
get_gz_error(gzFile gzf)
8686
{
8787
int errnum;
8888
const char *errmsg;
@@ -450,7 +450,7 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
450450
FILE *tarfile = NULL;
451451

452452
#ifdef HAVE_LIBZ
453-
gzFile *ztarfile = NULL;
453+
gzFile ztarfile = NULL;
454454
#endif
455455

456456
if (PQgetisnull(res, rownum, 0))

src/bin/pg_dump/pg_backup_files.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ typedef struct
6060
typedef struct
6161
{
6262
#ifdef HAVE_LIBZ
63-
gzFile *FH;
63+
gzFile FH;
6464
#else
6565
FILE *FH;
6666
#endif

src/bin/pg_dump/pg_backup_tar.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,13 @@ static void _EndBlobs(ArchiveHandle *AH, TocEntry *te);
5858
#define K_STD_BUF_SIZE 1024
5959

6060

61+
typedef struct
62+
{
6163
#ifdef HAVE_LIBZ
62-
/* typedef gzFile ThingFile; */
63-
typedef FILE ThingFile;
64+
gzFile zFH;
6465
#else
65-
typedef FILE ThingFile;
66+
FILE *zFH;
6667
#endif
67-
68-
typedef struct
69-
{
70-
ThingFile *zFH;
7168
FILE *nFH;
7269
FILE *tarFH;
7370
FILE *tmpFH;

0 commit comments

Comments
 (0)