Commit d923125b authored by Peter Eisentraut's avatar Peter Eisentraut

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.
parent 8e5f4300
...@@ -82,7 +82,7 @@ static bool segment_callback(XLogRecPtr segendpos, uint32 timeline); ...@@ -82,7 +82,7 @@ static bool segment_callback(XLogRecPtr segendpos, uint32 timeline);
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
static const char * static const char *
get_gz_error(gzFile *gzf) get_gz_error(gzFile gzf)
{ {
int errnum; int errnum;
const char *errmsg; const char *errmsg;
...@@ -450,7 +450,7 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum) ...@@ -450,7 +450,7 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
FILE *tarfile = NULL; FILE *tarfile = NULL;
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
gzFile *ztarfile = NULL; gzFile ztarfile = NULL;
#endif #endif
if (PQgetisnull(res, rownum, 0)) if (PQgetisnull(res, rownum, 0))
......
...@@ -60,7 +60,7 @@ typedef struct ...@@ -60,7 +60,7 @@ typedef struct
typedef struct typedef struct
{ {
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
gzFile *FH; gzFile FH;
#else #else
FILE *FH; FILE *FH;
#endif #endif
......
...@@ -58,16 +58,13 @@ static void _EndBlobs(ArchiveHandle *AH, TocEntry *te); ...@@ -58,16 +58,13 @@ static void _EndBlobs(ArchiveHandle *AH, TocEntry *te);
#define K_STD_BUF_SIZE 1024 #define K_STD_BUF_SIZE 1024
typedef struct
{
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
/* typedef gzFile ThingFile; */ gzFile zFH;
typedef FILE ThingFile;
#else #else
typedef FILE ThingFile; FILE *zFH;
#endif #endif
typedef struct
{
ThingFile *zFH;
FILE *nFH; FILE *nFH;
FILE *tarFH; FILE *tarFH;
FILE *tmpFH; FILE *tmpFH;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment