rroonga 5.0.1-x64-mingw32 → 5.0.2-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (731) hide show
  1. checksums.yaml +8 -8
  2. data/README.md +1 -1
  3. data/ext/groonga/rb-grn-logger.c +159 -3
  4. data/ext/groonga/rb-grn-plugin.c +17 -1
  5. data/ext/groonga/rb-grn-query-logger.c +129 -3
  6. data/ext/groonga/rb-grn.h +1 -1
  7. data/lib/1.9/groonga.so +0 -0
  8. data/lib/2.0/groonga.so +0 -0
  9. data/lib/2.1/groonga.so +0 -0
  10. data/lib/2.2/groonga.so +0 -0
  11. data/lib/groonga/query-logger.rb +48 -3
  12. data/lib/groonga/schema.rb +16 -3
  13. data/rroonga-build.rb +3 -3
  14. data/test/test-logger.rb +97 -2
  15. data/test/test-plugin.rb +5 -1
  16. data/test/test-query-logger.rb +149 -0
  17. data/test/test-schema.rb +19 -0
  18. data/vendor/local/bin/grndb.exe +0 -0
  19. data/vendor/local/bin/groonga-benchmark.exe +0 -0
  20. data/vendor/local/bin/groonga.exe +0 -0
  21. data/vendor/local/bin/libgroonga-0.dll +0 -0
  22. data/vendor/local/bin/libmecab-1.dll +0 -0
  23. data/vendor/local/bin/libmsgpack-4.dll +0 -0
  24. data/vendor/local/bin/libmsgpackc-2.dll +0 -0
  25. data/vendor/local/bin/libonig-5.dll +0 -0
  26. data/vendor/local/bin/lz4.exe +0 -0
  27. data/vendor/local/bin/lz4c.exe +0 -0
  28. data/vendor/local/bin/lz4cat +0 -0
  29. data/vendor/local/bin/mecab-config +2 -2
  30. data/vendor/local/bin/mecab.exe +0 -0
  31. data/vendor/local/bin/onig-config +1 -1
  32. data/vendor/local/bin/zlib1.dll +0 -0
  33. data/vendor/local/etc/groonga/httpd/groonga-httpd.conf +2 -2
  34. data/vendor/local/include/groonga/groonga.h +1 -0
  35. data/vendor/local/include/groonga/groonga/groonga.h +12 -6
  36. data/vendor/local/include/groonga/groonga/portability.h +158 -0
  37. data/vendor/local/include/msgpack.h +1 -0
  38. data/vendor/local/include/msgpack.hpp +2 -1
  39. data/vendor/local/include/msgpack/adaptor/bool.hpp +58 -0
  40. data/vendor/local/include/msgpack/{type/bool.hpp → adaptor/bool_fwd.hpp} +11 -27
  41. data/vendor/local/include/msgpack/adaptor/char_ptr.hpp +78 -0
  42. data/vendor/local/include/msgpack/adaptor/char_ptr_fwd.hpp +43 -0
  43. data/vendor/local/include/msgpack/adaptor/check_container_size.hpp +61 -0
  44. data/vendor/local/include/msgpack/adaptor/cpp11/array.hpp +76 -0
  45. data/vendor/local/include/msgpack/adaptor/cpp11/array_char.hpp +84 -0
  46. data/vendor/local/include/msgpack/adaptor/cpp11/array_char_fwd.hpp +45 -0
  47. data/vendor/local/include/msgpack/adaptor/cpp11/array_fwd.hpp +44 -0
  48. data/vendor/local/include/msgpack/adaptor/cpp11/forward_list.hpp +75 -0
  49. data/vendor/local/include/msgpack/adaptor/cpp11/forward_list_fwd.hpp +44 -0
  50. data/vendor/local/include/msgpack/adaptor/cpp11/tuple.hpp +152 -0
  51. data/vendor/local/include/msgpack/adaptor/cpp11/tuple_fwd.hpp +62 -0
  52. data/vendor/local/include/msgpack/adaptor/cpp11/unordered_map.hpp +142 -0
  53. data/vendor/local/include/msgpack/adaptor/cpp11/unordered_map_fwd.hpp +53 -0
  54. data/vendor/local/include/msgpack/adaptor/cpp11/unordered_set.hpp +134 -0
  55. data/vendor/local/include/msgpack/adaptor/cpp11/unordered_set_fwd.hpp +52 -0
  56. data/vendor/local/include/msgpack/adaptor/define.hpp +29 -0
  57. data/vendor/local/include/msgpack/adaptor/deque.hpp +83 -0
  58. data/vendor/local/include/msgpack/adaptor/deque_fwd.hpp +40 -0
  59. data/vendor/local/include/msgpack/adaptor/detail/cpp03_define.hpp +3475 -0
  60. data/vendor/local/include/msgpack/adaptor/detail/cpp03_msgpack_tuple.hpp +13918 -0
  61. data/vendor/local/include/msgpack/adaptor/detail/cpp03_msgpack_tuple_fwd.hpp +4341 -0
  62. data/vendor/local/include/msgpack/adaptor/detail/cpp11_define.hpp +184 -0
  63. data/vendor/local/include/msgpack/adaptor/detail/cpp11_msgpack_tuple.hpp +212 -0
  64. data/vendor/local/include/msgpack/adaptor/detail/cpp11_msgpack_tuple_fwd.hpp +84 -0
  65. data/vendor/local/include/msgpack/adaptor/fixint.hpp +212 -0
  66. data/vendor/local/include/msgpack/adaptor/fixint_fwd.hpp +100 -0
  67. data/vendor/local/include/msgpack/adaptor/float.hpp +105 -0
  68. data/vendor/local/include/msgpack/adaptor/float_fwd.hpp +44 -0
  69. data/vendor/local/include/msgpack/adaptor/int.hpp +308 -0
  70. data/vendor/local/include/msgpack/adaptor/int_fwd.hpp +100 -0
  71. data/vendor/local/include/msgpack/adaptor/list.hpp +83 -0
  72. data/vendor/local/include/msgpack/adaptor/list_fwd.hpp +40 -0
  73. data/vendor/local/include/msgpack/adaptor/map.hpp +219 -0
  74. data/vendor/local/include/msgpack/adaptor/map_fwd.hpp +69 -0
  75. data/vendor/local/include/msgpack/adaptor/msgpack_tuple.hpp +29 -0
  76. data/vendor/local/include/msgpack/adaptor/msgpack_tuple_fwd.hpp +29 -0
  77. data/vendor/local/include/msgpack/adaptor/nil.hpp +68 -0
  78. data/vendor/local/include/msgpack/adaptor/nil_fwd.hpp +51 -0
  79. data/vendor/local/include/msgpack/adaptor/pair.hpp +63 -0
  80. data/vendor/local/include/msgpack/{type/pair.hpp → adaptor/pair_fwd.hpp} +10 -29
  81. data/vendor/local/include/msgpack/adaptor/raw.hpp +98 -0
  82. data/vendor/local/include/msgpack/{type/nil.hpp → adaptor/raw_fwd.hpp} +15 -30
  83. data/vendor/local/include/msgpack/adaptor/set.hpp +134 -0
  84. data/vendor/local/include/msgpack/adaptor/set_fwd.hpp +52 -0
  85. data/vendor/local/include/msgpack/adaptor/string.hpp +78 -0
  86. data/vendor/local/include/msgpack/adaptor/string_fwd.hpp +42 -0
  87. data/vendor/local/include/msgpack/adaptor/tr1/unordered_map.hpp +164 -0
  88. data/vendor/local/include/msgpack/adaptor/tr1/unordered_map_fwd.hpp +75 -0
  89. data/vendor/local/include/msgpack/adaptor/tr1/unordered_set.hpp +157 -0
  90. data/vendor/local/include/msgpack/adaptor/tr1/unordered_set_fwd.hpp +75 -0
  91. data/vendor/local/include/msgpack/adaptor/vector.hpp +87 -0
  92. data/vendor/local/include/msgpack/adaptor/vector_bool.hpp +80 -0
  93. data/vendor/local/include/msgpack/adaptor/vector_bool_fwd.hpp +40 -0
  94. data/vendor/local/include/msgpack/adaptor/vector_char.hpp +81 -0
  95. data/vendor/local/include/msgpack/adaptor/vector_char_fwd.hpp +42 -0
  96. data/vendor/local/include/msgpack/adaptor/vector_fwd.hpp +42 -0
  97. data/vendor/local/include/msgpack/cpp_config.hpp +109 -0
  98. data/vendor/local/include/msgpack/detail/cpp03_zone.hpp +662 -0
  99. data/vendor/local/include/msgpack/detail/cpp11_zone.hpp +368 -0
  100. data/vendor/local/include/msgpack/fbuffer.h +3 -4
  101. data/vendor/local/include/msgpack/fbuffer.hpp +24 -16
  102. data/vendor/local/include/msgpack/gcc_atomic.h +33 -0
  103. data/vendor/local/include/msgpack/iterator.hpp +42 -0
  104. data/vendor/local/include/msgpack/object.h +51 -30
  105. data/vendor/local/include/msgpack/object.hpp +564 -273
  106. data/vendor/local/include/msgpack/object_fwd.hpp +182 -0
  107. data/vendor/local/include/msgpack/pack.h +23 -17
  108. data/vendor/local/include/msgpack/pack.hpp +889 -164
  109. data/vendor/local/include/msgpack/pack_define.h +2 -2
  110. data/vendor/local/include/msgpack/pack_template.h +452 -356
  111. data/vendor/local/include/msgpack/sbuffer.h +43 -37
  112. data/vendor/local/include/msgpack/sbuffer.hpp +98 -76
  113. data/vendor/local/include/msgpack/sysdep.h +48 -53
  114. data/vendor/local/include/msgpack/type.hpp +35 -17
  115. data/vendor/local/include/msgpack/unpack.h +62 -44
  116. data/vendor/local/include/msgpack/unpack.hpp +1578 -217
  117. data/vendor/local/include/msgpack/unpack_define.h +49 -47
  118. data/vendor/local/include/msgpack/unpack_template.h +344 -284
  119. data/vendor/local/include/msgpack/util.h +23 -0
  120. data/vendor/local/include/msgpack/version.h +12 -6
  121. data/vendor/local/include/msgpack/version.hpp +44 -0
  122. data/vendor/local/include/msgpack/version_master.h +3 -0
  123. data/vendor/local/include/msgpack/versioning.hpp +77 -0
  124. data/vendor/local/include/msgpack/vrefbuffer.h +40 -34
  125. data/vendor/local/include/msgpack/vrefbuffer.hpp +261 -64
  126. data/vendor/local/include/msgpack/zbuffer.h +79 -79
  127. data/vendor/local/include/msgpack/zbuffer.hpp +136 -67
  128. data/vendor/local/include/msgpack/zone.h +65 -42
  129. data/vendor/local/include/msgpack/zone.hpp +10 -445
  130. data/vendor/local/include/msgpack_fwd.hpp +28 -0
  131. data/vendor/local/lib/groonga/plugins/functions/vector.a +0 -0
  132. data/vendor/local/lib/groonga/plugins/functions/vector.dll +0 -0
  133. data/vendor/local/lib/groonga/plugins/functions/vector.dll.a +0 -0
  134. data/vendor/local/lib/groonga/plugins/functions/vector.la +41 -0
  135. data/vendor/local/lib/groonga/plugins/query_expanders/tsv.a +0 -0
  136. data/vendor/local/lib/groonga/plugins/query_expanders/tsv.dll +0 -0
  137. data/vendor/local/lib/groonga/plugins/query_expanders/tsv.dll.a +0 -0
  138. data/vendor/local/lib/groonga/plugins/query_expanders/tsv.la +2 -2
  139. data/vendor/local/lib/groonga/plugins/ruby/eval.a +0 -0
  140. data/vendor/local/lib/groonga/plugins/ruby/eval.dll +0 -0
  141. data/vendor/local/lib/groonga/plugins/ruby/eval.dll.a +0 -0
  142. data/vendor/local/lib/groonga/plugins/ruby/eval.la +2 -2
  143. data/vendor/local/lib/groonga/plugins/ruby/load.a +0 -0
  144. data/vendor/local/lib/groonga/plugins/ruby/load.dll +0 -0
  145. data/vendor/local/lib/groonga/plugins/ruby/load.dll.a +0 -0
  146. data/vendor/local/lib/groonga/plugins/ruby/load.la +2 -2
  147. data/vendor/local/lib/groonga/plugins/sharding.rb +1 -0
  148. data/vendor/local/lib/groonga/plugins/sharding/logical_count.rb +17 -45
  149. data/vendor/local/lib/groonga/plugins/sharding/logical_enumerator.rb +15 -6
  150. data/vendor/local/lib/groonga/plugins/sharding/logical_range_filter.rb +63 -75
  151. data/vendor/local/lib/groonga/plugins/sharding/range_expression_builder.rb +65 -0
  152. data/vendor/local/lib/groonga/plugins/suggest/suggest.a +0 -0
  153. data/vendor/local/lib/groonga/plugins/suggest/suggest.dll +0 -0
  154. data/vendor/local/lib/groonga/plugins/suggest/suggest.dll.a +0 -0
  155. data/vendor/local/lib/groonga/plugins/suggest/suggest.la +2 -2
  156. data/vendor/local/lib/groonga/plugins/table/table.a +0 -0
  157. data/vendor/local/lib/groonga/plugins/table/table.dll +0 -0
  158. data/vendor/local/lib/groonga/plugins/table/table.dll.a +0 -0
  159. data/vendor/local/lib/groonga/plugins/table/table.la +2 -2
  160. data/vendor/local/lib/groonga/plugins/token_filters/stop_word.a +0 -0
  161. data/vendor/local/lib/groonga/plugins/token_filters/stop_word.dll +0 -0
  162. data/vendor/local/lib/groonga/plugins/token_filters/stop_word.dll.a +0 -0
  163. data/vendor/local/lib/groonga/plugins/token_filters/stop_word.la +2 -2
  164. data/vendor/local/lib/groonga/plugins/tokenizers/mecab.a +0 -0
  165. data/vendor/local/lib/groonga/plugins/tokenizers/mecab.dll +0 -0
  166. data/vendor/local/lib/groonga/plugins/tokenizers/mecab.dll.a +0 -0
  167. data/vendor/local/lib/groonga/plugins/tokenizers/mecab.la +2 -2
  168. data/vendor/local/lib/groonga/scripts/ruby/expression_size_estimator.rb +38 -41
  169. data/vendor/local/lib/groonga/scripts/ruby/scan_info_data.rb +3 -0
  170. data/vendor/local/lib/libgroonga.a +0 -0
  171. data/vendor/local/lib/libgroonga.dll.a +0 -0
  172. data/vendor/local/lib/libgroonga.la +2 -2
  173. data/vendor/local/lib/liblz4.a +0 -0
  174. data/vendor/local/lib/liblz4.dll +0 -0
  175. data/vendor/local/lib/liblz4.dll.1 +0 -0
  176. data/vendor/local/lib/liblz4.dll.1.5.0 +0 -0
  177. data/vendor/local/lib/libmecab.a +0 -0
  178. data/vendor/local/lib/libmecab.dll.a +0 -0
  179. data/vendor/local/lib/libmecab.la +2 -2
  180. data/vendor/local/lib/libmsgpack.a +0 -0
  181. data/vendor/local/lib/libmsgpack.dll.a +0 -0
  182. data/vendor/local/lib/libmsgpack.la +4 -4
  183. data/vendor/local/lib/libmsgpackc.a +0 -0
  184. data/vendor/local/lib/libmsgpackc.dll.a +0 -0
  185. data/vendor/local/lib/libmsgpackc.la +2 -2
  186. data/vendor/local/lib/libonig.a +0 -0
  187. data/vendor/local/lib/libonig.dll.a +0 -0
  188. data/vendor/local/lib/libonig.la +2 -2
  189. data/vendor/local/lib/libz.a +0 -0
  190. data/vendor/local/lib/libz.dll.a +0 -0
  191. data/vendor/local/lib/pkgconfig/groonga.pc +3 -3
  192. data/vendor/local/lib/pkgconfig/liblz4.pc +5 -5
  193. data/vendor/local/lib/pkgconfig/msgpack.pc +2 -2
  194. data/vendor/local/lib/pkgconfig/oniguruma.pc +6 -6
  195. data/vendor/local/lib/pkgconfig/zlib.pc +3 -3
  196. data/vendor/local/libexec/mecab/mecab-cost-train.exe +0 -0
  197. data/vendor/local/libexec/mecab/mecab-dict-gen.exe +0 -0
  198. data/vendor/local/libexec/mecab/mecab-dict-index.exe +0 -0
  199. data/vendor/local/libexec/mecab/mecab-system-eval.exe +0 -0
  200. data/vendor/local/libexec/mecab/mecab-test-gen.exe +0 -0
  201. data/vendor/local/sbin/groonga-httpd-restart +1 -1
  202. data/vendor/local/sbin/groonga-httpd.exe +0 -0
  203. data/vendor/local/share/doc/groonga/en/html/.buildinfo +1 -1
  204. data/vendor/local/share/doc/groonga/en/html/_sources/contribution/development/release.txt +69 -52
  205. data/vendor/local/share/doc/groonga/en/html/_sources/install/centos.txt +6 -6
  206. data/vendor/local/share/doc/groonga/en/html/_sources/install/debian.txt +56 -5
  207. data/vendor/local/share/doc/groonga/en/html/_sources/install/fedora.txt +4 -4
  208. data/vendor/local/share/doc/groonga/en/html/_sources/install/mac_os_x.txt +3 -3
  209. data/vendor/local/share/doc/groonga/en/html/_sources/install/others.txt +7 -7
  210. data/vendor/local/share/doc/groonga/en/html/_sources/install/solaris.txt +3 -3
  211. data/vendor/local/share/doc/groonga/en/html/_sources/install/ubuntu.txt +6 -5
  212. data/vendor/local/share/doc/groonga/en/html/_sources/install/windows.txt +14 -14
  213. data/vendor/local/share/doc/groonga/en/html/_sources/news.txt +93 -3
  214. data/vendor/local/share/doc/groonga/en/html/_sources/news/0.x.txt +2 -2
  215. data/vendor/local/share/doc/groonga/en/html/_sources/news/1.0.x.txt +9 -9
  216. data/vendor/local/share/doc/groonga/en/html/_sources/news/1.1.x.txt +1 -1
  217. data/vendor/local/share/doc/groonga/en/html/_sources/news/1.2.x.txt +10 -10
  218. data/vendor/local/share/doc/groonga/en/html/_sources/news/1.3.x.txt +1 -1
  219. data/vendor/local/share/doc/groonga/en/html/_sources/news/2.x.txt +13 -13
  220. data/vendor/local/share/doc/groonga/en/html/_sources/news/3.x.txt +13 -13
  221. data/vendor/local/share/doc/groonga/en/html/_sources/news/4.x.txt +9 -9
  222. data/vendor/local/share/doc/groonga/en/html/_sources/news/senna.txt +13 -13
  223. data/vendor/local/share/doc/groonga/en/html/_sources/reference/commands/dump.txt +135 -27
  224. data/vendor/local/share/doc/groonga/en/html/_sources/reference/commands/request_cancel.txt +1 -1
  225. data/vendor/local/share/doc/groonga/en/html/_sources/reference/executables/groonga.txt +148 -7
  226. data/vendor/local/share/doc/groonga/en/html/_sources/reference/functions/vector_size.txt +76 -0
  227. data/vendor/local/share/doc/groonga/en/html/_sources/reference/scorer.txt +2 -1
  228. data/vendor/local/share/doc/groonga/en/html/_sources/server/gqtp.txt +38 -6
  229. data/vendor/local/share/doc/groonga/en/html/_sources/spec/gqtp.txt +2 -1
  230. data/vendor/local/share/doc/groonga/en/html/_sources/tutorial/index.txt +6 -4
  231. data/vendor/local/share/doc/groonga/en/html/characteristic.html +6 -6
  232. data/vendor/local/share/doc/groonga/en/html/client.html +6 -6
  233. data/vendor/local/share/doc/groonga/en/html/community.html +6 -6
  234. data/vendor/local/share/doc/groonga/en/html/contribution.html +14 -13
  235. data/vendor/local/share/doc/groonga/en/html/contribution/development.html +6 -6
  236. data/vendor/local/share/doc/groonga/en/html/contribution/development/com.html +6 -6
  237. data/vendor/local/share/doc/groonga/en/html/contribution/development/cooperation.html +6 -6
  238. data/vendor/local/share/doc/groonga/en/html/contribution/development/query.html +6 -6
  239. data/vendor/local/share/doc/groonga/en/html/contribution/development/release.html +58 -42
  240. data/vendor/local/share/doc/groonga/en/html/contribution/development/repository.html +6 -6
  241. data/vendor/local/share/doc/groonga/en/html/contribution/development/test.html +6 -6
  242. data/vendor/local/share/doc/groonga/en/html/contribution/documentation.html +6 -6
  243. data/vendor/local/share/doc/groonga/en/html/contribution/documentation/c-api.html +6 -6
  244. data/vendor/local/share/doc/groonga/en/html/contribution/documentation/i18n.html +6 -6
  245. data/vendor/local/share/doc/groonga/en/html/contribution/documentation/introduction.html +6 -6
  246. data/vendor/local/share/doc/groonga/en/html/contribution/report.html +6 -6
  247. data/vendor/local/share/doc/groonga/en/html/development.html +6 -6
  248. data/vendor/local/share/doc/groonga/en/html/development/travis-ci.html +6 -6
  249. data/vendor/local/share/doc/groonga/en/html/genindex.html +6 -6
  250. data/vendor/local/share/doc/groonga/en/html/index.html +15 -9
  251. data/vendor/local/share/doc/groonga/en/html/install.html +8 -7
  252. data/vendor/local/share/doc/groonga/en/html/install/centos.html +12 -12
  253. data/vendor/local/share/doc/groonga/en/html/install/debian.html +70 -13
  254. data/vendor/local/share/doc/groonga/en/html/install/fedora.html +10 -10
  255. data/vendor/local/share/doc/groonga/en/html/install/mac_os_x.html +9 -9
  256. data/vendor/local/share/doc/groonga/en/html/install/others.html +17 -17
  257. data/vendor/local/share/doc/groonga/en/html/install/solaris.html +9 -9
  258. data/vendor/local/share/doc/groonga/en/html/install/ubuntu.html +12 -11
  259. data/vendor/local/share/doc/groonga/en/html/install/windows.html +21 -21
  260. data/vendor/local/share/doc/groonga/en/html/limitations.html +6 -6
  261. data/vendor/local/share/doc/groonga/en/html/news.html +200 -103
  262. data/vendor/local/share/doc/groonga/en/html/news/0.x.html +10 -10
  263. data/vendor/local/share/doc/groonga/en/html/news/1.0.x.html +24 -24
  264. data/vendor/local/share/doc/groonga/en/html/news/1.1.x.html +8 -8
  265. data/vendor/local/share/doc/groonga/en/html/news/1.2.x.html +26 -26
  266. data/vendor/local/share/doc/groonga/en/html/news/1.3.x.html +8 -8
  267. data/vendor/local/share/doc/groonga/en/html/news/2.x.html +32 -32
  268. data/vendor/local/share/doc/groonga/en/html/news/3.x.html +32 -32
  269. data/vendor/local/share/doc/groonga/en/html/news/4.x.html +27 -27
  270. data/vendor/local/share/doc/groonga/en/html/news/senna.html +32 -32
  271. data/vendor/local/share/doc/groonga/en/html/objects.inv +0 -0
  272. data/vendor/local/share/doc/groonga/en/html/reference.html +8 -7
  273. data/vendor/local/share/doc/groonga/en/html/reference/api.html +6 -6
  274. data/vendor/local/share/doc/groonga/en/html/reference/api/global_configurations.html +6 -6
  275. data/vendor/local/share/doc/groonga/en/html/reference/api/grn_cache.html +6 -6
  276. data/vendor/local/share/doc/groonga/en/html/reference/api/grn_column.html +6 -6
  277. data/vendor/local/share/doc/groonga/en/html/reference/api/grn_command_version.html +6 -6
  278. data/vendor/local/share/doc/groonga/en/html/reference/api/grn_content_type.html +6 -6
  279. data/vendor/local/share/doc/groonga/en/html/reference/api/grn_ctx.html +6 -6
  280. data/vendor/local/share/doc/groonga/en/html/reference/api/grn_db.html +6 -6
  281. data/vendor/local/share/doc/groonga/en/html/reference/api/grn_encoding.html +6 -6
  282. data/vendor/local/share/doc/groonga/en/html/reference/api/grn_expr.html +6 -6
  283. data/vendor/local/share/doc/groonga/en/html/reference/api/grn_geo.html +6 -6
  284. data/vendor/local/share/doc/groonga/en/html/reference/api/grn_hook.html +6 -6
  285. data/vendor/local/share/doc/groonga/en/html/reference/api/grn_ii.html +6 -6
  286. data/vendor/local/share/doc/groonga/en/html/reference/api/grn_index_cursor.html +6 -6
  287. data/vendor/local/share/doc/groonga/en/html/reference/api/grn_info.html +6 -6
  288. data/vendor/local/share/doc/groonga/en/html/reference/api/grn_match_escalation.html +6 -6
  289. data/vendor/local/share/doc/groonga/en/html/reference/api/grn_obj.html +6 -6
  290. data/vendor/local/share/doc/groonga/en/html/reference/api/grn_proc.html +6 -6
  291. data/vendor/local/share/doc/groonga/en/html/reference/api/grn_search.html +6 -6
  292. data/vendor/local/share/doc/groonga/en/html/reference/api/grn_table.html +6 -6
  293. data/vendor/local/share/doc/groonga/en/html/reference/api/grn_table_cursor.html +6 -6
  294. data/vendor/local/share/doc/groonga/en/html/reference/api/grn_type.html +6 -6
  295. data/vendor/local/share/doc/groonga/en/html/reference/api/grn_user_data.html +6 -6
  296. data/vendor/local/share/doc/groonga/en/html/reference/api/overview.html +6 -6
  297. data/vendor/local/share/doc/groonga/en/html/reference/api/plugin.html +6 -6
  298. data/vendor/local/share/doc/groonga/en/html/reference/cast.html +6 -6
  299. data/vendor/local/share/doc/groonga/en/html/reference/column.html +6 -6
  300. data/vendor/local/share/doc/groonga/en/html/reference/columns/index.html +6 -6
  301. data/vendor/local/share/doc/groonga/en/html/reference/columns/pseudo.html +6 -6
  302. data/vendor/local/share/doc/groonga/en/html/reference/columns/scalar.html +6 -6
  303. data/vendor/local/share/doc/groonga/en/html/reference/columns/vector.html +6 -6
  304. data/vendor/local/share/doc/groonga/en/html/reference/command.html +6 -6
  305. data/vendor/local/share/doc/groonga/en/html/reference/command/command_version.html +6 -6
  306. data/vendor/local/share/doc/groonga/en/html/reference/command/output_format.html +6 -6
  307. data/vendor/local/share/doc/groonga/en/html/reference/command/request_id.html +6 -6
  308. data/vendor/local/share/doc/groonga/en/html/reference/command/return_code.html +6 -6
  309. data/vendor/local/share/doc/groonga/en/html/reference/commands/cache_limit.html +6 -6
  310. data/vendor/local/share/doc/groonga/en/html/reference/commands/check.html +6 -6
  311. data/vendor/local/share/doc/groonga/en/html/reference/commands/clearlock.html +6 -6
  312. data/vendor/local/share/doc/groonga/en/html/reference/commands/column_create.html +6 -6
  313. data/vendor/local/share/doc/groonga/en/html/reference/commands/column_list.html +6 -6
  314. data/vendor/local/share/doc/groonga/en/html/reference/commands/column_remove.html +6 -6
  315. data/vendor/local/share/doc/groonga/en/html/reference/commands/column_rename.html +6 -6
  316. data/vendor/local/share/doc/groonga/en/html/reference/commands/define_selector.html +6 -6
  317. data/vendor/local/share/doc/groonga/en/html/reference/commands/defrag.html +6 -6
  318. data/vendor/local/share/doc/groonga/en/html/reference/commands/delete.html +6 -6
  319. data/vendor/local/share/doc/groonga/en/html/reference/commands/dump.html +141 -34
  320. data/vendor/local/share/doc/groonga/en/html/reference/commands/load.html +6 -6
  321. data/vendor/local/share/doc/groonga/en/html/reference/commands/lock_clear.html +6 -6
  322. data/vendor/local/share/doc/groonga/en/html/reference/commands/log_level.html +6 -6
  323. data/vendor/local/share/doc/groonga/en/html/reference/commands/log_put.html +6 -6
  324. data/vendor/local/share/doc/groonga/en/html/reference/commands/log_reopen.html +6 -6
  325. data/vendor/local/share/doc/groonga/en/html/reference/commands/logical_count.html +6 -6
  326. data/vendor/local/share/doc/groonga/en/html/reference/commands/logical_range_filter.html +6 -6
  327. data/vendor/local/share/doc/groonga/en/html/reference/commands/normalize.html +6 -6
  328. data/vendor/local/share/doc/groonga/en/html/reference/commands/normalizer_list.html +6 -6
  329. data/vendor/local/share/doc/groonga/en/html/reference/commands/plugin_register.html +6 -6
  330. data/vendor/local/share/doc/groonga/en/html/reference/commands/plugin_unregister.html +6 -6
  331. data/vendor/local/share/doc/groonga/en/html/reference/commands/quit.html +6 -6
  332. data/vendor/local/share/doc/groonga/en/html/reference/commands/range_filter.html +6 -6
  333. data/vendor/local/share/doc/groonga/en/html/reference/commands/register.html +6 -6
  334. data/vendor/local/share/doc/groonga/en/html/reference/commands/request_cancel.html +8 -8
  335. data/vendor/local/share/doc/groonga/en/html/reference/commands/ruby_eval.html +6 -6
  336. data/vendor/local/share/doc/groonga/en/html/reference/commands/ruby_load.html +6 -6
  337. data/vendor/local/share/doc/groonga/en/html/reference/commands/select.html +6 -6
  338. data/vendor/local/share/doc/groonga/en/html/reference/commands/shutdown.html +6 -6
  339. data/vendor/local/share/doc/groonga/en/html/reference/commands/status.html +6 -6
  340. data/vendor/local/share/doc/groonga/en/html/reference/commands/suggest.html +6 -6
  341. data/vendor/local/share/doc/groonga/en/html/reference/commands/table_create.html +6 -6
  342. data/vendor/local/share/doc/groonga/en/html/reference/commands/table_list.html +6 -6
  343. data/vendor/local/share/doc/groonga/en/html/reference/commands/table_remove.html +6 -6
  344. data/vendor/local/share/doc/groonga/en/html/reference/commands/table_tokenize.html +6 -6
  345. data/vendor/local/share/doc/groonga/en/html/reference/commands/tokenize.html +6 -6
  346. data/vendor/local/share/doc/groonga/en/html/reference/commands/tokenizer_list.html +6 -6
  347. data/vendor/local/share/doc/groonga/en/html/reference/commands/truncate.html +6 -6
  348. data/vendor/local/share/doc/groonga/en/html/reference/executables.html +7 -7
  349. data/vendor/local/share/doc/groonga/en/html/reference/executables/grndb.html +6 -6
  350. data/vendor/local/share/doc/groonga/en/html/reference/executables/grnslap.html +10 -10
  351. data/vendor/local/share/doc/groonga/en/html/reference/executables/groonga-benchmark.html +10 -10
  352. data/vendor/local/share/doc/groonga/en/html/reference/executables/groonga-httpd.html +6 -6
  353. data/vendor/local/share/doc/groonga/en/html/reference/executables/groonga-server-http.html +6 -6
  354. data/vendor/local/share/doc/groonga/en/html/reference/executables/groonga-suggest-create-dataset.html +6 -6
  355. data/vendor/local/share/doc/groonga/en/html/reference/executables/groonga-suggest-httpd.html +6 -6
  356. data/vendor/local/share/doc/groonga/en/html/reference/executables/groonga-suggest-learner.html +6 -6
  357. data/vendor/local/share/doc/groonga/en/html/reference/executables/groonga.html +146 -14
  358. data/vendor/local/share/doc/groonga/en/html/reference/function.html +7 -6
  359. data/vendor/local/share/doc/groonga/en/html/reference/functions/between.html +6 -6
  360. data/vendor/local/share/doc/groonga/en/html/reference/functions/edit_distance.html +6 -6
  361. data/vendor/local/share/doc/groonga/en/html/reference/functions/geo_distance.html +6 -6
  362. data/vendor/local/share/doc/groonga/en/html/reference/functions/geo_in_circle.html +6 -6
  363. data/vendor/local/share/doc/groonga/en/html/reference/functions/geo_in_rectangle.html +6 -6
  364. data/vendor/local/share/doc/groonga/en/html/reference/functions/highlight_full.html +6 -6
  365. data/vendor/local/share/doc/groonga/en/html/reference/functions/highlight_html.html +6 -6
  366. data/vendor/local/share/doc/groonga/en/html/reference/functions/html_untag.html +6 -6
  367. data/vendor/local/share/doc/groonga/en/html/reference/functions/in_values.html +6 -6
  368. data/vendor/local/share/doc/groonga/en/html/reference/functions/now.html +6 -6
  369. data/vendor/local/share/doc/groonga/en/html/reference/functions/query.html +6 -6
  370. data/vendor/local/share/doc/groonga/en/html/reference/functions/rand.html +6 -6
  371. data/vendor/local/share/doc/groonga/en/html/reference/functions/snippet_html.html +6 -6
  372. data/vendor/local/share/doc/groonga/en/html/reference/functions/sub_filter.html +11 -11
  373. data/vendor/local/share/doc/groonga/en/html/reference/functions/vector_size.html +248 -0
  374. data/vendor/local/share/doc/groonga/en/html/reference/grn_expr.html +6 -6
  375. data/vendor/local/share/doc/groonga/en/html/reference/grn_expr/query_syntax.html +6 -6
  376. data/vendor/local/share/doc/groonga/en/html/reference/grn_expr/script_syntax.html +7 -7
  377. data/vendor/local/share/doc/groonga/en/html/reference/indexing.html +6 -6
  378. data/vendor/local/share/doc/groonga/en/html/reference/log.html +7 -7
  379. data/vendor/local/share/doc/groonga/en/html/reference/normalizers.html +6 -6
  380. data/vendor/local/share/doc/groonga/en/html/reference/operations.html +11 -11
  381. data/vendor/local/share/doc/groonga/en/html/reference/operations/geolocation_search.html +6 -6
  382. data/vendor/local/share/doc/groonga/en/html/reference/output.html +6 -6
  383. data/vendor/local/share/doc/groonga/en/html/reference/query_expanders.html +6 -6
  384. data/vendor/local/share/doc/groonga/en/html/reference/query_expanders/tsv.html +6 -6
  385. data/vendor/local/share/doc/groonga/en/html/reference/regular_expression.html +6 -6
  386. data/vendor/local/share/doc/groonga/en/html/reference/scorer.html +8 -7
  387. data/vendor/local/share/doc/groonga/en/html/reference/scorers/scorer_tf_at_most.html +6 -6
  388. data/vendor/local/share/doc/groonga/en/html/reference/scorers/scorer_tf_idf.html +6 -6
  389. data/vendor/local/share/doc/groonga/en/html/reference/scoring_note.html +6 -6
  390. data/vendor/local/share/doc/groonga/en/html/reference/suggest.html +6 -6
  391. data/vendor/local/share/doc/groonga/en/html/reference/suggest/completion.html +6 -6
  392. data/vendor/local/share/doc/groonga/en/html/reference/suggest/correction.html +6 -6
  393. data/vendor/local/share/doc/groonga/en/html/reference/suggest/introduction.html +6 -6
  394. data/vendor/local/share/doc/groonga/en/html/reference/suggest/suggestion.html +6 -6
  395. data/vendor/local/share/doc/groonga/en/html/reference/tables.html +6 -6
  396. data/vendor/local/share/doc/groonga/en/html/reference/token_filters.html +6 -6
  397. data/vendor/local/share/doc/groonga/en/html/reference/tokenizers.html +6 -6
  398. data/vendor/local/share/doc/groonga/en/html/reference/tuning.html +6 -6
  399. data/vendor/local/share/doc/groonga/en/html/reference/types.html +6 -6
  400. data/vendor/local/share/doc/groonga/en/html/search.html +6 -6
  401. data/vendor/local/share/doc/groonga/en/html/searchindex.js +1 -1
  402. data/vendor/local/share/doc/groonga/en/html/server.html +11 -7
  403. data/vendor/local/share/doc/groonga/en/html/server/gqtp.html +53 -8
  404. data/vendor/local/share/doc/groonga/en/html/server/http.html +6 -6
  405. data/vendor/local/share/doc/groonga/en/html/server/http/comparison.html +6 -6
  406. data/vendor/local/share/doc/groonga/en/html/server/http/groonga-httpd.html +6 -6
  407. data/vendor/local/share/doc/groonga/en/html/server/http/groonga.html +6 -6
  408. data/vendor/local/share/doc/groonga/en/html/server/memcached.html +6 -6
  409. data/vendor/local/share/doc/groonga/en/html/server/package.html +6 -6
  410. data/vendor/local/share/doc/groonga/en/html/spec.html +6 -6
  411. data/vendor/local/share/doc/groonga/en/html/spec/gqtp.html +10 -7
  412. data/vendor/local/share/doc/groonga/en/html/spec/search.html +6 -6
  413. data/vendor/local/share/doc/groonga/en/html/troubleshooting.html +6 -6
  414. data/vendor/local/share/doc/groonga/en/html/troubleshooting/different_results_with_the_same_keyword.html +6 -6
  415. data/vendor/local/share/doc/groonga/en/html/troubleshooting/mmap_cannot_allocate_memory.html +6 -6
  416. data/vendor/local/share/doc/groonga/en/html/tutorial.html +6 -6
  417. data/vendor/local/share/doc/groonga/en/html/tutorial/data.html +6 -6
  418. data/vendor/local/share/doc/groonga/en/html/tutorial/drilldown.html +6 -6
  419. data/vendor/local/share/doc/groonga/en/html/tutorial/index.html +15 -11
  420. data/vendor/local/share/doc/groonga/en/html/tutorial/introduction.html +7 -7
  421. data/vendor/local/share/doc/groonga/en/html/tutorial/lexicon.html +6 -6
  422. data/vendor/local/share/doc/groonga/en/html/tutorial/match_columns.html +6 -6
  423. data/vendor/local/share/doc/groonga/en/html/tutorial/micro_blog.html +6 -6
  424. data/vendor/local/share/doc/groonga/en/html/tutorial/network.html +6 -6
  425. data/vendor/local/share/doc/groonga/en/html/tutorial/patricia_trie.html +6 -6
  426. data/vendor/local/share/doc/groonga/en/html/tutorial/query_expansion.html +6 -6
  427. data/vendor/local/share/doc/groonga/en/html/tutorial/search.html +6 -6
  428. data/vendor/local/share/doc/groonga/ja/html/.buildinfo +1 -1
  429. data/vendor/local/share/doc/groonga/ja/html/_sources/contribution/development/release.txt +69 -52
  430. data/vendor/local/share/doc/groonga/ja/html/_sources/install/centos.txt +6 -6
  431. data/vendor/local/share/doc/groonga/ja/html/_sources/install/debian.txt +56 -5
  432. data/vendor/local/share/doc/groonga/ja/html/_sources/install/fedora.txt +4 -4
  433. data/vendor/local/share/doc/groonga/ja/html/_sources/install/mac_os_x.txt +3 -3
  434. data/vendor/local/share/doc/groonga/ja/html/_sources/install/others.txt +7 -7
  435. data/vendor/local/share/doc/groonga/ja/html/_sources/install/solaris.txt +3 -3
  436. data/vendor/local/share/doc/groonga/ja/html/_sources/install/ubuntu.txt +6 -5
  437. data/vendor/local/share/doc/groonga/ja/html/_sources/install/windows.txt +14 -14
  438. data/vendor/local/share/doc/groonga/ja/html/_sources/news.txt +93 -3
  439. data/vendor/local/share/doc/groonga/ja/html/_sources/news/0.x.txt +2 -2
  440. data/vendor/local/share/doc/groonga/ja/html/_sources/news/1.0.x.txt +9 -9
  441. data/vendor/local/share/doc/groonga/ja/html/_sources/news/1.1.x.txt +1 -1
  442. data/vendor/local/share/doc/groonga/ja/html/_sources/news/1.2.x.txt +10 -10
  443. data/vendor/local/share/doc/groonga/ja/html/_sources/news/1.3.x.txt +1 -1
  444. data/vendor/local/share/doc/groonga/ja/html/_sources/news/2.x.txt +13 -13
  445. data/vendor/local/share/doc/groonga/ja/html/_sources/news/3.x.txt +13 -13
  446. data/vendor/local/share/doc/groonga/ja/html/_sources/news/4.x.txt +9 -9
  447. data/vendor/local/share/doc/groonga/ja/html/_sources/news/senna.txt +13 -13
  448. data/vendor/local/share/doc/groonga/ja/html/_sources/reference/commands/dump.txt +135 -27
  449. data/vendor/local/share/doc/groonga/ja/html/_sources/reference/commands/request_cancel.txt +1 -1
  450. data/vendor/local/share/doc/groonga/ja/html/_sources/reference/executables/groonga.txt +148 -7
  451. data/vendor/local/share/doc/groonga/ja/html/_sources/reference/functions/vector_size.txt +76 -0
  452. data/vendor/local/share/doc/groonga/ja/html/_sources/reference/scorer.txt +2 -1
  453. data/vendor/local/share/doc/groonga/ja/html/_sources/server/gqtp.txt +38 -6
  454. data/vendor/local/share/doc/groonga/ja/html/_sources/spec/gqtp.txt +2 -1
  455. data/vendor/local/share/doc/groonga/ja/html/_sources/tutorial/index.txt +6 -4
  456. data/vendor/local/share/doc/groonga/ja/html/characteristic.html +6 -6
  457. data/vendor/local/share/doc/groonga/ja/html/client.html +6 -6
  458. data/vendor/local/share/doc/groonga/ja/html/community.html +6 -6
  459. data/vendor/local/share/doc/groonga/ja/html/contribution.html +14 -13
  460. data/vendor/local/share/doc/groonga/ja/html/contribution/development.html +6 -6
  461. data/vendor/local/share/doc/groonga/ja/html/contribution/development/com.html +6 -6
  462. data/vendor/local/share/doc/groonga/ja/html/contribution/development/cooperation.html +6 -6
  463. data/vendor/local/share/doc/groonga/ja/html/contribution/development/query.html +6 -6
  464. data/vendor/local/share/doc/groonga/ja/html/contribution/development/release.html +58 -42
  465. data/vendor/local/share/doc/groonga/ja/html/contribution/development/repository.html +6 -6
  466. data/vendor/local/share/doc/groonga/ja/html/contribution/development/test.html +6 -6
  467. data/vendor/local/share/doc/groonga/ja/html/contribution/documentation.html +6 -6
  468. data/vendor/local/share/doc/groonga/ja/html/contribution/documentation/c-api.html +6 -6
  469. data/vendor/local/share/doc/groonga/ja/html/contribution/documentation/i18n.html +6 -6
  470. data/vendor/local/share/doc/groonga/ja/html/contribution/documentation/introduction.html +6 -6
  471. data/vendor/local/share/doc/groonga/ja/html/contribution/report.html +6 -6
  472. data/vendor/local/share/doc/groonga/ja/html/development.html +6 -6
  473. data/vendor/local/share/doc/groonga/ja/html/development/travis-ci.html +6 -6
  474. data/vendor/local/share/doc/groonga/ja/html/genindex.html +6 -6
  475. data/vendor/local/share/doc/groonga/ja/html/index.html +15 -9
  476. data/vendor/local/share/doc/groonga/ja/html/install.html +8 -7
  477. data/vendor/local/share/doc/groonga/ja/html/install/centos.html +9 -9
  478. data/vendor/local/share/doc/groonga/ja/html/install/debian.html +63 -11
  479. data/vendor/local/share/doc/groonga/ja/html/install/fedora.html +9 -9
  480. data/vendor/local/share/doc/groonga/ja/html/install/mac_os_x.html +9 -9
  481. data/vendor/local/share/doc/groonga/ja/html/install/others.html +21 -18
  482. data/vendor/local/share/doc/groonga/ja/html/install/solaris.html +9 -9
  483. data/vendor/local/share/doc/groonga/ja/html/install/ubuntu.html +10 -9
  484. data/vendor/local/share/doc/groonga/ja/html/install/windows.html +20 -20
  485. data/vendor/local/share/doc/groonga/ja/html/limitations.html +6 -6
  486. data/vendor/local/share/doc/groonga/ja/html/news.html +234 -106
  487. data/vendor/local/share/doc/groonga/ja/html/news/0.x.html +10 -10
  488. data/vendor/local/share/doc/groonga/ja/html/news/1.0.x.html +24 -24
  489. data/vendor/local/share/doc/groonga/ja/html/news/1.1.x.html +8 -8
  490. data/vendor/local/share/doc/groonga/ja/html/news/1.2.x.html +26 -26
  491. data/vendor/local/share/doc/groonga/ja/html/news/1.3.x.html +8 -8
  492. data/vendor/local/share/doc/groonga/ja/html/news/2.x.html +32 -32
  493. data/vendor/local/share/doc/groonga/ja/html/news/3.x.html +32 -32
  494. data/vendor/local/share/doc/groonga/ja/html/news/4.x.html +27 -27
  495. data/vendor/local/share/doc/groonga/ja/html/news/senna.html +32 -32
  496. data/vendor/local/share/doc/groonga/ja/html/objects.inv +0 -0
  497. data/vendor/local/share/doc/groonga/ja/html/reference.html +8 -7
  498. data/vendor/local/share/doc/groonga/ja/html/reference/api.html +6 -6
  499. data/vendor/local/share/doc/groonga/ja/html/reference/api/global_configurations.html +6 -6
  500. data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_cache.html +6 -6
  501. data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_column.html +6 -6
  502. data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_command_version.html +6 -6
  503. data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_content_type.html +6 -6
  504. data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_ctx.html +6 -6
  505. data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_db.html +6 -6
  506. data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_encoding.html +6 -6
  507. data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_expr.html +6 -6
  508. data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_geo.html +6 -6
  509. data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_hook.html +6 -6
  510. data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_ii.html +6 -6
  511. data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_index_cursor.html +6 -6
  512. data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_info.html +6 -6
  513. data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_match_escalation.html +6 -6
  514. data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_obj.html +6 -6
  515. data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_proc.html +6 -6
  516. data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_search.html +6 -6
  517. data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_table.html +6 -6
  518. data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_table_cursor.html +6 -6
  519. data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_type.html +6 -6
  520. data/vendor/local/share/doc/groonga/ja/html/reference/api/grn_user_data.html +6 -6
  521. data/vendor/local/share/doc/groonga/ja/html/reference/api/overview.html +6 -6
  522. data/vendor/local/share/doc/groonga/ja/html/reference/api/plugin.html +6 -6
  523. data/vendor/local/share/doc/groonga/ja/html/reference/cast.html +6 -6
  524. data/vendor/local/share/doc/groonga/ja/html/reference/column.html +6 -6
  525. data/vendor/local/share/doc/groonga/ja/html/reference/columns/index.html +6 -6
  526. data/vendor/local/share/doc/groonga/ja/html/reference/columns/pseudo.html +6 -6
  527. data/vendor/local/share/doc/groonga/ja/html/reference/columns/scalar.html +6 -6
  528. data/vendor/local/share/doc/groonga/ja/html/reference/columns/vector.html +6 -6
  529. data/vendor/local/share/doc/groonga/ja/html/reference/command.html +6 -6
  530. data/vendor/local/share/doc/groonga/ja/html/reference/command/command_version.html +6 -6
  531. data/vendor/local/share/doc/groonga/ja/html/reference/command/output_format.html +6 -6
  532. data/vendor/local/share/doc/groonga/ja/html/reference/command/request_id.html +6 -6
  533. data/vendor/local/share/doc/groonga/ja/html/reference/command/return_code.html +6 -6
  534. data/vendor/local/share/doc/groonga/ja/html/reference/commands/cache_limit.html +6 -6
  535. data/vendor/local/share/doc/groonga/ja/html/reference/commands/check.html +6 -6
  536. data/vendor/local/share/doc/groonga/ja/html/reference/commands/clearlock.html +6 -6
  537. data/vendor/local/share/doc/groonga/ja/html/reference/commands/column_create.html +6 -6
  538. data/vendor/local/share/doc/groonga/ja/html/reference/commands/column_list.html +6 -6
  539. data/vendor/local/share/doc/groonga/ja/html/reference/commands/column_remove.html +6 -6
  540. data/vendor/local/share/doc/groonga/ja/html/reference/commands/column_rename.html +6 -6
  541. data/vendor/local/share/doc/groonga/ja/html/reference/commands/define_selector.html +6 -6
  542. data/vendor/local/share/doc/groonga/ja/html/reference/commands/defrag.html +6 -6
  543. data/vendor/local/share/doc/groonga/ja/html/reference/commands/delete.html +6 -6
  544. data/vendor/local/share/doc/groonga/ja/html/reference/commands/dump.html +141 -34
  545. data/vendor/local/share/doc/groonga/ja/html/reference/commands/load.html +6 -6
  546. data/vendor/local/share/doc/groonga/ja/html/reference/commands/lock_clear.html +6 -6
  547. data/vendor/local/share/doc/groonga/ja/html/reference/commands/log_level.html +6 -6
  548. data/vendor/local/share/doc/groonga/ja/html/reference/commands/log_put.html +6 -6
  549. data/vendor/local/share/doc/groonga/ja/html/reference/commands/log_reopen.html +6 -6
  550. data/vendor/local/share/doc/groonga/ja/html/reference/commands/logical_count.html +6 -6
  551. data/vendor/local/share/doc/groonga/ja/html/reference/commands/logical_range_filter.html +6 -6
  552. data/vendor/local/share/doc/groonga/ja/html/reference/commands/normalize.html +6 -6
  553. data/vendor/local/share/doc/groonga/ja/html/reference/commands/normalizer_list.html +6 -6
  554. data/vendor/local/share/doc/groonga/ja/html/reference/commands/plugin_register.html +6 -6
  555. data/vendor/local/share/doc/groonga/ja/html/reference/commands/plugin_unregister.html +6 -6
  556. data/vendor/local/share/doc/groonga/ja/html/reference/commands/quit.html +6 -6
  557. data/vendor/local/share/doc/groonga/ja/html/reference/commands/range_filter.html +6 -6
  558. data/vendor/local/share/doc/groonga/ja/html/reference/commands/register.html +6 -6
  559. data/vendor/local/share/doc/groonga/ja/html/reference/commands/request_cancel.html +25 -41
  560. data/vendor/local/share/doc/groonga/ja/html/reference/commands/ruby_eval.html +6 -6
  561. data/vendor/local/share/doc/groonga/ja/html/reference/commands/ruby_load.html +6 -6
  562. data/vendor/local/share/doc/groonga/ja/html/reference/commands/select.html +6 -6
  563. data/vendor/local/share/doc/groonga/ja/html/reference/commands/shutdown.html +6 -6
  564. data/vendor/local/share/doc/groonga/ja/html/reference/commands/status.html +6 -6
  565. data/vendor/local/share/doc/groonga/ja/html/reference/commands/suggest.html +6 -6
  566. data/vendor/local/share/doc/groonga/ja/html/reference/commands/table_create.html +6 -6
  567. data/vendor/local/share/doc/groonga/ja/html/reference/commands/table_list.html +6 -6
  568. data/vendor/local/share/doc/groonga/ja/html/reference/commands/table_remove.html +6 -6
  569. data/vendor/local/share/doc/groonga/ja/html/reference/commands/table_tokenize.html +6 -6
  570. data/vendor/local/share/doc/groonga/ja/html/reference/commands/tokenize.html +6 -6
  571. data/vendor/local/share/doc/groonga/ja/html/reference/commands/tokenizer_list.html +6 -6
  572. data/vendor/local/share/doc/groonga/ja/html/reference/commands/truncate.html +6 -6
  573. data/vendor/local/share/doc/groonga/ja/html/reference/executables.html +7 -7
  574. data/vendor/local/share/doc/groonga/ja/html/reference/executables/grndb.html +23 -29
  575. data/vendor/local/share/doc/groonga/ja/html/reference/executables/grnslap.html +10 -10
  576. data/vendor/local/share/doc/groonga/ja/html/reference/executables/groonga-benchmark.html +10 -10
  577. data/vendor/local/share/doc/groonga/ja/html/reference/executables/groonga-httpd.html +6 -6
  578. data/vendor/local/share/doc/groonga/ja/html/reference/executables/groonga-server-http.html +6 -6
  579. data/vendor/local/share/doc/groonga/ja/html/reference/executables/groonga-suggest-create-dataset.html +6 -6
  580. data/vendor/local/share/doc/groonga/ja/html/reference/executables/groonga-suggest-httpd.html +6 -6
  581. data/vendor/local/share/doc/groonga/ja/html/reference/executables/groonga-suggest-learner.html +6 -6
  582. data/vendor/local/share/doc/groonga/ja/html/reference/executables/groonga.html +146 -14
  583. data/vendor/local/share/doc/groonga/ja/html/reference/function.html +7 -6
  584. data/vendor/local/share/doc/groonga/ja/html/reference/functions/between.html +6 -6
  585. data/vendor/local/share/doc/groonga/ja/html/reference/functions/edit_distance.html +6 -6
  586. data/vendor/local/share/doc/groonga/ja/html/reference/functions/geo_distance.html +6 -6
  587. data/vendor/local/share/doc/groonga/ja/html/reference/functions/geo_in_circle.html +6 -6
  588. data/vendor/local/share/doc/groonga/ja/html/reference/functions/geo_in_rectangle.html +6 -6
  589. data/vendor/local/share/doc/groonga/ja/html/reference/functions/highlight_full.html +6 -6
  590. data/vendor/local/share/doc/groonga/ja/html/reference/functions/highlight_html.html +6 -6
  591. data/vendor/local/share/doc/groonga/ja/html/reference/functions/html_untag.html +6 -6
  592. data/vendor/local/share/doc/groonga/ja/html/reference/functions/in_values.html +6 -6
  593. data/vendor/local/share/doc/groonga/ja/html/reference/functions/now.html +6 -6
  594. data/vendor/local/share/doc/groonga/ja/html/reference/functions/query.html +6 -6
  595. data/vendor/local/share/doc/groonga/ja/html/reference/functions/rand.html +6 -6
  596. data/vendor/local/share/doc/groonga/ja/html/reference/functions/snippet_html.html +6 -6
  597. data/vendor/local/share/doc/groonga/ja/html/reference/functions/sub_filter.html +11 -11
  598. data/vendor/local/share/doc/groonga/ja/html/reference/functions/vector_size.html +249 -0
  599. data/vendor/local/share/doc/groonga/ja/html/reference/grn_expr.html +6 -6
  600. data/vendor/local/share/doc/groonga/ja/html/reference/grn_expr/query_syntax.html +6 -6
  601. data/vendor/local/share/doc/groonga/ja/html/reference/grn_expr/script_syntax.html +7 -7
  602. data/vendor/local/share/doc/groonga/ja/html/reference/indexing.html +6 -6
  603. data/vendor/local/share/doc/groonga/ja/html/reference/log.html +7 -7
  604. data/vendor/local/share/doc/groonga/ja/html/reference/normalizers.html +6 -6
  605. data/vendor/local/share/doc/groonga/ja/html/reference/operations.html +11 -11
  606. data/vendor/local/share/doc/groonga/ja/html/reference/operations/geolocation_search.html +6 -6
  607. data/vendor/local/share/doc/groonga/ja/html/reference/output.html +6 -6
  608. data/vendor/local/share/doc/groonga/ja/html/reference/query_expanders.html +6 -6
  609. data/vendor/local/share/doc/groonga/ja/html/reference/query_expanders/tsv.html +6 -6
  610. data/vendor/local/share/doc/groonga/ja/html/reference/regular_expression.html +6 -6
  611. data/vendor/local/share/doc/groonga/ja/html/reference/scorer.html +7 -7
  612. data/vendor/local/share/doc/groonga/ja/html/reference/scorers/scorer_tf_at_most.html +6 -6
  613. data/vendor/local/share/doc/groonga/ja/html/reference/scorers/scorer_tf_idf.html +6 -6
  614. data/vendor/local/share/doc/groonga/ja/html/reference/scoring_note.html +6 -6
  615. data/vendor/local/share/doc/groonga/ja/html/reference/suggest.html +6 -6
  616. data/vendor/local/share/doc/groonga/ja/html/reference/suggest/completion.html +6 -6
  617. data/vendor/local/share/doc/groonga/ja/html/reference/suggest/correction.html +6 -6
  618. data/vendor/local/share/doc/groonga/ja/html/reference/suggest/introduction.html +6 -6
  619. data/vendor/local/share/doc/groonga/ja/html/reference/suggest/suggestion.html +6 -6
  620. data/vendor/local/share/doc/groonga/ja/html/reference/tables.html +6 -6
  621. data/vendor/local/share/doc/groonga/ja/html/reference/token_filters.html +6 -6
  622. data/vendor/local/share/doc/groonga/ja/html/reference/tokenizers.html +6 -6
  623. data/vendor/local/share/doc/groonga/ja/html/reference/tuning.html +6 -6
  624. data/vendor/local/share/doc/groonga/ja/html/reference/types.html +6 -6
  625. data/vendor/local/share/doc/groonga/ja/html/search.html +6 -6
  626. data/vendor/local/share/doc/groonga/ja/html/searchindex.js +1 -1
  627. data/vendor/local/share/doc/groonga/ja/html/server.html +11 -7
  628. data/vendor/local/share/doc/groonga/ja/html/server/gqtp.html +53 -8
  629. data/vendor/local/share/doc/groonga/ja/html/server/http.html +6 -6
  630. data/vendor/local/share/doc/groonga/ja/html/server/http/comparison.html +6 -6
  631. data/vendor/local/share/doc/groonga/ja/html/server/http/groonga-httpd.html +6 -6
  632. data/vendor/local/share/doc/groonga/ja/html/server/http/groonga.html +6 -6
  633. data/vendor/local/share/doc/groonga/ja/html/server/memcached.html +6 -6
  634. data/vendor/local/share/doc/groonga/ja/html/server/package.html +6 -6
  635. data/vendor/local/share/doc/groonga/ja/html/spec.html +6 -6
  636. data/vendor/local/share/doc/groonga/ja/html/spec/gqtp.html +10 -7
  637. data/vendor/local/share/doc/groonga/ja/html/spec/search.html +6 -6
  638. data/vendor/local/share/doc/groonga/ja/html/troubleshooting.html +6 -6
  639. data/vendor/local/share/doc/groonga/ja/html/troubleshooting/different_results_with_the_same_keyword.html +6 -6
  640. data/vendor/local/share/doc/groonga/ja/html/troubleshooting/mmap_cannot_allocate_memory.html +6 -6
  641. data/vendor/local/share/doc/groonga/ja/html/tutorial.html +6 -6
  642. data/vendor/local/share/doc/groonga/ja/html/tutorial/data.html +6 -6
  643. data/vendor/local/share/doc/groonga/ja/html/tutorial/drilldown.html +6 -6
  644. data/vendor/local/share/doc/groonga/ja/html/tutorial/index.html +15 -11
  645. data/vendor/local/share/doc/groonga/ja/html/tutorial/introduction.html +7 -7
  646. data/vendor/local/share/doc/groonga/ja/html/tutorial/lexicon.html +6 -6
  647. data/vendor/local/share/doc/groonga/ja/html/tutorial/match_columns.html +6 -6
  648. data/vendor/local/share/doc/groonga/ja/html/tutorial/micro_blog.html +6 -6
  649. data/vendor/local/share/doc/groonga/ja/html/tutorial/network.html +6 -6
  650. data/vendor/local/share/doc/groonga/ja/html/tutorial/patricia_trie.html +6 -6
  651. data/vendor/local/share/doc/groonga/ja/html/tutorial/query_expansion.html +6 -6
  652. data/vendor/local/share/doc/groonga/ja/html/tutorial/search.html +6 -6
  653. data/vendor/local/share/groonga/html/{admin → admin.old}/css/groonga-admin.css +0 -0
  654. data/vendor/local/share/groonga/html/{admin → admin.old}/css/redmond/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  655. data/vendor/local/share/groonga/html/{admin → admin.old}/css/redmond/images/ui-bg_flat_55_fbec88_40x100.png +0 -0
  656. data/vendor/local/share/groonga/html/{admin → admin.old}/css/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
  657. data/vendor/local/share/groonga/html/{admin → admin.old}/css/redmond/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
  658. data/vendor/local/share/groonga/html/{admin → admin.old}/css/redmond/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  659. data/vendor/local/share/groonga/html/{admin → admin.old}/css/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
  660. data/vendor/local/share/groonga/html/{admin → admin.old}/css/redmond/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
  661. data/vendor/local/share/groonga/html/{admin → admin.old}/css/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
  662. data/vendor/local/share/groonga/html/{admin → admin.old}/css/redmond/images/ui-icons_217bc0_256x240.png +0 -0
  663. data/vendor/local/share/groonga/html/{admin → admin.old}/css/redmond/images/ui-icons_2e83ff_256x240.png +0 -0
  664. data/vendor/local/share/groonga/html/{admin → admin.old}/css/redmond/images/ui-icons_469bdd_256x240.png +0 -0
  665. data/vendor/local/share/groonga/html/{admin → admin.old}/css/redmond/images/ui-icons_6da8d5_256x240.png +0 -0
  666. data/vendor/local/share/groonga/html/{admin → admin.old}/css/redmond/images/ui-icons_cd0a0a_256x240.png +0 -0
  667. data/vendor/local/share/groonga/html/{admin → admin.old}/css/redmond/images/ui-icons_d8e7f3_256x240.png +0 -0
  668. data/vendor/local/share/groonga/html/{admin → admin.old}/css/redmond/images/ui-icons_f9bd01_256x240.png +0 -0
  669. data/vendor/local/share/groonga/html/{admin → admin.old}/css/redmond/jquery-ui-1.8.18.custom.css +0 -0
  670. data/vendor/local/share/groonga/html/admin.old/favicon.ico +0 -0
  671. data/vendor/local/share/groonga/html/admin.old/favicon.png +0 -0
  672. data/vendor/local/share/groonga/html/{admin → admin.old}/favicon.svg +0 -0
  673. data/vendor/local/share/groonga/html/{admin → admin.old}/images/groonga.png +0 -0
  674. data/vendor/local/share/groonga/html/{admin → admin.old}/images/groonga.svg +0 -0
  675. data/vendor/local/share/groonga/html/{admin → admin.old}/images/loading.gif +0 -0
  676. data/vendor/local/share/groonga/html/admin.old/index.html +297 -0
  677. data/vendor/local/share/groonga/html/{admin → admin.old}/index.ja.html +0 -0
  678. data/vendor/local/share/groonga/html/{admin → admin.old}/js/groonga-admin.ja.js +0 -0
  679. data/vendor/local/share/groonga/html/{admin → admin.old}/js/groonga-admin.js +0 -0
  680. data/vendor/local/share/groonga/html/{admin → admin.old}/js/jquery-1.7.2.js +0 -0
  681. data/vendor/local/share/groonga/html/{admin → admin.old}/js/jquery-ui-1.8.18.custom.js +0 -0
  682. data/vendor/local/share/groonga/html/{admin → admin.old}/js/jquery.flot-0.7.js +0 -0
  683. data/vendor/local/share/groonga/html/{admin → admin.old}/js/jquery.flot.license.txt +0 -0
  684. data/vendor/local/share/groonga/html/admin/.htaccess +543 -0
  685. data/vendor/local/share/groonga/html/admin/404.html +133 -0
  686. data/vendor/local/share/groonga/html/admin/bower_components/bootstrap-sass-official/assets/fonts/bootstrap/glyphicons-halflings-regular.eot +0 -0
  687. data/vendor/local/share/groonga/html/admin/bower_components/bootstrap-sass-official/assets/fonts/bootstrap/glyphicons-halflings-regular.svg +229 -0
  688. data/vendor/local/share/groonga/html/admin/bower_components/bootstrap-sass-official/assets/fonts/bootstrap/glyphicons-halflings-regular.ttf +0 -0
  689. data/vendor/local/share/groonga/html/admin/bower_components/bootstrap-sass-official/assets/fonts/bootstrap/glyphicons-halflings-regular.woff +0 -0
  690. data/vendor/local/share/groonga/html/admin/images/yeoman.d2754b85.png +0 -0
  691. data/vendor/local/share/groonga/html/admin/index.html +9 -297
  692. data/vendor/local/share/groonga/html/admin/robots.txt +3 -0
  693. data/vendor/local/share/groonga/html/admin/scripts/oldieshim.a466b7b1.js +1 -0
  694. data/vendor/local/share/groonga/html/admin/scripts/scripts.87083bfd.js +1 -0
  695. data/vendor/local/share/groonga/html/admin/scripts/vendor.fa48c0ac.js +13 -0
  696. data/vendor/local/share/groonga/html/admin/styles/main.0390285b.css +1 -0
  697. data/vendor/local/share/groonga/html/admin/styles/vendor.f4ae649a.css +10 -0
  698. data/vendor/local/share/groonga/html/admin/views/columns/new.html +1 -0
  699. data/vendor/local/share/groonga/html/admin/views/columns/show.html +1 -0
  700. data/vendor/local/share/groonga/html/admin/views/tables/index.html +1 -0
  701. data/vendor/local/share/groonga/html/admin/views/tables/new.html +29 -0
  702. data/vendor/local/share/groonga/html/admin/views/tables/search.html +1 -0
  703. data/vendor/local/share/groonga/html/admin/views/tables/show.html +1 -0
  704. data/vendor/local/share/groonga/html/admin/views/top.html +1 -0
  705. data/vendor/local/share/license/groonga-admin/LICENSE +502 -0
  706. data/vendor/local/share/license/groonga-admin/README.md +79 -0
  707. data/vendor/local/share/license/msgpack/AUTHORS +0 -1
  708. data/vendor/local/share/man/ja/man1/groonga.1 +826 -147
  709. data/vendor/local/share/man/man1/groonga.1 +812 -99
  710. metadata +138 -55
  711. data/doc/text/install.textile +0 -145
  712. data/doc/text/tutorial.textile +0 -510
  713. data/vendor/local/bin/libmsgpack-3.dll +0 -0
  714. data/vendor/local/include/msgpack/type/define.hpp +0 -3465
  715. data/vendor/local/include/msgpack/type/deque.hpp +0 -77
  716. data/vendor/local/include/msgpack/type/fixint.hpp +0 -172
  717. data/vendor/local/include/msgpack/type/float.hpp +0 -102
  718. data/vendor/local/include/msgpack/type/int.hpp +0 -276
  719. data/vendor/local/include/msgpack/type/list.hpp +0 -77
  720. data/vendor/local/include/msgpack/type/map.hpp +0 -205
  721. data/vendor/local/include/msgpack/type/raw.hpp +0 -94
  722. data/vendor/local/include/msgpack/type/set.hpp +0 -122
  723. data/vendor/local/include/msgpack/type/string.hpp +0 -62
  724. data/vendor/local/include/msgpack/type/tr1/unordered_map.hpp +0 -150
  725. data/vendor/local/include/msgpack/type/tr1/unordered_set.hpp +0 -142
  726. data/vendor/local/include/msgpack/type/tuple.hpp +0 -13691
  727. data/vendor/local/include/msgpack/type/vector.hpp +0 -81
  728. data/vendor/local/share/doc/groonga/en/html/_static/jp.png +0 -0
  729. data/vendor/local/share/doc/groonga/en/html/_static/us.png +0 -0
  730. data/vendor/local/share/doc/groonga/ja/html/_static/jp.png +0 -0
  731. data/vendor/local/share/doc/groonga/ja/html/_static/us.png +0 -0
