unlibarchive.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727
  1. // Copyright (C) 2023-2025 Artifex Software, Inc.
  2. //
  3. // This file is part of MuPDF.
  4. //
  5. // MuPDF is free software: you can redistribute it and/or modify it under the
  6. // terms of the GNU Affero General Public License as published by the Free
  7. // Software Foundation, either version 3 of the License, or (at your option)
  8. // any later version.
  9. //
  10. // MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
  11. // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  12. // FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
  13. // details.
  14. //
  15. // You should have received a copy of the GNU Affero General Public License
  16. // along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
  17. //
  18. // Alternative licensing terms are available from the licensor.
  19. // For commercial licensing, see <https://www.artifex.com/> or contact
  20. // Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
  21. // CA 94129, USA, for further information.
  22. #include "mupdf/fitz.h"
  23. #ifdef HAVE_LIBARCHIVE
  24. #ifdef _WIN32
  25. #include "libarchive/archive.h"
  26. #include "libarchive/archive_entry.h"
  27. #else
  28. #include <archive.h>
  29. #include <archive_entry.h>
  30. #endif
  31. typedef struct
  32. {
  33. size_t len;
  34. uint8_t name[32];
  35. } entry_t;
  36. typedef struct
  37. {
  38. fz_archive super;
  39. struct archive *archive;
  40. int current_entry_idx;
  41. int entries_max;
  42. int entries_len;
  43. entry_t **entries;
  44. fz_context *ctx; /* safe! */
  45. uint8_t block[4096];
  46. } fz_libarchive_archive;
  47. static la_ssize_t
  48. libarchive_read(struct archive *a, void *client_data, const void **buf)
  49. {
  50. fz_libarchive_archive *arch = (fz_libarchive_archive *)client_data;
  51. size_t z;
  52. uint8_t *p;
  53. size_t left;
  54. fz_context *ctx = arch->ctx;
  55. la_ssize_t ret = 0;
  56. fz_try(ctx)
  57. {
  58. z = fz_available(arch->ctx, arch->super.file, 1024);
  59. /* If we're at the EOF, can't read anything! */
  60. if (z == 0)
  61. break;
  62. /* If we have at least 1K, then just return the pointer to that
  63. * directly. */
  64. if (z >= 1024)
  65. {
  66. *buf = arch->super.file->rp;
  67. arch->super.file->rp += z;
  68. ret = (la_ssize_t)z;
  69. break;
  70. }
  71. /* If not, let's pull a large enough lump out. */
  72. left = sizeof(arch->block);
  73. p = arch->block;
  74. do
  75. {
  76. memcpy(p, arch->super.file->rp, z);
  77. p += z;
  78. arch->super.file->rp += z;
  79. left -= z;
  80. if (left)
  81. {
  82. z = fz_available(arch->ctx, arch->super.file, left);
  83. if (z > left)
  84. z = left;
  85. if (z == 0)
  86. break;
  87. }
  88. }
  89. while (left != 0);
  90. ret = p - arch->block;
  91. *buf = arch->block;
  92. }
  93. fz_catch(ctx)
  94. {
  95. /* Ignore error */
  96. archive_set_error(a, ARCHIVE_FATAL, "%s", fz_convert_error(ctx, NULL));
  97. return -1;
  98. }
  99. return ret;
  100. }
  101. static la_int64_t
  102. libarchive_skip(struct archive *a, void *client_data, la_int64_t skip)
  103. {
  104. fz_libarchive_archive *arch = (fz_libarchive_archive *)client_data;
  105. int64_t pos;
  106. fz_context *ctx = arch->ctx;
  107. fz_try(ctx)
  108. {
  109. pos = fz_tell(arch->ctx, arch->super.file);
  110. fz_seek(arch->ctx, arch->super.file, pos + skip, SEEK_SET);
  111. pos = fz_tell(arch->ctx, arch->super.file) - pos;
  112. }
  113. fz_catch(ctx)
  114. {
  115. /* Ignore error */
  116. archive_set_error(a, ARCHIVE_FATAL, "%s", fz_convert_error(ctx, NULL));
  117. return -1;
  118. }
  119. return pos;
  120. }
  121. static la_int64_t
  122. libarchive_seek(struct archive *a, void *client_data, la_int64_t offset, int whence)
  123. {
  124. fz_libarchive_archive *arch = (fz_libarchive_archive *)client_data;
  125. fz_context *ctx = arch->ctx;
  126. int64_t pos;
  127. fz_try(ctx)
  128. {
  129. fz_seek(arch->ctx, arch->super.file, offset, whence);
  130. pos = fz_tell(arch->ctx, arch->super.file);
  131. }
  132. fz_catch(ctx)
  133. {
  134. /* Ignore error */
  135. archive_set_error(a, ARCHIVE_FATAL, "%s", fz_convert_error(ctx, NULL));
  136. return -1;
  137. }
  138. return pos;
  139. }
  140. static int
  141. libarchive_close(struct archive *a, void *client_data)
  142. {
  143. /* Nothing to do. Stream is dropped when the fz_archive is closed. */
  144. return ARCHIVE_OK;
  145. }
  146. static int
  147. libarchive_open(fz_context *ctx, fz_libarchive_archive *arch)
  148. {
  149. int r;
  150. arch->archive = archive_read_new();
  151. archive_read_support_filter_all(arch->archive);
  152. archive_read_support_format_all(arch->archive);
  153. arch->ctx = ctx;
  154. r = archive_read_set_seek_callback(arch->archive, libarchive_seek);
  155. if (r == ARCHIVE_OK)
  156. r = archive_read_open2(arch->archive, arch, NULL, libarchive_read, libarchive_skip, libarchive_close);
  157. arch->ctx = NULL;
  158. if (r != ARCHIVE_OK)
  159. {
  160. archive_read_free(arch->archive);
  161. arch->archive = NULL;
  162. }
  163. return r != ARCHIVE_OK;
  164. }
  165. static void
  166. libarchive_reset(fz_context *ctx, fz_libarchive_archive *arch)
  167. {
  168. if (arch->archive)
  169. {
  170. archive_read_free(arch->archive);
  171. arch->archive = NULL;
  172. }
  173. fz_seek(ctx, arch->super.file, 0, SEEK_SET);
  174. if (libarchive_open(ctx, arch))
  175. fz_throw(ctx, FZ_ERROR_LIBRARY, "Failed to restart archive traversal!");
  176. arch->current_entry_idx = 0;
  177. }
  178. static void
  179. drop_libarchive_archive(fz_context *ctx, fz_archive *arch_)
  180. {
  181. fz_libarchive_archive *arch = (fz_libarchive_archive *)arch_;
  182. int i;
  183. archive_read_free(arch->archive);
  184. for (i = 0; i < arch->entries_len; ++i)
  185. fz_free(ctx, arch->entries[i]);
  186. fz_free(ctx, arch->entries);
  187. arch->archive = NULL;
  188. }
  189. int
  190. fz_is_libarchive_archive(fz_context *ctx, fz_stream *file)
  191. {
  192. fz_libarchive_archive arch;
  193. struct archive_entry *entry;
  194. int ret;
  195. arch.super.file = file;
  196. fz_seek(ctx, file, 0, SEEK_SET);
  197. /* Annoyingly, libarchive can say "sure, I can open this" only to
  198. * then fail when we try to read from it. We therefore need to
  199. * try to read at least 1 entry out to be sure. */
  200. ret = libarchive_open(ctx, &arch);
  201. if (ret == ARCHIVE_OK)
  202. {
  203. fz_var(ret);
  204. fz_try(ctx)
  205. {
  206. arch.ctx = ctx; /* safe */
  207. ret = archive_read_next_header(arch.archive, &entry);
  208. }
  209. fz_catch(ctx)
  210. {
  211. archive_read_free(arch.archive);
  212. fz_rethrow(ctx);
  213. }
  214. }
  215. archive_read_free(arch.archive);
  216. /* Do NOT return true if we get ARCHIVE_EOF. We will fail to recognise empty
  217. * archives, but the alternative is false positives. */
  218. return ret == ARCHIVE_OK;
  219. }
  220. static int
  221. lookup_archive_entry(fz_context *ctx, fz_libarchive_archive *arch, const char *name)
  222. {
  223. int idx;
  224. for (idx = 0; idx < arch->entries_len; idx++)
  225. {
  226. if (!strcmp(name, (const char *)arch->entries[idx]->name))
  227. return idx;
  228. }
  229. return -1;
  230. }
  231. static int has_libarchive_entry(fz_context *ctx, fz_archive *arch_, const char *name)
  232. {
  233. fz_libarchive_archive *arch = (fz_libarchive_archive *)arch_;
  234. return lookup_archive_entry(ctx, arch, name) != -1;
  235. }
  236. static const char *list_libarchive_entry(fz_context *ctx, fz_archive *arch_, int idx)
  237. {
  238. fz_libarchive_archive *arch = (fz_libarchive_archive *)arch_;
  239. if (idx < 0 || idx >= arch->entries_len)
  240. return NULL;
  241. return (const char *)arch->entries[idx]->name;
  242. }
  243. static int count_libarchive_entries(fz_context *ctx, fz_archive *arch_)
  244. {
  245. fz_libarchive_archive *arch = (fz_libarchive_archive *)arch_;
  246. return arch->entries_len;
  247. }
  248. static fz_buffer *
  249. read_libarchive_entry(fz_context *ctx, fz_archive *arch_, const char *name)
  250. {
  251. fz_libarchive_archive *arch = (fz_libarchive_archive *)arch_;
  252. fz_buffer *ubuf = NULL;
  253. int idx;
  254. struct archive_entry *entry;
  255. la_ssize_t ret;
  256. size_t size;
  257. idx = lookup_archive_entry(ctx, arch, name);
  258. if (idx < 0)
  259. return NULL;
  260. if (arch->current_entry_idx > idx)
  261. libarchive_reset(ctx, arch);
  262. fz_var(ubuf);
  263. arch->ctx = ctx;
  264. fz_try(ctx)
  265. {
  266. while (arch->current_entry_idx < idx)
  267. {
  268. int r = archive_read_next_header(arch->archive, &entry);
  269. if (r == ARCHIVE_OK)
  270. r = archive_read_data_skip(arch->archive);
  271. if (r != ARCHIVE_OK)
  272. fz_throw(ctx, FZ_ERROR_LIBRARY, "Failed to skip over archive entry");
  273. arch->current_entry_idx++;
  274. }
  275. /* This is the one we want. */
  276. if (archive_read_next_header(arch->archive, &entry) != ARCHIVE_OK)
  277. fz_throw(ctx, FZ_ERROR_LIBRARY, "Failed to read archive entry header");
  278. arch->current_entry_idx++;
  279. size = arch->entries[idx]->len;
  280. ubuf = fz_new_buffer(ctx, size);
  281. ubuf->len = size;
  282. ret = archive_read_data(arch->archive, ubuf->data, size);
  283. if (ret < 0)
  284. fz_throw(ctx, FZ_ERROR_LIBRARY, "Failed to read archive data");
  285. if ((size_t)ret != size)
  286. fz_warn(ctx, "Premature end of data reading archive entry data (%zu vs %zu)", (size_t)ubuf->len, (size_t)size);
  287. }
  288. fz_always(ctx)
  289. arch->ctx = NULL;
  290. fz_catch(ctx)
  291. {
  292. fz_drop_buffer(ctx, ubuf);
  293. fz_rethrow(ctx);
  294. }
  295. return ubuf;
  296. }
  297. static fz_stream *
  298. open_libarchive_entry(fz_context *ctx, fz_archive *arch_, const char *name)
  299. {
  300. fz_buffer *buf = read_libarchive_entry(ctx, arch_, name);
  301. fz_stream *stm = NULL;
  302. fz_try(ctx)
  303. stm = fz_open_buffer(ctx, buf);
  304. fz_always(ctx)
  305. fz_drop_buffer(ctx, buf);
  306. fz_catch(ctx)
  307. fz_rethrow(ctx);
  308. return stm;
  309. }
  310. fz_archive *
  311. fz_open_libarchive_archive_with_stream(fz_context *ctx, fz_stream *file)
  312. {
  313. fz_libarchive_archive *arch = fz_new_derived_archive(ctx, file, fz_libarchive_archive);
  314. int r;
  315. const char *path = NULL;
  316. char *free_path = NULL;
  317. fz_seek(ctx, file, 0, SEEK_SET);
  318. if (libarchive_open(ctx, arch) != ARCHIVE_OK)
  319. {
  320. fz_drop_archive(ctx, &arch->super);
  321. fz_throw(ctx, FZ_ERROR_LIBRARY, "cannot recognize libarchive archive");
  322. }
  323. arch->super.format = "libarchive";
  324. arch->super.count_entries = count_libarchive_entries;
  325. arch->super.list_entry = list_libarchive_entry;
  326. arch->super.has_entry = has_libarchive_entry;
  327. arch->super.read_entry = read_libarchive_entry;
  328. arch->super.open_entry = open_libarchive_entry;
  329. arch->super.drop_archive = drop_libarchive_archive;
  330. fz_var(free_path);
  331. fz_try(ctx)
  332. {
  333. arch->ctx = ctx;
  334. /* Count the archive entries */
  335. do
  336. {
  337. struct archive_entry *entry;
  338. size_t z;
  339. r = archive_read_next_header(arch->archive, &entry);
  340. if (r == ARCHIVE_EOF)
  341. break;
  342. if (r != ARCHIVE_OK)
  343. fz_throw(ctx, FZ_ERROR_LIBRARY, "Corrupt archive");
  344. free_path = NULL;
  345. path = archive_entry_pathname_utf8(entry);
  346. if (!path)
  347. {
  348. path = free_path = fz_utf8_from_wchar(ctx, archive_entry_pathname_w(entry));
  349. }
  350. if (!path)
  351. continue;
  352. if (arch->entries_len == arch->entries_max)
  353. {
  354. int new_max = arch->entries_max * 2;
  355. if (new_max == 0)
  356. new_max = 32;
  357. arch->entries = fz_realloc(ctx, arch->entries, sizeof(arch->entries[0]) * new_max);
  358. arch->entries_max = new_max;
  359. }
  360. z = strlen(path);
  361. arch->entries[arch->entries_len] = fz_malloc(ctx, sizeof(entry_t) - 32 + z + 1);
  362. memcpy(&arch->entries[arch->entries_len]->name[0], path, z+1);
  363. if (free_path)
  364. {
  365. fz_free(ctx, free_path);
  366. free_path = NULL;
  367. }
  368. arch->entries[arch->entries_len]->len = archive_entry_size(entry);
  369. arch->entries_len++;
  370. }
  371. while (r != ARCHIVE_EOF && r != ARCHIVE_FATAL);
  372. libarchive_reset(ctx, arch);
  373. }
  374. fz_always(ctx)
  375. {
  376. if (free_path)
  377. fz_free(ctx, free_path);
  378. }
  379. fz_catch(ctx)
  380. {
  381. arch->ctx = NULL;
  382. fz_drop_archive(ctx, &arch->super);
  383. fz_rethrow(ctx);
  384. }
  385. return &arch->super;
  386. }
  387. fz_archive *
  388. fz_open_libarchive_archive(fz_context *ctx, const char *filename)
  389. {
  390. fz_archive *tar = NULL;
  391. fz_stream *file;
  392. file = fz_open_file(ctx, filename);
  393. fz_try(ctx)
  394. tar = fz_open_libarchive_archive_with_stream(ctx, file);
  395. fz_always(ctx)
  396. fz_drop_stream(ctx, file);
  397. fz_catch(ctx)
  398. fz_rethrow(ctx);
  399. return tar;
  400. }
  401. /* Universal decomp stream */
  402. typedef struct
  403. {
  404. fz_stream *chain;
  405. fz_context *ctx; /* Safe as not persistent. */
  406. struct archive *archive;
  407. struct archive_entry *entry;
  408. uint8_t block[4096];
  409. } fz_libarchived_state;
  410. static la_ssize_t
  411. libarchived_read(struct archive *a, void *client_data, const void **buf)
  412. {
  413. fz_libarchived_state *state = (fz_libarchived_state *)client_data;
  414. size_t z;
  415. uint8_t *p;
  416. size_t left;
  417. fz_context *ctx = state->ctx;
  418. la_ssize_t ret = 0;
  419. fz_try(ctx)
  420. {
  421. z = fz_available(ctx, state->chain, 1024);
  422. /* If we're at the EOF, can't read anything! */
  423. if (z == 0)
  424. break;
  425. /* If we have at least 1K, then just return the pointer to that
  426. * directly. */
  427. if (z >= 1024)
  428. {
  429. *buf = state->chain->rp;
  430. state->chain->rp += z;
  431. ret = (la_ssize_t)z;
  432. break;
  433. }
  434. /* If not, let's pull a large enough lump out. */
  435. left = sizeof(state->block);
  436. p = state->block;
  437. do
  438. {
  439. memcpy(p, state->chain->rp, z);
  440. p += z;
  441. state->chain->rp += z;
  442. left -= z;
  443. if (left)
  444. {
  445. z = fz_available(ctx, state->chain, left);
  446. if (z > left)
  447. z = left;
  448. if (z == 0)
  449. break;
  450. }
  451. }
  452. while (left != 0);
  453. ret = p - state->block;
  454. *buf = state->block;
  455. }
  456. fz_catch(ctx)
  457. {
  458. /* Ignore error */
  459. archive_set_error(a, ARCHIVE_FATAL, "%s", fz_convert_error(ctx, NULL));
  460. return -1;
  461. }
  462. return ret;
  463. }
  464. static la_int64_t
  465. libarchived_skip(struct archive *a, void *client_data, la_int64_t skip)
  466. {
  467. fz_libarchived_state *state = (fz_libarchived_state *)client_data;
  468. int64_t pos;
  469. fz_context *ctx = state->ctx;
  470. fz_try(ctx)
  471. {
  472. pos = fz_tell(state->ctx, state->chain);
  473. fz_seek(state->ctx, state->chain, pos + skip, SEEK_SET);
  474. pos = fz_tell(state->ctx, state->chain) - pos;
  475. }
  476. fz_catch(ctx)
  477. {
  478. /* Ignore error */
  479. archive_set_error(a, ARCHIVE_FATAL, "%s", fz_convert_error(ctx, NULL));
  480. return -1;
  481. }
  482. return pos;
  483. }
  484. static la_int64_t
  485. libarchived_seek(struct archive *a, void *client_data, la_int64_t offset, int whence)
  486. {
  487. fz_libarchived_state *state = (fz_libarchived_state *)client_data;
  488. fz_context *ctx = state->ctx;
  489. int64_t pos;
  490. fz_try(ctx)
  491. {
  492. fz_seek(ctx, state->chain, offset, whence);
  493. pos = fz_tell(ctx, state->chain);
  494. }
  495. fz_catch(ctx)
  496. {
  497. /* Ignore error */
  498. archive_set_error(a, ARCHIVE_FATAL, "%s", fz_convert_error(ctx, NULL));
  499. return -1;
  500. }
  501. return pos;
  502. }
  503. static int
  504. libarchived_close(struct archive *a, void *client_data)
  505. {
  506. /* Nothing to do. Stream is dropped when the fz_stream is dropped. */
  507. return ARCHIVE_OK;
  508. }
  509. static int
  510. next_libarchived(fz_context *ctx, fz_stream *stm, size_t required)
  511. {
  512. fz_libarchived_state *state = stm->state;
  513. la_ssize_t z;
  514. if (stm->eof)
  515. return EOF;
  516. z = archive_read_data(state->archive, state->block, sizeof(state->block));
  517. if (z < 0)
  518. fz_throw(ctx, FZ_ERROR_LIBRARY, "Failed to read compressed data");
  519. if (z == 0)
  520. {
  521. stm->eof = 1;
  522. return EOF;
  523. }
  524. stm->rp = state->block;
  525. stm->wp = state->block + z;
  526. return *stm->rp++;
  527. }
  528. static void
  529. close_libarchived(fz_context *ctx, void *state_)
  530. {
  531. fz_libarchived_state *state = (fz_libarchived_state *)state_;
  532. int code;
  533. state->ctx = ctx;
  534. code = archive_read_free(state->archive);
  535. state->ctx = NULL;
  536. if (code != ARCHIVE_OK)
  537. fz_warn(ctx, "libarchive error: archive_read_free: %d", code);
  538. fz_drop_stream(ctx, state->chain);
  539. fz_free(ctx, state);
  540. }
  541. fz_stream *
  542. fz_open_libarchived(fz_context *ctx, fz_stream *chain)
  543. {
  544. fz_libarchived_state *state;
  545. int r;
  546. state = fz_malloc_struct(ctx, fz_libarchived_state);
  547. state->chain = fz_keep_stream(ctx, chain);
  548. state->archive = archive_read_new();
  549. archive_read_support_filter_all(state->archive);
  550. archive_read_support_format_raw(state->archive);
  551. state->ctx = ctx;
  552. r = archive_read_set_seek_callback(state->archive, libarchived_seek);
  553. if (r == ARCHIVE_OK)
  554. r = archive_read_open2(state->archive, state, NULL, libarchived_read, libarchived_skip, libarchived_close);
  555. if (r != ARCHIVE_OK)
  556. {
  557. archive_read_free(state->archive);
  558. state->ctx = NULL;
  559. fz_drop_stream(ctx, state->chain);
  560. fz_free(ctx, state);
  561. fz_throw(ctx, FZ_ERROR_LIBRARY, "Failed to open archive");
  562. }
  563. r = archive_filter_code(state->archive, 0);
  564. if (r == ARCHIVE_FILTER_NONE)
  565. {
  566. archive_read_free(state->archive);
  567. state->ctx = NULL;
  568. fz_drop_stream(ctx, state->chain);
  569. fz_free(ctx, state);
  570. fz_throw(ctx, FZ_ERROR_LIBRARY, "Failed to open archive");
  571. }
  572. /* This is the one we want. */
  573. r = archive_read_next_header(state->archive, &state->entry);
  574. if (r != ARCHIVE_OK)
  575. {
  576. archive_read_free(state->archive);
  577. state->ctx = NULL;
  578. fz_drop_stream(ctx, state->chain);
  579. fz_free(ctx, state);
  580. fz_throw(ctx, FZ_ERROR_LIBRARY, "Failed to open archive");
  581. }
  582. return fz_new_stream(ctx, state, next_libarchived, close_libarchived);
  583. }
  584. #else
  585. int
  586. fz_is_libarchive_archive(fz_context *ctx, fz_stream *file)
  587. {
  588. static int warned = 0;
  589. if (!warned)
  590. {
  591. warned = 1;
  592. fz_warn(ctx, "libarchive support not included");
  593. }
  594. return 0;
  595. }
  596. fz_archive *
  597. fz_open_libarchive_archive_with_stream(fz_context *ctx, fz_stream *file)
  598. {
  599. fz_throw(ctx, FZ_ERROR_UNSUPPORTED, "libarchive support not included");
  600. }
  601. fz_archive *
  602. fz_open_libarchive_archive(fz_context *ctx, const char *filename)
  603. {
  604. fz_throw(ctx, FZ_ERROR_UNSUPPORTED, "libarchive support not included");
  605. }
  606. fz_stream *
  607. fz_open_libarchived(fz_context *ctx, fz_stream *chain)
  608. {
  609. fz_throw(ctx, FZ_ERROR_UNSUPPORTED, "libarchive support not included");
  610. }
  611. #endif