diff options
| author | Victor Kareh <[email protected]> | 2026-05-29 13:04:41 -0400 |
|---|---|---|
| committer | Victor Kareh <[email protected]> | 2026-06-02 16:29:59 -0400 |
| commit | f50db4bff9acd01dfc87eccc1c452a0ee54ba89e (patch) | |
| tree | 9abdbe4af4cfbbc955b72452b9c40c4764755d84 | |
| parent | 22edb7f56f2a667177723a32a57a13fa077ddd47 (diff) | |
| download | atril-f50db4bff9acd01dfc87eccc1c452a0ee54ba89e.tar.bz2 atril-f50db4bff9acd01dfc87eccc1c452a0ee54ba89e.tar.xz | |
epub: use g_strndup for parsing document path
Replace manual byte-by-byte copy loop with g_strndup when extracting the
directory component from the epub container's full-path attribute.
| -rw-r--r-- | backend/epub/epub-document.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/backend/epub/epub-document.c b/backend/epub/epub-document.c index 224ab4b8..4aefb336 100644 --- a/backend/epub/epub-document.c +++ b/backend/epub/epub-document.c @@ -921,15 +921,8 @@ get_uri_to_content(const gchar* uri,GError ** error,EpubDocument *epub_document) gchar* documentfolder = g_strrstr((gchar*)relativepath,"/"); if (documentfolder != NULL) { - gchar* copybuffer = (gchar*)relativepath ; - gchar* directorybuffer = g_malloc0(sizeof(gchar*)*100); - gchar* writer = directorybuffer; - - while(copybuffer != documentfolder) { - (*writer) = (*copybuffer); - writer++;copybuffer++; - } - *writer = '\0'; + gchar* directorybuffer = g_strndup((gchar*)relativepath, + documentfolder - (gchar*)relativepath); GString *documentdir = g_string_new(tmp_archive_dir); g_string_append_printf(documentdir,"/%s",directorybuffer); |