@@ -1,17 +1,35 @@
1
- #include "type/bool.hpp"
2
- #include "type/deque.hpp"
3
- #include "type/fixint.hpp"
4
- #include "type/float.hpp"
5
- #include "type/int.hpp"
6
- #include "type/list.hpp"
7
- #include "type/map.hpp"
8
- #include "type/nil.hpp"
9
- #include "type/pair.hpp"
10
- #include "type/raw.hpp"
11
- #include "type/set.hpp"
12
- #include "type/string.hpp"
13
- #include "type/vector.hpp"
14
- #include "type/tuple.hpp"
15
- #include "type/define.hpp"
16
- #include "type/tr1/unordered_map.hpp"
17
- #include "type/tr1/unordered_set.hpp"
1
+ #include "cpp_config.hpp"
2
+ #include "adaptor/bool.hpp"
3
+ #include "adaptor/char_ptr.hpp"
4
+ #include "adaptor/deque.hpp"
5
+ #include "adaptor/fixint.hpp"
6
+ #include "adaptor/float.hpp"
7
+ #include "adaptor/int.hpp"
8
+ #include "adaptor/list.hpp"
9
+ #include "adaptor/map.hpp"
10
+ #include "adaptor/nil.hpp"
11
+ #include "adaptor/pair.hpp"
12
+ #include "adaptor/raw.hpp"
13
+ #include "adaptor/set.hpp"
14
+ #include "adaptor/string.hpp"
15
+ #include "adaptor/vector.hpp"
16
+ #include "adaptor/vector_bool.hpp"
17
+ #include "adaptor/vector_char.hpp"
18
+ #include "adaptor/msgpack_tuple.hpp"
19
+ #include "adaptor/define.hpp"
20
+
21
+ #if defined(MSGPACK_USE_CPP03)
22
+
23
+ #include "adaptor/tr1/unordered_map.hpp"
24
+ #include "adaptor/tr1/unordered_set.hpp"
25
+
26
+ #else // defined(MSGPACK_USE_CPP03)
27
+
28
+ #include "adaptor/cpp11/array.hpp"
29
+ #include "adaptor/cpp11/array_char.hpp"
30
+ #include "adaptor/cpp11/forward_list.hpp"
31
+ #include "adaptor/cpp11/tuple.hpp"
32
+ #include "adaptor/cpp11/unordered_map.hpp"
33
+ #include "adaptor/cpp11/unordered_set.hpp"
34
+
35
+ #endif // defined(MSGPACK_USE_CPP03)
@@ -15,8 +15,8 @@
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */
18
- #ifndef MSGPACK_UNPACKER_H__
19
- #define MSGPACK_UNPACKER_H__
18
+ #ifndef MSGPACK_UNPACKER_H
19
+ #define MSGPACK_UNPACKER_H
20
20
 
