libmspack 0.0.5 → 0.10.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/rake.yml +37 -0
  3. data/.gitignore +2 -0
  4. data/.yardopts +1 -1
  5. data/README.md +1 -1
  6. data/Rakefile +11 -5
  7. data/ext/Rakefile +1 -1
  8. data/ext/libmspack/AUTHORS +1 -0
  9. data/ext/libmspack/ChangeLog +321 -4
  10. data/ext/libmspack/INSTALL +368 -0
  11. data/ext/libmspack/Makefile.am +86 -95
  12. data/ext/libmspack/Makefile.in +1729 -0
  13. data/ext/libmspack/README +30 -30
  14. data/ext/libmspack/acinclude.m4 +99 -0
  15. data/ext/libmspack/aclocal.m4 +1218 -0
  16. data/ext/libmspack/ar-lib +270 -0
  17. data/ext/libmspack/compile +347 -0
  18. data/ext/libmspack/config.guess +1480 -0
  19. data/ext/libmspack/config.h.in +129 -0
  20. data/ext/libmspack/config.sub +1801 -0
  21. data/ext/libmspack/configure +15487 -0
  22. data/ext/libmspack/configure.ac +11 -13
  23. data/ext/libmspack/depcomp +791 -0
  24. data/ext/libmspack/install-sh +508 -0
  25. data/ext/libmspack/libmscabd.la +41 -0
  26. data/ext/libmspack/libmschmd.la +41 -0
  27. data/ext/libmspack/libmspack.la +41 -0
  28. data/ext/libmspack/ltmain.sh +11156 -0
  29. data/ext/libmspack/m4/libtool.m4 +8387 -0
  30. data/ext/libmspack/m4/ltoptions.m4 +437 -0
  31. data/ext/libmspack/m4/ltsugar.m4 +124 -0
  32. data/ext/libmspack/m4/ltversion.m4 +23 -0
  33. data/ext/libmspack/m4/lt~obsolete.m4 +99 -0
  34. data/ext/libmspack/missing +215 -0
  35. data/ext/libmspack/mspack/cab.h +20 -7
  36. data/ext/libmspack/mspack/cabd.c +301 -236
  37. data/ext/libmspack/mspack/chmd.c +304 -319
  38. data/ext/libmspack/mspack/crc32.c +52 -52
  39. data/ext/libmspack/mspack/crc32.h +1 -1
  40. data/ext/libmspack/mspack/kwajd.c +178 -172
  41. data/ext/libmspack/mspack/lzss.h +4 -4
  42. data/ext/libmspack/mspack/lzssd.c +42 -42
  43. data/ext/libmspack/mspack/lzx.h +11 -11
  44. data/ext/libmspack/mspack/lzxd.c +370 -361
  45. data/ext/libmspack/mspack/mspack.h +109 -77
  46. data/ext/libmspack/mspack/mszip.h +6 -6
  47. data/ext/libmspack/mspack/mszipd.c +140 -139
  48. data/ext/libmspack/mspack/oab.h +1 -0
  49. data/ext/libmspack/mspack/oabd.c +71 -73
  50. data/ext/libmspack/mspack/qtm.h +4 -4
  51. data/ext/libmspack/mspack/qtmd.c +118 -117
  52. data/ext/libmspack/mspack/readbits.h +52 -52
  53. data/ext/libmspack/mspack/readhuff.h +61 -61
  54. data/ext/libmspack/mspack/system.c +15 -9
  55. data/ext/libmspack/mspack/system.h +38 -50
  56. data/ext/libmspack/mspack/szddd.c +35 -35
  57. data/ext/libmspack/test-driver +148 -0
  58. data/ext/x86_64-linux/libmspack.so +0 -0
  59. data/ext/x86_64-windows/mspack.dll +0 -0
  60. data/lib/libmspack/version.rb +2 -1
  61. data/lib/libmspack.rb +1 -1
  62. data/libmspack.gemspec +4 -4
  63. data/spec/libmspack_spec.rb +5 -4
  64. metadata +38 -105
  65. data/.travis.yml +0 -5
  66. data/ext/i386-windows/libmspack.dll +0 -0
  67. data/ext/libmspack/cleanup.sh +0 -9
  68. data/ext/libmspack/debian/changelog +0 -6
  69. data/ext/libmspack/debian/control +0 -14
  70. data/ext/libmspack/debian/rules +0 -101
  71. data/ext/libmspack/doc/Doxyfile.in +0 -22
  72. data/ext/libmspack/doc/Makefile.in +0 -14
  73. data/ext/libmspack/doc/szdd_kwaj_format.html +0 -331
  74. data/ext/libmspack/mspack/mspack.def +0 -28
  75. data/ext/libmspack/mspack/qtmc.c +0 -18
  76. data/ext/libmspack/rebuild.sh +0 -8
  77. data/ext/libmspack/test/cabd_c10 +0 -19
  78. data/ext/libmspack/test/cabd_compare +0 -34
  79. data/ext/libmspack/test/cabd_md5.c +0 -161
  80. data/ext/libmspack/test/cabd_memory.c +0 -179
  81. data/ext/libmspack/test/cabd_test.c +0 -386
  82. data/ext/libmspack/test/cabrip.c +0 -81
  83. data/ext/libmspack/test/chmd_compare +0 -38
  84. data/ext/libmspack/test/chmd_find.c +0 -95
  85. data/ext/libmspack/test/chmd_md5.c +0 -67
  86. data/ext/libmspack/test/chmd_order.c +0 -144
  87. data/ext/libmspack/test/chminfo.c +0 -284
  88. data/ext/libmspack/test/chmx.c +0 -216
  89. data/ext/libmspack/test/error.h +0 -22
  90. data/ext/libmspack/test/expand.c +0 -79
  91. data/ext/libmspack/test/md5.c +0 -457
  92. data/ext/libmspack/test/md5.h +0 -165
  93. data/ext/libmspack/test/md5_fh.h +0 -123
  94. data/ext/libmspack/test/msdecompile_md5 +0 -24
  95. data/ext/libmspack/test/msexpand_md5 +0 -39
  96. data/ext/libmspack/test/multifh.c +0 -435
  97. data/ext/libmspack/test/oabx.c +0 -41
  98. data/ext/libmspack/test/test_files/cabd/1.pl +0 -84
  99. data/ext/libmspack/test/test_files/cabd/2.pl +0 -75
  100. data/ext/libmspack/test/test_files/cabd/bad_folderindex.cab +0 -0
  101. data/ext/libmspack/test/test_files/cabd/bad_nofiles.cab +0 -0
  102. data/ext/libmspack/test/test_files/cabd/bad_nofolders.cab +0 -0
  103. data/ext/libmspack/test/test_files/cabd/bad_signature.cab +0 -0
  104. data/ext/libmspack/test/test_files/cabd/multi_basic_pt1.cab +0 -0
  105. data/ext/libmspack/test/test_files/cabd/multi_basic_pt2.cab +0 -0
  106. data/ext/libmspack/test/test_files/cabd/multi_basic_pt3.cab +0 -0
  107. data/ext/libmspack/test/test_files/cabd/multi_basic_pt4.cab +0 -0
  108. data/ext/libmspack/test/test_files/cabd/multi_basic_pt5.cab +0 -0
  109. data/ext/libmspack/test/test_files/cabd/normal_255c_filename.cab +0 -0
  110. data/ext/libmspack/test/test_files/cabd/normal_2files_1folder.cab +0 -0
  111. data/ext/libmspack/test/test_files/cabd/partial_nodata.cab +0 -0
  112. data/ext/libmspack/test/test_files/cabd/partial_nofiles.cab +0 -0
  113. data/ext/libmspack/test/test_files/cabd/partial_nofolder.cab +0 -0
  114. data/ext/libmspack/test/test_files/cabd/partial_shortextheader.cab +0 -0
  115. data/ext/libmspack/test/test_files/cabd/partial_shortfile1.cab +0 -0
  116. data/ext/libmspack/test/test_files/cabd/partial_shortfile2.cab +0 -0
  117. data/ext/libmspack/test/test_files/cabd/partial_shortfolder.cab +0 -0
  118. data/ext/libmspack/test/test_files/cabd/partial_shortheader.cab +0 -0
  119. data/ext/libmspack/test/test_files/cabd/partial_str_nofname.cab +0 -0
  120. data/ext/libmspack/test/test_files/cabd/partial_str_noninfo.cab +0 -0
  121. data/ext/libmspack/test/test_files/cabd/partial_str_nonname.cab +0 -0
  122. data/ext/libmspack/test/test_files/cabd/partial_str_nopinfo.cab +0 -0
  123. data/ext/libmspack/test/test_files/cabd/partial_str_nopname.cab +0 -0
  124. data/ext/libmspack/test/test_files/cabd/partial_str_shortfname.cab +0 -0
  125. data/ext/libmspack/test/test_files/cabd/partial_str_shortninfo.cab +0 -0
  126. data/ext/libmspack/test/test_files/cabd/partial_str_shortnname.cab +0 -0
  127. data/ext/libmspack/test/test_files/cabd/partial_str_shortpinfo.cab +0 -0
  128. data/ext/libmspack/test/test_files/cabd/partial_str_shortpname.cab +0 -0
  129. data/ext/libmspack/test/test_files/cabd/reserve_---.cab +0 -0
  130. data/ext/libmspack/test/test_files/cabd/reserve_--D.cab +0 -0
  131. data/ext/libmspack/test/test_files/cabd/reserve_-F-.cab +0 -0
  132. data/ext/libmspack/test/test_files/cabd/reserve_-FD.cab +0 -0
  133. data/ext/libmspack/test/test_files/cabd/reserve_H--.cab +0 -0
  134. data/ext/libmspack/test/test_files/cabd/reserve_H-D.cab +0 -0
  135. data/ext/libmspack/test/test_files/cabd/reserve_HF-.cab +0 -0
  136. data/ext/libmspack/test/test_files/cabd/reserve_HFD.cab +0 -0
  137. data/ext/libmspack/test/test_files/cabd/search_basic.cab +0 -0
  138. data/ext/libmspack/test/test_files/cabd/search_tricky1.cab +0 -0
  139. data/ext/libmspack/winbuild.sh +0 -26
  140. data/ext/libmspack.h +0 -259
  141. data/ext/x86_64-windows/libmspack.dll +0 -0
