Freeciv-3.1
Loading...
Searching...
No Matches
ioz.h
Go to the documentation of this file.
1/**********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14#ifndef FC__IOZ_H
15#define FC__IOZ_H
16
17#ifdef __cplusplus
18extern "C" {
19#endif /* __cplusplus */
20
21/**********************************************************************
22 An IO layer to support transparent compression/uncompression.
23 (Currently only "required" functionality is supported.)
24***********************************************************************/
25
26#include <stdio.h> /* FILE */
27
28#include <freeciv_config.h>
29
30#include "shared.h" /* fc__attribute */
31
32struct fz_FILE_s; /* opaque */
33typedef struct fz_FILE_s fz_FILE;
34
35/* (Possibly) supported methods (depending on freeciv_config.h). */
38#ifdef FREECIV_HAVE_LIBZ
39 FZ_ZLIB,
40#endif
41#ifdef FREECIV_HAVE_LIBBZ2
42 FZ_BZIP2,
43#endif
44#ifdef FREECIV_HAVE_LIBLZMA
45 FZ_XZ,
46#endif
47#ifdef FREECIV_HAVE_LIBZSTD
48 FZ_ZSTD,
49#endif
50};
51
52fz_FILE *fz_from_file(const char *filename, const char *in_mode,
53 enum fz_method method, int compress_level);
54fz_FILE *fz_from_stream(FILE *stream);
55fz_FILE *fz_from_memory(char *buffer, int size, bool control);
56int fz_fclose(fz_FILE *fp);
57char *fz_fgets(char *buffer, int size, fz_FILE *fp);
58int fz_fprintf(fz_FILE *fp, const char *format, ...)
59 fc__attribute((__format__ (__printf__, 2, 3)));
60
61int fz_ferror(fz_FILE *fp);
62const char *fz_strerror(fz_FILE *fp);
63
64#ifdef __cplusplus
65}
66#endif /* __cplusplus */
67
68#endif /* FC__IOZ_H */
char * fz_fgets(char *buffer, int size, fz_FILE *fp)
Definition ioz.c:655
int fz_fprintf(fz_FILE *fp, const char *format,...) fc__attribute((__format__(__printf__
fz_method
Definition ioz.h:36
@ FZ_PLAIN
Definition ioz.h:37
fz_FILE * fz_from_stream(FILE *stream)
Definition ioz.c:548
int int fz_ferror(fz_FILE *fp)
Definition ioz.c:1099
fz_FILE * fz_from_memory(char *buffer, int size, bool control)
Definition ioz.c:207
fz_FILE * fz_from_file(const char *filename, const char *in_mode, enum fz_method method, int compress_level)
Definition ioz.c:230
const char * fz_strerror(fz_FILE *fp)
Definition ioz.c:1157
int fz_fclose(fz_FILE *fp)
Definition ioz.c:571
size_t size
Definition specvec.h:72
enum fz_method method
Definition ioz.c:150
#define fc__attribute(x)
Definition support.h:89