rugged 0.1.2 → 0.16.0b1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (277) hide show
  1. data/README.md +25 -36
  2. data/Rakefile +20 -98
  3. data/ext/rugged/extconf.rb +44 -4
  4. data/ext/rugged/remote.c +215 -0
  5. data/ext/rugged/rugged.c +171 -0
  6. data/ext/rugged/rugged.h +126 -0
  7. data/ext/rugged/rugged_blob.c +99 -0
  8. data/ext/rugged/rugged_commit.c +224 -0
  9. data/ext/rugged/rugged_config.c +238 -0
  10. data/ext/rugged/rugged_index.c +440 -0
  11. data/ext/rugged/rugged_object.c +203 -0
  12. data/ext/rugged/rugged_reference.c +401 -0
  13. data/ext/rugged/rugged_repo.c +482 -0
  14. data/ext/rugged/rugged_revwalk.c +138 -0
  15. data/ext/rugged/rugged_signature.c +80 -0
  16. data/ext/rugged/rugged_tag.c +216 -0
  17. data/ext/rugged/rugged_tree.c +322 -0
  18. data/ext/rugged/vendor/libgit2-dist.tar.gz +0 -0
  19. data/ext/rugged/vendor/libgit2-dist/deps/http-parser/http_parser.c +1778 -0
  20. data/ext/rugged/vendor/libgit2-dist/deps/http-parser/http_parser.h +267 -0
  21. data/ext/rugged/vendor/libgit2-dist/deps/zlib/adler32.c +169 -0
  22. data/ext/rugged/vendor/libgit2-dist/deps/zlib/crc32.c +442 -0
  23. data/ext/rugged/vendor/libgit2-dist/deps/zlib/crc32.h +441 -0
  24. data/ext/rugged/vendor/libgit2-dist/deps/zlib/deflate.c +1834 -0
  25. data/ext/rugged/vendor/libgit2-dist/deps/zlib/deflate.h +342 -0
  26. data/ext/rugged/vendor/libgit2-dist/deps/zlib/inffast.c +340 -0
  27. data/ext/rugged/vendor/libgit2-dist/deps/zlib/inffast.h +11 -0
  28. data/ext/rugged/vendor/libgit2-dist/deps/zlib/inffixed.h +94 -0
  29. data/ext/rugged/vendor/libgit2-dist/deps/zlib/inflate.c +1480 -0
  30. data/ext/rugged/vendor/libgit2-dist/deps/zlib/inflate.h +122 -0
  31. data/ext/rugged/vendor/libgit2-dist/deps/zlib/inftrees.c +330 -0
  32. data/ext/rugged/vendor/libgit2-dist/deps/zlib/inftrees.h +62 -0
  33. data/ext/rugged/vendor/libgit2-dist/deps/zlib/trees.c +1244 -0
  34. data/ext/rugged/vendor/libgit2-dist/deps/zlib/trees.h +128 -0
  35. data/ext/rugged/vendor/libgit2-dist/deps/zlib/zconf.h +54 -0
  36. data/ext/rugged/vendor/libgit2-dist/deps/zlib/zlib.h +1613 -0
  37. data/ext/rugged/vendor/libgit2-dist/deps/zlib/zutil.c +318 -0
  38. data/ext/rugged/vendor/libgit2-dist/deps/zlib/zutil.h +274 -0
  39. data/ext/rugged/vendor/libgit2-dist/examples/general.c +451 -0
  40. data/ext/rugged/vendor/libgit2-dist/examples/network/common.h +14 -0
  41. data/ext/rugged/vendor/libgit2-dist/examples/network/fetch.c +97 -0
  42. data/ext/rugged/vendor/libgit2-dist/examples/network/git2.c +58 -0
  43. data/ext/rugged/vendor/libgit2-dist/examples/network/index-pack.c +47 -0
  44. data/ext/rugged/vendor/libgit2-dist/examples/network/ls-remote.c +76 -0
  45. data/ext/rugged/vendor/libgit2-dist/examples/showindex.c +43 -0
  46. data/ext/rugged/vendor/libgit2-dist/include/git2.h +44 -0
  47. data/ext/rugged/vendor/libgit2-dist/include/git2/blob.h +120 -0
  48. data/ext/rugged/vendor/libgit2-dist/include/git2/branch.h +15 -0
  49. data/ext/rugged/vendor/libgit2-dist/include/git2/commit.h +263 -0
  50. data/ext/rugged/vendor/libgit2-dist/include/git2/common.h +103 -0
  51. data/ext/rugged/vendor/libgit2-dist/include/git2/config.h +278 -0
  52. data/ext/rugged/vendor/libgit2-dist/include/git2/errors.h +144 -0
  53. data/ext/rugged/vendor/libgit2-dist/include/git2/index.h +306 -0
  54. data/ext/rugged/vendor/libgit2-dist/include/git2/indexer.h +76 -0
  55. data/ext/rugged/vendor/libgit2-dist/include/git2/inttypes.h +305 -0
  56. data/ext/rugged/vendor/libgit2-dist/include/git2/net.h +51 -0
  57. data/ext/rugged/vendor/libgit2-dist/include/git2/object.h +173 -0
  58. data/ext/rugged/vendor/libgit2-dist/include/git2/odb.h +331 -0
  59. data/ext/rugged/vendor/libgit2-dist/include/git2/odb_backend.h +100 -0
  60. data/ext/rugged/vendor/libgit2-dist/include/git2/oid.h +218 -0
  61. data/ext/rugged/vendor/libgit2-dist/include/git2/reflog.h +128 -0
  62. data/ext/rugged/vendor/libgit2-dist/include/git2/refs.h +309 -0
  63. data/ext/rugged/vendor/libgit2-dist/include/git2/refspec.h +60 -0
  64. data/ext/rugged/vendor/libgit2-dist/include/git2/remote.h +176 -0
  65. data/ext/rugged/vendor/libgit2-dist/include/git2/repository.h +290 -0
  66. data/ext/rugged/vendor/libgit2-dist/include/git2/revwalk.h +169 -0
  67. data/ext/rugged/vendor/libgit2-dist/include/git2/signature.h +65 -0
  68. data/ext/rugged/vendor/libgit2-dist/include/git2/status.h +63 -0
  69. data/ext/rugged/vendor/libgit2-dist/include/git2/stdint.h +247 -0
  70. data/ext/rugged/vendor/libgit2-dist/include/git2/tag.h +279 -0
  71. data/ext/rugged/vendor/libgit2-dist/include/git2/threads.h +48 -0
  72. data/ext/rugged/vendor/libgit2-dist/include/git2/tree.h +318 -0
  73. data/ext/rugged/vendor/libgit2-dist/include/git2/types.h +169 -0
  74. data/ext/rugged/vendor/libgit2-dist/include/git2/version.h +15 -0
  75. data/ext/rugged/vendor/libgit2-dist/include/git2/windows.h +59 -0
  76. data/ext/rugged/vendor/libgit2-dist/include/git2/zlib.h +40 -0
  77. data/ext/rugged/vendor/libgit2-dist/src/blob.c +135 -0
  78. data/ext/rugged/vendor/libgit2-dist/src/blob.h +23 -0
  79. data/ext/rugged/vendor/libgit2-dist/src/bswap.h +97 -0
  80. data/ext/rugged/vendor/libgit2-dist/src/buffer.c +113 -0
  81. data/ext/rugged/vendor/libgit2-dist/src/buffer.h +32 -0
  82. data/ext/rugged/vendor/libgit2-dist/src/cache.c +111 -0
  83. data/ext/rugged/vendor/libgit2-dist/src/cache.h +64 -0
  84. data/ext/rugged/vendor/libgit2-dist/src/cc-compat.h +67 -0
  85. data/ext/rugged/vendor/libgit2-dist/src/commit.c +299 -0
  86. data/ext/rugged/vendor/libgit2-dist/src/commit.h +34 -0
  87. data/ext/rugged/vendor/libgit2-dist/src/common.h +64 -0
  88. data/ext/rugged/vendor/libgit2-dist/src/config.c +418 -0
  89. data/ext/rugged/vendor/libgit2-dist/src/config.h +24 -0
  90. data/ext/rugged/vendor/libgit2-dist/src/config_file.c +1210 -0
  91. data/ext/rugged/vendor/libgit2-dist/src/delta-apply.c +115 -0
  92. data/ext/rugged/vendor/libgit2-dist/src/delta-apply.h +33 -0
  93. data/ext/rugged/vendor/libgit2-dist/src/dir.h +47 -0
  94. data/ext/rugged/vendor/libgit2-dist/src/errors.c +104 -0
  95. data/ext/rugged/vendor/libgit2-dist/src/fetch.c +172 -0
  96. data/ext/rugged/vendor/libgit2-dist/src/fetch.h +18 -0
  97. data/ext/rugged/vendor/libgit2-dist/src/filebuf.c +400 -0
  98. data/ext/rugged/vendor/libgit2-dist/src/filebuf.h +72 -0
  99. data/ext/rugged/vendor/libgit2-dist/src/fileops.c +358 -0
  100. data/ext/rugged/vendor/libgit2-dist/src/fileops.h +151 -0
  101. data/ext/rugged/vendor/libgit2-dist/src/global.c +134 -0
  102. data/ext/rugged/vendor/libgit2-dist/src/global.h +24 -0
  103. data/ext/rugged/vendor/libgit2-dist/src/hash.c +74 -0
  104. data/ext/rugged/vendor/libgit2-dist/src/hash.h +29 -0
  105. data/ext/rugged/vendor/libgit2-dist/src/hashtable.c +243 -0
  106. data/ext/rugged/vendor/libgit2-dist/src/hashtable.h +80 -0
  107. data/ext/rugged/vendor/libgit2-dist/src/index.c +918 -0
  108. data/ext/rugged/vendor/libgit2-dist/src/index.h +34 -0
  109. data/ext/rugged/vendor/libgit2-dist/src/indexer.c +401 -0
  110. data/ext/rugged/vendor/libgit2-dist/src/map.h +37 -0
  111. data/ext/rugged/vendor/libgit2-dist/src/mwindow.c +272 -0
  112. data/ext/rugged/vendor/libgit2-dist/src/mwindow.h +45 -0
  113. data/ext/rugged/vendor/libgit2-dist/src/netops.c +198 -0
  114. data/ext/rugged/vendor/libgit2-dist/src/netops.h +36 -0
  115. data/ext/rugged/vendor/libgit2-dist/src/object.c +295 -0
  116. data/ext/rugged/vendor/libgit2-dist/src/odb.c +672 -0
  117. data/ext/rugged/vendor/libgit2-dist/src/odb.h +43 -0
  118. data/ext/rugged/vendor/libgit2-dist/src/odb_loose.c +855 -0
  119. data/ext/rugged/vendor/libgit2-dist/src/odb_pack.c +485 -0
  120. data/ext/rugged/vendor/libgit2-dist/src/oid.c +388 -0
  121. data/ext/rugged/vendor/libgit2-dist/src/pack.c +788 -0
  122. data/ext/rugged/vendor/libgit2-dist/src/pack.h +99 -0
  123. data/ext/rugged/vendor/libgit2-dist/src/path.c +270 -0
  124. data/ext/rugged/vendor/libgit2-dist/src/path.h +84 -0
  125. data/ext/rugged/vendor/libgit2-dist/src/pkt.c +426 -0
  126. data/ext/rugged/vendor/libgit2-dist/src/pkt.h +77 -0
  127. data/ext/rugged/vendor/libgit2-dist/src/posix.c +94 -0
  128. data/ext/rugged/vendor/libgit2-dist/src/posix.h +69 -0
  129. data/ext/rugged/vendor/libgit2-dist/src/ppc/sha1.c +70 -0
  130. data/ext/rugged/vendor/libgit2-dist/src/ppc/sha1.h +26 -0
  131. data/ext/rugged/vendor/libgit2-dist/src/pqueue.c +141 -0
  132. data/ext/rugged/vendor/libgit2-dist/src/pqueue.h +81 -0
  133. data/ext/rugged/vendor/libgit2-dist/src/protocol.c +50 -0
  134. data/ext/rugged/vendor/libgit2-dist/src/protocol.h +23 -0
  135. data/ext/rugged/vendor/libgit2-dist/src/reflog.c +318 -0
  136. data/ext/rugged/vendor/libgit2-dist/src/reflog.h +34 -0
  137. data/ext/rugged/vendor/libgit2-dist/src/refs.c +1693 -0
  138. data/ext/rugged/vendor/libgit2-dist/src/refs.h +58 -0
  139. data/ext/rugged/vendor/libgit2-dist/src/refspec.c +95 -0
  140. data/ext/rugged/vendor/libgit2-dist/src/refspec.h +23 -0
  141. data/ext/rugged/vendor/libgit2-dist/src/remote.c +339 -0
  142. data/ext/rugged/vendor/libgit2-dist/src/remote.h +25 -0
  143. data/ext/rugged/vendor/libgit2-dist/src/repository.c +849 -0
  144. data/ext/rugged/vendor/libgit2-dist/src/repository.h +60 -0
  145. data/ext/rugged/vendor/libgit2-dist/src/revwalk.c +569 -0
  146. data/ext/rugged/vendor/libgit2-dist/src/sha1.c +280 -0
  147. data/ext/rugged/vendor/libgit2-dist/src/sha1.h +21 -0
  148. data/ext/rugged/vendor/libgit2-dist/src/sha1_lookup.c +177 -0
  149. data/ext/rugged/vendor/libgit2-dist/src/sha1_lookup.h +18 -0
  150. data/ext/rugged/vendor/libgit2-dist/src/signature.c +335 -0
  151. data/ext/rugged/vendor/libgit2-dist/src/signature.h +18 -0
  152. data/ext/rugged/vendor/libgit2-dist/src/status.c +696 -0
  153. data/ext/rugged/vendor/libgit2-dist/src/tag.c +446 -0
  154. data/ext/rugged/vendor/libgit2-dist/src/tag.h +28 -0
  155. data/ext/rugged/vendor/libgit2-dist/src/thread-utils.c +55 -0
  156. data/ext/rugged/vendor/libgit2-dist/src/thread-utils.h +108 -0
  157. data/ext/rugged/vendor/libgit2-dist/src/transport.c +85 -0
  158. data/ext/rugged/vendor/libgit2-dist/src/transport.h +110 -0
  159. data/ext/rugged/vendor/libgit2-dist/src/transports/git.c +502 -0
  160. data/ext/rugged/vendor/libgit2-dist/src/transports/http.c +756 -0
  161. data/ext/rugged/vendor/libgit2-dist/src/transports/local.c +235 -0
  162. data/ext/rugged/vendor/libgit2-dist/src/tree-cache.c +201 -0
  163. data/ext/rugged/vendor/libgit2-dist/src/tree-cache.h +31 -0
  164. data/ext/rugged/vendor/libgit2-dist/src/tree.c +758 -0
  165. data/ext/rugged/vendor/libgit2-dist/src/tree.h +37 -0
  166. data/ext/rugged/vendor/libgit2-dist/src/tsort.c +365 -0
  167. data/ext/rugged/vendor/libgit2-dist/src/unix/map.c +70 -0
  168. data/ext/rugged/vendor/libgit2-dist/src/unix/posix.h +25 -0
  169. data/ext/rugged/vendor/libgit2-dist/src/util.c +381 -0
  170. data/ext/rugged/vendor/libgit2-dist/src/util.h +137 -0
  171. data/ext/rugged/vendor/libgit2-dist/src/vector.c +174 -0
  172. data/ext/rugged/vendor/libgit2-dist/src/vector.h +45 -0
  173. data/ext/rugged/vendor/libgit2-dist/src/win32/dir.c +115 -0
  174. data/ext/rugged/vendor/libgit2-dist/src/win32/fnmatch.c +180 -0
  175. data/ext/rugged/vendor/libgit2-dist/src/win32/fnmatch.h +27 -0
  176. data/ext/rugged/vendor/libgit2-dist/src/win32/map.c +131 -0
  177. data/ext/rugged/vendor/libgit2-dist/src/win32/mingw-compat.h +24 -0
  178. data/ext/rugged/vendor/libgit2-dist/src/win32/msvc-compat.h +38 -0
  179. data/ext/rugged/vendor/libgit2-dist/src/win32/posix.h +53 -0
  180. data/ext/rugged/vendor/libgit2-dist/src/win32/posix_w32.c +404 -0
  181. data/ext/rugged/vendor/libgit2-dist/src/win32/pthread.c +65 -0
  182. data/ext/rugged/vendor/libgit2-dist/src/win32/pthread.h +40 -0
  183. data/ext/rugged/vendor/libgit2-dist/src/win32/utf-conv.c +88 -0
  184. data/ext/rugged/vendor/libgit2-dist/src/win32/utf-conv.h +17 -0
  185. data/ext/rugged/vendor/libgit2-dist/tests-clay/buf/basic.c +29 -0
  186. data/ext/rugged/vendor/libgit2-dist/tests-clay/clay.h +187 -0
  187. data/ext/rugged/vendor/libgit2-dist/tests-clay/clay_libgit2.h +28 -0
  188. data/ext/rugged/vendor/libgit2-dist/tests-clay/clay_main.c +1073 -0
  189. data/ext/rugged/vendor/libgit2-dist/tests-clay/config/add.c +37 -0
  190. data/ext/rugged/vendor/libgit2-dist/tests-clay/config/new.c +36 -0
  191. data/ext/rugged/vendor/libgit2-dist/tests-clay/config/read.c +209 -0
  192. data/ext/rugged/vendor/libgit2-dist/tests-clay/config/stress.c +39 -0
  193. data/ext/rugged/vendor/libgit2-dist/tests-clay/config/write.c +77 -0
  194. data/ext/rugged/vendor/libgit2-dist/tests-clay/core/dirent.c +222 -0
  195. data/ext/rugged/vendor/libgit2-dist/tests-clay/core/filebuf.c +106 -0
  196. data/ext/rugged/vendor/libgit2-dist/tests-clay/core/oid.c +18 -0
  197. data/ext/rugged/vendor/libgit2-dist/tests-clay/core/path.c +139 -0
  198. data/ext/rugged/vendor/libgit2-dist/tests-clay/core/rmdir.c +50 -0
  199. data/ext/rugged/vendor/libgit2-dist/tests-clay/core/string.c +28 -0
  200. data/ext/rugged/vendor/libgit2-dist/tests-clay/core/strtol.c +37 -0
  201. data/ext/rugged/vendor/libgit2-dist/tests-clay/core/vector.c +66 -0
  202. data/ext/rugged/vendor/libgit2-dist/tests-clay/index/rename.c +60 -0
  203. data/ext/rugged/vendor/libgit2-dist/tests-clay/network/remotes.c +50 -0
  204. data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/chars.c +52 -0
  205. data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/compare.c +124 -0
  206. data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/convert.c +75 -0
  207. data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/data.h +323 -0
  208. data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/fromstr.c +30 -0
  209. data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/hash.c +162 -0
  210. data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/short.c +94 -0
  211. data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/size.c +13 -0
  212. data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/type2string.c +54 -0
  213. data/ext/rugged/vendor/libgit2-dist/tests-clay/object/tree/frompath.c +75 -0
  214. data/ext/rugged/vendor/libgit2-dist/tests-clay/odb/loose.c +84 -0
  215. data/ext/rugged/vendor/libgit2-dist/tests-clay/odb/loose_data.h +522 -0
  216. data/ext/rugged/vendor/libgit2-dist/tests-clay/odb/pack_data.h +151 -0
  217. data/ext/rugged/vendor/libgit2-dist/tests-clay/odb/packed.c +78 -0
  218. data/ext/rugged/vendor/libgit2-dist/tests-clay/odb/sorting.c +71 -0
  219. data/ext/rugged/vendor/libgit2-dist/tests-clay/repo/getters.c +68 -0
  220. data/ext/rugged/vendor/libgit2-dist/tests-clay/repo/init.c +104 -0
  221. data/ext/rugged/vendor/libgit2-dist/tests-clay/repo/open.c +54 -0
  222. data/ext/rugged/vendor/libgit2-dist/tests-clay/status/single.c +38 -0
  223. data/ext/rugged/vendor/libgit2-dist/tests-clay/status/status_data.h +48 -0
  224. data/ext/rugged/vendor/libgit2-dist/tests-clay/status/worktree.c +124 -0
  225. data/ext/rugged/vendor/libgit2-dist/tests/t00-core.c +628 -0
  226. data/ext/rugged/vendor/libgit2-dist/tests/t01-data.h +322 -0
  227. data/ext/rugged/vendor/libgit2-dist/tests/t01-rawobj.c +638 -0
  228. data/ext/rugged/vendor/libgit2-dist/tests/t03-data.h +344 -0
  229. data/ext/rugged/vendor/libgit2-dist/tests/t03-objwrite.c +255 -0
  230. data/ext/rugged/vendor/libgit2-dist/tests/t04-commit.c +788 -0
  231. data/ext/rugged/vendor/libgit2-dist/tests/t05-revwalk.c +140 -0
  232. data/ext/rugged/vendor/libgit2-dist/tests/t06-index.c +219 -0
  233. data/ext/rugged/vendor/libgit2-dist/tests/t07-hashtable.c +192 -0
  234. data/ext/rugged/vendor/libgit2-dist/tests/t08-tag.c +357 -0
  235. data/ext/rugged/vendor/libgit2-dist/tests/t09-tree.c +221 -0
  236. data/ext/rugged/vendor/libgit2-dist/tests/t10-refs.c +1294 -0
  237. data/ext/rugged/vendor/libgit2-dist/tests/t12-repo.c +174 -0
  238. data/ext/rugged/vendor/libgit2-dist/tests/t13-threads.c +41 -0
  239. data/ext/rugged/vendor/libgit2-dist/tests/t17-bufs.c +61 -0
  240. data/ext/rugged/vendor/libgit2-dist/tests/t18-status.c +448 -0
  241. data/ext/rugged/vendor/libgit2-dist/tests/test_helpers.c +310 -0
  242. data/ext/rugged/vendor/libgit2-dist/tests/test_helpers.h +83 -0
  243. data/ext/rugged/vendor/libgit2-dist/tests/test_lib.c +198 -0
  244. data/ext/rugged/vendor/libgit2-dist/tests/test_lib.h +54 -0
  245. data/ext/rugged/vendor/libgit2-dist/tests/test_main.c +89 -0
  246. data/lib/rugged.rb +4 -3
  247. data/lib/rugged/index.rb +0 -8
  248. data/lib/rugged/objects.rb +45 -0
  249. data/lib/rugged/repository.rb +29 -0
  250. data/lib/rugged/tree.rb +16 -6
  251. data/lib/rugged/version.rb +1 -1
  252. data/lib/rugged/walker.rb +5 -0
  253. data/test/blob_test.rb +18 -14
  254. data/test/commit_test.rb +28 -26
  255. data/test/coverage/HEAD.json +1 -0
  256. data/test/coverage/cover.rb +106 -0
  257. data/test/fixtures/testrepo.git/refs/heads/new_name +1 -0
  258. data/test/index_test.rb +101 -78
  259. data/test/lib_test.rb +4 -4
  260. data/test/object_test.rb +3 -3
  261. data/test/reference_test.rb +75 -0
  262. data/test/remote_test.rb +19 -0
  263. data/test/repo_pack_test.rb +4 -4
  264. data/test/repo_test.rb +44 -15
  265. data/test/tag_test.rb +7 -17
  266. data/test/test_helper.rb +24 -5
  267. data/test/tree_test.rb +30 -12
  268. data/test/walker_test.rb +40 -31
  269. metadata +273 -50
  270. data/lib/rugged/person.rb +0 -20
  271. data/lib/rugged/tree_entry.rb +0 -9
  272. data/test/fixtures/testrepo.git/objects/1d/83f106355e4309a293e42ad2a2c4b8bdbe77ae +0 -0
  273. data/test/fixtures/testrepo.git/objects/2f/3321418db5b2a841375b8b70880a8ab5a4148f +0 -0
  274. data/test/fixtures/testrepo.git/objects/36/9b00a7700cca3a506d79e301d6ad8bf735d9ee +0 -3
  275. data/test/fixtures/testrepo.git/objects/3d/b1b5ceace59ff65279757003763046fd4cbbe6 +0 -0
  276. data/test/fixtures/testrepo.git/objects/4c/d1604907792e2c43e03dcec1216f99d63e68c4 +0 -3
  277. data/test/fixtures/testrepo.git/objects/e0/f46d77041c149296549b01ed4a18b02c4b7400 +0 -0
