mirror of
https://github.com/fltk/fltk.git
synced 2026-05-27 19:10:24 +08:00
Fl_SVG_Image: remove use of gzdirect() that is absent in some old versions of zlib
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12519 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -79,15 +79,19 @@ float Fl_SVG_Image::svg_scaling_(int W, int H) {
|
|||||||
#if defined(HAVE_LIBZ)
|
#if defined(HAVE_LIBZ)
|
||||||
|
|
||||||
static char *svg_inflate(const char *fname) {
|
static char *svg_inflate(const char *fname) {
|
||||||
struct stat b;
|
FILE *in = fl_fopen(fname, "r");
|
||||||
fl_stat(fname, &b);
|
if (!in) return NULL;
|
||||||
long size = b.st_size;
|
unsigned char header[2];
|
||||||
|
fread(header, 2, 1, in);
|
||||||
|
int direct = (header[0] != 0x1f || header[1] != 0x8b);
|
||||||
|
fseek(in, 0, SEEK_END);
|
||||||
|
long size = ftell(in);
|
||||||
|
fclose(in);
|
||||||
int fd = fl_open_ext(fname, 1, 0);
|
int fd = fl_open_ext(fname, 1, 0);
|
||||||
if (fd < 0) return NULL;
|
if (fd < 0) return NULL;
|
||||||
gzFile gzf = gzdopen(fd, "r");
|
gzFile gzf = gzdopen(fd, "r");
|
||||||
if (!gzf) return NULL;
|
if (!gzf) return NULL;
|
||||||
int l;
|
int l;
|
||||||
int direct = gzdirect(gzf);
|
|
||||||
long out_size = direct ? size + 1 : 3*size + 1;
|
long out_size = direct ? size + 1 : 3*size + 1;
|
||||||
char *out = (char*)malloc(out_size);
|
char *out = (char*)malloc(out_size);
|
||||||
char *p = out;
|
char *p = out;
|
||||||
|
|||||||
Reference in New Issue
Block a user