Open flat2010 opened 4 years ago
Original:
// output.h
#else
/** gzip compressed output */
#include <zlib.h>
typedef gzFile zfile;
#define zopen(fname, ...) (gzopen(fname, __VA_ARGS__))
#ifdef WIN32
#define zattach(FILEp, ...) (gzdopen(_fileno(FILEp), __VA_ARGS__))
#else
#define zattach(FILEp, ...) (gzdopen(fileno(FILEp), __VA_ARGS__))
#endif
#define zprintf(output, ...) (gzprintf(output, __VA_ARGS__))
#define zflush(FILEp) (gzflush(FILEp))
#define zclose(output) (gzclose(output))
#define zsuffix ".gz"
#endif
My fix:
// output.h
#else
/** gzip compressed output */
#include <zlib.h>
typedef gzFile zfile;
#define zopen(fname, ...) (gzopen(fname, __VA_ARGS__))
#ifdef WIN32
#define zattach(FILEp, ...) (gzdopen(_fileno(FILEp), __VA_ARGS__))
#define zflush(FILEp) (gzflush(FILEp))
#else
#define zattach(FILEp, ...) (gzdopen(fileno(FILEp), __VA_ARGS__))
// here we pass Z_FINISH to gzflush
#define zflush(FILEp) (gzflush(FILEp, Z_FINISH))
#endif
#define zprintf(output, ...) (gzprintf(output, __VA_ARGS__))
#define zclose(output) (gzclose(output))
#define zsuffix ".gz"
#endif
Files involved
joy-master/joy_config.h joy-master/src/p2f.c
Platform
Ubuntu 14.04 4.4.0-148
Problem
Step1: modify
joy_config.h
as follows:Step2: modify
p2f.c
as follows:Step3: then make
Error occurs:
This will happen when zflush called if gzip enabled.
Reason
According to Linux specification, gzflush needs 2 parameters which the last should be either:
But there's only 1 parameter in definition of zflush:
Fix