Feature #725 ยป 0029-ioz.-ch-Drop-trailing-spaces.patch
| utility/ioz.c | ||
|---|---|---|
|
- Flexibility to add other methods if desired (eg, bzip2, arbitrary
|
||
|
external filter program, etc).
|
||
|
FIXME: when zlib support _not_ included, should sanity check whether
|
||
|
FIXME: When zlib support _not_ included, should sanity check whether
|
||
|
the first few bytes are gzip marker and complain if so.
|
||
|
***********************************************************************/
|
||
| ... | ... | |
|
if (j < size - 2) {
|
||
|
/* Space for both newline and terminating '\0' */
|
||
|
if (i + 1 < fp->u.mem.size
|
||
|
if (i + 1 < fp->u.mem.size
|
||
|
&& fp->u.mem.buffer[i] == '\r'
|
||
|
&& fp->u.mem.buffer[i + 1] == '\n') {
|
||
|
i += 2;
|
||
| ... | ... | |
|
retval = nullptr;
|
||
|
} else {
|
||
|
retval = buffer;
|
||
|
}
|
||
|
}
|
||
|
if (fp->u.bz2.error == BZ_STREAM_END) {
|
||
|
/* EOF reached. Do not BZ2_bzRead() any more. */
|
||
|
fp->u.bz2.eof = TRUE;
|
||
| utility/ioz.h | ||
|---|---|---|
|
extern "C" {
|
||
|
#endif /* __cplusplus */
|
||
|
/**********************************************************************
|
||
|
/***********************************************************************
|
||
|
An IO layer to support transparent compression/uncompression.
|
||
|
(Currently only "required" functionality is supported.)
|
||
|
***********************************************************************/
|
||
| ... | ... | |
|
#include <freeciv_config.h>
|
||
|
/* utility */
|
||
|
#include "shared.h" /* fc__attribute */
|
||
|
struct fz_FILE_s; /* opaque */
|
||
| ... | ... | |
|
int fz_fclose(fz_FILE *fp);
|
||
|
char *fz_fgets(char *buffer, int size, fz_FILE *fp);
|
||
|
int fz_fprintf(fz_FILE *fp, const char *format, ...)
|
||
|
fc__attribute((__format__ (__printf__, 2, 3)));
|
||
|
fc__attribute((__format__ (__printf__, 2, 3)));
|
||
|
int fz_ferror(fz_FILE *fp);
|
||
|
int fz_ferror(fz_FILE *fp);
|
||
|
const char *fz_strerror(fz_FILE *fp);
|
||
|
#ifdef __cplusplus
|
||