@@ -1,5 +1,5 @@
1
1
  /* libmspack -- a library for working with Microsoft compression formats.
2
- * (C) 2003-2013 Stuart Caie <kyzer@4u.net>
2
+ * (C) 2003-2019 Stuart Caie <kyzer@cabextract.org.uk>
3
3
  *
4
4
  * libmspack is free software; you can redistribute it and/or modify it under
5
5
  * the terms of the GNU Lesser General Public License (LGPL) version 2.1
@@ -308,8 +308,8 @@ struct mspack_system {
308
308
  * @see close(), read(), write(), seek(), tell(), message()
309
309
  */
310
310
  struct mspack_file * (*open)(struct mspack_system *self,
311
- const char *filename,
312
- int mode);
311
+ const char *filename,
312
+ int mode);
313
313
 
314
314
  /**
315
315
  * Closes a previously opened file. If any memory was allocated for this
@@ -328,12 +328,14 @@ struct mspack_system {
328
328
  * @param bytes the number of bytes to read from the file.
329
329
  * @return the number of bytes successfully read (this can be less than
330
330
  * the number requested), zero to mark the end of file, or less
331
- * than zero to indicate an error.
331
+ * than zero to indicate an error. The library does not "retry"
332
+ * reads and assumes short reads are due to EOF, so you should
333
+ * avoid returning short reads because of transient errors.
332
334
  * @see open(), write()
333
335
  */
