diff options
Diffstat (limited to 'backend/epub')
-rw-r--r-- | backend/epub/Makefile.am | 6 | ||||
-rw-r--r-- | backend/epub/epub-document.c | 112 | ||||
-rw-r--r-- | backend/epub/minizip/ioapi.c | 6 | ||||
-rw-r--r-- | backend/epub/minizip/ioapi.h | 7 | ||||
-rw-r--r-- | backend/epub/minizip/unzip.c | 49 | ||||
-rw-r--r-- | backend/epub/minizip/unzip.h | 11 |
6 files changed, 75 insertions, 116 deletions
diff --git a/backend/epub/Makefile.am b/backend/epub/Makefile.am index 9eca6519..e1dee6ca 100644 --- a/backend/epub/Makefile.am +++ b/backend/epub/Makefile.am @@ -15,7 +15,7 @@ backend_LTLIBRARIES = libepubdocument.la libepubdocument_la_SOURCES = \ epub-document.c \ - epub-document.h + epub-document.h libepubdocument_la_LDFLAGS = $(BACKEND_LIBTOOL_FLAGS) libepubdocument_la_LIBADD = \ @@ -29,7 +29,11 @@ backend_in_files = epubdocument.atril-backend.desktop.in backend_DATA = $(backend_in_files:.atril-backend.desktop.in=.atril-backend) $(backend_DATA): $(backend_in_files) +if USE_NLS $(AM_V_GEN) $(MSGFMT) --desktop --keyword=TypeDescription --template $< -d $(top_srcdir)/po -o $@ +else + $(AM_V_GEN) cp -f $< $@ +endif EXTRA_DIST = $(backend_in_files) diff --git a/backend/epub/epub-document.c b/backend/epub/epub-document.c index 52530f47..b63f91cb 100644 --- a/backend/epub/epub-document.c +++ b/backend/epub/epub-document.c @@ -31,9 +31,9 @@ #include <libxml/parser.h> #include <libxml/xmlmemory.h> #include <libxml/HTMLparser.h> -#include <config.h> -#include <glib/gi18n.h> +#include <config.h> +#include <glib/gi18n-lib.h> #include <glib/gstdio.h> #include <gtk/gtk.h> @@ -224,7 +224,6 @@ epub_document_links_has_document_links(EvDocumentLinks *document_links) return TRUE; } - typedef struct _LinksCBStruct { GtkTreeModel *model; GtkTreeIter *parent; @@ -413,7 +412,6 @@ epub_remove_temporary_dir (gchar *path_name) return (g_remove (path_name)); } - static gboolean check_mime_type (const gchar* uri, GError** error); @@ -625,45 +623,55 @@ xml_get_data_from_node(xmlNodePtr node, static gboolean check_mime_type(const gchar* uri,GError** error) { - GError * err = NULL ; - const gchar* mimeFromFile = ev_file_get_mime_type(uri,FALSE,&err); + GError * err = NULL; + const gchar* mimeFromFile; - gchar* mimetypes[] = {"application/epub+zip","application/x-booki+zip"}; - int typecount = 2; - if ( !mimeFromFile ) + mimeFromFile = ev_file_get_mime_type(uri, FALSE, &err); + if (mimeFromFile) { - if (err) { - g_propagate_error (error, err); + const gchar* mimetypes[] = {"application/epub+zip", "application/x-booki+zip", NULL}; + guint i; + + for (i = 0; mimetypes[i]; i++) { + if (strcmp(mimeFromFile, mimetypes[i]) == 0) + return TRUE; } - else { - g_set_error_literal (error, - EV_DOCUMENT_ERROR, - EV_DOCUMENT_ERROR_INVALID, - _("Unknown MIME Type")); + + /* fallback for malformed epub files */ + if (strcmp (mimeFromFile, "application/zip") == 0) + { + mimeFromFile = ev_file_get_mime_type (uri, TRUE, &err); + if (mimeFromFile) + { + for (i = 0; i < G_N_ELEMENTS (mimetypes); i++) { + if (g_strcmp0(mimeFromFile, mimetypes[i]) == 0) + return TRUE; + } + + /*We didn't find a match*/ + g_set_error_literal (error, + EV_DOCUMENT_ERROR, + EV_DOCUMENT_ERROR_INVALID, + _("Not an ePub document")); + + return FALSE; + } } - return FALSE; } - else - { - int i=0; - for (i=0; i < typecount ;i++) { - if ( g_strcmp0(mimeFromFile, mimetypes[i]) == 0 ) { - return TRUE; - } - } - /*We didn't find a match*/ + if (err) + g_propagate_error (error, err); + else g_set_error_literal (error, - EV_DOCUMENT_ERROR, - EV_DOCUMENT_ERROR_INVALID, - _("Not an ePub document")); + EV_DOCUMENT_ERROR, + EV_DOCUMENT_ERROR_INVALID, + _("Unknown MIME Type")); - return FALSE; - } + return FALSE; } static gboolean -extract_one_file(EpubDocument* epub_document,GError ** error) +extract_one_file(EpubDocument* epub_document, GFile *tmp_gfile, GError ** error) { GFile * outfile ; gsize writesize = 0; @@ -690,6 +698,20 @@ extract_one_file(EpubDocument* epub_document,GError ** error) gfilepath = g_string_new(epub_document->tmp_archive_dir) ; g_string_append_printf(gfilepath,"/%s",(gchar*)currentfilename); + outfile = g_file_new_for_path (gfilepath->str); + g_autofree gchar *rpath = g_file_get_relative_path (tmp_gfile, outfile); + + if (rpath == NULL) + { + g_set_error_literal (error, + EV_DOCUMENT_ERROR, + EV_DOCUMENT_ERROR_INVALID, + _("epub file is invalid or corrupt")); + g_critical ("Invalid filename in Epub container - '%s'", (gchar *) currentfilename); + result = FALSE; + goto out; + } + /*if we encounter a directory, make a directory inside our temporary folder.*/ if (directory != NULL && *directory == '\0') { @@ -717,7 +739,6 @@ extract_one_file(EpubDocument* epub_document,GError ** error) g_string_free(dir_create,TRUE); } - outfile = g_file_new_for_path(gfilepath->str); outstream = g_file_create(outfile,G_FILE_CREATE_PRIVATE,NULL,error); gpointer buffer = g_malloc0(512); while ( (writesize = unzReadCurrentFile(epub_document->epubDocument,buffer,512) ) != 0 ) @@ -730,10 +751,10 @@ extract_one_file(EpubDocument* epub_document,GError ** error) } g_free(buffer); g_output_stream_close((GOutputStream*)outstream,NULL,error); - g_object_unref(outfile) ; - g_object_unref(outstream) ; + g_object_unref(outstream); out: + g_object_unref(outfile); unzCloseCurrentFile (epub_document->epubDocument) ; g_string_free(gfilepath,TRUE); g_free(currentfilename); @@ -745,6 +766,7 @@ extract_epub_from_container (const gchar* uri, EpubDocument *epub_document, GError ** error) { + GFile *tmp_gfile = NULL; GError *err = NULL; epub_document->archivename = g_filename_from_uri(uri,NULL,error); @@ -806,9 +828,10 @@ extract_epub_from_container (const gchar* uri, goto out; } + tmp_gfile = g_file_new_for_path (epub_document->tmp_archive_dir); while ( TRUE ) { - if ( extract_one_file(epub_document,&err) == FALSE ) + if ( extract_one_file(epub_document, tmp_gfile, &err) == FALSE ) { if (err) { g_propagate_error (error, err); @@ -829,6 +852,7 @@ extract_epub_from_container (const gchar* uri, } out: + g_clear_object (&tmp_gfile); unzClose(epub_document->epubDocument); return result; } @@ -1020,7 +1044,7 @@ setup_document_content_list(const gchar* content_uri, GError** error,gchar *docu } if ( xmlStrcmp(itemrefptr->name,(xmlChar*)"itemref") == 0) { - contentListNode *newnode = g_malloc0(sizeof(newnode)); + contentListNode *newnode = g_malloc0(sizeof(*newnode)); newnode->key = (gchar*)xml_get_data_from_node(itemrefptr,XML_ATTRIBUTE,(xmlChar*)"idref"); if ( newnode->key == NULL ) { @@ -1201,7 +1225,13 @@ setup_index_from_navfile(gchar *tocpath) GList *index = NULL; open_xml_document(tocpath); set_xml_root_node(NULL); - xmlNodePtr nav = xml_get_pointer_to_node((xmlChar*)"nav",(xmlChar*)"id",(xmlChar*)"toc"); + xmlNodePtr nav = xml_get_pointer_to_node((xmlChar*)"nav",(xmlChar*)"type",(xmlChar*)"toc"); + + if (nav == NULL) { + xml_free_doc(); + return NULL; + } + xmlretval=NULL; xml_parse_children_of_node(nav,(xmlChar*)"ol", NULL,NULL); gchar *navdirend = g_strrstr(tocpath,"/"); @@ -1546,7 +1576,6 @@ epub_document_check_add_night_sheet(EvDocument *document) gchar *csspath = g_strdup_printf("%s/atrilnightstyle.css",epub_document->documentdir); - GFile *styles = g_file_new_for_path (csspath); GOutputStream *outstream = (GOutputStream*)g_file_create(styles,G_FILE_CREATE_PRIVATE,NULL,NULL); if ( g_output_stream_write((GOutputStream*)outstream,style,strlen(style),NULL,NULL) == -1 ) @@ -1597,7 +1626,7 @@ page_set_function(linknode *Link, GList *contentList) contentListNode *pagedata; guint flag=0; - while (!flag) { + while (!flag && listiter) { pagedata = listiter->data; if (link_present_on_page(Link->pagelink, pagedata->value)) { flag=1; @@ -1620,7 +1649,6 @@ epub_document_set_index_pages(GList *index,GList *contentList) g_list_foreach(index,(GFunc)page_set_function,contentList); } - static void add_mathjax_script_node_to_file(gchar *filename, gchar *data) { @@ -1768,7 +1796,6 @@ epub_document_init (EpubDocument *epub_document) epub_document->docTitle = NULL; } - static void epub_document_finalize (GObject *object) { @@ -1810,7 +1837,6 @@ epub_document_finalize (GObject *object) G_OBJECT_CLASS (epub_document_parent_class)->finalize (object); } - static void epub_document_class_init (EpubDocumentClass *klass) { diff --git a/backend/epub/minizip/ioapi.c b/backend/epub/minizip/ioapi.c index 7f5c191b..c20d20e3 100644 --- a/backend/epub/minizip/ioapi.c +++ b/backend/epub/minizip/ioapi.c @@ -25,7 +25,6 @@ #define FSEEKO_FUNC(stream, offset, origin) fseeko64(stream, offset, origin) #endif - #include "ioapi.h" voidpf call_zopen64 (const zlib_filefunc64_32_def* pfilefunc,const void*filename,int mode) @@ -82,8 +81,6 @@ void fill_zlib_filefunc64_32_def_from_filefunc32(zlib_filefunc64_32_def* p_filef p_filefunc64_32->ztell32_file = p_filefunc32->ztell_file; } - - static voidpf ZCALLBACK fopen_file_func OF((voidpf opaque, const char* filename, int mode)); static uLong ZCALLBACK fread_file_func OF((voidpf opaque, voidpf stream, void* buf, uLong size)); static uLong ZCALLBACK fwrite_file_func OF((voidpf opaque, voidpf stream, const void* buf,uLong size)); @@ -128,7 +125,6 @@ static voidpf ZCALLBACK fopen64_file_func (voidpf opaque, const void* filename, return file; } - static uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void* buf, uLong size) { uLong ret; @@ -150,7 +146,6 @@ static long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream) return ret; } - static ZPOS64_T ZCALLBACK ftell64_file_func (voidpf opaque, voidpf stream) { ZPOS64_T ret; @@ -206,7 +201,6 @@ static long ZCALLBACK fseek64_file_func (voidpf opaque, voidpf stream, ZPOS64_T return ret; } - static int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream) { int ret; diff --git a/backend/epub/minizip/ioapi.h b/backend/epub/minizip/ioapi.h index 7a0f44ad..eaf6b303 100644 --- a/backend/epub/minizip/ioapi.h +++ b/backend/epub/minizip/ioapi.h @@ -110,7 +110,6 @@ typedef unsigned long long int ZPOS64_T; extern "C" { #endif - #define ZLIB_FILEFUNC_SEEK_CUR (1) #define ZLIB_FILEFUNC_SEEK_END (2) #define ZLIB_FILEFUNC_SEEK_SET (0) @@ -122,7 +121,6 @@ extern "C" { #define ZLIB_FILEFUNC_MODE_EXISTING (4) #define ZLIB_FILEFUNC_MODE_CREATE (8) - #ifndef ZCALLBACK #if (defined(WIN32) || defined(_WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK) #define ZCALLBACK CALLBACK @@ -131,9 +129,6 @@ extern "C" { #endif #endif - - - typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode)); typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size)); typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size)); @@ -143,7 +138,6 @@ typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stre typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream)); typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin)); - /* here is the "old" 32 bits structure structure */ typedef struct zlib_filefunc_def_s { @@ -185,7 +179,6 @@ typedef struct zlib_filefunc64_32_def_s seek_file_func zseek32_file; } zlib_filefunc64_32_def; - #define ZREAD64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zread_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size)) #define ZWRITE64(filefunc,filestream,buf,size) ((*((filefunc).zfile_func64.zwrite_file)) ((filefunc).zfile_func64.opaque,filestream,buf,size)) //#define ZTELL64(filefunc,filestream) ((*((filefunc).ztell64_file)) ((filefunc).opaque,filestream)) diff --git a/backend/epub/minizip/unzip.c b/backend/epub/minizip/unzip.c index 2ed54a11..3c4a6415 100644 --- a/backend/epub/minizip/unzip.c +++ b/backend/epub/minizip/unzip.c @@ -12,7 +12,6 @@ For more info read MiniZip_info.txt - ------------------------------------------------------------------------------------ Decryption code comes from crypt.c by Info-ZIP but has been greatly reduced in terms of compatibility with older software. The following is from the original crypt.c. @@ -48,7 +47,6 @@ Copyright (C) 2007-2008 Even Rouault - Oct-2009 - Mathias Svensson - Removed cpl_* from symbol names (Even Rouault added them but since this is now moved to a new project (minizip64) I renamed them again). Oct-2009 - Mathias Svensson - Fixed problem if uncompressed size was > 4G and compressed size was <4G should only read the compressed/uncompressed size from the Zip64 format if @@ -63,7 +61,6 @@ */ - #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -86,20 +83,17 @@ # include <errno.h> #endif - #ifndef local # define local static #endif /* compile with -Dlocal if your debugger can't find static symbols */ - #ifndef CASESENSITIVITYDEFAULT_NO # if !defined(unix) && !defined(CASESENSITIVITYDEFAULT_YES) # define CASESENSITIVITYDEFAULT_NO # endif #endif - #ifndef UNZ_BUFSIZE #define UNZ_BUFSIZE (16384) #endif @@ -118,14 +112,12 @@ #define SIZECENTRALDIRITEM (0x2e) #define SIZEZIPLOCALHEADER (0x1e) - /* unz_file_info_interntal contain internal info about a file in zipfile*/ typedef struct unz_file_info64_internal_s { ZPOS64_T offset_curfile;/* relative offset of local header 8 bytes */ } unz_file_info64_internal; - /* file_in_zip_read_info_s contain internal information about a file in zipfile, when reading and decompress it */ typedef struct @@ -156,7 +148,6 @@ typedef struct int raw; } file_in_zip64_read_info_s; - /* unz64_s contain internal information about the zipfile */ typedef struct @@ -189,7 +180,6 @@ typedef struct # endif } unz64_s; - #ifndef NOUNCRYPT #include "crypt.h" #endif @@ -197,10 +187,9 @@ typedef struct /* =========================================================================== Read a byte from a gz_stream; update next_in and avail_in. Return EOF for end of file. - IN assertion: the stream s has been sucessfully opened for reading. + IN assertion: the stream s has been successfully opened for reading. */ - local int unz64local_getByte OF(( const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, @@ -224,7 +213,6 @@ local int unz64local_getByte(const zlib_filefunc64_32_def* pzlib_filefunc_def, v } } - /* =========================================================================== Reads a long in LSB order from the given gz_stream. Sets */ @@ -295,7 +283,6 @@ local int unz64local_getLong64 OF(( voidpf filestream, ZPOS64_T *pX)); - local int unz64local_getLong64 (const zlib_filefunc64_32_def* pzlib_filefunc_def, voidpf filestream, ZPOS64_T *pX) @@ -364,7 +351,6 @@ local int strcmpcasenosensitive_internal (const char* fileName1, const char* fil } } - #ifdef CASESENSITIVITYDEFAULT_NO #define CASESENSITIVITYDEFAULTVALUE 2 #else @@ -418,7 +404,6 @@ local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0) return 0; - uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream); if (uMaxBack>uSizeFile) @@ -463,7 +448,6 @@ local ZPOS64_T unz64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f return uPosFound; } - /* Locate the Central directory 64 of a zipfile (at the end, just before the global comment) @@ -486,7 +470,6 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib if (ZSEEK64(*pzlib_filefunc_def,filestream,0,ZLIB_FILEFUNC_SEEK_END) != 0) return 0; - uSizeFile = ZTELL64(*pzlib_filefunc_def,filestream); if (uMaxBack>uSizeFile) @@ -605,8 +588,6 @@ local unzFile unzOpenInternal (const void *path, us.z_filefunc = *pzlib_filefunc64_32_def; us.is64bitOpenFunction = is64bitOpenFunction; - - us.filestream = ZOPEN64(us.z_filefunc, path, ZLIB_FILEFUNC_MODE_READ | @@ -745,7 +726,6 @@ local unzFile unzOpenInternal (const void *path, us.pfile_in_zip_read = NULL; us.encrypted = 0; - s=(unz64_s*)ALLOC(sizeof(unz64_s)); if( s != NULL) { @@ -755,7 +735,6 @@ local unzFile unzOpenInternal (const void *path, return (unzFile)s; } - extern unzFile ZEXPORT unzOpen2 (const char *path, zlib_filefunc_def* pzlib_filefunc32_def) { @@ -814,7 +793,6 @@ extern int ZEXPORT unzClose (unzFile file) return UNZ_OK; } - /* Write info about the ZipFile in the *pglobal_info structure. No preparation of the structure is needed @@ -897,7 +875,6 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file, ZLIB_FILEFUNC_SEEK_SET)!=0) err=UNZ_ERRNO; - /* we check the magic */ if (err==UNZ_OK) { @@ -1002,7 +979,6 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file, else lSeek += file_info.size_file_extra; - if ((err==UNZ_OK) && (file_info.size_file_extra != 0)) { uLong acc = 0; @@ -1032,8 +1008,6 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file, /* ZIP64 extra fields */ if (headerId == 0x0001) { - uLong uL; - if(file_info.uncompressed_size == MAXU32) { if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK) @@ -1098,7 +1072,6 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file, else lSeek+=file_info.size_file_comment; - if ((err==UNZ_OK) && (pfile_info!=NULL)) *pfile_info=file_info; @@ -1108,8 +1081,6 @@ local int unz64local_GetCurrentFileInfoInternal (unzFile file, return err; } - - /* Write info about the ZipFile in the *pglobal_info structure. No preparation of the structure is needed @@ -1158,7 +1129,6 @@ extern int ZEXPORT unzGetCurrentFileInfo (unzFile file, pfile_info->tmu_date = file_info64.tmu_date, - pfile_info->compressed_size = (uLong)file_info64.compressed_size; pfile_info->uncompressed_size = (uLong)file_info64.uncompressed_size; @@ -1214,7 +1184,6 @@ extern int ZEXPORT unzGoToNextFile (unzFile file) return err; } - /* Try locate the file szFileName in the zipfile. For the iCaseSensitivity signification, see unzStringFileNameCompare @@ -1236,7 +1205,6 @@ extern int ZEXPORT unzLocateFile (unzFile file, const char *szFileName, int iCas ZPOS64_T num_fileSaved; ZPOS64_T pos_in_central_dirSaved; - if (file==NULL) return UNZ_PARAMERROR; @@ -1280,7 +1248,6 @@ extern int ZEXPORT unzLocateFile (unzFile file, const char *szFileName, int iCas return err; } - /* /////////////////////////////////////////// // Contributed by Ryan Haksi (mailto://[email protected]) @@ -1393,7 +1360,6 @@ local int unz64local_CheckCurrentFileCoherencyHeader (unz64_s* s, uInt* piSizeVa s->byte_before_the_zipfile,ZLIB_FILEFUNC_SEEK_SET)!=0) return UNZ_ERRNO; - if (err==UNZ_OK) { if (unz64local_getLong(&s->z_filefunc, s->filestream,&uMagic) != UNZ_OK) @@ -1596,7 +1562,6 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method, pfile_in_zip_read_info->rest_read_uncompressed = s->cur_file_info.uncompressed_size ; - pfile_in_zip_read_info->pos_in_zipfile = s->cur_file_info_internal.offset_curfile + SIZEZIPLOCALHEADER + iSizeVar; @@ -1628,7 +1593,6 @@ extern int ZEXPORT unzOpenCurrentFile3 (unzFile file, int* method, } # endif - return UNZ_OK; } @@ -1689,7 +1653,6 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) if (pfile_in_zip_read_info==NULL) return UNZ_PARAMERROR; - if (pfile_in_zip_read_info->read_buffer == NULL) return UNZ_END_OF_LIST_OF_FILE; if (len==0) @@ -1733,7 +1696,6 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) uReadThis)!=uReadThis) return UNZ_ERRNO; - # ifndef NOUNCRYPT if(s->encrypted) { @@ -1745,7 +1707,6 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) } # endif - pfile_in_zip_read_info->pos_in_zipfile += uReadThis; pfile_in_zip_read_info->rest_read_compressed-=uReadThis; @@ -1876,7 +1837,6 @@ extern int ZEXPORT unzReadCurrentFile (unzFile file, voidp buf, unsigned len) return err; } - /* Give the current position in uncompressed data */ @@ -1911,7 +1871,6 @@ extern ZPOS64_T ZEXPORT unztell64 (unzFile file) return pfile_in_zip_read_info->total_out_64; } - /* return 1 if the end of file was reached, 0 elsewhere */ @@ -1933,8 +1892,6 @@ extern int ZEXPORT unzeof (unzFile file) return 0; } - - /* Read extra field from the current file (opened by unzOpenCurrentFile) This is the local-header version of the extra field (sometimes, there is @@ -2009,7 +1966,6 @@ extern int ZEXPORT unzCloseCurrentFile (unzFile file) if (pfile_in_zip_read_info==NULL) return UNZ_PARAMERROR; - if ((pfile_in_zip_read_info->rest_read_uncompressed == 0) && (!pfile_in_zip_read_info->raw)) { @@ -2017,7 +1973,6 @@ extern int ZEXPORT unzCloseCurrentFile (unzFile file) err=UNZ_CRCERROR; } - TRYFREE(pfile_in_zip_read_info->read_buffer); pfile_in_zip_read_info->read_buffer = NULL; if (pfile_in_zip_read_info->stream_initialised == Z_DEFLATED) @@ -2027,7 +1982,6 @@ extern int ZEXPORT unzCloseCurrentFile (unzFile file) BZ2_bzDecompressEnd(&pfile_in_zip_read_info->bstream); #endif - pfile_in_zip_read_info->stream_initialised = 0; TRYFREE(pfile_in_zip_read_info); @@ -2036,7 +1990,6 @@ extern int ZEXPORT unzCloseCurrentFile (unzFile file) return err; } - /* Get the global comment string of the ZipFile, in the szComment buffer. uSizeBuf is the size of the szComment buffer. diff --git a/backend/epub/minizip/unzip.h b/backend/epub/minizip/unzip.h index 2104e391..5c5a3f99 100644 --- a/backend/epub/minizip/unzip.h +++ b/backend/epub/minizip/unzip.h @@ -70,7 +70,6 @@ typedef unzFile__ *unzFile; typedef voidp unzFile; #endif - #define UNZ_OK (0) #define UNZ_END_OF_LIST_OF_FILE (-100) #define UNZ_ERRNO (Z_ERRNO) @@ -162,7 +161,6 @@ extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1, (like 1 on Unix, 2 on Windows) */ - extern unzFile ZEXPORT unzOpen OF((const char *path)); extern unzFile ZEXPORT unzOpen64 OF((const void *path)); /* @@ -180,7 +178,6 @@ extern unzFile ZEXPORT unzOpen64 OF((const void *path)); does not describe the reality */ - extern unzFile ZEXPORT unzOpen2 OF((const char *path, zlib_filefunc_def* pzlib_filefunc_def)); /* @@ -212,7 +209,6 @@ extern int ZEXPORT unzGetGlobalInfo64 OF((unzFile file, No preparation of the structure is needed return UNZ_OK if there is no problem. */ - extern int ZEXPORT unzGetGlobalComment OF((unzFile file, char *szComment, uLong uSizeBuf)); @@ -222,7 +218,6 @@ extern int ZEXPORT unzGetGlobalComment OF((unzFile file, return the number of byte copied or an error code <0 */ - /***************************************************************************/ /* Unzip package allow you browse the directory of the zipfile */ @@ -251,7 +246,6 @@ extern int ZEXPORT unzLocateFile OF((unzFile file, UNZ_END_OF_LIST_OF_FILE if the file is not found */ - /* ****************************************** */ /* Ryan supplied functions */ /* unz_file_info contain information about a file in the zipfile */ @@ -315,14 +309,12 @@ extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file, (commentBufferSize is the size of the buffer) */ - /** Addition for GDAL : START */ extern ZPOS64_T ZEXPORT unzGetCurrentFileZStreamPos64 OF((unzFile file)); /** Addition for GDAL : END */ - /***************************************************************************/ /* for reading the content of the current zipfile, you can open it, read data from it, and close it (you can close it before reading all the file) @@ -369,7 +361,6 @@ extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file, but you CANNOT set method parameter as NULL */ - extern int ZEXPORT unzCloseCurrentFile OF((unzFile file)); /* Close the file in zip opened with unzOpenCurrentFile @@ -428,8 +419,6 @@ extern uLong ZEXPORT unzGetOffset (unzFile file); extern int ZEXPORT unzSetOffset64 (unzFile file, ZPOS64_T pos); extern int ZEXPORT unzSetOffset (unzFile file, uLong pos); - - #ifdef __cplusplus } #endif |