21
21
  #include "zone.h"
22
22
  #include "object.h"
@@ -34,12 +34,23 @@ extern "C" {
34
34
  */
35
35
 
36
36
  typedef struct msgpack_unpacked {
37
- msgpack_zone* zone;
38
- msgpack_object data;
37
+ msgpack_zone* zone;
38
+ msgpack_object data;
39
39
  } msgpack_unpacked;
40
40
 
41
- bool msgpack_unpack_next(msgpack_unpacked* result,
42
- const char* data, size_t len, size_t* off);
41
+ typedef enum {
42
+ MSGPACK_UNPACK_SUCCESS = 2,
43
+ MSGPACK_UNPACK_EXTRA_BYTES = 1,
44
+ MSGPACK_UNPACK_CONTINUE = 0,
45
+ MSGPACK_UNPACK_PARSE_ERROR = -1,
46
+ MSGPACK_UNPACK_NOMEM_ERROR = -2
47
+ } msgpack_unpack_return;
48
+
49
+
50
+ MSGPACK_DLLEXPORT
51
+ msgpack_unpack_return
52
+ msgpack_unpack_next(msgpack_unpacked* result,
53
+ const char* data, size_t len, size_t* off);
43
54
 
44
55
  /** @} */
45
56
 
@@ -51,14 +62,14 @@ bool msgpack_unpack_next(msgpack_unpacked* result,
51
62
  */
52
63
 
53
64
  typedef struct msgpack_unpacker {
54
- char* buffer;
55
- size_t used;
56
- size_t free;
57
- size_t off;
58
- size_t parsed;
59
- msgpack_zone* z;
60
- size_t initial_buffer_size;
61
- void* ctx;
65
+ char* buffer;
66
+ size_t used;
67
+ size_t free;
68
+ size_t off;
69
+ size_t parsed;
70
+ msgpack_zone* z;
71
+ size_t initial_buffer_size;
72
+ void* ctx;
62
73
  } msgpack_unpacker;
63
74
 
64
75
 
@@ -70,11 +81,13 @@ typedef struct msgpack_unpacker {
70
81
  * Initializes a streaming deserializer.
71
82
  * The initialized deserializer must be destroyed by msgpack_unpacker_destroy(msgpack_unpacker*).
72
83
  */
84
+ MSGPACK_DLLEXPORT
73
85
  bool msgpack_unpacker_init(msgpack_unpacker* mpac, size_t initial_buffer_size);
74
86
 
75
87
  /**
76
88
  * Destroys a streaming deserializer initialized by msgpack_unpacker_init(msgpack_unpacker*, size_t).
77
89
  */
90
+ MSGPACK_DLLEXPORT
78
91
  void msgpack_unpacker_destroy(msgpack_unpacker* mpac);
79
92
 
80
93
 
@@ -82,11 +95,13 @@ void msgpack_unpacker_destroy(msgpack_unpacker* mpac);
82
95
  * Creates a streaming deserializer.
83
96
  * The created deserializer must be destroyed by msgpack_unpacker_free(msgpack_unpacker*).
84
97
  */
98
+ MSGPACK_DLLEXPORT
85
99
  msgpack_unpacker* msgpack_unpacker_new(size_t initial_buffer_size);
86
100
 
87
101
  /**
88
102
  * Frees a streaming deserializer created by msgpack_unpacker_new(size_t).
89
103
  */
104
+ MSGPACK_DLLEXPORT
90
105
  void msgpack_unpacker_free(msgpack_unpacker* mpac);
91
106
 
92
107
 
@@ -136,7 +151,8 @@ static inline void msgpack_unpacker_buffer_consumed(msgpack_unpacker* mpac, si
136
151
  * Returns true if it successes. Otherwise false is returned.
137
152
  * @param pac pointer to an initialized msgpack_unpacked object.
138
153
  */
139
- bool msgpack_unpacker_next(msgpack_unpacker* mpac, msgpack_unpacked* pac);
154
+ MSGPACK_DLLEXPORT
155
+ msgpack_unpack_return msgpack_unpacker_next(msgpack_unpacker* mpac, msgpack_unpacked* pac);
140
156
 
141
157
  /**
142
158
  * Initializes a msgpack_unpacked object.
@@ -158,14 +174,19 @@ static inline void msgpack_unpacked_destroy(msgpack_unpacked* result);
158
174
  static inline msgpack_zone* msgpack_unpacked_release_zone(msgpack_unpacked* result);
159
175
 
160
176
 
177
+ MSGPACK_DLLEXPORT
161
178
  int msgpack_unpacker_execute(msgpack_unpacker* mpac);
162
179
 
180
+ MSGPACK_DLLEXPORT
163
181
  msgpack_object msgpack_unpacker_data(msgpack_unpacker* mpac);
164
182
 
183
+ MSGPACK_DLLEXPORT
165
184
  msgpack_zone* msgpack_unpacker_release_zone(msgpack_unpacker* mpac);
166
185
 
186
+ MSGPACK_DLLEXPORT
167
187
  void msgpack_unpacker_reset_zone(msgpack_unpacker* mpac);
168
188
 
189
+ MSGPACK_DLLEXPORT
169
190
  void msgpack_unpacker_reset(msgpack_unpacker* mpac);
170
191
 
171
192
  static inline size_t msgpack_unpacker_message_size(const msgpack_unpacker* mpac);
@@ -175,80 +196,77 @@ static inline size_t msgpack_unpacker_message_size(const msgpack_unpacker* mpac)
175
196
 
176
197
 
177
198
  // obsolete
178
- typedef enum {
179
- MSGPACK_UNPACK_SUCCESS = 2,
180
- MSGPACK_UNPACK_EXTRA_BYTES = 1,
181
- MSGPACK_UNPACK_CONTINUE = 0,
182
- MSGPACK_UNPACK_PARSE_ERROR = -1,
183
- } msgpack_unpack_return;
184
-
185
- // obsolete
199
+ MSGPACK_DLLEXPORT
186
200
  msgpack_unpack_return
187
201
  msgpack_unpack(const char* data, size_t len, size_t* off,
188
- msgpack_zone* result_zone, msgpack_object* result);
202
+ msgpack_zone* result_zone, msgpack_object* result);
203
+
204
+
189
205
 
190
206
 
191
207
  static inline size_t msgpack_unpacker_parsed_size(const msgpack_unpacker* mpac);
192
208
 
209
+ MSGPACK_DLLEXPORT
193
210
  bool msgpack_unpacker_flush_zone(msgpack_unpacker* mpac);
194
211
 
212
+ MSGPACK_DLLEXPORT
195
213
  bool msgpack_unpacker_expand_buffer(msgpack_unpacker* mpac, size_t size);
196
214
 
197
215
  static inline bool msgpack_unpacker_reserve_buffer(msgpack_unpacker* mpac, size_t size)
198
216
  {
199
- if(mpac->free >= size) { return true; }
200
- return msgpack_unpacker_expand_buffer(mpac, size);
217
+ if(mpac->free >= size) { return true; }
218
+ return msgpack_unpacker_expand_buffer(mpac, size);
201
219
  }
202
220
 
203
221
  static inline char* msgpack_unpacker_buffer(msgpack_unpacker* mpac)
204
222
  {
205
- return mpac->buffer + mpac->used;
223
+ return mpac->buffer + mpac->used;
206
224
  }
207
225
 
208
226
  static inline size_t msgpack_unpacker_buffer_capacity(const msgpack_unpacker* mpac)
209
227
  {
210
- return mpac->free;
228
+ return mpac->free;
211
229
  }
212
230
 
213
231
  static inline void msgpack_unpacker_buffer_consumed(msgpack_unpacker* mpac, size_t size)
214
232
  {
215
- mpac->used += size;
216
- mpac->free -= size;
233
+ mpac->used += size;
234
+ mpac->free -= size;
217
235
  }
218
236
 
219
237
  static inline size_t msgpack_unpacker_message_size(const msgpack_unpacker* mpac)
220
238
  {
221
- return mpac->parsed - mpac->off + mpac->used;
239
+ return mpac->parsed - mpac->off + mpac->used;
222
240
  }
223
241
 
224
242
  static inline size_t msgpack_unpacker_parsed_size(const msgpack_unpacker* mpac)
225
243
  {
226
- return mpac->parsed;
244
+ return mpac->parsed;
227
245
  }
228
246
 
229
247
 
230
248
  static inline void msgpack_unpacked_init(msgpack_unpacked* result)
231
249
  {
232
- memset(result, 0, sizeof(msgpack_unpacked));
250
+ memset(result, 0, sizeof(msgpack_unpacked));
233
251
  }
234
252
 
235
253
  static inline void msgpack_unpacked_destroy(msgpack_unpacked* result)
236
254
  {
237
- if(result->zone != NULL) {
238
- msgpack_zone_free(result->zone);
239
- result->zone = NULL;
240
- memset(&result->data, 0, sizeof(msgpack_object));
241
- }
255
+ if(result->zone != NULL) {
256
+ msgpack_zone_free(result->zone);
257
+ result->zone = NULL;
258
+ memset(&result->data, 0, sizeof(msgpack_object));
259
+ }
242
260
  }
243
261
 
244
262
  static inline msgpack_zone* msgpack_unpacked_release_zone(msgpack_unpacked* result)
245
263
  {
246
- if(result->zone != NULL) {
247
- msgpack_zone* z = result->zone;
248
- result->zone = NULL;
249
- return z;
250
- }
251
- return NULL;
264
+ if(result->zone != NULL) {
265
+ msgpack_zone* z = result->zone;
266
+ result->zone = NULL;
267
+ return z;
268
+ }
269
+ return NULL;
252
270
  }
253
271
 
254
272
 
@@ -1,7 +1,7 @@
1
1
  //
2
2
  // MessagePack for C++ deserializing routine
3
3
  //
4
- // Copyright (C) 2008-2009 FURUHASHI Sadayuki
4
+ // Copyright (C) 2008-2015 FURUHASHI Sadayuki and KONDO Takatoshi
5
5
  //
6
6
  // Licensed under the Apache License, Version 2.0 (the "License");
7
7
  // you may not use this file except in compliance with the License.
@@ -15,360 +15,1721 @@
15
15
  // See the License for the specific language governing permissions and
16
16
  // limitations under the License.
17
17
  //
18
- #ifndef MSGPACK_UNPACK_HPP__
19
- #define MSGPACK_UNPACK_HPP__
18
+ #ifndef MSGPACK_UNPACK_HPP
19
+ #define MSGPACK_UNPACK_HPP
20
20
 
21
- #include "unpack.h"
21
+ #include "msgpack/versioning.hpp"
22
22
  #include "object.hpp"
23
23
  #include "zone.hpp"
24
+ #include "unpack_define.h"
25
+ #include "cpp_config.hpp"
26
+ #include "sysdep.h"
27
+
24
28
  #include <memory>
25
29
  #include <stdexcept>
26
30
 
31
+ #if !defined(MSGPACK_USE_CPP03)
32
+ #include <atomic>
33
+ #endif
34
+
35
+
36
+ #if defined(_MSC_VER)
37
+ // avoiding confliction std::max, std::min, and macro in windows.h
38
+ #ifndef NOMINMAX
39
+ #define NOMINMAX
40
+ #endif
41
+ #endif // defined(_MSC_VER)
42
+
43
+ #ifdef _msgpack_atomic_counter_header
44
+ #include _msgpack_atomic_counter_header
45
+ #endif
46
+
47
+
48
+ const size_t COUNTER_SIZE = sizeof(_msgpack_atomic_counter_t);
49
+
50
+ #ifndef MSGPACK_UNPACKER_INIT_BUFFER_SIZE
51
+ #define MSGPACK_UNPACKER_INIT_BUFFER_SIZE (64*1024)
52
+ #endif
53
+
54
+ #ifndef MSGPACK_UNPACKER_RESERVE_SIZE
55
+ #define MSGPACK_UNPACKER_RESERVE_SIZE (32*1024)
56
+ #endif
57
+
58
+
27
59
  // backward compatibility
28
60
  #ifndef MSGPACK_UNPACKER_DEFAULT_INITIAL_BUFFER_SIZE
29
61
  #define MSGPACK_UNPACKER_DEFAULT_INITIAL_BUFFER_SIZE MSGPACK_UNPACKER_INIT_BUFFER_SIZE
30
62
  #endif
31
63
 
64
+
32
65
  namespace msgpack {
33
66
 
67
+ MSGPACK_API_VERSION_NAMESPACE(v1) {
68
+
69
+ typedef bool (*unpack_reference_func)(msgpack::type::object_type, std::size_t, void*);
34
70
 
35
71
  struct unpack_error : public std::runtime_error {
36
- unpack_error(const std::string& msg) :
37
- std::runtime_error(msg) { }
72
+ explicit unpack_error(const std::string& msg)
73
+ :std::runtime_error(msg) {}
74
+ #if !defined(MSGPACK_USE_CPP03)
75
+ explicit unpack_error(const char* msg):
76
+ std::runtime_error(msg) {}
77
+ #endif // !defined(MSGPACK_USE_CPP03)
78
+ };
79
+
80
+ struct parse_error : public unpack_error {
81
+ explicit parse_error(const std::string& msg)
82
+ :unpack_error(msg) {}
83
+ #if !defined(MSGPACK_USE_CPP03)
84
+ explicit parse_error(const char* msg)
85
+ :unpack_error(msg) {}
86
+ #endif // !defined(MSGPACK_USE_CPP03)
87
+ };
88
+
89
+ struct insufficient_bytes : public unpack_error {
90
+ explicit insufficient_bytes(const std::string& msg)
91
+ :unpack_error(msg) {}
92
+ #if !defined(MSGPACK_USE_CPP03)
93
+ explicit insufficient_bytes(const char* msg)
94
+ :unpack_error(msg) {}
95
+ #endif // !defined(MSGPACK_USE_CPP03)
96
+ };
97
+
98
+ struct size_overflow : public unpack_error {
99
+ explicit size_overflow(const std::string& msg)
100
+ :unpack_error(msg) {}
101
+ #if !defined(MSGPACK_USE_CPP03)
102
+ explicit size_overflow(const char* msg)
103
+ :unpack_error(msg) {}
104
+ #endif
105
+ };
106
+
107
+ struct array_size_overflow : public size_overflow {
108
+ array_size_overflow(const std::string& msg)
109
+ :size_overflow(msg) {}
110
+ #if !defined(MSGPACK_USE_CPP03)
111
+ array_size_overflow(const char* msg)
112
+ :size_overflow(msg) {}
113
+ #endif
114
+ };
115
+
116
+ struct map_size_overflow : public size_overflow {
117
+ map_size_overflow(const std::string& msg)
118
+ :size_overflow(msg) {}
119
+ #if !defined(MSGPACK_USE_CPP03)
120
+ map_size_overflow(const char* msg)
121
+ :size_overflow(msg) {}
122
+ #endif
123
+ };
124
+
125
+ struct str_size_overflow : public size_overflow {
126
+ str_size_overflow(const std::string& msg)
127
+ :size_overflow(msg) {}
128
+ #if !defined(MSGPACK_USE_CPP03)
129
+ str_size_overflow(const char* msg)
130
+ :size_overflow(msg) {}
131
+ #endif
132
+ };
133
+
134
+ struct bin_size_overflow : public size_overflow {
135
+ bin_size_overflow(const std::string& msg)
136
+ :size_overflow(msg) {}
137
+ #if !defined(MSGPACK_USE_CPP03)
138
+ bin_size_overflow(const char* msg)
139
+ :size_overflow(msg) {}
140
+ #endif
141
+ };
142
+
143
+ struct ext_size_overflow : public size_overflow {
144
+ ext_size_overflow(const std::string& msg)
145
+ :size_overflow(msg) {}
146
+ #if !defined(MSGPACK_USE_CPP03)
147
+ ext_size_overflow(const char* msg)
148
+ :size_overflow(msg) {}
149
+ #endif
150
+ };
151
+
152
+ struct depth_size_overflow : public size_overflow {
153
+ depth_size_overflow(const std::string& msg)
154
+ :size_overflow(msg) {}
155
+ #if !defined(MSGPACK_USE_CPP03)
156
+ depth_size_overflow(const char* msg)
157
+ :size_overflow(msg) {}
158
+ #endif
159
+ };
160
+
161
+ class unpack_limit {
162
+ public:
163
+ unpack_limit(
164
+ std::size_t array = 0xffffffff,
165
+ std::size_t map = 0xffffffff,
166
+ std::size_t str = 0xffffffff,
167
+ std::size_t bin = 0xffffffff,
168
+ std::size_t ext = 0xffffffff,
169
+ std::size_t depth = 0xffffffff)
170
+ :array_(array),
171
+ map_(map),
172
+ str_(str),
173
+ bin_(bin),
174
+ ext_(ext),
175
+ depth_(depth) {}
176
+ std::size_t array() const { return array_; }
177
+ std::size_t map() const { return map_; }
178
+ std::size_t str() const { return str_; }
179
+ std::size_t bin() const { return bin_; }
180
+ std::size_t ext() const { return ext_; }
181
+ std::size_t depth() const { return depth_; }
182
+
183
+ private:
184
+ std::size_t array_;
185
+ std::size_t map_;
186
+ std::size_t str_;
187
+ std::size_t bin_;
188
+ std::size_t ext_;
189
+ std::size_t depth_;
190
+ };
191
+
192
+ namespace detail {
193
+
194
+ class unpack_user {
195
+ public:
196
+ unpack_user(unpack_reference_func f = nullptr,
197
+ void* user_data = nullptr,
198
+ unpack_limit const& limit = unpack_limit())
199
+ :m_func(f), m_user_data(user_data), m_limit(limit) {}
200
+ msgpack::zone const& zone() const { return *m_zone; }
201
+ msgpack::zone& zone() { return *m_zone; }
202
+ void set_zone(msgpack::zone& zone) { m_zone = &zone; }
203
+ bool referenced() const { return m_referenced; }
204
+ void set_referenced(bool referenced) { m_referenced = referenced; }
205
+ unpack_reference_func reference_func() const { return m_func; }
206
+ void* user_data() const { return m_user_data; }
207
+ unpack_limit const& limit() const { return m_limit; }
208
+ unpack_limit& limit() { return m_limit; }
209
+
210
+ private:
211
+ msgpack::zone* m_zone;
212
+ bool m_referenced;
213
+ unpack_reference_func m_func;
214
+ void* m_user_data;
215
+ unpack_limit m_limit;
216
+ };
217
+
218
+ inline void unpack_uint8(uint8_t d, msgpack::object& o)
219
+ { o.type = msgpack::type::POSITIVE_INTEGER; o.via.u64 = d; }
220
+
221
+ inline void unpack_uint16(uint16_t d, msgpack::object& o)
222
+ { o.type = msgpack::type::POSITIVE_INTEGER; o.via.u64 = d; }
223
+
224
+ inline void unpack_uint32(uint32_t d, msgpack::object& o)
225
+ { o.type = msgpack::type::POSITIVE_INTEGER; o.via.u64 = d; }
226
+
227
+ inline void unpack_uint64(uint64_t d, msgpack::object& o)
228
+ { o.type = msgpack::type::POSITIVE_INTEGER; o.via.u64 = d; }
229
+
230
+ inline void unpack_int8(int8_t d, msgpack::object& o)
231
+ { if(d >= 0) { o.type = msgpack::type::POSITIVE_INTEGER; o.via.u64 = d; }
232
+ else { o.type = msgpack::type::NEGATIVE_INTEGER; o.via.i64 = d; } }
233
+
234
+ inline void unpack_int16(int16_t d, msgpack::object& o)
235
+ { if(d >= 0) { o.type = msgpack::type::POSITIVE_INTEGER; o.via.u64 = d; }
236
+ else { o.type = msgpack::type::NEGATIVE_INTEGER; o.via.i64 = d; } }
237
+
238
+ inline void unpack_int32(int32_t d, msgpack::object& o)
239
+ { if(d >= 0) { o.type = msgpack::type::POSITIVE_INTEGER; o.via.u64 = d; }
240
+ else { o.type = msgpack::type::NEGATIVE_INTEGER; o.via.i64 = d; } }
241
+
242
+ inline void unpack_int64(int64_t d, msgpack::object& o)
243
+ { if(d >= 0) { o.type = msgpack::type::POSITIVE_INTEGER; o.via.u64 = d; }
244
+ else { o.type = msgpack::type::NEGATIVE_INTEGER; o.via.i64 = d; } }
245
+
246
+ inline void unpack_float(float d, msgpack::object& o)
247
+ { o.type = msgpack::type::FLOAT; o.via.f64 = d; }
248
+
249
+ inline void unpack_double(double d, msgpack::object& o)
250
+ { o.type = msgpack::type::FLOAT; o.via.f64 = d; }
251
+
252
+ inline void unpack_nil(msgpack::object& o)
253
+ { o.type = msgpack::type::NIL; }
254
+
255
+ inline void unpack_true(msgpack::object& o)
256
+ { o.type = msgpack::type::BOOLEAN; o.via.boolean = true; }
257
+
258
+ inline void unpack_false(msgpack::object& o)
259
+ { o.type = msgpack::type::BOOLEAN; o.via.boolean = false; }
260
+
261
+ struct unpack_array {
262
+ void operator()(unpack_user& u, uint32_t n, msgpack::object& o) const {
263
+ if (n > u.limit().array()) throw msgpack::array_size_overflow("array size overflow");
264
+ o.type = msgpack::type::ARRAY;
265
+ o.via.array.size = 0;
266
+ o.via.array.ptr = static_cast<msgpack::object*>(u.zone().allocate_align(n*sizeof(msgpack::object)));
267
+ }
268
+ };
269
+
270
+ inline void unpack_array_item(msgpack::object& c, msgpack::object const& o)
271
+ {
272
+ #if defined(__GNUC__) && !defined(__clang__)
273
+ std::memcpy(&c.via.array.ptr[c.via.array.size++], &o, sizeof(msgpack::object));
274
+ #else /* __GNUC__ && !__clang__ */
275
+ c.via.array.ptr[c.via.array.size++] = o;
276
+ #endif /* __GNUC__ && !__clang__ */
277
+ }
278
+
279
+ struct unpack_map {
280
+ void operator()(unpack_user& u, uint32_t n, msgpack::object& o) const {
281
+ if (n > u.limit().map()) throw msgpack::map_size_overflow("map size overflow");
282
+ o.type = msgpack::type::MAP;
283
+ o.via.map.size = 0;
284
+ o.via.map.ptr = static_cast<msgpack::object_kv*>(u.zone().allocate_align(n*sizeof(msgpack::object_kv)));
285
+ }
286
+ };
287
+
288
+ inline void unpack_map_item(msgpack::object& c, msgpack::object const& k, msgpack::object const& v)
289
+ {
290
+ #if defined(__GNUC__) && !defined(__clang__)
291
+ std::memcpy(&c.via.map.ptr[c.via.map.size].key, &k, sizeof(msgpack::object));
292
+ std::memcpy(&c.via.map.ptr[c.via.map.size].val, &v, sizeof(msgpack::object));
293
+ #else /* __GNUC__ && !__clang__ */
294
+ c.via.map.ptr[c.via.map.size].key = k;
295
+ c.via.map.ptr[c.via.map.size].val = v;
296
+ #endif /* __GNUC__ && !__clang__ */
297
+ ++c.via.map.size;
298
+ }
299
+
300
+ inline void unpack_str(unpack_user& u, const char* p, uint32_t l, msgpack::object& o)
301
+ {
302
+ o.type = msgpack::type::STR;
303
+ if (u.reference_func() && u.reference_func()(o.type, l, u.user_data())) {
304
+ o.via.str.ptr = p;
305
+ u.set_referenced(true);
306
+ }
307
+ else {
308
+ if (l > u.limit().str()) throw msgpack::str_size_overflow("str size overflow");
309
+ char* tmp = static_cast<char*>(u.zone().allocate_align(l));
310
+ std::memcpy(tmp, p, l);
311
+ o.via.str.ptr = tmp;
312
+ }
313
+ o.via.str.size = l;
314
+ }
315
+
316
+ inline void unpack_bin(unpack_user& u, const char* p, uint32_t l, msgpack::object& o)
317
+ {
318
+ o.type = msgpack::type::BIN;
319
+ if (u.reference_func() && u.reference_func()(o.type, l, u.user_data())) {
320
+ o.via.bin.ptr = p;
321
+ u.set_referenced(true);
322
+ }
323
+ else {
324
+ if (l > u.limit().bin()) throw msgpack::bin_size_overflow("bin size overflow");
325
+ char* tmp = static_cast<char*>(u.zone().allocate_align(l));
326
+ std::memcpy(tmp, p, l);
327
+ o.via.bin.ptr = tmp;
328
+ }
329
+ o.via.bin.size = l;
330
+ }
331
+
332
+ inline void unpack_ext(unpack_user& u, const char* p, std::size_t l, msgpack::object& o)
333
+ {
334
+ o.type = msgpack::type::EXT;
335
+ if (u.reference_func() && u.reference_func()(o.type, l, u.user_data())) {
336
+ o.via.ext.ptr = p;
337
+ u.set_referenced(true);
338
+ }
339
+ else {
340
+ if (l > u.limit().ext()) throw msgpack::ext_size_overflow("ext size overflow");
341
+ char* tmp = static_cast<char*>(u.zone().allocate_align(l));
342
+ std::memcpy(tmp, p, l);
343
+ o.via.ext.ptr = tmp;
344
+ }
345
+ o.via.ext.size = static_cast<uint32_t>(l - 1);
346
+ }
347
+
348
+
349
+ class unpack_stack {
350
+ public:
351
+ msgpack::object const& obj() const { return m_obj; }
352
+ msgpack::object& obj() { return m_obj; }
353
+ void set_obj(msgpack::object const& obj) { m_obj = obj; }
354
+ std::size_t count() const { return m_count; }
355
+ void set_count(std::size_t count) { m_count = count; }
356
+ std::size_t decr_count() { return --m_count; }
357
+ uint32_t container_type() const { return m_container_type; }
358
+ void set_container_type(uint32_t container_type) { m_container_type = container_type; }
359
+ msgpack::object const& map_key() const { return m_map_key; }
360
+ void set_map_key(msgpack::object const& map_key) { m_map_key = map_key; }
361
+ private:
362
+ msgpack::object m_obj;
363
+ std::size_t m_count;
364
+ uint32_t m_container_type;
365
+ msgpack::object m_map_key;
366
+ };
367
+
368
+ inline void init_count(void* buffer)
369
+ {
370
+ #if defined(MSGPACK_USE_CPP03)
371
+ *reinterpret_cast<volatile _msgpack_atomic_counter_t*>(buffer) = 1;
372
+ #else // defined(MSGPACK_USE_CPP03)
373
+ new (buffer) std::atomic<unsigned int>(1);
374
+ #endif // defined(MSGPACK_USE_CPP03)
375
+ }
376
+
377
+ inline void decr_count(void* buffer)
378
+ {
379
+ #if defined(MSGPACK_USE_CPP03)
380
+ if(_msgpack_sync_decr_and_fetch(reinterpret_cast<volatile _msgpack_atomic_counter_t*>(buffer)) == 0) {
381
+ free(buffer);
382
+ }
383
+ #else // defined(MSGPACK_USE_CPP03)
384
+ if (--*reinterpret_cast<std::atomic<unsigned int>*>(buffer) == 0) {
385
+ free(buffer);
386
+ }
387
+ #endif // defined(MSGPACK_USE_CPP03)
388
+ }
389
+
390
+ inline void incr_count(void* buffer)
391
+ {
392
+ #if defined(MSGPACK_USE_CPP03)
393
+ _msgpack_sync_incr_and_fetch(reinterpret_cast<volatile _msgpack_atomic_counter_t*>(buffer));
394
+ #else // defined(MSGPACK_USE_CPP03)
395
+ ++*reinterpret_cast<std::atomic<unsigned int>*>(buffer);
396
+ #endif // defined(MSGPACK_USE_CPP03)
397
+ }
398
+
399
+ #if defined(MSGPACK_USE_CPP03)
400
+ inline _msgpack_atomic_counter_t get_count(void* buffer)
401
+ {
402
+ return *reinterpret_cast<volatile _msgpack_atomic_counter_t*>(buffer);
403
+ }
404
+ #else // defined(MSGPACK_USE_CPP03)
405
+ inline std::atomic<unsigned int> const& get_count(void* buffer)
406
+ {
407
+ return *reinterpret_cast<std::atomic<unsigned int>*>(buffer);
408
+ }
409
+ #endif // defined(MSGPACK_USE_CPP03)
410
+
411
+ struct fix_tag {
412
+ char f1[65]; // FIXME unique size is required. or use is_same meta function.
413
+ };
414
+
415
+ template <typename T>
416
+ struct value {
417
+ typedef T type;
418
+ };
419
+ template <>
420
+ struct value<fix_tag> {
421
+ typedef uint32_t type;
38
422
  };
39
423
 
424
+ template <typename T>
425
+ inline void load(uint32_t& dst, const char* n, typename msgpack::enable_if<sizeof(T) == sizeof(fix_tag)>::type* = nullptr) {
426
+ dst = static_cast<uint32_t>(*reinterpret_cast<const uint8_t*>(n)) & 0x0f;
427
+ }
428
+
429
+ template <typename T>
430
+ inline void load(T& dst, const char* n, typename msgpack::enable_if<sizeof(T) == 1>::type* = nullptr) {
431
+ dst = static_cast<T>(*reinterpret_cast<const uint8_t*>(n));
432
+ }
433
+
434
+ template <typename T>
435
+ inline void load(T& dst, const char* n, typename msgpack::enable_if<sizeof(T) == 2>::type* = nullptr) {
436
+ _msgpack_load16(T, n, &dst);
437
+ }
438
+
439
+ template <typename T>
440
+ inline void load(T& dst, const char* n, typename msgpack::enable_if<sizeof(T) == 4>::type* = nullptr) {
441
+ _msgpack_load32(T, n, &dst);
442
+ }
443
+
444
+ template <typename T>
445
+ inline void load(T& dst, const char* n, typename msgpack::enable_if<sizeof(T) == 8>::type* = nullptr) {
446
+ _msgpack_load64(T, n, &dst);
447
+ }
448
+
449
+ class context {
450
+ public:
451
+ context(unpack_reference_func f, void* user_data, unpack_limit const& limit)
452
+ :m_trail(0), m_user(f, user_data, limit), m_cs(MSGPACK_CS_HEADER)
453
+ {
454
+ m_stack.reserve(MSGPACK_EMBED_STACK_SIZE);
455
+ m_stack.push_back(unpack_stack());
456
+ }
457
+
458
+ void init()
459
+ {
460
+ m_cs = MSGPACK_CS_HEADER;
461
+ m_trail = 0;
462
+ m_stack.resize(1);
463
+ m_stack[0].set_obj(msgpack::object());
464
+ }
465
+
466
+ msgpack::object const& data() const
467
+ {
468
+ return m_stack[0].obj();
469
+ }
470
+
471
+ unpack_user& user()
472
+ {
473
+ return m_user;
474
+ }
475
+
476
+ unpack_user const& user() const
477
+ {
478
+ return m_user;
479
+ }
480
+
481
+ int execute(const char* data, std::size_t len, std::size_t& off);
482
+
483
+ private:
484
+ template <typename T>
485
+ static uint32_t next_cs(T p)
486
+ {
487
+ return static_cast<uint32_t>(*p) & 0x1f;
488
+ }
489
+
490
+ template <typename T, typename Func>
491
+ int push_aggregate(
492
+ Func const& f,
493
+ uint32_t container_type,
494
+ msgpack::object& obj,
495
+ const char* load_pos,
496
+ std::size_t& off) {
497
+ typename value<T>::type tmp;
498
+ load<T>(tmp, load_pos);
499
+ f(m_user, tmp, m_stack.back().obj());
500
+ if(tmp == 0) {
501
+ obj = m_stack.back().obj();
502
+ int ret = push_proc(obj, off);
503
+ if (ret != 0) return ret;
504
+ }
505
+ else {
506
+ m_stack.back().set_container_type(container_type);
507
+ m_stack.back().set_count(tmp);
508
+ if (m_stack.size() <= m_user.limit().depth()) {
509
+ m_stack.push_back(unpack_stack());
510
+ }
511
+ else {
512
+ throw msgpack::depth_size_overflow("depth size overflow");
513
+ }
514
+ m_cs = MSGPACK_CS_HEADER;
515
+ ++m_current;
516
+ }
517
+ return 0;
518
+ }
519
+
520
+ int push_item(msgpack::object& obj) {
521
+ bool finish = false;
522
+ while (!finish) {
523
+ if(m_stack.size() == 1) {
524
+ return 1;
525
+ }
526
+ unpack_stack& sp = *(m_stack.end() - 2);
527
+ switch(sp.container_type()) {
528
+ case MSGPACK_CT_ARRAY_ITEM:
529
+ unpack_array_item(sp.obj(), obj);
530
+ if(sp.decr_count() == 0) {
531
+ obj = sp.obj();
532
+ m_stack.pop_back();
533
+ }
534
+ else {
535
+ finish = true;
536
+ }
537
+ break;
538
+ case MSGPACK_CT_MAP_KEY:
539
+ sp.set_map_key(obj);
540
+ sp.set_container_type(MSGPACK_CT_MAP_VALUE);
541
+ finish = true;
542
+ break;
543
+ case MSGPACK_CT_MAP_VALUE:
544
+ unpack_map_item(sp.obj(), sp.map_key(), obj);
545
+ if(sp.decr_count() == 0) {
546
+ obj = sp.obj();
547
+ m_stack.pop_back();
548
+ }
549
+ else {
550
+ sp.set_container_type(MSGPACK_CT_MAP_KEY);
551
+ finish = true;
552
+ }
553
+ break;
554
+ default:
555
+ return -1;
556
+ }
557
+ }
558
+ return 0;
559
+ }
560
+
561
+ int push_proc(msgpack::object& obj, std::size_t& off) {
562
+ int ret = push_item(obj);
563
+ if (ret > 0) {
564
+ m_stack[0].set_obj(obj);
565
+ ++m_current;
566
+ /*printf("-- finish --\n"); */
567
+ off = m_current - m_start;
568
+ }
569
+ else if (ret < 0) {
570
+ off = m_current - m_start;
571
+ }
572
+ else {
573
+ m_cs = MSGPACK_CS_HEADER;
574
+ ++m_current;
575
+ }
576
+ return ret;
577
+ }
578
+
579
+ template <std::size_t N>
580
+ static void check_ext_size(std::size_t /*size*/) {
581
+ }
582
+
583
+ private:
584
+ char const* m_start;
585
+ char const* m_current;
586
+
587
+ std::size_t m_trail;
588
+ unpack_user m_user;
589
+ uint32_t m_cs;
590
+ std::vector<unpack_stack> m_stack;
591
+ };
592
+
593
+ template <>
594
+ inline void context::check_ext_size<4>(std::size_t size) {
595
+ if (size == 0xffffffff) throw msgpack::ext_size_overflow("ext size overflow");
596
+ }
597
+
598
+ inline int context::execute(const char* data, std::size_t len, std::size_t& off)
599
+ {
600
+ assert(len >= off);
601
+
602
+ m_start = data;
603
+ m_current = data + off;
604
+ const char* const pe = data + len;
605
+ const char* n = nullptr;
606
+
607
+ msgpack::object obj;
608
+
609
+ if(m_current == pe) {
610
+ off = m_current - m_start;
611
+ return 0;
612
+ }
613
+ bool fixed_trail_again = false;
614
+ do {
615
+ if (m_cs == MSGPACK_CS_HEADER) {
616
+ fixed_trail_again = false;
617
+ int selector = *reinterpret_cast<const unsigned char*>(m_current);
618
+ if (0x00 <= selector && selector <= 0x7f) { // Positive Fixnum
619
+ unpack_uint8(*reinterpret_cast<const uint8_t*>(m_current), obj);
620
+ int ret = push_proc(obj, off);
621
+ if (ret != 0) return ret;
622
+ } else if(0xe0 <= selector && selector <= 0xff) { // Negative Fixnum
623
+ unpack_int8(*reinterpret_cast<const int8_t*>(m_current), obj);
624
+ int ret = push_proc(obj, off);
625
+ if (ret != 0) return ret;
626
+ } else if (0xc4 <= selector && selector <= 0xdf) {
627
+ const uint32_t trail[] = {
628
+ 1, // bin 8 0xc4
629
+ 2, // bin 16 0xc5
630
+ 4, // bin 32 0xc6
631
+ 1, // ext 8 0xc7
632
+ 2, // ext 16 0xc8
633
+ 4, // ext 32 0xc9
634
+ 4, // float 32 0xca
635
+ 8, // float 64 0xcb
636
+ 1, // uint 8 0xcc
637
+ 2, // uint 16 0xcd
638
+ 4, // uint 32 0xce
639
+ 8, // uint 64 0xcf
640
+ 1, // int 8 0xd0
641
+ 2, // int 16 0xd1
642
+ 4, // int 32 0xd2
643
+ 8, // int 64 0xd3
644
+ 2, // fixext 1 0xd4
645
+ 3, // fixext 2 0xd5
646
+ 5, // fixext 4 0xd6
647
+ 9, // fixext 8 0xd7
648
+ 17,// fixext 16 0xd8
649
+ 1, // str 8 0xd9
650
+ 2, // str 16 0xda
651
+ 4, // str 32 0xdb
652
+ 2, // array 16 0xdc
653
+ 4, // array 32 0xdd
654
+ 2, // map 16 0xde
655
+ 4, // map 32 0xdf
656
+ };
657
+ m_trail = trail[selector - 0xc4];
658
+ m_cs = next_cs(m_current);
659
+ fixed_trail_again = true;
660
+ } else if(0xa0 <= selector && selector <= 0xbf) { // FixStr
661
+ m_trail = static_cast<uint32_t>(*m_current) & 0x1f;
662
+ if(m_trail == 0) {
663
+ unpack_str(m_user, n, static_cast<uint32_t>(m_trail), obj);
664
+ int ret = push_proc(obj, off);
665
+ if (ret != 0) return ret;
666
+ }
667
+ else {
668
+ m_cs = MSGPACK_ACS_STR_VALUE;
669
+ fixed_trail_again = true;
670
+ }
671
+
672
+ } else if(0x90 <= selector && selector <= 0x9f) { // FixArray
673
+ int ret = push_aggregate<fix_tag>(
674
+ unpack_array(), MSGPACK_CT_ARRAY_ITEM, obj, m_current, off);
675
+ if (ret != 0) return ret;
676
+ } else if(0x80 <= selector && selector <= 0x8f) { // FixMap
677
+ int ret = push_aggregate<fix_tag>(
678
+ unpack_map(), MSGPACK_CT_MAP_KEY, obj, m_current, off);
679
+ if (ret != 0) return ret;
680
+ } else if(selector == 0xc2) { // false
681
+ unpack_false(obj);
682
+ int ret = push_proc(obj, off);
683
+ if (ret != 0) return ret;
684
+ } else if(selector == 0xc3) { // true
685
+ unpack_true(obj);
686
+ int ret = push_proc(obj, off);
687
+ if (ret != 0) return ret;
688
+ } else if(selector == 0xc0) { // nil
689
+ unpack_nil(obj);
690
+ int ret = push_proc(obj, off);
691
+ if (ret != 0) return ret;
692
+ } else {
693
+ off = m_current - m_start;
694
+ return -1;
695
+ }
696
+ // end MSGPACK_CS_HEADER
697
+ }
698
+ if (m_cs != MSGPACK_CS_HEADER || fixed_trail_again) {
699
+ if (fixed_trail_again) {
700
+ ++m_current;
701
+ fixed_trail_again = false;
702
+ }
703
+ if(static_cast<std::size_t>(pe - m_current) < m_trail) {
704
+ off = m_current - m_start;
705
+ return 0;
706
+ }
707
+ n = m_current;
708
+ m_current += m_trail - 1;
709
+ switch(m_cs) {
710
+ //case MSGPACK_CS_
711
+ //case MSGPACK_CS_
712
+ case MSGPACK_CS_FLOAT: {
713
+ union { uint32_t i; float f; } mem;
714
+ load<uint32_t>(mem.i, n);
715
+ unpack_float(mem.f, obj);
716
+ int ret = push_proc(obj, off);
717
+ if (ret != 0) return ret;
718
+ } break;
719
+ case MSGPACK_CS_DOUBLE: {
720
+ union { uint64_t i; double f; } mem;
721
+ load<uint64_t>(mem.i, n);
722
+ #if defined(__arm__) && !(__ARM_EABI__) // arm-oabi
723
+ // https://github.com/msgpack/msgpack-perl/pull/1
724
+ mem.i = (mem.i & 0xFFFFFFFFUL) << 32UL | (mem.i >> 32UL);
725
+ #endif
726
+ unpack_double(mem.f, obj);
727
+ int ret = push_proc(obj, off);
728
+ if (ret != 0) return ret;
729
+ } break;
730
+ case MSGPACK_CS_UINT_8: {
731
+ uint8_t tmp;
732
+ load<uint8_t>(tmp, n);
733
+ unpack_uint8(tmp, obj);
734
+ int ret = push_proc(obj, off);
735
+ if (ret != 0) return ret;
736
+ } break;
737
+ case MSGPACK_CS_UINT_16: {
738
+ uint16_t tmp;
739
+ load<uint16_t>(tmp, n);
740
+ unpack_uint16(tmp, obj);
741
+ int ret = push_proc(obj, off);
742
+ if (ret != 0) return ret;
743
+ } break;
744
+ case MSGPACK_CS_UINT_32: {
745
+ uint32_t tmp;
746
+ load<uint32_t>(tmp, n);
747
+ unpack_uint32(tmp, obj);
748
+ int ret = push_proc(obj, off);
749
+ if (ret != 0) return ret;
750
+ } break;
751
+ case MSGPACK_CS_UINT_64: {
752
+ uint64_t tmp;
753
+ load<uint64_t>(tmp, n);
754
+ unpack_uint64(tmp, obj);
755
+ int ret = push_proc(obj, off);
756
+ if (ret != 0) return ret;
757
+ } break;
758
+ case MSGPACK_CS_INT_8: {
759
+ int8_t tmp;
760
+ load<int8_t>(tmp, n);
761
+ unpack_int8(tmp, obj);
762
+ int ret = push_proc(obj, off);
763
+ if (ret != 0) return ret;
764
+ } break;
765
+ case MSGPACK_CS_INT_16: {
766
+ int16_t tmp;
767
+ load<int16_t>(tmp, n);
768
+ unpack_int16(tmp, obj);
769
+ int ret = push_proc(obj, off);
770
+ if (ret != 0) return ret;
771
+ } break;
772
+ case MSGPACK_CS_INT_32: {
773
+ int32_t tmp;
774
+ load<int32_t>(tmp, n);
775
+ unpack_int32(tmp, obj);
776
+ int ret = push_proc(obj, off);
777
+ if (ret != 0) return ret;
778
+ } break;
779
+ case MSGPACK_CS_INT_64: {
780
+ int64_t tmp;
781
+ load<int64_t>(tmp, n);
782
+ unpack_int64(tmp, obj);
783
+ int ret = push_proc(obj, off);
784
+ if (ret != 0) return ret;
785
+ } break;
786
+ case MSGPACK_CS_FIXEXT_1: {
787
+ unpack_ext(m_user, n, 1+1, obj);
788
+ int ret = push_proc(obj, off);
789
+ if (ret != 0) return ret;
790
+ } break;
791
+ case MSGPACK_CS_FIXEXT_2: {
792
+ unpack_ext(m_user, n, 2+1, obj);
793
+ int ret = push_proc(obj, off);
794
+ if (ret != 0) return ret;
795
+ } break;
796
+ case MSGPACK_CS_FIXEXT_4: {
797
+ unpack_ext(m_user, n, 4+1, obj);
798
+ int ret = push_proc(obj, off);
799
+ if (ret != 0) return ret;
800
+ } break;
801
+ case MSGPACK_CS_FIXEXT_8: {
802
+ unpack_ext(m_user, n, 8+1, obj);
803
+ int ret = push_proc(obj, off);
804
+ if (ret != 0) return ret;
805
+ } break;
806
+ case MSGPACK_CS_FIXEXT_16: {
807
+ unpack_ext(m_user, n, 16+1, obj);
808
+ int ret = push_proc(obj, off);
809
+ if (ret != 0) return ret;
810
+ } break;
811
+ case MSGPACK_CS_STR_8: {
812
+ uint8_t tmp;
813
+ load<uint8_t>(tmp, n);
814
+ m_trail = tmp;
815
+ if(m_trail == 0) {
816
+ unpack_str(m_user, n, static_cast<uint32_t>(m_trail), obj);
817
+ int ret = push_proc(obj, off);
818
+ if (ret != 0) return ret;
819
+ }
820
+ else {
821
+ m_cs = MSGPACK_ACS_STR_VALUE;
822
+ fixed_trail_again = true;
823
+ }
824
+ } break;
825
+ case MSGPACK_CS_BIN_8: {
826
+ uint8_t tmp;
827
+ load<uint8_t>(tmp, n);
828
+ m_trail = tmp;
829
+ if(m_trail == 0) {
830
+ unpack_bin(m_user, n, static_cast<uint32_t>(m_trail), obj);
831
+ int ret = push_proc(obj, off);
832
+ if (ret != 0) return ret;
833
+ }
834
+ else {
835
+ m_cs = MSGPACK_ACS_BIN_VALUE;
836
+ fixed_trail_again = true;
837
+ }
838
+ } break;
839
+ case MSGPACK_CS_EXT_8: {
840
+ uint8_t tmp;
841
+ load<uint8_t>(tmp, n);
842
+ m_trail = tmp + 1;
843
+ if(m_trail == 0) {
844
+ unpack_ext(m_user, n, m_trail, obj);
845
+ int ret = push_proc(obj, off);
846
+ if (ret != 0) return ret;
847
+ }
848
+ else {
849
+ m_cs = MSGPACK_ACS_EXT_VALUE;
850
+ fixed_trail_again = true;
851
+ }
852
+ } break;
853
+ case MSGPACK_CS_STR_16: {
854
+ uint16_t tmp;
855
+ load<uint16_t>(tmp, n);
856
+ m_trail = tmp;
857
+ if(m_trail == 0) {
858
+ unpack_str(m_user, n, static_cast<uint32_t>(m_trail), obj);
859
+ int ret = push_proc(obj, off);
860
+ if (ret != 0) return ret;
861
+ }
862
+ else {
863
+ m_cs = MSGPACK_ACS_STR_VALUE;
864
+ fixed_trail_again = true;
865
+ }
866
+ } break;
867
+ case MSGPACK_CS_BIN_16: {
868
+ uint16_t tmp;
869
+ load<uint16_t>(tmp, n);
870
+ m_trail = tmp;
871
+ if(m_trail == 0) {
872
+ unpack_bin(m_user, n, static_cast<uint32_t>(m_trail), obj);
873
+ int ret = push_proc(obj, off);
874
+ if (ret != 0) return ret;
875
+ }
876
+ else {
877
+ m_cs = MSGPACK_ACS_BIN_VALUE;
878
+ fixed_trail_again = true;
879
+ }
880
+ } break;
881
+ case MSGPACK_CS_EXT_16: {
882
+ uint16_t tmp;
883
+ load<uint16_t>(tmp, n);
884
+ m_trail = tmp + 1;
885
+ if(m_trail == 0) {
886
+ unpack_ext(m_user, n, m_trail, obj);
887
+ int ret = push_proc(obj, off);
888
+ if (ret != 0) return ret;
889
+ }
890
+ else {
891
+ m_cs = MSGPACK_ACS_EXT_VALUE;
892
+ fixed_trail_again = true;
893
+ }
894
+ } break;
895
+ case MSGPACK_CS_STR_32: {
896
+ uint32_t tmp;
897
+ load<uint32_t>(tmp, n);
898
+ m_trail = tmp;
899
+ if(m_trail == 0) {
900
+ unpack_str(m_user, n, static_cast<uint32_t>(m_trail), obj);
901
+ int ret = push_proc(obj, off);
902
+ if (ret != 0) return ret;
903
+ }
904
+ else {
905
+ m_cs = MSGPACK_ACS_STR_VALUE;
906
+ fixed_trail_again = true;
907
+ }
908
+ } break;
909
+ case MSGPACK_CS_BIN_32: {
910
+ uint32_t tmp;
911
+ load<uint32_t>(tmp, n);
912
+ m_trail = tmp;
913
+ if(m_trail == 0) {
914
+ unpack_bin(m_user, n, static_cast<uint32_t>(m_trail), obj);
915
+ int ret = push_proc(obj, off);
916
+ if (ret != 0) return ret;
917
+ }
918
+ else {
919
+ m_cs = MSGPACK_ACS_BIN_VALUE;
920
+ fixed_trail_again = true;
921
+ }
922
+ } break;
923
+ case MSGPACK_CS_EXT_32: {
924
+ uint32_t tmp;
925
+ load<uint32_t>(tmp, n);
926
+ check_ext_size<sizeof(std::size_t)>(tmp);
927
+ m_trail = tmp;
928
+ ++m_trail;
929
+ if(m_trail == 0) {
930
+ unpack_ext(m_user, n, m_trail, obj);
931
+ int ret = push_proc(obj, off);
932
+ if (ret != 0) return ret;
933
+ }
934
+ else {
935
+ m_cs = MSGPACK_ACS_EXT_VALUE;
936
+ fixed_trail_again = true;
937
+ }
938
+ } break;
939
+ case MSGPACK_ACS_STR_VALUE: {
940
+ unpack_str(m_user, n, static_cast<uint32_t>(m_trail), obj);
941
+ int ret = push_proc(obj, off);
942
+ if (ret != 0) return ret;
943
+ } break;
944
+ case MSGPACK_ACS_BIN_VALUE: {
945
+ unpack_bin(m_user, n, static_cast<uint32_t>(m_trail), obj);
946
+ int ret = push_proc(obj, off);
947
+ if (ret != 0) return ret;
948
+ } break;
949
+ case MSGPACK_ACS_EXT_VALUE: {
950
+ unpack_ext(m_user, n, m_trail, obj);
951
+ int ret = push_proc(obj, off);
952
+ if (ret != 0) return ret;
953
+ } break;
954
+ case MSGPACK_CS_ARRAY_16: {
955
+ int ret = push_aggregate<uint16_t>(
956
+ unpack_array(), MSGPACK_CT_ARRAY_ITEM, obj, n, off);
957
+ if (ret != 0) return ret;
958
+ } break;
959
+ case MSGPACK_CS_ARRAY_32: {
960
+ /* FIXME security guard */
961
+ int ret = push_aggregate<uint32_t>(
962
+ unpack_array(), MSGPACK_CT_ARRAY_ITEM, obj, n, off);
963
+ if (ret != 0) return ret;
964
+ } break;
965
+ case MSGPACK_CS_MAP_16: {
966
+ int ret = push_aggregate<uint16_t>(
967
+ unpack_map(), MSGPACK_CT_MAP_KEY, obj, n, off);
968
+ if (ret != 0) return ret;
969
+ } break;
970
+ case MSGPACK_CS_MAP_32: {
971
+ /* FIXME security guard */
972
+ int ret = push_aggregate<uint32_t>(
973
+ unpack_map(), MSGPACK_CT_MAP_KEY, obj, n, off);
974
+ if (ret != 0) return ret;
975
+ } break;
976
+ default:
977
+ off = m_current - m_start;
978
+ return -1;
979
+ }
980
+ }
981
+ } while(m_current != pe);
982
+
983
+ off = m_current - m_start;
984
+ return 0;
985
+ }
986
+
987
+ } // detail
988
+
40
989
 
41
990
  class unpacked {
42
991
  public:
43
- unpacked() { }
992
+ unpacked() {}
44
993
 
45
- unpacked(object obj, std::auto_ptr<msgpack::zone> z) :
46
- m_obj(obj), m_zone(z) { }
994
+ unpacked(msgpack::object const& obj, msgpack::unique_ptr<msgpack::zone> z) :
995
+ m_obj(obj), m_zone(msgpack::move(z)) { }
47
996
 
48
- object& get()
49
- { return m_obj; }
997
+ void set(msgpack::object const& obj)
998
+ { m_obj = obj; }
50
999
 
51
- const object& get() const
52
- { return m_obj; }
1000
+ const msgpack::object& get() const
1001
+ { return m_obj; }
53
1002
 
54
- std::auto_ptr<msgpack::zone>& zone()
55
- { return m_zone; }
1003
+ msgpack::unique_ptr<msgpack::zone>& zone()
1004
+ { return m_zone; }
56
1005
 
57
- const std::auto_ptr<msgpack::zone>& zone() const
58
- { return m_zone; }
1006
+ const msgpack::unique_ptr<msgpack::zone>& zone() const
1007
+ { return m_zone; }
59
1008
 
60
1009
  private:
61
- object m_obj;
62
- std::auto_ptr<msgpack::zone> m_zone;
1010
+ msgpack::object m_obj;
1011
+ msgpack::unique_ptr<msgpack::zone> m_zone;
63
1012
  };
64
1013
 
65
1014
 
66
- class unpacker : public msgpack_unpacker {
1015
+ class unpacker {
67
1016
  public:
68
- unpacker(size_t init_buffer_size = MSGPACK_UNPACKER_INIT_BUFFER_SIZE);
69
- ~unpacker();
1017
+ unpacker(unpack_reference_func f = &unpacker::default_reference_func,
1018
+ void* user_data = nullptr,
1019
+ std::size_t init_buffer_size = MSGPACK_UNPACKER_INIT_BUFFER_SIZE,
1020
+ unpack_limit const& limit = unpack_limit());
1021
+
1022
+ #if !defined(MSGPACK_USE_CPP03)
1023
+ unpacker(unpacker&& other);
1024
+ unpacker& operator=(unpacker&& other);
1025
+ #endif // !defined(MSGPACK_USE_CPP03)
1026
+
1027
+ ~unpacker();
70
1028
 
71
1029
  public:
72
- /*! 1. reserve buffer. at least `size' bytes of capacity will be ready */
73
- void reserve_buffer(size_t size = MSGPACK_UNPACKER_RESERVE_SIZE);
74
-
75
- /*! 2. read data to the buffer() up to buffer_capacity() bytes */
76
- char* buffer();
77
- size_t buffer_capacity() const;
78
-
79
- /*! 3. specify the number of bytes actually copied */
80
- void buffer_consumed(size_t size);
81
-
82
- /*! 4. repeat next() until it retunrs false */
83
- bool next(unpacked* result);
84
-
85
- /*! 5. check if the size of message doesn't exceed assumption. */
86
- size_t message_size() const;
87
-
88
- // Basic usage of the unpacker is as following:
89
- //
90
- // msgpack::unpacker pac;
91
- // while( /* input is readable */ ) {
92
- //
93
- // // 1.
94
- // pac.reserve_buffer(32*1024);
95
- //
96
- // // 2.
97
- // size_t bytes = input.readsome(pac.buffer(), pac.buffer_capacity());
98
- //
99
- // // error handling ...
100
- //
101
- // // 3.
102
- // pac.buffer_consumed(bytes);
103
- //
104
- // // 4.
105
- // msgpack::unpacked result;
106
- // while(pac.next(&result)) {
107
- // // do some with the object with the zone.
108
- // msgpack::object obj = result.get();
109
- // std::auto_ptr<msgpack:zone> z = result.zone();
110
- // on_message(obj, z);
111
- //
112
- // //// boost::shared_ptr is also usable:
113
- // // boost::shared_ptr<msgpack::zone> life(z.release());
114
- // // on_message(result.get(), life);
115
- // }
116
- //
117
- // // 5.
118
- // if(pac.message_size() > 10*1024*1024) {
119
- // throw std::runtime_error("message is too large");
120
- // }
121
- // }
122
- //
123
-
124
- /*! for backward compatibility */
125
- bool execute();
126
-
127
- /*! for backward compatibility */
128
- object data();
129
-
130
- /*! for backward compatibility */
131
- zone* release_zone();
132
-
133
- /*! for backward compatibility */
134
- void reset_zone();
135
-
136
- /*! for backward compatibility */
137
- void reset();
1030
+ /*! 1. reserve buffer. at least `size' bytes of capacity will be ready */
1031
+ void reserve_buffer(std::size_t size = MSGPACK_UNPACKER_RESERVE_SIZE);
1032
+
1033
+ /*! 2. read data to the buffer() up to buffer_capacity() bytes */
1034
+ char* buffer();
1035
+ std::size_t buffer_capacity() const;
1036
+
1037
+ /*! 3. specify the number of bytes actually copied */
1038
+ void buffer_consumed(std::size_t size);
1039
+
1040
+ /*! 4. repeat next() until it retunrs false */
1041
+ bool next(unpacked* result);
1042
+ bool next(unpacked& result, bool& referenced);
1043
+ bool next(unpacked& result);
1044
+
1045
+ /*! 5. check if the size of message doesn't exceed assumption. */
1046
+ std::size_t message_size() const;
1047
+
1048
+ // Basic usage of the unpacker is as following:
1049
+ //
1050
+ // unpacker pac;
1051
+ // while( /* input is readable */ ) {
1052
+ //
1053
+ // // 1.
1054
+ // pac.reserve_buffer(32*1024);
1055
+ //
1056
+ // // 2.
1057
+ // std::size_t bytes = input.readsome(pac.buffer(), pac.buffer_capacity());
1058
+ //
1059
+ // // error handling ...
1060
+ //
1061
+ // // 3.
1062
+ // pac.buffer_consumed(bytes);
1063
+ //
1064
+ // // 4.
1065
+ // unpacked result;
1066
+ // while(pac.next(&result)) {
1067
+ // // do some with the object with the zone.
1068
+ // object obj = result.get();
1069
+ // std::auto_ptr<msgpack:zone> z = result.zone();
1070
+ // on_message(obj, z);
1071
+ //
1072
+ // //// boost::shared_ptr is also usable:
1073
+ // // boost::shared_ptr<zone> life(z.release());
1074
+ // // on_message(result.get(), life);
1075
+ // }
1076
+ //
1077
+ // // 5.
1078
+ // if(pac.message_size() > 10*1024*1024) {
1079
+ // throw std::runtime_error("message is too large");
1080
+ // }
1081
+ // }
1082
+ //
1083
+
1084
+ /*! for backward compatibility */
1085
+ bool execute();
1086
+
1087
+ /*! for backward compatibility */
1088
+ msgpack::object const& data();
1089
+
1090
+ /*! for backward compatibility */
1091
+ msgpack::zone* release_zone();
1092
+
1093
+ /*! for backward compatibility */
1094
+ void reset_zone();
1095
+
1096
+ /*! for backward compatibility */
1097
+ void reset();
138
1098
 
139
1099
  public:
140
- // These functions are usable when non-MessagePack message follows after
141
- // MessagePack message.
142
- size_t parsed_size() const;
1100
+ // These functions are usable when non-MessagePack message follows after
1101
+ // MessagePack message.
1102
+ std::size_t parsed_size() const;
143
1103
 
144
- /*! get address of the buffer that is not parsed */
145
- char* nonparsed_buffer();
146
- size_t nonparsed_size() const;
1104
+ /*! get address of the buffer that is not parsed */
1105
+ char* nonparsed_buffer();
1106
+ std::size_t nonparsed_size() const;
147
1107
 
148
- /*! skip specified size of non-parsed buffer, leaving the buffer */
149
- // Note that the `size' argument must be smaller than nonparsed_size()
150
- void skip_nonparsed_buffer(size_t size);
1108
+ /*! skip specified size of non-parsed buffer, leaving the buffer */
1109
+ // Note that the `size' argument must be smaller than nonparsed_size()
1110
+ void skip_nonparsed_buffer(std::size_t size);
151
1111
 
152
- /*! remove unparsed buffer from unpacker */
153
- // Note that reset() leaves non-parsed buffer.
154
- void remove_nonparsed_buffer();
1112
+ /*! remove unparsed buffer from unpacker */
1113
+ // Note that reset() leaves non-parsed buffer.
1114
+ void remove_nonparsed_buffer();
155
1115
 
156
1116
  private:
157
- typedef msgpack_unpacker base;
1117
+ void expand_buffer(std::size_t size);
1118
+ int execute_imp();
1119
+ bool flush_zone();
1120
+ static bool default_reference_func(msgpack::type::object_type type, std::size_t len, void*);
158
1121
 
159
1122
  private:
160
- unpacker(const unpacker&);
1123
+ char* m_buffer;
1124
+ std::size_t m_used;
1125
+ std::size_t m_free;
1126
+ std::size_t m_off;
1127
+ std::size_t m_parsed;
1128
+ msgpack::unique_ptr<msgpack::zone> m_z;
1129
+ std::size_t m_initial_buffer_size;
1130
+ detail::context m_ctx;
1131
+
1132
+ #if defined(MSGPACK_USE_CPP03)
1133
+ private:
1134
+ unpacker(const unpacker&);
1135
+ unpacker& operator=(const unpacker&);
1136
+ #else // defined(MSGPACK_USE_CPP03)
1137
+ unpacker(const unpacker&) = delete;
1138
+ unpacker& operator=(const unpacker&) = delete;
1139
+ #endif // defined(MSGPACK_USE_CPP03)
161
1140
  };
162
1141
 
163
-
164
- static void unpack(unpacked* result,
165
- const char* data, size_t len, size_t* offset = NULL);
1142
+ #if !defined(MSGPACK_USE_CPP03)
1143
+
1144
+ unpacked unpack(
1145
+ const char* data, std::size_t len, std::size_t& off, bool& referenced,
1146
+ unpack_reference_func f = nullptr, void* user_data = nullptr,
1147
+ unpack_limit const& limit = unpack_limit());
1148
+ unpacked unpack(
1149
+ const char* data, std::size_t len, std::size_t& off,
1150
+ unpack_reference_func f = nullptr, void* user_data = nullptr,
1151
+ unpack_limit const& limit = unpack_limit());
1152
+ unpacked unpack(
1153
+ const char* data, std::size_t len, bool& referenced,
1154
+ unpack_reference_func f = nullptr, void* user_data = nullptr,
1155
+ unpack_limit const& limit = unpack_limit());
1156
+ unpacked unpack(
1157
+ const char* data, std::size_t len,
1158
+ unpack_reference_func f = nullptr, void* user_data = nullptr,
1159
+ unpack_limit const& limit = unpack_limit());
1160
+
1161
+ #endif // !defined(MSGPACK_USE_CPP03)
1162
+
1163
+
1164
+ void unpack(unpacked& result,
1165
+ const char* data, std::size_t len, std::size_t& off, bool& referenced,
1166
+ unpack_reference_func f = nullptr, void* user_data = nullptr,
1167
+ unpack_limit const& limit = unpack_limit());
1168
+ void unpack(unpacked& result,
1169
+ const char* data, std::size_t len, std::size_t& off,
1170
+ unpack_reference_func f = nullptr, void* user_data = nullptr,
1171
+ unpack_limit const& limit = unpack_limit());
1172
+ void unpack(unpacked& result,
1173
+ const char* data, std::size_t len, bool& referenced,
1174
+ unpack_reference_func f = nullptr, void* user_data = nullptr,
1175
+ unpack_limit const& limit = unpack_limit());
1176
+
1177
+ void unpack(unpacked& result,
1178
+ const char* data, std::size_t len,
1179
+ unpack_reference_func f = nullptr, void* user_data = nullptr,
1180
+ unpack_limit const& limit = unpack_limit());
1181
+
1182
+ msgpack::object unpack(
1183
+ msgpack::zone& z,
1184
+ const char* data, std::size_t len, std::size_t& off, bool& referenced,
1185
+ unpack_reference_func f = nullptr, void* user_data = nullptr,
1186
+ unpack_limit const& limit = unpack_limit());
1187
+ msgpack::object unpack(
1188
+ msgpack::zone& z,
1189
+ const char* data, std::size_t len, std::size_t& off,
1190
+ unpack_reference_func f = nullptr, void* user_data = nullptr,
1191
+ unpack_limit const& limit = unpack_limit());
1192
+ msgpack::object unpack(
1193
+ msgpack::zone& z,
1194
+ const char* data, std::size_t len, bool& referenced,
1195
+ unpack_reference_func f = nullptr, void* user_data = nullptr,
1196
+ unpack_limit const& limit = unpack_limit());
1197
+ msgpack::object unpack(
1198
+ msgpack::zone& z,
1199
+ const char* data, std::size_t len,
1200
+ unpack_reference_func f = nullptr, void* user_data = nullptr,
1201
+ unpack_limit const& limit = unpack_limit());
166
1202
 
167
1203
 
168
1204
  // obsolete
1205
+ void unpack(unpacked* result,
1206
+ const char* data, std::size_t len, std::size_t* off = nullptr, bool* referenced = nullptr,
1207
+ unpack_reference_func f = nullptr, void* user_data = nullptr,
1208
+ unpack_limit const& limit = unpack_limit());
1209
+
1210
+
1211
+ // for internal use
169
1212
  typedef enum {
170
- UNPACK_SUCCESS = 2,
171
- UNPACK_EXTRA_BYTES = 1,
172
- UNPACK_CONTINUE = 0,
173
- UNPACK_PARSE_ERROR = -1,
1213
+ UNPACK_SUCCESS = 2,
1214
+ UNPACK_EXTRA_BYTES = 1,
1215
+ UNPACK_CONTINUE = 0,
1216
+ UNPACK_PARSE_ERROR = -1
174
1217
  } unpack_return;
175
1218
 
176
- // obsolete
177
- static unpack_return unpack(const char* data, size_t len, size_t* off,
178
- zone* z, object* result);
1219
+ inline unpacker::unpacker(unpack_reference_func f,
1220
+ void* user_data,
1221
+ std::size_t initial_buffer_size,
1222
+ unpack_limit const& limit)
1223
+ :m_z(new msgpack::zone), m_ctx(f, user_data, limit)
1224
+ {
1225
+ if(initial_buffer_size < COUNTER_SIZE) {
1226
+ initial_buffer_size = COUNTER_SIZE;
1227
+ }
1228
+
1229
+ char* buffer = static_cast<char*>(::malloc(initial_buffer_size));
1230
+ if(!buffer) {
1231
+ throw std::bad_alloc();
1232
+ }
1233
+
1234
+ m_buffer = buffer;
1235
+ m_used = COUNTER_SIZE;
1236
+ m_free = initial_buffer_size - m_used;
1237
+ m_off = COUNTER_SIZE;
1238
+ m_parsed = 0;
1239
+ m_initial_buffer_size = initial_buffer_size;
1240
+
1241
+ detail::init_count(m_buffer);
1242
+
1243
+ m_ctx.init();
1244
+ m_ctx.user().set_zone(*m_z);
1245
+ m_ctx.user().set_referenced(false);
1246
+ }
179
1247
 
1248
+ #if !defined(MSGPACK_USE_CPP03)
1249
+ // Move constructor and move assignment operator
1250
+
1251
+ inline unpacker::unpacker(unpacker&& other)
1252
+ :m_buffer(other.m_buffer),
1253
+ m_used(other.m_used),
1254
+ m_free(other.m_free),
1255
+ m_off(other.m_off),
1256
+ m_parsed(other.m_parsed),
1257
+ m_z(std::move(other.m_z)),
1258
+ m_initial_buffer_size(other.m_initial_buffer_size),
1259
+ m_ctx(other.m_ctx) {
1260
+ other.m_buffer = nullptr;
1261
+ }
180
1262
 
181
- // obsolete
182
- static object unpack(const char* data, size_t len, zone& z, size_t* off = NULL);
1263
+ inline unpacker& unpacker::operator=(unpacker&& other) {
1264
+ this->~unpacker();
1265
+ new (this) unpacker(std::move(other));
1266
+ return *this;
1267
+ }
183
1268
 
1269
+ #endif // !defined(MSGPACK_USE_CPP03)
184
1270
 
185
- inline unpacker::unpacker(size_t initial_buffer_size)
186
- {
187
- if(!msgpack_unpacker_init(this, initial_buffer_size)) {
188
- throw std::bad_alloc();
189
- }
190
- }
191
1271
 
192
1272
  inline unpacker::~unpacker()
193
1273
  {
194
- msgpack_unpacker_destroy(this);
1274
+ // These checks are required for move operations.
1275
+ if (m_buffer) detail::decr_count(m_buffer);
195
1276
  }
196
1277
 
197
1278
 
198
- inline void unpacker::reserve_buffer(size_t size)
1279
+ inline void unpacker::reserve_buffer(std::size_t size)
199
1280
  {
200
- if(!msgpack_unpacker_reserve_buffer(this, size)) {
201
- throw std::bad_alloc();
202
- }
1281
+ if(m_free >= size) return;
1282
+ expand_buffer(size);
203
1283
  }
204
1284
 
205
- inline char* unpacker::buffer()
1285
+ inline void unpacker::expand_buffer(std::size_t size)
206
1286
  {
207
- return msgpack_unpacker_buffer(this);
1287
+ if(m_used == m_off && detail::get_count(m_buffer) == 1
1288
+ && !m_ctx.user().referenced()) {
1289
+ // rewind buffer
1290
+ m_free += m_used - COUNTER_SIZE;
1291
+ m_used = COUNTER_SIZE;
1292
+ m_off = COUNTER_SIZE;
1293
+
1294
+ if(m_free >= size) return;
1295
+ }
1296
+
1297
+ if(m_off == COUNTER_SIZE) {
1298
+ std::size_t next_size = (m_used + m_free) * 2; // include COUNTER_SIZE
1299
+ while(next_size < size + m_used) {
1300
+ std::size_t tmp_next_size = next_size * 2;
1301
+ if (tmp_next_size <= next_size) {
1302
+ next_size = size + m_used;
1303
+ break;
1304
+ }
1305
+ next_size = tmp_next_size;
1306
+ }
1307
+
1308
+ char* tmp = static_cast<char*>(::realloc(m_buffer, next_size));
1309
+ if(!tmp) {
1310
+ throw std::bad_alloc();
1311
+ }
1312
+
1313
+ m_buffer = tmp;
1314
+ m_free = next_size - m_used;
1315
+
1316
+ } else {
1317
+ std::size_t next_size = m_initial_buffer_size; // include COUNTER_SIZE
1318
+ std::size_t not_parsed = m_used - m_off;
1319
+ while(next_size < size + not_parsed + COUNTER_SIZE) {
1320
+ std::size_t tmp_next_size = next_size * 2;
1321
+ if (tmp_next_size <= next_size) {
1322
+ next_size = size + not_parsed + COUNTER_SIZE;
1323
+ break;
1324
+ }
1325
+ next_size = tmp_next_size;
1326
+ }
1327
+
1328
+ char* tmp = static_cast<char*>(::malloc(next_size));
1329
+ if(!tmp) {
1330
+ throw std::bad_alloc();
1331
+ }
1332
+
1333
+ detail::init_count(tmp);
1334
+
1335
+ std::memcpy(tmp+COUNTER_SIZE, m_buffer + m_off, not_parsed);
1336
+
1337
+ if(m_ctx.user().referenced()) {
1338
+ try {
1339
+ m_z->push_finalizer(&detail::decr_count, m_buffer);
1340
+ }
1341
+ catch (...) {
1342
+ ::free(tmp);
1343
+ throw;
1344
+ }
1345
+ m_ctx.user().set_referenced(false);
1346
+ } else {
1347
+ detail::decr_count(m_buffer);
1348
+ }
1349
+
1350
+ m_buffer = tmp;
1351
+ m_used = not_parsed + COUNTER_SIZE;
1352
+ m_free = next_size - m_used;
1353
+ m_off = COUNTER_SIZE;
1354
+ }
208
1355
  }
209
1356
 
210
- inline size_t unpacker::buffer_capacity() const
1357
+ inline char* unpacker::buffer()
211
1358
  {
212
- return msgpack_unpacker_buffer_capacity(this);
1359
+ return m_buffer + m_used;
213
1360
  }
214
1361
 
215
- inline void unpacker::buffer_consumed(size_t size)
1362
+ inline std::size_t unpacker::buffer_capacity() const
216
1363
  {
217
- return msgpack_unpacker_buffer_consumed(this, size);
1364
+ return m_free;
218
1365
  }
219
1366
 
220
- inline bool unpacker::next(unpacked* result)
1367
+ inline void unpacker::buffer_consumed(std::size_t size)
221
1368
  {
222
- int ret = msgpack_unpacker_execute(this);
1369
+ m_used += size;
1370
+ m_free -= size;
1371
+ }
223
1372
 
224
- if(ret < 0) {
225
- throw unpack_error("parse error");
226
- }
1373
+ inline bool unpacker::next(unpacked& result, bool& referenced)
1374
+ {
1375
+ referenced = false;
1376
+ int ret = execute_imp();
1377
+ if(ret < 0) {
1378
+ throw msgpack::parse_error("parse error");
1379
+ }
1380
+
1381
+ if(ret == 0) {
1382
+ result.zone().reset();
1383
+ result.set(object());
1384
+ return false;
1385
+
1386
+ } else {
1387
+ referenced = m_ctx.user().referenced();
1388
+ result.zone().reset( release_zone() );
1389
+ result.set(data());
1390
+ reset();
1391
+ return true;
1392
+ }
1393
+ }
227
1394
 
228
- if(ret == 0) {
229
- result->zone().reset();
230
- result->get() = object();
231
- return false;
1395
+ inline bool unpacker::next(unpacked& result)
1396
+ {
1397
+ bool referenced;
1398
+ return next(result, referenced);
1399
+ }
232
1400
 
233
- } else {
234
- result->zone().reset( release_zone() );
235
- result->get() = data();
236
- reset();
237
- return true;
238
- }
1401
+ inline bool unpacker::next(unpacked* result)
1402
+ {
1403
+ return next(*result);
239
1404
  }
240
1405
 
241
1406
 
242
1407
  inline bool unpacker::execute()
243
1408
  {
244
- int ret = msgpack_unpacker_execute(this);
245
- if(ret < 0) {
246
- throw unpack_error("parse error");
247
- } else if(ret == 0) {
248
- return false;
249
- } else {
250
- return true;
251
- }
1409
+ int ret = execute_imp();
1410
+ if(ret < 0) {
1411
+ throw msgpack::parse_error("parse error");
1412
+ } else if(ret == 0) {
1413
+ return false;
1414
+ } else {
1415
+ return true;
1416
+ }
252
1417
  }
253
1418
 
254
- inline object unpacker::data()
1419
+ inline int unpacker::execute_imp()
255
1420
  {
256
- return msgpack_unpacker_data(this);
1421
+ std::size_t off = m_off;
1422
+ int ret = m_ctx.execute(m_buffer, m_used, m_off);
1423
+ if(m_off > off) {
1424
+ m_parsed += m_off - off;
1425
+ }
1426
+ return ret;
257
1427
  }
258
1428
 
259
- inline zone* unpacker::release_zone()
1429
+ inline msgpack::object const& unpacker::data()
260
1430
  {
261
- return static_cast<msgpack::zone*>(msgpack_unpacker_release_zone(static_cast<msgpack_unpacker*>(this)));
1431
+ return m_ctx.data();
1432
+ }
1433
+
1434
+ inline msgpack::zone* unpacker::release_zone()
1435
+ {
1436
+ if(!flush_zone()) {
1437
+ return nullptr;
1438
+ }
1439
+
1440
+ msgpack::zone* r = new msgpack::zone;
1441
+ msgpack::zone* old = m_z.release();
1442
+ m_z.reset(r);
1443
+ m_ctx.user().set_zone(*m_z);
1444
+
1445
+ return old;
262
1446
  }
263
1447
 
264
1448
  inline void unpacker::reset_zone()
265
1449
  {
266
- msgpack_unpacker_reset_zone(this);
1450
+ m_z->clear();
267
1451
  }
268
1452
 
269
- inline void unpacker::reset()
1453
+ inline bool unpacker::flush_zone()
270
1454
  {
271
- msgpack_unpacker_reset(this);
1455
+ if(m_ctx.user().referenced()) {
1456
+ try {
1457
+ m_z->push_finalizer(&detail::decr_count, m_buffer);
1458
+ } catch (...) {
1459
+ return false;
1460
+ }
1461
+ m_ctx.user().set_referenced(false);
1462
+
1463
+ detail::incr_count(m_buffer);
1464
+ }
1465
+
1466
+ return true;
272
1467
  }
273
1468
 
1469
+ inline void unpacker::reset()
1470
+ {
1471
+ m_ctx.init();
1472
+ // don't reset referenced flag
1473
+ m_parsed = 0;
1474
+ }
274
1475
 
275
- inline size_t unpacker::message_size() const
1476
+ inline std::size_t unpacker::message_size() const
276
1477
  {
277
- return msgpack_unpacker_message_size(this);
1478
+ return m_parsed - m_off + m_used;
278
1479
  }
279
1480
 
280
- inline size_t unpacker::parsed_size() const
1481
+ inline std::size_t unpacker::parsed_size() const
281
1482
  {
282
- return msgpack_unpacker_parsed_size(this);
1483
+ return m_parsed;
283
1484
  }
284
1485
 
285
1486
  inline char* unpacker::nonparsed_buffer()
286
1487
  {
287
- return base::buffer + base::off;
1488
+ return m_buffer + m_off;
288
1489
  }
289
1490
 
290
- inline size_t unpacker::nonparsed_size() const
1491
+ inline std::size_t unpacker::nonparsed_size() const
291
1492
  {
292
- return base::used - base::off;
1493
+ return m_used - m_off;
293
1494
  }
294
1495
 
295
- inline void unpacker::skip_nonparsed_buffer(size_t size)
1496
+ inline void unpacker::skip_nonparsed_buffer(std::size_t size)
296
1497
  {
297
- base::off += size;
1498
+ m_off += size;
298
1499
  }
299
1500
 
300
1501
  inline void unpacker::remove_nonparsed_buffer()
301
1502
  {
302
- base::used = base::off;
1503
+ m_used = m_off;
303
1504
  }
304
1505
 
1506
+ namespace detail {
305
1507
 
306
- inline void unpack(unpacked* result,
307
- const char* data, size_t len, size_t* offset)
1508
+ inline unpack_return
1509
+ unpack_imp(const char* data, std::size_t len, std::size_t& off,
1510
+ msgpack::zone& result_zone, msgpack::object& result, bool& referenced,
1511
+ unpack_reference_func f = nullptr, void* user_data = nullptr,
1512
+ unpack_limit const& limit = unpack_limit())
308
1513
  {
309
- msgpack::object obj;
310
- std::auto_ptr<msgpack::zone> z(new zone());
1514
+ std::size_t noff = off;
311
1515
 
312
- unpack_return ret = (unpack_return)msgpack_unpack(
313
- data, len, offset, z.get(),
314
- reinterpret_cast<msgpack_object*>(&obj));
1516
+ if(len <= noff) {
1517
+ // FIXME
1518
+ return UNPACK_CONTINUE;
1519
+ }
315
1520
 
316
- switch(ret) {
317
- case UNPACK_SUCCESS:
318
- result->get() = obj;
319
- result->zone() = z;
320
- return;
1521
+ detail::context ctx(f, user_data, limit);
1522
+ ctx.init();
321
1523
 
322
- case UNPACK_EXTRA_BYTES:
323
- result->get() = obj;
324
- result->zone() = z;
325
- return;
1524
+ ctx.user().set_zone(result_zone);
1525
+ ctx.user().set_referenced(false);
1526
+ referenced = false;
326
1527
 
327
- case UNPACK_CONTINUE:
328
- throw unpack_error("insufficient bytes");
1528
+ int e = ctx.execute(data, len, noff);
1529
+ if(e < 0) {
1530
+ return UNPACK_PARSE_ERROR;
1531
+ }
329
1532
 
330
- case UNPACK_PARSE_ERROR:
331
- default:
332
- throw unpack_error("parse error");
333
- }
1533
+ referenced = ctx.user().referenced();
1534
+ off = noff;
1535
+
1536
+ if(e == 0) {
1537
+ return UNPACK_CONTINUE;
1538
+ }
1539
+
1540
+ result = ctx.data();
1541
+
1542
+ if(noff < len) {
1543
+ return UNPACK_EXTRA_BYTES;
1544
+ }
1545
+
1546
+ return UNPACK_SUCCESS;
334
1547
  }
335
1548
 
1549
+ } // detail
336
1550
 
337
- // obsolete
338
- inline unpack_return unpack(const char* data, size_t len, size_t* off,
339
- zone* z, object* result)
1551
+ // reference version
1552
+
1553
+ #if !defined(MSGPACK_USE_CPP03)
1554
+
1555
+ inline unpacked unpack(
1556
+ const char* data, std::size_t len, std::size_t& off, bool& referenced,
1557
+ unpack_reference_func f, void* user_data, unpack_limit const& limit)
340
1558
  {
341
- return (unpack_return)msgpack_unpack(data, len, off,
342
- z, reinterpret_cast<msgpack_object*>(result));
1559
+ msgpack::object obj;
1560
+ msgpack::unique_ptr<msgpack::zone> z(new msgpack::zone);
1561
+ referenced = false;
1562
+ unpack_return ret = detail::unpack_imp(
1563
+ data, len, off, *z, obj, referenced, f, user_data, limit);
1564
+
1565
+ switch(ret) {
1566
+ case UNPACK_SUCCESS:
1567
+ return unpacked(obj, msgpack::move(z));
1568
+ case UNPACK_EXTRA_BYTES:
1569
+ return unpacked(obj, msgpack::move(z));
1570
+ case UNPACK_CONTINUE:
1571
+ throw msgpack::insufficient_bytes("insufficient bytes");
1572
+ case UNPACK_PARSE_ERROR:
1573
+ default:
1574
+ throw msgpack::parse_error("parse error");
1575
+ }
1576
+ return unpacked();
343
1577
  }
344
1578
 
345
- // obsolete
346
- inline object unpack(const char* data, size_t len, zone& z, size_t* off)
1579
+ inline unpacked unpack(
1580
+ const char* data, std::size_t len, std::size_t& off,
1581
+ unpack_reference_func f, void* user_data, unpack_limit const& limit)
347
1582
  {
348
- object result;
1583
+ bool referenced;
1584
+ return unpack(data, len, off, referenced, f, user_data, limit);
1585
+ }
349
1586
 
350
- switch( msgpack::unpack(data, len, off, &z, &result) ) {
351
- case UNPACK_SUCCESS:
352
- return result;
1587
+ inline unpacked unpack(
1588
+ const char* data, std::size_t len, bool& referenced,
1589
+ unpack_reference_func f, void* user_data, unpack_limit const& limit)
1590
+ {
1591
+ std::size_t off = 0;
1592
+ return unpack(data, len, off, referenced, f, user_data, limit);
1593
+ }
353
1594
 
354
- case UNPACK_EXTRA_BYTES:
355
- if(off) {
356
- return result;
357
- } else {
358
- throw unpack_error("extra bytes");
359
- }
1595
+ inline unpacked unpack(
1596
+ const char* data, std::size_t len,
1597
+ unpack_reference_func f, void* user_data, unpack_limit const& limit)
1598
+ {
1599
+ bool referenced;
1600
+ std::size_t off = 0;
1601
+ return unpack(data, len, off, referenced, f, user_data, limit);
1602
+ }
360
1603
 
361
- case UNPACK_CONTINUE:
362
- throw unpack_error("insufficient bytes");
1604
+ #endif // !defined(MSGPACK_USE_CPP03)
363
1605
 
364
- case UNPACK_PARSE_ERROR:
365
- default:
366
- throw unpack_error("parse error");
367
- }
1606
+ inline void unpack(unpacked& result,
1607
+ const char* data, std::size_t len, std::size_t& off, bool& referenced,
1608
+ unpack_reference_func f, void* user_data, unpack_limit const& limit)
1609
+ {
1610
+ msgpack::object obj;
1611
+ msgpack::unique_ptr<msgpack::zone> z(new msgpack::zone);
1612
+ referenced = false;
1613
+ unpack_return ret = detail::unpack_imp(
1614
+ data, len, off, *z, obj, referenced, f, user_data, limit);
1615
+
1616
+ switch(ret) {
1617
+ case UNPACK_SUCCESS:
1618
+ result.set(obj);
1619
+ result.zone() = msgpack::move(z);
1620
+ return;
1621
+ case UNPACK_EXTRA_BYTES:
1622
+ result.set(obj);
1623
+ result.zone() = msgpack::move(z);
1624
+ return;
1625
+ case UNPACK_CONTINUE:
1626
+ throw msgpack::insufficient_bytes("insufficient bytes");
1627
+ case UNPACK_PARSE_ERROR:
1628
+ default:
1629
+ throw msgpack::parse_error("parse error");
1630
+ }
368
1631
  }
369
1632
 
1633
+ inline void unpack(unpacked& result,
1634
+ const char* data, std::size_t len, std::size_t& off,
1635
+ unpack_reference_func f, void* user_data, unpack_limit const& limit)
1636
+ {
1637
+ bool referenced;
1638
+ unpack(result, data, len, off, referenced, f, user_data, limit);
1639
+ }
1640
+
1641
+ inline void unpack(unpacked& result,
1642
+ const char* data, std::size_t len, bool& referenced,
1643
+ unpack_reference_func f, void* user_data, unpack_limit const& limit)
1644
+ {
1645
+ std::size_t off = 0;
1646
+ unpack(result, data, len, off, referenced, f, user_data, limit);
1647
+ }
1648
+
1649
+ inline void unpack(unpacked& result,
1650
+ const char* data, std::size_t len,
1651
+ unpack_reference_func f, void* user_data, unpack_limit const& limit)
1652
+ {
1653
+ bool referenced;
1654
+ std::size_t off = 0;
1655
+ unpack(result, data, len, off, referenced, f, user_data, limit);
1656
+ }
1657
+
1658
+
1659
+ inline msgpack::object unpack(
1660
+ msgpack::zone& z,
1661
+ const char* data, std::size_t len, std::size_t& off, bool& referenced,
1662
+ unpack_reference_func f, void* user_data, unpack_limit const& limit)
1663
+ {
1664
+ msgpack::object obj;
1665
+ referenced = false;
1666
+ unpack_return ret = detail::unpack_imp(
1667
+ data, len, off, z, obj, referenced, f, user_data, limit);
1668
+
1669
+ switch(ret) {
1670
+ case UNPACK_SUCCESS:
1671
+ return obj;
1672
+ case UNPACK_EXTRA_BYTES:
1673
+ return obj;
1674
+ case UNPACK_CONTINUE:
1675
+ throw msgpack::insufficient_bytes("insufficient bytes");
1676
+ case UNPACK_PARSE_ERROR:
1677
+ default:
1678
+ throw msgpack::parse_error("parse error");
1679
+ }
1680
+ return obj;
1681
+ }
1682
+
1683
+ inline msgpack::object unpack(
1684
+ msgpack::zone& z,
1685
+ const char* data, std::size_t len, std::size_t& off,
1686
+ unpack_reference_func f, void* user_data, unpack_limit const& limit)
1687
+ {
1688
+ bool referenced;
1689
+ return unpack(z, data, len, off, referenced, f, user_data, limit);
1690
+ }
1691
+
1692
+ inline msgpack::object unpack(
1693
+ msgpack::zone& z,
1694
+ const char* data, std::size_t len, bool& referenced,
1695
+ unpack_reference_func f, void* user_data, unpack_limit const& limit)
1696
+ {
1697
+ std::size_t off = 0;
1698
+ return unpack(z, data, len, off, referenced, f, user_data, limit);
1699
+ }
1700
+
1701
+ inline msgpack::object unpack(
1702
+ msgpack::zone& z,
1703
+ const char* data, std::size_t len,
1704
+ unpack_reference_func f, void* user_data, unpack_limit const& limit)
1705
+ {
1706
+ bool referenced;
1707
+ std::size_t off = 0;
1708
+ return unpack(z, data, len, off, referenced, f, user_data, limit);
1709
+ }
1710
+
1711
+ // obsolete
1712
+ // pointer version
1713
+ inline void unpack(unpacked* result,
1714
+ const char* data, std::size_t len, std::size_t* off, bool* referenced,
1715
+ unpack_reference_func f, void* user_data, unpack_limit const& limit)
1716
+ {
1717
+ if (off)
1718
+ if (referenced) unpack(*result, data, len, *off, *referenced, f, user_data, limit);
1719
+ else unpack(*result, data, len, *off, f, user_data, limit);
1720
+ else
1721
+ if (referenced) unpack(*result, data, len, *referenced, f, user_data, limit);
1722
+ else unpack(*result, data, len, f, user_data, limit);
1723
+ }
1724
+
1725
+ inline bool unpacker::default_reference_func(msgpack::type::object_type /*type*/, std::size_t /*len*/, void*)
1726
+ {
1727
+ return true;
1728
+ }
1729
+
1730
+ } // MSGPACK_API_VERSION_NAMESPACE(v1)
370
1731
 
371
1732
  } // namespace msgpack
372
1733
 
373
- #endif /* msgpack/unpack.hpp */
374
1734
 
1735
+ #endif /* msgpack/unpack.hpp */