334
336
  int (*read)(struct mspack_file *file,
335
- void *buffer,
336
- int bytes);
337
+ void *buffer,
338
+ int bytes);
337
339
 
338
340
  /**
339
341
  * Writes a given number of bytes to an open file.
@@ -349,8 +351,8 @@ struct mspack_system {
349
351
  * @see open(), read()
350
352
  */
351
353
  int (*write)(struct mspack_file *file,
352
- void *buffer,
353
- int bytes);
354
+ void *buffer,
355
+ int bytes);
354
356
 
355
357
  /**
356
358
  * Seeks to a specific file offset within an open file.
@@ -376,8 +378,8 @@ struct mspack_system {
376
378
  * @see open(), tell()
377
379
  */
378
380
  int (*seek)(struct mspack_file *file,
379
- off_t offset,
380
- int mode);
381
+ off_t offset,
382
+ int mode);
381
383
 
382
384
  /**
383
385
  * Returns the current file position (in bytes) of the given file.
@@ -403,8 +405,8 @@ struct mspack_system {
403
405
  * @see open()
404
406
  */
405
407
  void (*message)(struct mspack_file *file,
406
- const char *format,
407
- ...);
408
+ const char *format,
409
+ ...);
408
410
 
409
411
  /**
410
412
  * Allocates memory.
@@ -417,12 +419,12 @@ struct mspack_system {
417
419
  * @see free()
418
420
  */
