seven-zip 1.4.2 → 1.7.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (887) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +49 -0
  3. data/.github/workflows/release.yml +21 -0
  4. data/README.md +13 -2
  5. data/Rakefile +2 -0
  6. data/ext/p7zip/C/7zBuf.h +4 -8
  7. data/ext/p7zip/C/7zBuf2.c +9 -3
  8. data/ext/p7zip/C/7zCrc.c +84 -32
  9. data/ext/p7zip/C/7zCrc.h +2 -2
  10. data/ext/p7zip/C/7zCrcOpt.c +89 -8
  11. data/ext/p7zip/C/7zStream.c +4 -2
  12. data/ext/p7zip/C/{Types.h → 7zTypes.h} +8 -6
  13. data/ext/p7zip/C/7zVersion.h +21 -6
  14. data/ext/p7zip/C/Aes.c +28 -15
  15. data/ext/p7zip/C/Aes.h +2 -2
  16. data/ext/p7zip/C/Alloc.c +60 -12
  17. data/ext/p7zip/C/Alloc.h +6 -7
  18. data/ext/p7zip/C/Bcj2.c +256 -0
  19. data/ext/p7zip/C/Bcj2.h +146 -0
  20. data/ext/p7zip/C/Bcj2Enc.c +312 -0
  21. data/ext/p7zip/C/Blake2.h +48 -0
  22. data/ext/p7zip/C/Blake2s.c +244 -0
  23. data/ext/p7zip/C/Bra.c +2 -0
  24. data/ext/p7zip/C/Bra.h +4 -8
  25. data/ext/p7zip/C/Bra86.c +48 -51
  26. data/ext/p7zip/C/BraIA64.c +3 -1
  27. data/ext/p7zip/C/BwtSort.c +3 -4
  28. data/ext/p7zip/C/BwtSort.h +4 -8
  29. data/ext/p7zip/C/Compiler.h +32 -0
  30. data/ext/p7zip/C/CpuArch.c +50 -7
  31. data/ext/p7zip/C/CpuArch.h +112 -41
  32. data/ext/p7zip/C/Delta.c +2 -0
  33. data/ext/p7zip/C/Delta.h +4 -8
  34. data/ext/p7zip/C/HuffEnc.c +8 -6
  35. data/ext/p7zip/C/HuffEnc.h +4 -8
  36. data/ext/p7zip/C/LzFind.c +391 -108
  37. data/ext/p7zip/C/LzFind.h +20 -18
  38. data/ext/p7zip/C/LzFindMt.c +100 -90
  39. data/ext/p7zip/C/LzFindMt.h +4 -8
  40. data/ext/p7zip/C/LzHash.h +23 -20
  41. data/ext/p7zip/C/Lzma2Dec.c +48 -26
  42. data/ext/p7zip/C/Lzma2Dec.h +4 -8
  43. data/ext/p7zip/C/Lzma2Enc.c +58 -15
  44. data/ext/p7zip/C/Lzma2Enc.h +3 -7
  45. data/ext/p7zip/C/{LzmaUtil/Lzma86Enc.h → Lzma86.h} +47 -14
  46. data/ext/p7zip/C/{LzmaUtil/Lzma86Dec.c → Lzma86Dec.c} +6 -13
  47. data/ext/p7zip/C/{LzmaUtil/Lzma86Enc.c → Lzma86Enc.c} +8 -15
  48. data/ext/p7zip/C/LzmaDec.c +180 -79
  49. data/ext/p7zip/C/LzmaDec.h +4 -8
  50. data/ext/p7zip/C/LzmaEnc.c +230 -147
  51. data/ext/p7zip/C/LzmaEnc.h +6 -8
  52. data/ext/p7zip/C/MtCoder.c +3 -3
  53. data/ext/p7zip/C/Ppmd.h +5 -5
  54. data/ext/p7zip/C/Ppmd7.c +9 -7
  55. data/ext/p7zip/C/Ppmd7.h +3 -3
  56. data/ext/p7zip/C/Ppmd7Dec.c +2 -0
  57. data/ext/p7zip/C/Ppmd7Enc.c +4 -2
  58. data/ext/p7zip/C/Ppmd8.c +34 -31
  59. data/ext/p7zip/C/Ppmd8.h +5 -1
  60. data/ext/p7zip/C/Ppmd8Dec.c +2 -0
  61. data/ext/p7zip/C/Ppmd8Enc.c +2 -0
  62. data/ext/p7zip/C/Precomp.h +10 -0
  63. data/ext/p7zip/C/RotateDefs.h +11 -1
  64. data/ext/p7zip/C/Sha1.c +340 -0
  65. data/ext/p7zip/C/Sha1.h +38 -0
  66. data/ext/p7zip/C/Sha256.c +107 -63
  67. data/ext/p7zip/C/Sha256.h +2 -2
  68. data/ext/p7zip/C/Sort.c +59 -11
  69. data/ext/p7zip/C/Sort.h +8 -10
  70. data/ext/p7zip/C/Threads.h +1 -1
  71. data/ext/p7zip/C/Xz.c +7 -5
  72. data/ext/p7zip/C/Xz.h +40 -17
  73. data/ext/p7zip/C/XzCrc64.c +69 -16
  74. data/ext/p7zip/C/XzCrc64.h +2 -2
  75. data/ext/p7zip/C/XzCrc64Opt.c +69 -0
  76. data/ext/p7zip/C/XzDec.c +93 -55
  77. data/ext/p7zip/C/XzEnc.c +206 -165
  78. data/ext/p7zip/C/XzEnc.h +23 -9
  79. data/ext/p7zip/C/XzIn.c +50 -43
  80. data/ext/p7zip/CPP/7zip/Archive/7z/7zCompressionMode.h +37 -13
  81. data/ext/p7zip/CPP/7zip/Archive/7z/7zDecode.cpp +392 -181
  82. data/ext/p7zip/CPP/7zip/Archive/7z/7zDecode.h +29 -29
  83. data/ext/p7zip/CPP/7zip/Archive/7z/7zEncode.cpp +424 -212
  84. data/ext/p7zip/CPP/7zip/Archive/7z/7zEncode.h +53 -16
  85. data/ext/p7zip/CPP/7zip/Archive/7z/7zExtract.cpp +312 -174
  86. data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderInStream.cpp +74 -61
  87. data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderInStream.h +22 -19
  88. data/ext/p7zip/CPP/7zip/Archive/7z/7zHandler.cpp +505 -232
  89. data/ext/p7zip/CPP/7zip/Archive/7z/7zHandler.h +70 -16
  90. data/ext/p7zip/CPP/7zip/Archive/7z/7zHandlerOut.cpp +602 -172
  91. data/ext/p7zip/CPP/7zip/Archive/7z/7zHeader.cpp +5 -0
  92. data/ext/p7zip/CPP/7zip/Archive/7z/7zHeader.h +54 -3
  93. data/ext/p7zip/CPP/7zip/Archive/7z/7zIn.cpp +981 -616
  94. data/ext/p7zip/CPP/7zip/Archive/7z/7zIn.h +275 -89
  95. data/ext/p7zip/CPP/7zip/Archive/7z/7zItem.h +77 -162
  96. data/ext/p7zip/CPP/7zip/Archive/7z/7zOut.cpp +288 -238
  97. data/ext/p7zip/CPP/7zip/Archive/7z/7zOut.h +189 -20
  98. data/ext/p7zip/CPP/7zip/Archive/7z/7zProperties.cpp +59 -49
  99. data/ext/p7zip/CPP/7zip/Archive/7z/7zRegister.cpp +12 -9
  100. data/ext/p7zip/CPP/7zip/Archive/7z/7zSpecStream.cpp +4 -6
  101. data/ext/p7zip/CPP/7zip/Archive/7z/7zSpecStream.h +5 -5
  102. data/ext/p7zip/CPP/7zip/Archive/7z/7zUpdate.cpp +1743 -447
  103. data/ext/p7zip/CPP/7zip/Archive/7z/7zUpdate.h +61 -10
  104. data/ext/p7zip/CPP/7zip/Archive/ApmHandler.cpp +84 -120
  105. data/ext/p7zip/CPP/7zip/Archive/ArHandler.cpp +854 -0
  106. data/ext/p7zip/CPP/7zip/Archive/ArchiveExports.cpp +48 -32
  107. data/ext/p7zip/CPP/7zip/Archive/ArjHandler.cpp +519 -340
  108. data/ext/p7zip/CPP/7zip/Archive/Bz2Handler.cpp +223 -203
  109. data/ext/p7zip/CPP/7zip/Archive/Cab/CabBlockInStream.cpp +50 -139
  110. data/ext/p7zip/CPP/7zip/Archive/Cab/CabBlockInStream.h +17 -18
  111. data/ext/p7zip/CPP/7zip/Archive/Cab/CabHandler.cpp +566 -234
  112. data/ext/p7zip/CPP/7zip/Archive/Cab/CabHandler.h +10 -1
  113. data/ext/p7zip/CPP/7zip/Archive/Cab/CabHeader.cpp +2 -2
  114. data/ext/p7zip/CPP/7zip/Archive/Cab/CabHeader.h +12 -15
  115. data/ext/p7zip/CPP/7zip/Archive/Cab/CabIn.cpp +341 -122
  116. data/ext/p7zip/CPP/7zip/Archive/Cab/CabIn.h +81 -66
  117. data/ext/p7zip/CPP/7zip/Archive/Cab/CabItem.h +17 -14
  118. data/ext/p7zip/CPP/7zip/Archive/Cab/CabRegister.cpp +10 -4
  119. data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHandler.cpp +190 -83
  120. data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHandler.h +7 -1
  121. data/ext/p7zip/CPP/7zip/Archive/Chm/ChmIn.cpp +292 -174
  122. data/ext/p7zip/CPP/7zip/Archive/Chm/ChmIn.h +73 -47
  123. data/ext/p7zip/CPP/7zip/Archive/ComHandler.cpp +886 -0
  124. data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2.cpp +994 -71
  125. data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2.h +364 -101
  126. data/ext/p7zip/CPP/7zip/Archive/Common/DummyOutStream.cpp +7 -12
  127. data/ext/p7zip/CPP/7zip/Archive/Common/DummyOutStream.h +4 -3
  128. data/ext/p7zip/CPP/7zip/Archive/Common/FindSignature.cpp +6 -6
  129. data/ext/p7zip/CPP/7zip/Archive/Common/FindSignature.h +2 -2
  130. data/ext/p7zip/CPP/7zip/Archive/Common/HandlerOut.cpp +77 -543
  131. data/ext/p7zip/CPP/7zip/Archive/Common/HandlerOut.h +31 -51
  132. data/ext/p7zip/CPP/7zip/Archive/Common/InStreamWithCRC.cpp +18 -14
  133. data/ext/p7zip/CPP/7zip/Archive/Common/ItemNameUtils.cpp +34 -7
  134. data/ext/p7zip/CPP/7zip/Archive/Common/ItemNameUtils.h +5 -2
  135. data/ext/p7zip/CPP/7zip/Archive/Common/MultiStream.cpp +25 -24
  136. data/ext/p7zip/CPP/7zip/Archive/Common/MultiStream.h +8 -3
  137. data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithCRC.h +1 -0
  138. data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithSha1.cpp +2 -2
  139. data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithSha1.h +5 -5
  140. data/ext/p7zip/CPP/7zip/Archive/Common/ParseProperties.cpp +0 -174
  141. data/ext/p7zip/CPP/7zip/Archive/Common/ParseProperties.h +2 -14
  142. data/ext/p7zip/CPP/7zip/Archive/CpioHandler.cpp +506 -335
  143. data/ext/p7zip/CPP/7zip/Archive/CramfsHandler.cpp +227 -84
  144. data/ext/p7zip/CPP/7zip/Archive/DeflateProps.cpp +0 -115
  145. data/ext/p7zip/CPP/7zip/Archive/DeflateProps.h +0 -29
  146. data/ext/p7zip/CPP/7zip/Archive/DllExports2.cpp +63 -17
  147. data/ext/p7zip/CPP/7zip/Archive/DmgHandler.cpp +1007 -339
  148. data/ext/p7zip/CPP/7zip/Archive/ElfHandler.cpp +618 -177
  149. data/ext/p7zip/CPP/7zip/Archive/ExtHandler.cpp +2867 -0
  150. data/ext/p7zip/CPP/7zip/Archive/FatHandler.cpp +136 -76
  151. data/ext/p7zip/CPP/7zip/Archive/FlvHandler.cpp +132 -150
  152. data/ext/p7zip/CPP/7zip/Archive/GptHandler.cpp +405 -0
  153. data/ext/p7zip/CPP/7zip/Archive/GzHandler.cpp +560 -214
  154. data/ext/p7zip/CPP/7zip/Archive/HandlerCont.cpp +288 -0
  155. data/ext/p7zip/CPP/7zip/Archive/HandlerCont.h +116 -0
  156. data/ext/p7zip/CPP/7zip/Archive/HfsHandler.cpp +1880 -0
  157. data/ext/p7zip/CPP/7zip/Archive/IArchive.h +415 -51
  158. data/ext/p7zip/CPP/7zip/Archive/IhexHandler.cpp +497 -0
  159. data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHandler.cpp +158 -71
  160. data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHandler.h +2 -1
  161. data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHeader.cpp +0 -9
  162. data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHeader.h +8 -5
  163. data/ext/p7zip/CPP/7zip/Archive/Iso/IsoIn.cpp +311 -91
  164. data/ext/p7zip/CPP/7zip/Archive/Iso/IsoIn.h +101 -83
  165. data/ext/p7zip/CPP/7zip/Archive/Iso/IsoItem.h +48 -39
  166. data/ext/p7zip/CPP/7zip/Archive/Iso/IsoRegister.cpp +12 -4
  167. data/ext/p7zip/CPP/7zip/Archive/LzhHandler.cpp +127 -114
  168. data/ext/p7zip/CPP/7zip/Archive/LzmaHandler.cpp +264 -121
  169. data/ext/p7zip/CPP/7zip/Archive/MachoHandler.cpp +402 -242
  170. data/ext/p7zip/CPP/7zip/Archive/MbrHandler.cpp +56 -114
  171. data/ext/p7zip/CPP/7zip/Archive/MslzHandler.cpp +230 -90
  172. data/ext/p7zip/CPP/7zip/Archive/MubHandler.cpp +129 -153
  173. data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisDecode.cpp +179 -58
  174. data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisDecode.h +36 -7
  175. data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisHandler.cpp +407 -237
  176. data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisHandler.h +9 -16
  177. data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisIn.cpp +5535 -1098
  178. data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisIn.h +345 -81
  179. data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisRegister.cpp +11 -4
  180. data/ext/p7zip/CPP/7zip/Archive/NtfsHandler.cpp +1424 -434
  181. data/ext/p7zip/CPP/7zip/Archive/PeHandler.cpp +1831 -521
  182. data/ext/p7zip/CPP/7zip/Archive/PpmdHandler.cpp +50 -35
  183. data/ext/p7zip/CPP/7zip/Archive/QcowHandler.cpp +615 -0
  184. data/ext/p7zip/CPP/7zip/Archive/Rar/Rar5Handler.cpp +2746 -0
  185. data/ext/p7zip/CPP/7zip/Archive/Rar/Rar5Handler.h +411 -0
  186. data/ext/p7zip/CPP/7zip/Archive/Rar/RarHandler.cpp +1241 -355
  187. data/ext/p7zip/CPP/7zip/Archive/Rar/RarHandler.h +70 -20
  188. data/ext/p7zip/CPP/7zip/Archive/Rar/RarHeader.h +38 -34
  189. data/ext/p7zip/CPP/7zip/Archive/Rar/RarItem.h +34 -16
  190. data/ext/p7zip/CPP/7zip/Archive/Rar/RarVol.h +129 -0
  191. data/ext/p7zip/CPP/7zip/Archive/RpmHandler.cpp +641 -194
  192. data/ext/p7zip/CPP/7zip/Archive/SplitHandler.cpp +174 -181
  193. data/ext/p7zip/CPP/7zip/Archive/SquashfsHandler.cpp +237 -174
  194. data/ext/p7zip/CPP/7zip/Archive/SwfHandler.cpp +471 -192
  195. data/ext/p7zip/CPP/7zip/Archive/Tar/TarHandler.cpp +350 -59
  196. data/ext/p7zip/CPP/7zip/Archive/Tar/TarHandler.h +24 -7
  197. data/ext/p7zip/CPP/7zip/Archive/Tar/TarHandlerOut.cpp +79 -27
  198. data/ext/p7zip/CPP/7zip/Archive/Tar/TarHeader.cpp +5 -7
  199. data/ext/p7zip/CPP/7zip/Archive/Tar/TarHeader.h +20 -44
  200. data/ext/p7zip/CPP/7zip/Archive/Tar/TarIn.cpp +279 -64
  201. data/ext/p7zip/CPP/7zip/Archive/Tar/TarIn.h +10 -1
  202. data/ext/p7zip/CPP/7zip/Archive/Tar/TarItem.h +34 -8
  203. data/ext/p7zip/CPP/7zip/Archive/Tar/TarOut.cpp +145 -87
  204. data/ext/p7zip/CPP/7zip/Archive/Tar/TarOut.h +13 -5
  205. data/ext/p7zip/CPP/7zip/Archive/Tar/TarRegister.cpp +14 -9
  206. data/ext/p7zip/CPP/7zip/Archive/Tar/TarUpdate.cpp +154 -27
  207. data/ext/p7zip/CPP/7zip/Archive/Tar/TarUpdate.h +10 -6
  208. data/ext/p7zip/CPP/7zip/Archive/Udf/UdfHandler.cpp +53 -128
  209. data/ext/p7zip/CPP/7zip/Archive/Udf/UdfHandler.h +6 -5
  210. data/ext/p7zip/CPP/7zip/Archive/Udf/UdfIn.cpp +384 -119
  211. data/ext/p7zip/CPP/7zip/Archive/Udf/UdfIn.h +40 -21
  212. data/ext/p7zip/CPP/7zip/Archive/UefiHandler.cpp +1618 -0
  213. data/ext/p7zip/CPP/7zip/Archive/VdiHandler.cpp +362 -0
  214. data/ext/p7zip/CPP/7zip/Archive/VhdHandler.cpp +438 -247
  215. data/ext/p7zip/CPP/7zip/Archive/VmdkHandler.cpp +1518 -0
  216. data/ext/p7zip/CPP/7zip/Archive/Wim/WimHandler.cpp +837 -249
  217. data/ext/p7zip/CPP/7zip/Archive/Wim/WimHandler.h +73 -47
  218. data/ext/p7zip/CPP/7zip/Archive/Wim/WimHandlerOut.cpp +1614 -351
  219. data/ext/p7zip/CPP/7zip/Archive/Wim/WimIn.cpp +1519 -513
  220. data/ext/p7zip/CPP/7zip/Archive/Wim/WimIn.h +498 -139
  221. data/ext/p7zip/CPP/7zip/Archive/Wim/WimRegister.cpp +13 -9
  222. data/ext/p7zip/CPP/7zip/Archive/XarHandler.cpp +272 -128
  223. data/ext/p7zip/CPP/7zip/Archive/XzHandler.cpp +502 -253
  224. data/ext/p7zip/CPP/7zip/Archive/XzHandler.h +65 -0
  225. data/ext/p7zip/CPP/7zip/Archive/ZHandler.cpp +114 -39
  226. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipAddCommon.cpp +118 -134
  227. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipAddCommon.h +6 -0
  228. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipCompressionMode.h +40 -20
  229. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHandler.cpp +541 -274
  230. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHandler.h +13 -40
  231. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp +165 -254
  232. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHeader.h +70 -178
  233. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipIn.cpp +1934 -550
  234. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipIn.h +294 -63
  235. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipItem.cpp +160 -86
  236. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipItem.h +139 -110
  237. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipOut.cpp +177 -154
  238. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipOut.h +50 -18
  239. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipRegister.cpp +18 -9
  240. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipUpdate.cpp +367 -201
  241. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipUpdate.h +11 -10
  242. data/ext/p7zip/CPP/7zip/Bundles/Format7zFree/makefile +2 -319
  243. data/ext/p7zip/CPP/7zip/Bundles/Format7zFree/makefile.depend +0 -4962
  244. data/ext/p7zip/CPP/7zip/Bundles/Format7zFree/makefile.list +1004 -259
  245. data/ext/p7zip/CPP/7zip/Common/CWrappers.cpp +26 -22
  246. data/ext/p7zip/CPP/7zip/Common/CWrappers.h +19 -14
  247. data/ext/p7zip/CPP/7zip/Common/CreateCoder.cpp +298 -130
  248. data/ext/p7zip/CPP/7zip/Common/CreateCoder.h +118 -34
  249. data/ext/p7zip/CPP/7zip/Common/FilePathAutoRename.cpp +24 -28
  250. data/ext/p7zip/CPP/7zip/Common/FilePathAutoRename.h +5 -5
  251. data/ext/p7zip/CPP/7zip/Common/FileStreams.cpp +268 -65
  252. data/ext/p7zip/CPP/7zip/Common/FileStreams.h +70 -33
  253. data/ext/p7zip/CPP/7zip/Common/FilterCoder.cpp +302 -131
  254. data/ext/p7zip/CPP/7zip/Common/FilterCoder.h +141 -43
  255. data/ext/p7zip/CPP/7zip/Common/InBuffer.cpp +87 -35
  256. data/ext/p7zip/CPP/7zip/Common/InBuffer.h +54 -45
  257. data/ext/p7zip/CPP/7zip/Common/InOutTempBuffer.cpp +22 -17
  258. data/ext/p7zip/CPP/7zip/Common/InOutTempBuffer.h +5 -5
  259. data/ext/p7zip/CPP/7zip/Common/LimitedStreams.cpp +256 -43
  260. data/ext/p7zip/CPP/7zip/Common/LimitedStreams.h +135 -8
  261. data/ext/p7zip/CPP/7zip/Common/MemBlocks.cpp +5 -5
  262. data/ext/p7zip/CPP/7zip/Common/MemBlocks.h +3 -3
  263. data/ext/p7zip/CPP/7zip/Common/MethodId.cpp +0 -24
  264. data/ext/p7zip/CPP/7zip/Common/MethodId.h +1 -1
  265. data/ext/p7zip/CPP/7zip/Common/MethodProps.cpp +430 -71
  266. data/ext/p7zip/CPP/7zip/Common/MethodProps.h +170 -17
  267. data/ext/p7zip/CPP/7zip/Common/OffsetStream.cpp +8 -4
  268. data/ext/p7zip/CPP/7zip/Common/OffsetStream.h +4 -3
  269. data/ext/p7zip/CPP/7zip/Common/OutBuffer.cpp +26 -31
  270. data/ext/p7zip/CPP/7zip/Common/OutBuffer.h +17 -18
  271. data/ext/p7zip/CPP/7zip/Common/OutMemStream.cpp +5 -5
  272. data/ext/p7zip/CPP/7zip/Common/OutMemStream.h +5 -4
  273. data/ext/p7zip/CPP/7zip/Common/ProgressUtils.cpp +22 -13
  274. data/ext/p7zip/CPP/7zip/Common/ProgressUtils.h +4 -3
  275. data/ext/p7zip/CPP/7zip/Common/PropId.cpp +108 -0
  276. data/ext/p7zip/CPP/7zip/Common/RegisterArc.h +63 -17
  277. data/ext/p7zip/CPP/7zip/Common/RegisterCodec.h +79 -6
  278. data/ext/p7zip/CPP/7zip/Common/StreamBinder.cpp +95 -90
  279. data/ext/p7zip/CPP/7zip/Common/StreamBinder.h +46 -23
  280. data/ext/p7zip/CPP/7zip/Common/StreamObjects.cpp +88 -24
  281. data/ext/p7zip/CPP/7zip/Common/StreamObjects.h +36 -14
  282. data/ext/p7zip/CPP/7zip/Common/StreamUtils.cpp +4 -4
  283. data/ext/p7zip/CPP/7zip/Common/StreamUtils.h +6 -6
  284. data/ext/p7zip/CPP/7zip/Common/UniqBlocks.cpp +57 -0
  285. data/ext/p7zip/CPP/7zip/Common/UniqBlocks.h +26 -0
  286. data/ext/p7zip/CPP/7zip/Common/VirtThread.cpp +8 -6
  287. data/ext/p7zip/CPP/7zip/Common/VirtThread.h +6 -5
  288. data/ext/p7zip/CPP/7zip/Compress/BZip2Const.h +13 -12
  289. data/ext/p7zip/CPP/7zip/Compress/BZip2Crc.h +1 -1
  290. data/ext/p7zip/CPP/7zip/Compress/BZip2Decoder.cpp +198 -147
  291. data/ext/p7zip/CPP/7zip/Compress/BZip2Decoder.h +60 -27
  292. data/ext/p7zip/CPP/7zip/Compress/BZip2Encoder.cpp +111 -116
  293. data/ext/p7zip/CPP/7zip/Compress/BZip2Encoder.h +53 -59
  294. data/ext/p7zip/CPP/7zip/Compress/BZip2Register.cpp +12 -7
  295. data/ext/p7zip/CPP/7zip/Compress/Bcj2Coder.cpp +554 -282
  296. data/ext/p7zip/CPP/7zip/Compress/Bcj2Coder.h +73 -71
  297. data/ext/p7zip/CPP/7zip/Compress/Bcj2Register.cpp +10 -5
  298. data/ext/p7zip/CPP/7zip/Compress/BcjCoder.cpp +13 -4
  299. data/ext/p7zip/CPP/7zip/Compress/BcjCoder.h +17 -5
  300. data/ext/p7zip/CPP/7zip/Compress/BcjRegister.cpp +7 -9
  301. data/ext/p7zip/CPP/7zip/Compress/BitlDecoder.cpp +2 -2
  302. data/ext/p7zip/CPP/7zip/Compress/BitlDecoder.h +58 -61
  303. data/ext/p7zip/CPP/7zip/Compress/BitlEncoder.h +24 -25
  304. data/ext/p7zip/CPP/7zip/Compress/BitmDecoder.h +46 -17
  305. data/ext/p7zip/CPP/7zip/Compress/BitmEncoder.h +18 -19
  306. data/ext/p7zip/CPP/7zip/Compress/BranchMisc.cpp +14 -28
  307. data/ext/p7zip/CPP/7zip/Compress/BranchMisc.h +27 -6
  308. data/ext/p7zip/CPP/7zip/Compress/BranchRegister.cpp +26 -15
  309. data/ext/p7zip/CPP/7zip/Compress/ByteSwap.cpp +45 -26
  310. data/ext/p7zip/CPP/7zip/Compress/CodecExports.cpp +254 -70
  311. data/ext/p7zip/CPP/7zip/Compress/CopyCoder.cpp +65 -17
  312. data/ext/p7zip/CPP/7zip/Compress/CopyCoder.h +15 -3
  313. data/ext/p7zip/CPP/7zip/Compress/CopyRegister.cpp +5 -4
  314. data/ext/p7zip/CPP/7zip/Compress/Deflate64Register.cpp +12 -6
  315. data/ext/p7zip/CPP/7zip/Compress/DeflateConst.h +43 -46
  316. data/ext/p7zip/CPP/7zip/Compress/DeflateDecoder.cpp +145 -81
  317. data/ext/p7zip/CPP/7zip/Compress/DeflateDecoder.h +31 -33
  318. data/ext/p7zip/CPP/7zip/Compress/DeflateEncoder.cpp +179 -162
  319. data/ext/p7zip/CPP/7zip/Compress/DeflateEncoder.h +35 -30
  320. data/ext/p7zip/CPP/7zip/Compress/DeflateRegister.cpp +11 -7
  321. data/ext/p7zip/CPP/7zip/Compress/DeltaFilter.cpp +55 -39
  322. data/ext/p7zip/CPP/7zip/Compress/{DllExports2.cpp → DllExports2Compress.cpp} +8 -8
  323. data/ext/p7zip/CPP/7zip/Compress/DllExportsCompress.cpp +48 -0
  324. data/ext/p7zip/CPP/7zip/Compress/HuffmanDecoder.h +220 -49
  325. data/ext/p7zip/CPP/7zip/Compress/ImplodeDecoder.cpp +14 -9
  326. data/ext/p7zip/CPP/7zip/Compress/ImplodeDecoder.h +2 -3
  327. data/ext/p7zip/CPP/7zip/Compress/ImplodeHuffmanDecoder.cpp +7 -7
  328. data/ext/p7zip/CPP/7zip/Compress/ImplodeHuffmanDecoder.h +1 -1
  329. data/ext/p7zip/CPP/7zip/Compress/LzOutWindow.cpp +1 -1
  330. data/ext/p7zip/CPP/7zip/Compress/LzOutWindow.h +21 -18
  331. data/ext/p7zip/CPP/7zip/Compress/LzhDecoder.cpp +171 -141
  332. data/ext/p7zip/CPP/7zip/Compress/LzhDecoder.h +32 -64
  333. data/ext/p7zip/CPP/7zip/Compress/Lzham/LICENSE +22 -0
  334. data/ext/p7zip/CPP/7zip/Compress/Lzham/LzhamRegister.cpp +783 -0
  335. data/ext/p7zip/CPP/7zip/Compress/Lzham/README.md +211 -0
  336. data/ext/p7zip/CPP/7zip/Compress/Lzham/include/lzham.h +803 -0
  337. data/ext/p7zip/CPP/7zip/Compress/Lzham/include/lzham_dynamic_lib.h +156 -0
  338. data/ext/p7zip/CPP/7zip/Compress/Lzham/include/lzham_exports.inc +31 -0
  339. data/ext/p7zip/CPP/7zip/Compress/Lzham/include/lzham_static_lib.h +59 -0
  340. data/ext/p7zip/CPP/7zip/Compress/Lzham/include/zlib.h +2 -0
  341. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/CMakeLists.txt +69 -0
  342. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_comp.h +38 -0
  343. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_lzbase.cpp +244 -0
  344. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_lzbase.h +46 -0
  345. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_lzcomp.cpp +750 -0
  346. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_lzcomp_internal.cpp +2240 -0
  347. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_lzcomp_internal.h +503 -0
  348. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_lzcomp_state.cpp +1684 -0
  349. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_match_accel.cpp +947 -0
  350. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_match_accel.h +164 -0
  351. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_null_threading.h +98 -0
  352. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_pthreads_threading.cpp +214 -0
  353. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_pthreads_threading.h +535 -0
  354. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_threading.h +12 -0
  355. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_win32_threading.cpp +232 -0
  356. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_win32_threading.h +387 -0
  357. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzhamcomp.vcxproj +208 -0
  358. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/CMakeLists.txt +86 -0
  359. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_assert.cpp +80 -0
  360. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_assert.h +58 -0
  361. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_checksum.cpp +73 -0
  362. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_checksum.h +13 -0
  363. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_config.h +25 -0
  364. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_core.h +303 -0
  365. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_decomp.h +37 -0
  366. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_helpers.h +54 -0
  367. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_huffman_codes.cpp +286 -0
  368. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_huffman_codes.h +32 -0
  369. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_lzdecomp.cpp +1586 -0
  370. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_lzdecompbase.cpp +131 -0
  371. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_lzdecompbase.h +89 -0
  372. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_math.h +142 -0
  373. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_mem.cpp +463 -0
  374. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_mem.h +115 -0
  375. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_platform.cpp +159 -0
  376. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_platform.h +284 -0
  377. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_prefix_coding.cpp +431 -0
  378. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_prefix_coding.h +157 -0
  379. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_symbol_codec.cpp +1527 -0
  380. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_symbol_codec.h +494 -0
  381. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_timer.cpp +147 -0
  382. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_timer.h +99 -0
  383. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_traits.h +141 -0
  384. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_types.h +72 -0
  385. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_utils.h +58 -0
  386. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_vector.cpp +83 -0
  387. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_vector.h +628 -0
  388. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzhamdecomp.vcxproj +224 -0
  389. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamlib/lzham_lib.cpp +179 -0
  390. data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamlib/lzhamlib.vcxproj +187 -0
  391. data/ext/p7zip/CPP/7zip/Compress/Lzham/makefile +10 -0
  392. data/ext/p7zip/CPP/7zip/Compress/Lzham/makefile.depend +0 -0
  393. data/ext/p7zip/CPP/7zip/Compress/Lzham/makefile.list +129 -0
  394. data/ext/p7zip/CPP/7zip/Compress/Lzma2Decoder.cpp +123 -46
  395. data/ext/p7zip/CPP/7zip/Compress/Lzma2Decoder.h +29 -14
  396. data/ext/p7zip/CPP/7zip/Compress/Lzma2Encoder.cpp +14 -9
  397. data/ext/p7zip/CPP/7zip/Compress/Lzma2Encoder.h +1 -1
  398. data/ext/p7zip/CPP/7zip/Compress/Lzma2Register.cpp +9 -7
  399. data/ext/p7zip/CPP/7zip/Compress/LzmaDecoder.cpp +24 -8
  400. data/ext/p7zip/CPP/7zip/Compress/LzmaDecoder.h +8 -1
  401. data/ext/p7zip/CPP/7zip/Compress/LzmaEncoder.cpp +30 -27
  402. data/ext/p7zip/CPP/7zip/Compress/LzmaEncoder.h +3 -1
  403. data/ext/p7zip/CPP/7zip/Compress/LzmaRegister.cpp +9 -7
  404. data/ext/p7zip/CPP/7zip/Compress/LzmsDecoder.cpp +576 -0
  405. data/ext/p7zip/CPP/7zip/Compress/LzmsDecoder.h +271 -0
  406. data/ext/p7zip/CPP/7zip/Compress/Lzx.h +32 -36
  407. data/ext/p7zip/CPP/7zip/Compress/LzxDecoder.cpp +380 -238
  408. data/ext/p7zip/CPP/7zip/Compress/LzxDecoder.h +170 -83
  409. data/ext/p7zip/CPP/7zip/Compress/Mtf8.h +7 -9
  410. data/ext/p7zip/CPP/7zip/Compress/PpmdDecoder.cpp +1 -5
  411. data/ext/p7zip/CPP/7zip/Compress/PpmdEncoder.cpp +51 -18
  412. data/ext/p7zip/CPP/7zip/Compress/PpmdEncoder.h +18 -8
  413. data/ext/p7zip/CPP/7zip/Compress/PpmdRegister.cpp +9 -8
  414. data/ext/p7zip/CPP/7zip/Compress/PpmdZip.cpp +61 -25
  415. data/ext/p7zip/CPP/7zip/Compress/PpmdZip.h +21 -6
  416. data/ext/p7zip/CPP/7zip/Compress/QuantumDecoder.cpp +122 -102
  417. data/ext/p7zip/CPP/7zip/Compress/QuantumDecoder.h +68 -157
  418. data/ext/p7zip/CPP/7zip/Compress/Rar/makefile +33 -18
  419. data/ext/p7zip/CPP/7zip/Compress/Rar/makefile.depend +0 -158
  420. data/ext/p7zip/CPP/7zip/Compress/Rar/makefile.list +105 -56
  421. data/ext/p7zip/CPP/7zip/Compress/Rar1Decoder.cpp +34 -21
  422. data/ext/p7zip/CPP/7zip/Compress/Rar1Decoder.h +2 -0
  423. data/ext/p7zip/CPP/7zip/Compress/Rar2Decoder.cpp +77 -67
  424. data/ext/p7zip/CPP/7zip/Compress/Rar2Decoder.h +12 -10
  425. data/ext/p7zip/CPP/7zip/Compress/Rar3Decoder.cpp +139 -118
  426. data/ext/p7zip/CPP/7zip/Compress/Rar3Decoder.h +48 -33
  427. data/ext/p7zip/CPP/7zip/Compress/Rar3Vm.cpp +148 -113
  428. data/ext/p7zip/CPP/7zip/Compress/Rar3Vm.h +35 -19
  429. data/ext/p7zip/CPP/7zip/Compress/Rar5Decoder.cpp +961 -0
  430. data/ext/p7zip/CPP/7zip/Compress/Rar5Decoder.h +335 -0
  431. data/ext/p7zip/CPP/7zip/Compress/RarCodecsRegister.cpp +13 -6
  432. data/ext/p7zip/CPP/7zip/Compress/ShrinkDecoder.cpp +91 -71
  433. data/ext/p7zip/CPP/7zip/Compress/ShrinkDecoder.h +2 -4
  434. data/ext/p7zip/CPP/7zip/Compress/XpressDecoder.cpp +129 -0
  435. data/ext/p7zip/CPP/7zip/Compress/XpressDecoder.h +13 -0
  436. data/ext/p7zip/CPP/7zip/Compress/ZDecoder.cpp +98 -20
  437. data/ext/p7zip/CPP/7zip/Compress/ZDecoder.h +19 -7
  438. data/ext/p7zip/CPP/7zip/Compress/ZlibDecoder.cpp +14 -11
  439. data/ext/p7zip/CPP/7zip/Compress/ZlibDecoder.h +32 -1
  440. data/ext/p7zip/CPP/7zip/Crypto/7zAes.cpp +137 -101
  441. data/ext/p7zip/CPP/7zip/Crypto/7zAes.h +31 -30
  442. data/ext/p7zip/CPP/7zip/Crypto/7zAesRegister.cpp +8 -9
  443. data/ext/p7zip/CPP/7zip/Crypto/HmacSha1.cpp +39 -28
  444. data/ext/p7zip/CPP/7zip/Crypto/HmacSha1.h +3 -3
  445. data/ext/p7zip/CPP/7zip/Crypto/HmacSha256.cpp +62 -0
  446. data/ext/p7zip/CPP/7zip/Crypto/HmacSha256.h +27 -0
  447. data/ext/p7zip/CPP/7zip/Crypto/MyAes.cpp +73 -7
  448. data/ext/p7zip/CPP/7zip/Crypto/MyAes.h +25 -8
  449. data/ext/p7zip/CPP/7zip/Crypto/MyAesReg.cpp +16 -0
  450. data/ext/p7zip/CPP/7zip/Crypto/Pbkdf2HmacSha1.cpp +29 -15
  451. data/ext/p7zip/CPP/7zip/Crypto/Pbkdf2HmacSha1.h +2 -1
  452. data/ext/p7zip/CPP/7zip/Crypto/RandGen.cpp +49 -34
  453. data/ext/p7zip/CPP/7zip/Crypto/RandGen.h +2 -2
  454. data/ext/p7zip/CPP/7zip/Crypto/Rar20Crypto.cpp +36 -39
  455. data/ext/p7zip/CPP/7zip/Crypto/Rar20Crypto.h +15 -17
  456. data/ext/p7zip/CPP/7zip/Crypto/Rar5Aes.cpp +257 -0
  457. data/ext/p7zip/CPP/7zip/Crypto/Rar5Aes.h +84 -0
  458. data/ext/p7zip/CPP/7zip/Crypto/RarAes.cpp +70 -71
  459. data/ext/p7zip/CPP/7zip/Crypto/RarAes.h +24 -19
  460. data/ext/p7zip/CPP/7zip/Crypto/Sha1Cls.h +51 -0
  461. data/ext/p7zip/CPP/7zip/Crypto/WzAes.cpp +68 -54
  462. data/ext/p7zip/CPP/7zip/Crypto/WzAes.h +37 -27
  463. data/ext/p7zip/CPP/7zip/Crypto/ZipCrypto.cpp +60 -34
  464. data/ext/p7zip/CPP/7zip/Crypto/ZipCrypto.h +28 -11
  465. data/ext/p7zip/CPP/7zip/Crypto/ZipStrong.cpp +90 -28
  466. data/ext/p7zip/CPP/7zip/Crypto/ZipStrong.h +13 -2
  467. data/ext/p7zip/CPP/7zip/Guid.txt +57 -11
  468. data/ext/p7zip/CPP/7zip/ICoder.h +202 -17
  469. data/ext/p7zip/CPP/7zip/IDecl.h +16 -3
  470. data/ext/p7zip/CPP/7zip/IPassword.h +1 -2
  471. data/ext/p7zip/CPP/7zip/IProgress.h +2 -16
  472. data/ext/p7zip/CPP/7zip/IStream.h +82 -13
  473. data/ext/p7zip/CPP/7zip/MyVersion.h +2 -11
  474. data/ext/p7zip/CPP/7zip/PropID.h +60 -9
  475. data/ext/p7zip/CPP/Common/C_FileIO.cpp +5 -1
  476. data/ext/p7zip/CPP/Common/C_FileIO.h +7 -1
  477. data/ext/p7zip/CPP/Common/CommandLineParser.cpp +122 -148
  478. data/ext/p7zip/CPP/Common/CommandLineParser.h +20 -29
  479. data/ext/p7zip/CPP/Common/Common.h +13 -0
  480. data/ext/p7zip/CPP/Common/CrcReg.cpp +98 -0
  481. data/ext/p7zip/CPP/Common/Defs.h +5 -10
  482. data/ext/p7zip/CPP/Common/DynLimBuf.cpp +93 -0
  483. data/ext/p7zip/CPP/Common/DynLimBuf.h +40 -0
  484. data/ext/p7zip/CPP/Common/DynamicBuffer.h +45 -31
  485. data/ext/p7zip/CPP/Common/IntToString.cpp +109 -40
  486. data/ext/p7zip/CPP/Common/IntToString.h +14 -9
  487. data/ext/p7zip/CPP/Common/Lang.cpp +120 -87
  488. data/ext/p7zip/CPP/Common/Lang.h +10 -15
  489. data/ext/p7zip/CPP/Common/ListFileUtils.cpp +82 -40
  490. data/ext/p7zip/CPP/Common/ListFileUtils.h +7 -4
  491. data/ext/p7zip/CPP/Common/MyBuffer.h +244 -0
  492. data/ext/p7zip/CPP/Common/MyCom.h +65 -28
  493. data/ext/p7zip/CPP/Common/MyGuidDef.h +1 -1
  494. data/ext/p7zip/CPP/Common/MyInitGuid.h +23 -0
  495. data/ext/p7zip/CPP/Common/MyLinux.h +42 -0
  496. data/ext/p7zip/CPP/Common/MyMap.cpp +8 -8
  497. data/ext/p7zip/CPP/Common/MyMap.h +2 -2
  498. data/ext/p7zip/CPP/Common/MyString.cpp +1643 -117
  499. data/ext/p7zip/CPP/Common/MyString.h +677 -486
  500. data/ext/p7zip/CPP/Common/MyTypes.h +38 -0
  501. data/ext/p7zip/CPP/Common/MyUnknown.h +4 -0
  502. data/ext/p7zip/CPP/Common/MyVector.cpp +0 -84
  503. data/ext/p7zip/CPP/Common/MyVector.h +472 -112
  504. data/ext/p7zip/CPP/Common/MyWindows.cpp +18 -1
  505. data/ext/p7zip/CPP/Common/MyWindows.h +8 -0
  506. data/ext/p7zip/CPP/Common/MyXml.cpp +169 -118
  507. data/ext/p7zip/CPP/Common/MyXml.h +14 -11
  508. data/ext/p7zip/CPP/Common/NewHandler.cpp +39 -0
  509. data/ext/p7zip/CPP/Common/NewHandler.h +55 -2
  510. data/ext/p7zip/CPP/Common/Random.h +14 -0
  511. data/ext/p7zip/CPP/Common/Sha1Reg.cpp +40 -0
  512. data/ext/p7zip/CPP/Common/Sha256Reg.cpp +40 -0
  513. data/ext/p7zip/CPP/Common/StdInStream.cpp +46 -27
  514. data/ext/p7zip/CPP/Common/StdInStream.h +11 -10
  515. data/ext/p7zip/CPP/Common/StdOutStream.cpp +48 -35
  516. data/ext/p7zip/CPP/Common/StdOutStream.h +44 -17
  517. data/ext/p7zip/CPP/Common/StringConvert.cpp +56 -17
  518. data/ext/p7zip/CPP/Common/StringConvert.h +7 -3
  519. data/ext/p7zip/CPP/Common/StringToInt.cpp +102 -48
  520. data/ext/p7zip/CPP/Common/StringToInt.h +13 -10
  521. data/ext/p7zip/CPP/Common/TextConfig.cpp +33 -47
  522. data/ext/p7zip/CPP/Common/TextConfig.h +3 -6
  523. data/ext/p7zip/CPP/Common/UTFConvert.cpp +218 -75
  524. data/ext/p7zip/CPP/Common/UTFConvert.h +4 -3
  525. data/ext/p7zip/CPP/Common/Wildcard.cpp +345 -125
  526. data/ext/p7zip/CPP/Common/Wildcard.h +82 -13
  527. data/ext/p7zip/CPP/Common/XzCrc64Reg.cpp +42 -0
  528. data/ext/p7zip/CPP/Windows/FileDir.cpp +427 -475
  529. data/ext/p7zip/CPP/Windows/FileDir.h +94 -72
  530. data/ext/p7zip/CPP/Windows/FileFind.cpp +235 -244
  531. data/ext/p7zip/CPP/Windows/FileFind.h +63 -59
  532. data/ext/p7zip/CPP/Windows/FileIO.cpp +29 -46
  533. data/ext/p7zip/CPP/Windows/FileIO.h +40 -42
  534. data/ext/p7zip/CPP/Windows/FileName.cpp +696 -17
  535. data/ext/p7zip/CPP/Windows/FileName.h +11 -3
  536. data/ext/p7zip/CPP/Windows/NtCheck.h +2 -0
  537. data/ext/p7zip/CPP/Windows/PropVariant.cpp +134 -30
  538. data/ext/p7zip/CPP/Windows/PropVariant.h +80 -24
  539. data/ext/p7zip/CPP/Windows/PropVariantUtils.cpp +89 -18
  540. data/ext/p7zip/CPP/Windows/PropVariantUtils.h +12 -7
  541. data/ext/p7zip/CPP/Windows/System.cpp +20 -15
  542. data/ext/p7zip/CPP/Windows/System.h +3 -2
  543. data/ext/p7zip/CPP/Windows/TimeUtils.cpp +203 -0
  544. data/ext/p7zip/CPP/Windows/TimeUtils.h +24 -0
  545. data/ext/p7zip/CPP/include_windows/basetyps.h +4 -4
  546. data/ext/p7zip/CPP/include_windows/windows.h +17 -11
  547. data/ext/p7zip/CPP/myWindows/StdAfx.h +97 -5
  548. data/ext/p7zip/CPP/myWindows/config.h +20 -5
  549. data/ext/p7zip/CPP/myWindows/myPrivate.h +8 -0
  550. data/ext/p7zip/CPP/myWindows/wine_date_and_time.cpp +34 -0
  551. data/ext/p7zip/ChangeLog +283 -35
  552. data/ext/p7zip/{DOCS → DOC}/7zC.txt +6 -13
  553. data/ext/p7zip/{DOCS → DOC}/License.txt +3 -2
  554. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/add.htm +93 -87
  555. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/bench.htm +88 -79
  556. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/delete.htm +62 -59
  557. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/extract.htm +96 -91
  558. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/extract_full.htm +73 -68
  559. data/ext/p7zip/DOC/MANUAL/cmdline/commands/hash.htm +65 -0
  560. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/index.htm +36 -33
  561. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/list.htm +78 -77
  562. data/ext/p7zip/DOC/MANUAL/cmdline/commands/rename.htm +51 -0
  563. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/style.css +232 -232
  564. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/test.htm +47 -46
  565. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/update.htm +71 -66
  566. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/exit_codes.htm +27 -27
  567. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/index.htm +29 -29
  568. data/ext/p7zip/{DOCS/MANUAL/switches → DOC/MANUAL/cmdline}/style.css +232 -232
  569. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/ar_exclude.htm +56 -56
  570. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/ar_include.htm +80 -83
  571. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/ar_no.htm +52 -52
  572. data/ext/p7zip/DOC/MANUAL/cmdline/switches/bb.htm +61 -0
  573. data/ext/p7zip/DOC/MANUAL/cmdline/switches/bs.htm +67 -0
  574. data/ext/p7zip/DOC/MANUAL/cmdline/switches/charset.htm +61 -0
  575. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/exclude.htm +71 -60
  576. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/include.htm +89 -87
  577. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/index.htm +95 -64
  578. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/large_pages.htm +59 -50
  579. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/list_tech.htm +36 -36
  580. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/method.htm +738 -625
  581. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/output_dir.htm +53 -53
  582. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/overwrite.htm +56 -56
  583. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/password.htm +55 -54
  584. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/recurse.htm +85 -83
  585. data/ext/p7zip/DOC/MANUAL/cmdline/switches/sa.htm +58 -0
  586. data/ext/p7zip/DOC/MANUAL/cmdline/switches/scc.htm +42 -0
  587. data/ext/p7zip/DOC/MANUAL/cmdline/switches/scrc.htm +53 -0
  588. data/ext/p7zip/DOC/MANUAL/cmdline/switches/sdel.htm +39 -0
  589. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/sfx.htm +153 -156
  590. data/ext/p7zip/DOC/MANUAL/cmdline/switches/shared.htm +40 -0
  591. data/ext/p7zip/DOC/MANUAL/cmdline/switches/sni.htm +56 -0
  592. data/ext/p7zip/DOC/MANUAL/cmdline/switches/sns.htm +77 -0
  593. data/ext/p7zip/DOC/MANUAL/cmdline/switches/spf.htm +80 -0
  594. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/ssc.htm +50 -50
  595. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/stdin.htm +56 -55
  596. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/stdout.htm +54 -50
  597. data/ext/p7zip/DOC/MANUAL/cmdline/switches/stl.htm +39 -0
  598. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/stop_switch.htm +31 -31
  599. data/ext/p7zip/DOC/MANUAL/cmdline/switches/stx.htm +50 -0
  600. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline/switches}/style.css +232 -232
  601. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/type.htm +121 -83
  602. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/update.htm +177 -176
  603. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/volume.htm +49 -49
  604. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/working_dir.htm +56 -55
  605. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/yes.htm +48 -48
  606. data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/syntax.htm +120 -120
  607. data/ext/p7zip/DOC/MANUAL/fm/about.htm +21 -0
  608. data/ext/p7zip/DOC/MANUAL/fm/benchmark.htm +56 -0
  609. data/ext/p7zip/DOC/MANUAL/fm/index.htm +54 -0
  610. data/ext/p7zip/DOC/MANUAL/fm/menu.htm +154 -0
  611. data/ext/p7zip/DOC/MANUAL/fm/options.htm +152 -0
  612. data/ext/p7zip/DOC/MANUAL/fm/plugins/7-zip/add.htm +311 -0
  613. data/ext/p7zip/DOC/MANUAL/fm/plugins/7-zip/extract.htm +78 -0
  614. data/ext/p7zip/DOC/MANUAL/fm/plugins/7-zip/index.htm +63 -0
  615. data/ext/p7zip/DOC/MANUAL/fm/plugins/7-zip/style.css +232 -0
  616. data/ext/p7zip/DOC/MANUAL/fm/plugins/index.htm +22 -0
  617. data/ext/p7zip/DOC/MANUAL/fm/plugins/style.css +232 -0
  618. data/ext/p7zip/DOC/MANUAL/fm/style.css +232 -0
  619. data/ext/p7zip/DOC/MANUAL/general/7z.htm +117 -0
  620. data/ext/p7zip/DOC/MANUAL/general/faq.htm +125 -0
  621. data/ext/p7zip/DOC/MANUAL/general/formats.htm +100 -0
  622. data/ext/p7zip/DOC/MANUAL/general/index.htm +27 -0
  623. data/ext/p7zip/DOC/MANUAL/general/license.htm +30 -0
  624. data/ext/p7zip/DOC/MANUAL/general/performance.htm +98 -0
  625. data/ext/p7zip/DOC/MANUAL/general/style.css +232 -0
  626. data/ext/p7zip/DOC/MANUAL/general/thanks.htm +43 -0
  627. data/ext/p7zip/DOC/MANUAL/start.htm +37 -0
  628. data/ext/p7zip/DOC/MANUAL/style.css +232 -0
  629. data/ext/p7zip/DOC/Methods.txt +158 -0
  630. data/ext/p7zip/{DOCS → DOC}/copying.txt +9 -11
  631. data/ext/p7zip/DOC/lzma.txt +328 -0
  632. data/ext/p7zip/{DOCS → DOC}/readme.txt +42 -65
  633. data/ext/p7zip/{DOCS/history.txt → DOC/src-history.txt} +88 -2
  634. data/ext/p7zip/README +117 -91
  635. data/ext/p7zip/TODO +0 -2
  636. data/ext/p7zip/install.sh +31 -29
  637. data/ext/p7zip/last_error +1 -0
  638. data/ext/p7zip/makefile +29 -125
  639. data/ext/p7zip/makefile.afl +23 -0
  640. data/ext/p7zip/makefile.aix_gcc +5 -4
  641. data/ext/p7zip/makefile.android_arm +49 -0
  642. data/ext/p7zip/makefile.beos +5 -4
  643. data/ext/p7zip/makefile.common +150 -0
  644. data/ext/p7zip/makefile.crc32 +3 -3
  645. data/ext/p7zip/makefile.cygwin +5 -4
  646. data/ext/p7zip/makefile.cygwin64 +21 -0
  647. data/ext/p7zip/makefile.cygwin64_asm +22 -0
  648. data/ext/p7zip/makefile.cygwin_asm +6 -4
  649. data/ext/p7zip/makefile.cygwin_clang +21 -0
  650. data/ext/p7zip/makefile.cygwin_clang_asm +23 -0
  651. data/ext/p7zip/{makefile.djgpp_old → makefile.djgpp} +5 -4
  652. data/ext/p7zip/makefile.djgpp_watt +7 -5
  653. data/ext/p7zip/makefile.freebsd5 +5 -4
  654. data/ext/p7zip/{makefile.freebsd6 → makefile.freebsd6+} +6 -5
  655. data/ext/p7zip/makefile.glb +27 -18
  656. data/ext/p7zip/makefile.gprof +3 -2
  657. data/ext/p7zip/makefile.haiku +19 -0
  658. data/ext/p7zip/makefile.hpux-acc +3 -2
  659. data/ext/p7zip/makefile.hpux-acc_64 +3 -2
  660. data/ext/p7zip/makefile.hpux-gcc +5 -4
  661. data/ext/p7zip/makefile.linux_amd64 +5 -4
  662. data/ext/p7zip/makefile.linux_amd64_asm +12 -5
  663. data/ext/p7zip/makefile.linux_amd64_asm_icc +5 -3
  664. data/ext/p7zip/makefile.linux_amd64_sanitizer +26 -0
  665. data/ext/p7zip/makefile.linux_any_cpu +5 -4
  666. data/ext/p7zip/makefile.linux_any_cpu_gcc_4.X +7 -4
  667. data/ext/p7zip/makefile.linux_clang_amd64_asm +25 -0
  668. data/ext/p7zip/makefile.linux_clang_amd64_asm_sanitize +27 -0
  669. data/ext/p7zip/makefile.linux_cross_aarch64 +25 -0
  670. data/ext/p7zip/makefile.linux_cross_arm +7 -4
  671. data/ext/p7zip/makefile.linux_cross_djgpp +27 -0
  672. data/ext/p7zip/makefile.linux_cross_m68k +26 -0
  673. data/ext/p7zip/makefile.linux_cross_mipsel +27 -0
  674. data/ext/p7zip/makefile.linux_cross_ppc +25 -0
  675. data/ext/p7zip/makefile.linux_cross_ppc64 +25 -0
  676. data/ext/p7zip/makefile.linux_cross_ppc64le +25 -0
  677. data/ext/p7zip/makefile.linux_cross_s390x +25 -0
  678. data/ext/p7zip/makefile.linux_cross_sparc64 +25 -0
  679. data/ext/p7zip/makefile.linux_gcc6_sanitize +23 -0
  680. data/ext/p7zip/makefile.linux_gcc_2.95_no_need_for_libstdc +6 -4
  681. data/ext/p7zip/makefile.linux_other +6 -5
  682. data/ext/p7zip/makefile.linux_s390x +5 -4
  683. data/ext/p7zip/{makefile.machine_base → makefile.linux_scan-build} +5 -4
  684. data/ext/p7zip/makefile.linux_valgrind +25 -0
  685. data/ext/p7zip/{makefile.linux_clang_amd64 → makefile.linux_x32} +6 -5
  686. data/ext/p7zip/makefile.linux_x86_asm_gcc_4.X +10 -5
  687. data/ext/p7zip/makefile.linux_x86_asm_gcc_4.X_fltk +8 -4
  688. data/ext/p7zip/makefile.linux_x86_asm_gcc_mudflap_4.X +4 -2
  689. data/ext/p7zip/makefile.linux_x86_asm_icc +4 -2
  690. data/ext/p7zip/makefile.linux_x86_icc +3 -2
  691. data/ext/p7zip/makefile.macosx_arm64 +17 -0
  692. data/ext/p7zip/{makefile.macosx_32bits → makefile.macosx_gcc_32bits} +3 -2
  693. data/ext/p7zip/{makefile.macosx_32bits_asm → makefile.macosx_gcc_32bits_asm} +5 -3
  694. data/ext/p7zip/{makefile.macosx_32bits_ppc → makefile.macosx_gcc_32bits_ppc} +3 -2
  695. data/ext/p7zip/{makefile.macosx_64bits → makefile.macosx_gcc_64bits} +3 -2
  696. data/ext/p7zip/makefile.macosx_llvm_64bits +9 -3
  697. data/ext/p7zip/makefile.netbsd +5 -4
  698. data/ext/p7zip/makefile.netware_asm_gcc_3.X +6 -4
  699. data/ext/p7zip/makefile.oldmake +41 -130
  700. data/ext/p7zip/makefile.openbsd +7 -3
  701. data/ext/p7zip/makefile.openbsd_no_port +9 -5
  702. data/ext/p7zip/makefile.qnx_shared.bin +5 -4
  703. data/ext/p7zip/makefile.qnx_static +5 -4
  704. data/ext/p7zip/makefile.solaris_sparc_CC_32 +5 -4
  705. data/ext/p7zip/makefile.solaris_sparc_CC_64 +6 -4
  706. data/ext/p7zip/makefile.solaris_sparc_gcc +7 -6
  707. data/ext/p7zip/makefile.solaris_x86 +5 -4
  708. data/ext/p7zip/makefile.tru64 +5 -4
  709. data/ext/seven_zip_ruby/extconf.rb +92 -6
  710. data/ext/seven_zip_ruby/seven_zip_archive.cpp +40 -17
  711. data/ext/seven_zip_ruby/seven_zip_archive.h +1 -1
  712. data/ext/seven_zip_ruby/utils.cpp +267 -124
  713. data/ext/seven_zip_ruby/utils.h +2 -0
  714. data/lib/seven_zip_ruby/7z.dll +0 -0
  715. data/lib/seven_zip_ruby/7z.sfx +0 -0
  716. data/lib/seven_zip_ruby/7z64.dll +0 -0
  717. data/lib/seven_zip_ruby/7zCon.sfx +0 -0
  718. data/lib/seven_zip_ruby/seven_zip_reader.rb +16 -1
  719. data/lib/seven_zip_ruby/version.rb +1 -1
  720. data/p7zip/.gitignore +7 -0
  721. data/p7zip/README.txt +29 -0
  722. data/p7zip/extract.sh +134 -0
  723. data/spec/seven_zip_ruby_spec.rb +22 -13
  724. data/test/res/The Flying Spaghetti Monster.txt +3 -0
  725. data/test/res/The Three Little Pigs.txt +5 -0
  726. data/test/res/UTF_content.txt +3 -0
  727. data/test/res/test_reader_data.7z +0 -0
  728. data/test/res/test_reader_filename_cp932.7z +0 -0
  729. data/test/res/test_reader_files.7z +0 -0
  730. data/test/test_seven_zip_reader.rb +187 -0
  731. data/test/test_seven_zip_writer.rb +184 -0
  732. metadata +267 -219
  733. data/.github/workflows/test-and-release.yml +0 -43
  734. data/ext/C/Types.h +0 -254
  735. data/ext/CPP/7zip/Archive/IArchive.h +0 -234
  736. data/ext/CPP/7zip/IDecl.h +0 -15
  737. data/ext/CPP/7zip/IPassword.h +0 -24
  738. data/ext/CPP/7zip/IProgress.h +0 -33
  739. data/ext/CPP/7zip/IStream.h +0 -58
  740. data/ext/CPP/7zip/PropID.h +0 -76
  741. data/ext/CPP/Common/MyCom.h +0 -225
  742. data/ext/CPP/Common/MyGuidDef.h +0 -54
  743. data/ext/CPP/Common/MyInitGuid.h +0 -22
  744. data/ext/CPP/Common/MyUnknown.h +0 -13
  745. data/ext/CPP/Common/MyWindows.h +0 -204
  746. data/ext/CPP/Common/Types.h +0 -11
  747. data/ext/CPP/Windows/PropVariant.h +0 -56
  748. data/ext/CPP/include_windows/basetyps.h +0 -19
  749. data/ext/CPP/include_windows/tchar.h +0 -89
  750. data/ext/CPP/include_windows/windows.h +0 -194
  751. data/ext/p7zip/Asm/x64/7zCrcT8U.asm +0 -103
  752. data/ext/p7zip/Asm/x86/7zCrcT8U.asm +0 -101
  753. data/ext/p7zip/C/7zCrcT8.c +0 -43
  754. data/ext/p7zip/C/Alloc.back3 +0 -238
  755. data/ext/p7zip/C/Alloc.c.back +0 -243
  756. data/ext/p7zip/C/Alloc.c.back2 +0 -222
  757. data/ext/p7zip/C/LzmaUtil/Lzma86Dec.h +0 -51
  758. data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderOutStream.cpp +0 -149
  759. data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderOutStream.h +0 -58
  760. data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHeader.cpp +0 -24
  761. data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHeader.h +0 -28
  762. data/ext/p7zip/CPP/7zip/Archive/Chm/ChmRegister.cpp +0 -13
  763. data/ext/p7zip/CPP/7zip/Archive/Com/ComHandler.cpp +0 -239
  764. data/ext/p7zip/CPP/7zip/Archive/Com/ComHandler.h +0 -28
  765. data/ext/p7zip/CPP/7zip/Archive/Com/ComIn.cpp +0 -389
  766. data/ext/p7zip/CPP/7zip/Archive/Com/ComIn.h +0 -119
  767. data/ext/p7zip/CPP/7zip/Archive/Com/ComRegister.cpp +0 -13
  768. data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2MT.cpp +0 -240
  769. data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2MT.h +0 -80
  770. data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2ST.cpp +0 -239
  771. data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2ST.h +0 -88
  772. data/ext/p7zip/CPP/7zip/Archive/Common/CrossThreadProgress.cpp +0 -15
  773. data/ext/p7zip/CPP/7zip/Archive/Common/CrossThreadProgress.h +0 -37
  774. data/ext/p7zip/CPP/7zip/Archive/DebHandler.cpp +0 -413
  775. data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsHandler.cpp +0 -243
  776. data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsHandler.h +0 -26
  777. data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsIn.cpp +0 -480
  778. data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsIn.h +0 -154
  779. data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsRegister.cpp +0 -13
  780. data/ext/p7zip/CPP/7zip/Archive/Rar/RarHeader.cpp +0 -21
  781. data/ext/p7zip/CPP/7zip/Archive/Rar/RarIn.cpp +0 -478
  782. data/ext/p7zip/CPP/7zip/Archive/Rar/RarIn.h +0 -123
  783. data/ext/p7zip/CPP/7zip/Archive/Rar/RarItem.cpp +0 -55
  784. data/ext/p7zip/CPP/7zip/Archive/Rar/RarRegister.cpp +0 -13
  785. data/ext/p7zip/CPP/7zip/Archive/Rar/RarVolumeInStream.cpp +0 -78
  786. data/ext/p7zip/CPP/7zip/Archive/Rar/RarVolumeInStream.h +0 -49
  787. data/ext/p7zip/CPP/7zip/Archive/Udf/UdfRegister.cpp +0 -13
  788. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHeader.cpp +0 -36
  789. data/ext/p7zip/CPP/7zip/Archive/Zip/ZipItemEx.h +0 -34
  790. data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_7zFM.txt +0 -163
  791. data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_7zG.txt +0 -131
  792. data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_7za.txt +0 -253
  793. data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_ALL.txt +0 -32
  794. data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_Format7zFree.txt +0 -290
  795. data/ext/p7zip/CPP/7zip/CMAKE/generate.sh +0 -37
  796. data/ext/p7zip/CPP/7zip/CMAKE/generate_xcode.sh +0 -32
  797. data/ext/p7zip/CPP/7zip/Common/LockedStream.cpp +0 -23
  798. data/ext/p7zip/CPP/7zip/Common/LockedStream.h +0 -38
  799. data/ext/p7zip/CPP/7zip/Compress/ArjDecoder1.cpp +0 -309
  800. data/ext/p7zip/CPP/7zip/Compress/ArjDecoder1.h +0 -98
  801. data/ext/p7zip/CPP/7zip/Compress/ArjDecoder2.cpp +0 -90
  802. data/ext/p7zip/CPP/7zip/Compress/ArjDecoder2.h +0 -59
  803. data/ext/p7zip/CPP/7zip/Compress/BranchCoder.cpp +0 -19
  804. data/ext/p7zip/CPP/7zip/Compress/BranchCoder.h +0 -44
  805. data/ext/p7zip/CPP/7zip/Compress/DllExports.cpp +0 -39
  806. data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp +0 -531
  807. data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp +0 -1018
  808. data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBench.h +0 -48
  809. data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp +0 -311
  810. data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.h +0 -20
  811. data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/makefile +0 -173
  812. data/ext/p7zip/CPP/7zip/Compress/Lzx86Converter.cpp +0 -90
  813. data/ext/p7zip/CPP/7zip/Compress/Lzx86Converter.h +0 -46
  814. data/ext/p7zip/CPP/7zip/Compress/RangeCoder.h +0 -205
  815. data/ext/p7zip/CPP/7zip/Compress/RangeCoderBit.h +0 -114
  816. data/ext/p7zip/CPP/7zip/Crypto/Sha1.cpp +0 -229
  817. data/ext/p7zip/CPP/7zip/Crypto/Sha1.h +0 -68
  818. data/ext/p7zip/CPP/7zip/PREMAKE/generate.sh +0 -18
  819. data/ext/p7zip/CPP/7zip/PREMAKE/premake4.lua +0 -263
  820. data/ext/p7zip/CPP/7zip/QMAKE/7ZA/7ZA.pro +0 -228
  821. data/ext/p7zip/CPP/7zip/QMAKE/7ZA/7ZA_osx.pro +0 -228
  822. data/ext/p7zip/CPP/7zip/QMAKE/test_emul/test_emul.pro +0 -26
  823. data/ext/p7zip/CPP/7zip/TEST/TestUI/TestUI.cpp +0 -560
  824. data/ext/p7zip/CPP/7zip/TEST/TestUI/makefile +0 -33
  825. data/ext/p7zip/CPP/7zip/TEST/TestUI/makefile.depend +0 -577
  826. data/ext/p7zip/CPP/7zip/TEST/TestUI/makefile.list +0 -16
  827. data/ext/p7zip/CPP/Common/Buffer.h +0 -77
  828. data/ext/p7zip/CPP/Common/Types.h +0 -11
  829. data/ext/p7zip/CPP/Windows/COM.cpp +0 -37
  830. data/ext/p7zip/CPP/Windows/COM.h +0 -69
  831. data/ext/p7zip/CPP/Windows/Clipboard.cpp +0 -160
  832. data/ext/p7zip/CPP/Windows/Clipboard.h +0 -28
  833. data/ext/p7zip/CPP/Windows/CommonDialog.h +0 -19
  834. data/ext/p7zip/CPP/Windows/Control/ComboBox.h +0 -82
  835. data/ext/p7zip/CPP/Windows/Control/Controls.cpp +0 -515
  836. data/ext/p7zip/CPP/Windows/Control/Dialog.cpp +0 -560
  837. data/ext/p7zip/CPP/Windows/Control/Dialog.h +0 -179
  838. data/ext/p7zip/CPP/Windows/Control/DialogImpl.h +0 -73
  839. data/ext/p7zip/CPP/Windows/Control/Edit.h +0 -24
  840. data/ext/p7zip/CPP/Windows/Control/ListView.h +0 -164
  841. data/ext/p7zip/CPP/Windows/Control/ProgressBar.h +0 -34
  842. data/ext/p7zip/CPP/Windows/Control/Static.h +0 -23
  843. data/ext/p7zip/CPP/Windows/Control/StatusBar.h +0 -56
  844. data/ext/p7zip/CPP/Windows/Control/Window2.cpp +0 -211
  845. data/ext/p7zip/CPP/Windows/Control/Window2.h +0 -111
  846. data/ext/p7zip/CPP/Windows/DLL.cpp +0 -193
  847. data/ext/p7zip/CPP/Windows/DLL.h +0 -48
  848. data/ext/p7zip/CPP/Windows/Error.cpp +0 -58
  849. data/ext/p7zip/CPP/Windows/Error.h +0 -33
  850. data/ext/p7zip/CPP/Windows/Menu.h +0 -4
  851. data/ext/p7zip/CPP/Windows/PropVariantConversions.cpp +0 -142
  852. data/ext/p7zip/CPP/Windows/PropVariantConversions.h +0 -14
  853. data/ext/p7zip/CPP/Windows/Registry.cpp +0 -313
  854. data/ext/p7zip/CPP/Windows/Registry.h +0 -113
  855. data/ext/p7zip/CPP/Windows/ResourceString.h +0 -22
  856. data/ext/p7zip/CPP/Windows/Shell.h +0 -21
  857. data/ext/p7zip/CPP/Windows/Time.cpp +0 -88
  858. data/ext/p7zip/CPP/Windows/Time.h +0 -21
  859. data/ext/p7zip/CPP/Windows/Window.cpp +0 -101
  860. data/ext/p7zip/CPP/Windows/Window.h +0 -43
  861. data/ext/p7zip/CPP/myWindows/initguid.h +0 -4
  862. data/ext/p7zip/CPP/myWindows/makefile +0 -21
  863. data/ext/p7zip/CPP/myWindows/makefile.depend +0 -32
  864. data/ext/p7zip/CPP/myWindows/makefile.list +0 -28
  865. data/ext/p7zip/CPP/myWindows/myAddExeFlag.cpp +0 -20
  866. data/ext/p7zip/CPP/myWindows/myGetTickCount.cpp +0 -8
  867. data/ext/p7zip/CPP/myWindows/mySplitCommandLine.cpp +0 -82
  868. data/ext/p7zip/CPP/myWindows/test_emul.cpp +0 -745
  869. data/ext/p7zip/CPP/myWindows/wine_GetXXXDefaultLangID.cpp +0 -741
  870. data/ext/p7zip/DOCS/MANUAL/switches/charset.htm +0 -49
  871. data/ext/p7zip/DOCS/Methods.txt +0 -152
  872. data/ext/p7zip/DOCS/lzma.txt +0 -598
  873. data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/ChangeLog +0 -41
  874. data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/readme +0 -21
  875. data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/readme.u7z +0 -30
  876. data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/u7z +0 -133
  877. data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/README +0 -21
  878. data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/check/check.sh +0 -117
  879. data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/check/files.tar +0 -0
  880. data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/man1/p7zip.1 +0 -33
  881. data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/p7zip +0 -144
  882. data/ext/p7zip/contrib/qnx630sp3/qnx630sp3-shared +0 -14
  883. data/ext/p7zip/contrib/qnx630sp3/qnx630sp3-static +0 -10
  884. data/ext/p7zip/integration_context_menu.txt +0 -51
  885. data/ext/p7zip/makefile.rules +0 -661
  886. /data/ext/p7zip/{DOCS → DOC}/7zFormat.txt +0 -0
  887. /data/ext/p7zip/{DOCS → DOC}/unRarLicense.txt +0 -0