@@ -0,0 +1,342 @@
1
+ /* deflate.h -- internal compression state
2
+ * Copyright (C) 1995-2010 Jean-loup Gailly
3
+ * For conditions of distribution and use, see copyright notice in zlib.h
4
+ */
5
+
6
+ /* WARNING: this file should *not* be used by applications. It is
7
+ part of the implementation of the compression library and is
8
+ subject to change. Applications should only use zlib.h.
9
+ */
10
+
11
+ /* @(#) $Id$ */
12
+
13
+ #ifndef DEFLATE_H
14
+ #define DEFLATE_H
15
+
16
+ #include "zutil.h"
17
+
18
+ /* define NO_GZIP when compiling if you want to disable gzip header and
19
+ trailer creation by deflate(). NO_GZIP would be used to avoid linking in
20
+ the crc code when it is not needed. For shared libraries, gzip encoding
21
+ should be left enabled. */
22
+ #ifndef NO_GZIP
23
+ # define GZIP
24
+ #endif
25
+
26
+ /* ===========================================================================
27
+ * Internal compression state.
28
+ */
29
+
30
+ #define LENGTH_CODES 29
31
+ /* number of length codes, not counting the special END_BLOCK code */
32
+
33
+ #define LITERALS 256
34
+ /* number of literal bytes 0..255 */
35
+
36
+ #define L_CODES (LITERALS+1+LENGTH_CODES)
37
+ /* number of Literal or Length codes, including the END_BLOCK code */
38
+
39
+ #define D_CODES 30
40
+ /* number of distance codes */
41
+
42
+ #define BL_CODES 19
43
+ /* number of codes used to transfer the bit lengths */
44
+
45
+ #define HEAP_SIZE (2*L_CODES+1)
46
+ /* maximum heap size */
47
+
48
+ #define MAX_BITS 15
49
+ /* All codes must not exceed MAX_BITS bits */
50
+
51
+ #define INIT_STATE 42
52
+ #define EXTRA_STATE 69
53
+ #define NAME_STATE 73
54
+ #define COMMENT_STATE 91
55
+ #define HCRC_STATE 103
56
+ #define BUSY_STATE 113
57
+ #define FINISH_STATE 666
58
+ /* Stream status */
59
+
60
+
61
+ /* Data structure describing a single value and its code string. */
62
+ typedef struct ct_data_s {
63
+ union {
64
+ ush freq; /* frequency count */
65
+ ush code; /* bit string */
66
+ } fc;
67
+ union {
68
+ ush dad; /* father node in Huffman tree */
69
+ ush len; /* length of bit string */
70
+ } dl;
71
+ } FAR ct_data;
72
+
73
+ #define Freq fc.freq
74
+ #define Code fc.code
75
+ #define Dad dl.dad
76
+ #define Len dl.len
77
+
78
+ typedef struct static_tree_desc_s static_tree_desc;
79
+
80
+ typedef struct tree_desc_s {
81
+ ct_data *dyn_tree; /* the dynamic tree */
82
+ int max_code; /* largest code with non zero frequency */
83
+ static_tree_desc *stat_desc; /* the corresponding static tree */
84
+ } FAR tree_desc;
85
+
86
+ typedef ush Pos;
87
+ typedef Pos FAR Posf;
88
+ typedef unsigned IPos;
89
+
90
+ /* A Pos is an index in the character window. We use short instead of int to
91
+ * save space in the various tables. IPos is used only for parameter passing.
92
+ */
93
+
94
+ typedef struct internal_state {
95
+ z_streamp strm; /* pointer back to this zlib stream */
96
+ int status; /* as the name implies */
97
+ Bytef *pending_buf; /* output still pending */
98
+ ulg pending_buf_size; /* size of pending_buf */
99
+ Bytef *pending_out; /* next pending byte to output to the stream */
100
+ uInt pending; /* nb of bytes in the pending buffer */
101
+ int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
102
+ gz_headerp gzhead; /* gzip header information to write */
103
+ uInt gzindex; /* where in extra, name, or comment */
104
+ Byte method; /* STORED (for zip only) or DEFLATED */
105
+ int last_flush; /* value of flush param for previous deflate call */
106
+
107
+ /* used by deflate.c: */
108
+
109
+ uInt w_size; /* LZ77 window size (32K by default) */
110
+ uInt w_bits; /* log2(w_size) (8..16) */
111
+ uInt w_mask; /* w_size - 1 */
112
+
113
+ Bytef *window;
114
+ /* Sliding window. Input bytes are read into the second half of the window,
115
+ * and move to the first half later to keep a dictionary of at least wSize
116
+ * bytes. With this organization, matches are limited to a distance of
117
+ * wSize-MAX_MATCH bytes, but this ensures that IO is always
118
+ * performed with a length multiple of the block size. Also, it limits
119
+ * the window size to 64K, which is quite useful on MSDOS.
120
+ * To do: use the user input buffer as sliding window.
121
+ */
122
+
123
+ ulg window_size;
124
+ /* Actual size of window: 2*wSize, except when the user input buffer
125
+ * is directly used as sliding window.
126
+ */
127
+
128
+ Posf *prev;
129
+ /* Link to older string with same hash index. To limit the size of this
130
+ * array to 64K, this link is maintained only for the last 32K strings.
131
+ * An index in this array is thus a window index modulo 32K.
132
+ */
133
+
134
+ Posf *head; /* Heads of the hash chains or NIL. */
135
+
136
+ uInt ins_h; /* hash index of string to be inserted */
137
+ uInt hash_size; /* number of elements in hash table */
138
+ uInt hash_bits; /* log2(hash_size) */
139
+ uInt hash_mask; /* hash_size-1 */
140
+
141
+ uInt hash_shift;
142
+ /* Number of bits by which ins_h must be shifted at each input
143
+ * step. It must be such that after MIN_MATCH steps, the oldest
144
+ * byte no longer takes part in the hash key, that is:
145
+ * hash_shift * MIN_MATCH >= hash_bits
146
+ */
147
+
148
+ long block_start;
149
+ /* Window position at the beginning of the current output block. Gets
150
+ * negative when the window is moved backwards.
151
+ */
152
+
153
+ uInt match_length; /* length of best match */
154
+ IPos prev_match; /* previous match */
155
+ int match_available; /* set if previous match exists */
156
+ uInt strstart; /* start of string to insert */
157
+ uInt match_start; /* start of matching string */
158
+ uInt lookahead; /* number of valid bytes ahead in window */
159
+
160
+ uInt prev_length;
161
+ /* Length of the best match at previous step. Matches not greater than this
162
+ * are discarded. This is used in the lazy match evaluation.
163
+ */
164
+
165
+ uInt max_chain_length;
166
+ /* To speed up deflation, hash chains are never searched beyond this
167
+ * length. A higher limit improves compression ratio but degrades the
168
+ * speed.
169
+ */
170
+
171
+ uInt max_lazy_match;
172
+ /* Attempt to find a better match only when the current match is strictly
173
+ * smaller than this value. This mechanism is used only for compression
174
+ * levels >= 4.
175
+ */
176
+ # define max_insert_length max_lazy_match
177
+ /* Insert new strings in the hash table only if the match length is not
178
+ * greater than this length. This saves time but degrades compression.
179
+ * max_insert_length is used only for compression levels <= 3.
180
+ */
181
+
182
+ int level; /* compression level (1..9) */
183
+ int strategy; /* favor or force Huffman coding*/
184
+
185
+ uInt good_match;
186
+ /* Use a faster search when the previous match is longer than this */
187
+
188
+ int nice_match; /* Stop searching when current match exceeds this */
189
+
190
+ /* used by trees.c: */
191
+ /* Didn't use ct_data typedef below to supress compiler warning */
192
+ struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
193
+ struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
194
+ struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
195
+
196
+ struct tree_desc_s l_desc; /* desc. for literal tree */
197
+ struct tree_desc_s d_desc; /* desc. for distance tree */
198
+ struct tree_desc_s bl_desc; /* desc. for bit length tree */
199
+
200
+ ush bl_count[MAX_BITS+1];
201
+ /* number of codes at each bit length for an optimal tree */
202
+
203
+ int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */
204
+ int heap_len; /* number of elements in the heap */
205
+ int heap_max; /* element of largest frequency */
206
+ /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
207
+ * The same heap array is used to build all trees.
208
+ */
209
+
210
+ uch depth[2*L_CODES+1];
211
+ /* Depth of each subtree used as tie breaker for trees of equal frequency
212
+ */
213
+
214
+ uchf *l_buf; /* buffer for literals or lengths */
215
+
216
+ uInt lit_bufsize;
217
+ /* Size of match buffer for literals/lengths. There are 4 reasons for
218
+ * limiting lit_bufsize to 64K:
219
+ * - frequencies can be kept in 16 bit counters
220
+ * - if compression is not successful for the first block, all input
221
+ * data is still in the window so we can still emit a stored block even
222
+ * when input comes from standard input. (This can also be done for
223
+ * all blocks if lit_bufsize is not greater than 32K.)
224
+ * - if compression is not successful for a file smaller than 64K, we can
225
+ * even emit a stored file instead of a stored block (saving 5 bytes).
226
+ * This is applicable only for zip (not gzip or zlib).
227
+ * - creating new Huffman trees less frequently may not provide fast
228
+ * adaptation to changes in the input data statistics. (Take for
229
+ * example a binary file with poorly compressible code followed by
230
+ * a highly compressible string table.) Smaller buffer sizes give
231
+ * fast adaptation but have of course the overhead of transmitting
232
+ * trees more frequently.
233
+ * - I can't count above 4
234
+ */
235
+
236
+ uInt last_lit; /* running index in l_buf */
237
+
238
+ ushf *d_buf;
239
+ /* Buffer for distances. To simplify the code, d_buf and l_buf have
240
+ * the same number of elements. To use different lengths, an extra flag
241
+ * array would be necessary.
242
+ */
243
+
244
+ ulg opt_len; /* bit length of current block with optimal trees */
245
+ ulg static_len; /* bit length of current block with static trees */
246
+ uInt matches; /* number of string matches in current block */
247
+ int last_eob_len; /* bit length of EOB code for last block */
248
+
249
+ #ifdef DEBUG
250
+ ulg compressed_len; /* total bit length of compressed file mod 2^32 */
251
+ ulg bits_sent; /* bit length of compressed data sent mod 2^32 */
252
+ #endif
253
+
254
+ ush bi_buf;
255
+ /* Output buffer. bits are inserted starting at the bottom (least
256
+ * significant bits).
257
+ */
258
+ int bi_valid;
259
+ /* Number of valid bits in bi_buf. All bits above the last valid bit
260
+ * are always zero.
261
+ */
262
+
263
+ ulg high_water;
264
+ /* High water mark offset in window for initialized bytes -- bytes above
265
+ * this are set to zero in order to avoid memory check warnings when
266
+ * longest match routines access bytes past the input. This is then
267
+ * updated to the new high water mark.
268
+ */
269
+
270
+ } FAR deflate_state;
271
+
272
+ /* Output a byte on the stream.
273
+ * IN assertion: there is enough room in pending_buf.
274
+ */
275
+ #define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
276
+
277
+
278
+ #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
279
+ /* Minimum amount of lookahead, except at the end of the input file.
280
+ * See deflate.c for comments about the MIN_MATCH+1.
281
+ */
282
+
283
+ #define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD)
284
+ /* In order to simplify the code, particularly on 16 bit machines, match
285
+ * distances are limited to MAX_DIST instead of WSIZE.
286
+ */
287
+
288
+ #define WIN_INIT MAX_MATCH
289
+ /* Number of bytes after end of data in window to initialize in order to avoid
290
+ memory checker errors from longest match routines */
291
+
292
+ /* in trees.c */
293
+ void ZLIB_INTERNAL _tr_init OF((deflate_state *s));
294
+ int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
295
+ void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf,
296
+ ulg stored_len, int last));
297
+ void ZLIB_INTERNAL _tr_align OF((deflate_state *s));
298
+ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
299
+ ulg stored_len, int last));
300
+
301
+ #define d_code(dist) \
302
+ ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
303
+ /* Mapping from a distance to a distance code. dist is the distance - 1 and
304
+ * must not have side effects. _dist_code[256] and _dist_code[257] are never
305
+ * used.
306
+ */
307
+
308
+ #ifndef DEBUG
309
+ /* Inline versions of _tr_tally for speed: */
310
+
311
+ #if defined(GEN_TREES_H) || !defined(STDC)
312
+ extern uch ZLIB_INTERNAL _length_code[];
313
+ extern uch ZLIB_INTERNAL _dist_code[];
314
+ #else
315
+ extern const uch ZLIB_INTERNAL _length_code[];
316
+ extern const uch ZLIB_INTERNAL _dist_code[];
317
+ #endif
318
+
319
+ # define _tr_tally_lit(s, c, flush) \
320
+ { uch cc = (uch)(c); \
321
+ s->d_buf[s->last_lit] = 0; \
322
+ s->l_buf[s->last_lit++] = cc; \
323
+ s->dyn_ltree[cc].Freq++; \
324
+ flush = (s->last_lit == s->lit_bufsize-1); \
325
+ }
326
+ # define _tr_tally_dist(s, distance, length, flush) \
327
+ { uch len = (uch)(length); \
328
+ ush dist = (ush)(distance); \
329
+ s->d_buf[s->last_lit] = dist; \
330
+ s->l_buf[s->last_lit++] = len; \
331
+ dist--; \
332
+ s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
333
+ s->dyn_dtree[d_code(dist)].Freq++; \
334
+ flush = (s->last_lit == s->lit_bufsize-1); \
335
+ }
336
+ #else
337
+ # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
338
+ # define _tr_tally_dist(s, distance, length, flush) \
339
+ flush = _tr_tally(s, distance, length)
340
+ #endif
341
+
342
+ #endif /* DEFLATE_H */
@@ -0,0 +1,340 @@
1
+ /* inffast.c -- fast decoding
2
+ * Copyright (C) 1995-2008, 2010 Mark Adler
3
+ * For conditions of distribution and use, see copyright notice in zlib.h
4
+ */
5
+
6
+ #include "zutil.h"
7
+ #include "inftrees.h"
8
+ #include "inflate.h"
9
+ #include "inffast.h"
10
+
11
+ #ifndef ASMINF
12
+
13
+ /* Allow machine dependent optimization for post-increment or pre-increment.
14
+ Based on testing to date,
15
+ Pre-increment preferred for:
16
+ - PowerPC G3 (Adler)
17
+ - MIPS R5000 (Randers-Pehrson)
18
+ Post-increment preferred for:
19
+ - none
20
+ No measurable difference:
21
+ - Pentium III (Anderson)
22
+ - M68060 (Nikl)
23
+ */
24
+ #ifdef POSTINC
25
+ # define OFF 0
26
+ # define PUP(a) *(a)++
27
+ #else
28
+ # define OFF 1
29
+ # define PUP(a) *++(a)
30
+ #endif
31
+
32
+ /*
33
+ Decode literal, length, and distance codes and write out the resulting
34
+ literal and match bytes until either not enough input or output is
35
+ available, an end-of-block is encountered, or a data error is encountered.
36
+ When large enough input and output buffers are supplied to inflate(), for
37
+ example, a 16K input buffer and a 64K output buffer, more than 95% of the
38
+ inflate execution time is spent in this routine.
39
+
40
+ Entry assumptions:
41
+
42
+ state->mode == LEN
43
+ strm->avail_in >= 6
44
+ strm->avail_out >= 258
45
+ start >= strm->avail_out
46
+ state->bits < 8
47
+
48
+ On return, state->mode is one of:
49
+
50
+ LEN -- ran out of enough output space or enough available input
51
+ TYPE -- reached end of block code, inflate() to interpret next block
52
+ BAD -- error in block data
53
+
54
+ Notes:
55
+
56
+ - The maximum input bits used by a length/distance pair is 15 bits for the
57
+ length code, 5 bits for the length extra, 15 bits for the distance code,
58
+ and 13 bits for the distance extra. This totals 48 bits, or six bytes.
59
+ Therefore if strm->avail_in >= 6, then there is enough input to avoid
60
+ checking for available input while decoding.
61
+
62
+ - The maximum bytes that a single length/distance pair can output is 258
63
+ bytes, which is the maximum length that can be coded. inflate_fast()
64
+ requires strm->avail_out >= 258 for each loop to avoid checking for
65
+ output space.
66
+ */
67
+ void ZLIB_INTERNAL inflate_fast(strm, start)
68
+ z_streamp strm;
69
+ unsigned start; /* inflate()'s starting value for strm->avail_out */
70
+ {
71
+ struct inflate_state FAR *state;
72
+ unsigned char FAR *in; /* local strm->next_in */
73
+ unsigned char FAR *last; /* while in < last, enough input available */
74
+ unsigned char FAR *out; /* local strm->next_out */
75
+ unsigned char FAR *beg; /* inflate()'s initial strm->next_out */
76
+ unsigned char FAR *end; /* while out < end, enough space available */
77
+ #ifdef INFLATE_STRICT
78
+ unsigned dmax; /* maximum distance from zlib header */
79
+ #endif
80
+ unsigned wsize; /* window size or zero if not using window */
81
+ unsigned whave; /* valid bytes in the window */
82
+ unsigned wnext; /* window write index */
83
+ unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */
84
+ unsigned long hold; /* local strm->hold */
85
+ unsigned bits; /* local strm->bits */
86
+ code const FAR *lcode; /* local strm->lencode */
87
+ code const FAR *dcode; /* local strm->distcode */
88
+ unsigned lmask; /* mask for first level of length codes */
89
+ unsigned dmask; /* mask for first level of distance codes */
90
+ code here; /* retrieved table entry */
91
+ unsigned op; /* code bits, operation, extra bits, or */
92
+ /* window position, window bytes to copy */
93
+ unsigned len; /* match length, unused bytes */
94
+ unsigned dist; /* match distance */
95
+ unsigned char FAR *from; /* where to copy match from */
96
+
97
+ /* copy state to local variables */
98
+ state = (struct inflate_state FAR *)strm->state;
99
+ in = strm->next_in - OFF;
100
+ last = in + (strm->avail_in - 5);
101
+ out = strm->next_out - OFF;
102
+ beg = out - (start - strm->avail_out);
103
+ end = out + (strm->avail_out - 257);
104
+ #ifdef INFLATE_STRICT
105
+ dmax = state->dmax;
106
+ #endif
107
+ wsize = state->wsize;
108
+ whave = state->whave;
109
+ wnext = state->wnext;
110
+ window = state->window;
111
+ hold = state->hold;
112
+ bits = state->bits;
113
+ lcode = state->lencode;
114
+ dcode = state->distcode;
115
+ lmask = (1U << state->lenbits) - 1;
116
+ dmask = (1U << state->distbits) - 1;
117
+
118
+ /* decode literals and length/distances until end-of-block or not enough
119
+ input data or output space */
120
+ do {
121
+ if (bits < 15) {
122
+ hold += (unsigned long)(PUP(in)) << bits;
123
+ bits += 8;
124
+ hold += (unsigned long)(PUP(in)) << bits;
125
+ bits += 8;
126
+ }
127
+ here = lcode[hold & lmask];
128
+ dolen:
129
+ op = (unsigned)(here.bits);
130
+ hold >>= op;
131
+ bits -= op;
132
+ op = (unsigned)(here.op);
133
+ if (op == 0) { /* literal */
134
+ Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
135
+ "inflate: literal '%c'\n" :
136
+ "inflate: literal 0x%02x\n", here.val));
137
+ PUP(out) = (unsigned char)(here.val);
138
+ }
139
+ else if (op & 16) { /* length base */
140
+ len = (unsigned)(here.val);
141
+ op &= 15; /* number of extra bits */
142
+ if (op) {
143
+ if (bits < op) {
144
+ hold += (unsigned long)(PUP(in)) << bits;
145
+ bits += 8;
146
+ }
147
+ len += (unsigned)hold & ((1U << op) - 1);
148
+ hold >>= op;
149
+ bits -= op;
150
+ }
151
+ Tracevv((stderr, "inflate: length %u\n", len));
152
+ if (bits < 15) {
153
+ hold += (unsigned long)(PUP(in)) << bits;
154
+ bits += 8;
155
+ hold += (unsigned long)(PUP(in)) << bits;
156
+ bits += 8;
157
+ }
158
+ here = dcode[hold & dmask];
159
+ dodist:
160
+ op = (unsigned)(here.bits);
161
+ hold >>= op;
162
+ bits -= op;
163
+ op = (unsigned)(here.op);
164
+ if (op & 16) { /* distance base */
165
+ dist = (unsigned)(here.val);
166
+ op &= 15; /* number of extra bits */
167
+ if (bits < op) {
168
+ hold += (unsigned long)(PUP(in)) << bits;
169
+ bits += 8;
170
+ if (bits < op) {
171
+ hold += (unsigned long)(PUP(in)) << bits;
172
+ bits += 8;
173
+ }
174
+ }
175
+ dist += (unsigned)hold & ((1U << op) - 1);
176
+ #ifdef INFLATE_STRICT
177
+ if (dist > dmax) {
178
+ strm->msg = (char *)"invalid distance too far back";
179
+ state->mode = BAD;
180
+ break;
181
+ }
182
+ #endif
183
+ hold >>= op;
184
+ bits -= op;
185
+ Tracevv((stderr, "inflate: distance %u\n", dist));
186
+ op = (unsigned)(out - beg); /* max distance in output */
187
+ if (dist > op) { /* see if copy from window */
188
+ op = dist - op; /* distance back in window */
189
+ if (op > whave) {
190
+ if (state->sane) {
191
+ strm->msg =
192
+ (char *)"invalid distance too far back";
193
+ state->mode = BAD;
194
+ break;
195
+ }
196
+ #ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
197
+ if (len <= op - whave) {
198
+ do {
199
+ PUP(out) = 0;
200
+ } while (--len);
201
+ continue;
202
+ }
203
+ len -= op - whave;
204
+ do {
205
+ PUP(out) = 0;
206
+ } while (--op > whave);
207
+ if (op == 0) {
208
+ from = out - dist;
209
+ do {
210
+ PUP(out) = PUP(from);
211
+ } while (--len);
212
+ continue;
213
+ }
214
+ #endif
215
+ }
216
+ from = window - OFF;
217
+ if (wnext == 0) { /* very common case */
218
+ from += wsize - op;
219
+ if (op < len) { /* some from window */
220
+ len -= op;
221
+ do {
222
+ PUP(out) = PUP(from);
223
+ } while (--op);
224
+ from = out - dist; /* rest from output */
225
+ }
226
+ }
227
+ else if (wnext < op) { /* wrap around window */
228
+ from += wsize + wnext - op;
229
+ op -= wnext;
230
+ if (op < len) { /* some from end of window */
231
+ len -= op;
232
+ do {
233
+ PUP(out) = PUP(from);
234
+ } while (--op);
235
+ from = window - OFF;
236
+ if (wnext < len) { /* some from start of window */
237
+ op = wnext;
238
+ len -= op;
239
+ do {
240
+ PUP(out) = PUP(from);
241
+ } while (--op);
242
+ from = out - dist; /* rest from output */
243
+ }
244
+ }
245
+ }
246
+ else { /* contiguous in window */
247
+ from += wnext - op;
248
+ if (op < len) { /* some from window */
249
+ len -= op;
250
+ do {
251
+ PUP(out) = PUP(from);
252
+ } while (--op);
253
+ from = out - dist; /* rest from output */
254
+ }
255
+ }
256
+ while (len > 2) {
257
+ PUP(out) = PUP(from);
258
+ PUP(out) = PUP(from);
259
+ PUP(out) = PUP(from);
260
+ len -= 3;
261
+ }
262
+ if (len) {
263
+ PUP(out) = PUP(from);
264
+ if (len > 1)
265
+ PUP(out) = PUP(from);
266
+ }
267
+ }
268
+ else {
269
+ from = out - dist; /* copy direct from output */
270
+ do { /* minimum length is three */
271
+ PUP(out) = PUP(from);
272
+ PUP(out) = PUP(from);
273
+ PUP(out) = PUP(from);
274
+ len -= 3;
275
+ } while (len > 2);
276
+ if (len) {
277
+ PUP(out) = PUP(from);
278
+ if (len > 1)
279
+ PUP(out) = PUP(from);
280
+ }
281
+ }
282
+ }
283
+ else if ((op & 64) == 0) { /* 2nd level distance code */
284
+ here = dcode[here.val + (hold & ((1U << op) - 1))];
285
+ goto dodist;
286
+ }
287
+ else {
288
+ strm->msg = (char *)"invalid distance code";
289
+ state->mode = BAD;
290
+ break;
291
+ }
292
+ }
293
+ else if ((op & 64) == 0) { /* 2nd level length code */
294
+ here = lcode[here.val + (hold & ((1U << op) - 1))];
295
+ goto dolen;
296
+ }
297
+ else if (op & 32) { /* end-of-block */
298
+ Tracevv((stderr, "inflate: end of block\n"));
299
+ state->mode = TYPE;
300
+ break;
301
+ }
302
+ else {
303
+ strm->msg = (char *)"invalid literal/length code";
304
+ state->mode = BAD;
305
+ break;
306
+ }
307
+ } while (in < last && out < end);
308
+
309
+ /* return unused bytes (on entry, bits < 8, so in won't go too far back) */
310
+ len = bits >> 3;
311
+ in -= len;
312
+ bits -= len << 3;
313
+ hold &= (1U << bits) - 1;
314
+
315
+ /* update state and return */
316
+ strm->next_in = in + OFF;
317
+ strm->next_out = out + OFF;
318
+ strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
319
+ strm->avail_out = (unsigned)(out < end ?
320
+ 257 + (end - out) : 257 - (out - end));
321
+ state->hold = hold;
322
+ state->bits = bits;
323
+ return;
324
+ }
325
+
326
+ /*
327
+ inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe):
328
+ - Using bit fields for code structure
329
+ - Different op definition to avoid & for extra bits (do & for table bits)
330
+ - Three separate decoding do-loops for direct, window, and wnext == 0
331
+ - Special case for distance > 1 copies to do overlapped load and store copy
332
+ - Explicit branch predictions (based on measured branch probabilities)
333
+ - Deferring match copy and interspersed it with decoding subsequent codes
334
+ - Swapping literal/length else
335
+ - Swapping window/direct else
336
+ - Larger unrolled copy loops (three is about right)
337
+ - Moving len -= 3 statement into middle of loop
338
+ */
339
+
340
+ #endif /* !ASMINF */