419
421
  void * (*alloc)(struct mspack_system *self,
420
- size_t bytes);
422
+ size_t bytes);
421
423
 
422
424
  /**
423
425
  * Frees memory.
424
426
  *
425
- * @param ptr the memory to be freed.
427
+ * @param ptr the memory to be freed. NULL is accepted and ignored.
426
428
  * @see alloc()
427
429
  */
428
430
  void (*free)(void *ptr);
@@ -440,8 +442,8 @@ struct mspack_system {
440
442
  * @param bytes the size of the memory region, in bytes
441
443
  */
442
444
  void (*copy)(void *src,
443
- void *dest,
444
- size_t bytes);
445
+ void *dest,
446
+ size_t bytes);
445
447
 
446
448
  /**
447
449
  * A null pointer to mark the end of mspack_system. It must equal NULL.
@@ -932,6 +934,13 @@ struct mscabd_file {
932
934
  #define MSCABD_PARAM_FIXMSZIP (1)
933
935
  /** mscab_decompressor::set_param() parameter: size of decompression buffer */
934
936
  #define MSCABD_PARAM_DECOMPBUF (2)
937
+ /** mscab_decompressor::set_param() parameter: salvage data from bad cabinets?
938
+ * If enabled, open() will skip file with bad folder indices or filenames
939
+ * rather than reject the whole cabinet, and extract() will limit rather than
940
+ * reject files with invalid offsets and lengths, and bad data block checksums
941
+ * will be ignored. Available only in CAB decoder version 2 and above.
942
+ */
943
+ #define MSCABD_PARAM_SALVAGE (3)
935
944
 
936
945
  /** TODO */
937
946
  struct mscab_compressor {
@@ -967,7 +976,7 @@ struct mscab_decompressor {
967
976
  * @see close(), search(), last_error()
968
977
  */
969
978
  struct mscabd_cabinet * (*open) (struct mscab_decompressor *self,
970
- const char *filename);
979
+ const char *filename);
971
980
 
972
981
  /**
973
982
  * Closes a previously opened cabinet or cabinet set.
@@ -999,7 +1008,7 @@ struct mscab_decompressor {
999
1008
  * @see open(), search(), append(), prepend()
1000
1009
  */
1001
1010
  void (*close)(struct mscab_decompressor *self,
1002
- struct mscabd_cabinet *cab);
1011
+ struct mscabd_cabinet *cab);
1003
1012
 
1004
1013
  /**
1005
1014
  * Searches a regular file for embedded cabinets.
@@ -1036,7 +1045,7 @@ struct mscab_decompressor {
1036
1045
  * @see close(), open(), last_error()
1037
1046
  */
1038
1047
  struct mscabd_cabinet * (*search) (struct mscab_decompressor *self,
1039
- const char *filename);
1048
+ const char *filename);
1040
1049
 
1041
1050
  /**
1042
1051
  * Appends one mscabd_cabinet to another, forming or extending a cabinet
@@ -1079,8 +1088,8 @@ struct mscab_decompressor {
1079
1088
  * @see prepend(), open(), close()
1080
1089
  */
