cybrid_api_bank_ruby 0.8.12 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (197) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/README.md +5 -5
  4. data/cybrid_api_bank_ruby.gemspec +1 -1
  5. data/docs/BankBankModel.md +2 -0
  6. data/docs/BanksBankApi.md +1 -1
  7. data/docs/PostBankBankModel.md +2 -0
  8. data/lib/cybrid_api_bank_ruby/api/accounts_bank_api.rb +1 -1
  9. data/lib/cybrid_api_bank_ruby/api/assets_bank_api.rb +1 -1
  10. data/lib/cybrid_api_bank_ruby/api/banks_bank_api.rb +1 -1
  11. data/lib/cybrid_api_bank_ruby/api/customers_bank_api.rb +1 -1
  12. data/lib/cybrid_api_bank_ruby/api/identity_records_bank_api.rb +1 -1
  13. data/lib/cybrid_api_bank_ruby/api/prices_bank_api.rb +1 -1
  14. data/lib/cybrid_api_bank_ruby/api/quotes_bank_api.rb +1 -1
  15. data/lib/cybrid_api_bank_ruby/api/symbols_bank_api.rb +1 -1
  16. data/lib/cybrid_api_bank_ruby/api/trades_bank_api.rb +1 -1
  17. data/lib/cybrid_api_bank_ruby/api/trading_configurations_bank_api.rb +1 -1
  18. data/lib/cybrid_api_bank_ruby/api/verification_keys_bank_api.rb +1 -1
  19. data/lib/cybrid_api_bank_ruby/api_client.rb +1 -1
  20. data/lib/cybrid_api_bank_ruby/api_error.rb +1 -1
  21. data/lib/cybrid_api_bank_ruby/configuration.rb +1 -1
  22. data/lib/cybrid_api_bank_ruby/models/account_bank_model.rb +3 -3
  23. data/lib/cybrid_api_bank_ruby/models/account_list_bank_model.rb +1 -1
  24. data/lib/cybrid_api_bank_ruby/models/asset_bank_model.rb +1 -1
  25. data/lib/cybrid_api_bank_ruby/models/asset_list_bank_model.rb +1 -1
  26. data/lib/cybrid_api_bank_ruby/models/attestation_details_bank_model.rb +1 -1
  27. data/lib/cybrid_api_bank_ruby/models/bank_bank_model.rb +14 -2
  28. data/lib/cybrid_api_bank_ruby/models/bank_list_bank_model.rb +1 -1
  29. data/lib/cybrid_api_bank_ruby/models/customer_bank_model.rb +1 -1
  30. data/lib/cybrid_api_bank_ruby/models/customer_list_bank_model.rb +1 -1
  31. data/lib/cybrid_api_bank_ruby/models/exchange_account_bank_model.rb +1 -1
  32. data/lib/cybrid_api_bank_ruby/models/exchange_bank_model.rb +1 -1
  33. data/lib/cybrid_api_bank_ruby/models/fee_bank_model.rb +1 -1
  34. data/lib/cybrid_api_bank_ruby/models/identity_record_bank_model.rb +1 -1
  35. data/lib/cybrid_api_bank_ruby/models/post_account_bank_model.rb +1 -1
  36. data/lib/cybrid_api_bank_ruby/models/post_bank_bank_model.rb +19 -2
  37. data/lib/cybrid_api_bank_ruby/models/post_customer_bank_model.rb +1 -1
  38. data/lib/cybrid_api_bank_ruby/models/post_fee_bank_model.rb +1 -1
  39. data/lib/cybrid_api_bank_ruby/models/post_identity_record_attestation_details_bank_model.rb +1 -1
  40. data/lib/cybrid_api_bank_ruby/models/post_identity_record_bank_model.rb +1 -1
  41. data/lib/cybrid_api_bank_ruby/models/post_quote_bank_model.rb +1 -1
  42. data/lib/cybrid_api_bank_ruby/models/post_trade_bank_model.rb +1 -1
  43. data/lib/cybrid_api_bank_ruby/models/post_trading_configuration_bank_model.rb +1 -1
  44. data/lib/cybrid_api_bank_ruby/models/post_verification_key_bank_model.rb +1 -1
  45. data/lib/cybrid_api_bank_ruby/models/quote_bank_model.rb +1 -1
  46. data/lib/cybrid_api_bank_ruby/models/quote_list_bank_model.rb +1 -1
  47. data/lib/cybrid_api_bank_ruby/models/symbol_price_bank_model.rb +1 -1
  48. data/lib/cybrid_api_bank_ruby/models/system_account_bank_model.rb +1 -1
  49. data/lib/cybrid_api_bank_ruby/models/trade_bank_model.rb +1 -1
  50. data/lib/cybrid_api_bank_ruby/models/trade_list_bank_model.rb +1 -1
  51. data/lib/cybrid_api_bank_ruby/models/trading_configuration_bank_model.rb +1 -1
  52. data/lib/cybrid_api_bank_ruby/models/trading_configuration_list_bank_model.rb +1 -1
  53. data/lib/cybrid_api_bank_ruby/models/verification_key_bank_model.rb +1 -1
  54. data/lib/cybrid_api_bank_ruby/models/verification_key_list_bank_model.rb +1 -1
  55. data/lib/cybrid_api_bank_ruby/version.rb +2 -2
  56. data/lib/cybrid_api_bank_ruby.rb +1 -1
  57. data/spec/api/accounts_bank_api_spec.rb +1 -1
  58. data/spec/api/assets_bank_api_spec.rb +1 -1
  59. data/spec/api/banks_bank_api_spec.rb +1 -1
  60. data/spec/api/customers_bank_api_spec.rb +1 -1
  61. data/spec/api/identity_records_bank_api_spec.rb +1 -1
  62. data/spec/api/prices_bank_api_spec.rb +1 -1
  63. data/spec/api/quotes_bank_api_spec.rb +1 -1
  64. data/spec/api/symbols_bank_api_spec.rb +1 -1
  65. data/spec/api/trades_bank_api_spec.rb +1 -1
  66. data/spec/api/trading_configurations_bank_api_spec.rb +1 -1
  67. data/spec/api/verification_keys_bank_api_spec.rb +1 -1
  68. data/spec/api_client_spec.rb +1 -1
  69. data/spec/configuration_spec.rb +1 -1
  70. data/spec/models/account_bank_model_spec.rb +2 -2
  71. data/spec/models/account_list_bank_model_spec.rb +1 -1
  72. data/spec/models/asset_bank_model_spec.rb +1 -1
  73. data/spec/models/asset_list_bank_model_spec.rb +1 -1
  74. data/spec/models/attestation_details_bank_model_spec.rb +1 -1
  75. data/spec/models/bank_bank_model_spec.rb +7 -1
  76. data/spec/models/bank_list_bank_model_spec.rb +1 -1
  77. data/spec/models/customer_bank_model_spec.rb +1 -1
  78. data/spec/models/customer_list_bank_model_spec.rb +1 -1
  79. data/spec/models/exchange_account_bank_model_spec.rb +1 -1
  80. data/spec/models/exchange_bank_model_spec.rb +1 -1
  81. data/spec/models/fee_bank_model_spec.rb +1 -1
  82. data/spec/models/identity_record_bank_model_spec.rb +1 -1
  83. data/spec/models/post_account_bank_model_spec.rb +1 -1
  84. data/spec/models/post_bank_bank_model_spec.rb +7 -1
  85. data/spec/models/post_customer_bank_model_spec.rb +1 -1
  86. data/spec/models/post_fee_bank_model_spec.rb +1 -1
  87. data/spec/models/post_identity_record_attestation_details_bank_model_spec.rb +1 -1
  88. data/spec/models/post_identity_record_bank_model_spec.rb +1 -1
  89. data/spec/models/post_quote_bank_model_spec.rb +1 -1
  90. data/spec/models/post_trade_bank_model_spec.rb +1 -1
  91. data/spec/models/post_trading_configuration_bank_model_spec.rb +1 -1
  92. data/spec/models/post_verification_key_bank_model_spec.rb +1 -1
  93. data/spec/models/quote_bank_model_spec.rb +1 -1
  94. data/spec/models/quote_list_bank_model_spec.rb +1 -1
  95. data/spec/models/symbol_price_bank_model_spec.rb +1 -1
  96. data/spec/models/system_account_bank_model_spec.rb +1 -1
  97. data/spec/models/trade_bank_model_spec.rb +1 -1
  98. data/spec/models/trade_list_bank_model_spec.rb +1 -1
  99. data/spec/models/trading_configuration_bank_model_spec.rb +1 -1
  100. data/spec/models/trading_configuration_list_bank_model_spec.rb +1 -1
  101. data/spec/models/verification_key_bank_model_spec.rb +1 -1
  102. data/spec/models/verification_key_list_bank_model_spec.rb +1 -1
  103. data/spec/spec_helper.rb +1 -1
  104. data/vendor/bundle/ruby/3.1.0/cache/psych-4.0.4.gem +0 -0
  105. data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/byebug-11.1.3/gem_make.out +2 -2
  106. data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/ffi-1.15.5/gem_make.out +2 -2
  107. data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/jaro_winkler-1.5.4/gem_make.out +2 -2
  108. data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/psych-4.0.4/gem.build_complete +0 -0
  109. data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/psych-4.0.4/gem_make.out +27 -0
  110. data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/psych-4.0.4/mkmf.log +75 -0
  111. data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/psych-4.0.4/psych.so +0 -0
  112. data/vendor/bundle/ruby/3.1.0/extensions/x86_64-linux/3.1.0-static/stringio-3.0.2/gem_make.out +2 -2
  113. data/vendor/bundle/ruby/3.1.0/gems/byebug-11.1.3/ext/byebug/Makefile +2 -2
  114. data/vendor/bundle/ruby/3.1.0/gems/ffi-1.15.5/ext/ffi_c/Makefile +2 -2
  115. data/vendor/bundle/ruby/3.1.0/gems/jaro_winkler-1.5.4/ext/jaro_winkler/Makefile +2 -2
  116. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/.gitignore +16 -0
  117. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/Gemfile +9 -0
  118. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/LICENSE +21 -0
  119. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/Mavenfile +7 -0
  120. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/README.md +72 -0
  121. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/Rakefile +41 -0
  122. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/bin/console +7 -0
  123. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/bin/setup +6 -0
  124. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/.sitearchdir.time +0 -0
  125. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/Makefile +274 -0
  126. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/depend +5 -0
  127. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/extconf.rb +43 -0
  128. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych.c +37 -0
  129. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych.h +17 -0
  130. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych.o +0 -0
  131. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych.so +0 -0
  132. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_emitter.c +555 -0
  133. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_emitter.h +8 -0
  134. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_emitter.o +0 -0
  135. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_parser.c +579 -0
  136. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_parser.h +6 -0
  137. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_parser.o +0 -0
  138. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_to_ruby.c +39 -0
  139. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_to_ruby.h +8 -0
  140. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_to_ruby.o +0 -0
  141. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_yaml_tree.c +12 -0
  142. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_yaml_tree.h +8 -0
  143. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/psych_yaml_tree.o +0 -0
  144. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/LICENSE +19 -0
  145. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/api.c +1393 -0
  146. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/config.h +80 -0
  147. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/dumper.c +394 -0
  148. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/emitter.c +2358 -0
  149. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/loader.c +544 -0
  150. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/parser.c +1375 -0
  151. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/reader.c +469 -0
  152. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/scanner.c +3598 -0
  153. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/writer.c +141 -0
  154. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/yaml.h +1985 -0
  155. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/ext/psych/yaml/yaml_private.h +688 -0
  156. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/class_loader.rb +104 -0
  157. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/coder.rb +95 -0
  158. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/core_ext.rb +19 -0
  159. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/exception.rb +14 -0
  160. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/handler.rb +255 -0
  161. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/handlers/document_stream.rb +23 -0
  162. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/handlers/recorder.rb +40 -0
  163. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/json/ruby_events.rb +20 -0
  164. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/json/stream.rb +17 -0
  165. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/json/tree_builder.rb +13 -0
  166. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/json/yaml_events.rb +30 -0
  167. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/nodes/alias.rb +21 -0
  168. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/nodes/document.rb +63 -0
  169. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/nodes/mapping.rb +59 -0
  170. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/nodes/node.rb +75 -0
  171. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/nodes/scalar.rb +70 -0
  172. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/nodes/sequence.rb +84 -0
  173. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/nodes/stream.rb +40 -0
  174. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/nodes.rb +78 -0
  175. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/omap.rb +5 -0
  176. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/parser.rb +52 -0
  177. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/scalar_scanner.rb +142 -0
  178. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/set.rb +5 -0
  179. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/stream.rb +38 -0
  180. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/streaming.rb +28 -0
  181. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/syntax_error.rb +22 -0
  182. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/tree_builder.rb +137 -0
  183. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/versions.rb +10 -0
  184. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/visitors/depth_first.rb +27 -0
  185. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/visitors/emitter.rb +52 -0
  186. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/visitors/json_tree.rb +25 -0
  187. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/visitors/to_ruby.rb +434 -0
  188. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/visitors/visitor.rb +34 -0
  189. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/visitors/yaml_tree.rb +587 -0
  190. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/visitors.rb +7 -0
  191. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych/y.rb +10 -0
  192. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych.rb +741 -0
  193. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/lib/psych.so +0 -0
  194. data/vendor/bundle/ruby/3.1.0/gems/psych-4.0.4/psych.gemspec +69 -0
  195. data/vendor/bundle/ruby/3.1.0/gems/stringio-3.0.2/ext/stringio/Makefile +2 -2
  196. data/vendor/bundle/ruby/3.1.0/specifications/psych-4.0.4.gemspec +36 -0
  197. metadata +87 -2
