Skip to content

Commit

Permalink
Remove the Fl_SVG_Image::fl_gzopen() member function that is less use…
Browse files Browse the repository at this point in the history
…ful with the new fl_open_ext() function.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12491 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Manolo Gouy authored and Manolo Gouy committed Oct 13, 2017
1 parent b5027d4 commit db83933
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
1 change: 0 additions & 1 deletion FL/Fl_SVG_Image.H
Expand Up @@ -74,7 +74,6 @@ public:
virtual void color_average(Fl_Color c, float i);
virtual void draw(int X, int Y, int W, int H, int cx = 0, int cy = 0);
void draw(int X, int Y) { draw(X, Y, w(), h(), 0, 0); }
static void* fl_gzopen(const char *fname);
};

#endif // FL_SVG_IMAGE_H
Expand Down
15 changes: 3 additions & 12 deletions src/Fl_SVG_Image.cxx
Expand Up @@ -76,24 +76,15 @@ float Fl_SVG_Image::svg_scaling_(int W, int H) {
return (f1 < f2) ? f1 : f2;
}

/** Opens for reading a potentially gzip'ed file identified by a UTF-8 encoded filename. */
void* Fl_SVG_Image::fl_gzopen(const char *fname) {
#if defined(HAVE_LIBZ)
int fd = fl_open_ext(fname, 0, 0);
if (fd < 0) return NULL;
return gzdopen(fd, "r");
#else
return NULL;
#endif // HAVE_LIBZ
}

#if defined(HAVE_LIBZ)

static char *svg_inflate(const char *fname) {
struct stat b;
fl_stat(fname, &b);
long size = b.st_size;
gzFile gzf = (gzFile)Fl_SVG_Image::fl_gzopen(fname);
int fd = fl_open_ext(fname, 0, 0);
if (fd < 0) return NULL;
gzFile gzf = gzdopen(fd, "r");
if (!gzf) return NULL;
int l;
int direct = gzdirect(gzf);
Expand Down
5 changes: 4 additions & 1 deletion src/fl_images_core.cxx
Expand Up @@ -32,6 +32,7 @@
#include <FL/Fl_PNG_Image.H>
#include <FL/Fl_PNM_Image.H>
#include <FL/Fl_SVG_Image.H>
#include <FL/fl_utf8.h>
#include <stdio.h>
#include <stdlib.h>
#include "flstring.h"
Expand Down Expand Up @@ -94,7 +95,9 @@ fl_check_images(const char *name, // I - Filename
#ifdef FLTK_USE_NANOSVG
# if defined(HAVE_LIBZ)
if (header[0] == 0x1f && header[1] == 0x8b) { // denotes gzip'ed data
gzFile gzf = (gzFile)Fl_SVG_Image::fl_gzopen(name);
int fd = fl_open_ext(name, 0, 0);
if (fd < 0) return NULL;
gzFile gzf = gzdopen(fd, "r");
if (gzf) {
gzread(gzf, header, headerlen);
gzclose(gzf);
Expand Down

0 comments on commit db83933

Please sign in to comment.