1081
1090
  int (*append) (struct mscab_decompressor *self,
1082
- struct mscabd_cabinet *cab,
1083
- struct mscabd_cabinet *nextcab);
1091
+ struct mscabd_cabinet *cab,
1092
+ struct mscabd_cabinet *nextcab);
1084
1093
 
1085
1094
  /**
1086
1095
  * Prepends one mscabd_cabinet to another, forming or extending a
@@ -1101,8 +1110,8 @@ struct mscab_decompressor {
1101
1110
  * @see append(), open(), close()
1102
1111
  */
1103
1112
  int (*prepend) (struct mscab_decompressor *self,
1104
- struct mscabd_cabinet *cab,
1105
- struct mscabd_cabinet *prevcab);
1113
+ struct mscabd_cabinet *cab,
1114
+ struct mscabd_cabinet *prevcab);
1106
1115
 
1107
1116
  /**
1108
1117
  * Extracts a file from a cabinet or cabinet set.
@@ -1127,8 +1136,8 @@ struct mscab_decompressor {
1127
1136
  * @return an error code, or MSPACK_ERR_OK if successful
1128
1137
  */
1129
1138
  int (*extract)(struct mscab_decompressor *self,
1130
- struct mscabd_file *file,
1131
- const char *filename);
1139
+ struct mscabd_file *file,
1140
+ const char *filename);
1132
1141
 
1133
1142
  /**
1134
1143
  * Sets a CAB decompression engine parameter.
@@ -1153,8 +1162,8 @@ struct mscab_decompressor {
1153
1162
  * @see search(), extract()
1154
1163
  */
1155
1164
  int (*set_param)(struct mscab_decompressor *self,
1156
- int param,
1157
- int value);
1165
+ int param,
1166
+ int value);
1158
1167
 
1159
1168
  /**
1160
1169
  * Returns the error code set by the most recently called method.
@@ -1439,8 +1448,8 @@ struct mschm_compressor {
1439
1448
  * @see use_temporary_file() set_param()
1440
1449
  */
1441
1450
  int (*generate)(struct mschm_compressor *self,
1442
- struct mschmc_file file_list[],
1443
- const char *output_file);
1451
+ struct mschmc_file file_list[],
1452
+ const char *output_file);
1444
1453
 
1445
1454
  /**
1446
1455
  * Specifies whether a temporary file is used during CHM generation.
@@ -1496,8 +1505,8 @@ struct mschm_compressor {
1496
1505
  * @see generate()
1497
1506
  */
1498
1507
  int (*use_temporary_file)(struct mschm_compressor *self,
1499
- int use_temp_file,
1500
- const char *temp_file);
1508
+ int use_temp_file,
1509
+ const char *temp_file);
1501
1510
  /**
1502
1511
  * Sets a CHM compression engine parameter.
1503
1512
  *
@@ -1544,8 +1553,8 @@ struct mschm_compressor {
1544
1553
  * @see generate()
1545
1554
  */
1546
1555
  int (*set_param)(struct mschm_compressor *self,
1547
- int param,
1548
- unsigned int value);
1556
+ int param,
1557
+ int value);
1549
1558
 
1550
1559
  /**
1551
1560
  * Returns the error code set by the most recently called method.
@@ -1587,7 +1596,7 @@ struct mschm_decompressor {
1587
1596
  * @see close()
1588
1597
  */
1589
1598
  struct mschmd_header *(*open)(struct mschm_decompressor *self,
1590
- const char *filename);
1599
+ const char *filename);
1591
1600
 
1592
1601
  /**
1593
1602
  * Closes a previously opened CHM helpfile.
@@ -1607,7 +1616,7 @@ struct mschm_decompressor {
1607
1616
  * @see open(), fast_open()
1608
1617
  */
1609
1618
  void (*close)(struct mschm_decompressor *self,
1610
- struct mschmd_header *chm);
1619
+ struct mschmd_header *chm);
1611
1620
 
1612
1621
  /**
1613
1622
  * Extracts a file from a CHM helpfile.
@@ -1628,8 +1637,8 @@ struct mschm_decompressor {
1628
1637
  * @return an error code, or MSPACK_ERR_OK if successful
1629
1638
  */