@@ -0,0 +1,469 @@
1
+
2
+ #include "yaml_private.h"
3
+
4
+ /*
5
+ * Declarations.
6
+ */
7
+
8
+ static int
9
+ yaml_parser_set_reader_error(yaml_parser_t *parser, const char *problem,
10
+ size_t offset, int value);
11
+
12
+ static int
13
+ yaml_parser_update_raw_buffer(yaml_parser_t *parser);
14
+
15
+ static int
16
+ yaml_parser_determine_encoding(yaml_parser_t *parser);
17
+
18
+ YAML_DECLARE(int)
19
+ yaml_parser_update_buffer(yaml_parser_t *parser, size_t length);
20
+
21
+ /*
22
+ * Set the reader error and return 0.
23
+ */
24
+
25
+ static int
26
+ yaml_parser_set_reader_error(yaml_parser_t *parser, const char *problem,
27
+ size_t offset, int value)
28
+ {
29
+ parser->error = YAML_READER_ERROR;
30
+ parser->problem = problem;
31
+ parser->problem_offset = offset;
32
+ parser->problem_value = value;
33
+
34
+ return 0;
35
+ }
36
+
37
+ /*
38
+ * Byte order marks.
39
+ */
40
+
41
+ #define BOM_UTF8 "\xef\xbb\xbf"
42
+ #define BOM_UTF16LE "\xff\xfe"
43
+ #define BOM_UTF16BE "\xfe\xff"
44
+
45
+ /*
46
+ * Determine the input stream encoding by checking the BOM symbol. If no BOM is
47
+ * found, the UTF-8 encoding is assumed. Return 1 on success, 0 on failure.
48
+ */
49
+
50
+ static int
51
+ yaml_parser_determine_encoding(yaml_parser_t *parser)
52
+ {
53
+ /* Ensure that we had enough bytes in the raw buffer. */
54
+
55
+ while (!parser->eof
56
+ && parser->raw_buffer.last - parser->raw_buffer.pointer < 3) {
57
+ if (!yaml_parser_update_raw_buffer(parser)) {
58
+ return 0;
59
+ }
60
+ }
61
+
62
+ /* Determine the encoding. */
63
+
64
+ if (parser->raw_buffer.last - parser->raw_buffer.pointer >= 2
65
+ && !memcmp(parser->raw_buffer.pointer, BOM_UTF16LE, 2)) {
66
+ parser->encoding = YAML_UTF16LE_ENCODING;
67
+ parser->raw_buffer.pointer += 2;
68
+ parser->offset += 2;
69
+ }
70
+ else if (parser->raw_buffer.last - parser->raw_buffer.pointer >= 2
71
+ && !memcmp(parser->raw_buffer.pointer, BOM_UTF16BE, 2)) {
72
+ parser->encoding = YAML_UTF16BE_ENCODING;
73
+ parser->raw_buffer.pointer += 2;
74
+ parser->offset += 2;
75
+ }
76
+ else if (parser->raw_buffer.last - parser->raw_buffer.pointer >= 3
77
+ && !memcmp(parser->raw_buffer.pointer, BOM_UTF8, 3)) {
78
+ parser->encoding = YAML_UTF8_ENCODING;
79
+ parser->raw_buffer.pointer += 3;
80
+ parser->offset += 3;
81
+ }
82
+ else {
83
+ parser->encoding = YAML_UTF8_ENCODING;
84
+ }
85
+
86
+ return 1;
87
+ }
88
+
89
+ /*
90
+ * Update the raw buffer.
91
+ */
92
+
93
+ static int
94
+ yaml_parser_update_raw_buffer(yaml_parser_t *parser)
95
+ {
96
+ size_t size_read = 0;
97
+
98
+ /* Return if the raw buffer is full. */
99
+
100
+ if (parser->raw_buffer.start == parser->raw_buffer.pointer
101
+ && parser->raw_buffer.last == parser->raw_buffer.end)
102
+ return 1;
103
+
104
+ /* Return on EOF. */
105
+
106
+ if (parser->eof) return 1;
107
+
108
+ /* Move the remaining bytes in the raw buffer to the beginning. */
109
+
110
+ if (parser->raw_buffer.start < parser->raw_buffer.pointer
111
+ && parser->raw_buffer.pointer < parser->raw_buffer.last) {
112
+ memmove(parser->raw_buffer.start, parser->raw_buffer.pointer,
113
+ parser->raw_buffer.last - parser->raw_buffer.pointer);
114
+ }
115
+ parser->raw_buffer.last -=
116
+ parser->raw_buffer.pointer - parser->raw_buffer.start;
117
+ parser->raw_buffer.pointer = parser->raw_buffer.start;
118
+
119
+ /* Call the read handler to fill the buffer. */
120
+
121
+ if (!parser->read_handler(parser->read_handler_data, parser->raw_buffer.last,
122
+ parser->raw_buffer.end - parser->raw_buffer.last, &size_read)) {
123
+ return yaml_parser_set_reader_error(parser, "input error",
124
+ parser->offset, -1);
125
+ }
126
+ parser->raw_buffer.last += size_read;
127
+ if (!size_read) {
128
+ parser->eof = 1;
129
+ }
130
+
131
+ return 1;
132
+ }
133
+
134
+ /*
135
+ * Ensure that the buffer contains at least `length` characters.
136
+ * Return 1 on success, 0 on failure.
137
+ *
138
+ * The length is supposed to be significantly less that the buffer size.
139
+ */
140
+
141
+ YAML_DECLARE(int)
142
+ yaml_parser_update_buffer(yaml_parser_t *parser, size_t length)
143
+ {
144
+ int first = 1;
145
+
146
+ assert(parser->read_handler); /* Read handler must be set. */
147
+
148
+ /* If the EOF flag is set and the raw buffer is empty, do nothing. */
149
+
150
+ if (parser->eof && parser->raw_buffer.pointer == parser->raw_buffer.last)
151
+ return 1;
152
+
153
+ /* Return if the buffer contains enough characters. */
154
+
155
+ if (parser->unread >= length)
156
+ return 1;
157
+
158
+ /* Determine the input encoding if it is not known yet. */
159
+
160
+ if (!parser->encoding) {
161
+ if (!yaml_parser_determine_encoding(parser))
162
+ return 0;
163
+ }
164
+
165
+ /* Move the unread characters to the beginning of the buffer. */
166
+
167
+ if (parser->buffer.start < parser->buffer.pointer
168
+ && parser->buffer.pointer < parser->buffer.last) {
169
+ size_t size = parser->buffer.last - parser->buffer.pointer;
170
+ memmove(parser->buffer.start, parser->buffer.pointer, size);
171
+ parser->buffer.pointer = parser->buffer.start;
172
+ parser->buffer.last = parser->buffer.start + size;
173
+ }
174
+ else if (parser->buffer.pointer == parser->buffer.last) {
175
+ parser->buffer.pointer = parser->buffer.start;
176
+ parser->buffer.last = parser->buffer.start;
177
+ }
178
+
179
+ /* Fill the buffer until it has enough characters. */
180
+
181
+ while (parser->unread < length)
182
+ {
183
+ /* Fill the raw buffer if necessary. */
184
+
185
+ if (!first || parser->raw_buffer.pointer == parser->raw_buffer.last) {
186
+ if (!yaml_parser_update_raw_buffer(parser)) return 0;
187
+ }
188
+ first = 0;
189
+
190
+ /* Decode the raw buffer. */
191
+
192
+ while (parser->raw_buffer.pointer != parser->raw_buffer.last)
193
+ {
194
+ unsigned int value = 0, value2 = 0;
195
+ int incomplete = 0;
196
+ unsigned char octet;
197
+ unsigned int width = 0;
198
+ int low, high;
199
+ size_t k;
200
+ size_t raw_unread = parser->raw_buffer.last - parser->raw_buffer.pointer;
201
+
202
+ /* Decode the next character. */
203
+
204
+ switch (parser->encoding)
205
+ {
206
+ case YAML_UTF8_ENCODING:
207
+
208
+ /*
209
+ * Decode a UTF-8 character. Check RFC 3629
210
+ * (http://www.ietf.org/rfc/rfc3629.txt) for more details.
211
+ *
212
+ * The following table (taken from the RFC) is used for
213
+ * decoding.
214
+ *
215
+ * Char. number range | UTF-8 octet sequence
216
+ * (hexadecimal) | (binary)
217
+ * --------------------+------------------------------------
218
+ * 0000 0000-0000 007F | 0xxxxxxx
219
+ * 0000 0080-0000 07FF | 110xxxxx 10xxxxxx
220
+ * 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx
221
+ * 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
222
+ *
223
+ * Additionally, the characters in the range 0xD800-0xDFFF
224
+ * are prohibited as they are reserved for use with UTF-16
225
+ * surrogate pairs.
226
+ */
227
+
228
+ /* Determine the length of the UTF-8 sequence. */
229
+
230
+ octet = parser->raw_buffer.pointer[0];
231
+ width = (octet & 0x80) == 0x00 ? 1 :
232
+ (octet & 0xE0) == 0xC0 ? 2 :
233
+ (octet & 0xF0) == 0xE0 ? 3 :
234
+ (octet & 0xF8) == 0xF0 ? 4 : 0;
235
+
236
+ /* Check if the leading octet is valid. */
237
+
238
+ if (!width)
239
+ return yaml_parser_set_reader_error(parser,
240
+ "invalid leading UTF-8 octet",
241
+ parser->offset, octet);
242
+
243
+ /* Check if the raw buffer contains an incomplete character. */
244
+
245
+ if (width > raw_unread) {
246
+ if (parser->eof) {
247
+ return yaml_parser_set_reader_error(parser,
248
+ "incomplete UTF-8 octet sequence",
249
+ parser->offset, -1);
250
+ }
251
+ incomplete = 1;
252
+ break;
253
+ }
254
+
255
+ /* Decode the leading octet. */
256
+
257
+ value = (octet & 0x80) == 0x00 ? octet & 0x7F :
258
+ (octet & 0xE0) == 0xC0 ? octet & 0x1F :
259
+ (octet & 0xF0) == 0xE0 ? octet & 0x0F :
260
+ (octet & 0xF8) == 0xF0 ? octet & 0x07 : 0;
261
+
262
+ /* Check and decode the trailing octets. */
263
+
264
+ for (k = 1; k < width; k ++)
265
+ {
266
+ octet = parser->raw_buffer.pointer[k];
267
+
268
+ /* Check if the octet is valid. */
269
+
270
+ if ((octet & 0xC0) != 0x80)
271
+ return yaml_parser_set_reader_error(parser,
272
+ "invalid trailing UTF-8 octet",
273
+ parser->offset+k, octet);
274
+
275
+ /* Decode the octet. */
276
+
277
+ value = (value << 6) + (octet & 0x3F);
278
+ }
279
+
280
+ /* Check the length of the sequence against the value. */
281
+
282
+ if (!((width == 1) ||
283
+ (width == 2 && value >= 0x80) ||
284
+ (width == 3 && value >= 0x800) ||
285
+ (width == 4 && value >= 0x10000)))
286
+ return yaml_parser_set_reader_error(parser,
287
+ "invalid length of a UTF-8 sequence",
288
+ parser->offset, -1);
289
+
290
+ /* Check the range of the value. */
291
+
292
+ if ((value >= 0xD800 && value <= 0xDFFF) || value > 0x10FFFF)
293
+ return yaml_parser_set_reader_error(parser,
294
+ "invalid Unicode character",
295
+ parser->offset, value);
296
+
297
+ break;
298
+
299
+ case YAML_UTF16LE_ENCODING:
300
+ case YAML_UTF16BE_ENCODING:
301
+
302
+ low = (parser->encoding == YAML_UTF16LE_ENCODING ? 0 : 1);
303
+ high = (parser->encoding == YAML_UTF16LE_ENCODING ? 1 : 0);
304
+
305
+ /*
306
+ * The UTF-16 encoding is not as simple as one might
307
+ * naively think. Check RFC 2781
308
+ * (http://www.ietf.org/rfc/rfc2781.txt).
309
+ *
310
+ * Normally, two subsequent bytes describe a Unicode
311
+ * character. However a special technique (called a
312
+ * surrogate pair) is used for specifying character
313
+ * values larger than 0xFFFF.
314
+ *
315
+ * A surrogate pair consists of two pseudo-characters:
316
+ * high surrogate area (0xD800-0xDBFF)
317
+ * low surrogate area (0xDC00-0xDFFF)
318
+ *
319
+ * The following formulas are used for decoding
320
+ * and encoding characters using surrogate pairs:
321
+ *
322
+ * U = U' + 0x10000 (0x01 00 00 <= U <= 0x10 FF FF)
323
+ * U' = yyyyyyyyyyxxxxxxxxxx (0 <= U' <= 0x0F FF FF)
324
+ * W1 = 110110yyyyyyyyyy
325
+ * W2 = 110111xxxxxxxxxx
326
+ *
327
+ * where U is the character value, W1 is the high surrogate
328
+ * area, W2 is the low surrogate area.
329
+ */
330
+
331
+ /* Check for incomplete UTF-16 character. */
332
+
333
+ if (raw_unread < 2) {
334
+ if (parser->eof) {
335
+ return yaml_parser_set_reader_error(parser,
336
+ "incomplete UTF-16 character",
337
+ parser->offset, -1);
338
+ }
339
+ incomplete = 1;
340
+ break;
341
+ }
342
+
343
+ /* Get the character. */
344
+
345
+ value = parser->raw_buffer.pointer[low]
346
+ + (parser->raw_buffer.pointer[high] << 8);
347
+
348
+ /* Check for unexpected low surrogate area. */
349
+
350
+ if ((value & 0xFC00) == 0xDC00)
351
+ return yaml_parser_set_reader_error(parser,
352
+ "unexpected low surrogate area",
353
+ parser->offset, value);
354
+
355
+ /* Check for a high surrogate area. */
356
+
357
+ if ((value & 0xFC00) == 0xD800) {
358
+
359
+ width = 4;
360
+
361
+ /* Check for incomplete surrogate pair. */
362
+
363
+ if (raw_unread < 4) {
364
+ if (parser->eof) {
365
+ return yaml_parser_set_reader_error(parser,
366
+ "incomplete UTF-16 surrogate pair",
367
+ parser->offset, -1);
368
+ }
369
+ incomplete = 1;
370
+ break;
371
+ }
372
+
373
+ /* Get the next character. */
374
+
375
+ value2 = parser->raw_buffer.pointer[low+2]
376
+ + (parser->raw_buffer.pointer[high+2] << 8);
377
+
378
+ /* Check for a low surrogate area. */
379
+
380
+ if ((value2 & 0xFC00) != 0xDC00)
381
+ return yaml_parser_set_reader_error(parser,
382
+ "expected low surrogate area",
383
+ parser->offset+2, value2);
384
+
385
+ /* Generate the value of the surrogate pair. */
386
+
387
+ value = 0x10000 + ((value & 0x3FF) << 10) + (value2 & 0x3FF);
388
+ }
389
+
390
+ else {
391
+ width = 2;
392
+ }
393
+
394
+ break;
395
+
396
+ default:
397
+ assert(1); /* Impossible. */
398
+ }
399
+
400
+ /* Check if the raw buffer contains enough bytes to form a character. */
401
+
402
+ if (incomplete) break;
403
+
404
+ /*
405
+ * Check if the character is in the allowed range:
406
+ * #x9 | #xA | #xD | [#x20-#x7E] (8 bit)
407
+ * | #x85 | [#xA0-#xD7FF] | [#xE000-#xFFFD] (16 bit)
408
+ * | [#x10000-#x10FFFF] (32 bit)
409
+ */
410
+
411
+ if (! (value == 0x09 || value == 0x0A || value == 0x0D
412
+ || (value >= 0x20 && value <= 0x7E)
413
+ || (value == 0x85) || (value >= 0xA0 && value <= 0xD7FF)
414
+ || (value >= 0xE000 && value <= 0xFFFD)
415
+ || (value >= 0x10000 && value <= 0x10FFFF)))
416
+ return yaml_parser_set_reader_error(parser,
417
+ "control characters are not allowed",
418
+ parser->offset, value);
419
+
420
+ /* Move the raw pointers. */
421
+
422
+ parser->raw_buffer.pointer += width;
423
+ parser->offset += width;
424
+
425
+ /* Finally put the character into the buffer. */
426
+
427
+ /* 0000 0000-0000 007F -> 0xxxxxxx */
428
+ if (value <= 0x7F) {
429
+ *(parser->buffer.last++) = value;
430
+ }
431
+ /* 0000 0080-0000 07FF -> 110xxxxx 10xxxxxx */
432
+ else if (value <= 0x7FF) {
433
+ *(parser->buffer.last++) = 0xC0 + (value >> 6);
434
+ *(parser->buffer.last++) = 0x80 + (value & 0x3F);
435
+ }
436
+ /* 0000 0800-0000 FFFF -> 1110xxxx 10xxxxxx 10xxxxxx */
437
+ else if (value <= 0xFFFF) {
438
+ *(parser->buffer.last++) = 0xE0 + (value >> 12);
439
+ *(parser->buffer.last++) = 0x80 + ((value >> 6) & 0x3F);
440
+ *(parser->buffer.last++) = 0x80 + (value & 0x3F);
441
+ }
442
+ /* 0001 0000-0010 FFFF -> 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */
443
+ else {
444
+ *(parser->buffer.last++) = 0xF0 + (value >> 18);
445
+ *(parser->buffer.last++) = 0x80 + ((value >> 12) & 0x3F);
446
+ *(parser->buffer.last++) = 0x80 + ((value >> 6) & 0x3F);
447
+ *(parser->buffer.last++) = 0x80 + (value & 0x3F);
448
+ }
449
+
450
+ parser->unread ++;
451
+ }
452
+
453
+ /* On EOF, put NUL into the buffer and return. */
454
+
455
+ if (parser->eof) {
456
+ *(parser->buffer.last++) = '\0';
457
+ parser->unread ++;
458
+ return 1;
459
+ }
460
+
461
+ }
462
+
463
+ if (parser->offset >= MAX_FILE_SIZE) {
464
+ return yaml_parser_set_reader_error(parser, "input is too long",
465
+ parser->offset, -1);
466
+ }
467
+
468
+ return 1;
469
+ }