@@ -1,153 +1,320 @@
1
- // Common/String.cpp
1
+ // Common/MyString.cpp
2
2
 
3
3
  #include "StdAfx.h"
4
4
 
5
+ #ifdef _WIN32
6
+ #include <wchar.h>
7
+ #else
5
8
  #include <ctype.h>
6
- #ifdef ENV_HAVE_WCTYPE_H
7
- #include <wctype.h>
8
9
  #endif
9
- #include "StringConvert.h" // FIXED
10
-
11
- #include "MyString.h" // FIXED to avoid confusion with <string.h> on some filesystems
12
-
13
- #include <stdio.h>
14
- #include <stdlib.h>
15
10
 
16
- #ifdef ENV_HAVE_WCHAR__H
17
- #include <wchar.h>
11
+ #if !defined(_UNICODE) || !defined(USE_UNICODE_FSTRING)
12
+ #include "StringConvert.h"
18
13
  #endif
19
14
 
20
- #include <limits.h>
21
- #ifndef MB_LEN_MAX
22
- #define MB_LEN_MAX 1024
23
- #endif
15
+ #include "MyString.h"
24
16
 
25
- #include "myPrivate.h"
17
+ #define MY_STRING_NEW(_T_, _size_) new _T_[_size_]
18
+ // #define MY_STRING_NEW(_T_, _size_) ((_T_ *)my_new((size_t)(_size_) * sizeof(_T_)))
26
19
 