1630
1639
  int (*extract)(struct mschm_decompressor *self,
1631
- struct mschmd_file *file,
1632
- const char *filename);
1640
+ struct mschmd_file *file,
1641
+ const char *filename);
1633
1642
 
1634
1643
  /**
1635
1644
  * Returns the error code set by the most recently called method.
@@ -1667,7 +1676,7 @@ struct mschm_decompressor {
1667
1676
  * @see open(), close(), fast_find(), extract()
1668
1677
  */
1669
1678
  struct mschmd_header *(*fast_open)(struct mschm_decompressor *self,
1670
- const char *filename);
1679
+ const char *filename);
1671
1680
 
1672
1681
  /**
1673
1682
  * Finds file details quickly.
@@ -1708,10 +1717,10 @@ struct mschm_decompressor {
1708
1717
  * @see open(), close(), fast_find(), extract()
1709
1718
  */
1710
1719
  int (*fast_find)(struct mschm_decompressor *self,
1711
- struct mschmd_header *chm,
1712
- const char *filename,
1713
- struct mschmd_file *f_ptr,
1714
- int f_size);
1720
+ struct mschmd_header *chm,
1721
+ const char *filename,
1722
+ struct mschmd_file *f_ptr,
1723
+ int f_size);
1715
1724
  };
1716
1725
 
1717
1726
  /* --- support for .LIT (EBook) file format -------------------------------- */
@@ -1817,9 +1826,9 @@ struct msszdd_compressor {
1817
1826
  * @see set_param()
1818
1827
  */
1819
1828
  int (*compress)(struct msszdd_compressor *self,
1820
- const char *input,
1821
- const char *output,
1822
- off_t length);
1829
+ const char *input,
1830
+ const char *output,
1831
+ off_t length);
1823
1832
 
1824
1833
  /**
1825
1834
  * Sets an SZDD compression engine parameter.
@@ -1843,8 +1852,8 @@ struct msszdd_compressor {
1843
1852
  * @see compress()
1844
1853
  */
1845
1854
  int (*set_param)(struct msszdd_compressor *self,
1846
- int param,
1847
- unsigned int value);
1855
+ int param,
1856
+ int value);
1848
1857
 
1849
1858
  /**
1850
1859
  * Returns the error code set by the most recently called method.
@@ -1885,7 +1894,7 @@ struct msszdd_decompressor {
1885
1894
  * @see close()
1886
1895
  */
1887
1896
  struct msszddd_header *(*open)(struct msszdd_decompressor *self,
1888
- const char *filename);
1897
+ const char *filename);
1889
1898
 
1890
1899
  /**
1891
1900
  * Closes a previously opened SZDD file.
@@ -1901,7 +1910,7 @@ struct msszdd_decompressor {
1901
1910
  * @see open()
1902
1911
  */
1903
1912
  void (*close)(struct msszdd_decompressor *self,
1904
- struct msszddd_header *szdd);
1913
+ struct msszddd_header *szdd);
1905
1914
 
1906
1915
  /**
1907
1916
  * Extracts the compressed data from a SZDD file.
@@ -1917,8 +1926,8 @@ struct msszdd_decompressor {
1917
1926
  * @return an error code, or MSPACK_ERR_OK if successful
1918
1927
  */
1919
1928
  int (*extract)(struct msszdd_decompressor *self,
1920
- struct msszddd_header *szdd,
1921
- const char *filename);
1929
+ struct msszddd_header *szdd,
1930
+ const char *filename);
1922
1931
 
1923
1932
  /**
1924
1933
  * Decompresses an SZDD file to an output file in one step.
@@ -1938,8 +1947,8 @@ struct msszdd_decompressor {
1938
1947
  * @return an error code, or MSPACK_ERR_OK if successful
1939
1948
  */
1940
1949
  int (*decompress)(struct msszdd_decompressor *self,
1941
- const char *input,
1942
- const char *output);
1950
+ const char *input,
1951
+ const char *output);
1943
1952
 
1944
1953
  /**
1945
1954
  * Returns the error code set by the most recently called method.
@@ -2053,9 +2062,9 @@ struct mskwaj_compressor {
2053
2062
  * @see set_param()
2054
2063
  */
