summaryrefslogtreecommitdiff
path: root/backend/epub
AgeCommit message (Collapse)AuthorFilesLines
13 daysepub: Expose GepubDoc handle via EvDocument virtual methodVictor Kareh1-0/+8
Add a get_doc_handle virtual method to EvDocumentClass so the view layer can obtain the underlying GepubDoc without depending on backend types directly. This prepares for replacing EvWebView with GepubWidget which needs the GepubDoc to render content. Assisted-by: OpenCode:claude-opus-4-6
13 daysepub: Remove dead code and unused virtual methodsVictor Kareh7-2981/+0
Remove the bundled minizip directory, unused includes, and the night mode virtual methods from EvDocumentClass which are no longer called by any code. Night mode is now handled entirely through WebKit user stylesheets. Assisted-by: OpenCode:claude-opus-4-6
13 daysepub: Pre-compute page paths and disable find interfaceVictor Kareh1-33/+27
Pre-compute all page URI paths at load time so get_page is thread-safe and does not mutate GepubDoc state. Remove the EvDocumentFind interface because the threaded find job is incompatible with the single-threaded GepubDoc and WebKit. EPUB search will be reimplemented using WebKit's native find controller in a future commit. Assisted-by: OpenCode:claude-opus-4-6
13 daysepub: Implement night mode using WebKit user stylesheetsVictor Kareh1-12/+0
Replace the old approach of modifying extracted HTML files on disk with a WebKitUserStyleSheet injected via the WebKitUserContentManager. This is cleaner and works with the new libgepub backend which no longer extracts files to a temporary directory. Assisted-by: OpenCode:claude-opus-4-6
13 daysepub: Replace backend internals with libgepubVictor Kareh3-1697/+249
Replace the hand-rolled EPUB parsing with libgepub. This removes the bundled minizip library, custom XML utilities, and temporary directory extraction in favor of GepubDoc which handles archive access, metadata, spine navigation, and table of contents. An epub:// URI scheme handler serves resources directly from the archive without extracting to disk. Search and night mode are stubbed as no-ops pending follow-up commits. Assisted-by: OpenCode:claude-opus-4-6
13 daysepub: Add libgepub-0.7 build dependencyVictor Kareh1-0/+1
Add libgepub as a required dependency for the EPUB backend in both meson and autotools build systems. No source code changes yet, but this prepares for replacing the hand-rolled EPUB parsing with libgepub. Assisted-by: OpenCode:claude-opus-4-6
2026-06-06epub: add NULL guards to prevent crashes with malformed EPUBsVictor Kareh1-1/+8
EPUB files with missing or incomplete metadata (like no title or missing navigation elements) can cause NULL pointer dereferences in the XML parsing functions. This adds NULL checks to xml_parse_children_of_node, get_child_list, and the TOC text parsing loop. Fixes #707
2026-06-02epub: validate epub content before parsingVictor Kareh1-3/+20
Check that the content file exists before attempting to parse it, and handle failures in document title extraction gracefully.
2026-06-02epub: use g_strndup for parsing document pathVictor Kareh1-9/+2
Replace manual byte-by-byte copy loop with g_strndup when extracting the directory component from the epub container's full-path attribute.
2025-12-23epub: Try and locate MathJax at configure timeColomban Wendling1-1/+1
Based on an XReader change[1], look up the MathJax source at configure time for better portability. If not specified manually, look in the common locations. This adds the --with-mathjax-directory=DIR configure option to manually specify the location, overriding the automatic discovery. The Meson part already exists, although was not used by the code. [1]: https://github.com/linuxmint/xreader/commit/9c6f363ad47f33b290d270489e50f7ad6071987a
2025-04-04fix: rename all backend filesOz Tiram1-1/+1
Signed-off-by: Oz Tiram <[email protected]>
2025-04-04chore: remove unused intltoolOz Tiram1-7/+7
Signed-off-by: Oz Tiram <[email protected]>
2025-04-04Initial support for mesonOz Tiram2-0/+56
Mostly copy and paste from linuxmint/xreader Signed-off-by: Oz Tiram <[email protected]>
2024-01-31epub: fix previous commitraveit651-1/+1
2024-01-31fix a incompatible pointer type warning for gcc14raveit651-2/+2
* fix a incompatible pointer type warning for gcc14 Co-authored-by: Colomban Wendling <[email protected]>
2024-01-31epub: Avoid crash when index list has extraneous entrycorrectmost1-2/+2
This commit also fixes an incorrect sizeof call detected by AddressSanitizer. Closes #599
2024-01-17epub: Prevent path traversal when extracting fileslukefromdc1-6/+22
Test each file's resolved path against the temporary directory before extracting.
2022-11-17epub: add fallback for malformed epub files in check_mime_typerbuj1-28/+38
2022-08-04epub: Fix index loading for certain documents - look for epub:typeMichael Webster1-1/+7
instead of epub:id. Add a null check as well. ref: https://help.apple.com/itc/booksassetguide/en.lproj/itc0f175a5b9.html#apdd3c4c6d1c0904 https://idpf.org/epub/301/spec/epub-contentdocs-20140626.html#sec-xhtml-nav
2022-01-02Remove warnings about redefining gettext support macrosrbuj1-2/+2
2021-11-20Use a blank line at mostrbuj5-75/+0
2021-04-01epub: declaration of ‘uL’ shadows a previous local [-Wshadow]rbuj1-2/+0
2021-04-01epub: fix typorbuj1-1/+1
2021-02-10build: allow users to disable gettext support (--disable-nls)rbuj1-1/+5
2020-10-24epub backend: Escape link text to display & in index contentrbuj1-1/+1
2020-08-28epub-document: improve code-styleraveit651-552/+552
- tab to spaces - fix some indents
2020-08-26check return value of xmlDocGetRootElement call if is NULLlvtao-sec1-2/+12
2020-07-10Fix segfault on empty navMaperrt1-2/+2
2020-04-15Fix cppcheck [knownConditionTrueFalse] warningsPablo Barciela1-6/+0
Fixes the warnings: backend/comics/comics-document.c:767:21: style: Condition 'bytes<=0' is always true [knownConditionTrueFalse] backend/epub/minizip/unzip.c:603:25: style: Condition 'unz_copyright[0]!=' '' is always false [knownConditionTrueFalse] properties/ev-properties-view.c:197:33: style: Condition 'text' is always true [knownConditionTrueFalse] shell/ev-sidebar-thumbnails.c:598:7: style: Condition '!loading_icon' is always true [knownConditionTrueFalse] shell/main.c:115:6: style: Condition '!error' is always true [knownConditionTrueFalse]
2020-04-14Remove strict-prototypes warningrbuj1-1/+1
2020-04-14ev-window/epub-document: remove unused functionsPablo Barciela1-11/+0
Fixes the build warnings: ev-window.c:6379:1: warning: function 'menubar_deactivate_cb' is not needed and will not be emitted [-Wunneeded-internal-declaration] menubar_deactivate_cb (GtkWidget *menubar, ^ epub-document.c:946:1: warning: function 'check_add_page_numbers' is not needed and will not be emitted [-Wunneeded-internal-declaration] check_add_page_numbers(linknode *listdata, contentListNode *comparenode) ^
2020-04-13epub-document: Remove unused-variable warningrbuj1-7/+5
2020-04-10epub backend: build with WARN_CFLAGS instead WARN_CXXFLAGSPablo Barciela1-2/+2
2019-11-11migrate from intltool to gettextWu Xiaotian2-7/+8
2019-07-01Remove trailing whitespacesLaurent Napias3-109/+109
2018-03-16epub: allow to save epub documentsraveit651-1/+5
inspired by: https://github.com/linuxmint/xreader/commit/63a28f https://github.com/linuxmint/xreader/issues/165
2018-03-16epub: fix loading epub thumbnailsMickael Albertus1-3/+4
origin commit: https://github.com/linuxmint/xreader/commit/6ed0ee1 Note: origin commit causes some serious build warnings, ......fixed.
2018-01-16epub: make minizip support more BSD variantsmonsta1-1/+1
closes https://github.com/mate-desktop/atril/issues/290 which has the original patch
2015-12-17Fix crash for epubs when accessibility is enabledAndrey Gursky1-0/+11
Once epub support has been implemented, atril crashes with all epubs. Backtrace for 1.10.2+repack1-1 (Debian Stretch): Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffd26d2700 (LWP 22276)] 0x0000000000000000 in ?? () (gdb) bt #0 0x0000000000000000 in () #1 0x00007ffff755914e in ev_job_page_data_run (job=0x9e3850 [EvJobPageData]) at ev-jobs.c:762 #2 0x00007ffff755a85a in ev_job_thread_proxy (job=0x9e3850 [EvJobPageData]) at ev-job-scheduler.c:184 #3 0x00007ffff755a85a in ev_job_thread_proxy (data=<optimized out>) at ev-job-scheduler.c:217 #4 0x00007ffff14e1955 in g_thread_proxy (data=0x7fff84002280) at /build/glib2.0-VKSJTv/glib2.0-2.46.1/./glib/gthread.c:778 #5 0x00007ffff08690a4 in start_thread (arg=0x7fffd26d2700) at pthread_create.c:309 #6 0x00007ffff059e06d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111 (gdb) It turns out it couldn't really work since one function pointer is uninitialized. But nobody complained. Thus I investigated it further, why it fails only for me. First, I tried a gtk3 version. And it works properly, but the broken code is not hit at all. Due to the threaded design, it was harder to figure out, why. Here is the code path: --> ev_window_load_job_cb (shell/ev-window.c) --> ev_document_model_set_document (libview/ev-document-model.c) --> ev_view_document_changed_cb (libview/ev-view.c) --> setup_caches (libview/ev-view.c) --> if (ev_view_is_a11y_enabled (view)) { ev_page_cache_set_flags(); } ev_page_cache_set_flags (libview/ev-page-cache.c) --> ev_page_cache_set_page_range (libview/ev-page-cache.c) --> data->job = ev_job_page_data_new (cache->document, i, flags); ... ev_job_scheduler_push_job (data->job, EV_JOB_PRIORITY_NONE); ... --> ev_job_thread_proxy (libview/ev-job-scheduler.c) --> ev_job_page_data_run (libview/ev-jobs.c) --> ev_document_links_get_links (libdocument/ev-document-links.c) --> EvDocumentLinksInterface *iface = EV_DOCUMENT_LINKS_GET_IFACE (document_links); return iface->get_links (document_links, page); (get_links == NULL) --> crash As one can see it depends on the accessibility. And it is enabled on my box. It can be reproduced with gsettings set org.mate.interface accessibility true (mate logout and login) Why the enabled accessibility is not discovered by the gtk3 version is another story. My question [1] was motivated by this. [1] https://github.com/mate-desktop/atril/issues/171
2015-09-10epub: drop embedded MathJax in favor of using distro-packaged onemonsta257-4472/+2
closes https://github.com/mate-desktop/atril/issues/158
2015-01-22fix careless hack: don't do double-free, avoid weird crashesMonsta1-2/+1
because backends manager frees that var already. actually, adding ev_backends_manager_get_backends_dir to the public API was still careless. backends manager and epub document jobs seem to be in the different threads, and there's no mutex seen anywhere around. luckily, what we have here is just a reading of a variable that has been assigned only once (in backends_dir function), so it's not as catastrophic as it would be if it was e.g. concurrent writing without a mutex. Closes https://github.com/mate-desktop/atril/pull/124
2014-12-29epub: Fix some typosinfirit1-2/+2
Thanks to tibbi <[email protected]> for spotting them.
2014-12-10fix some more leaks and stuffMonsta1-2/+2
2014-12-08don't leak memoryMonsta1-100/+125
2014-12-08removed some code that had no effectmonsta1-1/+0
2014-12-08epub backend: more anti-NULL protection for epub_document_set_index_pagesMonsta1-1/+4
2014-12-08ePub: Can open documents which do not have tocrootavish1-2/+15
I always thought all ePub documents had either a traditional ncx or an epub3 nav. Now as it turns out, sometimes neither of these are present. Fixed.
2014-12-08ePub backend: unescape uri strings from tocrootavish1-0/+6
Toc may include links with strings escaped for URI format. We needed to un-escape them.
2014-11-25properly return a value from non-void functionmonsta1-2/+2
2014-10-27Fix minizip Makefileinfirit1-3/+1