27
- LPSTR WINAPI CharPrevA( LPCSTR start, LPCSTR ptr ) { // OK for MBS
28
- while (*start && (start < ptr)) {
29
- LPCSTR next = CharNextA( start );
30
- if (next >= ptr)
31
- break;
32
- start = next;
20
+ /*
21
+ inline const char* MyStringGetNextCharPointer(const char *p) throw()
22
+ {
23
+ #if defined(_WIN32) && !defined(UNDER_CE)
24
+ return CharNextA(p);
25
+ #else
26
+ return p + 1;
27
+ #endif
28
+ }
29
+ */
30
+
31
+ int FindCharPosInString(const char *s, char c) throw()
32
+ {
33
+ for (const char *p = s;; p++)
34
+ {
35
+ if (*p == c)
36
+ return (int)(p - s);
37
+ if (*p == 0)
38
+ return -1;
39
+ // MyStringGetNextCharPointer(p);
33
40
  }
34
- return (LPSTR)start;
35
41
  }
36
42
 
37
- LPSTR WINAPI CharNextA( LPCSTR ptr ) {
38
- if (!*ptr)
39
- return (LPSTR)ptr;
40
- // #ifdef ENV_HAVE_MBRTOWC
41
- // if (global_use_utf16_conversion)
42
- // {
43
- // wchar_t wc;
44
- // size_t len = mbrtowc(&wc,ptr,MB_LEN_MAX,0); // mbrtowc stales on some configurations.
45
- // if (len >= 1) return (LPSTR)(ptr + len);
46
- // printf("INTERNAL ERROR - CharNextA\n");
47
- // exit(EXIT_FAILURE);
48
- // } else {
49
- // return (LPSTR)(ptr + 1);
50
- // }
51
- //#else
52
- return (LPSTR)(ptr + 1); // p7zip search only for ASCII characters like '/' so no need to worry about current locale
53
- //#endif
43
+ int FindCharPosInString(const wchar_t *s, wchar_t c) throw()
44
+ {
45
+ for (const wchar_t *p = s;; p++)
46
+ {
47
+ if (*p == c)
48
+ return (int)(p - s);
49
+ if (*p == 0)
50
+ return -1;
51
+ }
54
52
  }
55
53
 
56
- char MyCharLower(char c)
54
+ /*
55
+ void MyStringUpper_Ascii(wchar_t *s)
57
56
  {
58
- int r = c & 0xFF;
57
+ for (;;)
58
+ {
59
+ wchar_t c = *s;
60
+ if (c == 0)
61
+ return;
62
+ *s++ = MyCharUpper_Ascii(c);
63
+ }
64
+ }
65
+ */
59
66
 
60
- return tolower(r);
67
+ void MyStringLower_Ascii(char *s) throw()
68
+ {
69
+ for (;;)
70
+ {
71
+ char c = *s;
72
+ if (c == 0)
73
+ return;
74
+ *s++ = MyCharLower_Ascii(c);
75
+ }
61
76
  }
62
77
 
63
- wchar_t MyCharLower(wchar_t c)
78
+ void MyStringLower_Ascii(wchar_t *s) throw()
64
79
  {
65
- #ifdef ENV_HAVE_TOWUPPER
66
- return towlower(c);
80
+ for (;;)
81
+ {
82
+ wchar_t c = *s;
83
+ if (c == 0)
84
+ return;
85
+ *s++ = MyCharLower_Ascii(c);
86
+ }
87
+ }
88
+
89
+ #ifdef _WIN32
90
+
91
+ #ifdef _UNICODE
92
+
93
+ // wchar_t * MyStringUpper(wchar_t *s) { return CharUpperW(s); }
94
+ // wchar_t * MyStringLower(wchar_t *s) { return CharLowerW(s); }
95
+ // for WinCE - FString - char
96
+ // const char *MyStringGetPrevCharPointer(const char * /* base */, const char *p) { return p - 1; }
97
+
67
98
  #else
68
- int ret = c;
69
- if ((ret >= 1) && (ret <256)) ret = tolower(ret);
70
- return (wchar_t)ret;
71
- #endif
99
+
100
+ // const char * MyStringGetPrevCharPointer(const char *base, const char *p) throw() { return CharPrevA(base, p); }
101
+ // char * MyStringUpper(char *s) { return CharUpperA(s); }
102
+ // char * MyStringLower(char *s) { return CharLowerA(s); }
103
+
104
+ wchar_t MyCharUpper_WIN(wchar_t c) throw()
105
+ {
106
+ wchar_t *res = CharUpperW((LPWSTR)(UINT_PTR)(unsigned)c);
107
+ if (res != 0 || ::GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
108
+ return (wchar_t)(unsigned)(UINT_PTR)res;
109
+ const int kBufSize = 4;
110
+ char s[kBufSize + 1];
111
+ int numChars = ::WideCharToMultiByte(CP_ACP, 0, &c, 1, s, kBufSize, 0, 0);
112
+ if (numChars == 0 || numChars > kBufSize)
113
+ return c;
114
+ s[numChars] = 0;
115
+ ::CharUpperA(s);
116
+ ::MultiByteToWideChar(CP_ACP, 0, s, numChars, &c, 1);
117
+ return c;
72
118
  }
73
119
 
74
- char * MyStringLower(char *s)
120
+ /*
121
+ wchar_t MyCharLower_WIN(wchar_t c)
122
+ {
123
+ wchar_t *res = CharLowerW((LPWSTR)(UINT_PTR)(unsigned)c);
124
+ if (res != 0 || ::GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
125
+ return (wchar_t)(unsigned)(UINT_PTR)res;
126
+ const int kBufSize = 4;
127
+ char s[kBufSize + 1];
128
+ int numChars = ::WideCharToMultiByte(CP_ACP, 0, &c, 1, s, kBufSize, 0, 0);
129
+ if (numChars == 0 || numChars > kBufSize)
130
+ return c;
131
+ s[numChars] = 0;
132
+ ::CharLowerA(s);
133
+ ::MultiByteToWideChar(CP_ACP, 0, s, numChars, &c, 1);
134
+ return c;
135
+ }
136
+ */
137
+
138
+ /*
139
+ wchar_t * MyStringUpper(wchar_t *s)
75
140
  {
76
141
  if (s == 0)
77
142
  return 0;
78
- char *ret = s;
79
- while (*s)
80
- {
81
- *s = MyCharLower(*s);
82
- s++;
83
- }
84
- return ret;
143
+ wchar_t *res = CharUpperW(s);
144
+ if (res != 0 || ::GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
145
+ return res;
146
+ AString a = UnicodeStringToMultiByte(s);
147
+ a.MakeUpper();
148
+ MyStringCopy(s, (const wchar_t *)MultiByteToUnicodeString(a));
149
+ return s;
85
150
  }
151
+ */
86
152
 
153
+ /*
87
154
  wchar_t * MyStringLower(wchar_t *s)
88
155
  {
89
156
  if (s == 0)
90
157
  return 0;
91
- wchar_t *ret = s;
92
- while (*s)
158
+ wchar_t *res = CharLowerW(s);
159
+ if (res != 0 || ::GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
160
+ return res;
161
+ AString a = UnicodeStringToMultiByte(s);
162
+ a.MakeLower();
163
+ MyStringCopy(s, (const wchar_t *)MultiByteToUnicodeString(a));
164
+ return s;
165
+ }
166
+ */
167
+
168
+ #endif
169
+
170
+ #endif
171
+
172
+ bool IsString1PrefixedByString2(const char *s1, const char *s2) throw()
173
+ {
174
+ for (;;)
93
175
  {
94
- *s = MyCharLower(*s);
95
- s++;
176
+ unsigned char c2 = (unsigned char)*s2++; if (c2 == 0) return true;
177
+ unsigned char c1 = (unsigned char)*s1++; if (c1 != c2) return false;
96
178
  }
97
- return ret;
98
179
  }
99
180
 
100
- wchar_t MyCharUpper(wchar_t c)
181
+ bool StringsAreEqualNoCase(const wchar_t *s1, const wchar_t *s2) throw()
101
182
  {
102
- #ifdef ENV_HAVE_TOWUPPER
103
- return towupper(c);
104
- #else
105
- int ret = c;
106
- if ((ret >= 1) && (ret <256)) ret = toupper(ret);
107
- return (wchar_t)ret;
108
- #endif
183
+ for (;;)
184
+ {
185
+ wchar_t c1 = *s1++;
186
+ wchar_t c2 = *s2++;
187
+ if (c1 != c2 && MyCharUpper(c1) != MyCharUpper(c2)) return false;
188
+ if (c1 == 0) return true;
189
+ }
109
190
  }
110
191
 
111
- wchar_t * MyStringUpper(wchar_t *s)
192
+ // ---------- ASCII ----------
193
+
194
+ bool AString::IsPrefixedBy_Ascii_NoCase(const char *s) const throw()
112
195
  {
113
- if (s == 0)
114
- return 0;
115
- wchar_t *ret = s;
116
- while (*s)
196
+ const char *s1 = _chars;
197
+ for (;;)
117
198
  {
118
- *s = MyCharUpper(*s);
119
- s++;
199
+ char c2 = *s++;
200
+ if (c2 == 0)
201
+ return true;
202
+ char c1 = *s1++;
203
+ if (MyCharLower_Ascii(c1) !=
204
+ MyCharLower_Ascii(c2))
205
+ return false;
120
206
  }
121
- return ret;
122
207
  }
123
208
 
124
- int MyStringCompare(const char *s1, const char *s2)
209
+ bool UString::IsPrefixedBy_Ascii_NoCase(const char *s) const throw()
125
210
  {
126
- while (true)
211
+ const wchar_t *s1 = _chars;
212
+ for (;;)
127
213
  {
128
- unsigned char c1 = (unsigned char)*s1++;
129
- unsigned char c2 = (unsigned char)*s2++;
130
- if (c1 < c2) return -1;
131
- if (c1 > c2) return 1;
132
- if (c1 == 0) return 0;
214
+ char c2 = *s++;
215
+ if (c2 == 0)
216
+ return true;
217
+ wchar_t c1 = *s1++;
218
+ if (MyCharLower_Ascii(c1) != (unsigned char)MyCharLower_Ascii(c2))
219
+ return false;
220
+ }
221
+ }
222
+
223
+ bool StringsAreEqual_Ascii(const wchar_t *u, const char *a) throw()
224
+ {
225
+ for (;;)
226
+ {
227
+ unsigned char c = *a;
228
+ if (c != *u)
229
+ return false;
230
+ if (c == 0)
231
+ return true;
232
+ a++;
233
+ u++;
234
+ }
235
+ }
236
+
237
+ bool StringsAreEqualNoCase_Ascii(const char *s1, const char *s2) throw()
238
+ {
239
+ for (;;)
240
+ {
241
+ char c1 = *s1++;
242
+ char c2 = *s2++;
243
+ if (c1 != c2 && MyCharLower_Ascii(c1) != MyCharLower_Ascii(c2))
244
+ return false;
245
+ if (c1 == 0)
246
+ return true;
247
+ }
248
+ }
249
+
250
+ bool StringsAreEqualNoCase_Ascii(const wchar_t *s1, const wchar_t *s2) throw()
251
+ {
252
+ for (;;)
253
+ {
254
+ wchar_t c1 = *s1++;
255
+ wchar_t c2 = *s2++;
256
+ if (c1 != c2 && MyCharLower_Ascii(c1) != MyCharLower_Ascii(c2))
257
+ return false;
258
+ if (c1 == 0)
259
+ return true;
260
+ }
261
+ }
262
+
263
+ bool StringsAreEqualNoCase_Ascii(const wchar_t *s1, const char *s2) throw()
264
+ {
265
+ for (;;)
266
+ {
267
+ wchar_t c1 = *s1++;
268
+ char c2 = *s2++;
269
+ if (c1 != (unsigned char)c2 && (c1 > 0x7F || MyCharLower_Ascii(c1) != (unsigned char)MyCharLower_Ascii(c2)))
270
+ return false;
271
+ if (c1 == 0)
272
+ return true;
133
273
  }
134
274
  }
135
275
 
136
- int MyStringCompare(const wchar_t *s1, const wchar_t *s2)
276
+ bool IsString1PrefixedByString2(const wchar_t *s1, const wchar_t *s2) throw()
137
277
  {
138
- while (true)
278
+ for (;;)
279
+ {
280
+ wchar_t c2 = *s2++; if (c2 == 0) return true;
281
+ wchar_t c1 = *s1++; if (c1 != c2) return false;
282
+ }
283
+ }
284
+
285
+ bool IsString1PrefixedByString2_NoCase(const wchar_t *s1, const wchar_t *s2) throw()
286
+ {
287
+ for (;;)
288
+ {
289
+ wchar_t c2 = *s2++; if (c2 == 0) return true;
290
+ wchar_t c1 = *s1++;
291
+ if (c1 != c2 && MyCharUpper(c1) != MyCharUpper(c2))
292
+ return false;
293
+ }
294
+ }
295
+
296
+ // NTFS order: uses upper case
297
+ int MyStringCompareNoCase(const wchar_t *s1, const wchar_t *s2) throw()
298
+ {
299
+ for (;;)
139
300
  {
140
301
  wchar_t c1 = *s1++;
141
302
  wchar_t c2 = *s2++;
142
- if (c1 < c2) return -1;
143
- if (c1 > c2) return 1;
303
+ if (c1 != c2)
304
+ {
305
+ wchar_t u1 = MyCharUpper(c1);
306
+ wchar_t u2 = MyCharUpper(c2);
307
+ if (u1 < u2) return -1;
308
+ if (u1 > u2) return 1;
309
+ }
144
310
  if (c1 == 0) return 0;
145
311
  }
146
312
  }
147
313
 
148
- int MyStringCompareNoCase(const wchar_t *s1, const wchar_t *s2)
314
+ /*
315
+ int MyStringCompareNoCase_N(const wchar_t *s1, const wchar_t *s2, unsigned num)
149
316
  {
150
- while (true)
317
+ for (; num != 0; num--)
151
318
  {
152
319
  wchar_t c1 = *s1++;
153
320
  wchar_t c2 = *s2++;
@@ -160,47 +327,1406 @@ int MyStringCompareNoCase(const wchar_t *s1, const wchar_t *s2)
160
327
  }
161
328
  if (c1 == 0) return 0;
162
329
  }
330
+ return 0;
163
331
  }
332
+ */
164
333
 
165
- int MyStringCompareNoCase(const char *s1, const char *s2)
334
+ // ---------- AString ----------
335
+
336
+ void AString::InsertSpace(unsigned &index, unsigned size)
166
337
  {
167
- return MyStringCompareNoCase(MultiByteToUnicodeString(s1), MultiByteToUnicodeString(s2));
338
+ Grow(size);
339
+ MoveItems(index + size, index);
340
+ }
341
+
342
+ #define k_Alloc_Len_Limit 0x40000000
343
+
344
+ void AString::ReAlloc(unsigned newLimit)
345
+ {
346
+ if (newLimit < _len || newLimit >= k_Alloc_Len_Limit) throw 20130220;
347
+ // MY_STRING_REALLOC(_chars, char, newLimit + 1, _len + 1);
348
+ char *newBuf = MY_STRING_NEW(char, newLimit + 1);
349
+ memcpy(newBuf, _chars, (size_t)(_len + 1)); \
350
+ MY_STRING_DELETE(_chars);
351
+ _chars = newBuf;
352
+ _limit = newLimit;
353
+ }
354
+
355
+ void AString::ReAlloc2(unsigned newLimit)
356
+ {
357
+ if (newLimit >= k_Alloc_Len_Limit) throw 20130220;
358
+ // MY_STRING_REALLOC(_chars, char, newLimit + 1, 0);
359
+ char *newBuf = MY_STRING_NEW(char, newLimit + 1);
360
+ newBuf[0] = 0;
361
+ MY_STRING_DELETE(_chars);
362
+ _chars = newBuf;
363
+ _limit = newLimit;
364
+ }
365
+
366
+ void AString::SetStartLen(unsigned len)
367
+ {
368
+ _chars = 0;
369
+ _chars = MY_STRING_NEW(char, len + 1);
370
+ _len = len;
371
+ _limit = len;
372
+ }
373
+
374
+ void AString::Grow_1()
375
+ {
376
+ unsigned next = _len;
377
+ next += next / 2;
378
+ next += 16;
379
+ next &= ~(unsigned)15;
380
+ ReAlloc(next - 1);
381
+ }
382
+
383
+ void AString::Grow(unsigned n)
384
+ {
385
+ unsigned freeSize = _limit - _len;
386
+ if (n <= freeSize)
387
+ return;
388
+
389
+ unsigned next = _len + n;
390
+ next += next / 2;
391
+ next += 16;
392
+ next &= ~(unsigned)15;
393
+ ReAlloc(next - 1);
394
+ }
395
+
396
+ /*
397
+ AString::AString(unsigned num, const char *s)
398
+ {
399
+ unsigned len = MyStringLen(s);
400
+ if (num > len)
401
+ num = len;
402
+ SetStartLen(num);
403
+ memcpy(_chars, s, num);
404
+ _chars[num] = 0;
405
+ }
406
+ */
407
+
408
+ AString::AString(unsigned num, const AString &s)
409
+ {
410
+ if (num > s._len)
411
+ num = s._len;
412
+ SetStartLen(num);
413
+ memcpy(_chars, s._chars, num);
414
+ _chars[num] = 0;
415
+ }
416
+
417
+ AString::AString(const AString &s, char c)
418
+ {
419
+ SetStartLen(s.Len() + 1);
420
+ char *chars = _chars;
421
+ unsigned len = s.Len();
422
+ memcpy(chars, s, len);
423
+ chars[len] = c;
424
+ chars[len + 1] = 0;
425
+ }
426
+
427
+ AString::AString(const char *s1, unsigned num1, const char *s2, unsigned num2)
428
+ {
429
+ SetStartLen(num1 + num2);
430
+ char *chars = _chars;
431
+ memcpy(chars, s1, num1);
432
+ memcpy(chars + num1, s2, num2 + 1);
433
+ }
434
+
435
+ AString operator+(const AString &s1, const AString &s2) { return AString(s1, s1.Len(), s2, s2.Len()); }
436
+ AString operator+(const AString &s1, const char *s2) { return AString(s1, s1.Len(), s2, MyStringLen(s2)); }
437
+ AString operator+(const char *s1, const AString &s2) { return AString(s1, MyStringLen(s1), s2, s2.Len()); }
438
+
439
+ AString::AString()
440
+ {
441
+ _chars = 0;
442
+ _chars = MY_STRING_NEW(char, 4);
443
+ _len = 0;
444
+ _limit = 4 - 1;
445
+ _chars[0] = 0;
446
+ }
447
+
448
+ AString::AString(char c)
449
+ {
450
+ SetStartLen(1);
451
+ _chars[0] = c;
452
+ _chars[1] = 0;
453
+ }
454
+
455
+ AString::AString(const char *s)
456
+ {
457
+ SetStartLen(MyStringLen(s));
458
+ MyStringCopy(_chars, s);
459
+ }
460
+
461
+ AString::AString(const AString &s)
462
+ {
463
+ SetStartLen(s._len);
464
+ MyStringCopy(_chars, s._chars);
465
+ }
466
+
467
+ AString &AString::operator=(char c)
468
+ {
469
+ if (1 > _limit)
470
+ {
471
+ char *newBuf = MY_STRING_NEW(char, 1 + 1);
472
+ MY_STRING_DELETE(_chars);
473
+ _chars = newBuf;
474
+ _limit = 1;
475
+ }
476
+ _len = 1;
477
+ _chars[0] = c;
478
+ _chars[1] = 0;
479
+ return *this;
480
+ }
481
+
482
+ AString &AString::operator=(const char *s)
483
+ {
484
+ unsigned len = MyStringLen(s);
485
+ if (len > _limit)
486
+ {
487
+ char *newBuf = MY_STRING_NEW(char, len + 1);
488
+ MY_STRING_DELETE(_chars);
489
+ _chars = newBuf;
490
+ _limit = len;
491
+ }
492
+ _len = len;
493
+ MyStringCopy(_chars, s);
494
+ return *this;
495
+ }
496
+
497
+ AString &AString::operator=(const AString &s)
498
+ {
499
+ if (&s == this)
500
+ return *this;
501
+ unsigned len = s._len;
502
+ if (len > _limit)
503
+ {
504
+ char *newBuf = MY_STRING_NEW(char, len + 1);
505
+ MY_STRING_DELETE(_chars);
506
+ _chars = newBuf;
507
+ _limit = len;
508
+ }
509
+ _len = len;
510
+ MyStringCopy(_chars, s._chars);
511
+ return *this;
512
+ }
513
+
514
+ void AString::SetFromWStr_if_Ascii(const wchar_t *s)
515
+ {
516
+ unsigned len = 0;
517
+ {
518
+ for (;; len++)
519
+ {
520
+ wchar_t c = s[len];
521
+ if (c == 0)
522
+ break;
523
+ if (c >= 0x80)
524
+ return;
525
+ }
526
+ }
527
+ if (len > _limit)
528
+ {
529
+ char *newBuf = MY_STRING_NEW(char, len + 1);
530
+ MY_STRING_DELETE(_chars);
531
+ _chars = newBuf;
532
+ _limit = len;
533
+ }
534
+ _len = len;
535
+ char *dest = _chars;
536
+ unsigned i;
537
+ for (i = 0; i < len; i++)
538
+ dest[i] = (char)s[i];
539
+ dest[i] = 0;
540
+ }
541
+
542
+ /*
543
+ void AString::SetFromBstr_if_Ascii(BSTR s)
544
+ {
545
+ unsigned len = ::SysStringLen(s);
546
+ {
547
+ for (unsigned i = 0; i < len; i++)
548
+ if (s[i] <= 0 || s[i] >= 0x80)
549
+ return;
550
+ }
551
+ if (len > _limit)
552
+ {
553
+ char *newBuf = MY_STRING_NEW(char, len + 1);
554
+ MY_STRING_DELETE(_chars);
555
+ _chars = newBuf;
556
+ _limit = len;
557
+ }
558
+ _len = len;
559
+ char *dest = _chars;
560
+ unsigned i;
561
+ for (i = 0; i < len; i++)
562
+ dest[i] = (char)s[i];
563
+ dest[i] = 0;
564
+ }
565
+ */
566
+
567
+ void AString::Add_Space() { operator+=(' '); }
568
+ void AString::Add_Space_if_NotEmpty() { if (!IsEmpty()) Add_Space(); }
569
+ void AString::Add_LF() { operator+=('\n'); }
570
+
571
+ AString &AString::operator+=(const char *s)
572
+ {
573
+ unsigned len = MyStringLen(s);
574
+ Grow(len);
575
+ MyStringCopy(_chars + _len, s);
576
+ _len += len;
577
+ return *this;
578
+ }
579
+
580
+ AString &AString::operator+=(const AString &s)
581
+ {
582
+ Grow(s._len);
583
+ MyStringCopy(_chars + _len, s._chars);
584
+ _len += s._len;
585
+ return *this;
586
+ }
587
+
588
+ void AString::SetFrom(const char *s, unsigned len) // no check
589
+ {
590
+ if (len > _limit)
591
+ {
592
+ char *newBuf = MY_STRING_NEW(char, len + 1);
593
+ MY_STRING_DELETE(_chars);
594
+ _chars = newBuf;
595
+ _limit = len;
596
+ }
597
+ if (len != 0)
598
+ memcpy(_chars, s, len);
599
+ _chars[len] = 0;
600
+ _len = len;
601
+ }
602
+
603
+ void AString::SetFrom_CalcLen(const char *s, unsigned len) // no check
604
+ {
605
+ unsigned i;
606
+ for (i = 0; i < len; i++)
607
+ if (s[i] == 0)
608
+ break;
609
+ SetFrom(s, i);
610
+ }
611
+
612
+ int AString::Find(const char *s, unsigned startIndex) const throw()
613
+ {
614
+ const char *fs = strstr(_chars + startIndex, s);
615
+ if (!fs)
616
+ return -1;
617
+ return (int)(fs - _chars);
618
+
619
+ /*
620
+ if (s[0] == 0)
621
+ return startIndex;
622
+ unsigned len = MyStringLen(s);
623
+ const char *p = _chars + startIndex;
624
+ for (;; p++)
625
+ {
626
+ const char c = *p;
627
+ if (c != s[0])
628
+ {
629
+ if (c == 0)
630
+ return -1;
631
+ continue;
632
+ }
633
+ unsigned i;
634
+ for (i = 1; i < len; i++)
635
+ if (p[i] != s[i])
636
+ break;
637
+ if (i == len)
638
+ return (int)(p - _chars);
639
+ }
640
+ */
641
+ }
642
+
643
+ int AString::ReverseFind(char c) const throw()
644
+ {
645
+ if (_len == 0)
646
+ return -1;
647
+ const char *p = _chars + _len - 1;
648
+ for (;;)
649
+ {
650
+ if (*p == c)
651
+ return (int)(p - _chars);
652
+ if (p == _chars)
653
+ return -1;
654
+ p--; // p = GetPrevCharPointer(_chars, p);
655
+ }
656
+ }
657
+
658
+ int AString::ReverseFind_PathSepar() const throw()
659
+ {
660
+ if (_len == 0)
661
+ return -1;
662
+ const char *p = _chars + _len - 1;
663
+ for (;;)
664
+ {
665
+ char c = *p;
666
+ if (IS_PATH_SEPAR(c))
667
+ return (int)(p - _chars);
668
+ if (p == _chars)
669
+ return -1;
670
+ p--;
671
+ }
672
+ }
673
+
674
+ void AString::TrimLeft() throw()
675
+ {
676
+ const char *p = _chars;
677
+ for (;; p++)
678
+ {
679
+ char c = *p;
680
+ if (c != ' ' && c != '\n' && c != '\t')
681
+ break;
682
+ }
683
+ unsigned pos = (unsigned)(p - _chars);
684
+ if (pos != 0)
685
+ {
686
+ MoveItems(0, pos);
687
+ _len -= pos;
688
+ }
689
+ }
690
+
691
+ void AString::TrimRight() throw()
692
+ {
693
+ const char *p = _chars;
694
+ unsigned i;
695
+ for (i = _len; i != 0; i--)
696
+ {
697
+ char c = p[i - 1];
698
+ if (c != ' ' && c != '\n' && c != '\t')
699
+ break;
700
+ }
701
+ if (i != _len)
702
+ {
703
+ _chars[i] = 0;
704
+ _len = i;
705
+ }
706
+ }
707
+
708
+ void AString::InsertAtFront(char c)
709
+ {
710
+ if (_limit == _len)
711
+ Grow_1();
712
+ MoveItems(1, 0);
713
+ _chars[0] = c;
714
+ _len++;
715
+ }
716
+
717
+ /*
718
+ void AString::Insert(unsigned index, char c)
719
+ {
720
+ InsertSpace(index, 1);
721
+ _chars[index] = c;
722
+ _len++;
723
+ }
724
+ */
725
+
726
+ void AString::Insert(unsigned index, const char *s)
727
+ {
728
+ unsigned num = MyStringLen(s);
729
+ if (num != 0)
730
+ {
731
+ InsertSpace(index, num);
732
+ memcpy(_chars + index, s, num);
733
+ _len += num;
734
+ }
168
735
  }
169
736
 
737
+ void AString::Insert(unsigned index, const AString &s)
738
+ {
739
+ unsigned num = s.Len();
740
+ if (num != 0)
741
+ {
742
+ InsertSpace(index, num);
743
+ memcpy(_chars + index, s, num);
744
+ _len += num;
745
+ }
746
+ }
170
747
 
171
- #ifndef ENV_HAVE_WCHAR__H
748
+ void AString::RemoveChar(char ch) throw()
749
+ {
750
+ char *src = _chars;
751
+
752
+ for (;;)
753
+ {
754
+ char c = *src++;
755
+ if (c == 0)
756
+ return;
757
+ if (c == ch)
758
+ break;
759
+ }
172
760
 
173
- EXTERN_C_BEGIN
761
+ char *dest = src - 1;
762
+
763
+ for (;;)
764
+ {
765
+ char c = *src++;
766
+ if (c == 0)
767
+ break;
768
+ if (c != ch)
769
+ *dest++ = c;
770
+ }
771
+
772
+ *dest = 0;
773
+ _len = (unsigned)(dest - _chars);
774
+ }
174
775
 
175
- size_t wcslen(const wchar_t *s)
776
+ // !!!!!!!!!!!!!!! test it if newChar = '\0'
777
+ void AString::Replace(char oldChar, char newChar) throw()
176
778
  {
177
- register const wchar_t *p;
178
-
179
- for (p=s ; *p ; p++);
180
-
181
- return p - s;
779
+ if (oldChar == newChar)
780
+ return; // 0;
781
+ // unsigned number = 0;
782
+ int pos = 0;
783
+ while ((unsigned)pos < _len)
784
+ {
785
+ pos = Find(oldChar, pos);
786
+ if (pos < 0)
787
+ break;
788
+ _chars[(unsigned)pos] = newChar;
789
+ pos++;
790
+ // number++;
791
+ }
792
+ return; // number;
182
793
  }
183
794
 
184
- wchar_t *wcscpy(wchar_t * s1, const wchar_t * s2)
795
+ void AString::Replace(const AString &oldString, const AString &newString)
185
796
  {
186
- register wchar_t *s = s1;
187
-
188
- while ( (*s++ = *s2++) != 0 );
189
-
190
- return s1;
797
+ if (oldString.IsEmpty())
798
+ return; // 0;
799
+ if (oldString == newString)
800
+ return; // 0;
801
+ unsigned oldLen = oldString.Len();
802
+ unsigned newLen = newString.Len();
803
+ // unsigned number = 0;
804
+ int pos = 0;
805
+ while ((unsigned)pos < _len)
806
+ {
807
+ pos = Find(oldString, pos);
808
+ if (pos < 0)
809
+ break;
810
+ Delete(pos, oldLen);
811
+ Insert(pos, newString);
812
+ pos += newLen;
813
+ // number++;
814
+ }
815
+ // return number;
191
816
  }
192
817
 
193
- wchar_t *wcscat(wchar_t * s1, const wchar_t * s2)
818
+ void AString::Delete(unsigned index) throw()
194
819
  {
195
- register wchar_t *s = s1;
196
-
197
- while (*s++);
198
- --s;
199
- while ((*s++ = *s2++) != 0);
200
-
201
- return s1;
820
+ MoveItems(index, index + 1);
821
+ _len--;
202
822
  }
203
823
 
204
- EXTERN_C_END
824
+ void AString::Delete(unsigned index, unsigned count) throw()
825
+ {
826
+ if (index + count > _len)
827
+ count = _len - index;
828
+ if (count > 0)
829
+ {
830
+ MoveItems(index, index + count);
831
+ _len -= count;
832
+ }
833
+ }
834
+
835
+ void AString::DeleteFrontal(unsigned num) throw()
836
+ {
837
+ if (num != 0)
838
+ {
839
+ MoveItems(0, num);
840
+ _len -= num;
841
+ }
842
+ }
843
+
844
+ /*
845
+ AString operator+(const AString &s1, const AString &s2)
846
+ {
847
+ AString result(s1);
848
+ result += s2;
849
+ return result;
850
+ }
851
+
852
+ AString operator+(const AString &s, const char *chars)
853
+ {
854
+ AString result(s);
855
+ result += chars;
856
+ return result;
857
+ }
858
+
859
+ AString operator+(const char *chars, const AString &s)
860
+ {
861
+ AString result(chars);
862
+ result += s;
863
+ return result;
864
+ }
865
+
866
+ AString operator+(const AString &s, char c)
867
+ {
868
+ AString result(s);
869
+ result += c;
870
+ return result;
871
+ }
872
+ */
873
+
874
+ /*
875
+ AString operator+(char c, const AString &s)
876
+ {
877
+ AString result(c);
878
+ result += s;
879
+ return result;
880
+ }
881
+ */
882
+
883
+
884
+
885
+
886
+ // ---------- UString ----------
887
+
888
+ void UString::InsertSpace(unsigned index, unsigned size)
889
+ {
890
+ Grow(size);
891
+ MoveItems(index + size, index);
892
+ }
893
+
894
+ void UString::ReAlloc(unsigned newLimit)
895
+ {
896
+ if (newLimit < _len || newLimit >= k_Alloc_Len_Limit) throw 20130221;
897
+ // MY_STRING_REALLOC(_chars, wchar_t, newLimit + 1, _len + 1);
898
+ wchar_t *newBuf = MY_STRING_NEW(wchar_t, newLimit + 1);
899
+ wmemcpy(newBuf, _chars, _len + 1);
900
+ MY_STRING_DELETE(_chars);
901
+ _chars = newBuf;
902
+ _limit = newLimit;
903
+ }
904
+
905
+ void UString::ReAlloc2(unsigned newLimit)
906
+ {
907
+ if (newLimit >= k_Alloc_Len_Limit) throw 20130221;
908
+ // MY_STRING_REALLOC(_chars, wchar_t, newLimit + 1, 0);
909
+ wchar_t *newBuf = MY_STRING_NEW(wchar_t, newLimit + 1);
910
+ newBuf[0] = 0;
911
+ MY_STRING_DELETE(_chars);
912
+ _chars = newBuf;
913
+ _limit = newLimit;
914
+ }
915
+
916
+ void UString::SetStartLen(unsigned len)
917
+ {
918
+ _chars = 0;
919
+ _chars = MY_STRING_NEW(wchar_t, len + 1);
920
+ _len = len;
921
+ _limit = len;
922
+ }
923
+
924
+ void UString::Grow_1()
925
+ {
926
+ unsigned next = _len;
927
+ next += next / 2;
928
+ next += 16;
929
+ next &= ~(unsigned)15;
930
+ ReAlloc(next - 1);
931
+ }
932
+
933
+ void UString::Grow(unsigned n)
934
+ {
935
+ unsigned freeSize = _limit - _len;
936
+ if (n <= freeSize)
937
+ return;
938
+
939
+ unsigned next = _len + n;
940
+ next += next / 2;
941
+ next += 16;
942
+ next &= ~(unsigned)15;
943
+ ReAlloc(next - 1);
944
+ }
945
+
946
+
947
+ UString::UString(unsigned num, const wchar_t *s)
948
+ {
949
+ unsigned len = MyStringLen(s);
950
+ if (num > len)
951
+ num = len;
952
+ SetStartLen(num);
953
+ wmemcpy(_chars, s, num);
954
+ _chars[num] = 0;
955
+ }
956
+
957
+
958
+ UString::UString(unsigned num, const UString &s)
959
+ {
960
+ if (num > s._len)
961
+ num = s._len;
962
+ SetStartLen(num);
963
+ wmemcpy(_chars, s._chars, num);
964
+ _chars[num] = 0;
965
+ }
966
+
967
+ UString::UString(const UString &s, wchar_t c)
968
+ {
969
+ SetStartLen(s.Len() + 1);
970
+ wchar_t *chars = _chars;
971
+ unsigned len = s.Len();
972
+ wmemcpy(chars, s, len);
973
+ chars[len] = c;
974
+ chars[len + 1] = 0;
975
+ }
976
+
977
+ UString::UString(const wchar_t *s1, unsigned num1, const wchar_t *s2, unsigned num2)
978
+ {
979
+ SetStartLen(num1 + num2);
980
+ wchar_t *chars = _chars;
981
+ wmemcpy(chars, s1, num1);
982
+ wmemcpy(chars + num1, s2, num2 + 1);
983
+ }
984
+
985
+ UString operator+(const UString &s1, const UString &s2) { return UString(s1, s1.Len(), s2, s2.Len()); }
986
+ UString operator+(const UString &s1, const wchar_t *s2) { return UString(s1, s1.Len(), s2, MyStringLen(s2)); }
987
+ UString operator+(const wchar_t *s1, const UString &s2) { return UString(s1, MyStringLen(s1), s2, s2.Len()); }
988
+
989
+ UString::UString()
990
+ {
991
+ _chars = 0;
992
+ _chars = MY_STRING_NEW(wchar_t, 4);
993
+ _len = 0;
994
+ _limit = 4 - 1;
995
+ _chars[0] = 0;
996
+ }
997
+
998
+ UString::UString(wchar_t c)
999
+ {
1000
+ SetStartLen(1);
1001
+ _chars[0] = c;
1002
+ _chars[1] = 0;
1003
+ }
1004
+
1005
+ UString::UString(const wchar_t *s)
1006
+ {
1007
+ unsigned len = MyStringLen(s);
1008
+ SetStartLen(len);
1009
+ wmemcpy(_chars, s, len + 1);
1010
+ }
1011
+
1012
+ UString::UString(const UString &s)
1013
+ {
1014
+ SetStartLen(s._len);
1015
+ wmemcpy(_chars, s._chars, s._len + 1);
1016
+ }
1017
+
1018
+ UString &UString::operator=(wchar_t c)
1019
+ {
1020
+ if (1 > _limit)
1021
+ {
1022
+ wchar_t *newBuf = MY_STRING_NEW(wchar_t, 1 + 1);
1023
+ MY_STRING_DELETE(_chars);
1024
+ _chars = newBuf;
1025
+ _limit = 1;
1026
+ }
1027
+ _len = 1;
1028
+ _chars[0] = c;
1029
+ _chars[1] = 0;
1030
+ return *this;
1031
+ }
1032
+
1033
+ UString &UString::operator=(const wchar_t *s)
1034
+ {
1035
+ unsigned len = MyStringLen(s);
1036
+ if (len > _limit)
1037
+ {
1038
+ wchar_t *newBuf = MY_STRING_NEW(wchar_t, len + 1);
1039
+ MY_STRING_DELETE(_chars);
1040
+ _chars = newBuf;
1041
+ _limit = len;
1042
+ }
1043
+ _len = len;
1044
+ wmemcpy(_chars, s, len + 1);
1045
+ return *this;
1046
+ }
1047
+
1048
+ UString &UString::operator=(const UString &s)
1049
+ {
1050
+ if (&s == this)
1051
+ return *this;
1052
+ unsigned len = s._len;
1053
+ if (len > _limit)
1054
+ {
1055
+ wchar_t *newBuf = MY_STRING_NEW(wchar_t, len + 1);
1056
+ MY_STRING_DELETE(_chars);
1057
+ _chars = newBuf;
1058
+ _limit = len;
1059
+ }
1060
+ _len = len;
1061
+ wmemcpy(_chars, s._chars, len + 1);
1062
+ return *this;
1063
+ }
1064
+
1065
+ void UString::SetFromBstr(BSTR s)
1066
+ {
1067
+ unsigned len = ::SysStringLen(s);
1068
+ if (len > _limit)
1069
+ {
1070
+ wchar_t *newBuf = MY_STRING_NEW(wchar_t, len + 1);
1071
+ MY_STRING_DELETE(_chars);
1072
+ _chars = newBuf;
1073
+ _limit = len;
1074
+ }
1075
+ _len = len;
1076
+ // if (s)
1077
+ wmemcpy(_chars, s, len + 1);
1078
+ }
1079
+
1080
+ void UString::Add_Space() { operator+=(L' '); }
1081
+ void UString::Add_Space_if_NotEmpty() { if (!IsEmpty()) Add_Space(); }
1082
+
1083
+ void UString::Add_LF()
1084
+ {
1085
+ if (_limit == _len)
1086
+ Grow_1();
1087
+ unsigned len = _len;
1088
+ wchar_t *chars = _chars;
1089
+ chars[len++] = L'\n';
1090
+ chars[len] = 0;
1091
+ _len = len;
1092
+ }
1093
+
1094
+ UString &UString::operator+=(const wchar_t *s)
1095
+ {
1096
+ unsigned len = MyStringLen(s);
1097
+ Grow(len);
1098
+ wmemcpy(_chars + _len, s, len + 1);
1099
+ _len += len;
1100
+ return *this;
1101
+ }
1102
+
1103
+ UString &UString::operator+=(const UString &s)
1104
+ {
1105
+ Grow(s._len);
1106
+ wmemcpy(_chars + _len, s._chars, s._len + 1);
1107
+ _len += s._len;
1108
+ return *this;
1109
+ }
1110
+
1111
+ void UString::SetFrom(const wchar_t *s, unsigned len) // no check
1112
+ {
1113
+ if (len > _limit)
1114
+ {
1115
+ wchar_t *newBuf = MY_STRING_NEW(wchar_t, len + 1);
1116
+ MY_STRING_DELETE(_chars);
1117
+ _chars = newBuf;
1118
+ _limit = len;
1119
+ }
1120
+ if (len != 0)
1121
+ wmemcpy(_chars, s, len);
1122
+ _chars[len] = 0;
1123
+ _len = len;
1124
+ }
1125
+
1126
+ void UString::SetFromAscii(const char *s)
1127
+ {
1128
+ unsigned len = MyStringLen(s);
1129
+ if (len > _limit)
1130
+ {
1131
+ wchar_t *newBuf = MY_STRING_NEW(wchar_t, len + 1);
1132
+ MY_STRING_DELETE(_chars);
1133
+ _chars = newBuf;
1134
+ _limit = len;
1135
+ }
1136
+ wchar_t *chars = _chars;
1137
+ for (unsigned i = 0; i < len; i++)
1138
+ chars[i] = (unsigned char)s[i];
1139
+ chars[len] = 0;
1140
+ _len = len;
1141
+ }
1142
+
1143
+ void UString::AddAscii(const char *s)
1144
+ {
1145
+ unsigned len = MyStringLen(s);
1146
+ Grow(len);
1147
+ wchar_t *chars = _chars + _len;
1148
+ for (unsigned i = 0; i < len; i++)
1149
+ chars[i] = (unsigned char)s[i];
1150
+ chars[len] = 0;
1151
+ _len += len;
1152
+ }
1153
+
1154
+
1155
+
1156
+ int UString::Find(const wchar_t *s, unsigned startIndex) const throw()
1157
+ {
1158
+ const wchar_t *fs = wcsstr(_chars + startIndex, s);
1159
+ if (!fs)
1160
+ return -1;
1161
+ return (int)(fs - _chars);
1162
+
1163
+ /*
1164
+ if (s[0] == 0)
1165
+ return startIndex;
1166
+ unsigned len = MyStringLen(s);
1167
+ const wchar_t *p = _chars + startIndex;
1168
+ for (;; p++)
1169
+ {
1170
+ const wchar_t c = *p;
1171
+ if (c != s[0])
1172
+ {
1173
+ if (c == 0)
1174
+ return -1;
1175
+ continue;
1176
+ }
1177
+ unsigned i;
1178
+ for (i = 1; i < len; i++)
1179
+ if (p[i] != s[i])
1180
+ break;
1181
+ if (i == len)
1182
+ return (int)(p - _chars);
1183
+ }
1184
+ */
1185
+ }
1186
+
1187
+ int UString::ReverseFind(wchar_t c) const throw()
1188
+ {
1189
+ if (_len == 0)
1190
+ return -1;
1191
+ const wchar_t *p = _chars + _len - 1;
1192
+ for (;;)
1193
+ {
1194
+ if (*p == c)
1195
+ return (int)(p - _chars);
1196
+ if (p == _chars)
1197
+ return -1;
1198
+ p--;
1199
+ }
1200
+ }
1201
+
1202
+ int UString::ReverseFind_PathSepar() const throw()
1203
+ {
1204
+ if (_len == 0)
1205
+ return -1;
1206
+ const wchar_t *p = _chars + _len - 1;
1207
+ for (;;)
1208
+ {
1209
+ wchar_t c = *p;
1210
+ if (IS_PATH_SEPAR(c))
1211
+ return (int)(p - _chars);
1212
+ if (p == _chars)
1213
+ return -1;
1214
+ p--;
1215
+ }
1216
+ }
1217
+
1218
+ void UString::TrimLeft() throw()
1219
+ {
1220
+ const wchar_t *p = _chars;
1221
+ for (;; p++)
1222
+ {
1223
+ wchar_t c = *p;
1224
+ if (c != ' ' && c != '\n' && c != '\t')
1225
+ break;
1226
+ }
1227
+ unsigned pos = (unsigned)(p - _chars);
1228
+ if (pos != 0)
1229
+ {
1230
+ MoveItems(0, pos);
1231
+ _len -= pos;
1232
+ }
1233
+ }
1234
+
1235
+ void UString::TrimRight() throw()
1236
+ {
1237
+ const wchar_t *p = _chars;
1238
+ unsigned i;
1239
+ for (i = _len; i != 0; i--)
1240
+ {
1241
+ wchar_t c = p[i - 1];
1242
+ if (c != ' ' && c != '\n' && c != '\t')
1243
+ break;
1244
+ }
1245
+ if (i != _len)
1246
+ {
1247
+ _chars[i] = 0;
1248
+ _len = i;
1249
+ }
1250
+ }
1251
+
1252
+ void UString::InsertAtFront(wchar_t c)
1253
+ {
1254
+ if (_limit == _len)
1255
+ Grow_1();
1256
+ MoveItems(1, 0);
1257
+ _chars[0] = c;
1258
+ _len++;
1259
+ }
1260
+
1261
+ /*
1262
+ void UString::Insert(unsigned index, wchar_t c)
1263
+ {
1264
+ InsertSpace(index, 1);
1265
+ _chars[index] = c;
1266
+ _len++;
1267
+ }
1268
+ */
1269
+
1270
+ void UString::Insert(unsigned index, const wchar_t *s)
1271
+ {
1272
+ unsigned num = MyStringLen(s);
1273
+ if (num != 0)
1274
+ {
1275
+ InsertSpace(index, num);
1276
+ wmemcpy(_chars + index, s, num);
1277
+ _len += num;
1278
+ }
1279
+ }
1280
+
1281
+ void UString::Insert(unsigned index, const UString &s)
1282
+ {
1283
+ unsigned num = s.Len();
1284
+ if (num != 0)
1285
+ {
1286
+ InsertSpace(index, num);
1287
+ wmemcpy(_chars + index, s, num);
1288
+ _len += num;
1289
+ }
1290
+ }
1291
+
1292
+ void UString::RemoveChar(wchar_t ch) throw()
1293
+ {
1294
+ wchar_t *src = _chars;
1295
+
1296
+ for (;;)
1297
+ {
1298
+ wchar_t c = *src++;
1299
+ if (c == 0)
1300
+ return;
1301
+ if (c == ch)
1302
+ break;
1303
+ }
1304
+
1305
+ wchar_t *dest = src - 1;
1306
+
1307
+ for (;;)
1308
+ {
1309
+ wchar_t c = *src++;
1310
+ if (c == 0)
1311
+ break;
1312
+ if (c != ch)
1313
+ *dest++ = c;
1314
+ }
1315
+
1316
+ *dest = 0;
1317
+ _len = (unsigned)(dest - _chars);
1318
+ }
1319
+
1320
+ // !!!!!!!!!!!!!!! test it if newChar = '\0'
1321
+ void UString::Replace(wchar_t oldChar, wchar_t newChar) throw()
1322
+ {
1323
+ if (oldChar == newChar)
1324
+ return; // 0;
1325
+ // unsigned number = 0;
1326
+ int pos = 0;
1327
+ while ((unsigned)pos < _len)
1328
+ {
1329
+ pos = Find(oldChar, pos);
1330
+ if (pos < 0)
1331
+ break;
1332
+ _chars[(unsigned)pos] = newChar;
1333
+ pos++;
1334
+ // number++;
1335
+ }
1336
+ return; // number;
1337
+ }
1338
+
1339
+ void UString::Replace(const UString &oldString, const UString &newString)
1340
+ {
1341
+ if (oldString.IsEmpty())
1342
+ return; // 0;
1343
+ if (oldString == newString)
1344
+ return; // 0;
1345
+ unsigned oldLen = oldString.Len();
1346
+ unsigned newLen = newString.Len();
1347
+ // unsigned number = 0;
1348
+ int pos = 0;
1349
+ while ((unsigned)pos < _len)
1350
+ {
1351
+ pos = Find(oldString, pos);
1352
+ if (pos < 0)
1353
+ break;
1354
+ Delete(pos, oldLen);
1355
+ Insert(pos, newString);
1356
+ pos += newLen;
1357
+ // number++;
1358
+ }
1359
+ // return number;
1360
+ }
1361
+
1362
+ void UString::Delete(unsigned index) throw()
1363
+ {
1364
+ MoveItems(index, index + 1);
1365
+ _len--;
1366
+ }
1367
+
1368
+ void UString::Delete(unsigned index, unsigned count) throw()
1369
+ {
1370
+ if (index + count > _len)
1371
+ count = _len - index;
1372
+ if (count > 0)
1373
+ {
1374
+ MoveItems(index, index + count);
1375
+ _len -= count;
1376
+ }
1377
+ }
1378
+
1379
+ void UString::DeleteFrontal(unsigned num) throw()
1380
+ {
1381
+ if (num != 0)
1382
+ {
1383
+ MoveItems(0, num);
1384
+ _len -= num;
1385
+ }
1386
+ }
1387
+
1388
+
1389
+ // ---------- UString2 ----------
1390
+
1391
+ void UString2::ReAlloc2(unsigned newLimit)
1392
+ {
1393
+ if (newLimit >= k_Alloc_Len_Limit) throw 20130221;
1394
+ // MY_STRING_REALLOC(_chars, wchar_t, newLimit + 1, 0);
1395
+ _chars = MY_STRING_NEW(wchar_t, newLimit + 1);
1396
+ }
1397
+
1398
+ void UString2::SetStartLen(unsigned len)
1399
+ {
1400
+ _chars = 0;
1401
+ _chars = MY_STRING_NEW(wchar_t, len + 1);
1402
+ _len = len;
1403
+ }
1404
+
1405
+
1406
+ /*
1407
+ UString2::UString2(wchar_t c)
1408
+ {
1409
+ SetStartLen(1);
1410
+ _chars[0] = c;
1411
+ _chars[1] = 0;
1412
+ }
1413
+ */
1414
+
1415
+ UString2::UString2(const wchar_t *s)
1416
+ {
1417
+ unsigned len = MyStringLen(s);
1418
+ SetStartLen(len);
1419
+ wmemcpy(_chars, s, len + 1);
1420
+ }
1421
+
1422
+ UString2::UString2(const UString2 &s): _chars(NULL), _len(0)
1423
+ {
1424
+ if (s._chars)
1425
+ {
1426
+ SetStartLen(s._len);
1427
+ wmemcpy(_chars, s._chars, s._len + 1);
1428
+ }
1429
+ }
1430
+
1431
+ /*
1432
+ UString2 &UString2::operator=(wchar_t c)
1433
+ {
1434
+ if (1 > _len)
1435
+ {
1436
+ wchar_t *newBuf = MY_STRING_NEW(wchar_t, 1 + 1);
1437
+ if (_chars)
1438
+ MY_STRING_DELETE(_chars);
1439
+ _chars = newBuf;
1440
+ }
1441
+ _len = 1;
1442
+ _chars[0] = c;
1443
+ _chars[1] = 0;
1444
+ return *this;
1445
+ }
1446
+ */
1447
+
1448
+ UString2 &UString2::operator=(const wchar_t *s)
1449
+ {
1450
+ unsigned len = MyStringLen(s);
1451
+ if (len > _len)
1452
+ {
1453
+ wchar_t *newBuf = MY_STRING_NEW(wchar_t, len + 1);
1454
+ if (_chars)
1455
+ MY_STRING_DELETE(_chars);
1456
+ _chars = newBuf;
1457
+ }
1458
+ _len = len;
1459
+ MyStringCopy(_chars, s);
1460
+ return *this;
1461
+ }
1462
+
1463
+ void UString2::SetFromAscii(const char *s)
1464
+ {
1465
+ unsigned len = MyStringLen(s);
1466
+ if (len > _len)
1467
+ {
1468
+ wchar_t *newBuf = MY_STRING_NEW(wchar_t, len + 1);
1469
+ if (_chars)
1470
+ MY_STRING_DELETE(_chars);
1471
+ _chars = newBuf;
1472
+ }
1473
+ wchar_t *chars = _chars;
1474
+ for (unsigned i = 0; i < len; i++)
1475
+ chars[i] = (unsigned char)s[i];
1476
+ chars[len] = 0;
1477
+ _len = len;
1478
+ }
1479
+
1480
+ UString2 &UString2::operator=(const UString2 &s)
1481
+ {
1482
+ if (&s == this)
1483
+ return *this;
1484
+ unsigned len = s._len;
1485
+ if (len > _len)
1486
+ {
1487
+ wchar_t *newBuf = MY_STRING_NEW(wchar_t, len + 1);
1488
+ if (_chars)
1489
+ MY_STRING_DELETE(_chars);
1490
+ _chars = newBuf;
1491
+ }
1492
+ _len = len;
1493
+ MyStringCopy(_chars, s._chars);
1494
+ return *this;
1495
+ }
1496
+
1497
+ bool operator==(const UString2 &s1, const UString2 &s2)
1498
+ {
1499
+ return s1.Len() == s2.Len() && (s1.IsEmpty() || wcscmp(s1.GetRawPtr(), s2.GetRawPtr()) == 0);
1500
+ }
1501
+
1502
+ bool operator==(const UString2 &s1, const wchar_t *s2)
1503
+ {
1504
+ if (s1.IsEmpty())
1505
+ return (*s2 == 0);
1506
+ return wcscmp(s1.GetRawPtr(), s2) == 0;
1507
+ }
1508
+
1509
+ bool operator==(const wchar_t *s1, const UString2 &s2)
1510
+ {
1511
+ if (s2.IsEmpty())
1512
+ return (*s1 == 0);
1513
+ return wcscmp(s1, s2.GetRawPtr()) == 0;
1514
+ }
1515
+
1516
+
1517
+
1518
+ // ----------------------------------------
1519
+
1520
+ /*
1521
+ int MyStringCompareNoCase(const char *s1, const char *s2)
1522
+ {
1523
+ return MyStringCompareNoCase(MultiByteToUnicodeString(s1), MultiByteToUnicodeString(s2));
1524
+ }
1525
+ */
1526
+
1527
+ static inline UINT GetCurrentCodePage()
1528
+ {
1529
+ #if defined(UNDER_CE) || !defined(_WIN32)
1530
+ return CP_ACP;
1531
+ #else
1532
+ return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP;
1533
+ #endif
1534
+ }
1535
+
1536
+ #ifdef USE_UNICODE_FSTRING
1537
+
1538
+ #ifndef _UNICODE
1539
+
1540
+ AString fs2fas(CFSTR s)
1541
+ {
1542
+ return UnicodeStringToMultiByte(s, GetCurrentCodePage());
1543
+ }
1544
+
1545
+ FString fas2fs(const AString &s)
1546
+ {
1547
+ return MultiByteToUnicodeString(s, GetCurrentCodePage());
1548
+ }
1549
+
1550
+ #endif
1551
+
1552
+ #else
1553
+
1554
+ UString fs2us(const FString &s)
1555
+ {
1556
+ return MultiByteToUnicodeString((AString)s, GetCurrentCodePage());
1557
+ }
1558
+
1559
+ FString us2fs(const wchar_t *s)
1560
+ {
1561
+ return UnicodeStringToMultiByte(s, GetCurrentCodePage());
1562
+ }
1563
+
1564
+ #endif
1565
+
1566
+
1567
+
1568
+ #ifndef ENV_HAVE_WCTYPE_H
1569
+ // FIXME
1570
+
1571
+ wchar_t *wmemcpy(wchar_t * d, const wchar_t * s, size_t n)
1572
+ {
1573
+ wchar_t *a = d;
1574
+ while (n--) *d++ = *s++;
1575
+ return a;
1576
+ }
1577
+
1578
+ int wmemcmp(const wchar_t *l, const wchar_t *r, size_t n)
1579
+ {
1580
+ for (; n && *l==*r; n--, l++, r++);
1581
+ return n ? (*l-*r) : 0;
1582
+ }
1583
+
1584
+ wchar_t *wmemchr(const wchar_t *s, wchar_t c, size_t n)
1585
+ {
1586
+ for (; n && *s != c; n--, s++);
1587
+ return n ? (wchar_t *)s : 0;
1588
+ }
1589
+
1590
+ int wcscmp(const wchar_t *l, const wchar_t *r)
1591
+ {
1592
+ for (; *l==*r && *l && *r; l++, r++);
1593
+ return *l - *r;
1594
+ }
1595
+
1596
+ size_t wcslen(const wchar_t *s)
1597
+ {
1598
+ const wchar_t *a;
1599
+ for (a=s; *s; s++);
1600
+ return s-a;
1601
+ }
1602
+
1603
+ wchar_t *wcschr(const wchar_t *s, wchar_t c)
1604
+ {
1605
+ if (!c) return (wchar_t *)s + wcslen(s);
1606
+ for (; *s && *s != c; s++);
1607
+ return *s ? (wchar_t *)s : 0;
1608
+ }
1609
+
1610
+ #undef MAX
1611
+ #define MAX(a,b) ((a)>(b)?(a):(b))
1612
+ #undef MIN
1613
+ #define MIN(a,b) ((a)<(b)?(a):(b))
1614
+
1615
+ static wchar_t *twoway_wcsstr(const wchar_t *h, const wchar_t *n)
1616
+ {
1617
+ const wchar_t *z;
1618
+ size_t l, ip, jp, k, p, ms, p0, mem, mem0;
1619
+
1620
+ /* Computing length of needle */
1621
+ for (l=0; n[l] && h[l]; l++);
1622
+ if (n[l]) return 0; /* hit the end of h */
1623
+
1624
+ /* Compute maximal suffix */
1625
+ ip = -1; jp = 0; k = p = 1;
1626
+ while (jp+k<l) {
1627
+ if (n[ip+k] == n[jp+k]) {
1628
+ if (k == p) {
1629
+ jp += p;
1630
+ k = 1;
1631
+ } else k++;
1632
+ } else if (n[ip+k] > n[jp+k]) {
1633
+ jp += k;
1634
+ k = 1;
1635
+ p = jp - ip;
1636
+ } else {
1637
+ ip = jp++;
1638
+ k = p = 1;
1639
+ }
1640
+ }
1641
+ ms = ip;
1642
+ p0 = p;
1643
+
1644
+ /* And with the opposite comparison */
1645
+ ip = -1; jp = 0; k = p = 1;
1646
+ while (jp+k<l) {
1647
+ if (n[ip+k] == n[jp+k]) {
1648
+ if (k == p) {
1649
+ jp += p;
1650
+ k = 1;
1651
+ } else k++;
1652
+ } else if (n[ip+k] < n[jp+k]) {
1653
+ jp += k;
1654
+ k = 1;
1655
+ p = jp - ip;
1656
+ } else {
1657
+ ip = jp++;
1658
+ k = p = 1;
1659
+ }
1660
+ }
1661
+ if (ip+1 > ms+1) ms = ip;
1662
+ else p = p0;
1663
+
1664
+ /* Periodic needle? */
1665
+ if (wmemcmp(n, n+p, ms+1)) {
1666
+ mem0 = 0;
1667
+ p = MAX(ms, l-ms-1) + 1;
1668
+ } else mem0 = l-p;
1669
+ mem = 0;
1670
+
1671
+ /* Initialize incremental end-of-haystack pointer */
1672
+ z = h;
1673
+
1674
+ /* Search loop */
1675
+ for (;;) {
1676
+ /* Update incremental end-of-haystack pointer */
1677
+ if (z-h < l) {
1678
+ /* Fast estimate for MIN(l,63) */
1679
+ size_t grow = l | 63;
1680
+ const wchar_t *z2 = wmemchr(z, 0, grow);
1681
+ if (z2) {
1682
+ z = z2;
1683
+ if (z-h < l) return 0;
1684
+ } else z += grow;
1685
+ }
1686
+
1687
+ /* Compare right half */
1688
+ for (k=MAX(ms+1,mem); n[k] && n[k] == h[k]; k++);
1689
+ if (n[k]) {
1690
+ h += k-ms;
1691
+ mem = 0;
1692
+ continue;
1693
+ }
1694
+ /* Compare left half */
1695
+ for (k=ms+1; k>mem && n[k-1] == h[k-1]; k--);
1696
+ if (k <= mem) return (wchar_t *)h;
1697
+ h += p;
1698
+ mem = mem0;
1699
+ }
1700
+ }
1701
+
1702
+ wchar_t *wcsstr(const wchar_t * h, const wchar_t * n)
1703
+ {
1704
+ /* Return immediately on empty needle or haystack */
1705
+ if (!n[0]) return (wchar_t *)h;
1706
+ if (!h[0]) return 0;
1707
+
1708
+ /* Use faster algorithms for short needles */
1709
+ h = wcschr(h, *n);
1710
+ if (!h || !n[1]) return (wchar_t *)h;
1711
+ if (!h[1]) return 0;
1712
+
1713
+ return twoway_wcsstr(h, n);
1714
+ }
1715
+
1716
+ #if defined(__DJGPP__)
1717
+ wchar_t *wcscpy(wchar_t * d, const wchar_t * s)
1718
+ {
1719
+ wchar_t *a = d;
1720
+ while ((*d++ = *s++));
1721
+ return a;
1722
+ }
1723
+
1724
+ wchar_t *wcscat(wchar_t *dest, const wchar_t * src)
1725
+ {
1726
+ wcscpy(dest + wcslen(dest), src);
1727
+ return dest;
1728
+ }
1729
+
1730
+ #endif
205
1731
 
206
1732
  #endif