2055
2064
  int (*compress)(struct mskwaj_compressor *self,
2056
- const char *input,
2057
- const char *output,
2058
- off_t length);
2065
+ const char *input,
2066
+ const char *output,
2067
+ off_t length);
2059
2068
 
2060
2069
  /**
2061
2070
  * Sets an KWAJ compression engine parameter.
@@ -2081,8 +2090,8 @@ struct mskwaj_compressor {
2081
2090
  * @see generate()
2082
2091
  */
2083
2092
  int (*set_param)(struct mskwaj_compressor *self,
2084
- int param,
2085
- unsigned int value);
2093
+ int param,
2094
+ int value);
2086
2095
 
2087
2096
 
2088
2097
  /**
@@ -2103,7 +2112,7 @@ struct mskwaj_compressor {
2103
2112
  * filename is too long
2104
2113
  */
2105
2114
  int (*set_filename)(struct mskwaj_compressor *self,
2106
- const char *filename);
2115
+ const char *filename);
2107
2116
 
2108
2117
  /**
2109
2118
  * Sets arbitrary data that will be stored in the header of the
@@ -2123,8 +2132,8 @@ struct mskwaj_compressor {
2123
2132
  * is too long
2124
2133
  */
2125
2134
  int (*set_extra_data)(struct mskwaj_compressor *self,
2126
- void *data,
2127
- size_t bytes);
2135
+ void *data,
2136
+ size_t bytes);
2128
2137
 
2129
2138
  /**
2130
2139
  * Returns the error code set by the most recently called method.
@@ -2165,7 +2174,7 @@ struct mskwaj_decompressor {
2165
2174
  * @see close()
2166
2175
  */
2167
2176
  struct mskwajd_header *(*open)(struct mskwaj_decompressor *self,
2168
- const char *filename);
2177
+ const char *filename);
2169
2178
 
2170
2179
  /**
2171
2180
  * Closes a previously opened KWAJ file.
@@ -2180,7 +2189,7 @@ struct mskwaj_decompressor {
2180
2189
  * @see open()
2181
2190
  */
2182
2191
  void (*close)(struct mskwaj_decompressor *self,
2183
- struct mskwajd_header *kwaj);
2192
+ struct mskwajd_header *kwaj);
2184
2193
 
2185
2194
  /**
2186
2195
  * Extracts the compressed data from a KWAJ file.
@@ -2196,8 +2205,8 @@ struct mskwaj_decompressor {
2196
2205
  * @return an error code, or MSPACK_ERR_OK if successful
2197
2206
  */
2198
2207
  int (*extract)(struct mskwaj_decompressor *self,
2199
- struct mskwajd_header *kwaj,
2200
- const char *filename);
2208
+ struct mskwajd_header *kwaj,
2209
+ const char *filename);
2201
2210
 
2202
2211
  /**
2203
2212
  * Decompresses an KWAJ file to an output file in one step.
@@ -2217,8 +2226,8 @@ struct mskwaj_decompressor {
2217
2226
  * @return an error code, or MSPACK_ERR_OK if successful
2218
2227
  */
2219
2228
  int (*decompress)(struct mskwaj_decompressor *self,
2220
- const char *input,
2221
- const char *output);
2229
+ const char *input,
2230
+ const char *output);
2222
2231
 
2223
2232
  /**
2224
2233
  * Returns the error code set by the most recently called method.
@@ -2259,8 +2268,8 @@ struct msoab_compressor {
2259
2268
  * @return an error code, or MSPACK_ERR_OK if successful
2260
2269
  */
2261
2270
  int (*compress) (struct msoab_compressor *self,
2262
- const char *input,
2263
- const char *output);
2271
+ const char *input,
2272
+ const char *output);
2264
2273
 
2265
2274
  /**
2266
2275
  * Generate a compressed incremental OAB patch file.
@@ -2283,9 +2292,9 @@ struct msoab_compressor {
2283
2292
  * @return an error code, or MSPACK_ERR_OK if successful
2284
2293
  */
2285
2294
  int (*compress_incremental) (struct msoab_compressor *self,
2286
- const char *input,
2287
- const char *base,
2288
- const char *output);
2295
+ const char *input,
2296
+ const char *base,
2297
+ const char *output);
2289
2298
  };
2290
2299
 
2291
2300
  /**
@@ -2312,8 +2321,8 @@ struct msoab_decompressor {
2312
2321
  * @return an error code, or MSPACK_ERR_OK if successful
2313
2322
  */
2314
2323
  int (*decompress) (struct msoab_decompressor *self,
2315
- const char *input,
2316
- const char *output);
2324
+ const char *input,
2325
+ const char *output);
2317
2326
 
2318
2327
  /**
2319
2328
  * Decompresses an Offline Address Book with an incremental patch file.
@@ -2341,11 +2350,34 @@ struct msoab_decompressor {
2341
2350
  * @return an error code, or MSPACK_ERR_OK if successful
2342
2351
  */
2343
2352
  int (*decompress_incremental) (struct msoab_decompressor *self,
2344
- const char *input,
2345
- const char *base,
2346
- const char *output);
2353
+ const char *input,
2354
+ const char *base,
2355
+ const char *output);
2356
+
2357
+ /**
2358
+ * Sets an OAB decompression engine parameter. Available only in OAB
2359
+ * decompressor version 2 and above.
2360
+ *
2361
+ * - #MSOABD_PARAM_DECOMPBUF: How many bytes should be used as an input
2362
+ * buffer by decompressors? The minimum value is 16. The default value
2363
+ * is 4096.
2364
+ *
2365
+ * @param self a self-referential pointer to the msoab_decompressor
2366
+ * instance being called
2367
+ * @param param the parameter to set
2368
+ * @param value the value to set the parameter to
2369
+ * @return MSPACK_ERR_OK if all is OK, or MSPACK_ERR_ARGS if there
2370
+ * is a problem with either parameter or value.
2371
+ */
2372
+ int (*set_param)(struct msoab_decompressor *self,
2373
+ int param,
2374
+ int value);
2375
+
2347
2376
  };
2348
2377
 
2378
+ /** msoab_decompressor::set_param() parameter: size of decompression buffer */
2379
+ #define MSOABD_PARAM_DECOMPBUF (0)
2380
+
2349
2381
  #ifdef __cplusplus
2350
2382
  }
2351
2383
  #endif
@@ -32,14 +32,14 @@ extern "C" {
32
32
  # define MSZIP_LITERAL_TABLESIZE (MSZIP_LITERAL_MAXSYMBOLS * 4)
33
33
  #else
34
34
  # define MSZIP_LITERAL_TABLESIZE ((1 << MSZIP_LITERAL_TABLEBITS) + \
35
- (MSZIP_LITERAL_MAXSYMBOLS * 2))
35
+ (MSZIP_LITERAL_MAXSYMBOLS * 2))
36
36
  #endif
37
37
 
38
38
  #if (1 << MSZIP_DISTANCE_TABLEBITS) < (MSZIP_DISTANCE_MAXSYMBOLS * 2)
39
39
  # define MSZIP_DISTANCE_TABLESIZE (MSZIP_DISTANCE_MAXSYMBOLS * 4)
40
40
  #else
41
41
  # define MSZIP_DISTANCE_TABLESIZE ((1 << MSZIP_DISTANCE_TABLEBITS) + \
42
- (MSZIP_DISTANCE_MAXSYMBOLS * 2))
42
+ (MSZIP_DISTANCE_MAXSYMBOLS * 2))
43
43
  #endif
44
44
 
45
45
  struct mszipd_stream {
@@ -83,10 +83,10 @@ struct mszipd_stream {
83
83
  * a partial recovery of erroneous data.
84
84
  */
85
85
  extern struct mszipd_stream *mszipd_init(struct mspack_system *system,
86
- struct mspack_file *input,
87
- struct mspack_file *output,
88
- int input_buffer_size,
89
- int repair_mode);
86
+ struct mspack_file *input,
87
+ struct mspack_file *output,
88
+ int input_buffer_size,
89
+ int repair_mode);
90
90
 
91
91
  /* decompresses, or decompresses more of, an MS-ZIP stream.
92
92
  *