From 604c0045e75e606e4bab9f1d57b3ba4eb75a2c31 Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Fri, 23 Feb 2018 12:10:34 -0800 Subject: [PATCH] Update go dep (#1560) This fix updates go dep with `dep ensure --update` as well as the following: - Removed github.com/ugorji/go restriction in Gopkg.toml (fixes #1557) - Added github.com/flynn/go-shlex in Makefile (neede by Caddy, maybe removed later) This fix fixes #1557 Signed-off-by: Yong Tang --- Gopkg.lock | 88 +- Gopkg.toml | 12 +- Makefile | 2 + vendor/github.com/Shopify/sarama/.travis.yml | 8 +- vendor/github.com/Shopify/sarama/CHANGELOG.md | 42 + vendor/github.com/Shopify/sarama/README.md | 2 +- .../github.com/Shopify/sarama/acl_bindings.go | 119 + .../Shopify/sarama/acl_create_request.go | 76 + .../Shopify/sarama/acl_create_request_test.go | 34 + .../Shopify/sarama/acl_create_response.go | 88 + .../sarama/acl_create_response_test.go | 41 + .../Shopify/sarama/acl_delete_request.go | 48 + .../Shopify/sarama/acl_delete_request_test.go | 69 + .../Shopify/sarama/acl_delete_response.go | 155 + .../sarama/acl_delete_response_test.go | 38 + .../Shopify/sarama/acl_describe_request.go | 25 + .../sarama/acl_describe_request_test.go | 35 + .../Shopify/sarama/acl_describe_response.go | 80 + .../sarama/acl_describe_response_test.go | 45 + .../github.com/Shopify/sarama/acl_filter.go | 61 + vendor/github.com/Shopify/sarama/acl_types.go | 42 + .../sarama/add_offsets_to_txn_request.go | 52 + .../sarama/add_offsets_to_txn_request_test.go | 23 + .../sarama/add_offsets_to_txn_response.go | 44 + .../add_offsets_to_txn_response_test.go | 22 + .../sarama/add_partitions_to_txn_request.go | 76 + .../add_partitions_to_txn_request_test.go | 27 + .../sarama/add_partitions_to_txn_response.go | 108 + .../add_partitions_to_txn_response_test.go | 31 + .../Shopify/sarama/alter_configs_request.go | 120 + .../sarama/alter_configs_request_test.go | 91 + .../Shopify/sarama/alter_configs_response.go | 95 + .../sarama/alter_configs_response_test.go | 45 + .../Shopify/sarama/async_producer_test.go | 1 + vendor/github.com/Shopify/sarama/broker.go | 131 + .../Shopify/sarama/client_tls_test.go | 206 + vendor/github.com/Shopify/sarama/config.go | 4 +- .../Shopify/sarama/config_resource_type.go | 15 + vendor/github.com/Shopify/sarama/consumer.go | 57 +- .../Shopify/sarama/consumer_test.go | 18 +- .../Shopify/sarama/create_topics_request.go | 174 + .../sarama/create_topics_request_test.go | 50 + .../Shopify/sarama/create_topics_response.go | 112 + .../sarama/create_topics_response_test.go | 52 + .../Shopify/sarama/delete_topics_request.go | 41 + .../sarama/delete_topics_request_test.go | 22 + .../Shopify/sarama/delete_topics_response.go | 78 + .../sarama/delete_topics_response_test.go | 36 + .../sarama/describe_configs_request.go | 91 + .../sarama/describe_configs_request_test.go | 90 + .../sarama/describe_configs_response.go | 188 + .../sarama/describe_configs_response_test.go | 60 + .../Shopify/sarama/end_txn_request.go | 50 + .../Shopify/sarama/end_txn_request_test.go | 23 + .../Shopify/sarama/end_txn_response.go | 44 + .../Shopify/sarama/end_txn_response_test.go | 22 + vendor/github.com/Shopify/sarama/errors.go | 4 + .../Shopify/sarama/fetch_response.go | 100 +- .../Shopify/sarama/fetch_response_test.go | 18 +- .../sarama/init_producer_id_request.go | 43 + .../sarama/init_producer_id_request_test.go | 31 + .../sarama/init_producer_id_response.go | 55 + .../sarama/init_producer_id_response_test.go | 37 + .../github.com/Shopify/sarama/message_set.go | 13 + .../github.com/Shopify/sarama/mockbroker.go | 14 +- .../Shopify/sarama/mockresponses.go | 14 +- .../Shopify/sarama/produce_request_test.go | 11 +- .../github.com/Shopify/sarama/produce_set.go | 21 +- .../Shopify/sarama/produce_set_test.go | 9 +- .../github.com/Shopify/sarama/record_batch.go | 16 +- .../github.com/Shopify/sarama/record_test.go | 34 +- vendor/github.com/Shopify/sarama/records.go | 20 +- vendor/github.com/Shopify/sarama/request.go | 24 + .../github.com/Shopify/sarama/request_test.go | 2 + .../sarama/txn_offset_commit_request.go | 126 + .../sarama/txn_offset_commit_request_test.go | 35 + .../sarama/txn_offset_commit_response.go | 83 + .../sarama/txn_offset_commit_response_test.go | 31 + vendor/github.com/aws/aws-sdk-go/CHANGELOG.md | 245 + .../aws-sdk-go/aws/client/default_retryer.go | 26 +- .../aws/aws-sdk-go/aws/client/logger.go | 4 + .../aws/aws-sdk-go/aws/client/logger_test.go | 87 + .../aws-sdk-go/aws/corehandlers/handlers.go | 20 +- .../aws/aws-sdk-go/aws/ec2metadata/service.go | 24 + .../aws/ec2metadata/service_test.go | 62 +- .../aws/aws-sdk-go/aws/endpoints/decode.go | 24 + .../aws-sdk-go/aws/endpoints/decode_test.go | 123 + .../aws/aws-sdk-go/aws/endpoints/defaults.go | 136 +- .../aws/aws-sdk-go/aws/request/request.go | 45 +- .../aws/request/request_pagination.go | 25 +- .../aws/request/request_pagination_test.go | 141 +- .../aws/request/request_resetbody_test.go | 71 +- .../aws-sdk-go/aws/request/request_test.go | 96 +- .../aws/aws-sdk-go/aws/session/env_config.go | 8 + .../aws-sdk-go/aws/session/env_config_test.go | 47 +- .../aws/aws-sdk-go/aws/session/session.go | 14 +- .../aws/aws-sdk-go/aws/signer/v4/v4.go | 19 +- .../aws/aws-sdk-go/aws/signer/v4/v4_test.go | 97 +- vendor/github.com/aws/aws-sdk-go/aws/types.go | 81 + .../github.com/aws/aws-sdk-go/aws/version.go | 2 +- .../internal/sdkrand/locked_source.go | 29 + .../aws/aws-sdk-go/service/route53/api.go | 147 +- .../service/route53/examples_test.go | 271 + .../aws/aws-sdk-go/service/sts/api.go | 17 - vendor/github.com/coreos/etcd/.gitignore | 5 +- vendor/github.com/coreos/etcd/.semaphore.sh | 4 +- vendor/github.com/coreos/etcd/.travis.yml | 17 +- vendor/github.com/coreos/etcd/.words | 44 + vendor/github.com/coreos/etcd/CHANGELOG.md | 746 + .../github.com/coreos/etcd/CODE_OF_CONDUCT.md | 63 + vendor/github.com/coreos/etcd/CONTRIBUTING.md | 2 +- .../coreos/etcd/Dockerfile-functional-tester | 53 + vendor/github.com/coreos/etcd/Dockerfile-test | 3 +- vendor/github.com/coreos/etcd/NEWS | 106 - vendor/github.com/coreos/etcd/Procfile | 3 +- vendor/github.com/coreos/etcd/Procfile.v2 | 6 + vendor/github.com/coreos/etcd/README.md | 40 +- .../coreos/etcd/bill-of-materials.json | 58 +- vendor/github.com/coreos/etcd/build | 20 +- .../github.com/coreos/etcd/client/README.md | 2 +- .../coreos/etcd/client/auth_role.go | 3 +- .../coreos/etcd/client/auth_user.go | 3 +- .../github.com/coreos/etcd/client/client.go | 14 +- .../coreos/etcd/client/client_test.go | 2 +- vendor/github.com/coreos/etcd/client/doc.go | 4 +- .../coreos/etcd/client/example_keys_test.go | 93 + .../coreos/etcd/client/keys.generated.go | 4653 +- vendor/github.com/coreos/etcd/client/keys.go | 5 +- .../coreos/etcd/client/keys_test.go | 3 +- .../coreos/etcd/client/main_test.go | 77 + .../github.com/coreos/etcd/client/members.go | 5 +- .../coreos/etcd/client/members_test.go | 3 +- .../coreos/etcd/etcd.conf.yml.sample | 9 +- vendor/github.com/coreos/etcd/glide.lock | 49 +- vendor/github.com/coreos/etcd/glide.yaml | 76 +- vendor/github.com/coreos/etcd/meeting.ics | 49 + vendor/github.com/coreos/etcd/pkg/srv/srv.go | 3 +- .../coreos/etcd/pkg/srv/srv_test.go | 9 +- .../github.com/coreos/etcd/pkg/types/set.go | 4 +- vendor/github.com/coreos/etcd/test | 319 +- .../github.com/coreos/etcd/version/version.go | 2 +- .../github.com/emicklei/go-restful/CHANGES.md | 5 + .../emicklei/go-restful/container.go | 7 +- .../emicklei/go-restful/curly_test.go | 7 + .../github.com/emicklei/go-restful/jsr311.go | 25 + .../emicklei/go-restful/jsr311_test.go | 99 +- .../emicklei/go-restful/path_expression.go | 17 +- .../go-restful/path_expression_test.go | 24 +- .../emicklei/go-restful/path_processor.go | 63 + .../go-restful/path_processor_test.go | 55 + .../github.com/emicklei/go-restful/route.go | 50 +- .../emicklei/go-restful/route_test.go | 51 - .../github.com/emicklei/go-restful/router.go | 2 + .../farsightsec/golang-framestream/Encoder.go | 2 +- .../golang-framestream/framestream_test.go | 51 + vendor/github.com/go-openapi/spec/expander.go | 255 +- .../go-openapi/spec/expander_test.go | 132 + vendor/github.com/go-openapi/spec/ref.go | 3 + vendor/github.com/go-openapi/spec/schema.go | 26 +- .../github.com/go-openapi/spec/schema_test.go | 7 + vendor/github.com/go-openapi/swag/loading.go | 6 +- vendor/github.com/gogo/protobuf/.travis.yml | 10 +- vendor/github.com/gogo/protobuf/CONTRIBUTORS | 1 + vendor/github.com/gogo/protobuf/Makefile | 1 + vendor/github.com/gogo/protobuf/README | 1 + vendor/github.com/gogo/protobuf/Readme.md | 27 +- vendor/github.com/gogo/protobuf/extensions.md | 2 +- .../gogo/protobuf/install-protobuf.sh | 4 - .../github.com/gogo/protobuf/proto/discard.go | 151 + .../golang/protobuf/proto/discard.go | 151 + vendor/github.com/google/btree/btree.go | 66 +- vendor/github.com/google/btree/btree_test.go | 81 + vendor/github.com/hashicorp/golang-lru/2q.go | 21 +- vendor/github.com/hashicorp/golang-lru/arc.go | 16 +- vendor/github.com/hashicorp/golang-lru/doc.go | 21 + vendor/github.com/hashicorp/golang-lru/lru.go | 28 +- .../hashicorp/golang-lru/lru_test.go | 4 +- .../hashicorp/golang-lru/simplelru/lru.go | 17 +- .../golang-lru/simplelru/lru_interface.go | 37 + .../golang-lru/simplelru/lru_test.go | 4 +- vendor/github.com/imdario/mergo/.travis.yml | 7 +- vendor/github.com/imdario/mergo/README.md | 42 +- .../github.com/imdario/mergo/issue33_test.go | 2 +- vendor/github.com/imdario/mergo/merge.go | 2 +- vendor/github.com/imdario/mergo/merge_test.go | 50 + vendor/github.com/imdario/mergo/mergo.go | 2 + vendor/github.com/json-iterator/go/.gitignore | 6 +- vendor/github.com/json-iterator/go/Gopkg.lock | 45 + vendor/github.com/json-iterator/go/Gopkg.toml | 37 + vendor/github.com/json-iterator/go/README.md | 2 + .../go/{feature_adapter.go => adapter.go} | 38 +- .../go/{feature_any.go => any.go} | 82 +- .../go/{feature_any_array.go => any_array.go} | 0 .../go/{feature_any_bool.go => any_bool.go} | 0 .../go/{feature_any_float.go => any_float.go} | 0 .../go/{feature_any_int32.go => any_int32.go} | 0 .../go/{feature_any_int64.go => any_int64.go} | 0 ...{feature_any_invalid.go => any_invalid.go} | 0 .../go/{feature_any_nil.go => any_nil.go} | 0 .../{feature_any_number.go => any_number.go} | 37 +- .../{feature_any_object.go => any_object.go} | 0 .../go/{feature_any_string.go => any_str.go} | 2 +- .../{feature_any_uint32.go => any_uint32.go} | 0 .../{feature_any_uint64.go => any_uint64.go} | 0 vendor/github.com/json-iterator/go/build.sh | 12 + .../json-iterator/go/compatible_test.go | 40 - .../go/{feature_config.go => config.go} | 185 +- .../json-iterator/go/config_with_sync_map.go | 64 + .../go/config_without_sync_map.go | 70 + .../json-iterator/go/feature_json_number.go | 31 - .../json-iterator/go/feature_reflect.go | 721 - .../json-iterator/go/feature_reflect_array.go | 99 - .../json-iterator/go/feature_reflect_map.go | 244 - .../go/feature_reflect_native.go | 764 - .../json-iterator/go/feature_reflect_slice.go | 147 - .../json-iterator/go/feature_stream_int.go | 320 - .../go/{feature_iter.go => iter.go} | 0 .../{feature_iter_array.go => iter_array.go} | 0 .../{feature_iter_float.go => iter_float.go} | 6 + .../go/{feature_iter_int.go => iter_int.go} | 97 +- ...{feature_iter_object.go => iter_object.go} | 141 +- .../go/{feature_iter_skip.go => iter_skip.go} | 0 ...ter_skip_sloppy.go => iter_skip_sloppy.go} | 0 ...loppy_test.go => iter_skip_sloppy_test.go} | 2 +- ...ter_skip_strict.go => iter_skip_strict.go} | 0 .../{feature_iter_string.go => iter_str.go} | 0 .../go/jsoniter_1dot8_only_test.go | 45 - .../json-iterator/go/jsoniter_adapter_test.go | 84 - .../json-iterator/go/jsoniter_alias_test.go | 62 - .../go/jsoniter_any_array_test.go | 122 - .../go/jsoniter_any_bool_test.go | 64 - .../go/jsoniter_any_float_test.go | 102 - .../json-iterator/go/jsoniter_any_int_test.go | 197 - .../json-iterator/go/jsoniter_any_map_test.go | 14 - .../go/jsoniter_any_null_test.go | 15 - .../go/jsoniter_any_object_test.go | 107 - .../go/jsoniter_any_string_test.go | 56 - .../json-iterator/go/jsoniter_array_test.go | 213 - .../json-iterator/go/jsoniter_bool_test.go | 113 - .../go/jsoniter_customize_test.go | 341 - .../json-iterator/go/jsoniter_demo_test.go | 87 - .../go/jsoniter_encode_interface_test.go | 42 - .../go/jsoniter_enum_marshaler_test.go | 50 - .../go/jsoniter_fixed_array_test.go | 37 - .../json-iterator/go/jsoniter_float_test.go | 210 - .../json-iterator/go/jsoniter_int_test.go | 567 - .../go/jsoniter_interface_test.go | 576 - .../json-iterator/go/jsoniter_invalid_test.go | 138 - .../json-iterator/go/jsoniter_io_test.go | 65 - .../go/jsoniter_iterator_test.go | 66 - .../go/jsoniter_large_file_test.go | 157 - .../json-iterator/go/jsoniter_map_test.go | 160 - .../go/jsoniter_must_be_valid_test.go | 71 - .../json-iterator/go/jsoniter_nested_test.go | 88 - .../json-iterator/go/jsoniter_null_test.go | 168 - .../json-iterator/go/jsoniter_object_test.go | 342 - .../go/jsoniter_optional_test.go | 46 - .../go/jsoniter_raw_message_test.go | 114 - .../json-iterator/go/jsoniter_reader_test.go | 57 - .../go/jsoniter_reflect_native_test.go | 154 - .../json-iterator/go/jsoniter_skip_test.go | 184 - .../json-iterator/go/jsoniter_string_test.go | 261 - .../go/jsoniter_struct_decoder_test.go | 267 - .../go/jsoniter_struct_encoder_test.go | 52 - .../json-iterator/go/jsoniter_wrap_test.go | 118 - .../go/{feature_pool.go => pool.go} | 34 +- vendor/github.com/json-iterator/go/reflect.go | 321 + .../json-iterator/go/reflect_array.go | 104 + .../json-iterator/go/reflect_dynamic.go | 70 + ...lect_extension.go => reflect_extension.go} | 241 +- .../json-iterator/go/reflect_json_number.go | 112 + .../go/reflect_json_raw_message.go | 60 + .../json-iterator/go/reflect_map.go | 284 + .../json-iterator/go/reflect_marshaler.go | 218 + .../json-iterator/go/reflect_native.go | 455 + .../json-iterator/go/reflect_optional.go | 133 + .../json-iterator/go/reflect_slice.go | 99 + ...t_decoder.go => reflect_struct_decoder.go} | 498 +- ...ct_object.go => reflect_struct_encoder.go} | 158 +- .../go/{feature_stream.go => stream.go} | 150 +- ...eature_stream_float.go => stream_float.go} | 14 +- .../github.com/json-iterator/go/stream_int.go | 190 + ...feature_stream_string.go => stream_str.go} | 40 +- ...jsoniter_stream_test.go => stream_test.go} | 6 +- vendor/github.com/json-iterator/go/test.sh | 2 +- .../json-iterator/go/unmarshal_input_test.go | 72 - .../github.com/rcrowley/go-metrics/README.md | 1 + vendor/github.com/ugorji/go/.travis.yml | 11 + vendor/github.com/ugorji/go/README.md | 7 + vendor/github.com/ugorji/go/codec/0doc.go | 173 +- vendor/github.com/ugorji/go/codec/README.md | 86 +- vendor/github.com/ugorji/go/codec/binc.go | 362 +- vendor/github.com/ugorji/go/codec/cbor.go | 291 +- .../github.com/ugorji/go/codec/cbor_test.go | 33 +- .../github.com/ugorji/go/codec/codec_test.go | 2224 +- .../ugorji/go/codec/codecgen_test.go | 24 - vendor/github.com/ugorji/go/codec/decode.go | 2704 +- .../github.com/ugorji/go/codec/decode_go.go | 16 - .../github.com/ugorji/go/codec/decode_go14.go | 14 - vendor/github.com/ugorji/go/codec/encode.go | 1591 +- .../ugorji/go/codec/fast-path.generated.go | 45062 +++++++--------- .../ugorji/go/codec/fast-path.go.tmpl | 603 +- .../ugorji/go/codec/fast-path.not.go | 17 +- .../ugorji/go/codec/gen-dec-array.go.tmpl | 105 +- .../ugorji/go/codec/gen-dec-map.go.tmpl | 42 +- .../ugorji/go/codec/gen-helper.generated.go | 258 +- .../ugorji/go/codec/gen-helper.go.tmpl | 398 +- .../ugorji/go/codec/gen.generated.go | 150 +- vendor/github.com/ugorji/go/codec/gen.go | 1111 +- vendor/github.com/ugorji/go/codec/gen_15.go | 12 - vendor/github.com/ugorji/go/codec/gen_16.go | 12 - .../go/codec/goversion_arrayof_gte_go15.go | 14 + .../go/codec/goversion_arrayof_lt_go15.go | 14 + .../go/codec/goversion_makemap_gte_go19.go | 15 + .../go/codec/goversion_makemap_lt_go19.go | 12 + ...version_unexportedembeddedptr_gte_go110.go | 8 + ...oversion_unexportedembeddedptr_lt_go110.go | 8 + .../go/codec/goversion_unsupported_lt_go14.go | 17 + .../go/codec/goversion_vendor_eq_go15.go | 10 + .../go/codec/goversion_vendor_eq_go16.go | 10 + ...gen_17.go => goversion_vendor_gte_go17.go} | 6 +- .../go/codec/goversion_vendor_lt_go15.go | 8 + vendor/github.com/ugorji/go/codec/helper.go | 2035 +- .../ugorji/go/codec/helper_internal.go | 139 +- .../ugorji/go/codec/helper_not_unsafe.go | 256 +- .../github.com/ugorji/go/codec/helper_test.go | 47 - .../ugorji/go/codec/helper_unsafe.go | 609 +- vendor/github.com/ugorji/go/codec/json.go | 1798 +- .../ugorji/go/codec/mammoth-test.go.tmpl | 154 + .../ugorji/go/codec/mammoth2-test.go.tmpl | 94 + .../codec/mammoth2_codecgen_generated_test.go | 38478 +++++++++++++ .../go/codec/mammoth2_generated_test.go | 658 + .../ugorji/go/codec/mammoth_generated_test.go | 13188 +++++ vendor/github.com/ugorji/go/codec/msgpack.go | 347 +- vendor/github.com/ugorji/go/codec/noop.go | 26 +- vendor/github.com/ugorji/go/codec/prebuild.go | 3 - vendor/github.com/ugorji/go/codec/prebuild.sh | 205 - vendor/github.com/ugorji/go/codec/py_test.go | 2 +- vendor/github.com/ugorji/go/codec/rpc.go | 209 +- .../github.com/ugorji/go/codec/shared_test.go | 158 +- vendor/github.com/ugorji/go/codec/simple.go | 245 +- vendor/github.com/ugorji/go/codec/tests.sh | 107 - vendor/github.com/ugorji/go/codec/time.go | 233 - .../ugorji/go/codec/values_flex_test.go | 186 + .../github.com/ugorji/go/codec/values_test.go | 425 +- vendor/github.com/ugorji/go/codec/xml.go | 508 + .../github.com/ugorji/go/codec/z_all_test.go | 475 + vendor/github.com/v2pro/plz/.gitignore | 1 + vendor/github.com/v2pro/plz/LICENSE | 201 + vendor/github.com/v2pro/plz/README.md | 13 + vendor/github.com/v2pro/plz/closer.go | 71 + .../v2pro/plz/concurrent/executor.go | 7 + .../v2pro/plz/concurrent/go_above_19.go | 13 + .../v2pro/plz/concurrent/go_below_19.go | 30 + .../plz/concurrent/unbounded_executor.go | 99 + .../github.com/v2pro/plz/reflect2/README.md | 3 + .../v2pro/plz/reflect2/go_above_17.go | 8 + .../v2pro/plz/reflect2/go_above_19.go | 14 + .../v2pro/plz/reflect2/go_below_17.go | 9 + .../v2pro/plz/reflect2/go_below_19.go | 14 + .../github.com/v2pro/plz/reflect2/reflect2.go | 282 + .../v2pro/plz/reflect2/reflect2_amd64.s} | 0 .../v2pro/plz/reflect2/reflect2_kind.go | 30 + .../v2pro/plz/reflect2/relfect2_386.s | 0 .../v2pro/plz/reflect2/relfect2_amd64p32.s | 0 .../v2pro/plz/reflect2/relfect2_arm.s | 0 .../v2pro/plz/reflect2/relfect2_arm64.s | 0 .../v2pro/plz/reflect2/relfect2_mips64x.s | 0 .../v2pro/plz/reflect2/relfect2_mipsx.s | 0 .../v2pro/plz/reflect2/relfect2_ppc64x.s | 0 .../v2pro/plz/reflect2/relfect2_s390x.s | 0 .../v2pro/plz/reflect2/safe_field.go | 58 + .../github.com/v2pro/plz/reflect2/safe_map.go | 101 + .../v2pro/plz/reflect2/safe_slice.go | 92 + .../v2pro/plz/reflect2/safe_struct.go | 13 + .../v2pro/plz/reflect2/safe_type.go | 78 + .../github.com/v2pro/plz/reflect2/type_map.go | 72 + .../v2pro/plz/reflect2/unsafe_array.go | 65 + .../v2pro/plz/reflect2/unsafe_eface.go | 59 + .../v2pro/plz/reflect2/unsafe_field.go | 74 + .../v2pro/plz/reflect2/unsafe_iface.go | 64 + .../v2pro/plz/reflect2/unsafe_link.go | 70 + .../v2pro/plz/reflect2/unsafe_map.go | 138 + .../v2pro/plz/reflect2/unsafe_ptr.go | 46 + .../v2pro/plz/reflect2/unsafe_slice.go | 177 + .../v2pro/plz/reflect2/unsafe_struct.go | 59 + .../v2pro/plz/reflect2/unsafe_type.go | 85 + vendor/golang.org/x/crypto/ssh/certs.go | 4 +- vendor/golang.org/x/crypto/ssh/cipher.go | 244 +- vendor/golang.org/x/crypto/ssh/cipher_test.go | 11 +- vendor/golang.org/x/crypto/ssh/client_auth.go | 95 +- .../x/crypto/ssh/client_auth_test.go | 4 +- vendor/golang.org/x/crypto/ssh/common.go | 16 +- vendor/golang.org/x/crypto/ssh/keys_test.go | 24 +- vendor/golang.org/x/crypto/ssh/server.go | 10 +- .../x/crypto/ssh/terminal/util_windows.go | 10 +- vendor/golang.org/x/crypto/ssh/transport.go | 48 +- .../golang.org/x/sys/unix/affinity_linux.go | 2 +- vendor/golang.org/x/sys/unix/dirent.go | 89 +- vendor/golang.org/x/sys/unix/mkerrors.sh | 3 + vendor/golang.org/x/sys/unix/mkpost.go | 14 +- vendor/golang.org/x/sys/unix/mksyscall.pl | 15 +- .../golang.org/x/sys/unix/syscall_darwin.go | 13 +- .../x/sys/unix/syscall_dragonfly.go | 17 +- .../golang.org/x/sys/unix/syscall_freebsd.go | 13 +- vendor/golang.org/x/sys/unix/syscall_linux.go | 53 +- .../golang.org/x/sys/unix/syscall_linux_gc.go | 14 + .../x/sys/unix/syscall_linux_test.go | 102 +- .../golang.org/x/sys/unix/syscall_netbsd.go | 13 +- .../golang.org/x/sys/unix/syscall_openbsd.go | 13 +- .../golang.org/x/sys/unix/syscall_solaris.go | 17 +- vendor/golang.org/x/sys/unix/syscall_unix.go | 7 +- .../x/sys/unix/zerrors_linux_386.go | 55 +- .../x/sys/unix/zerrors_linux_amd64.go | 55 +- .../x/sys/unix/zerrors_linux_arm.go | 58 +- .../x/sys/unix/zerrors_linux_arm64.go | 55 +- .../x/sys/unix/zerrors_linux_mips.go | 55 +- .../x/sys/unix/zerrors_linux_mips64.go | 55 +- .../x/sys/unix/zerrors_linux_mips64le.go | 55 +- .../x/sys/unix/zerrors_linux_mipsle.go | 55 +- .../x/sys/unix/zerrors_linux_ppc64.go | 55 +- .../x/sys/unix/zerrors_linux_ppc64le.go | 55 +- .../x/sys/unix/zerrors_linux_s390x.go | 55 +- .../x/sys/unix/zsyscall_linux_386.go | 15 + .../x/sys/unix/zsyscall_linux_amd64.go | 15 + .../x/sys/unix/zsyscall_linux_arm.go | 15 + .../x/sys/unix/zsyscall_linux_arm64.go | 15 + .../x/sys/unix/zsyscall_linux_mips.go | 15 + .../x/sys/unix/zsyscall_linux_mips64.go | 15 + .../x/sys/unix/zsyscall_linux_mips64le.go | 15 + .../x/sys/unix/zsyscall_linux_mipsle.go | 15 + .../x/sys/unix/zsyscall_linux_ppc64.go | 15 + .../x/sys/unix/zsyscall_linux_ppc64le.go | 15 + .../x/sys/unix/zsyscall_linux_s390x.go | 15 + .../x/sys/unix/zsysnum_linux_s390x.go | 1 + .../golang.org/x/sys/unix/ztypes_linux_386.go | 308 +- .../x/sys/unix/ztypes_linux_amd64.go | 344 +- .../golang.org/x/sys/unix/ztypes_linux_arm.go | 350 +- .../x/sys/unix/ztypes_linux_arm64.go | 344 +- .../x/sys/unix/ztypes_linux_mips.go | 346 +- .../x/sys/unix/ztypes_linux_mips64.go | 344 +- .../x/sys/unix/ztypes_linux_mips64le.go | 344 +- .../x/sys/unix/ztypes_linux_mipsle.go | 346 +- .../x/sys/unix/ztypes_linux_ppc64.go | 344 +- .../x/sys/unix/ztypes_linux_ppc64le.go | 344 +- .../x/sys/unix/ztypes_linux_s390x.go | 266 +- vendor/golang.org/x/text/.gitattributes | 10 - vendor/golang.org/x/text/.gitignore | 6 - vendor/golang.org/x/text/AUTHORS | 3 - vendor/golang.org/x/text/CONTRIBUTING.md | 31 - vendor/golang.org/x/text/CONTRIBUTORS | 3 - vendor/golang.org/x/text/LICENSE | 27 - vendor/golang.org/x/text/PATENTS | 22 - vendor/golang.org/x/text/README.md | 93 - vendor/golang.org/x/text/codereview.cfg | 1 - vendor/golang.org/x/text/doc.go | 13 - vendor/golang.org/x/text/gen.go | 319 - vendor/golang.org/x/text/internal/gen.go | 52 - vendor/golang.org/x/text/internal/gen/code.go | 369 - vendor/golang.org/x/text/internal/gen/gen.go | 333 - vendor/golang.org/x/text/internal/gen_test.go | 38 - vendor/golang.org/x/text/internal/internal.go | 51 - .../x/text/internal/internal_test.go | 38 - vendor/golang.org/x/text/internal/match.go | 67 - .../golang.org/x/text/internal/match_test.go | 56 - vendor/golang.org/x/text/internal/tables.go | 118 - .../x/text/internal/triegen/compact.go | 58 - .../x/text/internal/triegen/data_test.go | 875 - .../internal/triegen/example_compact_test.go | 71 - .../x/text/internal/triegen/example_test.go | 148 - .../x/text/internal/triegen/gen_test.go | 68 - .../x/text/internal/triegen/print.go | 251 - .../x/text/internal/triegen/triegen.go | 494 - .../x/text/internal/ucd/example_test.go | 81 - vendor/golang.org/x/text/internal/ucd/ucd.go | 371 - .../x/text/internal/ucd/ucd_test.go | 105 - .../x/text/transform/examples_test.go | 37 - .../golang.org/x/text/transform/transform.go | 705 - .../x/text/transform/transform_test.go | 1317 - vendor/golang.org/x/text/unicode/cldr/base.go | 105 - vendor/golang.org/x/text/unicode/cldr/cldr.go | 130 - .../x/text/unicode/cldr/cldr_test.go | 27 - .../golang.org/x/text/unicode/cldr/collate.go | 359 - .../x/text/unicode/cldr/collate_test.go | 275 - .../x/text/unicode/cldr/data_test.go | 186 - .../golang.org/x/text/unicode/cldr/decode.go | 171 - .../x/text/unicode/cldr/examples_test.go | 21 - .../golang.org/x/text/unicode/cldr/makexml.go | 400 - .../golang.org/x/text/unicode/cldr/resolve.go | 602 - .../x/text/unicode/cldr/resolve_test.go | 368 - .../golang.org/x/text/unicode/cldr/slice.go | 144 - .../x/text/unicode/cldr/slice_test.go | 175 - vendor/golang.org/x/text/unicode/cldr/xml.go | 1494 - vendor/golang.org/x/text/unicode/doc.go | 8 - .../x/text/unicode/norm/composition.go | 508 - .../x/text/unicode/norm/composition_test.go | 130 - .../x/text/unicode/norm/data10.0.0_test.go | 7424 --- .../x/text/unicode/norm/data9.0.0_test.go | 7409 --- .../x/text/unicode/norm/example_iter_test.go | 82 - .../x/text/unicode/norm/example_test.go | 27 - .../x/text/unicode/norm/forminfo.go | 259 - .../x/text/unicode/norm/forminfo_test.go | 54 - .../golang.org/x/text/unicode/norm/input.go | 109 - vendor/golang.org/x/text/unicode/norm/iter.go | 457 - .../x/text/unicode/norm/iter_test.go | 98 - .../x/text/unicode/norm/maketables.go | 976 - .../x/text/unicode/norm/normalize.go | 609 - .../x/text/unicode/norm/normalize_test.go | 1287 - .../x/text/unicode/norm/readwriter.go | 125 - .../x/text/unicode/norm/readwriter_test.go | 56 - .../x/text/unicode/norm/tables10.0.0.go | 7653 --- .../x/text/unicode/norm/tables9.0.0.go | 7633 --- .../x/text/unicode/norm/transform.go | 88 - .../x/text/unicode/norm/transform_test.go | 101 - vendor/golang.org/x/text/unicode/norm/trie.go | 54 - .../golang.org/x/text/unicode/norm/triegen.go | 117 - .../x/text/unicode/norm/ucd_test.go | 275 - vendor/golang.org/x/text/width/common_test.go | 92 - .../golang.org/x/text/width/example_test.go | 52 - vendor/golang.org/x/text/width/gen.go | 115 - vendor/golang.org/x/text/width/gen_common.go | 96 - vendor/golang.org/x/text/width/gen_trieval.go | 34 - vendor/golang.org/x/text/width/kind_string.go | 16 - vendor/golang.org/x/text/width/runes_test.go | 461 - .../golang.org/x/text/width/tables10.0.0.go | 1318 - vendor/golang.org/x/text/width/tables9.0.0.go | 1286 - vendor/golang.org/x/text/width/tables_test.go | 59 - vendor/golang.org/x/text/width/transform.go | 239 - .../golang.org/x/text/width/transform_test.go | 701 - vendor/golang.org/x/text/width/trieval.go | 30 - vendor/golang.org/x/text/width/width.go | 206 - vendor/google.golang.org/grpc/call.go | 312 +- vendor/google.golang.org/grpc/clientconn.go | 47 +- .../google.golang.org/grpc/clientconn_test.go | 35 + vendor/google.golang.org/grpc/codec.go | 98 +- vendor/google.golang.org/grpc/codec_test.go | 106 +- vendor/google.golang.org/grpc/codes/codes.go | 23 +- .../grpc/credentials/credentials.go | 5 +- .../grpc/encoding/encoding.go | 123 +- .../grpc/encoding/proto/proto.go | 110 + .../proto/proto_benchmark_test.go} | 17 +- .../grpc/encoding/proto/proto_test.go | 129 + vendor/google.golang.org/grpc/go16.go | 5 +- vendor/google.golang.org/grpc/go17.go | 5 +- .../grpc/metadata/metadata.go | 55 +- .../grpc/metadata/metadata_test.go | 54 + .../grpc/resolver/resolver.go | 3 - .../grpc/resolver_conn_wrapper.go | 4 +- .../google.golang.org/grpc/resolver_test.go | 99 - vendor/google.golang.org/grpc/rpc_util.go | 98 +- .../google.golang.org/grpc/rpc_util_test.go | 9 +- vendor/google.golang.org/grpc/server.go | 33 +- .../grpc/stats/stats_test.go | 35 +- .../google.golang.org/grpc/status/status.go | 12 +- .../grpc/status/status_test.go | 27 + vendor/google.golang.org/grpc/stream.go | 284 +- .../grpc/transport/handler_server.go | 67 +- .../grpc/transport/handler_server_test.go | 13 +- .../grpc/transport/http2_client.go | 63 +- .../grpc/transport/http2_server.go | 29 +- .../grpc/transport/http_util.go | 67 +- .../grpc/transport/http_util_test.go | 29 +- .../grpc/transport/transport.go | 31 +- 563 files changed, 107278 insertions(+), 95314 deletions(-) create mode 100644 vendor/github.com/Shopify/sarama/acl_bindings.go create mode 100644 vendor/github.com/Shopify/sarama/acl_create_request.go create mode 100644 vendor/github.com/Shopify/sarama/acl_create_request_test.go create mode 100644 vendor/github.com/Shopify/sarama/acl_create_response.go create mode 100644 vendor/github.com/Shopify/sarama/acl_create_response_test.go create mode 100644 vendor/github.com/Shopify/sarama/acl_delete_request.go create mode 100644 vendor/github.com/Shopify/sarama/acl_delete_request_test.go create mode 100644 vendor/github.com/Shopify/sarama/acl_delete_response.go create mode 100644 vendor/github.com/Shopify/sarama/acl_delete_response_test.go create mode 100644 vendor/github.com/Shopify/sarama/acl_describe_request.go create mode 100644 vendor/github.com/Shopify/sarama/acl_describe_request_test.go create mode 100644 vendor/github.com/Shopify/sarama/acl_describe_response.go create mode 100644 vendor/github.com/Shopify/sarama/acl_describe_response_test.go create mode 100644 vendor/github.com/Shopify/sarama/acl_filter.go create mode 100644 vendor/github.com/Shopify/sarama/acl_types.go create mode 100644 vendor/github.com/Shopify/sarama/add_offsets_to_txn_request.go create mode 100644 vendor/github.com/Shopify/sarama/add_offsets_to_txn_request_test.go create mode 100644 vendor/github.com/Shopify/sarama/add_offsets_to_txn_response.go create mode 100644 vendor/github.com/Shopify/sarama/add_offsets_to_txn_response_test.go create mode 100644 vendor/github.com/Shopify/sarama/add_partitions_to_txn_request.go create mode 100644 vendor/github.com/Shopify/sarama/add_partitions_to_txn_request_test.go create mode 100644 vendor/github.com/Shopify/sarama/add_partitions_to_txn_response.go create mode 100644 vendor/github.com/Shopify/sarama/add_partitions_to_txn_response_test.go create mode 100644 vendor/github.com/Shopify/sarama/alter_configs_request.go create mode 100644 vendor/github.com/Shopify/sarama/alter_configs_request_test.go create mode 100644 vendor/github.com/Shopify/sarama/alter_configs_response.go create mode 100644 vendor/github.com/Shopify/sarama/alter_configs_response_test.go create mode 100644 vendor/github.com/Shopify/sarama/client_tls_test.go create mode 100644 vendor/github.com/Shopify/sarama/config_resource_type.go create mode 100644 vendor/github.com/Shopify/sarama/create_topics_request.go create mode 100644 vendor/github.com/Shopify/sarama/create_topics_request_test.go create mode 100644 vendor/github.com/Shopify/sarama/create_topics_response.go create mode 100644 vendor/github.com/Shopify/sarama/create_topics_response_test.go create mode 100644 vendor/github.com/Shopify/sarama/delete_topics_request.go create mode 100644 vendor/github.com/Shopify/sarama/delete_topics_request_test.go create mode 100644 vendor/github.com/Shopify/sarama/delete_topics_response.go create mode 100644 vendor/github.com/Shopify/sarama/delete_topics_response_test.go create mode 100644 vendor/github.com/Shopify/sarama/describe_configs_request.go create mode 100644 vendor/github.com/Shopify/sarama/describe_configs_request_test.go create mode 100644 vendor/github.com/Shopify/sarama/describe_configs_response.go create mode 100644 vendor/github.com/Shopify/sarama/describe_configs_response_test.go create mode 100644 vendor/github.com/Shopify/sarama/end_txn_request.go create mode 100644 vendor/github.com/Shopify/sarama/end_txn_request_test.go create mode 100644 vendor/github.com/Shopify/sarama/end_txn_response.go create mode 100644 vendor/github.com/Shopify/sarama/end_txn_response_test.go create mode 100644 vendor/github.com/Shopify/sarama/init_producer_id_request.go create mode 100644 vendor/github.com/Shopify/sarama/init_producer_id_request_test.go create mode 100644 vendor/github.com/Shopify/sarama/init_producer_id_response.go create mode 100644 vendor/github.com/Shopify/sarama/init_producer_id_response_test.go create mode 100644 vendor/github.com/Shopify/sarama/txn_offset_commit_request.go create mode 100644 vendor/github.com/Shopify/sarama/txn_offset_commit_request_test.go create mode 100644 vendor/github.com/Shopify/sarama/txn_offset_commit_response.go create mode 100644 vendor/github.com/Shopify/sarama/txn_offset_commit_response_test.go create mode 100644 vendor/github.com/aws/aws-sdk-go/internal/sdkrand/locked_source.go create mode 100644 vendor/github.com/coreos/etcd/.words create mode 100644 vendor/github.com/coreos/etcd/CHANGELOG.md create mode 100644 vendor/github.com/coreos/etcd/CODE_OF_CONDUCT.md create mode 100644 vendor/github.com/coreos/etcd/Dockerfile-functional-tester delete mode 100644 vendor/github.com/coreos/etcd/NEWS create mode 100644 vendor/github.com/coreos/etcd/Procfile.v2 create mode 100644 vendor/github.com/coreos/etcd/client/example_keys_test.go create mode 100644 vendor/github.com/coreos/etcd/client/main_test.go create mode 100644 vendor/github.com/coreos/etcd/meeting.ics create mode 100644 vendor/github.com/emicklei/go-restful/path_processor.go create mode 100644 vendor/github.com/emicklei/go-restful/path_processor_test.go create mode 100644 vendor/github.com/gogo/protobuf/proto/discard.go create mode 100644 vendor/github.com/golang/protobuf/proto/discard.go create mode 100644 vendor/github.com/hashicorp/golang-lru/doc.go create mode 100644 vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go create mode 100644 vendor/github.com/imdario/mergo/merge_test.go create mode 100644 vendor/github.com/json-iterator/go/Gopkg.lock create mode 100644 vendor/github.com/json-iterator/go/Gopkg.toml rename vendor/github.com/json-iterator/go/{feature_adapter.go => adapter.go} (78%) rename vendor/github.com/json-iterator/go/{feature_any.go => any.go} (75%) rename vendor/github.com/json-iterator/go/{feature_any_array.go => any_array.go} (100%) rename vendor/github.com/json-iterator/go/{feature_any_bool.go => any_bool.go} (100%) rename vendor/github.com/json-iterator/go/{feature_any_float.go => any_float.go} (100%) rename vendor/github.com/json-iterator/go/{feature_any_int32.go => any_int32.go} (100%) rename vendor/github.com/json-iterator/go/{feature_any_int64.go => any_int64.go} (100%) rename vendor/github.com/json-iterator/go/{feature_any_invalid.go => any_invalid.go} (100%) rename vendor/github.com/json-iterator/go/{feature_any_nil.go => any_nil.go} (100%) rename vendor/github.com/json-iterator/go/{feature_any_number.go => any_number.go} (76%) rename vendor/github.com/json-iterator/go/{feature_any_object.go => any_object.go} (100%) rename vendor/github.com/json-iterator/go/{feature_any_string.go => any_str.go} (97%) rename vendor/github.com/json-iterator/go/{feature_any_uint32.go => any_uint32.go} (100%) rename vendor/github.com/json-iterator/go/{feature_any_uint64.go => any_uint64.go} (100%) create mode 100755 vendor/github.com/json-iterator/go/build.sh delete mode 100644 vendor/github.com/json-iterator/go/compatible_test.go rename vendor/github.com/json-iterator/go/{feature_config.go => config.go} (59%) create mode 100644 vendor/github.com/json-iterator/go/config_with_sync_map.go create mode 100644 vendor/github.com/json-iterator/go/config_without_sync_map.go delete mode 100644 vendor/github.com/json-iterator/go/feature_json_number.go delete mode 100644 vendor/github.com/json-iterator/go/feature_reflect.go delete mode 100644 vendor/github.com/json-iterator/go/feature_reflect_array.go delete mode 100644 vendor/github.com/json-iterator/go/feature_reflect_map.go delete mode 100644 vendor/github.com/json-iterator/go/feature_reflect_native.go delete mode 100644 vendor/github.com/json-iterator/go/feature_reflect_slice.go delete mode 100644 vendor/github.com/json-iterator/go/feature_stream_int.go rename vendor/github.com/json-iterator/go/{feature_iter.go => iter.go} (100%) rename vendor/github.com/json-iterator/go/{feature_iter_array.go => iter_array.go} (100%) rename vendor/github.com/json-iterator/go/{feature_iter_float.go => iter_float.go} (98%) rename vendor/github.com/json-iterator/go/{feature_iter_int.go => iter_int.go} (72%) rename vendor/github.com/json-iterator/go/{feature_iter_object.go => iter_object.go} (68%) rename vendor/github.com/json-iterator/go/{feature_iter_skip.go => iter_skip.go} (100%) rename vendor/github.com/json-iterator/go/{feature_iter_skip_sloppy.go => iter_skip_sloppy.go} (100%) rename vendor/github.com/json-iterator/go/{jsoniter_sloppy_test.go => iter_skip_sloppy_test.go} (99%) rename vendor/github.com/json-iterator/go/{feature_iter_skip_strict.go => iter_skip_strict.go} (100%) rename vendor/github.com/json-iterator/go/{feature_iter_string.go => iter_str.go} (100%) delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_1dot8_only_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_adapter_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_alias_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_any_array_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_any_bool_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_any_float_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_any_int_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_any_map_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_any_null_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_any_object_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_any_string_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_array_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_bool_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_customize_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_demo_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_encode_interface_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_enum_marshaler_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_fixed_array_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_float_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_int_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_interface_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_invalid_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_io_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_iterator_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_large_file_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_map_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_must_be_valid_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_nested_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_null_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_object_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_optional_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_raw_message_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_reader_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_reflect_native_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_skip_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_string_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_struct_decoder_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_struct_encoder_test.go delete mode 100644 vendor/github.com/json-iterator/go/jsoniter_wrap_test.go rename vendor/github.com/json-iterator/go/{feature_pool.go => pool.go} (64%) create mode 100644 vendor/github.com/json-iterator/go/reflect.go create mode 100644 vendor/github.com/json-iterator/go/reflect_array.go create mode 100644 vendor/github.com/json-iterator/go/reflect_dynamic.go rename vendor/github.com/json-iterator/go/{feature_reflect_extension.go => reflect_extension.go} (59%) create mode 100644 vendor/github.com/json-iterator/go/reflect_json_number.go create mode 100644 vendor/github.com/json-iterator/go/reflect_json_raw_message.go create mode 100644 vendor/github.com/json-iterator/go/reflect_map.go create mode 100644 vendor/github.com/json-iterator/go/reflect_marshaler.go create mode 100644 vendor/github.com/json-iterator/go/reflect_native.go create mode 100644 vendor/github.com/json-iterator/go/reflect_optional.go create mode 100644 vendor/github.com/json-iterator/go/reflect_slice.go rename vendor/github.com/json-iterator/go/{feature_reflect_struct_decoder.go => reflect_struct_decoder.go} (69%) rename vendor/github.com/json-iterator/go/{feature_reflect_object.go => reflect_struct_encoder.go} (50%) rename vendor/github.com/json-iterator/go/{feature_stream.go => stream.go} (62%) rename vendor/github.com/json-iterator/go/{feature_stream_float.go => stream_float.go} (85%) create mode 100644 vendor/github.com/json-iterator/go/stream_int.go rename vendor/github.com/json-iterator/go/{feature_stream_string.go => stream_str.go} (91%) rename vendor/github.com/json-iterator/go/{jsoniter_stream_test.go => stream_test.go} (94%) delete mode 100644 vendor/github.com/json-iterator/go/unmarshal_input_test.go create mode 100644 vendor/github.com/ugorji/go/.travis.yml delete mode 100644 vendor/github.com/ugorji/go/codec/codecgen_test.go delete mode 100644 vendor/github.com/ugorji/go/codec/decode_go.go delete mode 100644 vendor/github.com/ugorji/go/codec/decode_go14.go delete mode 100644 vendor/github.com/ugorji/go/codec/gen_15.go delete mode 100644 vendor/github.com/ugorji/go/codec/gen_16.go create mode 100644 vendor/github.com/ugorji/go/codec/goversion_arrayof_gte_go15.go create mode 100644 vendor/github.com/ugorji/go/codec/goversion_arrayof_lt_go15.go create mode 100644 vendor/github.com/ugorji/go/codec/goversion_makemap_gte_go19.go create mode 100644 vendor/github.com/ugorji/go/codec/goversion_makemap_lt_go19.go create mode 100644 vendor/github.com/ugorji/go/codec/goversion_unexportedembeddedptr_gte_go110.go create mode 100644 vendor/github.com/ugorji/go/codec/goversion_unexportedembeddedptr_lt_go110.go create mode 100644 vendor/github.com/ugorji/go/codec/goversion_unsupported_lt_go14.go create mode 100644 vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go15.go create mode 100644 vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go16.go rename vendor/github.com/ugorji/go/codec/{gen_17.go => goversion_vendor_gte_go17.go} (53%) create mode 100644 vendor/github.com/ugorji/go/codec/goversion_vendor_lt_go15.go create mode 100644 vendor/github.com/ugorji/go/codec/mammoth-test.go.tmpl create mode 100644 vendor/github.com/ugorji/go/codec/mammoth2-test.go.tmpl create mode 100644 vendor/github.com/ugorji/go/codec/mammoth2_codecgen_generated_test.go create mode 100644 vendor/github.com/ugorji/go/codec/mammoth2_generated_test.go create mode 100644 vendor/github.com/ugorji/go/codec/mammoth_generated_test.go delete mode 100644 vendor/github.com/ugorji/go/codec/prebuild.go delete mode 100755 vendor/github.com/ugorji/go/codec/prebuild.sh delete mode 100755 vendor/github.com/ugorji/go/codec/tests.sh delete mode 100644 vendor/github.com/ugorji/go/codec/time.go create mode 100644 vendor/github.com/ugorji/go/codec/values_flex_test.go create mode 100644 vendor/github.com/ugorji/go/codec/xml.go create mode 100644 vendor/github.com/ugorji/go/codec/z_all_test.go create mode 100644 vendor/github.com/v2pro/plz/.gitignore create mode 100644 vendor/github.com/v2pro/plz/LICENSE create mode 100644 vendor/github.com/v2pro/plz/README.md create mode 100644 vendor/github.com/v2pro/plz/closer.go create mode 100644 vendor/github.com/v2pro/plz/concurrent/executor.go create mode 100644 vendor/github.com/v2pro/plz/concurrent/go_above_19.go create mode 100644 vendor/github.com/v2pro/plz/concurrent/go_below_19.go create mode 100644 vendor/github.com/v2pro/plz/concurrent/unbounded_executor.go create mode 100644 vendor/github.com/v2pro/plz/reflect2/README.md create mode 100644 vendor/github.com/v2pro/plz/reflect2/go_above_17.go create mode 100644 vendor/github.com/v2pro/plz/reflect2/go_above_19.go create mode 100644 vendor/github.com/v2pro/plz/reflect2/go_below_17.go create mode 100644 vendor/github.com/v2pro/plz/reflect2/go_below_19.go create mode 100644 vendor/github.com/v2pro/plz/reflect2/reflect2.go rename vendor/{google.golang.org/grpc/.please-update => github.com/v2pro/plz/reflect2/reflect2_amd64.s} (100%) create mode 100644 vendor/github.com/v2pro/plz/reflect2/reflect2_kind.go create mode 100644 vendor/github.com/v2pro/plz/reflect2/relfect2_386.s create mode 100644 vendor/github.com/v2pro/plz/reflect2/relfect2_amd64p32.s create mode 100644 vendor/github.com/v2pro/plz/reflect2/relfect2_arm.s create mode 100644 vendor/github.com/v2pro/plz/reflect2/relfect2_arm64.s create mode 100644 vendor/github.com/v2pro/plz/reflect2/relfect2_mips64x.s create mode 100644 vendor/github.com/v2pro/plz/reflect2/relfect2_mipsx.s create mode 100644 vendor/github.com/v2pro/plz/reflect2/relfect2_ppc64x.s create mode 100644 vendor/github.com/v2pro/plz/reflect2/relfect2_s390x.s create mode 100644 vendor/github.com/v2pro/plz/reflect2/safe_field.go create mode 100644 vendor/github.com/v2pro/plz/reflect2/safe_map.go create mode 100644 vendor/github.com/v2pro/plz/reflect2/safe_slice.go create mode 100644 vendor/github.com/v2pro/plz/reflect2/safe_struct.go create mode 100644 vendor/github.com/v2pro/plz/reflect2/safe_type.go create mode 100644 vendor/github.com/v2pro/plz/reflect2/type_map.go create mode 100644 vendor/github.com/v2pro/plz/reflect2/unsafe_array.go create mode 100644 vendor/github.com/v2pro/plz/reflect2/unsafe_eface.go create mode 100644 vendor/github.com/v2pro/plz/reflect2/unsafe_field.go create mode 100644 vendor/github.com/v2pro/plz/reflect2/unsafe_iface.go create mode 100644 vendor/github.com/v2pro/plz/reflect2/unsafe_link.go create mode 100644 vendor/github.com/v2pro/plz/reflect2/unsafe_map.go create mode 100644 vendor/github.com/v2pro/plz/reflect2/unsafe_ptr.go create mode 100644 vendor/github.com/v2pro/plz/reflect2/unsafe_slice.go create mode 100644 vendor/github.com/v2pro/plz/reflect2/unsafe_struct.go create mode 100644 vendor/github.com/v2pro/plz/reflect2/unsafe_type.go create mode 100644 vendor/golang.org/x/sys/unix/syscall_linux_gc.go delete mode 100644 vendor/golang.org/x/text/.gitattributes delete mode 100644 vendor/golang.org/x/text/.gitignore delete mode 100644 vendor/golang.org/x/text/AUTHORS delete mode 100644 vendor/golang.org/x/text/CONTRIBUTING.md delete mode 100644 vendor/golang.org/x/text/CONTRIBUTORS delete mode 100644 vendor/golang.org/x/text/LICENSE delete mode 100644 vendor/golang.org/x/text/PATENTS delete mode 100644 vendor/golang.org/x/text/README.md delete mode 100644 vendor/golang.org/x/text/codereview.cfg delete mode 100644 vendor/golang.org/x/text/doc.go delete mode 100644 vendor/golang.org/x/text/gen.go delete mode 100644 vendor/golang.org/x/text/internal/gen.go delete mode 100644 vendor/golang.org/x/text/internal/gen/code.go delete mode 100644 vendor/golang.org/x/text/internal/gen/gen.go delete mode 100644 vendor/golang.org/x/text/internal/gen_test.go delete mode 100644 vendor/golang.org/x/text/internal/internal.go delete mode 100644 vendor/golang.org/x/text/internal/internal_test.go delete mode 100644 vendor/golang.org/x/text/internal/match.go delete mode 100644 vendor/golang.org/x/text/internal/match_test.go delete mode 100644 vendor/golang.org/x/text/internal/tables.go delete mode 100644 vendor/golang.org/x/text/internal/triegen/compact.go delete mode 100644 vendor/golang.org/x/text/internal/triegen/data_test.go delete mode 100644 vendor/golang.org/x/text/internal/triegen/example_compact_test.go delete mode 100644 vendor/golang.org/x/text/internal/triegen/example_test.go delete mode 100644 vendor/golang.org/x/text/internal/triegen/gen_test.go delete mode 100644 vendor/golang.org/x/text/internal/triegen/print.go delete mode 100644 vendor/golang.org/x/text/internal/triegen/triegen.go delete mode 100644 vendor/golang.org/x/text/internal/ucd/example_test.go delete mode 100644 vendor/golang.org/x/text/internal/ucd/ucd.go delete mode 100644 vendor/golang.org/x/text/internal/ucd/ucd_test.go delete mode 100644 vendor/golang.org/x/text/transform/examples_test.go delete mode 100644 vendor/golang.org/x/text/transform/transform.go delete mode 100644 vendor/golang.org/x/text/transform/transform_test.go delete mode 100644 vendor/golang.org/x/text/unicode/cldr/base.go delete mode 100644 vendor/golang.org/x/text/unicode/cldr/cldr.go delete mode 100644 vendor/golang.org/x/text/unicode/cldr/cldr_test.go delete mode 100644 vendor/golang.org/x/text/unicode/cldr/collate.go delete mode 100644 vendor/golang.org/x/text/unicode/cldr/collate_test.go delete mode 100644 vendor/golang.org/x/text/unicode/cldr/data_test.go delete mode 100644 vendor/golang.org/x/text/unicode/cldr/decode.go delete mode 100644 vendor/golang.org/x/text/unicode/cldr/examples_test.go delete mode 100644 vendor/golang.org/x/text/unicode/cldr/makexml.go delete mode 100644 vendor/golang.org/x/text/unicode/cldr/resolve.go delete mode 100644 vendor/golang.org/x/text/unicode/cldr/resolve_test.go delete mode 100644 vendor/golang.org/x/text/unicode/cldr/slice.go delete mode 100644 vendor/golang.org/x/text/unicode/cldr/slice_test.go delete mode 100644 vendor/golang.org/x/text/unicode/cldr/xml.go delete mode 100644 vendor/golang.org/x/text/unicode/doc.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/composition.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/composition_test.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/data10.0.0_test.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/data9.0.0_test.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/example_iter_test.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/example_test.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/forminfo.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/forminfo_test.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/input.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/iter.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/iter_test.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/maketables.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/normalize.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/normalize_test.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/readwriter.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/readwriter_test.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/tables10.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/tables9.0.0.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/transform.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/transform_test.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/trie.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/triegen.go delete mode 100644 vendor/golang.org/x/text/unicode/norm/ucd_test.go delete mode 100644 vendor/golang.org/x/text/width/common_test.go delete mode 100644 vendor/golang.org/x/text/width/example_test.go delete mode 100644 vendor/golang.org/x/text/width/gen.go delete mode 100644 vendor/golang.org/x/text/width/gen_common.go delete mode 100644 vendor/golang.org/x/text/width/gen_trieval.go delete mode 100644 vendor/golang.org/x/text/width/kind_string.go delete mode 100644 vendor/golang.org/x/text/width/runes_test.go delete mode 100644 vendor/golang.org/x/text/width/tables10.0.0.go delete mode 100644 vendor/golang.org/x/text/width/tables9.0.0.go delete mode 100644 vendor/golang.org/x/text/width/tables_test.go delete mode 100644 vendor/golang.org/x/text/width/transform.go delete mode 100644 vendor/golang.org/x/text/width/transform_test.go delete mode 100644 vendor/golang.org/x/text/width/trieval.go delete mode 100644 vendor/golang.org/x/text/width/width.go create mode 100644 vendor/google.golang.org/grpc/encoding/proto/proto.go rename vendor/google.golang.org/grpc/{codec_benchmark_test.go => encoding/proto/proto_benchmark_test.go} (83%) create mode 100644 vendor/google.golang.org/grpc/encoding/proto/proto_test.go delete mode 100644 vendor/google.golang.org/grpc/resolver_test.go diff --git a/Gopkg.lock b/Gopkg.lock index 234f1e2bf..f9ed37f5b 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -16,8 +16,8 @@ [[projects]] name = "github.com/Shopify/sarama" packages = ["."] - revision = "3b1b38866a79f06deddf0487d5c27ba0697ccd65" - version = "v1.15.0" + revision = "f7be6aa2bc7b2e38edf816b08b582782194a1c02" + version = "v1.16.0" [[projects]] name = "github.com/apache/thrift" @@ -44,6 +44,7 @@ "aws/request", "aws/session", "aws/signer/v4", + "internal/sdkrand", "internal/shareddefaults", "private/protocol", "private/protocol/query", @@ -55,8 +56,8 @@ "service/route53/route53iface", "service/sts" ] - revision = "0cebc639926eb91b0192dae4b28bc808417e764c" - version = "v1.12.61" + revision = "f7f1ee9550cc76ceea731d99c8dbe00a0c39f66d" + version = "v1.13.4" [[projects]] name = "github.com/coreos/etcd" @@ -67,8 +68,8 @@ "pkg/types", "version" ] - revision = "fb5cd6f1c72c2b98e0c4453444cdfba306da867b" - version = "v3.2.14" + revision = "28f3f26c0e303392556035b694f75768d449d33d" + version = "v3.3.1" [[projects]] name = "github.com/coreos/go-semver" @@ -112,14 +113,14 @@ ".", "log" ] - revision = "2dd44038f0b95ae693b266c5f87593b5d2fdd78d" - version = "v2.5.0" + revision = "26b41036311f2da8242db402557a0dbd09dc83da" + version = "v2.6.0" [[projects]] branch = "master" name = "github.com/farsightsec/golang-framestream" packages = ["."] - revision = "dec85654e8b8cf6712870afb14ee53d1c98cd5e2" + revision = "c06a5734334d9629b3db143d74b47eb94ea68612" [[projects]] name = "github.com/ghodss/yaml" @@ -155,13 +156,13 @@ branch = "master" name = "github.com/go-openapi/spec" packages = ["."] - revision = "fa03337d7da5735229ee8f5e9d5d0b996014b7f8" + revision = "1de3e0542de65ad8d75452a595886fdd0befb363" [[projects]] branch = "master" name = "github.com/go-openapi/swag" packages = ["."] - revision = "84f4bee7c0a6db40e3166044c7983c1c32125429" + revision = "0d03ad0b6405ada874d59d97c416b5cf4234e154" [[projects]] name = "github.com/gogo/protobuf" @@ -169,8 +170,8 @@ "proto", "sortkeys" ] - revision = "342cbe0a04158f6dcb03ca0079991a51a4248c02" - version = "v0.5" + revision = "1adfc126b41513cc696b209667c8656ea7aac67c" + version = "v1.0.0" [[projects]] branch = "master" @@ -179,7 +180,6 @@ revision = "23def4e6c14b4da8ac2ed8007337bc5eb5007998" [[projects]] - branch = "master" name = "github.com/golang/protobuf" packages = [ "proto", @@ -188,7 +188,8 @@ "ptypes/duration", "ptypes/timestamp" ] - revision = "1e59b77b52bf8e4b449a57e6f79f21226d571845" + revision = "925541529c1fa6821df4e44ce2723319eb2be768" + version = "v1.0.0" [[projects]] branch = "master" @@ -200,7 +201,7 @@ branch = "master" name = "github.com/google/btree" packages = ["."] - revision = "316fb6d3f031ae8f4d457c6c5186b9e3ded70435" + revision = "e89373fe6b4a7413d7acd6da1725b83ef713e6e4" [[projects]] branch = "master" @@ -240,7 +241,7 @@ ".", "simplelru" ] - revision = "0a025b7e63adc15a622f29b0b2c4c3848243bbf6" + revision = "0fb14efe8c47ae851c0034ed7a448854d3d34cf3" [[projects]] branch = "master" @@ -251,8 +252,8 @@ [[projects]] name = "github.com/imdario/mergo" packages = ["."] - revision = "f1ac5984e69fed03e0574a92f70c59f132616ea2" - version = "0.3.0" + revision = "163f41321a19dd09362d4c63cc2489db2015f1f4" + version = "0.3.2" [[projects]] name = "github.com/jmespath/go-jmespath" @@ -262,14 +263,14 @@ [[projects]] name = "github.com/json-iterator/go" packages = ["."] - revision = "f7279a603edee96fe7764d3de9c6ff8cf9970994" - version = "1.0.4" + revision = "0ac74bba4a81211b28e32ef260c0f16ae41f1377" + version = "1.1.1" [[projects]] - branch = "master" name = "github.com/juju/ratelimit" packages = ["."] revision = "59fac5042749a5afb9af70e813da1dd5474f0167" + version = "1.0.1" [[projects]] branch = "master" @@ -366,7 +367,7 @@ branch = "master" name = "github.com/rcrowley/go-metrics" packages = ["."] - revision = "e181e095bae94582363434144c61a9653aff6e50" + revision = "8732c616f52954686704c8645fe1a9d59e9df7c1" [[projects]] name = "github.com/spf13/pflag" @@ -377,13 +378,23 @@ [[projects]] name = "github.com/ugorji/go" packages = ["codec"] - revision = "8c0409fcbb70099c748d71f714529204975f6c3f" + revision = "9831f2c3ac1068a78f50999a30db84270f647af6" + version = "v1.1" + +[[projects]] + name = "github.com/v2pro/plz" + packages = [ + "concurrent", + "reflect2" + ] + revision = "10fc95fad3224a032229e59f6e7023137d82b526" + version = "0.9.1" [[projects]] branch = "master" name = "golang.org/x/crypto" packages = ["ssh/terminal"] - revision = "13931e22f9e72ea58bb73048bc752b48c6d4d4ac" + revision = "49796115aa4b964c318aad4f3084fdb41e9aa067" [[projects]] branch = "master" @@ -392,27 +403,13 @@ "unix", "windows" ] - revision = "810d7000345868fc619eb81f46307107118f4ae1" - -[[projects]] - branch = "master" - name = "golang.org/x/text" - packages = [ - "internal/gen", - "internal/triegen", - "internal/ucd", - "transform", - "unicode/cldr", - "unicode/norm", - "width" - ] - revision = "e19ae1496984b1c655b8044a65c0300a3c878dd3" + revision = "88d2dcc510266da9f7f8c7f34e1940716cab5f5c" [[projects]] branch = "master" name = "google.golang.org/genproto" packages = ["googleapis/rpc/status"] - revision = "a8101f21cf983e773d0c1133ebc5424792003214" + revision = "2b5a72b8730b0b16380010cfe5286c42108d88e7" [[projects]] name = "google.golang.org/grpc" @@ -425,6 +422,7 @@ "connectivity", "credentials", "encoding", + "encoding/proto", "grpclb/grpc_lb_v1/messages", "grpclog", "internal", @@ -440,8 +438,8 @@ "tap", "transport" ] - revision = "7cea4cc846bcf00cbb27595b07da5de875ef7de9" - version = "v1.9.1" + revision = "8e4536a86ab602859c20df5ebfd0bd4228d08655" + version = "v1.10.0" [[projects]] name = "gopkg.in/inf.v0" @@ -593,11 +591,11 @@ branch = "master" name = "k8s.io/kube-openapi" packages = ["pkg/common"] - revision = "a07b7bbb58e7fdc5144f8d7046331d29fc9ad3b3" + revision = "50ae88d24ede7b8bad68e23c805b5d3da5c8abaf" [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "eb43278f9f3825b0fa2ba07fd7ecd66fa9741b62bb276f7246db83bc53a39d84" + inputs-digest = "e302488e45c3f12eae09558fb7c71cf495826866cb5b764745c10fffcb325537" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index c21833365..b50130d37 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -2,6 +2,7 @@ ignored = [ "github.com/mholt/caddy", "github.com/mholt/caddy/caddyfile", "github.com/mholt/caddy/startupshutdown", + "github.com/mholt/caddy/onevent", "github.com/miekg/dns", "github.com/prometheus/client_golang/prometheus", "github.com/prometheus/client_golang/prometheus/promhttp", @@ -13,12 +14,15 @@ ignored = [ "golang.org/x/net/internal/timeseries", "golang.org/x/net/lex/httplex", "golang.org/x/net/trace", + "golang.org/x/text/internal/gen", + "golang.org/x/text/internal/triegen", + "golang.org/x/text/internal/ucd", + "golang.org/x/text/transform", + "golang.org/x/text/unicode/cldr", + "golang.org/x/text/unicode/norm", + "golang.org/x/text/width", ] -[[override]] - name = "github.com/ugorji/go" - revision = "8c0409fcbb70099c748d71f714529204975f6c3f" - # client-go 6.0.0 uses apimachinery 180eddb345a5be3a157cea1c624700ad5bd27b8f # and api 11147472b7c934c474a2c484af3c0c5210b7a3af (see Godep.json). go dep # is unable to match Godep.json automatically so have to specify here. diff --git a/Makefile b/Makefile index 28ea7a0c5..e350ecef4 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,8 @@ godeps: (cd $(GOPATH)/src/github.com/prometheus/client_golang && git checkout -q v0.8.0) (cd $(GOPATH)/src/golang.org/x/net && git checkout -q release-branch.go1.10) (cd $(GOPATH)/src/golang.org/x/text && git checkout -q v0.3.0) + # github.com/flynn/go-shlex is required by mholt/caddy at the moment + go get -u github.com/flynn/go-shlex .PHONY: travis travis: check diff --git a/vendor/github.com/Shopify/sarama/.travis.yml b/vendor/github.com/Shopify/sarama/.travis.yml index ba1c0ab2d..cc38769fa 100644 --- a/vendor/github.com/Shopify/sarama/.travis.yml +++ b/vendor/github.com/Shopify/sarama/.travis.yml @@ -1,6 +1,5 @@ language: go go: -- 1.7.x - 1.8.x - 1.9.x @@ -22,8 +21,7 @@ before_install: - vagrant/boot_cluster.sh - vagrant/create_topics.sh -install: -- make install_dependencies +install: make install_dependencies script: - make test @@ -32,6 +30,6 @@ script: - make fmt after_success: - - bash <(curl -s https://codecov.io/bash) +- bash <(curl -s https://codecov.io/bash) -sudo: false +after_script: vagrant/halt_cluster.sh diff --git a/vendor/github.com/Shopify/sarama/CHANGELOG.md b/vendor/github.com/Shopify/sarama/CHANGELOG.md index fcc928723..836841650 100644 --- a/vendor/github.com/Shopify/sarama/CHANGELOG.md +++ b/vendor/github.com/Shopify/sarama/CHANGELOG.md @@ -1,5 +1,47 @@ # Changelog +#### Version 1.16.0 (2018-02-12) + +New Features: + - Add support for the Create/Delete Topics request/response pairs + ([#1007](https://github.com/Shopify/sarama/pull/1007), + [#1008](https://github.com/Shopify/sarama/pull/1008)). + - Add support for the Describe/Create/Delete ACL request/response pairs + ([#1009](https://github.com/Shopify/sarama/pull/1009)). + - Add support for the five transaction-related request/response pairs + ([#1016](https://github.com/Shopify/sarama/pull/1016)). + +Improvements: + - Permit setting version on mock producer responses + ([#999](https://github.com/Shopify/sarama/pull/999)). + - Add `NewMockBrokerListener` helper for testing TLS connections + ([#1019](https://github.com/Shopify/sarama/pull/1019)). + - Changed the default value for `Consumer.Fetch.Default` from 32KiB to 1MiB + which results in much higher throughput in most cases + ([#1024](https://github.com/Shopify/sarama/pull/1024)). + - Reuse the `time.Ticker` across fetch requests in the PartitionConsumer to + reduce CPU and memory usage when processing many partitions + ([#1028](https://github.com/Shopify/sarama/pull/1028)). + - Assign relative offsets to messages in the producer to save the brokers a + recompression pass + ([#1002](https://github.com/Shopify/sarama/pull/1002), + [#1015](https://github.com/Shopify/sarama/pull/1015)). + +Bug Fixes: + - Fix producing uncompressed batches with the new protocol format + ([#1032](https://github.com/Shopify/sarama/issues/1032)). + - Fix consuming compacted topics with the new protocol format + ([#1005](https://github.com/Shopify/sarama/issues/1005)). + - Fix consuming topics with a mix of protocol formats + ([#1021](https://github.com/Shopify/sarama/issues/1021)). + - Fix consuming when the broker includes multiple batches in a single response + ([#1022](https://github.com/Shopify/sarama/issues/1022)). + - Fix detection of `PartialTrailingMessage` when the partial message was + truncated before the magic value indicating its version + ([#1030](https://github.com/Shopify/sarama/pull/1030)). + - Fix expectation-checking in the mock of `SyncProducer.SendMessages` + ([#1035](https://github.com/Shopify/sarama/pull/1035)). + #### Version 1.15.0 (2017-12-08) New Features: diff --git a/vendor/github.com/Shopify/sarama/README.md b/vendor/github.com/Shopify/sarama/README.md index 25eb0cf92..28431f13e 100644 --- a/vendor/github.com/Shopify/sarama/README.md +++ b/vendor/github.com/Shopify/sarama/README.md @@ -21,7 +21,7 @@ You might also want to look at the [Frequently Asked Questions](https://github.c Sarama provides a "2 releases + 2 months" compatibility guarantee: we support the two latest stable releases of Kafka and Go, and we provide a two month grace period for older releases. This means we currently officially support -Go 1.9 through 1.7, and Kafka 1.0 through 0.10, although older releases are +Go 1.9 and 1.8, and Kafka 1.0 through 0.10, although older releases are still likely to work. Sarama follows semantic versioning and provides API stability via the gopkg.in service. diff --git a/vendor/github.com/Shopify/sarama/acl_bindings.go b/vendor/github.com/Shopify/sarama/acl_bindings.go new file mode 100644 index 000000000..51517359a --- /dev/null +++ b/vendor/github.com/Shopify/sarama/acl_bindings.go @@ -0,0 +1,119 @@ +package sarama + +type Resource struct { + ResourceType AclResourceType + ResourceName string +} + +func (r *Resource) encode(pe packetEncoder) error { + pe.putInt8(int8(r.ResourceType)) + + if err := pe.putString(r.ResourceName); err != nil { + return err + } + + return nil +} + +func (r *Resource) decode(pd packetDecoder, version int16) (err error) { + resourceType, err := pd.getInt8() + if err != nil { + return err + } + r.ResourceType = AclResourceType(resourceType) + + if r.ResourceName, err = pd.getString(); err != nil { + return err + } + + return nil +} + +type Acl struct { + Principal string + Host string + Operation AclOperation + PermissionType AclPermissionType +} + +func (a *Acl) encode(pe packetEncoder) error { + if err := pe.putString(a.Principal); err != nil { + return err + } + + if err := pe.putString(a.Host); err != nil { + return err + } + + pe.putInt8(int8(a.Operation)) + pe.putInt8(int8(a.PermissionType)) + + return nil +} + +func (a *Acl) decode(pd packetDecoder, version int16) (err error) { + if a.Principal, err = pd.getString(); err != nil { + return err + } + + if a.Host, err = pd.getString(); err != nil { + return err + } + + operation, err := pd.getInt8() + if err != nil { + return err + } + a.Operation = AclOperation(operation) + + permissionType, err := pd.getInt8() + if err != nil { + return err + } + a.PermissionType = AclPermissionType(permissionType) + + return nil +} + +type ResourceAcls struct { + Resource + Acls []*Acl +} + +func (r *ResourceAcls) encode(pe packetEncoder) error { + if err := r.Resource.encode(pe); err != nil { + return err + } + + if err := pe.putArrayLength(len(r.Acls)); err != nil { + return err + } + for _, acl := range r.Acls { + if err := acl.encode(pe); err != nil { + return err + } + } + + return nil +} + +func (r *ResourceAcls) decode(pd packetDecoder, version int16) error { + if err := r.Resource.decode(pd, version); err != nil { + return err + } + + n, err := pd.getArrayLength() + if err != nil { + return err + } + + r.Acls = make([]*Acl, n) + for i := 0; i < n; i++ { + r.Acls[i] = new(Acl) + if err := r.Acls[i].decode(pd, version); err != nil { + return err + } + } + + return nil +} diff --git a/vendor/github.com/Shopify/sarama/acl_create_request.go b/vendor/github.com/Shopify/sarama/acl_create_request.go new file mode 100644 index 000000000..0b6ecbec3 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/acl_create_request.go @@ -0,0 +1,76 @@ +package sarama + +type CreateAclsRequest struct { + AclCreations []*AclCreation +} + +func (c *CreateAclsRequest) encode(pe packetEncoder) error { + if err := pe.putArrayLength(len(c.AclCreations)); err != nil { + return err + } + + for _, aclCreation := range c.AclCreations { + if err := aclCreation.encode(pe); err != nil { + return err + } + } + + return nil +} + +func (c *CreateAclsRequest) decode(pd packetDecoder, version int16) (err error) { + n, err := pd.getArrayLength() + if err != nil { + return err + } + + c.AclCreations = make([]*AclCreation, n) + + for i := 0; i < n; i++ { + c.AclCreations[i] = new(AclCreation) + if err := c.AclCreations[i].decode(pd, version); err != nil { + return err + } + } + + return nil +} + +func (d *CreateAclsRequest) key() int16 { + return 30 +} + +func (d *CreateAclsRequest) version() int16 { + return 0 +} + +func (d *CreateAclsRequest) requiredVersion() KafkaVersion { + return V0_11_0_0 +} + +type AclCreation struct { + Resource + Acl +} + +func (a *AclCreation) encode(pe packetEncoder) error { + if err := a.Resource.encode(pe); err != nil { + return err + } + if err := a.Acl.encode(pe); err != nil { + return err + } + + return nil +} + +func (a *AclCreation) decode(pd packetDecoder, version int16) (err error) { + if err := a.Resource.decode(pd, version); err != nil { + return err + } + if err := a.Acl.decode(pd, version); err != nil { + return err + } + + return nil +} diff --git a/vendor/github.com/Shopify/sarama/acl_create_request_test.go b/vendor/github.com/Shopify/sarama/acl_create_request_test.go new file mode 100644 index 000000000..fb4b35c16 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/acl_create_request_test.go @@ -0,0 +1,34 @@ +package sarama + +import "testing" + +var ( + aclCreateRequest = []byte{ + 0, 0, 0, 1, + 3, // resource type = group + 0, 5, 'g', 'r', 'o', 'u', 'p', + 0, 9, 'p', 'r', 'i', 'n', 'c', 'i', 'p', 'a', 'l', + 0, 4, 'h', 'o', 's', 't', + 2, // all + 2, // deny + } +) + +func TestCreateAclsRequest(t *testing.T) { + req := &CreateAclsRequest{ + AclCreations: []*AclCreation{{ + Resource: Resource{ + ResourceType: AclResourceGroup, + ResourceName: "group", + }, + Acl: Acl{ + Principal: "principal", + Host: "host", + Operation: AclOperationAll, + PermissionType: AclPermissionDeny, + }}, + }, + } + + testRequest(t, "create request", req, aclCreateRequest) +} diff --git a/vendor/github.com/Shopify/sarama/acl_create_response.go b/vendor/github.com/Shopify/sarama/acl_create_response.go new file mode 100644 index 000000000..8a56f3573 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/acl_create_response.go @@ -0,0 +1,88 @@ +package sarama + +import "time" + +type CreateAclsResponse struct { + ThrottleTime time.Duration + AclCreationResponses []*AclCreationResponse +} + +func (c *CreateAclsResponse) encode(pe packetEncoder) error { + pe.putInt32(int32(c.ThrottleTime / time.Millisecond)) + + if err := pe.putArrayLength(len(c.AclCreationResponses)); err != nil { + return err + } + + for _, aclCreationResponse := range c.AclCreationResponses { + if err := aclCreationResponse.encode(pe); err != nil { + return err + } + } + + return nil +} + +func (c *CreateAclsResponse) decode(pd packetDecoder, version int16) (err error) { + throttleTime, err := pd.getInt32() + if err != nil { + return err + } + c.ThrottleTime = time.Duration(throttleTime) * time.Millisecond + + n, err := pd.getArrayLength() + if err != nil { + return err + } + + c.AclCreationResponses = make([]*AclCreationResponse, n) + for i := 0; i < n; i++ { + c.AclCreationResponses[i] = new(AclCreationResponse) + if err := c.AclCreationResponses[i].decode(pd, version); err != nil { + return err + } + } + + return nil +} + +func (d *CreateAclsResponse) key() int16 { + return 30 +} + +func (d *CreateAclsResponse) version() int16 { + return 0 +} + +func (d *CreateAclsResponse) requiredVersion() KafkaVersion { + return V0_11_0_0 +} + +type AclCreationResponse struct { + Err KError + ErrMsg *string +} + +func (a *AclCreationResponse) encode(pe packetEncoder) error { + pe.putInt16(int16(a.Err)) + + if err := pe.putNullableString(a.ErrMsg); err != nil { + return err + } + + return nil +} + +func (a *AclCreationResponse) decode(pd packetDecoder, version int16) (err error) { + kerr, err := pd.getInt16() + if err != nil { + return err + } + a.Err = KError(kerr) + + if a.ErrMsg, err = pd.getNullableString(); err != nil { + return err + } + + return nil +} diff --git a/vendor/github.com/Shopify/sarama/acl_create_response_test.go b/vendor/github.com/Shopify/sarama/acl_create_response_test.go new file mode 100644 index 000000000..65b934d9a --- /dev/null +++ b/vendor/github.com/Shopify/sarama/acl_create_response_test.go @@ -0,0 +1,41 @@ +package sarama + +import ( + "testing" + "time" +) + +var ( + createResponseWithError = []byte{ + 0, 0, 0, 100, + 0, 0, 0, 1, + 0, 42, + 0, 5, 'e', 'r', 'r', 'o', 'r', + } + + createResponseArray = []byte{ + 0, 0, 0, 100, + 0, 0, 0, 2, + 0, 42, + 0, 5, 'e', 'r', 'r', 'o', 'r', + 0, 0, + 255, 255, + } +) + +func TestCreateAclsResponse(t *testing.T) { + errmsg := "error" + resp := &CreateAclsResponse{ + ThrottleTime: 100 * time.Millisecond, + AclCreationResponses: []*AclCreationResponse{{ + Err: ErrInvalidRequest, + ErrMsg: &errmsg, + }}, + } + + testResponse(t, "response with error", resp, createResponseWithError) + + resp.AclCreationResponses = append(resp.AclCreationResponses, new(AclCreationResponse)) + + testResponse(t, "response array", resp, createResponseArray) +} diff --git a/vendor/github.com/Shopify/sarama/acl_delete_request.go b/vendor/github.com/Shopify/sarama/acl_delete_request.go new file mode 100644 index 000000000..4133dceab --- /dev/null +++ b/vendor/github.com/Shopify/sarama/acl_delete_request.go @@ -0,0 +1,48 @@ +package sarama + +type DeleteAclsRequest struct { + Filters []*AclFilter +} + +func (d *DeleteAclsRequest) encode(pe packetEncoder) error { + if err := pe.putArrayLength(len(d.Filters)); err != nil { + return err + } + + for _, filter := range d.Filters { + if err := filter.encode(pe); err != nil { + return err + } + } + + return nil +} + +func (d *DeleteAclsRequest) decode(pd packetDecoder, version int16) (err error) { + n, err := pd.getArrayLength() + if err != nil { + return err + } + + d.Filters = make([]*AclFilter, n) + for i := 0; i < n; i++ { + d.Filters[i] = new(AclFilter) + if err := d.Filters[i].decode(pd, version); err != nil { + return err + } + } + + return nil +} + +func (d *DeleteAclsRequest) key() int16 { + return 31 +} + +func (d *DeleteAclsRequest) version() int16 { + return 0 +} + +func (d *DeleteAclsRequest) requiredVersion() KafkaVersion { + return V0_11_0_0 +} diff --git a/vendor/github.com/Shopify/sarama/acl_delete_request_test.go b/vendor/github.com/Shopify/sarama/acl_delete_request_test.go new file mode 100644 index 000000000..2efdcb48e --- /dev/null +++ b/vendor/github.com/Shopify/sarama/acl_delete_request_test.go @@ -0,0 +1,69 @@ +package sarama + +import "testing" + +var ( + aclDeleteRequestNulls = []byte{ + 0, 0, 0, 1, + 1, + 255, 255, + 255, 255, + 255, 255, + 11, + 3, + } + + aclDeleteRequest = []byte{ + 0, 0, 0, 1, + 1, // any + 0, 6, 'f', 'i', 'l', 't', 'e', 'r', + 0, 9, 'p', 'r', 'i', 'n', 'c', 'i', 'p', 'a', 'l', + 0, 4, 'h', 'o', 's', 't', + 4, // write + 3, // allow + } + + aclDeleteRequestArray = []byte{ + 0, 0, 0, 2, + 1, + 0, 6, 'f', 'i', 'l', 't', 'e', 'r', + 0, 9, 'p', 'r', 'i', 'n', 'c', 'i', 'p', 'a', 'l', + 0, 4, 'h', 'o', 's', 't', + 4, // write + 3, // allow + 2, + 0, 5, 't', 'o', 'p', 'i', 'c', + 255, 255, + 255, 255, + 6, + 2, + } +) + +func TestDeleteAclsRequest(t *testing.T) { + req := &DeleteAclsRequest{ + Filters: []*AclFilter{{ + ResourceType: AclResourceAny, + Operation: AclOperationAlterConfigs, + PermissionType: AclPermissionAllow, + }}, + } + + testRequest(t, "delete request nulls", req, aclDeleteRequestNulls) + + req.Filters[0].ResourceName = nullString("filter") + req.Filters[0].Principal = nullString("principal") + req.Filters[0].Host = nullString("host") + req.Filters[0].Operation = AclOperationWrite + + testRequest(t, "delete request", req, aclDeleteRequest) + + req.Filters = append(req.Filters, &AclFilter{ + ResourceType: AclResourceTopic, + ResourceName: nullString("topic"), + Operation: AclOperationDelete, + PermissionType: AclPermissionDeny, + }) + + testRequest(t, "delete request array", req, aclDeleteRequestArray) +} diff --git a/vendor/github.com/Shopify/sarama/acl_delete_response.go b/vendor/github.com/Shopify/sarama/acl_delete_response.go new file mode 100644 index 000000000..b5e1c45eb --- /dev/null +++ b/vendor/github.com/Shopify/sarama/acl_delete_response.go @@ -0,0 +1,155 @@ +package sarama + +import "time" + +type DeleteAclsResponse struct { + ThrottleTime time.Duration + FilterResponses []*FilterResponse +} + +func (a *DeleteAclsResponse) encode(pe packetEncoder) error { + pe.putInt32(int32(a.ThrottleTime / time.Millisecond)) + + if err := pe.putArrayLength(len(a.FilterResponses)); err != nil { + return err + } + + for _, filterResponse := range a.FilterResponses { + if err := filterResponse.encode(pe); err != nil { + return err + } + } + + return nil +} + +func (a *DeleteAclsResponse) decode(pd packetDecoder, version int16) (err error) { + throttleTime, err := pd.getInt32() + if err != nil { + return err + } + a.ThrottleTime = time.Duration(throttleTime) * time.Millisecond + + n, err := pd.getArrayLength() + if err != nil { + return err + } + a.FilterResponses = make([]*FilterResponse, n) + + for i := 0; i < n; i++ { + a.FilterResponses[i] = new(FilterResponse) + if err := a.FilterResponses[i].decode(pd, version); err != nil { + return err + } + } + + return nil +} + +func (d *DeleteAclsResponse) key() int16 { + return 31 +} + +func (d *DeleteAclsResponse) version() int16 { + return 0 +} + +func (d *DeleteAclsResponse) requiredVersion() KafkaVersion { + return V0_11_0_0 +} + +type FilterResponse struct { + Err KError + ErrMsg *string + MatchingAcls []*MatchingAcl +} + +func (f *FilterResponse) encode(pe packetEncoder) error { + pe.putInt16(int16(f.Err)) + if err := pe.putNullableString(f.ErrMsg); err != nil { + return err + } + + if err := pe.putArrayLength(len(f.MatchingAcls)); err != nil { + return err + } + for _, matchingAcl := range f.MatchingAcls { + if err := matchingAcl.encode(pe); err != nil { + return err + } + } + + return nil +} + +func (f *FilterResponse) decode(pd packetDecoder, version int16) (err error) { + kerr, err := pd.getInt16() + if err != nil { + return err + } + f.Err = KError(kerr) + + if f.ErrMsg, err = pd.getNullableString(); err != nil { + return err + } + + n, err := pd.getArrayLength() + if err != nil { + return err + } + f.MatchingAcls = make([]*MatchingAcl, n) + for i := 0; i < n; i++ { + f.MatchingAcls[i] = new(MatchingAcl) + if err := f.MatchingAcls[i].decode(pd, version); err != nil { + return err + } + } + + return nil +} + +type MatchingAcl struct { + Err KError + ErrMsg *string + Resource + Acl +} + +func (m *MatchingAcl) encode(pe packetEncoder) error { + pe.putInt16(int16(m.Err)) + if err := pe.putNullableString(m.ErrMsg); err != nil { + return err + } + + if err := m.Resource.encode(pe); err != nil { + return err + } + + if err := m.Acl.encode(pe); err != nil { + return err + } + + return nil +} + +func (m *MatchingAcl) decode(pd packetDecoder, version int16) (err error) { + kerr, err := pd.getInt16() + if err != nil { + return err + } + m.Err = KError(kerr) + + if m.ErrMsg, err = pd.getNullableString(); err != nil { + return err + } + + if err := m.Resource.decode(pd, version); err != nil { + return err + } + + if err := m.Acl.decode(pd, version); err != nil { + return err + } + + return nil +} diff --git a/vendor/github.com/Shopify/sarama/acl_delete_response_test.go b/vendor/github.com/Shopify/sarama/acl_delete_response_test.go new file mode 100644 index 000000000..0d9dea684 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/acl_delete_response_test.go @@ -0,0 +1,38 @@ +package sarama + +import ( + "testing" + "time" +) + +var ( + deleteAclsResponse = []byte{ + 0, 0, 0, 100, + 0, 0, 0, 1, + 0, 0, // no error + 255, 255, // no error message + 0, 0, 0, 1, // 1 matching acl + 0, 0, // no error + 255, 255, // no error message + 2, // resource type + 0, 5, 't', 'o', 'p', 'i', 'c', + 0, 9, 'p', 'r', 'i', 'n', 'c', 'i', 'p', 'a', 'l', + 0, 4, 'h', 'o', 's', 't', + 4, + 3, + } +) + +func TestDeleteAclsResponse(t *testing.T) { + resp := &DeleteAclsResponse{ + ThrottleTime: 100 * time.Millisecond, + FilterResponses: []*FilterResponse{{ + MatchingAcls: []*MatchingAcl{{ + Resource: Resource{ResourceType: AclResourceTopic, ResourceName: "topic"}, + Acl: Acl{Principal: "principal", Host: "host", Operation: AclOperationWrite, PermissionType: AclPermissionAllow}, + }}, + }}, + } + + testResponse(t, "", resp, deleteAclsResponse) +} diff --git a/vendor/github.com/Shopify/sarama/acl_describe_request.go b/vendor/github.com/Shopify/sarama/acl_describe_request.go new file mode 100644 index 000000000..02a5a1f0e --- /dev/null +++ b/vendor/github.com/Shopify/sarama/acl_describe_request.go @@ -0,0 +1,25 @@ +package sarama + +type DescribeAclsRequest struct { + AclFilter +} + +func (d *DescribeAclsRequest) encode(pe packetEncoder) error { + return d.AclFilter.encode(pe) +} + +func (d *DescribeAclsRequest) decode(pd packetDecoder, version int16) (err error) { + return d.AclFilter.decode(pd, version) +} + +func (d *DescribeAclsRequest) key() int16 { + return 29 +} + +func (d *DescribeAclsRequest) version() int16 { + return 0 +} + +func (d *DescribeAclsRequest) requiredVersion() KafkaVersion { + return V0_11_0_0 +} diff --git a/vendor/github.com/Shopify/sarama/acl_describe_request_test.go b/vendor/github.com/Shopify/sarama/acl_describe_request_test.go new file mode 100644 index 000000000..3af14c616 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/acl_describe_request_test.go @@ -0,0 +1,35 @@ +package sarama + +import ( + "testing" +) + +var ( + aclDescribeRequest = []byte{ + 2, // resource type + 0, 5, 't', 'o', 'p', 'i', 'c', + 0, 9, 'p', 'r', 'i', 'n', 'c', 'i', 'p', 'a', 'l', + 0, 4, 'h', 'o', 's', 't', + 5, // acl operation + 3, // acl permission type + } +) + +func TestAclDescribeRequest(t *testing.T) { + resourcename := "topic" + principal := "principal" + host := "host" + + req := &DescribeAclsRequest{ + AclFilter{ + ResourceType: AclResourceTopic, + ResourceName: &resourcename, + Principal: &principal, + Host: &host, + Operation: AclOperationCreate, + PermissionType: AclPermissionAllow, + }, + } + + testRequest(t, "", req, aclDescribeRequest) +} diff --git a/vendor/github.com/Shopify/sarama/acl_describe_response.go b/vendor/github.com/Shopify/sarama/acl_describe_response.go new file mode 100644 index 000000000..5bc9497f4 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/acl_describe_response.go @@ -0,0 +1,80 @@ +package sarama + +import "time" + +type DescribeAclsResponse struct { + ThrottleTime time.Duration + Err KError + ErrMsg *string + ResourceAcls []*ResourceAcls +} + +func (d *DescribeAclsResponse) encode(pe packetEncoder) error { + pe.putInt32(int32(d.ThrottleTime / time.Millisecond)) + pe.putInt16(int16(d.Err)) + + if err := pe.putNullableString(d.ErrMsg); err != nil { + return err + } + + if err := pe.putArrayLength(len(d.ResourceAcls)); err != nil { + return err + } + + for _, resourceAcl := range d.ResourceAcls { + if err := resourceAcl.encode(pe); err != nil { + return err + } + } + + return nil +} + +func (d *DescribeAclsResponse) decode(pd packetDecoder, version int16) (err error) { + throttleTime, err := pd.getInt32() + if err != nil { + return err + } + d.ThrottleTime = time.Duration(throttleTime) * time.Millisecond + + kerr, err := pd.getInt16() + if err != nil { + return err + } + d.Err = KError(kerr) + + errmsg, err := pd.getString() + if err != nil { + return err + } + if errmsg != "" { + d.ErrMsg = &errmsg + } + + n, err := pd.getArrayLength() + if err != nil { + return err + } + d.ResourceAcls = make([]*ResourceAcls, n) + + for i := 0; i < n; i++ { + d.ResourceAcls[i] = new(ResourceAcls) + if err := d.ResourceAcls[i].decode(pd, version); err != nil { + return err + } + } + + return nil +} + +func (d *DescribeAclsResponse) key() int16 { + return 29 +} + +func (d *DescribeAclsResponse) version() int16 { + return 0 +} + +func (d *DescribeAclsResponse) requiredVersion() KafkaVersion { + return V0_11_0_0 +} diff --git a/vendor/github.com/Shopify/sarama/acl_describe_response_test.go b/vendor/github.com/Shopify/sarama/acl_describe_response_test.go new file mode 100644 index 000000000..f0652cfee --- /dev/null +++ b/vendor/github.com/Shopify/sarama/acl_describe_response_test.go @@ -0,0 +1,45 @@ +package sarama + +import ( + "testing" + "time" +) + +var aclDescribeResponseError = []byte{ + 0, 0, 0, 100, + 0, 8, // error + 0, 5, 'e', 'r', 'r', 'o', 'r', + 0, 0, 0, 1, // 1 resource + 2, // cluster type + 0, 5, 't', 'o', 'p', 'i', 'c', + 0, 0, 0, 1, // 1 acl + 0, 9, 'p', 'r', 'i', 'n', 'c', 'i', 'p', 'a', 'l', + 0, 4, 'h', 'o', 's', 't', + 4, // write + 3, // allow +} + +func TestAclDescribeResponse(t *testing.T) { + errmsg := "error" + resp := &DescribeAclsResponse{ + ThrottleTime: 100 * time.Millisecond, + Err: ErrBrokerNotAvailable, + ErrMsg: &errmsg, + ResourceAcls: []*ResourceAcls{{ + Resource: Resource{ + ResourceName: "topic", + ResourceType: AclResourceTopic, + }, + Acls: []*Acl{ + { + Principal: "principal", + Host: "host", + Operation: AclOperationWrite, + PermissionType: AclPermissionAllow, + }, + }, + }}, + } + + testResponse(t, "describe", resp, aclDescribeResponseError) +} diff --git a/vendor/github.com/Shopify/sarama/acl_filter.go b/vendor/github.com/Shopify/sarama/acl_filter.go new file mode 100644 index 000000000..970635421 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/acl_filter.go @@ -0,0 +1,61 @@ +package sarama + +type AclFilter struct { + ResourceType AclResourceType + ResourceName *string + Principal *string + Host *string + Operation AclOperation + PermissionType AclPermissionType +} + +func (a *AclFilter) encode(pe packetEncoder) error { + pe.putInt8(int8(a.ResourceType)) + if err := pe.putNullableString(a.ResourceName); err != nil { + return err + } + if err := pe.putNullableString(a.Principal); err != nil { + return err + } + if err := pe.putNullableString(a.Host); err != nil { + return err + } + pe.putInt8(int8(a.Operation)) + pe.putInt8(int8(a.PermissionType)) + + return nil +} + +func (a *AclFilter) decode(pd packetDecoder, version int16) (err error) { + resourceType, err := pd.getInt8() + if err != nil { + return err + } + a.ResourceType = AclResourceType(resourceType) + + if a.ResourceName, err = pd.getNullableString(); err != nil { + return err + } + + if a.Principal, err = pd.getNullableString(); err != nil { + return err + } + + if a.Host, err = pd.getNullableString(); err != nil { + return err + } + + operation, err := pd.getInt8() + if err != nil { + return err + } + a.Operation = AclOperation(operation) + + permissionType, err := pd.getInt8() + if err != nil { + return err + } + a.PermissionType = AclPermissionType(permissionType) + + return nil +} diff --git a/vendor/github.com/Shopify/sarama/acl_types.go b/vendor/github.com/Shopify/sarama/acl_types.go new file mode 100644 index 000000000..19da6f2f4 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/acl_types.go @@ -0,0 +1,42 @@ +package sarama + +type AclOperation int + +// ref: https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/acl/AclOperation.java +const ( + AclOperationUnknown AclOperation = 0 + AclOperationAny AclOperation = 1 + AclOperationAll AclOperation = 2 + AclOperationRead AclOperation = 3 + AclOperationWrite AclOperation = 4 + AclOperationCreate AclOperation = 5 + AclOperationDelete AclOperation = 6 + AclOperationAlter AclOperation = 7 + AclOperationDescribe AclOperation = 8 + AclOperationClusterAction AclOperation = 9 + AclOperationDescribeConfigs AclOperation = 10 + AclOperationAlterConfigs AclOperation = 11 + AclOperationIdempotentWrite AclOperation = 12 +) + +type AclPermissionType int + +// ref: https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/acl/AclPermissionType.java +const ( + AclPermissionUnknown AclPermissionType = 0 + AclPermissionAny AclPermissionType = 1 + AclPermissionDeny AclPermissionType = 2 + AclPermissionAllow AclPermissionType = 3 +) + +type AclResourceType int + +// ref: https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/resource/ResourceType.java +const ( + AclResourceUnknown AclResourceType = 0 + AclResourceAny AclResourceType = 1 + AclResourceTopic AclResourceType = 2 + AclResourceGroup AclResourceType = 3 + AclResourceCluster AclResourceType = 4 + AclResourceTransactionalID AclResourceType = 5 +) diff --git a/vendor/github.com/Shopify/sarama/add_offsets_to_txn_request.go b/vendor/github.com/Shopify/sarama/add_offsets_to_txn_request.go new file mode 100644 index 000000000..6da166c63 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/add_offsets_to_txn_request.go @@ -0,0 +1,52 @@ +package sarama + +type AddOffsetsToTxnRequest struct { + TransactionalID string + ProducerID int64 + ProducerEpoch int16 + GroupID string +} + +func (a *AddOffsetsToTxnRequest) encode(pe packetEncoder) error { + if err := pe.putString(a.TransactionalID); err != nil { + return err + } + + pe.putInt64(a.ProducerID) + + pe.putInt16(a.ProducerEpoch) + + if err := pe.putString(a.GroupID); err != nil { + return err + } + + return nil +} + +func (a *AddOffsetsToTxnRequest) decode(pd packetDecoder, version int16) (err error) { + if a.TransactionalID, err = pd.getString(); err != nil { + return err + } + if a.ProducerID, err = pd.getInt64(); err != nil { + return err + } + if a.ProducerEpoch, err = pd.getInt16(); err != nil { + return err + } + if a.GroupID, err = pd.getString(); err != nil { + return err + } + return nil +} + +func (a *AddOffsetsToTxnRequest) key() int16 { + return 25 +} + +func (a *AddOffsetsToTxnRequest) version() int16 { + return 0 +} + +func (a *AddOffsetsToTxnRequest) requiredVersion() KafkaVersion { + return V0_11_0_0 +} diff --git a/vendor/github.com/Shopify/sarama/add_offsets_to_txn_request_test.go b/vendor/github.com/Shopify/sarama/add_offsets_to_txn_request_test.go new file mode 100644 index 000000000..e96b3d33f --- /dev/null +++ b/vendor/github.com/Shopify/sarama/add_offsets_to_txn_request_test.go @@ -0,0 +1,23 @@ +package sarama + +import "testing" + +var ( + addOffsetsToTxnRequest = []byte{ + 0, 3, 't', 'x', 'n', + 0, 0, 0, 0, 0, 0, 31, 64, + 0, 0, + 0, 7, 'g', 'r', 'o', 'u', 'p', 'i', 'd', + } +) + +func TestAddOffsetsToTxnRequest(t *testing.T) { + req := &AddOffsetsToTxnRequest{ + TransactionalID: "txn", + ProducerID: 8000, + ProducerEpoch: 0, + GroupID: "groupid", + } + + testRequest(t, "", req, addOffsetsToTxnRequest) +} diff --git a/vendor/github.com/Shopify/sarama/add_offsets_to_txn_response.go b/vendor/github.com/Shopify/sarama/add_offsets_to_txn_response.go new file mode 100644 index 000000000..3a46151a0 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/add_offsets_to_txn_response.go @@ -0,0 +1,44 @@ +package sarama + +import ( + "time" +) + +type AddOffsetsToTxnResponse struct { + ThrottleTime time.Duration + Err KError +} + +func (a *AddOffsetsToTxnResponse) encode(pe packetEncoder) error { + pe.putInt32(int32(a.ThrottleTime / time.Millisecond)) + pe.putInt16(int16(a.Err)) + return nil +} + +func (a *AddOffsetsToTxnResponse) decode(pd packetDecoder, version int16) (err error) { + throttleTime, err := pd.getInt32() + if err != nil { + return err + } + a.ThrottleTime = time.Duration(throttleTime) * time.Millisecond + + kerr, err := pd.getInt16() + if err != nil { + return err + } + a.Err = KError(kerr) + + return nil +} + +func (a *AddOffsetsToTxnResponse) key() int16 { + return 25 +} + +func (a *AddOffsetsToTxnResponse) version() int16 { + return 0 +} + +func (a *AddOffsetsToTxnResponse) requiredVersion() KafkaVersion { + return V0_11_0_0 +} diff --git a/vendor/github.com/Shopify/sarama/add_offsets_to_txn_response_test.go b/vendor/github.com/Shopify/sarama/add_offsets_to_txn_response_test.go new file mode 100644 index 000000000..4504966fe --- /dev/null +++ b/vendor/github.com/Shopify/sarama/add_offsets_to_txn_response_test.go @@ -0,0 +1,22 @@ +package sarama + +import ( + "testing" + "time" +) + +var ( + addOffsetsToTxnResponse = []byte{ + 0, 0, 0, 100, + 0, 47, + } +) + +func TestAddOffsetsToTxnResponse(t *testing.T) { + resp := &AddOffsetsToTxnResponse{ + ThrottleTime: 100 * time.Millisecond, + Err: ErrInvalidProducerEpoch, + } + + testResponse(t, "", resp, addOffsetsToTxnResponse) +} diff --git a/vendor/github.com/Shopify/sarama/add_partitions_to_txn_request.go b/vendor/github.com/Shopify/sarama/add_partitions_to_txn_request.go new file mode 100644 index 000000000..a8a59225e --- /dev/null +++ b/vendor/github.com/Shopify/sarama/add_partitions_to_txn_request.go @@ -0,0 +1,76 @@ +package sarama + +type AddPartitionsToTxnRequest struct { + TransactionalID string + ProducerID int64 + ProducerEpoch int16 + TopicPartitions map[string][]int32 +} + +func (a *AddPartitionsToTxnRequest) encode(pe packetEncoder) error { + if err := pe.putString(a.TransactionalID); err != nil { + return err + } + pe.putInt64(a.ProducerID) + pe.putInt16(a.ProducerEpoch) + + if err := pe.putArrayLength(len(a.TopicPartitions)); err != nil { + return err + } + for topic, partitions := range a.TopicPartitions { + if err := pe.putString(topic); err != nil { + return err + } + if err := pe.putInt32Array(partitions); err != nil { + return err + } + } + + return nil +} + +func (a *AddPartitionsToTxnRequest) decode(pd packetDecoder, version int16) (err error) { + if a.TransactionalID, err = pd.getString(); err != nil { + return err + } + if a.ProducerID, err = pd.getInt64(); err != nil { + return err + } + if a.ProducerEpoch, err = pd.getInt16(); err != nil { + return err + } + + n, err := pd.getArrayLength() + if err != nil { + return err + } + + a.TopicPartitions = make(map[string][]int32) + for i := 0; i < n; i++ { + topic, err := pd.getString() + if err != nil { + return err + } + + partitions, err := pd.getInt32Array() + if err != nil { + return err + } + + a.TopicPartitions[topic] = partitions + } + + return nil +} + +func (a *AddPartitionsToTxnRequest) key() int16 { + return 24 +} + +func (a *AddPartitionsToTxnRequest) version() int16 { + return 0 +} + +func (a *AddPartitionsToTxnRequest) requiredVersion() KafkaVersion { + return V0_11_0_0 +} diff --git a/vendor/github.com/Shopify/sarama/add_partitions_to_txn_request_test.go b/vendor/github.com/Shopify/sarama/add_partitions_to_txn_request_test.go new file mode 100644 index 000000000..76a2eee43 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/add_partitions_to_txn_request_test.go @@ -0,0 +1,27 @@ +package sarama + +import "testing" + +var ( + addPartitionsToTxnRequest = []byte{ + 0, 3, 't', 'x', 'n', + 0, 0, 0, 0, 0, 0, 31, 64, // ProducerID + 0, 0, 0, 0, // ProducerEpoch + 0, 1, // 1 topic + 0, 5, 't', 'o', 'p', 'i', 'c', + 0, 0, 0, 1, 0, 0, 0, 1, + } +) + +func TestAddPartitionsToTxnRequest(t *testing.T) { + req := &AddPartitionsToTxnRequest{ + TransactionalID: "txn", + ProducerID: 8000, + ProducerEpoch: 0, + TopicPartitions: map[string][]int32{ + "topic": []int32{1}, + }, + } + + testRequest(t, "", req, addPartitionsToTxnRequest) +} diff --git a/vendor/github.com/Shopify/sarama/add_partitions_to_txn_response.go b/vendor/github.com/Shopify/sarama/add_partitions_to_txn_response.go new file mode 100644 index 000000000..581c556c5 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/add_partitions_to_txn_response.go @@ -0,0 +1,108 @@ +package sarama + +import ( + "time" +) + +type AddPartitionsToTxnResponse struct { + ThrottleTime time.Duration + Errors map[string][]*PartitionError +} + +func (a *AddPartitionsToTxnResponse) encode(pe packetEncoder) error { + pe.putInt32(int32(a.ThrottleTime / time.Millisecond)) + if err := pe.putArrayLength(len(a.Errors)); err != nil { + return err + } + + for topic, e := range a.Errors { + if err := pe.putString(topic); err != nil { + return err + } + if err := pe.putArrayLength(len(e)); err != nil { + return err + } + for _, partitionError := range e { + if err := partitionError.encode(pe); err != nil { + return err + } + } + } + + return nil +} + +func (a *AddPartitionsToTxnResponse) decode(pd packetDecoder, version int16) (err error) { + throttleTime, err := pd.getInt32() + if err != nil { + return err + } + a.ThrottleTime = time.Duration(throttleTime) * time.Millisecond + + n, err := pd.getArrayLength() + if err != nil { + return err + } + + a.Errors = make(map[string][]*PartitionError) + + for i := 0; i < n; i++ { + topic, err := pd.getString() + if err != nil { + return err + } + + m, err := pd.getArrayLength() + if err != nil { + return err + } + + a.Errors[topic] = make([]*PartitionError, m) + + for j := 0; j < m; j++ { + a.Errors[topic][j] = new(PartitionError) + if err := a.Errors[topic][j].decode(pd, version); err != nil { + return err + } + } + } + + return nil +} + +func (a *AddPartitionsToTxnResponse) key() int16 { + return 24 +} + +func (a *AddPartitionsToTxnResponse) version() int16 { + return 0 +} + +func (a *AddPartitionsToTxnResponse) requiredVersion() KafkaVersion { + return V0_11_0_0 +} + +type PartitionError struct { + Partition int32 + Err KError +} + +func (p *PartitionError) encode(pe packetEncoder) error { + pe.putInt32(p.Partition) + pe.putInt16(int16(p.Err)) + return nil +} + +func (p *PartitionError) decode(pd packetDecoder, version int16) (err error) { + if p.Partition, err = pd.getInt32(); err != nil { + return err + } + + kerr, err := pd.getInt16() + if err != nil { + return err + } + p.Err = KError(kerr) + + return nil +} diff --git a/vendor/github.com/Shopify/sarama/add_partitions_to_txn_response_test.go b/vendor/github.com/Shopify/sarama/add_partitions_to_txn_response_test.go new file mode 100644 index 000000000..7b5b82f80 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/add_partitions_to_txn_response_test.go @@ -0,0 +1,31 @@ +package sarama + +import ( + "testing" + "time" +) + +var ( + addPartitionsToTxnResponse = []byte{ + 0, 0, 0, 100, + 0, 0, 0, 1, + 0, 5, 't', 'o', 'p', 'i', 'c', + 0, 0, 0, 1, // 1 partition error + 0, 0, 0, 2, // partition 2 + 0, 48, // error + } +) + +func TestAddPartitionsToTxnResponse(t *testing.T) { + resp := &AddPartitionsToTxnResponse{ + ThrottleTime: 100 * time.Millisecond, + Errors: map[string][]*PartitionError{ + "topic": []*PartitionError{&PartitionError{ + Err: ErrInvalidTxnState, + Partition: 2, + }}, + }, + } + + testResponse(t, "", resp, addPartitionsToTxnResponse) +} diff --git a/vendor/github.com/Shopify/sarama/alter_configs_request.go b/vendor/github.com/Shopify/sarama/alter_configs_request.go new file mode 100644 index 000000000..48c44ead6 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/alter_configs_request.go @@ -0,0 +1,120 @@ +package sarama + +type AlterConfigsRequest struct { + Resources []*AlterConfigsResource + ValidateOnly bool +} + +type AlterConfigsResource struct { + Type ConfigResourceType + Name string + ConfigEntries map[string]*string +} + +func (acr *AlterConfigsRequest) encode(pe packetEncoder) error { + if err := pe.putArrayLength(len(acr.Resources)); err != nil { + return err + } + + for _, r := range acr.Resources { + if err := r.encode(pe); err != nil { + return err + } + } + + pe.putBool(acr.ValidateOnly) + return nil +} + +func (acr *AlterConfigsRequest) decode(pd packetDecoder, version int16) error { + resourceCount, err := pd.getArrayLength() + if err != nil { + return err + } + + acr.Resources = make([]*AlterConfigsResource, resourceCount) + for i := range acr.Resources { + r := &AlterConfigsResource{} + err = r.decode(pd, version) + if err != nil { + return err + } + acr.Resources[i] = r + } + + validateOnly, err := pd.getBool() + if err != nil { + return err + } + + acr.ValidateOnly = validateOnly + + return nil +} + +func (ac *AlterConfigsResource) encode(pe packetEncoder) error { + pe.putInt8(int8(ac.Type)) + + if err := pe.putString(ac.Name); err != nil { + return err + } + + if err := pe.putArrayLength(len(ac.ConfigEntries)); err != nil { + return err + } + for configKey, configValue := range ac.ConfigEntries { + if err := pe.putString(configKey); err != nil { + return err + } + if err := pe.putNullableString(configValue); err != nil { + return err + } + } + + return nil +} + +func (ac *AlterConfigsResource) decode(pd packetDecoder, version int16) error { + t, err := pd.getInt8() + if err != nil { + return err + } + ac.Type = ConfigResourceType(t) + + name, err := pd.getString() + if err != nil { + return err + } + ac.Name = name + + n, err := pd.getArrayLength() + if err != nil { + return err + } + + if n > 0 { + ac.ConfigEntries = make(map[string]*string, n) + for i := 0; i < n; i++ { + configKey, err := pd.getString() + if err != nil { + return err + } + if ac.ConfigEntries[configKey], err = pd.getNullableString(); err != nil { + return err + } + } + } + return err +} + +func (acr *AlterConfigsRequest) key() int16 { + return 33 +} + +func (acr *AlterConfigsRequest) version() int16 { + return 0 +} + +func (acr *AlterConfigsRequest) requiredVersion() KafkaVersion { + return V0_11_0_0 +} diff --git a/vendor/github.com/Shopify/sarama/alter_configs_request_test.go b/vendor/github.com/Shopify/sarama/alter_configs_request_test.go new file mode 100644 index 000000000..bfeff4491 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/alter_configs_request_test.go @@ -0,0 +1,91 @@ +package sarama + +import "testing" + +var ( + emptyAlterConfigsRequest = []byte{ + 0, 0, 0, 0, // 0 configs + 0, // don't Validate + } + + singleAlterConfigsRequest = []byte{ + 0, 0, 0, 1, // 1 config + 2, // a topic + 0, 3, 'f', 'o', 'o', // topic name: foo + 0, 0, 0, 1, //1 config name + 0, 10, // 10 chars + 's', 'e', 'g', 'm', 'e', 'n', 't', '.', 'm', 's', + 0, 4, + '1', '0', '0', '0', + 0, // don't validate + } + + doubleAlterConfigsRequest = []byte{ + 0, 0, 0, 2, // 2 config + 2, // a topic + 0, 3, 'f', 'o', 'o', // topic name: foo + 0, 0, 0, 1, //1 config name + 0, 10, // 10 chars + 's', 'e', 'g', 'm', 'e', 'n', 't', '.', 'm', 's', + 0, 4, + '1', '0', '0', '0', + 2, // a topic + 0, 3, 'b', 'a', 'r', // topic name: foo + 0, 0, 0, 2, //2 config + 0, 10, // 10 chars + 's', 'e', 'g', 'm', 'e', 'n', 't', '.', 'm', 's', + 0, 4, + '1', '0', '0', '0', + 0, 12, // 12 chars + 'r', 'e', 't', 'e', 'n', 't', 'i', 'o', 'n', '.', 'm', 's', + 0, 4, + '1', '0', '0', '0', + 0, // don't validate + } +) + +func TestAlterConfigsRequest(t *testing.T) { + var request *AlterConfigsRequest + + request = &AlterConfigsRequest{ + Resources: []*AlterConfigsResource{}, + } + testRequest(t, "no requests", request, emptyAlterConfigsRequest) + + configValue := "1000" + request = &AlterConfigsRequest{ + Resources: []*AlterConfigsResource{ + &AlterConfigsResource{ + Type: TopicResource, + Name: "foo", + ConfigEntries: map[string]*string{ + "segment.ms": &configValue, + }, + }, + }, + } + + testRequest(t, "one config", request, singleAlterConfigsRequest) + + request = &AlterConfigsRequest{ + Resources: []*AlterConfigsResource{ + &AlterConfigsResource{ + Type: TopicResource, + Name: "foo", + ConfigEntries: map[string]*string{ + "segment.ms": &configValue, + }, + }, + &AlterConfigsResource{ + Type: TopicResource, + Name: "bar", + ConfigEntries: map[string]*string{ + "segment.ms": &configValue, + "retention.ms": &configValue, + }, + }, + }, + } + + testRequest(t, "two configs", request, doubleAlterConfigsRequest) +} diff --git a/vendor/github.com/Shopify/sarama/alter_configs_response.go b/vendor/github.com/Shopify/sarama/alter_configs_response.go new file mode 100644 index 000000000..29b09e1ff --- /dev/null +++ b/vendor/github.com/Shopify/sarama/alter_configs_response.go @@ -0,0 +1,95 @@ +package sarama + +import "time" + +type AlterConfigsResponse struct { + ThrottleTime time.Duration + Resources []*AlterConfigsResourceResponse +} + +type AlterConfigsResourceResponse struct { + ErrorCode int16 + ErrorMsg string + Type ConfigResourceType + Name string +} + +func (ct *AlterConfigsResponse) encode(pe packetEncoder) error { + pe.putInt32(int32(ct.ThrottleTime / time.Millisecond)) + + if err := pe.putArrayLength(len(ct.Resources)); err != nil { + return err + } + + for i := range ct.Resources { + pe.putInt16(ct.Resources[i].ErrorCode) + err := pe.putString(ct.Resources[i].ErrorMsg) + if err != nil { + return nil + } + pe.putInt8(int8(ct.Resources[i].Type)) + err = pe.putString(ct.Resources[i].Name) + if err != nil { + return nil + } + } + + return nil +} + +func (acr *AlterConfigsResponse) decode(pd packetDecoder, version int16) error { + throttleTime, err := pd.getInt32() + if err != nil { + return err + } + acr.ThrottleTime = time.Duration(throttleTime) * time.Millisecond + + responseCount, err := pd.getArrayLength() + if err != nil { + return err + } + + acr.Resources = make([]*AlterConfigsResourceResponse, responseCount) + + for i := range acr.Resources { + acr.Resources[i] = new(AlterConfigsResourceResponse) + + errCode, err := pd.getInt16() + if err != nil { + return err + } + acr.Resources[i].ErrorCode = errCode + + e, err := pd.getString() + if err != nil { + return err + } + acr.Resources[i].ErrorMsg = e + + t, err := pd.getInt8() + if err != nil { + return err + } + acr.Resources[i].Type = ConfigResourceType(t) + + name, err := pd.getString() + if err != nil { + return err + } + acr.Resources[i].Name = name + } + + return nil +} + +func (r *AlterConfigsResponse) key() int16 { + return 32 +} + +func (r *AlterConfigsResponse) version() int16 { + return 0 +} + +func (r *AlterConfigsResponse) requiredVersion() KafkaVersion { + return V0_11_0_0 +} diff --git a/vendor/github.com/Shopify/sarama/alter_configs_response_test.go b/vendor/github.com/Shopify/sarama/alter_configs_response_test.go new file mode 100644 index 000000000..459202870 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/alter_configs_response_test.go @@ -0,0 +1,45 @@ +package sarama + +import ( + "testing" +) + +var ( + alterResponseEmpty = []byte{ + 0, 0, 0, 0, //throttle + 0, 0, 0, 0, // no configs + } + + alterResponsePopulated = []byte{ + 0, 0, 0, 0, //throttle + 0, 0, 0, 1, // response + 0, 0, //errorcode + 0, 0, //string + 2, // topic + 0, 3, 'f', 'o', 'o', + } +) + +func TestAlterConfigsResponse(t *testing.T) { + var response *AlterConfigsResponse + + response = &AlterConfigsResponse{ + Resources: []*AlterConfigsResourceResponse{}, + } + testVersionDecodable(t, "empty", response, alterResponseEmpty, 0) + if len(response.Resources) != 0 { + t.Error("Expected no groups") + } + + response = &AlterConfigsResponse{ + Resources: []*AlterConfigsResourceResponse{ + &AlterConfigsResourceResponse{ + ErrorCode: 0, + ErrorMsg: "", + Type: TopicResource, + Name: "foo", + }, + }, + } + testResponse(t, "response with error", response, alterResponsePopulated) +} diff --git a/vendor/github.com/Shopify/sarama/async_producer_test.go b/vendor/github.com/Shopify/sarama/async_producer_test.go index 07d23533b..716b654ea 100644 --- a/vendor/github.com/Shopify/sarama/async_producer_test.go +++ b/vendor/github.com/Shopify/sarama/async_producer_test.go @@ -639,6 +639,7 @@ func TestAsyncProducerFlusherRetryCondition(t *testing.T) { leader.SetHandlerByMap(map[string]MockResponse{ "ProduceRequest": NewMockProduceResponse(t). + SetVersion(0). SetError("my_topic", 0, ErrNoError), }) diff --git a/vendor/github.com/Shopify/sarama/broker.go b/vendor/github.com/Shopify/sarama/broker.go index 923b07faf..b759f8f78 100644 --- a/vendor/github.com/Shopify/sarama/broker.go +++ b/vendor/github.com/Shopify/sarama/broker.go @@ -373,6 +373,137 @@ func (b *Broker) ApiVersions(request *ApiVersionsRequest) (*ApiVersionsResponse, return response, nil } +func (b *Broker) CreateTopics(request *CreateTopicsRequest) (*CreateTopicsResponse, error) { + response := new(CreateTopicsResponse) + + err := b.sendAndReceive(request, response) + if err != nil { + return nil, err + } + + return response, nil +} + +func (b *Broker) DeleteTopics(request *DeleteTopicsRequest) (*DeleteTopicsResponse, error) { + response := new(DeleteTopicsResponse) + + err := b.sendAndReceive(request, response) + if err != nil { + return nil, err + } + + return response, nil +} + +func (b *Broker) DescribeAcls(request *DescribeAclsRequest) (*DescribeAclsResponse, error) { + response := new(DescribeAclsResponse) + + err := b.sendAndReceive(request, response) + if err != nil { + return nil, err + } + + return response, nil +} + +func (b *Broker) CreateAcls(request *CreateAclsRequest) (*CreateAclsResponse, error) { + response := new(CreateAclsResponse) + + err := b.sendAndReceive(request, response) + if err != nil { + return nil, err + } + + return response, nil +} + +func (b *Broker) DeleteAcls(request *DeleteAclsRequest) (*DeleteAclsResponse, error) { + response := new(DeleteAclsResponse) + + err := b.sendAndReceive(request, response) + if err != nil { + return nil, err + } + + return response, nil +} + +func (b *Broker) InitProducerID(request *InitProducerIDRequest) (*InitProducerIDResponse, error) { + response := new(InitProducerIDResponse) + + err := b.sendAndReceive(request, response) + if err != nil { + return nil, err + } + + return response, nil +} + +func (b *Broker) AddPartitionsToTxn(request *AddPartitionsToTxnRequest) (*AddPartitionsToTxnResponse, error) { + response := new(AddPartitionsToTxnResponse) + + err := b.sendAndReceive(request, response) + if err != nil { + return nil, err + } + + return response, nil +} + +func (b *Broker) AddOffsetsToTxn(request *AddOffsetsToTxnRequest) (*AddOffsetsToTxnResponse, error) { + response := new(AddOffsetsToTxnResponse) + + err := b.sendAndReceive(request, response) + if err != nil { + return nil, err + } + + return response, nil +} + +func (b *Broker) EndTxn(request *EndTxnRequest) (*EndTxnResponse, error) { + response := new(EndTxnResponse) + + err := b.sendAndReceive(request, response) + if err != nil { + return nil, err + } + + return response, nil +} + +func (b *Broker) TxnOffsetCommit(request *TxnOffsetCommitRequest) (*TxnOffsetCommitResponse, error) { + response := new(TxnOffsetCommitResponse) + + err := b.sendAndReceive(request, response) + if err != nil { + return nil, err + } + + return response, nil +} + +func (b *Broker) DescribeConfigs(request *DescribeConfigsRequest) (*DescribeConfigsResponse, error) { + response := new(DescribeConfigsResponse) + + err := b.sendAndReceive(request, response) + if err != nil { + return nil, err + } + + return response, nil +} + +func (b *Broker) AlterConfigs(request *AlterConfigsRequest) (*AlterConfigsResponse, error) { + response := new(AlterConfigsResponse) + + err := b.sendAndReceive(request, response) + if err != nil { + return nil, err + } + + return response, nil +} func (b *Broker) send(rb protocolBody, promiseResponse bool) (*responsePromise, error) { b.lock.Lock() defer b.lock.Unlock() diff --git a/vendor/github.com/Shopify/sarama/client_tls_test.go b/vendor/github.com/Shopify/sarama/client_tls_test.go new file mode 100644 index 000000000..eef5f6e9c --- /dev/null +++ b/vendor/github.com/Shopify/sarama/client_tls_test.go @@ -0,0 +1,206 @@ +package sarama + +import ( + "math/big" + "net" + "testing" + "time" + + "crypto/rand" + "crypto/rsa" + "crypto/tls" + "crypto/x509" + "crypto/x509/pkix" +) + +func TestTLS(t *testing.T) { + cakey, err := rsa.GenerateKey(rand.Reader, 2048) + if err != nil { + t.Fatal(err) + } + + clientkey, err := rsa.GenerateKey(rand.Reader, 2048) + if err != nil { + t.Fatal(err) + } + + hostkey, err := rsa.GenerateKey(rand.Reader, 2048) + if err != nil { + t.Fatal(err) + } + + nvb := time.Now().Add(-1 * time.Hour) + nva := time.Now().Add(1 * time.Hour) + + caTemplate := &x509.Certificate{ + Subject: pkix.Name{CommonName: "ca"}, + Issuer: pkix.Name{CommonName: "ca"}, + SerialNumber: big.NewInt(0), + NotAfter: nva, + NotBefore: nvb, + IsCA: true, + BasicConstraintsValid: true, + KeyUsage: x509.KeyUsageCertSign, + } + caDer, err := x509.CreateCertificate(rand.Reader, caTemplate, caTemplate, &cakey.PublicKey, cakey) + if err != nil { + t.Fatal(err) + } + caFinalCert, err := x509.ParseCertificate(caDer) + if err != nil { + t.Fatal(err) + } + + hostDer, err := x509.CreateCertificate(rand.Reader, &x509.Certificate{ + Subject: pkix.Name{CommonName: "host"}, + Issuer: pkix.Name{CommonName: "ca"}, + IPAddresses: []net.IP{net.IPv4(127, 0, 0, 1)}, + SerialNumber: big.NewInt(0), + NotAfter: nva, + NotBefore: nvb, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth}, + }, caFinalCert, &hostkey.PublicKey, cakey) + if err != nil { + t.Fatal(err) + } + + clientDer, err := x509.CreateCertificate(rand.Reader, &x509.Certificate{ + Subject: pkix.Name{CommonName: "client"}, + Issuer: pkix.Name{CommonName: "ca"}, + SerialNumber: big.NewInt(0), + NotAfter: nva, + NotBefore: nvb, + ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageClientAuth}, + }, caFinalCert, &clientkey.PublicKey, cakey) + if err != nil { + t.Fatal(err) + } + + pool := x509.NewCertPool() + pool.AddCert(caFinalCert) + + systemCerts, err := x509.SystemCertPool() + if err != nil { + t.Fatal(err) + } + + // Keep server the same - it's the client that we're testing + serverTLSConfig := &tls.Config{ + Certificates: []tls.Certificate{tls.Certificate{ + Certificate: [][]byte{hostDer}, + PrivateKey: hostkey, + }}, + ClientAuth: tls.RequireAndVerifyClientCert, + ClientCAs: pool, + } + + for _, tc := range []struct { + Succeed bool + Server, Client *tls.Config + }{ + { // Verify client fails if wrong CA cert pool is specified + Succeed: false, + Server: serverTLSConfig, + Client: &tls.Config{ + RootCAs: systemCerts, + Certificates: []tls.Certificate{tls.Certificate{ + Certificate: [][]byte{clientDer}, + PrivateKey: clientkey, + }}, + }, + }, + { // Verify client fails if wrong key is specified + Succeed: false, + Server: serverTLSConfig, + Client: &tls.Config{ + RootCAs: pool, + Certificates: []tls.Certificate{tls.Certificate{ + Certificate: [][]byte{clientDer}, + PrivateKey: hostkey, + }}, + }, + }, + { // Verify client fails if wrong cert is specified + Succeed: false, + Server: serverTLSConfig, + Client: &tls.Config{ + RootCAs: pool, + Certificates: []tls.Certificate{tls.Certificate{ + Certificate: [][]byte{hostDer}, + PrivateKey: clientkey, + }}, + }, + }, + { // Verify client fails if no CAs are specified + Succeed: false, + Server: serverTLSConfig, + Client: &tls.Config{ + Certificates: []tls.Certificate{tls.Certificate{ + Certificate: [][]byte{clientDer}, + PrivateKey: clientkey, + }}, + }, + }, + { // Verify client fails if no keys are specified + Succeed: false, + Server: serverTLSConfig, + Client: &tls.Config{ + RootCAs: pool, + }, + }, + { // Finally, verify it all works happily with client and server cert in place + Succeed: true, + Server: serverTLSConfig, + Client: &tls.Config{ + RootCAs: pool, + Certificates: []tls.Certificate{tls.Certificate{ + Certificate: [][]byte{clientDer}, + PrivateKey: clientkey, + }}, + }, + }, + } { + doListenerTLSTest(t, tc.Succeed, tc.Server, tc.Client) + } +} + +func doListenerTLSTest(t *testing.T, expectSuccess bool, serverConfig, clientConfig *tls.Config) { + serverConfig.BuildNameToCertificate() + clientConfig.BuildNameToCertificate() + + seedListener, err := tls.Listen("tcp", "127.0.0.1:0", serverConfig) + if err != nil { + t.Fatal("cannot open listener", err) + } + + var childT *testing.T + if expectSuccess { + childT = t + } else { + childT = &testing.T{} // we want to swallow errors + } + + seedBroker := NewMockBrokerListener(childT, 1, seedListener) + defer seedBroker.Close() + + seedBroker.Returns(new(MetadataResponse)) + + config := NewConfig() + config.Net.TLS.Enable = true + config.Net.TLS.Config = clientConfig + + client, err := NewClient([]string{seedBroker.Addr()}, config) + if err == nil { + safeClose(t, client) + } + + if expectSuccess { + if err != nil { + t.Fatal(err) + } + } else { + if err == nil { + t.Fatal("expected failure") + } + } +} diff --git a/vendor/github.com/Shopify/sarama/config.go b/vendor/github.com/Shopify/sarama/config.go index e4ff680f2..29ea5c2b3 100644 --- a/vendor/github.com/Shopify/sarama/config.go +++ b/vendor/github.com/Shopify/sarama/config.go @@ -175,7 +175,7 @@ type Config struct { // Equivalent to the JVM's `fetch.min.bytes`. Min int32 // The default number of message bytes to fetch from the broker in each - // request (default 32768). This should be larger than the majority of + // request (default 1MB). This should be larger than the majority of // your messages, or else the consumer will spend a lot of time // negotiating sizes and not actually consuming. Similar to the JVM's // `fetch.message.max.bytes`. @@ -292,7 +292,7 @@ func NewConfig() *Config { c.Producer.Return.Errors = true c.Consumer.Fetch.Min = 1 - c.Consumer.Fetch.Default = 32768 + c.Consumer.Fetch.Default = 1024 * 1024 c.Consumer.Retry.Backoff = 2 * time.Second c.Consumer.MaxWaitTime = 250 * time.Millisecond c.Consumer.MaxProcessingTime = 100 * time.Millisecond diff --git a/vendor/github.com/Shopify/sarama/config_resource_type.go b/vendor/github.com/Shopify/sarama/config_resource_type.go new file mode 100644 index 000000000..848cc9c90 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/config_resource_type.go @@ -0,0 +1,15 @@ +package sarama + +type ConfigResourceType int8 + +// Taken from : +// https://cwiki.apache.org/confluence/display/KAFKA/KIP-133%3A+Describe+and+Alter+Configs+Admin+APIs#KIP-133:DescribeandAlterConfigsAdminAPIs-WireFormattypes + +const ( + UnknownResource ConfigResourceType = 0 + AnyResource ConfigResourceType = 1 + TopicResource ConfigResourceType = 2 + GroupResource ConfigResourceType = 3 + ClusterResource ConfigResourceType = 4 + BrokerResource ConfigResourceType = 5 +) diff --git a/vendor/github.com/Shopify/sarama/consumer.go b/vendor/github.com/Shopify/sarama/consumer.go index 1a0728945..48d231cf9 100644 --- a/vendor/github.com/Shopify/sarama/consumer.go +++ b/vendor/github.com/Shopify/sarama/consumer.go @@ -441,40 +441,41 @@ func (child *partitionConsumer) HighWaterMarkOffset() int64 { func (child *partitionConsumer) responseFeeder() { var msgs []*ConsumerMessage - msgSent := false + expiryTicker := time.NewTicker(child.conf.Consumer.MaxProcessingTime) + firstAttempt := true feederLoop: for response := range child.feeder { msgs, child.responseResult = child.parseResponse(response) - expiryTicker := time.NewTicker(child.conf.Consumer.MaxProcessingTime) for i, msg := range msgs { messageSelect: select { case child.messages <- msg: - msgSent = true + firstAttempt = true case <-expiryTicker.C: - if !msgSent { + if !firstAttempt { child.responseResult = errTimedOut child.broker.acks.Done() for _, msg = range msgs[i:] { child.messages <- msg } child.broker.input <- child + expiryTicker.Stop() continue feederLoop } else { // current message has not been sent, return to select // statement - msgSent = false + firstAttempt = false goto messageSelect } } } - expiryTicker.Stop() child.broker.acks.Done() } + expiryTicker.Stop() close(child.messages) close(child.errors) } @@ -523,6 +524,7 @@ func (child *partitionConsumer) parseRecords(batch *RecordBatch) ([]*ConsumerMes var messages []*ConsumerMessage var incomplete bool prelude := true + originalOffset := child.offset for _, rec := range batch.Records { offset := batch.FirstOffset + rec.OffsetDelta @@ -547,9 +549,15 @@ func (child *partitionConsumer) parseRecords(batch *RecordBatch) ([]*ConsumerMes } } - if incomplete || len(messages) == 0 { + if incomplete { return nil, ErrIncompleteResponse } + + child.offset = batch.FirstOffset + int64(batch.LastOffsetDelta) + 1 + if child.offset <= originalOffset { + return nil, ErrConsumerOffsetNotAdvanced + } + return messages, nil } @@ -563,12 +571,12 @@ func (child *partitionConsumer) parseResponse(response *FetchResponse) ([]*Consu return nil, block.Err } - nRecs, err := block.Records.numRecords() + nRecs, err := block.numRecords() if err != nil { return nil, err } if nRecs == 0 { - partialTrailingMessage, err := block.Records.isPartial() + partialTrailingMessage, err := block.isPartial() if err != nil { return nil, err } @@ -594,14 +602,33 @@ func (child *partitionConsumer) parseResponse(response *FetchResponse) ([]*Consu child.fetchSize = child.conf.Consumer.Fetch.Default atomic.StoreInt64(&child.highWaterMarkOffset, block.HighWaterMarkOffset) - if control, err := block.Records.isControl(); err != nil || control { - return nil, err + messages := []*ConsumerMessage{} + for _, records := range block.RecordsSet { + if control, err := records.isControl(); err != nil || control { + continue + } + + switch records.recordsType { + case legacyRecords: + messageSetMessages, err := child.parseMessages(records.msgSet) + if err != nil { + return nil, err + } + + messages = append(messages, messageSetMessages...) + case defaultRecords: + recordBatchMessages, err := child.parseRecords(records.recordBatch) + if err != nil { + return nil, err + } + + messages = append(messages, recordBatchMessages...) + default: + return nil, fmt.Errorf("unknown records type: %v", records.recordsType) + } } - if block.Records.recordsType == legacyRecords { - return child.parseMessages(block.Records.msgSet) - } - return child.parseRecords(block.Records.recordBatch) + return messages, nil } // brokerConsumer diff --git a/vendor/github.com/Shopify/sarama/consumer_test.go b/vendor/github.com/Shopify/sarama/consumer_test.go index babd03913..881e0fe82 100644 --- a/vendor/github.com/Shopify/sarama/consumer_test.go +++ b/vendor/github.com/Shopify/sarama/consumer_test.go @@ -389,10 +389,12 @@ func TestConsumerExtraOffsets(t *testing.T) { newFetchResponse.AddRecord("my_topic", 0, nil, testMsg, 2) newFetchResponse.AddRecord("my_topic", 0, nil, testMsg, 3) newFetchResponse.AddRecord("my_topic", 0, nil, testMsg, 4) + newFetchResponse.SetLastOffsetDelta("my_topic", 0, 4) newFetchResponse.SetLastStableOffset("my_topic", 0, 4) for _, fetchResponse1 := range []*FetchResponse{legacyFetchResponse, newFetchResponse} { var offsetResponseVersion int16 cfg := NewConfig() + cfg.Consumer.Return.Errors = true if fetchResponse1.Version >= 4 { cfg.Version = V0_11_0_0 offsetResponseVersion = 1 @@ -426,8 +428,19 @@ func TestConsumerExtraOffsets(t *testing.T) { // Then: messages with offsets 1 and 2 are not returned even though they // are present in the response. - assertMessageOffset(t, <-consumer.Messages(), 3) - assertMessageOffset(t, <-consumer.Messages(), 4) + select { + case msg := <-consumer.Messages(): + assertMessageOffset(t, msg, 3) + case err := <-consumer.Errors(): + t.Fatal(err) + } + + select { + case msg := <-consumer.Messages(): + assertMessageOffset(t, msg, 4) + case err := <-consumer.Errors(): + t.Fatal(err) + } safeClose(t, consumer) safeClose(t, master) @@ -490,6 +503,7 @@ func TestConsumerNonSequentialOffsets(t *testing.T) { newFetchResponse.AddRecord("my_topic", 0, nil, testMsg, 5) newFetchResponse.AddRecord("my_topic", 0, nil, testMsg, 7) newFetchResponse.AddRecord("my_topic", 0, nil, testMsg, 11) + newFetchResponse.SetLastOffsetDelta("my_topic", 0, 11) newFetchResponse.SetLastStableOffset("my_topic", 0, 11) for _, fetchResponse1 := range []*FetchResponse{legacyFetchResponse, newFetchResponse} { var offsetResponseVersion int16 diff --git a/vendor/github.com/Shopify/sarama/create_topics_request.go b/vendor/github.com/Shopify/sarama/create_topics_request.go new file mode 100644 index 000000000..709c0a44e --- /dev/null +++ b/vendor/github.com/Shopify/sarama/create_topics_request.go @@ -0,0 +1,174 @@ +package sarama + +import ( + "time" +) + +type CreateTopicsRequest struct { + Version int16 + + TopicDetails map[string]*TopicDetail + Timeout time.Duration + ValidateOnly bool +} + +func (c *CreateTopicsRequest) encode(pe packetEncoder) error { + if err := pe.putArrayLength(len(c.TopicDetails)); err != nil { + return err + } + for topic, detail := range c.TopicDetails { + if err := pe.putString(topic); err != nil { + return err + } + if err := detail.encode(pe); err != nil { + return err + } + } + + pe.putInt32(int32(c.Timeout / time.Millisecond)) + + if c.Version >= 1 { + pe.putBool(c.ValidateOnly) + } + + return nil +} + +func (c *CreateTopicsRequest) decode(pd packetDecoder, version int16) (err error) { + n, err := pd.getArrayLength() + if err != nil { + return err + } + + c.TopicDetails = make(map[string]*TopicDetail, n) + + for i := 0; i < n; i++ { + topic, err := pd.getString() + if err != nil { + return err + } + c.TopicDetails[topic] = new(TopicDetail) + if err = c.TopicDetails[topic].decode(pd, version); err != nil { + return err + } + } + + timeout, err := pd.getInt32() + if err != nil { + return err + } + c.Timeout = time.Duration(timeout) * time.Millisecond + + if version >= 1 { + c.ValidateOnly, err = pd.getBool() + if err != nil { + return err + } + + c.Version = version + } + + return nil +} + +func (c *CreateTopicsRequest) key() int16 { + return 19 +} + +func (c *CreateTopicsRequest) version() int16 { + return c.Version +} + +func (c *CreateTopicsRequest) requiredVersion() KafkaVersion { + switch c.Version { + case 2: + return V1_0_0_0 + case 1: + return V0_11_0_0 + default: + return V0_10_1_0 + } +} + +type TopicDetail struct { + NumPartitions int32 + ReplicationFactor int16 + ReplicaAssignment map[int32][]int32 + ConfigEntries map[string]*string +} + +func (t *TopicDetail) encode(pe packetEncoder) error { + pe.putInt32(t.NumPartitions) + pe.putInt16(t.ReplicationFactor) + + if err := pe.putArrayLength(len(t.ReplicaAssignment)); err != nil { + return err + } + for partition, assignment := range t.ReplicaAssignment { + pe.putInt32(partition) + if err := pe.putInt32Array(assignment); err != nil { + return err + } + } + + if err := pe.putArrayLength(len(t.ConfigEntries)); err != nil { + return err + } + for configKey, configValue := range t.ConfigEntries { + if err := pe.putString(configKey); err != nil { + return err + } + if err := pe.putNullableString(configValue); err != nil { + return err + } + } + + return nil +} + +func (t *TopicDetail) decode(pd packetDecoder, version int16) (err error) { + if t.NumPartitions, err = pd.getInt32(); err != nil { + return err + } + if t.ReplicationFactor, err = pd.getInt16(); err != nil { + return err + } + + n, err := pd.getArrayLength() + if err != nil { + return err + } + + if n > 0 { + t.ReplicaAssignment = make(map[int32][]int32, n) + for i := 0; i < n; i++ { + replica, err := pd.getInt32() + if err != nil { + return err + } + if t.ReplicaAssignment[replica], err = pd.getInt32Array(); err != nil { + return err + } + } + } + + n, err = pd.getArrayLength() + if err != nil { + return err + } + + if n > 0 { + t.ConfigEntries = make(map[string]*string, n) + for i := 0; i < n; i++ { + configKey, err := pd.getString() + if err != nil { + return err + } + if t.ConfigEntries[configKey], err = pd.getNullableString(); err != nil { + return err + } + } + } + + return nil +} diff --git a/vendor/github.com/Shopify/sarama/create_topics_request_test.go b/vendor/github.com/Shopify/sarama/create_topics_request_test.go new file mode 100644 index 000000000..56b1b80e5 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/create_topics_request_test.go @@ -0,0 +1,50 @@ +package sarama + +import ( + "testing" + "time" +) + +var ( + createTopicsRequestV0 = []byte{ + 0, 0, 0, 1, + 0, 5, 't', 'o', 'p', 'i', 'c', + 255, 255, 255, 255, + 255, 255, + 0, 0, 0, 1, // 1 replica assignment + 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2, + 0, 0, 0, 1, // 1 config + 0, 12, 'r', 'e', 't', 'e', 'n', 't', 'i', 'o', 'n', '.', 'm', 's', + 0, 2, '-', '1', + 0, 0, 0, 100, + } + + createTopicsRequestV1 = append(createTopicsRequestV0, byte(1)) +) + +func TestCreateTopicsRequest(t *testing.T) { + retention := "-1" + + req := &CreateTopicsRequest{ + TopicDetails: map[string]*TopicDetail{ + "topic": { + NumPartitions: -1, + ReplicationFactor: -1, + ReplicaAssignment: map[int32][]int32{ + 0: []int32{0, 1, 2}, + }, + ConfigEntries: map[string]*string{ + "retention.ms": &retention, + }, + }, + }, + Timeout: 100 * time.Millisecond, + } + + testRequest(t, "version 0", req, createTopicsRequestV0) + + req.Version = 1 + req.ValidateOnly = true + + testRequest(t, "version 1", req, createTopicsRequestV1) +} diff --git a/vendor/github.com/Shopify/sarama/create_topics_response.go b/vendor/github.com/Shopify/sarama/create_topics_response.go new file mode 100644 index 000000000..66207e00c --- /dev/null +++ b/vendor/github.com/Shopify/sarama/create_topics_response.go @@ -0,0 +1,112 @@ +package sarama + +import "time" + +type CreateTopicsResponse struct { + Version int16 + ThrottleTime time.Duration + TopicErrors map[string]*TopicError +} + +func (c *CreateTopicsResponse) encode(pe packetEncoder) error { + if c.Version >= 2 { + pe.putInt32(int32(c.ThrottleTime / time.Millisecond)) + } + + if err := pe.putArrayLength(len(c.TopicErrors)); err != nil { + return err + } + for topic, topicError := range c.TopicErrors { + if err := pe.putString(topic); err != nil { + return err + } + if err := topicError.encode(pe, c.Version); err != nil { + return err + } + } + + return nil +} + +func (c *CreateTopicsResponse) decode(pd packetDecoder, version int16) (err error) { + c.Version = version + + if version >= 2 { + throttleTime, err := pd.getInt32() + if err != nil { + return err + } + c.ThrottleTime = time.Duration(throttleTime) * time.Millisecond + } + + n, err := pd.getArrayLength() + if err != nil { + return err + } + + c.TopicErrors = make(map[string]*TopicError, n) + for i := 0; i < n; i++ { + topic, err := pd.getString() + if err != nil { + return err + } + c.TopicErrors[topic] = new(TopicError) + if err := c.TopicErrors[topic].decode(pd, version); err != nil { + return err + } + } + + return nil +} + +func (c *CreateTopicsResponse) key() int16 { + return 19 +} + +func (c *CreateTopicsResponse) version() int16 { + return c.Version +} + +func (c *CreateTopicsResponse) requiredVersion() KafkaVersion { + switch c.Version { + case 2: + return V1_0_0_0 + case 1: + return V0_11_0_0 + default: + return V0_10_1_0 + } +} + +type TopicError struct { + Err KError + ErrMsg *string +} + +func (t *TopicError) encode(pe packetEncoder, version int16) error { + pe.putInt16(int16(t.Err)) + + if version >= 1 { + if err := pe.putNullableString(t.ErrMsg); err != nil { + return err + } + } + + return nil +} + +func (t *TopicError) decode(pd packetDecoder, version int16) (err error) { + kErr, err := pd.getInt16() + if err != nil { + return err + } + t.Err = KError(kErr) + + if version >= 1 { + if t.ErrMsg, err = pd.getNullableString(); err != nil { + return err + } + } + + return nil +} diff --git a/vendor/github.com/Shopify/sarama/create_topics_response_test.go b/vendor/github.com/Shopify/sarama/create_topics_response_test.go new file mode 100644 index 000000000..53790064f --- /dev/null +++ b/vendor/github.com/Shopify/sarama/create_topics_response_test.go @@ -0,0 +1,52 @@ +package sarama + +import ( + "testing" + "time" +) + +var ( + createTopicsResponseV0 = []byte{ + 0, 0, 0, 1, + 0, 5, 't', 'o', 'p', 'i', 'c', + 0, 42, + } + + createTopicsResponseV1 = []byte{ + 0, 0, 0, 1, + 0, 5, 't', 'o', 'p', 'i', 'c', + 0, 42, + 0, 3, 'm', 's', 'g', + } + + createTopicsResponseV2 = []byte{ + 0, 0, 0, 100, + 0, 0, 0, 1, + 0, 5, 't', 'o', 'p', 'i', 'c', + 0, 42, + 0, 3, 'm', 's', 'g', + } +) + +func TestCreateTopicsResponse(t *testing.T) { + resp := &CreateTopicsResponse{ + TopicErrors: map[string]*TopicError{ + "topic": &TopicError{ + Err: ErrInvalidRequest, + }, + }, + } + + testResponse(t, "version 0", resp, createTopicsResponseV0) + + resp.Version = 1 + msg := "msg" + resp.TopicErrors["topic"].ErrMsg = &msg + + testResponse(t, "version 1", resp, createTopicsResponseV1) + + resp.Version = 2 + resp.ThrottleTime = 100 * time.Millisecond + + testResponse(t, "version 2", resp, createTopicsResponseV2) +} diff --git a/vendor/github.com/Shopify/sarama/delete_topics_request.go b/vendor/github.com/Shopify/sarama/delete_topics_request.go new file mode 100644 index 000000000..ed9089ea4 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/delete_topics_request.go @@ -0,0 +1,41 @@ +package sarama + +import "time" + +type DeleteTopicsRequest struct { + Topics []string + Timeout time.Duration +} + +func (d *DeleteTopicsRequest) encode(pe packetEncoder) error { + if err := pe.putStringArray(d.Topics); err != nil { + return err + } + pe.putInt32(int32(d.Timeout / time.Millisecond)) + + return nil +} + +func (d *DeleteTopicsRequest) decode(pd packetDecoder, version int16) (err error) { + if d.Topics, err = pd.getStringArray(); err != nil { + return err + } + timeout, err := pd.getInt32() + if err != nil { + return err + } + d.Timeout = time.Duration(timeout) * time.Millisecond + return nil +} + +func (d *DeleteTopicsRequest) key() int16 { + return 20 +} + +func (d *DeleteTopicsRequest) version() int16 { + return 0 +} + +func (d *DeleteTopicsRequest) requiredVersion() KafkaVersion { + return V0_10_1_0 +} diff --git a/vendor/github.com/Shopify/sarama/delete_topics_request_test.go b/vendor/github.com/Shopify/sarama/delete_topics_request_test.go new file mode 100644 index 000000000..ce940823c --- /dev/null +++ b/vendor/github.com/Shopify/sarama/delete_topics_request_test.go @@ -0,0 +1,22 @@ +package sarama + +import ( + "testing" + "time" +) + +var deleteTopicsRequest = []byte{ + 0, 0, 0, 2, + 0, 5, 't', 'o', 'p', 'i', 'c', + 0, 5, 'o', 't', 'h', 'e', 'r', + 0, 0, 0, 100, +} + +func TestDeleteTopicsRequest(t *testing.T) { + req := &DeleteTopicsRequest{ + Topics: []string{"topic", "other"}, + Timeout: 100 * time.Millisecond, + } + + testRequest(t, "", req, deleteTopicsRequest) +} diff --git a/vendor/github.com/Shopify/sarama/delete_topics_response.go b/vendor/github.com/Shopify/sarama/delete_topics_response.go new file mode 100644 index 000000000..34225460a --- /dev/null +++ b/vendor/github.com/Shopify/sarama/delete_topics_response.go @@ -0,0 +1,78 @@ +package sarama + +import "time" + +type DeleteTopicsResponse struct { + Version int16 + ThrottleTime time.Duration + TopicErrorCodes map[string]KError +} + +func (d *DeleteTopicsResponse) encode(pe packetEncoder) error { + if d.Version >= 1 { + pe.putInt32(int32(d.ThrottleTime / time.Millisecond)) + } + + if err := pe.putArrayLength(len(d.TopicErrorCodes)); err != nil { + return err + } + for topic, errorCode := range d.TopicErrorCodes { + if err := pe.putString(topic); err != nil { + return err + } + pe.putInt16(int16(errorCode)) + } + + return nil +} + +func (d *DeleteTopicsResponse) decode(pd packetDecoder, version int16) (err error) { + if version >= 1 { + throttleTime, err := pd.getInt32() + if err != nil { + return err + } + d.ThrottleTime = time.Duration(throttleTime) * time.Millisecond + + d.Version = version + } + + n, err := pd.getArrayLength() + if err != nil { + return err + } + + d.TopicErrorCodes = make(map[string]KError, n) + + for i := 0; i < n; i++ { + topic, err := pd.getString() + if err != nil { + return err + } + errorCode, err := pd.getInt16() + if err != nil { + return err + } + + d.TopicErrorCodes[topic] = KError(errorCode) + } + + return nil +} + +func (d *DeleteTopicsResponse) key() int16 { + return 20 +} + +func (d *DeleteTopicsResponse) version() int16 { + return d.Version +} + +func (d *DeleteTopicsResponse) requiredVersion() KafkaVersion { + switch d.Version { + case 1: + return V0_11_0_0 + default: + return V0_10_1_0 + } +} diff --git a/vendor/github.com/Shopify/sarama/delete_topics_response_test.go b/vendor/github.com/Shopify/sarama/delete_topics_response_test.go new file mode 100644 index 000000000..516f1a3bd --- /dev/null +++ b/vendor/github.com/Shopify/sarama/delete_topics_response_test.go @@ -0,0 +1,36 @@ +package sarama + +import ( + "testing" + "time" +) + +var ( + deleteTopicsResponseV0 = []byte{ + 0, 0, 0, 1, + 0, 5, 't', 'o', 'p', 'i', 'c', + 0, 0, + } + + deleteTopicsResponseV1 = []byte{ + 0, 0, 0, 100, + 0, 0, 0, 1, + 0, 5, 't', 'o', 'p', 'i', 'c', + 0, 0, + } +) + +func TestDeleteTopicsResponse(t *testing.T) { + resp := &DeleteTopicsResponse{ + TopicErrorCodes: map[string]KError{ + "topic": ErrNoError, + }, + } + + testResponse(t, "version 0", resp, deleteTopicsResponseV0) + + resp.Version = 1 + resp.ThrottleTime = 100 * time.Millisecond + + testResponse(t, "version 1", resp, deleteTopicsResponseV1) +} diff --git a/vendor/github.com/Shopify/sarama/describe_configs_request.go b/vendor/github.com/Shopify/sarama/describe_configs_request.go new file mode 100644 index 000000000..7a7cffc3f --- /dev/null +++ b/vendor/github.com/Shopify/sarama/describe_configs_request.go @@ -0,0 +1,91 @@ +package sarama + +type ConfigResource struct { + Type ConfigResourceType + Name string + ConfigNames []string +} + +type DescribeConfigsRequest struct { + Resources []*ConfigResource +} + +func (r *DescribeConfigsRequest) encode(pe packetEncoder) error { + if err := pe.putArrayLength(len(r.Resources)); err != nil { + return err + } + + for _, c := range r.Resources { + pe.putInt8(int8(c.Type)) + if err := pe.putString(c.Name); err != nil { + return err + } + + if len(c.ConfigNames) == 0 { + pe.putInt32(-1) + continue + } + if err := pe.putStringArray(c.ConfigNames); err != nil { + return err + } + } + + return nil +} + +func (r *DescribeConfigsRequest) decode(pd packetDecoder, version int16) (err error) { + n, err := pd.getArrayLength() + if err != nil { + return err + } + + r.Resources = make([]*ConfigResource, n) + + for i := 0; i < n; i++ { + r.Resources[i] = &ConfigResource{} + t, err := pd.getInt8() + if err != nil { + return err + } + r.Resources[i].Type = ConfigResourceType(t) + name, err := pd.getString() + if err != nil { + return err + } + r.Resources[i].Name = name + + confLength, err := pd.getArrayLength() + + if err != nil { + return err + } + + if confLength == -1 { + continue + } + + cfnames := make([]string, confLength) + for i := 0; i < confLength; i++ { + s, err := pd.getString() + if err != nil { + return err + } + cfnames[i] = s + } + r.Resources[i].ConfigNames = cfnames + } + + return nil +} + +func (r *DescribeConfigsRequest) key() int16 { + return 32 +} + +func (r *DescribeConfigsRequest) version() int16 { + return 0 +} + +func (r *DescribeConfigsRequest) requiredVersion() KafkaVersion { + return V0_11_0_0 +} diff --git a/vendor/github.com/Shopify/sarama/describe_configs_request_test.go b/vendor/github.com/Shopify/sarama/describe_configs_request_test.go new file mode 100644 index 000000000..ca0fd0495 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/describe_configs_request_test.go @@ -0,0 +1,90 @@ +package sarama + +import "testing" + +var ( + emptyDescribeConfigsRequest = []byte{ + 0, 0, 0, 0, // 0 configs + } + + singleDescribeConfigsRequest = []byte{ + 0, 0, 0, 1, // 1 config + 2, // a topic + 0, 3, 'f', 'o', 'o', // topic name: foo + 0, 0, 0, 1, //1 config name + 0, 10, // 10 chars + 's', 'e', 'g', 'm', 'e', 'n', 't', '.', 'm', 's', + } + + doubleDescribeConfigsRequest = []byte{ + 0, 0, 0, 2, // 2 configs + 2, // a topic + 0, 3, 'f', 'o', 'o', // topic name: foo + 0, 0, 0, 2, //2 config name + 0, 10, // 10 chars + 's', 'e', 'g', 'm', 'e', 'n', 't', '.', 'm', 's', + 0, 12, // 12 chars + 'r', 'e', 't', 'e', 'n', 't', 'i', 'o', 'n', '.', 'm', 's', + 2, // a topic + 0, 3, 'b', 'a', 'r', // topic name: foo + 0, 0, 0, 1, // 1 config + 0, 10, // 10 chars + 's', 'e', 'g', 'm', 'e', 'n', 't', '.', 'm', 's', + } + + singleDescribeConfigsRequestAllConfigs = []byte{ + 0, 0, 0, 1, // 1 config + 2, // a topic + 0, 3, 'f', 'o', 'o', // topic name: foo + 255, 255, 255, 255, // no configs + } +) + +func TestDescribeConfigsRequest(t *testing.T) { + var request *DescribeConfigsRequest + + request = &DescribeConfigsRequest{ + Resources: []*ConfigResource{}, + } + testRequest(t, "no requests", request, emptyDescribeConfigsRequest) + + configs := []string{"segment.ms"} + request = &DescribeConfigsRequest{ + Resources: []*ConfigResource{ + &ConfigResource{ + Type: TopicResource, + Name: "foo", + ConfigNames: configs, + }, + }, + } + + testRequest(t, "one config", request, singleDescribeConfigsRequest) + + request = &DescribeConfigsRequest{ + Resources: []*ConfigResource{ + &ConfigResource{ + Type: TopicResource, + Name: "foo", + ConfigNames: []string{"segment.ms", "retention.ms"}, + }, + &ConfigResource{ + Type: TopicResource, + Name: "bar", + ConfigNames: []string{"segment.ms"}, + }, + }, + } + testRequest(t, "two configs", request, doubleDescribeConfigsRequest) + + request = &DescribeConfigsRequest{ + Resources: []*ConfigResource{ + &ConfigResource{ + Type: TopicResource, + Name: "foo", + }, + }, + } + + testRequest(t, "one topic, all configs", request, singleDescribeConfigsRequestAllConfigs) +} diff --git a/vendor/github.com/Shopify/sarama/describe_configs_response.go b/vendor/github.com/Shopify/sarama/describe_configs_response.go new file mode 100644 index 000000000..6e5d30e4f --- /dev/null +++ b/vendor/github.com/Shopify/sarama/describe_configs_response.go @@ -0,0 +1,188 @@ +package sarama + +import "time" + +type DescribeConfigsResponse struct { + ThrottleTime time.Duration + Resources []*ResourceResponse +} + +type ResourceResponse struct { + ErrorCode int16 + ErrorMsg string + Type ConfigResourceType + Name string + Configs []*ConfigEntry +} + +type ConfigEntry struct { + Name string + Value string + ReadOnly bool + Default bool + Sensitive bool +} + +func (r *DescribeConfigsResponse) encode(pe packetEncoder) (err error) { + pe.putInt32(int32(r.ThrottleTime / time.Millisecond)) + if err = pe.putArrayLength(len(r.Resources)); err != nil { + return err + } + + for _, c := range r.Resources { + if err = c.encode(pe); err != nil { + return err + } + } + return nil +} + +func (r *DescribeConfigsResponse) decode(pd packetDecoder, version int16) (err error) { + throttleTime, err := pd.getInt32() + if err != nil { + return err + } + r.ThrottleTime = time.Duration(throttleTime) * time.Millisecond + + n, err := pd.getArrayLength() + if err != nil { + return err + } + + r.Resources = make([]*ResourceResponse, n) + for i := 0; i < n; i++ { + rr := &ResourceResponse{} + if err := rr.decode(pd, version); err != nil { + return err + } + r.Resources[i] = rr + } + + return nil +} + +func (r *DescribeConfigsResponse) key() int16 { + return 32 +} + +func (r *DescribeConfigsResponse) version() int16 { + return 0 +} + +func (r *DescribeConfigsResponse) requiredVersion() KafkaVersion { + return V0_11_0_0 +} + +func (r *ResourceResponse) encode(pe packetEncoder) (err error) { + pe.putInt16(r.ErrorCode) + + if err = pe.putString(r.ErrorMsg); err != nil { + return err + } + + pe.putInt8(int8(r.Type)) + + if err = pe.putString(r.Name); err != nil { + return err + } + + if err = pe.putArrayLength(len(r.Configs)); err != nil { + return err + } + + for _, c := range r.Configs { + if err = c.encode(pe); err != nil { + return err + } + } + return nil +} + +func (r *ResourceResponse) decode(pd packetDecoder, version int16) (err error) { + ec, err := pd.getInt16() + if err != nil { + return err + } + r.ErrorCode = ec + + em, err := pd.getString() + if err != nil { + return err + } + r.ErrorMsg = em + + t, err := pd.getInt8() + if err != nil { + return err + } + r.Type = ConfigResourceType(t) + + name, err := pd.getString() + if err != nil { + return err + } + r.Name = name + + n, err := pd.getArrayLength() + if err != nil { + return err + } + + r.Configs = make([]*ConfigEntry, n) + for i := 0; i < n; i++ { + c := &ConfigEntry{} + if err := c.decode(pd, version); err != nil { + return err + } + r.Configs[i] = c + } + return nil +} + +func (r *ConfigEntry) encode(pe packetEncoder) (err error) { + if err = pe.putString(r.Name); err != nil { + return err + } + + if err = pe.putString(r.Value); err != nil { + return err + } + + pe.putBool(r.ReadOnly) + pe.putBool(r.Default) + pe.putBool(r.Sensitive) + return nil +} + +func (r *ConfigEntry) decode(pd packetDecoder, version int16) (err error) { + name, err := pd.getString() + if err != nil { + return err + } + r.Name = name + + value, err := pd.getString() + if err != nil { + return err + } + r.Value = value + + read, err := pd.getBool() + if err != nil { + return err + } + r.ReadOnly = read + + de, err := pd.getBool() + if err != nil { + return err + } + r.Default = de + + sensitive, err := pd.getBool() + if err != nil { + return err + } + r.Sensitive = sensitive + return nil +} diff --git a/vendor/github.com/Shopify/sarama/describe_configs_response_test.go b/vendor/github.com/Shopify/sarama/describe_configs_response_test.go new file mode 100644 index 000000000..e3dcbac39 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/describe_configs_response_test.go @@ -0,0 +1,60 @@ +package sarama + +import ( + "testing" +) + +var ( + describeConfigsResponseEmpty = []byte{ + 0, 0, 0, 0, //throttle + 0, 0, 0, 0, // no configs + } + + describeConfigsResponsePopulated = []byte{ + 0, 0, 0, 0, //throttle + 0, 0, 0, 1, // response + 0, 0, //errorcode + 0, 0, //string + 2, // topic + 0, 3, 'f', 'o', 'o', + 0, 0, 0, 1, //configs + 0, 10, 's', 'e', 'g', 'm', 'e', 'n', 't', '.', 'm', 's', + 0, 4, '1', '0', '0', '0', + 0, // ReadOnly + 0, // Default + 0, // Sensitive + } +) + +func TestDescribeConfigsResponse(t *testing.T) { + var response *DescribeConfigsResponse + + response = &DescribeConfigsResponse{ + Resources: []*ResourceResponse{}, + } + testVersionDecodable(t, "empty", response, describeConfigsResponseEmpty, 0) + if len(response.Resources) != 0 { + t.Error("Expected no groups") + } + + response = &DescribeConfigsResponse{ + Resources: []*ResourceResponse{ + &ResourceResponse{ + ErrorCode: 0, + ErrorMsg: "", + Type: TopicResource, + Name: "foo", + Configs: []*ConfigEntry{ + &ConfigEntry{ + Name: "segment.ms", + Value: "1000", + ReadOnly: false, + Default: false, + Sensitive: false, + }, + }, + }, + }, + } + testResponse(t, "response with error", response, describeConfigsResponsePopulated) +} diff --git a/vendor/github.com/Shopify/sarama/end_txn_request.go b/vendor/github.com/Shopify/sarama/end_txn_request.go new file mode 100644 index 000000000..2cd9b506d --- /dev/null +++ b/vendor/github.com/Shopify/sarama/end_txn_request.go @@ -0,0 +1,50 @@ +package sarama + +type EndTxnRequest struct { + TransactionalID string + ProducerID int64 + ProducerEpoch int16 + TransactionResult bool +} + +func (a *EndTxnRequest) encode(pe packetEncoder) error { + if err := pe.putString(a.TransactionalID); err != nil { + return err + } + + pe.putInt64(a.ProducerID) + + pe.putInt16(a.ProducerEpoch) + + pe.putBool(a.TransactionResult) + + return nil +} + +func (a *EndTxnRequest) decode(pd packetDecoder, version int16) (err error) { + if a.TransactionalID, err = pd.getString(); err != nil { + return err + } + if a.ProducerID, err = pd.getInt64(); err != nil { + return err + } + if a.ProducerEpoch, err = pd.getInt16(); err != nil { + return err + } + if a.TransactionResult, err = pd.getBool(); err != nil { + return err + } + return nil +} + +func (a *EndTxnRequest) key() int16 { + return 26 +} + +func (a *EndTxnRequest) version() int16 { + return 0 +} + +func (a *EndTxnRequest) requiredVersion() KafkaVersion { + return V0_11_0_0 +} diff --git a/vendor/github.com/Shopify/sarama/end_txn_request_test.go b/vendor/github.com/Shopify/sarama/end_txn_request_test.go new file mode 100644 index 000000000..20e404eb8 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/end_txn_request_test.go @@ -0,0 +1,23 @@ +package sarama + +import "testing" + +var ( + endTxnRequest = []byte{ + 0, 3, 't', 'x', 'n', + 0, 0, 0, 0, 0, 0, 31, 64, + 0, 1, + 1, + } +) + +func TestEndTxnRequest(t *testing.T) { + req := &EndTxnRequest{ + TransactionalID: "txn", + ProducerID: 8000, + ProducerEpoch: 1, + TransactionResult: true, + } + + testRequest(t, "", req, endTxnRequest) +} diff --git a/vendor/github.com/Shopify/sarama/end_txn_response.go b/vendor/github.com/Shopify/sarama/end_txn_response.go new file mode 100644 index 000000000..33b27e33d --- /dev/null +++ b/vendor/github.com/Shopify/sarama/end_txn_response.go @@ -0,0 +1,44 @@ +package sarama + +import ( + "time" +) + +type EndTxnResponse struct { + ThrottleTime time.Duration + Err KError +} + +func (e *EndTxnResponse) encode(pe packetEncoder) error { + pe.putInt32(int32(e.ThrottleTime / time.Millisecond)) + pe.putInt16(int16(e.Err)) + return nil +} + +func (e *EndTxnResponse) decode(pd packetDecoder, version int16) (err error) { + throttleTime, err := pd.getInt32() + if err != nil { + return err + } + e.ThrottleTime = time.Duration(throttleTime) * time.Millisecond + + kerr, err := pd.getInt16() + if err != nil { + return err + } + e.Err = KError(kerr) + + return nil +} + +func (e *EndTxnResponse) key() int16 { + return 25 +} + +func (e *EndTxnResponse) version() int16 { + return 0 +} + +func (e *EndTxnResponse) requiredVersion() KafkaVersion { + return V0_11_0_0 +} diff --git a/vendor/github.com/Shopify/sarama/end_txn_response_test.go b/vendor/github.com/Shopify/sarama/end_txn_response_test.go new file mode 100644 index 000000000..41d730418 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/end_txn_response_test.go @@ -0,0 +1,22 @@ +package sarama + +import ( + "testing" + "time" +) + +var ( + endTxnResponse = []byte{ + 0, 0, 0, 100, + 0, 49, + } +) + +func TestEndTxnResponse(t *testing.T) { + resp := &EndTxnResponse{ + ThrottleTime: 100 * time.Millisecond, + Err: ErrInvalidProducerIDMapping, + } + + testResponse(t, "", resp, endTxnResponse) +} diff --git a/vendor/github.com/Shopify/sarama/errors.go b/vendor/github.com/Shopify/sarama/errors.go index b6242cd8e..54f431a4a 100644 --- a/vendor/github.com/Shopify/sarama/errors.go +++ b/vendor/github.com/Shopify/sarama/errors.go @@ -37,6 +37,10 @@ var ErrShuttingDown = errors.New("kafka: message received by producer in process // ErrMessageTooLarge is returned when the next message to consume is larger than the configured Consumer.Fetch.Max var ErrMessageTooLarge = errors.New("kafka: message is larger than Consumer.Fetch.Max") +// ErrConsumerOffsetNotAdvanced is returned when a partition consumer didn't advance its offset after parsing +// a RecordBatch. +var ErrConsumerOffsetNotAdvanced = errors.New("kafka: consumer offset was not advanced after a RecordBatch") + // PacketEncodingError is returned from a failure while encoding a Kafka packet. This can happen, for example, // if you try to encode a string over 2^15 characters in length, since Kafka's encoding rules do not permit that. type PacketEncodingError struct { diff --git a/vendor/github.com/Shopify/sarama/fetch_response.go b/vendor/github.com/Shopify/sarama/fetch_response.go index 3433bcfdb..0e81ad89f 100644 --- a/vendor/github.com/Shopify/sarama/fetch_response.go +++ b/vendor/github.com/Shopify/sarama/fetch_response.go @@ -1,6 +1,8 @@ package sarama -import "time" +import ( + "time" +) type AbortedTransaction struct { ProducerID int64 @@ -31,7 +33,9 @@ type FetchResponseBlock struct { HighWaterMarkOffset int64 LastStableOffset int64 AbortedTransactions []*AbortedTransaction - Records Records + Records *Records // deprecated: use FetchResponseBlock.Records + RecordsSet []*Records + Partial bool } func (b *FetchResponseBlock) decode(pd packetDecoder, version int16) (err error) { @@ -79,15 +83,69 @@ func (b *FetchResponseBlock) decode(pd packetDecoder, version int16) (err error) if err != nil { return err } - if recordsSize > 0 { - if err = b.Records.decode(recordsDecoder); err != nil { + + b.RecordsSet = []*Records{} + + for recordsDecoder.remaining() > 0 { + records := &Records{} + if err := records.decode(recordsDecoder); err != nil { + // If we have at least one decoded records, this is not an error + if err == ErrInsufficientData { + if len(b.RecordsSet) == 0 { + b.Partial = true + } + break + } return err } + + partial, err := records.isPartial() + if err != nil { + return err + } + + // If we have at least one full records, we skip incomplete ones + if partial && len(b.RecordsSet) > 0 { + break + } + + b.RecordsSet = append(b.RecordsSet, records) + + if b.Records == nil { + b.Records = records + } } return nil } +func (b *FetchResponseBlock) numRecords() (int, error) { + sum := 0 + + for _, records := range b.RecordsSet { + count, err := records.numRecords() + if err != nil { + return 0, err + } + + sum += count + } + + return sum, nil +} + +func (b *FetchResponseBlock) isPartial() (bool, error) { + if b.Partial { + return true, nil + } + + if len(b.RecordsSet) == 1 { + return b.RecordsSet[0].isPartial() + } + + return false, nil +} + func (b *FetchResponseBlock) encode(pe packetEncoder, version int16) (err error) { pe.putInt16(int16(b.Err)) @@ -107,9 +165,11 @@ func (b *FetchResponseBlock) encode(pe packetEncoder, version int16) (err error) } pe.push(&lengthField{}) - err = b.Records.encode(pe) - if err != nil { - return err + for _, records := range b.RecordsSet { + err = records.encode(pe) + if err != nil { + return err + } } return pe.pop() } @@ -289,11 +349,11 @@ func (r *FetchResponse) AddMessage(topic string, partition int32, key, value Enc kb, vb := encodeKV(key, value) msg := &Message{Key: kb, Value: vb} msgBlock := &MessageBlock{Msg: msg, Offset: offset} - set := frb.Records.msgSet - if set == nil { - set = &MessageSet{} - frb.Records = newLegacyRecords(set) + if len(frb.RecordsSet) == 0 { + records := newLegacyRecords(&MessageSet{}) + frb.RecordsSet = []*Records{&records} } + set := frb.RecordsSet[0].msgSet set.Messages = append(set.Messages, msgBlock) } @@ -301,14 +361,24 @@ func (r *FetchResponse) AddRecord(topic string, partition int32, key, value Enco frb := r.getOrCreateBlock(topic, partition) kb, vb := encodeKV(key, value) rec := &Record{Key: kb, Value: vb, OffsetDelta: offset} - batch := frb.Records.recordBatch - if batch == nil { - batch = &RecordBatch{Version: 2} - frb.Records = newDefaultRecords(batch) + if len(frb.RecordsSet) == 0 { + records := newDefaultRecords(&RecordBatch{Version: 2}) + frb.RecordsSet = []*Records{&records} } + batch := frb.RecordsSet[0].recordBatch batch.addRecord(rec) } +func (r *FetchResponse) SetLastOffsetDelta(topic string, partition int32, offset int32) { + frb := r.getOrCreateBlock(topic, partition) + if len(frb.RecordsSet) == 0 { + records := newDefaultRecords(&RecordBatch{Version: 2}) + frb.RecordsSet = []*Records{&records} + } + batch := frb.RecordsSet[0].recordBatch + batch.LastOffsetDelta = offset +} + func (r *FetchResponse) SetLastStableOffset(topic string, partition int32, offset int64) { frb := r.getOrCreateBlock(topic, partition) frb.LastStableOffset = offset diff --git a/vendor/github.com/Shopify/sarama/fetch_response_test.go b/vendor/github.com/Shopify/sarama/fetch_response_test.go index d1cf4f902..b82a69f3e 100644 --- a/vendor/github.com/Shopify/sarama/fetch_response_test.go +++ b/vendor/github.com/Shopify/sarama/fetch_response_test.go @@ -117,7 +117,7 @@ func TestOneMessageFetchResponse(t *testing.T) { if block.HighWaterMarkOffset != 0x10101010 { t.Error("Decoding didn't produce correct high water mark offset.") } - partial, err := block.Records.isPartial() + partial, err := block.isPartial() if err != nil { t.Fatalf("Unexpected error: %v", err) } @@ -125,14 +125,14 @@ func TestOneMessageFetchResponse(t *testing.T) { t.Error("Decoding detected a partial trailing message where there wasn't one.") } - n, err := block.Records.numRecords() + n, err := block.numRecords() if err != nil { t.Fatalf("Unexpected error: %v", err) } if n != 1 { t.Fatal("Decoding produced incorrect number of messages.") } - msgBlock := block.Records.msgSet.Messages[0] + msgBlock := block.RecordsSet[0].msgSet.Messages[0] if msgBlock.Offset != 0x550000 { t.Error("Decoding produced incorrect message offset.") } @@ -170,7 +170,7 @@ func TestOneRecordFetchResponse(t *testing.T) { if block.HighWaterMarkOffset != 0x10101010 { t.Error("Decoding didn't produce correct high water mark offset.") } - partial, err := block.Records.isPartial() + partial, err := block.isPartial() if err != nil { t.Fatalf("Unexpected error: %v", err) } @@ -178,14 +178,14 @@ func TestOneRecordFetchResponse(t *testing.T) { t.Error("Decoding detected a partial trailing record where there wasn't one.") } - n, err := block.Records.numRecords() + n, err := block.numRecords() if err != nil { t.Fatalf("Unexpected error: %v", err) } if n != 1 { t.Fatal("Decoding produced incorrect number of records.") } - rec := block.Records.recordBatch.Records[0] + rec := block.RecordsSet[0].recordBatch.Records[0] if !bytes.Equal(rec.Key, []byte{0x01, 0x02, 0x03, 0x04}) { t.Error("Decoding produced incorrect record key.") } @@ -216,7 +216,7 @@ func TestOneMessageFetchResponseV4(t *testing.T) { if block.HighWaterMarkOffset != 0x10101010 { t.Error("Decoding didn't produce correct high water mark offset.") } - partial, err := block.Records.isPartial() + partial, err := block.isPartial() if err != nil { t.Fatalf("Unexpected error: %v", err) } @@ -224,14 +224,14 @@ func TestOneMessageFetchResponseV4(t *testing.T) { t.Error("Decoding detected a partial trailing record where there wasn't one.") } - n, err := block.Records.numRecords() + n, err := block.numRecords() if err != nil { t.Fatalf("Unexpected error: %v", err) } if n != 1 { t.Fatal("Decoding produced incorrect number of records.") } - msgBlock := block.Records.msgSet.Messages[0] + msgBlock := block.RecordsSet[0].msgSet.Messages[0] if msgBlock.Offset != 0x550000 { t.Error("Decoding produced incorrect message offset.") } diff --git a/vendor/github.com/Shopify/sarama/init_producer_id_request.go b/vendor/github.com/Shopify/sarama/init_producer_id_request.go new file mode 100644 index 000000000..8ceb6c232 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/init_producer_id_request.go @@ -0,0 +1,43 @@ +package sarama + +import "time" + +type InitProducerIDRequest struct { + TransactionalID *string + TransactionTimeout time.Duration +} + +func (i *InitProducerIDRequest) encode(pe packetEncoder) error { + if err := pe.putNullableString(i.TransactionalID); err != nil { + return err + } + pe.putInt32(int32(i.TransactionTimeout / time.Millisecond)) + + return nil +} + +func (i *InitProducerIDRequest) decode(pd packetDecoder, version int16) (err error) { + if i.TransactionalID, err = pd.getNullableString(); err != nil { + return err + } + + timeout, err := pd.getInt32() + if err != nil { + return err + } + i.TransactionTimeout = time.Duration(timeout) * time.Millisecond + + return nil +} + +func (i *InitProducerIDRequest) key() int16 { + return 22 +} + +func (i *InitProducerIDRequest) version() int16 { + return 0 +} + +func (i *InitProducerIDRequest) requiredVersion() KafkaVersion { + return V0_11_0_0 +} diff --git a/vendor/github.com/Shopify/sarama/init_producer_id_request_test.go b/vendor/github.com/Shopify/sarama/init_producer_id_request_test.go new file mode 100644 index 000000000..5c83d8514 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/init_producer_id_request_test.go @@ -0,0 +1,31 @@ +package sarama + +import ( + "testing" + "time" +) + +var ( + initProducerIDRequestNull = []byte{ + 255, 255, + 0, 0, 0, 100, + } + + initProducerIDRequest = []byte{ + 0, 3, 't', 'x', 'n', + 0, 0, 0, 100, + } +) + +func TestInitProducerIDRequest(t *testing.T) { + req := &InitProducerIDRequest{ + TransactionTimeout: 100 * time.Millisecond, + } + + testRequest(t, "null transaction id", req, initProducerIDRequestNull) + + transactionID := "txn" + req.TransactionalID = &transactionID + + testRequest(t, "transaction id", req, initProducerIDRequest) +} diff --git a/vendor/github.com/Shopify/sarama/init_producer_id_response.go b/vendor/github.com/Shopify/sarama/init_producer_id_response.go new file mode 100644 index 000000000..1b32eb085 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/init_producer_id_response.go @@ -0,0 +1,55 @@ +package sarama + +import "time" + +type InitProducerIDResponse struct { + ThrottleTime time.Duration + Err KError + ProducerID int64 + ProducerEpoch int16 +} + +func (i *InitProducerIDResponse) encode(pe packetEncoder) error { + pe.putInt32(int32(i.ThrottleTime / time.Millisecond)) + pe.putInt16(int16(i.Err)) + pe.putInt64(i.ProducerID) + pe.putInt16(i.ProducerEpoch) + + return nil +} + +func (i *InitProducerIDResponse) decode(pd packetDecoder, version int16) (err error) { + throttleTime, err := pd.getInt32() + if err != nil { + return err + } + i.ThrottleTime = time.Duration(throttleTime) * time.Millisecond + + kerr, err := pd.getInt16() + if err != nil { + return err + } + i.Err = KError(kerr) + + if i.ProducerID, err = pd.getInt64(); err != nil { + return err + } + + if i.ProducerEpoch, err = pd.getInt16(); err != nil { + return err + } + + return nil +} + +func (i *InitProducerIDResponse) key() int16 { + return 22 +} + +func (i *InitProducerIDResponse) version() int16 { + return 0 +} + +func (i *InitProducerIDResponse) requiredVersion() KafkaVersion { + return V0_11_0_0 +} diff --git a/vendor/github.com/Shopify/sarama/init_producer_id_response_test.go b/vendor/github.com/Shopify/sarama/init_producer_id_response_test.go new file mode 100644 index 000000000..b0649386a --- /dev/null +++ b/vendor/github.com/Shopify/sarama/init_producer_id_response_test.go @@ -0,0 +1,37 @@ +package sarama + +import ( + "testing" + "time" +) + +var ( + initProducerIDResponse = []byte{ + 0, 0, 0, 100, + 0, 0, + 0, 0, 0, 0, 0, 0, 31, 64, // producerID = 8000 + 0, 0, // epoch + } + + initProducerIDRequestError = []byte{ + 0, 0, 0, 100, + 0, 51, + 255, 255, 255, 255, 255, 255, 255, 255, + 0, 0, + } +) + +func TestInitProducerIDResponse(t *testing.T) { + resp := &InitProducerIDResponse{ + ThrottleTime: 100 * time.Millisecond, + ProducerID: 8000, + ProducerEpoch: 0, + } + + testResponse(t, "", resp, initProducerIDResponse) + + resp.Err = ErrConcurrentTransactions + resp.ProducerID = -1 + + testResponse(t, "with error", resp, initProducerIDRequestError) +} diff --git a/vendor/github.com/Shopify/sarama/message_set.go b/vendor/github.com/Shopify/sarama/message_set.go index f028784e5..27db52fdf 100644 --- a/vendor/github.com/Shopify/sarama/message_set.go +++ b/vendor/github.com/Shopify/sarama/message_set.go @@ -64,6 +64,19 @@ func (ms *MessageSet) decode(pd packetDecoder) (err error) { ms.Messages = nil for pd.remaining() > 0 { + magic, err := magicValue(pd) + if err != nil { + if err == ErrInsufficientData { + ms.PartialTrailingMessage = true + return nil + } + return err + } + + if magic > 1 { + return nil + } + msb := new(MessageBlock) err = msb.decode(pd) switch err { diff --git a/vendor/github.com/Shopify/sarama/mockbroker.go b/vendor/github.com/Shopify/sarama/mockbroker.go index 0734d34f6..55ef1e292 100644 --- a/vendor/github.com/Shopify/sarama/mockbroker.go +++ b/vendor/github.com/Shopify/sarama/mockbroker.go @@ -288,6 +288,15 @@ func NewMockBroker(t TestReporter, brokerID int32) *MockBroker { // NewMockBrokerAddr behaves like newMockBroker but listens on the address you give // it rather than just some ephemeral port. func NewMockBrokerAddr(t TestReporter, brokerID int32, addr string) *MockBroker { + listener, err := net.Listen("tcp", addr) + if err != nil { + t.Fatal(err) + } + return NewMockBrokerListener(t, brokerID, listener) +} + +// NewMockBrokerListener behaves like newMockBrokerAddr but accepts connections on the listener specified. +func NewMockBrokerListener(t TestReporter, brokerID int32, listener net.Listener) *MockBroker { var err error broker := &MockBroker{ @@ -296,13 +305,10 @@ func NewMockBrokerAddr(t TestReporter, brokerID int32, addr string) *MockBroker t: t, brokerID: brokerID, expectations: make(chan encoder, 512), + listener: listener, } broker.handler = broker.defaultRequestHandler - broker.listener, err = net.Listen("tcp", addr) - if err != nil { - t.Fatal(err) - } Logger.Printf("*** mockbroker/%d listening on %s\n", brokerID, broker.listener.Addr().String()) _, portStr, err := net.SplitHostPort(broker.listener.Addr().String()) if err != nil { diff --git a/vendor/github.com/Shopify/sarama/mockresponses.go b/vendor/github.com/Shopify/sarama/mockresponses.go index 9659757b7..f79a9d5e9 100644 --- a/vendor/github.com/Shopify/sarama/mockresponses.go +++ b/vendor/github.com/Shopify/sarama/mockresponses.go @@ -384,14 +384,20 @@ func (mr *MockOffsetCommitResponse) getError(group, topic string, partition int3 // MockProduceResponse is a `ProduceResponse` builder. type MockProduceResponse struct { - errors map[string]map[int32]KError - t TestReporter + version int16 + errors map[string]map[int32]KError + t TestReporter } func NewMockProduceResponse(t TestReporter) *MockProduceResponse { return &MockProduceResponse{t: t} } +func (mr *MockProduceResponse) SetVersion(version int16) *MockProduceResponse { + mr.version = version + return mr +} + func (mr *MockProduceResponse) SetError(topic string, partition int32, kerror KError) *MockProduceResponse { if mr.errors == nil { mr.errors = make(map[string]map[int32]KError) @@ -407,7 +413,9 @@ func (mr *MockProduceResponse) SetError(topic string, partition int32, kerror KE func (mr *MockProduceResponse) For(reqBody versionedDecoder) encoder { req := reqBody.(*ProduceRequest) - res := &ProduceResponse{} + res := &ProduceResponse{ + Version: mr.version, + } for topic, partitions := range req.records { for partition := range partitions { res.AddTopicPartition(topic, partition, mr.getError(topic, partition)) diff --git a/vendor/github.com/Shopify/sarama/produce_request_test.go b/vendor/github.com/Shopify/sarama/produce_request_test.go index be6459596..f6e84bc9b 100644 --- a/vendor/github.com/Shopify/sarama/produce_request_test.go +++ b/vendor/github.com/Shopify/sarama/produce_request_test.go @@ -48,9 +48,9 @@ var ( 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x54, 0x79, 0x61, 0xFD, + 0xCA, 0x33, 0xBC, 0x05, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x58, 0x8D, 0xCD, 0x59, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -83,9 +83,10 @@ func TestProduceRequest(t *testing.T) { request.Version = 3 batch := &RecordBatch{ - Version: 2, - FirstTimestamp: time.Unix(1479847795, 0), - MaxTimestamp: time.Unix(0, 0), + LastOffsetDelta: 1, + Version: 2, + FirstTimestamp: time.Unix(1479847795, 0), + MaxTimestamp: time.Unix(0, 0), Records: []*Record{{ TimestampDelta: 5 * time.Millisecond, Key: []byte{0x01, 0x02, 0x03, 0x04}, diff --git a/vendor/github.com/Shopify/sarama/produce_set.go b/vendor/github.com/Shopify/sarama/produce_set.go index 627fdf031..3cbaeb5f9 100644 --- a/vendor/github.com/Shopify/sarama/produce_set.go +++ b/vendor/github.com/Shopify/sarama/produce_set.go @@ -122,7 +122,15 @@ func (ps *produceSet) buildRequest() *ProduceRequest { for topic, partitionSet := range ps.msgs { for partition, set := range partitionSet { if req.Version >= 3 { - req.AddBatch(topic, partition, set.recordsToSend.recordBatch) + rb := set.recordsToSend.recordBatch + if len(rb.Records) > 0 { + rb.LastOffsetDelta = int32(len(rb.Records) - 1) + for i, record := range rb.Records { + record.OffsetDelta = int64(i) + } + } + + req.AddBatch(topic, partition, rb) continue } if ps.parent.conf.Producer.Compression == CompressionNone { @@ -132,6 +140,17 @@ func (ps *produceSet) buildRequest() *ProduceRequest { // and sent as the payload of a single fake "message" with the appropriate codec // set and no key. When the server sees a message with a compression codec, it // decompresses the payload and treats the result as its message set. + + if ps.parent.conf.Version.IsAtLeast(V0_10_0_0) { + // If our version is 0.10 or later, assign relative offsets + // to the inner messages. This lets the broker avoid + // recompressing the message set. + // (See https://cwiki.apache.org/confluence/display/KAFKA/KIP-31+-+Move+to+relative+offsets+in+compressed+message+sets + // for details on relative offsets.) + for i, msg := range set.recordsToSend.msgSet.Messages { + msg.Offset = int64(i) + } + } payload, err := encode(set.recordsToSend.msgSet, ps.parent.conf.MetricRegistry) if err != nil { Logger.Println(err) // if this happens, it's basically our fault. diff --git a/vendor/github.com/Shopify/sarama/produce_set_test.go b/vendor/github.com/Shopify/sarama/produce_set_test.go index 76afd455a..fee6e3fa1 100644 --- a/vendor/github.com/Shopify/sarama/produce_set_test.go +++ b/vendor/github.com/Shopify/sarama/produce_set_test.go @@ -173,11 +173,14 @@ func TestProduceSetCompressedRequestBuilding(t *testing.T) { if err != nil { t.Error("Failed to decode set from payload") } - for _, compMsgBlock := range msg.Set.Messages { + for i, compMsgBlock := range msg.Set.Messages { compMsg := compMsgBlock.Msg if compMsg.Version != 1 { t.Error("Wrong compressed message version") } + if compMsgBlock.Offset != int64(i) { + t.Errorf("Wrong relative inner offset, expected %d, got %d", i, compMsgBlock.Offset) + } } if msg.Version != 1 { t.Error("Wrong compressed parent message version") @@ -234,6 +237,10 @@ func TestProduceSetV3RequestBuilding(t *testing.T) { t.Errorf("Wrong timestamp delta: %v", rec.TimestampDelta) } + if rec.OffsetDelta != int64(i) { + t.Errorf("Wrong relative inner offset, expected %d, got %d", i, rec.OffsetDelta) + } + for j, h := range batch.Records[i].Headers { exp := fmt.Sprintf("header-%d", j+1) if string(h.Key) != exp { diff --git a/vendor/github.com/Shopify/sarama/record_batch.go b/vendor/github.com/Shopify/sarama/record_batch.go index a8c533b17..321de485b 100644 --- a/vendor/github.com/Shopify/sarama/record_batch.go +++ b/vendor/github.com/Shopify/sarama/record_batch.go @@ -208,21 +208,15 @@ func (b *RecordBatch) decode(pd packetDecoder) (err error) { func (b *RecordBatch) encodeRecords(pe packetEncoder) error { var raw []byte - if b.Codec != CompressionNone { - var err error - if raw, err = encode(recordsArray(b.Records), nil); err != nil { - return err - } - b.recordsLen = len(raw) + var err error + if raw, err = encode(recordsArray(b.Records), pe.metricRegistry()); err != nil { + return err } + b.recordsLen = len(raw) switch b.Codec { case CompressionNone: - offset := pe.offset() - if err := recordsArray(b.Records).encode(pe); err != nil { - return err - } - b.recordsLen = pe.offset() - offset + b.compressedRecords = raw case CompressionGZIP: var buf bytes.Buffer writer := gzip.NewWriter(&buf) diff --git a/vendor/github.com/Shopify/sarama/record_test.go b/vendor/github.com/Shopify/sarama/record_test.go index 68824edee..a3fb8f501 100644 --- a/vendor/github.com/Shopify/sarama/record_test.go +++ b/vendor/github.com/Shopify/sarama/record_test.go @@ -69,9 +69,10 @@ var recordBatchTestCases = []struct { { name: "uncompressed record", batch: RecordBatch{ - Version: 2, - FirstTimestamp: time.Unix(1479847795, 0), - MaxTimestamp: time.Unix(0, 0), + Version: 2, + FirstTimestamp: time.Unix(1479847795, 0), + MaxTimestamp: time.Unix(0, 0), + LastOffsetDelta: 0, Records: []*Record{{ TimestampDelta: 5 * time.Millisecond, Key: []byte{1, 2, 3, 4}, @@ -115,10 +116,11 @@ var recordBatchTestCases = []struct { { name: "gzipped record", batch: RecordBatch{ - Version: 2, - Codec: CompressionGZIP, - FirstTimestamp: time.Unix(1479847795, 0), - MaxTimestamp: time.Unix(0, 0), + Version: 2, + Codec: CompressionGZIP, + FirstTimestamp: time.Unix(1479847795, 0), + MaxTimestamp: time.Unix(0, 0), + LastOffsetDelta: 0, Records: []*Record{{ TimestampDelta: 5 * time.Millisecond, Key: []byte{1, 2, 3, 4}, @@ -168,10 +170,11 @@ var recordBatchTestCases = []struct { { name: "snappy compressed record", batch: RecordBatch{ - Version: 2, - Codec: CompressionSnappy, - FirstTimestamp: time.Unix(1479847795, 0), - MaxTimestamp: time.Unix(0, 0), + Version: 2, + Codec: CompressionSnappy, + FirstTimestamp: time.Unix(1479847795, 0), + MaxTimestamp: time.Unix(0, 0), + LastOffsetDelta: 0, Records: []*Record{{ TimestampDelta: 5 * time.Millisecond, Key: []byte{1, 2, 3, 4}, @@ -203,10 +206,11 @@ var recordBatchTestCases = []struct { { name: "lz4 compressed record", batch: RecordBatch{ - Version: 2, - Codec: CompressionLZ4, - FirstTimestamp: time.Unix(1479847795, 0), - MaxTimestamp: time.Unix(0, 0), + Version: 2, + Codec: CompressionLZ4, + FirstTimestamp: time.Unix(1479847795, 0), + MaxTimestamp: time.Unix(0, 0), + LastOffsetDelta: 0, Records: []*Record{{ TimestampDelta: 5 * time.Millisecond, Key: []byte{1, 2, 3, 4}, diff --git a/vendor/github.com/Shopify/sarama/records.go b/vendor/github.com/Shopify/sarama/records.go index 54ee7e387..258dcbac8 100644 --- a/vendor/github.com/Shopify/sarama/records.go +++ b/vendor/github.com/Shopify/sarama/records.go @@ -62,16 +62,12 @@ func (r *Records) encode(pe packetEncoder) error { } return r.recordBatch.encode(pe) } + return fmt.Errorf("unknown records type: %v", r.recordsType) } func (r *Records) setTypeFromMagic(pd packetDecoder) error { - dec, err := pd.peek(magicOffset, magicLength) - if err != nil { - return err - } - - magic, err := dec.getInt8() + magic, err := magicValue(pd) if err != nil { return err } @@ -80,13 +76,14 @@ func (r *Records) setTypeFromMagic(pd packetDecoder) error { if magic < 2 { r.recordsType = legacyRecords } + return nil } func (r *Records) decode(pd packetDecoder) error { if r.recordsType == unknownRecords { if err := r.setTypeFromMagic(pd); err != nil { - return nil + return err } } @@ -165,3 +162,12 @@ func (r *Records) isControl() (bool, error) { } return false, fmt.Errorf("unknown records type: %v", r.recordsType) } + +func magicValue(pd packetDecoder) (int8, error) { + dec, err := pd.peek(magicOffset, magicLength) + if err != nil { + return 0, err + } + + return dec.getInt8() +} diff --git a/vendor/github.com/Shopify/sarama/request.go b/vendor/github.com/Shopify/sarama/request.go index 9c37ca78b..5f7cb76e9 100644 --- a/vendor/github.com/Shopify/sarama/request.go +++ b/vendor/github.com/Shopify/sarama/request.go @@ -114,6 +114,30 @@ func allocateBody(key, version int16) protocolBody { return &SaslHandshakeRequest{} case 18: return &ApiVersionsRequest{} + case 19: + return &CreateTopicsRequest{} + case 20: + return &DeleteTopicsRequest{} + case 22: + return &InitProducerIDRequest{} + case 24: + return &AddPartitionsToTxnRequest{} + case 25: + return &AddOffsetsToTxnRequest{} + case 26: + return &EndTxnRequest{} + case 28: + return &TxnOffsetCommitRequest{} + case 29: + return &DescribeAclsRequest{} + case 30: + return &CreateAclsRequest{} + case 31: + return &DeleteAclsRequest{} + case 32: + return &DescribeConfigsRequest{} + case 33: + return &AlterConfigsRequest{} case 37: return &CreatePartitionsRequest{} } diff --git a/vendor/github.com/Shopify/sarama/request_test.go b/vendor/github.com/Shopify/sarama/request_test.go index bd9cef4eb..ba830d613 100644 --- a/vendor/github.com/Shopify/sarama/request_test.go +++ b/vendor/github.com/Shopify/sarama/request_test.go @@ -96,3 +96,5 @@ func testResponse(t *testing.T, name string, res protocolBody, expected []byte) t.Errorf("Decoded response does not match the encoded one\nencoded: %#v\ndecoded: %#v", res, decoded) } } + +func nullString(s string) *string { return &s } diff --git a/vendor/github.com/Shopify/sarama/txn_offset_commit_request.go b/vendor/github.com/Shopify/sarama/txn_offset_commit_request.go new file mode 100644 index 000000000..71e95b814 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/txn_offset_commit_request.go @@ -0,0 +1,126 @@ +package sarama + +type TxnOffsetCommitRequest struct { + TransactionalID string + GroupID string + ProducerID int64 + ProducerEpoch int16 + Topics map[string][]*PartitionOffsetMetadata +} + +func (t *TxnOffsetCommitRequest) encode(pe packetEncoder) error { + if err := pe.putString(t.TransactionalID); err != nil { + return err + } + if err := pe.putString(t.GroupID); err != nil { + return err + } + pe.putInt64(t.ProducerID) + pe.putInt16(t.ProducerEpoch) + + if err := pe.putArrayLength(len(t.Topics)); err != nil { + return err + } + for topic, partitions := range t.Topics { + if err := pe.putString(topic); err != nil { + return err + } + if err := pe.putArrayLength(len(partitions)); err != nil { + return err + } + for _, partition := range partitions { + if err := partition.encode(pe); err != nil { + return err + } + } + } + + return nil +} + +func (t *TxnOffsetCommitRequest) decode(pd packetDecoder, version int16) (err error) { + if t.TransactionalID, err = pd.getString(); err != nil { + return err + } + if t.GroupID, err = pd.getString(); err != nil { + return err + } + if t.ProducerID, err = pd.getInt64(); err != nil { + return err + } + if t.ProducerEpoch, err = pd.getInt16(); err != nil { + return err + } + + n, err := pd.getArrayLength() + if err != nil { + return err + } + + t.Topics = make(map[string][]*PartitionOffsetMetadata) + for i := 0; i < n; i++ { + topic, err := pd.getString() + if err != nil { + return err + } + + m, err := pd.getArrayLength() + if err != nil { + return err + } + + t.Topics[topic] = make([]*PartitionOffsetMetadata, m) + + for j := 0; j < m; j++ { + partitionOffsetMetadata := new(PartitionOffsetMetadata) + if err := partitionOffsetMetadata.decode(pd, version); err != nil { + return err + } + t.Topics[topic][j] = partitionOffsetMetadata + } + } + + return nil +} + +func (a *TxnOffsetCommitRequest) key() int16 { + return 28 +} + +func (a *TxnOffsetCommitRequest) version() int16 { + return 0 +} + +func (a *TxnOffsetCommitRequest) requiredVersion() KafkaVersion { + return V0_11_0_0 +} + +type PartitionOffsetMetadata struct { + Partition int32 + Offset int64 + Metadata *string +} + +func (p *PartitionOffsetMetadata) encode(pe packetEncoder) error { + pe.putInt32(p.Partition) + pe.putInt64(p.Offset) + if err := pe.putNullableString(p.Metadata); err != nil { + return err + } + + return nil +} + +func (p *PartitionOffsetMetadata) decode(pd packetDecoder, version int16) (err error) { + if p.Partition, err = pd.getInt32(); err != nil { + return err + } + if p.Offset, err = pd.getInt64(); err != nil { + return err + } + if p.Metadata, err = pd.getNullableString(); err != nil { + return err + } + + return nil +} diff --git a/vendor/github.com/Shopify/sarama/txn_offset_commit_request_test.go b/vendor/github.com/Shopify/sarama/txn_offset_commit_request_test.go new file mode 100644 index 000000000..fe3bba548 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/txn_offset_commit_request_test.go @@ -0,0 +1,35 @@ +package sarama + +import "testing" + +var ( + txnOffsetCommitRequest = []byte{ + 0, 3, 't', 'x', 'n', + 0, 7, 'g', 'r', 'o', 'u', 'p', 'i', 'd', + 0, 0, 0, 0, 0, 0, 31, 64, // producer ID + 0, 1, // producer epoch + 0, 0, 0, 1, // 1 topic + 0, 5, 't', 'o', 'p', 'i', 'c', + 0, 0, 0, 1, // 1 partition + 0, 0, 0, 2, // partition no 2 + 0, 0, 0, 0, 0, 0, 0, 123, + 255, 255, // no meta data + } +) + +func TestTxnOffsetCommitRequest(t *testing.T) { + req := &TxnOffsetCommitRequest{ + TransactionalID: "txn", + GroupID: "groupid", + ProducerID: 8000, + ProducerEpoch: 1, + Topics: map[string][]*PartitionOffsetMetadata{ + "topic": []*PartitionOffsetMetadata{{ + Offset: 123, + Partition: 2, + }}, + }, + } + + testRequest(t, "", req, txnOffsetCommitRequest) +} diff --git a/vendor/github.com/Shopify/sarama/txn_offset_commit_response.go b/vendor/github.com/Shopify/sarama/txn_offset_commit_response.go new file mode 100644 index 000000000..6c980f406 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/txn_offset_commit_response.go @@ -0,0 +1,83 @@ +package sarama + +import ( + "time" +) + +type TxnOffsetCommitResponse struct { + ThrottleTime time.Duration + Topics map[string][]*PartitionError +} + +func (t *TxnOffsetCommitResponse) encode(pe packetEncoder) error { + pe.putInt32(int32(t.ThrottleTime / time.Millisecond)) + if err := pe.putArrayLength(len(t.Topics)); err != nil { + return err + } + + for topic, e := range t.Topics { + if err := pe.putString(topic); err != nil { + return err + } + if err := pe.putArrayLength(len(e)); err != nil { + return err + } + for _, partitionError := range e { + if err := partitionError.encode(pe); err != nil { + return err + } + } + } + + return nil +} + +func (t *TxnOffsetCommitResponse) decode(pd packetDecoder, version int16) (err error) { + throttleTime, err := pd.getInt32() + if err != nil { + return err + } + t.ThrottleTime = time.Duration(throttleTime) * time.Millisecond + + n, err := pd.getArrayLength() + if err != nil { + return err + } + + t.Topics = make(map[string][]*PartitionError) + + for i := 0; i < n; i++ { + topic, err := pd.getString() + if err != nil { + return err + } + + m, err := pd.getArrayLength() + if err != nil { + return err + } + + t.Topics[topic] = make([]*PartitionError, m) + + for j := 0; j < m; j++ { + t.Topics[topic][j] = new(PartitionError) + if err := t.Topics[topic][j].decode(pd, version); err != nil { + return err + } + } + } + + return nil +} + +func (a *TxnOffsetCommitResponse) key() int16 { + return 28 +} + +func (a *TxnOffsetCommitResponse) version() int16 { + return 0 +} + +func (a *TxnOffsetCommitResponse) requiredVersion() KafkaVersion { + return V0_11_0_0 +} diff --git a/vendor/github.com/Shopify/sarama/txn_offset_commit_response_test.go b/vendor/github.com/Shopify/sarama/txn_offset_commit_response_test.go new file mode 100644 index 000000000..b275265c6 --- /dev/null +++ b/vendor/github.com/Shopify/sarama/txn_offset_commit_response_test.go @@ -0,0 +1,31 @@ +package sarama + +import ( + "testing" + "time" +) + +var ( + txnOffsetCommitResponse = []byte{ + 0, 0, 0, 100, + 0, 0, 0, 1, // 1 topic + 0, 5, 't', 'o', 'p', 'i', 'c', + 0, 0, 0, 1, // 1 partition response + 0, 0, 0, 2, // partition number 2 + 0, 47, // err + } +) + +func TestTxnOffsetCommitResponse(t *testing.T) { + resp := &TxnOffsetCommitResponse{ + ThrottleTime: 100 * time.Millisecond, + Topics: map[string][]*PartitionError{ + "topic": []*PartitionError{{ + Partition: 2, + Err: ErrInvalidProducerEpoch, + }}, + }, + } + + testResponse(t, "", resp, txnOffsetCommitResponse) +} diff --git a/vendor/github.com/aws/aws-sdk-go/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go/CHANGELOG.md index 736073e16..2486752ae 100644 --- a/vendor/github.com/aws/aws-sdk-go/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go/CHANGELOG.md @@ -1,3 +1,248 @@ +Release v1.13.4 (2018-02-23) +=== + +### Service Client Updates +* `service/appstream`: Updates service API and documentation + * This API update is to enable customers to copy their Amazon AppStream 2.0 images within and between AWS Regions +* `aws/endpoints`: Updated Regions and Endpoints metadata. + +Release v1.13.3 (2018-02-22) +=== + +### Service Client Updates +* `service/ce`: Updates service API and documentation +* `service/elasticloadbalancingv2`: Updates service documentation +* `aws/endpoints`: Updated Regions and Endpoints metadata. + +Release v1.13.2 (2018-02-21) +=== + +### Service Client Updates +* `service/codecommit`: Updates service API and documentation + * This release adds an API for adding a file directly to an AWS CodeCommit repository without requiring a Git client. +* `service/ec2`: Updates service API and documentation + * Adds support for tagging an EBS snapshot as part of the API call that creates the EBS snapshot +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/serverlessrepo`: Updates service API, documentation, and paginators + +Release v1.13.1 (2018-02-20) +=== + +### Service Client Updates +* `service/autoscaling`: Updates service API and documentation + * Amazon EC2 Auto Scaling support for service-linked roles +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/waf`: Updates service API and documentation + * The new PermissionPolicy APIs in AWS WAF Regional allow customers to attach resource-based policies to their entities. +* `service/waf-regional`: Updates service API and documentation + +Release v1.13.0 (2018-02-19) +=== + +### Service Client Updates +* `service/config`: Updates service API + * With this release, AWS Config updated the ConfigurationItemStatus enum values. The values prior to this update did not represent appropriate values returned by GetResourceConfigHistory. You must update your code to enumerate the new enum values so this is a breaking change. To map old properties to new properties, use the following descriptions: New discovered resource - Old property: Discovered, New property: ResourceDiscovered. Updated resource - Old property: Ok, New property: OK. Deleted resource - Old property: Deleted, New property: ResourceDeleted or ResourceDeletedNotRecorded. Not-recorded resource - Old property: N/A, New property: ResourceNotRecorded or ResourceDeletedNotRecorded. + +Release v1.12.79 (2018-02-16) +=== + +### Service Client Updates +* `service/rds`: Updates service API and documentation + * Updates RDS API to indicate whether a DBEngine supports read replicas. + +Release v1.12.78 (2018-02-15) +=== + +### Service Client Updates +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/gamelift`: Updates service API and documentation + * Updates to allow Fleets to run on On-Demand or Spot instances. +* `service/mediaconvert`: Updates service API and documentation + * Nielsen ID3 tags can now be inserted into transport stream (TS) and HLS outputs. For more information on Nielsen configuration you can go to https://docs.aws.amazon.com/mediaconvert/latest/apireference/jobs.html#jobs-nielsenconfiguration + +Release v1.12.77 (2018-02-14) +=== + +### Service Client Updates +* `service/appsync`: Updates service API and documentation +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/lex-models`: Updates service API and documentation + +Release v1.12.76 (2018-02-13) +=== + +### Service Client Updates +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/glacier`: Updates service documentation + * Documentation updates for glacier +* `service/route53`: Updates service API + * Added support for creating Private Hosted Zones and metric-based healthchecks in the ap-northeast-3 region for whitelisted customers. + +Release v1.12.75 (2018-02-12) +=== + +### Service Client Updates +* `service/cognito-idp`: Updates service API and documentation +* `service/ec2`: Updates service API and documentation + * Network interfaces now supply the following additional status of "associated" to better distinguish the current status. +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/guardduty`: Updates service API and documentation + * Added PortProbeAction information to the Action section of the port probe-type finding. +* `service/kms`: Updates service API + * This release of AWS Key Management Service includes support for InvalidArnException in the RetireGrant API. +* `service/rds`: Updates service documentation + * Aurora MySQL now supports MySQL 5.7. + +Release v1.12.74 (2018-02-09) +=== + +### Service Client Updates +* `service/ec2`: Updates service API and documentation + * Users can now better understand the longer ID opt-in status of their account using the two new APIs DescribeAggregateIdFormat and DescribePrincipalIdFormat +* `service/lex-models`: Updates service API and documentation +* `service/runtime.lex`: Updates service API and documentation + +Release v1.12.73 (2018-02-08) +=== + +### Service Client Updates +* `service/appstream`: Updates service API and documentation + * Adds support for allowing customers to provide a redirect URL for a stack. Users will be redirected to the link provided by the admin at the end of their streaming session. +* `service/budgets`: Updates service API and documentation + * Making budgetLimit and timePeriod optional, and updating budgets docs. +* `service/dms`: Updates service API, documentation, and paginators + * This release includes the addition of two new APIs: describe replication instance task logs and reboot instance. The first allows user to see how much storage each log for a task on a given instance is occupying. The second gives users the option to reboot the application software on the instance and force a fail over for MAZ instances to test robustness of their integration with our service. +* `service/ds`: Updates service API + * Updated the regex of some input parameters to support longer EC2 identifiers. +* `service/dynamodb`: Updates service API and documentation + * Amazon DynamoDB now supports server-side encryption using a default service key (alias/aws/dynamodb) from the AWS Key Management Service (KMS). AWS KMS is a service that combines secure, highly available hardware and software to provide a key management system scaled for the cloud. AWS KMS is used via the AWS Management Console or APIs to centrally create encryption keys, define the policies that control how keys can be used, and audit key usage to prove they are being used correctly. For more information, see the Amazon DynamoDB Developer Guide. +* `service/gamelift`: Updates service API and documentation + * Amazon GameLift FlexMatch added the StartMatchBackfill API. This API allows developers to add new players to an existing game session using the same matchmaking rules and player data that were used to initially create the session. +* `service/medialive`: Updates service API and documentation + * AWS Elemental MediaLive has added support for updating channel settings for idle channels. You can now update channel name, channel outputs and output destinations, encoder settings, user role ARN, and input specifications. Channel settings can be updated in the console or with API calls. Please note that running channels need to be stopped before they can be updated. We've also deprecated the 'Reserved' field. +* `service/mediastore`: Updates service API and documentation + * AWS Elemental MediaStore now supports per-container CORS configuration. + +Release v1.12.72 (2018-02-07) +=== + +### Service Client Updates +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/glue`: Updates service API and documentation + * This new feature will now allow customers to add a customized json classifier. They can specify a json path to indicate the object, array or field of the json documents they'd like crawlers to inspect when they crawl json files. +* `service/servicecatalog`: Updates service API, documentation, and paginators + * This release of Service Catalog adds SearchProvisionedProducts API and ProvisionedProductPlan APIs. +* `service/servicediscovery`: Updates service API and documentation + * This release adds support for registering CNAME record types and creating Route 53 alias records that route traffic to Amazon Elastic Load Balancers using Amazon Route 53 Auto Naming APIs. +* `service/ssm`: Updates service API and documentation + * This Patch Manager release supports configuring Linux repos as part of patch baselines, controlling updates of non-OS security packages and also creating patch baselines for SUSE12 + +### SDK Enhancements +* `private/model/api`: Add validation to ensure there is no duplication of services in models/apis ([#1758](https://github.com/aws/aws-sdk-go/pull/1758)) + * Prevents the SDK from mistakenly generating code a single service multiple times with different model versions. +* `example/service/ec2/instancesbyRegion`: Fix typos in example ([#1762](https://github.com/aws/aws-sdk-go/pull/1762)) +* `private/model/api`: removing SDK API reference crosslinks from input/output shapes. (#1765) + +### SDK Bugs +* `aws/session`: Fix bug in session.New not supporting AWS_SDK_LOAD_CONFIG ([#1770](https://github.com/aws/aws-sdk-go/pull/1770)) + * Fixes a bug in the session.New function that was not correctly sourcing the shared configuration files' path. + * Fixes [#1771](https://github.com/aws/aws-sdk-go/pull/1771) +Release v1.12.71 (2018-02-05) +=== + +### Service Client Updates +* `service/acm`: Updates service documentation + * Documentation updates for acm +* `service/cloud9`: Updates service documentation and examples + * API usage examples for AWS Cloud9. +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/kinesis`: Updates service API and documentation + * Using ListShards a Kinesis Data Streams customer or client can get information about shards in a data stream (including meta-data for each shard) without obtaining data stream level information. +* `service/opsworks`: Updates service API, documentation, and waiters + * AWS OpsWorks Stacks supports EBS encryption and HDD volume types. Also, a new DescribeOperatingSystems API is available, which lists all operating systems supported by OpsWorks Stacks. + +Release v1.12.70 (2018-01-26) +=== + +### Service Client Updates +* `service/devicefarm`: Updates service API and documentation + * Add InteractionMode in CreateRemoteAccessSession for DirectDeviceAccess feature. +* `service/medialive`: Updates service API and documentation + * Add InputSpecification to CreateChannel (specification of input attributes is used for channel sizing and affects pricing); add NotFoundException to DeleteInputSecurityGroups. +* `service/mturk-requester`: Updates service documentation + +Release v1.12.69 (2018-01-26) +=== + +### SDK Bugs +* `models/api`: Fix colliding names [#1754](https://github.com/aws/aws-sdk-go/pull/1754) [#1756](https://github.com/aws/aws-sdk-go/pull/1756) + * SDK had duplicate folders that were causing errors in some builds. + * Fixes [#1753](https://github.com/aws/aws-sdk-go/issues/1753) +Release v1.12.68 (2018-01-25) +=== + +### Service Client Updates +* `service/alexaforbusiness`: Updates service API and documentation +* `service/codebuild`: Updates service API and documentation + * Adding support for Shallow Clone and GitHub Enterprise in AWS CodeBuild. +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/guardduty`: Adds new service + * Added the missing AccessKeyDetails object to the resource shape. +* `service/lambda`: Updates service API and documentation + * AWS Lambda now supports Revision ID on your function versions and aliases, to track and apply conditional updates when you are updating your function version or alias resources. + +### SDK Bugs +* `service/s3/s3manager`: Fix check for nil OrigErr in Error() [#1749](https://github.com/aws/aws-sdk-go/issues/1749) + * S3 Manager's `Error` type did not check for nil of `OrigErr` when calling `Error()` + * Fixes [#1748](https://github.com/aws/aws-sdk-go/issues/1748) +Release v1.12.67 (2018-01-22) +=== + +### Service Client Updates +* `service/budgets`: Updates service API and documentation + * Add additional costTypes: IncludeDiscount, UseAmortized, to support finer control for different charges included in a cost budget. + +Release v1.12.66 (2018-01-19) +=== + +### Service Client Updates +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/glue`: Updates service API and documentation + * New AWS Glue DataCatalog APIs to manage table versions and a new feature to skip archiving of the old table version when updating table. +* `service/transcribe`: Adds new service + +Release v1.12.65 (2018-01-18) +=== + +### Service Client Updates +* `service/sagemaker`: Updates service API and documentation + * CreateTrainingJob and CreateEndpointConfig now supports KMS Key for volume encryption. + +Release v1.12.64 (2018-01-17) +=== + +### Service Client Updates +* `service/autoscaling-plans`: Updates service documentation +* `service/ec2`: Updates service documentation + * Documentation updates for EC2 + +Release v1.12.63 (2018-01-17) +=== + +### Service Client Updates +* `service/application-autoscaling`: Updates service API and documentation +* `service/autoscaling-plans`: Adds new service +* `service/rds`: Updates service API and documentation + * With this release you can now integrate RDS DB instances with CloudWatch Logs. We have added parameters to the operations for creating and modifying DB instances (for example CreateDBInstance) to allow you to take advantage of this capability through the CLI and API. Once you enable this feature, a stream of log events will publish to CloudWatch Logs for each log type you enable. + +Release v1.12.62 (2018-01-15) +=== + +### Service Client Updates +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/lambda`: Updates service API and documentation + * Support for creating Lambda Functions using 'dotnetcore2.0' and 'go1.x'. + Release v1.12.61 (2018-01-12) === diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go b/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go index 63d2df67c..4148d62e5 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go @@ -1,12 +1,11 @@ package client import ( - "math/rand" "strconv" - "sync" "time" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/internal/sdkrand" ) // DefaultRetryer implements basic retry logic using exponential backoff for @@ -31,8 +30,6 @@ func (d DefaultRetryer) MaxRetries() int { return d.NumMaxRetries } -var seededRand = rand.New(&lockedSource{src: rand.NewSource(time.Now().UnixNano())}) - // RetryRules returns the delay duration before retrying this request again func (d DefaultRetryer) RetryRules(r *request.Request) time.Duration { // Set the upper limit of delay in retrying at ~five minutes @@ -53,7 +50,7 @@ func (d DefaultRetryer) RetryRules(r *request.Request) time.Duration { retryCount = 13 } - delay := (1 << uint(retryCount)) * (seededRand.Intn(minTime) + minTime) + delay := (1 << uint(retryCount)) * (sdkrand.SeededRand.Intn(minTime) + minTime) return time.Duration(delay) * time.Millisecond } @@ -117,22 +114,3 @@ func canUseRetryAfterHeader(r *request.Request) bool { return true } - -// lockedSource is a thread-safe implementation of rand.Source -type lockedSource struct { - lk sync.Mutex - src rand.Source -} - -func (r *lockedSource) Int63() (n int64) { - r.lk.Lock() - n = r.src.Int63() - r.lk.Unlock() - return -} - -func (r *lockedSource) Seed(seed int64) { - r.lk.Lock() - r.src.Seed(seed) - r.lk.Unlock() -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go b/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go index 1f39c91f2..e223c54cc 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go @@ -46,6 +46,7 @@ func (reader *teeReaderCloser) Close() error { func logRequest(r *request.Request) { logBody := r.Config.LogLevel.Matches(aws.LogDebugWithHTTPBody) + bodySeekable := aws.IsReaderSeekable(r.Body) dumpedBody, err := httputil.DumpRequestOut(r.HTTPRequest, logBody) if err != nil { r.Config.Logger.Log(fmt.Sprintf(logReqErrMsg, r.ClientInfo.ServiceName, r.Operation.Name, err)) @@ -53,6 +54,9 @@ func logRequest(r *request.Request) { } if logBody { + if !bodySeekable { + r.SetReaderBody(aws.ReadSeekCloser(r.HTTPRequest.Body)) + } // Reset the request body because dumpRequest will re-wrap the r.HTTPRequest's // Body as a NoOpCloser and will not be reset after read by the HTTP // client reader. diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/logger_test.go b/vendor/github.com/aws/aws-sdk-go/aws/client/logger_test.go index b8d600c9c..f0e06b805 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/logger_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/client/logger_test.go @@ -2,8 +2,17 @@ package client import ( "bytes" + "fmt" "io" + "io/ioutil" + "reflect" "testing" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/client/metadata" + "github.com/aws/aws-sdk-go/aws/corehandlers" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/request" ) type mockCloser struct { @@ -55,3 +64,81 @@ func TestLogWriter(t *testing.T) { t.Errorf("Expected %q, but received %q", expected, lw.buf.String()) } } + +func TestLogRequest(t *testing.T) { + cases := []struct { + Body io.ReadSeeker + ExpectBody []byte + LogLevel aws.LogLevelType + }{ + { + Body: aws.ReadSeekCloser(bytes.NewBuffer([]byte("body content"))), + ExpectBody: []byte("body content"), + }, + { + Body: aws.ReadSeekCloser(bytes.NewBuffer([]byte("body content"))), + LogLevel: aws.LogDebugWithHTTPBody, + ExpectBody: []byte("body content"), + }, + { + Body: bytes.NewReader([]byte("body content")), + ExpectBody: []byte("body content"), + }, + { + Body: bytes.NewReader([]byte("body content")), + LogLevel: aws.LogDebugWithHTTPBody, + ExpectBody: []byte("body content"), + }, + } + + for i, c := range cases { + logW := bytes.NewBuffer(nil) + req := request.New( + aws.Config{ + Credentials: credentials.AnonymousCredentials, + Logger: &bufLogger{w: logW}, + LogLevel: aws.LogLevel(c.LogLevel), + }, + metadata.ClientInfo{ + Endpoint: "https://mock-service.mock-region.amazonaws.com", + }, + testHandlers(), + nil, + &request.Operation{ + Name: "APIName", + HTTPMethod: "POST", + HTTPPath: "/", + }, + struct{}{}, nil, + ) + req.SetReaderBody(c.Body) + req.Build() + + logRequest(req) + + b, err := ioutil.ReadAll(req.HTTPRequest.Body) + if err != nil { + t.Fatalf("%d, expect to read SDK request Body", i) + } + + if e, a := c.ExpectBody, b; !reflect.DeepEqual(e, a) { + t.Errorf("%d, expect %v body, got %v", i, e, a) + } + } +} + +type bufLogger struct { + w *bytes.Buffer +} + +func (l *bufLogger) Log(args ...interface{}) { + fmt.Fprintln(l.w, args...) +} + +func testHandlers() request.Handlers { + var handlers request.Handlers + + handlers.Build.PushBackNamed(corehandlers.SDKVersionUserAgentHandler) + + return handlers +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go index 495e3ef62..bfb1fcd1c 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go @@ -3,7 +3,6 @@ package corehandlers import ( "bytes" "fmt" - "io" "io/ioutil" "net/http" "net/url" @@ -36,18 +35,13 @@ var BuildContentLengthHandler = request.NamedHandler{Name: "core.BuildContentLen if slength := r.HTTPRequest.Header.Get("Content-Length"); slength != "" { length, _ = strconv.ParseInt(slength, 10, 64) } else { - switch body := r.Body.(type) { - case nil: - length = 0 - case lener: - length = int64(body.Len()) - case io.Seeker: - r.BodyStart, _ = body.Seek(0, 1) - end, _ := body.Seek(0, 2) - body.Seek(r.BodyStart, 0) // make sure to seek back to original location - length = end - r.BodyStart - default: - panic("Cannot get length of body, must provide `ContentLength`") + if r.Body != nil { + var err error + length, err = aws.SeekerLen(r.Body) + if err != nil { + r.Error = awserr.New(request.ErrCodeSerialization, "failed to get request body's length", err) + return + } } } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go index 5b4379dbd..ef5f73292 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go @@ -1,5 +1,10 @@ // Package ec2metadata provides the client for making API calls to the // EC2 Metadata service. +// +// This package's client can be disabled completely by setting the environment +// variable "AWS_EC2_METADATA_DISABLED=true". This environment variable set to +// true instructs the SDK to disable the EC2 Metadata client. The client cannot +// be used while the environemnt variable is set to true, (case insensitive). package ec2metadata import ( @@ -7,17 +12,21 @@ import ( "errors" "io" "net/http" + "os" + "strings" "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/client/metadata" + "github.com/aws/aws-sdk-go/aws/corehandlers" "github.com/aws/aws-sdk-go/aws/request" ) // ServiceName is the name of the service. const ServiceName = "ec2metadata" +const disableServiceEnvVar = "AWS_EC2_METADATA_DISABLED" // A EC2Metadata is an EC2 Metadata service Client. type EC2Metadata struct { @@ -75,6 +84,21 @@ func NewClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio svc.Handlers.Validate.Clear() svc.Handlers.Validate.PushBack(validateEndpointHandler) + // Disable the EC2 Metadata service if the environment variable is set. + // This shortcirctes the service's functionality to always fail to send + // requests. + if strings.ToLower(os.Getenv(disableServiceEnvVar)) == "true" { + svc.Handlers.Send.SwapNamed(request.NamedHandler{ + Name: corehandlers.SendHandler.Name, + Fn: func(r *request.Request) { + r.Error = awserr.New( + request.CanceledErrorCode, + "EC2 IMDS access disabled via "+disableServiceEnvVar+" env var", + nil) + }, + }) + } + // Add additional options to the service config for _, option := range opts { option(svc.Client) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service_test.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service_test.go index c2bc21587..6902e0b1e 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service_test.go @@ -3,21 +3,30 @@ package ec2metadata_test import ( "net/http" "net/http/httptest" + "os" + "strings" "sync" "testing" "time" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/ec2metadata" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/awstesting" "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/stretchr/testify/assert" ) func TestClientOverrideDefaultHTTPClientTimeout(t *testing.T) { svc := ec2metadata.New(unit.Session) - assert.NotEqual(t, http.DefaultClient, svc.Config.HTTPClient) - assert.Equal(t, 5*time.Second, svc.Config.HTTPClient.Timeout) + if e, a := http.DefaultClient, svc.Config.HTTPClient; e == a { + t.Errorf("expect %v, not to equal %v", e, a) + } + + if e, a := 5*time.Second, svc.Config.HTTPClient.Timeout; e != a { + t.Errorf("expect %v to be %v", e, a) + } } func TestClientNotOverrideDefaultHTTPClientTimeout(t *testing.T) { @@ -28,18 +37,25 @@ func TestClientNotOverrideDefaultHTTPClientTimeout(t *testing.T) { svc := ec2metadata.New(unit.Session) - assert.Equal(t, http.DefaultClient, svc.Config.HTTPClient) + if e, a := http.DefaultClient, svc.Config.HTTPClient; e != a { + t.Errorf("expect %v, got %v", e, a) + } - tr, ok := svc.Config.HTTPClient.Transport.(*http.Transport) - assert.True(t, ok) - assert.NotNil(t, tr) - assert.Nil(t, tr.Dial) + tr := svc.Config.HTTPClient.Transport.(*http.Transport) + if tr == nil { + t.Fatalf("expect transport not to be nil") + } + if tr.Dial != nil { + t.Errorf("expect dial to be nil, was not") + } } func TestClientDisableOverrideDefaultHTTPClientTimeout(t *testing.T) { svc := ec2metadata.New(unit.Session, aws.NewConfig().WithEC2MetadataDisableTimeoutOverride(true)) - assert.Equal(t, http.DefaultClient, svc.Config.HTTPClient) + if e, a := http.DefaultClient, svc.Config.HTTPClient; e != a { + t.Errorf("expect %v, got %v", e, a) + } } func TestClientOverrideDefaultHTTPClientTimeoutRace(t *testing.T) { @@ -63,6 +79,30 @@ func TestClientOverrideDefaultHTTPClientTimeoutRaceWithTransport(t *testing.T) { runEC2MetadataClients(t, cfg, 100) } +func TestClientDisableIMDS(t *testing.T) { + env := awstesting.StashEnv() + defer awstesting.PopEnv(env) + + os.Setenv("AWS_EC2_METADATA_DISABLED", "true") + + svc := ec2metadata.New(unit.Session) + resp, err := svc.Region() + if err == nil { + t.Fatalf("expect error, got none") + } + if len(resp) != 0 { + t.Errorf("expect no response, got %v", resp) + } + + aerr := err.(awserr.Error) + if e, a := request.CanceledErrorCode, aerr.Code(); e != a { + t.Errorf("expect %v error code, got %v", e, a) + } + if e, a := "AWS_EC2_METADATA_DISABLED", aerr.Message(); !strings.Contains(a, e) { + t.Errorf("expect %v in error message, got %v", e, a) + } +} + func runEC2MetadataClients(t *testing.T, cfg *aws.Config, atOnce int) { var wg sync.WaitGroup wg.Add(atOnce) @@ -70,7 +110,9 @@ func runEC2MetadataClients(t *testing.T, cfg *aws.Config, atOnce int) { go func() { svc := ec2metadata.New(unit.Session, cfg) _, err := svc.Region() - assert.NoError(t, err) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } wg.Done() }() } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode.go index 74f72de07..6dc035a53 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "io" + "os" "github.com/aws/aws-sdk-go/aws/awserr" ) @@ -84,11 +85,34 @@ func decodeV3Endpoints(modelDef modelDefinition, opts DecodeModelOptions) (Resol custAddEC2Metadata(p) custAddS3DualStack(p) custRmIotDataService(p) + + custFixCloudHSMv2SigningName(p) } return ps, nil } +func custFixCloudHSMv2SigningName(p *partition) { + // Workaround for aws/aws-sdk-go#1745 until the endpoint model can be + // fixed upstream. TODO remove this once the endpoints model is updated. + + s, ok := p.Services["cloudhsmv2"] + if !ok { + return + } + + if len(s.Defaults.CredentialScope.Service) != 0 { + fmt.Fprintf(os.Stderr, "cloudhsmv2 signing name already set, ignoring override.\n") + // If the value is already set don't override + return + } + + s.Defaults.CredentialScope.Service = "cloudhsm" + fmt.Fprintf(os.Stderr, "cloudhsmv2 signing name not set, overriding.\n") + + p.Services["cloudhsmv2"] = s +} + func custAddS3DualStack(p *partition) { if p.ID != "aws" { return diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode_test.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode_test.go index 319390721..835b64d23 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode_test.go @@ -115,3 +115,126 @@ func TestDecodeModelOptionsSet(t *testing.T) { t.Errorf("expect %v options got %v", expect, actual) } } + +func TestDecode_CustFixCloudHSMv2SigningName(t *testing.T) { + cases := []struct { + Doc string + Expect string + }{ + { + Doc: ` +{ + "version": 3, + "partitions": [ + { + "defaults": { + "hostname": "{service}.{region}.{dnsSuffix}", + "protocols": [ + "https" + ], + "signatureVersions": [ + "v4" + ] + }, + "dnsSuffix": "amazonaws.com", + "partition": "aws", + "partitionName": "AWS Standard", + "regionRegex": "^(us|eu|ap|sa|ca)\\-\\w+\\-\\d+$", + "regions": { + "ap-northeast-1": { + "description": "Asia Pacific (Tokyo)" + }, + "us-east-1": { + "description": "US East (N. Virginia)" + } + }, + "services": { + "cloudhsmv2": { + "endpoints": { + "us-east-1": {} + } + }, + "s3": { + "endpoints": { + "ap-northeast-1": {} + } + } + } + } + ] +}`, + Expect: "cloudhsm", + }, + { + Doc: ` +{ + "version": 3, + "partitions": [ + { + "defaults": { + "hostname": "{service}.{region}.{dnsSuffix}", + "protocols": [ + "https" + ], + "signatureVersions": [ + "v4" + ] + }, + "dnsSuffix": "amazonaws.com", + "partition": "aws", + "partitionName": "AWS Standard", + "regionRegex": "^(us|eu|ap|sa|ca)\\-\\w+\\-\\d+$", + "regions": { + "ap-northeast-1": { + "description": "Asia Pacific (Tokyo)" + }, + "us-east-1": { + "description": "US East (N. Virginia)" + } + }, + "services": { + "cloudhsmv2": { + "defaults": { + "credentialScope": { + "service": "coolSigningName" + } + }, + "endpoints": { + "us-east-1": {} + } + }, + "s3": { + "endpoints": { + "ap-northeast-1": {} + } + } + } + } + ] +}`, + Expect: "coolSigningName", + }, + } + + for i, c := range cases { + resolver, err := DecodeModel(strings.NewReader(c.Doc)) + if err != nil { + t.Fatalf("%d, expected no error, got %v", i, err) + } + + p := resolver.(partitions)[0] + defaults := p.Services["cloudhsmv2"].Defaults + if e, a := c.Expect, defaults.CredentialScope.Service; e != a { + t.Errorf("%d, expect %v, got %v", i, e, a) + } + + endpoint, err := resolver.EndpointFor("cloudhsmv2", "us-east-1") + if err != nil { + t.Fatalf("%d, failed to resolve endpoint, %v", i, err) + } + + if e, a := c.Expect, endpoint.SigningName; e != a { + t.Errorf("%d, expected %q go %q", i, e, a) + } + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go index 56f08e386..fe931cf7f 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go @@ -52,6 +52,7 @@ const ( Appstream2ServiceID = "appstream2" // Appstream2. AthenaServiceID = "athena" // Athena. AutoscalingServiceID = "autoscaling" // Autoscaling. + AutoscalingPlansServiceID = "autoscaling-plans" // AutoscalingPlans. BatchServiceID = "batch" // Batch. BudgetsServiceID = "budgets" // Budgets. ClouddirectoryServiceID = "clouddirectory" // Clouddirectory. @@ -105,12 +106,16 @@ const ( IotServiceID = "iot" // Iot. KinesisServiceID = "kinesis" // Kinesis. KinesisanalyticsServiceID = "kinesisanalytics" // Kinesisanalytics. + KinesisvideoServiceID = "kinesisvideo" // Kinesisvideo. KmsServiceID = "kms" // Kms. LambdaServiceID = "lambda" // Lambda. LightsailServiceID = "lightsail" // Lightsail. LogsServiceID = "logs" // Logs. MachinelearningServiceID = "machinelearning" // Machinelearning. MarketplacecommerceanalyticsServiceID = "marketplacecommerceanalytics" // Marketplacecommerceanalytics. + MediaconvertServiceID = "mediaconvert" // Mediaconvert. + MedialiveServiceID = "medialive" // Medialive. + MediapackageServiceID = "mediapackage" // Mediapackage. MeteringMarketplaceServiceID = "metering.marketplace" // MeteringMarketplace. MghServiceID = "mgh" // Mgh. MobileanalyticsServiceID = "mobileanalytics" // Mobileanalytics. @@ -131,6 +136,7 @@ const ( S3ServiceID = "s3" // S3. SdbServiceID = "sdb" // Sdb. ServicecatalogServiceID = "servicecatalog" // Servicecatalog. + ServicediscoveryServiceID = "servicediscovery" // Servicediscovery. ShieldServiceID = "shield" // Shield. SmsServiceID = "sms" // Sms. SnowballServiceID = "snowball" // Snowball. @@ -370,6 +376,22 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "autoscaling-plans": service{ + Defaults: endpoint{ + Hostname: "autoscaling.{region}.amazonaws.com", + Protocols: []string{"http", "https"}, + CredentialScope: credentialScope{ + Service: "autoscaling-plans", + }, + }, + Endpoints: endpoints{ + "ap-southeast-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "batch": service{ Endpoints: endpoints{ @@ -402,6 +424,7 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "us-east-1": endpoint{}, @@ -459,7 +482,11 @@ var awsPartition = partition{ }, }, "cloudhsmv2": service{ - + Defaults: endpoint{ + CredentialScope: credentialScope{ + Service: "cloudhsm", + }, + }, Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-south-1": endpoint{}, @@ -577,6 +604,7 @@ var awsPartition = partition{ "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -588,6 +616,7 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, @@ -689,6 +718,8 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, "eu-west-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, @@ -740,6 +771,7 @@ var awsPartition = partition{ "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1043,10 +1075,13 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, + "us-west-1": endpoint{}, "us-west-2": endpoint{}, }, }, @@ -1093,10 +1128,11 @@ var awsPartition = partition{ "glue": service{ Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, + "ap-northeast-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, }, }, "greengrass": service{ @@ -1156,6 +1192,7 @@ var awsPartition = partition{ "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "us-east-1": endpoint{}, + "us-east-2": endpoint{}, "us-west-1": endpoint{}, "us-west-2": endpoint{}, }, @@ -1207,6 +1244,16 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "kinesisvideo": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "kms": service{ Endpoints: endpoints{ @@ -1295,6 +1342,44 @@ var awsPartition = partition{ "us-east-1": endpoint{}, }, }, + "mediaconvert": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "medialive": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "mediapackage": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-3": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "metering.marketplace": service{ Defaults: endpoint{ CredentialScope: credentialScope{ @@ -1489,6 +1574,7 @@ var awsPartition = partition{ Endpoints: endpoints{ "eu-west-1": endpoint{}, "us-east-1": endpoint{}, + "us-east-2": endpoint{}, "us-west-2": endpoint{}, }, }, @@ -1619,6 +1705,15 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "servicediscovery": service{ + + Endpoints: endpoints{ + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "shield": service{ IsRegionalized: boxedFalse, Defaults: endpoint{ @@ -1636,8 +1731,10 @@ var awsPartition = partition{ "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1651,6 +1748,7 @@ var awsPartition = partition{ "ap-northeast-1": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, @@ -1733,7 +1831,9 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, + "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, @@ -1912,6 +2012,8 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "us-east-1": endpoint{}, "us-west-1": endpoint{}, @@ -2233,6 +2335,12 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, + "sms": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + }, + }, "snowball": service{ Endpoints: endpoints{ @@ -2423,6 +2531,18 @@ var awsusgovPartition = partition{ }, }, }, + "ecr": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "ecs": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, "elasticache": service{ Endpoints: endpoints{ @@ -2451,6 +2571,12 @@ var awsusgovPartition = partition{ }, }, }, + "es": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, "events": service{ Endpoints: endpoints{ diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request.go index 5c7db4982..81abcb805 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request.go @@ -224,6 +224,9 @@ func (r *Request) SetContext(ctx aws.Context) { // WillRetry returns if the request's can be retried. func (r *Request) WillRetry() bool { + if !aws.IsReaderSeekable(r.Body) && r.HTTPRequest.Body != NoBody { + return false + } return r.Error != nil && aws.BoolValue(r.Retryable) && r.RetryCount < r.MaxRetries() } @@ -255,6 +258,7 @@ func (r *Request) SetStringBody(s string) { // SetReaderBody will set the request's body reader. func (r *Request) SetReaderBody(reader io.ReadSeeker) { r.Body = reader + r.BodyStart, _ = reader.Seek(0, 1) // Get the Bodies current offset. r.ResetBody() } @@ -393,7 +397,7 @@ func (r *Request) getNextRequestBody() (io.ReadCloser, error) { // of the SDK if they used that field. // // Related golang/go#18257 - l, err := computeBodyLength(r.Body) + l, err := aws.SeekerLen(r.Body) if err != nil { return nil, awserr.New(ErrCodeSerialization, "failed to compute request body size", err) } @@ -411,7 +415,8 @@ func (r *Request) getNextRequestBody() (io.ReadCloser, error) { // Transfer-Encoding: chunked bodies for these methods. // // This would only happen if a aws.ReaderSeekerCloser was used with - // a io.Reader that was not also an io.Seeker. + // a io.Reader that was not also an io.Seeker, or did not implement + // Len() method. switch r.Operation.HTTPMethod { case "GET", "HEAD", "DELETE": body = NoBody @@ -423,42 +428,6 @@ func (r *Request) getNextRequestBody() (io.ReadCloser, error) { return body, nil } -// Attempts to compute the length of the body of the reader using the -// io.Seeker interface. If the value is not seekable because of being -// a ReaderSeekerCloser without an unerlying Seeker -1 will be returned. -// If no error occurs the length of the body will be returned. -func computeBodyLength(r io.ReadSeeker) (int64, error) { - seekable := true - // Determine if the seeker is actually seekable. ReaderSeekerCloser - // hides the fact that a io.Readers might not actually be seekable. - switch v := r.(type) { - case aws.ReaderSeekerCloser: - seekable = v.IsSeeker() - case *aws.ReaderSeekerCloser: - seekable = v.IsSeeker() - } - if !seekable { - return -1, nil - } - - curOffset, err := r.Seek(0, 1) - if err != nil { - return 0, err - } - - endOffset, err := r.Seek(0, 2) - if err != nil { - return 0, err - } - - _, err = r.Seek(curOffset, 0) - if err != nil { - return 0, err - } - - return endOffset - curOffset, nil -} - // GetBody will return an io.ReadSeeker of the Request's underlying // input body with a concurrency safe wrapper. func (r *Request) GetBody() io.ReadSeeker { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go index 59de6736b..159518a75 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination.go @@ -142,13 +142,28 @@ func (r *Request) nextPageTokens() []interface{} { tokens := []interface{}{} tokenAdded := false for _, outToken := range r.Operation.OutputTokens { - v, _ := awsutil.ValuesAtPath(r.Data, outToken) - if len(v) > 0 { - tokens = append(tokens, v[0]) - tokenAdded = true - } else { + vs, _ := awsutil.ValuesAtPath(r.Data, outToken) + if len(vs) == 0 { tokens = append(tokens, nil) + continue } + v := vs[0] + + switch tv := v.(type) { + case *string: + if len(aws.StringValue(tv)) == 0 { + tokens = append(tokens, nil) + continue + } + case string: + if len(tv) == 0 { + tokens = append(tokens, nil) + continue + } + } + + tokenAdded = true + tokens = append(tokens, v) } if !tokenAdded { return nil diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go index 73a95bad8..b942e014f 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_pagination_test.go @@ -454,78 +454,93 @@ func TestPaginationWithContextNilInput(t *testing.T) { } } -type testPageInput struct { - NextToken string -} -type testPageOutput struct { - Value string - NextToken *string -} - func TestPagination_Standalone(t *testing.T) { - expect := []struct { - Value, PrevToken, NextToken string - }{ - {"FirstValue", "InitalToken", "FirstToken"}, - {"SecondValue", "FirstToken", "SecondToken"}, - {"ThirdValue", "SecondToken", ""}, + type testPageInput struct { + NextToken *string } - input := testPageInput{ - NextToken: expect[0].PrevToken, + type testPageOutput struct { + Value *string + NextToken *string + } + type testCase struct { + Value, PrevToken, NextToken *string } - c := awstesting.NewClient() - i := 0 - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - r := c.NewRequest( - &request.Operation{ - Name: "Operation", - Paginator: &request.Paginator{ - InputTokens: []string{"NextToken"}, - OutputTokens: []string{"NextToken"}, - }, - }, - &input, &testPageOutput{}, - ) - // Setup handlers for testing - r.Handlers.Clear() - r.Handlers.Build.PushBack(func(req *request.Request) { - in := req.Params.(*testPageInput) - if e, a := expect[i].PrevToken, in.NextToken; e != a { - t.Errorf("%d, expect NextToken input %q, got %q", i, e, a) - } - }) - r.Handlers.Unmarshal.PushBack(func(req *request.Request) { - out := &testPageOutput{ - Value: expect[i].Value, - } - if len(expect[i].NextToken) > 0 { - out.NextToken = aws.String(expect[i].NextToken) - } - req.Data = out - }) - return r, nil + cases := [][]testCase{ + { + testCase{aws.String("FirstValue"), aws.String("InitalToken"), aws.String("FirstToken")}, + testCase{aws.String("SecondValue"), aws.String("FirstToken"), aws.String("SecondToken")}, + testCase{aws.String("ThirdValue"), aws.String("SecondToken"), nil}, + }, + { + testCase{aws.String("FirstValue"), aws.String("InitalToken"), aws.String("FirstToken")}, + testCase{aws.String("SecondValue"), aws.String("FirstToken"), aws.String("SecondToken")}, + testCase{aws.String("ThirdValue"), aws.String("SecondToken"), aws.String("")}, }, } - for p.Next() { - data := p.Page().(*testPageOutput) - - if e, a := expect[i].Value, data.Value; e != a { - t.Errorf("%d, expect Value to be %q, got %q", i, e, a) - } - if e, a := expect[i].NextToken, aws.StringValue(data.NextToken); e != a { - t.Errorf("%d, expect NextToken to be %q, got %q", i, e, a) + for _, c := range cases { + input := testPageInput{ + NextToken: c[0].PrevToken, } - i++ - } - if e, a := len(expect), i; e != a { - t.Errorf("expected to process %d pages, did %d", e, a) - } - if err := p.Err(); err != nil { - t.Fatalf("%d, expected no error, got %v", i, err) + svc := awstesting.NewClient() + i := 0 + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + r := svc.NewRequest( + &request.Operation{ + Name: "Operation", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + }, + }, + &input, &testPageOutput{}, + ) + // Setup handlers for testing + r.Handlers.Clear() + r.Handlers.Build.PushBack(func(req *request.Request) { + if e, a := len(c), i+1; a > e { + t.Fatalf("expect no more than %d requests, got %d", e, a) + } + in := req.Params.(*testPageInput) + if e, a := aws.StringValue(c[i].PrevToken), aws.StringValue(in.NextToken); e != a { + t.Errorf("%d, expect NextToken input %q, got %q", i, e, a) + } + }) + r.Handlers.Unmarshal.PushBack(func(req *request.Request) { + out := &testPageOutput{ + Value: c[i].Value, + } + if c[i].NextToken != nil { + next := *c[i].NextToken + out.NextToken = aws.String(next) + } + req.Data = out + }) + return r, nil + }, + } + + for p.Next() { + data := p.Page().(*testPageOutput) + + if e, a := aws.StringValue(c[i].Value), aws.StringValue(data.Value); e != a { + t.Errorf("%d, expect Value to be %q, got %q", i, e, a) + } + if e, a := aws.StringValue(c[i].NextToken), aws.StringValue(data.NextToken); e != a { + t.Errorf("%d, expect NextToken to be %q, got %q", i, e, a) + } + + i++ + } + if e, a := len(c), i; e != a { + t.Errorf("expected to process %d pages, did %d", e, a) + } + if err := p.Err(); err != nil { + t.Fatalf("%d, expected no error, got %v", i, err) + } } } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_resetbody_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_resetbody_test.go index 4a9172480..d7845b752 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_resetbody_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_resetbody_test.go @@ -2,6 +2,7 @@ package request import ( "bytes" + "io" "net/http" "strings" "testing" @@ -25,21 +26,70 @@ func TestResetBody_WithBodyContents(t *testing.T) { } } -func TestResetBody_ExcludeUnseekableBodyByMethod(t *testing.T) { +type mockReader struct{} + +func (mockReader) Read([]byte) (int, error) { + return 0, io.EOF +} + +func TestResetBody_ExcludeEmptyUnseekableBodyByMethod(t *testing.T) { cases := []struct { Method string + Body io.ReadSeeker IsNoBody bool }{ - {"GET", true}, - {"HEAD", true}, - {"DELETE", true}, - {"PUT", false}, - {"PATCH", false}, - {"POST", false}, + { + Method: "GET", + IsNoBody: true, + Body: aws.ReadSeekCloser(mockReader{}), + }, + { + Method: "HEAD", + IsNoBody: true, + Body: aws.ReadSeekCloser(mockReader{}), + }, + { + Method: "DELETE", + IsNoBody: true, + Body: aws.ReadSeekCloser(mockReader{}), + }, + { + Method: "PUT", + IsNoBody: false, + Body: aws.ReadSeekCloser(mockReader{}), + }, + { + Method: "PATCH", + IsNoBody: false, + Body: aws.ReadSeekCloser(mockReader{}), + }, + { + Method: "POST", + IsNoBody: false, + Body: aws.ReadSeekCloser(mockReader{}), + }, + { + Method: "GET", + IsNoBody: false, + Body: aws.ReadSeekCloser(bytes.NewBuffer([]byte("abc"))), + }, + { + Method: "GET", + IsNoBody: true, + Body: aws.ReadSeekCloser(bytes.NewBuffer(nil)), + }, + { + Method: "POST", + IsNoBody: false, + Body: aws.ReadSeekCloser(bytes.NewBuffer([]byte("abc"))), + }, + { + Method: "POST", + IsNoBody: true, + Body: aws.ReadSeekCloser(bytes.NewBuffer(nil)), + }, } - reader := aws.ReadSeekCloser(bytes.NewBuffer([]byte("abc"))) - for i, c := range cases { r := Request{ HTTPRequest: &http.Request{}, @@ -47,8 +97,7 @@ func TestResetBody_ExcludeUnseekableBodyByMethod(t *testing.T) { HTTPMethod: c.Method, }, } - - r.SetReaderBody(reader) + r.SetReaderBody(c.Body) if a, e := r.HTTPRequest.Body == NoBody, c.IsNoBody; a != e { t.Errorf("%d, expect body to be set to noBody(%t), but was %t", i, e, a) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go index 151cbf3d4..338331ffd 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go @@ -22,13 +22,13 @@ import ( "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/corehandlers" "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/defaults" "github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/aws/signer/v4" "github.com/aws/aws-sdk-go/awstesting" "github.com/aws/aws-sdk-go/awstesting/unit" "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" "github.com/aws/aws-sdk-go/private/protocol/rest" - "github.com/aws/aws-sdk-go/aws/defaults" ) type testData struct { @@ -893,7 +893,6 @@ func TestRequest_Presign(t *testing.T) { }, SignerFn: func(r *request.Request) { r.HTTPRequest.URL = mustParseURL("https://endpoint/presignedURL") - fmt.Println("url", r.HTTPRequest.URL.String()) if r.NotHoist { r.Error = fmt.Errorf("expect NotHoist to be cleared") } @@ -961,7 +960,7 @@ func TestRequest_Presign(t *testing.T) { } } } - + func TestNew_EndpointWithDefaultPort(t *testing.T) { endpoint := "https://estest.us-east-1.es.amazonaws.com:443" expectedRequestHost := "estest.us-east-1.es.amazonaws.com" @@ -983,7 +982,7 @@ func TestNew_EndpointWithDefaultPort(t *testing.T) { func TestSanitizeHostForHeader(t *testing.T) { cases := []struct { - url string + url string expectedRequestHost string }{ {"https://estest.us-east-1.es.amazonaws.com:443", "estest.us-east-1.es.amazonaws.com"}, @@ -999,6 +998,91 @@ func TestSanitizeHostForHeader(t *testing.T) { if h := r.Host; h != c.expectedRequestHost { t.Errorf("expect %v host, got %q", c.expectedRequestHost, h) - } - } + } + } +} + +func TestRequestWillRetry_ByBody(t *testing.T) { + svc := awstesting.NewClient() + + cases := []struct { + WillRetry bool + HTTPMethod string + Body io.ReadSeeker + IsReqNoBody bool + }{ + { + WillRetry: true, + HTTPMethod: "GET", + Body: bytes.NewReader([]byte{}), + IsReqNoBody: true, + }, + { + WillRetry: true, + HTTPMethod: "GET", + Body: bytes.NewReader(nil), + IsReqNoBody: true, + }, + { + WillRetry: true, + HTTPMethod: "POST", + Body: bytes.NewReader([]byte("abc123")), + }, + { + WillRetry: true, + HTTPMethod: "POST", + Body: aws.ReadSeekCloser(bytes.NewReader([]byte("abc123"))), + }, + { + WillRetry: true, + HTTPMethod: "GET", + Body: aws.ReadSeekCloser(bytes.NewBuffer(nil)), + IsReqNoBody: true, + }, + { + WillRetry: true, + HTTPMethod: "POST", + Body: aws.ReadSeekCloser(bytes.NewBuffer(nil)), + IsReqNoBody: true, + }, + { + WillRetry: false, + HTTPMethod: "POST", + Body: aws.ReadSeekCloser(bytes.NewBuffer([]byte("abc123"))), + }, + } + + for i, c := range cases { + req := svc.NewRequest(&request.Operation{ + Name: "Operation", + HTTPMethod: c.HTTPMethod, + HTTPPath: "/", + }, nil, nil) + req.SetReaderBody(c.Body) + req.Build() + + req.Error = fmt.Errorf("some error") + req.Retryable = aws.Bool(true) + req.HTTPResponse = &http.Response{ + StatusCode: 500, + } + + if e, a := c.IsReqNoBody, request.NoBody == req.HTTPRequest.Body; e != a { + t.Errorf("%d, expect request to be no body, %t, got %t, %T", i, e, a, req.HTTPRequest.Body) + } + + if e, a := c.WillRetry, req.WillRetry(); e != a { + t.Errorf("%d, expect %t willRetry, got %t", i, e, a) + } + + if req.Error == nil { + t.Fatalf("%d, expect error, got none", i) + } + if e, a := "some error", req.Error.Error(); !strings.Contains(a, e) { + t.Errorf("%d, expect %q error in %q", i, e, a) + } + if e, a := 0, req.RetryCount; e != a { + t.Errorf("%d, expect retry count to be %d, got %d", i, e, a) + } + } } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go index f1adcf481..12b452177 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config.go @@ -5,6 +5,7 @@ import ( "strconv" "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/defaults" ) // EnvProviderName provides a name of the provider when config is loaded from environment. @@ -176,6 +177,13 @@ func envConfigLoad(enableSharedConfig bool) envConfig { setFromEnvVal(&cfg.SharedCredentialsFile, sharedCredsFileEnvKey) setFromEnvVal(&cfg.SharedConfigFile, sharedConfigFileEnvKey) + if len(cfg.SharedCredentialsFile) == 0 { + cfg.SharedCredentialsFile = defaults.SharedCredentialsFilename() + } + if len(cfg.SharedConfigFile) == 0 { + cfg.SharedConfigFile = defaults.SharedConfigFilename() + } + cfg.CustomCABundle = os.Getenv("AWS_CA_BUNDLE") return cfg diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config_test.go b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config_test.go index 10e3662a2..3a0b6464d 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/env_config_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/env_config_test.go @@ -7,6 +7,7 @@ import ( "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/awstesting" + "github.com/aws/aws-sdk-go/internal/shareddefaults" ) func TestLoadEnvConfig_Creds(t *testing.T) { @@ -105,6 +106,8 @@ func TestLoadEnvConfig(t *testing.T) { }, Config: envConfig{ Region: "region", Profile: "profile", + SharedCredentialsFile: shareddefaults.SharedCredentialsFilename(), + SharedConfigFile: shareddefaults.SharedConfigFilename(), }, }, { @@ -116,6 +119,8 @@ func TestLoadEnvConfig(t *testing.T) { }, Config: envConfig{ Region: "region", Profile: "profile", + SharedCredentialsFile: shareddefaults.SharedCredentialsFilename(), + SharedConfigFile: shareddefaults.SharedConfigFilename(), }, }, { @@ -128,7 +133,9 @@ func TestLoadEnvConfig(t *testing.T) { }, Config: envConfig{ Region: "region", Profile: "profile", - EnableSharedConfig: true, + EnableSharedConfig: true, + SharedCredentialsFile: shareddefaults.SharedCredentialsFilename(), + SharedConfigFile: shareddefaults.SharedConfigFilename(), }, }, { @@ -136,6 +143,10 @@ func TestLoadEnvConfig(t *testing.T) { "AWS_DEFAULT_REGION": "default_region", "AWS_DEFAULT_PROFILE": "default_profile", }, + Config: envConfig{ + SharedCredentialsFile: shareddefaults.SharedCredentialsFilename(), + SharedConfigFile: shareddefaults.SharedConfigFilename(), + }, }, { Env: map[string]string{ @@ -145,7 +156,9 @@ func TestLoadEnvConfig(t *testing.T) { }, Config: envConfig{ Region: "default_region", Profile: "default_profile", - EnableSharedConfig: true, + EnableSharedConfig: true, + SharedCredentialsFile: shareddefaults.SharedCredentialsFilename(), + SharedConfigFile: shareddefaults.SharedConfigFilename(), }, }, { @@ -155,7 +168,9 @@ func TestLoadEnvConfig(t *testing.T) { }, Config: envConfig{ Region: "region", Profile: "profile", - EnableSharedConfig: true, + EnableSharedConfig: true, + SharedCredentialsFile: shareddefaults.SharedCredentialsFilename(), + SharedConfigFile: shareddefaults.SharedConfigFilename(), }, UseSharedConfigCall: true, }, @@ -168,7 +183,9 @@ func TestLoadEnvConfig(t *testing.T) { }, Config: envConfig{ Region: "region", Profile: "profile", - EnableSharedConfig: true, + EnableSharedConfig: true, + SharedCredentialsFile: shareddefaults.SharedCredentialsFilename(), + SharedConfigFile: shareddefaults.SharedConfigFilename(), }, UseSharedConfigCall: true, }, @@ -182,7 +199,9 @@ func TestLoadEnvConfig(t *testing.T) { }, Config: envConfig{ Region: "region", Profile: "profile", - EnableSharedConfig: true, + EnableSharedConfig: true, + SharedCredentialsFile: shareddefaults.SharedCredentialsFilename(), + SharedConfigFile: shareddefaults.SharedConfigFilename(), }, UseSharedConfigCall: true, }, @@ -193,7 +212,9 @@ func TestLoadEnvConfig(t *testing.T) { }, Config: envConfig{ Region: "default_region", Profile: "default_profile", - EnableSharedConfig: true, + EnableSharedConfig: true, + SharedCredentialsFile: shareddefaults.SharedCredentialsFilename(), + SharedConfigFile: shareddefaults.SharedConfigFilename(), }, UseSharedConfigCall: true, }, @@ -205,7 +226,9 @@ func TestLoadEnvConfig(t *testing.T) { }, Config: envConfig{ Region: "default_region", Profile: "default_profile", - EnableSharedConfig: true, + EnableSharedConfig: true, + SharedCredentialsFile: shareddefaults.SharedCredentialsFilename(), + SharedConfigFile: shareddefaults.SharedConfigFilename(), }, UseSharedConfigCall: true, }, @@ -214,7 +237,9 @@ func TestLoadEnvConfig(t *testing.T) { "AWS_CA_BUNDLE": "custom_ca_bundle", }, Config: envConfig{ - CustomCABundle: "custom_ca_bundle", + CustomCABundle: "custom_ca_bundle", + SharedCredentialsFile: shareddefaults.SharedCredentialsFilename(), + SharedConfigFile: shareddefaults.SharedConfigFilename(), }, }, { @@ -222,8 +247,10 @@ func TestLoadEnvConfig(t *testing.T) { "AWS_CA_BUNDLE": "custom_ca_bundle", }, Config: envConfig{ - CustomCABundle: "custom_ca_bundle", - EnableSharedConfig: true, + CustomCABundle: "custom_ca_bundle", + EnableSharedConfig: true, + SharedCredentialsFile: shareddefaults.SharedCredentialsFilename(), + SharedConfigFile: shareddefaults.SharedConfigFilename(), }, UseSharedConfigCall: true, }, diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go b/vendor/github.com/aws/aws-sdk-go/aws/session/session.go index 9f75d5ac5..2fc789d6d 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/session.go @@ -58,7 +58,12 @@ func New(cfgs ...*aws.Config) *Session { envCfg := loadEnvConfig() if envCfg.EnableSharedConfig { - s, err := newSession(Options{}, envCfg, cfgs...) + var cfg aws.Config + cfg.MergeIn(cfgs...) + s, err := NewSessionWithOptions(Options{ + Config: cfg, + SharedConfigState: SharedConfigEnable, + }) if err != nil { // Old session.New expected all errors to be discovered when // a request is made, and would report the errors then. This @@ -243,13 +248,6 @@ func NewSessionWithOptions(opts Options) (*Session, error) { envCfg.EnableSharedConfig = true } - if len(envCfg.SharedCredentialsFile) == 0 { - envCfg.SharedCredentialsFile = defaults.SharedCredentialsFilename() - } - if len(envCfg.SharedConfigFile) == 0 { - envCfg.SharedConfigFile = defaults.SharedConfigFilename() - } - // Only use AWS_CA_BUNDLE if session option is not provided. if len(envCfg.CustomCABundle) != 0 && opts.CustomCABundle == nil { f, err := os.Open(envCfg.CustomCABundle) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go index ccc88b4ac..4261bbcdf 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go @@ -341,7 +341,9 @@ func (v4 Signer) signWithBody(r *http.Request, body io.ReadSeeker, service, regi ctx.sanitizeHostForHeader() ctx.assignAmzQueryValues() - ctx.build(v4.DisableHeaderHoisting) + if err := ctx.build(v4.DisableHeaderHoisting); err != nil { + return nil, err + } // If the request is not presigned the body should be attached to it. This // prevents the confusion of wanting to send a signed request without @@ -503,11 +505,13 @@ func (v4 *Signer) logSigningInfo(ctx *signingCtx) { v4.Logger.Log(msg) } -func (ctx *signingCtx) build(disableHeaderHoisting bool) { +func (ctx *signingCtx) build(disableHeaderHoisting bool) error { ctx.buildTime() // no depends ctx.buildCredentialString() // no depends - ctx.buildBodyDigest() + if err := ctx.buildBodyDigest(); err != nil { + return err + } unsignedHeaders := ctx.Request.Header if ctx.isPresign { @@ -535,6 +539,8 @@ func (ctx *signingCtx) build(disableHeaderHoisting bool) { } ctx.Request.Header.Set("Authorization", strings.Join(parts, ", ")) } + + return nil } func (ctx *signingCtx) buildTime() { @@ -661,7 +667,7 @@ func (ctx *signingCtx) buildSignature() { ctx.signature = hex.EncodeToString(signature) } -func (ctx *signingCtx) buildBodyDigest() { +func (ctx *signingCtx) buildBodyDigest() error { hash := ctx.Request.Header.Get("X-Amz-Content-Sha256") if hash == "" { if ctx.unsignedPayload || (ctx.isPresign && ctx.ServiceName == "s3") { @@ -669,6 +675,9 @@ func (ctx *signingCtx) buildBodyDigest() { } else if ctx.Body == nil { hash = emptyStringSHA256 } else { + if !aws.IsReaderSeekable(ctx.Body) { + return fmt.Errorf("cannot use unseekable request body %T, for signed request with body", ctx.Body) + } hash = hex.EncodeToString(makeSha256Reader(ctx.Body)) } if ctx.unsignedPayload || ctx.ServiceName == "s3" || ctx.ServiceName == "glacier" { @@ -676,6 +685,8 @@ func (ctx *signingCtx) buildBodyDigest() { } } ctx.bodyDigest = hash + + return nil } // isRequestSigned returns if the request is currently signed or presigned diff --git a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4_test.go b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4_test.go index 45d0eb886..16bc7378a 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4_test.go @@ -7,6 +7,7 @@ import ( "net/http" "net/http/httptest" "reflect" + "strconv" "strings" "testing" "time" @@ -61,17 +62,42 @@ func TestStripExcessHeaders(t *testing.T) { } func buildRequest(serviceName, region, body string) (*http.Request, io.ReadSeeker) { - endpoint := "https://" + serviceName + "." + region + ".amazonaws.com" reader := strings.NewReader(body) - req, _ := http.NewRequest("POST", endpoint, reader) + return buildRequestWithBodyReader(serviceName, region, reader) +} + +func buildRequestWithBodyReader(serviceName, region string, body io.Reader) (*http.Request, io.ReadSeeker) { + var bodyLen int + + type lenner interface { + Len() int + } + if lr, ok := body.(lenner); ok { + bodyLen = lr.Len() + } + + endpoint := "https://" + serviceName + "." + region + ".amazonaws.com" + req, _ := http.NewRequest("POST", endpoint, body) req.URL.Opaque = "//example.org/bucket/key-._~,!@#$%^&*()" - req.Header.Add("X-Amz-Target", "prefix.Operation") - req.Header.Add("Content-Type", "application/x-amz-json-1.0") - req.Header.Add("Content-Length", string(len(body))) - req.Header.Add("X-Amz-Meta-Other-Header", "some-value=!@#$%^&* (+)") + req.Header.Set("X-Amz-Target", "prefix.Operation") + req.Header.Set("Content-Type", "application/x-amz-json-1.0") + + if bodyLen > 0 { + req.Header.Set("Content-Length", strconv.Itoa(bodyLen)) + } + + req.Header.Set("X-Amz-Meta-Other-Header", "some-value=!@#$%^&* (+)") req.Header.Add("X-Amz-Meta-Other-Header_With_Underscore", "some-value=!@#$%^&* (+)") req.Header.Add("X-amz-Meta-Other-Header_With_Underscore", "some-value=!@#$%^&* (+)") - return req, reader + + var seeker io.ReadSeeker + if sr, ok := body.(io.ReadSeeker); ok { + seeker = sr + } else { + seeker = aws.ReadSeekCloser(body) + } + + return req, seeker } func buildSigner() Signer { @@ -101,7 +127,7 @@ func TestPresignRequest(t *testing.T) { expectedDate := "19700101T000000Z" expectedHeaders := "content-length;content-type;host;x-amz-meta-other-header;x-amz-meta-other-header_with_underscore" - expectedSig := "ea7856749041f727690c580569738282e99c79355fe0d8f125d3b5535d2ece83" + expectedSig := "122f0b9e091e4ba84286097e2b3404a1f1f4c4aad479adda95b7dff0ccbe5581" expectedCred := "AKID/19700101/us-east-1/dynamodb/aws4_request" expectedTarget := "prefix.Operation" @@ -135,7 +161,7 @@ func TestPresignBodyWithArrayRequest(t *testing.T) { expectedDate := "19700101T000000Z" expectedHeaders := "content-length;content-type;host;x-amz-meta-other-header;x-amz-meta-other-header_with_underscore" - expectedSig := "fef6002062400bbf526d70f1a6456abc0fb2e213fe1416012737eebd42a62924" + expectedSig := "e3ac55addee8711b76c6d608d762cff285fe8b627a057f8b5ec9268cf82c08b1" expectedCred := "AKID/19700101/us-east-1/dynamodb/aws4_request" expectedTarget := "prefix.Operation" @@ -166,14 +192,14 @@ func TestSignRequest(t *testing.T) { signer.Sign(req, body, "dynamodb", "us-east-1", time.Unix(0, 0)) expectedDate := "19700101T000000Z" - expectedSig := "AWS4-HMAC-SHA256 Credential=AKID/19700101/us-east-1/dynamodb/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-meta-other-header;x-amz-meta-other-header_with_underscore;x-amz-security-token;x-amz-target, Signature=ea766cabd2ec977d955a3c2bae1ae54f4515d70752f2207618396f20aa85bd21" + expectedSig := "AWS4-HMAC-SHA256 Credential=AKID/19700101/us-east-1/dynamodb/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-date;x-amz-meta-other-header;x-amz-meta-other-header_with_underscore;x-amz-security-token;x-amz-target, Signature=a518299330494908a70222cec6899f6f32f297f8595f6df1776d998936652ad9" q := req.Header if e, a := expectedSig, q.Get("Authorization"); e != a { - t.Errorf("expect %v, got %v", e, a) + t.Errorf("expect\n%v\nactual\n%v\n", e, a) } if e, a := expectedDate, q.Get("X-Amz-Date"); e != a { - t.Errorf("expect %v, got %v", e, a) + t.Errorf("expect\n%v\nactual\n%v\n", e, a) } } @@ -207,6 +233,53 @@ func TestPresignEmptyBodyS3(t *testing.T) { } } +func TestSignUnseekableBody(t *testing.T) { + req, body := buildRequestWithBodyReader("mock-service", "mock-region", bytes.NewBuffer([]byte("hello"))) + signer := buildSigner() + _, err := signer.Sign(req, body, "mock-service", "mock-region", time.Now()) + if err == nil { + t.Fatalf("expect error signing request") + } + + if e, a := "unseekable request body", err.Error(); !strings.Contains(a, e) { + t.Errorf("expect %q to be in %q", e, a) + } +} + +func TestSignUnsignedPayloadUnseekableBody(t *testing.T) { + req, body := buildRequestWithBodyReader("mock-service", "mock-region", bytes.NewBuffer([]byte("hello"))) + + signer := buildSigner() + signer.UnsignedPayload = true + + _, err := signer.Sign(req, body, "mock-service", "mock-region", time.Now()) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + hash := req.Header.Get("X-Amz-Content-Sha256") + if e, a := "UNSIGNED-PAYLOAD", hash; e != a { + t.Errorf("expect %v, got %v", e, a) + } +} + +func TestSignPreComputedHashUnseekableBody(t *testing.T) { + req, body := buildRequestWithBodyReader("mock-service", "mock-region", bytes.NewBuffer([]byte("hello"))) + + signer := buildSigner() + + req.Header.Set("X-Amz-Content-Sha256", "some-content-sha256") + _, err := signer.Sign(req, body, "mock-service", "mock-region", time.Now()) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + hash := req.Header.Get("X-Amz-Content-Sha256") + if e, a := "some-content-sha256", hash; e != a { + t.Errorf("expect %v, got %v", e, a) + } +} + func TestSignPrecomputedBodyChecksum(t *testing.T) { req, body := buildRequest("dynamodb", "us-east-1", "hello") req.Header.Set("X-Amz-Content-Sha256", "PRECOMPUTED") diff --git a/vendor/github.com/aws/aws-sdk-go/aws/types.go b/vendor/github.com/aws/aws-sdk-go/aws/types.go index 0e2d864e1..3b4348a17 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/types.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/types.go @@ -22,6 +22,22 @@ type ReaderSeekerCloser struct { r io.Reader } +// IsReaderSeekable returns if the underlying reader type can be seeked. A +// io.Reader might not actually be seekable if it is the ReaderSeekerCloser +// type. +func IsReaderSeekable(r io.Reader) bool { + switch v := r.(type) { + case ReaderSeekerCloser: + return v.IsSeeker() + case *ReaderSeekerCloser: + return v.IsSeeker() + case io.ReadSeeker: + return true + default: + return false + } +} + // Read reads from the reader up to size of p. The number of bytes read, and // error if it occurred will be returned. // @@ -56,6 +72,71 @@ func (r ReaderSeekerCloser) IsSeeker() bool { return ok } +// HasLen returns the length of the underlying reader if the value implements +// the Len() int method. +func (r ReaderSeekerCloser) HasLen() (int, bool) { + type lenner interface { + Len() int + } + + if lr, ok := r.r.(lenner); ok { + return lr.Len(), true + } + + return 0, false +} + +// GetLen returns the length of the bytes remaining in the underlying reader. +// Checks first for Len(), then io.Seeker to determine the size of the +// underlying reader. +// +// Will return -1 if the length cannot be determined. +func (r ReaderSeekerCloser) GetLen() (int64, error) { + if l, ok := r.HasLen(); ok { + return int64(l), nil + } + + if s, ok := r.r.(io.Seeker); ok { + return seekerLen(s) + } + + return -1, nil +} + +// SeekerLen attempts to get the number of bytes remaining at the seeker's +// current position. Returns the number of bytes remaining or error. +func SeekerLen(s io.Seeker) (int64, error) { + // Determine if the seeker is actually seekable. ReaderSeekerCloser + // hides the fact that a io.Readers might not actually be seekable. + switch v := s.(type) { + case ReaderSeekerCloser: + return v.GetLen() + case *ReaderSeekerCloser: + return v.GetLen() + } + + return seekerLen(s) +} + +func seekerLen(s io.Seeker) (int64, error) { + curOffset, err := s.Seek(0, 1) + if err != nil { + return 0, err + } + + endOffset, err := s.Seek(0, 2) + if err != nil { + return 0, err + } + + _, err = s.Seek(curOffset, 0) + if err != nil { + return 0, err + } + + return endOffset - curOffset, nil +} + // Close closes the ReaderSeekerCloser. // // If the ReaderSeekerCloser is not an io.Closer nothing will be done. diff --git a/vendor/github.com/aws/aws-sdk-go/aws/version.go b/vendor/github.com/aws/aws-sdk-go/aws/version.go index 55b3761f2..9e9dbc223 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/version.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/version.go @@ -5,4 +5,4 @@ package aws const SDKName = "aws-sdk-go" // SDKVersion is the version of this SDK -const SDKVersion = "1.12.61" +const SDKVersion = "1.13.4" diff --git a/vendor/github.com/aws/aws-sdk-go/internal/sdkrand/locked_source.go b/vendor/github.com/aws/aws-sdk-go/internal/sdkrand/locked_source.go new file mode 100644 index 000000000..0c9802d87 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/sdkrand/locked_source.go @@ -0,0 +1,29 @@ +package sdkrand + +import ( + "math/rand" + "sync" + "time" +) + +// lockedSource is a thread-safe implementation of rand.Source +type lockedSource struct { + lk sync.Mutex + src rand.Source +} + +func (r *lockedSource) Int63() (n int64) { + r.lk.Lock() + n = r.src.Int63() + r.lk.Unlock() + return +} + +func (r *lockedSource) Seed(seed int64) { + r.lk.Lock() + r.src.Seed(seed) + r.lk.Unlock() +} + +// SeededRand is a new RNG using a thread safe implementation of rand.Source +var SeededRand = rand.New(&lockedSource{src: rand.NewSource(time.Now().UnixNano())}) diff --git a/vendor/github.com/aws/aws-sdk-go/service/route53/api.go b/vendor/github.com/aws/aws-sdk-go/service/route53/api.go index b4e6b0bdf..9e88dd5e4 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/route53/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/route53/api.go @@ -5773,7 +5773,6 @@ func (c *Route53) UpdateTrafficPolicyInstanceWithContext(ctx aws.Context, input // A complex type that contains the type of limit that you specified in the // request and the current value for that limit. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/AccountLimit type AccountLimit struct { _ struct{} `type:"structure"` @@ -5830,7 +5829,6 @@ func (s *AccountLimit) SetValue(v int64) *AccountLimit { // A complex type that identifies the CloudWatch alarm that you want Amazon // Route 53 health checkers to use to determine whether this health check is // healthy. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/AlarmIdentifier type AlarmIdentifier struct { _ struct{} `type:"structure"` @@ -5911,7 +5909,6 @@ func (s *AlarmIdentifier) SetRegion(v string) *AlarmIdentifier { // // * For information about creating failover resource record sets in a private // hosted zone, see Configuring Failover in a Private Hosted Zone (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-private-hosted-zones.html). -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/AliasTarget type AliasTarget struct { _ struct{} `type:"structure"` @@ -6143,7 +6140,6 @@ func (s *AliasTarget) SetHostedZoneId(v string) *AliasTarget { // A complex type that contains information about the request to associate a // VPC with a private hosted zone. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/AssociateVPCWithHostedZoneRequest type AssociateVPCWithHostedZoneInput struct { _ struct{} `locationName:"AssociateVPCWithHostedZoneRequest" type:"structure" xmlURI:"https://route53.amazonaws.com/doc/2013-04-01/"` @@ -6217,7 +6213,6 @@ func (s *AssociateVPCWithHostedZoneInput) SetVPC(v *VPC) *AssociateVPCWithHosted // A complex type that contains the response information for the AssociateVPCWithHostedZone // request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/AssociateVPCWithHostedZoneResponse type AssociateVPCWithHostedZoneOutput struct { _ struct{} `type:"structure"` @@ -6244,7 +6239,6 @@ func (s *AssociateVPCWithHostedZoneOutput) SetChangeInfo(v *ChangeInfo) *Associa } // The information for each resource record set that you want to change. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/Change type Change struct { _ struct{} `type:"structure"` @@ -6318,7 +6312,6 @@ func (s *Change) SetResourceRecordSet(v *ResourceRecordSet) *Change { } // The information for a change request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ChangeBatch type ChangeBatch struct { _ struct{} `type:"structure"` @@ -6381,7 +6374,6 @@ func (s *ChangeBatch) SetComment(v string) *ChangeBatch { // A complex type that describes change information about changes made to your // hosted zone. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ChangeInfo type ChangeInfo struct { _ struct{} `type:"structure"` @@ -6447,7 +6439,6 @@ func (s *ChangeInfo) SetSubmittedAt(v time.Time) *ChangeInfo { } // A complex type that contains change information for the resource record set. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ChangeResourceRecordSetsRequest type ChangeResourceRecordSetsInput struct { _ struct{} `locationName:"ChangeResourceRecordSetsRequest" type:"structure" xmlURI:"https://route53.amazonaws.com/doc/2013-04-01/"` @@ -6507,7 +6498,6 @@ func (s *ChangeResourceRecordSetsInput) SetHostedZoneId(v string) *ChangeResourc } // A complex type containing the response for the request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ChangeResourceRecordSetsResponse type ChangeResourceRecordSetsOutput struct { _ struct{} `type:"structure"` @@ -6539,7 +6529,6 @@ func (s *ChangeResourceRecordSetsOutput) SetChangeInfo(v *ChangeInfo) *ChangeRes // A complex type that contains information about the tags that you want to // add, edit, or delete. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ChangeTagsForResourceRequest type ChangeTagsForResourceInput struct { _ struct{} `locationName:"ChangeTagsForResourceRequest" type:"structure" xmlURI:"https://route53.amazonaws.com/doc/2013-04-01/"` @@ -6626,7 +6615,6 @@ func (s *ChangeTagsForResourceInput) SetResourceType(v string) *ChangeTagsForRes } // Empty response for the request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ChangeTagsForResourceResponse type ChangeTagsForResourceOutput struct { _ struct{} `type:"structure"` } @@ -6643,7 +6631,6 @@ func (s ChangeTagsForResourceOutput) GoString() string { // A complex type that contains information about the CloudWatch alarm that // Amazon Route 53 is monitoring for this health check. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/CloudWatchAlarmConfiguration type CloudWatchAlarmConfiguration struct { _ struct{} `type:"structure"` @@ -6755,7 +6742,6 @@ func (s *CloudWatchAlarmConfiguration) SetThreshold(v float64) *CloudWatchAlarmC } // A complex type that contains the health check request information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/CreateHealthCheckRequest type CreateHealthCheckInput struct { _ struct{} `locationName:"CreateHealthCheckRequest" type:"structure" xmlURI:"https://route53.amazonaws.com/doc/2013-04-01/"` @@ -6836,7 +6822,6 @@ func (s *CreateHealthCheckInput) SetHealthCheckConfig(v *HealthCheckConfig) *Cre } // A complex type containing the response information for the new health check. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/CreateHealthCheckResponse type CreateHealthCheckOutput struct { _ struct{} `type:"structure"` @@ -6875,7 +6860,6 @@ func (s *CreateHealthCheckOutput) SetLocation(v string) *CreateHealthCheckOutput // A complex type that contains information about the request to create a hosted // zone. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/CreateHostedZoneRequest type CreateHostedZoneInput struct { _ struct{} `locationName:"CreateHostedZoneRequest" type:"structure" xmlURI:"https://route53.amazonaws.com/doc/2013-04-01/"` @@ -6992,7 +6976,6 @@ func (s *CreateHostedZoneInput) SetVPC(v *VPC) *CreateHostedZoneInput { } // A complex type containing the response information for the hosted zone. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/CreateHostedZoneResponse type CreateHostedZoneOutput struct { _ struct{} `type:"structure"` @@ -7061,7 +7044,6 @@ func (s *CreateHostedZoneOutput) SetVPC(v *VPC) *CreateHostedZoneOutput { return s } -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/CreateQueryLoggingConfigRequest type CreateQueryLoggingConfigInput struct { _ struct{} `locationName:"CreateQueryLoggingConfigRequest" type:"structure" xmlURI:"https://route53.amazonaws.com/doc/2013-04-01/"` @@ -7123,7 +7105,6 @@ func (s *CreateQueryLoggingConfigInput) SetHostedZoneId(v string) *CreateQueryLo return s } -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/CreateQueryLoggingConfigResponse type CreateQueryLoggingConfigOutput struct { _ struct{} `type:"structure"` @@ -7162,7 +7143,6 @@ func (s *CreateQueryLoggingConfigOutput) SetQueryLoggingConfig(v *QueryLoggingCo return s } -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/CreateReusableDelegationSetRequest type CreateReusableDelegationSetInput struct { _ struct{} `locationName:"CreateReusableDelegationSetRequest" type:"structure" xmlURI:"https://route53.amazonaws.com/doc/2013-04-01/"` @@ -7218,7 +7198,6 @@ func (s *CreateReusableDelegationSetInput) SetHostedZoneId(v string) *CreateReus return s } -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/CreateReusableDelegationSetResponse type CreateReusableDelegationSetOutput struct { _ struct{} `type:"structure"` @@ -7257,7 +7236,6 @@ func (s *CreateReusableDelegationSetOutput) SetLocation(v string) *CreateReusabl // A complex type that contains information about the traffic policy that you // want to create. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/CreateTrafficPolicyRequest type CreateTrafficPolicyInput struct { _ struct{} `locationName:"CreateTrafficPolicyRequest" type:"structure" xmlURI:"https://route53.amazonaws.com/doc/2013-04-01/"` @@ -7322,7 +7300,6 @@ func (s *CreateTrafficPolicyInput) SetName(v string) *CreateTrafficPolicyInput { // A complex type that contains information about the resource record sets that // you want to create based on a specified traffic policy. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/CreateTrafficPolicyInstanceRequest type CreateTrafficPolicyInstanceInput struct { _ struct{} `locationName:"CreateTrafficPolicyInstanceRequest" type:"structure" xmlURI:"https://route53.amazonaws.com/doc/2013-04-01/"` @@ -7431,7 +7408,6 @@ func (s *CreateTrafficPolicyInstanceInput) SetTrafficPolicyVersion(v int64) *Cre // A complex type that contains the response information for the CreateTrafficPolicyInstance // request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/CreateTrafficPolicyInstanceResponse type CreateTrafficPolicyInstanceOutput struct { _ struct{} `type:"structure"` @@ -7470,7 +7446,6 @@ func (s *CreateTrafficPolicyInstanceOutput) SetTrafficPolicyInstance(v *TrafficP // A complex type that contains the response information for the CreateTrafficPolicy // request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/CreateTrafficPolicyResponse type CreateTrafficPolicyOutput struct { _ struct{} `type:"structure"` @@ -7509,7 +7484,6 @@ func (s *CreateTrafficPolicyOutput) SetTrafficPolicy(v *TrafficPolicy) *CreateTr // A complex type that contains information about the traffic policy that you // want to create a new version for. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/CreateTrafficPolicyVersionRequest type CreateTrafficPolicyVersionInput struct { _ struct{} `locationName:"CreateTrafficPolicyVersionRequest" type:"structure" xmlURI:"https://route53.amazonaws.com/doc/2013-04-01/"` @@ -7579,7 +7553,6 @@ func (s *CreateTrafficPolicyVersionInput) SetId(v string) *CreateTrafficPolicyVe // A complex type that contains the response information for the CreateTrafficPolicyVersion // request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/CreateTrafficPolicyVersionResponse type CreateTrafficPolicyVersionOutput struct { _ struct{} `type:"structure"` @@ -7620,7 +7593,6 @@ func (s *CreateTrafficPolicyVersionOutput) SetTrafficPolicy(v *TrafficPolicy) *C // A complex type that contains information about the request to authorize associating // a VPC with your private hosted zone. Authorization is only required when // a private hosted zone and a VPC were created by using different accounts. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/CreateVPCAssociationAuthorizationRequest type CreateVPCAssociationAuthorizationInput struct { _ struct{} `locationName:"CreateVPCAssociationAuthorizationRequest" type:"structure" xmlURI:"https://route53.amazonaws.com/doc/2013-04-01/"` @@ -7682,7 +7654,6 @@ func (s *CreateVPCAssociationAuthorizationInput) SetVPC(v *VPC) *CreateVPCAssoci // A complex type that contains the response information from a CreateVPCAssociationAuthorization // request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/CreateVPCAssociationAuthorizationResponse type CreateVPCAssociationAuthorizationOutput struct { _ struct{} `type:"structure"` @@ -7721,7 +7692,6 @@ func (s *CreateVPCAssociationAuthorizationOutput) SetVPC(v *VPC) *CreateVPCAssoc // A complex type that lists the name servers in a delegation set, as well as // the CallerReference and the ID for the delegation set. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DelegationSet type DelegationSet struct { _ struct{} `type:"structure"` @@ -7768,7 +7738,6 @@ func (s *DelegationSet) SetNameServers(v []*string) *DelegationSet { } // This action deletes a health check. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DeleteHealthCheckRequest type DeleteHealthCheckInput struct { _ struct{} `type:"structure"` @@ -7808,7 +7777,6 @@ func (s *DeleteHealthCheckInput) SetHealthCheckId(v string) *DeleteHealthCheckIn } // An empty element. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DeleteHealthCheckResponse type DeleteHealthCheckOutput struct { _ struct{} `type:"structure"` } @@ -7824,7 +7792,6 @@ func (s DeleteHealthCheckOutput) GoString() string { } // A request to delete a hosted zone. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DeleteHostedZoneRequest type DeleteHostedZoneInput struct { _ struct{} `type:"structure"` @@ -7864,7 +7831,6 @@ func (s *DeleteHostedZoneInput) SetId(v string) *DeleteHostedZoneInput { } // A complex type that contains the response to a DeleteHostedZone request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DeleteHostedZoneResponse type DeleteHostedZoneOutput struct { _ struct{} `type:"structure"` @@ -7891,7 +7857,6 @@ func (s *DeleteHostedZoneOutput) SetChangeInfo(v *ChangeInfo) *DeleteHostedZoneO return s } -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DeleteQueryLoggingConfigRequest type DeleteQueryLoggingConfigInput struct { _ struct{} `type:"structure"` @@ -7933,7 +7898,6 @@ func (s *DeleteQueryLoggingConfigInput) SetId(v string) *DeleteQueryLoggingConfi return s } -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DeleteQueryLoggingConfigResponse type DeleteQueryLoggingConfigOutput struct { _ struct{} `type:"structure"` } @@ -7949,7 +7913,6 @@ func (s DeleteQueryLoggingConfigOutput) GoString() string { } // A request to delete a reusable delegation set. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DeleteReusableDelegationSetRequest type DeleteReusableDelegationSetInput struct { _ struct{} `type:"structure"` @@ -7989,7 +7952,6 @@ func (s *DeleteReusableDelegationSetInput) SetId(v string) *DeleteReusableDelega } // An empty element. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DeleteReusableDelegationSetResponse type DeleteReusableDelegationSetOutput struct { _ struct{} `type:"structure"` } @@ -8005,7 +7967,6 @@ func (s DeleteReusableDelegationSetOutput) GoString() string { } // A request to delete a specified traffic policy version. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DeleteTrafficPolicyRequest type DeleteTrafficPolicyInput struct { _ struct{} `type:"structure"` @@ -8065,7 +8026,6 @@ func (s *DeleteTrafficPolicyInput) SetVersion(v int64) *DeleteTrafficPolicyInput } // A request to delete a specified traffic policy instance. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DeleteTrafficPolicyInstanceRequest type DeleteTrafficPolicyInstanceInput struct { _ struct{} `type:"structure"` @@ -8112,7 +8072,6 @@ func (s *DeleteTrafficPolicyInstanceInput) SetId(v string) *DeleteTrafficPolicyI } // An empty element. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DeleteTrafficPolicyInstanceResponse type DeleteTrafficPolicyInstanceOutput struct { _ struct{} `type:"structure"` } @@ -8128,7 +8087,6 @@ func (s DeleteTrafficPolicyInstanceOutput) GoString() string { } // An empty element. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DeleteTrafficPolicyResponse type DeleteTrafficPolicyOutput struct { _ struct{} `type:"structure"` } @@ -8146,7 +8104,6 @@ func (s DeleteTrafficPolicyOutput) GoString() string { // A complex type that contains information about the request to remove authorization // to associate a VPC that was created by one AWS account with a hosted zone // that was created with a different AWS account. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DeleteVPCAssociationAuthorizationRequest type DeleteVPCAssociationAuthorizationInput struct { _ struct{} `locationName:"DeleteVPCAssociationAuthorizationRequest" type:"structure" xmlURI:"https://route53.amazonaws.com/doc/2013-04-01/"` @@ -8209,7 +8166,6 @@ func (s *DeleteVPCAssociationAuthorizationInput) SetVPC(v *VPC) *DeleteVPCAssoci } // Empty response for the request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DeleteVPCAssociationAuthorizationResponse type DeleteVPCAssociationAuthorizationOutput struct { _ struct{} `type:"structure"` } @@ -8226,7 +8182,6 @@ func (s DeleteVPCAssociationAuthorizationOutput) GoString() string { // For the metric that the CloudWatch alarm is associated with, a complex type // that contains information about one dimension. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/Dimension type Dimension struct { _ struct{} `type:"structure"` @@ -8267,7 +8222,6 @@ func (s *Dimension) SetValue(v string) *Dimension { // A complex type that contains information about the VPC that you want to disassociate // from a specified private hosted zone. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DisassociateVPCFromHostedZoneRequest type DisassociateVPCFromHostedZoneInput struct { _ struct{} `locationName:"DisassociateVPCFromHostedZoneRequest" type:"structure" xmlURI:"https://route53.amazonaws.com/doc/2013-04-01/"` @@ -8337,7 +8291,6 @@ func (s *DisassociateVPCFromHostedZoneInput) SetVPC(v *VPC) *DisassociateVPCFrom // A complex type that contains the response information for the disassociate // request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DisassociateVPCFromHostedZoneResponse type DisassociateVPCFromHostedZoneOutput struct { _ struct{} `type:"structure"` @@ -8365,7 +8318,6 @@ func (s *DisassociateVPCFromHostedZoneOutput) SetChangeInfo(v *ChangeInfo) *Disa } // A complex type that contains information about a geo location. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GeoLocation type GeoLocation struct { _ struct{} `type:"structure"` @@ -8434,7 +8386,6 @@ func (s *GeoLocation) SetSubdivisionCode(v string) *GeoLocation { // A complex type that contains the codes and full continent, country, and subdivision // names for the specified geolocation code. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GeoLocationDetails type GeoLocationDetails struct { _ struct{} `type:"structure"` @@ -8507,7 +8458,6 @@ func (s *GeoLocationDetails) SetSubdivisionName(v string) *GeoLocationDetails { // A complex type that contains information about the request to create a hosted // zone. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetAccountLimitRequest type GetAccountLimitInput struct { _ struct{} `type:"structure"` @@ -8564,7 +8514,6 @@ func (s *GetAccountLimitInput) SetType(v string) *GetAccountLimitInput { } // A complex type that contains the requested limit. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetAccountLimitResponse type GetAccountLimitOutput struct { _ struct{} `type:"structure"` @@ -8608,7 +8557,6 @@ func (s *GetAccountLimitOutput) SetLimit(v *AccountLimit) *GetAccountLimitOutput } // The input for a GetChange request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetChangeRequest type GetChangeInput struct { _ struct{} `type:"structure"` @@ -8650,7 +8598,6 @@ func (s *GetChangeInput) SetId(v string) *GetChangeInput { } // A complex type that contains the ChangeInfo element. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetChangeResponse type GetChangeOutput struct { _ struct{} `type:"structure"` @@ -8676,7 +8623,6 @@ func (s *GetChangeOutput) SetChangeInfo(v *ChangeInfo) *GetChangeOutput { return s } -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetCheckerIpRangesRequest type GetCheckerIpRangesInput struct { _ struct{} `type:"structure"` } @@ -8691,7 +8637,6 @@ func (s GetCheckerIpRangesInput) GoString() string { return s.String() } -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetCheckerIpRangesResponse type GetCheckerIpRangesOutput struct { _ struct{} `type:"structure"` @@ -8717,7 +8662,6 @@ func (s *GetCheckerIpRangesOutput) SetCheckerIpRanges(v []*string) *GetCheckerIp // A request for information about whether a specified geographic location is // supported for Amazon Route 53 geolocation resource record sets. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetGeoLocationRequest type GetGeoLocationInput struct { _ struct{} `type:"structure"` @@ -8798,7 +8742,6 @@ func (s *GetGeoLocationInput) SetSubdivisionCode(v string) *GetGeoLocationInput // A complex type that contains the response information for the specified geolocation // code. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetGeoLocationResponse type GetGeoLocationOutput struct { _ struct{} `type:"structure"` @@ -8827,7 +8770,6 @@ func (s *GetGeoLocationOutput) SetGeoLocationDetails(v *GeoLocationDetails) *Get // A request for the number of health checks that are associated with the current // AWS account. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetHealthCheckCountRequest type GetHealthCheckCountInput struct { _ struct{} `type:"structure"` } @@ -8843,7 +8785,6 @@ func (s GetHealthCheckCountInput) GoString() string { } // A complex type that contains the response to a GetHealthCheckCount request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetHealthCheckCountResponse type GetHealthCheckCountOutput struct { _ struct{} `type:"structure"` @@ -8870,7 +8811,6 @@ func (s *GetHealthCheckCountOutput) SetHealthCheckCount(v int64) *GetHealthCheck } // A request to get information about a specified health check. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetHealthCheckRequest type GetHealthCheckInput struct { _ struct{} `type:"structure"` @@ -8913,7 +8853,6 @@ func (s *GetHealthCheckInput) SetHealthCheckId(v string) *GetHealthCheckInput { } // A request for the reason that a health check failed most recently. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetHealthCheckLastFailureReasonRequest type GetHealthCheckLastFailureReasonInput struct { _ struct{} `type:"structure"` @@ -8960,7 +8899,6 @@ func (s *GetHealthCheckLastFailureReasonInput) SetHealthCheckId(v string) *GetHe // A complex type that contains the response to a GetHealthCheckLastFailureReason // request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetHealthCheckLastFailureReasonResponse type GetHealthCheckLastFailureReasonOutput struct { _ struct{} `type:"structure"` @@ -8988,7 +8926,6 @@ func (s *GetHealthCheckLastFailureReasonOutput) SetHealthCheckObservations(v []* } // A complex type that contains the response to a GetHealthCheck request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetHealthCheckResponse type GetHealthCheckOutput struct { _ struct{} `type:"structure"` @@ -9016,7 +8953,6 @@ func (s *GetHealthCheckOutput) SetHealthCheck(v *HealthCheck) *GetHealthCheckOut } // A request to get the status for a health check. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetHealthCheckStatusRequest type GetHealthCheckStatusInput struct { _ struct{} `type:"structure"` @@ -9062,7 +8998,6 @@ func (s *GetHealthCheckStatusInput) SetHealthCheckId(v string) *GetHealthCheckSt } // A complex type that contains the response to a GetHealthCheck request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetHealthCheckStatusResponse type GetHealthCheckStatusOutput struct { _ struct{} `type:"structure"` @@ -9091,7 +9026,6 @@ func (s *GetHealthCheckStatusOutput) SetHealthCheckObservations(v []*HealthCheck // A request to retrieve a count of all the hosted zones that are associated // with the current AWS account. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetHostedZoneCountRequest type GetHostedZoneCountInput struct { _ struct{} `type:"structure"` } @@ -9107,7 +9041,6 @@ func (s GetHostedZoneCountInput) GoString() string { } // A complex type that contains the response to a GetHostedZoneCount request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetHostedZoneCountResponse type GetHostedZoneCountOutput struct { _ struct{} `type:"structure"` @@ -9135,7 +9068,6 @@ func (s *GetHostedZoneCountOutput) SetHostedZoneCount(v int64) *GetHostedZoneCou } // A request to get information about a specified hosted zone. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetHostedZoneRequest type GetHostedZoneInput struct { _ struct{} `type:"structure"` @@ -9176,7 +9108,6 @@ func (s *GetHostedZoneInput) SetId(v string) *GetHostedZoneInput { // A complex type that contains information about the request to create a hosted // zone. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetHostedZoneLimitRequest type GetHostedZoneLimitInput struct { _ struct{} `type:"structure"` @@ -9236,7 +9167,6 @@ func (s *GetHostedZoneLimitInput) SetType(v string) *GetHostedZoneLimitInput { } // A complex type that contains the requested limit. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetHostedZoneLimitResponse type GetHostedZoneLimitOutput struct { _ struct{} `type:"structure"` @@ -9280,7 +9210,6 @@ func (s *GetHostedZoneLimitOutput) SetLimit(v *HostedZoneLimit) *GetHostedZoneLi } // A complex type that contain the response to a GetHostedZone request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetHostedZoneResponse type GetHostedZoneOutput struct { _ struct{} `type:"structure"` @@ -9327,7 +9256,6 @@ func (s *GetHostedZoneOutput) SetVPCs(v []*VPC) *GetHostedZoneOutput { return s } -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetQueryLoggingConfigRequest type GetQueryLoggingConfigInput struct { _ struct{} `type:"structure"` @@ -9370,7 +9298,6 @@ func (s *GetQueryLoggingConfigInput) SetId(v string) *GetQueryLoggingConfigInput return s } -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetQueryLoggingConfigResponse type GetQueryLoggingConfigOutput struct { _ struct{} `type:"structure"` @@ -9398,7 +9325,6 @@ func (s *GetQueryLoggingConfigOutput) SetQueryLoggingConfig(v *QueryLoggingConfi } // A request to get information about a specified reusable delegation set. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetReusableDelegationSetRequest type GetReusableDelegationSetInput struct { _ struct{} `type:"structure"` @@ -9440,7 +9366,6 @@ func (s *GetReusableDelegationSetInput) SetId(v string) *GetReusableDelegationSe // A complex type that contains information about the request to create a hosted // zone. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetReusableDelegationSetLimitRequest type GetReusableDelegationSetLimitInput struct { _ struct{} `type:"structure"` @@ -9496,7 +9421,6 @@ func (s *GetReusableDelegationSetLimitInput) SetType(v string) *GetReusableDeleg } // A complex type that contains the requested limit. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetReusableDelegationSetLimitResponse type GetReusableDelegationSetLimitOutput struct { _ struct{} `type:"structure"` @@ -9537,7 +9461,6 @@ func (s *GetReusableDelegationSetLimitOutput) SetLimit(v *ReusableDelegationSetL // A complex type that contains the response to the GetReusableDelegationSet // request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetReusableDelegationSetResponse type GetReusableDelegationSetOutput struct { _ struct{} `type:"structure"` @@ -9564,7 +9487,6 @@ func (s *GetReusableDelegationSetOutput) SetDelegationSet(v *DelegationSet) *Get } // Gets information about a specific traffic policy version. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetTrafficPolicyRequest type GetTrafficPolicyInput struct { _ struct{} `type:"structure"` @@ -9626,7 +9548,6 @@ func (s *GetTrafficPolicyInput) SetVersion(v int64) *GetTrafficPolicyInput { // Request to get the number of traffic policy instances that are associated // with the current AWS account. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetTrafficPolicyInstanceCountRequest type GetTrafficPolicyInstanceCountInput struct { _ struct{} `type:"structure"` } @@ -9643,7 +9564,6 @@ func (s GetTrafficPolicyInstanceCountInput) GoString() string { // A complex type that contains information about the resource record sets that // Amazon Route 53 created based on a specified traffic policy. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetTrafficPolicyInstanceCountResponse type GetTrafficPolicyInstanceCountOutput struct { _ struct{} `type:"structure"` @@ -9671,7 +9591,6 @@ func (s *GetTrafficPolicyInstanceCountOutput) SetTrafficPolicyInstanceCount(v in } // Gets information about a specified traffic policy instance. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetTrafficPolicyInstanceRequest type GetTrafficPolicyInstanceInput struct { _ struct{} `type:"structure"` @@ -9715,7 +9634,6 @@ func (s *GetTrafficPolicyInstanceInput) SetId(v string) *GetTrafficPolicyInstanc // A complex type that contains information about the resource record sets that // Amazon Route 53 created based on a specified traffic policy. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetTrafficPolicyInstanceResponse type GetTrafficPolicyInstanceOutput struct { _ struct{} `type:"structure"` @@ -9742,7 +9660,6 @@ func (s *GetTrafficPolicyInstanceOutput) SetTrafficPolicyInstance(v *TrafficPoli } // A complex type that contains the response information for the request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/GetTrafficPolicyResponse type GetTrafficPolicyOutput struct { _ struct{} `type:"structure"` @@ -9770,7 +9687,6 @@ func (s *GetTrafficPolicyOutput) SetTrafficPolicy(v *TrafficPolicy) *GetTrafficP // A complex type that contains information about one health check that is associated // with the current AWS account. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/HealthCheck type HealthCheck struct { _ struct{} `type:"structure"` @@ -9856,7 +9772,6 @@ func (s *HealthCheck) SetLinkedService(v *LinkedService) *HealthCheck { } // A complex type that contains information about the health check. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/HealthCheckConfig type HealthCheckConfig struct { _ struct{} `type:"structure"` @@ -10268,7 +10183,6 @@ func (s *HealthCheckConfig) SetType(v string) *HealthCheckConfig { // A complex type that contains the last failure reason as reported by one Amazon // Route 53 health checker. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/HealthCheckObservation type HealthCheckObservation struct { _ struct{} `type:"structure"` @@ -10314,7 +10228,6 @@ func (s *HealthCheckObservation) SetStatusReport(v *StatusReport) *HealthCheckOb } // A complex type that contains general information about the hosted zone. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/HostedZone type HostedZone struct { _ struct{} `type:"structure"` @@ -10402,7 +10315,6 @@ func (s *HostedZone) SetResourceRecordSetCount(v int64) *HostedZone { // A complex type that contains an optional comment about your hosted zone. // If you don't want to specify a comment, omit both the HostedZoneConfig and // Comment elements. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/HostedZoneConfig type HostedZoneConfig struct { _ struct{} `type:"structure"` @@ -10437,7 +10349,6 @@ func (s *HostedZoneConfig) SetPrivateZone(v bool) *HostedZoneConfig { // A complex type that contains the type of limit that you specified in the // request and the current value for that limit. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/HostedZoneLimit type HostedZoneLimit struct { _ struct{} `type:"structure"` @@ -10484,7 +10395,6 @@ func (s *HostedZoneLimit) SetValue(v int64) *HostedZoneLimit { // is a complex type that describes the service that created the resource. When // a resource is created by another service, you can't edit or delete it using // Amazon Route 53. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/LinkedService type LinkedService struct { _ struct{} `type:"structure"` @@ -10524,7 +10434,6 @@ func (s *LinkedService) SetServicePrincipal(v string) *LinkedService { // A request to get a list of geographic locations that Amazon Route 53 supports // for geolocation resource record sets. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListGeoLocationsRequest type ListGeoLocationsInput struct { _ struct{} `type:"structure"` @@ -10619,7 +10528,6 @@ func (s *ListGeoLocationsInput) SetStartSubdivisionCode(v string) *ListGeoLocati } // A complex type containing the response information for the request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListGeoLocationsResponse type ListGeoLocationsOutput struct { _ struct{} `type:"structure"` @@ -10707,7 +10615,6 @@ func (s *ListGeoLocationsOutput) SetNextSubdivisionCode(v string) *ListGeoLocati // A request to retrieve a list of the health checks that are associated with // the current AWS account. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListHealthChecksRequest type ListHealthChecksInput struct { _ struct{} `type:"structure"` @@ -10752,7 +10659,6 @@ func (s *ListHealthChecksInput) SetMaxItems(v string) *ListHealthChecksInput { } // A complex type that contains the response to a ListHealthChecks request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListHealthChecksResponse type ListHealthChecksOutput struct { _ struct{} `type:"structure"` @@ -10830,7 +10736,6 @@ func (s *ListHealthChecksOutput) SetNextMarker(v string) *ListHealthChecksOutput // Retrieves a list of the public and private hosted zones that are associated // with the current AWS account in ASCII order by domain name. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListHostedZonesByNameRequest type ListHostedZonesByNameInput struct { _ struct{} `type:"structure"` @@ -10890,7 +10795,6 @@ func (s *ListHostedZonesByNameInput) SetMaxItems(v string) *ListHostedZonesByNam } // A complex type that contains the response information for the request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListHostedZonesByNameResponse type ListHostedZonesByNameOutput struct { _ struct{} `type:"structure"` @@ -10994,7 +10898,6 @@ func (s *ListHostedZonesByNameOutput) SetNextHostedZoneId(v string) *ListHostedZ // A request to retrieve a list of the public and private hosted zones that // are associated with the current AWS account. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListHostedZonesRequest type ListHostedZonesInput struct { _ struct{} `type:"structure"` @@ -11050,7 +10953,6 @@ func (s *ListHostedZonesInput) SetMaxItems(v string) *ListHostedZonesInput { return s } -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListHostedZonesResponse type ListHostedZonesOutput struct { _ struct{} `type:"structure"` @@ -11128,7 +11030,6 @@ func (s *ListHostedZonesOutput) SetNextMarker(v string) *ListHostedZonesOutput { return s } -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListQueryLoggingConfigsRequest type ListQueryLoggingConfigsInput struct { _ struct{} `type:"structure"` @@ -11186,7 +11087,6 @@ func (s *ListQueryLoggingConfigsInput) SetNextToken(v string) *ListQueryLoggingC return s } -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListQueryLoggingConfigsResponse type ListQueryLoggingConfigsOutput struct { _ struct{} `type:"structure"` @@ -11231,7 +11131,6 @@ func (s *ListQueryLoggingConfigsOutput) SetQueryLoggingConfigs(v []*QueryLogging // A request for the resource record sets that are associated with a specified // hosted zone. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListResourceRecordSetsRequest type ListResourceRecordSetsInput struct { _ struct{} `type:"structure"` @@ -11342,7 +11241,6 @@ func (s *ListResourceRecordSetsInput) SetStartRecordType(v string) *ListResource } // A complex type that contains list information for the resource record set. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListResourceRecordSetsResponse type ListResourceRecordSetsOutput struct { _ struct{} `type:"structure"` @@ -11427,7 +11325,6 @@ func (s *ListResourceRecordSetsOutput) SetResourceRecordSets(v []*ResourceRecord // A request to get a list of the reusable delegation sets that are associated // with the current AWS account. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListReusableDelegationSetsRequest type ListReusableDelegationSetsInput struct { _ struct{} `type:"structure"` @@ -11473,7 +11370,6 @@ func (s *ListReusableDelegationSetsInput) SetMaxItems(v string) *ListReusableDel // A complex type that contains information about the reusable delegation sets // that are associated with the current AWS account. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListReusableDelegationSetsResponse type ListReusableDelegationSetsOutput struct { _ struct{} `type:"structure"` @@ -11550,7 +11446,6 @@ func (s *ListReusableDelegationSetsOutput) SetNextMarker(v string) *ListReusable // A complex type containing information about a request for a list of the tags // that are associated with an individual resource. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTagsForResourceRequest type ListTagsForResourceInput struct { _ struct{} `type:"structure"` @@ -11609,7 +11504,6 @@ func (s *ListTagsForResourceInput) SetResourceType(v string) *ListTagsForResourc // A complex type that contains information about the health checks or hosted // zones for which you want to list tags. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTagsForResourceResponse type ListTagsForResourceOutput struct { _ struct{} `type:"structure"` @@ -11637,7 +11531,6 @@ func (s *ListTagsForResourceOutput) SetResourceTagSet(v *ResourceTagSet) *ListTa // A complex type that contains information about the health checks or hosted // zones for which you want to list tags. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTagsForResourcesRequest type ListTagsForResourcesInput struct { _ struct{} `locationName:"ListTagsForResourcesRequest" type:"structure" xmlURI:"https://route53.amazonaws.com/doc/2013-04-01/"` @@ -11699,7 +11592,6 @@ func (s *ListTagsForResourcesInput) SetResourceType(v string) *ListTagsForResour } // A complex type containing tags for the specified resources. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTagsForResourcesResponse type ListTagsForResourcesOutput struct { _ struct{} `type:"structure"` @@ -11727,7 +11619,6 @@ func (s *ListTagsForResourcesOutput) SetResourceTagSets(v []*ResourceTagSet) *Li // A complex type that contains the information about the request to list the // traffic policies that are associated with the current AWS account. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTrafficPoliciesRequest type ListTrafficPoliciesInput struct { _ struct{} `type:"structure"` @@ -11785,7 +11676,6 @@ func (s *ListTrafficPoliciesInput) SetTrafficPolicyIdMarker(v string) *ListTraff } // A complex type that contains the response information for the request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTrafficPoliciesResponse type ListTrafficPoliciesOutput struct { _ struct{} `type:"structure"` @@ -11852,7 +11742,6 @@ func (s *ListTrafficPoliciesOutput) SetTrafficPolicySummaries(v []*TrafficPolicy // A request for the traffic policy instances that you created in a specified // hosted zone. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTrafficPolicyInstancesByHostedZoneRequest type ListTrafficPolicyInstancesByHostedZoneInput struct { _ struct{} `type:"structure"` @@ -11941,7 +11830,6 @@ func (s *ListTrafficPolicyInstancesByHostedZoneInput) SetTrafficPolicyInstanceTy } // A complex type that contains the response information for the request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTrafficPolicyInstancesByHostedZoneResponse type ListTrafficPolicyInstancesByHostedZoneOutput struct { _ struct{} `type:"structure"` @@ -12018,7 +11906,6 @@ func (s *ListTrafficPolicyInstancesByHostedZoneOutput) SetTrafficPolicyInstances // A complex type that contains the information about the request to list your // traffic policy instances. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTrafficPolicyInstancesByPolicyRequest type ListTrafficPolicyInstancesByPolicyInput struct { _ struct{} `type:"structure"` @@ -12148,7 +12035,6 @@ func (s *ListTrafficPolicyInstancesByPolicyInput) SetTrafficPolicyVersion(v int6 } // A complex type that contains the response information for the request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTrafficPolicyInstancesByPolicyResponse type ListTrafficPolicyInstancesByPolicyOutput struct { _ struct{} `type:"structure"` @@ -12237,7 +12123,6 @@ func (s *ListTrafficPolicyInstancesByPolicyOutput) SetTrafficPolicyInstances(v [ // A request to get information about the traffic policy instances that you // created by using the current AWS account. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTrafficPolicyInstancesRequest type ListTrafficPolicyInstancesInput struct { _ struct{} `type:"structure"` @@ -12318,7 +12203,6 @@ func (s *ListTrafficPolicyInstancesInput) SetTrafficPolicyInstanceTypeMarker(v s } // A complex type that contains the response information for the request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTrafficPolicyInstancesResponse type ListTrafficPolicyInstancesOutput struct { _ struct{} `type:"structure"` @@ -12408,7 +12292,6 @@ func (s *ListTrafficPolicyInstancesOutput) SetTrafficPolicyInstances(v []*Traffi // A complex type that contains the information about the request to list your // traffic policies. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTrafficPolicyVersionsRequest type ListTrafficPolicyVersionsInput struct { _ struct{} `type:"structure"` @@ -12482,7 +12365,6 @@ func (s *ListTrafficPolicyVersionsInput) SetTrafficPolicyVersionMarker(v string) } // A complex type that contains the response information for the request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListTrafficPolicyVersionsResponse type ListTrafficPolicyVersionsOutput struct { _ struct{} `type:"structure"` @@ -12553,7 +12435,6 @@ func (s *ListTrafficPolicyVersionsOutput) SetTrafficPolicyVersionMarker(v string // A complex type that contains information about that can be associated with // your hosted zone. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListVPCAssociationAuthorizationsRequest type ListVPCAssociationAuthorizationsInput struct { _ struct{} `type:"structure"` @@ -12618,7 +12499,6 @@ func (s *ListVPCAssociationAuthorizationsInput) SetNextToken(v string) *ListVPCA } // A complex type that contains the response information for the request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ListVPCAssociationAuthorizationsResponse type ListVPCAssociationAuthorizationsOutput struct { _ struct{} `type:"structure"` @@ -12671,7 +12551,6 @@ func (s *ListVPCAssociationAuthorizationsOutput) SetVPCs(v []*VPC) *ListVPCAssoc // A complex type that contains information about a configuration for DNS query // logging. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/QueryLoggingConfig type QueryLoggingConfig struct { _ struct{} `type:"structure"` @@ -12723,7 +12602,6 @@ func (s *QueryLoggingConfig) SetId(v string) *QueryLoggingConfig { // Information specific to the resource record. // // If you're creating an alias resource record set, omit ResourceRecord. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ResourceRecord type ResourceRecord struct { _ struct{} `type:"structure"` @@ -12772,7 +12650,6 @@ func (s *ResourceRecord) SetValue(v string) *ResourceRecord { } // Information about the resource record set to create or delete. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ResourceRecordSet type ResourceRecordSet struct { _ struct{} `type:"structure"` @@ -13304,7 +13181,6 @@ func (s *ResourceRecordSet) SetWeight(v int64) *ResourceRecordSet { } // A complex type containing a resource and its associated tags. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ResourceTagSet type ResourceTagSet struct { _ struct{} `type:"structure"` @@ -13352,7 +13228,6 @@ func (s *ResourceTagSet) SetTags(v []*Tag) *ResourceTagSet { // A complex type that contains the type of limit that you specified in the // request and the current value for that limit. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ReusableDelegationSetLimit type ReusableDelegationSetLimit struct { _ struct{} `type:"structure"` @@ -13393,7 +13268,6 @@ func (s *ReusableDelegationSetLimit) SetValue(v int64) *ReusableDelegationSetLim // A complex type that contains the status that one Amazon Route 53 health checker // reports and the time of the health check. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/StatusReport type StatusReport struct { _ struct{} `type:"structure"` @@ -13432,7 +13306,6 @@ func (s *StatusReport) SetStatus(v string) *StatusReport { // A complex type that contains information about a tag that you want to add // or edit for the specified health check or hosted zone. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/Tag type Tag struct { _ struct{} `type:"structure"` @@ -13485,7 +13358,6 @@ func (s *Tag) SetValue(v string) *Tag { // Gets the value that Amazon Route 53 returns in response to a DNS request // for a specified record name and type. You can optionally specify the IP address // of a DNS resolver, an EDNS0 client subnet IP address, and a subnet mask. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/TestDNSAnswerRequest type TestDNSAnswerInput struct { _ struct{} `type:"structure"` @@ -13592,7 +13464,6 @@ func (s *TestDNSAnswerInput) SetResolverIP(v string) *TestDNSAnswerInput { } // A complex type that contains the response to a TestDNSAnswer request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/TestDNSAnswerResponse type TestDNSAnswerOutput struct { _ struct{} `type:"structure"` @@ -13680,7 +13551,6 @@ func (s *TestDNSAnswerOutput) SetResponseCode(v string) *TestDNSAnswerOutput { } // A complex type that contains settings for a traffic policy. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/TrafficPolicy type TrafficPolicy struct { _ struct{} `type:"structure"` @@ -13765,7 +13635,6 @@ func (s *TrafficPolicy) SetVersion(v int64) *TrafficPolicy { } // A complex type that contains settings for the new traffic policy instance. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/TrafficPolicyInstance type TrafficPolicyInstance struct { _ struct{} `type:"structure"` @@ -13899,7 +13768,6 @@ func (s *TrafficPolicyInstance) SetTrafficPolicyVersion(v int64) *TrafficPolicyI // A complex type that contains information about the latest version of one // traffic policy that is associated with the current AWS account. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/TrafficPolicySummary type TrafficPolicySummary struct { _ struct{} `type:"structure"` @@ -13973,7 +13841,6 @@ func (s *TrafficPolicySummary) SetType(v string) *TrafficPolicySummary { // A complex type that contains information about a request to update a health // check. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/UpdateHealthCheckRequest type UpdateHealthCheckInput struct { _ struct{} `locationName:"UpdateHealthCheckRequest" type:"structure" xmlURI:"https://route53.amazonaws.com/doc/2013-04-01/"` @@ -14362,7 +14229,6 @@ func (s *UpdateHealthCheckInput) SetSearchString(v string) *UpdateHealthCheckInp return s } -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/UpdateHealthCheckResponse type UpdateHealthCheckOutput struct { _ struct{} `type:"structure"` @@ -14390,7 +14256,6 @@ func (s *UpdateHealthCheckOutput) SetHealthCheck(v *HealthCheck) *UpdateHealthCh } // A request to update the comment for a hosted zone. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/UpdateHostedZoneCommentRequest type UpdateHostedZoneCommentInput struct { _ struct{} `locationName:"UpdateHostedZoneCommentRequest" type:"structure" xmlURI:"https://route53.amazonaws.com/doc/2013-04-01/"` @@ -14441,7 +14306,6 @@ func (s *UpdateHostedZoneCommentInput) SetId(v string) *UpdateHostedZoneCommentI // A complex type that contains the response to the UpdateHostedZoneComment // request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/UpdateHostedZoneCommentResponse type UpdateHostedZoneCommentOutput struct { _ struct{} `type:"structure"` @@ -14469,7 +14333,6 @@ func (s *UpdateHostedZoneCommentOutput) SetHostedZone(v *HostedZone) *UpdateHost // A complex type that contains information about the traffic policy that you // want to update the comment for. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/UpdateTrafficPolicyCommentRequest type UpdateTrafficPolicyCommentInput struct { _ struct{} `locationName:"UpdateTrafficPolicyCommentRequest" type:"structure" xmlURI:"https://route53.amazonaws.com/doc/2013-04-01/"` @@ -14545,7 +14408,6 @@ func (s *UpdateTrafficPolicyCommentInput) SetVersion(v int64) *UpdateTrafficPoli } // A complex type that contains the response information for the traffic policy. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/UpdateTrafficPolicyCommentResponse type UpdateTrafficPolicyCommentOutput struct { _ struct{} `type:"structure"` @@ -14573,7 +14435,6 @@ func (s *UpdateTrafficPolicyCommentOutput) SetTrafficPolicy(v *TrafficPolicy) *U // A complex type that contains information about the resource record sets that // you want to update based on a specified traffic policy instance. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/UpdateTrafficPolicyInstanceRequest type UpdateTrafficPolicyInstanceInput struct { _ struct{} `locationName:"UpdateTrafficPolicyInstanceRequest" type:"structure" xmlURI:"https://route53.amazonaws.com/doc/2013-04-01/"` @@ -14668,7 +14529,6 @@ func (s *UpdateTrafficPolicyInstanceInput) SetTrafficPolicyVersion(v int64) *Upd // A complex type that contains information about the resource record sets that // Amazon Route 53 created based on a specified traffic policy. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/UpdateTrafficPolicyInstanceResponse type UpdateTrafficPolicyInstanceOutput struct { _ struct{} `type:"structure"` @@ -14696,7 +14556,6 @@ func (s *UpdateTrafficPolicyInstanceOutput) SetTrafficPolicyInstance(v *TrafficP // (Private hosted zones only) A complex type that contains information about // an Amazon VPC. -// See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/VPC type VPC struct { _ struct{} `type:"structure"` @@ -14821,6 +14680,9 @@ const ( // CloudWatchRegionApNortheast2 is a CloudWatchRegion enum value CloudWatchRegionApNortheast2 = "ap-northeast-2" + // CloudWatchRegionApNortheast3 is a CloudWatchRegion enum value + CloudWatchRegionApNortheast3 = "ap-northeast-3" + // CloudWatchRegionSaEast1 is a CloudWatchRegion enum value CloudWatchRegionSaEast1 = "sa-east-1" ) @@ -15090,6 +14952,9 @@ const ( // VPCRegionApNortheast2 is a VPCRegion enum value VPCRegionApNortheast2 = "ap-northeast-2" + // VPCRegionApNortheast3 is a VPCRegion enum value + VPCRegionApNortheast3 = "ap-northeast-3" + // VPCRegionSaEast1 is a VPCRegion enum value VPCRegionSaEast1 = "sa-east-1" diff --git a/vendor/github.com/aws/aws-sdk-go/service/route53/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/route53/examples_test.go index 0f2a9c156..06111c42c 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/route53/examples_test.go +++ b/vendor/github.com/aws/aws-sdk-go/service/route53/examples_test.go @@ -83,6 +83,16 @@ func ExampleRoute53_ChangeResourceRecordSets_shared00() { Changes: []*route53.Change{ { Action: aws.String("CREATE"), + ResourceRecordSet: &route53.ResourceRecordSet{ + Name: aws.String("example.com"), + ResourceRecords: []*route53.ResourceRecord{ + { + Value: aws.String("192.0.2.44"), + }, + }, + TTL: aws.Int64(60), + Type: aws.String("A"), + }, }, }, Comment: aws.String("Web server for example.com"), @@ -130,9 +140,35 @@ func ExampleRoute53_ChangeResourceRecordSets_shared01() { Changes: []*route53.Change{ { Action: aws.String("CREATE"), + ResourceRecordSet: &route53.ResourceRecordSet{ + HealthCheckId: aws.String("abcdef11-2222-3333-4444-555555fedcba"), + Name: aws.String("example.com"), + ResourceRecords: []*route53.ResourceRecord{ + { + Value: aws.String("192.0.2.44"), + }, + }, + SetIdentifier: aws.String("Seattle data center"), + TTL: aws.Int64(60), + Type: aws.String("A"), + Weight: aws.Int64(100), + }, }, { Action: aws.String("CREATE"), + ResourceRecordSet: &route53.ResourceRecordSet{ + HealthCheckId: aws.String("abcdef66-7777-8888-9999-000000fedcba"), + Name: aws.String("example.com"), + ResourceRecords: []*route53.ResourceRecord{ + { + Value: aws.String("192.0.2.45"), + }, + }, + SetIdentifier: aws.String("Portland data center"), + TTL: aws.Int64(60), + Type: aws.String("A"), + Weight: aws.Int64(200), + }, }, }, Comment: aws.String("Web servers for example.com"), @@ -179,6 +215,15 @@ func ExampleRoute53_ChangeResourceRecordSets_shared02() { Changes: []*route53.Change{ { Action: aws.String("CREATE"), + ResourceRecordSet: &route53.ResourceRecordSet{ + AliasTarget: &route53.AliasTarget{ + DNSName: aws.String("d123rk29d0stfj.cloudfront.net"), + EvaluateTargetHealth: aws.Bool(false), + HostedZoneId: aws.String("Z2FDTNDATAQYW2"), + }, + Name: aws.String("example.com"), + Type: aws.String("A"), + }, }, }, Comment: aws.String("CloudFront distribution for example.com"), @@ -227,9 +272,31 @@ func ExampleRoute53_ChangeResourceRecordSets_shared03() { Changes: []*route53.Change{ { Action: aws.String("CREATE"), + ResourceRecordSet: &route53.ResourceRecordSet{ + AliasTarget: &route53.AliasTarget{ + DNSName: aws.String("example-com-123456789.us-east-2.elb.amazonaws.com "), + EvaluateTargetHealth: aws.Bool(true), + HostedZoneId: aws.String("Z3AADJGX6KTTL2"), + }, + Name: aws.String("example.com"), + SetIdentifier: aws.String("Ohio region"), + Type: aws.String("A"), + Weight: aws.Int64(100), + }, }, { Action: aws.String("CREATE"), + ResourceRecordSet: &route53.ResourceRecordSet{ + AliasTarget: &route53.AliasTarget{ + DNSName: aws.String("example-com-987654321.us-west-2.elb.amazonaws.com "), + EvaluateTargetHealth: aws.Bool(true), + HostedZoneId: aws.String("Z1H1FL5HABSF5"), + }, + Name: aws.String("example.com"), + SetIdentifier: aws.String("Oregon region"), + Type: aws.String("A"), + Weight: aws.Int64(200), + }, }, }, Comment: aws.String("ELB load balancers for example.com"), @@ -277,9 +344,35 @@ func ExampleRoute53_ChangeResourceRecordSets_shared04() { Changes: []*route53.Change{ { Action: aws.String("CREATE"), + ResourceRecordSet: &route53.ResourceRecordSet{ + HealthCheckId: aws.String("abcdef11-2222-3333-4444-555555fedcba"), + Name: aws.String("example.com"), + Region: aws.String("us-east-2"), + ResourceRecords: []*route53.ResourceRecord{ + { + Value: aws.String("192.0.2.44"), + }, + }, + SetIdentifier: aws.String("Ohio region"), + TTL: aws.Int64(60), + Type: aws.String("A"), + }, }, { Action: aws.String("CREATE"), + ResourceRecordSet: &route53.ResourceRecordSet{ + HealthCheckId: aws.String("abcdef66-7777-8888-9999-000000fedcba"), + Name: aws.String("example.com"), + Region: aws.String("us-west-2"), + ResourceRecords: []*route53.ResourceRecord{ + { + Value: aws.String("192.0.2.45"), + }, + }, + SetIdentifier: aws.String("Oregon region"), + TTL: aws.Int64(60), + Type: aws.String("A"), + }, }, }, Comment: aws.String("EC2 instances for example.com"), @@ -327,9 +420,31 @@ func ExampleRoute53_ChangeResourceRecordSets_shared05() { Changes: []*route53.Change{ { Action: aws.String("CREATE"), + ResourceRecordSet: &route53.ResourceRecordSet{ + AliasTarget: &route53.AliasTarget{ + DNSName: aws.String("example-com-123456789.us-east-2.elb.amazonaws.com "), + EvaluateTargetHealth: aws.Bool(true), + HostedZoneId: aws.String("Z3AADJGX6KTTL2"), + }, + Name: aws.String("example.com"), + Region: aws.String("us-east-2"), + SetIdentifier: aws.String("Ohio region"), + Type: aws.String("A"), + }, }, { Action: aws.String("CREATE"), + ResourceRecordSet: &route53.ResourceRecordSet{ + AliasTarget: &route53.AliasTarget{ + DNSName: aws.String("example-com-987654321.us-west-2.elb.amazonaws.com "), + EvaluateTargetHealth: aws.Bool(true), + HostedZoneId: aws.String("Z1H1FL5HABSF5"), + }, + Name: aws.String("example.com"), + Region: aws.String("us-west-2"), + SetIdentifier: aws.String("Oregon region"), + Type: aws.String("A"), + }, }, }, Comment: aws.String("ELB load balancers for example.com"), @@ -378,9 +493,35 @@ func ExampleRoute53_ChangeResourceRecordSets_shared06() { Changes: []*route53.Change{ { Action: aws.String("CREATE"), + ResourceRecordSet: &route53.ResourceRecordSet{ + Failover: aws.String("PRIMARY"), + HealthCheckId: aws.String("abcdef11-2222-3333-4444-555555fedcba"), + Name: aws.String("example.com"), + ResourceRecords: []*route53.ResourceRecord{ + { + Value: aws.String("192.0.2.44"), + }, + }, + SetIdentifier: aws.String("Ohio region"), + TTL: aws.Int64(60), + Type: aws.String("A"), + }, }, { Action: aws.String("CREATE"), + ResourceRecordSet: &route53.ResourceRecordSet{ + Failover: aws.String("SECONDARY"), + HealthCheckId: aws.String("abcdef66-7777-8888-9999-000000fedcba"), + Name: aws.String("example.com"), + ResourceRecords: []*route53.ResourceRecord{ + { + Value: aws.String("192.0.2.45"), + }, + }, + SetIdentifier: aws.String("Oregon region"), + TTL: aws.Int64(60), + Type: aws.String("A"), + }, }, }, Comment: aws.String("Failover configuration for example.com"), @@ -429,9 +570,31 @@ func ExampleRoute53_ChangeResourceRecordSets_shared07() { Changes: []*route53.Change{ { Action: aws.String("CREATE"), + ResourceRecordSet: &route53.ResourceRecordSet{ + AliasTarget: &route53.AliasTarget{ + DNSName: aws.String("example-com-123456789.us-east-2.elb.amazonaws.com "), + EvaluateTargetHealth: aws.Bool(true), + HostedZoneId: aws.String("Z3AADJGX6KTTL2"), + }, + Failover: aws.String("PRIMARY"), + Name: aws.String("example.com"), + SetIdentifier: aws.String("Ohio region"), + Type: aws.String("A"), + }, }, { Action: aws.String("CREATE"), + ResourceRecordSet: &route53.ResourceRecordSet{ + AliasTarget: &route53.AliasTarget{ + DNSName: aws.String("example-com-987654321.us-west-2.elb.amazonaws.com "), + EvaluateTargetHealth: aws.Bool(true), + HostedZoneId: aws.String("Z1H1FL5HABSF5"), + }, + Failover: aws.String("SECONDARY"), + Name: aws.String("example.com"), + SetIdentifier: aws.String("Oregon region"), + Type: aws.String("A"), + }, }, }, Comment: aws.String("Failover alias configuration for example.com"), @@ -480,15 +643,71 @@ func ExampleRoute53_ChangeResourceRecordSets_shared08() { Changes: []*route53.Change{ { Action: aws.String("CREATE"), + ResourceRecordSet: &route53.ResourceRecordSet{ + GeoLocation: &route53.GeoLocation{ + ContinentCode: aws.String("NA"), + }, + Name: aws.String("example.com"), + ResourceRecords: []*route53.ResourceRecord{ + { + Value: aws.String("192.0.2.44"), + }, + }, + SetIdentifier: aws.String("North America"), + TTL: aws.Int64(60), + Type: aws.String("A"), + }, }, { Action: aws.String("CREATE"), + ResourceRecordSet: &route53.ResourceRecordSet{ + GeoLocation: &route53.GeoLocation{ + ContinentCode: aws.String("SA"), + }, + Name: aws.String("example.com"), + ResourceRecords: []*route53.ResourceRecord{ + { + Value: aws.String("192.0.2.45"), + }, + }, + SetIdentifier: aws.String("South America"), + TTL: aws.Int64(60), + Type: aws.String("A"), + }, }, { Action: aws.String("CREATE"), + ResourceRecordSet: &route53.ResourceRecordSet{ + GeoLocation: &route53.GeoLocation{ + ContinentCode: aws.String("EU"), + }, + Name: aws.String("example.com"), + ResourceRecords: []*route53.ResourceRecord{ + { + Value: aws.String("192.0.2.46"), + }, + }, + SetIdentifier: aws.String("Europe"), + TTL: aws.Int64(60), + Type: aws.String("A"), + }, }, { Action: aws.String("CREATE"), + ResourceRecordSet: &route53.ResourceRecordSet{ + GeoLocation: &route53.GeoLocation{ + CountryCode: aws.String("*"), + }, + Name: aws.String("example.com"), + ResourceRecords: []*route53.ResourceRecord{ + { + Value: aws.String("192.0.2.47"), + }, + }, + SetIdentifier: aws.String("Other locations"), + TTL: aws.Int64(60), + Type: aws.String("A"), + }, }, }, Comment: aws.String("Geolocation configuration for example.com"), @@ -537,15 +756,67 @@ func ExampleRoute53_ChangeResourceRecordSets_shared09() { Changes: []*route53.Change{ { Action: aws.String("CREATE"), + ResourceRecordSet: &route53.ResourceRecordSet{ + AliasTarget: &route53.AliasTarget{ + DNSName: aws.String("example-com-123456789.us-east-2.elb.amazonaws.com "), + EvaluateTargetHealth: aws.Bool(true), + HostedZoneId: aws.String("Z3AADJGX6KTTL2"), + }, + GeoLocation: &route53.GeoLocation{ + ContinentCode: aws.String("NA"), + }, + Name: aws.String("example.com"), + SetIdentifier: aws.String("North America"), + Type: aws.String("A"), + }, }, { Action: aws.String("CREATE"), + ResourceRecordSet: &route53.ResourceRecordSet{ + AliasTarget: &route53.AliasTarget{ + DNSName: aws.String("example-com-234567890.sa-east-1.elb.amazonaws.com "), + EvaluateTargetHealth: aws.Bool(true), + HostedZoneId: aws.String("Z2P70J7HTTTPLU"), + }, + GeoLocation: &route53.GeoLocation{ + ContinentCode: aws.String("SA"), + }, + Name: aws.String("example.com"), + SetIdentifier: aws.String("South America"), + Type: aws.String("A"), + }, }, { Action: aws.String("CREATE"), + ResourceRecordSet: &route53.ResourceRecordSet{ + AliasTarget: &route53.AliasTarget{ + DNSName: aws.String("example-com-234567890.eu-central-1.elb.amazonaws.com "), + EvaluateTargetHealth: aws.Bool(true), + HostedZoneId: aws.String("Z215JYRZR1TBD5"), + }, + GeoLocation: &route53.GeoLocation{ + ContinentCode: aws.String("EU"), + }, + Name: aws.String("example.com"), + SetIdentifier: aws.String("Europe"), + Type: aws.String("A"), + }, }, { Action: aws.String("CREATE"), + ResourceRecordSet: &route53.ResourceRecordSet{ + AliasTarget: &route53.AliasTarget{ + DNSName: aws.String("example-com-234567890.ap-southeast-1.elb.amazonaws.com "), + EvaluateTargetHealth: aws.Bool(true), + HostedZoneId: aws.String("Z1LMS91P8CMLE5"), + }, + GeoLocation: &route53.GeoLocation{ + CountryCode: aws.String("*"), + }, + Name: aws.String("example.com"), + SetIdentifier: aws.String("Other locations"), + Type: aws.String("A"), + }, }, }, Comment: aws.String("Geolocation alias configuration for example.com"), diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/api.go b/vendor/github.com/aws/aws-sdk-go/service/sts/api.go index 23f0a06db..22a0a1285 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/sts/api.go @@ -1049,7 +1049,6 @@ func (c *STS) GetSessionTokenWithContext(ctx aws.Context, input *GetSessionToken return out, req.Send() } -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleRequest type AssumeRoleInput struct { _ struct{} `type:"structure"` @@ -1241,7 +1240,6 @@ func (s *AssumeRoleInput) SetTokenCode(v string) *AssumeRoleInput { // Contains the response to a successful AssumeRole request, including temporary // AWS credentials that can be used to make AWS requests. -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleResponse type AssumeRoleOutput struct { _ struct{} `type:"structure"` @@ -1295,7 +1293,6 @@ func (s *AssumeRoleOutput) SetPackedPolicySize(v int64) *AssumeRoleOutput { return s } -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithSAMLRequest type AssumeRoleWithSAMLInput struct { _ struct{} `type:"structure"` @@ -1436,7 +1433,6 @@ func (s *AssumeRoleWithSAMLInput) SetSAMLAssertion(v string) *AssumeRoleWithSAML // Contains the response to a successful AssumeRoleWithSAML request, including // temporary AWS credentials that can be used to make AWS requests. -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithSAMLResponse type AssumeRoleWithSAMLOutput struct { _ struct{} `type:"structure"` @@ -1548,7 +1544,6 @@ func (s *AssumeRoleWithSAMLOutput) SetSubjectType(v string) *AssumeRoleWithSAMLO return s } -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithWebIdentityRequest type AssumeRoleWithWebIdentityInput struct { _ struct{} `type:"structure"` @@ -1711,7 +1706,6 @@ func (s *AssumeRoleWithWebIdentityInput) SetWebIdentityToken(v string) *AssumeRo // Contains the response to a successful AssumeRoleWithWebIdentity request, // including temporary AWS credentials that can be used to make AWS requests. -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithWebIdentityResponse type AssumeRoleWithWebIdentityOutput struct { _ struct{} `type:"structure"` @@ -1804,7 +1798,6 @@ func (s *AssumeRoleWithWebIdentityOutput) SetSubjectFromWebIdentityToken(v strin // The identifiers for the temporary security credentials that the operation // returns. -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumedRoleUser type AssumedRoleUser struct { _ struct{} `type:"structure"` @@ -1847,7 +1840,6 @@ func (s *AssumedRoleUser) SetAssumedRoleId(v string) *AssumedRoleUser { } // AWS credentials for API authentication. -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/Credentials type Credentials struct { _ struct{} `type:"structure"` @@ -1906,7 +1898,6 @@ func (s *Credentials) SetSessionToken(v string) *Credentials { return s } -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/DecodeAuthorizationMessageRequest type DecodeAuthorizationMessageInput struct { _ struct{} `type:"structure"` @@ -1951,7 +1942,6 @@ func (s *DecodeAuthorizationMessageInput) SetEncodedMessage(v string) *DecodeAut // A document that contains additional information about the authorization status // of a request from an encoded message that is returned in response to an AWS // request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/DecodeAuthorizationMessageResponse type DecodeAuthorizationMessageOutput struct { _ struct{} `type:"structure"` @@ -1976,7 +1966,6 @@ func (s *DecodeAuthorizationMessageOutput) SetDecodedMessage(v string) *DecodeAu } // Identifiers for the federated user that is associated with the credentials. -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/FederatedUser type FederatedUser struct { _ struct{} `type:"structure"` @@ -2017,7 +2006,6 @@ func (s *FederatedUser) SetFederatedUserId(v string) *FederatedUser { return s } -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetCallerIdentityRequest type GetCallerIdentityInput struct { _ struct{} `type:"structure"` } @@ -2034,7 +2022,6 @@ func (s GetCallerIdentityInput) GoString() string { // Contains the response to a successful GetCallerIdentity request, including // information about the entity making the request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetCallerIdentityResponse type GetCallerIdentityOutput struct { _ struct{} `type:"structure"` @@ -2080,7 +2067,6 @@ func (s *GetCallerIdentityOutput) SetUserId(v string) *GetCallerIdentityOutput { return s } -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetFederationTokenRequest type GetFederationTokenInput struct { _ struct{} `type:"structure"` @@ -2189,7 +2175,6 @@ func (s *GetFederationTokenInput) SetPolicy(v string) *GetFederationTokenInput { // Contains the response to a successful GetFederationToken request, including // temporary AWS credentials that can be used to make AWS requests. -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetFederationTokenResponse type GetFederationTokenOutput struct { _ struct{} `type:"structure"` @@ -2242,7 +2227,6 @@ func (s *GetFederationTokenOutput) SetPackedPolicySize(v int64) *GetFederationTo return s } -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetSessionTokenRequest type GetSessionTokenInput struct { _ struct{} `type:"structure"` @@ -2327,7 +2311,6 @@ func (s *GetSessionTokenInput) SetTokenCode(v string) *GetSessionTokenInput { // Contains the response to a successful GetSessionToken request, including // temporary AWS credentials that can be used to make AWS requests. -// See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetSessionTokenResponse type GetSessionTokenOutput struct { _ struct{} `type:"structure"` diff --git a/vendor/github.com/coreos/etcd/.gitignore b/vendor/github.com/coreos/etcd/.gitignore index 1a68387a7..8abb0c8e2 100644 --- a/vendor/github.com/coreos/etcd/.gitignore +++ b/vendor/github.com/coreos/etcd/.gitignore @@ -7,7 +7,6 @@ /release /machine* /bin -.Dockerfile-test .vagrant *.etcd *.log @@ -15,8 +14,6 @@ *.swp /hack/insta-discovery/.env *.test -tools/functional-tester/docker/bin -hack/scripts-dev/docker-dns/.Dockerfile -hack/scripts-dev/docker-dns-srv/.Dockerfile hack/tls-setup/certs .idea +*.bak \ No newline at end of file diff --git a/vendor/github.com/coreos/etcd/.semaphore.sh b/vendor/github.com/coreos/etcd/.semaphore.sh index 1a6c85a62..51d66e884 100755 --- a/vendor/github.com/coreos/etcd/.semaphore.sh +++ b/vendor/github.com/coreos/etcd/.semaphore.sh @@ -2,7 +2,7 @@ TEST_SUFFIX=$(date +%s | base64 | head -c 15) -TEST_OPTS="RELEASE_TEST=y INTEGRATION=y PASSES='build unit release integration_e2e functional' MANUAL_VER=v3.2.11" +TEST_OPTS="RELEASE_TEST=y INTEGRATION=y PASSES='build unit release integration_e2e functional' MANUAL_VER=v3.3.0" if [ "$TEST_ARCH" == "386" ]; then TEST_OPTS="GOARCH=386 PASSES='build unit integration_e2e'" fi @@ -10,7 +10,7 @@ fi docker run \ --rm \ --volume=`pwd`:/go/src/github.com/coreos/etcd \ - gcr.io/etcd-development/etcd-test:go1.8.5 \ + gcr.io/etcd-development/etcd-test:go1.9.4 \ /bin/bash -c "${TEST_OPTS} ./test 2>&1 | tee test-${TEST_SUFFIX}.log" ! egrep "(--- FAIL:|panic: test timed out|appears to have leaked)" -B50 -A10 test-${TEST_SUFFIX}.log diff --git a/vendor/github.com/coreos/etcd/.travis.yml b/vendor/github.com/coreos/etcd/.travis.yml index 00f2b8102..ca37df151 100644 --- a/vendor/github.com/coreos/etcd/.travis.yml +++ b/vendor/github.com/coreos/etcd/.travis.yml @@ -6,7 +6,7 @@ sudo: required services: docker go: -- 1.8.5 +- 1.9.4 - tip notifications: @@ -30,7 +30,7 @@ matrix: - go: tip env: TARGET=amd64-go-tip exclude: - - go: 1.8.5 + - go: 1.9.4 env: TARGET=amd64-go-tip - go: tip env: TARGET=amd64 @@ -48,17 +48,18 @@ matrix: env: TARGET=ppc64le before_install: -- docker pull gcr.io/etcd-development/etcd-test:go1.8.5 +- if [[ $TRAVIS_GO_VERSION == 1.* ]]; then docker pull gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION}; fi install: - pushd cmd/etcd && go get -t -v ./... && popd script: + - echo "TRAVIS_GO_VERSION=${TRAVIS_GO_VERSION}" - > case "${TARGET}" in amd64) docker run --rm \ - --volume=`pwd`:/go/src/github.com/coreos/etcd gcr.io/etcd-development/etcd-test:go1.8.5 \ + --volume=`pwd`:/go/src/github.com/coreos/etcd gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION} \ /bin/bash -c "GOARCH=amd64 ./test" ;; amd64-go-tip) @@ -66,23 +67,23 @@ script: ;; darwin-amd64) docker run --rm \ - --volume=`pwd`:/go/src/github.com/coreos/etcd gcr.io/etcd-development/etcd-test:go1.8.5 \ + --volume=`pwd`:/go/src/github.com/coreos/etcd gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION} \ /bin/bash -c "GO_BUILD_FLAGS='-a -v' GOOS=darwin GOARCH=amd64 ./build" ;; windows-amd64) docker run --rm \ - --volume=`pwd`:/go/src/github.com/coreos/etcd gcr.io/etcd-development/etcd-test:go1.8.5 \ + --volume=`pwd`:/go/src/github.com/coreos/etcd gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION} \ /bin/bash -c "GO_BUILD_FLAGS='-a -v' GOOS=windows GOARCH=amd64 ./build" ;; 386) docker run --rm \ - --volume=`pwd`:/go/src/github.com/coreos/etcd gcr.io/etcd-development/etcd-test:go1.8.5 \ + --volume=`pwd`:/go/src/github.com/coreos/etcd gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION} \ /bin/bash -c "GOARCH=386 PASSES='build unit' ./test" ;; *) # test building out of gopath docker run --rm \ - --volume=`pwd`:/go/src/github.com/coreos/etcd gcr.io/etcd-development/etcd-test:go1.8.5 \ + --volume=`pwd`:/go/src/github.com/coreos/etcd gcr.io/etcd-development/etcd-test:go${TRAVIS_GO_VERSION} \ /bin/bash -c "GO_BUILD_FLAGS='-a -v' GOARCH='${TARGET}' ./build" ;; esac diff --git a/vendor/github.com/coreos/etcd/.words b/vendor/github.com/coreos/etcd/.words new file mode 100644 index 000000000..31fffef38 --- /dev/null +++ b/vendor/github.com/coreos/etcd/.words @@ -0,0 +1,44 @@ +DefaultMaxRequestBytes +ErrCodeEnhanceYourCalm +ErrTimeout +GoAway +KeepAlive +Keepalive +MiB +ResourceExhausted +RPC +RPCs +TODO +backoff +blackhole +blackholed +cancelable +cancelation +cluster_proxy +defragment +defragmenting +etcd +gRPC +goroutine +goroutines +healthcheck +iff +inflight +keepalive +keepalives +keyspace +linearization +localhost +mutex +prefetching +protobuf +prometheus +rafthttp +repin +serializable +teardown +too_many_pings +uncontended +unprefixed +unlisting + diff --git a/vendor/github.com/coreos/etcd/CHANGELOG.md b/vendor/github.com/coreos/etcd/CHANGELOG.md new file mode 100644 index 000000000..603e501d2 --- /dev/null +++ b/vendor/github.com/coreos/etcd/CHANGELOG.md @@ -0,0 +1,746 @@ +## [v3.3.0](https://github.com/coreos/etcd/releases/tag/v3.3.0) + +See [code changes](https://github.com/coreos/etcd/compare/v3.2.0...v3.3.0) and [v3.3 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_3.md) for any breaking changes. + +### Improved + +- Use [`coreos/bbolt`](https://github.com/coreos/bbolt/releases) to replace [`boltdb/bolt`](https://github.com/boltdb/bolt#project-status). + - Fix [etcd database size grows until `mvcc: database space exceeded`](https://github.com/coreos/etcd/issues/8009). +- [Reduce memory allocation](https://github.com/coreos/etcd/pull/8428) on [Range operations](https://github.com/coreos/etcd/pull/8475). +- [Rate limit](https://github.com/coreos/etcd/pull/8099) and [randomize](https://github.com/coreos/etcd/pull/8101) lease revoke on restart or leader elections. + - Prevent [spikes in Raft proposal rate](https://github.com/coreos/etcd/issues/8096). +- Support `clientv3` balancer failover under [network faults/partitions](https://github.com/coreos/etcd/issues/8711). +- Better warning on [mismatched `--initial-cluster`](https://github.com/coreos/etcd/pull/8083) flag. + +### Changed(Breaking Changes) + +- Require [Go 1.9+](https://github.com/coreos/etcd/issues/6174). + - Compile with *Go 1.9.2*. + - Deprecate [`golang.org/x/net/context`](https://github.com/coreos/etcd/pull/8511). +- Require [`google.golang.org/grpc`](https://github.com/grpc/grpc-go/releases) [**`v1.7.4`**](https://github.com/grpc/grpc-go/releases/tag/v1.7.4) or [**`v1.7.5+`**](https://github.com/grpc/grpc-go/releases/tag/v1.7.5): + - Deprecate [`metadata.Incoming/OutgoingContext`](https://github.com/coreos/etcd/pull/7896). + - Deprecate `grpclog.Logger`, upgrade to [`grpclog.LoggerV2`](https://github.com/coreos/etcd/pull/8533). + - Deprecate [`grpc.ErrClientConnTimeout`](https://github.com/coreos/etcd/pull/8505) errors in `clientv3`. + - Use [`MaxRecvMsgSize` and `MaxSendMsgSize`](https://github.com/coreos/etcd/pull/8437) to limit message size, in etcd server. +- Upgrade [`github.com/grpc-ecosystem/grpc-gateway`](https://github.com/grpc-ecosystem/grpc-gateway/releases) `v1.2.2` to `v1.3.0`. +- Translate [gRPC status error in v3 client `Snapshot` API](https://github.com/coreos/etcd/pull/9038). +- Upgrade [`github.com/ugorji/go/codec`](https://github.com/ugorji/go) for v2 `client`. + - [Regenerated](https://github.com/coreos/etcd/pull/8721) v2 `client` source code with latest `ugorji/go/codec`. +- Fix [`/health` endpoint JSON output](https://github.com/coreos/etcd/pull/8312). +- v3 `etcdctl` [`lease timetolive LEASE_ID`](https://github.com/coreos/etcd/issues/9028) on expired lease now prints [`lease LEASE_ID already expired`](https://github.com/coreos/etcd/pull/9047). + - <=3.2 prints `lease LEASE_ID granted with TTL(0s), remaining(-1s)`. + +### Added(`etcd`) + +- Add [`--experimental-enable-v2v3`](https://github.com/coreos/etcd/pull/8407) flag to [emulate v2 API with v3](https://github.com/coreos/etcd/issues/6925). +- Add [`--experimental-corrupt-check-time`](https://github.com/coreos/etcd/pull/8420) flag to [raise corrupt alarm monitoring](https://github.com/coreos/etcd/issues/7125). +- Add [`--experimental-initial-corrupt-check`](https://github.com/coreos/etcd/pull/8554) flag to [check database hash before serving client/peer traffic](https://github.com/coreos/etcd/issues/8313). +- Add [`--max-txn-ops`](https://github.com/coreos/etcd/pull/7976) flag to [configure maximum number operations in transaction](https://github.com/coreos/etcd/issues/7826). +- Add [`--max-request-bytes`](https://github.com/coreos/etcd/pull/7968) flag to [configure maximum client request size](https://github.com/coreos/etcd/issues/7923). + - If not configured, it defaults to 1.5 MiB. +- Add [`--client-crl-file`, `--peer-crl-file`](https://github.com/coreos/etcd/pull/8124) flags for [Certificate revocation list](https://github.com/coreos/etcd/issues/4034). +- Add [`--peer-require-cn`](https://github.com/coreos/etcd/pull/8616) flag to support [CN-based auth for inter-peer connection](https://github.com/coreos/etcd/issues/8262). +- Add [`--listen-metrics-urls`](https://github.com/coreos/etcd/pull/8242) flag for additional `/metrics` endpoints. + - Support [additional (non) TLS `/metrics` endpoints for a TLS-enabled cluster](https://github.com/coreos/etcd/pull/8282). + - e.g. `--listen-metrics-urls=https://localhost:2378,http://localhost:9379` to serve `/metrics` in secure port 2378 and insecure port 9379. + - Useful for [bypassing critical APIs when monitoring etcd](https://github.com/coreos/etcd/issues/8060). +- Add [`--auto-compaction-mode`](https://github.com/coreos/etcd/pull/8123) flag to [support revision-based compaction](https://github.com/coreos/etcd/issues/8098). +- Change `--auto-compaction-retention` flag to [accept string values](https://github.com/coreos/etcd/pull/8563) with [finer granularity](https://github.com/coreos/etcd/issues/8503). +- Add [`--grpc-keepalive-min-time`, `--grpc-keepalive-interval`, `--grpc-keepalive-timeout`](https://github.com/coreos/etcd/pull/8535) flags to configure server-side keepalive policies. +- Serve [`/health` endpoint as unhealthy](https://github.com/coreos/etcd/pull/8272) when [alarm is raised](https://github.com/coreos/etcd/issues/8207). +- Provide [error information in `/health`](https://github.com/coreos/etcd/pull/8312). + - e.g. `{"health":false,"errors":["NOSPACE"]}`. +- Move [logging setup to embed package](https://github.com/coreos/etcd/pull/8810) + - Disable gRPC server log by default. +- Use [monotonic time in Go 1.9](https://github.com/coreos/etcd/pull/8507) for `lease` package. +- Warn on [empty hosts in advertise URLs](https://github.com/coreos/etcd/pull/8384). + - Address [advertise client URLs accepts empty hosts](https://github.com/coreos/etcd/issues/8379). + - etcd `v3.4` will exit on this error. + - e.g. `--advertise-client-urls=http://:2379`. +- Warn on [shadowed environment variables](https://github.com/coreos/etcd/pull/8385). + - Address [error on shadowed environment variables](https://github.com/coreos/etcd/issues/8380). + - etcd `v3.4` will exit on this error. + +### Added(API) + +- Support [ranges in transaction comparisons](https://github.com/coreos/etcd/pull/8025) for [disconnected linearized reads](https://github.com/coreos/etcd/issues/7924). +- Add [nested transactions](https://github.com/coreos/etcd/pull/8102) to extend [proxy use cases](https://github.com/coreos/etcd/issues/7857). +- Add [lease comparison target in transaction](https://github.com/coreos/etcd/pull/8324). +- Add [lease list](https://github.com/coreos/etcd/pull/8358). +- Add [hash by revision](https://github.com/coreos/etcd/pull/8263) for [better corruption checking against boltdb](https://github.com/coreos/etcd/issues/8016). + +### Added(`etcd/clientv3`) + +- Add [health balancer](https://github.com/coreos/etcd/pull/8545) to fix [watch API hangs](https://github.com/coreos/etcd/issues/7247), improve [endpoint switch under network faults](https://github.com/coreos/etcd/issues/7941). +- [Refactor balancer](https://github.com/coreos/etcd/pull/8840) and add [client-side keepalive pings](https://github.com/coreos/etcd/pull/8199) to handle [network partitions](https://github.com/coreos/etcd/issues/8711). +- Add [`MaxCallSendMsgSize` and `MaxCallRecvMsgSize`](https://github.com/coreos/etcd/pull/9047) fields to [`clientv3.Config`](https://godoc.org/github.com/coreos/etcd/clientv3#Config). + - Fix [exceeded response size limit error in client-side](https://github.com/coreos/etcd/issues/9043). + - Address [kubernetes#51099](https://github.com/kubernetes/kubernetes/issues/51099). + - `MaxCallSendMsgSize` default value is 2 MiB, if not configured. + - `MaxCallRecvMsgSize` default value is `math.MaxInt32`, if not configured. +- Accept [`Compare_LEASE`](https://github.com/coreos/etcd/pull/8324) in [`clientv3.Compare`](https://godoc.org/github.com/coreos/etcd/clientv3#Compare). +- Add [`LeaseValue` helper](https://github.com/coreos/etcd/pull/8488) to `Cmp` `LeaseID` values in `Txn`. +- Add [`MoveLeader`](https://github.com/coreos/etcd/pull/8153) to `Maintenance`. +- Add [`HashKV`](https://github.com/coreos/etcd/pull/8351) to `Maintenance`. +- Add [`Leases`](https://github.com/coreos/etcd/pull/8358) to `Lease`. +- Add [`clientv3/ordering`](https://github.com/coreos/etcd/pull/8092) for enforce [ordering in serialized requests](https://github.com/coreos/etcd/issues/7623). + +### Added(v2 `etcdctl`) + +- Add [`backup --with-v3`](https://github.com/coreos/etcd/pull/8479) flag. + +### Added(v3 `etcdctl`) + +- Add [`--discovery-srv`](https://github.com/coreos/etcd/pull/8462) flag. +- Add [`--keepalive-time`, `--keepalive-timeout`](https://github.com/coreos/etcd/pull/8663) flags. +- Add [`lease list`](https://github.com/coreos/etcd/pull/8358) command. +- Add [`lease keep-alive --once`](https://github.com/coreos/etcd/pull/8775) flag. +- Make [`lease timetolive LEASE_ID`](https://github.com/coreos/etcd/issues/9028) on expired lease print [`lease LEASE_ID already expired`](https://github.com/coreos/etcd/pull/9047). + - <=3.2 prints `lease LEASE_ID granted with TTL(0s), remaining(-1s)`. +- Add [`defrag --data-dir`](https://github.com/coreos/etcd/pull/8367) flag. +- Add [`move-leader`](https://github.com/coreos/etcd/pull/8153) command. +- Add [`endpoint hashkv`](https://github.com/coreos/etcd/pull/8351) command. +- Add [`endpoint --cluster`](https://github.com/coreos/etcd/pull/8143) flag, equivalent to [v2 `etcdctl cluster-health`](https://github.com/coreos/etcd/issues/8117). +- Make `endpoint health` command terminate with [non-zero exit code on unhealthy status](https://github.com/coreos/etcd/pull/8342). +- Add [`lock --ttl`](https://github.com/coreos/etcd/pull/8370) flag. +- Support [`watch [key] [range_end] -- [exec-command…]`](https://github.com/coreos/etcd/pull/8919), equivalent to [v2 `etcdctl exec-watch`](https://github.com/coreos/etcd/issues/8814). +- Enable [`clientv3.WithRequireLeader(context.Context)` for `watch`](https://github.com/coreos/etcd/pull/8672) command. +- Print [`"del"` instead of `"delete"`](https://github.com/coreos/etcd/pull/8297) in `txn` interactive mode. +- Print [`ETCD_INITIAL_ADVERTISE_PEER_URLS` in `member add`](https://github.com/coreos/etcd/pull/8332). + +### Added(metrics) + +- Add [`etcd --listen-metrics-urls`](https://github.com/coreos/etcd/pull/8242) flag for additional `/metrics` endpoints. + - Useful for [bypassing critical APIs when monitoring etcd](https://github.com/coreos/etcd/issues/8060). +- Add [`etcd_server_version`](https://github.com/coreos/etcd/pull/8960) Prometheus metric. + - To replace [Kubernetes `etcd-version-monitor`](https://github.com/coreos/etcd/issues/8948). +- Add [`etcd_debugging_mvcc_db_compaction_keys_total`](https://github.com/coreos/etcd/pull/8280) Prometheus metric. +- Add [`etcd_debugging_server_lease_expired_total`](https://github.com/coreos/etcd/pull/8064) Prometheus metric. + - To improve [lease revoke monitoring](https://github.com/coreos/etcd/issues/8050). +- Document [Prometheus 2.0 rules](https://github.com/coreos/etcd/pull/8879). +- Initialize gRPC server [metrics with zero values](https://github.com/coreos/etcd/pull/8878). + +### Added(`grpc-proxy`) + +- Add [`grpc-proxy start --experimental-leasing-prefix`](https://github.com/coreos/etcd/pull/8341) flag: + - For disconnected linearized reads. + - Based on [V system leasing](https://github.com/coreos/etcd/issues/6065). + - See ["Disconnected consistent reads with etcd" blog post](https://coreos.com/blog/coreos-labs-disconnected-consistent-reads-with-etcd). +- Add [`grpc-proxy start --experimental-serializable-ordering`](https://github.com/coreos/etcd/pull/8315) flag. + - To ensure serializable reads have monotonically increasing store revisions across endpoints. +- Add [`grpc-proxy start --metrics-addr`](https://github.com/coreos/etcd/pull/8242) flag for an additional `/metrics` endpoint. + - Set `--metrics-addr=http://[HOST]:9379` to serve `/metrics` in insecure port 9379. +- Serve [`/health` endpoint in grpc-proxy](https://github.com/coreos/etcd/pull/8322). +- Add [`grpc-proxy start --debug`](https://github.com/coreos/etcd/pull/8994) flag. + +### Added(gRPC gateway) + +- Replace [gRPC gateway](https://github.com/grpc-ecosystem/grpc-gateway) endpoint with [`/v3beta`](https://github.com/coreos/etcd/pull/8880). + - To deprecate [`/v3alpha`](https://github.com/coreos/etcd/issues/8125) in `v3.4`. +- Support ["authorization" token](https://github.com/coreos/etcd/pull/7999). +- Support [websocket for bi-directional streams](https://github.com/coreos/etcd/pull/8257). + - Fix [`Watch` API with gRPC gateway](https://github.com/coreos/etcd/issues/8237). +- Upgrade gRPC gateway to [v1.3.0](https://github.com/coreos/etcd/issues/8838). + +### Added(`etcd/raft`) + +- Add [non-voting member](https://github.com/coreos/etcd/pull/8751). + - To implement [Raft thesis 4.2.1 Catching up new servers](https://github.com/coreos/etcd/issues/8568). + - `Learner` node does not vote or promote itself. + +### Added/Fixed(Security/Auth) + +- Add [CRL based connection rejection](https://github.com/coreos/etcd/pull/8124) to manage [revoked certs](https://github.com/coreos/etcd/issues/4034). +- Document [TLS authentication changes](https://github.com/coreos/etcd/pull/8895): + - [Server accepts connections if IP matches, without checking DNS entries](https://github.com/coreos/etcd/pull/8223). For instance, if peer cert contains IP addresses and DNS names in Subject Alternative Name (SAN) field, and the remote IP address matches one of those IP addresses, server just accepts connection without further checking the DNS names. + - [Server supports reverse-lookup on wildcard DNS `SAN`](https://github.com/coreos/etcd/pull/8281). For instance, if peer cert contains only DNS names (no IP addresses) in Subject Alternative Name (SAN) field, server first reverse-lookups the remote IP address to get a list of names mapping to that address (e.g. `nslookup IPADDR`). Then accepts the connection if those names have a matching name with peer cert's DNS names (either by exact or wildcard match). If none is matched, server forward-lookups each DNS entry in peer cert (e.g. look up `example.default.svc` when the entry is `*.example.default.svc`), and accepts connection only when the host's resolved addresses have the matching IP address with the peer's remote IP address. +- Add [`etcd --peer-require-cn`](https://github.com/coreos/etcd/pull/8616) flag. + - To support [CommonName(CN) based auth](https://github.com/coreos/etcd/issues/8262) for inter peer connection. +- [Swap priority](https://github.com/coreos/etcd/pull/8594) of cert CommonName(CN) and username + password. + - To address ["username and password specified in the request should take priority over CN in the cert"](https://github.com/coreos/etcd/issues/8584). +- Protect [lease revoke with auth](https://github.com/coreos/etcd/pull/8031). +- Provide user's role on [auth permission error](https://github.com/coreos/etcd/pull/8164). +- Fix [auth store panic with disabled token](https://github.com/coreos/etcd/pull/8695). +- Update `golang.org/x/crypto/bcrypt` (see [golang/crypto@6c586e1](https://github.com/golang/crypto/commit/6c586e17d90a7d08bbbc4069984180dce3b04117)). + +### Fixed(v2) + +- [Fail-over v2 client](https://github.com/coreos/etcd/pull/8519) to next endpoint on [oneshot failure](https://github.com/coreos/etcd/issues/8515). +- [Put back `/v2/machines`](https://github.com/coreos/etcd/pull/8062) endpoint for python-etcd wrapper. + +### Fixed(v3) + +- Fix [range/put/delete operation metrics](https://github.com/coreos/etcd/pull/8054) with transaction: + - `etcd_debugging_mvcc_range_total` + - `etcd_debugging_mvcc_put_total` + - `etcd_debugging_mvcc_delete_total` + - `etcd_debugging_mvcc_txn_total` +- Fix [`etcd_debugging_mvcc_keys_total`](https://github.com/coreos/etcd/pull/8390) on restore. +- Fix [`etcd_debugging_mvcc_db_total_size_in_bytes`](https://github.com/coreos/etcd/pull/8120) on restore. + - Also change to [`prometheus.NewGaugeFunc`](https://github.com/coreos/etcd/pull/8150). +- Fix [backend database in-memory index corruption](https://github.com/coreos/etcd/pull/8127) issue on restore (only 3.2.0 is affected). +- Fix [watch restore from snapshot](https://github.com/coreos/etcd/pull/8427). +- Fix ["put at-most-once" in `clientv3`](https://github.com/coreos/etcd/pull/8335). +- Handle [empty key permission](https://github.com/coreos/etcd/pull/8514) in `etcdctl`. +- [Fix server crash](https://github.com/coreos/etcd/pull/8010) on [invalid transaction request from gRPC gateway](https://github.com/coreos/etcd/issues/7889). +- Fix [`clientv3.WatchResponse.Canceled`](https://github.com/coreos/etcd/pull/8283) on [compacted watch request](https://github.com/coreos/etcd/issues/8231). +- Handle [WAL renaming failure on Windows](https://github.com/coreos/etcd/pull/8286). +- Make [peer dial timeout longer](https://github.com/coreos/etcd/pull/8599). + - See [coreos/etcd-operator#1300](https://github.com/coreos/etcd-operator/issues/1300) for more detail. +- Make server [wait up to request time-out](https://github.com/coreos/etcd/pull/8267) with [pending RPCs](https://github.com/coreos/etcd/issues/8224). +- Fix [`grpc.Server` panic on `GracefulStop`](https://github.com/coreos/etcd/pull/8987) with [TLS-enabled server](https://github.com/coreos/etcd/issues/8916). +- Fix ["multiple peer URLs cannot start" issue](https://github.com/coreos/etcd/issues/8383). +- Fix server-side auth so [concurrent auth operations do not return old revision error](https://github.com/coreos/etcd/pull/8442). +- Fix [`concurrency/stm` `Put` with serializable snapshot](https://github.com/coreos/etcd/pull/8439). + - Use store revision from first fetch to resolve write conflicts instead of modified revision. +- Fix [`grpc-proxy` Snapshot API error handling](https://github.com/coreos/etcd/commit/dbd16d52fbf81e5fd806d21ff5e9148d5bf203ab). +- Fix [`grpc-proxy` KV API `PrevKv` flag handling](https://github.com/coreos/etcd/pull/8366). +- Fix [`grpc-proxy` KV API `KeysOnly` flag handling](https://github.com/coreos/etcd/pull/8552). +- Upgrade [`coreos/go-systemd`](https://github.com/coreos/go-systemd/releases) to `v15` (see https://github.com/coreos/go-systemd/releases/tag/v15). + +### Other + +- Support previous two minor versions (see our [new release policy](https://github.com/coreos/etcd/pull/8805)). +- `v3.3.x` is the last release cycle that supports `ACI`: + - AppC was [officially suspended](https://github.com/appc/spec#-disclaimer-), as of late 2016. + - [`acbuild`](https://github.com/containers/build#this-project-is-currently-unmaintained) is not maintained anymore. + - `*.aci` files won't be available from etcd `v3.4` release. +- Add container registry [`gcr.io/etcd-development/etcd`](https://gcr.io/etcd-development/etcd). + - [quay.io/coreos/etcd](https://quay.io/coreos/etcd) is still supported as secondary. + + +## [v3.2.12](https://github.com/coreos/etcd/releases/tag/v3.2.12) (2017-12-20) + +See [code changes](https://github.com/coreos/etcd/compare/v3.2.11...v3.2.12) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. + +### Fixed + +- Fix [error message of `Revision` compactor](https://github.com/coreos/etcd/pull/8999) in server-side. + +### Added(`etcd/clientv3`,`etcdctl/v3`) + +- Add [`MaxCallSendMsgSize` and `MaxCallRecvMsgSize`](https://github.com/coreos/etcd/pull/9047) fields to [`clientv3.Config`](https://godoc.org/github.com/coreos/etcd/clientv3#Config). + - Fix [exceeded response size limit error in client-side](https://github.com/coreos/etcd/issues/9043). + - Address [kubernetes#51099](https://github.com/kubernetes/kubernetes/issues/51099). + - `MaxCallSendMsgSize` default value is 2 MiB, if not configured. + - `MaxCallRecvMsgSize` default value is `math.MaxInt32`, if not configured. + +### Other + +- Pin [grpc v1.7.5](https://github.com/grpc/grpc-go/releases/tag/v1.7.5), [grpc-gateway v1.3.0](https://github.com/grpc-ecosystem/grpc-gateway/releases/tag/v1.3.0). + - No code change, just to be explicit about recommended versions. + + +## [v3.2.11](https://github.com/coreos/etcd/releases/tag/v3.2.11) (2017-12-05) + +See [code changes](https://github.com/coreos/etcd/compare/v3.2.10...v3.2.11) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. + +### Fixed + +- Fix racey grpc-go's server handler transport `WriteStatus` call to prevent [TLS-enabled etcd server crash](https://github.com/coreos/etcd/issues/8904): + - Upgrade [`google.golang.org/grpc`](https://github.com/grpc/grpc-go/releases) `v1.7.3` to `v1.7.4`. + - Add [gRPC RPC failure warnings](https://github.com/coreos/etcd/pull/8939) to help debug such issues in the future. +- Remove `--listen-metrics-urls` flag in monitoring document (non-released in `v3.2.x`, planned for `v3.3.x`). + +### Added + +- Provide [more cert details](https://github.com/coreos/etcd/pull/8952/files) on TLS handshake failures. + + +## [v3.1.11](https://github.com/coreos/etcd/releases/tag/v3.1.11) (2017-11-28) + +See [code changes](https://github.com/coreos/etcd/compare/v3.1.10...v3.1.11) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. + +### Fixed + +- [#8411](https://github.com/coreos/etcd/issues/8411),[#8806](https://github.com/coreos/etcd/pull/8806) mvcc: fix watch restore from snapshot +- [#8009](https://github.com/coreos/etcd/issues/8009),[#8902](https://github.com/coreos/etcd/pull/8902) backport coreos/bbolt v1.3.1-coreos.5 + + +## [v3.2.10](https://github.com/coreos/etcd/releases/tag/v3.2.10) (2017-11-16) + +See [code changes](https://github.com/coreos/etcd/compare/v3.2.9...v3.2.10) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. + +### Fixed + +- Replace backend key-value database `boltdb/bolt` with [`coreos/bbolt`](https://github.com/coreos/bbolt/releases) to address [backend database size issue](https://github.com/coreos/etcd/issues/8009). +- Fix `clientv3` balancer to handle [network partitions](https://github.com/coreos/etcd/issues/8711): + - Upgrade [`google.golang.org/grpc`](https://github.com/grpc/grpc-go/releases) `v1.2.1` to `v1.7.3`. + - Upgrade [`github.com/grpc-ecosystem/grpc-gateway`](https://github.com/grpc-ecosystem/grpc-gateway/releases) `v1.2` to `v1.3`. +- Revert [discovery SRV auth `ServerName` with `*.{ROOT_DOMAIN}`](https://github.com/coreos/etcd/pull/8651) to support non-wildcard subject alternative names in the certs (see [issue #8445](https://github.com/coreos/etcd/issues/8445) for more contexts). + - For instance, `etcd --discovery-srv=etcd.local` will only authenticate peers/clients when the provided certs have root domain `etcd.local` (**not `*.etcd.local`**) as an entry in Subject Alternative Name (SAN) field. + + +## [v3.2.9](https://github.com/coreos/etcd/releases/tag/v3.2.9) (2017-10-06) + +See [code changes](https://github.com/coreos/etcd/compare/v3.2.8...v3.2.9) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. + +### Fixed(Security) + +- Compile with [Go 1.8.4](https://groups.google.com/d/msg/golang-nuts/sHfMg4gZNps/a-HDgDDDAAAJ). +- Update `golang.org/x/crypto/bcrypt` (see [golang/crypto@6c586e1](https://github.com/golang/crypto/commit/6c586e17d90a7d08bbbc4069984180dce3b04117)). +- Fix discovery SRV bootstrapping to [authenticate `ServerName` with `*.{ROOT_DOMAIN}`](https://github.com/coreos/etcd/pull/8651), in order to support sub-domain wildcard matching (see [issue #8445](https://github.com/coreos/etcd/issues/8445) for more contexts). + - For instance, `etcd --discovery-srv=etcd.local` will only authenticate peers/clients when the provided certs have root domain `*.etcd.local` as an entry in Subject Alternative Name (SAN) field. + + +## [v3.2.8](https://github.com/coreos/etcd/releases/tag/v3.2.8) (2017-09-29) + +See [code changes](https://github.com/coreos/etcd/compare/v3.2.7...v3.2.8) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. + +### Fixed + +- Fix v2 client failover to next endpoint on mutable operation. +- Fix grpc-proxy to respect `KeysOnly` flag. + + +## [v3.2.7](https://github.com/coreos/etcd/releases/tag/v3.2.7) (2017-09-01) + +See [code changes](https://github.com/coreos/etcd/compare/v3.2.6...v3.2.7) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. + +### Fixed + +- Fix server-side auth so concurrent auth operations do not return old revision error. +- Fix concurrency/stm Put with serializable snapshot + - Use store revision from first fetch to resolve write conflicts instead of modified revision. + + +## [v3.2.6](https://github.com/coreos/etcd/releases/tag/v3.2.6) (2017-08-21) + +See [code changes](https://github.com/coreos/etcd/compare/v3.2.5...v3.2.6). + +### Fixed + +- Fix watch restore from snapshot. +- Fix `etcd_debugging_mvcc_keys_total` inconsistency. +- Fix multiple URLs for `--listen-peer-urls` flag. +- Add `--enable-pprof` flag to etcd configuration file format. + + +## [v3.2.5](https://github.com/coreos/etcd/releases/tag/v3.2.5) (2017-08-04) + +See [code changes](https://github.com/coreos/etcd/compare/v3.2.4...v3.2.5) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. + +### Changed + +- Use reverse lookup to match wildcard DNS SAN. +- Return non-zero exit code on unhealthy `endpoint health`. + +### Fixed + +- Fix unreachable /metrics endpoint when `--enable-v2=false`. +- Fix grpc-proxy to respect `PrevKv` flag. + +### Added + +- Add container registry `gcr.io/etcd-development/etcd`. + + +## [v3.2.4](https://github.com/coreos/etcd/releases/tag/v3.2.4) (2017-07-19) + +See [code changes](https://github.com/coreos/etcd/compare/v3.2.3...v3.2.4) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. + +### Fixed + +- Do not block on active client stream when stopping server +- Fix gRPC proxy Snapshot RPC error handling + + +## [v3.2.3](https://github.com/coreos/etcd/releases/tag/v3.2.3) (2017-07-14) + +See [code changes](https://github.com/coreos/etcd/compare/v3.2.2...v3.2.3) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. + +### Fixed + +- Let clients establish unlimited streams + +### Added + +- Tag docker images with minor versions + - e.g. `docker pull quay.io/coreos/etcd:v3.2` to fetch latest v3.2 versions + + +## [v3.1.10](https://github.com/coreos/etcd/releases/tag/v3.1.10) (2017-07-14) + +See [code changes](https://github.com/coreos/etcd/compare/v3.1.9...v3.1.10) and [v3.1 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_1.md) for any breaking changes. + +### Changed + +- Compile with Go 1.8.3 to fix panic on `net/http.CloseNotify` + +### Added + +- Tag docker images with minor versions. + - e.g. `docker pull quay.io/coreos/etcd:v3.1` to fetch latest v3.1 versions. + + +## [v3.2.2](https://github.com/coreos/etcd/releases/tag/v3.2.2) (2017-07-07) + +See [code changes](https://github.com/coreos/etcd/compare/v3.2.1...v3.2.2) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. + +### Improved + +- Rate-limit lease revoke on expiration. +- Extend leases on promote to avoid queueing effect on lease expiration. + +### Fixed + +- Use user-provided listen address to connect to gRPC gateway: + - `net.Listener` rewrites IPv4 0.0.0.0 to IPv6 [::], breaking IPv6 disabled hosts. + - Only v3.2.0, v3.2.1 are affected. +- Accept connection with matched IP SAN but no DNS match. + - Don't check DNS entries in certs if there's a matching IP. +- Fix 'tools/benchmark' watch command. + + +## [v3.2.1](https://github.com/coreos/etcd/releases/tag/v3.2.1) (2017-06-23) + +See [code changes](https://github.com/coreos/etcd/compare/v3.2.0...v3.2.1) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. + +### Fixed + +- Fix backend database in-memory index corruption issue on restore (only 3.2.0 is affected). +- Fix gRPC gateway Txn marshaling issue. +- Fix backend database size debugging metrics. + + +## [v3.2.0](https://github.com/coreos/etcd/releases/tag/v3.2.0) (2017-06-09) + +See [code changes](https://github.com/coreos/etcd/compare/v3.1.0...v3.2.0) and [v3.2 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_2.md) for any breaking changes. + +### Improved + +- Improve backend read concurrency. + +### Added + +- Embedded etcd + - `Etcd.Peers` field is now `[]*peerListener`. +- RPCs + - Add Election, Lock service. +- Native client etcdserver/api/v3client + - client "embedded" in the server. +- gRPC proxy + - Proxy endpoint discovery. + - Namespaces. + - Coalesce lease requests. +- v3 client + - STM prefetching. + - Add namespace feature. + - Add `ErrOldCluster` with server version checking. + - Translate `WithPrefix()` into `WithFromKey()` for empty key. +- v3 etcdctl + - Add `check perf` command. + - Add `--from-key` flag to role grant-permission command. + - `lock` command takes an optional command to execute. +- etcd flags + - Add `--enable-v2` flag to configure v2 backend (enabled by default). + - Add `--auth-token` flag. +- `etcd gateway` + - Support DNS SRV priority. +- Auth + - Support Watch API. + - JWT tokens. +- Logging, monitoring + - Server warns large snapshot operations. + - Add `etcd_debugging_server_lease_expired_total` metrics. +- Security + - Deny incoming peer certs with wrong IP SAN. + - Resolve TLS `DNSNames` when SAN checking. + - Reload TLS certificates on every client connection. +- Release + - Annotate acbuild with supports-systemd-notify. + - Add `nsswitch.conf` to Docker container image. + - Add ppc64le, arm64(experimental) builds. + - Compile with `Go 1.8.3`. + +### Changed + +- v3 client + - `LeaseTimeToLive` returns TTL=-1 resp on lease not found. + - `clientv3.NewFromConfigFile` is moved to `clientv3/yaml.NewConfig`. + - concurrency package's elections updated to match RPC interfaces. + - let client dial endpoints not in the balancer. +- Dependencies + - Update [`google.golang.org/grpc`](https://github.com/grpc/grpc-go/releases) to `v1.2.1`. + - Update [`github.com/grpc-ecosystem/grpc-gateway`](https://github.com/grpc-ecosystem/grpc-gateway/releases) to `v1.2.0`. + +### Fixed + +- Allow v2 snapshot over 512MB. + + +## [v3.1.9](https://github.com/coreos/etcd/releases/tag/v3.1.9) (2017-06-09) + +See [code changes](https://github.com/coreos/etcd/compare/v3.1.8...v3.1.9) and [v3.1 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_1.md) for any breaking changes. + +### Fixed + +- Allow v2 snapshot over 512MB. + + +## [v3.1.8](https://github.com/coreos/etcd/releases/tag/v3.1.8) (2017-05-19) + +See [code changes](https://github.com/coreos/etcd/compare/v3.1.7...v3.1.8) and [v3.1 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_1.md) for any breaking changes. + + +## [v3.1.7](https://github.com/coreos/etcd/releases/tag/v3.1.7) (2017-04-28) + +See [code changes](https://github.com/coreos/etcd/compare/v3.1.6...v3.1.7) and [v3.1 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_1.md) for any breaking changes. + + +## [v3.1.6](https://github.com/coreos/etcd/releases/tag/v3.1.6) (2017-04-19) + +See [code changes](https://github.com/coreos/etcd/compare/v3.1.5...v3.1.6) and [v3.1 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_1.md) for any breaking changes. + +### Changed + +- Remove auth check in Status API. + +### Fixed + +- Fill in Auth API response header. + + +## [v3.1.5](https://github.com/coreos/etcd/releases/tag/v3.1.5) (2017-03-27) + +See [code changes](https://github.com/coreos/etcd/compare/v3.1.4...v3.1.5) and [v3.1 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_1.md) for any breaking changes. + +### Added + +- Add `/etc/nsswitch.conf` file to alpine-based Docker image. + +### Fixed + +- Fix raft memory leak issue. +- Fix Windows file path issues. + + +## [v3.1.4](https://github.com/coreos/etcd/releases/tag/v3.1.4) (2017-03-22) + +See [code changes](https://github.com/coreos/etcd/compare/v3.1.3...v3.1.4) and [v3.1 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_1.md) for any breaking changes. + + +## [v3.1.3](https://github.com/coreos/etcd/releases/tag/v3.1.3) (2017-03-10) + +See [code changes](https://github.com/coreos/etcd/compare/v3.1.2...v3.1.3) and [v3.1 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_1.md) for any breaking changes. + +### Changed + +- Use machine default host when advertise URLs are default values(`localhost:2379,2380`) AND if listen URL is `0.0.0.0`. + +### Fixed + +- Fix `etcd gateway` schema handling in DNS discovery. +- Fix sd_notify behaviors in `gateway`, `grpc-proxy`. + + +## [v3.1.2](https://github.com/coreos/etcd/releases/tag/v3.1.2) (2017-02-24) + +See [code changes](https://github.com/coreos/etcd/compare/v3.1.1...v3.1.2) and [v3.1 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_1.md) for any breaking changes. + +### Changed + +- Use IPv4 default host, by default (when IPv4 and IPv6 are available). + +### Fixed + +- Fix `etcd gateway` with multiple endpoints. + + +## [v3.1.1](https://github.com/coreos/etcd/releases/tag/v3.1.1) (2017-02-17) + +See [code changes](https://github.com/coreos/etcd/compare/v3.1.0...v3.1.1) and [v3.1 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_1.md) for any breaking changes. + +### Changed + +- Compile with `Go 1.7.5`. + + +## [v2.3.8](https://github.com/coreos/etcd/releases/tag/v2.3.8) (2017-02-17) + +See [code changes](https://github.com/coreos/etcd/compare/v2.3.7...v2.3.8). + +### Changed + +- Compile with `Go 1.7.5`. + + +## [v3.1.0](https://github.com/coreos/etcd/releases/tag/v3.1.0) (2017-01-20) + +See [code changes](https://github.com/coreos/etcd/compare/v3.0.0...v3.1.0) and [v3.1 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_1.md) for any breaking changes. + +### Improved + +- Faster linearizable reads (implements Raft read-index). +- v3 authentication API is now stable. + +### Added + +- Automatic leadership transfer when leader steps down. +- etcd flags + - `--strict-reconfig-check` flag is set by default. + - Add `--log-output` flag. + - Add `--metrics` flag. +- v3 client + - Add `SetEndpoints` method; update endpoints at runtime. + - Add `Sync` method; auto-update endpoints at runtime. + - Add `Lease TimeToLive` API; fetch lease information. + - replace Config.Logger field with global logger. + - Get API responses are sorted in ascending order by default. +- v3 etcdctl + - Add `lease timetolive` command. + - Add `--print-value-only` flag to get command. + - Add `--dest-prefix` flag to make-mirror command. + - `get` command responses are sorted in ascending order by default. +- `recipes` now conform to sessions defined in `clientv3/concurrency`. +- ACI has symlinks to `/usr/local/bin/etcd*`. +- Experimental gRPC proxy feature. + +### Changed + +- Deprecated following gRPC metrics in favor of [go-grpc-prometheus](https://github.com/grpc-ecosystem/go-grpc-prometheus): + - `etcd_grpc_requests_total` + - `etcd_grpc_requests_failed_total` + - `etcd_grpc_active_streams` + - `etcd_grpc_unary_requests_duration_seconds` +- etcd uses default route IP if advertise URL is not given. +- Cluster rejects removing members if quorum will be lost. +- SRV records (e.g., infra1.example.com) must match the discovery domain (i.e., example.com) if no custom certificate authority is given. + - `TLSConfig.ServerName` is ignored with user-provided certificates for backwards compatibility; to be deprecated. + - For example, `etcd --discovery-srv=example.com` will only authenticate peers/clients when the provided certs have root domain `example.com` as an entry in Subject Alternative Name (SAN) field. +- Discovery now has upper limit for waiting on retries. +- Warn on binding listeners through domain names; to be deprecated. + + +## [v3.0.16](https://github.com/coreos/etcd/releases/tag/v3.0.16) (2016-11-13) + +See [code changes](https://github.com/coreos/etcd/compare/v3.0.15...v3.0.16) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. + + +## [v3.0.15](https://github.com/coreos/etcd/releases/tag/v3.0.15) (2016-11-11) + +See [code changes](https://github.com/coreos/etcd/compare/v3.0.14...v3.0.15) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. + +### Fixed + +- Fix cancel watch request with wrong range end. + + +## [v3.0.14](https://github.com/coreos/etcd/releases/tag/v3.0.14) (2016-11-04) + +See [code changes](https://github.com/coreos/etcd/compare/v3.0.13...v3.0.14) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. + +### Added + +- v3 `etcdctl migrate` command now supports `--no-ttl` flag to discard keys on transform. + + +## [v3.0.13](https://github.com/coreos/etcd/releases/tag/v3.0.13) (2016-10-24) + +See [code changes](https://github.com/coreos/etcd/compare/v3.0.12...v3.0.13) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. + + +## [v3.0.12](https://github.com/coreos/etcd/releases/tag/v3.0.12) (2016-10-07) + +See [code changes](https://github.com/coreos/etcd/compare/v3.0.11...v3.0.12) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. + + +## [v3.0.11](https://github.com/coreos/etcd/releases/tag/v3.0.11) (2016-10-07) + +See [code changes](https://github.com/coreos/etcd/compare/v3.0.10...v3.0.11) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. + +### Added + +- Server returns previous key-value (optional) + - `clientv3.WithPrevKV` option + - v3 etcdctl `put,watch,del --prev-kv` flag + + +## [v3.0.10](https://github.com/coreos/etcd/releases/tag/v3.0.10) (2016-09-23) + +See [code changes](https://github.com/coreos/etcd/compare/v3.0.9...v3.0.10) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. + + +## [v3.0.9](https://github.com/coreos/etcd/releases/tag/v3.0.9) (2016-09-15) + +See [code changes](https://github.com/coreos/etcd/compare/v3.0.8...v3.0.9) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. + +### Added + +- Warn on domain names on listen URLs (v3.2 will reject domain names). + + +## [v3.0.8](https://github.com/coreos/etcd/releases/tag/v3.0.8) (2016-09-09) + +See [code changes](https://github.com/coreos/etcd/compare/v3.0.7...v3.0.8) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. + +### Changed + +- Allow only IP addresses in listen URLs (domain names are rejected). + + +## [v3.0.7](https://github.com/coreos/etcd/releases/tag/v3.0.7) (2016-08-31) + +See [code changes](https://github.com/coreos/etcd/compare/v3.0.6...v3.0.7) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. + +### Changed + +- SRV records only allow A records (RFC 2052). + + +## [v3.0.6](https://github.com/coreos/etcd/releases/tag/v3.0.6) (2016-08-19) + +See [code changes](https://github.com/coreos/etcd/compare/v3.0.5...v3.0.6) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. + + +## [v3.0.5](https://github.com/coreos/etcd/releases/tag/v3.0.5) (2016-08-19) + +See [code changes](https://github.com/coreos/etcd/compare/v3.0.4...v3.0.5) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. + +### Changed + +- SRV records (e.g., infra1.example.com) must match the discovery domain (i.e., example.com) if no custom certificate authority is given. + + +## [v3.0.4](https://github.com/coreos/etcd/releases/tag/v3.0.4) (2016-07-27) + +See [code changes](https://github.com/coreos/etcd/compare/v3.0.3...v3.0.4) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. + +### Changed + +- v2 auth can now use common name from TLS certificate when `--client-cert-auth` is enabled. + +### Added + +- v2 `etcdctl ls` command now supports `--output=json`. +- Add /var/lib/etcd directory to etcd official Docker image. + + +## [v3.0.3](https://github.com/coreos/etcd/releases/tag/v3.0.3) (2016-07-15) + +See [code changes](https://github.com/coreos/etcd/compare/v3.0.2...v3.0.3) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. + +### Changed + +- Revert Dockerfile to use `CMD`, instead of `ENTRYPOINT`, to support `etcdctl` run. + - Docker commands for v3.0.2 won't work without specifying executable binary paths. +- v3 etcdctl default endpoints are now `127.0.0.1:2379`. + + +## [v3.0.2](https://github.com/coreos/etcd/releases/tag/v3.0.2) (2016-07-08) + +See [code changes](https://github.com/coreos/etcd/compare/v3.0.1...v3.0.2) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. + +### Changed + +- Dockerfile uses `ENTRYPOINT`, instead of `CMD`, to run etcd without binary path specified. + + +## [v3.0.1](https://github.com/coreos/etcd/releases/tag/v3.0.1) (2016-07-01) + +See [code changes](https://github.com/coreos/etcd/compare/v3.0.0...v3.0.1) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. + + +## [v3.0.0](https://github.com/coreos/etcd/releases/tag/v3.0.0) (2016-06-30) + +See [code changes](https://github.com/coreos/etcd/compare/v2.3.0...v3.0.0) and [v3.0 upgrade guide](https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md) for any breaking changes. diff --git a/vendor/github.com/coreos/etcd/CODE_OF_CONDUCT.md b/vendor/github.com/coreos/etcd/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..c0c20dd81 --- /dev/null +++ b/vendor/github.com/coreos/etcd/CODE_OF_CONDUCT.md @@ -0,0 +1,63 @@ +## CoreOS Community Code of Conduct + +### Contributor Code of Conduct + +As contributors and maintainers of this project, and in the interest of +fostering an open and welcoming community, we pledge to respect all people who +contribute through reporting issues, posting feature requests, updating +documentation, submitting pull requests or patches, and other activities. + +We are committed to making participation in this project a harassment-free +experience for everyone, regardless of level of experience, gender, gender +identity and expression, sexual orientation, disability, personal appearance, +body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery +* Personal attacks +* Trolling or insulting/derogatory comments +* Public or private harassment +* Publishing others' private information, such as physical or electronic addresses, without explicit permission +* Other unethical or unprofessional conduct. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct. By adopting this Code of Conduct, +project maintainers commit themselves to fairly and consistently applying these +principles to every aspect of managing this project. Project maintainers who do +not follow or enforce the Code of Conduct may be permanently removed from the +project team. + +This code of conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting a project maintainer, Brandon Philips +, and/or Meghan Schofield +. + +This Code of Conduct is adapted from the Contributor Covenant +(http://contributor-covenant.org), version 1.2.0, available at +http://contributor-covenant.org/version/1/2/0/ + +### CoreOS Events Code of Conduct + +CoreOS events are working conferences intended for professional networking and +collaboration in the CoreOS community. Attendees are expected to behave +according to professional standards and in accordance with their employer’s +policies on appropriate workplace behavior. + +While at CoreOS events or related social networking opportunities, attendees +should not engage in discriminatory or offensive speech or actions including +but not limited to gender, sexuality, race, age, disability, or religion. +Speakers should be especially aware of these concerns. + +CoreOS does not condone any statements by speakers contrary to these standards. +CoreOS reserves the right to deny entrance and/or eject from an event (without +refund) any individual found to be engaging in discriminatory or offensive +speech or actions. + +Please bring any concerns to the immediate attention of designated on-site +staff, Brandon Philips , and/or Meghan Schofield +. diff --git a/vendor/github.com/coreos/etcd/CONTRIBUTING.md b/vendor/github.com/coreos/etcd/CONTRIBUTING.md index 635f73a30..31cef1fa0 100644 --- a/vendor/github.com/coreos/etcd/CONTRIBUTING.md +++ b/vendor/github.com/coreos/etcd/CONTRIBUTING.md @@ -5,7 +5,7 @@ etcd is Apache 2.0 licensed and accepts contributions via GitHub pull requests. # Email and chat - Email: [etcd-dev](https://groups.google.com/forum/?hl=en#!forum/etcd-dev) -- IRC: #[coreos](irc://irc.freenode.org:6667/#coreos) IRC channel on freenode.org +- IRC: #[etcd](irc://irc.freenode.org:6667/#etcd) IRC channel on freenode.org ## Getting started diff --git a/vendor/github.com/coreos/etcd/Dockerfile-functional-tester b/vendor/github.com/coreos/etcd/Dockerfile-functional-tester new file mode 100644 index 000000000..cfd808675 --- /dev/null +++ b/vendor/github.com/coreos/etcd/Dockerfile-functional-tester @@ -0,0 +1,53 @@ +FROM ubuntu:17.10 + +RUN rm /bin/sh && ln -s /bin/bash /bin/sh +RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections + +RUN apt-get -y update \ + && apt-get -y install \ + build-essential \ + gcc \ + apt-utils \ + pkg-config \ + software-properties-common \ + apt-transport-https \ + libssl-dev \ + sudo \ + bash \ + curl \ + wget \ + tar \ + git \ + && apt-get -y update \ + && apt-get -y upgrade \ + && apt-get -y autoremove \ + && apt-get -y autoclean + +ENV GOROOT /usr/local/go +ENV GOPATH /go +ENV PATH ${GOPATH}/bin:${GOROOT}/bin:${PATH} +ENV GO_VERSION REPLACE_ME_GO_VERSION +ENV GO_DOWNLOAD_URL https://storage.googleapis.com/golang +RUN rm -rf ${GOROOT} \ + && curl -s ${GO_DOWNLOAD_URL}/go${GO_VERSION}.linux-amd64.tar.gz | tar -v -C /usr/local/ -xz \ + && mkdir -p ${GOPATH}/src ${GOPATH}/bin \ + && go version + +RUN mkdir -p ${GOPATH}/src/github.com/coreos/etcd +ADD . ${GOPATH}/src/github.com/coreos/etcd + +RUN go get -v github.com/coreos/gofail \ + && pushd ${GOPATH}/src/github.com/coreos/etcd \ + && GO_BUILD_FLAGS="-v" ./build \ + && cp ./bin/etcd /etcd \ + && cp ./bin/etcdctl /etcdctl \ + && GO_BUILD_FLAGS="-v" FAILPOINTS=1 ./build \ + && cp ./bin/etcd /etcd-failpoints \ + && ./tools/functional-tester/build \ + && cp ./bin/etcd-agent /etcd-agent \ + && cp ./bin/etcd-tester /etcd-tester \ + && cp ./bin/etcd-runner /etcd-runner \ + && go build -v -o /benchmark ./cmd/tools/benchmark \ + && go build -v -o /etcd-test-proxy ./cmd/tools/etcd-test-proxy \ + && popd \ + && rm -rf ${GOPATH}/src/github.com/coreos/etcd diff --git a/vendor/github.com/coreos/etcd/Dockerfile-test b/vendor/github.com/coreos/etcd/Dockerfile-test index 8e0be6a3f..dea3ab0f8 100644 --- a/vendor/github.com/coreos/etcd/Dockerfile-test +++ b/vendor/github.com/coreos/etcd/Dockerfile-test @@ -49,8 +49,9 @@ RUN go get -v -u -tags spell github.com/chzchzchz/goword \ && go get -v -u honnef.co/go/tools/cmd/gosimple \ && go get -v -u honnef.co/go/tools/cmd/unused \ && go get -v -u honnef.co/go/tools/cmd/staticcheck \ - && go get -v -u github.com/wadey/gocovmerge \ + && go get -v -u github.com/gyuho/gocovmerge \ && go get -v -u github.com/gordonklaus/ineffassign \ + && go get -v -u github.com/alexkohler/nakedret \ && /tmp/install-marker.sh amd64 \ && rm -f /tmp/install-marker.sh \ && curl -s https://codecov.io/bash >/codecov \ diff --git a/vendor/github.com/coreos/etcd/NEWS b/vendor/github.com/coreos/etcd/NEWS deleted file mode 100644 index b11975f3b..000000000 --- a/vendor/github.com/coreos/etcd/NEWS +++ /dev/null @@ -1,106 +0,0 @@ -etcd v3.1.6 (2017-04-19) -- remove auth check in Status API -- fill in Auth API response header - -etcd v3.1.5 (2017-03-27) -- add '/etc/nsswitch.conf' file to alpine-based Docker image -- fix raft memory leak issue -- fix Windows file path issues - -etcd v3.1.4 (2017-03-22) - -etcd v3.1.3 (2017-03-10) -- use machine default host when advertise URLs are default - values(localhost:2379,2380) AND if listen URL is 0.0.0.0 -- fix 'etcd gateway' schema handling in DNS discovery -- fix sd_notify behaviors in gateway, grpc-proxy - -etcd v3.1.2 (2017-02-24) -- use IPv4 default host, by default (when IPv4 and IPv6 are available) -- fix 'etcd gateway' with multiple endpoints - -etcd v3.1.1 (2017-02-17) - -etcd v2.3.8 (2017-02-17) - -etcd v3.1.0 (2017-01-20) -- faster linearizable reads (implements Raft read-index) -- automatic leadership transfer when leader steps down -- etcd uses default route IP if advertise URL is not given -- cluster rejects removing members if quorum will be lost -- SRV records (e.g., infra1.example.com) must match the discovery domain - (i.e., example.com) if no custom certificate authority is given - - TLSConfig ServerName is ignored with user-provided certificates - for backwards compatibility; to be deprecated in 3.2 -- discovery now has upper limit for waiting on retries -- etcd flags - - --strict-reconfig-check flag is set by default - - add --log-output flag - - add --metrics flag -- v3 authentication API is now stable -- v3 client - - add SetEndpoints method; update endpoints at runtime - - add Sync method; auto-update endpoints at runtime - - add Lease TimeToLive API; fetch lease information - - replace Config.Logger field with global logger - - Get API responses are sorted in ascending order by default -- v3 etcdctl - - add lease timetolive command - - add --print-value-only flag to get command - - add --dest-prefix flag to make-mirror command - - command get responses are sorted in ascending order by default -- recipes now conform to sessions defined in clientv3/concurrency -- ACI has symlinks to /usr/local/bin/etcd* -- warn on binding listeners through domain names; to be deprecated in 3.2 -- experimental gRPC proxy feature - -etcd v3.0.16 (2017-01-13) - -etcd v3.0.15 (2016-11-11) -- fix cancel watch request with wrong range end - -etcd v3.0.14 (2016-11-04) -- v3 etcdctl migrate command now supports --no-ttl flag to discard keys on transform - -etcd v3.0.13 (2016-10-24) - -etcd v3.0.12 (2016-10-07) - -etcd v3.0.11 (2016-10-07) -- server returns previous key-value (optional) - - clientv3 WithPrevKV option - - v3 etcdctl put,watch,del --prev-kv flag - -etcd v3.0.10 (2016-09-23) - -etcd v3.0.9 (2016-09-15) -- warn on domain names on listen URLs (v3.2 will reject domain names) - -etcd v3.0.8 (2016-09-09) -- allow only IP addresses in listen URLs (domain names are rejected) - -etcd v3.0.7 (2016-08-31) -- SRV records only allow A records (RFC 2052) - -etcd v3.0.6 (2016-08-19) - -etcd v3.0.5 (2016-08-19) -- SRV records (e.g., infra1.example.com) must match the discovery domain - (i.e., example.com) if no custom certificate authority is given - -etcd v3.0.4 (2016-07-27) -- v2 auth can now use common name from TLS certificate when --client-cert-auth is enabled -- v2 etcdctl ls command now supports --output=json -- Add /var/lib/etcd directory to etcd official Docker image - -etcd v3.0.3 (2016-07-15) -- Revert Dockerfile to use CMD, instead of ENTRYPOINT, to support etcdctl run -- Docker commands for v3.0.2 won't work without specifying executable binary paths -- v3 etcdctl default endpoints are now 127.0.0.1:2379 - -etcd v3.0.2 (2016-07-08) -- Dockerfile uses ENTRYPOINT, instead of CMD, to run etcd without binary path specified - -etcd v3.0.1 (2016-07-01) - -etcd v3.0.0 (2016-06-30) diff --git a/vendor/github.com/coreos/etcd/Procfile b/vendor/github.com/coreos/etcd/Procfile index 41dd49f1c..868967c0e 100644 --- a/vendor/github.com/coreos/etcd/Procfile +++ b/vendor/github.com/coreos/etcd/Procfile @@ -2,5 +2,4 @@ etcd1: bin/etcd --name infra1 --listen-client-urls http://127.0.0.1:2379 --advertise-client-urls http://127.0.0.1:2379 --listen-peer-urls http://127.0.0.1:12380 --initial-advertise-peer-urls http://127.0.0.1:12380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --initial-cluster-state new --enable-pprof etcd2: bin/etcd --name infra2 --listen-client-urls http://127.0.0.1:22379 --advertise-client-urls http://127.0.0.1:22379 --listen-peer-urls http://127.0.0.1:22380 --initial-advertise-peer-urls http://127.0.0.1:22380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --initial-cluster-state new --enable-pprof etcd3: bin/etcd --name infra3 --listen-client-urls http://127.0.0.1:32379 --advertise-client-urls http://127.0.0.1:32379 --listen-peer-urls http://127.0.0.1:32380 --initial-advertise-peer-urls http://127.0.0.1:32380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --initial-cluster-state new --enable-pprof -# in future, use proxy to listen on 2379 -#proxy: bin/etcd --name infra-proxy1 --proxy=on --listen-client-urls http://127.0.0.1:2378 --initial-cluster 'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --enable-pprof +#proxy: bin/etcd grpc-proxy start --endpoints=127.0.0.1:2379,127.0.0.1:22379,127.0.0.1:32379 --listen-addr=127.0.0.1:23790 --advertise-client-url=127.0.0.1:23790 --enable-pprof diff --git a/vendor/github.com/coreos/etcd/Procfile.v2 b/vendor/github.com/coreos/etcd/Procfile.v2 new file mode 100644 index 000000000..41dd49f1c --- /dev/null +++ b/vendor/github.com/coreos/etcd/Procfile.v2 @@ -0,0 +1,6 @@ +# Use goreman to run `go get github.com/mattn/goreman` +etcd1: bin/etcd --name infra1 --listen-client-urls http://127.0.0.1:2379 --advertise-client-urls http://127.0.0.1:2379 --listen-peer-urls http://127.0.0.1:12380 --initial-advertise-peer-urls http://127.0.0.1:12380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --initial-cluster-state new --enable-pprof +etcd2: bin/etcd --name infra2 --listen-client-urls http://127.0.0.1:22379 --advertise-client-urls http://127.0.0.1:22379 --listen-peer-urls http://127.0.0.1:22380 --initial-advertise-peer-urls http://127.0.0.1:22380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --initial-cluster-state new --enable-pprof +etcd3: bin/etcd --name infra3 --listen-client-urls http://127.0.0.1:32379 --advertise-client-urls http://127.0.0.1:32379 --listen-peer-urls http://127.0.0.1:32380 --initial-advertise-peer-urls http://127.0.0.1:32380 --initial-cluster-token etcd-cluster-1 --initial-cluster 'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --initial-cluster-state new --enable-pprof +# in future, use proxy to listen on 2379 +#proxy: bin/etcd --name infra-proxy1 --proxy=on --listen-client-urls http://127.0.0.1:2378 --initial-cluster 'infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380' --enable-pprof diff --git a/vendor/github.com/coreos/etcd/README.md b/vendor/github.com/coreos/etcd/README.md index 8ab28492c..2b559014e 100644 --- a/vendor/github.com/coreos/etcd/README.md +++ b/vendor/github.com/coreos/etcd/README.md @@ -1,9 +1,12 @@ # etcd -[![Go Report Card](https://goreportcard.com/badge/github.com/coreos/etcd)](https://goreportcard.com/report/github.com/coreos/etcd) -[![Build Status](https://travis-ci.org/coreos/etcd.svg?branch=master)](https://travis-ci.org/coreos/etcd) -[![Build Status](https://semaphoreci.com/api/v1/coreos/etcd/branches/master/shields_badge.svg)](https://semaphoreci.com/coreos/etcd) -[![Docker Repository on Quay.io](https://quay.io/repository/coreos/etcd-git/status "Docker Repository on Quay.io")](https://quay.io/repository/coreos/etcd-git) +[![Go Report Card](https://goreportcard.com/badge/github.com/coreos/etcd?style=flat-square)](https://goreportcard.com/report/github.com/coreos/etcd) +[![Coverage](https://codecov.io/gh/coreos/etcd/branch/master/graph/badge.svg)](https://codecov.io/gh/coreos/etcd) +[![Build Status Travis](https://img.shields.io/travis/coreos/etcdlabs.svg?style=flat-square&&branch=master)](https://travis-ci.org/coreos/etcd) +[![Build Status Semaphore](https://semaphoreci.com/api/v1/coreos/etcd/branches/master/shields_badge.svg)](https://semaphoreci.com/coreos/etcd) +[![Godoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](https://godoc.org/github.com/coreos/etcd) +[![Releases](https://img.shields.io/github/release/coreos/etcd/all.svg?style=flat-square)](https://github.com/coreos/etcd/releases) +[![LICENSE](https://img.shields.io/github/license/coreos/etcd.svg?style=flat-square)](https://github.com/coreos/etcd/blob/master/LICENSE) **Note**: The `master` branch may be in an *unstable or even broken state* during development. Please use [releases][github-release] instead of the `master` branch in order to get stable binaries. @@ -33,13 +36,21 @@ See [etcdctl][etcdctl] for a simple command line client. [etcdctl]: https://github.com/coreos/etcd/tree/master/etcdctl [etcd-tests]: http://dash.etcd.io +## Community meetings + +etcd contributors and maintainers have bi-weekly meetings at 11:00 AM (USA Pacific) on Tuesdays. There is an [iCalendar][rfc5545] format for the meetings [here](meeting.ics). Anyone is welcome to join via [Zoom][zoom] or audio-only: +1 669 900 6833. An initial agenda will be posted to the [shared Google docs][shared-meeting-notes] a day before each meeting, and everyone is welcome to suggest additional topics or other agendas. + +[rfc5545]: https://tools.ietf.org/html/rfc5545 +[zoom]: https://coreos.zoom.us/j/854793406 +[shared-meeting-notes]: https://docs.google.com/document/d/1DbVXOHvd9scFsSmL2oNg4YGOHJdXqtx583DmeVWrB_M/edit# + ## Getting started ### Getting etcd The easiest way to get etcd is to use one of the pre-built release binaries which are available for OSX, Linux, Windows, [rkt][rkt], and Docker. Instructions for using these binaries are on the [GitHub releases page][github-release]. -For those wanting to try the very latest version, [build the latest version of etcd][dl-build] from the `master` branch. This first needs [*Go*](https://golang.org/) installed (version 1.8+ is required). All development occurs on `master`, including new features and bug fixes. Bug fixes are first targeted at `master` and subsequently ported to release branches, as described in the [branch management][branch-management] guide. +For those wanting to try the very latest version, [build the latest version of etcd][dl-build] from the `master` branch. This first needs [*Go*](https://golang.org/) installed (version 1.9+ is required). All development occurs on `master`, including new features and bug fixes. Bug fixes are first targeted at `master` and subsequently ported to release branches, as described in the [branch management][branch-management] guide. [rkt]: https://github.com/rkt/rkt/releases/ [github-release]: https://github.com/coreos/etcd/releases/ @@ -48,7 +59,22 @@ For those wanting to try the very latest version, [build the latest version of e ### Running etcd -First start a single-member cluster of etcd: +First start a single-member cluster of etcd. + +If etcd is installed using the [pre-built release binaries][github-release], run it from the installation location as below: + +```sh +/tmp/etcd-download-test/etcd +``` +The etcd command can be simply run as such if it is moved to the system path as below: + +```sh +mv /tmp/etcd-download-test/etcd /usr/locale/bin/ + +etcd +``` + +If etcd is [build from the master branch][dl-build], run it as below: ```sh ./bin/etcd @@ -87,7 +113,7 @@ Our [Procfile script](./Procfile) will set up a local example cluster. Start it goreman start ``` -This will bring up 3 etcd members `infra1`, `infra2` and `infra3` and etcd proxy `proxy`, which runs locally and composes a cluster. +This will bring up 3 etcd members `infra1`, `infra2` and `infra3` and etcd `grpc-proxy`, which runs locally and composes a cluster. Every cluster member and proxy accepts key value reads and key value writes. diff --git a/vendor/github.com/coreos/etcd/bill-of-materials.json b/vendor/github.com/coreos/etcd/bill-of-materials.json index 1afbc70c2..d22f6caba 100644 --- a/vendor/github.com/coreos/etcd/bill-of-materials.json +++ b/vendor/github.com/coreos/etcd/bill-of-materials.json @@ -26,15 +26,6 @@ } ] }, - { - "project": "github.com/cockroachdb/cmux", - "licenses": [ - { - "type": "Apache License 2.0", - "confidence": 1 - } - ] - }, { "project": "github.com/coreos/bbolt", "licenses": [ @@ -117,7 +108,7 @@ ] }, { - "project": "github.com/gogo/protobuf/proto", + "project": "github.com/gogo/protobuf", "licenses": [ { "type": "BSD 3-clause \"New\" or \"Revised\" License", @@ -152,6 +143,15 @@ } ] }, + { + "project": "github.com/gorilla/websocket", + "licenses": [ + { + "type": "BSD 2-clause \"Simplified\" License", + "confidence": 0.9852216748768473 + } + ] + }, { "project": "github.com/grpc-ecosystem/go-grpc-prometheus", "licenses": [ @@ -264,6 +264,24 @@ } ] }, + { + "project": "github.com/sirupsen/logrus", + "licenses": [ + { + "type": "MIT License", + "confidence": 1 + } + ] + }, + { + "project": "github.com/soheilhy/cmux", + "licenses": [ + { + "type": "Apache License 2.0", + "confidence": 1 + } + ] + }, { "project": "github.com/spf13/cobra", "licenses": [ @@ -282,6 +300,15 @@ } ] }, + { + "project": "github.com/tmc/grpc-websocket-proxy/wsproxy", + "licenses": [ + { + "type": "MIT License", + "confidence": 0.9891304347826086 + } + ] + }, { "project": "github.com/ugorji/go/codec", "licenses": [ @@ -327,6 +354,15 @@ } ] }, + { + "project": "golang.org/x/sys/unix", + "licenses": [ + { + "type": "BSD 3-clause \"New\" or \"Revised\" License", + "confidence": 0.9663865546218487 + } + ] + }, { "project": "golang.org/x/text", "licenses": [ @@ -346,7 +382,7 @@ ] }, { - "project": "google.golang.org/genproto/googleapis", + "project": "google.golang.org/genproto/googleapis/rpc/status", "licenses": [ { "type": "Apache License 2.0", diff --git a/vendor/github.com/coreos/etcd/build b/vendor/github.com/coreos/etcd/build index 36be42eb2..b233d3272 100755 --- a/vendor/github.com/coreos/etcd/build +++ b/vendor/github.com/coreos/etcd/build @@ -4,7 +4,7 @@ ORG_PATH="github.com/coreos" REPO_PATH="${ORG_PATH}/etcd" -GIT_SHA=`git rev-parse --short HEAD || echo "GitNotFound"` +GIT_SHA=$(git rev-parse --short HEAD || echo "GitNotFound") if [ ! -z "$FAILPOINTS" ]; then GIT_SHA="$GIT_SHA"-FAILPOINTS fi @@ -14,10 +14,9 @@ GO_LDFLAGS="$GO_LDFLAGS -X ${REPO_PATH}/cmd/vendor/${REPO_PATH}/version.GitSHA=$ # enable/disable failpoints toggle_failpoints() { - FAILPKGS="etcdserver/ mvcc/backend/" mode="$1" if which gofail >/dev/null 2>&1; then - gofail "$mode" $FAILPKGS + gofail "$mode" etcdserver/ mvcc/backend/ elif [ "$mode" != "disable" ]; then echo "FAILPOINTS set but gofail not found" exit 1 @@ -34,9 +33,12 @@ etcd_build() { out="bin" if [ -n "${BINDIR}" ]; then out="${BINDIR}"; fi toggle_failpoints_default - # Static compilation is useful when etcd is run in a container - CGO_ENABLED=0 go build $GO_BUILD_FLAGS -installsuffix cgo -ldflags "$GO_LDFLAGS" -o ${out}/etcd ${REPO_PATH}/cmd/etcd || return - CGO_ENABLED=0 go build $GO_BUILD_FLAGS -installsuffix cgo -ldflags "$GO_LDFLAGS" -o ${out}/etcdctl ${REPO_PATH}/cmd/etcdctl || return + # Static compilation is useful when etcd is run in a container. $GO_BUILD_FLAGS is OK + + # shellcheck disable=SC2086 + CGO_ENABLED=0 go build $GO_BUILD_FLAGS -installsuffix cgo -ldflags "$GO_LDFLAGS" -o "${out}/etcd" ${REPO_PATH}/cmd/etcd || return + # shellcheck disable=SC2086 + CGO_ENABLED=0 go build $GO_BUILD_FLAGS -installsuffix cgo -ldflags "$GO_LDFLAGS" -o "${out}/etcdctl" ${REPO_PATH}/cmd/etcdctl || return } etcd_setup_gopath() { @@ -49,9 +51,9 @@ etcd_setup_gopath() { GOPATH=":$GOPATH" fi export GOPATH=${etcdGOPATH}$GOPATH - rm -rf ${etcdGOPATH}/src - mkdir -p ${etcdGOPATH} - ln -s ${CDIR}/cmd/vendor ${etcdGOPATH}/src + rm -rf "${etcdGOPATH}/src" + mkdir -p "${etcdGOPATH}" + ln -s "${CDIR}/cmd/vendor" "${etcdGOPATH}/src" } toggle_failpoints_default diff --git a/vendor/github.com/coreos/etcd/client/README.md b/vendor/github.com/coreos/etcd/client/README.md index c0ec81901..2be731ede 100644 --- a/vendor/github.com/coreos/etcd/client/README.md +++ b/vendor/github.com/coreos/etcd/client/README.md @@ -25,8 +25,8 @@ package main import ( "log" "time" + "context" - "golang.org/x/net/context" "github.com/coreos/etcd/client" ) diff --git a/vendor/github.com/coreos/etcd/client/auth_role.go b/vendor/github.com/coreos/etcd/client/auth_role.go index d15e00dd7..b6ba7e150 100644 --- a/vendor/github.com/coreos/etcd/client/auth_role.go +++ b/vendor/github.com/coreos/etcd/client/auth_role.go @@ -16,11 +16,10 @@ package client import ( "bytes" + "context" "encoding/json" "net/http" "net/url" - - "golang.org/x/net/context" ) type Role struct { diff --git a/vendor/github.com/coreos/etcd/client/auth_user.go b/vendor/github.com/coreos/etcd/client/auth_user.go index 97c3f3181..8e7e2efe8 100644 --- a/vendor/github.com/coreos/etcd/client/auth_user.go +++ b/vendor/github.com/coreos/etcd/client/auth_user.go @@ -16,12 +16,11 @@ package client import ( "bytes" + "context" "encoding/json" "net/http" "net/url" "path" - - "golang.org/x/net/context" ) var ( diff --git a/vendor/github.com/coreos/etcd/client/client.go b/vendor/github.com/coreos/etcd/client/client.go index 19ce2ec01..e68745056 100644 --- a/vendor/github.com/coreos/etcd/client/client.go +++ b/vendor/github.com/coreos/etcd/client/client.go @@ -15,6 +15,7 @@ package client import ( + "context" "encoding/json" "errors" "fmt" @@ -29,8 +30,6 @@ import ( "time" "github.com/coreos/etcd/version" - - "golang.org/x/net/context" ) var ( @@ -671,8 +670,15 @@ func (r *redirectedHTTPAction) HTTPRequest(ep url.URL) *http.Request { } func shuffleEndpoints(r *rand.Rand, eps []url.URL) []url.URL { - p := r.Perm(len(eps)) - neps := make([]url.URL, len(eps)) + // copied from Go 1.9<= rand.Rand.Perm + n := len(eps) + p := make([]int, n) + for i := 0; i < n; i++ { + j := r.Intn(i + 1) + p[i] = p[j] + p[j] = i + } + neps := make([]url.URL, n) for i, k := range p { neps[i] = eps[k] } diff --git a/vendor/github.com/coreos/etcd/client/client_test.go b/vendor/github.com/coreos/etcd/client/client_test.go index 71c1b1340..40328a1e9 100644 --- a/vendor/github.com/coreos/etcd/client/client_test.go +++ b/vendor/github.com/coreos/etcd/client/client_test.go @@ -15,6 +15,7 @@ package client import ( + "context" "errors" "fmt" "io" @@ -30,7 +31,6 @@ import ( "github.com/coreos/etcd/pkg/testutil" "github.com/coreos/etcd/version" - "golang.org/x/net/context" ) type actionAssertingHTTPClient struct { diff --git a/vendor/github.com/coreos/etcd/client/doc.go b/vendor/github.com/coreos/etcd/client/doc.go index 32fdfb52c..ad4eca4e1 100644 --- a/vendor/github.com/coreos/etcd/client/doc.go +++ b/vendor/github.com/coreos/etcd/client/doc.go @@ -19,9 +19,9 @@ Create a Config and exchange it for a Client: import ( "net/http" + "context" "github.com/coreos/etcd/client" - "golang.org/x/net/context" ) cfg := client.Config{ @@ -59,7 +59,7 @@ Use a custom context to set timeouts on your operations: ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() - // set a new key, ignoring it's previous state + // set a new key, ignoring its previous state _, err := kAPI.Set(ctx, "/ping", "pong", nil) if err != nil { if err == context.DeadlineExceeded { diff --git a/vendor/github.com/coreos/etcd/client/example_keys_test.go b/vendor/github.com/coreos/etcd/client/example_keys_test.go new file mode 100644 index 000000000..66063571d --- /dev/null +++ b/vendor/github.com/coreos/etcd/client/example_keys_test.go @@ -0,0 +1,93 @@ +// Copyright 2017 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package client_test + +import ( + "context" + "fmt" + "log" + "sort" + + "github.com/coreos/etcd/client" +) + +func ExampleKeysAPI_directory() { + c, err := client.New(client.Config{ + Endpoints: exampleEndpoints, + Transport: exampleTransport, + }) + if err != nil { + log.Fatal(err) + } + kapi := client.NewKeysAPI(c) + + // Setting '/myNodes' to create a directory that will hold some keys. + o := client.SetOptions{Dir: true} + resp, err := kapi.Set(context.Background(), "/myNodes", "", &o) + if err != nil { + log.Fatal(err) + } + + // Add keys to /myNodes directory. + resp, err = kapi.Set(context.Background(), "/myNodes/key1", "value1", nil) + if err != nil { + log.Fatal(err) + } + resp, err = kapi.Set(context.Background(), "/myNodes/key2", "value2", nil) + if err != nil { + log.Fatal(err) + } + + // fetch directory + resp, err = kapi.Get(context.Background(), "/myNodes", nil) + if err != nil { + log.Fatal(err) + } + // print directory keys + sort.Sort(resp.Node.Nodes) + for _, n := range resp.Node.Nodes { + fmt.Printf("Key: %q, Value: %q\n", n.Key, n.Value) + } + + // Output: + // Key: "/myNodes/key1", Value: "value1" + // Key: "/myNodes/key2", Value: "value2" +} + +func ExampleKeysAPI_setget() { + c, err := client.New(client.Config{ + Endpoints: exampleEndpoints, + Transport: exampleTransport, + }) + if err != nil { + log.Fatal(err) + } + kapi := client.NewKeysAPI(c) + + // Set key "/foo" to value "bar". + resp, err := kapi.Set(context.Background(), "/foo", "bar", nil) + if err != nil { + log.Fatal(err) + } + // Get key "/foo" + resp, err = kapi.Get(context.Background(), "/foo", nil) + if err != nil { + log.Fatal(err) + } + + fmt.Printf("%q key has %q value\n", resp.Node.Key, resp.Node.Value) + + // Output: "/foo" key has "bar" value +} diff --git a/vendor/github.com/coreos/etcd/client/keys.generated.go b/vendor/github.com/coreos/etcd/client/keys.generated.go index 216139c9c..237fdbe8f 100644 --- a/vendor/github.com/coreos/etcd/client/keys.generated.go +++ b/vendor/github.com/coreos/etcd/client/keys.generated.go @@ -8,49 +8,50 @@ package client import ( "errors" "fmt" - codec1978 "github.com/ugorji/go/codec" "reflect" "runtime" time "time" + + codec1978 "github.com/ugorji/go/codec" ) const ( // ----- content types ---- - codecSelferC_UTF81819 = 1 - codecSelferC_RAW1819 = 0 + codecSelferC_UTF87612 = 1 + codecSelferC_RAW7612 = 0 // ----- value types used ---- - codecSelferValueTypeArray1819 = 10 - codecSelferValueTypeMap1819 = 9 + codecSelferValueTypeArray7612 = 10 + codecSelferValueTypeMap7612 = 9 // ----- containerStateValues ---- - codecSelfer_containerMapKey1819 = 2 - codecSelfer_containerMapValue1819 = 3 - codecSelfer_containerMapEnd1819 = 4 - codecSelfer_containerArrayElem1819 = 6 - codecSelfer_containerArrayEnd1819 = 7 + codecSelfer_containerMapKey7612 = 2 + codecSelfer_containerMapValue7612 = 3 + codecSelfer_containerMapEnd7612 = 4 + codecSelfer_containerArrayElem7612 = 6 + codecSelfer_containerArrayEnd7612 = 7 ) var ( - codecSelferBitsize1819 = uint8(reflect.TypeOf(uint(0)).Bits()) - codecSelferOnlyMapOrArrayEncodeToStructErr1819 = errors.New(`only encoded map or array can be decoded into a struct`) + codecSelferBitsize7612 = uint8(reflect.TypeOf(uint(0)).Bits()) + codecSelferOnlyMapOrArrayEncodeToStructErr7612 = errors.New(`only encoded map or array can be decoded into a struct`) ) -type codecSelfer1819 struct{} +type codecSelfer7612 struct{} func init() { - if codec1978.GenVersion != 5 { + if codec1978.GenVersion != 8 { _, file, _, _ := runtime.Caller(0) err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", - 5, codec1978.GenVersion, file) + 8, codec1978.GenVersion, file) panic(err) } if false { // reference the types, but skip this branch at build/run time - var v0 time.Time + var v0 time.Duration _ = v0 } } -func (x *Response) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer1819 +func (x *Error) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer7612 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { @@ -63,86 +64,100 @@ func (x *Response) CodecEncodeSelf(e *codec1978.Encoder) { } else { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray - var yyq2 [3]bool - _, _, _ = yysep2, yyq2, yy2arr2 + _, _ = yysep2, yy2arr2 const yyr2 bool = false - var yynn2 int if yyr2 || yy2arr2 { - r.EncodeArrayStart(3) + r.WriteArrayStart(4) } else { - yynn2 = 3 - for _, b := range yyq2 { - if b { - yynn2++ - } - } - r.EncodeMapStart(yynn2) - yynn2 = 0 + r.WriteMapStart(4) } if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem1819) + r.WriteArrayElem() yym4 := z.EncBinary() _ = yym4 if false { } else { - r.EncodeString(codecSelferC_UTF81819, string(x.Action)) + r.EncodeInt(int64(x.Code)) } } else { - z.EncSendContainerState(codecSelfer_containerMapKey1819) - r.EncodeString(codecSelferC_UTF81819, string("action")) - z.EncSendContainerState(codecSelfer_containerMapValue1819) + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("errorCode")) + r.WriteMapElemValue() yym5 := z.EncBinary() _ = yym5 if false { } else { - r.EncodeString(codecSelferC_UTF81819, string(x.Action)) + r.EncodeInt(int64(x.Code)) } } if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem1819) - if x.Node == nil { - r.EncodeNil() + r.WriteArrayElem() + yym7 := z.EncBinary() + _ = yym7 + if false { } else { - x.Node.CodecEncodeSelf(e) + r.EncodeString(codecSelferC_UTF87612, string(x.Message)) } } else { - z.EncSendContainerState(codecSelfer_containerMapKey1819) - r.EncodeString(codecSelferC_UTF81819, string("node")) - z.EncSendContainerState(codecSelfer_containerMapValue1819) - if x.Node == nil { - r.EncodeNil() + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("message")) + r.WriteMapElemValue() + yym8 := z.EncBinary() + _ = yym8 + if false { } else { - x.Node.CodecEncodeSelf(e) + r.EncodeString(codecSelferC_UTF87612, string(x.Message)) } } if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem1819) - if x.PrevNode == nil { - r.EncodeNil() + r.WriteArrayElem() + yym10 := z.EncBinary() + _ = yym10 + if false { } else { - x.PrevNode.CodecEncodeSelf(e) + r.EncodeString(codecSelferC_UTF87612, string(x.Cause)) } } else { - z.EncSendContainerState(codecSelfer_containerMapKey1819) - r.EncodeString(codecSelferC_UTF81819, string("prevNode")) - z.EncSendContainerState(codecSelfer_containerMapValue1819) - if x.PrevNode == nil { - r.EncodeNil() + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("cause")) + r.WriteMapElemValue() + yym11 := z.EncBinary() + _ = yym11 + if false { } else { - x.PrevNode.CodecEncodeSelf(e) + r.EncodeString(codecSelferC_UTF87612, string(x.Cause)) } } if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayEnd1819) + r.WriteArrayElem() + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeUint(uint64(x.Index)) + } } else { - z.EncSendContainerState(codecSelfer_containerMapEnd1819) + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("index")) + r.WriteMapElemValue() + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeUint(uint64(x.Index)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayEnd() + } else { + r.WriteMapEnd() } } } } -func (x *Response) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer1819 +func (x *Error) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer7612 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r yym1 := z.DecBinary() @@ -151,28 +166,28 @@ func (x *Response) CodecDecodeSelf(d *codec1978.Decoder) { } else if z.HasExtensions() && z.DecExt(x) { } else { yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap1819 { + if yyct2 == codecSelferValueTypeMap7612 { yyl2 := r.ReadMapStart() if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerMapEnd1819) + r.ReadMapEnd() } else { x.codecDecodeSelfFromMap(yyl2, d) } - } else if yyct2 == codecSelferValueTypeArray1819 { + } else if yyct2 == codecSelferValueTypeArray7612 { yyl2 := r.ReadArrayStart() if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerArrayEnd1819) + r.ReadArrayEnd() } else { x.codecDecodeSelfFromArray(yyl2, d) } } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr1819) + panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) } } } -func (x *Response) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer1819 +func (x *Error) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer7612 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yys3Slc = z.DecScratchBuffer() // default slice to decode into @@ -188,10 +203,1816 @@ func (x *Response) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - z.DecSendContainerState(codecSelfer_containerMapKey1819) - yys3Slc = r.DecodeBytes(yys3Slc, true, true) + r.ReadMapElemKey() + yys3Slc = r.DecodeStringAsBytes() yys3 := string(yys3Slc) - z.DecSendContainerState(codecSelfer_containerMapValue1819) + r.ReadMapElemValue() + switch yys3 { + case "errorCode": + if r.TryDecodeAsNil() { + x.Code = 0 + } else { + yyv4 := &x.Code + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + *((*int)(yyv4)) = int(r.DecodeInt(codecSelferBitsize7612)) + } + } + case "message": + if r.TryDecodeAsNil() { + x.Message = "" + } else { + yyv6 := &x.Message + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + *((*string)(yyv6)) = r.DecodeString() + } + } + case "cause": + if r.TryDecodeAsNil() { + x.Cause = "" + } else { + yyv8 := &x.Cause + yym9 := z.DecBinary() + _ = yym9 + if false { + } else { + *((*string)(yyv8)) = r.DecodeString() + } + } + case "index": + if r.TryDecodeAsNil() { + x.Index = 0 + } else { + yyv10 := &x.Index + yym11 := z.DecBinary() + _ = yym11 + if false { + } else { + *((*uint64)(yyv10)) = uint64(r.DecodeUint(64)) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + r.ReadMapEnd() +} + +func (x *Error) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Code = 0 + } else { + yyv13 := &x.Code + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + *((*int)(yyv13)) = int(r.DecodeInt(codecSelferBitsize7612)) + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Message = "" + } else { + yyv15 := &x.Message + yym16 := z.DecBinary() + _ = yym16 + if false { + } else { + *((*string)(yyv15)) = r.DecodeString() + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Cause = "" + } else { + yyv17 := &x.Cause + yym18 := z.DecBinary() + _ = yym18 + if false { + } else { + *((*string)(yyv17)) = r.DecodeString() + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Index = 0 + } else { + yyv19 := &x.Index + yym20 := z.DecBinary() + _ = yym20 + if false { + } else { + *((*uint64)(yyv19)) = uint64(r.DecodeUint(64)) + } + } + for { + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + break + } + r.ReadArrayElem() + z.DecStructFieldNotFound(yyj12-1, "") + } + r.ReadArrayEnd() +} + +func (x PrevExistType) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x)) + } +} + +func (x *PrevExistType) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + *((*string)(x)) = r.DecodeString() + } +} + +func (x *WatcherOptions) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false + if yyr2 || yy2arr2 { + r.WriteArrayStart(2) + } else { + r.WriteMapStart(2) + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeUint(uint64(x.AfterIndex)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("AfterIndex")) + r.WriteMapElemValue() + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeUint(uint64(x.AfterIndex)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeBool(bool(x.Recursive)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Recursive")) + r.WriteMapElemValue() + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeBool(bool(x.Recursive)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayEnd() + } else { + r.WriteMapEnd() + } + } + } +} + +func (x *WatcherOptions) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap7612 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + r.ReadMapEnd() + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray7612 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + r.ReadArrayEnd() + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) + } + } +} + +func (x *WatcherOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + r.ReadMapElemKey() + yys3Slc = r.DecodeStringAsBytes() + yys3 := string(yys3Slc) + r.ReadMapElemValue() + switch yys3 { + case "AfterIndex": + if r.TryDecodeAsNil() { + x.AfterIndex = 0 + } else { + yyv4 := &x.AfterIndex + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + *((*uint64)(yyv4)) = uint64(r.DecodeUint(64)) + } + } + case "Recursive": + if r.TryDecodeAsNil() { + x.Recursive = false + } else { + yyv6 := &x.Recursive + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + *((*bool)(yyv6)) = r.DecodeBool() + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + r.ReadMapEnd() +} + +func (x *WatcherOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj8 int + var yyb8 bool + var yyhl8 bool = l >= 0 + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.AfterIndex = 0 + } else { + yyv9 := &x.AfterIndex + yym10 := z.DecBinary() + _ = yym10 + if false { + } else { + *((*uint64)(yyv9)) = uint64(r.DecodeUint(64)) + } + } + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Recursive = false + } else { + yyv11 := &x.Recursive + yym12 := z.DecBinary() + _ = yym12 + if false { + } else { + *((*bool)(yyv11)) = r.DecodeBool() + } + } + for { + yyj8++ + if yyhl8 { + yyb8 = yyj8 > l + } else { + yyb8 = r.CheckBreak() + } + if yyb8 { + break + } + r.ReadArrayElem() + z.DecStructFieldNotFound(yyj8-1, "") + } + r.ReadArrayEnd() +} + +func (x *CreateInOrderOptions) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false + if yyr2 || yy2arr2 { + r.WriteArrayStart(1) + } else { + r.WriteMapStart(1) + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym4 := z.EncBinary() + _ = yym4 + if false { + } else if z.HasExtensions() && z.EncExt(x.TTL) { + } else { + r.EncodeInt(int64(x.TTL)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("TTL")) + r.WriteMapElemValue() + yym5 := z.EncBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.EncExt(x.TTL) { + } else { + r.EncodeInt(int64(x.TTL)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayEnd() + } else { + r.WriteMapEnd() + } + } + } +} + +func (x *CreateInOrderOptions) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap7612 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + r.ReadMapEnd() + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray7612 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + r.ReadArrayEnd() + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) + } + } +} + +func (x *CreateInOrderOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + r.ReadMapElemKey() + yys3Slc = r.DecodeStringAsBytes() + yys3 := string(yys3Slc) + r.ReadMapElemValue() + switch yys3 { + case "TTL": + if r.TryDecodeAsNil() { + x.TTL = 0 + } else { + yyv4 := &x.TTL + yym5 := z.DecBinary() + _ = yym5 + if false { + } else if z.HasExtensions() && z.DecExt(yyv4) { + } else { + *((*int64)(yyv4)) = int64(r.DecodeInt(64)) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + r.ReadMapEnd() +} + +func (x *CreateInOrderOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj6 int + var yyb6 bool + var yyhl6 bool = l >= 0 + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.TTL = 0 + } else { + yyv7 := &x.TTL + yym8 := z.DecBinary() + _ = yym8 + if false { + } else if z.HasExtensions() && z.DecExt(yyv7) { + } else { + *((*int64)(yyv7)) = int64(r.DecodeInt(64)) + } + } + for { + yyj6++ + if yyhl6 { + yyb6 = yyj6 > l + } else { + yyb6 = r.CheckBreak() + } + if yyb6 { + break + } + r.ReadArrayElem() + z.DecStructFieldNotFound(yyj6-1, "") + } + r.ReadArrayEnd() +} + +func (x *SetOptions) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false + if yyr2 || yy2arr2 { + r.WriteArrayStart(7) + } else { + r.WriteMapStart(7) + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.PrevValue)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("PrevValue")) + r.WriteMapElemValue() + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.PrevValue)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeUint(uint64(x.PrevIndex)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("PrevIndex")) + r.WriteMapElemValue() + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeUint(uint64(x.PrevIndex)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + x.PrevExist.CodecEncodeSelf(e) + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("PrevExist")) + r.WriteMapElemValue() + x.PrevExist.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym13 := z.EncBinary() + _ = yym13 + if false { + } else if z.HasExtensions() && z.EncExt(x.TTL) { + } else { + r.EncodeInt(int64(x.TTL)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("TTL")) + r.WriteMapElemValue() + yym14 := z.EncBinary() + _ = yym14 + if false { + } else if z.HasExtensions() && z.EncExt(x.TTL) { + } else { + r.EncodeInt(int64(x.TTL)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeBool(bool(x.Refresh)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Refresh")) + r.WriteMapElemValue() + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeBool(bool(x.Refresh)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeBool(bool(x.Dir)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Dir")) + r.WriteMapElemValue() + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeBool(bool(x.Dir)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym22 := z.EncBinary() + _ = yym22 + if false { + } else { + r.EncodeBool(bool(x.NoValueOnSuccess)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("NoValueOnSuccess")) + r.WriteMapElemValue() + yym23 := z.EncBinary() + _ = yym23 + if false { + } else { + r.EncodeBool(bool(x.NoValueOnSuccess)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayEnd() + } else { + r.WriteMapEnd() + } + } + } +} + +func (x *SetOptions) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap7612 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + r.ReadMapEnd() + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray7612 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + r.ReadArrayEnd() + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) + } + } +} + +func (x *SetOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + r.ReadMapElemKey() + yys3Slc = r.DecodeStringAsBytes() + yys3 := string(yys3Slc) + r.ReadMapElemValue() + switch yys3 { + case "PrevValue": + if r.TryDecodeAsNil() { + x.PrevValue = "" + } else { + yyv4 := &x.PrevValue + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + *((*string)(yyv4)) = r.DecodeString() + } + } + case "PrevIndex": + if r.TryDecodeAsNil() { + x.PrevIndex = 0 + } else { + yyv6 := &x.PrevIndex + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + *((*uint64)(yyv6)) = uint64(r.DecodeUint(64)) + } + } + case "PrevExist": + if r.TryDecodeAsNil() { + x.PrevExist = "" + } else { + yyv8 := &x.PrevExist + yyv8.CodecDecodeSelf(d) + } + case "TTL": + if r.TryDecodeAsNil() { + x.TTL = 0 + } else { + yyv9 := &x.TTL + yym10 := z.DecBinary() + _ = yym10 + if false { + } else if z.HasExtensions() && z.DecExt(yyv9) { + } else { + *((*int64)(yyv9)) = int64(r.DecodeInt(64)) + } + } + case "Refresh": + if r.TryDecodeAsNil() { + x.Refresh = false + } else { + yyv11 := &x.Refresh + yym12 := z.DecBinary() + _ = yym12 + if false { + } else { + *((*bool)(yyv11)) = r.DecodeBool() + } + } + case "Dir": + if r.TryDecodeAsNil() { + x.Dir = false + } else { + yyv13 := &x.Dir + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + *((*bool)(yyv13)) = r.DecodeBool() + } + } + case "NoValueOnSuccess": + if r.TryDecodeAsNil() { + x.NoValueOnSuccess = false + } else { + yyv15 := &x.NoValueOnSuccess + yym16 := z.DecBinary() + _ = yym16 + if false { + } else { + *((*bool)(yyv15)) = r.DecodeBool() + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + r.ReadMapEnd() +} + +func (x *SetOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj17 int + var yyb17 bool + var yyhl17 bool = l >= 0 + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l + } else { + yyb17 = r.CheckBreak() + } + if yyb17 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.PrevValue = "" + } else { + yyv18 := &x.PrevValue + yym19 := z.DecBinary() + _ = yym19 + if false { + } else { + *((*string)(yyv18)) = r.DecodeString() + } + } + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l + } else { + yyb17 = r.CheckBreak() + } + if yyb17 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.PrevIndex = 0 + } else { + yyv20 := &x.PrevIndex + yym21 := z.DecBinary() + _ = yym21 + if false { + } else { + *((*uint64)(yyv20)) = uint64(r.DecodeUint(64)) + } + } + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l + } else { + yyb17 = r.CheckBreak() + } + if yyb17 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.PrevExist = "" + } else { + yyv22 := &x.PrevExist + yyv22.CodecDecodeSelf(d) + } + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l + } else { + yyb17 = r.CheckBreak() + } + if yyb17 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.TTL = 0 + } else { + yyv23 := &x.TTL + yym24 := z.DecBinary() + _ = yym24 + if false { + } else if z.HasExtensions() && z.DecExt(yyv23) { + } else { + *((*int64)(yyv23)) = int64(r.DecodeInt(64)) + } + } + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l + } else { + yyb17 = r.CheckBreak() + } + if yyb17 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Refresh = false + } else { + yyv25 := &x.Refresh + yym26 := z.DecBinary() + _ = yym26 + if false { + } else { + *((*bool)(yyv25)) = r.DecodeBool() + } + } + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l + } else { + yyb17 = r.CheckBreak() + } + if yyb17 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Dir = false + } else { + yyv27 := &x.Dir + yym28 := z.DecBinary() + _ = yym28 + if false { + } else { + *((*bool)(yyv27)) = r.DecodeBool() + } + } + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l + } else { + yyb17 = r.CheckBreak() + } + if yyb17 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.NoValueOnSuccess = false + } else { + yyv29 := &x.NoValueOnSuccess + yym30 := z.DecBinary() + _ = yym30 + if false { + } else { + *((*bool)(yyv29)) = r.DecodeBool() + } + } + for { + yyj17++ + if yyhl17 { + yyb17 = yyj17 > l + } else { + yyb17 = r.CheckBreak() + } + if yyb17 { + break + } + r.ReadArrayElem() + z.DecStructFieldNotFound(yyj17-1, "") + } + r.ReadArrayEnd() +} + +func (x *GetOptions) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false + if yyr2 || yy2arr2 { + r.WriteArrayStart(3) + } else { + r.WriteMapStart(3) + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeBool(bool(x.Recursive)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Recursive")) + r.WriteMapElemValue() + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeBool(bool(x.Recursive)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeBool(bool(x.Sort)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Sort")) + r.WriteMapElemValue() + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeBool(bool(x.Sort)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeBool(bool(x.Quorum)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Quorum")) + r.WriteMapElemValue() + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeBool(bool(x.Quorum)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayEnd() + } else { + r.WriteMapEnd() + } + } + } +} + +func (x *GetOptions) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap7612 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + r.ReadMapEnd() + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray7612 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + r.ReadArrayEnd() + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) + } + } +} + +func (x *GetOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + r.ReadMapElemKey() + yys3Slc = r.DecodeStringAsBytes() + yys3 := string(yys3Slc) + r.ReadMapElemValue() + switch yys3 { + case "Recursive": + if r.TryDecodeAsNil() { + x.Recursive = false + } else { + yyv4 := &x.Recursive + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + *((*bool)(yyv4)) = r.DecodeBool() + } + } + case "Sort": + if r.TryDecodeAsNil() { + x.Sort = false + } else { + yyv6 := &x.Sort + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + *((*bool)(yyv6)) = r.DecodeBool() + } + } + case "Quorum": + if r.TryDecodeAsNil() { + x.Quorum = false + } else { + yyv8 := &x.Quorum + yym9 := z.DecBinary() + _ = yym9 + if false { + } else { + *((*bool)(yyv8)) = r.DecodeBool() + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + r.ReadMapEnd() +} + +func (x *GetOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj10 int + var yyb10 bool + var yyhl10 bool = l >= 0 + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Recursive = false + } else { + yyv11 := &x.Recursive + yym12 := z.DecBinary() + _ = yym12 + if false { + } else { + *((*bool)(yyv11)) = r.DecodeBool() + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Sort = false + } else { + yyv13 := &x.Sort + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + *((*bool)(yyv13)) = r.DecodeBool() + } + } + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Quorum = false + } else { + yyv15 := &x.Quorum + yym16 := z.DecBinary() + _ = yym16 + if false { + } else { + *((*bool)(yyv15)) = r.DecodeBool() + } + } + for { + yyj10++ + if yyhl10 { + yyb10 = yyj10 > l + } else { + yyb10 = r.CheckBreak() + } + if yyb10 { + break + } + r.ReadArrayElem() + z.DecStructFieldNotFound(yyj10-1, "") + } + r.ReadArrayEnd() +} + +func (x *DeleteOptions) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false + if yyr2 || yy2arr2 { + r.WriteArrayStart(4) + } else { + r.WriteMapStart(4) + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.PrevValue)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("PrevValue")) + r.WriteMapElemValue() + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.PrevValue)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeUint(uint64(x.PrevIndex)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("PrevIndex")) + r.WriteMapElemValue() + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeUint(uint64(x.PrevIndex)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeBool(bool(x.Recursive)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Recursive")) + r.WriteMapElemValue() + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeBool(bool(x.Recursive)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeBool(bool(x.Dir)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Dir")) + r.WriteMapElemValue() + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeBool(bool(x.Dir)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayEnd() + } else { + r.WriteMapEnd() + } + } + } +} + +func (x *DeleteOptions) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap7612 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + r.ReadMapEnd() + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray7612 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + r.ReadArrayEnd() + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) + } + } +} + +func (x *DeleteOptions) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + r.ReadMapElemKey() + yys3Slc = r.DecodeStringAsBytes() + yys3 := string(yys3Slc) + r.ReadMapElemValue() + switch yys3 { + case "PrevValue": + if r.TryDecodeAsNil() { + x.PrevValue = "" + } else { + yyv4 := &x.PrevValue + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + *((*string)(yyv4)) = r.DecodeString() + } + } + case "PrevIndex": + if r.TryDecodeAsNil() { + x.PrevIndex = 0 + } else { + yyv6 := &x.PrevIndex + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + *((*uint64)(yyv6)) = uint64(r.DecodeUint(64)) + } + } + case "Recursive": + if r.TryDecodeAsNil() { + x.Recursive = false + } else { + yyv8 := &x.Recursive + yym9 := z.DecBinary() + _ = yym9 + if false { + } else { + *((*bool)(yyv8)) = r.DecodeBool() + } + } + case "Dir": + if r.TryDecodeAsNil() { + x.Dir = false + } else { + yyv10 := &x.Dir + yym11 := z.DecBinary() + _ = yym11 + if false { + } else { + *((*bool)(yyv10)) = r.DecodeBool() + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + r.ReadMapEnd() +} + +func (x *DeleteOptions) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.PrevValue = "" + } else { + yyv13 := &x.PrevValue + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + *((*string)(yyv13)) = r.DecodeString() + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.PrevIndex = 0 + } else { + yyv15 := &x.PrevIndex + yym16 := z.DecBinary() + _ = yym16 + if false { + } else { + *((*uint64)(yyv15)) = uint64(r.DecodeUint(64)) + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Recursive = false + } else { + yyv17 := &x.Recursive + yym18 := z.DecBinary() + _ = yym18 + if false { + } else { + *((*bool)(yyv17)) = r.DecodeBool() + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Dir = false + } else { + yyv19 := &x.Dir + yym20 := z.DecBinary() + _ = yym20 + if false { + } else { + *((*bool)(yyv19)) = r.DecodeBool() + } + } + for { + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + break + } + r.ReadArrayElem() + z.DecStructFieldNotFound(yyj12-1, "") + } + r.ReadArrayEnd() +} + +func (x *Response) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false + if yyr2 || yy2arr2 { + r.WriteArrayStart(3) + } else { + r.WriteMapStart(3) + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Action)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("action")) + r.WriteMapElemValue() + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Action)) + } + } + var yyn6 bool + if x.Node == nil { + yyn6 = true + goto LABEL6 + } + LABEL6: + if yyr2 || yy2arr2 { + if yyn6 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.Node == nil { + r.EncodeNil() + } else { + x.Node.CodecEncodeSelf(e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("node")) + r.WriteMapElemValue() + if yyn6 { + r.EncodeNil() + } else { + if x.Node == nil { + r.EncodeNil() + } else { + x.Node.CodecEncodeSelf(e) + } + } + } + var yyn9 bool + if x.PrevNode == nil { + yyn9 = true + goto LABEL9 + } + LABEL9: + if yyr2 || yy2arr2 { + if yyn9 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.PrevNode == nil { + r.EncodeNil() + } else { + x.PrevNode.CodecEncodeSelf(e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("prevNode")) + r.WriteMapElemValue() + if yyn9 { + r.EncodeNil() + } else { + if x.PrevNode == nil { + r.EncodeNil() + } else { + x.PrevNode.CodecEncodeSelf(e) + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayEnd() + } else { + r.WriteMapEnd() + } + } + } +} + +func (x *Response) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap7612 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + r.ReadMapEnd() + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray7612 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + r.ReadArrayEnd() + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) + } + } +} + +func (x *Response) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + r.ReadMapElemKey() + yys3Slc = r.DecodeStringAsBytes() + yys3 := string(yys3Slc) + r.ReadMapElemValue() switch yys3 { case "action": if r.TryDecodeAsNil() { @@ -206,6 +2027,9 @@ func (x *Response) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } } case "node": + if x.Node == nil { + x.Node = new(Node) + } if r.TryDecodeAsNil() { if x.Node != nil { x.Node = nil @@ -217,6 +2041,9 @@ func (x *Response) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { x.Node.CodecDecodeSelf(d) } case "prevNode": + if x.PrevNode == nil { + x.PrevNode = new(Node) + } if r.TryDecodeAsNil() { if x.PrevNode != nil { x.PrevNode = nil @@ -231,11 +2058,11 @@ func (x *Response) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 } // end for yyj3 - z.DecSendContainerState(codecSelfer_containerMapEnd1819) + r.ReadMapEnd() } func (x *Response) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer1819 + var h codecSelfer7612 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyj8 int @@ -248,10 +2075,10 @@ func (x *Response) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { yyb8 = r.CheckBreak() } if yyb8 { - z.DecSendContainerState(codecSelfer_containerArrayEnd1819) + r.ReadArrayEnd() return } - z.DecSendContainerState(codecSelfer_containerArrayElem1819) + r.ReadArrayElem() if r.TryDecodeAsNil() { x.Action = "" } else { @@ -263,6 +2090,9 @@ func (x *Response) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { *((*string)(yyv9)) = r.DecodeString() } } + if x.Node == nil { + x.Node = new(Node) + } yyj8++ if yyhl8 { yyb8 = yyj8 > l @@ -270,10 +2100,10 @@ func (x *Response) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { yyb8 = r.CheckBreak() } if yyb8 { - z.DecSendContainerState(codecSelfer_containerArrayEnd1819) + r.ReadArrayEnd() return } - z.DecSendContainerState(codecSelfer_containerArrayElem1819) + r.ReadArrayElem() if r.TryDecodeAsNil() { if x.Node != nil { x.Node = nil @@ -284,6 +2114,9 @@ func (x *Response) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { } x.Node.CodecDecodeSelf(d) } + if x.PrevNode == nil { + x.PrevNode = new(Node) + } yyj8++ if yyhl8 { yyb8 = yyj8 > l @@ -291,10 +2124,10 @@ func (x *Response) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { yyb8 = r.CheckBreak() } if yyb8 { - z.DecSendContainerState(codecSelfer_containerArrayEnd1819) + r.ReadArrayEnd() return } - z.DecSendContainerState(codecSelfer_containerArrayElem1819) + r.ReadArrayElem() if r.TryDecodeAsNil() { if x.PrevNode != nil { x.PrevNode = nil @@ -315,14 +2148,14 @@ func (x *Response) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if yyb8 { break } - z.DecSendContainerState(codecSelfer_containerArrayElem1819) + r.ReadArrayElem() z.DecStructFieldNotFound(yyj8-1, "") } - z.DecSendContainerState(codecSelfer_containerArrayEnd1819) + r.ReadArrayEnd() } func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer1819 + var h codecSelfer7612 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { @@ -336,45 +2169,44 @@ func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) { yysep2 := !z.EncBinary() yy2arr2 := z.EncBasicHandle().StructToArray var yyq2 [8]bool - _, _, _ = yysep2, yyq2, yy2arr2 + _ = yyq2 + _, _ = yysep2, yy2arr2 const yyr2 bool = false yyq2[1] = x.Dir != false yyq2[6] = x.Expiration != nil yyq2[7] = x.TTL != 0 - var yynn2 int if yyr2 || yy2arr2 { - r.EncodeArrayStart(8) + r.WriteArrayStart(8) } else { - yynn2 = 5 + var yynn2 = 5 for _, b := range yyq2 { if b { yynn2++ } } - r.EncodeMapStart(yynn2) - yynn2 = 0 + r.WriteMapStart(yynn2) } if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem1819) + r.WriteArrayElem() yym4 := z.EncBinary() _ = yym4 if false { } else { - r.EncodeString(codecSelferC_UTF81819, string(x.Key)) + r.EncodeString(codecSelferC_UTF87612, string(x.Key)) } } else { - z.EncSendContainerState(codecSelfer_containerMapKey1819) - r.EncodeString(codecSelferC_UTF81819, string("key")) - z.EncSendContainerState(codecSelfer_containerMapValue1819) + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("key")) + r.WriteMapElemValue() yym5 := z.EncBinary() _ = yym5 if false { } else { - r.EncodeString(codecSelferC_UTF81819, string(x.Key)) + r.EncodeString(codecSelferC_UTF87612, string(x.Key)) } } if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem1819) + r.WriteArrayElem() if yyq2[1] { yym7 := z.EncBinary() _ = yym7 @@ -387,9 +2219,9 @@ func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[1] { - z.EncSendContainerState(codecSelfer_containerMapKey1819) - r.EncodeString(codecSelferC_UTF81819, string("dir")) - z.EncSendContainerState(codecSelfer_containerMapValue1819) + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("dir")) + r.WriteMapElemValue() yym8 := z.EncBinary() _ = yym8 if false { @@ -399,35 +2231,35 @@ func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem1819) + r.WriteArrayElem() yym10 := z.EncBinary() _ = yym10 if false { } else { - r.EncodeString(codecSelferC_UTF81819, string(x.Value)) + r.EncodeString(codecSelferC_UTF87612, string(x.Value)) } } else { - z.EncSendContainerState(codecSelfer_containerMapKey1819) - r.EncodeString(codecSelferC_UTF81819, string("value")) - z.EncSendContainerState(codecSelfer_containerMapValue1819) + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("value")) + r.WriteMapElemValue() yym11 := z.EncBinary() _ = yym11 if false { } else { - r.EncodeString(codecSelferC_UTF81819, string(x.Value)) + r.EncodeString(codecSelferC_UTF87612, string(x.Value)) } } if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem1819) + r.WriteArrayElem() if x.Nodes == nil { r.EncodeNil() } else { x.Nodes.CodecEncodeSelf(e) } } else { - z.EncSendContainerState(codecSelfer_containerMapKey1819) - r.EncodeString(codecSelferC_UTF81819, string("nodes")) - z.EncSendContainerState(codecSelfer_containerMapValue1819) + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("nodes")) + r.WriteMapElemValue() if x.Nodes == nil { r.EncodeNil() } else { @@ -435,7 +2267,7 @@ func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem1819) + r.WriteArrayElem() yym16 := z.EncBinary() _ = yym16 if false { @@ -443,9 +2275,9 @@ func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeUint(uint64(x.CreatedIndex)) } } else { - z.EncSendContainerState(codecSelfer_containerMapKey1819) - r.EncodeString(codecSelferC_UTF81819, string("createdIndex")) - z.EncSendContainerState(codecSelfer_containerMapValue1819) + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("createdIndex")) + r.WriteMapElemValue() yym17 := z.EncBinary() _ = yym17 if false { @@ -454,7 +2286,7 @@ func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem1819) + r.WriteArrayElem() yym19 := z.EncBinary() _ = yym19 if false { @@ -462,9 +2294,9 @@ func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeUint(uint64(x.ModifiedIndex)) } } else { - z.EncSendContainerState(codecSelfer_containerMapKey1819) - r.EncodeString(codecSelferC_UTF81819, string("modifiedIndex")) - z.EncSendContainerState(codecSelfer_containerMapValue1819) + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("modifiedIndex")) + r.WriteMapElemValue() yym20 := z.EncBinary() _ = yym20 if false { @@ -472,55 +2304,70 @@ func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) { r.EncodeUint(uint64(x.ModifiedIndex)) } } + var yyn21 bool + if x.Expiration == nil { + yyn21 = true + goto LABEL21 + } + LABEL21: if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem1819) - if yyq2[6] { - if x.Expiration == nil { - r.EncodeNil() - } else { - yym22 := z.EncBinary() - _ = yym22 - if false { - } else if yym23 := z.TimeRtidIfBinc(); yym23 != 0 { - r.EncodeBuiltin(yym23, x.Expiration) - } else if z.HasExtensions() && z.EncExt(x.Expiration) { - } else if yym22 { - z.EncBinaryMarshal(x.Expiration) - } else if !yym22 && z.IsJSONHandle() { - z.EncJSONMarshal(x.Expiration) - } else { - z.EncFallback(x.Expiration) - } - } - } else { + if yyn21 { + r.WriteArrayElem() r.EncodeNil() + } else { + r.WriteArrayElem() + if yyq2[6] { + if x.Expiration == nil { + r.EncodeNil() + } else { + yym22 := z.EncBinary() + _ = yym22 + if false { + } else if yym23 := z.TimeRtidIfBinc(); yym23 != 0 { + r.EncodeBuiltin(yym23, x.Expiration) + } else if z.HasExtensions() && z.EncExt(x.Expiration) { + } else if yym22 { + z.EncBinaryMarshal(x.Expiration) + } else if !yym22 && z.IsJSONHandle() { + z.EncJSONMarshal(x.Expiration) + } else { + z.EncFallback(x.Expiration) + } + } + } else { + r.EncodeNil() + } } } else { if yyq2[6] { - z.EncSendContainerState(codecSelfer_containerMapKey1819) - r.EncodeString(codecSelferC_UTF81819, string("expiration")) - z.EncSendContainerState(codecSelfer_containerMapValue1819) - if x.Expiration == nil { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("expiration")) + r.WriteMapElemValue() + if yyn21 { r.EncodeNil() } else { - yym24 := z.EncBinary() - _ = yym24 - if false { - } else if yym25 := z.TimeRtidIfBinc(); yym25 != 0 { - r.EncodeBuiltin(yym25, x.Expiration) - } else if z.HasExtensions() && z.EncExt(x.Expiration) { - } else if yym24 { - z.EncBinaryMarshal(x.Expiration) - } else if !yym24 && z.IsJSONHandle() { - z.EncJSONMarshal(x.Expiration) + if x.Expiration == nil { + r.EncodeNil() } else { - z.EncFallback(x.Expiration) + yym24 := z.EncBinary() + _ = yym24 + if false { + } else if yym25 := z.TimeRtidIfBinc(); yym25 != 0 { + r.EncodeBuiltin(yym25, x.Expiration) + } else if z.HasExtensions() && z.EncExt(x.Expiration) { + } else if yym24 { + z.EncBinaryMarshal(x.Expiration) + } else if !yym24 && z.IsJSONHandle() { + z.EncJSONMarshal(x.Expiration) + } else { + z.EncFallback(x.Expiration) + } } } } } if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayElem1819) + r.WriteArrayElem() if yyq2[7] { yym27 := z.EncBinary() _ = yym27 @@ -533,9 +2380,9 @@ func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) { } } else { if yyq2[7] { - z.EncSendContainerState(codecSelfer_containerMapKey1819) - r.EncodeString(codecSelferC_UTF81819, string("ttl")) - z.EncSendContainerState(codecSelfer_containerMapValue1819) + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("ttl")) + r.WriteMapElemValue() yym28 := z.EncBinary() _ = yym28 if false { @@ -545,16 +2392,16 @@ func (x *Node) CodecEncodeSelf(e *codec1978.Encoder) { } } if yyr2 || yy2arr2 { - z.EncSendContainerState(codecSelfer_containerArrayEnd1819) + r.WriteArrayEnd() } else { - z.EncSendContainerState(codecSelfer_containerMapEnd1819) + r.WriteMapEnd() } } } } func (x *Node) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer1819 + var h codecSelfer7612 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r yym1 := z.DecBinary() @@ -563,28 +2410,28 @@ func (x *Node) CodecDecodeSelf(d *codec1978.Decoder) { } else if z.HasExtensions() && z.DecExt(x) { } else { yyct2 := r.ContainerType() - if yyct2 == codecSelferValueTypeMap1819 { + if yyct2 == codecSelferValueTypeMap7612 { yyl2 := r.ReadMapStart() if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerMapEnd1819) + r.ReadMapEnd() } else { x.codecDecodeSelfFromMap(yyl2, d) } - } else if yyct2 == codecSelferValueTypeArray1819 { + } else if yyct2 == codecSelferValueTypeArray7612 { yyl2 := r.ReadArrayStart() if yyl2 == 0 { - z.DecSendContainerState(codecSelfer_containerArrayEnd1819) + r.ReadArrayEnd() } else { x.codecDecodeSelfFromArray(yyl2, d) } } else { - panic(codecSelferOnlyMapOrArrayEncodeToStructErr1819) + panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) } } } func (x *Node) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { - var h codecSelfer1819 + var h codecSelfer7612 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yys3Slc = z.DecScratchBuffer() // default slice to decode into @@ -600,10 +2447,10 @@ func (x *Node) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { break } } - z.DecSendContainerState(codecSelfer_containerMapKey1819) - yys3Slc = r.DecodeBytes(yys3Slc, true, true) + r.ReadMapElemKey() + yys3Slc = r.DecodeStringAsBytes() yys3 := string(yys3Slc) - z.DecSendContainerState(codecSelfer_containerMapValue1819) + r.ReadMapElemValue() switch yys3 { case "key": if r.TryDecodeAsNil() { @@ -673,6 +2520,9 @@ func (x *Node) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { } } case "expiration": + if x.Expiration == nil { + x.Expiration = new(time.Time) + } if r.TryDecodeAsNil() { if x.Expiration != nil { x.Expiration = nil @@ -711,11 +2561,11 @@ func (x *Node) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { z.DecStructFieldNotFound(-1, yys3) } // end switch yys3 } // end for yyj3 - z.DecSendContainerState(codecSelfer_containerMapEnd1819) + r.ReadMapEnd() } func (x *Node) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { - var h codecSelfer1819 + var h codecSelfer7612 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r var yyj20 int @@ -728,10 +2578,10 @@ func (x *Node) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { yyb20 = r.CheckBreak() } if yyb20 { - z.DecSendContainerState(codecSelfer_containerArrayEnd1819) + r.ReadArrayEnd() return } - z.DecSendContainerState(codecSelfer_containerArrayElem1819) + r.ReadArrayElem() if r.TryDecodeAsNil() { x.Key = "" } else { @@ -750,10 +2600,10 @@ func (x *Node) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { yyb20 = r.CheckBreak() } if yyb20 { - z.DecSendContainerState(codecSelfer_containerArrayEnd1819) + r.ReadArrayEnd() return } - z.DecSendContainerState(codecSelfer_containerArrayElem1819) + r.ReadArrayElem() if r.TryDecodeAsNil() { x.Dir = false } else { @@ -772,10 +2622,10 @@ func (x *Node) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { yyb20 = r.CheckBreak() } if yyb20 { - z.DecSendContainerState(codecSelfer_containerArrayEnd1819) + r.ReadArrayEnd() return } - z.DecSendContainerState(codecSelfer_containerArrayElem1819) + r.ReadArrayElem() if r.TryDecodeAsNil() { x.Value = "" } else { @@ -794,10 +2644,10 @@ func (x *Node) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { yyb20 = r.CheckBreak() } if yyb20 { - z.DecSendContainerState(codecSelfer_containerArrayEnd1819) + r.ReadArrayEnd() return } - z.DecSendContainerState(codecSelfer_containerArrayElem1819) + r.ReadArrayElem() if r.TryDecodeAsNil() { x.Nodes = nil } else { @@ -811,10 +2661,10 @@ func (x *Node) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { yyb20 = r.CheckBreak() } if yyb20 { - z.DecSendContainerState(codecSelfer_containerArrayEnd1819) + r.ReadArrayEnd() return } - z.DecSendContainerState(codecSelfer_containerArrayElem1819) + r.ReadArrayElem() if r.TryDecodeAsNil() { x.CreatedIndex = 0 } else { @@ -833,10 +2683,10 @@ func (x *Node) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { yyb20 = r.CheckBreak() } if yyb20 { - z.DecSendContainerState(codecSelfer_containerArrayEnd1819) + r.ReadArrayEnd() return } - z.DecSendContainerState(codecSelfer_containerArrayElem1819) + r.ReadArrayElem() if r.TryDecodeAsNil() { x.ModifiedIndex = 0 } else { @@ -848,6 +2698,9 @@ func (x *Node) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { *((*uint64)(yyv30)) = uint64(r.DecodeUint(64)) } } + if x.Expiration == nil { + x.Expiration = new(time.Time) + } yyj20++ if yyhl20 { yyb20 = yyj20 > l @@ -855,10 +2708,10 @@ func (x *Node) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { yyb20 = r.CheckBreak() } if yyb20 { - z.DecSendContainerState(codecSelfer_containerArrayEnd1819) + r.ReadArrayEnd() return } - z.DecSendContainerState(codecSelfer_containerArrayElem1819) + r.ReadArrayElem() if r.TryDecodeAsNil() { if x.Expiration != nil { x.Expiration = nil @@ -888,10 +2741,10 @@ func (x *Node) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { yyb20 = r.CheckBreak() } if yyb20 { - z.DecSendContainerState(codecSelfer_containerArrayEnd1819) + r.ReadArrayEnd() return } - z.DecSendContainerState(codecSelfer_containerArrayElem1819) + r.ReadArrayElem() if r.TryDecodeAsNil() { x.TTL = 0 } else { @@ -913,14 +2766,14 @@ func (x *Node) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { if yyb20 { break } - z.DecSendContainerState(codecSelfer_containerArrayElem1819) + r.ReadArrayElem() z.DecStructFieldNotFound(yyj20-1, "") } - z.DecSendContainerState(codecSelfer_containerArrayEnd1819) + r.ReadArrayEnd() } func (x Nodes) CodecEncodeSelf(e *codec1978.Encoder) { - var h codecSelfer1819 + var h codecSelfer7612 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r if x == nil { @@ -937,7 +2790,7 @@ func (x Nodes) CodecEncodeSelf(e *codec1978.Encoder) { } func (x *Nodes) CodecDecodeSelf(d *codec1978.Decoder) { - var h codecSelfer1819 + var h codecSelfer7612 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r yym1 := z.DecBinary() @@ -949,24 +2802,2333 @@ func (x *Nodes) CodecDecodeSelf(d *codec1978.Decoder) { } } -func (x codecSelfer1819) encNodes(v Nodes, e *codec1978.Encoder) { - var h codecSelfer1819 +func (x *httpKeysAPI) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer7612 z, r := codec1978.GenHelperEncoder(e) _, _, _ = h, z, r - r.EncodeArrayStart(len(v)) + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false + if yyr2 || yy2arr2 { + r.WriteArrayStart(0) + } else { + r.WriteMapStart(0) + } + if yyr2 || yy2arr2 { + r.WriteArrayEnd() + } else { + r.WriteMapEnd() + } + } + } +} + +func (x *httpKeysAPI) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap7612 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + r.ReadMapEnd() + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray7612 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + r.ReadArrayEnd() + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) + } + } +} + +func (x *httpKeysAPI) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + r.ReadMapElemKey() + yys3Slc = r.DecodeStringAsBytes() + yys3 := string(yys3Slc) + r.ReadMapElemValue() + switch yys3 { + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + r.ReadMapEnd() +} + +func (x *httpKeysAPI) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj4 int + var yyb4 bool + var yyhl4 bool = l >= 0 + for { + yyj4++ + if yyhl4 { + yyb4 = yyj4 > l + } else { + yyb4 = r.CheckBreak() + } + if yyb4 { + break + } + r.ReadArrayElem() + z.DecStructFieldNotFound(yyj4-1, "") + } + r.ReadArrayEnd() +} + +func (x *httpWatcher) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false + if yyr2 || yy2arr2 { + r.WriteArrayStart(0) + } else { + r.WriteMapStart(0) + } + if yyr2 || yy2arr2 { + r.WriteArrayEnd() + } else { + r.WriteMapEnd() + } + } + } +} + +func (x *httpWatcher) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap7612 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + r.ReadMapEnd() + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray7612 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + r.ReadArrayEnd() + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) + } + } +} + +func (x *httpWatcher) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + r.ReadMapElemKey() + yys3Slc = r.DecodeStringAsBytes() + yys3 := string(yys3Slc) + r.ReadMapElemValue() + switch yys3 { + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + r.ReadMapEnd() +} + +func (x *httpWatcher) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj4 int + var yyb4 bool + var yyhl4 bool = l >= 0 + for { + yyj4++ + if yyhl4 { + yyb4 = yyj4 > l + } else { + yyb4 = r.CheckBreak() + } + if yyb4 { + break + } + r.ReadArrayElem() + z.DecStructFieldNotFound(yyj4-1, "") + } + r.ReadArrayEnd() +} + +func (x *getAction) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false + if yyr2 || yy2arr2 { + r.WriteArrayStart(5) + } else { + r.WriteMapStart(5) + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Prefix)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Prefix")) + r.WriteMapElemValue() + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Prefix)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Key)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Key")) + r.WriteMapElemValue() + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Key)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeBool(bool(x.Recursive)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Recursive")) + r.WriteMapElemValue() + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeBool(bool(x.Recursive)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeBool(bool(x.Sorted)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Sorted")) + r.WriteMapElemValue() + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeBool(bool(x.Sorted)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeBool(bool(x.Quorum)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Quorum")) + r.WriteMapElemValue() + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeBool(bool(x.Quorum)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayEnd() + } else { + r.WriteMapEnd() + } + } + } +} + +func (x *getAction) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap7612 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + r.ReadMapEnd() + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray7612 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + r.ReadArrayEnd() + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) + } + } +} + +func (x *getAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + r.ReadMapElemKey() + yys3Slc = r.DecodeStringAsBytes() + yys3 := string(yys3Slc) + r.ReadMapElemValue() + switch yys3 { + case "Prefix": + if r.TryDecodeAsNil() { + x.Prefix = "" + } else { + yyv4 := &x.Prefix + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + *((*string)(yyv4)) = r.DecodeString() + } + } + case "Key": + if r.TryDecodeAsNil() { + x.Key = "" + } else { + yyv6 := &x.Key + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + *((*string)(yyv6)) = r.DecodeString() + } + } + case "Recursive": + if r.TryDecodeAsNil() { + x.Recursive = false + } else { + yyv8 := &x.Recursive + yym9 := z.DecBinary() + _ = yym9 + if false { + } else { + *((*bool)(yyv8)) = r.DecodeBool() + } + } + case "Sorted": + if r.TryDecodeAsNil() { + x.Sorted = false + } else { + yyv10 := &x.Sorted + yym11 := z.DecBinary() + _ = yym11 + if false { + } else { + *((*bool)(yyv10)) = r.DecodeBool() + } + } + case "Quorum": + if r.TryDecodeAsNil() { + x.Quorum = false + } else { + yyv12 := &x.Quorum + yym13 := z.DecBinary() + _ = yym13 + if false { + } else { + *((*bool)(yyv12)) = r.DecodeBool() + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + r.ReadMapEnd() +} + +func (x *getAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj14 int + var yyb14 bool + var yyhl14 bool = l >= 0 + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Prefix = "" + } else { + yyv15 := &x.Prefix + yym16 := z.DecBinary() + _ = yym16 + if false { + } else { + *((*string)(yyv15)) = r.DecodeString() + } + } + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Key = "" + } else { + yyv17 := &x.Key + yym18 := z.DecBinary() + _ = yym18 + if false { + } else { + *((*string)(yyv17)) = r.DecodeString() + } + } + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Recursive = false + } else { + yyv19 := &x.Recursive + yym20 := z.DecBinary() + _ = yym20 + if false { + } else { + *((*bool)(yyv19)) = r.DecodeBool() + } + } + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Sorted = false + } else { + yyv21 := &x.Sorted + yym22 := z.DecBinary() + _ = yym22 + if false { + } else { + *((*bool)(yyv21)) = r.DecodeBool() + } + } + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Quorum = false + } else { + yyv23 := &x.Quorum + yym24 := z.DecBinary() + _ = yym24 + if false { + } else { + *((*bool)(yyv23)) = r.DecodeBool() + } + } + for { + yyj14++ + if yyhl14 { + yyb14 = yyj14 > l + } else { + yyb14 = r.CheckBreak() + } + if yyb14 { + break + } + r.ReadArrayElem() + z.DecStructFieldNotFound(yyj14-1, "") + } + r.ReadArrayEnd() +} + +func (x *waitAction) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false + if yyr2 || yy2arr2 { + r.WriteArrayStart(4) + } else { + r.WriteMapStart(4) + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Prefix)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Prefix")) + r.WriteMapElemValue() + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Prefix)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Key)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Key")) + r.WriteMapElemValue() + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Key)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeUint(uint64(x.WaitIndex)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("WaitIndex")) + r.WriteMapElemValue() + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeUint(uint64(x.WaitIndex)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeBool(bool(x.Recursive)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Recursive")) + r.WriteMapElemValue() + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeBool(bool(x.Recursive)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayEnd() + } else { + r.WriteMapEnd() + } + } + } +} + +func (x *waitAction) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap7612 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + r.ReadMapEnd() + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray7612 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + r.ReadArrayEnd() + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) + } + } +} + +func (x *waitAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + r.ReadMapElemKey() + yys3Slc = r.DecodeStringAsBytes() + yys3 := string(yys3Slc) + r.ReadMapElemValue() + switch yys3 { + case "Prefix": + if r.TryDecodeAsNil() { + x.Prefix = "" + } else { + yyv4 := &x.Prefix + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + *((*string)(yyv4)) = r.DecodeString() + } + } + case "Key": + if r.TryDecodeAsNil() { + x.Key = "" + } else { + yyv6 := &x.Key + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + *((*string)(yyv6)) = r.DecodeString() + } + } + case "WaitIndex": + if r.TryDecodeAsNil() { + x.WaitIndex = 0 + } else { + yyv8 := &x.WaitIndex + yym9 := z.DecBinary() + _ = yym9 + if false { + } else { + *((*uint64)(yyv8)) = uint64(r.DecodeUint(64)) + } + } + case "Recursive": + if r.TryDecodeAsNil() { + x.Recursive = false + } else { + yyv10 := &x.Recursive + yym11 := z.DecBinary() + _ = yym11 + if false { + } else { + *((*bool)(yyv10)) = r.DecodeBool() + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + r.ReadMapEnd() +} + +func (x *waitAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Prefix = "" + } else { + yyv13 := &x.Prefix + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + *((*string)(yyv13)) = r.DecodeString() + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Key = "" + } else { + yyv15 := &x.Key + yym16 := z.DecBinary() + _ = yym16 + if false { + } else { + *((*string)(yyv15)) = r.DecodeString() + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.WaitIndex = 0 + } else { + yyv17 := &x.WaitIndex + yym18 := z.DecBinary() + _ = yym18 + if false { + } else { + *((*uint64)(yyv17)) = uint64(r.DecodeUint(64)) + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Recursive = false + } else { + yyv19 := &x.Recursive + yym20 := z.DecBinary() + _ = yym20 + if false { + } else { + *((*bool)(yyv19)) = r.DecodeBool() + } + } + for { + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + break + } + r.ReadArrayElem() + z.DecStructFieldNotFound(yyj12-1, "") + } + r.ReadArrayEnd() +} + +func (x *setAction) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false + if yyr2 || yy2arr2 { + r.WriteArrayStart(10) + } else { + r.WriteMapStart(10) + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Prefix)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Prefix")) + r.WriteMapElemValue() + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Prefix)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Key)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Key")) + r.WriteMapElemValue() + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Key)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Value)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Value")) + r.WriteMapElemValue() + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Value)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.PrevValue)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("PrevValue")) + r.WriteMapElemValue() + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.PrevValue)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeUint(uint64(x.PrevIndex)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("PrevIndex")) + r.WriteMapElemValue() + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeUint(uint64(x.PrevIndex)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + x.PrevExist.CodecEncodeSelf(e) + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("PrevExist")) + r.WriteMapElemValue() + x.PrevExist.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym22 := z.EncBinary() + _ = yym22 + if false { + } else if z.HasExtensions() && z.EncExt(x.TTL) { + } else { + r.EncodeInt(int64(x.TTL)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("TTL")) + r.WriteMapElemValue() + yym23 := z.EncBinary() + _ = yym23 + if false { + } else if z.HasExtensions() && z.EncExt(x.TTL) { + } else { + r.EncodeInt(int64(x.TTL)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym25 := z.EncBinary() + _ = yym25 + if false { + } else { + r.EncodeBool(bool(x.Refresh)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Refresh")) + r.WriteMapElemValue() + yym26 := z.EncBinary() + _ = yym26 + if false { + } else { + r.EncodeBool(bool(x.Refresh)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym28 := z.EncBinary() + _ = yym28 + if false { + } else { + r.EncodeBool(bool(x.Dir)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Dir")) + r.WriteMapElemValue() + yym29 := z.EncBinary() + _ = yym29 + if false { + } else { + r.EncodeBool(bool(x.Dir)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym31 := z.EncBinary() + _ = yym31 + if false { + } else { + r.EncodeBool(bool(x.NoValueOnSuccess)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("NoValueOnSuccess")) + r.WriteMapElemValue() + yym32 := z.EncBinary() + _ = yym32 + if false { + } else { + r.EncodeBool(bool(x.NoValueOnSuccess)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayEnd() + } else { + r.WriteMapEnd() + } + } + } +} + +func (x *setAction) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap7612 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + r.ReadMapEnd() + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray7612 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + r.ReadArrayEnd() + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) + } + } +} + +func (x *setAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + r.ReadMapElemKey() + yys3Slc = r.DecodeStringAsBytes() + yys3 := string(yys3Slc) + r.ReadMapElemValue() + switch yys3 { + case "Prefix": + if r.TryDecodeAsNil() { + x.Prefix = "" + } else { + yyv4 := &x.Prefix + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + *((*string)(yyv4)) = r.DecodeString() + } + } + case "Key": + if r.TryDecodeAsNil() { + x.Key = "" + } else { + yyv6 := &x.Key + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + *((*string)(yyv6)) = r.DecodeString() + } + } + case "Value": + if r.TryDecodeAsNil() { + x.Value = "" + } else { + yyv8 := &x.Value + yym9 := z.DecBinary() + _ = yym9 + if false { + } else { + *((*string)(yyv8)) = r.DecodeString() + } + } + case "PrevValue": + if r.TryDecodeAsNil() { + x.PrevValue = "" + } else { + yyv10 := &x.PrevValue + yym11 := z.DecBinary() + _ = yym11 + if false { + } else { + *((*string)(yyv10)) = r.DecodeString() + } + } + case "PrevIndex": + if r.TryDecodeAsNil() { + x.PrevIndex = 0 + } else { + yyv12 := &x.PrevIndex + yym13 := z.DecBinary() + _ = yym13 + if false { + } else { + *((*uint64)(yyv12)) = uint64(r.DecodeUint(64)) + } + } + case "PrevExist": + if r.TryDecodeAsNil() { + x.PrevExist = "" + } else { + yyv14 := &x.PrevExist + yyv14.CodecDecodeSelf(d) + } + case "TTL": + if r.TryDecodeAsNil() { + x.TTL = 0 + } else { + yyv15 := &x.TTL + yym16 := z.DecBinary() + _ = yym16 + if false { + } else if z.HasExtensions() && z.DecExt(yyv15) { + } else { + *((*int64)(yyv15)) = int64(r.DecodeInt(64)) + } + } + case "Refresh": + if r.TryDecodeAsNil() { + x.Refresh = false + } else { + yyv17 := &x.Refresh + yym18 := z.DecBinary() + _ = yym18 + if false { + } else { + *((*bool)(yyv17)) = r.DecodeBool() + } + } + case "Dir": + if r.TryDecodeAsNil() { + x.Dir = false + } else { + yyv19 := &x.Dir + yym20 := z.DecBinary() + _ = yym20 + if false { + } else { + *((*bool)(yyv19)) = r.DecodeBool() + } + } + case "NoValueOnSuccess": + if r.TryDecodeAsNil() { + x.NoValueOnSuccess = false + } else { + yyv21 := &x.NoValueOnSuccess + yym22 := z.DecBinary() + _ = yym22 + if false { + } else { + *((*bool)(yyv21)) = r.DecodeBool() + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + r.ReadMapEnd() +} + +func (x *setAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj23 int + var yyb23 bool + var yyhl23 bool = l >= 0 + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l + } else { + yyb23 = r.CheckBreak() + } + if yyb23 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Prefix = "" + } else { + yyv24 := &x.Prefix + yym25 := z.DecBinary() + _ = yym25 + if false { + } else { + *((*string)(yyv24)) = r.DecodeString() + } + } + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l + } else { + yyb23 = r.CheckBreak() + } + if yyb23 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Key = "" + } else { + yyv26 := &x.Key + yym27 := z.DecBinary() + _ = yym27 + if false { + } else { + *((*string)(yyv26)) = r.DecodeString() + } + } + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l + } else { + yyb23 = r.CheckBreak() + } + if yyb23 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Value = "" + } else { + yyv28 := &x.Value + yym29 := z.DecBinary() + _ = yym29 + if false { + } else { + *((*string)(yyv28)) = r.DecodeString() + } + } + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l + } else { + yyb23 = r.CheckBreak() + } + if yyb23 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.PrevValue = "" + } else { + yyv30 := &x.PrevValue + yym31 := z.DecBinary() + _ = yym31 + if false { + } else { + *((*string)(yyv30)) = r.DecodeString() + } + } + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l + } else { + yyb23 = r.CheckBreak() + } + if yyb23 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.PrevIndex = 0 + } else { + yyv32 := &x.PrevIndex + yym33 := z.DecBinary() + _ = yym33 + if false { + } else { + *((*uint64)(yyv32)) = uint64(r.DecodeUint(64)) + } + } + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l + } else { + yyb23 = r.CheckBreak() + } + if yyb23 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.PrevExist = "" + } else { + yyv34 := &x.PrevExist + yyv34.CodecDecodeSelf(d) + } + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l + } else { + yyb23 = r.CheckBreak() + } + if yyb23 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.TTL = 0 + } else { + yyv35 := &x.TTL + yym36 := z.DecBinary() + _ = yym36 + if false { + } else if z.HasExtensions() && z.DecExt(yyv35) { + } else { + *((*int64)(yyv35)) = int64(r.DecodeInt(64)) + } + } + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l + } else { + yyb23 = r.CheckBreak() + } + if yyb23 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Refresh = false + } else { + yyv37 := &x.Refresh + yym38 := z.DecBinary() + _ = yym38 + if false { + } else { + *((*bool)(yyv37)) = r.DecodeBool() + } + } + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l + } else { + yyb23 = r.CheckBreak() + } + if yyb23 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Dir = false + } else { + yyv39 := &x.Dir + yym40 := z.DecBinary() + _ = yym40 + if false { + } else { + *((*bool)(yyv39)) = r.DecodeBool() + } + } + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l + } else { + yyb23 = r.CheckBreak() + } + if yyb23 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.NoValueOnSuccess = false + } else { + yyv41 := &x.NoValueOnSuccess + yym42 := z.DecBinary() + _ = yym42 + if false { + } else { + *((*bool)(yyv41)) = r.DecodeBool() + } + } + for { + yyj23++ + if yyhl23 { + yyb23 = yyj23 > l + } else { + yyb23 = r.CheckBreak() + } + if yyb23 { + break + } + r.ReadArrayElem() + z.DecStructFieldNotFound(yyj23-1, "") + } + r.ReadArrayEnd() +} + +func (x *deleteAction) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false + if yyr2 || yy2arr2 { + r.WriteArrayStart(6) + } else { + r.WriteMapStart(6) + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Prefix)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Prefix")) + r.WriteMapElemValue() + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Prefix)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Key)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Key")) + r.WriteMapElemValue() + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Key)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.PrevValue)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("PrevValue")) + r.WriteMapElemValue() + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.PrevValue)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym13 := z.EncBinary() + _ = yym13 + if false { + } else { + r.EncodeUint(uint64(x.PrevIndex)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("PrevIndex")) + r.WriteMapElemValue() + yym14 := z.EncBinary() + _ = yym14 + if false { + } else { + r.EncodeUint(uint64(x.PrevIndex)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym16 := z.EncBinary() + _ = yym16 + if false { + } else { + r.EncodeBool(bool(x.Dir)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Dir")) + r.WriteMapElemValue() + yym17 := z.EncBinary() + _ = yym17 + if false { + } else { + r.EncodeBool(bool(x.Dir)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym19 := z.EncBinary() + _ = yym19 + if false { + } else { + r.EncodeBool(bool(x.Recursive)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Recursive")) + r.WriteMapElemValue() + yym20 := z.EncBinary() + _ = yym20 + if false { + } else { + r.EncodeBool(bool(x.Recursive)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayEnd() + } else { + r.WriteMapEnd() + } + } + } +} + +func (x *deleteAction) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap7612 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + r.ReadMapEnd() + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray7612 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + r.ReadArrayEnd() + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) + } + } +} + +func (x *deleteAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + r.ReadMapElemKey() + yys3Slc = r.DecodeStringAsBytes() + yys3 := string(yys3Slc) + r.ReadMapElemValue() + switch yys3 { + case "Prefix": + if r.TryDecodeAsNil() { + x.Prefix = "" + } else { + yyv4 := &x.Prefix + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + *((*string)(yyv4)) = r.DecodeString() + } + } + case "Key": + if r.TryDecodeAsNil() { + x.Key = "" + } else { + yyv6 := &x.Key + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + *((*string)(yyv6)) = r.DecodeString() + } + } + case "PrevValue": + if r.TryDecodeAsNil() { + x.PrevValue = "" + } else { + yyv8 := &x.PrevValue + yym9 := z.DecBinary() + _ = yym9 + if false { + } else { + *((*string)(yyv8)) = r.DecodeString() + } + } + case "PrevIndex": + if r.TryDecodeAsNil() { + x.PrevIndex = 0 + } else { + yyv10 := &x.PrevIndex + yym11 := z.DecBinary() + _ = yym11 + if false { + } else { + *((*uint64)(yyv10)) = uint64(r.DecodeUint(64)) + } + } + case "Dir": + if r.TryDecodeAsNil() { + x.Dir = false + } else { + yyv12 := &x.Dir + yym13 := z.DecBinary() + _ = yym13 + if false { + } else { + *((*bool)(yyv12)) = r.DecodeBool() + } + } + case "Recursive": + if r.TryDecodeAsNil() { + x.Recursive = false + } else { + yyv14 := &x.Recursive + yym15 := z.DecBinary() + _ = yym15 + if false { + } else { + *((*bool)(yyv14)) = r.DecodeBool() + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + r.ReadMapEnd() +} + +func (x *deleteAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj16 int + var yyb16 bool + var yyhl16 bool = l >= 0 + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Prefix = "" + } else { + yyv17 := &x.Prefix + yym18 := z.DecBinary() + _ = yym18 + if false { + } else { + *((*string)(yyv17)) = r.DecodeString() + } + } + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Key = "" + } else { + yyv19 := &x.Key + yym20 := z.DecBinary() + _ = yym20 + if false { + } else { + *((*string)(yyv19)) = r.DecodeString() + } + } + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.PrevValue = "" + } else { + yyv21 := &x.PrevValue + yym22 := z.DecBinary() + _ = yym22 + if false { + } else { + *((*string)(yyv21)) = r.DecodeString() + } + } + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.PrevIndex = 0 + } else { + yyv23 := &x.PrevIndex + yym24 := z.DecBinary() + _ = yym24 + if false { + } else { + *((*uint64)(yyv23)) = uint64(r.DecodeUint(64)) + } + } + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Dir = false + } else { + yyv25 := &x.Dir + yym26 := z.DecBinary() + _ = yym26 + if false { + } else { + *((*bool)(yyv25)) = r.DecodeBool() + } + } + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Recursive = false + } else { + yyv27 := &x.Recursive + yym28 := z.DecBinary() + _ = yym28 + if false { + } else { + *((*bool)(yyv27)) = r.DecodeBool() + } + } + for { + yyj16++ + if yyhl16 { + yyb16 = yyj16 > l + } else { + yyb16 = r.CheckBreak() + } + if yyb16 { + break + } + r.ReadArrayElem() + z.DecStructFieldNotFound(yyj16-1, "") + } + r.ReadArrayEnd() +} + +func (x *createInOrderAction) CodecEncodeSelf(e *codec1978.Encoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + yym1 := z.EncBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.EncExt(x) { + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false + if yyr2 || yy2arr2 { + r.WriteArrayStart(4) + } else { + r.WriteMapStart(4) + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym4 := z.EncBinary() + _ = yym4 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Prefix)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Prefix")) + r.WriteMapElemValue() + yym5 := z.EncBinary() + _ = yym5 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Prefix)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym7 := z.EncBinary() + _ = yym7 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Dir)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Dir")) + r.WriteMapElemValue() + yym8 := z.EncBinary() + _ = yym8 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Dir)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym10 := z.EncBinary() + _ = yym10 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Value)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("Value")) + r.WriteMapElemValue() + yym11 := z.EncBinary() + _ = yym11 + if false { + } else { + r.EncodeString(codecSelferC_UTF87612, string(x.Value)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yym13 := z.EncBinary() + _ = yym13 + if false { + } else if z.HasExtensions() && z.EncExt(x.TTL) { + } else { + r.EncodeInt(int64(x.TTL)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferC_UTF87612, string("TTL")) + r.WriteMapElemValue() + yym14 := z.EncBinary() + _ = yym14 + if false { + } else if z.HasExtensions() && z.EncExt(x.TTL) { + } else { + r.EncodeInt(int64(x.TTL)) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayEnd() + } else { + r.WriteMapEnd() + } + } + } +} + +func (x *createInOrderAction) CodecDecodeSelf(d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + yym1 := z.DecBinary() + _ = yym1 + if false { + } else if z.HasExtensions() && z.DecExt(x) { + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap7612 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + r.ReadMapEnd() + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray7612 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + r.ReadArrayEnd() + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(codecSelferOnlyMapOrArrayEncodeToStructErr7612) + } + } +} + +func (x *createInOrderAction) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yys3Slc = z.DecScratchBuffer() // default slice to decode into + _ = yys3Slc + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + r.ReadMapElemKey() + yys3Slc = r.DecodeStringAsBytes() + yys3 := string(yys3Slc) + r.ReadMapElemValue() + switch yys3 { + case "Prefix": + if r.TryDecodeAsNil() { + x.Prefix = "" + } else { + yyv4 := &x.Prefix + yym5 := z.DecBinary() + _ = yym5 + if false { + } else { + *((*string)(yyv4)) = r.DecodeString() + } + } + case "Dir": + if r.TryDecodeAsNil() { + x.Dir = "" + } else { + yyv6 := &x.Dir + yym7 := z.DecBinary() + _ = yym7 + if false { + } else { + *((*string)(yyv6)) = r.DecodeString() + } + } + case "Value": + if r.TryDecodeAsNil() { + x.Value = "" + } else { + yyv8 := &x.Value + yym9 := z.DecBinary() + _ = yym9 + if false { + } else { + *((*string)(yyv8)) = r.DecodeString() + } + } + case "TTL": + if r.TryDecodeAsNil() { + x.TTL = 0 + } else { + yyv10 := &x.TTL + yym11 := z.DecBinary() + _ = yym11 + if false { + } else if z.HasExtensions() && z.DecExt(yyv10) { + } else { + *((*int64)(yyv10)) = int64(r.DecodeInt(64)) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + r.ReadMapEnd() +} + +func (x *createInOrderAction) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj12 int + var yyb12 bool + var yyhl12 bool = l >= 0 + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Prefix = "" + } else { + yyv13 := &x.Prefix + yym14 := z.DecBinary() + _ = yym14 + if false { + } else { + *((*string)(yyv13)) = r.DecodeString() + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Dir = "" + } else { + yyv15 := &x.Dir + yym16 := z.DecBinary() + _ = yym16 + if false { + } else { + *((*string)(yyv15)) = r.DecodeString() + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.Value = "" + } else { + yyv17 := &x.Value + yym18 := z.DecBinary() + _ = yym18 + if false { + } else { + *((*string)(yyv17)) = r.DecodeString() + } + } + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.TTL = 0 + } else { + yyv19 := &x.TTL + yym20 := z.DecBinary() + _ = yym20 + if false { + } else if z.HasExtensions() && z.DecExt(yyv19) { + } else { + *((*int64)(yyv19)) = int64(r.DecodeInt(64)) + } + } + for { + yyj12++ + if yyhl12 { + yyb12 = yyj12 > l + } else { + yyb12 = r.CheckBreak() + } + if yyb12 { + break + } + r.ReadArrayElem() + z.DecStructFieldNotFound(yyj12-1, "") + } + r.ReadArrayEnd() +} + +func (x codecSelfer7612) encNodes(v Nodes, e *codec1978.Encoder) { + var h codecSelfer7612 + z, r := codec1978.GenHelperEncoder(e) + _, _, _ = h, z, r + r.WriteArrayStart(len(v)) for _, yyv1 := range v { - z.EncSendContainerState(codecSelfer_containerArrayElem1819) + r.WriteArrayElem() if yyv1 == nil { r.EncodeNil() } else { yyv1.CodecEncodeSelf(e) } } - z.EncSendContainerState(codecSelfer_containerArrayEnd1819) + r.WriteArrayEnd() } -func (x codecSelfer1819) decNodes(v *Nodes, d *codec1978.Decoder) { - var h codecSelfer1819 +func (x codecSelfer7612) decNodes(v *Nodes, d *codec1978.Decoder) { + var h codecSelfer7612 z, r := codec1978.GenHelperDecoder(d) _, _, _ = h, z, r @@ -982,79 +5144,49 @@ func (x codecSelfer1819) decNodes(v *Nodes, d *codec1978.Decoder) { yyv1 = yyv1[:0] yyc1 = true } - } else if yyl1 > 0 { - var yyrr1, yyrl1 int - var yyrt1 bool - _, _ = yyrl1, yyrt1 - yyrr1 = yyl1 // len(yyv1) - if yyl1 > cap(yyv1) { - - yyrg1 := len(yyv1) > 0 - yyv21 := yyv1 - yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 8) - if yyrt1 { + } else { + yyhl1 := yyl1 > 0 + var yyrl1 int + _ = yyrl1 + if yyhl1 { + if yyl1 > cap(yyv1) { + yyrl1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 8) if yyrl1 <= cap(yyv1) { yyv1 = yyv1[:yyrl1] } else { yyv1 = make([]*Node, yyrl1) } - } else { - yyv1 = make([]*Node, yyrl1) + yyc1 = true + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true } - yyc1 = true - yyrr1 = len(yyv1) - if yyrg1 { - copy(yyv1, yyv21) - } - } else if yyl1 != len(yyv1) { - yyv1 = yyv1[:yyl1] - yyc1 = true } - yyj1 := 0 - for ; yyj1 < yyrr1; yyj1++ { - yyh1.ElemContainerState(yyj1) - if r.TryDecodeAsNil() { - if yyv1[yyj1] != nil { - *yyv1[yyj1] = Node{} - } - } else { - if yyv1[yyj1] == nil { - yyv1[yyj1] = new(Node) - } - yyw2 := yyv1[yyj1] - yyw2.CodecDecodeSelf(d) - } - - } - if yyrt1 { - for ; yyj1 < yyl1; yyj1++ { - yyv1 = append(yyv1, nil) - yyh1.ElemContainerState(yyj1) - if r.TryDecodeAsNil() { - if yyv1[yyj1] != nil { - *yyv1[yyj1] = Node{} - } + var yyj1 int + // var yydn1 bool + for ; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { + if yyj1 == 0 && len(yyv1) == 0 { + if yyhl1 { + yyrl1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 8) } else { - if yyv1[yyj1] == nil { - yyv1[yyj1] = new(Node) - } - yyw3 := yyv1[yyj1] - yyw3.CodecDecodeSelf(d) + yyrl1 = 8 } - - } - } - - } else { - yyj1 := 0 - for ; !r.CheckBreak(); yyj1++ { - - if yyj1 >= len(yyv1) { - yyv1 = append(yyv1, nil) // var yyz1 *Node + yyv1 = make([]*Node, yyrl1) yyc1 = true } yyh1.ElemContainerState(yyj1) - if yyj1 < len(yyv1) { + // yydn1 = r.TryDecodeAsNil() + + // if indefinite, etc, then expand the slice if necessary + var yydb1 bool + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, nil) + yyc1 = true + + } + if yydb1 { + z.DecSwallow() + } else { if r.TryDecodeAsNil() { if yyv1[yyj1] != nil { *yyv1[yyj1] = Node{} @@ -1063,12 +5195,10 @@ func (x codecSelfer1819) decNodes(v *Nodes, d *codec1978.Decoder) { if yyv1[yyj1] == nil { yyv1[yyj1] = new(Node) } - yyw4 := yyv1[yyj1] - yyw4.CodecDecodeSelf(d) + yyw2 := yyv1[yyj1] + yyw2.CodecDecodeSelf(d) } - } else { - z.DecSwallow() } } @@ -1076,7 +5206,7 @@ func (x codecSelfer1819) decNodes(v *Nodes, d *codec1978.Decoder) { yyv1 = yyv1[:yyj1] yyc1 = true } else if yyj1 == 0 && yyv1 == nil { - yyv1 = []*Node{} + yyv1 = make([]*Node, 0) yyc1 = true } } @@ -1084,4 +5214,5 @@ func (x codecSelfer1819) decNodes(v *Nodes, d *codec1978.Decoder) { if yyc1 { *v = yyv1 } + } diff --git a/vendor/github.com/coreos/etcd/client/keys.go b/vendor/github.com/coreos/etcd/client/keys.go index 4a6c41a78..8b9fd3f87 100644 --- a/vendor/github.com/coreos/etcd/client/keys.go +++ b/vendor/github.com/coreos/etcd/client/keys.go @@ -17,6 +17,7 @@ package client //go:generate codecgen -d 1819 -r "Node|Response|Nodes" -o keys.generated.go keys.go import ( + "context" "encoding/json" "errors" "fmt" @@ -28,7 +29,6 @@ import ( "github.com/coreos/etcd/pkg/pathutil" "github.com/ugorji/go/codec" - "golang.org/x/net/context" ) const ( @@ -653,8 +653,7 @@ func unmarshalHTTPResponse(code int, header http.Header, body []byte) (res *Resp default: err = unmarshalFailedKeysResponse(body) } - - return + return res, err } func unmarshalSuccessfulKeysResponse(header http.Header, body []byte) (*Response, error) { diff --git a/vendor/github.com/coreos/etcd/client/keys_test.go b/vendor/github.com/coreos/etcd/client/keys_test.go index 253fa9b8f..0e190cf59 100644 --- a/vendor/github.com/coreos/etcd/client/keys_test.go +++ b/vendor/github.com/coreos/etcd/client/keys_test.go @@ -15,6 +15,7 @@ package client import ( + "context" "errors" "fmt" "io/ioutil" @@ -23,8 +24,6 @@ import ( "reflect" "testing" "time" - - "golang.org/x/net/context" ) func TestV2KeysURLHelper(t *testing.T) { diff --git a/vendor/github.com/coreos/etcd/client/main_test.go b/vendor/github.com/coreos/etcd/client/main_test.go new file mode 100644 index 000000000..1f2f3f306 --- /dev/null +++ b/vendor/github.com/coreos/etcd/client/main_test.go @@ -0,0 +1,77 @@ +// Copyright 2017 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package client_test + +import ( + "fmt" + "net/http" + "os" + "regexp" + "strings" + "testing" + "time" + + "github.com/coreos/etcd/integration" + "github.com/coreos/etcd/pkg/testutil" + "github.com/coreos/etcd/pkg/transport" +) + +var exampleEndpoints []string +var exampleTransport *http.Transport + +// TestMain sets up an etcd cluster if running the examples. +func TestMain(m *testing.M) { + useCluster, hasRunArg := false, false // default to running only Test* + for _, arg := range os.Args { + if strings.HasPrefix(arg, "-test.run=") { + exp := strings.Split(arg, "=")[1] + match, err := regexp.MatchString(exp, "Example") + useCluster = (err == nil && match) || strings.Contains(exp, "Example") + hasRunArg = true + break + } + } + if !hasRunArg { + // force only running Test* if no args given to avoid leak false + // positives from having a long-running cluster for the examples. + os.Args = append(os.Args, "-test.run=Test") + } + + var v int + if useCluster { + tr, trerr := transport.NewTransport(transport.TLSInfo{}, time.Second) + if trerr != nil { + fmt.Fprintf(os.Stderr, "%v", trerr) + os.Exit(1) + } + cfg := integration.ClusterConfig{Size: 1} + clus := integration.NewClusterV3(nil, &cfg) + exampleEndpoints = []string{clus.Members[0].URL()} + exampleTransport = tr + v = m.Run() + clus.Terminate(nil) + if err := testutil.CheckAfterTest(time.Second); err != nil { + fmt.Fprintf(os.Stderr, "%v", err) + os.Exit(1) + } + } else { + v = m.Run() + } + + if v == 0 && testutil.CheckLeakedGoroutine() { + os.Exit(1) + } + os.Exit(v) +} diff --git a/vendor/github.com/coreos/etcd/client/members.go b/vendor/github.com/coreos/etcd/client/members.go index 23adf07ad..aafa3d1b8 100644 --- a/vendor/github.com/coreos/etcd/client/members.go +++ b/vendor/github.com/coreos/etcd/client/members.go @@ -16,14 +16,13 @@ package client import ( "bytes" + "context" "encoding/json" "fmt" "net/http" "net/url" "path" - "golang.org/x/net/context" - "github.com/coreos/etcd/pkg/types" ) @@ -44,7 +43,7 @@ type Member struct { PeerURLs []string `json:"peerURLs"` // ClientURLs represents the HTTP(S) endpoints on which this Member - // serves it's client-facing APIs. + // serves its client-facing APIs. ClientURLs []string `json:"clientURLs"` } diff --git a/vendor/github.com/coreos/etcd/client/members_test.go b/vendor/github.com/coreos/etcd/client/members_test.go index f199db2cb..706b6aeb8 100644 --- a/vendor/github.com/coreos/etcd/client/members_test.go +++ b/vendor/github.com/coreos/etcd/client/members_test.go @@ -15,6 +15,7 @@ package client import ( + "context" "encoding/json" "errors" "net/http" @@ -22,8 +23,6 @@ import ( "reflect" "testing" - "golang.org/x/net/context" - "github.com/coreos/etcd/pkg/types" ) diff --git a/vendor/github.com/coreos/etcd/etcd.conf.yml.sample b/vendor/github.com/coreos/etcd/etcd.conf.yml.sample index c11fee8d9..2bc115f83 100644 --- a/vendor/github.com/coreos/etcd/etcd.conf.yml.sample +++ b/vendor/github.com/coreos/etcd/etcd.conf.yml.sample @@ -106,7 +106,7 @@ client-transport-security: # Enable client cert authentication. client-cert-auth: false - # Path to the client server TLS trusted CA key file. + # Path to the client server TLS trusted CA cert file. trusted-ca-file: # Client TLS using generated certificates @@ -123,9 +123,9 @@ peer-transport-security: key-file: # Enable peer client cert authentication. - client-cert-auth: false + peer-client-cert-auth: false - # Path to the peer server TLS trusted CA key file. + # Path to the peer server TLS trusted CA cert file. trusted-ca-file: # Peer TLS using generated certificates. @@ -137,5 +137,8 @@ debug: false # Specify a particular log level for each etcd package (eg: 'etcdmain=CRITICAL,etcdserver=DEBUG'. log-package-levels: +# Specify 'stdout' or 'stderr' to skip journald logging even when running under systemd. +log-output: default + # Force to create a new one member cluster. force-new-cluster: false diff --git a/vendor/github.com/coreos/etcd/glide.lock b/vendor/github.com/coreos/etcd/glide.lock index 67d83d8fd..0188e0d68 100644 --- a/vendor/github.com/coreos/etcd/glide.lock +++ b/vendor/github.com/coreos/etcd/glide.lock @@ -1,5 +1,5 @@ -hash: 57308341a6ff76ce7960119ca6f589d2f5476c056f1f38f9a32552d9e68509d8 -updated: 2017-12-19T13:02:46.509863-08:00 +hash: 23d3b011a2e95e7c285287f62d6c7404ee42ccf6f81055cd24ab58da51a10f42 +updated: 2017-12-18T15:54:23.990881-08:00 imports: - name: github.com/beorn7/perks version: 4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9 @@ -7,16 +7,14 @@ imports: - quantile - name: github.com/bgentry/speakeasy version: 4aabc24848ce5fd31929f7d1e4ea74d3709c14cd -- name: github.com/cockroachdb/cmux - version: 112f0506e7743d64a6eb8fedbcff13d9979bbf92 - name: github.com/coreos/bbolt - version: 32c383e75ce054674c53b5a07e55de85332aee14 + version: 48ea1b39c25fc1bab3506fbc712ecbaa842c4d2d - name: github.com/coreos/go-semver version: 8ab6407b697782a06568d4b7f1db25550ec2e4c6 subpackages: - semver - name: github.com/coreos/go-systemd - version: 48702e0da86bd25e76cfef347e2adeb434a0d0a6 + version: d2196463941895ee908e13531a23a39feb9e1243 subpackages: - daemon - journal @@ -33,23 +31,24 @@ imports: - name: github.com/dgrijalva/jwt-go version: d2709f9f1f31ebcda9651b03077758c1f3a0018c - name: github.com/dustin/go-humanize - version: 8929fe90cee4b2cb9deb468b51fb34eba64d1bf0 + version: bb3d318650d48840a39aa21a027c6630e198e626 - name: github.com/ghodss/yaml version: 0ca9ea5df5451ffdf184b4428c902747c2c11cd7 - name: github.com/gogo/protobuf - version: 100ba4e885062801d56799d78530b73b178a78f3 + version: 342cbe0a04158f6dcb03ca0079991a51a4248c02 subpackages: + - gogoproto - proto + - protoc-gen-gogo/descriptor - name: github.com/golang/groupcache version: 02826c3e79038b59d737d3b1c0a1d937f71a4433 subpackages: - lru - name: github.com/golang/protobuf - version: 5a0f697c9ed9d68fef0116532c6e05cfeae00e55 + version: 1e59b77b52bf8e4b449a57e6f79f21226d571845 subpackages: - jsonpb - proto - - protoc-gen-go/descriptor - ptypes - ptypes/any - ptypes/duration @@ -57,8 +56,10 @@ imports: - ptypes/timestamp - name: github.com/google/btree version: 925471ac9e2131377a91e1595defec898166fe49 +- name: github.com/gorilla/websocket + version: 4201258b820c74ac8e6922fc9e6b52f71fe46f8d - name: github.com/grpc-ecosystem/go-grpc-prometheus - version: 6b7015e65d366bf3f19b2b2a000a831940f0f7e0 + version: 0dafe0d496ea71181bf2dd039e7e3f44b6bd11a7 - name: github.com/grpc-ecosystem/grpc-gateway version: 8cc3a55af3bcf171a1c23a90c4df9cf591706104 subpackages: @@ -82,31 +83,40 @@ imports: - name: github.com/olekukonko/tablewriter version: a0225b3f23b5ce0cbec6d7a66a968f8a59eca9c4 - name: github.com/prometheus/client_golang - version: c5b7fccd204277076155f10851dad72b76a49317 + version: 5cec1d0429b02e4323e042eb04dafdb079ddf568 subpackages: - prometheus + - prometheus/promhttp - name: github.com/prometheus/client_model version: 6f3806018612930941127f2a7c6c453ba2c527d2 subpackages: - go - name: github.com/prometheus/common - version: 49fee292b27bfff7f354ee0f64e1bc4850462edf + version: e3fb1a1acd7605367a2b378bc2e2f893c05174b7 subpackages: - expfmt - internal/bitbucket.org/ww/goautoneg - model - name: github.com/prometheus/procfs - version: a1dba9ce8baed984a2495b658c82687f8157b98f + version: a6e9df898b1336106c743392c48ee0b71f5c4efa subpackages: - xfs - name: github.com/russross/blackfriday version: 4048872b16cc0fc2c5fd9eacf0ed2c2fedaa0c8c +- name: github.com/sirupsen/logrus + version: f006c2ac4710855cf0f916dd6b77acf6b048dc6e +- name: github.com/soheilhy/cmux + version: bb79a83465015a27a175925ebd155e660f55e9f1 - name: github.com/spf13/cobra version: 1c44ec8d3f1552cac48999f9306da23c4d8a288b - name: github.com/spf13/pflag - version: 08b1a584251b5b62f458943640fc8ebd4d50aaa5 + version: e57e3eeb33f795204c1ca35f56c44f83227c6e66 +- name: github.com/tmc/grpc-websocket-proxy + version: 89b8d40f7ca833297db804fcb3be53a76d01c238 + subpackages: + - wsproxy - name: github.com/ugorji/go - version: ded73eae5db7e7a0ef6f55aace87a2873c5d2b74 + version: bdcc60b419d136a85cdf2e7cbcac34b3f1cd6e57 subpackages: - codec - name: github.com/urfave/cli @@ -118,6 +128,7 @@ imports: subpackages: - bcrypt - blowfish + - ssh/terminal - name: golang.org/x/net version: 66aacef3dd8a676686c7ae3716979581e8b03c47 subpackages: @@ -129,11 +140,12 @@ imports: - lex/httplex - trace - name: golang.org/x/sys - version: e48874b42435b4347fc52bdee0424a52abc974d7 + version: ebfc5b4631820b793c9010c87fd8fef0f39eb082 subpackages: - unix + - windows - name: golang.org/x/text - version: 4ee4af566555f5fbe026368b75596286a312663a + version: b19bf474d317b857955b12035d2c5acb57ce8b01 subpackages: - secure/bidirule - transform @@ -146,7 +158,6 @@ imports: - name: google.golang.org/genproto version: 09f6ed296fc66555a25fe4ce95173148778dfa85 subpackages: - - googleapis/api/annotations - googleapis/rpc/status - name: google.golang.org/grpc version: 5b3c4e850e90a4cf6a20ebd46c8b32a0a3afcb9e diff --git a/vendor/github.com/coreos/etcd/glide.yaml b/vendor/github.com/coreos/etcd/glide.yaml index b3bd3fef8..20c49b3af 100644 --- a/vendor/github.com/coreos/etcd/glide.yaml +++ b/vendor/github.com/coreos/etcd/glide.yaml @@ -1,17 +1,17 @@ package: github.com/coreos/etcd +ignore: +- google.golang.org/appengine import: - package: github.com/bgentry/speakeasy - version: 4aabc24848ce5fd31929f7d1e4ea74d3709c14cd + version: v0.1.0 - package: github.com/coreos/bbolt - version: v1.3.1-coreos.5 -- package: github.com/cockroachdb/cmux - version: 112f0506e7743d64a6eb8fedbcff13d9979bbf92 + version: v1.3.1-coreos.6 - package: github.com/coreos/go-semver version: v0.2.0 subpackages: - semver - package: github.com/coreos/go-systemd - version: v14 + version: v15 subpackages: - daemon - journal @@ -20,20 +20,25 @@ import: version: v3 subpackages: - capnslog +- package: github.com/cpuguy83/go-md2man + version: 23709d0847197db6021a51fdb193e66e9222d4e7 - package: github.com/dustin/go-humanize - version: 8929fe90cee4b2cb9deb468b51fb34eba64d1bf0 + version: bb3d318650d48840a39aa21a027c6630e198e626 - package: github.com/ghodss/yaml version: v1.0.0 - package: github.com/gogo/protobuf - version: v0.4 + version: v0.5 subpackages: - proto + - gogoproto +- package: github.com/gorilla/websocket + version: 4201258b820c74ac8e6922fc9e6b52f71fe46f8d - package: github.com/golang/groupcache version: 02826c3e79038b59d737d3b1c0a1d937f71a4433 subpackages: - lru - package: github.com/golang/protobuf - version: 5a0f697c9ed9d68fef0116532c6e05cfeae00e55 + version: 1e59b77b52bf8e4b449a57e6f79f21226d571845 subpackages: - jsonpb - proto @@ -56,27 +61,34 @@ import: subpackages: - runewidth.go - package: github.com/prometheus/client_golang - version: v0.8.0 + version: 5cec1d0429b02e4323e042eb04dafdb079ddf568 subpackages: - prometheus + - prometheus/promhttp +- package: github.com/prometheus/client_model + version: 6f3806018612930941127f2a7c6c453ba2c527d2 + subpackages: + - go - package: github.com/prometheus/common - version: 49fee292b27bfff7f354ee0f64e1bc4850462edf + version: e3fb1a1acd7605367a2b378bc2e2f893c05174b7 - package: github.com/prometheus/procfs - version: a1dba9ce8baed984a2495b658c82687f8157b98f + version: a6e9df898b1336106c743392c48ee0b71f5c4efa + subpackages: + - xfs +- package: github.com/grpc-ecosystem/go-grpc-prometheus + version: 0dafe0d496ea71181bf2dd039e7e3f44b6bd11a7 - package: github.com/spf13/cobra version: 1c44ec8d3f1552cac48999f9306da23c4d8a288b - package: github.com/spf13/pflag - version: 08b1a584251b5b62f458943640fc8ebd4d50aaa5 + version: v1.0.0 - package: github.com/ugorji/go - version: ded73eae5db7e7a0ef6f55aace87a2873c5d2b74 + version: bdcc60b419d136a85cdf2e7cbcac34b3f1cd6e57 subpackages: - codec - package: github.com/urfave/cli version: v1.18.0 - package: github.com/xiang90/probing - version: 07dd2e8dfe18522e9c447ba95f2fe95262f63bb2 -- package: github.com/grpc-ecosystem/go-grpc-prometheus - version: v1.1 + version: 0.0.1 - package: golang.org/x/crypto version: 9419663f5a44be8b34ca85f08abc5fe1be11f8a3 subpackages: @@ -91,7 +103,7 @@ import: - internal/timeseries - trace - package: golang.org/x/sys - version: e48874b42435b4347fc52bdee0424a52abc974d7 + version: ebfc5b4631820b793c9010c87fd8fef0f39eb082 - package: golang.org/x/time version: c06e80d9300e4443158a03817b8a8cb37d230320 subpackages: @@ -115,20 +127,24 @@ import: version: cd8b52f8269e0feb286dfeef29f8fe4d5b397e0b - package: github.com/dgrijalva/jwt-go version: v3.0.0 -- package: github.com/beorn7/perks - version: 4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9 -- package: github.com/cpuguy83/go-md2man - version: 23709d0847197db6021a51fdb193e66e9222d4e7 -- package: github.com/matttproud/golang_protobuf_extensions - version: c12348ce28de40eed0136aa2b644d0ee0650e56c -- package: github.com/prometheus/client_model - version: 6f3806018612930941127f2a7c6c453ba2c527d2 -- package: github.com/russross/blackfriday - version: 4048872b16cc0fc2c5fd9eacf0ed2c2fedaa0c8c -- package: golang.org/x/text - version: 4ee4af566555f5fbe026368b75596286a312663a - package: google.golang.org/genproto version: 09f6ed296fc66555a25fe4ce95173148778dfa85 subpackages: - - googleapis/api/annotations - googleapis/rpc/status +- package: golang.org/x/text + version: b19bf474d317b857955b12035d2c5acb57ce8b01 + subpackages: + - secure/bidirule + - transform + - unicode/bidi + - unicode/norm +- package: github.com/russross/blackfriday + version: 4048872b16cc0fc2c5fd9eacf0ed2c2fedaa0c8c +- package: github.com/sirupsen/logrus + version: v1.0.3 +- package: github.com/soheilhy/cmux + version: v0.1.3 +- package: github.com/tmc/grpc-websocket-proxy + version: 89b8d40f7ca833297db804fcb3be53a76d01c238 + subpackages: + - wsproxy diff --git a/vendor/github.com/coreos/etcd/meeting.ics b/vendor/github.com/coreos/etcd/meeting.ics new file mode 100644 index 000000000..0157f9ab0 --- /dev/null +++ b/vendor/github.com/coreos/etcd/meeting.ics @@ -0,0 +1,49 @@ +BEGIN:VCALENDAR +PRODID:-//Google Inc//Google Calendar 70.9054//EN +VERSION:2.0 +CALSCALE:GREGORIAN +METHOD:REPLY +BEGIN:VTIMEZONE +TZID:America/Los_Angeles +X-LIC-LOCATION:America/Los_Angeles +BEGIN:DAYLIGHT +TZOFFSETFROM:-0800 +TZOFFSETTO:-0700 +TZNAME:PDT +DTSTART:19700308T020000 +RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU +END:DAYLIGHT +BEGIN:STANDARD +TZOFFSETFROM:-0700 +TZOFFSETTO:-0800 +TZNAME:PST +DTSTART:19701101T020000 +RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU +END:STANDARD +END:VTIMEZONE +BEGIN:VEVENT +DTSTART;TZID=America/Los_Angeles:20180116T110000 +DTEND;TZID=America/Los_Angeles:20180116T115000 +RRULE:FREQ=WEEKLY;INTERVAL=2;BYDAY=TU +DTSTAMP:20171213T131221Z +ORGANIZER;CN=Gyuho Lee:mailto:gyu_ho.lee@coreos.com +UID:11ivec3kg2egsng3vrl8t5alar@google.com +CREATED:20171212T194217Z +DESCRIPTION:
Please add your discussion items to the meeting notes.
< + br>Meeting notes
https://docs.google.com + /document/d/1DbVXOHvd9scFsSmL2oNg4YGOHJdXqtx583DmeVWrB_M/edit?usp=sharing

Zoom meeting
https://coreos.zoom + .us/j/854793406

Slack
https://kubernetes. + slack.com #etcd


+LAST-MODIFIED:20171213T131220Z +SEQUENCE:0 +STATUS:CONFIRMED +SUMMARY:etcd meeting +TRANSP:OPAQUE +END:VEVENT +END:VCALENDAR diff --git a/vendor/github.com/coreos/etcd/pkg/srv/srv.go b/vendor/github.com/coreos/etcd/pkg/srv/srv.go index fefcbcb4b..600061ce8 100644 --- a/vendor/github.com/coreos/etcd/pkg/srv/srv.go +++ b/vendor/github.com/coreos/etcd/pkg/srv/srv.go @@ -71,9 +71,10 @@ func GetCluster(service, name, dns string, apurls types.URLs) ([]string, error) // SRV records have a trailing dot but URL shouldn't. shortHost := strings.TrimSuffix(srv.Target, ".") urlHost := net.JoinHostPort(shortHost, port) - stringParts = append(stringParts, fmt.Sprintf("%s=%s://%s", n, scheme, urlHost)) if ok && url.Scheme != scheme { err = fmt.Errorf("bootstrap at %s from DNS for %s has scheme mismatch with expected peer %s", scheme+"://"+urlHost, service, url.String()) + } else { + stringParts = append(stringParts, fmt.Sprintf("%s=%s://%s", n, scheme, urlHost)) } } if len(stringParts) == 0 { diff --git a/vendor/github.com/coreos/etcd/pkg/srv/srv_test.go b/vendor/github.com/coreos/etcd/pkg/srv/srv_test.go index 0386c9d2a..17faa8548 100644 --- a/vendor/github.com/coreos/etcd/pkg/srv/srv_test.go +++ b/vendor/github.com/coreos/etcd/pkg/srv/srv_test.go @@ -86,7 +86,14 @@ func TestSRVGetCluster(t *testing.T) { "dnsClusterTest=https://1.example.com:2480,0=https://2.example.com:2480,1=https://3.example.com:2480", }, - // invalid + // reject if apurls are TLS but SRV is only http + { + nil, + srvAll, + []string{"https://10.0.0.1:2480"}, + + "0=http://2.example.com:2480,1=http://3.example.com:2480", + }, } resolveTCPAddr = func(network, addr string) (*net.TCPAddr, error) { diff --git a/vendor/github.com/coreos/etcd/pkg/types/set.go b/vendor/github.com/coreos/etcd/pkg/types/set.go index 73ef431be..c111b0c0c 100644 --- a/vendor/github.com/coreos/etcd/pkg/types/set.go +++ b/vendor/github.com/coreos/etcd/pkg/types/set.go @@ -61,7 +61,7 @@ func (us *unsafeSet) Remove(value string) { // Contains returns whether the set contains the given value func (us *unsafeSet) Contains(value string) (exists bool) { _, exists = us.d[value] - return + return exists } // ContainsAll returns whether the set contains all given values @@ -94,7 +94,7 @@ func (us *unsafeSet) Values() (values []string) { for val := range us.d { values = append(values, val) } - return + return values } // Copy creates a new Set containing the values of the first diff --git a/vendor/github.com/coreos/etcd/test b/vendor/github.com/coreos/etcd/test index 08be1b2ed..3865db5f3 100755 --- a/vendor/github.com/coreos/etcd/test +++ b/vendor/github.com/coreos/etcd/test @@ -91,24 +91,30 @@ function unit_pass { export CLIENT_DEBUG=1 fi # only -run=Test so examples can run in integration tests - go test ${GO_TEST_FLAG} -timeout 5m "${COVER}" ${RACE} -cpu 1,2,4 -run=Test "$@" "${TEST[@]}" + go test ${GO_TEST_FLAG} -timeout 3m "${COVER}" ${RACE} -cpu 1,2,4 -run=Test "$@" "${TEST[@]}" } function integration_pass { echo "Running integration tests..." - go test -timeout 15m -v -cpu 1,2,4 $@ ${REPO_PATH}/integration - go test -timeout 1m -v ${RACE} -cpu 1,2,4 $@ ${REPO_PATH}/client/integration - go test -timeout 10m -v ${RACE} -cpu 1,2,4 $@ ${REPO_PATH}/clientv3/integration - go test -timeout 1m -v -cpu 1,2,4 $@ ${REPO_PATH}/contrib/raftexample - go test -timeout 1m -v ${RACE} -cpu 1,2,4 -run=Example $@ ${TEST} + go test -timeout 15m -v -cpu 1,2,4 "$@" "${REPO_PATH}/integration" + integration_extra "$@" +} + +function integration_extra { + go test -timeout 1m -v ${RACE} -cpu 1,2,4 "$@" "${REPO_PATH}/client/integration" + go test -timeout 20m -v ${RACE} -cpu 1,2,4 "$@" "${REPO_PATH}/clientv3/integration" + go test -timeout 1m -v -cpu 1,2,4 "$@" "${REPO_PATH}/contrib/raftexample" + go test -timeout 5m -v ${RACE} -tags v2v3 "$@" "${REPO_PATH}/store" + go test -timeout 1m -v ${RACE} -cpu 1,2,4 -run=Example "$@" "${TEST[@]}" } function functional_pass { - # Clean up any data and logs from previous runs + # Clean up any data and logs from previous runs rm -rf ./agent-* + for a in 1 2 3; do mkdir -p ./agent-$a - ./bin/etcd-agent -etcd-path ./bin/etcd -etcd-log-dir "./agent-$a" -port ":${a}9027" -use-root=false & + ./bin/etcd-agent -etcd-path ./bin/etcd -etcd-log-dir "./agent-$a" -port ":${a}9027" & pid="$!" agent_pids="${agent_pids} $pid" done @@ -123,17 +129,23 @@ function functional_pass { echo "Starting 'etcd-tester'" ./bin/etcd-tester \ -agent-endpoints "127.0.0.1:19027,127.0.0.1:29027,127.0.0.1:39027" \ - -client-ports 12379,22379,32379 \ - -peer-ports 12380,22380,32380 \ + -client-ports 1379,2379,3379 \ + -advertise-client-ports 13790,23790,33790 \ + -peer-ports 1380,2380,3380 \ + -advertise-peer-ports 13800,23800,33800 \ -limit 1 \ - -schedule-cases "0 1 2 3 4 5" \ + -schedule-cases "0 1 2 3 4 5 6 7 8 9" \ + -stress-qps 1000 \ + -stress-key-txn-count 100 \ + -stress-key-txn-ops 10 \ -exit-on-failure && echo "'etcd-tester' succeeded" ETCD_TESTER_EXIT_CODE=$? echo "ETCD_TESTER_EXIT_CODE:" ${ETCD_TESTER_EXIT_CODE} echo "Waiting for processes to exit" - kill -s TERM ${agent_pids} - for a in ${agent_pids}; do wait $a || true; done + agent_pids=($agent_pids) + kill -s TERM "${agent_pids[@]}" + for a in "${agent_pids[@]}"; do wait "$a" || true; done if [[ "${ETCD_TESTER_EXIT_CODE}" -ne "0" ]]; then echo "--- FAIL: exit code" ${ETCD_TESTER_EXIT_CODE} @@ -141,14 +153,81 @@ function functional_pass { fi } -function e2e_pass { - echo "Running e2e tests..." - go test -timeout 15m -v -cpu 1,2,4 $@ ${REPO_PATH}/e2e +function cov_pass { + echo "Running code coverage..." + # install gocovmerge before running code coverage from github.com/wadey/gocovmerge + # gocovmerge merges coverage files + if ! which gocovmerge >/dev/null; then + echo "gocovmerge not installed" + exit 255 + fi + + if [ -z "$COVERDIR" ]; then + echo "COVERDIR undeclared" + exit 255 + fi + + if [ ! -f "bin/etcd_test" ]; then + echo "etcd_test binary not found" + exit 255 + fi + + mkdir -p "$COVERDIR" + + # run code coverage for unit and integration tests + GOCOVFLAGS="-covermode=set -coverpkg ${PKGS_COMMA} -v -timeout 15m" + GOCOVFLAGS=($GOCOVFLAGS) + failed="" + for t in $(echo "${TEST_PKGS}" | grep -vE "(e2e|functional-tester)"); do + tf=$(echo "$t" | tr / _) + # cache package compilation data for faster repeated builds + go test "${GOCOVFLAGS[@]}" -i "${REPO_PATH}/$t" || true + # uses -run=Test to skip examples because clientv3/ example tests will leak goroutines + go test "${GOCOVFLAGS[@]}" -run=Test -coverprofile "$COVERDIR/${tf}.coverprofile" "${REPO_PATH}/$t" || failed="$failed $t" + done + + # v2v3 tests + go test -tags v2v3 "${GOCOVFLAGS[@]}" -coverprofile "$COVERDIR/store-v2v3.coverprofile" "${REPO_PATH}/clientv3/integration" || failed="$failed store-v2v3" + + # proxy tests + go test -tags cluster_proxy "${GOCOVFLAGS[@]}" -coverprofile "$COVERDIR/proxy_integration.coverprofile" "${REPO_PATH}/integration" || failed="$failed proxy-integration" + go test -tags cluster_proxy "${GOCOVFLAGS[@]}" -coverprofile "$COVERDIR/proxy_clientv3.coverprofile" "${REPO_PATH}/clientv3/integration" || failed="$failed proxy-clientv3/integration" + + # run code coverage for e2e tests + # use 30m timeout because e2e coverage takes longer + # due to many tests cause etcd process to wait + # on leadership transfer timeout during gracefully shutdown + echo Testing e2e without proxy... + go test -tags cov -timeout 30m -v "${REPO_PATH}/e2e" || failed="$failed e2e" + echo Testing e2e with proxy... + go test -tags "cov cluster_proxy" -timeout 30m -v "${REPO_PATH}/e2e" || failed="$failed e2e-proxy" + + # incrementally merge to get coverage data even if some coverage files are corrupted + # optimistically assume etcdserver package's coverage file is OK since gocovmerge + # expects to start with a non-empty file + cp "$COVERDIR"/etcdserver.coverprofile "$COVERDIR"/cover.out + for f in "$COVERDIR"/*.coverprofile; do + echo "merging test coverage file ${f}" + gocovmerge "$f" "$COVERDIR"/cover.out >"$COVERDIR"/cover.tmp || failed="$failed $f" + if [ -s "$COVERDIR"/cover.tmp ]; then + mv "$COVERDIR"/cover.tmp "$COVERDIR"/cover.out + fi + done + # strip out generated files (using GNU-style sed) + sed --in-place '/generated.go/d' "$COVERDIR"/cover.out || true + + # held failures to generate the full coverage file, now fail + if [ -n "$failed" ]; then + for f in $failed; do + echo "--- FAIL:" "$f" + done + exit 255 + fi } -function integration_extra { - go test -timeout 15m -v ${RACE} -cpu 1,2,4 "$@" "${REPO_PATH}/client/integration" - go test -timeout 20m -v ${RACE} -cpu 1,2,4 "$@" "${REPO_PATH}/clientv3/integration" +function e2e_pass { + echo "Running e2e tests..." + go test -timeout 15m -v -cpu 1,2,4 "$@" "${REPO_PATH}/e2e" } function integration_e2e_pass { @@ -164,20 +243,21 @@ function integration_e2e_pass { } function grpcproxy_pass { - go test -timeout 15m -v ${RACE} -tags cluster_proxy -cpu 1,2,4 $@ ${REPO_PATH}/integration - go test -timeout 15m -v ${RACE} -tags cluster_proxy -cpu 1,2,4 $@ ${REPO_PATH}/clientv3/integration + go test -timeout 20m -v ${RACE} -tags cluster_proxy -cpu 1,2,4 "$@" "${REPO_PATH}/integration" + go test -timeout 20m -v ${RACE} -tags cluster_proxy -cpu 1,2,4 "$@" "${REPO_PATH}/clientv3/integration" + go test -timeout 15m -v -tags cluster_proxy "$@" "${REPO_PATH}/e2e" } function release_pass { rm -f ./bin/etcd-last-release # to grab latest patch release; bump this up for every minor release - UPGRADE_VER=$(git tag -l --sort=-version:refname "v3.2.*" | head -1) + UPGRADE_VER=$(git tag -l --sort=-version:refname "v3.3.*" | head -1) if [ -n "$MANUAL_VER" ]; then # in case, we need to test against different version UPGRADE_VER=$MANUAL_VER fi if [[ -z ${UPGRADE_VER} ]]; then - UPGRADE_VER="v3.2.0" + UPGRADE_VER="v3.3.0" echo "fallback to" ${UPGRADE_VER} fi @@ -185,7 +265,7 @@ function release_pass { echo "Downloading $file" set +e - curl --fail -L https://github.com/coreos/etcd/releases/download/$UPGRADE_VER/$file -o /tmp/$file + curl --fail -L "https://github.com/coreos/etcd/releases/download/$UPGRADE_VER/$file" -o "/tmp/$file" local result=$? set -e case $result in @@ -195,40 +275,60 @@ function release_pass { ;; esac - tar xzvf /tmp/$file -C /tmp/ --strip-components=1 + tar xzvf "/tmp/$file" -C /tmp/ --strip-components=1 mkdir -p ./bin mv /tmp/etcd ./bin/etcd-last-release } -function fmt_pass { - toggle_failpoints disable - - echo "Checking gofmt..." - fmtRes=$(gofmt -l -s -d $FMT) +function gofmt_pass { + fmtRes=$(gofmt -l -s -d "${FMT[@]}") if [ -n "${fmtRes}" ]; then echo -e "gofmt checking failed:\n${fmtRes}" exit 255 fi +} - echo "Checking govet..." - vetRes=$(go vet $TEST) +function govet_pass { + vetRes=$(go vet "${TEST[@]}") if [ -n "${vetRes}" ]; then echo -e "govet checking failed:\n${vetRes}" exit 255 fi +} - echo "Checking documentation style..." +function govet_shadow_pass { + fmtpkgs=$(for a in "${FMT[@]}"; do dirname "$a"; done | sort | uniq | grep -v "\\.") + fmtpkgs=($fmtpkgs) + vetRes=$(go tool vet -all -shadow "${fmtpkgs[@]}" 2>&1 | grep -v '/gw/' || true) + if [ -n "${vetRes}" ]; then + echo -e "govet -all -shadow checking failed:\n${vetRes}" + exit 255 + fi +} + +function shellcheck_pass { + if which shellcheck >/dev/null; then + shellcheckResult=$(shellcheck -fgcc build test scripts/* 2>&1 || true) + if [ -n "${shellcheckResult}" ]; then + echo -e "shellcheck checking failed:\n${shellcheckResult}" + exit 255 + fi + fi +} + +function markdown_you_pass { # eschew you - yous=`find . -name \*.md -exec egrep --color "[Yy]ou[r]?[ '.,;]" {} + | grep -v /v2/ || true` + yous=$(find . -name \*.md -exec grep -E --color "[Yy]ou[r]?[ '.,;]" {} + | grep -v /v2/ || true) if [ ! -z "$yous" ]; then echo -e "found 'you' in documentation:\n${yous}" exit 255 fi +} +function markdown_marker_pass { # TODO: check other markdown files when marker handles headers with '[]' if which marker >/dev/null; then - echo "Checking marker to find broken links..." - markerResult=`marker --skip-http --root ./Documentation 2>&1 || true` + markerResult=$(marker --skip-http --root ./Documentation 2>&1 || true) if [ -n "${markerResult}" ]; then echo -e "marker checking failed:\n${markerResult}" exit 255 @@ -236,27 +336,48 @@ function fmt_pass { else echo "Skipping marker..." fi +} +function goword_pass { + if which goword >/dev/null; then + # get all go files to process + gofiles=$(find "${FMT[@]}" -iname '*.go' 2>/dev/null) + gofiles_all=($gofiles) + # ignore tests and protobuf files + gofiles=$(echo "${gofiles_all[@]}" | sort | uniq | sed "s/ /\n/g" | grep -vE "(\\_test.go|\\.pb\\.go)") + gofiles=($gofiles) + # only check for broken exported godocs + gowordRes=$(goword -use-spell=false "${gofiles[@]}" | grep godoc-export | sort) + if [ ! -z "$gowordRes" ]; then + echo -e "goword checking failed:\n${gowordRes}" + exit 255 + fi + # check some spelling + gowordRes=$(goword -ignore-file=.words clientv3/{*,*/*}.go 2>&1 | grep spell | sort) + if [ ! -z "$gowordRes" ]; then + echo -e "goword checking failed:\n${gowordRes}" + exit 255 + fi + else + echo "Skipping goword..." + fi +} + +function gosimple_pass { if which gosimple >/dev/null; then - echo "Checking gosimple..." - gosimpleResult=`gosimple ${STATIC_ANALYSIS_PATHS} 2>&1 || true` + gosimpleResult=$(gosimple "${STATIC_ANALYSIS_PATHS[@]}" 2>&1 || true) if [ -n "${gosimpleResult}" ]; then - # TODO: resolve these after go1.8 migration - SIMPLE_CHECK_MASK="S(1024)" - if echo "${gosimpleResult}" | egrep -v "$SIMPLE_CHECK_MASK"; then - echo -e "gosimple checking failed:\n${gosimpleResult}" - exit 255 - else - echo -e "gosimple warning:\n${gosimpleResult}" - fi + echo -e "gosimple checking failed:\n${gosimpleResult}" + exit 255 fi else echo "Skipping gosimple..." fi +} +function unused_pass { if which unused >/dev/null; then - echo "Checking unused..." - unusedResult=`unused ${STATIC_ANALYSIS_PATHS} 2>&1 || true` + unusedResult=$(unused "${STATIC_ANALYSIS_PATHS[@]}" 2>&1 || true) if [ -n "${unusedResult}" ]; then echo -e "unused checking failed:\n${unusedResult}" exit 255 @@ -264,27 +385,53 @@ function fmt_pass { else echo "Skipping unused..." fi +} +function staticcheck_pass { if which staticcheck >/dev/null; then - echo "Checking staticcheck..." - staticcheckResult=`staticcheck ${STATIC_ANALYSIS_PATHS} 2>&1 || true` + staticcheckResult=$(staticcheck "${STATIC_ANALYSIS_PATHS[@]}" 2>&1 || true) if [ -n "${staticcheckResult}" ]; then # TODO: resolve these after go1.8 migration # See https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck - STATIC_CHECK_MASK="SA(1019|2002)" - if echo "${staticcheckResult}" | egrep -v "$STATIC_CHECK_MASK"; then + STATIC_CHECK_MASK="SA(1012|1019|2002)" + if echo "${staticcheckResult}" | grep -vE "$STATIC_CHECK_MASK"; then echo -e "staticcheck checking failed:\n${staticcheckResult}" exit 255 else - suppressed=`echo "${staticcheckResult}" | sed 's/ /\n/g' | grep "(SA" | sort | uniq -c` + suppressed=$(echo "${staticcheckResult}" | sed 's/ /\n/g' | grep "(SA" | sort | uniq -c) echo -e "staticcheck suppressed warnings:\n${suppressed}" fi fi else echo "Skipping staticcheck..." fi +} - echo "Checking for license header..." +function ineffassign_pass { + if which ineffassign >/dev/null; then + ineffassignResult=$(ineffassign "${STATIC_ANALYSIS_PATHS[@]}" 2>&1 || true) + if [ -n "${ineffassignResult}" ]; then + echo -e "ineffassign checking failed:\n${ineffassignResult}" + exit 255 + fi + else + echo "Skipping ineffassign..." + fi +} + +function nakedret_pass { + if which nakedret >/dev/null; then + nakedretResult=$(nakedret "${STATIC_ANALYSIS_PATHS[@]}" 2>&1 || true) + if [ -n "${nakedretResult}" ]; then + echo -e "nakedret checking failed:\n${nakedretResult}" + exit 255 + fi + else + echo "Skipping nakedret..." + fi +} + +function license_header_pass { licRes="" files=$(find . -type f -iname '*.go' ! -path './cmd/*' ! -path './gopath.proto/*') for file in $files; do @@ -296,10 +443,25 @@ function fmt_pass { echo -e "license header checking failed:\n${licRes}" exit 255 fi +} - echo "Checking commit titles..." - git log --oneline "$(git merge-base HEAD master)"...HEAD | while read l; do - commitMsg=`echo "$l" | cut -f2- -d' '` +function receiver_name_pass { + recvs=$(grep 'func ([^*]' {*,*/*,*/*/*}.go | grep -Ev "(generated|pb/)" | tr ':' ' ' | \ + awk ' { print $2" "$3" "$4" "$1 }' | sed "s/[a-zA-Z\.]*go//g" | sort | uniq | \ + grep -Ev "(Descriptor|Proto|_)" | awk ' { print $3" "$4 } ' | sort | uniq -c | grep -v ' 1 ' | awk ' { print $2 } ') + if [ -n "${recvs}" ]; then + recvs=($recvs) + for recv in "${recvs[@]}"; do + echo "Mismatched receiver for $recv..." + grep "$recv" "${FMT[@]}" | grep 'func (' + done + exit 255 + fi +} + +function commit_title_pass { + git log --oneline "$(git merge-base HEAD master)"...HEAD | while read -r l; do + commitMsg=$(echo "$l" | cut -f2- -d' ') if [[ "$commitMsg" == Merge* ]]; then # ignore "Merge pull" commits continue @@ -309,10 +471,10 @@ function fmt_pass { continue fi - pkgPrefix=`echo "$commitMsg" | cut -f1 -d':'` - spaceCommas=`echo "$commitMsg" | sed 's/ /\n/g' | grep -c ',$' || echo 0` - commaSpaces=`echo "$commitMsg" | sed 's/,/\n/g' | grep -c '^ ' || echo 0` - if [[ `echo $commitMsg | grep -c ":..*"` == 0 || "$commitMsg" == "$pkgPrefix" || "$spaceCommas" != "$commaSpaces" ]]; then + pkgPrefix=$(echo "$commitMsg" | cut -f1 -d':') + spaceCommas=$(echo "$commitMsg" | sed 's/ /\n/g' | grep -c ',$' || echo 0) + commaSpaces=$(echo "$commitMsg" | sed 's/,/\n/g' | grep -c '^ ' || echo 0) + if [[ $(echo "$commitMsg" | grep -c ":..*") == 0 || "$commitMsg" == "$pkgPrefix" || "$spaceCommas" != "$commaSpaces" ]]; then echo "$l"... echo "Expected commit title format '{\", \"}: '" echo "Got: $l" @@ -321,6 +483,31 @@ function fmt_pass { done } +function fmt_pass { + toggle_failpoints disable + + for p in gofmt \ + govet \ + govet_shadow \ + shellcheck \ + markdown_you \ + markdown_marker \ + goword \ + gosimple \ + unused \ + staticcheck \ + ineffassign \ + nakedret \ + license_header \ + receiver_name \ + commit_title \ + ; do + echo "Starting '$p' pass at $(date)" + "${p}"_pass "$@" + echo "Finished '$p' pass at $(date)" + done +} + function bom_pass { if ! which license-bill-of-materials >/dev/null; then return @@ -341,7 +528,7 @@ function dep_pass { # don't pull in etcdserver package pushd clientv3 >/dev/null badpkg="(etcdserver$|mvcc$|backend$|grpc-gateway)" - deps=`go list -f '{{ .Deps }}' | sed 's/ /\n/g' | egrep "${badpkg}" || echo ""` + deps=$(go list -f '{{ .Deps }}' | sed 's/ /\n/g' | grep -E "${badpkg}" || echo "") popd >/dev/null if [ ! -z "$deps" ]; then echo -e "clientv3 has masked dependencies:\n${deps}" @@ -352,8 +539,8 @@ function dep_pass { function build_cov_pass { out="bin" if [ -n "${BINDIR}" ]; then out="${BINDIR}"; fi - go test -tags cov -c -covermode=set -coverpkg=$PKGS_COMMA -o ${out}/etcd_test - go test -tags cov -c -covermode=set -coverpkg=$PKGS_COMMA -o ${out}/etcdctl_test ${REPO_PATH}/etcdctl + go test -tags cov -c -covermode=set -coverpkg="$PKGS_COMMA" -o "${out}/etcd_test" + go test -tags cov -c -covermode=set -coverpkg="$PKGS_COMMA" -o "${out}/etcdctl_test" "${REPO_PATH}/etcdctl" } function compile_pass { @@ -367,7 +554,9 @@ function build_pass { } for pass in $PASSES; do - ${pass}_pass $@ + echo "Starting '$pass' pass at $(date)" + "${pass}"_pass "$@" + echo "Finished '$pass' pass at $(date)" done echo "Success" diff --git a/vendor/github.com/coreos/etcd/version/version.go b/vendor/github.com/coreos/etcd/version/version.go index 4fb4e5519..0b6737138 100644 --- a/vendor/github.com/coreos/etcd/version/version.go +++ b/vendor/github.com/coreos/etcd/version/version.go @@ -26,7 +26,7 @@ import ( var ( // MinClusterVersion is the min cluster version this etcd binary is compatible with. MinClusterVersion = "3.0.0" - Version = "3.2.14" + Version = "3.3.1" APIVersion = "unknown" // Git SHA Value will be set during build diff --git a/vendor/github.com/emicklei/go-restful/CHANGES.md b/vendor/github.com/emicklei/go-restful/CHANGES.md index d90aaa22e..d23b57555 100644 --- a/vendor/github.com/emicklei/go-restful/CHANGES.md +++ b/vendor/github.com/emicklei/go-restful/CHANGES.md @@ -1,5 +1,10 @@ Change history of go-restful = +v2.6.0 +- Make JSR 311 routing and path param processing consistent +- Adding description to RouteBuilder.Reads() +- Update example for Swagger12 and OpenAPI + 2017-09-13 - added route condition functions using `.If(func)` in route building. diff --git a/vendor/github.com/emicklei/go-restful/container.go b/vendor/github.com/emicklei/go-restful/container.go index 4196180e5..b4ad153e8 100644 --- a/vendor/github.com/emicklei/go-restful/container.go +++ b/vendor/github.com/emicklei/go-restful/container.go @@ -259,7 +259,12 @@ func (c *Container) dispatch(httpWriter http.ResponseWriter, httpRequest *http.R chain.ProcessFilter(NewRequest(httpRequest), NewResponse(writer)) return } - wrappedRequest, wrappedResponse := route.wrapRequestResponse(writer, httpRequest) + pathProcessor, routerProcessesPath := c.router.(PathProcessor) + if !routerProcessesPath { + pathProcessor = defaultPathProcessor{} + } + pathParams := pathProcessor.ExtractParameters(route, webService, httpRequest.URL.Path) + wrappedRequest, wrappedResponse := route.wrapRequestResponse(writer, httpRequest, pathParams) // pass through filters (if any) if len(c.containerFilters)+len(webService.filters)+len(route.Filters) > 0 { // compose filter chain diff --git a/vendor/github.com/emicklei/go-restful/curly_test.go b/vendor/github.com/emicklei/go-restful/curly_test.go index bec017ca7..0568dfac1 100644 --- a/vendor/github.com/emicklei/go-restful/curly_test.go +++ b/vendor/github.com/emicklei/go-restful/curly_test.go @@ -158,6 +158,13 @@ func TestExtractParameters_Wildcard3(t *testing.T) { } } +func TestExtractParameters_Wildcard4(t *testing.T) { + params := doExtractParams("/static/{var:*}/sub", 3, "/static/test/sub", t) + if params["var"] != "test/sub" { + t.Errorf("parameter mismatch var: %s", params["var"]) + } +} + // clear && go test -v -test.run TestCurly_ISSUE_34 ...restful func TestCurly_ISSUE_34(t *testing.T) { ws1 := new(WebService).Path("/") diff --git a/vendor/github.com/emicklei/go-restful/jsr311.go b/vendor/github.com/emicklei/go-restful/jsr311.go index 9e8122416..4360b492e 100644 --- a/vendor/github.com/emicklei/go-restful/jsr311.go +++ b/vendor/github.com/emicklei/go-restful/jsr311.go @@ -39,6 +39,31 @@ func (r RouterJSR311) SelectRoute( return dispatcher, route, ok } +// ExtractParameters is used to obtain the path parameters from the route using the same matching +// engine as the JSR 311 router. +func (r RouterJSR311) ExtractParameters(route *Route, webService *WebService, urlPath string) map[string]string { + webServiceExpr := webService.pathExpr + webServiceMatches := webServiceExpr.Matcher.FindStringSubmatch(urlPath) + pathParameters := r.extractParams(webServiceExpr, webServiceMatches) + routeExpr := route.pathExpr + routeMatches := routeExpr.Matcher.FindStringSubmatch(webServiceMatches[len(webServiceMatches)-1]) + routeParams := r.extractParams(routeExpr, routeMatches) + for key, value := range routeParams { + pathParameters[key] = value + } + return pathParameters +} + +func (RouterJSR311) extractParams(pathExpr *pathExpression, matches []string) map[string]string { + params := map[string]string{} + for i := 1; i < len(matches); i++ { + if len(pathExpr.VarNames) >= i { + params[pathExpr.VarNames[i-1]] = matches[i] + } + } + return params +} + // http://jsr311.java.net/nonav/releases/1.1/spec/spec3.html#x3-360003.7.2 func (r RouterJSR311) detectRoute(routes []Route, httpRequest *http.Request) (*Route, error) { ifOk := []Route{} diff --git a/vendor/github.com/emicklei/go-restful/jsr311_test.go b/vendor/github.com/emicklei/go-restful/jsr311_test.go index ecde60366..15cb3333c 100644 --- a/vendor/github.com/emicklei/go-restful/jsr311_test.go +++ b/vendor/github.com/emicklei/go-restful/jsr311_test.go @@ -3,6 +3,7 @@ package restful import ( "io" "net/http" + "reflect" "sort" "testing" ) @@ -13,16 +14,17 @@ import ( var paths = []struct { // url with path (1) is handled by service with root (2) and last capturing group has value final (3) path, root, final string + params map[string]string }{ - {"/", "/", "/"}, - {"/p", "/p", ""}, - {"/p/x", "/p/{q}", ""}, - {"/q/x", "/q", "/x"}, - {"/p/x/", "/p/{q}", "/"}, - {"/p/x/y", "/p/{q}", "/y"}, - {"/q/x/y", "/q", "/x/y"}, - {"/z/q", "/{p}/q", ""}, - {"/a/b/c/q", "/", "/a/b/c/q"}, + {"/", "/", "/", map[string]string{}}, + {"/p", "/p", "", map[string]string{}}, + {"/p/x", "/p/{q}", "", map[string]string{"q": "x"}}, + {"/q/x", "/q", "/x", map[string]string{}}, + {"/p/x/", "/p/{q}", "/", map[string]string{"q": "x"}}, + {"/p/x/y", "/p/{q}", "/y", map[string]string{"q": "x"}}, + {"/q/x/y", "/q", "/x/y", map[string]string{}}, + {"/z/q", "/{p}/q", "", map[string]string{"p": "z"}}, + {"/a/b/c/q", "/", "/a/b/c/q", map[string]string{}}, } func TestDetectDispatcher(t *testing.T) { @@ -37,6 +39,7 @@ func TestDetectDispatcher(t *testing.T) { wc := NewContainer() for _, each := range dispatchers { + each.Route(each.GET("").To(dummy)) wc.Add(each) } @@ -57,6 +60,11 @@ func TestDetectDispatcher(t *testing.T) { t.Logf("[line:%v] Unexpected final, expected:%v, actual:%v", i, fixture.final, final) ok = false } + params := router.ExtractParameters(&who.Routes()[0], who, fixture.path) + if !reflect.DeepEqual(params, fixture.params) { + t.Logf("[line:%v] Unexpected params, expected:%v, actual:%v", i, fixture.params, params) + ok = false + } } if !ok { t.Fail() @@ -248,4 +256,77 @@ func TestDetectRouteReturns404IfNoRoutePassesConditions(t *testing.T) { } } +var extractParams = []struct { + name string + routePath string + urlPath string + expectedParams map[string]string +}{ + {"wildcardLastPart", "/fixed/{var:*}", "/fixed/remainder", map[string]string{"var": "remainder"}}, + {"wildcardMultipleParts", "/fixed/{var:*}", "/fixed/remain/der", map[string]string{"var": "remain/der"}}, + {"wildcardManyParts", "/fixed/{var:*}", "/fixed/test/sub/hi.html", map[string]string{"var": "test/sub/hi.html"}}, + {"wildcardInMiddle", "/fixed/{var:*}/morefixed", "/fixed/middle/stuff/morefixed", map[string]string{"var": "middle/stuff"}}, + {"wildcardFollowedByVar", "/fixed/{var:*}/morefixed/{otherVar}", "/fixed/middle/stuff/morefixed/end", map[string]string{"var": "middle/stuff", "otherVar": "end"}}, + {"singleParam", "/fixed/{var}", "/fixed/remainder", map[string]string{"var": "remainder"}}, + {"slash", "/", "/", map[string]string{}}, + {"NoVars", "/fixed", "/fixed", map[string]string{}}, + {"TwoVars", "/from/{source}/to/{destination}", "/from/LHR/to/AMS", map[string]string{"source": "LHR", "destination": "AMS"}}, + {"VarOnFront", "/{what}/from/{source}", "/who/from/SOS", map[string]string{"what": "who", "source": "SOS"}}, +} + +func TestExtractParams(t *testing.T) { + for _, testCase := range extractParams { + t.Run(testCase.name, func(t *testing.T) { + ws1 := new(WebService).Path("/") + ws1.Route(ws1.GET(testCase.routePath).To(dummy)) + router := RouterJSR311{} + req, _ := http.NewRequest(http.MethodGet, testCase.urlPath, nil) + params := router.ExtractParameters(&ws1.Routes()[0], ws1, req.URL.Path) + if len(params) != len(testCase.expectedParams) { + t.Fatalf("Wrong length of params on selected route, expected: %v, got: %v", testCase.expectedParams, params) + } + for expectedParamKey, expectedParamValue := range testCase.expectedParams { + if expectedParamValue != params[expectedParamKey] { + t.Errorf("Wrong parameter for key '%v', expected: %v, got: %v", expectedParamKey, expectedParamValue, params[expectedParamKey]) + } + } + }) + } +} + +func TestSelectRouteInvalidMethod(t *testing.T) { + ws1 := new(WebService).Path("/") + ws1.Route(ws1.GET("/simple").To(dummy)) + router := RouterJSR311{} + req, _ := http.NewRequest(http.MethodPost, "/simple", nil) + _, _, err := router.SelectRoute([]*WebService{ws1}, req) + if err == nil { + t.Fatal("Expected an error as the wrong method is used but was nil") + } +} + +func TestParameterInWebService(t *testing.T) { + for _, testCase := range extractParams { + t.Run(testCase.name, func(t *testing.T) { + ws1 := new(WebService).Path("/{wsParam}") + ws1.Route(ws1.GET(testCase.routePath).To(dummy)) + router := RouterJSR311{} + req, _ := http.NewRequest(http.MethodGet, "/wsValue"+testCase.urlPath, nil) + params := router.ExtractParameters(&ws1.Routes()[0], ws1, req.URL.Path) + expectedParams := map[string]string{"wsParam": "wsValue"} + for key, value := range testCase.expectedParams { + expectedParams[key] = value + } + if len(params) != len(expectedParams) { + t.Fatalf("Wrong length of params on selected route, expected: %v, got: %v", testCase.expectedParams, params) + } + for expectedParamKey, expectedParamValue := range testCase.expectedParams { + if expectedParamValue != params[expectedParamKey] { + t.Errorf("Wrong parameter for key '%v', expected: %v, got: %v", expectedParamKey, expectedParamValue, params[expectedParamKey]) + } + } + }) + } +} + func dummy(req *Request, resp *Response) { io.WriteString(resp.ResponseWriter, "dummy") } diff --git a/vendor/github.com/emicklei/go-restful/path_expression.go b/vendor/github.com/emicklei/go-restful/path_expression.go index a921e6f22..95a9a2545 100644 --- a/vendor/github.com/emicklei/go-restful/path_expression.go +++ b/vendor/github.com/emicklei/go-restful/path_expression.go @@ -14,8 +14,9 @@ import ( // PathExpression holds a compiled path expression (RegExp) needed to match against // Http request paths and to extract path parameter values. type pathExpression struct { - LiteralCount int // the number of literal characters (means those not resulting from template variable substitution) - VarCount int // the number of named parameters (enclosed by {}) in the path + LiteralCount int // the number of literal characters (means those not resulting from template variable substitution) + VarNames []string // the names of parameters (enclosed by {}) in the path + VarCount int // the number of named parameters (enclosed by {}) in the path Matcher *regexp.Regexp Source string // Path as defined by the RouteBuilder tokens []string @@ -24,16 +25,16 @@ type pathExpression struct { // NewPathExpression creates a PathExpression from the input URL path. // Returns an error if the path is invalid. func newPathExpression(path string) (*pathExpression, error) { - expression, literalCount, varCount, tokens := templateToRegularExpression(path) + expression, literalCount, varNames, varCount, tokens := templateToRegularExpression(path) compiled, err := regexp.Compile(expression) if err != nil { return nil, err } - return &pathExpression{literalCount, varCount, compiled, expression, tokens}, nil + return &pathExpression{literalCount, varNames, varCount, compiled, expression, tokens}, nil } // http://jsr311.java.net/nonav/releases/1.1/spec/spec3.html#x3-370003.7.3 -func templateToRegularExpression(template string) (expression string, literalCount int, varCount int, tokens []string) { +func templateToRegularExpression(template string) (expression string, literalCount int, varNames []string, varCount int, tokens []string) { var buffer bytes.Buffer buffer.WriteString("^") //tokens = strings.Split(template, "/") @@ -46,8 +47,10 @@ func templateToRegularExpression(template string) (expression string, literalCou if strings.HasPrefix(each, "{") { // check for regular expression in variable colon := strings.Index(each, ":") + var varName string if colon != -1 { // extract expression + varName = strings.TrimSpace(each[1:colon]) paramExpr := strings.TrimSpace(each[colon+1 : len(each)-1]) if paramExpr == "*" { // special case buffer.WriteString("(.*)") @@ -56,8 +59,10 @@ func templateToRegularExpression(template string) (expression string, literalCou } } else { // plain var + varName = strings.TrimSpace(each[1 : len(each)-1]) buffer.WriteString("([^/]+?)") } + varNames = append(varNames, varName) varCount += 1 } else { literalCount += len(each) @@ -65,5 +70,5 @@ func templateToRegularExpression(template string) (expression string, literalCou buffer.WriteString(regexp.QuoteMeta(encoded)) } } - return strings.TrimRight(buffer.String(), "/") + "(/.*)?$", literalCount, varCount, tokens + return strings.TrimRight(buffer.String(), "/") + "(/.*)?$", literalCount, varNames, varCount, tokens } diff --git a/vendor/github.com/emicklei/go-restful/path_expression_test.go b/vendor/github.com/emicklei/go-restful/path_expression_test.go index 334fcef73..073f1989e 100644 --- a/vendor/github.com/emicklei/go-restful/path_expression_test.go +++ b/vendor/github.com/emicklei/go-restful/path_expression_test.go @@ -1,23 +1,27 @@ package restful -import "testing" +import ( + "reflect" + "testing" +) var tempregexs = []struct { template, regex string + names []string literalCount, varCount int }{ - {"", "^(/.*)?$", 0, 0}, - {"/a/{b}/c/", "^/a/([^/]+?)/c(/.*)?$", 2, 1}, - {"/{a}/{b}/{c-d-e}/", "^/([^/]+?)/([^/]+?)/([^/]+?)(/.*)?$", 0, 3}, - {"/{p}/abcde", "^/([^/]+?)/abcde(/.*)?$", 5, 1}, - {"/a/{b:*}", "^/a/(.*)(/.*)?$", 1, 1}, - {"/a/{b:[a-z]+}", "^/a/([a-z]+)(/.*)?$", 1, 1}, + {"", "^(/.*)?$", nil, 0, 0}, + {"/a/{b}/c/", "^/a/([^/]+?)/c(/.*)?$", []string{"b"}, 2, 1}, + {"/{a}/{b}/{c-d-e}/", "^/([^/]+?)/([^/]+?)/([^/]+?)(/.*)?$", []string{"a", "b", "c-d-e"}, 0, 3}, + {"/{p}/abcde", "^/([^/]+?)/abcde(/.*)?$", []string{"p"}, 5, 1}, + {"/a/{b:*}", "^/a/(.*)(/.*)?$", []string{"b"}, 1, 1}, + {"/a/{b:[a-z]+}", "^/a/([a-z]+)(/.*)?$", []string{"b"}, 1, 1}, } func TestTemplateToRegularExpression(t *testing.T) { ok := true for i, fixture := range tempregexs { - actual, lCount, vCount, _ := templateToRegularExpression(fixture.template) + actual, lCount, varNames, vCount, _ := templateToRegularExpression(fixture.template) if actual != fixture.regex { t.Logf("regex mismatch, expected:%v , actual:%v, line:%v\n", fixture.regex, actual, i) // 11 = where the data starts ok = false @@ -30,6 +34,10 @@ func TestTemplateToRegularExpression(t *testing.T) { t.Logf("variable count mismatch, expected:%v , actual:%v, line:%v\n", fixture.varCount, vCount, i) ok = false } + if !reflect.DeepEqual(fixture.names, varNames) { + t.Logf("variable name mismatch, expected:%v , actual:%v, line:%v\n", fixture.names, varNames, i) + ok = false + } } if !ok { t.Fatal("one or more expression did not match") diff --git a/vendor/github.com/emicklei/go-restful/path_processor.go b/vendor/github.com/emicklei/go-restful/path_processor.go new file mode 100644 index 000000000..357c723a7 --- /dev/null +++ b/vendor/github.com/emicklei/go-restful/path_processor.go @@ -0,0 +1,63 @@ +package restful + +import ( + "bytes" + "strings" +) + +// Copyright 2018 Ernest Micklei. All rights reserved. +// Use of this source code is governed by a license +// that can be found in the LICENSE file. + +// PathProcessor is extra behaviour that a Router can provide to extract path parameters from the path. +// If a Router does not implement this interface then the default behaviour will be used. +type PathProcessor interface { + // ExtractParameters gets the path parameters defined in the route and webService from the urlPath + ExtractParameters(route *Route, webService *WebService, urlPath string) map[string]string +} + +type defaultPathProcessor struct{} + +// Extract the parameters from the request url path +func (d defaultPathProcessor) ExtractParameters(r *Route, _ *WebService, urlPath string) map[string]string { + urlParts := tokenizePath(urlPath) + pathParameters := map[string]string{} + for i, key := range r.pathParts { + var value string + if i >= len(urlParts) { + value = "" + } else { + value = urlParts[i] + } + if strings.HasPrefix(key, "{") { // path-parameter + if colon := strings.Index(key, ":"); colon != -1 { + // extract by regex + regPart := key[colon+1 : len(key)-1] + keyPart := key[1:colon] + if regPart == "*" { + pathParameters[keyPart] = untokenizePath(i, urlParts) + break + } else { + pathParameters[keyPart] = value + } + } else { + // without enclosing {} + pathParameters[key[1:len(key)-1]] = value + } + } + } + return pathParameters +} + +// Untokenize back into an URL path using the slash separator +func untokenizePath(offset int, parts []string) string { + var buffer bytes.Buffer + for p := offset; p < len(parts); p++ { + buffer.WriteString(parts[p]) + // do not end + if p < len(parts)-1 { + buffer.WriteString("/") + } + } + return buffer.String() +} diff --git a/vendor/github.com/emicklei/go-restful/path_processor_test.go b/vendor/github.com/emicklei/go-restful/path_processor_test.go new file mode 100644 index 000000000..fd1b07dd7 --- /dev/null +++ b/vendor/github.com/emicklei/go-restful/path_processor_test.go @@ -0,0 +1,55 @@ +package restful + +import "testing" + +func TestMatchesPath_OneParam(t *testing.T) { + params := doExtractParams("/from/{source}", 2, "/from/here", t) + if params["source"] != "here" { + t.Errorf("parameter mismatch here") + } +} + +func TestMatchesPath_Slash(t *testing.T) { + params := doExtractParams("/", 0, "/", t) + if len(params) != 0 { + t.Errorf("expected empty parameters") + } +} + +func TestMatchesPath_SlashNonVar(t *testing.T) { + params := doExtractParams("/any", 1, "/any", t) + if len(params) != 0 { + t.Errorf("expected empty parameters") + } +} + +func TestMatchesPath_TwoVars(t *testing.T) { + params := doExtractParams("/from/{source}/to/{destination}", 4, "/from/AMS/to/NY", t) + if params["source"] != "AMS" { + t.Errorf("parameter mismatch AMS") + } +} + +func TestMatchesPath_VarOnFront(t *testing.T) { + params := doExtractParams("{what}/from/{source}/", 3, "who/from/SOS/", t) + if params["source"] != "SOS" { + t.Errorf("parameter mismatch SOS") + } +} + +func TestExtractParameters_EmptyValue(t *testing.T) { + params := doExtractParams("/fixed/{var}", 2, "/fixed/", t) + if params["var"] != "" { + t.Errorf("parameter mismatch var") + } +} + +func doExtractParams(routePath string, size int, urlPath string, t *testing.T) map[string]string { + r := Route{Path: routePath} + r.postBuild() + if len(r.pathParts) != size { + t.Fatalf("len not %v %v, but %v", size, r.pathParts, len(r.pathParts)) + } + pathProcessor := defaultPathProcessor{} + return pathProcessor.ExtractParameters(&r, nil, urlPath) +} diff --git a/vendor/github.com/emicklei/go-restful/route.go b/vendor/github.com/emicklei/go-restful/route.go index b9e346a5e..f72bf9850 100644 --- a/vendor/github.com/emicklei/go-restful/route.go +++ b/vendor/github.com/emicklei/go-restful/route.go @@ -5,7 +5,6 @@ package restful // that can be found in the LICENSE file. import ( - "bytes" "net/http" "strings" ) @@ -54,10 +53,9 @@ func (r *Route) postBuild() { } // Create Request and Response from their http versions -func (r *Route) wrapRequestResponse(httpWriter http.ResponseWriter, httpRequest *http.Request) (*Request, *Response) { - params := r.extractParameters(httpRequest.URL.Path) +func (r *Route) wrapRequestResponse(httpWriter http.ResponseWriter, httpRequest *http.Request, pathParams map[string]string) (*Request, *Response) { wrappedRequest := NewRequest(httpRequest) - wrappedRequest.pathParameters = params + wrappedRequest.pathParameters = pathParams wrappedRequest.selectedRoutePath = r.Path wrappedResponse := NewResponse(httpWriter) wrappedResponse.requestAccept = httpRequest.Header.Get(HEADER_Accept) @@ -137,50 +135,6 @@ func (r Route) matchesContentType(mimeTypes string) bool { return false } -// Extract the parameters from the request url path -func (r Route) extractParameters(urlPath string) map[string]string { - urlParts := tokenizePath(urlPath) - pathParameters := map[string]string{} - for i, key := range r.pathParts { - var value string - if i >= len(urlParts) { - value = "" - } else { - value = urlParts[i] - } - if strings.HasPrefix(key, "{") { // path-parameter - if colon := strings.Index(key, ":"); colon != -1 { - // extract by regex - regPart := key[colon+1 : len(key)-1] - keyPart := key[1:colon] - if regPart == "*" { - pathParameters[keyPart] = untokenizePath(i, urlParts) - break - } else { - pathParameters[keyPart] = value - } - } else { - // without enclosing {} - pathParameters[key[1:len(key)-1]] = value - } - } - } - return pathParameters -} - -// Untokenize back into an URL path using the slash separator -func untokenizePath(offset int, parts []string) string { - var buffer bytes.Buffer - for p := offset; p < len(parts); p++ { - buffer.WriteString(parts[p]) - // do not end - if p < len(parts)-1 { - buffer.WriteString("/") - } - } - return buffer.String() -} - // Tokenize an URL path using the slash separator ; the result does not have empty tokens func tokenizePath(path string) []string { if "/" == path { diff --git a/vendor/github.com/emicklei/go-restful/route_test.go b/vendor/github.com/emicklei/go-restful/route_test.go index 6a104aff8..a687d8a4d 100644 --- a/vendor/github.com/emicklei/go-restful/route_test.go +++ b/vendor/github.com/emicklei/go-restful/route_test.go @@ -69,59 +69,8 @@ func TestMatchesContentTypeCharsetInformation(t *testing.T) { } } -func TestMatchesPath_OneParam(t *testing.T) { - params := doExtractParams("/from/{source}", 2, "/from/here", t) - if params["source"] != "here" { - t.Errorf("parameter mismatch here") - } -} - -func TestMatchesPath_Slash(t *testing.T) { - params := doExtractParams("/", 0, "/", t) - if len(params) != 0 { - t.Errorf("expected empty parameters") - } -} - -func TestMatchesPath_SlashNonVar(t *testing.T) { - params := doExtractParams("/any", 1, "/any", t) - if len(params) != 0 { - t.Errorf("expected empty parameters") - } -} - -func TestMatchesPath_TwoVars(t *testing.T) { - params := doExtractParams("/from/{source}/to/{destination}", 4, "/from/AMS/to/NY", t) - if params["source"] != "AMS" { - t.Errorf("parameter mismatch AMS") - } -} - -func TestMatchesPath_VarOnFront(t *testing.T) { - params := doExtractParams("{what}/from/{source}/", 3, "who/from/SOS/", t) - if params["source"] != "SOS" { - t.Errorf("parameter mismatch SOS") - } -} - -func TestExtractParameters_EmptyValue(t *testing.T) { - params := doExtractParams("/fixed/{var}", 2, "/fixed/", t) - if params["var"] != "" { - t.Errorf("parameter mismatch var") - } -} - func TestTokenizePath(t *testing.T) { if len(tokenizePath("/")) != 0 { t.Errorf("not empty path tokens") } } - -func doExtractParams(routePath string, size int, urlPath string, t *testing.T) map[string]string { - r := Route{Path: routePath} - r.postBuild() - if len(r.pathParts) != size { - t.Fatalf("len not %v %v, but %v", size, r.pathParts, len(r.pathParts)) - } - return r.extractParameters(urlPath) -} diff --git a/vendor/github.com/emicklei/go-restful/router.go b/vendor/github.com/emicklei/go-restful/router.go index 9b32fb675..19078af1c 100644 --- a/vendor/github.com/emicklei/go-restful/router.go +++ b/vendor/github.com/emicklei/go-restful/router.go @@ -7,6 +7,8 @@ package restful import "net/http" // A RouteSelector finds the best matching Route given the input HTTP Request +// RouteSelectors can optionally also implement the PathProcessor interface to also calculate the +// path parameters after the route has been selected. type RouteSelector interface { // SelectRoute finds a Route given the input HTTP Request and a list of WebServices. diff --git a/vendor/github.com/farsightsec/golang-framestream/Encoder.go b/vendor/github.com/farsightsec/golang-framestream/Encoder.go index 83c01bb01..1ef00213b 100644 --- a/vendor/github.com/farsightsec/golang-framestream/Encoder.go +++ b/vendor/github.com/farsightsec/golang-framestream/Encoder.go @@ -68,7 +68,7 @@ func NewEncoder(w io.Writer, opt *EncoderOptions) (enc *Encoder, err error) { // Write the start control frame. start := ControlStart start.SetContentType(opt.ContentType) - err = start.Encode(enc.writer) + err = start.EncodeFlush(enc.writer) if err != nil { return } diff --git a/vendor/github.com/farsightsec/golang-framestream/framestream_test.go b/vendor/github.com/farsightsec/golang-framestream/framestream_test.go index 3ba5d4be6..28e8bd82c 100644 --- a/vendor/github.com/farsightsec/golang-framestream/framestream_test.go +++ b/vendor/github.com/farsightsec/golang-framestream/framestream_test.go @@ -3,7 +3,9 @@ package framestream_test import ( "bytes" "net" + "sync" "testing" + "time" framestream "github.com/farsightsec/golang-framestream" ) @@ -132,3 +134,52 @@ func TestOversizeFrame(t *testing.T) { t.Error("data frame too large, received %v", err) } } + +func testNew(t *testing.T, bidirectional bool) { + client, server := net.Pipe() + wg := &sync.WaitGroup{} + wg.Add(2) + done := make(chan bool) + + go func() { + _, err := framestream.NewDecoder(server, + &framestream.DecoderOptions{ + Bidirectional: bidirectional, + }) + + if err != nil { + t.Fatal(err) + } + wg.Done() + }() + + go func() { + _, err := framestream.NewEncoder(client, + &framestream.EncoderOptions{ + Bidirectional: bidirectional, + }) + if err != nil { + t.Fatal(err) + } + wg.Done() + }() + + go func() { + wg.Wait() + close(done) + }() + + select { + case <-done: + case <-time.After(1 * time.Second): + t.Fatal("Time's up.") + } +} + +func TestNewBidirectional(t *testing.T) { + testNew(t, true) +} + +func TestNewUnidirectional(t *testing.T) { + testNew(t, false) +} diff --git a/vendor/github.com/go-openapi/spec/expander.go b/vendor/github.com/go-openapi/spec/expander.go index 59a227059..5054a7be6 100644 --- a/vendor/github.com/go-openapi/spec/expander.go +++ b/vendor/github.com/go-openapi/spec/expander.go @@ -16,9 +16,7 @@ package spec import ( "encoding/json" - "errors" "fmt" - "io/ioutil" "log" "net/url" "os" @@ -320,6 +318,17 @@ func debugLog(msg string, args ...interface{}) { } } +// normalize absolute path for cache. +// on Windows, drive letters should be converted to lower as scheme in net/url.URL +func normalizeAbsPath(path string) string { + u, err := url.Parse(path) + if err != nil { + debugLog("normalize absolute path failed: %s", err) + return path + } + return u.String() +} + // base or refPath could be a file path or a URL // given a base absolute path and a ref path, return the absolute path of refPath // 1) if refPath is absolute, return it @@ -379,32 +388,29 @@ func (r *schemaLoader) resolveRef(ref *Ref, target interface{}, basePath string) return nil } - // if no basePath is provided, we attempt to resolve the reference against root - if basePath == "" { - var b []byte - switch rr := r.root.(type) { - case *Schema: - b, _ = rr.MarshalJSON() - case *Swagger: - b, _ = rr.MarshalJSON() + var res interface{} + var data interface{} + var err error + // Resolve against the root if it isn't nil, and if ref is pointing at the root, or has a fragment only which means + // it is pointing somewhere in the root. + root := r.root + if (ref.IsRoot() || ref.HasFragmentOnly) && root == nil && basePath != "" { + if baseRef, err := NewRef(basePath); err == nil { + root, _, _, _ = r.load(baseRef.GetURL()) } - f, err := ioutil.TempFile(os.TempDir(), "tmproot") + } + if (ref.IsRoot() || ref.HasFragmentOnly) && root != nil { + data = root + } else { + baseRef := normalizeFileRef(ref, basePath) + debugLog("current ref is: %s", ref.String()) + debugLog("current ref normalized file: %s", baseRef.String()) + data, _, _, err = r.load(baseRef.GetURL()) if err != nil { return err } - f.Write(b) - f.Close() - basePath = f.Name() } - baseRef := normalizeFileRef(ref, basePath) - debugLog("current ref normalized file: %s", baseRef.String()) - data, _, _, err := r.load(baseRef.GetURL()) - if err != nil { - return err - } - - var res interface{} res = data if ref.String() != "" { res, _, err = ref.GetPointer().Get(data) @@ -415,6 +421,7 @@ func (r *schemaLoader) resolveRef(ref *Ref, target interface{}, basePath string) if err := swag.DynamicJSONToStruct(res, target); err != nil { return err } + return nil } @@ -449,6 +456,9 @@ func (r *schemaLoader) Resolve(ref *Ref, target interface{}, basePath string) er // absPath returns the absolute path of a file func absPath(fname string) (string, error) { + if strings.HasPrefix(fname, "http") { + return fname, nil + } if filepath.IsAbs(fname) { return fname, nil } @@ -471,11 +481,10 @@ func ExpandSpec(spec *Swagger, options *ExpandOptions) error { } if options == nil || !options.SkipSchemas { - rt := fmt.Sprintf("%s#/definitions/", specBasePath) for key, definition := range spec.Definitions { var def *Schema var err error - if def, err = expandSchema(definition, []string{rt + key}, resolver, specBasePath); shouldStopOnError(err, resolver.options) { + if def, err = expandSchema(definition, []string{fmt.Sprintf("#/defintions/%s", key)}, resolver, specBasePath); shouldStopOnError(err, resolver.options) { return err } if def != nil { @@ -526,29 +535,19 @@ func shouldStopOnError(err error, opts *ExpandOptions) bool { // go-openapi/validate uses this function // notice that it is impossible to reference a json scema in a different file other than root func ExpandSchema(schema *Schema, root interface{}, cache ResolutionCache) error { - // if root is passed as nil, assume root is the same as schema - if root == nil { - root = schema + // Only save the root to a tmp file if it isn't nil. + var base string + if root != nil { + base, _ = absPath("root") + if cache == nil { + cache = resCache + } + cache.Set(normalizeAbsPath(base), root) + base = "root" } - file, err := ioutil.TempFile(os.TempDir(), "root") - if err != nil { - return err - } - defer os.Remove(file.Name()) - - switch r := root.(type) { - case *Schema: - b, _ := r.MarshalJSON() - file.Write(b) - case *Swagger: - b, _ := r.MarshalJSON() - file.Write(b) - } - file.Close() - opts := &ExpandOptions{ - RelativeBase: file.Name(), + RelativeBase: base, SkipSchemas: false, ContinueOnError: false, } @@ -561,14 +560,10 @@ func ExpandSchemaWithBasePath(schema *Schema, cache ResolutionCache, opts *Expan return nil } - if opts == nil { - return errors.New("cannot expand schema without a base path") + var basePath string + if opts.RelativeBase != "" { + basePath, _ = absPath(opts.RelativeBase) } - if opts.RelativeBase == "" { - return errors.New("cannot expand schema with empty base path") - } - - basePath, _ := absPath(opts.RelativeBase) resolver, err := defaultSchemaLoader(nil, opts, cache) if err != nil { @@ -622,6 +617,10 @@ func basePathFromSchemaID(oldBasePath, id string) string { return u.String() } +func isCircular(ref *Ref, basePath string, parentRefs ...string) bool { + return basePath != "" && swag.ContainsStringsCI(parentRefs, ref.String()) +} + func expandSchema(target Schema, parentRefs []string, resolver *schemaLoader, basePath string) (*Schema, error) { if target.Ref.String() == "" && target.Ref.IsRoot() { // normalizing is important @@ -657,14 +656,16 @@ func expandSchema(target Schema, parentRefs []string, resolver *schemaLoader, ba /* this means there is a circle in the recursion tree */ /* return the Ref */ - if basePath != "" && swag.ContainsStringsCI(parentRefs, normalizedRef.String()) { + if isCircular(normalizedRef, basePath, parentRefs...) { target.Ref = *normalizedRef return &target, nil } debugLog("\nbasePath: %s", basePath) - b, _ := json.Marshal(target) - debugLog("calling Resolve with target: %s", string(b)) + if Debug { + b, _ := json.Marshal(target) + debugLog("calling Resolve with target: %s", string(b)) + } if err := resolver.Resolve(&target.Ref, &t, basePath); shouldStopOnError(err, resolver.options) { return nil, err } @@ -774,17 +775,41 @@ func expandSchema(target Schema, parentRefs []string, resolver *schemaLoader, ba return &target, nil } +func derefPathItem(pathItem *PathItem, parentRefs []string, resolver *schemaLoader, basePath string) error { + curRef := pathItem.Ref.String() + if curRef != "" { + normalizedRef := normalizeFileRef(&pathItem.Ref, basePath) + normalizedBasePath := normalizedRef.RemoteURI() + + if isCircular(normalizedRef, basePath, parentRefs...) { + return nil + } + + if err := resolver.Resolve(&pathItem.Ref, pathItem, basePath); shouldStopOnError(err, resolver.options) { + return err + } + + if pathItem.Ref.String() != "" && pathItem.Ref.String() != curRef && basePath != normalizedBasePath { + parentRefs = append(parentRefs, normalizedRef.String()) + return derefPathItem(pathItem, parentRefs, resolver, normalizedBasePath) + } + } + + return nil +} + func expandPathItem(pathItem *PathItem, resolver *schemaLoader, basePath string) error { if pathItem == nil { return nil } - if pathItem.Ref.String() != "" { - if err := resolver.Resolve(&pathItem.Ref, &pathItem, basePath); err != nil { - return err - } - pathItem.Ref = Ref{} + parentRefs := []string{} + if err := derefPathItem(pathItem, parentRefs, resolver, basePath); shouldStopOnError(err, resolver.options) { + return err } + pathItem.Ref = Ref{} + + parentRefs = parentRefs[0:] for idx := range pathItem.Parameters { if err := expandParameter(&(pathItem.Parameters[idx]), resolver, basePath); shouldStopOnError(err, resolver.options) { @@ -842,36 +867,104 @@ func expandOperation(op *Operation, resolver *schemaLoader, basePath string) err return nil } +// ExpandResponse expands a response based on a basepath +// This is the exported version of expandResponse +// all refs inside response will be resolved relative to basePath +func ExpandResponse(response *Response, basePath string) error { + opts := &ExpandOptions{ + RelativeBase: basePath, + } + resolver, err := defaultSchemaLoader(nil, opts, nil) + if err != nil { + return err + } + + return expandResponse(response, resolver, basePath) +} + +func derefResponse(response *Response, parentRefs []string, resolver *schemaLoader, basePath string) error { + curRef := response.Ref.String() + if curRef != "" { + /* Here the resolution scope is changed because a $ref was encountered */ + normalizedRef := normalizeFileRef(&response.Ref, basePath) + normalizedBasePath := normalizedRef.RemoteURI() + + if isCircular(normalizedRef, basePath, parentRefs...) { + return nil + } + + if err := resolver.Resolve(&response.Ref, response, basePath); shouldStopOnError(err, resolver.options) { + return err + } + + if response.Ref.String() != "" && response.Ref.String() != curRef && basePath != normalizedBasePath { + parentRefs = append(parentRefs, normalizedRef.String()) + return derefResponse(response, parentRefs, resolver, normalizedBasePath) + } + } + + return nil +} + func expandResponse(response *Response, resolver *schemaLoader, basePath string) error { if response == nil { return nil } - var parentRefs []string - - if response.Ref.String() != "" { - parentRefs = append(parentRefs, response.Ref.String()) - sch := new(Schema) - b, _ := response.MarshalJSON() - json.Unmarshal(b, sch) - s, _ := expandSchema(*sch, parentRefs, resolver, basePath) - // if err := resolver.Resolve(&response.Ref, response, basePath); shouldStopOnError(err, resolver.options) { - // return err - // } - b, _ = s.MarshalJSON() - json.Unmarshal(b, response) - response.Ref = Ref{} + parentRefs := []string{} + if err := derefResponse(response, parentRefs, resolver, basePath); shouldStopOnError(err, resolver.options) { + return err } + response.Ref = Ref{} + parentRefs = parentRefs[0:] if !resolver.options.SkipSchemas && response.Schema != nil { parentRefs = append(parentRefs, response.Schema.Ref.String()) - debugLog("response ref: %s", response.Schema.Ref) s, err := expandSchema(*response.Schema, parentRefs, resolver, basePath) if shouldStopOnError(err, resolver.options) { return err } *response.Schema = *s } + + return nil +} + +// ExpandParameter expands a parameter based on a basepath +// This is the exported version of expandParameter +// all refs inside parameter will be resolved relative to basePath +func ExpandParameter(parameter *Parameter, basePath string) error { + opts := &ExpandOptions{ + RelativeBase: basePath, + } + resolver, err := defaultSchemaLoader(nil, opts, nil) + if err != nil { + return err + } + + return expandParameter(parameter, resolver, basePath) +} + +func derefParameter(parameter *Parameter, parentRefs []string, resolver *schemaLoader, basePath string) error { + curRef := parameter.Ref.String() + if curRef != "" { + normalizedRef := normalizeFileRef(¶meter.Ref, basePath) + normalizedBasePath := normalizedRef.RemoteURI() + + if isCircular(normalizedRef, basePath, parentRefs...) { + return nil + } + + if err := resolver.Resolve(¶meter.Ref, parameter, basePath); shouldStopOnError(err, resolver.options) { + return err + } + + if parameter.Ref.String() != "" && parameter.Ref.String() != curRef && basePath != normalizedBasePath { + parentRefs = append(parentRefs, normalizedRef.String()) + return derefParameter(parameter, parentRefs, resolver, normalizedBasePath) + } + } + return nil } @@ -880,15 +973,13 @@ func expandParameter(parameter *Parameter, resolver *schemaLoader, basePath stri return nil } - var parentRefs []string - - if parameter.Ref.String() != "" { - parentRefs = append(parentRefs, parameter.Ref.String()) - if err := resolver.Resolve(¶meter.Ref, parameter, basePath); shouldStopOnError(err, resolver.options) { - return err - } - parameter.Ref = Ref{} + parentRefs := []string{} + if err := derefParameter(parameter, parentRefs, resolver, basePath); shouldStopOnError(err, resolver.options) { + return err } + parameter.Ref = Ref{} + + parentRefs = parentRefs[0:] if !resolver.options.SkipSchemas && parameter.Schema != nil { parentRefs = append(parentRefs, parameter.Schema.Ref.String()) s, err := expandSchema(*parameter.Schema, parentRefs, resolver, basePath) diff --git a/vendor/github.com/go-openapi/spec/expander_test.go b/vendor/github.com/go-openapi/spec/expander_test.go index 0c83d796a..b648a0cf0 100644 --- a/vendor/github.com/go-openapi/spec/expander_test.go +++ b/vendor/github.com/go-openapi/spec/expander_test.go @@ -206,6 +206,47 @@ func TestResponseExpansion(t *testing.T) { // assert.Equal(t, expected, resp) } +// test the exported version of ExpandResponse +func TestExportedResponseExpansion(t *testing.T) { + specDoc, err := jsonDoc("fixtures/expansion/all-the-things.json") + assert.NoError(t, err) + + basePath, err := absPath("fixtures/expansion/all-the-things.json") + assert.NoError(t, err) + + spec := new(Swagger) + err = json.Unmarshal(specDoc, spec) + assert.NoError(t, err) + + resp := spec.Responses["anotherPet"] + r := spec.Responses["petResponse"] + err = ExpandResponse(&r, basePath) + assert.NoError(t, err) + expected := r + + err = ExpandResponse(&resp, basePath) + b, _ := resp.MarshalJSON() + log.Printf(string(b)) + b, _ = expected.MarshalJSON() + log.Printf(string(b)) + assert.NoError(t, err) + assert.Equal(t, expected, resp) + + resp2 := spec.Paths.Paths["/"].Get.Responses.Default + expected = spec.Responses["stringResponse"] + + err = ExpandResponse(resp2, basePath) + assert.NoError(t, err) + assert.Equal(t, expected, *resp2) + + resp = spec.Paths.Paths["/"].Get.Responses.StatusCodeResponses[200] + expected = spec.Responses["petResponse"] + + err = ExpandResponse(&resp, basePath) + assert.NoError(t, err) + // assert.Equal(t, expected, resp) +} + func TestIssue3(t *testing.T) { spec := new(Swagger) specDoc, err := jsonDoc("fixtures/expansion/overflow.json") @@ -254,6 +295,32 @@ func TestParameterExpansion(t *testing.T) { assert.Equal(t, expected, param) } +func TestExportedParameterExpansion(t *testing.T) { + paramDoc, err := jsonDoc("fixtures/expansion/params.json") + assert.NoError(t, err) + + spec := new(Swagger) + err = json.Unmarshal(paramDoc, spec) + assert.NoError(t, err) + + basePath, err := absPath("fixtures/expansion/params.json") + assert.NoError(t, err) + + param := spec.Parameters["query"] + expected := spec.Parameters["tag"] + + err = ExpandParameter(¶m, basePath) + assert.NoError(t, err) + assert.Equal(t, expected, param) + + param = spec.Paths.Paths["/cars/{id}"].Parameters[0] + expected = spec.Parameters["id"] + + err = ExpandParameter(¶m, basePath) + assert.NoError(t, err) + assert.Equal(t, expected, param) +} + func TestCircularRefsExpansion(t *testing.T) { carsDoc, err := jsonDoc("fixtures/expansion/circularRefs.json") assert.NoError(t, err) @@ -626,6 +693,71 @@ func TestDefaultResolutionCache(t *testing.T) { assert.Equal(t, "here", sch) } +func TestRelativeBaseURI(t *testing.T) { + server := httptest.NewServer(http.FileServer(http.Dir("fixtures/remote"))) + defer server.Close() + + spec := new(Swagger) + // resolver, err := defaultSchemaLoader(spec, nil, nil) + // assert.NoError(t, err) + + err := ExpandSpec(spec, nil) + assert.NoError(t, err) + + specDoc, err := jsonDoc("fixtures/remote/all-the-things.json") + assert.NoError(t, err) + + opts := &ExpandOptions{ + RelativeBase: server.URL + "/all-the-things.json", + } + + spec = new(Swagger) + err = json.Unmarshal(specDoc, spec) + assert.NoError(t, err) + + pet := spec.Definitions["pet"] + errorModel := spec.Definitions["errorModel"] + petResponse := spec.Responses["petResponse"] + petResponse.Schema = &pet + stringResponse := spec.Responses["stringResponse"] + tagParam := spec.Parameters["tag"] + idParam := spec.Parameters["idParam"] + + anotherPet := spec.Responses["anotherPet"] + anotherPet.Ref = MustCreateRef(server.URL + "/" + anotherPet.Ref.String()) + err = ExpandResponse(&anotherPet, opts.RelativeBase) + assert.NoError(t, err) + spec.Responses["anotherPet"] = anotherPet + + circularA := spec.Responses["circularA"] + circularA.Ref = MustCreateRef(server.URL + "/" + circularA.Ref.String()) + err = ExpandResponse(&circularA, opts.RelativeBase) + assert.NoError(t, err) + spec.Responses["circularA"] = circularA + + err = ExpandSpec(spec, opts) + assert.NoError(t, err) + + assert.Equal(t, tagParam, spec.Parameters["query"]) + assert.Equal(t, petResponse, spec.Responses["petResponse"]) + assert.Equal(t, petResponse, spec.Responses["anotherPet"]) + assert.Equal(t, pet, *spec.Responses["petResponse"].Schema) + assert.Equal(t, stringResponse, *spec.Paths.Paths["/"].Get.Responses.Default) + assert.Equal(t, petResponse, spec.Paths.Paths["/"].Get.Responses.StatusCodeResponses[200]) + assert.Equal(t, pet, *spec.Paths.Paths["/pets"].Get.Responses.StatusCodeResponses[200].Schema.Items.Schema) + assert.Equal(t, errorModel, *spec.Paths.Paths["/pets"].Get.Responses.Default.Schema) + assert.Equal(t, pet, spec.Definitions["petInput"].AllOf[0]) + assert.Equal(t, spec.Definitions["petInput"], *spec.Paths.Paths["/pets"].Post.Parameters[0].Schema) + assert.Equal(t, petResponse, spec.Paths.Paths["/pets"].Post.Responses.StatusCodeResponses[200]) + assert.Equal(t, errorModel, *spec.Paths.Paths["/pets"].Post.Responses.Default.Schema) + pi := spec.Paths.Paths["/pets/{id}"] + assert.Equal(t, idParam, pi.Get.Parameters[0]) + assert.Equal(t, petResponse, pi.Get.Responses.StatusCodeResponses[200]) + assert.Equal(t, errorModel, *pi.Get.Responses.Default.Schema) + assert.Equal(t, idParam, pi.Delete.Parameters[0]) + assert.Equal(t, errorModel, *pi.Delete.Responses.Default.Schema) +} + func resolutionContextServer() *httptest.Server { var servedAt string server := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { diff --git a/vendor/github.com/go-openapi/spec/ref.go b/vendor/github.com/go-openapi/spec/ref.go index 4833b87e2..1405bfd8e 100644 --- a/vendor/github.com/go-openapi/spec/ref.go +++ b/vendor/github.com/go-openapi/spec/ref.go @@ -145,7 +145,10 @@ func (r *Ref) UnmarshalJSON(d []byte) error { if err := json.Unmarshal(d, &v); err != nil { return err } + return r.fromMap(v) +} +func (r *Ref) fromMap(v map[string]interface{}) error { if v == nil { return nil } diff --git a/vendor/github.com/go-openapi/spec/schema.go b/vendor/github.com/go-openapi/spec/schema.go index 1cdcc163f..05c1a4aa0 100644 --- a/vendor/github.com/go-openapi/spec/schema.go +++ b/vendor/github.com/go-openapi/spec/schema.go @@ -135,6 +135,10 @@ func (r *SchemaURL) UnmarshalJSON(data []byte) error { if err := json.Unmarshal(data, &v); err != nil { return err } + return r.fromMap(v) +} + +func (r *SchemaURL) fromMap(v map[string]interface{}) error { if v == nil { return nil } @@ -582,18 +586,17 @@ func (s Schema) MarshalJSON() ([]byte, error) { // UnmarshalJSON marshal this from JSON func (s *Schema) UnmarshalJSON(data []byte) error { - var sch Schema - if err := json.Unmarshal(data, &sch.SchemaProps); err != nil { + props := struct { + SchemaProps + SwaggerSchemaProps + }{} + if err := json.Unmarshal(data, &props); err != nil { return err } - if err := json.Unmarshal(data, &sch.Ref); err != nil { - return err - } - if err := json.Unmarshal(data, &sch.Schema); err != nil { - return err - } - if err := json.Unmarshal(data, &sch.SwaggerSchemaProps); err != nil { - return err + + sch := Schema{ + SchemaProps: props.SchemaProps, + SwaggerSchemaProps: props.SwaggerSchemaProps, } var d map[string]interface{} @@ -601,6 +604,9 @@ func (s *Schema) UnmarshalJSON(data []byte) error { return err } + sch.Ref.fromMap(d) + sch.Schema.fromMap(d) + delete(d, "$ref") delete(d, "$schema") for _, pn := range swag.DefaultJSONNameProvider.GetJSONNames(s) { diff --git a/vendor/github.com/go-openapi/spec/schema_test.go b/vendor/github.com/go-openapi/spec/schema_test.go index 2e49fbc15..6995fbb48 100644 --- a/vendor/github.com/go-openapi/spec/schema_test.go +++ b/vendor/github.com/go-openapi/spec/schema_test.go @@ -203,3 +203,10 @@ func TestSchema(t *testing.T) { } } + +func BenchmarkSchemaUnmarshal(b *testing.B) { + for i := 0; i < b.N; i++ { + sch := &Schema{} + sch.UnmarshalJSON([]byte(schemaJSON)) + } +} diff --git a/vendor/github.com/go-openapi/swag/loading.go b/vendor/github.com/go-openapi/swag/loading.go index 62ed1e80a..8a2c85434 100644 --- a/vendor/github.com/go-openapi/swag/loading.go +++ b/vendor/github.com/go-openapi/swag/loading.go @@ -19,6 +19,7 @@ import ( "io/ioutil" "log" "net/http" + "net/url" "path/filepath" "strings" "time" @@ -43,7 +44,10 @@ func LoadStrategy(path string, local, remote func(string) ([]byte, error)) func( if strings.HasPrefix(path, "http") { return remote } - return func(pth string) ([]byte, error) { return local(filepath.FromSlash(pth)) } + return func(pth string) ([]byte, error) { + upth, _ := url.PathUnescape(pth) + return local(filepath.FromSlash(upth)) + } } func loadHTTPBytes(timeout time.Duration) func(path string) ([]byte, error) { diff --git a/vendor/github.com/gogo/protobuf/.travis.yml b/vendor/github.com/gogo/protobuf/.travis.yml index 7f69fba09..12302e006 100644 --- a/vendor/github.com/gogo/protobuf/.travis.yml +++ b/vendor/github.com/gogo/protobuf/.travis.yml @@ -1,7 +1,7 @@ env: - PROTOBUF_VERSION=2.6.1 - PROTOBUF_VERSION=3.0.2 - - PROTOBUF_VERSION=3.4.0 + - PROTOBUF_VERSION=3.5.1 before_install: - ./install-protobuf.sh @@ -10,11 +10,11 @@ before_install: script: - PATH=/home/travis/bin:$PATH make buildserverall - echo $TRAVIS_GO_VERSION - - if [ "$TRAVIS_GO_VERSION" == 1.9 ] && [[ "$PROTOBUF_VERSION" == 3.4.0 ]]; then ! git status --porcelain | read || (git status; git diff; exit 1); fi + - if [[ "$PROTOBUF_VERSION" == "3.5.1" ]] && [[ "$TRAVIS_GO_VERSION" =~ ^1\.9\.[0-9]+$ ]]; then ! git status --porcelain | read || (git status; git diff; exit 1); fi language: go go: - - 1.8.3 - - 1.9 - + - 1.8.x + - 1.9.x + - 1.10beta1 diff --git a/vendor/github.com/gogo/protobuf/CONTRIBUTORS b/vendor/github.com/gogo/protobuf/CONTRIBUTORS index b1abc4d30..1b4f6c208 100644 --- a/vendor/github.com/gogo/protobuf/CONTRIBUTORS +++ b/vendor/github.com/gogo/protobuf/CONTRIBUTORS @@ -11,6 +11,7 @@ John Shahid John Tuley Laurent Patrick Lee +Peter Edge Roger Johansson Sam Nguyen Sergio Arbeo diff --git a/vendor/github.com/gogo/protobuf/Makefile b/vendor/github.com/gogo/protobuf/Makefile index 17e329367..1d9ad1f56 100644 --- a/vendor/github.com/gogo/protobuf/Makefile +++ b/vendor/github.com/gogo/protobuf/Makefile @@ -88,6 +88,7 @@ regenerate: make -C test/issue42order regenerate make -C proto generate-test-pbs make -C test/importdedup regenerate + make -C test/importduplicate regenerate make -C test/custombytesnonstruct regenerate make -C test/required regenerate make -C test/casttype regenerate diff --git a/vendor/github.com/gogo/protobuf/README b/vendor/github.com/gogo/protobuf/README index c82082723..035426df5 100644 --- a/vendor/github.com/gogo/protobuf/README +++ b/vendor/github.com/gogo/protobuf/README @@ -123,6 +123,7 @@ When the .proto file specifies `syntax="proto3"`, there are some differences: Consider file test.proto, containing ```proto + syntax = "proto2"; package example; enum FOO { X = 17; }; diff --git a/vendor/github.com/gogo/protobuf/Readme.md b/vendor/github.com/gogo/protobuf/Readme.md index b8eb4d14e..a4ad3eecd 100644 --- a/vendor/github.com/gogo/protobuf/Readme.md +++ b/vendor/github.com/gogo/protobuf/Readme.md @@ -43,8 +43,9 @@ These projects use gogoprotobuf: - nakama - proteus - carbonzipper stack - - SendGrid - + - sendgrid + - zero-os/0-stor + Please let us know if you are using gogoprotobuf by posting on our GoogleGroup. ### Mentioned @@ -64,10 +65,10 @@ After that you can choose: ### Installation -To install it, you must first have Go (at least version 1.6.3) installed (see [http://golang.org/doc/install](http://golang.org/doc/install)). Go 1.8.3 and 1.9 are continuously tested. +To install it, you must first have Go (at least version 1.6.3) installed (see [http://golang.org/doc/install](http://golang.org/doc/install)). Latest patch versions of Go 1.8, 1.9 and 1.10 are continuously tested. Next, install the standard protocol buffer implementation from [https://github.com/google/protobuf](https://github.com/google/protobuf). -Most versions from 2.3.1 should not give any problems, but 2.6.1, 3.0.2 and 3.4.0 are continuously tested. +Most versions from 2.3.1 should not give any problems, but 2.6.1, 3.0.2 and 3.5.1 are continuously tested. ### Speed @@ -98,7 +99,23 @@ Installing any of these binaries is easy. Simply run: go get github.com/gogo/protobuf/{binary} go get github.com/gogo/protobuf/gogoproto -These binaries allow you to using gogoprotobuf [extensions](https://github.com/gogo/protobuf/blob/master/extensions.md). +These binaries allow you to use gogoprotobuf [extensions](https://github.com/gogo/protobuf/blob/master/extensions.md). You can also use your own binary. + +To generate the code, you also need to set the include path properly. + + protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/gogo/protobuf/protobuf --{binary}_out=. myproto.proto + +To use proto files from "google/protobuf" you need to add additional args to protoc. + + protoc -I=. -I=$GOPATH/src -I=$GOPATH/src/github.com/gogo/protobuf/protobuf --{binary}_out=\ + Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types,\ + Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,\ + Mgoogle/protobuf/struct.proto=github.com/gogo/protobuf/types,\ + Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,\ + Mgoogle/protobuf/wrappers.proto=github.com/gogo/protobuf/types:. \ + myproto.proto + +Note that in the protoc command, {binary} does not contain the initial prefix of "protoc-gen". ### Most Speed and most customization diff --git a/vendor/github.com/gogo/protobuf/extensions.md b/vendor/github.com/gogo/protobuf/extensions.md index fcfe17af2..35dfee16f 100644 --- a/vendor/github.com/gogo/protobuf/extensions.md +++ b/vendor/github.com/gogo/protobuf/extensions.md @@ -81,7 +81,7 @@ Helper methods, functions and interfaces can be generated by triggering certain - + diff --git a/vendor/github.com/gogo/protobuf/install-protobuf.sh b/vendor/github.com/gogo/protobuf/install-protobuf.sh index fc40642e4..f42fc9e63 100755 --- a/vendor/github.com/gogo/protobuf/install-protobuf.sh +++ b/vendor/github.com/gogo/protobuf/install-protobuf.sh @@ -26,7 +26,3 @@ case "$PROTOBUF_VERSION" in die "unknown protobuf version: $PROTOBUF_VERSION" ;; esac - - - - diff --git a/vendor/github.com/gogo/protobuf/proto/discard.go b/vendor/github.com/gogo/protobuf/proto/discard.go new file mode 100644 index 000000000..bd0e3bb4c --- /dev/null +++ b/vendor/github.com/gogo/protobuf/proto/discard.go @@ -0,0 +1,151 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2017 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "fmt" + "reflect" + "strings" +) + +// DiscardUnknown recursively discards all unknown fields from this message +// and all embedded messages. +// +// When unmarshaling a message with unrecognized fields, the tags and values +// of such fields are preserved in the Message. This allows a later call to +// marshal to be able to produce a message that continues to have those +// unrecognized fields. To avoid this, DiscardUnknown is used to +// explicitly clear the unknown fields after unmarshaling. +// +// For proto2 messages, the unknown fields of message extensions are only +// discarded from messages that have been accessed via GetExtension. +func DiscardUnknown(m Message) { + discardLegacy(m) +} + +func discardLegacy(m Message) { + v := reflect.ValueOf(m) + if v.Kind() != reflect.Ptr || v.IsNil() { + return + } + v = v.Elem() + if v.Kind() != reflect.Struct { + return + } + t := v.Type() + + for i := 0; i < v.NumField(); i++ { + f := t.Field(i) + if strings.HasPrefix(f.Name, "XXX_") { + continue + } + vf := v.Field(i) + tf := f.Type + + // Unwrap tf to get its most basic type. + var isPointer, isSlice bool + if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { + isSlice = true + tf = tf.Elem() + } + if tf.Kind() == reflect.Ptr { + isPointer = true + tf = tf.Elem() + } + if isPointer && isSlice && tf.Kind() != reflect.Struct { + panic(fmt.Sprintf("%T.%s cannot be a slice of pointers to primitive types", m, f.Name)) + } + + switch tf.Kind() { + case reflect.Struct: + switch { + case !isPointer: + panic(fmt.Sprintf("%T.%s cannot be a direct struct value", m, f.Name)) + case isSlice: // E.g., []*pb.T + for j := 0; j < vf.Len(); j++ { + discardLegacy(vf.Index(j).Interface().(Message)) + } + default: // E.g., *pb.T + discardLegacy(vf.Interface().(Message)) + } + case reflect.Map: + switch { + case isPointer || isSlice: + panic(fmt.Sprintf("%T.%s cannot be a pointer to a map or a slice of map values", m, f.Name)) + default: // E.g., map[K]V + tv := vf.Type().Elem() + if tv.Kind() == reflect.Ptr && tv.Implements(protoMessageType) { // Proto struct (e.g., *T) + for _, key := range vf.MapKeys() { + val := vf.MapIndex(key) + discardLegacy(val.Interface().(Message)) + } + } + } + case reflect.Interface: + // Must be oneof field. + switch { + case isPointer || isSlice: + panic(fmt.Sprintf("%T.%s cannot be a pointer to a interface or a slice of interface values", m, f.Name)) + default: // E.g., test_proto.isCommunique_Union interface + if !vf.IsNil() && f.Tag.Get("protobuf_oneof") != "" { + vf = vf.Elem() // E.g., *test_proto.Communique_Msg + if !vf.IsNil() { + vf = vf.Elem() // E.g., test_proto.Communique_Msg + vf = vf.Field(0) // E.g., Proto struct (e.g., *T) or primitive value + if vf.Kind() == reflect.Ptr { + discardLegacy(vf.Interface().(Message)) + } + } + } + } + } + } + + if vf := v.FieldByName("XXX_unrecognized"); vf.IsValid() { + if vf.Type() != reflect.TypeOf([]byte{}) { + panic("expected XXX_unrecognized to be of type []byte") + } + vf.Set(reflect.ValueOf([]byte(nil))) + } + + // For proto2 messages, only discard unknown fields in message extensions + // that have been accessed via GetExtension. + if em, ok := extendable(m); ok { + // Ignore lock since discardLegacy is not concurrency safe. + emm, _ := em.extensionsRead() + for _, mx := range emm { + if m, ok := mx.value.(Message); ok { + discardLegacy(m) + } + } + } +} diff --git a/vendor/github.com/golang/protobuf/proto/discard.go b/vendor/github.com/golang/protobuf/proto/discard.go new file mode 100644 index 000000000..bd0e3bb4c --- /dev/null +++ b/vendor/github.com/golang/protobuf/proto/discard.go @@ -0,0 +1,151 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2017 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +package proto + +import ( + "fmt" + "reflect" + "strings" +) + +// DiscardUnknown recursively discards all unknown fields from this message +// and all embedded messages. +// +// When unmarshaling a message with unrecognized fields, the tags and values +// of such fields are preserved in the Message. This allows a later call to +// marshal to be able to produce a message that continues to have those +// unrecognized fields. To avoid this, DiscardUnknown is used to +// explicitly clear the unknown fields after unmarshaling. +// +// For proto2 messages, the unknown fields of message extensions are only +// discarded from messages that have been accessed via GetExtension. +func DiscardUnknown(m Message) { + discardLegacy(m) +} + +func discardLegacy(m Message) { + v := reflect.ValueOf(m) + if v.Kind() != reflect.Ptr || v.IsNil() { + return + } + v = v.Elem() + if v.Kind() != reflect.Struct { + return + } + t := v.Type() + + for i := 0; i < v.NumField(); i++ { + f := t.Field(i) + if strings.HasPrefix(f.Name, "XXX_") { + continue + } + vf := v.Field(i) + tf := f.Type + + // Unwrap tf to get its most basic type. + var isPointer, isSlice bool + if tf.Kind() == reflect.Slice && tf.Elem().Kind() != reflect.Uint8 { + isSlice = true + tf = tf.Elem() + } + if tf.Kind() == reflect.Ptr { + isPointer = true + tf = tf.Elem() + } + if isPointer && isSlice && tf.Kind() != reflect.Struct { + panic(fmt.Sprintf("%T.%s cannot be a slice of pointers to primitive types", m, f.Name)) + } + + switch tf.Kind() { + case reflect.Struct: + switch { + case !isPointer: + panic(fmt.Sprintf("%T.%s cannot be a direct struct value", m, f.Name)) + case isSlice: // E.g., []*pb.T + for j := 0; j < vf.Len(); j++ { + discardLegacy(vf.Index(j).Interface().(Message)) + } + default: // E.g., *pb.T + discardLegacy(vf.Interface().(Message)) + } + case reflect.Map: + switch { + case isPointer || isSlice: + panic(fmt.Sprintf("%T.%s cannot be a pointer to a map or a slice of map values", m, f.Name)) + default: // E.g., map[K]V + tv := vf.Type().Elem() + if tv.Kind() == reflect.Ptr && tv.Implements(protoMessageType) { // Proto struct (e.g., *T) + for _, key := range vf.MapKeys() { + val := vf.MapIndex(key) + discardLegacy(val.Interface().(Message)) + } + } + } + case reflect.Interface: + // Must be oneof field. + switch { + case isPointer || isSlice: + panic(fmt.Sprintf("%T.%s cannot be a pointer to a interface or a slice of interface values", m, f.Name)) + default: // E.g., test_proto.isCommunique_Union interface + if !vf.IsNil() && f.Tag.Get("protobuf_oneof") != "" { + vf = vf.Elem() // E.g., *test_proto.Communique_Msg + if !vf.IsNil() { + vf = vf.Elem() // E.g., test_proto.Communique_Msg + vf = vf.Field(0) // E.g., Proto struct (e.g., *T) or primitive value + if vf.Kind() == reflect.Ptr { + discardLegacy(vf.Interface().(Message)) + } + } + } + } + } + } + + if vf := v.FieldByName("XXX_unrecognized"); vf.IsValid() { + if vf.Type() != reflect.TypeOf([]byte{}) { + panic("expected XXX_unrecognized to be of type []byte") + } + vf.Set(reflect.ValueOf([]byte(nil))) + } + + // For proto2 messages, only discard unknown fields in message extensions + // that have been accessed via GetExtension. + if em, ok := extendable(m); ok { + // Ignore lock since discardLegacy is not concurrency safe. + emm, _ := em.extensionsRead() + for _, mx := range emm { + if m, ok := mx.value.(Message); ok { + discardLegacy(m) + } + } + } +} diff --git a/vendor/github.com/google/btree/btree.go b/vendor/github.com/google/btree/btree.go index eb74b1d39..7e4551d73 100644 --- a/vendor/github.com/google/btree/btree.go +++ b/vendor/github.com/google/btree/btree.go @@ -103,12 +103,16 @@ func (f *FreeList) newNode() (n *node) { return } -func (f *FreeList) freeNode(n *node) { +// freeNode adds the given node to the list, returning true if it was added +// and false if it was discarded. +func (f *FreeList) freeNode(n *node) (out bool) { f.mu.Lock() if len(f.freelist) < cap(f.freelist) { f.freelist = append(f.freelist, n) + out = true } f.mu.Unlock() + return } // ItemIterator allows callers of Ascend* to iterate in-order over portions of @@ -635,13 +639,30 @@ func (c *copyOnWriteContext) newNode() (n *node) { return } -func (c *copyOnWriteContext) freeNode(n *node) { +type freeType int + +const ( + ftFreelistFull freeType = iota // node was freed (available for GC, not stored in freelist) + ftStored // node was stored in the freelist for later use + ftNotOwned // node was ignored by COW, since it's owned by another one +) + +// freeNode frees a node within a given COW context, if it's owned by that +// context. It returns what happened to the node (see freeType const +// documentation). +func (c *copyOnWriteContext) freeNode(n *node) freeType { if n.cow == c { // clear to allow GC n.items.truncate(0) n.children.truncate(0) n.cow = nil - c.freelist.freeNode(n) + if c.freelist.freeNode(n) { + return ftStored + } else { + return ftFreelistFull + } + } else { + return ftNotOwned } } @@ -812,6 +833,45 @@ func (t *BTree) Len() int { return t.length } +// Clear removes all items from the btree. If addNodesToFreelist is true, +// t's nodes are added to its freelist as part of this call, until the freelist +// is full. Otherwise, the root node is simply dereferenced and the subtree +// left to Go's normal GC processes. +// +// This can be much faster +// than calling Delete on all elements, because that requires finding/removing +// each element in the tree and updating the tree accordingly. It also is +// somewhat faster than creating a new tree to replace the old one, because +// nodes from the old tree are reclaimed into the freelist for use by the new +// one, instead of being lost to the garbage collector. +// +// This call takes: +// O(1): when addNodesToFreelist is false, this is a single operation. +// O(1): when the freelist is already full, it breaks out immediately +// O(freelist size): when the freelist is empty and the nodes are all owned +// by this tree, nodes are added to the freelist until full. +// O(tree size): when all nodes are owned by another tree, all nodes are +// iterated over looking for nodes to add to the freelist, and due to +// ownership, none are. +func (t *BTree) Clear(addNodesToFreelist bool) { + if t.root != nil && addNodesToFreelist { + t.root.reset(t.cow) + } + t.root, t.length = nil, 0 +} + +// reset returns a subtree to the freelist. It breaks out immediately if the +// freelist is full, since the only benefit of iterating is to fill that +// freelist up. Returns true if parent reset call should continue. +func (n *node) reset(c *copyOnWriteContext) bool { + for _, child := range n.children { + if !child.reset(c) { + return false + } + } + return c.freeNode(n) != ftFreelistFull +} + // Int implements the Item interface for integers. type Int int diff --git a/vendor/github.com/google/btree/btree_test.go b/vendor/github.com/google/btree/btree_test.go index 5da9d8b69..9eeb136a5 100644 --- a/vendor/github.com/google/btree/btree_test.go +++ b/vendor/github.com/google/btree/btree_test.go @@ -687,3 +687,84 @@ func TestCloneConcurrentOperations(t *testing.T) { } } } + +func BenchmarkDeleteAndRestore(b *testing.B) { + items := perm(16392) + b.ResetTimer() + b.Run(`CopyBigFreeList`, func(b *testing.B) { + fl := NewFreeList(16392) + tr := NewWithFreeList(*btreeDegree, fl) + for _, v := range items { + tr.ReplaceOrInsert(v) + } + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + dels := make([]Item, 0, tr.Len()) + tr.Ascend(ItemIterator(func(b Item) bool { + dels = append(dels, b) + return true + })) + for _, del := range dels { + tr.Delete(del) + } + // tr is now empty, we make a new empty copy of it. + tr = NewWithFreeList(*btreeDegree, fl) + for _, v := range items { + tr.ReplaceOrInsert(v) + } + } + }) + b.Run(`Copy`, func(b *testing.B) { + tr := New(*btreeDegree) + for _, v := range items { + tr.ReplaceOrInsert(v) + } + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + dels := make([]Item, 0, tr.Len()) + tr.Ascend(ItemIterator(func(b Item) bool { + dels = append(dels, b) + return true + })) + for _, del := range dels { + tr.Delete(del) + } + // tr is now empty, we make a new empty copy of it. + tr = New(*btreeDegree) + for _, v := range items { + tr.ReplaceOrInsert(v) + } + } + }) + b.Run(`ClearBigFreelist`, func(b *testing.B) { + fl := NewFreeList(16392) + tr := NewWithFreeList(*btreeDegree, fl) + for _, v := range items { + tr.ReplaceOrInsert(v) + } + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + tr.Clear(true) + for _, v := range items { + tr.ReplaceOrInsert(v) + } + } + }) + b.Run(`Clear`, func(b *testing.B) { + tr := New(*btreeDegree) + for _, v := range items { + tr.ReplaceOrInsert(v) + } + b.ReportAllocs() + b.ResetTimer() + for i := 0; i < b.N; i++ { + tr.Clear(true) + for _, v := range items { + tr.ReplaceOrInsert(v) + } + } + }) +} diff --git a/vendor/github.com/hashicorp/golang-lru/2q.go b/vendor/github.com/hashicorp/golang-lru/2q.go index 337d96329..e474cd075 100644 --- a/vendor/github.com/hashicorp/golang-lru/2q.go +++ b/vendor/github.com/hashicorp/golang-lru/2q.go @@ -30,9 +30,9 @@ type TwoQueueCache struct { size int recentSize int - recent *simplelru.LRU - frequent *simplelru.LRU - recentEvict *simplelru.LRU + recent simplelru.LRUCache + frequent simplelru.LRUCache + recentEvict simplelru.LRUCache lock sync.RWMutex } @@ -84,7 +84,8 @@ func New2QParams(size int, recentRatio float64, ghostRatio float64) (*TwoQueueCa return c, nil } -func (c *TwoQueueCache) Get(key interface{}) (interface{}, bool) { +// Get looks up a key's value from the cache. +func (c *TwoQueueCache) Get(key interface{}) (value interface{}, ok bool) { c.lock.Lock() defer c.lock.Unlock() @@ -105,6 +106,7 @@ func (c *TwoQueueCache) Get(key interface{}) (interface{}, bool) { return nil, false } +// Add adds a value to the cache. func (c *TwoQueueCache) Add(key, value interface{}) { c.lock.Lock() defer c.lock.Unlock() @@ -160,12 +162,15 @@ func (c *TwoQueueCache) ensureSpace(recentEvict bool) { c.frequent.RemoveOldest() } +// Len returns the number of items in the cache. func (c *TwoQueueCache) Len() int { c.lock.RLock() defer c.lock.RUnlock() return c.recent.Len() + c.frequent.Len() } +// Keys returns a slice of the keys in the cache. +// The frequently used keys are first in the returned slice. func (c *TwoQueueCache) Keys() []interface{} { c.lock.RLock() defer c.lock.RUnlock() @@ -174,6 +179,7 @@ func (c *TwoQueueCache) Keys() []interface{} { return append(k1, k2...) } +// Remove removes the provided key from the cache. func (c *TwoQueueCache) Remove(key interface{}) { c.lock.Lock() defer c.lock.Unlock() @@ -188,6 +194,7 @@ func (c *TwoQueueCache) Remove(key interface{}) { } } +// Purge is used to completely clear the cache. func (c *TwoQueueCache) Purge() { c.lock.Lock() defer c.lock.Unlock() @@ -196,13 +203,17 @@ func (c *TwoQueueCache) Purge() { c.recentEvict.Purge() } +// Contains is used to check if the cache contains a key +// without updating recency or frequency. func (c *TwoQueueCache) Contains(key interface{}) bool { c.lock.RLock() defer c.lock.RUnlock() return c.frequent.Contains(key) || c.recent.Contains(key) } -func (c *TwoQueueCache) Peek(key interface{}) (interface{}, bool) { +// Peek is used to inspect the cache value of a key +// without updating recency or frequency. +func (c *TwoQueueCache) Peek(key interface{}) (value interface{}, ok bool) { c.lock.RLock() defer c.lock.RUnlock() if val, ok := c.frequent.Peek(key); ok { diff --git a/vendor/github.com/hashicorp/golang-lru/arc.go b/vendor/github.com/hashicorp/golang-lru/arc.go index a2a252817..555225a21 100644 --- a/vendor/github.com/hashicorp/golang-lru/arc.go +++ b/vendor/github.com/hashicorp/golang-lru/arc.go @@ -18,11 +18,11 @@ type ARCCache struct { size int // Size is the total capacity of the cache p int // P is the dynamic preference towards T1 or T2 - t1 *simplelru.LRU // T1 is the LRU for recently accessed items - b1 *simplelru.LRU // B1 is the LRU for evictions from t1 + t1 simplelru.LRUCache // T1 is the LRU for recently accessed items + b1 simplelru.LRUCache // B1 is the LRU for evictions from t1 - t2 *simplelru.LRU // T2 is the LRU for frequently accessed items - b2 *simplelru.LRU // B2 is the LRU for evictions from t2 + t2 simplelru.LRUCache // T2 is the LRU for frequently accessed items + b2 simplelru.LRUCache // B2 is the LRU for evictions from t2 lock sync.RWMutex } @@ -60,11 +60,11 @@ func NewARC(size int) (*ARCCache, error) { } // Get looks up a key's value from the cache. -func (c *ARCCache) Get(key interface{}) (interface{}, bool) { +func (c *ARCCache) Get(key interface{}) (value interface{}, ok bool) { c.lock.Lock() defer c.lock.Unlock() - // Ff the value is contained in T1 (recent), then + // If the value is contained in T1 (recent), then // promote it to T2 (frequent) if val, ok := c.t1.Peek(key); ok { c.t1.Remove(key) @@ -153,7 +153,7 @@ func (c *ARCCache) Add(key, value interface{}) { // Remove from B2 c.b2.Remove(key) - // Add the key to the frequntly used list + // Add the key to the frequently used list c.t2.Add(key, value) return } @@ -247,7 +247,7 @@ func (c *ARCCache) Contains(key interface{}) bool { // Peek is used to inspect the cache value of a key // without updating recency or frequency. -func (c *ARCCache) Peek(key interface{}) (interface{}, bool) { +func (c *ARCCache) Peek(key interface{}) (value interface{}, ok bool) { c.lock.RLock() defer c.lock.RUnlock() if val, ok := c.t1.Peek(key); ok { diff --git a/vendor/github.com/hashicorp/golang-lru/doc.go b/vendor/github.com/hashicorp/golang-lru/doc.go new file mode 100644 index 000000000..2547df979 --- /dev/null +++ b/vendor/github.com/hashicorp/golang-lru/doc.go @@ -0,0 +1,21 @@ +// Package lru provides three different LRU caches of varying sophistication. +// +// Cache is a simple LRU cache. It is based on the +// LRU implementation in groupcache: +// https://github.com/golang/groupcache/tree/master/lru +// +// TwoQueueCache tracks frequently used and recently used entries separately. +// This avoids a burst of accesses from taking out frequently used entries, +// at the cost of about 2x computational overhead and some extra bookkeeping. +// +// ARCCache is an adaptive replacement cache. It tracks recent evictions as +// well as recent usage in both the frequent and recent caches. Its +// computational overhead is comparable to TwoQueueCache, but the memory +// overhead is linear with the size of the cache. +// +// ARC has been patented by IBM, so do not use it if that is problematic for +// your program. +// +// All caches in this package take locks while operating, and are therefore +// thread-safe for consumers. +package lru diff --git a/vendor/github.com/hashicorp/golang-lru/lru.go b/vendor/github.com/hashicorp/golang-lru/lru.go index a6285f989..c8d9b0a23 100644 --- a/vendor/github.com/hashicorp/golang-lru/lru.go +++ b/vendor/github.com/hashicorp/golang-lru/lru.go @@ -1,6 +1,3 @@ -// This package provides a simple LRU cache. It is based on the -// LRU implementation in groupcache: -// https://github.com/golang/groupcache/tree/master/lru package lru import ( @@ -11,11 +8,11 @@ import ( // Cache is a thread-safe fixed size LRU cache. type Cache struct { - lru *simplelru.LRU + lru simplelru.LRUCache lock sync.RWMutex } -// New creates an LRU of the given size +// New creates an LRU of the given size. func New(size int) (*Cache, error) { return NewWithEvict(size, nil) } @@ -33,7 +30,7 @@ func NewWithEvict(size int, onEvicted func(key interface{}, value interface{})) return c, nil } -// Purge is used to completely clear the cache +// Purge is used to completely clear the cache. func (c *Cache) Purge() { c.lock.Lock() c.lru.Purge() @@ -41,30 +38,30 @@ func (c *Cache) Purge() { } // Add adds a value to the cache. Returns true if an eviction occurred. -func (c *Cache) Add(key, value interface{}) bool { +func (c *Cache) Add(key, value interface{}) (evicted bool) { c.lock.Lock() defer c.lock.Unlock() return c.lru.Add(key, value) } // Get looks up a key's value from the cache. -func (c *Cache) Get(key interface{}) (interface{}, bool) { +func (c *Cache) Get(key interface{}) (value interface{}, ok bool) { c.lock.Lock() defer c.lock.Unlock() return c.lru.Get(key) } -// Check if a key is in the cache, without updating the recent-ness -// or deleting it for being stale. +// Contains checks if a key is in the cache, without updating the +// recent-ness or deleting it for being stale. func (c *Cache) Contains(key interface{}) bool { c.lock.RLock() defer c.lock.RUnlock() return c.lru.Contains(key) } -// Returns the key value (or undefined if not found) without updating +// Peek returns the key value (or undefined if not found) without updating // the "recently used"-ness of the key. -func (c *Cache) Peek(key interface{}) (interface{}, bool) { +func (c *Cache) Peek(key interface{}) (value interface{}, ok bool) { c.lock.RLock() defer c.lock.RUnlock() return c.lru.Peek(key) @@ -73,16 +70,15 @@ func (c *Cache) Peek(key interface{}) (interface{}, bool) { // ContainsOrAdd checks if a key is in the cache without updating the // recent-ness or deleting it for being stale, and if not, adds the value. // Returns whether found and whether an eviction occurred. -func (c *Cache) ContainsOrAdd(key, value interface{}) (ok, evict bool) { +func (c *Cache) ContainsOrAdd(key, value interface{}) (ok, evicted bool) { c.lock.Lock() defer c.lock.Unlock() if c.lru.Contains(key) { return true, false - } else { - evict := c.lru.Add(key, value) - return false, evict } + evicted = c.lru.Add(key, value) + return false, evicted } // Remove removes the provided key from the cache. diff --git a/vendor/github.com/hashicorp/golang-lru/lru_test.go b/vendor/github.com/hashicorp/golang-lru/lru_test.go index 2b31218b0..e7e23505e 100644 --- a/vendor/github.com/hashicorp/golang-lru/lru_test.go +++ b/vendor/github.com/hashicorp/golang-lru/lru_test.go @@ -72,7 +72,7 @@ func TestLRU(t *testing.T) { if k != v { t.Fatalf("Evict values not equal (%v!=%v)", k, v) } - evictCounter += 1 + evictCounter++ } l, err := NewWithEvict(128, onEvicted) if err != nil { @@ -136,7 +136,7 @@ func TestLRU(t *testing.T) { func TestLRUAdd(t *testing.T) { evictCounter := 0 onEvicted := func(k interface{}, v interface{}) { - evictCounter += 1 + evictCounter++ } l, err := NewWithEvict(1, onEvicted) diff --git a/vendor/github.com/hashicorp/golang-lru/simplelru/lru.go b/vendor/github.com/hashicorp/golang-lru/simplelru/lru.go index cb416b394..5673773b2 100644 --- a/vendor/github.com/hashicorp/golang-lru/simplelru/lru.go +++ b/vendor/github.com/hashicorp/golang-lru/simplelru/lru.go @@ -36,7 +36,7 @@ func NewLRU(size int, onEvict EvictCallback) (*LRU, error) { return c, nil } -// Purge is used to completely clear the cache +// Purge is used to completely clear the cache. func (c *LRU) Purge() { for k, v := range c.items { if c.onEvict != nil { @@ -48,7 +48,7 @@ func (c *LRU) Purge() { } // Add adds a value to the cache. Returns true if an eviction occurred. -func (c *LRU) Add(key, value interface{}) bool { +func (c *LRU) Add(key, value interface{}) (evicted bool) { // Check for existing item if ent, ok := c.items[key]; ok { c.evictList.MoveToFront(ent) @@ -78,17 +78,18 @@ func (c *LRU) Get(key interface{}) (value interface{}, ok bool) { return } -// Check if a key is in the cache, without updating the recent-ness +// Contains checks if a key is in the cache, without updating the recent-ness // or deleting it for being stale. func (c *LRU) Contains(key interface{}) (ok bool) { _, ok = c.items[key] return ok } -// Returns the key value (or undefined if not found) without updating +// Peek returns the key value (or undefined if not found) without updating // the "recently used"-ness of the key. func (c *LRU) Peek(key interface{}) (value interface{}, ok bool) { - if ent, ok := c.items[key]; ok { + var ent *list.Element + if ent, ok = c.items[key]; ok { return ent.Value.(*entry).value, true } return nil, ok @@ -96,7 +97,7 @@ func (c *LRU) Peek(key interface{}) (value interface{}, ok bool) { // Remove removes the provided key from the cache, returning if the // key was contained. -func (c *LRU) Remove(key interface{}) bool { +func (c *LRU) Remove(key interface{}) (present bool) { if ent, ok := c.items[key]; ok { c.removeElement(ent) return true @@ -105,7 +106,7 @@ func (c *LRU) Remove(key interface{}) bool { } // RemoveOldest removes the oldest item from the cache. -func (c *LRU) RemoveOldest() (interface{}, interface{}, bool) { +func (c *LRU) RemoveOldest() (key interface{}, value interface{}, ok bool) { ent := c.evictList.Back() if ent != nil { c.removeElement(ent) @@ -116,7 +117,7 @@ func (c *LRU) RemoveOldest() (interface{}, interface{}, bool) { } // GetOldest returns the oldest entry -func (c *LRU) GetOldest() (interface{}, interface{}, bool) { +func (c *LRU) GetOldest() (key interface{}, value interface{}, ok bool) { ent := c.evictList.Back() if ent != nil { kv := ent.Value.(*entry) diff --git a/vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go b/vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go new file mode 100644 index 000000000..744cac01c --- /dev/null +++ b/vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go @@ -0,0 +1,37 @@ +package simplelru + + +// LRUCache is the interface for simple LRU cache. +type LRUCache interface { + // Adds a value to the cache, returns true if an eviction occurred and + // updates the "recently used"-ness of the key. + Add(key, value interface{}) bool + + // Returns key's value from the cache and + // updates the "recently used"-ness of the key. #value, isFound + Get(key interface{}) (value interface{}, ok bool) + + // Check if a key exsists in cache without updating the recent-ness. + Contains(key interface{}) (ok bool) + + // Returns key's value without updating the "recently used"-ness of the key. + Peek(key interface{}) (value interface{}, ok bool) + + // Removes a key from the cache. + Remove(key interface{}) bool + + // Removes the oldest entry from cache. + RemoveOldest() (interface{}, interface{}, bool) + + // Returns the oldest entry from the cache. #key, value, isFound + GetOldest() (interface{}, interface{}, bool) + + // Returns a slice of the keys in the cache, from oldest to newest. + Keys() []interface{} + + // Returns the number of items in the cache. + Len() int + + // Clear all cache entries + Purge() +} diff --git a/vendor/github.com/hashicorp/golang-lru/simplelru/lru_test.go b/vendor/github.com/hashicorp/golang-lru/simplelru/lru_test.go index a958934f6..ca5676e1e 100644 --- a/vendor/github.com/hashicorp/golang-lru/simplelru/lru_test.go +++ b/vendor/github.com/hashicorp/golang-lru/simplelru/lru_test.go @@ -8,7 +8,7 @@ func TestLRU(t *testing.T) { if k != v { t.Fatalf("Evict values not equal (%v!=%v)", k, v) } - evictCounter += 1 + evictCounter++ } l, err := NewLRU(128, onEvicted) if err != nil { @@ -112,7 +112,7 @@ func TestLRU_GetOldest_RemoveOldest(t *testing.T) { func TestLRU_Add(t *testing.T) { evictCounter := 0 onEvicted := func(k interface{}, v interface{}) { - evictCounter += 1 + evictCounter++ } l, err := NewLRU(1, onEvicted) diff --git a/vendor/github.com/imdario/mergo/.travis.yml b/vendor/github.com/imdario/mergo/.travis.yml index 9d91c6339..b13a50ed1 100644 --- a/vendor/github.com/imdario/mergo/.travis.yml +++ b/vendor/github.com/imdario/mergo/.travis.yml @@ -1,2 +1,7 @@ language: go -install: go get -t +install: + - go get -t + - go get golang.org/x/tools/cmd/cover + - go get github.com/mattn/goveralls +script: + - $HOME/gopath/bin/goveralls -service=travis-ci -repotoken $COVERALLS_TOKEN diff --git a/vendor/github.com/imdario/mergo/README.md b/vendor/github.com/imdario/mergo/README.md index f6b7858ad..4a99d3172 100644 --- a/vendor/github.com/imdario/mergo/README.md +++ b/vendor/github.com/imdario/mergo/README.md @@ -2,17 +2,16 @@ A helper to merge structs and maps in Golang. Useful for configuration default values, avoiding messy if-statements. -Also a lovely [comune](http://en.wikipedia.org/wiki/Mergo) (municipality) in the Province of Ancona in the Italian region Marche. - -![Mergo dall'alto](http://www.comune.mergo.an.it/Siti/Mergo/Immagini/Foto/mergo_dall_alto.jpg) +Also a lovely [comune](http://en.wikipedia.org/wiki/Mergo) (municipality) in the Province of Ancona in the Italian region of Marche. ## Status -It is ready for production use. It works fine after extensive use in the wild. +It is ready for production use. [It is used in several projects by Docker, Google, The Linux Foundation, VMWare, Shopify, etc](https://github.com/imdario/mergo#mergo-in-the-wild). [![Build Status][1]][2] [![GoDoc][3]][4] [![GoCard][5]][6] +[![Coverage Status][7]][8] [1]: https://travis-ci.org/imdario/mergo.png [2]: https://travis-ci.org/imdario/mergo @@ -20,19 +19,41 @@ It is ready for production use. It works fine after extensive use in the wild. [4]: https://godoc.org/github.com/imdario/mergo [5]: https://goreportcard.com/badge/imdario/mergo [6]: https://goreportcard.com/report/github.com/imdario/mergo +[7]: https://coveralls.io/repos/github/imdario/mergo/badge.svg?branch=master +[8]: https://coveralls.io/github/imdario/mergo?branch=master + +### Latest release + +[Release 0.3.1](https://github.com/imdario/mergo/releases/tag/0.3.1) is an important release because it changes `Merge()`and `Map()` signatures to support [transformers](#transformers). An optional/variadic argument has been added, so it won't break existing code. ### Important note -Mergo is intended to assign **only** zero value fields on destination with source value. Since April 6th it works like this. Before it didn't work properly, causing some random overwrites. After some issues and PRs I found it didn't merge as I designed it. Thanks to [imdario/mergo#8](https://github.com/imdario/mergo/pull/8) overwriting functions were added and the wrong behavior was clearly detected. - If you were using Mergo **before** April 6th 2015, please check your project works as intended after updating your local copy with ```go get -u github.com/imdario/mergo```. I apologize for any issue caused by its previous behavior and any future bug that Mergo could cause (I hope it won't!) in existing projects after the change (release 0.2.0). ### Mergo in the wild -- [docker/docker](https://github.com/docker/docker/) +- [moby/moby](https://github.com/moby/moby) - [kubernetes/kubernetes](https://github.com/kubernetes/kubernetes) +- [vmware/dispatch](https://github.com/vmware/dispatch) +- [Shopify/themekit](https://github.com/Shopify/themekit) - [imdario/zas](https://github.com/imdario/zas) +- [matcornic/hermes](https://github.com/matcornic/hermes) +- [OpenBazaar/openbazaar-go](https://github.com/OpenBazaar/openbazaar-go) +- [kataras/iris](https://github.com/kataras/iris) +- [michaelsauter/crane](https://github.com/michaelsauter/crane) +- [go-task/task](https://github.com/go-task/task) +- [sensu/uchiwa](https://github.com/sensu/uchiwa) +- [ory/hydra](https://github.com/ory/hydra) +- [sisatech/vcli](https://github.com/sisatech/vcli) +- [dairycart/dairycart](https://github.com/dairycart/dairycart) +- [projectcalico/felix](https://github.com/projectcalico/felix) +- [resin-os/balena](https://github.com/resin-os/balena) +- [go-kivik/kivik](https://github.com/go-kivik/kivik) +- [Telefonica/govice](https://github.com/Telefonica/govice) +- [supergiant/supergiant](supergiant/supergiant) +- [SergeyTsalkov/brooce](https://github.com/SergeyTsalkov/brooce) - [soniah/dnsmadeeasy](https://github.com/soniah/dnsmadeeasy) +- [ohsu-comp-bio/funnel](https://github.com/ohsu-comp-bio/funnel) - [EagerIO/Stout](https://github.com/EagerIO/Stout) - [lynndylanhurley/defsynth-api](https://github.com/lynndylanhurley/defsynth-api) - [russross/canvasassignments](https://github.com/russross/canvasassignments) @@ -50,7 +71,7 @@ If you were using Mergo **before** April 6th 2015, please check your project wor - [thoas/picfit](https://github.com/thoas/picfit) - [mantasmatelis/whooplist-server](https://github.com/mantasmatelis/whooplist-server) - [jnuthong/item_search](https://github.com/jnuthong/item_search) -- [Iris Web Framework](https://github.com/kataras/iris) +- [bukalapak/snowboard](https://github.com/bukalapak/snowboard) ## Installation @@ -71,7 +92,7 @@ if err := mergo.Merge(&dst, src); err != nil { } ``` -Also, you can merge overwriting values using the transformer WithOverride. +Also, you can merge overwriting values using the transformer `WithOverride`. ```go if err := mergo.Merge(&dst, src, WithOverride); err != nil { @@ -79,7 +100,7 @@ if err := mergo.Merge(&dst, src, WithOverride); err != nil { } ``` -Additionally, you can map a map[string]interface{} to a struct (and otherwise, from struct to map), following the same restrictions as in Merge(). Keys are capitalized to find each corresponding exported field. +Additionally, you can map a `map[string]interface{}` to a struct (and otherwise, from struct to map), following the same restrictions as in `Merge()`. Keys are capitalized to find each corresponding exported field. ```go if err := mergo.Map(&dst, srcMap); err != nil { @@ -151,6 +172,7 @@ func (t timeTransfomer) Transformer(typ reflect.Type) func(dst, src reflect.Valu dst.Set(src) } } + return nil } } return nil diff --git a/vendor/github.com/imdario/mergo/issue33_test.go b/vendor/github.com/imdario/mergo/issue33_test.go index c2d4a60d3..ae55ae236 100644 --- a/vendor/github.com/imdario/mergo/issue33_test.go +++ b/vendor/github.com/imdario/mergo/issue33_test.go @@ -28,6 +28,6 @@ func TestIssue33Merge(t *testing.T) { t.Errorf("Error while merging: %s", err) } if dest.Str != toMerge.Str { - t.Errorf("dest.Str should have been override: dest.Str(%v) == toMerge.Str(%v)", dest.Str, toMerge.Str) + t.Errorf("dest.Str should have been override: dest.Str(%v) != toMerge.Str(%v)", dest.Str, toMerge.Str) } } diff --git a/vendor/github.com/imdario/mergo/merge.go b/vendor/github.com/imdario/mergo/merge.go index 04629a3dc..8ca10c910 100644 --- a/vendor/github.com/imdario/mergo/merge.go +++ b/vendor/github.com/imdario/mergo/merge.go @@ -54,7 +54,7 @@ func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, co visited[h] = &visit{addr, typ, seen} } - if config.transformers != nil { + if config.transformers != nil && !isEmptyValue(dst) { if fn := config.transformers.Transformer(dst.Type()); fn != nil { err = fn(dst, src) return diff --git a/vendor/github.com/imdario/mergo/merge_test.go b/vendor/github.com/imdario/mergo/merge_test.go new file mode 100644 index 000000000..5bf808a78 --- /dev/null +++ b/vendor/github.com/imdario/mergo/merge_test.go @@ -0,0 +1,50 @@ +package mergo + +import ( + "reflect" + "testing" +) + +type transformer struct { + m map[reflect.Type]func(dst, src reflect.Value) error +} + +func (s *transformer) Transformer(t reflect.Type) func(dst, src reflect.Value) error { + if fn, ok := s.m[t]; ok { + return fn + } + return nil +} + +type foo struct { + s string + Bar *bar +} + +type bar struct { + i int + s map[string]string +} + +func TestMergeWithTransformerNilStruct(t *testing.T) { + a := foo{s: "foo"} + b := foo{Bar: &bar{i: 2, s: map[string]string{"foo": "bar"}}} + if err := Merge(&a, &b, WithOverride, WithTransformers(&transformer{ + m: map[reflect.Type]func(dst, src reflect.Value) error{ + reflect.TypeOf(&bar{}): func(dst, src reflect.Value) error { + // Do sthg with Elem + t.Log(dst.Elem().FieldByName("i")) + t.Log(src.Elem()) + return nil + }, + }, + })); err != nil { + t.Fatal(err) + } + if a.s != "foo" { + t.Fatalf("b not merged in properly: a.s.Value(%s) != expected(%s)", a.s, "foo") + } + if a.Bar == nil { + t.Fatalf("b not merged in properly: a.Bar shouldn't be nil") + } +} diff --git a/vendor/github.com/imdario/mergo/mergo.go b/vendor/github.com/imdario/mergo/mergo.go index f823c5517..785618cd0 100644 --- a/vendor/github.com/imdario/mergo/mergo.go +++ b/vendor/github.com/imdario/mergo/mergo.go @@ -47,6 +47,8 @@ func isEmptyValue(v reflect.Value) bool { return v.Float() == 0 case reflect.Interface, reflect.Ptr, reflect.Func: return v.IsNil() + case reflect.Invalid: + return true } return false } diff --git a/vendor/github.com/json-iterator/go/.gitignore b/vendor/github.com/json-iterator/go/.gitignore index ce242daf7..15556530a 100644 --- a/vendor/github.com/json-iterator/go/.gitignore +++ b/vendor/github.com/json-iterator/go/.gitignore @@ -1,4 +1,4 @@ -.idea -/coverage.txt -/profile.out +/vendor /bug_test.go +/coverage.txt +/.idea diff --git a/vendor/github.com/json-iterator/go/Gopkg.lock b/vendor/github.com/json-iterator/go/Gopkg.lock new file mode 100644 index 000000000..bbccc68d2 --- /dev/null +++ b/vendor/github.com/json-iterator/go/Gopkg.lock @@ -0,0 +1,45 @@ +# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. + + +[[projects]] + name = "github.com/davecgh/go-spew" + packages = ["spew"] + revision = "346938d642f2ec3594ed81d874461961cd0faa76" + version = "v1.1.0" + +[[projects]] + branch = "master" + name = "github.com/google/gofuzz" + packages = ["."] + revision = "24818f796faf91cd76ec7bddd72458fbced7a6c1" + +[[projects]] + name = "github.com/pmezard/go-difflib" + packages = ["difflib"] + revision = "792786c7400a136282c1664665ae0a8db921c6c2" + version = "v1.0.0" + +[[projects]] + name = "github.com/stretchr/testify" + packages = [ + "assert", + "require" + ] + revision = "12b6f73e6084dad08a7c6e575284b177ecafbc71" + version = "v1.2.1" + +[[projects]] + name = "github.com/v2pro/plz" + packages = [ + "concurrent", + "reflect2" + ] + revision = "10fc95fad3224a032229e59f6e7023137d82b526" + version = "0.9.1" + +[solve-meta] + analyzer-name = "dep" + analyzer-version = 1 + inputs-digest = "64fe3937a1afce5cb551c06ff7109065c971643e082512243d1071bab428ff14" + solver-name = "gps-cdcl" + solver-version = 1 diff --git a/vendor/github.com/json-iterator/go/Gopkg.toml b/vendor/github.com/json-iterator/go/Gopkg.toml new file mode 100644 index 000000000..8e7e8a65c --- /dev/null +++ b/vendor/github.com/json-iterator/go/Gopkg.toml @@ -0,0 +1,37 @@ +# Gopkg.toml example +# +# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md +# for detailed Gopkg.toml documentation. +# +# required = ["github.com/user/thing/cmd/thing"] +# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] +# +# [[constraint]] +# name = "github.com/user/project" +# version = "1.0.0" +# +# [[constraint]] +# name = "github.com/user/project2" +# branch = "dev" +# source = "github.com/myfork/project2" +# +# [[override]] +# name = "github.com/x/y" +# version = "2.4.0" + + +[[constraint]] + name = "github.com/davecgh/go-spew" + version = "1.1.0" + +[[constraint]] + branch = "master" + name = "github.com/google/gofuzz" + +[[constraint]] + name = "github.com/stretchr/testify" + version = "1.1.4" + +[[constraint]] + name = "github.com/v2pro/plz" + version = "0.9.1" diff --git a/vendor/github.com/json-iterator/go/README.md b/vendor/github.com/json-iterator/go/README.md index 3a0d68098..9f404aaa3 100644 --- a/vendor/github.com/json-iterator/go/README.md +++ b/vendor/github.com/json-iterator/go/README.md @@ -8,6 +8,8 @@ A high-performance 100% compatible drop-in replacement of "encoding/json" +You can also use thrift like JSON using [thrift-iterator](https://github.com/thrift-iterator/go) + ``` Go开发者们请加入我们,滴滴出行平台技术部 taowen@didichuxing.com ``` diff --git a/vendor/github.com/json-iterator/go/feature_adapter.go b/vendor/github.com/json-iterator/go/adapter.go similarity index 78% rename from vendor/github.com/json-iterator/go/feature_adapter.go rename to vendor/github.com/json-iterator/go/adapter.go index 0214b711a..3a494eeb4 100644 --- a/vendor/github.com/json-iterator/go/feature_adapter.go +++ b/vendor/github.com/json-iterator/go/adapter.go @@ -16,15 +16,6 @@ func Unmarshal(data []byte, v interface{}) error { return ConfigDefault.Unmarshal(data, v) } -func lastNotSpacePos(data []byte) int { - for i := len(data) - 1; i >= 0; i-- { - if data[i] != ' ' && data[i] != '\t' && data[i] != '\r' && data[i] != '\n' { - return i + 1 - } - } - return 0 -} - // UnmarshalFromString convenient method to read from string instead of []byte func UnmarshalFromString(str string, v interface{}) error { return ConfigDefault.UnmarshalFromString(str, v) @@ -71,6 +62,11 @@ type Decoder struct { // Decode decode JSON into interface{} func (adapter *Decoder) Decode(obj interface{}) error { + if adapter.iter.head == adapter.iter.tail && adapter.iter.reader != nil { + if !adapter.iter.loadMore() { + return io.EOF + } + } adapter.iter.ReadVal(obj) err := adapter.iter.Error if err == io.EOF { @@ -90,11 +86,21 @@ func (adapter *Decoder) Buffered() io.Reader { return bytes.NewReader(remaining) } -// UseNumber for number JSON element, use float64 or json.NumberValue (alias of string) +// UseNumber causes the Decoder to unmarshal a number into an interface{} as a +// Number instead of as a float64. func (adapter *Decoder) UseNumber() { - origCfg := adapter.iter.cfg.configBeforeFrozen - origCfg.UseNumber = true - adapter.iter.cfg = origCfg.Froze().(*frozenConfig) + cfg := adapter.iter.cfg.configBeforeFrozen + cfg.UseNumber = true + adapter.iter.cfg = cfg.frozeWithCacheReuse() +} + +// DisallowUnknownFields causes the Decoder to return an error when the destination +// is a struct and the input contains object keys which do not match any +// non-ignored, exported fields in the destination. +func (adapter *Decoder) DisallowUnknownFields() { + cfg := adapter.iter.cfg.configBeforeFrozen + cfg.DisallowUnknownFields = true + adapter.iter.cfg = cfg.frozeWithCacheReuse() } // NewEncoder same as json.NewEncoder @@ -117,14 +123,16 @@ func (adapter *Encoder) Encode(val interface{}) error { // SetIndent set the indention. Prefix is not supported func (adapter *Encoder) SetIndent(prefix, indent string) { - adapter.stream.cfg.indentionStep = len(indent) + config := adapter.stream.cfg.configBeforeFrozen + config.IndentionStep = len(indent) + adapter.stream.cfg = config.frozeWithCacheReuse() } // SetEscapeHTML escape html by default, set to false to disable func (adapter *Encoder) SetEscapeHTML(escapeHTML bool) { config := adapter.stream.cfg.configBeforeFrozen config.EscapeHTML = escapeHTML - adapter.stream.cfg = config.Froze().(*frozenConfig) + adapter.stream.cfg = config.frozeWithCacheReuse() } // Valid reports whether data is a valid JSON encoding. diff --git a/vendor/github.com/json-iterator/go/feature_any.go b/vendor/github.com/json-iterator/go/any.go similarity index 75% rename from vendor/github.com/json-iterator/go/feature_any.go rename to vendor/github.com/json-iterator/go/any.go index 87716d1fc..81c30fc97 100644 --- a/vendor/github.com/json-iterator/go/feature_any.go +++ b/vendor/github.com/json-iterator/go/any.go @@ -5,6 +5,9 @@ import ( "fmt" "io" "reflect" + "unsafe" + "github.com/v2pro/plz/reflect2" + "strconv" ) // Any generic object representation. @@ -25,7 +28,6 @@ type Any interface { ToString() string ToVal(val interface{}) Get(path ...interface{}) Any - // TODO: add Set Size() int Keys() []string GetInterface() interface{} @@ -35,7 +37,7 @@ type Any interface { type baseAny struct{} func (any *baseAny) Get(path ...interface{}) Any { - return &invalidAny{baseAny{}, fmt.Errorf("Get %v from simple value", path)} + return &invalidAny{baseAny{}, fmt.Errorf("GetIndex %v from simple value", path)} } func (any *baseAny) Size() int { @@ -89,7 +91,7 @@ func Wrap(val interface{}) Any { if isAny { return asAny } - typ := reflect.TypeOf(val) + typ := reflect2.TypeOf(val) switch typ.Kind() { case reflect.Slice: return wrapArray(val) @@ -100,6 +102,9 @@ func Wrap(val interface{}) Any { case reflect.String: return WrapString(val.(string)) case reflect.Int: + if strconv.IntSize == 32 { + return WrapInt32(int32(val.(int))) + } return WrapInt64(int64(val.(int))) case reflect.Int8: return WrapInt32(int32(val.(int8))) @@ -110,7 +115,15 @@ func Wrap(val interface{}) Any { case reflect.Int64: return WrapInt64(val.(int64)) case reflect.Uint: + if strconv.IntSize == 32 { + return WrapUint32(uint32(val.(uint))) + } return WrapUint64(uint64(val.(uint))) + case reflect.Uintptr: + if ptrSize == 32 { + return WrapUint32(uint32(val.(uintptr))) + } + return WrapUint64(uint64(val.(uintptr))) case reflect.Uint8: return WrapUint32(uint32(val.(uint8))) case reflect.Uint16: @@ -243,3 +256,66 @@ func locatePath(iter *Iterator, path []interface{}) Any { } return iter.readAny() } + +var anyType = reflect2.TypeOfPtr((*Any)(nil)).Elem() + +func createDecoderOfAny(ctx *ctx, typ reflect2.Type) ValDecoder { + if typ == anyType { + return &directAnyCodec{} + } + if typ.Implements(anyType) { + return &anyCodec{ + valType: typ, + } + } + return nil +} + +func createEncoderOfAny(ctx *ctx, typ reflect2.Type) ValEncoder { + if typ == anyType { + return &directAnyCodec{} + } + if typ.Implements(anyType) { + return &anyCodec{ + valType: typ, + } + } + return nil +} + +type anyCodec struct { + valType reflect2.Type +} + +func (codec *anyCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { + panic("not implemented") +} + +func (codec *anyCodec) Encode(ptr unsafe.Pointer, stream *Stream) { + obj := codec.valType.UnsafeIndirect(ptr) + any := obj.(Any) + any.WriteTo(stream) +} + +func (codec *anyCodec) IsEmpty(ptr unsafe.Pointer) bool { + obj := codec.valType.UnsafeIndirect(ptr) + any := obj.(Any) + return any.Size() == 0 +} + +type directAnyCodec struct { +} + +func (codec *directAnyCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { + *(*Any)(ptr) = iter.readAny() +} + +func (codec *directAnyCodec) Encode(ptr unsafe.Pointer, stream *Stream) { + any := *(*Any)(ptr) + any.WriteTo(stream) +} + +func (codec *directAnyCodec) IsEmpty(ptr unsafe.Pointer) bool { + any := *(*Any)(ptr) + return any.Size() == 0 +} diff --git a/vendor/github.com/json-iterator/go/feature_any_array.go b/vendor/github.com/json-iterator/go/any_array.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_any_array.go rename to vendor/github.com/json-iterator/go/any_array.go diff --git a/vendor/github.com/json-iterator/go/feature_any_bool.go b/vendor/github.com/json-iterator/go/any_bool.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_any_bool.go rename to vendor/github.com/json-iterator/go/any_bool.go diff --git a/vendor/github.com/json-iterator/go/feature_any_float.go b/vendor/github.com/json-iterator/go/any_float.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_any_float.go rename to vendor/github.com/json-iterator/go/any_float.go diff --git a/vendor/github.com/json-iterator/go/feature_any_int32.go b/vendor/github.com/json-iterator/go/any_int32.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_any_int32.go rename to vendor/github.com/json-iterator/go/any_int32.go diff --git a/vendor/github.com/json-iterator/go/feature_any_int64.go b/vendor/github.com/json-iterator/go/any_int64.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_any_int64.go rename to vendor/github.com/json-iterator/go/any_int64.go diff --git a/vendor/github.com/json-iterator/go/feature_any_invalid.go b/vendor/github.com/json-iterator/go/any_invalid.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_any_invalid.go rename to vendor/github.com/json-iterator/go/any_invalid.go diff --git a/vendor/github.com/json-iterator/go/feature_any_nil.go b/vendor/github.com/json-iterator/go/any_nil.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_any_nil.go rename to vendor/github.com/json-iterator/go/any_nil.go diff --git a/vendor/github.com/json-iterator/go/feature_any_number.go b/vendor/github.com/json-iterator/go/any_number.go similarity index 76% rename from vendor/github.com/json-iterator/go/feature_any_number.go rename to vendor/github.com/json-iterator/go/any_number.go index 4e1c27641..9d1e901a6 100644 --- a/vendor/github.com/json-iterator/go/feature_any_number.go +++ b/vendor/github.com/json-iterator/go/any_number.go @@ -1,6 +1,9 @@ package jsoniter -import "unsafe" +import ( + "io" + "unsafe" +) type numberLazyAny struct { baseAny @@ -29,7 +32,9 @@ func (any *numberLazyAny) ToInt() int { iter := any.cfg.BorrowIterator(any.buf) defer any.cfg.ReturnIterator(iter) val := iter.ReadInt() - any.err = iter.Error + if iter.Error != nil && iter.Error != io.EOF { + any.err = iter.Error + } return val } @@ -37,7 +42,9 @@ func (any *numberLazyAny) ToInt32() int32 { iter := any.cfg.BorrowIterator(any.buf) defer any.cfg.ReturnIterator(iter) val := iter.ReadInt32() - any.err = iter.Error + if iter.Error != nil && iter.Error != io.EOF { + any.err = iter.Error + } return val } @@ -45,7 +52,9 @@ func (any *numberLazyAny) ToInt64() int64 { iter := any.cfg.BorrowIterator(any.buf) defer any.cfg.ReturnIterator(iter) val := iter.ReadInt64() - any.err = iter.Error + if iter.Error != nil && iter.Error != io.EOF { + any.err = iter.Error + } return val } @@ -53,7 +62,9 @@ func (any *numberLazyAny) ToUint() uint { iter := any.cfg.BorrowIterator(any.buf) defer any.cfg.ReturnIterator(iter) val := iter.ReadUint() - any.err = iter.Error + if iter.Error != nil && iter.Error != io.EOF { + any.err = iter.Error + } return val } @@ -61,7 +72,9 @@ func (any *numberLazyAny) ToUint32() uint32 { iter := any.cfg.BorrowIterator(any.buf) defer any.cfg.ReturnIterator(iter) val := iter.ReadUint32() - any.err = iter.Error + if iter.Error != nil && iter.Error != io.EOF { + any.err = iter.Error + } return val } @@ -69,7 +82,9 @@ func (any *numberLazyAny) ToUint64() uint64 { iter := any.cfg.BorrowIterator(any.buf) defer any.cfg.ReturnIterator(iter) val := iter.ReadUint64() - any.err = iter.Error + if iter.Error != nil && iter.Error != io.EOF { + any.err = iter.Error + } return val } @@ -77,7 +92,9 @@ func (any *numberLazyAny) ToFloat32() float32 { iter := any.cfg.BorrowIterator(any.buf) defer any.cfg.ReturnIterator(iter) val := iter.ReadFloat32() - any.err = iter.Error + if iter.Error != nil && iter.Error != io.EOF { + any.err = iter.Error + } return val } @@ -85,7 +102,9 @@ func (any *numberLazyAny) ToFloat64() float64 { iter := any.cfg.BorrowIterator(any.buf) defer any.cfg.ReturnIterator(iter) val := iter.ReadFloat64() - any.err = iter.Error + if iter.Error != nil && iter.Error != io.EOF { + any.err = iter.Error + } return val } diff --git a/vendor/github.com/json-iterator/go/feature_any_object.go b/vendor/github.com/json-iterator/go/any_object.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_any_object.go rename to vendor/github.com/json-iterator/go/any_object.go diff --git a/vendor/github.com/json-iterator/go/feature_any_string.go b/vendor/github.com/json-iterator/go/any_str.go similarity index 97% rename from vendor/github.com/json-iterator/go/feature_any_string.go rename to vendor/github.com/json-iterator/go/any_str.go index abf060bd5..a4b93c78c 100644 --- a/vendor/github.com/json-iterator/go/feature_any_string.go +++ b/vendor/github.com/json-iterator/go/any_str.go @@ -14,7 +14,7 @@ func (any *stringAny) Get(path ...interface{}) Any { if len(path) == 0 { return any } - return &invalidAny{baseAny{}, fmt.Errorf("Get %v from simple value", path)} + return &invalidAny{baseAny{}, fmt.Errorf("GetIndex %v from simple value", path)} } func (any *stringAny) Parse() *Iterator { diff --git a/vendor/github.com/json-iterator/go/feature_any_uint32.go b/vendor/github.com/json-iterator/go/any_uint32.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_any_uint32.go rename to vendor/github.com/json-iterator/go/any_uint32.go diff --git a/vendor/github.com/json-iterator/go/feature_any_uint64.go b/vendor/github.com/json-iterator/go/any_uint64.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_any_uint64.go rename to vendor/github.com/json-iterator/go/any_uint64.go diff --git a/vendor/github.com/json-iterator/go/build.sh b/vendor/github.com/json-iterator/go/build.sh new file mode 100755 index 000000000..b45ef6883 --- /dev/null +++ b/vendor/github.com/json-iterator/go/build.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -e +set -x + +if [ ! -d /tmp/build-golang/src/github.com/json-iterator ]; then + mkdir -p /tmp/build-golang/src/github.com/json-iterator + ln -s $PWD /tmp/build-golang/src/github.com/json-iterator/go +fi +export GOPATH=/tmp/build-golang +go get -u github.com/golang/dep/cmd/dep +cd /tmp/build-golang/src/github.com/json-iterator/go +exec $GOPATH/bin/dep ensure -update diff --git a/vendor/github.com/json-iterator/go/compatible_test.go b/vendor/github.com/json-iterator/go/compatible_test.go deleted file mode 100644 index 4b725c536..000000000 --- a/vendor/github.com/json-iterator/go/compatible_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package jsoniter - -import ( - "bytes" - "encoding/json" - "testing" - - "github.com/stretchr/testify/require" -) - -// Standard Encoder has trailing newline. -func TestEncoderHasTrailingNewline(t *testing.T) { - should := require.New(t) - var buf, stdbuf bytes.Buffer - enc := ConfigCompatibleWithStandardLibrary.NewEncoder(&buf) - enc.Encode(1) - stdenc := json.NewEncoder(&stdbuf) - stdenc.Encode(1) - should.Equal(stdbuf.Bytes(), buf.Bytes()) -} - -// Non-nil but empty map should be ignored. -func TestOmitempty(t *testing.T) { - o := struct { - A string `json:"a,omitempty"` - B string `json:"b,omitempty"` - Annotations map[string]string `json:"annotations,omitempty"` - }{ - A: "a", - B: "b", - Annotations: map[string]string{}, - } - should := require.New(t) - var buf, stdbuf bytes.Buffer - enc := ConfigCompatibleWithStandardLibrary.NewEncoder(&buf) - enc.Encode(o) - stdenc := json.NewEncoder(&stdbuf) - stdenc.Encode(o) - should.Equal(string(stdbuf.Bytes()), string(buf.Bytes())) -} diff --git a/vendor/github.com/json-iterator/go/feature_config.go b/vendor/github.com/json-iterator/go/config.go similarity index 59% rename from vendor/github.com/json-iterator/go/feature_config.go rename to vendor/github.com/json-iterator/go/config.go index 140679536..aa4af6386 100644 --- a/vendor/github.com/json-iterator/go/feature_config.go +++ b/vendor/github.com/json-iterator/go/config.go @@ -2,11 +2,10 @@ package jsoniter import ( "encoding/json" - "errors" "io" - "reflect" - "sync/atomic" "unsafe" + "github.com/v2pro/plz/reflect2" + "sync" ) // Config customize how the API should behave. @@ -17,23 +16,13 @@ type Config struct { EscapeHTML bool SortMapKeys bool UseNumber bool + DisallowUnknownFields bool TagKey string + OnlyTaggedField bool ValidateJsonRawMessage bool ObjectFieldMustBeSimpleString bool } -type frozenConfig struct { - configBeforeFrozen Config - sortMapKeys bool - indentionStep int - objectFieldMustBeSimpleString bool - decoderCache unsafe.Pointer - encoderCache unsafe.Pointer - extensions []Extension - streamPool chan *Stream - iteratorPool chan *Iterator -} - // API the public interface of this package. // Primary Marshal and Unmarshal. type API interface { @@ -48,6 +37,7 @@ type API interface { NewEncoder(writer io.Writer) *Encoder NewDecoder(reader io.Reader) *Decoder Valid(data []byte) bool + RegisterExtension(extension Extension) } // ConfigDefault the default API @@ -71,33 +61,59 @@ var ConfigFastest = Config{ // Froze forge API from config func (cfg Config) Froze() API { - // TODO: cache frozen config - frozenConfig := &frozenConfig{ + api := &frozenConfig{ sortMapKeys: cfg.SortMapKeys, indentionStep: cfg.IndentionStep, objectFieldMustBeSimpleString: cfg.ObjectFieldMustBeSimpleString, - streamPool: make(chan *Stream, 16), - iteratorPool: make(chan *Iterator, 16), + onlyTaggedField: cfg.OnlyTaggedField, + disallowUnknownFields: cfg.DisallowUnknownFields, } - atomic.StorePointer(&frozenConfig.decoderCache, unsafe.Pointer(&map[string]ValDecoder{})) - atomic.StorePointer(&frozenConfig.encoderCache, unsafe.Pointer(&map[string]ValEncoder{})) + api.streamPool = &sync.Pool{ + New: func() interface{} { + return NewStream(api, nil, 512) + }, + } + api.iteratorPool = &sync.Pool{ + New: func() interface{} { + return NewIterator(api) + }, + } + api.initCache() + encoderExtension := EncoderExtension{} + decoderExtension := DecoderExtension{} if cfg.MarshalFloatWith6Digits { - frozenConfig.marshalFloatWith6Digits() + api.marshalFloatWith6Digits(encoderExtension) } if cfg.EscapeHTML { - frozenConfig.escapeHTML() + api.escapeHTML(encoderExtension) } if cfg.UseNumber { - frozenConfig.useNumber() + api.useNumber(decoderExtension) } if cfg.ValidateJsonRawMessage { - frozenConfig.validateJsonRawMessage() + api.validateJsonRawMessage(encoderExtension) } - frozenConfig.configBeforeFrozen = cfg - return frozenConfig + if len(encoderExtension) > 0 { + api.extensions = append(api.extensions, encoderExtension) + } + if len(decoderExtension) > 0 { + api.extensions = append(api.extensions, decoderExtension) + } + api.configBeforeFrozen = cfg + return api } -func (cfg *frozenConfig) validateJsonRawMessage() { +func (cfg Config) frozeWithCacheReuse() *frozenConfig { + api := getFrozenConfigFromCache(cfg) + if api != nil { + return api + } + api = cfg.Froze().(*frozenConfig) + addFrozenConfigToCache(cfg, api) + return api +} + +func (cfg *frozenConfig) validateJsonRawMessage(extension EncoderExtension) { encoder := &funcEncoder{func(ptr unsafe.Pointer, stream *Stream) { rawMessage := *(*json.RawMessage)(ptr) iter := cfg.BorrowIterator([]byte(rawMessage)) @@ -111,18 +127,18 @@ func (cfg *frozenConfig) validateJsonRawMessage() { }, func(ptr unsafe.Pointer) bool { return false }} - cfg.addEncoderToCache(reflect.TypeOf((*json.RawMessage)(nil)).Elem(), encoder) - cfg.addEncoderToCache(reflect.TypeOf((*RawMessage)(nil)).Elem(), encoder) + extension[reflect2.TypeOfPtr((*json.RawMessage)(nil)).Elem()] = encoder + extension[reflect2.TypeOfPtr((*RawMessage)(nil)).Elem()] = encoder } -func (cfg *frozenConfig) useNumber() { - cfg.addDecoderToCache(reflect.TypeOf((*interface{})(nil)).Elem(), &funcDecoder{func(ptr unsafe.Pointer, iter *Iterator) { +func (cfg *frozenConfig) useNumber(extension DecoderExtension) { + extension[reflect2.TypeOfPtr((*interface{})(nil)).Elem()] = &funcDecoder{func(ptr unsafe.Pointer, iter *Iterator) { if iter.WhatIsNext() == NumberValue { *((*interface{})(ptr)) = json.Number(iter.readNumberAsString()) } else { *((*interface{})(ptr)) = iter.Read() } - }}) + }} } func (cfg *frozenConfig) getTagKey() string { tagKey := cfg.configBeforeFrozen.TagKey @@ -132,7 +148,7 @@ func (cfg *frozenConfig) getTagKey() string { return tagKey } -func (cfg *frozenConfig) registerExtension(extension Extension) { +func (cfg *frozenConfig) RegisterExtension(extension Extension) { cfg.extensions = append(cfg.extensions, extension) } @@ -143,10 +159,6 @@ func (encoder *lossyFloat32Encoder) Encode(ptr unsafe.Pointer, stream *Stream) { stream.WriteFloat32Lossy(*((*float32)(ptr))) } -func (encoder *lossyFloat32Encoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - func (encoder *lossyFloat32Encoder) IsEmpty(ptr unsafe.Pointer) bool { return *((*float32)(ptr)) == 0 } @@ -158,20 +170,16 @@ func (encoder *lossyFloat64Encoder) Encode(ptr unsafe.Pointer, stream *Stream) { stream.WriteFloat64Lossy(*((*float64)(ptr))) } -func (encoder *lossyFloat64Encoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - func (encoder *lossyFloat64Encoder) IsEmpty(ptr unsafe.Pointer) bool { return *((*float64)(ptr)) == 0 } // EnableLossyFloatMarshalling keeps 10**(-6) precision // for float variables for better performance. -func (cfg *frozenConfig) marshalFloatWith6Digits() { +func (cfg *frozenConfig) marshalFloatWith6Digits(extension EncoderExtension) { // for better performance - cfg.addEncoderToCache(reflect.TypeOf((*float32)(nil)).Elem(), &lossyFloat32Encoder{}) - cfg.addEncoderToCache(reflect.TypeOf((*float64)(nil)).Elem(), &lossyFloat64Encoder{}) + extension[reflect2.TypeOfPtr((*float32)(nil)).Elem()] = &lossyFloat32Encoder{} + extension[reflect2.TypeOfPtr((*float64)(nil)).Elem()] = &lossyFloat64Encoder{} } type htmlEscapedStringEncoder struct { @@ -182,56 +190,12 @@ func (encoder *htmlEscapedStringEncoder) Encode(ptr unsafe.Pointer, stream *Stre stream.WriteStringWithHTMLEscaped(str) } -func (encoder *htmlEscapedStringEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - func (encoder *htmlEscapedStringEncoder) IsEmpty(ptr unsafe.Pointer) bool { return *((*string)(ptr)) == "" } -func (cfg *frozenConfig) escapeHTML() { - cfg.addEncoderToCache(reflect.TypeOf((*string)(nil)).Elem(), &htmlEscapedStringEncoder{}) -} - -func (cfg *frozenConfig) addDecoderToCache(cacheKey reflect.Type, decoder ValDecoder) { - done := false - for !done { - ptr := atomic.LoadPointer(&cfg.decoderCache) - cache := *(*map[reflect.Type]ValDecoder)(ptr) - copied := map[reflect.Type]ValDecoder{} - for k, v := range cache { - copied[k] = v - } - copied[cacheKey] = decoder - done = atomic.CompareAndSwapPointer(&cfg.decoderCache, ptr, unsafe.Pointer(&copied)) - } -} - -func (cfg *frozenConfig) addEncoderToCache(cacheKey reflect.Type, encoder ValEncoder) { - done := false - for !done { - ptr := atomic.LoadPointer(&cfg.encoderCache) - cache := *(*map[reflect.Type]ValEncoder)(ptr) - copied := map[reflect.Type]ValEncoder{} - for k, v := range cache { - copied[k] = v - } - copied[cacheKey] = encoder - done = atomic.CompareAndSwapPointer(&cfg.encoderCache, ptr, unsafe.Pointer(&copied)) - } -} - -func (cfg *frozenConfig) getDecoderFromCache(cacheKey reflect.Type) ValDecoder { - ptr := atomic.LoadPointer(&cfg.decoderCache) - cache := *(*map[reflect.Type]ValDecoder)(ptr) - return cache[cacheKey] -} - -func (cfg *frozenConfig) getEncoderFromCache(cacheKey reflect.Type) ValEncoder { - ptr := atomic.LoadPointer(&cfg.encoderCache) - cache := *(*map[reflect.Type]ValEncoder)(ptr) - return cache[cacheKey] +func (cfg *frozenConfig) escapeHTML(encoderExtension EncoderExtension) { + encoderExtension[reflect2.TypeOfPtr((*string)(nil)).Elem()] = &htmlEscapedStringEncoder{} } func (cfg *frozenConfig) cleanDecoders() { @@ -280,24 +244,22 @@ func (cfg *frozenConfig) MarshalIndent(v interface{}, prefix, indent string) ([] } newCfg := cfg.configBeforeFrozen newCfg.IndentionStep = len(indent) - return newCfg.Froze().Marshal(v) + return newCfg.frozeWithCacheReuse().Marshal(v) } func (cfg *frozenConfig) UnmarshalFromString(str string, v interface{}) error { data := []byte(str) - data = data[:lastNotSpacePos(data)] iter := cfg.BorrowIterator(data) defer cfg.ReturnIterator(iter) iter.ReadVal(v) - if iter.head == iter.tail { - iter.loadMore() - } - if iter.Error == io.EOF { - return nil - } - if iter.Error == nil { - iter.ReportError("UnmarshalFromString", "there are bytes left after unmarshal") + c := iter.nextToken() + if c == 0 { + if iter.Error == io.EOF { + return nil + } + return iter.Error } + iter.ReportError("Unmarshal", "there are bytes left after unmarshal") return iter.Error } @@ -308,24 +270,17 @@ func (cfg *frozenConfig) Get(data []byte, path ...interface{}) Any { } func (cfg *frozenConfig) Unmarshal(data []byte, v interface{}) error { - data = data[:lastNotSpacePos(data)] iter := cfg.BorrowIterator(data) defer cfg.ReturnIterator(iter) - typ := reflect.TypeOf(v) - if typ.Kind() != reflect.Ptr { - // return non-pointer error - return errors.New("the second param must be ptr type") - } iter.ReadVal(v) - if iter.head == iter.tail { - iter.loadMore() - } - if iter.Error == io.EOF { - return nil - } - if iter.Error == nil { - iter.ReportError("Unmarshal", "there are bytes left after unmarshal") + c := iter.nextToken() + if c == 0 { + if iter.Error == io.EOF { + return nil + } + return iter.Error } + iter.ReportError("Unmarshal", "there are bytes left after unmarshal") return iter.Error } diff --git a/vendor/github.com/json-iterator/go/config_with_sync_map.go b/vendor/github.com/json-iterator/go/config_with_sync_map.go new file mode 100644 index 000000000..7f14812c3 --- /dev/null +++ b/vendor/github.com/json-iterator/go/config_with_sync_map.go @@ -0,0 +1,64 @@ +//+build go1.9 + +package jsoniter + +import ( + "sync" +) + +type frozenConfig struct { + configBeforeFrozen Config + sortMapKeys bool + indentionStep int + objectFieldMustBeSimpleString bool + onlyTaggedField bool + disallowUnknownFields bool + decoderCache sync.Map + encoderCache sync.Map + extensions []Extension + streamPool *sync.Pool + iteratorPool *sync.Pool +} + +func (cfg *frozenConfig) initCache() { + cfg.decoderCache = sync.Map{} + cfg.encoderCache = sync.Map{} +} + +func (cfg *frozenConfig) addDecoderToCache(cacheKey uintptr, decoder ValDecoder) { + cfg.decoderCache.Store(cacheKey, decoder) +} + +func (cfg *frozenConfig) addEncoderToCache(cacheKey uintptr, encoder ValEncoder) { + cfg.encoderCache.Store(cacheKey, encoder) +} + +func (cfg *frozenConfig) getDecoderFromCache(cacheKey uintptr) ValDecoder { + decoder, found := cfg.decoderCache.Load(cacheKey) + if found { + return decoder.(ValDecoder) + } + return nil +} + +func (cfg *frozenConfig) getEncoderFromCache(cacheKey uintptr) ValEncoder { + encoder, found := cfg.encoderCache.Load(cacheKey) + if found { + return encoder.(ValEncoder) + } + return nil +} + +var cfgCache = &sync.Map{} + +func getFrozenConfigFromCache(cfg Config) *frozenConfig { + obj, found := cfgCache.Load(cfg) + if found { + return obj.(*frozenConfig) + } + return nil +} + +func addFrozenConfigToCache(cfg Config, frozenConfig *frozenConfig) { + cfgCache.Store(cfg, frozenConfig) +} diff --git a/vendor/github.com/json-iterator/go/config_without_sync_map.go b/vendor/github.com/json-iterator/go/config_without_sync_map.go new file mode 100644 index 000000000..5906cd550 --- /dev/null +++ b/vendor/github.com/json-iterator/go/config_without_sync_map.go @@ -0,0 +1,70 @@ +//+build !go1.9 + +package jsoniter + +import ( + "sync" +) + +type frozenConfig struct { + configBeforeFrozen Config + sortMapKeys bool + indentionStep int + objectFieldMustBeSimpleString bool + onlyTaggedField bool + disallowUnknownFields bool + cacheLock *sync.RWMutex + decoderCache map[uintptr]ValDecoder + encoderCache map[uintptr]ValEncoder + extensions []Extension + streamPool *sync.Pool + iteratorPool *sync.Pool +} + +func (cfg *frozenConfig) initCache() { + cfg.cacheLock = &sync.RWMutex{} + cfg.decoderCache = map[uintptr]ValDecoder{} + cfg.encoderCache = map[uintptr]ValEncoder{} +} + +func (cfg *frozenConfig) addDecoderToCache(cacheKey uintptr, decoder ValDecoder) { + cfg.cacheLock.Lock() + cfg.decoderCache[cacheKey] = decoder + cfg.cacheLock.Unlock() +} + +func (cfg *frozenConfig) addEncoderToCache(cacheKey uintptr, encoder ValEncoder) { + cfg.cacheLock.Lock() + cfg.encoderCache[cacheKey] = encoder + cfg.cacheLock.Unlock() +} + +func (cfg *frozenConfig) getDecoderFromCache(cacheKey uintptr) ValDecoder { + cfg.cacheLock.RLock() + decoder, _ := cfg.decoderCache[cacheKey].(ValDecoder) + cfg.cacheLock.RUnlock() + return decoder +} + +func (cfg *frozenConfig) getEncoderFromCache(cacheKey uintptr) ValEncoder { + cfg.cacheLock.RLock() + encoder, _ := cfg.encoderCache[cacheKey].(ValEncoder) + cfg.cacheLock.RUnlock() + return encoder +} + +var cfgCacheLock = &sync.RWMutex{} +var cfgCache = map[Config]*frozenConfig{} + +func getFrozenConfigFromCache(cfg Config) *frozenConfig { + cfgCacheLock.RLock() + frozenConfig := cfgCache[cfg] + cfgCacheLock.RUnlock() + return frozenConfig +} + +func addFrozenConfigToCache(cfg Config, frozenConfig *frozenConfig) { + cfgCacheLock.Lock() + cfgCache[cfg] = frozenConfig + cfgCacheLock.Unlock() +} diff --git a/vendor/github.com/json-iterator/go/feature_json_number.go b/vendor/github.com/json-iterator/go/feature_json_number.go deleted file mode 100644 index e187b200a..000000000 --- a/vendor/github.com/json-iterator/go/feature_json_number.go +++ /dev/null @@ -1,31 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "strconv" -) - -type Number string - -// String returns the literal text of the number. -func (n Number) String() string { return string(n) } - -// Float64 returns the number as a float64. -func (n Number) Float64() (float64, error) { - return strconv.ParseFloat(string(n), 64) -} - -// Int64 returns the number as an int64. -func (n Number) Int64() (int64, error) { - return strconv.ParseInt(string(n), 10, 64) -} - -func CastJsonNumber(val interface{}) (string, bool) { - switch typedVal := val.(type) { - case json.Number: - return string(typedVal), true - case Number: - return string(typedVal), true - } - return "", false -} diff --git a/vendor/github.com/json-iterator/go/feature_reflect.go b/vendor/github.com/json-iterator/go/feature_reflect.go deleted file mode 100644 index 1bd8987f2..000000000 --- a/vendor/github.com/json-iterator/go/feature_reflect.go +++ /dev/null @@ -1,721 +0,0 @@ -package jsoniter - -import ( - "encoding" - "encoding/json" - "fmt" - "reflect" - "time" - "unsafe" -) - -// ValDecoder is an internal type registered to cache as needed. -// Don't confuse jsoniter.ValDecoder with json.Decoder. -// For json.Decoder's adapter, refer to jsoniter.AdapterDecoder(todo link). -// -// Reflection on type to create decoders, which is then cached -// Reflection on value is avoided as we can, as the reflect.Value itself will allocate, with following exceptions -// 1. create instance of new value, for example *int will need a int to be allocated -// 2. append to slice, if the existing cap is not enough, allocate will be done using Reflect.New -// 3. assignment to map, both key and value will be reflect.Value -// For a simple struct binding, it will be reflect.Value free and allocation free -type ValDecoder interface { - Decode(ptr unsafe.Pointer, iter *Iterator) -} - -// ValEncoder is an internal type registered to cache as needed. -// Don't confuse jsoniter.ValEncoder with json.Encoder. -// For json.Encoder's adapter, refer to jsoniter.AdapterEncoder(todo godoc link). -type ValEncoder interface { - IsEmpty(ptr unsafe.Pointer) bool - Encode(ptr unsafe.Pointer, stream *Stream) - EncodeInterface(val interface{}, stream *Stream) -} - -type checkIsEmpty interface { - IsEmpty(ptr unsafe.Pointer) bool -} - -// WriteToStream the default implementation for TypeEncoder method EncodeInterface -func WriteToStream(val interface{}, stream *Stream, encoder ValEncoder) { - e := (*emptyInterface)(unsafe.Pointer(&val)) - if e.word == nil { - stream.WriteNil() - return - } - if reflect.TypeOf(val).Kind() == reflect.Ptr { - encoder.Encode(unsafe.Pointer(&e.word), stream) - } else { - encoder.Encode(e.word, stream) - } -} - -var jsonNumberType reflect.Type -var jsoniterNumberType reflect.Type -var jsonRawMessageType reflect.Type -var jsoniterRawMessageType reflect.Type -var anyType reflect.Type -var marshalerType reflect.Type -var unmarshalerType reflect.Type -var textMarshalerType reflect.Type -var textUnmarshalerType reflect.Type - -func init() { - jsonNumberType = reflect.TypeOf((*json.Number)(nil)).Elem() - jsoniterNumberType = reflect.TypeOf((*Number)(nil)).Elem() - jsonRawMessageType = reflect.TypeOf((*json.RawMessage)(nil)).Elem() - jsoniterRawMessageType = reflect.TypeOf((*RawMessage)(nil)).Elem() - anyType = reflect.TypeOf((*Any)(nil)).Elem() - marshalerType = reflect.TypeOf((*json.Marshaler)(nil)).Elem() - unmarshalerType = reflect.TypeOf((*json.Unmarshaler)(nil)).Elem() - textMarshalerType = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem() - textUnmarshalerType = reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem() -} - -type OptionalDecoder struct { - ValueType reflect.Type - ValueDecoder ValDecoder -} - -func (decoder *OptionalDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if iter.ReadNil() { - *((*unsafe.Pointer)(ptr)) = nil - } else { - if *((*unsafe.Pointer)(ptr)) == nil { - //pointer to null, we have to allocate memory to hold the value - value := reflect.New(decoder.ValueType) - newPtr := extractInterface(value.Interface()).word - decoder.ValueDecoder.Decode(newPtr, iter) - *((*uintptr)(ptr)) = uintptr(newPtr) - } else { - //reuse existing instance - decoder.ValueDecoder.Decode(*((*unsafe.Pointer)(ptr)), iter) - } - } -} - -type deferenceDecoder struct { - // only to deference a pointer - valueType reflect.Type - valueDecoder ValDecoder -} - -func (decoder *deferenceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - if *((*unsafe.Pointer)(ptr)) == nil { - //pointer to null, we have to allocate memory to hold the value - value := reflect.New(decoder.valueType) - newPtr := extractInterface(value.Interface()).word - decoder.valueDecoder.Decode(newPtr, iter) - *((*uintptr)(ptr)) = uintptr(newPtr) - } else { - //reuse existing instance - decoder.valueDecoder.Decode(*((*unsafe.Pointer)(ptr)), iter) - } -} - -type OptionalEncoder struct { - ValueEncoder ValEncoder -} - -func (encoder *OptionalEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - if *((*unsafe.Pointer)(ptr)) == nil { - stream.WriteNil() - } else { - encoder.ValueEncoder.Encode(*((*unsafe.Pointer)(ptr)), stream) - } -} - -func (encoder *OptionalEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - -func (encoder *OptionalEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return *((*unsafe.Pointer)(ptr)) == nil -} - -type optionalMapEncoder struct { - valueEncoder ValEncoder -} - -func (encoder *optionalMapEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - if *((*unsafe.Pointer)(ptr)) == nil { - stream.WriteNil() - } else { - encoder.valueEncoder.Encode(*((*unsafe.Pointer)(ptr)), stream) - } -} - -func (encoder *optionalMapEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - -func (encoder *optionalMapEncoder) IsEmpty(ptr unsafe.Pointer) bool { - p := *((*unsafe.Pointer)(ptr)) - return p == nil || encoder.valueEncoder.IsEmpty(p) -} - -type placeholderEncoder struct { - cfg *frozenConfig - cacheKey reflect.Type -} - -func (encoder *placeholderEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - encoder.getRealEncoder().Encode(ptr, stream) -} - -func (encoder *placeholderEncoder) EncodeInterface(val interface{}, stream *Stream) { - encoder.getRealEncoder().EncodeInterface(val, stream) -} - -func (encoder *placeholderEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.getRealEncoder().IsEmpty(ptr) -} - -func (encoder *placeholderEncoder) getRealEncoder() ValEncoder { - for i := 0; i < 500; i++ { - realDecoder := encoder.cfg.getEncoderFromCache(encoder.cacheKey) - _, isPlaceholder := realDecoder.(*placeholderEncoder) - if isPlaceholder { - time.Sleep(10 * time.Millisecond) - } else { - return realDecoder - } - } - panic(fmt.Sprintf("real encoder not found for cache key: %v", encoder.cacheKey)) -} - -type placeholderDecoder struct { - cfg *frozenConfig - cacheKey reflect.Type -} - -func (decoder *placeholderDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - for i := 0; i < 500; i++ { - realDecoder := decoder.cfg.getDecoderFromCache(decoder.cacheKey) - _, isPlaceholder := realDecoder.(*placeholderDecoder) - if isPlaceholder { - time.Sleep(10 * time.Millisecond) - } else { - realDecoder.Decode(ptr, iter) - return - } - } - panic(fmt.Sprintf("real decoder not found for cache key: %v", decoder.cacheKey)) -} - -// emptyInterface is the header for an interface{} value. -type emptyInterface struct { - typ unsafe.Pointer - word unsafe.Pointer -} - -// emptyInterface is the header for an interface with method (not interface{}) -type nonEmptyInterface struct { - // see ../runtime/iface.go:/Itab - itab *struct { - ityp unsafe.Pointer // static interface type - typ unsafe.Pointer // dynamic concrete type - link unsafe.Pointer - bad int32 - unused int32 - fun [100000]unsafe.Pointer // method table - } - word unsafe.Pointer -} - -// ReadVal copy the underlying JSON into go interface, same as json.Unmarshal -func (iter *Iterator) ReadVal(obj interface{}) { - typ := reflect.TypeOf(obj) - cacheKey := typ.Elem() - decoder, err := decoderOfType(iter.cfg, cacheKey) - if err != nil { - iter.Error = err - return - } - e := (*emptyInterface)(unsafe.Pointer(&obj)) - decoder.Decode(e.word, iter) -} - -// WriteVal copy the go interface into underlying JSON, same as json.Marshal -func (stream *Stream) WriteVal(val interface{}) { - if nil == val { - stream.WriteNil() - return - } - typ := reflect.TypeOf(val) - cacheKey := typ - encoder, err := encoderOfType(stream.cfg, cacheKey) - if err != nil { - stream.Error = err - return - } - encoder.EncodeInterface(val, stream) -} - -type prefix string - -func (p prefix) addToDecoder(decoder ValDecoder, err error) (ValDecoder, error) { - if err != nil { - return nil, fmt.Errorf("%s: %s", p, err.Error()) - } - return decoder, err -} - -func (p prefix) addToEncoder(encoder ValEncoder, err error) (ValEncoder, error) { - if err != nil { - return nil, fmt.Errorf("%s: %s", p, err.Error()) - } - return encoder, err -} - -func decoderOfType(cfg *frozenConfig, typ reflect.Type) (ValDecoder, error) { - cacheKey := typ - decoder := cfg.getDecoderFromCache(cacheKey) - if decoder != nil { - return decoder, nil - } - decoder = getTypeDecoderFromExtension(typ) - if decoder != nil { - cfg.addDecoderToCache(cacheKey, decoder) - return decoder, nil - } - decoder = &placeholderDecoder{cfg: cfg, cacheKey: cacheKey} - cfg.addDecoderToCache(cacheKey, decoder) - decoder, err := createDecoderOfType(cfg, typ) - for _, extension := range extensions { - decoder = extension.DecorateDecoder(typ, decoder) - } - cfg.addDecoderToCache(cacheKey, decoder) - return decoder, err -} - -func createDecoderOfType(cfg *frozenConfig, typ reflect.Type) (ValDecoder, error) { - typeName := typ.String() - if typ == jsonRawMessageType { - return &jsonRawMessageCodec{}, nil - } - if typ == jsoniterRawMessageType { - return &jsoniterRawMessageCodec{}, nil - } - if typ.AssignableTo(jsonNumberType) { - return &jsonNumberCodec{}, nil - } - if typ.AssignableTo(jsoniterNumberType) { - return &jsoniterNumberCodec{}, nil - } - if typ.Implements(unmarshalerType) { - templateInterface := reflect.New(typ).Elem().Interface() - var decoder ValDecoder = &unmarshalerDecoder{extractInterface(templateInterface)} - if typ.Kind() == reflect.Ptr { - decoder = &OptionalDecoder{typ.Elem(), decoder} - } - return decoder, nil - } - if reflect.PtrTo(typ).Implements(unmarshalerType) { - templateInterface := reflect.New(typ).Interface() - var decoder ValDecoder = &unmarshalerDecoder{extractInterface(templateInterface)} - return decoder, nil - } - if typ.Implements(textUnmarshalerType) { - templateInterface := reflect.New(typ).Elem().Interface() - var decoder ValDecoder = &textUnmarshalerDecoder{extractInterface(templateInterface)} - if typ.Kind() == reflect.Ptr { - decoder = &OptionalDecoder{typ.Elem(), decoder} - } - return decoder, nil - } - if reflect.PtrTo(typ).Implements(textUnmarshalerType) { - templateInterface := reflect.New(typ).Interface() - var decoder ValDecoder = &textUnmarshalerDecoder{extractInterface(templateInterface)} - return decoder, nil - } - if typ.Kind() == reflect.Slice && typ.Elem().Kind() == reflect.Uint8 { - sliceDecoder, err := prefix("[slice]").addToDecoder(decoderOfSlice(cfg, typ)) - if err != nil { - return nil, err - } - return &base64Codec{sliceDecoder: sliceDecoder}, nil - } - if typ.Implements(anyType) { - return &anyCodec{}, nil - } - switch typ.Kind() { - case reflect.String: - if typeName != "string" { - return decoderOfType(cfg, reflect.TypeOf((*string)(nil)).Elem()) - } - return &stringCodec{}, nil - case reflect.Int: - if typeName != "int" { - return decoderOfType(cfg, reflect.TypeOf((*int)(nil)).Elem()) - } - return &intCodec{}, nil - case reflect.Int8: - if typeName != "int8" { - return decoderOfType(cfg, reflect.TypeOf((*int8)(nil)).Elem()) - } - return &int8Codec{}, nil - case reflect.Int16: - if typeName != "int16" { - return decoderOfType(cfg, reflect.TypeOf((*int16)(nil)).Elem()) - } - return &int16Codec{}, nil - case reflect.Int32: - if typeName != "int32" { - return decoderOfType(cfg, reflect.TypeOf((*int32)(nil)).Elem()) - } - return &int32Codec{}, nil - case reflect.Int64: - if typeName != "int64" { - return decoderOfType(cfg, reflect.TypeOf((*int64)(nil)).Elem()) - } - return &int64Codec{}, nil - case reflect.Uint: - if typeName != "uint" { - return decoderOfType(cfg, reflect.TypeOf((*uint)(nil)).Elem()) - } - return &uintCodec{}, nil - case reflect.Uint8: - if typeName != "uint8" { - return decoderOfType(cfg, reflect.TypeOf((*uint8)(nil)).Elem()) - } - return &uint8Codec{}, nil - case reflect.Uint16: - if typeName != "uint16" { - return decoderOfType(cfg, reflect.TypeOf((*uint16)(nil)).Elem()) - } - return &uint16Codec{}, nil - case reflect.Uint32: - if typeName != "uint32" { - return decoderOfType(cfg, reflect.TypeOf((*uint32)(nil)).Elem()) - } - return &uint32Codec{}, nil - case reflect.Uintptr: - if typeName != "uintptr" { - return decoderOfType(cfg, reflect.TypeOf((*uintptr)(nil)).Elem()) - } - return &uintptrCodec{}, nil - case reflect.Uint64: - if typeName != "uint64" { - return decoderOfType(cfg, reflect.TypeOf((*uint64)(nil)).Elem()) - } - return &uint64Codec{}, nil - case reflect.Float32: - if typeName != "float32" { - return decoderOfType(cfg, reflect.TypeOf((*float32)(nil)).Elem()) - } - return &float32Codec{}, nil - case reflect.Float64: - if typeName != "float64" { - return decoderOfType(cfg, reflect.TypeOf((*float64)(nil)).Elem()) - } - return &float64Codec{}, nil - case reflect.Bool: - if typeName != "bool" { - return decoderOfType(cfg, reflect.TypeOf((*bool)(nil)).Elem()) - } - return &boolCodec{}, nil - case reflect.Interface: - if typ.NumMethod() == 0 { - return &emptyInterfaceCodec{}, nil - } - return &nonEmptyInterfaceCodec{}, nil - case reflect.Struct: - return prefix(fmt.Sprintf("[%s]", typeName)).addToDecoder(decoderOfStruct(cfg, typ)) - case reflect.Array: - return prefix("[array]").addToDecoder(decoderOfArray(cfg, typ)) - case reflect.Slice: - return prefix("[slice]").addToDecoder(decoderOfSlice(cfg, typ)) - case reflect.Map: - return prefix("[map]").addToDecoder(decoderOfMap(cfg, typ)) - case reflect.Ptr: - return prefix("[optional]").addToDecoder(decoderOfOptional(cfg, typ)) - default: - return nil, fmt.Errorf("unsupported type: %v", typ) - } -} - -func encoderOfType(cfg *frozenConfig, typ reflect.Type) (ValEncoder, error) { - cacheKey := typ - encoder := cfg.getEncoderFromCache(cacheKey) - if encoder != nil { - return encoder, nil - } - encoder = getTypeEncoderFromExtension(typ) - if encoder != nil { - cfg.addEncoderToCache(cacheKey, encoder) - return encoder, nil - } - encoder = &placeholderEncoder{cfg: cfg, cacheKey: cacheKey} - cfg.addEncoderToCache(cacheKey, encoder) - encoder, err := createEncoderOfType(cfg, typ) - for _, extension := range extensions { - encoder = extension.DecorateEncoder(typ, encoder) - } - cfg.addEncoderToCache(cacheKey, encoder) - return encoder, err -} - -func createEncoderOfType(cfg *frozenConfig, typ reflect.Type) (ValEncoder, error) { - if typ == jsonRawMessageType { - return &jsonRawMessageCodec{}, nil - } - if typ == jsoniterRawMessageType { - return &jsoniterRawMessageCodec{}, nil - } - if typ.AssignableTo(jsonNumberType) { - return &jsonNumberCodec{}, nil - } - if typ.AssignableTo(jsoniterNumberType) { - return &jsoniterNumberCodec{}, nil - } - if typ.Implements(marshalerType) { - checkIsEmpty, err := createCheckIsEmpty(typ) - if err != nil { - return nil, err - } - templateInterface := reflect.New(typ).Elem().Interface() - var encoder ValEncoder = &marshalerEncoder{ - templateInterface: extractInterface(templateInterface), - checkIsEmpty: checkIsEmpty, - } - if typ.Kind() == reflect.Ptr { - encoder = &OptionalEncoder{encoder} - } - return encoder, nil - } - if reflect.PtrTo(typ).Implements(marshalerType) { - checkIsEmpty, err := createCheckIsEmpty(reflect.PtrTo(typ)) - if err != nil { - return nil, err - } - templateInterface := reflect.New(typ).Interface() - var encoder ValEncoder = &marshalerEncoder{ - templateInterface: extractInterface(templateInterface), - checkIsEmpty: checkIsEmpty, - } - return encoder, nil - } - if typ.Implements(textMarshalerType) { - checkIsEmpty, err := createCheckIsEmpty(typ) - if err != nil { - return nil, err - } - templateInterface := reflect.New(typ).Elem().Interface() - var encoder ValEncoder = &textMarshalerEncoder{ - templateInterface: extractInterface(templateInterface), - checkIsEmpty: checkIsEmpty, - } - if typ.Kind() == reflect.Ptr { - encoder = &OptionalEncoder{encoder} - } - return encoder, nil - } - if typ.Kind() == reflect.Slice && typ.Elem().Kind() == reflect.Uint8 { - return &base64Codec{}, nil - } - if typ.Implements(anyType) { - return &anyCodec{}, nil - } - return createEncoderOfSimpleType(cfg, typ) -} - -func createCheckIsEmpty(typ reflect.Type) (checkIsEmpty, error) { - kind := typ.Kind() - switch kind { - case reflect.String: - return &stringCodec{}, nil - case reflect.Int: - return &intCodec{}, nil - case reflect.Int8: - return &int8Codec{}, nil - case reflect.Int16: - return &int16Codec{}, nil - case reflect.Int32: - return &int32Codec{}, nil - case reflect.Int64: - return &int64Codec{}, nil - case reflect.Uint: - return &uintCodec{}, nil - case reflect.Uint8: - return &uint8Codec{}, nil - case reflect.Uint16: - return &uint16Codec{}, nil - case reflect.Uint32: - return &uint32Codec{}, nil - case reflect.Uintptr: - return &uintptrCodec{}, nil - case reflect.Uint64: - return &uint64Codec{}, nil - case reflect.Float32: - return &float32Codec{}, nil - case reflect.Float64: - return &float64Codec{}, nil - case reflect.Bool: - return &boolCodec{}, nil - case reflect.Interface: - if typ.NumMethod() == 0 { - return &emptyInterfaceCodec{}, nil - } - return &nonEmptyInterfaceCodec{}, nil - case reflect.Struct: - return &structEncoder{}, nil - case reflect.Array: - return &arrayEncoder{}, nil - case reflect.Slice: - return &sliceEncoder{}, nil - case reflect.Map: - return &mapEncoder{}, nil - case reflect.Ptr: - return &OptionalEncoder{}, nil - default: - return nil, fmt.Errorf("unsupported type: %v", typ) - } -} - -func createEncoderOfSimpleType(cfg *frozenConfig, typ reflect.Type) (ValEncoder, error) { - typeName := typ.String() - kind := typ.Kind() - switch kind { - case reflect.String: - if typeName != "string" { - return encoderOfType(cfg, reflect.TypeOf((*string)(nil)).Elem()) - } - return &stringCodec{}, nil - case reflect.Int: - if typeName != "int" { - return encoderOfType(cfg, reflect.TypeOf((*int)(nil)).Elem()) - } - return &intCodec{}, nil - case reflect.Int8: - if typeName != "int8" { - return encoderOfType(cfg, reflect.TypeOf((*int8)(nil)).Elem()) - } - return &int8Codec{}, nil - case reflect.Int16: - if typeName != "int16" { - return encoderOfType(cfg, reflect.TypeOf((*int16)(nil)).Elem()) - } - return &int16Codec{}, nil - case reflect.Int32: - if typeName != "int32" { - return encoderOfType(cfg, reflect.TypeOf((*int32)(nil)).Elem()) - } - return &int32Codec{}, nil - case reflect.Int64: - if typeName != "int64" { - return encoderOfType(cfg, reflect.TypeOf((*int64)(nil)).Elem()) - } - return &int64Codec{}, nil - case reflect.Uint: - if typeName != "uint" { - return encoderOfType(cfg, reflect.TypeOf((*uint)(nil)).Elem()) - } - return &uintCodec{}, nil - case reflect.Uint8: - if typeName != "uint8" { - return encoderOfType(cfg, reflect.TypeOf((*uint8)(nil)).Elem()) - } - return &uint8Codec{}, nil - case reflect.Uint16: - if typeName != "uint16" { - return encoderOfType(cfg, reflect.TypeOf((*uint16)(nil)).Elem()) - } - return &uint16Codec{}, nil - case reflect.Uint32: - if typeName != "uint32" { - return encoderOfType(cfg, reflect.TypeOf((*uint32)(nil)).Elem()) - } - return &uint32Codec{}, nil - case reflect.Uintptr: - if typeName != "uintptr" { - return encoderOfType(cfg, reflect.TypeOf((*uintptr)(nil)).Elem()) - } - return &uintptrCodec{}, nil - case reflect.Uint64: - if typeName != "uint64" { - return encoderOfType(cfg, reflect.TypeOf((*uint64)(nil)).Elem()) - } - return &uint64Codec{}, nil - case reflect.Float32: - if typeName != "float32" { - return encoderOfType(cfg, reflect.TypeOf((*float32)(nil)).Elem()) - } - return &float32Codec{}, nil - case reflect.Float64: - if typeName != "float64" { - return encoderOfType(cfg, reflect.TypeOf((*float64)(nil)).Elem()) - } - return &float64Codec{}, nil - case reflect.Bool: - if typeName != "bool" { - return encoderOfType(cfg, reflect.TypeOf((*bool)(nil)).Elem()) - } - return &boolCodec{}, nil - case reflect.Interface: - if typ.NumMethod() == 0 { - return &emptyInterfaceCodec{}, nil - } - return &nonEmptyInterfaceCodec{}, nil - case reflect.Struct: - return prefix(fmt.Sprintf("[%s]", typeName)).addToEncoder(encoderOfStruct(cfg, typ)) - case reflect.Array: - return prefix("[array]").addToEncoder(encoderOfArray(cfg, typ)) - case reflect.Slice: - return prefix("[slice]").addToEncoder(encoderOfSlice(cfg, typ)) - case reflect.Map: - return prefix("[map]").addToEncoder(encoderOfMap(cfg, typ)) - case reflect.Ptr: - return prefix("[optional]").addToEncoder(encoderOfOptional(cfg, typ)) - default: - return nil, fmt.Errorf("unsupported type: %v", typ) - } -} - -func decoderOfOptional(cfg *frozenConfig, typ reflect.Type) (ValDecoder, error) { - elemType := typ.Elem() - decoder, err := decoderOfType(cfg, elemType) - if err != nil { - return nil, err - } - return &OptionalDecoder{elemType, decoder}, nil -} - -func encoderOfOptional(cfg *frozenConfig, typ reflect.Type) (ValEncoder, error) { - elemType := typ.Elem() - elemEncoder, err := encoderOfType(cfg, elemType) - if err != nil { - return nil, err - } - encoder := &OptionalEncoder{elemEncoder} - if elemType.Kind() == reflect.Map { - encoder = &OptionalEncoder{encoder} - } - return encoder, nil -} - -func decoderOfMap(cfg *frozenConfig, typ reflect.Type) (ValDecoder, error) { - decoder, err := decoderOfType(cfg, typ.Elem()) - if err != nil { - return nil, err - } - mapInterface := reflect.New(typ).Interface() - return &mapDecoder{typ, typ.Key(), typ.Elem(), decoder, extractInterface(mapInterface)}, nil -} - -func extractInterface(val interface{}) emptyInterface { - return *((*emptyInterface)(unsafe.Pointer(&val))) -} - -func encoderOfMap(cfg *frozenConfig, typ reflect.Type) (ValEncoder, error) { - elemType := typ.Elem() - encoder, err := encoderOfType(cfg, elemType) - if err != nil { - return nil, err - } - mapInterface := reflect.New(typ).Elem().Interface() - if cfg.sortMapKeys { - return &sortKeysMapEncoder{typ, elemType, encoder, *((*emptyInterface)(unsafe.Pointer(&mapInterface)))}, nil - } - return &mapEncoder{typ, elemType, encoder, *((*emptyInterface)(unsafe.Pointer(&mapInterface)))}, nil -} diff --git a/vendor/github.com/json-iterator/go/feature_reflect_array.go b/vendor/github.com/json-iterator/go/feature_reflect_array.go deleted file mode 100644 index d661fb6fe..000000000 --- a/vendor/github.com/json-iterator/go/feature_reflect_array.go +++ /dev/null @@ -1,99 +0,0 @@ -package jsoniter - -import ( - "fmt" - "io" - "reflect" - "unsafe" -) - -func decoderOfArray(cfg *frozenConfig, typ reflect.Type) (ValDecoder, error) { - decoder, err := decoderOfType(cfg, typ.Elem()) - if err != nil { - return nil, err - } - return &arrayDecoder{typ, typ.Elem(), decoder}, nil -} - -func encoderOfArray(cfg *frozenConfig, typ reflect.Type) (ValEncoder, error) { - encoder, err := encoderOfType(cfg, typ.Elem()) - if err != nil { - return nil, err - } - if typ.Elem().Kind() == reflect.Map { - encoder = &OptionalEncoder{encoder} - } - return &arrayEncoder{typ, typ.Elem(), encoder}, nil -} - -type arrayEncoder struct { - arrayType reflect.Type - elemType reflect.Type - elemEncoder ValEncoder -} - -func (encoder *arrayEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteArrayStart() - elemPtr := unsafe.Pointer(ptr) - encoder.elemEncoder.Encode(elemPtr, stream) - for i := 1; i < encoder.arrayType.Len(); i++ { - stream.WriteMore() - elemPtr = unsafe.Pointer(uintptr(elemPtr) + encoder.elemType.Size()) - encoder.elemEncoder.Encode(unsafe.Pointer(elemPtr), stream) - } - stream.WriteArrayEnd() - if stream.Error != nil && stream.Error != io.EOF { - stream.Error = fmt.Errorf("%v: %s", encoder.arrayType, stream.Error.Error()) - } -} - -func (encoder *arrayEncoder) EncodeInterface(val interface{}, stream *Stream) { - // special optimization for interface{} - e := (*emptyInterface)(unsafe.Pointer(&val)) - if e.word == nil { - stream.WriteArrayStart() - stream.WriteNil() - stream.WriteArrayEnd() - return - } - elemType := encoder.arrayType.Elem() - if encoder.arrayType.Len() == 1 && (elemType.Kind() == reflect.Ptr || elemType.Kind() == reflect.Map) { - ptr := uintptr(e.word) - e.word = unsafe.Pointer(&ptr) - } - if reflect.TypeOf(val).Kind() == reflect.Ptr { - encoder.Encode(unsafe.Pointer(&e.word), stream) - } else { - encoder.Encode(e.word, stream) - } -} - -func (encoder *arrayEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return false -} - -type arrayDecoder struct { - arrayType reflect.Type - elemType reflect.Type - elemDecoder ValDecoder -} - -func (decoder *arrayDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - decoder.doDecode(ptr, iter) - if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%v: %s", decoder.arrayType, iter.Error.Error()) - } -} - -func (decoder *arrayDecoder) doDecode(ptr unsafe.Pointer, iter *Iterator) { - offset := uintptr(0) - iter.ReadArrayCB(func(iter *Iterator) bool { - if offset < decoder.arrayType.Size() { - decoder.elemDecoder.Decode(unsafe.Pointer(uintptr(ptr)+offset), iter) - offset += decoder.elemType.Size() - } else { - iter.Skip() - } - return true - }) -} diff --git a/vendor/github.com/json-iterator/go/feature_reflect_map.go b/vendor/github.com/json-iterator/go/feature_reflect_map.go deleted file mode 100644 index 005671e01..000000000 --- a/vendor/github.com/json-iterator/go/feature_reflect_map.go +++ /dev/null @@ -1,244 +0,0 @@ -package jsoniter - -import ( - "encoding" - "encoding/json" - "reflect" - "sort" - "strconv" - "unsafe" -) - -type mapDecoder struct { - mapType reflect.Type - keyType reflect.Type - elemType reflect.Type - elemDecoder ValDecoder - mapInterface emptyInterface -} - -func (decoder *mapDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - // dark magic to cast unsafe.Pointer back to interface{} using reflect.Type - mapInterface := decoder.mapInterface - mapInterface.word = ptr - realInterface := (*interface{})(unsafe.Pointer(&mapInterface)) - realVal := reflect.ValueOf(*realInterface).Elem() - if iter.ReadNil() { - realVal.Set(reflect.Zero(decoder.mapType)) - return - } - if realVal.IsNil() { - realVal.Set(reflect.MakeMap(realVal.Type())) - } - iter.ReadMapCB(func(iter *Iterator, keyStr string) bool { - elem := reflect.New(decoder.elemType) - decoder.elemDecoder.Decode(unsafe.Pointer(elem.Pointer()), iter) - // to put into map, we have to use reflection - keyType := decoder.keyType - // TODO: remove this from loop - switch { - case keyType.Kind() == reflect.String: - realVal.SetMapIndex(reflect.ValueOf(keyStr).Convert(keyType), elem.Elem()) - return true - case keyType.Implements(textUnmarshalerType): - textUnmarshaler := reflect.New(keyType.Elem()).Interface().(encoding.TextUnmarshaler) - err := textUnmarshaler.UnmarshalText([]byte(keyStr)) - if err != nil { - iter.ReportError("read map key as TextUnmarshaler", err.Error()) - return false - } - realVal.SetMapIndex(reflect.ValueOf(textUnmarshaler), elem.Elem()) - return true - case reflect.PtrTo(keyType).Implements(textUnmarshalerType): - textUnmarshaler := reflect.New(keyType).Interface().(encoding.TextUnmarshaler) - err := textUnmarshaler.UnmarshalText([]byte(keyStr)) - if err != nil { - iter.ReportError("read map key as TextUnmarshaler", err.Error()) - return false - } - realVal.SetMapIndex(reflect.ValueOf(textUnmarshaler).Elem(), elem.Elem()) - return true - default: - switch keyType.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - n, err := strconv.ParseInt(keyStr, 10, 64) - if err != nil || reflect.Zero(keyType).OverflowInt(n) { - iter.ReportError("read map key as int64", "read int64 failed") - return false - } - realVal.SetMapIndex(reflect.ValueOf(n).Convert(keyType), elem.Elem()) - return true - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - n, err := strconv.ParseUint(keyStr, 10, 64) - if err != nil || reflect.Zero(keyType).OverflowUint(n) { - iter.ReportError("read map key as uint64", "read uint64 failed") - return false - } - realVal.SetMapIndex(reflect.ValueOf(n).Convert(keyType), elem.Elem()) - return true - } - } - iter.ReportError("read map key", "unexpected map key type "+keyType.String()) - return true - }) -} - -type mapEncoder struct { - mapType reflect.Type - elemType reflect.Type - elemEncoder ValEncoder - mapInterface emptyInterface -} - -func (encoder *mapEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - mapInterface := encoder.mapInterface - mapInterface.word = ptr - realInterface := (*interface{})(unsafe.Pointer(&mapInterface)) - realVal := reflect.ValueOf(*realInterface) - stream.WriteObjectStart() - for i, key := range realVal.MapKeys() { - if i != 0 { - stream.WriteMore() - } - encodeMapKey(key, stream) - if stream.indention > 0 { - stream.writeTwoBytes(byte(':'), byte(' ')) - } else { - stream.writeByte(':') - } - val := realVal.MapIndex(key).Interface() - encoder.elemEncoder.EncodeInterface(val, stream) - } - stream.WriteObjectEnd() -} - -func encodeMapKey(key reflect.Value, stream *Stream) { - if key.Kind() == reflect.String { - stream.WriteString(key.String()) - return - } - if tm, ok := key.Interface().(encoding.TextMarshaler); ok { - buf, err := tm.MarshalText() - if err != nil { - stream.Error = err - return - } - stream.writeByte('"') - stream.Write(buf) - stream.writeByte('"') - return - } - switch key.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - stream.writeByte('"') - stream.WriteInt64(key.Int()) - stream.writeByte('"') - return - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - stream.writeByte('"') - stream.WriteUint64(key.Uint()) - stream.writeByte('"') - return - } - stream.Error = &json.UnsupportedTypeError{Type: key.Type()} -} - -func (encoder *mapEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - -func (encoder *mapEncoder) IsEmpty(ptr unsafe.Pointer) bool { - mapInterface := encoder.mapInterface - mapInterface.word = ptr - realInterface := (*interface{})(unsafe.Pointer(&mapInterface)) - realVal := reflect.ValueOf(*realInterface) - return realVal.Len() == 0 -} - -type sortKeysMapEncoder struct { - mapType reflect.Type - elemType reflect.Type - elemEncoder ValEncoder - mapInterface emptyInterface -} - -func (encoder *sortKeysMapEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - mapInterface := encoder.mapInterface - mapInterface.word = ptr - realInterface := (*interface{})(unsafe.Pointer(&mapInterface)) - realVal := reflect.ValueOf(*realInterface) - - // Extract and sort the keys. - keys := realVal.MapKeys() - sv := stringValues(make([]reflectWithString, len(keys))) - for i, v := range keys { - sv[i].v = v - if err := sv[i].resolve(); err != nil { - stream.Error = err - return - } - } - sort.Sort(sv) - - stream.WriteObjectStart() - for i, key := range sv { - if i != 0 { - stream.WriteMore() - } - stream.WriteVal(key.s) // might need html escape, so can not WriteString directly - if stream.indention > 0 { - stream.writeTwoBytes(byte(':'), byte(' ')) - } else { - stream.writeByte(':') - } - val := realVal.MapIndex(key.v).Interface() - encoder.elemEncoder.EncodeInterface(val, stream) - } - stream.WriteObjectEnd() -} - -// stringValues is a slice of reflect.Value holding *reflect.StringValue. -// It implements the methods to sort by string. -type stringValues []reflectWithString - -type reflectWithString struct { - v reflect.Value - s string -} - -func (w *reflectWithString) resolve() error { - if w.v.Kind() == reflect.String { - w.s = w.v.String() - return nil - } - if tm, ok := w.v.Interface().(encoding.TextMarshaler); ok { - buf, err := tm.MarshalText() - w.s = string(buf) - return err - } - switch w.v.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - w.s = strconv.FormatInt(w.v.Int(), 10) - return nil - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - w.s = strconv.FormatUint(w.v.Uint(), 10) - return nil - } - return &json.UnsupportedTypeError{Type: w.v.Type()} -} - -func (sv stringValues) Len() int { return len(sv) } -func (sv stringValues) Swap(i, j int) { sv[i], sv[j] = sv[j], sv[i] } -func (sv stringValues) Less(i, j int) bool { return sv[i].s < sv[j].s } - -func (encoder *sortKeysMapEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - -func (encoder *sortKeysMapEncoder) IsEmpty(ptr unsafe.Pointer) bool { - mapInterface := encoder.mapInterface - mapInterface.word = ptr - realInterface := (*interface{})(unsafe.Pointer(&mapInterface)) - realVal := reflect.ValueOf(*realInterface) - return realVal.Len() == 0 -} diff --git a/vendor/github.com/json-iterator/go/feature_reflect_native.go b/vendor/github.com/json-iterator/go/feature_reflect_native.go deleted file mode 100644 index 95bd1e87c..000000000 --- a/vendor/github.com/json-iterator/go/feature_reflect_native.go +++ /dev/null @@ -1,764 +0,0 @@ -package jsoniter - -import ( - "encoding" - "encoding/base64" - "encoding/json" - "reflect" - "unsafe" -) - -type stringCodec struct { -} - -func (codec *stringCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - *((*string)(ptr)) = iter.ReadString() -} - -func (codec *stringCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - str := *((*string)(ptr)) - stream.WriteString(str) -} - -func (codec *stringCodec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *stringCodec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*string)(ptr)) == "" -} - -type intCodec struct { -} - -func (codec *intCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*int)(ptr)) = iter.ReadInt() - } -} - -func (codec *intCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteInt(*((*int)(ptr))) -} - -func (codec *intCodec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *intCodec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*int)(ptr)) == 0 -} - -type uintptrCodec struct { -} - -func (codec *uintptrCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*uintptr)(ptr)) = uintptr(iter.ReadUint64()) - } -} - -func (codec *uintptrCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteUint64(uint64(*((*uintptr)(ptr)))) -} - -func (codec *uintptrCodec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *uintptrCodec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*uintptr)(ptr)) == 0 -} - -type int8Codec struct { -} - -func (codec *int8Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*int8)(ptr)) = iter.ReadInt8() - } -} - -func (codec *int8Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteInt8(*((*int8)(ptr))) -} - -func (codec *int8Codec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *int8Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*int8)(ptr)) == 0 -} - -type int16Codec struct { -} - -func (codec *int16Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*int16)(ptr)) = iter.ReadInt16() - } -} - -func (codec *int16Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteInt16(*((*int16)(ptr))) -} - -func (codec *int16Codec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *int16Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*int16)(ptr)) == 0 -} - -type int32Codec struct { -} - -func (codec *int32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*int32)(ptr)) = iter.ReadInt32() - } -} - -func (codec *int32Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteInt32(*((*int32)(ptr))) -} - -func (codec *int32Codec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *int32Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*int32)(ptr)) == 0 -} - -type int64Codec struct { -} - -func (codec *int64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*int64)(ptr)) = iter.ReadInt64() - } -} - -func (codec *int64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteInt64(*((*int64)(ptr))) -} - -func (codec *int64Codec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *int64Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*int64)(ptr)) == 0 -} - -type uintCodec struct { -} - -func (codec *uintCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*uint)(ptr)) = iter.ReadUint() - return - } -} - -func (codec *uintCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteUint(*((*uint)(ptr))) -} - -func (codec *uintCodec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *uintCodec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*uint)(ptr)) == 0 -} - -type uint8Codec struct { -} - -func (codec *uint8Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*uint8)(ptr)) = iter.ReadUint8() - } -} - -func (codec *uint8Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteUint8(*((*uint8)(ptr))) -} - -func (codec *uint8Codec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *uint8Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*uint8)(ptr)) == 0 -} - -type uint16Codec struct { -} - -func (codec *uint16Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*uint16)(ptr)) = iter.ReadUint16() - } -} - -func (codec *uint16Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteUint16(*((*uint16)(ptr))) -} - -func (codec *uint16Codec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *uint16Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*uint16)(ptr)) == 0 -} - -type uint32Codec struct { -} - -func (codec *uint32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*uint32)(ptr)) = iter.ReadUint32() - } -} - -func (codec *uint32Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteUint32(*((*uint32)(ptr))) -} - -func (codec *uint32Codec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *uint32Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*uint32)(ptr)) == 0 -} - -type uint64Codec struct { -} - -func (codec *uint64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*uint64)(ptr)) = iter.ReadUint64() - } -} - -func (codec *uint64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteUint64(*((*uint64)(ptr))) -} - -func (codec *uint64Codec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *uint64Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*uint64)(ptr)) == 0 -} - -type float32Codec struct { -} - -func (codec *float32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*float32)(ptr)) = iter.ReadFloat32() - } -} - -func (codec *float32Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteFloat32(*((*float32)(ptr))) -} - -func (codec *float32Codec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *float32Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*float32)(ptr)) == 0 -} - -type float64Codec struct { -} - -func (codec *float64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*float64)(ptr)) = iter.ReadFloat64() - } -} - -func (codec *float64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteFloat64(*((*float64)(ptr))) -} - -func (codec *float64Codec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *float64Codec) IsEmpty(ptr unsafe.Pointer) bool { - return *((*float64)(ptr)) == 0 -} - -type boolCodec struct { -} - -func (codec *boolCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if !iter.ReadNil() { - *((*bool)(ptr)) = iter.ReadBool() - } -} - -func (codec *boolCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteBool(*((*bool)(ptr))) -} - -func (codec *boolCodec) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, codec) -} - -func (codec *boolCodec) IsEmpty(ptr unsafe.Pointer) bool { - return !(*((*bool)(ptr))) -} - -type emptyInterfaceCodec struct { -} - -func (codec *emptyInterfaceCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - existing := *((*interface{})(ptr)) - - // Checking for both typed and untyped nil pointers. - if existing != nil && - reflect.TypeOf(existing).Kind() == reflect.Ptr && - !reflect.ValueOf(existing).IsNil() { - - var ptrToExisting interface{} - for { - elem := reflect.ValueOf(existing).Elem() - if elem.Kind() != reflect.Ptr || elem.IsNil() { - break - } - ptrToExisting = existing - existing = elem.Interface() - } - - if iter.ReadNil() { - if ptrToExisting != nil { - nilPtr := reflect.Zero(reflect.TypeOf(ptrToExisting).Elem()) - reflect.ValueOf(ptrToExisting).Elem().Set(nilPtr) - } else { - *((*interface{})(ptr)) = nil - } - } else { - iter.ReadVal(existing) - } - - return - } - - if iter.ReadNil() { - *((*interface{})(ptr)) = nil - } else { - *((*interface{})(ptr)) = iter.Read() - } -} - -func (codec *emptyInterfaceCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteVal(*((*interface{})(ptr))) -} - -func (codec *emptyInterfaceCodec) EncodeInterface(val interface{}, stream *Stream) { - stream.WriteVal(val) -} - -func (codec *emptyInterfaceCodec) IsEmpty(ptr unsafe.Pointer) bool { - emptyInterface := (*emptyInterface)(ptr) - return emptyInterface.typ == nil -} - -type nonEmptyInterfaceCodec struct { -} - -func (codec *nonEmptyInterfaceCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - nonEmptyInterface := (*nonEmptyInterface)(ptr) - if nonEmptyInterface.itab == nil { - iter.ReportError("read non-empty interface", "do not know which concrete type to decode to") - return - } - var i interface{} - e := (*emptyInterface)(unsafe.Pointer(&i)) - e.typ = nonEmptyInterface.itab.typ - e.word = nonEmptyInterface.word - iter.ReadVal(&i) - if e.word == nil { - nonEmptyInterface.itab = nil - } - nonEmptyInterface.word = e.word -} - -func (codec *nonEmptyInterfaceCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - nonEmptyInterface := (*nonEmptyInterface)(ptr) - var i interface{} - if nonEmptyInterface.itab != nil { - e := (*emptyInterface)(unsafe.Pointer(&i)) - e.typ = nonEmptyInterface.itab.typ - e.word = nonEmptyInterface.word - } - stream.WriteVal(i) -} - -func (codec *nonEmptyInterfaceCodec) EncodeInterface(val interface{}, stream *Stream) { - stream.WriteVal(val) -} - -func (codec *nonEmptyInterfaceCodec) IsEmpty(ptr unsafe.Pointer) bool { - nonEmptyInterface := (*nonEmptyInterface)(ptr) - return nonEmptyInterface.word == nil -} - -type anyCodec struct { -} - -func (codec *anyCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - *((*Any)(ptr)) = iter.ReadAny() -} - -func (codec *anyCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - (*((*Any)(ptr))).WriteTo(stream) -} - -func (codec *anyCodec) EncodeInterface(val interface{}, stream *Stream) { - (val.(Any)).WriteTo(stream) -} - -func (codec *anyCodec) IsEmpty(ptr unsafe.Pointer) bool { - return (*((*Any)(ptr))).Size() == 0 -} - -type jsonNumberCodec struct { -} - -func (codec *jsonNumberCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - switch iter.WhatIsNext() { - case StringValue: - *((*json.Number)(ptr)) = json.Number(iter.ReadString()) - case NilValue: - iter.skipFourBytes('n', 'u', 'l', 'l') - *((*json.Number)(ptr)) = "" - default: - *((*json.Number)(ptr)) = json.Number([]byte(iter.readNumberAsString())) - } -} - -func (codec *jsonNumberCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteRaw(string(*((*json.Number)(ptr)))) -} - -func (codec *jsonNumberCodec) EncodeInterface(val interface{}, stream *Stream) { - stream.WriteRaw(string(val.(json.Number))) -} - -func (codec *jsonNumberCodec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*json.Number)(ptr))) == 0 -} - -type jsoniterNumberCodec struct { -} - -func (codec *jsoniterNumberCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - switch iter.WhatIsNext() { - case StringValue: - *((*Number)(ptr)) = Number(iter.ReadString()) - case NilValue: - iter.skipFourBytes('n', 'u', 'l', 'l') - *((*Number)(ptr)) = "" - default: - *((*Number)(ptr)) = Number([]byte(iter.readNumberAsString())) - } -} - -func (codec *jsoniterNumberCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteRaw(string(*((*Number)(ptr)))) -} - -func (codec *jsoniterNumberCodec) EncodeInterface(val interface{}, stream *Stream) { - stream.WriteRaw(string(val.(Number))) -} - -func (codec *jsoniterNumberCodec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*Number)(ptr))) == 0 -} - -type jsonRawMessageCodec struct { -} - -func (codec *jsonRawMessageCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - *((*json.RawMessage)(ptr)) = json.RawMessage(iter.SkipAndReturnBytes()) -} - -func (codec *jsonRawMessageCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteRaw(string(*((*json.RawMessage)(ptr)))) -} - -func (codec *jsonRawMessageCodec) EncodeInterface(val interface{}, stream *Stream) { - stream.WriteRaw(string(val.(json.RawMessage))) -} - -func (codec *jsonRawMessageCodec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*json.RawMessage)(ptr))) == 0 -} - -type jsoniterRawMessageCodec struct { -} - -func (codec *jsoniterRawMessageCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { - *((*RawMessage)(ptr)) = RawMessage(iter.SkipAndReturnBytes()) -} - -func (codec *jsoniterRawMessageCodec) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.WriteRaw(string(*((*RawMessage)(ptr)))) -} - -func (codec *jsoniterRawMessageCodec) EncodeInterface(val interface{}, stream *Stream) { - stream.WriteRaw(string(val.(RawMessage))) -} - -func (codec *jsoniterRawMessageCodec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*RawMessage)(ptr))) == 0 -} - -type base64Codec struct { - sliceDecoder ValDecoder -} - -func (codec *base64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { - if iter.ReadNil() { - ptrSlice := (*sliceHeader)(ptr) - ptrSlice.Len = 0 - ptrSlice.Cap = 0 - ptrSlice.Data = nil - return - } - switch iter.WhatIsNext() { - case StringValue: - encoding := base64.StdEncoding - src := iter.SkipAndReturnBytes() - src = src[1 : len(src)-1] - decodedLen := encoding.DecodedLen(len(src)) - dst := make([]byte, decodedLen) - len, err := encoding.Decode(dst, src) - if err != nil { - iter.ReportError("decode base64", err.Error()) - } else { - dst = dst[:len] - dstSlice := (*sliceHeader)(unsafe.Pointer(&dst)) - ptrSlice := (*sliceHeader)(ptr) - ptrSlice.Data = dstSlice.Data - ptrSlice.Cap = dstSlice.Cap - ptrSlice.Len = dstSlice.Len - } - case ArrayValue: - codec.sliceDecoder.Decode(ptr, iter) - default: - iter.ReportError("base64Codec", "invalid input") - } -} - -func (codec *base64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { - src := *((*[]byte)(ptr)) - if len(src) == 0 { - stream.WriteNil() - return - } - encoding := base64.StdEncoding - stream.writeByte('"') - toGrow := encoding.EncodedLen(len(src)) - stream.ensure(toGrow) - encoding.Encode(stream.buf[stream.n:], src) - stream.n += toGrow - stream.writeByte('"') -} - -func (codec *base64Codec) EncodeInterface(val interface{}, stream *Stream) { - ptr := extractInterface(val).word - src := *((*[]byte)(ptr)) - if len(src) == 0 { - stream.WriteNil() - return - } - encoding := base64.StdEncoding - stream.writeByte('"') - toGrow := encoding.EncodedLen(len(src)) - stream.ensure(toGrow) - encoding.Encode(stream.buf[stream.n:], src) - stream.n += toGrow - stream.writeByte('"') -} - -func (codec *base64Codec) IsEmpty(ptr unsafe.Pointer) bool { - return len(*((*[]byte)(ptr))) == 0 -} - -type stringModeNumberDecoder struct { - elemDecoder ValDecoder -} - -func (decoder *stringModeNumberDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - c := iter.nextToken() - if c != '"' { - iter.ReportError("stringModeNumberDecoder", `expect ", but found `+string([]byte{c})) - return - } - decoder.elemDecoder.Decode(ptr, iter) - if iter.Error != nil { - return - } - c = iter.readByte() - if c != '"' { - iter.ReportError("stringModeNumberDecoder", `expect ", but found `+string([]byte{c})) - return - } -} - -type stringModeStringDecoder struct { - elemDecoder ValDecoder - cfg *frozenConfig -} - -func (decoder *stringModeStringDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - decoder.elemDecoder.Decode(ptr, iter) - str := *((*string)(ptr)) - tempIter := decoder.cfg.BorrowIterator([]byte(str)) - defer decoder.cfg.ReturnIterator(tempIter) - *((*string)(ptr)) = tempIter.ReadString() -} - -type stringModeNumberEncoder struct { - elemEncoder ValEncoder -} - -func (encoder *stringModeNumberEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - stream.writeByte('"') - encoder.elemEncoder.Encode(ptr, stream) - stream.writeByte('"') -} - -func (encoder *stringModeNumberEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - -func (encoder *stringModeNumberEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.elemEncoder.IsEmpty(ptr) -} - -type stringModeStringEncoder struct { - elemEncoder ValEncoder - cfg *frozenConfig -} - -func (encoder *stringModeStringEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - tempStream := encoder.cfg.BorrowStream(nil) - defer encoder.cfg.ReturnStream(tempStream) - encoder.elemEncoder.Encode(ptr, tempStream) - stream.WriteString(string(tempStream.Buffer())) -} - -func (encoder *stringModeStringEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - -func (encoder *stringModeStringEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.elemEncoder.IsEmpty(ptr) -} - -type marshalerEncoder struct { - templateInterface emptyInterface - checkIsEmpty checkIsEmpty -} - -func (encoder *marshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - templateInterface := encoder.templateInterface - templateInterface.word = ptr - realInterface := (*interface{})(unsafe.Pointer(&templateInterface)) - marshaler, ok := (*realInterface).(json.Marshaler) - if !ok { - stream.WriteVal(nil) - return - } - - bytes, err := marshaler.MarshalJSON() - if err != nil { - stream.Error = err - } else { - stream.Write(bytes) - } -} -func (encoder *marshalerEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - -func (encoder *marshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.checkIsEmpty.IsEmpty(ptr) -} - -type textMarshalerEncoder struct { - templateInterface emptyInterface - checkIsEmpty checkIsEmpty -} - -func (encoder *textMarshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - templateInterface := encoder.templateInterface - templateInterface.word = ptr - realInterface := (*interface{})(unsafe.Pointer(&templateInterface)) - marshaler := (*realInterface).(encoding.TextMarshaler) - bytes, err := marshaler.MarshalText() - if err != nil { - stream.Error = err - } else { - stream.WriteString(string(bytes)) - } -} - -func (encoder *textMarshalerEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - -func (encoder *textMarshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { - return encoder.checkIsEmpty.IsEmpty(ptr) -} - -type unmarshalerDecoder struct { - templateInterface emptyInterface -} - -func (decoder *unmarshalerDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - templateInterface := decoder.templateInterface - templateInterface.word = ptr - realInterface := (*interface{})(unsafe.Pointer(&templateInterface)) - unmarshaler := (*realInterface).(json.Unmarshaler) - iter.nextToken() - iter.unreadByte() // skip spaces - bytes := iter.SkipAndReturnBytes() - err := unmarshaler.UnmarshalJSON(bytes) - if err != nil { - iter.ReportError("unmarshalerDecoder", err.Error()) - } -} - -type textUnmarshalerDecoder struct { - templateInterface emptyInterface -} - -func (decoder *textUnmarshalerDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - templateInterface := decoder.templateInterface - templateInterface.word = ptr - realInterface := (*interface{})(unsafe.Pointer(&templateInterface)) - unmarshaler := (*realInterface).(encoding.TextUnmarshaler) - str := iter.ReadString() - err := unmarshaler.UnmarshalText([]byte(str)) - if err != nil { - iter.ReportError("textUnmarshalerDecoder", err.Error()) - } -} diff --git a/vendor/github.com/json-iterator/go/feature_reflect_slice.go b/vendor/github.com/json-iterator/go/feature_reflect_slice.go deleted file mode 100644 index 51a8daecf..000000000 --- a/vendor/github.com/json-iterator/go/feature_reflect_slice.go +++ /dev/null @@ -1,147 +0,0 @@ -package jsoniter - -import ( - "fmt" - "io" - "reflect" - "unsafe" -) - -func decoderOfSlice(cfg *frozenConfig, typ reflect.Type) (ValDecoder, error) { - decoder, err := decoderOfType(cfg, typ.Elem()) - if err != nil { - return nil, err - } - return &sliceDecoder{typ, typ.Elem(), decoder}, nil -} - -func encoderOfSlice(cfg *frozenConfig, typ reflect.Type) (ValEncoder, error) { - encoder, err := encoderOfType(cfg, typ.Elem()) - if err != nil { - return nil, err - } - if typ.Elem().Kind() == reflect.Map { - encoder = &OptionalEncoder{encoder} - } - return &sliceEncoder{typ, typ.Elem(), encoder}, nil -} - -type sliceEncoder struct { - sliceType reflect.Type - elemType reflect.Type - elemEncoder ValEncoder -} - -func (encoder *sliceEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - slice := (*sliceHeader)(ptr) - if slice.Data == nil { - stream.WriteNil() - return - } - if slice.Len == 0 { - stream.WriteEmptyArray() - return - } - stream.WriteArrayStart() - elemPtr := unsafe.Pointer(slice.Data) - encoder.elemEncoder.Encode(unsafe.Pointer(elemPtr), stream) - for i := 1; i < slice.Len; i++ { - stream.WriteMore() - elemPtr = unsafe.Pointer(uintptr(elemPtr) + encoder.elemType.Size()) - encoder.elemEncoder.Encode(unsafe.Pointer(elemPtr), stream) - } - stream.WriteArrayEnd() - if stream.Error != nil && stream.Error != io.EOF { - stream.Error = fmt.Errorf("%v: %s", encoder.sliceType, stream.Error.Error()) - } -} - -func (encoder *sliceEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - -func (encoder *sliceEncoder) IsEmpty(ptr unsafe.Pointer) bool { - slice := (*sliceHeader)(ptr) - return slice.Len == 0 -} - -type sliceDecoder struct { - sliceType reflect.Type - elemType reflect.Type - elemDecoder ValDecoder -} - -// sliceHeader is a safe version of SliceHeader used within this package. -type sliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -func (decoder *sliceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - decoder.doDecode(ptr, iter) - if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%v: %s", decoder.sliceType, iter.Error.Error()) - } -} - -func (decoder *sliceDecoder) doDecode(ptr unsafe.Pointer, iter *Iterator) { - slice := (*sliceHeader)(ptr) - if iter.ReadNil() { - slice.Len = 0 - slice.Cap = 0 - slice.Data = nil - return - } - reuseSlice(slice, decoder.sliceType, 4) - slice.Len = 0 - offset := uintptr(0) - iter.ReadArrayCB(func(iter *Iterator) bool { - growOne(slice, decoder.sliceType, decoder.elemType) - decoder.elemDecoder.Decode(unsafe.Pointer(uintptr(slice.Data)+offset), iter) - offset += decoder.elemType.Size() - return true - }) -} - -// grow grows the slice s so that it can hold extra more values, allocating -// more capacity if needed. It also returns the old and new slice lengths. -func growOne(slice *sliceHeader, sliceType reflect.Type, elementType reflect.Type) { - newLen := slice.Len + 1 - if newLen <= slice.Cap { - slice.Len = newLen - return - } - newCap := slice.Cap - if newCap == 0 { - newCap = 1 - } else { - for newCap < newLen { - if slice.Len < 1024 { - newCap += newCap - } else { - newCap += newCap / 4 - } - } - } - newVal := reflect.MakeSlice(sliceType, newLen, newCap) - dst := unsafe.Pointer(newVal.Pointer()) - // copy old array into new array - originalBytesCount := slice.Len * int(elementType.Size()) - srcSliceHeader := (unsafe.Pointer)(&sliceHeader{slice.Data, originalBytesCount, originalBytesCount}) - dstSliceHeader := (unsafe.Pointer)(&sliceHeader{dst, originalBytesCount, originalBytesCount}) - copy(*(*[]byte)(dstSliceHeader), *(*[]byte)(srcSliceHeader)) - slice.Data = dst - slice.Len = newLen - slice.Cap = newCap -} - -func reuseSlice(slice *sliceHeader, sliceType reflect.Type, expectedCap int) { - if expectedCap <= slice.Cap { - return - } - newVal := reflect.MakeSlice(sliceType, 0, expectedCap) - dst := unsafe.Pointer(newVal.Pointer()) - slice.Data = dst - slice.Cap = expectedCap -} diff --git a/vendor/github.com/json-iterator/go/feature_stream_int.go b/vendor/github.com/json-iterator/go/feature_stream_int.go deleted file mode 100644 index 7cfd522c1..000000000 --- a/vendor/github.com/json-iterator/go/feature_stream_int.go +++ /dev/null @@ -1,320 +0,0 @@ -package jsoniter - -var digits []uint32 - -func init() { - digits = make([]uint32, 1000) - for i := uint32(0); i < 1000; i++ { - digits[i] = (((i / 100) + '0') << 16) + ((((i / 10) % 10) + '0') << 8) + i%10 + '0' - if i < 10 { - digits[i] += 2 << 24 - } else if i < 100 { - digits[i] += 1 << 24 - } - } -} - -func writeFirstBuf(buf []byte, v uint32, n int) int { - start := v >> 24 - if start == 0 { - buf[n] = byte(v >> 16) - n++ - buf[n] = byte(v >> 8) - n++ - } else if start == 1 { - buf[n] = byte(v >> 8) - n++ - } - buf[n] = byte(v) - n++ - return n -} - -func writeBuf(buf []byte, v uint32, n int) { - buf[n] = byte(v >> 16) - buf[n+1] = byte(v >> 8) - buf[n+2] = byte(v) -} - -// WriteUint8 write uint8 to stream -func (stream *Stream) WriteUint8(val uint8) { - stream.ensure(3) - stream.n = writeFirstBuf(stream.buf, digits[val], stream.n) -} - -// WriteInt8 write int8 to stream -func (stream *Stream) WriteInt8(nval int8) { - stream.ensure(4) - n := stream.n - var val uint8 - if nval < 0 { - val = uint8(-nval) - stream.buf[n] = '-' - n++ - } else { - val = uint8(nval) - } - stream.n = writeFirstBuf(stream.buf, digits[val], n) -} - -// WriteUint16 write uint16 to stream -func (stream *Stream) WriteUint16(val uint16) { - stream.ensure(5) - q1 := val / 1000 - if q1 == 0 { - stream.n = writeFirstBuf(stream.buf, digits[val], stream.n) - return - } - r1 := val - q1*1000 - n := writeFirstBuf(stream.buf, digits[q1], stream.n) - writeBuf(stream.buf, digits[r1], n) - stream.n = n + 3 - return -} - -// WriteInt16 write int16 to stream -func (stream *Stream) WriteInt16(nval int16) { - stream.ensure(6) - n := stream.n - var val uint16 - if nval < 0 { - val = uint16(-nval) - stream.buf[n] = '-' - n++ - } else { - val = uint16(nval) - } - q1 := val / 1000 - if q1 == 0 { - stream.n = writeFirstBuf(stream.buf, digits[val], n) - return - } - r1 := val - q1*1000 - n = writeFirstBuf(stream.buf, digits[q1], n) - writeBuf(stream.buf, digits[r1], n) - stream.n = n + 3 - return -} - -// WriteUint32 write uint32 to stream -func (stream *Stream) WriteUint32(val uint32) { - stream.ensure(10) - n := stream.n - q1 := val / 1000 - if q1 == 0 { - stream.n = writeFirstBuf(stream.buf, digits[val], n) - return - } - r1 := val - q1*1000 - q2 := q1 / 1000 - if q2 == 0 { - n := writeFirstBuf(stream.buf, digits[q1], n) - writeBuf(stream.buf, digits[r1], n) - stream.n = n + 3 - return - } - r2 := q1 - q2*1000 - q3 := q2 / 1000 - if q3 == 0 { - n = writeFirstBuf(stream.buf, digits[q2], n) - } else { - r3 := q2 - q3*1000 - stream.buf[n] = byte(q3 + '0') - n++ - writeBuf(stream.buf, digits[r3], n) - n += 3 - } - writeBuf(stream.buf, digits[r2], n) - writeBuf(stream.buf, digits[r1], n+3) - stream.n = n + 6 -} - -// WriteInt32 write int32 to stream -func (stream *Stream) WriteInt32(nval int32) { - stream.ensure(11) - n := stream.n - var val uint32 - if nval < 0 { - val = uint32(-nval) - stream.buf[n] = '-' - n++ - } else { - val = uint32(nval) - } - q1 := val / 1000 - if q1 == 0 { - stream.n = writeFirstBuf(stream.buf, digits[val], n) - return - } - r1 := val - q1*1000 - q2 := q1 / 1000 - if q2 == 0 { - n := writeFirstBuf(stream.buf, digits[q1], n) - writeBuf(stream.buf, digits[r1], n) - stream.n = n + 3 - return - } - r2 := q1 - q2*1000 - q3 := q2 / 1000 - if q3 == 0 { - n = writeFirstBuf(stream.buf, digits[q2], n) - } else { - r3 := q2 - q3*1000 - stream.buf[n] = byte(q3 + '0') - n++ - writeBuf(stream.buf, digits[r3], n) - n += 3 - } - writeBuf(stream.buf, digits[r2], n) - writeBuf(stream.buf, digits[r1], n+3) - stream.n = n + 6 -} - -// WriteUint64 write uint64 to stream -func (stream *Stream) WriteUint64(val uint64) { - stream.ensure(20) - n := stream.n - q1 := val / 1000 - if q1 == 0 { - stream.n = writeFirstBuf(stream.buf, digits[val], n) - return - } - r1 := val - q1*1000 - q2 := q1 / 1000 - if q2 == 0 { - n := writeFirstBuf(stream.buf, digits[q1], n) - writeBuf(stream.buf, digits[r1], n) - stream.n = n + 3 - return - } - r2 := q1 - q2*1000 - q3 := q2 / 1000 - if q3 == 0 { - n = writeFirstBuf(stream.buf, digits[q2], n) - writeBuf(stream.buf, digits[r2], n) - writeBuf(stream.buf, digits[r1], n+3) - stream.n = n + 6 - return - } - r3 := q2 - q3*1000 - q4 := q3 / 1000 - if q4 == 0 { - n = writeFirstBuf(stream.buf, digits[q3], n) - writeBuf(stream.buf, digits[r3], n) - writeBuf(stream.buf, digits[r2], n+3) - writeBuf(stream.buf, digits[r1], n+6) - stream.n = n + 9 - return - } - r4 := q3 - q4*1000 - q5 := q4 / 1000 - if q5 == 0 { - n = writeFirstBuf(stream.buf, digits[q4], n) - writeBuf(stream.buf, digits[r4], n) - writeBuf(stream.buf, digits[r3], n+3) - writeBuf(stream.buf, digits[r2], n+6) - writeBuf(stream.buf, digits[r1], n+9) - stream.n = n + 12 - return - } - r5 := q4 - q5*1000 - q6 := q5 / 1000 - if q6 == 0 { - n = writeFirstBuf(stream.buf, digits[q5], n) - } else { - n = writeFirstBuf(stream.buf, digits[q6], n) - r6 := q5 - q6*1000 - writeBuf(stream.buf, digits[r6], n) - n += 3 - } - writeBuf(stream.buf, digits[r5], n) - writeBuf(stream.buf, digits[r4], n+3) - writeBuf(stream.buf, digits[r3], n+6) - writeBuf(stream.buf, digits[r2], n+9) - writeBuf(stream.buf, digits[r1], n+12) - stream.n = n + 15 -} - -// WriteInt64 write int64 to stream -func (stream *Stream) WriteInt64(nval int64) { - stream.ensure(20) - n := stream.n - var val uint64 - if nval < 0 { - val = uint64(-nval) - stream.buf[n] = '-' - n++ - } else { - val = uint64(nval) - } - q1 := val / 1000 - if q1 == 0 { - stream.n = writeFirstBuf(stream.buf, digits[val], n) - return - } - r1 := val - q1*1000 - q2 := q1 / 1000 - if q2 == 0 { - n := writeFirstBuf(stream.buf, digits[q1], n) - writeBuf(stream.buf, digits[r1], n) - stream.n = n + 3 - return - } - r2 := q1 - q2*1000 - q3 := q2 / 1000 - if q3 == 0 { - n = writeFirstBuf(stream.buf, digits[q2], n) - writeBuf(stream.buf, digits[r2], n) - writeBuf(stream.buf, digits[r1], n+3) - stream.n = n + 6 - return - } - r3 := q2 - q3*1000 - q4 := q3 / 1000 - if q4 == 0 { - n = writeFirstBuf(stream.buf, digits[q3], n) - writeBuf(stream.buf, digits[r3], n) - writeBuf(stream.buf, digits[r2], n+3) - writeBuf(stream.buf, digits[r1], n+6) - stream.n = n + 9 - return - } - r4 := q3 - q4*1000 - q5 := q4 / 1000 - if q5 == 0 { - n = writeFirstBuf(stream.buf, digits[q4], n) - writeBuf(stream.buf, digits[r4], n) - writeBuf(stream.buf, digits[r3], n+3) - writeBuf(stream.buf, digits[r2], n+6) - writeBuf(stream.buf, digits[r1], n+9) - stream.n = n + 12 - return - } - r5 := q4 - q5*1000 - q6 := q5 / 1000 - if q6 == 0 { - n = writeFirstBuf(stream.buf, digits[q5], n) - } else { - stream.buf[n] = byte(q6 + '0') - n++ - r6 := q5 - q6*1000 - writeBuf(stream.buf, digits[r6], n) - n += 3 - } - writeBuf(stream.buf, digits[r5], n) - writeBuf(stream.buf, digits[r4], n+3) - writeBuf(stream.buf, digits[r3], n+6) - writeBuf(stream.buf, digits[r2], n+9) - writeBuf(stream.buf, digits[r1], n+12) - stream.n = n + 15 -} - -// WriteInt write int to stream -func (stream *Stream) WriteInt(val int) { - stream.WriteInt64(int64(val)) -} - -// WriteUint write uint to stream -func (stream *Stream) WriteUint(val uint) { - stream.WriteUint64(uint64(val)) -} diff --git a/vendor/github.com/json-iterator/go/feature_iter.go b/vendor/github.com/json-iterator/go/iter.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_iter.go rename to vendor/github.com/json-iterator/go/iter.go diff --git a/vendor/github.com/json-iterator/go/feature_iter_array.go b/vendor/github.com/json-iterator/go/iter_array.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_iter_array.go rename to vendor/github.com/json-iterator/go/iter_array.go diff --git a/vendor/github.com/json-iterator/go/feature_iter_float.go b/vendor/github.com/json-iterator/go/iter_float.go similarity index 98% rename from vendor/github.com/json-iterator/go/feature_iter_float.go rename to vendor/github.com/json-iterator/go/iter_float.go index 86f459912..4f883c095 100644 --- a/vendor/github.com/json-iterator/go/feature_iter_float.go +++ b/vendor/github.com/json-iterator/go/iter_float.go @@ -1,6 +1,7 @@ package jsoniter import ( + "encoding/json" "io" "math/big" "strconv" @@ -339,3 +340,8 @@ func validateFloat(str string) string { } return "" } + +// ReadNumber read json.Number +func (iter *Iterator) ReadNumber() (ret json.Number) { + return json.Number(iter.readNumberAsString()) +} diff --git a/vendor/github.com/json-iterator/go/feature_iter_int.go b/vendor/github.com/json-iterator/go/iter_int.go similarity index 72% rename from vendor/github.com/json-iterator/go/feature_iter_int.go rename to vendor/github.com/json-iterator/go/iter_int.go index 6137348cd..214232035 100644 --- a/vendor/github.com/json-iterator/go/feature_iter_int.go +++ b/vendor/github.com/json-iterator/go/iter_int.go @@ -22,11 +22,17 @@ func init() { // ReadUint read uint func (iter *Iterator) ReadUint() uint { + if strconv.IntSize == 32 { + return uint(iter.ReadUint32()) + } return uint(iter.ReadUint64()) } // ReadInt read int func (iter *Iterator) ReadInt() int { + if strconv.IntSize == 32 { + return int(iter.ReadInt32()) + } return int(iter.ReadInt64()) } @@ -113,13 +119,9 @@ func (iter *Iterator) ReadUint32() (ret uint32) { } func (iter *Iterator) readUint32(c byte) (ret uint32) { - defer func() { - if iter.head < len(iter.buf) && iter.buf[iter.head] == '.' { - iter.ReportError("readUint32", "can not decode float as int") - } - }() ind := intDigits[c] if ind == 0 { + iter.assertInteger() return 0 // single zero } if ind == invalidCharForNumber { @@ -132,12 +134,14 @@ func (iter *Iterator) readUint32(c byte) (ret uint32) { ind2 := intDigits[iter.buf[i]] if ind2 == invalidCharForNumber { iter.head = i + iter.assertInteger() return value } i++ ind3 := intDigits[iter.buf[i]] if ind3 == invalidCharForNumber { iter.head = i + iter.assertInteger() return value*10 + uint32(ind2) } //iter.head = i + 1 @@ -146,30 +150,35 @@ func (iter *Iterator) readUint32(c byte) (ret uint32) { ind4 := intDigits[iter.buf[i]] if ind4 == invalidCharForNumber { iter.head = i + iter.assertInteger() return value*100 + uint32(ind2)*10 + uint32(ind3) } i++ ind5 := intDigits[iter.buf[i]] if ind5 == invalidCharForNumber { iter.head = i + iter.assertInteger() return value*1000 + uint32(ind2)*100 + uint32(ind3)*10 + uint32(ind4) } i++ ind6 := intDigits[iter.buf[i]] if ind6 == invalidCharForNumber { iter.head = i + iter.assertInteger() return value*10000 + uint32(ind2)*1000 + uint32(ind3)*100 + uint32(ind4)*10 + uint32(ind5) } i++ ind7 := intDigits[iter.buf[i]] if ind7 == invalidCharForNumber { iter.head = i + iter.assertInteger() return value*100000 + uint32(ind2)*10000 + uint32(ind3)*1000 + uint32(ind4)*100 + uint32(ind5)*10 + uint32(ind6) } i++ ind8 := intDigits[iter.buf[i]] if ind8 == invalidCharForNumber { iter.head = i + iter.assertInteger() return value*1000000 + uint32(ind2)*100000 + uint32(ind3)*10000 + uint32(ind4)*1000 + uint32(ind5)*100 + uint32(ind6)*10 + uint32(ind7) } i++ @@ -177,6 +186,7 @@ func (iter *Iterator) readUint32(c byte) (ret uint32) { value = value*10000000 + uint32(ind2)*1000000 + uint32(ind3)*100000 + uint32(ind4)*10000 + uint32(ind5)*1000 + uint32(ind6)*100 + uint32(ind7)*10 + uint32(ind8) iter.head = i if ind9 == invalidCharForNumber { + iter.assertInteger() return value } } @@ -185,6 +195,7 @@ func (iter *Iterator) readUint32(c byte) (ret uint32) { ind = intDigits[iter.buf[i]] if ind == invalidCharForNumber { iter.head = i + iter.assertInteger() return value } if value > uint32SafeToMultiply10 { @@ -199,6 +210,7 @@ func (iter *Iterator) readUint32(c byte) (ret uint32) { value = (value << 3) + (value << 1) + uint32(ind) } if !iter.loadMore() { + iter.assertInteger() return value } } @@ -229,13 +241,9 @@ func (iter *Iterator) ReadUint64() uint64 { } func (iter *Iterator) readUint64(c byte) (ret uint64) { - defer func() { - if iter.head < len(iter.buf) && iter.buf[iter.head] == '.' { - iter.ReportError("readUint64", "can not decode float as int") - } - }() ind := intDigits[c] if ind == 0 { + iter.assertInteger() return 0 // single zero } if ind == invalidCharForNumber { @@ -243,11 +251,73 @@ func (iter *Iterator) readUint64(c byte) (ret uint64) { return } value := uint64(ind) + if iter.tail-iter.head > 10 { + i := iter.head + ind2 := intDigits[iter.buf[i]] + if ind2 == invalidCharForNumber { + iter.head = i + iter.assertInteger() + return value + } + i++ + ind3 := intDigits[iter.buf[i]] + if ind3 == invalidCharForNumber { + iter.head = i + iter.assertInteger() + return value*10 + uint64(ind2) + } + //iter.head = i + 1 + //value = value * 100 + uint32(ind2) * 10 + uint32(ind3) + i++ + ind4 := intDigits[iter.buf[i]] + if ind4 == invalidCharForNumber { + iter.head = i + iter.assertInteger() + return value*100 + uint64(ind2)*10 + uint64(ind3) + } + i++ + ind5 := intDigits[iter.buf[i]] + if ind5 == invalidCharForNumber { + iter.head = i + iter.assertInteger() + return value*1000 + uint64(ind2)*100 + uint64(ind3)*10 + uint64(ind4) + } + i++ + ind6 := intDigits[iter.buf[i]] + if ind6 == invalidCharForNumber { + iter.head = i + iter.assertInteger() + return value*10000 + uint64(ind2)*1000 + uint64(ind3)*100 + uint64(ind4)*10 + uint64(ind5) + } + i++ + ind7 := intDigits[iter.buf[i]] + if ind7 == invalidCharForNumber { + iter.head = i + iter.assertInteger() + return value*100000 + uint64(ind2)*10000 + uint64(ind3)*1000 + uint64(ind4)*100 + uint64(ind5)*10 + uint64(ind6) + } + i++ + ind8 := intDigits[iter.buf[i]] + if ind8 == invalidCharForNumber { + iter.head = i + iter.assertInteger() + return value*1000000 + uint64(ind2)*100000 + uint64(ind3)*10000 + uint64(ind4)*1000 + uint64(ind5)*100 + uint64(ind6)*10 + uint64(ind7) + } + i++ + ind9 := intDigits[iter.buf[i]] + value = value*10000000 + uint64(ind2)*1000000 + uint64(ind3)*100000 + uint64(ind4)*10000 + uint64(ind5)*1000 + uint64(ind6)*100 + uint64(ind7)*10 + uint64(ind8) + iter.head = i + if ind9 == invalidCharForNumber { + iter.assertInteger() + return value + } + } for { for i := iter.head; i < iter.tail; i++ { ind = intDigits[iter.buf[i]] if ind == invalidCharForNumber { iter.head = i + iter.assertInteger() return value } if value > uint64SafeToMultiple10 { @@ -262,7 +332,14 @@ func (iter *Iterator) readUint64(c byte) (ret uint64) { value = (value << 3) + (value << 1) + uint64(ind) } if !iter.loadMore() { + iter.assertInteger() return value } } } + +func (iter *Iterator) assertInteger() { + if iter.head < len(iter.buf) && iter.buf[iter.head] == '.' { + iter.ReportError("assertInteger", "can not decode float as int") + } +} diff --git a/vendor/github.com/json-iterator/go/feature_iter_object.go b/vendor/github.com/json-iterator/go/iter_object.go similarity index 68% rename from vendor/github.com/json-iterator/go/feature_iter_object.go rename to vendor/github.com/json-iterator/go/iter_object.go index dfd91fa60..ebd3da895 100644 --- a/vendor/github.com/json-iterator/go/feature_iter_object.go +++ b/vendor/github.com/json-iterator/go/iter_object.go @@ -3,7 +3,6 @@ package jsoniter import ( "fmt" "unicode" - "unsafe" ) // ReadObject read one field from object. @@ -19,26 +18,6 @@ func (iter *Iterator) ReadObject() (ret string) { c = iter.nextToken() if c == '"' { iter.unreadByte() - if iter.cfg.objectFieldMustBeSimpleString { - return string(iter.readObjectFieldAsBytes()) - } else { - field := iter.ReadString() - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } - return field - } - } - if c == '}' { - return "" // end of object - } - iter.ReportError("ReadObject", `expect " after {, but found `+string([]byte{c})) - return - case ',': - if iter.cfg.objectFieldMustBeSimpleString { - return string(iter.readObjectFieldAsBytes()) - } else { field := iter.ReadString() c = iter.nextToken() if c != ':' { @@ -46,6 +25,18 @@ func (iter *Iterator) ReadObject() (ret string) { } return field } + if c == '}' { + return "" // end of object + } + iter.ReportError("ReadObject", `expect " after {, but found `+string([]byte{c})) + return + case ',': + field := iter.ReadString() + c = iter.nextToken() + if c != ':' { + iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) + } + return field case '}': return "" // end of object default: @@ -54,97 +45,87 @@ func (iter *Iterator) ReadObject() (ret string) { } } -func (iter *Iterator) readFieldHash() int32 { +// CaseInsensitive +func (iter *Iterator) readFieldHash() int64 { hash := int64(0x811c9dc5) c := iter.nextToken() - if c == '"' { - for { - for i := iter.head; i < iter.tail; i++ { - // require ascii string and no escape - b := iter.buf[i] - if !iter.cfg.objectFieldMustBeSimpleString && b == '\\' { - iter.head = i - for _, b := range iter.readStringSlowPath() { - if 'A' <= b && b <= 'Z' { - b += 'a' - 'A' - } - hash ^= int64(b) - hash *= 0x1000193 + if c != '"' { + iter.ReportError("readFieldHash", `expect ", but found `+string([]byte{c})) + return 0 + } + for { + for i := iter.head; i < iter.tail; i++ { + // require ascii string and no escape + b := iter.buf[i] + if b == '\\' { + iter.head = i + for _, b := range iter.readStringSlowPath() { + if 'A' <= b && b <= 'Z' { + b += 'a' - 'A' } - c = iter.nextToken() - if c != ':' { - iter.ReportError("readFieldHash", `expect :, but found `+string([]byte{c})) - return 0 - } - return int32(hash) + hash ^= int64(b) + hash *= 0x1000193 } - if b == '"' { - iter.head = i + 1 - c = iter.nextToken() - if c != ':' { - iter.ReportError("readFieldHash", `expect :, but found `+string([]byte{c})) - return 0 - } - return int32(hash) + c = iter.nextToken() + if c != ':' { + iter.ReportError("readFieldHash", `expect :, but found `+string([]byte{c})) + return 0 } - if 'A' <= b && b <= 'Z' { - b += 'a' - 'A' - } - hash ^= int64(b) - hash *= 0x1000193 + return hash } - if !iter.loadMore() { - iter.ReportError("readFieldHash", `incomplete field name`) - return 0 + if b == '"' { + iter.head = i + 1 + c = iter.nextToken() + if c != ':' { + iter.ReportError("readFieldHash", `expect :, but found `+string([]byte{c})) + return 0 + } + return hash } + if 'A' <= b && b <= 'Z' { + b += 'a' - 'A' + } + hash ^= int64(b) + hash *= 0x1000193 + } + if !iter.loadMore() { + iter.ReportError("readFieldHash", `incomplete field name`) + return 0 } } - iter.ReportError("readFieldHash", `expect ", but found `+string([]byte{c})) - return 0 } -func calcHash(str string) int32 { +func calcHash(str string) int64 { hash := int64(0x811c9dc5) for _, b := range str { hash ^= int64(unicode.ToLower(b)) hash *= 0x1000193 } - return int32(hash) + return int64(hash) } // ReadObjectCB read object with callback, the key is ascii only and field name not copied func (iter *Iterator) ReadObjectCB(callback func(*Iterator, string) bool) bool { c := iter.nextToken() - var fieldBytes []byte var field string if c == '{' { c = iter.nextToken() if c == '"' { iter.unreadByte() - if iter.cfg.objectFieldMustBeSimpleString { - fieldBytes = iter.readObjectFieldAsBytes() - field = *(*string)(unsafe.Pointer(&fieldBytes)) - } else { - field = iter.ReadString() - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } + field = iter.ReadString() + c = iter.nextToken() + if c != ':' { + iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) } if !callback(iter, field) { return false } c = iter.nextToken() for c == ',' { - if iter.cfg.objectFieldMustBeSimpleString { - fieldBytes = iter.readObjectFieldAsBytes() - field = *(*string)(unsafe.Pointer(&fieldBytes)) - } else { - field = iter.ReadString() - c = iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } + field = iter.ReadString() + c = iter.nextToken() + if c != ':' { + iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) } if !callback(iter, field) { return false diff --git a/vendor/github.com/json-iterator/go/feature_iter_skip.go b/vendor/github.com/json-iterator/go/iter_skip.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_iter_skip.go rename to vendor/github.com/json-iterator/go/iter_skip.go diff --git a/vendor/github.com/json-iterator/go/feature_iter_skip_sloppy.go b/vendor/github.com/json-iterator/go/iter_skip_sloppy.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_iter_skip_sloppy.go rename to vendor/github.com/json-iterator/go/iter_skip_sloppy.go diff --git a/vendor/github.com/json-iterator/go/jsoniter_sloppy_test.go b/vendor/github.com/json-iterator/go/iter_skip_sloppy_test.go similarity index 99% rename from vendor/github.com/json-iterator/go/jsoniter_sloppy_test.go rename to vendor/github.com/json-iterator/go/iter_skip_sloppy_test.go index 487713ae7..bcb491fe6 100644 --- a/vendor/github.com/json-iterator/go/jsoniter_sloppy_test.go +++ b/vendor/github.com/json-iterator/go/iter_skip_sloppy_test.go @@ -1,4 +1,4 @@ -//+build jsoniter-sloppy +//+build jsoniter_sloppy package jsoniter diff --git a/vendor/github.com/json-iterator/go/feature_iter_skip_strict.go b/vendor/github.com/json-iterator/go/iter_skip_strict.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_iter_skip_strict.go rename to vendor/github.com/json-iterator/go/iter_skip_strict.go diff --git a/vendor/github.com/json-iterator/go/feature_iter_string.go b/vendor/github.com/json-iterator/go/iter_str.go similarity index 100% rename from vendor/github.com/json-iterator/go/feature_iter_string.go rename to vendor/github.com/json-iterator/go/iter_str.go diff --git a/vendor/github.com/json-iterator/go/jsoniter_1dot8_only_test.go b/vendor/github.com/json-iterator/go/jsoniter_1dot8_only_test.go deleted file mode 100644 index 1ac618653..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_1dot8_only_test.go +++ /dev/null @@ -1,45 +0,0 @@ -// +build go1.8 - -package jsoniter - -import ( - "bytes" - "encoding/json" - "testing" - "unicode/utf8" - - "github.com/stretchr/testify/require" -) - -func Test_new_encoder(t *testing.T) { - should := require.New(t) - buf1 := &bytes.Buffer{} - encoder1 := json.NewEncoder(buf1) - encoder1.SetEscapeHTML(false) - encoder1.Encode([]int{1}) - should.Equal("[1]\n", buf1.String()) - buf2 := &bytes.Buffer{} - encoder2 := NewEncoder(buf2) - encoder2.SetEscapeHTML(false) - encoder2.Encode([]int{1}) - should.Equal("[1]\n", buf2.String()) -} - -func Test_string_encode_with_std_without_html_escape(t *testing.T) { - api := Config{EscapeHTML: false}.Froze() - should := require.New(t) - for i := 0; i < utf8.RuneSelf; i++ { - input := string([]byte{byte(i)}) - buf := &bytes.Buffer{} - encoder := json.NewEncoder(buf) - encoder.SetEscapeHTML(false) - err := encoder.Encode(input) - should.Nil(err) - stdOutput := buf.String() - stdOutput = stdOutput[:len(stdOutput)-1] - jsoniterOutputBytes, err := api.Marshal(input) - should.Nil(err) - jsoniterOutput := string(jsoniterOutputBytes) - should.Equal(stdOutput, jsoniterOutput) - } -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_adapter_test.go b/vendor/github.com/json-iterator/go/jsoniter_adapter_test.go deleted file mode 100644 index 30f03deb6..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_adapter_test.go +++ /dev/null @@ -1,84 +0,0 @@ -package jsoniter - -import ( - "bytes" - "encoding/json" - "github.com/stretchr/testify/require" - "io/ioutil" - "testing" -) - -func Test_new_decoder(t *testing.T) { - should := require.New(t) - decoder1 := json.NewDecoder(bytes.NewBufferString(`[1][2]`)) - decoder2 := NewDecoder(bytes.NewBufferString(`[1][2]`)) - arr1 := []int{} - should.Nil(decoder1.Decode(&arr1)) - should.Equal([]int{1}, arr1) - arr2 := []int{} - should.True(decoder1.More()) - buffered, _ := ioutil.ReadAll(decoder1.Buffered()) - should.Equal("[2]", string(buffered)) - should.Nil(decoder2.Decode(&arr2)) - should.Equal([]int{1}, arr2) - should.True(decoder2.More()) - buffered, _ = ioutil.ReadAll(decoder2.Buffered()) - should.Equal("[2]", string(buffered)) - - should.Nil(decoder1.Decode(&arr1)) - should.Equal([]int{2}, arr1) - should.False(decoder1.More()) - should.Nil(decoder2.Decode(&arr2)) - should.Equal([]int{2}, arr2) - should.False(decoder2.More()) -} - -func Test_use_number(t *testing.T) { - should := require.New(t) - decoder1 := json.NewDecoder(bytes.NewBufferString(`123`)) - decoder1.UseNumber() - decoder2 := NewDecoder(bytes.NewBufferString(`123`)) - decoder2.UseNumber() - var obj1 interface{} - should.Nil(decoder1.Decode(&obj1)) - should.Equal(json.Number("123"), obj1) - var obj2 interface{} - should.Nil(decoder2.Decode(&obj2)) - should.Equal(json.Number("123"), obj2) -} - -func Test_use_number_for_unmarshal(t *testing.T) { - should := require.New(t) - api := Config{UseNumber: true}.Froze() - var obj interface{} - should.Nil(api.UnmarshalFromString("123", &obj)) - should.Equal(json.Number("123"), obj) -} - -func Test_marshal_indent(t *testing.T) { - should := require.New(t) - obj := struct { - F1 int - F2 []int - }{1, []int{2, 3, 4}} - output, err := json.MarshalIndent(obj, "", " ") - should.Nil(err) - should.Equal("{\n \"F1\": 1,\n \"F2\": [\n 2,\n 3,\n 4\n ]\n}", string(output)) - output, err = MarshalIndent(obj, "", " ") - should.Nil(err) - should.Equal("{\n \"F1\": 1,\n \"F2\": [\n 2,\n 3,\n 4\n ]\n}", string(output)) -} - -func Test_marshal_indent_map(t *testing.T) { - should := require.New(t) - obj := map[int]int{1: 2} - output, err := json.MarshalIndent(obj, "", " ") - should.Nil(err) - should.Equal("{\n \"1\": 2\n}", string(output)) - output, err = MarshalIndent(obj, "", " ") - should.Nil(err) - should.Equal("{\n \"1\": 2\n}", string(output)) - output, err = ConfigCompatibleWithStandardLibrary.MarshalIndent(obj, "", " ") - should.Nil(err) - should.Equal("{\n \"1\": 2\n}", string(output)) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_alias_test.go b/vendor/github.com/json-iterator/go/jsoniter_alias_test.go deleted file mode 100644 index 246651f75..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_alias_test.go +++ /dev/null @@ -1,62 +0,0 @@ -package jsoniter - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func Test_alias(t *testing.T) { - should := require.New(t) - type myint int - type myint8 int8 - type myint16 int16 - type myint32 int32 - type myint64 int64 - type myuint uint - type myuint8 uint8 - type myuint16 uint16 - type myuint32 uint32 - type myuint64 uint64 - type myfloat32 float32 - type myfloat64 float64 - type mystring string - type mybool bool - type myuintptr uintptr - var a struct { - A myint8 `json:"a"` - B myint16 `json:"stream"` - C myint32 `json:"c"` - D myint64 `json:"d"` - E myuint8 `json:"e"` - F myuint16 `json:"f"` - G myuint32 `json:"g"` - H myuint64 `json:"h"` - I myfloat32 `json:"i"` - J myfloat64 `json:"j"` - K mystring `json:"k"` - L myint `json:"l"` - M myuint `json:"m"` - N mybool `json:"n"` - O myuintptr `json:"o"` - } - - should.Nil(UnmarshalFromString(`{"a" : 1, "stream" : 1, "c": 1, "d" : 1, "e" : 1, "f" : 1, "g" : 1, "h": 1, "i" : 1, "j" : 1, "k" :"xxxx", "l" : 1, "m":1, "n": true, "o" : 1}`, &a)) - should.Equal(myfloat32(1), a.I) - should.Equal(myfloat64(1), a.J) - should.Equal(myint8(1), a.A) - should.Equal(myint16(1), a.B) - should.Equal(myint32(1), a.C) - should.Equal(myint64(1), a.D) - should.Equal(myuint8(1), a.E) - should.Equal(myuint16(1), a.F) - should.Equal(myuint32(1), a.G) - should.Equal(myuint64(1), a.H) - should.Equal(mystring("xxxx"), a.K) - should.Equal(mybool(true), a.N) - should.Equal(myuintptr(1), a.O) - b, err := Marshal(a) - should.Nil(err) - should.Equal(`{"a":1,"stream":1,"c":1,"d":1,"e":1,"f":1,"g":1,"h":1,"i":1,"j":1,"k":"xxxx","l":1,"m":1,"n":true,"o":1}`, string(b)) - -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_any_array_test.go b/vendor/github.com/json-iterator/go/jsoniter_any_array_test.go deleted file mode 100644 index dbffd822d..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_any_array_test.go +++ /dev/null @@ -1,122 +0,0 @@ -package jsoniter - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func Test_read_empty_array_as_any(t *testing.T) { - should := require.New(t) - any := Get([]byte("[]")) - should.Equal(ArrayValue, any.Get().ValueType()) - should.Equal(InvalidValue, any.Get(0.3).ValueType()) - should.Equal(0, any.Size()) - should.Equal(ArrayValue, any.ValueType()) - should.Nil(any.LastError()) - should.Equal(0, any.ToInt()) - should.Equal(int32(0), any.ToInt32()) - should.Equal(int64(0), any.ToInt64()) - should.Equal(uint(0), any.ToUint()) - should.Equal(uint32(0), any.ToUint32()) - should.Equal(uint64(0), any.ToUint64()) - should.Equal(float32(0), any.ToFloat32()) - should.Equal(float64(0), any.ToFloat64()) -} - -func Test_read_one_element_array_as_any(t *testing.T) { - should := require.New(t) - any := Get([]byte("[1]")) - should.Equal(1, any.Size()) -} - -func Test_read_two_element_array_as_any(t *testing.T) { - should := require.New(t) - any := Get([]byte("[1,2]")) - should.Equal(1, any.Get(0).ToInt()) - should.Equal(2, any.Size()) - should.True(any.ToBool()) - should.Equal(1, any.ToInt()) - should.Equal([]interface{}{float64(1), float64(2)}, any.GetInterface()) - stream := NewStream(ConfigDefault, nil, 32) - any.WriteTo(stream) - should.Equal("[1,2]", string(stream.Buffer())) - arr := []int{} - any.ToVal(&arr) - should.Equal([]int{1, 2}, arr) -} - -func Test_wrap_array_and_convert_to_any(t *testing.T) { - should := require.New(t) - any := Wrap([]int{1, 2, 3}) - any2 := Wrap([]int{}) - - should.Equal("[1,2,3]", any.ToString()) - should.True(any.ToBool()) - should.False(any2.ToBool()) - - should.Equal(1, any.ToInt()) - should.Equal(0, any2.ToInt()) - should.Equal(int32(1), any.ToInt32()) - should.Equal(int32(0), any2.ToInt32()) - should.Equal(int64(1), any.ToInt64()) - should.Equal(int64(0), any2.ToInt64()) - should.Equal(uint(1), any.ToUint()) - should.Equal(uint(0), any2.ToUint()) - should.Equal(uint32(1), any.ToUint32()) - should.Equal(uint32(0), any2.ToUint32()) - should.Equal(uint64(1), any.ToUint64()) - should.Equal(uint64(0), any2.ToUint64()) - should.Equal(float32(1), any.ToFloat32()) - should.Equal(float32(0), any2.ToFloat32()) - should.Equal(float64(1), any.ToFloat64()) - should.Equal(float64(0), any2.ToFloat64()) - should.Equal(3, any.Size()) - should.Equal(0, any2.Size()) - - var i interface{} = []int{1, 2, 3} - should.Equal(i, any.GetInterface()) -} - -func Test_array_lazy_any_get(t *testing.T) { - should := require.New(t) - any := Get([]byte("[1,[2,3],4]")) - should.Equal(3, any.Get(1, 1).ToInt()) - should.Equal("[1,[2,3],4]", any.ToString()) -} - -func Test_array_lazy_any_get_all(t *testing.T) { - should := require.New(t) - any := Get([]byte("[[1],[2],[3,4]]")) - should.Equal("[1,2,3]", any.Get('*', 0).ToString()) - any = Get([]byte("[[[1],[2],[3,4]]]"), 0, '*', 0) - should.Equal("[1,2,3]", any.ToString()) -} - -func Test_array_wrapper_any_get_all(t *testing.T) { - should := require.New(t) - any := wrapArray([][]int{ - {1, 2}, - {3, 4}, - {5, 6}, - }) - should.Equal("[1,3,5]", any.Get('*', 0).ToString()) - should.Equal(ArrayValue, any.ValueType()) - should.True(any.ToBool()) - should.Equal(1, any.Get(0, 0).ToInt()) -} - -func Test_array_lazy_any_get_invalid(t *testing.T) { - should := require.New(t) - any := Get([]byte("[]")) - should.Equal(InvalidValue, any.Get(1, 1).ValueType()) - should.NotNil(any.Get(1, 1).LastError()) - should.Equal(InvalidValue, any.Get("1").ValueType()) - should.NotNil(any.Get("1").LastError()) -} - -func Test_invalid_array(t *testing.T) { - should := require.New(t) - any := Get([]byte("["), 0) - should.Equal(InvalidValue, any.ValueType()) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_any_bool_test.go b/vendor/github.com/json-iterator/go/jsoniter_any_bool_test.go deleted file mode 100644 index a71743a64..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_any_bool_test.go +++ /dev/null @@ -1,64 +0,0 @@ -package jsoniter - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/require" -) - -var boolConvertMap = map[string]bool{ - "null": false, - "true": true, - "false": false, - - `"true"`: true, - `"false"`: true, - - "123": true, - `"123"`: true, - "0": false, - `"0"`: false, - "-1": true, - `"-1"`: true, - - "1.1": true, - "0.0": false, - "-1.1": true, - `""`: false, - "[1,2]": true, - "[]": false, - "{}": true, - `{"abc":1}`: true, -} - -func Test_read_bool_as_any(t *testing.T) { - should := require.New(t) - - var any Any - for k, v := range boolConvertMap { - any = Get([]byte(k)) - if v { - should.True(any.ToBool(), fmt.Sprintf("origin val is %v", k)) - } else { - should.False(any.ToBool(), fmt.Sprintf("origin val is %v", k)) - } - } - -} - -func Test_write_bool_to_stream(t *testing.T) { - should := require.New(t) - any := Get([]byte("true")) - stream := NewStream(ConfigDefault, nil, 32) - any.WriteTo(stream) - should.Equal("true", string(stream.Buffer())) - should.Equal(any.ValueType(), BoolValue) - - any = Get([]byte("false")) - stream = NewStream(ConfigDefault, nil, 32) - any.WriteTo(stream) - should.Equal("false", string(stream.Buffer())) - - should.Equal(any.ValueType(), BoolValue) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_any_float_test.go b/vendor/github.com/json-iterator/go/jsoniter_any_float_test.go deleted file mode 100644 index 391ac32a8..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_any_float_test.go +++ /dev/null @@ -1,102 +0,0 @@ -package jsoniter - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -var floatConvertMap = map[string]float64{ - "null": 0, - "true": 1, - "false": 0, - - `"true"`: 0, - `"false"`: 0, - - "1e1": 10, - "1e+1": 10, - "1e-1": .1, - "1E1": 10, - "1E+1": 10, - "1E-1": .1, - - "-1e1": -10, - "-1e+1": -10, - "-1e-1": -.1, - "-1E1": -10, - "-1E+1": -10, - "-1E-1": -.1, - - `"1e1"`: 10, - `"1e+1"`: 10, - `"1e-1"`: .1, - `"1E1"`: 10, - `"1E+1"`: 10, - `"1E-1"`: .1, - - `"-1e1"`: -10, - `"-1e+1"`: -10, - `"-1e-1"`: -.1, - `"-1E1"`: -10, - `"-1E+1"`: -10, - `"-1E-1"`: -.1, - - "123": 123, - `"123true"`: 123, - `"+"`: 0, - `"-"`: 0, - - `"-123true"`: -123, - `"-99.9true"`: -99.9, - "0": 0, - `"0"`: 0, - "-1": -1, - - "1.1": 1.1, - "0.0": 0, - "-1.1": -1.1, - `"+1.1"`: 1.1, - `""`: 0, - "[1,2]": 1, - "[]": 0, - "{}": 0, - `{"abc":1}`: 0, -} - -func Test_read_any_to_float(t *testing.T) { - should := require.New(t) - for k, v := range floatConvertMap { - any := Get([]byte(k)) - should.Equal(float64(v), any.ToFloat64(), "the original val is "+k) - } - - for k, v := range floatConvertMap { - any := Get([]byte(k)) - should.Equal(float32(v), any.ToFloat32(), "the original val is "+k) - } -} - -func Test_read_float_to_any(t *testing.T) { - should := require.New(t) - any := WrapFloat64(12.3) - anyFloat64 := float64(12.3) - //negaAnyFloat64 := float64(-1.1) - any2 := WrapFloat64(-1.1) - should.Equal(float64(12.3), any.ToFloat64()) - //should.Equal("12.3", any.ToString()) - should.True(any.ToBool()) - should.Equal(float32(anyFloat64), any.ToFloat32()) - should.Equal(int(anyFloat64), any.ToInt()) - should.Equal(int32(anyFloat64), any.ToInt32()) - should.Equal(int64(anyFloat64), any.ToInt64()) - should.Equal(uint(anyFloat64), any.ToUint()) - should.Equal(uint32(anyFloat64), any.ToUint32()) - should.Equal(uint64(anyFloat64), any.ToUint64()) - should.Equal(uint(0), any2.ToUint()) - should.Equal(uint32(0), any2.ToUint32()) - should.Equal(uint64(0), any2.ToUint64()) - should.Equal(any.ValueType(), NumberValue) - - should.Equal("1.23E+01", any.ToString()) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_any_int_test.go b/vendor/github.com/json-iterator/go/jsoniter_any_int_test.go deleted file mode 100644 index 232808528..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_any_int_test.go +++ /dev/null @@ -1,197 +0,0 @@ -package jsoniter - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/require" -) - -var intConvertMap = map[string]int{ - "null": 0, - "321.1": 321, - "-321.1": -321, - `"1.1"`: 1, - `"-321.1"`: -321, - "0.0": 0, - "0": 0, - `"0"`: 0, - `"0.0"`: 0, - "-1.1": -1, - "true": 1, - "false": 0, - `"true"`: 0, - `"false"`: 0, - `"true123"`: 0, - `"123true"`: 123, - `"-123true"`: -123, - `"1.2332e6"`: 1, - `""`: 0, - "+": 0, - "-": 0, - "[]": 0, - "[1,2]": 1, - `["1","2"]`: 1, - // object in php cannot convert to int - "{}": 0, -} - -func Test_read_any_to_int(t *testing.T) { - should := require.New(t) - - // int - for k, v := range intConvertMap { - any := Get([]byte(k)) - should.Equal(v, any.ToInt(), fmt.Sprintf("origin val %v", k)) - } - - // int32 - for k, v := range intConvertMap { - any := Get([]byte(k)) - should.Equal(int32(v), any.ToInt32(), fmt.Sprintf("original val is %v", k)) - } - - // int64 - for k, v := range intConvertMap { - any := Get([]byte(k)) - should.Equal(int64(v), any.ToInt64(), fmt.Sprintf("original val is %v", k)) - } - -} - -var uintConvertMap = map[string]int{ - "null": 0, - "321.1": 321, - `"1.1"`: 1, - `"-123.1"`: 0, - "0.0": 0, - "0": 0, - `"0"`: 0, - `"0.0"`: 0, - `"00.0"`: 0, - "true": 1, - "false": 0, - `"true"`: 0, - `"false"`: 0, - `"true123"`: 0, - `"+1"`: 1, - `"123true"`: 123, - `"-123true"`: 0, - `"1.2332e6"`: 1, - `""`: 0, - "+": 0, - "-": 0, - ".": 0, - "[]": 0, - "[1,2]": 1, - "{}": 0, - "{1,2}": 0, - "-1.1": 0, - "-321.1": 0, -} - -func Test_read_any_to_uint(t *testing.T) { - should := require.New(t) - - for k, v := range uintConvertMap { - any := Get([]byte(k)) - should.Equal(uint64(v), any.ToUint64(), fmt.Sprintf("origin val %v", k)) - } - - for k, v := range uintConvertMap { - any := Get([]byte(k)) - should.Equal(uint32(v), any.ToUint32(), fmt.Sprintf("origin val %v", k)) - } - - for k, v := range uintConvertMap { - any := Get([]byte(k)) - should.Equal(uint(v), any.ToUint(), fmt.Sprintf("origin val %v", k)) - } - -} - -func Test_read_int64_to_any(t *testing.T) { - should := require.New(t) - any := WrapInt64(12345) - should.Equal(12345, any.ToInt()) - should.Equal(int32(12345), any.ToInt32()) - should.Equal(int64(12345), any.ToInt64()) - should.Equal(uint(12345), any.ToUint()) - should.Equal(uint32(12345), any.ToUint32()) - should.Equal(uint64(12345), any.ToUint64()) - should.Equal(float32(12345), any.ToFloat32()) - should.Equal(float64(12345), any.ToFloat64()) - should.Equal("12345", any.ToString()) - should.Equal(true, any.ToBool()) - should.Equal(any.ValueType(), NumberValue) - stream := NewStream(ConfigDefault, nil, 32) - any.WriteTo(stream) - should.Equal("12345", string(stream.Buffer())) -} -func Test_read_int32_to_any(t *testing.T) { - should := require.New(t) - any := WrapInt32(12345) - should.Equal(12345, any.ToInt()) - should.Equal(int32(12345), any.ToInt32()) - should.Equal(int64(12345), any.ToInt64()) - should.Equal(uint(12345), any.ToUint()) - should.Equal(uint32(12345), any.ToUint32()) - should.Equal(uint64(12345), any.ToUint64()) - should.Equal(float32(12345), any.ToFloat32()) - should.Equal(float64(12345), any.ToFloat64()) - should.Equal("12345", any.ToString()) - should.Equal(true, any.ToBool()) - should.Equal(any.ValueType(), NumberValue) - stream := NewStream(ConfigDefault, nil, 32) - any.WriteTo(stream) - should.Equal("12345", string(stream.Buffer())) -} - -func Test_read_uint32_to_any(t *testing.T) { - should := require.New(t) - any := WrapUint32(12345) - should.Equal(12345, any.ToInt()) - should.Equal(int32(12345), any.ToInt32()) - should.Equal(int64(12345), any.ToInt64()) - should.Equal(uint(12345), any.ToUint()) - should.Equal(uint32(12345), any.ToUint32()) - should.Equal(uint64(12345), any.ToUint64()) - should.Equal(float32(12345), any.ToFloat32()) - should.Equal(float64(12345), any.ToFloat64()) - should.Equal("12345", any.ToString()) - should.Equal(true, any.ToBool()) - should.Equal(any.ValueType(), NumberValue) - stream := NewStream(ConfigDefault, nil, 32) - any.WriteTo(stream) - should.Equal("12345", string(stream.Buffer())) -} - -func Test_read_uint64_to_any(t *testing.T) { - should := require.New(t) - any := WrapUint64(12345) - should.Equal(12345, any.ToInt()) - should.Equal(int32(12345), any.ToInt32()) - should.Equal(int64(12345), any.ToInt64()) - should.Equal(uint(12345), any.ToUint()) - should.Equal(uint32(12345), any.ToUint32()) - should.Equal(uint64(12345), any.ToUint64()) - should.Equal(float32(12345), any.ToFloat32()) - should.Equal(float64(12345), any.ToFloat64()) - should.Equal("12345", any.ToString()) - should.Equal(true, any.ToBool()) - should.Equal(any.ValueType(), NumberValue) - stream := NewStream(ConfigDefault, nil, 32) - any.WriteTo(stream) - should.Equal("12345", string(stream.Buffer())) - stream = NewStream(ConfigDefault, nil, 32) - stream.WriteUint(uint(123)) - should.Equal("123", string(stream.Buffer())) -} - -func Test_int_lazy_any_get(t *testing.T) { - should := require.New(t) - any := Get([]byte("1234")) - // panic!! - //should.Equal(any.LastError(), io.EOF) - should.Equal(InvalidValue, any.Get(1, "2").ValueType()) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_any_map_test.go b/vendor/github.com/json-iterator/go/jsoniter_any_map_test.go deleted file mode 100644 index f93ea4e61..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_any_map_test.go +++ /dev/null @@ -1,14 +0,0 @@ -package jsoniter - -import ( - "github.com/stretchr/testify/require" - "testing" -) - -func Test_wrap_map(t *testing.T) { - should := require.New(t) - any := Wrap(map[string]string{"Field1": "hello"}) - should.Equal("hello", any.Get("Field1").ToString()) - any = Wrap(map[string]string{"Field1": "hello"}) - should.Equal(1, any.Size()) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_any_null_test.go b/vendor/github.com/json-iterator/go/jsoniter_any_null_test.go deleted file mode 100644 index eb09497b9..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_any_null_test.go +++ /dev/null @@ -1,15 +0,0 @@ -package jsoniter - -import ( - "github.com/stretchr/testify/require" - "testing" -) - -func Test_read_null_as_any(t *testing.T) { - should := require.New(t) - any := Get([]byte(`null`)) - should.Equal(0, any.ToInt()) - should.Equal(float64(0), any.ToFloat64()) - should.Equal("", any.ToString()) - should.False(any.ToBool()) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_any_object_test.go b/vendor/github.com/json-iterator/go/jsoniter_any_object_test.go deleted file mode 100644 index 9b215f95e..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_any_object_test.go +++ /dev/null @@ -1,107 +0,0 @@ -package jsoniter - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func Test_read_object_as_any(t *testing.T) { - should := require.New(t) - any := Get([]byte(`{"a":"stream","c":"d"}`)) - should.Equal(`{"a":"stream","c":"d"}`, any.ToString()) - // partial parse - should.Equal("stream", any.Get("a").ToString()) - should.Equal("d", any.Get("c").ToString()) - should.Equal(2, len(any.Keys())) - any = Get([]byte(`{"a":"stream","c":"d"}`)) - // full parse - should.Equal(2, len(any.Keys())) - should.Equal(2, any.Size()) - should.True(any.ToBool()) - should.Equal(0, any.ToInt()) - should.Equal(ObjectValue, any.ValueType()) - should.Nil(any.LastError()) - obj := struct { - A string - }{} - any.ToVal(&obj) - should.Equal("stream", obj.A) -} - -func Test_object_lazy_any_get(t *testing.T) { - should := require.New(t) - any := Get([]byte(`{"a":{"stream":{"c":"d"}}}`)) - should.Equal("d", any.Get("a", "stream", "c").ToString()) -} - -func Test_object_lazy_any_get_all(t *testing.T) { - should := require.New(t) - any := Get([]byte(`{"a":[0],"stream":[1]}`)) - should.Contains(any.Get('*', 0).ToString(), `"a":0`) -} - -func Test_object_lazy_any_get_invalid(t *testing.T) { - should := require.New(t) - any := Get([]byte(`{}`)) - should.Equal(InvalidValue, any.Get("a", "stream", "c").ValueType()) - should.Equal(InvalidValue, any.Get(1).ValueType()) -} - -func Test_wrap_map_and_convert_to_any(t *testing.T) { - should := require.New(t) - any := Wrap(map[string]interface{}{"a": 1}) - should.True(any.ToBool()) - should.Equal(0, any.ToInt()) - should.Equal(int32(0), any.ToInt32()) - should.Equal(int64(0), any.ToInt64()) - should.Equal(float32(0), any.ToFloat32()) - should.Equal(float64(0), any.ToFloat64()) - should.Equal(uint(0), any.ToUint()) - should.Equal(uint32(0), any.ToUint32()) - should.Equal(uint64(0), any.ToUint64()) -} - -func Test_wrap_object_and_convert_to_any(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - field2 string - } - any := Wrap(TestObject{"hello", "world"}) - should.Equal("hello", any.Get("Field1").ToString()) - any = Wrap(TestObject{"hello", "world"}) - should.Equal(2, any.Size()) - should.Equal(`{"Field1":"hello"}`, any.Get('*').ToString()) - - should.Equal(0, any.ToInt()) - should.Equal(int32(0), any.ToInt32()) - should.Equal(int64(0), any.ToInt64()) - should.Equal(float32(0), any.ToFloat32()) - should.Equal(float64(0), any.ToFloat64()) - should.Equal(uint(0), any.ToUint()) - should.Equal(uint32(0), any.ToUint32()) - should.Equal(uint64(0), any.ToUint64()) - should.True(any.ToBool()) - should.Equal(`{"Field1":"hello"}`, any.ToString()) - - // cannot pass! - //stream := NewStream(ConfigDefault, nil, 32) - //any.WriteTo(stream) - //should.Equal(`{"Field1":"hello"}`, string(stream.Buffer())) - // cannot pass! - -} - -func Test_any_within_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 Any - Field2 Any - } - obj := TestObject{} - err := UnmarshalFromString(`{"Field1": "hello", "Field2": [1,2,3]}`, &obj) - should.Nil(err) - should.Equal("hello", obj.Field1.ToString()) - should.Equal("[1,2,3]", obj.Field2.ToString()) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_any_string_test.go b/vendor/github.com/json-iterator/go/jsoniter_any_string_test.go deleted file mode 100644 index 119f7d27d..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_any_string_test.go +++ /dev/null @@ -1,56 +0,0 @@ -package jsoniter - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -var stringConvertMap = map[string]string{ - "null": "", - "321.1": "321.1", - `"1.1"`: "1.1", - `"-123.1"`: "-123.1", - "0.0": "0.0", - "0": "0", - `"0"`: "0", - `"0.0"`: "0.0", - `"00.0"`: "00.0", - "true": "true", - "false": "false", - `"true"`: "true", - `"false"`: "false", - `"true123"`: "true123", - `"+1"`: "+1", - "[]": "[]", - "[1,2]": "[1,2]", - "{}": "{}", - `{"a":1, "stream":true}`: `{"a":1, "stream":true}`, -} - -func Test_read_any_to_string(t *testing.T) { - should := require.New(t) - for k, v := range stringConvertMap { - any := Get([]byte(k)) - should.Equal(v, any.ToString(), "original val "+k) - } -} - -func Test_read_string_as_any(t *testing.T) { - should := require.New(t) - any := Get([]byte(`"hello"`)) - should.Equal("hello", any.ToString()) - should.True(any.ToBool()) - any = Get([]byte(`" "`)) - should.False(any.ToBool()) - any = Get([]byte(`"false"`)) - should.True(any.ToBool()) - any = Get([]byte(`"123"`)) - should.Equal(123, any.ToInt()) -} - -func Test_wrap_string(t *testing.T) { - should := require.New(t) - any := WrapString("123") - should.Equal(123, any.ToInt()) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_array_test.go b/vendor/github.com/json-iterator/go/jsoniter_array_test.go deleted file mode 100644 index 0f71ecb68..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_array_test.go +++ /dev/null @@ -1,213 +0,0 @@ -package jsoniter - -import ( - "bytes" - "encoding/json" - "github.com/stretchr/testify/require" - "testing" -) - -func Test_empty_array(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `[]`) - cont := iter.ReadArray() - should.False(cont) - iter = ParseString(ConfigDefault, `[]`) - iter.ReadArrayCB(func(iter *Iterator) bool { - should.FailNow("should not call") - return true - }) -} - -func Test_one_element(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `[1]`) - should.True(iter.ReadArray()) - should.Equal(1, iter.ReadInt()) - should.False(iter.ReadArray()) - iter = ParseString(ConfigDefault, `[1]`) - iter.ReadArrayCB(func(iter *Iterator) bool { - should.Equal(1, iter.ReadInt()) - return true - }) -} - -func Test_two_elements(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `[1,2]`) - should.True(iter.ReadArray()) - should.Equal(int64(1), iter.ReadInt64()) - should.True(iter.ReadArray()) - should.Equal(int64(2), iter.ReadInt64()) - should.False(iter.ReadArray()) - iter = ParseString(ConfigDefault, `[1,2]`) - should.Equal([]interface{}{float64(1), float64(2)}, iter.Read()) -} - -func Test_whitespace_in_head(t *testing.T) { - iter := ParseString(ConfigDefault, ` [1]`) - cont := iter.ReadArray() - if cont != true { - t.FailNow() - } - if iter.ReadUint64() != 1 { - t.FailNow() - } -} - -func Test_whitespace_after_array_start(t *testing.T) { - iter := ParseString(ConfigDefault, `[ 1]`) - cont := iter.ReadArray() - if cont != true { - t.FailNow() - } - if iter.ReadUint64() != 1 { - t.FailNow() - } -} - -func Test_whitespace_before_array_end(t *testing.T) { - iter := ParseString(ConfigDefault, `[1 ]`) - cont := iter.ReadArray() - if cont != true { - t.FailNow() - } - if iter.ReadUint64() != 1 { - t.FailNow() - } - cont = iter.ReadArray() - if cont != false { - t.FailNow() - } -} - -func Test_whitespace_before_comma(t *testing.T) { - iter := ParseString(ConfigDefault, `[1 ,2]`) - cont := iter.ReadArray() - if cont != true { - t.FailNow() - } - if iter.ReadUint64() != 1 { - t.FailNow() - } - cont = iter.ReadArray() - if cont != true { - t.FailNow() - } - if iter.ReadUint64() != 2 { - t.FailNow() - } - cont = iter.ReadArray() - if cont != false { - t.FailNow() - } -} - -func Test_write_array(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(Config{IndentionStep: 2}.Froze(), buf, 4096) - stream.WriteArrayStart() - stream.WriteInt(1) - stream.WriteMore() - stream.WriteInt(2) - stream.WriteArrayEnd() - stream.Flush() - should.Nil(stream.Error) - should.Equal("[\n 1,\n 2\n]", buf.String()) -} - -func Test_write_val_array(t *testing.T) { - should := require.New(t) - val := []int{1, 2, 3} - str, err := MarshalToString(&val) - should.Nil(err) - should.Equal("[1,2,3]", str) -} - -func Test_write_val_empty_array(t *testing.T) { - should := require.New(t) - val := []int{} - str, err := MarshalToString(val) - should.Nil(err) - should.Equal("[]", str) -} - -func Test_write_array_of_interface_in_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field []interface{} - Field2 string - } - val := TestObject{[]interface{}{1, 2}, ""} - str, err := MarshalToString(val) - should.Nil(err) - should.Contains(str, `"Field":[1,2]`) - should.Contains(str, `"Field2":""`) -} - -func Test_encode_byte_array(t *testing.T) { - should := require.New(t) - bytes, err := json.Marshal([]byte{1, 2, 3}) - should.Nil(err) - should.Equal(`"AQID"`, string(bytes)) - bytes, err = Marshal([]byte{1, 2, 3}) - should.Nil(err) - should.Equal(`"AQID"`, string(bytes)) -} - -func Test_decode_byte_array_from_base64(t *testing.T) { - should := require.New(t) - data := []byte{} - err := json.Unmarshal([]byte(`"AQID"`), &data) - should.Nil(err) - should.Equal([]byte{1, 2, 3}, data) - err = Unmarshal([]byte(`"AQID"`), &data) - should.Nil(err) - should.Equal([]byte{1, 2, 3}, data) -} - -func Test_decode_byte_array_from_array(t *testing.T) { - should := require.New(t) - data := []byte{} - err := json.Unmarshal([]byte(`[1,2,3]`), &data) - should.Nil(err) - should.Equal([]byte{1, 2, 3}, data) - err = Unmarshal([]byte(`[1,2,3]`), &data) - should.Nil(err) - should.Equal([]byte{1, 2, 3}, data) -} - -func Test_decode_slice(t *testing.T) { - should := require.New(t) - slice := make([]string, 0, 5) - UnmarshalFromString(`["hello", "world"]`, &slice) - should.Equal([]string{"hello", "world"}, slice) -} - -func Test_decode_large_slice(t *testing.T) { - should := require.New(t) - slice := make([]int, 0, 1) - UnmarshalFromString(`[1,2,3,4,5,6,7,8,9]`, &slice) - should.Equal([]int{1, 2, 3, 4, 5, 6, 7, 8, 9}, slice) -} - -func Benchmark_jsoniter_array(b *testing.B) { - b.ReportAllocs() - input := []byte(`[1,2,3,4,5,6,7,8,9]`) - iter := ParseBytes(ConfigDefault, input) - b.ResetTimer() - for n := 0; n < b.N; n++ { - iter.ResetBytes(input) - for iter.ReadArray() { - iter.ReadUint64() - } - } -} - -func Benchmark_json_array(b *testing.B) { - for n := 0; n < b.N; n++ { - result := []interface{}{} - json.Unmarshal([]byte(`[1,2,3]`), &result) - } -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_bool_test.go b/vendor/github.com/json-iterator/go/jsoniter_bool_test.go deleted file mode 100644 index 461b88ba3..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_bool_test.go +++ /dev/null @@ -1,113 +0,0 @@ -package jsoniter - -import ( - "bytes" - "encoding/json" - "testing" - - "github.com/stretchr/testify/require" -) - -func Test_true(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `true`) - should.True(iter.ReadBool()) - iter = ParseString(ConfigDefault, `true`) - should.Equal(true, iter.Read()) -} - -func Test_false(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `false`) - should.False(iter.ReadBool()) -} - -func Test_write_true_false(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteTrue() - stream.WriteFalse() - stream.WriteBool(false) - stream.Flush() - should.Nil(stream.Error) - should.Equal("truefalsefalse", buf.String()) -} - -func Test_write_val_bool(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteVal(true) - should.Equal(stream.Buffered(), 4) - stream.Flush() - should.Equal(stream.Buffered(), 0) - should.Nil(stream.Error) - should.Equal("true", buf.String()) -} - -func Test_encode_string_bool(t *testing.T) { - type TestObject struct { - Field bool `json:",omitempty,string"` - } - should := require.New(t) - output, err := json.Marshal(TestObject{true}) - should.Nil(err) - should.Equal(`{"Field":"true"}`, string(output)) - output, err = Marshal(TestObject{true}) - should.Nil(err) - should.Equal(`{"Field":"true"}`, string(output)) -} - -func Test_decode_string_bool(t *testing.T) { - type TestObject struct { - Field bool `json:",omitempty,string"` - } - should := require.New(t) - obj := TestObject{} - err := json.Unmarshal([]byte(`{"Field":"true"}`), &obj) - should.Nil(err) - should.True(obj.Field) - - obj = TestObject{} - err = json.Unmarshal([]byte(`{"Field":true}`), &obj) - should.NotNil(err) - - obj = TestObject{} - err = Unmarshal([]byte(`{"Field":"true"}`), &obj) - should.Nil(err) - should.True(obj.Field) - - obj = TestObject{} - err = Unmarshal([]byte(`{"Field":true}`), &obj) - should.NotNil(err) -} - -func Test_bool_can_be_null(t *testing.T) { - type TestData struct { - Field bool `json:"field"` - } - should := require.New(t) - - obj := TestData{} - data1 := []byte(`{"field": true}`) - err := Unmarshal(data1, &obj) - should.NoError(err) - should.Equal(true, obj.Field) - - data2 := []byte(`{"field": null}`) - err = Unmarshal(data2, &obj) - should.NoError(err) - // Same behavior as stdlib, not touching the existing value. - should.Equal(true, obj.Field) - - // Checking stdlib behavior as well - obj2 := TestData{} - err = json.Unmarshal(data1, &obj2) - should.NoError(err) - should.Equal(true, obj2.Field) - - err = json.Unmarshal(data2, &obj2) - should.NoError(err) - should.Equal(true, obj2.Field) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_customize_test.go b/vendor/github.com/json-iterator/go/jsoniter_customize_test.go deleted file mode 100644 index 628f89e45..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_customize_test.go +++ /dev/null @@ -1,341 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "strconv" - "testing" - "time" - "unsafe" - - "github.com/stretchr/testify/require" -) - -func Test_customize_type_decoder(t *testing.T) { - RegisterTypeDecoderFunc("time.Time", func(ptr unsafe.Pointer, iter *Iterator) { - t, err := time.ParseInLocation("2006-01-02 15:04:05", iter.ReadString(), time.UTC) - if err != nil { - iter.Error = err - return - } - *((*time.Time)(ptr)) = t - }) - defer ConfigDefault.(*frozenConfig).cleanDecoders() - val := time.Time{} - err := Unmarshal([]byte(`"2016-12-05 08:43:28"`), &val) - if err != nil { - t.Fatal(err) - } - year, month, day := val.Date() - if year != 2016 || month != 12 || day != 5 { - t.Fatal(val) - } -} - -func Test_customize_type_encoder(t *testing.T) { - should := require.New(t) - RegisterTypeEncoderFunc("time.Time", func(ptr unsafe.Pointer, stream *Stream) { - t := *((*time.Time)(ptr)) - stream.WriteString(t.UTC().Format("2006-01-02 15:04:05")) - }, nil) - defer ConfigDefault.(*frozenConfig).cleanEncoders() - val := time.Unix(0, 0) - str, err := MarshalToString(val) - should.Nil(err) - should.Equal(`"1970-01-01 00:00:00"`, str) -} - -func Test_customize_byte_array_encoder(t *testing.T) { - ConfigDefault.(*frozenConfig).cleanEncoders() - should := require.New(t) - RegisterTypeEncoderFunc("[]uint8", func(ptr unsafe.Pointer, stream *Stream) { - t := *((*[]byte)(ptr)) - stream.WriteString(string(t)) - }, nil) - defer ConfigDefault.(*frozenConfig).cleanEncoders() - val := []byte("abc") - str, err := MarshalToString(val) - should.Nil(err) - should.Equal(`"abc"`, str) -} - -func Test_customize_float_marshal(t *testing.T) { - should := require.New(t) - json := Config{MarshalFloatWith6Digits: true}.Froze() - str, err := json.MarshalToString(float32(1.23456789)) - should.Nil(err) - should.Equal("1.234568", str) -} - -type Tom struct { - field1 string -} - -func Test_customize_field_decoder(t *testing.T) { - RegisterFieldDecoderFunc("jsoniter.Tom", "field1", func(ptr unsafe.Pointer, iter *Iterator) { - *((*string)(ptr)) = strconv.Itoa(iter.ReadInt()) - }) - defer ConfigDefault.(*frozenConfig).cleanDecoders() - tom := Tom{} - err := Unmarshal([]byte(`{"field1": 100}`), &tom) - if err != nil { - t.Fatal(err) - } -} - -type TestObject1 struct { - Field1 string -} - -type testExtension struct { - DummyExtension -} - -func (extension *testExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) { - if structDescriptor.Type.String() != "jsoniter.TestObject1" { - return - } - binding := structDescriptor.GetField("Field1") - binding.Encoder = &funcEncoder{fun: func(ptr unsafe.Pointer, stream *Stream) { - str := *((*string)(ptr)) - val, _ := strconv.Atoi(str) - stream.WriteInt(val) - }} - binding.Decoder = &funcDecoder{func(ptr unsafe.Pointer, iter *Iterator) { - *((*string)(ptr)) = strconv.Itoa(iter.ReadInt()) - }} - binding.ToNames = []string{"field-1"} - binding.FromNames = []string{"field-1"} -} - -func Test_customize_field_by_extension(t *testing.T) { - should := require.New(t) - RegisterExtension(&testExtension{}) - obj := TestObject1{} - err := UnmarshalFromString(`{"field-1": 100}`, &obj) - should.Nil(err) - should.Equal("100", obj.Field1) - str, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`{"field-1":100}`, str) -} - -type timeImplementedMarshaler time.Time - -func (obj timeImplementedMarshaler) MarshalJSON() ([]byte, error) { - seconds := time.Time(obj).Unix() - return []byte(strconv.FormatInt(seconds, 10)), nil -} - -func Test_marshaler(t *testing.T) { - type TestObject struct { - Field timeImplementedMarshaler - } - should := require.New(t) - val := timeImplementedMarshaler(time.Unix(123, 0)) - obj := TestObject{val} - bytes, err := json.Marshal(obj) - should.Nil(err) - should.Equal(`{"Field":123}`, string(bytes)) - str, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`{"Field":123}`, str) -} - -func Test_marshaler_and_encoder(t *testing.T) { - type TestObject struct { - Field *timeImplementedMarshaler - } - ConfigDefault.(*frozenConfig).cleanEncoders() - should := require.New(t) - RegisterTypeEncoderFunc("jsoniter.timeImplementedMarshaler", func(ptr unsafe.Pointer, stream *Stream) { - stream.WriteString("hello from encoder") - }, nil) - val := timeImplementedMarshaler(time.Unix(123, 0)) - obj := TestObject{&val} - bytes, err := json.Marshal(obj) - should.Nil(err) - should.Equal(`{"Field":123}`, string(bytes)) - str, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`{"Field":"hello from encoder"}`, str) -} - -type ObjectImplementedUnmarshaler int - -func (obj *ObjectImplementedUnmarshaler) UnmarshalJSON(s []byte) error { - val, _ := strconv.ParseInt(string(s[1:len(s)-1]), 10, 64) - *obj = ObjectImplementedUnmarshaler(val) - return nil -} - -func Test_unmarshaler(t *testing.T) { - should := require.New(t) - var obj ObjectImplementedUnmarshaler - err := json.Unmarshal([]byte(` "100" `), &obj) - should.Nil(err) - should.Equal(100, int(obj)) - iter := ParseString(ConfigDefault, ` "100" `) - iter.ReadVal(&obj) - should.Nil(err) - should.Equal(100, int(obj)) -} - -func Test_unmarshaler_and_decoder(t *testing.T) { - type TestObject struct { - Field *ObjectImplementedUnmarshaler - Field2 string - } - ConfigDefault.(*frozenConfig).cleanDecoders() - should := require.New(t) - RegisterTypeDecoderFunc("jsoniter.ObjectImplementedUnmarshaler", func(ptr unsafe.Pointer, iter *Iterator) { - *(*ObjectImplementedUnmarshaler)(ptr) = 10 - iter.Skip() - }) - obj := TestObject{} - val := ObjectImplementedUnmarshaler(0) - obj.Field = &val - err := json.Unmarshal([]byte(`{"Field":"100"}`), &obj) - should.Nil(err) - should.Equal(100, int(*obj.Field)) - err = Unmarshal([]byte(`{"Field":"100"}`), &obj) - should.Nil(err) - should.Equal(10, int(*obj.Field)) -} - -type tmString string -type tmStruct struct { - String tmString -} - -func (s tmStruct) MarshalJSON() ([]byte, error) { - var b []byte - b = append(b, '"') - b = append(b, s.String...) - b = append(b, '"') - return b, nil -} - -func Test_marshaler_on_struct(t *testing.T) { - fixed := tmStruct{"hello"} - //json.Marshal(fixed) - Marshal(fixed) -} - -type withChan struct { - F2 chan []byte -} - -func (q withChan) MarshalJSON() ([]byte, error) { - return []byte(`""`), nil -} - -func (q *withChan) UnmarshalJSON(value []byte) error { - return nil -} - -func Test_marshal_json_with_chan(t *testing.T) { - type TestObject struct { - F1 withChan - } - should := require.New(t) - output, err := MarshalToString(TestObject{}) - should.Nil(err) - should.Equal(`{"F1":""}`, output) -} - -type withTime struct { - time.Time -} - -func (t *withTime) UnmarshalJSON(b []byte) error { - return nil -} -func (t withTime) MarshalJSON() ([]byte, error) { - return []byte(`"fake"`), nil -} - -func Test_marshal_json_with_time(t *testing.T) { - type S1 struct { - F1 withTime - F2 *withTime - } - type TestObject struct { - TF1 S1 - } - should := require.New(t) - obj := TestObject{ - S1{ - F1: withTime{ - time.Unix(0, 0), - }, - F2: &withTime{ - time.Unix(0, 0), - }, - }, - } - output, err := json.Marshal(obj) - should.Nil(err) - should.Equal(`{"TF1":{"F1":"fake","F2":"fake"}}`, string(output)) - output, err = Marshal(obj) - should.Nil(err) - should.Equal(`{"TF1":{"F1":"fake","F2":"fake"}}`, string(output)) - obj = TestObject{} - should.Nil(json.Unmarshal([]byte(`{"TF1":{"F1":"fake","F2":"fake"}}`), &obj)) - should.NotNil(obj.TF1.F2) - obj = TestObject{} - should.Nil(Unmarshal([]byte(`{"TF1":{"F1":"fake","F2":"fake"}}`), &obj)) - should.NotNil(obj.TF1.F2) -} - -func Test_customize_tag_key(t *testing.T) { - - type TestObject struct { - Field string `orm:"field"` - } - - should := require.New(t) - json := Config{TagKey: "orm"}.Froze() - str, err := json.MarshalToString(TestObject{"hello"}) - should.Nil(err) - should.Equal(`{"field":"hello"}`, str) -} - -func Test_recursive_empty_interface_customization(t *testing.T) { - t.Skip() - var obj interface{} - RegisterTypeDecoderFunc("interface {}", func(ptr unsafe.Pointer, iter *Iterator) { - switch iter.WhatIsNext() { - case NumberValue: - *(*interface{})(ptr) = iter.ReadInt64() - default: - *(*interface{})(ptr) = iter.Read() - } - }) - should := require.New(t) - Unmarshal([]byte("[100]"), &obj) - should.Equal([]interface{}{int64(100)}, obj) -} - -type GeoLocation struct { - Id string `json:"id,omitempty" db:"id"` -} - -func (p *GeoLocation) MarshalJSON() ([]byte, error) { - return []byte(`{}`), nil -} - -func (p *GeoLocation) UnmarshalJSON(input []byte) error { - p.Id = "hello" - return nil -} - -func Test_marshal_and_unmarshal_on_non_pointer(t *testing.T) { - should := require.New(t) - locations := []GeoLocation{{"000"}} - bytes, err := Marshal(locations) - should.Nil(err) - should.Equal("[{}]", string(bytes)) - err = Unmarshal([]byte("[1]"), &locations) - should.Nil(err) - should.Equal("hello", locations[0].Id) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_demo_test.go b/vendor/github.com/json-iterator/go/jsoniter_demo_test.go deleted file mode 100644 index 85718d1b2..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_demo_test.go +++ /dev/null @@ -1,87 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "testing" - - "github.com/stretchr/testify/require" -) - -func Test_bind_api_demo(t *testing.T) { - should := require.New(t) - val := []int{} - err := UnmarshalFromString(`[0,1,2,3] `, &val) - should.Nil(err) - should.Equal([]int{0, 1, 2, 3}, val) -} - -func Test_iterator_api_demo(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `[0,1,2,3]`) - total := 0 - for iter.ReadArray() { - total += iter.ReadInt() - } - should.Equal(6, total) -} - -type People struct { - Name string - Gender string - Age int - Address string - Mobile string - Country string - Height int -} - -func jsoniterMarshal(p *People) error { - _, err := Marshal(p) - if nil != err { - return err - } - return nil -} -func stdMarshal(p *People) error { - _, err := json.Marshal(p) - if nil != err { - return err - } - return nil -} - -func BenchmarkJosniterMarshal(b *testing.B) { - var p People - p.Address = "上海市徐汇区漕宝路" - p.Age = 30 - p.Country = "中国" - p.Gender = "male" - p.Height = 170 - p.Mobile = "18502120533" - p.Name = "Elvin" - b.ReportAllocs() - for i := 0; i < b.N; i++ { - err := jsoniterMarshal(&p) - if nil != err { - b.Error(err) - } - } -} - -func BenchmarkStdMarshal(b *testing.B) { - var p People - p.Address = "上海市徐汇区漕宝路" - p.Age = 30 - p.Country = "中国" - p.Gender = "male" - p.Height = 170 - p.Mobile = "18502120533" - p.Name = "Elvin" - b.ReportAllocs() - for i := 0; i < b.N; i++ { - err := stdMarshal(&p) - if nil != err { - b.Error(err) - } - } -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_encode_interface_test.go b/vendor/github.com/json-iterator/go/jsoniter_encode_interface_test.go deleted file mode 100644 index 14b7add9a..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_encode_interface_test.go +++ /dev/null @@ -1,42 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "testing" - - "github.com/stretchr/testify/require" -) - -func Test_encode_interface(t *testing.T) { - should := require.New(t) - var a interface{} - a = int8(10) - str, err := MarshalToString(a) - should.Nil(err) - should.Equal(str, "10") - a = float32(3) - str, err = MarshalToString(a) - should.Nil(err) - should.Equal(str, "3") - a = map[string]interface{}{"abc": 1} - str, err = MarshalToString(a) - should.Nil(err) - should.Equal(str, `{"abc":1}`) - a = uintptr(1) - str, err = MarshalToString(a) - should.Nil(err) - should.Equal(str, "1") - a = uint(1) - str, err = MarshalToString(a) - should.Nil(err) - should.Equal(str, "1") - a = uint8(1) - str, err = MarshalToString(a) - should.Nil(err) - should.Equal(str, "1") - a = json.RawMessage("abc") - MarshalToString(a) - str, err = MarshalToString(a) - should.Nil(err) - should.Equal(str, "abc") -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_enum_marshaler_test.go b/vendor/github.com/json-iterator/go/jsoniter_enum_marshaler_test.go deleted file mode 100644 index 69e1e8cd3..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_enum_marshaler_test.go +++ /dev/null @@ -1,50 +0,0 @@ -package jsoniter - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/require" -) - -type MyEnum int64 - -const ( - MyEnumA MyEnum = iota - MyEnumB -) - -func (m *MyEnum) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf(`"foo-%d"`, int(*m))), nil -} - -func (m *MyEnum) UnmarshalJSON(jb []byte) error { - switch string(jb) { - case `"foo-1"`: - *m = MyEnumB - default: - *m = MyEnumA - } - return nil -} - -func Test_custom_marshaler_on_enum(t *testing.T) { - type Wrapper struct { - Payload interface{} - } - type Wrapper2 struct { - Payload MyEnum - } - should := require.New(t) - - w := Wrapper{Payload: MyEnumB} - - jb, err := Marshal(w) - should.NoError(err) - should.Equal(`{"Payload":"foo-1"}`, string(jb)) - - var w2 Wrapper2 - err = Unmarshal(jb, &w2) - should.NoError(err) - should.Equal(MyEnumB, w2.Payload) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_fixed_array_test.go b/vendor/github.com/json-iterator/go/jsoniter_fixed_array_test.go deleted file mode 100644 index 6824b1196..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_fixed_array_test.go +++ /dev/null @@ -1,37 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "github.com/stretchr/testify/require" - "testing" -) - -func Test_encode_fixed_array(t *testing.T) { - should := require.New(t) - type FixedArray [2]float64 - fixed := FixedArray{0.1, 1.0} - output, err := MarshalToString(fixed) - should.Nil(err) - should.Equal("[0.1,1]", output) -} - -func Test_encode_fixed_array_of_map(t *testing.T) { - should := require.New(t) - type FixedArray [2]map[string]string - fixed := FixedArray{map[string]string{"1": "2"}, map[string]string{"3": "4"}} - output, err := MarshalToString(fixed) - should.Nil(err) - should.Equal(`[{"1":"2"},{"3":"4"}]`, output) -} - -func Test_decode_fixed_array(t *testing.T) { - should := require.New(t) - type FixedArray [2]float64 - var fixed FixedArray - should.Nil(json.Unmarshal([]byte("[1,2,3]"), &fixed)) - should.Equal(float64(1), fixed[0]) - should.Equal(float64(2), fixed[1]) - should.Nil(Unmarshal([]byte("[1,2,3]"), &fixed)) - should.Equal(float64(1), fixed[0]) - should.Equal(float64(2), fixed[1]) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_float_test.go b/vendor/github.com/json-iterator/go/jsoniter_float_test.go deleted file mode 100644 index d90ff2bd5..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_float_test.go +++ /dev/null @@ -1,210 +0,0 @@ -// +build go1.8 - -package jsoniter - -import ( - "bytes" - "encoding/json" - "fmt" - "strconv" - "testing" - - "github.com/stretchr/testify/require" -) - -func Test_read_big_float(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `12.3`) - val := iter.ReadBigFloat() - val64, _ := val.Float64() - should.Equal(12.3, val64) -} - -func Test_read_big_int(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `92233720368547758079223372036854775807`) - val := iter.ReadBigInt() - should.NotNil(val) - should.Equal(`92233720368547758079223372036854775807`, val.String()) -} - -func Test_read_float(t *testing.T) { - inputs := []string{ - `1.1`, `1000`, `9223372036854775807`, `12.3`, `-12.3`, `720368.54775807`, `720368.547758075`, - `1e1`, `1e+1`, `1e-1`, `1E1`, `1E+1`, `1E-1`, `-1e1`, `-1e+1`, `-1e-1`, - } - for _, input := range inputs { - // non-streaming - t.Run(fmt.Sprintf("%v", input), func(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, input+",") - expected, err := strconv.ParseFloat(input, 32) - should.Nil(err) - should.Equal(float32(expected), iter.ReadFloat32()) - }) - t.Run(fmt.Sprintf("%v", input), func(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, input+",") - expected, err := strconv.ParseFloat(input, 64) - should.Nil(err) - should.Equal(expected, iter.ReadFloat64()) - }) - // streaming - t.Run(fmt.Sprintf("%v", input), func(t *testing.T) { - should := require.New(t) - iter := Parse(ConfigDefault, bytes.NewBufferString(input+","), 2) - expected, err := strconv.ParseFloat(input, 32) - should.Nil(err) - should.Equal(float32(expected), iter.ReadFloat32()) - }) - t.Run(fmt.Sprintf("%v", input), func(t *testing.T) { - should := require.New(t) - iter := Parse(ConfigDefault, bytes.NewBufferString(input+","), 2) - val := float64(0) - err := json.Unmarshal([]byte(input), &val) - should.Nil(err) - should.Equal(val, iter.ReadFloat64()) - }) - } -} - -func Test_read_float_as_interface(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `12.3`) - should.Equal(float64(12.3), iter.Read()) -} - -func Test_wrap_float(t *testing.T) { - should := require.New(t) - str, err := MarshalToString(WrapFloat64(12.3)) - should.Nil(err) - should.Equal("12.3", str) -} - -func Test_write_float32(t *testing.T) { - vals := []float32{0, 1, -1, 99, 0xff, 0xfff, 0xffff, 0xfffff, 0xffffff, 0x4ffffff, 0xfffffff, - -0x4ffffff, -0xfffffff, 1.2345, 1.23456, 1.234567, 1.001} - for _, val := range vals { - t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteFloat32Lossy(val) - stream.Flush() - should.Nil(stream.Error) - output, err := json.Marshal(val) - should.Nil(err) - should.Equal(string(output), buf.String()) - }) - t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteVal(val) - stream.Flush() - should.Nil(stream.Error) - output, err := json.Marshal(val) - should.Nil(err) - should.Equal(string(output), buf.String()) - }) - } - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 10) - stream.WriteRaw("abcdefg") - stream.WriteFloat32Lossy(1.123456) - stream.Flush() - should.Nil(stream.Error) - should.Equal("abcdefg1.123456", buf.String()) - - stream = NewStream(ConfigDefault, nil, 0) - stream.WriteFloat32(float32(0.0000001)) - should.Equal("1e-07", string(stream.buf)) -} - -func Test_write_float64(t *testing.T) { - vals := []float64{0, 1, -1, 99, 0xff, 0xfff, 0xffff, 0xfffff, 0xffffff, 0x4ffffff, 0xfffffff, - -0x4ffffff, -0xfffffff, 1.2345, 1.23456, 1.234567, 1.001} - for _, val := range vals { - t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteFloat64Lossy(val) - stream.Flush() - should.Nil(stream.Error) - should.Equal(strconv.FormatFloat(val, 'f', -1, 64), buf.String()) - }) - t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteVal(val) - stream.Flush() - should.Nil(stream.Error) - should.Equal(strconv.FormatFloat(val, 'f', -1, 64), buf.String()) - }) - } - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 10) - stream.WriteRaw("abcdefg") - stream.WriteFloat64Lossy(1.123456) - stream.Flush() - should.Nil(stream.Error) - should.Equal("abcdefg1.123456", buf.String()) - - stream = NewStream(ConfigDefault, nil, 0) - stream.WriteFloat64(float64(0.0000001)) - should.Equal("1e-07", string(stream.buf)) -} - -func Test_read_float64_cursor(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, "[1.23456789\n,2,3]") - should.True(iter.ReadArray()) - should.Equal(1.23456789, iter.Read()) - should.True(iter.ReadArray()) - should.Equal(float64(2), iter.Read()) -} - -func Test_read_float_scientific(t *testing.T) { - should := require.New(t) - var obj interface{} - should.Nil(UnmarshalFromString(`1e1`, &obj)) - should.Equal(float64(10), obj) - should.Nil(json.Unmarshal([]byte(`1e1`), &obj)) - should.Equal(float64(10), obj) - should.Nil(UnmarshalFromString(`1.0e1`, &obj)) - should.Equal(float64(10), obj) - should.Nil(json.Unmarshal([]byte(`1.0e1`), &obj)) - should.Equal(float64(10), obj) -} - -func Test_lossy_float_marshal(t *testing.T) { - should := require.New(t) - api := Config{MarshalFloatWith6Digits: true}.Froze() - output, err := api.MarshalToString(float64(0.1234567)) - should.Nil(err) - should.Equal("0.123457", output) - output, err = api.MarshalToString(float32(0.1234567)) - should.Nil(err) - should.Equal("0.123457", output) -} - -func Benchmark_jsoniter_float(b *testing.B) { - b.ReportAllocs() - input := []byte(`1.1123,`) - iter := NewIterator(ConfigDefault) - for n := 0; n < b.N; n++ { - iter.ResetBytes(input) - iter.ReadFloat64() - } -} - -func Benchmark_json_float(b *testing.B) { - for n := 0; n < b.N; n++ { - result := float64(0) - json.Unmarshal([]byte(`1.1`), &result) - } -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_int_test.go b/vendor/github.com/json-iterator/go/jsoniter_int_test.go deleted file mode 100644 index 378947ca4..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_int_test.go +++ /dev/null @@ -1,567 +0,0 @@ -// +build go1.8 - -package jsoniter - -import ( - "bytes" - "encoding/json" - "fmt" - "io/ioutil" - "strconv" - "testing" - - "github.com/stretchr/testify/require" -) - -func Test_read_uint64_invalid(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, ",") - iter.ReadUint64() - should.NotNil(iter.Error) -} - -func Test_read_int_from_null(t *testing.T) { - - type TestObject struct { - F1 int8 - F2 int16 - F3 int32 - F4 int64 - F5 int - F6 uint8 - F7 uint16 - F8 uint32 - F9 uint64 - F10 uint - F11 float32 - F12 float64 - F13 uintptr - } - - should := require.New(t) - obj := TestObject{} - err := Unmarshal([]byte(`{ - "f1":null, - "f2":null, - "f3":null, - "f4":null, - "f5":null, - "f6":null, - "f7":null, - "f8":null, - "f9":null, - "f10":null, - "f11":null, - "f12":null, - "f13":null - }`), &obj) - should.Nil(err) -} - -func _int8(t *testing.T) { - inputs := []string{`127`, `-128`} - for _, input := range inputs { - t.Run(fmt.Sprintf("%v", input), func(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, input) - expected, err := strconv.ParseInt(input, 10, 8) - should.Nil(err) - should.Equal(int8(expected), iter.ReadInt8()) - }) - } -} - -func Test_read_int16(t *testing.T) { - inputs := []string{`32767`, `-32768`} - for _, input := range inputs { - t.Run(fmt.Sprintf("%v", input), func(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, input) - expected, err := strconv.ParseInt(input, 10, 16) - should.Nil(err) - should.Equal(int16(expected), iter.ReadInt16()) - }) - } -} - -func Test_read_int32(t *testing.T) { - inputs := []string{`1`, `12`, `123`, `1234`, `12345`, `123456`, `2147483647`, `-2147483648`} - for _, input := range inputs { - t.Run(fmt.Sprintf("%v", input), func(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, input) - expected, err := strconv.ParseInt(input, 10, 32) - should.Nil(err) - should.Equal(int32(expected), iter.ReadInt32()) - }) - t.Run(fmt.Sprintf("%v", input), func(t *testing.T) { - should := require.New(t) - iter := Parse(ConfigDefault, bytes.NewBufferString(input), 2) - expected, err := strconv.ParseInt(input, 10, 32) - should.Nil(err) - should.Equal(int32(expected), iter.ReadInt32()) - }) - } -} - -func Test_read_int32_array(t *testing.T) { - should := require.New(t) - input := `[123,456,789]` - val := make([]int32, 0) - UnmarshalFromString(input, &val) - should.Equal(3, len(val)) -} - -func Test_read_int64_array(t *testing.T) { - should := require.New(t) - input := `[123,456,789]` - val := make([]int64, 0) - UnmarshalFromString(input, &val) - should.Equal(3, len(val)) -} - -func Test_read_int_overflow(t *testing.T) { - should := require.New(t) - inputArr := []string{"123451", "-123451"} - for _, s := range inputArr { - iter := ParseString(ConfigDefault, s) - iter.ReadInt8() - should.NotNil(iter.Error) - - iterU := ParseString(ConfigDefault, s) - iterU.ReadUint8() - should.NotNil(iterU.Error) - - } - - inputArr = []string{"12345678912", "-12345678912"} - for _, s := range inputArr { - iter := ParseString(ConfigDefault, s) - iter.ReadInt16() - should.NotNil(iter.Error) - - iterUint := ParseString(ConfigDefault, s) - iterUint.ReadUint16() - should.NotNil(iterUint.Error) - } - - inputArr = []string{"3111111111", "-3111111111", "1234232323232323235678912", "-1234567892323232323212"} - for _, s := range inputArr { - iter := ParseString(ConfigDefault, s) - iter.ReadInt32() - should.NotNil(iter.Error) - - iterUint := ParseString(ConfigDefault, s) - iterUint.ReadUint32() - should.NotNil(iterUint.Error) - } - - inputArr = []string{"9223372036854775811", "-9523372036854775807", "1234232323232323235678912", "-1234567892323232323212"} - for _, s := range inputArr { - iter := ParseString(ConfigDefault, s) - iter.ReadInt64() - should.NotNil(iter.Error) - - iterUint := ParseString(ConfigDefault, s) - iterUint.ReadUint64() - should.NotNil(iterUint.Error) - } -} - -func Test_read_int64(t *testing.T) { - inputs := []string{`1`, `12`, `123`, `1234`, `12345`, `123456`, `9223372036854775807`, `-9223372036854775808`} - for _, input := range inputs { - t.Run(fmt.Sprintf("%v", input), func(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, input) - expected, err := strconv.ParseInt(input, 10, 64) - should.Nil(err) - should.Equal(expected, iter.ReadInt64()) - }) - t.Run(fmt.Sprintf("%v", input), func(t *testing.T) { - should := require.New(t) - iter := Parse(ConfigDefault, bytes.NewBufferString(input), 2) - expected, err := strconv.ParseInt(input, 10, 64) - should.Nil(err) - should.Equal(expected, iter.ReadInt64()) - }) - } -} - -func Test_read_int64_overflow(t *testing.T) { - should := require.New(t) - input := "123456789123456789123456789123456789," - iter := ParseString(ConfigDefault, input) - iter.ReadInt64() - should.NotNil(iter.Error) -} - -func Test_wrap_int(t *testing.T) { - should := require.New(t) - str, err := MarshalToString(WrapInt64(100)) - should.Nil(err) - should.Equal("100", str) -} - -func Test_write_uint8(t *testing.T) { - vals := []uint8{0, 1, 11, 111, 255} - for _, val := range vals { - t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteUint8(val) - stream.Flush() - should.Nil(stream.Error) - should.Equal(strconv.FormatUint(uint64(val), 10), buf.String()) - }) - t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteVal(val) - stream.Flush() - should.Nil(stream.Error) - should.Equal(strconv.FormatUint(uint64(val), 10), buf.String()) - }) - } - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 3) - stream.WriteRaw("a") - stream.WriteUint8(100) // should clear buffer - stream.Flush() - should.Nil(stream.Error) - should.Equal("a100", buf.String()) -} - -func Test_write_int8(t *testing.T) { - vals := []int8{0, 1, -1, 99, 0x7f, -0x80} - for _, val := range vals { - t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteInt8(val) - stream.Flush() - should.Nil(stream.Error) - should.Equal(strconv.FormatInt(int64(val), 10), buf.String()) - }) - t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteVal(val) - stream.Flush() - should.Nil(stream.Error) - should.Equal(strconv.FormatInt(int64(val), 10), buf.String()) - }) - } - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4) - stream.WriteRaw("a") - stream.WriteInt8(-100) // should clear buffer - stream.Flush() - should.Nil(stream.Error) - should.Equal("a-100", buf.String()) -} - -func Test_write_uint16(t *testing.T) { - vals := []uint16{0, 1, 11, 111, 255, 0xfff, 0xffff} - for _, val := range vals { - t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteUint16(val) - stream.Flush() - should.Nil(stream.Error) - should.Equal(strconv.FormatUint(uint64(val), 10), buf.String()) - }) - t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteVal(val) - stream.Flush() - should.Nil(stream.Error) - should.Equal(strconv.FormatUint(uint64(val), 10), buf.String()) - }) - } - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 5) - stream.WriteRaw("a") - stream.WriteUint16(10000) // should clear buffer - stream.Flush() - should.Nil(stream.Error) - should.Equal("a10000", buf.String()) -} - -func Test_write_int16(t *testing.T) { - vals := []int16{0, 1, 11, 111, 255, 0xfff, 0x7fff, -0x8000} - for _, val := range vals { - t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteInt16(val) - stream.Flush() - should.Nil(stream.Error) - should.Equal(strconv.FormatInt(int64(val), 10), buf.String()) - }) - t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteVal(val) - stream.Flush() - should.Nil(stream.Error) - should.Equal(strconv.FormatInt(int64(val), 10), buf.String()) - }) - } - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 6) - stream.WriteRaw("a") - stream.WriteInt16(-10000) // should clear buffer - stream.Flush() - should.Nil(stream.Error) - should.Equal("a-10000", buf.String()) -} - -func Test_write_uint32(t *testing.T) { - vals := []uint32{0, 1, 11, 111, 255, 999999, 0xfff, 0xffff, 0xfffff, 0xffffff, 0xfffffff, 0xffffffff} - for _, val := range vals { - t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteUint32(val) - stream.Flush() - should.Nil(stream.Error) - should.Equal(strconv.FormatUint(uint64(val), 10), buf.String()) - }) - t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteVal(val) - stream.Flush() - should.Nil(stream.Error) - should.Equal(strconv.FormatUint(uint64(val), 10), buf.String()) - }) - } - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 10) - stream.WriteRaw("a") - stream.WriteUint32(0xffffffff) // should clear buffer - stream.Flush() - should.Nil(stream.Error) - should.Equal("a4294967295", buf.String()) -} - -func Test_write_int32(t *testing.T) { - vals := []int32{0, 1, 11, 111, 255, 999999, 0xfff, 0xffff, 0xfffff, 0xffffff, 0xfffffff, 0x7fffffff, -0x80000000} - for _, val := range vals { - t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteInt32(val) - stream.Flush() - should.Nil(stream.Error) - should.Equal(strconv.FormatInt(int64(val), 10), buf.String()) - }) - t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteVal(val) - stream.Flush() - should.Nil(stream.Error) - should.Equal(strconv.FormatInt(int64(val), 10), buf.String()) - }) - } - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 11) - stream.WriteRaw("a") - stream.WriteInt32(-0x7fffffff) // should clear buffer - stream.Flush() - should.Nil(stream.Error) - should.Equal("a-2147483647", buf.String()) -} - -func Test_write_uint64(t *testing.T) { - vals := []uint64{0, 1, 11, 111, 255, 999999, 0xfff, 0xffff, 0xfffff, 0xffffff, 0xfffffff, 0xffffffff, - 0xfffffffff, 0xffffffffff, 0xfffffffffff, 0xffffffffffff, 0xfffffffffffff, 0xffffffffffffff, - 0xfffffffffffffff, 0xffffffffffffffff} - for _, val := range vals { - t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteUint64(val) - stream.Flush() - should.Nil(stream.Error) - should.Equal(strconv.FormatUint(uint64(val), 10), buf.String()) - }) - t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteVal(val) - stream.Flush() - should.Nil(stream.Error) - should.Equal(strconv.FormatUint(uint64(val), 10), buf.String()) - }) - } - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 10) - stream.WriteRaw("a") - stream.WriteUint64(0xffffffff) // should clear buffer - stream.Flush() - should.Nil(stream.Error) - should.Equal("a4294967295", buf.String()) -} - -func Test_write_int64(t *testing.T) { - vals := []int64{0, 1, 11, 111, 255, 999999, 0xfff, 0xffff, 0xfffff, 0xffffff, 0xfffffff, 0xffffffff, - 0xfffffffff, 0xffffffffff, 0xfffffffffff, 0xffffffffffff, 0xfffffffffffff, 0xffffffffffffff, - 0xfffffffffffffff, 0x7fffffffffffffff, -0x8000000000000000} - for _, val := range vals { - t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteInt64(val) - stream.Flush() - should.Nil(stream.Error) - should.Equal(strconv.FormatInt(val, 10), buf.String()) - }) - t.Run(fmt.Sprintf("%v", val), func(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteVal(val) - stream.Flush() - should.Nil(stream.Error) - should.Equal(strconv.FormatInt(val, 10), buf.String()) - }) - } - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 10) - stream.WriteRaw("a") - stream.WriteInt64(0xffffffff) // should clear buffer - stream.Flush() - should.Nil(stream.Error) - should.Equal("a4294967295", buf.String()) -} - -func Test_write_val_int(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteVal(1001) - stream.Flush() - should.Nil(stream.Error) - should.Equal("1001", buf.String()) -} - -func Test_write_val_int_ptr(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - val := 1001 - stream.WriteVal(&val) - stream.Flush() - should.Nil(stream.Error) - should.Equal("1001", buf.String()) -} - -func Test_json_number(t *testing.T) { - should := require.New(t) - var arr []json.Number - err := Unmarshal([]byte(`[1]`), &arr) - should.Nil(err) - should.Equal(json.Number("1"), arr[0]) - str, err := MarshalToString(arr) - should.Nil(err) - should.Equal(`[1]`, str) -} - -func Test_jsoniter_number(t *testing.T) { - should := require.New(t) - var arr []Number - err := Unmarshal([]byte(`[1]`), &arr) - should.Nil(err) - should.Equal(Number("1"), arr[0]) - str, isNumber := CastJsonNumber(arr[0]) - should.True(isNumber) - should.Equal("1", str) -} - -func Test_non_numeric_as_number(t *testing.T) { - should := require.New(t) - var v1 json.Number - err := Unmarshal([]byte(`"500"`), &v1) - should.Nil(err) - should.Equal("500", string(v1)) - var v2 Number - err = Unmarshal([]byte(`"500"`), &v2) - should.Nil(err) - should.Equal("500", string(v2)) -} - -func Test_null_as_number(t *testing.T) { - should := require.New(t) - var v1 json.Number - err := json.Unmarshal([]byte(`null`), &v1) - should.Nil(err) - should.Equal("", string(v1)) - var v2 Number - err = Unmarshal([]byte(`null`), &v2) - should.Nil(err) - should.Equal("", string(v2)) -} - -func Test_float_as_int(t *testing.T) { - should := require.New(t) - var i int - should.NotNil(Unmarshal([]byte(`1.1`), &i)) -} - -func Benchmark_jsoniter_encode_int(b *testing.B) { - stream := NewStream(ConfigDefault, ioutil.Discard, 64) - for n := 0; n < b.N; n++ { - stream.n = 0 - stream.WriteUint64(0xffffffff) - } -} - -func Benchmark_itoa(b *testing.B) { - for n := 0; n < b.N; n++ { - strconv.FormatInt(0xffffffff, 10) - } -} - -func Benchmark_jsoniter_int(b *testing.B) { - iter := NewIterator(ConfigDefault) - input := []byte(`100`) - for n := 0; n < b.N; n++ { - iter.ResetBytes(input) - iter.ReadInt64() - } -} - -func Benchmark_json_int(b *testing.B) { - for n := 0; n < b.N; n++ { - result := int64(0) - json.Unmarshal([]byte(`-100`), &result) - } -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_interface_test.go b/vendor/github.com/json-iterator/go/jsoniter_interface_test.go deleted file mode 100644 index 869429a12..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_interface_test.go +++ /dev/null @@ -1,576 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "fmt" - "testing" - "unsafe" - - "github.com/stretchr/testify/require" - "reflect" -) - -func Test_write_empty_interface_via_placeholder(t *testing.T) { - fmt.Println(^uint(0) >> 1) - should := require.New(t) - m := map[uint32]interface{}{1: "hello"} - inf := reflect.ValueOf(m).MapIndex(reflect.ValueOf(uint32(1))).Interface() - encoder := &placeholderEncoder{ - cfg: ConfigFastest.(*frozenConfig), - cacheKey: reflect.TypeOf(m).Elem(), - } - stream := ConfigFastest.BorrowStream(nil) - encoderOfType(ConfigFastest.(*frozenConfig), reflect.TypeOf(m).Elem()) - encoder.EncodeInterface(inf, stream) - should.Equal(`"hello"`, string(stream.Buffer())) -} - -func Test_write_array_of_interface(t *testing.T) { - should := require.New(t) - array := []interface{}{"hello"} - str, err := MarshalToString(array) - should.Nil(err) - should.Equal(`["hello"]`, str) -} - -func Test_write_map_of_interface(t *testing.T) { - should := require.New(t) - val := map[string]interface{}{"hello": "world"} - str, err := MarshalToString(val) - should.Nil(err) - should.Equal(`{"hello":"world"}`, str) -} - -func Test_write_map_of_interface_in_struct(t *testing.T) { - type TestObject struct { - Field map[string]interface{} - } - should := require.New(t) - val := TestObject{map[string]interface{}{"hello": "world"}} - str, err := MarshalToString(val) - should.Nil(err) - should.Equal(`{"Field":{"hello":"world"}}`, str) -} - -func Test_write_map_of_interface_in_struct_with_two_fields(t *testing.T) { - type TestObject struct { - Field map[string]interface{} - Field2 string - } - should := require.New(t) - val := TestObject{map[string]interface{}{"hello": "world"}, ""} - str, err := MarshalToString(val) - should.Nil(err) - should.Contains(str, `"Field":{"hello":"world"}`) -} - -type MyInterface interface { - Hello() string -} - -type MyString string - -func (ms MyString) Hello() string { - return string(ms) -} - -func Test_write_map_of_custom_interface(t *testing.T) { - should := require.New(t) - myStr := MyString("world") - should.Equal("world", myStr.Hello()) - val := map[string]MyInterface{"hello": myStr} - str, err := MarshalToString(val) - should.Nil(err) - should.Equal(`{"hello":"world"}`, str) -} - -func Test_write_interface(t *testing.T) { - should := require.New(t) - var val interface{} - val = "hello" - str, err := MarshalToString(val) - should.Nil(err) - should.Equal(`"hello"`, str) -} - -func Test_read_interface(t *testing.T) { - should := require.New(t) - var val interface{} - err := UnmarshalFromString(`"hello"`, &val) - should.Nil(err) - should.Equal("hello", val) - err = UnmarshalFromString(`1e1`, &val) - should.Nil(err) - should.Equal(float64(10), val) - err = UnmarshalFromString(`1.0e1`, &val) - should.Nil(err) - should.Equal(float64(10), val) - err = json.Unmarshal([]byte(`1.0e1`), &val) - should.Nil(err) - should.Equal(float64(10), val) -} - -func Test_read_custom_interface(t *testing.T) { - should := require.New(t) - var val MyInterface - RegisterTypeDecoderFunc("jsoniter.MyInterface", func(ptr unsafe.Pointer, iter *Iterator) { - *((*MyInterface)(ptr)) = MyString(iter.ReadString()) - }) - err := UnmarshalFromString(`"hello"`, &val) - should.Nil(err) - should.Equal("hello", val.Hello()) -} - -func Test_decode_object_contain_empty_interface(t *testing.T) { - type TestObject struct { - Field interface{} - } - should := require.New(t) - obj := TestObject{} - obj.Field = 1024 - should.Nil(UnmarshalFromString(`{"Field": "hello"}`, &obj)) - should.Equal("hello", obj.Field) -} - -func Test_decode_object_contain_non_empty_interface(t *testing.T) { - type TestObject struct { - Field MyInterface - } - should := require.New(t) - obj := TestObject{} - obj.Field = MyString("abc") - should.Nil(UnmarshalFromString(`{"Field": "hello"}`, &obj)) - should.Equal(MyString("hello"), obj.Field) -} - -func Test_encode_object_contain_empty_interface(t *testing.T) { - type TestObject struct { - Field interface{} - } - should := require.New(t) - obj := TestObject{} - obj.Field = 1024 - str, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`{"Field":1024}`, str) -} - -func Test_encode_object_contain_non_empty_interface(t *testing.T) { - type TestObject struct { - Field MyInterface - } - should := require.New(t) - obj := TestObject{} - obj.Field = MyString("hello") - str, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`{"Field":"hello"}`, str) -} - -func Test_nil_non_empty_interface(t *testing.T) { - ConfigDefault.(*frozenConfig).cleanEncoders() - ConfigDefault.(*frozenConfig).cleanDecoders() - type TestObject struct { - Field []MyInterface - } - should := require.New(t) - obj := TestObject{} - b := []byte(`{"Field":["AAA"]}`) - should.NotNil(json.Unmarshal(b, &obj)) - should.NotNil(Unmarshal(b, &obj)) -} - -func Test_read_large_number_as_interface(t *testing.T) { - should := require.New(t) - var val interface{} - err := Config{UseNumber: true}.Froze().UnmarshalFromString(`123456789123456789123456789`, &val) - should.Nil(err) - output, err := MarshalToString(val) - should.Nil(err) - should.Equal(`123456789123456789123456789`, output) -} - -func Test_nested_one_field_struct(t *testing.T) { - should := require.New(t) - type YetYetAnotherObject struct { - Field string - } - type YetAnotherObject struct { - Field *YetYetAnotherObject - } - type AnotherObject struct { - Field *YetAnotherObject - } - type TestObject struct { - Me *AnotherObject - } - obj := TestObject{&AnotherObject{&YetAnotherObject{&YetYetAnotherObject{"abc"}}}} - str, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`{"Me":{"Field":{"Field":{"Field":"abc"}}}}`, str) - str, err = MarshalToString(&obj) - should.Nil(err) - should.Equal(`{"Me":{"Field":{"Field":{"Field":"abc"}}}}`, str) -} - -func Test_struct_with_embedded_ptr_with_tag(t *testing.T) { - type O1 struct { - O1F string - } - - type Option struct { - O1 *O1 - } - - type T struct { - Option `json:","` - } - var obj T - should := require.New(t) - output, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`{"O1":null}`, output) -} - -func Test_struct_with_one_nil(t *testing.T) { - type TestObject struct { - F *float64 - } - var obj TestObject - should := require.New(t) - output, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`{"F":null}`, output) -} - -func Test_struct_with_one_nil_embedded(t *testing.T) { - type Parent struct { - Field1 string - Field2 string - } - type TestObject struct { - *Parent - } - obj := TestObject{} - should := require.New(t) - bytes, err := json.Marshal(obj) - should.Nil(err) - should.Equal("{}", string(bytes)) - output, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`{}`, output) -} - -func Test_struct_with_not_nil_embedded(t *testing.T) { - type Parent struct { - Field0 string - Field1 []string - Field2 map[string]interface{} - } - type TestObject struct { - *Parent - } - should := require.New(t) - var obj TestObject - err := UnmarshalFromString(`{"Field0":"1","Field1":null,"Field2":{"K":"V"}}`, &obj) - should.Nil(err) - should.Nil(obj.Field1) - should.Equal(map[string]interface{}{"K": "V"}, obj.Field2) - should.Equal("1", obj.Field0) -} - -func Test_array_with_one_nil_ptr(t *testing.T) { - obj := [1]*float64{nil} - should := require.New(t) - output, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`[null]`, output) -} - -func Test_array_with_one_not_nil_ptr(t *testing.T) { - two := float64(2) - obj := [1]*float64{&two} - should := require.New(t) - output, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`[2]`, output) -} - -func Test_embedded_array_with_one_nil(t *testing.T) { - type TestObject struct { - Field1 int - Field2 [1]*float64 - } - var obj TestObject - should := require.New(t) - output, err := MarshalToString(obj) - should.Nil(err) - should.Contains(output, `"Field2":[null]`) -} - -func Test_array_with_nothing(t *testing.T) { - var obj [2]*float64 - should := require.New(t) - output, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`[null,null]`, output) -} - -func Test_unmarshal_ptr_to_interface(t *testing.T) { - type TestData struct { - Name string `json:"name"` - } - should := require.New(t) - var obj interface{} = &TestData{} - err := json.Unmarshal([]byte(`{"name":"value"}`), &obj) - should.Nil(err) - should.Equal("&{value}", fmt.Sprintf("%v", obj)) - obj = interface{}(&TestData{}) - err = Unmarshal([]byte(`{"name":"value"}`), &obj) - should.Nil(err) - should.Equal("&{value}", fmt.Sprintf("%v", obj)) -} - -func Test_nil_out_null_interface(t *testing.T) { - type TestData struct { - Field interface{} `json:"field"` - } - should := require.New(t) - - var boolVar bool - obj := TestData{ - Field: &boolVar, - } - - data1 := []byte(`{"field": true}`) - - err := Unmarshal(data1, &obj) - should.NoError(err) - should.Equal(true, *(obj.Field.(*bool))) - - data2 := []byte(`{"field": null}`) - - err = Unmarshal(data2, &obj) - should.NoError(err) - should.Equal(nil, obj.Field) - - // Checking stdlib behavior matches. - obj2 := TestData{ - Field: &boolVar, - } - - err = json.Unmarshal(data1, &obj2) - should.NoError(err) - should.Equal(true, *(obj2.Field.(*bool))) - - err = json.Unmarshal(data2, &obj2) - should.NoError(err) - should.Equal(nil, obj2.Field) -} - -func Test_omitempty_nil_interface(t *testing.T) { - type TestData struct { - Field interface{} `json:"field,omitempty"` - } - should := require.New(t) - - obj := TestData{ - Field: nil, - } - - js, err := json.Marshal(obj) - should.NoError(err) - should.Equal("{}", string(js)) - - str, err := MarshalToString(obj) - should.NoError(err) - should.Equal(string(js), str) -} - -func Test_omitempty_nil_nonempty_interface(t *testing.T) { - type TestData struct { - Field MyInterface `json:"field,omitempty"` - } - should := require.New(t) - - obj := TestData{ - Field: nil, - } - - js, err := json.Marshal(obj) - should.NoError(err) - should.Equal("{}", string(js)) - - str, err := MarshalToString(obj) - should.NoError(err) - should.Equal(string(js), str) - - obj.Field = MyString("hello") - err = UnmarshalFromString(`{"field":null}`, &obj) - should.NoError(err) - should.Equal(nil, obj.Field) -} - -func Test_marshal_nil_marshaler_interface(t *testing.T) { - type TestData struct { - Field json.Marshaler `json:"field"` - } - should := require.New(t) - - obj := TestData{ - Field: nil, - } - - js, err := json.Marshal(obj) - should.NoError(err) - should.Equal(`{"field":null}`, string(js)) - - str, err := MarshalToString(obj) - should.NoError(err) - should.Equal(string(js), str) -} - -func Test_marshal_nil_nonempty_interface(t *testing.T) { - type TestData struct { - Field MyInterface `json:"field"` - } - should := require.New(t) - - obj := TestData{ - Field: nil, - } - - js, err := json.Marshal(obj) - should.NoError(err) - should.Equal(`{"field":null}`, string(js)) - - str, err := MarshalToString(obj) - should.NoError(err) - should.Equal(string(js), str) - - obj.Field = MyString("hello") - err = Unmarshal(js, &obj) - should.NoError(err) - should.Equal(nil, obj.Field) -} - -func Test_overwrite_interface_ptr_value_with_nil(t *testing.T) { - type Wrapper struct { - Payload interface{} `json:"payload,omitempty"` - } - type Payload struct { - Value int `json:"val,omitempty"` - } - - should := require.New(t) - - payload := &Payload{} - wrapper := &Wrapper{ - Payload: &payload, - } - - err := json.Unmarshal([]byte(`{"payload": {"val": 42}}`), &wrapper) - should.Equal(nil, err) - should.Equal(&payload, wrapper.Payload) - should.Equal(42, (*(wrapper.Payload.(**Payload))).Value) - - err = json.Unmarshal([]byte(`{"payload": null}`), &wrapper) - should.Equal(nil, err) - should.Equal(&payload, wrapper.Payload) - should.Equal((*Payload)(nil), payload) - - payload = &Payload{} - wrapper = &Wrapper{ - Payload: &payload, - } - - err = Unmarshal([]byte(`{"payload": {"val": 42}}`), &wrapper) - should.Equal(nil, err) - should.Equal(&payload, wrapper.Payload) - should.Equal(42, (*(wrapper.Payload.(**Payload))).Value) - - err = Unmarshal([]byte(`{"payload": null}`), &wrapper) - should.Equal(nil, err) - should.Equal(&payload, wrapper.Payload) - should.Equal((*Payload)(nil), payload) -} - -func Test_overwrite_interface_value_with_nil(t *testing.T) { - type Wrapper struct { - Payload interface{} `json:"payload,omitempty"` - } - type Payload struct { - Value int `json:"val,omitempty"` - } - - should := require.New(t) - - payload := &Payload{} - wrapper := &Wrapper{ - Payload: payload, - } - - err := json.Unmarshal([]byte(`{"payload": {"val": 42}}`), &wrapper) - should.Equal(nil, err) - should.Equal(42, (*(wrapper.Payload.(*Payload))).Value) - - err = json.Unmarshal([]byte(`{"payload": null}`), &wrapper) - should.Equal(nil, err) - should.Equal(nil, wrapper.Payload) - should.Equal(42, payload.Value) - - payload = &Payload{} - wrapper = &Wrapper{ - Payload: payload, - } - - err = Unmarshal([]byte(`{"payload": {"val": 42}}`), &wrapper) - should.Equal(nil, err) - should.Equal(42, (*(wrapper.Payload.(*Payload))).Value) - - err = Unmarshal([]byte(`{"payload": null}`), &wrapper) - should.Equal(nil, err) - should.Equal(nil, wrapper.Payload) - should.Equal(42, payload.Value) -} - -func Test_unmarshal_into_nil(t *testing.T) { - type Payload struct { - Value int `json:"val,omitempty"` - } - type Wrapper struct { - Payload interface{} `json:"payload,omitempty"` - } - - should := require.New(t) - - var payload *Payload - wrapper := &Wrapper{ - Payload: payload, - } - - err := json.Unmarshal([]byte(`{"payload": {"val": 42}}`), &wrapper) - should.Nil(err) - should.NotNil(wrapper.Payload) - should.Nil(payload) - - err = json.Unmarshal([]byte(`{"payload": null}`), &wrapper) - should.Nil(err) - should.Nil(wrapper.Payload) - should.Nil(payload) - - payload = nil - wrapper = &Wrapper{ - Payload: payload, - } - - err = Unmarshal([]byte(`{"payload": {"val": 42}}`), &wrapper) - should.Nil(err) - should.NotNil(wrapper.Payload) - should.Nil(payload) - - err = Unmarshal([]byte(`{"payload": null}`), &wrapper) - should.Nil(err) - should.Nil(wrapper.Payload) - should.Nil(payload) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_invalid_test.go b/vendor/github.com/json-iterator/go/jsoniter_invalid_test.go deleted file mode 100644 index 69be4dc53..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_invalid_test.go +++ /dev/null @@ -1,138 +0,0 @@ -package jsoniter - -import ( - "bytes" - "encoding/json" - "github.com/stretchr/testify/require" - "io" - "testing" -) - -func Test_missing_object_end(t *testing.T) { - should := require.New(t) - type TestObject struct { - Metric string `json:"metric"` - Tags map[string]interface{} `json:"tags"` - } - obj := TestObject{} - should.NotNil(UnmarshalFromString(`{"metric": "sys.777","tags": {"a":"123"}`, &obj)) -} - -func Test_missing_array_end(t *testing.T) { - should := require.New(t) - should.NotNil(UnmarshalFromString(`[1,2,3`, &[]int{})) -} - -func Test_invalid_any(t *testing.T) { - should := require.New(t) - any := Get([]byte("[]")) - should.Equal(InvalidValue, any.Get(0.3).ValueType()) - // is nil correct ? - should.Equal(nil, any.Get(0.3).GetInterface()) - - any = any.Get(0.3) - should.Equal(false, any.ToBool()) - should.Equal(int(0), any.ToInt()) - should.Equal(int32(0), any.ToInt32()) - should.Equal(int64(0), any.ToInt64()) - should.Equal(uint(0), any.ToUint()) - should.Equal(uint32(0), any.ToUint32()) - should.Equal(uint64(0), any.ToUint64()) - should.Equal(float32(0), any.ToFloat32()) - should.Equal(float64(0), any.ToFloat64()) - should.Equal("", any.ToString()) - - should.Equal(InvalidValue, any.Get(0.1).Get(1).ValueType()) -} - -func Test_invalid_struct_input(t *testing.T) { - should := require.New(t) - type TestObject struct{} - input := []byte{54, 141, 30} - obj := TestObject{} - should.NotNil(Unmarshal(input, &obj)) -} - -func Test_invalid_slice_input(t *testing.T) { - should := require.New(t) - type TestObject struct{} - input := []byte{93} - obj := []string{} - should.NotNil(Unmarshal(input, &obj)) -} - -func Test_invalid_array_input(t *testing.T) { - should := require.New(t) - type TestObject struct{} - input := []byte{93} - obj := [0]string{} - should.NotNil(Unmarshal(input, &obj)) -} - -func Test_invalid_float(t *testing.T) { - inputs := []string{ - `1.e1`, // dot without following digit - `1.`, // dot can not be the last char - ``, // empty number - `01`, // extra leading zero - `-`, // negative without digit - `--`, // double negative - `--2`, // double negative - } - for _, input := range inputs { - t.Run(input, func(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, input+",") - iter.Skip() - should.NotEqual(io.EOF, iter.Error) - should.NotNil(iter.Error) - v := float64(0) - should.NotNil(json.Unmarshal([]byte(input), &v)) - iter = ParseString(ConfigDefault, input+",") - iter.ReadFloat64() - should.NotEqual(io.EOF, iter.Error) - should.NotNil(iter.Error) - iter = ParseString(ConfigDefault, input+",") - iter.ReadFloat32() - should.NotEqual(io.EOF, iter.Error) - should.NotNil(iter.Error) - }) - } -} - -func Test_chan(t *testing.T) { - t.Skip("do not support chan") - - type TestObject struct { - MyChan chan bool - MyField int - } - - should := require.New(t) - obj := TestObject{} - str, err := json.Marshal(obj) - should.Nil(err) - should.Equal(``, str) -} - -func Test_invalid_number(t *testing.T) { - type Message struct { - Number int `json:"number"` - } - obj := Message{} - decoder := ConfigCompatibleWithStandardLibrary.NewDecoder(bytes.NewBufferString(`{"number":"5"}`)) - err := decoder.Decode(&obj) - invalidStr := err.Error() - result, err := ConfigCompatibleWithStandardLibrary.Marshal(invalidStr) - should := require.New(t) - should.Nil(err) - result2, err := json.Marshal(invalidStr) - should.Nil(err) - should.Equal(string(result2), string(result)) -} - -func Test_valid(t *testing.T) { - should := require.New(t) - should.True(Valid([]byte(`{}`))) - should.False(Valid([]byte(`{`))) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_io_test.go b/vendor/github.com/json-iterator/go/jsoniter_io_test.go deleted file mode 100644 index 5046ccc40..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_io_test.go +++ /dev/null @@ -1,65 +0,0 @@ -package jsoniter - -import ( - "bytes" - "github.com/stretchr/testify/require" - "io" - "testing" -) - -func Test_read_by_one(t *testing.T) { - iter := Parse(ConfigDefault, bytes.NewBufferString("abc"), 1) - b := iter.readByte() - if iter.Error != nil { - t.Fatal(iter.Error) - } - if b != 'a' { - t.Fatal(b) - } - iter.unreadByte() - if iter.Error != nil { - t.Fatal(iter.Error) - } - b = iter.readByte() - if iter.Error != nil { - t.Fatal(iter.Error) - } - if b != 'a' { - t.Fatal(b) - } -} - -func Test_read_by_two(t *testing.T) { - should := require.New(t) - iter := Parse(ConfigDefault, bytes.NewBufferString("abc"), 2) - b := iter.readByte() - should.Nil(iter.Error) - should.Equal(byte('a'), b) - b = iter.readByte() - should.Nil(iter.Error) - should.Equal(byte('b'), b) - iter.unreadByte() - should.Nil(iter.Error) - iter.unreadByte() - should.Nil(iter.Error) - b = iter.readByte() - should.Nil(iter.Error) - should.Equal(byte('a'), b) -} - -func Test_read_until_eof(t *testing.T) { - iter := Parse(ConfigDefault, bytes.NewBufferString("abc"), 2) - iter.readByte() - iter.readByte() - b := iter.readByte() - if iter.Error != nil { - t.Fatal(iter.Error) - } - if b != 'c' { - t.Fatal(b) - } - iter.readByte() - if iter.Error != io.EOF { - t.Fatal(iter.Error) - } -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_iterator_test.go b/vendor/github.com/json-iterator/go/jsoniter_iterator_test.go deleted file mode 100644 index 951574d8d..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_iterator_test.go +++ /dev/null @@ -1,66 +0,0 @@ -package jsoniter - -import ( - "bytes" - "encoding/json" - "fmt" - "strconv" - "testing" - - "github.com/stretchr/testify/require" -) - -func Test_bad_case(t *testing.T) { - // field := *(*string)(unsafe.Pointer(&str)) - // caused this issue - iter := Parse(ConfigDefault, bytes.NewBufferString(`{"Info":{"InfoHash":"4lzhP/fwlVLRgalC31YbfBSiqwo=","InfoHashstr":"E25CE13FF7F09552D181A942DF561B7C14A2AB0A","AnnounceList":["http://tracker.nwps.ws:6969/announce","http://tracker.nwps.ws:6969/announce","http://tracker.winglai.com/announce","http://fr33dom.h33t.com:3310/announce","http://exodus.desync.com:6969/announce","http://torrent.gresille.org/announce","http://tracker.trackerfix.com/announce","udp://tracker.btzoo.eu:80/announce","http://tracker.windsormetalbattery.com/announce","udp://10.rarbg.me:80/announce","udp://ipv4.tracker.harry.lu:80/announce","udp://tracker.ilibr.org:6969/announce","udp://tracker.zond.org:80/announce","http://torrent-tracker.ru/announce.php","http://bigfoot1942.sektori.org:6969/announce","http://tracker.best-torrents.net:6969/announce","http://announce.torrentsmd.com:6969/announce","udp://tracker.token.ro:80/announce","udp://tracker.coppersurfer.tk:80","http://tracker.thepiratebay.org/announce","udp://9.rarbg.com:2710/announce","udp://open.demonii.com:1337/announce","udp://tracker.ccc.de:80/announce","udp://tracker.istole.it:80/announce","udp://tracker.publicbt.com:80/announce","udp://tracker.openbittorrent.com:80/announce","udp://tracker.istole.it:80/announce","http://tracker.istole.it/announce","udp://tracker.publicbt.com:80/announce","http://tracker.publicbt.com/announce","udp://open.demonii.com:1337/announce"],"Length":2434793890,"PieceSize":524288,"PieceNum":4645},"InfoHashstr":"E25CE13FF7F09552D181A942DF561B7C14A2AB0A","SectionNum":32,"PieceNum":4645,"PieceSize":16384,"Finished":false,"SparseSize":104857600,"Bit":[{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="},{"Size":4645,"EndIndex":580,"EndMask":248,"Good":0,"Flush":false,"Bit":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="}]}`), 4096) - count := 0 - for field := iter.ReadObject(); field != ""; field = iter.ReadObject() { - if field == "Bit" { - for iter.ReadArray() { - for field := iter.ReadObject(); field != ""; field = iter.ReadObject() { - if field == "Bit" { - iter.ReadStringAsSlice() - } else { - if field != "Size" && field != "EndIndex" && field != "EndMask" && field != "Good" && field != "Flush" { - t.Fatal(field) - } - iter.Skip() - } - } - count++ - } - } else { - iter.Skip() - } - } - if count != 32 { - t.Fatal(count) - } -} - -func Test_iterator_use_number(t *testing.T) { - // Test UseNumber with iterator Read() - inputs := []string{`2147483647`, `-2147483648`} - for _, input := range inputs { - t.Run(fmt.Sprintf("%v", input), func(t *testing.T) { - should := require.New(t) - iter := ParseString(Config{UseNumber: true}.Froze(), input) - expected := json.Number(input) - should.Equal(expected, iter.Read()) - }) - } -} - -func Test_iterator_without_number(t *testing.T) { - inputs := []string{`2147483647`, `-2147483648`} - for _, input := range inputs { - t.Run(fmt.Sprintf("%v", input), func(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, input) - expected, err := strconv.ParseInt(input, 10, 32) - should.Nil(err) - should.Equal(float64(expected), iter.Read()) - }) - } -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_large_file_test.go b/vendor/github.com/json-iterator/go/jsoniter_large_file_test.go deleted file mode 100644 index 29eb58b16..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_large_file_test.go +++ /dev/null @@ -1,157 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "io/ioutil" - "os" - "testing" -) - -//func Test_large_file(t *testing.T) { -// file, err := os.Open("/tmp/large-file.json") -// if err != nil { -// t.Fatal(err) -// } -// iter := Parse(file, 4096) -// count := 0 -// for iter.ReadArray() { -// iter.Skip() -// count++ -// } -// if count != 11351 { -// t.Fatal(count) -// } -//} - -func init() { - ioutil.WriteFile("/tmp/large-file.json", []byte(`[{ - "person": { - "id": "d50887ca-a6ce-4e59-b89f-14f0b5d03b03", - "name": { - "fullName": "Leonid Bugaev", - "givenName": "Leonid", - "familyName": "Bugaev" - }, - "email": "leonsbox@gmail.com", - "gender": "male", - "location": "Saint Petersburg, Saint Petersburg, RU", - "geo": { - "city": "Saint Petersburg", - "state": "Saint Petersburg", - "country": "Russia", - "lat": 59.9342802, - "lng": 30.3350986 - }, - "bio": "Senior engineer at Granify.com", - "site": "http://flickfaver.com", - "avatar": "https://d1ts43dypk8bqh.cloudfront.net/v1/avatars/d50887ca-a6ce-4e59-b89f-14f0b5d03b03", - "employment": { - "name": "www.latera.ru", - "title": "Software Engineer", - "domain": "gmail.com" - }, - "facebook": { - "handle": "leonid.bugaev" - }, - "github": { - "handle": "buger", - "id": 14009, - "avatar": "https://avatars.githubusercontent.com/u/14009?v=3", - "company": "Granify", - "blog": "http://leonsbox.com", - "followers": 95, - "following": 10 - }, - "twitter": { - "handle": "flickfaver", - "id": 77004410, - "bio": null, - "followers": 2, - "following": 1, - "statuses": 5, - "favorites": 0, - "location": "", - "site": "http://flickfaver.com", - "avatar": null - }, - "linkedin": { - "handle": "in/leonidbugaev" - }, - "googleplus": { - "handle": null - }, - "angellist": { - "handle": "leonid-bugaev", - "id": 61541, - "bio": "Senior engineer at Granify.com", - "blog": "http://buger.github.com", - "site": "http://buger.github.com", - "followers": 41, - "avatar": "https://d1qb2nb5cznatu.cloudfront.net/users/61541-medium_jpg?1405474390" - }, - "klout": { - "handle": null, - "score": null - }, - "foursquare": { - "handle": null - }, - "aboutme": { - "handle": "leonid.bugaev", - "bio": null, - "avatar": null - }, - "gravatar": { - "handle": "buger", - "urls": [ - ], - "avatar": "http://1.gravatar.com/avatar/f7c8edd577d13b8930d5522f28123510", - "avatars": [ - { - "url": "http://1.gravatar.com/avatar/f7c8edd577d13b8930d5522f28123510", - "type": "thumbnail" - } - ] - }, - "fuzzy": false - }, - "company": "hello" -}]`), 0666) -} - -/* -200000 8886 ns/op 4336 B/op 6 allocs/op -50000 34244 ns/op 6744 B/op 14 allocs/op -*/ -func Benchmark_jsoniter_large_file(b *testing.B) { - b.ReportAllocs() - for n := 0; n < b.N; n++ { - file, _ := os.Open("/tmp/large-file.json") - iter := Parse(ConfigDefault, file, 4096) - count := 0 - iter.ReadArrayCB(func(iter *Iterator) bool { - // Skip() is strict by default, use --tags jsoniter-sloppy to skip without validation - iter.Skip() - count++ - return true - }) - file.Close() - if iter.Error != nil { - b.Error(iter.Error) - } - } -} - -func Benchmark_json_large_file(b *testing.B) { - b.ReportAllocs() - for n := 0; n < b.N; n++ { - file, _ := os.Open("/tmp/large-file.json") - bytes, _ := ioutil.ReadAll(file) - file.Close() - result := []struct{}{} - err := json.Unmarshal(bytes, &result) - if err != nil { - b.Error(err) - } - } -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_map_test.go b/vendor/github.com/json-iterator/go/jsoniter_map_test.go deleted file mode 100644 index 0865428f5..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_map_test.go +++ /dev/null @@ -1,160 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "math/big" - "testing" - - "github.com/stretchr/testify/require" - "strings" -) - -func Test_read_map(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `{"hello": "world"}`) - m := map[string]string{"1": "2"} - iter.ReadVal(&m) - copy(iter.buf, []byte{0, 0, 0, 0, 0, 0}) - should.Equal(map[string]string{"1": "2", "hello": "world"}, m) -} - -func Test_read_map_of_interface(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `{"hello": "world"}`) - m := map[string]interface{}{"1": "2"} - iter.ReadVal(&m) - should.Equal(map[string]interface{}{"1": "2", "hello": "world"}, m) - iter = ParseString(ConfigDefault, `{"hello": "world"}`) - should.Equal(map[string]interface{}{"hello": "world"}, iter.Read()) -} - -func Test_map_wrapper_any_get_all(t *testing.T) { - should := require.New(t) - any := Wrap(map[string][]int{"Field1": {1, 2}}) - should.Equal(`{"Field1":1}`, any.Get('*', 0).ToString()) - should.Contains(any.Keys(), "Field1") - - // map write to - stream := NewStream(ConfigDefault, nil, 0) - any.WriteTo(stream) - // TODO cannot pass - //should.Equal(string(stream.buf), "") -} - -func Test_write_val_map(t *testing.T) { - should := require.New(t) - val := map[string]string{"1": "2"} - str, err := MarshalToString(val) - should.Nil(err) - should.Equal(`{"1":"2"}`, str) -} - -func Test_slice_of_map(t *testing.T) { - should := require.New(t) - val := []map[string]string{{"1": "2"}} - str, err := MarshalToString(val) - should.Nil(err) - should.Equal(`[{"1":"2"}]`, str) - val = []map[string]string{} - should.Nil(UnmarshalFromString(str, &val)) - should.Equal("2", val[0]["1"]) -} - -func Test_encode_int_key_map(t *testing.T) { - should := require.New(t) - val := map[int]string{1: "2"} - str, err := MarshalToString(val) - should.Nil(err) - should.Equal(`{"1":"2"}`, str) -} - -func Test_decode_int_key_map(t *testing.T) { - should := require.New(t) - var val map[int]string - should.Nil(UnmarshalFromString(`{"1":"2"}`, &val)) - should.Equal(map[int]string{1: "2"}, val) -} - -func Test_encode_TextMarshaler_key_map(t *testing.T) { - should := require.New(t) - f, _, _ := big.ParseFloat("1", 10, 64, big.ToZero) - val := map[*big.Float]string{f: "2"} - str, err := MarshalToString(val) - should.Nil(err) - should.Equal(`{"1":"2"}`, str) -} - -func Test_decode_TextMarshaler_key_map(t *testing.T) { - should := require.New(t) - var val map[*big.Float]string - should.Nil(UnmarshalFromString(`{"1":"2"}`, &val)) - str, err := MarshalToString(val) - should.Nil(err) - should.Equal(`{"1":"2"}`, str) -} - -func Test_map_key_with_escaped_char(t *testing.T) { - type Ttest struct { - Map map[string]string - } - var jsonBytes = []byte(` - { - "Map":{ - "k\"ey": "val" - } - }`) - should := require.New(t) - { - var obj Ttest - should.Nil(json.Unmarshal(jsonBytes, &obj)) - should.Equal(map[string]string{"k\"ey": "val"}, obj.Map) - } - { - var obj Ttest - should.Nil(Unmarshal(jsonBytes, &obj)) - should.Equal(map[string]string{"k\"ey": "val"}, obj.Map) - } -} - -func Test_encode_map_with_sorted_keys(t *testing.T) { - should := require.New(t) - m := map[string]interface{}{ - "3": 3, - "1": 1, - "2": 2, - } - bytes, err := json.Marshal(m) - should.Nil(err) - output, err := ConfigCompatibleWithStandardLibrary.MarshalToString(m) - should.Nil(err) - should.Equal(string(bytes), output) -} - -func Test_encode_map_uint_keys(t *testing.T) { - should := require.New(t) - m := map[uint64]interface{}{ - uint64(1): "a", - uint64(2): "a", - uint64(4): "a", - } - - bytes, err := json.Marshal(m) - should.Nil(err) - - output, err := ConfigCompatibleWithStandardLibrary.MarshalToString(m) - should.Nil(err) - should.Equal(string(bytes), output) -} - -func Test_read_map_with_reader(t *testing.T) { - should := require.New(t) - input := `{"branch":"beta","change_log":"add the rows{10}","channel":"fros","create_time":"2017-06-13 16:39:08","firmware_list":"","md5":"80dee2bf7305bcf179582088e29fd7b9","note":{"CoreServices":{"md5":"d26975c0a8c7369f70ed699f2855cc2e","package_name":"CoreServices","version_code":"76","version_name":"1.0.76"},"FrDaemon":{"md5":"6b1f0626673200bc2157422cd2103f5d","package_name":"FrDaemon","version_code":"390","version_name":"1.0.390"},"FrGallery":{"md5":"90d767f0f31bcd3c1d27281ec979ba65","package_name":"FrGallery","version_code":"349","version_name":"1.0.349"},"FrLocal":{"md5":"f15a215b2c070a80a01f07bde4f219eb","package_name":"FrLocal","version_code":"791","version_name":"1.0.791"}},"pack_region_urls":{"CN":"https://s3.cn-north-1.amazonaws.com.cn/xxx-os/ttt_xxx_android_1.5.3.344.393.zip","default":"http://192.168.8.78/ttt_xxx_android_1.5.3.344.393.zip","local":"http://192.168.8.78/ttt_xxx_android_1.5.3.344.393.zip"},"pack_version":"1.5.3.344.393","pack_version_code":393,"region":"all","release_flag":0,"revision":62,"size":38966875,"status":3}` - reader := strings.NewReader(input) - decoder := ConfigCompatibleWithStandardLibrary.NewDecoder(reader) - m1 := map[string]interface{}{} - should.Nil(decoder.Decode(&m1)) - m2 := map[string]interface{}{} - should.Nil(json.Unmarshal([]byte(input), &m2)) - should.Equal(m2, m1) - should.Equal("1.0.76", m1["note"].(map[string]interface{})["CoreServices"].(map[string]interface{})["version_name"]) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_must_be_valid_test.go b/vendor/github.com/json-iterator/go/jsoniter_must_be_valid_test.go deleted file mode 100644 index 01a91c90f..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_must_be_valid_test.go +++ /dev/null @@ -1,71 +0,0 @@ -package jsoniter - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -// if must be valid is useless, just drop this test -func Test_must_be_valid(t *testing.T) { - should := require.New(t) - any := Get([]byte("123")) - should.Equal(any.MustBeValid().ToInt(), 123) - - any = Wrap(int8(10)) - should.Equal(any.MustBeValid().ToInt(), 10) - - any = Wrap(int16(10)) - should.Equal(any.MustBeValid().ToInt(), 10) - - any = Wrap(int32(10)) - should.Equal(any.MustBeValid().ToInt(), 10) - - any = Wrap(int64(10)) - should.Equal(any.MustBeValid().ToInt(), 10) - - any = Wrap(uint(10)) - should.Equal(any.MustBeValid().ToInt(), 10) - - any = Wrap(uint8(10)) - should.Equal(any.MustBeValid().ToInt(), 10) - - any = Wrap(uint16(10)) - should.Equal(any.MustBeValid().ToInt(), 10) - - any = Wrap(uint32(10)) - should.Equal(any.MustBeValid().ToInt(), 10) - - any = Wrap(uint64(10)) - should.Equal(any.MustBeValid().ToInt(), 10) - - any = Wrap(float32(10)) - should.Equal(any.MustBeValid().ToFloat64(), float64(10)) - - any = Wrap(float64(10)) - should.Equal(any.MustBeValid().ToFloat64(), float64(10)) - - any = Wrap(true) - should.Equal(any.MustBeValid().ToFloat64(), float64(1)) - - any = Wrap(false) - should.Equal(any.MustBeValid().ToFloat64(), float64(0)) - - any = Wrap(nil) - should.Equal(any.MustBeValid().ToFloat64(), float64(0)) - - any = Wrap(struct{ age int }{age: 1}) - should.Equal(any.MustBeValid().ToFloat64(), float64(0)) - - any = Wrap(map[string]interface{}{"abc": 1}) - should.Equal(any.MustBeValid().ToFloat64(), float64(0)) - - any = Wrap("abc") - should.Equal(any.MustBeValid().ToFloat64(), float64(0)) - - any = Wrap([]int{}) - should.Equal(any.MustBeValid().ToFloat64(), float64(0)) - - any = Wrap([]int{1, 2}) - should.Equal(any.MustBeValid().ToFloat64(), float64(1)) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_nested_test.go b/vendor/github.com/json-iterator/go/jsoniter_nested_test.go deleted file mode 100644 index 29f8cee84..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_nested_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "reflect" - "testing" -) - -type Level1 struct { - Hello []Level2 -} - -type Level2 struct { - World string -} - -func Test_nested(t *testing.T) { - iter := ParseString(ConfigDefault, `{"hello": [{"world": "value1"}, {"world": "value2"}]}`) - l1 := Level1{} - for l1Field := iter.ReadObject(); l1Field != ""; l1Field = iter.ReadObject() { - switch l1Field { - case "hello": - l2Array := []Level2{} - for iter.ReadArray() { - l2 := Level2{} - for l2Field := iter.ReadObject(); l2Field != ""; l2Field = iter.ReadObject() { - switch l2Field { - case "world": - l2.World = iter.ReadString() - default: - iter.ReportError("bind l2", "unexpected field: "+l2Field) - } - } - l2Array = append(l2Array, l2) - } - l1.Hello = l2Array - default: - iter.ReportError("bind l1", "unexpected field: "+l1Field) - } - } - if !reflect.DeepEqual(l1, Level1{ - Hello: []Level2{ - {World: "value1"}, - {World: "value2"}, - }, - }) { - t.Fatal(l1) - } -} - -func Benchmark_jsoniter_nested(b *testing.B) { - for n := 0; n < b.N; n++ { - iter := ParseString(ConfigDefault, `{"hello": [{"world": "value1"}, {"world": "value2"}]}`) - l1 := Level1{} - for l1Field := iter.ReadObject(); l1Field != ""; l1Field = iter.ReadObject() { - switch l1Field { - case "hello": - l1.Hello = readLevel1Hello(iter) - default: - iter.Skip() - } - } - } -} - -func readLevel1Hello(iter *Iterator) []Level2 { - l2Array := make([]Level2, 0, 2) - for iter.ReadArray() { - l2 := Level2{} - for l2Field := iter.ReadObject(); l2Field != ""; l2Field = iter.ReadObject() { - switch l2Field { - case "world": - l2.World = iter.ReadString() - default: - iter.Skip() - } - } - l2Array = append(l2Array, l2) - } - return l2Array -} - -func Benchmark_json_nested(b *testing.B) { - for n := 0; n < b.N; n++ { - l1 := Level1{} - json.Unmarshal([]byte(`{"hello": [{"world": "value1"}, {"world": "value2"}]}`), &l1) - } -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_null_test.go b/vendor/github.com/json-iterator/go/jsoniter_null_test.go deleted file mode 100644 index 8c891470f..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_null_test.go +++ /dev/null @@ -1,168 +0,0 @@ -package jsoniter - -import ( - "bytes" - "encoding/json" - "io" - "testing" - - "github.com/stretchr/testify/require" -) - -func Test_read_null(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `null`) - should.True(iter.ReadNil()) - iter = ParseString(ConfigDefault, `null`) - should.Nil(iter.Read()) - iter = ParseString(ConfigDefault, `navy`) - iter.Read() - should.True(iter.Error != nil && iter.Error != io.EOF) - iter = ParseString(ConfigDefault, `navy`) - iter.ReadNil() - should.True(iter.Error != nil && iter.Error != io.EOF) -} - -func Test_write_null(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteNil() - stream.Flush() - should.Nil(stream.Error) - should.Equal("null", buf.String()) -} - -func Test_encode_null(t *testing.T) { - should := require.New(t) - str, err := MarshalToString(nil) - should.Nil(err) - should.Equal("null", str) -} - -func Test_decode_null_object_field(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `[null,"a"]`) - iter.ReadArray() - if iter.ReadObject() != "" { - t.FailNow() - } - iter.ReadArray() - if iter.ReadString() != "a" { - t.FailNow() - } - type TestObject struct { - Field string - } - objs := []TestObject{} - should.Nil(UnmarshalFromString("[null]", &objs)) - should.Len(objs, 1) -} - -func Test_decode_null_array_element(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `[null,"a"]`) - should.True(iter.ReadArray()) - should.True(iter.ReadNil()) - should.True(iter.ReadArray()) - should.Equal("a", iter.ReadString()) -} - -func Test_decode_null_array(t *testing.T) { - should := require.New(t) - arr := []string{} - should.Nil(UnmarshalFromString("null", &arr)) - should.Nil(arr) -} - -func Test_decode_null_map(t *testing.T) { - should := require.New(t) - arr := map[string]string{} - should.Nil(UnmarshalFromString("null", &arr)) - should.Nil(arr) -} - -func Test_decode_null_string(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `[null,"a"]`) - should.True(iter.ReadArray()) - should.Equal("", iter.ReadString()) - should.True(iter.ReadArray()) - should.Equal("a", iter.ReadString()) -} - -func Test_decode_null_skip(t *testing.T) { - iter := ParseString(ConfigDefault, `[null,"a"]`) - iter.ReadArray() - iter.Skip() - iter.ReadArray() - if iter.ReadString() != "a" { - t.FailNow() - } -} - -func Test_encode_nil_map(t *testing.T) { - should := require.New(t) - type Ttest map[string]string - var obj1 Ttest - output, err := json.Marshal(obj1) - should.Nil(err) - should.Equal("null", string(output)) - output, err = json.Marshal(&obj1) - should.Nil(err) - should.Equal("null", string(output)) - output, err = Marshal(obj1) - should.Nil(err) - should.Equal("null", string(output)) - output, err = Marshal(&obj1) - should.Nil(err) - should.Equal("null", string(output)) -} - -func Test_encode_nil_array(t *testing.T) { - should := require.New(t) - type Ttest []string - var obj1 Ttest - output, err := json.Marshal(obj1) - should.Nil(err) - should.Equal("null", string(output)) - output, err = json.Marshal(&obj1) - should.Nil(err) - should.Equal("null", string(output)) - output, err = Marshal(obj1) - should.Nil(err) - should.Equal("null", string(output)) - output, err = Marshal(&obj1) - should.Nil(err) - should.Equal("null", string(output)) -} - -func Test_decode_nil_num(t *testing.T) { - type TestData struct { - Field int `json:"field"` - } - should := require.New(t) - - data1 := []byte(`{"field": 42}`) - data2 := []byte(`{"field": null}`) - - // Checking stdlib behavior as well - obj2 := TestData{} - err := json.Unmarshal(data1, &obj2) - should.Equal(nil, err) - should.Equal(42, obj2.Field) - - err = json.Unmarshal(data2, &obj2) - should.Equal(nil, err) - should.Equal(42, obj2.Field) - - obj := TestData{} - - err = Unmarshal(data1, &obj) - should.Equal(nil, err) - should.Equal(42, obj.Field) - - err = Unmarshal(data2, &obj) - should.Equal(nil, err) - should.Equal(42, obj.Field) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_object_test.go b/vendor/github.com/json-iterator/go/jsoniter_object_test.go deleted file mode 100644 index 9c9c53d02..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_object_test.go +++ /dev/null @@ -1,342 +0,0 @@ -package jsoniter - -import ( - "bytes" - "fmt" - "testing" - - "github.com/stretchr/testify/require" -) - -func Test_empty_object(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `{}`) - field := iter.ReadObject() - should.Equal("", field) - iter = ParseString(ConfigDefault, `{}`) - iter.ReadObjectCB(func(iter *Iterator, field string) bool { - should.FailNow("should not call") - return true - }) -} - -func Test_one_field(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `{"a": "stream"}`) - field := iter.ReadObject() - should.Equal("a", field) - value := iter.ReadString() - should.Equal("stream", value) - field = iter.ReadObject() - should.Equal("", field) - iter = ParseString(ConfigDefault, `{"a": "stream"}`) - should.True(iter.ReadObjectCB(func(iter *Iterator, field string) bool { - should.Equal("a", field) - iter.Skip() - return true - })) - -} - -func Test_two_field(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `{ "a": "stream" , "c": "d" }`) - field := iter.ReadObject() - should.Equal("a", field) - value := iter.ReadString() - should.Equal("stream", value) - field = iter.ReadObject() - should.Equal("c", field) - value = iter.ReadString() - should.Equal("d", value) - field = iter.ReadObject() - should.Equal("", field) - iter = ParseString(ConfigDefault, `{"field1": "1", "field2": 2}`) - for field := iter.ReadObject(); field != ""; field = iter.ReadObject() { - switch field { - case "field1": - iter.ReadString() - case "field2": - iter.ReadInt64() - default: - iter.ReportError("bind object", "unexpected field") - } - } -} - -func Test_object_wrapper_any_get_all(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 []int - Field2 []int - } - any := Wrap(TestObject{[]int{1, 2}, []int{3, 4}}) - should.Contains(any.Get('*', 0).ToString(), `"Field2":3`) - should.Contains(any.Keys(), "Field1") - should.Contains(any.Keys(), "Field2") - should.NotContains(any.Keys(), "Field3") - - //should.Contains(any.GetObject()["Field1"].GetArray()[0], 1) -} - -func Test_write_object(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(Config{IndentionStep: 2}.Froze(), buf, 4096) - stream.WriteObjectStart() - stream.WriteObjectField("hello") - stream.WriteInt(1) - stream.WriteMore() - stream.WriteObjectField("world") - stream.WriteInt(2) - stream.WriteObjectEnd() - stream.Flush() - should.Nil(stream.Error) - should.Equal("{\n \"hello\": 1,\n \"world\": 2\n}", buf.String()) -} - -func Test_write_val_zero_field_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - } - obj := TestObject{} - str, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`{}`, str) -} - -func Test_write_val_one_field_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string `json:"field-1"` - } - obj := TestObject{"hello"} - str, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`{"field-1":"hello"}`, str) -} - -func Test_mixed(t *testing.T) { - should := require.New(t) - type AA struct { - ID int `json:"id"` - Payload map[string]interface{} `json:"payload"` - buf *bytes.Buffer - } - aa := AA{} - err := UnmarshalFromString(` {"id":1, "payload":{"account":"123","password":"456"}}`, &aa) - should.Nil(err) - should.Equal(1, aa.ID) - should.Equal("123", aa.Payload["account"]) -} - -func Test_omit_empty(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string `json:"field-1,omitempty"` - Field2 string `json:"field-2,omitempty"` - Field3 string `json:"field-3,omitempty"` - } - obj := TestObject{} - obj.Field2 = "hello" - str, err := MarshalToString(&obj) - should.Nil(err) - should.Equal(`{"field-2":"hello"}`, str) -} - -func Test_ignore_field_on_not_valid_type(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string `json:"field-1,omitempty"` - Field2 func() `json:"-"` - } - obj := TestObject{} - obj.Field1 = "hello world" - obj.Field2 = func() {} - str, err := MarshalToString(&obj) - should.Nil(err) - should.Equal(`{"field-1":"hello world"}`, str) -} - -func Test_recursive_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - Me *TestObject - } - obj := TestObject{} - str, err := MarshalToString(obj) - should.Nil(err) - should.Contains(str, `"Field1":""`) - should.Contains(str, `"Me":null`) - err = UnmarshalFromString(str, &obj) - should.Nil(err) -} - -func Test_encode_anonymous_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field string - } - str, err := MarshalToString(struct { - TestObject - Field int - }{ - Field: 100, - }) - should.Nil(err) - should.Equal(`{"Field":100}`, str) -} - -func Test_decode_anonymous_struct(t *testing.T) { - should := require.New(t) - type Inner struct { - Key string `json:"key"` - } - - type Outer struct { - Inner - } - var outer Outer - j := []byte("{\"key\":\"value\"}") - should.Nil(Unmarshal(j, &outer)) - should.Equal("value", outer.Key) -} - -func Test_multiple_level_anonymous_struct(t *testing.T) { - type Level1 struct { - Field1 string - } - type Level2 struct { - Level1 - Field2 string - } - type Level3 struct { - Level2 - Field3 string - } - should := require.New(t) - obj := Level3{Level2{Level1{"1"}, "2"}, "3"} - output, err := MarshalToString(obj) - should.Nil(err) - should.Equal(`{"Field1":"1","Field2":"2","Field3":"3"}`, output) -} - -func Test_multiple_level_anonymous_struct_with_ptr(t *testing.T) { - type Level1 struct { - Field1 string - Field2 string - Field4 string - } - type Level2 struct { - *Level1 - Field2 string - Field3 string - } - type Level3 struct { - *Level2 - Field3 string - } - should := require.New(t) - obj := Level3{&Level2{&Level1{"1", "", "4"}, "2", ""}, "3"} - output, err := MarshalToString(obj) - should.Nil(err) - should.Contains(output, `"Field1":"1"`) - should.Contains(output, `"Field2":"2"`) - should.Contains(output, `"Field3":"3"`) - should.Contains(output, `"Field4":"4"`) -} - -func Test_shadow_struct_field(t *testing.T) { - should := require.New(t) - type omit *struct{} - type CacheItem struct { - Key string `json:"key"` - MaxAge int `json:"cacheAge"` - } - output, err := MarshalToString(struct { - *CacheItem - - // Omit bad keys - OmitMaxAge omit `json:"cacheAge,omitempty"` - - // Add nice keys - MaxAge int `json:"max_age"` - }{ - CacheItem: &CacheItem{ - Key: "value", - MaxAge: 100, - }, - MaxAge: 20, - }) - should.Nil(err) - should.Contains(output, `"key":"value"`) - should.Contains(output, `"max_age":20`) -} - -func Test_embedded_order(t *testing.T) { - type A struct { - Field2 string - } - - type C struct { - Field5 string - } - - type B struct { - Field4 string - C - Field6 string - } - - type TestObject struct { - Field1 string - A - Field3 string - B - Field7 string - } - should := require.New(t) - s := TestObject{} - output, err := MarshalToString(s) - should.Nil(err) - should.Equal(`{"Field1":"","Field2":"","Field3":"","Field4":"","Field5":"","Field6":"","Field7":""}`, output) -} - -func Test_decode_nested(t *testing.T) { - type StructOfString struct { - Field1 string - Field2 string - } - iter := ParseString(ConfigDefault, `[{"field1": "hello"}, null, {"field2": "world"}]`) - slice := []*StructOfString{} - iter.ReadVal(&slice) - if len(slice) != 3 { - fmt.Println(iter.Error) - t.Fatal(len(slice)) - } - if slice[0].Field1 != "hello" { - fmt.Println(iter.Error) - t.Fatal(slice[0]) - } - if slice[1] != nil { - fmt.Println(iter.Error) - t.Fatal(slice[1]) - } - if slice[2].Field2 != "world" { - fmt.Println(iter.Error) - t.Fatal(slice[2]) - } -} - -func Test_decode_field_with_escape(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - } - var obj TestObject - should.Nil(ConfigCompatibleWithStandardLibrary.Unmarshal([]byte(`{"Field\"1":"hello"}`), &obj)) - should.Equal("", obj.Field1) - should.Nil(ConfigCompatibleWithStandardLibrary.Unmarshal([]byte(`{"\u0046ield1":"hello"}`), &obj)) - should.Equal("hello", obj.Field1) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_optional_test.go b/vendor/github.com/json-iterator/go/jsoniter_optional_test.go deleted file mode 100644 index 82b789b50..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_optional_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package jsoniter - -import ( - "github.com/stretchr/testify/require" - "testing" -) - -func Test_encode_optional_int_pointer(t *testing.T) { - should := require.New(t) - var ptr *int - str, err := MarshalToString(ptr) - should.Nil(err) - should.Equal("null", str) - val := 100 - ptr = &val - str, err = MarshalToString(ptr) - should.Nil(err) - should.Equal("100", str) -} - -func Test_decode_struct_with_optional_field(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 *string - Field2 *string - } - obj := TestObject{} - UnmarshalFromString(`{"field1": null, "field2": "world"}`, &obj) - should.Nil(obj.Field1) - should.Equal("world", *obj.Field2) -} - -func Test_encode_struct_with_optional_field(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 *string - Field2 *string - } - obj := TestObject{} - world := "world" - obj.Field2 = &world - str, err := MarshalToString(obj) - should.Nil(err) - should.Contains(str, `"Field1":null`) - should.Contains(str, `"Field2":"world"`) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_raw_message_test.go b/vendor/github.com/json-iterator/go/jsoniter_raw_message_test.go deleted file mode 100644 index 4fba33f89..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_raw_message_test.go +++ /dev/null @@ -1,114 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "github.com/stretchr/testify/require" - "strings" - "testing" -) - -func Test_json_RawMessage(t *testing.T) { - should := require.New(t) - var data json.RawMessage - should.Nil(Unmarshal([]byte(`[1,2,3]`), &data)) - should.Equal(`[1,2,3]`, string(data)) - str, err := MarshalToString(data) - should.Nil(err) - should.Equal(`[1,2,3]`, str) -} - -func Test_jsoniter_RawMessage(t *testing.T) { - should := require.New(t) - var data RawMessage - should.Nil(Unmarshal([]byte(`[1,2,3]`), &data)) - should.Equal(`[1,2,3]`, string(data)) - str, err := MarshalToString(data) - should.Nil(err) - should.Equal(`[1,2,3]`, str) -} - -func Test_json_RawMessage_in_struct(t *testing.T) { - type TestObject struct { - Field1 string - Field2 json.RawMessage - } - should := require.New(t) - var data TestObject - should.Nil(Unmarshal([]byte(`{"field1": "hello", "field2": [1,2,3]}`), &data)) - should.Equal(` [1,2,3]`, string(data.Field2)) - should.Equal(`hello`, data.Field1) -} - -func Test_decode_map_of_raw_message(t *testing.T) { - should := require.New(t) - type RawMap map[string]*json.RawMessage - b := []byte("{\"test\":[{\"key\":\"value\"}]}") - var rawMap RawMap - should.Nil(Unmarshal(b, &rawMap)) - should.Equal(`[{"key":"value"}]`, string(*rawMap["test"])) - type Inner struct { - Key string `json:"key"` - } - var inner []Inner - Unmarshal(*rawMap["test"], &inner) - should.Equal("value", inner[0].Key) -} - -func Test_encode_map_of_raw_message(t *testing.T) { - should := require.New(t) - type RawMap map[string]*json.RawMessage - value := json.RawMessage("[]") - rawMap := RawMap{"hello": &value} - output, err := MarshalToString(rawMap) - should.Nil(err) - should.Equal(`{"hello":[]}`, output) -} - -func Test_encode_map_of_jsoniter_raw_message(t *testing.T) { - should := require.New(t) - type RawMap map[string]*RawMessage - value := RawMessage("[]") - rawMap := RawMap{"hello": &value} - output, err := MarshalToString(rawMap) - should.Nil(err) - should.Equal(`{"hello":[]}`, output) -} - -func Test_marshal_invalid_json_raw_message(t *testing.T) { - type A struct { - Raw json.RawMessage `json:"raw"` - } - message := []byte(`{}`) - - a := A{} - should := require.New(t) - should.Nil(ConfigCompatibleWithStandardLibrary.Unmarshal(message, &a)) - aout, aouterr := ConfigCompatibleWithStandardLibrary.Marshal(&a) - should.Equal(`{"raw":null}`, string(aout)) - should.Nil(aouterr) -} - -func Test_raw_message_memory_not_copied_issue(t *testing.T) { - jsonStream := `{"name":"xxxxx","bundle_id":"com.zonst.majiang","app_platform":"ios","app_category":"100103", "budget_day":1000,"bidding_min":1,"bidding_max":2,"bidding_type":"CPM", "freq":{"open":true,"type":"day","num":100},"speed":1, "targeting":{"vendor":{"open":true,"list":["zonst"]}, "geo_code":{"open":true,"list":["156110100"]},"app_category":{"open":true,"list":["100101"]}, "day_parting":{"open":true,"list":["100409","100410"]},"device_type":{"open":true,"list":["ipad"]}, "os_version":{"open":true,"list":[10]},"carrier":{"open":true,"list":["mobile"]}, "network":{"open":true,"list":["4G"]}},"url":{"tracking_imp_url":"http://www.baidu.com", "tracking_clk_url":"http://www.baidu.com","jump_url":"http://www.baidu.com","deep_link_url":"http://www.baidu.com"}}` - type IteratorObject struct { - Name *string `json:"name"` - BundleId *string `json:"bundle_id"` - AppCategory *string `json:"app_category"` - AppPlatform *string `json:"app_platform"` - BudgetDay *float32 `json:"budget_day"` - BiddingMax *float32 `json:"bidding_max"` - BiddingMin *float32 `json:"bidding_min"` - BiddingType *string `json:"bidding_type"` - Freq *RawMessage `json:"freq"` - Targeting *RawMessage `json:"targeting"` - Url *RawMessage `json:"url"` - Speed *int `json:"speed" db:"speed"` - } - - obj := &IteratorObject{} - decoder := NewDecoder(strings.NewReader(jsonStream)) - err := decoder.Decode(obj) - should := require.New(t) - should.Nil(err) - should.Equal(`{"open":true,"type":"day","num":100}`, string(*obj.Freq)) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_reader_test.go b/vendor/github.com/json-iterator/go/jsoniter_reader_test.go deleted file mode 100644 index b3b3588e1..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_reader_test.go +++ /dev/null @@ -1,57 +0,0 @@ -package jsoniter - -import ( - "github.com/stretchr/testify/require" - "strings" - "testing" - "time" -) - -func Test_reader_and_load_more(t *testing.T) { - should := require.New(t) - type TestObject struct { - CreatedAt time.Time - } - reader := strings.NewReader(` -{ - "agency": null, - "candidateId": 0, - "candidate": "Blah Blah", - "bookingId": 0, - "shiftId": 1, - "shiftTypeId": 0, - "shift": "Standard", - "bonus": 0, - "bonusNI": 0, - "days": [], - "totalHours": 27, - "expenses": [], - "weekEndingDateSystem": "2016-10-09", - "weekEndingDateClient": "2016-10-09", - "submittedAt": null, - "submittedById": null, - "approvedAt": "2016-10-10T18:38:04Z", - "approvedById": 0, - "authorisedAt": "2016-10-10T18:38:04Z", - "authorisedById": 0, - "invoicedAt": "2016-10-10T20:00:00Z", - "revokedAt": null, - "revokedById": null, - "revokeReason": null, - "rejectedAt": null, - "rejectedById": null, - "rejectReasonCode": null, - "rejectReason": null, - "createdAt": "2016-10-03T00:00:00Z", - "updatedAt": "2016-11-09T10:26:13Z", - "updatedById": null, - "overrides": [], - "bookingApproverId": null, - "bookingApprover": null, - "status": "approved" -} - `) - decoder := ConfigCompatibleWithStandardLibrary.NewDecoder(reader) - obj := TestObject{} - should.Nil(decoder.Decode(&obj)) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_reflect_native_test.go b/vendor/github.com/json-iterator/go/jsoniter_reflect_native_test.go deleted file mode 100644 index 0e2d68bba..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_reflect_native_test.go +++ /dev/null @@ -1,154 +0,0 @@ -package jsoniter - -import ( - "fmt" - "testing" -) - -func Test_reflect_str(t *testing.T) { - iter := ParseString(ConfigDefault, `"hello"`) - str := "" - iter.ReadVal(&str) - if str != "hello" { - fmt.Println(iter.Error) - t.Fatal(str) - } -} - -func Test_reflect_ptr_str(t *testing.T) { - iter := ParseString(ConfigDefault, `"hello"`) - var str *string - iter.ReadVal(&str) - if *str != "hello" { - t.Fatal(str) - } -} - -func Test_reflect_int(t *testing.T) { - iter := ParseString(ConfigDefault, `123`) - val := int(0) - iter.ReadVal(&val) - if val != 123 { - t.Fatal(val) - } -} - -func Test_reflect_int8(t *testing.T) { - iter := ParseString(ConfigDefault, `123`) - val := int8(0) - iter.ReadVal(&val) - if val != 123 { - t.Fatal(val) - } -} - -func Test_reflect_int16(t *testing.T) { - iter := ParseString(ConfigDefault, `123`) - val := int16(0) - iter.ReadVal(&val) - if val != 123 { - t.Fatal(val) - } -} - -func Test_reflect_int32(t *testing.T) { - iter := ParseString(ConfigDefault, `123`) - val := int32(0) - iter.ReadVal(&val) - if val != 123 { - t.Fatal(val) - } -} - -func Test_reflect_int64(t *testing.T) { - iter := ParseString(ConfigDefault, `123`) - val := int64(0) - iter.ReadVal(&val) - if val != 123 { - t.Fatal(val) - } -} - -func Test_reflect_uint(t *testing.T) { - iter := ParseString(ConfigDefault, `123`) - val := uint(0) - iter.ReadVal(&val) - if val != 123 { - t.Fatal(val) - } -} - -func Test_reflect_uint8(t *testing.T) { - iter := ParseString(ConfigDefault, `123`) - val := uint8(0) - iter.ReadVal(&val) - if val != 123 { - t.Fatal(val) - } -} - -func Test_reflect_uint16(t *testing.T) { - iter := ParseString(ConfigDefault, `123`) - val := uint16(0) - iter.ReadVal(&val) - if val != 123 { - t.Fatal(val) - } -} - -func Test_reflect_uint32(t *testing.T) { - iter := ParseString(ConfigDefault, `123`) - val := uint32(0) - iter.ReadVal(&val) - if val != 123 { - t.Fatal(val) - } -} - -func Test_reflect_uint64(t *testing.T) { - iter := ParseString(ConfigDefault, `123`) - val := uint64(0) - iter.ReadVal(&val) - if val != 123 { - t.Fatal(val) - } -} - -func Test_reflect_byte(t *testing.T) { - iter := ParseString(ConfigDefault, `123`) - val := byte(0) - iter.ReadVal(&val) - if val != 123 { - t.Fatal(val) - } -} - -func Test_reflect_float32(t *testing.T) { - iter := ParseString(ConfigDefault, `1.23`) - val := float32(0) - iter.ReadVal(&val) - if val != 1.23 { - fmt.Println(iter.Error) - t.Fatal(val) - } -} - -func Test_reflect_float64(t *testing.T) { - iter := ParseString(ConfigDefault, `1.23`) - val := float64(0) - iter.ReadVal(&val) - if val != 1.23 { - fmt.Println(iter.Error) - t.Fatal(val) - } -} - -func Test_reflect_bool(t *testing.T) { - iter := ParseString(ConfigDefault, `true`) - val := false - iter.ReadVal(&val) - if val != true { - fmt.Println(iter.Error) - t.Fatal(val) - } -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_skip_test.go b/vendor/github.com/json-iterator/go/jsoniter_skip_test.go deleted file mode 100644 index cb13e507c..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_skip_test.go +++ /dev/null @@ -1,184 +0,0 @@ -package jsoniter - -import ( - "bytes" - "encoding/json" - "testing" - - "github.com/stretchr/testify/require" -) - -func Test_skip_number_in_array(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `[-0.12, "stream"]`) - iter.ReadArray() - iter.Skip() - iter.ReadArray() - should.Nil(iter.Error) - should.Equal("stream", iter.ReadString()) -} - -func Test_skip_string_in_array(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `["hello", "stream"]`) - iter.ReadArray() - iter.Skip() - iter.ReadArray() - should.Nil(iter.Error) - should.Equal("stream", iter.ReadString()) -} - -func Test_skip_null(t *testing.T) { - iter := ParseString(ConfigDefault, `[null , "stream"]`) - iter.ReadArray() - iter.Skip() - iter.ReadArray() - if iter.ReadString() != "stream" { - t.FailNow() - } -} - -func Test_skip_true(t *testing.T) { - iter := ParseString(ConfigDefault, `[true , "stream"]`) - iter.ReadArray() - iter.Skip() - iter.ReadArray() - if iter.ReadString() != "stream" { - t.FailNow() - } -} - -func Test_skip_false(t *testing.T) { - iter := ParseString(ConfigDefault, `[false , "stream"]`) - iter.ReadArray() - iter.Skip() - iter.ReadArray() - if iter.ReadString() != "stream" { - t.FailNow() - } -} - -func Test_skip_array(t *testing.T) { - iter := ParseString(ConfigDefault, `[[1, [2, [3], 4]], "stream"]`) - iter.ReadArray() - iter.Skip() - iter.ReadArray() - if iter.ReadString() != "stream" { - t.FailNow() - } -} - -func Test_skip_empty_array(t *testing.T) { - iter := ParseString(ConfigDefault, `[ [ ], "stream"]`) - iter.ReadArray() - iter.Skip() - iter.ReadArray() - if iter.ReadString() != "stream" { - t.FailNow() - } -} - -func Test_skip_nested(t *testing.T) { - iter := ParseString(ConfigDefault, `[ {"a" : [{"stream": "c"}], "d": 102 }, "stream"]`) - iter.ReadArray() - iter.Skip() - iter.ReadArray() - if iter.ReadString() != "stream" { - t.FailNow() - } -} - -func Test_skip_and_return_bytes(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `[ {"a" : [{"stream": "c"}], "d": 102 }, "stream"]`) - iter.ReadArray() - skipped := iter.SkipAndReturnBytes() - should.Equal(`{"a" : [{"stream": "c"}], "d": 102 }`, string(skipped)) -} - -func Test_skip_and_return_bytes_with_reader(t *testing.T) { - should := require.New(t) - iter := Parse(ConfigDefault, bytes.NewBufferString(`[ {"a" : [{"stream": "c"}], "d": 102 }, "stream"]`), 4) - iter.ReadArray() - skipped := iter.SkipAndReturnBytes() - should.Equal(`{"a" : [{"stream": "c"}], "d": 102 }`, string(skipped)) -} - -func Test_skip_empty(t *testing.T) { - should := require.New(t) - should.NotNil(Get([]byte("")).LastError()) -} - -type TestResp struct { - Code uint64 -} - -func Benchmark_jsoniter_skip(b *testing.B) { - input := []byte(` -{ - "_shards":{ - "total" : 5, - "successful" : 5, - "failed" : 0 - }, - "hits":{ - "total" : 1, - "hits" : [ - { - "_index" : "twitter", - "_type" : "tweet", - "_id" : "1", - "_source" : { - "user" : "kimchy", - "postDate" : "2009-11-15T14:12:12", - "message" : "trying out Elasticsearch" - } - } - ] - }, - "code": 200 -}`) - for n := 0; n < b.N; n++ { - result := TestResp{} - iter := ParseBytes(ConfigDefault, input) - for field := iter.ReadObject(); field != ""; field = iter.ReadObject() { - switch field { - case "code": - result.Code = iter.ReadUint64() - default: - iter.Skip() - } - } - } -} - -func Benchmark_json_skip(b *testing.B) { - input := []byte(` -{ - "_shards":{ - "total" : 5, - "successful" : 5, - "failed" : 0 - }, - "hits":{ - "total" : 1, - "hits" : [ - { - "_index" : "twitter", - "_type" : "tweet", - "_id" : "1", - "_source" : { - "user" : "kimchy", - "postDate" : "2009-11-15T14:12:12", - "message" : "trying out Elasticsearch" - } - } - ] - }, - "code": 200 -}`) - for n := 0; n < b.N; n++ { - result := TestResp{} - json.Unmarshal(input, &result) - } -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_string_test.go b/vendor/github.com/json-iterator/go/jsoniter_string_test.go deleted file mode 100644 index 61c0f33b3..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_string_test.go +++ /dev/null @@ -1,261 +0,0 @@ -// +build go1.8 - -package jsoniter - -import ( - "bytes" - "encoding/json" - "fmt" - "testing" - "unicode/utf8" - - "github.com/stretchr/testify/require" -) - -func Test_read_string(t *testing.T) { - badInputs := []string{ - ``, - `"`, - `"\"`, - `"\\\"`, - "\"\n\"", - `"\U0001f64f"`, - `"\uD83D\u00"`, - } - for i := 0; i < 32; i++ { - // control characters are invalid - badInputs = append(badInputs, string([]byte{'"', byte(i), '"'})) - } - - for _, input := range badInputs { - testReadString(t, input, "", true, "json.Unmarshal", json.Unmarshal) - testReadString(t, input, "", true, "jsoniter.Unmarshal", Unmarshal) - testReadString(t, input, "", true, "jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal", ConfigCompatibleWithStandardLibrary.Unmarshal) - } - - goodInputs := []struct { - input string - expectValue string - }{ - {`""`, ""}, - {`"a"`, "a"}, - {`null`, ""}, - {`"Iñtërnâtiônàlizætiøn,💝🐹🌇⛔"`, "Iñtërnâtiônàlizætiøn,💝🐹🌇⛔"}, - {`"\uD83D"`, string([]byte{239, 191, 189})}, - {`"\uD83D\\"`, string([]byte{239, 191, 189, '\\'})}, - {`"\uD83D\ub000"`, string([]byte{239, 191, 189, 235, 128, 128})}, - {`"\uD83D\ude04"`, "😄"}, - {`"\uDEADBEEF"`, string([]byte{239, 191, 189, 66, 69, 69, 70})}, - } - - for _, tc := range goodInputs { - testReadString(t, tc.input, tc.expectValue, false, "json.Unmarshal", json.Unmarshal) - testReadString(t, tc.input, tc.expectValue, false, "jsoniter.Unmarshal", Unmarshal) - testReadString(t, tc.input, tc.expectValue, false, "jsoniter.ConfigCompatibleWithStandardLibrary.Unmarshal", ConfigCompatibleWithStandardLibrary.Unmarshal) - } -} - -func testReadString(t *testing.T, input string, expectValue string, expectError bool, marshalerName string, marshaler func([]byte, interface{}) error) { - var value string - err := marshaler([]byte(input), &value) - if expectError != (err != nil) { - t.Errorf("%q: %s: expected error %v, got %v", input, marshalerName, expectError, err) - return - } - if value != expectValue { - t.Errorf("%q: %s: expected %q, got %q", input, marshalerName, expectValue, value) - return - } -} - -func Test_read_normal_string(t *testing.T) { - cases := map[string]string{ - `"0123456789012345678901234567890123456789"`: `0123456789012345678901234567890123456789`, - `""`: ``, - `"hello"`: `hello`, - } - for input, output := range cases { - t.Run(fmt.Sprintf("%v:%v", input, output), func(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, input) - should.Equal(output, iter.ReadString()) - }) - t.Run(fmt.Sprintf("%v:%v", input, output), func(t *testing.T) { - should := require.New(t) - iter := Parse(ConfigDefault, bytes.NewBufferString(input), 2) - should.Equal(output, iter.ReadString()) - }) - t.Run(fmt.Sprintf("%v:%v", input, output), func(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, input) - should.Equal(output, string(iter.ReadStringAsSlice())) - }) - t.Run(fmt.Sprintf("%v:%v", input, output), func(t *testing.T) { - should := require.New(t) - iter := Parse(ConfigDefault, bytes.NewBufferString(input), 2) - should.Equal(output, string(iter.ReadStringAsSlice())) - }) - } -} - -func Test_read_exotic_string(t *testing.T) { - cases := map[string]string{ - `"hel\"lo"`: `hel"lo`, - `"hel\\\/lo"`: `hel\/lo`, - `"hel\\blo"`: `hel\blo`, - `"hel\\\blo"`: "hel\\\blo", - `"hel\\nlo"`: `hel\nlo`, - `"hel\\\nlo"`: "hel\\\nlo", - `"hel\\tlo"`: `hel\tlo`, - `"hel\\flo"`: `hel\flo`, - `"hel\\\flo"`: "hel\\\flo", - `"hel\\\rlo"`: "hel\\\rlo", - `"hel\\\tlo"`: "hel\\\tlo", - `"\u4e2d\u6587"`: "中文", - `"\ud83d\udc4a"`: "\xf0\x9f\x91\x8a", // surrogate - } - for input, output := range cases { - t.Run(fmt.Sprintf("%v:%v", input, output), func(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, input) - var v string - should.Nil(json.Unmarshal([]byte(input), &v)) - should.Equal(v, iter.ReadString()) - }) - t.Run(fmt.Sprintf("%v:%v", input, output), func(t *testing.T) { - should := require.New(t) - iter := Parse(ConfigDefault, bytes.NewBufferString(input), 2) - should.Equal(output, iter.ReadString()) - }) - } -} - -func Test_read_string_as_interface(t *testing.T) { - should := require.New(t) - iter := ParseString(ConfigDefault, `"hello"`) - should.Equal("hello", iter.Read()) -} - -func Test_write_string(t *testing.T) { - should := require.New(t) - str, err := MarshalToString("hello") - should.Equal(`"hello"`, str) - should.Nil(err) - str, err = MarshalToString(`hel"lo`) - should.Equal(`"hel\"lo"`, str) - should.Nil(err) -} - -func Test_write_val_string(t *testing.T) { - should := require.New(t) - buf := &bytes.Buffer{} - stream := NewStream(ConfigDefault, buf, 4096) - stream.WriteVal("hello") - stream.Flush() - should.Nil(stream.Error) - should.Equal(`"hello"`, buf.String()) -} - -func Test_decode_slash(t *testing.T) { - should := require.New(t) - var obj interface{} - should.NotNil(json.Unmarshal([]byte("\\"), &obj)) - should.NotNil(UnmarshalFromString("\\", &obj)) -} - -func Test_html_escape(t *testing.T) { - should := require.New(t) - output, err := json.Marshal(`>`) - should.Nil(err) - should.Equal(`"\u003e"`, string(output)) - output, err = ConfigCompatibleWithStandardLibrary.Marshal(`>`) - should.Nil(err) - should.Equal(`"\u003e"`, string(output)) - type MyString string - output, err = ConfigCompatibleWithStandardLibrary.Marshal(MyString(`>`)) - should.Nil(err) - should.Equal(`"\u003e"`, string(output)) -} - -func Test_string_encode_with_std(t *testing.T) { - should := require.New(t) - for i := 0; i < utf8.RuneSelf; i++ { - input := string([]byte{byte(i)}) - stdOutputBytes, err := json.Marshal(input) - should.Nil(err) - stdOutput := string(stdOutputBytes) - jsoniterOutputBytes, err := ConfigCompatibleWithStandardLibrary.Marshal(input) - should.Nil(err) - jsoniterOutput := string(jsoniterOutputBytes) - should.Equal(stdOutput, jsoniterOutput) - } -} - -func Test_unicode(t *testing.T) { - should := require.New(t) - output, _ := MarshalToString(map[string]interface{}{"a": "数字山谷"}) - should.Equal(`{"a":"数字山谷"}`, output) - output, _ = Config{EscapeHTML: false}.Froze().MarshalToString(map[string]interface{}{"a": "数字山谷"}) - should.Equal(`{"a":"数字山谷"}`, output) -} - -func Test_unicode_and_escape(t *testing.T) { - should := require.New(t) - output, err := MarshalToString(`"数字山谷"`) - should.Nil(err) - should.Equal(`"\"数字山谷\""`, output) - output, err = ConfigFastest.MarshalToString(`"数字山谷"`) - should.Nil(err) - should.Equal(`"\"数字山谷\""`, output) -} - -func Test_unsafe_unicode(t *testing.T) { - ConfigDefault.(*frozenConfig).cleanEncoders() - should := require.New(t) - output, err := ConfigDefault.MarshalToString("he\u2029\u2028he") - should.Nil(err) - should.Equal(`"he\u2029\u2028he"`, output) - output, err = ConfigFastest.MarshalToString("he\u2029\u2028he") - should.Nil(err) - should.Equal("\"he\u2029\u2028he\"", output) -} - -func Benchmark_jsoniter_unicode(b *testing.B) { - for n := 0; n < b.N; n++ { - iter := ParseString(ConfigDefault, `"\ud83d\udc4a"`) - iter.ReadString() - } -} - -func Benchmark_jsoniter_ascii(b *testing.B) { - iter := NewIterator(ConfigDefault) - input := []byte(`"hello, world! hello, world!"`) - b.ResetTimer() - for n := 0; n < b.N; n++ { - iter.ResetBytes(input) - iter.ReadString() - } -} - -func Benchmark_jsoniter_string_as_bytes(b *testing.B) { - iter := ParseString(ConfigDefault, `"hello, world!"`) - b.ResetTimer() - for n := 0; n < b.N; n++ { - iter.ResetBytes(iter.buf) - iter.ReadStringAsSlice() - } -} - -func Benchmark_json_unicode(b *testing.B) { - for n := 0; n < b.N; n++ { - result := "" - json.Unmarshal([]byte(`"\ud83d\udc4a"`), &result) - } -} - -func Benchmark_json_ascii(b *testing.B) { - for n := 0; n < b.N; n++ { - result := "" - json.Unmarshal([]byte(`"hello"`), &result) - } -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_struct_decoder_test.go b/vendor/github.com/json-iterator/go/jsoniter_struct_decoder_test.go deleted file mode 100644 index 257bbdb65..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_struct_decoder_test.go +++ /dev/null @@ -1,267 +0,0 @@ -package jsoniter - -import ( - "github.com/stretchr/testify/require" - "testing" -) - -func Test_decode_one_field_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - } - obj := TestObject{} - should.Nil(UnmarshalFromString(`{}`, &obj)) - should.Equal("", obj.Field1) - should.Nil(UnmarshalFromString(`{"field1": "hello"}`, &obj)) - should.Equal("hello", obj.Field1) -} - -func Test_decode_two_fields_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - Field2 string - } - obj := TestObject{} - should.Nil(UnmarshalFromString(`{}`, &obj)) - should.Equal("", obj.Field1) - should.Nil(UnmarshalFromString(`{"Field1": "a", "Field2": "stream"}`, &obj)) - should.Equal("a", obj.Field1) - should.Equal("stream", obj.Field2) -} - -func Test_decode_three_fields_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - Field2 string - Field3 string - } - obj := TestObject{} - should.Nil(UnmarshalFromString(`{}`, &obj)) - should.Equal("", obj.Field1) - should.Nil(UnmarshalFromString(`{"Field1": "a", "Field2": "stream", "Field3": "c"}`, &obj)) - should.Equal("a", obj.Field1) - should.Equal("stream", obj.Field2) - should.Equal("c", obj.Field3) -} - -func Test_decode_four_fields_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - Field2 string - Field3 string - Field4 string - } - obj := TestObject{} - should.Nil(UnmarshalFromString(`{}`, &obj)) - should.Equal("", obj.Field1) - should.Nil(UnmarshalFromString(`{"Field1": "a", "Field2": "stream", "Field3": "c", "Field4": "d"}`, &obj)) - should.Equal("a", obj.Field1) - should.Equal("stream", obj.Field2) - should.Equal("c", obj.Field3) - should.Equal("d", obj.Field4) -} - -func Test_decode_five_fields_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - Field2 string - Field3 string - Field4 string - Field5 string - } - obj := TestObject{} - should.Nil(UnmarshalFromString(`{}`, &obj)) - should.Equal("", obj.Field1) - should.Nil(UnmarshalFromString(`{"Field1": "a", "Field2": "stream", "Field3": "c", "Field4": "d", "Field5": "e"}`, &obj)) - should.Equal("a", obj.Field1) - should.Equal("stream", obj.Field2) - should.Equal("c", obj.Field3) - should.Equal("d", obj.Field4) - should.Equal("e", obj.Field5) -} - -func Test_decode_six_fields_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - Field2 string - Field3 string - Field4 string - Field5 string - Field6 string - } - obj := TestObject{} - should.Nil(UnmarshalFromString(`{}`, &obj)) - should.Equal("", obj.Field1) - should.Nil(UnmarshalFromString(`{"Field1": "a", "Field2": "stream", "Field3": "c", "Field4": "d", "Field5": "e", "Field6": "x"}`, &obj)) - should.Equal("a", obj.Field1) - should.Equal("stream", obj.Field2) - should.Equal("c", obj.Field3) - should.Equal("d", obj.Field4) - should.Equal("e", obj.Field5) - should.Equal("x", obj.Field6) -} - -func Test_decode_seven_fields_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - Field2 string - Field3 string - Field4 string - Field5 string - Field6 string - Field7 string - } - obj := TestObject{} - should.Nil(UnmarshalFromString(`{}`, &obj)) - should.Equal("", obj.Field1) - should.Nil(UnmarshalFromString(`{"Field1": "a", "Field2": "stream", "Field3": "c", "Field4": "d", "Field5": "e", "Field6": "x", "Field7":"y"}`, &obj)) - should.Equal("a", obj.Field1) - should.Equal("stream", obj.Field2) - should.Equal("c", obj.Field3) - should.Equal("d", obj.Field4) - should.Equal("e", obj.Field5) - should.Equal("x", obj.Field6) - should.Equal("y", obj.Field7) -} - -func Test_decode_eight_fields_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - Field2 string - Field3 string - Field4 string - Field5 string - Field6 string - Field7 string - Field8 string - } - obj := TestObject{} - should.Nil(UnmarshalFromString(`{}`, &obj)) - should.Equal("", obj.Field1) - should.Nil(UnmarshalFromString(`{"Field8":"1", "Field1": "a", "Field2": "stream", "Field3": "c", "Field4": "d", "Field5": "e", "Field6": "x", "Field7":"y"}`, &obj)) - should.Equal("a", obj.Field1) - should.Equal("stream", obj.Field2) - should.Equal("c", obj.Field3) - should.Equal("d", obj.Field4) - should.Equal("e", obj.Field5) - should.Equal("x", obj.Field6) - should.Equal("y", obj.Field7) - should.Equal("1", obj.Field8) -} - -func Test_decode_nine_fields_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - Field2 string - Field3 string - Field4 string - Field5 string - Field6 string - Field7 string - Field8 string - Field9 string - } - obj := TestObject{} - should.Nil(UnmarshalFromString(`{}`, &obj)) - should.Equal("", obj.Field1) - should.Nil(UnmarshalFromString(`{"Field8" : "zzzzzzzzzzz", "Field7": "zz", "Field6" : "xx", "Field1": "a", "Field2": "stream", "Field3": "c", "Field4": "d", "Field5": "e", "Field9":"f"}`, &obj)) - should.Equal("a", obj.Field1) - should.Equal("stream", obj.Field2) - should.Equal("c", obj.Field3) - should.Equal("d", obj.Field4) - should.Equal("e", obj.Field5) - should.Equal("xx", obj.Field6) - should.Equal("zz", obj.Field7) - should.Equal("zzzzzzzzzzz", obj.Field8) - should.Equal("f", obj.Field9) -} - -func Test_decode_ten_fields_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - Field2 string - Field3 string - Field4 string - Field5 string - Field6 string - Field7 string - Field8 string - Field9 string - Field10 string - } - obj := TestObject{} - should.Nil(UnmarshalFromString(`{}`, &obj)) - should.Equal("", obj.Field1) - should.Nil(UnmarshalFromString(`{"Field10":"x", "Field9": "x", "Field8":"x", "Field7":"x", "Field6":"x", "Field1": "a", "Field2": "stream", "Field3": "c", "Field4": "d", "Field5": "e"}`, &obj)) - should.Equal("a", obj.Field1) - should.Equal("stream", obj.Field2) - should.Equal("c", obj.Field3) - should.Equal("d", obj.Field4) - should.Equal("e", obj.Field5) - should.Equal("x", obj.Field6) - should.Equal("x", obj.Field7) - should.Equal("x", obj.Field8) - should.Equal("x", obj.Field9) - should.Equal("x", obj.Field10) -} - -func Test_decode_more_than_ten_fields_struct(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string - Field2 string - Field3 string - Field4 string - Field5 string - Field6 string - Field7 string - Field8 string - Field9 string - Field10 string - Field11 int - } - obj := TestObject{} - should.Nil(UnmarshalFromString(`{}`, &obj)) - should.Equal("", obj.Field1) - should.Nil(UnmarshalFromString(`{"field11":1, "field1": "a", "Field2": "stream", "Field3": "c", "Field4": "d", "Field5": "e"}`, &obj)) - should.Equal("a", obj.Field1) - should.Equal("stream", obj.Field2) - should.Equal("c", obj.Field3) - should.Equal("d", obj.Field4) - should.Equal("e", obj.Field5) - should.Equal(1, obj.Field11) -} - -func Test_decode_struct_field_with_tag(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 string `json:"field-1"` - Field2 string `json:"-"` - Field3 int `json:",string"` - } - obj := TestObject{Field2: "world"} - UnmarshalFromString(`{"field-1": "hello", "field2": "", "Field3": "100"}`, &obj) - should.Equal("hello", obj.Field1) - should.Equal("world", obj.Field2) - should.Equal(100, obj.Field3) -} - -func Test_decode_struct_field_with_tag_string(t *testing.T) { - should := require.New(t) - type TestObject struct { - Field1 int `json:",string"` - } - obj := TestObject{Field1: 100} - should.Nil(UnmarshalFromString(`{"Field1": "100"}`, &obj)) - should.Equal(100, obj.Field1) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_struct_encoder_test.go b/vendor/github.com/json-iterator/go/jsoniter_struct_encoder_test.go deleted file mode 100644 index 0e3e54188..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_struct_encoder_test.go +++ /dev/null @@ -1,52 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "testing" - "time" - - "github.com/stretchr/testify/require" -) - -func Test_encode_unexported_field(t *testing.T) { - type TestData struct { - a int - b <-chan int - C int - d *time.Timer - } - - should := require.New(t) - - testChan := make(<-chan int, 10) - testTimer := time.NewTimer(10 * time.Second) - - obj := &TestData{ - a: 42, - b: testChan, - C: 21, - d: testTimer, - } - - jb, err := json.Marshal(obj) - should.NoError(err) - should.Equal([]byte(`{"C":21}`), jb) - - err = json.Unmarshal([]byte(`{"a": 444, "b":"bad", "C":55, "d":{"not": "a timer"}}`), obj) - should.NoError(err) - should.Equal(42, obj.a) - should.Equal(testChan, obj.b) - should.Equal(55, obj.C) - should.Equal(testTimer, obj.d) - - jb, err = Marshal(obj) - should.NoError(err) - should.Equal(jb, []byte(`{"C":55}`)) - - err = Unmarshal([]byte(`{"a": 444, "b":"bad", "C":256, "d":{"not":"a timer"}}`), obj) - should.NoError(err) - should.Equal(42, obj.a) - should.Equal(testChan, obj.b) - should.Equal(256, obj.C) - should.Equal(testTimer, obj.d) -} diff --git a/vendor/github.com/json-iterator/go/jsoniter_wrap_test.go b/vendor/github.com/json-iterator/go/jsoniter_wrap_test.go deleted file mode 100644 index b300fb591..000000000 --- a/vendor/github.com/json-iterator/go/jsoniter_wrap_test.go +++ /dev/null @@ -1,118 +0,0 @@ -package jsoniter - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func Test_wrap_and_valuetype_everything(t *testing.T) { - should := require.New(t) - var i interface{} - any := Get([]byte("123")) - // default of number type is float64 - i = float64(123) - should.Equal(i, any.GetInterface()) - - any = Wrap(int8(10)) - should.Equal(any.ValueType(), NumberValue) - should.Equal(any.LastError(), nil) - // get interface is not int8 interface - // i = int8(10) - // should.Equal(i, any.GetInterface()) - - any = Wrap(int16(10)) - should.Equal(any.ValueType(), NumberValue) - should.Equal(any.LastError(), nil) - //i = int16(10) - //should.Equal(i, any.GetInterface()) - - any = Wrap(int32(10)) - should.Equal(any.ValueType(), NumberValue) - should.Equal(any.LastError(), nil) - i = int32(10) - should.Equal(i, any.GetInterface()) - any = Wrap(int64(10)) - should.Equal(any.ValueType(), NumberValue) - should.Equal(any.LastError(), nil) - i = int64(10) - should.Equal(i, any.GetInterface()) - - any = Wrap(uint(10)) - should.Equal(any.ValueType(), NumberValue) - should.Equal(any.LastError(), nil) - // not equal - //i = uint(10) - //should.Equal(i, any.GetInterface()) - any = Wrap(uint8(10)) - should.Equal(any.ValueType(), NumberValue) - should.Equal(any.LastError(), nil) - // not equal - // i = uint8(10) - // should.Equal(i, any.GetInterface()) - any = Wrap(uint16(10)) - should.Equal(any.ValueType(), NumberValue) - should.Equal(any.LastError(), nil) - any = Wrap(uint32(10)) - should.Equal(any.ValueType(), NumberValue) - should.Equal(any.LastError(), nil) - i = uint32(10) - should.Equal(i, any.GetInterface()) - any = Wrap(uint64(10)) - should.Equal(any.ValueType(), NumberValue) - should.Equal(any.LastError(), nil) - i = uint64(10) - should.Equal(i, any.GetInterface()) - - any = Wrap(float32(10)) - should.Equal(any.ValueType(), NumberValue) - should.Equal(any.LastError(), nil) - // not equal - //i = float32(10) - //should.Equal(i, any.GetInterface()) - any = Wrap(float64(10)) - should.Equal(any.ValueType(), NumberValue) - should.Equal(any.LastError(), nil) - i = float64(10) - should.Equal(i, any.GetInterface()) - - any = Wrap(true) - should.Equal(any.ValueType(), BoolValue) - should.Equal(any.LastError(), nil) - i = true - should.Equal(i, any.GetInterface()) - any = Wrap(false) - should.Equal(any.ValueType(), BoolValue) - should.Equal(any.LastError(), nil) - i = false - should.Equal(i, any.GetInterface()) - - any = Wrap(nil) - should.Equal(any.ValueType(), NilValue) - should.Equal(any.LastError(), nil) - i = nil - should.Equal(i, any.GetInterface()) - - stream := NewStream(ConfigDefault, nil, 32) - any.WriteTo(stream) - should.Equal("null", string(stream.Buffer())) - should.Equal(any.LastError(), nil) - - any = Wrap(struct{ age int }{age: 1}) - should.Equal(any.ValueType(), ObjectValue) - should.Equal(any.LastError(), nil) - i = struct{ age int }{age: 1} - should.Equal(i, any.GetInterface()) - - any = Wrap(map[string]interface{}{"abc": 1}) - should.Equal(any.ValueType(), ObjectValue) - should.Equal(any.LastError(), nil) - i = map[string]interface{}{"abc": 1} - should.Equal(i, any.GetInterface()) - - any = Wrap("abc") - i = "abc" - should.Equal(i, any.GetInterface()) - should.Equal(nil, any.LastError()) - -} diff --git a/vendor/github.com/json-iterator/go/feature_pool.go b/vendor/github.com/json-iterator/go/pool.go similarity index 64% rename from vendor/github.com/json-iterator/go/feature_pool.go rename to vendor/github.com/json-iterator/go/pool.go index 52d38e685..735062684 100644 --- a/vendor/github.com/json-iterator/go/feature_pool.go +++ b/vendor/github.com/json-iterator/go/pool.go @@ -17,43 +17,25 @@ type StreamPool interface { } func (cfg *frozenConfig) BorrowStream(writer io.Writer) *Stream { - select { - case stream := <-cfg.streamPool: - stream.Reset(writer) - return stream - default: - return NewStream(cfg, writer, 512) - } + stream := cfg.streamPool.Get().(*Stream) + stream.Reset(writer) + return stream } func (cfg *frozenConfig) ReturnStream(stream *Stream) { stream.Error = nil stream.Attachment = nil - select { - case cfg.streamPool <- stream: - return - default: - return - } + cfg.streamPool.Put(stream) } func (cfg *frozenConfig) BorrowIterator(data []byte) *Iterator { - select { - case iter := <-cfg.iteratorPool: - iter.ResetBytes(data) - return iter - default: - return ParseBytes(cfg, data) - } + iter := cfg.iteratorPool.Get().(*Iterator) + iter.ResetBytes(data) + return iter } func (cfg *frozenConfig) ReturnIterator(iter *Iterator) { iter.Error = nil iter.Attachment = nil - select { - case cfg.iteratorPool <- iter: - return - default: - return - } + cfg.iteratorPool.Put(iter) } diff --git a/vendor/github.com/json-iterator/go/reflect.go b/vendor/github.com/json-iterator/go/reflect.go new file mode 100644 index 000000000..0f0956340 --- /dev/null +++ b/vendor/github.com/json-iterator/go/reflect.go @@ -0,0 +1,321 @@ +package jsoniter + +import ( + "fmt" + "reflect" + "unsafe" + "github.com/v2pro/plz/reflect2" +) + +// ValDecoder is an internal type registered to cache as needed. +// Don't confuse jsoniter.ValDecoder with json.Decoder. +// For json.Decoder's adapter, refer to jsoniter.AdapterDecoder(todo link). +// +// Reflection on type to create decoders, which is then cached +// Reflection on value is avoided as we can, as the reflect.Value itself will allocate, with following exceptions +// 1. create instance of new value, for example *int will need a int to be allocated +// 2. append to slice, if the existing cap is not enough, allocate will be done using Reflect.New +// 3. assignment to map, both key and value will be reflect.Value +// For a simple struct binding, it will be reflect.Value free and allocation free +type ValDecoder interface { + Decode(ptr unsafe.Pointer, iter *Iterator) +} + +// ValEncoder is an internal type registered to cache as needed. +// Don't confuse jsoniter.ValEncoder with json.Encoder. +// For json.Encoder's adapter, refer to jsoniter.AdapterEncoder(todo godoc link). +type ValEncoder interface { + IsEmpty(ptr unsafe.Pointer) bool + Encode(ptr unsafe.Pointer, stream *Stream) +} + +type checkIsEmpty interface { + IsEmpty(ptr unsafe.Pointer) bool +} + +type ctx struct { + *frozenConfig + prefix string + encoders map[reflect2.Type]ValEncoder + decoders map[reflect2.Type]ValDecoder +} + +func (b *ctx) append(prefix string) *ctx { + return &ctx{ + frozenConfig: b.frozenConfig, + prefix: b.prefix + " " + prefix, + encoders: b.encoders, + decoders: b.decoders, + } +} + +// ReadVal copy the underlying JSON into go interface, same as json.Unmarshal +func (iter *Iterator) ReadVal(obj interface{}) { + cacheKey := reflect2.RTypeOf(obj) + decoder := iter.cfg.getDecoderFromCache(cacheKey) + if decoder == nil { + typ := reflect2.TypeOf(obj) + if typ.Kind() != reflect.Ptr { + iter.ReportError("ReadVal", "can only unmarshal into pointer") + return + } + decoder = iter.cfg.DecoderOf(typ) + } + ptr := reflect2.PtrOf(obj) + if ptr == nil { + iter.ReportError("ReadVal", "can not read into nil pointer") + return + } + decoder.Decode(ptr, iter) +} + +// WriteVal copy the go interface into underlying JSON, same as json.Marshal +func (stream *Stream) WriteVal(val interface{}) { + if nil == val { + stream.WriteNil() + return + } + cacheKey := reflect2.RTypeOf(val) + encoder := stream.cfg.getEncoderFromCache(cacheKey) + if encoder == nil { + typ := reflect2.TypeOf(val) + encoder = stream.cfg.EncoderOf(typ) + } + encoder.Encode(reflect2.PtrOf(val), stream) +} + +func (cfg *frozenConfig) DecoderOf(typ reflect2.Type) ValDecoder { + cacheKey := typ.RType() + decoder := cfg.getDecoderFromCache(cacheKey) + if decoder != nil { + return decoder + } + ctx := &ctx{ + frozenConfig: cfg, + prefix: "", + decoders: map[reflect2.Type]ValDecoder{}, + encoders: map[reflect2.Type]ValEncoder{}, + } + ptrType := typ.(*reflect2.UnsafePtrType) + decoder = decoderOfType(ctx, ptrType.Elem()) + cfg.addDecoderToCache(cacheKey, decoder) + return decoder +} + +func decoderOfType(ctx *ctx, typ reflect2.Type) ValDecoder { + decoder := getTypeDecoderFromExtension(ctx, typ) + if decoder != nil { + return decoder + } + decoder = createDecoderOfType(ctx, typ) + for _, extension := range extensions { + decoder = extension.DecorateDecoder(typ, decoder) + } + for _, extension := range ctx.extensions { + decoder = extension.DecorateDecoder(typ, decoder) + } + return decoder +} + +func createDecoderOfType(ctx *ctx, typ reflect2.Type) ValDecoder { + decoder := ctx.decoders[typ] + if decoder != nil { + return decoder + } + placeholder := &placeholderDecoder{} + ctx.decoders[typ] = placeholder + decoder = _createDecoderOfType(ctx, typ) + placeholder.decoder = decoder + return decoder +} + +func _createDecoderOfType(ctx *ctx, typ reflect2.Type) ValDecoder { + decoder := createDecoderOfJsonRawMessage(ctx, typ) + if decoder != nil { + return decoder + } + decoder = createDecoderOfJsonNumber(ctx, typ) + if decoder != nil { + return decoder + } + decoder = createDecoderOfMarshaler(ctx, typ) + if decoder != nil { + return decoder + } + decoder = createDecoderOfAny(ctx, typ) + if decoder != nil { + return decoder + } + decoder = createDecoderOfNative(ctx, typ) + if decoder != nil { + return decoder + } + switch typ.Kind() { + case reflect.Interface: + ifaceType, isIFace := typ.(*reflect2.UnsafeIFaceType) + if isIFace { + return &ifaceDecoder{valType: ifaceType} + } + return &efaceDecoder{} + case reflect.Struct: + return decoderOfStruct(ctx, typ) + case reflect.Array: + return decoderOfArray(ctx, typ) + case reflect.Slice: + return decoderOfSlice(ctx, typ) + case reflect.Map: + return decoderOfMap(ctx, typ) + case reflect.Ptr: + return decoderOfOptional(ctx, typ) + default: + return &lazyErrorDecoder{err: fmt.Errorf("%s%s is unsupported type", ctx.prefix, typ.String())} + } +} + +func (cfg *frozenConfig) EncoderOf(typ reflect2.Type) ValEncoder { + cacheKey := typ.RType() + encoder := cfg.getEncoderFromCache(cacheKey) + if encoder != nil { + return encoder + } + ctx := &ctx{ + frozenConfig: cfg, + prefix: "", + decoders: map[reflect2.Type]ValDecoder{}, + encoders: map[reflect2.Type]ValEncoder{}, + } + encoder = encoderOfType(ctx, typ) + if typ.LikePtr() { + encoder = &onePtrEncoder{encoder} + } + cfg.addEncoderToCache(cacheKey, encoder) + return encoder +} + +type onePtrEncoder struct { + encoder ValEncoder +} + +func (encoder *onePtrEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.encoder.IsEmpty(unsafe.Pointer(&ptr)) +} + +func (encoder *onePtrEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + encoder.encoder.Encode(unsafe.Pointer(&ptr), stream) +} + +func encoderOfType(ctx *ctx, typ reflect2.Type) ValEncoder { + encoder := getTypeEncoderFromExtension(ctx, typ) + if encoder != nil { + return encoder + } + encoder = createEncoderOfType(ctx, typ) + for _, extension := range extensions { + encoder = extension.DecorateEncoder(typ, encoder) + } + for _, extension := range ctx.extensions { + encoder = extension.DecorateEncoder(typ, encoder) + } + return encoder +} + +func createEncoderOfType(ctx *ctx, typ reflect2.Type) ValEncoder { + encoder := ctx.encoders[typ] + if encoder != nil { + return encoder + } + placeholder := &placeholderEncoder{} + ctx.encoders[typ] = placeholder + encoder = _createEncoderOfType(ctx, typ) + placeholder.encoder = encoder + return encoder +} +func _createEncoderOfType(ctx *ctx, typ reflect2.Type) ValEncoder { + encoder := createEncoderOfJsonRawMessage(ctx, typ) + if encoder != nil { + return encoder + } + encoder = createEncoderOfJsonNumber(ctx, typ) + if encoder != nil { + return encoder + } + encoder = createEncoderOfMarshaler(ctx, typ) + if encoder != nil { + return encoder + } + encoder = createEncoderOfAny(ctx, typ) + if encoder != nil { + return encoder + } + encoder = createEncoderOfNative(ctx, typ) + if encoder != nil { + return encoder + } + kind := typ.Kind() + switch kind { + case reflect.Interface: + return &dynamicEncoder{typ} + case reflect.Struct: + return encoderOfStruct(ctx, typ) + case reflect.Array: + return encoderOfArray(ctx, typ) + case reflect.Slice: + return encoderOfSlice(ctx, typ) + case reflect.Map: + return encoderOfMap(ctx, typ) + case reflect.Ptr: + return encoderOfOptional(ctx, typ) + default: + return &lazyErrorEncoder{err: fmt.Errorf("%s%s is unsupported type", ctx.prefix, typ.String())} + } +} + +type lazyErrorDecoder struct { + err error +} + +func (decoder *lazyErrorDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + if iter.WhatIsNext() != NilValue { + if iter.Error == nil { + iter.Error = decoder.err + } + } else { + iter.Skip() + } +} + +type lazyErrorEncoder struct { + err error +} + +func (encoder *lazyErrorEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + if ptr == nil { + stream.WriteNil() + } else if stream.Error == nil { + stream.Error = encoder.err + } +} + +func (encoder *lazyErrorEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return false +} + +type placeholderDecoder struct { + decoder ValDecoder +} + +func (decoder *placeholderDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + decoder.decoder.Decode(ptr, iter) +} + +type placeholderEncoder struct { + encoder ValEncoder +} + +func (encoder *placeholderEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + encoder.encoder.Encode(ptr, stream) +} + +func (encoder *placeholderEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.encoder.IsEmpty(ptr) +} diff --git a/vendor/github.com/json-iterator/go/reflect_array.go b/vendor/github.com/json-iterator/go/reflect_array.go new file mode 100644 index 000000000..0f4f02e71 --- /dev/null +++ b/vendor/github.com/json-iterator/go/reflect_array.go @@ -0,0 +1,104 @@ +package jsoniter + +import ( + "fmt" + "io" + "unsafe" + "github.com/v2pro/plz/reflect2" +) + +func decoderOfArray(ctx *ctx, typ reflect2.Type) ValDecoder { + arrayType := typ.(*reflect2.UnsafeArrayType) + decoder := decoderOfType(ctx.append("[arrayElem]"), arrayType.Elem()) + return &arrayDecoder{arrayType, decoder} +} + +func encoderOfArray(ctx *ctx, typ reflect2.Type) ValEncoder { + arrayType := typ.(*reflect2.UnsafeArrayType) + if arrayType.Len() == 0 { + return emptyArrayEncoder{} + } + encoder := encoderOfType(ctx.append("[arrayElem]"), arrayType.Elem()) + return &arrayEncoder{arrayType, encoder} +} + +type emptyArrayEncoder struct{} + +func (encoder emptyArrayEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteEmptyArray() +} + +func (encoder emptyArrayEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return true +} + +type arrayEncoder struct { + arrayType *reflect2.UnsafeArrayType + elemEncoder ValEncoder +} + +func (encoder *arrayEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteArrayStart() + elemPtr := unsafe.Pointer(ptr) + encoder.elemEncoder.Encode(elemPtr, stream) + for i := 1; i < encoder.arrayType.Len(); i++ { + stream.WriteMore() + elemPtr = encoder.arrayType.UnsafeGetIndex(ptr, i) + encoder.elemEncoder.Encode(elemPtr, stream) + } + stream.WriteArrayEnd() + if stream.Error != nil && stream.Error != io.EOF { + stream.Error = fmt.Errorf("%v: %s", encoder.arrayType, stream.Error.Error()) + } +} + +func (encoder *arrayEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return false +} + +type arrayDecoder struct { + arrayType *reflect2.UnsafeArrayType + elemDecoder ValDecoder +} + +func (decoder *arrayDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + decoder.doDecode(ptr, iter) + if iter.Error != nil && iter.Error != io.EOF { + iter.Error = fmt.Errorf("%v: %s", decoder.arrayType, iter.Error.Error()) + } +} + +func (decoder *arrayDecoder) doDecode(ptr unsafe.Pointer, iter *Iterator) { + c := iter.nextToken() + arrayType := decoder.arrayType + if c == 'n' { + iter.skipThreeBytes('u', 'l', 'l') + return + } + if c != '[' { + iter.ReportError("decode array", "expect [ or n, but found "+string([]byte{c})) + return + } + c = iter.nextToken() + if c == ']' { + return + } + iter.unreadByte() + elemPtr := arrayType.UnsafeGetIndex(ptr, 0) + decoder.elemDecoder.Decode(elemPtr, iter) + length := 1 + for c = iter.nextToken(); c == ','; c = iter.nextToken() { + if length >= arrayType.Len() { + iter.Skip() + continue + } + idx := length + length += 1 + elemPtr = arrayType.UnsafeGetIndex(ptr, idx) + decoder.elemDecoder.Decode(elemPtr, iter) + } + if c != ']' { + iter.ReportError("decode array", "expect ], but found "+string([]byte{c})) + return + } +} diff --git a/vendor/github.com/json-iterator/go/reflect_dynamic.go b/vendor/github.com/json-iterator/go/reflect_dynamic.go new file mode 100644 index 000000000..86b8425af --- /dev/null +++ b/vendor/github.com/json-iterator/go/reflect_dynamic.go @@ -0,0 +1,70 @@ +package jsoniter + +import ( + "github.com/v2pro/plz/reflect2" + "unsafe" + "reflect" +) + +type dynamicEncoder struct { + valType reflect2.Type +} + +func (encoder *dynamicEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + obj := encoder.valType.UnsafeIndirect(ptr) + stream.WriteVal(obj) +} + +func (encoder *dynamicEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.valType.UnsafeIndirect(ptr) == nil +} + +type efaceDecoder struct { +} + +func (decoder *efaceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + pObj := (*interface{})(ptr) + obj := *pObj + if obj == nil { + *pObj = iter.Read() + return + } + typ := reflect2.TypeOf(obj) + if typ.Kind() != reflect.Ptr { + *pObj = iter.Read() + return + } + ptrType := typ.(*reflect2.UnsafePtrType) + ptrElemType := ptrType.Elem() + if iter.WhatIsNext() == NilValue { + if ptrElemType.Kind() != reflect.Ptr { + iter.skipFourBytes('n', 'u', 'l', 'l') + *pObj = nil + return + } + } + if reflect2.IsNil(obj) { + obj := ptrElemType.New() + iter.ReadVal(obj) + *pObj = obj + return + } + iter.ReadVal(obj) +} + +type ifaceDecoder struct { + valType *reflect2.UnsafeIFaceType +} + +func (decoder *ifaceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + if iter.ReadNil() { + decoder.valType.UnsafeSet(ptr, decoder.valType.UnsafeNew()) + return + } + obj := decoder.valType.UnsafeIndirect(ptr) + if reflect2.IsNil(obj) { + iter.ReportError("decode non empty interface", "can not unmarshal into nil") + return + } + iter.ReadVal(obj) +} diff --git a/vendor/github.com/json-iterator/go/feature_reflect_extension.go b/vendor/github.com/json-iterator/go/reflect_extension.go similarity index 59% rename from vendor/github.com/json-iterator/go/feature_reflect_extension.go rename to vendor/github.com/json-iterator/go/reflect_extension.go index 177df2c81..c878ca1af 100644 --- a/vendor/github.com/json-iterator/go/feature_reflect_extension.go +++ b/vendor/github.com/json-iterator/go/reflect_extension.go @@ -7,6 +7,7 @@ import ( "strings" "unicode" "unsafe" + "github.com/v2pro/plz/reflect2" ) var typeDecoders = map[string]ValDecoder{} @@ -17,9 +18,7 @@ var extensions = []Extension{} // StructDescriptor describe how should we encode/decode the struct type StructDescriptor struct { - onePtrEmbedded bool - onePtrOptimization bool - Type reflect.Type + Type reflect2.Type Fields []*Binding } @@ -27,7 +26,7 @@ type StructDescriptor struct { // Can not use map here to keep field orders. func (structDescriptor *StructDescriptor) GetField(fieldName string) *Binding { for _, binding := range structDescriptor.Fields { - if binding.Field.Name == fieldName { + if binding.Field.Name() == fieldName { return binding } } @@ -37,7 +36,7 @@ func (structDescriptor *StructDescriptor) GetField(fieldName string) *Binding { // Binding describe how should we encode/decode the struct field type Binding struct { levels []int - Field *reflect.StructField + Field reflect2.StructField FromNames []string ToNames []string Encoder ValEncoder @@ -48,10 +47,10 @@ type Binding struct { // Can also rename fields by UpdateStructDescriptor. type Extension interface { UpdateStructDescriptor(structDescriptor *StructDescriptor) - CreateDecoder(typ reflect.Type) ValDecoder - CreateEncoder(typ reflect.Type) ValEncoder - DecorateDecoder(typ reflect.Type, decoder ValDecoder) ValDecoder - DecorateEncoder(typ reflect.Type, encoder ValEncoder) ValEncoder + CreateDecoder(typ reflect2.Type) ValDecoder + CreateEncoder(typ reflect2.Type) ValEncoder + DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder + DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder } // DummyExtension embed this type get dummy implementation for all methods of Extension @@ -63,22 +62,74 @@ func (extension *DummyExtension) UpdateStructDescriptor(structDescriptor *Struct } // CreateDecoder No-op -func (extension *DummyExtension) CreateDecoder(typ reflect.Type) ValDecoder { +func (extension *DummyExtension) CreateDecoder(typ reflect2.Type) ValDecoder { return nil } // CreateEncoder No-op -func (extension *DummyExtension) CreateEncoder(typ reflect.Type) ValEncoder { +func (extension *DummyExtension) CreateEncoder(typ reflect2.Type) ValEncoder { return nil } // DecorateDecoder No-op -func (extension *DummyExtension) DecorateDecoder(typ reflect.Type, decoder ValDecoder) ValDecoder { +func (extension *DummyExtension) DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder { return decoder } // DecorateEncoder No-op -func (extension *DummyExtension) DecorateEncoder(typ reflect.Type, encoder ValEncoder) ValEncoder { +func (extension *DummyExtension) DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder { + return encoder +} + +type EncoderExtension map[reflect2.Type]ValEncoder + +// UpdateStructDescriptor No-op +func (extension EncoderExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) { +} + +// CreateDecoder No-op +func (extension EncoderExtension) CreateDecoder(typ reflect2.Type) ValDecoder { + return nil +} + +// CreateEncoder get encoder from map +func (extension EncoderExtension) CreateEncoder(typ reflect2.Type) ValEncoder { + return extension[typ] +} + +// DecorateDecoder No-op +func (extension EncoderExtension) DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder { + return decoder +} + +// DecorateEncoder No-op +func (extension EncoderExtension) DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder { + return encoder +} + +type DecoderExtension map[reflect2.Type]ValDecoder + +// UpdateStructDescriptor No-op +func (extension DecoderExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) { +} + +// CreateDecoder get decoder from map +func (extension DecoderExtension) CreateDecoder(typ reflect2.Type) ValDecoder { + return extension[typ] +} + +// CreateEncoder No-op +func (extension DecoderExtension) CreateEncoder(typ reflect2.Type) ValEncoder { + return nil +} + +// DecorateDecoder No-op +func (extension DecoderExtension) DecorateDecoder(typ reflect2.Type, decoder ValDecoder) ValDecoder { + return decoder +} + +// DecorateEncoder No-op +func (extension DecoderExtension) DecorateEncoder(typ reflect2.Type, encoder ValEncoder) ValEncoder { return encoder } @@ -99,10 +150,6 @@ func (encoder *funcEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { encoder.fun(ptr, stream) } -func (encoder *funcEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - func (encoder *funcEncoder) IsEmpty(ptr unsafe.Pointer) bool { if encoder.isEmptyFunc == nil { return false @@ -161,60 +208,80 @@ func RegisterExtension(extension Extension) { extensions = append(extensions, extension) } -func getTypeDecoderFromExtension(typ reflect.Type) ValDecoder { - decoder := _getTypeDecoderFromExtension(typ) +func getTypeDecoderFromExtension(ctx *ctx, typ reflect2.Type) ValDecoder { + decoder := _getTypeDecoderFromExtension(ctx, typ) if decoder != nil { for _, extension := range extensions { decoder = extension.DecorateDecoder(typ, decoder) } + for _, extension := range ctx.extensions { + decoder = extension.DecorateDecoder(typ, decoder) + } } return decoder } -func _getTypeDecoderFromExtension(typ reflect.Type) ValDecoder { +func _getTypeDecoderFromExtension(ctx *ctx, typ reflect2.Type) ValDecoder { for _, extension := range extensions { decoder := extension.CreateDecoder(typ) if decoder != nil { return decoder } } + for _, extension := range ctx.extensions { + decoder := extension.CreateDecoder(typ) + if decoder != nil { + return decoder + } + } typeName := typ.String() decoder := typeDecoders[typeName] if decoder != nil { return decoder } if typ.Kind() == reflect.Ptr { - decoder := typeDecoders[typ.Elem().String()] + ptrType := typ.(*reflect2.UnsafePtrType) + decoder := typeDecoders[ptrType.Elem().String()] if decoder != nil { - return &OptionalDecoder{typ.Elem(), decoder} + return &OptionalDecoder{ptrType.Elem(), decoder} } } return nil } -func getTypeEncoderFromExtension(typ reflect.Type) ValEncoder { - encoder := _getTypeEncoderFromExtension(typ) +func getTypeEncoderFromExtension(ctx *ctx, typ reflect2.Type) ValEncoder { + encoder := _getTypeEncoderFromExtension(ctx, typ) if encoder != nil { for _, extension := range extensions { encoder = extension.DecorateEncoder(typ, encoder) } + for _, extension := range ctx.extensions { + encoder = extension.DecorateEncoder(typ, encoder) + } } return encoder } -func _getTypeEncoderFromExtension(typ reflect.Type) ValEncoder { +func _getTypeEncoderFromExtension(ctx *ctx, typ reflect2.Type) ValEncoder { for _, extension := range extensions { encoder := extension.CreateEncoder(typ) if encoder != nil { return encoder } } + for _, extension := range ctx.extensions { + encoder := extension.CreateEncoder(typ) + if encoder != nil { + return encoder + } + } typeName := typ.String() encoder := typeEncoders[typeName] if encoder != nil { return encoder } if typ.Kind() == reflect.Ptr { - encoder := typeEncoders[typ.Elem().String()] + typePtr := typ.(*reflect2.UnsafePtrType) + encoder := typeEncoders[typePtr.Elem().String()] if encoder != nil { return &OptionalEncoder{encoder} } @@ -222,72 +289,60 @@ func _getTypeEncoderFromExtension(typ reflect.Type) ValEncoder { return nil } -func describeStruct(cfg *frozenConfig, typ reflect.Type) (*StructDescriptor, error) { +func describeStruct(ctx *ctx, typ reflect2.Type) *StructDescriptor { + structType := typ.(*reflect2.UnsafeStructType) embeddedBindings := []*Binding{} bindings := []*Binding{} - for i := 0; i < typ.NumField(); i++ { - field := typ.Field(i) - tag := field.Tag.Get(cfg.getTagKey()) + for i := 0; i < structType.NumField(); i++ { + field := structType.Field(i) + tag, hastag := field.Tag().Lookup(ctx.getTagKey()) + if ctx.onlyTaggedField && !hastag { + continue + } tagParts := strings.Split(tag, ",") if tag == "-" { continue } - if field.Anonymous && (tag == "" || tagParts[0] == "") { - if field.Type.Kind() == reflect.Struct { - structDescriptor, err := describeStruct(cfg, field.Type) - if err != nil { - return nil, err - } + if field.Anonymous() && (tag == "" || tagParts[0] == "") { + if field.Type().Kind() == reflect.Struct { + structDescriptor := describeStruct(ctx, field.Type()) for _, binding := range structDescriptor.Fields { binding.levels = append([]int{i}, binding.levels...) omitempty := binding.Encoder.(*structFieldEncoder).omitempty - binding.Encoder = &structFieldEncoder{&field, binding.Encoder, omitempty} - binding.Decoder = &structFieldDecoder{&field, binding.Decoder} + binding.Encoder = &structFieldEncoder{field, binding.Encoder, omitempty} + binding.Decoder = &structFieldDecoder{field, binding.Decoder} embeddedBindings = append(embeddedBindings, binding) } continue - } else if field.Type.Kind() == reflect.Ptr && field.Type.Elem().Kind() == reflect.Struct { - structDescriptor, err := describeStruct(cfg, field.Type.Elem()) - if err != nil { - return nil, err + } else if field.Type().Kind() == reflect.Ptr { + ptrType := field.Type().(*reflect2.UnsafePtrType) + if ptrType.Elem().Kind() == reflect.Struct { + structDescriptor := describeStruct(ctx, ptrType.Elem()) + for _, binding := range structDescriptor.Fields { + binding.levels = append([]int{i}, binding.levels...) + omitempty := binding.Encoder.(*structFieldEncoder).omitempty + binding.Encoder = &dereferenceEncoder{binding.Encoder} + binding.Encoder = &structFieldEncoder{field, binding.Encoder, omitempty} + binding.Decoder = &dereferenceDecoder{ptrType.Elem(), binding.Decoder} + binding.Decoder = &structFieldDecoder{field, binding.Decoder} + embeddedBindings = append(embeddedBindings, binding) + } + continue } - for _, binding := range structDescriptor.Fields { - binding.levels = append([]int{i}, binding.levels...) - omitempty := binding.Encoder.(*structFieldEncoder).omitempty - binding.Encoder = &OptionalEncoder{binding.Encoder} - binding.Encoder = &structFieldEncoder{&field, binding.Encoder, omitempty} - binding.Decoder = &deferenceDecoder{field.Type.Elem(), binding.Decoder} - binding.Decoder = &structFieldDecoder{&field, binding.Decoder} - embeddedBindings = append(embeddedBindings, binding) - } - continue } } - fieldNames := calcFieldNames(field.Name, tagParts[0], tag) - fieldCacheKey := fmt.Sprintf("%s/%s", typ.String(), field.Name) + fieldNames := calcFieldNames(field.Name(), tagParts[0], tag) + fieldCacheKey := fmt.Sprintf("%s/%s", typ.String(), field.Name()) decoder := fieldDecoders[fieldCacheKey] if decoder == nil { - var err error - decoder, err = decoderOfType(cfg, field.Type) - if len(fieldNames) > 0 && err != nil { - return nil, err - } + decoder = decoderOfType(ctx.append(field.Name()), field.Type()) } encoder := fieldEncoders[fieldCacheKey] if encoder == nil { - var err error - encoder, err = encoderOfType(cfg, field.Type) - if len(fieldNames) > 0 && err != nil { - return nil, err - } - // map is stored as pointer in the struct, - // and treat nil or empty map as empty field - if encoder != nil && field.Type.Kind() == reflect.Map { - encoder = &optionalMapEncoder{encoder} - } + encoder = encoderOfType(ctx.append(field.Name()), field.Type()) } binding := &Binding{ - Field: &field, + Field: field, FromNames: fieldNames, ToNames: fieldNames, Decoder: decoder, @@ -296,35 +351,20 @@ func describeStruct(cfg *frozenConfig, typ reflect.Type) (*StructDescriptor, err binding.levels = []int{i} bindings = append(bindings, binding) } - return createStructDescriptor(cfg, typ, bindings, embeddedBindings), nil + return createStructDescriptor(ctx, typ, bindings, embeddedBindings) } -func createStructDescriptor(cfg *frozenConfig, typ reflect.Type, bindings []*Binding, embeddedBindings []*Binding) *StructDescriptor { - onePtrEmbedded := false - onePtrOptimization := false - if typ.NumField() == 1 { - firstField := typ.Field(0) - switch firstField.Type.Kind() { - case reflect.Ptr: - if firstField.Anonymous && firstField.Type.Elem().Kind() == reflect.Struct { - onePtrEmbedded = true - } - fallthrough - case reflect.Map: - onePtrOptimization = true - case reflect.Struct: - onePtrOptimization = isStructOnePtr(firstField.Type) - } - } +func createStructDescriptor(ctx *ctx, typ reflect2.Type, bindings []*Binding, embeddedBindings []*Binding) *StructDescriptor { structDescriptor := &StructDescriptor{ - onePtrEmbedded: onePtrEmbedded, - onePtrOptimization: onePtrOptimization, Type: typ, Fields: bindings, } for _, extension := range extensions { extension.UpdateStructDescriptor(structDescriptor) } - processTags(structDescriptor, cfg) + for _, extension := range ctx.extensions { + extension.UpdateStructDescriptor(structDescriptor) + } + processTags(structDescriptor, ctx.frozenConfig) // merge normal & embedded bindings & sort with original order allBindings := sortableBindings(append(embeddedBindings, structDescriptor.Fields...)) sort.Sort(allBindings) @@ -332,21 +372,6 @@ func createStructDescriptor(cfg *frozenConfig, typ reflect.Type, bindings []*Bin return structDescriptor } -func isStructOnePtr(typ reflect.Type) bool { - if typ.NumField() == 1 { - firstField := typ.Field(0) - switch firstField.Type.Kind() { - case reflect.Ptr: - return true - case reflect.Map: - return true - case reflect.Struct: - return isStructOnePtr(firstField.Type) - } - } - return false -} - type sortableBindings []*Binding func (bindings sortableBindings) Len() int { @@ -374,12 +399,12 @@ func (bindings sortableBindings) Swap(i, j int) { func processTags(structDescriptor *StructDescriptor, cfg *frozenConfig) { for _, binding := range structDescriptor.Fields { shouldOmitEmpty := false - tagParts := strings.Split(binding.Field.Tag.Get(cfg.getTagKey()), ",") + tagParts := strings.Split(binding.Field.Tag().Get(cfg.getTagKey()), ",") for _, tagPart := range tagParts[1:] { if tagPart == "omitempty" { shouldOmitEmpty = true } else if tagPart == "string" { - if binding.Field.Type.Kind() == reflect.String { + if binding.Field.Type().Kind() == reflect.String { binding.Decoder = &stringModeStringDecoder{binding.Decoder, cfg} binding.Encoder = &stringModeStringEncoder{binding.Encoder, cfg} } else { diff --git a/vendor/github.com/json-iterator/go/reflect_json_number.go b/vendor/github.com/json-iterator/go/reflect_json_number.go new file mode 100644 index 000000000..1e22d10ba --- /dev/null +++ b/vendor/github.com/json-iterator/go/reflect_json_number.go @@ -0,0 +1,112 @@ +package jsoniter + +import ( + "encoding/json" + "strconv" + "unsafe" + "github.com/v2pro/plz/reflect2" +) + +type Number string + +// String returns the literal text of the number. +func (n Number) String() string { return string(n) } + +// Float64 returns the number as a float64. +func (n Number) Float64() (float64, error) { + return strconv.ParseFloat(string(n), 64) +} + +// Int64 returns the number as an int64. +func (n Number) Int64() (int64, error) { + return strconv.ParseInt(string(n), 10, 64) +} + +func CastJsonNumber(val interface{}) (string, bool) { + switch typedVal := val.(type) { + case json.Number: + return string(typedVal), true + case Number: + return string(typedVal), true + } + return "", false +} + +var jsonNumberType = reflect2.TypeOfPtr((*json.Number)(nil)).Elem() +var jsoniterNumberType = reflect2.TypeOfPtr((*Number)(nil)).Elem() + +func createDecoderOfJsonNumber(ctx *ctx, typ reflect2.Type) ValDecoder { + if typ.AssignableTo(jsonNumberType) { + return &jsonNumberCodec{} + } + if typ.AssignableTo(jsoniterNumberType) { + return &jsoniterNumberCodec{} + } + return nil +} + +func createEncoderOfJsonNumber(ctx *ctx, typ reflect2.Type) ValEncoder { + if typ.AssignableTo(jsonNumberType) { + return &jsonNumberCodec{} + } + if typ.AssignableTo(jsoniterNumberType) { + return &jsoniterNumberCodec{} + } + return nil +} + +type jsonNumberCodec struct { +} + +func (codec *jsonNumberCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { + switch iter.WhatIsNext() { + case StringValue: + *((*json.Number)(ptr)) = json.Number(iter.ReadString()) + case NilValue: + iter.skipFourBytes('n', 'u', 'l', 'l') + *((*json.Number)(ptr)) = "" + default: + *((*json.Number)(ptr)) = json.Number([]byte(iter.readNumberAsString())) + } +} + +func (codec *jsonNumberCodec) Encode(ptr unsafe.Pointer, stream *Stream) { + number := *((*json.Number)(ptr)) + if len(number) == 0 { + stream.writeByte('0') + } else { + stream.WriteRaw(string(number)) + } +} + +func (codec *jsonNumberCodec) IsEmpty(ptr unsafe.Pointer) bool { + return len(*((*json.Number)(ptr))) == 0 +} + +type jsoniterNumberCodec struct { +} + +func (codec *jsoniterNumberCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { + switch iter.WhatIsNext() { + case StringValue: + *((*Number)(ptr)) = Number(iter.ReadString()) + case NilValue: + iter.skipFourBytes('n', 'u', 'l', 'l') + *((*Number)(ptr)) = "" + default: + *((*Number)(ptr)) = Number([]byte(iter.readNumberAsString())) + } +} + +func (codec *jsoniterNumberCodec) Encode(ptr unsafe.Pointer, stream *Stream) { + number := *((*Number)(ptr)) + if len(number) == 0 { + stream.writeByte('0') + } else { + stream.WriteRaw(string(number)) + } +} + +func (codec *jsoniterNumberCodec) IsEmpty(ptr unsafe.Pointer) bool { + return len(*((*Number)(ptr))) == 0 +} \ No newline at end of file diff --git a/vendor/github.com/json-iterator/go/reflect_json_raw_message.go b/vendor/github.com/json-iterator/go/reflect_json_raw_message.go new file mode 100644 index 000000000..f809dfe2e --- /dev/null +++ b/vendor/github.com/json-iterator/go/reflect_json_raw_message.go @@ -0,0 +1,60 @@ +package jsoniter + +import ( + "unsafe" + "encoding/json" + "github.com/v2pro/plz/reflect2" +) + +var jsonRawMessageType = reflect2.TypeOfPtr((*json.RawMessage)(nil)).Elem() +var jsoniterRawMessageType = reflect2.TypeOfPtr((*RawMessage)(nil)).Elem() + +func createEncoderOfJsonRawMessage(ctx *ctx, typ reflect2.Type) ValEncoder { + if typ == jsonRawMessageType { + return &jsonRawMessageCodec{} + } + if typ == jsoniterRawMessageType { + return &jsoniterRawMessageCodec{} + } + return nil +} + +func createDecoderOfJsonRawMessage(ctx *ctx, typ reflect2.Type) ValDecoder { + if typ == jsonRawMessageType { + return &jsonRawMessageCodec{} + } + if typ == jsoniterRawMessageType { + return &jsoniterRawMessageCodec{} + } + return nil +} + +type jsonRawMessageCodec struct { +} + +func (codec *jsonRawMessageCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { + *((*json.RawMessage)(ptr)) = json.RawMessage(iter.SkipAndReturnBytes()) +} + +func (codec *jsonRawMessageCodec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteRaw(string(*((*json.RawMessage)(ptr)))) +} + +func (codec *jsonRawMessageCodec) IsEmpty(ptr unsafe.Pointer) bool { + return len(*((*json.RawMessage)(ptr))) == 0 +} + +type jsoniterRawMessageCodec struct { +} + +func (codec *jsoniterRawMessageCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { + *((*RawMessage)(ptr)) = RawMessage(iter.SkipAndReturnBytes()) +} + +func (codec *jsoniterRawMessageCodec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteRaw(string(*((*RawMessage)(ptr)))) +} + +func (codec *jsoniterRawMessageCodec) IsEmpty(ptr unsafe.Pointer) bool { + return len(*((*RawMessage)(ptr))) == 0 +} \ No newline at end of file diff --git a/vendor/github.com/json-iterator/go/reflect_map.go b/vendor/github.com/json-iterator/go/reflect_map.go new file mode 100644 index 000000000..a33e726d4 --- /dev/null +++ b/vendor/github.com/json-iterator/go/reflect_map.go @@ -0,0 +1,284 @@ +package jsoniter + +import ( + "reflect" + "sort" + "unsafe" + "github.com/v2pro/plz/reflect2" + "fmt" +) + +func decoderOfMap(ctx *ctx, typ reflect2.Type) ValDecoder { + mapType := typ.(*reflect2.UnsafeMapType) + keyDecoder := decoderOfMapKey(ctx.append("[mapKey]"), mapType.Key()) + elemDecoder := decoderOfType(ctx.append("[mapElem]"), mapType.Elem()) + return &mapDecoder{ + mapType: mapType, + keyType: mapType.Key(), + elemType: mapType.Elem(), + keyDecoder: keyDecoder, + elemDecoder: elemDecoder, + } +} + +func encoderOfMap(ctx *ctx, typ reflect2.Type) ValEncoder { + mapType := typ.(*reflect2.UnsafeMapType) + if ctx.sortMapKeys { + return &sortKeysMapEncoder{ + mapType: mapType, + keyEncoder: encoderOfMapKey(ctx.append("[mapKey]"), mapType.Key()), + elemEncoder: encoderOfType(ctx.append("[mapElem]"), mapType.Elem()), + } + } + return &mapEncoder{ + mapType: mapType, + keyEncoder: encoderOfMapKey(ctx.append("[mapKey]"), mapType.Key()), + elemEncoder: encoderOfType(ctx.append("[mapElem]"), mapType.Elem()), + } +} + +func decoderOfMapKey(ctx *ctx, typ reflect2.Type) ValDecoder { + switch typ.Kind() { + case reflect.String: + return decoderOfType(ctx, reflect2.DefaultTypeOfKind(reflect.String)) + case reflect.Bool, + reflect.Uint8, reflect.Int8, + reflect.Uint16, reflect.Int16, + reflect.Uint32, reflect.Int32, + reflect.Uint64, reflect.Int64, + reflect.Uint, reflect.Int, + reflect.Float32, reflect.Float64, + reflect.Uintptr: + typ = reflect2.DefaultTypeOfKind(typ.Kind()) + return &numericMapKeyDecoder{decoderOfType(ctx, typ)} + default: + ptrType := reflect2.PtrTo(typ) + if ptrType.Implements(textMarshalerType) { + return &referenceDecoder{ + &textUnmarshalerDecoder{ + valType: ptrType, + }, + } + } + if typ.Implements(textMarshalerType) { + return &textUnmarshalerDecoder{ + valType: typ, + } + } + return &lazyErrorDecoder{err: fmt.Errorf("unsupported map key type: %v", typ)} + } +} + +func encoderOfMapKey(ctx *ctx, typ reflect2.Type) ValEncoder { + switch typ.Kind() { + case reflect.String: + return encoderOfType(ctx, reflect2.DefaultTypeOfKind(reflect.String)) + case reflect.Bool, + reflect.Uint8, reflect.Int8, + reflect.Uint16, reflect.Int16, + reflect.Uint32, reflect.Int32, + reflect.Uint64, reflect.Int64, + reflect.Uint, reflect.Int, + reflect.Float32, reflect.Float64, + reflect.Uintptr: + typ = reflect2.DefaultTypeOfKind(typ.Kind()) + return &numericMapKeyEncoder{encoderOfType(ctx, typ)} + default: + if typ == textMarshalerType { + return &directTextMarshalerEncoder{ + stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), + } + } + if typ.Implements(textMarshalerType) { + return &textMarshalerEncoder{ + valType: typ, + stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), + } + } + return &lazyErrorEncoder{err: fmt.Errorf("unsupported map key type: %v", typ)} + } +} + +type mapDecoder struct { + mapType *reflect2.UnsafeMapType + keyType reflect2.Type + elemType reflect2.Type + keyDecoder ValDecoder + elemDecoder ValDecoder +} + +func (decoder *mapDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + mapType := decoder.mapType + c := iter.nextToken() + if c == 'n' { + iter.skipThreeBytes('u', 'l', 'l') + *(*unsafe.Pointer)(ptr) = nil + mapType.UnsafeSet(ptr, mapType.UnsafeNew()) + return + } + if mapType.UnsafeIsNil(ptr) { + mapType.UnsafeSet(ptr, mapType.UnsafeMakeMap(0)) + } + if c != '{' { + iter.ReportError("ReadMapCB", `expect { or n, but found `+string([]byte{c})) + return + } + c = iter.nextToken() + if c == '}' { + return + } + if c != '"' { + iter.ReportError("ReadMapCB", `expect " after }, but found `+string([]byte{c})) + return + } + iter.unreadByte() + key := decoder.keyType.UnsafeNew() + decoder.keyDecoder.Decode(key, iter) + c = iter.nextToken() + if c != ':' { + iter.ReportError("ReadMapCB", "expect : after object field, but found "+string([]byte{c})) + return + } + elem := decoder.elemType.UnsafeNew() + decoder.elemDecoder.Decode(elem, iter) + decoder.mapType.UnsafeSetIndex(ptr, key, elem) + for c = iter.nextToken(); c == ','; c = iter.nextToken() { + key := decoder.keyType.UnsafeNew() + decoder.keyDecoder.Decode(key, iter) + c = iter.nextToken() + if c != ':' { + iter.ReportError("ReadMapCB", "expect : after object field, but found "+string([]byte{c})) + return + } + elem := decoder.elemType.UnsafeNew() + decoder.elemDecoder.Decode(elem, iter) + decoder.mapType.UnsafeSetIndex(ptr, key, elem) + } + if c != '}' { + iter.ReportError("ReadMapCB", `expect }, but found `+string([]byte{c})) + } +} + +type numericMapKeyDecoder struct { + decoder ValDecoder +} + +func (decoder *numericMapKeyDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + c := iter.nextToken() + if c != '"' { + iter.ReportError("ReadMapCB", `expect ", but found `+string([]byte{c})) + return + } + decoder.decoder.Decode(ptr, iter) + c = iter.nextToken() + if c != '"' { + iter.ReportError("ReadMapCB", `expect ", but found `+string([]byte{c})) + return + } +} + +type numericMapKeyEncoder struct { + encoder ValEncoder +} + +func (encoder *numericMapKeyEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.writeByte('"') + encoder.encoder.Encode(ptr, stream) + stream.writeByte('"') +} + +func (encoder *numericMapKeyEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return false +} + +type mapEncoder struct { + mapType *reflect2.UnsafeMapType + keyEncoder ValEncoder + elemEncoder ValEncoder +} + +func (encoder *mapEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteObjectStart() + iter := encoder.mapType.UnsafeIterate(ptr) + for i := 0; iter.HasNext(); i++ { + if i != 0 { + stream.WriteMore() + } + key, elem := iter.UnsafeNext() + encoder.keyEncoder.Encode(key, stream) + if stream.indention > 0 { + stream.writeTwoBytes(byte(':'), byte(' ')) + } else { + stream.writeByte(':') + } + encoder.elemEncoder.Encode(elem, stream) + } + stream.WriteObjectEnd() +} + +func (encoder *mapEncoder) IsEmpty(ptr unsafe.Pointer) bool { + iter := encoder.mapType.UnsafeIterate(ptr) + return !iter.HasNext() +} + +type sortKeysMapEncoder struct { + mapType *reflect2.UnsafeMapType + keyEncoder ValEncoder + elemEncoder ValEncoder +} + +func (encoder *sortKeysMapEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + if *(*unsafe.Pointer)(ptr) == nil { + stream.WriteNil() + return + } + stream.WriteObjectStart() + mapIter := encoder.mapType.UnsafeIterate(ptr) + subStream := stream.cfg.BorrowStream(nil) + subIter := stream.cfg.BorrowIterator(nil) + keyValues := encodedKeyValues{} + for mapIter.HasNext() { + subStream.buf = make([]byte, 0, 64) + key, elem := mapIter.UnsafeNext() + encoder.keyEncoder.Encode(key, subStream) + encodedKey := subStream.Buffer() + subIter.ResetBytes(encodedKey) + decodedKey := subIter.ReadString() + if stream.indention > 0 { + subStream.writeTwoBytes(byte(':'), byte(' ')) + } else { + subStream.writeByte(':') + } + encoder.elemEncoder.Encode(elem, subStream) + keyValues = append(keyValues, encodedKV{ + key: decodedKey, + keyValue: subStream.Buffer(), + }) + } + sort.Sort(keyValues) + for i, keyValue := range keyValues { + if i != 0 { + stream.WriteMore() + } + stream.Write(keyValue.keyValue) + } + stream.WriteObjectEnd() + stream.cfg.ReturnStream(subStream) + stream.cfg.ReturnIterator(subIter) +} + +func (encoder *sortKeysMapEncoder) IsEmpty(ptr unsafe.Pointer) bool { + iter := encoder.mapType.UnsafeIterate(ptr) + return !iter.HasNext() +} + +type encodedKeyValues []encodedKV + +type encodedKV struct { + key string + keyValue []byte +} + +func (sv encodedKeyValues) Len() int { return len(sv) } +func (sv encodedKeyValues) Swap(i, j int) { sv[i], sv[j] = sv[j], sv[i] } +func (sv encodedKeyValues) Less(i, j int) bool { return sv[i].key < sv[j].key } diff --git a/vendor/github.com/json-iterator/go/reflect_marshaler.go b/vendor/github.com/json-iterator/go/reflect_marshaler.go new file mode 100644 index 000000000..b2e0026b4 --- /dev/null +++ b/vendor/github.com/json-iterator/go/reflect_marshaler.go @@ -0,0 +1,218 @@ +package jsoniter + +import ( + "github.com/v2pro/plz/reflect2" + "unsafe" + "encoding" + "encoding/json" +) + +var marshalerType = reflect2.TypeOfPtr((*json.Marshaler)(nil)).Elem() +var unmarshalerType = reflect2.TypeOfPtr((*json.Unmarshaler)(nil)).Elem() +var textMarshalerType = reflect2.TypeOfPtr((*encoding.TextMarshaler)(nil)).Elem() +var textUnmarshalerType = reflect2.TypeOfPtr((*encoding.TextUnmarshaler)(nil)).Elem() + +func createDecoderOfMarshaler(ctx *ctx, typ reflect2.Type) ValDecoder { + ptrType := reflect2.PtrTo(typ) + if ptrType.Implements(unmarshalerType) { + return &referenceDecoder{ + &unmarshalerDecoder{ptrType}, + } + } + if ptrType.Implements(textUnmarshalerType) { + return &referenceDecoder{ + &textUnmarshalerDecoder{ptrType}, + } + } + return nil +} + +func createEncoderOfMarshaler(ctx *ctx, typ reflect2.Type) ValEncoder { + if typ == marshalerType { + checkIsEmpty := createCheckIsEmpty(ctx, typ) + var encoder ValEncoder = &directMarshalerEncoder{ + checkIsEmpty: checkIsEmpty, + } + return encoder + } + if typ.Implements(marshalerType) { + checkIsEmpty := createCheckIsEmpty(ctx, typ) + var encoder ValEncoder = &marshalerEncoder{ + valType: typ, + checkIsEmpty: checkIsEmpty, + } + return encoder + } + ptrType := reflect2.PtrTo(typ) + if ctx.prefix != "" && ptrType.Implements(marshalerType) { + checkIsEmpty := createCheckIsEmpty(ctx, ptrType) + var encoder ValEncoder = &marshalerEncoder{ + valType: ptrType, + checkIsEmpty: checkIsEmpty, + } + return &referenceEncoder{encoder} + } + if typ == textMarshalerType { + checkIsEmpty := createCheckIsEmpty(ctx, typ) + var encoder ValEncoder = &directTextMarshalerEncoder{ + checkIsEmpty: checkIsEmpty, + stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), + } + return encoder + } + if typ.Implements(textMarshalerType) { + checkIsEmpty := createCheckIsEmpty(ctx, typ) + var encoder ValEncoder = &textMarshalerEncoder{ + valType: typ, + stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), + checkIsEmpty: checkIsEmpty, + } + return encoder + } + // if prefix is empty, the type is the root type + if ctx.prefix != "" && ptrType.Implements(textMarshalerType) { + checkIsEmpty := createCheckIsEmpty(ctx, ptrType) + var encoder ValEncoder = &textMarshalerEncoder{ + valType: ptrType, + stringEncoder: ctx.EncoderOf(reflect2.TypeOf("")), + checkIsEmpty: checkIsEmpty, + } + return &referenceEncoder{encoder} + } + return nil +} + +type marshalerEncoder struct { + checkIsEmpty checkIsEmpty + valType reflect2.Type +} + +func (encoder *marshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + obj := encoder.valType.UnsafeIndirect(ptr) + if encoder.valType.IsNullable() && reflect2.IsNil(obj) { + stream.WriteNil() + return + } + marshaler := obj.(json.Marshaler) + bytes, err := marshaler.MarshalJSON() + if err != nil { + stream.Error = err + } else { + stream.Write(bytes) + } +} + +func (encoder *marshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.checkIsEmpty.IsEmpty(ptr) +} + +type directMarshalerEncoder struct { + checkIsEmpty checkIsEmpty +} + +func (encoder *directMarshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + marshaler := *(*json.Marshaler)(ptr) + if marshaler == nil { + stream.WriteNil() + return + } + bytes, err := marshaler.MarshalJSON() + if err != nil { + stream.Error = err + } else { + stream.Write(bytes) + } +} + +func (encoder *directMarshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.checkIsEmpty.IsEmpty(ptr) +} + +type textMarshalerEncoder struct { + valType reflect2.Type + stringEncoder ValEncoder + checkIsEmpty checkIsEmpty +} + +func (encoder *textMarshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + obj := encoder.valType.UnsafeIndirect(ptr) + if encoder.valType.IsNullable() && reflect2.IsNil(obj) { + stream.WriteNil() + return + } + marshaler := (obj).(encoding.TextMarshaler) + bytes, err := marshaler.MarshalText() + if err != nil { + stream.Error = err + } else { + str := string(bytes) + encoder.stringEncoder.Encode(unsafe.Pointer(&str), stream) + } +} + +func (encoder *textMarshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.checkIsEmpty.IsEmpty(ptr) +} + +type directTextMarshalerEncoder struct { + stringEncoder ValEncoder + checkIsEmpty checkIsEmpty +} + +func (encoder *directTextMarshalerEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + marshaler := *(*encoding.TextMarshaler)(ptr) + if marshaler == nil { + stream.WriteNil() + return + } + bytes, err := marshaler.MarshalText() + if err != nil { + stream.Error = err + } else { + str := string(bytes) + encoder.stringEncoder.Encode(unsafe.Pointer(&str), stream) + } +} + +func (encoder *directTextMarshalerEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.checkIsEmpty.IsEmpty(ptr) +} + +type unmarshalerDecoder struct { + valType reflect2.Type +} + +func (decoder *unmarshalerDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + valType := decoder.valType + obj := valType.UnsafeIndirect(ptr) + unmarshaler := obj.(json.Unmarshaler) + iter.nextToken() + iter.unreadByte() // skip spaces + bytes := iter.SkipAndReturnBytes() + err := unmarshaler.UnmarshalJSON(bytes) + if err != nil { + iter.ReportError("unmarshalerDecoder", err.Error()) + } +} + +type textUnmarshalerDecoder struct { + valType reflect2.Type +} + +func (decoder *textUnmarshalerDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + valType := decoder.valType + obj := valType.UnsafeIndirect(ptr) + if reflect2.IsNil(obj) { + ptrType := valType.(*reflect2.UnsafePtrType) + elemType := ptrType.Elem() + elem := elemType.UnsafeNew() + ptrType.UnsafeSet(ptr, unsafe.Pointer(&elem)) + obj = valType.UnsafeIndirect(ptr) + } + unmarshaler := (obj).(encoding.TextUnmarshaler) + str := iter.ReadString() + err := unmarshaler.UnmarshalText([]byte(str)) + if err != nil { + iter.ReportError("textUnmarshalerDecoder", err.Error()) + } +} diff --git a/vendor/github.com/json-iterator/go/reflect_native.go b/vendor/github.com/json-iterator/go/reflect_native.go new file mode 100644 index 000000000..f53636bb7 --- /dev/null +++ b/vendor/github.com/json-iterator/go/reflect_native.go @@ -0,0 +1,455 @@ +package jsoniter + +import ( + "encoding/base64" + "reflect" + "unsafe" + "github.com/v2pro/plz/reflect2" + "strconv" +) + +const ptrSize = 32 << uintptr(^uintptr(0)>>63) + +func createEncoderOfNative(ctx *ctx, typ reflect2.Type) ValEncoder { + if typ.Kind() == reflect.Slice && typ.(reflect2.SliceType).Elem().Kind() == reflect.Uint8 { + sliceDecoder := decoderOfSlice(ctx, typ) + return &base64Codec{sliceDecoder: sliceDecoder} + } + typeName := typ.String() + kind := typ.Kind() + switch kind { + case reflect.String: + if typeName != "string" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*string)(nil)).Elem()) + } + return &stringCodec{} + case reflect.Int: + if typeName != "int" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*int)(nil)).Elem()) + } + if strconv.IntSize == 32 { + return &int32Codec{} + } + return &int64Codec{} + case reflect.Int8: + if typeName != "int8" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*int8)(nil)).Elem()) + } + return &int8Codec{} + case reflect.Int16: + if typeName != "int16" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*int16)(nil)).Elem()) + } + return &int16Codec{} + case reflect.Int32: + if typeName != "int32" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*int32)(nil)).Elem()) + } + return &int32Codec{} + case reflect.Int64: + if typeName != "int64" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*int64)(nil)).Elem()) + } + return &int64Codec{} + case reflect.Uint: + if typeName != "uint" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*uint)(nil)).Elem()) + } + if strconv.IntSize == 32 { + return &uint32Codec{} + } + return &uint64Codec{} + case reflect.Uint8: + if typeName != "uint8" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*uint8)(nil)).Elem()) + } + return &uint8Codec{} + case reflect.Uint16: + if typeName != "uint16" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*uint16)(nil)).Elem()) + } + return &uint16Codec{} + case reflect.Uint32: + if typeName != "uint32" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*uint32)(nil)).Elem()) + } + return &uint32Codec{} + case reflect.Uintptr: + if typeName != "uintptr" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*uintptr)(nil)).Elem()) + } + if ptrSize == 32 { + return &uint32Codec{} + } + return &uint64Codec{} + case reflect.Uint64: + if typeName != "uint64" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*uint64)(nil)).Elem()) + } + return &uint64Codec{} + case reflect.Float32: + if typeName != "float32" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*float32)(nil)).Elem()) + } + return &float32Codec{} + case reflect.Float64: + if typeName != "float64" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*float64)(nil)).Elem()) + } + return &float64Codec{} + case reflect.Bool: + if typeName != "bool" { + return encoderOfType(ctx, reflect2.TypeOfPtr((*bool)(nil)).Elem()) + } + return &boolCodec{} + } + return nil +} + +func createDecoderOfNative(ctx *ctx, typ reflect2.Type) ValDecoder { + if typ.Kind() == reflect.Slice && typ.(reflect2.SliceType).Elem().Kind() == reflect.Uint8 { + sliceDecoder := decoderOfSlice(ctx, typ) + return &base64Codec{sliceDecoder: sliceDecoder} + } + typeName := typ.String() + switch typ.Kind() { + case reflect.String: + if typeName != "string" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*string)(nil)).Elem()) + } + return &stringCodec{} + case reflect.Int: + if typeName != "int" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*int)(nil)).Elem()) + } + if strconv.IntSize == 32 { + return &int32Codec{} + } + return &int64Codec{} + case reflect.Int8: + if typeName != "int8" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*int8)(nil)).Elem()) + } + return &int8Codec{} + case reflect.Int16: + if typeName != "int16" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*int16)(nil)).Elem()) + } + return &int16Codec{} + case reflect.Int32: + if typeName != "int32" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*int32)(nil)).Elem()) + } + return &int32Codec{} + case reflect.Int64: + if typeName != "int64" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*int64)(nil)).Elem()) + } + return &int64Codec{} + case reflect.Uint: + if typeName != "uint" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*uint)(nil)).Elem()) + } + if strconv.IntSize == 32 { + return &uint32Codec{} + } + return &uint64Codec{} + case reflect.Uint8: + if typeName != "uint8" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*uint8)(nil)).Elem()) + } + return &uint8Codec{} + case reflect.Uint16: + if typeName != "uint16" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*uint16)(nil)).Elem()) + } + return &uint16Codec{} + case reflect.Uint32: + if typeName != "uint32" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*uint32)(nil)).Elem()) + } + return &uint32Codec{} + case reflect.Uintptr: + if typeName != "uintptr" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*uintptr)(nil)).Elem()) + } + if ptrSize == 32 { + return &uint32Codec{} + } + return &uint64Codec{} + case reflect.Uint64: + if typeName != "uint64" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*uint64)(nil)).Elem()) + } + return &uint64Codec{} + case reflect.Float32: + if typeName != "float32" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*float32)(nil)).Elem()) + } + return &float32Codec{} + case reflect.Float64: + if typeName != "float64" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*float64)(nil)).Elem()) + } + return &float64Codec{} + case reflect.Bool: + if typeName != "bool" { + return decoderOfType(ctx, reflect2.TypeOfPtr((*bool)(nil)).Elem()) + } + return &boolCodec{} + } + return nil +} + +type stringCodec struct { +} + +func (codec *stringCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { + *((*string)(ptr)) = iter.ReadString() +} + +func (codec *stringCodec) Encode(ptr unsafe.Pointer, stream *Stream) { + str := *((*string)(ptr)) + stream.WriteString(str) +} + +func (codec *stringCodec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*string)(ptr)) == "" +} + +type int8Codec struct { +} + +func (codec *int8Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*int8)(ptr)) = iter.ReadInt8() + } +} + +func (codec *int8Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteInt8(*((*int8)(ptr))) +} + +func (codec *int8Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*int8)(ptr)) == 0 +} + +type int16Codec struct { +} + +func (codec *int16Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*int16)(ptr)) = iter.ReadInt16() + } +} + +func (codec *int16Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteInt16(*((*int16)(ptr))) +} + +func (codec *int16Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*int16)(ptr)) == 0 +} + +type int32Codec struct { +} + +func (codec *int32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*int32)(ptr)) = iter.ReadInt32() + } +} + +func (codec *int32Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteInt32(*((*int32)(ptr))) +} + +func (codec *int32Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*int32)(ptr)) == 0 +} + +type int64Codec struct { +} + +func (codec *int64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*int64)(ptr)) = iter.ReadInt64() + } +} + +func (codec *int64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteInt64(*((*int64)(ptr))) +} + +func (codec *int64Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*int64)(ptr)) == 0 +} + +type uint8Codec struct { +} + +func (codec *uint8Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*uint8)(ptr)) = iter.ReadUint8() + } +} + +func (codec *uint8Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteUint8(*((*uint8)(ptr))) +} + +func (codec *uint8Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*uint8)(ptr)) == 0 +} + +type uint16Codec struct { +} + +func (codec *uint16Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*uint16)(ptr)) = iter.ReadUint16() + } +} + +func (codec *uint16Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteUint16(*((*uint16)(ptr))) +} + +func (codec *uint16Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*uint16)(ptr)) == 0 +} + +type uint32Codec struct { +} + +func (codec *uint32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*uint32)(ptr)) = iter.ReadUint32() + } +} + +func (codec *uint32Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteUint32(*((*uint32)(ptr))) +} + +func (codec *uint32Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*uint32)(ptr)) == 0 +} + +type uint64Codec struct { +} + +func (codec *uint64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*uint64)(ptr)) = iter.ReadUint64() + } +} + +func (codec *uint64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteUint64(*((*uint64)(ptr))) +} + +func (codec *uint64Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*uint64)(ptr)) == 0 +} + +type float32Codec struct { +} + +func (codec *float32Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*float32)(ptr)) = iter.ReadFloat32() + } +} + +func (codec *float32Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteFloat32(*((*float32)(ptr))) +} + +func (codec *float32Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*float32)(ptr)) == 0 +} + +type float64Codec struct { +} + +func (codec *float64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*float64)(ptr)) = iter.ReadFloat64() + } +} + +func (codec *float64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteFloat64(*((*float64)(ptr))) +} + +func (codec *float64Codec) IsEmpty(ptr unsafe.Pointer) bool { + return *((*float64)(ptr)) == 0 +} + +type boolCodec struct { +} + +func (codec *boolCodec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if !iter.ReadNil() { + *((*bool)(ptr)) = iter.ReadBool() + } +} + +func (codec *boolCodec) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.WriteBool(*((*bool)(ptr))) +} + +func (codec *boolCodec) IsEmpty(ptr unsafe.Pointer) bool { + return !(*((*bool)(ptr))) +} + +type base64Codec struct { + sliceType *reflect2.UnsafeSliceType + sliceDecoder ValDecoder +} + +func (codec *base64Codec) Decode(ptr unsafe.Pointer, iter *Iterator) { + if iter.ReadNil() { + codec.sliceType.UnsafeSetNil(ptr) + return + } + switch iter.WhatIsNext() { + case StringValue: + encoding := base64.StdEncoding + src := iter.SkipAndReturnBytes() + src = src[1: len(src)-1] + decodedLen := encoding.DecodedLen(len(src)) + dst := make([]byte, decodedLen) + len, err := encoding.Decode(dst, src) + if err != nil { + iter.ReportError("decode base64", err.Error()) + } else { + dst = dst[:len] + codec.sliceType.UnsafeSet(ptr, unsafe.Pointer(&dst)) + } + case ArrayValue: + codec.sliceDecoder.Decode(ptr, iter) + default: + iter.ReportError("base64Codec", "invalid input") + } +} + +func (codec *base64Codec) Encode(ptr unsafe.Pointer, stream *Stream) { + src := *((*[]byte)(ptr)) + if len(src) == 0 { + stream.WriteNil() + return + } + encoding := base64.StdEncoding + stream.writeByte('"') + size := encoding.EncodedLen(len(src)) + buf := make([]byte, size) + encoding.Encode(buf, src) + stream.buf = append(stream.buf, buf...) + stream.writeByte('"') +} + +func (codec *base64Codec) IsEmpty(ptr unsafe.Pointer) bool { + return len(*((*[]byte)(ptr))) == 0 +} diff --git a/vendor/github.com/json-iterator/go/reflect_optional.go b/vendor/github.com/json-iterator/go/reflect_optional.go new file mode 100644 index 000000000..5eae3875f --- /dev/null +++ b/vendor/github.com/json-iterator/go/reflect_optional.go @@ -0,0 +1,133 @@ +package jsoniter + +import ( + "reflect" + "unsafe" + "github.com/v2pro/plz/reflect2" +) + +func decoderOfOptional(ctx *ctx, typ reflect2.Type) ValDecoder { + ptrType := typ.(*reflect2.UnsafePtrType) + elemType := ptrType.Elem() + decoder := decoderOfType(ctx, elemType) + if ctx.prefix == "" && elemType.Kind() == reflect.Ptr { + return &dereferenceDecoder{elemType, decoder} + } + return &OptionalDecoder{elemType, decoder} +} + +func encoderOfOptional(ctx *ctx, typ reflect2.Type) ValEncoder { + ptrType := typ.(*reflect2.UnsafePtrType) + elemType := ptrType.Elem() + elemEncoder := encoderOfType(ctx, elemType) + encoder := &OptionalEncoder{elemEncoder} + return encoder +} + +type OptionalDecoder struct { + ValueType reflect2.Type + ValueDecoder ValDecoder +} + +func (decoder *OptionalDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + if iter.ReadNil() { + *((*unsafe.Pointer)(ptr)) = nil + } else { + if *((*unsafe.Pointer)(ptr)) == nil { + //pointer to null, we have to allocate memory to hold the value + newPtr := decoder.ValueType.UnsafeNew() + decoder.ValueDecoder.Decode(newPtr, iter) + *((*unsafe.Pointer)(ptr)) = newPtr + } else { + //reuse existing instance + decoder.ValueDecoder.Decode(*((*unsafe.Pointer)(ptr)), iter) + } + } +} + +type dereferenceDecoder struct { + // only to deference a pointer + valueType reflect2.Type + valueDecoder ValDecoder +} + +func (decoder *dereferenceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + if *((*unsafe.Pointer)(ptr)) == nil { + //pointer to null, we have to allocate memory to hold the value + newPtr := decoder.valueType.UnsafeNew() + decoder.valueDecoder.Decode(newPtr, iter) + *((*unsafe.Pointer)(ptr)) = newPtr + } else { + //reuse existing instance + decoder.valueDecoder.Decode(*((*unsafe.Pointer)(ptr)), iter) + } +} + +type OptionalEncoder struct { + ValueEncoder ValEncoder +} + +func (encoder *OptionalEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + if *((*unsafe.Pointer)(ptr)) == nil { + stream.WriteNil() + } else { + encoder.ValueEncoder.Encode(*((*unsafe.Pointer)(ptr)), stream) + } +} + +func (encoder *OptionalEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return *((*unsafe.Pointer)(ptr)) == nil +} + +type dereferenceEncoder struct { + ValueEncoder ValEncoder +} + +func (encoder *dereferenceEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + if *((*unsafe.Pointer)(ptr)) == nil { + stream.WriteNil() + } else { + encoder.ValueEncoder.Encode(*((*unsafe.Pointer)(ptr)), stream) + } +} + +func (encoder *dereferenceEncoder) IsEmpty(ptr unsafe.Pointer) bool { + dePtr := *((*unsafe.Pointer)(ptr)) + if dePtr == nil { + return true + } + return encoder.ValueEncoder.IsEmpty(dePtr) +} + +func (encoder *dereferenceEncoder) IsEmbeddedPtrNil(ptr unsafe.Pointer) bool { + deReferenced := *((*unsafe.Pointer)(ptr)) + if deReferenced == nil { + return true + } + isEmbeddedPtrNil, converted := encoder.ValueEncoder.(IsEmbeddedPtrNil) + if !converted { + return false + } + fieldPtr := unsafe.Pointer(deReferenced) + return isEmbeddedPtrNil.IsEmbeddedPtrNil(fieldPtr) +} + +type referenceEncoder struct { + encoder ValEncoder +} + +func (encoder *referenceEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + encoder.encoder.Encode(unsafe.Pointer(&ptr), stream) +} + +func (encoder *referenceEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.encoder.IsEmpty(unsafe.Pointer(&ptr)) +} + +type referenceDecoder struct { + decoder ValDecoder +} + +func (decoder *referenceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + decoder.decoder.Decode(unsafe.Pointer(&ptr), iter) +} diff --git a/vendor/github.com/json-iterator/go/reflect_slice.go b/vendor/github.com/json-iterator/go/reflect_slice.go new file mode 100644 index 000000000..adb8d921b --- /dev/null +++ b/vendor/github.com/json-iterator/go/reflect_slice.go @@ -0,0 +1,99 @@ +package jsoniter + +import ( + "fmt" + "io" + "unsafe" + "github.com/v2pro/plz/reflect2" +) + +func decoderOfSlice(ctx *ctx, typ reflect2.Type) ValDecoder { + sliceType := typ.(*reflect2.UnsafeSliceType) + decoder := decoderOfType(ctx.append("[sliceElem]"), sliceType.Elem()) + return &sliceDecoder{sliceType, decoder} +} + +func encoderOfSlice(ctx *ctx, typ reflect2.Type) ValEncoder { + sliceType := typ.(*reflect2.UnsafeSliceType) + encoder := encoderOfType(ctx.append("[sliceElem]"), sliceType.Elem()) + return &sliceEncoder{sliceType, encoder} +} + +type sliceEncoder struct { + sliceType *reflect2.UnsafeSliceType + elemEncoder ValEncoder +} + +func (encoder *sliceEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + if encoder.sliceType.UnsafeIsNil(ptr) { + stream.WriteNil() + return + } + length := encoder.sliceType.UnsafeLengthOf(ptr) + if length == 0 { + stream.WriteEmptyArray() + return + } + stream.WriteArrayStart() + encoder.elemEncoder.Encode(encoder.sliceType.UnsafeGetIndex(ptr, 0), stream) + for i := 1; i < length; i++ { + stream.WriteMore() + elemPtr := encoder.sliceType.UnsafeGetIndex(ptr, i) + encoder.elemEncoder.Encode(elemPtr, stream) + } + stream.WriteArrayEnd() + if stream.Error != nil && stream.Error != io.EOF { + stream.Error = fmt.Errorf("%v: %s", encoder.sliceType, stream.Error.Error()) + } +} + +func (encoder *sliceEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.sliceType.UnsafeLengthOf(ptr) == 0 +} + +type sliceDecoder struct { + sliceType *reflect2.UnsafeSliceType + elemDecoder ValDecoder +} + +func (decoder *sliceDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + decoder.doDecode(ptr, iter) + if iter.Error != nil && iter.Error != io.EOF { + iter.Error = fmt.Errorf("%v: %s", decoder.sliceType, iter.Error.Error()) + } +} + +func (decoder *sliceDecoder) doDecode(ptr unsafe.Pointer, iter *Iterator) { + c := iter.nextToken() + sliceType := decoder.sliceType + if c == 'n' { + iter.skipThreeBytes('u', 'l', 'l') + sliceType.UnsafeSetNil(ptr) + return + } + if c != '[' { + iter.ReportError("decode slice", "expect [ or n, but found "+string([]byte{c})) + return + } + c = iter.nextToken() + if c == ']' { + sliceType.UnsafeSet(ptr, sliceType.UnsafeMakeSlice(0, 0)) + return + } + iter.unreadByte() + sliceType.UnsafeGrow(ptr, 1) + elemPtr := sliceType.UnsafeGetIndex(ptr, 0) + decoder.elemDecoder.Decode(elemPtr, iter) + length := 1 + for c = iter.nextToken(); c == ','; c = iter.nextToken() { + idx := length + length += 1 + sliceType.UnsafeGrow(ptr, length) + elemPtr = sliceType.UnsafeGetIndex(ptr, idx) + decoder.elemDecoder.Decode(elemPtr, iter) + } + if c != ']' { + iter.ReportError("decode slice", "expect ], but found "+string([]byte{c})) + return + } +} diff --git a/vendor/github.com/json-iterator/go/feature_reflect_struct_decoder.go b/vendor/github.com/json-iterator/go/reflect_struct_decoder.go similarity index 69% rename from vendor/github.com/json-iterator/go/feature_reflect_struct_decoder.go rename to vendor/github.com/json-iterator/go/reflect_struct_decoder.go index e6ced77c2..91d04f313 100644 --- a/vendor/github.com/json-iterator/go/feature_reflect_struct_decoder.go +++ b/vendor/github.com/json-iterator/go/reflect_struct_decoder.go @@ -3,38 +3,67 @@ package jsoniter import ( "fmt" "io" - "reflect" "strings" "unsafe" + "github.com/v2pro/plz/reflect2" ) -func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder) (ValDecoder, error) { - knownHash := map[int32]struct{}{ +func decoderOfStruct(ctx *ctx, typ reflect2.Type) ValDecoder { + bindings := map[string]*Binding{} + structDescriptor := describeStruct(ctx, typ) + for _, binding := range structDescriptor.Fields { + for _, fromName := range binding.FromNames { + old := bindings[fromName] + if old == nil { + bindings[fromName] = binding + continue + } + ignoreOld, ignoreNew := resolveConflictBinding(ctx.frozenConfig, old, binding) + if ignoreOld { + delete(bindings, fromName) + } + if !ignoreNew { + bindings[fromName] = binding + } + } + } + fields := map[string]*structFieldDecoder{} + for k, binding := range bindings { + fields[k] = binding.Decoder.(*structFieldDecoder) + } + return createStructDecoder(ctx, typ, fields) +} + +func createStructDecoder(ctx *ctx, typ reflect2.Type, fields map[string]*structFieldDecoder) ValDecoder { + if ctx.disallowUnknownFields { + return &generalStructDecoder{typ: typ, fields: fields, disallowUnknownFields: true} + } + knownHash := map[int64]struct{}{ 0: {}, } switch len(fields) { case 0: - return &skipObjectDecoder{typ}, nil + return &skipObjectDecoder{typ} case 1: for fieldName, fieldDecoder := range fields { fieldHash := calcHash(fieldName) _, known := knownHash[fieldHash] if known { - return &generalStructDecoder{typ, fields}, nil + return &generalStructDecoder{typ, fields, false} } knownHash[fieldHash] = struct{}{} - return &oneFieldStructDecoder{typ, fieldHash, fieldDecoder}, nil + return &oneFieldStructDecoder{typ, fieldHash, fieldDecoder} } case 2: - var fieldHash1 int32 - var fieldHash2 int32 + var fieldHash1 int64 + var fieldHash2 int64 var fieldDecoder1 *structFieldDecoder var fieldDecoder2 *structFieldDecoder for fieldName, fieldDecoder := range fields { fieldHash := calcHash(fieldName) _, known := knownHash[fieldHash] if known { - return &generalStructDecoder{typ, fields}, nil + return &generalStructDecoder{typ, fields, false} } knownHash[fieldHash] = struct{}{} if fieldHash1 == 0 { @@ -45,11 +74,11 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldDecoder2 = fieldDecoder } } - return &twoFieldsStructDecoder{typ, fieldHash1, fieldDecoder1, fieldHash2, fieldDecoder2}, nil + return &twoFieldsStructDecoder{typ, fieldHash1, fieldDecoder1, fieldHash2, fieldDecoder2} case 3: - var fieldName1 int32 - var fieldName2 int32 - var fieldName3 int32 + var fieldName1 int64 + var fieldName2 int64 + var fieldName3 int64 var fieldDecoder1 *structFieldDecoder var fieldDecoder2 *structFieldDecoder var fieldDecoder3 *structFieldDecoder @@ -57,7 +86,7 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldHash := calcHash(fieldName) _, known := knownHash[fieldHash] if known { - return &generalStructDecoder{typ, fields}, nil + return &generalStructDecoder{typ, fields, false} } knownHash[fieldHash] = struct{}{} if fieldName1 == 0 { @@ -72,12 +101,14 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder } } return &threeFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, fieldName2, fieldDecoder2, fieldName3, fieldDecoder3}, nil + fieldName1, fieldDecoder1, + fieldName2, fieldDecoder2, + fieldName3, fieldDecoder3} case 4: - var fieldName1 int32 - var fieldName2 int32 - var fieldName3 int32 - var fieldName4 int32 + var fieldName1 int64 + var fieldName2 int64 + var fieldName3 int64 + var fieldName4 int64 var fieldDecoder1 *structFieldDecoder var fieldDecoder2 *structFieldDecoder var fieldDecoder3 *structFieldDecoder @@ -86,7 +117,7 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldHash := calcHash(fieldName) _, known := knownHash[fieldHash] if known { - return &generalStructDecoder{typ, fields}, nil + return &generalStructDecoder{typ, fields, false} } knownHash[fieldHash] = struct{}{} if fieldName1 == 0 { @@ -104,14 +135,16 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder } } return &fourFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, fieldName2, fieldDecoder2, fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4}, nil + fieldName1, fieldDecoder1, + fieldName2, fieldDecoder2, + fieldName3, fieldDecoder3, + fieldName4, fieldDecoder4} case 5: - var fieldName1 int32 - var fieldName2 int32 - var fieldName3 int32 - var fieldName4 int32 - var fieldName5 int32 + var fieldName1 int64 + var fieldName2 int64 + var fieldName3 int64 + var fieldName4 int64 + var fieldName5 int64 var fieldDecoder1 *structFieldDecoder var fieldDecoder2 *structFieldDecoder var fieldDecoder3 *structFieldDecoder @@ -121,7 +154,7 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldHash := calcHash(fieldName) _, known := knownHash[fieldHash] if known { - return &generalStructDecoder{typ, fields}, nil + return &generalStructDecoder{typ, fields, false} } knownHash[fieldHash] = struct{}{} if fieldName1 == 0 { @@ -142,15 +175,18 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder } } return &fiveFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, fieldName2, fieldDecoder2, fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4, fieldName5, fieldDecoder5}, nil + fieldName1, fieldDecoder1, + fieldName2, fieldDecoder2, + fieldName3, fieldDecoder3, + fieldName4, fieldDecoder4, + fieldName5, fieldDecoder5} case 6: - var fieldName1 int32 - var fieldName2 int32 - var fieldName3 int32 - var fieldName4 int32 - var fieldName5 int32 - var fieldName6 int32 + var fieldName1 int64 + var fieldName2 int64 + var fieldName3 int64 + var fieldName4 int64 + var fieldName5 int64 + var fieldName6 int64 var fieldDecoder1 *structFieldDecoder var fieldDecoder2 *structFieldDecoder var fieldDecoder3 *structFieldDecoder @@ -161,7 +197,7 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldHash := calcHash(fieldName) _, known := knownHash[fieldHash] if known { - return &generalStructDecoder{typ, fields}, nil + return &generalStructDecoder{typ, fields, false} } knownHash[fieldHash] = struct{}{} if fieldName1 == 0 { @@ -185,16 +221,20 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder } } return &sixFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, fieldName2, fieldDecoder2, fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4, fieldName5, fieldDecoder5, fieldName6, fieldDecoder6}, nil + fieldName1, fieldDecoder1, + fieldName2, fieldDecoder2, + fieldName3, fieldDecoder3, + fieldName4, fieldDecoder4, + fieldName5, fieldDecoder5, + fieldName6, fieldDecoder6} case 7: - var fieldName1 int32 - var fieldName2 int32 - var fieldName3 int32 - var fieldName4 int32 - var fieldName5 int32 - var fieldName6 int32 - var fieldName7 int32 + var fieldName1 int64 + var fieldName2 int64 + var fieldName3 int64 + var fieldName4 int64 + var fieldName5 int64 + var fieldName6 int64 + var fieldName7 int64 var fieldDecoder1 *structFieldDecoder var fieldDecoder2 *structFieldDecoder var fieldDecoder3 *structFieldDecoder @@ -206,7 +246,7 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldHash := calcHash(fieldName) _, known := knownHash[fieldHash] if known { - return &generalStructDecoder{typ, fields}, nil + return &generalStructDecoder{typ, fields, false} } knownHash[fieldHash] = struct{}{} if fieldName1 == 0 { @@ -233,18 +273,22 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder } } return &sevenFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, fieldName2, fieldDecoder2, fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4, fieldName5, fieldDecoder5, fieldName6, fieldDecoder6, - fieldName7, fieldDecoder7}, nil + fieldName1, fieldDecoder1, + fieldName2, fieldDecoder2, + fieldName3, fieldDecoder3, + fieldName4, fieldDecoder4, + fieldName5, fieldDecoder5, + fieldName6, fieldDecoder6, + fieldName7, fieldDecoder7} case 8: - var fieldName1 int32 - var fieldName2 int32 - var fieldName3 int32 - var fieldName4 int32 - var fieldName5 int32 - var fieldName6 int32 - var fieldName7 int32 - var fieldName8 int32 + var fieldName1 int64 + var fieldName2 int64 + var fieldName3 int64 + var fieldName4 int64 + var fieldName5 int64 + var fieldName6 int64 + var fieldName7 int64 + var fieldName8 int64 var fieldDecoder1 *structFieldDecoder var fieldDecoder2 *structFieldDecoder var fieldDecoder3 *structFieldDecoder @@ -257,7 +301,7 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldHash := calcHash(fieldName) _, known := knownHash[fieldHash] if known { - return &generalStructDecoder{typ, fields}, nil + return &generalStructDecoder{typ, fields, false} } knownHash[fieldHash] = struct{}{} if fieldName1 == 0 { @@ -287,19 +331,24 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder } } return &eightFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, fieldName2, fieldDecoder2, fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4, fieldName5, fieldDecoder5, fieldName6, fieldDecoder6, - fieldName7, fieldDecoder7, fieldName8, fieldDecoder8}, nil + fieldName1, fieldDecoder1, + fieldName2, fieldDecoder2, + fieldName3, fieldDecoder3, + fieldName4, fieldDecoder4, + fieldName5, fieldDecoder5, + fieldName6, fieldDecoder6, + fieldName7, fieldDecoder7, + fieldName8, fieldDecoder8} case 9: - var fieldName1 int32 - var fieldName2 int32 - var fieldName3 int32 - var fieldName4 int32 - var fieldName5 int32 - var fieldName6 int32 - var fieldName7 int32 - var fieldName8 int32 - var fieldName9 int32 + var fieldName1 int64 + var fieldName2 int64 + var fieldName3 int64 + var fieldName4 int64 + var fieldName5 int64 + var fieldName6 int64 + var fieldName7 int64 + var fieldName8 int64 + var fieldName9 int64 var fieldDecoder1 *structFieldDecoder var fieldDecoder2 *structFieldDecoder var fieldDecoder3 *structFieldDecoder @@ -313,7 +362,7 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldHash := calcHash(fieldName) _, known := knownHash[fieldHash] if known { - return &generalStructDecoder{typ, fields}, nil + return &generalStructDecoder{typ, fields, false} } knownHash[fieldHash] = struct{}{} if fieldName1 == 0 { @@ -346,20 +395,26 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder } } return &nineFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, fieldName2, fieldDecoder2, fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4, fieldName5, fieldDecoder5, fieldName6, fieldDecoder6, - fieldName7, fieldDecoder7, fieldName8, fieldDecoder8, fieldName9, fieldDecoder9}, nil + fieldName1, fieldDecoder1, + fieldName2, fieldDecoder2, + fieldName3, fieldDecoder3, + fieldName4, fieldDecoder4, + fieldName5, fieldDecoder5, + fieldName6, fieldDecoder6, + fieldName7, fieldDecoder7, + fieldName8, fieldDecoder8, + fieldName9, fieldDecoder9} case 10: - var fieldName1 int32 - var fieldName2 int32 - var fieldName3 int32 - var fieldName4 int32 - var fieldName5 int32 - var fieldName6 int32 - var fieldName7 int32 - var fieldName8 int32 - var fieldName9 int32 - var fieldName10 int32 + var fieldName1 int64 + var fieldName2 int64 + var fieldName3 int64 + var fieldName4 int64 + var fieldName5 int64 + var fieldName6 int64 + var fieldName7 int64 + var fieldName8 int64 + var fieldName9 int64 + var fieldName10 int64 var fieldDecoder1 *structFieldDecoder var fieldDecoder2 *structFieldDecoder var fieldDecoder3 *structFieldDecoder @@ -374,7 +429,7 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder fieldHash := calcHash(fieldName) _, known := knownHash[fieldHash] if known { - return &generalStructDecoder{typ, fields}, nil + return &generalStructDecoder{typ, fields, false} } knownHash[fieldHash] = struct{}{} if fieldName1 == 0 { @@ -410,66 +465,77 @@ func createStructDecoder(typ reflect.Type, fields map[string]*structFieldDecoder } } return &tenFieldsStructDecoder{typ, - fieldName1, fieldDecoder1, fieldName2, fieldDecoder2, fieldName3, fieldDecoder3, - fieldName4, fieldDecoder4, fieldName5, fieldDecoder5, fieldName6, fieldDecoder6, - fieldName7, fieldDecoder7, fieldName8, fieldDecoder8, fieldName9, fieldDecoder9, - fieldName10, fieldDecoder10}, nil + fieldName1, fieldDecoder1, + fieldName2, fieldDecoder2, + fieldName3, fieldDecoder3, + fieldName4, fieldDecoder4, + fieldName5, fieldDecoder5, + fieldName6, fieldDecoder6, + fieldName7, fieldDecoder7, + fieldName8, fieldDecoder8, + fieldName9, fieldDecoder9, + fieldName10, fieldDecoder10} } - return &generalStructDecoder{typ, fields}, nil + return &generalStructDecoder{typ, fields, false} } type generalStructDecoder struct { - typ reflect.Type - fields map[string]*structFieldDecoder + typ reflect2.Type + fields map[string]*structFieldDecoder + disallowUnknownFields bool } func (decoder *generalStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { if !iter.readObjectStart() { return } - var fieldBytes []byte + decoder.decodeOneField(ptr, iter) + for iter.nextToken() == ',' { + decoder.decodeOneField(ptr, iter) + } + if iter.Error != nil && iter.Error != io.EOF { + iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) + } +} + +func (decoder *generalStructDecoder) decodeOneField(ptr unsafe.Pointer, iter *Iterator) { var field string + var fieldDecoder *structFieldDecoder if iter.cfg.objectFieldMustBeSimpleString { - fieldBytes = iter.readObjectFieldAsBytes() + fieldBytes := iter.ReadStringAsSlice() field = *(*string)(unsafe.Pointer(&fieldBytes)) + fieldDecoder = decoder.fields[field] + if fieldDecoder == nil { + fieldDecoder = decoder.fields[strings.ToLower(field)] + } } else { field = iter.ReadString() + fieldDecoder = decoder.fields[field] + if fieldDecoder == nil { + fieldDecoder = decoder.fields[strings.ToLower(field)] + } + } + if fieldDecoder == nil { + msg := "found unknown field: " + field + if decoder.disallowUnknownFields { + iter.ReportError("ReadObject", msg) + } c := iter.nextToken() if c != ':' { iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) } - } - fieldDecoder := decoder.fields[strings.ToLower(field)] - if fieldDecoder == nil { iter.Skip() - } else { - fieldDecoder.Decode(ptr, iter) + return } - for iter.nextToken() == ',' { - if iter.cfg.objectFieldMustBeSimpleString { - fieldBytes := iter.readObjectFieldAsBytes() - field = *(*string)(unsafe.Pointer(&fieldBytes)) - } else { - field = iter.ReadString() - c := iter.nextToken() - if c != ':' { - iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) - } - } - fieldDecoder = decoder.fields[strings.ToLower(field)] - if fieldDecoder == nil { - iter.Skip() - } else { - fieldDecoder.Decode(ptr, iter) - } - } - if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%v: %s", decoder.typ, iter.Error.Error()) + c := iter.nextToken() + if c != ':' { + iter.ReportError("ReadObject", "expect : after object field, but found "+string([]byte{c})) } + fieldDecoder.Decode(ptr, iter) } type skipObjectDecoder struct { - typ reflect.Type + typ reflect2.Type } func (decoder *skipObjectDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { @@ -482,8 +548,8 @@ func (decoder *skipObjectDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { } type oneFieldStructDecoder struct { - typ reflect.Type - fieldHash int32 + typ reflect2.Type + fieldHash int64 fieldDecoder *structFieldDecoder } @@ -502,15 +568,15 @@ func (decoder *oneFieldStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) } } if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%v: %s", decoder.typ, iter.Error.Error()) + iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) } } type twoFieldsStructDecoder struct { - typ reflect.Type - fieldHash1 int32 + typ reflect2.Type + fieldHash1 int64 fieldDecoder1 *structFieldDecoder - fieldHash2 int32 + fieldHash2 int64 fieldDecoder2 *structFieldDecoder } @@ -532,17 +598,17 @@ func (decoder *twoFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator } } if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%v: %s", decoder.typ, iter.Error.Error()) + iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) } } type threeFieldsStructDecoder struct { - typ reflect.Type - fieldHash1 int32 + typ reflect2.Type + fieldHash1 int64 fieldDecoder1 *structFieldDecoder - fieldHash2 int32 + fieldHash2 int64 fieldDecoder2 *structFieldDecoder - fieldHash3 int32 + fieldHash3 int64 fieldDecoder3 *structFieldDecoder } @@ -566,19 +632,19 @@ func (decoder *threeFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterat } } if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%v: %s", decoder.typ, iter.Error.Error()) + iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) } } type fourFieldsStructDecoder struct { - typ reflect.Type - fieldHash1 int32 + typ reflect2.Type + fieldHash1 int64 fieldDecoder1 *structFieldDecoder - fieldHash2 int32 + fieldHash2 int64 fieldDecoder2 *structFieldDecoder - fieldHash3 int32 + fieldHash3 int64 fieldDecoder3 *structFieldDecoder - fieldHash4 int32 + fieldHash4 int64 fieldDecoder4 *structFieldDecoder } @@ -604,21 +670,21 @@ func (decoder *fourFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterato } } if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%v: %s", decoder.typ, iter.Error.Error()) + iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) } } type fiveFieldsStructDecoder struct { - typ reflect.Type - fieldHash1 int32 + typ reflect2.Type + fieldHash1 int64 fieldDecoder1 *structFieldDecoder - fieldHash2 int32 + fieldHash2 int64 fieldDecoder2 *structFieldDecoder - fieldHash3 int32 + fieldHash3 int64 fieldDecoder3 *structFieldDecoder - fieldHash4 int32 + fieldHash4 int64 fieldDecoder4 *structFieldDecoder - fieldHash5 int32 + fieldHash5 int64 fieldDecoder5 *structFieldDecoder } @@ -646,23 +712,23 @@ func (decoder *fiveFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterato } } if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%v: %s", decoder.typ, iter.Error.Error()) + iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) } } type sixFieldsStructDecoder struct { - typ reflect.Type - fieldHash1 int32 + typ reflect2.Type + fieldHash1 int64 fieldDecoder1 *structFieldDecoder - fieldHash2 int32 + fieldHash2 int64 fieldDecoder2 *structFieldDecoder - fieldHash3 int32 + fieldHash3 int64 fieldDecoder3 *structFieldDecoder - fieldHash4 int32 + fieldHash4 int64 fieldDecoder4 *structFieldDecoder - fieldHash5 int32 + fieldHash5 int64 fieldDecoder5 *structFieldDecoder - fieldHash6 int32 + fieldHash6 int64 fieldDecoder6 *structFieldDecoder } @@ -692,25 +758,25 @@ func (decoder *sixFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator } } if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%v: %s", decoder.typ, iter.Error.Error()) + iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) } } type sevenFieldsStructDecoder struct { - typ reflect.Type - fieldHash1 int32 + typ reflect2.Type + fieldHash1 int64 fieldDecoder1 *structFieldDecoder - fieldHash2 int32 + fieldHash2 int64 fieldDecoder2 *structFieldDecoder - fieldHash3 int32 + fieldHash3 int64 fieldDecoder3 *structFieldDecoder - fieldHash4 int32 + fieldHash4 int64 fieldDecoder4 *structFieldDecoder - fieldHash5 int32 + fieldHash5 int64 fieldDecoder5 *structFieldDecoder - fieldHash6 int32 + fieldHash6 int64 fieldDecoder6 *structFieldDecoder - fieldHash7 int32 + fieldHash7 int64 fieldDecoder7 *structFieldDecoder } @@ -742,27 +808,27 @@ func (decoder *sevenFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterat } } if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%v: %s", decoder.typ, iter.Error.Error()) + iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) } } type eightFieldsStructDecoder struct { - typ reflect.Type - fieldHash1 int32 + typ reflect2.Type + fieldHash1 int64 fieldDecoder1 *structFieldDecoder - fieldHash2 int32 + fieldHash2 int64 fieldDecoder2 *structFieldDecoder - fieldHash3 int32 + fieldHash3 int64 fieldDecoder3 *structFieldDecoder - fieldHash4 int32 + fieldHash4 int64 fieldDecoder4 *structFieldDecoder - fieldHash5 int32 + fieldHash5 int64 fieldDecoder5 *structFieldDecoder - fieldHash6 int32 + fieldHash6 int64 fieldDecoder6 *structFieldDecoder - fieldHash7 int32 + fieldHash7 int64 fieldDecoder7 *structFieldDecoder - fieldHash8 int32 + fieldHash8 int64 fieldDecoder8 *structFieldDecoder } @@ -796,29 +862,29 @@ func (decoder *eightFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterat } } if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%v: %s", decoder.typ, iter.Error.Error()) + iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) } } type nineFieldsStructDecoder struct { - typ reflect.Type - fieldHash1 int32 + typ reflect2.Type + fieldHash1 int64 fieldDecoder1 *structFieldDecoder - fieldHash2 int32 + fieldHash2 int64 fieldDecoder2 *structFieldDecoder - fieldHash3 int32 + fieldHash3 int64 fieldDecoder3 *structFieldDecoder - fieldHash4 int32 + fieldHash4 int64 fieldDecoder4 *structFieldDecoder - fieldHash5 int32 + fieldHash5 int64 fieldDecoder5 *structFieldDecoder - fieldHash6 int32 + fieldHash6 int64 fieldDecoder6 *structFieldDecoder - fieldHash7 int32 + fieldHash7 int64 fieldDecoder7 *structFieldDecoder - fieldHash8 int32 + fieldHash8 int64 fieldDecoder8 *structFieldDecoder - fieldHash9 int32 + fieldHash9 int64 fieldDecoder9 *structFieldDecoder } @@ -854,31 +920,31 @@ func (decoder *nineFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterato } } if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%v: %s", decoder.typ, iter.Error.Error()) + iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) } } type tenFieldsStructDecoder struct { - typ reflect.Type - fieldHash1 int32 + typ reflect2.Type + fieldHash1 int64 fieldDecoder1 *structFieldDecoder - fieldHash2 int32 + fieldHash2 int64 fieldDecoder2 *structFieldDecoder - fieldHash3 int32 + fieldHash3 int64 fieldDecoder3 *structFieldDecoder - fieldHash4 int32 + fieldHash4 int64 fieldDecoder4 *structFieldDecoder - fieldHash5 int32 + fieldHash5 int64 fieldDecoder5 *structFieldDecoder - fieldHash6 int32 + fieldHash6 int64 fieldDecoder6 *structFieldDecoder - fieldHash7 int32 + fieldHash7 int64 fieldDecoder7 *structFieldDecoder - fieldHash8 int32 + fieldHash8 int64 fieldDecoder8 *structFieldDecoder - fieldHash9 int32 + fieldHash9 int64 fieldDecoder9 *structFieldDecoder - fieldHash10 int32 + fieldHash10 int64 fieldDecoder10 *structFieldDecoder } @@ -916,19 +982,53 @@ func (decoder *tenFieldsStructDecoder) Decode(ptr unsafe.Pointer, iter *Iterator } } if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%v: %s", decoder.typ, iter.Error.Error()) + iter.Error = fmt.Errorf("%v.%s", decoder.typ, iter.Error.Error()) } } type structFieldDecoder struct { - field *reflect.StructField + field reflect2.StructField fieldDecoder ValDecoder } func (decoder *structFieldDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { - fieldPtr := unsafe.Pointer(uintptr(ptr) + decoder.field.Offset) + fieldPtr := decoder.field.UnsafeGet(ptr) decoder.fieldDecoder.Decode(fieldPtr, iter) if iter.Error != nil && iter.Error != io.EOF { - iter.Error = fmt.Errorf("%s: %s", decoder.field.Name, iter.Error.Error()) + iter.Error = fmt.Errorf("%s: %s", decoder.field.Name(), iter.Error.Error()) } } + +type stringModeStringDecoder struct { + elemDecoder ValDecoder + cfg *frozenConfig +} + +func (decoder *stringModeStringDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + decoder.elemDecoder.Decode(ptr, iter) + str := *((*string)(ptr)) + tempIter := decoder.cfg.BorrowIterator([]byte(str)) + defer decoder.cfg.ReturnIterator(tempIter) + *((*string)(ptr)) = tempIter.ReadString() +} + +type stringModeNumberDecoder struct { + elemDecoder ValDecoder +} + +func (decoder *stringModeNumberDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { + c := iter.nextToken() + if c != '"' { + iter.ReportError("stringModeNumberDecoder", `expect ", but found `+string([]byte{c})) + return + } + decoder.elemDecoder.Decode(ptr, iter) + if iter.Error != nil { + return + } + c = iter.readByte() + if c != '"' { + iter.ReportError("stringModeNumberDecoder", `expect ", but found `+string([]byte{c})) + return + } +} \ No newline at end of file diff --git a/vendor/github.com/json-iterator/go/feature_reflect_object.go b/vendor/github.com/json-iterator/go/reflect_struct_encoder.go similarity index 50% rename from vendor/github.com/json-iterator/go/feature_reflect_object.go rename to vendor/github.com/json-iterator/go/reflect_struct_encoder.go index 59b1235c0..0252251db 100644 --- a/vendor/github.com/json-iterator/go/feature_reflect_object.go +++ b/vendor/github.com/json-iterator/go/reflect_struct_encoder.go @@ -4,21 +4,18 @@ import ( "fmt" "io" "reflect" - "strings" "unsafe" + "github.com/v2pro/plz/reflect2" ) -func encoderOfStruct(cfg *frozenConfig, typ reflect.Type) (ValEncoder, error) { +func encoderOfStruct(ctx *ctx, typ reflect2.Type) ValEncoder { type bindingTo struct { binding *Binding toName string ignored bool } orderedBindings := []*bindingTo{} - structDescriptor, err := describeStruct(cfg, typ) - if err != nil { - return nil, err - } + structDescriptor := describeStruct(ctx, typ) for _, binding := range structDescriptor.Fields { for _, toName := range binding.ToNames { new := &bindingTo{ @@ -29,13 +26,13 @@ func encoderOfStruct(cfg *frozenConfig, typ reflect.Type) (ValEncoder, error) { if old.toName != toName { continue } - old.ignored, new.ignored = resolveConflictBinding(cfg, old.binding, new.binding) + old.ignored, new.ignored = resolveConflictBinding(ctx.frozenConfig, old.binding, new.binding) } orderedBindings = append(orderedBindings, new) } } if len(orderedBindings) == 0 { - return &emptyStructEncoder{}, nil + return &emptyStructEncoder{} } finalOrderedFields := []structFieldTo{} for _, bindingTo := range orderedBindings { @@ -46,12 +43,36 @@ func encoderOfStruct(cfg *frozenConfig, typ reflect.Type) (ValEncoder, error) { }) } } - return &structEncoder{structDescriptor.onePtrEmbedded, structDescriptor.onePtrOptimization, finalOrderedFields}, nil + return &structEncoder{typ, finalOrderedFields} +} + +func createCheckIsEmpty(ctx *ctx, typ reflect2.Type) checkIsEmpty { + encoder := createEncoderOfNative(ctx, typ) + if encoder != nil { + return encoder + } + kind := typ.Kind() + switch kind { + case reflect.Interface: + return &dynamicEncoder{typ} + case reflect.Struct: + return &structEncoder{typ: typ} + case reflect.Array: + return &arrayEncoder{} + case reflect.Slice: + return &sliceEncoder{} + case reflect.Map: + return encoderOfMap(ctx, typ) + case reflect.Ptr: + return &OptionalEncoder{} + default: + return &lazyErrorEncoder{err: fmt.Errorf("unsupported type: %v", typ)} + } } func resolveConflictBinding(cfg *frozenConfig, old, new *Binding) (ignoreOld, ignoreNew bool) { - newTagged := new.Field.Tag.Get(cfg.getTagKey()) != "" - oldTagged := old.Field.Tag.Get(cfg.getTagKey()) != "" + newTagged := new.Field.Tag().Get(cfg.getTagKey()) != "" + oldTagged := old.Field.Tag().Get(cfg.getTagKey()) != "" if newTagged { if oldTagged { if len(old.levels) > len(new.levels) { @@ -78,62 +99,41 @@ func resolveConflictBinding(cfg *frozenConfig, old, new *Binding) (ignoreOld, ig } } -func decoderOfStruct(cfg *frozenConfig, typ reflect.Type) (ValDecoder, error) { - bindings := map[string]*Binding{} - structDescriptor, err := describeStruct(cfg, typ) - if err != nil { - return nil, err - } - for _, binding := range structDescriptor.Fields { - for _, fromName := range binding.FromNames { - old := bindings[fromName] - if old == nil { - bindings[fromName] = binding - continue - } - ignoreOld, ignoreNew := resolveConflictBinding(cfg, old, binding) - if ignoreOld { - delete(bindings, fromName) - } - if !ignoreNew { - bindings[fromName] = binding - } - } - } - fields := map[string]*structFieldDecoder{} - for k, binding := range bindings { - fields[strings.ToLower(k)] = binding.Decoder.(*structFieldDecoder) - } - return createStructDecoder(typ, fields) -} - type structFieldEncoder struct { - field *reflect.StructField + field reflect2.StructField fieldEncoder ValEncoder omitempty bool } func (encoder *structFieldEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { - fieldPtr := unsafe.Pointer(uintptr(ptr) + encoder.field.Offset) + fieldPtr := encoder.field.UnsafeGet(ptr) encoder.fieldEncoder.Encode(fieldPtr, stream) if stream.Error != nil && stream.Error != io.EOF { - stream.Error = fmt.Errorf("%s: %s", encoder.field.Name, stream.Error.Error()) + stream.Error = fmt.Errorf("%s: %s", encoder.field.Name(), stream.Error.Error()) } } -func (encoder *structFieldEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - func (encoder *structFieldEncoder) IsEmpty(ptr unsafe.Pointer) bool { - fieldPtr := unsafe.Pointer(uintptr(ptr) + encoder.field.Offset) + fieldPtr := encoder.field.UnsafeGet(ptr) return encoder.fieldEncoder.IsEmpty(fieldPtr) } +func (encoder *structFieldEncoder) IsEmbeddedPtrNil(ptr unsafe.Pointer) bool { + isEmbeddedPtrNil, converted := encoder.fieldEncoder.(IsEmbeddedPtrNil) + if !converted { + return false + } + fieldPtr := encoder.field.UnsafeGet(ptr) + return isEmbeddedPtrNil.IsEmbeddedPtrNil(fieldPtr) +} + +type IsEmbeddedPtrNil interface { + IsEmbeddedPtrNil(ptr unsafe.Pointer) bool +} + type structEncoder struct { - onePtrEmbedded bool - onePtrOptimization bool - fields []structFieldTo + typ reflect2.Type + fields []structFieldTo } type structFieldTo struct { @@ -148,6 +148,9 @@ func (encoder *structEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { if field.encoder.omitempty && field.encoder.IsEmpty(ptr) { continue } + if field.encoder.IsEmbeddedPtrNil(ptr) { + continue + } if isNotFirst { stream.WriteMore() } @@ -156,23 +159,8 @@ func (encoder *structEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { isNotFirst = true } stream.WriteObjectEnd() -} - -func (encoder *structEncoder) EncodeInterface(val interface{}, stream *Stream) { - e := (*emptyInterface)(unsafe.Pointer(&val)) - if encoder.onePtrOptimization { - if e.word == nil && encoder.onePtrEmbedded { - stream.WriteObjectStart() - stream.WriteObjectEnd() - return - } - ptr := uintptr(e.word) - e.word = unsafe.Pointer(&ptr) - } - if reflect.TypeOf(val).Kind() == reflect.Ptr { - encoder.Encode(unsafe.Pointer(&e.word), stream) - } else { - encoder.Encode(e.word, stream) + if stream.Error != nil && stream.Error != io.EOF { + stream.Error = fmt.Errorf("%v.%s", encoder.typ, stream.Error.Error()) } } @@ -187,10 +175,36 @@ func (encoder *emptyStructEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { stream.WriteEmptyObject() } -func (encoder *emptyStructEncoder) EncodeInterface(val interface{}, stream *Stream) { - WriteToStream(val, stream, encoder) -} - func (encoder *emptyStructEncoder) IsEmpty(ptr unsafe.Pointer) bool { return false } + +type stringModeNumberEncoder struct { + elemEncoder ValEncoder +} + +func (encoder *stringModeNumberEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + stream.writeByte('"') + encoder.elemEncoder.Encode(ptr, stream) + stream.writeByte('"') +} + +func (encoder *stringModeNumberEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.elemEncoder.IsEmpty(ptr) +} + +type stringModeStringEncoder struct { + elemEncoder ValEncoder + cfg *frozenConfig +} + +func (encoder *stringModeStringEncoder) Encode(ptr unsafe.Pointer, stream *Stream) { + tempStream := encoder.cfg.BorrowStream(nil) + defer encoder.cfg.ReturnStream(tempStream) + encoder.elemEncoder.Encode(ptr, tempStream) + stream.WriteString(string(tempStream.Buffer())) +} + +func (encoder *stringModeStringEncoder) IsEmpty(ptr unsafe.Pointer) bool { + return encoder.elemEncoder.IsEmpty(ptr) +} diff --git a/vendor/github.com/json-iterator/go/feature_stream.go b/vendor/github.com/json-iterator/go/stream.go similarity index 62% rename from vendor/github.com/json-iterator/go/feature_stream.go rename to vendor/github.com/json-iterator/go/stream.go index 97355eb5b..d6e529808 100644 --- a/vendor/github.com/json-iterator/go/feature_stream.go +++ b/vendor/github.com/json-iterator/go/stream.go @@ -10,7 +10,6 @@ type Stream struct { cfg *frozenConfig out io.Writer buf []byte - n int Error error indention int Attachment interface{} // open for customized encoder @@ -24,8 +23,7 @@ func NewStream(cfg API, out io.Writer, bufSize int) *Stream { return &Stream{ cfg: cfg.(*frozenConfig), out: out, - buf: make([]byte, bufSize), - n: 0, + buf: make([]byte, 0, bufSize), Error: nil, indention: 0, } @@ -39,22 +37,22 @@ func (stream *Stream) Pool() StreamPool { // Reset reuse this stream instance by assign a new writer func (stream *Stream) Reset(out io.Writer) { stream.out = out - stream.n = 0 + stream.buf = stream.buf[:0] } // Available returns how many bytes are unused in the buffer. func (stream *Stream) Available() int { - return len(stream.buf) - stream.n + return cap(stream.buf) - len(stream.buf) } // Buffered returns the number of bytes that have been written into the current buffer. func (stream *Stream) Buffered() int { - return stream.n + return len(stream.buf) } // Buffer if writer is nil, use this method to take the result func (stream *Stream) Buffer() []byte { - return stream.buf[:stream.n] + return stream.buf } // Write writes the contents of p into the buffer. @@ -62,97 +60,34 @@ func (stream *Stream) Buffer() []byte { // If nn < len(p), it also returns an error explaining // why the write is short. func (stream *Stream) Write(p []byte) (nn int, err error) { - for len(p) > stream.Available() && stream.Error == nil { - if stream.out == nil { - stream.growAtLeast(len(p)) - } else { - var n int - if stream.Buffered() == 0 { - // Large write, empty buffer. - // Write directly from p to avoid copy. - n, stream.Error = stream.out.Write(p) - } else { - n = copy(stream.buf[stream.n:], p) - stream.n += n - stream.Flush() - } - nn += n - p = p[n:] - } + stream.buf = append(stream.buf, p...) + if stream.out != nil { + nn, err = stream.out.Write(stream.buf) + stream.buf = stream.buf[nn:] + return } - if stream.Error != nil { - return nn, stream.Error - } - n := copy(stream.buf[stream.n:], p) - stream.n += n - nn += n - return nn, nil + return len(p), nil } // WriteByte writes a single byte. func (stream *Stream) writeByte(c byte) { - if stream.Error != nil { - return - } - if stream.Available() < 1 { - stream.growAtLeast(1) - } - stream.buf[stream.n] = c - stream.n++ + stream.buf = append(stream.buf, c) } func (stream *Stream) writeTwoBytes(c1 byte, c2 byte) { - if stream.Error != nil { - return - } - if stream.Available() < 2 { - stream.growAtLeast(2) - } - stream.buf[stream.n] = c1 - stream.buf[stream.n+1] = c2 - stream.n += 2 + stream.buf = append(stream.buf, c1, c2) } func (stream *Stream) writeThreeBytes(c1 byte, c2 byte, c3 byte) { - if stream.Error != nil { - return - } - if stream.Available() < 3 { - stream.growAtLeast(3) - } - stream.buf[stream.n] = c1 - stream.buf[stream.n+1] = c2 - stream.buf[stream.n+2] = c3 - stream.n += 3 + stream.buf = append(stream.buf, c1, c2, c3) } func (stream *Stream) writeFourBytes(c1 byte, c2 byte, c3 byte, c4 byte) { - if stream.Error != nil { - return - } - if stream.Available() < 4 { - stream.growAtLeast(4) - } - stream.buf[stream.n] = c1 - stream.buf[stream.n+1] = c2 - stream.buf[stream.n+2] = c3 - stream.buf[stream.n+3] = c4 - stream.n += 4 + stream.buf = append(stream.buf, c1, c2, c3, c4) } func (stream *Stream) writeFiveBytes(c1 byte, c2 byte, c3 byte, c4 byte, c5 byte) { - if stream.Error != nil { - return - } - if stream.Available() < 5 { - stream.growAtLeast(5) - } - stream.buf[stream.n] = c1 - stream.buf[stream.n+1] = c2 - stream.buf[stream.n+2] = c3 - stream.buf[stream.n+3] = c4 - stream.buf[stream.n+4] = c5 - stream.n += 5 + stream.buf = append(stream.buf, c1, c2, c3, c4, c5) } // Flush writes any buffered data to the underlying io.Writer. @@ -163,56 +98,20 @@ func (stream *Stream) Flush() error { if stream.Error != nil { return stream.Error } - if stream.n == 0 { - return nil - } - n, err := stream.out.Write(stream.buf[0:stream.n]) - if n < stream.n && err == nil { - err = io.ErrShortWrite - } + n, err := stream.out.Write(stream.buf) if err != nil { - if n > 0 && n < stream.n { - copy(stream.buf[0:stream.n-n], stream.buf[n:stream.n]) + if stream.Error == nil { + stream.Error = err } - stream.n -= n - stream.Error = err return err } - stream.n = 0 + stream.buf = stream.buf[n:] return nil } -func (stream *Stream) ensure(minimal int) { - available := stream.Available() - if available < minimal { - stream.growAtLeast(minimal) - } -} - -func (stream *Stream) growAtLeast(minimal int) { - if stream.out != nil { - stream.Flush() - if stream.Available() >= minimal { - return - } - } - toGrow := len(stream.buf) - if toGrow < minimal { - toGrow = minimal - } - newBuf := make([]byte, len(stream.buf)+toGrow) - copy(newBuf, stream.Buffer()) - stream.buf = newBuf -} - // WriteRaw write string out without quotes, just like []byte func (stream *Stream) WriteRaw(s string) { - stream.ensure(len(s)) - if stream.Error != nil { - return - } - n := copy(stream.buf[stream.n:], s) - stream.n += n + stream.buf = append(stream.buf, s...) } // WriteNil write null to stream @@ -273,6 +172,7 @@ func (stream *Stream) WriteEmptyObject() { func (stream *Stream) WriteMore() { stream.writeByte(',') stream.writeIndention(0) + stream.Flush() } // WriteArrayStart write [ with possible indention @@ -300,9 +200,7 @@ func (stream *Stream) writeIndention(delta int) { } stream.writeByte('\n') toWrite := stream.indention - delta - stream.ensure(toWrite) - for i := 0; i < toWrite && stream.n < len(stream.buf); i++ { - stream.buf[stream.n] = ' ' - stream.n++ + for i := 0; i < toWrite; i++ { + stream.buf = append(stream.buf, ' ') } } diff --git a/vendor/github.com/json-iterator/go/feature_stream_float.go b/vendor/github.com/json-iterator/go/stream_float.go similarity index 85% rename from vendor/github.com/json-iterator/go/feature_stream_float.go rename to vendor/github.com/json-iterator/go/stream_float.go index 9a404e11d..f318d2c59 100644 --- a/vendor/github.com/json-iterator/go/feature_stream_float.go +++ b/vendor/github.com/json-iterator/go/stream_float.go @@ -21,7 +21,7 @@ func (stream *Stream) WriteFloat32(val float32) { fmt = 'e' } } - stream.WriteRaw(strconv.FormatFloat(float64(val), fmt, -1, 32)) + stream.buf = strconv.AppendFloat(stream.buf, float64(val), fmt, -1, 32) } // WriteFloat32Lossy write float32 to stream with ONLY 6 digits precision although much much faster @@ -43,13 +43,12 @@ func (stream *Stream) WriteFloat32Lossy(val float32) { return } stream.writeByte('.') - stream.ensure(10) for p := precision - 1; p > 0 && fval < pow10[p]; p-- { stream.writeByte('0') } stream.WriteUint64(fval) - for stream.buf[stream.n-1] == '0' { - stream.n-- + for stream.buf[len(stream.buf)-1] == '0' { + stream.buf = stream.buf[:len(stream.buf)-1] } } @@ -63,7 +62,7 @@ func (stream *Stream) WriteFloat64(val float64) { fmt = 'e' } } - stream.WriteRaw(strconv.FormatFloat(float64(val), fmt, -1, 64)) + stream.buf = strconv.AppendFloat(stream.buf, float64(val), fmt, -1, 64) } // WriteFloat64Lossy write float64 to stream with ONLY 6 digits precision although much much faster @@ -85,12 +84,11 @@ func (stream *Stream) WriteFloat64Lossy(val float64) { return } stream.writeByte('.') - stream.ensure(10) for p := precision - 1; p > 0 && fval < pow10[p]; p-- { stream.writeByte('0') } stream.WriteUint64(fval) - for stream.buf[stream.n-1] == '0' { - stream.n-- + for stream.buf[len(stream.buf)-1] == '0' { + stream.buf = stream.buf[:len(stream.buf)-1] } } diff --git a/vendor/github.com/json-iterator/go/stream_int.go b/vendor/github.com/json-iterator/go/stream_int.go new file mode 100644 index 000000000..0f7424860 --- /dev/null +++ b/vendor/github.com/json-iterator/go/stream_int.go @@ -0,0 +1,190 @@ +package jsoniter + +var digits []uint32 + +func init() { + digits = make([]uint32, 1000) + for i := uint32(0); i < 1000; i++ { + digits[i] = (((i / 100) + '0') << 16) + ((((i / 10) % 10) + '0') << 8) + i%10 + '0' + if i < 10 { + digits[i] += 2 << 24 + } else if i < 100 { + digits[i] += 1 << 24 + } + } +} + +func writeFirstBuf(space []byte, v uint32) []byte { + start := v >> 24 + if start == 0 { + space = append(space, byte(v >> 16), byte(v >> 8)) + } else if start == 1 { + space = append(space, byte(v >> 8)) + } + space = append(space, byte(v)) + return space +} + +func writeBuf(buf []byte, v uint32) []byte { + return append(buf, byte(v >> 16), byte(v >> 8), byte(v)) +} + +// WriteUint8 write uint8 to stream +func (stream *Stream) WriteUint8(val uint8) { + stream.buf = writeFirstBuf(stream.buf, digits[val]) +} + +// WriteInt8 write int8 to stream +func (stream *Stream) WriteInt8(nval int8) { + var val uint8 + if nval < 0 { + val = uint8(-nval) + stream.buf = append(stream.buf, '-') + } else { + val = uint8(nval) + } + stream.buf = writeFirstBuf(stream.buf, digits[val]) +} + +// WriteUint16 write uint16 to stream +func (stream *Stream) WriteUint16(val uint16) { + q1 := val / 1000 + if q1 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[val]) + return + } + r1 := val - q1*1000 + stream.buf = writeFirstBuf(stream.buf, digits[q1]) + stream.buf = writeBuf(stream.buf, digits[r1]) + return +} + +// WriteInt16 write int16 to stream +func (stream *Stream) WriteInt16(nval int16) { + var val uint16 + if nval < 0 { + val = uint16(-nval) + stream.buf = append(stream.buf, '-') + } else { + val = uint16(nval) + } + stream.WriteUint16(val) +} + +// WriteUint32 write uint32 to stream +func (stream *Stream) WriteUint32(val uint32) { + q1 := val / 1000 + if q1 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[val]) + return + } + r1 := val - q1*1000 + q2 := q1 / 1000 + if q2 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[q1]) + stream.buf = writeBuf(stream.buf, digits[r1]) + return + } + r2 := q1 - q2*1000 + q3 := q2 / 1000 + if q3 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[q2]) + } else { + r3 := q2 - q3*1000 + stream.buf = append(stream.buf, byte(q3 + '0')) + stream.buf = writeBuf(stream.buf, digits[r3]) + } + stream.buf = writeBuf(stream.buf, digits[r2]) + stream.buf = writeBuf(stream.buf, digits[r1]) +} + +// WriteInt32 write int32 to stream +func (stream *Stream) WriteInt32(nval int32) { + var val uint32 + if nval < 0 { + val = uint32(-nval) + stream.buf = append(stream.buf, '-') + } else { + val = uint32(nval) + } + stream.WriteUint32(val) +} + +// WriteUint64 write uint64 to stream +func (stream *Stream) WriteUint64(val uint64) { + q1 := val / 1000 + if q1 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[val]) + return + } + r1 := val - q1*1000 + q2 := q1 / 1000 + if q2 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[q1]) + stream.buf = writeBuf(stream.buf, digits[r1]) + return + } + r2 := q1 - q2*1000 + q3 := q2 / 1000 + if q3 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[q2]) + stream.buf = writeBuf(stream.buf, digits[r2]) + stream.buf = writeBuf(stream.buf, digits[r1]) + return + } + r3 := q2 - q3*1000 + q4 := q3 / 1000 + if q4 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[q3]) + stream.buf = writeBuf(stream.buf, digits[r3]) + stream.buf = writeBuf(stream.buf, digits[r2]) + stream.buf = writeBuf(stream.buf, digits[r1]) + return + } + r4 := q3 - q4*1000 + q5 := q4 / 1000 + if q5 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[q4]) + stream.buf = writeBuf(stream.buf, digits[r4]) + stream.buf = writeBuf(stream.buf, digits[r3]) + stream.buf = writeBuf(stream.buf, digits[r2]) + stream.buf = writeBuf(stream.buf, digits[r1]) + return + } + r5 := q4 - q5*1000 + q6 := q5 / 1000 + if q6 == 0 { + stream.buf = writeFirstBuf(stream.buf, digits[q5]) + } else { + stream.buf = writeFirstBuf(stream.buf, digits[q6]) + r6 := q5 - q6*1000 + stream.buf = writeBuf(stream.buf, digits[r6]) + } + stream.buf = writeBuf(stream.buf, digits[r5]) + stream.buf = writeBuf(stream.buf, digits[r4]) + stream.buf = writeBuf(stream.buf, digits[r3]) + stream.buf = writeBuf(stream.buf, digits[r2]) + stream.buf = writeBuf(stream.buf, digits[r1]) +} + +// WriteInt64 write int64 to stream +func (stream *Stream) WriteInt64(nval int64) { + var val uint64 + if nval < 0 { + val = uint64(-nval) + stream.buf = append(stream.buf, '-') + } else { + val = uint64(nval) + } + stream.WriteUint64(val) +} + +// WriteInt write int to stream +func (stream *Stream) WriteInt(val int) { + stream.WriteInt64(int64(val)) +} + +// WriteUint write uint to stream +func (stream *Stream) WriteUint(val uint) { + stream.WriteUint64(uint64(val)) +} diff --git a/vendor/github.com/json-iterator/go/feature_stream_string.go b/vendor/github.com/json-iterator/go/stream_str.go similarity index 91% rename from vendor/github.com/json-iterator/go/feature_stream_string.go rename to vendor/github.com/json-iterator/go/stream_str.go index 334282f05..54c2ba0b3 100644 --- a/vendor/github.com/json-iterator/go/feature_stream_string.go +++ b/vendor/github.com/json-iterator/go/stream_str.go @@ -219,34 +219,22 @@ var hex = "0123456789abcdef" // WriteStringWithHTMLEscaped write string to stream with html special characters escaped func (stream *Stream) WriteStringWithHTMLEscaped(s string) { - stream.ensure(32) valLen := len(s) - toWriteLen := valLen - bufLengthMinusTwo := len(stream.buf) - 2 // make room for the quotes - if stream.n+toWriteLen > bufLengthMinusTwo { - toWriteLen = bufLengthMinusTwo - stream.n - } - n := stream.n - stream.buf[n] = '"' - n++ + stream.buf = append(stream.buf, '"') // write string, the fast path, without utf8 and escape support i := 0 - for ; i < toWriteLen; i++ { + for ; i < valLen; i++ { c := s[i] if c < utf8.RuneSelf && htmlSafeSet[c] { - stream.buf[n] = c - n++ + stream.buf = append(stream.buf, c) } else { break } } if i == valLen { - stream.buf[n] = '"' - n++ - stream.n = n + stream.buf = append(stream.buf, '"') return } - stream.n = n writeStringSlowPathWithHTMLEscaped(stream, i, s, valLen) } @@ -321,34 +309,22 @@ func writeStringSlowPathWithHTMLEscaped(stream *Stream, i int, s string, valLen // WriteString write string to stream without html escape func (stream *Stream) WriteString(s string) { - stream.ensure(32) valLen := len(s) - toWriteLen := valLen - bufLengthMinusTwo := len(stream.buf) - 2 // make room for the quotes - if stream.n+toWriteLen > bufLengthMinusTwo { - toWriteLen = bufLengthMinusTwo - stream.n - } - n := stream.n - stream.buf[n] = '"' - n++ + stream.buf = append(stream.buf, '"') // write string, the fast path, without utf8 and escape support i := 0 - for ; i < toWriteLen; i++ { + for ; i < valLen; i++ { c := s[i] if c > 31 && c != '"' && c != '\\' { - stream.buf[n] = c - n++ + stream.buf = append(stream.buf, c) } else { break } } if i == valLen { - stream.buf[n] = '"' - n++ - stream.n = n + stream.buf = append(stream.buf, '"') return } - stream.n = n writeStringSlowPath(stream, i, s, valLen) } diff --git a/vendor/github.com/json-iterator/go/jsoniter_stream_test.go b/vendor/github.com/json-iterator/go/stream_test.go similarity index 94% rename from vendor/github.com/json-iterator/go/jsoniter_stream_test.go rename to vendor/github.com/json-iterator/go/stream_test.go index 8df96b9f3..d407c7ab7 100644 --- a/vendor/github.com/json-iterator/go/jsoniter_stream_test.go +++ b/vendor/github.com/json-iterator/go/stream_test.go @@ -23,10 +23,10 @@ func Test_writeBytes_should_grow_buffer(t *testing.T) { stream := NewStream(ConfigDefault, nil, 1) stream.Write([]byte{'1', '2'}) should.Equal("12", string(stream.Buffer())) - should.Equal(3, len(stream.buf)) + should.Equal(2, len(stream.buf)) stream.Write([]byte{'3', '4', '5', '6', '7'}) should.Equal("1234567", string(stream.Buffer())) - should.Equal(8, len(stream.buf)) + should.Equal(7, len(stream.buf)) } func Test_writeIndention_should_grow_buffer(t *testing.T) { @@ -65,5 +65,5 @@ func Test_flush_buffer_should_stop_grow_buffer(t *testing.T) { writer := new(NopWriter) NewEncoder(writer).Encode(make([]int, 10000000)) should := require.New(t) - should.Equal(512, writer.bufferSize) + should.Equal(8, writer.bufferSize) } diff --git a/vendor/github.com/json-iterator/go/test.sh b/vendor/github.com/json-iterator/go/test.sh index 466f1141a..f4e7c0b2c 100755 --- a/vendor/github.com/json-iterator/go/test.sh +++ b/vendor/github.com/json-iterator/go/test.sh @@ -4,7 +4,7 @@ set -e echo "" > coverage.txt for d in $(go list ./... | grep -v vendor); do - go test -coverprofile=profile.out $d + go test -coverprofile=profile.out -coverpkg=github.com/json-iterator/go $d if [ -f profile.out ]; then cat profile.out >> coverage.txt rm profile.out diff --git a/vendor/github.com/json-iterator/go/unmarshal_input_test.go b/vendor/github.com/json-iterator/go/unmarshal_input_test.go deleted file mode 100644 index 9d7b99c5f..000000000 --- a/vendor/github.com/json-iterator/go/unmarshal_input_test.go +++ /dev/null @@ -1,72 +0,0 @@ -package jsoniter - -import ( - "encoding/json" - "reflect" - "testing" - - fuzz "github.com/google/gofuzz" -) - -func Test_NilInput(t *testing.T) { - var jb []byte // nil - var out string - err := Unmarshal(jb, &out) - if err == nil { - t.Errorf("Expected error") - } -} - -func Test_EmptyInput(t *testing.T) { - jb := []byte("") - var out string - err := Unmarshal(jb, &out) - if err == nil { - t.Errorf("Expected error") - } -} - -func Test_RandomInput_Bytes(t *testing.T) { - fz := fuzz.New().NilChance(0) - for i := 0; i < 10000; i++ { - var jb []byte - fz.Fuzz(&jb) - testRandomInput(t, jb) - } -} - -func Test_RandomInput_String(t *testing.T) { - fz := fuzz.New().NilChance(0) - for i := 0; i < 10000; i++ { - var js string - fz.Fuzz(&js) - jb := []byte(js) - testRandomInput(t, jb) - } -} - -func testRandomInput(t *testing.T, jb []byte) { - var outString string - testRandomInputTo(t, jb, &outString) - - var outInt int - testRandomInputTo(t, jb, &outInt) - - var outStruct struct{} - testRandomInputTo(t, jb, &outStruct) - - var outSlice []string - testRandomInputTo(t, jb, &outSlice) -} - -func testRandomInputTo(t *testing.T, jb []byte, out interface{}) { - err := Unmarshal(jb, out) - if err == nil { - // Cross-check stdlib to see if we just happened to fuzz a legit value. - err := json.Unmarshal(jb, out) - if err != nil { - t.Fatalf("Expected error unmarshaling as %s:\nas string: %q\nas bytes: %v", - reflect.TypeOf(out).Elem().Kind(), string(jb), jb) - } - } -} diff --git a/vendor/github.com/rcrowley/go-metrics/README.md b/vendor/github.com/rcrowley/go-metrics/README.md index bc2a45a83..17cea76de 100644 --- a/vendor/github.com/rcrowley/go-metrics/README.md +++ b/vendor/github.com/rcrowley/go-metrics/README.md @@ -164,3 +164,4 @@ Clients are available for the following destinations: * Prometheus - https://github.com/deathowl/go-metrics-prometheus * DataDog - https://github.com/syntaqx/go-metrics-datadog * SignalFX - https://github.com/pascallouisperez/go-metrics-signalfx +* Honeycomb - https://github.com/getspine/go-metrics-honeycomb diff --git a/vendor/github.com/ugorji/go/.travis.yml b/vendor/github.com/ugorji/go/.travis.yml new file mode 100644 index 000000000..05e593459 --- /dev/null +++ b/vendor/github.com/ugorji/go/.travis.yml @@ -0,0 +1,11 @@ +language: go +sudo: false +go: + - 1.7.x # go testing suite support, which we use, was introduced in go 1.7 + - 1.8.x + - 1.9.x + - tip +script: + - go test -tags "alltests" -run Suite -coverprofile coverage.txt github.com/ugorji/go/codec +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/ugorji/go/README.md b/vendor/github.com/ugorji/go/README.md index 6bb74742f..8867438d9 100644 --- a/vendor/github.com/ugorji/go/README.md +++ b/vendor/github.com/ugorji/go/README.md @@ -1,3 +1,10 @@ +[![Sourcegraph](https://sourcegraph.com/github.com/ugorji/go/-/badge.svg)](https://sourcegraph.com/github.com/ugorji/go/-/blob/codec) +[![Build Status](https://travis-ci.org/ugorji/go.svg?branch=master)](https://travis-ci.org/ugorji/go) +[![codecov](https://codecov.io/gh/ugorji/go/branch/master/graph/badge.svg)](https://codecov.io/gh/ugorji/go) +[![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](http://godoc.org/github.com/ugorji/go/codec) +[![rcard](https://goreportcard.com/badge/github.com/ugorji/go/codec?v=2)](https://goreportcard.com/report/github.com/ugorji/go/codec) +[![License](http://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://raw.githubusercontent.com/ugorji/go/master/LICENSE) + # go/codec This repository contains the `go-codec` library, diff --git a/vendor/github.com/ugorji/go/codec/0doc.go b/vendor/github.com/ugorji/go/codec/0doc.go index 209f9ebad..cf7b48d9c 100644 --- a/vendor/github.com/ugorji/go/codec/0doc.go +++ b/vendor/github.com/ugorji/go/codec/0doc.go @@ -1,9 +1,10 @@ -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. /* -High Performance, Feature-Rich Idiomatic Go codec/encoding library for -binc, msgpack, cbor, json. +Package codec provides a +High Performance, Feature-Rich Idiomatic Go 1.4+ codec/encoding library +for binc, msgpack, cbor, json. Supported Serialization formats are: @@ -11,21 +12,17 @@ Supported Serialization formats are: - binc: http://github.com/ugorji/binc - cbor: http://cbor.io http://tools.ietf.org/html/rfc7049 - json: http://json.org http://tools.ietf.org/html/rfc7159 - - simple: + - simple: To install: go get github.com/ugorji/go/codec -This package understands the 'unsafe' tag, to allow using unsafe semantics: - - - When decoding into a struct, you need to read the field name as a string - so you can find the struct field it is mapped to. - Using `unsafe` will bypass the allocation and copying overhead of []byte->string conversion. - -To install using unsafe, pass the 'unsafe' tag: - - go get -tags=unsafe github.com/ugorji/go/codec +This package will carefully use 'unsafe' for performance reasons in specific places. +You can build without unsafe use by passing the safe or appengine tag +i.e. 'go install -tags=safe ...'. Note that unsafe is only supported for the last 3 +go sdk versions e.g. current go release is go 1.9, so we support unsafe use only from +go 1.7+ . This is because supporting unsafe requires knowledge of implementation details. For detailed usage information, read the primer at http://ugorji.net/blog/go-codec-primer . @@ -35,12 +32,16 @@ the standard library (ie json, xml, gob, etc). Rich Feature Set includes: - Simple but extremely powerful and feature-rich API + - Support for go1.4 and above, while selectively using newer APIs for later releases + - Excellent code coverage ( > 90% ) - Very High Performance. Our extensive benchmarks show us outperforming Gob, Json, Bson, etc by 2-4X. - - Multiple conversions: - Package coerces types where appropriate - e.g. decode an int in the stream into a float, etc. - - Corner Cases: + - Careful selected use of 'unsafe' for targeted performance gains. + 100% mode exists where 'unsafe' is not used at all. + - Lock-free (sans mutex) concurrency for scaling to 100's of cores + - Coerce types where appropriate + e.g. decode an int in the stream into a float, decode numbers from formatted strings, etc + - Corner Cases: Overflows, nil maps/slices, nil values in streams are handled correctly - Standard field renaming via tags - Support for omitting empty fields during an encoding @@ -48,15 +49,21 @@ Rich Feature Set includes: (struct, slice, map, primitives, pointers, interface{}, etc) - Extensions to support efficient encoding/decoding of any named types - Support encoding.(Binary|Text)(M|Unm)arshaler interfaces + - Support IsZero() bool to determine if a value is a zero value. + Analogous to time.Time.IsZero() bool. - Decoding without a schema (into a interface{}). Includes Options to configure what specific map or slice type to use when decoding an encoded list or map into a nil interface{} + - Mapping a non-interface type to an interface, so we can decode appropriately + into any interface type with a correctly configured non-interface value. - Encode a struct as an array, and decode struct from an array in the data stream + - Option to encode struct keys as numbers (instead of strings) + (to support structured streams with fields encoded as numeric codes) - Comprehensive support for anonymous fields - Fast (no-reflection) encoding/decoding of common maps and slices - Code-generation for faster performance. - Support binary (e.g. messagepack, cbor) and text (e.g. json) formats - - Support indefinite-length formats to enable true streaming + - Support indefinite-length formats to enable true streaming (for formats which support it e.g. json, cbor) - Support canonical encoding, where a value is ALWAYS encoded as same sequence of bytes. This mostly applies to maps, where iteration order is non-deterministic. @@ -68,12 +75,12 @@ Rich Feature Set includes: - Encode/Decode from/to chan types (for iterative streaming support) - Drop-in replacement for encoding/json. `json:` key in struct tag supported. - Provides a RPC Server and Client Codec for net/rpc communication protocol. - - Handle unique idiosyncrasies of codecs e.g. - - For messagepack, configure how ambiguities in handling raw bytes are resolved - - For messagepack, provide rpc server/client codec to support + - Handle unique idiosyncrasies of codecs e.g. + - For messagepack, configure how ambiguities in handling raw bytes are resolved + - For messagepack, provide rpc server/client codec to support msgpack-rpc protocol defined at: https://github.com/msgpack-rpc/msgpack-rpc/blob/master/spec.md - + Extension Support Users can register a function to handle the encoding or decoding of @@ -92,6 +99,27 @@ encoded as an empty map because it has no exported fields, while UUID would be encoded as a string. However, with extension support, you can encode any of these however you like. +Custom Encoding and Decoding + +This package maintains symmetry in the encoding and decoding halfs. +We determine how to encode or decode by walking this decision tree + + - is type a codec.Selfer? + - is there an extension registered for the type? + - is format binary, and is type a encoding.BinaryMarshaler and BinaryUnmarshaler? + - is format specifically json, and is type a encoding/json.Marshaler and Unmarshaler? + - is format text-based, and type an encoding.TextMarshaler? + - else we use a pair of functions based on the "kind" of the type e.g. map, slice, int64, etc + +This symmetry is important to reduce chances of issues happening because the +encoding and decoding sides are out of sync e.g. decoded via very specific +encoding.TextUnmarshaler but encoded via kind-specific generalized mode. + +Consequently, if a type only defines one-half of the symmetry +(e.g. it implements UnmarshalJSON() but not MarshalJSON() ), +then that type doesn't satisfy the check and we will continue walking down the +decision tree. + RPC RPC Client and Server Codecs are implemented, so the codecs can be used @@ -160,40 +188,77 @@ Sample usage model: //OR rpcCodec := codec.MsgpackSpecRpc.ClientCodec(conn, h) client := rpc.NewClientWithCodec(rpcCodec) +Running Tests + +To run tests, use the following: + + go test + +To run the full suite of tests, use the following: + + go test -tags alltests -run Suite + +You can run the tag 'safe' to run tests or build in safe mode. e.g. + + go test -tags safe -run Json + go test -tags "alltests safe" -run Suite + +Running Benchmarks + +Please see http://github.com/ugorji/go-codec-bench . + +Caveats + +Struct fields matching the following are ignored during encoding and decoding + - struct tag value set to - + - func, complex numbers, unsafe pointers + - unexported and not embedded + - unexported and embedded and not struct kind + - unexported and embedded pointers (from go1.10) + +Every other field in a struct will be encoded/decoded. + +Embedded fields are encoded as if they exist in the top-level struct, +with some caveats. See Encode documentation. + */ package codec -// Benefits of go-codec: -// -// - encoding/json always reads whole file into memory first. -// This makes it unsuitable for parsing very large files. -// - encoding/xml cannot parse into a map[string]interface{} -// I found this out on reading https://github.com/clbanning/mxj - // TODO: +// - In Go 1.10, when mid-stack inlining is enabled, +// we should use committed functions for writeXXX and readXXX calls. +// This involves uncommenting the methods for decReaderSwitch and encWriterSwitch +// and using those (decReaderSwitch and encWriterSwitch) in all handles +// instead of encWriter and decReader. +// The benefit is that, for the (En|De)coder over []byte, the encWriter/decReader +// will be inlined, giving a performance bump for that typical case. +// However, it will only be inlined if mid-stack inlining is enabled, +// as we call panic to raise errors, and panic currently prevents inlining. // -// - optimization for codecgen: -// if len of entity is <= 3 words, then support a value receiver for encode. -// - (En|De)coder should store an error when it occurs. -// Until reset, subsequent calls return that error that was stored. -// This means that free panics must go away. -// All errors must be raised through errorf method. -// - Decoding using a chan is good, but incurs concurrency costs. -// This is because there's no fast way to use a channel without it -// having to switch goroutines constantly. -// Callback pattern is still the best. Maybe consider supporting something like: -// type X struct { -// Name string -// Ys []Y -// Ys chan <- Y -// Ys func(Y) -> call this function for each entry -// } -// - Consider adding a isZeroer interface { isZero() bool } -// It is used within isEmpty, for omitEmpty support. -// - Consider making Handle used AS-IS within the encoding/decoding session. -// This means that we don't cache Handle information within the (En|De)coder, -// except we really need it at Reset(...) -// - Consider adding math/big support -// - Consider reducing the size of the generated functions: -// Maybe use one loop, and put the conditionals in the loop. -// for ... { if cLen > 0 { if j == cLen { break } } else if dd.CheckBreak() { break } } +// PUNTED: +// - To make Handle comparable, make extHandle in BasicHandle a non-embedded pointer, +// and use overlay methods on *BasicHandle to call through to extHandle after initializing +// the "xh *extHandle" to point to a real slice. +// +// BEFORE EACH RELEASE: +// - Look through and fix padding for each type, to eliminate false sharing +// - critical shared objects that are read many times +// TypeInfos +// - pooled objects: +// decNaked, decNakedContainers, codecFner, typeInfoLoadArray, +// - small objects allocated independently, that we read/use much across threads: +// codecFn, typeInfo +// - Objects allocated independently and used a lot +// Decoder, Encoder, +// xxxHandle, xxxEncDriver, xxxDecDriver (xxx = json, msgpack, cbor, binc, simple) +// - In all above, arrange values modified together to be close to each other. +// +// For all of these, either ensure that they occupy full cache lines, +// or ensure that the things just past the cache line boundary are hardly read/written +// e.g. JsonHandle.RawBytesExt - which is copied into json(En|De)cDriver at init +// +// Occupying full cache lines means they occupy 8*N words (where N is an integer). +// Check this out by running: ./run.sh -z +// - look at those tagged ****, meaning they are not occupying full cache lines +// - look at those tagged <<<<, meaning they are larger than 32 words (something to watch) +// - Run "golint -min_confidence 0.81" diff --git a/vendor/github.com/ugorji/go/codec/README.md b/vendor/github.com/ugorji/go/codec/README.md index 91cb3a27b..50d65e550 100644 --- a/vendor/github.com/ugorji/go/codec/README.md +++ b/vendor/github.com/ugorji/go/codec/README.md @@ -15,17 +15,11 @@ To install: go get github.com/ugorji/go/codec -This package understands the `unsafe` tag, to allow using unsafe semantics: - - - When decoding into a struct, you need to read the field name as a string - so you can find the struct field it is mapped to. - Using `unsafe` will bypass the allocation and copying overhead of `[]byte->string` conversion. - -To use it, you must pass the `unsafe` tag during install: - -``` -go install -tags=unsafe github.com/ugorji/go/codec -``` +This package will carefully use 'unsafe' for performance reasons in specific places. +You can build without unsafe use by passing the safe or appengine tag +i.e. 'go install -tags=safe ...'. Note that unsafe is only supported for the last 3 +go sdk versions e.g. current go release is go 1.9, so we support unsafe use only from +go 1.7+ . This is because supporting unsafe requires knowledge of implementation details. Online documentation: http://godoc.org/github.com/ugorji/go/codec Detailed Usage/How-to Primer: http://ugorji.net/blog/go-codec-primer @@ -36,11 +30,15 @@ the standard library (ie json, xml, gob, etc). Rich Feature Set includes: - Simple but extremely powerful and feature-rich API + - Support for go1.4 and above, while selectively using newer APIs for later releases + - Excellent code coverage ( > 90% ) - Very High Performance. Our extensive benchmarks show us outperforming Gob, Json, Bson, etc by 2-4X. - - Multiple conversions: - Package coerces types where appropriate - e.g. decode an int in the stream into a float, etc. + - Careful selected use of 'unsafe' for targeted performance gains. + 100% mode exists where 'unsafe' is not used at all. + - Lock-free (sans mutex) concurrency for scaling to 100's of cores + - Coerce types where appropriate + e.g. decode an int in the stream into a float, decode numbers from formatted strings, etc - Corner Cases: Overflows, nil maps/slices, nil values in streams are handled correctly - Standard field renaming via tags @@ -49,10 +47,16 @@ Rich Feature Set includes: (struct, slice, map, primitives, pointers, interface{}, etc) - Extensions to support efficient encoding/decoding of any named types - Support encoding.(Binary|Text)(M|Unm)arshaler interfaces + - Support IsZero() bool to determine if a value is a zero value. + Analogous to time.Time.IsZero() bool. - Decoding without a schema (into a interface{}). Includes Options to configure what specific map or slice type to use when decoding an encoded list or map into a nil interface{} + - Mapping a non-interface type to an interface, so we can decode appropriately + into any interface type with a correctly configured non-interface value. - Encode a struct as an array, and decode struct from an array in the data stream + - Option to encode struct keys as numbers (instead of strings) + (to support structured streams with fields encoded as numeric codes) - Comprehensive support for anonymous fields - Fast (no-reflection) encoding/decoding of common maps and slices - Code-generation for faster performance. @@ -92,6 +96,27 @@ encoded as an empty map because it has no exported fields, while UUID would be encoded as a string. However, with extension support, you can encode any of these however you like. +## Custom Encoding and Decoding + +This package maintains symmetry in the encoding and decoding halfs. +We determine how to encode or decode by walking this decision tree + + - is type a codec.Selfer? + - is there an extension registered for the type? + - is format binary, and is type a encoding.BinaryMarshaler and BinaryUnmarshaler? + - is format specifically json, and is type a encoding/json.Marshaler and Unmarshaler? + - is format text-based, and type an encoding.TextMarshaler? + - else we use a pair of functions based on the "kind" of the type e.g. map, slice, int64, etc + +This symmetry is important to reduce chances of issues happening because the +encoding and decoding sides are out of sync e.g. decoded via very specific +encoding.TextUnmarshaler but encoded via kind-specific generalized mode. + +Consequently, if a type only defines one-half of the symmetry +(e.g. it implements UnmarshalJSON() but not MarshalJSON() ), +then that type doesn't satisfy the check and we will continue walking down the +decision tree. + ## RPC RPC Client and Server Codecs are implemented, so the codecs can be used @@ -146,3 +171,36 @@ Typical usage model: //OR rpcCodec := codec.MsgpackSpecRpc.ClientCodec(conn, h) client := rpc.NewClientWithCodec(rpcCodec) +## Running Tests + +To run tests, use the following: + + go test + +To run the full suite of tests, use the following: + + go test -tags alltests -run Suite + +You can run the tag 'safe' to run tests or build in safe mode. e.g. + + go test -tags safe -run Json + go test -tags "alltests safe" -run Suite + +## Running Benchmarks + +Please see http://github.com/ugorji/go-codec-bench . + +## Caveats + +Struct fields matching the following are ignored during encoding and decoding + + - struct tag value set to - + - func, complex numbers, unsafe pointers + - unexported and not embedded + - unexported and embedded and not struct kind + - unexported and embedded pointers (from go1.10) + +Every other field in a struct will be encoded/decoded. + +Embedded fields are encoded as if they exist in the top-level struct, +with some caveats. See Encode documentation. diff --git a/vendor/github.com/ugorji/go/codec/binc.go b/vendor/github.com/ugorji/go/codec/binc.go index 618c51505..39fd7d4a0 100644 --- a/vendor/github.com/ugorji/go/codec/binc.go +++ b/vendor/github.com/ugorji/go/codec/binc.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -57,37 +57,31 @@ const ( type bincEncDriver struct { e *Encoder + h *BincHandle w encWriter m map[string]uint16 // symbols - b [scratchByteArrayLen]byte - s uint16 // symbols sequencer - encNoSeparator -} - -func (e *bincEncDriver) IsBuiltinType(rt uintptr) bool { - return rt == timeTypId -} - -func (e *bincEncDriver) EncodeBuiltin(rt uintptr, v interface{}) { - if rt == timeTypId { - var bs []byte - switch x := v.(type) { - case time.Time: - bs = encodeTime(x) - case *time.Time: - bs = encodeTime(*x) - default: - e.e.errorf("binc error encoding builtin: expect time.Time, received %T", v) - } - e.w.writen1(bincVdTimestamp<<4 | uint8(len(bs))) - e.w.writeb(bs) - } + b [16]byte // scratch, used for encoding numbers - bigendian style + s uint16 // symbols sequencer + // c containerState + encDriverTrackContainerWriter + noBuiltInTypes + // encNoSeparator } func (e *bincEncDriver) EncodeNil() { e.w.writen1(bincVdSpecial<<4 | bincSpNil) } +func (e *bincEncDriver) EncodeTime(t time.Time) { + if t.IsZero() { + e.EncodeNil() + } else { + bs := bincEncodeTime(t) + e.w.writen1(bincVdTimestamp<<4 | uint8(len(bs))) + e.w.writeb(bs) + } +} + func (e *bincEncDriver) EncodeBool(b bool) { if b { e.w.writen1(bincVdSpecial<<4 | bincSpTrue) @@ -195,15 +189,21 @@ func (e *bincEncDriver) encodeExtPreamble(xtag byte, length int) { e.w.writen1(xtag) } -func (e *bincEncDriver) EncodeArrayStart(length int) { +func (e *bincEncDriver) WriteArrayStart(length int) { e.encLen(bincVdArray<<4, uint64(length)) + e.c = containerArrayStart } -func (e *bincEncDriver) EncodeMapStart(length int) { +func (e *bincEncDriver) WriteMapStart(length int) { e.encLen(bincVdMap<<4, uint64(length)) + e.c = containerMapStart } func (e *bincEncDriver) EncodeString(c charEncoding, v string) { + if e.c == containerMapKey && c == cUTF8 && (e.h.AsSymbols == 0 || e.h.AsSymbols == 1) { + e.EncodeSymbol(v) + return + } l := uint64(len(v)) e.encBytesLen(c, l) if l > 0 { @@ -213,7 +213,7 @@ func (e *bincEncDriver) EncodeString(c charEncoding, v string) { func (e *bincEncDriver) EncodeSymbol(v string) { // if WriteSymbolsNoRefs { - // e.encodeString(c_UTF8, v) + // e.encodeString(cUTF8, v) // return // } @@ -223,10 +223,10 @@ func (e *bincEncDriver) EncodeSymbol(v string) { l := len(v) if l == 0 { - e.encBytesLen(c_UTF8, 0) + e.encBytesLen(cUTF8, 0) return } else if l == 1 { - e.encBytesLen(c_UTF8, 1) + e.encBytesLen(cUTF8, 1) e.w.writen1(v[0]) return } @@ -276,6 +276,10 @@ func (e *bincEncDriver) EncodeSymbol(v string) { } func (e *bincEncDriver) EncodeStringBytes(c charEncoding, v []byte) { + if v == nil { + e.EncodeNil() + return + } l := uint64(len(v)) e.encBytesLen(c, l) if l > 0 { @@ -285,7 +289,7 @@ func (e *bincEncDriver) EncodeStringBytes(c charEncoding, v []byte) { func (e *bincEncDriver) encBytesLen(c charEncoding, length uint64) { //TODO: support bincUnicodeOther (for now, just use string or bytearray) - if c == c_RAW { + if c == cRAW { e.encLen(bincVdByteArray<<4, length) } else { e.encLen(bincVdString<<4, length) @@ -324,6 +328,9 @@ type bincDecSymbol struct { } type bincDecDriver struct { + decDriverNoopContainerReader + noBuiltInTypes + d *Decoder h *BincHandle r decReader @@ -332,13 +339,15 @@ type bincDecDriver struct { bd byte vd byte vs byte - noStreamingCodec - decNoSeparator - b [scratchByteArrayLen]byte - + _ [3]byte // padding // linear searching on this slice is ok, // because we typically expect < 32 symbols in each stream. s []bincDecSymbol + + // noStreamingCodec + // decNoSeparator + + b [8 * 8]byte // scratch } func (d *bincDecDriver) readNextBd() { @@ -369,9 +378,10 @@ func (d *bincDecDriver) ContainerType() (vt valueType) { return valueTypeArray } else if d.vd == bincVdMap { return valueTypeMap - } else { - // d.d.errorf("isContainerType: unsupported parameter: %v", vt) } + // else { + // d.d.errorf("isContainerType: unsupported parameter: %v", vt) + // } return valueTypeUnset } @@ -386,27 +396,24 @@ func (d *bincDecDriver) TryDecodeAsNil() bool { return false } -func (d *bincDecDriver) IsBuiltinType(rt uintptr) bool { - return rt == timeTypId -} - -func (d *bincDecDriver) DecodeBuiltin(rt uintptr, v interface{}) { +func (d *bincDecDriver) DecodeTime() (t time.Time) { if !d.bdRead { d.readNextBd() } - if rt == timeTypId { - if d.vd != bincVdTimestamp { - d.d.errorf("Invalid d.vd. Expecting 0x%x. Received: 0x%x", bincVdTimestamp, d.vd) - return - } - tt, err := decodeTime(d.r.readx(int(d.vs))) - if err != nil { - panic(err) - } - var vt *time.Time = v.(*time.Time) - *vt = tt + if d.bd == bincVdSpecial<<4|bincSpNil { d.bdRead = false + return } + if d.vd != bincVdTimestamp { + d.d.errorf("Invalid d.vd. Expecting 0x%x. Received: 0x%x", bincVdTimestamp, d.vd) + return + } + t, err := bincDecodeTime(d.r.readx(int(d.vs))) + if err != nil { + panic(err) + } + d.bdRead = false + return } func (d *bincDecDriver) decFloatPre(vs, defaultLen byte) { @@ -495,45 +502,33 @@ func (d *bincDecDriver) decCheckInteger() (ui uint64, neg bool) { return } } else { - d.d.errorf("number can only be decoded from uint or int values. d.bd: 0x%x, d.vd: 0x%x", d.bd, d.vd) + d.d.errorf("integer can only be decoded from int/uint. d.bd: 0x%x, d.vd: 0x%x", d.bd, d.vd) return } return } -func (d *bincDecDriver) DecodeInt(bitsize uint8) (i int64) { +func (d *bincDecDriver) DecodeInt64() (i int64) { ui, neg := d.decCheckInteger() - i, overflow := chkOvf.SignedInt(ui) - if overflow { - d.d.errorf("simple: overflow converting %v to signed integer", ui) - return - } + i = chkOvf.SignedIntV(ui) if neg { i = -i } - if chkOvf.Int(i, bitsize) { - d.d.errorf("binc: overflow integer: %v", i) - return - } d.bdRead = false return } -func (d *bincDecDriver) DecodeUint(bitsize uint8) (ui uint64) { +func (d *bincDecDriver) DecodeUint64() (ui uint64) { ui, neg := d.decCheckInteger() if neg { d.d.errorf("Assigning negative signed value to unsigned type") return } - if chkOvf.Uint(ui, bitsize) { - d.d.errorf("binc: overflow integer: %v", ui) - return - } d.bdRead = false return } -func (d *bincDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) { +func (d *bincDecDriver) DecodeFloat64() (f float64) { if !d.bdRead { d.readNextBd() } @@ -555,11 +550,7 @@ func (d *bincDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) { } else if vd == bincVdFloat { f = d.decFloat() } else { - f = float64(d.DecodeInt(64)) - } - if chkOverflow32 && chkOvf.Float32(f) { - d.d.errorf("binc: float32 overflow: %v", f) - return + f = float64(d.DecodeInt64()) } d.bdRead = false return @@ -631,7 +622,8 @@ func (d *bincDecDriver) decLenNumber() (v uint64) { return } -func (d *bincDecDriver) decStringAndBytes(bs []byte, withString, zerocopy bool) (bs2 []byte, s string) { +func (d *bincDecDriver) decStringAndBytes(bs []byte, withString, zerocopy bool) ( + bs2 []byte, s string) { if !d.bdRead { d.readNextBd() } @@ -639,7 +631,7 @@ func (d *bincDecDriver) decStringAndBytes(bs []byte, withString, zerocopy bool) d.bdRead = false return } - var slen int = -1 + var slen = -1 // var ok bool switch d.vd { case bincVdString, bincVdByteArray: @@ -728,11 +720,12 @@ func (d *bincDecDriver) DecodeString() (s string) { return } -func (d *bincDecDriver) DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut []byte) { - if isstring { - bsOut, _ = d.decStringAndBytes(bs, false, zerocopy) - return - } +func (d *bincDecDriver) DecodeStringAsBytes() (s []byte) { + s, _ = d.decStringAndBytes(d.b[:], false, true) + return +} + +func (d *bincDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { if !d.bdRead { d.readNextBd() } @@ -740,6 +733,11 @@ func (d *bincDecDriver) DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut [ d.bdRead = false return nil } + // check if an "array" of uint8's (see ContainerType for how to infer if an array) + if d.vd == bincVdArray { + bsOut, _ = fastpathTV.DecSliceUint8V(bs, true, d.d) + return + } var clen int if d.vd == bincVdString || d.vd == bincVdByteArray { clen = d.decLen() @@ -789,7 +787,7 @@ func (d *bincDecDriver) decodeExtV(verifyTag bool, tag byte) (xtag byte, xbs []b } xbs = d.r.readx(l) } else if d.vd == bincVdByteArray { - xbs = d.DecodeBytes(nil, false, true) + xbs = d.DecodeBytes(nil, true) } else { d.d.errorf("Invalid d.vd for extensions (Expecting extensions or byte array). Got: 0x%x", d.vd) return @@ -803,7 +801,7 @@ func (d *bincDecDriver) DecodeNaked() { d.readNextBd() } - n := &d.d.n + n := d.d.n var decodeFurther bool switch d.vd { @@ -858,10 +856,10 @@ func (d *bincDecDriver) DecodeNaked() { n.s = d.DecodeString() case bincVdByteArray: n.v = valueTypeBytes - n.l = d.DecodeBytes(nil, false, false) + n.l = d.DecodeBytes(nil, false) case bincVdTimestamp: - n.v = valueTypeTimestamp - tt, err := decodeTime(d.r.readx(int(d.vs))) + n.v = valueTypeTime + tt, err := bincDecodeTime(d.r.readx(int(d.vs))) if err != nil { panic(err) } @@ -908,14 +906,41 @@ func (d *bincDecDriver) DecodeNaked() { type BincHandle struct { BasicHandle binaryEncodingType + noElemSeparators + + // AsSymbols defines what should be encoded as symbols. + // + // Encoding as symbols can reduce the encoded size significantly. + // + // However, during decoding, each string to be encoded as a symbol must + // be checked to see if it has been seen before. Consequently, encoding time + // will increase if using symbols, because string comparisons has a clear cost. + // + // Values: + // - 0: default: library uses best judgement + // - 1: use symbols + // - 2: do not use symbols + AsSymbols uint8 + + // AsSymbols: may later on introduce more options ... + // - m: map keys + // - s: struct fields + // - n: none + // - a: all: same as m, s, ... + + _ [1]uint64 // padding } +// Name returns the name of the handle: binc +func (h *BincHandle) Name() string { return "binc" } + +// SetBytesExt sets an extension func (h *BincHandle) SetBytesExt(rt reflect.Type, tag uint64, ext BytesExt) (err error) { - return h.SetExt(rt, tag, &setExtWrapper{b: ext}) + return h.SetExt(rt, tag, &extWrapper{ext, interfaceExtFailer{}}) } func (h *BincHandle) newEncDriver(e *Encoder) encDriver { - return &bincEncDriver{e: e, w: e.w} + return &bincEncDriver{e: e, h: h, w: e.w} } func (h *BincHandle) newDecDriver(d *Decoder) decDriver { @@ -925,6 +950,7 @@ func (h *BincHandle) newDecDriver(d *Decoder) decDriver { func (e *bincEncDriver) reset() { e.w = e.e.w e.s = 0 + e.c = 0 e.m = nil } @@ -934,5 +960,165 @@ func (d *bincDecDriver) reset() { d.bd, d.bdRead, d.vd, d.vs = 0, false, 0, 0 } +// var timeDigits = [...]byte{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'} + +// EncodeTime encodes a time.Time as a []byte, including +// information on the instant in time and UTC offset. +// +// Format Description +// +// A timestamp is composed of 3 components: +// +// - secs: signed integer representing seconds since unix epoch +// - nsces: unsigned integer representing fractional seconds as a +// nanosecond offset within secs, in the range 0 <= nsecs < 1e9 +// - tz: signed integer representing timezone offset in minutes east of UTC, +// and a dst (daylight savings time) flag +// +// When encoding a timestamp, the first byte is the descriptor, which +// defines which components are encoded and how many bytes are used to +// encode secs and nsecs components. *If secs/nsecs is 0 or tz is UTC, it +// is not encoded in the byte array explicitly*. +// +// Descriptor 8 bits are of the form `A B C DDD EE`: +// A: Is secs component encoded? 1 = true +// B: Is nsecs component encoded? 1 = true +// C: Is tz component encoded? 1 = true +// DDD: Number of extra bytes for secs (range 0-7). +// If A = 1, secs encoded in DDD+1 bytes. +// If A = 0, secs is not encoded, and is assumed to be 0. +// If A = 1, then we need at least 1 byte to encode secs. +// DDD says the number of extra bytes beyond that 1. +// E.g. if DDD=0, then secs is represented in 1 byte. +// if DDD=2, then secs is represented in 3 bytes. +// EE: Number of extra bytes for nsecs (range 0-3). +// If B = 1, nsecs encoded in EE+1 bytes (similar to secs/DDD above) +// +// Following the descriptor bytes, subsequent bytes are: +// +// secs component encoded in `DDD + 1` bytes (if A == 1) +// nsecs component encoded in `EE + 1` bytes (if B == 1) +// tz component encoded in 2 bytes (if C == 1) +// +// secs and nsecs components are integers encoded in a BigEndian +// 2-complement encoding format. +// +// tz component is encoded as 2 bytes (16 bits). Most significant bit 15 to +// Least significant bit 0 are described below: +// +// Timezone offset has a range of -12:00 to +14:00 (ie -720 to +840 minutes). +// Bit 15 = have\_dst: set to 1 if we set the dst flag. +// Bit 14 = dst\_on: set to 1 if dst is in effect at the time, or 0 if not. +// Bits 13..0 = timezone offset in minutes. It is a signed integer in Big Endian format. +// +func bincEncodeTime(t time.Time) []byte { + //t := rv.Interface().(time.Time) + tsecs, tnsecs := t.Unix(), t.Nanosecond() + var ( + bd byte + btmp [8]byte + bs [16]byte + i int = 1 + ) + l := t.Location() + if l == time.UTC { + l = nil + } + if tsecs != 0 { + bd = bd | 0x80 + bigen.PutUint64(btmp[:], uint64(tsecs)) + f := pruneSignExt(btmp[:], tsecs >= 0) + bd = bd | (byte(7-f) << 2) + copy(bs[i:], btmp[f:]) + i = i + (8 - f) + } + if tnsecs != 0 { + bd = bd | 0x40 + bigen.PutUint32(btmp[:4], uint32(tnsecs)) + f := pruneSignExt(btmp[:4], true) + bd = bd | byte(3-f) + copy(bs[i:], btmp[f:4]) + i = i + (4 - f) + } + if l != nil { + bd = bd | 0x20 + // Note that Go Libs do not give access to dst flag. + _, zoneOffset := t.Zone() + //zoneName, zoneOffset := t.Zone() + zoneOffset /= 60 + z := uint16(zoneOffset) + bigen.PutUint16(btmp[:2], z) + // clear dst flags + bs[i] = btmp[0] & 0x3f + bs[i+1] = btmp[1] + i = i + 2 + } + bs[0] = bd + return bs[0:i] +} + +// bincDecodeTime decodes a []byte into a time.Time. +func bincDecodeTime(bs []byte) (tt time.Time, err error) { + bd := bs[0] + var ( + tsec int64 + tnsec uint32 + tz uint16 + i byte = 1 + i2 byte + n byte + ) + if bd&(1<<7) != 0 { + var btmp [8]byte + n = ((bd >> 2) & 0x7) + 1 + i2 = i + n + copy(btmp[8-n:], bs[i:i2]) + //if first bit of bs[i] is set, then fill btmp[0..8-n] with 0xff (ie sign extend it) + if bs[i]&(1<<7) != 0 { + copy(btmp[0:8-n], bsAll0xff) + //for j,k := byte(0), 8-n; j < k; j++ { btmp[j] = 0xff } + } + i = i2 + tsec = int64(bigen.Uint64(btmp[:])) + } + if bd&(1<<6) != 0 { + var btmp [4]byte + n = (bd & 0x3) + 1 + i2 = i + n + copy(btmp[4-n:], bs[i:i2]) + i = i2 + tnsec = bigen.Uint32(btmp[:]) + } + if bd&(1<<5) == 0 { + tt = time.Unix(tsec, int64(tnsec)).UTC() + return + } + // In stdlib time.Parse, when a date is parsed without a zone name, it uses "" as zone name. + // However, we need name here, so it can be shown when time is printed. + // Zone name is in form: UTC-08:00. + // Note that Go Libs do not give access to dst flag, so we ignore dst bits + + i2 = i + 2 + tz = bigen.Uint16(bs[i:i2]) + // i = i2 + // sign extend sign bit into top 2 MSB (which were dst bits): + if tz&(1<<13) == 0 { // positive + tz = tz & 0x3fff //clear 2 MSBs: dst bits + } else { // negative + tz = tz | 0xc000 //set 2 MSBs: dst bits + } + tzint := int16(tz) + if tzint == 0 { + tt = time.Unix(tsec, int64(tnsec)).UTC() + } else { + // For Go Time, do not use a descriptive timezone. + // It's unnecessary, and makes it harder to do a reflect.DeepEqual. + // The Offset already tells what the offset should be, if not on UTC and unknown zone name. + // var zoneName = timeLocUTCName(tzint) + tt = time.Unix(tsec, int64(tnsec)).In(time.FixedZone("", int(tzint)*60)) + } + return +} + var _ decDriver = (*bincDecDriver)(nil) var _ encDriver = (*bincEncDriver)(nil) diff --git a/vendor/github.com/ugorji/go/codec/cbor.go b/vendor/github.com/ugorji/go/codec/cbor.go index 4c72caffb..be01e19e7 100644 --- a/vendor/github.com/ugorji/go/codec/cbor.go +++ b/vendor/github.com/ugorji/go/codec/cbor.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -6,6 +6,7 @@ package codec import ( "math" "reflect" + "time" ) const ( @@ -38,6 +39,8 @@ const ( cborBdBreak = 0xff ) +// These define some in-stream descriptors for +// manual encoding e.g. when doing explicit indefinite-length const ( CborStreamBytes byte = 0x5f CborStreamString = 0x7f @@ -61,11 +64,13 @@ const ( type cborEncDriver struct { noBuiltInTypes - encNoSeparator + encDriverNoopContainerWriter + // encNoSeparator e *Encoder w encWriter h *CborHandle x [8]byte + _ [3]uint64 // padding } func (e *cborEncDriver) EncodeNil() { @@ -123,6 +128,24 @@ func (e *cborEncDriver) encLen(bd byte, length int) { e.encUint(uint64(length), bd) } +func (e *cborEncDriver) EncodeTime(t time.Time) { + if t.IsZero() { + e.EncodeNil() + } else if e.h.TimeRFC3339 { + e.encUint(0, cborBaseTag) + e.EncodeString(cUTF8, t.Format(time.RFC3339Nano)) + } else { + e.encUint(1, cborBaseTag) + t = t.UTC().Round(time.Microsecond) + sec, nsec := t.Unix(), uint64(t.Nanosecond()) + if nsec == 0 { + e.EncodeInt(sec) + } else { + e.EncodeFloat64(float64(sec) + float64(nsec)/1e9) + } + } +} + func (e *cborEncDriver) EncodeExt(rv interface{}, xtag uint64, ext Ext, en *Encoder) { e.encUint(uint64(xtag), cborBaseTag) if v := ext.ConvertExt(rv); v == nil { @@ -134,53 +157,103 @@ func (e *cborEncDriver) EncodeExt(rv interface{}, xtag uint64, ext Ext, en *Enco func (e *cborEncDriver) EncodeRawExt(re *RawExt, en *Encoder) { e.encUint(uint64(re.Tag), cborBaseTag) - if re.Data != nil { + if false && re.Data != nil { en.encode(re.Data) - } else if re.Value == nil { - e.EncodeNil() - } else { + } else if re.Value != nil { en.encode(re.Value) + } else { + e.EncodeNil() } } -func (e *cborEncDriver) EncodeArrayStart(length int) { - e.encLen(cborBaseArray, length) +func (e *cborEncDriver) WriteArrayStart(length int) { + if e.h.IndefiniteLength { + e.w.writen1(cborBdIndefiniteArray) + } else { + e.encLen(cborBaseArray, length) + } } -func (e *cborEncDriver) EncodeMapStart(length int) { - e.encLen(cborBaseMap, length) +func (e *cborEncDriver) WriteMapStart(length int) { + if e.h.IndefiniteLength { + e.w.writen1(cborBdIndefiniteMap) + } else { + e.encLen(cborBaseMap, length) + } +} + +func (e *cborEncDriver) WriteMapEnd() { + if e.h.IndefiniteLength { + e.w.writen1(cborBdBreak) + } +} + +func (e *cborEncDriver) WriteArrayEnd() { + if e.h.IndefiniteLength { + e.w.writen1(cborBdBreak) + } } func (e *cborEncDriver) EncodeString(c charEncoding, v string) { - e.encLen(cborBaseString, len(v)) - e.w.writestr(v) -} - -func (e *cborEncDriver) EncodeSymbol(v string) { - e.EncodeString(c_UTF8, v) + e.encStringBytesS(cborBaseString, v) } func (e *cborEncDriver) EncodeStringBytes(c charEncoding, v []byte) { - if c == c_RAW { - e.encLen(cborBaseBytes, len(v)) + if v == nil { + e.EncodeNil() + } else if c == cRAW { + e.encStringBytesS(cborBaseBytes, stringView(v)) } else { - e.encLen(cborBaseString, len(v)) + e.encStringBytesS(cborBaseString, stringView(v)) + } +} + +func (e *cborEncDriver) encStringBytesS(bb byte, v string) { + if e.h.IndefiniteLength { + if bb == cborBaseBytes { + e.w.writen1(cborBdIndefiniteBytes) + } else { + e.w.writen1(cborBdIndefiniteString) + } + blen := len(v) / 4 + if blen == 0 { + blen = 64 + } else if blen > 1024 { + blen = 1024 + } + for i := 0; i < len(v); { + var v2 string + i2 := i + blen + if i2 < len(v) { + v2 = v[i:i2] + } else { + v2 = v[i:] + } + e.encLen(bb, len(v2)) + e.w.writestr(v2) + i = i2 + } + e.w.writen1(cborBdBreak) + } else { + e.encLen(bb, len(v)) + e.w.writestr(v) } - e.w.writeb(v) } // ---------------------- type cborDecDriver struct { - d *Decoder - h *CborHandle - r decReader - b [scratchByteArrayLen]byte + d *Decoder + h *CborHandle + r decReader + // b [scratchByteArrayLen]byte br bool // bytes reader bdRead bool bd byte noBuiltInTypes - decNoSeparator + // decNoSeparator + decDriverNoopContainerReader + _ [3]uint64 // padding } func (d *cborDecDriver) readNextBd() { @@ -209,9 +282,10 @@ func (d *cborDecDriver) ContainerType() (vt valueType) { return valueTypeArray } else if d.bd == cborBdIndefiniteMap || (d.bd >= cborBaseMap && d.bd < cborBaseTag) { return valueTypeMap - } else { - // d.d.errorf("isContainerType: unsupported parameter: %v", vt) } + // else { + // d.d.errorf("isContainerType: unsupported parameter: %v", vt) + // } return valueTypeUnset } @@ -274,46 +348,30 @@ func (d *cborDecDriver) decCheckInteger() (neg bool) { return } -func (d *cborDecDriver) DecodeInt(bitsize uint8) (i int64) { +func (d *cborDecDriver) DecodeInt64() (i int64) { neg := d.decCheckInteger() ui := d.decUint() // check if this number can be converted to an int without overflow - var overflow bool if neg { - if i, overflow = chkOvf.SignedInt(ui + 1); overflow { - d.d.errorf("cbor: overflow converting %v to signed integer", ui+1) - return - } - i = -i + i = -(chkOvf.SignedIntV(ui + 1)) } else { - if i, overflow = chkOvf.SignedInt(ui); overflow { - d.d.errorf("cbor: overflow converting %v to signed integer", ui) - return - } - } - if chkOvf.Int(i, bitsize) { - d.d.errorf("cbor: overflow integer: %v", i) - return + i = chkOvf.SignedIntV(ui) } d.bdRead = false return } -func (d *cborDecDriver) DecodeUint(bitsize uint8) (ui uint64) { +func (d *cborDecDriver) DecodeUint64() (ui uint64) { if d.decCheckInteger() { d.d.errorf("Assigning negative signed value to unsigned type") return } ui = d.decUint() - if chkOvf.Uint(ui, bitsize) { - d.d.errorf("cbor: overflow integer: %v", ui) - return - } d.bdRead = false return } -func (d *cborDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) { +func (d *cborDecDriver) DecodeFloat64() (f float64) { if !d.bdRead { d.readNextBd() } @@ -324,15 +382,11 @@ func (d *cborDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) { } else if bd == cborBdFloat64 { f = math.Float64frombits(bigen.Uint64(d.r.readx(8))) } else if bd >= cborBaseUint && bd < cborBaseBytes { - f = float64(d.DecodeInt(64)) + f = float64(d.DecodeInt64()) } else { d.d.errorf("Float only valid from float16/32/64: Invalid descriptor: %v", bd) return } - if chkOverflow32 && chkOvf.Float32(f) { - d.d.errorf("cbor: float32 overflow: %v", f) - return - } d.bdRead = false return } @@ -386,7 +440,8 @@ func (d *cborDecDriver) decAppendIndefiniteBytes(bs []byte) []byte { break } if major := d.bd >> 5; major != cborMajorBytes && major != cborMajorText { - d.d.errorf("cbor: expect bytes or string major type in indefinite string/bytes; got: %v, byte: %v", major, d.bd) + d.d.errorf("expect bytes/string major type in indefinite string/bytes;"+ + " got: %v, byte: %v", major, d.bd) return nil } n := d.decLen() @@ -407,7 +462,7 @@ func (d *cborDecDriver) decAppendIndefiniteBytes(bs []byte) []byte { return bs } -func (d *cborDecDriver) DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut []byte) { +func (d *cborDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { if !d.bdRead { d.readNextBd() } @@ -416,25 +471,84 @@ func (d *cborDecDriver) DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut [ return nil } if d.bd == cborBdIndefiniteBytes || d.bd == cborBdIndefiniteString { + d.bdRead = false if bs == nil { - return d.decAppendIndefiniteBytes(nil) + if zerocopy { + return d.decAppendIndefiniteBytes(d.d.b[:0]) + } + return d.decAppendIndefiniteBytes(zeroByteSlice) } return d.decAppendIndefiniteBytes(bs[:0]) } + // check if an "array" of uint8's (see ContainerType for how to infer if an array) + if d.bd == cborBdIndefiniteArray || (d.bd >= cborBaseArray && d.bd < cborBaseMap) { + bsOut, _ = fastpathTV.DecSliceUint8V(bs, true, d.d) + return + } clen := d.decLen() d.bdRead = false if zerocopy { if d.br { return d.r.readx(clen) } else if len(bs) == 0 { - bs = d.b[:] + bs = d.d.b[:] } } - return decByteSlice(d.r, clen, d.d.h.MaxInitLen, bs) + return decByteSlice(d.r, clen, d.h.MaxInitLen, bs) } func (d *cborDecDriver) DecodeString() (s string) { - return string(d.DecodeBytes(d.b[:], true, true)) + return string(d.DecodeBytes(d.d.b[:], true)) +} + +func (d *cborDecDriver) DecodeStringAsBytes() (s []byte) { + return d.DecodeBytes(d.d.b[:], true) +} + +func (d *cborDecDriver) DecodeTime() (t time.Time) { + if !d.bdRead { + d.readNextBd() + } + if d.bd == cborBdNil || d.bd == cborBdUndefined { + d.bdRead = false + return + } + xtag := d.decUint() + d.bdRead = false + return d.decodeTime(xtag) +} + +func (d *cborDecDriver) decodeTime(xtag uint64) (t time.Time) { + if !d.bdRead { + d.readNextBd() + } + switch xtag { + case 0: + var err error + if t, err = time.Parse(time.RFC3339, stringView(d.DecodeStringAsBytes())); err != nil { + d.d.errorv(err) + } + case 1: + // decode an int64 or a float, and infer time.Time from there. + // for floats, round to microseconds, as that is what is guaranteed to fit well. + switch { + case d.bd == cborBdFloat16, d.bd == cborBdFloat32: + f1, f2 := math.Modf(d.DecodeFloat64()) + t = time.Unix(int64(f1), int64(f2*1e9)) + case d.bd == cborBdFloat64: + f1, f2 := math.Modf(d.DecodeFloat64()) + t = time.Unix(int64(f1), int64(f2*1e9)) + case d.bd >= cborBaseUint && d.bd < cborBaseNegInt, + d.bd >= cborBaseNegInt && d.bd < cborBaseBytes: + t = time.Unix(d.DecodeInt64(), 0) + default: + d.d.errorf("time.Time can only be decoded from a number (or RFC3339 string)") + } + default: + d.d.errorf("invalid tag for time.Time - expecting 0 or 1, got 0x%x", xtag) + } + t = t.UTC().Round(time.Microsecond) + return } func (d *cborDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxtag uint64) { @@ -465,7 +579,7 @@ func (d *cborDecDriver) DecodeNaked() { d.readNextBd() } - n := &d.d.n + n := d.d.n var decodeFurther bool switch d.bd { @@ -477,15 +591,12 @@ func (d *cborDecDriver) DecodeNaked() { case cborBdTrue: n.v = valueTypeBool n.b = true - case cborBdFloat16, cborBdFloat32: + case cborBdFloat16, cborBdFloat32, cborBdFloat64: n.v = valueTypeFloat - n.f = d.DecodeFloat(true) - case cborBdFloat64: - n.v = valueTypeFloat - n.f = d.DecodeFloat(false) + n.f = d.DecodeFloat64() case cborBdIndefiniteBytes: n.v = valueTypeBytes - n.l = d.DecodeBytes(nil, false, false) + n.l = d.DecodeBytes(nil, false) case cborBdIndefiniteString: n.v = valueTypeString n.s = d.DecodeString() @@ -500,17 +611,17 @@ func (d *cborDecDriver) DecodeNaked() { case d.bd >= cborBaseUint && d.bd < cborBaseNegInt: if d.h.SignedInteger { n.v = valueTypeInt - n.i = d.DecodeInt(64) + n.i = d.DecodeInt64() } else { n.v = valueTypeUint - n.u = d.DecodeUint(64) + n.u = d.DecodeUint64() } case d.bd >= cborBaseNegInt && d.bd < cborBaseBytes: n.v = valueTypeInt - n.i = d.DecodeInt(64) + n.i = d.DecodeInt64() case d.bd >= cborBaseBytes && d.bd < cborBaseString: n.v = valueTypeBytes - n.l = d.DecodeBytes(nil, false, false) + n.l = d.DecodeBytes(nil, false) case d.bd >= cborBaseString && d.bd < cborBaseArray: n.v = valueTypeString n.s = d.DecodeString() @@ -524,6 +635,11 @@ func (d *cborDecDriver) DecodeNaked() { n.v = valueTypeExt n.u = d.decUint() n.l = nil + if n.u == 0 || n.u == 1 { + d.bdRead = false + n.v = valueTypeTime + n.t = d.decodeTime(n.u) + } // d.bdRead = false // d.d.decode(&re.Value) // handled by decode itself. // decodeFurther = true @@ -554,30 +670,29 @@ func (d *cborDecDriver) DecodeNaked() { // // None of the optional extensions (with tags) defined in the spec are supported out-of-the-box. // Users can implement them as needed (using SetExt), including spec-documented ones: -// - timestamp, BigNum, BigFloat, Decimals, Encoded Text (e.g. URL, regexp, base64, MIME Message), etc. -// -// To encode with indefinite lengths (streaming), users will use -// (Must)Encode methods of *Encoder, along with writing CborStreamXXX constants. -// -// For example, to encode "one-byte" as an indefinite length string: -// var buf bytes.Buffer -// e := NewEncoder(&buf, new(CborHandle)) -// buf.WriteByte(CborStreamString) -// e.MustEncode("one-") -// e.MustEncode("byte") -// buf.WriteByte(CborStreamBreak) -// encodedBytes := buf.Bytes() -// var vv interface{} -// NewDecoderBytes(buf.Bytes(), new(CborHandle)).MustDecode(&vv) -// // Now, vv contains the same string "one-byte" -// +// - timestamp, BigNum, BigFloat, Decimals, +// - Encoded Text (e.g. URL, regexp, base64, MIME Message), etc. type CborHandle struct { binaryEncodingType + noElemSeparators BasicHandle + + // IndefiniteLength=true, means that we encode using indefinitelength + IndefiniteLength bool + + // TimeRFC3339 says to encode time.Time using RFC3339 format. + // If unset, we encode time.Time using seconds past epoch. + TimeRFC3339 bool + + _ [1]uint64 // padding } +// Name returns the name of the handle: cbor +func (h *CborHandle) Name() string { return "cbor" } + +// SetInterfaceExt sets an extension func (h *CborHandle) SetInterfaceExt(rt reflect.Type, tag uint64, ext InterfaceExt) (err error) { - return h.SetExt(rt, tag, &setExtWrapper{i: ext}) + return h.SetExt(rt, tag, &extWrapper{bytesExtFailer{}, ext}) } func (h *CborHandle) newEncDriver(e *Encoder) encDriver { diff --git a/vendor/github.com/ugorji/go/codec/cbor_test.go b/vendor/github.com/ugorji/go/codec/cbor_test.go index 205dffa7d..611ddffd3 100644 --- a/vendor/github.com/ugorji/go/codec/cbor_test.go +++ b/vendor/github.com/ugorji/go/codec/cbor_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -97,7 +97,7 @@ type testCborGolden struct { } // Some tests are skipped because they include numbers outside the range of int64/uint64 -func doTestCborGoldens(t *testing.T) { +func TestCborGoldens(t *testing.T) { oldMapType := testCborH.MapType defer func() { testCborH.MapType = oldMapType @@ -200,6 +200,31 @@ func testCborError(t *testing.T, i int, v0, v1 interface{}, err error, equal *bo // fmt.Printf("%v testCborError passed (checks passed)\n", i) } -func TestCborGoldens(t *testing.T) { - doTestCborGoldens(t) +func TestCborHalfFloat(t *testing.T) { + m := map[uint16]float64{ + // using examples from + // https://en.wikipedia.org/wiki/Half-precision_floating-point_format + 0x3c00: 1, + 0x3c01: 1 + math.Pow(2, -10), + 0xc000: -2, + 0x7bff: 65504, + 0x0400: math.Pow(2, -14), + 0x03ff: math.Pow(2, -14) - math.Pow(2, -24), + 0x0001: math.Pow(2, -24), + 0x0000: 0, + 0x8000: -0.0, + } + var ba [3]byte + ba[0] = cborBdFloat16 + var res float64 + for k, v := range m { + res = 0 + bigen.PutUint16(ba[1:], k) + testUnmarshalErr(&res, ba[:3], testCborH, t, "-") + if res == v { + logT(t, "equal floats: from %x %b, %v", k, k, v) + } else { + failT(t, "unequal floats: from %x %b, %v != %v", k, k, res, v) + } + } } diff --git a/vendor/github.com/ugorji/go/codec/codec_test.go b/vendor/github.com/ugorji/go/codec/codec_test.go index b05d19463..22e1e3a65 100644 --- a/vendor/github.com/ugorji/go/codec/codec_test.go +++ b/vendor/github.com/ugorji/go/codec/codec_test.go @@ -1,28 +1,14 @@ -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec -// Test works by using a slice of interfaces. -// It can test for encoding/decoding into/from a nil interface{} -// or passing the object to encode/decode into. -// -// There are basically 2 main tests here. -// First test internally encodes and decodes things and verifies that -// the artifact was as expected. -// Second test will use python msgpack to create a bunch of golden files, -// read those files, and compare them to what it should be. It then -// writes those files back out and compares the byte streams. -// -// Taken together, the tests are pretty extensive. -// -// The following manual tests must be done: -// - TestCodecUnderlyingType - import ( + "bufio" "bytes" "encoding/gob" "fmt" + "io" "io/ioutil" "math" "math/rand" @@ -42,29 +28,68 @@ import ( func init() { testPreInitFns = append(testPreInitFns, testInit) + // fmt.Printf("sizeof: Decoder: %v, Encoder: %v, decNaked: %v\n", + // reflect.TypeOf((*Decoder)(nil)).Elem().Size(), + // reflect.TypeOf((*Encoder)(nil)).Elem().Size(), + // reflect.TypeOf((*decNaked)(nil)).Elem().Size(), + // ) } +type testCustomStringT string + // make this a mapbyslice type testMbsT []interface{} -func (_ testMbsT) MapBySlice() {} +func (testMbsT) MapBySlice() {} -type testVerifyArg int +type testMbsCustStrT []testCustomStringT + +func (testMbsCustStrT) MapBySlice() {} + +type testIntfMapI interface { + GetIntfMapV() string +} + +type testIntfMapT1 struct { + IntfMapV string +} + +func (x *testIntfMapT1) GetIntfMapV() string { return x.IntfMapV } + +type testIntfMapT2 struct { + IntfMapV string +} + +func (x testIntfMapT2) GetIntfMapV() string { return x.IntfMapV } + +// ---- + +type testVerifyFlag uint8 const ( - testVerifyMapTypeSame testVerifyArg = iota + _ testVerifyFlag = 1 << iota + testVerifyMapTypeSame testVerifyMapTypeStrIntf testVerifyMapTypeIntfIntf // testVerifySliceIntf testVerifyForPython + testVerifyDoNil + testVerifyTimeAsInteger ) -const testSkipRPCTests = false +func (f testVerifyFlag) isset(v testVerifyFlag) bool { + return f&v == v +} + +// const testSkipRPCTests = false var ( testTableNumPrimitives int testTableIdxTime int testTableNumMaps int + + // set this when running using bufio, etc + testSkipRPCTests = false ) var ( @@ -82,14 +107,14 @@ var ( //timeToCompare4 = time.Time{}.UTC() // does not work well with simple cbor time encoding (overflow) timeToCompare4 = time.Unix(-2013855848, 4223).UTC() - table []interface{} // main items we encode - tableVerify []interface{} // we verify encoded things against this after decode - tableTestNilVerify []interface{} // for nil interface, use this to verify (rules are different) - tablePythonVerify []interface{} // for verifying for python, since Python sometimes + table []interface{} // main items we encode // will encode a float32 as float64, or large int as uint testRpcInt = new(TestRpcInt) ) +var wrapInt64Typ = reflect.TypeOf(wrapInt64(0)) +var wrapBytesTyp = reflect.TypeOf(wrapBytes(nil)) + func testByteBuf(in []byte) *bytes.Buffer { return bytes.NewBuffer(in) } @@ -134,6 +159,14 @@ func (x *TestABC2) UnmarshalText(data []byte) (err error) { // _, err = fmt.Sscanf(string(data), "%s %s %s", &x.A, &x.B, &x.C) } +type TestSimplish struct { + Ii int + Ss string + Ar [2]*TestSimplish + Sl []*TestSimplish + Mm map[string]*TestSimplish +} + type TestRpcABC struct { A, B, C string } @@ -159,200 +192,235 @@ type TestRawValue struct { I int } +// ---- + type testUnixNanoTimeExt struct { // keep timestamp here, so that do not incur interface-conversion costs - ts int64 + // ts int64 } -// func (x *testUnixNanoTimeExt) WriteExt(interface{}) []byte { panic("unsupported") } -// func (x *testUnixNanoTimeExt) ReadExt(interface{}, []byte) { panic("unsupported") } -func (x *testUnixNanoTimeExt) ConvertExt(v interface{}) interface{} { - switch v2 := v.(type) { - case time.Time: - x.ts = v2.UTC().UnixNano() - case *time.Time: - x.ts = v2.UTC().UnixNano() - default: - panic(fmt.Sprintf("unsupported format for time conversion: expecting time.Time; got %T", v)) - } - return &x.ts +func (x *testUnixNanoTimeExt) WriteExt(v interface{}) []byte { + v2 := v.(*time.Time) + bs := make([]byte, 8) + bigen.PutUint64(bs, uint64(v2.UnixNano())) + return bs } +func (x *testUnixNanoTimeExt) ReadExt(v interface{}, bs []byte) { + v2 := v.(*time.Time) + ui := bigen.Uint64(bs) + *v2 = time.Unix(0, int64(ui)).UTC() +} +func (x *testUnixNanoTimeExt) ConvertExt(v interface{}) interface{} { + v2 := v.(*time.Time) // structs are encoded by passing the ptr + return v2.UTC().UnixNano() +} + func (x *testUnixNanoTimeExt) UpdateExt(dest interface{}, v interface{}) { - // fmt.Printf("testUnixNanoTimeExt.UpdateExt: v: %v\n", v) tt := dest.(*time.Time) switch v2 := v.(type) { case int64: *tt = time.Unix(0, v2).UTC() - case *int64: - *tt = time.Unix(0, *v2).UTC() case uint64: *tt = time.Unix(0, int64(v2)).UTC() - case *uint64: - *tt = time.Unix(0, int64(*v2)).UTC() //case float64: //case string: default: panic(fmt.Sprintf("unsupported format for time conversion: expecting int64/uint64; got %T", v)) } - // fmt.Printf("testUnixNanoTimeExt.UpdateExt: v: %v, tt: %#v\n", v, tt) } -func testVerifyVal(v interface{}, arg testVerifyArg) (v2 interface{}) { - //for python msgpack, - // - all positive integers are unsigned 64-bit ints - // - all floats are float64 - switch iv := v.(type) { - case int8: - if iv >= 0 { - v2 = uint64(iv) - } else { - v2 = int64(iv) - } - case int16: - if iv >= 0 { - v2 = uint64(iv) - } else { - v2 = int64(iv) - } - case int32: - if iv >= 0 { - v2 = uint64(iv) - } else { - v2 = int64(iv) - } - case int64: - if iv >= 0 { - v2 = uint64(iv) - } else { - v2 = int64(iv) - } - case uint8: - v2 = uint64(iv) - case uint16: - v2 = uint64(iv) - case uint32: - v2 = uint64(iv) - case uint64: - v2 = uint64(iv) - case float32: - v2 = float64(iv) - case float64: - v2 = float64(iv) - case []interface{}: - m2 := make([]interface{}, len(iv)) - for j, vj := range iv { - m2[j] = testVerifyVal(vj, arg) - } - v2 = m2 - case testMbsT: - m2 := make([]interface{}, len(iv)) - for j, vj := range iv { - m2[j] = testVerifyVal(vj, arg) - } - v2 = testMbsT(m2) - case map[string]bool: - switch arg { - case testVerifyMapTypeSame: - m2 := make(map[string]bool) - for kj, kv := range iv { - m2[kj] = kv - } - v2 = m2 - case testVerifyMapTypeStrIntf, testVerifyForPython: - m2 := make(map[string]interface{}) - for kj, kv := range iv { - m2[kj] = kv - } - v2 = m2 - case testVerifyMapTypeIntfIntf: - m2 := make(map[interface{}]interface{}) - for kj, kv := range iv { - m2[kj] = kv - } - v2 = m2 - } - case map[string]interface{}: - switch arg { - case testVerifyMapTypeSame: - m2 := make(map[string]interface{}) - for kj, kv := range iv { - m2[kj] = testVerifyVal(kv, arg) - } - v2 = m2 - case testVerifyMapTypeStrIntf, testVerifyForPython: - m2 := make(map[string]interface{}) - for kj, kv := range iv { - m2[kj] = testVerifyVal(kv, arg) - } - v2 = m2 - case testVerifyMapTypeIntfIntf: - m2 := make(map[interface{}]interface{}) - for kj, kv := range iv { - m2[kj] = testVerifyVal(kv, arg) - } - v2 = m2 - } - case map[interface{}]interface{}: - m2 := make(map[interface{}]interface{}) - for kj, kv := range iv { - m2[testVerifyVal(kj, arg)] = testVerifyVal(kv, arg) - } - v2 = m2 - case time.Time: - switch arg { - case testVerifyForPython: - if iv2 := iv.UnixNano(); iv2 >= 0 { - v2 = uint64(iv2) - } else { - v2 = int64(iv2) - } - default: - v2 = v - } +// ---- + +type wrapInt64Ext int64 + +func (x *wrapInt64Ext) WriteExt(v interface{}) []byte { + v2 := uint64(int64(v.(wrapInt64))) + bs := make([]byte, 8) + bigen.PutUint64(bs, v2) + return bs +} +func (x *wrapInt64Ext) ReadExt(v interface{}, bs []byte) { + v2 := v.(*wrapInt64) + ui := bigen.Uint64(bs) + *v2 = wrapInt64(int64(ui)) +} +func (x *wrapInt64Ext) ConvertExt(v interface{}) interface{} { + return int64(v.(wrapInt64)) +} +func (x *wrapInt64Ext) UpdateExt(dest interface{}, v interface{}) { + v2 := dest.(*wrapInt64) + *v2 = wrapInt64(v.(int64)) +} + +// ---- + +type wrapBytesExt struct{} + +func (x *wrapBytesExt) WriteExt(v interface{}) []byte { + return ([]byte)(v.(wrapBytes)) +} +func (x *wrapBytesExt) ReadExt(v interface{}, bs []byte) { + v2 := v.(*wrapBytes) + *v2 = wrapBytes(bs) +} +func (x *wrapBytesExt) ConvertExt(v interface{}) interface{} { + return ([]byte)(v.(wrapBytes)) +} +func (x *wrapBytesExt) UpdateExt(dest interface{}, v interface{}) { + v2 := dest.(*wrapBytes) + // some formats (e.g. json) cannot nakedly determine []byte from string, so expect both + switch v3 := v.(type) { + case []byte: + *v2 = wrapBytes(v3) + case string: + *v2 = wrapBytes([]byte(v3)) default: - v2 = v + panic("UpdateExt for wrapBytesExt expects string or []byte") + } + // *v2 = wrapBytes(v.([]byte)) +} + +// ---- + +// timeExt is an extension handler for time.Time, that uses binc model for encoding/decoding time. +// we used binc model, as that is the only custom time representation that we designed ourselves. +type timeExt struct{} + +func (x timeExt) WriteExt(v interface{}) (bs []byte) { + switch v2 := v.(type) { + case time.Time: + bs = bincEncodeTime(v2) + case *time.Time: + bs = bincEncodeTime(*v2) + default: + panic(fmt.Errorf("unsupported format for time conversion: expecting time.Time; got %T", v2)) } return } +func (x timeExt) ReadExt(v interface{}, bs []byte) { + tt, err := bincDecodeTime(bs) + if err != nil { + panic(err) + } + *(v.(*time.Time)) = tt +} + +func (x timeExt) ConvertExt(v interface{}) interface{} { + return x.WriteExt(v) +} +func (x timeExt) UpdateExt(v interface{}, src interface{}) { + x.ReadExt(v, src.([]byte)) +} + +// ---- + +func testCodecEncode(ts interface{}, bsIn []byte, + fn func([]byte) *bytes.Buffer, h Handle) (bs []byte, err error) { + return sTestCodecEncode(ts, bsIn, fn, h, h.getBasicHandle()) +} + +func testCodecDecode(bs []byte, ts interface{}, h Handle) (err error) { + return sTestCodecDecode(bs, ts, h, h.getBasicHandle()) +} + +func checkErrT(t *testing.T, err error) { + if err != nil { + failT(t, err.Error()) + } +} + +func checkEqualT(t *testing.T, v1 interface{}, v2 interface{}, desc string) { + if err := deepEqual(v1, v2); err != nil { + failT(t, "Not Equal: %s: %v. v1: %v, v2: %v", desc, err, v1, v2) + } +} + +func failT(t *testing.T, args ...interface{}) { + if len(args) > 0 { + if format, isstr := args[0].(string); isstr { + logT(t, format, args[1:]...) + } + } + t.FailNow() +} func testInit() { - gob.Register(new(TestStruc)) + gob.Register(new(TestStrucFlex)) if testInitDebug { - ts0 := newTestStruc(2, false, !testSkipIntf, false) - fmt.Printf("====> depth: %v, ts: %#v\n", 2, ts0) + ts0 := newTestStrucFlex(2, testNumRepeatString, false, !testSkipIntf, false) + logT(nil, "====> depth: %v, ts: %#v\n", 2, ts0) } for _, v := range testHandles { bh := v.getBasicHandle() + // pre-fill them first + bh.EncodeOptions = testEncodeOptions + bh.DecodeOptions = testDecodeOptions + // bh.InterfaceReset = true + // bh.PreferArrayOverSlice = true + // modify from flag'ish things bh.InternString = testInternStr bh.Canonical = testCanonical bh.CheckCircularRef = testCheckCircRef bh.StructToArray = testStructToArray bh.MaxInitLen = testMaxInitLen - // mostly doing this for binc - if testWriteNoSymbols { - bh.AsSymbols = AsSymbolNone - } else { - bh.AsSymbols = AsSymbolAll + } + + testMsgpackH.RawToString = true + + var tTimeExt timeExt + var tBytesExt wrapBytesExt + var tI64Ext wrapInt64Ext + + // create legacy functions suitable for deprecated AddExt functionality, + // and use on some places for testSimpleH e.g. for time.Time and wrapInt64 + var ( + myExtEncFn = func(x BytesExt, rv reflect.Value) (bs []byte, err error) { + defer panicToErr(errstrDecoratorDef{}, &err) + bs = x.WriteExt(rv.Interface()) + return + } + myExtDecFn = func(x BytesExt, rv reflect.Value, bs []byte) (err error) { + defer panicToErr(errstrDecoratorDef{}, &err) + x.ReadExt(rv.Interface(), bs) + return + } + timeExtEncFn = func(rv reflect.Value) (bs []byte, err error) { return myExtEncFn(tTimeExt, rv) } + timeExtDecFn = func(rv reflect.Value, bs []byte) (err error) { return myExtDecFn(tTimeExt, rv, bs) } + wrapInt64ExtEncFn = func(rv reflect.Value) (bs []byte, err error) { return myExtEncFn(&tI64Ext, rv) } + wrapInt64ExtDecFn = func(rv reflect.Value, bs []byte) (err error) { return myExtDecFn(&tI64Ext, rv, bs) } + ) + + chkErr := func(err error) { + if err != nil { + panic(err) } } - testJsonH.Indent = int8(testJsonIndent) - testJsonH.HTMLCharsAsIs = testJsonHTMLCharsAsIs - testMsgpackH.RawToString = true - - // testMsgpackH.AddExt(byteSliceTyp, 0, testMsgpackH.BinaryEncodeExt, testMsgpackH.BinaryDecodeExt) - // testMsgpackH.AddExt(timeTyp, 1, testMsgpackH.TimeEncodeExt, testMsgpackH.TimeDecodeExt) - - // add extensions for msgpack, simple for time.Time, so we can encode/decode same way. - // use different flavors of XXXExt calls, including deprecated ones. - // NOTE: - // DO NOT set extensions for JsonH, so we can test json(M|Unm)arshal support. - testSimpleH.AddExt(timeTyp, 1, timeExtEncFn, timeExtDecFn) - testMsgpackH.SetBytesExt(timeTyp, 1, timeExt{}) - testCborH.SetInterfaceExt(timeTyp, 1, &testUnixNanoTimeExt{}) + // time.Time is a native type, so extensions will have no effect. + // However, we add these here to ensure nothing happens. + chkErr(testSimpleH.AddExt(timeTyp, 1, timeExtEncFn, timeExtDecFn)) + // testBincH.SetBytesExt(timeTyp, 1, timeExt{}) // time is builtin for binc + chkErr(testMsgpackH.SetBytesExt(timeTyp, 1, timeExt{})) + chkErr(testCborH.SetInterfaceExt(timeTyp, 1, &testUnixNanoTimeExt{})) // testJsonH.SetInterfaceExt(timeTyp, 1, &testUnixNanoTimeExt{}) + // Now, add extensions for the type wrapInt64 and wrapBytes, + // so we can execute the Encode/Decode Ext paths. + + chkErr(testSimpleH.SetBytesExt(wrapBytesTyp, 32, &tBytesExt)) + chkErr(testMsgpackH.SetBytesExt(wrapBytesTyp, 32, &tBytesExt)) + chkErr(testBincH.SetBytesExt(wrapBytesTyp, 32, &tBytesExt)) + chkErr(testJsonH.SetInterfaceExt(wrapBytesTyp, 32, &tBytesExt)) + chkErr(testCborH.SetInterfaceExt(wrapBytesTyp, 32, &tBytesExt)) + + chkErr(testSimpleH.AddExt(wrapInt64Typ, 16, wrapInt64ExtEncFn, wrapInt64ExtDecFn)) + // chkErr(testSimpleH.SetBytesExt(wrapInt64Typ, 16, &tI64Ext)) + chkErr(testMsgpackH.SetBytesExt(wrapInt64Typ, 16, &tI64Ext)) + chkErr(testBincH.SetBytesExt(wrapInt64Typ, 16, &tI64Ext)) + chkErr(testJsonH.SetInterfaceExt(wrapInt64Typ, 16, &tI64Ext)) + chkErr(testCborH.SetInterfaceExt(wrapInt64Typ, 16, &tI64Ext)) + // primitives MUST be an even number, so it can be used as a mapBySlice also. primitives := []interface{}{ int8(-8), @@ -407,15 +475,28 @@ func testInit() { }, []interface{}{true, false}, }, - "int32": int32(32323232), - "bool": true, - "LONG STRING": "123456789012345678901234567890123456789012345678901234567890", + "int32": int32(32323232), + "bool": true, + "LONG STRING": ` +1234567890 1234567890 +1234567890 1234567890 +1234567890 1234567890 +ABCDEDFGHIJKLMNOPQRSTUVWXYZ +abcdedfghijklmnopqrstuvwxyz +ABCDEDFGHIJKLMNOPQRSTUVWXYZ +abcdedfghijklmnopqrstuvwxyz +"ABCDEDFGHIJKLMNOPQRSTUVWXYZ" +' a tab ' +\a\b\c\d\e +\b\f\n\r\t all literally +ugorji +`, "SHORT STRING": "1234567890", }, map[interface{}]interface{}{ true: "true", uint8(138): false, - "false": uint8(200), + false: uint8(200), }, } @@ -428,54 +509,183 @@ func testInit() { table = append(table, primitives) table = append(table, testMbsT(primitives)) table = append(table, maps...) - table = append(table, newTestStruc(0, false, !testSkipIntf, false)) + table = append(table, newTestStrucFlex(0, testNumRepeatString, false, !testSkipIntf, false)) - tableVerify = make([]interface{}, len(table)) - tableTestNilVerify = make([]interface{}, len(table)) - tablePythonVerify = make([]interface{}, len(table)) +} +func testTableVerify(f testVerifyFlag, h Handle) (av []interface{}) { + av = make([]interface{}, len(table)) lp := testTableNumPrimitives + 4 - av := tableVerify - for i, v := range table { - if i == lp { - av[i] = skipVerifyVal - continue + // doNil := f & testVerifyDoNil == testVerifyDoNil + // doPython := f & testVerifyForPython == testVerifyForPython + switch { + case f.isset(testVerifyForPython): + for i, v := range table { + if i == testTableNumPrimitives+1 || i > lp { // testTableNumPrimitives+1 is the mapBySlice + av[i] = skipVerifyVal + continue + } + av[i] = testVerifyVal(v, f, h) } - //av[i] = testVerifyVal(v, testVerifyMapTypeSame) - switch v.(type) { - case []interface{}: - av[i] = testVerifyVal(v, testVerifyMapTypeSame) - case testMbsT: - av[i] = testVerifyVal(v, testVerifyMapTypeSame) - case map[string]interface{}: - av[i] = testVerifyVal(v, testVerifyMapTypeSame) - case map[interface{}]interface{}: - av[i] = testVerifyVal(v, testVerifyMapTypeSame) + // only do the python verify up to the maps, skipping the last 2 maps. + av = av[:testTableNumPrimitives+2+testTableNumMaps-2] + case f.isset(testVerifyDoNil): + for i, v := range table { + if i > lp { + av[i] = skipVerifyVal + continue + } + av[i] = testVerifyVal(v, f, h) + } + default: + for i, v := range table { + if i == lp { + av[i] = skipVerifyVal + continue + } + //av[i] = testVerifyVal(v, testVerifyMapTypeSame) + switch v.(type) { + case []interface{}: + av[i] = testVerifyVal(v, f, h) + case testMbsT: + av[i] = testVerifyVal(v, f, h) + case map[string]interface{}: + av[i] = testVerifyVal(v, f, h) + case map[interface{}]interface{}: + av[i] = testVerifyVal(v, f, h) + case time.Time: + av[i] = testVerifyVal(v, f, h) + default: + av[i] = v + } + } + } + return +} + +func testVerifyValInt(v int64, isMsgp bool) (v2 interface{}) { + if isMsgp { + if v >= 0 && v <= 127 { + v2 = uint64(v) + } else { + v2 = int64(v) + } + } else if v >= 0 { + v2 = uint64(v) + } else { + v2 = int64(v) + } + return +} + +func testVerifyVal(v interface{}, f testVerifyFlag, h Handle) (v2 interface{}) { + //for python msgpack, + // - all positive integers are unsigned 64-bit ints + // - all floats are float64 + _, isMsgp := h.(*MsgpackHandle) + _, isCbor := h.(*CborHandle) + switch iv := v.(type) { + case int8: + v2 = testVerifyValInt(int64(iv), isMsgp) + // fmt.Printf(">>>> is msgp: %v, v: %T, %v ==> v2: %T, %v\n", isMsgp, v, v, v2, v2) + case int16: + v2 = testVerifyValInt(int64(iv), isMsgp) + case int32: + v2 = testVerifyValInt(int64(iv), isMsgp) + case int64: + v2 = testVerifyValInt(int64(iv), isMsgp) + case uint8: + v2 = uint64(iv) + case uint16: + v2 = uint64(iv) + case uint32: + v2 = uint64(iv) + case uint64: + v2 = uint64(iv) + case float32: + v2 = float64(iv) + case float64: + v2 = float64(iv) + case []interface{}: + m2 := make([]interface{}, len(iv)) + for j, vj := range iv { + m2[j] = testVerifyVal(vj, f, h) + } + v2 = m2 + case testMbsT: + m2 := make([]interface{}, len(iv)) + for j, vj := range iv { + m2[j] = testVerifyVal(vj, f, h) + } + v2 = testMbsT(m2) + case map[string]bool: + switch { + case f.isset(testVerifyMapTypeSame): + m2 := make(map[string]bool) + for kj, kv := range iv { + m2[kj] = kv + } + v2 = m2 + case f.isset(testVerifyMapTypeStrIntf): + m2 := make(map[string]interface{}) + for kj, kv := range iv { + m2[kj] = kv + } + v2 = m2 + case f.isset(testVerifyMapTypeIntfIntf): + m2 := make(map[interface{}]interface{}) + for kj, kv := range iv { + m2[kj] = kv + } + v2 = m2 + } + case map[string]interface{}: + switch { + case f.isset(testVerifyMapTypeSame): + m2 := make(map[string]interface{}) + for kj, kv := range iv { + m2[kj] = testVerifyVal(kv, f, h) + } + v2 = m2 + case f.isset(testVerifyMapTypeStrIntf): + m2 := make(map[string]interface{}) + for kj, kv := range iv { + m2[kj] = testVerifyVal(kv, f, h) + } + v2 = m2 + case f.isset(testVerifyMapTypeIntfIntf): + m2 := make(map[interface{}]interface{}) + for kj, kv := range iv { + m2[kj] = testVerifyVal(kv, f, h) + } + v2 = m2 + } + case map[interface{}]interface{}: + m2 := make(map[interface{}]interface{}) + for kj, kv := range iv { + m2[testVerifyVal(kj, f, h)] = testVerifyVal(kv, f, h) + } + v2 = m2 + case time.Time: + switch { + case f.isset(testVerifyTimeAsInteger): + if iv2 := iv.UnixNano(); iv2 >= 0 { + v2 = uint64(iv2) + } else { + v2 = int64(iv2) + } + case isMsgp: + v2 = iv.UTC() + case isCbor: + // fmt.Printf("%%%% cbor verifier\n") + v2 = iv.UTC().Round(time.Microsecond) default: - av[i] = v + v2 = v } + default: + v2 = v } - - av = tableTestNilVerify - for i, v := range table { - if i > lp { - av[i] = skipVerifyVal - continue - } - av[i] = testVerifyVal(v, testVerifyMapTypeStrIntf) - } - - av = tablePythonVerify - for i, v := range table { - if i == testTableNumPrimitives+1 || i > lp { // testTableNumPrimitives+1 is the mapBySlice - av[i] = skipVerifyVal - continue - } - av[i] = testVerifyVal(v, testVerifyForPython) - } - - // only do the python verify up to the maps, skipping the last 2 maps. - tablePythonVerify = tablePythonVerify[:testTableNumPrimitives+2+testTableNumMaps-2] + return } func testUnmarshal(v interface{}, data []byte, h Handle) (err error) { @@ -486,20 +696,37 @@ func testMarshal(v interface{}, h Handle) (bs []byte, err error) { return testCodecEncode(v, nil, testByteBuf, h) } -func testMarshalErr(v interface{}, h Handle, t *testing.T, name string) (bs []byte, err error) { - if bs, err = testMarshal(v, h); err != nil { - logT(t, "Error encoding %s: %v, Err: %v", name, v, err) - t.FailNow() +func testMarshalErr(v interface{}, h Handle, t *testing.T, name string) (bs []byte) { + bs, err := testMarshal(v, h) + if err != nil { + failT(t, "Error encoding %s: %v, Err: %v", name, v, err) } return } -func testUnmarshalErr(v interface{}, data []byte, h Handle, t *testing.T, name string) (err error) { - if err = testUnmarshal(v, data, h); err != nil { - logT(t, "Error Decoding into %s: %v, Err: %v", name, v, err) - t.FailNow() +func testUnmarshalErr(v interface{}, data []byte, h Handle, t *testing.T, name string) { + if err := testUnmarshal(v, data, h); err != nil { + failT(t, "Error Decoding into %s: %v, Err: %v", name, v, err) } - return +} + +func testDeepEqualErr(v1, v2 interface{}, t *testing.T, name string) { + if err := deepEqual(v1, v2); err == nil { + logT(t, "%s: values equal", name) + } else { + failT(t, "%s: values not equal: %v. 1: %v, 2: %v", name, err, v1, v2) + } +} + +func testReadWriteCloser(c io.ReadWriteCloser) io.ReadWriteCloser { + if testRpcBufsize <= 0 && rand.Int63()%2 == 0 { + return c + } + return struct { + io.Closer + *bufio.Reader + *bufio.Writer + }{c, bufio.NewReaderSize(c, testRpcBufsize), bufio.NewWriterSize(c, testRpcBufsize)} } // doTestCodecTableOne allows us test for different variations based on arguments passed. @@ -511,40 +738,44 @@ func doTestCodecTableOne(t *testing.T, testNil bool, h Handle, for i, v0 := range vs { logT(t, "..............................................") logT(t, " Testing: #%d:, %T, %#v\n", i, v0, v0) - b0, err := testMarshalErr(v0, h, t, "v0") - if err != nil { - continue + b0 := testMarshalErr(v0, h, t, "v0") + var b1 = b0 + if len(b1) > 256 { + b1 = b1[:256] } if h.isBinary() { - logT(t, " Encoded bytes: len: %v, %v\n", len(b0), b0) + logT(t, " Encoded bytes: len: %v, %v\n", len(b0), b1) } else { - logT(t, " Encoded string: len: %v, %v\n", len(string(b0)), string(b0)) + logT(t, " Encoded string: len: %v, %v\n", len(b0), string(b1)) // println("########### encoded string: " + string(b0)) } var v1 interface{} - + var err error if testNil { err = testUnmarshal(&v1, b0, h) } else { if v0 != nil { v0rt := reflect.TypeOf(v0) // ptr - rv1 := reflect.New(v0rt) - err = testUnmarshal(rv1.Interface(), b0, h) - v1 = rv1.Elem().Interface() - // v1 = reflect.Indirect(reflect.ValueOf(v1)).Interface() + if v0rt.Kind() == reflect.Ptr { + err = testUnmarshal(v0, b0, h) + v1 = v0 + } else { + rv1 := reflect.New(v0rt) + err = testUnmarshal(rv1.Interface(), b0, h) + v1 = rv1.Elem().Interface() + // v1 = reflect.Indirect(reflect.ValueOf(v1)).Interface() + } } } - logT(t, " v1 returned: %T, %#v", v1, v1) + logT(t, " v1 returned: %T, %v %#v", v1, v1, v1) // if v1 != nil { // logT(t, " v1 returned: %T, %#v", v1, v1) // //we always indirect, because ptr to typed value may be passed (if not testNil) // v1 = reflect.Indirect(reflect.ValueOf(v1)).Interface() // } if err != nil { - logT(t, "-------- Error: %v. Partial return: %v", err, v1) - failT(t) - continue + failT(t, "-------- Error: %v. Partial return: %v", err, v1) } v0check := vsVerify[i] if v0check == skipVerifyVal { @@ -557,9 +788,9 @@ func doTestCodecTableOne(t *testing.T, testNil bool, h Handle, } else { // logT(t, "-------- Before and After marshal do not match: Error: %v"+ // " ====> GOLDEN: (%T) %#v, DECODED: (%T) %#v\n", err, v0check, v0check, v1, v1) - logT(t, "-------- Before and After marshal do not match: Error: %v", err) - logT(t, " ....... GOLDEN: (%T) %#v", v0check, v0check) - logT(t, " ....... DECODED: (%T) %#v", v1, v1) + logT(t, "-------- FAIL: Before and After marshal do not match: Error: %v", err) + logT(t, " ....... GOLDEN: (%T) %v %#v", v0check, v0check, v0check) + logT(t, " ....... DECODED: (%T) %v %#v", v1, v1, v1) failT(t) } } @@ -573,13 +804,18 @@ func testCodecTableOne(t *testing.T, h Handle) { numPrim, numMap, idxTime, idxMap := testTableNumPrimitives, testTableNumMaps, testTableIdxTime, testTableNumPrimitives+2 //println("#################") + tableVerify := testTableVerify(testVerifyMapTypeSame, h) + tableTestNilVerify := testTableVerify(testVerifyDoNil|testVerifyMapTypeStrIntf, h) switch v := h.(type) { case *MsgpackHandle: var oldWriteExt, oldRawToString bool + _, _ = oldWriteExt, oldRawToString oldWriteExt, v.WriteExt = v.WriteExt, true oldRawToString, v.RawToString = v.RawToString, true + // defer func() { v.WriteExt, v.RawToString = oldWriteExt, oldRawToString }() doTestCodecTableOne(t, false, h, table, tableVerify) - v.WriteExt, v.RawToString = oldWriteExt, oldRawToString + v.WriteExt = oldWriteExt + v.RawToString = oldRawToString case *JsonHandle: //skip []interface{} containing time.Time, as it encodes as a number, but cannot decode back to time.Time. //As there is no real support for extension tags in json, this must be skipped. @@ -598,13 +834,11 @@ func testCodecTableOne(t *testing.T, h Handle) { v := h.getBasicHandle() oldMapType, v.MapType = v.MapType, testMapStrIntfTyp - + // defer func() { v.MapType = oldMapType }() //skip time.Time, []interface{} containing time.Time, last map, and newStruc doTestCodecTableOne(t, true, h, table[:idxTime], tableTestNilVerify[:idxTime]) - doTestCodecTableOne(t, true, h, table[idxMap:idxMap+numMap-1], tableTestNilVerify[idxMap:idxMap+numMap-1]) - + doTestCodecTableOne(t, true, h, table[idxMap:idxMap+numMap-1], tableTestNilVerify[idxMap:idxMap+numMap-1]) // failing one for msgpack v.MapType = oldMapType - // func TestMsgpackNilIntf(t *testing.T) { //do last map and newStruc @@ -615,53 +849,59 @@ func testCodecTableOne(t *testing.T, h Handle) { } func testCodecMiscOne(t *testing.T, h Handle) { + var err error testOnce.Do(testInitAll) - b, err := testMarshalErr(32, h, t, "32") + b := testMarshalErr(32, h, t, "32") // Cannot do this nil one, because faster type assertion decoding will panic // var i *int32 // if err = testUnmarshal(b, i, nil); err == nil { // logT(t, "------- Expecting error because we cannot unmarshal to int32 nil ptr") - // t.FailNow() + // failT(t) // } - var i2 int32 = 0 - err = testUnmarshalErr(&i2, b, h, t, "int32-ptr") + var i2 int32 + testUnmarshalErr(&i2, b, h, t, "int32-ptr") if i2 != int32(32) { logT(t, "------- didn't unmarshal to 32: Received: %d", i2) - t.FailNow() + failT(t) } // func TestMsgpackDecodePtr(t *testing.T) { - ts := newTestStruc(0, false, !testSkipIntf, false) - b, err = testMarshalErr(ts, h, t, "pointer-to-struct") + ts := newTestStrucFlex(testDepth, testNumRepeatString, false, !testSkipIntf, false) + b = testMarshalErr(ts, h, t, "pointer-to-struct") if len(b) < 40 { logT(t, "------- Size must be > 40. Size: %d", len(b)) - t.FailNow() + failT(t) + } + var b1 = b + if len(b1) > 256 { + b1 = b1[:256] } if h.isBinary() { - logT(t, "------- b: %v", b) + logT(t, "------- b: size: %v, value: %v", len(b), b1) } else { - logT(t, "------- b: %s", b) + logT(t, "------- b: size: %v, value: %s", len(b), b1) } - ts2 := new(TestStruc) - err = testUnmarshalErr(ts2, b, h, t, "pointer-to-struct") + ts2 := new(TestStrucFlex) + testUnmarshalErr(ts2, b, h, t, "pointer-to-struct") if ts2.I64 != math.MaxInt64*2/3 { logT(t, "------- Unmarshal wrong. Expect I64 = 64. Got: %v", ts2.I64) - t.FailNow() + failT(t) } // func TestMsgpackIntfDecode(t *testing.T) { m := map[string]int{"A": 2, "B": 3} p := []interface{}{m} - bs, err := testMarshalErr(p, h, t, "p") + bs := testMarshalErr(p, h, t, "p") m2 := map[string]int{} p2 := []interface{}{m2} - err = testUnmarshalErr(&p2, bs, h, t, "&p2") + testUnmarshalErr(&p2, bs, h, t, "&p2") if m2["A"] != 2 || m2["B"] != 3 { - logT(t, "m2 not as expected: expecting: %v, got: %v", m, m2) - t.FailNow() + logT(t, "FAIL: m2 not as expected: expecting: %v, got: %v", m, m2) + failT(t) } + // log("m: %v, m2: %v, p: %v, p2: %v", m, m2, p, p2) checkEqualT(t, p, p2, "p=p2") checkEqualT(t, m, m2, "m=m2") @@ -669,19 +909,19 @@ func testCodecMiscOne(t *testing.T, h Handle) { logT(t, "p and p2 match") } else { logT(t, "Not Equal: %v. p: %v, p2: %v", err, p, p2) - t.FailNow() + failT(t) } if err = deepEqual(m, m2); err == nil { logT(t, "m and m2 match") } else { logT(t, "Not Equal: %v. m: %v, m2: %v", err, m, m2) - t.FailNow() + failT(t) } // func TestMsgpackDecodeStructSubset(t *testing.T) { // test that we can decode a subset of the stream mm := map[string]interface{}{"A": 5, "B": 99, "C": 333} - bs, err = testMarshalErr(mm, h, t, "mm") + bs = testMarshalErr(mm, h, t, "mm") type ttt struct { A uint8 C int32 @@ -702,18 +942,13 @@ func testCodecMiscOne(t *testing.T, h Handle) { var tarr0 = tarr{1, [3]int64{2, 3, 4}, []byte{4, 5, 6}, [3]byte{7, 8, 9}} // test both pointer and non-pointer (value) for _, tarr1 := range []interface{}{tarr0, &tarr0} { - bs, err = testMarshalErr(tarr1, h, t, "tarr1") - if err != nil { - logT(t, "Error marshalling: %v", err) - t.FailNow() - } + bs = testMarshalErr(tarr1, h, t, "tarr1") if _, ok := h.(*JsonHandle); ok { logT(t, "Marshal as: %s", bs) } var tarr2 tarr testUnmarshalErr(&tarr2, bs, h, t, "tarr2") checkEqualT(t, tarr0, tarr2, "tarr0=tarr2") - // fmt.Printf(">>>> err: %v. tarr1: %v, tarr2: %v\n", err, tarr0, tarr2) } // test byte array, even if empty (msgpack only) @@ -724,6 +959,19 @@ func testCodecMiscOne(t *testing.T, h Handle) { var ya = ystruct{} testUnmarshalErr(&ya, []byte{0x91, 0x90}, h, t, "ya") } + + var tt1, tt2 time.Time + tt2 = time.Now() + bs = testMarshalErr(tt1, h, t, "zero-time-enc") + testUnmarshalErr(&tt2, bs, h, t, "zero-time-dec") + testDeepEqualErr(tt1, tt2, t, "zero-time-eq") + + // test encoding a slice of byte (but not []byte) and decoding into a []byte + var sw = []wrapUint8{'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J'} + var bw []byte // ("ABCDEFGHIJ") + bs = testMarshalErr(sw, h, t, "wrap-bytes-enc") + testUnmarshalErr(&bw, bs, h, t, "wrap-bytes-dec") + testDeepEqualErr(bw, []byte("ABCDEFGHIJ"), t, "wrap-bytes-eq") } func testCodecEmbeddedPointer(t *testing.T, h Handle) { @@ -739,12 +987,10 @@ func testCodecEmbeddedPointer(t *testing.T, h Handle) { } var z Z = 4 x1 := &B{&z, &A{5}, 6} - bs, err := testMarshalErr(x1, h, t, "x1") - // fmt.Printf("buf: len(%v): %x\n", buf.Len(), buf.Bytes()) + bs := testMarshalErr(x1, h, t, "x1") var x2 = new(B) - err = testUnmarshalErr(x2, bs, h, t, "x2") - err = checkEqualT(t, x1, x2, "x1=x2") - _ = err + testUnmarshalErr(x2, bs, h, t, "x2") + checkEqualT(t, x1, x2, "x1=x2") } func testCodecUnderlyingType(t *testing.T, h Handle) { @@ -770,40 +1016,120 @@ func testCodecUnderlyingType(t *testing.T, h Handle) { } func testCodecChan(t *testing.T, h Handle) { + testOnce.Do(testInitAll) // - send a slice []*int64 (sl1) into an chan (ch1) with cap > len(s1) // - encode ch1 as a stream array // - decode a chan (ch2), with cap > len(s1) from the stream array // - receive from ch2 into slice sl2 // - compare sl1 and sl2 // - do this for codecs: json, cbor (covers all types) - sl1 := make([]*int64, 4) - for i := range sl1 { - var j int64 = int64(i) - sl1[i] = &j + + if true { + logT(t, "*int64") + sl1 := make([]*int64, 4) + for i := range sl1 { + var j int64 = int64(i) + sl1[i] = &j + } + ch1 := make(chan *int64, 4) + for _, j := range sl1 { + ch1 <- j + } + var bs []byte + NewEncoderBytes(&bs, h).MustEncode(ch1) + ch2 := make(chan *int64, 8) + NewDecoderBytes(bs, h).MustDecode(&ch2) + close(ch2) + var sl2 []*int64 + for j := range ch2 { + sl2 = append(sl2, j) + } + if err := deepEqual(sl1, sl2); err != nil { + logT(t, "FAIL: Not Match: %v; len: %v, %v", err, len(sl1), len(sl2)) + failT(t) + } } - ch1 := make(chan *int64, 4) - for _, j := range sl1 { - ch1 <- j + + if true { + logT(t, "testBytesT []byte - input []byte") + type testBytesT []byte + sl1 := make([]testBytesT, 4) + for i := range sl1 { + var j = []byte(strings.Repeat(strconv.FormatInt(int64(i), 10), i)) + sl1[i] = j + } + ch1 := make(chan testBytesT, 4) + for _, j := range sl1 { + ch1 <- j + } + var bs []byte + NewEncoderBytes(&bs, h).MustEncode(ch1) + ch2 := make(chan testBytesT, 8) + NewDecoderBytes(bs, h).MustDecode(&ch2) + close(ch2) + var sl2 []testBytesT + for j := range ch2 { + // logT(t, ">>>> from chan: is nil? %v, %v", j == nil, j) + sl2 = append(sl2, j) + } + if err := deepEqual(sl1, sl2); err != nil { + logT(t, "FAIL: Not Match: %v; len: %v, %v", err, len(sl1), len(sl2)) + failT(t) + } } - var bs []byte - NewEncoderBytes(&bs, h).MustEncode(ch1) - // if !h.isBinary() { - // fmt.Printf("before: len(ch1): %v, bs: %s\n", len(ch1), bs) - // } - // var ch2 chan *int64 // this will block if json, etc. - ch2 := make(chan *int64, 8) - NewDecoderBytes(bs, h).MustDecode(&ch2) - // logT(t, "Len(ch2): %v", len(ch2)) - // fmt.Printf("after: len(ch2): %v, ch2: %v\n", len(ch2), ch2) - close(ch2) - var sl2 []*int64 - for j := range ch2 { - sl2 = append(sl2, j) + if true { + logT(t, "testBytesT byte - input string/testBytesT") + type testBytesT byte + sl1 := make([]testBytesT, 4) + for i := range sl1 { + var j = strconv.FormatInt(int64(i), 10)[0] + sl1[i] = testBytesT(j) + } + ch1 := make(chan testBytesT, 4) + for _, j := range sl1 { + ch1 <- j + } + var bs []byte + NewEncoderBytes(&bs, h).MustEncode(ch1) + ch2 := make(chan testBytesT, 8) + NewDecoderBytes(bs, h).MustDecode(&ch2) + close(ch2) + var sl2 []testBytesT + for j := range ch2 { + sl2 = append(sl2, j) + } + if err := deepEqual(sl1, sl2); err != nil { + logT(t, "FAIL: Not Match: %v; len: %v, %v", err, len(sl1), len(sl2)) + failT(t) + } } - if err := deepEqual(sl1, sl2); err != nil { - logT(t, "Not Match: %v; len: %v, %v", err, len(sl1), len(sl2)) - failT(t) + + if true { + logT(t, "*[]byte") + sl1 := make([]byte, 4) + for i := range sl1 { + var j = strconv.FormatInt(int64(i), 10)[0] + sl1[i] = byte(j) + } + ch1 := make(chan byte, 4) + for _, j := range sl1 { + ch1 <- j + } + var bs []byte + NewEncoderBytes(&bs, h).MustEncode(ch1) + ch2 := make(chan byte, 8) + NewDecoderBytes(bs, h).MustDecode(&ch2) + close(ch2) + var sl2 []byte + for j := range ch2 { + sl2 = append(sl2, j) + } + if err := deepEqual(sl1, sl2); err != nil { + logT(t, "FAIL: Not Match: %v; len: %v, %v", err, len(sl1), len(sl2)) + failT(t) + } } + } func testCodecRpcOne(t *testing.T, rr Rpc, h Handle, doRequest bool, exitSleepMs time.Duration, @@ -815,7 +1141,12 @@ func testCodecRpcOne(t *testing.T, rr Rpc, h Handle, doRequest bool, exitSleepMs // rpc needs EOF, which is sent via a panic, and so must be recovered. if !recoverPanicToErr { logT(t, "EXPECTED. set recoverPanicToErr=true, since rpc needs EOF") - t.FailNow() + failT(t) + } + + if jsonH, ok := h.(*JsonHandle); ok && !jsonH.TermWhitespace { + jsonH.TermWhitespace = true + defer func() { jsonH.TermWhitespace = false }() } srv := rpc.NewServer() srv.Register(testRpcInt) @@ -828,7 +1159,7 @@ func testCodecRpcOne(t *testing.T, rr Rpc, h Handle, doRequest bool, exitSleepMs // opts.MapType = mapStrIntfTyp // opts.RawToString = false serverExitChan := make(chan bool, 1) - var serverExitFlag uint64 = 0 + var serverExitFlag uint64 serverFn := func() { for { conn1, err1 := ln.Accept() @@ -842,7 +1173,7 @@ func testCodecRpcOne(t *testing.T, rr Rpc, h Handle, doRequest bool, exitSleepMs return // exit serverFn goroutine } if err1 == nil { - var sc rpc.ServerCodec = rr.ServerCodec(conn1, h) + sc := rr.ServerCodec(testReadWriteCloser(conn1), h) srv.ServeCodec(sc) } } @@ -872,7 +1203,6 @@ func testCodecRpcOne(t *testing.T, rr Rpc, h Handle, doRequest bool, exitSleepMs connFn := func() (bs net.Conn) { // log("calling f1") bs, err2 := net.Dial(ln.Addr().Network(), ln.Addr().String()) - //fmt.Printf("f1. bs: %v, err2: %v\n", bs, err2) checkErrT(t, err2) return } @@ -894,7 +1224,7 @@ func testCodecRpcOne(t *testing.T, rr Rpc, h Handle, doRequest bool, exitSleepMs } if doRequest { bs := connFn() - cc := rr.ClientCodec(bs, h) + cc := rr.ClientCodec(testReadWriteCloser(bs), h) clientFn(cc) } if exitSleepMs != 0 { @@ -908,10 +1238,12 @@ func testCodecRpcOne(t *testing.T, rr Rpc, h Handle, doRequest bool, exitSleepMs } func doTestMapEncodeForCanonical(t *testing.T, name string, h Handle) { - v1 := map[string]interface{}{ - "a": 1, - "b": "hello", - "c": map[string]interface{}{ + testOnce.Do(testInitAll) + // println("doTestMapEncodeForCanonical") + v1 := map[stringUint64T]interface{}{ + {"a", 1}: 1, + {"b", 2}: "hello", + {"c", 3}: map[string]interface{}{ "c/a": 1, "c/b": "world", "c/c": []int{1, 2, 3, 4}, @@ -937,13 +1269,26 @@ func doTestMapEncodeForCanonical(t *testing.T, name string, h Handle) { "4444": 4444, "55555": 55555, }, + "c/g": map[bool]int{ + false: 0, + true: 1, + }, }, } - var v2 map[string]interface{} - var b1, b2 []byte + var v2 map[stringUint64T]interface{} + var b1, b2, b3 []byte - // encode v1 into b1, decode b1 into v2, encode v2 into b2, compare b1 and b2 + // encode v1 into b1, decode b1 into v2, encode v2 into b2, and compare b1 and b2. + // OR + // encode v1 into b1, decode b1 into v2, encode v2 into b2 and b3, and compare b2 and b3. + // e.g. when doing cbor indefinite, we may haveto use out-of-band encoding + // where each key is encoded as an indefinite length string, which makes it not the same + // order as the strings were lexicographically ordered before. + var cborIndef bool + if ch, ok := h.(*CborHandle); ok { + cborIndef = ch.IndefiniteLength + } bh := h.getBasicHandle() if !bh.Canonical { bh.Canonical = true @@ -954,15 +1299,24 @@ func doTestMapEncodeForCanonical(t *testing.T, name string, h Handle) { e1.MustEncode(v1) d1 := NewDecoderBytes(b1, h) d1.MustDecode(&v2) + // testDeepEqualErr(v1, v2, t, "huh?") e2 := NewEncoderBytes(&b2, h) e2.MustEncode(v2) - if !bytes.Equal(b1, b2) { - logT(t, "Unequal bytes: %v VS %v", b1, b2) - t.FailNow() + var b1t, b2t = b1, b2 + if cborIndef { + e2 = NewEncoderBytes(&b3, h) + e2.MustEncode(v2) + b1t, b2t = b2, b3 + } + + if !bytes.Equal(b1t, b2t) { + logT(t, "Unequal bytes: %v VS %v", b1t, b2t) + failT(t) } } func doTestStdEncIntf(t *testing.T, name string, h Handle) { + testOnce.Do(testInitAll) args := [][2]interface{}{ {&TestABC{"A", "BB", "CCC"}, new(TestABC)}, {&TestABC2{"AAA", "BB", "C"}, new(TestABC2)}, @@ -976,13 +1330,14 @@ func doTestStdEncIntf(t *testing.T, name string, h Handle) { if err := deepEqual(a[0], a[1]); err == nil { logT(t, "++++ Objects match") } else { - logT(t, "---- Objects do not match: y1: %v, err: %v", a[1], err) + logT(t, "---- FAIL: Objects do not match: y1: %v, err: %v", a[1], err) failT(t) } } } func doTestEncCircularRef(t *testing.T, name string, h Handle) { + testOnce.Do(testInitAll) type T1 struct { S string B bool @@ -1012,13 +1367,13 @@ func doTestEncCircularRef(t *testing.T, name string, h Handle) { err = NewEncoderBytes(&bs, h).Encode(&t3) if err == nil { logT(t, "expecting error due to circular reference. found none") - t.FailNow() + failT(t) } if x := err.Error(); strings.Contains(x, "circular") || strings.Contains(x, "cyclic") { logT(t, "error detected as expected: %v", x) } else { - logT(t, "error detected was not as expected: %v", x) - t.FailNow() + logT(t, "FAIL: error detected was not as expected: %v", x) + failT(t) } } @@ -1039,6 +1394,7 @@ type ( ) func doTestAnonCycle(t *testing.T, name string, h Handle) { + testOnce.Do(testInitAll) var x TestAnonCycleT1 x.S = "hello" x.TestAnonCycleT2.S2 = "hello.2" @@ -1046,12 +1402,13 @@ func doTestAnonCycle(t *testing.T, name string, h Handle) { // just check that you can get typeInfo for T1 rt := reflect.TypeOf((*TestAnonCycleT1)(nil)).Elem() - rtid := reflect.ValueOf(rt).Pointer() + rtid := rt2id(rt) pti := h.getBasicHandle().getTypeInfo(rtid, rt) logT(t, "pti: %v", pti) } func doTestJsonLargeInteger(t *testing.T, v interface{}, ias uint8) { + testOnce.Do(testInitAll) logT(t, "Running doTestJsonLargeInteger: v: %#v, ias: %c", v, ias) oldIAS := testJsonH.IntegerAsString defer func() { testJsonH.IntegerAsString = oldIAS }() @@ -1117,11 +1474,11 @@ func doTestJsonLargeInteger(t *testing.T, v interface{}, ias uint8) { logT(t, "Expecting equal values from %s: got golden: %v, decoded: %v", b, v2, vu) failT(t) } - // fmt.Printf("%v: %s, decode: %d, bool: %v, equal_on_decode: %v\n", v, b, vu, vb, vu == v.(uint)) } } func doTestRawValue(t *testing.T, name string, h Handle) { + testOnce.Do(testInitAll) bh := h.getBasicHandle() if !bh.Raw { bh.Raw = true @@ -1153,7 +1510,7 @@ func doTestRawValue(t *testing.T, name string, h Handle) { // logT(t, "Encoded %v, decoded %v", i, i2) if i != i2 { logT(t, "Error: encoded %v, decoded %v", i, i2) - t.FailNow() + failT(t) } } @@ -1162,11 +1519,12 @@ func doTestRawValue(t *testing.T, name string, h Handle) { // We keep this unexported here, and put actual test in ext_dep_test.go. // This way, it can be excluded by excluding file completely. func doTestPythonGenStreams(t *testing.T, name string, h Handle) { + testOnce.Do(testInitAll) logT(t, "TestPythonGenStreams-%v", name) tmpdir, err := ioutil.TempDir("", "golang-"+name+"-test") if err != nil { logT(t, "-------- Unable to create temp directory\n") - t.FailNow() + failT(t) } defer os.RemoveAll(tmpdir) logT(t, "tmpdir: %v", tmpdir) @@ -1177,12 +1535,13 @@ func doTestPythonGenStreams(t *testing.T, name string, h Handle) { if cmdout, err = cmd.CombinedOutput(); err != nil { logT(t, "-------- Error running test.py testdata. Err: %v", err) logT(t, " %v", string(cmdout)) - t.FailNow() + failT(t) } bh := h.getBasicHandle() oldMapType := bh.MapType + tablePythonVerify := testTableVerify(testVerifyForPython|testVerifyTimeAsInteger|testVerifyMapTypeStrIntf, h) for i, v := range tablePythonVerify { // if v == uint64(0) && h == testMsgpackH { // v = int64(0) @@ -1218,7 +1577,7 @@ func doTestPythonGenStreams(t *testing.T, name string, h Handle) { if err = deepEqual(v, v1); err == nil { logT(t, "++++++++ Objects match: %T, %v", v, v) } else { - logT(t, "-------- Objects do not match: %v. Source: %T. Decoded: %T", err, v, v1) + logT(t, "-------- FAIL: Objects do not match: %v. Source: %T. Decoded: %T", err, v, v1) logT(t, "-------- GOLDEN: %#v", v) // logT(t, "-------- DECODED: %#v <====> %#v", v1, reflect.Indirect(reflect.ValueOf(v1)).Interface()) logT(t, "-------- DECODED: %#v <====> %#v", v1, reflect.Indirect(reflect.ValueOf(v1)).Interface()) @@ -1233,7 +1592,7 @@ func doTestPythonGenStreams(t *testing.T, name string, h Handle) { if err = deepEqual(bsb, bss); err == nil { logT(t, "++++++++ Bytes match") } else { - logT(t, "???????? Bytes do not match. %v.", err) + logT(t, "???????? FAIL: Bytes do not match. %v.", err) xs := "--------" if reflect.ValueOf(v).Kind() == reflect.Map { xs = " " @@ -1262,6 +1621,7 @@ func doTestMsgpackRpcSpecGoClientToPythonSvc(t *testing.T) { if testSkipRPCTests { return } + testOnce.Do(testInitAll) // openPorts are between 6700 and 6800 r := rand.New(rand.NewSource(time.Now().UnixNano())) openPort := strconv.FormatInt(6700+r.Int63n(99), 10) @@ -1274,7 +1634,7 @@ func doTestMsgpackRpcSpecGoClientToPythonSvc(t *testing.T) { bs, err2 = net.Dial("tcp", ":"+openPort) } checkErrT(t, err2) - cc := MsgpackSpecRpc.ClientCodec(bs, testMsgpackH) + cc := MsgpackSpecRpc.ClientCodec(testReadWriteCloser(bs), testMsgpackH) cl := rpc.NewClientWithCodec(cc) defer cl.Close() var rstr string @@ -1290,6 +1650,7 @@ func doTestMsgpackRpcSpecPythonClientToGoSvc(t *testing.T) { if testSkipRPCTests { return } + testOnce.Do(testInitAll) port := testCodecRpcOne(t, MsgpackSpecRpc, testMsgpackH, false, 1*time.Second) //time.Sleep(1000 * time.Millisecond) cmd := exec.Command("python", "test.py", "rpc-client-go-service", strconv.Itoa(port)) @@ -1298,12 +1659,876 @@ func doTestMsgpackRpcSpecPythonClientToGoSvc(t *testing.T) { if cmdout, err = cmd.CombinedOutput(); err != nil { logT(t, "-------- Error running test.py rpc-client-go-service. Err: %v", err) logT(t, " %v", string(cmdout)) - t.FailNow() + failT(t) } checkEqualT(t, string(cmdout), fmt.Sprintf("%#v\n%#v\n", []string{"A1", "B2", "C3"}, TestRpcABC{"Aa", "Bb", "Cc"}), "cmdout=") } +func doTestSwallowAndZero(t *testing.T, h Handle) { + testOnce.Do(testInitAll) + v1 := newTestStrucFlex(testDepth, testNumRepeatString, false, false, false) + var b1 []byte + + e1 := NewEncoderBytes(&b1, h) + e1.MustEncode(v1) + d1 := NewDecoderBytes(b1, h) + d1.swallow() + if d1.r.numread() != len(b1) { + logT(t, "swallow didn't consume all encoded bytes: %v out of %v", d1.r.numread(), len(b1)) + failT(t) + } + setZero(v1) + testDeepEqualErr(v1, &TestStrucFlex{}, t, "filled-and-zeroed") +} + +func doTestRawExt(t *testing.T, h Handle) { + testOnce.Do(testInitAll) + var b []byte + var v RawExt // interface{} + _, isJson := h.(*JsonHandle) + _, isCbor := h.(*CborHandle) + bh := h.getBasicHandle() + // isValuer := isJson || isCbor + // _ = isValuer + for _, r := range []RawExt{ + {Tag: 99, Value: "9999", Data: []byte("9999")}, + } { + e := NewEncoderBytes(&b, h) + e.MustEncode(&r) + // fmt.Printf(">>>> rawext: isnil? %v, %d - %v\n", b == nil, len(b), b) + d := NewDecoderBytes(b, h) + d.MustDecode(&v) + var r2 = r + switch { + case isJson: + r2.Tag = 0 + r2.Data = nil + case isCbor: + r2.Data = nil + default: + r2.Value = nil + } + testDeepEqualErr(v, r2, t, "rawext-default") + // switch h.(type) { + // case *JsonHandle: + // testDeepEqualErr(r.Value, v, t, "rawext-json") + // default: + // var r2 = r + // if isValuer { + // r2.Data = nil + // } else { + // r2.Value = nil + // } + // testDeepEqualErr(v, r2, t, "rawext-default") + // } + } + + // Add testing for Raw also + if b != nil { + b = b[:0] + } + oldRawMode := bh.Raw + defer func() { bh.Raw = oldRawMode }() + bh.Raw = true + + var v2 Raw + for _, s := range []string{ + "goodbye", + "hello", + } { + e := NewEncoderBytes(&b, h) + e.MustEncode(&s) + // fmt.Printf(">>>> rawext: isnil? %v, %d - %v\n", b == nil, len(b), b) + var r Raw = make([]byte, len(b)) + copy(r, b) + d := NewDecoderBytes(b, h) + d.MustDecode(&v2) + testDeepEqualErr(v2, r, t, "raw-default") + } + +} + +// func doTestTimeExt(t *testing.T, h Handle) { +// var t = time.Now() +// // add time ext to the handle +// } + +func doTestMapStructKey(t *testing.T, h Handle) { + testOnce.Do(testInitAll) + var b []byte + var v interface{} // map[stringUint64T]wrapUint64Slice // interface{} + bh := h.getBasicHandle() + m := map[stringUint64T]wrapUint64Slice{ + {"55555", 55555}: []wrapUint64{12345}, + {"333", 333}: []wrapUint64{123}, + } + oldCanonical := bh.Canonical + oldMapType := bh.MapType + defer func() { + bh.Canonical = oldCanonical + bh.MapType = oldMapType + }() + + bh.MapType = reflect.TypeOf((*map[stringUint64T]wrapUint64Slice)(nil)).Elem() + for _, bv := range [2]bool{true, false} { + b, v = nil, nil + bh.Canonical = bv + e := NewEncoderBytes(&b, h) + e.MustEncode(m) + d := NewDecoderBytes(b, h) + d.MustDecode(&v) + testDeepEqualErr(v, m, t, "map-structkey") + } +} + +func doTestDecodeNilMapValue(t *testing.T, handle Handle) { + testOnce.Do(testInitAll) + type Struct struct { + Field map[uint16]map[uint32]struct{} + } + + bh := handle.getBasicHandle() + oldMapType := bh.MapType + oldDeleteOnNilMapValue := bh.DeleteOnNilMapValue + defer func() { + bh.MapType = oldMapType + bh.DeleteOnNilMapValue = oldDeleteOnNilMapValue + }() + bh.MapType = reflect.TypeOf(map[interface{}]interface{}(nil)) + bh.DeleteOnNilMapValue = false + + _, isJsonHandle := handle.(*JsonHandle) + + toEncode := Struct{Field: map[uint16]map[uint32]struct{}{ + 1: nil, + }} + + bs, err := testMarshal(toEncode, handle) + if err != nil { + logT(t, "Error encoding: %v, Err: %v", toEncode, err) + failT(t) + } + if isJsonHandle { + logT(t, "json encoded: %s\n", bs) + } + + var decoded Struct + err = testUnmarshal(&decoded, bs, handle) + if err != nil { + logT(t, "Error decoding: %v", err) + failT(t) + } + if !reflect.DeepEqual(decoded, toEncode) { + logT(t, "Decoded value %#v != %#v", decoded, toEncode) + failT(t) + } +} + +func doTestEmbeddedFieldPrecedence(t *testing.T, h Handle) { + testOnce.Do(testInitAll) + type Embedded struct { + Field byte + } + type Struct struct { + Field byte + Embedded + } + toEncode := Struct{ + Field: 1, + Embedded: Embedded{Field: 2}, + } + _, isJsonHandle := h.(*JsonHandle) + handle := h.getBasicHandle() + oldMapType := handle.MapType + defer func() { handle.MapType = oldMapType }() + + handle.MapType = reflect.TypeOf(map[interface{}]interface{}(nil)) + + bs, err := testMarshal(toEncode, h) + if err != nil { + logT(t, "Error encoding: %v, Err: %v", toEncode, err) + failT(t) + } + + var decoded Struct + err = testUnmarshal(&decoded, bs, h) + if err != nil { + logT(t, "Error decoding: %v", err) + failT(t) + } + + if decoded.Field != toEncode.Field { + logT(t, "Decoded result %v != %v", decoded.Field, toEncode.Field) // hex to look at what was encoded + if isJsonHandle { + logT(t, "JSON encoded as: %s", bs) // hex to look at what was encoded + } + failT(t) + } +} + +func doTestLargeContainerLen(t *testing.T, h Handle) { + testOnce.Do(testInitAll) + m := make(map[int][]struct{}) + for i := range []int{ + 0, 1, + math.MaxInt8, math.MaxInt8 + 4, math.MaxInt8 - 4, + math.MaxInt16, math.MaxInt16 + 4, math.MaxInt16 - 4, + math.MaxInt32, math.MaxInt32 + 4, math.MaxInt32 - 4, + math.MaxInt64, math.MaxInt64 - 4, + + math.MaxUint8, math.MaxUint8 + 4, math.MaxUint8 - 4, + math.MaxUint16, math.MaxUint16 + 4, math.MaxUint16 - 4, + math.MaxUint32, math.MaxUint32 + 4, math.MaxUint32 - 4, + } { + m[i] = make([]struct{}, i) + } + bs := testMarshalErr(m, h, t, "-") + var m2 = make(map[int][]struct{}) + testUnmarshalErr(m2, bs, h, t, "-") + testDeepEqualErr(m, m2, t, "-") + + // do same tests for large strings (encoded as symbols or not) + // skip if 32-bit or not using unsafe mode + if safeMode || (32<<(^uint(0)>>63)) < 64 { + return + } + + // now, want to do tests for large strings, which + // could be encoded as symbols. + // to do this, we create a simple one-field struct, + // use use flags to switch from symbols to non-symbols + + hbinc, okbinc := h.(*BincHandle) + if okbinc { + oldAsSymbols := hbinc.AsSymbols + defer func() { hbinc.AsSymbols = oldAsSymbols }() + } + var out []byte = make([]byte, 0, math.MaxUint16*3/2) + var in []byte = make([]byte, math.MaxUint16*3/2) + for i := range in { + in[i] = 'A' + } + e := NewEncoder(nil, h) + for _, i := range []int{ + 0, 1, 4, 8, 12, 16, 28, 32, 36, + math.MaxInt8, math.MaxInt8 + 4, math.MaxInt8 - 4, + math.MaxInt16, math.MaxInt16 + 4, math.MaxInt16 - 4, + + math.MaxUint8, math.MaxUint8 + 4, math.MaxUint8 - 4, + math.MaxUint16, math.MaxUint16 + 4, math.MaxUint16 - 4, + } { + var m1, m2 map[string]bool + m1 = make(map[string]bool, 1) + var s1 = stringView(in[:i]) + // fmt.Printf("testcontainerlen: large string: i: %v, |%s|\n", i, s1) + m1[s1] = true + + if okbinc { + hbinc.AsSymbols = 2 + } + out = out[:0] + e.ResetBytes(&out) + e.MustEncode(m1) + // bs, _ = testMarshalErr(m1, h, t, "-") + m2 = make(map[string]bool, 1) + testUnmarshalErr(m2, out, h, t, "no-symbols") + testDeepEqualErr(m1, m2, t, "no-symbols") + + if okbinc { + // now, do as symbols + hbinc.AsSymbols = 1 + out = out[:0] + e.ResetBytes(&out) + e.MustEncode(m1) + // bs, _ = testMarshalErr(m1, h, t, "-") + m2 = make(map[string]bool, 1) + testUnmarshalErr(m2, out, h, t, "symbols") + testDeepEqualErr(m1, m2, t, "symbols") + } + } + +} + +func testRandomFillRV(v reflect.Value) { + testOnce.Do(testInitAll) + fneg := func() int64 { + i := rand.Intn(1) + if i == 1 { + return 1 + } + return -1 + } + + switch v.Kind() { + case reflect.Invalid: + case reflect.Ptr: + if v.IsNil() { + v.Set(reflect.New(v.Type().Elem())) + } + testRandomFillRV(v.Elem()) + case reflect.Interface: + if v.IsNil() { + v.Set(reflect.ValueOf("nothing")) + } else { + testRandomFillRV(v.Elem()) + } + case reflect.Struct: + for i, n := 0, v.NumField(); i < n; i++ { + testRandomFillRV(v.Field(i)) + } + case reflect.Slice: + if v.IsNil() { + v.Set(reflect.MakeSlice(v.Type(), 4, 4)) + } + fallthrough + case reflect.Array: + for i, n := 0, v.Len(); i < n; i++ { + testRandomFillRV(v.Index(i)) + } + case reflect.Map: + if v.IsNil() { + v.Set(reflect.MakeMap(v.Type())) + } + if v.Len() == 0 { + kt, vt := v.Type().Key(), v.Type().Elem() + for i := 0; i < 4; i++ { + k0 := reflect.New(kt).Elem() + v0 := reflect.New(vt).Elem() + testRandomFillRV(k0) + testRandomFillRV(v0) + v.SetMapIndex(k0, v0) + } + } else { + for _, k := range v.MapKeys() { + testRandomFillRV(v.MapIndex(k)) + } + } + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + v.SetInt(fneg() * rand.Int63n(127)) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + v.SetUint(uint64(rand.Int63n(255))) + case reflect.Bool: + v.SetBool(fneg() == 1) + case reflect.Float32, reflect.Float64: + v.SetFloat(float64(fneg()) * float64(rand.Float32())) + case reflect.String: + // ensure this string can test the extent of json string decoding + v.SetString(strings.Repeat(strconv.FormatInt(rand.Int63n(99), 10), rand.Intn(8)) + + "- ABC \x41=\x42 \u2318 - \r \b \f - \u2028 and \u2029 .") + default: + panic(fmt.Errorf("testRandomFillRV: unsupported type: %v", v.Kind())) + } +} + +func testMammoth(t *testing.T, name string, h Handle) { + testOnce.Do(testInitAll) + var b []byte + + var m, m2 TestMammoth + testRandomFillRV(reflect.ValueOf(&m).Elem()) + b = testMarshalErr(&m, h, t, "mammoth-"+name) + testUnmarshalErr(&m2, b, h, t, "mammoth-"+name) + testDeepEqualErr(&m, &m2, t, "mammoth-"+name) + + var mm, mm2 TestMammoth2Wrapper + testRandomFillRV(reflect.ValueOf(&mm).Elem()) + b = testMarshalErr(&mm, h, t, "mammoth2-"+name) + testUnmarshalErr(&mm2, b, h, t, "mammoth2-"+name) + testDeepEqualErr(&mm, &mm2, t, "mammoth2-"+name) + // testMammoth2(t, name, h) +} + +func testTime(t *testing.T, name string, h Handle) { + testOnce.Do(testInitAll) + // test time which uses the time.go implementation (ie Binc) + var tt, tt2 time.Time + // time in 1990 + tt = time.Unix(20*366*24*60*60, 1000*900).In(time.FixedZone("UGO", -5*60*60)) + // fmt.Printf("time tt: %v\n", tt) + b := testMarshalErr(tt, h, t, "time-"+name) + testUnmarshalErr(&tt2, b, h, t, "time-"+name) + // per go documentation, test time with .Equal not == + if !tt2.Equal(tt) { + logT(t, "%s: values not equal: 1: %v, 2: %v", name, tt2, tt) + failT(t) + } + // testDeepEqualErr(tt.UTC(), tt2, t, "time-"+name) +} + +func testUintToInt(t *testing.T, name string, h Handle) { + testOnce.Do(testInitAll) + var golden = [...]int64{ + 0, 1, 22, 333, 4444, 55555, 666666, + // msgpack ones + 24, 128, + // standard ones + math.MaxUint8, math.MaxUint8 + 4, math.MaxUint8 - 4, + math.MaxUint16, math.MaxUint16 + 4, math.MaxUint16 - 4, + math.MaxUint32, math.MaxUint32 + 4, math.MaxUint32 - 4, + math.MaxInt8, math.MaxInt8 + 4, math.MaxInt8 - 4, + math.MaxInt16, math.MaxInt16 + 4, math.MaxInt16 - 4, + math.MaxInt32, math.MaxInt32 + 4, math.MaxInt32 - 4, + math.MaxInt64, math.MaxInt64 - 4, + } + var ui uint64 + var fi float64 + var b []byte + for _, i := range golden { + ui = 0 + b = testMarshalErr(i, h, t, "int2uint-"+name) + testUnmarshalErr(&ui, b, h, t, "int2uint-"+name) + if ui != uint64(i) { + logT(t, "%s: values not equal: %v, %v", name, ui, uint64(i)) + failT(t) + } + i = 0 + b = testMarshalErr(ui, h, t, "uint2int-"+name) + testUnmarshalErr(&i, b, h, t, "uint2int-"+name) + if i != int64(ui) { + logT(t, "%s: values not equal: %v, %v", name, i, int64(ui)) + failT(t) + } + fi = 0 + b = testMarshalErr(i, h, t, "int2float-"+name) + testUnmarshalErr(&fi, b, h, t, "int2float-"+name) + if fi != float64(i) { + logT(t, "%s: values not equal: %v, %v", name, fi, float64(i)) + failT(t) + } + } +} + +func doTestDifferentMapOrSliceType(t *testing.T, name string, h Handle) { + testOnce.Do(testInitAll) + + // - maptype, slicetype: diff from map[string]intf, map[intf]intf or []intf, etc + // include map[interface{}]string where some keys are []byte. + // To test, take a sequence of []byte and string, and decode into []string and []interface. + // Also, decode into map[string]string, map[string]interface{}, map[interface{}]string + + bh := h.getBasicHandle() + oldM, oldS := bh.MapType, bh.SliceType + defer func() { bh.MapType, bh.SliceType = oldM, oldS }() + + var b []byte + + var vi = []interface{}{ + "hello 1", + []byte("hello 2"), + "hello 3", + []byte("hello 4"), + "hello 5", + } + var vs []string + var v2i, v2s testMbsT + var v2ss testMbsCustStrT + // encode it as a map or as a slice + for i, v := range vi { + vv, ok := v.(string) + if !ok { + vv = string(v.([]byte)) + } + vs = append(vs, vv) + v2i = append(v2i, v, strconv.FormatInt(int64(i+1), 10)) + v2s = append(v2s, vv, strconv.FormatInt(int64(i+1), 10)) + v2ss = append(v2ss, testCustomStringT(vv), testCustomStringT(strconv.FormatInt(int64(i+1), 10))) + } + + var v2d interface{} + + // encode vs as a list, and decode into a list and compare + var goldSliceS = []string{"hello 1", "hello 2", "hello 3", "hello 4", "hello 5"} + var goldSliceI = []interface{}{"hello 1", "hello 2", "hello 3", "hello 4", "hello 5"} + var goldSlice = []interface{}{goldSliceS, goldSliceI} + for j, g := range goldSlice { + bh.SliceType = reflect.TypeOf(g) + name := fmt.Sprintf("slice-%s-%v", name, j+1) + b = testMarshalErr(vs, h, t, name) + v2d = nil + // v2d = reflect.New(bh.SliceType).Elem().Interface() + testUnmarshalErr(&v2d, b, h, t, name) + testDeepEqualErr(v2d, goldSlice[j], t, name) + } + + // to ensure that we do not use fast-path for map[intf]string, use a custom string type (for goldMapIS). + // this will allow us to test out the path that sees a []byte where a map has an interface{} type, + // and convert it to a string for the decoded map key. + + // encode v2i as a map, and decode into a map and compare + var goldMapSS = map[string]string{"hello 1": "1", "hello 2": "2", "hello 3": "3", "hello 4": "4", "hello 5": "5"} + var goldMapSI = map[string]interface{}{"hello 1": "1", "hello 2": "2", "hello 3": "3", "hello 4": "4", "hello 5": "5"} + var goldMapIS = map[interface{}]testCustomStringT{"hello 1": "1", "hello 2": "2", "hello 3": "3", "hello 4": "4", "hello 5": "5"} + var goldMap = []interface{}{goldMapSS, goldMapSI, goldMapIS} + for j, g := range goldMap { + bh.MapType = reflect.TypeOf(g) + name := fmt.Sprintf("map-%s-%v", name, j+1) + // for formats that clearly differentiate binary from string, use v2i + // else use the v2s (with all strings, no []byte) + v2d = nil + // v2d = reflect.New(bh.MapType).Elem().Interface() + switch h.(type) { + case *MsgpackHandle, *BincHandle, *CborHandle: + b = testMarshalErr(v2i, h, t, name) + testUnmarshalErr(&v2d, b, h, t, name) + testDeepEqualErr(v2d, goldMap[j], t, name) + default: + b = testMarshalErr(v2s, h, t, name) + testUnmarshalErr(&v2d, b, h, t, name) + testDeepEqualErr(v2d, goldMap[j], t, name) + b = testMarshalErr(v2ss, h, t, name) + v2d = nil + testUnmarshalErr(&v2d, b, h, t, name) + testDeepEqualErr(v2d, goldMap[j], t, name) + } + } + +} + +func doTestScalars(t *testing.T, name string, h Handle) { + testOnce.Do(testInitAll) + + // for each scalar: + // - encode its ptr + // - encode it (non-ptr) + // - check that bytes are same + // - make a copy (using reflect) + // - check that same + // - set zero on it + // - check that its equal to 0 value + // - decode into new + // - compare to original + + bh := h.getBasicHandle() + if !bh.Canonical { + bh.Canonical = true + defer func() { bh.Canonical = false }() + } + + vi := []interface{}{ + int(0), + int8(0), + int16(0), + int32(0), + int64(0), + uint(0), + uint8(0), + uint16(0), + uint32(0), + uint64(0), + uintptr(0), + float32(0), + float64(0), + bool(false), + string(""), + []byte(nil), + } + for _, v := range fastpathAV { + vi = append(vi, reflect.Zero(v.rt).Interface()) + } + for _, v := range vi { + rv := reflect.New(reflect.TypeOf(v)).Elem() + testRandomFillRV(rv) + v = rv.Interface() + + rv2 := reflect.New(rv.Type()) + rv2.Elem().Set(rv) + vp := rv2.Interface() + + var tname string + switch rv.Kind() { + case reflect.Map: + tname = "map[" + rv.Type().Key().Name() + "]" + rv.Type().Elem().Name() + case reflect.Slice: + tname = "[]" + rv.Type().Elem().Name() + default: + tname = rv.Type().Name() + } + + var b, b1, b2 []byte + b1 = testMarshalErr(v, h, t, tname+"-enc") + // store b1 into b, as b1 slice is reused for next marshal + b = make([]byte, len(b1)) + copy(b, b1) + b2 = testMarshalErr(vp, h, t, tname+"-enc-ptr") + testDeepEqualErr(b1, b2, t, tname+"-enc-eq") + setZero(vp) + testDeepEqualErr(rv2.Elem().Interface(), reflect.Zero(rv.Type()).Interface(), t, tname+"-enc-eq-zero-ref") + + vp = rv2.Interface() + testUnmarshalErr(vp, b, h, t, tname+"-dec") + testDeepEqualErr(rv2.Elem().Interface(), v, t, tname+"-dec-eq") + } +} + +func doTestIntfMapping(t *testing.T, name string, h Handle) { + testOnce.Do(testInitAll) + rti := reflect.TypeOf((*testIntfMapI)(nil)).Elem() + defer func() { h.getBasicHandle().Intf2Impl(rti, nil) }() + + type T9 struct { + I testIntfMapI + } + + for i, v := range []testIntfMapI{ + // Use a valid string to test some extents of json string decoding + &testIntfMapT1{"ABC \x41=\x42 \u2318 - \r \b \f - \u2028 and \u2029 ."}, + testIntfMapT2{"DEF"}, + } { + if err := h.getBasicHandle().Intf2Impl(rti, reflect.TypeOf(v)); err != nil { + failT(t, "Error mapping %v to %T", rti, v) + } + var v1, v2 T9 + v1 = T9{v} + b := testMarshalErr(v1, h, t, name+"-enc-"+strconv.Itoa(i)) + testUnmarshalErr(&v2, b, h, t, name+"-dec-"+strconv.Itoa(i)) + testDeepEqualErr(v1, v2, t, name+"-dec-eq-"+strconv.Itoa(i)) + } +} + +// ----------------- + +func TestJsonDecodeNonStringScalarInStringContext(t *testing.T) { + testOnce.Do(testInitAll) + var b = `{"s.true": "true", "b.true": true, "s.false": "false", "b.false": false, "s.10": "10", "i.10": 10, "i.-10": -10}` + var golden = map[string]string{"s.true": "true", "b.true": "true", "s.false": "false", "b.false": "false", "s.10": "10", "i.10": "10", "i.-10": "-10"} + + var m map[string]string + d := NewDecoderBytes([]byte(b), testJsonH) + d.MustDecode(&m) + if err := deepEqual(golden, m); err == nil { + logT(t, "++++ match: decoded: %#v", m) + } else { + logT(t, "---- mismatch: %v ==> golden: %#v, decoded: %#v", err, golden, m) + failT(t) + } +} + +func TestJsonEncodeIndent(t *testing.T) { + testOnce.Do(testInitAll) + v := TestSimplish{ + Ii: -794, + Ss: `A Man is +after the new line + after new line and tab +`, + } + v2 := v + v.Mm = make(map[string]*TestSimplish) + for i := 0; i < len(v.Ar); i++ { + v3 := v2 + v3.Ii += (i * 4) + v3.Ss = fmt.Sprintf("%d - %s", v3.Ii, v3.Ss) + if i%2 == 0 { + v.Ar[i] = &v3 + } + // v3 = v2 + v.Sl = append(v.Sl, &v3) + v.Mm[strconv.FormatInt(int64(i), 10)] = &v3 + } + oldcan := testJsonH.Canonical + oldIndent := testJsonH.Indent + oldS2A := testJsonH.StructToArray + defer func() { + testJsonH.Canonical = oldcan + testJsonH.Indent = oldIndent + testJsonH.StructToArray = oldS2A + }() + testJsonH.Canonical = true + testJsonH.Indent = -1 + testJsonH.StructToArray = false + var bs []byte + NewEncoderBytes(&bs, testJsonH).MustEncode(&v) + txt1Tab := string(bs) + bs = nil + testJsonH.Indent = 120 + NewEncoderBytes(&bs, testJsonH).MustEncode(&v) + txtSpaces := string(bs) + // fmt.Printf("\n-----------\n%s\n------------\n%s\n-------------\n", txt1Tab, txtSpaces) + + goldenResultTab := `{ + "Ar": [ + { + "Ar": [ + null, + null + ], + "Ii": -794, + "Mm": null, + "Sl": null, + "Ss": "-794 - A Man is\nafter the new line\n\tafter new line and tab\n" + }, + null + ], + "Ii": -794, + "Mm": { + "0": { + "Ar": [ + null, + null + ], + "Ii": -794, + "Mm": null, + "Sl": null, + "Ss": "-794 - A Man is\nafter the new line\n\tafter new line and tab\n" + }, + "1": { + "Ar": [ + null, + null + ], + "Ii": -790, + "Mm": null, + "Sl": null, + "Ss": "-790 - A Man is\nafter the new line\n\tafter new line and tab\n" + } + }, + "Sl": [ + { + "Ar": [ + null, + null + ], + "Ii": -794, + "Mm": null, + "Sl": null, + "Ss": "-794 - A Man is\nafter the new line\n\tafter new line and tab\n" + }, + { + "Ar": [ + null, + null + ], + "Ii": -790, + "Mm": null, + "Sl": null, + "Ss": "-790 - A Man is\nafter the new line\n\tafter new line and tab\n" + } + ], + "Ss": "A Man is\nafter the new line\n\tafter new line and tab\n" +}` + + if txt1Tab != goldenResultTab { + logT(t, "decoded indented with tabs != expected: \nexpected: %s\nencoded: %s", goldenResultTab, txt1Tab) + failT(t) + } + if txtSpaces != strings.Replace(goldenResultTab, "\t", strings.Repeat(" ", 120), -1) { + logT(t, "decoded indented with spaces != expected: \nexpected: %s\nencoded: %s", goldenResultTab, txtSpaces) + failT(t) + } +} + +func TestBufioDecReader(t *testing.T) { + testOnce.Do(testInitAll) + // try to read 85 bytes in chunks of 7 at a time. + var s = strings.Repeat("01234'56789 ", 5) + // fmt.Printf("s: %s\n", s) + var r = strings.NewReader(s) + var br = &bufioDecReader{r: r, buf: make([]byte, 0, 13)} + b, err := ioutil.ReadAll(br) + if err != nil { + panic(err) + } + var s2 = string(b) + // fmt.Printf("s==s2: %v, len(s): %v, len(b): %v, len(s2): %v\n", s == s2, len(s), len(b), len(s2)) + if s != s2 { + logT(t, "not equal: \ns: %s\ns2: %s", s, s2) + failT(t) + } + // Now, test search functions for skip, readTo and readUntil + // readUntil ', readTo ', skip whitespace. 3 times in a loop, each time compare the token and/or outs + // readUntil: see: 56789 + var out []byte + var token byte + br = &bufioDecReader{r: strings.NewReader(s), buf: make([]byte, 0, 7)} + // println() + for _, v2 := range [...]string{ + `01234'`, + `56789 01234'`, + `56789 01234'`, + `56789 01234'`, + } { + out = br.readUntil(nil, '\'') + testDeepEqualErr(string(out), v2, t, "-") + // fmt.Printf("readUntil: out: `%s`\n", out) + } + br = &bufioDecReader{r: strings.NewReader(s), buf: make([]byte, 0, 7)} + // println() + for range [4]struct{}{} { + out = br.readTo(nil, &jsonNumSet) + testDeepEqualErr(string(out), `01234`, t, "-") + // fmt.Printf("readTo: out: `%s`\n", out) + out = br.readUntil(nil, '\'') + testDeepEqualErr(string(out), "'", t, "-") + // fmt.Printf("readUntil: out: `%s`\n", out) + out = br.readTo(nil, &jsonNumSet) + testDeepEqualErr(string(out), `56789`, t, "-") + // fmt.Printf("readTo: out: `%s`\n", out) + out = br.readUntil(nil, '0') + testDeepEqualErr(string(out), ` 0`, t, "-") + // fmt.Printf("readUntil: out: `%s`\n", out) + br.UnreadByte() + } + br = &bufioDecReader{r: strings.NewReader(s), buf: make([]byte, 0, 7)} + // println() + for range [4]struct{}{} { + out = br.readUntil(nil, ' ') + testDeepEqualErr(string(out), `01234'56789 `, t, "-") + // fmt.Printf("readUntil: out: |%s|\n", out) + token = br.skip(&jsonCharWhitespaceSet) + testDeepEqualErr(token, byte('0'), t, "-") + // fmt.Printf("skip: token: '%c'\n", token) + br.UnreadByte() + } + // println() +} + +// ----------- + +func TestJsonLargeInteger(t *testing.T) { + testOnce.Do(testInitAll) + for _, i := range []uint8{'L', 'A', 0} { + for _, j := range []interface{}{ + int64(1 << 60), + -int64(1 << 60), + 0, + 1 << 20, + -(1 << 20), + uint64(1 << 60), + uint(0), + uint(1 << 20), + } { + doTestJsonLargeInteger(t, j, i) + } + } +} + +func TestJsonInvalidUnicode(t *testing.T) { + testOnce.Do(testInitAll) + var m = map[string]string{ + `"\udc49\u0430abc"`: "\uFFFDabc", + `"\udc49\u0430"`: "\uFFFD", + `"\udc49abc"`: "\uFFFDabc", + `"\udc49"`: "\uFFFD", + `"\udZ49\u0430abc"`: "\uFFFD\u0430abc", + `"\udcG9\u0430"`: "\uFFFD\u0430", + `"\uHc49abc"`: "\uFFFDabc", + `"\uKc49"`: "\uFFFD", + // ``: "", + } + for k, v := range m { + // println("k = ", k) + var s string + testUnmarshalErr(&s, []byte(k), testJsonH, t, "-") + if s != v { + logT(t, "not equal: %q, %q", v, s) + failT(t) + } + } +} + +// ---------- + func TestBincCodecsTable(t *testing.T) { testCodecTableOne(t, testBincH) } @@ -1320,6 +2545,10 @@ func TestBincStdEncIntf(t *testing.T) { doTestStdEncIntf(t, "binc", testBincH) } +func TestBincMammoth(t *testing.T) { + testMammoth(t, "binc", testBincH) +} + func TestSimpleCodecsTable(t *testing.T) { testCodecTableOne(t, testSimpleH) } @@ -1336,6 +2565,10 @@ func TestSimpleStdEncIntf(t *testing.T) { doTestStdEncIntf(t, "simple", testSimpleH) } +func TestSimpleMammoth(t *testing.T) { + testMammoth(t, "simple", testSimpleH) +} + func TestMsgpackCodecsTable(t *testing.T) { testCodecTableOne(t, testMsgpackH) } @@ -1352,6 +2585,10 @@ func TestMsgpackStdEncIntf(t *testing.T) { doTestStdEncIntf(t, "msgpack", testMsgpackH) } +func TestMsgpackMammoth(t *testing.T) { + testMammoth(t, "msgpack", testMsgpackH) +} + func TestCborCodecsTable(t *testing.T) { testCodecTableOne(t, testCborH) } @@ -1376,6 +2613,10 @@ func TestCborStdEncIntf(t *testing.T) { doTestStdEncIntf(t, "cbor", testCborH) } +func TestCborMammoth(t *testing.T) { + testMammoth(t, "cbor", testCborH) +} + func TestJsonCodecsTable(t *testing.T) { testCodecTableOne(t, testJsonH) } @@ -1396,6 +2637,10 @@ func TestJsonStdEncIntf(t *testing.T) { doTestStdEncIntf(t, "json", testJsonH) } +func TestJsonMammoth(t *testing.T) { + testMammoth(t, "json", testJsonH) +} + // ----- Raw --------- func TestJsonRaw(t *testing.T) { doTestRawValue(t, "json", testJsonH) @@ -1453,53 +2698,270 @@ func TestBincUnderlyingType(t *testing.T) { testCodecUnderlyingType(t, testBincH) } -func TestJsonLargeInteger(t *testing.T) { - for _, i := range []uint8{'L', 'A', 0} { - for _, j := range []interface{}{ - int64(1 << 60), - -int64(1 << 60), - 0, - 1 << 20, - -(1 << 20), - uint64(1 << 60), - uint(0), - uint(1 << 20), - } { - doTestJsonLargeInteger(t, j, i) - } - } +func TestJsonSwallowAndZero(t *testing.T) { + doTestSwallowAndZero(t, testJsonH) } -func TestJsonDecodeNonStringScalarInStringContext(t *testing.T) { - var b = `{"s.true": "true", "b.true": true, "s.false": "false", "b.false": false, "s.10": "10", "i.10": 10, "i.-10": -10}` - var golden = map[string]string{"s.true": "true", "b.true": "true", "s.false": "false", "b.false": "false", "s.10": "10", "i.10": "10", "i.-10": "-10"} +func TestCborSwallowAndZero(t *testing.T) { + doTestSwallowAndZero(t, testCborH) +} - var m map[string]string - d := NewDecoderBytes([]byte(b), testJsonH) - d.MustDecode(&m) - if err := deepEqual(golden, m); err == nil { - logT(t, "++++ match: decoded: %#v", m) - } else { - logT(t, "---- mismatch: %v ==> golden: %#v, decoded: %#v", err, golden, m) - failT(t) - } +func TestMsgpackSwallowAndZero(t *testing.T) { + doTestSwallowAndZero(t, testMsgpackH) +} + +func TestBincSwallowAndZero(t *testing.T) { + doTestSwallowAndZero(t, testBincH) +} + +func TestSimpleSwallowAndZero(t *testing.T) { + doTestSwallowAndZero(t, testSimpleH) +} + +func TestJsonRawExt(t *testing.T) { + doTestRawExt(t, testJsonH) +} + +func TestCborRawExt(t *testing.T) { + doTestRawExt(t, testCborH) +} + +func TestMsgpackRawExt(t *testing.T) { + doTestRawExt(t, testMsgpackH) +} + +func TestBincRawExt(t *testing.T) { + doTestRawExt(t, testBincH) +} + +func TestSimpleRawExt(t *testing.T) { + doTestRawExt(t, testSimpleH) +} + +func TestJsonMapStructKey(t *testing.T) { + doTestMapStructKey(t, testJsonH) +} + +func TestCborMapStructKey(t *testing.T) { + doTestMapStructKey(t, testCborH) +} + +func TestMsgpackMapStructKey(t *testing.T) { + doTestMapStructKey(t, testMsgpackH) +} + +func TestBincMapStructKey(t *testing.T) { + doTestMapStructKey(t, testBincH) +} + +func TestSimpleMapStructKey(t *testing.T) { + doTestMapStructKey(t, testSimpleH) +} + +func TestJsonDecodeNilMapValue(t *testing.T) { + doTestDecodeNilMapValue(t, testJsonH) +} + +func TestCborDecodeNilMapValue(t *testing.T) { + doTestDecodeNilMapValue(t, testCborH) +} + +func TestMsgpackDecodeNilMapValue(t *testing.T) { + doTestDecodeNilMapValue(t, testMsgpackH) +} + +func TestBincDecodeNilMapValue(t *testing.T) { + doTestDecodeNilMapValue(t, testBincH) +} + +func TestSimpleDecodeNilMapValue(t *testing.T) { + doTestDecodeNilMapValue(t, testSimpleH) +} + +func TestJsonEmbeddedFieldPrecedence(t *testing.T) { + doTestEmbeddedFieldPrecedence(t, testJsonH) +} + +func TestCborEmbeddedFieldPrecedence(t *testing.T) { + doTestEmbeddedFieldPrecedence(t, testCborH) +} + +func TestMsgpackEmbeddedFieldPrecedence(t *testing.T) { + doTestEmbeddedFieldPrecedence(t, testMsgpackH) +} + +func TestBincEmbeddedFieldPrecedence(t *testing.T) { + doTestEmbeddedFieldPrecedence(t, testBincH) +} + +func TestSimpleEmbeddedFieldPrecedence(t *testing.T) { + doTestEmbeddedFieldPrecedence(t, testSimpleH) +} + +func TestJsonLargeContainerLen(t *testing.T) { + doTestLargeContainerLen(t, testJsonH) +} + +func TestCborLargeContainerLen(t *testing.T) { + doTestLargeContainerLen(t, testCborH) +} + +func TestMsgpackLargeContainerLen(t *testing.T) { + doTestLargeContainerLen(t, testMsgpackH) +} + +func TestBincLargeContainerLen(t *testing.T) { + doTestLargeContainerLen(t, testBincH) +} + +func TestSimpleLargeContainerLen(t *testing.T) { + doTestLargeContainerLen(t, testSimpleH) +} + +func TestJsonMammothMapsAndSlices(t *testing.T) { + doTestMammothMapsAndSlices(t, testJsonH) +} + +func TestCborMammothMapsAndSlices(t *testing.T) { + doTestMammothMapsAndSlices(t, testCborH) +} + +func TestMsgpackMammothMapsAndSlices(t *testing.T) { + old1, old2 := testMsgpackH.RawToString, testMsgpackH.WriteExt + defer func() { testMsgpackH.RawToString, testMsgpackH.WriteExt = old1, old2 }() + testMsgpackH.RawToString = true + testMsgpackH.WriteExt = true + + doTestMammothMapsAndSlices(t, testMsgpackH) +} + +func TestBincMammothMapsAndSlices(t *testing.T) { + doTestMammothMapsAndSlices(t, testBincH) +} + +func TestSimpleMammothMapsAndSlices(t *testing.T) { + doTestMammothMapsAndSlices(t, testSimpleH) +} + +func TestJsonTime(t *testing.T) { + testTime(t, "json", testJsonH) +} + +func TestCborTime(t *testing.T) { + testTime(t, "cbor", testCborH) +} + +func TestMsgpackTime(t *testing.T) { + testTime(t, "msgpack", testMsgpackH) +} + +func TestBincTime(t *testing.T) { + testTime(t, "binc", testBincH) +} + +func TestSimpleTime(t *testing.T) { + testTime(t, "simple", testSimpleH) +} + +func TestJsonUintToInt(t *testing.T) { + testUintToInt(t, "json", testJsonH) +} + +func TestCborUintToInt(t *testing.T) { + testUintToInt(t, "cbor", testCborH) +} + +func TestMsgpackUintToInt(t *testing.T) { + testUintToInt(t, "msgpack", testMsgpackH) +} + +func TestBincUintToInt(t *testing.T) { + testUintToInt(t, "binc", testBincH) +} + +func TestSimpleUintToInt(t *testing.T) { + testUintToInt(t, "simple", testSimpleH) +} + +func TestJsonDifferentMapOrSliceType(t *testing.T) { + doTestDifferentMapOrSliceType(t, "json", testJsonH) +} + +func TestCborDifferentMapOrSliceType(t *testing.T) { + doTestDifferentMapOrSliceType(t, "cbor", testCborH) +} + +func TestMsgpackDifferentMapOrSliceType(t *testing.T) { + doTestDifferentMapOrSliceType(t, "msgpack", testMsgpackH) +} + +func TestBincDifferentMapOrSliceType(t *testing.T) { + doTestDifferentMapOrSliceType(t, "binc", testBincH) +} + +func TestSimpleDifferentMapOrSliceType(t *testing.T) { + doTestDifferentMapOrSliceType(t, "simple", testSimpleH) +} + +func TestJsonScalars(t *testing.T) { + doTestScalars(t, "json", testJsonH) +} + +func TestCborScalars(t *testing.T) { + doTestScalars(t, "cbor", testCborH) +} + +func TestMsgpackScalars(t *testing.T) { + doTestScalars(t, "msgpack", testMsgpackH) +} + +func TestBincScalars(t *testing.T) { + doTestScalars(t, "binc", testBincH) +} + +func TestSimpleScalars(t *testing.T) { + doTestScalars(t, "simple", testSimpleH) +} + +func TestJsonIntfMapping(t *testing.T) { + doTestIntfMapping(t, "json", testJsonH) +} + +func TestCborIntfMapping(t *testing.T) { + doTestIntfMapping(t, "cbor", testCborH) +} + +func TestMsgpackIntfMapping(t *testing.T) { + doTestIntfMapping(t, "msgpack", testMsgpackH) +} + +func TestBincIntfMapping(t *testing.T) { + doTestIntfMapping(t, "binc", testBincH) +} + +func TestSimpleIntfMapping(t *testing.T) { + doTestIntfMapping(t, "simple", testSimpleH) } // TODO: -// Add Tests for: -// - decoding empty list/map in stream into a nil slice/map -// - binary(M|Unm)arsher support for time.Time (e.g. cbor encoding) -// - text(M|Unm)arshaler support for time.Time (e.g. json encoding) -// - non fast-path scenarios e.g. map[string]uint16, []customStruct. -// Expand cbor to include indefinite length stuff for this non-fast-path types. -// This may not be necessary, since we have the manual tests (fastpathEnabled=false) to test/validate with. -// - CodecSelfer -// Ensure it is called when (en|de)coding interface{} or reflect.Value (2 different codepaths). -// - interfaces: textMarshaler, binaryMarshaler, codecSelfer -// - struct tags: -// on anonymous fields, _struct (all fields), etc -// - codecgen of struct containing channels. -// - bad input with large array length prefix // -// Cleanup tests: -// - The are brittle in their handling of validation and skipping +// Add Tests for: +// - struct tags: on anonymous fields, _struct (all fields), etc +// - chan to encode and decode (with support for codecgen also) +// +// Add negative tests for failure conditions: +// - bad input with large array length prefix +// +// decode.go (standalone) +// - UnreadByte: only 2 states (z.ls = 2 and z.ls = 1) (0 --> 2 --> 1) +// - track: z.trb: track, stop track, check +// - PreferArrayOverSlice??? +// - InterfaceReset +// - (chan byte) to decode []byte (with mapbyslice track) +// - decode slice of len 6, 16 into slice of (len 4, cap 8) and (len ) with maxinitlen=6, 8, 16 +// - DeleteOnNilMapValue +// - decnaked: n.l == nil +// - ensureDecodeable (try to decode into a non-decodeable thing e.g. a nil interface{}, +// +// encode.go (standalone) +// - nil and 0-len slices and maps for non-fastpath things diff --git a/vendor/github.com/ugorji/go/codec/codecgen_test.go b/vendor/github.com/ugorji/go/codec/codecgen_test.go deleted file mode 100644 index 586af774b..000000000 --- a/vendor/github.com/ugorji/go/codec/codecgen_test.go +++ /dev/null @@ -1,24 +0,0 @@ -// +build x,codecgen - -package codec - -import ( - "fmt" - "testing" -) - -func _TestCodecgenJson1(t *testing.T) { - // This is just a simplistic test for codecgen. - // It is typically disabled. We only enable it for debugging purposes. - const callCodecgenDirect bool = true - v := newTestStruc(2, false, !testSkipIntf, false) - var bs []byte - e := NewEncoderBytes(&bs, testJsonH) - if callCodecgenDirect { - v.CodecEncodeSelf(e) - e.w.atEndOfEncode() - } else { - e.MustEncode(v) - } - fmt.Printf("%s\n", bs) -} diff --git a/vendor/github.com/ugorji/go/codec/decode.go b/vendor/github.com/ugorji/go/codec/decode.go index 2563668ba..148c609c1 100644 --- a/vendor/github.com/ugorji/go/codec/decode.go +++ b/vendor/github.com/ugorji/go/codec/decode.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -9,6 +9,8 @@ import ( "fmt" "io" "reflect" + "strconv" + "sync" "time" ) @@ -19,8 +21,17 @@ const ( ) var ( - onlyMapOrArrayCanDecodeIntoStructErr = errors.New("only encoded map or array can be decoded into a struct") - cannotDecodeIntoNilErr = errors.New("cannot decode into nil") + errstrOnlyMapOrArrayCanDecodeIntoStruct = "only encoded map or array can be decoded into a struct" + errstrCannotDecodeIntoNil = "cannot decode into nil" + + errmsgExpandSliceOverflow = "expand slice: slice overflow" + errmsgExpandSliceCannotChange = "expand slice: cannot change" + + errDecoderNotInitialized = errors.New("Decoder not initialized") + + errDecUnreadByteNothingToRead = errors.New("cannot unread - nothing has been read") + errDecUnreadByteLastByteNotRead = errors.New("cannot unread - last byte has not been read") + errDecUnreadByteUnknown = errors.New("cannot unread - reason unknown") ) // decReader abstracts the reading source, allowing implementations that can @@ -34,25 +45,29 @@ type decReader interface { readx(n int) []byte readb([]byte) readn1() uint8 - readn1eof() (v uint8, eof bool) numread() int // number of bytes read track() stopTrack() []byte -} -type decReaderByteScanner interface { - io.Reader - io.ByteScanner + // skip will skip any byte that matches, and return the first non-matching byte + skip(accept *bitset256) (token byte) + // readTo will read any byte that matches, stopping once no-longer matching. + readTo(in []byte, accept *bitset256) (out []byte) + // readUntil will read, only stopping once it matches the 'stop' byte. + readUntil(in []byte, stop byte) (out []byte) } type decDriver interface { // this will check if the next token is a break. CheckBreak() bool + // Note: TryDecodeAsNil should be careful not to share any temporary []byte with + // the rest of the decDriver. This is because sometimes, we optimize by holding onto + // a transient []byte, and ensuring the only other call we make to the decDriver + // during that time is maybe a TryDecodeAsNil() call. TryDecodeAsNil() bool // vt is one of: Bytes, String, Nil, Slice or Map. Return unSet if not known. ContainerType() (vt valueType) - IsBuiltinType(rt uintptr) bool - DecodeBuiltin(rt uintptr, v interface{}) + // IsBuiltinType(rt uintptr) bool // DecodeNaked will decode primitives (number, bool, string, []byte) and RawExt. // For maps and arrays, it will not do the decoding in-band, but will signal @@ -66,9 +81,15 @@ type decDriver interface { // extensions should also use readx to decode them, for efficiency. // kInterface will extract the detached byte slice if it has to pass it outside its realm. DecodeNaked() - DecodeInt(bitsize uint8) (i int64) - DecodeUint(bitsize uint8) (ui uint64) - DecodeFloat(chkOverflow32 bool) (f float64) + + // Deprecated: use DecodeInt64 and DecodeUint64 instead + // DecodeInt(bitsize uint8) (i int64) + // DecodeUint(bitsize uint8) (ui uint64) + + DecodeInt64() (i int64) + DecodeUint64() (ui uint64) + + DecodeFloat64() (f float64) DecodeBool() (b bool) // DecodeString can also decode symbols. // It looks redundant as DecodeBytes is available. @@ -76,45 +97,69 @@ type decDriver interface { // return a pre-stored string value, meaning that it can bypass // the cost of []byte->string conversion. DecodeString() (s string) + DecodeStringAsBytes() (v []byte) // DecodeBytes may be called directly, without going through reflection. // Consequently, it must be designed to handle possible nil. - DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut []byte) + DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) + // DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut []byte) // decodeExt will decode into a *RawExt or into an extension. DecodeExt(v interface{}, xtag uint64, ext Ext) (realxtag uint64) // decodeExt(verifyTag bool, tag byte) (xtag byte, xbs []byte) - ReadMapStart() int + + DecodeTime() (t time.Time) + ReadArrayStart() int + ReadArrayElem() + ReadArrayEnd() + ReadMapStart() int + ReadMapElemKey() + ReadMapElemValue() + ReadMapEnd() reset() uncacheRead() } -type decNoSeparator struct { -} +type decDriverNoopContainerReader struct{} -func (_ decNoSeparator) ReadEnd() {} +func (x decDriverNoopContainerReader) ReadArrayStart() (v int) { return } +func (x decDriverNoopContainerReader) ReadArrayElem() {} +func (x decDriverNoopContainerReader) ReadArrayEnd() {} +func (x decDriverNoopContainerReader) ReadMapStart() (v int) { return } +func (x decDriverNoopContainerReader) ReadMapElemKey() {} +func (x decDriverNoopContainerReader) ReadMapElemValue() {} +func (x decDriverNoopContainerReader) ReadMapEnd() {} +func (x decDriverNoopContainerReader) CheckBreak() (v bool) { return } -// func (_ decNoSeparator) uncacheRead() {} +// func (x decNoSeparator) uncacheRead() {} +// DecodeOptions captures configuration options during decode. type DecodeOptions struct { // MapType specifies type to use during schema-less decoding of a map in the stream. - // If nil, we use map[interface{}]interface{} + // If nil (unset), we default to map[string]interface{} iff json handle and MapStringAsKey=true, + // else map[interface{}]interface{}. MapType reflect.Type // SliceType specifies type to use during schema-less decoding of an array in the stream. - // If nil, we use []interface{} + // If nil (unset), we default to []interface{} for all formats. SliceType reflect.Type - // MaxInitLen defines the maxinum initial length that we "make" a collection (string, slice, map, chan). - // If 0 or negative, we default to a sensible value based on the size of an element in the collection. + // MaxInitLen defines the maxinum initial length that we "make" a collection + // (string, slice, map, chan). If 0 or negative, we default to a sensible value + // based on the size of an element in the collection. // // For example, when decoding, a stream may say that it has 2^64 elements. - // We should not auto-matically provision a slice of that length, to prevent Out-Of-Memory crash. + // We should not auto-matically provision a slice of that size, to prevent Out-Of-Memory crash. // Instead, we provision up to MaxInitLen, fill that up, and start appending after that. MaxInitLen int + // ReaderBufferSize is the size of the buffer used when reading. + // + // if > 0, we use a smart buffer internally for performance purposes. + ReaderBufferSize int + // If ErrorIfNoField, return an error when decoding a map // from a codec stream into a struct, and no matching struct field is found. ErrorIfNoField bool @@ -141,6 +186,11 @@ type DecodeOptions struct { // or is an interface. MapValueReset bool + // SliceElementReset: on decoding a slice, reset the element to a zero value first. + // + // concern: if the slice already contained some garbage, we will decode into that garbage. + SliceElementReset bool + // InterfaceReset controls how we decode into an interface. // // By default, when we see a field that is an interface{...}, @@ -174,20 +224,355 @@ type DecodeOptions struct { // *Note*: This only applies if using go1.5 and above, // as it requires reflect.ArrayOf support which was absent before go1.5. PreferArrayOverSlice bool + + // DeleteOnNilMapValue controls how to decode a nil value in the stream. + // + // If true, we will delete the mapping of the key. + // Else, just set the mapping to the zero value of the type. + DeleteOnNilMapValue bool } // ------------------------------------ -// ioDecByteScanner implements Read(), ReadByte(...), UnreadByte(...) methods -// of io.Reader, io.ByteScanner. -type ioDecByteScanner struct { - r io.Reader - l byte // last byte - ls byte // last byte status. 0: init-canDoNothing, 1: canRead, 2: canUnread - b [1]byte // tiny buffer for reading single bytes +type bufioDecReader struct { + buf []byte + r io.Reader + + c int // cursor + n int // num read + err error + + tr []byte + trb bool + b [4]byte } -func (z *ioDecByteScanner) Read(p []byte) (n int, err error) { +func (z *bufioDecReader) reset(r io.Reader) { + z.r, z.c, z.n, z.err, z.trb = r, 0, 0, nil, false + if z.tr != nil { + z.tr = z.tr[:0] + } +} + +func (z *bufioDecReader) Read(p []byte) (n int, err error) { + if z.err != nil { + return 0, z.err + } + p0 := p + n = copy(p, z.buf[z.c:]) + z.c += n + if z.c == len(z.buf) { + z.c = 0 + } + z.n += n + if len(p) == n { + if z.c == 0 { + z.buf = z.buf[:1] + z.buf[0] = p[len(p)-1] + z.c = 1 + } + if z.trb { + z.tr = append(z.tr, p0[:n]...) + } + return + } + p = p[n:] + var n2 int + // if we are here, then z.buf is all read + if len(p) > len(z.buf) { + n2, err = decReadFull(z.r, p) + n += n2 + z.n += n2 + z.err = err + // don't return EOF if some bytes were read. keep for next time. + if n > 0 && err == io.EOF { + err = nil + } + // always keep last byte in z.buf + z.buf = z.buf[:1] + z.buf[0] = p[len(p)-1] + z.c = 1 + if z.trb { + z.tr = append(z.tr, p0[:n]...) + } + return + } + // z.c is now 0, and len(p) <= len(z.buf) + for len(p) > 0 && z.err == nil { + // println("len(p) loop starting ... ") + z.c = 0 + z.buf = z.buf[0:cap(z.buf)] + n2, err = z.r.Read(z.buf) + if n2 > 0 { + if err == io.EOF { + err = nil + } + z.buf = z.buf[:n2] + n2 = copy(p, z.buf) + z.c = n2 + n += n2 + z.n += n2 + p = p[n2:] + } + z.err = err + // println("... len(p) loop done") + } + if z.c == 0 { + z.buf = z.buf[:1] + z.buf[0] = p[len(p)-1] + z.c = 1 + } + if z.trb { + z.tr = append(z.tr, p0[:n]...) + } + return +} + +func (z *bufioDecReader) ReadByte() (b byte, err error) { + z.b[0] = 0 + _, err = z.Read(z.b[:1]) + b = z.b[0] + return +} + +func (z *bufioDecReader) UnreadByte() (err error) { + if z.err != nil { + return z.err + } + if z.c > 0 { + z.c-- + z.n-- + if z.trb { + z.tr = z.tr[:len(z.tr)-1] + } + return + } + return errDecUnreadByteNothingToRead +} + +func (z *bufioDecReader) numread() int { + return z.n +} + +func (z *bufioDecReader) readx(n int) (bs []byte) { + if n <= 0 || z.err != nil { + return + } + if z.c+n <= len(z.buf) { + bs = z.buf[z.c : z.c+n] + z.n += n + z.c += n + if z.trb { + z.tr = append(z.tr, bs...) + } + return + } + bs = make([]byte, n) + _, err := z.Read(bs) + if err != nil { + panic(err) + } + return +} + +func (z *bufioDecReader) readb(bs []byte) { + _, err := z.Read(bs) + if err != nil { + panic(err) + } +} + +// func (z *bufioDecReader) readn1eof() (b uint8, eof bool) { +// b, err := z.ReadByte() +// if err != nil { +// if err == io.EOF { +// eof = true +// } else { +// panic(err) +// } +// } +// return +// } + +func (z *bufioDecReader) readn1() (b uint8) { + b, err := z.ReadByte() + if err != nil { + panic(err) + } + return +} + +func (z *bufioDecReader) search(in []byte, accept *bitset256, stop, flag uint8) (token byte, out []byte) { + // flag: 1 (skip), 2 (readTo), 4 (readUntil) + if flag == 4 { + for i := z.c; i < len(z.buf); i++ { + if z.buf[i] == stop { + token = z.buf[i] + z.n = z.n + (i - z.c) - 1 + i++ + out = z.buf[z.c:i] + if z.trb { + z.tr = append(z.tr, z.buf[z.c:i]...) + } + z.c = i + return + } + } + } else { + for i := z.c; i < len(z.buf); i++ { + if !accept.isset(z.buf[i]) { + token = z.buf[i] + z.n = z.n + (i - z.c) - 1 + if flag == 1 { + i++ + } else { + out = z.buf[z.c:i] + } + if z.trb { + z.tr = append(z.tr, z.buf[z.c:i]...) + } + z.c = i + return + } + } + } + z.n += len(z.buf) - z.c + if flag != 1 { + out = append(in, z.buf[z.c:]...) + } + if z.trb { + z.tr = append(z.tr, z.buf[z.c:]...) + } + var n2 int + if z.err != nil { + return + } + for { + z.c = 0 + z.buf = z.buf[0:cap(z.buf)] + n2, z.err = z.r.Read(z.buf) + if n2 > 0 && z.err != nil { + z.err = nil + } + z.buf = z.buf[:n2] + if flag == 4 { + for i := 0; i < n2; i++ { + if z.buf[i] == stop { + token = z.buf[i] + z.n += i - 1 + i++ + out = append(out, z.buf[z.c:i]...) + if z.trb { + z.tr = append(z.tr, z.buf[z.c:i]...) + } + z.c = i + return + } + } + } else { + for i := 0; i < n2; i++ { + if !accept.isset(z.buf[i]) { + token = z.buf[i] + z.n += i - 1 + if flag == 1 { + i++ + } + if flag != 1 { + out = append(out, z.buf[z.c:i]...) + } + if z.trb { + z.tr = append(z.tr, z.buf[z.c:i]...) + } + z.c = i + return + } + } + } + if flag != 1 { + out = append(out, z.buf[:n2]...) + } + z.n += n2 + if z.err != nil { + return + } + if z.trb { + z.tr = append(z.tr, z.buf[:n2]...) + } + } +} + +func (z *bufioDecReader) skip(accept *bitset256) (token byte) { + token, _ = z.search(nil, accept, 0, 1) + return +} + +func (z *bufioDecReader) readTo(in []byte, accept *bitset256) (out []byte) { + _, out = z.search(in, accept, 0, 2) + return +} + +func (z *bufioDecReader) readUntil(in []byte, stop byte) (out []byte) { + _, out = z.search(in, nil, stop, 4) + return +} + +func (z *bufioDecReader) unreadn1() { + err := z.UnreadByte() + if err != nil { + panic(err) + } +} + +func (z *bufioDecReader) track() { + if z.tr != nil { + z.tr = z.tr[:0] + } + z.trb = true +} + +func (z *bufioDecReader) stopTrack() (bs []byte) { + z.trb = false + return z.tr +} + +// ioDecReader is a decReader that reads off an io.Reader. +// +// It also has a fallback implementation of ByteScanner if needed. +type ioDecReader struct { + r io.Reader // the reader passed in + + rr io.Reader + br io.ByteScanner + + l byte // last byte + ls byte // last byte status. 0: init-canDoNothing, 1: canRead, 2: canUnread + trb bool // tracking bytes turned on + _ bool + b [4]byte // tiny buffer for reading single bytes + + x [scratchByteArrayLen]byte // for: get struct field name, swallow valueTypeBytes, etc + n int // num read + tr []byte // tracking bytes read +} + +func (z *ioDecReader) reset(r io.Reader) { + z.r = r + z.rr = r + z.l, z.ls, z.n, z.trb = 0, 0, 0, false + if z.tr != nil { + z.tr = z.tr[:0] + } + var ok bool + if z.br, ok = r.(io.ByteScanner); !ok { + z.br = z + z.rr = z + } +} + +func (z *ioDecReader) Read(p []byte) (n int, err error) { + if len(p) == 0 { + return + } var firstByte bool if z.ls == 1 { z.ls = 2 @@ -213,8 +598,8 @@ func (z *ioDecByteScanner) Read(p []byte) (n int, err error) { return } -func (z *ioDecByteScanner) ReadByte() (c byte, err error) { - n, err := z.Read(z.b[:]) +func (z *ioDecReader) ReadByte() (c byte, err error) { + n, err := z.Read(z.b[:1]) if n == 1 { c = z.b[0] if err == io.EOF { @@ -224,30 +609,20 @@ func (z *ioDecByteScanner) ReadByte() (c byte, err error) { return } -func (z *ioDecByteScanner) UnreadByte() (err error) { - x := z.ls - if x == 0 { - err = errors.New("cannot unread - nothing has been read") - } else if x == 1 { - err = errors.New("cannot unread - last byte has not been read") - } else if x == 2 { +func (z *ioDecReader) UnreadByte() (err error) { + switch z.ls { + case 2: z.ls = 1 + case 0: + err = errDecUnreadByteNothingToRead + case 1: + err = errDecUnreadByteLastByteNotRead + default: + err = errDecUnreadByteUnknown } return } -// ioDecReader is a decReader that reads off an io.Reader -type ioDecReader struct { - br decReaderByteScanner - // temp byte array re-used internally for efficiency during read. - // shares buffer with Decoder, so we keep size of struct within 8 words. - x *[scratchByteArrayLen]byte - bs ioDecByteScanner - n int // num read - tr []byte // tracking bytes read - trb bool -} - func (z *ioDecReader) numread() int { return z.n } @@ -261,7 +636,7 @@ func (z *ioDecReader) readx(n int) (bs []byte) { } else { bs = make([]byte, n) } - if _, err := io.ReadAtLeast(z.br, bs, n); err != nil { + if _, err := decReadFull(z.rr, bs); err != nil { panic(err) } z.n += len(bs) @@ -272,31 +647,18 @@ func (z *ioDecReader) readx(n int) (bs []byte) { } func (z *ioDecReader) readb(bs []byte) { - if len(bs) == 0 { - return - } - n, err := io.ReadAtLeast(z.br, bs, len(bs)) - z.n += n - if err != nil { + // if len(bs) == 0 { + // return + // } + if _, err := decReadFull(z.rr, bs); err != nil { panic(err) } + z.n += len(bs) if z.trb { z.tr = append(z.tr, bs...) } } -func (z *ioDecReader) readn1() (b uint8) { - b, err := z.br.ReadByte() - if err != nil { - panic(err) - } - z.n++ - if z.trb { - z.tr = append(z.tr, b) - } - return b -} - func (z *ioDecReader) readn1eof() (b uint8, eof bool) { b, err := z.br.ReadByte() if err == nil { @@ -312,6 +674,62 @@ func (z *ioDecReader) readn1eof() (b uint8, eof bool) { return } +func (z *ioDecReader) readn1() (b uint8) { + var err error + if b, err = z.br.ReadByte(); err == nil { + z.n++ + if z.trb { + z.tr = append(z.tr, b) + } + return + } + panic(err) +} + +func (z *ioDecReader) skip(accept *bitset256) (token byte) { + for { + var eof bool + token, eof = z.readn1eof() + if eof { + return + } + if accept.isset(token) { + continue + } + return + } +} + +func (z *ioDecReader) readTo(in []byte, accept *bitset256) (out []byte) { + out = in + for { + token, eof := z.readn1eof() + if eof { + return + } + if accept.isset(token) { + out = append(out, token) + } else { + z.unreadn1() + return + } + } +} + +func (z *ioDecReader) readUntil(in []byte, stop byte) (out []byte) { + out = in + for { + token, eof := z.readn1eof() + if eof { + panic(io.EOF) + } + out = append(out, token) + if token == stop { + return + } + } +} + func (z *ioDecReader) unreadn1() { err := z.br.UnreadByte() if err != nil { @@ -339,7 +757,7 @@ func (z *ioDecReader) stopTrack() (bs []byte) { // ------------------------------------ -var bytesDecReaderCannotUnreadErr = errors.New("cannot unread last byte read") +var errBytesDecReaderCannotUnread = errors.New("cannot unread last byte read") // bytesDecReader is a decReader that reads off a byte slice with zero copying type bytesDecReader struct { @@ -362,7 +780,7 @@ func (z *bytesDecReader) numread() int { func (z *bytesDecReader) unreadn1() { if z.c == 0 || len(z.b) == 0 { - panic(bytesDecReaderCannotUnreadErr) + panic(errBytesDecReaderCannotUnread) } z.c-- z.a++ @@ -388,6 +806,10 @@ func (z *bytesDecReader) readx(n int) (bs []byte) { return } +func (z *bytesDecReader) readb(bs []byte) { + copy(bs, z.readx(len(bs))) +} + func (z *bytesDecReader) readn1() (v uint8) { if z.a == 0 { panic(io.EOF) @@ -398,19 +820,69 @@ func (z *bytesDecReader) readn1() (v uint8) { return } -func (z *bytesDecReader) readn1eof() (v uint8, eof bool) { +// func (z *bytesDecReader) readn1eof() (v uint8, eof bool) { +// if z.a == 0 { +// eof = true +// return +// } +// v = z.b[z.c] +// z.c++ +// z.a-- +// return +// } + +func (z *bytesDecReader) skip(accept *bitset256) (token byte) { if z.a == 0 { - eof = true return } - v = z.b[z.c] - z.c++ - z.a-- + blen := len(z.b) + for i := z.c; i < blen; i++ { + if !accept.isset(z.b[i]) { + token = z.b[i] + i++ + z.a -= (i - z.c) + z.c = i + return + } + } + z.a, z.c = 0, blen return } -func (z *bytesDecReader) readb(bs []byte) { - copy(bs, z.readx(len(bs))) +func (z *bytesDecReader) readTo(_ []byte, accept *bitset256) (out []byte) { + if z.a == 0 { + return + } + blen := len(z.b) + for i := z.c; i < blen; i++ { + if !accept.isset(z.b[i]) { + out = z.b[z.c:i] + z.a -= (i - z.c) + z.c = i + return + } + } + out = z.b[z.c:] + z.a, z.c = 0, blen + return +} + +func (z *bytesDecReader) readUntil(_ []byte, stop byte) (out []byte) { + if z.a == 0 { + panic(io.EOF) + } + blen := len(z.b) + for i := z.c; i < blen; i++ { + if z.b[i] == stop { + i++ + out = z.b[z.c:i] + z.a -= (i - z.c) + z.c = i + return + } + } + z.a, z.c = 0, blen + panic(io.EOF) } func (z *bytesDecReader) track() { @@ -421,172 +893,66 @@ func (z *bytesDecReader) stopTrack() (bs []byte) { return z.b[z.t:z.c] } -// ------------------------------------ - -type decFnInfo struct { - d *Decoder - ti *typeInfo - xfFn Ext - xfTag uint64 - seq seqType -} - // ---------------------------------------- -type decFn struct { - i decFnInfo - f func(*decFnInfo, reflect.Value) +// func (d *Decoder) builtin(f *codecFnInfo, rv reflect.Value) { +// d.d.DecodeBuiltin(f.ti.rtid, rv2i(rv)) +// } + +func (d *Decoder) rawExt(f *codecFnInfo, rv reflect.Value) { + d.d.DecodeExt(rv2i(rv), 0, nil) } -func (f *decFnInfo) builtin(rv reflect.Value) { - f.d.d.DecodeBuiltin(f.ti.rtid, rv.Addr().Interface()) +func (d *Decoder) ext(f *codecFnInfo, rv reflect.Value) { + d.d.DecodeExt(rv2i(rv), f.xfTag, f.xfFn) } -func (f *decFnInfo) rawExt(rv reflect.Value) { - f.d.d.DecodeExt(rv.Addr().Interface(), 0, nil) +func (d *Decoder) selferUnmarshal(f *codecFnInfo, rv reflect.Value) { + rv2i(rv).(Selfer).CodecDecodeSelf(d) } -func (f *decFnInfo) raw(rv reflect.Value) { - rv.SetBytes(f.d.raw()) -} - -func (f *decFnInfo) ext(rv reflect.Value) { - f.d.d.DecodeExt(rv.Addr().Interface(), f.xfTag, f.xfFn) -} - -func (f *decFnInfo) getValueForUnmarshalInterface(rv reflect.Value, indir int8) (v interface{}) { - if indir == -1 { - v = rv.Addr().Interface() - } else if indir == 0 { - v = rv.Interface() - } else { - for j := int8(0); j < indir; j++ { - if rv.IsNil() { - rv.Set(reflect.New(rv.Type().Elem())) - } - rv = rv.Elem() - } - v = rv.Interface() - } - return -} - -func (f *decFnInfo) selferUnmarshal(rv reflect.Value) { - f.getValueForUnmarshalInterface(rv, f.ti.csIndir).(Selfer).CodecDecodeSelf(f.d) -} - -func (f *decFnInfo) binaryUnmarshal(rv reflect.Value) { - bm := f.getValueForUnmarshalInterface(rv, f.ti.bunmIndir).(encoding.BinaryUnmarshaler) - xbs := f.d.d.DecodeBytes(nil, false, true) +func (d *Decoder) binaryUnmarshal(f *codecFnInfo, rv reflect.Value) { + bm := rv2i(rv).(encoding.BinaryUnmarshaler) + xbs := d.d.DecodeBytes(nil, true) if fnerr := bm.UnmarshalBinary(xbs); fnerr != nil { panic(fnerr) } } -func (f *decFnInfo) textUnmarshal(rv reflect.Value) { - tm := f.getValueForUnmarshalInterface(rv, f.ti.tunmIndir).(encoding.TextUnmarshaler) - fnerr := tm.UnmarshalText(f.d.d.DecodeBytes(f.d.b[:], true, true)) +func (d *Decoder) textUnmarshal(f *codecFnInfo, rv reflect.Value) { + tm := rv2i(rv).(encoding.TextUnmarshaler) + fnerr := tm.UnmarshalText(d.d.DecodeStringAsBytes()) if fnerr != nil { panic(fnerr) } } -func (f *decFnInfo) jsonUnmarshal(rv reflect.Value) { - tm := f.getValueForUnmarshalInterface(rv, f.ti.junmIndir).(jsonUnmarshaler) - // bs := f.d.d.DecodeBytes(f.d.b[:], true, true) +func (d *Decoder) jsonUnmarshal(f *codecFnInfo, rv reflect.Value) { + tm := rv2i(rv).(jsonUnmarshaler) + // bs := d.d.DecodeBytes(d.b[:], true, true) // grab the bytes to be read, as UnmarshalJSON needs the full JSON so as to unmarshal it itself. - fnerr := tm.UnmarshalJSON(f.d.nextValueBytes()) + fnerr := tm.UnmarshalJSON(d.nextValueBytes()) if fnerr != nil { panic(fnerr) } } -func (f *decFnInfo) kErr(rv reflect.Value) { - f.d.errorf("no decoding function defined for kind %v", rv.Kind()) +func (d *Decoder) kErr(f *codecFnInfo, rv reflect.Value) { + d.errorf("no decoding function defined for kind %v", rv.Kind()) } -func (f *decFnInfo) kString(rv reflect.Value) { - rv.SetString(f.d.d.DecodeString()) -} - -func (f *decFnInfo) kBool(rv reflect.Value) { - rv.SetBool(f.d.d.DecodeBool()) -} - -func (f *decFnInfo) kInt(rv reflect.Value) { - rv.SetInt(f.d.d.DecodeInt(intBitsize)) -} - -func (f *decFnInfo) kInt64(rv reflect.Value) { - rv.SetInt(f.d.d.DecodeInt(64)) -} - -func (f *decFnInfo) kInt32(rv reflect.Value) { - rv.SetInt(f.d.d.DecodeInt(32)) -} - -func (f *decFnInfo) kInt8(rv reflect.Value) { - rv.SetInt(f.d.d.DecodeInt(8)) -} - -func (f *decFnInfo) kInt16(rv reflect.Value) { - rv.SetInt(f.d.d.DecodeInt(16)) -} - -func (f *decFnInfo) kFloat32(rv reflect.Value) { - rv.SetFloat(f.d.d.DecodeFloat(true)) -} - -func (f *decFnInfo) kFloat64(rv reflect.Value) { - rv.SetFloat(f.d.d.DecodeFloat(false)) -} - -func (f *decFnInfo) kUint8(rv reflect.Value) { - rv.SetUint(f.d.d.DecodeUint(8)) -} - -func (f *decFnInfo) kUint64(rv reflect.Value) { - rv.SetUint(f.d.d.DecodeUint(64)) -} - -func (f *decFnInfo) kUint(rv reflect.Value) { - rv.SetUint(f.d.d.DecodeUint(uintBitsize)) -} - -func (f *decFnInfo) kUintptr(rv reflect.Value) { - rv.SetUint(f.d.d.DecodeUint(uintBitsize)) -} - -func (f *decFnInfo) kUint32(rv reflect.Value) { - rv.SetUint(f.d.d.DecodeUint(32)) -} - -func (f *decFnInfo) kUint16(rv reflect.Value) { - rv.SetUint(f.d.d.DecodeUint(16)) -} - -// func (f *decFnInfo) kPtr(rv reflect.Value) { -// debugf(">>>>>>> ??? decode kPtr called - shouldn't get called") -// if rv.IsNil() { -// rv.Set(reflect.New(rv.Type().Elem())) -// } -// f.d.decodeValue(rv.Elem()) -// } - // var kIntfCtr uint64 -func (f *decFnInfo) kInterfaceNaked() (rvn reflect.Value) { +func (d *Decoder) kInterfaceNaked(f *codecFnInfo) (rvn reflect.Value) { // nil interface: // use some hieristics to decode it appropriately // based on the detected next value in the stream. - d := f.d + n := d.naked() d.d.DecodeNaked() - n := &d.n if n.v == valueTypeNil { return } // We cannot decode non-nil stream value into nil interface with methods (e.g. io.Reader). - // if num := f.ti.rt.NumMethod(); num > 0 { if f.ti.numMeth > 0 { d.errorf("cannot decode non-nil codec value into nil %v (%v methods)", f.ti.rt, f.ti.numMeth) return @@ -594,272 +960,311 @@ func (f *decFnInfo) kInterfaceNaked() (rvn reflect.Value) { // var useRvn bool switch n.v { case valueTypeMap: - // if d.h.MapType == nil || d.h.MapType == mapIntfIntfTyp { - // } else if d.h.MapType == mapStrIntfTyp { // for json performance - // } - if d.mtid == 0 || d.mtid == mapIntfIntfTypId { - l := len(n.ms) - n.ms = append(n.ms, nil) - var v2 interface{} = &n.ms[l] - d.decode(v2) - rvn = reflect.ValueOf(v2).Elem() - n.ms = n.ms[:l] - } else if d.mtid == mapStrIntfTypId { // for json performance - l := len(n.ns) - n.ns = append(n.ns, nil) - var v2 interface{} = &n.ns[l] - d.decode(v2) - rvn = reflect.ValueOf(v2).Elem() - n.ns = n.ns[:l] - } else { - rvn = reflect.New(d.h.MapType).Elem() - d.decodeValue(rvn, nil) + // if json, default to a map type with string keys + mtid := d.mtid + if mtid == 0 { + if d.jsms { + mtid = mapStrIntfTypId + } else { + mtid = mapIntfIntfTypId + } } - case valueTypeArray: - // if d.h.SliceType == nil || d.h.SliceType == intfSliceTyp { - if d.stid == 0 || d.stid == intfSliceTypId { - l := len(n.ss) - n.ss = append(n.ss, nil) - var v2 interface{} = &n.ss[l] - d.decode(v2) - n.ss = n.ss[:l] - rvn = reflect.ValueOf(v2).Elem() - if reflectArrayOfSupported && d.stid == 0 && d.h.PreferArrayOverSlice { - rvn = reflectArrayOf(rvn) + if mtid == mapIntfIntfTypId { + n.initContainers() + if n.lm < arrayCacheLen { + n.ma[n.lm] = nil + rvn = n.rma[n.lm] + n.lm++ + d.decode(&n.ma[n.lm-1]) + n.lm-- + } else { + var v2 map[interface{}]interface{} + d.decode(&v2) + rvn = reflect.ValueOf(&v2).Elem() + } + } else if mtid == mapStrIntfTypId { // for json performance + n.initContainers() + if n.ln < arrayCacheLen { + n.na[n.ln] = nil + rvn = n.rna[n.ln] + n.ln++ + d.decode(&n.na[n.ln-1]) + n.ln-- + } else { + var v2 map[string]interface{} + d.decode(&v2) + rvn = reflect.ValueOf(&v2).Elem() } } else { - rvn = reflect.New(d.h.SliceType).Elem() - d.decodeValue(rvn, nil) + if d.mtr { + rvn = reflect.New(d.h.MapType) + d.decode(rv2i(rvn)) + rvn = rvn.Elem() + } else { + rvn = reflect.New(d.h.MapType).Elem() + d.decodeValue(rvn, nil, true) + } + } + case valueTypeArray: + if d.stid == 0 || d.stid == intfSliceTypId { + n.initContainers() + if n.ls < arrayCacheLen { + n.sa[n.ls] = nil + rvn = n.rsa[n.ls] + n.ls++ + d.decode(&n.sa[n.ls-1]) + n.ls-- + } else { + var v2 []interface{} + d.decode(&v2) + rvn = reflect.ValueOf(&v2).Elem() + } + if reflectArrayOfSupported && d.stid == 0 && d.h.PreferArrayOverSlice { + rvn2 := reflect.New(reflectArrayOf(rvn.Len(), intfTyp)).Elem() + reflect.Copy(rvn2, rvn) + rvn = rvn2 + } + } else { + if d.str { + rvn = reflect.New(d.h.SliceType) + d.decode(rv2i(rvn)) + rvn = rvn.Elem() + } else { + rvn = reflect.New(d.h.SliceType).Elem() + d.decodeValue(rvn, nil, true) + } } case valueTypeExt: var v interface{} tag, bytes := n.u, n.l // calling decode below might taint the values if bytes == nil { - l := len(n.is) - n.is = append(n.is, nil) - v2 := &n.is[l] - d.decode(v2) - v = *v2 - n.is = n.is[:l] + n.initContainers() + if n.li < arrayCacheLen { + n.ia[n.li] = nil + n.li++ + d.decode(&n.ia[n.li-1]) + // v = *(&n.ia[l]) + n.li-- + v = n.ia[n.li] + n.ia[n.li] = nil + } else { + d.decode(&v) + } } bfn := d.h.getExtForTag(tag) if bfn == nil { var re RawExt re.Tag = tag re.Data = detachZeroCopyBytes(d.bytes, nil, bytes) - rvn = reflect.ValueOf(re) + re.Value = v + rvn = reflect.ValueOf(&re).Elem() } else { rvnA := reflect.New(bfn.rt) - rvn = rvnA.Elem() if bytes != nil { - bfn.ext.ReadExt(rvnA.Interface(), bytes) + bfn.ext.ReadExt(rv2i(rvnA), bytes) } else { - bfn.ext.UpdateExt(rvnA.Interface(), v) + bfn.ext.UpdateExt(rv2i(rvnA), v) } + rvn = rvnA.Elem() } case valueTypeNil: // no-op case valueTypeInt: - rvn = reflect.ValueOf(&n.i).Elem() + rvn = n.ri case valueTypeUint: - rvn = reflect.ValueOf(&n.u).Elem() + rvn = n.ru case valueTypeFloat: - rvn = reflect.ValueOf(&n.f).Elem() + rvn = n.rf case valueTypeBool: - rvn = reflect.ValueOf(&n.b).Elem() + rvn = n.rb case valueTypeString, valueTypeSymbol: - rvn = reflect.ValueOf(&n.s).Elem() + rvn = n.rs case valueTypeBytes: - rvn = reflect.ValueOf(&n.l).Elem() - case valueTypeTimestamp: - rvn = reflect.ValueOf(&n.t).Elem() + rvn = n.rl + case valueTypeTime: + rvn = n.rt default: - panic(fmt.Errorf("kInterfaceNaked: unexpected valueType: %d", n.v)) + panicv.errorf("kInterfaceNaked: unexpected valueType: %d", n.v) } return } -func (f *decFnInfo) kInterface(rv reflect.Value) { - // debugf("\t===> kInterface") - +func (d *Decoder) kInterface(f *codecFnInfo, rv reflect.Value) { // Note: // A consequence of how kInterface works, is that // if an interface already contains something, we try // to decode into what was there before. // We do not replace with a generic value (as got from decodeNaked). + // every interface passed here MUST be settable. var rvn reflect.Value - if rv.IsNil() { - rvn = f.kInterfaceNaked() - if rvn.IsValid() { - rv.Set(rvn) - } - } else if f.d.h.InterfaceReset { - rvn = f.kInterfaceNaked() + if rv.IsNil() || d.h.InterfaceReset { + // check if mapping to a type: if so, initialize it and move on + rvn = d.h.intf2impl(f.ti.rtid) if rvn.IsValid() { rv.Set(rvn) } else { - // reset to zero value based on current type in there. - rv.Set(reflect.Zero(rv.Elem().Type())) + rvn = d.kInterfaceNaked(f) + if rvn.IsValid() { + rv.Set(rvn) + } else if d.h.InterfaceReset { + // reset to zero value based on current type in there. + rv.Set(reflect.Zero(rv.Elem().Type())) + } + return } } else { + // now we have a non-nil interface value, meaning it contains a type rvn = rv.Elem() - // Note: interface{} is settable, but underlying type may not be. - // Consequently, we have to set the reflect.Value directly. - // if underlying type is settable (e.g. ptr or interface), - // we just decode into it. - // Else we create a settable value, decode into it, and set on the interface. - if rvn.CanSet() { - f.d.decodeValue(rvn, nil) - } else { - rvn2 := reflect.New(rvn.Type()).Elem() - rvn2.Set(rvn) - f.d.decodeValue(rvn2, nil) - rv.Set(rvn2) - } } + if d.d.TryDecodeAsNil() { + rv.Set(reflect.Zero(rvn.Type())) + return + } + + // Note: interface{} is settable, but underlying type may not be. + // Consequently, we MAY have to create a decodable value out of the underlying value, + // decode into it, and reset the interface itself. + // fmt.Printf(">>>> kInterface: rvn type: %v, rv type: %v\n", rvn.Type(), rv.Type()) + + rvn2, canDecode := isDecodeable(rvn) + if canDecode { + d.decodeValue(rvn2, nil, true) + return + } + + rvn2 = reflect.New(rvn.Type()).Elem() + rvn2.Set(rvn) + d.decodeValue(rvn2, nil, true) + rv.Set(rvn2) } -func (f *decFnInfo) kStruct(rv reflect.Value) { +func decStructFieldKey(dd decDriver, keyType valueType, b *[decScratchByteArrayLen]byte) (rvkencname []byte) { + // use if-else-if, not switch (which compiles to binary-search) + // since keyType is typically valueTypeString, branch prediction is pretty good. + + if keyType == valueTypeString { + rvkencname = dd.DecodeStringAsBytes() + } else if keyType == valueTypeInt { + rvkencname = strconv.AppendInt(b[:0], dd.DecodeInt64(), 10) + } else if keyType == valueTypeUint { + rvkencname = strconv.AppendUint(b[:0], dd.DecodeUint64(), 10) + } else if keyType == valueTypeFloat { + rvkencname = strconv.AppendFloat(b[:0], dd.DecodeFloat64(), 'f', -1, 64) + } else { + rvkencname = dd.DecodeStringAsBytes() + } + return rvkencname +} + +func (d *Decoder) kStruct(f *codecFnInfo, rv reflect.Value) { fti := f.ti - d := f.d dd := d.d - cr := d.cr + elemsep := d.esep + sfn := structFieldNode{v: rv, update: true} ctyp := dd.ContainerType() if ctyp == valueTypeMap { containerLen := dd.ReadMapStart() if containerLen == 0 { - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return } - tisfi := fti.sfi + tisfi := fti.sfiSort hasLen := containerLen >= 0 - if hasLen { - for j := 0; j < containerLen; j++ { - // rvkencname := dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapKey) - } - rvkencnameB := dd.DecodeBytes(f.d.b[:], true, true) - rvkencname := stringView(rvkencnameB) - // rvksi := ti.getForEncName(rvkencname) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if k := fti.indexForEncName(rvkencname); k > -1 { - si := tisfi[k] - if dd.TryDecodeAsNil() { - si.setToZeroValue(rv) - } else { - d.decodeValue(si.field(rv, true), nil) - } - } else { - d.structFieldNotFound(-1, rvkencname) - } - keepAlive4StringView(rvkencnameB) // maintain ref 4 stringView + + var rvkencname []byte + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if elemsep { + dd.ReadMapElemKey() } - } else { - for j := 0; !dd.CheckBreak(); j++ { - // rvkencname := dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapKey) - } - rvkencnameB := dd.DecodeBytes(f.d.b[:], true, true) - rvkencname := stringView(rvkencnameB) - // rvksi := ti.getForEncName(rvkencname) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if k := fti.indexForEncName(rvkencname); k > -1 { - si := tisfi[k] - if dd.TryDecodeAsNil() { - si.setToZeroValue(rv) - } else { - d.decodeValue(si.field(rv, true), nil) - } - } else { - d.structFieldNotFound(-1, rvkencname) - } - keepAlive4StringView(rvkencnameB) // maintain ref 4 stringView + rvkencname = decStructFieldKey(dd, fti.keyType, &d.b) + if elemsep { + dd.ReadMapElemValue() } + if k := fti.indexForEncName(rvkencname); k > -1 { + si := tisfi[k] + if dd.TryDecodeAsNil() { + si.setToZeroValue(rv) + } else { + d.decodeValue(sfn.field(si), nil, true) + } + } else { + d.structFieldNotFound(-1, stringView(rvkencname)) + } + // keepAlive4StringView(rvkencnameB) // not needed, as reference is outside loop } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() } else if ctyp == valueTypeArray { containerLen := dd.ReadArrayStart() if containerLen == 0 { - if cr != nil { - cr.sendContainerState(containerArrayEnd) - } + dd.ReadArrayEnd() return } // Not much gain from doing it two ways for array. // Arrays are not used as much for structs. hasLen := containerLen >= 0 - for j, si := range fti.sfip { - if hasLen { - if j == containerLen { - break - } - } else if dd.CheckBreak() { + for j, si := range fti.sfiSrc { + if (hasLen && j == containerLen) || (!hasLen && dd.CheckBreak()) { break } - if cr != nil { - cr.sendContainerState(containerArrayElem) + if elemsep { + dd.ReadArrayElem() } if dd.TryDecodeAsNil() { si.setToZeroValue(rv) } else { - d.decodeValue(si.field(rv, true), nil) + d.decodeValue(sfn.field(si), nil, true) } } - if containerLen > len(fti.sfip) { + if containerLen > len(fti.sfiSrc) { // read remaining values and throw away - for j := len(fti.sfip); j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerArrayElem) + for j := len(fti.sfiSrc); j < containerLen; j++ { + if elemsep { + dd.ReadArrayElem() } d.structFieldNotFound(j, "") } } - if cr != nil { - cr.sendContainerState(containerArrayEnd) - } + dd.ReadArrayEnd() } else { - f.d.error(onlyMapOrArrayCanDecodeIntoStructErr) + d.errorstr(errstrOnlyMapOrArrayCanDecodeIntoStruct) return } } -func (f *decFnInfo) kSlice(rv reflect.Value) { +func (d *Decoder) kSlice(f *codecFnInfo, rv reflect.Value) { // A slice can be set from a map or array in stream. // This way, the order can be kept (as order is lost with map). ti := f.ti - d := f.d + if f.seq == seqTypeChan && ti.chandir&uint8(reflect.SendDir) == 0 { + d.errorf("receive-only channel cannot be used for sending byte(s)") + } dd := d.d - rtelem0 := ti.rt.Elem() + rtelem0 := ti.elem ctyp := dd.ContainerType() if ctyp == valueTypeBytes || ctyp == valueTypeString { // you can only decode bytes or string in the stream into a slice or array of bytes if !(ti.rtid == uint8SliceTypId || rtelem0.Kind() == reflect.Uint8) { - f.d.errorf("bytes or string in the stream must be decoded into a slice or array of bytes, not %v", ti.rt) + d.errorf("bytes/string in stream must decode into slice/array of bytes, not %v", ti.rt) } if f.seq == seqTypeChan { - bs2 := dd.DecodeBytes(nil, false, true) - ch := rv.Interface().(chan<- byte) + bs2 := dd.DecodeBytes(nil, true) + irv := rv2i(rv) + ch, ok := irv.(chan<- byte) + if !ok { + ch = irv.(chan byte) + } for _, b := range bs2 { ch <- b } } else { rvbs := rv.Bytes() - bs2 := dd.DecodeBytes(rvbs, false, false) - if rvbs == nil && bs2 != nil || rvbs != nil && bs2 == nil || len(bs2) != len(rvbs) { + bs2 := dd.DecodeBytes(rvbs, false) + // if rvbs == nil && bs2 != nil || rvbs != nil && bs2 == nil || len(bs2) != len(rvbs) { + if !(len(bs2) > 0 && len(bs2) == len(rvbs) && &bs2[0] == &rvbs[0]) { if rv.CanSet() { rv.SetBytes(bs2) - } else { + } else if len(rvbs) > 0 && len(bs2) > 0 { copy(rvbs, bs2) } } @@ -871,199 +1276,221 @@ func (f *decFnInfo) kSlice(rv reflect.Value) { slh, containerLenS := d.decSliceHelperStart() // only expects valueType(Array|Map) - // // an array can never return a nil slice. so no need to check f.array here. + // an array can never return a nil slice. so no need to check f.array here. if containerLenS == 0 { - if f.seq == seqTypeSlice { - if rv.IsNil() { - rv.Set(reflect.MakeSlice(ti.rt, 0, 0)) - } else { - rv.SetLen(0) - } - } else if f.seq == seqTypeChan { - if rv.IsNil() { - rv.Set(reflect.MakeChan(ti.rt, 0)) + if rv.CanSet() { + if f.seq == seqTypeSlice { + if rv.IsNil() { + rv.Set(reflect.MakeSlice(ti.rt, 0, 0)) + } else { + rv.SetLen(0) + } + } else if f.seq == seqTypeChan { + if rv.IsNil() { + rv.Set(reflect.MakeChan(ti.rt, 0)) + } } } slh.End() return } + rtelem0Size := int(rtelem0.Size()) + rtElem0Kind := rtelem0.Kind() + rtelem0Mut := !isImmutableKind(rtElem0Kind) rtelem := rtelem0 - for rtelem.Kind() == reflect.Ptr { + rtelemkind := rtelem.Kind() + for rtelemkind == reflect.Ptr { rtelem = rtelem.Elem() + rtelemkind = rtelem.Kind() } - fn := d.getDecFn(rtelem, true, true) - var rv0, rv9 reflect.Value - rv0 = rv - rvChanged := false + var fn *codecFn - // for j := 0; j < containerLenS; j++ { - var rvlen int - if containerLenS > 0 { // hasLen - if f.seq == seqTypeChan { - if rv.IsNil() { - rvlen, _ = decInferLen(containerLenS, f.d.h.MaxInitLen, int(rtelem0.Size())) - rv.Set(reflect.MakeChan(ti.rt, rvlen)) - } - // handle chan specially: - for j := 0; j < containerLenS; j++ { - rv9 = reflect.New(rtelem0).Elem() - slh.ElemContainerState(j) - d.decodeValue(rv9, fn) - rv.Send(rv9) - } - } else { // slice or array - var truncated bool // says len of sequence is not same as expected number of elements - numToRead := containerLenS // if truncated, reset numToRead + var rvCanset = rv.CanSet() + var rvChanged bool + var rv0 = rv + var rv9 reflect.Value - rvcap := rv.Cap() - rvlen = rv.Len() - if containerLenS > rvcap { - if f.seq == seqTypeArray { - d.arrayCannotExpand(rvlen, containerLenS) - } else { - oldRvlenGtZero := rvlen > 0 - rvlen, truncated = decInferLen(containerLenS, f.d.h.MaxInitLen, int(rtelem0.Size())) - if truncated { - if rvlen <= rvcap { - rv.SetLen(rvlen) - } else { - rv = reflect.MakeSlice(ti.rt, rvlen, rvlen) - rvChanged = true - } - } else { - rv = reflect.MakeSlice(ti.rt, rvlen, rvlen) - rvChanged = true - } - if rvChanged && oldRvlenGtZero && !isImmutableKind(rtelem0.Kind()) { - reflect.Copy(rv, rv0) // only copy up to length NOT cap i.e. rv0.Slice(0, rvcap) - } - rvcap = rvlen + rvlen := rv.Len() + rvcap := rv.Cap() + hasLen := containerLenS > 0 + if hasLen && f.seq == seqTypeSlice { + if containerLenS > rvcap { + oldRvlenGtZero := rvlen > 0 + rvlen = decInferLen(containerLenS, d.h.MaxInitLen, int(rtelem0.Size())) + if rvlen <= rvcap { + if rvCanset { + rv.SetLen(rvlen) } - numToRead = rvlen - } else if containerLenS != rvlen { - if f.seq == seqTypeSlice { - rv.SetLen(containerLenS) - rvlen = containerLenS - } - } - j := 0 - // we read up to the numToRead - for ; j < numToRead; j++ { - slh.ElemContainerState(j) - d.decodeValue(rv.Index(j), fn) - } - - // if slice, expand and read up to containerLenS (or EOF) iff truncated - // if array, swallow all the rest. - - if f.seq == seqTypeArray { - for ; j < containerLenS; j++ { - slh.ElemContainerState(j) - d.swallow() - } - } else if truncated { // slice was truncated, as chan NOT in this block - for ; j < containerLenS; j++ { - rv = expandSliceValue(rv, 1) - rv9 = rv.Index(j) - if resetSliceElemToZeroValue { - rv9.Set(reflect.Zero(rtelem0)) - } - slh.ElemContainerState(j) - d.decodeValue(rv9, fn) - } - } - } - } else { - rvlen = rv.Len() - j := 0 - for ; !dd.CheckBreak(); j++ { - if f.seq == seqTypeChan { - slh.ElemContainerState(j) - rv9 = reflect.New(rtelem0).Elem() - d.decodeValue(rv9, fn) - rv.Send(rv9) + } else if rvCanset { + rv = reflect.MakeSlice(ti.rt, rvlen, rvlen) + rvcap = rvlen + rvChanged = true } else { - // if indefinite, etc, then expand the slice if necessary - var decodeIntoBlank bool - if j >= rvlen { - if f.seq == seqTypeArray { - d.arrayCannotExpand(rvlen, j+1) - decodeIntoBlank = true - } else { // if f.seq == seqTypeSlice - // rv = reflect.Append(rv, reflect.Zero(rtelem0)) // uses append logic, plus varargs - rv = expandSliceValue(rv, 1) - rv9 = rv.Index(j) - // rv.Index(rv.Len() - 1).Set(reflect.Zero(rtelem0)) - if resetSliceElemToZeroValue { - rv9.Set(reflect.Zero(rtelem0)) - } - rvlen++ - rvChanged = true - } - } else { // slice or array - rv9 = rv.Index(j) - } - slh.ElemContainerState(j) - if decodeIntoBlank { - d.swallow() - } else { // seqTypeSlice - d.decodeValue(rv9, fn) + d.errorf("cannot decode into non-settable slice") + } + if rvChanged && oldRvlenGtZero && !isImmutableKind(rtelem0.Kind()) { + reflect.Copy(rv, rv0) // only copy up to length NOT cap i.e. rv0.Slice(0, rvcap) + } + } else if containerLenS != rvlen { + rvlen = containerLenS + if rvCanset { + rv.SetLen(rvlen) + } + // else { + // rv = rv.Slice(0, rvlen) + // rvChanged = true + // d.errorf("cannot decode into non-settable slice") + // } + } + } + + // consider creating new element once, and just decoding into it. + var rtelem0Zero reflect.Value + var rtelem0ZeroValid bool + var decodeAsNil bool + var j int + d.cfer() + for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + if j == 0 && (f.seq == seqTypeSlice || f.seq == seqTypeChan) && rv.IsNil() { + if hasLen { + rvlen = decInferLen(containerLenS, d.h.MaxInitLen, rtelem0Size) + } else { + rvlen = 8 + } + if rvCanset { + if f.seq == seqTypeSlice { + rv = reflect.MakeSlice(ti.rt, rvlen, rvlen) + rvChanged = true + } else { // chan + rv = reflect.MakeChan(ti.rt, rvlen) + rvChanged = true } + } else { + d.errorf("cannot decode into non-settable slice") } } - if f.seq == seqTypeSlice { - if j < rvlen { + slh.ElemContainerState(j) + decodeAsNil = dd.TryDecodeAsNil() + if f.seq == seqTypeChan { + if decodeAsNil { + rv.Send(reflect.Zero(rtelem0)) + continue + } + if rtelem0Mut || !rv9.IsValid() { // || (rtElem0Kind == reflect.Ptr && rv9.IsNil()) { + rv9 = reflect.New(rtelem0).Elem() + } + if fn == nil { + fn = d.cf.get(rtelem, true, true) + } + d.decodeValue(rv9, fn, true) + rv.Send(rv9) + } else { + // if indefinite, etc, then expand the slice if necessary + var decodeIntoBlank bool + if j >= rvlen { + if f.seq == seqTypeArray { + d.arrayCannotExpand(rvlen, j+1) + decodeIntoBlank = true + } else { // if f.seq == seqTypeSlice + // rv = reflect.Append(rv, reflect.Zero(rtelem0)) // append logic + varargs + var rvcap2 int + var rvErrmsg2 string + rv9, rvcap2, rvChanged, rvErrmsg2 = + expandSliceRV(rv, ti.rt, rvCanset, rtelem0Size, 1, rvlen, rvcap) + if rvErrmsg2 != "" { + d.errorf(rvErrmsg2) + } + rvlen++ + if rvChanged { + rv = rv9 + rvcap = rvcap2 + } + } + } + if decodeIntoBlank { + if !decodeAsNil { + d.swallow() + } + } else { + rv9 = rv.Index(j) + if d.h.SliceElementReset || decodeAsNil { + if !rtelem0ZeroValid { + rtelem0ZeroValid = true + rtelem0Zero = reflect.Zero(rtelem0) + } + rv9.Set(rtelem0Zero) + } + if decodeAsNil { + continue + } + + if fn == nil { + fn = d.cf.get(rtelem, true, true) + } + d.decodeValue(rv9, fn, true) + } + } + } + if f.seq == seqTypeSlice { + if j < rvlen { + if rv.CanSet() { rv.SetLen(j) - } else if j == 0 && rv.IsNil() { + } else if rvCanset { + rv = rv.Slice(0, j) + rvChanged = true + } // else { d.errorf("kSlice: cannot change non-settable slice") } + rvlen = j + } else if j == 0 && rv.IsNil() { + if rvCanset { rv = reflect.MakeSlice(ti.rt, 0, 0) rvChanged = true - } + } // else { d.errorf("kSlice: cannot change non-settable slice") } } } slh.End() - if rvChanged { + if rvChanged { // infers rvCanset=true, so it can be reset rv0.Set(rv) } } -func (f *decFnInfo) kArray(rv reflect.Value) { - // f.d.decodeValue(rv.Slice(0, rv.Len())) - f.kSlice(rv.Slice(0, rv.Len())) -} +// func (d *Decoder) kArray(f *codecFnInfo, rv reflect.Value) { +// // d.decodeValueFn(rv.Slice(0, rv.Len())) +// f.kSlice(rv.Slice(0, rv.Len())) +// } -func (f *decFnInfo) kMap(rv reflect.Value) { - d := f.d +func (d *Decoder) kMap(f *codecFnInfo, rv reflect.Value) { dd := d.d containerLen := dd.ReadMapStart() - cr := d.cr + elemsep := d.esep ti := f.ti if rv.IsNil() { - rv.Set(reflect.MakeMap(ti.rt)) + rv.Set(makeMapReflect(ti.rt, containerLen)) } if containerLen == 0 { - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return } - ktype, vtype := ti.rt.Key(), ti.rt.Elem() - ktypeId := reflect.ValueOf(ktype).Pointer() + ktype, vtype := ti.key, ti.elem + ktypeId := rt2id(ktype) vtypeKind := vtype.Kind() - var keyFn, valFn *decFn - var xtyp reflect.Type - for xtyp = ktype; xtyp.Kind() == reflect.Ptr; xtyp = xtyp.Elem() { + + var keyFn, valFn *codecFn + var ktypeLo, vtypeLo reflect.Type + + for ktypeLo = ktype; ktypeLo.Kind() == reflect.Ptr; ktypeLo = ktypeLo.Elem() { } - keyFn = d.getDecFn(xtyp, true, true) - for xtyp = vtype; xtyp.Kind() == reflect.Ptr; xtyp = xtyp.Elem() { + + for vtypeLo = vtype; vtypeLo.Kind() == reflect.Ptr; vtypeLo = vtypeLo.Elem() { } - valFn = d.getDecFn(xtyp, true, true) + var mapGet, mapSet bool - if !f.d.h.MapValueReset { + rvvImmut := isImmutableKind(vtypeKind) + if !d.h.MapValueReset { // if pointer, mapGet = true // if interface, mapGet = true if !DecodeNakedAlways (else false) // if builtin, mapGet = false @@ -1071,118 +1498,124 @@ func (f *decFnInfo) kMap(rv reflect.Value) { if vtypeKind == reflect.Ptr { mapGet = true } else if vtypeKind == reflect.Interface { - if !f.d.h.InterfaceReset { + if !d.h.InterfaceReset { mapGet = true } - } else if !isImmutableKind(vtypeKind) { + } else if !rvvImmut { mapGet = true } } - var rvk, rvv, rvz reflect.Value - - // for j := 0; j < containerLen; j++ { - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - rvk = reflect.New(ktype).Elem() - if cr != nil { - cr.sendContainerState(containerMapKey) + var rvk, rvkp, rvv, rvz reflect.Value + rvkMut := !isImmutableKind(ktype.Kind()) // if ktype is immutable, then re-use the same rvk. + ktypeIsString := ktypeId == stringTypId + ktypeIsIntf := ktypeId == intfTypId + hasLen := containerLen > 0 + var kstrbs []byte + d.cfer() + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if rvkMut || !rvkp.IsValid() { + rvkp = reflect.New(ktype) + rvk = rvkp.Elem() + } + if elemsep { + dd.ReadMapElemKey() + } + if false && dd.TryDecodeAsNil() { // nil cannot be a map key, so disregard this block + // Previously, if a nil key, we just ignored the mapped value and continued. + // However, that makes the result of encoding and then decoding map[intf]intf{nil:nil} + // to be an empty map. + // Instead, we treat a nil key as the zero value of the type. + rvk.Set(reflect.Zero(ktype)) + } else if ktypeIsString { + kstrbs = dd.DecodeStringAsBytes() + rvk.SetString(stringView(kstrbs)) + // NOTE: if doing an insert, you MUST use a real string (not stringview) + } else { + if keyFn == nil { + keyFn = d.cf.get(ktypeLo, true, true) } - d.decodeValue(rvk, keyFn) - - // special case if a byte array. - if ktypeId == intfTypId { - rvk = rvk.Elem() - if rvk.Type() == uint8SliceTyp { - rvk = reflect.ValueOf(d.string(rvk.Bytes())) - } - } - mapSet = true // set to false if u do a get, and its a pointer, and exists - if mapGet { - rvv = rv.MapIndex(rvk) - if rvv.IsValid() { - if vtypeKind == reflect.Ptr { - mapSet = false - } + d.decodeValue(rvk, keyFn, true) + } + // special case if a byte array. + if ktypeIsIntf { + if rvk2 := rvk.Elem(); rvk2.IsValid() { + if rvk2.Type() == uint8SliceTyp { + rvk = reflect.ValueOf(d.string(rvk2.Bytes())) } else { - if rvz.IsValid() { - rvz.Set(reflect.Zero(vtype)) - } else { - rvz = reflect.New(vtype).Elem() - } - rvv = rvz + rvk = rvk2 } - } else { - if rvz.IsValid() { - rvz.Set(reflect.Zero(vtype)) - } else { - rvz = reflect.New(vtype).Elem() - } - rvv = rvz - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - d.decodeValue(rvv, valFn) - if mapSet { - rv.SetMapIndex(rvk, rvv) } } - } else { - for j := 0; !dd.CheckBreak(); j++ { - rvk = reflect.New(ktype).Elem() - if cr != nil { - cr.sendContainerState(containerMapKey) - } - d.decodeValue(rvk, keyFn) - // special case if a byte array. - if ktypeId == intfTypId { - rvk = rvk.Elem() - if rvk.Type() == uint8SliceTyp { - rvk = reflect.ValueOf(d.string(rvk.Bytes())) - } - } - mapSet = true // set to false if u do a get, and its a pointer, and exists - if mapGet { - rvv = rv.MapIndex(rvk) - if rvv.IsValid() { - if vtypeKind == reflect.Ptr { - mapSet = false - } - } else { - if rvz.IsValid() { - rvz.Set(reflect.Zero(vtype)) - } else { - rvz = reflect.New(vtype).Elem() - } - rvv = rvz - } - } else { - if rvz.IsValid() { - rvz.Set(reflect.Zero(vtype)) - } else { - rvz = reflect.New(vtype).Elem() - } - rvv = rvz - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - d.decodeValue(rvv, valFn) - if mapSet { - rv.SetMapIndex(rvk, rvv) - } + if elemsep { + dd.ReadMapElemValue() } - } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } -} -type decRtidFn struct { - rtid uintptr - fn decFn + // Brittle, but OK per TryDecodeAsNil() contract. + // i.e. TryDecodeAsNil never shares slices with other decDriver procedures + if dd.TryDecodeAsNil() { + if ktypeIsString { + rvk.SetString(d.string(kstrbs)) + } + if d.h.DeleteOnNilMapValue { + rv.SetMapIndex(rvk, reflect.Value{}) + } else { + rv.SetMapIndex(rvk, reflect.Zero(vtype)) + } + continue + } + + mapSet = true // set to false if u do a get, and its a non-nil pointer + if mapGet { + // mapGet true only in case where kind=Ptr|Interface or kind is otherwise mutable. + rvv = rv.MapIndex(rvk) + if !rvv.IsValid() { + rvv = reflect.New(vtype).Elem() + } else if vtypeKind == reflect.Ptr { + if rvv.IsNil() { + rvv = reflect.New(vtype).Elem() + } else { + mapSet = false + } + } else if vtypeKind == reflect.Interface { + // not addressable, and thus not settable. + // e MUST create a settable/addressable variant + rvv2 := reflect.New(rvv.Type()).Elem() + if !rvv.IsNil() { + rvv2.Set(rvv) + } + rvv = rvv2 + } + // else it is ~mutable, and we can just decode into it directly + } else if rvvImmut { + if !rvz.IsValid() { + rvz = reflect.New(vtype).Elem() + } + rvv = rvz + } else { + rvv = reflect.New(vtype).Elem() + } + + // We MUST be done with the stringview of the key, before decoding the value + // so that we don't bastardize the reused byte array. + if mapSet && ktypeIsString { + rvk.SetString(d.string(kstrbs)) + } + if valFn == nil { + valFn = d.cf.get(vtypeLo, true, true) + } + d.decodeValue(rvv, valFn, true) + // d.decodeValueFn(rvv, valFn) + if mapSet { + rv.SetMapIndex(rvk, rvv) + } + // if ktypeIsString { + // // keepAlive4StringView(kstrbs) // not needed, as reference is outside loop + // } + } + + dd.ReadMapEnd() } // decNaked is used to keep track of the primitives decoded. @@ -1203,80 +1636,204 @@ type decRtidFn struct { // // kInterfaceNaked will ensure that there is no allocation for the common // uses. + +type decNakedContainers struct { + // array/stacks for reducing allocation + // keep arrays at the bottom? Chance is that they are not used much. + ia [arrayCacheLen]interface{} + ma [arrayCacheLen]map[interface{}]interface{} + na [arrayCacheLen]map[string]interface{} + sa [arrayCacheLen][]interface{} + + // ria [arrayCacheLen]reflect.Value // not needed, as we decode directly into &ia[n] + rma, rna, rsa [arrayCacheLen]reflect.Value // reflect.Value mapping to above +} + +func (n *decNakedContainers) init() { + for i := 0; i < arrayCacheLen; i++ { + // n.ria[i] = reflect.ValueOf(&(n.ia[i])).Elem() + n.rma[i] = reflect.ValueOf(&(n.ma[i])).Elem() + n.rna[i] = reflect.ValueOf(&(n.na[i])).Elem() + n.rsa[i] = reflect.ValueOf(&(n.sa[i])).Elem() + } +} + type decNaked struct { // r RawExt // used for RawExt, uint, []byte. + + // primitives below u uint64 i int64 f float64 l []byte s string + + // ---- cpu cache line boundary? t time.Time b bool - v valueType - // stacks for reducing allocation - is []interface{} - ms []map[interface{}]interface{} - ns []map[string]interface{} - ss [][]interface{} - // rs []RawExt + // state + v valueType + li, lm, ln, ls int8 + inited bool - // keep arrays at the bottom? Chance is that they are not used much. - ia [4]interface{} - ma [4]map[interface{}]interface{} - na [4]map[string]interface{} - sa [4][]interface{} - // ra [2]RawExt + *decNakedContainers + + ru, ri, rf, rl, rs, rb, rt reflect.Value // mapping to the primitives above + + // _ [6]uint64 // padding // no padding - rt goes into next cache line +} + +func (n *decNaked) init() { + if n.inited { + return + } + n.ru = reflect.ValueOf(&n.u).Elem() + n.ri = reflect.ValueOf(&n.i).Elem() + n.rf = reflect.ValueOf(&n.f).Elem() + n.rl = reflect.ValueOf(&n.l).Elem() + n.rs = reflect.ValueOf(&n.s).Elem() + n.rt = reflect.ValueOf(&n.t).Elem() + n.rb = reflect.ValueOf(&n.b).Elem() + + n.inited = true + // n.rr[] = reflect.ValueOf(&n.) +} + +func (n *decNaked) initContainers() { + if n.decNakedContainers == nil { + n.decNakedContainers = new(decNakedContainers) + n.decNakedContainers.init() + } } func (n *decNaked) reset() { - if n.ss != nil { - n.ss = n.ss[:0] - } - if n.is != nil { - n.is = n.is[:0] - } - if n.ms != nil { - n.ms = n.ms[:0] - } - if n.ns != nil { - n.ns = n.ns[:0] + if n == nil { + return } + n.li, n.lm, n.ln, n.ls = 0, 0, 0, 0 } +type rtid2rv struct { + rtid uintptr + rv reflect.Value +} + +// -------------- + +type decReaderSwitch struct { + rb bytesDecReader + // ---- cpu cache line boundary? + ri *ioDecReader + mtr, str bool // whether maptype or slicetype are known types + + be bool // is binary encoding + bytes bool // is bytes reader + js bool // is json handle + jsms bool // is json handle, and MapKeyAsString + esep bool // has elem separators +} + +// TODO: Uncomment after mid-stack inlining enabled in go 1.10 +// +// func (z *decReaderSwitch) unreadn1() { +// if z.bytes { +// z.rb.unreadn1() +// } else { +// z.ri.unreadn1() +// } +// } +// func (z *decReaderSwitch) readx(n int) []byte { +// if z.bytes { +// return z.rb.readx(n) +// } +// return z.ri.readx(n) +// } +// func (z *decReaderSwitch) readb(s []byte) { +// if z.bytes { +// z.rb.readb(s) +// } else { +// z.ri.readb(s) +// } +// } +// func (z *decReaderSwitch) readn1() uint8 { +// if z.bytes { +// return z.rb.readn1() +// } +// return z.ri.readn1() +// } +// func (z *decReaderSwitch) numread() int { +// if z.bytes { +// return z.rb.numread() +// } +// return z.ri.numread() +// } +// func (z *decReaderSwitch) track() { +// if z.bytes { +// z.rb.track() +// } else { +// z.ri.track() +// } +// } +// func (z *decReaderSwitch) stopTrack() []byte { +// if z.bytes { +// return z.rb.stopTrack() +// } +// return z.ri.stopTrack() +// } +// func (z *decReaderSwitch) skip(accept *bitset256) (token byte) { +// if z.bytes { +// return z.rb.skip(accept) +// } +// return z.ri.skip(accept) +// } +// func (z *decReaderSwitch) readTo(in []byte, accept *bitset256) (out []byte) { +// if z.bytes { +// return z.rb.readTo(in, accept) +// } +// return z.ri.readTo(in, accept) +// } +// func (z *decReaderSwitch) readUntil(in []byte, stop byte) (out []byte) { +// if z.bytes { +// return z.rb.readUntil(in, stop) +// } +// return z.ri.readUntil(in, stop) +// } + +const decScratchByteArrayLen = cacheLineSize - 8 + // A Decoder reads and decodes an object from an input stream in the codec format. type Decoder struct { + panicHdl // hopefully, reduce derefencing cost by laying the decReader inside the Decoder. // Try to put things that go together to fit within a cache line (8 words). d decDriver // NOTE: Decoder shouldn't call it's read methods, // as the handler MAY need to do some coordination. - r decReader - // sa [initCollectionCap]decRtidFn + r decReader h *BasicHandle - hh Handle - - be bool // is binary encoding - bytes bool // is bytes reader - js bool // is json handle - - rb bytesDecReader - ri ioDecReader - cr containerStateRecv - - s []decRtidFn - f map[uintptr]*decFn - - // _ uintptr // for alignment purposes, so next one starts from a cache line - + bi *bufioDecReader // cache the mapTypeId and sliceTypeId for faster comparisons mtid uintptr stid uintptr - n decNaked - b [scratchByteArrayLen]byte - is map[string]string // used for interning strings + // ---- cpu cache line boundary? + decReaderSwitch + + // ---- cpu cache line boundary? + codecFnPooler + // cr containerStateRecv + n *decNaked + nsp *sync.Pool + err error + + // ---- cpu cache line boundary? + b [decScratchByteArrayLen]byte // scratch buffer, used by Decoder and xxxEncDrivers + is map[string]string // used for interning strings + + // padding - false sharing help // modify 232 if Decoder struct changes. + // _ [cacheLineSize - 232%cacheLineSize]byte } // NewDecoder returns a Decoder for decoding a stream of bytes from an io.Reader. @@ -1297,64 +1854,100 @@ func NewDecoderBytes(in []byte, h Handle) *Decoder { return d } +var defaultDecNaked decNaked + func newDecoder(h Handle) *Decoder { - d := &Decoder{hh: h, h: h.getBasicHandle(), be: h.isBinary()} - n := &d.n - // n.rs = n.ra[:0] - n.ms = n.ma[:0] - n.is = n.ia[:0] - n.ns = n.na[:0] - n.ss = n.sa[:0] - _, d.js = h.(*JsonHandle) + d := &Decoder{h: h.getBasicHandle(), err: errDecoderNotInitialized} + d.hh = h + d.be = h.isBinary() + // NOTE: do not initialize d.n here. It is lazily initialized in d.naked() + var jh *JsonHandle + jh, d.js = h.(*JsonHandle) + if d.js { + d.jsms = jh.MapKeyAsString + } + d.esep = d.hh.hasElemSeparators() if d.h.InternString { d.is = make(map[string]string, 32) } d.d = h.newDecDriver(d) - d.cr, _ = d.d.(containerStateRecv) - // d.d = h.newDecDriver(decReaderT{true, &d.rb, &d.ri}) + // d.cr, _ = d.d.(containerStateRecv) return d } func (d *Decoder) resetCommon() { d.n.reset() d.d.reset() - // reset all things which were cached from the Handle, - // but could be changed. + d.err = nil + // reset all things which were cached from the Handle, but could change d.mtid, d.stid = 0, 0 + d.mtr, d.str = false, false if d.h.MapType != nil { - d.mtid = reflect.ValueOf(d.h.MapType).Pointer() + d.mtid = rt2id(d.h.MapType) + d.mtr = fastpathAV.index(d.mtid) != -1 } if d.h.SliceType != nil { - d.stid = reflect.ValueOf(d.h.SliceType).Pointer() + d.stid = rt2id(d.h.SliceType) + d.str = fastpathAV.index(d.stid) != -1 } } +// Reset the Decoder with a new Reader to decode from, +// clearing all state from last run(s). func (d *Decoder) Reset(r io.Reader) { - d.ri.x = &d.b - // d.s = d.sa[:0] - d.ri.bs.r = r - var ok bool - d.ri.br, ok = r.(decReaderByteScanner) - if !ok { - d.ri.br = &d.ri.bs + if r == nil { + return + } + if d.bi == nil { + d.bi = new(bufioDecReader) + } + d.bytes = false + if d.h.ReaderBufferSize > 0 { + d.bi.buf = make([]byte, 0, d.h.ReaderBufferSize) + d.bi.reset(r) + d.r = d.bi + } else { + // d.ri.x = &d.b + // d.s = d.sa[:0] + if d.ri == nil { + d.ri = new(ioDecReader) + } + d.ri.reset(r) + d.r = d.ri } - d.r = &d.ri d.resetCommon() } +// ResetBytes resets the Decoder with a new []byte to decode from, +// clearing all state from last run(s). func (d *Decoder) ResetBytes(in []byte) { - // d.s = d.sa[:0] + if in == nil { + return + } d.bytes = true d.rb.reset(in) d.r = &d.rb d.resetCommon() } -// func (d *Decoder) sendContainerState(c containerState) { -// if d.cr != nil { -// d.cr.sendContainerState(c) -// } -// } +// naked must be called before each call to .DecodeNaked, +// as they will use it. +func (d *Decoder) naked() *decNaked { + if d.n == nil { + // consider one of: + // - get from sync.Pool (if GC is frequent, there's no value here) + // - new alloc (safest. only init'ed if it a naked decode will be done) + // - field in Decoder (makes the Decoder struct very big) + // To support using a decoder where a DecodeNaked is not needed, + // we prefer #1 or #2. + // d.n = new(decNaked) // &d.nv // new(decNaked) // grab from a sync.Pool + // d.n.init() + var v interface{} + d.nsp, v = pool.decNaked() + d.n = v.(*decNaked) + } + return d.n +} // Decode decodes the stream from reader and stores the result in the // value pointed to by v. v cannot be a nil pointer. v can also be @@ -1406,16 +1999,45 @@ func (d *Decoder) ResetBytes(in []byte) { // However, when decoding a stream nil, we reset the destination container // to its "zero" value (e.g. nil for slice/map, etc). // +// Note: we allow nil values in the stream anywhere except for map keys. +// A nil value in the encoded stream where a map key is expected is treated as an error. func (d *Decoder) Decode(v interface{}) (err error) { - defer panicToErr(&err) - d.decode(v) + // need to call defer directly, else it seems the recover is not fully handled + defer panicToErrs2(d, &d.err, &err) + defer d.alwaysAtEnd() + d.MustDecode(v) return } -// this is not a smart swallow, as it allocates objects and does unnecessary work. -func (d *Decoder) swallowViaHammer() { - var blank interface{} - d.decodeValue(reflect.ValueOf(&blank).Elem(), nil) +// MustDecode is like Decode, but panics if unable to Decode. +// This provides insight to the code location that triggered the error. +func (d *Decoder) MustDecode(v interface{}) { + // TODO: Top-level: ensure that v is a pointer and not nil. + if d.err != nil { + panic(d.err) + } + if d.d.TryDecodeAsNil() { + setZero(v) + } else { + d.decode(v) + } + d.alwaysAtEnd() + // xprintf(">>>>>>>> >>>>>>>> num decFns: %v\n", d.cf.sn) +} + +// // this is not a smart swallow, as it allocates objects and does unnecessary work. +// func (d *Decoder) swallowViaHammer() { +// var blank interface{} +// d.decodeValueNoFn(reflect.ValueOf(&blank).Elem()) +// } + +func (d *Decoder) alwaysAtEnd() { + if d.n != nil { + // if n != nil, then nsp != nil (they are always set together) + d.nsp.Put(d.n) + d.n, d.nsp = nil, nil + } + d.codecFnPooler.alwaysAtEnd() } func (d *Decoder) swallow() { @@ -1424,406 +2046,227 @@ func (d *Decoder) swallow() { if dd.TryDecodeAsNil() { return } - cr := d.cr + elemsep := d.esep switch dd.ContainerType() { case valueTypeMap: containerLen := dd.ReadMapStart() - clenGtEqualZero := containerLen >= 0 - for j := 0; ; j++ { - if clenGtEqualZero { - if j >= containerLen { - break - } - } else if dd.CheckBreak() { - break - } - if cr != nil { - cr.sendContainerState(containerMapKey) + hasLen := containerLen >= 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + // if clenGtEqualZero {if j >= containerLen {break} } else if dd.CheckBreak() {break} + if elemsep { + dd.ReadMapElemKey() } d.swallow() - if cr != nil { - cr.sendContainerState(containerMapValue) + if elemsep { + dd.ReadMapElemValue() } d.swallow() } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() case valueTypeArray: - containerLenS := dd.ReadArrayStart() - clenGtEqualZero := containerLenS >= 0 - for j := 0; ; j++ { - if clenGtEqualZero { - if j >= containerLenS { - break - } - } else if dd.CheckBreak() { - break - } - if cr != nil { - cr.sendContainerState(containerArrayElem) + containerLen := dd.ReadArrayStart() + hasLen := containerLen >= 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if elemsep { + dd.ReadArrayElem() } d.swallow() } - if cr != nil { - cr.sendContainerState(containerArrayEnd) - } + dd.ReadArrayEnd() case valueTypeBytes: - dd.DecodeBytes(d.b[:], false, true) + dd.DecodeBytes(d.b[:], true) case valueTypeString: - dd.DecodeBytes(d.b[:], true, true) - // dd.DecodeStringAsBytes(d.b[:]) + dd.DecodeStringAsBytes() default: // these are all primitives, which we can get from decodeNaked // if RawExt using Value, complete the processing. + n := d.naked() dd.DecodeNaked() - if n := &d.n; n.v == valueTypeExt && n.l == nil { - l := len(n.is) - n.is = append(n.is, nil) - v2 := &n.is[l] - d.decode(v2) - n.is = n.is[:l] + if n.v == valueTypeExt && n.l == nil { + n.initContainers() + if n.li < arrayCacheLen { + n.ia[n.li] = nil + n.li++ + d.decode(&n.ia[n.li-1]) + n.ia[n.li-1] = nil + n.li-- + } else { + var v2 interface{} + d.decode(&v2) + } } } } -// MustDecode is like Decode, but panics if unable to Decode. -// This provides insight to the code location that triggered the error. -func (d *Decoder) MustDecode(v interface{}) { - d.decode(v) +func setZero(iv interface{}) { + if iv == nil || definitelyNil(iv) { + return + } + var canDecode bool + switch v := iv.(type) { + case *string: + *v = "" + case *bool: + *v = false + case *int: + *v = 0 + case *int8: + *v = 0 + case *int16: + *v = 0 + case *int32: + *v = 0 + case *int64: + *v = 0 + case *uint: + *v = 0 + case *uint8: + *v = 0 + case *uint16: + *v = 0 + case *uint32: + *v = 0 + case *uint64: + *v = 0 + case *float32: + *v = 0 + case *float64: + *v = 0 + case *[]uint8: + *v = nil + case *Raw: + *v = nil + case *time.Time: + *v = time.Time{} + case reflect.Value: + if v, canDecode = isDecodeable(v); canDecode && v.CanSet() { + v.Set(reflect.Zero(v.Type())) + } // TODO: else drain if chan, clear if map, set all to nil if slice??? + default: + if !fastpathDecodeSetZeroTypeSwitch(iv) { + v := reflect.ValueOf(iv) + if v, canDecode = isDecodeable(v); canDecode && v.CanSet() { + v.Set(reflect.Zero(v.Type())) + } // TODO: else drain if chan, clear if map, set all to nil if slice??? + } + } } func (d *Decoder) decode(iv interface{}) { - // if ics, ok := iv.(Selfer); ok { - // ics.CodecDecodeSelf(d) - // return - // } - - if d.d.TryDecodeAsNil() { - switch v := iv.(type) { - case nil: - case *string: - *v = "" - case *bool: - *v = false - case *int: - *v = 0 - case *int8: - *v = 0 - case *int16: - *v = 0 - case *int32: - *v = 0 - case *int64: - *v = 0 - case *uint: - *v = 0 - case *uint8: - *v = 0 - case *uint16: - *v = 0 - case *uint32: - *v = 0 - case *uint64: - *v = 0 - case *float32: - *v = 0 - case *float64: - *v = 0 - case *[]uint8: - *v = nil - case *Raw: - *v = nil - case reflect.Value: - if v.Kind() != reflect.Ptr || v.IsNil() { - d.errNotValidPtrValue(v) - } - // d.chkPtrValue(v) - v = v.Elem() - if v.IsValid() { - v.Set(reflect.Zero(v.Type())) - } - default: - rv := reflect.ValueOf(iv) - if rv.Kind() != reflect.Ptr || rv.IsNil() { - d.errNotValidPtrValue(rv) - } - // d.chkPtrValue(rv) - rv = rv.Elem() - if rv.IsValid() { - rv.Set(reflect.Zero(rv.Type())) - } - } + // check nil and interfaces explicitly, + // so that type switches just have a run of constant non-interface types. + if iv == nil { + d.errorstr(errstrCannotDecodeIntoNil) + return + } + if v, ok := iv.(Selfer); ok { + v.CodecDecodeSelf(d) return } switch v := iv.(type) { - case nil: - d.error(cannotDecodeIntoNilErr) - return - - case Selfer: - v.CodecDecodeSelf(d) + // case nil: + // case Selfer: case reflect.Value: - if v.Kind() != reflect.Ptr || v.IsNil() { - d.errNotValidPtrValue(v) - } - // d.chkPtrValue(v) - d.decodeValueNotNil(v.Elem(), nil) + v = d.ensureDecodeable(v) + d.decodeValue(v, nil, true) case *string: *v = d.d.DecodeString() case *bool: *v = d.d.DecodeBool() case *int: - *v = int(d.d.DecodeInt(intBitsize)) + *v = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) case *int8: - *v = int8(d.d.DecodeInt(8)) + *v = int8(chkOvf.IntV(d.d.DecodeInt64(), 8)) case *int16: - *v = int16(d.d.DecodeInt(16)) + *v = int16(chkOvf.IntV(d.d.DecodeInt64(), 16)) case *int32: - *v = int32(d.d.DecodeInt(32)) + *v = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) case *int64: - *v = d.d.DecodeInt(64) + *v = d.d.DecodeInt64() case *uint: - *v = uint(d.d.DecodeUint(uintBitsize)) + *v = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) case *uint8: - *v = uint8(d.d.DecodeUint(8)) + *v = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) case *uint16: - *v = uint16(d.d.DecodeUint(16)) + *v = uint16(chkOvf.UintV(d.d.DecodeUint64(), 16)) case *uint32: - *v = uint32(d.d.DecodeUint(32)) + *v = uint32(chkOvf.UintV(d.d.DecodeUint64(), 32)) case *uint64: - *v = d.d.DecodeUint(64) + *v = d.d.DecodeUint64() case *float32: - *v = float32(d.d.DecodeFloat(true)) + f64 := d.d.DecodeFloat64() + if chkOvf.Float32(f64) { + d.errorf("float32 overflow: %v", f64) + } + *v = float32(f64) case *float64: - *v = d.d.DecodeFloat(false) + *v = d.d.DecodeFloat64() case *[]uint8: - *v = d.d.DecodeBytes(*v, false, false) - + *v = d.d.DecodeBytes(*v, false) + case []uint8: + b := d.d.DecodeBytes(v, false) + if !(len(b) > 0 && len(b) == len(v) && &b[0] == &v[0]) { + copy(v, b) + } + case *time.Time: + *v = d.d.DecodeTime() case *Raw: - *v = d.raw() + *v = d.rawBytes() case *interface{}: - d.decodeValueNotNil(reflect.ValueOf(iv).Elem(), nil) + d.decodeValue(reflect.ValueOf(iv).Elem(), nil, true) + // d.decodeValueNotNil(reflect.ValueOf(iv).Elem()) default: if !fastpathDecodeTypeSwitch(iv, d) { - d.decodeI(iv, true, false, false, false) + v := reflect.ValueOf(iv) + v = d.ensureDecodeable(v) + d.decodeValue(v, nil, false) + // d.decodeValueFallback(v) } } } -func (d *Decoder) preDecodeValue(rv reflect.Value, tryNil bool) (rv2 reflect.Value, proceed bool) { - if tryNil && d.d.TryDecodeAsNil() { - // No need to check if a ptr, recursively, to determine - // whether to set value to nil. - // Just always set value to its zero type. - if rv.IsValid() { // rv.CanSet() // always settable, except it's invalid - rv.Set(reflect.Zero(rv.Type())) - } - return - } - +func (d *Decoder) decodeValue(rv reflect.Value, fn *codecFn, chkAll bool) { // If stream is not containing a nil value, then we can deref to the base // non-pointer value, and decode into that. - for rv.Kind() == reflect.Ptr { - if rv.IsNil() { - rv.Set(reflect.New(rv.Type().Elem())) - } - rv = rv.Elem() - } - return rv, true -} - -func (d *Decoder) decodeI(iv interface{}, checkPtr, tryNil, checkFastpath, checkCodecSelfer bool) { - rv := reflect.ValueOf(iv) - if checkPtr { - if rv.Kind() != reflect.Ptr || rv.IsNil() { - d.errNotValidPtrValue(rv) - } - // d.chkPtrValue(rv) - } - rv, proceed := d.preDecodeValue(rv, tryNil) - if proceed { - fn := d.getDecFn(rv.Type(), checkFastpath, checkCodecSelfer) - fn.f(&fn.i, rv) - } -} - -func (d *Decoder) decodeValue(rv reflect.Value, fn *decFn) { - if rv, proceed := d.preDecodeValue(rv, true); proceed { - if fn == nil { - fn = d.getDecFn(rv.Type(), true, true) - } - fn.f(&fn.i, rv) - } -} - -func (d *Decoder) decodeValueNotNil(rv reflect.Value, fn *decFn) { - if rv, proceed := d.preDecodeValue(rv, false); proceed { - if fn == nil { - fn = d.getDecFn(rv.Type(), true, true) - } - fn.f(&fn.i, rv) - } -} - -func (d *Decoder) getDecFn(rt reflect.Type, checkFastpath, checkCodecSelfer bool) (fn *decFn) { - rtid := reflect.ValueOf(rt).Pointer() - - // retrieve or register a focus'ed function for this type - // to eliminate need to do the retrieval multiple times - - // if d.f == nil && d.s == nil { debugf("---->Creating new dec f map for type: %v\n", rt) } - var ok bool - if useMapForCodecCache { - fn, ok = d.f[rtid] - } else { - for i := range d.s { - v := &(d.s[i]) - if v.rtid == rtid { - fn, ok = &(v.fn), true + var rvp reflect.Value + var rvpValid bool + if rv.Kind() == reflect.Ptr { + rvpValid = true + for { + if rv.IsNil() { + rv.Set(reflect.New(rv.Type().Elem())) + } + rvp = rv + rv = rv.Elem() + if rv.Kind() != reflect.Ptr { break } } } - if ok { - return - } - if useMapForCodecCache { - if d.f == nil { - d.f = make(map[uintptr]*decFn, initCollectionCap) + if fn == nil { + // always pass checkCodecSelfer=true, in case T or ****T is passed, where *T is a Selfer + fn = d.cfer().get(rv.Type(), chkAll, true) // chkAll, chkAll) + } + if fn.i.addrD { + if rvpValid { + fn.fd(d, &fn.i, rvp) + } else if rv.CanAddr() { + fn.fd(d, &fn.i, rv.Addr()) + } else if !fn.i.addrF { + fn.fd(d, &fn.i, rv) + } else { + d.errorf("cannot decode into a non-pointer value") } - fn = new(decFn) - d.f[rtid] = fn } else { - if d.s == nil { - d.s = make([]decRtidFn, 0, initCollectionCap) - } - d.s = append(d.s, decRtidFn{rtid: rtid}) - fn = &(d.s[len(d.s)-1]).fn + fn.fd(d, &fn.i, rv) } - - // debugf("\tCreating new dec fn for type: %v\n", rt) - ti := d.h.getTypeInfo(rtid, rt) - fi := &(fn.i) - fi.d = d - fi.ti = ti - - // An extension can be registered for any type, regardless of the Kind - // (e.g. type BitSet int64, type MyStruct { / * unexported fields * / }, type X []int, etc. - // - // We can't check if it's an extension byte here first, because the user may have - // registered a pointer or non-pointer type, meaning we may have to recurse first - // before matching a mapped type, even though the extension byte is already detected. - // - // NOTE: if decoding into a nil interface{}, we return a non-nil - // value except even if the container registers a length of 0. - if checkCodecSelfer && ti.cs { - fn.f = (*decFnInfo).selferUnmarshal - } else if rtid == rawExtTypId { - fn.f = (*decFnInfo).rawExt - } else if rtid == rawTypId { - fn.f = (*decFnInfo).raw - } else if d.d.IsBuiltinType(rtid) { - fn.f = (*decFnInfo).builtin - } else if xfFn := d.h.getExt(rtid); xfFn != nil { - fi.xfTag, fi.xfFn = xfFn.tag, xfFn.ext - fn.f = (*decFnInfo).ext - } else if supportMarshalInterfaces && d.be && ti.bunm { - fn.f = (*decFnInfo).binaryUnmarshal - } else if supportMarshalInterfaces && !d.be && d.js && ti.junm { - //If JSON, we should check JSONUnmarshal before textUnmarshal - fn.f = (*decFnInfo).jsonUnmarshal - } else if supportMarshalInterfaces && !d.be && ti.tunm { - fn.f = (*decFnInfo).textUnmarshal - } else { - rk := rt.Kind() - if fastpathEnabled && checkFastpath && (rk == reflect.Map || rk == reflect.Slice) { - if rt.PkgPath() == "" { - if idx := fastpathAV.index(rtid); idx != -1 { - fn.f = fastpathAV[idx].decfn - } - } else { - // use mapping for underlying type if there - ok = false - var rtu reflect.Type - if rk == reflect.Map { - rtu = reflect.MapOf(rt.Key(), rt.Elem()) - } else { - rtu = reflect.SliceOf(rt.Elem()) - } - rtuid := reflect.ValueOf(rtu).Pointer() - if idx := fastpathAV.index(rtuid); idx != -1 { - xfnf := fastpathAV[idx].decfn - xrt := fastpathAV[idx].rt - fn.f = func(xf *decFnInfo, xrv reflect.Value) { - // xfnf(xf, xrv.Convert(xrt)) - xfnf(xf, xrv.Addr().Convert(reflect.PtrTo(xrt)).Elem()) - } - } - } - } - if fn.f == nil { - switch rk { - case reflect.String: - fn.f = (*decFnInfo).kString - case reflect.Bool: - fn.f = (*decFnInfo).kBool - case reflect.Int: - fn.f = (*decFnInfo).kInt - case reflect.Int64: - fn.f = (*decFnInfo).kInt64 - case reflect.Int32: - fn.f = (*decFnInfo).kInt32 - case reflect.Int8: - fn.f = (*decFnInfo).kInt8 - case reflect.Int16: - fn.f = (*decFnInfo).kInt16 - case reflect.Float32: - fn.f = (*decFnInfo).kFloat32 - case reflect.Float64: - fn.f = (*decFnInfo).kFloat64 - case reflect.Uint8: - fn.f = (*decFnInfo).kUint8 - case reflect.Uint64: - fn.f = (*decFnInfo).kUint64 - case reflect.Uint: - fn.f = (*decFnInfo).kUint - case reflect.Uint32: - fn.f = (*decFnInfo).kUint32 - case reflect.Uint16: - fn.f = (*decFnInfo).kUint16 - // case reflect.Ptr: - // fn.f = (*decFnInfo).kPtr - case reflect.Uintptr: - fn.f = (*decFnInfo).kUintptr - case reflect.Interface: - fn.f = (*decFnInfo).kInterface - case reflect.Struct: - fn.f = (*decFnInfo).kStruct - case reflect.Chan: - fi.seq = seqTypeChan - fn.f = (*decFnInfo).kSlice - case reflect.Slice: - fi.seq = seqTypeSlice - fn.f = (*decFnInfo).kSlice - case reflect.Array: - fi.seq = seqTypeArray - fn.f = (*decFnInfo).kArray - case reflect.Map: - fn.f = (*decFnInfo).kMap - default: - fn.f = (*decFnInfo).kErr - } - } - } - - return + // return rv } func (d *Decoder) structFieldNotFound(index int, rvkencname string) { @@ -1846,69 +2289,73 @@ func (d *Decoder) arrayCannotExpand(sliceLen, streamLen int) { } } -func (d *Decoder) chkPtrValue(rv reflect.Value) { - // We can only decode into a non-nil pointer - if rv.Kind() == reflect.Ptr && !rv.IsNil() { - return +func isDecodeable(rv reflect.Value) (rv2 reflect.Value, canDecode bool) { + switch rv.Kind() { + case reflect.Array: + return rv, true + case reflect.Ptr: + if !rv.IsNil() { + return rv.Elem(), true + } + case reflect.Slice, reflect.Chan, reflect.Map: + if !rv.IsNil() { + return rv, true + } } - d.errNotValidPtrValue(rv) + return } -func (d *Decoder) errNotValidPtrValue(rv reflect.Value) { +func (d *Decoder) ensureDecodeable(rv reflect.Value) (rv2 reflect.Value) { + // decode can take any reflect.Value that is a inherently addressable i.e. + // - array + // - non-nil chan (we will SEND to it) + // - non-nil slice (we will set its elements) + // - non-nil map (we will put into it) + // - non-nil pointer (we can "update" it) + rv2, canDecode := isDecodeable(rv) + if canDecode { + return + } if !rv.IsValid() { - d.error(cannotDecodeIntoNilErr) + d.errorstr(errstrCannotDecodeIntoNil) return } if !rv.CanInterface() { d.errorf("cannot decode into a value without an interface: %v", rv) return } - rvi := rv.Interface() - d.errorf("cannot decode into non-pointer or nil pointer. Got: %v, %T, %v", rv.Kind(), rvi, rvi) -} - -func (d *Decoder) error(err error) { - panic(err) -} - -func (d *Decoder) errorf(format string, params ...interface{}) { - params2 := make([]interface{}, len(params)+1) - params2[0] = d.r.numread() - copy(params2[1:], params) - err := fmt.Errorf("[pos %d]: "+format, params2...) - panic(err) + rvi := rv2i(rv) + rvk := rv.Kind() + d.errorf("cannot decode into value of kind: %v, type: %T, %v", rvk, rvi, rvi) + return } // Possibly get an interned version of a string // -// This should mostly be used for map keys, where the key type is string +// This should mostly be used for map keys, where the key type is string. +// This is because keys of a map/struct are typically reused across many objects. func (d *Decoder) string(v []byte) (s string) { - if d.is != nil { - s, ok := d.is[string(v)] // no allocation here, per go implementation - if !ok { - s = string(v) // new allocation here - d.is[s] = s - } - return s + if d.is == nil { + return string(v) // don't return stringView, as we need a real string here. } - return string(v) // don't return stringView, as we need a real string here. + s, ok := d.is[string(v)] // no allocation here, per go implementation + if !ok { + s = string(v) // new allocation here + d.is[s] = s + } + return s } -// func (d *Decoder) intern(s string) { -// if d.is != nil { -// d.is[s] = s -// } -// } - // nextValueBytes returns the next value in the stream as a set of bytes. -func (d *Decoder) nextValueBytes() []byte { +func (d *Decoder) nextValueBytes() (bs []byte) { d.d.uncacheRead() d.r.track() d.swallow() - return d.r.stopTrack() + bs = d.r.stopTrack() + return } -func (d *Decoder) raw() []byte { +func (d *Decoder) rawBytes() []byte { // ensure that this is not a view into the bytes // i.e. make new copy always. bs := d.nextValueBytes() @@ -1917,6 +2364,10 @@ func (d *Decoder) raw() []byte { return bs2 } +func (d *Decoder) wrapErrstr(v interface{}, err *error) { + *err = fmt.Errorf("%s decode error [pos %d]: %v", d.hh.Name(), d.r.numread(), v) +} + // -------------------------------------------------- // decSliceHelper assists when decoding into a slice, from a map or an array in the stream. @@ -1930,12 +2381,13 @@ type decSliceHelper struct { func (d *Decoder) decSliceHelperStart() (x decSliceHelper, clen int) { dd := d.d ctyp := dd.ContainerType() - if ctyp == valueTypeArray { + switch ctyp { + case valueTypeArray: x.array = true clen = dd.ReadArrayStart() - } else if ctyp == valueTypeMap { + case valueTypeMap: clen = dd.ReadMapStart() * 2 - } else { + default: d.errorf("only encoded map or array can be decoded into a slice (%d)", ctyp) } // x.ct = ctyp @@ -1944,30 +2396,20 @@ func (d *Decoder) decSliceHelperStart() (x decSliceHelper, clen int) { } func (x decSliceHelper) End() { - cr := x.d.cr - if cr == nil { - return - } if x.array { - cr.sendContainerState(containerArrayEnd) + x.d.d.ReadArrayEnd() } else { - cr.sendContainerState(containerMapEnd) + x.d.d.ReadMapEnd() } } func (x decSliceHelper) ElemContainerState(index int) { - cr := x.d.cr - if cr == nil { - return - } if x.array { - cr.sendContainerState(containerArrayElem) + x.d.d.ReadArrayElem() + } else if index%2 == 0 { + x.d.d.ReadMapElemKey() } else { - if index%2 == 0 { - cr.sendContainerState(containerMapKey) - } else { - cr.sendContainerState(containerMapValue) - } + x.d.d.ReadMapElemValue() } } @@ -1983,12 +2425,11 @@ func decByteSlice(r decReader, clen, maxInitLen int, bs []byte) (bsOut []byte) { r.readb(bsOut) } else { // bsOut = make([]byte, clen) - len2, _ := decInferLen(clen, maxInitLen, 1) + len2 := decInferLen(clen, maxInitLen, 1) bsOut = make([]byte, len2) r.readb(bsOut) for len2 < clen { - len3, _ := decInferLen(clen-len2, maxInitLen, 1) - // fmt.Printf(">>>>> TESTING: in loop: clen: %v, maxInitLen: %v, len2: %v, len3: %v\n", clen, maxInitLen, len2, len3) + len3 := decInferLen(clen-len2, maxInitLen, 1) bs3 := bsOut bsOut = make([]byte, len2+len3) copy(bsOut, bs3) @@ -2019,11 +2460,14 @@ func detachZeroCopyBytes(isBytesReader bool, dest []byte, in []byte) (out []byte // - maxlen: max length to be returned. // if <= 0, it is unset, and we infer it based on the unit size // - unit: number of bytes for each element of the collection -func decInferLen(clen, maxlen, unit int) (rvlen int, truncated bool) { +func decInferLen(clen, maxlen, unit int) (rvlen int) { // handle when maxlen is not set i.e. <= 0 if clen <= 0 { return } + if unit == 0 { + return clen + } if maxlen <= 0 { // no maxlen defined. Use maximum of 256K memory, with a floor of 4K items. // maxlen = 256 * 1024 / unit @@ -2038,39 +2482,57 @@ func decInferLen(clen, maxlen, unit int) (rvlen int, truncated bool) { } if clen > maxlen { rvlen = maxlen - truncated = true } else { rvlen = clen } return - // if clen <= 0 { - // rvlen = 0 - // } else if maxlen > 0 && clen > maxlen { - // rvlen = maxlen - // truncated = true - // } else { - // rvlen = clen - // } - // return } -// // implement overall decReader wrapping both, for possible use inline: -// type decReaderT struct { -// bytes bool -// rb *bytesDecReader -// ri *ioDecReader -// } -// -// // implement *Decoder as a decReader. -// // Using decReaderT (defined just above) caused performance degradation -// // possibly because of constant copying the value, -// // and some value->interface conversion causing allocation. -// func (d *Decoder) unreadn1() { -// if d.bytes { -// d.rb.unreadn1() -// } else { -// d.ri.unreadn1() -// } -// } -// ... for other methods of decReader. -// Testing showed that performance improvement was negligible. +func expandSliceRV(s reflect.Value, st reflect.Type, canChange bool, stElemSize, num, slen, scap int) ( + s2 reflect.Value, scap2 int, changed bool, err string) { + l1 := slen + num // new slice length + if l1 < slen { + err = errmsgExpandSliceOverflow + return + } + if l1 <= scap { + if s.CanSet() { + s.SetLen(l1) + } else if canChange { + s2 = s.Slice(0, l1) + scap2 = scap + changed = true + } else { + err = errmsgExpandSliceCannotChange + return + } + return + } + if !canChange { + err = errmsgExpandSliceCannotChange + return + } + scap2 = growCap(scap, stElemSize, num) + s2 = reflect.MakeSlice(st, l1, scap2) + changed = true + reflect.Copy(s2, s) + return +} + +func decReadFull(r io.Reader, bs []byte) (n int, err error) { + var nn int + for n < len(bs) && err == nil { + nn, err = r.Read(bs[n:]) + if nn > 0 { + if err == io.EOF { + // leave EOF for next time + err = nil + } + n += nn + } + } + + // do not do this - it serves no purpose + // if n != len(bs) && err == io.EOF { err = io.ErrUnexpectedEOF } + return +} diff --git a/vendor/github.com/ugorji/go/codec/decode_go.go b/vendor/github.com/ugorji/go/codec/decode_go.go deleted file mode 100644 index ba289cef6..000000000 --- a/vendor/github.com/ugorji/go/codec/decode_go.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a MIT license found in the LICENSE file. - -// +build go1.5 - -package codec - -import "reflect" - -const reflectArrayOfSupported = true - -func reflectArrayOf(rvn reflect.Value) (rvn2 reflect.Value) { - rvn2 = reflect.New(reflect.ArrayOf(rvn.Len(), intfTyp)).Elem() - reflect.Copy(rvn2, rvn) - return -} diff --git a/vendor/github.com/ugorji/go/codec/decode_go14.go b/vendor/github.com/ugorji/go/codec/decode_go14.go deleted file mode 100644 index 50063bc8f..000000000 --- a/vendor/github.com/ugorji/go/codec/decode_go14.go +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a MIT license found in the LICENSE file. - -// +build !go1.5 - -package codec - -import "reflect" - -const reflectArrayOfSupported = false - -func reflectArrayOf(rvn reflect.Value) (rvn2 reflect.Value) { - panic("reflect.ArrayOf unsupported") -} diff --git a/vendor/github.com/ugorji/go/codec/encode.go b/vendor/github.com/ugorji/go/codec/encode.go index 268154d24..48053d24c 100644 --- a/vendor/github.com/ugorji/go/codec/encode.go +++ b/vendor/github.com/ugorji/go/codec/encode.go @@ -1,42 +1,24 @@ -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec import ( + "bufio" "encoding" + "errors" "fmt" "io" "reflect" "sort" + "strconv" "sync" + "time" ) -const ( - defEncByteBufSize = 1 << 6 // 4:16, 6:64, 8:256, 10:1024 -) +const defEncByteBufSize = 1 << 6 // 4:16, 6:64, 8:256, 10:1024 -// AsSymbolFlag defines what should be encoded as symbols. -type AsSymbolFlag uint8 - -const ( - // AsSymbolDefault is default. - // Currently, this means only encode struct field names as symbols. - // The default is subject to change. - AsSymbolDefault AsSymbolFlag = iota - - // AsSymbolAll means encode anything which could be a symbol as a symbol. - AsSymbolAll = 0xfe - - // AsSymbolNone means do not encode anything as a symbol. - AsSymbolNone = 1 << iota - - // AsSymbolMapStringKeys means encode keys in map[string]XXX as symbols. - AsSymbolMapStringKeysFlag - - // AsSymbolStructFieldName means encode struct field names as symbols. - AsSymbolStructFieldNameFlag -) +var errEncoderNotInitialized = errors.New("Encoder not initialized") // encWriter abstracts writing to a byte array or to an io.Writer. type encWriter interface { @@ -49,8 +31,6 @@ type encWriter interface { // encDriver abstracts the actual codec (binc vs msgpack, etc) type encDriver interface { - IsBuiltinType(rt uintptr) bool - EncodeBuiltin(rt uintptr, v interface{}) EncodeNil() EncodeInt(i int64) EncodeUint(i uint64) @@ -60,37 +40,69 @@ type encDriver interface { // encodeExtPreamble(xtag byte, length int) EncodeRawExt(re *RawExt, e *Encoder) EncodeExt(v interface{}, xtag uint64, ext Ext, e *Encoder) - EncodeArrayStart(length int) - EncodeMapStart(length int) EncodeString(c charEncoding, v string) - EncodeSymbol(v string) + // EncodeSymbol(v string) EncodeStringBytes(c charEncoding, v []byte) - //TODO + EncodeTime(time.Time) //encBignum(f *big.Int) //encStringRunes(c charEncoding, v []rune) + WriteArrayStart(length int) + WriteArrayElem() + WriteArrayEnd() + WriteMapStart(length int) + WriteMapElemKey() + WriteMapElemValue() + WriteMapEnd() reset() -} - -type encDriverAsis interface { - EncodeAsis(v []byte) -} - -type encNoSeparator struct{} - -func (_ encNoSeparator) EncodeEnd() {} - -type ioEncWriterWriter interface { - WriteByte(c byte) error - WriteString(s string) (n int, err error) - Write(p []byte) (n int, err error) + atEndOfEncode() } type ioEncStringWriter interface { WriteString(s string) (n int, err error) } +type encDriverAsis interface { + EncodeAsis(v []byte) +} + +type encDriverNoopContainerWriter struct{} + +func (encDriverNoopContainerWriter) WriteArrayStart(length int) {} +func (encDriverNoopContainerWriter) WriteArrayElem() {} +func (encDriverNoopContainerWriter) WriteArrayEnd() {} +func (encDriverNoopContainerWriter) WriteMapStart(length int) {} +func (encDriverNoopContainerWriter) WriteMapElemKey() {} +func (encDriverNoopContainerWriter) WriteMapElemValue() {} +func (encDriverNoopContainerWriter) WriteMapEnd() {} +func (encDriverNoopContainerWriter) atEndOfEncode() {} + +type encDriverTrackContainerWriter struct { + c containerState +} + +func (e *encDriverTrackContainerWriter) WriteArrayStart(length int) { e.c = containerArrayStart } +func (e *encDriverTrackContainerWriter) WriteArrayElem() { e.c = containerArrayElem } +func (e *encDriverTrackContainerWriter) WriteArrayEnd() { e.c = containerArrayEnd } +func (e *encDriverTrackContainerWriter) WriteMapStart(length int) { e.c = containerMapStart } +func (e *encDriverTrackContainerWriter) WriteMapElemKey() { e.c = containerMapKey } +func (e *encDriverTrackContainerWriter) WriteMapElemValue() { e.c = containerMapValue } +func (e *encDriverTrackContainerWriter) WriteMapEnd() { e.c = containerMapEnd } +func (e *encDriverTrackContainerWriter) atEndOfEncode() {} + +// type ioEncWriterWriter interface { +// WriteByte(c byte) error +// WriteString(s string) (n int, err error) +// Write(p []byte) (n int, err error) +// } + +// EncodeOptions captures configuration options during encode. type EncodeOptions struct { + // WriterBufferSize is the size of the buffer used when writing. + // + // if > 0, we use a smart buffer internally for performance purposes. + WriterBufferSize int + // Encode a struct as an array, and not as a map StructToArray bool @@ -132,330 +144,188 @@ type EncodeOptions struct { // If unset, we error out. Raw bool - // AsSymbols defines what should be encoded as symbols. - // - // Encoding as symbols can reduce the encoded size significantly. - // - // However, during decoding, each string to be encoded as a symbol must - // be checked to see if it has been seen before. Consequently, encoding time - // will increase if using symbols, because string comparisons has a clear cost. - // - // Sample values: - // AsSymbolNone - // AsSymbolAll - // AsSymbolMapStringKeys - // AsSymbolMapStringKeysFlag | AsSymbolStructFieldNameFlag - AsSymbols AsSymbolFlag + // // AsSymbols defines what should be encoded as symbols. + // // + // // Encoding as symbols can reduce the encoded size significantly. + // // + // // However, during decoding, each string to be encoded as a symbol must + // // be checked to see if it has been seen before. Consequently, encoding time + // // will increase if using symbols, because string comparisons has a clear cost. + // // + // // Sample values: + // // AsSymbolNone + // // AsSymbolAll + // // AsSymbolMapStringKeys + // // AsSymbolMapStringKeysFlag | AsSymbolStructFieldNameFlag + // AsSymbols AsSymbolFlag } // --------------------------------------------- -type simpleIoEncWriterWriter struct { +// ioEncWriter implements encWriter and can write to an io.Writer implementation +type ioEncWriter struct { w io.Writer + ww io.Writer bw io.ByteWriter sw ioEncStringWriter - bs [1]byte + fw ioFlusher + b [8]byte } -func (o *simpleIoEncWriterWriter) WriteByte(c byte) (err error) { - if o.bw != nil { - return o.bw.WriteByte(c) - } - // _, err = o.w.Write([]byte{c}) - o.bs[0] = c - _, err = o.w.Write(o.bs[:]) +func (z *ioEncWriter) WriteByte(b byte) (err error) { + z.b[0] = b + _, err = z.w.Write(z.b[:1]) return } -func (o *simpleIoEncWriterWriter) WriteString(s string) (n int, err error) { - if o.sw != nil { - return o.sw.WriteString(s) - } - // return o.w.Write([]byte(s)) - return o.w.Write(bytesView(s)) -} - -func (o *simpleIoEncWriterWriter) Write(p []byte) (n int, err error) { - return o.w.Write(p) -} - -// ---------------------------------------- - -// ioEncWriter implements encWriter and can write to an io.Writer implementation -type ioEncWriter struct { - w ioEncWriterWriter - s simpleIoEncWriterWriter - // x [8]byte // temp byte array re-used internally for efficiency +func (z *ioEncWriter) WriteString(s string) (n int, err error) { + return z.w.Write(bytesView(s)) } func (z *ioEncWriter) writeb(bs []byte) { - if len(bs) == 0 { - return - } - n, err := z.w.Write(bs) - if err != nil { + if _, err := z.ww.Write(bs); err != nil { panic(err) } - if n != len(bs) { - panic(fmt.Errorf("incorrect num bytes written. Expecting: %v, Wrote: %v", len(bs), n)) - } } func (z *ioEncWriter) writestr(s string) { - n, err := z.w.WriteString(s) - if err != nil { + if _, err := z.sw.WriteString(s); err != nil { panic(err) } - if n != len(s) { - panic(fmt.Errorf("incorrect num bytes written. Expecting: %v, Wrote: %v", len(s), n)) - } } func (z *ioEncWriter) writen1(b byte) { - if err := z.w.WriteByte(b); err != nil { + if err := z.bw.WriteByte(b); err != nil { panic(err) } } -func (z *ioEncWriter) writen2(b1 byte, b2 byte) { - z.writen1(b1) - z.writen1(b2) -} - -func (z *ioEncWriter) atEndOfEncode() {} - -// ---------------------------------------- - -// bytesEncWriter implements encWriter and can write to an byte slice. -// It is used by Marshal function. -type bytesEncWriter struct { - b []byte - c int // cursor - out *[]byte // write out on atEndOfEncode -} - -func (z *bytesEncWriter) writeb(s []byte) { - if len(s) == 0 { - return - } - oc, a := z.growNoAlloc(len(s)) - if a { - z.growAlloc(len(s), oc) - } - copy(z.b[oc:], s) -} - -func (z *bytesEncWriter) writestr(s string) { - if len(s) == 0 { - return - } - oc, a := z.growNoAlloc(len(s)) - if a { - z.growAlloc(len(s), oc) - } - copy(z.b[oc:], s) -} - -func (z *bytesEncWriter) writen1(b1 byte) { - oc, a := z.growNoAlloc(1) - if a { - z.growAlloc(1, oc) - } - z.b[oc] = b1 -} - -func (z *bytesEncWriter) writen2(b1 byte, b2 byte) { - oc, a := z.growNoAlloc(2) - if a { - z.growAlloc(2, oc) - } - z.b[oc+1] = b2 - z.b[oc] = b1 -} - -func (z *bytesEncWriter) atEndOfEncode() { - *(z.out) = z.b[:z.c] -} - -// have a growNoalloc(n int), which can be inlined. -// if allocation is needed, then call growAlloc(n int) - -func (z *bytesEncWriter) growNoAlloc(n int) (oldcursor int, allocNeeded bool) { - oldcursor = z.c - z.c = z.c + n - if z.c > len(z.b) { - if z.c > cap(z.b) { - allocNeeded = true - } else { - z.b = z.b[:cap(z.b)] +func (z *ioEncWriter) writen2(b1, b2 byte) { + var err error + if err = z.bw.WriteByte(b1); err == nil { + if err = z.bw.WriteByte(b2); err == nil { + return } } - return + panic(err) } -func (z *bytesEncWriter) growAlloc(n int, oldcursor int) { - // appendslice logic (if cap < 1024, *2, else *1.25): more expensive. many copy calls. - // bytes.Buffer model (2*cap + n): much better - // bs := make([]byte, 2*cap(z.b)+n) - bs := make([]byte, growCap(cap(z.b), 1, n)) - copy(bs, z.b[:oldcursor]) - z.b = bs +// func (z *ioEncWriter) writen5(b1, b2, b3, b4, b5 byte) { +// z.b[0], z.b[1], z.b[2], z.b[3], z.b[4] = b1, b2, b3, b4, b5 +// if _, err := z.ww.Write(z.b[:5]); err != nil { +// panic(err) +// } +// } + +func (z *ioEncWriter) atEndOfEncode() { + if z.fw != nil { + z.fw.Flush() + } } // --------------------------------------------- -type encFnInfo struct { - e *Encoder - ti *typeInfo - xfFn Ext - xfTag uint64 - seq seqType +// bytesEncAppender implements encWriter and can write to an byte slice. +type bytesEncAppender struct { + b []byte + out *[]byte } -func (f *encFnInfo) builtin(rv reflect.Value) { - f.e.e.EncodeBuiltin(f.ti.rtid, rv.Interface()) +func (z *bytesEncAppender) writeb(s []byte) { + z.b = append(z.b, s...) +} +func (z *bytesEncAppender) writestr(s string) { + z.b = append(z.b, s...) +} +func (z *bytesEncAppender) writen1(b1 byte) { + z.b = append(z.b, b1) +} +func (z *bytesEncAppender) writen2(b1, b2 byte) { + z.b = append(z.b, b1, b2) +} +func (z *bytesEncAppender) atEndOfEncode() { + *(z.out) = z.b +} +func (z *bytesEncAppender) reset(in []byte, out *[]byte) { + z.b = in[:0] + z.out = out } -func (f *encFnInfo) raw(rv reflect.Value) { - f.e.raw(rv.Interface().(Raw)) +// --------------------------------------------- + +func (e *Encoder) rawExt(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeRawExt(rv2i(rv).(*RawExt), e) } -func (f *encFnInfo) rawExt(rv reflect.Value) { - // rev := rv.Interface().(RawExt) - // f.e.e.EncodeRawExt(&rev, f.e) - var re *RawExt - if rv.CanAddr() { - re = rv.Addr().Interface().(*RawExt) - } else { - rev := rv.Interface().(RawExt) - re = &rev - } - f.e.e.EncodeRawExt(re, f.e) +func (e *Encoder) ext(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeExt(rv2i(rv), f.xfTag, f.xfFn, e) } -func (f *encFnInfo) ext(rv reflect.Value) { - // if this is a struct|array and it was addressable, then pass the address directly (not the value) - if k := rv.Kind(); (k == reflect.Struct || k == reflect.Array) && rv.CanAddr() { - rv = rv.Addr() - } - f.e.e.EncodeExt(rv.Interface(), f.xfTag, f.xfFn, f.e) +func (e *Encoder) selferMarshal(f *codecFnInfo, rv reflect.Value) { + rv2i(rv).(Selfer).CodecEncodeSelf(e) } -func (f *encFnInfo) getValueForMarshalInterface(rv reflect.Value, indir int8) (v interface{}, proceed bool) { - if indir == 0 { - v = rv.Interface() - } else if indir == -1 { - // If a non-pointer was passed to Encode(), then that value is not addressable. - // Take addr if addressable, else copy value to an addressable value. - if rv.CanAddr() { - v = rv.Addr().Interface() - } else { - rv2 := reflect.New(rv.Type()) - rv2.Elem().Set(rv) - v = rv2.Interface() - // fmt.Printf("rv.Type: %v, rv2.Type: %v, v: %v\n", rv.Type(), rv2.Type(), v) - } - } else { - for j := int8(0); j < indir; j++ { - if rv.IsNil() { - f.e.e.EncodeNil() - return - } - rv = rv.Elem() - } - v = rv.Interface() - } - return v, true +func (e *Encoder) binaryMarshal(f *codecFnInfo, rv reflect.Value) { + bs, fnerr := rv2i(rv).(encoding.BinaryMarshaler).MarshalBinary() + e.marshal(bs, fnerr, false, cRAW) } -func (f *encFnInfo) selferMarshal(rv reflect.Value) { - if v, proceed := f.getValueForMarshalInterface(rv, f.ti.csIndir); proceed { - v.(Selfer).CodecEncodeSelf(f.e) - } +func (e *Encoder) textMarshal(f *codecFnInfo, rv reflect.Value) { + bs, fnerr := rv2i(rv).(encoding.TextMarshaler).MarshalText() + e.marshal(bs, fnerr, false, cUTF8) } -func (f *encFnInfo) binaryMarshal(rv reflect.Value) { - if v, proceed := f.getValueForMarshalInterface(rv, f.ti.bmIndir); proceed { - bs, fnerr := v.(encoding.BinaryMarshaler).MarshalBinary() - f.e.marshal(bs, fnerr, false, c_RAW) - } +func (e *Encoder) jsonMarshal(f *codecFnInfo, rv reflect.Value) { + bs, fnerr := rv2i(rv).(jsonMarshaler).MarshalJSON() + e.marshal(bs, fnerr, true, cUTF8) } -func (f *encFnInfo) textMarshal(rv reflect.Value) { - if v, proceed := f.getValueForMarshalInterface(rv, f.ti.tmIndir); proceed { - // debugf(">>>> encoding.TextMarshaler: %T", rv.Interface()) - bs, fnerr := v.(encoding.TextMarshaler).MarshalText() - f.e.marshal(bs, fnerr, false, c_UTF8) - } +func (e *Encoder) raw(f *codecFnInfo, rv reflect.Value) { + e.rawBytes(rv2i(rv).(Raw)) } -func (f *encFnInfo) jsonMarshal(rv reflect.Value) { - if v, proceed := f.getValueForMarshalInterface(rv, f.ti.jmIndir); proceed { - bs, fnerr := v.(jsonMarshaler).MarshalJSON() - f.e.marshal(bs, fnerr, true, c_UTF8) - } +func (e *Encoder) kInvalid(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeNil() } -func (f *encFnInfo) kBool(rv reflect.Value) { - f.e.e.EncodeBool(rv.Bool()) +func (e *Encoder) kErr(f *codecFnInfo, rv reflect.Value) { + e.errorf("unsupported kind %s, for %#v", rv.Kind(), rv) } -func (f *encFnInfo) kString(rv reflect.Value) { - f.e.e.EncodeString(c_UTF8, rv.String()) -} - -func (f *encFnInfo) kFloat64(rv reflect.Value) { - f.e.e.EncodeFloat64(rv.Float()) -} - -func (f *encFnInfo) kFloat32(rv reflect.Value) { - f.e.e.EncodeFloat32(float32(rv.Float())) -} - -func (f *encFnInfo) kInt(rv reflect.Value) { - f.e.e.EncodeInt(rv.Int()) -} - -func (f *encFnInfo) kUint(rv reflect.Value) { - f.e.e.EncodeUint(rv.Uint()) -} - -func (f *encFnInfo) kInvalid(rv reflect.Value) { - f.e.e.EncodeNil() -} - -func (f *encFnInfo) kErr(rv reflect.Value) { - f.e.errorf("unsupported kind %s, for %#v", rv.Kind(), rv) -} - -func (f *encFnInfo) kSlice(rv reflect.Value) { +func (e *Encoder) kSlice(f *codecFnInfo, rv reflect.Value) { ti := f.ti + ee := e.e // array may be non-addressable, so we have to manage with care // (don't call rv.Bytes, rv.Slice, etc). // E.g. type struct S{B [2]byte}; // Encode(S{}) will bomb on "panic: slice of unaddressable array". - e := f.e if f.seq != seqTypeArray { if rv.IsNil() { - e.e.EncodeNil() + ee.EncodeNil() return } // If in this method, then there was no extension function defined. // So it's okay to treat as []byte. if ti.rtid == uint8SliceTypId { - e.e.EncodeStringBytes(c_RAW, rv.Bytes()) + ee.EncodeStringBytes(cRAW, rv.Bytes()) return } } - cr := e.cr - rtelem := ti.rt.Elem() + if f.seq == seqTypeChan && ti.chandir&uint8(reflect.RecvDir) == 0 { + e.errorf("send-only channel cannot be used for receiving byte(s)") + } + elemsep := e.esep l := rv.Len() - if ti.rtid == uint8SliceTypId || rtelem.Kind() == reflect.Uint8 { + rtelem := ti.elem + rtelemIsByte := uint8TypId == rt2id(rtelem) // NOT rtelem.Kind() == reflect.Uint8 + // if a slice, array or chan of bytes, treat specially + if rtelemIsByte { switch f.seq { + case seqTypeSlice: + ee.EncodeStringBytes(cRAW, rv.Bytes()) case seqTypeArray: - // if l == 0 { e.e.encodeStringBytes(c_RAW, nil) } else if rv.CanAddr() { - e.e.EncodeStringBytes(c_RAW, rv.Slice(0, l).Bytes()) + ee.EncodeStringBytes(cRAW, rv.Slice(0, l).Bytes()) } else { var bs []byte if l <= cap(e.b) { @@ -464,26 +334,23 @@ func (f *encFnInfo) kSlice(rv reflect.Value) { bs = make([]byte, l) } reflect.Copy(reflect.ValueOf(bs), rv) - // TODO: Test that reflect.Copy works instead of manual one-by-one - // for i := 0; i < l; i++ { - // bs[i] = byte(rv.Index(i).Uint()) - // } - e.e.EncodeStringBytes(c_RAW, bs) + ee.EncodeStringBytes(cRAW, bs) } - case seqTypeSlice: - e.e.EncodeStringBytes(c_RAW, rv.Bytes()) case seqTypeChan: bs := e.b[:0] // do not use range, so that the number of elements encoded // does not change, and encoding does not hang waiting on someone to close chan. - // for b := range rv.Interface().(<-chan byte) { - // bs = append(bs, b) - // } - ch := rv.Interface().(<-chan byte) + // for b := range rv2i(rv).(<-chan byte) { bs = append(bs, b) } + // ch := rv2i(rv).(<-chan byte) // fix error - that this is a chan byte, not a <-chan byte. + irv := rv2i(rv) + ch, ok := irv.(<-chan byte) + if !ok { + ch = irv.(chan byte) + } for i := 0; i < l; i++ { bs = append(bs, <-ch) } - e.e.EncodeStringBytes(c_RAW, bs) + ee.EncodeStringBytes(cRAW, bs) } return } @@ -493,87 +360,180 @@ func (f *encFnInfo) kSlice(rv reflect.Value) { e.errorf("mapBySlice requires even slice length, but got %v", l) return } - e.e.EncodeMapStart(l / 2) + ee.WriteMapStart(l / 2) } else { - e.e.EncodeArrayStart(l) + ee.WriteArrayStart(l) } if l > 0 { + var fn *codecFn for rtelem.Kind() == reflect.Ptr { rtelem = rtelem.Elem() } // if kind is reflect.Interface, do not pre-determine the // encoding type, because preEncodeValue may break it down to // a concrete type and kInterface will bomb. - var fn *encFn if rtelem.Kind() != reflect.Interface { - rtelemid := reflect.ValueOf(rtelem).Pointer() - fn = e.getEncFn(rtelemid, rtelem, true, true) + fn = e.cfer().get(rtelem, true, true) } - // TODO: Consider perf implication of encoding odd index values as symbols if type is string for j := 0; j < l; j++ { - if cr != nil { + if elemsep { if ti.mbs { if j%2 == 0 { - cr.sendContainerState(containerMapKey) + ee.WriteMapElemKey() } else { - cr.sendContainerState(containerMapValue) + ee.WriteMapElemValue() } } else { - cr.sendContainerState(containerArrayElem) + ee.WriteArrayElem() } } if f.seq == seqTypeChan { if rv2, ok2 := rv.Recv(); ok2 { - e.encodeValue(rv2, fn) + e.encodeValue(rv2, fn, true) } else { - e.encode(nil) // WE HAVE TO DO SOMETHING, so nil if nothing received. + ee.EncodeNil() // WE HAVE TO DO SOMETHING, so nil if nothing received. } } else { - e.encodeValue(rv.Index(j), fn) + e.encodeValue(rv.Index(j), fn, true) } } } - if cr != nil { - if ti.mbs { - cr.sendContainerState(containerMapEnd) - } else { - cr.sendContainerState(containerArrayEnd) - } + if ti.mbs { + ee.WriteMapEnd() + } else { + ee.WriteArrayEnd() } } -func (f *encFnInfo) kStruct(rv reflect.Value) { +func (e *Encoder) kStructNoOmitempty(f *codecFnInfo, rv reflect.Value) { fti := f.ti - e := f.e - cr := e.cr - tisfi := fti.sfip + elemsep := e.esep + tisfi := fti.sfiSrc toMap := !(fti.toArray || e.h.StructToArray) - newlen := len(fti.sfi) + if toMap { + tisfi = fti.sfiSort + } + ee := e.e + + sfn := structFieldNode{v: rv, update: false} + if toMap { + ee.WriteMapStart(len(tisfi)) + if elemsep { + for _, si := range tisfi { + ee.WriteMapElemKey() + // ee.EncodeString(cUTF8, si.encName) + encStructFieldKey(ee, fti.keyType, si.encName) + ee.WriteMapElemValue() + e.encodeValue(sfn.field(si), nil, true) + } + } else { + for _, si := range tisfi { + // ee.EncodeString(cUTF8, si.encName) + encStructFieldKey(ee, fti.keyType, si.encName) + e.encodeValue(sfn.field(si), nil, true) + } + } + ee.WriteMapEnd() + } else { + ee.WriteArrayStart(len(tisfi)) + if elemsep { + for _, si := range tisfi { + ee.WriteArrayElem() + e.encodeValue(sfn.field(si), nil, true) + } + } else { + for _, si := range tisfi { + e.encodeValue(sfn.field(si), nil, true) + } + } + ee.WriteArrayEnd() + } +} + +func encStructFieldKey(ee encDriver, keyType valueType, s string) { + var m must + + // use if-else-if, not switch (which compiles to binary-search) + // since keyType is typically valueTypeString, branch prediction is pretty good. + + if keyType == valueTypeString { + ee.EncodeString(cUTF8, s) + } else if keyType == valueTypeInt { + ee.EncodeInt(m.Int(strconv.ParseInt(s, 10, 64))) + } else if keyType == valueTypeUint { + ee.EncodeUint(m.Uint(strconv.ParseUint(s, 10, 64))) + } else if keyType == valueTypeFloat { + ee.EncodeFloat64(m.Float(strconv.ParseFloat(s, 64))) + } else { + ee.EncodeString(cUTF8, s) + } +} + +func (e *Encoder) kStruct(f *codecFnInfo, rv reflect.Value) { + fti := f.ti + elemsep := e.esep + tisfi := fti.sfiSrc + toMap := !(fti.toArray || e.h.StructToArray) + // if toMap, use the sorted array. If toArray, use unsorted array (to match sequence in struct) + if toMap { + tisfi = fti.sfiSort + } + newlen := len(fti.sfiSort) + ee := e.e // Use sync.Pool to reduce allocating slices unnecessarily. // The cost of sync.Pool is less than the cost of new allocation. - pool, poolv, fkvs := encStructPoolGet(newlen) + // + // Each element of the array pools one of encStructPool(8|16|32|64). + // It allows the re-use of slices up to 64 in length. + // A performance cost of encoding structs was collecting + // which values were empty and should be omitted. + // We needed slices of reflect.Value and string to collect them. + // This shared pool reduces the amount of unnecessary creation we do. + // The cost is that of locking sometimes, but sync.Pool is efficient + // enough to reduce thread contention. - // if toMap, use the sorted array. If toArray, use unsorted array (to match sequence in struct) - if toMap { - tisfi = fti.sfi + var spool *sync.Pool + var poolv interface{} + var fkvs []stringRv + // fmt.Printf(">>>>>>>>>>>>>> encode.kStruct: newlen: %d\n", newlen) + if newlen <= 8 { + spool, poolv = pool.stringRv8() + fkvs = poolv.(*[8]stringRv)[:newlen] + } else if newlen <= 16 { + spool, poolv = pool.stringRv16() + fkvs = poolv.(*[16]stringRv)[:newlen] + } else if newlen <= 32 { + spool, poolv = pool.stringRv32() + fkvs = poolv.(*[32]stringRv)[:newlen] + } else if newlen <= 64 { + spool, poolv = pool.stringRv64() + fkvs = poolv.(*[64]stringRv)[:newlen] + } else if newlen <= 128 { + spool, poolv = pool.stringRv128() + fkvs = poolv.(*[128]stringRv)[:newlen] + } else { + fkvs = make([]stringRv, newlen) } + newlen = 0 var kv stringRv recur := e.h.RecursiveEmptyCheck + sfn := structFieldNode{v: rv, update: false} for _, si := range tisfi { - kv.r = si.field(rv, false) + // kv.r = si.field(rv, false) + kv.r = sfn.field(si) if toMap { - if si.omitEmpty && isEmptyValue(kv.r, recur, recur) { + if si.omitEmpty() && isEmptyValue(kv.r, e.h.TypeInfos, recur, recur) { continue } kv.v = si.encName } else { // use the zero value. // if a reference or struct, set to nil (so you do not output too much) - if si.omitEmpty && isEmptyValue(kv.r, recur, recur) { + if si.omitEmpty() && isEmptyValue(kv.r, e.h.TypeInfos, recur, recur) { switch kv.r.Kind() { case reflect.Struct, reflect.Interface, reflect.Ptr, reflect.Array, reflect.Map, reflect.Slice: kv.r = reflect.Value{} //encode as nil @@ -584,91 +544,64 @@ func (f *encFnInfo) kStruct(rv reflect.Value) { newlen++ } - // debugf(">>>> kStruct: newlen: %v", newlen) - // sep := !e.be - ee := e.e //don't dereference every time - if toMap { - ee.EncodeMapStart(newlen) - // asSymbols := e.h.AsSymbols&AsSymbolStructFieldNameFlag != 0 - asSymbols := e.h.AsSymbols == AsSymbolDefault || e.h.AsSymbols&AsSymbolStructFieldNameFlag != 0 - for j := 0; j < newlen; j++ { - kv = fkvs[j] - if cr != nil { - cr.sendContainerState(containerMapKey) + ee.WriteMapStart(newlen) + if elemsep { + for j := 0; j < newlen; j++ { + kv = fkvs[j] + ee.WriteMapElemKey() + // ee.EncodeString(cUTF8, kv.v) + encStructFieldKey(ee, fti.keyType, kv.v) + ee.WriteMapElemValue() + e.encodeValue(kv.r, nil, true) } - if asSymbols { - ee.EncodeSymbol(kv.v) - } else { - ee.EncodeString(c_UTF8, kv.v) + } else { + for j := 0; j < newlen; j++ { + kv = fkvs[j] + // ee.EncodeString(cUTF8, kv.v) + encStructFieldKey(ee, fti.keyType, kv.v) + e.encodeValue(kv.r, nil, true) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - e.encodeValue(kv.r, nil) - } - if cr != nil { - cr.sendContainerState(containerMapEnd) } + ee.WriteMapEnd() } else { - ee.EncodeArrayStart(newlen) - for j := 0; j < newlen; j++ { - kv = fkvs[j] - if cr != nil { - cr.sendContainerState(containerArrayElem) + ee.WriteArrayStart(newlen) + if elemsep { + for j := 0; j < newlen; j++ { + ee.WriteArrayElem() + e.encodeValue(fkvs[j].r, nil, true) + } + } else { + for j := 0; j < newlen; j++ { + e.encodeValue(fkvs[j].r, nil, true) } - e.encodeValue(kv.r, nil) - } - if cr != nil { - cr.sendContainerState(containerArrayEnd) } + ee.WriteArrayEnd() } // do not use defer. Instead, use explicit pool return at end of function. // defer has a cost we are trying to avoid. // If there is a panic and these slices are not returned, it is ok. - if pool != nil { - pool.Put(poolv) + if spool != nil { + spool.Put(poolv) } } -// func (f *encFnInfo) kPtr(rv reflect.Value) { -// debugf(">>>>>>> ??? encode kPtr called - shouldn't get called") -// if rv.IsNil() { -// f.e.e.encodeNil() -// return -// } -// f.e.encodeValue(rv.Elem()) -// } - -// func (f *encFnInfo) kInterface(rv reflect.Value) { -// println("kInterface called") -// debug.PrintStack() -// if rv.IsNil() { -// f.e.e.EncodeNil() -// return -// } -// f.e.encodeValue(rv.Elem(), nil) -// } - -func (f *encFnInfo) kMap(rv reflect.Value) { - ee := f.e.e +func (e *Encoder) kMap(f *codecFnInfo, rv reflect.Value) { + ee := e.e if rv.IsNil() { ee.EncodeNil() return } l := rv.Len() - ee.EncodeMapStart(l) - e := f.e - cr := e.cr + ee.WriteMapStart(l) + elemsep := e.esep if l == 0 { - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() return } - var asSymbols bool + // var asSymbols bool // determine the underlying key and val encFn's for the map. // This eliminates some work which is done for each loop iteration i.e. // rv.Type(), ref.ValueOf(rt).Pointer(), then check map/list for fn. @@ -676,269 +609,295 @@ func (f *encFnInfo) kMap(rv reflect.Value) { // However, if kind is reflect.Interface, do not pre-determine the // encoding type, because preEncodeValue may break it down to // a concrete type and kInterface will bomb. - var keyFn, valFn *encFn + var keyFn, valFn *codecFn ti := f.ti - rtkey := ti.rt.Key() - rtval := ti.rt.Elem() - rtkeyid := reflect.ValueOf(rtkey).Pointer() - // keyTypeIsString := f.ti.rt.Key().Kind() == reflect.String - var keyTypeIsString = rtkeyid == stringTypId - if keyTypeIsString { - asSymbols = e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 - } else { - for rtkey.Kind() == reflect.Ptr { - rtkey = rtkey.Elem() - } - if rtkey.Kind() != reflect.Interface { - rtkeyid = reflect.ValueOf(rtkey).Pointer() - keyFn = e.getEncFn(rtkeyid, rtkey, true, true) - } - } + rtkey0 := ti.key + rtkey := rtkey0 + rtval0 := ti.elem + rtval := rtval0 + // rtkeyid := rt2id(rtkey0) for rtval.Kind() == reflect.Ptr { rtval = rtval.Elem() } if rtval.Kind() != reflect.Interface { - rtvalid := reflect.ValueOf(rtval).Pointer() - valFn = e.getEncFn(rtvalid, rtval, true, true) + valFn = e.cfer().get(rtval, true, true) } mks := rv.MapKeys() - // for j, lmks := 0, len(mks); j < lmks; j++ { if e.h.Canonical { - e.kMapCanonical(rtkeyid, rtkey, rv, mks, valFn, asSymbols) - } else { - for j := range mks { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - if keyTypeIsString { - if asSymbols { - ee.EncodeSymbol(mks[j].String()) - } else { - ee.EncodeString(c_UTF8, mks[j].String()) - } - } else { - e.encodeValue(mks[j], keyFn) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - e.encodeValue(rv.MapIndex(mks[j]), valFn) + e.kMapCanonical(rtkey, rv, mks, valFn) + ee.WriteMapEnd() + return + } + + var keyTypeIsString = stringTypId == rt2id(rtkey0) // rtkeyid + if !keyTypeIsString { + for rtkey.Kind() == reflect.Ptr { + rtkey = rtkey.Elem() + } + if rtkey.Kind() != reflect.Interface { + // rtkeyid = rt2id(rtkey) + keyFn = e.cfer().get(rtkey, true, true) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) + + // for j, lmks := 0, len(mks); j < lmks; j++ { + for j := range mks { + if elemsep { + ee.WriteMapElemKey() + } + if keyTypeIsString { + ee.EncodeString(cUTF8, mks[j].String()) + } else { + e.encodeValue(mks[j], keyFn, true) + } + if elemsep { + ee.WriteMapElemValue() + } + e.encodeValue(rv.MapIndex(mks[j]), valFn, true) + } + ee.WriteMapEnd() } -func (e *Encoder) kMapCanonical(rtkeyid uintptr, rtkey reflect.Type, rv reflect.Value, mks []reflect.Value, valFn *encFn, asSymbols bool) { +func (e *Encoder) kMapCanonical(rtkey reflect.Type, rv reflect.Value, mks []reflect.Value, valFn *codecFn) { ee := e.e - cr := e.cr + elemsep := e.esep // we previously did out-of-band if an extension was registered. // This is not necessary, as the natural kind is sufficient for ordering. - if rtkeyid == uint8SliceTypId { - mksv := make([]bytesRv, len(mks)) + switch rtkey.Kind() { + case reflect.Bool: + mksv := make([]boolRv, len(mks)) for i, k := range mks { v := &mksv[i] v.r = k - v.v = k.Bytes() + v.v = k.Bool() } - sort.Sort(bytesRvSlice(mksv)) + sort.Sort(boolRvSlice(mksv)) for i := range mksv { - if cr != nil { - cr.sendContainerState(containerMapKey) + if elemsep { + ee.WriteMapElemKey() } - ee.EncodeStringBytes(c_RAW, mksv[i].v) - if cr != nil { - cr.sendContainerState(containerMapValue) + ee.EncodeBool(mksv[i].v) + if elemsep { + ee.WriteMapElemValue() } - e.encodeValue(rv.MapIndex(mksv[i].r), valFn) + e.encodeValue(rv.MapIndex(mksv[i].r), valFn, true) } - } else { - switch rtkey.Kind() { - case reflect.Bool: - mksv := make([]boolRv, len(mks)) + case reflect.String: + mksv := make([]stringRv, len(mks)) + for i, k := range mks { + v := &mksv[i] + v.r = k + v.v = k.String() + } + sort.Sort(stringRvSlice(mksv)) + for i := range mksv { + if elemsep { + ee.WriteMapElemKey() + } + ee.EncodeString(cUTF8, mksv[i].v) + if elemsep { + ee.WriteMapElemValue() + } + e.encodeValue(rv.MapIndex(mksv[i].r), valFn, true) + } + case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint, reflect.Uintptr: + mksv := make([]uintRv, len(mks)) + for i, k := range mks { + v := &mksv[i] + v.r = k + v.v = k.Uint() + } + sort.Sort(uintRvSlice(mksv)) + for i := range mksv { + if elemsep { + ee.WriteMapElemKey() + } + ee.EncodeUint(mksv[i].v) + if elemsep { + ee.WriteMapElemValue() + } + e.encodeValue(rv.MapIndex(mksv[i].r), valFn, true) + } + case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: + mksv := make([]intRv, len(mks)) + for i, k := range mks { + v := &mksv[i] + v.r = k + v.v = k.Int() + } + sort.Sort(intRvSlice(mksv)) + for i := range mksv { + if elemsep { + ee.WriteMapElemKey() + } + ee.EncodeInt(mksv[i].v) + if elemsep { + ee.WriteMapElemValue() + } + e.encodeValue(rv.MapIndex(mksv[i].r), valFn, true) + } + case reflect.Float32: + mksv := make([]floatRv, len(mks)) + for i, k := range mks { + v := &mksv[i] + v.r = k + v.v = k.Float() + } + sort.Sort(floatRvSlice(mksv)) + for i := range mksv { + if elemsep { + ee.WriteMapElemKey() + } + ee.EncodeFloat32(float32(mksv[i].v)) + if elemsep { + ee.WriteMapElemValue() + } + e.encodeValue(rv.MapIndex(mksv[i].r), valFn, true) + } + case reflect.Float64: + mksv := make([]floatRv, len(mks)) + for i, k := range mks { + v := &mksv[i] + v.r = k + v.v = k.Float() + } + sort.Sort(floatRvSlice(mksv)) + for i := range mksv { + if elemsep { + ee.WriteMapElemKey() + } + ee.EncodeFloat64(mksv[i].v) + if elemsep { + ee.WriteMapElemValue() + } + e.encodeValue(rv.MapIndex(mksv[i].r), valFn, true) + } + case reflect.Struct: + if rv.Type() == timeTyp { + mksv := make([]timeRv, len(mks)) for i, k := range mks { v := &mksv[i] v.r = k - v.v = k.Bool() + v.v = rv2i(k).(time.Time) } - sort.Sort(boolRvSlice(mksv)) + sort.Sort(timeRvSlice(mksv)) for i := range mksv { - if cr != nil { - cr.sendContainerState(containerMapKey) + if elemsep { + ee.WriteMapElemKey() } - ee.EncodeBool(mksv[i].v) - if cr != nil { - cr.sendContainerState(containerMapValue) + ee.EncodeTime(mksv[i].v) + if elemsep { + ee.WriteMapElemValue() } - e.encodeValue(rv.MapIndex(mksv[i].r), valFn) + e.encodeValue(rv.MapIndex(mksv[i].r), valFn, true) } - case reflect.String: - mksv := make([]stringRv, len(mks)) - for i, k := range mks { - v := &mksv[i] - v.r = k - v.v = k.String() + break + } + fallthrough + default: + // out-of-band + // first encode each key to a []byte first, then sort them, then record + var mksv []byte = make([]byte, 0, len(mks)*16) // temporary byte slice for the encoding + e2 := NewEncoderBytes(&mksv, e.hh) + mksbv := make([]bytesRv, len(mks)) + for i, k := range mks { + v := &mksbv[i] + l := len(mksv) + e2.MustEncode(k) + v.r = k + v.v = mksv[l:] + } + sort.Sort(bytesRvSlice(mksbv)) + for j := range mksbv { + if elemsep { + ee.WriteMapElemKey() } - sort.Sort(stringRvSlice(mksv)) - for i := range mksv { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - if asSymbols { - ee.EncodeSymbol(mksv[i].v) - } else { - ee.EncodeString(c_UTF8, mksv[i].v) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - e.encodeValue(rv.MapIndex(mksv[i].r), valFn) - } - case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint, reflect.Uintptr: - mksv := make([]uintRv, len(mks)) - for i, k := range mks { - v := &mksv[i] - v.r = k - v.v = k.Uint() - } - sort.Sort(uintRvSlice(mksv)) - for i := range mksv { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - ee.EncodeUint(mksv[i].v) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - e.encodeValue(rv.MapIndex(mksv[i].r), valFn) - } - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int: - mksv := make([]intRv, len(mks)) - for i, k := range mks { - v := &mksv[i] - v.r = k - v.v = k.Int() - } - sort.Sort(intRvSlice(mksv)) - for i := range mksv { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - ee.EncodeInt(mksv[i].v) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - e.encodeValue(rv.MapIndex(mksv[i].r), valFn) - } - case reflect.Float32: - mksv := make([]floatRv, len(mks)) - for i, k := range mks { - v := &mksv[i] - v.r = k - v.v = k.Float() - } - sort.Sort(floatRvSlice(mksv)) - for i := range mksv { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - ee.EncodeFloat32(float32(mksv[i].v)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - e.encodeValue(rv.MapIndex(mksv[i].r), valFn) - } - case reflect.Float64: - mksv := make([]floatRv, len(mks)) - for i, k := range mks { - v := &mksv[i] - v.r = k - v.v = k.Float() - } - sort.Sort(floatRvSlice(mksv)) - for i := range mksv { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - ee.EncodeFloat64(mksv[i].v) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - e.encodeValue(rv.MapIndex(mksv[i].r), valFn) - } - default: - // out-of-band - // first encode each key to a []byte first, then sort them, then record - var mksv []byte = make([]byte, 0, len(mks)*16) // temporary byte slice for the encoding - e2 := NewEncoderBytes(&mksv, e.hh) - mksbv := make([]bytesRv, len(mks)) - for i, k := range mks { - v := &mksbv[i] - l := len(mksv) - e2.MustEncode(k) - v.r = k - v.v = mksv[l:] - // fmt.Printf(">>>>> %s\n", mksv[l:]) - } - sort.Sort(bytesRvSlice(mksbv)) - for j := range mksbv { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - e.asis(mksbv[j].v) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - e.encodeValue(rv.MapIndex(mksbv[j].r), valFn) + e.asis(mksbv[j].v) + if elemsep { + ee.WriteMapElemValue() } + e.encodeValue(rv.MapIndex(mksbv[j].r), valFn, true) } } } -// -------------------------------------------------- +// // -------------------------------------------------- -// encFn encapsulates the captured variables and the encode function. -// This way, we only do some calculations one times, and pass to the -// code block that should be called (encapsulated in a function) -// instead of executing the checks every time. -type encFn struct { - i encFnInfo - f func(*encFnInfo, reflect.Value) +type encWriterSwitch struct { + wi *ioEncWriter + // wb bytesEncWriter + wb bytesEncAppender + wx bool // if bytes, wx=true + esep bool // whether it has elem separators + isas bool // whether e.as != nil } -// -------------------------------------------------- +// // TODO: Uncomment after mid-stack inlining enabled in go 1.10 -type encRtidFn struct { - rtid uintptr - fn encFn -} +// func (z *encWriterSwitch) writeb(s []byte) { +// if z.wx { +// z.wb.writeb(s) +// } else { +// z.wi.writeb(s) +// } +// } +// func (z *encWriterSwitch) writestr(s string) { +// if z.wx { +// z.wb.writestr(s) +// } else { +// z.wi.writestr(s) +// } +// } +// func (z *encWriterSwitch) writen1(b1 byte) { +// if z.wx { +// z.wb.writen1(b1) +// } else { +// z.wi.writen1(b1) +// } +// } +// func (z *encWriterSwitch) writen2(b1, b2 byte) { +// if z.wx { +// z.wb.writen2(b1, b2) +// } else { +// z.wi.writen2(b1, b2) +// } +// } // An Encoder writes an object to an output stream in the codec format. type Encoder struct { + panicHdl // hopefully, reduce derefencing cost by laying the encWriter inside the Encoder e encDriver // NOTE: Encoder shouldn't call it's write methods, // as the handler MAY need to do some coordination. - w encWriter - s []encRtidFn - ci set - be bool // is binary encoding - js bool // is json handle - - wi ioEncWriter - wb bytesEncWriter + w encWriter h *BasicHandle - hh Handle - - cr containerStateRecv + bw *bufio.Writer as encDriverAsis - f map[uintptr]*encFn - b [scratchByteArrayLen]byte + // ---- cpu cache line boundary? + + // ---- cpu cache line boundary? + encWriterSwitch + err error + + // ---- cpu cache line boundary? + codecFnPooler + ci set + js bool // here, so that no need to piggy back on *codecFner for this + be bool // here, so that no need to piggy back on *codecFner for this + _ [6]byte // padding + + // ---- writable fields during execution --- *try* to keep in sep cache line + + // ---- cpu cache line boundary? + // b [scratchByteArrayLen]byte + // _ [cacheLineSize - scratchByteArrayLen]byte // padding + b [cacheLineSize - 0]byte // used for encoding a chan or (non-addressable) array of bytes } // NewEncoder returns an Encoder for encoding into an io.Writer. @@ -963,50 +922,76 @@ func NewEncoderBytes(out *[]byte, h Handle) *Encoder { } func newEncoder(h Handle) *Encoder { - e := &Encoder{hh: h, h: h.getBasicHandle(), be: h.isBinary()} - _, e.js = h.(*JsonHandle) - e.e = h.newEncDriver(e) - e.as, _ = e.e.(encDriverAsis) - e.cr, _ = e.e.(containerStateRecv) + e := &Encoder{h: h.getBasicHandle(), err: errEncoderNotInitialized} + e.hh = h + e.esep = h.hasElemSeparators() return e } -// Reset the Encoder with a new output stream. +func (e *Encoder) resetCommon() { + if e.e == nil || e.hh.recreateEncDriver(e.e) { + e.e = e.hh.newEncDriver(e) + e.as, e.isas = e.e.(encDriverAsis) + // e.cr, _ = e.e.(containerStateRecv) + } + e.be = e.hh.isBinary() + _, e.js = e.hh.(*JsonHandle) + e.e.reset() + e.err = nil +} + +// Reset resets the Encoder with a new output stream. // // This accommodates using the state of the Encoder, // where it has "cached" information about sub-engines. func (e *Encoder) Reset(w io.Writer) { - ww, ok := w.(ioEncWriterWriter) - if ok { - e.wi.w = ww - } else { - sww := &e.wi.s - sww.w = w - sww.bw, _ = w.(io.ByteWriter) - sww.sw, _ = w.(ioEncStringWriter) - e.wi.w = sww - //ww = bufio.NewWriterSize(w, defEncByteBufSize) + if w == nil { + return } - e.w = &e.wi - e.e.reset() + if e.wi == nil { + e.wi = new(ioEncWriter) + } + var ok bool + e.wx = false + e.wi.w = w + if e.h.WriterBufferSize > 0 { + e.bw = bufio.NewWriterSize(w, e.h.WriterBufferSize) + e.wi.bw = e.bw + e.wi.sw = e.bw + e.wi.fw = e.bw + e.wi.ww = e.bw + } else { + if e.wi.bw, ok = w.(io.ByteWriter); !ok { + e.wi.bw = e.wi + } + if e.wi.sw, ok = w.(ioEncStringWriter); !ok { + e.wi.sw = e.wi + } + e.wi.fw, _ = w.(ioFlusher) + e.wi.ww = w + } + e.w = e.wi + e.resetCommon() } +// ResetBytes resets the Encoder with a new destination output []byte. func (e *Encoder) ResetBytes(out *[]byte) { - in := *out + if out == nil { + return + } + var in []byte + if out != nil { + in = *out + } if in == nil { in = make([]byte, defEncByteBufSize) } - e.wb.b, e.wb.out, e.wb.c = in, out, 0 + e.wx = true + e.wb.reset(in, out) e.w = &e.wb - e.e.reset() + e.resetCommon() } -// func (e *Encoder) sendContainerState(c containerState) { -// if e.cr != nil { -// e.cr.sendContainerState(c) -// } -// } - // Encode writes an object into a stream. // // Encoding can be configured via the struct tag for the fields. @@ -1015,7 +1000,14 @@ func (e *Encoder) ResetBytes(out *[]byte) { // Note that the "json" key is used in the absence of the "codec" key. // // To set an option on all fields (e.g. omitempty on all fields), you -// can create a field called _struct, and set flags on it. +// can create a field called _struct, and set flags on it. The options +// which can be set on _struct are: +// - omitempty: so all fields are omitted if empty +// - toarray: so struct is encoded as an array +// - int: so struct key names are encoded as signed integers (instead of strings) +// - uint: so struct key names are encoded as unsigned integers (instead of strings) +// - float: so struct key names are encoded as floats (instead of strings) +// More details on these below. // // Struct values "usually" encode as maps. Each exported struct field is encoded unless: // - the field's tag is "-", OR @@ -1023,6 +1015,13 @@ func (e *Encoder) ResetBytes(out *[]byte) { // // When encoding as a map, the first string in the tag (before the comma) // is the map key string to use when encoding. +// ... +// This key is typically encoded as a string. +// However, there are instances where the encoded stream has mapping keys encoded as numbers. +// For example, some cbor streams have keys as integer codes in the stream, but they should map +// to fields in a structured object. Consequently, a struct is the natural representation in code. +// For these, configure the struct to encode/decode the keys as numbers (instead of string). +// This is done with the int,uint or float option on the _struct field (see above). // // However, struct values may encode as arrays. This happens when: // - StructToArray Encode option is set, OR @@ -1055,50 +1054,68 @@ func (e *Encoder) ResetBytes(out *[]byte) { // } // // type MyStruct struct { -// _struct bool `codec:",toarray"` //encode struct as an array +// _struct bool `codec:",toarray"` //encode struct as an array +// } +// +// type MyStruct struct { +// _struct bool `codec:",uint"` //encode struct with "unsigned integer" keys +// Field1 string `codec:"1"` //encode Field1 key using: EncodeInt(1) +// Field2 string `codec:"2"` //encode Field2 key using: EncodeInt(2) // } // // The mode of encoding is based on the type of the value. When a value is seen: // - If a Selfer, call its CodecEncodeSelf method // - If an extension is registered for it, call that extension function -// - If it implements encoding.(Binary|Text|JSON)Marshaler, call its Marshal(Binary|Text|JSON) method +// - If implements encoding.(Binary|Text|JSON)Marshaler, call Marshal(Binary|Text|JSON) method // - Else encode it based on its reflect.Kind // // Note that struct field names and keys in map[string]XXX will be treated as symbols. // Some formats support symbols (e.g. binc) and will properly encode the string // only once in the stream, and use a tag to refer to it thereafter. func (e *Encoder) Encode(v interface{}) (err error) { - defer panicToErr(&err) - e.encode(v) - e.w.atEndOfEncode() + defer panicToErrs2(e, &e.err, &err) + defer e.alwaysAtEnd() + e.MustEncode(v) return } // MustEncode is like Encode, but panics if unable to Encode. // This provides insight to the code location that triggered the error. func (e *Encoder) MustEncode(v interface{}) { + if e.err != nil { + panic(e.err) + } e.encode(v) + e.e.atEndOfEncode() e.w.atEndOfEncode() + e.alwaysAtEnd() } +// func (e *Encoder) alwaysAtEnd() { +// e.codecFnPooler.alwaysAtEnd() +// } + func (e *Encoder) encode(iv interface{}) { - // if ics, ok := iv.(Selfer); ok { - // ics.CodecEncodeSelf(e) - // return - // } + if iv == nil || definitelyNil(iv) { + e.e.EncodeNil() + return + } + if v, ok := iv.(Selfer); ok { + v.CodecEncodeSelf(e) + return + } + + // a switch with only concrete types can be optimized. + // consequently, we deal with nil and interfaces outside. switch v := iv.(type) { - case nil: - e.e.EncodeNil() - case Selfer: - v.CodecEncodeSelf(e) case Raw: - e.raw(v) + e.rawBytes(v) case reflect.Value: - e.encodeValue(v, nil) + e.encodeValue(v, nil, true) case string: - e.e.EncodeString(c_UTF8, v) + e.e.EncodeString(cUTF8, v) case bool: e.e.EncodeBool(v) case int: @@ -1121,16 +1138,22 @@ func (e *Encoder) encode(iv interface{}) { e.e.EncodeUint(uint64(v)) case uint64: e.e.EncodeUint(v) + case uintptr: + e.e.EncodeUint(uint64(v)) case float32: e.e.EncodeFloat32(v) case float64: e.e.EncodeFloat64(v) - + case time.Time: + e.e.EncodeTime(v) case []uint8: - e.e.EncodeStringBytes(c_RAW, v) + e.e.EncodeStringBytes(cRAW, v) + + case *Raw: + e.rawBytes(*v) case *string: - e.e.EncodeString(c_UTF8, *v) + e.e.EncodeString(cUTF8, *v) case *bool: e.e.EncodeBool(*v) case *int: @@ -1153,24 +1176,31 @@ func (e *Encoder) encode(iv interface{}) { e.e.EncodeUint(uint64(*v)) case *uint64: e.e.EncodeUint(*v) + case *uintptr: + e.e.EncodeUint(uint64(*v)) case *float32: e.e.EncodeFloat32(*v) case *float64: e.e.EncodeFloat64(*v) + case *time.Time: + e.e.EncodeTime(*v) case *[]uint8: - e.e.EncodeStringBytes(c_RAW, *v) + e.e.EncodeStringBytes(cRAW, *v) default: - const checkCodecSelfer1 = true // in case T is passed, where *T is a Selfer, still checkCodecSelfer if !fastpathEncodeTypeSwitch(iv, e) { - e.encodeI(iv, false, checkCodecSelfer1) + // checkfastpath=true (not false), as underlying slice/map type may be fast-path + e.encodeValue(reflect.ValueOf(iv), nil, true) } } } -func (e *Encoder) preEncodeValue(rv reflect.Value) (rv2 reflect.Value, sptr uintptr, proceed bool) { - // use a goto statement instead of a recursive function for ptr/interface. +func (e *Encoder) encodeValue(rv reflect.Value, fn *codecFn, checkFastpath bool) { + // if a valid fn is passed, it MUST BE for the dereferenced type of rv + var sptr uintptr + var rvp reflect.Value + var rvpValid bool TOP: switch rv.Kind() { case reflect.Ptr: @@ -1178,6 +1208,8 @@ TOP: e.e.EncodeNil() return } + rvpValid = true + rvp = rv rv = rv.Elem() if e.h.CheckCircularRef && rv.Kind() == reflect.Struct { // TODO: Movable pointers will be an issue here. Future problem. @@ -1202,167 +1234,33 @@ TOP: return } - proceed = true - rv2 = rv - return -} - -func (e *Encoder) doEncodeValue(rv reflect.Value, fn *encFn, sptr uintptr, - checkFastpath, checkCodecSelfer bool) { - if sptr != 0 { - if (&e.ci).add(sptr) { - e.errorf("circular reference found: # %d", sptr) - } + if sptr != 0 && (&e.ci).add(sptr) { + e.errorf("circular reference found: # %d", sptr) } + if fn == nil { rt := rv.Type() - rtid := reflect.ValueOf(rt).Pointer() - // fn = e.getEncFn(rtid, rt, true, true) - fn = e.getEncFn(rtid, rt, checkFastpath, checkCodecSelfer) + // always pass checkCodecSelfer=true, in case T or ****T is passed, where *T is a Selfer + fn = e.cfer().get(rt, checkFastpath, true) + } + if fn.i.addrE { + if rvpValid { + fn.fe(e, &fn.i, rvp) + } else if rv.CanAddr() { + fn.fe(e, &fn.i, rv.Addr()) + } else { + rv2 := reflect.New(rv.Type()) + rv2.Elem().Set(rv) + fn.fe(e, &fn.i, rv2) + } + } else { + fn.fe(e, &fn.i, rv) } - fn.f(&fn.i, rv) if sptr != 0 { (&e.ci).remove(sptr) } } -func (e *Encoder) encodeI(iv interface{}, checkFastpath, checkCodecSelfer bool) { - if rv, sptr, proceed := e.preEncodeValue(reflect.ValueOf(iv)); proceed { - e.doEncodeValue(rv, nil, sptr, checkFastpath, checkCodecSelfer) - } -} - -func (e *Encoder) encodeValue(rv reflect.Value, fn *encFn) { - // if a valid fn is passed, it MUST BE for the dereferenced type of rv - if rv, sptr, proceed := e.preEncodeValue(rv); proceed { - e.doEncodeValue(rv, fn, sptr, true, true) - } -} - -func (e *Encoder) getEncFn(rtid uintptr, rt reflect.Type, checkFastpath, checkCodecSelfer bool) (fn *encFn) { - // rtid := reflect.ValueOf(rt).Pointer() - var ok bool - if useMapForCodecCache { - fn, ok = e.f[rtid] - } else { - for i := range e.s { - v := &(e.s[i]) - if v.rtid == rtid { - fn, ok = &(v.fn), true - break - } - } - } - if ok { - return - } - - if useMapForCodecCache { - if e.f == nil { - e.f = make(map[uintptr]*encFn, initCollectionCap) - } - fn = new(encFn) - e.f[rtid] = fn - } else { - if e.s == nil { - e.s = make([]encRtidFn, 0, initCollectionCap) - } - e.s = append(e.s, encRtidFn{rtid: rtid}) - fn = &(e.s[len(e.s)-1]).fn - } - - ti := e.h.getTypeInfo(rtid, rt) - fi := &(fn.i) - fi.e = e - fi.ti = ti - - if checkCodecSelfer && ti.cs { - fn.f = (*encFnInfo).selferMarshal - } else if rtid == rawTypId { - fn.f = (*encFnInfo).raw - } else if rtid == rawExtTypId { - fn.f = (*encFnInfo).rawExt - } else if e.e.IsBuiltinType(rtid) { - fn.f = (*encFnInfo).builtin - } else if xfFn := e.h.getExt(rtid); xfFn != nil { - fi.xfTag, fi.xfFn = xfFn.tag, xfFn.ext - fn.f = (*encFnInfo).ext - } else if supportMarshalInterfaces && e.be && ti.bm { - fn.f = (*encFnInfo).binaryMarshal - } else if supportMarshalInterfaces && !e.be && e.js && ti.jm { - //If JSON, we should check JSONMarshal before textMarshal - fn.f = (*encFnInfo).jsonMarshal - } else if supportMarshalInterfaces && !e.be && ti.tm { - fn.f = (*encFnInfo).textMarshal - } else { - rk := rt.Kind() - if fastpathEnabled && checkFastpath && (rk == reflect.Map || rk == reflect.Slice) { - if rt.PkgPath() == "" { // un-named slice or map - if idx := fastpathAV.index(rtid); idx != -1 { - fn.f = fastpathAV[idx].encfn - } - } else { - ok = false - // use mapping for underlying type if there - var rtu reflect.Type - if rk == reflect.Map { - rtu = reflect.MapOf(rt.Key(), rt.Elem()) - } else { - rtu = reflect.SliceOf(rt.Elem()) - } - rtuid := reflect.ValueOf(rtu).Pointer() - if idx := fastpathAV.index(rtuid); idx != -1 { - xfnf := fastpathAV[idx].encfn - xrt := fastpathAV[idx].rt - fn.f = func(xf *encFnInfo, xrv reflect.Value) { - xfnf(xf, xrv.Convert(xrt)) - } - } - } - } - if fn.f == nil { - switch rk { - case reflect.Bool: - fn.f = (*encFnInfo).kBool - case reflect.String: - fn.f = (*encFnInfo).kString - case reflect.Float64: - fn.f = (*encFnInfo).kFloat64 - case reflect.Float32: - fn.f = (*encFnInfo).kFloat32 - case reflect.Int, reflect.Int8, reflect.Int64, reflect.Int32, reflect.Int16: - fn.f = (*encFnInfo).kInt - case reflect.Uint8, reflect.Uint64, reflect.Uint, reflect.Uint32, reflect.Uint16, reflect.Uintptr: - fn.f = (*encFnInfo).kUint - case reflect.Invalid: - fn.f = (*encFnInfo).kInvalid - case reflect.Chan: - fi.seq = seqTypeChan - fn.f = (*encFnInfo).kSlice - case reflect.Slice: - fi.seq = seqTypeSlice - fn.f = (*encFnInfo).kSlice - case reflect.Array: - fi.seq = seqTypeArray - fn.f = (*encFnInfo).kSlice - case reflect.Struct: - fn.f = (*encFnInfo).kStruct - // reflect.Ptr and reflect.Interface are handled already by preEncodeValue - // case reflect.Ptr: - // fn.f = (*encFnInfo).kPtr - // case reflect.Interface: - // fn.f = (*encFnInfo).kInterface - case reflect.Map: - fn.f = (*encFnInfo).kMap - default: - fn.f = (*encFnInfo).kErr - } - } - } - - return -} - func (e *Encoder) marshal(bs []byte, fnerr error, asis bool, c charEncoding) { if fnerr != nil { panic(fnerr) @@ -1377,86 +1275,21 @@ func (e *Encoder) marshal(bs []byte, fnerr error, asis bool, c charEncoding) { } func (e *Encoder) asis(v []byte) { - if e.as == nil { - e.w.writeb(v) - } else { + if e.isas { e.as.EncodeAsis(v) + } else { + e.w.writeb(v) } } -func (e *Encoder) raw(vv Raw) { +func (e *Encoder) rawBytes(vv Raw) { v := []byte(vv) if !e.h.Raw { e.errorf("Raw values cannot be encoded: %v", v) } - if e.as == nil { - e.w.writeb(v) - } else { - e.as.EncodeAsis(v) - } + e.asis(v) } -func (e *Encoder) errorf(format string, params ...interface{}) { - err := fmt.Errorf(format, params...) - panic(err) +func (e *Encoder) wrapErrstr(v interface{}, err *error) { + *err = fmt.Errorf("%s encode error: %v", e.hh.Name(), v) } - -// ---------------------------------------- - -const encStructPoolLen = 5 - -// encStructPool is an array of sync.Pool. -// Each element of the array pools one of encStructPool(8|16|32|64). -// It allows the re-use of slices up to 64 in length. -// A performance cost of encoding structs was collecting -// which values were empty and should be omitted. -// We needed slices of reflect.Value and string to collect them. -// This shared pool reduces the amount of unnecessary creation we do. -// The cost is that of locking sometimes, but sync.Pool is efficient -// enough to reduce thread contention. -var encStructPool [encStructPoolLen]sync.Pool - -func init() { - encStructPool[0].New = func() interface{} { return new([8]stringRv) } - encStructPool[1].New = func() interface{} { return new([16]stringRv) } - encStructPool[2].New = func() interface{} { return new([32]stringRv) } - encStructPool[3].New = func() interface{} { return new([64]stringRv) } - encStructPool[4].New = func() interface{} { return new([128]stringRv) } -} - -func encStructPoolGet(newlen int) (p *sync.Pool, v interface{}, s []stringRv) { - // if encStructPoolLen != 5 { // constant chec, so removed at build time. - // panic(errors.New("encStructPoolLen must be equal to 4")) // defensive, in case it is changed - // } - // idxpool := newlen / 8 - if newlen <= 8 { - p = &encStructPool[0] - v = p.Get() - s = v.(*[8]stringRv)[:newlen] - } else if newlen <= 16 { - p = &encStructPool[1] - v = p.Get() - s = v.(*[16]stringRv)[:newlen] - } else if newlen <= 32 { - p = &encStructPool[2] - v = p.Get() - s = v.(*[32]stringRv)[:newlen] - } else if newlen <= 64 { - p = &encStructPool[3] - v = p.Get() - s = v.(*[64]stringRv)[:newlen] - } else if newlen <= 128 { - p = &encStructPool[4] - v = p.Get() - s = v.(*[128]stringRv)[:newlen] - } else { - s = make([]stringRv, newlen) - } - return -} - -// ---------------------------------------- - -// func encErr(format string, params ...interface{}) { -// doPanic(msgTagEnc, format, params...) -// } diff --git a/vendor/github.com/ugorji/go/codec/fast-path.generated.go b/vendor/github.com/ugorji/go/codec/fast-path.generated.go index f2e5d2dcf..87f2562f6 100644 --- a/vendor/github.com/ugorji/go/codec/fast-path.generated.go +++ b/vendor/github.com/ugorji/go/codec/fast-path.generated.go @@ -3,10 +3,7 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. -// ************************************************************ -// DO NOT EDIT. -// THIS FILE IS AUTO-GENERATED from fast-path.go.tmpl -// ************************************************************ +// Code generated from fast-path.go.tmpl - DO NOT EDIT. package codec @@ -18,19 +15,19 @@ package codec // This file can be omitted without causing a build failure. // // The advantage of fast paths is: -// - Many calls bypass reflection altogether +// - Many calls bypass reflection altogether // // Currently support -// - slice of all builtin types, -// - map of all builtin types to string or interface value -// - symmetrical maps of all builtin types (e.g. str-str, uint8-uint8) +// - slice of all builtin types, +// - map of all builtin types to string or interface value +// - symmetrical maps of all builtin types (e.g. str-str, uint8-uint8) // This should provide adequate "typical" implementations. // // Note that fast track decode functions must handle values for which an address cannot be obtained. // For example: -// m2 := map[string]int{} -// p2 := []interface{}{m2} -// // decoding into p2 will bomb if fast track functions do not treat like unaddressable. +// m2 := map[string]int{} +// p2 := []interface{}{m2} +// // decoding into p2 will bomb if fast track functions do not treat like unaddressable. // import ( @@ -40,9 +37,6 @@ import ( const fastpathEnabled = true -const fastpathCheckNilFalse = false // for reflect -const fastpathCheckNilTrue = true // for type switch - type fastpathT struct{} var fastpathTV fastpathT @@ -50,8 +44,8 @@ var fastpathTV fastpathT type fastpathE struct { rtid uintptr rt reflect.Type - encfn func(*encFnInfo, reflect.Value) - decfn func(*decFnInfo, reflect.Value) + encfn func(*Encoder, *codecFnInfo, reflect.Value) + decfn func(*Decoder, *codecFnInfo, reflect.Value) } type fastpathA [271]fastpathE @@ -84,286 +78,288 @@ var fastpathAV fastpathA // due to possible initialization loop error, make fastpath in an init() func init() { i := 0 - fn := func(v interface{}, fe func(*encFnInfo, reflect.Value), fd func(*decFnInfo, reflect.Value)) (f fastpathE) { + fn := func(v interface{}, + fe func(*Encoder, *codecFnInfo, reflect.Value), + fd func(*Decoder, *codecFnInfo, reflect.Value)) (f fastpathE) { xrt := reflect.TypeOf(v) - xptr := reflect.ValueOf(xrt).Pointer() + xptr := rt2id(xrt) fastpathAV[i] = fastpathE{xptr, xrt, fe, fd} i++ return } - fn([]interface{}(nil), (*encFnInfo).fastpathEncSliceIntfR, (*decFnInfo).fastpathDecSliceIntfR) - fn([]string(nil), (*encFnInfo).fastpathEncSliceStringR, (*decFnInfo).fastpathDecSliceStringR) - fn([]float32(nil), (*encFnInfo).fastpathEncSliceFloat32R, (*decFnInfo).fastpathDecSliceFloat32R) - fn([]float64(nil), (*encFnInfo).fastpathEncSliceFloat64R, (*decFnInfo).fastpathDecSliceFloat64R) - fn([]uint(nil), (*encFnInfo).fastpathEncSliceUintR, (*decFnInfo).fastpathDecSliceUintR) - fn([]uint16(nil), (*encFnInfo).fastpathEncSliceUint16R, (*decFnInfo).fastpathDecSliceUint16R) - fn([]uint32(nil), (*encFnInfo).fastpathEncSliceUint32R, (*decFnInfo).fastpathDecSliceUint32R) - fn([]uint64(nil), (*encFnInfo).fastpathEncSliceUint64R, (*decFnInfo).fastpathDecSliceUint64R) - fn([]uintptr(nil), (*encFnInfo).fastpathEncSliceUintptrR, (*decFnInfo).fastpathDecSliceUintptrR) - fn([]int(nil), (*encFnInfo).fastpathEncSliceIntR, (*decFnInfo).fastpathDecSliceIntR) - fn([]int8(nil), (*encFnInfo).fastpathEncSliceInt8R, (*decFnInfo).fastpathDecSliceInt8R) - fn([]int16(nil), (*encFnInfo).fastpathEncSliceInt16R, (*decFnInfo).fastpathDecSliceInt16R) - fn([]int32(nil), (*encFnInfo).fastpathEncSliceInt32R, (*decFnInfo).fastpathDecSliceInt32R) - fn([]int64(nil), (*encFnInfo).fastpathEncSliceInt64R, (*decFnInfo).fastpathDecSliceInt64R) - fn([]bool(nil), (*encFnInfo).fastpathEncSliceBoolR, (*decFnInfo).fastpathDecSliceBoolR) + fn([]interface{}(nil), (*Encoder).fastpathEncSliceIntfR, (*Decoder).fastpathDecSliceIntfR) + fn([]string(nil), (*Encoder).fastpathEncSliceStringR, (*Decoder).fastpathDecSliceStringR) + fn([]float32(nil), (*Encoder).fastpathEncSliceFloat32R, (*Decoder).fastpathDecSliceFloat32R) + fn([]float64(nil), (*Encoder).fastpathEncSliceFloat64R, (*Decoder).fastpathDecSliceFloat64R) + fn([]uint(nil), (*Encoder).fastpathEncSliceUintR, (*Decoder).fastpathDecSliceUintR) + fn([]uint16(nil), (*Encoder).fastpathEncSliceUint16R, (*Decoder).fastpathDecSliceUint16R) + fn([]uint32(nil), (*Encoder).fastpathEncSliceUint32R, (*Decoder).fastpathDecSliceUint32R) + fn([]uint64(nil), (*Encoder).fastpathEncSliceUint64R, (*Decoder).fastpathDecSliceUint64R) + fn([]uintptr(nil), (*Encoder).fastpathEncSliceUintptrR, (*Decoder).fastpathDecSliceUintptrR) + fn([]int(nil), (*Encoder).fastpathEncSliceIntR, (*Decoder).fastpathDecSliceIntR) + fn([]int8(nil), (*Encoder).fastpathEncSliceInt8R, (*Decoder).fastpathDecSliceInt8R) + fn([]int16(nil), (*Encoder).fastpathEncSliceInt16R, (*Decoder).fastpathDecSliceInt16R) + fn([]int32(nil), (*Encoder).fastpathEncSliceInt32R, (*Decoder).fastpathDecSliceInt32R) + fn([]int64(nil), (*Encoder).fastpathEncSliceInt64R, (*Decoder).fastpathDecSliceInt64R) + fn([]bool(nil), (*Encoder).fastpathEncSliceBoolR, (*Decoder).fastpathDecSliceBoolR) - fn(map[interface{}]interface{}(nil), (*encFnInfo).fastpathEncMapIntfIntfR, (*decFnInfo).fastpathDecMapIntfIntfR) - fn(map[interface{}]string(nil), (*encFnInfo).fastpathEncMapIntfStringR, (*decFnInfo).fastpathDecMapIntfStringR) - fn(map[interface{}]uint(nil), (*encFnInfo).fastpathEncMapIntfUintR, (*decFnInfo).fastpathDecMapIntfUintR) - fn(map[interface{}]uint8(nil), (*encFnInfo).fastpathEncMapIntfUint8R, (*decFnInfo).fastpathDecMapIntfUint8R) - fn(map[interface{}]uint16(nil), (*encFnInfo).fastpathEncMapIntfUint16R, (*decFnInfo).fastpathDecMapIntfUint16R) - fn(map[interface{}]uint32(nil), (*encFnInfo).fastpathEncMapIntfUint32R, (*decFnInfo).fastpathDecMapIntfUint32R) - fn(map[interface{}]uint64(nil), (*encFnInfo).fastpathEncMapIntfUint64R, (*decFnInfo).fastpathDecMapIntfUint64R) - fn(map[interface{}]uintptr(nil), (*encFnInfo).fastpathEncMapIntfUintptrR, (*decFnInfo).fastpathDecMapIntfUintptrR) - fn(map[interface{}]int(nil), (*encFnInfo).fastpathEncMapIntfIntR, (*decFnInfo).fastpathDecMapIntfIntR) - fn(map[interface{}]int8(nil), (*encFnInfo).fastpathEncMapIntfInt8R, (*decFnInfo).fastpathDecMapIntfInt8R) - fn(map[interface{}]int16(nil), (*encFnInfo).fastpathEncMapIntfInt16R, (*decFnInfo).fastpathDecMapIntfInt16R) - fn(map[interface{}]int32(nil), (*encFnInfo).fastpathEncMapIntfInt32R, (*decFnInfo).fastpathDecMapIntfInt32R) - fn(map[interface{}]int64(nil), (*encFnInfo).fastpathEncMapIntfInt64R, (*decFnInfo).fastpathDecMapIntfInt64R) - fn(map[interface{}]float32(nil), (*encFnInfo).fastpathEncMapIntfFloat32R, (*decFnInfo).fastpathDecMapIntfFloat32R) - fn(map[interface{}]float64(nil), (*encFnInfo).fastpathEncMapIntfFloat64R, (*decFnInfo).fastpathDecMapIntfFloat64R) - fn(map[interface{}]bool(nil), (*encFnInfo).fastpathEncMapIntfBoolR, (*decFnInfo).fastpathDecMapIntfBoolR) - fn(map[string]interface{}(nil), (*encFnInfo).fastpathEncMapStringIntfR, (*decFnInfo).fastpathDecMapStringIntfR) - fn(map[string]string(nil), (*encFnInfo).fastpathEncMapStringStringR, (*decFnInfo).fastpathDecMapStringStringR) - fn(map[string]uint(nil), (*encFnInfo).fastpathEncMapStringUintR, (*decFnInfo).fastpathDecMapStringUintR) - fn(map[string]uint8(nil), (*encFnInfo).fastpathEncMapStringUint8R, (*decFnInfo).fastpathDecMapStringUint8R) - fn(map[string]uint16(nil), (*encFnInfo).fastpathEncMapStringUint16R, (*decFnInfo).fastpathDecMapStringUint16R) - fn(map[string]uint32(nil), (*encFnInfo).fastpathEncMapStringUint32R, (*decFnInfo).fastpathDecMapStringUint32R) - fn(map[string]uint64(nil), (*encFnInfo).fastpathEncMapStringUint64R, (*decFnInfo).fastpathDecMapStringUint64R) - fn(map[string]uintptr(nil), (*encFnInfo).fastpathEncMapStringUintptrR, (*decFnInfo).fastpathDecMapStringUintptrR) - fn(map[string]int(nil), (*encFnInfo).fastpathEncMapStringIntR, (*decFnInfo).fastpathDecMapStringIntR) - fn(map[string]int8(nil), (*encFnInfo).fastpathEncMapStringInt8R, (*decFnInfo).fastpathDecMapStringInt8R) - fn(map[string]int16(nil), (*encFnInfo).fastpathEncMapStringInt16R, (*decFnInfo).fastpathDecMapStringInt16R) - fn(map[string]int32(nil), (*encFnInfo).fastpathEncMapStringInt32R, (*decFnInfo).fastpathDecMapStringInt32R) - fn(map[string]int64(nil), (*encFnInfo).fastpathEncMapStringInt64R, (*decFnInfo).fastpathDecMapStringInt64R) - fn(map[string]float32(nil), (*encFnInfo).fastpathEncMapStringFloat32R, (*decFnInfo).fastpathDecMapStringFloat32R) - fn(map[string]float64(nil), (*encFnInfo).fastpathEncMapStringFloat64R, (*decFnInfo).fastpathDecMapStringFloat64R) - fn(map[string]bool(nil), (*encFnInfo).fastpathEncMapStringBoolR, (*decFnInfo).fastpathDecMapStringBoolR) - fn(map[float32]interface{}(nil), (*encFnInfo).fastpathEncMapFloat32IntfR, (*decFnInfo).fastpathDecMapFloat32IntfR) - fn(map[float32]string(nil), (*encFnInfo).fastpathEncMapFloat32StringR, (*decFnInfo).fastpathDecMapFloat32StringR) - fn(map[float32]uint(nil), (*encFnInfo).fastpathEncMapFloat32UintR, (*decFnInfo).fastpathDecMapFloat32UintR) - fn(map[float32]uint8(nil), (*encFnInfo).fastpathEncMapFloat32Uint8R, (*decFnInfo).fastpathDecMapFloat32Uint8R) - fn(map[float32]uint16(nil), (*encFnInfo).fastpathEncMapFloat32Uint16R, (*decFnInfo).fastpathDecMapFloat32Uint16R) - fn(map[float32]uint32(nil), (*encFnInfo).fastpathEncMapFloat32Uint32R, (*decFnInfo).fastpathDecMapFloat32Uint32R) - fn(map[float32]uint64(nil), (*encFnInfo).fastpathEncMapFloat32Uint64R, (*decFnInfo).fastpathDecMapFloat32Uint64R) - fn(map[float32]uintptr(nil), (*encFnInfo).fastpathEncMapFloat32UintptrR, (*decFnInfo).fastpathDecMapFloat32UintptrR) - fn(map[float32]int(nil), (*encFnInfo).fastpathEncMapFloat32IntR, (*decFnInfo).fastpathDecMapFloat32IntR) - fn(map[float32]int8(nil), (*encFnInfo).fastpathEncMapFloat32Int8R, (*decFnInfo).fastpathDecMapFloat32Int8R) - fn(map[float32]int16(nil), (*encFnInfo).fastpathEncMapFloat32Int16R, (*decFnInfo).fastpathDecMapFloat32Int16R) - fn(map[float32]int32(nil), (*encFnInfo).fastpathEncMapFloat32Int32R, (*decFnInfo).fastpathDecMapFloat32Int32R) - fn(map[float32]int64(nil), (*encFnInfo).fastpathEncMapFloat32Int64R, (*decFnInfo).fastpathDecMapFloat32Int64R) - fn(map[float32]float32(nil), (*encFnInfo).fastpathEncMapFloat32Float32R, (*decFnInfo).fastpathDecMapFloat32Float32R) - fn(map[float32]float64(nil), (*encFnInfo).fastpathEncMapFloat32Float64R, (*decFnInfo).fastpathDecMapFloat32Float64R) - fn(map[float32]bool(nil), (*encFnInfo).fastpathEncMapFloat32BoolR, (*decFnInfo).fastpathDecMapFloat32BoolR) - fn(map[float64]interface{}(nil), (*encFnInfo).fastpathEncMapFloat64IntfR, (*decFnInfo).fastpathDecMapFloat64IntfR) - fn(map[float64]string(nil), (*encFnInfo).fastpathEncMapFloat64StringR, (*decFnInfo).fastpathDecMapFloat64StringR) - fn(map[float64]uint(nil), (*encFnInfo).fastpathEncMapFloat64UintR, (*decFnInfo).fastpathDecMapFloat64UintR) - fn(map[float64]uint8(nil), (*encFnInfo).fastpathEncMapFloat64Uint8R, (*decFnInfo).fastpathDecMapFloat64Uint8R) - fn(map[float64]uint16(nil), (*encFnInfo).fastpathEncMapFloat64Uint16R, (*decFnInfo).fastpathDecMapFloat64Uint16R) - fn(map[float64]uint32(nil), (*encFnInfo).fastpathEncMapFloat64Uint32R, (*decFnInfo).fastpathDecMapFloat64Uint32R) - fn(map[float64]uint64(nil), (*encFnInfo).fastpathEncMapFloat64Uint64R, (*decFnInfo).fastpathDecMapFloat64Uint64R) - fn(map[float64]uintptr(nil), (*encFnInfo).fastpathEncMapFloat64UintptrR, (*decFnInfo).fastpathDecMapFloat64UintptrR) - fn(map[float64]int(nil), (*encFnInfo).fastpathEncMapFloat64IntR, (*decFnInfo).fastpathDecMapFloat64IntR) - fn(map[float64]int8(nil), (*encFnInfo).fastpathEncMapFloat64Int8R, (*decFnInfo).fastpathDecMapFloat64Int8R) - fn(map[float64]int16(nil), (*encFnInfo).fastpathEncMapFloat64Int16R, (*decFnInfo).fastpathDecMapFloat64Int16R) - fn(map[float64]int32(nil), (*encFnInfo).fastpathEncMapFloat64Int32R, (*decFnInfo).fastpathDecMapFloat64Int32R) - fn(map[float64]int64(nil), (*encFnInfo).fastpathEncMapFloat64Int64R, (*decFnInfo).fastpathDecMapFloat64Int64R) - fn(map[float64]float32(nil), (*encFnInfo).fastpathEncMapFloat64Float32R, (*decFnInfo).fastpathDecMapFloat64Float32R) - fn(map[float64]float64(nil), (*encFnInfo).fastpathEncMapFloat64Float64R, (*decFnInfo).fastpathDecMapFloat64Float64R) - fn(map[float64]bool(nil), (*encFnInfo).fastpathEncMapFloat64BoolR, (*decFnInfo).fastpathDecMapFloat64BoolR) - fn(map[uint]interface{}(nil), (*encFnInfo).fastpathEncMapUintIntfR, (*decFnInfo).fastpathDecMapUintIntfR) - fn(map[uint]string(nil), (*encFnInfo).fastpathEncMapUintStringR, (*decFnInfo).fastpathDecMapUintStringR) - fn(map[uint]uint(nil), (*encFnInfo).fastpathEncMapUintUintR, (*decFnInfo).fastpathDecMapUintUintR) - fn(map[uint]uint8(nil), (*encFnInfo).fastpathEncMapUintUint8R, (*decFnInfo).fastpathDecMapUintUint8R) - fn(map[uint]uint16(nil), (*encFnInfo).fastpathEncMapUintUint16R, (*decFnInfo).fastpathDecMapUintUint16R) - fn(map[uint]uint32(nil), (*encFnInfo).fastpathEncMapUintUint32R, (*decFnInfo).fastpathDecMapUintUint32R) - fn(map[uint]uint64(nil), (*encFnInfo).fastpathEncMapUintUint64R, (*decFnInfo).fastpathDecMapUintUint64R) - fn(map[uint]uintptr(nil), (*encFnInfo).fastpathEncMapUintUintptrR, (*decFnInfo).fastpathDecMapUintUintptrR) - fn(map[uint]int(nil), (*encFnInfo).fastpathEncMapUintIntR, (*decFnInfo).fastpathDecMapUintIntR) - fn(map[uint]int8(nil), (*encFnInfo).fastpathEncMapUintInt8R, (*decFnInfo).fastpathDecMapUintInt8R) - fn(map[uint]int16(nil), (*encFnInfo).fastpathEncMapUintInt16R, (*decFnInfo).fastpathDecMapUintInt16R) - fn(map[uint]int32(nil), (*encFnInfo).fastpathEncMapUintInt32R, (*decFnInfo).fastpathDecMapUintInt32R) - fn(map[uint]int64(nil), (*encFnInfo).fastpathEncMapUintInt64R, (*decFnInfo).fastpathDecMapUintInt64R) - fn(map[uint]float32(nil), (*encFnInfo).fastpathEncMapUintFloat32R, (*decFnInfo).fastpathDecMapUintFloat32R) - fn(map[uint]float64(nil), (*encFnInfo).fastpathEncMapUintFloat64R, (*decFnInfo).fastpathDecMapUintFloat64R) - fn(map[uint]bool(nil), (*encFnInfo).fastpathEncMapUintBoolR, (*decFnInfo).fastpathDecMapUintBoolR) - fn(map[uint8]interface{}(nil), (*encFnInfo).fastpathEncMapUint8IntfR, (*decFnInfo).fastpathDecMapUint8IntfR) - fn(map[uint8]string(nil), (*encFnInfo).fastpathEncMapUint8StringR, (*decFnInfo).fastpathDecMapUint8StringR) - fn(map[uint8]uint(nil), (*encFnInfo).fastpathEncMapUint8UintR, (*decFnInfo).fastpathDecMapUint8UintR) - fn(map[uint8]uint8(nil), (*encFnInfo).fastpathEncMapUint8Uint8R, (*decFnInfo).fastpathDecMapUint8Uint8R) - fn(map[uint8]uint16(nil), (*encFnInfo).fastpathEncMapUint8Uint16R, (*decFnInfo).fastpathDecMapUint8Uint16R) - fn(map[uint8]uint32(nil), (*encFnInfo).fastpathEncMapUint8Uint32R, (*decFnInfo).fastpathDecMapUint8Uint32R) - fn(map[uint8]uint64(nil), (*encFnInfo).fastpathEncMapUint8Uint64R, (*decFnInfo).fastpathDecMapUint8Uint64R) - fn(map[uint8]uintptr(nil), (*encFnInfo).fastpathEncMapUint8UintptrR, (*decFnInfo).fastpathDecMapUint8UintptrR) - fn(map[uint8]int(nil), (*encFnInfo).fastpathEncMapUint8IntR, (*decFnInfo).fastpathDecMapUint8IntR) - fn(map[uint8]int8(nil), (*encFnInfo).fastpathEncMapUint8Int8R, (*decFnInfo).fastpathDecMapUint8Int8R) - fn(map[uint8]int16(nil), (*encFnInfo).fastpathEncMapUint8Int16R, (*decFnInfo).fastpathDecMapUint8Int16R) - fn(map[uint8]int32(nil), (*encFnInfo).fastpathEncMapUint8Int32R, (*decFnInfo).fastpathDecMapUint8Int32R) - fn(map[uint8]int64(nil), (*encFnInfo).fastpathEncMapUint8Int64R, (*decFnInfo).fastpathDecMapUint8Int64R) - fn(map[uint8]float32(nil), (*encFnInfo).fastpathEncMapUint8Float32R, (*decFnInfo).fastpathDecMapUint8Float32R) - fn(map[uint8]float64(nil), (*encFnInfo).fastpathEncMapUint8Float64R, (*decFnInfo).fastpathDecMapUint8Float64R) - fn(map[uint8]bool(nil), (*encFnInfo).fastpathEncMapUint8BoolR, (*decFnInfo).fastpathDecMapUint8BoolR) - fn(map[uint16]interface{}(nil), (*encFnInfo).fastpathEncMapUint16IntfR, (*decFnInfo).fastpathDecMapUint16IntfR) - fn(map[uint16]string(nil), (*encFnInfo).fastpathEncMapUint16StringR, (*decFnInfo).fastpathDecMapUint16StringR) - fn(map[uint16]uint(nil), (*encFnInfo).fastpathEncMapUint16UintR, (*decFnInfo).fastpathDecMapUint16UintR) - fn(map[uint16]uint8(nil), (*encFnInfo).fastpathEncMapUint16Uint8R, (*decFnInfo).fastpathDecMapUint16Uint8R) - fn(map[uint16]uint16(nil), (*encFnInfo).fastpathEncMapUint16Uint16R, (*decFnInfo).fastpathDecMapUint16Uint16R) - fn(map[uint16]uint32(nil), (*encFnInfo).fastpathEncMapUint16Uint32R, (*decFnInfo).fastpathDecMapUint16Uint32R) - fn(map[uint16]uint64(nil), (*encFnInfo).fastpathEncMapUint16Uint64R, (*decFnInfo).fastpathDecMapUint16Uint64R) - fn(map[uint16]uintptr(nil), (*encFnInfo).fastpathEncMapUint16UintptrR, (*decFnInfo).fastpathDecMapUint16UintptrR) - fn(map[uint16]int(nil), (*encFnInfo).fastpathEncMapUint16IntR, (*decFnInfo).fastpathDecMapUint16IntR) - fn(map[uint16]int8(nil), (*encFnInfo).fastpathEncMapUint16Int8R, (*decFnInfo).fastpathDecMapUint16Int8R) - fn(map[uint16]int16(nil), (*encFnInfo).fastpathEncMapUint16Int16R, (*decFnInfo).fastpathDecMapUint16Int16R) - fn(map[uint16]int32(nil), (*encFnInfo).fastpathEncMapUint16Int32R, (*decFnInfo).fastpathDecMapUint16Int32R) - fn(map[uint16]int64(nil), (*encFnInfo).fastpathEncMapUint16Int64R, (*decFnInfo).fastpathDecMapUint16Int64R) - fn(map[uint16]float32(nil), (*encFnInfo).fastpathEncMapUint16Float32R, (*decFnInfo).fastpathDecMapUint16Float32R) - fn(map[uint16]float64(nil), (*encFnInfo).fastpathEncMapUint16Float64R, (*decFnInfo).fastpathDecMapUint16Float64R) - fn(map[uint16]bool(nil), (*encFnInfo).fastpathEncMapUint16BoolR, (*decFnInfo).fastpathDecMapUint16BoolR) - fn(map[uint32]interface{}(nil), (*encFnInfo).fastpathEncMapUint32IntfR, (*decFnInfo).fastpathDecMapUint32IntfR) - fn(map[uint32]string(nil), (*encFnInfo).fastpathEncMapUint32StringR, (*decFnInfo).fastpathDecMapUint32StringR) - fn(map[uint32]uint(nil), (*encFnInfo).fastpathEncMapUint32UintR, (*decFnInfo).fastpathDecMapUint32UintR) - fn(map[uint32]uint8(nil), (*encFnInfo).fastpathEncMapUint32Uint8R, (*decFnInfo).fastpathDecMapUint32Uint8R) - fn(map[uint32]uint16(nil), (*encFnInfo).fastpathEncMapUint32Uint16R, (*decFnInfo).fastpathDecMapUint32Uint16R) - fn(map[uint32]uint32(nil), (*encFnInfo).fastpathEncMapUint32Uint32R, (*decFnInfo).fastpathDecMapUint32Uint32R) - fn(map[uint32]uint64(nil), (*encFnInfo).fastpathEncMapUint32Uint64R, (*decFnInfo).fastpathDecMapUint32Uint64R) - fn(map[uint32]uintptr(nil), (*encFnInfo).fastpathEncMapUint32UintptrR, (*decFnInfo).fastpathDecMapUint32UintptrR) - fn(map[uint32]int(nil), (*encFnInfo).fastpathEncMapUint32IntR, (*decFnInfo).fastpathDecMapUint32IntR) - fn(map[uint32]int8(nil), (*encFnInfo).fastpathEncMapUint32Int8R, (*decFnInfo).fastpathDecMapUint32Int8R) - fn(map[uint32]int16(nil), (*encFnInfo).fastpathEncMapUint32Int16R, (*decFnInfo).fastpathDecMapUint32Int16R) - fn(map[uint32]int32(nil), (*encFnInfo).fastpathEncMapUint32Int32R, (*decFnInfo).fastpathDecMapUint32Int32R) - fn(map[uint32]int64(nil), (*encFnInfo).fastpathEncMapUint32Int64R, (*decFnInfo).fastpathDecMapUint32Int64R) - fn(map[uint32]float32(nil), (*encFnInfo).fastpathEncMapUint32Float32R, (*decFnInfo).fastpathDecMapUint32Float32R) - fn(map[uint32]float64(nil), (*encFnInfo).fastpathEncMapUint32Float64R, (*decFnInfo).fastpathDecMapUint32Float64R) - fn(map[uint32]bool(nil), (*encFnInfo).fastpathEncMapUint32BoolR, (*decFnInfo).fastpathDecMapUint32BoolR) - fn(map[uint64]interface{}(nil), (*encFnInfo).fastpathEncMapUint64IntfR, (*decFnInfo).fastpathDecMapUint64IntfR) - fn(map[uint64]string(nil), (*encFnInfo).fastpathEncMapUint64StringR, (*decFnInfo).fastpathDecMapUint64StringR) - fn(map[uint64]uint(nil), (*encFnInfo).fastpathEncMapUint64UintR, (*decFnInfo).fastpathDecMapUint64UintR) - fn(map[uint64]uint8(nil), (*encFnInfo).fastpathEncMapUint64Uint8R, (*decFnInfo).fastpathDecMapUint64Uint8R) - fn(map[uint64]uint16(nil), (*encFnInfo).fastpathEncMapUint64Uint16R, (*decFnInfo).fastpathDecMapUint64Uint16R) - fn(map[uint64]uint32(nil), (*encFnInfo).fastpathEncMapUint64Uint32R, (*decFnInfo).fastpathDecMapUint64Uint32R) - fn(map[uint64]uint64(nil), (*encFnInfo).fastpathEncMapUint64Uint64R, (*decFnInfo).fastpathDecMapUint64Uint64R) - fn(map[uint64]uintptr(nil), (*encFnInfo).fastpathEncMapUint64UintptrR, (*decFnInfo).fastpathDecMapUint64UintptrR) - fn(map[uint64]int(nil), (*encFnInfo).fastpathEncMapUint64IntR, (*decFnInfo).fastpathDecMapUint64IntR) - fn(map[uint64]int8(nil), (*encFnInfo).fastpathEncMapUint64Int8R, (*decFnInfo).fastpathDecMapUint64Int8R) - fn(map[uint64]int16(nil), (*encFnInfo).fastpathEncMapUint64Int16R, (*decFnInfo).fastpathDecMapUint64Int16R) - fn(map[uint64]int32(nil), (*encFnInfo).fastpathEncMapUint64Int32R, (*decFnInfo).fastpathDecMapUint64Int32R) - fn(map[uint64]int64(nil), (*encFnInfo).fastpathEncMapUint64Int64R, (*decFnInfo).fastpathDecMapUint64Int64R) - fn(map[uint64]float32(nil), (*encFnInfo).fastpathEncMapUint64Float32R, (*decFnInfo).fastpathDecMapUint64Float32R) - fn(map[uint64]float64(nil), (*encFnInfo).fastpathEncMapUint64Float64R, (*decFnInfo).fastpathDecMapUint64Float64R) - fn(map[uint64]bool(nil), (*encFnInfo).fastpathEncMapUint64BoolR, (*decFnInfo).fastpathDecMapUint64BoolR) - fn(map[uintptr]interface{}(nil), (*encFnInfo).fastpathEncMapUintptrIntfR, (*decFnInfo).fastpathDecMapUintptrIntfR) - fn(map[uintptr]string(nil), (*encFnInfo).fastpathEncMapUintptrStringR, (*decFnInfo).fastpathDecMapUintptrStringR) - fn(map[uintptr]uint(nil), (*encFnInfo).fastpathEncMapUintptrUintR, (*decFnInfo).fastpathDecMapUintptrUintR) - fn(map[uintptr]uint8(nil), (*encFnInfo).fastpathEncMapUintptrUint8R, (*decFnInfo).fastpathDecMapUintptrUint8R) - fn(map[uintptr]uint16(nil), (*encFnInfo).fastpathEncMapUintptrUint16R, (*decFnInfo).fastpathDecMapUintptrUint16R) - fn(map[uintptr]uint32(nil), (*encFnInfo).fastpathEncMapUintptrUint32R, (*decFnInfo).fastpathDecMapUintptrUint32R) - fn(map[uintptr]uint64(nil), (*encFnInfo).fastpathEncMapUintptrUint64R, (*decFnInfo).fastpathDecMapUintptrUint64R) - fn(map[uintptr]uintptr(nil), (*encFnInfo).fastpathEncMapUintptrUintptrR, (*decFnInfo).fastpathDecMapUintptrUintptrR) - fn(map[uintptr]int(nil), (*encFnInfo).fastpathEncMapUintptrIntR, (*decFnInfo).fastpathDecMapUintptrIntR) - fn(map[uintptr]int8(nil), (*encFnInfo).fastpathEncMapUintptrInt8R, (*decFnInfo).fastpathDecMapUintptrInt8R) - fn(map[uintptr]int16(nil), (*encFnInfo).fastpathEncMapUintptrInt16R, (*decFnInfo).fastpathDecMapUintptrInt16R) - fn(map[uintptr]int32(nil), (*encFnInfo).fastpathEncMapUintptrInt32R, (*decFnInfo).fastpathDecMapUintptrInt32R) - fn(map[uintptr]int64(nil), (*encFnInfo).fastpathEncMapUintptrInt64R, (*decFnInfo).fastpathDecMapUintptrInt64R) - fn(map[uintptr]float32(nil), (*encFnInfo).fastpathEncMapUintptrFloat32R, (*decFnInfo).fastpathDecMapUintptrFloat32R) - fn(map[uintptr]float64(nil), (*encFnInfo).fastpathEncMapUintptrFloat64R, (*decFnInfo).fastpathDecMapUintptrFloat64R) - fn(map[uintptr]bool(nil), (*encFnInfo).fastpathEncMapUintptrBoolR, (*decFnInfo).fastpathDecMapUintptrBoolR) - fn(map[int]interface{}(nil), (*encFnInfo).fastpathEncMapIntIntfR, (*decFnInfo).fastpathDecMapIntIntfR) - fn(map[int]string(nil), (*encFnInfo).fastpathEncMapIntStringR, (*decFnInfo).fastpathDecMapIntStringR) - fn(map[int]uint(nil), (*encFnInfo).fastpathEncMapIntUintR, (*decFnInfo).fastpathDecMapIntUintR) - fn(map[int]uint8(nil), (*encFnInfo).fastpathEncMapIntUint8R, (*decFnInfo).fastpathDecMapIntUint8R) - fn(map[int]uint16(nil), (*encFnInfo).fastpathEncMapIntUint16R, (*decFnInfo).fastpathDecMapIntUint16R) - fn(map[int]uint32(nil), (*encFnInfo).fastpathEncMapIntUint32R, (*decFnInfo).fastpathDecMapIntUint32R) - fn(map[int]uint64(nil), (*encFnInfo).fastpathEncMapIntUint64R, (*decFnInfo).fastpathDecMapIntUint64R) - fn(map[int]uintptr(nil), (*encFnInfo).fastpathEncMapIntUintptrR, (*decFnInfo).fastpathDecMapIntUintptrR) - fn(map[int]int(nil), (*encFnInfo).fastpathEncMapIntIntR, (*decFnInfo).fastpathDecMapIntIntR) - fn(map[int]int8(nil), (*encFnInfo).fastpathEncMapIntInt8R, (*decFnInfo).fastpathDecMapIntInt8R) - fn(map[int]int16(nil), (*encFnInfo).fastpathEncMapIntInt16R, (*decFnInfo).fastpathDecMapIntInt16R) - fn(map[int]int32(nil), (*encFnInfo).fastpathEncMapIntInt32R, (*decFnInfo).fastpathDecMapIntInt32R) - fn(map[int]int64(nil), (*encFnInfo).fastpathEncMapIntInt64R, (*decFnInfo).fastpathDecMapIntInt64R) - fn(map[int]float32(nil), (*encFnInfo).fastpathEncMapIntFloat32R, (*decFnInfo).fastpathDecMapIntFloat32R) - fn(map[int]float64(nil), (*encFnInfo).fastpathEncMapIntFloat64R, (*decFnInfo).fastpathDecMapIntFloat64R) - fn(map[int]bool(nil), (*encFnInfo).fastpathEncMapIntBoolR, (*decFnInfo).fastpathDecMapIntBoolR) - fn(map[int8]interface{}(nil), (*encFnInfo).fastpathEncMapInt8IntfR, (*decFnInfo).fastpathDecMapInt8IntfR) - fn(map[int8]string(nil), (*encFnInfo).fastpathEncMapInt8StringR, (*decFnInfo).fastpathDecMapInt8StringR) - fn(map[int8]uint(nil), (*encFnInfo).fastpathEncMapInt8UintR, (*decFnInfo).fastpathDecMapInt8UintR) - fn(map[int8]uint8(nil), (*encFnInfo).fastpathEncMapInt8Uint8R, (*decFnInfo).fastpathDecMapInt8Uint8R) - fn(map[int8]uint16(nil), (*encFnInfo).fastpathEncMapInt8Uint16R, (*decFnInfo).fastpathDecMapInt8Uint16R) - fn(map[int8]uint32(nil), (*encFnInfo).fastpathEncMapInt8Uint32R, (*decFnInfo).fastpathDecMapInt8Uint32R) - fn(map[int8]uint64(nil), (*encFnInfo).fastpathEncMapInt8Uint64R, (*decFnInfo).fastpathDecMapInt8Uint64R) - fn(map[int8]uintptr(nil), (*encFnInfo).fastpathEncMapInt8UintptrR, (*decFnInfo).fastpathDecMapInt8UintptrR) - fn(map[int8]int(nil), (*encFnInfo).fastpathEncMapInt8IntR, (*decFnInfo).fastpathDecMapInt8IntR) - fn(map[int8]int8(nil), (*encFnInfo).fastpathEncMapInt8Int8R, (*decFnInfo).fastpathDecMapInt8Int8R) - fn(map[int8]int16(nil), (*encFnInfo).fastpathEncMapInt8Int16R, (*decFnInfo).fastpathDecMapInt8Int16R) - fn(map[int8]int32(nil), (*encFnInfo).fastpathEncMapInt8Int32R, (*decFnInfo).fastpathDecMapInt8Int32R) - fn(map[int8]int64(nil), (*encFnInfo).fastpathEncMapInt8Int64R, (*decFnInfo).fastpathDecMapInt8Int64R) - fn(map[int8]float32(nil), (*encFnInfo).fastpathEncMapInt8Float32R, (*decFnInfo).fastpathDecMapInt8Float32R) - fn(map[int8]float64(nil), (*encFnInfo).fastpathEncMapInt8Float64R, (*decFnInfo).fastpathDecMapInt8Float64R) - fn(map[int8]bool(nil), (*encFnInfo).fastpathEncMapInt8BoolR, (*decFnInfo).fastpathDecMapInt8BoolR) - fn(map[int16]interface{}(nil), (*encFnInfo).fastpathEncMapInt16IntfR, (*decFnInfo).fastpathDecMapInt16IntfR) - fn(map[int16]string(nil), (*encFnInfo).fastpathEncMapInt16StringR, (*decFnInfo).fastpathDecMapInt16StringR) - fn(map[int16]uint(nil), (*encFnInfo).fastpathEncMapInt16UintR, (*decFnInfo).fastpathDecMapInt16UintR) - fn(map[int16]uint8(nil), (*encFnInfo).fastpathEncMapInt16Uint8R, (*decFnInfo).fastpathDecMapInt16Uint8R) - fn(map[int16]uint16(nil), (*encFnInfo).fastpathEncMapInt16Uint16R, (*decFnInfo).fastpathDecMapInt16Uint16R) - fn(map[int16]uint32(nil), (*encFnInfo).fastpathEncMapInt16Uint32R, (*decFnInfo).fastpathDecMapInt16Uint32R) - fn(map[int16]uint64(nil), (*encFnInfo).fastpathEncMapInt16Uint64R, (*decFnInfo).fastpathDecMapInt16Uint64R) - fn(map[int16]uintptr(nil), (*encFnInfo).fastpathEncMapInt16UintptrR, (*decFnInfo).fastpathDecMapInt16UintptrR) - fn(map[int16]int(nil), (*encFnInfo).fastpathEncMapInt16IntR, (*decFnInfo).fastpathDecMapInt16IntR) - fn(map[int16]int8(nil), (*encFnInfo).fastpathEncMapInt16Int8R, (*decFnInfo).fastpathDecMapInt16Int8R) - fn(map[int16]int16(nil), (*encFnInfo).fastpathEncMapInt16Int16R, (*decFnInfo).fastpathDecMapInt16Int16R) - fn(map[int16]int32(nil), (*encFnInfo).fastpathEncMapInt16Int32R, (*decFnInfo).fastpathDecMapInt16Int32R) - fn(map[int16]int64(nil), (*encFnInfo).fastpathEncMapInt16Int64R, (*decFnInfo).fastpathDecMapInt16Int64R) - fn(map[int16]float32(nil), (*encFnInfo).fastpathEncMapInt16Float32R, (*decFnInfo).fastpathDecMapInt16Float32R) - fn(map[int16]float64(nil), (*encFnInfo).fastpathEncMapInt16Float64R, (*decFnInfo).fastpathDecMapInt16Float64R) - fn(map[int16]bool(nil), (*encFnInfo).fastpathEncMapInt16BoolR, (*decFnInfo).fastpathDecMapInt16BoolR) - fn(map[int32]interface{}(nil), (*encFnInfo).fastpathEncMapInt32IntfR, (*decFnInfo).fastpathDecMapInt32IntfR) - fn(map[int32]string(nil), (*encFnInfo).fastpathEncMapInt32StringR, (*decFnInfo).fastpathDecMapInt32StringR) - fn(map[int32]uint(nil), (*encFnInfo).fastpathEncMapInt32UintR, (*decFnInfo).fastpathDecMapInt32UintR) - fn(map[int32]uint8(nil), (*encFnInfo).fastpathEncMapInt32Uint8R, (*decFnInfo).fastpathDecMapInt32Uint8R) - fn(map[int32]uint16(nil), (*encFnInfo).fastpathEncMapInt32Uint16R, (*decFnInfo).fastpathDecMapInt32Uint16R) - fn(map[int32]uint32(nil), (*encFnInfo).fastpathEncMapInt32Uint32R, (*decFnInfo).fastpathDecMapInt32Uint32R) - fn(map[int32]uint64(nil), (*encFnInfo).fastpathEncMapInt32Uint64R, (*decFnInfo).fastpathDecMapInt32Uint64R) - fn(map[int32]uintptr(nil), (*encFnInfo).fastpathEncMapInt32UintptrR, (*decFnInfo).fastpathDecMapInt32UintptrR) - fn(map[int32]int(nil), (*encFnInfo).fastpathEncMapInt32IntR, (*decFnInfo).fastpathDecMapInt32IntR) - fn(map[int32]int8(nil), (*encFnInfo).fastpathEncMapInt32Int8R, (*decFnInfo).fastpathDecMapInt32Int8R) - fn(map[int32]int16(nil), (*encFnInfo).fastpathEncMapInt32Int16R, (*decFnInfo).fastpathDecMapInt32Int16R) - fn(map[int32]int32(nil), (*encFnInfo).fastpathEncMapInt32Int32R, (*decFnInfo).fastpathDecMapInt32Int32R) - fn(map[int32]int64(nil), (*encFnInfo).fastpathEncMapInt32Int64R, (*decFnInfo).fastpathDecMapInt32Int64R) - fn(map[int32]float32(nil), (*encFnInfo).fastpathEncMapInt32Float32R, (*decFnInfo).fastpathDecMapInt32Float32R) - fn(map[int32]float64(nil), (*encFnInfo).fastpathEncMapInt32Float64R, (*decFnInfo).fastpathDecMapInt32Float64R) - fn(map[int32]bool(nil), (*encFnInfo).fastpathEncMapInt32BoolR, (*decFnInfo).fastpathDecMapInt32BoolR) - fn(map[int64]interface{}(nil), (*encFnInfo).fastpathEncMapInt64IntfR, (*decFnInfo).fastpathDecMapInt64IntfR) - fn(map[int64]string(nil), (*encFnInfo).fastpathEncMapInt64StringR, (*decFnInfo).fastpathDecMapInt64StringR) - fn(map[int64]uint(nil), (*encFnInfo).fastpathEncMapInt64UintR, (*decFnInfo).fastpathDecMapInt64UintR) - fn(map[int64]uint8(nil), (*encFnInfo).fastpathEncMapInt64Uint8R, (*decFnInfo).fastpathDecMapInt64Uint8R) - fn(map[int64]uint16(nil), (*encFnInfo).fastpathEncMapInt64Uint16R, (*decFnInfo).fastpathDecMapInt64Uint16R) - fn(map[int64]uint32(nil), (*encFnInfo).fastpathEncMapInt64Uint32R, (*decFnInfo).fastpathDecMapInt64Uint32R) - fn(map[int64]uint64(nil), (*encFnInfo).fastpathEncMapInt64Uint64R, (*decFnInfo).fastpathDecMapInt64Uint64R) - fn(map[int64]uintptr(nil), (*encFnInfo).fastpathEncMapInt64UintptrR, (*decFnInfo).fastpathDecMapInt64UintptrR) - fn(map[int64]int(nil), (*encFnInfo).fastpathEncMapInt64IntR, (*decFnInfo).fastpathDecMapInt64IntR) - fn(map[int64]int8(nil), (*encFnInfo).fastpathEncMapInt64Int8R, (*decFnInfo).fastpathDecMapInt64Int8R) - fn(map[int64]int16(nil), (*encFnInfo).fastpathEncMapInt64Int16R, (*decFnInfo).fastpathDecMapInt64Int16R) - fn(map[int64]int32(nil), (*encFnInfo).fastpathEncMapInt64Int32R, (*decFnInfo).fastpathDecMapInt64Int32R) - fn(map[int64]int64(nil), (*encFnInfo).fastpathEncMapInt64Int64R, (*decFnInfo).fastpathDecMapInt64Int64R) - fn(map[int64]float32(nil), (*encFnInfo).fastpathEncMapInt64Float32R, (*decFnInfo).fastpathDecMapInt64Float32R) - fn(map[int64]float64(nil), (*encFnInfo).fastpathEncMapInt64Float64R, (*decFnInfo).fastpathDecMapInt64Float64R) - fn(map[int64]bool(nil), (*encFnInfo).fastpathEncMapInt64BoolR, (*decFnInfo).fastpathDecMapInt64BoolR) - fn(map[bool]interface{}(nil), (*encFnInfo).fastpathEncMapBoolIntfR, (*decFnInfo).fastpathDecMapBoolIntfR) - fn(map[bool]string(nil), (*encFnInfo).fastpathEncMapBoolStringR, (*decFnInfo).fastpathDecMapBoolStringR) - fn(map[bool]uint(nil), (*encFnInfo).fastpathEncMapBoolUintR, (*decFnInfo).fastpathDecMapBoolUintR) - fn(map[bool]uint8(nil), (*encFnInfo).fastpathEncMapBoolUint8R, (*decFnInfo).fastpathDecMapBoolUint8R) - fn(map[bool]uint16(nil), (*encFnInfo).fastpathEncMapBoolUint16R, (*decFnInfo).fastpathDecMapBoolUint16R) - fn(map[bool]uint32(nil), (*encFnInfo).fastpathEncMapBoolUint32R, (*decFnInfo).fastpathDecMapBoolUint32R) - fn(map[bool]uint64(nil), (*encFnInfo).fastpathEncMapBoolUint64R, (*decFnInfo).fastpathDecMapBoolUint64R) - fn(map[bool]uintptr(nil), (*encFnInfo).fastpathEncMapBoolUintptrR, (*decFnInfo).fastpathDecMapBoolUintptrR) - fn(map[bool]int(nil), (*encFnInfo).fastpathEncMapBoolIntR, (*decFnInfo).fastpathDecMapBoolIntR) - fn(map[bool]int8(nil), (*encFnInfo).fastpathEncMapBoolInt8R, (*decFnInfo).fastpathDecMapBoolInt8R) - fn(map[bool]int16(nil), (*encFnInfo).fastpathEncMapBoolInt16R, (*decFnInfo).fastpathDecMapBoolInt16R) - fn(map[bool]int32(nil), (*encFnInfo).fastpathEncMapBoolInt32R, (*decFnInfo).fastpathDecMapBoolInt32R) - fn(map[bool]int64(nil), (*encFnInfo).fastpathEncMapBoolInt64R, (*decFnInfo).fastpathDecMapBoolInt64R) - fn(map[bool]float32(nil), (*encFnInfo).fastpathEncMapBoolFloat32R, (*decFnInfo).fastpathDecMapBoolFloat32R) - fn(map[bool]float64(nil), (*encFnInfo).fastpathEncMapBoolFloat64R, (*decFnInfo).fastpathDecMapBoolFloat64R) - fn(map[bool]bool(nil), (*encFnInfo).fastpathEncMapBoolBoolR, (*decFnInfo).fastpathDecMapBoolBoolR) + fn(map[interface{}]interface{}(nil), (*Encoder).fastpathEncMapIntfIntfR, (*Decoder).fastpathDecMapIntfIntfR) + fn(map[interface{}]string(nil), (*Encoder).fastpathEncMapIntfStringR, (*Decoder).fastpathDecMapIntfStringR) + fn(map[interface{}]uint(nil), (*Encoder).fastpathEncMapIntfUintR, (*Decoder).fastpathDecMapIntfUintR) + fn(map[interface{}]uint8(nil), (*Encoder).fastpathEncMapIntfUint8R, (*Decoder).fastpathDecMapIntfUint8R) + fn(map[interface{}]uint16(nil), (*Encoder).fastpathEncMapIntfUint16R, (*Decoder).fastpathDecMapIntfUint16R) + fn(map[interface{}]uint32(nil), (*Encoder).fastpathEncMapIntfUint32R, (*Decoder).fastpathDecMapIntfUint32R) + fn(map[interface{}]uint64(nil), (*Encoder).fastpathEncMapIntfUint64R, (*Decoder).fastpathDecMapIntfUint64R) + fn(map[interface{}]uintptr(nil), (*Encoder).fastpathEncMapIntfUintptrR, (*Decoder).fastpathDecMapIntfUintptrR) + fn(map[interface{}]int(nil), (*Encoder).fastpathEncMapIntfIntR, (*Decoder).fastpathDecMapIntfIntR) + fn(map[interface{}]int8(nil), (*Encoder).fastpathEncMapIntfInt8R, (*Decoder).fastpathDecMapIntfInt8R) + fn(map[interface{}]int16(nil), (*Encoder).fastpathEncMapIntfInt16R, (*Decoder).fastpathDecMapIntfInt16R) + fn(map[interface{}]int32(nil), (*Encoder).fastpathEncMapIntfInt32R, (*Decoder).fastpathDecMapIntfInt32R) + fn(map[interface{}]int64(nil), (*Encoder).fastpathEncMapIntfInt64R, (*Decoder).fastpathDecMapIntfInt64R) + fn(map[interface{}]float32(nil), (*Encoder).fastpathEncMapIntfFloat32R, (*Decoder).fastpathDecMapIntfFloat32R) + fn(map[interface{}]float64(nil), (*Encoder).fastpathEncMapIntfFloat64R, (*Decoder).fastpathDecMapIntfFloat64R) + fn(map[interface{}]bool(nil), (*Encoder).fastpathEncMapIntfBoolR, (*Decoder).fastpathDecMapIntfBoolR) + fn(map[string]interface{}(nil), (*Encoder).fastpathEncMapStringIntfR, (*Decoder).fastpathDecMapStringIntfR) + fn(map[string]string(nil), (*Encoder).fastpathEncMapStringStringR, (*Decoder).fastpathDecMapStringStringR) + fn(map[string]uint(nil), (*Encoder).fastpathEncMapStringUintR, (*Decoder).fastpathDecMapStringUintR) + fn(map[string]uint8(nil), (*Encoder).fastpathEncMapStringUint8R, (*Decoder).fastpathDecMapStringUint8R) + fn(map[string]uint16(nil), (*Encoder).fastpathEncMapStringUint16R, (*Decoder).fastpathDecMapStringUint16R) + fn(map[string]uint32(nil), (*Encoder).fastpathEncMapStringUint32R, (*Decoder).fastpathDecMapStringUint32R) + fn(map[string]uint64(nil), (*Encoder).fastpathEncMapStringUint64R, (*Decoder).fastpathDecMapStringUint64R) + fn(map[string]uintptr(nil), (*Encoder).fastpathEncMapStringUintptrR, (*Decoder).fastpathDecMapStringUintptrR) + fn(map[string]int(nil), (*Encoder).fastpathEncMapStringIntR, (*Decoder).fastpathDecMapStringIntR) + fn(map[string]int8(nil), (*Encoder).fastpathEncMapStringInt8R, (*Decoder).fastpathDecMapStringInt8R) + fn(map[string]int16(nil), (*Encoder).fastpathEncMapStringInt16R, (*Decoder).fastpathDecMapStringInt16R) + fn(map[string]int32(nil), (*Encoder).fastpathEncMapStringInt32R, (*Decoder).fastpathDecMapStringInt32R) + fn(map[string]int64(nil), (*Encoder).fastpathEncMapStringInt64R, (*Decoder).fastpathDecMapStringInt64R) + fn(map[string]float32(nil), (*Encoder).fastpathEncMapStringFloat32R, (*Decoder).fastpathDecMapStringFloat32R) + fn(map[string]float64(nil), (*Encoder).fastpathEncMapStringFloat64R, (*Decoder).fastpathDecMapStringFloat64R) + fn(map[string]bool(nil), (*Encoder).fastpathEncMapStringBoolR, (*Decoder).fastpathDecMapStringBoolR) + fn(map[float32]interface{}(nil), (*Encoder).fastpathEncMapFloat32IntfR, (*Decoder).fastpathDecMapFloat32IntfR) + fn(map[float32]string(nil), (*Encoder).fastpathEncMapFloat32StringR, (*Decoder).fastpathDecMapFloat32StringR) + fn(map[float32]uint(nil), (*Encoder).fastpathEncMapFloat32UintR, (*Decoder).fastpathDecMapFloat32UintR) + fn(map[float32]uint8(nil), (*Encoder).fastpathEncMapFloat32Uint8R, (*Decoder).fastpathDecMapFloat32Uint8R) + fn(map[float32]uint16(nil), (*Encoder).fastpathEncMapFloat32Uint16R, (*Decoder).fastpathDecMapFloat32Uint16R) + fn(map[float32]uint32(nil), (*Encoder).fastpathEncMapFloat32Uint32R, (*Decoder).fastpathDecMapFloat32Uint32R) + fn(map[float32]uint64(nil), (*Encoder).fastpathEncMapFloat32Uint64R, (*Decoder).fastpathDecMapFloat32Uint64R) + fn(map[float32]uintptr(nil), (*Encoder).fastpathEncMapFloat32UintptrR, (*Decoder).fastpathDecMapFloat32UintptrR) + fn(map[float32]int(nil), (*Encoder).fastpathEncMapFloat32IntR, (*Decoder).fastpathDecMapFloat32IntR) + fn(map[float32]int8(nil), (*Encoder).fastpathEncMapFloat32Int8R, (*Decoder).fastpathDecMapFloat32Int8R) + fn(map[float32]int16(nil), (*Encoder).fastpathEncMapFloat32Int16R, (*Decoder).fastpathDecMapFloat32Int16R) + fn(map[float32]int32(nil), (*Encoder).fastpathEncMapFloat32Int32R, (*Decoder).fastpathDecMapFloat32Int32R) + fn(map[float32]int64(nil), (*Encoder).fastpathEncMapFloat32Int64R, (*Decoder).fastpathDecMapFloat32Int64R) + fn(map[float32]float32(nil), (*Encoder).fastpathEncMapFloat32Float32R, (*Decoder).fastpathDecMapFloat32Float32R) + fn(map[float32]float64(nil), (*Encoder).fastpathEncMapFloat32Float64R, (*Decoder).fastpathDecMapFloat32Float64R) + fn(map[float32]bool(nil), (*Encoder).fastpathEncMapFloat32BoolR, (*Decoder).fastpathDecMapFloat32BoolR) + fn(map[float64]interface{}(nil), (*Encoder).fastpathEncMapFloat64IntfR, (*Decoder).fastpathDecMapFloat64IntfR) + fn(map[float64]string(nil), (*Encoder).fastpathEncMapFloat64StringR, (*Decoder).fastpathDecMapFloat64StringR) + fn(map[float64]uint(nil), (*Encoder).fastpathEncMapFloat64UintR, (*Decoder).fastpathDecMapFloat64UintR) + fn(map[float64]uint8(nil), (*Encoder).fastpathEncMapFloat64Uint8R, (*Decoder).fastpathDecMapFloat64Uint8R) + fn(map[float64]uint16(nil), (*Encoder).fastpathEncMapFloat64Uint16R, (*Decoder).fastpathDecMapFloat64Uint16R) + fn(map[float64]uint32(nil), (*Encoder).fastpathEncMapFloat64Uint32R, (*Decoder).fastpathDecMapFloat64Uint32R) + fn(map[float64]uint64(nil), (*Encoder).fastpathEncMapFloat64Uint64R, (*Decoder).fastpathDecMapFloat64Uint64R) + fn(map[float64]uintptr(nil), (*Encoder).fastpathEncMapFloat64UintptrR, (*Decoder).fastpathDecMapFloat64UintptrR) + fn(map[float64]int(nil), (*Encoder).fastpathEncMapFloat64IntR, (*Decoder).fastpathDecMapFloat64IntR) + fn(map[float64]int8(nil), (*Encoder).fastpathEncMapFloat64Int8R, (*Decoder).fastpathDecMapFloat64Int8R) + fn(map[float64]int16(nil), (*Encoder).fastpathEncMapFloat64Int16R, (*Decoder).fastpathDecMapFloat64Int16R) + fn(map[float64]int32(nil), (*Encoder).fastpathEncMapFloat64Int32R, (*Decoder).fastpathDecMapFloat64Int32R) + fn(map[float64]int64(nil), (*Encoder).fastpathEncMapFloat64Int64R, (*Decoder).fastpathDecMapFloat64Int64R) + fn(map[float64]float32(nil), (*Encoder).fastpathEncMapFloat64Float32R, (*Decoder).fastpathDecMapFloat64Float32R) + fn(map[float64]float64(nil), (*Encoder).fastpathEncMapFloat64Float64R, (*Decoder).fastpathDecMapFloat64Float64R) + fn(map[float64]bool(nil), (*Encoder).fastpathEncMapFloat64BoolR, (*Decoder).fastpathDecMapFloat64BoolR) + fn(map[uint]interface{}(nil), (*Encoder).fastpathEncMapUintIntfR, (*Decoder).fastpathDecMapUintIntfR) + fn(map[uint]string(nil), (*Encoder).fastpathEncMapUintStringR, (*Decoder).fastpathDecMapUintStringR) + fn(map[uint]uint(nil), (*Encoder).fastpathEncMapUintUintR, (*Decoder).fastpathDecMapUintUintR) + fn(map[uint]uint8(nil), (*Encoder).fastpathEncMapUintUint8R, (*Decoder).fastpathDecMapUintUint8R) + fn(map[uint]uint16(nil), (*Encoder).fastpathEncMapUintUint16R, (*Decoder).fastpathDecMapUintUint16R) + fn(map[uint]uint32(nil), (*Encoder).fastpathEncMapUintUint32R, (*Decoder).fastpathDecMapUintUint32R) + fn(map[uint]uint64(nil), (*Encoder).fastpathEncMapUintUint64R, (*Decoder).fastpathDecMapUintUint64R) + fn(map[uint]uintptr(nil), (*Encoder).fastpathEncMapUintUintptrR, (*Decoder).fastpathDecMapUintUintptrR) + fn(map[uint]int(nil), (*Encoder).fastpathEncMapUintIntR, (*Decoder).fastpathDecMapUintIntR) + fn(map[uint]int8(nil), (*Encoder).fastpathEncMapUintInt8R, (*Decoder).fastpathDecMapUintInt8R) + fn(map[uint]int16(nil), (*Encoder).fastpathEncMapUintInt16R, (*Decoder).fastpathDecMapUintInt16R) + fn(map[uint]int32(nil), (*Encoder).fastpathEncMapUintInt32R, (*Decoder).fastpathDecMapUintInt32R) + fn(map[uint]int64(nil), (*Encoder).fastpathEncMapUintInt64R, (*Decoder).fastpathDecMapUintInt64R) + fn(map[uint]float32(nil), (*Encoder).fastpathEncMapUintFloat32R, (*Decoder).fastpathDecMapUintFloat32R) + fn(map[uint]float64(nil), (*Encoder).fastpathEncMapUintFloat64R, (*Decoder).fastpathDecMapUintFloat64R) + fn(map[uint]bool(nil), (*Encoder).fastpathEncMapUintBoolR, (*Decoder).fastpathDecMapUintBoolR) + fn(map[uint8]interface{}(nil), (*Encoder).fastpathEncMapUint8IntfR, (*Decoder).fastpathDecMapUint8IntfR) + fn(map[uint8]string(nil), (*Encoder).fastpathEncMapUint8StringR, (*Decoder).fastpathDecMapUint8StringR) + fn(map[uint8]uint(nil), (*Encoder).fastpathEncMapUint8UintR, (*Decoder).fastpathDecMapUint8UintR) + fn(map[uint8]uint8(nil), (*Encoder).fastpathEncMapUint8Uint8R, (*Decoder).fastpathDecMapUint8Uint8R) + fn(map[uint8]uint16(nil), (*Encoder).fastpathEncMapUint8Uint16R, (*Decoder).fastpathDecMapUint8Uint16R) + fn(map[uint8]uint32(nil), (*Encoder).fastpathEncMapUint8Uint32R, (*Decoder).fastpathDecMapUint8Uint32R) + fn(map[uint8]uint64(nil), (*Encoder).fastpathEncMapUint8Uint64R, (*Decoder).fastpathDecMapUint8Uint64R) + fn(map[uint8]uintptr(nil), (*Encoder).fastpathEncMapUint8UintptrR, (*Decoder).fastpathDecMapUint8UintptrR) + fn(map[uint8]int(nil), (*Encoder).fastpathEncMapUint8IntR, (*Decoder).fastpathDecMapUint8IntR) + fn(map[uint8]int8(nil), (*Encoder).fastpathEncMapUint8Int8R, (*Decoder).fastpathDecMapUint8Int8R) + fn(map[uint8]int16(nil), (*Encoder).fastpathEncMapUint8Int16R, (*Decoder).fastpathDecMapUint8Int16R) + fn(map[uint8]int32(nil), (*Encoder).fastpathEncMapUint8Int32R, (*Decoder).fastpathDecMapUint8Int32R) + fn(map[uint8]int64(nil), (*Encoder).fastpathEncMapUint8Int64R, (*Decoder).fastpathDecMapUint8Int64R) + fn(map[uint8]float32(nil), (*Encoder).fastpathEncMapUint8Float32R, (*Decoder).fastpathDecMapUint8Float32R) + fn(map[uint8]float64(nil), (*Encoder).fastpathEncMapUint8Float64R, (*Decoder).fastpathDecMapUint8Float64R) + fn(map[uint8]bool(nil), (*Encoder).fastpathEncMapUint8BoolR, (*Decoder).fastpathDecMapUint8BoolR) + fn(map[uint16]interface{}(nil), (*Encoder).fastpathEncMapUint16IntfR, (*Decoder).fastpathDecMapUint16IntfR) + fn(map[uint16]string(nil), (*Encoder).fastpathEncMapUint16StringR, (*Decoder).fastpathDecMapUint16StringR) + fn(map[uint16]uint(nil), (*Encoder).fastpathEncMapUint16UintR, (*Decoder).fastpathDecMapUint16UintR) + fn(map[uint16]uint8(nil), (*Encoder).fastpathEncMapUint16Uint8R, (*Decoder).fastpathDecMapUint16Uint8R) + fn(map[uint16]uint16(nil), (*Encoder).fastpathEncMapUint16Uint16R, (*Decoder).fastpathDecMapUint16Uint16R) + fn(map[uint16]uint32(nil), (*Encoder).fastpathEncMapUint16Uint32R, (*Decoder).fastpathDecMapUint16Uint32R) + fn(map[uint16]uint64(nil), (*Encoder).fastpathEncMapUint16Uint64R, (*Decoder).fastpathDecMapUint16Uint64R) + fn(map[uint16]uintptr(nil), (*Encoder).fastpathEncMapUint16UintptrR, (*Decoder).fastpathDecMapUint16UintptrR) + fn(map[uint16]int(nil), (*Encoder).fastpathEncMapUint16IntR, (*Decoder).fastpathDecMapUint16IntR) + fn(map[uint16]int8(nil), (*Encoder).fastpathEncMapUint16Int8R, (*Decoder).fastpathDecMapUint16Int8R) + fn(map[uint16]int16(nil), (*Encoder).fastpathEncMapUint16Int16R, (*Decoder).fastpathDecMapUint16Int16R) + fn(map[uint16]int32(nil), (*Encoder).fastpathEncMapUint16Int32R, (*Decoder).fastpathDecMapUint16Int32R) + fn(map[uint16]int64(nil), (*Encoder).fastpathEncMapUint16Int64R, (*Decoder).fastpathDecMapUint16Int64R) + fn(map[uint16]float32(nil), (*Encoder).fastpathEncMapUint16Float32R, (*Decoder).fastpathDecMapUint16Float32R) + fn(map[uint16]float64(nil), (*Encoder).fastpathEncMapUint16Float64R, (*Decoder).fastpathDecMapUint16Float64R) + fn(map[uint16]bool(nil), (*Encoder).fastpathEncMapUint16BoolR, (*Decoder).fastpathDecMapUint16BoolR) + fn(map[uint32]interface{}(nil), (*Encoder).fastpathEncMapUint32IntfR, (*Decoder).fastpathDecMapUint32IntfR) + fn(map[uint32]string(nil), (*Encoder).fastpathEncMapUint32StringR, (*Decoder).fastpathDecMapUint32StringR) + fn(map[uint32]uint(nil), (*Encoder).fastpathEncMapUint32UintR, (*Decoder).fastpathDecMapUint32UintR) + fn(map[uint32]uint8(nil), (*Encoder).fastpathEncMapUint32Uint8R, (*Decoder).fastpathDecMapUint32Uint8R) + fn(map[uint32]uint16(nil), (*Encoder).fastpathEncMapUint32Uint16R, (*Decoder).fastpathDecMapUint32Uint16R) + fn(map[uint32]uint32(nil), (*Encoder).fastpathEncMapUint32Uint32R, (*Decoder).fastpathDecMapUint32Uint32R) + fn(map[uint32]uint64(nil), (*Encoder).fastpathEncMapUint32Uint64R, (*Decoder).fastpathDecMapUint32Uint64R) + fn(map[uint32]uintptr(nil), (*Encoder).fastpathEncMapUint32UintptrR, (*Decoder).fastpathDecMapUint32UintptrR) + fn(map[uint32]int(nil), (*Encoder).fastpathEncMapUint32IntR, (*Decoder).fastpathDecMapUint32IntR) + fn(map[uint32]int8(nil), (*Encoder).fastpathEncMapUint32Int8R, (*Decoder).fastpathDecMapUint32Int8R) + fn(map[uint32]int16(nil), (*Encoder).fastpathEncMapUint32Int16R, (*Decoder).fastpathDecMapUint32Int16R) + fn(map[uint32]int32(nil), (*Encoder).fastpathEncMapUint32Int32R, (*Decoder).fastpathDecMapUint32Int32R) + fn(map[uint32]int64(nil), (*Encoder).fastpathEncMapUint32Int64R, (*Decoder).fastpathDecMapUint32Int64R) + fn(map[uint32]float32(nil), (*Encoder).fastpathEncMapUint32Float32R, (*Decoder).fastpathDecMapUint32Float32R) + fn(map[uint32]float64(nil), (*Encoder).fastpathEncMapUint32Float64R, (*Decoder).fastpathDecMapUint32Float64R) + fn(map[uint32]bool(nil), (*Encoder).fastpathEncMapUint32BoolR, (*Decoder).fastpathDecMapUint32BoolR) + fn(map[uint64]interface{}(nil), (*Encoder).fastpathEncMapUint64IntfR, (*Decoder).fastpathDecMapUint64IntfR) + fn(map[uint64]string(nil), (*Encoder).fastpathEncMapUint64StringR, (*Decoder).fastpathDecMapUint64StringR) + fn(map[uint64]uint(nil), (*Encoder).fastpathEncMapUint64UintR, (*Decoder).fastpathDecMapUint64UintR) + fn(map[uint64]uint8(nil), (*Encoder).fastpathEncMapUint64Uint8R, (*Decoder).fastpathDecMapUint64Uint8R) + fn(map[uint64]uint16(nil), (*Encoder).fastpathEncMapUint64Uint16R, (*Decoder).fastpathDecMapUint64Uint16R) + fn(map[uint64]uint32(nil), (*Encoder).fastpathEncMapUint64Uint32R, (*Decoder).fastpathDecMapUint64Uint32R) + fn(map[uint64]uint64(nil), (*Encoder).fastpathEncMapUint64Uint64R, (*Decoder).fastpathDecMapUint64Uint64R) + fn(map[uint64]uintptr(nil), (*Encoder).fastpathEncMapUint64UintptrR, (*Decoder).fastpathDecMapUint64UintptrR) + fn(map[uint64]int(nil), (*Encoder).fastpathEncMapUint64IntR, (*Decoder).fastpathDecMapUint64IntR) + fn(map[uint64]int8(nil), (*Encoder).fastpathEncMapUint64Int8R, (*Decoder).fastpathDecMapUint64Int8R) + fn(map[uint64]int16(nil), (*Encoder).fastpathEncMapUint64Int16R, (*Decoder).fastpathDecMapUint64Int16R) + fn(map[uint64]int32(nil), (*Encoder).fastpathEncMapUint64Int32R, (*Decoder).fastpathDecMapUint64Int32R) + fn(map[uint64]int64(nil), (*Encoder).fastpathEncMapUint64Int64R, (*Decoder).fastpathDecMapUint64Int64R) + fn(map[uint64]float32(nil), (*Encoder).fastpathEncMapUint64Float32R, (*Decoder).fastpathDecMapUint64Float32R) + fn(map[uint64]float64(nil), (*Encoder).fastpathEncMapUint64Float64R, (*Decoder).fastpathDecMapUint64Float64R) + fn(map[uint64]bool(nil), (*Encoder).fastpathEncMapUint64BoolR, (*Decoder).fastpathDecMapUint64BoolR) + fn(map[uintptr]interface{}(nil), (*Encoder).fastpathEncMapUintptrIntfR, (*Decoder).fastpathDecMapUintptrIntfR) + fn(map[uintptr]string(nil), (*Encoder).fastpathEncMapUintptrStringR, (*Decoder).fastpathDecMapUintptrStringR) + fn(map[uintptr]uint(nil), (*Encoder).fastpathEncMapUintptrUintR, (*Decoder).fastpathDecMapUintptrUintR) + fn(map[uintptr]uint8(nil), (*Encoder).fastpathEncMapUintptrUint8R, (*Decoder).fastpathDecMapUintptrUint8R) + fn(map[uintptr]uint16(nil), (*Encoder).fastpathEncMapUintptrUint16R, (*Decoder).fastpathDecMapUintptrUint16R) + fn(map[uintptr]uint32(nil), (*Encoder).fastpathEncMapUintptrUint32R, (*Decoder).fastpathDecMapUintptrUint32R) + fn(map[uintptr]uint64(nil), (*Encoder).fastpathEncMapUintptrUint64R, (*Decoder).fastpathDecMapUintptrUint64R) + fn(map[uintptr]uintptr(nil), (*Encoder).fastpathEncMapUintptrUintptrR, (*Decoder).fastpathDecMapUintptrUintptrR) + fn(map[uintptr]int(nil), (*Encoder).fastpathEncMapUintptrIntR, (*Decoder).fastpathDecMapUintptrIntR) + fn(map[uintptr]int8(nil), (*Encoder).fastpathEncMapUintptrInt8R, (*Decoder).fastpathDecMapUintptrInt8R) + fn(map[uintptr]int16(nil), (*Encoder).fastpathEncMapUintptrInt16R, (*Decoder).fastpathDecMapUintptrInt16R) + fn(map[uintptr]int32(nil), (*Encoder).fastpathEncMapUintptrInt32R, (*Decoder).fastpathDecMapUintptrInt32R) + fn(map[uintptr]int64(nil), (*Encoder).fastpathEncMapUintptrInt64R, (*Decoder).fastpathDecMapUintptrInt64R) + fn(map[uintptr]float32(nil), (*Encoder).fastpathEncMapUintptrFloat32R, (*Decoder).fastpathDecMapUintptrFloat32R) + fn(map[uintptr]float64(nil), (*Encoder).fastpathEncMapUintptrFloat64R, (*Decoder).fastpathDecMapUintptrFloat64R) + fn(map[uintptr]bool(nil), (*Encoder).fastpathEncMapUintptrBoolR, (*Decoder).fastpathDecMapUintptrBoolR) + fn(map[int]interface{}(nil), (*Encoder).fastpathEncMapIntIntfR, (*Decoder).fastpathDecMapIntIntfR) + fn(map[int]string(nil), (*Encoder).fastpathEncMapIntStringR, (*Decoder).fastpathDecMapIntStringR) + fn(map[int]uint(nil), (*Encoder).fastpathEncMapIntUintR, (*Decoder).fastpathDecMapIntUintR) + fn(map[int]uint8(nil), (*Encoder).fastpathEncMapIntUint8R, (*Decoder).fastpathDecMapIntUint8R) + fn(map[int]uint16(nil), (*Encoder).fastpathEncMapIntUint16R, (*Decoder).fastpathDecMapIntUint16R) + fn(map[int]uint32(nil), (*Encoder).fastpathEncMapIntUint32R, (*Decoder).fastpathDecMapIntUint32R) + fn(map[int]uint64(nil), (*Encoder).fastpathEncMapIntUint64R, (*Decoder).fastpathDecMapIntUint64R) + fn(map[int]uintptr(nil), (*Encoder).fastpathEncMapIntUintptrR, (*Decoder).fastpathDecMapIntUintptrR) + fn(map[int]int(nil), (*Encoder).fastpathEncMapIntIntR, (*Decoder).fastpathDecMapIntIntR) + fn(map[int]int8(nil), (*Encoder).fastpathEncMapIntInt8R, (*Decoder).fastpathDecMapIntInt8R) + fn(map[int]int16(nil), (*Encoder).fastpathEncMapIntInt16R, (*Decoder).fastpathDecMapIntInt16R) + fn(map[int]int32(nil), (*Encoder).fastpathEncMapIntInt32R, (*Decoder).fastpathDecMapIntInt32R) + fn(map[int]int64(nil), (*Encoder).fastpathEncMapIntInt64R, (*Decoder).fastpathDecMapIntInt64R) + fn(map[int]float32(nil), (*Encoder).fastpathEncMapIntFloat32R, (*Decoder).fastpathDecMapIntFloat32R) + fn(map[int]float64(nil), (*Encoder).fastpathEncMapIntFloat64R, (*Decoder).fastpathDecMapIntFloat64R) + fn(map[int]bool(nil), (*Encoder).fastpathEncMapIntBoolR, (*Decoder).fastpathDecMapIntBoolR) + fn(map[int8]interface{}(nil), (*Encoder).fastpathEncMapInt8IntfR, (*Decoder).fastpathDecMapInt8IntfR) + fn(map[int8]string(nil), (*Encoder).fastpathEncMapInt8StringR, (*Decoder).fastpathDecMapInt8StringR) + fn(map[int8]uint(nil), (*Encoder).fastpathEncMapInt8UintR, (*Decoder).fastpathDecMapInt8UintR) + fn(map[int8]uint8(nil), (*Encoder).fastpathEncMapInt8Uint8R, (*Decoder).fastpathDecMapInt8Uint8R) + fn(map[int8]uint16(nil), (*Encoder).fastpathEncMapInt8Uint16R, (*Decoder).fastpathDecMapInt8Uint16R) + fn(map[int8]uint32(nil), (*Encoder).fastpathEncMapInt8Uint32R, (*Decoder).fastpathDecMapInt8Uint32R) + fn(map[int8]uint64(nil), (*Encoder).fastpathEncMapInt8Uint64R, (*Decoder).fastpathDecMapInt8Uint64R) + fn(map[int8]uintptr(nil), (*Encoder).fastpathEncMapInt8UintptrR, (*Decoder).fastpathDecMapInt8UintptrR) + fn(map[int8]int(nil), (*Encoder).fastpathEncMapInt8IntR, (*Decoder).fastpathDecMapInt8IntR) + fn(map[int8]int8(nil), (*Encoder).fastpathEncMapInt8Int8R, (*Decoder).fastpathDecMapInt8Int8R) + fn(map[int8]int16(nil), (*Encoder).fastpathEncMapInt8Int16R, (*Decoder).fastpathDecMapInt8Int16R) + fn(map[int8]int32(nil), (*Encoder).fastpathEncMapInt8Int32R, (*Decoder).fastpathDecMapInt8Int32R) + fn(map[int8]int64(nil), (*Encoder).fastpathEncMapInt8Int64R, (*Decoder).fastpathDecMapInt8Int64R) + fn(map[int8]float32(nil), (*Encoder).fastpathEncMapInt8Float32R, (*Decoder).fastpathDecMapInt8Float32R) + fn(map[int8]float64(nil), (*Encoder).fastpathEncMapInt8Float64R, (*Decoder).fastpathDecMapInt8Float64R) + fn(map[int8]bool(nil), (*Encoder).fastpathEncMapInt8BoolR, (*Decoder).fastpathDecMapInt8BoolR) + fn(map[int16]interface{}(nil), (*Encoder).fastpathEncMapInt16IntfR, (*Decoder).fastpathDecMapInt16IntfR) + fn(map[int16]string(nil), (*Encoder).fastpathEncMapInt16StringR, (*Decoder).fastpathDecMapInt16StringR) + fn(map[int16]uint(nil), (*Encoder).fastpathEncMapInt16UintR, (*Decoder).fastpathDecMapInt16UintR) + fn(map[int16]uint8(nil), (*Encoder).fastpathEncMapInt16Uint8R, (*Decoder).fastpathDecMapInt16Uint8R) + fn(map[int16]uint16(nil), (*Encoder).fastpathEncMapInt16Uint16R, (*Decoder).fastpathDecMapInt16Uint16R) + fn(map[int16]uint32(nil), (*Encoder).fastpathEncMapInt16Uint32R, (*Decoder).fastpathDecMapInt16Uint32R) + fn(map[int16]uint64(nil), (*Encoder).fastpathEncMapInt16Uint64R, (*Decoder).fastpathDecMapInt16Uint64R) + fn(map[int16]uintptr(nil), (*Encoder).fastpathEncMapInt16UintptrR, (*Decoder).fastpathDecMapInt16UintptrR) + fn(map[int16]int(nil), (*Encoder).fastpathEncMapInt16IntR, (*Decoder).fastpathDecMapInt16IntR) + fn(map[int16]int8(nil), (*Encoder).fastpathEncMapInt16Int8R, (*Decoder).fastpathDecMapInt16Int8R) + fn(map[int16]int16(nil), (*Encoder).fastpathEncMapInt16Int16R, (*Decoder).fastpathDecMapInt16Int16R) + fn(map[int16]int32(nil), (*Encoder).fastpathEncMapInt16Int32R, (*Decoder).fastpathDecMapInt16Int32R) + fn(map[int16]int64(nil), (*Encoder).fastpathEncMapInt16Int64R, (*Decoder).fastpathDecMapInt16Int64R) + fn(map[int16]float32(nil), (*Encoder).fastpathEncMapInt16Float32R, (*Decoder).fastpathDecMapInt16Float32R) + fn(map[int16]float64(nil), (*Encoder).fastpathEncMapInt16Float64R, (*Decoder).fastpathDecMapInt16Float64R) + fn(map[int16]bool(nil), (*Encoder).fastpathEncMapInt16BoolR, (*Decoder).fastpathDecMapInt16BoolR) + fn(map[int32]interface{}(nil), (*Encoder).fastpathEncMapInt32IntfR, (*Decoder).fastpathDecMapInt32IntfR) + fn(map[int32]string(nil), (*Encoder).fastpathEncMapInt32StringR, (*Decoder).fastpathDecMapInt32StringR) + fn(map[int32]uint(nil), (*Encoder).fastpathEncMapInt32UintR, (*Decoder).fastpathDecMapInt32UintR) + fn(map[int32]uint8(nil), (*Encoder).fastpathEncMapInt32Uint8R, (*Decoder).fastpathDecMapInt32Uint8R) + fn(map[int32]uint16(nil), (*Encoder).fastpathEncMapInt32Uint16R, (*Decoder).fastpathDecMapInt32Uint16R) + fn(map[int32]uint32(nil), (*Encoder).fastpathEncMapInt32Uint32R, (*Decoder).fastpathDecMapInt32Uint32R) + fn(map[int32]uint64(nil), (*Encoder).fastpathEncMapInt32Uint64R, (*Decoder).fastpathDecMapInt32Uint64R) + fn(map[int32]uintptr(nil), (*Encoder).fastpathEncMapInt32UintptrR, (*Decoder).fastpathDecMapInt32UintptrR) + fn(map[int32]int(nil), (*Encoder).fastpathEncMapInt32IntR, (*Decoder).fastpathDecMapInt32IntR) + fn(map[int32]int8(nil), (*Encoder).fastpathEncMapInt32Int8R, (*Decoder).fastpathDecMapInt32Int8R) + fn(map[int32]int16(nil), (*Encoder).fastpathEncMapInt32Int16R, (*Decoder).fastpathDecMapInt32Int16R) + fn(map[int32]int32(nil), (*Encoder).fastpathEncMapInt32Int32R, (*Decoder).fastpathDecMapInt32Int32R) + fn(map[int32]int64(nil), (*Encoder).fastpathEncMapInt32Int64R, (*Decoder).fastpathDecMapInt32Int64R) + fn(map[int32]float32(nil), (*Encoder).fastpathEncMapInt32Float32R, (*Decoder).fastpathDecMapInt32Float32R) + fn(map[int32]float64(nil), (*Encoder).fastpathEncMapInt32Float64R, (*Decoder).fastpathDecMapInt32Float64R) + fn(map[int32]bool(nil), (*Encoder).fastpathEncMapInt32BoolR, (*Decoder).fastpathDecMapInt32BoolR) + fn(map[int64]interface{}(nil), (*Encoder).fastpathEncMapInt64IntfR, (*Decoder).fastpathDecMapInt64IntfR) + fn(map[int64]string(nil), (*Encoder).fastpathEncMapInt64StringR, (*Decoder).fastpathDecMapInt64StringR) + fn(map[int64]uint(nil), (*Encoder).fastpathEncMapInt64UintR, (*Decoder).fastpathDecMapInt64UintR) + fn(map[int64]uint8(nil), (*Encoder).fastpathEncMapInt64Uint8R, (*Decoder).fastpathDecMapInt64Uint8R) + fn(map[int64]uint16(nil), (*Encoder).fastpathEncMapInt64Uint16R, (*Decoder).fastpathDecMapInt64Uint16R) + fn(map[int64]uint32(nil), (*Encoder).fastpathEncMapInt64Uint32R, (*Decoder).fastpathDecMapInt64Uint32R) + fn(map[int64]uint64(nil), (*Encoder).fastpathEncMapInt64Uint64R, (*Decoder).fastpathDecMapInt64Uint64R) + fn(map[int64]uintptr(nil), (*Encoder).fastpathEncMapInt64UintptrR, (*Decoder).fastpathDecMapInt64UintptrR) + fn(map[int64]int(nil), (*Encoder).fastpathEncMapInt64IntR, (*Decoder).fastpathDecMapInt64IntR) + fn(map[int64]int8(nil), (*Encoder).fastpathEncMapInt64Int8R, (*Decoder).fastpathDecMapInt64Int8R) + fn(map[int64]int16(nil), (*Encoder).fastpathEncMapInt64Int16R, (*Decoder).fastpathDecMapInt64Int16R) + fn(map[int64]int32(nil), (*Encoder).fastpathEncMapInt64Int32R, (*Decoder).fastpathDecMapInt64Int32R) + fn(map[int64]int64(nil), (*Encoder).fastpathEncMapInt64Int64R, (*Decoder).fastpathDecMapInt64Int64R) + fn(map[int64]float32(nil), (*Encoder).fastpathEncMapInt64Float32R, (*Decoder).fastpathDecMapInt64Float32R) + fn(map[int64]float64(nil), (*Encoder).fastpathEncMapInt64Float64R, (*Decoder).fastpathDecMapInt64Float64R) + fn(map[int64]bool(nil), (*Encoder).fastpathEncMapInt64BoolR, (*Decoder).fastpathDecMapInt64BoolR) + fn(map[bool]interface{}(nil), (*Encoder).fastpathEncMapBoolIntfR, (*Decoder).fastpathDecMapBoolIntfR) + fn(map[bool]string(nil), (*Encoder).fastpathEncMapBoolStringR, (*Decoder).fastpathDecMapBoolStringR) + fn(map[bool]uint(nil), (*Encoder).fastpathEncMapBoolUintR, (*Decoder).fastpathDecMapBoolUintR) + fn(map[bool]uint8(nil), (*Encoder).fastpathEncMapBoolUint8R, (*Decoder).fastpathDecMapBoolUint8R) + fn(map[bool]uint16(nil), (*Encoder).fastpathEncMapBoolUint16R, (*Decoder).fastpathDecMapBoolUint16R) + fn(map[bool]uint32(nil), (*Encoder).fastpathEncMapBoolUint32R, (*Decoder).fastpathDecMapBoolUint32R) + fn(map[bool]uint64(nil), (*Encoder).fastpathEncMapBoolUint64R, (*Decoder).fastpathDecMapBoolUint64R) + fn(map[bool]uintptr(nil), (*Encoder).fastpathEncMapBoolUintptrR, (*Decoder).fastpathDecMapBoolUintptrR) + fn(map[bool]int(nil), (*Encoder).fastpathEncMapBoolIntR, (*Decoder).fastpathDecMapBoolIntR) + fn(map[bool]int8(nil), (*Encoder).fastpathEncMapBoolInt8R, (*Decoder).fastpathDecMapBoolInt8R) + fn(map[bool]int16(nil), (*Encoder).fastpathEncMapBoolInt16R, (*Decoder).fastpathDecMapBoolInt16R) + fn(map[bool]int32(nil), (*Encoder).fastpathEncMapBoolInt32R, (*Decoder).fastpathDecMapBoolInt32R) + fn(map[bool]int64(nil), (*Encoder).fastpathEncMapBoolInt64R, (*Decoder).fastpathDecMapBoolInt64R) + fn(map[bool]float32(nil), (*Encoder).fastpathEncMapBoolFloat32R, (*Decoder).fastpathDecMapBoolFloat32R) + fn(map[bool]float64(nil), (*Encoder).fastpathEncMapBoolFloat64R, (*Decoder).fastpathDecMapBoolFloat64R) + fn(map[bool]bool(nil), (*Encoder).fastpathEncMapBoolBoolR, (*Decoder).fastpathDecMapBoolBoolR) sort.Sort(fastpathAslice(fastpathAV[:])) } @@ -375,2737 +371,1093 @@ func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { switch v := iv.(type) { case []interface{}: - fastpathTV.EncSliceIntfV(v, fastpathCheckNilTrue, e) + fastpathTV.EncSliceIntfV(v, e) case *[]interface{}: - fastpathTV.EncSliceIntfV(*v, fastpathCheckNilTrue, e) + fastpathTV.EncSliceIntfV(*v, e) + case []string: + fastpathTV.EncSliceStringV(v, e) + case *[]string: + fastpathTV.EncSliceStringV(*v, e) + case []float32: + fastpathTV.EncSliceFloat32V(v, e) + case *[]float32: + fastpathTV.EncSliceFloat32V(*v, e) + case []float64: + fastpathTV.EncSliceFloat64V(v, e) + case *[]float64: + fastpathTV.EncSliceFloat64V(*v, e) + case []uint: + fastpathTV.EncSliceUintV(v, e) + case *[]uint: + fastpathTV.EncSliceUintV(*v, e) + case []uint16: + fastpathTV.EncSliceUint16V(v, e) + case *[]uint16: + fastpathTV.EncSliceUint16V(*v, e) + case []uint32: + fastpathTV.EncSliceUint32V(v, e) + case *[]uint32: + fastpathTV.EncSliceUint32V(*v, e) + case []uint64: + fastpathTV.EncSliceUint64V(v, e) + case *[]uint64: + fastpathTV.EncSliceUint64V(*v, e) + case []uintptr: + fastpathTV.EncSliceUintptrV(v, e) + case *[]uintptr: + fastpathTV.EncSliceUintptrV(*v, e) + case []int: + fastpathTV.EncSliceIntV(v, e) + case *[]int: + fastpathTV.EncSliceIntV(*v, e) + case []int8: + fastpathTV.EncSliceInt8V(v, e) + case *[]int8: + fastpathTV.EncSliceInt8V(*v, e) + case []int16: + fastpathTV.EncSliceInt16V(v, e) + case *[]int16: + fastpathTV.EncSliceInt16V(*v, e) + case []int32: + fastpathTV.EncSliceInt32V(v, e) + case *[]int32: + fastpathTV.EncSliceInt32V(*v, e) + case []int64: + fastpathTV.EncSliceInt64V(v, e) + case *[]int64: + fastpathTV.EncSliceInt64V(*v, e) + case []bool: + fastpathTV.EncSliceBoolV(v, e) + case *[]bool: + fastpathTV.EncSliceBoolV(*v, e) case map[interface{}]interface{}: - fastpathTV.EncMapIntfIntfV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntfIntfV(v, e) case *map[interface{}]interface{}: - fastpathTV.EncMapIntfIntfV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntfIntfV(*v, e) case map[interface{}]string: - fastpathTV.EncMapIntfStringV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntfStringV(v, e) case *map[interface{}]string: - fastpathTV.EncMapIntfStringV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntfStringV(*v, e) case map[interface{}]uint: - fastpathTV.EncMapIntfUintV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntfUintV(v, e) case *map[interface{}]uint: - fastpathTV.EncMapIntfUintV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntfUintV(*v, e) case map[interface{}]uint8: - fastpathTV.EncMapIntfUint8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntfUint8V(v, e) case *map[interface{}]uint8: - fastpathTV.EncMapIntfUint8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntfUint8V(*v, e) case map[interface{}]uint16: - fastpathTV.EncMapIntfUint16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntfUint16V(v, e) case *map[interface{}]uint16: - fastpathTV.EncMapIntfUint16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntfUint16V(*v, e) case map[interface{}]uint32: - fastpathTV.EncMapIntfUint32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntfUint32V(v, e) case *map[interface{}]uint32: - fastpathTV.EncMapIntfUint32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntfUint32V(*v, e) case map[interface{}]uint64: - fastpathTV.EncMapIntfUint64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntfUint64V(v, e) case *map[interface{}]uint64: - fastpathTV.EncMapIntfUint64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntfUint64V(*v, e) case map[interface{}]uintptr: - fastpathTV.EncMapIntfUintptrV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntfUintptrV(v, e) case *map[interface{}]uintptr: - fastpathTV.EncMapIntfUintptrV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntfUintptrV(*v, e) case map[interface{}]int: - fastpathTV.EncMapIntfIntV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntfIntV(v, e) case *map[interface{}]int: - fastpathTV.EncMapIntfIntV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntfIntV(*v, e) case map[interface{}]int8: - fastpathTV.EncMapIntfInt8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntfInt8V(v, e) case *map[interface{}]int8: - fastpathTV.EncMapIntfInt8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntfInt8V(*v, e) case map[interface{}]int16: - fastpathTV.EncMapIntfInt16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntfInt16V(v, e) case *map[interface{}]int16: - fastpathTV.EncMapIntfInt16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntfInt16V(*v, e) case map[interface{}]int32: - fastpathTV.EncMapIntfInt32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntfInt32V(v, e) case *map[interface{}]int32: - fastpathTV.EncMapIntfInt32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntfInt32V(*v, e) case map[interface{}]int64: - fastpathTV.EncMapIntfInt64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntfInt64V(v, e) case *map[interface{}]int64: - fastpathTV.EncMapIntfInt64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntfInt64V(*v, e) case map[interface{}]float32: - fastpathTV.EncMapIntfFloat32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntfFloat32V(v, e) case *map[interface{}]float32: - fastpathTV.EncMapIntfFloat32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntfFloat32V(*v, e) case map[interface{}]float64: - fastpathTV.EncMapIntfFloat64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntfFloat64V(v, e) case *map[interface{}]float64: - fastpathTV.EncMapIntfFloat64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntfFloat64V(*v, e) case map[interface{}]bool: - fastpathTV.EncMapIntfBoolV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntfBoolV(v, e) case *map[interface{}]bool: - fastpathTV.EncMapIntfBoolV(*v, fastpathCheckNilTrue, e) - - case []string: - fastpathTV.EncSliceStringV(v, fastpathCheckNilTrue, e) - case *[]string: - fastpathTV.EncSliceStringV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntfBoolV(*v, e) case map[string]interface{}: - fastpathTV.EncMapStringIntfV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapStringIntfV(v, e) case *map[string]interface{}: - fastpathTV.EncMapStringIntfV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapStringIntfV(*v, e) case map[string]string: - fastpathTV.EncMapStringStringV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapStringStringV(v, e) case *map[string]string: - fastpathTV.EncMapStringStringV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapStringStringV(*v, e) case map[string]uint: - fastpathTV.EncMapStringUintV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapStringUintV(v, e) case *map[string]uint: - fastpathTV.EncMapStringUintV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapStringUintV(*v, e) case map[string]uint8: - fastpathTV.EncMapStringUint8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapStringUint8V(v, e) case *map[string]uint8: - fastpathTV.EncMapStringUint8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapStringUint8V(*v, e) case map[string]uint16: - fastpathTV.EncMapStringUint16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapStringUint16V(v, e) case *map[string]uint16: - fastpathTV.EncMapStringUint16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapStringUint16V(*v, e) case map[string]uint32: - fastpathTV.EncMapStringUint32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapStringUint32V(v, e) case *map[string]uint32: - fastpathTV.EncMapStringUint32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapStringUint32V(*v, e) case map[string]uint64: - fastpathTV.EncMapStringUint64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapStringUint64V(v, e) case *map[string]uint64: - fastpathTV.EncMapStringUint64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapStringUint64V(*v, e) case map[string]uintptr: - fastpathTV.EncMapStringUintptrV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapStringUintptrV(v, e) case *map[string]uintptr: - fastpathTV.EncMapStringUintptrV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapStringUintptrV(*v, e) case map[string]int: - fastpathTV.EncMapStringIntV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapStringIntV(v, e) case *map[string]int: - fastpathTV.EncMapStringIntV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapStringIntV(*v, e) case map[string]int8: - fastpathTV.EncMapStringInt8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapStringInt8V(v, e) case *map[string]int8: - fastpathTV.EncMapStringInt8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapStringInt8V(*v, e) case map[string]int16: - fastpathTV.EncMapStringInt16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapStringInt16V(v, e) case *map[string]int16: - fastpathTV.EncMapStringInt16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapStringInt16V(*v, e) case map[string]int32: - fastpathTV.EncMapStringInt32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapStringInt32V(v, e) case *map[string]int32: - fastpathTV.EncMapStringInt32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapStringInt32V(*v, e) case map[string]int64: - fastpathTV.EncMapStringInt64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapStringInt64V(v, e) case *map[string]int64: - fastpathTV.EncMapStringInt64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapStringInt64V(*v, e) case map[string]float32: - fastpathTV.EncMapStringFloat32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapStringFloat32V(v, e) case *map[string]float32: - fastpathTV.EncMapStringFloat32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapStringFloat32V(*v, e) case map[string]float64: - fastpathTV.EncMapStringFloat64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapStringFloat64V(v, e) case *map[string]float64: - fastpathTV.EncMapStringFloat64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapStringFloat64V(*v, e) case map[string]bool: - fastpathTV.EncMapStringBoolV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapStringBoolV(v, e) case *map[string]bool: - fastpathTV.EncMapStringBoolV(*v, fastpathCheckNilTrue, e) - - case []float32: - fastpathTV.EncSliceFloat32V(v, fastpathCheckNilTrue, e) - case *[]float32: - fastpathTV.EncSliceFloat32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapStringBoolV(*v, e) case map[float32]interface{}: - fastpathTV.EncMapFloat32IntfV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat32IntfV(v, e) case *map[float32]interface{}: - fastpathTV.EncMapFloat32IntfV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat32IntfV(*v, e) case map[float32]string: - fastpathTV.EncMapFloat32StringV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat32StringV(v, e) case *map[float32]string: - fastpathTV.EncMapFloat32StringV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat32StringV(*v, e) case map[float32]uint: - fastpathTV.EncMapFloat32UintV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat32UintV(v, e) case *map[float32]uint: - fastpathTV.EncMapFloat32UintV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat32UintV(*v, e) case map[float32]uint8: - fastpathTV.EncMapFloat32Uint8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat32Uint8V(v, e) case *map[float32]uint8: - fastpathTV.EncMapFloat32Uint8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat32Uint8V(*v, e) case map[float32]uint16: - fastpathTV.EncMapFloat32Uint16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat32Uint16V(v, e) case *map[float32]uint16: - fastpathTV.EncMapFloat32Uint16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat32Uint16V(*v, e) case map[float32]uint32: - fastpathTV.EncMapFloat32Uint32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat32Uint32V(v, e) case *map[float32]uint32: - fastpathTV.EncMapFloat32Uint32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat32Uint32V(*v, e) case map[float32]uint64: - fastpathTV.EncMapFloat32Uint64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat32Uint64V(v, e) case *map[float32]uint64: - fastpathTV.EncMapFloat32Uint64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat32Uint64V(*v, e) case map[float32]uintptr: - fastpathTV.EncMapFloat32UintptrV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat32UintptrV(v, e) case *map[float32]uintptr: - fastpathTV.EncMapFloat32UintptrV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat32UintptrV(*v, e) case map[float32]int: - fastpathTV.EncMapFloat32IntV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat32IntV(v, e) case *map[float32]int: - fastpathTV.EncMapFloat32IntV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat32IntV(*v, e) case map[float32]int8: - fastpathTV.EncMapFloat32Int8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat32Int8V(v, e) case *map[float32]int8: - fastpathTV.EncMapFloat32Int8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat32Int8V(*v, e) case map[float32]int16: - fastpathTV.EncMapFloat32Int16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat32Int16V(v, e) case *map[float32]int16: - fastpathTV.EncMapFloat32Int16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat32Int16V(*v, e) case map[float32]int32: - fastpathTV.EncMapFloat32Int32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat32Int32V(v, e) case *map[float32]int32: - fastpathTV.EncMapFloat32Int32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat32Int32V(*v, e) case map[float32]int64: - fastpathTV.EncMapFloat32Int64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat32Int64V(v, e) case *map[float32]int64: - fastpathTV.EncMapFloat32Int64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat32Int64V(*v, e) case map[float32]float32: - fastpathTV.EncMapFloat32Float32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat32Float32V(v, e) case *map[float32]float32: - fastpathTV.EncMapFloat32Float32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat32Float32V(*v, e) case map[float32]float64: - fastpathTV.EncMapFloat32Float64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat32Float64V(v, e) case *map[float32]float64: - fastpathTV.EncMapFloat32Float64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat32Float64V(*v, e) case map[float32]bool: - fastpathTV.EncMapFloat32BoolV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat32BoolV(v, e) case *map[float32]bool: - fastpathTV.EncMapFloat32BoolV(*v, fastpathCheckNilTrue, e) - - case []float64: - fastpathTV.EncSliceFloat64V(v, fastpathCheckNilTrue, e) - case *[]float64: - fastpathTV.EncSliceFloat64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat32BoolV(*v, e) case map[float64]interface{}: - fastpathTV.EncMapFloat64IntfV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat64IntfV(v, e) case *map[float64]interface{}: - fastpathTV.EncMapFloat64IntfV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat64IntfV(*v, e) case map[float64]string: - fastpathTV.EncMapFloat64StringV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat64StringV(v, e) case *map[float64]string: - fastpathTV.EncMapFloat64StringV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat64StringV(*v, e) case map[float64]uint: - fastpathTV.EncMapFloat64UintV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat64UintV(v, e) case *map[float64]uint: - fastpathTV.EncMapFloat64UintV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat64UintV(*v, e) case map[float64]uint8: - fastpathTV.EncMapFloat64Uint8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat64Uint8V(v, e) case *map[float64]uint8: - fastpathTV.EncMapFloat64Uint8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat64Uint8V(*v, e) case map[float64]uint16: - fastpathTV.EncMapFloat64Uint16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat64Uint16V(v, e) case *map[float64]uint16: - fastpathTV.EncMapFloat64Uint16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat64Uint16V(*v, e) case map[float64]uint32: - fastpathTV.EncMapFloat64Uint32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat64Uint32V(v, e) case *map[float64]uint32: - fastpathTV.EncMapFloat64Uint32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat64Uint32V(*v, e) case map[float64]uint64: - fastpathTV.EncMapFloat64Uint64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat64Uint64V(v, e) case *map[float64]uint64: - fastpathTV.EncMapFloat64Uint64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat64Uint64V(*v, e) case map[float64]uintptr: - fastpathTV.EncMapFloat64UintptrV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat64UintptrV(v, e) case *map[float64]uintptr: - fastpathTV.EncMapFloat64UintptrV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat64UintptrV(*v, e) case map[float64]int: - fastpathTV.EncMapFloat64IntV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat64IntV(v, e) case *map[float64]int: - fastpathTV.EncMapFloat64IntV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat64IntV(*v, e) case map[float64]int8: - fastpathTV.EncMapFloat64Int8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat64Int8V(v, e) case *map[float64]int8: - fastpathTV.EncMapFloat64Int8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat64Int8V(*v, e) case map[float64]int16: - fastpathTV.EncMapFloat64Int16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat64Int16V(v, e) case *map[float64]int16: - fastpathTV.EncMapFloat64Int16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat64Int16V(*v, e) case map[float64]int32: - fastpathTV.EncMapFloat64Int32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat64Int32V(v, e) case *map[float64]int32: - fastpathTV.EncMapFloat64Int32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat64Int32V(*v, e) case map[float64]int64: - fastpathTV.EncMapFloat64Int64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat64Int64V(v, e) case *map[float64]int64: - fastpathTV.EncMapFloat64Int64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat64Int64V(*v, e) case map[float64]float32: - fastpathTV.EncMapFloat64Float32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat64Float32V(v, e) case *map[float64]float32: - fastpathTV.EncMapFloat64Float32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat64Float32V(*v, e) case map[float64]float64: - fastpathTV.EncMapFloat64Float64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat64Float64V(v, e) case *map[float64]float64: - fastpathTV.EncMapFloat64Float64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat64Float64V(*v, e) case map[float64]bool: - fastpathTV.EncMapFloat64BoolV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapFloat64BoolV(v, e) case *map[float64]bool: - fastpathTV.EncMapFloat64BoolV(*v, fastpathCheckNilTrue, e) - - case []uint: - fastpathTV.EncSliceUintV(v, fastpathCheckNilTrue, e) - case *[]uint: - fastpathTV.EncSliceUintV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapFloat64BoolV(*v, e) case map[uint]interface{}: - fastpathTV.EncMapUintIntfV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintIntfV(v, e) case *map[uint]interface{}: - fastpathTV.EncMapUintIntfV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintIntfV(*v, e) case map[uint]string: - fastpathTV.EncMapUintStringV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintStringV(v, e) case *map[uint]string: - fastpathTV.EncMapUintStringV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintStringV(*v, e) case map[uint]uint: - fastpathTV.EncMapUintUintV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintUintV(v, e) case *map[uint]uint: - fastpathTV.EncMapUintUintV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintUintV(*v, e) case map[uint]uint8: - fastpathTV.EncMapUintUint8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintUint8V(v, e) case *map[uint]uint8: - fastpathTV.EncMapUintUint8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintUint8V(*v, e) case map[uint]uint16: - fastpathTV.EncMapUintUint16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintUint16V(v, e) case *map[uint]uint16: - fastpathTV.EncMapUintUint16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintUint16V(*v, e) case map[uint]uint32: - fastpathTV.EncMapUintUint32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintUint32V(v, e) case *map[uint]uint32: - fastpathTV.EncMapUintUint32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintUint32V(*v, e) case map[uint]uint64: - fastpathTV.EncMapUintUint64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintUint64V(v, e) case *map[uint]uint64: - fastpathTV.EncMapUintUint64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintUint64V(*v, e) case map[uint]uintptr: - fastpathTV.EncMapUintUintptrV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintUintptrV(v, e) case *map[uint]uintptr: - fastpathTV.EncMapUintUintptrV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintUintptrV(*v, e) case map[uint]int: - fastpathTV.EncMapUintIntV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintIntV(v, e) case *map[uint]int: - fastpathTV.EncMapUintIntV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintIntV(*v, e) case map[uint]int8: - fastpathTV.EncMapUintInt8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintInt8V(v, e) case *map[uint]int8: - fastpathTV.EncMapUintInt8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintInt8V(*v, e) case map[uint]int16: - fastpathTV.EncMapUintInt16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintInt16V(v, e) case *map[uint]int16: - fastpathTV.EncMapUintInt16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintInt16V(*v, e) case map[uint]int32: - fastpathTV.EncMapUintInt32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintInt32V(v, e) case *map[uint]int32: - fastpathTV.EncMapUintInt32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintInt32V(*v, e) case map[uint]int64: - fastpathTV.EncMapUintInt64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintInt64V(v, e) case *map[uint]int64: - fastpathTV.EncMapUintInt64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintInt64V(*v, e) case map[uint]float32: - fastpathTV.EncMapUintFloat32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintFloat32V(v, e) case *map[uint]float32: - fastpathTV.EncMapUintFloat32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintFloat32V(*v, e) case map[uint]float64: - fastpathTV.EncMapUintFloat64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintFloat64V(v, e) case *map[uint]float64: - fastpathTV.EncMapUintFloat64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintFloat64V(*v, e) case map[uint]bool: - fastpathTV.EncMapUintBoolV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintBoolV(v, e) case *map[uint]bool: - fastpathTV.EncMapUintBoolV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintBoolV(*v, e) case map[uint8]interface{}: - fastpathTV.EncMapUint8IntfV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint8IntfV(v, e) case *map[uint8]interface{}: - fastpathTV.EncMapUint8IntfV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint8IntfV(*v, e) case map[uint8]string: - fastpathTV.EncMapUint8StringV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint8StringV(v, e) case *map[uint8]string: - fastpathTV.EncMapUint8StringV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint8StringV(*v, e) case map[uint8]uint: - fastpathTV.EncMapUint8UintV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint8UintV(v, e) case *map[uint8]uint: - fastpathTV.EncMapUint8UintV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint8UintV(*v, e) case map[uint8]uint8: - fastpathTV.EncMapUint8Uint8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint8Uint8V(v, e) case *map[uint8]uint8: - fastpathTV.EncMapUint8Uint8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint8Uint8V(*v, e) case map[uint8]uint16: - fastpathTV.EncMapUint8Uint16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint8Uint16V(v, e) case *map[uint8]uint16: - fastpathTV.EncMapUint8Uint16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint8Uint16V(*v, e) case map[uint8]uint32: - fastpathTV.EncMapUint8Uint32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint8Uint32V(v, e) case *map[uint8]uint32: - fastpathTV.EncMapUint8Uint32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint8Uint32V(*v, e) case map[uint8]uint64: - fastpathTV.EncMapUint8Uint64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint8Uint64V(v, e) case *map[uint8]uint64: - fastpathTV.EncMapUint8Uint64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint8Uint64V(*v, e) case map[uint8]uintptr: - fastpathTV.EncMapUint8UintptrV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint8UintptrV(v, e) case *map[uint8]uintptr: - fastpathTV.EncMapUint8UintptrV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint8UintptrV(*v, e) case map[uint8]int: - fastpathTV.EncMapUint8IntV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint8IntV(v, e) case *map[uint8]int: - fastpathTV.EncMapUint8IntV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint8IntV(*v, e) case map[uint8]int8: - fastpathTV.EncMapUint8Int8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint8Int8V(v, e) case *map[uint8]int8: - fastpathTV.EncMapUint8Int8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint8Int8V(*v, e) case map[uint8]int16: - fastpathTV.EncMapUint8Int16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint8Int16V(v, e) case *map[uint8]int16: - fastpathTV.EncMapUint8Int16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint8Int16V(*v, e) case map[uint8]int32: - fastpathTV.EncMapUint8Int32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint8Int32V(v, e) case *map[uint8]int32: - fastpathTV.EncMapUint8Int32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint8Int32V(*v, e) case map[uint8]int64: - fastpathTV.EncMapUint8Int64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint8Int64V(v, e) case *map[uint8]int64: - fastpathTV.EncMapUint8Int64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint8Int64V(*v, e) case map[uint8]float32: - fastpathTV.EncMapUint8Float32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint8Float32V(v, e) case *map[uint8]float32: - fastpathTV.EncMapUint8Float32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint8Float32V(*v, e) case map[uint8]float64: - fastpathTV.EncMapUint8Float64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint8Float64V(v, e) case *map[uint8]float64: - fastpathTV.EncMapUint8Float64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint8Float64V(*v, e) case map[uint8]bool: - fastpathTV.EncMapUint8BoolV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint8BoolV(v, e) case *map[uint8]bool: - fastpathTV.EncMapUint8BoolV(*v, fastpathCheckNilTrue, e) - - case []uint16: - fastpathTV.EncSliceUint16V(v, fastpathCheckNilTrue, e) - case *[]uint16: - fastpathTV.EncSliceUint16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint8BoolV(*v, e) case map[uint16]interface{}: - fastpathTV.EncMapUint16IntfV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint16IntfV(v, e) case *map[uint16]interface{}: - fastpathTV.EncMapUint16IntfV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint16IntfV(*v, e) case map[uint16]string: - fastpathTV.EncMapUint16StringV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint16StringV(v, e) case *map[uint16]string: - fastpathTV.EncMapUint16StringV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint16StringV(*v, e) case map[uint16]uint: - fastpathTV.EncMapUint16UintV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint16UintV(v, e) case *map[uint16]uint: - fastpathTV.EncMapUint16UintV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint16UintV(*v, e) case map[uint16]uint8: - fastpathTV.EncMapUint16Uint8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint16Uint8V(v, e) case *map[uint16]uint8: - fastpathTV.EncMapUint16Uint8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint16Uint8V(*v, e) case map[uint16]uint16: - fastpathTV.EncMapUint16Uint16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint16Uint16V(v, e) case *map[uint16]uint16: - fastpathTV.EncMapUint16Uint16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint16Uint16V(*v, e) case map[uint16]uint32: - fastpathTV.EncMapUint16Uint32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint16Uint32V(v, e) case *map[uint16]uint32: - fastpathTV.EncMapUint16Uint32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint16Uint32V(*v, e) case map[uint16]uint64: - fastpathTV.EncMapUint16Uint64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint16Uint64V(v, e) case *map[uint16]uint64: - fastpathTV.EncMapUint16Uint64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint16Uint64V(*v, e) case map[uint16]uintptr: - fastpathTV.EncMapUint16UintptrV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint16UintptrV(v, e) case *map[uint16]uintptr: - fastpathTV.EncMapUint16UintptrV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint16UintptrV(*v, e) case map[uint16]int: - fastpathTV.EncMapUint16IntV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint16IntV(v, e) case *map[uint16]int: - fastpathTV.EncMapUint16IntV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint16IntV(*v, e) case map[uint16]int8: - fastpathTV.EncMapUint16Int8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint16Int8V(v, e) case *map[uint16]int8: - fastpathTV.EncMapUint16Int8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint16Int8V(*v, e) case map[uint16]int16: - fastpathTV.EncMapUint16Int16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint16Int16V(v, e) case *map[uint16]int16: - fastpathTV.EncMapUint16Int16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint16Int16V(*v, e) case map[uint16]int32: - fastpathTV.EncMapUint16Int32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint16Int32V(v, e) case *map[uint16]int32: - fastpathTV.EncMapUint16Int32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint16Int32V(*v, e) case map[uint16]int64: - fastpathTV.EncMapUint16Int64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint16Int64V(v, e) case *map[uint16]int64: - fastpathTV.EncMapUint16Int64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint16Int64V(*v, e) case map[uint16]float32: - fastpathTV.EncMapUint16Float32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint16Float32V(v, e) case *map[uint16]float32: - fastpathTV.EncMapUint16Float32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint16Float32V(*v, e) case map[uint16]float64: - fastpathTV.EncMapUint16Float64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint16Float64V(v, e) case *map[uint16]float64: - fastpathTV.EncMapUint16Float64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint16Float64V(*v, e) case map[uint16]bool: - fastpathTV.EncMapUint16BoolV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint16BoolV(v, e) case *map[uint16]bool: - fastpathTV.EncMapUint16BoolV(*v, fastpathCheckNilTrue, e) - - case []uint32: - fastpathTV.EncSliceUint32V(v, fastpathCheckNilTrue, e) - case *[]uint32: - fastpathTV.EncSliceUint32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint16BoolV(*v, e) case map[uint32]interface{}: - fastpathTV.EncMapUint32IntfV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint32IntfV(v, e) case *map[uint32]interface{}: - fastpathTV.EncMapUint32IntfV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint32IntfV(*v, e) case map[uint32]string: - fastpathTV.EncMapUint32StringV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint32StringV(v, e) case *map[uint32]string: - fastpathTV.EncMapUint32StringV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint32StringV(*v, e) case map[uint32]uint: - fastpathTV.EncMapUint32UintV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint32UintV(v, e) case *map[uint32]uint: - fastpathTV.EncMapUint32UintV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint32UintV(*v, e) case map[uint32]uint8: - fastpathTV.EncMapUint32Uint8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint32Uint8V(v, e) case *map[uint32]uint8: - fastpathTV.EncMapUint32Uint8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint32Uint8V(*v, e) case map[uint32]uint16: - fastpathTV.EncMapUint32Uint16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint32Uint16V(v, e) case *map[uint32]uint16: - fastpathTV.EncMapUint32Uint16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint32Uint16V(*v, e) case map[uint32]uint32: - fastpathTV.EncMapUint32Uint32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint32Uint32V(v, e) case *map[uint32]uint32: - fastpathTV.EncMapUint32Uint32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint32Uint32V(*v, e) case map[uint32]uint64: - fastpathTV.EncMapUint32Uint64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint32Uint64V(v, e) case *map[uint32]uint64: - fastpathTV.EncMapUint32Uint64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint32Uint64V(*v, e) case map[uint32]uintptr: - fastpathTV.EncMapUint32UintptrV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint32UintptrV(v, e) case *map[uint32]uintptr: - fastpathTV.EncMapUint32UintptrV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint32UintptrV(*v, e) case map[uint32]int: - fastpathTV.EncMapUint32IntV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint32IntV(v, e) case *map[uint32]int: - fastpathTV.EncMapUint32IntV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint32IntV(*v, e) case map[uint32]int8: - fastpathTV.EncMapUint32Int8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint32Int8V(v, e) case *map[uint32]int8: - fastpathTV.EncMapUint32Int8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint32Int8V(*v, e) case map[uint32]int16: - fastpathTV.EncMapUint32Int16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint32Int16V(v, e) case *map[uint32]int16: - fastpathTV.EncMapUint32Int16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint32Int16V(*v, e) case map[uint32]int32: - fastpathTV.EncMapUint32Int32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint32Int32V(v, e) case *map[uint32]int32: - fastpathTV.EncMapUint32Int32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint32Int32V(*v, e) case map[uint32]int64: - fastpathTV.EncMapUint32Int64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint32Int64V(v, e) case *map[uint32]int64: - fastpathTV.EncMapUint32Int64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint32Int64V(*v, e) case map[uint32]float32: - fastpathTV.EncMapUint32Float32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint32Float32V(v, e) case *map[uint32]float32: - fastpathTV.EncMapUint32Float32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint32Float32V(*v, e) case map[uint32]float64: - fastpathTV.EncMapUint32Float64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint32Float64V(v, e) case *map[uint32]float64: - fastpathTV.EncMapUint32Float64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint32Float64V(*v, e) case map[uint32]bool: - fastpathTV.EncMapUint32BoolV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint32BoolV(v, e) case *map[uint32]bool: - fastpathTV.EncMapUint32BoolV(*v, fastpathCheckNilTrue, e) - - case []uint64: - fastpathTV.EncSliceUint64V(v, fastpathCheckNilTrue, e) - case *[]uint64: - fastpathTV.EncSliceUint64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint32BoolV(*v, e) case map[uint64]interface{}: - fastpathTV.EncMapUint64IntfV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint64IntfV(v, e) case *map[uint64]interface{}: - fastpathTV.EncMapUint64IntfV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint64IntfV(*v, e) case map[uint64]string: - fastpathTV.EncMapUint64StringV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint64StringV(v, e) case *map[uint64]string: - fastpathTV.EncMapUint64StringV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint64StringV(*v, e) case map[uint64]uint: - fastpathTV.EncMapUint64UintV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint64UintV(v, e) case *map[uint64]uint: - fastpathTV.EncMapUint64UintV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint64UintV(*v, e) case map[uint64]uint8: - fastpathTV.EncMapUint64Uint8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint64Uint8V(v, e) case *map[uint64]uint8: - fastpathTV.EncMapUint64Uint8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint64Uint8V(*v, e) case map[uint64]uint16: - fastpathTV.EncMapUint64Uint16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint64Uint16V(v, e) case *map[uint64]uint16: - fastpathTV.EncMapUint64Uint16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint64Uint16V(*v, e) case map[uint64]uint32: - fastpathTV.EncMapUint64Uint32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint64Uint32V(v, e) case *map[uint64]uint32: - fastpathTV.EncMapUint64Uint32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint64Uint32V(*v, e) case map[uint64]uint64: - fastpathTV.EncMapUint64Uint64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint64Uint64V(v, e) case *map[uint64]uint64: - fastpathTV.EncMapUint64Uint64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint64Uint64V(*v, e) case map[uint64]uintptr: - fastpathTV.EncMapUint64UintptrV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint64UintptrV(v, e) case *map[uint64]uintptr: - fastpathTV.EncMapUint64UintptrV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint64UintptrV(*v, e) case map[uint64]int: - fastpathTV.EncMapUint64IntV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint64IntV(v, e) case *map[uint64]int: - fastpathTV.EncMapUint64IntV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint64IntV(*v, e) case map[uint64]int8: - fastpathTV.EncMapUint64Int8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint64Int8V(v, e) case *map[uint64]int8: - fastpathTV.EncMapUint64Int8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint64Int8V(*v, e) case map[uint64]int16: - fastpathTV.EncMapUint64Int16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint64Int16V(v, e) case *map[uint64]int16: - fastpathTV.EncMapUint64Int16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint64Int16V(*v, e) case map[uint64]int32: - fastpathTV.EncMapUint64Int32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint64Int32V(v, e) case *map[uint64]int32: - fastpathTV.EncMapUint64Int32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint64Int32V(*v, e) case map[uint64]int64: - fastpathTV.EncMapUint64Int64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint64Int64V(v, e) case *map[uint64]int64: - fastpathTV.EncMapUint64Int64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint64Int64V(*v, e) case map[uint64]float32: - fastpathTV.EncMapUint64Float32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint64Float32V(v, e) case *map[uint64]float32: - fastpathTV.EncMapUint64Float32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint64Float32V(*v, e) case map[uint64]float64: - fastpathTV.EncMapUint64Float64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint64Float64V(v, e) case *map[uint64]float64: - fastpathTV.EncMapUint64Float64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint64Float64V(*v, e) case map[uint64]bool: - fastpathTV.EncMapUint64BoolV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUint64BoolV(v, e) case *map[uint64]bool: - fastpathTV.EncMapUint64BoolV(*v, fastpathCheckNilTrue, e) - - case []uintptr: - fastpathTV.EncSliceUintptrV(v, fastpathCheckNilTrue, e) - case *[]uintptr: - fastpathTV.EncSliceUintptrV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUint64BoolV(*v, e) case map[uintptr]interface{}: - fastpathTV.EncMapUintptrIntfV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintptrIntfV(v, e) case *map[uintptr]interface{}: - fastpathTV.EncMapUintptrIntfV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintptrIntfV(*v, e) case map[uintptr]string: - fastpathTV.EncMapUintptrStringV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintptrStringV(v, e) case *map[uintptr]string: - fastpathTV.EncMapUintptrStringV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintptrStringV(*v, e) case map[uintptr]uint: - fastpathTV.EncMapUintptrUintV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintptrUintV(v, e) case *map[uintptr]uint: - fastpathTV.EncMapUintptrUintV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintptrUintV(*v, e) case map[uintptr]uint8: - fastpathTV.EncMapUintptrUint8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintptrUint8V(v, e) case *map[uintptr]uint8: - fastpathTV.EncMapUintptrUint8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintptrUint8V(*v, e) case map[uintptr]uint16: - fastpathTV.EncMapUintptrUint16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintptrUint16V(v, e) case *map[uintptr]uint16: - fastpathTV.EncMapUintptrUint16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintptrUint16V(*v, e) case map[uintptr]uint32: - fastpathTV.EncMapUintptrUint32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintptrUint32V(v, e) case *map[uintptr]uint32: - fastpathTV.EncMapUintptrUint32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintptrUint32V(*v, e) case map[uintptr]uint64: - fastpathTV.EncMapUintptrUint64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintptrUint64V(v, e) case *map[uintptr]uint64: - fastpathTV.EncMapUintptrUint64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintptrUint64V(*v, e) case map[uintptr]uintptr: - fastpathTV.EncMapUintptrUintptrV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintptrUintptrV(v, e) case *map[uintptr]uintptr: - fastpathTV.EncMapUintptrUintptrV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintptrUintptrV(*v, e) case map[uintptr]int: - fastpathTV.EncMapUintptrIntV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintptrIntV(v, e) case *map[uintptr]int: - fastpathTV.EncMapUintptrIntV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintptrIntV(*v, e) case map[uintptr]int8: - fastpathTV.EncMapUintptrInt8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintptrInt8V(v, e) case *map[uintptr]int8: - fastpathTV.EncMapUintptrInt8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintptrInt8V(*v, e) case map[uintptr]int16: - fastpathTV.EncMapUintptrInt16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintptrInt16V(v, e) case *map[uintptr]int16: - fastpathTV.EncMapUintptrInt16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintptrInt16V(*v, e) case map[uintptr]int32: - fastpathTV.EncMapUintptrInt32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintptrInt32V(v, e) case *map[uintptr]int32: - fastpathTV.EncMapUintptrInt32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintptrInt32V(*v, e) case map[uintptr]int64: - fastpathTV.EncMapUintptrInt64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintptrInt64V(v, e) case *map[uintptr]int64: - fastpathTV.EncMapUintptrInt64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintptrInt64V(*v, e) case map[uintptr]float32: - fastpathTV.EncMapUintptrFloat32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintptrFloat32V(v, e) case *map[uintptr]float32: - fastpathTV.EncMapUintptrFloat32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintptrFloat32V(*v, e) case map[uintptr]float64: - fastpathTV.EncMapUintptrFloat64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintptrFloat64V(v, e) case *map[uintptr]float64: - fastpathTV.EncMapUintptrFloat64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintptrFloat64V(*v, e) case map[uintptr]bool: - fastpathTV.EncMapUintptrBoolV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapUintptrBoolV(v, e) case *map[uintptr]bool: - fastpathTV.EncMapUintptrBoolV(*v, fastpathCheckNilTrue, e) - - case []int: - fastpathTV.EncSliceIntV(v, fastpathCheckNilTrue, e) - case *[]int: - fastpathTV.EncSliceIntV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapUintptrBoolV(*v, e) case map[int]interface{}: - fastpathTV.EncMapIntIntfV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntIntfV(v, e) case *map[int]interface{}: - fastpathTV.EncMapIntIntfV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntIntfV(*v, e) case map[int]string: - fastpathTV.EncMapIntStringV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntStringV(v, e) case *map[int]string: - fastpathTV.EncMapIntStringV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntStringV(*v, e) case map[int]uint: - fastpathTV.EncMapIntUintV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntUintV(v, e) case *map[int]uint: - fastpathTV.EncMapIntUintV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntUintV(*v, e) case map[int]uint8: - fastpathTV.EncMapIntUint8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntUint8V(v, e) case *map[int]uint8: - fastpathTV.EncMapIntUint8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntUint8V(*v, e) case map[int]uint16: - fastpathTV.EncMapIntUint16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntUint16V(v, e) case *map[int]uint16: - fastpathTV.EncMapIntUint16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntUint16V(*v, e) case map[int]uint32: - fastpathTV.EncMapIntUint32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntUint32V(v, e) case *map[int]uint32: - fastpathTV.EncMapIntUint32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntUint32V(*v, e) case map[int]uint64: - fastpathTV.EncMapIntUint64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntUint64V(v, e) case *map[int]uint64: - fastpathTV.EncMapIntUint64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntUint64V(*v, e) case map[int]uintptr: - fastpathTV.EncMapIntUintptrV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntUintptrV(v, e) case *map[int]uintptr: - fastpathTV.EncMapIntUintptrV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntUintptrV(*v, e) case map[int]int: - fastpathTV.EncMapIntIntV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntIntV(v, e) case *map[int]int: - fastpathTV.EncMapIntIntV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntIntV(*v, e) case map[int]int8: - fastpathTV.EncMapIntInt8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntInt8V(v, e) case *map[int]int8: - fastpathTV.EncMapIntInt8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntInt8V(*v, e) case map[int]int16: - fastpathTV.EncMapIntInt16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntInt16V(v, e) case *map[int]int16: - fastpathTV.EncMapIntInt16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntInt16V(*v, e) case map[int]int32: - fastpathTV.EncMapIntInt32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntInt32V(v, e) case *map[int]int32: - fastpathTV.EncMapIntInt32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntInt32V(*v, e) case map[int]int64: - fastpathTV.EncMapIntInt64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntInt64V(v, e) case *map[int]int64: - fastpathTV.EncMapIntInt64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntInt64V(*v, e) case map[int]float32: - fastpathTV.EncMapIntFloat32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntFloat32V(v, e) case *map[int]float32: - fastpathTV.EncMapIntFloat32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntFloat32V(*v, e) case map[int]float64: - fastpathTV.EncMapIntFloat64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntFloat64V(v, e) case *map[int]float64: - fastpathTV.EncMapIntFloat64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntFloat64V(*v, e) case map[int]bool: - fastpathTV.EncMapIntBoolV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapIntBoolV(v, e) case *map[int]bool: - fastpathTV.EncMapIntBoolV(*v, fastpathCheckNilTrue, e) - - case []int8: - fastpathTV.EncSliceInt8V(v, fastpathCheckNilTrue, e) - case *[]int8: - fastpathTV.EncSliceInt8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapIntBoolV(*v, e) case map[int8]interface{}: - fastpathTV.EncMapInt8IntfV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt8IntfV(v, e) case *map[int8]interface{}: - fastpathTV.EncMapInt8IntfV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt8IntfV(*v, e) case map[int8]string: - fastpathTV.EncMapInt8StringV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt8StringV(v, e) case *map[int8]string: - fastpathTV.EncMapInt8StringV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt8StringV(*v, e) case map[int8]uint: - fastpathTV.EncMapInt8UintV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt8UintV(v, e) case *map[int8]uint: - fastpathTV.EncMapInt8UintV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt8UintV(*v, e) case map[int8]uint8: - fastpathTV.EncMapInt8Uint8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt8Uint8V(v, e) case *map[int8]uint8: - fastpathTV.EncMapInt8Uint8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt8Uint8V(*v, e) case map[int8]uint16: - fastpathTV.EncMapInt8Uint16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt8Uint16V(v, e) case *map[int8]uint16: - fastpathTV.EncMapInt8Uint16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt8Uint16V(*v, e) case map[int8]uint32: - fastpathTV.EncMapInt8Uint32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt8Uint32V(v, e) case *map[int8]uint32: - fastpathTV.EncMapInt8Uint32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt8Uint32V(*v, e) case map[int8]uint64: - fastpathTV.EncMapInt8Uint64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt8Uint64V(v, e) case *map[int8]uint64: - fastpathTV.EncMapInt8Uint64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt8Uint64V(*v, e) case map[int8]uintptr: - fastpathTV.EncMapInt8UintptrV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt8UintptrV(v, e) case *map[int8]uintptr: - fastpathTV.EncMapInt8UintptrV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt8UintptrV(*v, e) case map[int8]int: - fastpathTV.EncMapInt8IntV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt8IntV(v, e) case *map[int8]int: - fastpathTV.EncMapInt8IntV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt8IntV(*v, e) case map[int8]int8: - fastpathTV.EncMapInt8Int8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt8Int8V(v, e) case *map[int8]int8: - fastpathTV.EncMapInt8Int8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt8Int8V(*v, e) case map[int8]int16: - fastpathTV.EncMapInt8Int16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt8Int16V(v, e) case *map[int8]int16: - fastpathTV.EncMapInt8Int16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt8Int16V(*v, e) case map[int8]int32: - fastpathTV.EncMapInt8Int32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt8Int32V(v, e) case *map[int8]int32: - fastpathTV.EncMapInt8Int32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt8Int32V(*v, e) case map[int8]int64: - fastpathTV.EncMapInt8Int64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt8Int64V(v, e) case *map[int8]int64: - fastpathTV.EncMapInt8Int64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt8Int64V(*v, e) case map[int8]float32: - fastpathTV.EncMapInt8Float32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt8Float32V(v, e) case *map[int8]float32: - fastpathTV.EncMapInt8Float32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt8Float32V(*v, e) case map[int8]float64: - fastpathTV.EncMapInt8Float64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt8Float64V(v, e) case *map[int8]float64: - fastpathTV.EncMapInt8Float64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt8Float64V(*v, e) case map[int8]bool: - fastpathTV.EncMapInt8BoolV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt8BoolV(v, e) case *map[int8]bool: - fastpathTV.EncMapInt8BoolV(*v, fastpathCheckNilTrue, e) - - case []int16: - fastpathTV.EncSliceInt16V(v, fastpathCheckNilTrue, e) - case *[]int16: - fastpathTV.EncSliceInt16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt8BoolV(*v, e) case map[int16]interface{}: - fastpathTV.EncMapInt16IntfV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt16IntfV(v, e) case *map[int16]interface{}: - fastpathTV.EncMapInt16IntfV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt16IntfV(*v, e) case map[int16]string: - fastpathTV.EncMapInt16StringV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt16StringV(v, e) case *map[int16]string: - fastpathTV.EncMapInt16StringV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt16StringV(*v, e) case map[int16]uint: - fastpathTV.EncMapInt16UintV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt16UintV(v, e) case *map[int16]uint: - fastpathTV.EncMapInt16UintV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt16UintV(*v, e) case map[int16]uint8: - fastpathTV.EncMapInt16Uint8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt16Uint8V(v, e) case *map[int16]uint8: - fastpathTV.EncMapInt16Uint8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt16Uint8V(*v, e) case map[int16]uint16: - fastpathTV.EncMapInt16Uint16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt16Uint16V(v, e) case *map[int16]uint16: - fastpathTV.EncMapInt16Uint16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt16Uint16V(*v, e) case map[int16]uint32: - fastpathTV.EncMapInt16Uint32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt16Uint32V(v, e) case *map[int16]uint32: - fastpathTV.EncMapInt16Uint32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt16Uint32V(*v, e) case map[int16]uint64: - fastpathTV.EncMapInt16Uint64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt16Uint64V(v, e) case *map[int16]uint64: - fastpathTV.EncMapInt16Uint64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt16Uint64V(*v, e) case map[int16]uintptr: - fastpathTV.EncMapInt16UintptrV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt16UintptrV(v, e) case *map[int16]uintptr: - fastpathTV.EncMapInt16UintptrV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt16UintptrV(*v, e) case map[int16]int: - fastpathTV.EncMapInt16IntV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt16IntV(v, e) case *map[int16]int: - fastpathTV.EncMapInt16IntV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt16IntV(*v, e) case map[int16]int8: - fastpathTV.EncMapInt16Int8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt16Int8V(v, e) case *map[int16]int8: - fastpathTV.EncMapInt16Int8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt16Int8V(*v, e) case map[int16]int16: - fastpathTV.EncMapInt16Int16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt16Int16V(v, e) case *map[int16]int16: - fastpathTV.EncMapInt16Int16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt16Int16V(*v, e) case map[int16]int32: - fastpathTV.EncMapInt16Int32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt16Int32V(v, e) case *map[int16]int32: - fastpathTV.EncMapInt16Int32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt16Int32V(*v, e) case map[int16]int64: - fastpathTV.EncMapInt16Int64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt16Int64V(v, e) case *map[int16]int64: - fastpathTV.EncMapInt16Int64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt16Int64V(*v, e) case map[int16]float32: - fastpathTV.EncMapInt16Float32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt16Float32V(v, e) case *map[int16]float32: - fastpathTV.EncMapInt16Float32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt16Float32V(*v, e) case map[int16]float64: - fastpathTV.EncMapInt16Float64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt16Float64V(v, e) case *map[int16]float64: - fastpathTV.EncMapInt16Float64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt16Float64V(*v, e) case map[int16]bool: - fastpathTV.EncMapInt16BoolV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt16BoolV(v, e) case *map[int16]bool: - fastpathTV.EncMapInt16BoolV(*v, fastpathCheckNilTrue, e) - - case []int32: - fastpathTV.EncSliceInt32V(v, fastpathCheckNilTrue, e) - case *[]int32: - fastpathTV.EncSliceInt32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt16BoolV(*v, e) case map[int32]interface{}: - fastpathTV.EncMapInt32IntfV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt32IntfV(v, e) case *map[int32]interface{}: - fastpathTV.EncMapInt32IntfV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt32IntfV(*v, e) case map[int32]string: - fastpathTV.EncMapInt32StringV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt32StringV(v, e) case *map[int32]string: - fastpathTV.EncMapInt32StringV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt32StringV(*v, e) case map[int32]uint: - fastpathTV.EncMapInt32UintV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt32UintV(v, e) case *map[int32]uint: - fastpathTV.EncMapInt32UintV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt32UintV(*v, e) case map[int32]uint8: - fastpathTV.EncMapInt32Uint8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt32Uint8V(v, e) case *map[int32]uint8: - fastpathTV.EncMapInt32Uint8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt32Uint8V(*v, e) case map[int32]uint16: - fastpathTV.EncMapInt32Uint16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt32Uint16V(v, e) case *map[int32]uint16: - fastpathTV.EncMapInt32Uint16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt32Uint16V(*v, e) case map[int32]uint32: - fastpathTV.EncMapInt32Uint32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt32Uint32V(v, e) case *map[int32]uint32: - fastpathTV.EncMapInt32Uint32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt32Uint32V(*v, e) case map[int32]uint64: - fastpathTV.EncMapInt32Uint64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt32Uint64V(v, e) case *map[int32]uint64: - fastpathTV.EncMapInt32Uint64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt32Uint64V(*v, e) case map[int32]uintptr: - fastpathTV.EncMapInt32UintptrV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt32UintptrV(v, e) case *map[int32]uintptr: - fastpathTV.EncMapInt32UintptrV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt32UintptrV(*v, e) case map[int32]int: - fastpathTV.EncMapInt32IntV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt32IntV(v, e) case *map[int32]int: - fastpathTV.EncMapInt32IntV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt32IntV(*v, e) case map[int32]int8: - fastpathTV.EncMapInt32Int8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt32Int8V(v, e) case *map[int32]int8: - fastpathTV.EncMapInt32Int8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt32Int8V(*v, e) case map[int32]int16: - fastpathTV.EncMapInt32Int16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt32Int16V(v, e) case *map[int32]int16: - fastpathTV.EncMapInt32Int16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt32Int16V(*v, e) case map[int32]int32: - fastpathTV.EncMapInt32Int32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt32Int32V(v, e) case *map[int32]int32: - fastpathTV.EncMapInt32Int32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt32Int32V(*v, e) case map[int32]int64: - fastpathTV.EncMapInt32Int64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt32Int64V(v, e) case *map[int32]int64: - fastpathTV.EncMapInt32Int64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt32Int64V(*v, e) case map[int32]float32: - fastpathTV.EncMapInt32Float32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt32Float32V(v, e) case *map[int32]float32: - fastpathTV.EncMapInt32Float32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt32Float32V(*v, e) case map[int32]float64: - fastpathTV.EncMapInt32Float64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt32Float64V(v, e) case *map[int32]float64: - fastpathTV.EncMapInt32Float64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt32Float64V(*v, e) case map[int32]bool: - fastpathTV.EncMapInt32BoolV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt32BoolV(v, e) case *map[int32]bool: - fastpathTV.EncMapInt32BoolV(*v, fastpathCheckNilTrue, e) - - case []int64: - fastpathTV.EncSliceInt64V(v, fastpathCheckNilTrue, e) - case *[]int64: - fastpathTV.EncSliceInt64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt32BoolV(*v, e) case map[int64]interface{}: - fastpathTV.EncMapInt64IntfV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt64IntfV(v, e) case *map[int64]interface{}: - fastpathTV.EncMapInt64IntfV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt64IntfV(*v, e) case map[int64]string: - fastpathTV.EncMapInt64StringV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt64StringV(v, e) case *map[int64]string: - fastpathTV.EncMapInt64StringV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt64StringV(*v, e) case map[int64]uint: - fastpathTV.EncMapInt64UintV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt64UintV(v, e) case *map[int64]uint: - fastpathTV.EncMapInt64UintV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt64UintV(*v, e) case map[int64]uint8: - fastpathTV.EncMapInt64Uint8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt64Uint8V(v, e) case *map[int64]uint8: - fastpathTV.EncMapInt64Uint8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt64Uint8V(*v, e) case map[int64]uint16: - fastpathTV.EncMapInt64Uint16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt64Uint16V(v, e) case *map[int64]uint16: - fastpathTV.EncMapInt64Uint16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt64Uint16V(*v, e) case map[int64]uint32: - fastpathTV.EncMapInt64Uint32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt64Uint32V(v, e) case *map[int64]uint32: - fastpathTV.EncMapInt64Uint32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt64Uint32V(*v, e) case map[int64]uint64: - fastpathTV.EncMapInt64Uint64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt64Uint64V(v, e) case *map[int64]uint64: - fastpathTV.EncMapInt64Uint64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt64Uint64V(*v, e) case map[int64]uintptr: - fastpathTV.EncMapInt64UintptrV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt64UintptrV(v, e) case *map[int64]uintptr: - fastpathTV.EncMapInt64UintptrV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt64UintptrV(*v, e) case map[int64]int: - fastpathTV.EncMapInt64IntV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt64IntV(v, e) case *map[int64]int: - fastpathTV.EncMapInt64IntV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt64IntV(*v, e) case map[int64]int8: - fastpathTV.EncMapInt64Int8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt64Int8V(v, e) case *map[int64]int8: - fastpathTV.EncMapInt64Int8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt64Int8V(*v, e) case map[int64]int16: - fastpathTV.EncMapInt64Int16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt64Int16V(v, e) case *map[int64]int16: - fastpathTV.EncMapInt64Int16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt64Int16V(*v, e) case map[int64]int32: - fastpathTV.EncMapInt64Int32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt64Int32V(v, e) case *map[int64]int32: - fastpathTV.EncMapInt64Int32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt64Int32V(*v, e) case map[int64]int64: - fastpathTV.EncMapInt64Int64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt64Int64V(v, e) case *map[int64]int64: - fastpathTV.EncMapInt64Int64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt64Int64V(*v, e) case map[int64]float32: - fastpathTV.EncMapInt64Float32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt64Float32V(v, e) case *map[int64]float32: - fastpathTV.EncMapInt64Float32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt64Float32V(*v, e) case map[int64]float64: - fastpathTV.EncMapInt64Float64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt64Float64V(v, e) case *map[int64]float64: - fastpathTV.EncMapInt64Float64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt64Float64V(*v, e) case map[int64]bool: - fastpathTV.EncMapInt64BoolV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapInt64BoolV(v, e) case *map[int64]bool: - fastpathTV.EncMapInt64BoolV(*v, fastpathCheckNilTrue, e) - - case []bool: - fastpathTV.EncSliceBoolV(v, fastpathCheckNilTrue, e) - case *[]bool: - fastpathTV.EncSliceBoolV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapInt64BoolV(*v, e) case map[bool]interface{}: - fastpathTV.EncMapBoolIntfV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapBoolIntfV(v, e) case *map[bool]interface{}: - fastpathTV.EncMapBoolIntfV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapBoolIntfV(*v, e) case map[bool]string: - fastpathTV.EncMapBoolStringV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapBoolStringV(v, e) case *map[bool]string: - fastpathTV.EncMapBoolStringV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapBoolStringV(*v, e) case map[bool]uint: - fastpathTV.EncMapBoolUintV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapBoolUintV(v, e) case *map[bool]uint: - fastpathTV.EncMapBoolUintV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapBoolUintV(*v, e) case map[bool]uint8: - fastpathTV.EncMapBoolUint8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapBoolUint8V(v, e) case *map[bool]uint8: - fastpathTV.EncMapBoolUint8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapBoolUint8V(*v, e) case map[bool]uint16: - fastpathTV.EncMapBoolUint16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapBoolUint16V(v, e) case *map[bool]uint16: - fastpathTV.EncMapBoolUint16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapBoolUint16V(*v, e) case map[bool]uint32: - fastpathTV.EncMapBoolUint32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapBoolUint32V(v, e) case *map[bool]uint32: - fastpathTV.EncMapBoolUint32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapBoolUint32V(*v, e) case map[bool]uint64: - fastpathTV.EncMapBoolUint64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapBoolUint64V(v, e) case *map[bool]uint64: - fastpathTV.EncMapBoolUint64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapBoolUint64V(*v, e) case map[bool]uintptr: - fastpathTV.EncMapBoolUintptrV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapBoolUintptrV(v, e) case *map[bool]uintptr: - fastpathTV.EncMapBoolUintptrV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapBoolUintptrV(*v, e) case map[bool]int: - fastpathTV.EncMapBoolIntV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapBoolIntV(v, e) case *map[bool]int: - fastpathTV.EncMapBoolIntV(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapBoolIntV(*v, e) case map[bool]int8: - fastpathTV.EncMapBoolInt8V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapBoolInt8V(v, e) case *map[bool]int8: - fastpathTV.EncMapBoolInt8V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapBoolInt8V(*v, e) case map[bool]int16: - fastpathTV.EncMapBoolInt16V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapBoolInt16V(v, e) case *map[bool]int16: - fastpathTV.EncMapBoolInt16V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapBoolInt16V(*v, e) case map[bool]int32: - fastpathTV.EncMapBoolInt32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapBoolInt32V(v, e) case *map[bool]int32: - fastpathTV.EncMapBoolInt32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapBoolInt32V(*v, e) case map[bool]int64: - fastpathTV.EncMapBoolInt64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapBoolInt64V(v, e) case *map[bool]int64: - fastpathTV.EncMapBoolInt64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapBoolInt64V(*v, e) case map[bool]float32: - fastpathTV.EncMapBoolFloat32V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapBoolFloat32V(v, e) case *map[bool]float32: - fastpathTV.EncMapBoolFloat32V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapBoolFloat32V(*v, e) case map[bool]float64: - fastpathTV.EncMapBoolFloat64V(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapBoolFloat64V(v, e) case *map[bool]float64: - fastpathTV.EncMapBoolFloat64V(*v, fastpathCheckNilTrue, e) - + fastpathTV.EncMapBoolFloat64V(*v, e) case map[bool]bool: - fastpathTV.EncMapBoolBoolV(v, fastpathCheckNilTrue, e) + fastpathTV.EncMapBoolBoolV(v, e) case *map[bool]bool: - fastpathTV.EncMapBoolBoolV(*v, fastpathCheckNilTrue, e) + fastpathTV.EncMapBoolBoolV(*v, e) default: - _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) - return false - } - return true -} - -func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { - switch v := iv.(type) { - - case []interface{}: - fastpathTV.EncSliceIntfV(v, fastpathCheckNilTrue, e) - case *[]interface{}: - fastpathTV.EncSliceIntfV(*v, fastpathCheckNilTrue, e) - - case []string: - fastpathTV.EncSliceStringV(v, fastpathCheckNilTrue, e) - case *[]string: - fastpathTV.EncSliceStringV(*v, fastpathCheckNilTrue, e) - - case []float32: - fastpathTV.EncSliceFloat32V(v, fastpathCheckNilTrue, e) - case *[]float32: - fastpathTV.EncSliceFloat32V(*v, fastpathCheckNilTrue, e) - - case []float64: - fastpathTV.EncSliceFloat64V(v, fastpathCheckNilTrue, e) - case *[]float64: - fastpathTV.EncSliceFloat64V(*v, fastpathCheckNilTrue, e) - - case []uint: - fastpathTV.EncSliceUintV(v, fastpathCheckNilTrue, e) - case *[]uint: - fastpathTV.EncSliceUintV(*v, fastpathCheckNilTrue, e) - - case []uint16: - fastpathTV.EncSliceUint16V(v, fastpathCheckNilTrue, e) - case *[]uint16: - fastpathTV.EncSliceUint16V(*v, fastpathCheckNilTrue, e) - - case []uint32: - fastpathTV.EncSliceUint32V(v, fastpathCheckNilTrue, e) - case *[]uint32: - fastpathTV.EncSliceUint32V(*v, fastpathCheckNilTrue, e) - - case []uint64: - fastpathTV.EncSliceUint64V(v, fastpathCheckNilTrue, e) - case *[]uint64: - fastpathTV.EncSliceUint64V(*v, fastpathCheckNilTrue, e) - - case []uintptr: - fastpathTV.EncSliceUintptrV(v, fastpathCheckNilTrue, e) - case *[]uintptr: - fastpathTV.EncSliceUintptrV(*v, fastpathCheckNilTrue, e) - - case []int: - fastpathTV.EncSliceIntV(v, fastpathCheckNilTrue, e) - case *[]int: - fastpathTV.EncSliceIntV(*v, fastpathCheckNilTrue, e) - - case []int8: - fastpathTV.EncSliceInt8V(v, fastpathCheckNilTrue, e) - case *[]int8: - fastpathTV.EncSliceInt8V(*v, fastpathCheckNilTrue, e) - - case []int16: - fastpathTV.EncSliceInt16V(v, fastpathCheckNilTrue, e) - case *[]int16: - fastpathTV.EncSliceInt16V(*v, fastpathCheckNilTrue, e) - - case []int32: - fastpathTV.EncSliceInt32V(v, fastpathCheckNilTrue, e) - case *[]int32: - fastpathTV.EncSliceInt32V(*v, fastpathCheckNilTrue, e) - - case []int64: - fastpathTV.EncSliceInt64V(v, fastpathCheckNilTrue, e) - case *[]int64: - fastpathTV.EncSliceInt64V(*v, fastpathCheckNilTrue, e) - - case []bool: - fastpathTV.EncSliceBoolV(v, fastpathCheckNilTrue, e) - case *[]bool: - fastpathTV.EncSliceBoolV(*v, fastpathCheckNilTrue, e) - - default: - _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) - return false - } - return true -} - -func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { - switch v := iv.(type) { - - case map[interface{}]interface{}: - fastpathTV.EncMapIntfIntfV(v, fastpathCheckNilTrue, e) - case *map[interface{}]interface{}: - fastpathTV.EncMapIntfIntfV(*v, fastpathCheckNilTrue, e) - - case map[interface{}]string: - fastpathTV.EncMapIntfStringV(v, fastpathCheckNilTrue, e) - case *map[interface{}]string: - fastpathTV.EncMapIntfStringV(*v, fastpathCheckNilTrue, e) - - case map[interface{}]uint: - fastpathTV.EncMapIntfUintV(v, fastpathCheckNilTrue, e) - case *map[interface{}]uint: - fastpathTV.EncMapIntfUintV(*v, fastpathCheckNilTrue, e) - - case map[interface{}]uint8: - fastpathTV.EncMapIntfUint8V(v, fastpathCheckNilTrue, e) - case *map[interface{}]uint8: - fastpathTV.EncMapIntfUint8V(*v, fastpathCheckNilTrue, e) - - case map[interface{}]uint16: - fastpathTV.EncMapIntfUint16V(v, fastpathCheckNilTrue, e) - case *map[interface{}]uint16: - fastpathTV.EncMapIntfUint16V(*v, fastpathCheckNilTrue, e) - - case map[interface{}]uint32: - fastpathTV.EncMapIntfUint32V(v, fastpathCheckNilTrue, e) - case *map[interface{}]uint32: - fastpathTV.EncMapIntfUint32V(*v, fastpathCheckNilTrue, e) - - case map[interface{}]uint64: - fastpathTV.EncMapIntfUint64V(v, fastpathCheckNilTrue, e) - case *map[interface{}]uint64: - fastpathTV.EncMapIntfUint64V(*v, fastpathCheckNilTrue, e) - - case map[interface{}]uintptr: - fastpathTV.EncMapIntfUintptrV(v, fastpathCheckNilTrue, e) - case *map[interface{}]uintptr: - fastpathTV.EncMapIntfUintptrV(*v, fastpathCheckNilTrue, e) - - case map[interface{}]int: - fastpathTV.EncMapIntfIntV(v, fastpathCheckNilTrue, e) - case *map[interface{}]int: - fastpathTV.EncMapIntfIntV(*v, fastpathCheckNilTrue, e) - - case map[interface{}]int8: - fastpathTV.EncMapIntfInt8V(v, fastpathCheckNilTrue, e) - case *map[interface{}]int8: - fastpathTV.EncMapIntfInt8V(*v, fastpathCheckNilTrue, e) - - case map[interface{}]int16: - fastpathTV.EncMapIntfInt16V(v, fastpathCheckNilTrue, e) - case *map[interface{}]int16: - fastpathTV.EncMapIntfInt16V(*v, fastpathCheckNilTrue, e) - - case map[interface{}]int32: - fastpathTV.EncMapIntfInt32V(v, fastpathCheckNilTrue, e) - case *map[interface{}]int32: - fastpathTV.EncMapIntfInt32V(*v, fastpathCheckNilTrue, e) - - case map[interface{}]int64: - fastpathTV.EncMapIntfInt64V(v, fastpathCheckNilTrue, e) - case *map[interface{}]int64: - fastpathTV.EncMapIntfInt64V(*v, fastpathCheckNilTrue, e) - - case map[interface{}]float32: - fastpathTV.EncMapIntfFloat32V(v, fastpathCheckNilTrue, e) - case *map[interface{}]float32: - fastpathTV.EncMapIntfFloat32V(*v, fastpathCheckNilTrue, e) - - case map[interface{}]float64: - fastpathTV.EncMapIntfFloat64V(v, fastpathCheckNilTrue, e) - case *map[interface{}]float64: - fastpathTV.EncMapIntfFloat64V(*v, fastpathCheckNilTrue, e) - - case map[interface{}]bool: - fastpathTV.EncMapIntfBoolV(v, fastpathCheckNilTrue, e) - case *map[interface{}]bool: - fastpathTV.EncMapIntfBoolV(*v, fastpathCheckNilTrue, e) - - case map[string]interface{}: - fastpathTV.EncMapStringIntfV(v, fastpathCheckNilTrue, e) - case *map[string]interface{}: - fastpathTV.EncMapStringIntfV(*v, fastpathCheckNilTrue, e) - - case map[string]string: - fastpathTV.EncMapStringStringV(v, fastpathCheckNilTrue, e) - case *map[string]string: - fastpathTV.EncMapStringStringV(*v, fastpathCheckNilTrue, e) - - case map[string]uint: - fastpathTV.EncMapStringUintV(v, fastpathCheckNilTrue, e) - case *map[string]uint: - fastpathTV.EncMapStringUintV(*v, fastpathCheckNilTrue, e) - - case map[string]uint8: - fastpathTV.EncMapStringUint8V(v, fastpathCheckNilTrue, e) - case *map[string]uint8: - fastpathTV.EncMapStringUint8V(*v, fastpathCheckNilTrue, e) - - case map[string]uint16: - fastpathTV.EncMapStringUint16V(v, fastpathCheckNilTrue, e) - case *map[string]uint16: - fastpathTV.EncMapStringUint16V(*v, fastpathCheckNilTrue, e) - - case map[string]uint32: - fastpathTV.EncMapStringUint32V(v, fastpathCheckNilTrue, e) - case *map[string]uint32: - fastpathTV.EncMapStringUint32V(*v, fastpathCheckNilTrue, e) - - case map[string]uint64: - fastpathTV.EncMapStringUint64V(v, fastpathCheckNilTrue, e) - case *map[string]uint64: - fastpathTV.EncMapStringUint64V(*v, fastpathCheckNilTrue, e) - - case map[string]uintptr: - fastpathTV.EncMapStringUintptrV(v, fastpathCheckNilTrue, e) - case *map[string]uintptr: - fastpathTV.EncMapStringUintptrV(*v, fastpathCheckNilTrue, e) - - case map[string]int: - fastpathTV.EncMapStringIntV(v, fastpathCheckNilTrue, e) - case *map[string]int: - fastpathTV.EncMapStringIntV(*v, fastpathCheckNilTrue, e) - - case map[string]int8: - fastpathTV.EncMapStringInt8V(v, fastpathCheckNilTrue, e) - case *map[string]int8: - fastpathTV.EncMapStringInt8V(*v, fastpathCheckNilTrue, e) - - case map[string]int16: - fastpathTV.EncMapStringInt16V(v, fastpathCheckNilTrue, e) - case *map[string]int16: - fastpathTV.EncMapStringInt16V(*v, fastpathCheckNilTrue, e) - - case map[string]int32: - fastpathTV.EncMapStringInt32V(v, fastpathCheckNilTrue, e) - case *map[string]int32: - fastpathTV.EncMapStringInt32V(*v, fastpathCheckNilTrue, e) - - case map[string]int64: - fastpathTV.EncMapStringInt64V(v, fastpathCheckNilTrue, e) - case *map[string]int64: - fastpathTV.EncMapStringInt64V(*v, fastpathCheckNilTrue, e) - - case map[string]float32: - fastpathTV.EncMapStringFloat32V(v, fastpathCheckNilTrue, e) - case *map[string]float32: - fastpathTV.EncMapStringFloat32V(*v, fastpathCheckNilTrue, e) - - case map[string]float64: - fastpathTV.EncMapStringFloat64V(v, fastpathCheckNilTrue, e) - case *map[string]float64: - fastpathTV.EncMapStringFloat64V(*v, fastpathCheckNilTrue, e) - - case map[string]bool: - fastpathTV.EncMapStringBoolV(v, fastpathCheckNilTrue, e) - case *map[string]bool: - fastpathTV.EncMapStringBoolV(*v, fastpathCheckNilTrue, e) - - case map[float32]interface{}: - fastpathTV.EncMapFloat32IntfV(v, fastpathCheckNilTrue, e) - case *map[float32]interface{}: - fastpathTV.EncMapFloat32IntfV(*v, fastpathCheckNilTrue, e) - - case map[float32]string: - fastpathTV.EncMapFloat32StringV(v, fastpathCheckNilTrue, e) - case *map[float32]string: - fastpathTV.EncMapFloat32StringV(*v, fastpathCheckNilTrue, e) - - case map[float32]uint: - fastpathTV.EncMapFloat32UintV(v, fastpathCheckNilTrue, e) - case *map[float32]uint: - fastpathTV.EncMapFloat32UintV(*v, fastpathCheckNilTrue, e) - - case map[float32]uint8: - fastpathTV.EncMapFloat32Uint8V(v, fastpathCheckNilTrue, e) - case *map[float32]uint8: - fastpathTV.EncMapFloat32Uint8V(*v, fastpathCheckNilTrue, e) - - case map[float32]uint16: - fastpathTV.EncMapFloat32Uint16V(v, fastpathCheckNilTrue, e) - case *map[float32]uint16: - fastpathTV.EncMapFloat32Uint16V(*v, fastpathCheckNilTrue, e) - - case map[float32]uint32: - fastpathTV.EncMapFloat32Uint32V(v, fastpathCheckNilTrue, e) - case *map[float32]uint32: - fastpathTV.EncMapFloat32Uint32V(*v, fastpathCheckNilTrue, e) - - case map[float32]uint64: - fastpathTV.EncMapFloat32Uint64V(v, fastpathCheckNilTrue, e) - case *map[float32]uint64: - fastpathTV.EncMapFloat32Uint64V(*v, fastpathCheckNilTrue, e) - - case map[float32]uintptr: - fastpathTV.EncMapFloat32UintptrV(v, fastpathCheckNilTrue, e) - case *map[float32]uintptr: - fastpathTV.EncMapFloat32UintptrV(*v, fastpathCheckNilTrue, e) - - case map[float32]int: - fastpathTV.EncMapFloat32IntV(v, fastpathCheckNilTrue, e) - case *map[float32]int: - fastpathTV.EncMapFloat32IntV(*v, fastpathCheckNilTrue, e) - - case map[float32]int8: - fastpathTV.EncMapFloat32Int8V(v, fastpathCheckNilTrue, e) - case *map[float32]int8: - fastpathTV.EncMapFloat32Int8V(*v, fastpathCheckNilTrue, e) - - case map[float32]int16: - fastpathTV.EncMapFloat32Int16V(v, fastpathCheckNilTrue, e) - case *map[float32]int16: - fastpathTV.EncMapFloat32Int16V(*v, fastpathCheckNilTrue, e) - - case map[float32]int32: - fastpathTV.EncMapFloat32Int32V(v, fastpathCheckNilTrue, e) - case *map[float32]int32: - fastpathTV.EncMapFloat32Int32V(*v, fastpathCheckNilTrue, e) - - case map[float32]int64: - fastpathTV.EncMapFloat32Int64V(v, fastpathCheckNilTrue, e) - case *map[float32]int64: - fastpathTV.EncMapFloat32Int64V(*v, fastpathCheckNilTrue, e) - - case map[float32]float32: - fastpathTV.EncMapFloat32Float32V(v, fastpathCheckNilTrue, e) - case *map[float32]float32: - fastpathTV.EncMapFloat32Float32V(*v, fastpathCheckNilTrue, e) - - case map[float32]float64: - fastpathTV.EncMapFloat32Float64V(v, fastpathCheckNilTrue, e) - case *map[float32]float64: - fastpathTV.EncMapFloat32Float64V(*v, fastpathCheckNilTrue, e) - - case map[float32]bool: - fastpathTV.EncMapFloat32BoolV(v, fastpathCheckNilTrue, e) - case *map[float32]bool: - fastpathTV.EncMapFloat32BoolV(*v, fastpathCheckNilTrue, e) - - case map[float64]interface{}: - fastpathTV.EncMapFloat64IntfV(v, fastpathCheckNilTrue, e) - case *map[float64]interface{}: - fastpathTV.EncMapFloat64IntfV(*v, fastpathCheckNilTrue, e) - - case map[float64]string: - fastpathTV.EncMapFloat64StringV(v, fastpathCheckNilTrue, e) - case *map[float64]string: - fastpathTV.EncMapFloat64StringV(*v, fastpathCheckNilTrue, e) - - case map[float64]uint: - fastpathTV.EncMapFloat64UintV(v, fastpathCheckNilTrue, e) - case *map[float64]uint: - fastpathTV.EncMapFloat64UintV(*v, fastpathCheckNilTrue, e) - - case map[float64]uint8: - fastpathTV.EncMapFloat64Uint8V(v, fastpathCheckNilTrue, e) - case *map[float64]uint8: - fastpathTV.EncMapFloat64Uint8V(*v, fastpathCheckNilTrue, e) - - case map[float64]uint16: - fastpathTV.EncMapFloat64Uint16V(v, fastpathCheckNilTrue, e) - case *map[float64]uint16: - fastpathTV.EncMapFloat64Uint16V(*v, fastpathCheckNilTrue, e) - - case map[float64]uint32: - fastpathTV.EncMapFloat64Uint32V(v, fastpathCheckNilTrue, e) - case *map[float64]uint32: - fastpathTV.EncMapFloat64Uint32V(*v, fastpathCheckNilTrue, e) - - case map[float64]uint64: - fastpathTV.EncMapFloat64Uint64V(v, fastpathCheckNilTrue, e) - case *map[float64]uint64: - fastpathTV.EncMapFloat64Uint64V(*v, fastpathCheckNilTrue, e) - - case map[float64]uintptr: - fastpathTV.EncMapFloat64UintptrV(v, fastpathCheckNilTrue, e) - case *map[float64]uintptr: - fastpathTV.EncMapFloat64UintptrV(*v, fastpathCheckNilTrue, e) - - case map[float64]int: - fastpathTV.EncMapFloat64IntV(v, fastpathCheckNilTrue, e) - case *map[float64]int: - fastpathTV.EncMapFloat64IntV(*v, fastpathCheckNilTrue, e) - - case map[float64]int8: - fastpathTV.EncMapFloat64Int8V(v, fastpathCheckNilTrue, e) - case *map[float64]int8: - fastpathTV.EncMapFloat64Int8V(*v, fastpathCheckNilTrue, e) - - case map[float64]int16: - fastpathTV.EncMapFloat64Int16V(v, fastpathCheckNilTrue, e) - case *map[float64]int16: - fastpathTV.EncMapFloat64Int16V(*v, fastpathCheckNilTrue, e) - - case map[float64]int32: - fastpathTV.EncMapFloat64Int32V(v, fastpathCheckNilTrue, e) - case *map[float64]int32: - fastpathTV.EncMapFloat64Int32V(*v, fastpathCheckNilTrue, e) - - case map[float64]int64: - fastpathTV.EncMapFloat64Int64V(v, fastpathCheckNilTrue, e) - case *map[float64]int64: - fastpathTV.EncMapFloat64Int64V(*v, fastpathCheckNilTrue, e) - - case map[float64]float32: - fastpathTV.EncMapFloat64Float32V(v, fastpathCheckNilTrue, e) - case *map[float64]float32: - fastpathTV.EncMapFloat64Float32V(*v, fastpathCheckNilTrue, e) - - case map[float64]float64: - fastpathTV.EncMapFloat64Float64V(v, fastpathCheckNilTrue, e) - case *map[float64]float64: - fastpathTV.EncMapFloat64Float64V(*v, fastpathCheckNilTrue, e) - - case map[float64]bool: - fastpathTV.EncMapFloat64BoolV(v, fastpathCheckNilTrue, e) - case *map[float64]bool: - fastpathTV.EncMapFloat64BoolV(*v, fastpathCheckNilTrue, e) - - case map[uint]interface{}: - fastpathTV.EncMapUintIntfV(v, fastpathCheckNilTrue, e) - case *map[uint]interface{}: - fastpathTV.EncMapUintIntfV(*v, fastpathCheckNilTrue, e) - - case map[uint]string: - fastpathTV.EncMapUintStringV(v, fastpathCheckNilTrue, e) - case *map[uint]string: - fastpathTV.EncMapUintStringV(*v, fastpathCheckNilTrue, e) - - case map[uint]uint: - fastpathTV.EncMapUintUintV(v, fastpathCheckNilTrue, e) - case *map[uint]uint: - fastpathTV.EncMapUintUintV(*v, fastpathCheckNilTrue, e) - - case map[uint]uint8: - fastpathTV.EncMapUintUint8V(v, fastpathCheckNilTrue, e) - case *map[uint]uint8: - fastpathTV.EncMapUintUint8V(*v, fastpathCheckNilTrue, e) - - case map[uint]uint16: - fastpathTV.EncMapUintUint16V(v, fastpathCheckNilTrue, e) - case *map[uint]uint16: - fastpathTV.EncMapUintUint16V(*v, fastpathCheckNilTrue, e) - - case map[uint]uint32: - fastpathTV.EncMapUintUint32V(v, fastpathCheckNilTrue, e) - case *map[uint]uint32: - fastpathTV.EncMapUintUint32V(*v, fastpathCheckNilTrue, e) - - case map[uint]uint64: - fastpathTV.EncMapUintUint64V(v, fastpathCheckNilTrue, e) - case *map[uint]uint64: - fastpathTV.EncMapUintUint64V(*v, fastpathCheckNilTrue, e) - - case map[uint]uintptr: - fastpathTV.EncMapUintUintptrV(v, fastpathCheckNilTrue, e) - case *map[uint]uintptr: - fastpathTV.EncMapUintUintptrV(*v, fastpathCheckNilTrue, e) - - case map[uint]int: - fastpathTV.EncMapUintIntV(v, fastpathCheckNilTrue, e) - case *map[uint]int: - fastpathTV.EncMapUintIntV(*v, fastpathCheckNilTrue, e) - - case map[uint]int8: - fastpathTV.EncMapUintInt8V(v, fastpathCheckNilTrue, e) - case *map[uint]int8: - fastpathTV.EncMapUintInt8V(*v, fastpathCheckNilTrue, e) - - case map[uint]int16: - fastpathTV.EncMapUintInt16V(v, fastpathCheckNilTrue, e) - case *map[uint]int16: - fastpathTV.EncMapUintInt16V(*v, fastpathCheckNilTrue, e) - - case map[uint]int32: - fastpathTV.EncMapUintInt32V(v, fastpathCheckNilTrue, e) - case *map[uint]int32: - fastpathTV.EncMapUintInt32V(*v, fastpathCheckNilTrue, e) - - case map[uint]int64: - fastpathTV.EncMapUintInt64V(v, fastpathCheckNilTrue, e) - case *map[uint]int64: - fastpathTV.EncMapUintInt64V(*v, fastpathCheckNilTrue, e) - - case map[uint]float32: - fastpathTV.EncMapUintFloat32V(v, fastpathCheckNilTrue, e) - case *map[uint]float32: - fastpathTV.EncMapUintFloat32V(*v, fastpathCheckNilTrue, e) - - case map[uint]float64: - fastpathTV.EncMapUintFloat64V(v, fastpathCheckNilTrue, e) - case *map[uint]float64: - fastpathTV.EncMapUintFloat64V(*v, fastpathCheckNilTrue, e) - - case map[uint]bool: - fastpathTV.EncMapUintBoolV(v, fastpathCheckNilTrue, e) - case *map[uint]bool: - fastpathTV.EncMapUintBoolV(*v, fastpathCheckNilTrue, e) - - case map[uint8]interface{}: - fastpathTV.EncMapUint8IntfV(v, fastpathCheckNilTrue, e) - case *map[uint8]interface{}: - fastpathTV.EncMapUint8IntfV(*v, fastpathCheckNilTrue, e) - - case map[uint8]string: - fastpathTV.EncMapUint8StringV(v, fastpathCheckNilTrue, e) - case *map[uint8]string: - fastpathTV.EncMapUint8StringV(*v, fastpathCheckNilTrue, e) - - case map[uint8]uint: - fastpathTV.EncMapUint8UintV(v, fastpathCheckNilTrue, e) - case *map[uint8]uint: - fastpathTV.EncMapUint8UintV(*v, fastpathCheckNilTrue, e) - - case map[uint8]uint8: - fastpathTV.EncMapUint8Uint8V(v, fastpathCheckNilTrue, e) - case *map[uint8]uint8: - fastpathTV.EncMapUint8Uint8V(*v, fastpathCheckNilTrue, e) - - case map[uint8]uint16: - fastpathTV.EncMapUint8Uint16V(v, fastpathCheckNilTrue, e) - case *map[uint8]uint16: - fastpathTV.EncMapUint8Uint16V(*v, fastpathCheckNilTrue, e) - - case map[uint8]uint32: - fastpathTV.EncMapUint8Uint32V(v, fastpathCheckNilTrue, e) - case *map[uint8]uint32: - fastpathTV.EncMapUint8Uint32V(*v, fastpathCheckNilTrue, e) - - case map[uint8]uint64: - fastpathTV.EncMapUint8Uint64V(v, fastpathCheckNilTrue, e) - case *map[uint8]uint64: - fastpathTV.EncMapUint8Uint64V(*v, fastpathCheckNilTrue, e) - - case map[uint8]uintptr: - fastpathTV.EncMapUint8UintptrV(v, fastpathCheckNilTrue, e) - case *map[uint8]uintptr: - fastpathTV.EncMapUint8UintptrV(*v, fastpathCheckNilTrue, e) - - case map[uint8]int: - fastpathTV.EncMapUint8IntV(v, fastpathCheckNilTrue, e) - case *map[uint8]int: - fastpathTV.EncMapUint8IntV(*v, fastpathCheckNilTrue, e) - - case map[uint8]int8: - fastpathTV.EncMapUint8Int8V(v, fastpathCheckNilTrue, e) - case *map[uint8]int8: - fastpathTV.EncMapUint8Int8V(*v, fastpathCheckNilTrue, e) - - case map[uint8]int16: - fastpathTV.EncMapUint8Int16V(v, fastpathCheckNilTrue, e) - case *map[uint8]int16: - fastpathTV.EncMapUint8Int16V(*v, fastpathCheckNilTrue, e) - - case map[uint8]int32: - fastpathTV.EncMapUint8Int32V(v, fastpathCheckNilTrue, e) - case *map[uint8]int32: - fastpathTV.EncMapUint8Int32V(*v, fastpathCheckNilTrue, e) - - case map[uint8]int64: - fastpathTV.EncMapUint8Int64V(v, fastpathCheckNilTrue, e) - case *map[uint8]int64: - fastpathTV.EncMapUint8Int64V(*v, fastpathCheckNilTrue, e) - - case map[uint8]float32: - fastpathTV.EncMapUint8Float32V(v, fastpathCheckNilTrue, e) - case *map[uint8]float32: - fastpathTV.EncMapUint8Float32V(*v, fastpathCheckNilTrue, e) - - case map[uint8]float64: - fastpathTV.EncMapUint8Float64V(v, fastpathCheckNilTrue, e) - case *map[uint8]float64: - fastpathTV.EncMapUint8Float64V(*v, fastpathCheckNilTrue, e) - - case map[uint8]bool: - fastpathTV.EncMapUint8BoolV(v, fastpathCheckNilTrue, e) - case *map[uint8]bool: - fastpathTV.EncMapUint8BoolV(*v, fastpathCheckNilTrue, e) - - case map[uint16]interface{}: - fastpathTV.EncMapUint16IntfV(v, fastpathCheckNilTrue, e) - case *map[uint16]interface{}: - fastpathTV.EncMapUint16IntfV(*v, fastpathCheckNilTrue, e) - - case map[uint16]string: - fastpathTV.EncMapUint16StringV(v, fastpathCheckNilTrue, e) - case *map[uint16]string: - fastpathTV.EncMapUint16StringV(*v, fastpathCheckNilTrue, e) - - case map[uint16]uint: - fastpathTV.EncMapUint16UintV(v, fastpathCheckNilTrue, e) - case *map[uint16]uint: - fastpathTV.EncMapUint16UintV(*v, fastpathCheckNilTrue, e) - - case map[uint16]uint8: - fastpathTV.EncMapUint16Uint8V(v, fastpathCheckNilTrue, e) - case *map[uint16]uint8: - fastpathTV.EncMapUint16Uint8V(*v, fastpathCheckNilTrue, e) - - case map[uint16]uint16: - fastpathTV.EncMapUint16Uint16V(v, fastpathCheckNilTrue, e) - case *map[uint16]uint16: - fastpathTV.EncMapUint16Uint16V(*v, fastpathCheckNilTrue, e) - - case map[uint16]uint32: - fastpathTV.EncMapUint16Uint32V(v, fastpathCheckNilTrue, e) - case *map[uint16]uint32: - fastpathTV.EncMapUint16Uint32V(*v, fastpathCheckNilTrue, e) - - case map[uint16]uint64: - fastpathTV.EncMapUint16Uint64V(v, fastpathCheckNilTrue, e) - case *map[uint16]uint64: - fastpathTV.EncMapUint16Uint64V(*v, fastpathCheckNilTrue, e) - - case map[uint16]uintptr: - fastpathTV.EncMapUint16UintptrV(v, fastpathCheckNilTrue, e) - case *map[uint16]uintptr: - fastpathTV.EncMapUint16UintptrV(*v, fastpathCheckNilTrue, e) - - case map[uint16]int: - fastpathTV.EncMapUint16IntV(v, fastpathCheckNilTrue, e) - case *map[uint16]int: - fastpathTV.EncMapUint16IntV(*v, fastpathCheckNilTrue, e) - - case map[uint16]int8: - fastpathTV.EncMapUint16Int8V(v, fastpathCheckNilTrue, e) - case *map[uint16]int8: - fastpathTV.EncMapUint16Int8V(*v, fastpathCheckNilTrue, e) - - case map[uint16]int16: - fastpathTV.EncMapUint16Int16V(v, fastpathCheckNilTrue, e) - case *map[uint16]int16: - fastpathTV.EncMapUint16Int16V(*v, fastpathCheckNilTrue, e) - - case map[uint16]int32: - fastpathTV.EncMapUint16Int32V(v, fastpathCheckNilTrue, e) - case *map[uint16]int32: - fastpathTV.EncMapUint16Int32V(*v, fastpathCheckNilTrue, e) - - case map[uint16]int64: - fastpathTV.EncMapUint16Int64V(v, fastpathCheckNilTrue, e) - case *map[uint16]int64: - fastpathTV.EncMapUint16Int64V(*v, fastpathCheckNilTrue, e) - - case map[uint16]float32: - fastpathTV.EncMapUint16Float32V(v, fastpathCheckNilTrue, e) - case *map[uint16]float32: - fastpathTV.EncMapUint16Float32V(*v, fastpathCheckNilTrue, e) - - case map[uint16]float64: - fastpathTV.EncMapUint16Float64V(v, fastpathCheckNilTrue, e) - case *map[uint16]float64: - fastpathTV.EncMapUint16Float64V(*v, fastpathCheckNilTrue, e) - - case map[uint16]bool: - fastpathTV.EncMapUint16BoolV(v, fastpathCheckNilTrue, e) - case *map[uint16]bool: - fastpathTV.EncMapUint16BoolV(*v, fastpathCheckNilTrue, e) - - case map[uint32]interface{}: - fastpathTV.EncMapUint32IntfV(v, fastpathCheckNilTrue, e) - case *map[uint32]interface{}: - fastpathTV.EncMapUint32IntfV(*v, fastpathCheckNilTrue, e) - - case map[uint32]string: - fastpathTV.EncMapUint32StringV(v, fastpathCheckNilTrue, e) - case *map[uint32]string: - fastpathTV.EncMapUint32StringV(*v, fastpathCheckNilTrue, e) - - case map[uint32]uint: - fastpathTV.EncMapUint32UintV(v, fastpathCheckNilTrue, e) - case *map[uint32]uint: - fastpathTV.EncMapUint32UintV(*v, fastpathCheckNilTrue, e) - - case map[uint32]uint8: - fastpathTV.EncMapUint32Uint8V(v, fastpathCheckNilTrue, e) - case *map[uint32]uint8: - fastpathTV.EncMapUint32Uint8V(*v, fastpathCheckNilTrue, e) - - case map[uint32]uint16: - fastpathTV.EncMapUint32Uint16V(v, fastpathCheckNilTrue, e) - case *map[uint32]uint16: - fastpathTV.EncMapUint32Uint16V(*v, fastpathCheckNilTrue, e) - - case map[uint32]uint32: - fastpathTV.EncMapUint32Uint32V(v, fastpathCheckNilTrue, e) - case *map[uint32]uint32: - fastpathTV.EncMapUint32Uint32V(*v, fastpathCheckNilTrue, e) - - case map[uint32]uint64: - fastpathTV.EncMapUint32Uint64V(v, fastpathCheckNilTrue, e) - case *map[uint32]uint64: - fastpathTV.EncMapUint32Uint64V(*v, fastpathCheckNilTrue, e) - - case map[uint32]uintptr: - fastpathTV.EncMapUint32UintptrV(v, fastpathCheckNilTrue, e) - case *map[uint32]uintptr: - fastpathTV.EncMapUint32UintptrV(*v, fastpathCheckNilTrue, e) - - case map[uint32]int: - fastpathTV.EncMapUint32IntV(v, fastpathCheckNilTrue, e) - case *map[uint32]int: - fastpathTV.EncMapUint32IntV(*v, fastpathCheckNilTrue, e) - - case map[uint32]int8: - fastpathTV.EncMapUint32Int8V(v, fastpathCheckNilTrue, e) - case *map[uint32]int8: - fastpathTV.EncMapUint32Int8V(*v, fastpathCheckNilTrue, e) - - case map[uint32]int16: - fastpathTV.EncMapUint32Int16V(v, fastpathCheckNilTrue, e) - case *map[uint32]int16: - fastpathTV.EncMapUint32Int16V(*v, fastpathCheckNilTrue, e) - - case map[uint32]int32: - fastpathTV.EncMapUint32Int32V(v, fastpathCheckNilTrue, e) - case *map[uint32]int32: - fastpathTV.EncMapUint32Int32V(*v, fastpathCheckNilTrue, e) - - case map[uint32]int64: - fastpathTV.EncMapUint32Int64V(v, fastpathCheckNilTrue, e) - case *map[uint32]int64: - fastpathTV.EncMapUint32Int64V(*v, fastpathCheckNilTrue, e) - - case map[uint32]float32: - fastpathTV.EncMapUint32Float32V(v, fastpathCheckNilTrue, e) - case *map[uint32]float32: - fastpathTV.EncMapUint32Float32V(*v, fastpathCheckNilTrue, e) - - case map[uint32]float64: - fastpathTV.EncMapUint32Float64V(v, fastpathCheckNilTrue, e) - case *map[uint32]float64: - fastpathTV.EncMapUint32Float64V(*v, fastpathCheckNilTrue, e) - - case map[uint32]bool: - fastpathTV.EncMapUint32BoolV(v, fastpathCheckNilTrue, e) - case *map[uint32]bool: - fastpathTV.EncMapUint32BoolV(*v, fastpathCheckNilTrue, e) - - case map[uint64]interface{}: - fastpathTV.EncMapUint64IntfV(v, fastpathCheckNilTrue, e) - case *map[uint64]interface{}: - fastpathTV.EncMapUint64IntfV(*v, fastpathCheckNilTrue, e) - - case map[uint64]string: - fastpathTV.EncMapUint64StringV(v, fastpathCheckNilTrue, e) - case *map[uint64]string: - fastpathTV.EncMapUint64StringV(*v, fastpathCheckNilTrue, e) - - case map[uint64]uint: - fastpathTV.EncMapUint64UintV(v, fastpathCheckNilTrue, e) - case *map[uint64]uint: - fastpathTV.EncMapUint64UintV(*v, fastpathCheckNilTrue, e) - - case map[uint64]uint8: - fastpathTV.EncMapUint64Uint8V(v, fastpathCheckNilTrue, e) - case *map[uint64]uint8: - fastpathTV.EncMapUint64Uint8V(*v, fastpathCheckNilTrue, e) - - case map[uint64]uint16: - fastpathTV.EncMapUint64Uint16V(v, fastpathCheckNilTrue, e) - case *map[uint64]uint16: - fastpathTV.EncMapUint64Uint16V(*v, fastpathCheckNilTrue, e) - - case map[uint64]uint32: - fastpathTV.EncMapUint64Uint32V(v, fastpathCheckNilTrue, e) - case *map[uint64]uint32: - fastpathTV.EncMapUint64Uint32V(*v, fastpathCheckNilTrue, e) - - case map[uint64]uint64: - fastpathTV.EncMapUint64Uint64V(v, fastpathCheckNilTrue, e) - case *map[uint64]uint64: - fastpathTV.EncMapUint64Uint64V(*v, fastpathCheckNilTrue, e) - - case map[uint64]uintptr: - fastpathTV.EncMapUint64UintptrV(v, fastpathCheckNilTrue, e) - case *map[uint64]uintptr: - fastpathTV.EncMapUint64UintptrV(*v, fastpathCheckNilTrue, e) - - case map[uint64]int: - fastpathTV.EncMapUint64IntV(v, fastpathCheckNilTrue, e) - case *map[uint64]int: - fastpathTV.EncMapUint64IntV(*v, fastpathCheckNilTrue, e) - - case map[uint64]int8: - fastpathTV.EncMapUint64Int8V(v, fastpathCheckNilTrue, e) - case *map[uint64]int8: - fastpathTV.EncMapUint64Int8V(*v, fastpathCheckNilTrue, e) - - case map[uint64]int16: - fastpathTV.EncMapUint64Int16V(v, fastpathCheckNilTrue, e) - case *map[uint64]int16: - fastpathTV.EncMapUint64Int16V(*v, fastpathCheckNilTrue, e) - - case map[uint64]int32: - fastpathTV.EncMapUint64Int32V(v, fastpathCheckNilTrue, e) - case *map[uint64]int32: - fastpathTV.EncMapUint64Int32V(*v, fastpathCheckNilTrue, e) - - case map[uint64]int64: - fastpathTV.EncMapUint64Int64V(v, fastpathCheckNilTrue, e) - case *map[uint64]int64: - fastpathTV.EncMapUint64Int64V(*v, fastpathCheckNilTrue, e) - - case map[uint64]float32: - fastpathTV.EncMapUint64Float32V(v, fastpathCheckNilTrue, e) - case *map[uint64]float32: - fastpathTV.EncMapUint64Float32V(*v, fastpathCheckNilTrue, e) - - case map[uint64]float64: - fastpathTV.EncMapUint64Float64V(v, fastpathCheckNilTrue, e) - case *map[uint64]float64: - fastpathTV.EncMapUint64Float64V(*v, fastpathCheckNilTrue, e) - - case map[uint64]bool: - fastpathTV.EncMapUint64BoolV(v, fastpathCheckNilTrue, e) - case *map[uint64]bool: - fastpathTV.EncMapUint64BoolV(*v, fastpathCheckNilTrue, e) - - case map[uintptr]interface{}: - fastpathTV.EncMapUintptrIntfV(v, fastpathCheckNilTrue, e) - case *map[uintptr]interface{}: - fastpathTV.EncMapUintptrIntfV(*v, fastpathCheckNilTrue, e) - - case map[uintptr]string: - fastpathTV.EncMapUintptrStringV(v, fastpathCheckNilTrue, e) - case *map[uintptr]string: - fastpathTV.EncMapUintptrStringV(*v, fastpathCheckNilTrue, e) - - case map[uintptr]uint: - fastpathTV.EncMapUintptrUintV(v, fastpathCheckNilTrue, e) - case *map[uintptr]uint: - fastpathTV.EncMapUintptrUintV(*v, fastpathCheckNilTrue, e) - - case map[uintptr]uint8: - fastpathTV.EncMapUintptrUint8V(v, fastpathCheckNilTrue, e) - case *map[uintptr]uint8: - fastpathTV.EncMapUintptrUint8V(*v, fastpathCheckNilTrue, e) - - case map[uintptr]uint16: - fastpathTV.EncMapUintptrUint16V(v, fastpathCheckNilTrue, e) - case *map[uintptr]uint16: - fastpathTV.EncMapUintptrUint16V(*v, fastpathCheckNilTrue, e) - - case map[uintptr]uint32: - fastpathTV.EncMapUintptrUint32V(v, fastpathCheckNilTrue, e) - case *map[uintptr]uint32: - fastpathTV.EncMapUintptrUint32V(*v, fastpathCheckNilTrue, e) - - case map[uintptr]uint64: - fastpathTV.EncMapUintptrUint64V(v, fastpathCheckNilTrue, e) - case *map[uintptr]uint64: - fastpathTV.EncMapUintptrUint64V(*v, fastpathCheckNilTrue, e) - - case map[uintptr]uintptr: - fastpathTV.EncMapUintptrUintptrV(v, fastpathCheckNilTrue, e) - case *map[uintptr]uintptr: - fastpathTV.EncMapUintptrUintptrV(*v, fastpathCheckNilTrue, e) - - case map[uintptr]int: - fastpathTV.EncMapUintptrIntV(v, fastpathCheckNilTrue, e) - case *map[uintptr]int: - fastpathTV.EncMapUintptrIntV(*v, fastpathCheckNilTrue, e) - - case map[uintptr]int8: - fastpathTV.EncMapUintptrInt8V(v, fastpathCheckNilTrue, e) - case *map[uintptr]int8: - fastpathTV.EncMapUintptrInt8V(*v, fastpathCheckNilTrue, e) - - case map[uintptr]int16: - fastpathTV.EncMapUintptrInt16V(v, fastpathCheckNilTrue, e) - case *map[uintptr]int16: - fastpathTV.EncMapUintptrInt16V(*v, fastpathCheckNilTrue, e) - - case map[uintptr]int32: - fastpathTV.EncMapUintptrInt32V(v, fastpathCheckNilTrue, e) - case *map[uintptr]int32: - fastpathTV.EncMapUintptrInt32V(*v, fastpathCheckNilTrue, e) - - case map[uintptr]int64: - fastpathTV.EncMapUintptrInt64V(v, fastpathCheckNilTrue, e) - case *map[uintptr]int64: - fastpathTV.EncMapUintptrInt64V(*v, fastpathCheckNilTrue, e) - - case map[uintptr]float32: - fastpathTV.EncMapUintptrFloat32V(v, fastpathCheckNilTrue, e) - case *map[uintptr]float32: - fastpathTV.EncMapUintptrFloat32V(*v, fastpathCheckNilTrue, e) - - case map[uintptr]float64: - fastpathTV.EncMapUintptrFloat64V(v, fastpathCheckNilTrue, e) - case *map[uintptr]float64: - fastpathTV.EncMapUintptrFloat64V(*v, fastpathCheckNilTrue, e) - - case map[uintptr]bool: - fastpathTV.EncMapUintptrBoolV(v, fastpathCheckNilTrue, e) - case *map[uintptr]bool: - fastpathTV.EncMapUintptrBoolV(*v, fastpathCheckNilTrue, e) - - case map[int]interface{}: - fastpathTV.EncMapIntIntfV(v, fastpathCheckNilTrue, e) - case *map[int]interface{}: - fastpathTV.EncMapIntIntfV(*v, fastpathCheckNilTrue, e) - - case map[int]string: - fastpathTV.EncMapIntStringV(v, fastpathCheckNilTrue, e) - case *map[int]string: - fastpathTV.EncMapIntStringV(*v, fastpathCheckNilTrue, e) - - case map[int]uint: - fastpathTV.EncMapIntUintV(v, fastpathCheckNilTrue, e) - case *map[int]uint: - fastpathTV.EncMapIntUintV(*v, fastpathCheckNilTrue, e) - - case map[int]uint8: - fastpathTV.EncMapIntUint8V(v, fastpathCheckNilTrue, e) - case *map[int]uint8: - fastpathTV.EncMapIntUint8V(*v, fastpathCheckNilTrue, e) - - case map[int]uint16: - fastpathTV.EncMapIntUint16V(v, fastpathCheckNilTrue, e) - case *map[int]uint16: - fastpathTV.EncMapIntUint16V(*v, fastpathCheckNilTrue, e) - - case map[int]uint32: - fastpathTV.EncMapIntUint32V(v, fastpathCheckNilTrue, e) - case *map[int]uint32: - fastpathTV.EncMapIntUint32V(*v, fastpathCheckNilTrue, e) - - case map[int]uint64: - fastpathTV.EncMapIntUint64V(v, fastpathCheckNilTrue, e) - case *map[int]uint64: - fastpathTV.EncMapIntUint64V(*v, fastpathCheckNilTrue, e) - - case map[int]uintptr: - fastpathTV.EncMapIntUintptrV(v, fastpathCheckNilTrue, e) - case *map[int]uintptr: - fastpathTV.EncMapIntUintptrV(*v, fastpathCheckNilTrue, e) - - case map[int]int: - fastpathTV.EncMapIntIntV(v, fastpathCheckNilTrue, e) - case *map[int]int: - fastpathTV.EncMapIntIntV(*v, fastpathCheckNilTrue, e) - - case map[int]int8: - fastpathTV.EncMapIntInt8V(v, fastpathCheckNilTrue, e) - case *map[int]int8: - fastpathTV.EncMapIntInt8V(*v, fastpathCheckNilTrue, e) - - case map[int]int16: - fastpathTV.EncMapIntInt16V(v, fastpathCheckNilTrue, e) - case *map[int]int16: - fastpathTV.EncMapIntInt16V(*v, fastpathCheckNilTrue, e) - - case map[int]int32: - fastpathTV.EncMapIntInt32V(v, fastpathCheckNilTrue, e) - case *map[int]int32: - fastpathTV.EncMapIntInt32V(*v, fastpathCheckNilTrue, e) - - case map[int]int64: - fastpathTV.EncMapIntInt64V(v, fastpathCheckNilTrue, e) - case *map[int]int64: - fastpathTV.EncMapIntInt64V(*v, fastpathCheckNilTrue, e) - - case map[int]float32: - fastpathTV.EncMapIntFloat32V(v, fastpathCheckNilTrue, e) - case *map[int]float32: - fastpathTV.EncMapIntFloat32V(*v, fastpathCheckNilTrue, e) - - case map[int]float64: - fastpathTV.EncMapIntFloat64V(v, fastpathCheckNilTrue, e) - case *map[int]float64: - fastpathTV.EncMapIntFloat64V(*v, fastpathCheckNilTrue, e) - - case map[int]bool: - fastpathTV.EncMapIntBoolV(v, fastpathCheckNilTrue, e) - case *map[int]bool: - fastpathTV.EncMapIntBoolV(*v, fastpathCheckNilTrue, e) - - case map[int8]interface{}: - fastpathTV.EncMapInt8IntfV(v, fastpathCheckNilTrue, e) - case *map[int8]interface{}: - fastpathTV.EncMapInt8IntfV(*v, fastpathCheckNilTrue, e) - - case map[int8]string: - fastpathTV.EncMapInt8StringV(v, fastpathCheckNilTrue, e) - case *map[int8]string: - fastpathTV.EncMapInt8StringV(*v, fastpathCheckNilTrue, e) - - case map[int8]uint: - fastpathTV.EncMapInt8UintV(v, fastpathCheckNilTrue, e) - case *map[int8]uint: - fastpathTV.EncMapInt8UintV(*v, fastpathCheckNilTrue, e) - - case map[int8]uint8: - fastpathTV.EncMapInt8Uint8V(v, fastpathCheckNilTrue, e) - case *map[int8]uint8: - fastpathTV.EncMapInt8Uint8V(*v, fastpathCheckNilTrue, e) - - case map[int8]uint16: - fastpathTV.EncMapInt8Uint16V(v, fastpathCheckNilTrue, e) - case *map[int8]uint16: - fastpathTV.EncMapInt8Uint16V(*v, fastpathCheckNilTrue, e) - - case map[int8]uint32: - fastpathTV.EncMapInt8Uint32V(v, fastpathCheckNilTrue, e) - case *map[int8]uint32: - fastpathTV.EncMapInt8Uint32V(*v, fastpathCheckNilTrue, e) - - case map[int8]uint64: - fastpathTV.EncMapInt8Uint64V(v, fastpathCheckNilTrue, e) - case *map[int8]uint64: - fastpathTV.EncMapInt8Uint64V(*v, fastpathCheckNilTrue, e) - - case map[int8]uintptr: - fastpathTV.EncMapInt8UintptrV(v, fastpathCheckNilTrue, e) - case *map[int8]uintptr: - fastpathTV.EncMapInt8UintptrV(*v, fastpathCheckNilTrue, e) - - case map[int8]int: - fastpathTV.EncMapInt8IntV(v, fastpathCheckNilTrue, e) - case *map[int8]int: - fastpathTV.EncMapInt8IntV(*v, fastpathCheckNilTrue, e) - - case map[int8]int8: - fastpathTV.EncMapInt8Int8V(v, fastpathCheckNilTrue, e) - case *map[int8]int8: - fastpathTV.EncMapInt8Int8V(*v, fastpathCheckNilTrue, e) - - case map[int8]int16: - fastpathTV.EncMapInt8Int16V(v, fastpathCheckNilTrue, e) - case *map[int8]int16: - fastpathTV.EncMapInt8Int16V(*v, fastpathCheckNilTrue, e) - - case map[int8]int32: - fastpathTV.EncMapInt8Int32V(v, fastpathCheckNilTrue, e) - case *map[int8]int32: - fastpathTV.EncMapInt8Int32V(*v, fastpathCheckNilTrue, e) - - case map[int8]int64: - fastpathTV.EncMapInt8Int64V(v, fastpathCheckNilTrue, e) - case *map[int8]int64: - fastpathTV.EncMapInt8Int64V(*v, fastpathCheckNilTrue, e) - - case map[int8]float32: - fastpathTV.EncMapInt8Float32V(v, fastpathCheckNilTrue, e) - case *map[int8]float32: - fastpathTV.EncMapInt8Float32V(*v, fastpathCheckNilTrue, e) - - case map[int8]float64: - fastpathTV.EncMapInt8Float64V(v, fastpathCheckNilTrue, e) - case *map[int8]float64: - fastpathTV.EncMapInt8Float64V(*v, fastpathCheckNilTrue, e) - - case map[int8]bool: - fastpathTV.EncMapInt8BoolV(v, fastpathCheckNilTrue, e) - case *map[int8]bool: - fastpathTV.EncMapInt8BoolV(*v, fastpathCheckNilTrue, e) - - case map[int16]interface{}: - fastpathTV.EncMapInt16IntfV(v, fastpathCheckNilTrue, e) - case *map[int16]interface{}: - fastpathTV.EncMapInt16IntfV(*v, fastpathCheckNilTrue, e) - - case map[int16]string: - fastpathTV.EncMapInt16StringV(v, fastpathCheckNilTrue, e) - case *map[int16]string: - fastpathTV.EncMapInt16StringV(*v, fastpathCheckNilTrue, e) - - case map[int16]uint: - fastpathTV.EncMapInt16UintV(v, fastpathCheckNilTrue, e) - case *map[int16]uint: - fastpathTV.EncMapInt16UintV(*v, fastpathCheckNilTrue, e) - - case map[int16]uint8: - fastpathTV.EncMapInt16Uint8V(v, fastpathCheckNilTrue, e) - case *map[int16]uint8: - fastpathTV.EncMapInt16Uint8V(*v, fastpathCheckNilTrue, e) - - case map[int16]uint16: - fastpathTV.EncMapInt16Uint16V(v, fastpathCheckNilTrue, e) - case *map[int16]uint16: - fastpathTV.EncMapInt16Uint16V(*v, fastpathCheckNilTrue, e) - - case map[int16]uint32: - fastpathTV.EncMapInt16Uint32V(v, fastpathCheckNilTrue, e) - case *map[int16]uint32: - fastpathTV.EncMapInt16Uint32V(*v, fastpathCheckNilTrue, e) - - case map[int16]uint64: - fastpathTV.EncMapInt16Uint64V(v, fastpathCheckNilTrue, e) - case *map[int16]uint64: - fastpathTV.EncMapInt16Uint64V(*v, fastpathCheckNilTrue, e) - - case map[int16]uintptr: - fastpathTV.EncMapInt16UintptrV(v, fastpathCheckNilTrue, e) - case *map[int16]uintptr: - fastpathTV.EncMapInt16UintptrV(*v, fastpathCheckNilTrue, e) - - case map[int16]int: - fastpathTV.EncMapInt16IntV(v, fastpathCheckNilTrue, e) - case *map[int16]int: - fastpathTV.EncMapInt16IntV(*v, fastpathCheckNilTrue, e) - - case map[int16]int8: - fastpathTV.EncMapInt16Int8V(v, fastpathCheckNilTrue, e) - case *map[int16]int8: - fastpathTV.EncMapInt16Int8V(*v, fastpathCheckNilTrue, e) - - case map[int16]int16: - fastpathTV.EncMapInt16Int16V(v, fastpathCheckNilTrue, e) - case *map[int16]int16: - fastpathTV.EncMapInt16Int16V(*v, fastpathCheckNilTrue, e) - - case map[int16]int32: - fastpathTV.EncMapInt16Int32V(v, fastpathCheckNilTrue, e) - case *map[int16]int32: - fastpathTV.EncMapInt16Int32V(*v, fastpathCheckNilTrue, e) - - case map[int16]int64: - fastpathTV.EncMapInt16Int64V(v, fastpathCheckNilTrue, e) - case *map[int16]int64: - fastpathTV.EncMapInt16Int64V(*v, fastpathCheckNilTrue, e) - - case map[int16]float32: - fastpathTV.EncMapInt16Float32V(v, fastpathCheckNilTrue, e) - case *map[int16]float32: - fastpathTV.EncMapInt16Float32V(*v, fastpathCheckNilTrue, e) - - case map[int16]float64: - fastpathTV.EncMapInt16Float64V(v, fastpathCheckNilTrue, e) - case *map[int16]float64: - fastpathTV.EncMapInt16Float64V(*v, fastpathCheckNilTrue, e) - - case map[int16]bool: - fastpathTV.EncMapInt16BoolV(v, fastpathCheckNilTrue, e) - case *map[int16]bool: - fastpathTV.EncMapInt16BoolV(*v, fastpathCheckNilTrue, e) - - case map[int32]interface{}: - fastpathTV.EncMapInt32IntfV(v, fastpathCheckNilTrue, e) - case *map[int32]interface{}: - fastpathTV.EncMapInt32IntfV(*v, fastpathCheckNilTrue, e) - - case map[int32]string: - fastpathTV.EncMapInt32StringV(v, fastpathCheckNilTrue, e) - case *map[int32]string: - fastpathTV.EncMapInt32StringV(*v, fastpathCheckNilTrue, e) - - case map[int32]uint: - fastpathTV.EncMapInt32UintV(v, fastpathCheckNilTrue, e) - case *map[int32]uint: - fastpathTV.EncMapInt32UintV(*v, fastpathCheckNilTrue, e) - - case map[int32]uint8: - fastpathTV.EncMapInt32Uint8V(v, fastpathCheckNilTrue, e) - case *map[int32]uint8: - fastpathTV.EncMapInt32Uint8V(*v, fastpathCheckNilTrue, e) - - case map[int32]uint16: - fastpathTV.EncMapInt32Uint16V(v, fastpathCheckNilTrue, e) - case *map[int32]uint16: - fastpathTV.EncMapInt32Uint16V(*v, fastpathCheckNilTrue, e) - - case map[int32]uint32: - fastpathTV.EncMapInt32Uint32V(v, fastpathCheckNilTrue, e) - case *map[int32]uint32: - fastpathTV.EncMapInt32Uint32V(*v, fastpathCheckNilTrue, e) - - case map[int32]uint64: - fastpathTV.EncMapInt32Uint64V(v, fastpathCheckNilTrue, e) - case *map[int32]uint64: - fastpathTV.EncMapInt32Uint64V(*v, fastpathCheckNilTrue, e) - - case map[int32]uintptr: - fastpathTV.EncMapInt32UintptrV(v, fastpathCheckNilTrue, e) - case *map[int32]uintptr: - fastpathTV.EncMapInt32UintptrV(*v, fastpathCheckNilTrue, e) - - case map[int32]int: - fastpathTV.EncMapInt32IntV(v, fastpathCheckNilTrue, e) - case *map[int32]int: - fastpathTV.EncMapInt32IntV(*v, fastpathCheckNilTrue, e) - - case map[int32]int8: - fastpathTV.EncMapInt32Int8V(v, fastpathCheckNilTrue, e) - case *map[int32]int8: - fastpathTV.EncMapInt32Int8V(*v, fastpathCheckNilTrue, e) - - case map[int32]int16: - fastpathTV.EncMapInt32Int16V(v, fastpathCheckNilTrue, e) - case *map[int32]int16: - fastpathTV.EncMapInt32Int16V(*v, fastpathCheckNilTrue, e) - - case map[int32]int32: - fastpathTV.EncMapInt32Int32V(v, fastpathCheckNilTrue, e) - case *map[int32]int32: - fastpathTV.EncMapInt32Int32V(*v, fastpathCheckNilTrue, e) - - case map[int32]int64: - fastpathTV.EncMapInt32Int64V(v, fastpathCheckNilTrue, e) - case *map[int32]int64: - fastpathTV.EncMapInt32Int64V(*v, fastpathCheckNilTrue, e) - - case map[int32]float32: - fastpathTV.EncMapInt32Float32V(v, fastpathCheckNilTrue, e) - case *map[int32]float32: - fastpathTV.EncMapInt32Float32V(*v, fastpathCheckNilTrue, e) - - case map[int32]float64: - fastpathTV.EncMapInt32Float64V(v, fastpathCheckNilTrue, e) - case *map[int32]float64: - fastpathTV.EncMapInt32Float64V(*v, fastpathCheckNilTrue, e) - - case map[int32]bool: - fastpathTV.EncMapInt32BoolV(v, fastpathCheckNilTrue, e) - case *map[int32]bool: - fastpathTV.EncMapInt32BoolV(*v, fastpathCheckNilTrue, e) - - case map[int64]interface{}: - fastpathTV.EncMapInt64IntfV(v, fastpathCheckNilTrue, e) - case *map[int64]interface{}: - fastpathTV.EncMapInt64IntfV(*v, fastpathCheckNilTrue, e) - - case map[int64]string: - fastpathTV.EncMapInt64StringV(v, fastpathCheckNilTrue, e) - case *map[int64]string: - fastpathTV.EncMapInt64StringV(*v, fastpathCheckNilTrue, e) - - case map[int64]uint: - fastpathTV.EncMapInt64UintV(v, fastpathCheckNilTrue, e) - case *map[int64]uint: - fastpathTV.EncMapInt64UintV(*v, fastpathCheckNilTrue, e) - - case map[int64]uint8: - fastpathTV.EncMapInt64Uint8V(v, fastpathCheckNilTrue, e) - case *map[int64]uint8: - fastpathTV.EncMapInt64Uint8V(*v, fastpathCheckNilTrue, e) - - case map[int64]uint16: - fastpathTV.EncMapInt64Uint16V(v, fastpathCheckNilTrue, e) - case *map[int64]uint16: - fastpathTV.EncMapInt64Uint16V(*v, fastpathCheckNilTrue, e) - - case map[int64]uint32: - fastpathTV.EncMapInt64Uint32V(v, fastpathCheckNilTrue, e) - case *map[int64]uint32: - fastpathTV.EncMapInt64Uint32V(*v, fastpathCheckNilTrue, e) - - case map[int64]uint64: - fastpathTV.EncMapInt64Uint64V(v, fastpathCheckNilTrue, e) - case *map[int64]uint64: - fastpathTV.EncMapInt64Uint64V(*v, fastpathCheckNilTrue, e) - - case map[int64]uintptr: - fastpathTV.EncMapInt64UintptrV(v, fastpathCheckNilTrue, e) - case *map[int64]uintptr: - fastpathTV.EncMapInt64UintptrV(*v, fastpathCheckNilTrue, e) - - case map[int64]int: - fastpathTV.EncMapInt64IntV(v, fastpathCheckNilTrue, e) - case *map[int64]int: - fastpathTV.EncMapInt64IntV(*v, fastpathCheckNilTrue, e) - - case map[int64]int8: - fastpathTV.EncMapInt64Int8V(v, fastpathCheckNilTrue, e) - case *map[int64]int8: - fastpathTV.EncMapInt64Int8V(*v, fastpathCheckNilTrue, e) - - case map[int64]int16: - fastpathTV.EncMapInt64Int16V(v, fastpathCheckNilTrue, e) - case *map[int64]int16: - fastpathTV.EncMapInt64Int16V(*v, fastpathCheckNilTrue, e) - - case map[int64]int32: - fastpathTV.EncMapInt64Int32V(v, fastpathCheckNilTrue, e) - case *map[int64]int32: - fastpathTV.EncMapInt64Int32V(*v, fastpathCheckNilTrue, e) - - case map[int64]int64: - fastpathTV.EncMapInt64Int64V(v, fastpathCheckNilTrue, e) - case *map[int64]int64: - fastpathTV.EncMapInt64Int64V(*v, fastpathCheckNilTrue, e) - - case map[int64]float32: - fastpathTV.EncMapInt64Float32V(v, fastpathCheckNilTrue, e) - case *map[int64]float32: - fastpathTV.EncMapInt64Float32V(*v, fastpathCheckNilTrue, e) - - case map[int64]float64: - fastpathTV.EncMapInt64Float64V(v, fastpathCheckNilTrue, e) - case *map[int64]float64: - fastpathTV.EncMapInt64Float64V(*v, fastpathCheckNilTrue, e) - - case map[int64]bool: - fastpathTV.EncMapInt64BoolV(v, fastpathCheckNilTrue, e) - case *map[int64]bool: - fastpathTV.EncMapInt64BoolV(*v, fastpathCheckNilTrue, e) - - case map[bool]interface{}: - fastpathTV.EncMapBoolIntfV(v, fastpathCheckNilTrue, e) - case *map[bool]interface{}: - fastpathTV.EncMapBoolIntfV(*v, fastpathCheckNilTrue, e) - - case map[bool]string: - fastpathTV.EncMapBoolStringV(v, fastpathCheckNilTrue, e) - case *map[bool]string: - fastpathTV.EncMapBoolStringV(*v, fastpathCheckNilTrue, e) - - case map[bool]uint: - fastpathTV.EncMapBoolUintV(v, fastpathCheckNilTrue, e) - case *map[bool]uint: - fastpathTV.EncMapBoolUintV(*v, fastpathCheckNilTrue, e) - - case map[bool]uint8: - fastpathTV.EncMapBoolUint8V(v, fastpathCheckNilTrue, e) - case *map[bool]uint8: - fastpathTV.EncMapBoolUint8V(*v, fastpathCheckNilTrue, e) - - case map[bool]uint16: - fastpathTV.EncMapBoolUint16V(v, fastpathCheckNilTrue, e) - case *map[bool]uint16: - fastpathTV.EncMapBoolUint16V(*v, fastpathCheckNilTrue, e) - - case map[bool]uint32: - fastpathTV.EncMapBoolUint32V(v, fastpathCheckNilTrue, e) - case *map[bool]uint32: - fastpathTV.EncMapBoolUint32V(*v, fastpathCheckNilTrue, e) - - case map[bool]uint64: - fastpathTV.EncMapBoolUint64V(v, fastpathCheckNilTrue, e) - case *map[bool]uint64: - fastpathTV.EncMapBoolUint64V(*v, fastpathCheckNilTrue, e) - - case map[bool]uintptr: - fastpathTV.EncMapBoolUintptrV(v, fastpathCheckNilTrue, e) - case *map[bool]uintptr: - fastpathTV.EncMapBoolUintptrV(*v, fastpathCheckNilTrue, e) - - case map[bool]int: - fastpathTV.EncMapBoolIntV(v, fastpathCheckNilTrue, e) - case *map[bool]int: - fastpathTV.EncMapBoolIntV(*v, fastpathCheckNilTrue, e) - - case map[bool]int8: - fastpathTV.EncMapBoolInt8V(v, fastpathCheckNilTrue, e) - case *map[bool]int8: - fastpathTV.EncMapBoolInt8V(*v, fastpathCheckNilTrue, e) - - case map[bool]int16: - fastpathTV.EncMapBoolInt16V(v, fastpathCheckNilTrue, e) - case *map[bool]int16: - fastpathTV.EncMapBoolInt16V(*v, fastpathCheckNilTrue, e) - - case map[bool]int32: - fastpathTV.EncMapBoolInt32V(v, fastpathCheckNilTrue, e) - case *map[bool]int32: - fastpathTV.EncMapBoolInt32V(*v, fastpathCheckNilTrue, e) - - case map[bool]int64: - fastpathTV.EncMapBoolInt64V(v, fastpathCheckNilTrue, e) - case *map[bool]int64: - fastpathTV.EncMapBoolInt64V(*v, fastpathCheckNilTrue, e) - - case map[bool]float32: - fastpathTV.EncMapBoolFloat32V(v, fastpathCheckNilTrue, e) - case *map[bool]float32: - fastpathTV.EncMapBoolFloat32V(*v, fastpathCheckNilTrue, e) - - case map[bool]float64: - fastpathTV.EncMapBoolFloat64V(v, fastpathCheckNilTrue, e) - case *map[bool]float64: - fastpathTV.EncMapBoolFloat64V(*v, fastpathCheckNilTrue, e) - - case map[bool]bool: - fastpathTV.EncMapBoolBoolV(v, fastpathCheckNilTrue, e) - case *map[bool]bool: - fastpathTV.EncMapBoolBoolV(*v, fastpathCheckNilTrue, e) - - default: - _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) + _ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4 return false } return true @@ -3113,812 +1465,816 @@ func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { // -- -- fast path functions -func (f *encFnInfo) fastpathEncSliceIntfR(rv reflect.Value) { +func (e *Encoder) fastpathEncSliceIntfR(f *codecFnInfo, rv reflect.Value) { if f.ti.mbs { - fastpathTV.EncAsMapSliceIntfV(rv.Interface().([]interface{}), fastpathCheckNilFalse, f.e) + fastpathTV.EncAsMapSliceIntfV(rv2i(rv).([]interface{}), e) } else { - fastpathTV.EncSliceIntfV(rv.Interface().([]interface{}), fastpathCheckNilFalse, f.e) + fastpathTV.EncSliceIntfV(rv2i(rv).([]interface{}), e) } } -func (_ fastpathT) EncSliceIntfV(v []interface{}, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncSliceIntfV(v []interface{}, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeArrayStart(len(v)) - for _, v2 := range v { - if cr != nil { - cr.sendContainerState(containerArrayElem) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteArrayStart(len(v)) + if esep { + for _, v2 := range v { + ee.WriteArrayElem() + e.encode(v2) + } + } else { + for _, v2 := range v { + e.encode(v2) } - e.encode(v2) - } - if cr != nil { - cr.sendContainerState(containerArrayEnd) } + ee.WriteArrayEnd() } - -func (_ fastpathT) EncAsMapSliceIntfV(v []interface{}, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() - return - } +func (_ fastpathT) EncAsMapSliceIntfV(v []interface{}, e *Encoder) { + ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { e.errorf("mapBySlice requires even slice length, but got %v", len(v)) return } - ee.EncodeMapStart(len(v) / 2) - for j, v2 := range v { - if cr != nil { + ee.WriteMapStart(len(v) / 2) + if esep { + for j, v2 := range v { if j%2 == 0 { - cr.sendContainerState(containerMapKey) + ee.WriteMapElemKey() } else { - cr.sendContainerState(containerMapValue) + ee.WriteMapElemValue() } + e.encode(v2) } - e.encode(v2) - } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } -} - -func (f *encFnInfo) fastpathEncSliceStringR(rv reflect.Value) { - if f.ti.mbs { - fastpathTV.EncAsMapSliceStringV(rv.Interface().([]string), fastpathCheckNilFalse, f.e) } else { - fastpathTV.EncSliceStringV(rv.Interface().([]string), fastpathCheckNilFalse, f.e) - } -} -func (_ fastpathT) EncSliceStringV(v []string, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() - return - } - ee.EncodeArrayStart(len(v)) - for _, v2 := range v { - if cr != nil { - cr.sendContainerState(containerArrayElem) + for _, v2 := range v { + e.encode(v2) } - ee.EncodeString(c_UTF8, v2) - } - if cr != nil { - cr.sendContainerState(containerArrayEnd) } + ee.WriteMapEnd() } -func (_ fastpathT) EncAsMapSliceStringV(v []string, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (e *Encoder) fastpathEncSliceStringR(f *codecFnInfo, rv reflect.Value) { + if f.ti.mbs { + fastpathTV.EncAsMapSliceStringV(rv2i(rv).([]string), e) + } else { + fastpathTV.EncSliceStringV(rv2i(rv).([]string), e) + } +} +func (_ fastpathT) EncSliceStringV(v []string, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteArrayStart(len(v)) + if esep { + for _, v2 := range v { + ee.WriteArrayElem() + ee.EncodeString(cUTF8, v2) + } + } else { + for _, v2 := range v { + ee.EncodeString(cUTF8, v2) + } + } + ee.WriteArrayEnd() +} +func (_ fastpathT) EncAsMapSliceStringV(v []string, e *Encoder) { + ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { e.errorf("mapBySlice requires even slice length, but got %v", len(v)) return } - ee.EncodeMapStart(len(v) / 2) - for j, v2 := range v { - if cr != nil { + ee.WriteMapStart(len(v) / 2) + if esep { + for j, v2 := range v { if j%2 == 0 { - cr.sendContainerState(containerMapKey) + ee.WriteMapElemKey() } else { - cr.sendContainerState(containerMapValue) + ee.WriteMapElemValue() } + ee.EncodeString(cUTF8, v2) } - ee.EncodeString(c_UTF8, v2) - } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } -} - -func (f *encFnInfo) fastpathEncSliceFloat32R(rv reflect.Value) { - if f.ti.mbs { - fastpathTV.EncAsMapSliceFloat32V(rv.Interface().([]float32), fastpathCheckNilFalse, f.e) } else { - fastpathTV.EncSliceFloat32V(rv.Interface().([]float32), fastpathCheckNilFalse, f.e) - } -} -func (_ fastpathT) EncSliceFloat32V(v []float32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() - return - } - ee.EncodeArrayStart(len(v)) - for _, v2 := range v { - if cr != nil { - cr.sendContainerState(containerArrayElem) + for _, v2 := range v { + ee.EncodeString(cUTF8, v2) } - ee.EncodeFloat32(v2) - } - if cr != nil { - cr.sendContainerState(containerArrayEnd) } + ee.WriteMapEnd() } -func (_ fastpathT) EncAsMapSliceFloat32V(v []float32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (e *Encoder) fastpathEncSliceFloat32R(f *codecFnInfo, rv reflect.Value) { + if f.ti.mbs { + fastpathTV.EncAsMapSliceFloat32V(rv2i(rv).([]float32), e) + } else { + fastpathTV.EncSliceFloat32V(rv2i(rv).([]float32), e) + } +} +func (_ fastpathT) EncSliceFloat32V(v []float32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteArrayStart(len(v)) + if esep { + for _, v2 := range v { + ee.WriteArrayElem() + ee.EncodeFloat32(v2) + } + } else { + for _, v2 := range v { + ee.EncodeFloat32(v2) + } + } + ee.WriteArrayEnd() +} +func (_ fastpathT) EncAsMapSliceFloat32V(v []float32, e *Encoder) { + ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { e.errorf("mapBySlice requires even slice length, but got %v", len(v)) return } - ee.EncodeMapStart(len(v) / 2) - for j, v2 := range v { - if cr != nil { + ee.WriteMapStart(len(v) / 2) + if esep { + for j, v2 := range v { if j%2 == 0 { - cr.sendContainerState(containerMapKey) + ee.WriteMapElemKey() } else { - cr.sendContainerState(containerMapValue) + ee.WriteMapElemValue() } + ee.EncodeFloat32(v2) } - ee.EncodeFloat32(v2) - } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } -} - -func (f *encFnInfo) fastpathEncSliceFloat64R(rv reflect.Value) { - if f.ti.mbs { - fastpathTV.EncAsMapSliceFloat64V(rv.Interface().([]float64), fastpathCheckNilFalse, f.e) } else { - fastpathTV.EncSliceFloat64V(rv.Interface().([]float64), fastpathCheckNilFalse, f.e) - } -} -func (_ fastpathT) EncSliceFloat64V(v []float64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() - return - } - ee.EncodeArrayStart(len(v)) - for _, v2 := range v { - if cr != nil { - cr.sendContainerState(containerArrayElem) + for _, v2 := range v { + ee.EncodeFloat32(v2) } - ee.EncodeFloat64(v2) - } - if cr != nil { - cr.sendContainerState(containerArrayEnd) } + ee.WriteMapEnd() } -func (_ fastpathT) EncAsMapSliceFloat64V(v []float64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (e *Encoder) fastpathEncSliceFloat64R(f *codecFnInfo, rv reflect.Value) { + if f.ti.mbs { + fastpathTV.EncAsMapSliceFloat64V(rv2i(rv).([]float64), e) + } else { + fastpathTV.EncSliceFloat64V(rv2i(rv).([]float64), e) + } +} +func (_ fastpathT) EncSliceFloat64V(v []float64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteArrayStart(len(v)) + if esep { + for _, v2 := range v { + ee.WriteArrayElem() + ee.EncodeFloat64(v2) + } + } else { + for _, v2 := range v { + ee.EncodeFloat64(v2) + } + } + ee.WriteArrayEnd() +} +func (_ fastpathT) EncAsMapSliceFloat64V(v []float64, e *Encoder) { + ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { e.errorf("mapBySlice requires even slice length, but got %v", len(v)) return } - ee.EncodeMapStart(len(v) / 2) - for j, v2 := range v { - if cr != nil { + ee.WriteMapStart(len(v) / 2) + if esep { + for j, v2 := range v { if j%2 == 0 { - cr.sendContainerState(containerMapKey) + ee.WriteMapElemKey() } else { - cr.sendContainerState(containerMapValue) + ee.WriteMapElemValue() } + ee.EncodeFloat64(v2) } - ee.EncodeFloat64(v2) - } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } -} - -func (f *encFnInfo) fastpathEncSliceUintR(rv reflect.Value) { - if f.ti.mbs { - fastpathTV.EncAsMapSliceUintV(rv.Interface().([]uint), fastpathCheckNilFalse, f.e) } else { - fastpathTV.EncSliceUintV(rv.Interface().([]uint), fastpathCheckNilFalse, f.e) - } -} -func (_ fastpathT) EncSliceUintV(v []uint, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() - return - } - ee.EncodeArrayStart(len(v)) - for _, v2 := range v { - if cr != nil { - cr.sendContainerState(containerArrayElem) + for _, v2 := range v { + ee.EncodeFloat64(v2) } - ee.EncodeUint(uint64(v2)) - } - if cr != nil { - cr.sendContainerState(containerArrayEnd) } + ee.WriteMapEnd() } -func (_ fastpathT) EncAsMapSliceUintV(v []uint, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (e *Encoder) fastpathEncSliceUintR(f *codecFnInfo, rv reflect.Value) { + if f.ti.mbs { + fastpathTV.EncAsMapSliceUintV(rv2i(rv).([]uint), e) + } else { + fastpathTV.EncSliceUintV(rv2i(rv).([]uint), e) + } +} +func (_ fastpathT) EncSliceUintV(v []uint, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteArrayStart(len(v)) + if esep { + for _, v2 := range v { + ee.WriteArrayElem() + ee.EncodeUint(uint64(v2)) + } + } else { + for _, v2 := range v { + ee.EncodeUint(uint64(v2)) + } + } + ee.WriteArrayEnd() +} +func (_ fastpathT) EncAsMapSliceUintV(v []uint, e *Encoder) { + ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { e.errorf("mapBySlice requires even slice length, but got %v", len(v)) return } - ee.EncodeMapStart(len(v) / 2) - for j, v2 := range v { - if cr != nil { + ee.WriteMapStart(len(v) / 2) + if esep { + for j, v2 := range v { if j%2 == 0 { - cr.sendContainerState(containerMapKey) + ee.WriteMapElemKey() } else { - cr.sendContainerState(containerMapValue) + ee.WriteMapElemValue() } + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) - } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } -} - -func (f *encFnInfo) fastpathEncSliceUint16R(rv reflect.Value) { - if f.ti.mbs { - fastpathTV.EncAsMapSliceUint16V(rv.Interface().([]uint16), fastpathCheckNilFalse, f.e) } else { - fastpathTV.EncSliceUint16V(rv.Interface().([]uint16), fastpathCheckNilFalse, f.e) - } -} -func (_ fastpathT) EncSliceUint16V(v []uint16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() - return - } - ee.EncodeArrayStart(len(v)) - for _, v2 := range v { - if cr != nil { - cr.sendContainerState(containerArrayElem) + for _, v2 := range v { + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) - } - if cr != nil { - cr.sendContainerState(containerArrayEnd) } + ee.WriteMapEnd() } -func (_ fastpathT) EncAsMapSliceUint16V(v []uint16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (e *Encoder) fastpathEncSliceUint8R(f *codecFnInfo, rv reflect.Value) { + if f.ti.mbs { + fastpathTV.EncAsMapSliceUint8V(rv2i(rv).([]uint8), e) + } else { + fastpathTV.EncSliceUint8V(rv2i(rv).([]uint8), e) + } +} +func (_ fastpathT) EncSliceUint8V(v []uint8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteArrayStart(len(v)) + if esep { + for _, v2 := range v { + ee.WriteArrayElem() + ee.EncodeUint(uint64(v2)) + } + } else { + for _, v2 := range v { + ee.EncodeUint(uint64(v2)) + } + } + ee.WriteArrayEnd() +} +func (_ fastpathT) EncAsMapSliceUint8V(v []uint8, e *Encoder) { + ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { e.errorf("mapBySlice requires even slice length, but got %v", len(v)) return } - ee.EncodeMapStart(len(v) / 2) - for j, v2 := range v { - if cr != nil { + ee.WriteMapStart(len(v) / 2) + if esep { + for j, v2 := range v { if j%2 == 0 { - cr.sendContainerState(containerMapKey) + ee.WriteMapElemKey() } else { - cr.sendContainerState(containerMapValue) + ee.WriteMapElemValue() } + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) - } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } -} - -func (f *encFnInfo) fastpathEncSliceUint32R(rv reflect.Value) { - if f.ti.mbs { - fastpathTV.EncAsMapSliceUint32V(rv.Interface().([]uint32), fastpathCheckNilFalse, f.e) } else { - fastpathTV.EncSliceUint32V(rv.Interface().([]uint32), fastpathCheckNilFalse, f.e) - } -} -func (_ fastpathT) EncSliceUint32V(v []uint32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() - return - } - ee.EncodeArrayStart(len(v)) - for _, v2 := range v { - if cr != nil { - cr.sendContainerState(containerArrayElem) + for _, v2 := range v { + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) - } - if cr != nil { - cr.sendContainerState(containerArrayEnd) } + ee.WriteMapEnd() } -func (_ fastpathT) EncAsMapSliceUint32V(v []uint32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (e *Encoder) fastpathEncSliceUint16R(f *codecFnInfo, rv reflect.Value) { + if f.ti.mbs { + fastpathTV.EncAsMapSliceUint16V(rv2i(rv).([]uint16), e) + } else { + fastpathTV.EncSliceUint16V(rv2i(rv).([]uint16), e) + } +} +func (_ fastpathT) EncSliceUint16V(v []uint16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteArrayStart(len(v)) + if esep { + for _, v2 := range v { + ee.WriteArrayElem() + ee.EncodeUint(uint64(v2)) + } + } else { + for _, v2 := range v { + ee.EncodeUint(uint64(v2)) + } + } + ee.WriteArrayEnd() +} +func (_ fastpathT) EncAsMapSliceUint16V(v []uint16, e *Encoder) { + ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { e.errorf("mapBySlice requires even slice length, but got %v", len(v)) return } - ee.EncodeMapStart(len(v) / 2) - for j, v2 := range v { - if cr != nil { + ee.WriteMapStart(len(v) / 2) + if esep { + for j, v2 := range v { if j%2 == 0 { - cr.sendContainerState(containerMapKey) + ee.WriteMapElemKey() } else { - cr.sendContainerState(containerMapValue) + ee.WriteMapElemValue() } + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) - } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } -} - -func (f *encFnInfo) fastpathEncSliceUint64R(rv reflect.Value) { - if f.ti.mbs { - fastpathTV.EncAsMapSliceUint64V(rv.Interface().([]uint64), fastpathCheckNilFalse, f.e) } else { - fastpathTV.EncSliceUint64V(rv.Interface().([]uint64), fastpathCheckNilFalse, f.e) - } -} -func (_ fastpathT) EncSliceUint64V(v []uint64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() - return - } - ee.EncodeArrayStart(len(v)) - for _, v2 := range v { - if cr != nil { - cr.sendContainerState(containerArrayElem) + for _, v2 := range v { + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) - } - if cr != nil { - cr.sendContainerState(containerArrayEnd) } + ee.WriteMapEnd() } -func (_ fastpathT) EncAsMapSliceUint64V(v []uint64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (e *Encoder) fastpathEncSliceUint32R(f *codecFnInfo, rv reflect.Value) { + if f.ti.mbs { + fastpathTV.EncAsMapSliceUint32V(rv2i(rv).([]uint32), e) + } else { + fastpathTV.EncSliceUint32V(rv2i(rv).([]uint32), e) + } +} +func (_ fastpathT) EncSliceUint32V(v []uint32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteArrayStart(len(v)) + if esep { + for _, v2 := range v { + ee.WriteArrayElem() + ee.EncodeUint(uint64(v2)) + } + } else { + for _, v2 := range v { + ee.EncodeUint(uint64(v2)) + } + } + ee.WriteArrayEnd() +} +func (_ fastpathT) EncAsMapSliceUint32V(v []uint32, e *Encoder) { + ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { e.errorf("mapBySlice requires even slice length, but got %v", len(v)) return } - ee.EncodeMapStart(len(v) / 2) - for j, v2 := range v { - if cr != nil { + ee.WriteMapStart(len(v) / 2) + if esep { + for j, v2 := range v { if j%2 == 0 { - cr.sendContainerState(containerMapKey) + ee.WriteMapElemKey() } else { - cr.sendContainerState(containerMapValue) + ee.WriteMapElemValue() } + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) - } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } -} - -func (f *encFnInfo) fastpathEncSliceUintptrR(rv reflect.Value) { - if f.ti.mbs { - fastpathTV.EncAsMapSliceUintptrV(rv.Interface().([]uintptr), fastpathCheckNilFalse, f.e) } else { - fastpathTV.EncSliceUintptrV(rv.Interface().([]uintptr), fastpathCheckNilFalse, f.e) - } -} -func (_ fastpathT) EncSliceUintptrV(v []uintptr, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() - return - } - ee.EncodeArrayStart(len(v)) - for _, v2 := range v { - if cr != nil { - cr.sendContainerState(containerArrayElem) + for _, v2 := range v { + ee.EncodeUint(uint64(v2)) } - e.encode(v2) - } - if cr != nil { - cr.sendContainerState(containerArrayEnd) } + ee.WriteMapEnd() } -func (_ fastpathT) EncAsMapSliceUintptrV(v []uintptr, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (e *Encoder) fastpathEncSliceUint64R(f *codecFnInfo, rv reflect.Value) { + if f.ti.mbs { + fastpathTV.EncAsMapSliceUint64V(rv2i(rv).([]uint64), e) + } else { + fastpathTV.EncSliceUint64V(rv2i(rv).([]uint64), e) + } +} +func (_ fastpathT) EncSliceUint64V(v []uint64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteArrayStart(len(v)) + if esep { + for _, v2 := range v { + ee.WriteArrayElem() + ee.EncodeUint(uint64(v2)) + } + } else { + for _, v2 := range v { + ee.EncodeUint(uint64(v2)) + } + } + ee.WriteArrayEnd() +} +func (_ fastpathT) EncAsMapSliceUint64V(v []uint64, e *Encoder) { + ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { e.errorf("mapBySlice requires even slice length, but got %v", len(v)) return } - ee.EncodeMapStart(len(v) / 2) - for j, v2 := range v { - if cr != nil { + ee.WriteMapStart(len(v) / 2) + if esep { + for j, v2 := range v { if j%2 == 0 { - cr.sendContainerState(containerMapKey) + ee.WriteMapElemKey() } else { - cr.sendContainerState(containerMapValue) + ee.WriteMapElemValue() } + ee.EncodeUint(uint64(v2)) } - e.encode(v2) - } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } -} - -func (f *encFnInfo) fastpathEncSliceIntR(rv reflect.Value) { - if f.ti.mbs { - fastpathTV.EncAsMapSliceIntV(rv.Interface().([]int), fastpathCheckNilFalse, f.e) } else { - fastpathTV.EncSliceIntV(rv.Interface().([]int), fastpathCheckNilFalse, f.e) - } -} -func (_ fastpathT) EncSliceIntV(v []int, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() - return - } - ee.EncodeArrayStart(len(v)) - for _, v2 := range v { - if cr != nil { - cr.sendContainerState(containerArrayElem) + for _, v2 := range v { + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(v2)) - } - if cr != nil { - cr.sendContainerState(containerArrayEnd) } + ee.WriteMapEnd() } -func (_ fastpathT) EncAsMapSliceIntV(v []int, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (e *Encoder) fastpathEncSliceUintptrR(f *codecFnInfo, rv reflect.Value) { + if f.ti.mbs { + fastpathTV.EncAsMapSliceUintptrV(rv2i(rv).([]uintptr), e) + } else { + fastpathTV.EncSliceUintptrV(rv2i(rv).([]uintptr), e) + } +} +func (_ fastpathT) EncSliceUintptrV(v []uintptr, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteArrayStart(len(v)) + if esep { + for _, v2 := range v { + ee.WriteArrayElem() + e.encode(v2) + } + } else { + for _, v2 := range v { + e.encode(v2) + } + } + ee.WriteArrayEnd() +} +func (_ fastpathT) EncAsMapSliceUintptrV(v []uintptr, e *Encoder) { + ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { e.errorf("mapBySlice requires even slice length, but got %v", len(v)) return } - ee.EncodeMapStart(len(v) / 2) - for j, v2 := range v { - if cr != nil { + ee.WriteMapStart(len(v) / 2) + if esep { + for j, v2 := range v { if j%2 == 0 { - cr.sendContainerState(containerMapKey) + ee.WriteMapElemKey() } else { - cr.sendContainerState(containerMapValue) + ee.WriteMapElemValue() } + e.encode(v2) } - ee.EncodeInt(int64(v2)) - } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } -} - -func (f *encFnInfo) fastpathEncSliceInt8R(rv reflect.Value) { - if f.ti.mbs { - fastpathTV.EncAsMapSliceInt8V(rv.Interface().([]int8), fastpathCheckNilFalse, f.e) } else { - fastpathTV.EncSliceInt8V(rv.Interface().([]int8), fastpathCheckNilFalse, f.e) - } -} -func (_ fastpathT) EncSliceInt8V(v []int8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() - return - } - ee.EncodeArrayStart(len(v)) - for _, v2 := range v { - if cr != nil { - cr.sendContainerState(containerArrayElem) + for _, v2 := range v { + e.encode(v2) } - ee.EncodeInt(int64(v2)) - } - if cr != nil { - cr.sendContainerState(containerArrayEnd) } + ee.WriteMapEnd() } -func (_ fastpathT) EncAsMapSliceInt8V(v []int8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (e *Encoder) fastpathEncSliceIntR(f *codecFnInfo, rv reflect.Value) { + if f.ti.mbs { + fastpathTV.EncAsMapSliceIntV(rv2i(rv).([]int), e) + } else { + fastpathTV.EncSliceIntV(rv2i(rv).([]int), e) + } +} +func (_ fastpathT) EncSliceIntV(v []int, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteArrayStart(len(v)) + if esep { + for _, v2 := range v { + ee.WriteArrayElem() + ee.EncodeInt(int64(v2)) + } + } else { + for _, v2 := range v { + ee.EncodeInt(int64(v2)) + } + } + ee.WriteArrayEnd() +} +func (_ fastpathT) EncAsMapSliceIntV(v []int, e *Encoder) { + ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { e.errorf("mapBySlice requires even slice length, but got %v", len(v)) return } - ee.EncodeMapStart(len(v) / 2) - for j, v2 := range v { - if cr != nil { + ee.WriteMapStart(len(v) / 2) + if esep { + for j, v2 := range v { if j%2 == 0 { - cr.sendContainerState(containerMapKey) + ee.WriteMapElemKey() } else { - cr.sendContainerState(containerMapValue) + ee.WriteMapElemValue() } + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) - } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } -} - -func (f *encFnInfo) fastpathEncSliceInt16R(rv reflect.Value) { - if f.ti.mbs { - fastpathTV.EncAsMapSliceInt16V(rv.Interface().([]int16), fastpathCheckNilFalse, f.e) } else { - fastpathTV.EncSliceInt16V(rv.Interface().([]int16), fastpathCheckNilFalse, f.e) - } -} -func (_ fastpathT) EncSliceInt16V(v []int16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() - return - } - ee.EncodeArrayStart(len(v)) - for _, v2 := range v { - if cr != nil { - cr.sendContainerState(containerArrayElem) + for _, v2 := range v { + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) - } - if cr != nil { - cr.sendContainerState(containerArrayEnd) } + ee.WriteMapEnd() } -func (_ fastpathT) EncAsMapSliceInt16V(v []int16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (e *Encoder) fastpathEncSliceInt8R(f *codecFnInfo, rv reflect.Value) { + if f.ti.mbs { + fastpathTV.EncAsMapSliceInt8V(rv2i(rv).([]int8), e) + } else { + fastpathTV.EncSliceInt8V(rv2i(rv).([]int8), e) + } +} +func (_ fastpathT) EncSliceInt8V(v []int8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteArrayStart(len(v)) + if esep { + for _, v2 := range v { + ee.WriteArrayElem() + ee.EncodeInt(int64(v2)) + } + } else { + for _, v2 := range v { + ee.EncodeInt(int64(v2)) + } + } + ee.WriteArrayEnd() +} +func (_ fastpathT) EncAsMapSliceInt8V(v []int8, e *Encoder) { + ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { e.errorf("mapBySlice requires even slice length, but got %v", len(v)) return } - ee.EncodeMapStart(len(v) / 2) - for j, v2 := range v { - if cr != nil { + ee.WriteMapStart(len(v) / 2) + if esep { + for j, v2 := range v { if j%2 == 0 { - cr.sendContainerState(containerMapKey) + ee.WriteMapElemKey() } else { - cr.sendContainerState(containerMapValue) + ee.WriteMapElemValue() } + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) - } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } -} - -func (f *encFnInfo) fastpathEncSliceInt32R(rv reflect.Value) { - if f.ti.mbs { - fastpathTV.EncAsMapSliceInt32V(rv.Interface().([]int32), fastpathCheckNilFalse, f.e) } else { - fastpathTV.EncSliceInt32V(rv.Interface().([]int32), fastpathCheckNilFalse, f.e) - } -} -func (_ fastpathT) EncSliceInt32V(v []int32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() - return - } - ee.EncodeArrayStart(len(v)) - for _, v2 := range v { - if cr != nil { - cr.sendContainerState(containerArrayElem) + for _, v2 := range v { + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) - } - if cr != nil { - cr.sendContainerState(containerArrayEnd) } + ee.WriteMapEnd() } -func (_ fastpathT) EncAsMapSliceInt32V(v []int32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (e *Encoder) fastpathEncSliceInt16R(f *codecFnInfo, rv reflect.Value) { + if f.ti.mbs { + fastpathTV.EncAsMapSliceInt16V(rv2i(rv).([]int16), e) + } else { + fastpathTV.EncSliceInt16V(rv2i(rv).([]int16), e) + } +} +func (_ fastpathT) EncSliceInt16V(v []int16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteArrayStart(len(v)) + if esep { + for _, v2 := range v { + ee.WriteArrayElem() + ee.EncodeInt(int64(v2)) + } + } else { + for _, v2 := range v { + ee.EncodeInt(int64(v2)) + } + } + ee.WriteArrayEnd() +} +func (_ fastpathT) EncAsMapSliceInt16V(v []int16, e *Encoder) { + ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { e.errorf("mapBySlice requires even slice length, but got %v", len(v)) return } - ee.EncodeMapStart(len(v) / 2) - for j, v2 := range v { - if cr != nil { + ee.WriteMapStart(len(v) / 2) + if esep { + for j, v2 := range v { if j%2 == 0 { - cr.sendContainerState(containerMapKey) + ee.WriteMapElemKey() } else { - cr.sendContainerState(containerMapValue) + ee.WriteMapElemValue() } + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) - } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } -} - -func (f *encFnInfo) fastpathEncSliceInt64R(rv reflect.Value) { - if f.ti.mbs { - fastpathTV.EncAsMapSliceInt64V(rv.Interface().([]int64), fastpathCheckNilFalse, f.e) } else { - fastpathTV.EncSliceInt64V(rv.Interface().([]int64), fastpathCheckNilFalse, f.e) - } -} -func (_ fastpathT) EncSliceInt64V(v []int64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() - return - } - ee.EncodeArrayStart(len(v)) - for _, v2 := range v { - if cr != nil { - cr.sendContainerState(containerArrayElem) + for _, v2 := range v { + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) - } - if cr != nil { - cr.sendContainerState(containerArrayEnd) } + ee.WriteMapEnd() } -func (_ fastpathT) EncAsMapSliceInt64V(v []int64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (e *Encoder) fastpathEncSliceInt32R(f *codecFnInfo, rv reflect.Value) { + if f.ti.mbs { + fastpathTV.EncAsMapSliceInt32V(rv2i(rv).([]int32), e) + } else { + fastpathTV.EncSliceInt32V(rv2i(rv).([]int32), e) + } +} +func (_ fastpathT) EncSliceInt32V(v []int32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteArrayStart(len(v)) + if esep { + for _, v2 := range v { + ee.WriteArrayElem() + ee.EncodeInt(int64(v2)) + } + } else { + for _, v2 := range v { + ee.EncodeInt(int64(v2)) + } + } + ee.WriteArrayEnd() +} +func (_ fastpathT) EncAsMapSliceInt32V(v []int32, e *Encoder) { + ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { e.errorf("mapBySlice requires even slice length, but got %v", len(v)) return } - ee.EncodeMapStart(len(v) / 2) - for j, v2 := range v { - if cr != nil { + ee.WriteMapStart(len(v) / 2) + if esep { + for j, v2 := range v { if j%2 == 0 { - cr.sendContainerState(containerMapKey) + ee.WriteMapElemKey() } else { - cr.sendContainerState(containerMapValue) + ee.WriteMapElemValue() } + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) - } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } -} - -func (f *encFnInfo) fastpathEncSliceBoolR(rv reflect.Value) { - if f.ti.mbs { - fastpathTV.EncAsMapSliceBoolV(rv.Interface().([]bool), fastpathCheckNilFalse, f.e) } else { - fastpathTV.EncSliceBoolV(rv.Interface().([]bool), fastpathCheckNilFalse, f.e) - } -} -func (_ fastpathT) EncSliceBoolV(v []bool, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() - return - } - ee.EncodeArrayStart(len(v)) - for _, v2 := range v { - if cr != nil { - cr.sendContainerState(containerArrayElem) + for _, v2 := range v { + ee.EncodeInt(int64(v2)) } - ee.EncodeBool(v2) - } - if cr != nil { - cr.sendContainerState(containerArrayEnd) } + ee.WriteMapEnd() } -func (_ fastpathT) EncAsMapSliceBoolV(v []bool, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (e *Encoder) fastpathEncSliceInt64R(f *codecFnInfo, rv reflect.Value) { + if f.ti.mbs { + fastpathTV.EncAsMapSliceInt64V(rv2i(rv).([]int64), e) + } else { + fastpathTV.EncSliceInt64V(rv2i(rv).([]int64), e) + } +} +func (_ fastpathT) EncSliceInt64V(v []int64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteArrayStart(len(v)) + if esep { + for _, v2 := range v { + ee.WriteArrayElem() + ee.EncodeInt(int64(v2)) + } + } else { + for _, v2 := range v { + ee.EncodeInt(int64(v2)) + } + } + ee.WriteArrayEnd() +} +func (_ fastpathT) EncAsMapSliceInt64V(v []int64, e *Encoder) { + ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { e.errorf("mapBySlice requires even slice length, but got %v", len(v)) return } - ee.EncodeMapStart(len(v) / 2) - for j, v2 := range v { - if cr != nil { + ee.WriteMapStart(len(v) / 2) + if esep { + for j, v2 := range v { if j%2 == 0 { - cr.sendContainerState(containerMapKey) + ee.WriteMapElemKey() } else { - cr.sendContainerState(containerMapValue) + ee.WriteMapElemValue() } + ee.EncodeInt(int64(v2)) + } + } else { + for _, v2 := range v { + ee.EncodeInt(int64(v2)) } - ee.EncodeBool(v2) - } - if cr != nil { - cr.sendContainerState(containerMapEnd) } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntfIntfR(rv reflect.Value) { - fastpathTV.EncMapIntfIntfV(rv.Interface().(map[interface{}]interface{}), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncSliceBoolR(f *codecFnInfo, rv reflect.Value) { + if f.ti.mbs { + fastpathTV.EncAsMapSliceBoolV(rv2i(rv).([]bool), e) + } else { + fastpathTV.EncSliceBoolV(rv2i(rv).([]bool), e) + } } -func (_ fastpathT) EncMapIntfIntfV(v map[interface{}]interface{}, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncSliceBoolV(v []bool, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteArrayStart(len(v)) + if esep { + for _, v2 := range v { + ee.WriteArrayElem() + ee.EncodeBool(v2) + } + } else { + for _, v2 := range v { + ee.EncodeBool(v2) + } + } + ee.WriteArrayEnd() +} +func (_ fastpathT) EncAsMapSliceBoolV(v []bool, e *Encoder) { + ee, esep := e.e, e.hh.hasElemSeparators() + if len(v)%2 == 1 { + e.errorf("mapBySlice requires even slice length, but got %v", len(v)) + return + } + ee.WriteMapStart(len(v) / 2) + if esep { + for j, v2 := range v { + if j%2 == 0 { + ee.WriteMapElemKey() + } else { + ee.WriteMapElemValue() + } + ee.EncodeBool(v2) + } + } else { + for _, v2 := range v { + ee.EncodeBool(v2) + } + } + ee.WriteMapEnd() +} + +func (e *Encoder) fastpathEncMapIntfIntfR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntfIntfV(rv2i(rv).(map[interface{}]interface{}), e) +} +func (_ fastpathT) EncMapIntfIntfV(v map[interface{}]interface{}, e *Encoder) { + if v == nil { + e.e.EncodeNil() + return + } + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding e2 := NewEncoderBytes(&mksv, e.hh) @@ -3934,44 +2290,47 @@ func (_ fastpathT) EncMapIntfIntfV(v map[interface{}]interface{}, checkNil bool, i++ } sort.Sort(bytesISlice(v2)) - for j := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for j := range v2 { + ee.WriteMapElemKey() + e.asis(v2[j].v) + ee.WriteMapElemValue() + e.encode(v[v2[j].i]) } - e.asis(v2[j].v) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for j := range v2 { + e.asis(v2[j].v) + e.encode(v[v2[j].i]) } - e.encode(v[v2[j].i]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + e.encode(v2) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntfStringR(rv reflect.Value) { - fastpathTV.EncMapIntfStringV(rv.Interface().(map[interface{}]string), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntfStringR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntfStringV(rv2i(rv).(map[interface{}]string), e) } -func (_ fastpathT) EncMapIntfStringV(v map[interface{}]string, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntfStringV(v map[interface{}]string, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding e2 := NewEncoderBytes(&mksv, e.hh) @@ -3987,44 +2346,47 @@ func (_ fastpathT) EncMapIntfStringV(v map[interface{}]string, checkNil bool, e i++ } sort.Sort(bytesISlice(v2)) - for j := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for j := range v2 { + ee.WriteMapElemKey() + e.asis(v2[j].v) + ee.WriteMapElemValue() + e.encode(v[v2[j].i]) } - e.asis(v2[j].v) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for j := range v2 { + e.asis(v2[j].v) + e.encode(v[v2[j].i]) } - e.encode(v[v2[j].i]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v2) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeString(cUTF8, v2) } - ee.EncodeString(c_UTF8, v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntfUintR(rv reflect.Value) { - fastpathTV.EncMapIntfUintV(rv.Interface().(map[interface{}]uint), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntfUintR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntfUintV(rv2i(rv).(map[interface{}]uint), e) } -func (_ fastpathT) EncMapIntfUintV(v map[interface{}]uint, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntfUintV(v map[interface{}]uint, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding e2 := NewEncoderBytes(&mksv, e.hh) @@ -4040,44 +2402,47 @@ func (_ fastpathT) EncMapIntfUintV(v map[interface{}]uint, checkNil bool, e *Enc i++ } sort.Sort(bytesISlice(v2)) - for j := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for j := range v2 { + ee.WriteMapElemKey() + e.asis(v2[j].v) + ee.WriteMapElemValue() + e.encode(v[v2[j].i]) } - e.asis(v2[j].v) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for j := range v2 { + e.asis(v2[j].v) + e.encode(v[v2[j].i]) } - e.encode(v[v2[j].i]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntfUint8R(rv reflect.Value) { - fastpathTV.EncMapIntfUint8V(rv.Interface().(map[interface{}]uint8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntfUint8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntfUint8V(rv2i(rv).(map[interface{}]uint8), e) } -func (_ fastpathT) EncMapIntfUint8V(v map[interface{}]uint8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntfUint8V(v map[interface{}]uint8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding e2 := NewEncoderBytes(&mksv, e.hh) @@ -4093,44 +2458,47 @@ func (_ fastpathT) EncMapIntfUint8V(v map[interface{}]uint8, checkNil bool, e *E i++ } sort.Sort(bytesISlice(v2)) - for j := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for j := range v2 { + ee.WriteMapElemKey() + e.asis(v2[j].v) + ee.WriteMapElemValue() + e.encode(v[v2[j].i]) } - e.asis(v2[j].v) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for j := range v2 { + e.asis(v2[j].v) + e.encode(v[v2[j].i]) } - e.encode(v[v2[j].i]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntfUint16R(rv reflect.Value) { - fastpathTV.EncMapIntfUint16V(rv.Interface().(map[interface{}]uint16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntfUint16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntfUint16V(rv2i(rv).(map[interface{}]uint16), e) } -func (_ fastpathT) EncMapIntfUint16V(v map[interface{}]uint16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntfUint16V(v map[interface{}]uint16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding e2 := NewEncoderBytes(&mksv, e.hh) @@ -4146,44 +2514,47 @@ func (_ fastpathT) EncMapIntfUint16V(v map[interface{}]uint16, checkNil bool, e i++ } sort.Sort(bytesISlice(v2)) - for j := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for j := range v2 { + ee.WriteMapElemKey() + e.asis(v2[j].v) + ee.WriteMapElemValue() + e.encode(v[v2[j].i]) } - e.asis(v2[j].v) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for j := range v2 { + e.asis(v2[j].v) + e.encode(v[v2[j].i]) } - e.encode(v[v2[j].i]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntfUint32R(rv reflect.Value) { - fastpathTV.EncMapIntfUint32V(rv.Interface().(map[interface{}]uint32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntfUint32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntfUint32V(rv2i(rv).(map[interface{}]uint32), e) } -func (_ fastpathT) EncMapIntfUint32V(v map[interface{}]uint32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntfUint32V(v map[interface{}]uint32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding e2 := NewEncoderBytes(&mksv, e.hh) @@ -4199,44 +2570,47 @@ func (_ fastpathT) EncMapIntfUint32V(v map[interface{}]uint32, checkNil bool, e i++ } sort.Sort(bytesISlice(v2)) - for j := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for j := range v2 { + ee.WriteMapElemKey() + e.asis(v2[j].v) + ee.WriteMapElemValue() + e.encode(v[v2[j].i]) } - e.asis(v2[j].v) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for j := range v2 { + e.asis(v2[j].v) + e.encode(v[v2[j].i]) } - e.encode(v[v2[j].i]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntfUint64R(rv reflect.Value) { - fastpathTV.EncMapIntfUint64V(rv.Interface().(map[interface{}]uint64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntfUint64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntfUint64V(rv2i(rv).(map[interface{}]uint64), e) } -func (_ fastpathT) EncMapIntfUint64V(v map[interface{}]uint64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntfUint64V(v map[interface{}]uint64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding e2 := NewEncoderBytes(&mksv, e.hh) @@ -4252,44 +2626,47 @@ func (_ fastpathT) EncMapIntfUint64V(v map[interface{}]uint64, checkNil bool, e i++ } sort.Sort(bytesISlice(v2)) - for j := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for j := range v2 { + ee.WriteMapElemKey() + e.asis(v2[j].v) + ee.WriteMapElemValue() + e.encode(v[v2[j].i]) } - e.asis(v2[j].v) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for j := range v2 { + e.asis(v2[j].v) + e.encode(v[v2[j].i]) } - e.encode(v[v2[j].i]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntfUintptrR(rv reflect.Value) { - fastpathTV.EncMapIntfUintptrV(rv.Interface().(map[interface{}]uintptr), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntfUintptrR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntfUintptrV(rv2i(rv).(map[interface{}]uintptr), e) } -func (_ fastpathT) EncMapIntfUintptrV(v map[interface{}]uintptr, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntfUintptrV(v map[interface{}]uintptr, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding e2 := NewEncoderBytes(&mksv, e.hh) @@ -4305,44 +2682,47 @@ func (_ fastpathT) EncMapIntfUintptrV(v map[interface{}]uintptr, checkNil bool, i++ } sort.Sort(bytesISlice(v2)) - for j := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for j := range v2 { + ee.WriteMapElemKey() + e.asis(v2[j].v) + ee.WriteMapElemValue() + e.encode(v[v2[j].i]) } - e.asis(v2[j].v) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for j := range v2 { + e.asis(v2[j].v) + e.encode(v[v2[j].i]) } - e.encode(v[v2[j].i]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + e.encode(v2) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntfIntR(rv reflect.Value) { - fastpathTV.EncMapIntfIntV(rv.Interface().(map[interface{}]int), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntfIntR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntfIntV(rv2i(rv).(map[interface{}]int), e) } -func (_ fastpathT) EncMapIntfIntV(v map[interface{}]int, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntfIntV(v map[interface{}]int, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding e2 := NewEncoderBytes(&mksv, e.hh) @@ -4358,44 +2738,47 @@ func (_ fastpathT) EncMapIntfIntV(v map[interface{}]int, checkNil bool, e *Encod i++ } sort.Sort(bytesISlice(v2)) - for j := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for j := range v2 { + ee.WriteMapElemKey() + e.asis(v2[j].v) + ee.WriteMapElemValue() + e.encode(v[v2[j].i]) } - e.asis(v2[j].v) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for j := range v2 { + e.asis(v2[j].v) + e.encode(v[v2[j].i]) } - e.encode(v[v2[j].i]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntfInt8R(rv reflect.Value) { - fastpathTV.EncMapIntfInt8V(rv.Interface().(map[interface{}]int8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntfInt8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntfInt8V(rv2i(rv).(map[interface{}]int8), e) } -func (_ fastpathT) EncMapIntfInt8V(v map[interface{}]int8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntfInt8V(v map[interface{}]int8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding e2 := NewEncoderBytes(&mksv, e.hh) @@ -4411,44 +2794,47 @@ func (_ fastpathT) EncMapIntfInt8V(v map[interface{}]int8, checkNil bool, e *Enc i++ } sort.Sort(bytesISlice(v2)) - for j := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for j := range v2 { + ee.WriteMapElemKey() + e.asis(v2[j].v) + ee.WriteMapElemValue() + e.encode(v[v2[j].i]) } - e.asis(v2[j].v) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for j := range v2 { + e.asis(v2[j].v) + e.encode(v[v2[j].i]) } - e.encode(v[v2[j].i]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntfInt16R(rv reflect.Value) { - fastpathTV.EncMapIntfInt16V(rv.Interface().(map[interface{}]int16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntfInt16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntfInt16V(rv2i(rv).(map[interface{}]int16), e) } -func (_ fastpathT) EncMapIntfInt16V(v map[interface{}]int16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntfInt16V(v map[interface{}]int16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding e2 := NewEncoderBytes(&mksv, e.hh) @@ -4464,44 +2850,47 @@ func (_ fastpathT) EncMapIntfInt16V(v map[interface{}]int16, checkNil bool, e *E i++ } sort.Sort(bytesISlice(v2)) - for j := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for j := range v2 { + ee.WriteMapElemKey() + e.asis(v2[j].v) + ee.WriteMapElemValue() + e.encode(v[v2[j].i]) } - e.asis(v2[j].v) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for j := range v2 { + e.asis(v2[j].v) + e.encode(v[v2[j].i]) } - e.encode(v[v2[j].i]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntfInt32R(rv reflect.Value) { - fastpathTV.EncMapIntfInt32V(rv.Interface().(map[interface{}]int32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntfInt32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntfInt32V(rv2i(rv).(map[interface{}]int32), e) } -func (_ fastpathT) EncMapIntfInt32V(v map[interface{}]int32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntfInt32V(v map[interface{}]int32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding e2 := NewEncoderBytes(&mksv, e.hh) @@ -4517,44 +2906,47 @@ func (_ fastpathT) EncMapIntfInt32V(v map[interface{}]int32, checkNil bool, e *E i++ } sort.Sort(bytesISlice(v2)) - for j := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for j := range v2 { + ee.WriteMapElemKey() + e.asis(v2[j].v) + ee.WriteMapElemValue() + e.encode(v[v2[j].i]) } - e.asis(v2[j].v) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for j := range v2 { + e.asis(v2[j].v) + e.encode(v[v2[j].i]) } - e.encode(v[v2[j].i]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntfInt64R(rv reflect.Value) { - fastpathTV.EncMapIntfInt64V(rv.Interface().(map[interface{}]int64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntfInt64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntfInt64V(rv2i(rv).(map[interface{}]int64), e) } -func (_ fastpathT) EncMapIntfInt64V(v map[interface{}]int64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntfInt64V(v map[interface{}]int64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding e2 := NewEncoderBytes(&mksv, e.hh) @@ -4570,44 +2962,47 @@ func (_ fastpathT) EncMapIntfInt64V(v map[interface{}]int64, checkNil bool, e *E i++ } sort.Sort(bytesISlice(v2)) - for j := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for j := range v2 { + ee.WriteMapElemKey() + e.asis(v2[j].v) + ee.WriteMapElemValue() + e.encode(v[v2[j].i]) } - e.asis(v2[j].v) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for j := range v2 { + e.asis(v2[j].v) + e.encode(v[v2[j].i]) } - e.encode(v[v2[j].i]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntfFloat32R(rv reflect.Value) { - fastpathTV.EncMapIntfFloat32V(rv.Interface().(map[interface{}]float32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntfFloat32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntfFloat32V(rv2i(rv).(map[interface{}]float32), e) } -func (_ fastpathT) EncMapIntfFloat32V(v map[interface{}]float32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntfFloat32V(v map[interface{}]float32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding e2 := NewEncoderBytes(&mksv, e.hh) @@ -4623,44 +3018,47 @@ func (_ fastpathT) EncMapIntfFloat32V(v map[interface{}]float32, checkNil bool, i++ } sort.Sort(bytesISlice(v2)) - for j := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for j := range v2 { + ee.WriteMapElemKey() + e.asis(v2[j].v) + ee.WriteMapElemValue() + e.encode(v[v2[j].i]) } - e.asis(v2[j].v) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for j := range v2 { + e.asis(v2[j].v) + e.encode(v[v2[j].i]) } - e.encode(v[v2[j].i]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeFloat32(v2) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeFloat32(v2) } - ee.EncodeFloat32(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntfFloat64R(rv reflect.Value) { - fastpathTV.EncMapIntfFloat64V(rv.Interface().(map[interface{}]float64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntfFloat64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntfFloat64V(rv2i(rv).(map[interface{}]float64), e) } -func (_ fastpathT) EncMapIntfFloat64V(v map[interface{}]float64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntfFloat64V(v map[interface{}]float64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding e2 := NewEncoderBytes(&mksv, e.hh) @@ -4676,44 +3074,47 @@ func (_ fastpathT) EncMapIntfFloat64V(v map[interface{}]float64, checkNil bool, i++ } sort.Sort(bytesISlice(v2)) - for j := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for j := range v2 { + ee.WriteMapElemKey() + e.asis(v2[j].v) + ee.WriteMapElemValue() + e.encode(v[v2[j].i]) } - e.asis(v2[j].v) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for j := range v2 { + e.asis(v2[j].v) + e.encode(v[v2[j].i]) } - e.encode(v[v2[j].i]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeFloat64(v2) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeFloat64(v2) } - ee.EncodeFloat64(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntfBoolR(rv reflect.Value) { - fastpathTV.EncMapIntfBoolV(rv.Interface().(map[interface{}]bool), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntfBoolR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntfBoolV(rv2i(rv).(map[interface{}]bool), e) } -func (_ fastpathT) EncMapIntfBoolV(v map[interface{}]bool, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntfBoolV(v map[interface{}]bool, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding e2 := NewEncoderBytes(&mksv, e.hh) @@ -4729,45 +3130,47 @@ func (_ fastpathT) EncMapIntfBoolV(v map[interface{}]bool, checkNil bool, e *Enc i++ } sort.Sort(bytesISlice(v2)) - for j := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for j := range v2 { + ee.WriteMapElemKey() + e.asis(v2[j].v) + ee.WriteMapElemValue() + e.encode(v[v2[j].i]) } - e.asis(v2[j].v) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for j := range v2 { + e.asis(v2[j].v) + e.encode(v[v2[j].i]) } - e.encode(v[v2[j].i]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeBool(v2) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeBool(v2) } - ee.EncodeBool(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapStringIntfR(rv reflect.Value) { - fastpathTV.EncMapStringIntfV(rv.Interface().(map[string]interface{}), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapStringIntfR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapStringIntfV(rv2i(rv).(map[string]interface{}), e) } -func (_ fastpathT) EncMapStringIntfV(v map[string]interface{}, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapStringIntfV(v map[string]interface{}, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) - asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -4776,53 +3179,47 @@ func (_ fastpathT) EncMapStringIntfV(v map[string]interface{}, checkNil bool, e i++ } sort.Sort(stringSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + e.encode(v[string(k2)]) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for _, k2 := range v2 { + ee.EncodeString(cUTF8, k2) + e.encode(v[string(k2)]) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - e.encode(v[string(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + e.encode(v2) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for k2, v2 := range v { + ee.EncodeString(cUTF8, k2) + e.encode(v2) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapStringStringR(rv reflect.Value) { - fastpathTV.EncMapStringStringV(rv.Interface().(map[string]string), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapStringStringR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapStringStringV(rv2i(rv).(map[string]string), e) } -func (_ fastpathT) EncMapStringStringV(v map[string]string, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapStringStringV(v map[string]string, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) - asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -4831,53 +3228,47 @@ func (_ fastpathT) EncMapStringStringV(v map[string]string, checkNil bool, e *En i++ } sort.Sort(stringSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v[string(k2)]) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for _, k2 := range v2 { + ee.EncodeString(cUTF8, k2) + ee.EncodeString(cUTF8, v[string(k2)]) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeString(c_UTF8, v[string(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v2) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for k2, v2 := range v { + ee.EncodeString(cUTF8, k2) + ee.EncodeString(cUTF8, v2) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeString(c_UTF8, v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapStringUintR(rv reflect.Value) { - fastpathTV.EncMapStringUintV(rv.Interface().(map[string]uint), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapStringUintR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapStringUintV(rv2i(rv).(map[string]uint), e) } -func (_ fastpathT) EncMapStringUintV(v map[string]uint, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapStringUintV(v map[string]uint, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) - asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -4886,53 +3277,47 @@ func (_ fastpathT) EncMapStringUintV(v map[string]uint, checkNil bool, e *Encode i++ } sort.Sort(stringSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[string(k2)])) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for _, k2 := range v2 { + ee.EncodeString(cUTF8, k2) + ee.EncodeUint(uint64(v[string(k2)])) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeUint(uint64(v[string(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for k2, v2 := range v { + ee.EncodeString(cUTF8, k2) + ee.EncodeUint(uint64(v2)) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapStringUint8R(rv reflect.Value) { - fastpathTV.EncMapStringUint8V(rv.Interface().(map[string]uint8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapStringUint8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapStringUint8V(rv2i(rv).(map[string]uint8), e) } -func (_ fastpathT) EncMapStringUint8V(v map[string]uint8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapStringUint8V(v map[string]uint8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) - asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -4941,53 +3326,47 @@ func (_ fastpathT) EncMapStringUint8V(v map[string]uint8, checkNil bool, e *Enco i++ } sort.Sort(stringSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[string(k2)])) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for _, k2 := range v2 { + ee.EncodeString(cUTF8, k2) + ee.EncodeUint(uint64(v[string(k2)])) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeUint(uint64(v[string(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for k2, v2 := range v { + ee.EncodeString(cUTF8, k2) + ee.EncodeUint(uint64(v2)) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapStringUint16R(rv reflect.Value) { - fastpathTV.EncMapStringUint16V(rv.Interface().(map[string]uint16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapStringUint16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapStringUint16V(rv2i(rv).(map[string]uint16), e) } -func (_ fastpathT) EncMapStringUint16V(v map[string]uint16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapStringUint16V(v map[string]uint16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) - asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -4996,53 +3375,47 @@ func (_ fastpathT) EncMapStringUint16V(v map[string]uint16, checkNil bool, e *En i++ } sort.Sort(stringSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[string(k2)])) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for _, k2 := range v2 { + ee.EncodeString(cUTF8, k2) + ee.EncodeUint(uint64(v[string(k2)])) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeUint(uint64(v[string(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for k2, v2 := range v { + ee.EncodeString(cUTF8, k2) + ee.EncodeUint(uint64(v2)) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapStringUint32R(rv reflect.Value) { - fastpathTV.EncMapStringUint32V(rv.Interface().(map[string]uint32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapStringUint32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapStringUint32V(rv2i(rv).(map[string]uint32), e) } -func (_ fastpathT) EncMapStringUint32V(v map[string]uint32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapStringUint32V(v map[string]uint32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) - asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -5051,53 +3424,47 @@ func (_ fastpathT) EncMapStringUint32V(v map[string]uint32, checkNil bool, e *En i++ } sort.Sort(stringSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[string(k2)])) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for _, k2 := range v2 { + ee.EncodeString(cUTF8, k2) + ee.EncodeUint(uint64(v[string(k2)])) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeUint(uint64(v[string(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for k2, v2 := range v { + ee.EncodeString(cUTF8, k2) + ee.EncodeUint(uint64(v2)) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapStringUint64R(rv reflect.Value) { - fastpathTV.EncMapStringUint64V(rv.Interface().(map[string]uint64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapStringUint64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapStringUint64V(rv2i(rv).(map[string]uint64), e) } -func (_ fastpathT) EncMapStringUint64V(v map[string]uint64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapStringUint64V(v map[string]uint64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) - asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -5106,53 +3473,47 @@ func (_ fastpathT) EncMapStringUint64V(v map[string]uint64, checkNil bool, e *En i++ } sort.Sort(stringSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[string(k2)])) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for _, k2 := range v2 { + ee.EncodeString(cUTF8, k2) + ee.EncodeUint(uint64(v[string(k2)])) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeUint(uint64(v[string(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for k2, v2 := range v { + ee.EncodeString(cUTF8, k2) + ee.EncodeUint(uint64(v2)) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapStringUintptrR(rv reflect.Value) { - fastpathTV.EncMapStringUintptrV(rv.Interface().(map[string]uintptr), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapStringUintptrR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapStringUintptrV(rv2i(rv).(map[string]uintptr), e) } -func (_ fastpathT) EncMapStringUintptrV(v map[string]uintptr, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapStringUintptrV(v map[string]uintptr, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) - asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -5161,53 +3522,47 @@ func (_ fastpathT) EncMapStringUintptrV(v map[string]uintptr, checkNil bool, e * i++ } sort.Sort(stringSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + e.encode(v[string(k2)]) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for _, k2 := range v2 { + ee.EncodeString(cUTF8, k2) + e.encode(v[string(k2)]) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - e.encode(v[string(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + e.encode(v2) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for k2, v2 := range v { + ee.EncodeString(cUTF8, k2) + e.encode(v2) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapStringIntR(rv reflect.Value) { - fastpathTV.EncMapStringIntV(rv.Interface().(map[string]int), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapStringIntR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapStringIntV(rv2i(rv).(map[string]int), e) } -func (_ fastpathT) EncMapStringIntV(v map[string]int, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapStringIntV(v map[string]int, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) - asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -5216,53 +3571,47 @@ func (_ fastpathT) EncMapStringIntV(v map[string]int, checkNil bool, e *Encoder) i++ } sort.Sort(stringSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[string(k2)])) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for _, k2 := range v2 { + ee.EncodeString(cUTF8, k2) + ee.EncodeInt(int64(v[string(k2)])) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeInt(int64(v[string(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for k2, v2 := range v { + ee.EncodeString(cUTF8, k2) + ee.EncodeInt(int64(v2)) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapStringInt8R(rv reflect.Value) { - fastpathTV.EncMapStringInt8V(rv.Interface().(map[string]int8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapStringInt8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapStringInt8V(rv2i(rv).(map[string]int8), e) } -func (_ fastpathT) EncMapStringInt8V(v map[string]int8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapStringInt8V(v map[string]int8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) - asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -5271,53 +3620,47 @@ func (_ fastpathT) EncMapStringInt8V(v map[string]int8, checkNil bool, e *Encode i++ } sort.Sort(stringSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[string(k2)])) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for _, k2 := range v2 { + ee.EncodeString(cUTF8, k2) + ee.EncodeInt(int64(v[string(k2)])) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeInt(int64(v[string(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for k2, v2 := range v { + ee.EncodeString(cUTF8, k2) + ee.EncodeInt(int64(v2)) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapStringInt16R(rv reflect.Value) { - fastpathTV.EncMapStringInt16V(rv.Interface().(map[string]int16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapStringInt16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapStringInt16V(rv2i(rv).(map[string]int16), e) } -func (_ fastpathT) EncMapStringInt16V(v map[string]int16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapStringInt16V(v map[string]int16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) - asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -5326,53 +3669,47 @@ func (_ fastpathT) EncMapStringInt16V(v map[string]int16, checkNil bool, e *Enco i++ } sort.Sort(stringSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[string(k2)])) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for _, k2 := range v2 { + ee.EncodeString(cUTF8, k2) + ee.EncodeInt(int64(v[string(k2)])) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeInt(int64(v[string(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for k2, v2 := range v { + ee.EncodeString(cUTF8, k2) + ee.EncodeInt(int64(v2)) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapStringInt32R(rv reflect.Value) { - fastpathTV.EncMapStringInt32V(rv.Interface().(map[string]int32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapStringInt32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapStringInt32V(rv2i(rv).(map[string]int32), e) } -func (_ fastpathT) EncMapStringInt32V(v map[string]int32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapStringInt32V(v map[string]int32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) - asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -5381,53 +3718,47 @@ func (_ fastpathT) EncMapStringInt32V(v map[string]int32, checkNil bool, e *Enco i++ } sort.Sort(stringSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[string(k2)])) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for _, k2 := range v2 { + ee.EncodeString(cUTF8, k2) + ee.EncodeInt(int64(v[string(k2)])) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeInt(int64(v[string(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for k2, v2 := range v { + ee.EncodeString(cUTF8, k2) + ee.EncodeInt(int64(v2)) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapStringInt64R(rv reflect.Value) { - fastpathTV.EncMapStringInt64V(rv.Interface().(map[string]int64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapStringInt64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapStringInt64V(rv2i(rv).(map[string]int64), e) } -func (_ fastpathT) EncMapStringInt64V(v map[string]int64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapStringInt64V(v map[string]int64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) - asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -5436,53 +3767,47 @@ func (_ fastpathT) EncMapStringInt64V(v map[string]int64, checkNil bool, e *Enco i++ } sort.Sort(stringSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[string(k2)])) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for _, k2 := range v2 { + ee.EncodeString(cUTF8, k2) + ee.EncodeInt(int64(v[string(k2)])) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeInt(int64(v[string(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for k2, v2 := range v { + ee.EncodeString(cUTF8, k2) + ee.EncodeInt(int64(v2)) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapStringFloat32R(rv reflect.Value) { - fastpathTV.EncMapStringFloat32V(rv.Interface().(map[string]float32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapStringFloat32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapStringFloat32V(rv2i(rv).(map[string]float32), e) } -func (_ fastpathT) EncMapStringFloat32V(v map[string]float32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapStringFloat32V(v map[string]float32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) - asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -5491,53 +3816,47 @@ func (_ fastpathT) EncMapStringFloat32V(v map[string]float32, checkNil bool, e * i++ } sort.Sort(stringSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeFloat32(v[string(k2)]) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for _, k2 := range v2 { + ee.EncodeString(cUTF8, k2) + ee.EncodeFloat32(v[string(k2)]) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeFloat32(v[string(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeFloat32(v2) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for k2, v2 := range v { + ee.EncodeString(cUTF8, k2) + ee.EncodeFloat32(v2) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeFloat32(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapStringFloat64R(rv reflect.Value) { - fastpathTV.EncMapStringFloat64V(rv.Interface().(map[string]float64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapStringFloat64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapStringFloat64V(rv2i(rv).(map[string]float64), e) } -func (_ fastpathT) EncMapStringFloat64V(v map[string]float64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapStringFloat64V(v map[string]float64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) - asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -5546,53 +3865,47 @@ func (_ fastpathT) EncMapStringFloat64V(v map[string]float64, checkNil bool, e * i++ } sort.Sort(stringSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeFloat64(v[string(k2)]) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for _, k2 := range v2 { + ee.EncodeString(cUTF8, k2) + ee.EncodeFloat64(v[string(k2)]) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeFloat64(v[string(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeFloat64(v2) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for k2, v2 := range v { + ee.EncodeString(cUTF8, k2) + ee.EncodeFloat64(v2) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeFloat64(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapStringBoolR(rv reflect.Value) { - fastpathTV.EncMapStringBoolV(rv.Interface().(map[string]bool), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapStringBoolR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapStringBoolV(rv2i(rv).(map[string]bool), e) } -func (_ fastpathT) EncMapStringBoolV(v map[string]bool, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapStringBoolV(v map[string]bool, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) - asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]string, len(v)) var i int @@ -5601,52 +3914,47 @@ func (_ fastpathT) EncMapStringBoolV(v map[string]bool, checkNil bool, e *Encode i++ } sort.Sort(stringSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeBool(v[string(k2)]) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for _, k2 := range v2 { + ee.EncodeString(cUTF8, k2) + ee.EncodeBool(v[string(k2)]) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeBool(v[string(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeString(cUTF8, k2) + ee.WriteMapElemValue() + ee.EncodeBool(v2) } - if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) + } else { + for k2, v2 := range v { + ee.EncodeString(cUTF8, k2) + ee.EncodeBool(v2) } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - ee.EncodeBool(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat32IntfR(rv reflect.Value) { - fastpathTV.EncMapFloat32IntfV(rv.Interface().(map[float32]interface{}), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat32IntfR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat32IntfV(rv2i(rv).(map[float32]interface{}), e) } -func (_ fastpathT) EncMapFloat32IntfV(v map[float32]interface{}, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat32IntfV(v map[float32]interface{}, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -5655,44 +3963,47 @@ func (_ fastpathT) EncMapFloat32IntfV(v map[float32]interface{}, checkNil bool, i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat32(float32(k2)) + ee.WriteMapElemValue() + e.encode(v[float32(k2)]) } - ee.EncodeFloat32(float32(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat32(float32(k2)) + e.encode(v[float32(k2)]) } - e.encode(v[float32(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat32(k2) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeFloat32(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat32(k2) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat32StringR(rv reflect.Value) { - fastpathTV.EncMapFloat32StringV(rv.Interface().(map[float32]string), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat32StringR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat32StringV(rv2i(rv).(map[float32]string), e) } -func (_ fastpathT) EncMapFloat32StringV(v map[float32]string, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat32StringV(v map[float32]string, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -5701,44 +4012,47 @@ func (_ fastpathT) EncMapFloat32StringV(v map[float32]string, checkNil bool, e * i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat32(float32(k2)) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v[float32(k2)]) } - ee.EncodeFloat32(float32(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat32(float32(k2)) + ee.EncodeString(cUTF8, v[float32(k2)]) } - ee.EncodeString(c_UTF8, v[float32(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat32(k2) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v2) } - ee.EncodeFloat32(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat32(k2) + ee.EncodeString(cUTF8, v2) } - ee.EncodeString(c_UTF8, v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat32UintR(rv reflect.Value) { - fastpathTV.EncMapFloat32UintV(rv.Interface().(map[float32]uint), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat32UintR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat32UintV(rv2i(rv).(map[float32]uint), e) } -func (_ fastpathT) EncMapFloat32UintV(v map[float32]uint, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat32UintV(v map[float32]uint, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -5747,44 +4061,47 @@ func (_ fastpathT) EncMapFloat32UintV(v map[float32]uint, checkNil bool, e *Enco i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat32(float32(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[float32(k2)])) } - ee.EncodeFloat32(float32(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat32(float32(k2)) + ee.EncodeUint(uint64(v[float32(k2)])) } - ee.EncodeUint(uint64(v[float32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat32(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeFloat32(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat32(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat32Uint8R(rv reflect.Value) { - fastpathTV.EncMapFloat32Uint8V(rv.Interface().(map[float32]uint8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat32Uint8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat32Uint8V(rv2i(rv).(map[float32]uint8), e) } -func (_ fastpathT) EncMapFloat32Uint8V(v map[float32]uint8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat32Uint8V(v map[float32]uint8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -5793,44 +4110,47 @@ func (_ fastpathT) EncMapFloat32Uint8V(v map[float32]uint8, checkNil bool, e *En i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat32(float32(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[float32(k2)])) } - ee.EncodeFloat32(float32(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat32(float32(k2)) + ee.EncodeUint(uint64(v[float32(k2)])) } - ee.EncodeUint(uint64(v[float32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat32(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeFloat32(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat32(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat32Uint16R(rv reflect.Value) { - fastpathTV.EncMapFloat32Uint16V(rv.Interface().(map[float32]uint16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat32Uint16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat32Uint16V(rv2i(rv).(map[float32]uint16), e) } -func (_ fastpathT) EncMapFloat32Uint16V(v map[float32]uint16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat32Uint16V(v map[float32]uint16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -5839,44 +4159,47 @@ func (_ fastpathT) EncMapFloat32Uint16V(v map[float32]uint16, checkNil bool, e * i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat32(float32(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[float32(k2)])) } - ee.EncodeFloat32(float32(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat32(float32(k2)) + ee.EncodeUint(uint64(v[float32(k2)])) } - ee.EncodeUint(uint64(v[float32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat32(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeFloat32(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat32(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat32Uint32R(rv reflect.Value) { - fastpathTV.EncMapFloat32Uint32V(rv.Interface().(map[float32]uint32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat32Uint32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat32Uint32V(rv2i(rv).(map[float32]uint32), e) } -func (_ fastpathT) EncMapFloat32Uint32V(v map[float32]uint32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat32Uint32V(v map[float32]uint32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -5885,44 +4208,47 @@ func (_ fastpathT) EncMapFloat32Uint32V(v map[float32]uint32, checkNil bool, e * i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat32(float32(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[float32(k2)])) } - ee.EncodeFloat32(float32(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat32(float32(k2)) + ee.EncodeUint(uint64(v[float32(k2)])) } - ee.EncodeUint(uint64(v[float32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat32(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeFloat32(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat32(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat32Uint64R(rv reflect.Value) { - fastpathTV.EncMapFloat32Uint64V(rv.Interface().(map[float32]uint64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat32Uint64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat32Uint64V(rv2i(rv).(map[float32]uint64), e) } -func (_ fastpathT) EncMapFloat32Uint64V(v map[float32]uint64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat32Uint64V(v map[float32]uint64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -5931,44 +4257,47 @@ func (_ fastpathT) EncMapFloat32Uint64V(v map[float32]uint64, checkNil bool, e * i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat32(float32(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[float32(k2)])) } - ee.EncodeFloat32(float32(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat32(float32(k2)) + ee.EncodeUint(uint64(v[float32(k2)])) } - ee.EncodeUint(uint64(v[float32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat32(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeFloat32(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat32(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat32UintptrR(rv reflect.Value) { - fastpathTV.EncMapFloat32UintptrV(rv.Interface().(map[float32]uintptr), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat32UintptrR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat32UintptrV(rv2i(rv).(map[float32]uintptr), e) } -func (_ fastpathT) EncMapFloat32UintptrV(v map[float32]uintptr, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat32UintptrV(v map[float32]uintptr, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -5977,44 +4306,47 @@ func (_ fastpathT) EncMapFloat32UintptrV(v map[float32]uintptr, checkNil bool, e i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat32(float32(k2)) + ee.WriteMapElemValue() + e.encode(v[float32(k2)]) } - ee.EncodeFloat32(float32(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat32(float32(k2)) + e.encode(v[float32(k2)]) } - e.encode(v[float32(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat32(k2) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeFloat32(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat32(k2) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat32IntR(rv reflect.Value) { - fastpathTV.EncMapFloat32IntV(rv.Interface().(map[float32]int), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat32IntR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat32IntV(rv2i(rv).(map[float32]int), e) } -func (_ fastpathT) EncMapFloat32IntV(v map[float32]int, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat32IntV(v map[float32]int, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -6023,44 +4355,47 @@ func (_ fastpathT) EncMapFloat32IntV(v map[float32]int, checkNil bool, e *Encode i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat32(float32(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[float32(k2)])) } - ee.EncodeFloat32(float32(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat32(float32(k2)) + ee.EncodeInt(int64(v[float32(k2)])) } - ee.EncodeInt(int64(v[float32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat32(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeFloat32(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat32(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat32Int8R(rv reflect.Value) { - fastpathTV.EncMapFloat32Int8V(rv.Interface().(map[float32]int8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat32Int8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat32Int8V(rv2i(rv).(map[float32]int8), e) } -func (_ fastpathT) EncMapFloat32Int8V(v map[float32]int8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat32Int8V(v map[float32]int8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -6069,44 +4404,47 @@ func (_ fastpathT) EncMapFloat32Int8V(v map[float32]int8, checkNil bool, e *Enco i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat32(float32(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[float32(k2)])) } - ee.EncodeFloat32(float32(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat32(float32(k2)) + ee.EncodeInt(int64(v[float32(k2)])) } - ee.EncodeInt(int64(v[float32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat32(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeFloat32(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat32(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat32Int16R(rv reflect.Value) { - fastpathTV.EncMapFloat32Int16V(rv.Interface().(map[float32]int16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat32Int16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat32Int16V(rv2i(rv).(map[float32]int16), e) } -func (_ fastpathT) EncMapFloat32Int16V(v map[float32]int16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat32Int16V(v map[float32]int16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -6115,44 +4453,47 @@ func (_ fastpathT) EncMapFloat32Int16V(v map[float32]int16, checkNil bool, e *En i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat32(float32(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[float32(k2)])) } - ee.EncodeFloat32(float32(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat32(float32(k2)) + ee.EncodeInt(int64(v[float32(k2)])) } - ee.EncodeInt(int64(v[float32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat32(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeFloat32(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat32(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat32Int32R(rv reflect.Value) { - fastpathTV.EncMapFloat32Int32V(rv.Interface().(map[float32]int32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat32Int32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat32Int32V(rv2i(rv).(map[float32]int32), e) } -func (_ fastpathT) EncMapFloat32Int32V(v map[float32]int32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat32Int32V(v map[float32]int32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -6161,44 +4502,47 @@ func (_ fastpathT) EncMapFloat32Int32V(v map[float32]int32, checkNil bool, e *En i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat32(float32(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[float32(k2)])) } - ee.EncodeFloat32(float32(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat32(float32(k2)) + ee.EncodeInt(int64(v[float32(k2)])) } - ee.EncodeInt(int64(v[float32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat32(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeFloat32(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat32(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat32Int64R(rv reflect.Value) { - fastpathTV.EncMapFloat32Int64V(rv.Interface().(map[float32]int64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat32Int64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat32Int64V(rv2i(rv).(map[float32]int64), e) } -func (_ fastpathT) EncMapFloat32Int64V(v map[float32]int64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat32Int64V(v map[float32]int64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -6207,44 +4551,47 @@ func (_ fastpathT) EncMapFloat32Int64V(v map[float32]int64, checkNil bool, e *En i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat32(float32(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[float32(k2)])) } - ee.EncodeFloat32(float32(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat32(float32(k2)) + ee.EncodeInt(int64(v[float32(k2)])) } - ee.EncodeInt(int64(v[float32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat32(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeFloat32(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat32(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat32Float32R(rv reflect.Value) { - fastpathTV.EncMapFloat32Float32V(rv.Interface().(map[float32]float32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat32Float32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat32Float32V(rv2i(rv).(map[float32]float32), e) } -func (_ fastpathT) EncMapFloat32Float32V(v map[float32]float32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat32Float32V(v map[float32]float32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -6253,44 +4600,47 @@ func (_ fastpathT) EncMapFloat32Float32V(v map[float32]float32, checkNil bool, e i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat32(float32(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat32(v[float32(k2)]) } - ee.EncodeFloat32(float32(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat32(float32(k2)) + ee.EncodeFloat32(v[float32(k2)]) } - ee.EncodeFloat32(v[float32(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat32(k2) + ee.WriteMapElemValue() + ee.EncodeFloat32(v2) } - ee.EncodeFloat32(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat32(k2) + ee.EncodeFloat32(v2) } - ee.EncodeFloat32(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat32Float64R(rv reflect.Value) { - fastpathTV.EncMapFloat32Float64V(rv.Interface().(map[float32]float64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat32Float64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat32Float64V(rv2i(rv).(map[float32]float64), e) } -func (_ fastpathT) EncMapFloat32Float64V(v map[float32]float64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat32Float64V(v map[float32]float64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -6299,44 +4649,47 @@ func (_ fastpathT) EncMapFloat32Float64V(v map[float32]float64, checkNil bool, e i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat32(float32(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat64(v[float32(k2)]) } - ee.EncodeFloat32(float32(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat32(float32(k2)) + ee.EncodeFloat64(v[float32(k2)]) } - ee.EncodeFloat64(v[float32(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat32(k2) + ee.WriteMapElemValue() + ee.EncodeFloat64(v2) } - ee.EncodeFloat32(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat32(k2) + ee.EncodeFloat64(v2) } - ee.EncodeFloat64(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat32BoolR(rv reflect.Value) { - fastpathTV.EncMapFloat32BoolV(rv.Interface().(map[float32]bool), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat32BoolR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat32BoolV(rv2i(rv).(map[float32]bool), e) } -func (_ fastpathT) EncMapFloat32BoolV(v map[float32]bool, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat32BoolV(v map[float32]bool, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -6345,44 +4698,47 @@ func (_ fastpathT) EncMapFloat32BoolV(v map[float32]bool, checkNil bool, e *Enco i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat32(float32(k2)) + ee.WriteMapElemValue() + ee.EncodeBool(v[float32(k2)]) } - ee.EncodeFloat32(float32(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat32(float32(k2)) + ee.EncodeBool(v[float32(k2)]) } - ee.EncodeBool(v[float32(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat32(k2) + ee.WriteMapElemValue() + ee.EncodeBool(v2) } - ee.EncodeFloat32(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat32(k2) + ee.EncodeBool(v2) } - ee.EncodeBool(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat64IntfR(rv reflect.Value) { - fastpathTV.EncMapFloat64IntfV(rv.Interface().(map[float64]interface{}), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat64IntfR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat64IntfV(rv2i(rv).(map[float64]interface{}), e) } -func (_ fastpathT) EncMapFloat64IntfV(v map[float64]interface{}, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat64IntfV(v map[float64]interface{}, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -6391,44 +4747,47 @@ func (_ fastpathT) EncMapFloat64IntfV(v map[float64]interface{}, checkNil bool, i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat64(float64(k2)) + ee.WriteMapElemValue() + e.encode(v[float64(k2)]) } - ee.EncodeFloat64(float64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat64(float64(k2)) + e.encode(v[float64(k2)]) } - e.encode(v[float64(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat64(k2) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeFloat64(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat64(k2) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat64StringR(rv reflect.Value) { - fastpathTV.EncMapFloat64StringV(rv.Interface().(map[float64]string), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat64StringR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat64StringV(rv2i(rv).(map[float64]string), e) } -func (_ fastpathT) EncMapFloat64StringV(v map[float64]string, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat64StringV(v map[float64]string, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -6437,44 +4796,47 @@ func (_ fastpathT) EncMapFloat64StringV(v map[float64]string, checkNil bool, e * i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat64(float64(k2)) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v[float64(k2)]) } - ee.EncodeFloat64(float64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat64(float64(k2)) + ee.EncodeString(cUTF8, v[float64(k2)]) } - ee.EncodeString(c_UTF8, v[float64(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat64(k2) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v2) } - ee.EncodeFloat64(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat64(k2) + ee.EncodeString(cUTF8, v2) } - ee.EncodeString(c_UTF8, v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat64UintR(rv reflect.Value) { - fastpathTV.EncMapFloat64UintV(rv.Interface().(map[float64]uint), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat64UintR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat64UintV(rv2i(rv).(map[float64]uint), e) } -func (_ fastpathT) EncMapFloat64UintV(v map[float64]uint, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat64UintV(v map[float64]uint, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -6483,44 +4845,47 @@ func (_ fastpathT) EncMapFloat64UintV(v map[float64]uint, checkNil bool, e *Enco i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat64(float64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[float64(k2)])) } - ee.EncodeFloat64(float64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat64(float64(k2)) + ee.EncodeUint(uint64(v[float64(k2)])) } - ee.EncodeUint(uint64(v[float64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat64(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeFloat64(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat64(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat64Uint8R(rv reflect.Value) { - fastpathTV.EncMapFloat64Uint8V(rv.Interface().(map[float64]uint8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat64Uint8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat64Uint8V(rv2i(rv).(map[float64]uint8), e) } -func (_ fastpathT) EncMapFloat64Uint8V(v map[float64]uint8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat64Uint8V(v map[float64]uint8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -6529,44 +4894,47 @@ func (_ fastpathT) EncMapFloat64Uint8V(v map[float64]uint8, checkNil bool, e *En i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat64(float64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[float64(k2)])) } - ee.EncodeFloat64(float64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat64(float64(k2)) + ee.EncodeUint(uint64(v[float64(k2)])) } - ee.EncodeUint(uint64(v[float64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat64(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeFloat64(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat64(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat64Uint16R(rv reflect.Value) { - fastpathTV.EncMapFloat64Uint16V(rv.Interface().(map[float64]uint16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat64Uint16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat64Uint16V(rv2i(rv).(map[float64]uint16), e) } -func (_ fastpathT) EncMapFloat64Uint16V(v map[float64]uint16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat64Uint16V(v map[float64]uint16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -6575,44 +4943,47 @@ func (_ fastpathT) EncMapFloat64Uint16V(v map[float64]uint16, checkNil bool, e * i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat64(float64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[float64(k2)])) } - ee.EncodeFloat64(float64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat64(float64(k2)) + ee.EncodeUint(uint64(v[float64(k2)])) } - ee.EncodeUint(uint64(v[float64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat64(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeFloat64(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat64(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat64Uint32R(rv reflect.Value) { - fastpathTV.EncMapFloat64Uint32V(rv.Interface().(map[float64]uint32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat64Uint32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat64Uint32V(rv2i(rv).(map[float64]uint32), e) } -func (_ fastpathT) EncMapFloat64Uint32V(v map[float64]uint32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat64Uint32V(v map[float64]uint32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -6621,44 +4992,47 @@ func (_ fastpathT) EncMapFloat64Uint32V(v map[float64]uint32, checkNil bool, e * i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat64(float64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[float64(k2)])) } - ee.EncodeFloat64(float64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat64(float64(k2)) + ee.EncodeUint(uint64(v[float64(k2)])) } - ee.EncodeUint(uint64(v[float64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat64(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeFloat64(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat64(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat64Uint64R(rv reflect.Value) { - fastpathTV.EncMapFloat64Uint64V(rv.Interface().(map[float64]uint64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat64Uint64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat64Uint64V(rv2i(rv).(map[float64]uint64), e) } -func (_ fastpathT) EncMapFloat64Uint64V(v map[float64]uint64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat64Uint64V(v map[float64]uint64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -6667,44 +5041,47 @@ func (_ fastpathT) EncMapFloat64Uint64V(v map[float64]uint64, checkNil bool, e * i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat64(float64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[float64(k2)])) } - ee.EncodeFloat64(float64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat64(float64(k2)) + ee.EncodeUint(uint64(v[float64(k2)])) } - ee.EncodeUint(uint64(v[float64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat64(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeFloat64(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat64(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat64UintptrR(rv reflect.Value) { - fastpathTV.EncMapFloat64UintptrV(rv.Interface().(map[float64]uintptr), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat64UintptrR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat64UintptrV(rv2i(rv).(map[float64]uintptr), e) } -func (_ fastpathT) EncMapFloat64UintptrV(v map[float64]uintptr, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat64UintptrV(v map[float64]uintptr, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -6713,44 +5090,47 @@ func (_ fastpathT) EncMapFloat64UintptrV(v map[float64]uintptr, checkNil bool, e i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat64(float64(k2)) + ee.WriteMapElemValue() + e.encode(v[float64(k2)]) } - ee.EncodeFloat64(float64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat64(float64(k2)) + e.encode(v[float64(k2)]) } - e.encode(v[float64(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat64(k2) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeFloat64(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat64(k2) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat64IntR(rv reflect.Value) { - fastpathTV.EncMapFloat64IntV(rv.Interface().(map[float64]int), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat64IntR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat64IntV(rv2i(rv).(map[float64]int), e) } -func (_ fastpathT) EncMapFloat64IntV(v map[float64]int, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat64IntV(v map[float64]int, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -6759,44 +5139,47 @@ func (_ fastpathT) EncMapFloat64IntV(v map[float64]int, checkNil bool, e *Encode i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat64(float64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[float64(k2)])) } - ee.EncodeFloat64(float64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat64(float64(k2)) + ee.EncodeInt(int64(v[float64(k2)])) } - ee.EncodeInt(int64(v[float64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat64(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeFloat64(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat64(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat64Int8R(rv reflect.Value) { - fastpathTV.EncMapFloat64Int8V(rv.Interface().(map[float64]int8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat64Int8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat64Int8V(rv2i(rv).(map[float64]int8), e) } -func (_ fastpathT) EncMapFloat64Int8V(v map[float64]int8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat64Int8V(v map[float64]int8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -6805,44 +5188,47 @@ func (_ fastpathT) EncMapFloat64Int8V(v map[float64]int8, checkNil bool, e *Enco i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat64(float64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[float64(k2)])) } - ee.EncodeFloat64(float64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat64(float64(k2)) + ee.EncodeInt(int64(v[float64(k2)])) } - ee.EncodeInt(int64(v[float64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat64(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeFloat64(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat64(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat64Int16R(rv reflect.Value) { - fastpathTV.EncMapFloat64Int16V(rv.Interface().(map[float64]int16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat64Int16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat64Int16V(rv2i(rv).(map[float64]int16), e) } -func (_ fastpathT) EncMapFloat64Int16V(v map[float64]int16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat64Int16V(v map[float64]int16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -6851,44 +5237,47 @@ func (_ fastpathT) EncMapFloat64Int16V(v map[float64]int16, checkNil bool, e *En i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat64(float64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[float64(k2)])) } - ee.EncodeFloat64(float64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat64(float64(k2)) + ee.EncodeInt(int64(v[float64(k2)])) } - ee.EncodeInt(int64(v[float64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat64(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeFloat64(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat64(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat64Int32R(rv reflect.Value) { - fastpathTV.EncMapFloat64Int32V(rv.Interface().(map[float64]int32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat64Int32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat64Int32V(rv2i(rv).(map[float64]int32), e) } -func (_ fastpathT) EncMapFloat64Int32V(v map[float64]int32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat64Int32V(v map[float64]int32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -6897,44 +5286,47 @@ func (_ fastpathT) EncMapFloat64Int32V(v map[float64]int32, checkNil bool, e *En i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat64(float64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[float64(k2)])) } - ee.EncodeFloat64(float64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat64(float64(k2)) + ee.EncodeInt(int64(v[float64(k2)])) } - ee.EncodeInt(int64(v[float64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat64(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeFloat64(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat64(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat64Int64R(rv reflect.Value) { - fastpathTV.EncMapFloat64Int64V(rv.Interface().(map[float64]int64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat64Int64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat64Int64V(rv2i(rv).(map[float64]int64), e) } -func (_ fastpathT) EncMapFloat64Int64V(v map[float64]int64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat64Int64V(v map[float64]int64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -6943,44 +5335,47 @@ func (_ fastpathT) EncMapFloat64Int64V(v map[float64]int64, checkNil bool, e *En i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat64(float64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[float64(k2)])) } - ee.EncodeFloat64(float64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat64(float64(k2)) + ee.EncodeInt(int64(v[float64(k2)])) } - ee.EncodeInt(int64(v[float64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat64(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeFloat64(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat64(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat64Float32R(rv reflect.Value) { - fastpathTV.EncMapFloat64Float32V(rv.Interface().(map[float64]float32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat64Float32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat64Float32V(rv2i(rv).(map[float64]float32), e) } -func (_ fastpathT) EncMapFloat64Float32V(v map[float64]float32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat64Float32V(v map[float64]float32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -6989,44 +5384,47 @@ func (_ fastpathT) EncMapFloat64Float32V(v map[float64]float32, checkNil bool, e i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat64(float64(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat32(v[float64(k2)]) } - ee.EncodeFloat64(float64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat64(float64(k2)) + ee.EncodeFloat32(v[float64(k2)]) } - ee.EncodeFloat32(v[float64(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat64(k2) + ee.WriteMapElemValue() + ee.EncodeFloat32(v2) } - ee.EncodeFloat64(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat64(k2) + ee.EncodeFloat32(v2) } - ee.EncodeFloat32(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat64Float64R(rv reflect.Value) { - fastpathTV.EncMapFloat64Float64V(rv.Interface().(map[float64]float64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat64Float64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat64Float64V(rv2i(rv).(map[float64]float64), e) } -func (_ fastpathT) EncMapFloat64Float64V(v map[float64]float64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat64Float64V(v map[float64]float64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -7035,44 +5433,47 @@ func (_ fastpathT) EncMapFloat64Float64V(v map[float64]float64, checkNil bool, e i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat64(float64(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat64(v[float64(k2)]) } - ee.EncodeFloat64(float64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat64(float64(k2)) + ee.EncodeFloat64(v[float64(k2)]) } - ee.EncodeFloat64(v[float64(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat64(k2) + ee.WriteMapElemValue() + ee.EncodeFloat64(v2) } - ee.EncodeFloat64(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat64(k2) + ee.EncodeFloat64(v2) } - ee.EncodeFloat64(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapFloat64BoolR(rv reflect.Value) { - fastpathTV.EncMapFloat64BoolV(rv.Interface().(map[float64]bool), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapFloat64BoolR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapFloat64BoolV(rv2i(rv).(map[float64]bool), e) } -func (_ fastpathT) EncMapFloat64BoolV(v map[float64]bool, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapFloat64BoolV(v map[float64]bool, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]float64, len(v)) var i int @@ -7081,44 +5482,47 @@ func (_ fastpathT) EncMapFloat64BoolV(v map[float64]bool, checkNil bool, e *Enco i++ } sort.Sort(floatSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeFloat64(float64(k2)) + ee.WriteMapElemValue() + ee.EncodeBool(v[float64(k2)]) } - ee.EncodeFloat64(float64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeFloat64(float64(k2)) + ee.EncodeBool(v[float64(k2)]) } - ee.EncodeBool(v[float64(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeFloat64(k2) + ee.WriteMapElemValue() + ee.EncodeBool(v2) } - ee.EncodeFloat64(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeFloat64(k2) + ee.EncodeBool(v2) } - ee.EncodeBool(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintIntfR(rv reflect.Value) { - fastpathTV.EncMapUintIntfV(rv.Interface().(map[uint]interface{}), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintIntfR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintIntfV(rv2i(rv).(map[uint]interface{}), e) } -func (_ fastpathT) EncMapUintIntfV(v map[uint]interface{}, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintIntfV(v map[uint]interface{}, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -7127,44 +5531,47 @@ func (_ fastpathT) EncMapUintIntfV(v map[uint]interface{}, checkNil bool, e *Enc i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint(k2))) + ee.WriteMapElemValue() + e.encode(v[uint(k2)]) } - ee.EncodeUint(uint64(uint(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint(k2))) + e.encode(v[uint(k2)]) } - e.encode(v[uint(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintStringR(rv reflect.Value) { - fastpathTV.EncMapUintStringV(rv.Interface().(map[uint]string), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintStringR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintStringV(rv2i(rv).(map[uint]string), e) } -func (_ fastpathT) EncMapUintStringV(v map[uint]string, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintStringV(v map[uint]string, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -7173,44 +5580,47 @@ func (_ fastpathT) EncMapUintStringV(v map[uint]string, checkNil bool, e *Encode i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint(k2))) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v[uint(k2)]) } - ee.EncodeUint(uint64(uint(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint(k2))) + ee.EncodeString(cUTF8, v[uint(k2)]) } - ee.EncodeString(c_UTF8, v[uint(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeString(cUTF8, v2) } - ee.EncodeString(c_UTF8, v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintUintR(rv reflect.Value) { - fastpathTV.EncMapUintUintV(rv.Interface().(map[uint]uint), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintUintR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintUintV(rv2i(rv).(map[uint]uint), e) } -func (_ fastpathT) EncMapUintUintV(v map[uint]uint, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintUintV(v map[uint]uint, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -7219,44 +5629,47 @@ func (_ fastpathT) EncMapUintUintV(v map[uint]uint, checkNil bool, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint(k2)])) } - ee.EncodeUint(uint64(uint(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint(k2))) + ee.EncodeUint(uint64(v[uint(k2)])) } - ee.EncodeUint(uint64(v[uint(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintUint8R(rv reflect.Value) { - fastpathTV.EncMapUintUint8V(rv.Interface().(map[uint]uint8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintUint8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintUint8V(rv2i(rv).(map[uint]uint8), e) } -func (_ fastpathT) EncMapUintUint8V(v map[uint]uint8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintUint8V(v map[uint]uint8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -7265,44 +5678,47 @@ func (_ fastpathT) EncMapUintUint8V(v map[uint]uint8, checkNil bool, e *Encoder) i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint(k2)])) } - ee.EncodeUint(uint64(uint(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint(k2))) + ee.EncodeUint(uint64(v[uint(k2)])) } - ee.EncodeUint(uint64(v[uint(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintUint16R(rv reflect.Value) { - fastpathTV.EncMapUintUint16V(rv.Interface().(map[uint]uint16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintUint16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintUint16V(rv2i(rv).(map[uint]uint16), e) } -func (_ fastpathT) EncMapUintUint16V(v map[uint]uint16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintUint16V(v map[uint]uint16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -7311,44 +5727,47 @@ func (_ fastpathT) EncMapUintUint16V(v map[uint]uint16, checkNil bool, e *Encode i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint(k2)])) } - ee.EncodeUint(uint64(uint(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint(k2))) + ee.EncodeUint(uint64(v[uint(k2)])) } - ee.EncodeUint(uint64(v[uint(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintUint32R(rv reflect.Value) { - fastpathTV.EncMapUintUint32V(rv.Interface().(map[uint]uint32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintUint32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintUint32V(rv2i(rv).(map[uint]uint32), e) } -func (_ fastpathT) EncMapUintUint32V(v map[uint]uint32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintUint32V(v map[uint]uint32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -7357,44 +5776,47 @@ func (_ fastpathT) EncMapUintUint32V(v map[uint]uint32, checkNil bool, e *Encode i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint(k2)])) } - ee.EncodeUint(uint64(uint(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint(k2))) + ee.EncodeUint(uint64(v[uint(k2)])) } - ee.EncodeUint(uint64(v[uint(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintUint64R(rv reflect.Value) { - fastpathTV.EncMapUintUint64V(rv.Interface().(map[uint]uint64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintUint64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintUint64V(rv2i(rv).(map[uint]uint64), e) } -func (_ fastpathT) EncMapUintUint64V(v map[uint]uint64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintUint64V(v map[uint]uint64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -7403,44 +5825,47 @@ func (_ fastpathT) EncMapUintUint64V(v map[uint]uint64, checkNil bool, e *Encode i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint(k2)])) } - ee.EncodeUint(uint64(uint(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint(k2))) + ee.EncodeUint(uint64(v[uint(k2)])) } - ee.EncodeUint(uint64(v[uint(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintUintptrR(rv reflect.Value) { - fastpathTV.EncMapUintUintptrV(rv.Interface().(map[uint]uintptr), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintUintptrR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintUintptrV(rv2i(rv).(map[uint]uintptr), e) } -func (_ fastpathT) EncMapUintUintptrV(v map[uint]uintptr, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintUintptrV(v map[uint]uintptr, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -7449,44 +5874,47 @@ func (_ fastpathT) EncMapUintUintptrV(v map[uint]uintptr, checkNil bool, e *Enco i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint(k2))) + ee.WriteMapElemValue() + e.encode(v[uint(k2)]) } - ee.EncodeUint(uint64(uint(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint(k2))) + e.encode(v[uint(k2)]) } - e.encode(v[uint(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintIntR(rv reflect.Value) { - fastpathTV.EncMapUintIntV(rv.Interface().(map[uint]int), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintIntR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintIntV(rv2i(rv).(map[uint]int), e) } -func (_ fastpathT) EncMapUintIntV(v map[uint]int, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintIntV(v map[uint]int, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -7495,44 +5923,47 @@ func (_ fastpathT) EncMapUintIntV(v map[uint]int, checkNil bool, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint(k2)])) } - ee.EncodeUint(uint64(uint(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint(k2))) + ee.EncodeInt(int64(v[uint(k2)])) } - ee.EncodeInt(int64(v[uint(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintInt8R(rv reflect.Value) { - fastpathTV.EncMapUintInt8V(rv.Interface().(map[uint]int8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintInt8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintInt8V(rv2i(rv).(map[uint]int8), e) } -func (_ fastpathT) EncMapUintInt8V(v map[uint]int8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintInt8V(v map[uint]int8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -7541,44 +5972,47 @@ func (_ fastpathT) EncMapUintInt8V(v map[uint]int8, checkNil bool, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint(k2)])) } - ee.EncodeUint(uint64(uint(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint(k2))) + ee.EncodeInt(int64(v[uint(k2)])) } - ee.EncodeInt(int64(v[uint(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintInt16R(rv reflect.Value) { - fastpathTV.EncMapUintInt16V(rv.Interface().(map[uint]int16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintInt16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintInt16V(rv2i(rv).(map[uint]int16), e) } -func (_ fastpathT) EncMapUintInt16V(v map[uint]int16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintInt16V(v map[uint]int16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -7587,44 +6021,47 @@ func (_ fastpathT) EncMapUintInt16V(v map[uint]int16, checkNil bool, e *Encoder) i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint(k2)])) } - ee.EncodeUint(uint64(uint(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint(k2))) + ee.EncodeInt(int64(v[uint(k2)])) } - ee.EncodeInt(int64(v[uint(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintInt32R(rv reflect.Value) { - fastpathTV.EncMapUintInt32V(rv.Interface().(map[uint]int32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintInt32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintInt32V(rv2i(rv).(map[uint]int32), e) } -func (_ fastpathT) EncMapUintInt32V(v map[uint]int32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintInt32V(v map[uint]int32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -7633,44 +6070,47 @@ func (_ fastpathT) EncMapUintInt32V(v map[uint]int32, checkNil bool, e *Encoder) i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint(k2)])) } - ee.EncodeUint(uint64(uint(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint(k2))) + ee.EncodeInt(int64(v[uint(k2)])) } - ee.EncodeInt(int64(v[uint(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintInt64R(rv reflect.Value) { - fastpathTV.EncMapUintInt64V(rv.Interface().(map[uint]int64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintInt64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintInt64V(rv2i(rv).(map[uint]int64), e) } -func (_ fastpathT) EncMapUintInt64V(v map[uint]int64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintInt64V(v map[uint]int64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -7679,44 +6119,47 @@ func (_ fastpathT) EncMapUintInt64V(v map[uint]int64, checkNil bool, e *Encoder) i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint(k2)])) } - ee.EncodeUint(uint64(uint(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint(k2))) + ee.EncodeInt(int64(v[uint(k2)])) } - ee.EncodeInt(int64(v[uint(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintFloat32R(rv reflect.Value) { - fastpathTV.EncMapUintFloat32V(rv.Interface().(map[uint]float32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintFloat32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintFloat32V(rv2i(rv).(map[uint]float32), e) } -func (_ fastpathT) EncMapUintFloat32V(v map[uint]float32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintFloat32V(v map[uint]float32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -7725,44 +6168,47 @@ func (_ fastpathT) EncMapUintFloat32V(v map[uint]float32, checkNil bool, e *Enco i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint(k2))) + ee.WriteMapElemValue() + ee.EncodeFloat32(v[uint(k2)]) } - ee.EncodeUint(uint64(uint(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint(k2))) + ee.EncodeFloat32(v[uint(k2)]) } - ee.EncodeFloat32(v[uint(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat32(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeFloat32(v2) } - ee.EncodeFloat32(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintFloat64R(rv reflect.Value) { - fastpathTV.EncMapUintFloat64V(rv.Interface().(map[uint]float64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintFloat64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintFloat64V(rv2i(rv).(map[uint]float64), e) } -func (_ fastpathT) EncMapUintFloat64V(v map[uint]float64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintFloat64V(v map[uint]float64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -7771,44 +6217,47 @@ func (_ fastpathT) EncMapUintFloat64V(v map[uint]float64, checkNil bool, e *Enco i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint(k2))) + ee.WriteMapElemValue() + ee.EncodeFloat64(v[uint(k2)]) } - ee.EncodeUint(uint64(uint(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint(k2))) + ee.EncodeFloat64(v[uint(k2)]) } - ee.EncodeFloat64(v[uint(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat64(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeFloat64(v2) } - ee.EncodeFloat64(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintBoolR(rv reflect.Value) { - fastpathTV.EncMapUintBoolV(rv.Interface().(map[uint]bool), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintBoolR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintBoolV(rv2i(rv).(map[uint]bool), e) } -func (_ fastpathT) EncMapUintBoolV(v map[uint]bool, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintBoolV(v map[uint]bool, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -7817,44 +6266,47 @@ func (_ fastpathT) EncMapUintBoolV(v map[uint]bool, checkNil bool, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint(k2))) + ee.WriteMapElemValue() + ee.EncodeBool(v[uint(k2)]) } - ee.EncodeUint(uint64(uint(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint(k2))) + ee.EncodeBool(v[uint(k2)]) } - ee.EncodeBool(v[uint(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeBool(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeBool(v2) } - ee.EncodeBool(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint8IntfR(rv reflect.Value) { - fastpathTV.EncMapUint8IntfV(rv.Interface().(map[uint8]interface{}), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint8IntfR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint8IntfV(rv2i(rv).(map[uint8]interface{}), e) } -func (_ fastpathT) EncMapUint8IntfV(v map[uint8]interface{}, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint8IntfV(v map[uint8]interface{}, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -7863,44 +6315,47 @@ func (_ fastpathT) EncMapUint8IntfV(v map[uint8]interface{}, checkNil bool, e *E i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint8(k2))) + ee.WriteMapElemValue() + e.encode(v[uint8(k2)]) } - ee.EncodeUint(uint64(uint8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint8(k2))) + e.encode(v[uint8(k2)]) } - e.encode(v[uint8(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint8StringR(rv reflect.Value) { - fastpathTV.EncMapUint8StringV(rv.Interface().(map[uint8]string), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint8StringR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint8StringV(rv2i(rv).(map[uint8]string), e) } -func (_ fastpathT) EncMapUint8StringV(v map[uint8]string, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint8StringV(v map[uint8]string, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -7909,44 +6364,47 @@ func (_ fastpathT) EncMapUint8StringV(v map[uint8]string, checkNil bool, e *Enco i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint8(k2))) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v[uint8(k2)]) } - ee.EncodeUint(uint64(uint8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint8(k2))) + ee.EncodeString(cUTF8, v[uint8(k2)]) } - ee.EncodeString(c_UTF8, v[uint8(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeString(cUTF8, v2) } - ee.EncodeString(c_UTF8, v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint8UintR(rv reflect.Value) { - fastpathTV.EncMapUint8UintV(rv.Interface().(map[uint8]uint), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint8UintR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint8UintV(rv2i(rv).(map[uint8]uint), e) } -func (_ fastpathT) EncMapUint8UintV(v map[uint8]uint, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint8UintV(v map[uint8]uint, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -7955,44 +6413,47 @@ func (_ fastpathT) EncMapUint8UintV(v map[uint8]uint, checkNil bool, e *Encoder) i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint8(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint8(k2)])) } - ee.EncodeUint(uint64(uint8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint8(k2))) + ee.EncodeUint(uint64(v[uint8(k2)])) } - ee.EncodeUint(uint64(v[uint8(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint8Uint8R(rv reflect.Value) { - fastpathTV.EncMapUint8Uint8V(rv.Interface().(map[uint8]uint8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint8Uint8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint8Uint8V(rv2i(rv).(map[uint8]uint8), e) } -func (_ fastpathT) EncMapUint8Uint8V(v map[uint8]uint8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint8Uint8V(v map[uint8]uint8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -8001,44 +6462,47 @@ func (_ fastpathT) EncMapUint8Uint8V(v map[uint8]uint8, checkNil bool, e *Encode i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint8(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint8(k2)])) } - ee.EncodeUint(uint64(uint8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint8(k2))) + ee.EncodeUint(uint64(v[uint8(k2)])) } - ee.EncodeUint(uint64(v[uint8(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint8Uint16R(rv reflect.Value) { - fastpathTV.EncMapUint8Uint16V(rv.Interface().(map[uint8]uint16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint8Uint16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint8Uint16V(rv2i(rv).(map[uint8]uint16), e) } -func (_ fastpathT) EncMapUint8Uint16V(v map[uint8]uint16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint8Uint16V(v map[uint8]uint16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -8047,44 +6511,47 @@ func (_ fastpathT) EncMapUint8Uint16V(v map[uint8]uint16, checkNil bool, e *Enco i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint8(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint8(k2)])) } - ee.EncodeUint(uint64(uint8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint8(k2))) + ee.EncodeUint(uint64(v[uint8(k2)])) } - ee.EncodeUint(uint64(v[uint8(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint8Uint32R(rv reflect.Value) { - fastpathTV.EncMapUint8Uint32V(rv.Interface().(map[uint8]uint32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint8Uint32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint8Uint32V(rv2i(rv).(map[uint8]uint32), e) } -func (_ fastpathT) EncMapUint8Uint32V(v map[uint8]uint32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint8Uint32V(v map[uint8]uint32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -8093,44 +6560,47 @@ func (_ fastpathT) EncMapUint8Uint32V(v map[uint8]uint32, checkNil bool, e *Enco i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint8(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint8(k2)])) } - ee.EncodeUint(uint64(uint8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint8(k2))) + ee.EncodeUint(uint64(v[uint8(k2)])) } - ee.EncodeUint(uint64(v[uint8(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint8Uint64R(rv reflect.Value) { - fastpathTV.EncMapUint8Uint64V(rv.Interface().(map[uint8]uint64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint8Uint64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint8Uint64V(rv2i(rv).(map[uint8]uint64), e) } -func (_ fastpathT) EncMapUint8Uint64V(v map[uint8]uint64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint8Uint64V(v map[uint8]uint64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -8139,44 +6609,47 @@ func (_ fastpathT) EncMapUint8Uint64V(v map[uint8]uint64, checkNil bool, e *Enco i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint8(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint8(k2)])) } - ee.EncodeUint(uint64(uint8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint8(k2))) + ee.EncodeUint(uint64(v[uint8(k2)])) } - ee.EncodeUint(uint64(v[uint8(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint8UintptrR(rv reflect.Value) { - fastpathTV.EncMapUint8UintptrV(rv.Interface().(map[uint8]uintptr), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint8UintptrR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint8UintptrV(rv2i(rv).(map[uint8]uintptr), e) } -func (_ fastpathT) EncMapUint8UintptrV(v map[uint8]uintptr, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint8UintptrV(v map[uint8]uintptr, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -8185,44 +6658,47 @@ func (_ fastpathT) EncMapUint8UintptrV(v map[uint8]uintptr, checkNil bool, e *En i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint8(k2))) + ee.WriteMapElemValue() + e.encode(v[uint8(k2)]) } - ee.EncodeUint(uint64(uint8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint8(k2))) + e.encode(v[uint8(k2)]) } - e.encode(v[uint8(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint8IntR(rv reflect.Value) { - fastpathTV.EncMapUint8IntV(rv.Interface().(map[uint8]int), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint8IntR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint8IntV(rv2i(rv).(map[uint8]int), e) } -func (_ fastpathT) EncMapUint8IntV(v map[uint8]int, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint8IntV(v map[uint8]int, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -8231,44 +6707,47 @@ func (_ fastpathT) EncMapUint8IntV(v map[uint8]int, checkNil bool, e *Encoder) { i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint8(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint8(k2)])) } - ee.EncodeUint(uint64(uint8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint8(k2))) + ee.EncodeInt(int64(v[uint8(k2)])) } - ee.EncodeInt(int64(v[uint8(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint8Int8R(rv reflect.Value) { - fastpathTV.EncMapUint8Int8V(rv.Interface().(map[uint8]int8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint8Int8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint8Int8V(rv2i(rv).(map[uint8]int8), e) } -func (_ fastpathT) EncMapUint8Int8V(v map[uint8]int8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint8Int8V(v map[uint8]int8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -8277,44 +6756,47 @@ func (_ fastpathT) EncMapUint8Int8V(v map[uint8]int8, checkNil bool, e *Encoder) i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint8(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint8(k2)])) } - ee.EncodeUint(uint64(uint8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint8(k2))) + ee.EncodeInt(int64(v[uint8(k2)])) } - ee.EncodeInt(int64(v[uint8(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint8Int16R(rv reflect.Value) { - fastpathTV.EncMapUint8Int16V(rv.Interface().(map[uint8]int16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint8Int16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint8Int16V(rv2i(rv).(map[uint8]int16), e) } -func (_ fastpathT) EncMapUint8Int16V(v map[uint8]int16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint8Int16V(v map[uint8]int16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -8323,44 +6805,47 @@ func (_ fastpathT) EncMapUint8Int16V(v map[uint8]int16, checkNil bool, e *Encode i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint8(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint8(k2)])) } - ee.EncodeUint(uint64(uint8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint8(k2))) + ee.EncodeInt(int64(v[uint8(k2)])) } - ee.EncodeInt(int64(v[uint8(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint8Int32R(rv reflect.Value) { - fastpathTV.EncMapUint8Int32V(rv.Interface().(map[uint8]int32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint8Int32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint8Int32V(rv2i(rv).(map[uint8]int32), e) } -func (_ fastpathT) EncMapUint8Int32V(v map[uint8]int32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint8Int32V(v map[uint8]int32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -8369,44 +6854,47 @@ func (_ fastpathT) EncMapUint8Int32V(v map[uint8]int32, checkNil bool, e *Encode i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint8(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint8(k2)])) } - ee.EncodeUint(uint64(uint8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint8(k2))) + ee.EncodeInt(int64(v[uint8(k2)])) } - ee.EncodeInt(int64(v[uint8(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint8Int64R(rv reflect.Value) { - fastpathTV.EncMapUint8Int64V(rv.Interface().(map[uint8]int64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint8Int64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint8Int64V(rv2i(rv).(map[uint8]int64), e) } -func (_ fastpathT) EncMapUint8Int64V(v map[uint8]int64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint8Int64V(v map[uint8]int64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -8415,44 +6903,47 @@ func (_ fastpathT) EncMapUint8Int64V(v map[uint8]int64, checkNil bool, e *Encode i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint8(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint8(k2)])) } - ee.EncodeUint(uint64(uint8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint8(k2))) + ee.EncodeInt(int64(v[uint8(k2)])) } - ee.EncodeInt(int64(v[uint8(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint8Float32R(rv reflect.Value) { - fastpathTV.EncMapUint8Float32V(rv.Interface().(map[uint8]float32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint8Float32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint8Float32V(rv2i(rv).(map[uint8]float32), e) } -func (_ fastpathT) EncMapUint8Float32V(v map[uint8]float32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint8Float32V(v map[uint8]float32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -8461,44 +6952,47 @@ func (_ fastpathT) EncMapUint8Float32V(v map[uint8]float32, checkNil bool, e *En i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint8(k2))) + ee.WriteMapElemValue() + ee.EncodeFloat32(v[uint8(k2)]) } - ee.EncodeUint(uint64(uint8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint8(k2))) + ee.EncodeFloat32(v[uint8(k2)]) } - ee.EncodeFloat32(v[uint8(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat32(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeFloat32(v2) } - ee.EncodeFloat32(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint8Float64R(rv reflect.Value) { - fastpathTV.EncMapUint8Float64V(rv.Interface().(map[uint8]float64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint8Float64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint8Float64V(rv2i(rv).(map[uint8]float64), e) } -func (_ fastpathT) EncMapUint8Float64V(v map[uint8]float64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint8Float64V(v map[uint8]float64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -8507,44 +7001,47 @@ func (_ fastpathT) EncMapUint8Float64V(v map[uint8]float64, checkNil bool, e *En i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint8(k2))) + ee.WriteMapElemValue() + ee.EncodeFloat64(v[uint8(k2)]) } - ee.EncodeUint(uint64(uint8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint8(k2))) + ee.EncodeFloat64(v[uint8(k2)]) } - ee.EncodeFloat64(v[uint8(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat64(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeFloat64(v2) } - ee.EncodeFloat64(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint8BoolR(rv reflect.Value) { - fastpathTV.EncMapUint8BoolV(rv.Interface().(map[uint8]bool), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint8BoolR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint8BoolV(rv2i(rv).(map[uint8]bool), e) } -func (_ fastpathT) EncMapUint8BoolV(v map[uint8]bool, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint8BoolV(v map[uint8]bool, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -8553,44 +7050,47 @@ func (_ fastpathT) EncMapUint8BoolV(v map[uint8]bool, checkNil bool, e *Encoder) i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint8(k2))) + ee.WriteMapElemValue() + ee.EncodeBool(v[uint8(k2)]) } - ee.EncodeUint(uint64(uint8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint8(k2))) + ee.EncodeBool(v[uint8(k2)]) } - ee.EncodeBool(v[uint8(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeBool(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeBool(v2) } - ee.EncodeBool(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint16IntfR(rv reflect.Value) { - fastpathTV.EncMapUint16IntfV(rv.Interface().(map[uint16]interface{}), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint16IntfR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint16IntfV(rv2i(rv).(map[uint16]interface{}), e) } -func (_ fastpathT) EncMapUint16IntfV(v map[uint16]interface{}, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint16IntfV(v map[uint16]interface{}, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -8599,44 +7099,47 @@ func (_ fastpathT) EncMapUint16IntfV(v map[uint16]interface{}, checkNil bool, e i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint16(k2))) + ee.WriteMapElemValue() + e.encode(v[uint16(k2)]) } - ee.EncodeUint(uint64(uint16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint16(k2))) + e.encode(v[uint16(k2)]) } - e.encode(v[uint16(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint16StringR(rv reflect.Value) { - fastpathTV.EncMapUint16StringV(rv.Interface().(map[uint16]string), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint16StringR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint16StringV(rv2i(rv).(map[uint16]string), e) } -func (_ fastpathT) EncMapUint16StringV(v map[uint16]string, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint16StringV(v map[uint16]string, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -8645,44 +7148,47 @@ func (_ fastpathT) EncMapUint16StringV(v map[uint16]string, checkNil bool, e *En i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint16(k2))) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v[uint16(k2)]) } - ee.EncodeUint(uint64(uint16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint16(k2))) + ee.EncodeString(cUTF8, v[uint16(k2)]) } - ee.EncodeString(c_UTF8, v[uint16(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeString(cUTF8, v2) } - ee.EncodeString(c_UTF8, v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint16UintR(rv reflect.Value) { - fastpathTV.EncMapUint16UintV(rv.Interface().(map[uint16]uint), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint16UintR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint16UintV(rv2i(rv).(map[uint16]uint), e) } -func (_ fastpathT) EncMapUint16UintV(v map[uint16]uint, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint16UintV(v map[uint16]uint, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -8691,44 +7197,47 @@ func (_ fastpathT) EncMapUint16UintV(v map[uint16]uint, checkNil bool, e *Encode i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint16(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint16(k2)])) } - ee.EncodeUint(uint64(uint16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint16(k2))) + ee.EncodeUint(uint64(v[uint16(k2)])) } - ee.EncodeUint(uint64(v[uint16(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint16Uint8R(rv reflect.Value) { - fastpathTV.EncMapUint16Uint8V(rv.Interface().(map[uint16]uint8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint16Uint8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint16Uint8V(rv2i(rv).(map[uint16]uint8), e) } -func (_ fastpathT) EncMapUint16Uint8V(v map[uint16]uint8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint16Uint8V(v map[uint16]uint8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -8737,44 +7246,47 @@ func (_ fastpathT) EncMapUint16Uint8V(v map[uint16]uint8, checkNil bool, e *Enco i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint16(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint16(k2)])) } - ee.EncodeUint(uint64(uint16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint16(k2))) + ee.EncodeUint(uint64(v[uint16(k2)])) } - ee.EncodeUint(uint64(v[uint16(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint16Uint16R(rv reflect.Value) { - fastpathTV.EncMapUint16Uint16V(rv.Interface().(map[uint16]uint16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint16Uint16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint16Uint16V(rv2i(rv).(map[uint16]uint16), e) } -func (_ fastpathT) EncMapUint16Uint16V(v map[uint16]uint16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint16Uint16V(v map[uint16]uint16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -8783,44 +7295,47 @@ func (_ fastpathT) EncMapUint16Uint16V(v map[uint16]uint16, checkNil bool, e *En i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint16(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint16(k2)])) } - ee.EncodeUint(uint64(uint16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint16(k2))) + ee.EncodeUint(uint64(v[uint16(k2)])) } - ee.EncodeUint(uint64(v[uint16(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint16Uint32R(rv reflect.Value) { - fastpathTV.EncMapUint16Uint32V(rv.Interface().(map[uint16]uint32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint16Uint32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint16Uint32V(rv2i(rv).(map[uint16]uint32), e) } -func (_ fastpathT) EncMapUint16Uint32V(v map[uint16]uint32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint16Uint32V(v map[uint16]uint32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -8829,44 +7344,47 @@ func (_ fastpathT) EncMapUint16Uint32V(v map[uint16]uint32, checkNil bool, e *En i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint16(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint16(k2)])) } - ee.EncodeUint(uint64(uint16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint16(k2))) + ee.EncodeUint(uint64(v[uint16(k2)])) } - ee.EncodeUint(uint64(v[uint16(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint16Uint64R(rv reflect.Value) { - fastpathTV.EncMapUint16Uint64V(rv.Interface().(map[uint16]uint64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint16Uint64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint16Uint64V(rv2i(rv).(map[uint16]uint64), e) } -func (_ fastpathT) EncMapUint16Uint64V(v map[uint16]uint64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint16Uint64V(v map[uint16]uint64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -8875,44 +7393,47 @@ func (_ fastpathT) EncMapUint16Uint64V(v map[uint16]uint64, checkNil bool, e *En i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint16(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint16(k2)])) } - ee.EncodeUint(uint64(uint16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint16(k2))) + ee.EncodeUint(uint64(v[uint16(k2)])) } - ee.EncodeUint(uint64(v[uint16(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint16UintptrR(rv reflect.Value) { - fastpathTV.EncMapUint16UintptrV(rv.Interface().(map[uint16]uintptr), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint16UintptrR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint16UintptrV(rv2i(rv).(map[uint16]uintptr), e) } -func (_ fastpathT) EncMapUint16UintptrV(v map[uint16]uintptr, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint16UintptrV(v map[uint16]uintptr, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -8921,44 +7442,47 @@ func (_ fastpathT) EncMapUint16UintptrV(v map[uint16]uintptr, checkNil bool, e * i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint16(k2))) + ee.WriteMapElemValue() + e.encode(v[uint16(k2)]) } - ee.EncodeUint(uint64(uint16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint16(k2))) + e.encode(v[uint16(k2)]) } - e.encode(v[uint16(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint16IntR(rv reflect.Value) { - fastpathTV.EncMapUint16IntV(rv.Interface().(map[uint16]int), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint16IntR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint16IntV(rv2i(rv).(map[uint16]int), e) } -func (_ fastpathT) EncMapUint16IntV(v map[uint16]int, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint16IntV(v map[uint16]int, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -8967,44 +7491,47 @@ func (_ fastpathT) EncMapUint16IntV(v map[uint16]int, checkNil bool, e *Encoder) i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint16(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint16(k2)])) } - ee.EncodeUint(uint64(uint16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint16(k2))) + ee.EncodeInt(int64(v[uint16(k2)])) } - ee.EncodeInt(int64(v[uint16(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint16Int8R(rv reflect.Value) { - fastpathTV.EncMapUint16Int8V(rv.Interface().(map[uint16]int8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint16Int8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint16Int8V(rv2i(rv).(map[uint16]int8), e) } -func (_ fastpathT) EncMapUint16Int8V(v map[uint16]int8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint16Int8V(v map[uint16]int8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -9013,44 +7540,47 @@ func (_ fastpathT) EncMapUint16Int8V(v map[uint16]int8, checkNil bool, e *Encode i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint16(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint16(k2)])) } - ee.EncodeUint(uint64(uint16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint16(k2))) + ee.EncodeInt(int64(v[uint16(k2)])) } - ee.EncodeInt(int64(v[uint16(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint16Int16R(rv reflect.Value) { - fastpathTV.EncMapUint16Int16V(rv.Interface().(map[uint16]int16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint16Int16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint16Int16V(rv2i(rv).(map[uint16]int16), e) } -func (_ fastpathT) EncMapUint16Int16V(v map[uint16]int16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint16Int16V(v map[uint16]int16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -9059,44 +7589,47 @@ func (_ fastpathT) EncMapUint16Int16V(v map[uint16]int16, checkNil bool, e *Enco i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint16(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint16(k2)])) } - ee.EncodeUint(uint64(uint16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint16(k2))) + ee.EncodeInt(int64(v[uint16(k2)])) } - ee.EncodeInt(int64(v[uint16(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint16Int32R(rv reflect.Value) { - fastpathTV.EncMapUint16Int32V(rv.Interface().(map[uint16]int32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint16Int32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint16Int32V(rv2i(rv).(map[uint16]int32), e) } -func (_ fastpathT) EncMapUint16Int32V(v map[uint16]int32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint16Int32V(v map[uint16]int32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -9105,44 +7638,47 @@ func (_ fastpathT) EncMapUint16Int32V(v map[uint16]int32, checkNil bool, e *Enco i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint16(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint16(k2)])) } - ee.EncodeUint(uint64(uint16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint16(k2))) + ee.EncodeInt(int64(v[uint16(k2)])) } - ee.EncodeInt(int64(v[uint16(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint16Int64R(rv reflect.Value) { - fastpathTV.EncMapUint16Int64V(rv.Interface().(map[uint16]int64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint16Int64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint16Int64V(rv2i(rv).(map[uint16]int64), e) } -func (_ fastpathT) EncMapUint16Int64V(v map[uint16]int64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint16Int64V(v map[uint16]int64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -9151,44 +7687,47 @@ func (_ fastpathT) EncMapUint16Int64V(v map[uint16]int64, checkNil bool, e *Enco i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint16(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint16(k2)])) } - ee.EncodeUint(uint64(uint16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint16(k2))) + ee.EncodeInt(int64(v[uint16(k2)])) } - ee.EncodeInt(int64(v[uint16(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint16Float32R(rv reflect.Value) { - fastpathTV.EncMapUint16Float32V(rv.Interface().(map[uint16]float32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint16Float32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint16Float32V(rv2i(rv).(map[uint16]float32), e) } -func (_ fastpathT) EncMapUint16Float32V(v map[uint16]float32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint16Float32V(v map[uint16]float32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -9197,44 +7736,47 @@ func (_ fastpathT) EncMapUint16Float32V(v map[uint16]float32, checkNil bool, e * i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint16(k2))) + ee.WriteMapElemValue() + ee.EncodeFloat32(v[uint16(k2)]) } - ee.EncodeUint(uint64(uint16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint16(k2))) + ee.EncodeFloat32(v[uint16(k2)]) } - ee.EncodeFloat32(v[uint16(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat32(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeFloat32(v2) } - ee.EncodeFloat32(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint16Float64R(rv reflect.Value) { - fastpathTV.EncMapUint16Float64V(rv.Interface().(map[uint16]float64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint16Float64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint16Float64V(rv2i(rv).(map[uint16]float64), e) } -func (_ fastpathT) EncMapUint16Float64V(v map[uint16]float64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint16Float64V(v map[uint16]float64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -9243,44 +7785,47 @@ func (_ fastpathT) EncMapUint16Float64V(v map[uint16]float64, checkNil bool, e * i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint16(k2))) + ee.WriteMapElemValue() + ee.EncodeFloat64(v[uint16(k2)]) } - ee.EncodeUint(uint64(uint16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint16(k2))) + ee.EncodeFloat64(v[uint16(k2)]) } - ee.EncodeFloat64(v[uint16(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat64(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeFloat64(v2) } - ee.EncodeFloat64(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint16BoolR(rv reflect.Value) { - fastpathTV.EncMapUint16BoolV(rv.Interface().(map[uint16]bool), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint16BoolR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint16BoolV(rv2i(rv).(map[uint16]bool), e) } -func (_ fastpathT) EncMapUint16BoolV(v map[uint16]bool, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint16BoolV(v map[uint16]bool, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -9289,44 +7834,47 @@ func (_ fastpathT) EncMapUint16BoolV(v map[uint16]bool, checkNil bool, e *Encode i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint16(k2))) + ee.WriteMapElemValue() + ee.EncodeBool(v[uint16(k2)]) } - ee.EncodeUint(uint64(uint16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint16(k2))) + ee.EncodeBool(v[uint16(k2)]) } - ee.EncodeBool(v[uint16(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeBool(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeBool(v2) } - ee.EncodeBool(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint32IntfR(rv reflect.Value) { - fastpathTV.EncMapUint32IntfV(rv.Interface().(map[uint32]interface{}), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint32IntfR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint32IntfV(rv2i(rv).(map[uint32]interface{}), e) } -func (_ fastpathT) EncMapUint32IntfV(v map[uint32]interface{}, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint32IntfV(v map[uint32]interface{}, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -9335,44 +7883,47 @@ func (_ fastpathT) EncMapUint32IntfV(v map[uint32]interface{}, checkNil bool, e i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint32(k2))) + ee.WriteMapElemValue() + e.encode(v[uint32(k2)]) } - ee.EncodeUint(uint64(uint32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint32(k2))) + e.encode(v[uint32(k2)]) } - e.encode(v[uint32(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint32StringR(rv reflect.Value) { - fastpathTV.EncMapUint32StringV(rv.Interface().(map[uint32]string), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint32StringR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint32StringV(rv2i(rv).(map[uint32]string), e) } -func (_ fastpathT) EncMapUint32StringV(v map[uint32]string, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint32StringV(v map[uint32]string, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -9381,44 +7932,47 @@ func (_ fastpathT) EncMapUint32StringV(v map[uint32]string, checkNil bool, e *En i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint32(k2))) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v[uint32(k2)]) } - ee.EncodeUint(uint64(uint32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint32(k2))) + ee.EncodeString(cUTF8, v[uint32(k2)]) } - ee.EncodeString(c_UTF8, v[uint32(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeString(cUTF8, v2) } - ee.EncodeString(c_UTF8, v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint32UintR(rv reflect.Value) { - fastpathTV.EncMapUint32UintV(rv.Interface().(map[uint32]uint), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint32UintR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint32UintV(rv2i(rv).(map[uint32]uint), e) } -func (_ fastpathT) EncMapUint32UintV(v map[uint32]uint, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint32UintV(v map[uint32]uint, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -9427,44 +7981,47 @@ func (_ fastpathT) EncMapUint32UintV(v map[uint32]uint, checkNil bool, e *Encode i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint32(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint32(k2)])) } - ee.EncodeUint(uint64(uint32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint32(k2))) + ee.EncodeUint(uint64(v[uint32(k2)])) } - ee.EncodeUint(uint64(v[uint32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint32Uint8R(rv reflect.Value) { - fastpathTV.EncMapUint32Uint8V(rv.Interface().(map[uint32]uint8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint32Uint8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint32Uint8V(rv2i(rv).(map[uint32]uint8), e) } -func (_ fastpathT) EncMapUint32Uint8V(v map[uint32]uint8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint32Uint8V(v map[uint32]uint8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -9473,44 +8030,47 @@ func (_ fastpathT) EncMapUint32Uint8V(v map[uint32]uint8, checkNil bool, e *Enco i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint32(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint32(k2)])) } - ee.EncodeUint(uint64(uint32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint32(k2))) + ee.EncodeUint(uint64(v[uint32(k2)])) } - ee.EncodeUint(uint64(v[uint32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint32Uint16R(rv reflect.Value) { - fastpathTV.EncMapUint32Uint16V(rv.Interface().(map[uint32]uint16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint32Uint16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint32Uint16V(rv2i(rv).(map[uint32]uint16), e) } -func (_ fastpathT) EncMapUint32Uint16V(v map[uint32]uint16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint32Uint16V(v map[uint32]uint16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -9519,44 +8079,47 @@ func (_ fastpathT) EncMapUint32Uint16V(v map[uint32]uint16, checkNil bool, e *En i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint32(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint32(k2)])) } - ee.EncodeUint(uint64(uint32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint32(k2))) + ee.EncodeUint(uint64(v[uint32(k2)])) } - ee.EncodeUint(uint64(v[uint32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint32Uint32R(rv reflect.Value) { - fastpathTV.EncMapUint32Uint32V(rv.Interface().(map[uint32]uint32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint32Uint32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint32Uint32V(rv2i(rv).(map[uint32]uint32), e) } -func (_ fastpathT) EncMapUint32Uint32V(v map[uint32]uint32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint32Uint32V(v map[uint32]uint32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -9565,44 +8128,47 @@ func (_ fastpathT) EncMapUint32Uint32V(v map[uint32]uint32, checkNil bool, e *En i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint32(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint32(k2)])) } - ee.EncodeUint(uint64(uint32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint32(k2))) + ee.EncodeUint(uint64(v[uint32(k2)])) } - ee.EncodeUint(uint64(v[uint32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint32Uint64R(rv reflect.Value) { - fastpathTV.EncMapUint32Uint64V(rv.Interface().(map[uint32]uint64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint32Uint64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint32Uint64V(rv2i(rv).(map[uint32]uint64), e) } -func (_ fastpathT) EncMapUint32Uint64V(v map[uint32]uint64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint32Uint64V(v map[uint32]uint64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -9611,44 +8177,47 @@ func (_ fastpathT) EncMapUint32Uint64V(v map[uint32]uint64, checkNil bool, e *En i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint32(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint32(k2)])) } - ee.EncodeUint(uint64(uint32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint32(k2))) + ee.EncodeUint(uint64(v[uint32(k2)])) } - ee.EncodeUint(uint64(v[uint32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint32UintptrR(rv reflect.Value) { - fastpathTV.EncMapUint32UintptrV(rv.Interface().(map[uint32]uintptr), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint32UintptrR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint32UintptrV(rv2i(rv).(map[uint32]uintptr), e) } -func (_ fastpathT) EncMapUint32UintptrV(v map[uint32]uintptr, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint32UintptrV(v map[uint32]uintptr, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -9657,44 +8226,47 @@ func (_ fastpathT) EncMapUint32UintptrV(v map[uint32]uintptr, checkNil bool, e * i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint32(k2))) + ee.WriteMapElemValue() + e.encode(v[uint32(k2)]) } - ee.EncodeUint(uint64(uint32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint32(k2))) + e.encode(v[uint32(k2)]) } - e.encode(v[uint32(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint32IntR(rv reflect.Value) { - fastpathTV.EncMapUint32IntV(rv.Interface().(map[uint32]int), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint32IntR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint32IntV(rv2i(rv).(map[uint32]int), e) } -func (_ fastpathT) EncMapUint32IntV(v map[uint32]int, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint32IntV(v map[uint32]int, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -9703,44 +8275,47 @@ func (_ fastpathT) EncMapUint32IntV(v map[uint32]int, checkNil bool, e *Encoder) i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint32(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint32(k2)])) } - ee.EncodeUint(uint64(uint32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint32(k2))) + ee.EncodeInt(int64(v[uint32(k2)])) } - ee.EncodeInt(int64(v[uint32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint32Int8R(rv reflect.Value) { - fastpathTV.EncMapUint32Int8V(rv.Interface().(map[uint32]int8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint32Int8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint32Int8V(rv2i(rv).(map[uint32]int8), e) } -func (_ fastpathT) EncMapUint32Int8V(v map[uint32]int8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint32Int8V(v map[uint32]int8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -9749,44 +8324,47 @@ func (_ fastpathT) EncMapUint32Int8V(v map[uint32]int8, checkNil bool, e *Encode i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint32(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint32(k2)])) } - ee.EncodeUint(uint64(uint32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint32(k2))) + ee.EncodeInt(int64(v[uint32(k2)])) } - ee.EncodeInt(int64(v[uint32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint32Int16R(rv reflect.Value) { - fastpathTV.EncMapUint32Int16V(rv.Interface().(map[uint32]int16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint32Int16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint32Int16V(rv2i(rv).(map[uint32]int16), e) } -func (_ fastpathT) EncMapUint32Int16V(v map[uint32]int16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint32Int16V(v map[uint32]int16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -9795,44 +8373,47 @@ func (_ fastpathT) EncMapUint32Int16V(v map[uint32]int16, checkNil bool, e *Enco i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint32(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint32(k2)])) } - ee.EncodeUint(uint64(uint32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint32(k2))) + ee.EncodeInt(int64(v[uint32(k2)])) } - ee.EncodeInt(int64(v[uint32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint32Int32R(rv reflect.Value) { - fastpathTV.EncMapUint32Int32V(rv.Interface().(map[uint32]int32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint32Int32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint32Int32V(rv2i(rv).(map[uint32]int32), e) } -func (_ fastpathT) EncMapUint32Int32V(v map[uint32]int32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint32Int32V(v map[uint32]int32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -9841,44 +8422,47 @@ func (_ fastpathT) EncMapUint32Int32V(v map[uint32]int32, checkNil bool, e *Enco i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint32(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint32(k2)])) } - ee.EncodeUint(uint64(uint32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint32(k2))) + ee.EncodeInt(int64(v[uint32(k2)])) } - ee.EncodeInt(int64(v[uint32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint32Int64R(rv reflect.Value) { - fastpathTV.EncMapUint32Int64V(rv.Interface().(map[uint32]int64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint32Int64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint32Int64V(rv2i(rv).(map[uint32]int64), e) } -func (_ fastpathT) EncMapUint32Int64V(v map[uint32]int64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint32Int64V(v map[uint32]int64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -9887,44 +8471,47 @@ func (_ fastpathT) EncMapUint32Int64V(v map[uint32]int64, checkNil bool, e *Enco i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint32(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint32(k2)])) } - ee.EncodeUint(uint64(uint32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint32(k2))) + ee.EncodeInt(int64(v[uint32(k2)])) } - ee.EncodeInt(int64(v[uint32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint32Float32R(rv reflect.Value) { - fastpathTV.EncMapUint32Float32V(rv.Interface().(map[uint32]float32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint32Float32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint32Float32V(rv2i(rv).(map[uint32]float32), e) } -func (_ fastpathT) EncMapUint32Float32V(v map[uint32]float32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint32Float32V(v map[uint32]float32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -9933,44 +8520,47 @@ func (_ fastpathT) EncMapUint32Float32V(v map[uint32]float32, checkNil bool, e * i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint32(k2))) + ee.WriteMapElemValue() + ee.EncodeFloat32(v[uint32(k2)]) } - ee.EncodeUint(uint64(uint32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint32(k2))) + ee.EncodeFloat32(v[uint32(k2)]) } - ee.EncodeFloat32(v[uint32(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat32(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeFloat32(v2) } - ee.EncodeFloat32(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint32Float64R(rv reflect.Value) { - fastpathTV.EncMapUint32Float64V(rv.Interface().(map[uint32]float64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint32Float64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint32Float64V(rv2i(rv).(map[uint32]float64), e) } -func (_ fastpathT) EncMapUint32Float64V(v map[uint32]float64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint32Float64V(v map[uint32]float64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -9979,44 +8569,47 @@ func (_ fastpathT) EncMapUint32Float64V(v map[uint32]float64, checkNil bool, e * i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint32(k2))) + ee.WriteMapElemValue() + ee.EncodeFloat64(v[uint32(k2)]) } - ee.EncodeUint(uint64(uint32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint32(k2))) + ee.EncodeFloat64(v[uint32(k2)]) } - ee.EncodeFloat64(v[uint32(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat64(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeFloat64(v2) } - ee.EncodeFloat64(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint32BoolR(rv reflect.Value) { - fastpathTV.EncMapUint32BoolV(rv.Interface().(map[uint32]bool), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint32BoolR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint32BoolV(rv2i(rv).(map[uint32]bool), e) } -func (_ fastpathT) EncMapUint32BoolV(v map[uint32]bool, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint32BoolV(v map[uint32]bool, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -10025,44 +8618,47 @@ func (_ fastpathT) EncMapUint32BoolV(v map[uint32]bool, checkNil bool, e *Encode i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint32(k2))) + ee.WriteMapElemValue() + ee.EncodeBool(v[uint32(k2)]) } - ee.EncodeUint(uint64(uint32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint32(k2))) + ee.EncodeBool(v[uint32(k2)]) } - ee.EncodeBool(v[uint32(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeBool(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeBool(v2) } - ee.EncodeBool(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint64IntfR(rv reflect.Value) { - fastpathTV.EncMapUint64IntfV(rv.Interface().(map[uint64]interface{}), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint64IntfR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint64IntfV(rv2i(rv).(map[uint64]interface{}), e) } -func (_ fastpathT) EncMapUint64IntfV(v map[uint64]interface{}, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint64IntfV(v map[uint64]interface{}, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -10071,44 +8667,47 @@ func (_ fastpathT) EncMapUint64IntfV(v map[uint64]interface{}, checkNil bool, e i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint64(k2))) + ee.WriteMapElemValue() + e.encode(v[uint64(k2)]) } - ee.EncodeUint(uint64(uint64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint64(k2))) + e.encode(v[uint64(k2)]) } - e.encode(v[uint64(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint64StringR(rv reflect.Value) { - fastpathTV.EncMapUint64StringV(rv.Interface().(map[uint64]string), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint64StringR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint64StringV(rv2i(rv).(map[uint64]string), e) } -func (_ fastpathT) EncMapUint64StringV(v map[uint64]string, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint64StringV(v map[uint64]string, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -10117,44 +8716,47 @@ func (_ fastpathT) EncMapUint64StringV(v map[uint64]string, checkNil bool, e *En i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint64(k2))) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v[uint64(k2)]) } - ee.EncodeUint(uint64(uint64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint64(k2))) + ee.EncodeString(cUTF8, v[uint64(k2)]) } - ee.EncodeString(c_UTF8, v[uint64(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeString(cUTF8, v2) } - ee.EncodeString(c_UTF8, v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint64UintR(rv reflect.Value) { - fastpathTV.EncMapUint64UintV(rv.Interface().(map[uint64]uint), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint64UintR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint64UintV(rv2i(rv).(map[uint64]uint), e) } -func (_ fastpathT) EncMapUint64UintV(v map[uint64]uint, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint64UintV(v map[uint64]uint, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -10163,44 +8765,47 @@ func (_ fastpathT) EncMapUint64UintV(v map[uint64]uint, checkNil bool, e *Encode i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint64(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint64(k2)])) } - ee.EncodeUint(uint64(uint64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint64(k2))) + ee.EncodeUint(uint64(v[uint64(k2)])) } - ee.EncodeUint(uint64(v[uint64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint64Uint8R(rv reflect.Value) { - fastpathTV.EncMapUint64Uint8V(rv.Interface().(map[uint64]uint8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint64Uint8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint64Uint8V(rv2i(rv).(map[uint64]uint8), e) } -func (_ fastpathT) EncMapUint64Uint8V(v map[uint64]uint8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint64Uint8V(v map[uint64]uint8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -10209,44 +8814,47 @@ func (_ fastpathT) EncMapUint64Uint8V(v map[uint64]uint8, checkNil bool, e *Enco i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint64(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint64(k2)])) } - ee.EncodeUint(uint64(uint64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint64(k2))) + ee.EncodeUint(uint64(v[uint64(k2)])) } - ee.EncodeUint(uint64(v[uint64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint64Uint16R(rv reflect.Value) { - fastpathTV.EncMapUint64Uint16V(rv.Interface().(map[uint64]uint16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint64Uint16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint64Uint16V(rv2i(rv).(map[uint64]uint16), e) } -func (_ fastpathT) EncMapUint64Uint16V(v map[uint64]uint16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint64Uint16V(v map[uint64]uint16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -10255,44 +8863,47 @@ func (_ fastpathT) EncMapUint64Uint16V(v map[uint64]uint16, checkNil bool, e *En i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint64(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint64(k2)])) } - ee.EncodeUint(uint64(uint64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint64(k2))) + ee.EncodeUint(uint64(v[uint64(k2)])) } - ee.EncodeUint(uint64(v[uint64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint64Uint32R(rv reflect.Value) { - fastpathTV.EncMapUint64Uint32V(rv.Interface().(map[uint64]uint32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint64Uint32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint64Uint32V(rv2i(rv).(map[uint64]uint32), e) } -func (_ fastpathT) EncMapUint64Uint32V(v map[uint64]uint32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint64Uint32V(v map[uint64]uint32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -10301,44 +8912,47 @@ func (_ fastpathT) EncMapUint64Uint32V(v map[uint64]uint32, checkNil bool, e *En i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint64(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint64(k2)])) } - ee.EncodeUint(uint64(uint64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint64(k2))) + ee.EncodeUint(uint64(v[uint64(k2)])) } - ee.EncodeUint(uint64(v[uint64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint64Uint64R(rv reflect.Value) { - fastpathTV.EncMapUint64Uint64V(rv.Interface().(map[uint64]uint64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint64Uint64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint64Uint64V(rv2i(rv).(map[uint64]uint64), e) } -func (_ fastpathT) EncMapUint64Uint64V(v map[uint64]uint64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint64Uint64V(v map[uint64]uint64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -10347,44 +8961,47 @@ func (_ fastpathT) EncMapUint64Uint64V(v map[uint64]uint64, checkNil bool, e *En i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint64(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uint64(k2)])) } - ee.EncodeUint(uint64(uint64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint64(k2))) + ee.EncodeUint(uint64(v[uint64(k2)])) } - ee.EncodeUint(uint64(v[uint64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint64UintptrR(rv reflect.Value) { - fastpathTV.EncMapUint64UintptrV(rv.Interface().(map[uint64]uintptr), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint64UintptrR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint64UintptrV(rv2i(rv).(map[uint64]uintptr), e) } -func (_ fastpathT) EncMapUint64UintptrV(v map[uint64]uintptr, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint64UintptrV(v map[uint64]uintptr, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -10393,44 +9010,47 @@ func (_ fastpathT) EncMapUint64UintptrV(v map[uint64]uintptr, checkNil bool, e * i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint64(k2))) + ee.WriteMapElemValue() + e.encode(v[uint64(k2)]) } - ee.EncodeUint(uint64(uint64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint64(k2))) + e.encode(v[uint64(k2)]) } - e.encode(v[uint64(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint64IntR(rv reflect.Value) { - fastpathTV.EncMapUint64IntV(rv.Interface().(map[uint64]int), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint64IntR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint64IntV(rv2i(rv).(map[uint64]int), e) } -func (_ fastpathT) EncMapUint64IntV(v map[uint64]int, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint64IntV(v map[uint64]int, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -10439,44 +9059,47 @@ func (_ fastpathT) EncMapUint64IntV(v map[uint64]int, checkNil bool, e *Encoder) i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint64(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint64(k2)])) } - ee.EncodeUint(uint64(uint64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint64(k2))) + ee.EncodeInt(int64(v[uint64(k2)])) } - ee.EncodeInt(int64(v[uint64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint64Int8R(rv reflect.Value) { - fastpathTV.EncMapUint64Int8V(rv.Interface().(map[uint64]int8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint64Int8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint64Int8V(rv2i(rv).(map[uint64]int8), e) } -func (_ fastpathT) EncMapUint64Int8V(v map[uint64]int8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint64Int8V(v map[uint64]int8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -10485,44 +9108,47 @@ func (_ fastpathT) EncMapUint64Int8V(v map[uint64]int8, checkNil bool, e *Encode i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint64(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint64(k2)])) } - ee.EncodeUint(uint64(uint64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint64(k2))) + ee.EncodeInt(int64(v[uint64(k2)])) } - ee.EncodeInt(int64(v[uint64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint64Int16R(rv reflect.Value) { - fastpathTV.EncMapUint64Int16V(rv.Interface().(map[uint64]int16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint64Int16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint64Int16V(rv2i(rv).(map[uint64]int16), e) } -func (_ fastpathT) EncMapUint64Int16V(v map[uint64]int16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint64Int16V(v map[uint64]int16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -10531,44 +9157,47 @@ func (_ fastpathT) EncMapUint64Int16V(v map[uint64]int16, checkNil bool, e *Enco i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint64(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint64(k2)])) } - ee.EncodeUint(uint64(uint64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint64(k2))) + ee.EncodeInt(int64(v[uint64(k2)])) } - ee.EncodeInt(int64(v[uint64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint64Int32R(rv reflect.Value) { - fastpathTV.EncMapUint64Int32V(rv.Interface().(map[uint64]int32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint64Int32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint64Int32V(rv2i(rv).(map[uint64]int32), e) } -func (_ fastpathT) EncMapUint64Int32V(v map[uint64]int32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint64Int32V(v map[uint64]int32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -10577,44 +9206,47 @@ func (_ fastpathT) EncMapUint64Int32V(v map[uint64]int32, checkNil bool, e *Enco i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint64(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint64(k2)])) } - ee.EncodeUint(uint64(uint64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint64(k2))) + ee.EncodeInt(int64(v[uint64(k2)])) } - ee.EncodeInt(int64(v[uint64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint64Int64R(rv reflect.Value) { - fastpathTV.EncMapUint64Int64V(rv.Interface().(map[uint64]int64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint64Int64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint64Int64V(rv2i(rv).(map[uint64]int64), e) } -func (_ fastpathT) EncMapUint64Int64V(v map[uint64]int64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint64Int64V(v map[uint64]int64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -10623,44 +9255,47 @@ func (_ fastpathT) EncMapUint64Int64V(v map[uint64]int64, checkNil bool, e *Enco i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint64(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uint64(k2)])) } - ee.EncodeUint(uint64(uint64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint64(k2))) + ee.EncodeInt(int64(v[uint64(k2)])) } - ee.EncodeInt(int64(v[uint64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint64Float32R(rv reflect.Value) { - fastpathTV.EncMapUint64Float32V(rv.Interface().(map[uint64]float32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint64Float32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint64Float32V(rv2i(rv).(map[uint64]float32), e) } -func (_ fastpathT) EncMapUint64Float32V(v map[uint64]float32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint64Float32V(v map[uint64]float32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -10669,44 +9304,47 @@ func (_ fastpathT) EncMapUint64Float32V(v map[uint64]float32, checkNil bool, e * i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint64(k2))) + ee.WriteMapElemValue() + ee.EncodeFloat32(v[uint64(k2)]) } - ee.EncodeUint(uint64(uint64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint64(k2))) + ee.EncodeFloat32(v[uint64(k2)]) } - ee.EncodeFloat32(v[uint64(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat32(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeFloat32(v2) } - ee.EncodeFloat32(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint64Float64R(rv reflect.Value) { - fastpathTV.EncMapUint64Float64V(rv.Interface().(map[uint64]float64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint64Float64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint64Float64V(rv2i(rv).(map[uint64]float64), e) } -func (_ fastpathT) EncMapUint64Float64V(v map[uint64]float64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint64Float64V(v map[uint64]float64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -10715,44 +9353,47 @@ func (_ fastpathT) EncMapUint64Float64V(v map[uint64]float64, checkNil bool, e * i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint64(k2))) + ee.WriteMapElemValue() + ee.EncodeFloat64(v[uint64(k2)]) } - ee.EncodeUint(uint64(uint64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint64(k2))) + ee.EncodeFloat64(v[uint64(k2)]) } - ee.EncodeFloat64(v[uint64(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat64(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeFloat64(v2) } - ee.EncodeFloat64(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUint64BoolR(rv reflect.Value) { - fastpathTV.EncMapUint64BoolV(rv.Interface().(map[uint64]bool), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUint64BoolR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUint64BoolV(rv2i(rv).(map[uint64]bool), e) } -func (_ fastpathT) EncMapUint64BoolV(v map[uint64]bool, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUint64BoolV(v map[uint64]bool, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -10761,44 +9402,47 @@ func (_ fastpathT) EncMapUint64BoolV(v map[uint64]bool, checkNil bool, e *Encode i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(uint64(k2))) + ee.WriteMapElemValue() + ee.EncodeBool(v[uint64(k2)]) } - ee.EncodeUint(uint64(uint64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeUint(uint64(uint64(k2))) + ee.EncodeBool(v[uint64(k2)]) } - ee.EncodeBool(v[uint64(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeUint(uint64(k2)) + ee.WriteMapElemValue() + ee.EncodeBool(v2) } - ee.EncodeUint(uint64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeUint(uint64(k2)) + ee.EncodeBool(v2) } - ee.EncodeBool(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintptrIntfR(rv reflect.Value) { - fastpathTV.EncMapUintptrIntfV(rv.Interface().(map[uintptr]interface{}), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintptrIntfR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintptrIntfV(rv2i(rv).(map[uintptr]interface{}), e) } -func (_ fastpathT) EncMapUintptrIntfV(v map[uintptr]interface{}, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintptrIntfV(v map[uintptr]interface{}, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -10807,44 +9451,47 @@ func (_ fastpathT) EncMapUintptrIntfV(v map[uintptr]interface{}, checkNil bool, i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + e.encode(uintptr(k2)) + ee.WriteMapElemValue() + e.encode(v[uintptr(k2)]) } - e.encode(uintptr(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + e.encode(uintptr(k2)) + e.encode(v[uintptr(k2)]) } - e.encode(v[uintptr(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + e.encode(v2) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintptrStringR(rv reflect.Value) { - fastpathTV.EncMapUintptrStringV(rv.Interface().(map[uintptr]string), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintptrStringR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintptrStringV(rv2i(rv).(map[uintptr]string), e) } -func (_ fastpathT) EncMapUintptrStringV(v map[uintptr]string, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintptrStringV(v map[uintptr]string, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -10853,44 +9500,47 @@ func (_ fastpathT) EncMapUintptrStringV(v map[uintptr]string, checkNil bool, e * i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + e.encode(uintptr(k2)) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v[uintptr(k2)]) } - e.encode(uintptr(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + e.encode(uintptr(k2)) + ee.EncodeString(cUTF8, v[uintptr(k2)]) } - ee.EncodeString(c_UTF8, v[uintptr(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v2) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeString(cUTF8, v2) } - ee.EncodeString(c_UTF8, v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintptrUintR(rv reflect.Value) { - fastpathTV.EncMapUintptrUintV(rv.Interface().(map[uintptr]uint), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintptrUintR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintptrUintV(rv2i(rv).(map[uintptr]uint), e) } -func (_ fastpathT) EncMapUintptrUintV(v map[uintptr]uint, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintptrUintV(v map[uintptr]uint, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -10899,44 +9549,47 @@ func (_ fastpathT) EncMapUintptrUintV(v map[uintptr]uint, checkNil bool, e *Enco i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + e.encode(uintptr(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uintptr(k2)])) } - e.encode(uintptr(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + e.encode(uintptr(k2)) + ee.EncodeUint(uint64(v[uintptr(k2)])) } - ee.EncodeUint(uint64(v[uintptr(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintptrUint8R(rv reflect.Value) { - fastpathTV.EncMapUintptrUint8V(rv.Interface().(map[uintptr]uint8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintptrUint8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintptrUint8V(rv2i(rv).(map[uintptr]uint8), e) } -func (_ fastpathT) EncMapUintptrUint8V(v map[uintptr]uint8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintptrUint8V(v map[uintptr]uint8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -10945,44 +9598,47 @@ func (_ fastpathT) EncMapUintptrUint8V(v map[uintptr]uint8, checkNil bool, e *En i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + e.encode(uintptr(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uintptr(k2)])) } - e.encode(uintptr(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + e.encode(uintptr(k2)) + ee.EncodeUint(uint64(v[uintptr(k2)])) } - ee.EncodeUint(uint64(v[uintptr(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintptrUint16R(rv reflect.Value) { - fastpathTV.EncMapUintptrUint16V(rv.Interface().(map[uintptr]uint16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintptrUint16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintptrUint16V(rv2i(rv).(map[uintptr]uint16), e) } -func (_ fastpathT) EncMapUintptrUint16V(v map[uintptr]uint16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintptrUint16V(v map[uintptr]uint16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -10991,44 +9647,47 @@ func (_ fastpathT) EncMapUintptrUint16V(v map[uintptr]uint16, checkNil bool, e * i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + e.encode(uintptr(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uintptr(k2)])) } - e.encode(uintptr(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + e.encode(uintptr(k2)) + ee.EncodeUint(uint64(v[uintptr(k2)])) } - ee.EncodeUint(uint64(v[uintptr(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintptrUint32R(rv reflect.Value) { - fastpathTV.EncMapUintptrUint32V(rv.Interface().(map[uintptr]uint32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintptrUint32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintptrUint32V(rv2i(rv).(map[uintptr]uint32), e) } -func (_ fastpathT) EncMapUintptrUint32V(v map[uintptr]uint32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintptrUint32V(v map[uintptr]uint32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -11037,44 +9696,47 @@ func (_ fastpathT) EncMapUintptrUint32V(v map[uintptr]uint32, checkNil bool, e * i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + e.encode(uintptr(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uintptr(k2)])) } - e.encode(uintptr(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + e.encode(uintptr(k2)) + ee.EncodeUint(uint64(v[uintptr(k2)])) } - ee.EncodeUint(uint64(v[uintptr(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintptrUint64R(rv reflect.Value) { - fastpathTV.EncMapUintptrUint64V(rv.Interface().(map[uintptr]uint64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintptrUint64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintptrUint64V(rv2i(rv).(map[uintptr]uint64), e) } -func (_ fastpathT) EncMapUintptrUint64V(v map[uintptr]uint64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintptrUint64V(v map[uintptr]uint64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -11083,44 +9745,47 @@ func (_ fastpathT) EncMapUintptrUint64V(v map[uintptr]uint64, checkNil bool, e * i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + e.encode(uintptr(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[uintptr(k2)])) } - e.encode(uintptr(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + e.encode(uintptr(k2)) + ee.EncodeUint(uint64(v[uintptr(k2)])) } - ee.EncodeUint(uint64(v[uintptr(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintptrUintptrR(rv reflect.Value) { - fastpathTV.EncMapUintptrUintptrV(rv.Interface().(map[uintptr]uintptr), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintptrUintptrR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintptrUintptrV(rv2i(rv).(map[uintptr]uintptr), e) } -func (_ fastpathT) EncMapUintptrUintptrV(v map[uintptr]uintptr, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintptrUintptrV(v map[uintptr]uintptr, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -11129,44 +9794,47 @@ func (_ fastpathT) EncMapUintptrUintptrV(v map[uintptr]uintptr, checkNil bool, e i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + e.encode(uintptr(k2)) + ee.WriteMapElemValue() + e.encode(v[uintptr(k2)]) } - e.encode(uintptr(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + e.encode(uintptr(k2)) + e.encode(v[uintptr(k2)]) } - e.encode(v[uintptr(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + e.encode(v2) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintptrIntR(rv reflect.Value) { - fastpathTV.EncMapUintptrIntV(rv.Interface().(map[uintptr]int), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintptrIntR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintptrIntV(rv2i(rv).(map[uintptr]int), e) } -func (_ fastpathT) EncMapUintptrIntV(v map[uintptr]int, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintptrIntV(v map[uintptr]int, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -11175,44 +9843,47 @@ func (_ fastpathT) EncMapUintptrIntV(v map[uintptr]int, checkNil bool, e *Encode i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + e.encode(uintptr(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uintptr(k2)])) } - e.encode(uintptr(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + e.encode(uintptr(k2)) + ee.EncodeInt(int64(v[uintptr(k2)])) } - ee.EncodeInt(int64(v[uintptr(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintptrInt8R(rv reflect.Value) { - fastpathTV.EncMapUintptrInt8V(rv.Interface().(map[uintptr]int8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintptrInt8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintptrInt8V(rv2i(rv).(map[uintptr]int8), e) } -func (_ fastpathT) EncMapUintptrInt8V(v map[uintptr]int8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintptrInt8V(v map[uintptr]int8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -11221,44 +9892,47 @@ func (_ fastpathT) EncMapUintptrInt8V(v map[uintptr]int8, checkNil bool, e *Enco i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + e.encode(uintptr(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uintptr(k2)])) } - e.encode(uintptr(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + e.encode(uintptr(k2)) + ee.EncodeInt(int64(v[uintptr(k2)])) } - ee.EncodeInt(int64(v[uintptr(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintptrInt16R(rv reflect.Value) { - fastpathTV.EncMapUintptrInt16V(rv.Interface().(map[uintptr]int16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintptrInt16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintptrInt16V(rv2i(rv).(map[uintptr]int16), e) } -func (_ fastpathT) EncMapUintptrInt16V(v map[uintptr]int16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintptrInt16V(v map[uintptr]int16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -11267,44 +9941,47 @@ func (_ fastpathT) EncMapUintptrInt16V(v map[uintptr]int16, checkNil bool, e *En i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + e.encode(uintptr(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uintptr(k2)])) } - e.encode(uintptr(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + e.encode(uintptr(k2)) + ee.EncodeInt(int64(v[uintptr(k2)])) } - ee.EncodeInt(int64(v[uintptr(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintptrInt32R(rv reflect.Value) { - fastpathTV.EncMapUintptrInt32V(rv.Interface().(map[uintptr]int32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintptrInt32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintptrInt32V(rv2i(rv).(map[uintptr]int32), e) } -func (_ fastpathT) EncMapUintptrInt32V(v map[uintptr]int32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintptrInt32V(v map[uintptr]int32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -11313,44 +9990,47 @@ func (_ fastpathT) EncMapUintptrInt32V(v map[uintptr]int32, checkNil bool, e *En i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + e.encode(uintptr(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uintptr(k2)])) } - e.encode(uintptr(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + e.encode(uintptr(k2)) + ee.EncodeInt(int64(v[uintptr(k2)])) } - ee.EncodeInt(int64(v[uintptr(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintptrInt64R(rv reflect.Value) { - fastpathTV.EncMapUintptrInt64V(rv.Interface().(map[uintptr]int64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintptrInt64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintptrInt64V(rv2i(rv).(map[uintptr]int64), e) } -func (_ fastpathT) EncMapUintptrInt64V(v map[uintptr]int64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintptrInt64V(v map[uintptr]int64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -11359,44 +10039,47 @@ func (_ fastpathT) EncMapUintptrInt64V(v map[uintptr]int64, checkNil bool, e *En i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + e.encode(uintptr(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[uintptr(k2)])) } - e.encode(uintptr(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + e.encode(uintptr(k2)) + ee.EncodeInt(int64(v[uintptr(k2)])) } - ee.EncodeInt(int64(v[uintptr(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintptrFloat32R(rv reflect.Value) { - fastpathTV.EncMapUintptrFloat32V(rv.Interface().(map[uintptr]float32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintptrFloat32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintptrFloat32V(rv2i(rv).(map[uintptr]float32), e) } -func (_ fastpathT) EncMapUintptrFloat32V(v map[uintptr]float32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintptrFloat32V(v map[uintptr]float32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -11405,44 +10088,47 @@ func (_ fastpathT) EncMapUintptrFloat32V(v map[uintptr]float32, checkNil bool, e i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + e.encode(uintptr(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat32(v[uintptr(k2)]) } - e.encode(uintptr(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + e.encode(uintptr(k2)) + ee.EncodeFloat32(v[uintptr(k2)]) } - ee.EncodeFloat32(v[uintptr(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeFloat32(v2) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeFloat32(v2) } - ee.EncodeFloat32(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintptrFloat64R(rv reflect.Value) { - fastpathTV.EncMapUintptrFloat64V(rv.Interface().(map[uintptr]float64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintptrFloat64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintptrFloat64V(rv2i(rv).(map[uintptr]float64), e) } -func (_ fastpathT) EncMapUintptrFloat64V(v map[uintptr]float64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintptrFloat64V(v map[uintptr]float64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -11451,44 +10137,47 @@ func (_ fastpathT) EncMapUintptrFloat64V(v map[uintptr]float64, checkNil bool, e i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + e.encode(uintptr(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat64(v[uintptr(k2)]) } - e.encode(uintptr(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + e.encode(uintptr(k2)) + ee.EncodeFloat64(v[uintptr(k2)]) } - ee.EncodeFloat64(v[uintptr(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeFloat64(v2) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeFloat64(v2) } - ee.EncodeFloat64(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapUintptrBoolR(rv reflect.Value) { - fastpathTV.EncMapUintptrBoolV(rv.Interface().(map[uintptr]bool), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapUintptrBoolR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapUintptrBoolV(rv2i(rv).(map[uintptr]bool), e) } -func (_ fastpathT) EncMapUintptrBoolV(v map[uintptr]bool, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapUintptrBoolV(v map[uintptr]bool, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]uint64, len(v)) var i int @@ -11497,44 +10186,47 @@ func (_ fastpathT) EncMapUintptrBoolV(v map[uintptr]bool, checkNil bool, e *Enco i++ } sort.Sort(uintSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + e.encode(uintptr(k2)) + ee.WriteMapElemValue() + ee.EncodeBool(v[uintptr(k2)]) } - e.encode(uintptr(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + e.encode(uintptr(k2)) + ee.EncodeBool(v[uintptr(k2)]) } - ee.EncodeBool(v[uintptr(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + e.encode(k2) + ee.WriteMapElemValue() + ee.EncodeBool(v2) } - e.encode(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + e.encode(k2) + ee.EncodeBool(v2) } - ee.EncodeBool(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntIntfR(rv reflect.Value) { - fastpathTV.EncMapIntIntfV(rv.Interface().(map[int]interface{}), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntIntfR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntIntfV(rv2i(rv).(map[int]interface{}), e) } -func (_ fastpathT) EncMapIntIntfV(v map[int]interface{}, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntIntfV(v map[int]interface{}, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -11543,44 +10235,47 @@ func (_ fastpathT) EncMapIntIntfV(v map[int]interface{}, checkNil bool, e *Encod i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int(k2))) + ee.WriteMapElemValue() + e.encode(v[int(k2)]) } - ee.EncodeInt(int64(int(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int(k2))) + e.encode(v[int(k2)]) } - e.encode(v[int(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntStringR(rv reflect.Value) { - fastpathTV.EncMapIntStringV(rv.Interface().(map[int]string), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntStringR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntStringV(rv2i(rv).(map[int]string), e) } -func (_ fastpathT) EncMapIntStringV(v map[int]string, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntStringV(v map[int]string, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -11589,44 +10284,47 @@ func (_ fastpathT) EncMapIntStringV(v map[int]string, checkNil bool, e *Encoder) i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int(k2))) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v[int(k2)]) } - ee.EncodeInt(int64(int(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int(k2))) + ee.EncodeString(cUTF8, v[int(k2)]) } - ee.EncodeString(c_UTF8, v[int(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeString(cUTF8, v2) } - ee.EncodeString(c_UTF8, v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntUintR(rv reflect.Value) { - fastpathTV.EncMapIntUintV(rv.Interface().(map[int]uint), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntUintR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntUintV(rv2i(rv).(map[int]uint), e) } -func (_ fastpathT) EncMapIntUintV(v map[int]uint, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntUintV(v map[int]uint, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -11635,44 +10333,47 @@ func (_ fastpathT) EncMapIntUintV(v map[int]uint, checkNil bool, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int(k2)])) } - ee.EncodeInt(int64(int(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int(k2))) + ee.EncodeUint(uint64(v[int(k2)])) } - ee.EncodeUint(uint64(v[int(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntUint8R(rv reflect.Value) { - fastpathTV.EncMapIntUint8V(rv.Interface().(map[int]uint8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntUint8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntUint8V(rv2i(rv).(map[int]uint8), e) } -func (_ fastpathT) EncMapIntUint8V(v map[int]uint8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntUint8V(v map[int]uint8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -11681,44 +10382,47 @@ func (_ fastpathT) EncMapIntUint8V(v map[int]uint8, checkNil bool, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int(k2)])) } - ee.EncodeInt(int64(int(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int(k2))) + ee.EncodeUint(uint64(v[int(k2)])) } - ee.EncodeUint(uint64(v[int(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntUint16R(rv reflect.Value) { - fastpathTV.EncMapIntUint16V(rv.Interface().(map[int]uint16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntUint16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntUint16V(rv2i(rv).(map[int]uint16), e) } -func (_ fastpathT) EncMapIntUint16V(v map[int]uint16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntUint16V(v map[int]uint16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -11727,44 +10431,47 @@ func (_ fastpathT) EncMapIntUint16V(v map[int]uint16, checkNil bool, e *Encoder) i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int(k2)])) } - ee.EncodeInt(int64(int(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int(k2))) + ee.EncodeUint(uint64(v[int(k2)])) } - ee.EncodeUint(uint64(v[int(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntUint32R(rv reflect.Value) { - fastpathTV.EncMapIntUint32V(rv.Interface().(map[int]uint32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntUint32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntUint32V(rv2i(rv).(map[int]uint32), e) } -func (_ fastpathT) EncMapIntUint32V(v map[int]uint32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntUint32V(v map[int]uint32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -11773,44 +10480,47 @@ func (_ fastpathT) EncMapIntUint32V(v map[int]uint32, checkNil bool, e *Encoder) i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int(k2)])) } - ee.EncodeInt(int64(int(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int(k2))) + ee.EncodeUint(uint64(v[int(k2)])) } - ee.EncodeUint(uint64(v[int(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntUint64R(rv reflect.Value) { - fastpathTV.EncMapIntUint64V(rv.Interface().(map[int]uint64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntUint64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntUint64V(rv2i(rv).(map[int]uint64), e) } -func (_ fastpathT) EncMapIntUint64V(v map[int]uint64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntUint64V(v map[int]uint64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -11819,44 +10529,47 @@ func (_ fastpathT) EncMapIntUint64V(v map[int]uint64, checkNil bool, e *Encoder) i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int(k2)])) } - ee.EncodeInt(int64(int(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int(k2))) + ee.EncodeUint(uint64(v[int(k2)])) } - ee.EncodeUint(uint64(v[int(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntUintptrR(rv reflect.Value) { - fastpathTV.EncMapIntUintptrV(rv.Interface().(map[int]uintptr), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntUintptrR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntUintptrV(rv2i(rv).(map[int]uintptr), e) } -func (_ fastpathT) EncMapIntUintptrV(v map[int]uintptr, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntUintptrV(v map[int]uintptr, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -11865,44 +10578,47 @@ func (_ fastpathT) EncMapIntUintptrV(v map[int]uintptr, checkNil bool, e *Encode i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int(k2))) + ee.WriteMapElemValue() + e.encode(v[int(k2)]) } - ee.EncodeInt(int64(int(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int(k2))) + e.encode(v[int(k2)]) } - e.encode(v[int(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntIntR(rv reflect.Value) { - fastpathTV.EncMapIntIntV(rv.Interface().(map[int]int), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntIntR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntIntV(rv2i(rv).(map[int]int), e) } -func (_ fastpathT) EncMapIntIntV(v map[int]int, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntIntV(v map[int]int, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -11911,44 +10627,47 @@ func (_ fastpathT) EncMapIntIntV(v map[int]int, checkNil bool, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int(k2)])) } - ee.EncodeInt(int64(int(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int(k2))) + ee.EncodeInt(int64(v[int(k2)])) } - ee.EncodeInt(int64(v[int(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntInt8R(rv reflect.Value) { - fastpathTV.EncMapIntInt8V(rv.Interface().(map[int]int8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntInt8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntInt8V(rv2i(rv).(map[int]int8), e) } -func (_ fastpathT) EncMapIntInt8V(v map[int]int8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntInt8V(v map[int]int8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -11957,44 +10676,47 @@ func (_ fastpathT) EncMapIntInt8V(v map[int]int8, checkNil bool, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int(k2)])) } - ee.EncodeInt(int64(int(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int(k2))) + ee.EncodeInt(int64(v[int(k2)])) } - ee.EncodeInt(int64(v[int(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntInt16R(rv reflect.Value) { - fastpathTV.EncMapIntInt16V(rv.Interface().(map[int]int16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntInt16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntInt16V(rv2i(rv).(map[int]int16), e) } -func (_ fastpathT) EncMapIntInt16V(v map[int]int16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntInt16V(v map[int]int16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -12003,44 +10725,47 @@ func (_ fastpathT) EncMapIntInt16V(v map[int]int16, checkNil bool, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int(k2)])) } - ee.EncodeInt(int64(int(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int(k2))) + ee.EncodeInt(int64(v[int(k2)])) } - ee.EncodeInt(int64(v[int(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntInt32R(rv reflect.Value) { - fastpathTV.EncMapIntInt32V(rv.Interface().(map[int]int32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntInt32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntInt32V(rv2i(rv).(map[int]int32), e) } -func (_ fastpathT) EncMapIntInt32V(v map[int]int32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntInt32V(v map[int]int32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -12049,44 +10774,47 @@ func (_ fastpathT) EncMapIntInt32V(v map[int]int32, checkNil bool, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int(k2)])) } - ee.EncodeInt(int64(int(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int(k2))) + ee.EncodeInt(int64(v[int(k2)])) } - ee.EncodeInt(int64(v[int(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntInt64R(rv reflect.Value) { - fastpathTV.EncMapIntInt64V(rv.Interface().(map[int]int64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntInt64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntInt64V(rv2i(rv).(map[int]int64), e) } -func (_ fastpathT) EncMapIntInt64V(v map[int]int64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntInt64V(v map[int]int64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -12095,44 +10823,47 @@ func (_ fastpathT) EncMapIntInt64V(v map[int]int64, checkNil bool, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int(k2)])) } - ee.EncodeInt(int64(int(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int(k2))) + ee.EncodeInt(int64(v[int(k2)])) } - ee.EncodeInt(int64(v[int(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntFloat32R(rv reflect.Value) { - fastpathTV.EncMapIntFloat32V(rv.Interface().(map[int]float32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntFloat32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntFloat32V(rv2i(rv).(map[int]float32), e) } -func (_ fastpathT) EncMapIntFloat32V(v map[int]float32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntFloat32V(v map[int]float32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -12141,44 +10872,47 @@ func (_ fastpathT) EncMapIntFloat32V(v map[int]float32, checkNil bool, e *Encode i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int(k2))) + ee.WriteMapElemValue() + ee.EncodeFloat32(v[int(k2)]) } - ee.EncodeInt(int64(int(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int(k2))) + ee.EncodeFloat32(v[int(k2)]) } - ee.EncodeFloat32(v[int(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat32(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeFloat32(v2) } - ee.EncodeFloat32(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntFloat64R(rv reflect.Value) { - fastpathTV.EncMapIntFloat64V(rv.Interface().(map[int]float64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntFloat64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntFloat64V(rv2i(rv).(map[int]float64), e) } -func (_ fastpathT) EncMapIntFloat64V(v map[int]float64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntFloat64V(v map[int]float64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -12187,44 +10921,47 @@ func (_ fastpathT) EncMapIntFloat64V(v map[int]float64, checkNil bool, e *Encode i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int(k2))) + ee.WriteMapElemValue() + ee.EncodeFloat64(v[int(k2)]) } - ee.EncodeInt(int64(int(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int(k2))) + ee.EncodeFloat64(v[int(k2)]) } - ee.EncodeFloat64(v[int(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat64(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeFloat64(v2) } - ee.EncodeFloat64(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapIntBoolR(rv reflect.Value) { - fastpathTV.EncMapIntBoolV(rv.Interface().(map[int]bool), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapIntBoolR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapIntBoolV(rv2i(rv).(map[int]bool), e) } -func (_ fastpathT) EncMapIntBoolV(v map[int]bool, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapIntBoolV(v map[int]bool, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -12233,44 +10970,47 @@ func (_ fastpathT) EncMapIntBoolV(v map[int]bool, checkNil bool, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int(k2))) + ee.WriteMapElemValue() + ee.EncodeBool(v[int(k2)]) } - ee.EncodeInt(int64(int(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int(k2))) + ee.EncodeBool(v[int(k2)]) } - ee.EncodeBool(v[int(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeBool(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeBool(v2) } - ee.EncodeBool(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt8IntfR(rv reflect.Value) { - fastpathTV.EncMapInt8IntfV(rv.Interface().(map[int8]interface{}), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt8IntfR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt8IntfV(rv2i(rv).(map[int8]interface{}), e) } -func (_ fastpathT) EncMapInt8IntfV(v map[int8]interface{}, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt8IntfV(v map[int8]interface{}, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -12279,44 +11019,47 @@ func (_ fastpathT) EncMapInt8IntfV(v map[int8]interface{}, checkNil bool, e *Enc i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int8(k2))) + ee.WriteMapElemValue() + e.encode(v[int8(k2)]) } - ee.EncodeInt(int64(int8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int8(k2))) + e.encode(v[int8(k2)]) } - e.encode(v[int8(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt8StringR(rv reflect.Value) { - fastpathTV.EncMapInt8StringV(rv.Interface().(map[int8]string), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt8StringR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt8StringV(rv2i(rv).(map[int8]string), e) } -func (_ fastpathT) EncMapInt8StringV(v map[int8]string, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt8StringV(v map[int8]string, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -12325,44 +11068,47 @@ func (_ fastpathT) EncMapInt8StringV(v map[int8]string, checkNil bool, e *Encode i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int8(k2))) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v[int8(k2)]) } - ee.EncodeInt(int64(int8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int8(k2))) + ee.EncodeString(cUTF8, v[int8(k2)]) } - ee.EncodeString(c_UTF8, v[int8(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeString(cUTF8, v2) } - ee.EncodeString(c_UTF8, v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt8UintR(rv reflect.Value) { - fastpathTV.EncMapInt8UintV(rv.Interface().(map[int8]uint), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt8UintR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt8UintV(rv2i(rv).(map[int8]uint), e) } -func (_ fastpathT) EncMapInt8UintV(v map[int8]uint, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt8UintV(v map[int8]uint, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -12371,44 +11117,47 @@ func (_ fastpathT) EncMapInt8UintV(v map[int8]uint, checkNil bool, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int8(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int8(k2)])) } - ee.EncodeInt(int64(int8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int8(k2))) + ee.EncodeUint(uint64(v[int8(k2)])) } - ee.EncodeUint(uint64(v[int8(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt8Uint8R(rv reflect.Value) { - fastpathTV.EncMapInt8Uint8V(rv.Interface().(map[int8]uint8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt8Uint8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt8Uint8V(rv2i(rv).(map[int8]uint8), e) } -func (_ fastpathT) EncMapInt8Uint8V(v map[int8]uint8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt8Uint8V(v map[int8]uint8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -12417,44 +11166,47 @@ func (_ fastpathT) EncMapInt8Uint8V(v map[int8]uint8, checkNil bool, e *Encoder) i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int8(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int8(k2)])) } - ee.EncodeInt(int64(int8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int8(k2))) + ee.EncodeUint(uint64(v[int8(k2)])) } - ee.EncodeUint(uint64(v[int8(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt8Uint16R(rv reflect.Value) { - fastpathTV.EncMapInt8Uint16V(rv.Interface().(map[int8]uint16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt8Uint16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt8Uint16V(rv2i(rv).(map[int8]uint16), e) } -func (_ fastpathT) EncMapInt8Uint16V(v map[int8]uint16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt8Uint16V(v map[int8]uint16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -12463,44 +11215,47 @@ func (_ fastpathT) EncMapInt8Uint16V(v map[int8]uint16, checkNil bool, e *Encode i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int8(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int8(k2)])) } - ee.EncodeInt(int64(int8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int8(k2))) + ee.EncodeUint(uint64(v[int8(k2)])) } - ee.EncodeUint(uint64(v[int8(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt8Uint32R(rv reflect.Value) { - fastpathTV.EncMapInt8Uint32V(rv.Interface().(map[int8]uint32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt8Uint32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt8Uint32V(rv2i(rv).(map[int8]uint32), e) } -func (_ fastpathT) EncMapInt8Uint32V(v map[int8]uint32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt8Uint32V(v map[int8]uint32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -12509,44 +11264,47 @@ func (_ fastpathT) EncMapInt8Uint32V(v map[int8]uint32, checkNil bool, e *Encode i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int8(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int8(k2)])) } - ee.EncodeInt(int64(int8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int8(k2))) + ee.EncodeUint(uint64(v[int8(k2)])) } - ee.EncodeUint(uint64(v[int8(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt8Uint64R(rv reflect.Value) { - fastpathTV.EncMapInt8Uint64V(rv.Interface().(map[int8]uint64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt8Uint64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt8Uint64V(rv2i(rv).(map[int8]uint64), e) } -func (_ fastpathT) EncMapInt8Uint64V(v map[int8]uint64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt8Uint64V(v map[int8]uint64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -12555,44 +11313,47 @@ func (_ fastpathT) EncMapInt8Uint64V(v map[int8]uint64, checkNil bool, e *Encode i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int8(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int8(k2)])) } - ee.EncodeInt(int64(int8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int8(k2))) + ee.EncodeUint(uint64(v[int8(k2)])) } - ee.EncodeUint(uint64(v[int8(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt8UintptrR(rv reflect.Value) { - fastpathTV.EncMapInt8UintptrV(rv.Interface().(map[int8]uintptr), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt8UintptrR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt8UintptrV(rv2i(rv).(map[int8]uintptr), e) } -func (_ fastpathT) EncMapInt8UintptrV(v map[int8]uintptr, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt8UintptrV(v map[int8]uintptr, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -12601,44 +11362,47 @@ func (_ fastpathT) EncMapInt8UintptrV(v map[int8]uintptr, checkNil bool, e *Enco i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int8(k2))) + ee.WriteMapElemValue() + e.encode(v[int8(k2)]) } - ee.EncodeInt(int64(int8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int8(k2))) + e.encode(v[int8(k2)]) } - e.encode(v[int8(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt8IntR(rv reflect.Value) { - fastpathTV.EncMapInt8IntV(rv.Interface().(map[int8]int), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt8IntR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt8IntV(rv2i(rv).(map[int8]int), e) } -func (_ fastpathT) EncMapInt8IntV(v map[int8]int, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt8IntV(v map[int8]int, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -12647,44 +11411,47 @@ func (_ fastpathT) EncMapInt8IntV(v map[int8]int, checkNil bool, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int8(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int8(k2)])) } - ee.EncodeInt(int64(int8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int8(k2))) + ee.EncodeInt(int64(v[int8(k2)])) } - ee.EncodeInt(int64(v[int8(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt8Int8R(rv reflect.Value) { - fastpathTV.EncMapInt8Int8V(rv.Interface().(map[int8]int8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt8Int8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt8Int8V(rv2i(rv).(map[int8]int8), e) } -func (_ fastpathT) EncMapInt8Int8V(v map[int8]int8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt8Int8V(v map[int8]int8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -12693,44 +11460,47 @@ func (_ fastpathT) EncMapInt8Int8V(v map[int8]int8, checkNil bool, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int8(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int8(k2)])) } - ee.EncodeInt(int64(int8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int8(k2))) + ee.EncodeInt(int64(v[int8(k2)])) } - ee.EncodeInt(int64(v[int8(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt8Int16R(rv reflect.Value) { - fastpathTV.EncMapInt8Int16V(rv.Interface().(map[int8]int16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt8Int16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt8Int16V(rv2i(rv).(map[int8]int16), e) } -func (_ fastpathT) EncMapInt8Int16V(v map[int8]int16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt8Int16V(v map[int8]int16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -12739,44 +11509,47 @@ func (_ fastpathT) EncMapInt8Int16V(v map[int8]int16, checkNil bool, e *Encoder) i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int8(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int8(k2)])) } - ee.EncodeInt(int64(int8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int8(k2))) + ee.EncodeInt(int64(v[int8(k2)])) } - ee.EncodeInt(int64(v[int8(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt8Int32R(rv reflect.Value) { - fastpathTV.EncMapInt8Int32V(rv.Interface().(map[int8]int32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt8Int32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt8Int32V(rv2i(rv).(map[int8]int32), e) } -func (_ fastpathT) EncMapInt8Int32V(v map[int8]int32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt8Int32V(v map[int8]int32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -12785,44 +11558,47 @@ func (_ fastpathT) EncMapInt8Int32V(v map[int8]int32, checkNil bool, e *Encoder) i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int8(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int8(k2)])) } - ee.EncodeInt(int64(int8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int8(k2))) + ee.EncodeInt(int64(v[int8(k2)])) } - ee.EncodeInt(int64(v[int8(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt8Int64R(rv reflect.Value) { - fastpathTV.EncMapInt8Int64V(rv.Interface().(map[int8]int64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt8Int64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt8Int64V(rv2i(rv).(map[int8]int64), e) } -func (_ fastpathT) EncMapInt8Int64V(v map[int8]int64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt8Int64V(v map[int8]int64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -12831,44 +11607,47 @@ func (_ fastpathT) EncMapInt8Int64V(v map[int8]int64, checkNil bool, e *Encoder) i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int8(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int8(k2)])) } - ee.EncodeInt(int64(int8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int8(k2))) + ee.EncodeInt(int64(v[int8(k2)])) } - ee.EncodeInt(int64(v[int8(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt8Float32R(rv reflect.Value) { - fastpathTV.EncMapInt8Float32V(rv.Interface().(map[int8]float32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt8Float32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt8Float32V(rv2i(rv).(map[int8]float32), e) } -func (_ fastpathT) EncMapInt8Float32V(v map[int8]float32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt8Float32V(v map[int8]float32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -12877,44 +11656,47 @@ func (_ fastpathT) EncMapInt8Float32V(v map[int8]float32, checkNil bool, e *Enco i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int8(k2))) + ee.WriteMapElemValue() + ee.EncodeFloat32(v[int8(k2)]) } - ee.EncodeInt(int64(int8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int8(k2))) + ee.EncodeFloat32(v[int8(k2)]) } - ee.EncodeFloat32(v[int8(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat32(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeFloat32(v2) } - ee.EncodeFloat32(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt8Float64R(rv reflect.Value) { - fastpathTV.EncMapInt8Float64V(rv.Interface().(map[int8]float64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt8Float64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt8Float64V(rv2i(rv).(map[int8]float64), e) } -func (_ fastpathT) EncMapInt8Float64V(v map[int8]float64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt8Float64V(v map[int8]float64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -12923,44 +11705,47 @@ func (_ fastpathT) EncMapInt8Float64V(v map[int8]float64, checkNil bool, e *Enco i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int8(k2))) + ee.WriteMapElemValue() + ee.EncodeFloat64(v[int8(k2)]) } - ee.EncodeInt(int64(int8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int8(k2))) + ee.EncodeFloat64(v[int8(k2)]) } - ee.EncodeFloat64(v[int8(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat64(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeFloat64(v2) } - ee.EncodeFloat64(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt8BoolR(rv reflect.Value) { - fastpathTV.EncMapInt8BoolV(rv.Interface().(map[int8]bool), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt8BoolR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt8BoolV(rv2i(rv).(map[int8]bool), e) } -func (_ fastpathT) EncMapInt8BoolV(v map[int8]bool, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt8BoolV(v map[int8]bool, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -12969,44 +11754,47 @@ func (_ fastpathT) EncMapInt8BoolV(v map[int8]bool, checkNil bool, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int8(k2))) + ee.WriteMapElemValue() + ee.EncodeBool(v[int8(k2)]) } - ee.EncodeInt(int64(int8(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int8(k2))) + ee.EncodeBool(v[int8(k2)]) } - ee.EncodeBool(v[int8(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeBool(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeBool(v2) } - ee.EncodeBool(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt16IntfR(rv reflect.Value) { - fastpathTV.EncMapInt16IntfV(rv.Interface().(map[int16]interface{}), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt16IntfR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt16IntfV(rv2i(rv).(map[int16]interface{}), e) } -func (_ fastpathT) EncMapInt16IntfV(v map[int16]interface{}, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt16IntfV(v map[int16]interface{}, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -13015,44 +11803,47 @@ func (_ fastpathT) EncMapInt16IntfV(v map[int16]interface{}, checkNil bool, e *E i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int16(k2))) + ee.WriteMapElemValue() + e.encode(v[int16(k2)]) } - ee.EncodeInt(int64(int16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int16(k2))) + e.encode(v[int16(k2)]) } - e.encode(v[int16(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt16StringR(rv reflect.Value) { - fastpathTV.EncMapInt16StringV(rv.Interface().(map[int16]string), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt16StringR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt16StringV(rv2i(rv).(map[int16]string), e) } -func (_ fastpathT) EncMapInt16StringV(v map[int16]string, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt16StringV(v map[int16]string, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -13061,44 +11852,47 @@ func (_ fastpathT) EncMapInt16StringV(v map[int16]string, checkNil bool, e *Enco i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int16(k2))) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v[int16(k2)]) } - ee.EncodeInt(int64(int16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int16(k2))) + ee.EncodeString(cUTF8, v[int16(k2)]) } - ee.EncodeString(c_UTF8, v[int16(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeString(cUTF8, v2) } - ee.EncodeString(c_UTF8, v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt16UintR(rv reflect.Value) { - fastpathTV.EncMapInt16UintV(rv.Interface().(map[int16]uint), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt16UintR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt16UintV(rv2i(rv).(map[int16]uint), e) } -func (_ fastpathT) EncMapInt16UintV(v map[int16]uint, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt16UintV(v map[int16]uint, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -13107,44 +11901,47 @@ func (_ fastpathT) EncMapInt16UintV(v map[int16]uint, checkNil bool, e *Encoder) i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int16(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int16(k2)])) } - ee.EncodeInt(int64(int16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int16(k2))) + ee.EncodeUint(uint64(v[int16(k2)])) } - ee.EncodeUint(uint64(v[int16(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt16Uint8R(rv reflect.Value) { - fastpathTV.EncMapInt16Uint8V(rv.Interface().(map[int16]uint8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt16Uint8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt16Uint8V(rv2i(rv).(map[int16]uint8), e) } -func (_ fastpathT) EncMapInt16Uint8V(v map[int16]uint8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt16Uint8V(v map[int16]uint8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -13153,44 +11950,47 @@ func (_ fastpathT) EncMapInt16Uint8V(v map[int16]uint8, checkNil bool, e *Encode i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int16(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int16(k2)])) } - ee.EncodeInt(int64(int16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int16(k2))) + ee.EncodeUint(uint64(v[int16(k2)])) } - ee.EncodeUint(uint64(v[int16(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt16Uint16R(rv reflect.Value) { - fastpathTV.EncMapInt16Uint16V(rv.Interface().(map[int16]uint16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt16Uint16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt16Uint16V(rv2i(rv).(map[int16]uint16), e) } -func (_ fastpathT) EncMapInt16Uint16V(v map[int16]uint16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt16Uint16V(v map[int16]uint16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -13199,44 +11999,47 @@ func (_ fastpathT) EncMapInt16Uint16V(v map[int16]uint16, checkNil bool, e *Enco i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int16(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int16(k2)])) } - ee.EncodeInt(int64(int16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int16(k2))) + ee.EncodeUint(uint64(v[int16(k2)])) } - ee.EncodeUint(uint64(v[int16(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt16Uint32R(rv reflect.Value) { - fastpathTV.EncMapInt16Uint32V(rv.Interface().(map[int16]uint32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt16Uint32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt16Uint32V(rv2i(rv).(map[int16]uint32), e) } -func (_ fastpathT) EncMapInt16Uint32V(v map[int16]uint32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt16Uint32V(v map[int16]uint32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -13245,44 +12048,47 @@ func (_ fastpathT) EncMapInt16Uint32V(v map[int16]uint32, checkNil bool, e *Enco i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int16(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int16(k2)])) } - ee.EncodeInt(int64(int16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int16(k2))) + ee.EncodeUint(uint64(v[int16(k2)])) } - ee.EncodeUint(uint64(v[int16(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt16Uint64R(rv reflect.Value) { - fastpathTV.EncMapInt16Uint64V(rv.Interface().(map[int16]uint64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt16Uint64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt16Uint64V(rv2i(rv).(map[int16]uint64), e) } -func (_ fastpathT) EncMapInt16Uint64V(v map[int16]uint64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt16Uint64V(v map[int16]uint64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -13291,44 +12097,47 @@ func (_ fastpathT) EncMapInt16Uint64V(v map[int16]uint64, checkNil bool, e *Enco i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int16(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int16(k2)])) } - ee.EncodeInt(int64(int16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int16(k2))) + ee.EncodeUint(uint64(v[int16(k2)])) } - ee.EncodeUint(uint64(v[int16(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt16UintptrR(rv reflect.Value) { - fastpathTV.EncMapInt16UintptrV(rv.Interface().(map[int16]uintptr), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt16UintptrR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt16UintptrV(rv2i(rv).(map[int16]uintptr), e) } -func (_ fastpathT) EncMapInt16UintptrV(v map[int16]uintptr, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt16UintptrV(v map[int16]uintptr, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -13337,44 +12146,47 @@ func (_ fastpathT) EncMapInt16UintptrV(v map[int16]uintptr, checkNil bool, e *En i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int16(k2))) + ee.WriteMapElemValue() + e.encode(v[int16(k2)]) } - ee.EncodeInt(int64(int16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int16(k2))) + e.encode(v[int16(k2)]) } - e.encode(v[int16(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt16IntR(rv reflect.Value) { - fastpathTV.EncMapInt16IntV(rv.Interface().(map[int16]int), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt16IntR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt16IntV(rv2i(rv).(map[int16]int), e) } -func (_ fastpathT) EncMapInt16IntV(v map[int16]int, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt16IntV(v map[int16]int, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -13383,44 +12195,47 @@ func (_ fastpathT) EncMapInt16IntV(v map[int16]int, checkNil bool, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int16(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int16(k2)])) } - ee.EncodeInt(int64(int16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int16(k2))) + ee.EncodeInt(int64(v[int16(k2)])) } - ee.EncodeInt(int64(v[int16(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt16Int8R(rv reflect.Value) { - fastpathTV.EncMapInt16Int8V(rv.Interface().(map[int16]int8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt16Int8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt16Int8V(rv2i(rv).(map[int16]int8), e) } -func (_ fastpathT) EncMapInt16Int8V(v map[int16]int8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt16Int8V(v map[int16]int8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -13429,44 +12244,47 @@ func (_ fastpathT) EncMapInt16Int8V(v map[int16]int8, checkNil bool, e *Encoder) i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int16(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int16(k2)])) } - ee.EncodeInt(int64(int16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int16(k2))) + ee.EncodeInt(int64(v[int16(k2)])) } - ee.EncodeInt(int64(v[int16(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt16Int16R(rv reflect.Value) { - fastpathTV.EncMapInt16Int16V(rv.Interface().(map[int16]int16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt16Int16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt16Int16V(rv2i(rv).(map[int16]int16), e) } -func (_ fastpathT) EncMapInt16Int16V(v map[int16]int16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt16Int16V(v map[int16]int16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -13475,44 +12293,47 @@ func (_ fastpathT) EncMapInt16Int16V(v map[int16]int16, checkNil bool, e *Encode i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int16(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int16(k2)])) } - ee.EncodeInt(int64(int16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int16(k2))) + ee.EncodeInt(int64(v[int16(k2)])) } - ee.EncodeInt(int64(v[int16(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt16Int32R(rv reflect.Value) { - fastpathTV.EncMapInt16Int32V(rv.Interface().(map[int16]int32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt16Int32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt16Int32V(rv2i(rv).(map[int16]int32), e) } -func (_ fastpathT) EncMapInt16Int32V(v map[int16]int32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt16Int32V(v map[int16]int32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -13521,44 +12342,47 @@ func (_ fastpathT) EncMapInt16Int32V(v map[int16]int32, checkNil bool, e *Encode i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int16(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int16(k2)])) } - ee.EncodeInt(int64(int16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int16(k2))) + ee.EncodeInt(int64(v[int16(k2)])) } - ee.EncodeInt(int64(v[int16(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt16Int64R(rv reflect.Value) { - fastpathTV.EncMapInt16Int64V(rv.Interface().(map[int16]int64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt16Int64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt16Int64V(rv2i(rv).(map[int16]int64), e) } -func (_ fastpathT) EncMapInt16Int64V(v map[int16]int64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt16Int64V(v map[int16]int64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -13567,44 +12391,47 @@ func (_ fastpathT) EncMapInt16Int64V(v map[int16]int64, checkNil bool, e *Encode i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int16(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int16(k2)])) } - ee.EncodeInt(int64(int16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int16(k2))) + ee.EncodeInt(int64(v[int16(k2)])) } - ee.EncodeInt(int64(v[int16(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt16Float32R(rv reflect.Value) { - fastpathTV.EncMapInt16Float32V(rv.Interface().(map[int16]float32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt16Float32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt16Float32V(rv2i(rv).(map[int16]float32), e) } -func (_ fastpathT) EncMapInt16Float32V(v map[int16]float32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt16Float32V(v map[int16]float32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -13613,44 +12440,47 @@ func (_ fastpathT) EncMapInt16Float32V(v map[int16]float32, checkNil bool, e *En i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int16(k2))) + ee.WriteMapElemValue() + ee.EncodeFloat32(v[int16(k2)]) } - ee.EncodeInt(int64(int16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int16(k2))) + ee.EncodeFloat32(v[int16(k2)]) } - ee.EncodeFloat32(v[int16(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat32(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeFloat32(v2) } - ee.EncodeFloat32(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt16Float64R(rv reflect.Value) { - fastpathTV.EncMapInt16Float64V(rv.Interface().(map[int16]float64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt16Float64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt16Float64V(rv2i(rv).(map[int16]float64), e) } -func (_ fastpathT) EncMapInt16Float64V(v map[int16]float64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt16Float64V(v map[int16]float64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -13659,44 +12489,47 @@ func (_ fastpathT) EncMapInt16Float64V(v map[int16]float64, checkNil bool, e *En i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int16(k2))) + ee.WriteMapElemValue() + ee.EncodeFloat64(v[int16(k2)]) } - ee.EncodeInt(int64(int16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int16(k2))) + ee.EncodeFloat64(v[int16(k2)]) } - ee.EncodeFloat64(v[int16(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat64(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeFloat64(v2) } - ee.EncodeFloat64(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt16BoolR(rv reflect.Value) { - fastpathTV.EncMapInt16BoolV(rv.Interface().(map[int16]bool), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt16BoolR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt16BoolV(rv2i(rv).(map[int16]bool), e) } -func (_ fastpathT) EncMapInt16BoolV(v map[int16]bool, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt16BoolV(v map[int16]bool, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -13705,44 +12538,47 @@ func (_ fastpathT) EncMapInt16BoolV(v map[int16]bool, checkNil bool, e *Encoder) i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int16(k2))) + ee.WriteMapElemValue() + ee.EncodeBool(v[int16(k2)]) } - ee.EncodeInt(int64(int16(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int16(k2))) + ee.EncodeBool(v[int16(k2)]) } - ee.EncodeBool(v[int16(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeBool(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeBool(v2) } - ee.EncodeBool(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt32IntfR(rv reflect.Value) { - fastpathTV.EncMapInt32IntfV(rv.Interface().(map[int32]interface{}), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt32IntfR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt32IntfV(rv2i(rv).(map[int32]interface{}), e) } -func (_ fastpathT) EncMapInt32IntfV(v map[int32]interface{}, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt32IntfV(v map[int32]interface{}, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -13751,44 +12587,47 @@ func (_ fastpathT) EncMapInt32IntfV(v map[int32]interface{}, checkNil bool, e *E i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int32(k2))) + ee.WriteMapElemValue() + e.encode(v[int32(k2)]) } - ee.EncodeInt(int64(int32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int32(k2))) + e.encode(v[int32(k2)]) } - e.encode(v[int32(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt32StringR(rv reflect.Value) { - fastpathTV.EncMapInt32StringV(rv.Interface().(map[int32]string), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt32StringR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt32StringV(rv2i(rv).(map[int32]string), e) } -func (_ fastpathT) EncMapInt32StringV(v map[int32]string, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt32StringV(v map[int32]string, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -13797,44 +12636,47 @@ func (_ fastpathT) EncMapInt32StringV(v map[int32]string, checkNil bool, e *Enco i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int32(k2))) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v[int32(k2)]) } - ee.EncodeInt(int64(int32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int32(k2))) + ee.EncodeString(cUTF8, v[int32(k2)]) } - ee.EncodeString(c_UTF8, v[int32(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeString(cUTF8, v2) } - ee.EncodeString(c_UTF8, v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt32UintR(rv reflect.Value) { - fastpathTV.EncMapInt32UintV(rv.Interface().(map[int32]uint), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt32UintR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt32UintV(rv2i(rv).(map[int32]uint), e) } -func (_ fastpathT) EncMapInt32UintV(v map[int32]uint, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt32UintV(v map[int32]uint, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -13843,44 +12685,47 @@ func (_ fastpathT) EncMapInt32UintV(v map[int32]uint, checkNil bool, e *Encoder) i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int32(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int32(k2)])) } - ee.EncodeInt(int64(int32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int32(k2))) + ee.EncodeUint(uint64(v[int32(k2)])) } - ee.EncodeUint(uint64(v[int32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt32Uint8R(rv reflect.Value) { - fastpathTV.EncMapInt32Uint8V(rv.Interface().(map[int32]uint8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt32Uint8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt32Uint8V(rv2i(rv).(map[int32]uint8), e) } -func (_ fastpathT) EncMapInt32Uint8V(v map[int32]uint8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt32Uint8V(v map[int32]uint8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -13889,44 +12734,47 @@ func (_ fastpathT) EncMapInt32Uint8V(v map[int32]uint8, checkNil bool, e *Encode i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int32(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int32(k2)])) } - ee.EncodeInt(int64(int32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int32(k2))) + ee.EncodeUint(uint64(v[int32(k2)])) } - ee.EncodeUint(uint64(v[int32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt32Uint16R(rv reflect.Value) { - fastpathTV.EncMapInt32Uint16V(rv.Interface().(map[int32]uint16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt32Uint16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt32Uint16V(rv2i(rv).(map[int32]uint16), e) } -func (_ fastpathT) EncMapInt32Uint16V(v map[int32]uint16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt32Uint16V(v map[int32]uint16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -13935,44 +12783,47 @@ func (_ fastpathT) EncMapInt32Uint16V(v map[int32]uint16, checkNil bool, e *Enco i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int32(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int32(k2)])) } - ee.EncodeInt(int64(int32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int32(k2))) + ee.EncodeUint(uint64(v[int32(k2)])) } - ee.EncodeUint(uint64(v[int32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt32Uint32R(rv reflect.Value) { - fastpathTV.EncMapInt32Uint32V(rv.Interface().(map[int32]uint32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt32Uint32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt32Uint32V(rv2i(rv).(map[int32]uint32), e) } -func (_ fastpathT) EncMapInt32Uint32V(v map[int32]uint32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt32Uint32V(v map[int32]uint32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -13981,44 +12832,47 @@ func (_ fastpathT) EncMapInt32Uint32V(v map[int32]uint32, checkNil bool, e *Enco i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int32(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int32(k2)])) } - ee.EncodeInt(int64(int32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int32(k2))) + ee.EncodeUint(uint64(v[int32(k2)])) } - ee.EncodeUint(uint64(v[int32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt32Uint64R(rv reflect.Value) { - fastpathTV.EncMapInt32Uint64V(rv.Interface().(map[int32]uint64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt32Uint64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt32Uint64V(rv2i(rv).(map[int32]uint64), e) } -func (_ fastpathT) EncMapInt32Uint64V(v map[int32]uint64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt32Uint64V(v map[int32]uint64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -14027,44 +12881,47 @@ func (_ fastpathT) EncMapInt32Uint64V(v map[int32]uint64, checkNil bool, e *Enco i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int32(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int32(k2)])) } - ee.EncodeInt(int64(int32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int32(k2))) + ee.EncodeUint(uint64(v[int32(k2)])) } - ee.EncodeUint(uint64(v[int32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt32UintptrR(rv reflect.Value) { - fastpathTV.EncMapInt32UintptrV(rv.Interface().(map[int32]uintptr), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt32UintptrR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt32UintptrV(rv2i(rv).(map[int32]uintptr), e) } -func (_ fastpathT) EncMapInt32UintptrV(v map[int32]uintptr, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt32UintptrV(v map[int32]uintptr, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -14073,44 +12930,47 @@ func (_ fastpathT) EncMapInt32UintptrV(v map[int32]uintptr, checkNil bool, e *En i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int32(k2))) + ee.WriteMapElemValue() + e.encode(v[int32(k2)]) } - ee.EncodeInt(int64(int32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int32(k2))) + e.encode(v[int32(k2)]) } - e.encode(v[int32(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt32IntR(rv reflect.Value) { - fastpathTV.EncMapInt32IntV(rv.Interface().(map[int32]int), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt32IntR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt32IntV(rv2i(rv).(map[int32]int), e) } -func (_ fastpathT) EncMapInt32IntV(v map[int32]int, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt32IntV(v map[int32]int, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -14119,44 +12979,47 @@ func (_ fastpathT) EncMapInt32IntV(v map[int32]int, checkNil bool, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int32(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int32(k2)])) } - ee.EncodeInt(int64(int32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int32(k2))) + ee.EncodeInt(int64(v[int32(k2)])) } - ee.EncodeInt(int64(v[int32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt32Int8R(rv reflect.Value) { - fastpathTV.EncMapInt32Int8V(rv.Interface().(map[int32]int8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt32Int8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt32Int8V(rv2i(rv).(map[int32]int8), e) } -func (_ fastpathT) EncMapInt32Int8V(v map[int32]int8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt32Int8V(v map[int32]int8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -14165,44 +13028,47 @@ func (_ fastpathT) EncMapInt32Int8V(v map[int32]int8, checkNil bool, e *Encoder) i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int32(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int32(k2)])) } - ee.EncodeInt(int64(int32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int32(k2))) + ee.EncodeInt(int64(v[int32(k2)])) } - ee.EncodeInt(int64(v[int32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt32Int16R(rv reflect.Value) { - fastpathTV.EncMapInt32Int16V(rv.Interface().(map[int32]int16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt32Int16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt32Int16V(rv2i(rv).(map[int32]int16), e) } -func (_ fastpathT) EncMapInt32Int16V(v map[int32]int16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt32Int16V(v map[int32]int16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -14211,44 +13077,47 @@ func (_ fastpathT) EncMapInt32Int16V(v map[int32]int16, checkNil bool, e *Encode i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int32(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int32(k2)])) } - ee.EncodeInt(int64(int32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int32(k2))) + ee.EncodeInt(int64(v[int32(k2)])) } - ee.EncodeInt(int64(v[int32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt32Int32R(rv reflect.Value) { - fastpathTV.EncMapInt32Int32V(rv.Interface().(map[int32]int32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt32Int32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt32Int32V(rv2i(rv).(map[int32]int32), e) } -func (_ fastpathT) EncMapInt32Int32V(v map[int32]int32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt32Int32V(v map[int32]int32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -14257,44 +13126,47 @@ func (_ fastpathT) EncMapInt32Int32V(v map[int32]int32, checkNil bool, e *Encode i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int32(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int32(k2)])) } - ee.EncodeInt(int64(int32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int32(k2))) + ee.EncodeInt(int64(v[int32(k2)])) } - ee.EncodeInt(int64(v[int32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt32Int64R(rv reflect.Value) { - fastpathTV.EncMapInt32Int64V(rv.Interface().(map[int32]int64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt32Int64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt32Int64V(rv2i(rv).(map[int32]int64), e) } -func (_ fastpathT) EncMapInt32Int64V(v map[int32]int64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt32Int64V(v map[int32]int64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -14303,44 +13175,47 @@ func (_ fastpathT) EncMapInt32Int64V(v map[int32]int64, checkNil bool, e *Encode i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int32(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int32(k2)])) } - ee.EncodeInt(int64(int32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int32(k2))) + ee.EncodeInt(int64(v[int32(k2)])) } - ee.EncodeInt(int64(v[int32(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt32Float32R(rv reflect.Value) { - fastpathTV.EncMapInt32Float32V(rv.Interface().(map[int32]float32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt32Float32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt32Float32V(rv2i(rv).(map[int32]float32), e) } -func (_ fastpathT) EncMapInt32Float32V(v map[int32]float32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt32Float32V(v map[int32]float32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -14349,44 +13224,47 @@ func (_ fastpathT) EncMapInt32Float32V(v map[int32]float32, checkNil bool, e *En i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int32(k2))) + ee.WriteMapElemValue() + ee.EncodeFloat32(v[int32(k2)]) } - ee.EncodeInt(int64(int32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int32(k2))) + ee.EncodeFloat32(v[int32(k2)]) } - ee.EncodeFloat32(v[int32(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat32(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeFloat32(v2) } - ee.EncodeFloat32(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt32Float64R(rv reflect.Value) { - fastpathTV.EncMapInt32Float64V(rv.Interface().(map[int32]float64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt32Float64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt32Float64V(rv2i(rv).(map[int32]float64), e) } -func (_ fastpathT) EncMapInt32Float64V(v map[int32]float64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt32Float64V(v map[int32]float64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -14395,44 +13273,47 @@ func (_ fastpathT) EncMapInt32Float64V(v map[int32]float64, checkNil bool, e *En i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int32(k2))) + ee.WriteMapElemValue() + ee.EncodeFloat64(v[int32(k2)]) } - ee.EncodeInt(int64(int32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int32(k2))) + ee.EncodeFloat64(v[int32(k2)]) } - ee.EncodeFloat64(v[int32(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat64(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeFloat64(v2) } - ee.EncodeFloat64(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt32BoolR(rv reflect.Value) { - fastpathTV.EncMapInt32BoolV(rv.Interface().(map[int32]bool), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt32BoolR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt32BoolV(rv2i(rv).(map[int32]bool), e) } -func (_ fastpathT) EncMapInt32BoolV(v map[int32]bool, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt32BoolV(v map[int32]bool, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -14441,44 +13322,47 @@ func (_ fastpathT) EncMapInt32BoolV(v map[int32]bool, checkNil bool, e *Encoder) i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int32(k2))) + ee.WriteMapElemValue() + ee.EncodeBool(v[int32(k2)]) } - ee.EncodeInt(int64(int32(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int32(k2))) + ee.EncodeBool(v[int32(k2)]) } - ee.EncodeBool(v[int32(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeBool(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeBool(v2) } - ee.EncodeBool(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt64IntfR(rv reflect.Value) { - fastpathTV.EncMapInt64IntfV(rv.Interface().(map[int64]interface{}), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt64IntfR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt64IntfV(rv2i(rv).(map[int64]interface{}), e) } -func (_ fastpathT) EncMapInt64IntfV(v map[int64]interface{}, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt64IntfV(v map[int64]interface{}, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -14487,44 +13371,47 @@ func (_ fastpathT) EncMapInt64IntfV(v map[int64]interface{}, checkNil bool, e *E i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int64(k2))) + ee.WriteMapElemValue() + e.encode(v[int64(k2)]) } - ee.EncodeInt(int64(int64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int64(k2))) + e.encode(v[int64(k2)]) } - e.encode(v[int64(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt64StringR(rv reflect.Value) { - fastpathTV.EncMapInt64StringV(rv.Interface().(map[int64]string), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt64StringR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt64StringV(rv2i(rv).(map[int64]string), e) } -func (_ fastpathT) EncMapInt64StringV(v map[int64]string, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt64StringV(v map[int64]string, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -14533,44 +13420,47 @@ func (_ fastpathT) EncMapInt64StringV(v map[int64]string, checkNil bool, e *Enco i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int64(k2))) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v[int64(k2)]) } - ee.EncodeInt(int64(int64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int64(k2))) + ee.EncodeString(cUTF8, v[int64(k2)]) } - ee.EncodeString(c_UTF8, v[int64(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeString(cUTF8, v2) } - ee.EncodeString(c_UTF8, v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt64UintR(rv reflect.Value) { - fastpathTV.EncMapInt64UintV(rv.Interface().(map[int64]uint), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt64UintR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt64UintV(rv2i(rv).(map[int64]uint), e) } -func (_ fastpathT) EncMapInt64UintV(v map[int64]uint, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt64UintV(v map[int64]uint, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -14579,44 +13469,47 @@ func (_ fastpathT) EncMapInt64UintV(v map[int64]uint, checkNil bool, e *Encoder) i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int64(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int64(k2)])) } - ee.EncodeInt(int64(int64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int64(k2))) + ee.EncodeUint(uint64(v[int64(k2)])) } - ee.EncodeUint(uint64(v[int64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt64Uint8R(rv reflect.Value) { - fastpathTV.EncMapInt64Uint8V(rv.Interface().(map[int64]uint8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt64Uint8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt64Uint8V(rv2i(rv).(map[int64]uint8), e) } -func (_ fastpathT) EncMapInt64Uint8V(v map[int64]uint8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt64Uint8V(v map[int64]uint8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -14625,44 +13518,47 @@ func (_ fastpathT) EncMapInt64Uint8V(v map[int64]uint8, checkNil bool, e *Encode i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int64(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int64(k2)])) } - ee.EncodeInt(int64(int64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int64(k2))) + ee.EncodeUint(uint64(v[int64(k2)])) } - ee.EncodeUint(uint64(v[int64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt64Uint16R(rv reflect.Value) { - fastpathTV.EncMapInt64Uint16V(rv.Interface().(map[int64]uint16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt64Uint16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt64Uint16V(rv2i(rv).(map[int64]uint16), e) } -func (_ fastpathT) EncMapInt64Uint16V(v map[int64]uint16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt64Uint16V(v map[int64]uint16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -14671,44 +13567,47 @@ func (_ fastpathT) EncMapInt64Uint16V(v map[int64]uint16, checkNil bool, e *Enco i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int64(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int64(k2)])) } - ee.EncodeInt(int64(int64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int64(k2))) + ee.EncodeUint(uint64(v[int64(k2)])) } - ee.EncodeUint(uint64(v[int64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt64Uint32R(rv reflect.Value) { - fastpathTV.EncMapInt64Uint32V(rv.Interface().(map[int64]uint32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt64Uint32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt64Uint32V(rv2i(rv).(map[int64]uint32), e) } -func (_ fastpathT) EncMapInt64Uint32V(v map[int64]uint32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt64Uint32V(v map[int64]uint32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -14717,44 +13616,47 @@ func (_ fastpathT) EncMapInt64Uint32V(v map[int64]uint32, checkNil bool, e *Enco i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int64(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int64(k2)])) } - ee.EncodeInt(int64(int64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int64(k2))) + ee.EncodeUint(uint64(v[int64(k2)])) } - ee.EncodeUint(uint64(v[int64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt64Uint64R(rv reflect.Value) { - fastpathTV.EncMapInt64Uint64V(rv.Interface().(map[int64]uint64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt64Uint64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt64Uint64V(rv2i(rv).(map[int64]uint64), e) } -func (_ fastpathT) EncMapInt64Uint64V(v map[int64]uint64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt64Uint64V(v map[int64]uint64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -14763,44 +13665,47 @@ func (_ fastpathT) EncMapInt64Uint64V(v map[int64]uint64, checkNil bool, e *Enco i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int64(k2))) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[int64(k2)])) } - ee.EncodeInt(int64(int64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int64(k2))) + ee.EncodeUint(uint64(v[int64(k2)])) } - ee.EncodeUint(uint64(v[int64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt64UintptrR(rv reflect.Value) { - fastpathTV.EncMapInt64UintptrV(rv.Interface().(map[int64]uintptr), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt64UintptrR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt64UintptrV(rv2i(rv).(map[int64]uintptr), e) } -func (_ fastpathT) EncMapInt64UintptrV(v map[int64]uintptr, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt64UintptrV(v map[int64]uintptr, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -14809,44 +13714,47 @@ func (_ fastpathT) EncMapInt64UintptrV(v map[int64]uintptr, checkNil bool, e *En i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int64(k2))) + ee.WriteMapElemValue() + e.encode(v[int64(k2)]) } - ee.EncodeInt(int64(int64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int64(k2))) + e.encode(v[int64(k2)]) } - e.encode(v[int64(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt64IntR(rv reflect.Value) { - fastpathTV.EncMapInt64IntV(rv.Interface().(map[int64]int), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt64IntR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt64IntV(rv2i(rv).(map[int64]int), e) } -func (_ fastpathT) EncMapInt64IntV(v map[int64]int, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt64IntV(v map[int64]int, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -14855,44 +13763,47 @@ func (_ fastpathT) EncMapInt64IntV(v map[int64]int, checkNil bool, e *Encoder) { i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int64(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int64(k2)])) } - ee.EncodeInt(int64(int64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int64(k2))) + ee.EncodeInt(int64(v[int64(k2)])) } - ee.EncodeInt(int64(v[int64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt64Int8R(rv reflect.Value) { - fastpathTV.EncMapInt64Int8V(rv.Interface().(map[int64]int8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt64Int8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt64Int8V(rv2i(rv).(map[int64]int8), e) } -func (_ fastpathT) EncMapInt64Int8V(v map[int64]int8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt64Int8V(v map[int64]int8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -14901,44 +13812,47 @@ func (_ fastpathT) EncMapInt64Int8V(v map[int64]int8, checkNil bool, e *Encoder) i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int64(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int64(k2)])) } - ee.EncodeInt(int64(int64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int64(k2))) + ee.EncodeInt(int64(v[int64(k2)])) } - ee.EncodeInt(int64(v[int64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt64Int16R(rv reflect.Value) { - fastpathTV.EncMapInt64Int16V(rv.Interface().(map[int64]int16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt64Int16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt64Int16V(rv2i(rv).(map[int64]int16), e) } -func (_ fastpathT) EncMapInt64Int16V(v map[int64]int16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt64Int16V(v map[int64]int16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -14947,44 +13861,47 @@ func (_ fastpathT) EncMapInt64Int16V(v map[int64]int16, checkNil bool, e *Encode i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int64(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int64(k2)])) } - ee.EncodeInt(int64(int64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int64(k2))) + ee.EncodeInt(int64(v[int64(k2)])) } - ee.EncodeInt(int64(v[int64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt64Int32R(rv reflect.Value) { - fastpathTV.EncMapInt64Int32V(rv.Interface().(map[int64]int32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt64Int32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt64Int32V(rv2i(rv).(map[int64]int32), e) } -func (_ fastpathT) EncMapInt64Int32V(v map[int64]int32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt64Int32V(v map[int64]int32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -14993,44 +13910,47 @@ func (_ fastpathT) EncMapInt64Int32V(v map[int64]int32, checkNil bool, e *Encode i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int64(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int64(k2)])) } - ee.EncodeInt(int64(int64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int64(k2))) + ee.EncodeInt(int64(v[int64(k2)])) } - ee.EncodeInt(int64(v[int64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt64Int64R(rv reflect.Value) { - fastpathTV.EncMapInt64Int64V(rv.Interface().(map[int64]int64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt64Int64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt64Int64V(rv2i(rv).(map[int64]int64), e) } -func (_ fastpathT) EncMapInt64Int64V(v map[int64]int64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt64Int64V(v map[int64]int64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -15039,44 +13959,47 @@ func (_ fastpathT) EncMapInt64Int64V(v map[int64]int64, checkNil bool, e *Encode i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int64(k2))) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[int64(k2)])) } - ee.EncodeInt(int64(int64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int64(k2))) + ee.EncodeInt(int64(v[int64(k2)])) } - ee.EncodeInt(int64(v[int64(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt64Float32R(rv reflect.Value) { - fastpathTV.EncMapInt64Float32V(rv.Interface().(map[int64]float32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt64Float32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt64Float32V(rv2i(rv).(map[int64]float32), e) } -func (_ fastpathT) EncMapInt64Float32V(v map[int64]float32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt64Float32V(v map[int64]float32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -15085,44 +14008,47 @@ func (_ fastpathT) EncMapInt64Float32V(v map[int64]float32, checkNil bool, e *En i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int64(k2))) + ee.WriteMapElemValue() + ee.EncodeFloat32(v[int64(k2)]) } - ee.EncodeInt(int64(int64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int64(k2))) + ee.EncodeFloat32(v[int64(k2)]) } - ee.EncodeFloat32(v[int64(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat32(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeFloat32(v2) } - ee.EncodeFloat32(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt64Float64R(rv reflect.Value) { - fastpathTV.EncMapInt64Float64V(rv.Interface().(map[int64]float64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt64Float64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt64Float64V(rv2i(rv).(map[int64]float64), e) } -func (_ fastpathT) EncMapInt64Float64V(v map[int64]float64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt64Float64V(v map[int64]float64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -15131,44 +14057,47 @@ func (_ fastpathT) EncMapInt64Float64V(v map[int64]float64, checkNil bool, e *En i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int64(k2))) + ee.WriteMapElemValue() + ee.EncodeFloat64(v[int64(k2)]) } - ee.EncodeInt(int64(int64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int64(k2))) + ee.EncodeFloat64(v[int64(k2)]) } - ee.EncodeFloat64(v[int64(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat64(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeFloat64(v2) } - ee.EncodeFloat64(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapInt64BoolR(rv reflect.Value) { - fastpathTV.EncMapInt64BoolV(rv.Interface().(map[int64]bool), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapInt64BoolR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapInt64BoolV(rv2i(rv).(map[int64]bool), e) } -func (_ fastpathT) EncMapInt64BoolV(v map[int64]bool, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapInt64BoolV(v map[int64]bool, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]int64, len(v)) var i int @@ -15177,44 +14106,47 @@ func (_ fastpathT) EncMapInt64BoolV(v map[int64]bool, checkNil bool, e *Encoder) i++ } sort.Sort(intSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeInt(int64(int64(k2))) + ee.WriteMapElemValue() + ee.EncodeBool(v[int64(k2)]) } - ee.EncodeInt(int64(int64(k2))) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeInt(int64(int64(k2))) + ee.EncodeBool(v[int64(k2)]) } - ee.EncodeBool(v[int64(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeInt(int64(k2)) + ee.WriteMapElemValue() + ee.EncodeBool(v2) } - ee.EncodeInt(int64(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeInt(int64(k2)) + ee.EncodeBool(v2) } - ee.EncodeBool(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapBoolIntfR(rv reflect.Value) { - fastpathTV.EncMapBoolIntfV(rv.Interface().(map[bool]interface{}), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapBoolIntfR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapBoolIntfV(rv2i(rv).(map[bool]interface{}), e) } -func (_ fastpathT) EncMapBoolIntfV(v map[bool]interface{}, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapBoolIntfV(v map[bool]interface{}, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]bool, len(v)) var i int @@ -15223,44 +14155,47 @@ func (_ fastpathT) EncMapBoolIntfV(v map[bool]interface{}, checkNil bool, e *Enc i++ } sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeBool(bool(k2)) + ee.WriteMapElemValue() + e.encode(v[bool(k2)]) } - ee.EncodeBool(bool(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeBool(bool(k2)) + e.encode(v[bool(k2)]) } - e.encode(v[bool(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeBool(k2) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeBool(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeBool(k2) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapBoolStringR(rv reflect.Value) { - fastpathTV.EncMapBoolStringV(rv.Interface().(map[bool]string), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapBoolStringR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapBoolStringV(rv2i(rv).(map[bool]string), e) } -func (_ fastpathT) EncMapBoolStringV(v map[bool]string, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapBoolStringV(v map[bool]string, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]bool, len(v)) var i int @@ -15269,44 +14204,47 @@ func (_ fastpathT) EncMapBoolStringV(v map[bool]string, checkNil bool, e *Encode i++ } sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeBool(bool(k2)) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v[bool(k2)]) } - ee.EncodeBool(bool(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeBool(bool(k2)) + ee.EncodeString(cUTF8, v[bool(k2)]) } - ee.EncodeString(c_UTF8, v[bool(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeBool(k2) + ee.WriteMapElemValue() + ee.EncodeString(cUTF8, v2) } - ee.EncodeBool(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeBool(k2) + ee.EncodeString(cUTF8, v2) } - ee.EncodeString(c_UTF8, v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapBoolUintR(rv reflect.Value) { - fastpathTV.EncMapBoolUintV(rv.Interface().(map[bool]uint), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapBoolUintR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapBoolUintV(rv2i(rv).(map[bool]uint), e) } -func (_ fastpathT) EncMapBoolUintV(v map[bool]uint, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapBoolUintV(v map[bool]uint, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]bool, len(v)) var i int @@ -15315,44 +14253,47 @@ func (_ fastpathT) EncMapBoolUintV(v map[bool]uint, checkNil bool, e *Encoder) { i++ } sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeBool(bool(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[bool(k2)])) } - ee.EncodeBool(bool(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeBool(bool(k2)) + ee.EncodeUint(uint64(v[bool(k2)])) } - ee.EncodeUint(uint64(v[bool(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeBool(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeBool(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeBool(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapBoolUint8R(rv reflect.Value) { - fastpathTV.EncMapBoolUint8V(rv.Interface().(map[bool]uint8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapBoolUint8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapBoolUint8V(rv2i(rv).(map[bool]uint8), e) } -func (_ fastpathT) EncMapBoolUint8V(v map[bool]uint8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapBoolUint8V(v map[bool]uint8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]bool, len(v)) var i int @@ -15361,44 +14302,47 @@ func (_ fastpathT) EncMapBoolUint8V(v map[bool]uint8, checkNil bool, e *Encoder) i++ } sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeBool(bool(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[bool(k2)])) } - ee.EncodeBool(bool(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeBool(bool(k2)) + ee.EncodeUint(uint64(v[bool(k2)])) } - ee.EncodeUint(uint64(v[bool(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeBool(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeBool(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeBool(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapBoolUint16R(rv reflect.Value) { - fastpathTV.EncMapBoolUint16V(rv.Interface().(map[bool]uint16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapBoolUint16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapBoolUint16V(rv2i(rv).(map[bool]uint16), e) } -func (_ fastpathT) EncMapBoolUint16V(v map[bool]uint16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapBoolUint16V(v map[bool]uint16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]bool, len(v)) var i int @@ -15407,44 +14351,47 @@ func (_ fastpathT) EncMapBoolUint16V(v map[bool]uint16, checkNil bool, e *Encode i++ } sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeBool(bool(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[bool(k2)])) } - ee.EncodeBool(bool(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeBool(bool(k2)) + ee.EncodeUint(uint64(v[bool(k2)])) } - ee.EncodeUint(uint64(v[bool(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeBool(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeBool(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeBool(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapBoolUint32R(rv reflect.Value) { - fastpathTV.EncMapBoolUint32V(rv.Interface().(map[bool]uint32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapBoolUint32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapBoolUint32V(rv2i(rv).(map[bool]uint32), e) } -func (_ fastpathT) EncMapBoolUint32V(v map[bool]uint32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapBoolUint32V(v map[bool]uint32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]bool, len(v)) var i int @@ -15453,44 +14400,47 @@ func (_ fastpathT) EncMapBoolUint32V(v map[bool]uint32, checkNil bool, e *Encode i++ } sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeBool(bool(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[bool(k2)])) } - ee.EncodeBool(bool(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeBool(bool(k2)) + ee.EncodeUint(uint64(v[bool(k2)])) } - ee.EncodeUint(uint64(v[bool(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeBool(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeBool(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeBool(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapBoolUint64R(rv reflect.Value) { - fastpathTV.EncMapBoolUint64V(rv.Interface().(map[bool]uint64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapBoolUint64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapBoolUint64V(rv2i(rv).(map[bool]uint64), e) } -func (_ fastpathT) EncMapBoolUint64V(v map[bool]uint64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapBoolUint64V(v map[bool]uint64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]bool, len(v)) var i int @@ -15499,44 +14449,47 @@ func (_ fastpathT) EncMapBoolUint64V(v map[bool]uint64, checkNil bool, e *Encode i++ } sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeBool(bool(k2)) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v[bool(k2)])) } - ee.EncodeBool(bool(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeBool(bool(k2)) + ee.EncodeUint(uint64(v[bool(k2)])) } - ee.EncodeUint(uint64(v[bool(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeBool(k2) + ee.WriteMapElemValue() + ee.EncodeUint(uint64(v2)) } - ee.EncodeBool(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeBool(k2) + ee.EncodeUint(uint64(v2)) } - ee.EncodeUint(uint64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapBoolUintptrR(rv reflect.Value) { - fastpathTV.EncMapBoolUintptrV(rv.Interface().(map[bool]uintptr), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapBoolUintptrR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapBoolUintptrV(rv2i(rv).(map[bool]uintptr), e) } -func (_ fastpathT) EncMapBoolUintptrV(v map[bool]uintptr, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapBoolUintptrV(v map[bool]uintptr, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]bool, len(v)) var i int @@ -15545,44 +14498,47 @@ func (_ fastpathT) EncMapBoolUintptrV(v map[bool]uintptr, checkNil bool, e *Enco i++ } sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeBool(bool(k2)) + ee.WriteMapElemValue() + e.encode(v[bool(k2)]) } - ee.EncodeBool(bool(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeBool(bool(k2)) + e.encode(v[bool(k2)]) } - e.encode(v[bool(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeBool(k2) + ee.WriteMapElemValue() + e.encode(v2) } - ee.EncodeBool(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeBool(k2) + e.encode(v2) } - e.encode(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapBoolIntR(rv reflect.Value) { - fastpathTV.EncMapBoolIntV(rv.Interface().(map[bool]int), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapBoolIntR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapBoolIntV(rv2i(rv).(map[bool]int), e) } -func (_ fastpathT) EncMapBoolIntV(v map[bool]int, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapBoolIntV(v map[bool]int, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]bool, len(v)) var i int @@ -15591,44 +14547,47 @@ func (_ fastpathT) EncMapBoolIntV(v map[bool]int, checkNil bool, e *Encoder) { i++ } sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeBool(bool(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[bool(k2)])) } - ee.EncodeBool(bool(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeBool(bool(k2)) + ee.EncodeInt(int64(v[bool(k2)])) } - ee.EncodeInt(int64(v[bool(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeBool(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeBool(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeBool(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapBoolInt8R(rv reflect.Value) { - fastpathTV.EncMapBoolInt8V(rv.Interface().(map[bool]int8), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapBoolInt8R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapBoolInt8V(rv2i(rv).(map[bool]int8), e) } -func (_ fastpathT) EncMapBoolInt8V(v map[bool]int8, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapBoolInt8V(v map[bool]int8, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]bool, len(v)) var i int @@ -15637,44 +14596,47 @@ func (_ fastpathT) EncMapBoolInt8V(v map[bool]int8, checkNil bool, e *Encoder) { i++ } sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeBool(bool(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[bool(k2)])) } - ee.EncodeBool(bool(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeBool(bool(k2)) + ee.EncodeInt(int64(v[bool(k2)])) } - ee.EncodeInt(int64(v[bool(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeBool(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeBool(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeBool(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapBoolInt16R(rv reflect.Value) { - fastpathTV.EncMapBoolInt16V(rv.Interface().(map[bool]int16), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapBoolInt16R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapBoolInt16V(rv2i(rv).(map[bool]int16), e) } -func (_ fastpathT) EncMapBoolInt16V(v map[bool]int16, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapBoolInt16V(v map[bool]int16, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]bool, len(v)) var i int @@ -15683,44 +14645,47 @@ func (_ fastpathT) EncMapBoolInt16V(v map[bool]int16, checkNil bool, e *Encoder) i++ } sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeBool(bool(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[bool(k2)])) } - ee.EncodeBool(bool(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeBool(bool(k2)) + ee.EncodeInt(int64(v[bool(k2)])) } - ee.EncodeInt(int64(v[bool(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeBool(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeBool(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeBool(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapBoolInt32R(rv reflect.Value) { - fastpathTV.EncMapBoolInt32V(rv.Interface().(map[bool]int32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapBoolInt32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapBoolInt32V(rv2i(rv).(map[bool]int32), e) } -func (_ fastpathT) EncMapBoolInt32V(v map[bool]int32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapBoolInt32V(v map[bool]int32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]bool, len(v)) var i int @@ -15729,44 +14694,47 @@ func (_ fastpathT) EncMapBoolInt32V(v map[bool]int32, checkNil bool, e *Encoder) i++ } sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeBool(bool(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[bool(k2)])) } - ee.EncodeBool(bool(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeBool(bool(k2)) + ee.EncodeInt(int64(v[bool(k2)])) } - ee.EncodeInt(int64(v[bool(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeBool(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeBool(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeBool(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapBoolInt64R(rv reflect.Value) { - fastpathTV.EncMapBoolInt64V(rv.Interface().(map[bool]int64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapBoolInt64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapBoolInt64V(rv2i(rv).(map[bool]int64), e) } -func (_ fastpathT) EncMapBoolInt64V(v map[bool]int64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapBoolInt64V(v map[bool]int64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]bool, len(v)) var i int @@ -15775,44 +14743,47 @@ func (_ fastpathT) EncMapBoolInt64V(v map[bool]int64, checkNil bool, e *Encoder) i++ } sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeBool(bool(k2)) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v[bool(k2)])) } - ee.EncodeBool(bool(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeBool(bool(k2)) + ee.EncodeInt(int64(v[bool(k2)])) } - ee.EncodeInt(int64(v[bool(k2)])) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeBool(k2) + ee.WriteMapElemValue() + ee.EncodeInt(int64(v2)) } - ee.EncodeBool(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeBool(k2) + ee.EncodeInt(int64(v2)) } - ee.EncodeInt(int64(v2)) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapBoolFloat32R(rv reflect.Value) { - fastpathTV.EncMapBoolFloat32V(rv.Interface().(map[bool]float32), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapBoolFloat32R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapBoolFloat32V(rv2i(rv).(map[bool]float32), e) } -func (_ fastpathT) EncMapBoolFloat32V(v map[bool]float32, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapBoolFloat32V(v map[bool]float32, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]bool, len(v)) var i int @@ -15821,44 +14792,47 @@ func (_ fastpathT) EncMapBoolFloat32V(v map[bool]float32, checkNil bool, e *Enco i++ } sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeBool(bool(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat32(v[bool(k2)]) } - ee.EncodeBool(bool(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeBool(bool(k2)) + ee.EncodeFloat32(v[bool(k2)]) } - ee.EncodeFloat32(v[bool(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeBool(k2) + ee.WriteMapElemValue() + ee.EncodeFloat32(v2) } - ee.EncodeBool(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeBool(k2) + ee.EncodeFloat32(v2) } - ee.EncodeFloat32(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapBoolFloat64R(rv reflect.Value) { - fastpathTV.EncMapBoolFloat64V(rv.Interface().(map[bool]float64), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapBoolFloat64R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapBoolFloat64V(rv2i(rv).(map[bool]float64), e) } -func (_ fastpathT) EncMapBoolFloat64V(v map[bool]float64, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapBoolFloat64V(v map[bool]float64, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]bool, len(v)) var i int @@ -15867,44 +14841,47 @@ func (_ fastpathT) EncMapBoolFloat64V(v map[bool]float64, checkNil bool, e *Enco i++ } sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeBool(bool(k2)) + ee.WriteMapElemValue() + ee.EncodeFloat64(v[bool(k2)]) } - ee.EncodeBool(bool(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeBool(bool(k2)) + ee.EncodeFloat64(v[bool(k2)]) } - ee.EncodeFloat64(v[bool(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeBool(k2) + ee.WriteMapElemValue() + ee.EncodeFloat64(v2) } - ee.EncodeBool(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeBool(k2) + ee.EncodeFloat64(v2) } - ee.EncodeFloat64(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } -func (f *encFnInfo) fastpathEncMapBoolBoolR(rv reflect.Value) { - fastpathTV.EncMapBoolBoolV(rv.Interface().(map[bool]bool), fastpathCheckNilFalse, f.e) +func (e *Encoder) fastpathEncMapBoolBoolR(f *codecFnInfo, rv reflect.Value) { + fastpathTV.EncMapBoolBoolV(rv2i(rv).(map[bool]bool), e) } -func (_ fastpathT) EncMapBoolBoolV(v map[bool]bool, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() +func (_ fastpathT) EncMapBoolBoolV(v map[bool]bool, e *Encoder) { + if v == nil { + e.e.EncodeNil() return } - ee.EncodeMapStart(len(v)) + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) if e.h.Canonical { v2 := make([]bool, len(v)) var i int @@ -15913,2209 +14890,2830 @@ func (_ fastpathT) EncMapBoolBoolV(v map[bool]bool, checkNil bool, e *Encoder) { i++ } sort.Sort(boolSlice(v2)) - for _, k2 := range v2 { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + ee.EncodeBool(bool(k2)) + ee.WriteMapElemValue() + ee.EncodeBool(v[bool(k2)]) } - ee.EncodeBool(bool(k2)) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for _, k2 := range v2 { + ee.EncodeBool(bool(k2)) + ee.EncodeBool(v[bool(k2)]) } - ee.EncodeBool(v[bool(k2)]) } } else { - for k2, v2 := range v { - if cr != nil { - cr.sendContainerState(containerMapKey) + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + ee.EncodeBool(k2) + ee.WriteMapElemValue() + ee.EncodeBool(v2) } - ee.EncodeBool(k2) - if cr != nil { - cr.sendContainerState(containerMapValue) + } else { + for k2, v2 := range v { + ee.EncodeBool(k2) + ee.EncodeBool(v2) } - ee.EncodeBool(v2) } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + ee.WriteMapEnd() } // -- decode // -- -- fast path type switch func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { + var changed bool switch v := iv.(type) { case []interface{}: - fastpathTV.DecSliceIntfV(v, fastpathCheckNilFalse, false, d) + var v2 []interface{} + v2, changed = fastpathTV.DecSliceIntfV(v, false, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } case *[]interface{}: - v2, changed2 := fastpathTV.DecSliceIntfV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 []interface{} + v2, changed = fastpathTV.DecSliceIntfV(*v, true, d) + if changed { + *v = v2 + } + case []string: + var v2 []string + v2, changed = fastpathTV.DecSliceStringV(v, false, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } + case *[]string: + var v2 []string + v2, changed = fastpathTV.DecSliceStringV(*v, true, d) + if changed { + *v = v2 + } + case []float32: + var v2 []float32 + v2, changed = fastpathTV.DecSliceFloat32V(v, false, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } + case *[]float32: + var v2 []float32 + v2, changed = fastpathTV.DecSliceFloat32V(*v, true, d) + if changed { + *v = v2 + } + case []float64: + var v2 []float64 + v2, changed = fastpathTV.DecSliceFloat64V(v, false, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } + case *[]float64: + var v2 []float64 + v2, changed = fastpathTV.DecSliceFloat64V(*v, true, d) + if changed { + *v = v2 + } + case []uint: + var v2 []uint + v2, changed = fastpathTV.DecSliceUintV(v, false, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } + case *[]uint: + var v2 []uint + v2, changed = fastpathTV.DecSliceUintV(*v, true, d) + if changed { + *v = v2 + } + case []uint16: + var v2 []uint16 + v2, changed = fastpathTV.DecSliceUint16V(v, false, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } + case *[]uint16: + var v2 []uint16 + v2, changed = fastpathTV.DecSliceUint16V(*v, true, d) + if changed { + *v = v2 + } + case []uint32: + var v2 []uint32 + v2, changed = fastpathTV.DecSliceUint32V(v, false, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } + case *[]uint32: + var v2 []uint32 + v2, changed = fastpathTV.DecSliceUint32V(*v, true, d) + if changed { + *v = v2 + } + case []uint64: + var v2 []uint64 + v2, changed = fastpathTV.DecSliceUint64V(v, false, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } + case *[]uint64: + var v2 []uint64 + v2, changed = fastpathTV.DecSliceUint64V(*v, true, d) + if changed { + *v = v2 + } + case []uintptr: + var v2 []uintptr + v2, changed = fastpathTV.DecSliceUintptrV(v, false, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } + case *[]uintptr: + var v2 []uintptr + v2, changed = fastpathTV.DecSliceUintptrV(*v, true, d) + if changed { + *v = v2 + } + case []int: + var v2 []int + v2, changed = fastpathTV.DecSliceIntV(v, false, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } + case *[]int: + var v2 []int + v2, changed = fastpathTV.DecSliceIntV(*v, true, d) + if changed { + *v = v2 + } + case []int8: + var v2 []int8 + v2, changed = fastpathTV.DecSliceInt8V(v, false, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } + case *[]int8: + var v2 []int8 + v2, changed = fastpathTV.DecSliceInt8V(*v, true, d) + if changed { + *v = v2 + } + case []int16: + var v2 []int16 + v2, changed = fastpathTV.DecSliceInt16V(v, false, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } + case *[]int16: + var v2 []int16 + v2, changed = fastpathTV.DecSliceInt16V(*v, true, d) + if changed { + *v = v2 + } + case []int32: + var v2 []int32 + v2, changed = fastpathTV.DecSliceInt32V(v, false, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } + case *[]int32: + var v2 []int32 + v2, changed = fastpathTV.DecSliceInt32V(*v, true, d) + if changed { + *v = v2 + } + case []int64: + var v2 []int64 + v2, changed = fastpathTV.DecSliceInt64V(v, false, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } + case *[]int64: + var v2 []int64 + v2, changed = fastpathTV.DecSliceInt64V(*v, true, d) + if changed { + *v = v2 + } + case []bool: + var v2 []bool + v2, changed = fastpathTV.DecSliceBoolV(v, false, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } + case *[]bool: + var v2 []bool + v2, changed = fastpathTV.DecSliceBoolV(*v, true, d) + if changed { *v = v2 } case map[interface{}]interface{}: - fastpathTV.DecMapIntfIntfV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntfIntfV(v, false, d) case *map[interface{}]interface{}: - v2, changed2 := fastpathTV.DecMapIntfIntfV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[interface{}]interface{} + v2, changed = fastpathTV.DecMapIntfIntfV(*v, true, d) + if changed { *v = v2 } - case map[interface{}]string: - fastpathTV.DecMapIntfStringV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntfStringV(v, false, d) case *map[interface{}]string: - v2, changed2 := fastpathTV.DecMapIntfStringV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[interface{}]string + v2, changed = fastpathTV.DecMapIntfStringV(*v, true, d) + if changed { *v = v2 } - case map[interface{}]uint: - fastpathTV.DecMapIntfUintV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntfUintV(v, false, d) case *map[interface{}]uint: - v2, changed2 := fastpathTV.DecMapIntfUintV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[interface{}]uint + v2, changed = fastpathTV.DecMapIntfUintV(*v, true, d) + if changed { *v = v2 } - case map[interface{}]uint8: - fastpathTV.DecMapIntfUint8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntfUint8V(v, false, d) case *map[interface{}]uint8: - v2, changed2 := fastpathTV.DecMapIntfUint8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[interface{}]uint8 + v2, changed = fastpathTV.DecMapIntfUint8V(*v, true, d) + if changed { *v = v2 } - case map[interface{}]uint16: - fastpathTV.DecMapIntfUint16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntfUint16V(v, false, d) case *map[interface{}]uint16: - v2, changed2 := fastpathTV.DecMapIntfUint16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[interface{}]uint16 + v2, changed = fastpathTV.DecMapIntfUint16V(*v, true, d) + if changed { *v = v2 } - case map[interface{}]uint32: - fastpathTV.DecMapIntfUint32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntfUint32V(v, false, d) case *map[interface{}]uint32: - v2, changed2 := fastpathTV.DecMapIntfUint32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[interface{}]uint32 + v2, changed = fastpathTV.DecMapIntfUint32V(*v, true, d) + if changed { *v = v2 } - case map[interface{}]uint64: - fastpathTV.DecMapIntfUint64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntfUint64V(v, false, d) case *map[interface{}]uint64: - v2, changed2 := fastpathTV.DecMapIntfUint64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[interface{}]uint64 + v2, changed = fastpathTV.DecMapIntfUint64V(*v, true, d) + if changed { *v = v2 } - case map[interface{}]uintptr: - fastpathTV.DecMapIntfUintptrV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntfUintptrV(v, false, d) case *map[interface{}]uintptr: - v2, changed2 := fastpathTV.DecMapIntfUintptrV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[interface{}]uintptr + v2, changed = fastpathTV.DecMapIntfUintptrV(*v, true, d) + if changed { *v = v2 } - case map[interface{}]int: - fastpathTV.DecMapIntfIntV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntfIntV(v, false, d) case *map[interface{}]int: - v2, changed2 := fastpathTV.DecMapIntfIntV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[interface{}]int + v2, changed = fastpathTV.DecMapIntfIntV(*v, true, d) + if changed { *v = v2 } - case map[interface{}]int8: - fastpathTV.DecMapIntfInt8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntfInt8V(v, false, d) case *map[interface{}]int8: - v2, changed2 := fastpathTV.DecMapIntfInt8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[interface{}]int8 + v2, changed = fastpathTV.DecMapIntfInt8V(*v, true, d) + if changed { *v = v2 } - case map[interface{}]int16: - fastpathTV.DecMapIntfInt16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntfInt16V(v, false, d) case *map[interface{}]int16: - v2, changed2 := fastpathTV.DecMapIntfInt16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[interface{}]int16 + v2, changed = fastpathTV.DecMapIntfInt16V(*v, true, d) + if changed { *v = v2 } - case map[interface{}]int32: - fastpathTV.DecMapIntfInt32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntfInt32V(v, false, d) case *map[interface{}]int32: - v2, changed2 := fastpathTV.DecMapIntfInt32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[interface{}]int32 + v2, changed = fastpathTV.DecMapIntfInt32V(*v, true, d) + if changed { *v = v2 } - case map[interface{}]int64: - fastpathTV.DecMapIntfInt64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntfInt64V(v, false, d) case *map[interface{}]int64: - v2, changed2 := fastpathTV.DecMapIntfInt64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[interface{}]int64 + v2, changed = fastpathTV.DecMapIntfInt64V(*v, true, d) + if changed { *v = v2 } - case map[interface{}]float32: - fastpathTV.DecMapIntfFloat32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntfFloat32V(v, false, d) case *map[interface{}]float32: - v2, changed2 := fastpathTV.DecMapIntfFloat32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[interface{}]float32 + v2, changed = fastpathTV.DecMapIntfFloat32V(*v, true, d) + if changed { *v = v2 } - case map[interface{}]float64: - fastpathTV.DecMapIntfFloat64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntfFloat64V(v, false, d) case *map[interface{}]float64: - v2, changed2 := fastpathTV.DecMapIntfFloat64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[interface{}]float64 + v2, changed = fastpathTV.DecMapIntfFloat64V(*v, true, d) + if changed { *v = v2 } - case map[interface{}]bool: - fastpathTV.DecMapIntfBoolV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntfBoolV(v, false, d) case *map[interface{}]bool: - v2, changed2 := fastpathTV.DecMapIntfBoolV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[interface{}]bool + v2, changed = fastpathTV.DecMapIntfBoolV(*v, true, d) + if changed { *v = v2 } - - case []string: - fastpathTV.DecSliceStringV(v, fastpathCheckNilFalse, false, d) - case *[]string: - v2, changed2 := fastpathTV.DecSliceStringV(*v, fastpathCheckNilFalse, true, d) - if changed2 { - *v = v2 - } - case map[string]interface{}: - fastpathTV.DecMapStringIntfV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapStringIntfV(v, false, d) case *map[string]interface{}: - v2, changed2 := fastpathTV.DecMapStringIntfV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[string]interface{} + v2, changed = fastpathTV.DecMapStringIntfV(*v, true, d) + if changed { *v = v2 } - case map[string]string: - fastpathTV.DecMapStringStringV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapStringStringV(v, false, d) case *map[string]string: - v2, changed2 := fastpathTV.DecMapStringStringV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[string]string + v2, changed = fastpathTV.DecMapStringStringV(*v, true, d) + if changed { *v = v2 } - case map[string]uint: - fastpathTV.DecMapStringUintV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapStringUintV(v, false, d) case *map[string]uint: - v2, changed2 := fastpathTV.DecMapStringUintV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[string]uint + v2, changed = fastpathTV.DecMapStringUintV(*v, true, d) + if changed { *v = v2 } - case map[string]uint8: - fastpathTV.DecMapStringUint8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapStringUint8V(v, false, d) case *map[string]uint8: - v2, changed2 := fastpathTV.DecMapStringUint8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[string]uint8 + v2, changed = fastpathTV.DecMapStringUint8V(*v, true, d) + if changed { *v = v2 } - case map[string]uint16: - fastpathTV.DecMapStringUint16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapStringUint16V(v, false, d) case *map[string]uint16: - v2, changed2 := fastpathTV.DecMapStringUint16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[string]uint16 + v2, changed = fastpathTV.DecMapStringUint16V(*v, true, d) + if changed { *v = v2 } - case map[string]uint32: - fastpathTV.DecMapStringUint32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapStringUint32V(v, false, d) case *map[string]uint32: - v2, changed2 := fastpathTV.DecMapStringUint32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[string]uint32 + v2, changed = fastpathTV.DecMapStringUint32V(*v, true, d) + if changed { *v = v2 } - case map[string]uint64: - fastpathTV.DecMapStringUint64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapStringUint64V(v, false, d) case *map[string]uint64: - v2, changed2 := fastpathTV.DecMapStringUint64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[string]uint64 + v2, changed = fastpathTV.DecMapStringUint64V(*v, true, d) + if changed { *v = v2 } - case map[string]uintptr: - fastpathTV.DecMapStringUintptrV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapStringUintptrV(v, false, d) case *map[string]uintptr: - v2, changed2 := fastpathTV.DecMapStringUintptrV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[string]uintptr + v2, changed = fastpathTV.DecMapStringUintptrV(*v, true, d) + if changed { *v = v2 } - case map[string]int: - fastpathTV.DecMapStringIntV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapStringIntV(v, false, d) case *map[string]int: - v2, changed2 := fastpathTV.DecMapStringIntV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[string]int + v2, changed = fastpathTV.DecMapStringIntV(*v, true, d) + if changed { *v = v2 } - case map[string]int8: - fastpathTV.DecMapStringInt8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapStringInt8V(v, false, d) case *map[string]int8: - v2, changed2 := fastpathTV.DecMapStringInt8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[string]int8 + v2, changed = fastpathTV.DecMapStringInt8V(*v, true, d) + if changed { *v = v2 } - case map[string]int16: - fastpathTV.DecMapStringInt16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapStringInt16V(v, false, d) case *map[string]int16: - v2, changed2 := fastpathTV.DecMapStringInt16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[string]int16 + v2, changed = fastpathTV.DecMapStringInt16V(*v, true, d) + if changed { *v = v2 } - case map[string]int32: - fastpathTV.DecMapStringInt32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapStringInt32V(v, false, d) case *map[string]int32: - v2, changed2 := fastpathTV.DecMapStringInt32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[string]int32 + v2, changed = fastpathTV.DecMapStringInt32V(*v, true, d) + if changed { *v = v2 } - case map[string]int64: - fastpathTV.DecMapStringInt64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapStringInt64V(v, false, d) case *map[string]int64: - v2, changed2 := fastpathTV.DecMapStringInt64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[string]int64 + v2, changed = fastpathTV.DecMapStringInt64V(*v, true, d) + if changed { *v = v2 } - case map[string]float32: - fastpathTV.DecMapStringFloat32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapStringFloat32V(v, false, d) case *map[string]float32: - v2, changed2 := fastpathTV.DecMapStringFloat32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[string]float32 + v2, changed = fastpathTV.DecMapStringFloat32V(*v, true, d) + if changed { *v = v2 } - case map[string]float64: - fastpathTV.DecMapStringFloat64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapStringFloat64V(v, false, d) case *map[string]float64: - v2, changed2 := fastpathTV.DecMapStringFloat64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[string]float64 + v2, changed = fastpathTV.DecMapStringFloat64V(*v, true, d) + if changed { *v = v2 } - case map[string]bool: - fastpathTV.DecMapStringBoolV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapStringBoolV(v, false, d) case *map[string]bool: - v2, changed2 := fastpathTV.DecMapStringBoolV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[string]bool + v2, changed = fastpathTV.DecMapStringBoolV(*v, true, d) + if changed { *v = v2 } - - case []float32: - fastpathTV.DecSliceFloat32V(v, fastpathCheckNilFalse, false, d) - case *[]float32: - v2, changed2 := fastpathTV.DecSliceFloat32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { - *v = v2 - } - case map[float32]interface{}: - fastpathTV.DecMapFloat32IntfV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat32IntfV(v, false, d) case *map[float32]interface{}: - v2, changed2 := fastpathTV.DecMapFloat32IntfV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float32]interface{} + v2, changed = fastpathTV.DecMapFloat32IntfV(*v, true, d) + if changed { *v = v2 } - case map[float32]string: - fastpathTV.DecMapFloat32StringV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat32StringV(v, false, d) case *map[float32]string: - v2, changed2 := fastpathTV.DecMapFloat32StringV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float32]string + v2, changed = fastpathTV.DecMapFloat32StringV(*v, true, d) + if changed { *v = v2 } - case map[float32]uint: - fastpathTV.DecMapFloat32UintV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat32UintV(v, false, d) case *map[float32]uint: - v2, changed2 := fastpathTV.DecMapFloat32UintV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float32]uint + v2, changed = fastpathTV.DecMapFloat32UintV(*v, true, d) + if changed { *v = v2 } - case map[float32]uint8: - fastpathTV.DecMapFloat32Uint8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat32Uint8V(v, false, d) case *map[float32]uint8: - v2, changed2 := fastpathTV.DecMapFloat32Uint8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float32]uint8 + v2, changed = fastpathTV.DecMapFloat32Uint8V(*v, true, d) + if changed { *v = v2 } - case map[float32]uint16: - fastpathTV.DecMapFloat32Uint16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat32Uint16V(v, false, d) case *map[float32]uint16: - v2, changed2 := fastpathTV.DecMapFloat32Uint16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float32]uint16 + v2, changed = fastpathTV.DecMapFloat32Uint16V(*v, true, d) + if changed { *v = v2 } - case map[float32]uint32: - fastpathTV.DecMapFloat32Uint32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat32Uint32V(v, false, d) case *map[float32]uint32: - v2, changed2 := fastpathTV.DecMapFloat32Uint32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float32]uint32 + v2, changed = fastpathTV.DecMapFloat32Uint32V(*v, true, d) + if changed { *v = v2 } - case map[float32]uint64: - fastpathTV.DecMapFloat32Uint64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat32Uint64V(v, false, d) case *map[float32]uint64: - v2, changed2 := fastpathTV.DecMapFloat32Uint64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float32]uint64 + v2, changed = fastpathTV.DecMapFloat32Uint64V(*v, true, d) + if changed { *v = v2 } - case map[float32]uintptr: - fastpathTV.DecMapFloat32UintptrV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat32UintptrV(v, false, d) case *map[float32]uintptr: - v2, changed2 := fastpathTV.DecMapFloat32UintptrV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float32]uintptr + v2, changed = fastpathTV.DecMapFloat32UintptrV(*v, true, d) + if changed { *v = v2 } - case map[float32]int: - fastpathTV.DecMapFloat32IntV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat32IntV(v, false, d) case *map[float32]int: - v2, changed2 := fastpathTV.DecMapFloat32IntV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float32]int + v2, changed = fastpathTV.DecMapFloat32IntV(*v, true, d) + if changed { *v = v2 } - case map[float32]int8: - fastpathTV.DecMapFloat32Int8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat32Int8V(v, false, d) case *map[float32]int8: - v2, changed2 := fastpathTV.DecMapFloat32Int8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float32]int8 + v2, changed = fastpathTV.DecMapFloat32Int8V(*v, true, d) + if changed { *v = v2 } - case map[float32]int16: - fastpathTV.DecMapFloat32Int16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat32Int16V(v, false, d) case *map[float32]int16: - v2, changed2 := fastpathTV.DecMapFloat32Int16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float32]int16 + v2, changed = fastpathTV.DecMapFloat32Int16V(*v, true, d) + if changed { *v = v2 } - case map[float32]int32: - fastpathTV.DecMapFloat32Int32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat32Int32V(v, false, d) case *map[float32]int32: - v2, changed2 := fastpathTV.DecMapFloat32Int32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float32]int32 + v2, changed = fastpathTV.DecMapFloat32Int32V(*v, true, d) + if changed { *v = v2 } - case map[float32]int64: - fastpathTV.DecMapFloat32Int64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat32Int64V(v, false, d) case *map[float32]int64: - v2, changed2 := fastpathTV.DecMapFloat32Int64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float32]int64 + v2, changed = fastpathTV.DecMapFloat32Int64V(*v, true, d) + if changed { *v = v2 } - case map[float32]float32: - fastpathTV.DecMapFloat32Float32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat32Float32V(v, false, d) case *map[float32]float32: - v2, changed2 := fastpathTV.DecMapFloat32Float32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float32]float32 + v2, changed = fastpathTV.DecMapFloat32Float32V(*v, true, d) + if changed { *v = v2 } - case map[float32]float64: - fastpathTV.DecMapFloat32Float64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat32Float64V(v, false, d) case *map[float32]float64: - v2, changed2 := fastpathTV.DecMapFloat32Float64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float32]float64 + v2, changed = fastpathTV.DecMapFloat32Float64V(*v, true, d) + if changed { *v = v2 } - case map[float32]bool: - fastpathTV.DecMapFloat32BoolV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat32BoolV(v, false, d) case *map[float32]bool: - v2, changed2 := fastpathTV.DecMapFloat32BoolV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float32]bool + v2, changed = fastpathTV.DecMapFloat32BoolV(*v, true, d) + if changed { *v = v2 } - - case []float64: - fastpathTV.DecSliceFloat64V(v, fastpathCheckNilFalse, false, d) - case *[]float64: - v2, changed2 := fastpathTV.DecSliceFloat64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { - *v = v2 - } - case map[float64]interface{}: - fastpathTV.DecMapFloat64IntfV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat64IntfV(v, false, d) case *map[float64]interface{}: - v2, changed2 := fastpathTV.DecMapFloat64IntfV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float64]interface{} + v2, changed = fastpathTV.DecMapFloat64IntfV(*v, true, d) + if changed { *v = v2 } - case map[float64]string: - fastpathTV.DecMapFloat64StringV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat64StringV(v, false, d) case *map[float64]string: - v2, changed2 := fastpathTV.DecMapFloat64StringV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float64]string + v2, changed = fastpathTV.DecMapFloat64StringV(*v, true, d) + if changed { *v = v2 } - case map[float64]uint: - fastpathTV.DecMapFloat64UintV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat64UintV(v, false, d) case *map[float64]uint: - v2, changed2 := fastpathTV.DecMapFloat64UintV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float64]uint + v2, changed = fastpathTV.DecMapFloat64UintV(*v, true, d) + if changed { *v = v2 } - case map[float64]uint8: - fastpathTV.DecMapFloat64Uint8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat64Uint8V(v, false, d) case *map[float64]uint8: - v2, changed2 := fastpathTV.DecMapFloat64Uint8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float64]uint8 + v2, changed = fastpathTV.DecMapFloat64Uint8V(*v, true, d) + if changed { *v = v2 } - case map[float64]uint16: - fastpathTV.DecMapFloat64Uint16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat64Uint16V(v, false, d) case *map[float64]uint16: - v2, changed2 := fastpathTV.DecMapFloat64Uint16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float64]uint16 + v2, changed = fastpathTV.DecMapFloat64Uint16V(*v, true, d) + if changed { *v = v2 } - case map[float64]uint32: - fastpathTV.DecMapFloat64Uint32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat64Uint32V(v, false, d) case *map[float64]uint32: - v2, changed2 := fastpathTV.DecMapFloat64Uint32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float64]uint32 + v2, changed = fastpathTV.DecMapFloat64Uint32V(*v, true, d) + if changed { *v = v2 } - case map[float64]uint64: - fastpathTV.DecMapFloat64Uint64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat64Uint64V(v, false, d) case *map[float64]uint64: - v2, changed2 := fastpathTV.DecMapFloat64Uint64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float64]uint64 + v2, changed = fastpathTV.DecMapFloat64Uint64V(*v, true, d) + if changed { *v = v2 } - case map[float64]uintptr: - fastpathTV.DecMapFloat64UintptrV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat64UintptrV(v, false, d) case *map[float64]uintptr: - v2, changed2 := fastpathTV.DecMapFloat64UintptrV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float64]uintptr + v2, changed = fastpathTV.DecMapFloat64UintptrV(*v, true, d) + if changed { *v = v2 } - case map[float64]int: - fastpathTV.DecMapFloat64IntV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat64IntV(v, false, d) case *map[float64]int: - v2, changed2 := fastpathTV.DecMapFloat64IntV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float64]int + v2, changed = fastpathTV.DecMapFloat64IntV(*v, true, d) + if changed { *v = v2 } - case map[float64]int8: - fastpathTV.DecMapFloat64Int8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat64Int8V(v, false, d) case *map[float64]int8: - v2, changed2 := fastpathTV.DecMapFloat64Int8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float64]int8 + v2, changed = fastpathTV.DecMapFloat64Int8V(*v, true, d) + if changed { *v = v2 } - case map[float64]int16: - fastpathTV.DecMapFloat64Int16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat64Int16V(v, false, d) case *map[float64]int16: - v2, changed2 := fastpathTV.DecMapFloat64Int16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float64]int16 + v2, changed = fastpathTV.DecMapFloat64Int16V(*v, true, d) + if changed { *v = v2 } - case map[float64]int32: - fastpathTV.DecMapFloat64Int32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat64Int32V(v, false, d) case *map[float64]int32: - v2, changed2 := fastpathTV.DecMapFloat64Int32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float64]int32 + v2, changed = fastpathTV.DecMapFloat64Int32V(*v, true, d) + if changed { *v = v2 } - case map[float64]int64: - fastpathTV.DecMapFloat64Int64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat64Int64V(v, false, d) case *map[float64]int64: - v2, changed2 := fastpathTV.DecMapFloat64Int64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float64]int64 + v2, changed = fastpathTV.DecMapFloat64Int64V(*v, true, d) + if changed { *v = v2 } - case map[float64]float32: - fastpathTV.DecMapFloat64Float32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat64Float32V(v, false, d) case *map[float64]float32: - v2, changed2 := fastpathTV.DecMapFloat64Float32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float64]float32 + v2, changed = fastpathTV.DecMapFloat64Float32V(*v, true, d) + if changed { *v = v2 } - case map[float64]float64: - fastpathTV.DecMapFloat64Float64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat64Float64V(v, false, d) case *map[float64]float64: - v2, changed2 := fastpathTV.DecMapFloat64Float64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float64]float64 + v2, changed = fastpathTV.DecMapFloat64Float64V(*v, true, d) + if changed { *v = v2 } - case map[float64]bool: - fastpathTV.DecMapFloat64BoolV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapFloat64BoolV(v, false, d) case *map[float64]bool: - v2, changed2 := fastpathTV.DecMapFloat64BoolV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[float64]bool + v2, changed = fastpathTV.DecMapFloat64BoolV(*v, true, d) + if changed { *v = v2 } - - case []uint: - fastpathTV.DecSliceUintV(v, fastpathCheckNilFalse, false, d) - case *[]uint: - v2, changed2 := fastpathTV.DecSliceUintV(*v, fastpathCheckNilFalse, true, d) - if changed2 { - *v = v2 - } - case map[uint]interface{}: - fastpathTV.DecMapUintIntfV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintIntfV(v, false, d) case *map[uint]interface{}: - v2, changed2 := fastpathTV.DecMapUintIntfV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint]interface{} + v2, changed = fastpathTV.DecMapUintIntfV(*v, true, d) + if changed { *v = v2 } - case map[uint]string: - fastpathTV.DecMapUintStringV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintStringV(v, false, d) case *map[uint]string: - v2, changed2 := fastpathTV.DecMapUintStringV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint]string + v2, changed = fastpathTV.DecMapUintStringV(*v, true, d) + if changed { *v = v2 } - case map[uint]uint: - fastpathTV.DecMapUintUintV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintUintV(v, false, d) case *map[uint]uint: - v2, changed2 := fastpathTV.DecMapUintUintV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint]uint + v2, changed = fastpathTV.DecMapUintUintV(*v, true, d) + if changed { *v = v2 } - case map[uint]uint8: - fastpathTV.DecMapUintUint8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintUint8V(v, false, d) case *map[uint]uint8: - v2, changed2 := fastpathTV.DecMapUintUint8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint]uint8 + v2, changed = fastpathTV.DecMapUintUint8V(*v, true, d) + if changed { *v = v2 } - case map[uint]uint16: - fastpathTV.DecMapUintUint16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintUint16V(v, false, d) case *map[uint]uint16: - v2, changed2 := fastpathTV.DecMapUintUint16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint]uint16 + v2, changed = fastpathTV.DecMapUintUint16V(*v, true, d) + if changed { *v = v2 } - case map[uint]uint32: - fastpathTV.DecMapUintUint32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintUint32V(v, false, d) case *map[uint]uint32: - v2, changed2 := fastpathTV.DecMapUintUint32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint]uint32 + v2, changed = fastpathTV.DecMapUintUint32V(*v, true, d) + if changed { *v = v2 } - case map[uint]uint64: - fastpathTV.DecMapUintUint64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintUint64V(v, false, d) case *map[uint]uint64: - v2, changed2 := fastpathTV.DecMapUintUint64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint]uint64 + v2, changed = fastpathTV.DecMapUintUint64V(*v, true, d) + if changed { *v = v2 } - case map[uint]uintptr: - fastpathTV.DecMapUintUintptrV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintUintptrV(v, false, d) case *map[uint]uintptr: - v2, changed2 := fastpathTV.DecMapUintUintptrV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint]uintptr + v2, changed = fastpathTV.DecMapUintUintptrV(*v, true, d) + if changed { *v = v2 } - case map[uint]int: - fastpathTV.DecMapUintIntV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintIntV(v, false, d) case *map[uint]int: - v2, changed2 := fastpathTV.DecMapUintIntV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint]int + v2, changed = fastpathTV.DecMapUintIntV(*v, true, d) + if changed { *v = v2 } - case map[uint]int8: - fastpathTV.DecMapUintInt8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintInt8V(v, false, d) case *map[uint]int8: - v2, changed2 := fastpathTV.DecMapUintInt8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint]int8 + v2, changed = fastpathTV.DecMapUintInt8V(*v, true, d) + if changed { *v = v2 } - case map[uint]int16: - fastpathTV.DecMapUintInt16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintInt16V(v, false, d) case *map[uint]int16: - v2, changed2 := fastpathTV.DecMapUintInt16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint]int16 + v2, changed = fastpathTV.DecMapUintInt16V(*v, true, d) + if changed { *v = v2 } - case map[uint]int32: - fastpathTV.DecMapUintInt32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintInt32V(v, false, d) case *map[uint]int32: - v2, changed2 := fastpathTV.DecMapUintInt32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint]int32 + v2, changed = fastpathTV.DecMapUintInt32V(*v, true, d) + if changed { *v = v2 } - case map[uint]int64: - fastpathTV.DecMapUintInt64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintInt64V(v, false, d) case *map[uint]int64: - v2, changed2 := fastpathTV.DecMapUintInt64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint]int64 + v2, changed = fastpathTV.DecMapUintInt64V(*v, true, d) + if changed { *v = v2 } - case map[uint]float32: - fastpathTV.DecMapUintFloat32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintFloat32V(v, false, d) case *map[uint]float32: - v2, changed2 := fastpathTV.DecMapUintFloat32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint]float32 + v2, changed = fastpathTV.DecMapUintFloat32V(*v, true, d) + if changed { *v = v2 } - case map[uint]float64: - fastpathTV.DecMapUintFloat64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintFloat64V(v, false, d) case *map[uint]float64: - v2, changed2 := fastpathTV.DecMapUintFloat64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint]float64 + v2, changed = fastpathTV.DecMapUintFloat64V(*v, true, d) + if changed { *v = v2 } - case map[uint]bool: - fastpathTV.DecMapUintBoolV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintBoolV(v, false, d) case *map[uint]bool: - v2, changed2 := fastpathTV.DecMapUintBoolV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint]bool + v2, changed = fastpathTV.DecMapUintBoolV(*v, true, d) + if changed { *v = v2 } - case map[uint8]interface{}: - fastpathTV.DecMapUint8IntfV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint8IntfV(v, false, d) case *map[uint8]interface{}: - v2, changed2 := fastpathTV.DecMapUint8IntfV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint8]interface{} + v2, changed = fastpathTV.DecMapUint8IntfV(*v, true, d) + if changed { *v = v2 } - case map[uint8]string: - fastpathTV.DecMapUint8StringV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint8StringV(v, false, d) case *map[uint8]string: - v2, changed2 := fastpathTV.DecMapUint8StringV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint8]string + v2, changed = fastpathTV.DecMapUint8StringV(*v, true, d) + if changed { *v = v2 } - case map[uint8]uint: - fastpathTV.DecMapUint8UintV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint8UintV(v, false, d) case *map[uint8]uint: - v2, changed2 := fastpathTV.DecMapUint8UintV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint8]uint + v2, changed = fastpathTV.DecMapUint8UintV(*v, true, d) + if changed { *v = v2 } - case map[uint8]uint8: - fastpathTV.DecMapUint8Uint8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint8Uint8V(v, false, d) case *map[uint8]uint8: - v2, changed2 := fastpathTV.DecMapUint8Uint8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint8]uint8 + v2, changed = fastpathTV.DecMapUint8Uint8V(*v, true, d) + if changed { *v = v2 } - case map[uint8]uint16: - fastpathTV.DecMapUint8Uint16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint8Uint16V(v, false, d) case *map[uint8]uint16: - v2, changed2 := fastpathTV.DecMapUint8Uint16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint8]uint16 + v2, changed = fastpathTV.DecMapUint8Uint16V(*v, true, d) + if changed { *v = v2 } - case map[uint8]uint32: - fastpathTV.DecMapUint8Uint32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint8Uint32V(v, false, d) case *map[uint8]uint32: - v2, changed2 := fastpathTV.DecMapUint8Uint32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint8]uint32 + v2, changed = fastpathTV.DecMapUint8Uint32V(*v, true, d) + if changed { *v = v2 } - case map[uint8]uint64: - fastpathTV.DecMapUint8Uint64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint8Uint64V(v, false, d) case *map[uint8]uint64: - v2, changed2 := fastpathTV.DecMapUint8Uint64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint8]uint64 + v2, changed = fastpathTV.DecMapUint8Uint64V(*v, true, d) + if changed { *v = v2 } - case map[uint8]uintptr: - fastpathTV.DecMapUint8UintptrV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint8UintptrV(v, false, d) case *map[uint8]uintptr: - v2, changed2 := fastpathTV.DecMapUint8UintptrV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint8]uintptr + v2, changed = fastpathTV.DecMapUint8UintptrV(*v, true, d) + if changed { *v = v2 } - case map[uint8]int: - fastpathTV.DecMapUint8IntV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint8IntV(v, false, d) case *map[uint8]int: - v2, changed2 := fastpathTV.DecMapUint8IntV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint8]int + v2, changed = fastpathTV.DecMapUint8IntV(*v, true, d) + if changed { *v = v2 } - case map[uint8]int8: - fastpathTV.DecMapUint8Int8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint8Int8V(v, false, d) case *map[uint8]int8: - v2, changed2 := fastpathTV.DecMapUint8Int8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint8]int8 + v2, changed = fastpathTV.DecMapUint8Int8V(*v, true, d) + if changed { *v = v2 } - case map[uint8]int16: - fastpathTV.DecMapUint8Int16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint8Int16V(v, false, d) case *map[uint8]int16: - v2, changed2 := fastpathTV.DecMapUint8Int16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint8]int16 + v2, changed = fastpathTV.DecMapUint8Int16V(*v, true, d) + if changed { *v = v2 } - case map[uint8]int32: - fastpathTV.DecMapUint8Int32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint8Int32V(v, false, d) case *map[uint8]int32: - v2, changed2 := fastpathTV.DecMapUint8Int32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint8]int32 + v2, changed = fastpathTV.DecMapUint8Int32V(*v, true, d) + if changed { *v = v2 } - case map[uint8]int64: - fastpathTV.DecMapUint8Int64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint8Int64V(v, false, d) case *map[uint8]int64: - v2, changed2 := fastpathTV.DecMapUint8Int64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint8]int64 + v2, changed = fastpathTV.DecMapUint8Int64V(*v, true, d) + if changed { *v = v2 } - case map[uint8]float32: - fastpathTV.DecMapUint8Float32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint8Float32V(v, false, d) case *map[uint8]float32: - v2, changed2 := fastpathTV.DecMapUint8Float32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint8]float32 + v2, changed = fastpathTV.DecMapUint8Float32V(*v, true, d) + if changed { *v = v2 } - case map[uint8]float64: - fastpathTV.DecMapUint8Float64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint8Float64V(v, false, d) case *map[uint8]float64: - v2, changed2 := fastpathTV.DecMapUint8Float64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint8]float64 + v2, changed = fastpathTV.DecMapUint8Float64V(*v, true, d) + if changed { *v = v2 } - case map[uint8]bool: - fastpathTV.DecMapUint8BoolV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint8BoolV(v, false, d) case *map[uint8]bool: - v2, changed2 := fastpathTV.DecMapUint8BoolV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint8]bool + v2, changed = fastpathTV.DecMapUint8BoolV(*v, true, d) + if changed { *v = v2 } - - case []uint16: - fastpathTV.DecSliceUint16V(v, fastpathCheckNilFalse, false, d) - case *[]uint16: - v2, changed2 := fastpathTV.DecSliceUint16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { - *v = v2 - } - case map[uint16]interface{}: - fastpathTV.DecMapUint16IntfV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint16IntfV(v, false, d) case *map[uint16]interface{}: - v2, changed2 := fastpathTV.DecMapUint16IntfV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint16]interface{} + v2, changed = fastpathTV.DecMapUint16IntfV(*v, true, d) + if changed { *v = v2 } - case map[uint16]string: - fastpathTV.DecMapUint16StringV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint16StringV(v, false, d) case *map[uint16]string: - v2, changed2 := fastpathTV.DecMapUint16StringV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint16]string + v2, changed = fastpathTV.DecMapUint16StringV(*v, true, d) + if changed { *v = v2 } - case map[uint16]uint: - fastpathTV.DecMapUint16UintV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint16UintV(v, false, d) case *map[uint16]uint: - v2, changed2 := fastpathTV.DecMapUint16UintV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint16]uint + v2, changed = fastpathTV.DecMapUint16UintV(*v, true, d) + if changed { *v = v2 } - case map[uint16]uint8: - fastpathTV.DecMapUint16Uint8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint16Uint8V(v, false, d) case *map[uint16]uint8: - v2, changed2 := fastpathTV.DecMapUint16Uint8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint16]uint8 + v2, changed = fastpathTV.DecMapUint16Uint8V(*v, true, d) + if changed { *v = v2 } - case map[uint16]uint16: - fastpathTV.DecMapUint16Uint16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint16Uint16V(v, false, d) case *map[uint16]uint16: - v2, changed2 := fastpathTV.DecMapUint16Uint16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint16]uint16 + v2, changed = fastpathTV.DecMapUint16Uint16V(*v, true, d) + if changed { *v = v2 } - case map[uint16]uint32: - fastpathTV.DecMapUint16Uint32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint16Uint32V(v, false, d) case *map[uint16]uint32: - v2, changed2 := fastpathTV.DecMapUint16Uint32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint16]uint32 + v2, changed = fastpathTV.DecMapUint16Uint32V(*v, true, d) + if changed { *v = v2 } - case map[uint16]uint64: - fastpathTV.DecMapUint16Uint64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint16Uint64V(v, false, d) case *map[uint16]uint64: - v2, changed2 := fastpathTV.DecMapUint16Uint64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint16]uint64 + v2, changed = fastpathTV.DecMapUint16Uint64V(*v, true, d) + if changed { *v = v2 } - case map[uint16]uintptr: - fastpathTV.DecMapUint16UintptrV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint16UintptrV(v, false, d) case *map[uint16]uintptr: - v2, changed2 := fastpathTV.DecMapUint16UintptrV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint16]uintptr + v2, changed = fastpathTV.DecMapUint16UintptrV(*v, true, d) + if changed { *v = v2 } - case map[uint16]int: - fastpathTV.DecMapUint16IntV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint16IntV(v, false, d) case *map[uint16]int: - v2, changed2 := fastpathTV.DecMapUint16IntV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint16]int + v2, changed = fastpathTV.DecMapUint16IntV(*v, true, d) + if changed { *v = v2 } - case map[uint16]int8: - fastpathTV.DecMapUint16Int8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint16Int8V(v, false, d) case *map[uint16]int8: - v2, changed2 := fastpathTV.DecMapUint16Int8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint16]int8 + v2, changed = fastpathTV.DecMapUint16Int8V(*v, true, d) + if changed { *v = v2 } - case map[uint16]int16: - fastpathTV.DecMapUint16Int16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint16Int16V(v, false, d) case *map[uint16]int16: - v2, changed2 := fastpathTV.DecMapUint16Int16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint16]int16 + v2, changed = fastpathTV.DecMapUint16Int16V(*v, true, d) + if changed { *v = v2 } - case map[uint16]int32: - fastpathTV.DecMapUint16Int32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint16Int32V(v, false, d) case *map[uint16]int32: - v2, changed2 := fastpathTV.DecMapUint16Int32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint16]int32 + v2, changed = fastpathTV.DecMapUint16Int32V(*v, true, d) + if changed { *v = v2 } - case map[uint16]int64: - fastpathTV.DecMapUint16Int64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint16Int64V(v, false, d) case *map[uint16]int64: - v2, changed2 := fastpathTV.DecMapUint16Int64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint16]int64 + v2, changed = fastpathTV.DecMapUint16Int64V(*v, true, d) + if changed { *v = v2 } - case map[uint16]float32: - fastpathTV.DecMapUint16Float32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint16Float32V(v, false, d) case *map[uint16]float32: - v2, changed2 := fastpathTV.DecMapUint16Float32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint16]float32 + v2, changed = fastpathTV.DecMapUint16Float32V(*v, true, d) + if changed { *v = v2 } - case map[uint16]float64: - fastpathTV.DecMapUint16Float64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint16Float64V(v, false, d) case *map[uint16]float64: - v2, changed2 := fastpathTV.DecMapUint16Float64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint16]float64 + v2, changed = fastpathTV.DecMapUint16Float64V(*v, true, d) + if changed { *v = v2 } - case map[uint16]bool: - fastpathTV.DecMapUint16BoolV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint16BoolV(v, false, d) case *map[uint16]bool: - v2, changed2 := fastpathTV.DecMapUint16BoolV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint16]bool + v2, changed = fastpathTV.DecMapUint16BoolV(*v, true, d) + if changed { *v = v2 } - - case []uint32: - fastpathTV.DecSliceUint32V(v, fastpathCheckNilFalse, false, d) - case *[]uint32: - v2, changed2 := fastpathTV.DecSliceUint32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { - *v = v2 - } - case map[uint32]interface{}: - fastpathTV.DecMapUint32IntfV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint32IntfV(v, false, d) case *map[uint32]interface{}: - v2, changed2 := fastpathTV.DecMapUint32IntfV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint32]interface{} + v2, changed = fastpathTV.DecMapUint32IntfV(*v, true, d) + if changed { *v = v2 } - case map[uint32]string: - fastpathTV.DecMapUint32StringV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint32StringV(v, false, d) case *map[uint32]string: - v2, changed2 := fastpathTV.DecMapUint32StringV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint32]string + v2, changed = fastpathTV.DecMapUint32StringV(*v, true, d) + if changed { *v = v2 } - case map[uint32]uint: - fastpathTV.DecMapUint32UintV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint32UintV(v, false, d) case *map[uint32]uint: - v2, changed2 := fastpathTV.DecMapUint32UintV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint32]uint + v2, changed = fastpathTV.DecMapUint32UintV(*v, true, d) + if changed { *v = v2 } - case map[uint32]uint8: - fastpathTV.DecMapUint32Uint8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint32Uint8V(v, false, d) case *map[uint32]uint8: - v2, changed2 := fastpathTV.DecMapUint32Uint8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint32]uint8 + v2, changed = fastpathTV.DecMapUint32Uint8V(*v, true, d) + if changed { *v = v2 } - case map[uint32]uint16: - fastpathTV.DecMapUint32Uint16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint32Uint16V(v, false, d) case *map[uint32]uint16: - v2, changed2 := fastpathTV.DecMapUint32Uint16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint32]uint16 + v2, changed = fastpathTV.DecMapUint32Uint16V(*v, true, d) + if changed { *v = v2 } - case map[uint32]uint32: - fastpathTV.DecMapUint32Uint32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint32Uint32V(v, false, d) case *map[uint32]uint32: - v2, changed2 := fastpathTV.DecMapUint32Uint32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint32]uint32 + v2, changed = fastpathTV.DecMapUint32Uint32V(*v, true, d) + if changed { *v = v2 } - case map[uint32]uint64: - fastpathTV.DecMapUint32Uint64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint32Uint64V(v, false, d) case *map[uint32]uint64: - v2, changed2 := fastpathTV.DecMapUint32Uint64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint32]uint64 + v2, changed = fastpathTV.DecMapUint32Uint64V(*v, true, d) + if changed { *v = v2 } - case map[uint32]uintptr: - fastpathTV.DecMapUint32UintptrV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint32UintptrV(v, false, d) case *map[uint32]uintptr: - v2, changed2 := fastpathTV.DecMapUint32UintptrV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint32]uintptr + v2, changed = fastpathTV.DecMapUint32UintptrV(*v, true, d) + if changed { *v = v2 } - case map[uint32]int: - fastpathTV.DecMapUint32IntV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint32IntV(v, false, d) case *map[uint32]int: - v2, changed2 := fastpathTV.DecMapUint32IntV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint32]int + v2, changed = fastpathTV.DecMapUint32IntV(*v, true, d) + if changed { *v = v2 } - case map[uint32]int8: - fastpathTV.DecMapUint32Int8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint32Int8V(v, false, d) case *map[uint32]int8: - v2, changed2 := fastpathTV.DecMapUint32Int8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint32]int8 + v2, changed = fastpathTV.DecMapUint32Int8V(*v, true, d) + if changed { *v = v2 } - case map[uint32]int16: - fastpathTV.DecMapUint32Int16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint32Int16V(v, false, d) case *map[uint32]int16: - v2, changed2 := fastpathTV.DecMapUint32Int16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint32]int16 + v2, changed = fastpathTV.DecMapUint32Int16V(*v, true, d) + if changed { *v = v2 } - case map[uint32]int32: - fastpathTV.DecMapUint32Int32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint32Int32V(v, false, d) case *map[uint32]int32: - v2, changed2 := fastpathTV.DecMapUint32Int32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint32]int32 + v2, changed = fastpathTV.DecMapUint32Int32V(*v, true, d) + if changed { *v = v2 } - case map[uint32]int64: - fastpathTV.DecMapUint32Int64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint32Int64V(v, false, d) case *map[uint32]int64: - v2, changed2 := fastpathTV.DecMapUint32Int64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint32]int64 + v2, changed = fastpathTV.DecMapUint32Int64V(*v, true, d) + if changed { *v = v2 } - case map[uint32]float32: - fastpathTV.DecMapUint32Float32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint32Float32V(v, false, d) case *map[uint32]float32: - v2, changed2 := fastpathTV.DecMapUint32Float32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint32]float32 + v2, changed = fastpathTV.DecMapUint32Float32V(*v, true, d) + if changed { *v = v2 } - case map[uint32]float64: - fastpathTV.DecMapUint32Float64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint32Float64V(v, false, d) case *map[uint32]float64: - v2, changed2 := fastpathTV.DecMapUint32Float64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint32]float64 + v2, changed = fastpathTV.DecMapUint32Float64V(*v, true, d) + if changed { *v = v2 } - case map[uint32]bool: - fastpathTV.DecMapUint32BoolV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint32BoolV(v, false, d) case *map[uint32]bool: - v2, changed2 := fastpathTV.DecMapUint32BoolV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint32]bool + v2, changed = fastpathTV.DecMapUint32BoolV(*v, true, d) + if changed { *v = v2 } - - case []uint64: - fastpathTV.DecSliceUint64V(v, fastpathCheckNilFalse, false, d) - case *[]uint64: - v2, changed2 := fastpathTV.DecSliceUint64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { - *v = v2 - } - case map[uint64]interface{}: - fastpathTV.DecMapUint64IntfV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint64IntfV(v, false, d) case *map[uint64]interface{}: - v2, changed2 := fastpathTV.DecMapUint64IntfV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint64]interface{} + v2, changed = fastpathTV.DecMapUint64IntfV(*v, true, d) + if changed { *v = v2 } - case map[uint64]string: - fastpathTV.DecMapUint64StringV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint64StringV(v, false, d) case *map[uint64]string: - v2, changed2 := fastpathTV.DecMapUint64StringV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint64]string + v2, changed = fastpathTV.DecMapUint64StringV(*v, true, d) + if changed { *v = v2 } - case map[uint64]uint: - fastpathTV.DecMapUint64UintV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint64UintV(v, false, d) case *map[uint64]uint: - v2, changed2 := fastpathTV.DecMapUint64UintV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint64]uint + v2, changed = fastpathTV.DecMapUint64UintV(*v, true, d) + if changed { *v = v2 } - case map[uint64]uint8: - fastpathTV.DecMapUint64Uint8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint64Uint8V(v, false, d) case *map[uint64]uint8: - v2, changed2 := fastpathTV.DecMapUint64Uint8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint64]uint8 + v2, changed = fastpathTV.DecMapUint64Uint8V(*v, true, d) + if changed { *v = v2 } - case map[uint64]uint16: - fastpathTV.DecMapUint64Uint16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint64Uint16V(v, false, d) case *map[uint64]uint16: - v2, changed2 := fastpathTV.DecMapUint64Uint16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint64]uint16 + v2, changed = fastpathTV.DecMapUint64Uint16V(*v, true, d) + if changed { *v = v2 } - case map[uint64]uint32: - fastpathTV.DecMapUint64Uint32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint64Uint32V(v, false, d) case *map[uint64]uint32: - v2, changed2 := fastpathTV.DecMapUint64Uint32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint64]uint32 + v2, changed = fastpathTV.DecMapUint64Uint32V(*v, true, d) + if changed { *v = v2 } - case map[uint64]uint64: - fastpathTV.DecMapUint64Uint64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint64Uint64V(v, false, d) case *map[uint64]uint64: - v2, changed2 := fastpathTV.DecMapUint64Uint64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint64]uint64 + v2, changed = fastpathTV.DecMapUint64Uint64V(*v, true, d) + if changed { *v = v2 } - case map[uint64]uintptr: - fastpathTV.DecMapUint64UintptrV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint64UintptrV(v, false, d) case *map[uint64]uintptr: - v2, changed2 := fastpathTV.DecMapUint64UintptrV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint64]uintptr + v2, changed = fastpathTV.DecMapUint64UintptrV(*v, true, d) + if changed { *v = v2 } - case map[uint64]int: - fastpathTV.DecMapUint64IntV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint64IntV(v, false, d) case *map[uint64]int: - v2, changed2 := fastpathTV.DecMapUint64IntV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint64]int + v2, changed = fastpathTV.DecMapUint64IntV(*v, true, d) + if changed { *v = v2 } - case map[uint64]int8: - fastpathTV.DecMapUint64Int8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint64Int8V(v, false, d) case *map[uint64]int8: - v2, changed2 := fastpathTV.DecMapUint64Int8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint64]int8 + v2, changed = fastpathTV.DecMapUint64Int8V(*v, true, d) + if changed { *v = v2 } - case map[uint64]int16: - fastpathTV.DecMapUint64Int16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint64Int16V(v, false, d) case *map[uint64]int16: - v2, changed2 := fastpathTV.DecMapUint64Int16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint64]int16 + v2, changed = fastpathTV.DecMapUint64Int16V(*v, true, d) + if changed { *v = v2 } - case map[uint64]int32: - fastpathTV.DecMapUint64Int32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint64Int32V(v, false, d) case *map[uint64]int32: - v2, changed2 := fastpathTV.DecMapUint64Int32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint64]int32 + v2, changed = fastpathTV.DecMapUint64Int32V(*v, true, d) + if changed { *v = v2 } - case map[uint64]int64: - fastpathTV.DecMapUint64Int64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint64Int64V(v, false, d) case *map[uint64]int64: - v2, changed2 := fastpathTV.DecMapUint64Int64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint64]int64 + v2, changed = fastpathTV.DecMapUint64Int64V(*v, true, d) + if changed { *v = v2 } - case map[uint64]float32: - fastpathTV.DecMapUint64Float32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint64Float32V(v, false, d) case *map[uint64]float32: - v2, changed2 := fastpathTV.DecMapUint64Float32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint64]float32 + v2, changed = fastpathTV.DecMapUint64Float32V(*v, true, d) + if changed { *v = v2 } - case map[uint64]float64: - fastpathTV.DecMapUint64Float64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint64Float64V(v, false, d) case *map[uint64]float64: - v2, changed2 := fastpathTV.DecMapUint64Float64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint64]float64 + v2, changed = fastpathTV.DecMapUint64Float64V(*v, true, d) + if changed { *v = v2 } - case map[uint64]bool: - fastpathTV.DecMapUint64BoolV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUint64BoolV(v, false, d) case *map[uint64]bool: - v2, changed2 := fastpathTV.DecMapUint64BoolV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uint64]bool + v2, changed = fastpathTV.DecMapUint64BoolV(*v, true, d) + if changed { *v = v2 } - - case []uintptr: - fastpathTV.DecSliceUintptrV(v, fastpathCheckNilFalse, false, d) - case *[]uintptr: - v2, changed2 := fastpathTV.DecSliceUintptrV(*v, fastpathCheckNilFalse, true, d) - if changed2 { - *v = v2 - } - case map[uintptr]interface{}: - fastpathTV.DecMapUintptrIntfV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintptrIntfV(v, false, d) case *map[uintptr]interface{}: - v2, changed2 := fastpathTV.DecMapUintptrIntfV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uintptr]interface{} + v2, changed = fastpathTV.DecMapUintptrIntfV(*v, true, d) + if changed { *v = v2 } - case map[uintptr]string: - fastpathTV.DecMapUintptrStringV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintptrStringV(v, false, d) case *map[uintptr]string: - v2, changed2 := fastpathTV.DecMapUintptrStringV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uintptr]string + v2, changed = fastpathTV.DecMapUintptrStringV(*v, true, d) + if changed { *v = v2 } - case map[uintptr]uint: - fastpathTV.DecMapUintptrUintV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintptrUintV(v, false, d) case *map[uintptr]uint: - v2, changed2 := fastpathTV.DecMapUintptrUintV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uintptr]uint + v2, changed = fastpathTV.DecMapUintptrUintV(*v, true, d) + if changed { *v = v2 } - case map[uintptr]uint8: - fastpathTV.DecMapUintptrUint8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintptrUint8V(v, false, d) case *map[uintptr]uint8: - v2, changed2 := fastpathTV.DecMapUintptrUint8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uintptr]uint8 + v2, changed = fastpathTV.DecMapUintptrUint8V(*v, true, d) + if changed { *v = v2 } - case map[uintptr]uint16: - fastpathTV.DecMapUintptrUint16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintptrUint16V(v, false, d) case *map[uintptr]uint16: - v2, changed2 := fastpathTV.DecMapUintptrUint16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uintptr]uint16 + v2, changed = fastpathTV.DecMapUintptrUint16V(*v, true, d) + if changed { *v = v2 } - case map[uintptr]uint32: - fastpathTV.DecMapUintptrUint32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintptrUint32V(v, false, d) case *map[uintptr]uint32: - v2, changed2 := fastpathTV.DecMapUintptrUint32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uintptr]uint32 + v2, changed = fastpathTV.DecMapUintptrUint32V(*v, true, d) + if changed { *v = v2 } - case map[uintptr]uint64: - fastpathTV.DecMapUintptrUint64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintptrUint64V(v, false, d) case *map[uintptr]uint64: - v2, changed2 := fastpathTV.DecMapUintptrUint64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uintptr]uint64 + v2, changed = fastpathTV.DecMapUintptrUint64V(*v, true, d) + if changed { *v = v2 } - case map[uintptr]uintptr: - fastpathTV.DecMapUintptrUintptrV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintptrUintptrV(v, false, d) case *map[uintptr]uintptr: - v2, changed2 := fastpathTV.DecMapUintptrUintptrV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uintptr]uintptr + v2, changed = fastpathTV.DecMapUintptrUintptrV(*v, true, d) + if changed { *v = v2 } - case map[uintptr]int: - fastpathTV.DecMapUintptrIntV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintptrIntV(v, false, d) case *map[uintptr]int: - v2, changed2 := fastpathTV.DecMapUintptrIntV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uintptr]int + v2, changed = fastpathTV.DecMapUintptrIntV(*v, true, d) + if changed { *v = v2 } - case map[uintptr]int8: - fastpathTV.DecMapUintptrInt8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintptrInt8V(v, false, d) case *map[uintptr]int8: - v2, changed2 := fastpathTV.DecMapUintptrInt8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uintptr]int8 + v2, changed = fastpathTV.DecMapUintptrInt8V(*v, true, d) + if changed { *v = v2 } - case map[uintptr]int16: - fastpathTV.DecMapUintptrInt16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintptrInt16V(v, false, d) case *map[uintptr]int16: - v2, changed2 := fastpathTV.DecMapUintptrInt16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uintptr]int16 + v2, changed = fastpathTV.DecMapUintptrInt16V(*v, true, d) + if changed { *v = v2 } - case map[uintptr]int32: - fastpathTV.DecMapUintptrInt32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintptrInt32V(v, false, d) case *map[uintptr]int32: - v2, changed2 := fastpathTV.DecMapUintptrInt32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uintptr]int32 + v2, changed = fastpathTV.DecMapUintptrInt32V(*v, true, d) + if changed { *v = v2 } - case map[uintptr]int64: - fastpathTV.DecMapUintptrInt64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintptrInt64V(v, false, d) case *map[uintptr]int64: - v2, changed2 := fastpathTV.DecMapUintptrInt64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uintptr]int64 + v2, changed = fastpathTV.DecMapUintptrInt64V(*v, true, d) + if changed { *v = v2 } - case map[uintptr]float32: - fastpathTV.DecMapUintptrFloat32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintptrFloat32V(v, false, d) case *map[uintptr]float32: - v2, changed2 := fastpathTV.DecMapUintptrFloat32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uintptr]float32 + v2, changed = fastpathTV.DecMapUintptrFloat32V(*v, true, d) + if changed { *v = v2 } - case map[uintptr]float64: - fastpathTV.DecMapUintptrFloat64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintptrFloat64V(v, false, d) case *map[uintptr]float64: - v2, changed2 := fastpathTV.DecMapUintptrFloat64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uintptr]float64 + v2, changed = fastpathTV.DecMapUintptrFloat64V(*v, true, d) + if changed { *v = v2 } - case map[uintptr]bool: - fastpathTV.DecMapUintptrBoolV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapUintptrBoolV(v, false, d) case *map[uintptr]bool: - v2, changed2 := fastpathTV.DecMapUintptrBoolV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[uintptr]bool + v2, changed = fastpathTV.DecMapUintptrBoolV(*v, true, d) + if changed { *v = v2 } - - case []int: - fastpathTV.DecSliceIntV(v, fastpathCheckNilFalse, false, d) - case *[]int: - v2, changed2 := fastpathTV.DecSliceIntV(*v, fastpathCheckNilFalse, true, d) - if changed2 { - *v = v2 - } - case map[int]interface{}: - fastpathTV.DecMapIntIntfV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntIntfV(v, false, d) case *map[int]interface{}: - v2, changed2 := fastpathTV.DecMapIntIntfV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int]interface{} + v2, changed = fastpathTV.DecMapIntIntfV(*v, true, d) + if changed { *v = v2 } - case map[int]string: - fastpathTV.DecMapIntStringV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntStringV(v, false, d) case *map[int]string: - v2, changed2 := fastpathTV.DecMapIntStringV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int]string + v2, changed = fastpathTV.DecMapIntStringV(*v, true, d) + if changed { *v = v2 } - case map[int]uint: - fastpathTV.DecMapIntUintV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntUintV(v, false, d) case *map[int]uint: - v2, changed2 := fastpathTV.DecMapIntUintV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int]uint + v2, changed = fastpathTV.DecMapIntUintV(*v, true, d) + if changed { *v = v2 } - case map[int]uint8: - fastpathTV.DecMapIntUint8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntUint8V(v, false, d) case *map[int]uint8: - v2, changed2 := fastpathTV.DecMapIntUint8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int]uint8 + v2, changed = fastpathTV.DecMapIntUint8V(*v, true, d) + if changed { *v = v2 } - case map[int]uint16: - fastpathTV.DecMapIntUint16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntUint16V(v, false, d) case *map[int]uint16: - v2, changed2 := fastpathTV.DecMapIntUint16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int]uint16 + v2, changed = fastpathTV.DecMapIntUint16V(*v, true, d) + if changed { *v = v2 } - case map[int]uint32: - fastpathTV.DecMapIntUint32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntUint32V(v, false, d) case *map[int]uint32: - v2, changed2 := fastpathTV.DecMapIntUint32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int]uint32 + v2, changed = fastpathTV.DecMapIntUint32V(*v, true, d) + if changed { *v = v2 } - case map[int]uint64: - fastpathTV.DecMapIntUint64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntUint64V(v, false, d) case *map[int]uint64: - v2, changed2 := fastpathTV.DecMapIntUint64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int]uint64 + v2, changed = fastpathTV.DecMapIntUint64V(*v, true, d) + if changed { *v = v2 } - case map[int]uintptr: - fastpathTV.DecMapIntUintptrV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntUintptrV(v, false, d) case *map[int]uintptr: - v2, changed2 := fastpathTV.DecMapIntUintptrV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int]uintptr + v2, changed = fastpathTV.DecMapIntUintptrV(*v, true, d) + if changed { *v = v2 } - case map[int]int: - fastpathTV.DecMapIntIntV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntIntV(v, false, d) case *map[int]int: - v2, changed2 := fastpathTV.DecMapIntIntV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int]int + v2, changed = fastpathTV.DecMapIntIntV(*v, true, d) + if changed { *v = v2 } - case map[int]int8: - fastpathTV.DecMapIntInt8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntInt8V(v, false, d) case *map[int]int8: - v2, changed2 := fastpathTV.DecMapIntInt8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int]int8 + v2, changed = fastpathTV.DecMapIntInt8V(*v, true, d) + if changed { *v = v2 } - case map[int]int16: - fastpathTV.DecMapIntInt16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntInt16V(v, false, d) case *map[int]int16: - v2, changed2 := fastpathTV.DecMapIntInt16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int]int16 + v2, changed = fastpathTV.DecMapIntInt16V(*v, true, d) + if changed { *v = v2 } - case map[int]int32: - fastpathTV.DecMapIntInt32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntInt32V(v, false, d) case *map[int]int32: - v2, changed2 := fastpathTV.DecMapIntInt32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int]int32 + v2, changed = fastpathTV.DecMapIntInt32V(*v, true, d) + if changed { *v = v2 } - case map[int]int64: - fastpathTV.DecMapIntInt64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntInt64V(v, false, d) case *map[int]int64: - v2, changed2 := fastpathTV.DecMapIntInt64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int]int64 + v2, changed = fastpathTV.DecMapIntInt64V(*v, true, d) + if changed { *v = v2 } - case map[int]float32: - fastpathTV.DecMapIntFloat32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntFloat32V(v, false, d) case *map[int]float32: - v2, changed2 := fastpathTV.DecMapIntFloat32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int]float32 + v2, changed = fastpathTV.DecMapIntFloat32V(*v, true, d) + if changed { *v = v2 } - case map[int]float64: - fastpathTV.DecMapIntFloat64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntFloat64V(v, false, d) case *map[int]float64: - v2, changed2 := fastpathTV.DecMapIntFloat64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int]float64 + v2, changed = fastpathTV.DecMapIntFloat64V(*v, true, d) + if changed { *v = v2 } - case map[int]bool: - fastpathTV.DecMapIntBoolV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapIntBoolV(v, false, d) case *map[int]bool: - v2, changed2 := fastpathTV.DecMapIntBoolV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int]bool + v2, changed = fastpathTV.DecMapIntBoolV(*v, true, d) + if changed { *v = v2 } - - case []int8: - fastpathTV.DecSliceInt8V(v, fastpathCheckNilFalse, false, d) - case *[]int8: - v2, changed2 := fastpathTV.DecSliceInt8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { - *v = v2 - } - case map[int8]interface{}: - fastpathTV.DecMapInt8IntfV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt8IntfV(v, false, d) case *map[int8]interface{}: - v2, changed2 := fastpathTV.DecMapInt8IntfV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int8]interface{} + v2, changed = fastpathTV.DecMapInt8IntfV(*v, true, d) + if changed { *v = v2 } - case map[int8]string: - fastpathTV.DecMapInt8StringV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt8StringV(v, false, d) case *map[int8]string: - v2, changed2 := fastpathTV.DecMapInt8StringV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int8]string + v2, changed = fastpathTV.DecMapInt8StringV(*v, true, d) + if changed { *v = v2 } - case map[int8]uint: - fastpathTV.DecMapInt8UintV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt8UintV(v, false, d) case *map[int8]uint: - v2, changed2 := fastpathTV.DecMapInt8UintV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int8]uint + v2, changed = fastpathTV.DecMapInt8UintV(*v, true, d) + if changed { *v = v2 } - case map[int8]uint8: - fastpathTV.DecMapInt8Uint8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt8Uint8V(v, false, d) case *map[int8]uint8: - v2, changed2 := fastpathTV.DecMapInt8Uint8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int8]uint8 + v2, changed = fastpathTV.DecMapInt8Uint8V(*v, true, d) + if changed { *v = v2 } - case map[int8]uint16: - fastpathTV.DecMapInt8Uint16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt8Uint16V(v, false, d) case *map[int8]uint16: - v2, changed2 := fastpathTV.DecMapInt8Uint16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int8]uint16 + v2, changed = fastpathTV.DecMapInt8Uint16V(*v, true, d) + if changed { *v = v2 } - case map[int8]uint32: - fastpathTV.DecMapInt8Uint32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt8Uint32V(v, false, d) case *map[int8]uint32: - v2, changed2 := fastpathTV.DecMapInt8Uint32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int8]uint32 + v2, changed = fastpathTV.DecMapInt8Uint32V(*v, true, d) + if changed { *v = v2 } - case map[int8]uint64: - fastpathTV.DecMapInt8Uint64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt8Uint64V(v, false, d) case *map[int8]uint64: - v2, changed2 := fastpathTV.DecMapInt8Uint64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int8]uint64 + v2, changed = fastpathTV.DecMapInt8Uint64V(*v, true, d) + if changed { *v = v2 } - case map[int8]uintptr: - fastpathTV.DecMapInt8UintptrV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt8UintptrV(v, false, d) case *map[int8]uintptr: - v2, changed2 := fastpathTV.DecMapInt8UintptrV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int8]uintptr + v2, changed = fastpathTV.DecMapInt8UintptrV(*v, true, d) + if changed { *v = v2 } - case map[int8]int: - fastpathTV.DecMapInt8IntV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt8IntV(v, false, d) case *map[int8]int: - v2, changed2 := fastpathTV.DecMapInt8IntV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int8]int + v2, changed = fastpathTV.DecMapInt8IntV(*v, true, d) + if changed { *v = v2 } - case map[int8]int8: - fastpathTV.DecMapInt8Int8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt8Int8V(v, false, d) case *map[int8]int8: - v2, changed2 := fastpathTV.DecMapInt8Int8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int8]int8 + v2, changed = fastpathTV.DecMapInt8Int8V(*v, true, d) + if changed { *v = v2 } - case map[int8]int16: - fastpathTV.DecMapInt8Int16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt8Int16V(v, false, d) case *map[int8]int16: - v2, changed2 := fastpathTV.DecMapInt8Int16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int8]int16 + v2, changed = fastpathTV.DecMapInt8Int16V(*v, true, d) + if changed { *v = v2 } - case map[int8]int32: - fastpathTV.DecMapInt8Int32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt8Int32V(v, false, d) case *map[int8]int32: - v2, changed2 := fastpathTV.DecMapInt8Int32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int8]int32 + v2, changed = fastpathTV.DecMapInt8Int32V(*v, true, d) + if changed { *v = v2 } - case map[int8]int64: - fastpathTV.DecMapInt8Int64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt8Int64V(v, false, d) case *map[int8]int64: - v2, changed2 := fastpathTV.DecMapInt8Int64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int8]int64 + v2, changed = fastpathTV.DecMapInt8Int64V(*v, true, d) + if changed { *v = v2 } - case map[int8]float32: - fastpathTV.DecMapInt8Float32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt8Float32V(v, false, d) case *map[int8]float32: - v2, changed2 := fastpathTV.DecMapInt8Float32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int8]float32 + v2, changed = fastpathTV.DecMapInt8Float32V(*v, true, d) + if changed { *v = v2 } - case map[int8]float64: - fastpathTV.DecMapInt8Float64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt8Float64V(v, false, d) case *map[int8]float64: - v2, changed2 := fastpathTV.DecMapInt8Float64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int8]float64 + v2, changed = fastpathTV.DecMapInt8Float64V(*v, true, d) + if changed { *v = v2 } - case map[int8]bool: - fastpathTV.DecMapInt8BoolV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt8BoolV(v, false, d) case *map[int8]bool: - v2, changed2 := fastpathTV.DecMapInt8BoolV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int8]bool + v2, changed = fastpathTV.DecMapInt8BoolV(*v, true, d) + if changed { *v = v2 } - - case []int16: - fastpathTV.DecSliceInt16V(v, fastpathCheckNilFalse, false, d) - case *[]int16: - v2, changed2 := fastpathTV.DecSliceInt16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { - *v = v2 - } - case map[int16]interface{}: - fastpathTV.DecMapInt16IntfV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt16IntfV(v, false, d) case *map[int16]interface{}: - v2, changed2 := fastpathTV.DecMapInt16IntfV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int16]interface{} + v2, changed = fastpathTV.DecMapInt16IntfV(*v, true, d) + if changed { *v = v2 } - case map[int16]string: - fastpathTV.DecMapInt16StringV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt16StringV(v, false, d) case *map[int16]string: - v2, changed2 := fastpathTV.DecMapInt16StringV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int16]string + v2, changed = fastpathTV.DecMapInt16StringV(*v, true, d) + if changed { *v = v2 } - case map[int16]uint: - fastpathTV.DecMapInt16UintV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt16UintV(v, false, d) case *map[int16]uint: - v2, changed2 := fastpathTV.DecMapInt16UintV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int16]uint + v2, changed = fastpathTV.DecMapInt16UintV(*v, true, d) + if changed { *v = v2 } - case map[int16]uint8: - fastpathTV.DecMapInt16Uint8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt16Uint8V(v, false, d) case *map[int16]uint8: - v2, changed2 := fastpathTV.DecMapInt16Uint8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int16]uint8 + v2, changed = fastpathTV.DecMapInt16Uint8V(*v, true, d) + if changed { *v = v2 } - case map[int16]uint16: - fastpathTV.DecMapInt16Uint16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt16Uint16V(v, false, d) case *map[int16]uint16: - v2, changed2 := fastpathTV.DecMapInt16Uint16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int16]uint16 + v2, changed = fastpathTV.DecMapInt16Uint16V(*v, true, d) + if changed { *v = v2 } - case map[int16]uint32: - fastpathTV.DecMapInt16Uint32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt16Uint32V(v, false, d) case *map[int16]uint32: - v2, changed2 := fastpathTV.DecMapInt16Uint32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int16]uint32 + v2, changed = fastpathTV.DecMapInt16Uint32V(*v, true, d) + if changed { *v = v2 } - case map[int16]uint64: - fastpathTV.DecMapInt16Uint64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt16Uint64V(v, false, d) case *map[int16]uint64: - v2, changed2 := fastpathTV.DecMapInt16Uint64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int16]uint64 + v2, changed = fastpathTV.DecMapInt16Uint64V(*v, true, d) + if changed { *v = v2 } - case map[int16]uintptr: - fastpathTV.DecMapInt16UintptrV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt16UintptrV(v, false, d) case *map[int16]uintptr: - v2, changed2 := fastpathTV.DecMapInt16UintptrV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int16]uintptr + v2, changed = fastpathTV.DecMapInt16UintptrV(*v, true, d) + if changed { *v = v2 } - case map[int16]int: - fastpathTV.DecMapInt16IntV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt16IntV(v, false, d) case *map[int16]int: - v2, changed2 := fastpathTV.DecMapInt16IntV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int16]int + v2, changed = fastpathTV.DecMapInt16IntV(*v, true, d) + if changed { *v = v2 } - case map[int16]int8: - fastpathTV.DecMapInt16Int8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt16Int8V(v, false, d) case *map[int16]int8: - v2, changed2 := fastpathTV.DecMapInt16Int8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int16]int8 + v2, changed = fastpathTV.DecMapInt16Int8V(*v, true, d) + if changed { *v = v2 } - case map[int16]int16: - fastpathTV.DecMapInt16Int16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt16Int16V(v, false, d) case *map[int16]int16: - v2, changed2 := fastpathTV.DecMapInt16Int16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int16]int16 + v2, changed = fastpathTV.DecMapInt16Int16V(*v, true, d) + if changed { *v = v2 } - case map[int16]int32: - fastpathTV.DecMapInt16Int32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt16Int32V(v, false, d) case *map[int16]int32: - v2, changed2 := fastpathTV.DecMapInt16Int32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int16]int32 + v2, changed = fastpathTV.DecMapInt16Int32V(*v, true, d) + if changed { *v = v2 } - case map[int16]int64: - fastpathTV.DecMapInt16Int64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt16Int64V(v, false, d) case *map[int16]int64: - v2, changed2 := fastpathTV.DecMapInt16Int64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int16]int64 + v2, changed = fastpathTV.DecMapInt16Int64V(*v, true, d) + if changed { *v = v2 } - case map[int16]float32: - fastpathTV.DecMapInt16Float32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt16Float32V(v, false, d) case *map[int16]float32: - v2, changed2 := fastpathTV.DecMapInt16Float32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int16]float32 + v2, changed = fastpathTV.DecMapInt16Float32V(*v, true, d) + if changed { *v = v2 } - case map[int16]float64: - fastpathTV.DecMapInt16Float64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt16Float64V(v, false, d) case *map[int16]float64: - v2, changed2 := fastpathTV.DecMapInt16Float64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int16]float64 + v2, changed = fastpathTV.DecMapInt16Float64V(*v, true, d) + if changed { *v = v2 } - case map[int16]bool: - fastpathTV.DecMapInt16BoolV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt16BoolV(v, false, d) case *map[int16]bool: - v2, changed2 := fastpathTV.DecMapInt16BoolV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int16]bool + v2, changed = fastpathTV.DecMapInt16BoolV(*v, true, d) + if changed { *v = v2 } - - case []int32: - fastpathTV.DecSliceInt32V(v, fastpathCheckNilFalse, false, d) - case *[]int32: - v2, changed2 := fastpathTV.DecSliceInt32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { - *v = v2 - } - case map[int32]interface{}: - fastpathTV.DecMapInt32IntfV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt32IntfV(v, false, d) case *map[int32]interface{}: - v2, changed2 := fastpathTV.DecMapInt32IntfV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int32]interface{} + v2, changed = fastpathTV.DecMapInt32IntfV(*v, true, d) + if changed { *v = v2 } - case map[int32]string: - fastpathTV.DecMapInt32StringV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt32StringV(v, false, d) case *map[int32]string: - v2, changed2 := fastpathTV.DecMapInt32StringV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int32]string + v2, changed = fastpathTV.DecMapInt32StringV(*v, true, d) + if changed { *v = v2 } - case map[int32]uint: - fastpathTV.DecMapInt32UintV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt32UintV(v, false, d) case *map[int32]uint: - v2, changed2 := fastpathTV.DecMapInt32UintV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int32]uint + v2, changed = fastpathTV.DecMapInt32UintV(*v, true, d) + if changed { *v = v2 } - case map[int32]uint8: - fastpathTV.DecMapInt32Uint8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt32Uint8V(v, false, d) case *map[int32]uint8: - v2, changed2 := fastpathTV.DecMapInt32Uint8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int32]uint8 + v2, changed = fastpathTV.DecMapInt32Uint8V(*v, true, d) + if changed { *v = v2 } - case map[int32]uint16: - fastpathTV.DecMapInt32Uint16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt32Uint16V(v, false, d) case *map[int32]uint16: - v2, changed2 := fastpathTV.DecMapInt32Uint16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int32]uint16 + v2, changed = fastpathTV.DecMapInt32Uint16V(*v, true, d) + if changed { *v = v2 } - case map[int32]uint32: - fastpathTV.DecMapInt32Uint32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt32Uint32V(v, false, d) case *map[int32]uint32: - v2, changed2 := fastpathTV.DecMapInt32Uint32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int32]uint32 + v2, changed = fastpathTV.DecMapInt32Uint32V(*v, true, d) + if changed { *v = v2 } - case map[int32]uint64: - fastpathTV.DecMapInt32Uint64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt32Uint64V(v, false, d) case *map[int32]uint64: - v2, changed2 := fastpathTV.DecMapInt32Uint64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int32]uint64 + v2, changed = fastpathTV.DecMapInt32Uint64V(*v, true, d) + if changed { *v = v2 } - case map[int32]uintptr: - fastpathTV.DecMapInt32UintptrV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt32UintptrV(v, false, d) case *map[int32]uintptr: - v2, changed2 := fastpathTV.DecMapInt32UintptrV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int32]uintptr + v2, changed = fastpathTV.DecMapInt32UintptrV(*v, true, d) + if changed { *v = v2 } - case map[int32]int: - fastpathTV.DecMapInt32IntV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt32IntV(v, false, d) case *map[int32]int: - v2, changed2 := fastpathTV.DecMapInt32IntV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int32]int + v2, changed = fastpathTV.DecMapInt32IntV(*v, true, d) + if changed { *v = v2 } - case map[int32]int8: - fastpathTV.DecMapInt32Int8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt32Int8V(v, false, d) case *map[int32]int8: - v2, changed2 := fastpathTV.DecMapInt32Int8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int32]int8 + v2, changed = fastpathTV.DecMapInt32Int8V(*v, true, d) + if changed { *v = v2 } - case map[int32]int16: - fastpathTV.DecMapInt32Int16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt32Int16V(v, false, d) case *map[int32]int16: - v2, changed2 := fastpathTV.DecMapInt32Int16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int32]int16 + v2, changed = fastpathTV.DecMapInt32Int16V(*v, true, d) + if changed { *v = v2 } - case map[int32]int32: - fastpathTV.DecMapInt32Int32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt32Int32V(v, false, d) case *map[int32]int32: - v2, changed2 := fastpathTV.DecMapInt32Int32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int32]int32 + v2, changed = fastpathTV.DecMapInt32Int32V(*v, true, d) + if changed { *v = v2 } - case map[int32]int64: - fastpathTV.DecMapInt32Int64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt32Int64V(v, false, d) case *map[int32]int64: - v2, changed2 := fastpathTV.DecMapInt32Int64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int32]int64 + v2, changed = fastpathTV.DecMapInt32Int64V(*v, true, d) + if changed { *v = v2 } - case map[int32]float32: - fastpathTV.DecMapInt32Float32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt32Float32V(v, false, d) case *map[int32]float32: - v2, changed2 := fastpathTV.DecMapInt32Float32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int32]float32 + v2, changed = fastpathTV.DecMapInt32Float32V(*v, true, d) + if changed { *v = v2 } - case map[int32]float64: - fastpathTV.DecMapInt32Float64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt32Float64V(v, false, d) case *map[int32]float64: - v2, changed2 := fastpathTV.DecMapInt32Float64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int32]float64 + v2, changed = fastpathTV.DecMapInt32Float64V(*v, true, d) + if changed { *v = v2 } - case map[int32]bool: - fastpathTV.DecMapInt32BoolV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt32BoolV(v, false, d) case *map[int32]bool: - v2, changed2 := fastpathTV.DecMapInt32BoolV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int32]bool + v2, changed = fastpathTV.DecMapInt32BoolV(*v, true, d) + if changed { *v = v2 } - - case []int64: - fastpathTV.DecSliceInt64V(v, fastpathCheckNilFalse, false, d) - case *[]int64: - v2, changed2 := fastpathTV.DecSliceInt64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { - *v = v2 - } - case map[int64]interface{}: - fastpathTV.DecMapInt64IntfV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt64IntfV(v, false, d) case *map[int64]interface{}: - v2, changed2 := fastpathTV.DecMapInt64IntfV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int64]interface{} + v2, changed = fastpathTV.DecMapInt64IntfV(*v, true, d) + if changed { *v = v2 } - case map[int64]string: - fastpathTV.DecMapInt64StringV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt64StringV(v, false, d) case *map[int64]string: - v2, changed2 := fastpathTV.DecMapInt64StringV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int64]string + v2, changed = fastpathTV.DecMapInt64StringV(*v, true, d) + if changed { *v = v2 } - case map[int64]uint: - fastpathTV.DecMapInt64UintV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt64UintV(v, false, d) case *map[int64]uint: - v2, changed2 := fastpathTV.DecMapInt64UintV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int64]uint + v2, changed = fastpathTV.DecMapInt64UintV(*v, true, d) + if changed { *v = v2 } - case map[int64]uint8: - fastpathTV.DecMapInt64Uint8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt64Uint8V(v, false, d) case *map[int64]uint8: - v2, changed2 := fastpathTV.DecMapInt64Uint8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int64]uint8 + v2, changed = fastpathTV.DecMapInt64Uint8V(*v, true, d) + if changed { *v = v2 } - case map[int64]uint16: - fastpathTV.DecMapInt64Uint16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt64Uint16V(v, false, d) case *map[int64]uint16: - v2, changed2 := fastpathTV.DecMapInt64Uint16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int64]uint16 + v2, changed = fastpathTV.DecMapInt64Uint16V(*v, true, d) + if changed { *v = v2 } - case map[int64]uint32: - fastpathTV.DecMapInt64Uint32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt64Uint32V(v, false, d) case *map[int64]uint32: - v2, changed2 := fastpathTV.DecMapInt64Uint32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int64]uint32 + v2, changed = fastpathTV.DecMapInt64Uint32V(*v, true, d) + if changed { *v = v2 } - case map[int64]uint64: - fastpathTV.DecMapInt64Uint64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt64Uint64V(v, false, d) case *map[int64]uint64: - v2, changed2 := fastpathTV.DecMapInt64Uint64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int64]uint64 + v2, changed = fastpathTV.DecMapInt64Uint64V(*v, true, d) + if changed { *v = v2 } - case map[int64]uintptr: - fastpathTV.DecMapInt64UintptrV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt64UintptrV(v, false, d) case *map[int64]uintptr: - v2, changed2 := fastpathTV.DecMapInt64UintptrV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int64]uintptr + v2, changed = fastpathTV.DecMapInt64UintptrV(*v, true, d) + if changed { *v = v2 } - case map[int64]int: - fastpathTV.DecMapInt64IntV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt64IntV(v, false, d) case *map[int64]int: - v2, changed2 := fastpathTV.DecMapInt64IntV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int64]int + v2, changed = fastpathTV.DecMapInt64IntV(*v, true, d) + if changed { *v = v2 } - case map[int64]int8: - fastpathTV.DecMapInt64Int8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt64Int8V(v, false, d) case *map[int64]int8: - v2, changed2 := fastpathTV.DecMapInt64Int8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int64]int8 + v2, changed = fastpathTV.DecMapInt64Int8V(*v, true, d) + if changed { *v = v2 } - case map[int64]int16: - fastpathTV.DecMapInt64Int16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt64Int16V(v, false, d) case *map[int64]int16: - v2, changed2 := fastpathTV.DecMapInt64Int16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int64]int16 + v2, changed = fastpathTV.DecMapInt64Int16V(*v, true, d) + if changed { *v = v2 } - case map[int64]int32: - fastpathTV.DecMapInt64Int32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt64Int32V(v, false, d) case *map[int64]int32: - v2, changed2 := fastpathTV.DecMapInt64Int32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int64]int32 + v2, changed = fastpathTV.DecMapInt64Int32V(*v, true, d) + if changed { *v = v2 } - case map[int64]int64: - fastpathTV.DecMapInt64Int64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt64Int64V(v, false, d) case *map[int64]int64: - v2, changed2 := fastpathTV.DecMapInt64Int64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int64]int64 + v2, changed = fastpathTV.DecMapInt64Int64V(*v, true, d) + if changed { *v = v2 } - case map[int64]float32: - fastpathTV.DecMapInt64Float32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt64Float32V(v, false, d) case *map[int64]float32: - v2, changed2 := fastpathTV.DecMapInt64Float32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int64]float32 + v2, changed = fastpathTV.DecMapInt64Float32V(*v, true, d) + if changed { *v = v2 } - case map[int64]float64: - fastpathTV.DecMapInt64Float64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt64Float64V(v, false, d) case *map[int64]float64: - v2, changed2 := fastpathTV.DecMapInt64Float64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int64]float64 + v2, changed = fastpathTV.DecMapInt64Float64V(*v, true, d) + if changed { *v = v2 } - case map[int64]bool: - fastpathTV.DecMapInt64BoolV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapInt64BoolV(v, false, d) case *map[int64]bool: - v2, changed2 := fastpathTV.DecMapInt64BoolV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[int64]bool + v2, changed = fastpathTV.DecMapInt64BoolV(*v, true, d) + if changed { *v = v2 } - - case []bool: - fastpathTV.DecSliceBoolV(v, fastpathCheckNilFalse, false, d) - case *[]bool: - v2, changed2 := fastpathTV.DecSliceBoolV(*v, fastpathCheckNilFalse, true, d) - if changed2 { - *v = v2 - } - case map[bool]interface{}: - fastpathTV.DecMapBoolIntfV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapBoolIntfV(v, false, d) case *map[bool]interface{}: - v2, changed2 := fastpathTV.DecMapBoolIntfV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[bool]interface{} + v2, changed = fastpathTV.DecMapBoolIntfV(*v, true, d) + if changed { *v = v2 } - case map[bool]string: - fastpathTV.DecMapBoolStringV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapBoolStringV(v, false, d) case *map[bool]string: - v2, changed2 := fastpathTV.DecMapBoolStringV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[bool]string + v2, changed = fastpathTV.DecMapBoolStringV(*v, true, d) + if changed { *v = v2 } - case map[bool]uint: - fastpathTV.DecMapBoolUintV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapBoolUintV(v, false, d) case *map[bool]uint: - v2, changed2 := fastpathTV.DecMapBoolUintV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[bool]uint + v2, changed = fastpathTV.DecMapBoolUintV(*v, true, d) + if changed { *v = v2 } - case map[bool]uint8: - fastpathTV.DecMapBoolUint8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapBoolUint8V(v, false, d) case *map[bool]uint8: - v2, changed2 := fastpathTV.DecMapBoolUint8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[bool]uint8 + v2, changed = fastpathTV.DecMapBoolUint8V(*v, true, d) + if changed { *v = v2 } - case map[bool]uint16: - fastpathTV.DecMapBoolUint16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapBoolUint16V(v, false, d) case *map[bool]uint16: - v2, changed2 := fastpathTV.DecMapBoolUint16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[bool]uint16 + v2, changed = fastpathTV.DecMapBoolUint16V(*v, true, d) + if changed { *v = v2 } - case map[bool]uint32: - fastpathTV.DecMapBoolUint32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapBoolUint32V(v, false, d) case *map[bool]uint32: - v2, changed2 := fastpathTV.DecMapBoolUint32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[bool]uint32 + v2, changed = fastpathTV.DecMapBoolUint32V(*v, true, d) + if changed { *v = v2 } - case map[bool]uint64: - fastpathTV.DecMapBoolUint64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapBoolUint64V(v, false, d) case *map[bool]uint64: - v2, changed2 := fastpathTV.DecMapBoolUint64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[bool]uint64 + v2, changed = fastpathTV.DecMapBoolUint64V(*v, true, d) + if changed { *v = v2 } - case map[bool]uintptr: - fastpathTV.DecMapBoolUintptrV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapBoolUintptrV(v, false, d) case *map[bool]uintptr: - v2, changed2 := fastpathTV.DecMapBoolUintptrV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[bool]uintptr + v2, changed = fastpathTV.DecMapBoolUintptrV(*v, true, d) + if changed { *v = v2 } - case map[bool]int: - fastpathTV.DecMapBoolIntV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapBoolIntV(v, false, d) case *map[bool]int: - v2, changed2 := fastpathTV.DecMapBoolIntV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[bool]int + v2, changed = fastpathTV.DecMapBoolIntV(*v, true, d) + if changed { *v = v2 } - case map[bool]int8: - fastpathTV.DecMapBoolInt8V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapBoolInt8V(v, false, d) case *map[bool]int8: - v2, changed2 := fastpathTV.DecMapBoolInt8V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[bool]int8 + v2, changed = fastpathTV.DecMapBoolInt8V(*v, true, d) + if changed { *v = v2 } - case map[bool]int16: - fastpathTV.DecMapBoolInt16V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapBoolInt16V(v, false, d) case *map[bool]int16: - v2, changed2 := fastpathTV.DecMapBoolInt16V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[bool]int16 + v2, changed = fastpathTV.DecMapBoolInt16V(*v, true, d) + if changed { *v = v2 } - case map[bool]int32: - fastpathTV.DecMapBoolInt32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapBoolInt32V(v, false, d) case *map[bool]int32: - v2, changed2 := fastpathTV.DecMapBoolInt32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[bool]int32 + v2, changed = fastpathTV.DecMapBoolInt32V(*v, true, d) + if changed { *v = v2 } - case map[bool]int64: - fastpathTV.DecMapBoolInt64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapBoolInt64V(v, false, d) case *map[bool]int64: - v2, changed2 := fastpathTV.DecMapBoolInt64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[bool]int64 + v2, changed = fastpathTV.DecMapBoolInt64V(*v, true, d) + if changed { *v = v2 } - case map[bool]float32: - fastpathTV.DecMapBoolFloat32V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapBoolFloat32V(v, false, d) case *map[bool]float32: - v2, changed2 := fastpathTV.DecMapBoolFloat32V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[bool]float32 + v2, changed = fastpathTV.DecMapBoolFloat32V(*v, true, d) + if changed { *v = v2 } - case map[bool]float64: - fastpathTV.DecMapBoolFloat64V(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapBoolFloat64V(v, false, d) case *map[bool]float64: - v2, changed2 := fastpathTV.DecMapBoolFloat64V(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[bool]float64 + v2, changed = fastpathTV.DecMapBoolFloat64V(*v, true, d) + if changed { *v = v2 } - case map[bool]bool: - fastpathTV.DecMapBoolBoolV(v, fastpathCheckNilFalse, false, d) + fastpathTV.DecMapBoolBoolV(v, false, d) case *map[bool]bool: - v2, changed2 := fastpathTV.DecMapBoolBoolV(*v, fastpathCheckNilFalse, true, d) - if changed2 { + var v2 map[bool]bool + v2, changed = fastpathTV.DecMapBoolBoolV(*v, true, d) + if changed { *v = v2 } - default: - _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) + _ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4 + return false + } + return true +} + +func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { + switch v := iv.(type) { + + case *[]interface{}: + *v = nil + case *[]string: + *v = nil + case *[]float32: + *v = nil + case *[]float64: + *v = nil + case *[]uint: + *v = nil + case *[]uint8: + *v = nil + case *[]uint16: + *v = nil + case *[]uint32: + *v = nil + case *[]uint64: + *v = nil + case *[]uintptr: + *v = nil + case *[]int: + *v = nil + case *[]int8: + *v = nil + case *[]int16: + *v = nil + case *[]int32: + *v = nil + case *[]int64: + *v = nil + case *[]bool: + *v = nil + + case *map[interface{}]interface{}: + *v = nil + case *map[interface{}]string: + *v = nil + case *map[interface{}]uint: + *v = nil + case *map[interface{}]uint8: + *v = nil + case *map[interface{}]uint16: + *v = nil + case *map[interface{}]uint32: + *v = nil + case *map[interface{}]uint64: + *v = nil + case *map[interface{}]uintptr: + *v = nil + case *map[interface{}]int: + *v = nil + case *map[interface{}]int8: + *v = nil + case *map[interface{}]int16: + *v = nil + case *map[interface{}]int32: + *v = nil + case *map[interface{}]int64: + *v = nil + case *map[interface{}]float32: + *v = nil + case *map[interface{}]float64: + *v = nil + case *map[interface{}]bool: + *v = nil + case *map[string]interface{}: + *v = nil + case *map[string]string: + *v = nil + case *map[string]uint: + *v = nil + case *map[string]uint8: + *v = nil + case *map[string]uint16: + *v = nil + case *map[string]uint32: + *v = nil + case *map[string]uint64: + *v = nil + case *map[string]uintptr: + *v = nil + case *map[string]int: + *v = nil + case *map[string]int8: + *v = nil + case *map[string]int16: + *v = nil + case *map[string]int32: + *v = nil + case *map[string]int64: + *v = nil + case *map[string]float32: + *v = nil + case *map[string]float64: + *v = nil + case *map[string]bool: + *v = nil + case *map[float32]interface{}: + *v = nil + case *map[float32]string: + *v = nil + case *map[float32]uint: + *v = nil + case *map[float32]uint8: + *v = nil + case *map[float32]uint16: + *v = nil + case *map[float32]uint32: + *v = nil + case *map[float32]uint64: + *v = nil + case *map[float32]uintptr: + *v = nil + case *map[float32]int: + *v = nil + case *map[float32]int8: + *v = nil + case *map[float32]int16: + *v = nil + case *map[float32]int32: + *v = nil + case *map[float32]int64: + *v = nil + case *map[float32]float32: + *v = nil + case *map[float32]float64: + *v = nil + case *map[float32]bool: + *v = nil + case *map[float64]interface{}: + *v = nil + case *map[float64]string: + *v = nil + case *map[float64]uint: + *v = nil + case *map[float64]uint8: + *v = nil + case *map[float64]uint16: + *v = nil + case *map[float64]uint32: + *v = nil + case *map[float64]uint64: + *v = nil + case *map[float64]uintptr: + *v = nil + case *map[float64]int: + *v = nil + case *map[float64]int8: + *v = nil + case *map[float64]int16: + *v = nil + case *map[float64]int32: + *v = nil + case *map[float64]int64: + *v = nil + case *map[float64]float32: + *v = nil + case *map[float64]float64: + *v = nil + case *map[float64]bool: + *v = nil + case *map[uint]interface{}: + *v = nil + case *map[uint]string: + *v = nil + case *map[uint]uint: + *v = nil + case *map[uint]uint8: + *v = nil + case *map[uint]uint16: + *v = nil + case *map[uint]uint32: + *v = nil + case *map[uint]uint64: + *v = nil + case *map[uint]uintptr: + *v = nil + case *map[uint]int: + *v = nil + case *map[uint]int8: + *v = nil + case *map[uint]int16: + *v = nil + case *map[uint]int32: + *v = nil + case *map[uint]int64: + *v = nil + case *map[uint]float32: + *v = nil + case *map[uint]float64: + *v = nil + case *map[uint]bool: + *v = nil + case *map[uint8]interface{}: + *v = nil + case *map[uint8]string: + *v = nil + case *map[uint8]uint: + *v = nil + case *map[uint8]uint8: + *v = nil + case *map[uint8]uint16: + *v = nil + case *map[uint8]uint32: + *v = nil + case *map[uint8]uint64: + *v = nil + case *map[uint8]uintptr: + *v = nil + case *map[uint8]int: + *v = nil + case *map[uint8]int8: + *v = nil + case *map[uint8]int16: + *v = nil + case *map[uint8]int32: + *v = nil + case *map[uint8]int64: + *v = nil + case *map[uint8]float32: + *v = nil + case *map[uint8]float64: + *v = nil + case *map[uint8]bool: + *v = nil + case *map[uint16]interface{}: + *v = nil + case *map[uint16]string: + *v = nil + case *map[uint16]uint: + *v = nil + case *map[uint16]uint8: + *v = nil + case *map[uint16]uint16: + *v = nil + case *map[uint16]uint32: + *v = nil + case *map[uint16]uint64: + *v = nil + case *map[uint16]uintptr: + *v = nil + case *map[uint16]int: + *v = nil + case *map[uint16]int8: + *v = nil + case *map[uint16]int16: + *v = nil + case *map[uint16]int32: + *v = nil + case *map[uint16]int64: + *v = nil + case *map[uint16]float32: + *v = nil + case *map[uint16]float64: + *v = nil + case *map[uint16]bool: + *v = nil + case *map[uint32]interface{}: + *v = nil + case *map[uint32]string: + *v = nil + case *map[uint32]uint: + *v = nil + case *map[uint32]uint8: + *v = nil + case *map[uint32]uint16: + *v = nil + case *map[uint32]uint32: + *v = nil + case *map[uint32]uint64: + *v = nil + case *map[uint32]uintptr: + *v = nil + case *map[uint32]int: + *v = nil + case *map[uint32]int8: + *v = nil + case *map[uint32]int16: + *v = nil + case *map[uint32]int32: + *v = nil + case *map[uint32]int64: + *v = nil + case *map[uint32]float32: + *v = nil + case *map[uint32]float64: + *v = nil + case *map[uint32]bool: + *v = nil + case *map[uint64]interface{}: + *v = nil + case *map[uint64]string: + *v = nil + case *map[uint64]uint: + *v = nil + case *map[uint64]uint8: + *v = nil + case *map[uint64]uint16: + *v = nil + case *map[uint64]uint32: + *v = nil + case *map[uint64]uint64: + *v = nil + case *map[uint64]uintptr: + *v = nil + case *map[uint64]int: + *v = nil + case *map[uint64]int8: + *v = nil + case *map[uint64]int16: + *v = nil + case *map[uint64]int32: + *v = nil + case *map[uint64]int64: + *v = nil + case *map[uint64]float32: + *v = nil + case *map[uint64]float64: + *v = nil + case *map[uint64]bool: + *v = nil + case *map[uintptr]interface{}: + *v = nil + case *map[uintptr]string: + *v = nil + case *map[uintptr]uint: + *v = nil + case *map[uintptr]uint8: + *v = nil + case *map[uintptr]uint16: + *v = nil + case *map[uintptr]uint32: + *v = nil + case *map[uintptr]uint64: + *v = nil + case *map[uintptr]uintptr: + *v = nil + case *map[uintptr]int: + *v = nil + case *map[uintptr]int8: + *v = nil + case *map[uintptr]int16: + *v = nil + case *map[uintptr]int32: + *v = nil + case *map[uintptr]int64: + *v = nil + case *map[uintptr]float32: + *v = nil + case *map[uintptr]float64: + *v = nil + case *map[uintptr]bool: + *v = nil + case *map[int]interface{}: + *v = nil + case *map[int]string: + *v = nil + case *map[int]uint: + *v = nil + case *map[int]uint8: + *v = nil + case *map[int]uint16: + *v = nil + case *map[int]uint32: + *v = nil + case *map[int]uint64: + *v = nil + case *map[int]uintptr: + *v = nil + case *map[int]int: + *v = nil + case *map[int]int8: + *v = nil + case *map[int]int16: + *v = nil + case *map[int]int32: + *v = nil + case *map[int]int64: + *v = nil + case *map[int]float32: + *v = nil + case *map[int]float64: + *v = nil + case *map[int]bool: + *v = nil + case *map[int8]interface{}: + *v = nil + case *map[int8]string: + *v = nil + case *map[int8]uint: + *v = nil + case *map[int8]uint8: + *v = nil + case *map[int8]uint16: + *v = nil + case *map[int8]uint32: + *v = nil + case *map[int8]uint64: + *v = nil + case *map[int8]uintptr: + *v = nil + case *map[int8]int: + *v = nil + case *map[int8]int8: + *v = nil + case *map[int8]int16: + *v = nil + case *map[int8]int32: + *v = nil + case *map[int8]int64: + *v = nil + case *map[int8]float32: + *v = nil + case *map[int8]float64: + *v = nil + case *map[int8]bool: + *v = nil + case *map[int16]interface{}: + *v = nil + case *map[int16]string: + *v = nil + case *map[int16]uint: + *v = nil + case *map[int16]uint8: + *v = nil + case *map[int16]uint16: + *v = nil + case *map[int16]uint32: + *v = nil + case *map[int16]uint64: + *v = nil + case *map[int16]uintptr: + *v = nil + case *map[int16]int: + *v = nil + case *map[int16]int8: + *v = nil + case *map[int16]int16: + *v = nil + case *map[int16]int32: + *v = nil + case *map[int16]int64: + *v = nil + case *map[int16]float32: + *v = nil + case *map[int16]float64: + *v = nil + case *map[int16]bool: + *v = nil + case *map[int32]interface{}: + *v = nil + case *map[int32]string: + *v = nil + case *map[int32]uint: + *v = nil + case *map[int32]uint8: + *v = nil + case *map[int32]uint16: + *v = nil + case *map[int32]uint32: + *v = nil + case *map[int32]uint64: + *v = nil + case *map[int32]uintptr: + *v = nil + case *map[int32]int: + *v = nil + case *map[int32]int8: + *v = nil + case *map[int32]int16: + *v = nil + case *map[int32]int32: + *v = nil + case *map[int32]int64: + *v = nil + case *map[int32]float32: + *v = nil + case *map[int32]float64: + *v = nil + case *map[int32]bool: + *v = nil + case *map[int64]interface{}: + *v = nil + case *map[int64]string: + *v = nil + case *map[int64]uint: + *v = nil + case *map[int64]uint8: + *v = nil + case *map[int64]uint16: + *v = nil + case *map[int64]uint32: + *v = nil + case *map[int64]uint64: + *v = nil + case *map[int64]uintptr: + *v = nil + case *map[int64]int: + *v = nil + case *map[int64]int8: + *v = nil + case *map[int64]int16: + *v = nil + case *map[int64]int32: + *v = nil + case *map[int64]int64: + *v = nil + case *map[int64]float32: + *v = nil + case *map[int64]float64: + *v = nil + case *map[int64]bool: + *v = nil + case *map[bool]interface{}: + *v = nil + case *map[bool]string: + *v = nil + case *map[bool]uint: + *v = nil + case *map[bool]uint8: + *v = nil + case *map[bool]uint16: + *v = nil + case *map[bool]uint32: + *v = nil + case *map[bool]uint64: + *v = nil + case *map[bool]uintptr: + *v = nil + case *map[bool]int: + *v = nil + case *map[bool]int8: + *v = nil + case *map[bool]int16: + *v = nil + case *map[bool]int32: + *v = nil + case *map[bool]int64: + *v = nil + case *map[bool]float32: + *v = nil + case *map[bool]float64: + *v = nil + case *map[bool]bool: + *v = nil + default: + _ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4 return false } return true @@ -18123,36 +17721,29 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { // -- -- fast path functions -func (f *decFnInfo) fastpathDecSliceIntfR(rv reflect.Value) { - array := f.seq == seqTypeArray - if !array && rv.CanAddr() { - vp := rv.Addr().Interface().(*[]interface{}) - v, changed := fastpathTV.DecSliceIntfV(*vp, fastpathCheckNilFalse, !array, f.d) +func (d *Decoder) fastpathDecSliceIntfR(f *codecFnInfo, rv reflect.Value) { + if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*[]interface{}) + v, changed := fastpathTV.DecSliceIntfV(*vp, !array, d) if changed { *vp = v } } else { - v := rv.Interface().([]interface{}) - fastpathTV.DecSliceIntfV(v, fastpathCheckNilFalse, false, f.d) + v := rv2i(rv).([]interface{}) + v2, changed := fastpathTV.DecSliceIntfV(v, !array, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } } } - -func (f fastpathT) DecSliceIntfX(vp *[]interface{}, checkNil bool, d *Decoder) { - v, changed := f.DecSliceIntfV(*vp, checkNil, true, d) +func (f fastpathT) DecSliceIntfX(vp *[]interface{}, d *Decoder) { + v, changed := f.DecSliceIntfV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecSliceIntfV(v []interface{}, checkNil bool, canChange bool, d *Decoder) (_ []interface{}, changed bool) { +func (_ fastpathT) DecSliceIntfV(v []interface{}, canChange bool, d *Decoder) (_ []interface{}, changed bool) { dd := d.d - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -18166,127 +17757,89 @@ func (_ fastpathT) DecSliceIntfV(v []interface{}, checkNil bool, canChange bool, slh.End() return v, changed } - - if containerLenS > 0 { - x2read := containerLenS - var xtrunc bool + hasLen := containerLenS > 0 + var xlen int + if hasLen && canChange { if containerLenS > cap(v) { - if canChange { - var xlen int - xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 16) - if xtrunc { - if xlen <= cap(v) { - v = v[:xlen] - } else { - v = make([]interface{}, xlen) - } - } else { - v = make([]interface{}, xlen) - } - changed = true + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 16) + if xlen <= cap(v) { + v = v[:xlen] } else { - d.arrayCannotExpand(len(v), containerLenS) + v = make([]interface{}, xlen) } - x2read = len(v) + changed = true } else if containerLenS != len(v) { - if canChange { - v = v[:containerLenS] - changed = true - } - } - j := 0 - for ; j < x2read; j++ { - slh.ElemContainerState(j) - d.decode(&v[j]) - } - if xtrunc { - for ; j < containerLenS; j++ { - v = append(v, nil) - slh.ElemContainerState(j) - d.decode(&v[j]) - } - } else if !canChange { - for ; j < containerLenS; j++ { - slh.ElemContainerState(j) - d.swallow() - } - } - } else { - breakFound := dd.CheckBreak() - if breakFound { - if canChange { - if v == nil { - v = []interface{}{} - } else if len(v) != 0 { - v = v[:0] - } - changed = true - } - slh.End() - return v, changed - } - if cap(v) == 0 { - v = make([]interface{}, 1, 4) + v = v[:containerLenS] changed = true } - j := 0 - for ; !breakFound; j++ { - if j >= len(v) { - if canChange { - v = append(v, nil) - changed = true - } else { - d.arrayCannotExpand(len(v), j+1) - } - } - slh.ElemContainerState(j) - if j < len(v) { - d.decode(&v[j]) - + } + j := 0 + for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + if j == 0 && len(v) == 0 && canChange { + if hasLen { + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 16) } else { - d.swallow() + xlen = 8 } - breakFound = dd.CheckBreak() + v = make([]interface{}, xlen) + changed = true } - if canChange && j < len(v) { + // if indefinite, etc, then expand the slice if necessary + var decodeIntoBlank bool + if j >= len(v) { + if canChange { + v = append(v, nil) + changed = true + } else { + d.arrayCannotExpand(len(v), j+1) + decodeIntoBlank = true + } + } + slh.ElemContainerState(j) + if decodeIntoBlank { + d.swallow() + } else if dd.TryDecodeAsNil() { + v[j] = nil + } else { + d.decode(&v[j]) + } + } + if canChange { + if j < len(v) { v = v[:j] changed = true + } else if j == 0 && v == nil { + v = make([]interface{}, 0) + changed = true } } slh.End() return v, changed } -func (f *decFnInfo) fastpathDecSliceStringR(rv reflect.Value) { - array := f.seq == seqTypeArray - if !array && rv.CanAddr() { - vp := rv.Addr().Interface().(*[]string) - v, changed := fastpathTV.DecSliceStringV(*vp, fastpathCheckNilFalse, !array, f.d) +func (d *Decoder) fastpathDecSliceStringR(f *codecFnInfo, rv reflect.Value) { + if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*[]string) + v, changed := fastpathTV.DecSliceStringV(*vp, !array, d) if changed { *vp = v } } else { - v := rv.Interface().([]string) - fastpathTV.DecSliceStringV(v, fastpathCheckNilFalse, false, f.d) + v := rv2i(rv).([]string) + v2, changed := fastpathTV.DecSliceStringV(v, !array, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } } } - -func (f fastpathT) DecSliceStringX(vp *[]string, checkNil bool, d *Decoder) { - v, changed := f.DecSliceStringV(*vp, checkNil, true, d) +func (f fastpathT) DecSliceStringX(vp *[]string, d *Decoder) { + v, changed := f.DecSliceStringV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecSliceStringV(v []string, checkNil bool, canChange bool, d *Decoder) (_ []string, changed bool) { +func (_ fastpathT) DecSliceStringV(v []string, canChange bool, d *Decoder) (_ []string, changed bool) { dd := d.d - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -18300,126 +17853,89 @@ func (_ fastpathT) DecSliceStringV(v []string, checkNil bool, canChange bool, d slh.End() return v, changed } - - if containerLenS > 0 { - x2read := containerLenS - var xtrunc bool + hasLen := containerLenS > 0 + var xlen int + if hasLen && canChange { if containerLenS > cap(v) { - if canChange { - var xlen int - xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 16) - if xtrunc { - if xlen <= cap(v) { - v = v[:xlen] - } else { - v = make([]string, xlen) - } - } else { - v = make([]string, xlen) - } - changed = true + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 16) + if xlen <= cap(v) { + v = v[:xlen] } else { - d.arrayCannotExpand(len(v), containerLenS) + v = make([]string, xlen) } - x2read = len(v) + changed = true } else if containerLenS != len(v) { - if canChange { - v = v[:containerLenS] - changed = true - } - } - j := 0 - for ; j < x2read; j++ { - slh.ElemContainerState(j) - v[j] = dd.DecodeString() - } - if xtrunc { - for ; j < containerLenS; j++ { - v = append(v, "") - slh.ElemContainerState(j) - v[j] = dd.DecodeString() - } - } else if !canChange { - for ; j < containerLenS; j++ { - slh.ElemContainerState(j) - d.swallow() - } - } - } else { - breakFound := dd.CheckBreak() - if breakFound { - if canChange { - if v == nil { - v = []string{} - } else if len(v) != 0 { - v = v[:0] - } - changed = true - } - slh.End() - return v, changed - } - if cap(v) == 0 { - v = make([]string, 1, 4) + v = v[:containerLenS] changed = true } - j := 0 - for ; !breakFound; j++ { - if j >= len(v) { - if canChange { - v = append(v, "") - changed = true - } else { - d.arrayCannotExpand(len(v), j+1) - } - } - slh.ElemContainerState(j) - if j < len(v) { - v[j] = dd.DecodeString() + } + j := 0 + for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + if j == 0 && len(v) == 0 && canChange { + if hasLen { + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 16) } else { - d.swallow() + xlen = 8 } - breakFound = dd.CheckBreak() + v = make([]string, xlen) + changed = true } - if canChange && j < len(v) { + // if indefinite, etc, then expand the slice if necessary + var decodeIntoBlank bool + if j >= len(v) { + if canChange { + v = append(v, "") + changed = true + } else { + d.arrayCannotExpand(len(v), j+1) + decodeIntoBlank = true + } + } + slh.ElemContainerState(j) + if decodeIntoBlank { + d.swallow() + } else if dd.TryDecodeAsNil() { + v[j] = "" + } else { + v[j] = dd.DecodeString() + } + } + if canChange { + if j < len(v) { v = v[:j] changed = true + } else if j == 0 && v == nil { + v = make([]string, 0) + changed = true } } slh.End() return v, changed } -func (f *decFnInfo) fastpathDecSliceFloat32R(rv reflect.Value) { - array := f.seq == seqTypeArray - if !array && rv.CanAddr() { - vp := rv.Addr().Interface().(*[]float32) - v, changed := fastpathTV.DecSliceFloat32V(*vp, fastpathCheckNilFalse, !array, f.d) +func (d *Decoder) fastpathDecSliceFloat32R(f *codecFnInfo, rv reflect.Value) { + if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*[]float32) + v, changed := fastpathTV.DecSliceFloat32V(*vp, !array, d) if changed { *vp = v } } else { - v := rv.Interface().([]float32) - fastpathTV.DecSliceFloat32V(v, fastpathCheckNilFalse, false, f.d) + v := rv2i(rv).([]float32) + v2, changed := fastpathTV.DecSliceFloat32V(v, !array, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } } } - -func (f fastpathT) DecSliceFloat32X(vp *[]float32, checkNil bool, d *Decoder) { - v, changed := f.DecSliceFloat32V(*vp, checkNil, true, d) +func (f fastpathT) DecSliceFloat32X(vp *[]float32, d *Decoder) { + v, changed := f.DecSliceFloat32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecSliceFloat32V(v []float32, checkNil bool, canChange bool, d *Decoder) (_ []float32, changed bool) { +func (_ fastpathT) DecSliceFloat32V(v []float32, canChange bool, d *Decoder) (_ []float32, changed bool) { dd := d.d - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -18433,126 +17949,89 @@ func (_ fastpathT) DecSliceFloat32V(v []float32, checkNil bool, canChange bool, slh.End() return v, changed } - - if containerLenS > 0 { - x2read := containerLenS - var xtrunc bool + hasLen := containerLenS > 0 + var xlen int + if hasLen && canChange { if containerLenS > cap(v) { - if canChange { - var xlen int - xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 4) - if xtrunc { - if xlen <= cap(v) { - v = v[:xlen] - } else { - v = make([]float32, xlen) - } - } else { - v = make([]float32, xlen) - } - changed = true + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4) + if xlen <= cap(v) { + v = v[:xlen] } else { - d.arrayCannotExpand(len(v), containerLenS) + v = make([]float32, xlen) } - x2read = len(v) + changed = true } else if containerLenS != len(v) { - if canChange { - v = v[:containerLenS] - changed = true - } - } - j := 0 - for ; j < x2read; j++ { - slh.ElemContainerState(j) - v[j] = float32(dd.DecodeFloat(true)) - } - if xtrunc { - for ; j < containerLenS; j++ { - v = append(v, 0) - slh.ElemContainerState(j) - v[j] = float32(dd.DecodeFloat(true)) - } - } else if !canChange { - for ; j < containerLenS; j++ { - slh.ElemContainerState(j) - d.swallow() - } - } - } else { - breakFound := dd.CheckBreak() - if breakFound { - if canChange { - if v == nil { - v = []float32{} - } else if len(v) != 0 { - v = v[:0] - } - changed = true - } - slh.End() - return v, changed - } - if cap(v) == 0 { - v = make([]float32, 1, 4) + v = v[:containerLenS] changed = true } - j := 0 - for ; !breakFound; j++ { - if j >= len(v) { - if canChange { - v = append(v, 0) - changed = true - } else { - d.arrayCannotExpand(len(v), j+1) - } - } - slh.ElemContainerState(j) - if j < len(v) { - v[j] = float32(dd.DecodeFloat(true)) + } + j := 0 + for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + if j == 0 && len(v) == 0 && canChange { + if hasLen { + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4) } else { - d.swallow() + xlen = 8 } - breakFound = dd.CheckBreak() + v = make([]float32, xlen) + changed = true } - if canChange && j < len(v) { + // if indefinite, etc, then expand the slice if necessary + var decodeIntoBlank bool + if j >= len(v) { + if canChange { + v = append(v, 0) + changed = true + } else { + d.arrayCannotExpand(len(v), j+1) + decodeIntoBlank = true + } + } + slh.ElemContainerState(j) + if decodeIntoBlank { + d.swallow() + } else if dd.TryDecodeAsNil() { + v[j] = 0 + } else { + v[j] = float32(chkOvf.Float32V(dd.DecodeFloat64())) + } + } + if canChange { + if j < len(v) { v = v[:j] changed = true + } else if j == 0 && v == nil { + v = make([]float32, 0) + changed = true } } slh.End() return v, changed } -func (f *decFnInfo) fastpathDecSliceFloat64R(rv reflect.Value) { - array := f.seq == seqTypeArray - if !array && rv.CanAddr() { - vp := rv.Addr().Interface().(*[]float64) - v, changed := fastpathTV.DecSliceFloat64V(*vp, fastpathCheckNilFalse, !array, f.d) +func (d *Decoder) fastpathDecSliceFloat64R(f *codecFnInfo, rv reflect.Value) { + if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*[]float64) + v, changed := fastpathTV.DecSliceFloat64V(*vp, !array, d) if changed { *vp = v } } else { - v := rv.Interface().([]float64) - fastpathTV.DecSliceFloat64V(v, fastpathCheckNilFalse, false, f.d) + v := rv2i(rv).([]float64) + v2, changed := fastpathTV.DecSliceFloat64V(v, !array, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } } } - -func (f fastpathT) DecSliceFloat64X(vp *[]float64, checkNil bool, d *Decoder) { - v, changed := f.DecSliceFloat64V(*vp, checkNil, true, d) +func (f fastpathT) DecSliceFloat64X(vp *[]float64, d *Decoder) { + v, changed := f.DecSliceFloat64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecSliceFloat64V(v []float64, checkNil bool, canChange bool, d *Decoder) (_ []float64, changed bool) { +func (_ fastpathT) DecSliceFloat64V(v []float64, canChange bool, d *Decoder) (_ []float64, changed bool) { dd := d.d - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -18566,126 +18045,89 @@ func (_ fastpathT) DecSliceFloat64V(v []float64, checkNil bool, canChange bool, slh.End() return v, changed } - - if containerLenS > 0 { - x2read := containerLenS - var xtrunc bool + hasLen := containerLenS > 0 + var xlen int + if hasLen && canChange { if containerLenS > cap(v) { - if canChange { - var xlen int - xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8) - if xtrunc { - if xlen <= cap(v) { - v = v[:xlen] - } else { - v = make([]float64, xlen) - } - } else { - v = make([]float64, xlen) - } - changed = true + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) + if xlen <= cap(v) { + v = v[:xlen] } else { - d.arrayCannotExpand(len(v), containerLenS) + v = make([]float64, xlen) } - x2read = len(v) + changed = true } else if containerLenS != len(v) { - if canChange { - v = v[:containerLenS] - changed = true - } - } - j := 0 - for ; j < x2read; j++ { - slh.ElemContainerState(j) - v[j] = dd.DecodeFloat(false) - } - if xtrunc { - for ; j < containerLenS; j++ { - v = append(v, 0) - slh.ElemContainerState(j) - v[j] = dd.DecodeFloat(false) - } - } else if !canChange { - for ; j < containerLenS; j++ { - slh.ElemContainerState(j) - d.swallow() - } - } - } else { - breakFound := dd.CheckBreak() - if breakFound { - if canChange { - if v == nil { - v = []float64{} - } else if len(v) != 0 { - v = v[:0] - } - changed = true - } - slh.End() - return v, changed - } - if cap(v) == 0 { - v = make([]float64, 1, 4) + v = v[:containerLenS] changed = true } - j := 0 - for ; !breakFound; j++ { - if j >= len(v) { - if canChange { - v = append(v, 0) - changed = true - } else { - d.arrayCannotExpand(len(v), j+1) - } - } - slh.ElemContainerState(j) - if j < len(v) { - v[j] = dd.DecodeFloat(false) + } + j := 0 + for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + if j == 0 && len(v) == 0 && canChange { + if hasLen { + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) } else { - d.swallow() + xlen = 8 } - breakFound = dd.CheckBreak() + v = make([]float64, xlen) + changed = true } - if canChange && j < len(v) { + // if indefinite, etc, then expand the slice if necessary + var decodeIntoBlank bool + if j >= len(v) { + if canChange { + v = append(v, 0) + changed = true + } else { + d.arrayCannotExpand(len(v), j+1) + decodeIntoBlank = true + } + } + slh.ElemContainerState(j) + if decodeIntoBlank { + d.swallow() + } else if dd.TryDecodeAsNil() { + v[j] = 0 + } else { + v[j] = dd.DecodeFloat64() + } + } + if canChange { + if j < len(v) { v = v[:j] changed = true + } else if j == 0 && v == nil { + v = make([]float64, 0) + changed = true } } slh.End() return v, changed } -func (f *decFnInfo) fastpathDecSliceUintR(rv reflect.Value) { - array := f.seq == seqTypeArray - if !array && rv.CanAddr() { - vp := rv.Addr().Interface().(*[]uint) - v, changed := fastpathTV.DecSliceUintV(*vp, fastpathCheckNilFalse, !array, f.d) +func (d *Decoder) fastpathDecSliceUintR(f *codecFnInfo, rv reflect.Value) { + if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*[]uint) + v, changed := fastpathTV.DecSliceUintV(*vp, !array, d) if changed { *vp = v } } else { - v := rv.Interface().([]uint) - fastpathTV.DecSliceUintV(v, fastpathCheckNilFalse, false, f.d) + v := rv2i(rv).([]uint) + v2, changed := fastpathTV.DecSliceUintV(v, !array, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } } } - -func (f fastpathT) DecSliceUintX(vp *[]uint, checkNil bool, d *Decoder) { - v, changed := f.DecSliceUintV(*vp, checkNil, true, d) +func (f fastpathT) DecSliceUintX(vp *[]uint, d *Decoder) { + v, changed := f.DecSliceUintV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecSliceUintV(v []uint, checkNil bool, canChange bool, d *Decoder) (_ []uint, changed bool) { +func (_ fastpathT) DecSliceUintV(v []uint, canChange bool, d *Decoder) (_ []uint, changed bool) { dd := d.d - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -18699,126 +18141,185 @@ func (_ fastpathT) DecSliceUintV(v []uint, checkNil bool, canChange bool, d *Dec slh.End() return v, changed } - - if containerLenS > 0 { - x2read := containerLenS - var xtrunc bool + hasLen := containerLenS > 0 + var xlen int + if hasLen && canChange { if containerLenS > cap(v) { - if canChange { - var xlen int - xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8) - if xtrunc { - if xlen <= cap(v) { - v = v[:xlen] - } else { - v = make([]uint, xlen) - } - } else { - v = make([]uint, xlen) - } - changed = true + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) + if xlen <= cap(v) { + v = v[:xlen] } else { - d.arrayCannotExpand(len(v), containerLenS) + v = make([]uint, xlen) } - x2read = len(v) + changed = true } else if containerLenS != len(v) { - if canChange { - v = v[:containerLenS] - changed = true - } - } - j := 0 - for ; j < x2read; j++ { - slh.ElemContainerState(j) - v[j] = uint(dd.DecodeUint(uintBitsize)) - } - if xtrunc { - for ; j < containerLenS; j++ { - v = append(v, 0) - slh.ElemContainerState(j) - v[j] = uint(dd.DecodeUint(uintBitsize)) - } - } else if !canChange { - for ; j < containerLenS; j++ { - slh.ElemContainerState(j) - d.swallow() - } - } - } else { - breakFound := dd.CheckBreak() - if breakFound { - if canChange { - if v == nil { - v = []uint{} - } else if len(v) != 0 { - v = v[:0] - } - changed = true - } - slh.End() - return v, changed - } - if cap(v) == 0 { - v = make([]uint, 1, 4) + v = v[:containerLenS] changed = true } - j := 0 - for ; !breakFound; j++ { - if j >= len(v) { - if canChange { - v = append(v, 0) - changed = true - } else { - d.arrayCannotExpand(len(v), j+1) - } - } - slh.ElemContainerState(j) - if j < len(v) { - v[j] = uint(dd.DecodeUint(uintBitsize)) + } + j := 0 + for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + if j == 0 && len(v) == 0 && canChange { + if hasLen { + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) } else { - d.swallow() + xlen = 8 } - breakFound = dd.CheckBreak() + v = make([]uint, xlen) + changed = true } - if canChange && j < len(v) { + // if indefinite, etc, then expand the slice if necessary + var decodeIntoBlank bool + if j >= len(v) { + if canChange { + v = append(v, 0) + changed = true + } else { + d.arrayCannotExpand(len(v), j+1) + decodeIntoBlank = true + } + } + slh.ElemContainerState(j) + if decodeIntoBlank { + d.swallow() + } else if dd.TryDecodeAsNil() { + v[j] = 0 + } else { + v[j] = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + } + } + if canChange { + if j < len(v) { v = v[:j] changed = true + } else if j == 0 && v == nil { + v = make([]uint, 0) + changed = true } } slh.End() return v, changed } -func (f *decFnInfo) fastpathDecSliceUint16R(rv reflect.Value) { - array := f.seq == seqTypeArray - if !array && rv.CanAddr() { - vp := rv.Addr().Interface().(*[]uint16) - v, changed := fastpathTV.DecSliceUint16V(*vp, fastpathCheckNilFalse, !array, f.d) +func (d *Decoder) fastpathDecSliceUint8R(f *codecFnInfo, rv reflect.Value) { + if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*[]uint8) + v, changed := fastpathTV.DecSliceUint8V(*vp, !array, d) if changed { *vp = v } } else { - v := rv.Interface().([]uint16) - fastpathTV.DecSliceUint16V(v, fastpathCheckNilFalse, false, f.d) + v := rv2i(rv).([]uint8) + v2, changed := fastpathTV.DecSliceUint8V(v, !array, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } } } - -func (f fastpathT) DecSliceUint16X(vp *[]uint16, checkNil bool, d *Decoder) { - v, changed := f.DecSliceUint16V(*vp, checkNil, true, d) +func (f fastpathT) DecSliceUint8X(vp *[]uint8, d *Decoder) { + v, changed := f.DecSliceUint8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecSliceUint16V(v []uint16, checkNil bool, canChange bool, d *Decoder) (_ []uint16, changed bool) { +func (_ fastpathT) DecSliceUint8V(v []uint8, canChange bool, d *Decoder) (_ []uint8, changed bool) { dd := d.d - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { + slh, containerLenS := d.decSliceHelperStart() + if containerLenS == 0 { + if canChange { + if v == nil { + v = []uint8{} + } else if len(v) != 0 { + v = v[:0] + } changed = true } - return nil, changed + slh.End() + return v, changed } + hasLen := containerLenS > 0 + var xlen int + if hasLen && canChange { + if containerLenS > cap(v) { + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1) + if xlen <= cap(v) { + v = v[:xlen] + } else { + v = make([]uint8, xlen) + } + changed = true + } else if containerLenS != len(v) { + v = v[:containerLenS] + changed = true + } + } + j := 0 + for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + if j == 0 && len(v) == 0 && canChange { + if hasLen { + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1) + } else { + xlen = 8 + } + v = make([]uint8, xlen) + changed = true + } + // if indefinite, etc, then expand the slice if necessary + var decodeIntoBlank bool + if j >= len(v) { + if canChange { + v = append(v, 0) + changed = true + } else { + d.arrayCannotExpand(len(v), j+1) + decodeIntoBlank = true + } + } + slh.ElemContainerState(j) + if decodeIntoBlank { + d.swallow() + } else if dd.TryDecodeAsNil() { + v[j] = 0 + } else { + v[j] = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + } + } + if canChange { + if j < len(v) { + v = v[:j] + changed = true + } else if j == 0 && v == nil { + v = make([]uint8, 0) + changed = true + } + } + slh.End() + return v, changed +} +func (d *Decoder) fastpathDecSliceUint16R(f *codecFnInfo, rv reflect.Value) { + if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*[]uint16) + v, changed := fastpathTV.DecSliceUint16V(*vp, !array, d) + if changed { + *vp = v + } + } else { + v := rv2i(rv).([]uint16) + v2, changed := fastpathTV.DecSliceUint16V(v, !array, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } + } +} +func (f fastpathT) DecSliceUint16X(vp *[]uint16, d *Decoder) { + v, changed := f.DecSliceUint16V(*vp, true, d) + if changed { + *vp = v + } +} +func (_ fastpathT) DecSliceUint16V(v []uint16, canChange bool, d *Decoder) (_ []uint16, changed bool) { + dd := d.d slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -18832,126 +18333,89 @@ func (_ fastpathT) DecSliceUint16V(v []uint16, checkNil bool, canChange bool, d slh.End() return v, changed } - - if containerLenS > 0 { - x2read := containerLenS - var xtrunc bool + hasLen := containerLenS > 0 + var xlen int + if hasLen && canChange { if containerLenS > cap(v) { - if canChange { - var xlen int - xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 2) - if xtrunc { - if xlen <= cap(v) { - v = v[:xlen] - } else { - v = make([]uint16, xlen) - } - } else { - v = make([]uint16, xlen) - } - changed = true + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 2) + if xlen <= cap(v) { + v = v[:xlen] } else { - d.arrayCannotExpand(len(v), containerLenS) + v = make([]uint16, xlen) } - x2read = len(v) + changed = true } else if containerLenS != len(v) { - if canChange { - v = v[:containerLenS] - changed = true - } - } - j := 0 - for ; j < x2read; j++ { - slh.ElemContainerState(j) - v[j] = uint16(dd.DecodeUint(16)) - } - if xtrunc { - for ; j < containerLenS; j++ { - v = append(v, 0) - slh.ElemContainerState(j) - v[j] = uint16(dd.DecodeUint(16)) - } - } else if !canChange { - for ; j < containerLenS; j++ { - slh.ElemContainerState(j) - d.swallow() - } - } - } else { - breakFound := dd.CheckBreak() - if breakFound { - if canChange { - if v == nil { - v = []uint16{} - } else if len(v) != 0 { - v = v[:0] - } - changed = true - } - slh.End() - return v, changed - } - if cap(v) == 0 { - v = make([]uint16, 1, 4) + v = v[:containerLenS] changed = true } - j := 0 - for ; !breakFound; j++ { - if j >= len(v) { - if canChange { - v = append(v, 0) - changed = true - } else { - d.arrayCannotExpand(len(v), j+1) - } - } - slh.ElemContainerState(j) - if j < len(v) { - v[j] = uint16(dd.DecodeUint(16)) + } + j := 0 + for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + if j == 0 && len(v) == 0 && canChange { + if hasLen { + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 2) } else { - d.swallow() + xlen = 8 } - breakFound = dd.CheckBreak() + v = make([]uint16, xlen) + changed = true } - if canChange && j < len(v) { + // if indefinite, etc, then expand the slice if necessary + var decodeIntoBlank bool + if j >= len(v) { + if canChange { + v = append(v, 0) + changed = true + } else { + d.arrayCannotExpand(len(v), j+1) + decodeIntoBlank = true + } + } + slh.ElemContainerState(j) + if decodeIntoBlank { + d.swallow() + } else if dd.TryDecodeAsNil() { + v[j] = 0 + } else { + v[j] = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + } + } + if canChange { + if j < len(v) { v = v[:j] changed = true + } else if j == 0 && v == nil { + v = make([]uint16, 0) + changed = true } } slh.End() return v, changed } -func (f *decFnInfo) fastpathDecSliceUint32R(rv reflect.Value) { - array := f.seq == seqTypeArray - if !array && rv.CanAddr() { - vp := rv.Addr().Interface().(*[]uint32) - v, changed := fastpathTV.DecSliceUint32V(*vp, fastpathCheckNilFalse, !array, f.d) +func (d *Decoder) fastpathDecSliceUint32R(f *codecFnInfo, rv reflect.Value) { + if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*[]uint32) + v, changed := fastpathTV.DecSliceUint32V(*vp, !array, d) if changed { *vp = v } } else { - v := rv.Interface().([]uint32) - fastpathTV.DecSliceUint32V(v, fastpathCheckNilFalse, false, f.d) + v := rv2i(rv).([]uint32) + v2, changed := fastpathTV.DecSliceUint32V(v, !array, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } } } - -func (f fastpathT) DecSliceUint32X(vp *[]uint32, checkNil bool, d *Decoder) { - v, changed := f.DecSliceUint32V(*vp, checkNil, true, d) +func (f fastpathT) DecSliceUint32X(vp *[]uint32, d *Decoder) { + v, changed := f.DecSliceUint32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecSliceUint32V(v []uint32, checkNil bool, canChange bool, d *Decoder) (_ []uint32, changed bool) { +func (_ fastpathT) DecSliceUint32V(v []uint32, canChange bool, d *Decoder) (_ []uint32, changed bool) { dd := d.d - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -18965,126 +18429,89 @@ func (_ fastpathT) DecSliceUint32V(v []uint32, checkNil bool, canChange bool, d slh.End() return v, changed } - - if containerLenS > 0 { - x2read := containerLenS - var xtrunc bool + hasLen := containerLenS > 0 + var xlen int + if hasLen && canChange { if containerLenS > cap(v) { - if canChange { - var xlen int - xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 4) - if xtrunc { - if xlen <= cap(v) { - v = v[:xlen] - } else { - v = make([]uint32, xlen) - } - } else { - v = make([]uint32, xlen) - } - changed = true + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4) + if xlen <= cap(v) { + v = v[:xlen] } else { - d.arrayCannotExpand(len(v), containerLenS) + v = make([]uint32, xlen) } - x2read = len(v) + changed = true } else if containerLenS != len(v) { - if canChange { - v = v[:containerLenS] - changed = true - } - } - j := 0 - for ; j < x2read; j++ { - slh.ElemContainerState(j) - v[j] = uint32(dd.DecodeUint(32)) - } - if xtrunc { - for ; j < containerLenS; j++ { - v = append(v, 0) - slh.ElemContainerState(j) - v[j] = uint32(dd.DecodeUint(32)) - } - } else if !canChange { - for ; j < containerLenS; j++ { - slh.ElemContainerState(j) - d.swallow() - } - } - } else { - breakFound := dd.CheckBreak() - if breakFound { - if canChange { - if v == nil { - v = []uint32{} - } else if len(v) != 0 { - v = v[:0] - } - changed = true - } - slh.End() - return v, changed - } - if cap(v) == 0 { - v = make([]uint32, 1, 4) + v = v[:containerLenS] changed = true } - j := 0 - for ; !breakFound; j++ { - if j >= len(v) { - if canChange { - v = append(v, 0) - changed = true - } else { - d.arrayCannotExpand(len(v), j+1) - } - } - slh.ElemContainerState(j) - if j < len(v) { - v[j] = uint32(dd.DecodeUint(32)) + } + j := 0 + for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + if j == 0 && len(v) == 0 && canChange { + if hasLen { + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4) } else { - d.swallow() + xlen = 8 } - breakFound = dd.CheckBreak() + v = make([]uint32, xlen) + changed = true } - if canChange && j < len(v) { + // if indefinite, etc, then expand the slice if necessary + var decodeIntoBlank bool + if j >= len(v) { + if canChange { + v = append(v, 0) + changed = true + } else { + d.arrayCannotExpand(len(v), j+1) + decodeIntoBlank = true + } + } + slh.ElemContainerState(j) + if decodeIntoBlank { + d.swallow() + } else if dd.TryDecodeAsNil() { + v[j] = 0 + } else { + v[j] = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + } + } + if canChange { + if j < len(v) { v = v[:j] changed = true + } else if j == 0 && v == nil { + v = make([]uint32, 0) + changed = true } } slh.End() return v, changed } -func (f *decFnInfo) fastpathDecSliceUint64R(rv reflect.Value) { - array := f.seq == seqTypeArray - if !array && rv.CanAddr() { - vp := rv.Addr().Interface().(*[]uint64) - v, changed := fastpathTV.DecSliceUint64V(*vp, fastpathCheckNilFalse, !array, f.d) +func (d *Decoder) fastpathDecSliceUint64R(f *codecFnInfo, rv reflect.Value) { + if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*[]uint64) + v, changed := fastpathTV.DecSliceUint64V(*vp, !array, d) if changed { *vp = v } } else { - v := rv.Interface().([]uint64) - fastpathTV.DecSliceUint64V(v, fastpathCheckNilFalse, false, f.d) + v := rv2i(rv).([]uint64) + v2, changed := fastpathTV.DecSliceUint64V(v, !array, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } } } - -func (f fastpathT) DecSliceUint64X(vp *[]uint64, checkNil bool, d *Decoder) { - v, changed := f.DecSliceUint64V(*vp, checkNil, true, d) +func (f fastpathT) DecSliceUint64X(vp *[]uint64, d *Decoder) { + v, changed := f.DecSliceUint64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecSliceUint64V(v []uint64, checkNil bool, canChange bool, d *Decoder) (_ []uint64, changed bool) { +func (_ fastpathT) DecSliceUint64V(v []uint64, canChange bool, d *Decoder) (_ []uint64, changed bool) { dd := d.d - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -19098,126 +18525,89 @@ func (_ fastpathT) DecSliceUint64V(v []uint64, checkNil bool, canChange bool, d slh.End() return v, changed } - - if containerLenS > 0 { - x2read := containerLenS - var xtrunc bool + hasLen := containerLenS > 0 + var xlen int + if hasLen && canChange { if containerLenS > cap(v) { - if canChange { - var xlen int - xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8) - if xtrunc { - if xlen <= cap(v) { - v = v[:xlen] - } else { - v = make([]uint64, xlen) - } - } else { - v = make([]uint64, xlen) - } - changed = true + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) + if xlen <= cap(v) { + v = v[:xlen] } else { - d.arrayCannotExpand(len(v), containerLenS) + v = make([]uint64, xlen) } - x2read = len(v) + changed = true } else if containerLenS != len(v) { - if canChange { - v = v[:containerLenS] - changed = true - } - } - j := 0 - for ; j < x2read; j++ { - slh.ElemContainerState(j) - v[j] = dd.DecodeUint(64) - } - if xtrunc { - for ; j < containerLenS; j++ { - v = append(v, 0) - slh.ElemContainerState(j) - v[j] = dd.DecodeUint(64) - } - } else if !canChange { - for ; j < containerLenS; j++ { - slh.ElemContainerState(j) - d.swallow() - } - } - } else { - breakFound := dd.CheckBreak() - if breakFound { - if canChange { - if v == nil { - v = []uint64{} - } else if len(v) != 0 { - v = v[:0] - } - changed = true - } - slh.End() - return v, changed - } - if cap(v) == 0 { - v = make([]uint64, 1, 4) + v = v[:containerLenS] changed = true } - j := 0 - for ; !breakFound; j++ { - if j >= len(v) { - if canChange { - v = append(v, 0) - changed = true - } else { - d.arrayCannotExpand(len(v), j+1) - } - } - slh.ElemContainerState(j) - if j < len(v) { - v[j] = dd.DecodeUint(64) + } + j := 0 + for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + if j == 0 && len(v) == 0 && canChange { + if hasLen { + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) } else { - d.swallow() + xlen = 8 } - breakFound = dd.CheckBreak() + v = make([]uint64, xlen) + changed = true } - if canChange && j < len(v) { + // if indefinite, etc, then expand the slice if necessary + var decodeIntoBlank bool + if j >= len(v) { + if canChange { + v = append(v, 0) + changed = true + } else { + d.arrayCannotExpand(len(v), j+1) + decodeIntoBlank = true + } + } + slh.ElemContainerState(j) + if decodeIntoBlank { + d.swallow() + } else if dd.TryDecodeAsNil() { + v[j] = 0 + } else { + v[j] = dd.DecodeUint64() + } + } + if canChange { + if j < len(v) { v = v[:j] changed = true + } else if j == 0 && v == nil { + v = make([]uint64, 0) + changed = true } } slh.End() return v, changed } -func (f *decFnInfo) fastpathDecSliceUintptrR(rv reflect.Value) { - array := f.seq == seqTypeArray - if !array && rv.CanAddr() { - vp := rv.Addr().Interface().(*[]uintptr) - v, changed := fastpathTV.DecSliceUintptrV(*vp, fastpathCheckNilFalse, !array, f.d) +func (d *Decoder) fastpathDecSliceUintptrR(f *codecFnInfo, rv reflect.Value) { + if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*[]uintptr) + v, changed := fastpathTV.DecSliceUintptrV(*vp, !array, d) if changed { *vp = v } } else { - v := rv.Interface().([]uintptr) - fastpathTV.DecSliceUintptrV(v, fastpathCheckNilFalse, false, f.d) + v := rv2i(rv).([]uintptr) + v2, changed := fastpathTV.DecSliceUintptrV(v, !array, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } } } - -func (f fastpathT) DecSliceUintptrX(vp *[]uintptr, checkNil bool, d *Decoder) { - v, changed := f.DecSliceUintptrV(*vp, checkNil, true, d) +func (f fastpathT) DecSliceUintptrX(vp *[]uintptr, d *Decoder) { + v, changed := f.DecSliceUintptrV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecSliceUintptrV(v []uintptr, checkNil bool, canChange bool, d *Decoder) (_ []uintptr, changed bool) { +func (_ fastpathT) DecSliceUintptrV(v []uintptr, canChange bool, d *Decoder) (_ []uintptr, changed bool) { dd := d.d - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -19231,126 +18621,89 @@ func (_ fastpathT) DecSliceUintptrV(v []uintptr, checkNil bool, canChange bool, slh.End() return v, changed } - - if containerLenS > 0 { - x2read := containerLenS - var xtrunc bool + hasLen := containerLenS > 0 + var xlen int + if hasLen && canChange { if containerLenS > cap(v) { - if canChange { - var xlen int - xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8) - if xtrunc { - if xlen <= cap(v) { - v = v[:xlen] - } else { - v = make([]uintptr, xlen) - } - } else { - v = make([]uintptr, xlen) - } - changed = true + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) + if xlen <= cap(v) { + v = v[:xlen] } else { - d.arrayCannotExpand(len(v), containerLenS) + v = make([]uintptr, xlen) } - x2read = len(v) + changed = true } else if containerLenS != len(v) { - if canChange { - v = v[:containerLenS] - changed = true - } - } - j := 0 - for ; j < x2read; j++ { - slh.ElemContainerState(j) - v[j] = uintptr(dd.DecodeUint(uintBitsize)) - } - if xtrunc { - for ; j < containerLenS; j++ { - v = append(v, 0) - slh.ElemContainerState(j) - v[j] = uintptr(dd.DecodeUint(uintBitsize)) - } - } else if !canChange { - for ; j < containerLenS; j++ { - slh.ElemContainerState(j) - d.swallow() - } - } - } else { - breakFound := dd.CheckBreak() - if breakFound { - if canChange { - if v == nil { - v = []uintptr{} - } else if len(v) != 0 { - v = v[:0] - } - changed = true - } - slh.End() - return v, changed - } - if cap(v) == 0 { - v = make([]uintptr, 1, 4) + v = v[:containerLenS] changed = true } - j := 0 - for ; !breakFound; j++ { - if j >= len(v) { - if canChange { - v = append(v, 0) - changed = true - } else { - d.arrayCannotExpand(len(v), j+1) - } - } - slh.ElemContainerState(j) - if j < len(v) { - v[j] = uintptr(dd.DecodeUint(uintBitsize)) + } + j := 0 + for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + if j == 0 && len(v) == 0 && canChange { + if hasLen { + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) } else { - d.swallow() + xlen = 8 } - breakFound = dd.CheckBreak() + v = make([]uintptr, xlen) + changed = true } - if canChange && j < len(v) { + // if indefinite, etc, then expand the slice if necessary + var decodeIntoBlank bool + if j >= len(v) { + if canChange { + v = append(v, 0) + changed = true + } else { + d.arrayCannotExpand(len(v), j+1) + decodeIntoBlank = true + } + } + slh.ElemContainerState(j) + if decodeIntoBlank { + d.swallow() + } else if dd.TryDecodeAsNil() { + v[j] = 0 + } else { + v[j] = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + } + } + if canChange { + if j < len(v) { v = v[:j] changed = true + } else if j == 0 && v == nil { + v = make([]uintptr, 0) + changed = true } } slh.End() return v, changed } -func (f *decFnInfo) fastpathDecSliceIntR(rv reflect.Value) { - array := f.seq == seqTypeArray - if !array && rv.CanAddr() { - vp := rv.Addr().Interface().(*[]int) - v, changed := fastpathTV.DecSliceIntV(*vp, fastpathCheckNilFalse, !array, f.d) +func (d *Decoder) fastpathDecSliceIntR(f *codecFnInfo, rv reflect.Value) { + if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*[]int) + v, changed := fastpathTV.DecSliceIntV(*vp, !array, d) if changed { *vp = v } } else { - v := rv.Interface().([]int) - fastpathTV.DecSliceIntV(v, fastpathCheckNilFalse, false, f.d) + v := rv2i(rv).([]int) + v2, changed := fastpathTV.DecSliceIntV(v, !array, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } } } - -func (f fastpathT) DecSliceIntX(vp *[]int, checkNil bool, d *Decoder) { - v, changed := f.DecSliceIntV(*vp, checkNil, true, d) +func (f fastpathT) DecSliceIntX(vp *[]int, d *Decoder) { + v, changed := f.DecSliceIntV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecSliceIntV(v []int, checkNil bool, canChange bool, d *Decoder) (_ []int, changed bool) { +func (_ fastpathT) DecSliceIntV(v []int, canChange bool, d *Decoder) (_ []int, changed bool) { dd := d.d - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -19364,126 +18717,89 @@ func (_ fastpathT) DecSliceIntV(v []int, checkNil bool, canChange bool, d *Decod slh.End() return v, changed } - - if containerLenS > 0 { - x2read := containerLenS - var xtrunc bool + hasLen := containerLenS > 0 + var xlen int + if hasLen && canChange { if containerLenS > cap(v) { - if canChange { - var xlen int - xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8) - if xtrunc { - if xlen <= cap(v) { - v = v[:xlen] - } else { - v = make([]int, xlen) - } - } else { - v = make([]int, xlen) - } - changed = true + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) + if xlen <= cap(v) { + v = v[:xlen] } else { - d.arrayCannotExpand(len(v), containerLenS) + v = make([]int, xlen) } - x2read = len(v) + changed = true } else if containerLenS != len(v) { - if canChange { - v = v[:containerLenS] - changed = true - } - } - j := 0 - for ; j < x2read; j++ { - slh.ElemContainerState(j) - v[j] = int(dd.DecodeInt(intBitsize)) - } - if xtrunc { - for ; j < containerLenS; j++ { - v = append(v, 0) - slh.ElemContainerState(j) - v[j] = int(dd.DecodeInt(intBitsize)) - } - } else if !canChange { - for ; j < containerLenS; j++ { - slh.ElemContainerState(j) - d.swallow() - } - } - } else { - breakFound := dd.CheckBreak() - if breakFound { - if canChange { - if v == nil { - v = []int{} - } else if len(v) != 0 { - v = v[:0] - } - changed = true - } - slh.End() - return v, changed - } - if cap(v) == 0 { - v = make([]int, 1, 4) + v = v[:containerLenS] changed = true } - j := 0 - for ; !breakFound; j++ { - if j >= len(v) { - if canChange { - v = append(v, 0) - changed = true - } else { - d.arrayCannotExpand(len(v), j+1) - } - } - slh.ElemContainerState(j) - if j < len(v) { - v[j] = int(dd.DecodeInt(intBitsize)) + } + j := 0 + for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + if j == 0 && len(v) == 0 && canChange { + if hasLen { + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) } else { - d.swallow() + xlen = 8 } - breakFound = dd.CheckBreak() + v = make([]int, xlen) + changed = true } - if canChange && j < len(v) { + // if indefinite, etc, then expand the slice if necessary + var decodeIntoBlank bool + if j >= len(v) { + if canChange { + v = append(v, 0) + changed = true + } else { + d.arrayCannotExpand(len(v), j+1) + decodeIntoBlank = true + } + } + slh.ElemContainerState(j) + if decodeIntoBlank { + d.swallow() + } else if dd.TryDecodeAsNil() { + v[j] = 0 + } else { + v[j] = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + } + } + if canChange { + if j < len(v) { v = v[:j] changed = true + } else if j == 0 && v == nil { + v = make([]int, 0) + changed = true } } slh.End() return v, changed } -func (f *decFnInfo) fastpathDecSliceInt8R(rv reflect.Value) { - array := f.seq == seqTypeArray - if !array && rv.CanAddr() { - vp := rv.Addr().Interface().(*[]int8) - v, changed := fastpathTV.DecSliceInt8V(*vp, fastpathCheckNilFalse, !array, f.d) +func (d *Decoder) fastpathDecSliceInt8R(f *codecFnInfo, rv reflect.Value) { + if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*[]int8) + v, changed := fastpathTV.DecSliceInt8V(*vp, !array, d) if changed { *vp = v } } else { - v := rv.Interface().([]int8) - fastpathTV.DecSliceInt8V(v, fastpathCheckNilFalse, false, f.d) + v := rv2i(rv).([]int8) + v2, changed := fastpathTV.DecSliceInt8V(v, !array, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } } } - -func (f fastpathT) DecSliceInt8X(vp *[]int8, checkNil bool, d *Decoder) { - v, changed := f.DecSliceInt8V(*vp, checkNil, true, d) +func (f fastpathT) DecSliceInt8X(vp *[]int8, d *Decoder) { + v, changed := f.DecSliceInt8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecSliceInt8V(v []int8, checkNil bool, canChange bool, d *Decoder) (_ []int8, changed bool) { +func (_ fastpathT) DecSliceInt8V(v []int8, canChange bool, d *Decoder) (_ []int8, changed bool) { dd := d.d - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -19497,126 +18813,89 @@ func (_ fastpathT) DecSliceInt8V(v []int8, checkNil bool, canChange bool, d *Dec slh.End() return v, changed } - - if containerLenS > 0 { - x2read := containerLenS - var xtrunc bool + hasLen := containerLenS > 0 + var xlen int + if hasLen && canChange { if containerLenS > cap(v) { - if canChange { - var xlen int - xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 1) - if xtrunc { - if xlen <= cap(v) { - v = v[:xlen] - } else { - v = make([]int8, xlen) - } - } else { - v = make([]int8, xlen) - } - changed = true + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1) + if xlen <= cap(v) { + v = v[:xlen] } else { - d.arrayCannotExpand(len(v), containerLenS) + v = make([]int8, xlen) } - x2read = len(v) + changed = true } else if containerLenS != len(v) { - if canChange { - v = v[:containerLenS] - changed = true - } - } - j := 0 - for ; j < x2read; j++ { - slh.ElemContainerState(j) - v[j] = int8(dd.DecodeInt(8)) - } - if xtrunc { - for ; j < containerLenS; j++ { - v = append(v, 0) - slh.ElemContainerState(j) - v[j] = int8(dd.DecodeInt(8)) - } - } else if !canChange { - for ; j < containerLenS; j++ { - slh.ElemContainerState(j) - d.swallow() - } - } - } else { - breakFound := dd.CheckBreak() - if breakFound { - if canChange { - if v == nil { - v = []int8{} - } else if len(v) != 0 { - v = v[:0] - } - changed = true - } - slh.End() - return v, changed - } - if cap(v) == 0 { - v = make([]int8, 1, 4) + v = v[:containerLenS] changed = true } - j := 0 - for ; !breakFound; j++ { - if j >= len(v) { - if canChange { - v = append(v, 0) - changed = true - } else { - d.arrayCannotExpand(len(v), j+1) - } - } - slh.ElemContainerState(j) - if j < len(v) { - v[j] = int8(dd.DecodeInt(8)) + } + j := 0 + for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + if j == 0 && len(v) == 0 && canChange { + if hasLen { + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1) } else { - d.swallow() + xlen = 8 } - breakFound = dd.CheckBreak() + v = make([]int8, xlen) + changed = true } - if canChange && j < len(v) { + // if indefinite, etc, then expand the slice if necessary + var decodeIntoBlank bool + if j >= len(v) { + if canChange { + v = append(v, 0) + changed = true + } else { + d.arrayCannotExpand(len(v), j+1) + decodeIntoBlank = true + } + } + slh.ElemContainerState(j) + if decodeIntoBlank { + d.swallow() + } else if dd.TryDecodeAsNil() { + v[j] = 0 + } else { + v[j] = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + } + } + if canChange { + if j < len(v) { v = v[:j] changed = true + } else if j == 0 && v == nil { + v = make([]int8, 0) + changed = true } } slh.End() return v, changed } -func (f *decFnInfo) fastpathDecSliceInt16R(rv reflect.Value) { - array := f.seq == seqTypeArray - if !array && rv.CanAddr() { - vp := rv.Addr().Interface().(*[]int16) - v, changed := fastpathTV.DecSliceInt16V(*vp, fastpathCheckNilFalse, !array, f.d) +func (d *Decoder) fastpathDecSliceInt16R(f *codecFnInfo, rv reflect.Value) { + if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*[]int16) + v, changed := fastpathTV.DecSliceInt16V(*vp, !array, d) if changed { *vp = v } } else { - v := rv.Interface().([]int16) - fastpathTV.DecSliceInt16V(v, fastpathCheckNilFalse, false, f.d) + v := rv2i(rv).([]int16) + v2, changed := fastpathTV.DecSliceInt16V(v, !array, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } } } - -func (f fastpathT) DecSliceInt16X(vp *[]int16, checkNil bool, d *Decoder) { - v, changed := f.DecSliceInt16V(*vp, checkNil, true, d) +func (f fastpathT) DecSliceInt16X(vp *[]int16, d *Decoder) { + v, changed := f.DecSliceInt16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecSliceInt16V(v []int16, checkNil bool, canChange bool, d *Decoder) (_ []int16, changed bool) { +func (_ fastpathT) DecSliceInt16V(v []int16, canChange bool, d *Decoder) (_ []int16, changed bool) { dd := d.d - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -19630,126 +18909,89 @@ func (_ fastpathT) DecSliceInt16V(v []int16, checkNil bool, canChange bool, d *D slh.End() return v, changed } - - if containerLenS > 0 { - x2read := containerLenS - var xtrunc bool + hasLen := containerLenS > 0 + var xlen int + if hasLen && canChange { if containerLenS > cap(v) { - if canChange { - var xlen int - xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 2) - if xtrunc { - if xlen <= cap(v) { - v = v[:xlen] - } else { - v = make([]int16, xlen) - } - } else { - v = make([]int16, xlen) - } - changed = true + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 2) + if xlen <= cap(v) { + v = v[:xlen] } else { - d.arrayCannotExpand(len(v), containerLenS) + v = make([]int16, xlen) } - x2read = len(v) + changed = true } else if containerLenS != len(v) { - if canChange { - v = v[:containerLenS] - changed = true - } - } - j := 0 - for ; j < x2read; j++ { - slh.ElemContainerState(j) - v[j] = int16(dd.DecodeInt(16)) - } - if xtrunc { - for ; j < containerLenS; j++ { - v = append(v, 0) - slh.ElemContainerState(j) - v[j] = int16(dd.DecodeInt(16)) - } - } else if !canChange { - for ; j < containerLenS; j++ { - slh.ElemContainerState(j) - d.swallow() - } - } - } else { - breakFound := dd.CheckBreak() - if breakFound { - if canChange { - if v == nil { - v = []int16{} - } else if len(v) != 0 { - v = v[:0] - } - changed = true - } - slh.End() - return v, changed - } - if cap(v) == 0 { - v = make([]int16, 1, 4) + v = v[:containerLenS] changed = true } - j := 0 - for ; !breakFound; j++ { - if j >= len(v) { - if canChange { - v = append(v, 0) - changed = true - } else { - d.arrayCannotExpand(len(v), j+1) - } - } - slh.ElemContainerState(j) - if j < len(v) { - v[j] = int16(dd.DecodeInt(16)) + } + j := 0 + for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + if j == 0 && len(v) == 0 && canChange { + if hasLen { + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 2) } else { - d.swallow() + xlen = 8 } - breakFound = dd.CheckBreak() + v = make([]int16, xlen) + changed = true } - if canChange && j < len(v) { + // if indefinite, etc, then expand the slice if necessary + var decodeIntoBlank bool + if j >= len(v) { + if canChange { + v = append(v, 0) + changed = true + } else { + d.arrayCannotExpand(len(v), j+1) + decodeIntoBlank = true + } + } + slh.ElemContainerState(j) + if decodeIntoBlank { + d.swallow() + } else if dd.TryDecodeAsNil() { + v[j] = 0 + } else { + v[j] = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + } + } + if canChange { + if j < len(v) { v = v[:j] changed = true + } else if j == 0 && v == nil { + v = make([]int16, 0) + changed = true } } slh.End() return v, changed } -func (f *decFnInfo) fastpathDecSliceInt32R(rv reflect.Value) { - array := f.seq == seqTypeArray - if !array && rv.CanAddr() { - vp := rv.Addr().Interface().(*[]int32) - v, changed := fastpathTV.DecSliceInt32V(*vp, fastpathCheckNilFalse, !array, f.d) +func (d *Decoder) fastpathDecSliceInt32R(f *codecFnInfo, rv reflect.Value) { + if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*[]int32) + v, changed := fastpathTV.DecSliceInt32V(*vp, !array, d) if changed { *vp = v } } else { - v := rv.Interface().([]int32) - fastpathTV.DecSliceInt32V(v, fastpathCheckNilFalse, false, f.d) + v := rv2i(rv).([]int32) + v2, changed := fastpathTV.DecSliceInt32V(v, !array, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } } } - -func (f fastpathT) DecSliceInt32X(vp *[]int32, checkNil bool, d *Decoder) { - v, changed := f.DecSliceInt32V(*vp, checkNil, true, d) +func (f fastpathT) DecSliceInt32X(vp *[]int32, d *Decoder) { + v, changed := f.DecSliceInt32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecSliceInt32V(v []int32, checkNil bool, canChange bool, d *Decoder) (_ []int32, changed bool) { +func (_ fastpathT) DecSliceInt32V(v []int32, canChange bool, d *Decoder) (_ []int32, changed bool) { dd := d.d - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -19763,126 +19005,89 @@ func (_ fastpathT) DecSliceInt32V(v []int32, checkNil bool, canChange bool, d *D slh.End() return v, changed } - - if containerLenS > 0 { - x2read := containerLenS - var xtrunc bool + hasLen := containerLenS > 0 + var xlen int + if hasLen && canChange { if containerLenS > cap(v) { - if canChange { - var xlen int - xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 4) - if xtrunc { - if xlen <= cap(v) { - v = v[:xlen] - } else { - v = make([]int32, xlen) - } - } else { - v = make([]int32, xlen) - } - changed = true + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4) + if xlen <= cap(v) { + v = v[:xlen] } else { - d.arrayCannotExpand(len(v), containerLenS) + v = make([]int32, xlen) } - x2read = len(v) + changed = true } else if containerLenS != len(v) { - if canChange { - v = v[:containerLenS] - changed = true - } - } - j := 0 - for ; j < x2read; j++ { - slh.ElemContainerState(j) - v[j] = int32(dd.DecodeInt(32)) - } - if xtrunc { - for ; j < containerLenS; j++ { - v = append(v, 0) - slh.ElemContainerState(j) - v[j] = int32(dd.DecodeInt(32)) - } - } else if !canChange { - for ; j < containerLenS; j++ { - slh.ElemContainerState(j) - d.swallow() - } - } - } else { - breakFound := dd.CheckBreak() - if breakFound { - if canChange { - if v == nil { - v = []int32{} - } else if len(v) != 0 { - v = v[:0] - } - changed = true - } - slh.End() - return v, changed - } - if cap(v) == 0 { - v = make([]int32, 1, 4) + v = v[:containerLenS] changed = true } - j := 0 - for ; !breakFound; j++ { - if j >= len(v) { - if canChange { - v = append(v, 0) - changed = true - } else { - d.arrayCannotExpand(len(v), j+1) - } - } - slh.ElemContainerState(j) - if j < len(v) { - v[j] = int32(dd.DecodeInt(32)) + } + j := 0 + for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + if j == 0 && len(v) == 0 && canChange { + if hasLen { + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 4) } else { - d.swallow() + xlen = 8 } - breakFound = dd.CheckBreak() + v = make([]int32, xlen) + changed = true } - if canChange && j < len(v) { + // if indefinite, etc, then expand the slice if necessary + var decodeIntoBlank bool + if j >= len(v) { + if canChange { + v = append(v, 0) + changed = true + } else { + d.arrayCannotExpand(len(v), j+1) + decodeIntoBlank = true + } + } + slh.ElemContainerState(j) + if decodeIntoBlank { + d.swallow() + } else if dd.TryDecodeAsNil() { + v[j] = 0 + } else { + v[j] = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + } + } + if canChange { + if j < len(v) { v = v[:j] changed = true + } else if j == 0 && v == nil { + v = make([]int32, 0) + changed = true } } slh.End() return v, changed } -func (f *decFnInfo) fastpathDecSliceInt64R(rv reflect.Value) { - array := f.seq == seqTypeArray - if !array && rv.CanAddr() { - vp := rv.Addr().Interface().(*[]int64) - v, changed := fastpathTV.DecSliceInt64V(*vp, fastpathCheckNilFalse, !array, f.d) +func (d *Decoder) fastpathDecSliceInt64R(f *codecFnInfo, rv reflect.Value) { + if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*[]int64) + v, changed := fastpathTV.DecSliceInt64V(*vp, !array, d) if changed { *vp = v } } else { - v := rv.Interface().([]int64) - fastpathTV.DecSliceInt64V(v, fastpathCheckNilFalse, false, f.d) + v := rv2i(rv).([]int64) + v2, changed := fastpathTV.DecSliceInt64V(v, !array, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } } } - -func (f fastpathT) DecSliceInt64X(vp *[]int64, checkNil bool, d *Decoder) { - v, changed := f.DecSliceInt64V(*vp, checkNil, true, d) +func (f fastpathT) DecSliceInt64X(vp *[]int64, d *Decoder) { + v, changed := f.DecSliceInt64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecSliceInt64V(v []int64, checkNil bool, canChange bool, d *Decoder) (_ []int64, changed bool) { +func (_ fastpathT) DecSliceInt64V(v []int64, canChange bool, d *Decoder) (_ []int64, changed bool) { dd := d.d - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -19896,126 +19101,89 @@ func (_ fastpathT) DecSliceInt64V(v []int64, checkNil bool, canChange bool, d *D slh.End() return v, changed } - - if containerLenS > 0 { - x2read := containerLenS - var xtrunc bool + hasLen := containerLenS > 0 + var xlen int + if hasLen && canChange { if containerLenS > cap(v) { - if canChange { - var xlen int - xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 8) - if xtrunc { - if xlen <= cap(v) { - v = v[:xlen] - } else { - v = make([]int64, xlen) - } - } else { - v = make([]int64, xlen) - } - changed = true + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) + if xlen <= cap(v) { + v = v[:xlen] } else { - d.arrayCannotExpand(len(v), containerLenS) + v = make([]int64, xlen) } - x2read = len(v) + changed = true } else if containerLenS != len(v) { - if canChange { - v = v[:containerLenS] - changed = true - } - } - j := 0 - for ; j < x2read; j++ { - slh.ElemContainerState(j) - v[j] = dd.DecodeInt(64) - } - if xtrunc { - for ; j < containerLenS; j++ { - v = append(v, 0) - slh.ElemContainerState(j) - v[j] = dd.DecodeInt(64) - } - } else if !canChange { - for ; j < containerLenS; j++ { - slh.ElemContainerState(j) - d.swallow() - } - } - } else { - breakFound := dd.CheckBreak() - if breakFound { - if canChange { - if v == nil { - v = []int64{} - } else if len(v) != 0 { - v = v[:0] - } - changed = true - } - slh.End() - return v, changed - } - if cap(v) == 0 { - v = make([]int64, 1, 4) + v = v[:containerLenS] changed = true } - j := 0 - for ; !breakFound; j++ { - if j >= len(v) { - if canChange { - v = append(v, 0) - changed = true - } else { - d.arrayCannotExpand(len(v), j+1) - } - } - slh.ElemContainerState(j) - if j < len(v) { - v[j] = dd.DecodeInt(64) + } + j := 0 + for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + if j == 0 && len(v) == 0 && canChange { + if hasLen { + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 8) } else { - d.swallow() + xlen = 8 } - breakFound = dd.CheckBreak() + v = make([]int64, xlen) + changed = true } - if canChange && j < len(v) { + // if indefinite, etc, then expand the slice if necessary + var decodeIntoBlank bool + if j >= len(v) { + if canChange { + v = append(v, 0) + changed = true + } else { + d.arrayCannotExpand(len(v), j+1) + decodeIntoBlank = true + } + } + slh.ElemContainerState(j) + if decodeIntoBlank { + d.swallow() + } else if dd.TryDecodeAsNil() { + v[j] = 0 + } else { + v[j] = dd.DecodeInt64() + } + } + if canChange { + if j < len(v) { v = v[:j] changed = true + } else if j == 0 && v == nil { + v = make([]int64, 0) + changed = true } } slh.End() return v, changed } -func (f *decFnInfo) fastpathDecSliceBoolR(rv reflect.Value) { - array := f.seq == seqTypeArray - if !array && rv.CanAddr() { - vp := rv.Addr().Interface().(*[]bool) - v, changed := fastpathTV.DecSliceBoolV(*vp, fastpathCheckNilFalse, !array, f.d) +func (d *Decoder) fastpathDecSliceBoolR(f *codecFnInfo, rv reflect.Value) { + if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*[]bool) + v, changed := fastpathTV.DecSliceBoolV(*vp, !array, d) if changed { *vp = v } } else { - v := rv.Interface().([]bool) - fastpathTV.DecSliceBoolV(v, fastpathCheckNilFalse, false, f.d) + v := rv2i(rv).([]bool) + v2, changed := fastpathTV.DecSliceBoolV(v, !array, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } } } - -func (f fastpathT) DecSliceBoolX(vp *[]bool, checkNil bool, d *Decoder) { - v, changed := f.DecSliceBoolV(*vp, checkNil, true, d) +func (f fastpathT) DecSliceBoolX(vp *[]bool, d *Decoder) { + v, changed := f.DecSliceBoolV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecSliceBoolV(v []bool, checkNil bool, canChange bool, d *Decoder) (_ []bool, changed bool) { +func (_ fastpathT) DecSliceBoolV(v []bool, canChange bool, d *Decoder) (_ []bool, changed bool) { dd := d.d - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { @@ -20029,19324 +19197,15326 @@ func (_ fastpathT) DecSliceBoolV(v []bool, checkNil bool, canChange bool, d *Dec slh.End() return v, changed } - - if containerLenS > 0 { - x2read := containerLenS - var xtrunc bool + hasLen := containerLenS > 0 + var xlen int + if hasLen && canChange { if containerLenS > cap(v) { - if canChange { - var xlen int - xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, 1) - if xtrunc { - if xlen <= cap(v) { - v = v[:xlen] - } else { - v = make([]bool, xlen) - } - } else { - v = make([]bool, xlen) - } - changed = true + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1) + if xlen <= cap(v) { + v = v[:xlen] } else { - d.arrayCannotExpand(len(v), containerLenS) + v = make([]bool, xlen) } - x2read = len(v) + changed = true } else if containerLenS != len(v) { - if canChange { - v = v[:containerLenS] - changed = true - } - } - j := 0 - for ; j < x2read; j++ { - slh.ElemContainerState(j) - v[j] = dd.DecodeBool() - } - if xtrunc { - for ; j < containerLenS; j++ { - v = append(v, false) - slh.ElemContainerState(j) - v[j] = dd.DecodeBool() - } - } else if !canChange { - for ; j < containerLenS; j++ { - slh.ElemContainerState(j) - d.swallow() - } - } - } else { - breakFound := dd.CheckBreak() - if breakFound { - if canChange { - if v == nil { - v = []bool{} - } else if len(v) != 0 { - v = v[:0] - } - changed = true - } - slh.End() - return v, changed - } - if cap(v) == 0 { - v = make([]bool, 1, 4) + v = v[:containerLenS] changed = true } - j := 0 - for ; !breakFound; j++ { - if j >= len(v) { - if canChange { - v = append(v, false) - changed = true - } else { - d.arrayCannotExpand(len(v), j+1) - } - } - slh.ElemContainerState(j) - if j < len(v) { - v[j] = dd.DecodeBool() + } + j := 0 + for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + if j == 0 && len(v) == 0 && canChange { + if hasLen { + xlen = decInferLen(containerLenS, d.h.MaxInitLen, 1) } else { - d.swallow() + xlen = 8 } - breakFound = dd.CheckBreak() + v = make([]bool, xlen) + changed = true } - if canChange && j < len(v) { + // if indefinite, etc, then expand the slice if necessary + var decodeIntoBlank bool + if j >= len(v) { + if canChange { + v = append(v, false) + changed = true + } else { + d.arrayCannotExpand(len(v), j+1) + decodeIntoBlank = true + } + } + slh.ElemContainerState(j) + if decodeIntoBlank { + d.swallow() + } else if dd.TryDecodeAsNil() { + v[j] = false + } else { + v[j] = dd.DecodeBool() + } + } + if canChange { + if j < len(v) { v = v[:j] changed = true + } else if j == 0 && v == nil { + v = make([]bool, 0) + changed = true } } slh.End() return v, changed } -func (f *decFnInfo) fastpathDecMapIntfIntfR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[interface{}]interface{}) - v, changed := fastpathTV.DecMapIntfIntfV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntfIntfR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[interface{}]interface{}) + v, changed := fastpathTV.DecMapIntfIntfV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[interface{}]interface{}) - fastpathTV.DecMapIntfIntfV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntfIntfV(rv2i(rv).(map[interface{}]interface{}), false, d) } } -func (f fastpathT) DecMapIntfIntfX(vp *map[interface{}]interface{}, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntfIntfV(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntfIntfX(vp *map[interface{}]interface{}, d *Decoder) { + v, changed := f.DecMapIntfIntfV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntfIntfV(v map[interface{}]interface{}, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntfIntfV(v map[interface{}]interface{}, canChange bool, d *Decoder) (_ map[interface{}]interface{}, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 32) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 32) v = make(map[interface{}]interface{}, xlen) changed = true } - mapGet := !d.h.MapValueReset && !d.h.InterfaceReset + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } + mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset var mk interface{} var mv interface{} - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] + mk = nil + d.decode(&mk) + if bv, bok := mk.([]byte); bok { + mk = d.string(bv) + } + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv + v[mk] = nil } + continue + } + if mapGet { + mv = v[mk] + } else { + mv = nil + } + d.decode(&mv) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntfStringR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[interface{}]string) - v, changed := fastpathTV.DecMapIntfStringV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntfStringR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[interface{}]string) + v, changed := fastpathTV.DecMapIntfStringV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[interface{}]string) - fastpathTV.DecMapIntfStringV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntfStringV(rv2i(rv).(map[interface{}]string), false, d) } } -func (f fastpathT) DecMapIntfStringX(vp *map[interface{}]string, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntfStringV(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntfStringX(vp *map[interface{}]string, d *Decoder) { + v, changed := f.DecMapIntfStringV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntfStringV(v map[interface{}]string, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntfStringV(v map[interface{}]string, canChange bool, d *Decoder) (_ map[interface{}]string, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 32) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 32) v = make(map[interface{}]string, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk interface{} var mv string - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv + mk = nil + d.decode(&mk) + if bv, bok := mk.([]byte); bok { + mk = d.string(bv) + } + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = "" } + continue + } + mv = dd.DecodeString() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntfUintR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[interface{}]uint) - v, changed := fastpathTV.DecMapIntfUintV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntfUintR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[interface{}]uint) + v, changed := fastpathTV.DecMapIntfUintV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[interface{}]uint) - fastpathTV.DecMapIntfUintV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntfUintV(rv2i(rv).(map[interface{}]uint), false, d) } } -func (f fastpathT) DecMapIntfUintX(vp *map[interface{}]uint, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntfUintV(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntfUintX(vp *map[interface{}]uint, d *Decoder) { + v, changed := f.DecMapIntfUintV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntfUintV(v map[interface{}]uint, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntfUintV(v map[interface{}]uint, canChange bool, d *Decoder) (_ map[interface{}]uint, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) v = make(map[interface{}]uint, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk interface{} var mv uint - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = nil + d.decode(&mk) + if bv, bok := mk.([]byte); bok { + mk = d.string(bv) + } + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntfUint8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[interface{}]uint8) - v, changed := fastpathTV.DecMapIntfUint8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntfUint8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[interface{}]uint8) + v, changed := fastpathTV.DecMapIntfUint8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[interface{}]uint8) - fastpathTV.DecMapIntfUint8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntfUint8V(rv2i(rv).(map[interface{}]uint8), false, d) } } -func (f fastpathT) DecMapIntfUint8X(vp *map[interface{}]uint8, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntfUint8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntfUint8X(vp *map[interface{}]uint8, d *Decoder) { + v, changed := f.DecMapIntfUint8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntfUint8V(v map[interface{}]uint8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntfUint8V(v map[interface{}]uint8, canChange bool, d *Decoder) (_ map[interface{}]uint8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) v = make(map[interface{}]uint8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk interface{} var mv uint8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv + mk = nil + d.decode(&mk) + if bv, bok := mk.([]byte); bok { + mk = d.string(bv) + } + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntfUint16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[interface{}]uint16) - v, changed := fastpathTV.DecMapIntfUint16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntfUint16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[interface{}]uint16) + v, changed := fastpathTV.DecMapIntfUint16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[interface{}]uint16) - fastpathTV.DecMapIntfUint16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntfUint16V(rv2i(rv).(map[interface{}]uint16), false, d) } } -func (f fastpathT) DecMapIntfUint16X(vp *map[interface{}]uint16, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntfUint16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntfUint16X(vp *map[interface{}]uint16, d *Decoder) { + v, changed := f.DecMapIntfUint16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntfUint16V(v map[interface{}]uint16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntfUint16V(v map[interface{}]uint16, canChange bool, d *Decoder) (_ map[interface{}]uint16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 18) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 18) v = make(map[interface{}]uint16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk interface{} var mv uint16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv + mk = nil + d.decode(&mk) + if bv, bok := mk.([]byte); bok { + mk = d.string(bv) + } + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntfUint32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[interface{}]uint32) - v, changed := fastpathTV.DecMapIntfUint32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntfUint32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[interface{}]uint32) + v, changed := fastpathTV.DecMapIntfUint32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[interface{}]uint32) - fastpathTV.DecMapIntfUint32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntfUint32V(rv2i(rv).(map[interface{}]uint32), false, d) } } -func (f fastpathT) DecMapIntfUint32X(vp *map[interface{}]uint32, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntfUint32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntfUint32X(vp *map[interface{}]uint32, d *Decoder) { + v, changed := f.DecMapIntfUint32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntfUint32V(v map[interface{}]uint32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntfUint32V(v map[interface{}]uint32, canChange bool, d *Decoder) (_ map[interface{}]uint32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) v = make(map[interface{}]uint32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk interface{} var mv uint32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv + mk = nil + d.decode(&mk) + if bv, bok := mk.([]byte); bok { + mk = d.string(bv) + } + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntfUint64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[interface{}]uint64) - v, changed := fastpathTV.DecMapIntfUint64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntfUint64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[interface{}]uint64) + v, changed := fastpathTV.DecMapIntfUint64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[interface{}]uint64) - fastpathTV.DecMapIntfUint64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntfUint64V(rv2i(rv).(map[interface{}]uint64), false, d) } } -func (f fastpathT) DecMapIntfUint64X(vp *map[interface{}]uint64, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntfUint64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntfUint64X(vp *map[interface{}]uint64, d *Decoder) { + v, changed := f.DecMapIntfUint64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntfUint64V(v map[interface{}]uint64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntfUint64V(v map[interface{}]uint64, canChange bool, d *Decoder) (_ map[interface{}]uint64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) v = make(map[interface{}]uint64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk interface{} var mv uint64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv + mk = nil + d.decode(&mk) + if bv, bok := mk.([]byte); bok { + mk = d.string(bv) + } + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeUint64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntfUintptrR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[interface{}]uintptr) - v, changed := fastpathTV.DecMapIntfUintptrV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntfUintptrR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[interface{}]uintptr) + v, changed := fastpathTV.DecMapIntfUintptrV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[interface{}]uintptr) - fastpathTV.DecMapIntfUintptrV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntfUintptrV(rv2i(rv).(map[interface{}]uintptr), false, d) } } -func (f fastpathT) DecMapIntfUintptrX(vp *map[interface{}]uintptr, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntfUintptrV(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntfUintptrX(vp *map[interface{}]uintptr, d *Decoder) { + v, changed := f.DecMapIntfUintptrV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntfUintptrV(v map[interface{}]uintptr, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntfUintptrV(v map[interface{}]uintptr, canChange bool, d *Decoder) (_ map[interface{}]uintptr, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) v = make(map[interface{}]uintptr, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk interface{} var mv uintptr - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = nil + d.decode(&mk) + if bv, bok := mk.([]byte); bok { + mk = d.string(bv) + } + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntfIntR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[interface{}]int) - v, changed := fastpathTV.DecMapIntfIntV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntfIntR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[interface{}]int) + v, changed := fastpathTV.DecMapIntfIntV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[interface{}]int) - fastpathTV.DecMapIntfIntV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntfIntV(rv2i(rv).(map[interface{}]int), false, d) } } -func (f fastpathT) DecMapIntfIntX(vp *map[interface{}]int, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntfIntV(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntfIntX(vp *map[interface{}]int, d *Decoder) { + v, changed := f.DecMapIntfIntV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntfIntV(v map[interface{}]int, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntfIntV(v map[interface{}]int, canChange bool, d *Decoder) (_ map[interface{}]int, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) v = make(map[interface{}]int, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk interface{} var mv int - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv + mk = nil + d.decode(&mk) + if bv, bok := mk.([]byte); bok { + mk = d.string(bv) + } + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntfInt8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[interface{}]int8) - v, changed := fastpathTV.DecMapIntfInt8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntfInt8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[interface{}]int8) + v, changed := fastpathTV.DecMapIntfInt8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[interface{}]int8) - fastpathTV.DecMapIntfInt8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntfInt8V(rv2i(rv).(map[interface{}]int8), false, d) } } -func (f fastpathT) DecMapIntfInt8X(vp *map[interface{}]int8, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntfInt8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntfInt8X(vp *map[interface{}]int8, d *Decoder) { + v, changed := f.DecMapIntfInt8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntfInt8V(v map[interface{}]int8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntfInt8V(v map[interface{}]int8, canChange bool, d *Decoder) (_ map[interface{}]int8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) v = make(map[interface{}]int8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk interface{} var mv int8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv + mk = nil + d.decode(&mk) + if bv, bok := mk.([]byte); bok { + mk = d.string(bv) + } + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntfInt16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[interface{}]int16) - v, changed := fastpathTV.DecMapIntfInt16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntfInt16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[interface{}]int16) + v, changed := fastpathTV.DecMapIntfInt16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[interface{}]int16) - fastpathTV.DecMapIntfInt16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntfInt16V(rv2i(rv).(map[interface{}]int16), false, d) } } -func (f fastpathT) DecMapIntfInt16X(vp *map[interface{}]int16, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntfInt16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntfInt16X(vp *map[interface{}]int16, d *Decoder) { + v, changed := f.DecMapIntfInt16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntfInt16V(v map[interface{}]int16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntfInt16V(v map[interface{}]int16, canChange bool, d *Decoder) (_ map[interface{}]int16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 18) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 18) v = make(map[interface{}]int16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk interface{} var mv int16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv + mk = nil + d.decode(&mk) + if bv, bok := mk.([]byte); bok { + mk = d.string(bv) + } + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntfInt32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[interface{}]int32) - v, changed := fastpathTV.DecMapIntfInt32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntfInt32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[interface{}]int32) + v, changed := fastpathTV.DecMapIntfInt32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[interface{}]int32) - fastpathTV.DecMapIntfInt32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntfInt32V(rv2i(rv).(map[interface{}]int32), false, d) } } -func (f fastpathT) DecMapIntfInt32X(vp *map[interface{}]int32, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntfInt32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntfInt32X(vp *map[interface{}]int32, d *Decoder) { + v, changed := f.DecMapIntfInt32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntfInt32V(v map[interface{}]int32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntfInt32V(v map[interface{}]int32, canChange bool, d *Decoder) (_ map[interface{}]int32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) v = make(map[interface{}]int32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk interface{} var mv int32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv + mk = nil + d.decode(&mk) + if bv, bok := mk.([]byte); bok { + mk = d.string(bv) + } + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntfInt64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[interface{}]int64) - v, changed := fastpathTV.DecMapIntfInt64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntfInt64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[interface{}]int64) + v, changed := fastpathTV.DecMapIntfInt64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[interface{}]int64) - fastpathTV.DecMapIntfInt64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntfInt64V(rv2i(rv).(map[interface{}]int64), false, d) } } -func (f fastpathT) DecMapIntfInt64X(vp *map[interface{}]int64, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntfInt64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntfInt64X(vp *map[interface{}]int64, d *Decoder) { + v, changed := f.DecMapIntfInt64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntfInt64V(v map[interface{}]int64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntfInt64V(v map[interface{}]int64, canChange bool, d *Decoder) (_ map[interface{}]int64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) v = make(map[interface{}]int64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk interface{} var mv int64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv + mk = nil + d.decode(&mk) + if bv, bok := mk.([]byte); bok { + mk = d.string(bv) + } + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeInt64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntfFloat32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[interface{}]float32) - v, changed := fastpathTV.DecMapIntfFloat32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntfFloat32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[interface{}]float32) + v, changed := fastpathTV.DecMapIntfFloat32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[interface{}]float32) - fastpathTV.DecMapIntfFloat32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntfFloat32V(rv2i(rv).(map[interface{}]float32), false, d) } } -func (f fastpathT) DecMapIntfFloat32X(vp *map[interface{}]float32, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntfFloat32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntfFloat32X(vp *map[interface{}]float32, d *Decoder) { + v, changed := f.DecMapIntfFloat32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntfFloat32V(v map[interface{}]float32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntfFloat32V(v map[interface{}]float32, canChange bool, d *Decoder) (_ map[interface{}]float32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) v = make(map[interface{}]float32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk interface{} var mv float32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv + mk = nil + d.decode(&mk) + if bv, bok := mk.([]byte); bok { + mk = d.string(bv) + } + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntfFloat64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[interface{}]float64) - v, changed := fastpathTV.DecMapIntfFloat64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntfFloat64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[interface{}]float64) + v, changed := fastpathTV.DecMapIntfFloat64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[interface{}]float64) - fastpathTV.DecMapIntfFloat64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntfFloat64V(rv2i(rv).(map[interface{}]float64), false, d) } } -func (f fastpathT) DecMapIntfFloat64X(vp *map[interface{}]float64, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntfFloat64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntfFloat64X(vp *map[interface{}]float64, d *Decoder) { + v, changed := f.DecMapIntfFloat64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntfFloat64V(v map[interface{}]float64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntfFloat64V(v map[interface{}]float64, canChange bool, d *Decoder) (_ map[interface{}]float64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) v = make(map[interface{}]float64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk interface{} var mv float64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv + mk = nil + d.decode(&mk) + if bv, bok := mk.([]byte); bok { + mk = d.string(bv) + } + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeFloat64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntfBoolR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[interface{}]bool) - v, changed := fastpathTV.DecMapIntfBoolV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntfBoolR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[interface{}]bool) + v, changed := fastpathTV.DecMapIntfBoolV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[interface{}]bool) - fastpathTV.DecMapIntfBoolV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntfBoolV(rv2i(rv).(map[interface{}]bool), false, d) } } -func (f fastpathT) DecMapIntfBoolX(vp *map[interface{}]bool, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntfBoolV(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntfBoolX(vp *map[interface{}]bool, d *Decoder) { + v, changed := f.DecMapIntfBoolV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntfBoolV(v map[interface{}]bool, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntfBoolV(v map[interface{}]bool, canChange bool, d *Decoder) (_ map[interface{}]bool, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) v = make(map[interface{}]bool, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk interface{} var mv bool - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) - } - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv + mk = nil + d.decode(&mk) + if bv, bok := mk.([]byte); bok { + mk = d.string(bv) + } + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = false } + continue + } + mv = dd.DecodeBool() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapStringIntfR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[string]interface{}) - v, changed := fastpathTV.DecMapStringIntfV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapStringIntfR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[string]interface{}) + v, changed := fastpathTV.DecMapStringIntfV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[string]interface{}) - fastpathTV.DecMapStringIntfV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapStringIntfV(rv2i(rv).(map[string]interface{}), false, d) } } -func (f fastpathT) DecMapStringIntfX(vp *map[string]interface{}, checkNil bool, d *Decoder) { - v, changed := f.DecMapStringIntfV(*vp, checkNil, true, d) +func (f fastpathT) DecMapStringIntfX(vp *map[string]interface{}, d *Decoder) { + v, changed := f.DecMapStringIntfV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapStringIntfV(v map[string]interface{}, checkNil bool, canChange bool, +func (_ fastpathT) DecMapStringIntfV(v map[string]interface{}, canChange bool, d *Decoder) (_ map[string]interface{}, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 32) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 32) v = make(map[string]interface{}, xlen) changed = true } - mapGet := !d.h.MapValueReset && !d.h.InterfaceReset + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } + mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset var mk string var mv interface{} - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] + mk = dd.DecodeString() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv + v[mk] = nil } + continue + } + if mapGet { + mv = v[mk] + } else { + mv = nil + } + d.decode(&mv) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapStringStringR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[string]string) - v, changed := fastpathTV.DecMapStringStringV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapStringStringR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[string]string) + v, changed := fastpathTV.DecMapStringStringV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[string]string) - fastpathTV.DecMapStringStringV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapStringStringV(rv2i(rv).(map[string]string), false, d) } } -func (f fastpathT) DecMapStringStringX(vp *map[string]string, checkNil bool, d *Decoder) { - v, changed := f.DecMapStringStringV(*vp, checkNil, true, d) +func (f fastpathT) DecMapStringStringX(vp *map[string]string, d *Decoder) { + v, changed := f.DecMapStringStringV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapStringStringV(v map[string]string, checkNil bool, canChange bool, +func (_ fastpathT) DecMapStringStringV(v map[string]string, canChange bool, d *Decoder) (_ map[string]string, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 32) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 32) v = make(map[string]string, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk string var mv string - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv + mk = dd.DecodeString() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = "" } + continue + } + mv = dd.DecodeString() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapStringUintR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[string]uint) - v, changed := fastpathTV.DecMapStringUintV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapStringUintR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[string]uint) + v, changed := fastpathTV.DecMapStringUintV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[string]uint) - fastpathTV.DecMapStringUintV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapStringUintV(rv2i(rv).(map[string]uint), false, d) } } -func (f fastpathT) DecMapStringUintX(vp *map[string]uint, checkNil bool, d *Decoder) { - v, changed := f.DecMapStringUintV(*vp, checkNil, true, d) +func (f fastpathT) DecMapStringUintX(vp *map[string]uint, d *Decoder) { + v, changed := f.DecMapStringUintV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapStringUintV(v map[string]uint, checkNil bool, canChange bool, +func (_ fastpathT) DecMapStringUintV(v map[string]uint, canChange bool, d *Decoder) (_ map[string]uint, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) v = make(map[string]uint, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk string var mv uint - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = dd.DecodeString() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapStringUint8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[string]uint8) - v, changed := fastpathTV.DecMapStringUint8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapStringUint8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[string]uint8) + v, changed := fastpathTV.DecMapStringUint8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[string]uint8) - fastpathTV.DecMapStringUint8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapStringUint8V(rv2i(rv).(map[string]uint8), false, d) } } -func (f fastpathT) DecMapStringUint8X(vp *map[string]uint8, checkNil bool, d *Decoder) { - v, changed := f.DecMapStringUint8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapStringUint8X(vp *map[string]uint8, d *Decoder) { + v, changed := f.DecMapStringUint8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapStringUint8V(v map[string]uint8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapStringUint8V(v map[string]uint8, canChange bool, d *Decoder) (_ map[string]uint8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) v = make(map[string]uint8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk string var mv uint8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv + mk = dd.DecodeString() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapStringUint16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[string]uint16) - v, changed := fastpathTV.DecMapStringUint16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapStringUint16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[string]uint16) + v, changed := fastpathTV.DecMapStringUint16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[string]uint16) - fastpathTV.DecMapStringUint16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapStringUint16V(rv2i(rv).(map[string]uint16), false, d) } } -func (f fastpathT) DecMapStringUint16X(vp *map[string]uint16, checkNil bool, d *Decoder) { - v, changed := f.DecMapStringUint16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapStringUint16X(vp *map[string]uint16, d *Decoder) { + v, changed := f.DecMapStringUint16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapStringUint16V(v map[string]uint16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapStringUint16V(v map[string]uint16, canChange bool, d *Decoder) (_ map[string]uint16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 18) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 18) v = make(map[string]uint16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk string var mv uint16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv + mk = dd.DecodeString() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapStringUint32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[string]uint32) - v, changed := fastpathTV.DecMapStringUint32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapStringUint32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[string]uint32) + v, changed := fastpathTV.DecMapStringUint32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[string]uint32) - fastpathTV.DecMapStringUint32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapStringUint32V(rv2i(rv).(map[string]uint32), false, d) } } -func (f fastpathT) DecMapStringUint32X(vp *map[string]uint32, checkNil bool, d *Decoder) { - v, changed := f.DecMapStringUint32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapStringUint32X(vp *map[string]uint32, d *Decoder) { + v, changed := f.DecMapStringUint32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapStringUint32V(v map[string]uint32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapStringUint32V(v map[string]uint32, canChange bool, d *Decoder) (_ map[string]uint32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) v = make(map[string]uint32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk string var mv uint32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv + mk = dd.DecodeString() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapStringUint64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[string]uint64) - v, changed := fastpathTV.DecMapStringUint64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapStringUint64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[string]uint64) + v, changed := fastpathTV.DecMapStringUint64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[string]uint64) - fastpathTV.DecMapStringUint64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapStringUint64V(rv2i(rv).(map[string]uint64), false, d) } } -func (f fastpathT) DecMapStringUint64X(vp *map[string]uint64, checkNil bool, d *Decoder) { - v, changed := f.DecMapStringUint64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapStringUint64X(vp *map[string]uint64, d *Decoder) { + v, changed := f.DecMapStringUint64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapStringUint64V(v map[string]uint64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapStringUint64V(v map[string]uint64, canChange bool, d *Decoder) (_ map[string]uint64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) v = make(map[string]uint64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk string var mv uint64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv + mk = dd.DecodeString() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeUint64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapStringUintptrR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[string]uintptr) - v, changed := fastpathTV.DecMapStringUintptrV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapStringUintptrR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[string]uintptr) + v, changed := fastpathTV.DecMapStringUintptrV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[string]uintptr) - fastpathTV.DecMapStringUintptrV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapStringUintptrV(rv2i(rv).(map[string]uintptr), false, d) } } -func (f fastpathT) DecMapStringUintptrX(vp *map[string]uintptr, checkNil bool, d *Decoder) { - v, changed := f.DecMapStringUintptrV(*vp, checkNil, true, d) +func (f fastpathT) DecMapStringUintptrX(vp *map[string]uintptr, d *Decoder) { + v, changed := f.DecMapStringUintptrV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapStringUintptrV(v map[string]uintptr, checkNil bool, canChange bool, +func (_ fastpathT) DecMapStringUintptrV(v map[string]uintptr, canChange bool, d *Decoder) (_ map[string]uintptr, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) v = make(map[string]uintptr, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk string var mv uintptr - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = dd.DecodeString() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapStringIntR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[string]int) - v, changed := fastpathTV.DecMapStringIntV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapStringIntR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[string]int) + v, changed := fastpathTV.DecMapStringIntV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[string]int) - fastpathTV.DecMapStringIntV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapStringIntV(rv2i(rv).(map[string]int), false, d) } } -func (f fastpathT) DecMapStringIntX(vp *map[string]int, checkNil bool, d *Decoder) { - v, changed := f.DecMapStringIntV(*vp, checkNil, true, d) +func (f fastpathT) DecMapStringIntX(vp *map[string]int, d *Decoder) { + v, changed := f.DecMapStringIntV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapStringIntV(v map[string]int, checkNil bool, canChange bool, +func (_ fastpathT) DecMapStringIntV(v map[string]int, canChange bool, d *Decoder) (_ map[string]int, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) v = make(map[string]int, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk string var mv int - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv + mk = dd.DecodeString() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapStringInt8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[string]int8) - v, changed := fastpathTV.DecMapStringInt8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapStringInt8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[string]int8) + v, changed := fastpathTV.DecMapStringInt8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[string]int8) - fastpathTV.DecMapStringInt8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapStringInt8V(rv2i(rv).(map[string]int8), false, d) } } -func (f fastpathT) DecMapStringInt8X(vp *map[string]int8, checkNil bool, d *Decoder) { - v, changed := f.DecMapStringInt8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapStringInt8X(vp *map[string]int8, d *Decoder) { + v, changed := f.DecMapStringInt8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapStringInt8V(v map[string]int8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapStringInt8V(v map[string]int8, canChange bool, d *Decoder) (_ map[string]int8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) v = make(map[string]int8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk string var mv int8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv + mk = dd.DecodeString() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapStringInt16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[string]int16) - v, changed := fastpathTV.DecMapStringInt16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapStringInt16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[string]int16) + v, changed := fastpathTV.DecMapStringInt16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[string]int16) - fastpathTV.DecMapStringInt16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapStringInt16V(rv2i(rv).(map[string]int16), false, d) } } -func (f fastpathT) DecMapStringInt16X(vp *map[string]int16, checkNil bool, d *Decoder) { - v, changed := f.DecMapStringInt16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapStringInt16X(vp *map[string]int16, d *Decoder) { + v, changed := f.DecMapStringInt16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapStringInt16V(v map[string]int16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapStringInt16V(v map[string]int16, canChange bool, d *Decoder) (_ map[string]int16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 18) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 18) v = make(map[string]int16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk string var mv int16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv + mk = dd.DecodeString() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapStringInt32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[string]int32) - v, changed := fastpathTV.DecMapStringInt32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapStringInt32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[string]int32) + v, changed := fastpathTV.DecMapStringInt32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[string]int32) - fastpathTV.DecMapStringInt32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapStringInt32V(rv2i(rv).(map[string]int32), false, d) } } -func (f fastpathT) DecMapStringInt32X(vp *map[string]int32, checkNil bool, d *Decoder) { - v, changed := f.DecMapStringInt32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapStringInt32X(vp *map[string]int32, d *Decoder) { + v, changed := f.DecMapStringInt32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapStringInt32V(v map[string]int32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapStringInt32V(v map[string]int32, canChange bool, d *Decoder) (_ map[string]int32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) v = make(map[string]int32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk string var mv int32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv + mk = dd.DecodeString() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapStringInt64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[string]int64) - v, changed := fastpathTV.DecMapStringInt64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapStringInt64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[string]int64) + v, changed := fastpathTV.DecMapStringInt64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[string]int64) - fastpathTV.DecMapStringInt64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapStringInt64V(rv2i(rv).(map[string]int64), false, d) } } -func (f fastpathT) DecMapStringInt64X(vp *map[string]int64, checkNil bool, d *Decoder) { - v, changed := f.DecMapStringInt64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapStringInt64X(vp *map[string]int64, d *Decoder) { + v, changed := f.DecMapStringInt64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapStringInt64V(v map[string]int64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapStringInt64V(v map[string]int64, canChange bool, d *Decoder) (_ map[string]int64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) v = make(map[string]int64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk string var mv int64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv + mk = dd.DecodeString() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeInt64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapStringFloat32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[string]float32) - v, changed := fastpathTV.DecMapStringFloat32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapStringFloat32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[string]float32) + v, changed := fastpathTV.DecMapStringFloat32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[string]float32) - fastpathTV.DecMapStringFloat32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapStringFloat32V(rv2i(rv).(map[string]float32), false, d) } } -func (f fastpathT) DecMapStringFloat32X(vp *map[string]float32, checkNil bool, d *Decoder) { - v, changed := f.DecMapStringFloat32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapStringFloat32X(vp *map[string]float32, d *Decoder) { + v, changed := f.DecMapStringFloat32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapStringFloat32V(v map[string]float32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapStringFloat32V(v map[string]float32, canChange bool, d *Decoder) (_ map[string]float32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) v = make(map[string]float32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk string var mv float32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv + mk = dd.DecodeString() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapStringFloat64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[string]float64) - v, changed := fastpathTV.DecMapStringFloat64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapStringFloat64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[string]float64) + v, changed := fastpathTV.DecMapStringFloat64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[string]float64) - fastpathTV.DecMapStringFloat64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapStringFloat64V(rv2i(rv).(map[string]float64), false, d) } } -func (f fastpathT) DecMapStringFloat64X(vp *map[string]float64, checkNil bool, d *Decoder) { - v, changed := f.DecMapStringFloat64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapStringFloat64X(vp *map[string]float64, d *Decoder) { + v, changed := f.DecMapStringFloat64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapStringFloat64V(v map[string]float64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapStringFloat64V(v map[string]float64, canChange bool, d *Decoder) (_ map[string]float64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) v = make(map[string]float64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk string var mv float64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv + mk = dd.DecodeString() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeFloat64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapStringBoolR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[string]bool) - v, changed := fastpathTV.DecMapStringBoolV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapStringBoolR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[string]bool) + v, changed := fastpathTV.DecMapStringBoolV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[string]bool) - fastpathTV.DecMapStringBoolV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapStringBoolV(rv2i(rv).(map[string]bool), false, d) } } -func (f fastpathT) DecMapStringBoolX(vp *map[string]bool, checkNil bool, d *Decoder) { - v, changed := f.DecMapStringBoolV(*vp, checkNil, true, d) +func (f fastpathT) DecMapStringBoolX(vp *map[string]bool, d *Decoder) { + v, changed := f.DecMapStringBoolV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapStringBoolV(v map[string]bool, checkNil bool, canChange bool, +func (_ fastpathT) DecMapStringBoolV(v map[string]bool, canChange bool, d *Decoder) (_ map[string]bool, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) v = make(map[string]bool, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk string var mv bool - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeString() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv + mk = dd.DecodeString() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = false } + continue + } + mv = dd.DecodeBool() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat32IntfR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float32]interface{}) - v, changed := fastpathTV.DecMapFloat32IntfV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat32IntfR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float32]interface{}) + v, changed := fastpathTV.DecMapFloat32IntfV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float32]interface{}) - fastpathTV.DecMapFloat32IntfV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat32IntfV(rv2i(rv).(map[float32]interface{}), false, d) } } -func (f fastpathT) DecMapFloat32IntfX(vp *map[float32]interface{}, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat32IntfV(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat32IntfX(vp *map[float32]interface{}, d *Decoder) { + v, changed := f.DecMapFloat32IntfV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat32IntfV(v map[float32]interface{}, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat32IntfV(v map[float32]interface{}, canChange bool, d *Decoder) (_ map[float32]interface{}, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) v = make(map[float32]interface{}, xlen) changed = true } - mapGet := !d.h.MapValueReset && !d.h.InterfaceReset + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } + mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset var mk float32 var mv interface{} - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] + mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv + v[mk] = nil } + continue + } + if mapGet { + mv = v[mk] + } else { + mv = nil + } + d.decode(&mv) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat32StringR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float32]string) - v, changed := fastpathTV.DecMapFloat32StringV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat32StringR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float32]string) + v, changed := fastpathTV.DecMapFloat32StringV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float32]string) - fastpathTV.DecMapFloat32StringV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat32StringV(rv2i(rv).(map[float32]string), false, d) } } -func (f fastpathT) DecMapFloat32StringX(vp *map[float32]string, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat32StringV(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat32StringX(vp *map[float32]string, d *Decoder) { + v, changed := f.DecMapFloat32StringV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat32StringV(v map[float32]string, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat32StringV(v map[float32]string, canChange bool, d *Decoder) (_ map[float32]string, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) v = make(map[float32]string, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float32 var mv string - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv + mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = "" } + continue + } + mv = dd.DecodeString() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat32UintR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float32]uint) - v, changed := fastpathTV.DecMapFloat32UintV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat32UintR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float32]uint) + v, changed := fastpathTV.DecMapFloat32UintV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float32]uint) - fastpathTV.DecMapFloat32UintV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat32UintV(rv2i(rv).(map[float32]uint), false, d) } } -func (f fastpathT) DecMapFloat32UintX(vp *map[float32]uint, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat32UintV(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat32UintX(vp *map[float32]uint, d *Decoder) { + v, changed := f.DecMapFloat32UintV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat32UintV(v map[float32]uint, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat32UintV(v map[float32]uint, canChange bool, d *Decoder) (_ map[float32]uint, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[float32]uint, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float32 var mv uint - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat32Uint8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float32]uint8) - v, changed := fastpathTV.DecMapFloat32Uint8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat32Uint8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float32]uint8) + v, changed := fastpathTV.DecMapFloat32Uint8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float32]uint8) - fastpathTV.DecMapFloat32Uint8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat32Uint8V(rv2i(rv).(map[float32]uint8), false, d) } } -func (f fastpathT) DecMapFloat32Uint8X(vp *map[float32]uint8, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat32Uint8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat32Uint8X(vp *map[float32]uint8, d *Decoder) { + v, changed := f.DecMapFloat32Uint8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat32Uint8V(v map[float32]uint8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat32Uint8V(v map[float32]uint8, canChange bool, d *Decoder) (_ map[float32]uint8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) v = make(map[float32]uint8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float32 var mv uint8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv + mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat32Uint16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float32]uint16) - v, changed := fastpathTV.DecMapFloat32Uint16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat32Uint16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float32]uint16) + v, changed := fastpathTV.DecMapFloat32Uint16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float32]uint16) - fastpathTV.DecMapFloat32Uint16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat32Uint16V(rv2i(rv).(map[float32]uint16), false, d) } } -func (f fastpathT) DecMapFloat32Uint16X(vp *map[float32]uint16, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat32Uint16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat32Uint16X(vp *map[float32]uint16, d *Decoder) { + v, changed := f.DecMapFloat32Uint16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat32Uint16V(v map[float32]uint16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat32Uint16V(v map[float32]uint16, canChange bool, d *Decoder) (_ map[float32]uint16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 6) v = make(map[float32]uint16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float32 var mv uint16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv + mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat32Uint32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float32]uint32) - v, changed := fastpathTV.DecMapFloat32Uint32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat32Uint32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float32]uint32) + v, changed := fastpathTV.DecMapFloat32Uint32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float32]uint32) - fastpathTV.DecMapFloat32Uint32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat32Uint32V(rv2i(rv).(map[float32]uint32), false, d) } } -func (f fastpathT) DecMapFloat32Uint32X(vp *map[float32]uint32, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat32Uint32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat32Uint32X(vp *map[float32]uint32, d *Decoder) { + v, changed := f.DecMapFloat32Uint32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat32Uint32V(v map[float32]uint32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat32Uint32V(v map[float32]uint32, canChange bool, d *Decoder) (_ map[float32]uint32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 8) v = make(map[float32]uint32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float32 var mv uint32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv + mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat32Uint64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float32]uint64) - v, changed := fastpathTV.DecMapFloat32Uint64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat32Uint64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float32]uint64) + v, changed := fastpathTV.DecMapFloat32Uint64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float32]uint64) - fastpathTV.DecMapFloat32Uint64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat32Uint64V(rv2i(rv).(map[float32]uint64), false, d) } } -func (f fastpathT) DecMapFloat32Uint64X(vp *map[float32]uint64, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat32Uint64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat32Uint64X(vp *map[float32]uint64, d *Decoder) { + v, changed := f.DecMapFloat32Uint64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat32Uint64V(v map[float32]uint64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat32Uint64V(v map[float32]uint64, canChange bool, d *Decoder) (_ map[float32]uint64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[float32]uint64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float32 var mv uint64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv + mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeUint64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat32UintptrR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float32]uintptr) - v, changed := fastpathTV.DecMapFloat32UintptrV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat32UintptrR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float32]uintptr) + v, changed := fastpathTV.DecMapFloat32UintptrV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float32]uintptr) - fastpathTV.DecMapFloat32UintptrV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat32UintptrV(rv2i(rv).(map[float32]uintptr), false, d) } } -func (f fastpathT) DecMapFloat32UintptrX(vp *map[float32]uintptr, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat32UintptrV(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat32UintptrX(vp *map[float32]uintptr, d *Decoder) { + v, changed := f.DecMapFloat32UintptrV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat32UintptrV(v map[float32]uintptr, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat32UintptrV(v map[float32]uintptr, canChange bool, d *Decoder) (_ map[float32]uintptr, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[float32]uintptr, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float32 var mv uintptr - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat32IntR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float32]int) - v, changed := fastpathTV.DecMapFloat32IntV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat32IntR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float32]int) + v, changed := fastpathTV.DecMapFloat32IntV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float32]int) - fastpathTV.DecMapFloat32IntV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat32IntV(rv2i(rv).(map[float32]int), false, d) } } -func (f fastpathT) DecMapFloat32IntX(vp *map[float32]int, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat32IntV(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat32IntX(vp *map[float32]int, d *Decoder) { + v, changed := f.DecMapFloat32IntV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat32IntV(v map[float32]int, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat32IntV(v map[float32]int, canChange bool, d *Decoder) (_ map[float32]int, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[float32]int, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float32 var mv int - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv + mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat32Int8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float32]int8) - v, changed := fastpathTV.DecMapFloat32Int8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat32Int8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float32]int8) + v, changed := fastpathTV.DecMapFloat32Int8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float32]int8) - fastpathTV.DecMapFloat32Int8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat32Int8V(rv2i(rv).(map[float32]int8), false, d) } } -func (f fastpathT) DecMapFloat32Int8X(vp *map[float32]int8, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat32Int8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat32Int8X(vp *map[float32]int8, d *Decoder) { + v, changed := f.DecMapFloat32Int8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat32Int8V(v map[float32]int8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat32Int8V(v map[float32]int8, canChange bool, d *Decoder) (_ map[float32]int8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) v = make(map[float32]int8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float32 var mv int8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv + mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat32Int16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float32]int16) - v, changed := fastpathTV.DecMapFloat32Int16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat32Int16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float32]int16) + v, changed := fastpathTV.DecMapFloat32Int16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float32]int16) - fastpathTV.DecMapFloat32Int16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat32Int16V(rv2i(rv).(map[float32]int16), false, d) } } -func (f fastpathT) DecMapFloat32Int16X(vp *map[float32]int16, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat32Int16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat32Int16X(vp *map[float32]int16, d *Decoder) { + v, changed := f.DecMapFloat32Int16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat32Int16V(v map[float32]int16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat32Int16V(v map[float32]int16, canChange bool, d *Decoder) (_ map[float32]int16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 6) v = make(map[float32]int16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float32 var mv int16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv + mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat32Int32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float32]int32) - v, changed := fastpathTV.DecMapFloat32Int32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat32Int32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float32]int32) + v, changed := fastpathTV.DecMapFloat32Int32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float32]int32) - fastpathTV.DecMapFloat32Int32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat32Int32V(rv2i(rv).(map[float32]int32), false, d) } } -func (f fastpathT) DecMapFloat32Int32X(vp *map[float32]int32, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat32Int32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat32Int32X(vp *map[float32]int32, d *Decoder) { + v, changed := f.DecMapFloat32Int32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat32Int32V(v map[float32]int32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat32Int32V(v map[float32]int32, canChange bool, d *Decoder) (_ map[float32]int32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 8) v = make(map[float32]int32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float32 var mv int32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv + mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat32Int64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float32]int64) - v, changed := fastpathTV.DecMapFloat32Int64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat32Int64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float32]int64) + v, changed := fastpathTV.DecMapFloat32Int64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float32]int64) - fastpathTV.DecMapFloat32Int64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat32Int64V(rv2i(rv).(map[float32]int64), false, d) } } -func (f fastpathT) DecMapFloat32Int64X(vp *map[float32]int64, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat32Int64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat32Int64X(vp *map[float32]int64, d *Decoder) { + v, changed := f.DecMapFloat32Int64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat32Int64V(v map[float32]int64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat32Int64V(v map[float32]int64, canChange bool, d *Decoder) (_ map[float32]int64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[float32]int64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float32 var mv int64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv + mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeInt64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat32Float32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float32]float32) - v, changed := fastpathTV.DecMapFloat32Float32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat32Float32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float32]float32) + v, changed := fastpathTV.DecMapFloat32Float32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float32]float32) - fastpathTV.DecMapFloat32Float32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat32Float32V(rv2i(rv).(map[float32]float32), false, d) } } -func (f fastpathT) DecMapFloat32Float32X(vp *map[float32]float32, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat32Float32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat32Float32X(vp *map[float32]float32, d *Decoder) { + v, changed := f.DecMapFloat32Float32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat32Float32V(v map[float32]float32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat32Float32V(v map[float32]float32, canChange bool, d *Decoder) (_ map[float32]float32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 8) v = make(map[float32]float32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float32 var mv float32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv + mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat32Float64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float32]float64) - v, changed := fastpathTV.DecMapFloat32Float64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat32Float64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float32]float64) + v, changed := fastpathTV.DecMapFloat32Float64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float32]float64) - fastpathTV.DecMapFloat32Float64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat32Float64V(rv2i(rv).(map[float32]float64), false, d) } } -func (f fastpathT) DecMapFloat32Float64X(vp *map[float32]float64, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat32Float64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat32Float64X(vp *map[float32]float64, d *Decoder) { + v, changed := f.DecMapFloat32Float64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat32Float64V(v map[float32]float64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat32Float64V(v map[float32]float64, canChange bool, d *Decoder) (_ map[float32]float64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[float32]float64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float32 var mv float64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv + mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeFloat64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat32BoolR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float32]bool) - v, changed := fastpathTV.DecMapFloat32BoolV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat32BoolR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float32]bool) + v, changed := fastpathTV.DecMapFloat32BoolV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float32]bool) - fastpathTV.DecMapFloat32BoolV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat32BoolV(rv2i(rv).(map[float32]bool), false, d) } } -func (f fastpathT) DecMapFloat32BoolX(vp *map[float32]bool, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat32BoolV(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat32BoolX(vp *map[float32]bool, d *Decoder) { + v, changed := f.DecMapFloat32BoolV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat32BoolV(v map[float32]bool, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat32BoolV(v map[float32]bool, canChange bool, d *Decoder) (_ map[float32]bool, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) v = make(map[float32]bool, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float32 var mv bool - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = float32(dd.DecodeFloat(true)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv + mk = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = false } + continue + } + mv = dd.DecodeBool() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat64IntfR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float64]interface{}) - v, changed := fastpathTV.DecMapFloat64IntfV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat64IntfR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float64]interface{}) + v, changed := fastpathTV.DecMapFloat64IntfV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float64]interface{}) - fastpathTV.DecMapFloat64IntfV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat64IntfV(rv2i(rv).(map[float64]interface{}), false, d) } } -func (f fastpathT) DecMapFloat64IntfX(vp *map[float64]interface{}, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat64IntfV(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat64IntfX(vp *map[float64]interface{}, d *Decoder) { + v, changed := f.DecMapFloat64IntfV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat64IntfV(v map[float64]interface{}, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat64IntfV(v map[float64]interface{}, canChange bool, d *Decoder) (_ map[float64]interface{}, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) v = make(map[float64]interface{}, xlen) changed = true } - mapGet := !d.h.MapValueReset && !d.h.InterfaceReset + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } + mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset var mk float64 var mv interface{} - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] + mk = dd.DecodeFloat64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv + v[mk] = nil } + continue + } + if mapGet { + mv = v[mk] + } else { + mv = nil + } + d.decode(&mv) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat64StringR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float64]string) - v, changed := fastpathTV.DecMapFloat64StringV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat64StringR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float64]string) + v, changed := fastpathTV.DecMapFloat64StringV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float64]string) - fastpathTV.DecMapFloat64StringV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat64StringV(rv2i(rv).(map[float64]string), false, d) } } -func (f fastpathT) DecMapFloat64StringX(vp *map[float64]string, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat64StringV(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat64StringX(vp *map[float64]string, d *Decoder) { + v, changed := f.DecMapFloat64StringV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat64StringV(v map[float64]string, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat64StringV(v map[float64]string, canChange bool, d *Decoder) (_ map[float64]string, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) v = make(map[float64]string, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float64 var mv string - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv + mk = dd.DecodeFloat64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = "" } + continue + } + mv = dd.DecodeString() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat64UintR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float64]uint) - v, changed := fastpathTV.DecMapFloat64UintV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat64UintR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float64]uint) + v, changed := fastpathTV.DecMapFloat64UintV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float64]uint) - fastpathTV.DecMapFloat64UintV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat64UintV(rv2i(rv).(map[float64]uint), false, d) } } -func (f fastpathT) DecMapFloat64UintX(vp *map[float64]uint, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat64UintV(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat64UintX(vp *map[float64]uint, d *Decoder) { + v, changed := f.DecMapFloat64UintV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat64UintV(v map[float64]uint, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat64UintV(v map[float64]uint, canChange bool, d *Decoder) (_ map[float64]uint, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[float64]uint, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float64 var mv uint - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = dd.DecodeFloat64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat64Uint8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float64]uint8) - v, changed := fastpathTV.DecMapFloat64Uint8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat64Uint8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float64]uint8) + v, changed := fastpathTV.DecMapFloat64Uint8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float64]uint8) - fastpathTV.DecMapFloat64Uint8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat64Uint8V(rv2i(rv).(map[float64]uint8), false, d) } } -func (f fastpathT) DecMapFloat64Uint8X(vp *map[float64]uint8, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat64Uint8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat64Uint8X(vp *map[float64]uint8, d *Decoder) { + v, changed := f.DecMapFloat64Uint8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat64Uint8V(v map[float64]uint8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat64Uint8V(v map[float64]uint8, canChange bool, d *Decoder) (_ map[float64]uint8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[float64]uint8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float64 var mv uint8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv + mk = dd.DecodeFloat64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat64Uint16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float64]uint16) - v, changed := fastpathTV.DecMapFloat64Uint16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat64Uint16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float64]uint16) + v, changed := fastpathTV.DecMapFloat64Uint16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float64]uint16) - fastpathTV.DecMapFloat64Uint16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat64Uint16V(rv2i(rv).(map[float64]uint16), false, d) } } -func (f fastpathT) DecMapFloat64Uint16X(vp *map[float64]uint16, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat64Uint16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat64Uint16X(vp *map[float64]uint16, d *Decoder) { + v, changed := f.DecMapFloat64Uint16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat64Uint16V(v map[float64]uint16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat64Uint16V(v map[float64]uint16, canChange bool, d *Decoder) (_ map[float64]uint16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) v = make(map[float64]uint16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float64 var mv uint16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv + mk = dd.DecodeFloat64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat64Uint32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float64]uint32) - v, changed := fastpathTV.DecMapFloat64Uint32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat64Uint32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float64]uint32) + v, changed := fastpathTV.DecMapFloat64Uint32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float64]uint32) - fastpathTV.DecMapFloat64Uint32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat64Uint32V(rv2i(rv).(map[float64]uint32), false, d) } } -func (f fastpathT) DecMapFloat64Uint32X(vp *map[float64]uint32, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat64Uint32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat64Uint32X(vp *map[float64]uint32, d *Decoder) { + v, changed := f.DecMapFloat64Uint32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat64Uint32V(v map[float64]uint32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat64Uint32V(v map[float64]uint32, canChange bool, d *Decoder) (_ map[float64]uint32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[float64]uint32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float64 var mv uint32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv + mk = dd.DecodeFloat64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat64Uint64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float64]uint64) - v, changed := fastpathTV.DecMapFloat64Uint64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat64Uint64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float64]uint64) + v, changed := fastpathTV.DecMapFloat64Uint64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float64]uint64) - fastpathTV.DecMapFloat64Uint64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat64Uint64V(rv2i(rv).(map[float64]uint64), false, d) } } -func (f fastpathT) DecMapFloat64Uint64X(vp *map[float64]uint64, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat64Uint64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat64Uint64X(vp *map[float64]uint64, d *Decoder) { + v, changed := f.DecMapFloat64Uint64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat64Uint64V(v map[float64]uint64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat64Uint64V(v map[float64]uint64, canChange bool, d *Decoder) (_ map[float64]uint64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[float64]uint64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float64 var mv uint64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv + mk = dd.DecodeFloat64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeUint64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat64UintptrR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float64]uintptr) - v, changed := fastpathTV.DecMapFloat64UintptrV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat64UintptrR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float64]uintptr) + v, changed := fastpathTV.DecMapFloat64UintptrV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float64]uintptr) - fastpathTV.DecMapFloat64UintptrV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat64UintptrV(rv2i(rv).(map[float64]uintptr), false, d) } } -func (f fastpathT) DecMapFloat64UintptrX(vp *map[float64]uintptr, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat64UintptrV(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat64UintptrX(vp *map[float64]uintptr, d *Decoder) { + v, changed := f.DecMapFloat64UintptrV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat64UintptrV(v map[float64]uintptr, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat64UintptrV(v map[float64]uintptr, canChange bool, d *Decoder) (_ map[float64]uintptr, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[float64]uintptr, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float64 var mv uintptr - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = dd.DecodeFloat64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat64IntR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float64]int) - v, changed := fastpathTV.DecMapFloat64IntV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat64IntR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float64]int) + v, changed := fastpathTV.DecMapFloat64IntV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float64]int) - fastpathTV.DecMapFloat64IntV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat64IntV(rv2i(rv).(map[float64]int), false, d) } } -func (f fastpathT) DecMapFloat64IntX(vp *map[float64]int, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat64IntV(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat64IntX(vp *map[float64]int, d *Decoder) { + v, changed := f.DecMapFloat64IntV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat64IntV(v map[float64]int, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat64IntV(v map[float64]int, canChange bool, d *Decoder) (_ map[float64]int, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[float64]int, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float64 var mv int - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv + mk = dd.DecodeFloat64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat64Int8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float64]int8) - v, changed := fastpathTV.DecMapFloat64Int8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat64Int8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float64]int8) + v, changed := fastpathTV.DecMapFloat64Int8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float64]int8) - fastpathTV.DecMapFloat64Int8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat64Int8V(rv2i(rv).(map[float64]int8), false, d) } } -func (f fastpathT) DecMapFloat64Int8X(vp *map[float64]int8, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat64Int8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat64Int8X(vp *map[float64]int8, d *Decoder) { + v, changed := f.DecMapFloat64Int8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat64Int8V(v map[float64]int8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat64Int8V(v map[float64]int8, canChange bool, d *Decoder) (_ map[float64]int8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[float64]int8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float64 var mv int8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv + mk = dd.DecodeFloat64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat64Int16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float64]int16) - v, changed := fastpathTV.DecMapFloat64Int16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat64Int16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float64]int16) + v, changed := fastpathTV.DecMapFloat64Int16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float64]int16) - fastpathTV.DecMapFloat64Int16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat64Int16V(rv2i(rv).(map[float64]int16), false, d) } } -func (f fastpathT) DecMapFloat64Int16X(vp *map[float64]int16, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat64Int16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat64Int16X(vp *map[float64]int16, d *Decoder) { + v, changed := f.DecMapFloat64Int16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat64Int16V(v map[float64]int16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat64Int16V(v map[float64]int16, canChange bool, d *Decoder) (_ map[float64]int16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) v = make(map[float64]int16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float64 var mv int16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv + mk = dd.DecodeFloat64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat64Int32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float64]int32) - v, changed := fastpathTV.DecMapFloat64Int32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat64Int32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float64]int32) + v, changed := fastpathTV.DecMapFloat64Int32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float64]int32) - fastpathTV.DecMapFloat64Int32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat64Int32V(rv2i(rv).(map[float64]int32), false, d) } } -func (f fastpathT) DecMapFloat64Int32X(vp *map[float64]int32, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat64Int32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat64Int32X(vp *map[float64]int32, d *Decoder) { + v, changed := f.DecMapFloat64Int32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat64Int32V(v map[float64]int32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat64Int32V(v map[float64]int32, canChange bool, d *Decoder) (_ map[float64]int32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[float64]int32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float64 var mv int32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv + mk = dd.DecodeFloat64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat64Int64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float64]int64) - v, changed := fastpathTV.DecMapFloat64Int64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat64Int64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float64]int64) + v, changed := fastpathTV.DecMapFloat64Int64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float64]int64) - fastpathTV.DecMapFloat64Int64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat64Int64V(rv2i(rv).(map[float64]int64), false, d) } } -func (f fastpathT) DecMapFloat64Int64X(vp *map[float64]int64, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat64Int64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat64Int64X(vp *map[float64]int64, d *Decoder) { + v, changed := f.DecMapFloat64Int64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat64Int64V(v map[float64]int64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat64Int64V(v map[float64]int64, canChange bool, d *Decoder) (_ map[float64]int64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[float64]int64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float64 var mv int64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv + mk = dd.DecodeFloat64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeInt64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat64Float32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float64]float32) - v, changed := fastpathTV.DecMapFloat64Float32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat64Float32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float64]float32) + v, changed := fastpathTV.DecMapFloat64Float32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float64]float32) - fastpathTV.DecMapFloat64Float32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat64Float32V(rv2i(rv).(map[float64]float32), false, d) } } -func (f fastpathT) DecMapFloat64Float32X(vp *map[float64]float32, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat64Float32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat64Float32X(vp *map[float64]float32, d *Decoder) { + v, changed := f.DecMapFloat64Float32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat64Float32V(v map[float64]float32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat64Float32V(v map[float64]float32, canChange bool, d *Decoder) (_ map[float64]float32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[float64]float32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float64 var mv float32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv + mk = dd.DecodeFloat64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat64Float64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float64]float64) - v, changed := fastpathTV.DecMapFloat64Float64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat64Float64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float64]float64) + v, changed := fastpathTV.DecMapFloat64Float64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float64]float64) - fastpathTV.DecMapFloat64Float64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat64Float64V(rv2i(rv).(map[float64]float64), false, d) } } -func (f fastpathT) DecMapFloat64Float64X(vp *map[float64]float64, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat64Float64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat64Float64X(vp *map[float64]float64, d *Decoder) { + v, changed := f.DecMapFloat64Float64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat64Float64V(v map[float64]float64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat64Float64V(v map[float64]float64, canChange bool, d *Decoder) (_ map[float64]float64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[float64]float64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float64 var mv float64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv + mk = dd.DecodeFloat64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeFloat64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapFloat64BoolR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[float64]bool) - v, changed := fastpathTV.DecMapFloat64BoolV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapFloat64BoolR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[float64]bool) + v, changed := fastpathTV.DecMapFloat64BoolV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[float64]bool) - fastpathTV.DecMapFloat64BoolV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapFloat64BoolV(rv2i(rv).(map[float64]bool), false, d) } } -func (f fastpathT) DecMapFloat64BoolX(vp *map[float64]bool, checkNil bool, d *Decoder) { - v, changed := f.DecMapFloat64BoolV(*vp, checkNil, true, d) +func (f fastpathT) DecMapFloat64BoolX(vp *map[float64]bool, d *Decoder) { + v, changed := f.DecMapFloat64BoolV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapFloat64BoolV(v map[float64]bool, checkNil bool, canChange bool, +func (_ fastpathT) DecMapFloat64BoolV(v map[float64]bool, canChange bool, d *Decoder) (_ map[float64]bool, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[float64]bool, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk float64 var mv bool - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeFloat(false) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv + mk = dd.DecodeFloat64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = false } + continue + } + mv = dd.DecodeBool() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintIntfR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint]interface{}) - v, changed := fastpathTV.DecMapUintIntfV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintIntfR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint]interface{}) + v, changed := fastpathTV.DecMapUintIntfV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint]interface{}) - fastpathTV.DecMapUintIntfV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintIntfV(rv2i(rv).(map[uint]interface{}), false, d) } } -func (f fastpathT) DecMapUintIntfX(vp *map[uint]interface{}, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintIntfV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintIntfX(vp *map[uint]interface{}, d *Decoder) { + v, changed := f.DecMapUintIntfV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintIntfV(v map[uint]interface{}, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintIntfV(v map[uint]interface{}, canChange bool, d *Decoder) (_ map[uint]interface{}, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) v = make(map[uint]interface{}, xlen) changed = true } - mapGet := !d.h.MapValueReset && !d.h.InterfaceReset + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } + mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset var mk uint var mv interface{} - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] + mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv + v[mk] = nil } + continue + } + if mapGet { + mv = v[mk] + } else { + mv = nil + } + d.decode(&mv) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintStringR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint]string) - v, changed := fastpathTV.DecMapUintStringV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintStringR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint]string) + v, changed := fastpathTV.DecMapUintStringV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint]string) - fastpathTV.DecMapUintStringV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintStringV(rv2i(rv).(map[uint]string), false, d) } } -func (f fastpathT) DecMapUintStringX(vp *map[uint]string, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintStringV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintStringX(vp *map[uint]string, d *Decoder) { + v, changed := f.DecMapUintStringV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintStringV(v map[uint]string, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintStringV(v map[uint]string, canChange bool, d *Decoder) (_ map[uint]string, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) v = make(map[uint]string, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint var mv string - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv + mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = "" } + continue + } + mv = dd.DecodeString() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintUintR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint]uint) - v, changed := fastpathTV.DecMapUintUintV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintUintR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint]uint) + v, changed := fastpathTV.DecMapUintUintV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint]uint) - fastpathTV.DecMapUintUintV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintUintV(rv2i(rv).(map[uint]uint), false, d) } } -func (f fastpathT) DecMapUintUintX(vp *map[uint]uint, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintUintV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintUintX(vp *map[uint]uint, d *Decoder) { + v, changed := f.DecMapUintUintV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintUintV(v map[uint]uint, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintUintV(v map[uint]uint, canChange bool, d *Decoder) (_ map[uint]uint, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[uint]uint, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint var mv uint - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintUint8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint]uint8) - v, changed := fastpathTV.DecMapUintUint8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintUint8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint]uint8) + v, changed := fastpathTV.DecMapUintUint8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint]uint8) - fastpathTV.DecMapUintUint8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintUint8V(rv2i(rv).(map[uint]uint8), false, d) } } -func (f fastpathT) DecMapUintUint8X(vp *map[uint]uint8, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintUint8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintUint8X(vp *map[uint]uint8, d *Decoder) { + v, changed := f.DecMapUintUint8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintUint8V(v map[uint]uint8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintUint8V(v map[uint]uint8, canChange bool, d *Decoder) (_ map[uint]uint8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[uint]uint8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint var mv uint8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv + mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintUint16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint]uint16) - v, changed := fastpathTV.DecMapUintUint16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintUint16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint]uint16) + v, changed := fastpathTV.DecMapUintUint16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint]uint16) - fastpathTV.DecMapUintUint16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintUint16V(rv2i(rv).(map[uint]uint16), false, d) } } -func (f fastpathT) DecMapUintUint16X(vp *map[uint]uint16, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintUint16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintUint16X(vp *map[uint]uint16, d *Decoder) { + v, changed := f.DecMapUintUint16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintUint16V(v map[uint]uint16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintUint16V(v map[uint]uint16, canChange bool, d *Decoder) (_ map[uint]uint16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) v = make(map[uint]uint16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint var mv uint16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv + mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintUint32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint]uint32) - v, changed := fastpathTV.DecMapUintUint32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintUint32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint]uint32) + v, changed := fastpathTV.DecMapUintUint32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint]uint32) - fastpathTV.DecMapUintUint32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintUint32V(rv2i(rv).(map[uint]uint32), false, d) } } -func (f fastpathT) DecMapUintUint32X(vp *map[uint]uint32, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintUint32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintUint32X(vp *map[uint]uint32, d *Decoder) { + v, changed := f.DecMapUintUint32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintUint32V(v map[uint]uint32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintUint32V(v map[uint]uint32, canChange bool, d *Decoder) (_ map[uint]uint32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[uint]uint32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint var mv uint32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv + mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintUint64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint]uint64) - v, changed := fastpathTV.DecMapUintUint64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintUint64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint]uint64) + v, changed := fastpathTV.DecMapUintUint64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint]uint64) - fastpathTV.DecMapUintUint64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintUint64V(rv2i(rv).(map[uint]uint64), false, d) } } -func (f fastpathT) DecMapUintUint64X(vp *map[uint]uint64, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintUint64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintUint64X(vp *map[uint]uint64, d *Decoder) { + v, changed := f.DecMapUintUint64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintUint64V(v map[uint]uint64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintUint64V(v map[uint]uint64, canChange bool, d *Decoder) (_ map[uint]uint64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[uint]uint64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint var mv uint64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv + mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeUint64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintUintptrR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint]uintptr) - v, changed := fastpathTV.DecMapUintUintptrV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintUintptrR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint]uintptr) + v, changed := fastpathTV.DecMapUintUintptrV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint]uintptr) - fastpathTV.DecMapUintUintptrV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintUintptrV(rv2i(rv).(map[uint]uintptr), false, d) } } -func (f fastpathT) DecMapUintUintptrX(vp *map[uint]uintptr, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintUintptrV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintUintptrX(vp *map[uint]uintptr, d *Decoder) { + v, changed := f.DecMapUintUintptrV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintUintptrV(v map[uint]uintptr, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintUintptrV(v map[uint]uintptr, canChange bool, d *Decoder) (_ map[uint]uintptr, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[uint]uintptr, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint var mv uintptr - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintIntR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint]int) - v, changed := fastpathTV.DecMapUintIntV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintIntR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint]int) + v, changed := fastpathTV.DecMapUintIntV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint]int) - fastpathTV.DecMapUintIntV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintIntV(rv2i(rv).(map[uint]int), false, d) } } -func (f fastpathT) DecMapUintIntX(vp *map[uint]int, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintIntV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintIntX(vp *map[uint]int, d *Decoder) { + v, changed := f.DecMapUintIntV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintIntV(v map[uint]int, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintIntV(v map[uint]int, canChange bool, d *Decoder) (_ map[uint]int, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[uint]int, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint var mv int - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv + mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintInt8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint]int8) - v, changed := fastpathTV.DecMapUintInt8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintInt8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint]int8) + v, changed := fastpathTV.DecMapUintInt8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint]int8) - fastpathTV.DecMapUintInt8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintInt8V(rv2i(rv).(map[uint]int8), false, d) } } -func (f fastpathT) DecMapUintInt8X(vp *map[uint]int8, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintInt8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintInt8X(vp *map[uint]int8, d *Decoder) { + v, changed := f.DecMapUintInt8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintInt8V(v map[uint]int8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintInt8V(v map[uint]int8, canChange bool, d *Decoder) (_ map[uint]int8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[uint]int8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint var mv int8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv + mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintInt16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint]int16) - v, changed := fastpathTV.DecMapUintInt16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintInt16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint]int16) + v, changed := fastpathTV.DecMapUintInt16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint]int16) - fastpathTV.DecMapUintInt16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintInt16V(rv2i(rv).(map[uint]int16), false, d) } } -func (f fastpathT) DecMapUintInt16X(vp *map[uint]int16, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintInt16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintInt16X(vp *map[uint]int16, d *Decoder) { + v, changed := f.DecMapUintInt16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintInt16V(v map[uint]int16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintInt16V(v map[uint]int16, canChange bool, d *Decoder) (_ map[uint]int16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) v = make(map[uint]int16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint var mv int16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv + mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintInt32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint]int32) - v, changed := fastpathTV.DecMapUintInt32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintInt32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint]int32) + v, changed := fastpathTV.DecMapUintInt32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint]int32) - fastpathTV.DecMapUintInt32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintInt32V(rv2i(rv).(map[uint]int32), false, d) } } -func (f fastpathT) DecMapUintInt32X(vp *map[uint]int32, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintInt32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintInt32X(vp *map[uint]int32, d *Decoder) { + v, changed := f.DecMapUintInt32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintInt32V(v map[uint]int32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintInt32V(v map[uint]int32, canChange bool, d *Decoder) (_ map[uint]int32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[uint]int32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint var mv int32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv + mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintInt64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint]int64) - v, changed := fastpathTV.DecMapUintInt64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintInt64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint]int64) + v, changed := fastpathTV.DecMapUintInt64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint]int64) - fastpathTV.DecMapUintInt64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintInt64V(rv2i(rv).(map[uint]int64), false, d) } } -func (f fastpathT) DecMapUintInt64X(vp *map[uint]int64, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintInt64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintInt64X(vp *map[uint]int64, d *Decoder) { + v, changed := f.DecMapUintInt64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintInt64V(v map[uint]int64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintInt64V(v map[uint]int64, canChange bool, d *Decoder) (_ map[uint]int64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[uint]int64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint var mv int64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv + mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeInt64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintFloat32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint]float32) - v, changed := fastpathTV.DecMapUintFloat32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintFloat32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint]float32) + v, changed := fastpathTV.DecMapUintFloat32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint]float32) - fastpathTV.DecMapUintFloat32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintFloat32V(rv2i(rv).(map[uint]float32), false, d) } } -func (f fastpathT) DecMapUintFloat32X(vp *map[uint]float32, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintFloat32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintFloat32X(vp *map[uint]float32, d *Decoder) { + v, changed := f.DecMapUintFloat32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintFloat32V(v map[uint]float32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintFloat32V(v map[uint]float32, canChange bool, d *Decoder) (_ map[uint]float32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[uint]float32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint var mv float32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv + mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintFloat64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint]float64) - v, changed := fastpathTV.DecMapUintFloat64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintFloat64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint]float64) + v, changed := fastpathTV.DecMapUintFloat64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint]float64) - fastpathTV.DecMapUintFloat64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintFloat64V(rv2i(rv).(map[uint]float64), false, d) } } -func (f fastpathT) DecMapUintFloat64X(vp *map[uint]float64, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintFloat64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintFloat64X(vp *map[uint]float64, d *Decoder) { + v, changed := f.DecMapUintFloat64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintFloat64V(v map[uint]float64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintFloat64V(v map[uint]float64, canChange bool, d *Decoder) (_ map[uint]float64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[uint]float64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint var mv float64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv + mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeFloat64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintBoolR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint]bool) - v, changed := fastpathTV.DecMapUintBoolV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintBoolR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint]bool) + v, changed := fastpathTV.DecMapUintBoolV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint]bool) - fastpathTV.DecMapUintBoolV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintBoolV(rv2i(rv).(map[uint]bool), false, d) } } -func (f fastpathT) DecMapUintBoolX(vp *map[uint]bool, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintBoolV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintBoolX(vp *map[uint]bool, d *Decoder) { + v, changed := f.DecMapUintBoolV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintBoolV(v map[uint]bool, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintBoolV(v map[uint]bool, canChange bool, d *Decoder) (_ map[uint]bool, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[uint]bool, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint var mv bool - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv + mk = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = false } + continue + } + mv = dd.DecodeBool() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint8IntfR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint8]interface{}) - v, changed := fastpathTV.DecMapUint8IntfV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint8IntfR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint8]interface{}) + v, changed := fastpathTV.DecMapUint8IntfV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint8]interface{}) - fastpathTV.DecMapUint8IntfV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint8IntfV(rv2i(rv).(map[uint8]interface{}), false, d) } } -func (f fastpathT) DecMapUint8IntfX(vp *map[uint8]interface{}, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint8IntfV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint8IntfX(vp *map[uint8]interface{}, d *Decoder) { + v, changed := f.DecMapUint8IntfV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint8IntfV(v map[uint8]interface{}, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint8IntfV(v map[uint8]interface{}, canChange bool, d *Decoder) (_ map[uint8]interface{}, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) v = make(map[uint8]interface{}, xlen) changed = true } - mapGet := !d.h.MapValueReset && !d.h.InterfaceReset + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } + mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset var mk uint8 var mv interface{} - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] + mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv + v[mk] = nil } + continue + } + if mapGet { + mv = v[mk] + } else { + mv = nil + } + d.decode(&mv) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint8StringR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint8]string) - v, changed := fastpathTV.DecMapUint8StringV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint8StringR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint8]string) + v, changed := fastpathTV.DecMapUint8StringV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint8]string) - fastpathTV.DecMapUint8StringV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint8StringV(rv2i(rv).(map[uint8]string), false, d) } } -func (f fastpathT) DecMapUint8StringX(vp *map[uint8]string, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint8StringV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint8StringX(vp *map[uint8]string, d *Decoder) { + v, changed := f.DecMapUint8StringV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint8StringV(v map[uint8]string, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint8StringV(v map[uint8]string, canChange bool, d *Decoder) (_ map[uint8]string, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) v = make(map[uint8]string, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint8 var mv string - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv + mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = "" } + continue + } + mv = dd.DecodeString() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint8UintR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint8]uint) - v, changed := fastpathTV.DecMapUint8UintV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint8UintR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint8]uint) + v, changed := fastpathTV.DecMapUint8UintV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint8]uint) - fastpathTV.DecMapUint8UintV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint8UintV(rv2i(rv).(map[uint8]uint), false, d) } } -func (f fastpathT) DecMapUint8UintX(vp *map[uint8]uint, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint8UintV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint8UintX(vp *map[uint8]uint, d *Decoder) { + v, changed := f.DecMapUint8UintV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint8UintV(v map[uint8]uint, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint8UintV(v map[uint8]uint, canChange bool, d *Decoder) (_ map[uint8]uint, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[uint8]uint, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint8 var mv uint - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint8Uint8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint8]uint8) - v, changed := fastpathTV.DecMapUint8Uint8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint8Uint8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint8]uint8) + v, changed := fastpathTV.DecMapUint8Uint8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint8]uint8) - fastpathTV.DecMapUint8Uint8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint8Uint8V(rv2i(rv).(map[uint8]uint8), false, d) } } -func (f fastpathT) DecMapUint8Uint8X(vp *map[uint8]uint8, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint8Uint8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint8Uint8X(vp *map[uint8]uint8, d *Decoder) { + v, changed := f.DecMapUint8Uint8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint8Uint8V(v map[uint8]uint8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint8Uint8V(v map[uint8]uint8, canChange bool, d *Decoder) (_ map[uint8]uint8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 2) v = make(map[uint8]uint8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint8 var mv uint8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv + mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint8Uint16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint8]uint16) - v, changed := fastpathTV.DecMapUint8Uint16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint8Uint16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint8]uint16) + v, changed := fastpathTV.DecMapUint8Uint16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint8]uint16) - fastpathTV.DecMapUint8Uint16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint8Uint16V(rv2i(rv).(map[uint8]uint16), false, d) } } -func (f fastpathT) DecMapUint8Uint16X(vp *map[uint8]uint16, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint8Uint16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint8Uint16X(vp *map[uint8]uint16, d *Decoder) { + v, changed := f.DecMapUint8Uint16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint8Uint16V(v map[uint8]uint16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint8Uint16V(v map[uint8]uint16, canChange bool, d *Decoder) (_ map[uint8]uint16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) v = make(map[uint8]uint16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint8 var mv uint16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv + mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint8Uint32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint8]uint32) - v, changed := fastpathTV.DecMapUint8Uint32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint8Uint32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint8]uint32) + v, changed := fastpathTV.DecMapUint8Uint32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint8]uint32) - fastpathTV.DecMapUint8Uint32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint8Uint32V(rv2i(rv).(map[uint8]uint32), false, d) } } -func (f fastpathT) DecMapUint8Uint32X(vp *map[uint8]uint32, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint8Uint32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint8Uint32X(vp *map[uint8]uint32, d *Decoder) { + v, changed := f.DecMapUint8Uint32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint8Uint32V(v map[uint8]uint32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint8Uint32V(v map[uint8]uint32, canChange bool, d *Decoder) (_ map[uint8]uint32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) v = make(map[uint8]uint32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint8 var mv uint32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv + mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint8Uint64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint8]uint64) - v, changed := fastpathTV.DecMapUint8Uint64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint8Uint64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint8]uint64) + v, changed := fastpathTV.DecMapUint8Uint64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint8]uint64) - fastpathTV.DecMapUint8Uint64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint8Uint64V(rv2i(rv).(map[uint8]uint64), false, d) } } -func (f fastpathT) DecMapUint8Uint64X(vp *map[uint8]uint64, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint8Uint64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint8Uint64X(vp *map[uint8]uint64, d *Decoder) { + v, changed := f.DecMapUint8Uint64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint8Uint64V(v map[uint8]uint64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint8Uint64V(v map[uint8]uint64, canChange bool, d *Decoder) (_ map[uint8]uint64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[uint8]uint64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint8 var mv uint64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv + mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeUint64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint8UintptrR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint8]uintptr) - v, changed := fastpathTV.DecMapUint8UintptrV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint8UintptrR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint8]uintptr) + v, changed := fastpathTV.DecMapUint8UintptrV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint8]uintptr) - fastpathTV.DecMapUint8UintptrV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint8UintptrV(rv2i(rv).(map[uint8]uintptr), false, d) } } -func (f fastpathT) DecMapUint8UintptrX(vp *map[uint8]uintptr, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint8UintptrV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint8UintptrX(vp *map[uint8]uintptr, d *Decoder) { + v, changed := f.DecMapUint8UintptrV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint8UintptrV(v map[uint8]uintptr, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint8UintptrV(v map[uint8]uintptr, canChange bool, d *Decoder) (_ map[uint8]uintptr, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[uint8]uintptr, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint8 var mv uintptr - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint8IntR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint8]int) - v, changed := fastpathTV.DecMapUint8IntV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint8IntR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint8]int) + v, changed := fastpathTV.DecMapUint8IntV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint8]int) - fastpathTV.DecMapUint8IntV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint8IntV(rv2i(rv).(map[uint8]int), false, d) } } -func (f fastpathT) DecMapUint8IntX(vp *map[uint8]int, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint8IntV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint8IntX(vp *map[uint8]int, d *Decoder) { + v, changed := f.DecMapUint8IntV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint8IntV(v map[uint8]int, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint8IntV(v map[uint8]int, canChange bool, d *Decoder) (_ map[uint8]int, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[uint8]int, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint8 var mv int - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv + mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint8Int8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint8]int8) - v, changed := fastpathTV.DecMapUint8Int8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint8Int8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint8]int8) + v, changed := fastpathTV.DecMapUint8Int8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint8]int8) - fastpathTV.DecMapUint8Int8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint8Int8V(rv2i(rv).(map[uint8]int8), false, d) } } -func (f fastpathT) DecMapUint8Int8X(vp *map[uint8]int8, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint8Int8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint8Int8X(vp *map[uint8]int8, d *Decoder) { + v, changed := f.DecMapUint8Int8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint8Int8V(v map[uint8]int8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint8Int8V(v map[uint8]int8, canChange bool, d *Decoder) (_ map[uint8]int8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 2) v = make(map[uint8]int8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint8 var mv int8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv + mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint8Int16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint8]int16) - v, changed := fastpathTV.DecMapUint8Int16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint8Int16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint8]int16) + v, changed := fastpathTV.DecMapUint8Int16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint8]int16) - fastpathTV.DecMapUint8Int16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint8Int16V(rv2i(rv).(map[uint8]int16), false, d) } } -func (f fastpathT) DecMapUint8Int16X(vp *map[uint8]int16, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint8Int16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint8Int16X(vp *map[uint8]int16, d *Decoder) { + v, changed := f.DecMapUint8Int16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint8Int16V(v map[uint8]int16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint8Int16V(v map[uint8]int16, canChange bool, d *Decoder) (_ map[uint8]int16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) v = make(map[uint8]int16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint8 var mv int16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv + mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint8Int32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint8]int32) - v, changed := fastpathTV.DecMapUint8Int32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint8Int32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint8]int32) + v, changed := fastpathTV.DecMapUint8Int32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint8]int32) - fastpathTV.DecMapUint8Int32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint8Int32V(rv2i(rv).(map[uint8]int32), false, d) } } -func (f fastpathT) DecMapUint8Int32X(vp *map[uint8]int32, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint8Int32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint8Int32X(vp *map[uint8]int32, d *Decoder) { + v, changed := f.DecMapUint8Int32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint8Int32V(v map[uint8]int32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint8Int32V(v map[uint8]int32, canChange bool, d *Decoder) (_ map[uint8]int32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) v = make(map[uint8]int32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint8 var mv int32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv + mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint8Int64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint8]int64) - v, changed := fastpathTV.DecMapUint8Int64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint8Int64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint8]int64) + v, changed := fastpathTV.DecMapUint8Int64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint8]int64) - fastpathTV.DecMapUint8Int64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint8Int64V(rv2i(rv).(map[uint8]int64), false, d) } } -func (f fastpathT) DecMapUint8Int64X(vp *map[uint8]int64, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint8Int64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint8Int64X(vp *map[uint8]int64, d *Decoder) { + v, changed := f.DecMapUint8Int64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint8Int64V(v map[uint8]int64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint8Int64V(v map[uint8]int64, canChange bool, d *Decoder) (_ map[uint8]int64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[uint8]int64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint8 var mv int64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv + mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeInt64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint8Float32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint8]float32) - v, changed := fastpathTV.DecMapUint8Float32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint8Float32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint8]float32) + v, changed := fastpathTV.DecMapUint8Float32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint8]float32) - fastpathTV.DecMapUint8Float32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint8Float32V(rv2i(rv).(map[uint8]float32), false, d) } } -func (f fastpathT) DecMapUint8Float32X(vp *map[uint8]float32, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint8Float32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint8Float32X(vp *map[uint8]float32, d *Decoder) { + v, changed := f.DecMapUint8Float32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint8Float32V(v map[uint8]float32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint8Float32V(v map[uint8]float32, canChange bool, d *Decoder) (_ map[uint8]float32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) v = make(map[uint8]float32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint8 var mv float32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv + mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint8Float64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint8]float64) - v, changed := fastpathTV.DecMapUint8Float64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint8Float64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint8]float64) + v, changed := fastpathTV.DecMapUint8Float64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint8]float64) - fastpathTV.DecMapUint8Float64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint8Float64V(rv2i(rv).(map[uint8]float64), false, d) } } -func (f fastpathT) DecMapUint8Float64X(vp *map[uint8]float64, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint8Float64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint8Float64X(vp *map[uint8]float64, d *Decoder) { + v, changed := f.DecMapUint8Float64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint8Float64V(v map[uint8]float64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint8Float64V(v map[uint8]float64, canChange bool, d *Decoder) (_ map[uint8]float64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[uint8]float64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint8 var mv float64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv + mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeFloat64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint8BoolR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint8]bool) - v, changed := fastpathTV.DecMapUint8BoolV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint8BoolR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint8]bool) + v, changed := fastpathTV.DecMapUint8BoolV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint8]bool) - fastpathTV.DecMapUint8BoolV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint8BoolV(rv2i(rv).(map[uint8]bool), false, d) } } -func (f fastpathT) DecMapUint8BoolX(vp *map[uint8]bool, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint8BoolV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint8BoolX(vp *map[uint8]bool, d *Decoder) { + v, changed := f.DecMapUint8BoolV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint8BoolV(v map[uint8]bool, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint8BoolV(v map[uint8]bool, canChange bool, d *Decoder) (_ map[uint8]bool, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 2) v = make(map[uint8]bool, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint8 var mv bool - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint8(dd.DecodeUint(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv + mk = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = false } + continue + } + mv = dd.DecodeBool() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint16IntfR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint16]interface{}) - v, changed := fastpathTV.DecMapUint16IntfV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint16IntfR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint16]interface{}) + v, changed := fastpathTV.DecMapUint16IntfV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint16]interface{}) - fastpathTV.DecMapUint16IntfV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint16IntfV(rv2i(rv).(map[uint16]interface{}), false, d) } } -func (f fastpathT) DecMapUint16IntfX(vp *map[uint16]interface{}, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint16IntfV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint16IntfX(vp *map[uint16]interface{}, d *Decoder) { + v, changed := f.DecMapUint16IntfV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint16IntfV(v map[uint16]interface{}, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint16IntfV(v map[uint16]interface{}, canChange bool, d *Decoder) (_ map[uint16]interface{}, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 18) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 18) v = make(map[uint16]interface{}, xlen) changed = true } - mapGet := !d.h.MapValueReset && !d.h.InterfaceReset + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } + mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset var mk uint16 var mv interface{} - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] + mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv + v[mk] = nil } + continue + } + if mapGet { + mv = v[mk] + } else { + mv = nil + } + d.decode(&mv) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint16StringR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint16]string) - v, changed := fastpathTV.DecMapUint16StringV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint16StringR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint16]string) + v, changed := fastpathTV.DecMapUint16StringV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint16]string) - fastpathTV.DecMapUint16StringV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint16StringV(rv2i(rv).(map[uint16]string), false, d) } } -func (f fastpathT) DecMapUint16StringX(vp *map[uint16]string, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint16StringV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint16StringX(vp *map[uint16]string, d *Decoder) { + v, changed := f.DecMapUint16StringV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint16StringV(v map[uint16]string, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint16StringV(v map[uint16]string, canChange bool, d *Decoder) (_ map[uint16]string, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 18) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 18) v = make(map[uint16]string, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint16 var mv string - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv + mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = "" } + continue + } + mv = dd.DecodeString() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint16UintR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint16]uint) - v, changed := fastpathTV.DecMapUint16UintV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint16UintR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint16]uint) + v, changed := fastpathTV.DecMapUint16UintV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint16]uint) - fastpathTV.DecMapUint16UintV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint16UintV(rv2i(rv).(map[uint16]uint), false, d) } } -func (f fastpathT) DecMapUint16UintX(vp *map[uint16]uint, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint16UintV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint16UintX(vp *map[uint16]uint, d *Decoder) { + v, changed := f.DecMapUint16UintV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint16UintV(v map[uint16]uint, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint16UintV(v map[uint16]uint, canChange bool, d *Decoder) (_ map[uint16]uint, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) v = make(map[uint16]uint, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint16 var mv uint - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint16Uint8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint16]uint8) - v, changed := fastpathTV.DecMapUint16Uint8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint16Uint8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint16]uint8) + v, changed := fastpathTV.DecMapUint16Uint8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint16]uint8) - fastpathTV.DecMapUint16Uint8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint16Uint8V(rv2i(rv).(map[uint16]uint8), false, d) } } -func (f fastpathT) DecMapUint16Uint8X(vp *map[uint16]uint8, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint16Uint8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint16Uint8X(vp *map[uint16]uint8, d *Decoder) { + v, changed := f.DecMapUint16Uint8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint16Uint8V(v map[uint16]uint8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint16Uint8V(v map[uint16]uint8, canChange bool, d *Decoder) (_ map[uint16]uint8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) v = make(map[uint16]uint8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint16 var mv uint8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv + mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint16Uint16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint16]uint16) - v, changed := fastpathTV.DecMapUint16Uint16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint16Uint16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint16]uint16) + v, changed := fastpathTV.DecMapUint16Uint16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint16]uint16) - fastpathTV.DecMapUint16Uint16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint16Uint16V(rv2i(rv).(map[uint16]uint16), false, d) } } -func (f fastpathT) DecMapUint16Uint16X(vp *map[uint16]uint16, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint16Uint16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint16Uint16X(vp *map[uint16]uint16, d *Decoder) { + v, changed := f.DecMapUint16Uint16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint16Uint16V(v map[uint16]uint16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint16Uint16V(v map[uint16]uint16, canChange bool, d *Decoder) (_ map[uint16]uint16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 4) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 4) v = make(map[uint16]uint16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint16 var mv uint16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv + mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint16Uint32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint16]uint32) - v, changed := fastpathTV.DecMapUint16Uint32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint16Uint32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint16]uint32) + v, changed := fastpathTV.DecMapUint16Uint32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint16]uint32) - fastpathTV.DecMapUint16Uint32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint16Uint32V(rv2i(rv).(map[uint16]uint32), false, d) } } -func (f fastpathT) DecMapUint16Uint32X(vp *map[uint16]uint32, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint16Uint32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint16Uint32X(vp *map[uint16]uint32, d *Decoder) { + v, changed := f.DecMapUint16Uint32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint16Uint32V(v map[uint16]uint32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint16Uint32V(v map[uint16]uint32, canChange bool, d *Decoder) (_ map[uint16]uint32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 6) v = make(map[uint16]uint32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint16 var mv uint32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv + mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint16Uint64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint16]uint64) - v, changed := fastpathTV.DecMapUint16Uint64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint16Uint64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint16]uint64) + v, changed := fastpathTV.DecMapUint16Uint64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint16]uint64) - fastpathTV.DecMapUint16Uint64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint16Uint64V(rv2i(rv).(map[uint16]uint64), false, d) } } -func (f fastpathT) DecMapUint16Uint64X(vp *map[uint16]uint64, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint16Uint64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint16Uint64X(vp *map[uint16]uint64, d *Decoder) { + v, changed := f.DecMapUint16Uint64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint16Uint64V(v map[uint16]uint64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint16Uint64V(v map[uint16]uint64, canChange bool, d *Decoder) (_ map[uint16]uint64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) v = make(map[uint16]uint64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint16 var mv uint64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv + mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeUint64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint16UintptrR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint16]uintptr) - v, changed := fastpathTV.DecMapUint16UintptrV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint16UintptrR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint16]uintptr) + v, changed := fastpathTV.DecMapUint16UintptrV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint16]uintptr) - fastpathTV.DecMapUint16UintptrV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint16UintptrV(rv2i(rv).(map[uint16]uintptr), false, d) } } -func (f fastpathT) DecMapUint16UintptrX(vp *map[uint16]uintptr, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint16UintptrV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint16UintptrX(vp *map[uint16]uintptr, d *Decoder) { + v, changed := f.DecMapUint16UintptrV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint16UintptrV(v map[uint16]uintptr, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint16UintptrV(v map[uint16]uintptr, canChange bool, d *Decoder) (_ map[uint16]uintptr, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) v = make(map[uint16]uintptr, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint16 var mv uintptr - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint16IntR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint16]int) - v, changed := fastpathTV.DecMapUint16IntV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint16IntR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint16]int) + v, changed := fastpathTV.DecMapUint16IntV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint16]int) - fastpathTV.DecMapUint16IntV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint16IntV(rv2i(rv).(map[uint16]int), false, d) } } -func (f fastpathT) DecMapUint16IntX(vp *map[uint16]int, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint16IntV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint16IntX(vp *map[uint16]int, d *Decoder) { + v, changed := f.DecMapUint16IntV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint16IntV(v map[uint16]int, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint16IntV(v map[uint16]int, canChange bool, d *Decoder) (_ map[uint16]int, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) v = make(map[uint16]int, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint16 var mv int - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv + mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint16Int8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint16]int8) - v, changed := fastpathTV.DecMapUint16Int8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint16Int8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint16]int8) + v, changed := fastpathTV.DecMapUint16Int8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint16]int8) - fastpathTV.DecMapUint16Int8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint16Int8V(rv2i(rv).(map[uint16]int8), false, d) } } -func (f fastpathT) DecMapUint16Int8X(vp *map[uint16]int8, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint16Int8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint16Int8X(vp *map[uint16]int8, d *Decoder) { + v, changed := f.DecMapUint16Int8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint16Int8V(v map[uint16]int8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint16Int8V(v map[uint16]int8, canChange bool, d *Decoder) (_ map[uint16]int8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) v = make(map[uint16]int8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint16 var mv int8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv + mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint16Int16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint16]int16) - v, changed := fastpathTV.DecMapUint16Int16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint16Int16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint16]int16) + v, changed := fastpathTV.DecMapUint16Int16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint16]int16) - fastpathTV.DecMapUint16Int16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint16Int16V(rv2i(rv).(map[uint16]int16), false, d) } } -func (f fastpathT) DecMapUint16Int16X(vp *map[uint16]int16, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint16Int16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint16Int16X(vp *map[uint16]int16, d *Decoder) { + v, changed := f.DecMapUint16Int16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint16Int16V(v map[uint16]int16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint16Int16V(v map[uint16]int16, canChange bool, d *Decoder) (_ map[uint16]int16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 4) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 4) v = make(map[uint16]int16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint16 var mv int16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv + mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint16Int32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint16]int32) - v, changed := fastpathTV.DecMapUint16Int32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint16Int32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint16]int32) + v, changed := fastpathTV.DecMapUint16Int32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint16]int32) - fastpathTV.DecMapUint16Int32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint16Int32V(rv2i(rv).(map[uint16]int32), false, d) } } -func (f fastpathT) DecMapUint16Int32X(vp *map[uint16]int32, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint16Int32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint16Int32X(vp *map[uint16]int32, d *Decoder) { + v, changed := f.DecMapUint16Int32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint16Int32V(v map[uint16]int32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint16Int32V(v map[uint16]int32, canChange bool, d *Decoder) (_ map[uint16]int32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 6) v = make(map[uint16]int32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint16 var mv int32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv + mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint16Int64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint16]int64) - v, changed := fastpathTV.DecMapUint16Int64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint16Int64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint16]int64) + v, changed := fastpathTV.DecMapUint16Int64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint16]int64) - fastpathTV.DecMapUint16Int64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint16Int64V(rv2i(rv).(map[uint16]int64), false, d) } } -func (f fastpathT) DecMapUint16Int64X(vp *map[uint16]int64, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint16Int64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint16Int64X(vp *map[uint16]int64, d *Decoder) { + v, changed := f.DecMapUint16Int64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint16Int64V(v map[uint16]int64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint16Int64V(v map[uint16]int64, canChange bool, d *Decoder) (_ map[uint16]int64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) v = make(map[uint16]int64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint16 var mv int64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv + mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeInt64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint16Float32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint16]float32) - v, changed := fastpathTV.DecMapUint16Float32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint16Float32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint16]float32) + v, changed := fastpathTV.DecMapUint16Float32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint16]float32) - fastpathTV.DecMapUint16Float32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint16Float32V(rv2i(rv).(map[uint16]float32), false, d) } } -func (f fastpathT) DecMapUint16Float32X(vp *map[uint16]float32, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint16Float32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint16Float32X(vp *map[uint16]float32, d *Decoder) { + v, changed := f.DecMapUint16Float32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint16Float32V(v map[uint16]float32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint16Float32V(v map[uint16]float32, canChange bool, d *Decoder) (_ map[uint16]float32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 6) v = make(map[uint16]float32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint16 var mv float32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv + mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint16Float64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint16]float64) - v, changed := fastpathTV.DecMapUint16Float64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint16Float64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint16]float64) + v, changed := fastpathTV.DecMapUint16Float64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint16]float64) - fastpathTV.DecMapUint16Float64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint16Float64V(rv2i(rv).(map[uint16]float64), false, d) } } -func (f fastpathT) DecMapUint16Float64X(vp *map[uint16]float64, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint16Float64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint16Float64X(vp *map[uint16]float64, d *Decoder) { + v, changed := f.DecMapUint16Float64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint16Float64V(v map[uint16]float64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint16Float64V(v map[uint16]float64, canChange bool, d *Decoder) (_ map[uint16]float64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) v = make(map[uint16]float64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint16 var mv float64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv + mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeFloat64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint16BoolR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint16]bool) - v, changed := fastpathTV.DecMapUint16BoolV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint16BoolR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint16]bool) + v, changed := fastpathTV.DecMapUint16BoolV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint16]bool) - fastpathTV.DecMapUint16BoolV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint16BoolV(rv2i(rv).(map[uint16]bool), false, d) } } -func (f fastpathT) DecMapUint16BoolX(vp *map[uint16]bool, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint16BoolV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint16BoolX(vp *map[uint16]bool, d *Decoder) { + v, changed := f.DecMapUint16BoolV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint16BoolV(v map[uint16]bool, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint16BoolV(v map[uint16]bool, canChange bool, d *Decoder) (_ map[uint16]bool, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) v = make(map[uint16]bool, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint16 var mv bool - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint16(dd.DecodeUint(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv + mk = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = false } + continue + } + mv = dd.DecodeBool() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint32IntfR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint32]interface{}) - v, changed := fastpathTV.DecMapUint32IntfV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint32IntfR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint32]interface{}) + v, changed := fastpathTV.DecMapUint32IntfV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint32]interface{}) - fastpathTV.DecMapUint32IntfV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint32IntfV(rv2i(rv).(map[uint32]interface{}), false, d) } } -func (f fastpathT) DecMapUint32IntfX(vp *map[uint32]interface{}, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint32IntfV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint32IntfX(vp *map[uint32]interface{}, d *Decoder) { + v, changed := f.DecMapUint32IntfV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint32IntfV(v map[uint32]interface{}, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint32IntfV(v map[uint32]interface{}, canChange bool, d *Decoder) (_ map[uint32]interface{}, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) v = make(map[uint32]interface{}, xlen) changed = true } - mapGet := !d.h.MapValueReset && !d.h.InterfaceReset + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } + mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset var mk uint32 var mv interface{} - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] + mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv + v[mk] = nil } + continue + } + if mapGet { + mv = v[mk] + } else { + mv = nil + } + d.decode(&mv) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint32StringR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint32]string) - v, changed := fastpathTV.DecMapUint32StringV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint32StringR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint32]string) + v, changed := fastpathTV.DecMapUint32StringV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint32]string) - fastpathTV.DecMapUint32StringV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint32StringV(rv2i(rv).(map[uint32]string), false, d) } } -func (f fastpathT) DecMapUint32StringX(vp *map[uint32]string, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint32StringV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint32StringX(vp *map[uint32]string, d *Decoder) { + v, changed := f.DecMapUint32StringV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint32StringV(v map[uint32]string, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint32StringV(v map[uint32]string, canChange bool, d *Decoder) (_ map[uint32]string, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) v = make(map[uint32]string, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint32 var mv string - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv + mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = "" } + continue + } + mv = dd.DecodeString() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint32UintR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint32]uint) - v, changed := fastpathTV.DecMapUint32UintV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint32UintR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint32]uint) + v, changed := fastpathTV.DecMapUint32UintV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint32]uint) - fastpathTV.DecMapUint32UintV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint32UintV(rv2i(rv).(map[uint32]uint), false, d) } } -func (f fastpathT) DecMapUint32UintX(vp *map[uint32]uint, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint32UintV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint32UintX(vp *map[uint32]uint, d *Decoder) { + v, changed := f.DecMapUint32UintV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint32UintV(v map[uint32]uint, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint32UintV(v map[uint32]uint, canChange bool, d *Decoder) (_ map[uint32]uint, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[uint32]uint, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint32 var mv uint - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint32Uint8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint32]uint8) - v, changed := fastpathTV.DecMapUint32Uint8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint32Uint8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint32]uint8) + v, changed := fastpathTV.DecMapUint32Uint8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint32]uint8) - fastpathTV.DecMapUint32Uint8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint32Uint8V(rv2i(rv).(map[uint32]uint8), false, d) } } -func (f fastpathT) DecMapUint32Uint8X(vp *map[uint32]uint8, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint32Uint8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint32Uint8X(vp *map[uint32]uint8, d *Decoder) { + v, changed := f.DecMapUint32Uint8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint32Uint8V(v map[uint32]uint8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint32Uint8V(v map[uint32]uint8, canChange bool, d *Decoder) (_ map[uint32]uint8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) v = make(map[uint32]uint8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint32 var mv uint8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv + mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint32Uint16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint32]uint16) - v, changed := fastpathTV.DecMapUint32Uint16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint32Uint16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint32]uint16) + v, changed := fastpathTV.DecMapUint32Uint16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint32]uint16) - fastpathTV.DecMapUint32Uint16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint32Uint16V(rv2i(rv).(map[uint32]uint16), false, d) } } -func (f fastpathT) DecMapUint32Uint16X(vp *map[uint32]uint16, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint32Uint16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint32Uint16X(vp *map[uint32]uint16, d *Decoder) { + v, changed := f.DecMapUint32Uint16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint32Uint16V(v map[uint32]uint16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint32Uint16V(v map[uint32]uint16, canChange bool, d *Decoder) (_ map[uint32]uint16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 6) v = make(map[uint32]uint16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint32 var mv uint16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv + mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint32Uint32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint32]uint32) - v, changed := fastpathTV.DecMapUint32Uint32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint32Uint32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint32]uint32) + v, changed := fastpathTV.DecMapUint32Uint32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint32]uint32) - fastpathTV.DecMapUint32Uint32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint32Uint32V(rv2i(rv).(map[uint32]uint32), false, d) } } -func (f fastpathT) DecMapUint32Uint32X(vp *map[uint32]uint32, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint32Uint32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint32Uint32X(vp *map[uint32]uint32, d *Decoder) { + v, changed := f.DecMapUint32Uint32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint32Uint32V(v map[uint32]uint32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint32Uint32V(v map[uint32]uint32, canChange bool, d *Decoder) (_ map[uint32]uint32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 8) v = make(map[uint32]uint32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint32 var mv uint32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv + mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint32Uint64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint32]uint64) - v, changed := fastpathTV.DecMapUint32Uint64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint32Uint64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint32]uint64) + v, changed := fastpathTV.DecMapUint32Uint64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint32]uint64) - fastpathTV.DecMapUint32Uint64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint32Uint64V(rv2i(rv).(map[uint32]uint64), false, d) } } -func (f fastpathT) DecMapUint32Uint64X(vp *map[uint32]uint64, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint32Uint64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint32Uint64X(vp *map[uint32]uint64, d *Decoder) { + v, changed := f.DecMapUint32Uint64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint32Uint64V(v map[uint32]uint64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint32Uint64V(v map[uint32]uint64, canChange bool, d *Decoder) (_ map[uint32]uint64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[uint32]uint64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint32 var mv uint64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv + mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeUint64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint32UintptrR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint32]uintptr) - v, changed := fastpathTV.DecMapUint32UintptrV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint32UintptrR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint32]uintptr) + v, changed := fastpathTV.DecMapUint32UintptrV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint32]uintptr) - fastpathTV.DecMapUint32UintptrV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint32UintptrV(rv2i(rv).(map[uint32]uintptr), false, d) } } -func (f fastpathT) DecMapUint32UintptrX(vp *map[uint32]uintptr, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint32UintptrV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint32UintptrX(vp *map[uint32]uintptr, d *Decoder) { + v, changed := f.DecMapUint32UintptrV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint32UintptrV(v map[uint32]uintptr, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint32UintptrV(v map[uint32]uintptr, canChange bool, d *Decoder) (_ map[uint32]uintptr, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[uint32]uintptr, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint32 var mv uintptr - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint32IntR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint32]int) - v, changed := fastpathTV.DecMapUint32IntV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint32IntR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint32]int) + v, changed := fastpathTV.DecMapUint32IntV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint32]int) - fastpathTV.DecMapUint32IntV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint32IntV(rv2i(rv).(map[uint32]int), false, d) } } -func (f fastpathT) DecMapUint32IntX(vp *map[uint32]int, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint32IntV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint32IntX(vp *map[uint32]int, d *Decoder) { + v, changed := f.DecMapUint32IntV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint32IntV(v map[uint32]int, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint32IntV(v map[uint32]int, canChange bool, d *Decoder) (_ map[uint32]int, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[uint32]int, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint32 var mv int - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv + mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint32Int8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint32]int8) - v, changed := fastpathTV.DecMapUint32Int8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint32Int8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint32]int8) + v, changed := fastpathTV.DecMapUint32Int8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint32]int8) - fastpathTV.DecMapUint32Int8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint32Int8V(rv2i(rv).(map[uint32]int8), false, d) } } -func (f fastpathT) DecMapUint32Int8X(vp *map[uint32]int8, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint32Int8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint32Int8X(vp *map[uint32]int8, d *Decoder) { + v, changed := f.DecMapUint32Int8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint32Int8V(v map[uint32]int8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint32Int8V(v map[uint32]int8, canChange bool, d *Decoder) (_ map[uint32]int8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) v = make(map[uint32]int8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint32 var mv int8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv + mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint32Int16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint32]int16) - v, changed := fastpathTV.DecMapUint32Int16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint32Int16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint32]int16) + v, changed := fastpathTV.DecMapUint32Int16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint32]int16) - fastpathTV.DecMapUint32Int16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint32Int16V(rv2i(rv).(map[uint32]int16), false, d) } } -func (f fastpathT) DecMapUint32Int16X(vp *map[uint32]int16, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint32Int16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint32Int16X(vp *map[uint32]int16, d *Decoder) { + v, changed := f.DecMapUint32Int16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint32Int16V(v map[uint32]int16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint32Int16V(v map[uint32]int16, canChange bool, d *Decoder) (_ map[uint32]int16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 6) v = make(map[uint32]int16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint32 var mv int16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv + mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint32Int32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint32]int32) - v, changed := fastpathTV.DecMapUint32Int32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint32Int32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint32]int32) + v, changed := fastpathTV.DecMapUint32Int32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint32]int32) - fastpathTV.DecMapUint32Int32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint32Int32V(rv2i(rv).(map[uint32]int32), false, d) } } -func (f fastpathT) DecMapUint32Int32X(vp *map[uint32]int32, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint32Int32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint32Int32X(vp *map[uint32]int32, d *Decoder) { + v, changed := f.DecMapUint32Int32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint32Int32V(v map[uint32]int32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint32Int32V(v map[uint32]int32, canChange bool, d *Decoder) (_ map[uint32]int32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 8) v = make(map[uint32]int32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint32 var mv int32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv + mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint32Int64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint32]int64) - v, changed := fastpathTV.DecMapUint32Int64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint32Int64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint32]int64) + v, changed := fastpathTV.DecMapUint32Int64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint32]int64) - fastpathTV.DecMapUint32Int64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint32Int64V(rv2i(rv).(map[uint32]int64), false, d) } } -func (f fastpathT) DecMapUint32Int64X(vp *map[uint32]int64, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint32Int64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint32Int64X(vp *map[uint32]int64, d *Decoder) { + v, changed := f.DecMapUint32Int64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint32Int64V(v map[uint32]int64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint32Int64V(v map[uint32]int64, canChange bool, d *Decoder) (_ map[uint32]int64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[uint32]int64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint32 var mv int64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv + mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeInt64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint32Float32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint32]float32) - v, changed := fastpathTV.DecMapUint32Float32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint32Float32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint32]float32) + v, changed := fastpathTV.DecMapUint32Float32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint32]float32) - fastpathTV.DecMapUint32Float32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint32Float32V(rv2i(rv).(map[uint32]float32), false, d) } } -func (f fastpathT) DecMapUint32Float32X(vp *map[uint32]float32, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint32Float32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint32Float32X(vp *map[uint32]float32, d *Decoder) { + v, changed := f.DecMapUint32Float32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint32Float32V(v map[uint32]float32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint32Float32V(v map[uint32]float32, canChange bool, d *Decoder) (_ map[uint32]float32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 8) v = make(map[uint32]float32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint32 var mv float32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv + mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint32Float64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint32]float64) - v, changed := fastpathTV.DecMapUint32Float64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint32Float64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint32]float64) + v, changed := fastpathTV.DecMapUint32Float64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint32]float64) - fastpathTV.DecMapUint32Float64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint32Float64V(rv2i(rv).(map[uint32]float64), false, d) } } -func (f fastpathT) DecMapUint32Float64X(vp *map[uint32]float64, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint32Float64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint32Float64X(vp *map[uint32]float64, d *Decoder) { + v, changed := f.DecMapUint32Float64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint32Float64V(v map[uint32]float64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint32Float64V(v map[uint32]float64, canChange bool, d *Decoder) (_ map[uint32]float64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[uint32]float64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint32 var mv float64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv + mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeFloat64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint32BoolR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint32]bool) - v, changed := fastpathTV.DecMapUint32BoolV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint32BoolR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint32]bool) + v, changed := fastpathTV.DecMapUint32BoolV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint32]bool) - fastpathTV.DecMapUint32BoolV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint32BoolV(rv2i(rv).(map[uint32]bool), false, d) } } -func (f fastpathT) DecMapUint32BoolX(vp *map[uint32]bool, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint32BoolV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint32BoolX(vp *map[uint32]bool, d *Decoder) { + v, changed := f.DecMapUint32BoolV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint32BoolV(v map[uint32]bool, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint32BoolV(v map[uint32]bool, canChange bool, d *Decoder) (_ map[uint32]bool, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) v = make(map[uint32]bool, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint32 var mv bool - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uint32(dd.DecodeUint(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv + mk = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = false } + continue + } + mv = dd.DecodeBool() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint64IntfR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint64]interface{}) - v, changed := fastpathTV.DecMapUint64IntfV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint64IntfR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint64]interface{}) + v, changed := fastpathTV.DecMapUint64IntfV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint64]interface{}) - fastpathTV.DecMapUint64IntfV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint64IntfV(rv2i(rv).(map[uint64]interface{}), false, d) } } -func (f fastpathT) DecMapUint64IntfX(vp *map[uint64]interface{}, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint64IntfV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint64IntfX(vp *map[uint64]interface{}, d *Decoder) { + v, changed := f.DecMapUint64IntfV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint64IntfV(v map[uint64]interface{}, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint64IntfV(v map[uint64]interface{}, canChange bool, d *Decoder) (_ map[uint64]interface{}, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) v = make(map[uint64]interface{}, xlen) changed = true } - mapGet := !d.h.MapValueReset && !d.h.InterfaceReset + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } + mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset var mk uint64 var mv interface{} - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] + mk = dd.DecodeUint64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv + v[mk] = nil } + continue + } + if mapGet { + mv = v[mk] + } else { + mv = nil + } + d.decode(&mv) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint64StringR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint64]string) - v, changed := fastpathTV.DecMapUint64StringV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint64StringR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint64]string) + v, changed := fastpathTV.DecMapUint64StringV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint64]string) - fastpathTV.DecMapUint64StringV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint64StringV(rv2i(rv).(map[uint64]string), false, d) } } -func (f fastpathT) DecMapUint64StringX(vp *map[uint64]string, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint64StringV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint64StringX(vp *map[uint64]string, d *Decoder) { + v, changed := f.DecMapUint64StringV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint64StringV(v map[uint64]string, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint64StringV(v map[uint64]string, canChange bool, d *Decoder) (_ map[uint64]string, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) v = make(map[uint64]string, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint64 var mv string - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv + mk = dd.DecodeUint64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = "" } + continue + } + mv = dd.DecodeString() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint64UintR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint64]uint) - v, changed := fastpathTV.DecMapUint64UintV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint64UintR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint64]uint) + v, changed := fastpathTV.DecMapUint64UintV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint64]uint) - fastpathTV.DecMapUint64UintV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint64UintV(rv2i(rv).(map[uint64]uint), false, d) } } -func (f fastpathT) DecMapUint64UintX(vp *map[uint64]uint, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint64UintV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint64UintX(vp *map[uint64]uint, d *Decoder) { + v, changed := f.DecMapUint64UintV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint64UintV(v map[uint64]uint, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint64UintV(v map[uint64]uint, canChange bool, d *Decoder) (_ map[uint64]uint, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[uint64]uint, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint64 var mv uint - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = dd.DecodeUint64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint64Uint8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint64]uint8) - v, changed := fastpathTV.DecMapUint64Uint8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint64Uint8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint64]uint8) + v, changed := fastpathTV.DecMapUint64Uint8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint64]uint8) - fastpathTV.DecMapUint64Uint8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint64Uint8V(rv2i(rv).(map[uint64]uint8), false, d) } } -func (f fastpathT) DecMapUint64Uint8X(vp *map[uint64]uint8, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint64Uint8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint64Uint8X(vp *map[uint64]uint8, d *Decoder) { + v, changed := f.DecMapUint64Uint8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint64Uint8V(v map[uint64]uint8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint64Uint8V(v map[uint64]uint8, canChange bool, d *Decoder) (_ map[uint64]uint8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[uint64]uint8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint64 var mv uint8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv + mk = dd.DecodeUint64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint64Uint16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint64]uint16) - v, changed := fastpathTV.DecMapUint64Uint16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint64Uint16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint64]uint16) + v, changed := fastpathTV.DecMapUint64Uint16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint64]uint16) - fastpathTV.DecMapUint64Uint16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint64Uint16V(rv2i(rv).(map[uint64]uint16), false, d) } } -func (f fastpathT) DecMapUint64Uint16X(vp *map[uint64]uint16, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint64Uint16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint64Uint16X(vp *map[uint64]uint16, d *Decoder) { + v, changed := f.DecMapUint64Uint16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint64Uint16V(v map[uint64]uint16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint64Uint16V(v map[uint64]uint16, canChange bool, d *Decoder) (_ map[uint64]uint16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) v = make(map[uint64]uint16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint64 var mv uint16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv + mk = dd.DecodeUint64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint64Uint32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint64]uint32) - v, changed := fastpathTV.DecMapUint64Uint32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint64Uint32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint64]uint32) + v, changed := fastpathTV.DecMapUint64Uint32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint64]uint32) - fastpathTV.DecMapUint64Uint32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint64Uint32V(rv2i(rv).(map[uint64]uint32), false, d) } } -func (f fastpathT) DecMapUint64Uint32X(vp *map[uint64]uint32, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint64Uint32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint64Uint32X(vp *map[uint64]uint32, d *Decoder) { + v, changed := f.DecMapUint64Uint32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint64Uint32V(v map[uint64]uint32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint64Uint32V(v map[uint64]uint32, canChange bool, d *Decoder) (_ map[uint64]uint32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[uint64]uint32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint64 var mv uint32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv + mk = dd.DecodeUint64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint64Uint64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint64]uint64) - v, changed := fastpathTV.DecMapUint64Uint64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint64Uint64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint64]uint64) + v, changed := fastpathTV.DecMapUint64Uint64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint64]uint64) - fastpathTV.DecMapUint64Uint64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint64Uint64V(rv2i(rv).(map[uint64]uint64), false, d) } } -func (f fastpathT) DecMapUint64Uint64X(vp *map[uint64]uint64, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint64Uint64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint64Uint64X(vp *map[uint64]uint64, d *Decoder) { + v, changed := f.DecMapUint64Uint64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint64Uint64V(v map[uint64]uint64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint64Uint64V(v map[uint64]uint64, canChange bool, d *Decoder) (_ map[uint64]uint64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[uint64]uint64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint64 var mv uint64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv + mk = dd.DecodeUint64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeUint64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint64UintptrR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint64]uintptr) - v, changed := fastpathTV.DecMapUint64UintptrV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint64UintptrR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint64]uintptr) + v, changed := fastpathTV.DecMapUint64UintptrV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint64]uintptr) - fastpathTV.DecMapUint64UintptrV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint64UintptrV(rv2i(rv).(map[uint64]uintptr), false, d) } } -func (f fastpathT) DecMapUint64UintptrX(vp *map[uint64]uintptr, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint64UintptrV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint64UintptrX(vp *map[uint64]uintptr, d *Decoder) { + v, changed := f.DecMapUint64UintptrV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint64UintptrV(v map[uint64]uintptr, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint64UintptrV(v map[uint64]uintptr, canChange bool, d *Decoder) (_ map[uint64]uintptr, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[uint64]uintptr, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint64 var mv uintptr - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = dd.DecodeUint64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint64IntR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint64]int) - v, changed := fastpathTV.DecMapUint64IntV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint64IntR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint64]int) + v, changed := fastpathTV.DecMapUint64IntV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint64]int) - fastpathTV.DecMapUint64IntV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint64IntV(rv2i(rv).(map[uint64]int), false, d) } } -func (f fastpathT) DecMapUint64IntX(vp *map[uint64]int, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint64IntV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint64IntX(vp *map[uint64]int, d *Decoder) { + v, changed := f.DecMapUint64IntV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint64IntV(v map[uint64]int, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint64IntV(v map[uint64]int, canChange bool, d *Decoder) (_ map[uint64]int, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[uint64]int, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint64 var mv int - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv + mk = dd.DecodeUint64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint64Int8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint64]int8) - v, changed := fastpathTV.DecMapUint64Int8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint64Int8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint64]int8) + v, changed := fastpathTV.DecMapUint64Int8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint64]int8) - fastpathTV.DecMapUint64Int8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint64Int8V(rv2i(rv).(map[uint64]int8), false, d) } } -func (f fastpathT) DecMapUint64Int8X(vp *map[uint64]int8, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint64Int8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint64Int8X(vp *map[uint64]int8, d *Decoder) { + v, changed := f.DecMapUint64Int8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint64Int8V(v map[uint64]int8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint64Int8V(v map[uint64]int8, canChange bool, d *Decoder) (_ map[uint64]int8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[uint64]int8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint64 var mv int8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv + mk = dd.DecodeUint64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint64Int16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint64]int16) - v, changed := fastpathTV.DecMapUint64Int16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint64Int16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint64]int16) + v, changed := fastpathTV.DecMapUint64Int16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint64]int16) - fastpathTV.DecMapUint64Int16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint64Int16V(rv2i(rv).(map[uint64]int16), false, d) } } -func (f fastpathT) DecMapUint64Int16X(vp *map[uint64]int16, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint64Int16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint64Int16X(vp *map[uint64]int16, d *Decoder) { + v, changed := f.DecMapUint64Int16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint64Int16V(v map[uint64]int16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint64Int16V(v map[uint64]int16, canChange bool, d *Decoder) (_ map[uint64]int16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) v = make(map[uint64]int16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint64 var mv int16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv + mk = dd.DecodeUint64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint64Int32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint64]int32) - v, changed := fastpathTV.DecMapUint64Int32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint64Int32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint64]int32) + v, changed := fastpathTV.DecMapUint64Int32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint64]int32) - fastpathTV.DecMapUint64Int32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint64Int32V(rv2i(rv).(map[uint64]int32), false, d) } } -func (f fastpathT) DecMapUint64Int32X(vp *map[uint64]int32, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint64Int32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint64Int32X(vp *map[uint64]int32, d *Decoder) { + v, changed := f.DecMapUint64Int32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint64Int32V(v map[uint64]int32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint64Int32V(v map[uint64]int32, canChange bool, d *Decoder) (_ map[uint64]int32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[uint64]int32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint64 var mv int32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv + mk = dd.DecodeUint64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint64Int64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint64]int64) - v, changed := fastpathTV.DecMapUint64Int64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint64Int64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint64]int64) + v, changed := fastpathTV.DecMapUint64Int64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint64]int64) - fastpathTV.DecMapUint64Int64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint64Int64V(rv2i(rv).(map[uint64]int64), false, d) } } -func (f fastpathT) DecMapUint64Int64X(vp *map[uint64]int64, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint64Int64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint64Int64X(vp *map[uint64]int64, d *Decoder) { + v, changed := f.DecMapUint64Int64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint64Int64V(v map[uint64]int64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint64Int64V(v map[uint64]int64, canChange bool, d *Decoder) (_ map[uint64]int64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[uint64]int64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint64 var mv int64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv + mk = dd.DecodeUint64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeInt64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint64Float32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint64]float32) - v, changed := fastpathTV.DecMapUint64Float32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint64Float32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint64]float32) + v, changed := fastpathTV.DecMapUint64Float32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint64]float32) - fastpathTV.DecMapUint64Float32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint64Float32V(rv2i(rv).(map[uint64]float32), false, d) } } -func (f fastpathT) DecMapUint64Float32X(vp *map[uint64]float32, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint64Float32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint64Float32X(vp *map[uint64]float32, d *Decoder) { + v, changed := f.DecMapUint64Float32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint64Float32V(v map[uint64]float32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint64Float32V(v map[uint64]float32, canChange bool, d *Decoder) (_ map[uint64]float32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[uint64]float32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint64 var mv float32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv + mk = dd.DecodeUint64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint64Float64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint64]float64) - v, changed := fastpathTV.DecMapUint64Float64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint64Float64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint64]float64) + v, changed := fastpathTV.DecMapUint64Float64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint64]float64) - fastpathTV.DecMapUint64Float64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint64Float64V(rv2i(rv).(map[uint64]float64), false, d) } } -func (f fastpathT) DecMapUint64Float64X(vp *map[uint64]float64, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint64Float64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint64Float64X(vp *map[uint64]float64, d *Decoder) { + v, changed := f.DecMapUint64Float64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint64Float64V(v map[uint64]float64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint64Float64V(v map[uint64]float64, canChange bool, d *Decoder) (_ map[uint64]float64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[uint64]float64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint64 var mv float64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv + mk = dd.DecodeUint64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeFloat64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUint64BoolR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uint64]bool) - v, changed := fastpathTV.DecMapUint64BoolV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUint64BoolR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uint64]bool) + v, changed := fastpathTV.DecMapUint64BoolV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uint64]bool) - fastpathTV.DecMapUint64BoolV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUint64BoolV(rv2i(rv).(map[uint64]bool), false, d) } } -func (f fastpathT) DecMapUint64BoolX(vp *map[uint64]bool, checkNil bool, d *Decoder) { - v, changed := f.DecMapUint64BoolV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUint64BoolX(vp *map[uint64]bool, d *Decoder) { + v, changed := f.DecMapUint64BoolV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUint64BoolV(v map[uint64]bool, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUint64BoolV(v map[uint64]bool, canChange bool, d *Decoder) (_ map[uint64]bool, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[uint64]bool, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uint64 var mv bool - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeUint(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv + mk = dd.DecodeUint64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = false } + continue + } + mv = dd.DecodeBool() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintptrIntfR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uintptr]interface{}) - v, changed := fastpathTV.DecMapUintptrIntfV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintptrIntfR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uintptr]interface{}) + v, changed := fastpathTV.DecMapUintptrIntfV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uintptr]interface{}) - fastpathTV.DecMapUintptrIntfV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintptrIntfV(rv2i(rv).(map[uintptr]interface{}), false, d) } } -func (f fastpathT) DecMapUintptrIntfX(vp *map[uintptr]interface{}, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintptrIntfV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintptrIntfX(vp *map[uintptr]interface{}, d *Decoder) { + v, changed := f.DecMapUintptrIntfV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintptrIntfV(v map[uintptr]interface{}, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintptrIntfV(v map[uintptr]interface{}, canChange bool, d *Decoder) (_ map[uintptr]interface{}, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) v = make(map[uintptr]interface{}, xlen) changed = true } - mapGet := !d.h.MapValueReset && !d.h.InterfaceReset + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } + mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset var mk uintptr var mv interface{} - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] + mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv + v[mk] = nil } + continue + } + if mapGet { + mv = v[mk] + } else { + mv = nil + } + d.decode(&mv) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintptrStringR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uintptr]string) - v, changed := fastpathTV.DecMapUintptrStringV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintptrStringR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uintptr]string) + v, changed := fastpathTV.DecMapUintptrStringV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uintptr]string) - fastpathTV.DecMapUintptrStringV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintptrStringV(rv2i(rv).(map[uintptr]string), false, d) } } -func (f fastpathT) DecMapUintptrStringX(vp *map[uintptr]string, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintptrStringV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintptrStringX(vp *map[uintptr]string, d *Decoder) { + v, changed := f.DecMapUintptrStringV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintptrStringV(v map[uintptr]string, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintptrStringV(v map[uintptr]string, canChange bool, d *Decoder) (_ map[uintptr]string, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) v = make(map[uintptr]string, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uintptr var mv string - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv + mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = "" } + continue + } + mv = dd.DecodeString() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintptrUintR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uintptr]uint) - v, changed := fastpathTV.DecMapUintptrUintV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintptrUintR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uintptr]uint) + v, changed := fastpathTV.DecMapUintptrUintV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uintptr]uint) - fastpathTV.DecMapUintptrUintV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintptrUintV(rv2i(rv).(map[uintptr]uint), false, d) } } -func (f fastpathT) DecMapUintptrUintX(vp *map[uintptr]uint, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintptrUintV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintptrUintX(vp *map[uintptr]uint, d *Decoder) { + v, changed := f.DecMapUintptrUintV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintptrUintV(v map[uintptr]uint, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintptrUintV(v map[uintptr]uint, canChange bool, d *Decoder) (_ map[uintptr]uint, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[uintptr]uint, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uintptr var mv uint - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintptrUint8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uintptr]uint8) - v, changed := fastpathTV.DecMapUintptrUint8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintptrUint8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uintptr]uint8) + v, changed := fastpathTV.DecMapUintptrUint8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uintptr]uint8) - fastpathTV.DecMapUintptrUint8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintptrUint8V(rv2i(rv).(map[uintptr]uint8), false, d) } } -func (f fastpathT) DecMapUintptrUint8X(vp *map[uintptr]uint8, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintptrUint8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintptrUint8X(vp *map[uintptr]uint8, d *Decoder) { + v, changed := f.DecMapUintptrUint8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintptrUint8V(v map[uintptr]uint8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintptrUint8V(v map[uintptr]uint8, canChange bool, d *Decoder) (_ map[uintptr]uint8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[uintptr]uint8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uintptr var mv uint8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv + mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintptrUint16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uintptr]uint16) - v, changed := fastpathTV.DecMapUintptrUint16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintptrUint16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uintptr]uint16) + v, changed := fastpathTV.DecMapUintptrUint16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uintptr]uint16) - fastpathTV.DecMapUintptrUint16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintptrUint16V(rv2i(rv).(map[uintptr]uint16), false, d) } } -func (f fastpathT) DecMapUintptrUint16X(vp *map[uintptr]uint16, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintptrUint16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintptrUint16X(vp *map[uintptr]uint16, d *Decoder) { + v, changed := f.DecMapUintptrUint16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintptrUint16V(v map[uintptr]uint16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintptrUint16V(v map[uintptr]uint16, canChange bool, d *Decoder) (_ map[uintptr]uint16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) v = make(map[uintptr]uint16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uintptr var mv uint16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv + mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintptrUint32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uintptr]uint32) - v, changed := fastpathTV.DecMapUintptrUint32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintptrUint32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uintptr]uint32) + v, changed := fastpathTV.DecMapUintptrUint32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uintptr]uint32) - fastpathTV.DecMapUintptrUint32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintptrUint32V(rv2i(rv).(map[uintptr]uint32), false, d) } } -func (f fastpathT) DecMapUintptrUint32X(vp *map[uintptr]uint32, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintptrUint32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintptrUint32X(vp *map[uintptr]uint32, d *Decoder) { + v, changed := f.DecMapUintptrUint32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintptrUint32V(v map[uintptr]uint32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintptrUint32V(v map[uintptr]uint32, canChange bool, d *Decoder) (_ map[uintptr]uint32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[uintptr]uint32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uintptr var mv uint32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv + mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintptrUint64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uintptr]uint64) - v, changed := fastpathTV.DecMapUintptrUint64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintptrUint64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uintptr]uint64) + v, changed := fastpathTV.DecMapUintptrUint64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uintptr]uint64) - fastpathTV.DecMapUintptrUint64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintptrUint64V(rv2i(rv).(map[uintptr]uint64), false, d) } } -func (f fastpathT) DecMapUintptrUint64X(vp *map[uintptr]uint64, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintptrUint64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintptrUint64X(vp *map[uintptr]uint64, d *Decoder) { + v, changed := f.DecMapUintptrUint64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintptrUint64V(v map[uintptr]uint64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintptrUint64V(v map[uintptr]uint64, canChange bool, d *Decoder) (_ map[uintptr]uint64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[uintptr]uint64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uintptr var mv uint64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv + mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeUint64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintptrUintptrR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uintptr]uintptr) - v, changed := fastpathTV.DecMapUintptrUintptrV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintptrUintptrR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uintptr]uintptr) + v, changed := fastpathTV.DecMapUintptrUintptrV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uintptr]uintptr) - fastpathTV.DecMapUintptrUintptrV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintptrUintptrV(rv2i(rv).(map[uintptr]uintptr), false, d) } } -func (f fastpathT) DecMapUintptrUintptrX(vp *map[uintptr]uintptr, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintptrUintptrV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintptrUintptrX(vp *map[uintptr]uintptr, d *Decoder) { + v, changed := f.DecMapUintptrUintptrV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintptrUintptrV(v map[uintptr]uintptr, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintptrUintptrV(v map[uintptr]uintptr, canChange bool, d *Decoder) (_ map[uintptr]uintptr, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[uintptr]uintptr, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uintptr var mv uintptr - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintptrIntR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uintptr]int) - v, changed := fastpathTV.DecMapUintptrIntV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintptrIntR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uintptr]int) + v, changed := fastpathTV.DecMapUintptrIntV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uintptr]int) - fastpathTV.DecMapUintptrIntV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintptrIntV(rv2i(rv).(map[uintptr]int), false, d) } } -func (f fastpathT) DecMapUintptrIntX(vp *map[uintptr]int, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintptrIntV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintptrIntX(vp *map[uintptr]int, d *Decoder) { + v, changed := f.DecMapUintptrIntV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintptrIntV(v map[uintptr]int, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintptrIntV(v map[uintptr]int, canChange bool, d *Decoder) (_ map[uintptr]int, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[uintptr]int, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uintptr var mv int - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv + mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintptrInt8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uintptr]int8) - v, changed := fastpathTV.DecMapUintptrInt8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintptrInt8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uintptr]int8) + v, changed := fastpathTV.DecMapUintptrInt8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uintptr]int8) - fastpathTV.DecMapUintptrInt8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintptrInt8V(rv2i(rv).(map[uintptr]int8), false, d) } } -func (f fastpathT) DecMapUintptrInt8X(vp *map[uintptr]int8, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintptrInt8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintptrInt8X(vp *map[uintptr]int8, d *Decoder) { + v, changed := f.DecMapUintptrInt8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintptrInt8V(v map[uintptr]int8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintptrInt8V(v map[uintptr]int8, canChange bool, d *Decoder) (_ map[uintptr]int8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[uintptr]int8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uintptr var mv int8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv + mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintptrInt16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uintptr]int16) - v, changed := fastpathTV.DecMapUintptrInt16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintptrInt16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uintptr]int16) + v, changed := fastpathTV.DecMapUintptrInt16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uintptr]int16) - fastpathTV.DecMapUintptrInt16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintptrInt16V(rv2i(rv).(map[uintptr]int16), false, d) } } -func (f fastpathT) DecMapUintptrInt16X(vp *map[uintptr]int16, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintptrInt16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintptrInt16X(vp *map[uintptr]int16, d *Decoder) { + v, changed := f.DecMapUintptrInt16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintptrInt16V(v map[uintptr]int16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintptrInt16V(v map[uintptr]int16, canChange bool, d *Decoder) (_ map[uintptr]int16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) v = make(map[uintptr]int16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uintptr var mv int16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv + mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintptrInt32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uintptr]int32) - v, changed := fastpathTV.DecMapUintptrInt32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintptrInt32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uintptr]int32) + v, changed := fastpathTV.DecMapUintptrInt32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uintptr]int32) - fastpathTV.DecMapUintptrInt32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintptrInt32V(rv2i(rv).(map[uintptr]int32), false, d) } } -func (f fastpathT) DecMapUintptrInt32X(vp *map[uintptr]int32, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintptrInt32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintptrInt32X(vp *map[uintptr]int32, d *Decoder) { + v, changed := f.DecMapUintptrInt32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintptrInt32V(v map[uintptr]int32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintptrInt32V(v map[uintptr]int32, canChange bool, d *Decoder) (_ map[uintptr]int32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[uintptr]int32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uintptr var mv int32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv + mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintptrInt64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uintptr]int64) - v, changed := fastpathTV.DecMapUintptrInt64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintptrInt64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uintptr]int64) + v, changed := fastpathTV.DecMapUintptrInt64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uintptr]int64) - fastpathTV.DecMapUintptrInt64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintptrInt64V(rv2i(rv).(map[uintptr]int64), false, d) } } -func (f fastpathT) DecMapUintptrInt64X(vp *map[uintptr]int64, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintptrInt64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintptrInt64X(vp *map[uintptr]int64, d *Decoder) { + v, changed := f.DecMapUintptrInt64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintptrInt64V(v map[uintptr]int64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintptrInt64V(v map[uintptr]int64, canChange bool, d *Decoder) (_ map[uintptr]int64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[uintptr]int64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uintptr var mv int64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv + mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeInt64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintptrFloat32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uintptr]float32) - v, changed := fastpathTV.DecMapUintptrFloat32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintptrFloat32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uintptr]float32) + v, changed := fastpathTV.DecMapUintptrFloat32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uintptr]float32) - fastpathTV.DecMapUintptrFloat32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintptrFloat32V(rv2i(rv).(map[uintptr]float32), false, d) } } -func (f fastpathT) DecMapUintptrFloat32X(vp *map[uintptr]float32, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintptrFloat32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintptrFloat32X(vp *map[uintptr]float32, d *Decoder) { + v, changed := f.DecMapUintptrFloat32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintptrFloat32V(v map[uintptr]float32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintptrFloat32V(v map[uintptr]float32, canChange bool, d *Decoder) (_ map[uintptr]float32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[uintptr]float32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uintptr var mv float32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv + mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintptrFloat64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uintptr]float64) - v, changed := fastpathTV.DecMapUintptrFloat64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintptrFloat64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uintptr]float64) + v, changed := fastpathTV.DecMapUintptrFloat64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uintptr]float64) - fastpathTV.DecMapUintptrFloat64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintptrFloat64V(rv2i(rv).(map[uintptr]float64), false, d) } } -func (f fastpathT) DecMapUintptrFloat64X(vp *map[uintptr]float64, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintptrFloat64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintptrFloat64X(vp *map[uintptr]float64, d *Decoder) { + v, changed := f.DecMapUintptrFloat64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintptrFloat64V(v map[uintptr]float64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintptrFloat64V(v map[uintptr]float64, canChange bool, d *Decoder) (_ map[uintptr]float64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[uintptr]float64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uintptr var mv float64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv + mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeFloat64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapUintptrBoolR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[uintptr]bool) - v, changed := fastpathTV.DecMapUintptrBoolV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapUintptrBoolR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[uintptr]bool) + v, changed := fastpathTV.DecMapUintptrBoolV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[uintptr]bool) - fastpathTV.DecMapUintptrBoolV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapUintptrBoolV(rv2i(rv).(map[uintptr]bool), false, d) } } -func (f fastpathT) DecMapUintptrBoolX(vp *map[uintptr]bool, checkNil bool, d *Decoder) { - v, changed := f.DecMapUintptrBoolV(*vp, checkNil, true, d) +func (f fastpathT) DecMapUintptrBoolX(vp *map[uintptr]bool, d *Decoder) { + v, changed := f.DecMapUintptrBoolV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapUintptrBoolV(v map[uintptr]bool, checkNil bool, canChange bool, +func (_ fastpathT) DecMapUintptrBoolV(v map[uintptr]bool, canChange bool, d *Decoder) (_ map[uintptr]bool, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[uintptr]bool, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk uintptr var mv bool - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = uintptr(dd.DecodeUint(uintBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv + mk = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = false } + continue + } + mv = dd.DecodeBool() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntIntfR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int]interface{}) - v, changed := fastpathTV.DecMapIntIntfV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntIntfR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int]interface{}) + v, changed := fastpathTV.DecMapIntIntfV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int]interface{}) - fastpathTV.DecMapIntIntfV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntIntfV(rv2i(rv).(map[int]interface{}), false, d) } } -func (f fastpathT) DecMapIntIntfX(vp *map[int]interface{}, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntIntfV(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntIntfX(vp *map[int]interface{}, d *Decoder) { + v, changed := f.DecMapIntIntfV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntIntfV(v map[int]interface{}, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntIntfV(v map[int]interface{}, canChange bool, d *Decoder) (_ map[int]interface{}, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) v = make(map[int]interface{}, xlen) changed = true } - mapGet := !d.h.MapValueReset && !d.h.InterfaceReset + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } + mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset var mk int var mv interface{} - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] + mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv + v[mk] = nil } + continue + } + if mapGet { + mv = v[mk] + } else { + mv = nil + } + d.decode(&mv) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntStringR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int]string) - v, changed := fastpathTV.DecMapIntStringV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntStringR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int]string) + v, changed := fastpathTV.DecMapIntStringV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int]string) - fastpathTV.DecMapIntStringV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntStringV(rv2i(rv).(map[int]string), false, d) } } -func (f fastpathT) DecMapIntStringX(vp *map[int]string, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntStringV(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntStringX(vp *map[int]string, d *Decoder) { + v, changed := f.DecMapIntStringV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntStringV(v map[int]string, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntStringV(v map[int]string, canChange bool, d *Decoder) (_ map[int]string, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) v = make(map[int]string, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int var mv string - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv + mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = "" } + continue + } + mv = dd.DecodeString() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntUintR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int]uint) - v, changed := fastpathTV.DecMapIntUintV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntUintR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int]uint) + v, changed := fastpathTV.DecMapIntUintV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int]uint) - fastpathTV.DecMapIntUintV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntUintV(rv2i(rv).(map[int]uint), false, d) } } -func (f fastpathT) DecMapIntUintX(vp *map[int]uint, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntUintV(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntUintX(vp *map[int]uint, d *Decoder) { + v, changed := f.DecMapIntUintV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntUintV(v map[int]uint, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntUintV(v map[int]uint, canChange bool, d *Decoder) (_ map[int]uint, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[int]uint, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int var mv uint - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntUint8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int]uint8) - v, changed := fastpathTV.DecMapIntUint8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntUint8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int]uint8) + v, changed := fastpathTV.DecMapIntUint8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int]uint8) - fastpathTV.DecMapIntUint8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntUint8V(rv2i(rv).(map[int]uint8), false, d) } } -func (f fastpathT) DecMapIntUint8X(vp *map[int]uint8, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntUint8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntUint8X(vp *map[int]uint8, d *Decoder) { + v, changed := f.DecMapIntUint8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntUint8V(v map[int]uint8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntUint8V(v map[int]uint8, canChange bool, d *Decoder) (_ map[int]uint8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[int]uint8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int var mv uint8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv + mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntUint16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int]uint16) - v, changed := fastpathTV.DecMapIntUint16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntUint16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int]uint16) + v, changed := fastpathTV.DecMapIntUint16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int]uint16) - fastpathTV.DecMapIntUint16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntUint16V(rv2i(rv).(map[int]uint16), false, d) } } -func (f fastpathT) DecMapIntUint16X(vp *map[int]uint16, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntUint16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntUint16X(vp *map[int]uint16, d *Decoder) { + v, changed := f.DecMapIntUint16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntUint16V(v map[int]uint16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntUint16V(v map[int]uint16, canChange bool, d *Decoder) (_ map[int]uint16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) v = make(map[int]uint16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int var mv uint16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv + mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntUint32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int]uint32) - v, changed := fastpathTV.DecMapIntUint32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntUint32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int]uint32) + v, changed := fastpathTV.DecMapIntUint32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int]uint32) - fastpathTV.DecMapIntUint32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntUint32V(rv2i(rv).(map[int]uint32), false, d) } } -func (f fastpathT) DecMapIntUint32X(vp *map[int]uint32, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntUint32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntUint32X(vp *map[int]uint32, d *Decoder) { + v, changed := f.DecMapIntUint32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntUint32V(v map[int]uint32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntUint32V(v map[int]uint32, canChange bool, d *Decoder) (_ map[int]uint32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[int]uint32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int var mv uint32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv + mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntUint64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int]uint64) - v, changed := fastpathTV.DecMapIntUint64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntUint64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int]uint64) + v, changed := fastpathTV.DecMapIntUint64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int]uint64) - fastpathTV.DecMapIntUint64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntUint64V(rv2i(rv).(map[int]uint64), false, d) } } -func (f fastpathT) DecMapIntUint64X(vp *map[int]uint64, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntUint64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntUint64X(vp *map[int]uint64, d *Decoder) { + v, changed := f.DecMapIntUint64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntUint64V(v map[int]uint64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntUint64V(v map[int]uint64, canChange bool, d *Decoder) (_ map[int]uint64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[int]uint64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int var mv uint64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv + mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeUint64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntUintptrR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int]uintptr) - v, changed := fastpathTV.DecMapIntUintptrV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntUintptrR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int]uintptr) + v, changed := fastpathTV.DecMapIntUintptrV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int]uintptr) - fastpathTV.DecMapIntUintptrV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntUintptrV(rv2i(rv).(map[int]uintptr), false, d) } } -func (f fastpathT) DecMapIntUintptrX(vp *map[int]uintptr, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntUintptrV(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntUintptrX(vp *map[int]uintptr, d *Decoder) { + v, changed := f.DecMapIntUintptrV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntUintptrV(v map[int]uintptr, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntUintptrV(v map[int]uintptr, canChange bool, d *Decoder) (_ map[int]uintptr, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[int]uintptr, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int var mv uintptr - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntIntR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int]int) - v, changed := fastpathTV.DecMapIntIntV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntIntR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int]int) + v, changed := fastpathTV.DecMapIntIntV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int]int) - fastpathTV.DecMapIntIntV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntIntV(rv2i(rv).(map[int]int), false, d) } } -func (f fastpathT) DecMapIntIntX(vp *map[int]int, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntIntV(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntIntX(vp *map[int]int, d *Decoder) { + v, changed := f.DecMapIntIntV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntIntV(v map[int]int, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntIntV(v map[int]int, canChange bool, d *Decoder) (_ map[int]int, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[int]int, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int var mv int - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv + mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntInt8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int]int8) - v, changed := fastpathTV.DecMapIntInt8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntInt8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int]int8) + v, changed := fastpathTV.DecMapIntInt8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int]int8) - fastpathTV.DecMapIntInt8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntInt8V(rv2i(rv).(map[int]int8), false, d) } } -func (f fastpathT) DecMapIntInt8X(vp *map[int]int8, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntInt8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntInt8X(vp *map[int]int8, d *Decoder) { + v, changed := f.DecMapIntInt8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntInt8V(v map[int]int8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntInt8V(v map[int]int8, canChange bool, d *Decoder) (_ map[int]int8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[int]int8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int var mv int8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv + mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntInt16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int]int16) - v, changed := fastpathTV.DecMapIntInt16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntInt16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int]int16) + v, changed := fastpathTV.DecMapIntInt16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int]int16) - fastpathTV.DecMapIntInt16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntInt16V(rv2i(rv).(map[int]int16), false, d) } } -func (f fastpathT) DecMapIntInt16X(vp *map[int]int16, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntInt16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntInt16X(vp *map[int]int16, d *Decoder) { + v, changed := f.DecMapIntInt16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntInt16V(v map[int]int16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntInt16V(v map[int]int16, canChange bool, d *Decoder) (_ map[int]int16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) v = make(map[int]int16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int var mv int16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv + mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntInt32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int]int32) - v, changed := fastpathTV.DecMapIntInt32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntInt32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int]int32) + v, changed := fastpathTV.DecMapIntInt32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int]int32) - fastpathTV.DecMapIntInt32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntInt32V(rv2i(rv).(map[int]int32), false, d) } } -func (f fastpathT) DecMapIntInt32X(vp *map[int]int32, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntInt32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntInt32X(vp *map[int]int32, d *Decoder) { + v, changed := f.DecMapIntInt32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntInt32V(v map[int]int32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntInt32V(v map[int]int32, canChange bool, d *Decoder) (_ map[int]int32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[int]int32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int var mv int32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv + mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntInt64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int]int64) - v, changed := fastpathTV.DecMapIntInt64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntInt64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int]int64) + v, changed := fastpathTV.DecMapIntInt64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int]int64) - fastpathTV.DecMapIntInt64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntInt64V(rv2i(rv).(map[int]int64), false, d) } } -func (f fastpathT) DecMapIntInt64X(vp *map[int]int64, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntInt64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntInt64X(vp *map[int]int64, d *Decoder) { + v, changed := f.DecMapIntInt64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntInt64V(v map[int]int64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntInt64V(v map[int]int64, canChange bool, d *Decoder) (_ map[int]int64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[int]int64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int var mv int64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv + mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeInt64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntFloat32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int]float32) - v, changed := fastpathTV.DecMapIntFloat32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntFloat32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int]float32) + v, changed := fastpathTV.DecMapIntFloat32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int]float32) - fastpathTV.DecMapIntFloat32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntFloat32V(rv2i(rv).(map[int]float32), false, d) } } -func (f fastpathT) DecMapIntFloat32X(vp *map[int]float32, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntFloat32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntFloat32X(vp *map[int]float32, d *Decoder) { + v, changed := f.DecMapIntFloat32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntFloat32V(v map[int]float32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntFloat32V(v map[int]float32, canChange bool, d *Decoder) (_ map[int]float32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[int]float32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int var mv float32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv + mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntFloat64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int]float64) - v, changed := fastpathTV.DecMapIntFloat64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntFloat64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int]float64) + v, changed := fastpathTV.DecMapIntFloat64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int]float64) - fastpathTV.DecMapIntFloat64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntFloat64V(rv2i(rv).(map[int]float64), false, d) } } -func (f fastpathT) DecMapIntFloat64X(vp *map[int]float64, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntFloat64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntFloat64X(vp *map[int]float64, d *Decoder) { + v, changed := f.DecMapIntFloat64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntFloat64V(v map[int]float64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntFloat64V(v map[int]float64, canChange bool, d *Decoder) (_ map[int]float64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[int]float64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int var mv float64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv + mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeFloat64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapIntBoolR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int]bool) - v, changed := fastpathTV.DecMapIntBoolV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapIntBoolR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int]bool) + v, changed := fastpathTV.DecMapIntBoolV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int]bool) - fastpathTV.DecMapIntBoolV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapIntBoolV(rv2i(rv).(map[int]bool), false, d) } } -func (f fastpathT) DecMapIntBoolX(vp *map[int]bool, checkNil bool, d *Decoder) { - v, changed := f.DecMapIntBoolV(*vp, checkNil, true, d) +func (f fastpathT) DecMapIntBoolX(vp *map[int]bool, d *Decoder) { + v, changed := f.DecMapIntBoolV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapIntBoolV(v map[int]bool, checkNil bool, canChange bool, +func (_ fastpathT) DecMapIntBoolV(v map[int]bool, canChange bool, d *Decoder) (_ map[int]bool, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[int]bool, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int var mv bool - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int(dd.DecodeInt(intBitsize)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv + mk = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = false } + continue + } + mv = dd.DecodeBool() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt8IntfR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int8]interface{}) - v, changed := fastpathTV.DecMapInt8IntfV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt8IntfR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int8]interface{}) + v, changed := fastpathTV.DecMapInt8IntfV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int8]interface{}) - fastpathTV.DecMapInt8IntfV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt8IntfV(rv2i(rv).(map[int8]interface{}), false, d) } } -func (f fastpathT) DecMapInt8IntfX(vp *map[int8]interface{}, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt8IntfV(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt8IntfX(vp *map[int8]interface{}, d *Decoder) { + v, changed := f.DecMapInt8IntfV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt8IntfV(v map[int8]interface{}, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt8IntfV(v map[int8]interface{}, canChange bool, d *Decoder) (_ map[int8]interface{}, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) v = make(map[int8]interface{}, xlen) changed = true } - mapGet := !d.h.MapValueReset && !d.h.InterfaceReset + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } + mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset var mk int8 var mv interface{} - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] + mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv + v[mk] = nil } + continue + } + if mapGet { + mv = v[mk] + } else { + mv = nil + } + d.decode(&mv) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt8StringR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int8]string) - v, changed := fastpathTV.DecMapInt8StringV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt8StringR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int8]string) + v, changed := fastpathTV.DecMapInt8StringV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int8]string) - fastpathTV.DecMapInt8StringV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt8StringV(rv2i(rv).(map[int8]string), false, d) } } -func (f fastpathT) DecMapInt8StringX(vp *map[int8]string, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt8StringV(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt8StringX(vp *map[int8]string, d *Decoder) { + v, changed := f.DecMapInt8StringV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt8StringV(v map[int8]string, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt8StringV(v map[int8]string, canChange bool, d *Decoder) (_ map[int8]string, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) v = make(map[int8]string, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int8 var mv string - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv + mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = "" } + continue + } + mv = dd.DecodeString() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt8UintR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int8]uint) - v, changed := fastpathTV.DecMapInt8UintV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt8UintR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int8]uint) + v, changed := fastpathTV.DecMapInt8UintV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int8]uint) - fastpathTV.DecMapInt8UintV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt8UintV(rv2i(rv).(map[int8]uint), false, d) } } -func (f fastpathT) DecMapInt8UintX(vp *map[int8]uint, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt8UintV(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt8UintX(vp *map[int8]uint, d *Decoder) { + v, changed := f.DecMapInt8UintV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt8UintV(v map[int8]uint, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt8UintV(v map[int8]uint, canChange bool, d *Decoder) (_ map[int8]uint, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[int8]uint, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int8 var mv uint - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt8Uint8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int8]uint8) - v, changed := fastpathTV.DecMapInt8Uint8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt8Uint8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int8]uint8) + v, changed := fastpathTV.DecMapInt8Uint8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int8]uint8) - fastpathTV.DecMapInt8Uint8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt8Uint8V(rv2i(rv).(map[int8]uint8), false, d) } } -func (f fastpathT) DecMapInt8Uint8X(vp *map[int8]uint8, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt8Uint8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt8Uint8X(vp *map[int8]uint8, d *Decoder) { + v, changed := f.DecMapInt8Uint8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt8Uint8V(v map[int8]uint8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt8Uint8V(v map[int8]uint8, canChange bool, d *Decoder) (_ map[int8]uint8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 2) v = make(map[int8]uint8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int8 var mv uint8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv + mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt8Uint16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int8]uint16) - v, changed := fastpathTV.DecMapInt8Uint16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt8Uint16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int8]uint16) + v, changed := fastpathTV.DecMapInt8Uint16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int8]uint16) - fastpathTV.DecMapInt8Uint16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt8Uint16V(rv2i(rv).(map[int8]uint16), false, d) } } -func (f fastpathT) DecMapInt8Uint16X(vp *map[int8]uint16, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt8Uint16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt8Uint16X(vp *map[int8]uint16, d *Decoder) { + v, changed := f.DecMapInt8Uint16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt8Uint16V(v map[int8]uint16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt8Uint16V(v map[int8]uint16, canChange bool, d *Decoder) (_ map[int8]uint16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) v = make(map[int8]uint16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int8 var mv uint16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv + mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt8Uint32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int8]uint32) - v, changed := fastpathTV.DecMapInt8Uint32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt8Uint32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int8]uint32) + v, changed := fastpathTV.DecMapInt8Uint32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int8]uint32) - fastpathTV.DecMapInt8Uint32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt8Uint32V(rv2i(rv).(map[int8]uint32), false, d) } } -func (f fastpathT) DecMapInt8Uint32X(vp *map[int8]uint32, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt8Uint32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt8Uint32X(vp *map[int8]uint32, d *Decoder) { + v, changed := f.DecMapInt8Uint32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt8Uint32V(v map[int8]uint32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt8Uint32V(v map[int8]uint32, canChange bool, d *Decoder) (_ map[int8]uint32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) v = make(map[int8]uint32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int8 var mv uint32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv + mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt8Uint64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int8]uint64) - v, changed := fastpathTV.DecMapInt8Uint64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt8Uint64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int8]uint64) + v, changed := fastpathTV.DecMapInt8Uint64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int8]uint64) - fastpathTV.DecMapInt8Uint64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt8Uint64V(rv2i(rv).(map[int8]uint64), false, d) } } -func (f fastpathT) DecMapInt8Uint64X(vp *map[int8]uint64, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt8Uint64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt8Uint64X(vp *map[int8]uint64, d *Decoder) { + v, changed := f.DecMapInt8Uint64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt8Uint64V(v map[int8]uint64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt8Uint64V(v map[int8]uint64, canChange bool, d *Decoder) (_ map[int8]uint64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[int8]uint64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int8 var mv uint64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv + mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeUint64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt8UintptrR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int8]uintptr) - v, changed := fastpathTV.DecMapInt8UintptrV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt8UintptrR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int8]uintptr) + v, changed := fastpathTV.DecMapInt8UintptrV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int8]uintptr) - fastpathTV.DecMapInt8UintptrV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt8UintptrV(rv2i(rv).(map[int8]uintptr), false, d) } } -func (f fastpathT) DecMapInt8UintptrX(vp *map[int8]uintptr, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt8UintptrV(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt8UintptrX(vp *map[int8]uintptr, d *Decoder) { + v, changed := f.DecMapInt8UintptrV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt8UintptrV(v map[int8]uintptr, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt8UintptrV(v map[int8]uintptr, canChange bool, d *Decoder) (_ map[int8]uintptr, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[int8]uintptr, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int8 var mv uintptr - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt8IntR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int8]int) - v, changed := fastpathTV.DecMapInt8IntV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt8IntR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int8]int) + v, changed := fastpathTV.DecMapInt8IntV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int8]int) - fastpathTV.DecMapInt8IntV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt8IntV(rv2i(rv).(map[int8]int), false, d) } } -func (f fastpathT) DecMapInt8IntX(vp *map[int8]int, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt8IntV(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt8IntX(vp *map[int8]int, d *Decoder) { + v, changed := f.DecMapInt8IntV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt8IntV(v map[int8]int, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt8IntV(v map[int8]int, canChange bool, d *Decoder) (_ map[int8]int, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[int8]int, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int8 var mv int - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv + mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt8Int8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int8]int8) - v, changed := fastpathTV.DecMapInt8Int8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt8Int8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int8]int8) + v, changed := fastpathTV.DecMapInt8Int8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int8]int8) - fastpathTV.DecMapInt8Int8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt8Int8V(rv2i(rv).(map[int8]int8), false, d) } } -func (f fastpathT) DecMapInt8Int8X(vp *map[int8]int8, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt8Int8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt8Int8X(vp *map[int8]int8, d *Decoder) { + v, changed := f.DecMapInt8Int8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt8Int8V(v map[int8]int8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt8Int8V(v map[int8]int8, canChange bool, d *Decoder) (_ map[int8]int8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 2) v = make(map[int8]int8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int8 var mv int8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv + mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt8Int16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int8]int16) - v, changed := fastpathTV.DecMapInt8Int16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt8Int16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int8]int16) + v, changed := fastpathTV.DecMapInt8Int16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int8]int16) - fastpathTV.DecMapInt8Int16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt8Int16V(rv2i(rv).(map[int8]int16), false, d) } } -func (f fastpathT) DecMapInt8Int16X(vp *map[int8]int16, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt8Int16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt8Int16X(vp *map[int8]int16, d *Decoder) { + v, changed := f.DecMapInt8Int16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt8Int16V(v map[int8]int16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt8Int16V(v map[int8]int16, canChange bool, d *Decoder) (_ map[int8]int16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) v = make(map[int8]int16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int8 var mv int16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv + mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt8Int32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int8]int32) - v, changed := fastpathTV.DecMapInt8Int32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt8Int32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int8]int32) + v, changed := fastpathTV.DecMapInt8Int32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int8]int32) - fastpathTV.DecMapInt8Int32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt8Int32V(rv2i(rv).(map[int8]int32), false, d) } } -func (f fastpathT) DecMapInt8Int32X(vp *map[int8]int32, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt8Int32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt8Int32X(vp *map[int8]int32, d *Decoder) { + v, changed := f.DecMapInt8Int32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt8Int32V(v map[int8]int32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt8Int32V(v map[int8]int32, canChange bool, d *Decoder) (_ map[int8]int32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) v = make(map[int8]int32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int8 var mv int32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv + mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt8Int64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int8]int64) - v, changed := fastpathTV.DecMapInt8Int64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt8Int64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int8]int64) + v, changed := fastpathTV.DecMapInt8Int64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int8]int64) - fastpathTV.DecMapInt8Int64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt8Int64V(rv2i(rv).(map[int8]int64), false, d) } } -func (f fastpathT) DecMapInt8Int64X(vp *map[int8]int64, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt8Int64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt8Int64X(vp *map[int8]int64, d *Decoder) { + v, changed := f.DecMapInt8Int64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt8Int64V(v map[int8]int64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt8Int64V(v map[int8]int64, canChange bool, d *Decoder) (_ map[int8]int64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[int8]int64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int8 var mv int64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv + mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeInt64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt8Float32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int8]float32) - v, changed := fastpathTV.DecMapInt8Float32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt8Float32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int8]float32) + v, changed := fastpathTV.DecMapInt8Float32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int8]float32) - fastpathTV.DecMapInt8Float32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt8Float32V(rv2i(rv).(map[int8]float32), false, d) } } -func (f fastpathT) DecMapInt8Float32X(vp *map[int8]float32, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt8Float32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt8Float32X(vp *map[int8]float32, d *Decoder) { + v, changed := f.DecMapInt8Float32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt8Float32V(v map[int8]float32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt8Float32V(v map[int8]float32, canChange bool, d *Decoder) (_ map[int8]float32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) v = make(map[int8]float32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int8 var mv float32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv + mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt8Float64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int8]float64) - v, changed := fastpathTV.DecMapInt8Float64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt8Float64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int8]float64) + v, changed := fastpathTV.DecMapInt8Float64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int8]float64) - fastpathTV.DecMapInt8Float64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt8Float64V(rv2i(rv).(map[int8]float64), false, d) } } -func (f fastpathT) DecMapInt8Float64X(vp *map[int8]float64, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt8Float64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt8Float64X(vp *map[int8]float64, d *Decoder) { + v, changed := f.DecMapInt8Float64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt8Float64V(v map[int8]float64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt8Float64V(v map[int8]float64, canChange bool, d *Decoder) (_ map[int8]float64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[int8]float64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int8 var mv float64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv + mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeFloat64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt8BoolR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int8]bool) - v, changed := fastpathTV.DecMapInt8BoolV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt8BoolR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int8]bool) + v, changed := fastpathTV.DecMapInt8BoolV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int8]bool) - fastpathTV.DecMapInt8BoolV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt8BoolV(rv2i(rv).(map[int8]bool), false, d) } } -func (f fastpathT) DecMapInt8BoolX(vp *map[int8]bool, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt8BoolV(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt8BoolX(vp *map[int8]bool, d *Decoder) { + v, changed := f.DecMapInt8BoolV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt8BoolV(v map[int8]bool, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt8BoolV(v map[int8]bool, canChange bool, d *Decoder) (_ map[int8]bool, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 2) v = make(map[int8]bool, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int8 var mv bool - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int8(dd.DecodeInt(8)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv + mk = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = false } + continue + } + mv = dd.DecodeBool() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt16IntfR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int16]interface{}) - v, changed := fastpathTV.DecMapInt16IntfV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt16IntfR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int16]interface{}) + v, changed := fastpathTV.DecMapInt16IntfV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int16]interface{}) - fastpathTV.DecMapInt16IntfV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt16IntfV(rv2i(rv).(map[int16]interface{}), false, d) } } -func (f fastpathT) DecMapInt16IntfX(vp *map[int16]interface{}, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt16IntfV(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt16IntfX(vp *map[int16]interface{}, d *Decoder) { + v, changed := f.DecMapInt16IntfV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt16IntfV(v map[int16]interface{}, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt16IntfV(v map[int16]interface{}, canChange bool, d *Decoder) (_ map[int16]interface{}, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 18) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 18) v = make(map[int16]interface{}, xlen) changed = true } - mapGet := !d.h.MapValueReset && !d.h.InterfaceReset + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } + mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset var mk int16 var mv interface{} - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] + mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv + v[mk] = nil } + continue + } + if mapGet { + mv = v[mk] + } else { + mv = nil + } + d.decode(&mv) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt16StringR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int16]string) - v, changed := fastpathTV.DecMapInt16StringV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt16StringR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int16]string) + v, changed := fastpathTV.DecMapInt16StringV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int16]string) - fastpathTV.DecMapInt16StringV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt16StringV(rv2i(rv).(map[int16]string), false, d) } } -func (f fastpathT) DecMapInt16StringX(vp *map[int16]string, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt16StringV(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt16StringX(vp *map[int16]string, d *Decoder) { + v, changed := f.DecMapInt16StringV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt16StringV(v map[int16]string, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt16StringV(v map[int16]string, canChange bool, d *Decoder) (_ map[int16]string, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 18) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 18) v = make(map[int16]string, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int16 var mv string - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv + mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = "" } + continue + } + mv = dd.DecodeString() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt16UintR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int16]uint) - v, changed := fastpathTV.DecMapInt16UintV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt16UintR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int16]uint) + v, changed := fastpathTV.DecMapInt16UintV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int16]uint) - fastpathTV.DecMapInt16UintV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt16UintV(rv2i(rv).(map[int16]uint), false, d) } } -func (f fastpathT) DecMapInt16UintX(vp *map[int16]uint, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt16UintV(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt16UintX(vp *map[int16]uint, d *Decoder) { + v, changed := f.DecMapInt16UintV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt16UintV(v map[int16]uint, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt16UintV(v map[int16]uint, canChange bool, d *Decoder) (_ map[int16]uint, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) v = make(map[int16]uint, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int16 var mv uint - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt16Uint8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int16]uint8) - v, changed := fastpathTV.DecMapInt16Uint8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt16Uint8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int16]uint8) + v, changed := fastpathTV.DecMapInt16Uint8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int16]uint8) - fastpathTV.DecMapInt16Uint8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt16Uint8V(rv2i(rv).(map[int16]uint8), false, d) } } -func (f fastpathT) DecMapInt16Uint8X(vp *map[int16]uint8, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt16Uint8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt16Uint8X(vp *map[int16]uint8, d *Decoder) { + v, changed := f.DecMapInt16Uint8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt16Uint8V(v map[int16]uint8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt16Uint8V(v map[int16]uint8, canChange bool, d *Decoder) (_ map[int16]uint8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) v = make(map[int16]uint8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int16 var mv uint8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv + mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt16Uint16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int16]uint16) - v, changed := fastpathTV.DecMapInt16Uint16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt16Uint16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int16]uint16) + v, changed := fastpathTV.DecMapInt16Uint16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int16]uint16) - fastpathTV.DecMapInt16Uint16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt16Uint16V(rv2i(rv).(map[int16]uint16), false, d) } } -func (f fastpathT) DecMapInt16Uint16X(vp *map[int16]uint16, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt16Uint16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt16Uint16X(vp *map[int16]uint16, d *Decoder) { + v, changed := f.DecMapInt16Uint16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt16Uint16V(v map[int16]uint16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt16Uint16V(v map[int16]uint16, canChange bool, d *Decoder) (_ map[int16]uint16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 4) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 4) v = make(map[int16]uint16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int16 var mv uint16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv + mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt16Uint32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int16]uint32) - v, changed := fastpathTV.DecMapInt16Uint32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt16Uint32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int16]uint32) + v, changed := fastpathTV.DecMapInt16Uint32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int16]uint32) - fastpathTV.DecMapInt16Uint32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt16Uint32V(rv2i(rv).(map[int16]uint32), false, d) } } -func (f fastpathT) DecMapInt16Uint32X(vp *map[int16]uint32, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt16Uint32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt16Uint32X(vp *map[int16]uint32, d *Decoder) { + v, changed := f.DecMapInt16Uint32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt16Uint32V(v map[int16]uint32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt16Uint32V(v map[int16]uint32, canChange bool, d *Decoder) (_ map[int16]uint32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 6) v = make(map[int16]uint32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int16 var mv uint32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv + mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt16Uint64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int16]uint64) - v, changed := fastpathTV.DecMapInt16Uint64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt16Uint64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int16]uint64) + v, changed := fastpathTV.DecMapInt16Uint64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int16]uint64) - fastpathTV.DecMapInt16Uint64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt16Uint64V(rv2i(rv).(map[int16]uint64), false, d) } } -func (f fastpathT) DecMapInt16Uint64X(vp *map[int16]uint64, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt16Uint64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt16Uint64X(vp *map[int16]uint64, d *Decoder) { + v, changed := f.DecMapInt16Uint64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt16Uint64V(v map[int16]uint64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt16Uint64V(v map[int16]uint64, canChange bool, d *Decoder) (_ map[int16]uint64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) v = make(map[int16]uint64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int16 var mv uint64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv + mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeUint64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt16UintptrR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int16]uintptr) - v, changed := fastpathTV.DecMapInt16UintptrV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt16UintptrR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int16]uintptr) + v, changed := fastpathTV.DecMapInt16UintptrV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int16]uintptr) - fastpathTV.DecMapInt16UintptrV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt16UintptrV(rv2i(rv).(map[int16]uintptr), false, d) } } -func (f fastpathT) DecMapInt16UintptrX(vp *map[int16]uintptr, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt16UintptrV(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt16UintptrX(vp *map[int16]uintptr, d *Decoder) { + v, changed := f.DecMapInt16UintptrV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt16UintptrV(v map[int16]uintptr, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt16UintptrV(v map[int16]uintptr, canChange bool, d *Decoder) (_ map[int16]uintptr, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) v = make(map[int16]uintptr, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int16 var mv uintptr - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt16IntR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int16]int) - v, changed := fastpathTV.DecMapInt16IntV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt16IntR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int16]int) + v, changed := fastpathTV.DecMapInt16IntV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int16]int) - fastpathTV.DecMapInt16IntV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt16IntV(rv2i(rv).(map[int16]int), false, d) } } -func (f fastpathT) DecMapInt16IntX(vp *map[int16]int, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt16IntV(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt16IntX(vp *map[int16]int, d *Decoder) { + v, changed := f.DecMapInt16IntV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt16IntV(v map[int16]int, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt16IntV(v map[int16]int, canChange bool, d *Decoder) (_ map[int16]int, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) v = make(map[int16]int, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int16 var mv int - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv + mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt16Int8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int16]int8) - v, changed := fastpathTV.DecMapInt16Int8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt16Int8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int16]int8) + v, changed := fastpathTV.DecMapInt16Int8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int16]int8) - fastpathTV.DecMapInt16Int8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt16Int8V(rv2i(rv).(map[int16]int8), false, d) } } -func (f fastpathT) DecMapInt16Int8X(vp *map[int16]int8, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt16Int8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt16Int8X(vp *map[int16]int8, d *Decoder) { + v, changed := f.DecMapInt16Int8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt16Int8V(v map[int16]int8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt16Int8V(v map[int16]int8, canChange bool, d *Decoder) (_ map[int16]int8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) v = make(map[int16]int8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int16 var mv int8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv + mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt16Int16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int16]int16) - v, changed := fastpathTV.DecMapInt16Int16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt16Int16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int16]int16) + v, changed := fastpathTV.DecMapInt16Int16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int16]int16) - fastpathTV.DecMapInt16Int16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt16Int16V(rv2i(rv).(map[int16]int16), false, d) } } -func (f fastpathT) DecMapInt16Int16X(vp *map[int16]int16, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt16Int16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt16Int16X(vp *map[int16]int16, d *Decoder) { + v, changed := f.DecMapInt16Int16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt16Int16V(v map[int16]int16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt16Int16V(v map[int16]int16, canChange bool, d *Decoder) (_ map[int16]int16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 4) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 4) v = make(map[int16]int16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int16 var mv int16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv + mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt16Int32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int16]int32) - v, changed := fastpathTV.DecMapInt16Int32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt16Int32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int16]int32) + v, changed := fastpathTV.DecMapInt16Int32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int16]int32) - fastpathTV.DecMapInt16Int32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt16Int32V(rv2i(rv).(map[int16]int32), false, d) } } -func (f fastpathT) DecMapInt16Int32X(vp *map[int16]int32, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt16Int32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt16Int32X(vp *map[int16]int32, d *Decoder) { + v, changed := f.DecMapInt16Int32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt16Int32V(v map[int16]int32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt16Int32V(v map[int16]int32, canChange bool, d *Decoder) (_ map[int16]int32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 6) v = make(map[int16]int32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int16 var mv int32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv + mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt16Int64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int16]int64) - v, changed := fastpathTV.DecMapInt16Int64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt16Int64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int16]int64) + v, changed := fastpathTV.DecMapInt16Int64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int16]int64) - fastpathTV.DecMapInt16Int64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt16Int64V(rv2i(rv).(map[int16]int64), false, d) } } -func (f fastpathT) DecMapInt16Int64X(vp *map[int16]int64, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt16Int64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt16Int64X(vp *map[int16]int64, d *Decoder) { + v, changed := f.DecMapInt16Int64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt16Int64V(v map[int16]int64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt16Int64V(v map[int16]int64, canChange bool, d *Decoder) (_ map[int16]int64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) v = make(map[int16]int64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int16 var mv int64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv + mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeInt64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt16Float32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int16]float32) - v, changed := fastpathTV.DecMapInt16Float32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt16Float32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int16]float32) + v, changed := fastpathTV.DecMapInt16Float32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int16]float32) - fastpathTV.DecMapInt16Float32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt16Float32V(rv2i(rv).(map[int16]float32), false, d) } } -func (f fastpathT) DecMapInt16Float32X(vp *map[int16]float32, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt16Float32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt16Float32X(vp *map[int16]float32, d *Decoder) { + v, changed := f.DecMapInt16Float32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt16Float32V(v map[int16]float32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt16Float32V(v map[int16]float32, canChange bool, d *Decoder) (_ map[int16]float32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 6) v = make(map[int16]float32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int16 var mv float32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv + mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt16Float64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int16]float64) - v, changed := fastpathTV.DecMapInt16Float64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt16Float64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int16]float64) + v, changed := fastpathTV.DecMapInt16Float64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int16]float64) - fastpathTV.DecMapInt16Float64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt16Float64V(rv2i(rv).(map[int16]float64), false, d) } } -func (f fastpathT) DecMapInt16Float64X(vp *map[int16]float64, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt16Float64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt16Float64X(vp *map[int16]float64, d *Decoder) { + v, changed := f.DecMapInt16Float64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt16Float64V(v map[int16]float64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt16Float64V(v map[int16]float64, canChange bool, d *Decoder) (_ map[int16]float64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) v = make(map[int16]float64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int16 var mv float64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv + mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeFloat64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt16BoolR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int16]bool) - v, changed := fastpathTV.DecMapInt16BoolV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt16BoolR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int16]bool) + v, changed := fastpathTV.DecMapInt16BoolV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int16]bool) - fastpathTV.DecMapInt16BoolV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt16BoolV(rv2i(rv).(map[int16]bool), false, d) } } -func (f fastpathT) DecMapInt16BoolX(vp *map[int16]bool, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt16BoolV(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt16BoolX(vp *map[int16]bool, d *Decoder) { + v, changed := f.DecMapInt16BoolV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt16BoolV(v map[int16]bool, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt16BoolV(v map[int16]bool, canChange bool, d *Decoder) (_ map[int16]bool, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) v = make(map[int16]bool, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int16 var mv bool - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int16(dd.DecodeInt(16)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv + mk = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = false } + continue + } + mv = dd.DecodeBool() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt32IntfR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int32]interface{}) - v, changed := fastpathTV.DecMapInt32IntfV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt32IntfR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int32]interface{}) + v, changed := fastpathTV.DecMapInt32IntfV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int32]interface{}) - fastpathTV.DecMapInt32IntfV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt32IntfV(rv2i(rv).(map[int32]interface{}), false, d) } } -func (f fastpathT) DecMapInt32IntfX(vp *map[int32]interface{}, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt32IntfV(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt32IntfX(vp *map[int32]interface{}, d *Decoder) { + v, changed := f.DecMapInt32IntfV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt32IntfV(v map[int32]interface{}, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt32IntfV(v map[int32]interface{}, canChange bool, d *Decoder) (_ map[int32]interface{}, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) v = make(map[int32]interface{}, xlen) changed = true } - mapGet := !d.h.MapValueReset && !d.h.InterfaceReset + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } + mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset var mk int32 var mv interface{} - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] + mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv + v[mk] = nil } + continue + } + if mapGet { + mv = v[mk] + } else { + mv = nil + } + d.decode(&mv) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt32StringR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int32]string) - v, changed := fastpathTV.DecMapInt32StringV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt32StringR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int32]string) + v, changed := fastpathTV.DecMapInt32StringV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int32]string) - fastpathTV.DecMapInt32StringV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt32StringV(rv2i(rv).(map[int32]string), false, d) } } -func (f fastpathT) DecMapInt32StringX(vp *map[int32]string, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt32StringV(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt32StringX(vp *map[int32]string, d *Decoder) { + v, changed := f.DecMapInt32StringV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt32StringV(v map[int32]string, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt32StringV(v map[int32]string, canChange bool, d *Decoder) (_ map[int32]string, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 20) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 20) v = make(map[int32]string, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int32 var mv string - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv + mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = "" } + continue + } + mv = dd.DecodeString() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt32UintR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int32]uint) - v, changed := fastpathTV.DecMapInt32UintV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt32UintR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int32]uint) + v, changed := fastpathTV.DecMapInt32UintV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int32]uint) - fastpathTV.DecMapInt32UintV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt32UintV(rv2i(rv).(map[int32]uint), false, d) } } -func (f fastpathT) DecMapInt32UintX(vp *map[int32]uint, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt32UintV(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt32UintX(vp *map[int32]uint, d *Decoder) { + v, changed := f.DecMapInt32UintV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt32UintV(v map[int32]uint, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt32UintV(v map[int32]uint, canChange bool, d *Decoder) (_ map[int32]uint, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[int32]uint, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int32 var mv uint - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt32Uint8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int32]uint8) - v, changed := fastpathTV.DecMapInt32Uint8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt32Uint8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int32]uint8) + v, changed := fastpathTV.DecMapInt32Uint8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int32]uint8) - fastpathTV.DecMapInt32Uint8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt32Uint8V(rv2i(rv).(map[int32]uint8), false, d) } } -func (f fastpathT) DecMapInt32Uint8X(vp *map[int32]uint8, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt32Uint8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt32Uint8X(vp *map[int32]uint8, d *Decoder) { + v, changed := f.DecMapInt32Uint8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt32Uint8V(v map[int32]uint8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt32Uint8V(v map[int32]uint8, canChange bool, d *Decoder) (_ map[int32]uint8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) v = make(map[int32]uint8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int32 var mv uint8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv + mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt32Uint16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int32]uint16) - v, changed := fastpathTV.DecMapInt32Uint16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt32Uint16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int32]uint16) + v, changed := fastpathTV.DecMapInt32Uint16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int32]uint16) - fastpathTV.DecMapInt32Uint16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt32Uint16V(rv2i(rv).(map[int32]uint16), false, d) } } -func (f fastpathT) DecMapInt32Uint16X(vp *map[int32]uint16, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt32Uint16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt32Uint16X(vp *map[int32]uint16, d *Decoder) { + v, changed := f.DecMapInt32Uint16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt32Uint16V(v map[int32]uint16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt32Uint16V(v map[int32]uint16, canChange bool, d *Decoder) (_ map[int32]uint16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 6) v = make(map[int32]uint16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int32 var mv uint16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv + mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt32Uint32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int32]uint32) - v, changed := fastpathTV.DecMapInt32Uint32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt32Uint32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int32]uint32) + v, changed := fastpathTV.DecMapInt32Uint32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int32]uint32) - fastpathTV.DecMapInt32Uint32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt32Uint32V(rv2i(rv).(map[int32]uint32), false, d) } } -func (f fastpathT) DecMapInt32Uint32X(vp *map[int32]uint32, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt32Uint32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt32Uint32X(vp *map[int32]uint32, d *Decoder) { + v, changed := f.DecMapInt32Uint32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt32Uint32V(v map[int32]uint32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt32Uint32V(v map[int32]uint32, canChange bool, d *Decoder) (_ map[int32]uint32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 8) v = make(map[int32]uint32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int32 var mv uint32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv + mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt32Uint64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int32]uint64) - v, changed := fastpathTV.DecMapInt32Uint64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt32Uint64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int32]uint64) + v, changed := fastpathTV.DecMapInt32Uint64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int32]uint64) - fastpathTV.DecMapInt32Uint64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt32Uint64V(rv2i(rv).(map[int32]uint64), false, d) } } -func (f fastpathT) DecMapInt32Uint64X(vp *map[int32]uint64, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt32Uint64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt32Uint64X(vp *map[int32]uint64, d *Decoder) { + v, changed := f.DecMapInt32Uint64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt32Uint64V(v map[int32]uint64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt32Uint64V(v map[int32]uint64, canChange bool, d *Decoder) (_ map[int32]uint64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[int32]uint64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int32 var mv uint64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv + mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeUint64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt32UintptrR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int32]uintptr) - v, changed := fastpathTV.DecMapInt32UintptrV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt32UintptrR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int32]uintptr) + v, changed := fastpathTV.DecMapInt32UintptrV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int32]uintptr) - fastpathTV.DecMapInt32UintptrV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt32UintptrV(rv2i(rv).(map[int32]uintptr), false, d) } } -func (f fastpathT) DecMapInt32UintptrX(vp *map[int32]uintptr, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt32UintptrV(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt32UintptrX(vp *map[int32]uintptr, d *Decoder) { + v, changed := f.DecMapInt32UintptrV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt32UintptrV(v map[int32]uintptr, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt32UintptrV(v map[int32]uintptr, canChange bool, d *Decoder) (_ map[int32]uintptr, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[int32]uintptr, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int32 var mv uintptr - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt32IntR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int32]int) - v, changed := fastpathTV.DecMapInt32IntV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt32IntR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int32]int) + v, changed := fastpathTV.DecMapInt32IntV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int32]int) - fastpathTV.DecMapInt32IntV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt32IntV(rv2i(rv).(map[int32]int), false, d) } } -func (f fastpathT) DecMapInt32IntX(vp *map[int32]int, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt32IntV(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt32IntX(vp *map[int32]int, d *Decoder) { + v, changed := f.DecMapInt32IntV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt32IntV(v map[int32]int, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt32IntV(v map[int32]int, canChange bool, d *Decoder) (_ map[int32]int, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[int32]int, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int32 var mv int - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv + mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt32Int8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int32]int8) - v, changed := fastpathTV.DecMapInt32Int8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt32Int8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int32]int8) + v, changed := fastpathTV.DecMapInt32Int8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int32]int8) - fastpathTV.DecMapInt32Int8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt32Int8V(rv2i(rv).(map[int32]int8), false, d) } } -func (f fastpathT) DecMapInt32Int8X(vp *map[int32]int8, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt32Int8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt32Int8X(vp *map[int32]int8, d *Decoder) { + v, changed := f.DecMapInt32Int8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt32Int8V(v map[int32]int8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt32Int8V(v map[int32]int8, canChange bool, d *Decoder) (_ map[int32]int8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) v = make(map[int32]int8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int32 var mv int8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv + mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt32Int16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int32]int16) - v, changed := fastpathTV.DecMapInt32Int16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt32Int16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int32]int16) + v, changed := fastpathTV.DecMapInt32Int16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int32]int16) - fastpathTV.DecMapInt32Int16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt32Int16V(rv2i(rv).(map[int32]int16), false, d) } } -func (f fastpathT) DecMapInt32Int16X(vp *map[int32]int16, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt32Int16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt32Int16X(vp *map[int32]int16, d *Decoder) { + v, changed := f.DecMapInt32Int16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt32Int16V(v map[int32]int16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt32Int16V(v map[int32]int16, canChange bool, d *Decoder) (_ map[int32]int16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 6) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 6) v = make(map[int32]int16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int32 var mv int16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv + mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt32Int32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int32]int32) - v, changed := fastpathTV.DecMapInt32Int32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt32Int32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int32]int32) + v, changed := fastpathTV.DecMapInt32Int32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int32]int32) - fastpathTV.DecMapInt32Int32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt32Int32V(rv2i(rv).(map[int32]int32), false, d) } } -func (f fastpathT) DecMapInt32Int32X(vp *map[int32]int32, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt32Int32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt32Int32X(vp *map[int32]int32, d *Decoder) { + v, changed := f.DecMapInt32Int32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt32Int32V(v map[int32]int32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt32Int32V(v map[int32]int32, canChange bool, d *Decoder) (_ map[int32]int32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 8) v = make(map[int32]int32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int32 var mv int32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv + mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt32Int64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int32]int64) - v, changed := fastpathTV.DecMapInt32Int64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt32Int64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int32]int64) + v, changed := fastpathTV.DecMapInt32Int64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int32]int64) - fastpathTV.DecMapInt32Int64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt32Int64V(rv2i(rv).(map[int32]int64), false, d) } } -func (f fastpathT) DecMapInt32Int64X(vp *map[int32]int64, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt32Int64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt32Int64X(vp *map[int32]int64, d *Decoder) { + v, changed := f.DecMapInt32Int64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt32Int64V(v map[int32]int64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt32Int64V(v map[int32]int64, canChange bool, d *Decoder) (_ map[int32]int64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[int32]int64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int32 var mv int64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv + mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeInt64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt32Float32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int32]float32) - v, changed := fastpathTV.DecMapInt32Float32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt32Float32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int32]float32) + v, changed := fastpathTV.DecMapInt32Float32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int32]float32) - fastpathTV.DecMapInt32Float32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt32Float32V(rv2i(rv).(map[int32]float32), false, d) } } -func (f fastpathT) DecMapInt32Float32X(vp *map[int32]float32, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt32Float32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt32Float32X(vp *map[int32]float32, d *Decoder) { + v, changed := f.DecMapInt32Float32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt32Float32V(v map[int32]float32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt32Float32V(v map[int32]float32, canChange bool, d *Decoder) (_ map[int32]float32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 8) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 8) v = make(map[int32]float32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int32 var mv float32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv + mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt32Float64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int32]float64) - v, changed := fastpathTV.DecMapInt32Float64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt32Float64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int32]float64) + v, changed := fastpathTV.DecMapInt32Float64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int32]float64) - fastpathTV.DecMapInt32Float64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt32Float64V(rv2i(rv).(map[int32]float64), false, d) } } -func (f fastpathT) DecMapInt32Float64X(vp *map[int32]float64, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt32Float64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt32Float64X(vp *map[int32]float64, d *Decoder) { + v, changed := f.DecMapInt32Float64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt32Float64V(v map[int32]float64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt32Float64V(v map[int32]float64, canChange bool, d *Decoder) (_ map[int32]float64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[int32]float64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int32 var mv float64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv + mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeFloat64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt32BoolR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int32]bool) - v, changed := fastpathTV.DecMapInt32BoolV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt32BoolR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int32]bool) + v, changed := fastpathTV.DecMapInt32BoolV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int32]bool) - fastpathTV.DecMapInt32BoolV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt32BoolV(rv2i(rv).(map[int32]bool), false, d) } } -func (f fastpathT) DecMapInt32BoolX(vp *map[int32]bool, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt32BoolV(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt32BoolX(vp *map[int32]bool, d *Decoder) { + v, changed := f.DecMapInt32BoolV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt32BoolV(v map[int32]bool, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt32BoolV(v map[int32]bool, canChange bool, d *Decoder) (_ map[int32]bool, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) v = make(map[int32]bool, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int32 var mv bool - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = int32(dd.DecodeInt(32)) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv + mk = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = false } + continue + } + mv = dd.DecodeBool() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt64IntfR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int64]interface{}) - v, changed := fastpathTV.DecMapInt64IntfV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt64IntfR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int64]interface{}) + v, changed := fastpathTV.DecMapInt64IntfV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int64]interface{}) - fastpathTV.DecMapInt64IntfV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt64IntfV(rv2i(rv).(map[int64]interface{}), false, d) } } -func (f fastpathT) DecMapInt64IntfX(vp *map[int64]interface{}, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt64IntfV(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt64IntfX(vp *map[int64]interface{}, d *Decoder) { + v, changed := f.DecMapInt64IntfV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt64IntfV(v map[int64]interface{}, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt64IntfV(v map[int64]interface{}, canChange bool, d *Decoder) (_ map[int64]interface{}, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) v = make(map[int64]interface{}, xlen) changed = true } - mapGet := !d.h.MapValueReset && !d.h.InterfaceReset + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } + mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset var mk int64 var mv interface{} - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] + mk = dd.DecodeInt64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv + v[mk] = nil } + continue + } + if mapGet { + mv = v[mk] + } else { + mv = nil + } + d.decode(&mv) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt64StringR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int64]string) - v, changed := fastpathTV.DecMapInt64StringV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt64StringR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int64]string) + v, changed := fastpathTV.DecMapInt64StringV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int64]string) - fastpathTV.DecMapInt64StringV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt64StringV(rv2i(rv).(map[int64]string), false, d) } } -func (f fastpathT) DecMapInt64StringX(vp *map[int64]string, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt64StringV(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt64StringX(vp *map[int64]string, d *Decoder) { + v, changed := f.DecMapInt64StringV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt64StringV(v map[int64]string, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt64StringV(v map[int64]string, canChange bool, d *Decoder) (_ map[int64]string, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 24) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 24) v = make(map[int64]string, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int64 var mv string - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv + mk = dd.DecodeInt64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = "" } + continue + } + mv = dd.DecodeString() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt64UintR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int64]uint) - v, changed := fastpathTV.DecMapInt64UintV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt64UintR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int64]uint) + v, changed := fastpathTV.DecMapInt64UintV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int64]uint) - fastpathTV.DecMapInt64UintV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt64UintV(rv2i(rv).(map[int64]uint), false, d) } } -func (f fastpathT) DecMapInt64UintX(vp *map[int64]uint, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt64UintV(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt64UintX(vp *map[int64]uint, d *Decoder) { + v, changed := f.DecMapInt64UintV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt64UintV(v map[int64]uint, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt64UintV(v map[int64]uint, canChange bool, d *Decoder) (_ map[int64]uint, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[int64]uint, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int64 var mv uint - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = dd.DecodeInt64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt64Uint8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int64]uint8) - v, changed := fastpathTV.DecMapInt64Uint8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt64Uint8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int64]uint8) + v, changed := fastpathTV.DecMapInt64Uint8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int64]uint8) - fastpathTV.DecMapInt64Uint8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt64Uint8V(rv2i(rv).(map[int64]uint8), false, d) } } -func (f fastpathT) DecMapInt64Uint8X(vp *map[int64]uint8, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt64Uint8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt64Uint8X(vp *map[int64]uint8, d *Decoder) { + v, changed := f.DecMapInt64Uint8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt64Uint8V(v map[int64]uint8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt64Uint8V(v map[int64]uint8, canChange bool, d *Decoder) (_ map[int64]uint8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[int64]uint8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int64 var mv uint8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv + mk = dd.DecodeInt64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt64Uint16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int64]uint16) - v, changed := fastpathTV.DecMapInt64Uint16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt64Uint16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int64]uint16) + v, changed := fastpathTV.DecMapInt64Uint16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int64]uint16) - fastpathTV.DecMapInt64Uint16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt64Uint16V(rv2i(rv).(map[int64]uint16), false, d) } } -func (f fastpathT) DecMapInt64Uint16X(vp *map[int64]uint16, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt64Uint16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt64Uint16X(vp *map[int64]uint16, d *Decoder) { + v, changed := f.DecMapInt64Uint16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt64Uint16V(v map[int64]uint16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt64Uint16V(v map[int64]uint16, canChange bool, d *Decoder) (_ map[int64]uint16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) v = make(map[int64]uint16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int64 var mv uint16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv + mk = dd.DecodeInt64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt64Uint32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int64]uint32) - v, changed := fastpathTV.DecMapInt64Uint32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt64Uint32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int64]uint32) + v, changed := fastpathTV.DecMapInt64Uint32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int64]uint32) - fastpathTV.DecMapInt64Uint32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt64Uint32V(rv2i(rv).(map[int64]uint32), false, d) } } -func (f fastpathT) DecMapInt64Uint32X(vp *map[int64]uint32, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt64Uint32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt64Uint32X(vp *map[int64]uint32, d *Decoder) { + v, changed := f.DecMapInt64Uint32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt64Uint32V(v map[int64]uint32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt64Uint32V(v map[int64]uint32, canChange bool, d *Decoder) (_ map[int64]uint32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[int64]uint32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int64 var mv uint32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv + mk = dd.DecodeInt64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt64Uint64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int64]uint64) - v, changed := fastpathTV.DecMapInt64Uint64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt64Uint64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int64]uint64) + v, changed := fastpathTV.DecMapInt64Uint64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int64]uint64) - fastpathTV.DecMapInt64Uint64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt64Uint64V(rv2i(rv).(map[int64]uint64), false, d) } } -func (f fastpathT) DecMapInt64Uint64X(vp *map[int64]uint64, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt64Uint64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt64Uint64X(vp *map[int64]uint64, d *Decoder) { + v, changed := f.DecMapInt64Uint64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt64Uint64V(v map[int64]uint64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt64Uint64V(v map[int64]uint64, canChange bool, d *Decoder) (_ map[int64]uint64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[int64]uint64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int64 var mv uint64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv + mk = dd.DecodeInt64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeUint64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt64UintptrR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int64]uintptr) - v, changed := fastpathTV.DecMapInt64UintptrV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt64UintptrR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int64]uintptr) + v, changed := fastpathTV.DecMapInt64UintptrV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int64]uintptr) - fastpathTV.DecMapInt64UintptrV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt64UintptrV(rv2i(rv).(map[int64]uintptr), false, d) } } -func (f fastpathT) DecMapInt64UintptrX(vp *map[int64]uintptr, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt64UintptrV(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt64UintptrX(vp *map[int64]uintptr, d *Decoder) { + v, changed := f.DecMapInt64UintptrV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt64UintptrV(v map[int64]uintptr, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt64UintptrV(v map[int64]uintptr, canChange bool, d *Decoder) (_ map[int64]uintptr, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[int64]uintptr, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int64 var mv uintptr - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = dd.DecodeInt64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt64IntR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int64]int) - v, changed := fastpathTV.DecMapInt64IntV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt64IntR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int64]int) + v, changed := fastpathTV.DecMapInt64IntV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int64]int) - fastpathTV.DecMapInt64IntV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt64IntV(rv2i(rv).(map[int64]int), false, d) } } -func (f fastpathT) DecMapInt64IntX(vp *map[int64]int, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt64IntV(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt64IntX(vp *map[int64]int, d *Decoder) { + v, changed := f.DecMapInt64IntV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt64IntV(v map[int64]int, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt64IntV(v map[int64]int, canChange bool, d *Decoder) (_ map[int64]int, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[int64]int, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int64 var mv int - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv + mk = dd.DecodeInt64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt64Int8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int64]int8) - v, changed := fastpathTV.DecMapInt64Int8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt64Int8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int64]int8) + v, changed := fastpathTV.DecMapInt64Int8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int64]int8) - fastpathTV.DecMapInt64Int8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt64Int8V(rv2i(rv).(map[int64]int8), false, d) } } -func (f fastpathT) DecMapInt64Int8X(vp *map[int64]int8, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt64Int8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt64Int8X(vp *map[int64]int8, d *Decoder) { + v, changed := f.DecMapInt64Int8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt64Int8V(v map[int64]int8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt64Int8V(v map[int64]int8, canChange bool, d *Decoder) (_ map[int64]int8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[int64]int8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int64 var mv int8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv + mk = dd.DecodeInt64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt64Int16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int64]int16) - v, changed := fastpathTV.DecMapInt64Int16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt64Int16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int64]int16) + v, changed := fastpathTV.DecMapInt64Int16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int64]int16) - fastpathTV.DecMapInt64Int16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt64Int16V(rv2i(rv).(map[int64]int16), false, d) } } -func (f fastpathT) DecMapInt64Int16X(vp *map[int64]int16, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt64Int16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt64Int16X(vp *map[int64]int16, d *Decoder) { + v, changed := f.DecMapInt64Int16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt64Int16V(v map[int64]int16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt64Int16V(v map[int64]int16, canChange bool, d *Decoder) (_ map[int64]int16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 10) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 10) v = make(map[int64]int16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int64 var mv int16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv + mk = dd.DecodeInt64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt64Int32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int64]int32) - v, changed := fastpathTV.DecMapInt64Int32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt64Int32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int64]int32) + v, changed := fastpathTV.DecMapInt64Int32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int64]int32) - fastpathTV.DecMapInt64Int32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt64Int32V(rv2i(rv).(map[int64]int32), false, d) } } -func (f fastpathT) DecMapInt64Int32X(vp *map[int64]int32, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt64Int32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt64Int32X(vp *map[int64]int32, d *Decoder) { + v, changed := f.DecMapInt64Int32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt64Int32V(v map[int64]int32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt64Int32V(v map[int64]int32, canChange bool, d *Decoder) (_ map[int64]int32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[int64]int32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int64 var mv int32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv + mk = dd.DecodeInt64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt64Int64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int64]int64) - v, changed := fastpathTV.DecMapInt64Int64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt64Int64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int64]int64) + v, changed := fastpathTV.DecMapInt64Int64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int64]int64) - fastpathTV.DecMapInt64Int64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt64Int64V(rv2i(rv).(map[int64]int64), false, d) } } -func (f fastpathT) DecMapInt64Int64X(vp *map[int64]int64, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt64Int64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt64Int64X(vp *map[int64]int64, d *Decoder) { + v, changed := f.DecMapInt64Int64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt64Int64V(v map[int64]int64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt64Int64V(v map[int64]int64, canChange bool, d *Decoder) (_ map[int64]int64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[int64]int64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int64 var mv int64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv + mk = dd.DecodeInt64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeInt64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt64Float32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int64]float32) - v, changed := fastpathTV.DecMapInt64Float32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt64Float32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int64]float32) + v, changed := fastpathTV.DecMapInt64Float32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int64]float32) - fastpathTV.DecMapInt64Float32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt64Float32V(rv2i(rv).(map[int64]float32), false, d) } } -func (f fastpathT) DecMapInt64Float32X(vp *map[int64]float32, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt64Float32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt64Float32X(vp *map[int64]float32, d *Decoder) { + v, changed := f.DecMapInt64Float32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt64Float32V(v map[int64]float32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt64Float32V(v map[int64]float32, canChange bool, d *Decoder) (_ map[int64]float32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 12) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 12) v = make(map[int64]float32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int64 var mv float32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv + mk = dd.DecodeInt64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt64Float64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int64]float64) - v, changed := fastpathTV.DecMapInt64Float64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt64Float64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int64]float64) + v, changed := fastpathTV.DecMapInt64Float64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int64]float64) - fastpathTV.DecMapInt64Float64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt64Float64V(rv2i(rv).(map[int64]float64), false, d) } } -func (f fastpathT) DecMapInt64Float64X(vp *map[int64]float64, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt64Float64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt64Float64X(vp *map[int64]float64, d *Decoder) { + v, changed := f.DecMapInt64Float64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt64Float64V(v map[int64]float64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt64Float64V(v map[int64]float64, canChange bool, d *Decoder) (_ map[int64]float64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 16) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 16) v = make(map[int64]float64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int64 var mv float64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv + mk = dd.DecodeInt64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeFloat64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapInt64BoolR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[int64]bool) - v, changed := fastpathTV.DecMapInt64BoolV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapInt64BoolR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[int64]bool) + v, changed := fastpathTV.DecMapInt64BoolV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[int64]bool) - fastpathTV.DecMapInt64BoolV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapInt64BoolV(rv2i(rv).(map[int64]bool), false, d) } } -func (f fastpathT) DecMapInt64BoolX(vp *map[int64]bool, checkNil bool, d *Decoder) { - v, changed := f.DecMapInt64BoolV(*vp, checkNil, true, d) +func (f fastpathT) DecMapInt64BoolX(vp *map[int64]bool, d *Decoder) { + v, changed := f.DecMapInt64BoolV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapInt64BoolV(v map[int64]bool, checkNil bool, canChange bool, +func (_ fastpathT) DecMapInt64BoolV(v map[int64]bool, canChange bool, d *Decoder) (_ map[int64]bool, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[int64]bool, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk int64 var mv bool - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeInt(64) - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv + mk = dd.DecodeInt64() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = false } + continue + } + mv = dd.DecodeBool() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapBoolIntfR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[bool]interface{}) - v, changed := fastpathTV.DecMapBoolIntfV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapBoolIntfR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[bool]interface{}) + v, changed := fastpathTV.DecMapBoolIntfV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[bool]interface{}) - fastpathTV.DecMapBoolIntfV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapBoolIntfV(rv2i(rv).(map[bool]interface{}), false, d) } } -func (f fastpathT) DecMapBoolIntfX(vp *map[bool]interface{}, checkNil bool, d *Decoder) { - v, changed := f.DecMapBoolIntfV(*vp, checkNil, true, d) +func (f fastpathT) DecMapBoolIntfX(vp *map[bool]interface{}, d *Decoder) { + v, changed := f.DecMapBoolIntfV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapBoolIntfV(v map[bool]interface{}, checkNil bool, canChange bool, +func (_ fastpathT) DecMapBoolIntfV(v map[bool]interface{}, canChange bool, d *Decoder) (_ map[bool]interface{}, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) v = make(map[bool]interface{}, xlen) changed = true } - mapGet := !d.h.MapValueReset && !d.h.InterfaceReset + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } + mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset var mk bool var mv interface{} - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] - } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - if mapGet { - mv = v[mk] + mk = dd.DecodeBool() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) } else { - mv = nil - } - d.decode(&mv) - if v != nil { - v[mk] = mv + v[mk] = nil } + continue + } + if mapGet { + mv = v[mk] + } else { + mv = nil + } + d.decode(&mv) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapBoolStringR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[bool]string) - v, changed := fastpathTV.DecMapBoolStringV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapBoolStringR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[bool]string) + v, changed := fastpathTV.DecMapBoolStringV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[bool]string) - fastpathTV.DecMapBoolStringV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapBoolStringV(rv2i(rv).(map[bool]string), false, d) } } -func (f fastpathT) DecMapBoolStringX(vp *map[bool]string, checkNil bool, d *Decoder) { - v, changed := f.DecMapBoolStringV(*vp, checkNil, true, d) +func (f fastpathT) DecMapBoolStringX(vp *map[bool]string, d *Decoder) { + v, changed := f.DecMapBoolStringV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapBoolStringV(v map[bool]string, checkNil bool, canChange bool, +func (_ fastpathT) DecMapBoolStringV(v map[bool]string, canChange bool, d *Decoder) (_ map[bool]string, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 17) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 17) v = make(map[bool]string, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk bool var mv string - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeString() - if v != nil { - v[mk] = mv + mk = dd.DecodeBool() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = "" } + continue + } + mv = dd.DecodeString() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapBoolUintR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[bool]uint) - v, changed := fastpathTV.DecMapBoolUintV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapBoolUintR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[bool]uint) + v, changed := fastpathTV.DecMapBoolUintV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[bool]uint) - fastpathTV.DecMapBoolUintV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapBoolUintV(rv2i(rv).(map[bool]uint), false, d) } } -func (f fastpathT) DecMapBoolUintX(vp *map[bool]uint, checkNil bool, d *Decoder) { - v, changed := f.DecMapBoolUintV(*vp, checkNil, true, d) +func (f fastpathT) DecMapBoolUintX(vp *map[bool]uint, d *Decoder) { + v, changed := f.DecMapBoolUintV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapBoolUintV(v map[bool]uint, checkNil bool, canChange bool, +func (_ fastpathT) DecMapBoolUintV(v map[bool]uint, canChange bool, d *Decoder) (_ map[bool]uint, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[bool]uint, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk bool var mv uint - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = dd.DecodeBool() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapBoolUint8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[bool]uint8) - v, changed := fastpathTV.DecMapBoolUint8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapBoolUint8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[bool]uint8) + v, changed := fastpathTV.DecMapBoolUint8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[bool]uint8) - fastpathTV.DecMapBoolUint8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapBoolUint8V(rv2i(rv).(map[bool]uint8), false, d) } } -func (f fastpathT) DecMapBoolUint8X(vp *map[bool]uint8, checkNil bool, d *Decoder) { - v, changed := f.DecMapBoolUint8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapBoolUint8X(vp *map[bool]uint8, d *Decoder) { + v, changed := f.DecMapBoolUint8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapBoolUint8V(v map[bool]uint8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapBoolUint8V(v map[bool]uint8, canChange bool, d *Decoder) (_ map[bool]uint8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 2) v = make(map[bool]uint8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk bool var mv uint8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint8(dd.DecodeUint(8)) - if v != nil { - v[mk] = mv + mk = dd.DecodeBool() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint8(chkOvf.UintV(dd.DecodeUint64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapBoolUint16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[bool]uint16) - v, changed := fastpathTV.DecMapBoolUint16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapBoolUint16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[bool]uint16) + v, changed := fastpathTV.DecMapBoolUint16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[bool]uint16) - fastpathTV.DecMapBoolUint16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapBoolUint16V(rv2i(rv).(map[bool]uint16), false, d) } } -func (f fastpathT) DecMapBoolUint16X(vp *map[bool]uint16, checkNil bool, d *Decoder) { - v, changed := f.DecMapBoolUint16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapBoolUint16X(vp *map[bool]uint16, d *Decoder) { + v, changed := f.DecMapBoolUint16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapBoolUint16V(v map[bool]uint16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapBoolUint16V(v map[bool]uint16, canChange bool, d *Decoder) (_ map[bool]uint16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) v = make(map[bool]uint16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk bool var mv uint16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint16(dd.DecodeUint(16)) - if v != nil { - v[mk] = mv + mk = dd.DecodeBool() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint16(chkOvf.UintV(dd.DecodeUint64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapBoolUint32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[bool]uint32) - v, changed := fastpathTV.DecMapBoolUint32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapBoolUint32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[bool]uint32) + v, changed := fastpathTV.DecMapBoolUint32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[bool]uint32) - fastpathTV.DecMapBoolUint32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapBoolUint32V(rv2i(rv).(map[bool]uint32), false, d) } } -func (f fastpathT) DecMapBoolUint32X(vp *map[bool]uint32, checkNil bool, d *Decoder) { - v, changed := f.DecMapBoolUint32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapBoolUint32X(vp *map[bool]uint32, d *Decoder) { + v, changed := f.DecMapBoolUint32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapBoolUint32V(v map[bool]uint32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapBoolUint32V(v map[bool]uint32, canChange bool, d *Decoder) (_ map[bool]uint32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) v = make(map[bool]uint32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk bool var mv uint32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uint32(dd.DecodeUint(32)) - if v != nil { - v[mk] = mv + mk = dd.DecodeBool() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uint32(chkOvf.UintV(dd.DecodeUint64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapBoolUint64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[bool]uint64) - v, changed := fastpathTV.DecMapBoolUint64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapBoolUint64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[bool]uint64) + v, changed := fastpathTV.DecMapBoolUint64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[bool]uint64) - fastpathTV.DecMapBoolUint64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapBoolUint64V(rv2i(rv).(map[bool]uint64), false, d) } } -func (f fastpathT) DecMapBoolUint64X(vp *map[bool]uint64, checkNil bool, d *Decoder) { - v, changed := f.DecMapBoolUint64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapBoolUint64X(vp *map[bool]uint64, d *Decoder) { + v, changed := f.DecMapBoolUint64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapBoolUint64V(v map[bool]uint64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapBoolUint64V(v map[bool]uint64, canChange bool, d *Decoder) (_ map[bool]uint64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[bool]uint64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk bool var mv uint64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeUint(64) - if v != nil { - v[mk] = mv + mk = dd.DecodeBool() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeUint64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapBoolUintptrR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[bool]uintptr) - v, changed := fastpathTV.DecMapBoolUintptrV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapBoolUintptrR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[bool]uintptr) + v, changed := fastpathTV.DecMapBoolUintptrV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[bool]uintptr) - fastpathTV.DecMapBoolUintptrV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapBoolUintptrV(rv2i(rv).(map[bool]uintptr), false, d) } } -func (f fastpathT) DecMapBoolUintptrX(vp *map[bool]uintptr, checkNil bool, d *Decoder) { - v, changed := f.DecMapBoolUintptrV(*vp, checkNil, true, d) +func (f fastpathT) DecMapBoolUintptrX(vp *map[bool]uintptr, d *Decoder) { + v, changed := f.DecMapBoolUintptrV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapBoolUintptrV(v map[bool]uintptr, checkNil bool, canChange bool, +func (_ fastpathT) DecMapBoolUintptrV(v map[bool]uintptr, canChange bool, d *Decoder) (_ map[bool]uintptr, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[bool]uintptr, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk bool var mv uintptr - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = uintptr(dd.DecodeUint(uintBitsize)) - if v != nil { - v[mk] = mv + mk = dd.DecodeBool() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapBoolIntR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[bool]int) - v, changed := fastpathTV.DecMapBoolIntV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapBoolIntR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[bool]int) + v, changed := fastpathTV.DecMapBoolIntV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[bool]int) - fastpathTV.DecMapBoolIntV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapBoolIntV(rv2i(rv).(map[bool]int), false, d) } } -func (f fastpathT) DecMapBoolIntX(vp *map[bool]int, checkNil bool, d *Decoder) { - v, changed := f.DecMapBoolIntV(*vp, checkNil, true, d) +func (f fastpathT) DecMapBoolIntX(vp *map[bool]int, d *Decoder) { + v, changed := f.DecMapBoolIntV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapBoolIntV(v map[bool]int, checkNil bool, canChange bool, +func (_ fastpathT) DecMapBoolIntV(v map[bool]int, canChange bool, d *Decoder) (_ map[bool]int, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[bool]int, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk bool var mv int - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int(dd.DecodeInt(intBitsize)) - if v != nil { - v[mk] = mv + mk = dd.DecodeBool() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int(chkOvf.IntV(dd.DecodeInt64(), intBitsize)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapBoolInt8R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[bool]int8) - v, changed := fastpathTV.DecMapBoolInt8V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapBoolInt8R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[bool]int8) + v, changed := fastpathTV.DecMapBoolInt8V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[bool]int8) - fastpathTV.DecMapBoolInt8V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapBoolInt8V(rv2i(rv).(map[bool]int8), false, d) } } -func (f fastpathT) DecMapBoolInt8X(vp *map[bool]int8, checkNil bool, d *Decoder) { - v, changed := f.DecMapBoolInt8V(*vp, checkNil, true, d) +func (f fastpathT) DecMapBoolInt8X(vp *map[bool]int8, d *Decoder) { + v, changed := f.DecMapBoolInt8V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapBoolInt8V(v map[bool]int8, checkNil bool, canChange bool, +func (_ fastpathT) DecMapBoolInt8V(v map[bool]int8, canChange bool, d *Decoder) (_ map[bool]int8, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 2) v = make(map[bool]int8, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk bool var mv int8 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int8(dd.DecodeInt(8)) - if v != nil { - v[mk] = mv + mk = dd.DecodeBool() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int8(chkOvf.IntV(dd.DecodeInt64(), 8)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapBoolInt16R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[bool]int16) - v, changed := fastpathTV.DecMapBoolInt16V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapBoolInt16R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[bool]int16) + v, changed := fastpathTV.DecMapBoolInt16V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[bool]int16) - fastpathTV.DecMapBoolInt16V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapBoolInt16V(rv2i(rv).(map[bool]int16), false, d) } } -func (f fastpathT) DecMapBoolInt16X(vp *map[bool]int16, checkNil bool, d *Decoder) { - v, changed := f.DecMapBoolInt16V(*vp, checkNil, true, d) +func (f fastpathT) DecMapBoolInt16X(vp *map[bool]int16, d *Decoder) { + v, changed := f.DecMapBoolInt16V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapBoolInt16V(v map[bool]int16, checkNil bool, canChange bool, +func (_ fastpathT) DecMapBoolInt16V(v map[bool]int16, canChange bool, d *Decoder) (_ map[bool]int16, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 3) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 3) v = make(map[bool]int16, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk bool var mv int16 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int16(dd.DecodeInt(16)) - if v != nil { - v[mk] = mv + mk = dd.DecodeBool() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int16(chkOvf.IntV(dd.DecodeInt64(), 16)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapBoolInt32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[bool]int32) - v, changed := fastpathTV.DecMapBoolInt32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapBoolInt32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[bool]int32) + v, changed := fastpathTV.DecMapBoolInt32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[bool]int32) - fastpathTV.DecMapBoolInt32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapBoolInt32V(rv2i(rv).(map[bool]int32), false, d) } } -func (f fastpathT) DecMapBoolInt32X(vp *map[bool]int32, checkNil bool, d *Decoder) { - v, changed := f.DecMapBoolInt32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapBoolInt32X(vp *map[bool]int32, d *Decoder) { + v, changed := f.DecMapBoolInt32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapBoolInt32V(v map[bool]int32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapBoolInt32V(v map[bool]int32, canChange bool, d *Decoder) (_ map[bool]int32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) v = make(map[bool]int32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk bool var mv int32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = int32(dd.DecodeInt(32)) - if v != nil { - v[mk] = mv + mk = dd.DecodeBool() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = int32(chkOvf.IntV(dd.DecodeInt64(), 32)) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapBoolInt64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[bool]int64) - v, changed := fastpathTV.DecMapBoolInt64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapBoolInt64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[bool]int64) + v, changed := fastpathTV.DecMapBoolInt64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[bool]int64) - fastpathTV.DecMapBoolInt64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapBoolInt64V(rv2i(rv).(map[bool]int64), false, d) } } -func (f fastpathT) DecMapBoolInt64X(vp *map[bool]int64, checkNil bool, d *Decoder) { - v, changed := f.DecMapBoolInt64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapBoolInt64X(vp *map[bool]int64, d *Decoder) { + v, changed := f.DecMapBoolInt64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapBoolInt64V(v map[bool]int64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapBoolInt64V(v map[bool]int64, canChange bool, d *Decoder) (_ map[bool]int64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[bool]int64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk bool var mv int64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeInt(64) - if v != nil { - v[mk] = mv + mk = dd.DecodeBool() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeInt64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapBoolFloat32R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[bool]float32) - v, changed := fastpathTV.DecMapBoolFloat32V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapBoolFloat32R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[bool]float32) + v, changed := fastpathTV.DecMapBoolFloat32V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[bool]float32) - fastpathTV.DecMapBoolFloat32V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapBoolFloat32V(rv2i(rv).(map[bool]float32), false, d) } } -func (f fastpathT) DecMapBoolFloat32X(vp *map[bool]float32, checkNil bool, d *Decoder) { - v, changed := f.DecMapBoolFloat32V(*vp, checkNil, true, d) +func (f fastpathT) DecMapBoolFloat32X(vp *map[bool]float32, d *Decoder) { + v, changed := f.DecMapBoolFloat32V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapBoolFloat32V(v map[bool]float32, checkNil bool, canChange bool, +func (_ fastpathT) DecMapBoolFloat32V(v map[bool]float32, canChange bool, d *Decoder) (_ map[bool]float32, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 5) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 5) v = make(map[bool]float32, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk bool var mv float32 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = float32(dd.DecodeFloat(true)) - if v != nil { - v[mk] = mv + mk = dd.DecodeBool() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = float32(chkOvf.Float32V(dd.DecodeFloat64())) + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapBoolFloat64R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[bool]float64) - v, changed := fastpathTV.DecMapBoolFloat64V(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapBoolFloat64R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[bool]float64) + v, changed := fastpathTV.DecMapBoolFloat64V(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[bool]float64) - fastpathTV.DecMapBoolFloat64V(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapBoolFloat64V(rv2i(rv).(map[bool]float64), false, d) } } -func (f fastpathT) DecMapBoolFloat64X(vp *map[bool]float64, checkNil bool, d *Decoder) { - v, changed := f.DecMapBoolFloat64V(*vp, checkNil, true, d) +func (f fastpathT) DecMapBoolFloat64X(vp *map[bool]float64, d *Decoder) { + v, changed := f.DecMapBoolFloat64V(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapBoolFloat64V(v map[bool]float64, checkNil bool, canChange bool, +func (_ fastpathT) DecMapBoolFloat64V(v map[bool]float64, canChange bool, d *Decoder) (_ map[bool]float64, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 9) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 9) v = make(map[bool]float64, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk bool var mv float64 - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeFloat(false) - if v != nil { - v[mk] = mv + mk = dd.DecodeBool() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = 0 } + continue + } + mv = dd.DecodeFloat64() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } -func (f *decFnInfo) fastpathDecMapBoolBoolR(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[bool]bool) - v, changed := fastpathTV.DecMapBoolBoolV(*vp, fastpathCheckNilFalse, true, f.d) +func (d *Decoder) fastpathDecMapBoolBoolR(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[bool]bool) + v, changed := fastpathTV.DecMapBoolBoolV(*vp, true, d) if changed { *vp = v } } else { - v := rv.Interface().(map[bool]bool) - fastpathTV.DecMapBoolBoolV(v, fastpathCheckNilFalse, false, f.d) + fastpathTV.DecMapBoolBoolV(rv2i(rv).(map[bool]bool), false, d) } } -func (f fastpathT) DecMapBoolBoolX(vp *map[bool]bool, checkNil bool, d *Decoder) { - v, changed := f.DecMapBoolBoolV(*vp, checkNil, true, d) +func (f fastpathT) DecMapBoolBoolX(vp *map[bool]bool, d *Decoder) { + v, changed := f.DecMapBoolBoolV(*vp, true, d) if changed { *vp = v } } -func (_ fastpathT) DecMapBoolBoolV(v map[bool]bool, checkNil bool, canChange bool, +func (_ fastpathT) DecMapBoolBoolV(v map[bool]bool, canChange bool, d *Decoder) (_ map[bool]bool, changed bool) { - dd := d.d - cr := d.cr - - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators() containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, 2) + xlen := decInferLen(containerLen, d.h.MaxInitLen, 2) v = make(map[bool]bool, xlen) changed = true } - + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed + } var mk bool var mv bool - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv - } + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { + dd.ReadMapElemKey() } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { - cr.sendContainerState(containerMapKey) - } - mk = dd.DecodeBool() - if cr != nil { - cr.sendContainerState(containerMapValue) - } - mv = dd.DecodeBool() - if v != nil { - v[mk] = mv + mk = dd.DecodeBool() + if esep { + dd.ReadMapElemValue() + } + if dd.TryDecodeAsNil() { + if v == nil { + } else if d.h.DeleteOnNilMapValue { + delete(v, mk) + } else { + v[mk] = false } + continue + } + mv = dd.DecodeBool() + if v != nil { + v[mk] = mv } } - if cr != nil { - cr.sendContainerState(containerMapEnd) - } + dd.ReadMapEnd() return v, changed } diff --git a/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl b/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl index c3ffdf93d..2023e05d3 100644 --- a/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl +++ b/vendor/github.com/ugorji/go/codec/fast-path.go.tmpl @@ -3,10 +3,7 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. -// ************************************************************ -// DO NOT EDIT. -// THIS FILE IS AUTO-GENERATED from fast-path.go.tmpl -// ************************************************************ +// Code generated from fast-path.go.tmpl - DO NOT EDIT. package codec @@ -18,19 +15,19 @@ package codec // This file can be omitted without causing a build failure. // // The advantage of fast paths is: -// - Many calls bypass reflection altogether +// - Many calls bypass reflection altogether // // Currently support -// - slice of all builtin types, -// - map of all builtin types to string or interface value -// - symmetrical maps of all builtin types (e.g. str-str, uint8-uint8) +// - slice of all builtin types, +// - map of all builtin types to string or interface value +// - symmetrical maps of all builtin types (e.g. str-str, uint8-uint8) // This should provide adequate "typical" implementations. // // Note that fast track decode functions must handle values for which an address cannot be obtained. // For example: -// m2 := map[string]int{} -// p2 := []interface{}{m2} -// // decoding into p2 will bomb if fast track functions do not treat like unaddressable. +// m2 := map[string]int{} +// p2 := []interface{}{m2} +// // decoding into p2 will bomb if fast track functions do not treat like unaddressable. // import ( @@ -40,9 +37,6 @@ import ( const fastpathEnabled = true -const fastpathCheckNilFalse = false // for reflect -const fastpathCheckNilTrue = true // for type switch - type fastpathT struct {} var fastpathTV fastpathT @@ -50,8 +44,8 @@ var fastpathTV fastpathT type fastpathE struct { rtid uintptr rt reflect.Type - encfn func(*encFnInfo, reflect.Value) - decfn func(*decFnInfo, reflect.Value) + encfn func(*Encoder, *codecFnInfo, reflect.Value) + decfn func(*Decoder, *codecFnInfo, reflect.Value) } type fastpathA [{{ .FastpathLen }}]fastpathE @@ -84,19 +78,21 @@ var fastpathAV fastpathA // due to possible initialization loop error, make fastpath in an init() func init() { i := 0 - fn := func(v interface{}, fe func(*encFnInfo, reflect.Value), fd func(*decFnInfo, reflect.Value)) (f fastpathE) { + fn := func(v interface{}, + fe func(*Encoder, *codecFnInfo, reflect.Value), + fd func(*Decoder, *codecFnInfo, reflect.Value)) (f fastpathE) { xrt := reflect.TypeOf(v) - xptr := reflect.ValueOf(xrt).Pointer() + xptr := rt2id(xrt) fastpathAV[i] = fastpathE{xptr, xrt, fe, fd} i++ return } - - {{range .Values}}{{if not .Primitive}}{{if not .MapKey }} - fn([]{{ .Elem }}(nil), (*encFnInfo).{{ .MethodNamePfx "fastpathEnc" false }}R, (*decFnInfo).{{ .MethodNamePfx "fastpathDec" false }}R){{end}}{{end}}{{end}} + {{/* do not register []uint8 in fast-path */}} + {{range .Values}}{{if not .Primitive}}{{if not .MapKey }}{{if ne .Elem "uint8"}} + fn([]{{ .Elem }}(nil), (*Encoder).{{ .MethodNamePfx "fastpathEnc" false }}R, (*Decoder).{{ .MethodNamePfx "fastpathDec" false }}R){{end}}{{end}}{{end}}{{end}} {{range .Values}}{{if not .Primitive}}{{if .MapKey }} - fn(map[{{ .MapKey }}]{{ .Elem }}(nil), (*encFnInfo).{{ .MethodNamePfx "fastpathEnc" false }}R, (*decFnInfo).{{ .MethodNamePfx "fastpathDec" false }}R){{end}}{{end}}{{end}} + fn(map[{{ .MapKey }}]{{ .Elem }}(nil), (*Encoder).{{ .MethodNamePfx "fastpathEnc" false }}R, (*Decoder).{{ .MethodNamePfx "fastpathDec" false }}R){{end}}{{end}}{{end}} sort.Sort(fastpathAslice(fastpathAV[:])) } @@ -106,31 +102,47 @@ func init() { // -- -- fast path type switch func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { switch v := iv.(type) { -{{range .Values}}{{if not .Primitive}}{{if not .MapKey }} - case []{{ .Elem }}:{{else}} - case map[{{ .MapKey }}]{{ .Elem }}:{{end}} - fastpathTV.{{ .MethodNamePfx "Enc" false }}V(v, fastpathCheckNilTrue, e){{if not .MapKey }} - case *[]{{ .Elem }}:{{else}} - case *map[{{ .MapKey }}]{{ .Elem }}:{{end}} - fastpathTV.{{ .MethodNamePfx "Enc" false }}V(*v, fastpathCheckNilTrue, e) -{{end}}{{end}} + +{{range .Values}}{{if not .Primitive}}{{if not .MapKey }}{{if ne .Elem "uint8"}} + case []{{ .Elem }}: + fastpathTV.{{ .MethodNamePfx "Enc" false }}V(v, e) + case *[]{{ .Elem }}: + fastpathTV.{{ .MethodNamePfx "Enc" false }}V(*v, e){{/* +*/}}{{end}}{{end}}{{end}}{{end}} + +{{range .Values}}{{if not .Primitive}}{{if .MapKey }} + case map[{{ .MapKey }}]{{ .Elem }}: + fastpathTV.{{ .MethodNamePfx "Enc" false }}V(v, e) + case *map[{{ .MapKey }}]{{ .Elem }}: + fastpathTV.{{ .MethodNamePfx "Enc" false }}V(*v, e){{/* +*/}}{{end}}{{end}}{{end}} + default: - _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) + _ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4 return false } return true } +{{/* +**** removing this block, as they are never called directly **** + + + +**** removing this block, as they are never called directly **** + + + func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { switch v := iv.(type) { {{range .Values}}{{if not .Primitive}}{{if not .MapKey }} case []{{ .Elem }}: - fastpathTV.{{ .MethodNamePfx "Enc" false }}V(v, fastpathCheckNilTrue, e) + fastpathTV.{{ .MethodNamePfx "Enc" false }}V(v, e) case *[]{{ .Elem }}: - fastpathTV.{{ .MethodNamePfx "Enc" false }}V(*v, fastpathCheckNilTrue, e) + fastpathTV.{{ .MethodNamePfx "Enc" false }}V(*v, e) {{end}}{{end}}{{end}} default: - _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) + _ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4 return false } return true @@ -140,84 +152,99 @@ func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { switch v := iv.(type) { {{range .Values}}{{if not .Primitive}}{{if .MapKey }} case map[{{ .MapKey }}]{{ .Elem }}: - fastpathTV.{{ .MethodNamePfx "Enc" false }}V(v, fastpathCheckNilTrue, e) + fastpathTV.{{ .MethodNamePfx "Enc" false }}V(v, e) case *map[{{ .MapKey }}]{{ .Elem }}: - fastpathTV.{{ .MethodNamePfx "Enc" false }}V(*v, fastpathCheckNilTrue, e) + fastpathTV.{{ .MethodNamePfx "Enc" false }}V(*v, e) {{end}}{{end}}{{end}} default: - _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) + _ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4 return false } return true } + + +**** removing this block, as they are never called directly **** + + + +**** removing this block, as they are never called directly **** +*/}} + // -- -- fast path functions {{range .Values}}{{if not .Primitive}}{{if not .MapKey }} - -func (f *encFnInfo) {{ .MethodNamePfx "fastpathEnc" false }}R(rv reflect.Value) { +func (e *Encoder) {{ .MethodNamePfx "fastpathEnc" false }}R(f *codecFnInfo, rv reflect.Value) { if f.ti.mbs { - fastpathTV.{{ .MethodNamePfx "EncAsMap" false }}V(rv.Interface().([]{{ .Elem }}), fastpathCheckNilFalse, f.e) + fastpathTV.{{ .MethodNamePfx "EncAsMap" false }}V(rv2i(rv).([]{{ .Elem }}), e) } else { - fastpathTV.{{ .MethodNamePfx "Enc" false }}V(rv.Interface().([]{{ .Elem }}), fastpathCheckNilFalse, f.e) + fastpathTV.{{ .MethodNamePfx "Enc" false }}V(rv2i(rv).([]{{ .Elem }}), e) } } -func (_ fastpathT) {{ .MethodNamePfx "Enc" false }}V(v []{{ .Elem }}, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() - return - } - ee.EncodeArrayStart(len(v)) +func (_ fastpathT) {{ .MethodNamePfx "Enc" false }}V(v []{{ .Elem }}, e *Encoder) { + if v == nil { e.e.EncodeNil(); return } + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteArrayStart(len(v)) + if esep { + for _, v2 := range v { + ee.WriteArrayElem() + {{ encmd .Elem "v2"}} + } + } else { + for _, v2 := range v { + {{ encmd .Elem "v2"}} + } + } {{/* for _, v2 := range v { - if cr != nil { cr.sendContainerState(containerArrayElem) } + if esep { ee.WriteArrayElem() } {{ encmd .Elem "v2"}} - } - if cr != nil { cr.sendContainerState(containerArrayEnd) }{{/* ee.EncodeEnd() */}} + } */}} + ee.WriteArrayEnd() } - -func (_ fastpathT) {{ .MethodNamePfx "EncAsMap" false }}V(v []{{ .Elem }}, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() - return - } +func (_ fastpathT) {{ .MethodNamePfx "EncAsMap" false }}V(v []{{ .Elem }}, e *Encoder) { + ee, esep := e.e, e.hh.hasElemSeparators() if len(v)%2 == 1 { e.errorf("mapBySlice requires even slice length, but got %v", len(v)) return } - ee.EncodeMapStart(len(v) / 2) - for j, v2 := range v { - if cr != nil { + ee.WriteMapStart(len(v) / 2) + if esep { + for j, v2 := range v { if j%2 == 0 { - cr.sendContainerState(containerMapKey) + ee.WriteMapElemKey() } else { - cr.sendContainerState(containerMapValue) + ee.WriteMapElemValue() + } + {{ encmd .Elem "v2"}} + } + } else { + for _, v2 := range v { + {{ encmd .Elem "v2"}} + } + } {{/* + for j, v2 := range v { + if esep { + if j%2 == 0 { + ee.WriteMapElemKey() + } else { + ee.WriteMapElemValue() } } {{ encmd .Elem "v2"}} - } - if cr != nil { cr.sendContainerState(containerMapEnd) } + } */}} + ee.WriteMapEnd() } - {{end}}{{end}}{{end}} {{range .Values}}{{if not .Primitive}}{{if .MapKey }} - -func (f *encFnInfo) {{ .MethodNamePfx "fastpathEnc" false }}R(rv reflect.Value) { - fastpathTV.{{ .MethodNamePfx "Enc" false }}V(rv.Interface().(map[{{ .MapKey }}]{{ .Elem }}), fastpathCheckNilFalse, f.e) +func (e *Encoder) {{ .MethodNamePfx "fastpathEnc" false }}R(f *codecFnInfo, rv reflect.Value) { + fastpathTV.{{ .MethodNamePfx "Enc" false }}V(rv2i(rv).(map[{{ .MapKey }}]{{ .Elem }}), e) } -func (_ fastpathT) {{ .MethodNamePfx "Enc" false }}V(v map[{{ .MapKey }}]{{ .Elem }}, checkNil bool, e *Encoder) { - ee := e.e - cr := e.cr - if checkNil && v == nil { - ee.EncodeNil() - return - } - ee.EncodeMapStart(len(v)) - {{if eq .MapKey "string"}}asSymbols := e.h.AsSymbols&AsSymbolMapStringKeysFlag != 0 - {{end}}if e.h.Canonical { +func (_ fastpathT) {{ .MethodNamePfx "Enc" false }}V(v map[{{ .MapKey }}]{{ .Elem }}, e *Encoder) { + if v == nil { e.e.EncodeNil(); return } + ee, esep := e.e, e.hh.hasElemSeparators() + ee.WriteMapStart(len(v)) + if e.h.Canonical { {{if eq .MapKey "interface{}"}}{{/* out of band */}}var mksv []byte = make([]byte, 0, len(v)*16) // temporary byte slice for the encoding e2 := NewEncoderBytes(&mksv, e.hh) @@ -233,63 +260,126 @@ func (_ fastpathT) {{ .MethodNamePfx "Enc" false }}V(v map[{{ .MapKey }}]{{ .Ele i++ } sort.Sort(bytesISlice(v2)) + if esep { + for j := range v2 { + ee.WriteMapElemKey() + e.asis(v2[j].v) + ee.WriteMapElemValue() + e.encode(v[v2[j].i]) + } + } else { + for j := range v2 { + e.asis(v2[j].v) + e.encode(v[v2[j].i]) + } + } {{/* for j := range v2 { - if cr != nil { cr.sendContainerState(containerMapKey) } + if esep { ee.WriteMapElemKey() } e.asis(v2[j].v) - if cr != nil { cr.sendContainerState(containerMapValue) } + if esep { ee.WriteMapElemValue() } e.encode(v[v2[j].i]) - } {{else}}{{ $x := sorttype .MapKey true}}v2 := make([]{{ $x }}, len(v)) + } */}} {{else}}{{ $x := sorttype .MapKey true}}v2 := make([]{{ $x }}, len(v)) var i int for k, _ := range v { v2[i] = {{ $x }}(k) i++ } sort.Sort({{ sorttype .MapKey false}}(v2)) + if esep { + for _, k2 := range v2 { + ee.WriteMapElemKey() + {{if eq .MapKey "string"}}ee.EncodeString(cUTF8, k2){{else}}{{ $y := printf "%s(k2)" .MapKey }}{{ encmd .MapKey $y }}{{end}} + ee.WriteMapElemValue() + {{ $y := printf "v[%s(k2)]" .MapKey }}{{ encmd .Elem $y }} + } + } else { + for _, k2 := range v2 { + {{if eq .MapKey "string"}}ee.EncodeString(cUTF8, k2){{else}}{{ $y := printf "%s(k2)" .MapKey }}{{ encmd .MapKey $y }}{{end}} + {{ $y := printf "v[%s(k2)]" .MapKey }}{{ encmd .Elem $y }} + } + } {{/* for _, k2 := range v2 { - if cr != nil { cr.sendContainerState(containerMapKey) } - {{if eq .MapKey "string"}}if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) - }{{else}}{{ $y := printf "%s(k2)" .MapKey }}{{ encmd .MapKey $y }}{{end}} - if cr != nil { cr.sendContainerState(containerMapValue) } + if esep { ee.WriteMapElemKey() } + {{if eq .MapKey "string"}}ee.EncodeString(cUTF8, k2){{else}}{{ $y := printf "%s(k2)" .MapKey }}{{ encmd .MapKey $y }}{{end}} + if esep { ee.WriteMapElemValue() } {{ $y := printf "v[%s(k2)]" .MapKey }}{{ encmd .Elem $y }} - } {{end}} + } */}} {{end}} } else { + if esep { + for k2, v2 := range v { + ee.WriteMapElemKey() + {{if eq .MapKey "string"}}ee.EncodeString(cUTF8, k2){{else}}{{ encmd .MapKey "k2"}}{{end}} + ee.WriteMapElemValue() + {{ encmd .Elem "v2"}} + } + } else { + for k2, v2 := range v { + {{if eq .MapKey "string"}}ee.EncodeString(cUTF8, k2){{else}}{{ encmd .MapKey "k2"}}{{end}} + {{ encmd .Elem "v2"}} + } + } {{/* for k2, v2 := range v { - if cr != nil { cr.sendContainerState(containerMapKey) } - {{if eq .MapKey "string"}}if asSymbols { - ee.EncodeSymbol(k2) - } else { - ee.EncodeString(c_UTF8, k2) - }{{else}}{{ encmd .MapKey "k2"}}{{end}} - if cr != nil { cr.sendContainerState(containerMapValue) } + if esep { ee.WriteMapElemKey() } + {{if eq .MapKey "string"}}ee.EncodeString(cUTF8, k2){{else}}{{ encmd .MapKey "k2"}}{{end}} + if esep { ee.WriteMapElemValue() } {{ encmd .Elem "v2"}} - } + } */}} } - if cr != nil { cr.sendContainerState(containerMapEnd) }{{/* ee.EncodeEnd() */}} + ee.WriteMapEnd() } - {{end}}{{end}}{{end}} // -- decode // -- -- fast path type switch func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { + var changed bool + switch v := iv.(type) { +{{range .Values}}{{if not .Primitive}}{{if not .MapKey }}{{if ne .Elem "uint8"}} + case []{{ .Elem }}: + var v2 []{{ .Elem }} + v2, changed = fastpathTV.{{ .MethodNamePfx "Dec" false }}V(v, false, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } + case *[]{{ .Elem }}: + var v2 []{{ .Elem }} + v2, changed = fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*v, true, d) + if changed { + *v = v2 + }{{/* +*/}}{{end}}{{end}}{{end}}{{end}} +{{range .Values}}{{if not .Primitive}}{{if .MapKey }}{{/* +// maps only change if nil, and in that case, there's no point copying +*/}} + case map[{{ .MapKey }}]{{ .Elem }}: + fastpathTV.{{ .MethodNamePfx "Dec" false }}V(v, false, d) + case *map[{{ .MapKey }}]{{ .Elem }}: + var v2 map[{{ .MapKey }}]{{ .Elem }} + v2, changed = fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*v, true, d) + if changed { + *v = v2 + }{{/* +*/}}{{end}}{{end}}{{end}} + default: + _ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4 + return false + } + return true +} + +func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { switch v := iv.(type) { {{range .Values}}{{if not .Primitive}}{{if not .MapKey }} - case []{{ .Elem }}:{{else}} - case map[{{ .MapKey }}]{{ .Elem }}:{{end}} - fastpathTV.{{ .MethodNamePfx "Dec" false }}V(v, fastpathCheckNilFalse, false, d){{if not .MapKey }} - case *[]{{ .Elem }}:{{else}} - case *map[{{ .MapKey }}]{{ .Elem }}:{{end}} - v2, changed2 := fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*v, fastpathCheckNilFalse, true, d) - if changed2 { - *v = v2 - } -{{end}}{{end}} + case *[]{{ .Elem }}: + *v = nil {{/* +*/}}{{end}}{{end}}{{end}} +{{range .Values}}{{if not .Primitive}}{{if .MapKey }} + case *map[{{ .MapKey }}]{{ .Elem }}: + *v = nil {{/* +*/}}{{end}}{{end}}{{end}} default: - _ = v // TODO: workaround https://github.com/golang/go/issues/12927 (remove after go 1.6 release) + _ = v // workaround https://github.com/golang/go/issues/12927 seen in go1.4 return false } return true @@ -303,225 +393,152 @@ Slices can change if they - are addressable (from a ptr) - are settable (e.g. contained in an interface{}) */}} -func (f *decFnInfo) {{ .MethodNamePfx "fastpathDec" false }}R(rv reflect.Value) { - array := f.seq == seqTypeArray - if !array && rv.CanAddr() { {{/* // CanSet => CanAddr + Exported */}} - vp := rv.Addr().Interface().(*[]{{ .Elem }}) - v, changed := fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*vp, fastpathCheckNilFalse, !array, f.d) - if changed { - *vp = v - } +func (d *Decoder) {{ .MethodNamePfx "fastpathDec" false }}R(f *codecFnInfo, rv reflect.Value) { + if array := f.seq == seqTypeArray; !array && rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*[]{{ .Elem }}) + v, changed := fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*vp, !array, d) + if changed { *vp = v } } else { - v := rv.Interface().([]{{ .Elem }}) - fastpathTV.{{ .MethodNamePfx "Dec" false }}V(v, fastpathCheckNilFalse, false, f.d) + v := rv2i(rv).([]{{ .Elem }}) + v2, changed := fastpathTV.{{ .MethodNamePfx "Dec" false }}V(v, !array, d) + if changed && len(v) > 0 && len(v2) > 0 && !(len(v2) == len(v) && &v2[0] == &v[0]) { + copy(v, v2) + } } } - -func (f fastpathT) {{ .MethodNamePfx "Dec" false }}X(vp *[]{{ .Elem }}, checkNil bool, d *Decoder) { - v, changed := f.{{ .MethodNamePfx "Dec" false }}V(*vp, checkNil, true, d) - if changed { - *vp = v - } +func (f fastpathT) {{ .MethodNamePfx "Dec" false }}X(vp *[]{{ .Elem }}, d *Decoder) { + v, changed := f.{{ .MethodNamePfx "Dec" false }}V(*vp, true, d) + if changed { *vp = v } } -func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, checkNil bool, canChange bool, d *Decoder) (_ []{{ .Elem }}, changed bool) { - dd := d.d - {{/* // if dd.isContainerType(valueTypeNil) { dd.TryDecodeAsNil() */}} - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - +func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v []{{ .Elem }}, canChange bool, d *Decoder) (_ []{{ .Elem }}, changed bool) { + dd := d.d{{/* + // if dd.isContainerType(valueTypeNil) { dd.TryDecodeAsNil() + */}} slh, containerLenS := d.decSliceHelperStart() if containerLenS == 0 { if canChange { - if v == nil { - v = []{{ .Elem }}{} - } else if len(v) != 0 { - v = v[:0] - } + if v == nil { v = []{{ .Elem }}{} } else if len(v) != 0 { v = v[:0] } changed = true } slh.End() return v, changed } - - if containerLenS > 0 { - x2read := containerLenS - var xtrunc bool + hasLen := containerLenS > 0 + var xlen int + if hasLen && canChange { if containerLenS > cap(v) { - if canChange { {{/* - // fast-path is for "basic" immutable types, so no need to copy them over - // s := make([]{{ .Elem }}, decInferLen(containerLenS, d.h.MaxInitLen)) - // copy(s, v[:cap(v)]) - // v = s */}} - var xlen int - xlen, xtrunc = decInferLen(containerLenS, d.h.MaxInitLen, {{ .Size }}) - if xtrunc { - if xlen <= cap(v) { - v = v[:xlen] - } else { - v = make([]{{ .Elem }}, xlen) - } - } else { - v = make([]{{ .Elem }}, xlen) - } - changed = true + xlen = decInferLen(containerLenS, d.h.MaxInitLen, {{ .Size }}) + if xlen <= cap(v) { + v = v[:xlen] } else { - d.arrayCannotExpand(len(v), containerLenS) + v = make([]{{ .Elem }}, xlen) } - x2read = len(v) + changed = true } else if containerLenS != len(v) { - if canChange { - v = v[:containerLenS] - changed = true - } - } {{/* // all checks done. cannot go past len. */}} - j := 0 - for ; j < x2read; j++ { - slh.ElemContainerState(j) - {{ if eq .Elem "interface{}" }}d.decode(&v[j]){{ else }}v[j] = {{ decmd .Elem }}{{ end }} - } - if xtrunc { {{/* // means canChange=true, changed=true already. */}} - for ; j < containerLenS; j++ { - v = append(v, {{ zerocmd .Elem }}) - slh.ElemContainerState(j) - {{ if eq .Elem "interface{}" }}d.decode(&v[j]){{ else }}v[j] = {{ decmd .Elem }}{{ end }} - } - } else if !canChange { - for ; j < containerLenS; j++ { - slh.ElemContainerState(j) - d.swallow() - } - } - } else { - breakFound := dd.CheckBreak() {{/* check break first, so we can initialize v with a capacity of 4 if necessary */}} - if breakFound { - if canChange { - if v == nil { - v = []{{ .Elem }}{} - } else if len(v) != 0 { - v = v[:0] - } - changed = true - } - slh.End() - return v, changed - } - if cap(v) == 0 { - v = make([]{{ .Elem }}, 1, 4) - changed = true - } - j := 0 - for ; !breakFound; j++ { - if j >= len(v) { - if canChange { - v = append(v, {{ zerocmd .Elem }}) - changed = true - } else { - d.arrayCannotExpand(len(v), j+1) - } - } - slh.ElemContainerState(j) - if j < len(v) { {{/* // all checks done. cannot go past len. */}} - {{ if eq .Elem "interface{}" }}d.decode(&v[j]) - {{ else }}v[j] = {{ decmd .Elem }}{{ end }} - } else { - d.swallow() - } - breakFound = dd.CheckBreak() - } - if canChange && j < len(v) { - v = v[:j] + v = v[:containerLenS] changed = true } } - slh.End() + j := 0 + for ; (hasLen && j < containerLenS) || !(hasLen || dd.CheckBreak()); j++ { + if j == 0 && len(v) == 0 && canChange { + if hasLen { + xlen = decInferLen(containerLenS, d.h.MaxInitLen, {{ .Size }}) + } else { + xlen = 8 + } + v = make([]{{ .Elem }}, xlen) + changed = true + } + // if indefinite, etc, then expand the slice if necessary + var decodeIntoBlank bool + if j >= len(v) { + if canChange { + v = append(v, {{ zerocmd .Elem }}) + changed = true + } else { + d.arrayCannotExpand(len(v), j+1) + decodeIntoBlank = true + } + } + slh.ElemContainerState(j) + if decodeIntoBlank { + d.swallow() + } else if dd.TryDecodeAsNil() { + v[j] = {{ zerocmd .Elem }} + } else { + {{ if eq .Elem "interface{}" }}d.decode(&v[j]){{ else }}v[j] = {{ decmd .Elem }}{{ end }} + } + } + if canChange { + if j < len(v) { + v = v[:j] + changed = true + } else if j == 0 && v == nil { + v = make([]{{ .Elem }}, 0) + changed = true + } + } + slh.End() return v, changed } - {{end}}{{end}}{{end}} - {{range .Values}}{{if not .Primitive}}{{if .MapKey }} {{/* Maps can change if they are - addressable (from a ptr) - settable (e.g. contained in an interface{}) */}} -func (f *decFnInfo) {{ .MethodNamePfx "fastpathDec" false }}R(rv reflect.Value) { - if rv.CanAddr() { - vp := rv.Addr().Interface().(*map[{{ .MapKey }}]{{ .Elem }}) - v, changed := fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*vp, fastpathCheckNilFalse, true, f.d) - if changed { - *vp = v - } +func (d *Decoder) {{ .MethodNamePfx "fastpathDec" false }}R(f *codecFnInfo, rv reflect.Value) { + if rv.Kind() == reflect.Ptr { + vp := rv2i(rv).(*map[{{ .MapKey }}]{{ .Elem }}) + v, changed := fastpathTV.{{ .MethodNamePfx "Dec" false }}V(*vp, true, d); + if changed { *vp = v } } else { - v := rv.Interface().(map[{{ .MapKey }}]{{ .Elem }}) - fastpathTV.{{ .MethodNamePfx "Dec" false }}V(v, fastpathCheckNilFalse, false, f.d) - } + fastpathTV.{{ .MethodNamePfx "Dec" false }}V(rv2i(rv).(map[{{ .MapKey }}]{{ .Elem }}), false, d) + } } -func (f fastpathT) {{ .MethodNamePfx "Dec" false }}X(vp *map[{{ .MapKey }}]{{ .Elem }}, checkNil bool, d *Decoder) { - v, changed := f.{{ .MethodNamePfx "Dec" false }}V(*vp, checkNil, true, d) - if changed { - *vp = v - } +func (f fastpathT) {{ .MethodNamePfx "Dec" false }}X(vp *map[{{ .MapKey }}]{{ .Elem }}, d *Decoder) { + v, changed := f.{{ .MethodNamePfx "Dec" false }}V(*vp, true, d) + if changed { *vp = v } } -func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v map[{{ .MapKey }}]{{ .Elem }}, checkNil bool, canChange bool, +func (_ fastpathT) {{ .MethodNamePfx "Dec" false }}V(v map[{{ .MapKey }}]{{ .Elem }}, canChange bool, d *Decoder) (_ map[{{ .MapKey }}]{{ .Elem }}, changed bool) { - dd := d.d - cr := d.cr - {{/* // if dd.isContainerType(valueTypeNil) {dd.TryDecodeAsNil() */}} - if checkNil && dd.TryDecodeAsNil() { - if v != nil { - changed = true - } - return nil, changed - } - + dd, esep := d.d, d.hh.hasElemSeparators(){{/* + // if dd.isContainerType(valueTypeNil) {dd.TryDecodeAsNil() + */}} containerLen := dd.ReadMapStart() if canChange && v == nil { - xlen, _ := decInferLen(containerLen, d.h.MaxInitLen, {{ .Size }}) + xlen := decInferLen(containerLen, d.h.MaxInitLen, {{ .Size }}) v = make(map[{{ .MapKey }}]{{ .Elem }}, xlen) changed = true } - {{ if eq .Elem "interface{}" }}mapGet := !d.h.MapValueReset && !d.h.InterfaceReset{{end}} - var mk {{ .MapKey }} - var mv {{ .Elem }} - if containerLen > 0 { - for j := 0; j < containerLen; j++ { - if cr != nil { cr.sendContainerState(containerMapKey) } - {{ if eq .MapKey "interface{}" }}mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) {{/* // maps cannot have []byte as key. switch to string. */}} - }{{ else }}mk = {{ decmd .MapKey }}{{ end }} - if cr != nil { cr.sendContainerState(containerMapValue) } - {{ if eq .Elem "interface{}" }}if mapGet { mv = v[mk] } else { mv = nil } - d.decode(&mv){{ else }}mv = {{ decmd .Elem }}{{ end }} - if v != nil { - v[mk] = mv - } - } - } else if containerLen < 0 { - for j := 0; !dd.CheckBreak(); j++ { - if cr != nil { cr.sendContainerState(containerMapKey) } - {{ if eq .MapKey "interface{}" }}mk = nil - d.decode(&mk) - if bv, bok := mk.([]byte); bok { - mk = d.string(bv) {{/* // maps cannot have []byte as key. switch to string. */}} - }{{ else }}mk = {{ decmd .MapKey }}{{ end }} - if cr != nil { cr.sendContainerState(containerMapValue) } - {{ if eq .Elem "interface{}" }}if mapGet { mv = v[mk] } else { mv = nil } - d.decode(&mv){{ else }}mv = {{ decmd .Elem }}{{ end }} - if v != nil { - v[mk] = mv - } - } + if containerLen == 0 { + dd.ReadMapEnd() + return v, changed } - if cr != nil { cr.sendContainerState(containerMapEnd) } + {{ if eq .Elem "interface{}" }}mapGet := v != nil && !d.h.MapValueReset && !d.h.InterfaceReset + {{end}}var mk {{ .MapKey }} + var mv {{ .Elem }} + hasLen := containerLen > 0 + for j := 0; (hasLen && j < containerLen) || !(hasLen || dd.CheckBreak()); j++ { + if esep { dd.ReadMapElemKey() } + {{ if eq .MapKey "interface{}" }}mk = nil + d.decode(&mk) + if bv, bok := mk.([]byte); bok { + mk = d.string(bv) {{/* // maps cannot have []byte as key. switch to string. */}} + }{{ else }}mk = {{ decmd .MapKey }}{{ end }} + if esep { dd.ReadMapElemValue() } + if dd.TryDecodeAsNil() { + if v == nil {} else if d.h.DeleteOnNilMapValue { delete(v, mk) } else { v[mk] = {{ zerocmd .Elem }} } + continue + } + {{ if eq .Elem "interface{}" }}if mapGet { mv = v[mk] } else { mv = nil } + d.decode(&mv){{ else }}mv = {{ decmd .Elem }}{{ end }} + if v != nil { v[mk] = mv } + } + dd.ReadMapEnd() return v, changed } - {{end}}{{end}}{{end}} diff --git a/vendor/github.com/ugorji/go/codec/fast-path.not.go b/vendor/github.com/ugorji/go/codec/fast-path.not.go index 63e591145..f11b4674f 100644 --- a/vendor/github.com/ugorji/go/codec/fast-path.not.go +++ b/vendor/github.com/ugorji/go/codec/fast-path.not.go @@ -1,3 +1,6 @@ +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Use of this source code is governed by a MIT license found in the LICENSE file. + // +build notfastpath package codec @@ -18,17 +21,27 @@ func fastpathDecodeTypeSwitch(iv interface{}, d *Decoder) bool { return fal func fastpathEncodeTypeSwitch(iv interface{}, e *Encoder) bool { return false } func fastpathEncodeTypeSwitchSlice(iv interface{}, e *Encoder) bool { return false } func fastpathEncodeTypeSwitchMap(iv interface{}, e *Encoder) bool { return false } +func fastpathDecodeSetZeroTypeSwitch(iv interface{}) bool { return false } type fastpathT struct{} type fastpathE struct { rtid uintptr rt reflect.Type - encfn func(*encFnInfo, reflect.Value) - decfn func(*decFnInfo, reflect.Value) + encfn func(*Encoder, *codecFnInfo, reflect.Value) + decfn func(*Decoder, *codecFnInfo, reflect.Value) } type fastpathA [0]fastpathE func (x fastpathA) index(rtid uintptr) int { return -1 } +func (_ fastpathT) DecSliceUint8V(v []uint8, canChange bool, d *Decoder) (_ []uint8, changed bool) { + fn := d.cfer().get(uint8SliceTyp, true, true) + d.kSlice(&fn.i, reflect.ValueOf(&v).Elem()) + return v, true +} + var fastpathAV fastpathA var fastpathTV fastpathT + +// ---- +type TestMammoth2Wrapper struct{} // to allow testMammoth work in notfastpath mode diff --git a/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl b/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl index 32df54144..fbe802ed9 100644 --- a/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl +++ b/vendor/github.com/ugorji/go/codec/gen-dec-array.go.tmpl @@ -13,92 +13,65 @@ if {{var "l"}} == 0 { {{var "v"}} = make({{ .CTyp }}, 0) {{var "c"}} = true } {{end}} -} else if {{var "l"}} > 0 { - {{if isChan }}if {{var "v"}} == nil { - {{var "rl"}}, _ = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }}) - {{var "v"}} = make({{ .CTyp }}, {{var "rl"}}) - {{var "c"}} = true - } - for {{var "r"}} := 0; {{var "r"}} < {{var "l"}}; {{var "r"}}++ { - {{var "h"}}.ElemContainerState({{var "r"}}) - var {{var "t"}} {{ .Typ }} - {{ $x := printf "%st%s" .TempVar .Rand }}{{ decLineVar $x }} - {{var "v"}} <- {{var "t"}} - } - {{ else }} var {{var "rr"}}, {{var "rl"}} int {{/* // num2read, length of slice/array/chan */}} - var {{var "rt"}} bool {{/* truncated */}} - _, _ = {{var "rl"}}, {{var "rt"}} - {{var "rr"}} = {{var "l"}} // len({{var "v"}}) +} else { + {{var "hl"}} := {{var "l"}} > 0 + var {{var "rl"}} int; _ = {{var "rl"}} + {{if isSlice }} if {{var "hl"}} { if {{var "l"}} > cap({{var "v"}}) { - {{if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "l"}}) - {{ else }}{{if not .Immutable }} - {{var "rg"}} := len({{var "v"}}) > 0 - {{var "v2"}} := {{var "v"}} {{end}} - {{var "rl"}}, {{var "rt"}} = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }}) - if {{var "rt"}} { - if {{var "rl"}} <= cap({{var "v"}}) { - {{var "v"}} = {{var "v"}}[:{{var "rl"}}] - } else { - {{var "v"}} = make([]{{ .Typ }}, {{var "rl"}}) - } + {{var "rl"}} = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }}) + if {{var "rl"}} <= cap({{var "v"}}) { + {{var "v"}} = {{var "v"}}[:{{var "rl"}}] } else { {{var "v"}} = make([]{{ .Typ }}, {{var "rl"}}) } {{var "c"}} = true - {{var "rr"}} = len({{var "v"}}) {{if not .Immutable }} - if {{var "rg"}} { copy({{var "v"}}, {{var "v2"}}) } {{end}} {{end}}{{/* end not Immutable, isArray */}} - } {{if isSlice }} else if {{var "l"}} != len({{var "v"}}) { + } else if {{var "l"}} != len({{var "v"}}) { {{var "v"}} = {{var "v"}}[:{{var "l"}}] {{var "c"}} = true - } {{end}} {{/* end isSlice:47 */}} - {{var "j"}} := 0 - for ; {{var "j"}} < {{var "rr"}} ; {{var "j"}}++ { - {{var "h"}}.ElemContainerState({{var "j"}}) - {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }} } - {{if isArray }}for ; {{var "j"}} < {{var "l"}} ; {{var "j"}}++ { + } {{end}} + var {{var "j"}} int + // var {{var "dn"}} bool + for ; ({{var "hl"}} && {{var "j"}} < {{var "l"}}) || !({{var "hl"}} || r.CheckBreak()); {{var "j"}}++ { + {{if not isArray}} if {{var "j"}} == 0 && len({{var "v"}}) == 0 { + if {{var "hl"}} { + {{var "rl"}} = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }}) + } else { + {{var "rl"}} = 8 + } + {{var "v"}} = make([]{{ .Typ }}, {{var "rl"}}) + {{var "c"}} = true + }{{end}} {{var "h"}}.ElemContainerState({{var "j"}}) - z.DecSwallow() - } - {{ else }}if {{var "rt"}} { - for ; {{var "j"}} < {{var "l"}} ; {{var "j"}}++ { - {{var "v"}} = append({{var "v"}}, {{ zero}}) - {{var "h"}}.ElemContainerState({{var "j"}}) - {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }} - } - } {{end}} {{/* end isArray:56 */}} - {{end}} {{/* end isChan:16 */}} -} else { {{/* len < 0 */}} - {{var "j"}} := 0 - for ; !r.CheckBreak(); {{var "j"}}++ { - {{if isChan }} - {{var "h"}}.ElemContainerState({{var "j"}}) - var {{var "t"}} {{ .Typ }} - {{ $x := printf "%st%s" .TempVar .Rand }}{{ decLineVar $x }} - {{var "v"}} <- {{var "t"}} - {{ else }} + {{/* {{var "dn"}} = r.TryDecodeAsNil() */}} + {{if isChan}}{{ $x := printf "%[1]vv%[2]v" .TempVar .Rand }}var {{var $x}} {{ .Typ }} + {{ decLineVar $x }} + {{var "v"}} <- {{ $x }} + {{else}} + // if indefinite, etc, then expand the slice if necessary + var {{var "db"}} bool if {{var "j"}} >= len({{var "v"}}) { - {{if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "j"}}+1) - {{ else }}{{var "v"}} = append({{var "v"}}, {{zero}})// var {{var "z"}} {{ .Typ }} - {{var "c"}} = true {{end}} + {{if isSlice }} {{var "v"}} = append({{var "v"}}, {{ zero }}); {{var "c"}} = true + {{else}} z.DecArrayCannotExpand(len(v), {{var "j"}}+1); {{var "db"}} = true + {{end}} } - {{var "h"}}.ElemContainerState({{var "j"}}) - if {{var "j"}} < len({{var "v"}}) { - {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }} - } else { + if {{var "db"}} { z.DecSwallow() + } else { + {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }} } - {{end}} + {{end}} } - {{if isSlice }}if {{var "j"}} < len({{var "v"}}) { + {{if isSlice}} if {{var "j"}} < len({{var "v"}}) { {{var "v"}} = {{var "v"}}[:{{var "j"}}] {{var "c"}} = true } else if {{var "j"}} == 0 && {{var "v"}} == nil { - {{var "v"}} = []{{ .Typ }}{} + {{var "v"}} = make([]{{ .Typ }}, 0) {{var "c"}} = true - }{{end}} + } {{end}} } {{var "h"}}.End() {{if not isArray }}if {{var "c"}} { *{{ .Varname }} = {{var "v"}} }{{end}} + diff --git a/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl b/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl index 77400e0a1..8323b5494 100644 --- a/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl +++ b/vendor/github.com/ugorji/go/codec/gen-dec-map.go.tmpl @@ -2,21 +2,22 @@ {{var "l"}} := r.ReadMapStart() {{var "bh"}} := z.DecBasicHandle() if {{var "v"}} == nil { - {{var "rl"}}, _ := z.DecInferLen({{var "l"}}, {{var "bh"}}.MaxInitLen, {{ .Size }}) + {{var "rl"}} := z.DecInferLen({{var "l"}}, {{var "bh"}}.MaxInitLen, {{ .Size }}) {{var "v"}} = make(map[{{ .KTyp }}]{{ .Typ }}, {{var "rl"}}) *{{ .Varname }} = {{var "v"}} } var {{var "mk"}} {{ .KTyp }} var {{var "mv"}} {{ .Typ }} -var {{var "mg"}} {{if decElemKindPtr}}, {{var "ms"}}, {{var "mok"}}{{end}} bool +var {{var "mg"}}, {{var "mdn"}} {{if decElemKindPtr}}, {{var "ms"}}, {{var "mok"}}{{end}} bool if {{var "bh"}}.MapValueReset { {{if decElemKindPtr}}{{var "mg"}} = true {{else if decElemKindIntf}}if !{{var "bh"}}.InterfaceReset { {{var "mg"}} = true } {{else if not decElemKindImmutable}}{{var "mg"}} = true {{end}} } -if {{var "l"}} > 0 { -for {{var "j"}} := 0; {{var "j"}} < {{var "l"}}; {{var "j"}}++ { - z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }}) +if {{var "l"}} != 0 { +{{var "hl"}} := {{var "l"}} > 0 + for {{var "j"}} := 0; ({{var "hl"}} && {{var "j"}} < {{var "l"}}) || !({{var "hl"}} || r.CheckBreak()); {{var "j"}}++ { + r.ReadMapElemKey() {{/* z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }}) */}} {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x }} {{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */}}if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} { {{var "mk"}} = string({{var "bv"}}) @@ -28,31 +29,14 @@ for {{var "j"}} := 0; {{var "j"}} < {{var "l"}}; {{var "j"}}++ { {{var "ms"}} = false } {{else}}{{var "mv"}} = {{var "v"}}[{{var "mk"}}] {{end}} } {{if not decElemKindImmutable}}else { {{var "mv"}} = {{decElemZero}} }{{end}} - z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }}) - {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ decLineVar $x }} - if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil { - {{var "v"}}[{{var "mk"}}] = {{var "mv"}} - } -} -} else if {{var "l"}} < 0 { -for {{var "j"}} := 0; !r.CheckBreak(); {{var "j"}}++ { - z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }}) - {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x }} -{{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */}}if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} { - {{var "mk"}} = string({{var "bv"}}) - }{{ end }}{{if decElemKindPtr}} - {{var "ms"}} = true {{ end }} - if {{var "mg"}} { - {{if decElemKindPtr}}{{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}] - if {{var "mok"}} { - {{var "ms"}} = false - } {{else}}{{var "mv"}} = {{var "v"}}[{{var "mk"}}] {{end}} - } {{if not decElemKindImmutable}}else { {{var "mv"}} = {{decElemZero}} }{{end}} - z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }}) - {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ decLineVar $x }} - if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil { + r.ReadMapElemValue() {{/* z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }}) */}} + {{var "mdn"}} = false + {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ $y := printf "%vmdn%v" .TempVar .Rand }}{{ decLineVar $x $y }} + if {{var "mdn"}} { + if {{ var "bh" }}.DeleteOnNilMapValue { delete({{var "v"}}, {{var "mk"}}) } else { {{var "v"}}[{{var "mk"}}] = {{decElemZero}} } + } else if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil { {{var "v"}}[{{var "mk"}}] = {{var "mv"}} } } } // else len==0: TODO: Should we clear map entries? -z.DecSendContainerState(codecSelfer_containerMapEnd{{ .Sfx }}) +r.ReadMapEnd() {{/* z.DecSendContainerState(codecSelfer_containerMapEnd{{ .Sfx }}) */}} diff --git a/vendor/github.com/ugorji/go/codec/gen-helper.generated.go b/vendor/github.com/ugorji/go/codec/gen-helper.generated.go index eb0bdad35..917d28283 100644 --- a/vendor/github.com/ugorji/go/codec/gen-helper.generated.go +++ b/vendor/github.com/ugorji/go/codec/gen-helper.generated.go @@ -3,10 +3,7 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. -// ************************************************************ -// DO NOT EDIT. -// THIS FILE IS AUTO-GENERATED from gen-helper.go.tmpl -// ************************************************************ +// Code generated from gen-helper.go.tmpl - DO NOT EDIT. package codec @@ -15,6 +12,9 @@ import ( "reflect" ) +// GenVersion is the current version of codecgen. +const GenVersion = 8 + // This file is used to generate helper code for codecgen. // The values here i.e. genHelper(En|De)coder are not to be used directly by // library users. They WILL change continuously and without notice. @@ -26,25 +26,75 @@ import ( // to perform encoding or decoding of primitives or known slice or map types. // GenHelperEncoder is exported so that it can be used externally by codecgen. +// // Library users: DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE. -func GenHelperEncoder(e *Encoder) (genHelperEncoder, encDriver) { - return genHelperEncoder{e: e}, e.e +func GenHelperEncoder(e *Encoder) (ge genHelperEncoder, ee genHelperEncDriver) { + ge = genHelperEncoder{e: e} + ee = genHelperEncDriver{encDriver: e.e} + return } // GenHelperDecoder is exported so that it can be used externally by codecgen. +// // Library users: DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE. -func GenHelperDecoder(d *Decoder) (genHelperDecoder, decDriver) { - return genHelperDecoder{d: d}, d.d +func GenHelperDecoder(d *Decoder) (gd genHelperDecoder, dd genHelperDecDriver) { + gd = genHelperDecoder{d: d} + dd = genHelperDecDriver{decDriver: d.d} + return +} + +type genHelperEncDriver struct { + encDriver +} + +func (x genHelperEncDriver) EncodeBuiltin(rt uintptr, v interface{}) {} +func (x genHelperEncDriver) EncStructFieldKey(keyType valueType, s string) { + encStructFieldKey(x.encDriver, keyType, s) +} +func (x genHelperEncDriver) EncodeSymbol(s string) { + x.encDriver.EncodeString(cUTF8, s) +} + +type genHelperDecDriver struct { + decDriver + C checkOverflow +} + +func (x genHelperDecDriver) DecodeBuiltin(rt uintptr, v interface{}) {} +func (x genHelperDecDriver) DecStructFieldKey(keyType valueType, buf *[decScratchByteArrayLen]byte) []byte { + return decStructFieldKey(x.decDriver, keyType, buf) +} +func (x genHelperDecDriver) DecodeInt(bitsize uint8) (i int64) { + return x.C.IntV(x.decDriver.DecodeInt64(), bitsize) +} +func (x genHelperDecDriver) DecodeUint(bitsize uint8) (ui uint64) { + return x.C.UintV(x.decDriver.DecodeUint64(), bitsize) +} +func (x genHelperDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) { + f = x.DecodeFloat64() + if chkOverflow32 && chkOvf.Float32(f) { + panicv.errorf("float32 overflow: %v", f) + } + return +} +func (x genHelperDecDriver) DecodeFloat32As64() (f float64) { + f = x.DecodeFloat64() + if chkOvf.Float32(f) { + panicv.errorf("float32 overflow: %v", f) + } + return } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* type genHelperEncoder struct { + M must e *Encoder F fastpathT } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* type genHelperDecoder struct { + C checkOverflow d *Decoder F fastpathT } @@ -59,74 +109,86 @@ func (f genHelperEncoder) EncBinary() bool { return f.e.be // f.e.hh.isBinaryEncoding() } -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) EncFallback(iv interface{}) { - // println(">>>>>>>>> EncFallback") - f.e.encodeI(iv, false, false) -} - -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) EncTextMarshal(iv encoding.TextMarshaler) { - bs, fnerr := iv.MarshalText() - f.e.marshal(bs, fnerr, false, c_UTF8) -} - -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) EncJSONMarshal(iv jsonMarshaler) { - bs, fnerr := iv.MarshalJSON() - f.e.marshal(bs, fnerr, true, c_UTF8) -} - -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) EncBinaryMarshal(iv encoding.BinaryMarshaler) { - bs, fnerr := iv.MarshalBinary() - f.e.marshal(bs, fnerr, false, c_RAW) -} - -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) EncRaw(iv Raw) { - f.e.raw(iv) -} - -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) TimeRtidIfBinc() uintptr { - if _, ok := f.e.hh.(*BincHandle); ok { - return timeTypId - } - return 0 -} - // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) IsJSONHandle() bool { return f.e.js } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncFallback(iv interface{}) { + // println(">>>>>>>>> EncFallback") + // f.e.encodeI(iv, false, false) + f.e.encodeValue(reflect.ValueOf(iv), nil, false) +} + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncTextMarshal(iv encoding.TextMarshaler) { + bs, fnerr := iv.MarshalText() + f.e.marshal(bs, fnerr, false, cUTF8) +} + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncJSONMarshal(iv jsonMarshaler) { + bs, fnerr := iv.MarshalJSON() + f.e.marshal(bs, fnerr, true, cUTF8) +} + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncBinaryMarshal(iv encoding.BinaryMarshaler) { + bs, fnerr := iv.MarshalBinary() + f.e.marshal(bs, fnerr, false, cRAW) +} + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncRaw(iv Raw) { f.e.rawBytes(iv) } + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +// +// Deprecated: builtin no longer supported - so we make this method a no-op, +// but leave in-place so that old generated files continue to work without regeneration. +func (f genHelperEncoder) TimeRtidIfBinc() (v uintptr) { return } + +// func (f genHelperEncoder) TimeRtidIfBinc() uintptr { +// if _, ok := f.e.hh.(*BincHandle); ok { +// return timeTypId +// } +// } + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) I2Rtid(v interface{}) uintptr { + return i2rtid(v) +} + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) Extension(rtid uintptr) (xfn *extTypeTagFn) { + return f.e.h.getExt(rtid) +} + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncExtension(v interface{}, xfFn *extTypeTagFn) { + f.e.e.EncodeExt(v, xfFn.tag, xfFn.ext, f.e) +} + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +// +// Deprecated: No longer used, +// but leave in-place so that old generated files continue to work without regeneration. func (f genHelperEncoder) HasExtensions() bool { return len(f.e.h.extHandle) != 0 } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +// +// Deprecated: No longer used, +// but leave in-place so that old generated files continue to work without regeneration. func (f genHelperEncoder) EncExt(v interface{}) (r bool) { - rt := reflect.TypeOf(v) - if rt.Kind() == reflect.Ptr { - rt = rt.Elem() - } - rtid := reflect.ValueOf(rt).Pointer() - if xfFn := f.e.h.getExt(rtid); xfFn != nil { + if xfFn := f.e.h.getExt(i2rtid(v)); xfFn != nil { f.e.e.EncodeExt(v, xfFn.tag, xfFn.ext, f.e) return true } return false } -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) EncSendContainerState(c containerState) { - if f.e.cr != nil { - f.e.cr.sendContainerState(c) - } -} - // ---------------- DECODER FOLLOWS ----------------- // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* @@ -140,19 +202,27 @@ func (f genHelperDecoder) DecBinary() bool { } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecSwallow() { - f.d.swallow() -} +func (f genHelperDecoder) DecSwallow() { f.d.swallow() } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecScratchBuffer() []byte { return f.d.b[:] } +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecScratchArrayBuffer() *[decScratchByteArrayLen]byte { + return &f.d.b +} + // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecFallback(iv interface{}, chkPtr bool) { // println(">>>>>>>>> DecFallback") - f.d.decodeI(iv, chkPtr, false, false, false) + rv := reflect.ValueOf(iv) + if chkPtr { + rv = f.d.ensureDecodeable(rv) + } + f.d.decodeValue(rv, nil, false) + // f.d.decodeValueFallback(rv) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* @@ -172,7 +242,7 @@ func (f genHelperDecoder) DecArrayCannotExpand(sliceLen, streamLen int) { // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecTextUnmarshal(tm encoding.TextUnmarshaler) { - fnerr := tm.UnmarshalText(f.d.d.DecodeBytes(f.d.b[:], true, true)) + fnerr := tm.UnmarshalText(f.d.d.DecodeStringAsBytes()) if fnerr != nil { panic(fnerr) } @@ -180,7 +250,7 @@ func (f genHelperDecoder) DecTextUnmarshal(tm encoding.TextUnmarshaler) { // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecJSONUnmarshal(tm jsonUnmarshaler) { - // bs := f.dd.DecodeBytes(f.d.b[:], true, true) + // bs := f.dd.DecodeStringAsBytes() // grab the bytes to be read, as UnmarshalJSON needs the full JSON so as to unmarshal it itself. fnerr := tm.UnmarshalJSON(f.d.nextValueBytes()) if fnerr != nil { @@ -190,24 +260,28 @@ func (f genHelperDecoder) DecJSONUnmarshal(tm jsonUnmarshaler) { // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecBinaryUnmarshal(bm encoding.BinaryUnmarshaler) { - fnerr := bm.UnmarshalBinary(f.d.d.DecodeBytes(nil, false, true)) + fnerr := bm.UnmarshalBinary(f.d.d.DecodeBytes(nil, true)) if fnerr != nil { panic(fnerr) } } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecRaw() []byte { - return f.d.raw() -} +func (f genHelperDecoder) DecRaw() []byte { return f.d.rawBytes() } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) TimeRtidIfBinc() uintptr { - if _, ok := f.d.hh.(*BincHandle); ok { - return timeTypId - } - return 0 -} +// +// Deprecated: builtin no longer supported - so we make this method a no-op, +// but leave in-place so that old generated files continue to work without regeneration. +func (f genHelperDecoder) TimeRtidIfBinc() (v uintptr) { return } + +// func (f genHelperDecoder) TimeRtidIfBinc() uintptr { +// // Note: builtin is no longer supported - so make this a no-op +// if _, ok := f.d.hh.(*BincHandle); ok { +// return timeTypId +// } +// return 0 +// } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) IsJSONHandle() bool { @@ -215,15 +289,34 @@ func (f genHelperDecoder) IsJSONHandle() bool { } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) I2Rtid(v interface{}) uintptr { + return i2rtid(v) +} + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) Extension(rtid uintptr) (xfn *extTypeTagFn) { + return f.d.h.getExt(rtid) +} + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecExtension(v interface{}, xfFn *extTypeTagFn) { + f.d.d.DecodeExt(v, xfFn.tag, xfFn.ext) +} + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +// +// Deprecated: No longer used, +// but leave in-place so that old generated files continue to work without regeneration. func (f genHelperDecoder) HasExtensions() bool { return len(f.d.h.extHandle) != 0 } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +// +// Deprecated: No longer used, +// but leave in-place so that old generated files continue to work without regeneration. func (f genHelperDecoder) DecExt(v interface{}) (r bool) { - rt := reflect.TypeOf(v).Elem() - rtid := reflect.ValueOf(rt).Pointer() - if xfFn := f.d.h.getExt(rtid); xfFn != nil { + if xfFn := f.d.h.getExt(i2rtid(v)); xfFn != nil { f.d.d.DecodeExt(v, xfFn.tag, xfFn.ext) return true } @@ -231,13 +324,12 @@ func (f genHelperDecoder) DecExt(v interface{}) (r bool) { } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecInferLen(clen, maxlen, unit int) (rvlen int, truncated bool) { +func (f genHelperDecoder) DecInferLen(clen, maxlen, unit int) (rvlen int) { return decInferLen(clen, maxlen, unit) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecSendContainerState(c containerState) { - if f.d.cr != nil { - f.d.cr.sendContainerState(c) - } -} +// +// Deprecated: no longer used, +// but leave in-place so that old generated files continue to work without regeneration. +func (f genHelperDecoder) StringView(v []byte) string { return stringView(v) } diff --git a/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl b/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl index ad99f6671..6aeb85650 100644 --- a/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl +++ b/vendor/github.com/ugorji/go/codec/gen-helper.go.tmpl @@ -3,10 +3,7 @@ // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. -// ************************************************************ -// DO NOT EDIT. -// THIS FILE IS AUTO-GENERATED from gen-helper.go.tmpl -// ************************************************************ +// Code generated from gen-helper.go.tmpl - DO NOT EDIT. package codec @@ -15,36 +12,89 @@ import ( "reflect" ) +// GenVersion is the current version of codecgen. +const GenVersion = {{ .Version }} + // This file is used to generate helper code for codecgen. // The values here i.e. genHelper(En|De)coder are not to be used directly by // library users. They WILL change continuously and without notice. -// +// // To help enforce this, we create an unexported type with exported members. // The only way to get the type is via the one exported type that we control (somewhat). -// +// // When static codecs are created for types, they will use this value // to perform encoding or decoding of primitives or known slice or map types. // GenHelperEncoder is exported so that it can be used externally by codecgen. +// // Library users: DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE. -func GenHelperEncoder(e *Encoder) (genHelperEncoder, encDriver) { - return genHelperEncoder{e:e}, e.e +func GenHelperEncoder(e *Encoder) (ge genHelperEncoder, ee genHelperEncDriver) { + ge = genHelperEncoder{e: e} + ee = genHelperEncDriver{encDriver: e.e} + return } // GenHelperDecoder is exported so that it can be used externally by codecgen. +// // Library users: DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE. -func GenHelperDecoder(d *Decoder) (genHelperDecoder, decDriver) { - return genHelperDecoder{d:d}, d.d +func GenHelperDecoder(d *Decoder) (gd genHelperDecoder, dd genHelperDecDriver) { + gd = genHelperDecoder{d: d} + dd = genHelperDecDriver{decDriver: d.d} + return +} + +type genHelperEncDriver struct { + encDriver +} + +func (x genHelperEncDriver) EncodeBuiltin(rt uintptr, v interface{}) {} +func (x genHelperEncDriver) EncStructFieldKey(keyType valueType, s string) { + encStructFieldKey(x.encDriver, keyType, s) +} +func (x genHelperEncDriver) EncodeSymbol(s string) { + x.encDriver.EncodeString(cUTF8, s) +} + +type genHelperDecDriver struct { + decDriver + C checkOverflow +} + +func (x genHelperDecDriver) DecodeBuiltin(rt uintptr, v interface{}) {} +func (x genHelperDecDriver) DecStructFieldKey(keyType valueType, buf *[decScratchByteArrayLen]byte) []byte { + return decStructFieldKey(x.decDriver, keyType, buf) +} +func (x genHelperDecDriver) DecodeInt(bitsize uint8) (i int64) { + return x.C.IntV(x.decDriver.DecodeInt64(), bitsize) +} +func (x genHelperDecDriver) DecodeUint(bitsize uint8) (ui uint64) { + return x.C.UintV(x.decDriver.DecodeUint64(), bitsize) +} +func (x genHelperDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) { + f = x.DecodeFloat64() + if chkOverflow32 && chkOvf.Float32(f) { + panicv.errorf("float32 overflow: %v", f) + } + return +} +func (x genHelperDecDriver) DecodeFloat32As64() (f float64) { + f = x.DecodeFloat64() + if chkOvf.Float32(f) { + panicv.errorf("float32 overflow: %v", f) + } + return } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* type genHelperEncoder struct { + M must e *Encoder F fastpathT } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* type genHelperDecoder struct { + C checkOverflow d *Decoder F fastpathT } @@ -53,69 +103,78 @@ type genHelperDecoder struct { func (f genHelperEncoder) EncBasicHandle() *BasicHandle { return f.e.h } - // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) EncBinary() bool { return f.e.be // f.e.hh.isBinaryEncoding() } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) EncFallback(iv interface{}) { - // println(">>>>>>>>> EncFallback") - f.e.encodeI(iv, false, false) -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) EncTextMarshal(iv encoding.TextMarshaler) { - bs, fnerr := iv.MarshalText() - f.e.marshal(bs, fnerr, false, c_UTF8) -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) EncJSONMarshal(iv jsonMarshaler) { - bs, fnerr := iv.MarshalJSON() - f.e.marshal(bs, fnerr, true, c_UTF8) -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) EncBinaryMarshal(iv encoding.BinaryMarshaler) { - bs, fnerr := iv.MarshalBinary() - f.e.marshal(bs, fnerr, false, c_RAW) -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) EncRaw(iv Raw) { - f.e.raw(iv) -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) TimeRtidIfBinc() uintptr { - if _, ok := f.e.hh.(*BincHandle); ok { - return timeTypId - } - return 0 -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperEncoder) IsJSONHandle() bool { return f.e.js } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncFallback(iv interface{}) { + // println(">>>>>>>>> EncFallback") + // f.e.encodeI(iv, false, false) + f.e.encodeValue(reflect.ValueOf(iv), nil, false) +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncTextMarshal(iv encoding.TextMarshaler) { + bs, fnerr := iv.MarshalText() + f.e.marshal(bs, fnerr, false, cUTF8) +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncJSONMarshal(iv jsonMarshaler) { + bs, fnerr := iv.MarshalJSON() + f.e.marshal(bs, fnerr, true, cUTF8) +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncBinaryMarshal(iv encoding.BinaryMarshaler) { + bs, fnerr := iv.MarshalBinary() + f.e.marshal(bs, fnerr, false, cRAW) +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncRaw(iv Raw) { f.e.rawBytes(iv) } +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +// +// Deprecated: builtin no longer supported - so we make this method a no-op, +// but leave in-place so that old generated files continue to work without regeneration. +func (f genHelperEncoder) TimeRtidIfBinc() (v uintptr) { return } +// func (f genHelperEncoder) TimeRtidIfBinc() uintptr { +// if _, ok := f.e.hh.(*BincHandle); ok { +// return timeTypId +// } +// } + +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) I2Rtid(v interface{}) uintptr { + return i2rtid(v) +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) Extension(rtid uintptr) (xfn *extTypeTagFn) { + return f.e.h.getExt(rtid) +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperEncoder) EncExtension(v interface{}, xfFn *extTypeTagFn) { + f.e.e.EncodeExt(v, xfFn.tag, xfFn.ext, f.e) +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +// +// Deprecated: No longer used, +// but leave in-place so that old generated files continue to work without regeneration. func (f genHelperEncoder) HasExtensions() bool { return len(f.e.h.extHandle) != 0 } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +// +// Deprecated: No longer used, +// but leave in-place so that old generated files continue to work without regeneration. func (f genHelperEncoder) EncExt(v interface{}) (r bool) { - rt := reflect.TypeOf(v) - if rt.Kind() == reflect.Ptr { - rt = rt.Elem() - } - rtid := reflect.ValueOf(rt).Pointer() - if xfFn := f.e.h.getExt(rtid); xfFn != nil { + if xfFn := f.e.h.getExt(i2rtid(v)); xfFn != nil { f.e.e.EncodeExt(v, xfFn.tag, xfFn.ext, f.e) return true } return false } -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) EncSendContainerState(c containerState) { - if f.e.cr != nil { - f.e.cr.sendContainerState(c) - } -} // ---------------- DECODER FOLLOWS ----------------- @@ -128,17 +187,24 @@ func (f genHelperDecoder) DecBinary() bool { return f.d.be // f.d.hh.isBinaryEncoding() } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecSwallow() { - f.d.swallow() -} +func (f genHelperDecoder) DecSwallow() { f.d.swallow() } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecScratchBuffer() []byte { return f.d.b[:] } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecScratchArrayBuffer() *[decScratchByteArrayLen]byte { + return &f.d.b +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecFallback(iv interface{}, chkPtr bool) { // println(">>>>>>>>> DecFallback") - f.d.decodeI(iv, chkPtr, false, false, false) + rv := reflect.ValueOf(iv) + if chkPtr { + rv = f.d.ensureDecodeable(rv) + } + f.d.decodeValue(rv, nil, false) + // f.d.decodeValueFallback(rv) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecSliceHelperStart() (decSliceHelper, int) { @@ -154,14 +220,14 @@ func (f genHelperDecoder) DecArrayCannotExpand(sliceLen, streamLen int) { } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecTextUnmarshal(tm encoding.TextUnmarshaler) { - fnerr := tm.UnmarshalText(f.d.d.DecodeBytes(f.d.b[:], true, true)) + fnerr := tm.UnmarshalText(f.d.d.DecodeStringAsBytes()) if fnerr != nil { panic(fnerr) } } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecJSONUnmarshal(tm jsonUnmarshaler) { - // bs := f.dd.DecodeBytes(f.d.b[:], true, true) + // bs := f.dd.DecodeStringAsBytes() // grab the bytes to be read, as UnmarshalJSON needs the full JSON so as to unmarshal it itself. fnerr := tm.UnmarshalJSON(f.d.nextValueBytes()) if fnerr != nil { @@ -170,203 +236,67 @@ func (f genHelperDecoder) DecJSONUnmarshal(tm jsonUnmarshaler) { } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) DecBinaryUnmarshal(bm encoding.BinaryUnmarshaler) { - fnerr := bm.UnmarshalBinary(f.d.d.DecodeBytes(nil, false, true)) + fnerr := bm.UnmarshalBinary(f.d.d.DecodeBytes(nil, true)) if fnerr != nil { panic(fnerr) } } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecRaw() []byte { - return f.d.raw() -} +func (f genHelperDecoder) DecRaw() []byte { return f.d.rawBytes() } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) TimeRtidIfBinc() uintptr { - if _, ok := f.d.hh.(*BincHandle); ok { - return timeTypId - } - return 0 -} +// +// Deprecated: builtin no longer supported - so we make this method a no-op, +// but leave in-place so that old generated files continue to work without regeneration. +func (f genHelperDecoder) TimeRtidIfBinc() (v uintptr) { return } +// func (f genHelperDecoder) TimeRtidIfBinc() uintptr { +// // Note: builtin is no longer supported - so make this a no-op +// if _, ok := f.d.hh.(*BincHandle); ok { +// return timeTypId +// } +// return 0 +// } + // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* func (f genHelperDecoder) IsJSONHandle() bool { return f.d.js } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) I2Rtid(v interface{}) uintptr { + return i2rtid(v) +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) Extension(rtid uintptr) (xfn *extTypeTagFn) { + return f.d.h.getExt(rtid) +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +func (f genHelperDecoder) DecExtension(v interface{}, xfFn *extTypeTagFn) { + f.d.d.DecodeExt(v, xfFn.tag, xfFn.ext) +} +// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +// +// Deprecated: No longer used, +// but leave in-place so that old generated files continue to work without regeneration. func (f genHelperDecoder) HasExtensions() bool { return len(f.d.h.extHandle) != 0 } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* +// +// Deprecated: No longer used, +// but leave in-place so that old generated files continue to work without regeneration. func (f genHelperDecoder) DecExt(v interface{}) (r bool) { - rt := reflect.TypeOf(v).Elem() - rtid := reflect.ValueOf(rt).Pointer() - if xfFn := f.d.h.getExt(rtid); xfFn != nil { + if xfFn := f.d.h.getExt(i2rtid(v)); xfFn != nil { f.d.d.DecodeExt(v, xfFn.tag, xfFn.ext) return true } return false } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecInferLen(clen, maxlen, unit int) (rvlen int, truncated bool) { +func (f genHelperDecoder) DecInferLen(clen, maxlen, unit int) (rvlen int) { return decInferLen(clen, maxlen, unit) } // FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecSendContainerState(c containerState) { - if f.d.cr != nil { - f.d.cr.sendContainerState(c) - } -} +// +// Deprecated: no longer used, +// but leave in-place so that old generated files continue to work without regeneration. +func (f genHelperDecoder) StringView(v []byte) string { return stringView(v) } -{{/* - -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) EncDriver() encDriver { - return f.e.e -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecDriver() decDriver { - return f.d.d -} - -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) EncNil() { - f.e.e.EncodeNil() -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) EncBytes(v []byte) { - f.e.e.EncodeStringBytes(c_RAW, v) -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) EncArrayStart(length int) { - f.e.e.EncodeArrayStart(length) -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) EncArrayEnd() { - f.e.e.EncodeArrayEnd() -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) EncArrayEntrySeparator() { - f.e.e.EncodeArrayEntrySeparator() -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) EncMapStart(length int) { - f.e.e.EncodeMapStart(length) -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) EncMapEnd() { - f.e.e.EncodeMapEnd() -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) EncMapEntrySeparator() { - f.e.e.EncodeMapEntrySeparator() -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) EncMapKVSeparator() { - f.e.e.EncodeMapKVSeparator() -} - -// --------- - -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecBytes(v *[]byte) { - *v = f.d.d.DecodeBytes(*v) -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecTryNil() bool { - return f.d.d.TryDecodeAsNil() -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecContainerIsNil() (b bool) { - return f.d.d.IsContainerType(valueTypeNil) -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecContainerIsMap() (b bool) { - return f.d.d.IsContainerType(valueTypeMap) -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecContainerIsArray() (b bool) { - return f.d.d.IsContainerType(valueTypeArray) -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecCheckBreak() bool { - return f.d.d.CheckBreak() -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecMapStart() int { - return f.d.d.ReadMapStart() -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecArrayStart() int { - return f.d.d.ReadArrayStart() -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecMapEnd() { - f.d.d.ReadMapEnd() -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecArrayEnd() { - f.d.d.ReadArrayEnd() -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecArrayEntrySeparator() { - f.d.d.ReadArrayEntrySeparator() -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecMapEntrySeparator() { - f.d.d.ReadMapEntrySeparator() -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) DecMapKVSeparator() { - f.d.d.ReadMapKVSeparator() -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) ReadStringAsBytes(bs []byte) []byte { - return f.d.d.DecodeStringAsBytes(bs) -} - - -// -- encode calls (primitives) -{{range .Values}}{{if .Primitive }}{{if ne .Primitive "interface{}" }} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) {{ .MethodNamePfx "Enc" true }}(v {{ .Primitive }}) { - ee := f.e.e - {{ encmd .Primitive "v" }} -} -{{ end }}{{ end }}{{ end }} - -// -- decode calls (primitives) -{{range .Values}}{{if .Primitive }}{{if ne .Primitive "interface{}" }} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) {{ .MethodNamePfx "Dec" true }}(vp *{{ .Primitive }}) { - dd := f.d.d - *vp = {{ decmd .Primitive }} -} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperDecoder) {{ .MethodNamePfx "Read" true }}() (v {{ .Primitive }}) { - dd := f.d.d - v = {{ decmd .Primitive }} - return -} -{{ end }}{{ end }}{{ end }} - - -// -- encode calls (slices/maps) -{{range .Values}}{{if not .Primitive }}{{if .Slice }} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) {{ .MethodNamePfx "Enc" false }}(v []{{ .Elem }}) { {{ else }} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -func (f genHelperEncoder) {{ .MethodNamePfx "Enc" false }}(v map[{{ .MapKey }}]{{ .Elem }}) { {{end}} - f.F.{{ .MethodNamePfx "Enc" false }}V(v, false, f.e) -} -{{ end }}{{ end }} - -// -- decode calls (slices/maps) -{{range .Values}}{{if not .Primitive }} -// FOR USE BY CODECGEN ONLY. IT *WILL* CHANGE WITHOUT NOTICE. *DO NOT USE* -{{if .Slice }}func (f genHelperDecoder) {{ .MethodNamePfx "Dec" false }}(vp *[]{{ .Elem }}) { -{{else}}func (f genHelperDecoder) {{ .MethodNamePfx "Dec" false }}(vp *map[{{ .MapKey }}]{{ .Elem }}) { {{end}} - v, changed := f.F.{{ .MethodNamePfx "Dec" false }}V(*vp, false, true, f.d) - if changed { - *vp = v - } -} -{{ end }}{{ end }} -*/}} diff --git a/vendor/github.com/ugorji/go/codec/gen.generated.go b/vendor/github.com/ugorji/go/codec/gen.generated.go index 2ace97b78..799bc76e8 100644 --- a/vendor/github.com/ugorji/go/codec/gen.generated.go +++ b/vendor/github.com/ugorji/go/codec/gen.generated.go @@ -1,3 +1,5 @@ +// +build codecgen.exec + // Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. @@ -10,21 +12,22 @@ const genDecMapTmpl = ` {{var "l"}} := r.ReadMapStart() {{var "bh"}} := z.DecBasicHandle() if {{var "v"}} == nil { - {{var "rl"}}, _ := z.DecInferLen({{var "l"}}, {{var "bh"}}.MaxInitLen, {{ .Size }}) + {{var "rl"}} := z.DecInferLen({{var "l"}}, {{var "bh"}}.MaxInitLen, {{ .Size }}) {{var "v"}} = make(map[{{ .KTyp }}]{{ .Typ }}, {{var "rl"}}) *{{ .Varname }} = {{var "v"}} } var {{var "mk"}} {{ .KTyp }} var {{var "mv"}} {{ .Typ }} -var {{var "mg"}} {{if decElemKindPtr}}, {{var "ms"}}, {{var "mok"}}{{end}} bool +var {{var "mg"}}, {{var "mdn"}} {{if decElemKindPtr}}, {{var "ms"}}, {{var "mok"}}{{end}} bool if {{var "bh"}}.MapValueReset { {{if decElemKindPtr}}{{var "mg"}} = true {{else if decElemKindIntf}}if !{{var "bh"}}.InterfaceReset { {{var "mg"}} = true } {{else if not decElemKindImmutable}}{{var "mg"}} = true {{end}} } -if {{var "l"}} > 0 { -for {{var "j"}} := 0; {{var "j"}} < {{var "l"}}; {{var "j"}}++ { - z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }}) +if {{var "l"}} != 0 { +{{var "hl"}} := {{var "l"}} > 0 + for {{var "j"}} := 0; ({{var "hl"}} && {{var "j"}} < {{var "l"}}) || !({{var "hl"}} || r.CheckBreak()); {{var "j"}}++ { + r.ReadMapElemKey() {{/* z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }}) */}} {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x }} {{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */}}if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} { {{var "mk"}} = string({{var "bv"}}) @@ -36,34 +39,17 @@ for {{var "j"}} := 0; {{var "j"}} < {{var "l"}}; {{var "j"}}++ { {{var "ms"}} = false } {{else}}{{var "mv"}} = {{var "v"}}[{{var "mk"}}] {{end}} } {{if not decElemKindImmutable}}else { {{var "mv"}} = {{decElemZero}} }{{end}} - z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }}) - {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ decLineVar $x }} - if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil { - {{var "v"}}[{{var "mk"}}] = {{var "mv"}} - } -} -} else if {{var "l"}} < 0 { -for {{var "j"}} := 0; !r.CheckBreak(); {{var "j"}}++ { - z.DecSendContainerState(codecSelfer_containerMapKey{{ .Sfx }}) - {{ $x := printf "%vmk%v" .TempVar .Rand }}{{ decLineVarK $x }} -{{ if eq .KTyp "interface{}" }}{{/* // special case if a byte array. */}}if {{var "bv"}}, {{var "bok"}} := {{var "mk"}}.([]byte); {{var "bok"}} { - {{var "mk"}} = string({{var "bv"}}) - }{{ end }}{{if decElemKindPtr}} - {{var "ms"}} = true {{ end }} - if {{var "mg"}} { - {{if decElemKindPtr}}{{var "mv"}}, {{var "mok"}} = {{var "v"}}[{{var "mk"}}] - if {{var "mok"}} { - {{var "ms"}} = false - } {{else}}{{var "mv"}} = {{var "v"}}[{{var "mk"}}] {{end}} - } {{if not decElemKindImmutable}}else { {{var "mv"}} = {{decElemZero}} }{{end}} - z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }}) - {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ decLineVar $x }} - if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil { + r.ReadMapElemValue() {{/* z.DecSendContainerState(codecSelfer_containerMapValue{{ .Sfx }}) */}} + {{var "mdn"}} = false + {{ $x := printf "%vmv%v" .TempVar .Rand }}{{ $y := printf "%vmdn%v" .TempVar .Rand }}{{ decLineVar $x $y }} + if {{var "mdn"}} { + if {{ var "bh" }}.DeleteOnNilMapValue { delete({{var "v"}}, {{var "mk"}}) } else { {{var "v"}}[{{var "mk"}}] = {{decElemZero}} } + } else if {{if decElemKindPtr}} {{var "ms"}} && {{end}} {{var "v"}} != nil { {{var "v"}}[{{var "mk"}}] = {{var "mv"}} } } } // else len==0: TODO: Should we clear map entries? -z.DecSendContainerState(codecSelfer_containerMapEnd{{ .Sfx }}) +r.ReadMapEnd() {{/* z.DecSendContainerState(codecSelfer_containerMapEnd{{ .Sfx }}) */}} ` const genDecListTmpl = ` @@ -82,94 +68,66 @@ if {{var "l"}} == 0 { {{var "v"}} = make({{ .CTyp }}, 0) {{var "c"}} = true } {{end}} -} else if {{var "l"}} > 0 { - {{if isChan }}if {{var "v"}} == nil { - {{var "rl"}}, _ = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }}) - {{var "v"}} = make({{ .CTyp }}, {{var "rl"}}) - {{var "c"}} = true - } - for {{var "r"}} := 0; {{var "r"}} < {{var "l"}}; {{var "r"}}++ { - {{var "h"}}.ElemContainerState({{var "r"}}) - var {{var "t"}} {{ .Typ }} - {{ $x := printf "%st%s" .TempVar .Rand }}{{ decLineVar $x }} - {{var "v"}} <- {{var "t"}} - } - {{ else }} var {{var "rr"}}, {{var "rl"}} int {{/* // num2read, length of slice/array/chan */}} - var {{var "rt"}} bool {{/* truncated */}} - _, _ = {{var "rl"}}, {{var "rt"}} - {{var "rr"}} = {{var "l"}} // len({{var "v"}}) +} else { + {{var "hl"}} := {{var "l"}} > 0 + var {{var "rl"}} int; _ = {{var "rl"}} + {{if isSlice }} if {{var "hl"}} { if {{var "l"}} > cap({{var "v"}}) { - {{if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "l"}}) - {{ else }}{{if not .Immutable }} - {{var "rg"}} := len({{var "v"}}) > 0 - {{var "v2"}} := {{var "v"}} {{end}} - {{var "rl"}}, {{var "rt"}} = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }}) - if {{var "rt"}} { - if {{var "rl"}} <= cap({{var "v"}}) { - {{var "v"}} = {{var "v"}}[:{{var "rl"}}] - } else { - {{var "v"}} = make([]{{ .Typ }}, {{var "rl"}}) - } + {{var "rl"}} = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }}) + if {{var "rl"}} <= cap({{var "v"}}) { + {{var "v"}} = {{var "v"}}[:{{var "rl"}}] } else { {{var "v"}} = make([]{{ .Typ }}, {{var "rl"}}) } {{var "c"}} = true - {{var "rr"}} = len({{var "v"}}) {{if not .Immutable }} - if {{var "rg"}} { copy({{var "v"}}, {{var "v2"}}) } {{end}} {{end}}{{/* end not Immutable, isArray */}} - } {{if isSlice }} else if {{var "l"}} != len({{var "v"}}) { + } else if {{var "l"}} != len({{var "v"}}) { {{var "v"}} = {{var "v"}}[:{{var "l"}}] {{var "c"}} = true - } {{end}} {{/* end isSlice:47 */}} - {{var "j"}} := 0 - for ; {{var "j"}} < {{var "rr"}} ; {{var "j"}}++ { - {{var "h"}}.ElemContainerState({{var "j"}}) - {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }} } - {{if isArray }}for ; {{var "j"}} < {{var "l"}} ; {{var "j"}}++ { + } {{end}} + var {{var "j"}} int + // var {{var "dn"}} bool + for ; ({{var "hl"}} && {{var "j"}} < {{var "l"}}) || !({{var "hl"}} || r.CheckBreak()); {{var "j"}}++ { + {{if not isArray}} if {{var "j"}} == 0 && len({{var "v"}}) == 0 { + if {{var "hl"}} { + {{var "rl"}} = z.DecInferLen({{var "l"}}, z.DecBasicHandle().MaxInitLen, {{ .Size }}) + } else { + {{var "rl"}} = 8 + } + {{var "v"}} = make([]{{ .Typ }}, {{var "rl"}}) + {{var "c"}} = true + }{{end}} {{var "h"}}.ElemContainerState({{var "j"}}) - z.DecSwallow() - } - {{ else }}if {{var "rt"}} { - for ; {{var "j"}} < {{var "l"}} ; {{var "j"}}++ { - {{var "v"}} = append({{var "v"}}, {{ zero}}) - {{var "h"}}.ElemContainerState({{var "j"}}) - {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }} - } - } {{end}} {{/* end isArray:56 */}} - {{end}} {{/* end isChan:16 */}} -} else { {{/* len < 0 */}} - {{var "j"}} := 0 - for ; !r.CheckBreak(); {{var "j"}}++ { - {{if isChan }} - {{var "h"}}.ElemContainerState({{var "j"}}) - var {{var "t"}} {{ .Typ }} - {{ $x := printf "%st%s" .TempVar .Rand }}{{ decLineVar $x }} - {{var "v"}} <- {{var "t"}} - {{ else }} + {{/* {{var "dn"}} = r.TryDecodeAsNil() */}} + {{if isChan}}{{ $x := printf "%[1]vv%[2]v" .TempVar .Rand }}var {{var $x}} {{ .Typ }} + {{ decLineVar $x }} + {{var "v"}} <- {{ $x }} + {{else}} + // if indefinite, etc, then expand the slice if necessary + var {{var "db"}} bool if {{var "j"}} >= len({{var "v"}}) { - {{if isArray }}z.DecArrayCannotExpand(len({{var "v"}}), {{var "j"}}+1) - {{ else }}{{var "v"}} = append({{var "v"}}, {{zero}})// var {{var "z"}} {{ .Typ }} - {{var "c"}} = true {{end}} + {{if isSlice }} {{var "v"}} = append({{var "v"}}, {{ zero }}); {{var "c"}} = true + {{else}} z.DecArrayCannotExpand(len(v), {{var "j"}}+1); {{var "db"}} = true + {{end}} } - {{var "h"}}.ElemContainerState({{var "j"}}) - if {{var "j"}} < len({{var "v"}}) { - {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }} - } else { + if {{var "db"}} { z.DecSwallow() + } else { + {{ $x := printf "%[1]vv%[2]v[%[1]vj%[2]v]" .TempVar .Rand }}{{ decLineVar $x }} } - {{end}} + {{end}} } - {{if isSlice }}if {{var "j"}} < len({{var "v"}}) { + {{if isSlice}} if {{var "j"}} < len({{var "v"}}) { {{var "v"}} = {{var "v"}}[:{{var "j"}}] {{var "c"}} = true } else if {{var "j"}} == 0 && {{var "v"}} == nil { - {{var "v"}} = []{{ .Typ }}{} + {{var "v"}} = make([]{{ .Typ }}, 0) {{var "c"}} = true - }{{end}} + } {{end}} } {{var "h"}}.End() {{if not isArray }}if {{var "c"}} { *{{ .Varname }} = {{var "v"}} }{{end}} -` +` diff --git a/vendor/github.com/ugorji/go/codec/gen.go b/vendor/github.com/ugorji/go/codec/gen.go index da66921a6..d1dcdab32 100644 --- a/vendor/github.com/ugorji/go/codec/gen.go +++ b/vendor/github.com/ugorji/go/codec/gen.go @@ -1,4 +1,6 @@ -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// +build codecgen.exec + +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -28,7 +30,6 @@ import ( // codecgen supports the full cycle of reflection-based codec: // - RawExt // - Raw -// - Builtins // - Extensions // - (Binary|Text|JSON)(Unm|M)arshal // - generic by-kind @@ -80,6 +81,10 @@ import ( // Note: // It was a conscious decision to have gen.go always explicitly call EncodeNil or TryDecodeAsNil. // This way, there isn't a function call overhead just to see that we should not enter a block of code. +// +// Note: +// codecgen-generated code depends on the variables defined by fast-path.generated.go. +// consequently, you cannot run with tags "codecgen notfastpath". // GenVersion is the current version of codecgen. // @@ -94,7 +99,10 @@ import ( // changes in signature of some unpublished helper methods and codecgen cmdline arguments. // v4: Removed separator support from (en|de)cDriver, and refactored codec(gen) // v5: changes to support faster json decoding. Let encoder/decoder maintain state of collections. -const GenVersion = 5 +// v6: removed unsafe from gen, and now uses codecgen.exec tag +// v7: +// v8: current - we now maintain compatibility with old generated code. +const genVersion = 8 const ( genCodecPkg = "codec1978" @@ -122,13 +130,27 @@ const ( ) var ( - genAllTypesSamePkgErr = errors.New("All types must be in the same package") - genExpectArrayOrMapErr = errors.New("unexpected type. Expecting array/map/slice") - genBase64enc = base64.NewEncoding("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789__") - genQNameRegex = regexp.MustCompile(`[A-Za-z_.]+`) - genCheckVendor bool + errGenAllTypesSamePkg = errors.New("All types must be in the same package") + errGenExpectArrayOrMap = errors.New("unexpected type. Expecting array/map/slice") + + genBase64enc = base64.NewEncoding("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789__") + genQNameRegex = regexp.MustCompile(`[A-Za-z_.]+`) ) +type genBuf struct { + buf []byte +} + +func (x *genBuf) s(s string) *genBuf { x.buf = append(x.buf, s...); return x } +func (x *genBuf) b(s []byte) *genBuf { x.buf = append(x.buf, s...); return x } +func (x *genBuf) v() string { return string(x.buf) } +func (x *genBuf) f(s string, args ...interface{}) { x.s(fmt.Sprintf(s, args...)) } +func (x *genBuf) reset() { + if x.buf != nil { + x.buf = x.buf[:0] + } +} + // genRunner holds some state used during a Gen run. type genRunner struct { w io.Writer // output @@ -147,8 +169,7 @@ type genRunner struct { is map[reflect.Type]struct{} // types seen during import search bp string // base PkgPath, for which we are generating for - cpfx string // codec package prefix - unsafe bool // is unsafe to be used in generated code? + cpfx string // codec package prefix tm map[reflect.Type]struct{} // types for which enc/dec must be generated ts []reflect.Type // types for which enc/dec must be generated @@ -158,13 +179,16 @@ type genRunner struct { ti *TypeInfos // rr *rand.Rand // random generator for file-specific types + + nx bool // no extensions } // Gen will write a complete go file containing Selfer implementations for each // type passed. All the types must be in the same package. // -// Library users: *DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINOUSLY WITHOUT NOTICE.* -func Gen(w io.Writer, buildTags, pkgName, uid string, useUnsafe bool, ti *TypeInfos, typ ...reflect.Type) { +// Library users: DO NOT USE IT DIRECTLY. IT WILL CHANGE CONTINUOUSLY WITHOUT NOTICE. +func Gen(w io.Writer, buildTags, pkgName, uid string, noExtensions bool, + ti *TypeInfos, typ ...reflect.Type) { // All types passed to this method do not have a codec.Selfer method implemented directly. // codecgen already checks the AST and skips any types that define the codec.Selfer methods. // Consequently, there's no need to check and trim them if they implement codec.Selfer @@ -173,19 +197,19 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, useUnsafe bool, ti *TypeIn return } x := genRunner{ - unsafe: useUnsafe, - w: w, - t: typ, - te: make(map[uintptr]bool), - td: make(map[uintptr]bool), - im: make(map[string]reflect.Type), - imn: make(map[string]string), - is: make(map[reflect.Type]struct{}), - tm: make(map[reflect.Type]struct{}), - ts: []reflect.Type{}, - bp: genImportPath(typ[0]), - xs: uid, - ti: ti, + w: w, + t: typ, + te: make(map[uintptr]bool), + td: make(map[uintptr]bool), + im: make(map[string]reflect.Type), + imn: make(map[string]string), + is: make(map[reflect.Type]struct{}), + tm: make(map[reflect.Type]struct{}), + ts: []reflect.Type{}, + bp: genImportPath(typ[0]), + xs: uid, + ti: ti, + nx: noExtensions, } if x.ti == nil { x.ti = defTypeInfos @@ -201,7 +225,7 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, useUnsafe bool, ti *TypeIn for _, t := range typ { // fmt.Printf("###########: PkgPath: '%v', Name: '%s'\n", genImportPath(t), t.Name()) if genImportPath(t) != x.bp { - panic(genAllTypesSamePkgErr) + panic(errGenAllTypesSamePkg) } x.genRefPkgs(t) } @@ -211,10 +235,7 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, useUnsafe bool, ti *TypeIn } x.line(` -// ************************************************************ -// DO NOT EDIT. -// THIS FILE IS AUTO-GENERATED BY codecgen. -// ************************************************************ +// Code generated by codecgen - DO NOT EDIT. `) x.line("package " + pkgName) @@ -226,19 +247,20 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, useUnsafe bool, ti *TypeIn } // use a sorted set of im keys, so that we can get consistent output imKeys := make([]string, 0, len(x.im)) - for k, _ := range x.im { + for k := range x.im { imKeys = append(imKeys, k) } sort.Strings(imKeys) for _, k := range imKeys { // for k, _ := range x.im { - x.linef("%s \"%s\"", x.imn[k], k) + if k == x.imn[k] { + x.linef("\"%s\"", k) + } else { + x.linef("%s \"%s\"", x.imn[k], k) + } } // add required packages - for _, k := range [...]string{"reflect", "unsafe", "runtime", "fmt", "errors"} { + for _, k := range [...]string{"runtime", "errors", "strconv"} { // "reflect", "fmt" if _, ok := x.im[k]; !ok { - if k == "unsafe" && !x.unsafe { - continue - } x.line("\"" + k + "\"") } } @@ -247,41 +269,36 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, useUnsafe bool, ti *TypeIn x.line("const (") x.linef("// ----- content types ----") - x.linef("codecSelferC_UTF8%s = %v", x.xs, int64(c_UTF8)) - x.linef("codecSelferC_RAW%s = %v", x.xs, int64(c_RAW)) + x.linef("codecSelferCcUTF8%s = %v", x.xs, int64(cUTF8)) + x.linef("codecSelferCcRAW%s = %v", x.xs, int64(cRAW)) x.linef("// ----- value types used ----") - x.linef("codecSelferValueTypeArray%s = %v", x.xs, int64(valueTypeArray)) - x.linef("codecSelferValueTypeMap%s = %v", x.xs, int64(valueTypeMap)) - x.linef("// ----- containerStateValues ----") - x.linef("codecSelfer_containerMapKey%s = %v", x.xs, int64(containerMapKey)) - x.linef("codecSelfer_containerMapValue%s = %v", x.xs, int64(containerMapValue)) - x.linef("codecSelfer_containerMapEnd%s = %v", x.xs, int64(containerMapEnd)) - x.linef("codecSelfer_containerArrayElem%s = %v", x.xs, int64(containerArrayElem)) - x.linef("codecSelfer_containerArrayEnd%s = %v", x.xs, int64(containerArrayEnd)) + for _, vt := range [...]valueType{ + valueTypeArray, valueTypeMap, valueTypeString, + valueTypeInt, valueTypeUint, valueTypeFloat} { + x.linef("codecSelferValueType%s%s = %v", vt.String(), x.xs, int64(vt)) + } + + x.linef("codecSelferBitsize%s = uint8(32 << (^uint(0) >> 63))", x.xs) x.line(")") x.line("var (") - x.line("codecSelferBitsize" + x.xs + " = uint8(reflect.TypeOf(uint(0)).Bits())") - x.line("codecSelferOnlyMapOrArrayEncodeToStructErr" + x.xs + " = errors.New(`only encoded map or array can be decoded into a struct`)") + x.line("errCodecSelferOnlyMapOrArrayEncodeToStruct" + x.xs + " = errors.New(`only encoded map or array can be decoded into a struct`)") x.line(")") x.line("") - if x.unsafe { - x.line("type codecSelferUnsafeString" + x.xs + " struct { Data uintptr; Len int}") - x.line("") - } x.hn = "codecSelfer" + x.xs x.line("type " + x.hn + " struct{}") x.line("") x.varsfxreset() x.line("func init() {") - x.linef("if %sGenVersion != %v {", x.cpfx, GenVersion) + x.linef("if %sGenVersion != %v {", x.cpfx, genVersion) x.line("_, file, _, _ := runtime.Caller(0)") - x.line(`err := fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", `) - x.linef(`%v, %sGenVersion, file)`, GenVersion, x.cpfx) - x.line("panic(err)") + x.outf(`panic("codecgen version mismatch: current: %v, need " + strconv.FormatInt(int64(%sGenVersion), 10) + ". Re-generate file: " + file)`, genVersion, x.cpfx) + // x.out(`panic(fmt.Errorf("codecgen version mismatch: current: %v, need %v. Re-generate file: %v", `) + // x.linef(`%v, %sGenVersion, file))`, genVersion, x.cpfx) x.linef("}") x.line("if false { // reference the types, but skip this branch at build/run time") + // x.line("_ = strconv.ParseInt") var n int // for k, t := range x.im { for _, k := range imKeys { @@ -289,10 +306,6 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, useUnsafe bool, ti *TypeIn x.linef("var v%v %s.%s", n, x.imn[k], t.Name()) n++ } - if x.unsafe { - x.linef("var v%v unsafe.Pointer", n) - n++ - } if n > 0 { x.out("_") for i := 1; i < n; i++ { @@ -315,7 +328,7 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, useUnsafe bool, ti *TypeIn } for _, t := range x.ts { - rtid := reflect.ValueOf(t).Pointer() + rtid := rt2id(t) // generate enc functions for all these slice/map types. x.varsfxreset() x.linef("func (x %s) enc%s(v %s%s, e *%sEncoder) {", x.hn, x.genMethodNameT(t), x.arr2str(t, "*"), x.genTypeName(t), x.cpfx) @@ -326,7 +339,7 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, useUnsafe bool, ti *TypeIn case reflect.Map: x.encMapFallback("v", t) default: - panic(genExpectArrayOrMapErr) + panic(errGenExpectArrayOrMap) } x.line("}") x.line("") @@ -341,7 +354,7 @@ func Gen(w io.Writer, buildTags, pkgName, uid string, useUnsafe bool, ti *TypeIn case reflect.Map: x.decMapFallback("v", rtid, t) default: - panic(genExpectArrayOrMapErr) + panic(errGenExpectArrayOrMap) } x.line("}") x.line("") @@ -377,7 +390,6 @@ func (x *genRunner) genRefPkgs(t reflect.Type) { if _, ok := x.is[t]; ok { return } - // fmt.Printf(">>>>>>: PkgPath: '%v', Name: '%s'\n", genImportPath(t), t.Name()) x.is[t] = struct{}{} tpkg, tname := genImportPath(t), t.Name() if tpkg != "" && tpkg != x.bp && tpkg != x.cp && tname != "" && tname[0] >= 'A' && tname[0] <= 'Z' { @@ -406,13 +418,6 @@ func (x *genRunner) genRefPkgs(t reflect.Type) { } } -func (x *genRunner) line(s string) { - x.out(s) - if len(s) == 0 || s[len(s)-1] != '\n' { - x.out("\n") - } -} - func (x *genRunner) varsfx() string { x.c++ return strconv.FormatUint(x.c, 10) @@ -423,17 +428,31 @@ func (x *genRunner) varsfxreset() { } func (x *genRunner) out(s string) { - if _, err := io.WriteString(x.w, s); err != nil { + _, err := io.WriteString(x.w, s) + if err != nil { panic(err) } } -func (x *genRunner) linef(s string, params ...interface{}) { - x.line(fmt.Sprintf(s, params...)) +func (x *genRunner) outf(s string, params ...interface{}) { + _, err := fmt.Fprintf(x.w, s, params...) + if err != nil { + panic(err) + } } -func (x *genRunner) outf(s string, params ...interface{}) { - x.out(fmt.Sprintf(s, params...)) +func (x *genRunner) line(s string) { + x.out(s) + if len(s) == 0 || s[len(s)-1] != '\n' { + x.out("\n") + } +} + +func (x *genRunner) linef(s string, params ...interface{}) { + x.outf(s, params...) + if len(s) == 0 || s[len(s)-1] != '\n' { + x.out("\n") + } } func (x *genRunner) genTypeName(t reflect.Type) (n string) { @@ -506,16 +525,17 @@ func (x *genRunner) selfer(encode bool) { t := x.tc t0 := t // always make decode use a pointer receiver, - // and structs always use a ptr receiver (encode|decode) - isptr := !encode || t.Kind() == reflect.Struct + // and structs/arrays always use a ptr receiver (encode|decode) + isptr := !encode || t.Kind() == reflect.Array || (t.Kind() == reflect.Struct && t != timeTyp) x.varsfxreset() - fnSigPfx := "func (x " + + fnSigPfx := "func (" + genTopLevelVarName + " " if isptr { fnSigPfx += "*" } fnSigPfx += x.genTypeName(t) - x.out(fnSigPfx) + if isptr { t = reflect.PtrTo(t) } @@ -531,7 +551,7 @@ func (x *genRunner) selfer(encode bool) { // or way to elegantly handle that, and also setting it to a // non-nil value doesn't affect the pointer passed. // x.decVar(genTopLevelVarName, t, false) - x.dec(genTopLevelVarName, t0) + x.dec(genTopLevelVarName, t0, true) } x.line("}") x.line("") @@ -545,21 +565,21 @@ func (x *genRunner) selfer(encode bool) { x.out(fnSigPfx) x.line(") codecDecodeSelfFromMap(l int, d *" + x.cpfx + "Decoder) {") x.genRequiredMethodVars(false) - x.decStructMap(genTopLevelVarName, "l", reflect.ValueOf(t0).Pointer(), t0, genStructMapStyleConsolidated) + x.decStructMap(genTopLevelVarName, "l", rt2id(t0), t0, genStructMapStyleConsolidated) x.line("}") x.line("") } else { x.out(fnSigPfx) x.line(") codecDecodeSelfFromMapLenPrefix(l int, d *" + x.cpfx + "Decoder) {") x.genRequiredMethodVars(false) - x.decStructMap(genTopLevelVarName, "l", reflect.ValueOf(t0).Pointer(), t0, genStructMapStyleLenPrefix) + x.decStructMap(genTopLevelVarName, "l", rt2id(t0), t0, genStructMapStyleLenPrefix) x.line("}") x.line("") x.out(fnSigPfx) x.line(") codecDecodeSelfFromMapCheckBreak(l int, d *" + x.cpfx + "Decoder) {") x.genRequiredMethodVars(false) - x.decStructMap(genTopLevelVarName, "l", reflect.ValueOf(t0).Pointer(), t0, genStructMapStyleCheckBreak) + x.decStructMap(genTopLevelVarName, "l", rt2id(t0), t0, genStructMapStyleCheckBreak) x.line("}") x.line("") } @@ -568,18 +588,24 @@ func (x *genRunner) selfer(encode bool) { x.out(fnSigPfx) x.line(") codecDecodeSelfFromArray(l int, d *" + x.cpfx + "Decoder) {") x.genRequiredMethodVars(false) - x.decStructArray(genTopLevelVarName, "l", "return", reflect.ValueOf(t0).Pointer(), t0) + x.decStructArray(genTopLevelVarName, "l", "return", rt2id(t0), t0) x.line("}") x.line("") } // used for chan, array, slice, map -func (x *genRunner) xtraSM(varname string, encode bool, t reflect.Type) { - if encode { - x.linef("h.enc%s((%s%s)(%s), e)", x.genMethodNameT(t), x.arr2str(t, "*"), x.genTypeName(t), varname) +func (x *genRunner) xtraSM(varname string, t reflect.Type, encode, isptr bool) { + var ptrPfx, addrPfx string + if isptr { + ptrPfx = "*" } else { - x.linef("h.dec%s((*%s)(%s), d)", x.genMethodNameT(t), x.genTypeName(t), varname) + addrPfx = "&" + } + if encode { + x.linef("h.enc%s((%s%s)(%s), e)", x.genMethodNameT(t), ptrPfx, x.genTypeName(t), varname) + } else { + x.linef("h.dec%s((*%s)(%s%s), d)", x.genMethodNameT(t), x.genTypeName(t), addrPfx, varname) } x.registerXtraT(t) } @@ -618,17 +644,23 @@ func (x *genRunner) encVar(varname string, t reflect.Type) { if checkNil { x.linef("if %s == nil { r.EncodeNil() } else { ", varname) } + switch t.Kind() { case reflect.Ptr: - switch t.Elem().Kind() { - case reflect.Struct, reflect.Array: + telem := t.Elem() + tek := telem.Kind() + if tek == reflect.Array || (tek == reflect.Struct && t != timeTyp) { x.enc(varname, genNonPtr(t)) - default: - i := x.varsfx() - x.line(genTempVarPfx + i + " := *" + varname) - x.enc(genTempVarPfx+i, genNonPtr(t)) + break } + i := x.varsfx() + x.line(genTempVarPfx + i + " := *" + varname) + x.enc(genTempVarPfx+i, genNonPtr(t)) case reflect.Struct, reflect.Array: + if t == timeTyp { + x.enc(varname, t) + break + } i := x.varsfx() x.line(genTempVarPfx + i + " := &" + varname) x.enc(genTempVarPfx+i, t) @@ -642,29 +674,33 @@ func (x *genRunner) encVar(varname string, t reflect.Type) { } -// enc will encode a variable (varname) of type t, -// except t is of kind reflect.Struct or reflect.Array, wherein varname is of type ptrTo(T) (to prevent copying) +// enc will encode a variable (varname) of type t, where t represents T. +// if t is !time.Time and t is of kind reflect.Struct or reflect.Array, varname is of type *T +// (to prevent copying), +// else t is of type T func (x *genRunner) enc(varname string, t reflect.Type) { - rtid := reflect.ValueOf(t).Pointer() + rtid := rt2id(t) + ti2 := x.ti.get(rtid, t) // We call CodecEncodeSelf if one of the following are honored: // - the type already implements Selfer, call that // - the type has a Selfer implementation just created, use that // - the type is in the list of the ones we will generate for, but it is not currently being generated mi := x.varsfx() - tptr := reflect.PtrTo(t) + // tptr := reflect.PtrTo(t) tk := t.Kind() if x.checkForSelfer(t, varname) { - if tk == reflect.Array || tk == reflect.Struct { // varname is of type *T - if tptr.Implements(selferTyp) || t.Implements(selferTyp) { + if tk == reflect.Array || (tk == reflect.Struct && rtid != timeTypId) { // varname is of type *T + // if tptr.Implements(selferTyp) || t.Implements(selferTyp) { + if ti2.isFlag(typeInfoFlagIsZeroerPtr) || ti2.isFlag(typeInfoFlagIsZeroer) { x.line(varname + ".CodecEncodeSelf(e)") return } } else { // varname is of type T - if t.Implements(selferTyp) { + if ti2.cs { // t.Implements(selferTyp) { x.line(varname + ".CodecEncodeSelf(e)") return - } else if tptr.Implements(selferTyp) { + } else if ti2.csp { // tptr.Implements(selferTyp) { x.linef("%ssf%s := &%s", genTempVarPfx, mi, varname) x.linef("%ssf%s.CodecEncodeSelf(e)", genTempVarPfx, mi) return @@ -696,57 +732,53 @@ func (x *genRunner) enc(varname string, t reflect.Type) { } // check if - // - type is RawExt, Raw + // - type is time.Time, RawExt, Raw // - the type implements (Text|JSON|Binary)(Unm|M)arshal - x.linef("%sm%s := z.EncBinary()", genTempVarPfx, mi) - x.linef("_ = %sm%s", genTempVarPfx, mi) + x.line("if false {") //start if block defer func() { x.line("}") }() //end if block + if t == timeTyp { + x.linef("} else { r.EncodeTime(%s)", varname) + return + } if t == rawTyp { - x.linef("} else { z.EncRaw(%v)", varname) + x.linef("} else { z.EncRaw(%s)", varname) return } if t == rawExtTyp { - x.linef("} else { r.EncodeRawExt(%v, e)", varname) + x.linef("} else { r.EncodeRawExt(%s, e)", varname) return } - // HACK: Support for Builtins. - // Currently, only Binc supports builtins, and the only builtin type is time.Time. - // Have a method that returns the rtid for time.Time if Handle is Binc. - if t == timeTyp { - vrtid := genTempVarPfx + "m" + x.varsfx() - x.linef("} else if %s := z.TimeRtidIfBinc(); %s != 0 { ", vrtid, vrtid) - x.linef("r.EncodeBuiltin(%s, %s)", vrtid, varname) - } // only check for extensions if the type is named, and has a packagePath. - if genImportPath(t) != "" && t.Name() != "" { - // first check if extensions are configued, before doing the interface conversion - x.linef("} else if z.HasExtensions() && z.EncExt(%s) {", varname) + var arrayOrStruct = tk == reflect.Array || tk == reflect.Struct // meaning varname if of type *T + if !x.nx && genImportPath(t) != "" && t.Name() != "" { + yy := fmt.Sprintf("%sxt%s", genTempVarPfx, mi) + x.linef("} else if %s := z.Extension(z.I2Rtid(%s)); %s != nil { z.EncExtension(%s, %s) ", yy, varname, yy, varname, yy) } - if tk == reflect.Array || tk == reflect.Struct { // varname is of type *T - if t.Implements(binaryMarshalerTyp) || tptr.Implements(binaryMarshalerTyp) { - x.linef("} else if %sm%s { z.EncBinaryMarshal(%v) ", genTempVarPfx, mi, varname) + if arrayOrStruct { // varname is of type *T + if ti2.bm || ti2.bmp { // t.Implements(binaryMarshalerTyp) || tptr.Implements(binaryMarshalerTyp) { + x.linef("} else if z.EncBinary() { z.EncBinaryMarshal(%v) ", varname) } - if t.Implements(jsonMarshalerTyp) || tptr.Implements(jsonMarshalerTyp) { - x.linef("} else if !%sm%s && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", genTempVarPfx, mi, varname) - } else if t.Implements(textMarshalerTyp) || tptr.Implements(textMarshalerTyp) { - x.linef("} else if !%sm%s { z.EncTextMarshal(%v) ", genTempVarPfx, mi, varname) + if ti2.jm || ti2.jmp { // t.Implements(jsonMarshalerTyp) || tptr.Implements(jsonMarshalerTyp) { + x.linef("} else if !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", varname) + } else if ti2.tm || ti2.tmp { // t.Implements(textMarshalerTyp) || tptr.Implements(textMarshalerTyp) { + x.linef("} else if !z.EncBinary() { z.EncTextMarshal(%v) ", varname) } } else { // varname is of type T - if t.Implements(binaryMarshalerTyp) { - x.linef("} else if %sm%s { z.EncBinaryMarshal(%v) ", genTempVarPfx, mi, varname) - } else if tptr.Implements(binaryMarshalerTyp) { - x.linef("} else if %sm%s { z.EncBinaryMarshal(&%v) ", genTempVarPfx, mi, varname) + if ti2.bm { // t.Implements(binaryMarshalerTyp) { + x.linef("} else if z.EncBinary() { z.EncBinaryMarshal(%v) ", varname) + } else if ti2.bmp { // tptr.Implements(binaryMarshalerTyp) { + x.linef("} else if z.EncBinary() { z.EncBinaryMarshal(&%v) ", varname) } - if t.Implements(jsonMarshalerTyp) { - x.linef("} else if !%sm%s && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", genTempVarPfx, mi, varname) - } else if tptr.Implements(jsonMarshalerTyp) { - x.linef("} else if !%sm%s && z.IsJSONHandle() { z.EncJSONMarshal(&%v) ", genTempVarPfx, mi, varname) - } else if t.Implements(textMarshalerTyp) { - x.linef("} else if !%sm%s { z.EncTextMarshal(%v) ", genTempVarPfx, mi, varname) - } else if tptr.Implements(textMarshalerTyp) { - x.linef("} else if !%sm%s { z.EncTextMarshal(&%v) ", genTempVarPfx, mi, varname) + if ti2.jm { // t.Implements(jsonMarshalerTyp) { + x.linef("} else if !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(%v) ", varname) + } else if ti2.jmp { // tptr.Implements(jsonMarshalerTyp) { + x.linef("} else if !z.EncBinary() && z.IsJSONHandle() { z.EncJSONMarshal(&%v) ", varname) + } else if ti2.tm { // t.Implements(textMarshalerTyp) { + x.linef("} else if !z.EncBinary() { z.EncTextMarshal(%v) ", varname) + } else if ti2.tmp { // tptr.Implements(textMarshalerTyp) { + x.linef("} else if !z.EncBinary() { z.EncTextMarshal(&%v) ", varname) } } x.line("} else {") @@ -763,12 +795,12 @@ func (x *genRunner) enc(varname string, t reflect.Type) { case reflect.Bool: x.line("r.EncodeBool(bool(" + varname + "))") case reflect.String: - x.line("r.EncodeString(codecSelferC_UTF8" + x.xs + ", string(" + varname + "))") + x.line("r.EncodeString(codecSelferCcUTF8" + x.xs + ", string(" + varname + "))") case reflect.Chan: - x.xtraSM(varname, true, t) + x.xtraSM(varname, t, true, false) // x.encListFallback(varname, rtid, t) case reflect.Array: - x.xtraSM(varname, true, t) + x.xtraSM(varname, t, true, true) case reflect.Slice: // if nil, call dedicated function // if a []uint8, call dedicated function @@ -777,12 +809,12 @@ func (x *genRunner) enc(varname string, t reflect.Type) { // - if elements are primitives or Selfers, call dedicated function on each member. // - else call Encoder.encode(XXX) on it. if rtid == uint8SliceTypId { - x.line("r.EncodeStringBytes(codecSelferC_RAW" + x.xs + ", []byte(" + varname + "))") + x.line("r.EncodeStringBytes(codecSelferCcRAW" + x.xs + ", []byte(" + varname + "))") } else if fastpathAV.index(rtid) != -1 { g := x.newGenV(t) - x.line("z.F." + g.MethodNamePfx("Enc", false) + "V(" + varname + ", false, e)") + x.line("z.F." + g.MethodNamePfx("Enc", false) + "V(" + varname + ", e)") } else { - x.xtraSM(varname, true, t) + x.xtraSM(varname, t, true, false) // x.encListFallback(varname, rtid, t) } case reflect.Map: @@ -794,9 +826,9 @@ func (x *genRunner) enc(varname string, t reflect.Type) { // x.line("if " + varname + " == nil { \nr.EncodeNil()\n } else { ") if fastpathAV.index(rtid) != -1 { g := x.newGenV(t) - x.line("z.F." + g.MethodNamePfx("Enc", false) + "V(" + varname + ", false, e)") + x.line("z.F." + g.MethodNamePfx("Enc", false) + "V(" + varname + ", e)") } else { - x.xtraSM(varname, true, t) + x.xtraSM(varname, t, true, false) // x.encMapFallback(varname, rtid, t) } case reflect.Struct: @@ -827,12 +859,53 @@ func (x *genRunner) encZero(t reflect.Type) { case reflect.Bool: x.line("r.EncodeBool(false)") case reflect.String: - x.line("r.EncodeString(codecSelferC_UTF8" + x.xs + `, "")`) + x.line("r.EncodeString(codecSelferCcUTF8" + x.xs + `, "")`) default: x.line("r.EncodeNil()") } } +func (x *genRunner) encOmitEmptyLine(t2 reflect.StructField, varname string, buf *genBuf) { + // smartly check omitEmpty on a struct type, as it may contain uncomparable map/slice/etc. + // also, for maps/slices/arrays, check if len ! 0 (not if == zero value) + varname2 := varname + "." + t2.Name + switch t2.Type.Kind() { + case reflect.Struct: + rtid2 := rt2id(t2.Type) + ti2 := x.ti.get(rtid2, t2.Type) + // fmt.Printf(">>>> structfield: omitempty: type: %s, field: %s\n", t2.Type.Name(), t2.Name) + if ti2.rtid == timeTypId { + buf.s("!(").s(varname2).s(".IsZero())") + break + } + if ti2.isFlag(typeInfoFlagIsZeroerPtr) || ti2.isFlag(typeInfoFlagIsZeroer) { + buf.s("!(").s(varname2).s(".IsZero())") + break + } + if ti2.isFlag(typeInfoFlagComparable) { + buf.s(varname2).s(" != ").s(x.genZeroValueR(t2.Type)) + break + } + // buf.s("(") + buf.s("false") + for i, n := 0, t2.Type.NumField(); i < n; i++ { + f := t2.Type.Field(i) + if f.PkgPath != "" { // unexported + continue + } + buf.s(" || ") + x.encOmitEmptyLine(f, varname2, buf) + } + //buf.s(")") + case reflect.Bool: + buf.s(varname2) + case reflect.Map, reflect.Slice, reflect.Array, reflect.Chan: + buf.s("len(").s(varname2).s(") != 0") + default: + buf.s(varname2).s(" != ").s(x.genZeroValueR(t2.Type)) + } +} + func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) { // Use knowledge from structfieldinfo (mbs, encodable fields. Ignore omitempty. ) // replicate code in kStruct i.e. for each field, deref type to non-pointer, and call x.enc on it @@ -847,60 +920,71 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) { x.line(sepVarname + " := !z.EncBinary()") x.linef("%s := z.EncBasicHandle().StructToArray", struct2arrvar) - tisfi := ti.sfip // always use sequence from file. decStruct expects same thing. + x.linef("_, _ = %s, %s", sepVarname, struct2arrvar) + x.linef("const %s bool = %v // struct tag has 'toArray'", ti2arrayvar, ti.toArray) + + tisfi := ti.sfiSrc // always use sequence from file. decStruct expects same thing. + + // var nn int // due to omitEmpty, we need to calculate the // number of non-empty things we write out first. // This is required as we need to pre-determine the size of the container, // to support length-prefixing. - x.linef("var %s [%v]bool", numfieldsvar, len(tisfi)) - x.linef("_, _, _ = %s, %s, %s", sepVarname, numfieldsvar, struct2arrvar) - x.linef("const %s bool = %v", ti2arrayvar, ti.toArray) - nn := 0 - for j, si := range tisfi { - if !si.omitEmpty { - nn++ - continue - } - var t2 reflect.StructField - var omitline string - if si.i != -1 { - t2 = t.Field(int(si.i)) - } else { - t2typ := t - varname3 := varname - for _, ix := range si.is { - for t2typ.Kind() == reflect.Ptr { - t2typ = t2typ.Elem() - } - t2 = t2typ.Field(ix) - t2typ = t2.Type - varname3 = varname3 + "." + t2.Name - if t2typ.Kind() == reflect.Ptr { - omitline += varname3 + " != nil && " + if ti.anyOmitEmpty { + x.linef("var %s = [%v]bool{ // should field at this index be written?", numfieldsvar, len(tisfi)) + + for j, si := range tisfi { + _ = j + if !si.omitEmpty() { + // x.linef("%s[%v] = true // %s", numfieldsvar, j, si.fieldName) + x.linef("true, // %s", si.fieldName) + // nn++ + continue + } + var t2 reflect.StructField + var omitline genBuf + { + t2typ := t + varname3 := varname + // go through the loop, record the t2 field explicitly, + // and gather the omit line if embedded in pointers. + for ij, ix := range si.is { + if uint8(ij) == si.nis { + break + } + for t2typ.Kind() == reflect.Ptr { + t2typ = t2typ.Elem() + } + t2 = t2typ.Field(int(ix)) + t2typ = t2.Type + varname3 = varname3 + "." + t2.Name + // do not include actual field in the omit line. + // that is done subsequently (right after - below). + if uint8(ij+1) < si.nis && t2typ.Kind() == reflect.Ptr { + omitline.s(varname3).s(" != nil && ") + } } } + x.encOmitEmptyLine(t2, varname, &omitline) + x.linef("%s, // %s", omitline.v(), si.fieldName) } - // never check omitEmpty on a struct type, as it may contain uncomparable map/slice/etc. - // also, for maps/slices/arrays, check if len ! 0 (not if == zero value) - switch t2.Type.Kind() { - case reflect.Struct: - omitline += " true" - case reflect.Map, reflect.Slice, reflect.Array, reflect.Chan: - omitline += "len(" + varname + "." + t2.Name + ") != 0" - default: - omitline += varname + "." + t2.Name + " != " + x.genZeroValueR(t2.Type) - } - x.linef("%s[%v] = %s", numfieldsvar, j, omitline) + x.line("}") + x.linef("_ = %s", numfieldsvar) } - x.linef("var %snn%s int", genTempVarPfx, i) + // x.linef("var %snn%s int", genTempVarPfx, i) x.linef("if %s || %s {", ti2arrayvar, struct2arrvar) // if ti.toArray { - x.line("r.EncodeArrayStart(" + strconv.FormatInt(int64(len(tisfi)), 10) + ")") + x.linef("r.WriteArrayStart(%d)", len(tisfi)) x.linef("} else {") // if not ti.toArray - x.linef("%snn%s = %v", genTempVarPfx, i, nn) - x.linef("for _, b := range %s { if b { %snn%s++ } }", numfieldsvar, genTempVarPfx, i) - x.linef("r.EncodeMapStart(%snn%s)", genTempVarPfx, i) - x.linef("%snn%s = %v", genTempVarPfx, i, 0) - // x.line("r.EncodeMapStart(" + strconv.FormatInt(int64(len(tisfi)), 10) + ")") + if ti.anyOmitEmpty { + // nn = 0 + // x.linef("var %snn%s = %v", genTempVarPfx, i, nn) + x.linef("var %snn%s int", genTempVarPfx, i) + x.linef("for _, b := range %s { if b { %snn%s++ } }", numfieldsvar, genTempVarPfx, i) + x.linef("r.WriteMapStart(%snn%s)", genTempVarPfx, i) + x.linef("%snn%s = %v", genTempVarPfx, i, 0) + } else { + x.linef("r.WriteMapStart(%d)", len(tisfi)) + } x.line("}") // close if not StructToArray for j, si := range tisfi { @@ -908,17 +992,17 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) { isNilVarName := genTempVarPfx + "n" + i var labelUsed bool var t2 reflect.StructField - if si.i != -1 { - t2 = t.Field(int(si.i)) - } else { + { t2typ := t varname3 := varname - for _, ix := range si.is { - // fmt.Printf("%%%% %v, ix: %v\n", t2typ, ix) + for ij, ix := range si.is { + if uint8(ij) == si.nis { + break + } for t2typ.Kind() == reflect.Ptr { t2typ = t2typ.Elem() } - t2 = t2typ.Field(ix) + t2 = t2typ.Field(int(ix)) t2typ = t2.Type varname3 = varname3 + "." + t2.Name if t2typ.Kind() == reflect.Ptr { @@ -941,14 +1025,14 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) { x.linef("if %s || %s {", ti2arrayvar, struct2arrvar) // if ti.toArray if labelUsed { - x.line("if " + isNilVarName + " { r.EncodeNil() } else { ") + x.linef("if %s { r.WriteArrayElem(); r.EncodeNil() } else { ", isNilVarName) } - x.linef("z.EncSendContainerState(codecSelfer_containerArrayElem%s)", x.xs) - if si.omitEmpty { + x.line("r.WriteArrayElem()") + if si.omitEmpty() { x.linef("if %s[%v] {", numfieldsvar, j) } x.encVar(varname+"."+t2.Name, t2.Type) - if si.omitEmpty { + if si.omitEmpty() { x.linef("} else {") x.encZero(t2.Type) x.linef("}") @@ -959,12 +1043,25 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) { x.linef("} else {") // if not ti.toArray - if si.omitEmpty { + if si.omitEmpty() { x.linef("if %s[%v] {", numfieldsvar, j) } - x.linef("z.EncSendContainerState(codecSelfer_containerMapKey%s)", x.xs) - x.line("r.EncodeString(codecSelferC_UTF8" + x.xs + ", string(\"" + si.encName + "\"))") - x.linef("z.EncSendContainerState(codecSelfer_containerMapValue%s)", x.xs) + x.line("r.WriteMapElemKey()") + + // x.line("r.EncodeString(codecSelferCcUTF8" + x.xs + ", `" + si.encName + "`)") + // emulate EncStructFieldKey + switch ti.keyType { + case valueTypeInt: + x.linef("r.EncodeInt(z.M.Int(strconv.ParseInt(`%s`, 10, 64)))", si.encName) + case valueTypeUint: + x.linef("r.EncodeUint(z.M.Uint(strconv.ParseUint(`%s`, 10, 64)))", si.encName) + case valueTypeFloat: + x.linef("r.EncodeFloat64(z.M.Float(strconv.ParseFloat(`%s`, 64)))", si.encName) + default: // string + x.linef("r.EncodeString(codecSelferCcUTF8%s, `%s`)", x.xs, si.encName) + } + // x.linef("r.EncStructFieldKey(codecSelferValueType%s%s, `%s`)", ti.keyType.String(), x.xs, si.encName) + x.line("r.WriteMapElemValue()") if labelUsed { x.line("if " + isNilVarName + " { r.EncodeNil() } else { ") x.encVar(varname+"."+t2.Name, t2.Type) @@ -972,136 +1069,197 @@ func (x *genRunner) encStruct(varname string, rtid uintptr, t reflect.Type) { } else { x.encVar(varname+"."+t2.Name, t2.Type) } - if si.omitEmpty { + if si.omitEmpty() { x.line("}") } x.linef("} ") // end if/else ti.toArray } x.linef("if %s || %s {", ti2arrayvar, struct2arrvar) // if ti.toArray { - x.linef("z.EncSendContainerState(codecSelfer_containerArrayEnd%s)", x.xs) + x.line("r.WriteArrayEnd()") x.line("} else {") - x.linef("z.EncSendContainerState(codecSelfer_containerMapEnd%s)", x.xs) + x.line("r.WriteMapEnd()") x.line("}") } func (x *genRunner) encListFallback(varname string, t reflect.Type) { if t.AssignableTo(uint8SliceTyp) { - x.linef("r.EncodeStringBytes(codecSelferC_RAW%s, []byte(%s))", x.xs, varname) + x.linef("r.EncodeStringBytes(codecSelferCcRAW%s, []byte(%s))", x.xs, varname) return } if t.Kind() == reflect.Array && t.Elem().Kind() == reflect.Uint8 { - x.linef("r.EncodeStringBytes(codecSelferC_RAW%s, ([%v]byte(%s))[:])", x.xs, t.Len(), varname) + x.linef("r.EncodeStringBytes(codecSelferCcRAW%s, ((*[%d]byte)(%s))[:])", x.xs, t.Len(), varname) return } i := x.varsfx() g := genTempVarPfx - x.line("r.EncodeArrayStart(len(" + varname + "))") + x.line("r.WriteArrayStart(len(" + varname + "))") if t.Kind() == reflect.Chan { x.linef("for %si%s, %si2%s := 0, len(%s); %si%s < %si2%s; %si%s++ {", g, i, g, i, varname, g, i, g, i, g, i) - x.linef("z.EncSendContainerState(codecSelfer_containerArrayElem%s)", x.xs) + x.line("r.WriteArrayElem()") x.linef("%sv%s := <-%s", g, i, varname) } else { - // x.linef("for %si%s, %sv%s := range %s {", genTempVarPfx, i, genTempVarPfx, i, varname) x.linef("for _, %sv%s := range %s {", genTempVarPfx, i, varname) - x.linef("z.EncSendContainerState(codecSelfer_containerArrayElem%s)", x.xs) + x.line("r.WriteArrayElem()") } x.encVar(genTempVarPfx+"v"+i, t.Elem()) x.line("}") - x.linef("z.EncSendContainerState(codecSelfer_containerArrayEnd%s)", x.xs) + x.line("r.WriteArrayEnd()") } func (x *genRunner) encMapFallback(varname string, t reflect.Type) { // TODO: expand this to handle canonical. i := x.varsfx() - x.line("r.EncodeMapStart(len(" + varname + "))") + x.line("r.WriteMapStart(len(" + varname + "))") x.linef("for %sk%s, %sv%s := range %s {", genTempVarPfx, i, genTempVarPfx, i, varname) - // x.line("for " + genTempVarPfx + "k" + i + ", " + genTempVarPfx + "v" + i + " := range " + varname + " {") - x.linef("z.EncSendContainerState(codecSelfer_containerMapKey%s)", x.xs) + x.line("r.WriteMapElemKey()") x.encVar(genTempVarPfx+"k"+i, t.Key()) - x.linef("z.EncSendContainerState(codecSelfer_containerMapValue%s)", x.xs) + x.line("r.WriteMapElemValue()") x.encVar(genTempVarPfx+"v"+i, t.Elem()) x.line("}") - x.linef("z.EncSendContainerState(codecSelfer_containerMapEnd%s)", x.xs) + x.line("r.WriteMapEnd()") } -func (x *genRunner) decVar(varname string, t reflect.Type, canBeNil bool) { +func (x *genRunner) decVarInitPtr(varname, nilvar string, t reflect.Type, si *structFieldInfo, + newbuf, nilbuf *genBuf) (t2 reflect.StructField) { + //we must accommodate anonymous fields, where the embedded field is a nil pointer in the value. + // t2 = t.FieldByIndex(si.is) + t2typ := t + varname3 := varname + t2kind := t2typ.Kind() + var nilbufed bool + if si != nil { + for ij, ix := range si.is { + if uint8(ij) == si.nis { + break + } + for t2typ.Kind() == reflect.Ptr { + t2typ = t2typ.Elem() + } + t2 = t2typ.Field(int(ix)) + t2typ = t2.Type + varname3 = varname3 + "." + t2.Name + t2kind = t2typ.Kind() + if t2kind != reflect.Ptr { + continue + } + if newbuf != nil { + newbuf.f("if %s == nil { %s = new(%s) }\n", varname3, varname3, x.genTypeName(t2typ.Elem())) + } + if nilbuf != nil { + if !nilbufed { + nilbuf.s("if true") + nilbufed = true + } + nilbuf.s(" && ").s(varname3).s(" != nil") + } + } + } + // if t2typ.Kind() == reflect.Ptr { + // varname3 = varname3 + t2.Name + // } + if nilbuf != nil { + if nilbufed { + nilbuf.s(" { ") + } + if nilvar != "" { + nilbuf.s(nilvar).s(" = true") + } else if tk := t2typ.Kind(); tk == reflect.Ptr { + if strings.IndexByte(varname3, '.') != -1 || strings.IndexByte(varname3, '[') != -1 { + nilbuf.s(varname3).s(" = nil") + } else { + nilbuf.s("*").s(varname3).s(" = ").s(x.genZeroValueR(t2typ.Elem())) + } + } else { + nilbuf.s(varname3).s(" = ").s(x.genZeroValueR(t2typ)) + } + if nilbufed { + nilbuf.s("}") + } + } + return t2 +} + +// decVar takes a variable called varname, of type t +func (x *genRunner) decVarMain(varname, rand string, t reflect.Type, checkNotNil bool) { // We only encode as nil if a nillable value. // This removes some of the wasted checks for TryDecodeAsNil. // We need to think about this more, to see what happens if omitempty, etc // cause a nil value to be stored when something is expected. // This could happen when decoding from a struct encoded as an array. // For that, decVar should be called with canNil=true, to force true as its value. - i := x.varsfx() - if !canBeNil { - canBeNil = genAnythingCanBeNil || !genIsImmutable(t) - } - if canBeNil { - x.line("if r.TryDecodeAsNil() {") - if t.Kind() == reflect.Ptr { - x.line("if " + varname + " != nil { ") - - // if varname is a field of a struct (has a dot in it), - // then just set it to nil - if strings.IndexByte(varname, '.') != -1 { - x.line(varname + " = nil") - } else { - x.line("*" + varname + " = " + x.genZeroValueR(t.Elem())) - } - x.line("}") - } else { - x.line(varname + " = " + x.genZeroValueR(t)) - } - x.line("} else {") - } else { - x.line("// cannot be nil") - } + var varname2 string if t.Kind() != reflect.Ptr { - if x.decTryAssignPrimitive(varname, t) { - x.line(genTempVarPfx + "v" + i + " := &" + varname) - x.dec(genTempVarPfx+"v"+i, t) + if t.PkgPath() != "" || !x.decTryAssignPrimitive(varname, t, false) { + x.dec(varname, t, false) } } else { - x.linef("if %s == nil { %s = new(%s) }", varname, varname, x.genTypeName(t.Elem())) + if checkNotNil { + x.linef("if %s == nil { %s = new(%s) }", varname, varname, x.genTypeName(t.Elem())) + } // Ensure we set underlying ptr to a non-nil value (so we can deref to it later). // There's a chance of a **T in here which is nil. var ptrPfx string for t = t.Elem(); t.Kind() == reflect.Ptr; t = t.Elem() { ptrPfx += "*" - x.linef("if %s%s == nil { %s%s = new(%s)}", - ptrPfx, varname, ptrPfx, varname, x.genTypeName(t)) - } - // if varname has [ in it, then create temp variable for this ptr thingie - if strings.Index(varname, "[") >= 0 { - varname2 := genTempVarPfx + "w" + i - x.line(varname2 + " := " + varname) - varname = varname2 + if checkNotNil { + x.linef("if %s%s == nil { %s%s = new(%s)}", + ptrPfx, varname, ptrPfx, varname, x.genTypeName(t)) + } } + // Should we create temp var if a slice/map indexing? No. dec(...) can now handle it. if ptrPfx == "" { - x.dec(varname, t) + x.dec(varname, t, true) } else { - x.line(genTempVarPfx + "z" + i + " := " + ptrPfx + varname) - x.dec(genTempVarPfx+"z"+i, t) + varname2 = genTempVarPfx + "z" + rand + x.line(varname2 + " := " + ptrPfx + varname) + x.dec(varname2, t, true) } - } +} + +// decVar takes a variable called varname, of type t +func (x *genRunner) decVar(varname, nilvar string, t reflect.Type, canBeNil, checkNotNil bool) { + i := x.varsfx() + + // We only encode as nil if a nillable value. + // This removes some of the wasted checks for TryDecodeAsNil. + // We need to think about this more, to see what happens if omitempty, etc + // cause a nil value to be stored when something is expected. + // This could happen when decoding from a struct encoded as an array. + // For that, decVar should be called with canNil=true, to force true as its value. + + if !canBeNil { + canBeNil = genAnythingCanBeNil || !genIsImmutable(t) + } + + if canBeNil { + var buf genBuf + x.decVarInitPtr(varname, nilvar, t, nil, nil, &buf) + x.linef("if r.TryDecodeAsNil() { %s } else {", buf.buf) + } else { + x.line("// cannot be nil") + } + + x.decVarMain(varname, i, t, checkNotNil) if canBeNil { x.line("} ") } } -// dec will decode a variable (varname) of type ptrTo(t). +// dec will decode a variable (varname) of type t or ptrTo(t) if isptr==true. // t is always a basetype (i.e. not of kind reflect.Ptr). -func (x *genRunner) dec(varname string, t reflect.Type) { +func (x *genRunner) dec(varname string, t reflect.Type, isptr bool) { // assumptions: // - the varname is to a pointer already. No need to take address of it // - t is always a baseType T (not a *T, etc). - rtid := reflect.ValueOf(t).Pointer() - tptr := reflect.PtrTo(t) + rtid := rt2id(t) + ti2 := x.ti.get(rtid, t) + // tptr := reflect.PtrTo(t) if x.checkForSelfer(t, varname) { - if t.Implements(selferTyp) || tptr.Implements(selferTyp) { + if ti2.cs || ti2.csp { // t.Implements(selferTyp) || tptr.Implements(selferTyp) { x.line(varname + ".CodecDecodeSelf(d)") return } @@ -1130,100 +1288,61 @@ func (x *genRunner) dec(varname string, t reflect.Type) { } // check if - // - type is Raw, RawExt + // - type is time.Time, Raw, RawExt // - the type implements (Text|JSON|Binary)(Unm|M)arshal + mi := x.varsfx() - x.linef("%sm%s := z.DecBinary()", genTempVarPfx, mi) - x.linef("_ = %sm%s", genTempVarPfx, mi) + // x.linef("%sm%s := z.DecBinary()", genTempVarPfx, mi) + // x.linef("_ = %sm%s", genTempVarPfx, mi) x.line("if false {") //start if block defer func() { x.line("}") }() //end if block - if t == rawTyp { - x.linef("} else { *%v = z.DecRaw()", varname) - return + var ptrPfx, addrPfx string + if isptr { + ptrPfx = "*" + } else { + addrPfx = "&" } - if t == rawExtTyp { - x.linef("} else { r.DecodeExt(%v, 0, nil)", varname) - return - } - - // HACK: Support for Builtins. - // Currently, only Binc supports builtins, and the only builtin type is time.Time. - // Have a method that returns the rtid for time.Time if Handle is Binc. if t == timeTyp { - vrtid := genTempVarPfx + "m" + x.varsfx() - x.linef("} else if %s := z.TimeRtidIfBinc(); %s != 0 { ", vrtid, vrtid) - x.linef("r.DecodeBuiltin(%s, %s)", vrtid, varname) + x.linef("} else { %s%v = r.DecodeTime()", ptrPfx, varname) + return } - // only check for extensions if the type is named, and has a packagePath. - if genImportPath(t) != "" && t.Name() != "" { - // first check if extensions are configued, before doing the interface conversion - x.linef("} else if z.HasExtensions() && z.DecExt(%s) {", varname) + if t == rawTyp { + x.linef("} else { %s%v = z.DecRaw()", ptrPfx, varname) + return } - if t.Implements(binaryUnmarshalerTyp) || tptr.Implements(binaryUnmarshalerTyp) { - x.linef("} else if %sm%s { z.DecBinaryUnmarshal(%v) ", genTempVarPfx, mi, varname) + if t == rawExtTyp { + x.linef("} else { r.DecodeExt(%s%v, 0, nil)", addrPfx, varname) + return } - if t.Implements(jsonUnmarshalerTyp) || tptr.Implements(jsonUnmarshalerTyp) { - x.linef("} else if !%sm%s && z.IsJSONHandle() { z.DecJSONUnmarshal(%v)", genTempVarPfx, mi, varname) - } else if t.Implements(textUnmarshalerTyp) || tptr.Implements(textUnmarshalerTyp) { - x.linef("} else if !%sm%s { z.DecTextUnmarshal(%v)", genTempVarPfx, mi, varname) + + // only check for extensions if the type is named, and has a packagePath. + if !x.nx && genImportPath(t) != "" && t.Name() != "" { + // first check if extensions are configued, before doing the interface conversion + // x.linef("} else if z.HasExtensions() && z.DecExt(%s) {", varname) + yy := fmt.Sprintf("%sxt%s", genTempVarPfx, mi) + x.linef("} else if %s := z.Extension(z.I2Rtid(%s)); %s != nil { z.DecExtension(%s, %s) ", yy, varname, yy, varname, yy) + } + + if ti2.bu || ti2.bup { // t.Implements(binaryUnmarshalerTyp) || tptr.Implements(binaryUnmarshalerTyp) { + x.linef("} else if z.DecBinary() { z.DecBinaryUnmarshal(%s%v) ", addrPfx, varname) + } + if ti2.ju || ti2.jup { // t.Implements(jsonUnmarshalerTyp) || tptr.Implements(jsonUnmarshalerTyp) { + x.linef("} else if !z.DecBinary() && z.IsJSONHandle() { z.DecJSONUnmarshal(%s%v)", addrPfx, varname) + } else if ti2.tu || ti2.tup { // t.Implements(textUnmarshalerTyp) || tptr.Implements(textUnmarshalerTyp) { + x.linef("} else if !z.DecBinary() { z.DecTextUnmarshal(%s%v)", addrPfx, varname) } x.line("} else {") - // Since these are pointers, we cannot share, and have to use them one by one + if x.decTryAssignPrimitive(varname, t, isptr) { + return + } + switch t.Kind() { - case reflect.Int: - x.line("*((*int)(" + varname + ")) = int(r.DecodeInt(codecSelferBitsize" + x.xs + "))") - // x.line("z.DecInt((*int)(" + varname + "))") - case reflect.Int8: - x.line("*((*int8)(" + varname + ")) = int8(r.DecodeInt(8))") - // x.line("z.DecInt8((*int8)(" + varname + "))") - case reflect.Int16: - x.line("*((*int16)(" + varname + ")) = int16(r.DecodeInt(16))") - // x.line("z.DecInt16((*int16)(" + varname + "))") - case reflect.Int32: - x.line("*((*int32)(" + varname + ")) = int32(r.DecodeInt(32))") - // x.line("z.DecInt32((*int32)(" + varname + "))") - case reflect.Int64: - x.line("*((*int64)(" + varname + ")) = int64(r.DecodeInt(64))") - // x.line("z.DecInt64((*int64)(" + varname + "))") - - case reflect.Uint: - x.line("*((*uint)(" + varname + ")) = uint(r.DecodeUint(codecSelferBitsize" + x.xs + "))") - // x.line("z.DecUint((*uint)(" + varname + "))") - case reflect.Uint8: - x.line("*((*uint8)(" + varname + ")) = uint8(r.DecodeUint(8))") - // x.line("z.DecUint8((*uint8)(" + varname + "))") - case reflect.Uint16: - x.line("*((*uint16)(" + varname + ")) = uint16(r.DecodeUint(16))") - //x.line("z.DecUint16((*uint16)(" + varname + "))") - case reflect.Uint32: - x.line("*((*uint32)(" + varname + ")) = uint32(r.DecodeUint(32))") - //x.line("z.DecUint32((*uint32)(" + varname + "))") - case reflect.Uint64: - x.line("*((*uint64)(" + varname + ")) = uint64(r.DecodeUint(64))") - //x.line("z.DecUint64((*uint64)(" + varname + "))") - case reflect.Uintptr: - x.line("*((*uintptr)(" + varname + ")) = uintptr(r.DecodeUint(codecSelferBitsize" + x.xs + "))") - - case reflect.Float32: - x.line("*((*float32)(" + varname + ")) = float32(r.DecodeFloat(true))") - //x.line("z.DecFloat32((*float32)(" + varname + "))") - case reflect.Float64: - x.line("*((*float64)(" + varname + ")) = float64(r.DecodeFloat(false))") - // x.line("z.DecFloat64((*float64)(" + varname + "))") - - case reflect.Bool: - x.line("*((*bool)(" + varname + ")) = r.DecodeBool()") - // x.line("z.DecBool((*bool)(" + varname + "))") - case reflect.String: - x.line("*((*string)(" + varname + ")) = r.DecodeString()") - // x.line("z.DecString((*string)(" + varname + "))") case reflect.Array, reflect.Chan: - x.xtraSM(varname, false, t) - // x.decListFallback(varname, rtid, true, t) + x.xtraSM(varname, t, false, isptr) case reflect.Slice: // if a []uint8, call dedicated function // if a known fastpath slice, call dedicated function @@ -1231,12 +1350,13 @@ func (x *genRunner) dec(varname string, t reflect.Type) { // - if elements are primitives or Selfers, call dedicated function on each member. // - else call Encoder.encode(XXX) on it. if rtid == uint8SliceTypId { - x.line("*" + varname + " = r.DecodeBytes(*(*[]byte)(" + varname + "), false, false)") + x.linef("%s%s = r.DecodeBytes(%s(%s[]byte)(%s), false)", + ptrPfx, varname, ptrPfx, ptrPfx, varname) } else if fastpathAV.index(rtid) != -1 { g := x.newGenV(t) - x.line("z.F." + g.MethodNamePfx("Dec", false) + "X(" + varname + ", false, d)") + x.linef("z.F.%sX(%s%s, d)", g.MethodNamePfx("Dec", false), addrPfx, varname) } else { - x.xtraSM(varname, false, t) + x.xtraSM(varname, t, false, isptr) // x.decListFallback(varname, rtid, false, t) } case reflect.Map: @@ -1246,83 +1366,89 @@ func (x *genRunner) dec(varname string, t reflect.Type) { // - else call Encoder.encode(XXX) on it. if fastpathAV.index(rtid) != -1 { g := x.newGenV(t) - x.line("z.F." + g.MethodNamePfx("Dec", false) + "X(" + varname + ", false, d)") + x.linef("z.F.%sX(%s%s, d)", g.MethodNamePfx("Dec", false), addrPfx, varname) } else { - x.xtraSM(varname, false, t) + x.xtraSM(varname, t, false, isptr) // x.decMapFallback(varname, rtid, t) } case reflect.Struct: if inlist { - x.decStruct(varname, rtid, t) + // no need to create temp variable if isptr, or x.F or x[F] + if isptr || strings.IndexByte(varname, '.') != -1 || strings.IndexByte(varname, '[') != -1 { + x.decStruct(varname, rtid, t) + } else { + varname2 := genTempVarPfx + "j" + mi + x.line(varname2 + " := &" + varname) + x.decStruct(varname2, rtid, t) + } } else { // delete(x.td, rtid) - x.line("z.DecFallback(" + varname + ", false)") + x.line("z.DecFallback(" + addrPfx + varname + ", false)") } default: if rtidAdded { delete(x.te, rtid) } - x.line("z.DecFallback(" + varname + ", true)") + x.line("z.DecFallback(" + addrPfx + varname + ", true)") } } -func (x *genRunner) decTryAssignPrimitive(varname string, t reflect.Type) (tryAsPtr bool) { +func (x *genRunner) decTryAssignPrimitive(varname string, t reflect.Type, isptr bool) (done bool) { // This should only be used for exact primitives (ie un-named types). // Named types may be implementations of Selfer, Unmarshaler, etc. // They should be handled by dec(...) - if t.Name() != "" { - tryAsPtr = true - return + var ptr string + if isptr { + ptr = "*" } - switch t.Kind() { case reflect.Int: - x.linef("%s = r.DecodeInt(codecSelferBitsize%s)", varname, x.xs) + x.linef("%s%s = (%s)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize%s))", ptr, varname, x.genTypeName(t), x.xs) case reflect.Int8: - x.linef("%s = r.DecodeInt(8)", varname) + x.linef("%s%s = (%s)(z.C.IntV(r.DecodeInt64(), 8))", ptr, varname, x.genTypeName(t)) case reflect.Int16: - x.linef("%s = r.DecodeInt(16)", varname) + x.linef("%s%s = (%s)(z.C.IntV(r.DecodeInt64(), 16))", ptr, varname, x.genTypeName(t)) case reflect.Int32: - x.linef("%s = r.DecodeInt(32)", varname) + x.linef("%s%s = (%s)(z.C.IntV(r.DecodeInt64(), 32))", ptr, varname, x.genTypeName(t)) case reflect.Int64: - x.linef("%s = r.DecodeInt(64)", varname) + x.linef("%s%s = (%s)(r.DecodeInt64())", ptr, varname, x.genTypeName(t)) case reflect.Uint: - x.linef("%s = r.DecodeUint(codecSelferBitsize%s)", varname, x.xs) + x.linef("%s%s = (%s)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize%s))", ptr, varname, x.genTypeName(t), x.xs) case reflect.Uint8: - x.linef("%s = r.DecodeUint(8)", varname) + x.linef("%s%s = (%s)(z.C.UintV(r.DecodeUint64(), 8))", ptr, varname, x.genTypeName(t)) case reflect.Uint16: - x.linef("%s = r.DecodeUint(16)", varname) + x.linef("%s%s = (%s)(z.C.UintV(r.DecodeUint64(), 16))", ptr, varname, x.genTypeName(t)) case reflect.Uint32: - x.linef("%s = r.DecodeUint(32)", varname) + x.linef("%s%s = (%s)(z.C.UintV(r.DecodeUint64(), 32))", ptr, varname, x.genTypeName(t)) case reflect.Uint64: - x.linef("%s = r.DecodeUint(64)", varname) + x.linef("%s%s = (%s)(r.DecodeUint64())", ptr, varname, x.genTypeName(t)) case reflect.Uintptr: - x.linef("%s = r.DecodeUint(codecSelferBitsize%s)", varname, x.xs) + x.linef("%s%s = (%s)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize%s))", ptr, varname, x.genTypeName(t), x.xs) case reflect.Float32: - x.linef("%s = r.DecodeFloat(true)", varname) + x.linef("%s%s = (%s)(r.DecodeFloat32As64())", ptr, varname, x.genTypeName(t)) case reflect.Float64: - x.linef("%s = r.DecodeFloat(false)", varname) + x.linef("%s%s = (%s)(r.DecodeFloat64())", ptr, varname, x.genTypeName(t)) case reflect.Bool: - x.linef("%s = r.DecodeBool()", varname) + x.linef("%s%s = (%s)(r.DecodeBool())", ptr, varname, x.genTypeName(t)) case reflect.String: - x.linef("%s = r.DecodeString()", varname) + x.linef("%s%s = (%s)(r.DecodeString())", ptr, varname, x.genTypeName(t)) default: - tryAsPtr = true + return false } - return + return true } func (x *genRunner) decListFallback(varname string, rtid uintptr, t reflect.Type) { if t.AssignableTo(uint8SliceTyp) { - x.line("*" + varname + " = r.DecodeBytes(*((*[]byte)(" + varname + ")), false, false)") + x.line("*" + varname + " = r.DecodeBytes(*((*[]byte)(" + varname + ")), false)") return } if t.Kind() == reflect.Array && t.Elem().Kind() == reflect.Uint8 { - x.linef("r.DecodeBytes( ((*[%s]byte)(%s))[:], false, true)", t.Len(), varname) + x.linef("r.DecodeBytes( ((*[%d]byte)(%s))[:], true)", t.Len(), varname) return } type tstruc struct { @@ -1340,11 +1466,7 @@ func (x *genRunner) decListFallback(varname string, rtid uintptr, t reflect.Type funcs := make(template.FuncMap) funcs["decLineVar"] = func(varname string) string { - x.decVar(varname, telem, false) - return "" - } - funcs["decLine"] = func(pfx string) string { - x.decVar(ts.TempVar+pfx+ts.Rand, reflect.PtrTo(telem), false) + x.decVar(varname, "", telem, false, true) return "" } funcs["var"] = func(s string) string { @@ -1402,19 +1524,11 @@ func (x *genRunner) decMapFallback(varname string, rtid uintptr, t reflect.Type) return telem.Kind() == reflect.Interface } funcs["decLineVarK"] = func(varname string) string { - x.decVar(varname, tkey, false) + x.decVar(varname, "", tkey, false, true) return "" } - funcs["decLineVar"] = func(varname string) string { - x.decVar(varname, telem, false) - return "" - } - funcs["decLineK"] = func(pfx string) string { - x.decVar(ts.TempVar+pfx+ts.Rand, reflect.PtrTo(tkey), false) - return "" - } - funcs["decLine"] = func(pfx string) string { - x.decVar(ts.TempVar+pfx+ts.Rand, reflect.PtrTo(telem), false) + funcs["decLineVar"] = func(varname, decodedNilVarname string) string { + x.decVar(varname, decodedNilVarname, telem, false, true) return "" } funcs["var"] = func(s string) string { @@ -1432,31 +1546,17 @@ func (x *genRunner) decMapFallback(varname string, rtid uintptr, t reflect.Type) func (x *genRunner) decStructMapSwitch(kName string, varname string, rtid uintptr, t reflect.Type) { ti := x.ti.get(rtid, t) - tisfi := ti.sfip // always use sequence from file. decStruct expects same thing. + tisfi := ti.sfiSrc // always use sequence from file. decStruct expects same thing. x.line("switch (" + kName + ") {") + var newbuf, nilbuf genBuf for _, si := range tisfi { x.line("case \"" + si.encName + "\":") - var t2 reflect.StructField - if si.i != -1 { - t2 = t.Field(int(si.i)) - } else { - //we must accommodate anonymous fields, where the embedded field is a nil pointer in the value. - // t2 = t.FieldByIndex(si.is) - t2typ := t - varname3 := varname - for _, ix := range si.is { - for t2typ.Kind() == reflect.Ptr { - t2typ = t2typ.Elem() - } - t2 = t2typ.Field(ix) - t2typ = t2.Type - varname3 = varname3 + "." + t2.Name - if t2typ.Kind() == reflect.Ptr { - x.linef("if %s == nil { %s = new(%s) }", varname3, varname3, x.genTypeName(t2typ.Elem())) - } - } - } - x.decVar(varname+"."+t2.Name, t2.Type, false) + newbuf.reset() + nilbuf.reset() + t2 := x.decVarInitPtr(varname, "", t, si, &newbuf, &nilbuf) + x.linef("if r.TryDecodeAsNil() { %s } else { %s", nilbuf.buf, newbuf.buf) + x.decVarMain(varname+"."+t2.Name, x.varsfx(), t2.Type, false) + x.line("}") } x.line("default:") // pass the slice here, so that the string will not escape, and maybe save allocation @@ -1466,27 +1566,10 @@ func (x *genRunner) decStructMapSwitch(kName string, varname string, rtid uintpt func (x *genRunner) decStructMap(varname, lenvarname string, rtid uintptr, t reflect.Type, style genStructMapStyle) { tpfx := genTempVarPfx + ti := x.ti.get(rtid, t) i := x.varsfx() kName := tpfx + "s" + i - // We thought to use ReadStringAsBytes, as go compiler might optimize the copy out. - // However, using that was more expensive, as it seems that the switch expression - // is evaluated each time. - // - // We could depend on decodeString using a temporary/shared buffer internally. - // However, this model of creating a byte array, and using explicitly is faster, - // and allows optional use of unsafe []byte->string conversion without alloc. - - // Also, ensure that the slice array doesn't escape. - // That will help escape analysis prevent allocation when it gets better. - - // x.line("var " + kName + "Arr = [32]byte{} // default string to decode into") - // x.line("var " + kName + "Slc = " + kName + "Arr[:] // default slice to decode into") - // use the scratch buffer to avoid allocation (most field names are < 32). - - x.line("var " + kName + "Slc = z.DecScratchBuffer() // default slice to decode into") - - x.line("_ = " + kName + "Slc") switch style { case genStructMapStyleLenPrefix: x.linef("for %sj%s := 0; %sj%s < %s; %sj%s++ {", tpfx, i, tpfx, i, lenvarname, tpfx, i) @@ -1498,60 +1581,49 @@ func (x *genRunner) decStructMap(varname, lenvarname string, rtid uintptr, t ref x.linef("if %shl%s { if %sj%s >= %s { break }", tpfx, i, tpfx, i, lenvarname) x.line("} else { if r.CheckBreak() { break }; }") } - x.linef("z.DecSendContainerState(codecSelfer_containerMapKey%s)", x.xs) - x.line(kName + "Slc = r.DecodeBytes(" + kName + "Slc, true, true)") - // let string be scoped to this loop alone, so it doesn't escape. - if x.unsafe { - x.line(kName + "SlcHdr := codecSelferUnsafeString" + x.xs + "{uintptr(unsafe.Pointer(&" + - kName + "Slc[0])), len(" + kName + "Slc)}") - x.line(kName + " := *(*string)(unsafe.Pointer(&" + kName + "SlcHdr))") - } else { - x.line(kName + " := string(" + kName + "Slc)") + x.line("r.ReadMapElemKey()") + + // emulate decstructfieldkey + switch ti.keyType { + case valueTypeInt: + x.linef("%s := z.StringView(strconv.AppendInt(z.DecScratchArrayBuffer()[:0], r.DecodeInt64(), 10))", kName) + case valueTypeUint: + x.linef("%s := z.StringView(strconv.AppendUint(z.DecScratchArrayBuffer()[:0], r.DecodeUint64(), 10))", kName) + case valueTypeFloat: + x.linef("%s := z.StringView(strconv.AppendFloat(z.DecScratchArrayBuffer()[:0], r.DecodeFloat64(), 'f', -1, 64))", kName) + default: // string + x.linef("%s := z.StringView(r.DecodeStringAsBytes())", kName) } - x.linef("z.DecSendContainerState(codecSelfer_containerMapValue%s)", x.xs) + // x.linef("%s := z.StringView(r.DecStructFieldKey(codecSelferValueType%s%s, z.DecScratchArrayBuffer()))", kName, ti.keyType.String(), x.xs) + + x.line("r.ReadMapElemValue()") x.decStructMapSwitch(kName, varname, rtid, t) x.line("} // end for " + tpfx + "j" + i) - x.linef("z.DecSendContainerState(codecSelfer_containerMapEnd%s)", x.xs) + x.line("r.ReadMapEnd()") } func (x *genRunner) decStructArray(varname, lenvarname, breakString string, rtid uintptr, t reflect.Type) { tpfx := genTempVarPfx i := x.varsfx() ti := x.ti.get(rtid, t) - tisfi := ti.sfip // always use sequence from file. decStruct expects same thing. + tisfi := ti.sfiSrc // always use sequence from file. decStruct expects same thing. x.linef("var %sj%s int", tpfx, i) x.linef("var %sb%s bool", tpfx, i) // break x.linef("var %shl%s bool = %s >= 0", tpfx, i, lenvarname) // has length + var newbuf, nilbuf genBuf for _, si := range tisfi { - var t2 reflect.StructField - if si.i != -1 { - t2 = t.Field(int(si.i)) - } else { - //we must accommodate anonymous fields, where the embedded field is a nil pointer in the value. - // t2 = t.FieldByIndex(si.is) - t2typ := t - varname3 := varname - for _, ix := range si.is { - for t2typ.Kind() == reflect.Ptr { - t2typ = t2typ.Elem() - } - t2 = t2typ.Field(ix) - t2typ = t2.Type - varname3 = varname3 + "." + t2.Name - if t2typ.Kind() == reflect.Ptr { - x.linef("if %s == nil { %s = new(%s) }", varname3, varname3, x.genTypeName(t2typ.Elem())) - } - } - } - x.linef("%sj%s++; if %shl%s { %sb%s = %sj%s > %s } else { %sb%s = r.CheckBreak() }", tpfx, i, tpfx, i, tpfx, i, tpfx, i, lenvarname, tpfx, i) - x.linef("if %sb%s { z.DecSendContainerState(codecSelfer_containerArrayEnd%s); %s }", - tpfx, i, x.xs, breakString) - x.linef("z.DecSendContainerState(codecSelfer_containerArrayElem%s)", x.xs) - x.decVar(varname+"."+t2.Name, t2.Type, true) + x.linef("if %sb%s { r.ReadArrayEnd(); %s }", tpfx, i, breakString) + x.line("r.ReadArrayElem()") + newbuf.reset() + nilbuf.reset() + t2 := x.decVarInitPtr(varname, "", t, si, &newbuf, &nilbuf) + x.linef("if r.TryDecodeAsNil() { %s } else { %s", nilbuf.buf, newbuf.buf) + x.decVarMain(varname+"."+t2.Name, x.varsfx(), t2.Type, false) + x.line("}") } // read remaining values and throw away. x.line("for {") @@ -1559,28 +1631,28 @@ func (x *genRunner) decStructArray(varname, lenvarname, breakString string, rtid tpfx, i, tpfx, i, tpfx, i, tpfx, i, lenvarname, tpfx, i) x.linef("if %sb%s { break }", tpfx, i) - x.linef("z.DecSendContainerState(codecSelfer_containerArrayElem%s)", x.xs) + x.line("r.ReadArrayElem()") x.linef(`z.DecStructFieldNotFound(%sj%s - 1, "")`, tpfx, i) x.line("}") - x.linef("z.DecSendContainerState(codecSelfer_containerArrayEnd%s)", x.xs) + x.line("r.ReadArrayEnd()") } func (x *genRunner) decStruct(varname string, rtid uintptr, t reflect.Type) { - // if container is map + // varname MUST be a ptr, or a struct field or a slice element. i := x.varsfx() x.linef("%sct%s := r.ContainerType()", genTempVarPfx, i) x.linef("if %sct%s == codecSelferValueTypeMap%s {", genTempVarPfx, i, x.xs) x.line(genTempVarPfx + "l" + i + " := r.ReadMapStart()") x.linef("if %sl%s == 0 {", genTempVarPfx, i) - x.linef("z.DecSendContainerState(codecSelfer_containerMapEnd%s)", x.xs) + x.line("r.ReadMapEnd()") if genUseOneFunctionForDecStructMap { x.line("} else { ") - x.linef("x.codecDecodeSelfFromMap(%sl%s, d)", genTempVarPfx, i) + x.linef("%s.codecDecodeSelfFromMap(%sl%s, d)", varname, genTempVarPfx, i) } else { x.line("} else if " + genTempVarPfx + "l" + i + " > 0 { ") - x.line("x.codecDecodeSelfFromMapLenPrefix(" + genTempVarPfx + "l" + i + ", d)") + x.line(varname + ".codecDecodeSelfFromMapLenPrefix(" + genTempVarPfx + "l" + i + ", d)") x.line("} else {") - x.line("x.codecDecodeSelfFromMapCheckBreak(" + genTempVarPfx + "l" + i + ", d)") + x.line(varname + ".codecDecodeSelfFromMapCheckBreak(" + genTempVarPfx + "l" + i + ", d)") } x.line("}") @@ -1588,13 +1660,13 @@ func (x *genRunner) decStruct(varname string, rtid uintptr, t reflect.Type) { x.linef("} else if %sct%s == codecSelferValueTypeArray%s {", genTempVarPfx, i, x.xs) x.line(genTempVarPfx + "l" + i + " := r.ReadArrayStart()") x.linef("if %sl%s == 0 {", genTempVarPfx, i) - x.linef("z.DecSendContainerState(codecSelfer_containerArrayEnd%s)", x.xs) + x.line("r.ReadArrayEnd()") x.line("} else { ") - x.linef("x.codecDecodeSelfFromArray(%sl%s, d)", genTempVarPfx, i) + x.linef("%s.codecDecodeSelfFromArray(%sl%s, d)", varname, genTempVarPfx, i) x.line("}") // else panic x.line("} else { ") - x.line("panic(codecSelferOnlyMapOrArrayEncodeToStructErr" + x.xs + ")") + x.line("panic(errCodecSelferOnlyMapOrArrayEncodeToStruct" + x.xs + ")") x.line("} ") } @@ -1654,7 +1726,7 @@ func genImportPath(t reflect.Type) (s string) { s = t.PkgPath() if genCheckVendor { // HACK: always handle vendoring. It should be typically on in go 1.6, 1.7 - s = stripVendor(s) + s = genStripVendor(s) } return } @@ -1776,13 +1848,13 @@ func genIsImmutable(t reflect.Type) (v bool) { } type genInternal struct { - Values []genV - Unsafe bool + Version int + Values []genV } func (x genInternal) FastpathLen() (l int) { for _, v := range x.Values { - if v.Primitive == "" { + if v.Primitive == "" && !(v.MapKey == "" && v.Elem == "uint8") { l++ } } @@ -1802,6 +1874,32 @@ func genInternalZeroValue(s string) string { } } +var genInternalNonZeroValueIdx [5]uint64 +var genInternalNonZeroValueStrs = [2][5]string{ + {`"string-is-an-interface"`, "true", `"some-string"`, "11.1", "33"}, + {`"string-is-an-interface-2"`, "true", `"some-string-2"`, "22.2", "44"}, +} + +func genInternalNonZeroValue(s string) string { + switch s { + case "interface{}", "interface {}": + genInternalNonZeroValueIdx[0]++ + return genInternalNonZeroValueStrs[genInternalNonZeroValueIdx[0]%2][0] // return string, to remove ambiguity + case "bool": + genInternalNonZeroValueIdx[1]++ + return genInternalNonZeroValueStrs[genInternalNonZeroValueIdx[1]%2][1] + case "string": + genInternalNonZeroValueIdx[2]++ + return genInternalNonZeroValueStrs[genInternalNonZeroValueIdx[2]%2][2] + case "float32", "float64", "float", "double": + genInternalNonZeroValueIdx[3]++ + return genInternalNonZeroValueStrs[genInternalNonZeroValueIdx[3]%2][3] + default: + genInternalNonZeroValueIdx[4]++ + return genInternalNonZeroValueStrs[genInternalNonZeroValueIdx[4]%2][4] + } +} + func genInternalEncCommandAsString(s string, vname string) string { switch s { case "uint", "uint8", "uint16", "uint32", "uint64": @@ -1809,15 +1907,15 @@ func genInternalEncCommandAsString(s string, vname string) string { case "int", "int8", "int16", "int32", "int64": return "ee.EncodeInt(int64(" + vname + "))" case "string": - return "ee.EncodeString(c_UTF8, " + vname + ")" + return "ee.EncodeString(cUTF8, " + vname + ")" case "float32": return "ee.EncodeFloat32(" + vname + ")" case "float64": return "ee.EncodeFloat64(" + vname + ")" case "bool": return "ee.EncodeBool(" + vname + ")" - case "symbol": - return "ee.EncodeSymbol(" + vname + ")" + // case "symbol": + // return "ee.EncodeSymbol(" + vname + ")" default: return "e.encode(" + vname + ")" } @@ -1826,34 +1924,34 @@ func genInternalEncCommandAsString(s string, vname string) string { func genInternalDecCommandAsString(s string) string { switch s { case "uint": - return "uint(dd.DecodeUint(uintBitsize))" + return "uint(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))" case "uint8": - return "uint8(dd.DecodeUint(8))" + return "uint8(chkOvf.UintV(dd.DecodeUint64(), 8))" case "uint16": - return "uint16(dd.DecodeUint(16))" + return "uint16(chkOvf.UintV(dd.DecodeUint64(), 16))" case "uint32": - return "uint32(dd.DecodeUint(32))" + return "uint32(chkOvf.UintV(dd.DecodeUint64(), 32))" case "uint64": - return "dd.DecodeUint(64)" + return "dd.DecodeUint64()" case "uintptr": - return "uintptr(dd.DecodeUint(uintBitsize))" + return "uintptr(chkOvf.UintV(dd.DecodeUint64(), uintBitsize))" case "int": - return "int(dd.DecodeInt(intBitsize))" + return "int(chkOvf.IntV(dd.DecodeInt64(), intBitsize))" case "int8": - return "int8(dd.DecodeInt(8))" + return "int8(chkOvf.IntV(dd.DecodeInt64(), 8))" case "int16": - return "int16(dd.DecodeInt(16))" + return "int16(chkOvf.IntV(dd.DecodeInt64(), 16))" case "int32": - return "int32(dd.DecodeInt(32))" + return "int32(chkOvf.IntV(dd.DecodeInt64(), 32))" case "int64": - return "dd.DecodeInt(64)" + return "dd.DecodeInt64()" case "string": return "dd.DecodeString()" case "float32": - return "float32(dd.DecodeFloat(true))" + return "float32(chkOvf.Float32V(dd.DecodeFloat64()))" case "float64": - return "dd.DecodeFloat(false)" + return "dd.DecodeFloat64()" case "bool": return "dd.DecodeBool()" default: @@ -1877,7 +1975,7 @@ func genInternalSortType(s string, elem bool) string { panic("sorttype: unexpected type: " + s) } -func stripVendor(s string) string { +func genStripVendor(s string) string { // HACK: Misbehaviour occurs in go 1.5. May have to re-visit this later. // if s contains /vendor/ OR startsWith vendor/, then return everything after it. const vendorStart = "vendor/" @@ -1891,7 +1989,7 @@ func stripVendor(s string) string { } // var genInternalMu sync.Mutex -var genInternalV genInternal +var genInternalV = genInternal{Version: genVersion} var genInternalTmplFuncs template.FuncMap var genInternalOnce sync.Once @@ -1954,14 +2052,15 @@ func genInternalInit() { "float64": 8, "bool": 1, } - var gt genInternal + var gt = genInternal{Version: genVersion} // For each slice or map type, there must be a (symmetrical) Encode and Decode fast-path function for _, s := range types { gt.Values = append(gt.Values, genV{Primitive: s, Size: mapvaltypes2[s]}) - if s != "uint8" { // do not generate fast path for slice of bytes. Treat specially already. - gt.Values = append(gt.Values, genV{Elem: s, Size: mapvaltypes2[s]}) - } + // if s != "uint8" { // do not generate fast path for slice of bytes. Treat specially already. + // gt.Values = append(gt.Values, genV{Elem: s, Size: mapvaltypes2[s]}) + // } + gt.Values = append(gt.Values, genV{Elem: s, Size: mapvaltypes2[s]}) if _, ok := mapvaltypes2[s]; !ok { gt.Values = append(gt.Values, genV{MapKey: s, Elem: s, Size: 2 * mapvaltypes2[s]}) } @@ -1975,6 +2074,7 @@ func genInternalInit() { funcs["encmd"] = genInternalEncCommandAsString funcs["decmd"] = genInternalDecCommandAsString funcs["zerocmd"] = genInternalZeroValue + funcs["nonzerocmd"] = genInternalNonZeroValue funcs["hasprefix"] = strings.HasPrefix funcs["sorttype"] = genInternalSortType @@ -1986,11 +2086,10 @@ func genInternalInit() { // It is run by the program author alone. // Unfortunately, it has to be exported so that it can be called from a command line tool. // *** DO NOT USE *** -func genInternalGoFile(r io.Reader, w io.Writer, safe bool) (err error) { +func genInternalGoFile(r io.Reader, w io.Writer) (err error) { genInternalOnce.Do(genInternalInit) gt := genInternalV - gt.Unsafe = !safe t := template.New("").Funcs(genInternalTmplFuncs) diff --git a/vendor/github.com/ugorji/go/codec/gen_15.go b/vendor/github.com/ugorji/go/codec/gen_15.go deleted file mode 100644 index ab76c3102..000000000 --- a/vendor/github.com/ugorji/go/codec/gen_15.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a MIT license found in the LICENSE file. - -// +build go1.5,!go1.6 - -package codec - -import "os" - -func init() { - genCheckVendor = os.Getenv("GO15VENDOREXPERIMENT") == "1" -} diff --git a/vendor/github.com/ugorji/go/codec/gen_16.go b/vendor/github.com/ugorji/go/codec/gen_16.go deleted file mode 100644 index 87c04e2e1..000000000 --- a/vendor/github.com/ugorji/go/codec/gen_16.go +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. -// Use of this source code is governed by a MIT license found in the LICENSE file. - -// +build go1.6 - -package codec - -import "os" - -func init() { - genCheckVendor = os.Getenv("GO15VENDOREXPERIMENT") != "0" -} diff --git a/vendor/github.com/ugorji/go/codec/goversion_arrayof_gte_go15.go b/vendor/github.com/ugorji/go/codec/goversion_arrayof_gte_go15.go new file mode 100644 index 000000000..9ddbe2059 --- /dev/null +++ b/vendor/github.com/ugorji/go/codec/goversion_arrayof_gte_go15.go @@ -0,0 +1,14 @@ +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Use of this source code is governed by a MIT license found in the LICENSE file. + +// +build go1.5 + +package codec + +import "reflect" + +const reflectArrayOfSupported = true + +func reflectArrayOf(count int, elem reflect.Type) reflect.Type { + return reflect.ArrayOf(count, elem) +} diff --git a/vendor/github.com/ugorji/go/codec/goversion_arrayof_lt_go15.go b/vendor/github.com/ugorji/go/codec/goversion_arrayof_lt_go15.go new file mode 100644 index 000000000..c5fcd6697 --- /dev/null +++ b/vendor/github.com/ugorji/go/codec/goversion_arrayof_lt_go15.go @@ -0,0 +1,14 @@ +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Use of this source code is governed by a MIT license found in the LICENSE file. + +// +build !go1.5 + +package codec + +import "reflect" + +const reflectArrayOfSupported = false + +func reflectArrayOf(count int, elem reflect.Type) reflect.Type { + panic("codec: reflect.ArrayOf unsupported in this go version") +} diff --git a/vendor/github.com/ugorji/go/codec/goversion_makemap_gte_go19.go b/vendor/github.com/ugorji/go/codec/goversion_makemap_gte_go19.go new file mode 100644 index 000000000..bc39d6b71 --- /dev/null +++ b/vendor/github.com/ugorji/go/codec/goversion_makemap_gte_go19.go @@ -0,0 +1,15 @@ +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Use of this source code is governed by a MIT license found in the LICENSE file. + +// +build go1.9 + +package codec + +import "reflect" + +func makeMapReflect(t reflect.Type, size int) reflect.Value { + if size < 0 { + return reflect.MakeMapWithSize(t, 4) + } + return reflect.MakeMapWithSize(t, size) +} diff --git a/vendor/github.com/ugorji/go/codec/goversion_makemap_lt_go19.go b/vendor/github.com/ugorji/go/codec/goversion_makemap_lt_go19.go new file mode 100644 index 000000000..cde4cd372 --- /dev/null +++ b/vendor/github.com/ugorji/go/codec/goversion_makemap_lt_go19.go @@ -0,0 +1,12 @@ +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Use of this source code is governed by a MIT license found in the LICENSE file. + +// +build !go1.9 + +package codec + +import "reflect" + +func makeMapReflect(t reflect.Type, size int) reflect.Value { + return reflect.MakeMap(t) +} diff --git a/vendor/github.com/ugorji/go/codec/goversion_unexportedembeddedptr_gte_go110.go b/vendor/github.com/ugorji/go/codec/goversion_unexportedembeddedptr_gte_go110.go new file mode 100644 index 000000000..794133a3c --- /dev/null +++ b/vendor/github.com/ugorji/go/codec/goversion_unexportedembeddedptr_gte_go110.go @@ -0,0 +1,8 @@ +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Use of this source code is governed by a MIT license found in the LICENSE file. + +// +build go1.10 + +package codec + +const allowSetUnexportedEmbeddedPtr = false diff --git a/vendor/github.com/ugorji/go/codec/goversion_unexportedembeddedptr_lt_go110.go b/vendor/github.com/ugorji/go/codec/goversion_unexportedembeddedptr_lt_go110.go new file mode 100644 index 000000000..fd92ede35 --- /dev/null +++ b/vendor/github.com/ugorji/go/codec/goversion_unexportedembeddedptr_lt_go110.go @@ -0,0 +1,8 @@ +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Use of this source code is governed by a MIT license found in the LICENSE file. + +// +build !go1.10 + +package codec + +const allowSetUnexportedEmbeddedPtr = true diff --git a/vendor/github.com/ugorji/go/codec/goversion_unsupported_lt_go14.go b/vendor/github.com/ugorji/go/codec/goversion_unsupported_lt_go14.go new file mode 100644 index 000000000..8debfa613 --- /dev/null +++ b/vendor/github.com/ugorji/go/codec/goversion_unsupported_lt_go14.go @@ -0,0 +1,17 @@ +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Use of this source code is governed by a MIT license found in the LICENSE file. + +// +build !go1.4 + +package codec + +// This codec package will only work for go1.4 and above. +// This is for the following reasons: +// - go 1.4 was released in 2014 +// - go runtime is written fully in go +// - interface only holds pointers +// - reflect.Value is stabilized as 3 words + +func init() { + panic("codec: go 1.3 and below are not supported") +} diff --git a/vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go15.go b/vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go15.go new file mode 100644 index 000000000..0f1bb01e5 --- /dev/null +++ b/vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go15.go @@ -0,0 +1,10 @@ +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Use of this source code is governed by a MIT license found in the LICENSE file. + +// +build go1.5,!go1.6 + +package codec + +import "os" + +var genCheckVendor = os.Getenv("GO15VENDOREXPERIMENT") == "1" diff --git a/vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go16.go b/vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go16.go new file mode 100644 index 000000000..2fb4b057d --- /dev/null +++ b/vendor/github.com/ugorji/go/codec/goversion_vendor_eq_go16.go @@ -0,0 +1,10 @@ +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Use of this source code is governed by a MIT license found in the LICENSE file. + +// +build go1.6,!go1.7 + +package codec + +import "os" + +var genCheckVendor = os.Getenv("GO15VENDOREXPERIMENT") != "0" diff --git a/vendor/github.com/ugorji/go/codec/gen_17.go b/vendor/github.com/ugorji/go/codec/goversion_vendor_gte_go17.go similarity index 53% rename from vendor/github.com/ugorji/go/codec/gen_17.go rename to vendor/github.com/ugorji/go/codec/goversion_vendor_gte_go17.go index 3881a43ce..c5b815505 100644 --- a/vendor/github.com/ugorji/go/codec/gen_17.go +++ b/vendor/github.com/ugorji/go/codec/goversion_vendor_gte_go17.go @@ -1,10 +1,8 @@ -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. // +build go1.7 package codec -func init() { - genCheckVendor = true -} +const genCheckVendor = true diff --git a/vendor/github.com/ugorji/go/codec/goversion_vendor_lt_go15.go b/vendor/github.com/ugorji/go/codec/goversion_vendor_lt_go15.go new file mode 100644 index 000000000..837cf240b --- /dev/null +++ b/vendor/github.com/ugorji/go/codec/goversion_vendor_lt_go15.go @@ -0,0 +1,8 @@ +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Use of this source code is governed by a MIT license found in the LICENSE file. + +// +build !go1.5 + +package codec + +var genCheckVendor = false diff --git a/vendor/github.com/ugorji/go/codec/helper.go b/vendor/github.com/ugorji/go/codec/helper.go index 8b94fc1e4..e6994a917 100644 --- a/vendor/github.com/ugorji/go/codec/helper.go +++ b/vendor/github.com/ugorji/go/codec/helper.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -102,9 +102,11 @@ import ( "encoding/binary" "errors" "fmt" + "io" "math" "reflect" "sort" + "strconv" "strings" "sync" "time" @@ -112,32 +114,28 @@ import ( const ( scratchByteArrayLen = 32 - initCollectionCap = 32 // 32 is defensive. 16 is preferred. + // initCollectionCap = 16 // 32 is defensive. 16 is preferred. // Support encoding.(Binary|Text)(Unm|M)arshaler. // This constant flag will enable or disable it. supportMarshalInterfaces = true - // Each Encoder or Decoder uses a cache of functions based on conditionals, - // so that the conditionals are not run every time. - // - // Either a map or a slice is used to keep track of the functions. - // The map is more natural, but has a higher cost than a slice/array. - // This flag (useMapForCodecCache) controls which is used. - // - // From benchmarks, slices with linear search perform better with < 32 entries. - // We have typically seen a high threshold of about 24 entries. - useMapForCodecCache = false - // for debugging, set this to false, to catch panic traces. // Note that this will always cause rpc tests to fail, since they need io.EOF sent via panic. recoverPanicToErr = true - // if resetSliceElemToZeroValue, then on decoding a slice, reset the element to a zero value first. - // Only concern is that, if the slice already contained some garbage, we will decode into that garbage. - // The chances of this are slim, so leave this "optimization". - // TODO: should this be true, to ensure that we always decode into a "zero" "empty" value? - resetSliceElemToZeroValue bool = false + // arrayCacheLen is the length of the cache used in encoder or decoder for + // allowing zero-alloc initialization. + arrayCacheLen = 8 + + // size of the cacheline: defaulting to value for archs: amd64, arm64, 386 + // should use "runtime/internal/sys".CacheLineSize, but that is not exposed. + cacheLineSize = 64 + + wordSizeBits = 32 << (^uint(0) >> 63) // strconv.IntSize + wordSize = wordSizeBits / 8 + + maxLevelsEmbedding = 15 // use this, so structFieldInfo fits into 8 bytes ) var ( @@ -145,15 +143,28 @@ var ( zeroByteSlice = oneByteArr[:0:0] ) +var refBitset bitset32 +var pool pooler +var panicv panicHdl + +func init() { + pool.init() + + refBitset.set(byte(reflect.Map)) + refBitset.set(byte(reflect.Ptr)) + refBitset.set(byte(reflect.Func)) + refBitset.set(byte(reflect.Chan)) +} + type charEncoding uint8 const ( - c_RAW charEncoding = iota - c_UTF8 - c_UTF16LE - c_UTF16BE - c_UTF32LE - c_UTF32BE + cRAW charEncoding = iota + cUTF8 + cUTF16LE + cUTF16BE + cUTF32LE + cUTF32BE ) // valueType is the stream type @@ -171,12 +182,35 @@ const ( valueTypeBytes valueTypeMap valueTypeArray - valueTypeTimestamp + valueTypeTime valueTypeExt // valueTypeInvalid = 0xff ) +var valueTypeStrings = [...]string{ + "Unset", + "Nil", + "Int", + "Uint", + "Float", + "Bool", + "String", + "Symbol", + "Bytes", + "Map", + "Array", + "Timestamp", + "Ext", +} + +func (x valueType) String() string { + if int(x) < len(valueTypeStrings) { + return valueTypeStrings[x] + } + return strconv.FormatInt(int64(x), 10) +} + type seqType uint8 const ( @@ -202,11 +236,11 @@ const ( containerArrayEnd ) -// sfiIdx used for tracking where a (field/enc)Name is seen in a []*structFieldInfo -type sfiIdx struct { - name string - index int -} +// // sfiIdx used for tracking where a (field/enc)Name is seen in a []*structFieldInfo +// type sfiIdx struct { +// name string +// index int +// } // do not recurse if a containing type refers to an embedded type // which refers back to its containing type (via a pointer). @@ -215,34 +249,39 @@ type sfiIdx struct { const rgetMaxRecursion = 2 // Anecdotally, we believe most types have <= 12 fields. -// Java's PMD rules set TooManyFields threshold to 15. -const rgetPoolTArrayLen = 12 +// - even Java's PMD rules set TooManyFields threshold to 15. +// However, go has embedded fields, which should be regarded as +// top level, allowing structs to possibly double or triple. +// In addition, we don't want to keep creating transient arrays, +// especially for the sfi index tracking, and the evtypes tracking. +// +// So - try to keep typeInfoLoadArray within 2K bytes +const ( + typeInfoLoadArraySfisLen = 16 + typeInfoLoadArraySfiidxLen = 8 * 112 + typeInfoLoadArrayEtypesLen = 12 + typeInfoLoadArrayBLen = 8 * 4 +) -type rgetT struct { - fNames []string - encNames []string - etypes []uintptr - sfis []*structFieldInfo +type typeInfoLoad struct { + // fNames []string + // encNames []string + etypes []uintptr + sfis []structFieldInfo } -type rgetPoolT struct { - fNames [rgetPoolTArrayLen]string - encNames [rgetPoolTArrayLen]string - etypes [rgetPoolTArrayLen]uintptr - sfis [rgetPoolTArrayLen]*structFieldInfo - sfiidx [rgetPoolTArrayLen]sfiIdx -} - -var rgetPool = sync.Pool{ - New: func() interface{} { return new(rgetPoolT) }, -} - -type containerStateRecv interface { - sendContainerState(containerState) +type typeInfoLoadArray struct { + // fNames [typeInfoLoadArrayLen]string + // encNames [typeInfoLoadArrayLen]string + sfis [typeInfoLoadArraySfisLen]structFieldInfo + sfiidx [typeInfoLoadArraySfiidxLen]byte + etypes [typeInfoLoadArrayEtypesLen]uintptr + b [typeInfoLoadArrayBLen]byte // scratch - used for struct field names } // mirror json.Marshaler and json.Unmarshaler here, // so we don't import the encoding/json package + type jsonMarshaler interface { MarshalJSON() ([]byte, error) } @@ -250,6 +289,12 @@ type jsonUnmarshaler interface { UnmarshalJSON([]byte) error } +type isZeroer interface { + IsZero() bool +} + +// type byteAccepter func(byte) bool + var ( bigen = binary.BigEndian structInfoFieldName = "_struct" @@ -259,11 +304,17 @@ var ( intfSliceTyp = reflect.TypeOf([]interface{}(nil)) intfTyp = intfSliceTyp.Elem() + reflectValTyp = reflect.TypeOf((*reflect.Value)(nil)).Elem() + stringTyp = reflect.TypeOf("") timeTyp = reflect.TypeOf(time.Time{}) rawExtTyp = reflect.TypeOf(RawExt{}) rawTyp = reflect.TypeOf(Raw{}) + uintptrTyp = reflect.TypeOf(uintptr(0)) + uint8Typ = reflect.TypeOf(uint8(0)) uint8SliceTyp = reflect.TypeOf([]uint8(nil)) + uintTyp = reflect.TypeOf(uint(0)) + intTyp = reflect.TypeOf(int(0)) mapBySliceTyp = reflect.TypeOf((*MapBySlice)(nil)).Elem() @@ -277,32 +328,64 @@ var ( jsonUnmarshalerTyp = reflect.TypeOf((*jsonUnmarshaler)(nil)).Elem() selferTyp = reflect.TypeOf((*Selfer)(nil)).Elem() + iszeroTyp = reflect.TypeOf((*isZeroer)(nil)).Elem() - uint8SliceTypId = reflect.ValueOf(uint8SliceTyp).Pointer() - rawExtTypId = reflect.ValueOf(rawExtTyp).Pointer() - rawTypId = reflect.ValueOf(rawTyp).Pointer() - intfTypId = reflect.ValueOf(intfTyp).Pointer() - timeTypId = reflect.ValueOf(timeTyp).Pointer() - stringTypId = reflect.ValueOf(stringTyp).Pointer() + uint8TypId = rt2id(uint8Typ) + uint8SliceTypId = rt2id(uint8SliceTyp) + rawExtTypId = rt2id(rawExtTyp) + rawTypId = rt2id(rawTyp) + intfTypId = rt2id(intfTyp) + timeTypId = rt2id(timeTyp) + stringTypId = rt2id(stringTyp) - mapStrIntfTypId = reflect.ValueOf(mapStrIntfTyp).Pointer() - mapIntfIntfTypId = reflect.ValueOf(mapIntfIntfTyp).Pointer() - intfSliceTypId = reflect.ValueOf(intfSliceTyp).Pointer() - // mapBySliceTypId = reflect.ValueOf(mapBySliceTyp).Pointer() + mapStrIntfTypId = rt2id(mapStrIntfTyp) + mapIntfIntfTypId = rt2id(mapIntfIntfTyp) + intfSliceTypId = rt2id(intfSliceTyp) + // mapBySliceTypId = rt2id(mapBySliceTyp) - intBitsize uint8 = uint8(reflect.TypeOf(int(0)).Bits()) - uintBitsize uint8 = uint8(reflect.TypeOf(uint(0)).Bits()) + intBitsize = uint8(intTyp.Bits()) + uintBitsize = uint8(uintTyp.Bits()) bsAll0x00 = []byte{0, 0, 0, 0, 0, 0, 0, 0} bsAll0xff = []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} chkOvf checkOverflow - noFieldNameToStructFieldInfoErr = errors.New("no field name passed to parseStructFieldInfo") + errNoFieldNameToStructFieldInfo = errors.New("no field name passed to parseStructFieldInfo") ) var defTypeInfos = NewTypeInfos([]string{"codec", "json"}) +var immutableKindsSet = [32]bool{ + // reflect.Invalid: , + reflect.Bool: true, + reflect.Int: true, + reflect.Int8: true, + reflect.Int16: true, + reflect.Int32: true, + reflect.Int64: true, + reflect.Uint: true, + reflect.Uint8: true, + reflect.Uint16: true, + reflect.Uint32: true, + reflect.Uint64: true, + reflect.Uintptr: true, + reflect.Float32: true, + reflect.Float64: true, + reflect.Complex64: true, + reflect.Complex128: true, + // reflect.Array + // reflect.Chan + // reflect.Func: true, + // reflect.Interface + // reflect.Map + // reflect.Ptr + // reflect.Slice + reflect.String: true, + // reflect.Struct + // reflect.UnsafePointer +} + // Selfer defines methods by which a value can encode or decode itself. // // Any type which implements Selfer will be able to encode or decode itself. @@ -313,29 +396,58 @@ type Selfer interface { CodecDecodeSelf(*Decoder) } -// MapBySlice represents a slice which should be encoded as a map in the stream. +// MapBySlice is a tag interface that denotes wrapped slice should encode as a map in the stream. // The slice contains a sequence of key-value pairs. // This affords storing a map in a specific sequence in the stream. // +// Example usage: +// type T1 []string // or []int or []Point or any other "slice" type +// func (_ T1) MapBySlice{} // T1 now implements MapBySlice, and will be encoded as a map +// type T2 struct { KeyValues T1 } +// +// var kvs = []string{"one", "1", "two", "2", "three", "3"} +// var v2 = T2{ KeyValues: T1(kvs) } +// // v2 will be encoded like the map: {"KeyValues": {"one": "1", "two": "2", "three": "3"} } +// // The support of MapBySlice affords the following: // - A slice type which implements MapBySlice will be encoded as a map // - A slice can be decoded from a map in the stream +// - It MUST be a slice type (not a pointer receiver) that implements MapBySlice type MapBySlice interface { MapBySlice() } -// WARNING: DO NOT USE DIRECTLY. EXPORTED FOR GODOC BENEFIT. WILL BE REMOVED. -// // BasicHandle encapsulates the common options and extension functions. +// +// Deprecated: DO NOT USE DIRECTLY. EXPORTED FOR GODOC BENEFIT. WILL BE REMOVED. type BasicHandle struct { + // BasicHandle is always a part of a different type. + // It doesn't have to fit into it own cache lines. + // TypeInfos is used to get the type info for any type. // // If not configured, the default TypeInfos is used, which uses struct tag keys: codec, json TypeInfos *TypeInfos + // Note: BasicHandle is not comparable, due to these slices here (extHandle, intf2impls). + // If *[]T is used instead, this becomes comparable, at the cost of extra indirection. + // Thses slices are used all the time, so keep as slices (not pointers). + extHandle - EncodeOptions + + intf2impls + + RPCOptions + + // ---- cache line + DecodeOptions + + // ---- cache line + + EncodeOptions + + // noBuiltInTypeChecker } func (x *BasicHandle) getBasicHandle() *BasicHandle { @@ -343,10 +455,10 @@ func (x *BasicHandle) getBasicHandle() *BasicHandle { } func (x *BasicHandle) getTypeInfo(rtid uintptr, rt reflect.Type) (pti *typeInfo) { - if x.TypeInfos != nil { - return x.TypeInfos.get(rtid, rt) + if x.TypeInfos == nil { + return defTypeInfos.get(rtid, rt) } - return defTypeInfos.get(rtid, rt) + return x.TypeInfos.get(rtid, rt) } // Handle is the interface for a specific encoding format. @@ -355,28 +467,36 @@ func (x *BasicHandle) getTypeInfo(rtid uintptr, rt reflect.Type) (pti *typeInfo) // and not modified while in use. Such a pre-configured Handle // is safe for concurrent access. type Handle interface { + Name() string getBasicHandle() *BasicHandle + recreateEncDriver(encDriver) bool newEncDriver(w *Encoder) encDriver newDecDriver(r *Decoder) decDriver isBinary() bool + hasElemSeparators() bool + // IsBuiltinType(rtid uintptr) bool } // Raw represents raw formatted bytes. -// We "blindly" store it during encode and store the raw bytes during decode. -// Note: it is dangerous during encode, so we may gate the behaviour behind an Encode flag which must be explicitly set. +// We "blindly" store it during encode and retrieve the raw bytes during decode. +// Note: it is dangerous during encode, so we may gate the behaviour +// behind an Encode flag which must be explicitly set. type Raw []byte // RawExt represents raw unprocessed extension data. -// Some codecs will decode extension data as a *RawExt if there is no registered extension for the tag. +// Some codecs will decode extension data as a *RawExt +// if there is no registered extension for the tag. // -// Only one of Data or Value is nil. If Data is nil, then the content of the RawExt is in the Value. +// Only one of Data or Value is nil. +// If Data is nil, then the content of the RawExt is in the Value. type RawExt struct { Tag uint64 - // Data is the []byte which represents the raw ext. If Data is nil, ext is exposed in Value. - // Data is used by codecs (e.g. binc, msgpack, simple) which do custom serialization of the types + // Data is the []byte which represents the raw ext. If nil, ext is exposed in Value. + // Data is used by codecs (e.g. binc, msgpack, simple) which do custom serialization of types Data []byte // Value represents the extension, if Data is nil. - // Value is used by codecs (e.g. cbor, json) which use the format to do custom serialization of the types. + // Value is used by codecs (e.g. cbor, json) which leverage the format to do + // custom serialization of the types. Value interface{} } @@ -385,24 +505,30 @@ type RawExt struct { type BytesExt interface { // WriteExt converts a value to a []byte. // - // Note: v *may* be a pointer to the extension type, if the extension type was a struct or array. + // Note: v is a pointer iff the registered extension type is a struct or array kind. WriteExt(v interface{}) []byte // ReadExt updates a value from a []byte. + // + // Note: dst is always a pointer kind to the registered extension type. ReadExt(dst interface{}, src []byte) } // InterfaceExt handles custom (de)serialization of types to/from another interface{} value. // The Encoder or Decoder will then handle the further (de)serialization of that known type. // -// It is used by codecs (e.g. cbor, json) which use the format to do custom serialization of the types. +// It is used by codecs (e.g. cbor, json) which use the format to do custom serialization of types. type InterfaceExt interface { - // ConvertExt converts a value into a simpler interface for easy encoding e.g. convert time.Time to int64. + // ConvertExt converts a value into a simpler interface for easy encoding + // e.g. convert time.Time to int64. // - // Note: v *may* be a pointer to the extension type, if the extension type was a struct or array. + // Note: v is a pointer iff the registered extension type is a struct or array kind. ConvertExt(v interface{}) interface{} - // UpdateExt updates a value from a simpler interface for easy decoding e.g. convert int64 to time.Time. + // UpdateExt updates a value from a simpler interface for easy decoding + // e.g. convert int64 to time.Time. + // + // Note: dst is always a pointer kind to the registered extension type. UpdateExt(dst interface{}, src interface{}) } @@ -440,64 +566,59 @@ func (x addExtWrapper) UpdateExt(dest interface{}, v interface{}) { x.ReadExt(dest, v.([]byte)) } -type setExtWrapper struct { - b BytesExt - i InterfaceExt +type extWrapper struct { + BytesExt + InterfaceExt } -func (x *setExtWrapper) WriteExt(v interface{}) []byte { - if x.b == nil { - panic("BytesExt.WriteExt is not supported") - } - return x.b.WriteExt(v) +type bytesExtFailer struct{} + +func (bytesExtFailer) WriteExt(v interface{}) []byte { + panicv.errorstr("BytesExt.WriteExt is not supported") + return nil +} +func (bytesExtFailer) ReadExt(v interface{}, bs []byte) { + panicv.errorstr("BytesExt.ReadExt is not supported") } -func (x *setExtWrapper) ReadExt(v interface{}, bs []byte) { - if x.b == nil { - panic("BytesExt.WriteExt is not supported") +type interfaceExtFailer struct{} - } - x.b.ReadExt(v, bs) +func (interfaceExtFailer) ConvertExt(v interface{}) interface{} { + panicv.errorstr("InterfaceExt.ConvertExt is not supported") + return nil } - -func (x *setExtWrapper) ConvertExt(v interface{}) interface{} { - if x.i == nil { - panic("InterfaceExt.ConvertExt is not supported") - - } - return x.i.ConvertExt(v) +func (interfaceExtFailer) UpdateExt(dest interface{}, v interface{}) { + panicv.errorstr("InterfaceExt.UpdateExt is not supported") } -func (x *setExtWrapper) UpdateExt(dest interface{}, v interface{}) { - if x.i == nil { - panic("InterfaceExxt.UpdateExt is not supported") - - } - x.i.UpdateExt(dest, v) -} - -// type errorString string -// func (x errorString) Error() string { return string(x) } - type binaryEncodingType struct{} -func (_ binaryEncodingType) isBinary() bool { return true } +func (binaryEncodingType) isBinary() bool { return true } type textEncodingType struct{} -func (_ textEncodingType) isBinary() bool { return false } +func (textEncodingType) isBinary() bool { return false } // noBuiltInTypes is embedded into many types which do not support builtins // e.g. msgpack, simple, cbor. + +// type noBuiltInTypeChecker struct{} +// func (noBuiltInTypeChecker) IsBuiltinType(rt uintptr) bool { return false } +// type noBuiltInTypes struct{ noBuiltInTypeChecker } + type noBuiltInTypes struct{} -func (_ noBuiltInTypes) IsBuiltinType(rt uintptr) bool { return false } -func (_ noBuiltInTypes) EncodeBuiltin(rt uintptr, v interface{}) {} -func (_ noBuiltInTypes) DecodeBuiltin(rt uintptr, v interface{}) {} +func (noBuiltInTypes) EncodeBuiltin(rt uintptr, v interface{}) {} +func (noBuiltInTypes) DecodeBuiltin(rt uintptr, v interface{}) {} -type noStreamingCodec struct{} +// type noStreamingCodec struct{} +// func (noStreamingCodec) CheckBreak() bool { return false } +// func (noStreamingCodec) hasElemSeparators() bool { return false } -func (_ noStreamingCodec) CheckBreak() bool { return false } +type noElemSeparators struct{} + +func (noElemSeparators) hasElemSeparators() (v bool) { return } +func (noElemSeparators) recreateEncDriver(e encDriver) (v bool) { return } // bigenHelper. // Users must already slice the x completely, because we will not reslice. @@ -522,165 +643,256 @@ func (z bigenHelper) writeUint64(v uint64) { } type extTypeTagFn struct { - rtid uintptr - rt reflect.Type - tag uint64 - ext Ext + rtid uintptr + rtidptr uintptr + rt reflect.Type + tag uint64 + ext Ext + _ [1]uint64 // padding } type extHandle []extTypeTagFn -// DEPRECATED: Use SetBytesExt or SetInterfaceExt on the Handle instead. -// // AddExt registes an encode and decode function for a reflect.Type. -// AddExt internally calls SetExt. // To deregister an Ext, call AddExt with nil encfn and/or nil decfn. -func (o *extHandle) AddExt( - rt reflect.Type, tag byte, - encfn func(reflect.Value) ([]byte, error), decfn func(reflect.Value, []byte) error, -) (err error) { +// +// Deprecated: Use SetBytesExt or SetInterfaceExt on the Handle instead. +func (o *extHandle) AddExt(rt reflect.Type, tag byte, + encfn func(reflect.Value) ([]byte, error), + decfn func(reflect.Value, []byte) error) (err error) { if encfn == nil || decfn == nil { return o.SetExt(rt, uint64(tag), nil) } return o.SetExt(rt, uint64(tag), addExtWrapper{encfn, decfn}) } -// DEPRECATED: Use SetBytesExt or SetInterfaceExt on the Handle instead. +// SetExt will set the extension for a tag and reflect.Type. +// Note that the type must be a named type, and specifically not a pointer or Interface. +// An error is returned if that is not honored. +// To Deregister an ext, call SetExt with nil Ext. // -// Note that the type must be a named type, and specifically not -// a pointer or Interface. An error is returned if that is not honored. -// -// To Deregister an ext, call SetExt with nil Ext +// Deprecated: Use SetBytesExt or SetInterfaceExt on the Handle instead. func (o *extHandle) SetExt(rt reflect.Type, tag uint64, ext Ext) (err error) { // o is a pointer, because we may need to initialize it - if rt.PkgPath() == "" || rt.Kind() == reflect.Interface { - err = fmt.Errorf("codec.Handle.AddExt: Takes named type, not a pointer or interface: %T", - reflect.Zero(rt).Interface()) - return + rk := rt.Kind() + for rk == reflect.Ptr { + rt = rt.Elem() + rk = rt.Kind() } - rtid := reflect.ValueOf(rt).Pointer() - for _, v := range *o { + if rt.PkgPath() == "" || rk == reflect.Interface { // || rk == reflect.Ptr { + return fmt.Errorf("codec.Handle.SetExt: Takes named type, not a pointer or interface: %v", rt) + } + + rtid := rt2id(rt) + switch rtid { + case timeTypId, rawTypId, rawExtTypId: + // all natively supported type, so cannot have an extension + return // TODO: should we silently ignore, or return an error??? + } + // if o == nil { + // return errors.New("codec.Handle.SetExt: extHandle not initialized") + // } + o2 := *o + // if o2 == nil { + // return errors.New("codec.Handle.SetExt: extHandle not initialized") + // } + for i := range o2 { + v := &o2[i] if v.rtid == rtid { v.tag, v.ext = tag, ext return } } - - if *o == nil { - *o = make([]extTypeTagFn, 0, 4) - } - *o = append(*o, extTypeTagFn{rtid, rt, tag, ext}) + rtidptr := rt2id(reflect.PtrTo(rt)) + *o = append(o2, extTypeTagFn{rtid, rtidptr, rt, tag, ext, [1]uint64{}}) return } -func (o extHandle) getExt(rtid uintptr) *extTypeTagFn { - var v *extTypeTagFn +func (o extHandle) getExt(rtid uintptr) (v *extTypeTagFn) { for i := range o { v = &o[i] - if v.rtid == rtid { - return v + if v.rtid == rtid || v.rtidptr == rtid { + return } } return nil } -func (o extHandle) getExtForTag(tag uint64) *extTypeTagFn { - var v *extTypeTagFn +func (o extHandle) getExtForTag(tag uint64) (v *extTypeTagFn) { for i := range o { v = &o[i] if v.tag == tag { - return v + return } } return nil } +type intf2impl struct { + rtid uintptr // for intf + impl reflect.Type + // _ [1]uint64 // padding // not-needed, as *intf2impl is never returned. +} + +type intf2impls []intf2impl + +// Intf2Impl maps an interface to an implementing type. +// This allows us support infering the concrete type +// and populating it when passed an interface. +// e.g. var v io.Reader can be decoded as a bytes.Buffer, etc. +// +// Passing a nil impl will clear the mapping. +func (o *intf2impls) Intf2Impl(intf, impl reflect.Type) (err error) { + if impl != nil && !impl.Implements(intf) { + return fmt.Errorf("Intf2Impl: %v does not implement %v", impl, intf) + } + rtid := rt2id(intf) + o2 := *o + for i := range o2 { + v := &o2[i] + if v.rtid == rtid { + v.impl = impl + return + } + } + *o = append(o2, intf2impl{rtid, impl}) + return +} + +func (o intf2impls) intf2impl(rtid uintptr) (rv reflect.Value) { + for i := range o { + v := &o[i] + if v.rtid == rtid { + if v.impl == nil { + return + } + if v.impl.Kind() == reflect.Ptr { + return reflect.New(v.impl.Elem()) + } + return reflect.New(v.impl).Elem() + } + } + return +} + +type structFieldInfoFlag uint8 + +const ( + _ structFieldInfoFlag = 1 << iota + structFieldInfoFlagReady + structFieldInfoFlagOmitEmpty +) + +func (x *structFieldInfoFlag) flagSet(f structFieldInfoFlag) { + *x = *x | f +} + +func (x *structFieldInfoFlag) flagClr(f structFieldInfoFlag) { + *x = *x &^ f +} + +func (x structFieldInfoFlag) flagGet(f structFieldInfoFlag) bool { + return x&f != 0 +} + +func (x structFieldInfoFlag) omitEmpty() bool { + return x.flagGet(structFieldInfoFlagOmitEmpty) +} + +func (x structFieldInfoFlag) ready() bool { + return x.flagGet(structFieldInfoFlagReady) +} + type structFieldInfo struct { encName string // encode name fieldName string // field name - // only one of 'i' or 'is' can be set. If 'i' is -1, then 'is' has been set. - - is []int // (recursive/embedded) field index in struct - i int16 // field index in struct - omitEmpty bool - toArray bool // if field is _struct, is the toArray set? -} - -// func (si *structFieldInfo) isZero() bool { -// return si.encName == "" && len(si.is) == 0 && si.i == 0 && !si.omitEmpty && !si.toArray -// } - -// rv returns the field of the struct. -// If anonymous, it returns an Invalid -func (si *structFieldInfo) field(v reflect.Value, update bool) (rv2 reflect.Value) { - if si.i != -1 { - v = v.Field(int(si.i)) - return v - } - // replicate FieldByIndex - for _, x := range si.is { - for v.Kind() == reflect.Ptr { - if v.IsNil() { - if !update { - return - } - v.Set(reflect.New(v.Type().Elem())) - } - v = v.Elem() - } - v = v.Field(x) - } - return v + is [maxLevelsEmbedding]uint16 // (recursive/embedded) field index in struct + nis uint8 // num levels of embedding. if 1, then it's not embedded. + structFieldInfoFlag } func (si *structFieldInfo) setToZeroValue(v reflect.Value) { - if si.i != -1 { - v = v.Field(int(si.i)) - v.Set(reflect.Zero(v.Type())) - // v.Set(reflect.New(v.Type()).Elem()) - // v.Set(reflect.New(v.Type())) - } else { - // replicate FieldByIndex - for _, x := range si.is { - for v.Kind() == reflect.Ptr { - if v.IsNil() { - return - } - v = v.Elem() - } - v = v.Field(x) - } + if v, valid := si.field(v, false); valid { v.Set(reflect.Zero(v.Type())) } } -func parseStructFieldInfo(fname string, stag string) *structFieldInfo { - // if fname == "" { - // panic(noFieldNameToStructFieldInfoErr) - // } - si := structFieldInfo{ - encName: fname, +// rv returns the field of the struct. +// If anonymous, it returns an Invalid +func (si *structFieldInfo) field(v reflect.Value, update bool) (rv2 reflect.Value, valid bool) { + // replicate FieldByIndex + for i, x := range si.is { + if uint8(i) == si.nis { + break + } + if v, valid = baseStructRv(v, update); !valid { + return + } + v = v.Field(int(x)) } - if stag != "" { - for i, s := range strings.Split(stag, ",") { - if i == 0 { - if s != "" { - si.encName = s - } - } else { - if s == "omitempty" { - si.omitEmpty = true - } else if s == "toarray" { - si.toArray = true - } + return v, true +} + +// func (si *structFieldInfo) fieldval(v reflect.Value, update bool) reflect.Value { +// v, _ = si.field(v, update) +// return v +// } + +func parseStructInfo(stag string) (toArray, omitEmpty bool, keytype valueType) { + keytype = valueTypeString // default + if stag == "" { + return + } + for i, s := range strings.Split(stag, ",") { + if i == 0 { + } else { + switch s { + case "omitempty": + omitEmpty = true + case "toarray": + toArray = true + case "int": + keytype = valueTypeInt + case "uint": + keytype = valueTypeUint + case "float": + keytype = valueTypeFloat + // case "bool": + // keytype = valueTypeBool + case "string": + keytype = valueTypeString + } + } + } + return +} + +func (si *structFieldInfo) parseTag(stag string) { + // if fname == "" { + // panic(errNoFieldNameToStructFieldInfo) + // } + + if stag == "" { + return + } + for i, s := range strings.Split(stag, ",") { + if i == 0 { + if s != "" { + si.encName = s + } + } else { + switch s { + case "omitempty": + si.flagSet(structFieldInfoFlagOmitEmpty) + // si.omitEmpty = true + // case "toarray": + // si.toArray = true } } } - // si.encNameBs = []byte(si.encName) - return &si } type sfiSortedByEncName []*structFieldInfo @@ -697,7 +909,105 @@ func (p sfiSortedByEncName) Swap(i, j int) { p[i], p[j] = p[j], p[i] } -// typeInfo keeps information about each type referenced in the encode/decode sequence. +const structFieldNodeNumToCache = 4 + +type structFieldNodeCache struct { + rv [structFieldNodeNumToCache]reflect.Value + idx [structFieldNodeNumToCache]uint32 + num uint8 +} + +func (x *structFieldNodeCache) get(key uint32) (fv reflect.Value, valid bool) { + for i, k := range &x.idx { + if uint8(i) == x.num { + return // break + } + if key == k { + return x.rv[i], true + } + } + return +} + +func (x *structFieldNodeCache) tryAdd(fv reflect.Value, key uint32) { + if x.num < structFieldNodeNumToCache { + x.rv[x.num] = fv + x.idx[x.num] = key + x.num++ + return + } +} + +type structFieldNode struct { + v reflect.Value + cache2 structFieldNodeCache + cache3 structFieldNodeCache + update bool +} + +func (x *structFieldNode) field(si *structFieldInfo) (fv reflect.Value) { + // return si.fieldval(x.v, x.update) + // Note: we only cache if nis=2 or nis=3 i.e. up to 2 levels of embedding + // This mostly saves us time on the repeated calls to v.Elem, v.Field, etc. + var valid bool + switch si.nis { + case 1: + fv = x.v.Field(int(si.is[0])) + case 2: + if fv, valid = x.cache2.get(uint32(si.is[0])); valid { + fv = fv.Field(int(si.is[1])) + return + } + fv = x.v.Field(int(si.is[0])) + if fv, valid = baseStructRv(fv, x.update); !valid { + return + } + x.cache2.tryAdd(fv, uint32(si.is[0])) + fv = fv.Field(int(si.is[1])) + case 3: + var key uint32 = uint32(si.is[0])<<16 | uint32(si.is[1]) + if fv, valid = x.cache3.get(key); valid { + fv = fv.Field(int(si.is[2])) + return + } + fv = x.v.Field(int(si.is[0])) + if fv, valid = baseStructRv(fv, x.update); !valid { + return + } + fv = fv.Field(int(si.is[1])) + if fv, valid = baseStructRv(fv, x.update); !valid { + return + } + x.cache3.tryAdd(fv, key) + fv = fv.Field(int(si.is[2])) + default: + fv, _ = si.field(x.v, x.update) + } + return +} + +func baseStructRv(v reflect.Value, update bool) (v2 reflect.Value, valid bool) { + for v.Kind() == reflect.Ptr { + if v.IsNil() { + if !update { + return + } + v.Set(reflect.New(v.Type().Elem())) + } + v = v.Elem() + } + return v, true +} + +type typeInfoFlag uint8 + +const ( + typeInfoFlagComparable = 1 << iota + typeInfoFlagIsZeroer + typeInfoFlagIsZeroerPtr +) + +// typeInfo keeps information about each (non-ptr) type referenced in the encode/decode sequence. // // During an encode/decode sequence, we work as below: // - If base is a built in type, en/decode base value @@ -706,70 +1016,82 @@ func (p sfiSortedByEncName) Swap(i, j int) { // - If type is text(M/Unm)arshaler, call Text(M/Unm)arshal method // - Else decode appropriately based on the reflect.Kind type typeInfo struct { - sfi []*structFieldInfo // sorted. Used when enc/dec struct to map. - sfip []*structFieldInfo // unsorted. Used when enc/dec struct to array. + rt reflect.Type + elem reflect.Type + pkgpath string - rt reflect.Type rtid uintptr + // rv0 reflect.Value // saved zero value, used if immutableKind numMeth uint16 // number of methods + kind uint8 + chandir uint8 - // baseId gives pointer to the base reflect.Type, after deferencing - // the pointers. E.g. base type of ***time.Time is time.Time. - base reflect.Type - baseId uintptr - baseIndir int8 // number of indirections to get to base + anyOmitEmpty bool // true if a struct, and any of the fields are tagged "omitempty" + toArray bool // whether this (struct) type should be encoded as an array + keyType valueType // if struct, how is the field name stored in a stream? default is string + mbs bool // base type (T or *T) is a MapBySlice - mbs bool // base type (T or *T) is a MapBySlice + // ---- cpu cache line boundary? + sfiSort []*structFieldInfo // sorted. Used when enc/dec struct to map. + sfiSrc []*structFieldInfo // unsorted. Used when enc/dec struct to array. - bm bool // base type (T or *T) is a binaryMarshaler - bunm bool // base type (T or *T) is a binaryUnmarshaler - bmIndir int8 // number of indirections to get to binaryMarshaler type - bunmIndir int8 // number of indirections to get to binaryUnmarshaler type + key reflect.Type - tm bool // base type (T or *T) is a textMarshaler - tunm bool // base type (T or *T) is a textUnmarshaler - tmIndir int8 // number of indirections to get to textMarshaler type - tunmIndir int8 // number of indirections to get to textUnmarshaler type + // ---- cpu cache line boundary? + // sfis []structFieldInfo // all sfi, in src order, as created. + sfiNamesSort []byte // all names, with indexes into the sfiSort - jm bool // base type (T or *T) is a jsonMarshaler - junm bool // base type (T or *T) is a jsonUnmarshaler - jmIndir int8 // number of indirections to get to jsonMarshaler type - junmIndir int8 // number of indirections to get to jsonUnmarshaler type + // format of marshal type fields below: [btj][mu]p? OR csp? - cs bool // base type (T or *T) is a Selfer - csIndir int8 // number of indirections to get to Selfer type + bm bool // T is a binaryMarshaler + bmp bool // *T is a binaryMarshaler + bu bool // T is a binaryUnmarshaler + bup bool // *T is a binaryUnmarshaler + tm bool // T is a textMarshaler + tmp bool // *T is a textMarshaler + tu bool // T is a textUnmarshaler + tup bool // *T is a textUnmarshaler - toArray bool // whether this (struct) type should be encoded as an array + jm bool // T is a jsonMarshaler + jmp bool // *T is a jsonMarshaler + ju bool // T is a jsonUnmarshaler + jup bool // *T is a jsonUnmarshaler + cs bool // T is a Selfer + csp bool // *T is a Selfer + + // other flags, with individual bits representing if set. + flags typeInfoFlag + + // _ [2]byte // padding + _ [3]uint64 // padding } -func (ti *typeInfo) indexForEncName(name string) int { - // NOTE: name may be a stringView, so don't pass it to another function. - //tisfi := ti.sfi - const binarySearchThreshold = 16 - if sfilen := len(ti.sfi); sfilen < binarySearchThreshold { - // linear search. faster than binary search in my testing up to 16-field structs. - for i, si := range ti.sfi { - if si.encName == name { - return i - } - } +func (ti *typeInfo) isFlag(f typeInfoFlag) bool { + return ti.flags&f != 0 +} + +func (ti *typeInfo) indexForEncName(name []byte) (index int16) { + var sn []byte + if len(name)+2 <= 32 { + var buf [32]byte // should not escape + sn = buf[:len(name)+2] } else { - // binary search. adapted from sort/search.go. - h, i, j := 0, 0, sfilen - for i < j { - h = i + (j-i)/2 - if ti.sfi[h].encName < name { - i = h + 1 - } else { - j = h - } - } - if i < sfilen && ti.sfi[i].encName == name { - return i - } + sn = make([]byte, len(name)+2) } - return -1 + copy(sn[1:], name) + sn[0], sn[len(sn)-1] = tiSep2(name), 0xff + j := bytes.Index(ti.sfiNamesSort, sn) + if j < 0 { + return -1 + } + index = int16(uint16(ti.sfiNamesSort[j+len(sn)+1]) | uint16(ti.sfiNamesSort[j+len(sn)])<<8) + return +} + +type rtid2ti struct { + rtid uintptr + ti *typeInfo } // TypeInfos caches typeInfo for each type on first inspection. @@ -777,9 +1099,11 @@ func (ti *typeInfo) indexForEncName(name string) int { // It is configured with a set of tag keys, which are used to get // configuration for the type. type TypeInfos struct { - infos map[uintptr]*typeInfo - mu sync.RWMutex + // infos: formerly map[uintptr]*typeInfo, now *[]rtid2ti, 2 words expected + infos atomicTypeInfoSlice + mu sync.Mutex tags []string + _ [2]uint64 // padding } // NewTypeInfos creates a TypeInfos given a set of struct tags keys. @@ -787,7 +1111,7 @@ type TypeInfos struct { // This allows users customize the struct tag keys which contain configuration // of their types. func NewTypeInfos(tags []string) *TypeInfos { - return &TypeInfos{tags: tags, infos: make(map[uintptr]*typeInfo, 64)} + return &TypeInfos{tags: tags} } func (x *TypeInfos) structTag(t reflect.StructTag) (s string) { @@ -802,91 +1126,124 @@ func (x *TypeInfos) structTag(t reflect.StructTag) (s string) { return } +func (x *TypeInfos) find(s []rtid2ti, rtid uintptr) (idx int, ti *typeInfo) { + // binary search. adapted from sort/search.go. + // if sp == nil { + // return -1, nil + // } + // s := *sp + h, i, j := 0, 0, len(s) + for i < j { + h = i + (j-i)/2 + if s[h].rtid < rtid { + i = h + 1 + } else { + j = h + } + } + if i < len(s) && s[i].rtid == rtid { + return i, s[i].ti + } + return i, nil +} + func (x *TypeInfos) get(rtid uintptr, rt reflect.Type) (pti *typeInfo) { - var ok bool - x.mu.RLock() - pti, ok = x.infos[rtid] - x.mu.RUnlock() - if ok { - return + sp := x.infos.load() + var idx int + if sp != nil { + idx, pti = x.find(sp, rtid) + if pti != nil { + return + } + } + + rk := rt.Kind() + + if rk == reflect.Ptr { // || (rk == reflect.Interface && rtid != intfTypId) { + panicv.errorf("invalid kind passed to TypeInfos.get: %v - %v", rk, rt) } // do not hold lock while computing this. // it may lead to duplication, but that's ok. - ti := typeInfo{rt: rt, rtid: rtid} + ti := typeInfo{rt: rt, rtid: rtid, kind: uint8(rk), pkgpath: rt.PkgPath()} + // ti.rv0 = reflect.Zero(rt) + + // ti.comparable = rt.Comparable() ti.numMeth = uint16(rt.NumMethod()) - var indir int8 - if ok, indir = implementsIntf(rt, binaryMarshalerTyp); ok { - ti.bm, ti.bmIndir = true, indir + ti.bm, ti.bmp = implIntf(rt, binaryMarshalerTyp) + ti.bu, ti.bup = implIntf(rt, binaryUnmarshalerTyp) + ti.tm, ti.tmp = implIntf(rt, textMarshalerTyp) + ti.tu, ti.tup = implIntf(rt, textUnmarshalerTyp) + ti.jm, ti.jmp = implIntf(rt, jsonMarshalerTyp) + ti.ju, ti.jup = implIntf(rt, jsonUnmarshalerTyp) + ti.cs, ti.csp = implIntf(rt, selferTyp) + + b1, b2 := implIntf(rt, iszeroTyp) + if b1 { + ti.flags |= typeInfoFlagIsZeroer } - if ok, indir = implementsIntf(rt, binaryUnmarshalerTyp); ok { - ti.bunm, ti.bunmIndir = true, indir + if b2 { + ti.flags |= typeInfoFlagIsZeroerPtr } - if ok, indir = implementsIntf(rt, textMarshalerTyp); ok { - ti.tm, ti.tmIndir = true, indir - } - if ok, indir = implementsIntf(rt, textUnmarshalerTyp); ok { - ti.tunm, ti.tunmIndir = true, indir - } - if ok, indir = implementsIntf(rt, jsonMarshalerTyp); ok { - ti.jm, ti.jmIndir = true, indir - } - if ok, indir = implementsIntf(rt, jsonUnmarshalerTyp); ok { - ti.junm, ti.junmIndir = true, indir - } - if ok, indir = implementsIntf(rt, selferTyp); ok { - ti.cs, ti.csIndir = true, indir - } - if ok, _ = implementsIntf(rt, mapBySliceTyp); ok { - ti.mbs = true + if rt.Comparable() { + ti.flags |= typeInfoFlagComparable } - pt := rt - var ptIndir int8 - // for ; pt.Kind() == reflect.Ptr; pt, ptIndir = pt.Elem(), ptIndir+1 { } - for pt.Kind() == reflect.Ptr { - pt = pt.Elem() - ptIndir++ - } - if ptIndir == 0 { - ti.base = rt - ti.baseId = rtid - } else { - ti.base = pt - ti.baseId = reflect.ValueOf(pt).Pointer() - ti.baseIndir = ptIndir - } - - if rt.Kind() == reflect.Struct { + switch rk { + case reflect.Struct: var omitEmpty bool if f, ok := rt.FieldByName(structInfoFieldName); ok { - siInfo := parseStructFieldInfo(structInfoFieldName, x.structTag(f.Tag)) - ti.toArray = siInfo.toArray - omitEmpty = siInfo.omitEmpty + ti.toArray, omitEmpty, ti.keyType = parseStructInfo(x.structTag(f.Tag)) + } else { + ti.keyType = valueTypeString } - pi := rgetPool.Get() - pv := pi.(*rgetPoolT) - pv.etypes[0] = ti.baseId - vv := rgetT{pv.fNames[:0], pv.encNames[:0], pv.etypes[:1], pv.sfis[:0]} + pp, pi := pool.tiLoad() + pv := pi.(*typeInfoLoadArray) + pv.etypes[0] = ti.rtid + // vv := typeInfoLoad{pv.fNames[:0], pv.encNames[:0], pv.etypes[:1], pv.sfis[:0]} + vv := typeInfoLoad{pv.etypes[:1], pv.sfis[:0]} x.rget(rt, rtid, omitEmpty, nil, &vv) - ti.sfip, ti.sfi = rgetResolveSFI(vv.sfis, pv.sfiidx[:0]) - rgetPool.Put(pi) + // ti.sfis = vv.sfis + ti.sfiSrc, ti.sfiSort, ti.sfiNamesSort, ti.anyOmitEmpty = rgetResolveSFI(rt, vv.sfis, pv) + pp.Put(pi) + case reflect.Map: + ti.elem = rt.Elem() + ti.key = rt.Key() + case reflect.Slice: + ti.mbs, _ = implIntf(rt, mapBySliceTyp) + ti.elem = rt.Elem() + case reflect.Chan: + ti.elem = rt.Elem() + ti.chandir = uint8(rt.ChanDir()) + case reflect.Array, reflect.Ptr: + ti.elem = rt.Elem() } - // sfi = sfip + // sfi = sfiSrc x.mu.Lock() - if pti, ok = x.infos[rtid]; !ok { + sp = x.infos.load() + if sp == nil { pti = &ti - x.infos[rtid] = pti + vs := []rtid2ti{{rtid, pti}} + x.infos.store(vs) + } else { + idx, pti = x.find(sp, rtid) + if pti == nil { + pti = &ti + vs := make([]rtid2ti, len(sp)+1) + copy(vs, sp[:idx]) + copy(vs[idx+1:], sp[idx:]) + vs[idx] = rtid2ti{rtid, pti} + x.infos.store(vs) + } } x.mu.Unlock() return } func (x *TypeInfos) rget(rt reflect.Type, rtid uintptr, omitEmpty bool, - indexstack []int, pv *rgetT, -) { + indexstack []uint16, pv *typeInfoLoad) { // Read up fields and store how to access the value. // // It uses go's rules for message selectors, @@ -895,10 +1252,15 @@ func (x *TypeInfos) rget(rt reflect.Type, rtid uintptr, omitEmpty bool, // Note: we consciously use slices, not a map, to simulate a set. // Typically, types have < 16 fields, // and iteration using equals is faster than maps there - + flen := rt.NumField() + if flen > (1< %v fields are not supported - has %v fields", + (1< maxLevelsEmbedding-1 { + panicv.errorf("codec: only supports up to %v depth of embedding - type has %v depth", + maxLevelsEmbedding-1, len(indexstack)) } + si.nis = uint8(len(indexstack)) + 1 + copy(si.is[:], indexstack) + si.is[len(indexstack)] = j if omitEmpty { - si.omitEmpty = true + si.flagSet(structFieldInfoFlagOmitEmpty) } pv.sfis = append(pv.sfis, si) } } +func tiSep(name string) uint8 { + // (xn[0]%64) // (between 192-255 - outside ascii BMP) + // return 0xfe - (name[0] & 63) + // return 0xfe - (name[0] & 63) - uint8(len(name)) + // return 0xfe - (name[0] & 63) - uint8(len(name)&63) + // return ((0xfe - (name[0] & 63)) & 0xf8) | (uint8(len(name) & 0x07)) + return 0xfe - (name[0] & 63) - uint8(len(name)&63) +} + +func tiSep2(name []byte) uint8 { + return 0xfe - (name[0] & 63) - uint8(len(name)&63) +} + // resolves the struct field info got from a call to rget. // Returns a trimmed, unsorted and sorted []*structFieldInfo. -func rgetResolveSFI(x []*structFieldInfo, pv []sfiIdx) (y, z []*structFieldInfo) { - var n int - for i, v := range x { - xn := v.encName //TODO: fieldName or encName? use encName for now. - var found bool - for j, k := range pv { - if k.name == xn { - // one of them must be reset to nil, and the index updated appropriately to the other one - if len(v.is) == len(x[k.index].is) { - } else if len(v.is) < len(x[k.index].is) { - pv[j].index = i - if x[k.index] != nil { - x[k.index] = nil - n++ - } - } else { - if x[i] != nil { - x[i] = nil - n++ - } +func rgetResolveSFI(rt reflect.Type, x []structFieldInfo, pv *typeInfoLoadArray) ( + y, z []*structFieldInfo, ss []byte, anyOmitEmpty bool) { + sa := pv.sfiidx[:0] + sn := pv.b[:] + n := len(x) + + var xn string + var ui uint16 + var sep byte + + for i := range x { + ui = uint16(i) + xn = x[i].encName // fieldName or encName? use encName for now. + if len(xn)+2 > cap(pv.b) { + sn = make([]byte, len(xn)+2) + } else { + sn = sn[:len(xn)+2] + } + // use a custom sep, so that misses are less frequent, + // since the sep (first char in search) is as unique as first char in field name. + sep = tiSep(xn) + sn[0], sn[len(sn)-1] = sep, 0xff + copy(sn[1:], xn) + j := bytes.Index(sa, sn) + if j == -1 { + sa = append(sa, sep) + sa = append(sa, xn...) + sa = append(sa, 0xff, byte(ui>>8), byte(ui)) + } else { + index := uint16(sa[j+len(sn)+1]) | uint16(sa[j+len(sn)])<<8 + // one of them must be reset to nil, + // and the index updated appropriately to the other one + if x[i].nis == x[index].nis { + } else if x[i].nis < x[index].nis { + sa[j+len(sn)], sa[j+len(sn)+1] = byte(ui>>8), byte(ui) + if x[index].ready() { + x[index].flagClr(structFieldInfoFlagReady) + n-- + } + } else { + if x[i].ready() { + x[i].flagClr(structFieldInfoFlagReady) + n-- } - found = true - break } } - if !found { - pv = append(pv, sfiIdx{xn, i}) - } + + } + var w []structFieldInfo + sharingArray := len(x) <= typeInfoLoadArraySfisLen // sharing array with typeInfoLoadArray + if sharingArray { + w = make([]structFieldInfo, n) } - // remove all the nils - y = make([]*structFieldInfo, len(x)-n) + // remove all the nils (non-ready) + y = make([]*structFieldInfo, n) n = 0 - for _, v := range x { - if v == nil { + var sslen int + for i := range x { + if !x[i].ready() { continue } - y[n] = v + if !anyOmitEmpty && x[i].omitEmpty() { + anyOmitEmpty = true + } + if sharingArray { + w[n] = x[i] + y[n] = &w[n] + } else { + y[n] = &x[i] + } + sslen = sslen + len(x[i].encName) + 4 n++ } + if n != len(y) { + panicv.errorf("failure reading struct %v - expecting %d of %d valid fields, got %d", + rt, len(y), len(x), n) + } z = make([]*structFieldInfo, len(y)) copy(z, y) sort.Sort(sfiSortedByEncName(z)) + + sharingArray = len(sa) <= typeInfoLoadArraySfiidxLen + if sharingArray { + ss = make([]byte, 0, sslen) + } else { + ss = sa[:0] // reuse the newly made sa array if necessary + } + for i := range z { + xn = z[i].encName + sep = tiSep(xn) + ui = uint16(i) + ss = append(ss, sep) + ss = append(ss, xn...) + ss = append(ss, 0xff, byte(ui>>8), byte(ui)) + } return } -func panicToErr(err *error) { +func implIntf(rt, iTyp reflect.Type) (base bool, indir bool) { + return rt.Implements(iTyp), reflect.PtrTo(rt).Implements(iTyp) +} + +// isEmptyStruct is only called from isEmptyValue, and checks if a struct is empty: +// - does it implement IsZero() bool +// - is it comparable, and can i compare directly using == +// - if checkStruct, then walk through the encodable fields +// and check if they are empty or not. +func isEmptyStruct(v reflect.Value, tinfos *TypeInfos, deref, checkStruct bool) bool { + // v is a struct kind - no need to check again. + // We only check isZero on a struct kind, to reduce the amount of times + // that we lookup the rtid and typeInfo for each type as we walk the tree. + + vt := v.Type() + rtid := rt2id(vt) + if tinfos == nil { + tinfos = defTypeInfos + } + ti := tinfos.get(rtid, vt) + if ti.rtid == timeTypId { + return rv2i(v).(time.Time).IsZero() + } + if ti.isFlag(typeInfoFlagIsZeroerPtr) && v.CanAddr() { + return rv2i(v.Addr()).(isZeroer).IsZero() + } + if ti.isFlag(typeInfoFlagIsZeroer) { + return rv2i(v).(isZeroer).IsZero() + } + if ti.isFlag(typeInfoFlagComparable) { + return rv2i(v) == rv2i(reflect.Zero(vt)) + } + if !checkStruct { + return false + } + // We only care about what we can encode/decode, + // so that is what we use to check omitEmpty. + for _, si := range ti.sfiSrc { + sfv, valid := si.field(v, false) + if valid && !isEmptyValue(sfv, tinfos, deref, checkStruct) { + return false + } + } + return true +} + +// func roundFloat(x float64) float64 { +// t := math.Trunc(x) +// if math.Abs(x-t) >= 0.5 { +// return t + math.Copysign(1, x) +// } +// return t +// } + +func panicToErr(h errstrDecorator, err *error) { if recoverPanicToErr { if x := recover(); x != nil { - //debug.PrintStack() - panicValToErr(x, err) + // fmt.Printf("panic'ing with: %v\n", x) + // debug.PrintStack() + panicValToErr(h, x, err) } } } -// func doPanic(tag string, format string, params ...interface{}) { -// params2 := make([]interface{}, len(params)+1) -// params2[0] = tag -// copy(params2[1:], params) -// panic(fmt.Errorf("%s: "+format, params2...)) -// } +func panicToErrs2(h errstrDecorator, err1, err2 *error) { + if recoverPanicToErr { + if x := recover(); x != nil { + panicValToErr(h, x, err1) + panicValToErr(h, x, err2) + } + } +} + +func panicValToErr(h errstrDecorator, v interface{}, err *error) { + switch xerr := v.(type) { + case nil: + case error: + switch xerr { + case nil: + case io.EOF, io.ErrUnexpectedEOF, errEncoderNotInitialized, errDecoderNotInitialized: + // treat as special (bubble up) + *err = xerr + default: + h.wrapErrstr(xerr.Error(), err) + } + case string: + if xerr != "" { + h.wrapErrstr(xerr, err) + } + case fmt.Stringer: + if xerr != nil { + h.wrapErrstr(xerr.String(), err) + } + default: + h.wrapErrstr(v, err) + } +} func isImmutableKind(k reflect.Kind) (v bool) { - return false || - k == reflect.Int || - k == reflect.Int8 || - k == reflect.Int16 || - k == reflect.Int32 || - k == reflect.Int64 || - k == reflect.Uint || - k == reflect.Uint8 || - k == reflect.Uint16 || - k == reflect.Uint32 || - k == reflect.Uint64 || - k == reflect.Uintptr || - k == reflect.Float32 || - k == reflect.Float64 || - k == reflect.Bool || - k == reflect.String + return immutableKindsSet[k] } -// these functions must be inlinable, and not call anybody +// ---- + +type codecFnInfo struct { + ti *typeInfo + xfFn Ext + xfTag uint64 + seq seqType + addrD bool + addrF bool // if addrD, this says whether decode function can take a value or a ptr + addrE bool + ready bool // ready to use +} + +// codecFn encapsulates the captured variables and the encode function. +// This way, we only do some calculations one times, and pass to the +// code block that should be called (encapsulated in a function) +// instead of executing the checks every time. +type codecFn struct { + i codecFnInfo + fe func(*Encoder, *codecFnInfo, reflect.Value) + fd func(*Decoder, *codecFnInfo, reflect.Value) + _ [1]uint64 // padding +} + +type codecRtidFn struct { + rtid uintptr + fn *codecFn +} + +type codecFner struct { + // hh Handle + h *BasicHandle + s []codecRtidFn + be bool + js bool + _ [6]byte // padding + _ [3]uint64 // padding +} + +func (c *codecFner) reset(hh Handle) { + bh := hh.getBasicHandle() + // only reset iff extensions changed or *TypeInfos changed + var hhSame = true && + c.h == bh && c.h.TypeInfos == bh.TypeInfos && + len(c.h.extHandle) == len(bh.extHandle) && + (len(c.h.extHandle) == 0 || &c.h.extHandle[0] == &bh.extHandle[0]) + if !hhSame { + // c.hh = hh + c.h, bh = bh, c.h // swap both + _, c.js = hh.(*JsonHandle) + c.be = hh.isBinary() + for i := range c.s { + c.s[i].fn.i.ready = false + } + } +} + +func (c *codecFner) get(rt reflect.Type, checkFastpath, checkCodecSelfer bool) (fn *codecFn) { + rtid := rt2id(rt) + + for _, x := range c.s { + if x.rtid == rtid { + // if rtid exists, then there's a *codenFn attached (non-nil) + fn = x.fn + if fn.i.ready { + return + } + break + } + } + var ti *typeInfo + if fn == nil { + fn = new(codecFn) + if c.s == nil { + c.s = make([]codecRtidFn, 0, 8) + } + c.s = append(c.s, codecRtidFn{rtid, fn}) + } else { + ti = fn.i.ti + *fn = codecFn{} + fn.i.ti = ti + // fn.fe, fn.fd = nil, nil + } + fi := &(fn.i) + fi.ready = true + if ti == nil { + ti = c.h.getTypeInfo(rtid, rt) + fi.ti = ti + } + + rk := reflect.Kind(ti.kind) + + if checkCodecSelfer && (ti.cs || ti.csp) { + fn.fe = (*Encoder).selferMarshal + fn.fd = (*Decoder).selferUnmarshal + fi.addrF = true + fi.addrD = ti.csp + fi.addrE = ti.csp + } else if rtid == timeTypId { + fn.fe = (*Encoder).kTime + fn.fd = (*Decoder).kTime + } else if rtid == rawTypId { + fn.fe = (*Encoder).raw + fn.fd = (*Decoder).raw + } else if rtid == rawExtTypId { + fn.fe = (*Encoder).rawExt + fn.fd = (*Decoder).rawExt + fi.addrF = true + fi.addrD = true + fi.addrE = true + } else if xfFn := c.h.getExt(rtid); xfFn != nil { + fi.xfTag, fi.xfFn = xfFn.tag, xfFn.ext + fn.fe = (*Encoder).ext + fn.fd = (*Decoder).ext + fi.addrF = true + fi.addrD = true + if rk == reflect.Struct || rk == reflect.Array { + fi.addrE = true + } + } else if supportMarshalInterfaces && c.be && (ti.bm || ti.bmp) && (ti.bu || ti.bup) { + fn.fe = (*Encoder).binaryMarshal + fn.fd = (*Decoder).binaryUnmarshal + fi.addrF = true + fi.addrD = ti.bup + fi.addrE = ti.bmp + } else if supportMarshalInterfaces && !c.be && c.js && (ti.jm || ti.jmp) && (ti.ju || ti.jup) { + //If JSON, we should check JSONMarshal before textMarshal + fn.fe = (*Encoder).jsonMarshal + fn.fd = (*Decoder).jsonUnmarshal + fi.addrF = true + fi.addrD = ti.jup + fi.addrE = ti.jmp + } else if supportMarshalInterfaces && !c.be && (ti.tm || ti.tmp) && (ti.tu || ti.tup) { + fn.fe = (*Encoder).textMarshal + fn.fd = (*Decoder).textUnmarshal + fi.addrF = true + fi.addrD = ti.tup + fi.addrE = ti.tmp + } else { + if fastpathEnabled && checkFastpath && (rk == reflect.Map || rk == reflect.Slice) { + if ti.pkgpath == "" { // un-named slice or map + if idx := fastpathAV.index(rtid); idx != -1 { + fn.fe = fastpathAV[idx].encfn + fn.fd = fastpathAV[idx].decfn + fi.addrD = true + fi.addrF = false + } + } else { + // use mapping for underlying type if there + var rtu reflect.Type + if rk == reflect.Map { + rtu = reflect.MapOf(ti.key, ti.elem) + } else { + rtu = reflect.SliceOf(ti.elem) + } + rtuid := rt2id(rtu) + if idx := fastpathAV.index(rtuid); idx != -1 { + xfnf := fastpathAV[idx].encfn + xrt := fastpathAV[idx].rt + fn.fe = func(e *Encoder, xf *codecFnInfo, xrv reflect.Value) { + xfnf(e, xf, xrv.Convert(xrt)) + } + fi.addrD = true + fi.addrF = false // meaning it can be an address(ptr) or a value + xfnf2 := fastpathAV[idx].decfn + fn.fd = func(d *Decoder, xf *codecFnInfo, xrv reflect.Value) { + if xrv.Kind() == reflect.Ptr { + xfnf2(d, xf, xrv.Convert(reflect.PtrTo(xrt))) + } else { + xfnf2(d, xf, xrv.Convert(xrt)) + } + } + } + } + } + if fn.fe == nil && fn.fd == nil { + switch rk { + case reflect.Bool: + fn.fe = (*Encoder).kBool + fn.fd = (*Decoder).kBool + case reflect.String: + fn.fe = (*Encoder).kString + fn.fd = (*Decoder).kString + case reflect.Int: + fn.fd = (*Decoder).kInt + fn.fe = (*Encoder).kInt + case reflect.Int8: + fn.fe = (*Encoder).kInt8 + fn.fd = (*Decoder).kInt8 + case reflect.Int16: + fn.fe = (*Encoder).kInt16 + fn.fd = (*Decoder).kInt16 + case reflect.Int32: + fn.fe = (*Encoder).kInt32 + fn.fd = (*Decoder).kInt32 + case reflect.Int64: + fn.fe = (*Encoder).kInt64 + fn.fd = (*Decoder).kInt64 + case reflect.Uint: + fn.fd = (*Decoder).kUint + fn.fe = (*Encoder).kUint + case reflect.Uint8: + fn.fe = (*Encoder).kUint8 + fn.fd = (*Decoder).kUint8 + case reflect.Uint16: + fn.fe = (*Encoder).kUint16 + fn.fd = (*Decoder).kUint16 + case reflect.Uint32: + fn.fe = (*Encoder).kUint32 + fn.fd = (*Decoder).kUint32 + case reflect.Uint64: + fn.fe = (*Encoder).kUint64 + fn.fd = (*Decoder).kUint64 + case reflect.Uintptr: + fn.fe = (*Encoder).kUintptr + fn.fd = (*Decoder).kUintptr + case reflect.Float32: + fn.fe = (*Encoder).kFloat32 + fn.fd = (*Decoder).kFloat32 + case reflect.Float64: + fn.fe = (*Encoder).kFloat64 + fn.fd = (*Decoder).kFloat64 + case reflect.Invalid: + fn.fe = (*Encoder).kInvalid + fn.fd = (*Decoder).kErr + case reflect.Chan: + fi.seq = seqTypeChan + fn.fe = (*Encoder).kSlice + fn.fd = (*Decoder).kSlice + case reflect.Slice: + fi.seq = seqTypeSlice + fn.fe = (*Encoder).kSlice + fn.fd = (*Decoder).kSlice + case reflect.Array: + fi.seq = seqTypeArray + fn.fe = (*Encoder).kSlice + fi.addrF = false + fi.addrD = false + rt2 := reflect.SliceOf(ti.elem) + fn.fd = func(d *Decoder, xf *codecFnInfo, xrv reflect.Value) { + d.cfer().get(rt2, true, false).fd(d, xf, xrv.Slice(0, xrv.Len())) + } + // fn.fd = (*Decoder).kArray + case reflect.Struct: + if ti.anyOmitEmpty { + fn.fe = (*Encoder).kStruct + } else { + fn.fe = (*Encoder).kStructNoOmitempty + } + fn.fd = (*Decoder).kStruct + case reflect.Map: + fn.fe = (*Encoder).kMap + fn.fd = (*Decoder).kMap + case reflect.Interface: + // encode: reflect.Interface are handled already by preEncodeValue + fn.fd = (*Decoder).kInterface + fn.fe = (*Encoder).kErr + default: + // reflect.Ptr and reflect.Interface are handled already by preEncodeValue + fn.fe = (*Encoder).kErr + fn.fd = (*Decoder).kErr + } + } + } + return +} + +type codecFnPooler struct { + cf *codecFner + cfp *sync.Pool + hh Handle +} + +func (d *codecFnPooler) cfer() *codecFner { + if d.cf == nil { + var v interface{} + d.cfp, v = pool.codecFner() + d.cf = v.(*codecFner) + d.cf.reset(d.hh) + } + return d.cf +} + +func (d *codecFnPooler) alwaysAtEnd() { + if d.cf != nil { + d.cfp.Put(d.cf) + d.cf, d.cfp = nil, nil + } +} + +// ---- + +// these "checkOverflow" functions must be inlinable, and not call anybody. +// Overflow means that the value cannot be represented without wrapping/overflow. +// Overflow=false does not mean that the value can be represented without losing precision +// (especially for floating point). + type checkOverflow struct{} -func (_ checkOverflow) Float32(f float64) (overflow bool) { - if f < 0 { - f = -f - } - return math.MaxFloat32 < f && f <= math.MaxFloat64 -} +// func (checkOverflow) Float16(f float64) (overflow bool) { +// panicv.errorf("unimplemented") +// if f < 0 { +// f = -f +// } +// return math.MaxFloat32 < f && f <= math.MaxFloat64 +// } -func (_ checkOverflow) Uint(v uint64, bitsize uint8) (overflow bool) { +func (checkOverflow) Float32(v float64) (overflow bool) { + if v < 0 { + v = -v + } + return math.MaxFloat32 < v && v <= math.MaxFloat64 +} +func (checkOverflow) Uint(v uint64, bitsize uint8) (overflow bool) { if bitsize == 0 || bitsize >= 64 || v == 0 { return } @@ -1102,8 +1912,7 @@ func (_ checkOverflow) Uint(v uint64, bitsize uint8) (overflow bool) { } return } - -func (_ checkOverflow) Int(v int64, bitsize uint8) (overflow bool) { +func (checkOverflow) Int(v int64, bitsize uint8) (overflow bool) { if bitsize == 0 || bitsize >= 64 || v == 0 { return } @@ -1112,38 +1921,76 @@ func (_ checkOverflow) Int(v int64, bitsize uint8) (overflow bool) { } return } - -func (_ checkOverflow) SignedInt(v uint64) (i int64, overflow bool) { +func (checkOverflow) SignedInt(v uint64) (overflow bool) { //e.g. -127 to 128 for int8 pos := (v >> 63) == 0 ui2 := v & 0x7fffffffffffffff if pos { if ui2 > math.MaxInt64 { overflow = true - return } } else { if ui2 > math.MaxInt64-1 { overflow = true - return } } - i = int64(v) return } +func (x checkOverflow) Float32V(v float64) float64 { + if x.Float32(v) { + panicv.errorf("float32 overflow: %v", v) + } + return v +} +func (x checkOverflow) UintV(v uint64, bitsize uint8) uint64 { + if x.Uint(v, bitsize) { + panicv.errorf("uint64 overflow: %v", v) + } + return v +} +func (x checkOverflow) IntV(v int64, bitsize uint8) int64 { + if x.Int(v, bitsize) { + panicv.errorf("int64 overflow: %v", v) + } + return v +} +func (x checkOverflow) SignedIntV(v uint64) int64 { + if x.SignedInt(v) { + panicv.errorf("uint64 to int64 overflow: %v", v) + } + return int64(v) +} + // ------------------ SORT ----------------- func isNaN(f float64) bool { return f != f } // ----------------------- +type ioFlusher interface { + Flush() error +} + +type ioPeeker interface { + Peek(int) ([]byte, error) +} + +type ioBuffered interface { + Buffered() int +} + +// ----------------------- + type intSlice []int64 type uintSlice []uint64 + +// type uintptrSlice []uintptr type floatSlice []float64 type boolSlice []bool type stringSlice []string -type bytesSlice [][]byte + +// type bytesSlice [][]byte func (p intSlice) Len() int { return len(p) } func (p intSlice) Less(i, j int) bool { return p[i] < p[j] } @@ -1153,6 +2000,10 @@ func (p uintSlice) Len() int { return len(p) } func (p uintSlice) Less(i, j int) bool { return p[i] < p[j] } func (p uintSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } +// func (p uintptrSlice) Len() int { return len(p) } +// func (p uintptrSlice) Less(i, j int) bool { return p[i] < p[j] } +// func (p uintptrSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + func (p floatSlice) Len() int { return len(p) } func (p floatSlice) Less(i, j int) bool { return p[i] < p[j] || isNaN(p[i]) && !isNaN(p[j]) @@ -1163,9 +2014,9 @@ func (p stringSlice) Len() int { return len(p) } func (p stringSlice) Less(i, j int) bool { return p[i] < p[j] } func (p stringSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } -func (p bytesSlice) Len() int { return len(p) } -func (p bytesSlice) Less(i, j int) bool { return bytes.Compare(p[i], p[j]) == -1 } -func (p bytesSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } +// func (p bytesSlice) Len() int { return len(p) } +// func (p bytesSlice) Less(i, j int) bool { return bytes.Compare(p[i], p[j]) == -1 } +// func (p bytesSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } func (p boolSlice) Len() int { return len(p) } func (p boolSlice) Less(i, j int) bool { return !p[i] && p[j] } @@ -1203,6 +2054,11 @@ type bytesRv struct { r reflect.Value } type bytesRvSlice []bytesRv +type timeRv struct { + v time.Time + r reflect.Value +} +type timeRvSlice []timeRv func (p intRvSlice) Len() int { return len(p) } func (p intRvSlice) Less(i, j int) bool { return p[i].v < p[j].v } @@ -1230,6 +2086,10 @@ func (p boolRvSlice) Len() int { return len(p) } func (p boolRvSlice) Less(i, j int) bool { return !p[i].v && p[j].v } func (p boolRvSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } +func (p timeRvSlice) Len() int { return len(p) } +func (p timeRvSlice) Less(i, j int) bool { return p[i].v.Before(p[j].v) } +func (p timeRvSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + // ----------------- type bytesI struct { @@ -1249,7 +2109,6 @@ type set []uintptr func (s *set) add(v uintptr) (exists bool) { // e.ci is always nil, or len >= 1 - // defer func() { fmt.Printf("$$$$$$$$$$$ cirRef Add: %v, exists: %v\n", v, exists) }() x := *s if x == nil { x = make([]uintptr, 1, 8) @@ -1290,7 +2149,6 @@ func (s *set) add(v uintptr) (exists bool) { } func (s *set) remove(v uintptr) (exists bool) { - // defer func() { fmt.Printf("$$$$$$$$$$$ cirRef Rm: %v, exists: %v\n", v, exists) }() x := *s if len(x) == 0 { return @@ -1312,3 +2170,248 @@ func (s *set) remove(v uintptr) (exists bool) { } return } + +// ------ + +// bitset types are better than [256]bool, because they permit the whole +// bitset array being on a single cache line and use less memory. + +// given x > 0 and n > 0 and x is exactly 2^n, then pos/x === pos>>n AND pos%x === pos&(x-1). +// consequently, pos/32 === pos>>5, pos/16 === pos>>4, pos/8 === pos>>3, pos%8 == pos&7 + +type bitset256 [32]byte + +func (x *bitset256) isset(pos byte) bool { + return x[pos>>3]&(1<<(pos&7)) != 0 +} +func (x *bitset256) issetv(pos byte) byte { + return x[pos>>3] & (1 << (pos & 7)) +} +func (x *bitset256) set(pos byte) { + x[pos>>3] |= (1 << (pos & 7)) +} + +// func (x *bitset256) unset(pos byte) { +// x[pos>>3] &^= (1 << (pos & 7)) +// } + +type bitset128 [16]byte + +func (x *bitset128) isset(pos byte) bool { + return x[pos>>3]&(1<<(pos&7)) != 0 +} +func (x *bitset128) set(pos byte) { + x[pos>>3] |= (1 << (pos & 7)) +} + +// func (x *bitset128) unset(pos byte) { +// x[pos>>3] &^= (1 << (pos & 7)) +// } + +type bitset32 [4]byte + +func (x *bitset32) isset(pos byte) bool { + return x[pos>>3]&(1<<(pos&7)) != 0 +} +func (x *bitset32) set(pos byte) { + x[pos>>3] |= (1 << (pos & 7)) +} + +// func (x *bitset32) unset(pos byte) { +// x[pos>>3] &^= (1 << (pos & 7)) +// } + +// type bit2set256 [64]byte + +// func (x *bit2set256) set(pos byte, v1, v2 bool) { +// var pos2 uint8 = (pos & 3) << 1 // returning 0, 2, 4 or 6 +// if v1 { +// x[pos>>2] |= 1 << (pos2 + 1) +// } +// if v2 { +// x[pos>>2] |= 1 << pos2 +// } +// } +// func (x *bit2set256) get(pos byte) uint8 { +// var pos2 uint8 = (pos & 3) << 1 // returning 0, 2, 4 or 6 +// return x[pos>>2] << (6 - pos2) >> 6 // 11000000 -> 00000011 +// } + +// ------------ + +type pooler struct { + dn sync.Pool // for decNaked + cfn sync.Pool // for codecFner + tiload sync.Pool + strRv8, strRv16, strRv32, strRv64, strRv128 sync.Pool // for stringRV +} + +func (p *pooler) init() { + p.strRv8.New = func() interface{} { return new([8]stringRv) } + p.strRv16.New = func() interface{} { return new([16]stringRv) } + p.strRv32.New = func() interface{} { return new([32]stringRv) } + p.strRv64.New = func() interface{} { return new([64]stringRv) } + p.strRv128.New = func() interface{} { return new([128]stringRv) } + p.dn.New = func() interface{} { x := new(decNaked); x.init(); return x } + p.tiload.New = func() interface{} { return new(typeInfoLoadArray) } + p.cfn.New = func() interface{} { return new(codecFner) } +} + +func (p *pooler) stringRv8() (sp *sync.Pool, v interface{}) { + return &p.strRv8, p.strRv8.Get() +} +func (p *pooler) stringRv16() (sp *sync.Pool, v interface{}) { + return &p.strRv16, p.strRv16.Get() +} +func (p *pooler) stringRv32() (sp *sync.Pool, v interface{}) { + return &p.strRv32, p.strRv32.Get() +} +func (p *pooler) stringRv64() (sp *sync.Pool, v interface{}) { + return &p.strRv64, p.strRv64.Get() +} +func (p *pooler) stringRv128() (sp *sync.Pool, v interface{}) { + return &p.strRv128, p.strRv128.Get() +} +func (p *pooler) decNaked() (sp *sync.Pool, v interface{}) { + return &p.dn, p.dn.Get() +} +func (p *pooler) codecFner() (sp *sync.Pool, v interface{}) { + return &p.cfn, p.cfn.Get() +} +func (p *pooler) tiLoad() (sp *sync.Pool, v interface{}) { + return &p.tiload, p.tiload.Get() +} + +// func (p *pooler) decNaked() (v *decNaked, f func(*decNaked) ) { +// sp := &(p.dn) +// vv := sp.Get() +// return vv.(*decNaked), func(x *decNaked) { sp.Put(vv) } +// } +// func (p *pooler) decNakedGet() (v interface{}) { +// return p.dn.Get() +// } +// func (p *pooler) codecFnerGet() (v interface{}) { +// return p.cfn.Get() +// } +// func (p *pooler) tiLoadGet() (v interface{}) { +// return p.tiload.Get() +// } +// func (p *pooler) decNakedPut(v interface{}) { +// p.dn.Put(v) +// } +// func (p *pooler) codecFnerPut(v interface{}) { +// p.cfn.Put(v) +// } +// func (p *pooler) tiLoadPut(v interface{}) { +// p.tiload.Put(v) +// } + +type panicHdl struct{} + +func (panicHdl) errorv(err error) { + if err != nil { + panic(err) + } +} + +func (panicHdl) errorstr(message string) { + if message != "" { + panic(message) + } +} + +func (panicHdl) errorf(format string, params ...interface{}) { + if format != "" { + if len(params) == 0 { + panic(format) + } else { + panic(fmt.Sprintf(format, params...)) + } + } +} + +type errstrDecorator interface { + wrapErrstr(interface{}, *error) +} + +type errstrDecoratorDef struct{} + +func (errstrDecoratorDef) wrapErrstr(v interface{}, e *error) { *e = fmt.Errorf("%v", v) } + +type must struct{} + +func (must) String(s string, err error) string { + if err != nil { + panicv.errorv(err) + } + return s +} +func (must) Int(s int64, err error) int64 { + if err != nil { + panicv.errorv(err) + } + return s +} +func (must) Uint(s uint64, err error) uint64 { + if err != nil { + panicv.errorv(err) + } + return s +} +func (must) Float(s float64, err error) float64 { + if err != nil { + panicv.errorv(err) + } + return s +} + +// xdebugf prints the message in red on the terminal. +// Use it in place of fmt.Printf (which it calls internally) +func xdebugf(pattern string, args ...interface{}) { + var delim string + if len(pattern) > 0 && pattern[len(pattern)-1] != '\n' { + delim = "\n" + } + fmt.Printf("\033[1;31m"+pattern+delim+"\033[0m", args...) +} + +// func isImmutableKind(k reflect.Kind) (v bool) { +// return false || +// k == reflect.Int || +// k == reflect.Int8 || +// k == reflect.Int16 || +// k == reflect.Int32 || +// k == reflect.Int64 || +// k == reflect.Uint || +// k == reflect.Uint8 || +// k == reflect.Uint16 || +// k == reflect.Uint32 || +// k == reflect.Uint64 || +// k == reflect.Uintptr || +// k == reflect.Float32 || +// k == reflect.Float64 || +// k == reflect.Bool || +// k == reflect.String +// } + +// func timeLocUTCName(tzint int16) string { +// if tzint == 0 { +// return "UTC" +// } +// var tzname = []byte("UTC+00:00") +// //tzname := fmt.Sprintf("UTC%s%02d:%02d", tzsign, tz/60, tz%60) //perf issue using Sprintf. inline below. +// //tzhr, tzmin := tz/60, tz%60 //faster if u convert to int first +// var tzhr, tzmin int16 +// if tzint < 0 { +// tzname[3] = '-' // (TODO: verify. this works here) +// tzhr, tzmin = -tzint/60, (-tzint)%60 +// } else { +// tzhr, tzmin = tzint/60, tzint%60 +// } +// tzname[4] = timeDigits[tzhr/10] +// tzname[5] = timeDigits[tzhr%10] +// tzname[7] = timeDigits[tzmin/10] +// tzname[8] = timeDigits[tzmin%10] +// return string(tzname) +// //return time.FixedZone(string(tzname), int(tzint)*60) +// } diff --git a/vendor/github.com/ugorji/go/codec/helper_internal.go b/vendor/github.com/ugorji/go/codec/helper_internal.go index 5d0727f77..0cbd665e2 100644 --- a/vendor/github.com/ugorji/go/codec/helper_internal.go +++ b/vendor/github.com/ugorji/go/codec/helper_internal.go @@ -6,74 +6,6 @@ package codec // All non-std package dependencies live in this file, // so porting to different environment is easy (just update functions). -import ( - "errors" - "fmt" - "math" - "reflect" -) - -func panicValToErr(panicVal interface{}, err *error) { - if panicVal == nil { - return - } - // case nil - switch xerr := panicVal.(type) { - case error: - *err = xerr - case string: - *err = errors.New(xerr) - default: - *err = fmt.Errorf("%v", panicVal) - } - return -} - -func hIsEmptyValue(v reflect.Value, deref, checkStruct bool) bool { - switch v.Kind() { - case reflect.Invalid: - return true - case reflect.Array, reflect.Map, reflect.Slice, reflect.String: - return v.Len() == 0 - case reflect.Bool: - return !v.Bool() - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.Interface, reflect.Ptr: - if deref { - if v.IsNil() { - return true - } - return hIsEmptyValue(v.Elem(), deref, checkStruct) - } else { - return v.IsNil() - } - case reflect.Struct: - if !checkStruct { - return false - } - // return true if all fields are empty. else return false. - // we cannot use equality check, because some fields may be maps/slices/etc - // and consequently the structs are not comparable. - // return v.Interface() == reflect.Zero(v.Type()).Interface() - for i, n := 0, v.NumField(); i < n; i++ { - if !hIsEmptyValue(v.Field(i), deref, checkStruct) { - return false - } - } - return true - } - return false -} - -func isEmptyValue(v reflect.Value, deref, checkStruct bool) bool { - return hIsEmptyValue(v, deref, checkStruct) -} - func pruneSignExt(v []byte, pos bool) (n int) { if len(v) < 2 { } else if pos && v[0] == 0 { @@ -86,37 +18,6 @@ func pruneSignExt(v []byte, pos bool) (n int) { return } -func implementsIntf(typ, iTyp reflect.Type) (success bool, indir int8) { - if typ == nil { - return - } - rt := typ - // The type might be a pointer and we need to keep - // dereferencing to the base type until we find an implementation. - for { - if rt.Implements(iTyp) { - return true, indir - } - if p := rt; p.Kind() == reflect.Ptr { - indir++ - if indir >= math.MaxInt8 { // insane number of indirections - return false, 0 - } - rt = p.Elem() - continue - } - break - } - // No luck yet, but if this is a base type (non-pointer), the pointer might satisfy. - if typ.Kind() != reflect.Ptr { - // Not a pointer, but does the pointer work? - if reflect.PtrTo(typ).Implements(iTyp) { - return true, -1 - } - } - return false, 0 -} - // validate that this function is correct ... // culled from OGRE (Object-Oriented Graphics Rendering Engine) // function: halfToFloatI (http://stderr.org/doc/ogre-doc/api/OgreBitwise_8h-source.html) @@ -129,21 +30,20 @@ func halfFloatToFloatBits(yy uint16) (d uint32) { if e == 0 { if m == 0 { // plu or minus 0 return s << 31 - } else { // Denormalized number -- renormalize it - for (m & 0x00000400) == 0 { - m <<= 1 - e -= 1 - } - e += 1 - const zz uint32 = 0x0400 - m &= ^zz } + // Denormalized number -- renormalize it + for (m & 0x00000400) == 0 { + m <<= 1 + e -= 1 + } + e += 1 + const zz uint32 = 0x0400 + m &= ^zz } else if e == 31 { if m == 0 { // Inf return (s << 31) | 0x7f800000 - } else { // NaN - return (s << 31) | 0x7f800000 | (m << 13) } + return (s << 31) | 0x7f800000 | (m << 13) // NaN } e = e + (127 - 15) m = m << 13 @@ -219,24 +119,3 @@ func growCap(oldCap, unit, num int) (newCap int) { } return } - -func expandSliceValue(s reflect.Value, num int) reflect.Value { - if num <= 0 { - return s - } - l0 := s.Len() - l1 := l0 + num // new slice length - if l1 < l0 { - panic("ExpandSlice: slice overflow") - } - c0 := s.Cap() - if l1 <= c0 { - return s.Slice(0, l1) - } - st := s.Type() - c1 := growCap(c0, int(st.Elem().Size()), num) - s2 := reflect.MakeSlice(st, l1, c1) - // println("expandslicevalue: cap-old: ", c0, ", cap-new: ", c1, ", len-new: ", l1) - reflect.Copy(s2, s) - return s2 -} diff --git a/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go b/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go index f254b9886..fd52690c9 100644 --- a/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go +++ b/vendor/github.com/ugorji/go/codec/helper_not_unsafe.go @@ -1,10 +1,18 @@ -// +build !unsafe +// +build !go1.7 safe appengine -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec +import ( + "reflect" + "sync/atomic" + "time" +) + +const safeMode = true + // stringView returns a view of the []byte as a string. // In unsafe mode, it doesn't incur allocation and copying caused by conversion. // In regular safe mode, it is an allocation and copy. @@ -25,12 +33,240 @@ func bytesView(v string) []byte { return []byte(v) } -// keepAlive4BytesView maintains a reference to the input parameter for bytesView. -// -// Usage: call this at point where done with the bytes view. -func keepAlive4BytesView(v string) {} +func definitelyNil(v interface{}) bool { + // this is a best-effort option. + // We just return false, so we don't unnecessarily incur the cost of reflection this early. + return false +} -// keepAlive4BytesView maintains a reference to the input parameter for stringView. -// -// Usage: call this at point where done with the string view. -func keepAlive4StringView(v []byte) {} +func rv2i(rv reflect.Value) interface{} { + return rv.Interface() +} + +func rt2id(rt reflect.Type) uintptr { + return reflect.ValueOf(rt).Pointer() +} + +func rv2rtid(rv reflect.Value) uintptr { + return reflect.ValueOf(rv.Type()).Pointer() +} + +func i2rtid(i interface{}) uintptr { + return reflect.ValueOf(reflect.TypeOf(i)).Pointer() +} + +// -------------------------- + +func isEmptyValue(v reflect.Value, tinfos *TypeInfos, deref, checkStruct bool) bool { + switch v.Kind() { + case reflect.Invalid: + return true + case reflect.Array, reflect.Map, reflect.Slice, reflect.String: + return v.Len() == 0 + case reflect.Bool: + return !v.Bool() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return v.Int() == 0 + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return v.Uint() == 0 + case reflect.Float32, reflect.Float64: + return v.Float() == 0 + case reflect.Interface, reflect.Ptr: + if deref { + if v.IsNil() { + return true + } + return isEmptyValue(v.Elem(), tinfos, deref, checkStruct) + } + return v.IsNil() + case reflect.Struct: + return isEmptyStruct(v, tinfos, deref, checkStruct) + } + return false +} + +// -------------------------- +// type ptrToRvMap struct{} + +// func (*ptrToRvMap) init() {} +// func (*ptrToRvMap) get(i interface{}) reflect.Value { +// return reflect.ValueOf(i).Elem() +// } + +// -------------------------- +type atomicTypeInfoSlice struct { // expected to be 2 words + v atomic.Value +} + +func (x *atomicTypeInfoSlice) load() []rtid2ti { + i := x.v.Load() + if i == nil { + return nil + } + return i.([]rtid2ti) +} + +func (x *atomicTypeInfoSlice) store(p []rtid2ti) { + x.v.Store(p) +} + +// -------------------------- +func (d *Decoder) raw(f *codecFnInfo, rv reflect.Value) { + rv.SetBytes(d.rawBytes()) +} + +func (d *Decoder) kString(f *codecFnInfo, rv reflect.Value) { + rv.SetString(d.d.DecodeString()) +} + +func (d *Decoder) kBool(f *codecFnInfo, rv reflect.Value) { + rv.SetBool(d.d.DecodeBool()) +} + +func (d *Decoder) kTime(f *codecFnInfo, rv reflect.Value) { + rv.Set(reflect.ValueOf(d.d.DecodeTime())) +} + +func (d *Decoder) kFloat32(f *codecFnInfo, rv reflect.Value) { + fv := d.d.DecodeFloat64() + if chkOvf.Float32(fv) { + d.errorf("float32 overflow: %v", fv) + } + rv.SetFloat(fv) +} + +func (d *Decoder) kFloat64(f *codecFnInfo, rv reflect.Value) { + rv.SetFloat(d.d.DecodeFloat64()) +} + +func (d *Decoder) kInt(f *codecFnInfo, rv reflect.Value) { + rv.SetInt(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) +} + +func (d *Decoder) kInt8(f *codecFnInfo, rv reflect.Value) { + rv.SetInt(chkOvf.IntV(d.d.DecodeInt64(), 8)) +} + +func (d *Decoder) kInt16(f *codecFnInfo, rv reflect.Value) { + rv.SetInt(chkOvf.IntV(d.d.DecodeInt64(), 16)) +} + +func (d *Decoder) kInt32(f *codecFnInfo, rv reflect.Value) { + rv.SetInt(chkOvf.IntV(d.d.DecodeInt64(), 32)) +} + +func (d *Decoder) kInt64(f *codecFnInfo, rv reflect.Value) { + rv.SetInt(d.d.DecodeInt64()) +} + +func (d *Decoder) kUint(f *codecFnInfo, rv reflect.Value) { + rv.SetUint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) +} + +func (d *Decoder) kUintptr(f *codecFnInfo, rv reflect.Value) { + rv.SetUint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) +} + +func (d *Decoder) kUint8(f *codecFnInfo, rv reflect.Value) { + rv.SetUint(chkOvf.UintV(d.d.DecodeUint64(), 8)) +} + +func (d *Decoder) kUint16(f *codecFnInfo, rv reflect.Value) { + rv.SetUint(chkOvf.UintV(d.d.DecodeUint64(), 16)) +} + +func (d *Decoder) kUint32(f *codecFnInfo, rv reflect.Value) { + rv.SetUint(chkOvf.UintV(d.d.DecodeUint64(), 32)) +} + +func (d *Decoder) kUint64(f *codecFnInfo, rv reflect.Value) { + rv.SetUint(d.d.DecodeUint64()) +} + +// ---------------- + +func (e *Encoder) kBool(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeBool(rv.Bool()) +} + +func (e *Encoder) kTime(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeTime(rv2i(rv).(time.Time)) +} + +func (e *Encoder) kString(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeString(cUTF8, rv.String()) +} + +func (e *Encoder) kFloat64(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeFloat64(rv.Float()) +} + +func (e *Encoder) kFloat32(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeFloat32(float32(rv.Float())) +} + +func (e *Encoder) kInt(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeInt(rv.Int()) +} + +func (e *Encoder) kInt8(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeInt(rv.Int()) +} + +func (e *Encoder) kInt16(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeInt(rv.Int()) +} + +func (e *Encoder) kInt32(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeInt(rv.Int()) +} + +func (e *Encoder) kInt64(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeInt(rv.Int()) +} + +func (e *Encoder) kUint(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeUint(rv.Uint()) +} + +func (e *Encoder) kUint8(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeUint(rv.Uint()) +} + +func (e *Encoder) kUint16(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeUint(rv.Uint()) +} + +func (e *Encoder) kUint32(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeUint(rv.Uint()) +} + +func (e *Encoder) kUint64(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeUint(rv.Uint()) +} + +func (e *Encoder) kUintptr(f *codecFnInfo, rv reflect.Value) { + e.e.EncodeUint(rv.Uint()) +} + +// // keepAlive4BytesView maintains a reference to the input parameter for bytesView. +// // +// // Usage: call this at point where done with the bytes view. +// func keepAlive4BytesView(v string) {} + +// // keepAlive4BytesView maintains a reference to the input parameter for stringView. +// // +// // Usage: call this at point where done with the string view. +// func keepAlive4StringView(v []byte) {} + +// func definitelyNil(v interface{}) bool { +// rv := reflect.ValueOf(v) +// switch rv.Kind() { +// case reflect.Invalid: +// return true +// case reflect.Ptr, reflect.Interface, reflect.Chan, reflect.Slice, reflect.Map, reflect.Func: +// return rv.IsNil() +// default: +// return false +// } +// } diff --git a/vendor/github.com/ugorji/go/codec/helper_test.go b/vendor/github.com/ugorji/go/codec/helper_test.go index 611eac43d..a765fd4a4 100644 --- a/vendor/github.com/ugorji/go/codec/helper_test.go +++ b/vendor/github.com/ugorji/go/codec/helper_test.go @@ -8,41 +8,9 @@ package codec import ( "errors" - "fmt" "reflect" - "testing" ) -// ----- functions below are used only by tests (not benchmarks) - -const ( - testLogToT = true - failNowOnFail = true -) - -func checkErrT(t *testing.T, err error) { - if err != nil { - logT(t, err.Error()) - failT(t) - } -} - -func checkEqualT(t *testing.T, v1 interface{}, v2 interface{}, desc string) (err error) { - if err = deepEqual(v1, v2); err != nil { - logT(t, "Not Equal: %s: %v. v1: %v, v2: %v", desc, err, v1, v2) - failT(t) - } - return -} - -func failT(t *testing.T) { - if failNowOnFail { - t.FailNow() - } else { - t.Fail() - } -} - // --- these functions are used by both benchmarks and tests func deepEqual(v1, v2 interface{}) (err error) { @@ -52,21 +20,6 @@ func deepEqual(v1, v2 interface{}) (err error) { return } -func logT(x interface{}, format string, args ...interface{}) { - if t, ok := x.(*testing.T); ok && t != nil && testLogToT { - if testVerbose { - t.Logf(format, args...) - } - } else if b, ok := x.(*testing.B); ok && b != nil && testLogToT { - b.Logf(format, args...) - } else { - if len(format) == 0 || format[len(format)-1] != '\n' { - format = format + "\n" - } - fmt.Printf(format, args...) - } -} - func approxDataSize(rv reflect.Value) (sum int) { switch rk := rv.Kind(); rk { case reflect.Invalid: diff --git a/vendor/github.com/ugorji/go/codec/helper_unsafe.go b/vendor/github.com/ugorji/go/codec/helper_unsafe.go index 6c146f77c..21aa4db75 100644 --- a/vendor/github.com/ugorji/go/codec/helper_unsafe.go +++ b/vendor/github.com/ugorji/go/codec/helper_unsafe.go @@ -1,53 +1,632 @@ -// +build unsafe +// +build !safe +// +build !appengine +// +build go1.7 -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec import ( - "runtime" + "reflect" + "sync/atomic" + "time" "unsafe" ) // This file has unsafe variants of some helper methods. // NOTE: See helper_not_unsafe.go for the usage information. +// var zeroRTv [4]uintptr + +const safeMode = false +const unsafeFlagIndir = 1 << 7 // keep in sync with GO_ROOT/src/reflect/value.go + type unsafeString struct { - Data uintptr + Data unsafe.Pointer Len int } type unsafeSlice struct { - Data uintptr + Data unsafe.Pointer Len int Cap int } +type unsafeIntf struct { + typ unsafe.Pointer + word unsafe.Pointer +} + +type unsafeReflectValue struct { + typ unsafe.Pointer + ptr unsafe.Pointer + flag uintptr +} + func stringView(v []byte) string { if len(v) == 0 { return "" } - bx := (*unsafeSlice)(unsafe.Pointer(&v)) - sx := unsafeString{bx.Data, bx.Len} - return *(*string)(unsafe.Pointer(&sx)) + return *(*string)(unsafe.Pointer(&unsafeString{bx.Data, bx.Len})) } func bytesView(v string) []byte { if len(v) == 0 { return zeroByteSlice } - sx := (*unsafeString)(unsafe.Pointer(&v)) - bx := unsafeSlice{sx.Data, sx.Len, sx.Len} - return *(*[]byte)(unsafe.Pointer(&bx)) + return *(*[]byte)(unsafe.Pointer(&unsafeSlice{sx.Data, sx.Len, sx.Len})) } -func keepAlive4BytesView(v string) { - runtime.KeepAlive(v) +func definitelyNil(v interface{}) bool { + // There is no global way of checking if an interface is nil. + // For true references (map, ptr, func, chan), you can just look + // at the word of the interface. However, for slices, you have to dereference + // the word, and get a pointer to the 3-word interface value. + // + // However, the following are cheap calls + // - TypeOf(interface): cheap 2-line call. + // - ValueOf(interface{}): expensive + // - type.Kind: cheap call through an interface + // - Value.Type(): cheap call + // except it's a method value (e.g. r.Read, which implies that it is a Func) + + return ((*unsafeIntf)(unsafe.Pointer(&v))).word == nil } -func keepAlive4StringView(v []byte) { - runtime.KeepAlive(v) +func rv2i(rv reflect.Value) interface{} { + // TODO: consider a more generally-known optimization for reflect.Value ==> Interface + // + // Currently, we use this fragile method that taps into implememtation details from + // the source go stdlib reflect/value.go, and trims the implementation. + + urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + // true references (map, func, chan, ptr - NOT slice) may be double-referenced as flagIndir + var ptr unsafe.Pointer + if refBitset.isset(byte(urv.flag&(1<<5-1))) && urv.flag&unsafeFlagIndir != 0 { + ptr = *(*unsafe.Pointer)(urv.ptr) + } else { + ptr = urv.ptr + } + return *(*interface{})(unsafe.Pointer(&unsafeIntf{typ: urv.typ, word: ptr})) } + +func rt2id(rt reflect.Type) uintptr { + return uintptr(((*unsafeIntf)(unsafe.Pointer(&rt))).word) +} + +func rv2rtid(rv reflect.Value) uintptr { + return uintptr((*unsafeReflectValue)(unsafe.Pointer(&rv)).typ) +} + +func i2rtid(i interface{}) uintptr { + return uintptr(((*unsafeIntf)(unsafe.Pointer(&i))).typ) +} + +// -------------------------- + +func isEmptyValue(v reflect.Value, tinfos *TypeInfos, deref, checkStruct bool) bool { + urv := (*unsafeReflectValue)(unsafe.Pointer(&v)) + if urv.flag == 0 { + return true + } + switch v.Kind() { + case reflect.Invalid: + return true + case reflect.String: + return (*unsafeString)(urv.ptr).Len == 0 + case reflect.Slice: + return (*unsafeSlice)(urv.ptr).Len == 0 + case reflect.Bool: + return !*(*bool)(urv.ptr) + case reflect.Int: + return *(*int)(urv.ptr) == 0 + case reflect.Int8: + return *(*int8)(urv.ptr) == 0 + case reflect.Int16: + return *(*int16)(urv.ptr) == 0 + case reflect.Int32: + return *(*int32)(urv.ptr) == 0 + case reflect.Int64: + return *(*int64)(urv.ptr) == 0 + case reflect.Uint: + return *(*uint)(urv.ptr) == 0 + case reflect.Uint8: + return *(*uint8)(urv.ptr) == 0 + case reflect.Uint16: + return *(*uint16)(urv.ptr) == 0 + case reflect.Uint32: + return *(*uint32)(urv.ptr) == 0 + case reflect.Uint64: + return *(*uint64)(urv.ptr) == 0 + case reflect.Uintptr: + return *(*uintptr)(urv.ptr) == 0 + case reflect.Float32: + return *(*float32)(urv.ptr) == 0 + case reflect.Float64: + return *(*float64)(urv.ptr) == 0 + case reflect.Interface: + isnil := urv.ptr == nil || *(*unsafe.Pointer)(urv.ptr) == nil + if deref { + if isnil { + return true + } + return isEmptyValue(v.Elem(), tinfos, deref, checkStruct) + } + return isnil + case reflect.Ptr: + isnil := urv.ptr == nil + if deref { + if isnil { + return true + } + return isEmptyValue(v.Elem(), tinfos, deref, checkStruct) + } + return isnil + case reflect.Struct: + return isEmptyStruct(v, tinfos, deref, checkStruct) + case reflect.Map, reflect.Array, reflect.Chan: + return v.Len() == 0 + } + return false +} + +// -------------------------- + +type atomicTypeInfoSlice struct { // expected to be 2 words + v unsafe.Pointer // data array - Pointer (not uintptr) to maintain GC reference + l int64 // length of the data array +} + +func (x *atomicTypeInfoSlice) load() []rtid2ti { + l := int(atomic.LoadInt64(&x.l)) + if l == 0 { + return nil + } + return *(*[]rtid2ti)(unsafe.Pointer(&unsafeSlice{Data: atomic.LoadPointer(&x.v), Len: l, Cap: l})) + // return (*[]rtid2ti)(atomic.LoadPointer(&x.v)) +} + +func (x *atomicTypeInfoSlice) store(p []rtid2ti) { + s := (*unsafeSlice)(unsafe.Pointer(&p)) + atomic.StorePointer(&x.v, s.Data) + atomic.StoreInt64(&x.l, int64(s.Len)) + // atomic.StorePointer(&x.v, unsafe.Pointer(p)) +} + +// -------------------------- +func (d *Decoder) raw(f *codecFnInfo, rv reflect.Value) { + urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + *(*[]byte)(urv.ptr) = d.rawBytes() +} + +func (d *Decoder) kString(f *codecFnInfo, rv reflect.Value) { + urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + *(*string)(urv.ptr) = d.d.DecodeString() +} + +func (d *Decoder) kBool(f *codecFnInfo, rv reflect.Value) { + urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + *(*bool)(urv.ptr) = d.d.DecodeBool() +} + +func (d *Decoder) kTime(f *codecFnInfo, rv reflect.Value) { + urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + *(*time.Time)(urv.ptr) = d.d.DecodeTime() +} + +func (d *Decoder) kFloat32(f *codecFnInfo, rv reflect.Value) { + fv := d.d.DecodeFloat64() + if chkOvf.Float32(fv) { + d.errorf("float32 overflow: %v", fv) + } + urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + *(*float32)(urv.ptr) = float32(fv) +} + +func (d *Decoder) kFloat64(f *codecFnInfo, rv reflect.Value) { + urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + *(*float64)(urv.ptr) = d.d.DecodeFloat64() +} + +func (d *Decoder) kInt(f *codecFnInfo, rv reflect.Value) { + urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + *(*int)(urv.ptr) = int(chkOvf.IntV(d.d.DecodeInt64(), intBitsize)) +} + +func (d *Decoder) kInt8(f *codecFnInfo, rv reflect.Value) { + urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + *(*int8)(urv.ptr) = int8(chkOvf.IntV(d.d.DecodeInt64(), 8)) +} + +func (d *Decoder) kInt16(f *codecFnInfo, rv reflect.Value) { + urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + *(*int16)(urv.ptr) = int16(chkOvf.IntV(d.d.DecodeInt64(), 16)) +} + +func (d *Decoder) kInt32(f *codecFnInfo, rv reflect.Value) { + urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + *(*int32)(urv.ptr) = int32(chkOvf.IntV(d.d.DecodeInt64(), 32)) +} + +func (d *Decoder) kInt64(f *codecFnInfo, rv reflect.Value) { + urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + *(*int64)(urv.ptr) = d.d.DecodeInt64() +} + +func (d *Decoder) kUint(f *codecFnInfo, rv reflect.Value) { + urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + *(*uint)(urv.ptr) = uint(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) +} + +func (d *Decoder) kUintptr(f *codecFnInfo, rv reflect.Value) { + urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + *(*uintptr)(urv.ptr) = uintptr(chkOvf.UintV(d.d.DecodeUint64(), uintBitsize)) +} + +func (d *Decoder) kUint8(f *codecFnInfo, rv reflect.Value) { + urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + *(*uint8)(urv.ptr) = uint8(chkOvf.UintV(d.d.DecodeUint64(), 8)) +} + +func (d *Decoder) kUint16(f *codecFnInfo, rv reflect.Value) { + urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + *(*uint16)(urv.ptr) = uint16(chkOvf.UintV(d.d.DecodeUint64(), 16)) +} + +func (d *Decoder) kUint32(f *codecFnInfo, rv reflect.Value) { + urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + *(*uint32)(urv.ptr) = uint32(chkOvf.UintV(d.d.DecodeUint64(), 32)) +} + +func (d *Decoder) kUint64(f *codecFnInfo, rv reflect.Value) { + urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + *(*uint64)(urv.ptr) = d.d.DecodeUint64() +} + +// ------------ + +func (e *Encoder) kBool(f *codecFnInfo, rv reflect.Value) { + v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + e.e.EncodeBool(*(*bool)(v.ptr)) +} + +func (e *Encoder) kTime(f *codecFnInfo, rv reflect.Value) { + v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + e.e.EncodeTime(*(*time.Time)(v.ptr)) +} + +func (e *Encoder) kString(f *codecFnInfo, rv reflect.Value) { + v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + e.e.EncodeString(cUTF8, *(*string)(v.ptr)) +} + +func (e *Encoder) kFloat64(f *codecFnInfo, rv reflect.Value) { + v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + e.e.EncodeFloat64(*(*float64)(v.ptr)) +} + +func (e *Encoder) kFloat32(f *codecFnInfo, rv reflect.Value) { + v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + e.e.EncodeFloat32(*(*float32)(v.ptr)) +} + +func (e *Encoder) kInt(f *codecFnInfo, rv reflect.Value) { + v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + e.e.EncodeInt(int64(*(*int)(v.ptr))) +} + +func (e *Encoder) kInt8(f *codecFnInfo, rv reflect.Value) { + v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + e.e.EncodeInt(int64(*(*int8)(v.ptr))) +} + +func (e *Encoder) kInt16(f *codecFnInfo, rv reflect.Value) { + v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + e.e.EncodeInt(int64(*(*int16)(v.ptr))) +} + +func (e *Encoder) kInt32(f *codecFnInfo, rv reflect.Value) { + v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + e.e.EncodeInt(int64(*(*int32)(v.ptr))) +} + +func (e *Encoder) kInt64(f *codecFnInfo, rv reflect.Value) { + v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + e.e.EncodeInt(int64(*(*int64)(v.ptr))) +} + +func (e *Encoder) kUint(f *codecFnInfo, rv reflect.Value) { + v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + e.e.EncodeUint(uint64(*(*uint)(v.ptr))) +} + +func (e *Encoder) kUint8(f *codecFnInfo, rv reflect.Value) { + v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + e.e.EncodeUint(uint64(*(*uint8)(v.ptr))) +} + +func (e *Encoder) kUint16(f *codecFnInfo, rv reflect.Value) { + v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + e.e.EncodeUint(uint64(*(*uint16)(v.ptr))) +} + +func (e *Encoder) kUint32(f *codecFnInfo, rv reflect.Value) { + v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + e.e.EncodeUint(uint64(*(*uint32)(v.ptr))) +} + +func (e *Encoder) kUint64(f *codecFnInfo, rv reflect.Value) { + v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + e.e.EncodeUint(uint64(*(*uint64)(v.ptr))) +} + +func (e *Encoder) kUintptr(f *codecFnInfo, rv reflect.Value) { + v := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + e.e.EncodeUint(uint64(*(*uintptr)(v.ptr))) +} + +// ------------ + +// func (d *Decoder) raw(f *codecFnInfo, rv reflect.Value) { +// urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) +// // if urv.flag&unsafeFlagIndir != 0 { +// // urv.ptr = *(*unsafe.Pointer)(urv.ptr) +// // } +// *(*[]byte)(urv.ptr) = d.rawBytes() +// } + +// func rv0t(rt reflect.Type) reflect.Value { +// ut := (*unsafeIntf)(unsafe.Pointer(&rt)) +// // we need to determine whether ifaceIndir, and then whether to just pass 0 as the ptr +// uv := unsafeReflectValue{ut.word, &zeroRTv, flag(rt.Kind())} +// return *(*reflect.Value)(unsafe.Pointer(&uv}) +// } + +// func rv2i(rv reflect.Value) interface{} { +// urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) +// // true references (map, func, chan, ptr - NOT slice) may be double-referenced as flagIndir +// var ptr unsafe.Pointer +// // kk := reflect.Kind(urv.flag & (1<<5 - 1)) +// // if (kk == reflect.Map || kk == reflect.Ptr || kk == reflect.Chan || kk == reflect.Func) && urv.flag&unsafeFlagIndir != 0 { +// if refBitset.isset(byte(urv.flag&(1<<5-1))) && urv.flag&unsafeFlagIndir != 0 { +// ptr = *(*unsafe.Pointer)(urv.ptr) +// } else { +// ptr = urv.ptr +// } +// return *(*interface{})(unsafe.Pointer(&unsafeIntf{typ: urv.typ, word: ptr})) +// // return *(*interface{})(unsafe.Pointer(&unsafeIntf{word: *(*unsafe.Pointer)(urv.ptr), typ: urv.typ})) +// // return *(*interface{})(unsafe.Pointer(&unsafeIntf{word: urv.ptr, typ: urv.typ})) +// } + +// func definitelyNil(v interface{}) bool { +// var ui *unsafeIntf = (*unsafeIntf)(unsafe.Pointer(&v)) +// if ui.word == nil { +// return true +// } +// var tk = reflect.TypeOf(v).Kind() +// return (tk == reflect.Interface || tk == reflect.Slice) && *(*unsafe.Pointer)(ui.word) == nil +// fmt.Printf(">>>> definitely nil: isnil: %v, TYPE: \t%T, word: %v, *word: %v, type: %v, nil: %v\n", +// v == nil, v, word, *((*unsafe.Pointer)(word)), ui.typ, nil) +// } + +// func keepAlive4BytesView(v string) { +// runtime.KeepAlive(v) +// } + +// func keepAlive4StringView(v []byte) { +// runtime.KeepAlive(v) +// } + +// func rt2id(rt reflect.Type) uintptr { +// return uintptr(((*unsafeIntf)(unsafe.Pointer(&rt))).word) +// // var i interface{} = rt +// // // ui := (*unsafeIntf)(unsafe.Pointer(&i)) +// // return ((*unsafeIntf)(unsafe.Pointer(&i))).word +// } + +// func rv2i(rv reflect.Value) interface{} { +// urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) +// // non-reference type: already indir +// // reference type: depend on flagIndir property ('cos maybe was double-referenced) +// // const (unsafeRvFlagKindMask = 1<<5 - 1 , unsafeRvFlagIndir = 1 << 7 ) +// // rvk := reflect.Kind(urv.flag & (1<<5 - 1)) +// // if (rvk == reflect.Chan || +// // rvk == reflect.Func || +// // rvk == reflect.Interface || +// // rvk == reflect.Map || +// // rvk == reflect.Ptr || +// // rvk == reflect.UnsafePointer) && urv.flag&(1<<8) != 0 { +// // fmt.Printf(">>>>> ---- double indirect reference: %v, %v\n", rvk, rv.Type()) +// // return *(*interface{})(unsafe.Pointer(&unsafeIntf{word: *(*unsafe.Pointer)(urv.ptr), typ: urv.typ})) +// // } +// if urv.flag&(1<<5-1) == uintptr(reflect.Map) && urv.flag&(1<<7) != 0 { +// // fmt.Printf(">>>>> ---- double indirect reference: %v, %v\n", rvk, rv.Type()) +// return *(*interface{})(unsafe.Pointer(&unsafeIntf{word: *(*unsafe.Pointer)(urv.ptr), typ: urv.typ})) +// } +// // fmt.Printf(">>>>> ++++ direct reference: %v, %v\n", rvk, rv.Type()) +// return *(*interface{})(unsafe.Pointer(&unsafeIntf{word: urv.ptr, typ: urv.typ})) +// } + +// const ( +// unsafeRvFlagKindMask = 1<<5 - 1 +// unsafeRvKindDirectIface = 1 << 5 +// unsafeRvFlagIndir = 1 << 7 +// unsafeRvFlagAddr = 1 << 8 +// unsafeRvFlagMethod = 1 << 9 + +// _USE_RV_INTERFACE bool = false +// _UNSAFE_RV_DEBUG = true +// ) + +// type unsafeRtype struct { +// _ [2]uintptr +// _ uint32 +// _ uint8 +// _ uint8 +// _ uint8 +// kind uint8 +// _ [2]uintptr +// _ int32 +// } + +// func _rv2i(rv reflect.Value) interface{} { +// // Note: From use, +// // - it's never an interface +// // - the only calls here are for ifaceIndir types. +// // (though that conditional is wrong) +// // To know for sure, we need the value of t.kind (which is not exposed). +// // +// // Need to validate the path: type is indirect ==> only value is indirect ==> default (value is direct) +// // - Type indirect, Value indirect: ==> numbers, boolean, slice, struct, array, string +// // - Type Direct, Value indirect: ==> map??? +// // - Type Direct, Value direct: ==> pointers, unsafe.Pointer, func, chan, map +// // +// // TRANSLATES TO: +// // if typeIndirect { } else if valueIndirect { } else { } +// // +// // Since we don't deal with funcs, then "flagNethod" is unset, and can be ignored. + +// if _USE_RV_INTERFACE { +// return rv.Interface() +// } +// urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) + +// // if urv.flag&unsafeRvFlagMethod != 0 || urv.flag&unsafeRvFlagKindMask == uintptr(reflect.Interface) { +// // println("***** IS flag method or interface: delegating to rv.Interface()") +// // return rv.Interface() +// // } + +// // if urv.flag&unsafeRvFlagKindMask == uintptr(reflect.Interface) { +// // println("***** IS Interface: delegate to rv.Interface") +// // return rv.Interface() +// // } +// // if urv.flag&unsafeRvFlagKindMask&unsafeRvKindDirectIface == 0 { +// // if urv.flag&unsafeRvFlagAddr == 0 { +// // println("***** IS ifaceIndir typ") +// // // ui := unsafeIntf{word: urv.ptr, typ: urv.typ} +// // // return *(*interface{})(unsafe.Pointer(&ui)) +// // // return *(*interface{})(unsafe.Pointer(&unsafeIntf{word: urv.ptr, typ: urv.typ})) +// // } +// // } else if urv.flag&unsafeRvFlagIndir != 0 { +// // println("***** IS flagindir") +// // // return *(*interface{})(unsafe.Pointer(&unsafeIntf{word: *(*unsafe.Pointer)(urv.ptr), typ: urv.typ})) +// // } else { +// // println("***** NOT flagindir") +// // return *(*interface{})(unsafe.Pointer(&unsafeIntf{word: urv.ptr, typ: urv.typ})) +// // } +// // println("***** default: delegate to rv.Interface") + +// urt := (*unsafeRtype)(unsafe.Pointer(urv.typ)) +// if _UNSAFE_RV_DEBUG { +// fmt.Printf(">>>> start: %v: ", rv.Type()) +// fmt.Printf("%v - %v\n", *urv, *urt) +// } +// if urt.kind&unsafeRvKindDirectIface == 0 { +// if _UNSAFE_RV_DEBUG { +// fmt.Printf("**** +ifaceIndir type: %v\n", rv.Type()) +// } +// // println("***** IS ifaceIndir typ") +// // if true || urv.flag&unsafeRvFlagAddr == 0 { +// // // println(" ***** IS NOT addr") +// return *(*interface{})(unsafe.Pointer(&unsafeIntf{word: urv.ptr, typ: urv.typ})) +// // } +// } else if urv.flag&unsafeRvFlagIndir != 0 { +// if _UNSAFE_RV_DEBUG { +// fmt.Printf("**** +flagIndir type: %v\n", rv.Type()) +// } +// // println("***** IS flagindir") +// return *(*interface{})(unsafe.Pointer(&unsafeIntf{word: *(*unsafe.Pointer)(urv.ptr), typ: urv.typ})) +// } else { +// if _UNSAFE_RV_DEBUG { +// fmt.Printf("**** -flagIndir type: %v\n", rv.Type()) +// } +// // println("***** NOT flagindir") +// return *(*interface{})(unsafe.Pointer(&unsafeIntf{word: urv.ptr, typ: urv.typ})) +// } +// // println("***** default: delegating to rv.Interface()") +// // return rv.Interface() +// } + +// var staticM0 = make(map[string]uint64) +// var staticI0 = (int32)(-5) + +// func staticRv2iTest() { +// i0 := (int32)(-5) +// m0 := make(map[string]uint16) +// m0["1"] = 1 +// for _, i := range []interface{}{ +// (int)(7), +// (uint)(8), +// (int16)(-9), +// (uint16)(19), +// (uintptr)(77), +// (bool)(true), +// float32(-32.7), +// float64(64.9), +// complex(float32(19), 5), +// complex(float64(-32), 7), +// [4]uint64{1, 2, 3, 4}, +// (chan<- int)(nil), // chan, +// rv2i, // func +// io.Writer(ioutil.Discard), +// make(map[string]uint), +// (map[string]uint)(nil), +// staticM0, +// m0, +// &m0, +// i0, +// &i0, +// &staticI0, +// &staticM0, +// []uint32{6, 7, 8}, +// "abc", +// Raw{}, +// RawExt{}, +// &Raw{}, +// &RawExt{}, +// unsafe.Pointer(&i0), +// } { +// i2 := rv2i(reflect.ValueOf(i)) +// eq := reflect.DeepEqual(i, i2) +// fmt.Printf(">>>> %v == %v? %v\n", i, i2, eq) +// } +// // os.Exit(0) +// } + +// func init() { +// staticRv2iTest() +// } + +// func rv2i(rv reflect.Value) interface{} { +// if _USE_RV_INTERFACE || rv.Kind() == reflect.Interface || rv.CanAddr() { +// return rv.Interface() +// } +// // var i interface{} +// // ui := (*unsafeIntf)(unsafe.Pointer(&i)) +// var ui unsafeIntf +// urv := (*unsafeReflectValue)(unsafe.Pointer(&rv)) +// // fmt.Printf("urv: flag: %b, typ: %b, ptr: %b\n", urv.flag, uintptr(urv.typ), uintptr(urv.ptr)) +// if (urv.flag&unsafeRvFlagKindMask)&unsafeRvKindDirectIface == 0 { +// if urv.flag&unsafeRvFlagAddr != 0 { +// println("***** indirect and addressable! Needs typed move - delegate to rv.Interface()") +// return rv.Interface() +// } +// println("****** indirect type/kind") +// ui.word = urv.ptr +// } else if urv.flag&unsafeRvFlagIndir != 0 { +// println("****** unsafe rv flag indir") +// ui.word = *(*unsafe.Pointer)(urv.ptr) +// } else { +// println("****** default: assign prt to word directly") +// ui.word = urv.ptr +// } +// // ui.word = urv.ptr +// ui.typ = urv.typ +// // fmt.Printf("(pointers) ui.typ: %p, word: %p\n", ui.typ, ui.word) +// // fmt.Printf("(binary) ui.typ: %b, word: %b\n", uintptr(ui.typ), uintptr(ui.word)) +// return *(*interface{})(unsafe.Pointer(&ui)) +// // return i +// } diff --git a/vendor/github.com/ugorji/go/codec/json.go b/vendor/github.com/ugorji/go/codec/json.go index df67d68ce..ec7b0d656 100644 --- a/vendor/github.com/ugorji/go/codec/json.go +++ b/vendor/github.com/ugorji/go/codec/json.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -17,16 +17,6 @@ package codec // Note: // - we cannot use strconv.Quote and strconv.Unquote because json quotes/unquotes differently. // We implement it here. -// - Also, strconv.ParseXXX for floats and integers -// - only works on strings resulting in unnecessary allocation and []byte-string conversion. -// - it does a lot of redundant checks, because json numbers are simpler that what it supports. -// - We parse numbers (floats and integers) directly here. -// We only delegate parsing floats if it is a hairy float which could cause a loss of precision. -// In that case, we delegate to strconv.ParseFloat. -// -// Note: -// - encode does not beautify. There is no whitespace when encoding. -// - rpc calls which take single integer arguments or write single numeric arguments will need care. // Top-level methods of json(End|Dec)Driver (which are implementations of (en|de)cDriver // MUST not call one-another. @@ -34,42 +24,41 @@ package codec import ( "bytes" "encoding/base64" - "fmt" + "math" "reflect" "strconv" + "time" + "unicode" "unicode/utf16" "unicode/utf8" ) //-------------------------------- -var ( - jsonLiterals = [...]byte{'t', 'r', 'u', 'e', 'f', 'a', 'l', 's', 'e', 'n', 'u', 'l', 'l'} +var jsonLiterals = [...]byte{ + '"', 't', 'r', 'u', 'e', '"', + '"', 'f', 'a', 'l', 's', 'e', '"', + '"', 'n', 'u', 'l', 'l', '"', +} - jsonFloat64Pow10 = [...]float64{ - 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, - 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, - 1e20, 1e21, 1e22, - } - - jsonUint64Pow10 = [...]uint64{ - 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, - 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, - } - - // jsonTabs and jsonSpaces are used as caches for indents - jsonTabs, jsonSpaces string +const ( + jsonLitTrueQ = 0 + jsonLitTrue = 1 + jsonLitFalseQ = 6 + jsonLitFalse = 7 + jsonLitNullQ = 13 + jsonLitNull = 14 ) const ( - // jsonUnreadAfterDecNum controls whether we unread after decoding a number. - // - // instead of unreading, just update d.tok (iff it's not a whitespace char) - // However, doing this means that we may HOLD onto some data which belongs to another stream. - // Thus, it is safest to unread the data when done. - // keep behind a constant flag for now. - jsonUnreadAfterDecNum = true + jsonU4Chk2 = '0' + jsonU4Chk1 = 'a' - 10 + jsonU4Chk0 = 'A' - 10 + jsonScratchArrayLen = 64 +) + +const ( // If !jsonValidateSymbols, decoding will be faster, by skipping some checks: // - If we see first character of null, false or true, // do not validate subsequent characters. @@ -78,48 +67,156 @@ const ( // P.S. Do not expect a significant decoding boost from this. jsonValidateSymbols = true - // if jsonTruncateMantissa, truncate mantissa if trailing 0's. - // This is important because it could allow some floats to be decoded without - // deferring to strconv.ParseFloat. - jsonTruncateMantissa = true - - // if mantissa >= jsonNumUintCutoff before multiplying by 10, this is an overflow - jsonNumUintCutoff = (1<<64-1)/uint64(10) + 1 // cutoff64(base) - - // if mantissa >= jsonNumUintMaxVal, this is an overflow - jsonNumUintMaxVal = 1< & + var i byte + for i = 32; i < utf8.RuneSelf; i++ { + switch i { + case '"', '\\': + case '<', '>', '&': + jsonCharSafeSet.set(i) // = true + default: + jsonCharSafeSet.set(i) + jsonCharHtmlSafeSet.set(i) + } + } + for i = 0; i <= utf8.RuneSelf; i++ { + switch i { + case ' ', '\t', '\r', '\n': + jsonCharWhitespaceSet.set(i) + case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'e', 'E', '.', '+', '-': + jsonNumSet.set(i) + } } - jsonTabs = string(bs[:]) } -type jsonEncDriver struct { - e *Encoder - w encWriter - h *JsonHandle - b [64]byte // scratch - bs []byte // scratch - se setExtWrapper - ds string // indent string - dl uint16 // indent level - dt bool // indent using tabs - d bool // indent +// ---------------- + +type jsonEncDriverTypical struct { + w encWriter + // w *encWriterSwitch + b *[jsonScratchArrayLen]byte + tw bool // term white space c containerState - noBuiltInTypes +} + +func (e *jsonEncDriverTypical) typical() {} + +func (e *jsonEncDriverTypical) reset(ee *jsonEncDriver) { + e.w = ee.ew + // e.w = &ee.e.encWriterSwitch + e.b = &ee.b + e.tw = ee.h.TermWhitespace + e.c = 0 +} + +func (e *jsonEncDriverTypical) WriteArrayStart(length int) { + e.w.writen1('[') + e.c = containerArrayStart +} + +func (e *jsonEncDriverTypical) WriteArrayElem() { + if e.c != containerArrayStart { + e.w.writen1(',') + } + e.c = containerArrayElem +} + +func (e *jsonEncDriverTypical) WriteArrayEnd() { + e.w.writen1(']') + e.c = containerArrayEnd +} + +func (e *jsonEncDriverTypical) WriteMapStart(length int) { + e.w.writen1('{') + e.c = containerMapStart +} + +func (e *jsonEncDriverTypical) WriteMapElemKey() { + if e.c != containerMapStart { + e.w.writen1(',') + } + e.c = containerMapKey +} + +func (e *jsonEncDriverTypical) WriteMapElemValue() { + e.w.writen1(':') + e.c = containerMapValue +} + +func (e *jsonEncDriverTypical) WriteMapEnd() { + e.w.writen1('}') + e.c = containerMapEnd +} + +func (e *jsonEncDriverTypical) EncodeBool(b bool) { + if b { + e.w.writeb(jsonLiterals[jsonLitTrue : jsonLitTrue+4]) + } else { + e.w.writeb(jsonLiterals[jsonLitFalse : jsonLitFalse+5]) + } +} + +func (e *jsonEncDriverTypical) EncodeFloat64(f float64) { + fmt, prec := jsonFloatStrconvFmtPrec(f) + e.w.writeb(strconv.AppendFloat(e.b[:0], f, fmt, prec, 64)) +} + +func (e *jsonEncDriverTypical) EncodeInt(v int64) { + e.w.writeb(strconv.AppendInt(e.b[:0], v, 10)) +} + +func (e *jsonEncDriverTypical) EncodeUint(v uint64) { + e.w.writeb(strconv.AppendUint(e.b[:0], v, 10)) +} + +func (e *jsonEncDriverTypical) EncodeFloat32(f float32) { + e.EncodeFloat64(float64(f)) +} + +func (e *jsonEncDriverTypical) atEndOfEncode() { + if e.tw { + e.w.writen1(' ') + } +} + +// ---------------- + +type jsonEncDriverGeneric struct { + w encWriter // encWriter // *encWriterSwitch + b *[jsonScratchArrayLen]byte + c containerState + // ds string // indent string + di int8 // indent per + d bool // indenting? + dt bool // indent using tabs + dl uint16 // indent level + ks bool // map key as string + is byte // integer as string + tw bool // term white space + _ [7]byte // padding } // indent is done as below: @@ -127,115 +224,227 @@ type jsonEncDriver struct { // - newline and indent are added before each ending, // except there was no entry (so we can have {} or []) -func (e *jsonEncDriver) sendContainerState(c containerState) { - // determine whether to output separators - if c == containerMapKey { - if e.c != containerMapStart { - e.w.writen1(',') - } - if e.d { - e.writeIndent() - } - } else if c == containerMapValue { - if e.d { - e.w.writen2(':', ' ') - } else { - e.w.writen1(':') - } - } else if c == containerMapEnd { - if e.d { - e.dl-- - if e.c != containerMapStart { - e.writeIndent() - } - } - e.w.writen1('}') - } else if c == containerArrayElem { +func (e *jsonEncDriverGeneric) reset(ee *jsonEncDriver) { + e.w = ee.ew + e.b = &ee.b + e.tw = ee.h.TermWhitespace + e.c = 0 + e.d, e.dt, e.dl, e.di = false, false, 0, 0 + h := ee.h + if h.Indent > 0 { + e.d = true + e.di = int8(h.Indent) + } else if h.Indent < 0 { + e.d = true + e.dt = true + e.di = int8(-h.Indent) + } + e.ks = h.MapKeyAsString + e.is = h.IntegerAsString +} + +func (e *jsonEncDriverGeneric) WriteArrayStart(length int) { + if e.d { + e.dl++ + } + e.w.writen1('[') + e.c = containerArrayStart +} + +func (e *jsonEncDriverGeneric) WriteArrayElem() { + if e.c != containerArrayStart { + e.w.writen1(',') + } + if e.d { + e.writeIndent() + } + e.c = containerArrayElem +} + +func (e *jsonEncDriverGeneric) WriteArrayEnd() { + if e.d { + e.dl-- if e.c != containerArrayStart { - e.w.writen1(',') - } - if e.d { e.writeIndent() } - } else if c == containerArrayEnd { - if e.d { - e.dl-- - if e.c != containerArrayStart { - e.writeIndent() - } - } - e.w.writen1(']') } - e.c = c + e.w.writen1(']') + e.c = containerArrayEnd } -func (e *jsonEncDriver) writeIndent() { +func (e *jsonEncDriverGeneric) WriteMapStart(length int) { + if e.d { + e.dl++ + } + e.w.writen1('{') + e.c = containerMapStart +} + +func (e *jsonEncDriverGeneric) WriteMapElemKey() { + if e.c != containerMapStart { + e.w.writen1(',') + } + if e.d { + e.writeIndent() + } + e.c = containerMapKey +} + +func (e *jsonEncDriverGeneric) WriteMapElemValue() { + if e.d { + e.w.writen2(':', ' ') + } else { + e.w.writen1(':') + } + e.c = containerMapValue +} + +func (e *jsonEncDriverGeneric) WriteMapEnd() { + if e.d { + e.dl-- + if e.c != containerMapStart { + e.writeIndent() + } + } + e.w.writen1('}') + e.c = containerMapEnd +} + +func (e *jsonEncDriverGeneric) writeIndent() { e.w.writen1('\n') - if x := len(e.ds) * int(e.dl); x <= jsonSpacesOrTabsLen { - if e.dt { - e.w.writestr(jsonTabs[:x]) + x := int(e.di) * int(e.dl) + if e.dt { + for x > jsonSpacesOrTabsLen { + e.w.writeb(jsonTabs[:]) + x -= jsonSpacesOrTabsLen + } + e.w.writeb(jsonTabs[:x]) + } else { + for x > jsonSpacesOrTabsLen { + e.w.writeb(jsonSpaces[:]) + x -= jsonSpacesOrTabsLen + } + e.w.writeb(jsonSpaces[:x]) + } +} + +func (e *jsonEncDriverGeneric) EncodeBool(b bool) { + if e.ks && e.c == containerMapKey { + if b { + e.w.writeb(jsonLiterals[jsonLitTrueQ : jsonLitTrueQ+6]) } else { - e.w.writestr(jsonSpaces[:x]) + e.w.writeb(jsonLiterals[jsonLitFalseQ : jsonLitFalseQ+7]) } } else { - for i := uint16(0); i < e.dl; i++ { - e.w.writestr(e.ds) + if b { + e.w.writeb(jsonLiterals[jsonLitTrue : jsonLitTrue+4]) + } else { + e.w.writeb(jsonLiterals[jsonLitFalse : jsonLitFalse+5]) } } } -func (e *jsonEncDriver) EncodeNil() { - e.w.writeb(jsonLiterals[9:13]) // null -} +func (e *jsonEncDriverGeneric) EncodeFloat64(f float64) { + // instead of using 'g', specify whether to use 'e' or 'f' + fmt, prec := jsonFloatStrconvFmtPrec(f) -func (e *jsonEncDriver) EncodeBool(b bool) { - if b { - e.w.writeb(jsonLiterals[0:4]) // true + var blen int + if e.ks && e.c == containerMapKey { + blen = 2 + len(strconv.AppendFloat(e.b[1:1], f, fmt, prec, 64)) + e.b[0] = '"' + e.b[blen-1] = '"' } else { - e.w.writeb(jsonLiterals[4:9]) // false + blen = len(strconv.AppendFloat(e.b[:0], f, fmt, prec, 64)) } + e.w.writeb(e.b[:blen]) } -func (e *jsonEncDriver) EncodeFloat32(f float32) { - e.encodeFloat(float64(f), 32) -} - -func (e *jsonEncDriver) EncodeFloat64(f float64) { - // e.w.writestr(strconv.FormatFloat(f, 'E', -1, 64)) - e.encodeFloat(f, 64) -} - -func (e *jsonEncDriver) encodeFloat(f float64, numbits int) { - x := strconv.AppendFloat(e.b[:0], f, 'G', -1, numbits) - e.w.writeb(x) - if bytes.IndexByte(x, 'E') == -1 && bytes.IndexByte(x, '.') == -1 { - e.w.writen2('.', '0') - } -} - -func (e *jsonEncDriver) EncodeInt(v int64) { - if x := e.h.IntegerAsString; x == 'A' || x == 'L' && (v > 1<<53 || v < -(1<<53)) { - e.w.writen1('"') - e.w.writeb(strconv.AppendInt(e.b[:0], v, 10)) - e.w.writen1('"') +func (e *jsonEncDriverGeneric) EncodeInt(v int64) { + x := e.is + if x == 'A' || x == 'L' && (v > 1<<53 || v < -(1<<53)) || (e.ks && e.c == containerMapKey) { + blen := 2 + len(strconv.AppendInt(e.b[1:1], v, 10)) + e.b[0] = '"' + e.b[blen-1] = '"' + e.w.writeb(e.b[:blen]) return } e.w.writeb(strconv.AppendInt(e.b[:0], v, 10)) } -func (e *jsonEncDriver) EncodeUint(v uint64) { - if x := e.h.IntegerAsString; x == 'A' || x == 'L' && v > 1<<53 { - e.w.writen1('"') - e.w.writeb(strconv.AppendUint(e.b[:0], v, 10)) - e.w.writen1('"') +func (e *jsonEncDriverGeneric) EncodeUint(v uint64) { + x := e.is + if x == 'A' || x == 'L' && v > 1<<53 || (e.ks && e.c == containerMapKey) { + blen := 2 + len(strconv.AppendUint(e.b[1:1], v, 10)) + e.b[0] = '"' + e.b[blen-1] = '"' + e.w.writeb(e.b[:blen]) return } e.w.writeb(strconv.AppendUint(e.b[:0], v, 10)) } +func (e *jsonEncDriverGeneric) EncodeFloat32(f float32) { + // e.encodeFloat(float64(f), 32) + // always encode all floats as IEEE 64-bit floating point. + // It also ensures that we can decode in full precision even if into a float32, + // as what is written is always to float64 precision. + e.EncodeFloat64(float64(f)) +} + +func (e *jsonEncDriverGeneric) atEndOfEncode() { + if e.tw { + if e.d { + e.w.writen1('\n') + } else { + e.w.writen1(' ') + } + } +} + +// -------------------- + +type jsonEncDriver struct { + noBuiltInTypes + e *Encoder + h *JsonHandle + ew encWriter // encWriter // *encWriterSwitch + se extWrapper + // ---- cpu cache line boundary? + bs []byte // scratch + // ---- cpu cache line boundary? + b [jsonScratchArrayLen]byte // scratch (encode time, +} + +func (e *jsonEncDriver) EncodeNil() { + // We always encode nil as just null (never in quotes) + // This allows us to easily decode if a nil in the json stream + // ie if initial token is n. + e.ew.writeb(jsonLiterals[jsonLitNull : jsonLitNull+4]) + + // if e.h.MapKeyAsString && e.c == containerMapKey { + // e.ew.writeb(jsonLiterals[jsonLitNullQ : jsonLitNullQ+6]) + // } else { + // e.ew.writeb(jsonLiterals[jsonLitNull : jsonLitNull+4]) + // } +} + +func (e *jsonEncDriver) EncodeTime(t time.Time) { + // Do NOT use MarshalJSON, as it allocates internally. + // instead, we call AppendFormat directly, using our scratch buffer (e.b) + if t.IsZero() { + e.EncodeNil() + } else { + e.b[0] = '"' + b := t.AppendFormat(e.b[1:1], time.RFC3339Nano) + e.b[len(b)+1] = '"' + e.ew.writeb(e.b[:len(b)+2]) + } + // v, err := t.MarshalJSON(); if err != nil { e.e.error(err) } e.ew.writeb(v) +} + func (e *jsonEncDriver) EncodeExt(rv interface{}, xtag uint64, ext Ext, en *Encoder) { if v := ext.ConvertExt(rv); v == nil { - e.w.writeb(jsonLiterals[9:13]) // null // e.EncodeNil() + e.EncodeNil() } else { en.encode(v) } @@ -244,76 +453,61 @@ func (e *jsonEncDriver) EncodeExt(rv interface{}, xtag uint64, ext Ext, en *Enco func (e *jsonEncDriver) EncodeRawExt(re *RawExt, en *Encoder) { // only encodes re.Value (never re.Data) if re.Value == nil { - e.w.writeb(jsonLiterals[9:13]) // null // e.EncodeNil() + e.EncodeNil() } else { en.encode(re.Value) } } -func (e *jsonEncDriver) EncodeArrayStart(length int) { - if e.d { - e.dl++ - } - e.w.writen1('[') - e.c = containerArrayStart -} - -func (e *jsonEncDriver) EncodeMapStart(length int) { - if e.d { - e.dl++ - } - e.w.writen1('{') - e.c = containerMapStart -} - func (e *jsonEncDriver) EncodeString(c charEncoding, v string) { - // e.w.writestr(strconv.Quote(v)) - e.quoteStr(v) -} - -func (e *jsonEncDriver) EncodeSymbol(v string) { - // e.EncodeString(c_UTF8, v) e.quoteStr(v) } func (e *jsonEncDriver) EncodeStringBytes(c charEncoding, v []byte) { // if encoding raw bytes and RawBytesExt is configured, use it to encode - if c == c_RAW && e.se.i != nil { - e.EncodeExt(v, 0, &e.se, e.e) + if v == nil { + e.EncodeNil() return } - if c == c_RAW { - slen := base64.StdEncoding.EncodedLen(len(v)) - if cap(e.bs) >= slen { - e.bs = e.bs[:slen] - } else { - e.bs = make([]byte, slen) + if c == cRAW { + if e.se.InterfaceExt != nil { + e.EncodeExt(v, 0, &e.se, e.e) + return } - base64.StdEncoding.Encode(e.bs, v) - e.w.writen1('"') - e.w.writeb(e.bs) - e.w.writen1('"') + + slen := base64.StdEncoding.EncodedLen(len(v)) + if cap(e.bs) >= slen+2 { + e.bs = e.bs[:slen+2] + } else { + e.bs = make([]byte, slen+2) + } + e.bs[0] = '"' + base64.StdEncoding.Encode(e.bs[1:], v) + e.bs[slen+1] = '"' + e.ew.writeb(e.bs) } else { - // e.EncodeString(c, string(v)) e.quoteStr(stringView(v)) } } func (e *jsonEncDriver) EncodeAsis(v []byte) { - e.w.writeb(v) + e.ew.writeb(v) } func (e *jsonEncDriver) quoteStr(s string) { // adapted from std pkg encoding/json const hex = "0123456789abcdef" - w := e.w + w := e.ew + htmlasis := e.h.HTMLCharsAsIs w.writen1('"') - start := 0 - for i := 0; i < len(s); { + var start int + for i, slen := 0, len(s); i < slen; { // encode all bytes < 0x20 (except \r, \n). // also encode < > & to prevent security holes when served to some browsers. if b := s[i]; b < utf8.RuneSelf { - if 0x20 <= b && b != '\\' && b != '"' && b != '<' && b != '>' && b != '&' { + // if 0x20 <= b && b != '\\' && b != '"' && b != '<' && b != '>' && b != '&' { + // if (htmlasis && jsonCharSafeSet.isset(b)) || jsonCharHtmlSafeSet.isset(b) { + if jsonCharHtmlSafeSet.isset(b) || (htmlasis && jsonCharSafeSet.isset(b)) { i++ continue } @@ -333,13 +527,6 @@ func (e *jsonEncDriver) quoteStr(s string) { w.writen2('\\', 'f') case '\t': w.writen2('\\', 't') - case '<', '>', '&': - if e.h.HTMLCharsAsIs { - w.writen1(b) - } else { - w.writestr(`\u00`) - w.writen2(hex[b>>4], hex[b&0xF]) - } default: w.writestr(`\u00`) w.writen2(hex[b>>4], hex[b&0xF]) @@ -378,123 +565,32 @@ func (e *jsonEncDriver) quoteStr(s string) { w.writen1('"') } -//-------------------------------- - -type jsonNum struct { - // bytes []byte // may have [+-.eE0-9] - mantissa uint64 // where mantissa ends, and maybe dot begins. - exponent int16 // exponent value. - manOverflow bool - neg bool // started with -. No initial sign in the bytes above. - dot bool // has dot - explicitExponent bool // explicit exponent -} - -func (x *jsonNum) reset() { - x.manOverflow = false - x.neg = false - x.dot = false - x.explicitExponent = false - x.mantissa = 0 - x.exponent = 0 -} - -// uintExp is called only if exponent > 0. -func (x *jsonNum) uintExp() (n uint64, overflow bool) { - n = x.mantissa - e := x.exponent - if e >= int16(len(jsonUint64Pow10)) { - overflow = true - return - } - n *= jsonUint64Pow10[e] - if n < x.mantissa || n > jsonNumUintMaxVal { - overflow = true - return - } - return - // for i := int16(0); i < e; i++ { - // if n >= jsonNumUintCutoff { - // overflow = true - // return - // } - // n *= 10 - // } - // return -} - -// these constants are only used withn floatVal. -// They are brought out, so that floatVal can be inlined. -const ( - jsonUint64MantissaBits = 52 - jsonMaxExponent = int16(len(jsonFloat64Pow10)) - 1 -) - -func (x *jsonNum) floatVal() (f float64, parseUsingStrConv bool) { - // We do not want to lose precision. - // Consequently, we will delegate to strconv.ParseFloat if any of the following happen: - // - There are more digits than in math.MaxUint64: 18446744073709551615 (20 digits) - // We expect up to 99.... (19 digits) - // - The mantissa cannot fit into a 52 bits of uint64 - // - The exponent is beyond our scope ie beyong 22. - parseUsingStrConv = x.manOverflow || - x.exponent > jsonMaxExponent || - (x.exponent < 0 && -(x.exponent) > jsonMaxExponent) || - x.mantissa>>jsonUint64MantissaBits != 0 - - if parseUsingStrConv { - return - } - - // all good. so handle parse here. - f = float64(x.mantissa) - // fmt.Printf(".Float: uint64 value: %v, float: %v\n", m, f) - if x.neg { - f = -f - } - if x.exponent > 0 { - f *= jsonFloat64Pow10[x.exponent] - } else if x.exponent < 0 { - f /= jsonFloat64Pow10[-x.exponent] - } - return -} - type jsonDecDriver struct { noBuiltInTypes - d *Decoder - h *JsonHandle - r decReader + d *Decoder + h *JsonHandle + r decReader // *decReaderSwitch // decReader + se extWrapper + + // ---- writable fields during execution --- *try* to keep in sep cache line c containerState // tok is used to store the token read right after skipWhiteSpace. - tok uint8 + tok uint8 + fnull bool // found null from appendStringAsBytes + bs []byte // scratch. Initialized from b. Used for parsing strings or numbers. + bstr [8]byte // scratch used for string \UXXX parsing + // ---- cpu cache line boundary? + b [jsonScratchArrayLen]byte // scratch 1, used for parsing strings or numbers or time.Time + b2 [jsonScratchArrayLen]byte // scratch 2, used only for readUntil, decNumBytes - bstr [8]byte // scratch used for string \UXXX parsing - b [64]byte // scratch, used for parsing strings or numbers - b2 [64]byte // scratch, used only for decodeBytes (after base64) - bs []byte // scratch. Initialized from b. Used for parsing strings or numbers. - - se setExtWrapper - - n jsonNum + _ [3]uint64 // padding + // n jsonNum } -func jsonIsWS(b byte) bool { - return b == ' ' || b == '\t' || b == '\r' || b == '\n' -} - -// // This will skip whitespace characters and return the next byte to read. -// // The next byte determines what the value will be one of. -// func (d *jsonDecDriver) skipWhitespace() { -// // fast-path: do not enter loop. Just check first (in case no whitespace). -// b := d.r.readn1() -// if jsonIsWS(b) { -// r := d.r -// for b = r.readn1(); jsonIsWS(b); b = r.readn1() { -// } -// } -// d.tok = b +// func jsonIsWS(b byte) bool { +// // return b == ' ' || b == '\t' || b == '\r' || b == '\n' +// return jsonCharWhitespaceSet.isset(b) // } func (d *jsonDecDriver) uncacheRead() { @@ -504,110 +600,13 @@ func (d *jsonDecDriver) uncacheRead() { } } -func (d *jsonDecDriver) sendContainerState(c containerState) { - if d.tok == 0 { - var b byte - r := d.r - for b = r.readn1(); jsonIsWS(b); b = r.readn1() { - } - d.tok = b - } - var xc uint8 // char expected - if c == containerMapKey { - if d.c != containerMapStart { - xc = ',' - } - } else if c == containerMapValue { - xc = ':' - } else if c == containerMapEnd { - xc = '}' - } else if c == containerArrayElem { - if d.c != containerArrayStart { - xc = ',' - } - } else if c == containerArrayEnd { - xc = ']' - } - if xc != 0 { - if d.tok != xc { - d.d.errorf("json: expect char '%c' but got char '%c'", xc, d.tok) - } - d.tok = 0 - } - d.c = c -} - -func (d *jsonDecDriver) CheckBreak() bool { - if d.tok == 0 { - var b byte - r := d.r - for b = r.readn1(); jsonIsWS(b); b = r.readn1() { - } - d.tok = b - } - if d.tok == '}' || d.tok == ']' { - // d.tok = 0 // only checking, not consuming - return true - } - return false -} - -func (d *jsonDecDriver) readStrIdx(fromIdx, toIdx uint8) { - bs := d.r.readx(int(toIdx - fromIdx)) - d.tok = 0 - if jsonValidateSymbols { - if !bytes.Equal(bs, jsonLiterals[fromIdx:toIdx]) { - d.d.errorf("json: expecting %s: got %s", jsonLiterals[fromIdx:toIdx], bs) - return - } - } -} - -func (d *jsonDecDriver) TryDecodeAsNil() bool { - if d.tok == 0 { - var b byte - r := d.r - for b = r.readn1(); jsonIsWS(b); b = r.readn1() { - } - d.tok = b - } - if d.tok == 'n' { - d.readStrIdx(10, 13) // ull - return true - } - return false -} - -func (d *jsonDecDriver) DecodeBool() bool { - if d.tok == 0 { - var b byte - r := d.r - for b = r.readn1(); jsonIsWS(b); b = r.readn1() { - } - d.tok = b - } - if d.tok == 'f' { - d.readStrIdx(5, 9) // alse - return false - } - if d.tok == 't' { - d.readStrIdx(1, 4) // rue - return true - } - d.d.errorf("json: decode bool: got first char %c", d.tok) - return false // "unreachable" -} - func (d *jsonDecDriver) ReadMapStart() int { if d.tok == 0 { - var b byte - r := d.r - for b = r.readn1(); jsonIsWS(b); b = r.readn1() { - } - d.tok = b + d.tok = d.r.skip(&jsonCharWhitespaceSet) } - if d.tok != '{' { - d.d.errorf("json: expect char '%c' but got char '%c'", '{', d.tok) + const xc uint8 = '{' + if d.tok != xc { + d.d.errorf("expect char '%c' but got char '%c'", xc, d.tok) } d.tok = 0 d.c = containerMapStart @@ -616,29 +615,168 @@ func (d *jsonDecDriver) ReadMapStart() int { func (d *jsonDecDriver) ReadArrayStart() int { if d.tok == 0 { - var b byte - r := d.r - for b = r.readn1(); jsonIsWS(b); b = r.readn1() { - } - d.tok = b + d.tok = d.r.skip(&jsonCharWhitespaceSet) } - if d.tok != '[' { - d.d.errorf("json: expect char '%c' but got char '%c'", '[', d.tok) + const xc uint8 = '[' + if d.tok != xc { + d.d.errorf("expect char '%c' but got char '%c'", xc, d.tok) } d.tok = 0 d.c = containerArrayStart return -1 } +func (d *jsonDecDriver) CheckBreak() bool { + if d.tok == 0 { + d.tok = d.r.skip(&jsonCharWhitespaceSet) + } + return d.tok == '}' || d.tok == ']' +} + +// For the ReadXXX methods below, we could just delegate to helper functions +// readContainerState(c containerState, xc uint8, check bool) +// - ReadArrayElem would become: +// readContainerState(containerArrayElem, ',', d.c != containerArrayStart) +// +// However, until mid-stack inlining (go 1.10?) comes, supporting inlining of +// oneliners, we explicitly write them all 5 out to elide the extra func call. +// TODO: For Go 1.10, if inlined, consider consolidating these. + +func (d *jsonDecDriver) ReadArrayElem() { + const xc uint8 = ',' + if d.tok == 0 { + d.tok = d.r.skip(&jsonCharWhitespaceSet) + } + if d.c != containerArrayStart { + if d.tok != xc { + d.d.errorf("expect char '%c' but got char '%c'", xc, d.tok) + } + d.tok = 0 + } + d.c = containerArrayElem +} + +func (d *jsonDecDriver) ReadArrayEnd() { + const xc uint8 = ']' + if d.tok == 0 { + d.tok = d.r.skip(&jsonCharWhitespaceSet) + } + if d.tok != xc { + d.d.errorf("expect char '%c' but got char '%c'", xc, d.tok) + } + d.tok = 0 + d.c = containerArrayEnd +} + +func (d *jsonDecDriver) ReadMapElemKey() { + const xc uint8 = ',' + if d.tok == 0 { + d.tok = d.r.skip(&jsonCharWhitespaceSet) + } + if d.c != containerMapStart { + if d.tok != xc { + d.d.errorf("expect char '%c' but got char '%c'", xc, d.tok) + } + d.tok = 0 + } + d.c = containerMapKey +} + +func (d *jsonDecDriver) ReadMapElemValue() { + const xc uint8 = ':' + if d.tok == 0 { + d.tok = d.r.skip(&jsonCharWhitespaceSet) + } + if d.tok != xc { + d.d.errorf("expect char '%c' but got char '%c'", xc, d.tok) + } + d.tok = 0 + d.c = containerMapValue +} + +func (d *jsonDecDriver) ReadMapEnd() { + const xc uint8 = '}' + if d.tok == 0 { + d.tok = d.r.skip(&jsonCharWhitespaceSet) + } + if d.tok != xc { + d.d.errorf("expect char '%c' but got char '%c'", xc, d.tok) + } + d.tok = 0 + d.c = containerMapEnd +} + +func (d *jsonDecDriver) readLit(length, fromIdx uint8) { + bs := d.r.readx(int(length)) + d.tok = 0 + if jsonValidateSymbols && !bytes.Equal(bs, jsonLiterals[fromIdx:fromIdx+length]) { + d.d.errorf("expecting %s: got %s", jsonLiterals[fromIdx:fromIdx+length], bs) + return + } +} + +func (d *jsonDecDriver) TryDecodeAsNil() bool { + if d.tok == 0 { + d.tok = d.r.skip(&jsonCharWhitespaceSet) + } + // we shouldn't try to see if "null" was here, right? + // only the plain string: `null` denotes a nil (ie not quotes) + if d.tok == 'n' { + d.readLit(3, jsonLitNull+1) // (n)ull + return true + } + return false +} + +func (d *jsonDecDriver) DecodeBool() (v bool) { + if d.tok == 0 { + d.tok = d.r.skip(&jsonCharWhitespaceSet) + } + fquot := d.c == containerMapKey && d.tok == '"' + if fquot { + d.tok = d.r.readn1() + } + switch d.tok { + case 'f': + d.readLit(4, jsonLitFalse+1) // (f)alse + // v = false + case 't': + d.readLit(3, jsonLitTrue+1) // (t)rue + v = true + default: + d.d.errorf("decode bool: got first char %c", d.tok) + // v = false // "unreachable" + } + if fquot { + d.r.readn1() + } + return +} + +func (d *jsonDecDriver) DecodeTime() (t time.Time) { + // read string, and pass the string into json.unmarshal + d.appendStringAsBytes() + if d.fnull { + return + } + t, err := time.Parse(time.RFC3339, stringView(d.bs)) + if err != nil { + d.d.errorv(err) + } + return +} + func (d *jsonDecDriver) ContainerType() (vt valueType) { // check container type by checking the first char if d.tok == 0 { - var b byte - r := d.r - for b = r.readn1(); jsonIsWS(b); b = r.readn1() { - } - d.tok = b + d.tok = d.r.skip(&jsonCharWhitespaceSet) } + + // optimize this, so we don't do 4 checks but do one computation. + // return jsonContainerSet[d.tok] + + // ContainerType is mostly called for Map and Array, + // so this conditional is good enough (max 2 checks typically) if b := d.tok; b == '{' { return valueTypeMap } else if b == '[' { @@ -649,269 +787,87 @@ func (d *jsonDecDriver) ContainerType() (vt valueType) { return valueTypeString } return valueTypeUnset - // d.d.errorf("isContainerType: unsupported parameter: %v", vt) - // return false // "unreachable" } -func (d *jsonDecDriver) decNum(storeBytes bool) { - // If it is has a . or an e|E, decode as a float; else decode as an int. +func (d *jsonDecDriver) decNumBytes() (bs []byte) { + // stores num bytes in d.bs if d.tok == 0 { - var b byte - r := d.r - for b = r.readn1(); jsonIsWS(b); b = r.readn1() { - } - d.tok = b + d.tok = d.r.skip(&jsonCharWhitespaceSet) } - b := d.tok - var str bool - if b == '"' { - str = true - b = d.r.readn1() - } - if !(b == '+' || b == '-' || b == '.' || (b >= '0' && b <= '9')) { - d.d.errorf("json: decNum: got first char '%c'", b) - return + if d.tok == '"' { + bs = d.r.readUntil(d.b2[:0], '"') + bs = bs[:len(bs)-1] + } else { + d.r.unreadn1() + bs = d.r.readTo(d.bs[:0], &jsonNumSet) } d.tok = 0 + return bs +} - const cutoff = (1<<64-1)/uint64(10) + 1 // cutoff64(base) - const jsonNumUintMaxVal = 1<= jsonNumUintCutoff { - n.manOverflow = true - break - } - v := uint64(b - '0') - n.mantissa *= 10 - if v != 0 { - n1 := n.mantissa + v - if n1 < n.mantissa || n1 > jsonNumUintMaxVal { - n.manOverflow = true // n+v overflows - break - } - n.mantissa = n1 - } - case 6: - state = 7 - fallthrough - case 7: - if !(b == '0' && e == 0) { - e = e*10 + int16(b-'0') - } - default: - break LOOP - } - case '"': - if str { - if storeBytes { - d.bs = append(d.bs, '"') - } - b, eof = r.readn1eof() - } - break LOOP - default: - break LOOP - } - if storeBytes { - d.bs = append(d.bs, b) - } - b, eof = r.readn1eof() - } - - if jsonTruncateMantissa && n.mantissa != 0 { - for n.mantissa%10 == 0 { - n.mantissa /= 10 - n.exponent++ - } - } - - if e != 0 { - if eNeg { - n.exponent -= e +func (d *jsonDecDriver) DecodeInt64() (i int64) { + const cutoff = uint64(1 << uint(64-1)) + bs := d.decNumBytes() + n, neg, badsyntax, overflow := jsonParseInteger(bs) + if overflow { + d.d.errorf("overflow parsing integer: %s", bs) + } else if badsyntax { + // d.d.errorf("invalid syntax for integer: %s", bs) + // fallback: try to decode as float, and cast + if neg { + n = d.decUint64ViaFloat(stringView(bs[1:])) } else { - n.exponent += e + n = d.decUint64ViaFloat(stringView(bs)) } } - - // d.n = n - - if !eof { - if jsonUnreadAfterDecNum { - r.unreadn1() - } else { - if !jsonIsWS(b) { - d.tok = b - } + if neg { + if n > cutoff { + d.d.errorf("overflow parsing integer: %s", bs) } - } - // fmt.Printf("1: n: bytes: %s, neg: %v, dot: %v, exponent: %v, mantissaEndIndex: %v\n", - // n.bytes, n.neg, n.dot, n.exponent, n.mantissaEndIndex) - return -} - -func (d *jsonDecDriver) DecodeInt(bitsize uint8) (i int64) { - d.decNum(false) - n := &d.n - if n.manOverflow { - d.d.errorf("json: overflow integer after: %v", n.mantissa) - return - } - var u uint64 - if n.exponent == 0 { - u = n.mantissa - } else if n.exponent < 0 { - d.d.errorf("json: fractional integer") - return - } else if n.exponent > 0 { - var overflow bool - if u, overflow = n.uintExp(); overflow { - d.d.errorf("json: overflow integer") - return - } - } - i = int64(u) - if n.neg { - i = -i - } - if chkOvf.Int(i, bitsize) { - d.d.errorf("json: overflow %v bits: %s", bitsize, d.bs) - return - } - // fmt.Printf("DecodeInt: %v\n", i) - return -} - -// floatVal MUST only be called after a decNum, as d.bs now contains the bytes of the number -func (d *jsonDecDriver) floatVal() (f float64) { - f, useStrConv := d.n.floatVal() - if useStrConv { - var err error - if f, err = strconv.ParseFloat(stringView(d.bs), 64); err != nil { - panic(fmt.Errorf("parse float: %s, %v", d.bs, err)) - } - if d.n.neg { - f = -f + i = -(int64(n)) + } else { + if n >= cutoff { + d.d.errorf("overflow parsing integer: %s", bs) } + i = int64(n) } return } -func (d *jsonDecDriver) DecodeUint(bitsize uint8) (u uint64) { - d.decNum(false) - n := &d.n - if n.neg { - d.d.errorf("json: unsigned integer cannot be negative") - return +func (d *jsonDecDriver) decUint64ViaFloat(s string) (u uint64) { + f, err := strconv.ParseFloat(s, 64) + if err != nil { + d.d.errorf("invalid syntax for integer: %s", s) + // d.d.errorv(err) } - if n.manOverflow { - d.d.errorf("json: overflow integer after: %v", n.mantissa) - return + fi, ff := math.Modf(f) + if ff > 0 { + d.d.errorf("fractional part found parsing integer: %s", s) + } else if fi > float64(math.MaxUint64) { + d.d.errorf("overflow parsing integer: %s", s) } - if n.exponent == 0 { - u = n.mantissa - } else if n.exponent < 0 { - d.d.errorf("json: fractional integer") - return - } else if n.exponent > 0 { - var overflow bool - if u, overflow = n.uintExp(); overflow { - d.d.errorf("json: overflow integer") - return - } - } - if chkOvf.Uint(u, bitsize) { - d.d.errorf("json: overflow %v bits: %s", bitsize, d.bs) - return - } - // fmt.Printf("DecodeUint: %v\n", u) - return + return uint64(fi) } -func (d *jsonDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) { - d.decNum(true) - f = d.floatVal() - if chkOverflow32 && chkOvf.Float32(f) { - d.d.errorf("json: overflow float32: %v, %s", f, d.bs) - return +func (d *jsonDecDriver) DecodeFloat64() (f float64) { + bs := d.decNumBytes() + f, err := strconv.ParseFloat(stringView(bs), 64) + if err != nil { + d.d.errorv(err) } return } @@ -929,23 +885,31 @@ func (d *jsonDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxta return } -func (d *jsonDecDriver) DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut []byte) { +func (d *jsonDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { // if decoding into raw bytes, and the RawBytesExt is configured, use it to decode. - if !isstring && d.se.i != nil { + if d.se.InterfaceExt != nil { bsOut = bs d.DecodeExt(&bsOut, 0, &d.se) return } - d.appendStringAsBytes() - // if isstring, then just return the bytes, even if it is using the scratch buffer. - // the bytes will be converted to a string as needed. - if isstring { - return d.bs + if d.tok == 0 { + d.tok = d.r.skip(&jsonCharWhitespaceSet) } - // if appendStringAsBytes returned a zero-len slice, then treat as nil. - // This should only happen for null, and "". + // check if an "array" of uint8's (see ContainerType for how to infer if an array) + if d.tok == '[' { + bsOut, _ = fastpathTV.DecSliceUint8V(bs, true, d.d) + return + } + d.appendStringAsBytes() + // base64 encodes []byte{} as "", and we encode nil []byte as null. + // Consequently, base64 should decode null as a nil []byte, and "" as an empty []byte{}. + // appendStringAsBytes returns a zero-len slice for both, so as not to reset d.bs. + // However, it sets a fnull field to true, so we can check if a null was found. if len(d.bs) == 0 { - return nil + if d.fnull { + return nil + } + return []byte{} } bs0 := d.bs slen := base64.StdEncoding.DecodedLen(len(bs0)) @@ -958,7 +922,7 @@ func (d *jsonDecDriver) DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut [ } slen2, err := base64.StdEncoding.Decode(bsOut, bs0) if err != nil { - d.d.errorf("json: error decoding base64 binary '%s': %v", bs0, err) + d.d.errorf("error decoding base64 binary '%s': %v", bs0, err) return nil } if slen != slen2 { @@ -969,184 +933,256 @@ func (d *jsonDecDriver) DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut [ func (d *jsonDecDriver) DecodeString() (s string) { d.appendStringAsBytes() - // if x := d.s.sc; x != nil && x.so && x.st == '}' { // map key - if d.c == containerMapKey { - return d.d.string(d.bs) - } - return string(d.bs) + return d.bsToString() +} + +func (d *jsonDecDriver) DecodeStringAsBytes() (s []byte) { + d.appendStringAsBytes() + return d.bs } func (d *jsonDecDriver) appendStringAsBytes() { if d.tok == 0 { - var b byte - r := d.r - for b = r.readn1(); jsonIsWS(b); b = r.readn1() { - } - d.tok = b + d.tok = d.r.skip(&jsonCharWhitespaceSet) } + d.fnull = false if d.tok != '"' { - // d.d.errorf("json: expect char '%c' but got char '%c'", '"', d.tok) + // d.d.errorf("expect char '%c' but got char '%c'", '"', d.tok) // handle non-string scalar: null, true, false or a number switch d.tok { case 'n': - d.readStrIdx(10, 13) // ull + d.readLit(3, jsonLitNull+1) // (n)ull d.bs = d.bs[:0] + d.fnull = true case 'f': - d.readStrIdx(5, 9) // alse + d.readLit(4, jsonLitFalse+1) // (f)alse d.bs = d.bs[:5] copy(d.bs, "false") case 't': - d.readStrIdx(1, 4) // rue + d.readLit(3, jsonLitTrue+1) // (t)rue d.bs = d.bs[:4] copy(d.bs, "true") default: // try to parse a valid number - d.decNum(true) + bs := d.decNumBytes() + if len(bs) <= cap(d.bs) { + d.bs = d.bs[:len(bs)] + } else { + d.bs = make([]byte, len(bs)) + } + copy(d.bs, bs) } return } d.tok = 0 - - v := d.bs[:0] - var c uint8 r := d.r - for { - c = r.readn1() - if c == '"' { - break - } else if c == '\\' { - c = r.readn1() - switch c { - case '"', '\\', '/', '\'': - v = append(v, c) - case 'b': - v = append(v, '\b') - case 'f': - v = append(v, '\f') - case 'n': - v = append(v, '\n') - case 'r': - v = append(v, '\r') - case 't': - v = append(v, '\t') - case 'u': - rr := d.jsonU4(false) - // fmt.Printf("$$$$$$$$$: is surrogate: %v\n", utf16.IsSurrogate(rr)) - if utf16.IsSurrogate(rr) { - rr = utf16.DecodeRune(rr, d.jsonU4(true)) - } - w2 := utf8.EncodeRune(d.bstr[:], rr) - v = append(v, d.bstr[:w2]...) - default: - d.d.errorf("json: unsupported escaped value: %c", c) - } - } else { - v = append(v, c) + var cs = r.readUntil(d.b2[:0], '"') + var cslen = len(cs) + var c uint8 + v := d.bs[:0] + // append on each byte seen can be expensive, so we just + // keep track of where we last read a contiguous set of + // non-special bytes (using cursor variable), + // and when we see a special byte + // e.g. end-of-slice, " or \, + // we will append the full range into the v slice before proceeding + for i, cursor := 0, 0; ; { + if i == cslen { + v = append(v, cs[cursor:]...) + cs = r.readUntil(d.b2[:0], '"') + cslen = len(cs) + i, cursor = 0, 0 } + c = cs[i] + if c == '"' { + v = append(v, cs[cursor:i]...) + break + } + if c != '\\' { + i++ + continue + } + v = append(v, cs[cursor:i]...) + i++ + c = cs[i] + switch c { + case '"', '\\', '/', '\'': + v = append(v, c) + case 'b': + v = append(v, '\b') + case 'f': + v = append(v, '\f') + case 'n': + v = append(v, '\n') + case 'r': + v = append(v, '\r') + case 't': + v = append(v, '\t') + case 'u': + var r rune + var rr uint32 + if len(cs) < i+4 { // may help reduce bounds-checking + d.d.errorf("need at least 4 more bytes for unicode sequence") + } + // c = cs[i+4] // may help reduce bounds-checking + for j := 1; j < 5; j++ { + // best to use explicit if-else + // - not a table, etc which involve memory loads, array lookup with bounds checks, etc + c = cs[i+j] + if c >= '0' && c <= '9' { + rr = rr*16 + uint32(c-jsonU4Chk2) + } else if c >= 'a' && c <= 'f' { + rr = rr*16 + uint32(c-jsonU4Chk1) + } else if c >= 'A' && c <= 'F' { + rr = rr*16 + uint32(c-jsonU4Chk0) + } else { + r = unicode.ReplacementChar + i += 4 + goto encode_rune + } + } + r = rune(rr) + i += 4 + if utf16.IsSurrogate(r) { + if len(cs) >= i+6 && cs[i+2] == 'u' && cs[i+1] == '\\' { + i += 2 + // c = cs[i+4] // may help reduce bounds-checking + var rr1 uint32 + for j := 1; j < 5; j++ { + c = cs[i+j] + if c >= '0' && c <= '9' { + rr = rr*16 + uint32(c-jsonU4Chk2) + } else if c >= 'a' && c <= 'f' { + rr = rr*16 + uint32(c-jsonU4Chk1) + } else if c >= 'A' && c <= 'F' { + rr = rr*16 + uint32(c-jsonU4Chk0) + } else { + r = unicode.ReplacementChar + i += 4 + goto encode_rune + } + } + r = utf16.DecodeRune(r, rune(rr1)) + i += 4 + } else { + r = unicode.ReplacementChar + goto encode_rune + } + } + encode_rune: + w2 := utf8.EncodeRune(d.bstr[:], r) + v = append(v, d.bstr[:w2]...) + default: + d.d.errorf("unsupported escaped value: %c", c) + } + i++ + cursor = i } d.bs = v } -func (d *jsonDecDriver) jsonU4(checkSlashU bool) rune { - r := d.r - if checkSlashU && !(r.readn1() == '\\' && r.readn1() == 'u') { - d.d.errorf(`json: unquoteStr: invalid unicode sequence. Expecting \u`) - return 0 +func (d *jsonDecDriver) nakedNum(z *decNaked, bs []byte) (err error) { + const cutoff = uint64(1 << uint(64-1)) + var n uint64 + var neg, badsyntax, overflow bool + + if d.h.PreferFloat { + goto F } - // u, _ := strconv.ParseUint(string(d.bstr[:4]), 16, 64) - var u uint32 - for i := 0; i < 4; i++ { - v := r.readn1() - if '0' <= v && v <= '9' { - v = v - '0' - } else if 'a' <= v && v <= 'z' { - v = v - 'a' + 10 - } else if 'A' <= v && v <= 'Z' { - v = v - 'A' + 10 - } else { - d.d.errorf(`json: unquoteStr: invalid hex char in \u unicode sequence: %q`, v) - return 0 + n, neg, badsyntax, overflow = jsonParseInteger(bs) + if badsyntax || overflow { + goto F + } + if neg { + if n > cutoff { + goto F } - u = u*16 + uint32(v) + z.v = valueTypeInt + z.i = -(int64(n)) + } else if d.h.SignedInteger { + if n >= cutoff { + goto F + } + z.v = valueTypeInt + z.i = int64(n) + } else { + z.v = valueTypeUint + z.u = n } - return rune(u) + return +F: + z.v = valueTypeFloat + z.f, err = strconv.ParseFloat(stringView(bs), 64) + return +} + +func (d *jsonDecDriver) bsToString() string { + // if x := d.s.sc; x != nil && x.so && x.st == '}' { // map key + if jsonAlwaysReturnInternString || d.c == containerMapKey { + return d.d.string(d.bs) + } + return string(d.bs) } func (d *jsonDecDriver) DecodeNaked() { - z := &d.d.n + z := d.d.n // var decodeFurther bool if d.tok == 0 { - var b byte - r := d.r - for b = r.readn1(); jsonIsWS(b); b = r.readn1() { - } - d.tok = b + d.tok = d.r.skip(&jsonCharWhitespaceSet) } switch d.tok { case 'n': - d.readStrIdx(10, 13) // ull + d.readLit(3, jsonLitNull+1) // (n)ull z.v = valueTypeNil case 'f': - d.readStrIdx(5, 9) // alse + d.readLit(4, jsonLitFalse+1) // (f)alse z.v = valueTypeBool z.b = false case 't': - d.readStrIdx(1, 4) // rue + d.readLit(3, jsonLitTrue+1) // (t)rue z.v = valueTypeBool z.b = true case '{': - z.v = valueTypeMap - // d.tok = 0 // don't consume. kInterfaceNaked will call ReadMapStart - // decodeFurther = true + z.v = valueTypeMap // don't consume. kInterfaceNaked will call ReadMapStart case '[': - z.v = valueTypeArray - // d.tok = 0 // don't consume. kInterfaceNaked will call ReadArrayStart - // decodeFurther = true + z.v = valueTypeArray // don't consume. kInterfaceNaked will call ReadArrayStart case '"': - z.v = valueTypeString - z.s = d.DecodeString() - default: // number - d.decNum(true) - n := &d.n - // if the string had a any of [.eE], then decode as float. - switch { - case n.explicitExponent, n.dot, n.exponent < 0, n.manOverflow: - z.v = valueTypeFloat - z.f = d.floatVal() - case n.exponent == 0: - u := n.mantissa - switch { - case n.neg: - z.v = valueTypeInt - z.i = -int64(u) - case d.h.SignedInteger: - z.v = valueTypeInt - z.i = int64(u) + // if a string, and MapKeyAsString, then try to decode it as a nil, bool or number first + d.appendStringAsBytes() + if len(d.bs) > 0 && d.c == containerMapKey && d.h.MapKeyAsString { + switch stringView(d.bs) { + case "null": + z.v = valueTypeNil + case "true": + z.v = valueTypeBool + z.b = true + case "false": + z.v = valueTypeBool + z.b = false default: - z.v = valueTypeUint - z.u = u - } - default: - u, overflow := n.uintExp() - switch { - case overflow: - z.v = valueTypeFloat - z.f = d.floatVal() - case n.neg: - z.v = valueTypeInt - z.i = -int64(u) - case d.h.SignedInteger: - z.v = valueTypeInt - z.i = int64(u) - default: - z.v = valueTypeUint - z.u = u + // check if a number: float, int or uint + if err := d.nakedNum(z, d.bs); err != nil { + z.v = valueTypeString + z.s = d.bsToString() + } } + } else { + z.v = valueTypeString + z.s = d.bsToString() + } + default: // number + bs := d.decNumBytes() + if len(bs) == 0 { + d.d.errorf("decode number from empty string") + return + } + if err := d.nakedNum(z, bs); err != nil { + d.d.errorf("decode number from %s: %v", bs, err) + return } - // fmt.Printf("DecodeNaked: Number: %T, %v\n", v, v) } // if decodeFurther { // d.s.sc.retryRead() @@ -1160,26 +1196,27 @@ func (d *jsonDecDriver) DecodeNaked() { // // Json is comprehensively supported: // - decodes numbers into interface{} as int, uint or float64 +// based on how the number looks and some config parameters e.g. PreferFloat, SignedInt, etc. +// - decode integers from float formatted numbers e.g. 1.27e+8 +// - decode any json value (numbers, bool, etc) from quoted strings // - configurable way to encode/decode []byte . // by default, encodes and decodes []byte using base64 Std Encoding // - UTF-8 support for encoding and decoding // // It has better performance than the json library in the standard library, -// by leveraging the performance improvements of the codec library and -// minimizing allocations. +// by leveraging the performance improvements of the codec library. // // In addition, it doesn't read more bytes than necessary during a decode, which allows // reading multiple values from a stream containing json and non-json content. // For example, a user can read a json value, then a cbor value, then a msgpack value, // all from the same stream in sequence. +// +// Note that, when decoding quoted strings, invalid UTF-8 or invalid UTF-16 surrogate pairs are +// not treated as an error. Instead, they are replaced by the Unicode replacement character U+FFFD. type JsonHandle struct { textEncodingType BasicHandle - // RawBytesExt, if configured, is used to encode and decode raw bytes in a custom way. - // If not configured, raw bytes are encoded to/from base64 text. - RawBytesExt InterfaceExt - // Indent indicates how a value is encoded. // - If positive, indent by that number of spaces. // - If negative, indent by that number of tabs. @@ -1196,69 +1233,190 @@ type JsonHandle struct { // - if 'A', then encode all integers as a json string // containing the exact integer representation as a decimal. // - else encode all integers as a json number (default) - IntegerAsString uint8 + IntegerAsString byte // HTMLCharsAsIs controls how to encode some special characters to html: < > & // // By default, we encode them as \uXXX // to prevent security holes when served from some browsers. HTMLCharsAsIs bool + + // PreferFloat says that we will default to decoding a number as a float. + // If not set, we will examine the characters of the number and decode as an + // integer type if it doesn't have any of the characters [.eE]. + PreferFloat bool + + // TermWhitespace says that we add a whitespace character + // at the end of an encoding. + // + // The whitespace is important, especially if using numbers in a context + // where multiple items are written to a stream. + TermWhitespace bool + + // MapKeyAsString says to encode all map keys as strings. + // + // Use this to enforce strict json output. + // The only caveat is that nil value is ALWAYS written as null (never as "null") + MapKeyAsString bool + + // _ [2]byte // padding + + // Note: below, we store hardly-used items e.g. RawBytesExt is cached in the (en|de)cDriver. + + // RawBytesExt, if configured, is used to encode and decode raw bytes in a custom way. + // If not configured, raw bytes are encoded to/from base64 text. + RawBytesExt InterfaceExt + + _ [3]uint64 // padding } +// Name returns the name of the handle: json +func (h *JsonHandle) Name() string { return "json" } +func (h *JsonHandle) hasElemSeparators() bool { return true } +func (h *JsonHandle) typical() bool { + return h.Indent == 0 && !h.MapKeyAsString && h.IntegerAsString != 'A' && h.IntegerAsString != 'L' +} + +type jsonTypical interface { + typical() +} + +func (h *JsonHandle) recreateEncDriver(ed encDriver) (v bool) { + _, v = ed.(jsonTypical) + return v != h.typical() +} + +// SetInterfaceExt sets an extension func (h *JsonHandle) SetInterfaceExt(rt reflect.Type, tag uint64, ext InterfaceExt) (err error) { - return h.SetExt(rt, tag, &setExtWrapper{i: ext}) + return h.SetExt(rt, tag, &extWrapper{bytesExtFailer{}, ext}) } -func (h *JsonHandle) newEncDriver(e *Encoder) encDriver { - hd := jsonEncDriver{e: e, h: h} - hd.bs = hd.b[:0] +type jsonEncDriverTypicalImpl struct { + jsonEncDriver + jsonEncDriverTypical + _ [1]uint64 // padding +} - hd.reset() +func (x *jsonEncDriverTypicalImpl) reset() { + x.jsonEncDriver.reset() + x.jsonEncDriverTypical.reset(&x.jsonEncDriver) +} - return &hd +type jsonEncDriverGenericImpl struct { + jsonEncDriver + jsonEncDriverGeneric +} + +func (x *jsonEncDriverGenericImpl) reset() { + x.jsonEncDriver.reset() + x.jsonEncDriverGeneric.reset(&x.jsonEncDriver) +} + +func (h *JsonHandle) newEncDriver(e *Encoder) (ee encDriver) { + var hd *jsonEncDriver + if h.typical() { + var v jsonEncDriverTypicalImpl + ee = &v + hd = &v.jsonEncDriver + } else { + var v jsonEncDriverGenericImpl + ee = &v + hd = &v.jsonEncDriver + } + hd.e, hd.h, hd.bs = e, h, hd.b[:0] + hd.se.BytesExt = bytesExtFailer{} + ee.reset() + return } func (h *JsonHandle) newDecDriver(d *Decoder) decDriver { // d := jsonDecDriver{r: r.(*bytesDecReader), h: h} hd := jsonDecDriver{d: d, h: h} + hd.se.BytesExt = bytesExtFailer{} hd.bs = hd.b[:0] hd.reset() return &hd } func (e *jsonEncDriver) reset() { - e.w = e.e.w - e.se.i = e.h.RawBytesExt + e.ew = e.e.w // e.e.w // &e.e.encWriterSwitch + e.se.InterfaceExt = e.h.RawBytesExt if e.bs != nil { e.bs = e.bs[:0] } - e.d, e.dt, e.dl, e.ds = false, false, 0, "" - e.c = 0 - if e.h.Indent > 0 { - e.d = true - e.ds = jsonSpaces[:e.h.Indent] - } else if e.h.Indent < 0 { - e.d = true - e.dt = true - e.ds = jsonTabs[:-(e.h.Indent)] - } } func (d *jsonDecDriver) reset() { - d.r = d.d.r - d.se.i = d.h.RawBytesExt + d.r = d.d.r // &d.d.decReaderSwitch // d.d.r + d.se.InterfaceExt = d.h.RawBytesExt if d.bs != nil { d.bs = d.bs[:0] } d.c, d.tok = 0, 0 - d.n.reset() + // d.n.reset() } -var jsonEncodeTerminate = []byte{' '} +func jsonFloatStrconvFmtPrec(f float64) (fmt byte, prec int) { + prec = -1 + var abs = math.Abs(f) + if abs != 0 && (abs < 1e-6 || abs >= 1e21) { + fmt = 'e' + } else { + fmt = 'f' + // set prec to 1 iff mod is 0. + // better than using jsonIsFloatBytesB2 to check if a . or E in the float bytes. + // this ensures that every float has an e or .0 in it. + if abs <= 1 { + if abs == 0 || abs == 1 { + prec = 1 + } + } else if _, mod := math.Modf(abs); mod == 0 { + prec = 1 + } + } + return +} -func (h *JsonHandle) rpcEncodeTerminate() []byte { - return jsonEncodeTerminate +// custom-fitted version of strconv.Parse(Ui|I)nt. +// Also ensures we don't have to search for .eE to determine if a float or not. +func jsonParseInteger(s []byte) (n uint64, neg, badSyntax, overflow bool) { + const maxUint64 = (1<<64 - 1) + const cutoff = maxUint64/10 + 1 + + if len(s) == 0 { + badSyntax = true + return + } + switch s[0] { + case '+': + s = s[1:] + case '-': + s = s[1:] + neg = true + } + for _, c := range s { + if c < '0' || c > '9' { + badSyntax = true + return + } + // unsigned integers don't overflow well on multiplication, so check cutoff here + // e.g. (maxUint64-5)*10 doesn't overflow well ... + if n >= cutoff { + overflow = true + return + } + n *= 10 + n1 := n + uint64(c-'0') + if n1 < n || n1 > maxUint64 { + overflow = true + return + } + n = n1 + } + return } var _ decDriver = (*jsonDecDriver)(nil) -var _ encDriver = (*jsonEncDriver)(nil) +var _ encDriver = (*jsonEncDriverGenericImpl)(nil) +var _ encDriver = (*jsonEncDriverTypicalImpl)(nil) +var _ jsonTypical = (*jsonEncDriverTypical)(nil) diff --git a/vendor/github.com/ugorji/go/codec/mammoth-test.go.tmpl b/vendor/github.com/ugorji/go/codec/mammoth-test.go.tmpl new file mode 100644 index 000000000..90d758ce4 --- /dev/null +++ b/vendor/github.com/ugorji/go/codec/mammoth-test.go.tmpl @@ -0,0 +1,154 @@ +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// Use of this source code is governed by a MIT license found in the LICENSE file. + +// Code generated from mammoth-test.go.tmpl - DO NOT EDIT. + +package codec + +import "testing" +import "fmt" +import "reflect" + +// TestMammoth has all the different paths optimized in fast-path +// It has all the primitives, slices and maps. +// +// For each of those types, it has a pointer and a non-pointer field. + +func init() { _ = fmt.Printf } // so we can include fmt as needed + +type TestMammoth struct { + +{{range .Values }}{{if .Primitive }}{{/* +*/}}{{ .MethodNamePfx "F" true }} {{ .Primitive }} +{{ .MethodNamePfx "Fptr" true }} *{{ .Primitive }} +{{end}}{{end}} + +{{range .Values }}{{if not .Primitive }}{{if not .MapKey }}{{/* +*/}}{{ .MethodNamePfx "F" false }} []{{ .Elem }} +{{ .MethodNamePfx "Fptr" false }} *[]{{ .Elem }} +{{end}}{{end}}{{end}} + +{{range .Values }}{{if not .Primitive }}{{if .MapKey }}{{/* +*/}}{{ .MethodNamePfx "F" false }} map[{{ .MapKey }}]{{ .Elem }} +{{ .MethodNamePfx "Fptr" false }} *map[{{ .MapKey }}]{{ .Elem }} +{{end}}{{end}}{{end}} + +} + +{{range .Values }}{{if not .Primitive }}{{if not .MapKey }}{{/* +*/}} type {{ .MethodNamePfx "typMbs" false }} []{{ .Elem }} +func (_ {{ .MethodNamePfx "typMbs" false }}) MapBySlice() { } +{{end}}{{end}}{{end}} + +{{range .Values }}{{if not .Primitive }}{{if .MapKey }}{{/* +*/}} type {{ .MethodNamePfx "typMap" false }} map[{{ .MapKey }}]{{ .Elem }} +{{end}}{{end}}{{end}} + +func doTestMammothSlices(t *testing.T, h Handle) { +{{range $i, $e := .Values }}{{if not .Primitive }}{{if not .MapKey }}{{/* +*/}} + var v{{$i}}va [8]{{ .Elem }} + for _, v := range [][]{{ .Elem }}{ nil, {}, { {{ nonzerocmd .Elem }}, {{ zerocmd .Elem }}, {{ zerocmd .Elem }}, {{ nonzerocmd .Elem }} } } { {{/* + // fmt.Printf(">>>> running mammoth slice v{{$i}}: %v\n", v) + // - encode value to some []byte + // - decode into a length-wise-equal []byte + // - check if equal to initial slice + // - encode ptr to the value + // - check if encode bytes are same + // - decode into ptrs to: nil, then 1-elem slice, equal-length, then large len slice + // - decode into non-addressable slice of equal length, then larger len + // - for each decode, compare elem-by-elem to the original slice + // - + // - rinse and repeat for a MapBySlice version + // - + */}} + var v{{$i}}v1, v{{$i}}v2 []{{ .Elem }} + v{{$i}}v1 = v + bs{{$i}} := testMarshalErr(v{{$i}}v1, h, t, "enc-slice-v{{$i}}") + if v == nil { v{{$i}}v2 = nil } else { v{{$i}}v2 = make([]{{ .Elem }}, len(v)) } + testUnmarshalErr(v{{$i}}v2, bs{{$i}}, h, t, "dec-slice-v{{$i}}") + testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-slice-v{{$i}}") + if v == nil { v{{$i}}v2 = nil } else { v{{$i}}v2 = make([]{{ .Elem }}, len(v)) } + testUnmarshalErr(reflect.ValueOf(v{{$i}}v2), bs{{$i}}, h, t, "dec-slice-v{{$i}}-noaddr") // non-addressable value + testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-slice-v{{$i}}-noaddr") + // ... + bs{{$i}} = testMarshalErr(&v{{$i}}v1, h, t, "enc-slice-v{{$i}}-p") + v{{$i}}v2 = nil + testUnmarshalErr(&v{{$i}}v2, bs{{$i}}, h, t, "dec-slice-v{{$i}}-p") + testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-slice-v{{$i}}-p") + v{{$i}}va = [8]{{ .Elem }}{} // clear the array + v{{$i}}v2 = v{{$i}}va[:1:1] + testUnmarshalErr(&v{{$i}}v2, bs{{$i}}, h, t, "dec-slice-v{{$i}}-p-1") + testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-slice-v{{$i}}-p-1") + v{{$i}}va = [8]{{ .Elem }}{} // clear the array + v{{$i}}v2 = v{{$i}}va[:len(v{{$i}}v1):len(v{{$i}}v1)] + testUnmarshalErr(&v{{$i}}v2, bs{{$i}}, h, t, "dec-slice-v{{$i}}-p-len") + testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-slice-v{{$i}}-p-len") + v{{$i}}va = [8]{{ .Elem }}{} // clear the array + v{{$i}}v2 = v{{$i}}va[:] + testUnmarshalErr(&v{{$i}}v2, bs{{$i}}, h, t, "dec-slice-v{{$i}}-p-cap") + testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-slice-v{{$i}}-p-cap") + if len(v{{$i}}v1) > 1 { + v{{$i}}va = [8]{{ .Elem }}{} // clear the array + testUnmarshalErr((&v{{$i}}va)[:len(v{{$i}}v1)], bs{{$i}}, h, t, "dec-slice-v{{$i}}-p-len-noaddr") + testDeepEqualErr(v{{$i}}v1, v{{$i}}va[:len(v{{$i}}v1)], t, "equal-slice-v{{$i}}-p-len-noaddr") + v{{$i}}va = [8]{{ .Elem }}{} // clear the array + testUnmarshalErr((&v{{$i}}va)[:], bs{{$i}}, h, t, "dec-slice-v{{$i}}-p-cap-noaddr") + testDeepEqualErr(v{{$i}}v1, v{{$i}}va[:len(v{{$i}}v1)], t, "equal-slice-v{{$i}}-p-cap-noaddr") + } + // ... + var v{{$i}}v3, v{{$i}}v4 {{ .MethodNamePfx "typMbs" false }} + v{{$i}}v2 = nil + if v != nil { v{{$i}}v2 = make([]{{ .Elem }}, len(v)) } + v{{$i}}v3 = {{ .MethodNamePfx "typMbs" false }}(v{{$i}}v1) + v{{$i}}v4 = {{ .MethodNamePfx "typMbs" false }}(v{{$i}}v2) + bs{{$i}} = testMarshalErr(v{{$i}}v3, h, t, "enc-slice-v{{$i}}-custom") + testUnmarshalErr(v{{$i}}v4, bs{{$i}}, h, t, "dec-slice-v{{$i}}-custom") + testDeepEqualErr(v{{$i}}v3, v{{$i}}v4, t, "equal-slice-v{{$i}}-custom") + bs{{$i}} = testMarshalErr(&v{{$i}}v3, h, t, "enc-slice-v{{$i}}-custom-p") + v{{$i}}v2 = nil + v{{$i}}v4 = {{ .MethodNamePfx "typMbs" false }}(v{{$i}}v2) + testUnmarshalErr(&v{{$i}}v4, bs{{$i}}, h, t, "dec-slice-v{{$i}}-custom-p") + testDeepEqualErr(v{{$i}}v3, v{{$i}}v4, t, "equal-slice-v{{$i}}-custom-p") + } +{{end}}{{end}}{{end}} +} + +func doTestMammothMaps(t *testing.T, h Handle) { +{{range $i, $e := .Values }}{{if not .Primitive }}{{if .MapKey }}{{/* +*/}} + for _, v := range []map[{{ .MapKey }}]{{ .Elem }}{ nil, {}, { {{ nonzerocmd .MapKey }}:{{ zerocmd .Elem }} {{if ne "bool" .MapKey}}, {{ nonzerocmd .MapKey }}:{{ nonzerocmd .Elem }} {{end}} } } { + // fmt.Printf(">>>> running mammoth map v{{$i}}: %v\n", v) + var v{{$i}}v1, v{{$i}}v2 map[{{ .MapKey }}]{{ .Elem }} + v{{$i}}v1 = v + bs{{$i}} := testMarshalErr(v{{$i}}v1, h, t, "enc-map-v{{$i}}") + if v == nil { v{{$i}}v2 = nil } else { v{{$i}}v2 = make(map[{{ .MapKey }}]{{ .Elem }}, len(v)) } // reset map + testUnmarshalErr(v{{$i}}v2, bs{{$i}}, h, t, "dec-map-v{{$i}}") + testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-map-v{{$i}}") + if v == nil { v{{$i}}v2 = nil } else { v{{$i}}v2 = make(map[{{ .MapKey }}]{{ .Elem }}, len(v)) } // reset map + testUnmarshalErr(reflect.ValueOf(v{{$i}}v2), bs{{$i}}, h, t, "dec-map-v{{$i}}-noaddr") // decode into non-addressable map value + testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-map-v{{$i}}-noaddr") + if v == nil { v{{$i}}v2 = nil } else { v{{$i}}v2 = make(map[{{ .MapKey }}]{{ .Elem }}, len(v)) } // reset map + testUnmarshalErr(&v{{$i}}v2, bs{{$i}}, h, t, "dec-map-v{{$i}}-p-len") + testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-map-v{{$i}}-p-len") + bs{{$i}} = testMarshalErr(&v{{$i}}v1, h, t, "enc-map-v{{$i}}-p") + v{{$i}}v2 = nil + testUnmarshalErr(&v{{$i}}v2, bs{{$i}}, h, t, "dec-map-v{{$i}}-p-nil") + testDeepEqualErr(v{{$i}}v1, v{{$i}}v2, t, "equal-map-v{{$i}}-p-nil") + // ... + if v == nil { v{{$i}}v2 = nil } else { v{{$i}}v2 = make(map[{{ .MapKey }}]{{ .Elem }}, len(v)) } // reset map + var v{{$i}}v3, v{{$i}}v4 {{ .MethodNamePfx "typMap" false }} + v{{$i}}v3 = {{ .MethodNamePfx "typMap" false }}(v{{$i}}v1) + v{{$i}}v4 = {{ .MethodNamePfx "typMap" false }}(v{{$i}}v2) + bs{{$i}} = testMarshalErr(v{{$i}}v3, h, t, "enc-map-v{{$i}}-custom") + testUnmarshalErr(v{{$i}}v4, bs{{$i}}, h, t, "dec-map-v{{$i}}-p-len") + testDeepEqualErr(v{{$i}}v3, v{{$i}}v4, t, "equal-map-v{{$i}}-p-len") + } +{{end}}{{end}}{{end}} + +} + +func doTestMammothMapsAndSlices(t *testing.T, h Handle) { + doTestMammothSlices(t, h) + doTestMammothMaps(t, h) +} diff --git a/vendor/github.com/ugorji/go/codec/mammoth2-test.go.tmpl b/vendor/github.com/ugorji/go/codec/mammoth2-test.go.tmpl new file mode 100644 index 000000000..7cdf8f5d7 --- /dev/null +++ b/vendor/github.com/ugorji/go/codec/mammoth2-test.go.tmpl @@ -0,0 +1,94 @@ +// +build !notfastpath + +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// Use of this source code is governed by a MIT license found in the LICENSE file. + +// Code generated from mammoth2-test.go.tmpl - DO NOT EDIT. + +package codec + +// Increase codecoverage by covering all the codecgen paths, in fast-path and gen-helper.go.... +// +// Add: +// - test file for creating a mammoth generated file as _mammoth_generated.go +// - generate a second mammoth files in a different file: mammoth2_generated_test.go +// - mammoth-test.go.tmpl will do this +// - run codecgen on it, into mammoth2_codecgen_generated_test.go (no build tags) +// - as part of TestMammoth, run it also +// - this will cover all the codecgen, gen-helper, etc in one full run +// - check in mammoth* files into github also +// - then +// +// Now, add some types: +// - some that implement BinaryMarshal, TextMarshal, JSONMarshal, and one that implements none of it +// - create a wrapper type that includes TestMammoth2, with it in slices, and maps, and the custom types +// - this wrapper object is what we work encode/decode (so that the codecgen methods are called) + + +// import "encoding/binary" +import "fmt" + +type TestMammoth2 struct { + +{{range .Values }}{{if .Primitive }}{{/* +*/}}{{ .MethodNamePfx "F" true }} {{ .Primitive }} +{{ .MethodNamePfx "Fptr" true }} *{{ .Primitive }} +{{end}}{{end}} + +{{range .Values }}{{if not .Primitive }}{{if not .MapKey }}{{/* +*/}}{{ .MethodNamePfx "F" false }} []{{ .Elem }} +{{ .MethodNamePfx "Fptr" false }} *[]{{ .Elem }} +{{end}}{{end}}{{end}} + +{{range .Values }}{{if not .Primitive }}{{if .MapKey }}{{/* +*/}}{{ .MethodNamePfx "F" false }} map[{{ .MapKey }}]{{ .Elem }} +{{ .MethodNamePfx "Fptr" false }} *map[{{ .MapKey }}]{{ .Elem }} +{{end}}{{end}}{{end}} + +} + +// ----------- + +type testMammoth2Binary uint64 +func (x testMammoth2Binary) MarshalBinary() (data []byte, err error) { +data = make([]byte, 8) +bigen.PutUint64(data, uint64(x)) +return +} +func (x *testMammoth2Binary) UnmarshalBinary(data []byte) (err error) { +*x = testMammoth2Binary(bigen.Uint64(data)) +return +} + +type testMammoth2Text uint64 +func (x testMammoth2Text) MarshalText() (data []byte, err error) { +data = []byte(fmt.Sprintf("%b", uint64(x))) +return +} +func (x *testMammoth2Text) UnmarshalText(data []byte) (err error) { +_, err = fmt.Sscanf(string(data), "%b", (*uint64)(x)) +return +} + +type testMammoth2Json uint64 +func (x testMammoth2Json) MarshalJSON() (data []byte, err error) { +data = []byte(fmt.Sprintf("%v", uint64(x))) +return +} +func (x *testMammoth2Json) UnmarshalJSON(data []byte) (err error) { +_, err = fmt.Sscanf(string(data), "%v", (*uint64)(x)) +return +} + +type testMammoth2Basic [4]uint64 + +type TestMammoth2Wrapper struct { + V TestMammoth2 + T testMammoth2Text + B testMammoth2Binary + J testMammoth2Json + C testMammoth2Basic + M map[testMammoth2Basic]TestMammoth2 + L []TestMammoth2 + A [4]int64 +} diff --git a/vendor/github.com/ugorji/go/codec/mammoth2_codecgen_generated_test.go b/vendor/github.com/ugorji/go/codec/mammoth2_codecgen_generated_test.go new file mode 100644 index 000000000..ce9324a2b --- /dev/null +++ b/vendor/github.com/ugorji/go/codec/mammoth2_codecgen_generated_test.go @@ -0,0 +1,38478 @@ +// +build !notfastpath + +// Code generated by codecgen - DO NOT EDIT. + +package codec + +import ( + "errors" + "runtime" + "strconv" +) + +const ( + // ----- content types ---- + codecSelferCcUTF819781 = 1 + codecSelferCcRAW19781 = 0 + // ----- value types used ---- + codecSelferValueTypeArray19781 = 10 + codecSelferValueTypeMap19781 = 9 + codecSelferValueTypeString19781 = 6 + codecSelferValueTypeInt19781 = 2 + codecSelferValueTypeUint19781 = 3 + codecSelferValueTypeFloat19781 = 4 + codecSelferBitsize19781 = uint8(32 << (^uint(0) >> 63)) +) + +var ( + errCodecSelferOnlyMapOrArrayEncodeToStruct19781 = errors.New(`only encoded map or array can be decoded into a struct`) +) + +type codecSelfer19781 struct{} + +func init() { + if GenVersion != 8 { + _, file, _, _ := runtime.Caller(0) + panic("codecgen version mismatch: current: 8, need " + strconv.FormatInt(int64(GenVersion), 10) + ". Re-generate file: " + file) + } + if false { // reference the types, but skip this branch at build/run time + } +} + +func (x *TestMammoth2) CodecEncodeSelf(e *Encoder) { + var h codecSelfer19781 + z, r := GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + if false { + } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { + z.EncExtension(x, yyxt1) + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false // struct tag has 'toArray' + if yyr2 || yy2arr2 { + r.WriteArrayStart(576) + } else { + r.WriteMapStart(576) + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FIntf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.EncFallback(x.FIntf) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FIntf`) + r.WriteMapElemValue() + if x.FIntf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.EncFallback(x.FIntf) + } + } + } + var yyn6 bool + if x.FptrIntf == nil { + yyn6 = true + goto LABEL6 + } + LABEL6: + if yyr2 || yy2arr2 { + if yyn6 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrIntf == nil { + r.EncodeNil() + } else { + yy7 := *x.FptrIntf + if false { + } else { + z.EncFallback(yy7) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrIntf`) + r.WriteMapElemValue() + if yyn6 { + r.EncodeNil() + } else { + if x.FptrIntf == nil { + r.EncodeNil() + } else { + yy9 := *x.FptrIntf + if false { + } else { + z.EncFallback(yy9) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if false { + } else { + r.EncodeString(codecSelferCcUTF819781, string(x.FString)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FString`) + r.WriteMapElemValue() + if false { + } else { + r.EncodeString(codecSelferCcUTF819781, string(x.FString)) + } + } + var yyn14 bool + if x.FptrString == nil { + yyn14 = true + goto LABEL14 + } + LABEL14: + if yyr2 || yy2arr2 { + if yyn14 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrString == nil { + r.EncodeNil() + } else { + yy15 := *x.FptrString + if false { + } else { + r.EncodeString(codecSelferCcUTF819781, string(yy15)) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrString`) + r.WriteMapElemValue() + if yyn14 { + r.EncodeNil() + } else { + if x.FptrString == nil { + r.EncodeNil() + } else { + yy17 := *x.FptrString + if false { + } else { + r.EncodeString(codecSelferCcUTF819781, string(yy17)) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if false { + } else { + r.EncodeFloat32(float32(x.FFloat32)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FFloat32`) + r.WriteMapElemValue() + if false { + } else { + r.EncodeFloat32(float32(x.FFloat32)) + } + } + var yyn22 bool + if x.FptrFloat32 == nil { + yyn22 = true + goto LABEL22 + } + LABEL22: + if yyr2 || yy2arr2 { + if yyn22 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrFloat32 == nil { + r.EncodeNil() + } else { + yy23 := *x.FptrFloat32 + if false { + } else { + r.EncodeFloat32(float32(yy23)) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrFloat32`) + r.WriteMapElemValue() + if yyn22 { + r.EncodeNil() + } else { + if x.FptrFloat32 == nil { + r.EncodeNil() + } else { + yy25 := *x.FptrFloat32 + if false { + } else { + r.EncodeFloat32(float32(yy25)) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if false { + } else { + r.EncodeFloat64(float64(x.FFloat64)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FFloat64`) + r.WriteMapElemValue() + if false { + } else { + r.EncodeFloat64(float64(x.FFloat64)) + } + } + var yyn30 bool + if x.FptrFloat64 == nil { + yyn30 = true + goto LABEL30 + } + LABEL30: + if yyr2 || yy2arr2 { + if yyn30 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrFloat64 == nil { + r.EncodeNil() + } else { + yy31 := *x.FptrFloat64 + if false { + } else { + r.EncodeFloat64(float64(yy31)) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrFloat64`) + r.WriteMapElemValue() + if yyn30 { + r.EncodeNil() + } else { + if x.FptrFloat64 == nil { + r.EncodeNil() + } else { + yy33 := *x.FptrFloat64 + if false { + } else { + r.EncodeFloat64(float64(yy33)) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if false { + } else { + r.EncodeUint(uint64(x.FUint)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FUint`) + r.WriteMapElemValue() + if false { + } else { + r.EncodeUint(uint64(x.FUint)) + } + } + var yyn38 bool + if x.FptrUint == nil { + yyn38 = true + goto LABEL38 + } + LABEL38: + if yyr2 || yy2arr2 { + if yyn38 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrUint == nil { + r.EncodeNil() + } else { + yy39 := *x.FptrUint + if false { + } else { + r.EncodeUint(uint64(yy39)) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrUint`) + r.WriteMapElemValue() + if yyn38 { + r.EncodeNil() + } else { + if x.FptrUint == nil { + r.EncodeNil() + } else { + yy41 := *x.FptrUint + if false { + } else { + r.EncodeUint(uint64(yy41)) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if false { + } else { + r.EncodeUint(uint64(x.FUint8)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FUint8`) + r.WriteMapElemValue() + if false { + } else { + r.EncodeUint(uint64(x.FUint8)) + } + } + var yyn46 bool + if x.FptrUint8 == nil { + yyn46 = true + goto LABEL46 + } + LABEL46: + if yyr2 || yy2arr2 { + if yyn46 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrUint8 == nil { + r.EncodeNil() + } else { + yy47 := *x.FptrUint8 + if false { + } else { + r.EncodeUint(uint64(yy47)) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrUint8`) + r.WriteMapElemValue() + if yyn46 { + r.EncodeNil() + } else { + if x.FptrUint8 == nil { + r.EncodeNil() + } else { + yy49 := *x.FptrUint8 + if false { + } else { + r.EncodeUint(uint64(yy49)) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if false { + } else { + r.EncodeUint(uint64(x.FUint16)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FUint16`) + r.WriteMapElemValue() + if false { + } else { + r.EncodeUint(uint64(x.FUint16)) + } + } + var yyn54 bool + if x.FptrUint16 == nil { + yyn54 = true + goto LABEL54 + } + LABEL54: + if yyr2 || yy2arr2 { + if yyn54 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrUint16 == nil { + r.EncodeNil() + } else { + yy55 := *x.FptrUint16 + if false { + } else { + r.EncodeUint(uint64(yy55)) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrUint16`) + r.WriteMapElemValue() + if yyn54 { + r.EncodeNil() + } else { + if x.FptrUint16 == nil { + r.EncodeNil() + } else { + yy57 := *x.FptrUint16 + if false { + } else { + r.EncodeUint(uint64(yy57)) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if false { + } else { + r.EncodeUint(uint64(x.FUint32)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FUint32`) + r.WriteMapElemValue() + if false { + } else { + r.EncodeUint(uint64(x.FUint32)) + } + } + var yyn62 bool + if x.FptrUint32 == nil { + yyn62 = true + goto LABEL62 + } + LABEL62: + if yyr2 || yy2arr2 { + if yyn62 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrUint32 == nil { + r.EncodeNil() + } else { + yy63 := *x.FptrUint32 + if false { + } else { + r.EncodeUint(uint64(yy63)) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrUint32`) + r.WriteMapElemValue() + if yyn62 { + r.EncodeNil() + } else { + if x.FptrUint32 == nil { + r.EncodeNil() + } else { + yy65 := *x.FptrUint32 + if false { + } else { + r.EncodeUint(uint64(yy65)) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if false { + } else { + r.EncodeUint(uint64(x.FUint64)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FUint64`) + r.WriteMapElemValue() + if false { + } else { + r.EncodeUint(uint64(x.FUint64)) + } + } + var yyn70 bool + if x.FptrUint64 == nil { + yyn70 = true + goto LABEL70 + } + LABEL70: + if yyr2 || yy2arr2 { + if yyn70 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrUint64 == nil { + r.EncodeNil() + } else { + yy71 := *x.FptrUint64 + if false { + } else { + r.EncodeUint(uint64(yy71)) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrUint64`) + r.WriteMapElemValue() + if yyn70 { + r.EncodeNil() + } else { + if x.FptrUint64 == nil { + r.EncodeNil() + } else { + yy73 := *x.FptrUint64 + if false { + } else { + r.EncodeUint(uint64(yy73)) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if false { + } else { + r.EncodeUint(uint64(x.FUintptr)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FUintptr`) + r.WriteMapElemValue() + if false { + } else { + r.EncodeUint(uint64(x.FUintptr)) + } + } + var yyn78 bool + if x.FptrUintptr == nil { + yyn78 = true + goto LABEL78 + } + LABEL78: + if yyr2 || yy2arr2 { + if yyn78 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrUintptr == nil { + r.EncodeNil() + } else { + yy79 := *x.FptrUintptr + if false { + } else { + r.EncodeUint(uint64(yy79)) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrUintptr`) + r.WriteMapElemValue() + if yyn78 { + r.EncodeNil() + } else { + if x.FptrUintptr == nil { + r.EncodeNil() + } else { + yy81 := *x.FptrUintptr + if false { + } else { + r.EncodeUint(uint64(yy81)) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if false { + } else { + r.EncodeInt(int64(x.FInt)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FInt`) + r.WriteMapElemValue() + if false { + } else { + r.EncodeInt(int64(x.FInt)) + } + } + var yyn86 bool + if x.FptrInt == nil { + yyn86 = true + goto LABEL86 + } + LABEL86: + if yyr2 || yy2arr2 { + if yyn86 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrInt == nil { + r.EncodeNil() + } else { + yy87 := *x.FptrInt + if false { + } else { + r.EncodeInt(int64(yy87)) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrInt`) + r.WriteMapElemValue() + if yyn86 { + r.EncodeNil() + } else { + if x.FptrInt == nil { + r.EncodeNil() + } else { + yy89 := *x.FptrInt + if false { + } else { + r.EncodeInt(int64(yy89)) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if false { + } else { + r.EncodeInt(int64(x.FInt8)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FInt8`) + r.WriteMapElemValue() + if false { + } else { + r.EncodeInt(int64(x.FInt8)) + } + } + var yyn94 bool + if x.FptrInt8 == nil { + yyn94 = true + goto LABEL94 + } + LABEL94: + if yyr2 || yy2arr2 { + if yyn94 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrInt8 == nil { + r.EncodeNil() + } else { + yy95 := *x.FptrInt8 + if false { + } else { + r.EncodeInt(int64(yy95)) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrInt8`) + r.WriteMapElemValue() + if yyn94 { + r.EncodeNil() + } else { + if x.FptrInt8 == nil { + r.EncodeNil() + } else { + yy97 := *x.FptrInt8 + if false { + } else { + r.EncodeInt(int64(yy97)) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if false { + } else { + r.EncodeInt(int64(x.FInt16)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FInt16`) + r.WriteMapElemValue() + if false { + } else { + r.EncodeInt(int64(x.FInt16)) + } + } + var yyn102 bool + if x.FptrInt16 == nil { + yyn102 = true + goto LABEL102 + } + LABEL102: + if yyr2 || yy2arr2 { + if yyn102 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrInt16 == nil { + r.EncodeNil() + } else { + yy103 := *x.FptrInt16 + if false { + } else { + r.EncodeInt(int64(yy103)) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrInt16`) + r.WriteMapElemValue() + if yyn102 { + r.EncodeNil() + } else { + if x.FptrInt16 == nil { + r.EncodeNil() + } else { + yy105 := *x.FptrInt16 + if false { + } else { + r.EncodeInt(int64(yy105)) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if false { + } else { + r.EncodeInt(int64(x.FInt32)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FInt32`) + r.WriteMapElemValue() + if false { + } else { + r.EncodeInt(int64(x.FInt32)) + } + } + var yyn110 bool + if x.FptrInt32 == nil { + yyn110 = true + goto LABEL110 + } + LABEL110: + if yyr2 || yy2arr2 { + if yyn110 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrInt32 == nil { + r.EncodeNil() + } else { + yy111 := *x.FptrInt32 + if false { + } else { + r.EncodeInt(int64(yy111)) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrInt32`) + r.WriteMapElemValue() + if yyn110 { + r.EncodeNil() + } else { + if x.FptrInt32 == nil { + r.EncodeNil() + } else { + yy113 := *x.FptrInt32 + if false { + } else { + r.EncodeInt(int64(yy113)) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if false { + } else { + r.EncodeInt(int64(x.FInt64)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FInt64`) + r.WriteMapElemValue() + if false { + } else { + r.EncodeInt(int64(x.FInt64)) + } + } + var yyn118 bool + if x.FptrInt64 == nil { + yyn118 = true + goto LABEL118 + } + LABEL118: + if yyr2 || yy2arr2 { + if yyn118 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrInt64 == nil { + r.EncodeNil() + } else { + yy119 := *x.FptrInt64 + if false { + } else { + r.EncodeInt(int64(yy119)) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrInt64`) + r.WriteMapElemValue() + if yyn118 { + r.EncodeNil() + } else { + if x.FptrInt64 == nil { + r.EncodeNil() + } else { + yy121 := *x.FptrInt64 + if false { + } else { + r.EncodeInt(int64(yy121)) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if false { + } else { + r.EncodeBool(bool(x.FBool)) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FBool`) + r.WriteMapElemValue() + if false { + } else { + r.EncodeBool(bool(x.FBool)) + } + } + var yyn126 bool + if x.FptrBool == nil { + yyn126 = true + goto LABEL126 + } + LABEL126: + if yyr2 || yy2arr2 { + if yyn126 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrBool == nil { + r.EncodeNil() + } else { + yy127 := *x.FptrBool + if false { + } else { + r.EncodeBool(bool(yy127)) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrBool`) + r.WriteMapElemValue() + if yyn126 { + r.EncodeNil() + } else { + if x.FptrBool == nil { + r.EncodeNil() + } else { + yy129 := *x.FptrBool + if false { + } else { + r.EncodeBool(bool(yy129)) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FSliceIntf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceIntfV(x.FSliceIntf, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FSliceIntf`) + r.WriteMapElemValue() + if x.FSliceIntf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceIntfV(x.FSliceIntf, e) + } + } + } + var yyn134 bool + if x.FptrSliceIntf == nil { + yyn134 = true + goto LABEL134 + } + LABEL134: + if yyr2 || yy2arr2 { + if yyn134 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrSliceIntf == nil { + r.EncodeNil() + } else { + yy135 := *x.FptrSliceIntf + if false { + } else { + z.F.EncSliceIntfV(yy135, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrSliceIntf`) + r.WriteMapElemValue() + if yyn134 { + r.EncodeNil() + } else { + if x.FptrSliceIntf == nil { + r.EncodeNil() + } else { + yy137 := *x.FptrSliceIntf + if false { + } else { + z.F.EncSliceIntfV(yy137, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FSliceString == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceStringV(x.FSliceString, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FSliceString`) + r.WriteMapElemValue() + if x.FSliceString == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceStringV(x.FSliceString, e) + } + } + } + var yyn142 bool + if x.FptrSliceString == nil { + yyn142 = true + goto LABEL142 + } + LABEL142: + if yyr2 || yy2arr2 { + if yyn142 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrSliceString == nil { + r.EncodeNil() + } else { + yy143 := *x.FptrSliceString + if false { + } else { + z.F.EncSliceStringV(yy143, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrSliceString`) + r.WriteMapElemValue() + if yyn142 { + r.EncodeNil() + } else { + if x.FptrSliceString == nil { + r.EncodeNil() + } else { + yy145 := *x.FptrSliceString + if false { + } else { + z.F.EncSliceStringV(yy145, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FSliceFloat32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceFloat32V(x.FSliceFloat32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FSliceFloat32`) + r.WriteMapElemValue() + if x.FSliceFloat32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceFloat32V(x.FSliceFloat32, e) + } + } + } + var yyn150 bool + if x.FptrSliceFloat32 == nil { + yyn150 = true + goto LABEL150 + } + LABEL150: + if yyr2 || yy2arr2 { + if yyn150 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrSliceFloat32 == nil { + r.EncodeNil() + } else { + yy151 := *x.FptrSliceFloat32 + if false { + } else { + z.F.EncSliceFloat32V(yy151, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrSliceFloat32`) + r.WriteMapElemValue() + if yyn150 { + r.EncodeNil() + } else { + if x.FptrSliceFloat32 == nil { + r.EncodeNil() + } else { + yy153 := *x.FptrSliceFloat32 + if false { + } else { + z.F.EncSliceFloat32V(yy153, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FSliceFloat64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceFloat64V(x.FSliceFloat64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FSliceFloat64`) + r.WriteMapElemValue() + if x.FSliceFloat64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceFloat64V(x.FSliceFloat64, e) + } + } + } + var yyn158 bool + if x.FptrSliceFloat64 == nil { + yyn158 = true + goto LABEL158 + } + LABEL158: + if yyr2 || yy2arr2 { + if yyn158 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrSliceFloat64 == nil { + r.EncodeNil() + } else { + yy159 := *x.FptrSliceFloat64 + if false { + } else { + z.F.EncSliceFloat64V(yy159, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrSliceFloat64`) + r.WriteMapElemValue() + if yyn158 { + r.EncodeNil() + } else { + if x.FptrSliceFloat64 == nil { + r.EncodeNil() + } else { + yy161 := *x.FptrSliceFloat64 + if false { + } else { + z.F.EncSliceFloat64V(yy161, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FSliceUint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceUintV(x.FSliceUint, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FSliceUint`) + r.WriteMapElemValue() + if x.FSliceUint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceUintV(x.FSliceUint, e) + } + } + } + var yyn166 bool + if x.FptrSliceUint == nil { + yyn166 = true + goto LABEL166 + } + LABEL166: + if yyr2 || yy2arr2 { + if yyn166 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrSliceUint == nil { + r.EncodeNil() + } else { + yy167 := *x.FptrSliceUint + if false { + } else { + z.F.EncSliceUintV(yy167, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrSliceUint`) + r.WriteMapElemValue() + if yyn166 { + r.EncodeNil() + } else { + if x.FptrSliceUint == nil { + r.EncodeNil() + } else { + yy169 := *x.FptrSliceUint + if false { + } else { + z.F.EncSliceUintV(yy169, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FSliceUint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + r.EncodeStringBytes(codecSelferCcRAW19781, []byte(x.FSliceUint8)) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FSliceUint8`) + r.WriteMapElemValue() + if x.FSliceUint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + r.EncodeStringBytes(codecSelferCcRAW19781, []byte(x.FSliceUint8)) + } + } + } + var yyn174 bool + if x.FptrSliceUint8 == nil { + yyn174 = true + goto LABEL174 + } + LABEL174: + if yyr2 || yy2arr2 { + if yyn174 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrSliceUint8 == nil { + r.EncodeNil() + } else { + yy175 := *x.FptrSliceUint8 + if false { + } else { + r.EncodeStringBytes(codecSelferCcRAW19781, []byte(yy175)) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrSliceUint8`) + r.WriteMapElemValue() + if yyn174 { + r.EncodeNil() + } else { + if x.FptrSliceUint8 == nil { + r.EncodeNil() + } else { + yy177 := *x.FptrSliceUint8 + if false { + } else { + r.EncodeStringBytes(codecSelferCcRAW19781, []byte(yy177)) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FSliceUint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceUint16V(x.FSliceUint16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FSliceUint16`) + r.WriteMapElemValue() + if x.FSliceUint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceUint16V(x.FSliceUint16, e) + } + } + } + var yyn182 bool + if x.FptrSliceUint16 == nil { + yyn182 = true + goto LABEL182 + } + LABEL182: + if yyr2 || yy2arr2 { + if yyn182 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrSliceUint16 == nil { + r.EncodeNil() + } else { + yy183 := *x.FptrSliceUint16 + if false { + } else { + z.F.EncSliceUint16V(yy183, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrSliceUint16`) + r.WriteMapElemValue() + if yyn182 { + r.EncodeNil() + } else { + if x.FptrSliceUint16 == nil { + r.EncodeNil() + } else { + yy185 := *x.FptrSliceUint16 + if false { + } else { + z.F.EncSliceUint16V(yy185, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FSliceUint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceUint32V(x.FSliceUint32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FSliceUint32`) + r.WriteMapElemValue() + if x.FSliceUint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceUint32V(x.FSliceUint32, e) + } + } + } + var yyn190 bool + if x.FptrSliceUint32 == nil { + yyn190 = true + goto LABEL190 + } + LABEL190: + if yyr2 || yy2arr2 { + if yyn190 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrSliceUint32 == nil { + r.EncodeNil() + } else { + yy191 := *x.FptrSliceUint32 + if false { + } else { + z.F.EncSliceUint32V(yy191, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrSliceUint32`) + r.WriteMapElemValue() + if yyn190 { + r.EncodeNil() + } else { + if x.FptrSliceUint32 == nil { + r.EncodeNil() + } else { + yy193 := *x.FptrSliceUint32 + if false { + } else { + z.F.EncSliceUint32V(yy193, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FSliceUint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceUint64V(x.FSliceUint64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FSliceUint64`) + r.WriteMapElemValue() + if x.FSliceUint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceUint64V(x.FSliceUint64, e) + } + } + } + var yyn198 bool + if x.FptrSliceUint64 == nil { + yyn198 = true + goto LABEL198 + } + LABEL198: + if yyr2 || yy2arr2 { + if yyn198 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrSliceUint64 == nil { + r.EncodeNil() + } else { + yy199 := *x.FptrSliceUint64 + if false { + } else { + z.F.EncSliceUint64V(yy199, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrSliceUint64`) + r.WriteMapElemValue() + if yyn198 { + r.EncodeNil() + } else { + if x.FptrSliceUint64 == nil { + r.EncodeNil() + } else { + yy201 := *x.FptrSliceUint64 + if false { + } else { + z.F.EncSliceUint64V(yy201, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FSliceUintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceUintptrV(x.FSliceUintptr, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FSliceUintptr`) + r.WriteMapElemValue() + if x.FSliceUintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceUintptrV(x.FSliceUintptr, e) + } + } + } + var yyn206 bool + if x.FptrSliceUintptr == nil { + yyn206 = true + goto LABEL206 + } + LABEL206: + if yyr2 || yy2arr2 { + if yyn206 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrSliceUintptr == nil { + r.EncodeNil() + } else { + yy207 := *x.FptrSliceUintptr + if false { + } else { + z.F.EncSliceUintptrV(yy207, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrSliceUintptr`) + r.WriteMapElemValue() + if yyn206 { + r.EncodeNil() + } else { + if x.FptrSliceUintptr == nil { + r.EncodeNil() + } else { + yy209 := *x.FptrSliceUintptr + if false { + } else { + z.F.EncSliceUintptrV(yy209, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FSliceInt == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceIntV(x.FSliceInt, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FSliceInt`) + r.WriteMapElemValue() + if x.FSliceInt == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceIntV(x.FSliceInt, e) + } + } + } + var yyn214 bool + if x.FptrSliceInt == nil { + yyn214 = true + goto LABEL214 + } + LABEL214: + if yyr2 || yy2arr2 { + if yyn214 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrSliceInt == nil { + r.EncodeNil() + } else { + yy215 := *x.FptrSliceInt + if false { + } else { + z.F.EncSliceIntV(yy215, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrSliceInt`) + r.WriteMapElemValue() + if yyn214 { + r.EncodeNil() + } else { + if x.FptrSliceInt == nil { + r.EncodeNil() + } else { + yy217 := *x.FptrSliceInt + if false { + } else { + z.F.EncSliceIntV(yy217, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FSliceInt8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceInt8V(x.FSliceInt8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FSliceInt8`) + r.WriteMapElemValue() + if x.FSliceInt8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceInt8V(x.FSliceInt8, e) + } + } + } + var yyn222 bool + if x.FptrSliceInt8 == nil { + yyn222 = true + goto LABEL222 + } + LABEL222: + if yyr2 || yy2arr2 { + if yyn222 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrSliceInt8 == nil { + r.EncodeNil() + } else { + yy223 := *x.FptrSliceInt8 + if false { + } else { + z.F.EncSliceInt8V(yy223, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrSliceInt8`) + r.WriteMapElemValue() + if yyn222 { + r.EncodeNil() + } else { + if x.FptrSliceInt8 == nil { + r.EncodeNil() + } else { + yy225 := *x.FptrSliceInt8 + if false { + } else { + z.F.EncSliceInt8V(yy225, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FSliceInt16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceInt16V(x.FSliceInt16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FSliceInt16`) + r.WriteMapElemValue() + if x.FSliceInt16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceInt16V(x.FSliceInt16, e) + } + } + } + var yyn230 bool + if x.FptrSliceInt16 == nil { + yyn230 = true + goto LABEL230 + } + LABEL230: + if yyr2 || yy2arr2 { + if yyn230 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrSliceInt16 == nil { + r.EncodeNil() + } else { + yy231 := *x.FptrSliceInt16 + if false { + } else { + z.F.EncSliceInt16V(yy231, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrSliceInt16`) + r.WriteMapElemValue() + if yyn230 { + r.EncodeNil() + } else { + if x.FptrSliceInt16 == nil { + r.EncodeNil() + } else { + yy233 := *x.FptrSliceInt16 + if false { + } else { + z.F.EncSliceInt16V(yy233, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FSliceInt32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceInt32V(x.FSliceInt32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FSliceInt32`) + r.WriteMapElemValue() + if x.FSliceInt32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceInt32V(x.FSliceInt32, e) + } + } + } + var yyn238 bool + if x.FptrSliceInt32 == nil { + yyn238 = true + goto LABEL238 + } + LABEL238: + if yyr2 || yy2arr2 { + if yyn238 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrSliceInt32 == nil { + r.EncodeNil() + } else { + yy239 := *x.FptrSliceInt32 + if false { + } else { + z.F.EncSliceInt32V(yy239, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrSliceInt32`) + r.WriteMapElemValue() + if yyn238 { + r.EncodeNil() + } else { + if x.FptrSliceInt32 == nil { + r.EncodeNil() + } else { + yy241 := *x.FptrSliceInt32 + if false { + } else { + z.F.EncSliceInt32V(yy241, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FSliceInt64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceInt64V(x.FSliceInt64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FSliceInt64`) + r.WriteMapElemValue() + if x.FSliceInt64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceInt64V(x.FSliceInt64, e) + } + } + } + var yyn246 bool + if x.FptrSliceInt64 == nil { + yyn246 = true + goto LABEL246 + } + LABEL246: + if yyr2 || yy2arr2 { + if yyn246 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrSliceInt64 == nil { + r.EncodeNil() + } else { + yy247 := *x.FptrSliceInt64 + if false { + } else { + z.F.EncSliceInt64V(yy247, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrSliceInt64`) + r.WriteMapElemValue() + if yyn246 { + r.EncodeNil() + } else { + if x.FptrSliceInt64 == nil { + r.EncodeNil() + } else { + yy249 := *x.FptrSliceInt64 + if false { + } else { + z.F.EncSliceInt64V(yy249, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FSliceBool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceBoolV(x.FSliceBool, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FSliceBool`) + r.WriteMapElemValue() + if x.FSliceBool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncSliceBoolV(x.FSliceBool, e) + } + } + } + var yyn254 bool + if x.FptrSliceBool == nil { + yyn254 = true + goto LABEL254 + } + LABEL254: + if yyr2 || yy2arr2 { + if yyn254 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrSliceBool == nil { + r.EncodeNil() + } else { + yy255 := *x.FptrSliceBool + if false { + } else { + z.F.EncSliceBoolV(yy255, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrSliceBool`) + r.WriteMapElemValue() + if yyn254 { + r.EncodeNil() + } else { + if x.FptrSliceBool == nil { + r.EncodeNil() + } else { + yy257 := *x.FptrSliceBool + if false { + } else { + z.F.EncSliceBoolV(yy257, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntfIntf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfIntfV(x.FMapIntfIntf, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntfIntf`) + r.WriteMapElemValue() + if x.FMapIntfIntf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfIntfV(x.FMapIntfIntf, e) + } + } + } + var yyn262 bool + if x.FptrMapIntfIntf == nil { + yyn262 = true + goto LABEL262 + } + LABEL262: + if yyr2 || yy2arr2 { + if yyn262 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntfIntf == nil { + r.EncodeNil() + } else { + yy263 := *x.FptrMapIntfIntf + if false { + } else { + z.F.EncMapIntfIntfV(yy263, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfIntf`) + r.WriteMapElemValue() + if yyn262 { + r.EncodeNil() + } else { + if x.FptrMapIntfIntf == nil { + r.EncodeNil() + } else { + yy265 := *x.FptrMapIntfIntf + if false { + } else { + z.F.EncMapIntfIntfV(yy265, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntfString == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfStringV(x.FMapIntfString, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntfString`) + r.WriteMapElemValue() + if x.FMapIntfString == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfStringV(x.FMapIntfString, e) + } + } + } + var yyn270 bool + if x.FptrMapIntfString == nil { + yyn270 = true + goto LABEL270 + } + LABEL270: + if yyr2 || yy2arr2 { + if yyn270 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntfString == nil { + r.EncodeNil() + } else { + yy271 := *x.FptrMapIntfString + if false { + } else { + z.F.EncMapIntfStringV(yy271, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfString`) + r.WriteMapElemValue() + if yyn270 { + r.EncodeNil() + } else { + if x.FptrMapIntfString == nil { + r.EncodeNil() + } else { + yy273 := *x.FptrMapIntfString + if false { + } else { + z.F.EncMapIntfStringV(yy273, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntfUint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfUintV(x.FMapIntfUint, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntfUint`) + r.WriteMapElemValue() + if x.FMapIntfUint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfUintV(x.FMapIntfUint, e) + } + } + } + var yyn278 bool + if x.FptrMapIntfUint == nil { + yyn278 = true + goto LABEL278 + } + LABEL278: + if yyr2 || yy2arr2 { + if yyn278 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntfUint == nil { + r.EncodeNil() + } else { + yy279 := *x.FptrMapIntfUint + if false { + } else { + z.F.EncMapIntfUintV(yy279, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfUint`) + r.WriteMapElemValue() + if yyn278 { + r.EncodeNil() + } else { + if x.FptrMapIntfUint == nil { + r.EncodeNil() + } else { + yy281 := *x.FptrMapIntfUint + if false { + } else { + z.F.EncMapIntfUintV(yy281, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntfUint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfUint8V(x.FMapIntfUint8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntfUint8`) + r.WriteMapElemValue() + if x.FMapIntfUint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfUint8V(x.FMapIntfUint8, e) + } + } + } + var yyn286 bool + if x.FptrMapIntfUint8 == nil { + yyn286 = true + goto LABEL286 + } + LABEL286: + if yyr2 || yy2arr2 { + if yyn286 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntfUint8 == nil { + r.EncodeNil() + } else { + yy287 := *x.FptrMapIntfUint8 + if false { + } else { + z.F.EncMapIntfUint8V(yy287, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfUint8`) + r.WriteMapElemValue() + if yyn286 { + r.EncodeNil() + } else { + if x.FptrMapIntfUint8 == nil { + r.EncodeNil() + } else { + yy289 := *x.FptrMapIntfUint8 + if false { + } else { + z.F.EncMapIntfUint8V(yy289, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntfUint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfUint16V(x.FMapIntfUint16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntfUint16`) + r.WriteMapElemValue() + if x.FMapIntfUint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfUint16V(x.FMapIntfUint16, e) + } + } + } + var yyn294 bool + if x.FptrMapIntfUint16 == nil { + yyn294 = true + goto LABEL294 + } + LABEL294: + if yyr2 || yy2arr2 { + if yyn294 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntfUint16 == nil { + r.EncodeNil() + } else { + yy295 := *x.FptrMapIntfUint16 + if false { + } else { + z.F.EncMapIntfUint16V(yy295, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfUint16`) + r.WriteMapElemValue() + if yyn294 { + r.EncodeNil() + } else { + if x.FptrMapIntfUint16 == nil { + r.EncodeNil() + } else { + yy297 := *x.FptrMapIntfUint16 + if false { + } else { + z.F.EncMapIntfUint16V(yy297, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntfUint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfUint32V(x.FMapIntfUint32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntfUint32`) + r.WriteMapElemValue() + if x.FMapIntfUint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfUint32V(x.FMapIntfUint32, e) + } + } + } + var yyn302 bool + if x.FptrMapIntfUint32 == nil { + yyn302 = true + goto LABEL302 + } + LABEL302: + if yyr2 || yy2arr2 { + if yyn302 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntfUint32 == nil { + r.EncodeNil() + } else { + yy303 := *x.FptrMapIntfUint32 + if false { + } else { + z.F.EncMapIntfUint32V(yy303, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfUint32`) + r.WriteMapElemValue() + if yyn302 { + r.EncodeNil() + } else { + if x.FptrMapIntfUint32 == nil { + r.EncodeNil() + } else { + yy305 := *x.FptrMapIntfUint32 + if false { + } else { + z.F.EncMapIntfUint32V(yy305, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntfUint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfUint64V(x.FMapIntfUint64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntfUint64`) + r.WriteMapElemValue() + if x.FMapIntfUint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfUint64V(x.FMapIntfUint64, e) + } + } + } + var yyn310 bool + if x.FptrMapIntfUint64 == nil { + yyn310 = true + goto LABEL310 + } + LABEL310: + if yyr2 || yy2arr2 { + if yyn310 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntfUint64 == nil { + r.EncodeNil() + } else { + yy311 := *x.FptrMapIntfUint64 + if false { + } else { + z.F.EncMapIntfUint64V(yy311, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfUint64`) + r.WriteMapElemValue() + if yyn310 { + r.EncodeNil() + } else { + if x.FptrMapIntfUint64 == nil { + r.EncodeNil() + } else { + yy313 := *x.FptrMapIntfUint64 + if false { + } else { + z.F.EncMapIntfUint64V(yy313, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntfUintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfUintptrV(x.FMapIntfUintptr, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntfUintptr`) + r.WriteMapElemValue() + if x.FMapIntfUintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfUintptrV(x.FMapIntfUintptr, e) + } + } + } + var yyn318 bool + if x.FptrMapIntfUintptr == nil { + yyn318 = true + goto LABEL318 + } + LABEL318: + if yyr2 || yy2arr2 { + if yyn318 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntfUintptr == nil { + r.EncodeNil() + } else { + yy319 := *x.FptrMapIntfUintptr + if false { + } else { + z.F.EncMapIntfUintptrV(yy319, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfUintptr`) + r.WriteMapElemValue() + if yyn318 { + r.EncodeNil() + } else { + if x.FptrMapIntfUintptr == nil { + r.EncodeNil() + } else { + yy321 := *x.FptrMapIntfUintptr + if false { + } else { + z.F.EncMapIntfUintptrV(yy321, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntfInt == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfIntV(x.FMapIntfInt, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntfInt`) + r.WriteMapElemValue() + if x.FMapIntfInt == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfIntV(x.FMapIntfInt, e) + } + } + } + var yyn326 bool + if x.FptrMapIntfInt == nil { + yyn326 = true + goto LABEL326 + } + LABEL326: + if yyr2 || yy2arr2 { + if yyn326 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntfInt == nil { + r.EncodeNil() + } else { + yy327 := *x.FptrMapIntfInt + if false { + } else { + z.F.EncMapIntfIntV(yy327, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfInt`) + r.WriteMapElemValue() + if yyn326 { + r.EncodeNil() + } else { + if x.FptrMapIntfInt == nil { + r.EncodeNil() + } else { + yy329 := *x.FptrMapIntfInt + if false { + } else { + z.F.EncMapIntfIntV(yy329, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntfInt8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfInt8V(x.FMapIntfInt8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntfInt8`) + r.WriteMapElemValue() + if x.FMapIntfInt8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfInt8V(x.FMapIntfInt8, e) + } + } + } + var yyn334 bool + if x.FptrMapIntfInt8 == nil { + yyn334 = true + goto LABEL334 + } + LABEL334: + if yyr2 || yy2arr2 { + if yyn334 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntfInt8 == nil { + r.EncodeNil() + } else { + yy335 := *x.FptrMapIntfInt8 + if false { + } else { + z.F.EncMapIntfInt8V(yy335, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfInt8`) + r.WriteMapElemValue() + if yyn334 { + r.EncodeNil() + } else { + if x.FptrMapIntfInt8 == nil { + r.EncodeNil() + } else { + yy337 := *x.FptrMapIntfInt8 + if false { + } else { + z.F.EncMapIntfInt8V(yy337, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntfInt16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfInt16V(x.FMapIntfInt16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntfInt16`) + r.WriteMapElemValue() + if x.FMapIntfInt16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfInt16V(x.FMapIntfInt16, e) + } + } + } + var yyn342 bool + if x.FptrMapIntfInt16 == nil { + yyn342 = true + goto LABEL342 + } + LABEL342: + if yyr2 || yy2arr2 { + if yyn342 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntfInt16 == nil { + r.EncodeNil() + } else { + yy343 := *x.FptrMapIntfInt16 + if false { + } else { + z.F.EncMapIntfInt16V(yy343, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfInt16`) + r.WriteMapElemValue() + if yyn342 { + r.EncodeNil() + } else { + if x.FptrMapIntfInt16 == nil { + r.EncodeNil() + } else { + yy345 := *x.FptrMapIntfInt16 + if false { + } else { + z.F.EncMapIntfInt16V(yy345, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntfInt32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfInt32V(x.FMapIntfInt32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntfInt32`) + r.WriteMapElemValue() + if x.FMapIntfInt32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfInt32V(x.FMapIntfInt32, e) + } + } + } + var yyn350 bool + if x.FptrMapIntfInt32 == nil { + yyn350 = true + goto LABEL350 + } + LABEL350: + if yyr2 || yy2arr2 { + if yyn350 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntfInt32 == nil { + r.EncodeNil() + } else { + yy351 := *x.FptrMapIntfInt32 + if false { + } else { + z.F.EncMapIntfInt32V(yy351, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfInt32`) + r.WriteMapElemValue() + if yyn350 { + r.EncodeNil() + } else { + if x.FptrMapIntfInt32 == nil { + r.EncodeNil() + } else { + yy353 := *x.FptrMapIntfInt32 + if false { + } else { + z.F.EncMapIntfInt32V(yy353, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntfInt64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfInt64V(x.FMapIntfInt64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntfInt64`) + r.WriteMapElemValue() + if x.FMapIntfInt64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfInt64V(x.FMapIntfInt64, e) + } + } + } + var yyn358 bool + if x.FptrMapIntfInt64 == nil { + yyn358 = true + goto LABEL358 + } + LABEL358: + if yyr2 || yy2arr2 { + if yyn358 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntfInt64 == nil { + r.EncodeNil() + } else { + yy359 := *x.FptrMapIntfInt64 + if false { + } else { + z.F.EncMapIntfInt64V(yy359, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfInt64`) + r.WriteMapElemValue() + if yyn358 { + r.EncodeNil() + } else { + if x.FptrMapIntfInt64 == nil { + r.EncodeNil() + } else { + yy361 := *x.FptrMapIntfInt64 + if false { + } else { + z.F.EncMapIntfInt64V(yy361, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntfFloat32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfFloat32V(x.FMapIntfFloat32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntfFloat32`) + r.WriteMapElemValue() + if x.FMapIntfFloat32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfFloat32V(x.FMapIntfFloat32, e) + } + } + } + var yyn366 bool + if x.FptrMapIntfFloat32 == nil { + yyn366 = true + goto LABEL366 + } + LABEL366: + if yyr2 || yy2arr2 { + if yyn366 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntfFloat32 == nil { + r.EncodeNil() + } else { + yy367 := *x.FptrMapIntfFloat32 + if false { + } else { + z.F.EncMapIntfFloat32V(yy367, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfFloat32`) + r.WriteMapElemValue() + if yyn366 { + r.EncodeNil() + } else { + if x.FptrMapIntfFloat32 == nil { + r.EncodeNil() + } else { + yy369 := *x.FptrMapIntfFloat32 + if false { + } else { + z.F.EncMapIntfFloat32V(yy369, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntfFloat64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfFloat64V(x.FMapIntfFloat64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntfFloat64`) + r.WriteMapElemValue() + if x.FMapIntfFloat64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfFloat64V(x.FMapIntfFloat64, e) + } + } + } + var yyn374 bool + if x.FptrMapIntfFloat64 == nil { + yyn374 = true + goto LABEL374 + } + LABEL374: + if yyr2 || yy2arr2 { + if yyn374 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntfFloat64 == nil { + r.EncodeNil() + } else { + yy375 := *x.FptrMapIntfFloat64 + if false { + } else { + z.F.EncMapIntfFloat64V(yy375, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfFloat64`) + r.WriteMapElemValue() + if yyn374 { + r.EncodeNil() + } else { + if x.FptrMapIntfFloat64 == nil { + r.EncodeNil() + } else { + yy377 := *x.FptrMapIntfFloat64 + if false { + } else { + z.F.EncMapIntfFloat64V(yy377, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntfBool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfBoolV(x.FMapIntfBool, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntfBool`) + r.WriteMapElemValue() + if x.FMapIntfBool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntfBoolV(x.FMapIntfBool, e) + } + } + } + var yyn382 bool + if x.FptrMapIntfBool == nil { + yyn382 = true + goto LABEL382 + } + LABEL382: + if yyr2 || yy2arr2 { + if yyn382 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntfBool == nil { + r.EncodeNil() + } else { + yy383 := *x.FptrMapIntfBool + if false { + } else { + z.F.EncMapIntfBoolV(yy383, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntfBool`) + r.WriteMapElemValue() + if yyn382 { + r.EncodeNil() + } else { + if x.FptrMapIntfBool == nil { + r.EncodeNil() + } else { + yy385 := *x.FptrMapIntfBool + if false { + } else { + z.F.EncMapIntfBoolV(yy385, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapStringIntf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringIntfV(x.FMapStringIntf, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapStringIntf`) + r.WriteMapElemValue() + if x.FMapStringIntf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringIntfV(x.FMapStringIntf, e) + } + } + } + var yyn390 bool + if x.FptrMapStringIntf == nil { + yyn390 = true + goto LABEL390 + } + LABEL390: + if yyr2 || yy2arr2 { + if yyn390 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapStringIntf == nil { + r.EncodeNil() + } else { + yy391 := *x.FptrMapStringIntf + if false { + } else { + z.F.EncMapStringIntfV(yy391, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapStringIntf`) + r.WriteMapElemValue() + if yyn390 { + r.EncodeNil() + } else { + if x.FptrMapStringIntf == nil { + r.EncodeNil() + } else { + yy393 := *x.FptrMapStringIntf + if false { + } else { + z.F.EncMapStringIntfV(yy393, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapStringString == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringStringV(x.FMapStringString, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapStringString`) + r.WriteMapElemValue() + if x.FMapStringString == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringStringV(x.FMapStringString, e) + } + } + } + var yyn398 bool + if x.FptrMapStringString == nil { + yyn398 = true + goto LABEL398 + } + LABEL398: + if yyr2 || yy2arr2 { + if yyn398 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapStringString == nil { + r.EncodeNil() + } else { + yy399 := *x.FptrMapStringString + if false { + } else { + z.F.EncMapStringStringV(yy399, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapStringString`) + r.WriteMapElemValue() + if yyn398 { + r.EncodeNil() + } else { + if x.FptrMapStringString == nil { + r.EncodeNil() + } else { + yy401 := *x.FptrMapStringString + if false { + } else { + z.F.EncMapStringStringV(yy401, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapStringUint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringUintV(x.FMapStringUint, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapStringUint`) + r.WriteMapElemValue() + if x.FMapStringUint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringUintV(x.FMapStringUint, e) + } + } + } + var yyn406 bool + if x.FptrMapStringUint == nil { + yyn406 = true + goto LABEL406 + } + LABEL406: + if yyr2 || yy2arr2 { + if yyn406 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapStringUint == nil { + r.EncodeNil() + } else { + yy407 := *x.FptrMapStringUint + if false { + } else { + z.F.EncMapStringUintV(yy407, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapStringUint`) + r.WriteMapElemValue() + if yyn406 { + r.EncodeNil() + } else { + if x.FptrMapStringUint == nil { + r.EncodeNil() + } else { + yy409 := *x.FptrMapStringUint + if false { + } else { + z.F.EncMapStringUintV(yy409, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapStringUint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringUint8V(x.FMapStringUint8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapStringUint8`) + r.WriteMapElemValue() + if x.FMapStringUint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringUint8V(x.FMapStringUint8, e) + } + } + } + var yyn414 bool + if x.FptrMapStringUint8 == nil { + yyn414 = true + goto LABEL414 + } + LABEL414: + if yyr2 || yy2arr2 { + if yyn414 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapStringUint8 == nil { + r.EncodeNil() + } else { + yy415 := *x.FptrMapStringUint8 + if false { + } else { + z.F.EncMapStringUint8V(yy415, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapStringUint8`) + r.WriteMapElemValue() + if yyn414 { + r.EncodeNil() + } else { + if x.FptrMapStringUint8 == nil { + r.EncodeNil() + } else { + yy417 := *x.FptrMapStringUint8 + if false { + } else { + z.F.EncMapStringUint8V(yy417, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapStringUint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringUint16V(x.FMapStringUint16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapStringUint16`) + r.WriteMapElemValue() + if x.FMapStringUint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringUint16V(x.FMapStringUint16, e) + } + } + } + var yyn422 bool + if x.FptrMapStringUint16 == nil { + yyn422 = true + goto LABEL422 + } + LABEL422: + if yyr2 || yy2arr2 { + if yyn422 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapStringUint16 == nil { + r.EncodeNil() + } else { + yy423 := *x.FptrMapStringUint16 + if false { + } else { + z.F.EncMapStringUint16V(yy423, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapStringUint16`) + r.WriteMapElemValue() + if yyn422 { + r.EncodeNil() + } else { + if x.FptrMapStringUint16 == nil { + r.EncodeNil() + } else { + yy425 := *x.FptrMapStringUint16 + if false { + } else { + z.F.EncMapStringUint16V(yy425, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapStringUint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringUint32V(x.FMapStringUint32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapStringUint32`) + r.WriteMapElemValue() + if x.FMapStringUint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringUint32V(x.FMapStringUint32, e) + } + } + } + var yyn430 bool + if x.FptrMapStringUint32 == nil { + yyn430 = true + goto LABEL430 + } + LABEL430: + if yyr2 || yy2arr2 { + if yyn430 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapStringUint32 == nil { + r.EncodeNil() + } else { + yy431 := *x.FptrMapStringUint32 + if false { + } else { + z.F.EncMapStringUint32V(yy431, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapStringUint32`) + r.WriteMapElemValue() + if yyn430 { + r.EncodeNil() + } else { + if x.FptrMapStringUint32 == nil { + r.EncodeNil() + } else { + yy433 := *x.FptrMapStringUint32 + if false { + } else { + z.F.EncMapStringUint32V(yy433, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapStringUint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringUint64V(x.FMapStringUint64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapStringUint64`) + r.WriteMapElemValue() + if x.FMapStringUint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringUint64V(x.FMapStringUint64, e) + } + } + } + var yyn438 bool + if x.FptrMapStringUint64 == nil { + yyn438 = true + goto LABEL438 + } + LABEL438: + if yyr2 || yy2arr2 { + if yyn438 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapStringUint64 == nil { + r.EncodeNil() + } else { + yy439 := *x.FptrMapStringUint64 + if false { + } else { + z.F.EncMapStringUint64V(yy439, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapStringUint64`) + r.WriteMapElemValue() + if yyn438 { + r.EncodeNil() + } else { + if x.FptrMapStringUint64 == nil { + r.EncodeNil() + } else { + yy441 := *x.FptrMapStringUint64 + if false { + } else { + z.F.EncMapStringUint64V(yy441, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapStringUintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringUintptrV(x.FMapStringUintptr, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapStringUintptr`) + r.WriteMapElemValue() + if x.FMapStringUintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringUintptrV(x.FMapStringUintptr, e) + } + } + } + var yyn446 bool + if x.FptrMapStringUintptr == nil { + yyn446 = true + goto LABEL446 + } + LABEL446: + if yyr2 || yy2arr2 { + if yyn446 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapStringUintptr == nil { + r.EncodeNil() + } else { + yy447 := *x.FptrMapStringUintptr + if false { + } else { + z.F.EncMapStringUintptrV(yy447, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapStringUintptr`) + r.WriteMapElemValue() + if yyn446 { + r.EncodeNil() + } else { + if x.FptrMapStringUintptr == nil { + r.EncodeNil() + } else { + yy449 := *x.FptrMapStringUintptr + if false { + } else { + z.F.EncMapStringUintptrV(yy449, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapStringInt == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringIntV(x.FMapStringInt, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapStringInt`) + r.WriteMapElemValue() + if x.FMapStringInt == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringIntV(x.FMapStringInt, e) + } + } + } + var yyn454 bool + if x.FptrMapStringInt == nil { + yyn454 = true + goto LABEL454 + } + LABEL454: + if yyr2 || yy2arr2 { + if yyn454 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapStringInt == nil { + r.EncodeNil() + } else { + yy455 := *x.FptrMapStringInt + if false { + } else { + z.F.EncMapStringIntV(yy455, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapStringInt`) + r.WriteMapElemValue() + if yyn454 { + r.EncodeNil() + } else { + if x.FptrMapStringInt == nil { + r.EncodeNil() + } else { + yy457 := *x.FptrMapStringInt + if false { + } else { + z.F.EncMapStringIntV(yy457, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapStringInt8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringInt8V(x.FMapStringInt8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapStringInt8`) + r.WriteMapElemValue() + if x.FMapStringInt8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringInt8V(x.FMapStringInt8, e) + } + } + } + var yyn462 bool + if x.FptrMapStringInt8 == nil { + yyn462 = true + goto LABEL462 + } + LABEL462: + if yyr2 || yy2arr2 { + if yyn462 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapStringInt8 == nil { + r.EncodeNil() + } else { + yy463 := *x.FptrMapStringInt8 + if false { + } else { + z.F.EncMapStringInt8V(yy463, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapStringInt8`) + r.WriteMapElemValue() + if yyn462 { + r.EncodeNil() + } else { + if x.FptrMapStringInt8 == nil { + r.EncodeNil() + } else { + yy465 := *x.FptrMapStringInt8 + if false { + } else { + z.F.EncMapStringInt8V(yy465, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapStringInt16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringInt16V(x.FMapStringInt16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapStringInt16`) + r.WriteMapElemValue() + if x.FMapStringInt16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringInt16V(x.FMapStringInt16, e) + } + } + } + var yyn470 bool + if x.FptrMapStringInt16 == nil { + yyn470 = true + goto LABEL470 + } + LABEL470: + if yyr2 || yy2arr2 { + if yyn470 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapStringInt16 == nil { + r.EncodeNil() + } else { + yy471 := *x.FptrMapStringInt16 + if false { + } else { + z.F.EncMapStringInt16V(yy471, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapStringInt16`) + r.WriteMapElemValue() + if yyn470 { + r.EncodeNil() + } else { + if x.FptrMapStringInt16 == nil { + r.EncodeNil() + } else { + yy473 := *x.FptrMapStringInt16 + if false { + } else { + z.F.EncMapStringInt16V(yy473, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapStringInt32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringInt32V(x.FMapStringInt32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapStringInt32`) + r.WriteMapElemValue() + if x.FMapStringInt32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringInt32V(x.FMapStringInt32, e) + } + } + } + var yyn478 bool + if x.FptrMapStringInt32 == nil { + yyn478 = true + goto LABEL478 + } + LABEL478: + if yyr2 || yy2arr2 { + if yyn478 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapStringInt32 == nil { + r.EncodeNil() + } else { + yy479 := *x.FptrMapStringInt32 + if false { + } else { + z.F.EncMapStringInt32V(yy479, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapStringInt32`) + r.WriteMapElemValue() + if yyn478 { + r.EncodeNil() + } else { + if x.FptrMapStringInt32 == nil { + r.EncodeNil() + } else { + yy481 := *x.FptrMapStringInt32 + if false { + } else { + z.F.EncMapStringInt32V(yy481, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapStringInt64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringInt64V(x.FMapStringInt64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapStringInt64`) + r.WriteMapElemValue() + if x.FMapStringInt64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringInt64V(x.FMapStringInt64, e) + } + } + } + var yyn486 bool + if x.FptrMapStringInt64 == nil { + yyn486 = true + goto LABEL486 + } + LABEL486: + if yyr2 || yy2arr2 { + if yyn486 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapStringInt64 == nil { + r.EncodeNil() + } else { + yy487 := *x.FptrMapStringInt64 + if false { + } else { + z.F.EncMapStringInt64V(yy487, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapStringInt64`) + r.WriteMapElemValue() + if yyn486 { + r.EncodeNil() + } else { + if x.FptrMapStringInt64 == nil { + r.EncodeNil() + } else { + yy489 := *x.FptrMapStringInt64 + if false { + } else { + z.F.EncMapStringInt64V(yy489, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapStringFloat32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringFloat32V(x.FMapStringFloat32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapStringFloat32`) + r.WriteMapElemValue() + if x.FMapStringFloat32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringFloat32V(x.FMapStringFloat32, e) + } + } + } + var yyn494 bool + if x.FptrMapStringFloat32 == nil { + yyn494 = true + goto LABEL494 + } + LABEL494: + if yyr2 || yy2arr2 { + if yyn494 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapStringFloat32 == nil { + r.EncodeNil() + } else { + yy495 := *x.FptrMapStringFloat32 + if false { + } else { + z.F.EncMapStringFloat32V(yy495, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapStringFloat32`) + r.WriteMapElemValue() + if yyn494 { + r.EncodeNil() + } else { + if x.FptrMapStringFloat32 == nil { + r.EncodeNil() + } else { + yy497 := *x.FptrMapStringFloat32 + if false { + } else { + z.F.EncMapStringFloat32V(yy497, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapStringFloat64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringFloat64V(x.FMapStringFloat64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapStringFloat64`) + r.WriteMapElemValue() + if x.FMapStringFloat64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringFloat64V(x.FMapStringFloat64, e) + } + } + } + var yyn502 bool + if x.FptrMapStringFloat64 == nil { + yyn502 = true + goto LABEL502 + } + LABEL502: + if yyr2 || yy2arr2 { + if yyn502 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapStringFloat64 == nil { + r.EncodeNil() + } else { + yy503 := *x.FptrMapStringFloat64 + if false { + } else { + z.F.EncMapStringFloat64V(yy503, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapStringFloat64`) + r.WriteMapElemValue() + if yyn502 { + r.EncodeNil() + } else { + if x.FptrMapStringFloat64 == nil { + r.EncodeNil() + } else { + yy505 := *x.FptrMapStringFloat64 + if false { + } else { + z.F.EncMapStringFloat64V(yy505, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapStringBool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringBoolV(x.FMapStringBool, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapStringBool`) + r.WriteMapElemValue() + if x.FMapStringBool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapStringBoolV(x.FMapStringBool, e) + } + } + } + var yyn510 bool + if x.FptrMapStringBool == nil { + yyn510 = true + goto LABEL510 + } + LABEL510: + if yyr2 || yy2arr2 { + if yyn510 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapStringBool == nil { + r.EncodeNil() + } else { + yy511 := *x.FptrMapStringBool + if false { + } else { + z.F.EncMapStringBoolV(yy511, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapStringBool`) + r.WriteMapElemValue() + if yyn510 { + r.EncodeNil() + } else { + if x.FptrMapStringBool == nil { + r.EncodeNil() + } else { + yy513 := *x.FptrMapStringBool + if false { + } else { + z.F.EncMapStringBoolV(yy513, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat32Intf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32IntfV(x.FMapFloat32Intf, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Intf`) + r.WriteMapElemValue() + if x.FMapFloat32Intf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32IntfV(x.FMapFloat32Intf, e) + } + } + } + var yyn518 bool + if x.FptrMapFloat32Intf == nil { + yyn518 = true + goto LABEL518 + } + LABEL518: + if yyr2 || yy2arr2 { + if yyn518 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat32Intf == nil { + r.EncodeNil() + } else { + yy519 := *x.FptrMapFloat32Intf + if false { + } else { + z.F.EncMapFloat32IntfV(yy519, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Intf`) + r.WriteMapElemValue() + if yyn518 { + r.EncodeNil() + } else { + if x.FptrMapFloat32Intf == nil { + r.EncodeNil() + } else { + yy521 := *x.FptrMapFloat32Intf + if false { + } else { + z.F.EncMapFloat32IntfV(yy521, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat32String == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32StringV(x.FMapFloat32String, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat32String`) + r.WriteMapElemValue() + if x.FMapFloat32String == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32StringV(x.FMapFloat32String, e) + } + } + } + var yyn526 bool + if x.FptrMapFloat32String == nil { + yyn526 = true + goto LABEL526 + } + LABEL526: + if yyr2 || yy2arr2 { + if yyn526 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat32String == nil { + r.EncodeNil() + } else { + yy527 := *x.FptrMapFloat32String + if false { + } else { + z.F.EncMapFloat32StringV(yy527, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32String`) + r.WriteMapElemValue() + if yyn526 { + r.EncodeNil() + } else { + if x.FptrMapFloat32String == nil { + r.EncodeNil() + } else { + yy529 := *x.FptrMapFloat32String + if false { + } else { + z.F.EncMapFloat32StringV(yy529, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat32Uint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32UintV(x.FMapFloat32Uint, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Uint`) + r.WriteMapElemValue() + if x.FMapFloat32Uint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32UintV(x.FMapFloat32Uint, e) + } + } + } + var yyn534 bool + if x.FptrMapFloat32Uint == nil { + yyn534 = true + goto LABEL534 + } + LABEL534: + if yyr2 || yy2arr2 { + if yyn534 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat32Uint == nil { + r.EncodeNil() + } else { + yy535 := *x.FptrMapFloat32Uint + if false { + } else { + z.F.EncMapFloat32UintV(yy535, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Uint`) + r.WriteMapElemValue() + if yyn534 { + r.EncodeNil() + } else { + if x.FptrMapFloat32Uint == nil { + r.EncodeNil() + } else { + yy537 := *x.FptrMapFloat32Uint + if false { + } else { + z.F.EncMapFloat32UintV(yy537, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat32Uint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32Uint8V(x.FMapFloat32Uint8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Uint8`) + r.WriteMapElemValue() + if x.FMapFloat32Uint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32Uint8V(x.FMapFloat32Uint8, e) + } + } + } + var yyn542 bool + if x.FptrMapFloat32Uint8 == nil { + yyn542 = true + goto LABEL542 + } + LABEL542: + if yyr2 || yy2arr2 { + if yyn542 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat32Uint8 == nil { + r.EncodeNil() + } else { + yy543 := *x.FptrMapFloat32Uint8 + if false { + } else { + z.F.EncMapFloat32Uint8V(yy543, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Uint8`) + r.WriteMapElemValue() + if yyn542 { + r.EncodeNil() + } else { + if x.FptrMapFloat32Uint8 == nil { + r.EncodeNil() + } else { + yy545 := *x.FptrMapFloat32Uint8 + if false { + } else { + z.F.EncMapFloat32Uint8V(yy545, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat32Uint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32Uint16V(x.FMapFloat32Uint16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Uint16`) + r.WriteMapElemValue() + if x.FMapFloat32Uint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32Uint16V(x.FMapFloat32Uint16, e) + } + } + } + var yyn550 bool + if x.FptrMapFloat32Uint16 == nil { + yyn550 = true + goto LABEL550 + } + LABEL550: + if yyr2 || yy2arr2 { + if yyn550 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat32Uint16 == nil { + r.EncodeNil() + } else { + yy551 := *x.FptrMapFloat32Uint16 + if false { + } else { + z.F.EncMapFloat32Uint16V(yy551, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Uint16`) + r.WriteMapElemValue() + if yyn550 { + r.EncodeNil() + } else { + if x.FptrMapFloat32Uint16 == nil { + r.EncodeNil() + } else { + yy553 := *x.FptrMapFloat32Uint16 + if false { + } else { + z.F.EncMapFloat32Uint16V(yy553, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat32Uint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32Uint32V(x.FMapFloat32Uint32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Uint32`) + r.WriteMapElemValue() + if x.FMapFloat32Uint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32Uint32V(x.FMapFloat32Uint32, e) + } + } + } + var yyn558 bool + if x.FptrMapFloat32Uint32 == nil { + yyn558 = true + goto LABEL558 + } + LABEL558: + if yyr2 || yy2arr2 { + if yyn558 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat32Uint32 == nil { + r.EncodeNil() + } else { + yy559 := *x.FptrMapFloat32Uint32 + if false { + } else { + z.F.EncMapFloat32Uint32V(yy559, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Uint32`) + r.WriteMapElemValue() + if yyn558 { + r.EncodeNil() + } else { + if x.FptrMapFloat32Uint32 == nil { + r.EncodeNil() + } else { + yy561 := *x.FptrMapFloat32Uint32 + if false { + } else { + z.F.EncMapFloat32Uint32V(yy561, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat32Uint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32Uint64V(x.FMapFloat32Uint64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Uint64`) + r.WriteMapElemValue() + if x.FMapFloat32Uint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32Uint64V(x.FMapFloat32Uint64, e) + } + } + } + var yyn566 bool + if x.FptrMapFloat32Uint64 == nil { + yyn566 = true + goto LABEL566 + } + LABEL566: + if yyr2 || yy2arr2 { + if yyn566 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat32Uint64 == nil { + r.EncodeNil() + } else { + yy567 := *x.FptrMapFloat32Uint64 + if false { + } else { + z.F.EncMapFloat32Uint64V(yy567, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Uint64`) + r.WriteMapElemValue() + if yyn566 { + r.EncodeNil() + } else { + if x.FptrMapFloat32Uint64 == nil { + r.EncodeNil() + } else { + yy569 := *x.FptrMapFloat32Uint64 + if false { + } else { + z.F.EncMapFloat32Uint64V(yy569, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat32Uintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32UintptrV(x.FMapFloat32Uintptr, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Uintptr`) + r.WriteMapElemValue() + if x.FMapFloat32Uintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32UintptrV(x.FMapFloat32Uintptr, e) + } + } + } + var yyn574 bool + if x.FptrMapFloat32Uintptr == nil { + yyn574 = true + goto LABEL574 + } + LABEL574: + if yyr2 || yy2arr2 { + if yyn574 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat32Uintptr == nil { + r.EncodeNil() + } else { + yy575 := *x.FptrMapFloat32Uintptr + if false { + } else { + z.F.EncMapFloat32UintptrV(yy575, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Uintptr`) + r.WriteMapElemValue() + if yyn574 { + r.EncodeNil() + } else { + if x.FptrMapFloat32Uintptr == nil { + r.EncodeNil() + } else { + yy577 := *x.FptrMapFloat32Uintptr + if false { + } else { + z.F.EncMapFloat32UintptrV(yy577, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat32Int == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32IntV(x.FMapFloat32Int, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Int`) + r.WriteMapElemValue() + if x.FMapFloat32Int == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32IntV(x.FMapFloat32Int, e) + } + } + } + var yyn582 bool + if x.FptrMapFloat32Int == nil { + yyn582 = true + goto LABEL582 + } + LABEL582: + if yyr2 || yy2arr2 { + if yyn582 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat32Int == nil { + r.EncodeNil() + } else { + yy583 := *x.FptrMapFloat32Int + if false { + } else { + z.F.EncMapFloat32IntV(yy583, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Int`) + r.WriteMapElemValue() + if yyn582 { + r.EncodeNil() + } else { + if x.FptrMapFloat32Int == nil { + r.EncodeNil() + } else { + yy585 := *x.FptrMapFloat32Int + if false { + } else { + z.F.EncMapFloat32IntV(yy585, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat32Int8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32Int8V(x.FMapFloat32Int8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Int8`) + r.WriteMapElemValue() + if x.FMapFloat32Int8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32Int8V(x.FMapFloat32Int8, e) + } + } + } + var yyn590 bool + if x.FptrMapFloat32Int8 == nil { + yyn590 = true + goto LABEL590 + } + LABEL590: + if yyr2 || yy2arr2 { + if yyn590 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat32Int8 == nil { + r.EncodeNil() + } else { + yy591 := *x.FptrMapFloat32Int8 + if false { + } else { + z.F.EncMapFloat32Int8V(yy591, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Int8`) + r.WriteMapElemValue() + if yyn590 { + r.EncodeNil() + } else { + if x.FptrMapFloat32Int8 == nil { + r.EncodeNil() + } else { + yy593 := *x.FptrMapFloat32Int8 + if false { + } else { + z.F.EncMapFloat32Int8V(yy593, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat32Int16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32Int16V(x.FMapFloat32Int16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Int16`) + r.WriteMapElemValue() + if x.FMapFloat32Int16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32Int16V(x.FMapFloat32Int16, e) + } + } + } + var yyn598 bool + if x.FptrMapFloat32Int16 == nil { + yyn598 = true + goto LABEL598 + } + LABEL598: + if yyr2 || yy2arr2 { + if yyn598 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat32Int16 == nil { + r.EncodeNil() + } else { + yy599 := *x.FptrMapFloat32Int16 + if false { + } else { + z.F.EncMapFloat32Int16V(yy599, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Int16`) + r.WriteMapElemValue() + if yyn598 { + r.EncodeNil() + } else { + if x.FptrMapFloat32Int16 == nil { + r.EncodeNil() + } else { + yy601 := *x.FptrMapFloat32Int16 + if false { + } else { + z.F.EncMapFloat32Int16V(yy601, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat32Int32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32Int32V(x.FMapFloat32Int32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Int32`) + r.WriteMapElemValue() + if x.FMapFloat32Int32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32Int32V(x.FMapFloat32Int32, e) + } + } + } + var yyn606 bool + if x.FptrMapFloat32Int32 == nil { + yyn606 = true + goto LABEL606 + } + LABEL606: + if yyr2 || yy2arr2 { + if yyn606 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat32Int32 == nil { + r.EncodeNil() + } else { + yy607 := *x.FptrMapFloat32Int32 + if false { + } else { + z.F.EncMapFloat32Int32V(yy607, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Int32`) + r.WriteMapElemValue() + if yyn606 { + r.EncodeNil() + } else { + if x.FptrMapFloat32Int32 == nil { + r.EncodeNil() + } else { + yy609 := *x.FptrMapFloat32Int32 + if false { + } else { + z.F.EncMapFloat32Int32V(yy609, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat32Int64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32Int64V(x.FMapFloat32Int64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Int64`) + r.WriteMapElemValue() + if x.FMapFloat32Int64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32Int64V(x.FMapFloat32Int64, e) + } + } + } + var yyn614 bool + if x.FptrMapFloat32Int64 == nil { + yyn614 = true + goto LABEL614 + } + LABEL614: + if yyr2 || yy2arr2 { + if yyn614 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat32Int64 == nil { + r.EncodeNil() + } else { + yy615 := *x.FptrMapFloat32Int64 + if false { + } else { + z.F.EncMapFloat32Int64V(yy615, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Int64`) + r.WriteMapElemValue() + if yyn614 { + r.EncodeNil() + } else { + if x.FptrMapFloat32Int64 == nil { + r.EncodeNil() + } else { + yy617 := *x.FptrMapFloat32Int64 + if false { + } else { + z.F.EncMapFloat32Int64V(yy617, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat32Float32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32Float32V(x.FMapFloat32Float32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Float32`) + r.WriteMapElemValue() + if x.FMapFloat32Float32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32Float32V(x.FMapFloat32Float32, e) + } + } + } + var yyn622 bool + if x.FptrMapFloat32Float32 == nil { + yyn622 = true + goto LABEL622 + } + LABEL622: + if yyr2 || yy2arr2 { + if yyn622 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat32Float32 == nil { + r.EncodeNil() + } else { + yy623 := *x.FptrMapFloat32Float32 + if false { + } else { + z.F.EncMapFloat32Float32V(yy623, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Float32`) + r.WriteMapElemValue() + if yyn622 { + r.EncodeNil() + } else { + if x.FptrMapFloat32Float32 == nil { + r.EncodeNil() + } else { + yy625 := *x.FptrMapFloat32Float32 + if false { + } else { + z.F.EncMapFloat32Float32V(yy625, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat32Float64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32Float64V(x.FMapFloat32Float64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Float64`) + r.WriteMapElemValue() + if x.FMapFloat32Float64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32Float64V(x.FMapFloat32Float64, e) + } + } + } + var yyn630 bool + if x.FptrMapFloat32Float64 == nil { + yyn630 = true + goto LABEL630 + } + LABEL630: + if yyr2 || yy2arr2 { + if yyn630 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat32Float64 == nil { + r.EncodeNil() + } else { + yy631 := *x.FptrMapFloat32Float64 + if false { + } else { + z.F.EncMapFloat32Float64V(yy631, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Float64`) + r.WriteMapElemValue() + if yyn630 { + r.EncodeNil() + } else { + if x.FptrMapFloat32Float64 == nil { + r.EncodeNil() + } else { + yy633 := *x.FptrMapFloat32Float64 + if false { + } else { + z.F.EncMapFloat32Float64V(yy633, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat32Bool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32BoolV(x.FMapFloat32Bool, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat32Bool`) + r.WriteMapElemValue() + if x.FMapFloat32Bool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat32BoolV(x.FMapFloat32Bool, e) + } + } + } + var yyn638 bool + if x.FptrMapFloat32Bool == nil { + yyn638 = true + goto LABEL638 + } + LABEL638: + if yyr2 || yy2arr2 { + if yyn638 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat32Bool == nil { + r.EncodeNil() + } else { + yy639 := *x.FptrMapFloat32Bool + if false { + } else { + z.F.EncMapFloat32BoolV(yy639, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat32Bool`) + r.WriteMapElemValue() + if yyn638 { + r.EncodeNil() + } else { + if x.FptrMapFloat32Bool == nil { + r.EncodeNil() + } else { + yy641 := *x.FptrMapFloat32Bool + if false { + } else { + z.F.EncMapFloat32BoolV(yy641, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat64Intf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64IntfV(x.FMapFloat64Intf, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Intf`) + r.WriteMapElemValue() + if x.FMapFloat64Intf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64IntfV(x.FMapFloat64Intf, e) + } + } + } + var yyn646 bool + if x.FptrMapFloat64Intf == nil { + yyn646 = true + goto LABEL646 + } + LABEL646: + if yyr2 || yy2arr2 { + if yyn646 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat64Intf == nil { + r.EncodeNil() + } else { + yy647 := *x.FptrMapFloat64Intf + if false { + } else { + z.F.EncMapFloat64IntfV(yy647, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Intf`) + r.WriteMapElemValue() + if yyn646 { + r.EncodeNil() + } else { + if x.FptrMapFloat64Intf == nil { + r.EncodeNil() + } else { + yy649 := *x.FptrMapFloat64Intf + if false { + } else { + z.F.EncMapFloat64IntfV(yy649, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat64String == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64StringV(x.FMapFloat64String, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat64String`) + r.WriteMapElemValue() + if x.FMapFloat64String == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64StringV(x.FMapFloat64String, e) + } + } + } + var yyn654 bool + if x.FptrMapFloat64String == nil { + yyn654 = true + goto LABEL654 + } + LABEL654: + if yyr2 || yy2arr2 { + if yyn654 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat64String == nil { + r.EncodeNil() + } else { + yy655 := *x.FptrMapFloat64String + if false { + } else { + z.F.EncMapFloat64StringV(yy655, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64String`) + r.WriteMapElemValue() + if yyn654 { + r.EncodeNil() + } else { + if x.FptrMapFloat64String == nil { + r.EncodeNil() + } else { + yy657 := *x.FptrMapFloat64String + if false { + } else { + z.F.EncMapFloat64StringV(yy657, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat64Uint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64UintV(x.FMapFloat64Uint, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Uint`) + r.WriteMapElemValue() + if x.FMapFloat64Uint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64UintV(x.FMapFloat64Uint, e) + } + } + } + var yyn662 bool + if x.FptrMapFloat64Uint == nil { + yyn662 = true + goto LABEL662 + } + LABEL662: + if yyr2 || yy2arr2 { + if yyn662 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat64Uint == nil { + r.EncodeNil() + } else { + yy663 := *x.FptrMapFloat64Uint + if false { + } else { + z.F.EncMapFloat64UintV(yy663, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Uint`) + r.WriteMapElemValue() + if yyn662 { + r.EncodeNil() + } else { + if x.FptrMapFloat64Uint == nil { + r.EncodeNil() + } else { + yy665 := *x.FptrMapFloat64Uint + if false { + } else { + z.F.EncMapFloat64UintV(yy665, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat64Uint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64Uint8V(x.FMapFloat64Uint8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Uint8`) + r.WriteMapElemValue() + if x.FMapFloat64Uint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64Uint8V(x.FMapFloat64Uint8, e) + } + } + } + var yyn670 bool + if x.FptrMapFloat64Uint8 == nil { + yyn670 = true + goto LABEL670 + } + LABEL670: + if yyr2 || yy2arr2 { + if yyn670 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat64Uint8 == nil { + r.EncodeNil() + } else { + yy671 := *x.FptrMapFloat64Uint8 + if false { + } else { + z.F.EncMapFloat64Uint8V(yy671, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Uint8`) + r.WriteMapElemValue() + if yyn670 { + r.EncodeNil() + } else { + if x.FptrMapFloat64Uint8 == nil { + r.EncodeNil() + } else { + yy673 := *x.FptrMapFloat64Uint8 + if false { + } else { + z.F.EncMapFloat64Uint8V(yy673, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat64Uint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64Uint16V(x.FMapFloat64Uint16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Uint16`) + r.WriteMapElemValue() + if x.FMapFloat64Uint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64Uint16V(x.FMapFloat64Uint16, e) + } + } + } + var yyn678 bool + if x.FptrMapFloat64Uint16 == nil { + yyn678 = true + goto LABEL678 + } + LABEL678: + if yyr2 || yy2arr2 { + if yyn678 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat64Uint16 == nil { + r.EncodeNil() + } else { + yy679 := *x.FptrMapFloat64Uint16 + if false { + } else { + z.F.EncMapFloat64Uint16V(yy679, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Uint16`) + r.WriteMapElemValue() + if yyn678 { + r.EncodeNil() + } else { + if x.FptrMapFloat64Uint16 == nil { + r.EncodeNil() + } else { + yy681 := *x.FptrMapFloat64Uint16 + if false { + } else { + z.F.EncMapFloat64Uint16V(yy681, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat64Uint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64Uint32V(x.FMapFloat64Uint32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Uint32`) + r.WriteMapElemValue() + if x.FMapFloat64Uint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64Uint32V(x.FMapFloat64Uint32, e) + } + } + } + var yyn686 bool + if x.FptrMapFloat64Uint32 == nil { + yyn686 = true + goto LABEL686 + } + LABEL686: + if yyr2 || yy2arr2 { + if yyn686 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat64Uint32 == nil { + r.EncodeNil() + } else { + yy687 := *x.FptrMapFloat64Uint32 + if false { + } else { + z.F.EncMapFloat64Uint32V(yy687, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Uint32`) + r.WriteMapElemValue() + if yyn686 { + r.EncodeNil() + } else { + if x.FptrMapFloat64Uint32 == nil { + r.EncodeNil() + } else { + yy689 := *x.FptrMapFloat64Uint32 + if false { + } else { + z.F.EncMapFloat64Uint32V(yy689, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat64Uint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64Uint64V(x.FMapFloat64Uint64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Uint64`) + r.WriteMapElemValue() + if x.FMapFloat64Uint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64Uint64V(x.FMapFloat64Uint64, e) + } + } + } + var yyn694 bool + if x.FptrMapFloat64Uint64 == nil { + yyn694 = true + goto LABEL694 + } + LABEL694: + if yyr2 || yy2arr2 { + if yyn694 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat64Uint64 == nil { + r.EncodeNil() + } else { + yy695 := *x.FptrMapFloat64Uint64 + if false { + } else { + z.F.EncMapFloat64Uint64V(yy695, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Uint64`) + r.WriteMapElemValue() + if yyn694 { + r.EncodeNil() + } else { + if x.FptrMapFloat64Uint64 == nil { + r.EncodeNil() + } else { + yy697 := *x.FptrMapFloat64Uint64 + if false { + } else { + z.F.EncMapFloat64Uint64V(yy697, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat64Uintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64UintptrV(x.FMapFloat64Uintptr, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Uintptr`) + r.WriteMapElemValue() + if x.FMapFloat64Uintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64UintptrV(x.FMapFloat64Uintptr, e) + } + } + } + var yyn702 bool + if x.FptrMapFloat64Uintptr == nil { + yyn702 = true + goto LABEL702 + } + LABEL702: + if yyr2 || yy2arr2 { + if yyn702 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat64Uintptr == nil { + r.EncodeNil() + } else { + yy703 := *x.FptrMapFloat64Uintptr + if false { + } else { + z.F.EncMapFloat64UintptrV(yy703, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Uintptr`) + r.WriteMapElemValue() + if yyn702 { + r.EncodeNil() + } else { + if x.FptrMapFloat64Uintptr == nil { + r.EncodeNil() + } else { + yy705 := *x.FptrMapFloat64Uintptr + if false { + } else { + z.F.EncMapFloat64UintptrV(yy705, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat64Int == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64IntV(x.FMapFloat64Int, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Int`) + r.WriteMapElemValue() + if x.FMapFloat64Int == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64IntV(x.FMapFloat64Int, e) + } + } + } + var yyn710 bool + if x.FptrMapFloat64Int == nil { + yyn710 = true + goto LABEL710 + } + LABEL710: + if yyr2 || yy2arr2 { + if yyn710 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat64Int == nil { + r.EncodeNil() + } else { + yy711 := *x.FptrMapFloat64Int + if false { + } else { + z.F.EncMapFloat64IntV(yy711, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Int`) + r.WriteMapElemValue() + if yyn710 { + r.EncodeNil() + } else { + if x.FptrMapFloat64Int == nil { + r.EncodeNil() + } else { + yy713 := *x.FptrMapFloat64Int + if false { + } else { + z.F.EncMapFloat64IntV(yy713, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat64Int8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64Int8V(x.FMapFloat64Int8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Int8`) + r.WriteMapElemValue() + if x.FMapFloat64Int8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64Int8V(x.FMapFloat64Int8, e) + } + } + } + var yyn718 bool + if x.FptrMapFloat64Int8 == nil { + yyn718 = true + goto LABEL718 + } + LABEL718: + if yyr2 || yy2arr2 { + if yyn718 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat64Int8 == nil { + r.EncodeNil() + } else { + yy719 := *x.FptrMapFloat64Int8 + if false { + } else { + z.F.EncMapFloat64Int8V(yy719, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Int8`) + r.WriteMapElemValue() + if yyn718 { + r.EncodeNil() + } else { + if x.FptrMapFloat64Int8 == nil { + r.EncodeNil() + } else { + yy721 := *x.FptrMapFloat64Int8 + if false { + } else { + z.F.EncMapFloat64Int8V(yy721, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat64Int16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64Int16V(x.FMapFloat64Int16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Int16`) + r.WriteMapElemValue() + if x.FMapFloat64Int16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64Int16V(x.FMapFloat64Int16, e) + } + } + } + var yyn726 bool + if x.FptrMapFloat64Int16 == nil { + yyn726 = true + goto LABEL726 + } + LABEL726: + if yyr2 || yy2arr2 { + if yyn726 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat64Int16 == nil { + r.EncodeNil() + } else { + yy727 := *x.FptrMapFloat64Int16 + if false { + } else { + z.F.EncMapFloat64Int16V(yy727, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Int16`) + r.WriteMapElemValue() + if yyn726 { + r.EncodeNil() + } else { + if x.FptrMapFloat64Int16 == nil { + r.EncodeNil() + } else { + yy729 := *x.FptrMapFloat64Int16 + if false { + } else { + z.F.EncMapFloat64Int16V(yy729, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat64Int32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64Int32V(x.FMapFloat64Int32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Int32`) + r.WriteMapElemValue() + if x.FMapFloat64Int32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64Int32V(x.FMapFloat64Int32, e) + } + } + } + var yyn734 bool + if x.FptrMapFloat64Int32 == nil { + yyn734 = true + goto LABEL734 + } + LABEL734: + if yyr2 || yy2arr2 { + if yyn734 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat64Int32 == nil { + r.EncodeNil() + } else { + yy735 := *x.FptrMapFloat64Int32 + if false { + } else { + z.F.EncMapFloat64Int32V(yy735, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Int32`) + r.WriteMapElemValue() + if yyn734 { + r.EncodeNil() + } else { + if x.FptrMapFloat64Int32 == nil { + r.EncodeNil() + } else { + yy737 := *x.FptrMapFloat64Int32 + if false { + } else { + z.F.EncMapFloat64Int32V(yy737, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat64Int64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64Int64V(x.FMapFloat64Int64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Int64`) + r.WriteMapElemValue() + if x.FMapFloat64Int64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64Int64V(x.FMapFloat64Int64, e) + } + } + } + var yyn742 bool + if x.FptrMapFloat64Int64 == nil { + yyn742 = true + goto LABEL742 + } + LABEL742: + if yyr2 || yy2arr2 { + if yyn742 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat64Int64 == nil { + r.EncodeNil() + } else { + yy743 := *x.FptrMapFloat64Int64 + if false { + } else { + z.F.EncMapFloat64Int64V(yy743, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Int64`) + r.WriteMapElemValue() + if yyn742 { + r.EncodeNil() + } else { + if x.FptrMapFloat64Int64 == nil { + r.EncodeNil() + } else { + yy745 := *x.FptrMapFloat64Int64 + if false { + } else { + z.F.EncMapFloat64Int64V(yy745, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat64Float32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64Float32V(x.FMapFloat64Float32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Float32`) + r.WriteMapElemValue() + if x.FMapFloat64Float32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64Float32V(x.FMapFloat64Float32, e) + } + } + } + var yyn750 bool + if x.FptrMapFloat64Float32 == nil { + yyn750 = true + goto LABEL750 + } + LABEL750: + if yyr2 || yy2arr2 { + if yyn750 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat64Float32 == nil { + r.EncodeNil() + } else { + yy751 := *x.FptrMapFloat64Float32 + if false { + } else { + z.F.EncMapFloat64Float32V(yy751, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Float32`) + r.WriteMapElemValue() + if yyn750 { + r.EncodeNil() + } else { + if x.FptrMapFloat64Float32 == nil { + r.EncodeNil() + } else { + yy753 := *x.FptrMapFloat64Float32 + if false { + } else { + z.F.EncMapFloat64Float32V(yy753, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat64Float64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64Float64V(x.FMapFloat64Float64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Float64`) + r.WriteMapElemValue() + if x.FMapFloat64Float64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64Float64V(x.FMapFloat64Float64, e) + } + } + } + var yyn758 bool + if x.FptrMapFloat64Float64 == nil { + yyn758 = true + goto LABEL758 + } + LABEL758: + if yyr2 || yy2arr2 { + if yyn758 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat64Float64 == nil { + r.EncodeNil() + } else { + yy759 := *x.FptrMapFloat64Float64 + if false { + } else { + z.F.EncMapFloat64Float64V(yy759, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Float64`) + r.WriteMapElemValue() + if yyn758 { + r.EncodeNil() + } else { + if x.FptrMapFloat64Float64 == nil { + r.EncodeNil() + } else { + yy761 := *x.FptrMapFloat64Float64 + if false { + } else { + z.F.EncMapFloat64Float64V(yy761, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapFloat64Bool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64BoolV(x.FMapFloat64Bool, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapFloat64Bool`) + r.WriteMapElemValue() + if x.FMapFloat64Bool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapFloat64BoolV(x.FMapFloat64Bool, e) + } + } + } + var yyn766 bool + if x.FptrMapFloat64Bool == nil { + yyn766 = true + goto LABEL766 + } + LABEL766: + if yyr2 || yy2arr2 { + if yyn766 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapFloat64Bool == nil { + r.EncodeNil() + } else { + yy767 := *x.FptrMapFloat64Bool + if false { + } else { + z.F.EncMapFloat64BoolV(yy767, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapFloat64Bool`) + r.WriteMapElemValue() + if yyn766 { + r.EncodeNil() + } else { + if x.FptrMapFloat64Bool == nil { + r.EncodeNil() + } else { + yy769 := *x.FptrMapFloat64Bool + if false { + } else { + z.F.EncMapFloat64BoolV(yy769, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintIntf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintIntfV(x.FMapUintIntf, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintIntf`) + r.WriteMapElemValue() + if x.FMapUintIntf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintIntfV(x.FMapUintIntf, e) + } + } + } + var yyn774 bool + if x.FptrMapUintIntf == nil { + yyn774 = true + goto LABEL774 + } + LABEL774: + if yyr2 || yy2arr2 { + if yyn774 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintIntf == nil { + r.EncodeNil() + } else { + yy775 := *x.FptrMapUintIntf + if false { + } else { + z.F.EncMapUintIntfV(yy775, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintIntf`) + r.WriteMapElemValue() + if yyn774 { + r.EncodeNil() + } else { + if x.FptrMapUintIntf == nil { + r.EncodeNil() + } else { + yy777 := *x.FptrMapUintIntf + if false { + } else { + z.F.EncMapUintIntfV(yy777, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintString == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintStringV(x.FMapUintString, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintString`) + r.WriteMapElemValue() + if x.FMapUintString == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintStringV(x.FMapUintString, e) + } + } + } + var yyn782 bool + if x.FptrMapUintString == nil { + yyn782 = true + goto LABEL782 + } + LABEL782: + if yyr2 || yy2arr2 { + if yyn782 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintString == nil { + r.EncodeNil() + } else { + yy783 := *x.FptrMapUintString + if false { + } else { + z.F.EncMapUintStringV(yy783, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintString`) + r.WriteMapElemValue() + if yyn782 { + r.EncodeNil() + } else { + if x.FptrMapUintString == nil { + r.EncodeNil() + } else { + yy785 := *x.FptrMapUintString + if false { + } else { + z.F.EncMapUintStringV(yy785, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintUint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintUintV(x.FMapUintUint, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintUint`) + r.WriteMapElemValue() + if x.FMapUintUint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintUintV(x.FMapUintUint, e) + } + } + } + var yyn790 bool + if x.FptrMapUintUint == nil { + yyn790 = true + goto LABEL790 + } + LABEL790: + if yyr2 || yy2arr2 { + if yyn790 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintUint == nil { + r.EncodeNil() + } else { + yy791 := *x.FptrMapUintUint + if false { + } else { + z.F.EncMapUintUintV(yy791, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintUint`) + r.WriteMapElemValue() + if yyn790 { + r.EncodeNil() + } else { + if x.FptrMapUintUint == nil { + r.EncodeNil() + } else { + yy793 := *x.FptrMapUintUint + if false { + } else { + z.F.EncMapUintUintV(yy793, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintUint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintUint8V(x.FMapUintUint8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintUint8`) + r.WriteMapElemValue() + if x.FMapUintUint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintUint8V(x.FMapUintUint8, e) + } + } + } + var yyn798 bool + if x.FptrMapUintUint8 == nil { + yyn798 = true + goto LABEL798 + } + LABEL798: + if yyr2 || yy2arr2 { + if yyn798 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintUint8 == nil { + r.EncodeNil() + } else { + yy799 := *x.FptrMapUintUint8 + if false { + } else { + z.F.EncMapUintUint8V(yy799, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintUint8`) + r.WriteMapElemValue() + if yyn798 { + r.EncodeNil() + } else { + if x.FptrMapUintUint8 == nil { + r.EncodeNil() + } else { + yy801 := *x.FptrMapUintUint8 + if false { + } else { + z.F.EncMapUintUint8V(yy801, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintUint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintUint16V(x.FMapUintUint16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintUint16`) + r.WriteMapElemValue() + if x.FMapUintUint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintUint16V(x.FMapUintUint16, e) + } + } + } + var yyn806 bool + if x.FptrMapUintUint16 == nil { + yyn806 = true + goto LABEL806 + } + LABEL806: + if yyr2 || yy2arr2 { + if yyn806 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintUint16 == nil { + r.EncodeNil() + } else { + yy807 := *x.FptrMapUintUint16 + if false { + } else { + z.F.EncMapUintUint16V(yy807, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintUint16`) + r.WriteMapElemValue() + if yyn806 { + r.EncodeNil() + } else { + if x.FptrMapUintUint16 == nil { + r.EncodeNil() + } else { + yy809 := *x.FptrMapUintUint16 + if false { + } else { + z.F.EncMapUintUint16V(yy809, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintUint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintUint32V(x.FMapUintUint32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintUint32`) + r.WriteMapElemValue() + if x.FMapUintUint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintUint32V(x.FMapUintUint32, e) + } + } + } + var yyn814 bool + if x.FptrMapUintUint32 == nil { + yyn814 = true + goto LABEL814 + } + LABEL814: + if yyr2 || yy2arr2 { + if yyn814 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintUint32 == nil { + r.EncodeNil() + } else { + yy815 := *x.FptrMapUintUint32 + if false { + } else { + z.F.EncMapUintUint32V(yy815, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintUint32`) + r.WriteMapElemValue() + if yyn814 { + r.EncodeNil() + } else { + if x.FptrMapUintUint32 == nil { + r.EncodeNil() + } else { + yy817 := *x.FptrMapUintUint32 + if false { + } else { + z.F.EncMapUintUint32V(yy817, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintUint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintUint64V(x.FMapUintUint64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintUint64`) + r.WriteMapElemValue() + if x.FMapUintUint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintUint64V(x.FMapUintUint64, e) + } + } + } + var yyn822 bool + if x.FptrMapUintUint64 == nil { + yyn822 = true + goto LABEL822 + } + LABEL822: + if yyr2 || yy2arr2 { + if yyn822 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintUint64 == nil { + r.EncodeNil() + } else { + yy823 := *x.FptrMapUintUint64 + if false { + } else { + z.F.EncMapUintUint64V(yy823, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintUint64`) + r.WriteMapElemValue() + if yyn822 { + r.EncodeNil() + } else { + if x.FptrMapUintUint64 == nil { + r.EncodeNil() + } else { + yy825 := *x.FptrMapUintUint64 + if false { + } else { + z.F.EncMapUintUint64V(yy825, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintUintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintUintptrV(x.FMapUintUintptr, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintUintptr`) + r.WriteMapElemValue() + if x.FMapUintUintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintUintptrV(x.FMapUintUintptr, e) + } + } + } + var yyn830 bool + if x.FptrMapUintUintptr == nil { + yyn830 = true + goto LABEL830 + } + LABEL830: + if yyr2 || yy2arr2 { + if yyn830 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintUintptr == nil { + r.EncodeNil() + } else { + yy831 := *x.FptrMapUintUintptr + if false { + } else { + z.F.EncMapUintUintptrV(yy831, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintUintptr`) + r.WriteMapElemValue() + if yyn830 { + r.EncodeNil() + } else { + if x.FptrMapUintUintptr == nil { + r.EncodeNil() + } else { + yy833 := *x.FptrMapUintUintptr + if false { + } else { + z.F.EncMapUintUintptrV(yy833, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintInt == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintIntV(x.FMapUintInt, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintInt`) + r.WriteMapElemValue() + if x.FMapUintInt == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintIntV(x.FMapUintInt, e) + } + } + } + var yyn838 bool + if x.FptrMapUintInt == nil { + yyn838 = true + goto LABEL838 + } + LABEL838: + if yyr2 || yy2arr2 { + if yyn838 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintInt == nil { + r.EncodeNil() + } else { + yy839 := *x.FptrMapUintInt + if false { + } else { + z.F.EncMapUintIntV(yy839, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintInt`) + r.WriteMapElemValue() + if yyn838 { + r.EncodeNil() + } else { + if x.FptrMapUintInt == nil { + r.EncodeNil() + } else { + yy841 := *x.FptrMapUintInt + if false { + } else { + z.F.EncMapUintIntV(yy841, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintInt8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintInt8V(x.FMapUintInt8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintInt8`) + r.WriteMapElemValue() + if x.FMapUintInt8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintInt8V(x.FMapUintInt8, e) + } + } + } + var yyn846 bool + if x.FptrMapUintInt8 == nil { + yyn846 = true + goto LABEL846 + } + LABEL846: + if yyr2 || yy2arr2 { + if yyn846 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintInt8 == nil { + r.EncodeNil() + } else { + yy847 := *x.FptrMapUintInt8 + if false { + } else { + z.F.EncMapUintInt8V(yy847, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintInt8`) + r.WriteMapElemValue() + if yyn846 { + r.EncodeNil() + } else { + if x.FptrMapUintInt8 == nil { + r.EncodeNil() + } else { + yy849 := *x.FptrMapUintInt8 + if false { + } else { + z.F.EncMapUintInt8V(yy849, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintInt16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintInt16V(x.FMapUintInt16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintInt16`) + r.WriteMapElemValue() + if x.FMapUintInt16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintInt16V(x.FMapUintInt16, e) + } + } + } + var yyn854 bool + if x.FptrMapUintInt16 == nil { + yyn854 = true + goto LABEL854 + } + LABEL854: + if yyr2 || yy2arr2 { + if yyn854 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintInt16 == nil { + r.EncodeNil() + } else { + yy855 := *x.FptrMapUintInt16 + if false { + } else { + z.F.EncMapUintInt16V(yy855, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintInt16`) + r.WriteMapElemValue() + if yyn854 { + r.EncodeNil() + } else { + if x.FptrMapUintInt16 == nil { + r.EncodeNil() + } else { + yy857 := *x.FptrMapUintInt16 + if false { + } else { + z.F.EncMapUintInt16V(yy857, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintInt32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintInt32V(x.FMapUintInt32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintInt32`) + r.WriteMapElemValue() + if x.FMapUintInt32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintInt32V(x.FMapUintInt32, e) + } + } + } + var yyn862 bool + if x.FptrMapUintInt32 == nil { + yyn862 = true + goto LABEL862 + } + LABEL862: + if yyr2 || yy2arr2 { + if yyn862 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintInt32 == nil { + r.EncodeNil() + } else { + yy863 := *x.FptrMapUintInt32 + if false { + } else { + z.F.EncMapUintInt32V(yy863, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintInt32`) + r.WriteMapElemValue() + if yyn862 { + r.EncodeNil() + } else { + if x.FptrMapUintInt32 == nil { + r.EncodeNil() + } else { + yy865 := *x.FptrMapUintInt32 + if false { + } else { + z.F.EncMapUintInt32V(yy865, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintInt64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintInt64V(x.FMapUintInt64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintInt64`) + r.WriteMapElemValue() + if x.FMapUintInt64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintInt64V(x.FMapUintInt64, e) + } + } + } + var yyn870 bool + if x.FptrMapUintInt64 == nil { + yyn870 = true + goto LABEL870 + } + LABEL870: + if yyr2 || yy2arr2 { + if yyn870 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintInt64 == nil { + r.EncodeNil() + } else { + yy871 := *x.FptrMapUintInt64 + if false { + } else { + z.F.EncMapUintInt64V(yy871, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintInt64`) + r.WriteMapElemValue() + if yyn870 { + r.EncodeNil() + } else { + if x.FptrMapUintInt64 == nil { + r.EncodeNil() + } else { + yy873 := *x.FptrMapUintInt64 + if false { + } else { + z.F.EncMapUintInt64V(yy873, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintFloat32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintFloat32V(x.FMapUintFloat32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintFloat32`) + r.WriteMapElemValue() + if x.FMapUintFloat32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintFloat32V(x.FMapUintFloat32, e) + } + } + } + var yyn878 bool + if x.FptrMapUintFloat32 == nil { + yyn878 = true + goto LABEL878 + } + LABEL878: + if yyr2 || yy2arr2 { + if yyn878 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintFloat32 == nil { + r.EncodeNil() + } else { + yy879 := *x.FptrMapUintFloat32 + if false { + } else { + z.F.EncMapUintFloat32V(yy879, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintFloat32`) + r.WriteMapElemValue() + if yyn878 { + r.EncodeNil() + } else { + if x.FptrMapUintFloat32 == nil { + r.EncodeNil() + } else { + yy881 := *x.FptrMapUintFloat32 + if false { + } else { + z.F.EncMapUintFloat32V(yy881, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintFloat64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintFloat64V(x.FMapUintFloat64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintFloat64`) + r.WriteMapElemValue() + if x.FMapUintFloat64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintFloat64V(x.FMapUintFloat64, e) + } + } + } + var yyn886 bool + if x.FptrMapUintFloat64 == nil { + yyn886 = true + goto LABEL886 + } + LABEL886: + if yyr2 || yy2arr2 { + if yyn886 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintFloat64 == nil { + r.EncodeNil() + } else { + yy887 := *x.FptrMapUintFloat64 + if false { + } else { + z.F.EncMapUintFloat64V(yy887, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintFloat64`) + r.WriteMapElemValue() + if yyn886 { + r.EncodeNil() + } else { + if x.FptrMapUintFloat64 == nil { + r.EncodeNil() + } else { + yy889 := *x.FptrMapUintFloat64 + if false { + } else { + z.F.EncMapUintFloat64V(yy889, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintBool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintBoolV(x.FMapUintBool, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintBool`) + r.WriteMapElemValue() + if x.FMapUintBool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintBoolV(x.FMapUintBool, e) + } + } + } + var yyn894 bool + if x.FptrMapUintBool == nil { + yyn894 = true + goto LABEL894 + } + LABEL894: + if yyr2 || yy2arr2 { + if yyn894 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintBool == nil { + r.EncodeNil() + } else { + yy895 := *x.FptrMapUintBool + if false { + } else { + z.F.EncMapUintBoolV(yy895, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintBool`) + r.WriteMapElemValue() + if yyn894 { + r.EncodeNil() + } else { + if x.FptrMapUintBool == nil { + r.EncodeNil() + } else { + yy897 := *x.FptrMapUintBool + if false { + } else { + z.F.EncMapUintBoolV(yy897, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint8Intf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8IntfV(x.FMapUint8Intf, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint8Intf`) + r.WriteMapElemValue() + if x.FMapUint8Intf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8IntfV(x.FMapUint8Intf, e) + } + } + } + var yyn902 bool + if x.FptrMapUint8Intf == nil { + yyn902 = true + goto LABEL902 + } + LABEL902: + if yyr2 || yy2arr2 { + if yyn902 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint8Intf == nil { + r.EncodeNil() + } else { + yy903 := *x.FptrMapUint8Intf + if false { + } else { + z.F.EncMapUint8IntfV(yy903, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Intf`) + r.WriteMapElemValue() + if yyn902 { + r.EncodeNil() + } else { + if x.FptrMapUint8Intf == nil { + r.EncodeNil() + } else { + yy905 := *x.FptrMapUint8Intf + if false { + } else { + z.F.EncMapUint8IntfV(yy905, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint8String == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8StringV(x.FMapUint8String, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint8String`) + r.WriteMapElemValue() + if x.FMapUint8String == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8StringV(x.FMapUint8String, e) + } + } + } + var yyn910 bool + if x.FptrMapUint8String == nil { + yyn910 = true + goto LABEL910 + } + LABEL910: + if yyr2 || yy2arr2 { + if yyn910 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint8String == nil { + r.EncodeNil() + } else { + yy911 := *x.FptrMapUint8String + if false { + } else { + z.F.EncMapUint8StringV(yy911, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8String`) + r.WriteMapElemValue() + if yyn910 { + r.EncodeNil() + } else { + if x.FptrMapUint8String == nil { + r.EncodeNil() + } else { + yy913 := *x.FptrMapUint8String + if false { + } else { + z.F.EncMapUint8StringV(yy913, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint8Uint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8UintV(x.FMapUint8Uint, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint8Uint`) + r.WriteMapElemValue() + if x.FMapUint8Uint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8UintV(x.FMapUint8Uint, e) + } + } + } + var yyn918 bool + if x.FptrMapUint8Uint == nil { + yyn918 = true + goto LABEL918 + } + LABEL918: + if yyr2 || yy2arr2 { + if yyn918 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint8Uint == nil { + r.EncodeNil() + } else { + yy919 := *x.FptrMapUint8Uint + if false { + } else { + z.F.EncMapUint8UintV(yy919, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Uint`) + r.WriteMapElemValue() + if yyn918 { + r.EncodeNil() + } else { + if x.FptrMapUint8Uint == nil { + r.EncodeNil() + } else { + yy921 := *x.FptrMapUint8Uint + if false { + } else { + z.F.EncMapUint8UintV(yy921, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint8Uint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8Uint8V(x.FMapUint8Uint8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint8Uint8`) + r.WriteMapElemValue() + if x.FMapUint8Uint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8Uint8V(x.FMapUint8Uint8, e) + } + } + } + var yyn926 bool + if x.FptrMapUint8Uint8 == nil { + yyn926 = true + goto LABEL926 + } + LABEL926: + if yyr2 || yy2arr2 { + if yyn926 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint8Uint8 == nil { + r.EncodeNil() + } else { + yy927 := *x.FptrMapUint8Uint8 + if false { + } else { + z.F.EncMapUint8Uint8V(yy927, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Uint8`) + r.WriteMapElemValue() + if yyn926 { + r.EncodeNil() + } else { + if x.FptrMapUint8Uint8 == nil { + r.EncodeNil() + } else { + yy929 := *x.FptrMapUint8Uint8 + if false { + } else { + z.F.EncMapUint8Uint8V(yy929, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint8Uint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8Uint16V(x.FMapUint8Uint16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint8Uint16`) + r.WriteMapElemValue() + if x.FMapUint8Uint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8Uint16V(x.FMapUint8Uint16, e) + } + } + } + var yyn934 bool + if x.FptrMapUint8Uint16 == nil { + yyn934 = true + goto LABEL934 + } + LABEL934: + if yyr2 || yy2arr2 { + if yyn934 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint8Uint16 == nil { + r.EncodeNil() + } else { + yy935 := *x.FptrMapUint8Uint16 + if false { + } else { + z.F.EncMapUint8Uint16V(yy935, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Uint16`) + r.WriteMapElemValue() + if yyn934 { + r.EncodeNil() + } else { + if x.FptrMapUint8Uint16 == nil { + r.EncodeNil() + } else { + yy937 := *x.FptrMapUint8Uint16 + if false { + } else { + z.F.EncMapUint8Uint16V(yy937, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint8Uint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8Uint32V(x.FMapUint8Uint32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint8Uint32`) + r.WriteMapElemValue() + if x.FMapUint8Uint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8Uint32V(x.FMapUint8Uint32, e) + } + } + } + var yyn942 bool + if x.FptrMapUint8Uint32 == nil { + yyn942 = true + goto LABEL942 + } + LABEL942: + if yyr2 || yy2arr2 { + if yyn942 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint8Uint32 == nil { + r.EncodeNil() + } else { + yy943 := *x.FptrMapUint8Uint32 + if false { + } else { + z.F.EncMapUint8Uint32V(yy943, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Uint32`) + r.WriteMapElemValue() + if yyn942 { + r.EncodeNil() + } else { + if x.FptrMapUint8Uint32 == nil { + r.EncodeNil() + } else { + yy945 := *x.FptrMapUint8Uint32 + if false { + } else { + z.F.EncMapUint8Uint32V(yy945, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint8Uint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8Uint64V(x.FMapUint8Uint64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint8Uint64`) + r.WriteMapElemValue() + if x.FMapUint8Uint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8Uint64V(x.FMapUint8Uint64, e) + } + } + } + var yyn950 bool + if x.FptrMapUint8Uint64 == nil { + yyn950 = true + goto LABEL950 + } + LABEL950: + if yyr2 || yy2arr2 { + if yyn950 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint8Uint64 == nil { + r.EncodeNil() + } else { + yy951 := *x.FptrMapUint8Uint64 + if false { + } else { + z.F.EncMapUint8Uint64V(yy951, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Uint64`) + r.WriteMapElemValue() + if yyn950 { + r.EncodeNil() + } else { + if x.FptrMapUint8Uint64 == nil { + r.EncodeNil() + } else { + yy953 := *x.FptrMapUint8Uint64 + if false { + } else { + z.F.EncMapUint8Uint64V(yy953, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint8Uintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8UintptrV(x.FMapUint8Uintptr, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint8Uintptr`) + r.WriteMapElemValue() + if x.FMapUint8Uintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8UintptrV(x.FMapUint8Uintptr, e) + } + } + } + var yyn958 bool + if x.FptrMapUint8Uintptr == nil { + yyn958 = true + goto LABEL958 + } + LABEL958: + if yyr2 || yy2arr2 { + if yyn958 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint8Uintptr == nil { + r.EncodeNil() + } else { + yy959 := *x.FptrMapUint8Uintptr + if false { + } else { + z.F.EncMapUint8UintptrV(yy959, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Uintptr`) + r.WriteMapElemValue() + if yyn958 { + r.EncodeNil() + } else { + if x.FptrMapUint8Uintptr == nil { + r.EncodeNil() + } else { + yy961 := *x.FptrMapUint8Uintptr + if false { + } else { + z.F.EncMapUint8UintptrV(yy961, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint8Int == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8IntV(x.FMapUint8Int, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint8Int`) + r.WriteMapElemValue() + if x.FMapUint8Int == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8IntV(x.FMapUint8Int, e) + } + } + } + var yyn966 bool + if x.FptrMapUint8Int == nil { + yyn966 = true + goto LABEL966 + } + LABEL966: + if yyr2 || yy2arr2 { + if yyn966 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint8Int == nil { + r.EncodeNil() + } else { + yy967 := *x.FptrMapUint8Int + if false { + } else { + z.F.EncMapUint8IntV(yy967, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Int`) + r.WriteMapElemValue() + if yyn966 { + r.EncodeNil() + } else { + if x.FptrMapUint8Int == nil { + r.EncodeNil() + } else { + yy969 := *x.FptrMapUint8Int + if false { + } else { + z.F.EncMapUint8IntV(yy969, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint8Int8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8Int8V(x.FMapUint8Int8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint8Int8`) + r.WriteMapElemValue() + if x.FMapUint8Int8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8Int8V(x.FMapUint8Int8, e) + } + } + } + var yyn974 bool + if x.FptrMapUint8Int8 == nil { + yyn974 = true + goto LABEL974 + } + LABEL974: + if yyr2 || yy2arr2 { + if yyn974 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint8Int8 == nil { + r.EncodeNil() + } else { + yy975 := *x.FptrMapUint8Int8 + if false { + } else { + z.F.EncMapUint8Int8V(yy975, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Int8`) + r.WriteMapElemValue() + if yyn974 { + r.EncodeNil() + } else { + if x.FptrMapUint8Int8 == nil { + r.EncodeNil() + } else { + yy977 := *x.FptrMapUint8Int8 + if false { + } else { + z.F.EncMapUint8Int8V(yy977, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint8Int16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8Int16V(x.FMapUint8Int16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint8Int16`) + r.WriteMapElemValue() + if x.FMapUint8Int16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8Int16V(x.FMapUint8Int16, e) + } + } + } + var yyn982 bool + if x.FptrMapUint8Int16 == nil { + yyn982 = true + goto LABEL982 + } + LABEL982: + if yyr2 || yy2arr2 { + if yyn982 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint8Int16 == nil { + r.EncodeNil() + } else { + yy983 := *x.FptrMapUint8Int16 + if false { + } else { + z.F.EncMapUint8Int16V(yy983, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Int16`) + r.WriteMapElemValue() + if yyn982 { + r.EncodeNil() + } else { + if x.FptrMapUint8Int16 == nil { + r.EncodeNil() + } else { + yy985 := *x.FptrMapUint8Int16 + if false { + } else { + z.F.EncMapUint8Int16V(yy985, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint8Int32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8Int32V(x.FMapUint8Int32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint8Int32`) + r.WriteMapElemValue() + if x.FMapUint8Int32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8Int32V(x.FMapUint8Int32, e) + } + } + } + var yyn990 bool + if x.FptrMapUint8Int32 == nil { + yyn990 = true + goto LABEL990 + } + LABEL990: + if yyr2 || yy2arr2 { + if yyn990 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint8Int32 == nil { + r.EncodeNil() + } else { + yy991 := *x.FptrMapUint8Int32 + if false { + } else { + z.F.EncMapUint8Int32V(yy991, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Int32`) + r.WriteMapElemValue() + if yyn990 { + r.EncodeNil() + } else { + if x.FptrMapUint8Int32 == nil { + r.EncodeNil() + } else { + yy993 := *x.FptrMapUint8Int32 + if false { + } else { + z.F.EncMapUint8Int32V(yy993, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint8Int64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8Int64V(x.FMapUint8Int64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint8Int64`) + r.WriteMapElemValue() + if x.FMapUint8Int64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8Int64V(x.FMapUint8Int64, e) + } + } + } + var yyn998 bool + if x.FptrMapUint8Int64 == nil { + yyn998 = true + goto LABEL998 + } + LABEL998: + if yyr2 || yy2arr2 { + if yyn998 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint8Int64 == nil { + r.EncodeNil() + } else { + yy999 := *x.FptrMapUint8Int64 + if false { + } else { + z.F.EncMapUint8Int64V(yy999, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Int64`) + r.WriteMapElemValue() + if yyn998 { + r.EncodeNil() + } else { + if x.FptrMapUint8Int64 == nil { + r.EncodeNil() + } else { + yy1001 := *x.FptrMapUint8Int64 + if false { + } else { + z.F.EncMapUint8Int64V(yy1001, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint8Float32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8Float32V(x.FMapUint8Float32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint8Float32`) + r.WriteMapElemValue() + if x.FMapUint8Float32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8Float32V(x.FMapUint8Float32, e) + } + } + } + var yyn1006 bool + if x.FptrMapUint8Float32 == nil { + yyn1006 = true + goto LABEL1006 + } + LABEL1006: + if yyr2 || yy2arr2 { + if yyn1006 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint8Float32 == nil { + r.EncodeNil() + } else { + yy1007 := *x.FptrMapUint8Float32 + if false { + } else { + z.F.EncMapUint8Float32V(yy1007, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Float32`) + r.WriteMapElemValue() + if yyn1006 { + r.EncodeNil() + } else { + if x.FptrMapUint8Float32 == nil { + r.EncodeNil() + } else { + yy1009 := *x.FptrMapUint8Float32 + if false { + } else { + z.F.EncMapUint8Float32V(yy1009, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint8Float64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8Float64V(x.FMapUint8Float64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint8Float64`) + r.WriteMapElemValue() + if x.FMapUint8Float64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8Float64V(x.FMapUint8Float64, e) + } + } + } + var yyn1014 bool + if x.FptrMapUint8Float64 == nil { + yyn1014 = true + goto LABEL1014 + } + LABEL1014: + if yyr2 || yy2arr2 { + if yyn1014 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint8Float64 == nil { + r.EncodeNil() + } else { + yy1015 := *x.FptrMapUint8Float64 + if false { + } else { + z.F.EncMapUint8Float64V(yy1015, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Float64`) + r.WriteMapElemValue() + if yyn1014 { + r.EncodeNil() + } else { + if x.FptrMapUint8Float64 == nil { + r.EncodeNil() + } else { + yy1017 := *x.FptrMapUint8Float64 + if false { + } else { + z.F.EncMapUint8Float64V(yy1017, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint8Bool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8BoolV(x.FMapUint8Bool, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint8Bool`) + r.WriteMapElemValue() + if x.FMapUint8Bool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint8BoolV(x.FMapUint8Bool, e) + } + } + } + var yyn1022 bool + if x.FptrMapUint8Bool == nil { + yyn1022 = true + goto LABEL1022 + } + LABEL1022: + if yyr2 || yy2arr2 { + if yyn1022 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint8Bool == nil { + r.EncodeNil() + } else { + yy1023 := *x.FptrMapUint8Bool + if false { + } else { + z.F.EncMapUint8BoolV(yy1023, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint8Bool`) + r.WriteMapElemValue() + if yyn1022 { + r.EncodeNil() + } else { + if x.FptrMapUint8Bool == nil { + r.EncodeNil() + } else { + yy1025 := *x.FptrMapUint8Bool + if false { + } else { + z.F.EncMapUint8BoolV(yy1025, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint16Intf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16IntfV(x.FMapUint16Intf, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint16Intf`) + r.WriteMapElemValue() + if x.FMapUint16Intf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16IntfV(x.FMapUint16Intf, e) + } + } + } + var yyn1030 bool + if x.FptrMapUint16Intf == nil { + yyn1030 = true + goto LABEL1030 + } + LABEL1030: + if yyr2 || yy2arr2 { + if yyn1030 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint16Intf == nil { + r.EncodeNil() + } else { + yy1031 := *x.FptrMapUint16Intf + if false { + } else { + z.F.EncMapUint16IntfV(yy1031, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Intf`) + r.WriteMapElemValue() + if yyn1030 { + r.EncodeNil() + } else { + if x.FptrMapUint16Intf == nil { + r.EncodeNil() + } else { + yy1033 := *x.FptrMapUint16Intf + if false { + } else { + z.F.EncMapUint16IntfV(yy1033, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint16String == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16StringV(x.FMapUint16String, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint16String`) + r.WriteMapElemValue() + if x.FMapUint16String == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16StringV(x.FMapUint16String, e) + } + } + } + var yyn1038 bool + if x.FptrMapUint16String == nil { + yyn1038 = true + goto LABEL1038 + } + LABEL1038: + if yyr2 || yy2arr2 { + if yyn1038 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint16String == nil { + r.EncodeNil() + } else { + yy1039 := *x.FptrMapUint16String + if false { + } else { + z.F.EncMapUint16StringV(yy1039, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16String`) + r.WriteMapElemValue() + if yyn1038 { + r.EncodeNil() + } else { + if x.FptrMapUint16String == nil { + r.EncodeNil() + } else { + yy1041 := *x.FptrMapUint16String + if false { + } else { + z.F.EncMapUint16StringV(yy1041, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint16Uint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16UintV(x.FMapUint16Uint, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint16Uint`) + r.WriteMapElemValue() + if x.FMapUint16Uint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16UintV(x.FMapUint16Uint, e) + } + } + } + var yyn1046 bool + if x.FptrMapUint16Uint == nil { + yyn1046 = true + goto LABEL1046 + } + LABEL1046: + if yyr2 || yy2arr2 { + if yyn1046 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint16Uint == nil { + r.EncodeNil() + } else { + yy1047 := *x.FptrMapUint16Uint + if false { + } else { + z.F.EncMapUint16UintV(yy1047, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Uint`) + r.WriteMapElemValue() + if yyn1046 { + r.EncodeNil() + } else { + if x.FptrMapUint16Uint == nil { + r.EncodeNil() + } else { + yy1049 := *x.FptrMapUint16Uint + if false { + } else { + z.F.EncMapUint16UintV(yy1049, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint16Uint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16Uint8V(x.FMapUint16Uint8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint16Uint8`) + r.WriteMapElemValue() + if x.FMapUint16Uint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16Uint8V(x.FMapUint16Uint8, e) + } + } + } + var yyn1054 bool + if x.FptrMapUint16Uint8 == nil { + yyn1054 = true + goto LABEL1054 + } + LABEL1054: + if yyr2 || yy2arr2 { + if yyn1054 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint16Uint8 == nil { + r.EncodeNil() + } else { + yy1055 := *x.FptrMapUint16Uint8 + if false { + } else { + z.F.EncMapUint16Uint8V(yy1055, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Uint8`) + r.WriteMapElemValue() + if yyn1054 { + r.EncodeNil() + } else { + if x.FptrMapUint16Uint8 == nil { + r.EncodeNil() + } else { + yy1057 := *x.FptrMapUint16Uint8 + if false { + } else { + z.F.EncMapUint16Uint8V(yy1057, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint16Uint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16Uint16V(x.FMapUint16Uint16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint16Uint16`) + r.WriteMapElemValue() + if x.FMapUint16Uint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16Uint16V(x.FMapUint16Uint16, e) + } + } + } + var yyn1062 bool + if x.FptrMapUint16Uint16 == nil { + yyn1062 = true + goto LABEL1062 + } + LABEL1062: + if yyr2 || yy2arr2 { + if yyn1062 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint16Uint16 == nil { + r.EncodeNil() + } else { + yy1063 := *x.FptrMapUint16Uint16 + if false { + } else { + z.F.EncMapUint16Uint16V(yy1063, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Uint16`) + r.WriteMapElemValue() + if yyn1062 { + r.EncodeNil() + } else { + if x.FptrMapUint16Uint16 == nil { + r.EncodeNil() + } else { + yy1065 := *x.FptrMapUint16Uint16 + if false { + } else { + z.F.EncMapUint16Uint16V(yy1065, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint16Uint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16Uint32V(x.FMapUint16Uint32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint16Uint32`) + r.WriteMapElemValue() + if x.FMapUint16Uint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16Uint32V(x.FMapUint16Uint32, e) + } + } + } + var yyn1070 bool + if x.FptrMapUint16Uint32 == nil { + yyn1070 = true + goto LABEL1070 + } + LABEL1070: + if yyr2 || yy2arr2 { + if yyn1070 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint16Uint32 == nil { + r.EncodeNil() + } else { + yy1071 := *x.FptrMapUint16Uint32 + if false { + } else { + z.F.EncMapUint16Uint32V(yy1071, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Uint32`) + r.WriteMapElemValue() + if yyn1070 { + r.EncodeNil() + } else { + if x.FptrMapUint16Uint32 == nil { + r.EncodeNil() + } else { + yy1073 := *x.FptrMapUint16Uint32 + if false { + } else { + z.F.EncMapUint16Uint32V(yy1073, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint16Uint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16Uint64V(x.FMapUint16Uint64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint16Uint64`) + r.WriteMapElemValue() + if x.FMapUint16Uint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16Uint64V(x.FMapUint16Uint64, e) + } + } + } + var yyn1078 bool + if x.FptrMapUint16Uint64 == nil { + yyn1078 = true + goto LABEL1078 + } + LABEL1078: + if yyr2 || yy2arr2 { + if yyn1078 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint16Uint64 == nil { + r.EncodeNil() + } else { + yy1079 := *x.FptrMapUint16Uint64 + if false { + } else { + z.F.EncMapUint16Uint64V(yy1079, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Uint64`) + r.WriteMapElemValue() + if yyn1078 { + r.EncodeNil() + } else { + if x.FptrMapUint16Uint64 == nil { + r.EncodeNil() + } else { + yy1081 := *x.FptrMapUint16Uint64 + if false { + } else { + z.F.EncMapUint16Uint64V(yy1081, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint16Uintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16UintptrV(x.FMapUint16Uintptr, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint16Uintptr`) + r.WriteMapElemValue() + if x.FMapUint16Uintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16UintptrV(x.FMapUint16Uintptr, e) + } + } + } + var yyn1086 bool + if x.FptrMapUint16Uintptr == nil { + yyn1086 = true + goto LABEL1086 + } + LABEL1086: + if yyr2 || yy2arr2 { + if yyn1086 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint16Uintptr == nil { + r.EncodeNil() + } else { + yy1087 := *x.FptrMapUint16Uintptr + if false { + } else { + z.F.EncMapUint16UintptrV(yy1087, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Uintptr`) + r.WriteMapElemValue() + if yyn1086 { + r.EncodeNil() + } else { + if x.FptrMapUint16Uintptr == nil { + r.EncodeNil() + } else { + yy1089 := *x.FptrMapUint16Uintptr + if false { + } else { + z.F.EncMapUint16UintptrV(yy1089, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint16Int == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16IntV(x.FMapUint16Int, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint16Int`) + r.WriteMapElemValue() + if x.FMapUint16Int == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16IntV(x.FMapUint16Int, e) + } + } + } + var yyn1094 bool + if x.FptrMapUint16Int == nil { + yyn1094 = true + goto LABEL1094 + } + LABEL1094: + if yyr2 || yy2arr2 { + if yyn1094 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint16Int == nil { + r.EncodeNil() + } else { + yy1095 := *x.FptrMapUint16Int + if false { + } else { + z.F.EncMapUint16IntV(yy1095, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Int`) + r.WriteMapElemValue() + if yyn1094 { + r.EncodeNil() + } else { + if x.FptrMapUint16Int == nil { + r.EncodeNil() + } else { + yy1097 := *x.FptrMapUint16Int + if false { + } else { + z.F.EncMapUint16IntV(yy1097, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint16Int8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16Int8V(x.FMapUint16Int8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint16Int8`) + r.WriteMapElemValue() + if x.FMapUint16Int8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16Int8V(x.FMapUint16Int8, e) + } + } + } + var yyn1102 bool + if x.FptrMapUint16Int8 == nil { + yyn1102 = true + goto LABEL1102 + } + LABEL1102: + if yyr2 || yy2arr2 { + if yyn1102 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint16Int8 == nil { + r.EncodeNil() + } else { + yy1103 := *x.FptrMapUint16Int8 + if false { + } else { + z.F.EncMapUint16Int8V(yy1103, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Int8`) + r.WriteMapElemValue() + if yyn1102 { + r.EncodeNil() + } else { + if x.FptrMapUint16Int8 == nil { + r.EncodeNil() + } else { + yy1105 := *x.FptrMapUint16Int8 + if false { + } else { + z.F.EncMapUint16Int8V(yy1105, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint16Int16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16Int16V(x.FMapUint16Int16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint16Int16`) + r.WriteMapElemValue() + if x.FMapUint16Int16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16Int16V(x.FMapUint16Int16, e) + } + } + } + var yyn1110 bool + if x.FptrMapUint16Int16 == nil { + yyn1110 = true + goto LABEL1110 + } + LABEL1110: + if yyr2 || yy2arr2 { + if yyn1110 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint16Int16 == nil { + r.EncodeNil() + } else { + yy1111 := *x.FptrMapUint16Int16 + if false { + } else { + z.F.EncMapUint16Int16V(yy1111, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Int16`) + r.WriteMapElemValue() + if yyn1110 { + r.EncodeNil() + } else { + if x.FptrMapUint16Int16 == nil { + r.EncodeNil() + } else { + yy1113 := *x.FptrMapUint16Int16 + if false { + } else { + z.F.EncMapUint16Int16V(yy1113, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint16Int32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16Int32V(x.FMapUint16Int32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint16Int32`) + r.WriteMapElemValue() + if x.FMapUint16Int32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16Int32V(x.FMapUint16Int32, e) + } + } + } + var yyn1118 bool + if x.FptrMapUint16Int32 == nil { + yyn1118 = true + goto LABEL1118 + } + LABEL1118: + if yyr2 || yy2arr2 { + if yyn1118 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint16Int32 == nil { + r.EncodeNil() + } else { + yy1119 := *x.FptrMapUint16Int32 + if false { + } else { + z.F.EncMapUint16Int32V(yy1119, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Int32`) + r.WriteMapElemValue() + if yyn1118 { + r.EncodeNil() + } else { + if x.FptrMapUint16Int32 == nil { + r.EncodeNil() + } else { + yy1121 := *x.FptrMapUint16Int32 + if false { + } else { + z.F.EncMapUint16Int32V(yy1121, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint16Int64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16Int64V(x.FMapUint16Int64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint16Int64`) + r.WriteMapElemValue() + if x.FMapUint16Int64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16Int64V(x.FMapUint16Int64, e) + } + } + } + var yyn1126 bool + if x.FptrMapUint16Int64 == nil { + yyn1126 = true + goto LABEL1126 + } + LABEL1126: + if yyr2 || yy2arr2 { + if yyn1126 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint16Int64 == nil { + r.EncodeNil() + } else { + yy1127 := *x.FptrMapUint16Int64 + if false { + } else { + z.F.EncMapUint16Int64V(yy1127, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Int64`) + r.WriteMapElemValue() + if yyn1126 { + r.EncodeNil() + } else { + if x.FptrMapUint16Int64 == nil { + r.EncodeNil() + } else { + yy1129 := *x.FptrMapUint16Int64 + if false { + } else { + z.F.EncMapUint16Int64V(yy1129, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint16Float32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16Float32V(x.FMapUint16Float32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint16Float32`) + r.WriteMapElemValue() + if x.FMapUint16Float32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16Float32V(x.FMapUint16Float32, e) + } + } + } + var yyn1134 bool + if x.FptrMapUint16Float32 == nil { + yyn1134 = true + goto LABEL1134 + } + LABEL1134: + if yyr2 || yy2arr2 { + if yyn1134 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint16Float32 == nil { + r.EncodeNil() + } else { + yy1135 := *x.FptrMapUint16Float32 + if false { + } else { + z.F.EncMapUint16Float32V(yy1135, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Float32`) + r.WriteMapElemValue() + if yyn1134 { + r.EncodeNil() + } else { + if x.FptrMapUint16Float32 == nil { + r.EncodeNil() + } else { + yy1137 := *x.FptrMapUint16Float32 + if false { + } else { + z.F.EncMapUint16Float32V(yy1137, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint16Float64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16Float64V(x.FMapUint16Float64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint16Float64`) + r.WriteMapElemValue() + if x.FMapUint16Float64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16Float64V(x.FMapUint16Float64, e) + } + } + } + var yyn1142 bool + if x.FptrMapUint16Float64 == nil { + yyn1142 = true + goto LABEL1142 + } + LABEL1142: + if yyr2 || yy2arr2 { + if yyn1142 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint16Float64 == nil { + r.EncodeNil() + } else { + yy1143 := *x.FptrMapUint16Float64 + if false { + } else { + z.F.EncMapUint16Float64V(yy1143, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Float64`) + r.WriteMapElemValue() + if yyn1142 { + r.EncodeNil() + } else { + if x.FptrMapUint16Float64 == nil { + r.EncodeNil() + } else { + yy1145 := *x.FptrMapUint16Float64 + if false { + } else { + z.F.EncMapUint16Float64V(yy1145, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint16Bool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16BoolV(x.FMapUint16Bool, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint16Bool`) + r.WriteMapElemValue() + if x.FMapUint16Bool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint16BoolV(x.FMapUint16Bool, e) + } + } + } + var yyn1150 bool + if x.FptrMapUint16Bool == nil { + yyn1150 = true + goto LABEL1150 + } + LABEL1150: + if yyr2 || yy2arr2 { + if yyn1150 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint16Bool == nil { + r.EncodeNil() + } else { + yy1151 := *x.FptrMapUint16Bool + if false { + } else { + z.F.EncMapUint16BoolV(yy1151, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint16Bool`) + r.WriteMapElemValue() + if yyn1150 { + r.EncodeNil() + } else { + if x.FptrMapUint16Bool == nil { + r.EncodeNil() + } else { + yy1153 := *x.FptrMapUint16Bool + if false { + } else { + z.F.EncMapUint16BoolV(yy1153, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint32Intf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32IntfV(x.FMapUint32Intf, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint32Intf`) + r.WriteMapElemValue() + if x.FMapUint32Intf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32IntfV(x.FMapUint32Intf, e) + } + } + } + var yyn1158 bool + if x.FptrMapUint32Intf == nil { + yyn1158 = true + goto LABEL1158 + } + LABEL1158: + if yyr2 || yy2arr2 { + if yyn1158 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint32Intf == nil { + r.EncodeNil() + } else { + yy1159 := *x.FptrMapUint32Intf + if false { + } else { + z.F.EncMapUint32IntfV(yy1159, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Intf`) + r.WriteMapElemValue() + if yyn1158 { + r.EncodeNil() + } else { + if x.FptrMapUint32Intf == nil { + r.EncodeNil() + } else { + yy1161 := *x.FptrMapUint32Intf + if false { + } else { + z.F.EncMapUint32IntfV(yy1161, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint32String == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32StringV(x.FMapUint32String, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint32String`) + r.WriteMapElemValue() + if x.FMapUint32String == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32StringV(x.FMapUint32String, e) + } + } + } + var yyn1166 bool + if x.FptrMapUint32String == nil { + yyn1166 = true + goto LABEL1166 + } + LABEL1166: + if yyr2 || yy2arr2 { + if yyn1166 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint32String == nil { + r.EncodeNil() + } else { + yy1167 := *x.FptrMapUint32String + if false { + } else { + z.F.EncMapUint32StringV(yy1167, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32String`) + r.WriteMapElemValue() + if yyn1166 { + r.EncodeNil() + } else { + if x.FptrMapUint32String == nil { + r.EncodeNil() + } else { + yy1169 := *x.FptrMapUint32String + if false { + } else { + z.F.EncMapUint32StringV(yy1169, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint32Uint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32UintV(x.FMapUint32Uint, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint32Uint`) + r.WriteMapElemValue() + if x.FMapUint32Uint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32UintV(x.FMapUint32Uint, e) + } + } + } + var yyn1174 bool + if x.FptrMapUint32Uint == nil { + yyn1174 = true + goto LABEL1174 + } + LABEL1174: + if yyr2 || yy2arr2 { + if yyn1174 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint32Uint == nil { + r.EncodeNil() + } else { + yy1175 := *x.FptrMapUint32Uint + if false { + } else { + z.F.EncMapUint32UintV(yy1175, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Uint`) + r.WriteMapElemValue() + if yyn1174 { + r.EncodeNil() + } else { + if x.FptrMapUint32Uint == nil { + r.EncodeNil() + } else { + yy1177 := *x.FptrMapUint32Uint + if false { + } else { + z.F.EncMapUint32UintV(yy1177, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint32Uint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32Uint8V(x.FMapUint32Uint8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint32Uint8`) + r.WriteMapElemValue() + if x.FMapUint32Uint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32Uint8V(x.FMapUint32Uint8, e) + } + } + } + var yyn1182 bool + if x.FptrMapUint32Uint8 == nil { + yyn1182 = true + goto LABEL1182 + } + LABEL1182: + if yyr2 || yy2arr2 { + if yyn1182 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint32Uint8 == nil { + r.EncodeNil() + } else { + yy1183 := *x.FptrMapUint32Uint8 + if false { + } else { + z.F.EncMapUint32Uint8V(yy1183, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Uint8`) + r.WriteMapElemValue() + if yyn1182 { + r.EncodeNil() + } else { + if x.FptrMapUint32Uint8 == nil { + r.EncodeNil() + } else { + yy1185 := *x.FptrMapUint32Uint8 + if false { + } else { + z.F.EncMapUint32Uint8V(yy1185, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint32Uint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32Uint16V(x.FMapUint32Uint16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint32Uint16`) + r.WriteMapElemValue() + if x.FMapUint32Uint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32Uint16V(x.FMapUint32Uint16, e) + } + } + } + var yyn1190 bool + if x.FptrMapUint32Uint16 == nil { + yyn1190 = true + goto LABEL1190 + } + LABEL1190: + if yyr2 || yy2arr2 { + if yyn1190 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint32Uint16 == nil { + r.EncodeNil() + } else { + yy1191 := *x.FptrMapUint32Uint16 + if false { + } else { + z.F.EncMapUint32Uint16V(yy1191, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Uint16`) + r.WriteMapElemValue() + if yyn1190 { + r.EncodeNil() + } else { + if x.FptrMapUint32Uint16 == nil { + r.EncodeNil() + } else { + yy1193 := *x.FptrMapUint32Uint16 + if false { + } else { + z.F.EncMapUint32Uint16V(yy1193, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint32Uint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32Uint32V(x.FMapUint32Uint32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint32Uint32`) + r.WriteMapElemValue() + if x.FMapUint32Uint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32Uint32V(x.FMapUint32Uint32, e) + } + } + } + var yyn1198 bool + if x.FptrMapUint32Uint32 == nil { + yyn1198 = true + goto LABEL1198 + } + LABEL1198: + if yyr2 || yy2arr2 { + if yyn1198 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint32Uint32 == nil { + r.EncodeNil() + } else { + yy1199 := *x.FptrMapUint32Uint32 + if false { + } else { + z.F.EncMapUint32Uint32V(yy1199, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Uint32`) + r.WriteMapElemValue() + if yyn1198 { + r.EncodeNil() + } else { + if x.FptrMapUint32Uint32 == nil { + r.EncodeNil() + } else { + yy1201 := *x.FptrMapUint32Uint32 + if false { + } else { + z.F.EncMapUint32Uint32V(yy1201, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint32Uint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32Uint64V(x.FMapUint32Uint64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint32Uint64`) + r.WriteMapElemValue() + if x.FMapUint32Uint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32Uint64V(x.FMapUint32Uint64, e) + } + } + } + var yyn1206 bool + if x.FptrMapUint32Uint64 == nil { + yyn1206 = true + goto LABEL1206 + } + LABEL1206: + if yyr2 || yy2arr2 { + if yyn1206 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint32Uint64 == nil { + r.EncodeNil() + } else { + yy1207 := *x.FptrMapUint32Uint64 + if false { + } else { + z.F.EncMapUint32Uint64V(yy1207, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Uint64`) + r.WriteMapElemValue() + if yyn1206 { + r.EncodeNil() + } else { + if x.FptrMapUint32Uint64 == nil { + r.EncodeNil() + } else { + yy1209 := *x.FptrMapUint32Uint64 + if false { + } else { + z.F.EncMapUint32Uint64V(yy1209, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint32Uintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32UintptrV(x.FMapUint32Uintptr, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint32Uintptr`) + r.WriteMapElemValue() + if x.FMapUint32Uintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32UintptrV(x.FMapUint32Uintptr, e) + } + } + } + var yyn1214 bool + if x.FptrMapUint32Uintptr == nil { + yyn1214 = true + goto LABEL1214 + } + LABEL1214: + if yyr2 || yy2arr2 { + if yyn1214 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint32Uintptr == nil { + r.EncodeNil() + } else { + yy1215 := *x.FptrMapUint32Uintptr + if false { + } else { + z.F.EncMapUint32UintptrV(yy1215, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Uintptr`) + r.WriteMapElemValue() + if yyn1214 { + r.EncodeNil() + } else { + if x.FptrMapUint32Uintptr == nil { + r.EncodeNil() + } else { + yy1217 := *x.FptrMapUint32Uintptr + if false { + } else { + z.F.EncMapUint32UintptrV(yy1217, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint32Int == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32IntV(x.FMapUint32Int, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint32Int`) + r.WriteMapElemValue() + if x.FMapUint32Int == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32IntV(x.FMapUint32Int, e) + } + } + } + var yyn1222 bool + if x.FptrMapUint32Int == nil { + yyn1222 = true + goto LABEL1222 + } + LABEL1222: + if yyr2 || yy2arr2 { + if yyn1222 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint32Int == nil { + r.EncodeNil() + } else { + yy1223 := *x.FptrMapUint32Int + if false { + } else { + z.F.EncMapUint32IntV(yy1223, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Int`) + r.WriteMapElemValue() + if yyn1222 { + r.EncodeNil() + } else { + if x.FptrMapUint32Int == nil { + r.EncodeNil() + } else { + yy1225 := *x.FptrMapUint32Int + if false { + } else { + z.F.EncMapUint32IntV(yy1225, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint32Int8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32Int8V(x.FMapUint32Int8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint32Int8`) + r.WriteMapElemValue() + if x.FMapUint32Int8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32Int8V(x.FMapUint32Int8, e) + } + } + } + var yyn1230 bool + if x.FptrMapUint32Int8 == nil { + yyn1230 = true + goto LABEL1230 + } + LABEL1230: + if yyr2 || yy2arr2 { + if yyn1230 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint32Int8 == nil { + r.EncodeNil() + } else { + yy1231 := *x.FptrMapUint32Int8 + if false { + } else { + z.F.EncMapUint32Int8V(yy1231, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Int8`) + r.WriteMapElemValue() + if yyn1230 { + r.EncodeNil() + } else { + if x.FptrMapUint32Int8 == nil { + r.EncodeNil() + } else { + yy1233 := *x.FptrMapUint32Int8 + if false { + } else { + z.F.EncMapUint32Int8V(yy1233, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint32Int16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32Int16V(x.FMapUint32Int16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint32Int16`) + r.WriteMapElemValue() + if x.FMapUint32Int16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32Int16V(x.FMapUint32Int16, e) + } + } + } + var yyn1238 bool + if x.FptrMapUint32Int16 == nil { + yyn1238 = true + goto LABEL1238 + } + LABEL1238: + if yyr2 || yy2arr2 { + if yyn1238 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint32Int16 == nil { + r.EncodeNil() + } else { + yy1239 := *x.FptrMapUint32Int16 + if false { + } else { + z.F.EncMapUint32Int16V(yy1239, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Int16`) + r.WriteMapElemValue() + if yyn1238 { + r.EncodeNil() + } else { + if x.FptrMapUint32Int16 == nil { + r.EncodeNil() + } else { + yy1241 := *x.FptrMapUint32Int16 + if false { + } else { + z.F.EncMapUint32Int16V(yy1241, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint32Int32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32Int32V(x.FMapUint32Int32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint32Int32`) + r.WriteMapElemValue() + if x.FMapUint32Int32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32Int32V(x.FMapUint32Int32, e) + } + } + } + var yyn1246 bool + if x.FptrMapUint32Int32 == nil { + yyn1246 = true + goto LABEL1246 + } + LABEL1246: + if yyr2 || yy2arr2 { + if yyn1246 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint32Int32 == nil { + r.EncodeNil() + } else { + yy1247 := *x.FptrMapUint32Int32 + if false { + } else { + z.F.EncMapUint32Int32V(yy1247, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Int32`) + r.WriteMapElemValue() + if yyn1246 { + r.EncodeNil() + } else { + if x.FptrMapUint32Int32 == nil { + r.EncodeNil() + } else { + yy1249 := *x.FptrMapUint32Int32 + if false { + } else { + z.F.EncMapUint32Int32V(yy1249, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint32Int64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32Int64V(x.FMapUint32Int64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint32Int64`) + r.WriteMapElemValue() + if x.FMapUint32Int64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32Int64V(x.FMapUint32Int64, e) + } + } + } + var yyn1254 bool + if x.FptrMapUint32Int64 == nil { + yyn1254 = true + goto LABEL1254 + } + LABEL1254: + if yyr2 || yy2arr2 { + if yyn1254 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint32Int64 == nil { + r.EncodeNil() + } else { + yy1255 := *x.FptrMapUint32Int64 + if false { + } else { + z.F.EncMapUint32Int64V(yy1255, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Int64`) + r.WriteMapElemValue() + if yyn1254 { + r.EncodeNil() + } else { + if x.FptrMapUint32Int64 == nil { + r.EncodeNil() + } else { + yy1257 := *x.FptrMapUint32Int64 + if false { + } else { + z.F.EncMapUint32Int64V(yy1257, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint32Float32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32Float32V(x.FMapUint32Float32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint32Float32`) + r.WriteMapElemValue() + if x.FMapUint32Float32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32Float32V(x.FMapUint32Float32, e) + } + } + } + var yyn1262 bool + if x.FptrMapUint32Float32 == nil { + yyn1262 = true + goto LABEL1262 + } + LABEL1262: + if yyr2 || yy2arr2 { + if yyn1262 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint32Float32 == nil { + r.EncodeNil() + } else { + yy1263 := *x.FptrMapUint32Float32 + if false { + } else { + z.F.EncMapUint32Float32V(yy1263, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Float32`) + r.WriteMapElemValue() + if yyn1262 { + r.EncodeNil() + } else { + if x.FptrMapUint32Float32 == nil { + r.EncodeNil() + } else { + yy1265 := *x.FptrMapUint32Float32 + if false { + } else { + z.F.EncMapUint32Float32V(yy1265, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint32Float64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32Float64V(x.FMapUint32Float64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint32Float64`) + r.WriteMapElemValue() + if x.FMapUint32Float64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32Float64V(x.FMapUint32Float64, e) + } + } + } + var yyn1270 bool + if x.FptrMapUint32Float64 == nil { + yyn1270 = true + goto LABEL1270 + } + LABEL1270: + if yyr2 || yy2arr2 { + if yyn1270 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint32Float64 == nil { + r.EncodeNil() + } else { + yy1271 := *x.FptrMapUint32Float64 + if false { + } else { + z.F.EncMapUint32Float64V(yy1271, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Float64`) + r.WriteMapElemValue() + if yyn1270 { + r.EncodeNil() + } else { + if x.FptrMapUint32Float64 == nil { + r.EncodeNil() + } else { + yy1273 := *x.FptrMapUint32Float64 + if false { + } else { + z.F.EncMapUint32Float64V(yy1273, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint32Bool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32BoolV(x.FMapUint32Bool, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint32Bool`) + r.WriteMapElemValue() + if x.FMapUint32Bool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint32BoolV(x.FMapUint32Bool, e) + } + } + } + var yyn1278 bool + if x.FptrMapUint32Bool == nil { + yyn1278 = true + goto LABEL1278 + } + LABEL1278: + if yyr2 || yy2arr2 { + if yyn1278 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint32Bool == nil { + r.EncodeNil() + } else { + yy1279 := *x.FptrMapUint32Bool + if false { + } else { + z.F.EncMapUint32BoolV(yy1279, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint32Bool`) + r.WriteMapElemValue() + if yyn1278 { + r.EncodeNil() + } else { + if x.FptrMapUint32Bool == nil { + r.EncodeNil() + } else { + yy1281 := *x.FptrMapUint32Bool + if false { + } else { + z.F.EncMapUint32BoolV(yy1281, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint64Intf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64IntfV(x.FMapUint64Intf, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint64Intf`) + r.WriteMapElemValue() + if x.FMapUint64Intf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64IntfV(x.FMapUint64Intf, e) + } + } + } + var yyn1286 bool + if x.FptrMapUint64Intf == nil { + yyn1286 = true + goto LABEL1286 + } + LABEL1286: + if yyr2 || yy2arr2 { + if yyn1286 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint64Intf == nil { + r.EncodeNil() + } else { + yy1287 := *x.FptrMapUint64Intf + if false { + } else { + z.F.EncMapUint64IntfV(yy1287, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Intf`) + r.WriteMapElemValue() + if yyn1286 { + r.EncodeNil() + } else { + if x.FptrMapUint64Intf == nil { + r.EncodeNil() + } else { + yy1289 := *x.FptrMapUint64Intf + if false { + } else { + z.F.EncMapUint64IntfV(yy1289, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint64String == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64StringV(x.FMapUint64String, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint64String`) + r.WriteMapElemValue() + if x.FMapUint64String == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64StringV(x.FMapUint64String, e) + } + } + } + var yyn1294 bool + if x.FptrMapUint64String == nil { + yyn1294 = true + goto LABEL1294 + } + LABEL1294: + if yyr2 || yy2arr2 { + if yyn1294 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint64String == nil { + r.EncodeNil() + } else { + yy1295 := *x.FptrMapUint64String + if false { + } else { + z.F.EncMapUint64StringV(yy1295, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64String`) + r.WriteMapElemValue() + if yyn1294 { + r.EncodeNil() + } else { + if x.FptrMapUint64String == nil { + r.EncodeNil() + } else { + yy1297 := *x.FptrMapUint64String + if false { + } else { + z.F.EncMapUint64StringV(yy1297, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint64Uint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64UintV(x.FMapUint64Uint, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint64Uint`) + r.WriteMapElemValue() + if x.FMapUint64Uint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64UintV(x.FMapUint64Uint, e) + } + } + } + var yyn1302 bool + if x.FptrMapUint64Uint == nil { + yyn1302 = true + goto LABEL1302 + } + LABEL1302: + if yyr2 || yy2arr2 { + if yyn1302 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint64Uint == nil { + r.EncodeNil() + } else { + yy1303 := *x.FptrMapUint64Uint + if false { + } else { + z.F.EncMapUint64UintV(yy1303, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Uint`) + r.WriteMapElemValue() + if yyn1302 { + r.EncodeNil() + } else { + if x.FptrMapUint64Uint == nil { + r.EncodeNil() + } else { + yy1305 := *x.FptrMapUint64Uint + if false { + } else { + z.F.EncMapUint64UintV(yy1305, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint64Uint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64Uint8V(x.FMapUint64Uint8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint64Uint8`) + r.WriteMapElemValue() + if x.FMapUint64Uint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64Uint8V(x.FMapUint64Uint8, e) + } + } + } + var yyn1310 bool + if x.FptrMapUint64Uint8 == nil { + yyn1310 = true + goto LABEL1310 + } + LABEL1310: + if yyr2 || yy2arr2 { + if yyn1310 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint64Uint8 == nil { + r.EncodeNil() + } else { + yy1311 := *x.FptrMapUint64Uint8 + if false { + } else { + z.F.EncMapUint64Uint8V(yy1311, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Uint8`) + r.WriteMapElemValue() + if yyn1310 { + r.EncodeNil() + } else { + if x.FptrMapUint64Uint8 == nil { + r.EncodeNil() + } else { + yy1313 := *x.FptrMapUint64Uint8 + if false { + } else { + z.F.EncMapUint64Uint8V(yy1313, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint64Uint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64Uint16V(x.FMapUint64Uint16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint64Uint16`) + r.WriteMapElemValue() + if x.FMapUint64Uint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64Uint16V(x.FMapUint64Uint16, e) + } + } + } + var yyn1318 bool + if x.FptrMapUint64Uint16 == nil { + yyn1318 = true + goto LABEL1318 + } + LABEL1318: + if yyr2 || yy2arr2 { + if yyn1318 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint64Uint16 == nil { + r.EncodeNil() + } else { + yy1319 := *x.FptrMapUint64Uint16 + if false { + } else { + z.F.EncMapUint64Uint16V(yy1319, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Uint16`) + r.WriteMapElemValue() + if yyn1318 { + r.EncodeNil() + } else { + if x.FptrMapUint64Uint16 == nil { + r.EncodeNil() + } else { + yy1321 := *x.FptrMapUint64Uint16 + if false { + } else { + z.F.EncMapUint64Uint16V(yy1321, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint64Uint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64Uint32V(x.FMapUint64Uint32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint64Uint32`) + r.WriteMapElemValue() + if x.FMapUint64Uint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64Uint32V(x.FMapUint64Uint32, e) + } + } + } + var yyn1326 bool + if x.FptrMapUint64Uint32 == nil { + yyn1326 = true + goto LABEL1326 + } + LABEL1326: + if yyr2 || yy2arr2 { + if yyn1326 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint64Uint32 == nil { + r.EncodeNil() + } else { + yy1327 := *x.FptrMapUint64Uint32 + if false { + } else { + z.F.EncMapUint64Uint32V(yy1327, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Uint32`) + r.WriteMapElemValue() + if yyn1326 { + r.EncodeNil() + } else { + if x.FptrMapUint64Uint32 == nil { + r.EncodeNil() + } else { + yy1329 := *x.FptrMapUint64Uint32 + if false { + } else { + z.F.EncMapUint64Uint32V(yy1329, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint64Uint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64Uint64V(x.FMapUint64Uint64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint64Uint64`) + r.WriteMapElemValue() + if x.FMapUint64Uint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64Uint64V(x.FMapUint64Uint64, e) + } + } + } + var yyn1334 bool + if x.FptrMapUint64Uint64 == nil { + yyn1334 = true + goto LABEL1334 + } + LABEL1334: + if yyr2 || yy2arr2 { + if yyn1334 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint64Uint64 == nil { + r.EncodeNil() + } else { + yy1335 := *x.FptrMapUint64Uint64 + if false { + } else { + z.F.EncMapUint64Uint64V(yy1335, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Uint64`) + r.WriteMapElemValue() + if yyn1334 { + r.EncodeNil() + } else { + if x.FptrMapUint64Uint64 == nil { + r.EncodeNil() + } else { + yy1337 := *x.FptrMapUint64Uint64 + if false { + } else { + z.F.EncMapUint64Uint64V(yy1337, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint64Uintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64UintptrV(x.FMapUint64Uintptr, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint64Uintptr`) + r.WriteMapElemValue() + if x.FMapUint64Uintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64UintptrV(x.FMapUint64Uintptr, e) + } + } + } + var yyn1342 bool + if x.FptrMapUint64Uintptr == nil { + yyn1342 = true + goto LABEL1342 + } + LABEL1342: + if yyr2 || yy2arr2 { + if yyn1342 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint64Uintptr == nil { + r.EncodeNil() + } else { + yy1343 := *x.FptrMapUint64Uintptr + if false { + } else { + z.F.EncMapUint64UintptrV(yy1343, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Uintptr`) + r.WriteMapElemValue() + if yyn1342 { + r.EncodeNil() + } else { + if x.FptrMapUint64Uintptr == nil { + r.EncodeNil() + } else { + yy1345 := *x.FptrMapUint64Uintptr + if false { + } else { + z.F.EncMapUint64UintptrV(yy1345, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint64Int == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64IntV(x.FMapUint64Int, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint64Int`) + r.WriteMapElemValue() + if x.FMapUint64Int == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64IntV(x.FMapUint64Int, e) + } + } + } + var yyn1350 bool + if x.FptrMapUint64Int == nil { + yyn1350 = true + goto LABEL1350 + } + LABEL1350: + if yyr2 || yy2arr2 { + if yyn1350 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint64Int == nil { + r.EncodeNil() + } else { + yy1351 := *x.FptrMapUint64Int + if false { + } else { + z.F.EncMapUint64IntV(yy1351, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Int`) + r.WriteMapElemValue() + if yyn1350 { + r.EncodeNil() + } else { + if x.FptrMapUint64Int == nil { + r.EncodeNil() + } else { + yy1353 := *x.FptrMapUint64Int + if false { + } else { + z.F.EncMapUint64IntV(yy1353, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint64Int8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64Int8V(x.FMapUint64Int8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint64Int8`) + r.WriteMapElemValue() + if x.FMapUint64Int8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64Int8V(x.FMapUint64Int8, e) + } + } + } + var yyn1358 bool + if x.FptrMapUint64Int8 == nil { + yyn1358 = true + goto LABEL1358 + } + LABEL1358: + if yyr2 || yy2arr2 { + if yyn1358 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint64Int8 == nil { + r.EncodeNil() + } else { + yy1359 := *x.FptrMapUint64Int8 + if false { + } else { + z.F.EncMapUint64Int8V(yy1359, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Int8`) + r.WriteMapElemValue() + if yyn1358 { + r.EncodeNil() + } else { + if x.FptrMapUint64Int8 == nil { + r.EncodeNil() + } else { + yy1361 := *x.FptrMapUint64Int8 + if false { + } else { + z.F.EncMapUint64Int8V(yy1361, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint64Int16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64Int16V(x.FMapUint64Int16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint64Int16`) + r.WriteMapElemValue() + if x.FMapUint64Int16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64Int16V(x.FMapUint64Int16, e) + } + } + } + var yyn1366 bool + if x.FptrMapUint64Int16 == nil { + yyn1366 = true + goto LABEL1366 + } + LABEL1366: + if yyr2 || yy2arr2 { + if yyn1366 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint64Int16 == nil { + r.EncodeNil() + } else { + yy1367 := *x.FptrMapUint64Int16 + if false { + } else { + z.F.EncMapUint64Int16V(yy1367, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Int16`) + r.WriteMapElemValue() + if yyn1366 { + r.EncodeNil() + } else { + if x.FptrMapUint64Int16 == nil { + r.EncodeNil() + } else { + yy1369 := *x.FptrMapUint64Int16 + if false { + } else { + z.F.EncMapUint64Int16V(yy1369, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint64Int32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64Int32V(x.FMapUint64Int32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint64Int32`) + r.WriteMapElemValue() + if x.FMapUint64Int32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64Int32V(x.FMapUint64Int32, e) + } + } + } + var yyn1374 bool + if x.FptrMapUint64Int32 == nil { + yyn1374 = true + goto LABEL1374 + } + LABEL1374: + if yyr2 || yy2arr2 { + if yyn1374 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint64Int32 == nil { + r.EncodeNil() + } else { + yy1375 := *x.FptrMapUint64Int32 + if false { + } else { + z.F.EncMapUint64Int32V(yy1375, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Int32`) + r.WriteMapElemValue() + if yyn1374 { + r.EncodeNil() + } else { + if x.FptrMapUint64Int32 == nil { + r.EncodeNil() + } else { + yy1377 := *x.FptrMapUint64Int32 + if false { + } else { + z.F.EncMapUint64Int32V(yy1377, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint64Int64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64Int64V(x.FMapUint64Int64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint64Int64`) + r.WriteMapElemValue() + if x.FMapUint64Int64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64Int64V(x.FMapUint64Int64, e) + } + } + } + var yyn1382 bool + if x.FptrMapUint64Int64 == nil { + yyn1382 = true + goto LABEL1382 + } + LABEL1382: + if yyr2 || yy2arr2 { + if yyn1382 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint64Int64 == nil { + r.EncodeNil() + } else { + yy1383 := *x.FptrMapUint64Int64 + if false { + } else { + z.F.EncMapUint64Int64V(yy1383, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Int64`) + r.WriteMapElemValue() + if yyn1382 { + r.EncodeNil() + } else { + if x.FptrMapUint64Int64 == nil { + r.EncodeNil() + } else { + yy1385 := *x.FptrMapUint64Int64 + if false { + } else { + z.F.EncMapUint64Int64V(yy1385, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint64Float32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64Float32V(x.FMapUint64Float32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint64Float32`) + r.WriteMapElemValue() + if x.FMapUint64Float32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64Float32V(x.FMapUint64Float32, e) + } + } + } + var yyn1390 bool + if x.FptrMapUint64Float32 == nil { + yyn1390 = true + goto LABEL1390 + } + LABEL1390: + if yyr2 || yy2arr2 { + if yyn1390 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint64Float32 == nil { + r.EncodeNil() + } else { + yy1391 := *x.FptrMapUint64Float32 + if false { + } else { + z.F.EncMapUint64Float32V(yy1391, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Float32`) + r.WriteMapElemValue() + if yyn1390 { + r.EncodeNil() + } else { + if x.FptrMapUint64Float32 == nil { + r.EncodeNil() + } else { + yy1393 := *x.FptrMapUint64Float32 + if false { + } else { + z.F.EncMapUint64Float32V(yy1393, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint64Float64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64Float64V(x.FMapUint64Float64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint64Float64`) + r.WriteMapElemValue() + if x.FMapUint64Float64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64Float64V(x.FMapUint64Float64, e) + } + } + } + var yyn1398 bool + if x.FptrMapUint64Float64 == nil { + yyn1398 = true + goto LABEL1398 + } + LABEL1398: + if yyr2 || yy2arr2 { + if yyn1398 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint64Float64 == nil { + r.EncodeNil() + } else { + yy1399 := *x.FptrMapUint64Float64 + if false { + } else { + z.F.EncMapUint64Float64V(yy1399, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Float64`) + r.WriteMapElemValue() + if yyn1398 { + r.EncodeNil() + } else { + if x.FptrMapUint64Float64 == nil { + r.EncodeNil() + } else { + yy1401 := *x.FptrMapUint64Float64 + if false { + } else { + z.F.EncMapUint64Float64V(yy1401, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUint64Bool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64BoolV(x.FMapUint64Bool, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUint64Bool`) + r.WriteMapElemValue() + if x.FMapUint64Bool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUint64BoolV(x.FMapUint64Bool, e) + } + } + } + var yyn1406 bool + if x.FptrMapUint64Bool == nil { + yyn1406 = true + goto LABEL1406 + } + LABEL1406: + if yyr2 || yy2arr2 { + if yyn1406 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUint64Bool == nil { + r.EncodeNil() + } else { + yy1407 := *x.FptrMapUint64Bool + if false { + } else { + z.F.EncMapUint64BoolV(yy1407, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUint64Bool`) + r.WriteMapElemValue() + if yyn1406 { + r.EncodeNil() + } else { + if x.FptrMapUint64Bool == nil { + r.EncodeNil() + } else { + yy1409 := *x.FptrMapUint64Bool + if false { + } else { + z.F.EncMapUint64BoolV(yy1409, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintptrIntf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrIntfV(x.FMapUintptrIntf, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintptrIntf`) + r.WriteMapElemValue() + if x.FMapUintptrIntf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrIntfV(x.FMapUintptrIntf, e) + } + } + } + var yyn1414 bool + if x.FptrMapUintptrIntf == nil { + yyn1414 = true + goto LABEL1414 + } + LABEL1414: + if yyr2 || yy2arr2 { + if yyn1414 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintptrIntf == nil { + r.EncodeNil() + } else { + yy1415 := *x.FptrMapUintptrIntf + if false { + } else { + z.F.EncMapUintptrIntfV(yy1415, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrIntf`) + r.WriteMapElemValue() + if yyn1414 { + r.EncodeNil() + } else { + if x.FptrMapUintptrIntf == nil { + r.EncodeNil() + } else { + yy1417 := *x.FptrMapUintptrIntf + if false { + } else { + z.F.EncMapUintptrIntfV(yy1417, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintptrString == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrStringV(x.FMapUintptrString, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintptrString`) + r.WriteMapElemValue() + if x.FMapUintptrString == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrStringV(x.FMapUintptrString, e) + } + } + } + var yyn1422 bool + if x.FptrMapUintptrString == nil { + yyn1422 = true + goto LABEL1422 + } + LABEL1422: + if yyr2 || yy2arr2 { + if yyn1422 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintptrString == nil { + r.EncodeNil() + } else { + yy1423 := *x.FptrMapUintptrString + if false { + } else { + z.F.EncMapUintptrStringV(yy1423, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrString`) + r.WriteMapElemValue() + if yyn1422 { + r.EncodeNil() + } else { + if x.FptrMapUintptrString == nil { + r.EncodeNil() + } else { + yy1425 := *x.FptrMapUintptrString + if false { + } else { + z.F.EncMapUintptrStringV(yy1425, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintptrUint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrUintV(x.FMapUintptrUint, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintptrUint`) + r.WriteMapElemValue() + if x.FMapUintptrUint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrUintV(x.FMapUintptrUint, e) + } + } + } + var yyn1430 bool + if x.FptrMapUintptrUint == nil { + yyn1430 = true + goto LABEL1430 + } + LABEL1430: + if yyr2 || yy2arr2 { + if yyn1430 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintptrUint == nil { + r.EncodeNil() + } else { + yy1431 := *x.FptrMapUintptrUint + if false { + } else { + z.F.EncMapUintptrUintV(yy1431, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrUint`) + r.WriteMapElemValue() + if yyn1430 { + r.EncodeNil() + } else { + if x.FptrMapUintptrUint == nil { + r.EncodeNil() + } else { + yy1433 := *x.FptrMapUintptrUint + if false { + } else { + z.F.EncMapUintptrUintV(yy1433, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintptrUint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrUint8V(x.FMapUintptrUint8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintptrUint8`) + r.WriteMapElemValue() + if x.FMapUintptrUint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrUint8V(x.FMapUintptrUint8, e) + } + } + } + var yyn1438 bool + if x.FptrMapUintptrUint8 == nil { + yyn1438 = true + goto LABEL1438 + } + LABEL1438: + if yyr2 || yy2arr2 { + if yyn1438 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintptrUint8 == nil { + r.EncodeNil() + } else { + yy1439 := *x.FptrMapUintptrUint8 + if false { + } else { + z.F.EncMapUintptrUint8V(yy1439, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrUint8`) + r.WriteMapElemValue() + if yyn1438 { + r.EncodeNil() + } else { + if x.FptrMapUintptrUint8 == nil { + r.EncodeNil() + } else { + yy1441 := *x.FptrMapUintptrUint8 + if false { + } else { + z.F.EncMapUintptrUint8V(yy1441, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintptrUint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrUint16V(x.FMapUintptrUint16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintptrUint16`) + r.WriteMapElemValue() + if x.FMapUintptrUint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrUint16V(x.FMapUintptrUint16, e) + } + } + } + var yyn1446 bool + if x.FptrMapUintptrUint16 == nil { + yyn1446 = true + goto LABEL1446 + } + LABEL1446: + if yyr2 || yy2arr2 { + if yyn1446 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintptrUint16 == nil { + r.EncodeNil() + } else { + yy1447 := *x.FptrMapUintptrUint16 + if false { + } else { + z.F.EncMapUintptrUint16V(yy1447, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrUint16`) + r.WriteMapElemValue() + if yyn1446 { + r.EncodeNil() + } else { + if x.FptrMapUintptrUint16 == nil { + r.EncodeNil() + } else { + yy1449 := *x.FptrMapUintptrUint16 + if false { + } else { + z.F.EncMapUintptrUint16V(yy1449, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintptrUint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrUint32V(x.FMapUintptrUint32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintptrUint32`) + r.WriteMapElemValue() + if x.FMapUintptrUint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrUint32V(x.FMapUintptrUint32, e) + } + } + } + var yyn1454 bool + if x.FptrMapUintptrUint32 == nil { + yyn1454 = true + goto LABEL1454 + } + LABEL1454: + if yyr2 || yy2arr2 { + if yyn1454 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintptrUint32 == nil { + r.EncodeNil() + } else { + yy1455 := *x.FptrMapUintptrUint32 + if false { + } else { + z.F.EncMapUintptrUint32V(yy1455, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrUint32`) + r.WriteMapElemValue() + if yyn1454 { + r.EncodeNil() + } else { + if x.FptrMapUintptrUint32 == nil { + r.EncodeNil() + } else { + yy1457 := *x.FptrMapUintptrUint32 + if false { + } else { + z.F.EncMapUintptrUint32V(yy1457, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintptrUint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrUint64V(x.FMapUintptrUint64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintptrUint64`) + r.WriteMapElemValue() + if x.FMapUintptrUint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrUint64V(x.FMapUintptrUint64, e) + } + } + } + var yyn1462 bool + if x.FptrMapUintptrUint64 == nil { + yyn1462 = true + goto LABEL1462 + } + LABEL1462: + if yyr2 || yy2arr2 { + if yyn1462 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintptrUint64 == nil { + r.EncodeNil() + } else { + yy1463 := *x.FptrMapUintptrUint64 + if false { + } else { + z.F.EncMapUintptrUint64V(yy1463, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrUint64`) + r.WriteMapElemValue() + if yyn1462 { + r.EncodeNil() + } else { + if x.FptrMapUintptrUint64 == nil { + r.EncodeNil() + } else { + yy1465 := *x.FptrMapUintptrUint64 + if false { + } else { + z.F.EncMapUintptrUint64V(yy1465, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintptrUintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrUintptrV(x.FMapUintptrUintptr, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintptrUintptr`) + r.WriteMapElemValue() + if x.FMapUintptrUintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrUintptrV(x.FMapUintptrUintptr, e) + } + } + } + var yyn1470 bool + if x.FptrMapUintptrUintptr == nil { + yyn1470 = true + goto LABEL1470 + } + LABEL1470: + if yyr2 || yy2arr2 { + if yyn1470 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintptrUintptr == nil { + r.EncodeNil() + } else { + yy1471 := *x.FptrMapUintptrUintptr + if false { + } else { + z.F.EncMapUintptrUintptrV(yy1471, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrUintptr`) + r.WriteMapElemValue() + if yyn1470 { + r.EncodeNil() + } else { + if x.FptrMapUintptrUintptr == nil { + r.EncodeNil() + } else { + yy1473 := *x.FptrMapUintptrUintptr + if false { + } else { + z.F.EncMapUintptrUintptrV(yy1473, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintptrInt == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrIntV(x.FMapUintptrInt, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintptrInt`) + r.WriteMapElemValue() + if x.FMapUintptrInt == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrIntV(x.FMapUintptrInt, e) + } + } + } + var yyn1478 bool + if x.FptrMapUintptrInt == nil { + yyn1478 = true + goto LABEL1478 + } + LABEL1478: + if yyr2 || yy2arr2 { + if yyn1478 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintptrInt == nil { + r.EncodeNil() + } else { + yy1479 := *x.FptrMapUintptrInt + if false { + } else { + z.F.EncMapUintptrIntV(yy1479, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrInt`) + r.WriteMapElemValue() + if yyn1478 { + r.EncodeNil() + } else { + if x.FptrMapUintptrInt == nil { + r.EncodeNil() + } else { + yy1481 := *x.FptrMapUintptrInt + if false { + } else { + z.F.EncMapUintptrIntV(yy1481, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintptrInt8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrInt8V(x.FMapUintptrInt8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintptrInt8`) + r.WriteMapElemValue() + if x.FMapUintptrInt8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrInt8V(x.FMapUintptrInt8, e) + } + } + } + var yyn1486 bool + if x.FptrMapUintptrInt8 == nil { + yyn1486 = true + goto LABEL1486 + } + LABEL1486: + if yyr2 || yy2arr2 { + if yyn1486 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintptrInt8 == nil { + r.EncodeNil() + } else { + yy1487 := *x.FptrMapUintptrInt8 + if false { + } else { + z.F.EncMapUintptrInt8V(yy1487, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrInt8`) + r.WriteMapElemValue() + if yyn1486 { + r.EncodeNil() + } else { + if x.FptrMapUintptrInt8 == nil { + r.EncodeNil() + } else { + yy1489 := *x.FptrMapUintptrInt8 + if false { + } else { + z.F.EncMapUintptrInt8V(yy1489, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintptrInt16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrInt16V(x.FMapUintptrInt16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintptrInt16`) + r.WriteMapElemValue() + if x.FMapUintptrInt16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrInt16V(x.FMapUintptrInt16, e) + } + } + } + var yyn1494 bool + if x.FptrMapUintptrInt16 == nil { + yyn1494 = true + goto LABEL1494 + } + LABEL1494: + if yyr2 || yy2arr2 { + if yyn1494 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintptrInt16 == nil { + r.EncodeNil() + } else { + yy1495 := *x.FptrMapUintptrInt16 + if false { + } else { + z.F.EncMapUintptrInt16V(yy1495, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrInt16`) + r.WriteMapElemValue() + if yyn1494 { + r.EncodeNil() + } else { + if x.FptrMapUintptrInt16 == nil { + r.EncodeNil() + } else { + yy1497 := *x.FptrMapUintptrInt16 + if false { + } else { + z.F.EncMapUintptrInt16V(yy1497, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintptrInt32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrInt32V(x.FMapUintptrInt32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintptrInt32`) + r.WriteMapElemValue() + if x.FMapUintptrInt32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrInt32V(x.FMapUintptrInt32, e) + } + } + } + var yyn1502 bool + if x.FptrMapUintptrInt32 == nil { + yyn1502 = true + goto LABEL1502 + } + LABEL1502: + if yyr2 || yy2arr2 { + if yyn1502 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintptrInt32 == nil { + r.EncodeNil() + } else { + yy1503 := *x.FptrMapUintptrInt32 + if false { + } else { + z.F.EncMapUintptrInt32V(yy1503, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrInt32`) + r.WriteMapElemValue() + if yyn1502 { + r.EncodeNil() + } else { + if x.FptrMapUintptrInt32 == nil { + r.EncodeNil() + } else { + yy1505 := *x.FptrMapUintptrInt32 + if false { + } else { + z.F.EncMapUintptrInt32V(yy1505, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintptrInt64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrInt64V(x.FMapUintptrInt64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintptrInt64`) + r.WriteMapElemValue() + if x.FMapUintptrInt64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrInt64V(x.FMapUintptrInt64, e) + } + } + } + var yyn1510 bool + if x.FptrMapUintptrInt64 == nil { + yyn1510 = true + goto LABEL1510 + } + LABEL1510: + if yyr2 || yy2arr2 { + if yyn1510 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintptrInt64 == nil { + r.EncodeNil() + } else { + yy1511 := *x.FptrMapUintptrInt64 + if false { + } else { + z.F.EncMapUintptrInt64V(yy1511, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrInt64`) + r.WriteMapElemValue() + if yyn1510 { + r.EncodeNil() + } else { + if x.FptrMapUintptrInt64 == nil { + r.EncodeNil() + } else { + yy1513 := *x.FptrMapUintptrInt64 + if false { + } else { + z.F.EncMapUintptrInt64V(yy1513, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintptrFloat32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrFloat32V(x.FMapUintptrFloat32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintptrFloat32`) + r.WriteMapElemValue() + if x.FMapUintptrFloat32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrFloat32V(x.FMapUintptrFloat32, e) + } + } + } + var yyn1518 bool + if x.FptrMapUintptrFloat32 == nil { + yyn1518 = true + goto LABEL1518 + } + LABEL1518: + if yyr2 || yy2arr2 { + if yyn1518 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintptrFloat32 == nil { + r.EncodeNil() + } else { + yy1519 := *x.FptrMapUintptrFloat32 + if false { + } else { + z.F.EncMapUintptrFloat32V(yy1519, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrFloat32`) + r.WriteMapElemValue() + if yyn1518 { + r.EncodeNil() + } else { + if x.FptrMapUintptrFloat32 == nil { + r.EncodeNil() + } else { + yy1521 := *x.FptrMapUintptrFloat32 + if false { + } else { + z.F.EncMapUintptrFloat32V(yy1521, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintptrFloat64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrFloat64V(x.FMapUintptrFloat64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintptrFloat64`) + r.WriteMapElemValue() + if x.FMapUintptrFloat64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrFloat64V(x.FMapUintptrFloat64, e) + } + } + } + var yyn1526 bool + if x.FptrMapUintptrFloat64 == nil { + yyn1526 = true + goto LABEL1526 + } + LABEL1526: + if yyr2 || yy2arr2 { + if yyn1526 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintptrFloat64 == nil { + r.EncodeNil() + } else { + yy1527 := *x.FptrMapUintptrFloat64 + if false { + } else { + z.F.EncMapUintptrFloat64V(yy1527, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrFloat64`) + r.WriteMapElemValue() + if yyn1526 { + r.EncodeNil() + } else { + if x.FptrMapUintptrFloat64 == nil { + r.EncodeNil() + } else { + yy1529 := *x.FptrMapUintptrFloat64 + if false { + } else { + z.F.EncMapUintptrFloat64V(yy1529, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapUintptrBool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrBoolV(x.FMapUintptrBool, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapUintptrBool`) + r.WriteMapElemValue() + if x.FMapUintptrBool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapUintptrBoolV(x.FMapUintptrBool, e) + } + } + } + var yyn1534 bool + if x.FptrMapUintptrBool == nil { + yyn1534 = true + goto LABEL1534 + } + LABEL1534: + if yyr2 || yy2arr2 { + if yyn1534 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapUintptrBool == nil { + r.EncodeNil() + } else { + yy1535 := *x.FptrMapUintptrBool + if false { + } else { + z.F.EncMapUintptrBoolV(yy1535, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapUintptrBool`) + r.WriteMapElemValue() + if yyn1534 { + r.EncodeNil() + } else { + if x.FptrMapUintptrBool == nil { + r.EncodeNil() + } else { + yy1537 := *x.FptrMapUintptrBool + if false { + } else { + z.F.EncMapUintptrBoolV(yy1537, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntIntf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntIntfV(x.FMapIntIntf, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntIntf`) + r.WriteMapElemValue() + if x.FMapIntIntf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntIntfV(x.FMapIntIntf, e) + } + } + } + var yyn1542 bool + if x.FptrMapIntIntf == nil { + yyn1542 = true + goto LABEL1542 + } + LABEL1542: + if yyr2 || yy2arr2 { + if yyn1542 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntIntf == nil { + r.EncodeNil() + } else { + yy1543 := *x.FptrMapIntIntf + if false { + } else { + z.F.EncMapIntIntfV(yy1543, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntIntf`) + r.WriteMapElemValue() + if yyn1542 { + r.EncodeNil() + } else { + if x.FptrMapIntIntf == nil { + r.EncodeNil() + } else { + yy1545 := *x.FptrMapIntIntf + if false { + } else { + z.F.EncMapIntIntfV(yy1545, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntString == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntStringV(x.FMapIntString, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntString`) + r.WriteMapElemValue() + if x.FMapIntString == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntStringV(x.FMapIntString, e) + } + } + } + var yyn1550 bool + if x.FptrMapIntString == nil { + yyn1550 = true + goto LABEL1550 + } + LABEL1550: + if yyr2 || yy2arr2 { + if yyn1550 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntString == nil { + r.EncodeNil() + } else { + yy1551 := *x.FptrMapIntString + if false { + } else { + z.F.EncMapIntStringV(yy1551, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntString`) + r.WriteMapElemValue() + if yyn1550 { + r.EncodeNil() + } else { + if x.FptrMapIntString == nil { + r.EncodeNil() + } else { + yy1553 := *x.FptrMapIntString + if false { + } else { + z.F.EncMapIntStringV(yy1553, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntUint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntUintV(x.FMapIntUint, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntUint`) + r.WriteMapElemValue() + if x.FMapIntUint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntUintV(x.FMapIntUint, e) + } + } + } + var yyn1558 bool + if x.FptrMapIntUint == nil { + yyn1558 = true + goto LABEL1558 + } + LABEL1558: + if yyr2 || yy2arr2 { + if yyn1558 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntUint == nil { + r.EncodeNil() + } else { + yy1559 := *x.FptrMapIntUint + if false { + } else { + z.F.EncMapIntUintV(yy1559, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntUint`) + r.WriteMapElemValue() + if yyn1558 { + r.EncodeNil() + } else { + if x.FptrMapIntUint == nil { + r.EncodeNil() + } else { + yy1561 := *x.FptrMapIntUint + if false { + } else { + z.F.EncMapIntUintV(yy1561, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntUint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntUint8V(x.FMapIntUint8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntUint8`) + r.WriteMapElemValue() + if x.FMapIntUint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntUint8V(x.FMapIntUint8, e) + } + } + } + var yyn1566 bool + if x.FptrMapIntUint8 == nil { + yyn1566 = true + goto LABEL1566 + } + LABEL1566: + if yyr2 || yy2arr2 { + if yyn1566 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntUint8 == nil { + r.EncodeNil() + } else { + yy1567 := *x.FptrMapIntUint8 + if false { + } else { + z.F.EncMapIntUint8V(yy1567, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntUint8`) + r.WriteMapElemValue() + if yyn1566 { + r.EncodeNil() + } else { + if x.FptrMapIntUint8 == nil { + r.EncodeNil() + } else { + yy1569 := *x.FptrMapIntUint8 + if false { + } else { + z.F.EncMapIntUint8V(yy1569, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntUint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntUint16V(x.FMapIntUint16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntUint16`) + r.WriteMapElemValue() + if x.FMapIntUint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntUint16V(x.FMapIntUint16, e) + } + } + } + var yyn1574 bool + if x.FptrMapIntUint16 == nil { + yyn1574 = true + goto LABEL1574 + } + LABEL1574: + if yyr2 || yy2arr2 { + if yyn1574 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntUint16 == nil { + r.EncodeNil() + } else { + yy1575 := *x.FptrMapIntUint16 + if false { + } else { + z.F.EncMapIntUint16V(yy1575, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntUint16`) + r.WriteMapElemValue() + if yyn1574 { + r.EncodeNil() + } else { + if x.FptrMapIntUint16 == nil { + r.EncodeNil() + } else { + yy1577 := *x.FptrMapIntUint16 + if false { + } else { + z.F.EncMapIntUint16V(yy1577, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntUint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntUint32V(x.FMapIntUint32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntUint32`) + r.WriteMapElemValue() + if x.FMapIntUint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntUint32V(x.FMapIntUint32, e) + } + } + } + var yyn1582 bool + if x.FptrMapIntUint32 == nil { + yyn1582 = true + goto LABEL1582 + } + LABEL1582: + if yyr2 || yy2arr2 { + if yyn1582 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntUint32 == nil { + r.EncodeNil() + } else { + yy1583 := *x.FptrMapIntUint32 + if false { + } else { + z.F.EncMapIntUint32V(yy1583, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntUint32`) + r.WriteMapElemValue() + if yyn1582 { + r.EncodeNil() + } else { + if x.FptrMapIntUint32 == nil { + r.EncodeNil() + } else { + yy1585 := *x.FptrMapIntUint32 + if false { + } else { + z.F.EncMapIntUint32V(yy1585, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntUint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntUint64V(x.FMapIntUint64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntUint64`) + r.WriteMapElemValue() + if x.FMapIntUint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntUint64V(x.FMapIntUint64, e) + } + } + } + var yyn1590 bool + if x.FptrMapIntUint64 == nil { + yyn1590 = true + goto LABEL1590 + } + LABEL1590: + if yyr2 || yy2arr2 { + if yyn1590 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntUint64 == nil { + r.EncodeNil() + } else { + yy1591 := *x.FptrMapIntUint64 + if false { + } else { + z.F.EncMapIntUint64V(yy1591, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntUint64`) + r.WriteMapElemValue() + if yyn1590 { + r.EncodeNil() + } else { + if x.FptrMapIntUint64 == nil { + r.EncodeNil() + } else { + yy1593 := *x.FptrMapIntUint64 + if false { + } else { + z.F.EncMapIntUint64V(yy1593, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntUintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntUintptrV(x.FMapIntUintptr, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntUintptr`) + r.WriteMapElemValue() + if x.FMapIntUintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntUintptrV(x.FMapIntUintptr, e) + } + } + } + var yyn1598 bool + if x.FptrMapIntUintptr == nil { + yyn1598 = true + goto LABEL1598 + } + LABEL1598: + if yyr2 || yy2arr2 { + if yyn1598 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntUintptr == nil { + r.EncodeNil() + } else { + yy1599 := *x.FptrMapIntUintptr + if false { + } else { + z.F.EncMapIntUintptrV(yy1599, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntUintptr`) + r.WriteMapElemValue() + if yyn1598 { + r.EncodeNil() + } else { + if x.FptrMapIntUintptr == nil { + r.EncodeNil() + } else { + yy1601 := *x.FptrMapIntUintptr + if false { + } else { + z.F.EncMapIntUintptrV(yy1601, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntInt == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntIntV(x.FMapIntInt, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntInt`) + r.WriteMapElemValue() + if x.FMapIntInt == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntIntV(x.FMapIntInt, e) + } + } + } + var yyn1606 bool + if x.FptrMapIntInt == nil { + yyn1606 = true + goto LABEL1606 + } + LABEL1606: + if yyr2 || yy2arr2 { + if yyn1606 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntInt == nil { + r.EncodeNil() + } else { + yy1607 := *x.FptrMapIntInt + if false { + } else { + z.F.EncMapIntIntV(yy1607, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntInt`) + r.WriteMapElemValue() + if yyn1606 { + r.EncodeNil() + } else { + if x.FptrMapIntInt == nil { + r.EncodeNil() + } else { + yy1609 := *x.FptrMapIntInt + if false { + } else { + z.F.EncMapIntIntV(yy1609, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntInt8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntInt8V(x.FMapIntInt8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntInt8`) + r.WriteMapElemValue() + if x.FMapIntInt8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntInt8V(x.FMapIntInt8, e) + } + } + } + var yyn1614 bool + if x.FptrMapIntInt8 == nil { + yyn1614 = true + goto LABEL1614 + } + LABEL1614: + if yyr2 || yy2arr2 { + if yyn1614 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntInt8 == nil { + r.EncodeNil() + } else { + yy1615 := *x.FptrMapIntInt8 + if false { + } else { + z.F.EncMapIntInt8V(yy1615, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntInt8`) + r.WriteMapElemValue() + if yyn1614 { + r.EncodeNil() + } else { + if x.FptrMapIntInt8 == nil { + r.EncodeNil() + } else { + yy1617 := *x.FptrMapIntInt8 + if false { + } else { + z.F.EncMapIntInt8V(yy1617, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntInt16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntInt16V(x.FMapIntInt16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntInt16`) + r.WriteMapElemValue() + if x.FMapIntInt16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntInt16V(x.FMapIntInt16, e) + } + } + } + var yyn1622 bool + if x.FptrMapIntInt16 == nil { + yyn1622 = true + goto LABEL1622 + } + LABEL1622: + if yyr2 || yy2arr2 { + if yyn1622 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntInt16 == nil { + r.EncodeNil() + } else { + yy1623 := *x.FptrMapIntInt16 + if false { + } else { + z.F.EncMapIntInt16V(yy1623, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntInt16`) + r.WriteMapElemValue() + if yyn1622 { + r.EncodeNil() + } else { + if x.FptrMapIntInt16 == nil { + r.EncodeNil() + } else { + yy1625 := *x.FptrMapIntInt16 + if false { + } else { + z.F.EncMapIntInt16V(yy1625, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntInt32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntInt32V(x.FMapIntInt32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntInt32`) + r.WriteMapElemValue() + if x.FMapIntInt32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntInt32V(x.FMapIntInt32, e) + } + } + } + var yyn1630 bool + if x.FptrMapIntInt32 == nil { + yyn1630 = true + goto LABEL1630 + } + LABEL1630: + if yyr2 || yy2arr2 { + if yyn1630 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntInt32 == nil { + r.EncodeNil() + } else { + yy1631 := *x.FptrMapIntInt32 + if false { + } else { + z.F.EncMapIntInt32V(yy1631, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntInt32`) + r.WriteMapElemValue() + if yyn1630 { + r.EncodeNil() + } else { + if x.FptrMapIntInt32 == nil { + r.EncodeNil() + } else { + yy1633 := *x.FptrMapIntInt32 + if false { + } else { + z.F.EncMapIntInt32V(yy1633, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntInt64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntInt64V(x.FMapIntInt64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntInt64`) + r.WriteMapElemValue() + if x.FMapIntInt64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntInt64V(x.FMapIntInt64, e) + } + } + } + var yyn1638 bool + if x.FptrMapIntInt64 == nil { + yyn1638 = true + goto LABEL1638 + } + LABEL1638: + if yyr2 || yy2arr2 { + if yyn1638 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntInt64 == nil { + r.EncodeNil() + } else { + yy1639 := *x.FptrMapIntInt64 + if false { + } else { + z.F.EncMapIntInt64V(yy1639, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntInt64`) + r.WriteMapElemValue() + if yyn1638 { + r.EncodeNil() + } else { + if x.FptrMapIntInt64 == nil { + r.EncodeNil() + } else { + yy1641 := *x.FptrMapIntInt64 + if false { + } else { + z.F.EncMapIntInt64V(yy1641, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntFloat32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntFloat32V(x.FMapIntFloat32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntFloat32`) + r.WriteMapElemValue() + if x.FMapIntFloat32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntFloat32V(x.FMapIntFloat32, e) + } + } + } + var yyn1646 bool + if x.FptrMapIntFloat32 == nil { + yyn1646 = true + goto LABEL1646 + } + LABEL1646: + if yyr2 || yy2arr2 { + if yyn1646 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntFloat32 == nil { + r.EncodeNil() + } else { + yy1647 := *x.FptrMapIntFloat32 + if false { + } else { + z.F.EncMapIntFloat32V(yy1647, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntFloat32`) + r.WriteMapElemValue() + if yyn1646 { + r.EncodeNil() + } else { + if x.FptrMapIntFloat32 == nil { + r.EncodeNil() + } else { + yy1649 := *x.FptrMapIntFloat32 + if false { + } else { + z.F.EncMapIntFloat32V(yy1649, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntFloat64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntFloat64V(x.FMapIntFloat64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntFloat64`) + r.WriteMapElemValue() + if x.FMapIntFloat64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntFloat64V(x.FMapIntFloat64, e) + } + } + } + var yyn1654 bool + if x.FptrMapIntFloat64 == nil { + yyn1654 = true + goto LABEL1654 + } + LABEL1654: + if yyr2 || yy2arr2 { + if yyn1654 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntFloat64 == nil { + r.EncodeNil() + } else { + yy1655 := *x.FptrMapIntFloat64 + if false { + } else { + z.F.EncMapIntFloat64V(yy1655, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntFloat64`) + r.WriteMapElemValue() + if yyn1654 { + r.EncodeNil() + } else { + if x.FptrMapIntFloat64 == nil { + r.EncodeNil() + } else { + yy1657 := *x.FptrMapIntFloat64 + if false { + } else { + z.F.EncMapIntFloat64V(yy1657, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapIntBool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntBoolV(x.FMapIntBool, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapIntBool`) + r.WriteMapElemValue() + if x.FMapIntBool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapIntBoolV(x.FMapIntBool, e) + } + } + } + var yyn1662 bool + if x.FptrMapIntBool == nil { + yyn1662 = true + goto LABEL1662 + } + LABEL1662: + if yyr2 || yy2arr2 { + if yyn1662 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapIntBool == nil { + r.EncodeNil() + } else { + yy1663 := *x.FptrMapIntBool + if false { + } else { + z.F.EncMapIntBoolV(yy1663, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapIntBool`) + r.WriteMapElemValue() + if yyn1662 { + r.EncodeNil() + } else { + if x.FptrMapIntBool == nil { + r.EncodeNil() + } else { + yy1665 := *x.FptrMapIntBool + if false { + } else { + z.F.EncMapIntBoolV(yy1665, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt8Intf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8IntfV(x.FMapInt8Intf, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt8Intf`) + r.WriteMapElemValue() + if x.FMapInt8Intf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8IntfV(x.FMapInt8Intf, e) + } + } + } + var yyn1670 bool + if x.FptrMapInt8Intf == nil { + yyn1670 = true + goto LABEL1670 + } + LABEL1670: + if yyr2 || yy2arr2 { + if yyn1670 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt8Intf == nil { + r.EncodeNil() + } else { + yy1671 := *x.FptrMapInt8Intf + if false { + } else { + z.F.EncMapInt8IntfV(yy1671, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Intf`) + r.WriteMapElemValue() + if yyn1670 { + r.EncodeNil() + } else { + if x.FptrMapInt8Intf == nil { + r.EncodeNil() + } else { + yy1673 := *x.FptrMapInt8Intf + if false { + } else { + z.F.EncMapInt8IntfV(yy1673, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt8String == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8StringV(x.FMapInt8String, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt8String`) + r.WriteMapElemValue() + if x.FMapInt8String == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8StringV(x.FMapInt8String, e) + } + } + } + var yyn1678 bool + if x.FptrMapInt8String == nil { + yyn1678 = true + goto LABEL1678 + } + LABEL1678: + if yyr2 || yy2arr2 { + if yyn1678 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt8String == nil { + r.EncodeNil() + } else { + yy1679 := *x.FptrMapInt8String + if false { + } else { + z.F.EncMapInt8StringV(yy1679, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8String`) + r.WriteMapElemValue() + if yyn1678 { + r.EncodeNil() + } else { + if x.FptrMapInt8String == nil { + r.EncodeNil() + } else { + yy1681 := *x.FptrMapInt8String + if false { + } else { + z.F.EncMapInt8StringV(yy1681, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt8Uint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8UintV(x.FMapInt8Uint, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt8Uint`) + r.WriteMapElemValue() + if x.FMapInt8Uint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8UintV(x.FMapInt8Uint, e) + } + } + } + var yyn1686 bool + if x.FptrMapInt8Uint == nil { + yyn1686 = true + goto LABEL1686 + } + LABEL1686: + if yyr2 || yy2arr2 { + if yyn1686 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt8Uint == nil { + r.EncodeNil() + } else { + yy1687 := *x.FptrMapInt8Uint + if false { + } else { + z.F.EncMapInt8UintV(yy1687, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Uint`) + r.WriteMapElemValue() + if yyn1686 { + r.EncodeNil() + } else { + if x.FptrMapInt8Uint == nil { + r.EncodeNil() + } else { + yy1689 := *x.FptrMapInt8Uint + if false { + } else { + z.F.EncMapInt8UintV(yy1689, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt8Uint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8Uint8V(x.FMapInt8Uint8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt8Uint8`) + r.WriteMapElemValue() + if x.FMapInt8Uint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8Uint8V(x.FMapInt8Uint8, e) + } + } + } + var yyn1694 bool + if x.FptrMapInt8Uint8 == nil { + yyn1694 = true + goto LABEL1694 + } + LABEL1694: + if yyr2 || yy2arr2 { + if yyn1694 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt8Uint8 == nil { + r.EncodeNil() + } else { + yy1695 := *x.FptrMapInt8Uint8 + if false { + } else { + z.F.EncMapInt8Uint8V(yy1695, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Uint8`) + r.WriteMapElemValue() + if yyn1694 { + r.EncodeNil() + } else { + if x.FptrMapInt8Uint8 == nil { + r.EncodeNil() + } else { + yy1697 := *x.FptrMapInt8Uint8 + if false { + } else { + z.F.EncMapInt8Uint8V(yy1697, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt8Uint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8Uint16V(x.FMapInt8Uint16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt8Uint16`) + r.WriteMapElemValue() + if x.FMapInt8Uint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8Uint16V(x.FMapInt8Uint16, e) + } + } + } + var yyn1702 bool + if x.FptrMapInt8Uint16 == nil { + yyn1702 = true + goto LABEL1702 + } + LABEL1702: + if yyr2 || yy2arr2 { + if yyn1702 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt8Uint16 == nil { + r.EncodeNil() + } else { + yy1703 := *x.FptrMapInt8Uint16 + if false { + } else { + z.F.EncMapInt8Uint16V(yy1703, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Uint16`) + r.WriteMapElemValue() + if yyn1702 { + r.EncodeNil() + } else { + if x.FptrMapInt8Uint16 == nil { + r.EncodeNil() + } else { + yy1705 := *x.FptrMapInt8Uint16 + if false { + } else { + z.F.EncMapInt8Uint16V(yy1705, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt8Uint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8Uint32V(x.FMapInt8Uint32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt8Uint32`) + r.WriteMapElemValue() + if x.FMapInt8Uint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8Uint32V(x.FMapInt8Uint32, e) + } + } + } + var yyn1710 bool + if x.FptrMapInt8Uint32 == nil { + yyn1710 = true + goto LABEL1710 + } + LABEL1710: + if yyr2 || yy2arr2 { + if yyn1710 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt8Uint32 == nil { + r.EncodeNil() + } else { + yy1711 := *x.FptrMapInt8Uint32 + if false { + } else { + z.F.EncMapInt8Uint32V(yy1711, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Uint32`) + r.WriteMapElemValue() + if yyn1710 { + r.EncodeNil() + } else { + if x.FptrMapInt8Uint32 == nil { + r.EncodeNil() + } else { + yy1713 := *x.FptrMapInt8Uint32 + if false { + } else { + z.F.EncMapInt8Uint32V(yy1713, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt8Uint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8Uint64V(x.FMapInt8Uint64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt8Uint64`) + r.WriteMapElemValue() + if x.FMapInt8Uint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8Uint64V(x.FMapInt8Uint64, e) + } + } + } + var yyn1718 bool + if x.FptrMapInt8Uint64 == nil { + yyn1718 = true + goto LABEL1718 + } + LABEL1718: + if yyr2 || yy2arr2 { + if yyn1718 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt8Uint64 == nil { + r.EncodeNil() + } else { + yy1719 := *x.FptrMapInt8Uint64 + if false { + } else { + z.F.EncMapInt8Uint64V(yy1719, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Uint64`) + r.WriteMapElemValue() + if yyn1718 { + r.EncodeNil() + } else { + if x.FptrMapInt8Uint64 == nil { + r.EncodeNil() + } else { + yy1721 := *x.FptrMapInt8Uint64 + if false { + } else { + z.F.EncMapInt8Uint64V(yy1721, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt8Uintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8UintptrV(x.FMapInt8Uintptr, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt8Uintptr`) + r.WriteMapElemValue() + if x.FMapInt8Uintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8UintptrV(x.FMapInt8Uintptr, e) + } + } + } + var yyn1726 bool + if x.FptrMapInt8Uintptr == nil { + yyn1726 = true + goto LABEL1726 + } + LABEL1726: + if yyr2 || yy2arr2 { + if yyn1726 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt8Uintptr == nil { + r.EncodeNil() + } else { + yy1727 := *x.FptrMapInt8Uintptr + if false { + } else { + z.F.EncMapInt8UintptrV(yy1727, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Uintptr`) + r.WriteMapElemValue() + if yyn1726 { + r.EncodeNil() + } else { + if x.FptrMapInt8Uintptr == nil { + r.EncodeNil() + } else { + yy1729 := *x.FptrMapInt8Uintptr + if false { + } else { + z.F.EncMapInt8UintptrV(yy1729, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt8Int == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8IntV(x.FMapInt8Int, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt8Int`) + r.WriteMapElemValue() + if x.FMapInt8Int == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8IntV(x.FMapInt8Int, e) + } + } + } + var yyn1734 bool + if x.FptrMapInt8Int == nil { + yyn1734 = true + goto LABEL1734 + } + LABEL1734: + if yyr2 || yy2arr2 { + if yyn1734 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt8Int == nil { + r.EncodeNil() + } else { + yy1735 := *x.FptrMapInt8Int + if false { + } else { + z.F.EncMapInt8IntV(yy1735, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Int`) + r.WriteMapElemValue() + if yyn1734 { + r.EncodeNil() + } else { + if x.FptrMapInt8Int == nil { + r.EncodeNil() + } else { + yy1737 := *x.FptrMapInt8Int + if false { + } else { + z.F.EncMapInt8IntV(yy1737, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt8Int8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8Int8V(x.FMapInt8Int8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt8Int8`) + r.WriteMapElemValue() + if x.FMapInt8Int8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8Int8V(x.FMapInt8Int8, e) + } + } + } + var yyn1742 bool + if x.FptrMapInt8Int8 == nil { + yyn1742 = true + goto LABEL1742 + } + LABEL1742: + if yyr2 || yy2arr2 { + if yyn1742 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt8Int8 == nil { + r.EncodeNil() + } else { + yy1743 := *x.FptrMapInt8Int8 + if false { + } else { + z.F.EncMapInt8Int8V(yy1743, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Int8`) + r.WriteMapElemValue() + if yyn1742 { + r.EncodeNil() + } else { + if x.FptrMapInt8Int8 == nil { + r.EncodeNil() + } else { + yy1745 := *x.FptrMapInt8Int8 + if false { + } else { + z.F.EncMapInt8Int8V(yy1745, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt8Int16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8Int16V(x.FMapInt8Int16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt8Int16`) + r.WriteMapElemValue() + if x.FMapInt8Int16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8Int16V(x.FMapInt8Int16, e) + } + } + } + var yyn1750 bool + if x.FptrMapInt8Int16 == nil { + yyn1750 = true + goto LABEL1750 + } + LABEL1750: + if yyr2 || yy2arr2 { + if yyn1750 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt8Int16 == nil { + r.EncodeNil() + } else { + yy1751 := *x.FptrMapInt8Int16 + if false { + } else { + z.F.EncMapInt8Int16V(yy1751, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Int16`) + r.WriteMapElemValue() + if yyn1750 { + r.EncodeNil() + } else { + if x.FptrMapInt8Int16 == nil { + r.EncodeNil() + } else { + yy1753 := *x.FptrMapInt8Int16 + if false { + } else { + z.F.EncMapInt8Int16V(yy1753, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt8Int32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8Int32V(x.FMapInt8Int32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt8Int32`) + r.WriteMapElemValue() + if x.FMapInt8Int32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8Int32V(x.FMapInt8Int32, e) + } + } + } + var yyn1758 bool + if x.FptrMapInt8Int32 == nil { + yyn1758 = true + goto LABEL1758 + } + LABEL1758: + if yyr2 || yy2arr2 { + if yyn1758 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt8Int32 == nil { + r.EncodeNil() + } else { + yy1759 := *x.FptrMapInt8Int32 + if false { + } else { + z.F.EncMapInt8Int32V(yy1759, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Int32`) + r.WriteMapElemValue() + if yyn1758 { + r.EncodeNil() + } else { + if x.FptrMapInt8Int32 == nil { + r.EncodeNil() + } else { + yy1761 := *x.FptrMapInt8Int32 + if false { + } else { + z.F.EncMapInt8Int32V(yy1761, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt8Int64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8Int64V(x.FMapInt8Int64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt8Int64`) + r.WriteMapElemValue() + if x.FMapInt8Int64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8Int64V(x.FMapInt8Int64, e) + } + } + } + var yyn1766 bool + if x.FptrMapInt8Int64 == nil { + yyn1766 = true + goto LABEL1766 + } + LABEL1766: + if yyr2 || yy2arr2 { + if yyn1766 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt8Int64 == nil { + r.EncodeNil() + } else { + yy1767 := *x.FptrMapInt8Int64 + if false { + } else { + z.F.EncMapInt8Int64V(yy1767, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Int64`) + r.WriteMapElemValue() + if yyn1766 { + r.EncodeNil() + } else { + if x.FptrMapInt8Int64 == nil { + r.EncodeNil() + } else { + yy1769 := *x.FptrMapInt8Int64 + if false { + } else { + z.F.EncMapInt8Int64V(yy1769, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt8Float32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8Float32V(x.FMapInt8Float32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt8Float32`) + r.WriteMapElemValue() + if x.FMapInt8Float32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8Float32V(x.FMapInt8Float32, e) + } + } + } + var yyn1774 bool + if x.FptrMapInt8Float32 == nil { + yyn1774 = true + goto LABEL1774 + } + LABEL1774: + if yyr2 || yy2arr2 { + if yyn1774 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt8Float32 == nil { + r.EncodeNil() + } else { + yy1775 := *x.FptrMapInt8Float32 + if false { + } else { + z.F.EncMapInt8Float32V(yy1775, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Float32`) + r.WriteMapElemValue() + if yyn1774 { + r.EncodeNil() + } else { + if x.FptrMapInt8Float32 == nil { + r.EncodeNil() + } else { + yy1777 := *x.FptrMapInt8Float32 + if false { + } else { + z.F.EncMapInt8Float32V(yy1777, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt8Float64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8Float64V(x.FMapInt8Float64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt8Float64`) + r.WriteMapElemValue() + if x.FMapInt8Float64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8Float64V(x.FMapInt8Float64, e) + } + } + } + var yyn1782 bool + if x.FptrMapInt8Float64 == nil { + yyn1782 = true + goto LABEL1782 + } + LABEL1782: + if yyr2 || yy2arr2 { + if yyn1782 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt8Float64 == nil { + r.EncodeNil() + } else { + yy1783 := *x.FptrMapInt8Float64 + if false { + } else { + z.F.EncMapInt8Float64V(yy1783, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Float64`) + r.WriteMapElemValue() + if yyn1782 { + r.EncodeNil() + } else { + if x.FptrMapInt8Float64 == nil { + r.EncodeNil() + } else { + yy1785 := *x.FptrMapInt8Float64 + if false { + } else { + z.F.EncMapInt8Float64V(yy1785, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt8Bool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8BoolV(x.FMapInt8Bool, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt8Bool`) + r.WriteMapElemValue() + if x.FMapInt8Bool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt8BoolV(x.FMapInt8Bool, e) + } + } + } + var yyn1790 bool + if x.FptrMapInt8Bool == nil { + yyn1790 = true + goto LABEL1790 + } + LABEL1790: + if yyr2 || yy2arr2 { + if yyn1790 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt8Bool == nil { + r.EncodeNil() + } else { + yy1791 := *x.FptrMapInt8Bool + if false { + } else { + z.F.EncMapInt8BoolV(yy1791, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt8Bool`) + r.WriteMapElemValue() + if yyn1790 { + r.EncodeNil() + } else { + if x.FptrMapInt8Bool == nil { + r.EncodeNil() + } else { + yy1793 := *x.FptrMapInt8Bool + if false { + } else { + z.F.EncMapInt8BoolV(yy1793, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt16Intf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16IntfV(x.FMapInt16Intf, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt16Intf`) + r.WriteMapElemValue() + if x.FMapInt16Intf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16IntfV(x.FMapInt16Intf, e) + } + } + } + var yyn1798 bool + if x.FptrMapInt16Intf == nil { + yyn1798 = true + goto LABEL1798 + } + LABEL1798: + if yyr2 || yy2arr2 { + if yyn1798 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt16Intf == nil { + r.EncodeNil() + } else { + yy1799 := *x.FptrMapInt16Intf + if false { + } else { + z.F.EncMapInt16IntfV(yy1799, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Intf`) + r.WriteMapElemValue() + if yyn1798 { + r.EncodeNil() + } else { + if x.FptrMapInt16Intf == nil { + r.EncodeNil() + } else { + yy1801 := *x.FptrMapInt16Intf + if false { + } else { + z.F.EncMapInt16IntfV(yy1801, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt16String == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16StringV(x.FMapInt16String, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt16String`) + r.WriteMapElemValue() + if x.FMapInt16String == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16StringV(x.FMapInt16String, e) + } + } + } + var yyn1806 bool + if x.FptrMapInt16String == nil { + yyn1806 = true + goto LABEL1806 + } + LABEL1806: + if yyr2 || yy2arr2 { + if yyn1806 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt16String == nil { + r.EncodeNil() + } else { + yy1807 := *x.FptrMapInt16String + if false { + } else { + z.F.EncMapInt16StringV(yy1807, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16String`) + r.WriteMapElemValue() + if yyn1806 { + r.EncodeNil() + } else { + if x.FptrMapInt16String == nil { + r.EncodeNil() + } else { + yy1809 := *x.FptrMapInt16String + if false { + } else { + z.F.EncMapInt16StringV(yy1809, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt16Uint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16UintV(x.FMapInt16Uint, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt16Uint`) + r.WriteMapElemValue() + if x.FMapInt16Uint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16UintV(x.FMapInt16Uint, e) + } + } + } + var yyn1814 bool + if x.FptrMapInt16Uint == nil { + yyn1814 = true + goto LABEL1814 + } + LABEL1814: + if yyr2 || yy2arr2 { + if yyn1814 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt16Uint == nil { + r.EncodeNil() + } else { + yy1815 := *x.FptrMapInt16Uint + if false { + } else { + z.F.EncMapInt16UintV(yy1815, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Uint`) + r.WriteMapElemValue() + if yyn1814 { + r.EncodeNil() + } else { + if x.FptrMapInt16Uint == nil { + r.EncodeNil() + } else { + yy1817 := *x.FptrMapInt16Uint + if false { + } else { + z.F.EncMapInt16UintV(yy1817, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt16Uint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16Uint8V(x.FMapInt16Uint8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt16Uint8`) + r.WriteMapElemValue() + if x.FMapInt16Uint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16Uint8V(x.FMapInt16Uint8, e) + } + } + } + var yyn1822 bool + if x.FptrMapInt16Uint8 == nil { + yyn1822 = true + goto LABEL1822 + } + LABEL1822: + if yyr2 || yy2arr2 { + if yyn1822 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt16Uint8 == nil { + r.EncodeNil() + } else { + yy1823 := *x.FptrMapInt16Uint8 + if false { + } else { + z.F.EncMapInt16Uint8V(yy1823, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Uint8`) + r.WriteMapElemValue() + if yyn1822 { + r.EncodeNil() + } else { + if x.FptrMapInt16Uint8 == nil { + r.EncodeNil() + } else { + yy1825 := *x.FptrMapInt16Uint8 + if false { + } else { + z.F.EncMapInt16Uint8V(yy1825, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt16Uint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16Uint16V(x.FMapInt16Uint16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt16Uint16`) + r.WriteMapElemValue() + if x.FMapInt16Uint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16Uint16V(x.FMapInt16Uint16, e) + } + } + } + var yyn1830 bool + if x.FptrMapInt16Uint16 == nil { + yyn1830 = true + goto LABEL1830 + } + LABEL1830: + if yyr2 || yy2arr2 { + if yyn1830 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt16Uint16 == nil { + r.EncodeNil() + } else { + yy1831 := *x.FptrMapInt16Uint16 + if false { + } else { + z.F.EncMapInt16Uint16V(yy1831, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Uint16`) + r.WriteMapElemValue() + if yyn1830 { + r.EncodeNil() + } else { + if x.FptrMapInt16Uint16 == nil { + r.EncodeNil() + } else { + yy1833 := *x.FptrMapInt16Uint16 + if false { + } else { + z.F.EncMapInt16Uint16V(yy1833, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt16Uint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16Uint32V(x.FMapInt16Uint32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt16Uint32`) + r.WriteMapElemValue() + if x.FMapInt16Uint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16Uint32V(x.FMapInt16Uint32, e) + } + } + } + var yyn1838 bool + if x.FptrMapInt16Uint32 == nil { + yyn1838 = true + goto LABEL1838 + } + LABEL1838: + if yyr2 || yy2arr2 { + if yyn1838 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt16Uint32 == nil { + r.EncodeNil() + } else { + yy1839 := *x.FptrMapInt16Uint32 + if false { + } else { + z.F.EncMapInt16Uint32V(yy1839, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Uint32`) + r.WriteMapElemValue() + if yyn1838 { + r.EncodeNil() + } else { + if x.FptrMapInt16Uint32 == nil { + r.EncodeNil() + } else { + yy1841 := *x.FptrMapInt16Uint32 + if false { + } else { + z.F.EncMapInt16Uint32V(yy1841, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt16Uint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16Uint64V(x.FMapInt16Uint64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt16Uint64`) + r.WriteMapElemValue() + if x.FMapInt16Uint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16Uint64V(x.FMapInt16Uint64, e) + } + } + } + var yyn1846 bool + if x.FptrMapInt16Uint64 == nil { + yyn1846 = true + goto LABEL1846 + } + LABEL1846: + if yyr2 || yy2arr2 { + if yyn1846 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt16Uint64 == nil { + r.EncodeNil() + } else { + yy1847 := *x.FptrMapInt16Uint64 + if false { + } else { + z.F.EncMapInt16Uint64V(yy1847, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Uint64`) + r.WriteMapElemValue() + if yyn1846 { + r.EncodeNil() + } else { + if x.FptrMapInt16Uint64 == nil { + r.EncodeNil() + } else { + yy1849 := *x.FptrMapInt16Uint64 + if false { + } else { + z.F.EncMapInt16Uint64V(yy1849, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt16Uintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16UintptrV(x.FMapInt16Uintptr, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt16Uintptr`) + r.WriteMapElemValue() + if x.FMapInt16Uintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16UintptrV(x.FMapInt16Uintptr, e) + } + } + } + var yyn1854 bool + if x.FptrMapInt16Uintptr == nil { + yyn1854 = true + goto LABEL1854 + } + LABEL1854: + if yyr2 || yy2arr2 { + if yyn1854 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt16Uintptr == nil { + r.EncodeNil() + } else { + yy1855 := *x.FptrMapInt16Uintptr + if false { + } else { + z.F.EncMapInt16UintptrV(yy1855, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Uintptr`) + r.WriteMapElemValue() + if yyn1854 { + r.EncodeNil() + } else { + if x.FptrMapInt16Uintptr == nil { + r.EncodeNil() + } else { + yy1857 := *x.FptrMapInt16Uintptr + if false { + } else { + z.F.EncMapInt16UintptrV(yy1857, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt16Int == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16IntV(x.FMapInt16Int, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt16Int`) + r.WriteMapElemValue() + if x.FMapInt16Int == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16IntV(x.FMapInt16Int, e) + } + } + } + var yyn1862 bool + if x.FptrMapInt16Int == nil { + yyn1862 = true + goto LABEL1862 + } + LABEL1862: + if yyr2 || yy2arr2 { + if yyn1862 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt16Int == nil { + r.EncodeNil() + } else { + yy1863 := *x.FptrMapInt16Int + if false { + } else { + z.F.EncMapInt16IntV(yy1863, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Int`) + r.WriteMapElemValue() + if yyn1862 { + r.EncodeNil() + } else { + if x.FptrMapInt16Int == nil { + r.EncodeNil() + } else { + yy1865 := *x.FptrMapInt16Int + if false { + } else { + z.F.EncMapInt16IntV(yy1865, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt16Int8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16Int8V(x.FMapInt16Int8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt16Int8`) + r.WriteMapElemValue() + if x.FMapInt16Int8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16Int8V(x.FMapInt16Int8, e) + } + } + } + var yyn1870 bool + if x.FptrMapInt16Int8 == nil { + yyn1870 = true + goto LABEL1870 + } + LABEL1870: + if yyr2 || yy2arr2 { + if yyn1870 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt16Int8 == nil { + r.EncodeNil() + } else { + yy1871 := *x.FptrMapInt16Int8 + if false { + } else { + z.F.EncMapInt16Int8V(yy1871, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Int8`) + r.WriteMapElemValue() + if yyn1870 { + r.EncodeNil() + } else { + if x.FptrMapInt16Int8 == nil { + r.EncodeNil() + } else { + yy1873 := *x.FptrMapInt16Int8 + if false { + } else { + z.F.EncMapInt16Int8V(yy1873, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt16Int16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16Int16V(x.FMapInt16Int16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt16Int16`) + r.WriteMapElemValue() + if x.FMapInt16Int16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16Int16V(x.FMapInt16Int16, e) + } + } + } + var yyn1878 bool + if x.FptrMapInt16Int16 == nil { + yyn1878 = true + goto LABEL1878 + } + LABEL1878: + if yyr2 || yy2arr2 { + if yyn1878 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt16Int16 == nil { + r.EncodeNil() + } else { + yy1879 := *x.FptrMapInt16Int16 + if false { + } else { + z.F.EncMapInt16Int16V(yy1879, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Int16`) + r.WriteMapElemValue() + if yyn1878 { + r.EncodeNil() + } else { + if x.FptrMapInt16Int16 == nil { + r.EncodeNil() + } else { + yy1881 := *x.FptrMapInt16Int16 + if false { + } else { + z.F.EncMapInt16Int16V(yy1881, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt16Int32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16Int32V(x.FMapInt16Int32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt16Int32`) + r.WriteMapElemValue() + if x.FMapInt16Int32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16Int32V(x.FMapInt16Int32, e) + } + } + } + var yyn1886 bool + if x.FptrMapInt16Int32 == nil { + yyn1886 = true + goto LABEL1886 + } + LABEL1886: + if yyr2 || yy2arr2 { + if yyn1886 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt16Int32 == nil { + r.EncodeNil() + } else { + yy1887 := *x.FptrMapInt16Int32 + if false { + } else { + z.F.EncMapInt16Int32V(yy1887, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Int32`) + r.WriteMapElemValue() + if yyn1886 { + r.EncodeNil() + } else { + if x.FptrMapInt16Int32 == nil { + r.EncodeNil() + } else { + yy1889 := *x.FptrMapInt16Int32 + if false { + } else { + z.F.EncMapInt16Int32V(yy1889, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt16Int64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16Int64V(x.FMapInt16Int64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt16Int64`) + r.WriteMapElemValue() + if x.FMapInt16Int64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16Int64V(x.FMapInt16Int64, e) + } + } + } + var yyn1894 bool + if x.FptrMapInt16Int64 == nil { + yyn1894 = true + goto LABEL1894 + } + LABEL1894: + if yyr2 || yy2arr2 { + if yyn1894 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt16Int64 == nil { + r.EncodeNil() + } else { + yy1895 := *x.FptrMapInt16Int64 + if false { + } else { + z.F.EncMapInt16Int64V(yy1895, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Int64`) + r.WriteMapElemValue() + if yyn1894 { + r.EncodeNil() + } else { + if x.FptrMapInt16Int64 == nil { + r.EncodeNil() + } else { + yy1897 := *x.FptrMapInt16Int64 + if false { + } else { + z.F.EncMapInt16Int64V(yy1897, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt16Float32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16Float32V(x.FMapInt16Float32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt16Float32`) + r.WriteMapElemValue() + if x.FMapInt16Float32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16Float32V(x.FMapInt16Float32, e) + } + } + } + var yyn1902 bool + if x.FptrMapInt16Float32 == nil { + yyn1902 = true + goto LABEL1902 + } + LABEL1902: + if yyr2 || yy2arr2 { + if yyn1902 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt16Float32 == nil { + r.EncodeNil() + } else { + yy1903 := *x.FptrMapInt16Float32 + if false { + } else { + z.F.EncMapInt16Float32V(yy1903, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Float32`) + r.WriteMapElemValue() + if yyn1902 { + r.EncodeNil() + } else { + if x.FptrMapInt16Float32 == nil { + r.EncodeNil() + } else { + yy1905 := *x.FptrMapInt16Float32 + if false { + } else { + z.F.EncMapInt16Float32V(yy1905, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt16Float64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16Float64V(x.FMapInt16Float64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt16Float64`) + r.WriteMapElemValue() + if x.FMapInt16Float64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16Float64V(x.FMapInt16Float64, e) + } + } + } + var yyn1910 bool + if x.FptrMapInt16Float64 == nil { + yyn1910 = true + goto LABEL1910 + } + LABEL1910: + if yyr2 || yy2arr2 { + if yyn1910 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt16Float64 == nil { + r.EncodeNil() + } else { + yy1911 := *x.FptrMapInt16Float64 + if false { + } else { + z.F.EncMapInt16Float64V(yy1911, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Float64`) + r.WriteMapElemValue() + if yyn1910 { + r.EncodeNil() + } else { + if x.FptrMapInt16Float64 == nil { + r.EncodeNil() + } else { + yy1913 := *x.FptrMapInt16Float64 + if false { + } else { + z.F.EncMapInt16Float64V(yy1913, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt16Bool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16BoolV(x.FMapInt16Bool, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt16Bool`) + r.WriteMapElemValue() + if x.FMapInt16Bool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt16BoolV(x.FMapInt16Bool, e) + } + } + } + var yyn1918 bool + if x.FptrMapInt16Bool == nil { + yyn1918 = true + goto LABEL1918 + } + LABEL1918: + if yyr2 || yy2arr2 { + if yyn1918 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt16Bool == nil { + r.EncodeNil() + } else { + yy1919 := *x.FptrMapInt16Bool + if false { + } else { + z.F.EncMapInt16BoolV(yy1919, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt16Bool`) + r.WriteMapElemValue() + if yyn1918 { + r.EncodeNil() + } else { + if x.FptrMapInt16Bool == nil { + r.EncodeNil() + } else { + yy1921 := *x.FptrMapInt16Bool + if false { + } else { + z.F.EncMapInt16BoolV(yy1921, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt32Intf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32IntfV(x.FMapInt32Intf, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt32Intf`) + r.WriteMapElemValue() + if x.FMapInt32Intf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32IntfV(x.FMapInt32Intf, e) + } + } + } + var yyn1926 bool + if x.FptrMapInt32Intf == nil { + yyn1926 = true + goto LABEL1926 + } + LABEL1926: + if yyr2 || yy2arr2 { + if yyn1926 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt32Intf == nil { + r.EncodeNil() + } else { + yy1927 := *x.FptrMapInt32Intf + if false { + } else { + z.F.EncMapInt32IntfV(yy1927, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Intf`) + r.WriteMapElemValue() + if yyn1926 { + r.EncodeNil() + } else { + if x.FptrMapInt32Intf == nil { + r.EncodeNil() + } else { + yy1929 := *x.FptrMapInt32Intf + if false { + } else { + z.F.EncMapInt32IntfV(yy1929, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt32String == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32StringV(x.FMapInt32String, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt32String`) + r.WriteMapElemValue() + if x.FMapInt32String == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32StringV(x.FMapInt32String, e) + } + } + } + var yyn1934 bool + if x.FptrMapInt32String == nil { + yyn1934 = true + goto LABEL1934 + } + LABEL1934: + if yyr2 || yy2arr2 { + if yyn1934 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt32String == nil { + r.EncodeNil() + } else { + yy1935 := *x.FptrMapInt32String + if false { + } else { + z.F.EncMapInt32StringV(yy1935, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32String`) + r.WriteMapElemValue() + if yyn1934 { + r.EncodeNil() + } else { + if x.FptrMapInt32String == nil { + r.EncodeNil() + } else { + yy1937 := *x.FptrMapInt32String + if false { + } else { + z.F.EncMapInt32StringV(yy1937, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt32Uint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32UintV(x.FMapInt32Uint, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt32Uint`) + r.WriteMapElemValue() + if x.FMapInt32Uint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32UintV(x.FMapInt32Uint, e) + } + } + } + var yyn1942 bool + if x.FptrMapInt32Uint == nil { + yyn1942 = true + goto LABEL1942 + } + LABEL1942: + if yyr2 || yy2arr2 { + if yyn1942 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt32Uint == nil { + r.EncodeNil() + } else { + yy1943 := *x.FptrMapInt32Uint + if false { + } else { + z.F.EncMapInt32UintV(yy1943, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Uint`) + r.WriteMapElemValue() + if yyn1942 { + r.EncodeNil() + } else { + if x.FptrMapInt32Uint == nil { + r.EncodeNil() + } else { + yy1945 := *x.FptrMapInt32Uint + if false { + } else { + z.F.EncMapInt32UintV(yy1945, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt32Uint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32Uint8V(x.FMapInt32Uint8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt32Uint8`) + r.WriteMapElemValue() + if x.FMapInt32Uint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32Uint8V(x.FMapInt32Uint8, e) + } + } + } + var yyn1950 bool + if x.FptrMapInt32Uint8 == nil { + yyn1950 = true + goto LABEL1950 + } + LABEL1950: + if yyr2 || yy2arr2 { + if yyn1950 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt32Uint8 == nil { + r.EncodeNil() + } else { + yy1951 := *x.FptrMapInt32Uint8 + if false { + } else { + z.F.EncMapInt32Uint8V(yy1951, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Uint8`) + r.WriteMapElemValue() + if yyn1950 { + r.EncodeNil() + } else { + if x.FptrMapInt32Uint8 == nil { + r.EncodeNil() + } else { + yy1953 := *x.FptrMapInt32Uint8 + if false { + } else { + z.F.EncMapInt32Uint8V(yy1953, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt32Uint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32Uint16V(x.FMapInt32Uint16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt32Uint16`) + r.WriteMapElemValue() + if x.FMapInt32Uint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32Uint16V(x.FMapInt32Uint16, e) + } + } + } + var yyn1958 bool + if x.FptrMapInt32Uint16 == nil { + yyn1958 = true + goto LABEL1958 + } + LABEL1958: + if yyr2 || yy2arr2 { + if yyn1958 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt32Uint16 == nil { + r.EncodeNil() + } else { + yy1959 := *x.FptrMapInt32Uint16 + if false { + } else { + z.F.EncMapInt32Uint16V(yy1959, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Uint16`) + r.WriteMapElemValue() + if yyn1958 { + r.EncodeNil() + } else { + if x.FptrMapInt32Uint16 == nil { + r.EncodeNil() + } else { + yy1961 := *x.FptrMapInt32Uint16 + if false { + } else { + z.F.EncMapInt32Uint16V(yy1961, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt32Uint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32Uint32V(x.FMapInt32Uint32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt32Uint32`) + r.WriteMapElemValue() + if x.FMapInt32Uint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32Uint32V(x.FMapInt32Uint32, e) + } + } + } + var yyn1966 bool + if x.FptrMapInt32Uint32 == nil { + yyn1966 = true + goto LABEL1966 + } + LABEL1966: + if yyr2 || yy2arr2 { + if yyn1966 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt32Uint32 == nil { + r.EncodeNil() + } else { + yy1967 := *x.FptrMapInt32Uint32 + if false { + } else { + z.F.EncMapInt32Uint32V(yy1967, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Uint32`) + r.WriteMapElemValue() + if yyn1966 { + r.EncodeNil() + } else { + if x.FptrMapInt32Uint32 == nil { + r.EncodeNil() + } else { + yy1969 := *x.FptrMapInt32Uint32 + if false { + } else { + z.F.EncMapInt32Uint32V(yy1969, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt32Uint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32Uint64V(x.FMapInt32Uint64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt32Uint64`) + r.WriteMapElemValue() + if x.FMapInt32Uint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32Uint64V(x.FMapInt32Uint64, e) + } + } + } + var yyn1974 bool + if x.FptrMapInt32Uint64 == nil { + yyn1974 = true + goto LABEL1974 + } + LABEL1974: + if yyr2 || yy2arr2 { + if yyn1974 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt32Uint64 == nil { + r.EncodeNil() + } else { + yy1975 := *x.FptrMapInt32Uint64 + if false { + } else { + z.F.EncMapInt32Uint64V(yy1975, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Uint64`) + r.WriteMapElemValue() + if yyn1974 { + r.EncodeNil() + } else { + if x.FptrMapInt32Uint64 == nil { + r.EncodeNil() + } else { + yy1977 := *x.FptrMapInt32Uint64 + if false { + } else { + z.F.EncMapInt32Uint64V(yy1977, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt32Uintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32UintptrV(x.FMapInt32Uintptr, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt32Uintptr`) + r.WriteMapElemValue() + if x.FMapInt32Uintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32UintptrV(x.FMapInt32Uintptr, e) + } + } + } + var yyn1982 bool + if x.FptrMapInt32Uintptr == nil { + yyn1982 = true + goto LABEL1982 + } + LABEL1982: + if yyr2 || yy2arr2 { + if yyn1982 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt32Uintptr == nil { + r.EncodeNil() + } else { + yy1983 := *x.FptrMapInt32Uintptr + if false { + } else { + z.F.EncMapInt32UintptrV(yy1983, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Uintptr`) + r.WriteMapElemValue() + if yyn1982 { + r.EncodeNil() + } else { + if x.FptrMapInt32Uintptr == nil { + r.EncodeNil() + } else { + yy1985 := *x.FptrMapInt32Uintptr + if false { + } else { + z.F.EncMapInt32UintptrV(yy1985, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt32Int == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32IntV(x.FMapInt32Int, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt32Int`) + r.WriteMapElemValue() + if x.FMapInt32Int == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32IntV(x.FMapInt32Int, e) + } + } + } + var yyn1990 bool + if x.FptrMapInt32Int == nil { + yyn1990 = true + goto LABEL1990 + } + LABEL1990: + if yyr2 || yy2arr2 { + if yyn1990 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt32Int == nil { + r.EncodeNil() + } else { + yy1991 := *x.FptrMapInt32Int + if false { + } else { + z.F.EncMapInt32IntV(yy1991, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Int`) + r.WriteMapElemValue() + if yyn1990 { + r.EncodeNil() + } else { + if x.FptrMapInt32Int == nil { + r.EncodeNil() + } else { + yy1993 := *x.FptrMapInt32Int + if false { + } else { + z.F.EncMapInt32IntV(yy1993, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt32Int8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32Int8V(x.FMapInt32Int8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt32Int8`) + r.WriteMapElemValue() + if x.FMapInt32Int8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32Int8V(x.FMapInt32Int8, e) + } + } + } + var yyn1998 bool + if x.FptrMapInt32Int8 == nil { + yyn1998 = true + goto LABEL1998 + } + LABEL1998: + if yyr2 || yy2arr2 { + if yyn1998 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt32Int8 == nil { + r.EncodeNil() + } else { + yy1999 := *x.FptrMapInt32Int8 + if false { + } else { + z.F.EncMapInt32Int8V(yy1999, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Int8`) + r.WriteMapElemValue() + if yyn1998 { + r.EncodeNil() + } else { + if x.FptrMapInt32Int8 == nil { + r.EncodeNil() + } else { + yy2001 := *x.FptrMapInt32Int8 + if false { + } else { + z.F.EncMapInt32Int8V(yy2001, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt32Int16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32Int16V(x.FMapInt32Int16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt32Int16`) + r.WriteMapElemValue() + if x.FMapInt32Int16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32Int16V(x.FMapInt32Int16, e) + } + } + } + var yyn2006 bool + if x.FptrMapInt32Int16 == nil { + yyn2006 = true + goto LABEL2006 + } + LABEL2006: + if yyr2 || yy2arr2 { + if yyn2006 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt32Int16 == nil { + r.EncodeNil() + } else { + yy2007 := *x.FptrMapInt32Int16 + if false { + } else { + z.F.EncMapInt32Int16V(yy2007, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Int16`) + r.WriteMapElemValue() + if yyn2006 { + r.EncodeNil() + } else { + if x.FptrMapInt32Int16 == nil { + r.EncodeNil() + } else { + yy2009 := *x.FptrMapInt32Int16 + if false { + } else { + z.F.EncMapInt32Int16V(yy2009, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt32Int32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32Int32V(x.FMapInt32Int32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt32Int32`) + r.WriteMapElemValue() + if x.FMapInt32Int32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32Int32V(x.FMapInt32Int32, e) + } + } + } + var yyn2014 bool + if x.FptrMapInt32Int32 == nil { + yyn2014 = true + goto LABEL2014 + } + LABEL2014: + if yyr2 || yy2arr2 { + if yyn2014 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt32Int32 == nil { + r.EncodeNil() + } else { + yy2015 := *x.FptrMapInt32Int32 + if false { + } else { + z.F.EncMapInt32Int32V(yy2015, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Int32`) + r.WriteMapElemValue() + if yyn2014 { + r.EncodeNil() + } else { + if x.FptrMapInt32Int32 == nil { + r.EncodeNil() + } else { + yy2017 := *x.FptrMapInt32Int32 + if false { + } else { + z.F.EncMapInt32Int32V(yy2017, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt32Int64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32Int64V(x.FMapInt32Int64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt32Int64`) + r.WriteMapElemValue() + if x.FMapInt32Int64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32Int64V(x.FMapInt32Int64, e) + } + } + } + var yyn2022 bool + if x.FptrMapInt32Int64 == nil { + yyn2022 = true + goto LABEL2022 + } + LABEL2022: + if yyr2 || yy2arr2 { + if yyn2022 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt32Int64 == nil { + r.EncodeNil() + } else { + yy2023 := *x.FptrMapInt32Int64 + if false { + } else { + z.F.EncMapInt32Int64V(yy2023, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Int64`) + r.WriteMapElemValue() + if yyn2022 { + r.EncodeNil() + } else { + if x.FptrMapInt32Int64 == nil { + r.EncodeNil() + } else { + yy2025 := *x.FptrMapInt32Int64 + if false { + } else { + z.F.EncMapInt32Int64V(yy2025, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt32Float32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32Float32V(x.FMapInt32Float32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt32Float32`) + r.WriteMapElemValue() + if x.FMapInt32Float32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32Float32V(x.FMapInt32Float32, e) + } + } + } + var yyn2030 bool + if x.FptrMapInt32Float32 == nil { + yyn2030 = true + goto LABEL2030 + } + LABEL2030: + if yyr2 || yy2arr2 { + if yyn2030 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt32Float32 == nil { + r.EncodeNil() + } else { + yy2031 := *x.FptrMapInt32Float32 + if false { + } else { + z.F.EncMapInt32Float32V(yy2031, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Float32`) + r.WriteMapElemValue() + if yyn2030 { + r.EncodeNil() + } else { + if x.FptrMapInt32Float32 == nil { + r.EncodeNil() + } else { + yy2033 := *x.FptrMapInt32Float32 + if false { + } else { + z.F.EncMapInt32Float32V(yy2033, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt32Float64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32Float64V(x.FMapInt32Float64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt32Float64`) + r.WriteMapElemValue() + if x.FMapInt32Float64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32Float64V(x.FMapInt32Float64, e) + } + } + } + var yyn2038 bool + if x.FptrMapInt32Float64 == nil { + yyn2038 = true + goto LABEL2038 + } + LABEL2038: + if yyr2 || yy2arr2 { + if yyn2038 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt32Float64 == nil { + r.EncodeNil() + } else { + yy2039 := *x.FptrMapInt32Float64 + if false { + } else { + z.F.EncMapInt32Float64V(yy2039, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Float64`) + r.WriteMapElemValue() + if yyn2038 { + r.EncodeNil() + } else { + if x.FptrMapInt32Float64 == nil { + r.EncodeNil() + } else { + yy2041 := *x.FptrMapInt32Float64 + if false { + } else { + z.F.EncMapInt32Float64V(yy2041, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt32Bool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32BoolV(x.FMapInt32Bool, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt32Bool`) + r.WriteMapElemValue() + if x.FMapInt32Bool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt32BoolV(x.FMapInt32Bool, e) + } + } + } + var yyn2046 bool + if x.FptrMapInt32Bool == nil { + yyn2046 = true + goto LABEL2046 + } + LABEL2046: + if yyr2 || yy2arr2 { + if yyn2046 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt32Bool == nil { + r.EncodeNil() + } else { + yy2047 := *x.FptrMapInt32Bool + if false { + } else { + z.F.EncMapInt32BoolV(yy2047, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt32Bool`) + r.WriteMapElemValue() + if yyn2046 { + r.EncodeNil() + } else { + if x.FptrMapInt32Bool == nil { + r.EncodeNil() + } else { + yy2049 := *x.FptrMapInt32Bool + if false { + } else { + z.F.EncMapInt32BoolV(yy2049, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt64Intf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64IntfV(x.FMapInt64Intf, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt64Intf`) + r.WriteMapElemValue() + if x.FMapInt64Intf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64IntfV(x.FMapInt64Intf, e) + } + } + } + var yyn2054 bool + if x.FptrMapInt64Intf == nil { + yyn2054 = true + goto LABEL2054 + } + LABEL2054: + if yyr2 || yy2arr2 { + if yyn2054 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt64Intf == nil { + r.EncodeNil() + } else { + yy2055 := *x.FptrMapInt64Intf + if false { + } else { + z.F.EncMapInt64IntfV(yy2055, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Intf`) + r.WriteMapElemValue() + if yyn2054 { + r.EncodeNil() + } else { + if x.FptrMapInt64Intf == nil { + r.EncodeNil() + } else { + yy2057 := *x.FptrMapInt64Intf + if false { + } else { + z.F.EncMapInt64IntfV(yy2057, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt64String == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64StringV(x.FMapInt64String, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt64String`) + r.WriteMapElemValue() + if x.FMapInt64String == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64StringV(x.FMapInt64String, e) + } + } + } + var yyn2062 bool + if x.FptrMapInt64String == nil { + yyn2062 = true + goto LABEL2062 + } + LABEL2062: + if yyr2 || yy2arr2 { + if yyn2062 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt64String == nil { + r.EncodeNil() + } else { + yy2063 := *x.FptrMapInt64String + if false { + } else { + z.F.EncMapInt64StringV(yy2063, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64String`) + r.WriteMapElemValue() + if yyn2062 { + r.EncodeNil() + } else { + if x.FptrMapInt64String == nil { + r.EncodeNil() + } else { + yy2065 := *x.FptrMapInt64String + if false { + } else { + z.F.EncMapInt64StringV(yy2065, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt64Uint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64UintV(x.FMapInt64Uint, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt64Uint`) + r.WriteMapElemValue() + if x.FMapInt64Uint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64UintV(x.FMapInt64Uint, e) + } + } + } + var yyn2070 bool + if x.FptrMapInt64Uint == nil { + yyn2070 = true + goto LABEL2070 + } + LABEL2070: + if yyr2 || yy2arr2 { + if yyn2070 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt64Uint == nil { + r.EncodeNil() + } else { + yy2071 := *x.FptrMapInt64Uint + if false { + } else { + z.F.EncMapInt64UintV(yy2071, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Uint`) + r.WriteMapElemValue() + if yyn2070 { + r.EncodeNil() + } else { + if x.FptrMapInt64Uint == nil { + r.EncodeNil() + } else { + yy2073 := *x.FptrMapInt64Uint + if false { + } else { + z.F.EncMapInt64UintV(yy2073, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt64Uint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64Uint8V(x.FMapInt64Uint8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt64Uint8`) + r.WriteMapElemValue() + if x.FMapInt64Uint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64Uint8V(x.FMapInt64Uint8, e) + } + } + } + var yyn2078 bool + if x.FptrMapInt64Uint8 == nil { + yyn2078 = true + goto LABEL2078 + } + LABEL2078: + if yyr2 || yy2arr2 { + if yyn2078 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt64Uint8 == nil { + r.EncodeNil() + } else { + yy2079 := *x.FptrMapInt64Uint8 + if false { + } else { + z.F.EncMapInt64Uint8V(yy2079, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Uint8`) + r.WriteMapElemValue() + if yyn2078 { + r.EncodeNil() + } else { + if x.FptrMapInt64Uint8 == nil { + r.EncodeNil() + } else { + yy2081 := *x.FptrMapInt64Uint8 + if false { + } else { + z.F.EncMapInt64Uint8V(yy2081, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt64Uint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64Uint16V(x.FMapInt64Uint16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt64Uint16`) + r.WriteMapElemValue() + if x.FMapInt64Uint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64Uint16V(x.FMapInt64Uint16, e) + } + } + } + var yyn2086 bool + if x.FptrMapInt64Uint16 == nil { + yyn2086 = true + goto LABEL2086 + } + LABEL2086: + if yyr2 || yy2arr2 { + if yyn2086 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt64Uint16 == nil { + r.EncodeNil() + } else { + yy2087 := *x.FptrMapInt64Uint16 + if false { + } else { + z.F.EncMapInt64Uint16V(yy2087, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Uint16`) + r.WriteMapElemValue() + if yyn2086 { + r.EncodeNil() + } else { + if x.FptrMapInt64Uint16 == nil { + r.EncodeNil() + } else { + yy2089 := *x.FptrMapInt64Uint16 + if false { + } else { + z.F.EncMapInt64Uint16V(yy2089, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt64Uint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64Uint32V(x.FMapInt64Uint32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt64Uint32`) + r.WriteMapElemValue() + if x.FMapInt64Uint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64Uint32V(x.FMapInt64Uint32, e) + } + } + } + var yyn2094 bool + if x.FptrMapInt64Uint32 == nil { + yyn2094 = true + goto LABEL2094 + } + LABEL2094: + if yyr2 || yy2arr2 { + if yyn2094 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt64Uint32 == nil { + r.EncodeNil() + } else { + yy2095 := *x.FptrMapInt64Uint32 + if false { + } else { + z.F.EncMapInt64Uint32V(yy2095, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Uint32`) + r.WriteMapElemValue() + if yyn2094 { + r.EncodeNil() + } else { + if x.FptrMapInt64Uint32 == nil { + r.EncodeNil() + } else { + yy2097 := *x.FptrMapInt64Uint32 + if false { + } else { + z.F.EncMapInt64Uint32V(yy2097, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt64Uint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64Uint64V(x.FMapInt64Uint64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt64Uint64`) + r.WriteMapElemValue() + if x.FMapInt64Uint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64Uint64V(x.FMapInt64Uint64, e) + } + } + } + var yyn2102 bool + if x.FptrMapInt64Uint64 == nil { + yyn2102 = true + goto LABEL2102 + } + LABEL2102: + if yyr2 || yy2arr2 { + if yyn2102 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt64Uint64 == nil { + r.EncodeNil() + } else { + yy2103 := *x.FptrMapInt64Uint64 + if false { + } else { + z.F.EncMapInt64Uint64V(yy2103, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Uint64`) + r.WriteMapElemValue() + if yyn2102 { + r.EncodeNil() + } else { + if x.FptrMapInt64Uint64 == nil { + r.EncodeNil() + } else { + yy2105 := *x.FptrMapInt64Uint64 + if false { + } else { + z.F.EncMapInt64Uint64V(yy2105, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt64Uintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64UintptrV(x.FMapInt64Uintptr, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt64Uintptr`) + r.WriteMapElemValue() + if x.FMapInt64Uintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64UintptrV(x.FMapInt64Uintptr, e) + } + } + } + var yyn2110 bool + if x.FptrMapInt64Uintptr == nil { + yyn2110 = true + goto LABEL2110 + } + LABEL2110: + if yyr2 || yy2arr2 { + if yyn2110 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt64Uintptr == nil { + r.EncodeNil() + } else { + yy2111 := *x.FptrMapInt64Uintptr + if false { + } else { + z.F.EncMapInt64UintptrV(yy2111, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Uintptr`) + r.WriteMapElemValue() + if yyn2110 { + r.EncodeNil() + } else { + if x.FptrMapInt64Uintptr == nil { + r.EncodeNil() + } else { + yy2113 := *x.FptrMapInt64Uintptr + if false { + } else { + z.F.EncMapInt64UintptrV(yy2113, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt64Int == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64IntV(x.FMapInt64Int, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt64Int`) + r.WriteMapElemValue() + if x.FMapInt64Int == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64IntV(x.FMapInt64Int, e) + } + } + } + var yyn2118 bool + if x.FptrMapInt64Int == nil { + yyn2118 = true + goto LABEL2118 + } + LABEL2118: + if yyr2 || yy2arr2 { + if yyn2118 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt64Int == nil { + r.EncodeNil() + } else { + yy2119 := *x.FptrMapInt64Int + if false { + } else { + z.F.EncMapInt64IntV(yy2119, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Int`) + r.WriteMapElemValue() + if yyn2118 { + r.EncodeNil() + } else { + if x.FptrMapInt64Int == nil { + r.EncodeNil() + } else { + yy2121 := *x.FptrMapInt64Int + if false { + } else { + z.F.EncMapInt64IntV(yy2121, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt64Int8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64Int8V(x.FMapInt64Int8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt64Int8`) + r.WriteMapElemValue() + if x.FMapInt64Int8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64Int8V(x.FMapInt64Int8, e) + } + } + } + var yyn2126 bool + if x.FptrMapInt64Int8 == nil { + yyn2126 = true + goto LABEL2126 + } + LABEL2126: + if yyr2 || yy2arr2 { + if yyn2126 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt64Int8 == nil { + r.EncodeNil() + } else { + yy2127 := *x.FptrMapInt64Int8 + if false { + } else { + z.F.EncMapInt64Int8V(yy2127, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Int8`) + r.WriteMapElemValue() + if yyn2126 { + r.EncodeNil() + } else { + if x.FptrMapInt64Int8 == nil { + r.EncodeNil() + } else { + yy2129 := *x.FptrMapInt64Int8 + if false { + } else { + z.F.EncMapInt64Int8V(yy2129, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt64Int16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64Int16V(x.FMapInt64Int16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt64Int16`) + r.WriteMapElemValue() + if x.FMapInt64Int16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64Int16V(x.FMapInt64Int16, e) + } + } + } + var yyn2134 bool + if x.FptrMapInt64Int16 == nil { + yyn2134 = true + goto LABEL2134 + } + LABEL2134: + if yyr2 || yy2arr2 { + if yyn2134 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt64Int16 == nil { + r.EncodeNil() + } else { + yy2135 := *x.FptrMapInt64Int16 + if false { + } else { + z.F.EncMapInt64Int16V(yy2135, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Int16`) + r.WriteMapElemValue() + if yyn2134 { + r.EncodeNil() + } else { + if x.FptrMapInt64Int16 == nil { + r.EncodeNil() + } else { + yy2137 := *x.FptrMapInt64Int16 + if false { + } else { + z.F.EncMapInt64Int16V(yy2137, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt64Int32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64Int32V(x.FMapInt64Int32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt64Int32`) + r.WriteMapElemValue() + if x.FMapInt64Int32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64Int32V(x.FMapInt64Int32, e) + } + } + } + var yyn2142 bool + if x.FptrMapInt64Int32 == nil { + yyn2142 = true + goto LABEL2142 + } + LABEL2142: + if yyr2 || yy2arr2 { + if yyn2142 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt64Int32 == nil { + r.EncodeNil() + } else { + yy2143 := *x.FptrMapInt64Int32 + if false { + } else { + z.F.EncMapInt64Int32V(yy2143, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Int32`) + r.WriteMapElemValue() + if yyn2142 { + r.EncodeNil() + } else { + if x.FptrMapInt64Int32 == nil { + r.EncodeNil() + } else { + yy2145 := *x.FptrMapInt64Int32 + if false { + } else { + z.F.EncMapInt64Int32V(yy2145, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt64Int64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64Int64V(x.FMapInt64Int64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt64Int64`) + r.WriteMapElemValue() + if x.FMapInt64Int64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64Int64V(x.FMapInt64Int64, e) + } + } + } + var yyn2150 bool + if x.FptrMapInt64Int64 == nil { + yyn2150 = true + goto LABEL2150 + } + LABEL2150: + if yyr2 || yy2arr2 { + if yyn2150 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt64Int64 == nil { + r.EncodeNil() + } else { + yy2151 := *x.FptrMapInt64Int64 + if false { + } else { + z.F.EncMapInt64Int64V(yy2151, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Int64`) + r.WriteMapElemValue() + if yyn2150 { + r.EncodeNil() + } else { + if x.FptrMapInt64Int64 == nil { + r.EncodeNil() + } else { + yy2153 := *x.FptrMapInt64Int64 + if false { + } else { + z.F.EncMapInt64Int64V(yy2153, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt64Float32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64Float32V(x.FMapInt64Float32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt64Float32`) + r.WriteMapElemValue() + if x.FMapInt64Float32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64Float32V(x.FMapInt64Float32, e) + } + } + } + var yyn2158 bool + if x.FptrMapInt64Float32 == nil { + yyn2158 = true + goto LABEL2158 + } + LABEL2158: + if yyr2 || yy2arr2 { + if yyn2158 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt64Float32 == nil { + r.EncodeNil() + } else { + yy2159 := *x.FptrMapInt64Float32 + if false { + } else { + z.F.EncMapInt64Float32V(yy2159, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Float32`) + r.WriteMapElemValue() + if yyn2158 { + r.EncodeNil() + } else { + if x.FptrMapInt64Float32 == nil { + r.EncodeNil() + } else { + yy2161 := *x.FptrMapInt64Float32 + if false { + } else { + z.F.EncMapInt64Float32V(yy2161, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt64Float64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64Float64V(x.FMapInt64Float64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt64Float64`) + r.WriteMapElemValue() + if x.FMapInt64Float64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64Float64V(x.FMapInt64Float64, e) + } + } + } + var yyn2166 bool + if x.FptrMapInt64Float64 == nil { + yyn2166 = true + goto LABEL2166 + } + LABEL2166: + if yyr2 || yy2arr2 { + if yyn2166 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt64Float64 == nil { + r.EncodeNil() + } else { + yy2167 := *x.FptrMapInt64Float64 + if false { + } else { + z.F.EncMapInt64Float64V(yy2167, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Float64`) + r.WriteMapElemValue() + if yyn2166 { + r.EncodeNil() + } else { + if x.FptrMapInt64Float64 == nil { + r.EncodeNil() + } else { + yy2169 := *x.FptrMapInt64Float64 + if false { + } else { + z.F.EncMapInt64Float64V(yy2169, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapInt64Bool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64BoolV(x.FMapInt64Bool, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapInt64Bool`) + r.WriteMapElemValue() + if x.FMapInt64Bool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapInt64BoolV(x.FMapInt64Bool, e) + } + } + } + var yyn2174 bool + if x.FptrMapInt64Bool == nil { + yyn2174 = true + goto LABEL2174 + } + LABEL2174: + if yyr2 || yy2arr2 { + if yyn2174 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapInt64Bool == nil { + r.EncodeNil() + } else { + yy2175 := *x.FptrMapInt64Bool + if false { + } else { + z.F.EncMapInt64BoolV(yy2175, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapInt64Bool`) + r.WriteMapElemValue() + if yyn2174 { + r.EncodeNil() + } else { + if x.FptrMapInt64Bool == nil { + r.EncodeNil() + } else { + yy2177 := *x.FptrMapInt64Bool + if false { + } else { + z.F.EncMapInt64BoolV(yy2177, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapBoolIntf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolIntfV(x.FMapBoolIntf, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapBoolIntf`) + r.WriteMapElemValue() + if x.FMapBoolIntf == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolIntfV(x.FMapBoolIntf, e) + } + } + } + var yyn2182 bool + if x.FptrMapBoolIntf == nil { + yyn2182 = true + goto LABEL2182 + } + LABEL2182: + if yyr2 || yy2arr2 { + if yyn2182 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapBoolIntf == nil { + r.EncodeNil() + } else { + yy2183 := *x.FptrMapBoolIntf + if false { + } else { + z.F.EncMapBoolIntfV(yy2183, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolIntf`) + r.WriteMapElemValue() + if yyn2182 { + r.EncodeNil() + } else { + if x.FptrMapBoolIntf == nil { + r.EncodeNil() + } else { + yy2185 := *x.FptrMapBoolIntf + if false { + } else { + z.F.EncMapBoolIntfV(yy2185, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapBoolString == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolStringV(x.FMapBoolString, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapBoolString`) + r.WriteMapElemValue() + if x.FMapBoolString == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolStringV(x.FMapBoolString, e) + } + } + } + var yyn2190 bool + if x.FptrMapBoolString == nil { + yyn2190 = true + goto LABEL2190 + } + LABEL2190: + if yyr2 || yy2arr2 { + if yyn2190 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapBoolString == nil { + r.EncodeNil() + } else { + yy2191 := *x.FptrMapBoolString + if false { + } else { + z.F.EncMapBoolStringV(yy2191, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolString`) + r.WriteMapElemValue() + if yyn2190 { + r.EncodeNil() + } else { + if x.FptrMapBoolString == nil { + r.EncodeNil() + } else { + yy2193 := *x.FptrMapBoolString + if false { + } else { + z.F.EncMapBoolStringV(yy2193, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapBoolUint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolUintV(x.FMapBoolUint, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapBoolUint`) + r.WriteMapElemValue() + if x.FMapBoolUint == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolUintV(x.FMapBoolUint, e) + } + } + } + var yyn2198 bool + if x.FptrMapBoolUint == nil { + yyn2198 = true + goto LABEL2198 + } + LABEL2198: + if yyr2 || yy2arr2 { + if yyn2198 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapBoolUint == nil { + r.EncodeNil() + } else { + yy2199 := *x.FptrMapBoolUint + if false { + } else { + z.F.EncMapBoolUintV(yy2199, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolUint`) + r.WriteMapElemValue() + if yyn2198 { + r.EncodeNil() + } else { + if x.FptrMapBoolUint == nil { + r.EncodeNil() + } else { + yy2201 := *x.FptrMapBoolUint + if false { + } else { + z.F.EncMapBoolUintV(yy2201, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapBoolUint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolUint8V(x.FMapBoolUint8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapBoolUint8`) + r.WriteMapElemValue() + if x.FMapBoolUint8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolUint8V(x.FMapBoolUint8, e) + } + } + } + var yyn2206 bool + if x.FptrMapBoolUint8 == nil { + yyn2206 = true + goto LABEL2206 + } + LABEL2206: + if yyr2 || yy2arr2 { + if yyn2206 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapBoolUint8 == nil { + r.EncodeNil() + } else { + yy2207 := *x.FptrMapBoolUint8 + if false { + } else { + z.F.EncMapBoolUint8V(yy2207, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolUint8`) + r.WriteMapElemValue() + if yyn2206 { + r.EncodeNil() + } else { + if x.FptrMapBoolUint8 == nil { + r.EncodeNil() + } else { + yy2209 := *x.FptrMapBoolUint8 + if false { + } else { + z.F.EncMapBoolUint8V(yy2209, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapBoolUint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolUint16V(x.FMapBoolUint16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapBoolUint16`) + r.WriteMapElemValue() + if x.FMapBoolUint16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolUint16V(x.FMapBoolUint16, e) + } + } + } + var yyn2214 bool + if x.FptrMapBoolUint16 == nil { + yyn2214 = true + goto LABEL2214 + } + LABEL2214: + if yyr2 || yy2arr2 { + if yyn2214 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapBoolUint16 == nil { + r.EncodeNil() + } else { + yy2215 := *x.FptrMapBoolUint16 + if false { + } else { + z.F.EncMapBoolUint16V(yy2215, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolUint16`) + r.WriteMapElemValue() + if yyn2214 { + r.EncodeNil() + } else { + if x.FptrMapBoolUint16 == nil { + r.EncodeNil() + } else { + yy2217 := *x.FptrMapBoolUint16 + if false { + } else { + z.F.EncMapBoolUint16V(yy2217, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapBoolUint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolUint32V(x.FMapBoolUint32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapBoolUint32`) + r.WriteMapElemValue() + if x.FMapBoolUint32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolUint32V(x.FMapBoolUint32, e) + } + } + } + var yyn2222 bool + if x.FptrMapBoolUint32 == nil { + yyn2222 = true + goto LABEL2222 + } + LABEL2222: + if yyr2 || yy2arr2 { + if yyn2222 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapBoolUint32 == nil { + r.EncodeNil() + } else { + yy2223 := *x.FptrMapBoolUint32 + if false { + } else { + z.F.EncMapBoolUint32V(yy2223, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolUint32`) + r.WriteMapElemValue() + if yyn2222 { + r.EncodeNil() + } else { + if x.FptrMapBoolUint32 == nil { + r.EncodeNil() + } else { + yy2225 := *x.FptrMapBoolUint32 + if false { + } else { + z.F.EncMapBoolUint32V(yy2225, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapBoolUint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolUint64V(x.FMapBoolUint64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapBoolUint64`) + r.WriteMapElemValue() + if x.FMapBoolUint64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolUint64V(x.FMapBoolUint64, e) + } + } + } + var yyn2230 bool + if x.FptrMapBoolUint64 == nil { + yyn2230 = true + goto LABEL2230 + } + LABEL2230: + if yyr2 || yy2arr2 { + if yyn2230 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapBoolUint64 == nil { + r.EncodeNil() + } else { + yy2231 := *x.FptrMapBoolUint64 + if false { + } else { + z.F.EncMapBoolUint64V(yy2231, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolUint64`) + r.WriteMapElemValue() + if yyn2230 { + r.EncodeNil() + } else { + if x.FptrMapBoolUint64 == nil { + r.EncodeNil() + } else { + yy2233 := *x.FptrMapBoolUint64 + if false { + } else { + z.F.EncMapBoolUint64V(yy2233, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapBoolUintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolUintptrV(x.FMapBoolUintptr, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapBoolUintptr`) + r.WriteMapElemValue() + if x.FMapBoolUintptr == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolUintptrV(x.FMapBoolUintptr, e) + } + } + } + var yyn2238 bool + if x.FptrMapBoolUintptr == nil { + yyn2238 = true + goto LABEL2238 + } + LABEL2238: + if yyr2 || yy2arr2 { + if yyn2238 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapBoolUintptr == nil { + r.EncodeNil() + } else { + yy2239 := *x.FptrMapBoolUintptr + if false { + } else { + z.F.EncMapBoolUintptrV(yy2239, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolUintptr`) + r.WriteMapElemValue() + if yyn2238 { + r.EncodeNil() + } else { + if x.FptrMapBoolUintptr == nil { + r.EncodeNil() + } else { + yy2241 := *x.FptrMapBoolUintptr + if false { + } else { + z.F.EncMapBoolUintptrV(yy2241, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapBoolInt == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolIntV(x.FMapBoolInt, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapBoolInt`) + r.WriteMapElemValue() + if x.FMapBoolInt == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolIntV(x.FMapBoolInt, e) + } + } + } + var yyn2246 bool + if x.FptrMapBoolInt == nil { + yyn2246 = true + goto LABEL2246 + } + LABEL2246: + if yyr2 || yy2arr2 { + if yyn2246 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapBoolInt == nil { + r.EncodeNil() + } else { + yy2247 := *x.FptrMapBoolInt + if false { + } else { + z.F.EncMapBoolIntV(yy2247, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolInt`) + r.WriteMapElemValue() + if yyn2246 { + r.EncodeNil() + } else { + if x.FptrMapBoolInt == nil { + r.EncodeNil() + } else { + yy2249 := *x.FptrMapBoolInt + if false { + } else { + z.F.EncMapBoolIntV(yy2249, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapBoolInt8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolInt8V(x.FMapBoolInt8, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapBoolInt8`) + r.WriteMapElemValue() + if x.FMapBoolInt8 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolInt8V(x.FMapBoolInt8, e) + } + } + } + var yyn2254 bool + if x.FptrMapBoolInt8 == nil { + yyn2254 = true + goto LABEL2254 + } + LABEL2254: + if yyr2 || yy2arr2 { + if yyn2254 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapBoolInt8 == nil { + r.EncodeNil() + } else { + yy2255 := *x.FptrMapBoolInt8 + if false { + } else { + z.F.EncMapBoolInt8V(yy2255, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolInt8`) + r.WriteMapElemValue() + if yyn2254 { + r.EncodeNil() + } else { + if x.FptrMapBoolInt8 == nil { + r.EncodeNil() + } else { + yy2257 := *x.FptrMapBoolInt8 + if false { + } else { + z.F.EncMapBoolInt8V(yy2257, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapBoolInt16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolInt16V(x.FMapBoolInt16, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapBoolInt16`) + r.WriteMapElemValue() + if x.FMapBoolInt16 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolInt16V(x.FMapBoolInt16, e) + } + } + } + var yyn2262 bool + if x.FptrMapBoolInt16 == nil { + yyn2262 = true + goto LABEL2262 + } + LABEL2262: + if yyr2 || yy2arr2 { + if yyn2262 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapBoolInt16 == nil { + r.EncodeNil() + } else { + yy2263 := *x.FptrMapBoolInt16 + if false { + } else { + z.F.EncMapBoolInt16V(yy2263, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolInt16`) + r.WriteMapElemValue() + if yyn2262 { + r.EncodeNil() + } else { + if x.FptrMapBoolInt16 == nil { + r.EncodeNil() + } else { + yy2265 := *x.FptrMapBoolInt16 + if false { + } else { + z.F.EncMapBoolInt16V(yy2265, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapBoolInt32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolInt32V(x.FMapBoolInt32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapBoolInt32`) + r.WriteMapElemValue() + if x.FMapBoolInt32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolInt32V(x.FMapBoolInt32, e) + } + } + } + var yyn2270 bool + if x.FptrMapBoolInt32 == nil { + yyn2270 = true + goto LABEL2270 + } + LABEL2270: + if yyr2 || yy2arr2 { + if yyn2270 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapBoolInt32 == nil { + r.EncodeNil() + } else { + yy2271 := *x.FptrMapBoolInt32 + if false { + } else { + z.F.EncMapBoolInt32V(yy2271, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolInt32`) + r.WriteMapElemValue() + if yyn2270 { + r.EncodeNil() + } else { + if x.FptrMapBoolInt32 == nil { + r.EncodeNil() + } else { + yy2273 := *x.FptrMapBoolInt32 + if false { + } else { + z.F.EncMapBoolInt32V(yy2273, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapBoolInt64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolInt64V(x.FMapBoolInt64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapBoolInt64`) + r.WriteMapElemValue() + if x.FMapBoolInt64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolInt64V(x.FMapBoolInt64, e) + } + } + } + var yyn2278 bool + if x.FptrMapBoolInt64 == nil { + yyn2278 = true + goto LABEL2278 + } + LABEL2278: + if yyr2 || yy2arr2 { + if yyn2278 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapBoolInt64 == nil { + r.EncodeNil() + } else { + yy2279 := *x.FptrMapBoolInt64 + if false { + } else { + z.F.EncMapBoolInt64V(yy2279, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolInt64`) + r.WriteMapElemValue() + if yyn2278 { + r.EncodeNil() + } else { + if x.FptrMapBoolInt64 == nil { + r.EncodeNil() + } else { + yy2281 := *x.FptrMapBoolInt64 + if false { + } else { + z.F.EncMapBoolInt64V(yy2281, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapBoolFloat32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolFloat32V(x.FMapBoolFloat32, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapBoolFloat32`) + r.WriteMapElemValue() + if x.FMapBoolFloat32 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolFloat32V(x.FMapBoolFloat32, e) + } + } + } + var yyn2286 bool + if x.FptrMapBoolFloat32 == nil { + yyn2286 = true + goto LABEL2286 + } + LABEL2286: + if yyr2 || yy2arr2 { + if yyn2286 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapBoolFloat32 == nil { + r.EncodeNil() + } else { + yy2287 := *x.FptrMapBoolFloat32 + if false { + } else { + z.F.EncMapBoolFloat32V(yy2287, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolFloat32`) + r.WriteMapElemValue() + if yyn2286 { + r.EncodeNil() + } else { + if x.FptrMapBoolFloat32 == nil { + r.EncodeNil() + } else { + yy2289 := *x.FptrMapBoolFloat32 + if false { + } else { + z.F.EncMapBoolFloat32V(yy2289, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapBoolFloat64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolFloat64V(x.FMapBoolFloat64, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapBoolFloat64`) + r.WriteMapElemValue() + if x.FMapBoolFloat64 == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolFloat64V(x.FMapBoolFloat64, e) + } + } + } + var yyn2294 bool + if x.FptrMapBoolFloat64 == nil { + yyn2294 = true + goto LABEL2294 + } + LABEL2294: + if yyr2 || yy2arr2 { + if yyn2294 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapBoolFloat64 == nil { + r.EncodeNil() + } else { + yy2295 := *x.FptrMapBoolFloat64 + if false { + } else { + z.F.EncMapBoolFloat64V(yy2295, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolFloat64`) + r.WriteMapElemValue() + if yyn2294 { + r.EncodeNil() + } else { + if x.FptrMapBoolFloat64 == nil { + r.EncodeNil() + } else { + yy2297 := *x.FptrMapBoolFloat64 + if false { + } else { + z.F.EncMapBoolFloat64V(yy2297, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.FMapBoolBool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolBoolV(x.FMapBoolBool, e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FMapBoolBool`) + r.WriteMapElemValue() + if x.FMapBoolBool == nil { + r.EncodeNil() + } else { + if false { + } else { + z.F.EncMapBoolBoolV(x.FMapBoolBool, e) + } + } + } + var yyn2302 bool + if x.FptrMapBoolBool == nil { + yyn2302 = true + goto LABEL2302 + } + LABEL2302: + if yyr2 || yy2arr2 { + if yyn2302 { + r.WriteArrayElem() + r.EncodeNil() + } else { + r.WriteArrayElem() + if x.FptrMapBoolBool == nil { + r.EncodeNil() + } else { + yy2303 := *x.FptrMapBoolBool + if false { + } else { + z.F.EncMapBoolBoolV(yy2303, e) + } + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `FptrMapBoolBool`) + r.WriteMapElemValue() + if yyn2302 { + r.EncodeNil() + } else { + if x.FptrMapBoolBool == nil { + r.EncodeNil() + } else { + yy2305 := *x.FptrMapBoolBool + if false { + } else { + z.F.EncMapBoolBoolV(yy2305, e) + } + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayEnd() + } else { + r.WriteMapEnd() + } + } + } +} + +func (x *TestMammoth2) CodecDecodeSelf(d *Decoder) { + var h codecSelfer19781 + z, r := GenHelperDecoder(d) + _, _, _ = h, z, r + if false { + } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { + z.DecExtension(x, yyxt1) + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap19781 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + r.ReadMapEnd() + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray19781 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + r.ReadArrayEnd() + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct19781) + } + } +} + +func (x *TestMammoth2) codecDecodeSelfFromMap(l int, d *Decoder) { + var h codecSelfer19781 + z, r := GenHelperDecoder(d) + _, _, _ = h, z, r + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + r.ReadMapElemKey() + yys3 := z.StringView(r.DecodeStringAsBytes()) + r.ReadMapElemValue() + switch yys3 { + case "FIntf": + if r.TryDecodeAsNil() { + x.FIntf = nil + } else { + if false { + } else { + z.DecFallback(&x.FIntf, true) + } + } + case "FptrIntf": + if r.TryDecodeAsNil() { + if true && x.FptrIntf != nil { + x.FptrIntf = nil + } + } else { + if x.FptrIntf == nil { + x.FptrIntf = new(interface{}) + } + + if false { + } else { + z.DecFallback(x.FptrIntf, true) + } + } + case "FString": + if r.TryDecodeAsNil() { + x.FString = "" + } else { + x.FString = (string)(r.DecodeString()) + } + case "FptrString": + if r.TryDecodeAsNil() { + if true && x.FptrString != nil { + x.FptrString = nil + } + } else { + if x.FptrString == nil { + x.FptrString = new(string) + } + + if false { + } else { + *x.FptrString = (string)(r.DecodeString()) + } + } + case "FFloat32": + if r.TryDecodeAsNil() { + x.FFloat32 = 0 + } else { + x.FFloat32 = (float32)(r.DecodeFloat32As64()) + } + case "FptrFloat32": + if r.TryDecodeAsNil() { + if true && x.FptrFloat32 != nil { + x.FptrFloat32 = nil + } + } else { + if x.FptrFloat32 == nil { + x.FptrFloat32 = new(float32) + } + + if false { + } else { + *x.FptrFloat32 = (float32)(r.DecodeFloat32As64()) + } + } + case "FFloat64": + if r.TryDecodeAsNil() { + x.FFloat64 = 0 + } else { + x.FFloat64 = (float64)(r.DecodeFloat64()) + } + case "FptrFloat64": + if r.TryDecodeAsNil() { + if true && x.FptrFloat64 != nil { + x.FptrFloat64 = nil + } + } else { + if x.FptrFloat64 == nil { + x.FptrFloat64 = new(float64) + } + + if false { + } else { + *x.FptrFloat64 = (float64)(r.DecodeFloat64()) + } + } + case "FUint": + if r.TryDecodeAsNil() { + x.FUint = 0 + } else { + x.FUint = (uint)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781)) + } + case "FptrUint": + if r.TryDecodeAsNil() { + if true && x.FptrUint != nil { + x.FptrUint = nil + } + } else { + if x.FptrUint == nil { + x.FptrUint = new(uint) + } + + if false { + } else { + *x.FptrUint = (uint)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781)) + } + } + case "FUint8": + if r.TryDecodeAsNil() { + x.FUint8 = 0 + } else { + x.FUint8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) + } + case "FptrUint8": + if r.TryDecodeAsNil() { + if true && x.FptrUint8 != nil { + x.FptrUint8 = nil + } + } else { + if x.FptrUint8 == nil { + x.FptrUint8 = new(uint8) + } + + if false { + } else { + *x.FptrUint8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) + } + } + case "FUint16": + if r.TryDecodeAsNil() { + x.FUint16 = 0 + } else { + x.FUint16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16)) + } + case "FptrUint16": + if r.TryDecodeAsNil() { + if true && x.FptrUint16 != nil { + x.FptrUint16 = nil + } + } else { + if x.FptrUint16 == nil { + x.FptrUint16 = new(uint16) + } + + if false { + } else { + *x.FptrUint16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16)) + } + } + case "FUint32": + if r.TryDecodeAsNil() { + x.FUint32 = 0 + } else { + x.FUint32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) + } + case "FptrUint32": + if r.TryDecodeAsNil() { + if true && x.FptrUint32 != nil { + x.FptrUint32 = nil + } + } else { + if x.FptrUint32 == nil { + x.FptrUint32 = new(uint32) + } + + if false { + } else { + *x.FptrUint32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) + } + } + case "FUint64": + if r.TryDecodeAsNil() { + x.FUint64 = 0 + } else { + x.FUint64 = (uint64)(r.DecodeUint64()) + } + case "FptrUint64": + if r.TryDecodeAsNil() { + if true && x.FptrUint64 != nil { + x.FptrUint64 = nil + } + } else { + if x.FptrUint64 == nil { + x.FptrUint64 = new(uint64) + } + + if false { + } else { + *x.FptrUint64 = (uint64)(r.DecodeUint64()) + } + } + case "FUintptr": + if r.TryDecodeAsNil() { + x.FUintptr = 0 + } else { + x.FUintptr = (uintptr)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781)) + } + case "FptrUintptr": + if r.TryDecodeAsNil() { + if true && x.FptrUintptr != nil { + x.FptrUintptr = nil + } + } else { + if x.FptrUintptr == nil { + x.FptrUintptr = new(uintptr) + } + + if false { + } else { + *x.FptrUintptr = (uintptr)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781)) + } + } + case "FInt": + if r.TryDecodeAsNil() { + x.FInt = 0 + } else { + x.FInt = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19781)) + } + case "FptrInt": + if r.TryDecodeAsNil() { + if true && x.FptrInt != nil { + x.FptrInt = nil + } + } else { + if x.FptrInt == nil { + x.FptrInt = new(int) + } + + if false { + } else { + *x.FptrInt = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19781)) + } + } + case "FInt8": + if r.TryDecodeAsNil() { + x.FInt8 = 0 + } else { + x.FInt8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) + } + case "FptrInt8": + if r.TryDecodeAsNil() { + if true && x.FptrInt8 != nil { + x.FptrInt8 = nil + } + } else { + if x.FptrInt8 == nil { + x.FptrInt8 = new(int8) + } + + if false { + } else { + *x.FptrInt8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) + } + } + case "FInt16": + if r.TryDecodeAsNil() { + x.FInt16 = 0 + } else { + x.FInt16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) + } + case "FptrInt16": + if r.TryDecodeAsNil() { + if true && x.FptrInt16 != nil { + x.FptrInt16 = nil + } + } else { + if x.FptrInt16 == nil { + x.FptrInt16 = new(int16) + } + + if false { + } else { + *x.FptrInt16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) + } + } + case "FInt32": + if r.TryDecodeAsNil() { + x.FInt32 = 0 + } else { + x.FInt32 = (int32)(z.C.IntV(r.DecodeInt64(), 32)) + } + case "FptrInt32": + if r.TryDecodeAsNil() { + if true && x.FptrInt32 != nil { + x.FptrInt32 = nil + } + } else { + if x.FptrInt32 == nil { + x.FptrInt32 = new(int32) + } + + if false { + } else { + *x.FptrInt32 = (int32)(z.C.IntV(r.DecodeInt64(), 32)) + } + } + case "FInt64": + if r.TryDecodeAsNil() { + x.FInt64 = 0 + } else { + x.FInt64 = (int64)(r.DecodeInt64()) + } + case "FptrInt64": + if r.TryDecodeAsNil() { + if true && x.FptrInt64 != nil { + x.FptrInt64 = nil + } + } else { + if x.FptrInt64 == nil { + x.FptrInt64 = new(int64) + } + + if false { + } else { + *x.FptrInt64 = (int64)(r.DecodeInt64()) + } + } + case "FBool": + if r.TryDecodeAsNil() { + x.FBool = false + } else { + x.FBool = (bool)(r.DecodeBool()) + } + case "FptrBool": + if r.TryDecodeAsNil() { + if true && x.FptrBool != nil { + x.FptrBool = nil + } + } else { + if x.FptrBool == nil { + x.FptrBool = new(bool) + } + + if false { + } else { + *x.FptrBool = (bool)(r.DecodeBool()) + } + } + case "FSliceIntf": + if r.TryDecodeAsNil() { + x.FSliceIntf = nil + } else { + if false { + } else { + z.F.DecSliceIntfX(&x.FSliceIntf, d) + } + } + case "FptrSliceIntf": + if r.TryDecodeAsNil() { + if true && x.FptrSliceIntf != nil { + x.FptrSliceIntf = nil + } + } else { + if x.FptrSliceIntf == nil { + x.FptrSliceIntf = new([]interface{}) + } + + if false { + } else { + z.F.DecSliceIntfX(x.FptrSliceIntf, d) + } + } + case "FSliceString": + if r.TryDecodeAsNil() { + x.FSliceString = nil + } else { + if false { + } else { + z.F.DecSliceStringX(&x.FSliceString, d) + } + } + case "FptrSliceString": + if r.TryDecodeAsNil() { + if true && x.FptrSliceString != nil { + x.FptrSliceString = nil + } + } else { + if x.FptrSliceString == nil { + x.FptrSliceString = new([]string) + } + + if false { + } else { + z.F.DecSliceStringX(x.FptrSliceString, d) + } + } + case "FSliceFloat32": + if r.TryDecodeAsNil() { + x.FSliceFloat32 = nil + } else { + if false { + } else { + z.F.DecSliceFloat32X(&x.FSliceFloat32, d) + } + } + case "FptrSliceFloat32": + if r.TryDecodeAsNil() { + if true && x.FptrSliceFloat32 != nil { + x.FptrSliceFloat32 = nil + } + } else { + if x.FptrSliceFloat32 == nil { + x.FptrSliceFloat32 = new([]float32) + } + + if false { + } else { + z.F.DecSliceFloat32X(x.FptrSliceFloat32, d) + } + } + case "FSliceFloat64": + if r.TryDecodeAsNil() { + x.FSliceFloat64 = nil + } else { + if false { + } else { + z.F.DecSliceFloat64X(&x.FSliceFloat64, d) + } + } + case "FptrSliceFloat64": + if r.TryDecodeAsNil() { + if true && x.FptrSliceFloat64 != nil { + x.FptrSliceFloat64 = nil + } + } else { + if x.FptrSliceFloat64 == nil { + x.FptrSliceFloat64 = new([]float64) + } + + if false { + } else { + z.F.DecSliceFloat64X(x.FptrSliceFloat64, d) + } + } + case "FSliceUint": + if r.TryDecodeAsNil() { + x.FSliceUint = nil + } else { + if false { + } else { + z.F.DecSliceUintX(&x.FSliceUint, d) + } + } + case "FptrSliceUint": + if r.TryDecodeAsNil() { + if true && x.FptrSliceUint != nil { + x.FptrSliceUint = nil + } + } else { + if x.FptrSliceUint == nil { + x.FptrSliceUint = new([]uint) + } + + if false { + } else { + z.F.DecSliceUintX(x.FptrSliceUint, d) + } + } + case "FSliceUint8": + if r.TryDecodeAsNil() { + x.FSliceUint8 = nil + } else { + if false { + } else { + x.FSliceUint8 = r.DecodeBytes(([]byte)(x.FSliceUint8), false) + } + } + case "FptrSliceUint8": + if r.TryDecodeAsNil() { + if true && x.FptrSliceUint8 != nil { + x.FptrSliceUint8 = nil + } + } else { + if x.FptrSliceUint8 == nil { + x.FptrSliceUint8 = new([]uint8) + } + + if false { + } else { + *x.FptrSliceUint8 = r.DecodeBytes(*(*[]byte)(x.FptrSliceUint8), false) + } + } + case "FSliceUint16": + if r.TryDecodeAsNil() { + x.FSliceUint16 = nil + } else { + if false { + } else { + z.F.DecSliceUint16X(&x.FSliceUint16, d) + } + } + case "FptrSliceUint16": + if r.TryDecodeAsNil() { + if true && x.FptrSliceUint16 != nil { + x.FptrSliceUint16 = nil + } + } else { + if x.FptrSliceUint16 == nil { + x.FptrSliceUint16 = new([]uint16) + } + + if false { + } else { + z.F.DecSliceUint16X(x.FptrSliceUint16, d) + } + } + case "FSliceUint32": + if r.TryDecodeAsNil() { + x.FSliceUint32 = nil + } else { + if false { + } else { + z.F.DecSliceUint32X(&x.FSliceUint32, d) + } + } + case "FptrSliceUint32": + if r.TryDecodeAsNil() { + if true && x.FptrSliceUint32 != nil { + x.FptrSliceUint32 = nil + } + } else { + if x.FptrSliceUint32 == nil { + x.FptrSliceUint32 = new([]uint32) + } + + if false { + } else { + z.F.DecSliceUint32X(x.FptrSliceUint32, d) + } + } + case "FSliceUint64": + if r.TryDecodeAsNil() { + x.FSliceUint64 = nil + } else { + if false { + } else { + z.F.DecSliceUint64X(&x.FSliceUint64, d) + } + } + case "FptrSliceUint64": + if r.TryDecodeAsNil() { + if true && x.FptrSliceUint64 != nil { + x.FptrSliceUint64 = nil + } + } else { + if x.FptrSliceUint64 == nil { + x.FptrSliceUint64 = new([]uint64) + } + + if false { + } else { + z.F.DecSliceUint64X(x.FptrSliceUint64, d) + } + } + case "FSliceUintptr": + if r.TryDecodeAsNil() { + x.FSliceUintptr = nil + } else { + if false { + } else { + z.F.DecSliceUintptrX(&x.FSliceUintptr, d) + } + } + case "FptrSliceUintptr": + if r.TryDecodeAsNil() { + if true && x.FptrSliceUintptr != nil { + x.FptrSliceUintptr = nil + } + } else { + if x.FptrSliceUintptr == nil { + x.FptrSliceUintptr = new([]uintptr) + } + + if false { + } else { + z.F.DecSliceUintptrX(x.FptrSliceUintptr, d) + } + } + case "FSliceInt": + if r.TryDecodeAsNil() { + x.FSliceInt = nil + } else { + if false { + } else { + z.F.DecSliceIntX(&x.FSliceInt, d) + } + } + case "FptrSliceInt": + if r.TryDecodeAsNil() { + if true && x.FptrSliceInt != nil { + x.FptrSliceInt = nil + } + } else { + if x.FptrSliceInt == nil { + x.FptrSliceInt = new([]int) + } + + if false { + } else { + z.F.DecSliceIntX(x.FptrSliceInt, d) + } + } + case "FSliceInt8": + if r.TryDecodeAsNil() { + x.FSliceInt8 = nil + } else { + if false { + } else { + z.F.DecSliceInt8X(&x.FSliceInt8, d) + } + } + case "FptrSliceInt8": + if r.TryDecodeAsNil() { + if true && x.FptrSliceInt8 != nil { + x.FptrSliceInt8 = nil + } + } else { + if x.FptrSliceInt8 == nil { + x.FptrSliceInt8 = new([]int8) + } + + if false { + } else { + z.F.DecSliceInt8X(x.FptrSliceInt8, d) + } + } + case "FSliceInt16": + if r.TryDecodeAsNil() { + x.FSliceInt16 = nil + } else { + if false { + } else { + z.F.DecSliceInt16X(&x.FSliceInt16, d) + } + } + case "FptrSliceInt16": + if r.TryDecodeAsNil() { + if true && x.FptrSliceInt16 != nil { + x.FptrSliceInt16 = nil + } + } else { + if x.FptrSliceInt16 == nil { + x.FptrSliceInt16 = new([]int16) + } + + if false { + } else { + z.F.DecSliceInt16X(x.FptrSliceInt16, d) + } + } + case "FSliceInt32": + if r.TryDecodeAsNil() { + x.FSliceInt32 = nil + } else { + if false { + } else { + z.F.DecSliceInt32X(&x.FSliceInt32, d) + } + } + case "FptrSliceInt32": + if r.TryDecodeAsNil() { + if true && x.FptrSliceInt32 != nil { + x.FptrSliceInt32 = nil + } + } else { + if x.FptrSliceInt32 == nil { + x.FptrSliceInt32 = new([]int32) + } + + if false { + } else { + z.F.DecSliceInt32X(x.FptrSliceInt32, d) + } + } + case "FSliceInt64": + if r.TryDecodeAsNil() { + x.FSliceInt64 = nil + } else { + if false { + } else { + z.F.DecSliceInt64X(&x.FSliceInt64, d) + } + } + case "FptrSliceInt64": + if r.TryDecodeAsNil() { + if true && x.FptrSliceInt64 != nil { + x.FptrSliceInt64 = nil + } + } else { + if x.FptrSliceInt64 == nil { + x.FptrSliceInt64 = new([]int64) + } + + if false { + } else { + z.F.DecSliceInt64X(x.FptrSliceInt64, d) + } + } + case "FSliceBool": + if r.TryDecodeAsNil() { + x.FSliceBool = nil + } else { + if false { + } else { + z.F.DecSliceBoolX(&x.FSliceBool, d) + } + } + case "FptrSliceBool": + if r.TryDecodeAsNil() { + if true && x.FptrSliceBool != nil { + x.FptrSliceBool = nil + } + } else { + if x.FptrSliceBool == nil { + x.FptrSliceBool = new([]bool) + } + + if false { + } else { + z.F.DecSliceBoolX(x.FptrSliceBool, d) + } + } + case "FMapIntfIntf": + if r.TryDecodeAsNil() { + x.FMapIntfIntf = nil + } else { + if false { + } else { + z.F.DecMapIntfIntfX(&x.FMapIntfIntf, d) + } + } + case "FptrMapIntfIntf": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfIntf != nil { + x.FptrMapIntfIntf = nil + } + } else { + if x.FptrMapIntfIntf == nil { + x.FptrMapIntfIntf = new(map[interface{}]interface{}) + } + + if false { + } else { + z.F.DecMapIntfIntfX(x.FptrMapIntfIntf, d) + } + } + case "FMapIntfString": + if r.TryDecodeAsNil() { + x.FMapIntfString = nil + } else { + if false { + } else { + z.F.DecMapIntfStringX(&x.FMapIntfString, d) + } + } + case "FptrMapIntfString": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfString != nil { + x.FptrMapIntfString = nil + } + } else { + if x.FptrMapIntfString == nil { + x.FptrMapIntfString = new(map[interface{}]string) + } + + if false { + } else { + z.F.DecMapIntfStringX(x.FptrMapIntfString, d) + } + } + case "FMapIntfUint": + if r.TryDecodeAsNil() { + x.FMapIntfUint = nil + } else { + if false { + } else { + z.F.DecMapIntfUintX(&x.FMapIntfUint, d) + } + } + case "FptrMapIntfUint": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfUint != nil { + x.FptrMapIntfUint = nil + } + } else { + if x.FptrMapIntfUint == nil { + x.FptrMapIntfUint = new(map[interface{}]uint) + } + + if false { + } else { + z.F.DecMapIntfUintX(x.FptrMapIntfUint, d) + } + } + case "FMapIntfUint8": + if r.TryDecodeAsNil() { + x.FMapIntfUint8 = nil + } else { + if false { + } else { + z.F.DecMapIntfUint8X(&x.FMapIntfUint8, d) + } + } + case "FptrMapIntfUint8": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfUint8 != nil { + x.FptrMapIntfUint8 = nil + } + } else { + if x.FptrMapIntfUint8 == nil { + x.FptrMapIntfUint8 = new(map[interface{}]uint8) + } + + if false { + } else { + z.F.DecMapIntfUint8X(x.FptrMapIntfUint8, d) + } + } + case "FMapIntfUint16": + if r.TryDecodeAsNil() { + x.FMapIntfUint16 = nil + } else { + if false { + } else { + z.F.DecMapIntfUint16X(&x.FMapIntfUint16, d) + } + } + case "FptrMapIntfUint16": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfUint16 != nil { + x.FptrMapIntfUint16 = nil + } + } else { + if x.FptrMapIntfUint16 == nil { + x.FptrMapIntfUint16 = new(map[interface{}]uint16) + } + + if false { + } else { + z.F.DecMapIntfUint16X(x.FptrMapIntfUint16, d) + } + } + case "FMapIntfUint32": + if r.TryDecodeAsNil() { + x.FMapIntfUint32 = nil + } else { + if false { + } else { + z.F.DecMapIntfUint32X(&x.FMapIntfUint32, d) + } + } + case "FptrMapIntfUint32": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfUint32 != nil { + x.FptrMapIntfUint32 = nil + } + } else { + if x.FptrMapIntfUint32 == nil { + x.FptrMapIntfUint32 = new(map[interface{}]uint32) + } + + if false { + } else { + z.F.DecMapIntfUint32X(x.FptrMapIntfUint32, d) + } + } + case "FMapIntfUint64": + if r.TryDecodeAsNil() { + x.FMapIntfUint64 = nil + } else { + if false { + } else { + z.F.DecMapIntfUint64X(&x.FMapIntfUint64, d) + } + } + case "FptrMapIntfUint64": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfUint64 != nil { + x.FptrMapIntfUint64 = nil + } + } else { + if x.FptrMapIntfUint64 == nil { + x.FptrMapIntfUint64 = new(map[interface{}]uint64) + } + + if false { + } else { + z.F.DecMapIntfUint64X(x.FptrMapIntfUint64, d) + } + } + case "FMapIntfUintptr": + if r.TryDecodeAsNil() { + x.FMapIntfUintptr = nil + } else { + if false { + } else { + z.F.DecMapIntfUintptrX(&x.FMapIntfUintptr, d) + } + } + case "FptrMapIntfUintptr": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfUintptr != nil { + x.FptrMapIntfUintptr = nil + } + } else { + if x.FptrMapIntfUintptr == nil { + x.FptrMapIntfUintptr = new(map[interface{}]uintptr) + } + + if false { + } else { + z.F.DecMapIntfUintptrX(x.FptrMapIntfUintptr, d) + } + } + case "FMapIntfInt": + if r.TryDecodeAsNil() { + x.FMapIntfInt = nil + } else { + if false { + } else { + z.F.DecMapIntfIntX(&x.FMapIntfInt, d) + } + } + case "FptrMapIntfInt": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfInt != nil { + x.FptrMapIntfInt = nil + } + } else { + if x.FptrMapIntfInt == nil { + x.FptrMapIntfInt = new(map[interface{}]int) + } + + if false { + } else { + z.F.DecMapIntfIntX(x.FptrMapIntfInt, d) + } + } + case "FMapIntfInt8": + if r.TryDecodeAsNil() { + x.FMapIntfInt8 = nil + } else { + if false { + } else { + z.F.DecMapIntfInt8X(&x.FMapIntfInt8, d) + } + } + case "FptrMapIntfInt8": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfInt8 != nil { + x.FptrMapIntfInt8 = nil + } + } else { + if x.FptrMapIntfInt8 == nil { + x.FptrMapIntfInt8 = new(map[interface{}]int8) + } + + if false { + } else { + z.F.DecMapIntfInt8X(x.FptrMapIntfInt8, d) + } + } + case "FMapIntfInt16": + if r.TryDecodeAsNil() { + x.FMapIntfInt16 = nil + } else { + if false { + } else { + z.F.DecMapIntfInt16X(&x.FMapIntfInt16, d) + } + } + case "FptrMapIntfInt16": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfInt16 != nil { + x.FptrMapIntfInt16 = nil + } + } else { + if x.FptrMapIntfInt16 == nil { + x.FptrMapIntfInt16 = new(map[interface{}]int16) + } + + if false { + } else { + z.F.DecMapIntfInt16X(x.FptrMapIntfInt16, d) + } + } + case "FMapIntfInt32": + if r.TryDecodeAsNil() { + x.FMapIntfInt32 = nil + } else { + if false { + } else { + z.F.DecMapIntfInt32X(&x.FMapIntfInt32, d) + } + } + case "FptrMapIntfInt32": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfInt32 != nil { + x.FptrMapIntfInt32 = nil + } + } else { + if x.FptrMapIntfInt32 == nil { + x.FptrMapIntfInt32 = new(map[interface{}]int32) + } + + if false { + } else { + z.F.DecMapIntfInt32X(x.FptrMapIntfInt32, d) + } + } + case "FMapIntfInt64": + if r.TryDecodeAsNil() { + x.FMapIntfInt64 = nil + } else { + if false { + } else { + z.F.DecMapIntfInt64X(&x.FMapIntfInt64, d) + } + } + case "FptrMapIntfInt64": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfInt64 != nil { + x.FptrMapIntfInt64 = nil + } + } else { + if x.FptrMapIntfInt64 == nil { + x.FptrMapIntfInt64 = new(map[interface{}]int64) + } + + if false { + } else { + z.F.DecMapIntfInt64X(x.FptrMapIntfInt64, d) + } + } + case "FMapIntfFloat32": + if r.TryDecodeAsNil() { + x.FMapIntfFloat32 = nil + } else { + if false { + } else { + z.F.DecMapIntfFloat32X(&x.FMapIntfFloat32, d) + } + } + case "FptrMapIntfFloat32": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfFloat32 != nil { + x.FptrMapIntfFloat32 = nil + } + } else { + if x.FptrMapIntfFloat32 == nil { + x.FptrMapIntfFloat32 = new(map[interface{}]float32) + } + + if false { + } else { + z.F.DecMapIntfFloat32X(x.FptrMapIntfFloat32, d) + } + } + case "FMapIntfFloat64": + if r.TryDecodeAsNil() { + x.FMapIntfFloat64 = nil + } else { + if false { + } else { + z.F.DecMapIntfFloat64X(&x.FMapIntfFloat64, d) + } + } + case "FptrMapIntfFloat64": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfFloat64 != nil { + x.FptrMapIntfFloat64 = nil + } + } else { + if x.FptrMapIntfFloat64 == nil { + x.FptrMapIntfFloat64 = new(map[interface{}]float64) + } + + if false { + } else { + z.F.DecMapIntfFloat64X(x.FptrMapIntfFloat64, d) + } + } + case "FMapIntfBool": + if r.TryDecodeAsNil() { + x.FMapIntfBool = nil + } else { + if false { + } else { + z.F.DecMapIntfBoolX(&x.FMapIntfBool, d) + } + } + case "FptrMapIntfBool": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfBool != nil { + x.FptrMapIntfBool = nil + } + } else { + if x.FptrMapIntfBool == nil { + x.FptrMapIntfBool = new(map[interface{}]bool) + } + + if false { + } else { + z.F.DecMapIntfBoolX(x.FptrMapIntfBool, d) + } + } + case "FMapStringIntf": + if r.TryDecodeAsNil() { + x.FMapStringIntf = nil + } else { + if false { + } else { + z.F.DecMapStringIntfX(&x.FMapStringIntf, d) + } + } + case "FptrMapStringIntf": + if r.TryDecodeAsNil() { + if true && x.FptrMapStringIntf != nil { + x.FptrMapStringIntf = nil + } + } else { + if x.FptrMapStringIntf == nil { + x.FptrMapStringIntf = new(map[string]interface{}) + } + + if false { + } else { + z.F.DecMapStringIntfX(x.FptrMapStringIntf, d) + } + } + case "FMapStringString": + if r.TryDecodeAsNil() { + x.FMapStringString = nil + } else { + if false { + } else { + z.F.DecMapStringStringX(&x.FMapStringString, d) + } + } + case "FptrMapStringString": + if r.TryDecodeAsNil() { + if true && x.FptrMapStringString != nil { + x.FptrMapStringString = nil + } + } else { + if x.FptrMapStringString == nil { + x.FptrMapStringString = new(map[string]string) + } + + if false { + } else { + z.F.DecMapStringStringX(x.FptrMapStringString, d) + } + } + case "FMapStringUint": + if r.TryDecodeAsNil() { + x.FMapStringUint = nil + } else { + if false { + } else { + z.F.DecMapStringUintX(&x.FMapStringUint, d) + } + } + case "FptrMapStringUint": + if r.TryDecodeAsNil() { + if true && x.FptrMapStringUint != nil { + x.FptrMapStringUint = nil + } + } else { + if x.FptrMapStringUint == nil { + x.FptrMapStringUint = new(map[string]uint) + } + + if false { + } else { + z.F.DecMapStringUintX(x.FptrMapStringUint, d) + } + } + case "FMapStringUint8": + if r.TryDecodeAsNil() { + x.FMapStringUint8 = nil + } else { + if false { + } else { + z.F.DecMapStringUint8X(&x.FMapStringUint8, d) + } + } + case "FptrMapStringUint8": + if r.TryDecodeAsNil() { + if true && x.FptrMapStringUint8 != nil { + x.FptrMapStringUint8 = nil + } + } else { + if x.FptrMapStringUint8 == nil { + x.FptrMapStringUint8 = new(map[string]uint8) + } + + if false { + } else { + z.F.DecMapStringUint8X(x.FptrMapStringUint8, d) + } + } + case "FMapStringUint16": + if r.TryDecodeAsNil() { + x.FMapStringUint16 = nil + } else { + if false { + } else { + z.F.DecMapStringUint16X(&x.FMapStringUint16, d) + } + } + case "FptrMapStringUint16": + if r.TryDecodeAsNil() { + if true && x.FptrMapStringUint16 != nil { + x.FptrMapStringUint16 = nil + } + } else { + if x.FptrMapStringUint16 == nil { + x.FptrMapStringUint16 = new(map[string]uint16) + } + + if false { + } else { + z.F.DecMapStringUint16X(x.FptrMapStringUint16, d) + } + } + case "FMapStringUint32": + if r.TryDecodeAsNil() { + x.FMapStringUint32 = nil + } else { + if false { + } else { + z.F.DecMapStringUint32X(&x.FMapStringUint32, d) + } + } + case "FptrMapStringUint32": + if r.TryDecodeAsNil() { + if true && x.FptrMapStringUint32 != nil { + x.FptrMapStringUint32 = nil + } + } else { + if x.FptrMapStringUint32 == nil { + x.FptrMapStringUint32 = new(map[string]uint32) + } + + if false { + } else { + z.F.DecMapStringUint32X(x.FptrMapStringUint32, d) + } + } + case "FMapStringUint64": + if r.TryDecodeAsNil() { + x.FMapStringUint64 = nil + } else { + if false { + } else { + z.F.DecMapStringUint64X(&x.FMapStringUint64, d) + } + } + case "FptrMapStringUint64": + if r.TryDecodeAsNil() { + if true && x.FptrMapStringUint64 != nil { + x.FptrMapStringUint64 = nil + } + } else { + if x.FptrMapStringUint64 == nil { + x.FptrMapStringUint64 = new(map[string]uint64) + } + + if false { + } else { + z.F.DecMapStringUint64X(x.FptrMapStringUint64, d) + } + } + case "FMapStringUintptr": + if r.TryDecodeAsNil() { + x.FMapStringUintptr = nil + } else { + if false { + } else { + z.F.DecMapStringUintptrX(&x.FMapStringUintptr, d) + } + } + case "FptrMapStringUintptr": + if r.TryDecodeAsNil() { + if true && x.FptrMapStringUintptr != nil { + x.FptrMapStringUintptr = nil + } + } else { + if x.FptrMapStringUintptr == nil { + x.FptrMapStringUintptr = new(map[string]uintptr) + } + + if false { + } else { + z.F.DecMapStringUintptrX(x.FptrMapStringUintptr, d) + } + } + case "FMapStringInt": + if r.TryDecodeAsNil() { + x.FMapStringInt = nil + } else { + if false { + } else { + z.F.DecMapStringIntX(&x.FMapStringInt, d) + } + } + case "FptrMapStringInt": + if r.TryDecodeAsNil() { + if true && x.FptrMapStringInt != nil { + x.FptrMapStringInt = nil + } + } else { + if x.FptrMapStringInt == nil { + x.FptrMapStringInt = new(map[string]int) + } + + if false { + } else { + z.F.DecMapStringIntX(x.FptrMapStringInt, d) + } + } + case "FMapStringInt8": + if r.TryDecodeAsNil() { + x.FMapStringInt8 = nil + } else { + if false { + } else { + z.F.DecMapStringInt8X(&x.FMapStringInt8, d) + } + } + case "FptrMapStringInt8": + if r.TryDecodeAsNil() { + if true && x.FptrMapStringInt8 != nil { + x.FptrMapStringInt8 = nil + } + } else { + if x.FptrMapStringInt8 == nil { + x.FptrMapStringInt8 = new(map[string]int8) + } + + if false { + } else { + z.F.DecMapStringInt8X(x.FptrMapStringInt8, d) + } + } + case "FMapStringInt16": + if r.TryDecodeAsNil() { + x.FMapStringInt16 = nil + } else { + if false { + } else { + z.F.DecMapStringInt16X(&x.FMapStringInt16, d) + } + } + case "FptrMapStringInt16": + if r.TryDecodeAsNil() { + if true && x.FptrMapStringInt16 != nil { + x.FptrMapStringInt16 = nil + } + } else { + if x.FptrMapStringInt16 == nil { + x.FptrMapStringInt16 = new(map[string]int16) + } + + if false { + } else { + z.F.DecMapStringInt16X(x.FptrMapStringInt16, d) + } + } + case "FMapStringInt32": + if r.TryDecodeAsNil() { + x.FMapStringInt32 = nil + } else { + if false { + } else { + z.F.DecMapStringInt32X(&x.FMapStringInt32, d) + } + } + case "FptrMapStringInt32": + if r.TryDecodeAsNil() { + if true && x.FptrMapStringInt32 != nil { + x.FptrMapStringInt32 = nil + } + } else { + if x.FptrMapStringInt32 == nil { + x.FptrMapStringInt32 = new(map[string]int32) + } + + if false { + } else { + z.F.DecMapStringInt32X(x.FptrMapStringInt32, d) + } + } + case "FMapStringInt64": + if r.TryDecodeAsNil() { + x.FMapStringInt64 = nil + } else { + if false { + } else { + z.F.DecMapStringInt64X(&x.FMapStringInt64, d) + } + } + case "FptrMapStringInt64": + if r.TryDecodeAsNil() { + if true && x.FptrMapStringInt64 != nil { + x.FptrMapStringInt64 = nil + } + } else { + if x.FptrMapStringInt64 == nil { + x.FptrMapStringInt64 = new(map[string]int64) + } + + if false { + } else { + z.F.DecMapStringInt64X(x.FptrMapStringInt64, d) + } + } + case "FMapStringFloat32": + if r.TryDecodeAsNil() { + x.FMapStringFloat32 = nil + } else { + if false { + } else { + z.F.DecMapStringFloat32X(&x.FMapStringFloat32, d) + } + } + case "FptrMapStringFloat32": + if r.TryDecodeAsNil() { + if true && x.FptrMapStringFloat32 != nil { + x.FptrMapStringFloat32 = nil + } + } else { + if x.FptrMapStringFloat32 == nil { + x.FptrMapStringFloat32 = new(map[string]float32) + } + + if false { + } else { + z.F.DecMapStringFloat32X(x.FptrMapStringFloat32, d) + } + } + case "FMapStringFloat64": + if r.TryDecodeAsNil() { + x.FMapStringFloat64 = nil + } else { + if false { + } else { + z.F.DecMapStringFloat64X(&x.FMapStringFloat64, d) + } + } + case "FptrMapStringFloat64": + if r.TryDecodeAsNil() { + if true && x.FptrMapStringFloat64 != nil { + x.FptrMapStringFloat64 = nil + } + } else { + if x.FptrMapStringFloat64 == nil { + x.FptrMapStringFloat64 = new(map[string]float64) + } + + if false { + } else { + z.F.DecMapStringFloat64X(x.FptrMapStringFloat64, d) + } + } + case "FMapStringBool": + if r.TryDecodeAsNil() { + x.FMapStringBool = nil + } else { + if false { + } else { + z.F.DecMapStringBoolX(&x.FMapStringBool, d) + } + } + case "FptrMapStringBool": + if r.TryDecodeAsNil() { + if true && x.FptrMapStringBool != nil { + x.FptrMapStringBool = nil + } + } else { + if x.FptrMapStringBool == nil { + x.FptrMapStringBool = new(map[string]bool) + } + + if false { + } else { + z.F.DecMapStringBoolX(x.FptrMapStringBool, d) + } + } + case "FMapFloat32Intf": + if r.TryDecodeAsNil() { + x.FMapFloat32Intf = nil + } else { + if false { + } else { + z.F.DecMapFloat32IntfX(&x.FMapFloat32Intf, d) + } + } + case "FptrMapFloat32Intf": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Intf != nil { + x.FptrMapFloat32Intf = nil + } + } else { + if x.FptrMapFloat32Intf == nil { + x.FptrMapFloat32Intf = new(map[float32]interface{}) + } + + if false { + } else { + z.F.DecMapFloat32IntfX(x.FptrMapFloat32Intf, d) + } + } + case "FMapFloat32String": + if r.TryDecodeAsNil() { + x.FMapFloat32String = nil + } else { + if false { + } else { + z.F.DecMapFloat32StringX(&x.FMapFloat32String, d) + } + } + case "FptrMapFloat32String": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32String != nil { + x.FptrMapFloat32String = nil + } + } else { + if x.FptrMapFloat32String == nil { + x.FptrMapFloat32String = new(map[float32]string) + } + + if false { + } else { + z.F.DecMapFloat32StringX(x.FptrMapFloat32String, d) + } + } + case "FMapFloat32Uint": + if r.TryDecodeAsNil() { + x.FMapFloat32Uint = nil + } else { + if false { + } else { + z.F.DecMapFloat32UintX(&x.FMapFloat32Uint, d) + } + } + case "FptrMapFloat32Uint": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Uint != nil { + x.FptrMapFloat32Uint = nil + } + } else { + if x.FptrMapFloat32Uint == nil { + x.FptrMapFloat32Uint = new(map[float32]uint) + } + + if false { + } else { + z.F.DecMapFloat32UintX(x.FptrMapFloat32Uint, d) + } + } + case "FMapFloat32Uint8": + if r.TryDecodeAsNil() { + x.FMapFloat32Uint8 = nil + } else { + if false { + } else { + z.F.DecMapFloat32Uint8X(&x.FMapFloat32Uint8, d) + } + } + case "FptrMapFloat32Uint8": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Uint8 != nil { + x.FptrMapFloat32Uint8 = nil + } + } else { + if x.FptrMapFloat32Uint8 == nil { + x.FptrMapFloat32Uint8 = new(map[float32]uint8) + } + + if false { + } else { + z.F.DecMapFloat32Uint8X(x.FptrMapFloat32Uint8, d) + } + } + case "FMapFloat32Uint16": + if r.TryDecodeAsNil() { + x.FMapFloat32Uint16 = nil + } else { + if false { + } else { + z.F.DecMapFloat32Uint16X(&x.FMapFloat32Uint16, d) + } + } + case "FptrMapFloat32Uint16": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Uint16 != nil { + x.FptrMapFloat32Uint16 = nil + } + } else { + if x.FptrMapFloat32Uint16 == nil { + x.FptrMapFloat32Uint16 = new(map[float32]uint16) + } + + if false { + } else { + z.F.DecMapFloat32Uint16X(x.FptrMapFloat32Uint16, d) + } + } + case "FMapFloat32Uint32": + if r.TryDecodeAsNil() { + x.FMapFloat32Uint32 = nil + } else { + if false { + } else { + z.F.DecMapFloat32Uint32X(&x.FMapFloat32Uint32, d) + } + } + case "FptrMapFloat32Uint32": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Uint32 != nil { + x.FptrMapFloat32Uint32 = nil + } + } else { + if x.FptrMapFloat32Uint32 == nil { + x.FptrMapFloat32Uint32 = new(map[float32]uint32) + } + + if false { + } else { + z.F.DecMapFloat32Uint32X(x.FptrMapFloat32Uint32, d) + } + } + case "FMapFloat32Uint64": + if r.TryDecodeAsNil() { + x.FMapFloat32Uint64 = nil + } else { + if false { + } else { + z.F.DecMapFloat32Uint64X(&x.FMapFloat32Uint64, d) + } + } + case "FptrMapFloat32Uint64": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Uint64 != nil { + x.FptrMapFloat32Uint64 = nil + } + } else { + if x.FptrMapFloat32Uint64 == nil { + x.FptrMapFloat32Uint64 = new(map[float32]uint64) + } + + if false { + } else { + z.F.DecMapFloat32Uint64X(x.FptrMapFloat32Uint64, d) + } + } + case "FMapFloat32Uintptr": + if r.TryDecodeAsNil() { + x.FMapFloat32Uintptr = nil + } else { + if false { + } else { + z.F.DecMapFloat32UintptrX(&x.FMapFloat32Uintptr, d) + } + } + case "FptrMapFloat32Uintptr": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Uintptr != nil { + x.FptrMapFloat32Uintptr = nil + } + } else { + if x.FptrMapFloat32Uintptr == nil { + x.FptrMapFloat32Uintptr = new(map[float32]uintptr) + } + + if false { + } else { + z.F.DecMapFloat32UintptrX(x.FptrMapFloat32Uintptr, d) + } + } + case "FMapFloat32Int": + if r.TryDecodeAsNil() { + x.FMapFloat32Int = nil + } else { + if false { + } else { + z.F.DecMapFloat32IntX(&x.FMapFloat32Int, d) + } + } + case "FptrMapFloat32Int": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Int != nil { + x.FptrMapFloat32Int = nil + } + } else { + if x.FptrMapFloat32Int == nil { + x.FptrMapFloat32Int = new(map[float32]int) + } + + if false { + } else { + z.F.DecMapFloat32IntX(x.FptrMapFloat32Int, d) + } + } + case "FMapFloat32Int8": + if r.TryDecodeAsNil() { + x.FMapFloat32Int8 = nil + } else { + if false { + } else { + z.F.DecMapFloat32Int8X(&x.FMapFloat32Int8, d) + } + } + case "FptrMapFloat32Int8": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Int8 != nil { + x.FptrMapFloat32Int8 = nil + } + } else { + if x.FptrMapFloat32Int8 == nil { + x.FptrMapFloat32Int8 = new(map[float32]int8) + } + + if false { + } else { + z.F.DecMapFloat32Int8X(x.FptrMapFloat32Int8, d) + } + } + case "FMapFloat32Int16": + if r.TryDecodeAsNil() { + x.FMapFloat32Int16 = nil + } else { + if false { + } else { + z.F.DecMapFloat32Int16X(&x.FMapFloat32Int16, d) + } + } + case "FptrMapFloat32Int16": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Int16 != nil { + x.FptrMapFloat32Int16 = nil + } + } else { + if x.FptrMapFloat32Int16 == nil { + x.FptrMapFloat32Int16 = new(map[float32]int16) + } + + if false { + } else { + z.F.DecMapFloat32Int16X(x.FptrMapFloat32Int16, d) + } + } + case "FMapFloat32Int32": + if r.TryDecodeAsNil() { + x.FMapFloat32Int32 = nil + } else { + if false { + } else { + z.F.DecMapFloat32Int32X(&x.FMapFloat32Int32, d) + } + } + case "FptrMapFloat32Int32": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Int32 != nil { + x.FptrMapFloat32Int32 = nil + } + } else { + if x.FptrMapFloat32Int32 == nil { + x.FptrMapFloat32Int32 = new(map[float32]int32) + } + + if false { + } else { + z.F.DecMapFloat32Int32X(x.FptrMapFloat32Int32, d) + } + } + case "FMapFloat32Int64": + if r.TryDecodeAsNil() { + x.FMapFloat32Int64 = nil + } else { + if false { + } else { + z.F.DecMapFloat32Int64X(&x.FMapFloat32Int64, d) + } + } + case "FptrMapFloat32Int64": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Int64 != nil { + x.FptrMapFloat32Int64 = nil + } + } else { + if x.FptrMapFloat32Int64 == nil { + x.FptrMapFloat32Int64 = new(map[float32]int64) + } + + if false { + } else { + z.F.DecMapFloat32Int64X(x.FptrMapFloat32Int64, d) + } + } + case "FMapFloat32Float32": + if r.TryDecodeAsNil() { + x.FMapFloat32Float32 = nil + } else { + if false { + } else { + z.F.DecMapFloat32Float32X(&x.FMapFloat32Float32, d) + } + } + case "FptrMapFloat32Float32": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Float32 != nil { + x.FptrMapFloat32Float32 = nil + } + } else { + if x.FptrMapFloat32Float32 == nil { + x.FptrMapFloat32Float32 = new(map[float32]float32) + } + + if false { + } else { + z.F.DecMapFloat32Float32X(x.FptrMapFloat32Float32, d) + } + } + case "FMapFloat32Float64": + if r.TryDecodeAsNil() { + x.FMapFloat32Float64 = nil + } else { + if false { + } else { + z.F.DecMapFloat32Float64X(&x.FMapFloat32Float64, d) + } + } + case "FptrMapFloat32Float64": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Float64 != nil { + x.FptrMapFloat32Float64 = nil + } + } else { + if x.FptrMapFloat32Float64 == nil { + x.FptrMapFloat32Float64 = new(map[float32]float64) + } + + if false { + } else { + z.F.DecMapFloat32Float64X(x.FptrMapFloat32Float64, d) + } + } + case "FMapFloat32Bool": + if r.TryDecodeAsNil() { + x.FMapFloat32Bool = nil + } else { + if false { + } else { + z.F.DecMapFloat32BoolX(&x.FMapFloat32Bool, d) + } + } + case "FptrMapFloat32Bool": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Bool != nil { + x.FptrMapFloat32Bool = nil + } + } else { + if x.FptrMapFloat32Bool == nil { + x.FptrMapFloat32Bool = new(map[float32]bool) + } + + if false { + } else { + z.F.DecMapFloat32BoolX(x.FptrMapFloat32Bool, d) + } + } + case "FMapFloat64Intf": + if r.TryDecodeAsNil() { + x.FMapFloat64Intf = nil + } else { + if false { + } else { + z.F.DecMapFloat64IntfX(&x.FMapFloat64Intf, d) + } + } + case "FptrMapFloat64Intf": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Intf != nil { + x.FptrMapFloat64Intf = nil + } + } else { + if x.FptrMapFloat64Intf == nil { + x.FptrMapFloat64Intf = new(map[float64]interface{}) + } + + if false { + } else { + z.F.DecMapFloat64IntfX(x.FptrMapFloat64Intf, d) + } + } + case "FMapFloat64String": + if r.TryDecodeAsNil() { + x.FMapFloat64String = nil + } else { + if false { + } else { + z.F.DecMapFloat64StringX(&x.FMapFloat64String, d) + } + } + case "FptrMapFloat64String": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64String != nil { + x.FptrMapFloat64String = nil + } + } else { + if x.FptrMapFloat64String == nil { + x.FptrMapFloat64String = new(map[float64]string) + } + + if false { + } else { + z.F.DecMapFloat64StringX(x.FptrMapFloat64String, d) + } + } + case "FMapFloat64Uint": + if r.TryDecodeAsNil() { + x.FMapFloat64Uint = nil + } else { + if false { + } else { + z.F.DecMapFloat64UintX(&x.FMapFloat64Uint, d) + } + } + case "FptrMapFloat64Uint": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Uint != nil { + x.FptrMapFloat64Uint = nil + } + } else { + if x.FptrMapFloat64Uint == nil { + x.FptrMapFloat64Uint = new(map[float64]uint) + } + + if false { + } else { + z.F.DecMapFloat64UintX(x.FptrMapFloat64Uint, d) + } + } + case "FMapFloat64Uint8": + if r.TryDecodeAsNil() { + x.FMapFloat64Uint8 = nil + } else { + if false { + } else { + z.F.DecMapFloat64Uint8X(&x.FMapFloat64Uint8, d) + } + } + case "FptrMapFloat64Uint8": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Uint8 != nil { + x.FptrMapFloat64Uint8 = nil + } + } else { + if x.FptrMapFloat64Uint8 == nil { + x.FptrMapFloat64Uint8 = new(map[float64]uint8) + } + + if false { + } else { + z.F.DecMapFloat64Uint8X(x.FptrMapFloat64Uint8, d) + } + } + case "FMapFloat64Uint16": + if r.TryDecodeAsNil() { + x.FMapFloat64Uint16 = nil + } else { + if false { + } else { + z.F.DecMapFloat64Uint16X(&x.FMapFloat64Uint16, d) + } + } + case "FptrMapFloat64Uint16": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Uint16 != nil { + x.FptrMapFloat64Uint16 = nil + } + } else { + if x.FptrMapFloat64Uint16 == nil { + x.FptrMapFloat64Uint16 = new(map[float64]uint16) + } + + if false { + } else { + z.F.DecMapFloat64Uint16X(x.FptrMapFloat64Uint16, d) + } + } + case "FMapFloat64Uint32": + if r.TryDecodeAsNil() { + x.FMapFloat64Uint32 = nil + } else { + if false { + } else { + z.F.DecMapFloat64Uint32X(&x.FMapFloat64Uint32, d) + } + } + case "FptrMapFloat64Uint32": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Uint32 != nil { + x.FptrMapFloat64Uint32 = nil + } + } else { + if x.FptrMapFloat64Uint32 == nil { + x.FptrMapFloat64Uint32 = new(map[float64]uint32) + } + + if false { + } else { + z.F.DecMapFloat64Uint32X(x.FptrMapFloat64Uint32, d) + } + } + case "FMapFloat64Uint64": + if r.TryDecodeAsNil() { + x.FMapFloat64Uint64 = nil + } else { + if false { + } else { + z.F.DecMapFloat64Uint64X(&x.FMapFloat64Uint64, d) + } + } + case "FptrMapFloat64Uint64": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Uint64 != nil { + x.FptrMapFloat64Uint64 = nil + } + } else { + if x.FptrMapFloat64Uint64 == nil { + x.FptrMapFloat64Uint64 = new(map[float64]uint64) + } + + if false { + } else { + z.F.DecMapFloat64Uint64X(x.FptrMapFloat64Uint64, d) + } + } + case "FMapFloat64Uintptr": + if r.TryDecodeAsNil() { + x.FMapFloat64Uintptr = nil + } else { + if false { + } else { + z.F.DecMapFloat64UintptrX(&x.FMapFloat64Uintptr, d) + } + } + case "FptrMapFloat64Uintptr": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Uintptr != nil { + x.FptrMapFloat64Uintptr = nil + } + } else { + if x.FptrMapFloat64Uintptr == nil { + x.FptrMapFloat64Uintptr = new(map[float64]uintptr) + } + + if false { + } else { + z.F.DecMapFloat64UintptrX(x.FptrMapFloat64Uintptr, d) + } + } + case "FMapFloat64Int": + if r.TryDecodeAsNil() { + x.FMapFloat64Int = nil + } else { + if false { + } else { + z.F.DecMapFloat64IntX(&x.FMapFloat64Int, d) + } + } + case "FptrMapFloat64Int": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Int != nil { + x.FptrMapFloat64Int = nil + } + } else { + if x.FptrMapFloat64Int == nil { + x.FptrMapFloat64Int = new(map[float64]int) + } + + if false { + } else { + z.F.DecMapFloat64IntX(x.FptrMapFloat64Int, d) + } + } + case "FMapFloat64Int8": + if r.TryDecodeAsNil() { + x.FMapFloat64Int8 = nil + } else { + if false { + } else { + z.F.DecMapFloat64Int8X(&x.FMapFloat64Int8, d) + } + } + case "FptrMapFloat64Int8": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Int8 != nil { + x.FptrMapFloat64Int8 = nil + } + } else { + if x.FptrMapFloat64Int8 == nil { + x.FptrMapFloat64Int8 = new(map[float64]int8) + } + + if false { + } else { + z.F.DecMapFloat64Int8X(x.FptrMapFloat64Int8, d) + } + } + case "FMapFloat64Int16": + if r.TryDecodeAsNil() { + x.FMapFloat64Int16 = nil + } else { + if false { + } else { + z.F.DecMapFloat64Int16X(&x.FMapFloat64Int16, d) + } + } + case "FptrMapFloat64Int16": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Int16 != nil { + x.FptrMapFloat64Int16 = nil + } + } else { + if x.FptrMapFloat64Int16 == nil { + x.FptrMapFloat64Int16 = new(map[float64]int16) + } + + if false { + } else { + z.F.DecMapFloat64Int16X(x.FptrMapFloat64Int16, d) + } + } + case "FMapFloat64Int32": + if r.TryDecodeAsNil() { + x.FMapFloat64Int32 = nil + } else { + if false { + } else { + z.F.DecMapFloat64Int32X(&x.FMapFloat64Int32, d) + } + } + case "FptrMapFloat64Int32": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Int32 != nil { + x.FptrMapFloat64Int32 = nil + } + } else { + if x.FptrMapFloat64Int32 == nil { + x.FptrMapFloat64Int32 = new(map[float64]int32) + } + + if false { + } else { + z.F.DecMapFloat64Int32X(x.FptrMapFloat64Int32, d) + } + } + case "FMapFloat64Int64": + if r.TryDecodeAsNil() { + x.FMapFloat64Int64 = nil + } else { + if false { + } else { + z.F.DecMapFloat64Int64X(&x.FMapFloat64Int64, d) + } + } + case "FptrMapFloat64Int64": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Int64 != nil { + x.FptrMapFloat64Int64 = nil + } + } else { + if x.FptrMapFloat64Int64 == nil { + x.FptrMapFloat64Int64 = new(map[float64]int64) + } + + if false { + } else { + z.F.DecMapFloat64Int64X(x.FptrMapFloat64Int64, d) + } + } + case "FMapFloat64Float32": + if r.TryDecodeAsNil() { + x.FMapFloat64Float32 = nil + } else { + if false { + } else { + z.F.DecMapFloat64Float32X(&x.FMapFloat64Float32, d) + } + } + case "FptrMapFloat64Float32": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Float32 != nil { + x.FptrMapFloat64Float32 = nil + } + } else { + if x.FptrMapFloat64Float32 == nil { + x.FptrMapFloat64Float32 = new(map[float64]float32) + } + + if false { + } else { + z.F.DecMapFloat64Float32X(x.FptrMapFloat64Float32, d) + } + } + case "FMapFloat64Float64": + if r.TryDecodeAsNil() { + x.FMapFloat64Float64 = nil + } else { + if false { + } else { + z.F.DecMapFloat64Float64X(&x.FMapFloat64Float64, d) + } + } + case "FptrMapFloat64Float64": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Float64 != nil { + x.FptrMapFloat64Float64 = nil + } + } else { + if x.FptrMapFloat64Float64 == nil { + x.FptrMapFloat64Float64 = new(map[float64]float64) + } + + if false { + } else { + z.F.DecMapFloat64Float64X(x.FptrMapFloat64Float64, d) + } + } + case "FMapFloat64Bool": + if r.TryDecodeAsNil() { + x.FMapFloat64Bool = nil + } else { + if false { + } else { + z.F.DecMapFloat64BoolX(&x.FMapFloat64Bool, d) + } + } + case "FptrMapFloat64Bool": + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Bool != nil { + x.FptrMapFloat64Bool = nil + } + } else { + if x.FptrMapFloat64Bool == nil { + x.FptrMapFloat64Bool = new(map[float64]bool) + } + + if false { + } else { + z.F.DecMapFloat64BoolX(x.FptrMapFloat64Bool, d) + } + } + case "FMapUintIntf": + if r.TryDecodeAsNil() { + x.FMapUintIntf = nil + } else { + if false { + } else { + z.F.DecMapUintIntfX(&x.FMapUintIntf, d) + } + } + case "FptrMapUintIntf": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintIntf != nil { + x.FptrMapUintIntf = nil + } + } else { + if x.FptrMapUintIntf == nil { + x.FptrMapUintIntf = new(map[uint]interface{}) + } + + if false { + } else { + z.F.DecMapUintIntfX(x.FptrMapUintIntf, d) + } + } + case "FMapUintString": + if r.TryDecodeAsNil() { + x.FMapUintString = nil + } else { + if false { + } else { + z.F.DecMapUintStringX(&x.FMapUintString, d) + } + } + case "FptrMapUintString": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintString != nil { + x.FptrMapUintString = nil + } + } else { + if x.FptrMapUintString == nil { + x.FptrMapUintString = new(map[uint]string) + } + + if false { + } else { + z.F.DecMapUintStringX(x.FptrMapUintString, d) + } + } + case "FMapUintUint": + if r.TryDecodeAsNil() { + x.FMapUintUint = nil + } else { + if false { + } else { + z.F.DecMapUintUintX(&x.FMapUintUint, d) + } + } + case "FptrMapUintUint": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintUint != nil { + x.FptrMapUintUint = nil + } + } else { + if x.FptrMapUintUint == nil { + x.FptrMapUintUint = new(map[uint]uint) + } + + if false { + } else { + z.F.DecMapUintUintX(x.FptrMapUintUint, d) + } + } + case "FMapUintUint8": + if r.TryDecodeAsNil() { + x.FMapUintUint8 = nil + } else { + if false { + } else { + z.F.DecMapUintUint8X(&x.FMapUintUint8, d) + } + } + case "FptrMapUintUint8": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintUint8 != nil { + x.FptrMapUintUint8 = nil + } + } else { + if x.FptrMapUintUint8 == nil { + x.FptrMapUintUint8 = new(map[uint]uint8) + } + + if false { + } else { + z.F.DecMapUintUint8X(x.FptrMapUintUint8, d) + } + } + case "FMapUintUint16": + if r.TryDecodeAsNil() { + x.FMapUintUint16 = nil + } else { + if false { + } else { + z.F.DecMapUintUint16X(&x.FMapUintUint16, d) + } + } + case "FptrMapUintUint16": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintUint16 != nil { + x.FptrMapUintUint16 = nil + } + } else { + if x.FptrMapUintUint16 == nil { + x.FptrMapUintUint16 = new(map[uint]uint16) + } + + if false { + } else { + z.F.DecMapUintUint16X(x.FptrMapUintUint16, d) + } + } + case "FMapUintUint32": + if r.TryDecodeAsNil() { + x.FMapUintUint32 = nil + } else { + if false { + } else { + z.F.DecMapUintUint32X(&x.FMapUintUint32, d) + } + } + case "FptrMapUintUint32": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintUint32 != nil { + x.FptrMapUintUint32 = nil + } + } else { + if x.FptrMapUintUint32 == nil { + x.FptrMapUintUint32 = new(map[uint]uint32) + } + + if false { + } else { + z.F.DecMapUintUint32X(x.FptrMapUintUint32, d) + } + } + case "FMapUintUint64": + if r.TryDecodeAsNil() { + x.FMapUintUint64 = nil + } else { + if false { + } else { + z.F.DecMapUintUint64X(&x.FMapUintUint64, d) + } + } + case "FptrMapUintUint64": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintUint64 != nil { + x.FptrMapUintUint64 = nil + } + } else { + if x.FptrMapUintUint64 == nil { + x.FptrMapUintUint64 = new(map[uint]uint64) + } + + if false { + } else { + z.F.DecMapUintUint64X(x.FptrMapUintUint64, d) + } + } + case "FMapUintUintptr": + if r.TryDecodeAsNil() { + x.FMapUintUintptr = nil + } else { + if false { + } else { + z.F.DecMapUintUintptrX(&x.FMapUintUintptr, d) + } + } + case "FptrMapUintUintptr": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintUintptr != nil { + x.FptrMapUintUintptr = nil + } + } else { + if x.FptrMapUintUintptr == nil { + x.FptrMapUintUintptr = new(map[uint]uintptr) + } + + if false { + } else { + z.F.DecMapUintUintptrX(x.FptrMapUintUintptr, d) + } + } + case "FMapUintInt": + if r.TryDecodeAsNil() { + x.FMapUintInt = nil + } else { + if false { + } else { + z.F.DecMapUintIntX(&x.FMapUintInt, d) + } + } + case "FptrMapUintInt": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintInt != nil { + x.FptrMapUintInt = nil + } + } else { + if x.FptrMapUintInt == nil { + x.FptrMapUintInt = new(map[uint]int) + } + + if false { + } else { + z.F.DecMapUintIntX(x.FptrMapUintInt, d) + } + } + case "FMapUintInt8": + if r.TryDecodeAsNil() { + x.FMapUintInt8 = nil + } else { + if false { + } else { + z.F.DecMapUintInt8X(&x.FMapUintInt8, d) + } + } + case "FptrMapUintInt8": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintInt8 != nil { + x.FptrMapUintInt8 = nil + } + } else { + if x.FptrMapUintInt8 == nil { + x.FptrMapUintInt8 = new(map[uint]int8) + } + + if false { + } else { + z.F.DecMapUintInt8X(x.FptrMapUintInt8, d) + } + } + case "FMapUintInt16": + if r.TryDecodeAsNil() { + x.FMapUintInt16 = nil + } else { + if false { + } else { + z.F.DecMapUintInt16X(&x.FMapUintInt16, d) + } + } + case "FptrMapUintInt16": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintInt16 != nil { + x.FptrMapUintInt16 = nil + } + } else { + if x.FptrMapUintInt16 == nil { + x.FptrMapUintInt16 = new(map[uint]int16) + } + + if false { + } else { + z.F.DecMapUintInt16X(x.FptrMapUintInt16, d) + } + } + case "FMapUintInt32": + if r.TryDecodeAsNil() { + x.FMapUintInt32 = nil + } else { + if false { + } else { + z.F.DecMapUintInt32X(&x.FMapUintInt32, d) + } + } + case "FptrMapUintInt32": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintInt32 != nil { + x.FptrMapUintInt32 = nil + } + } else { + if x.FptrMapUintInt32 == nil { + x.FptrMapUintInt32 = new(map[uint]int32) + } + + if false { + } else { + z.F.DecMapUintInt32X(x.FptrMapUintInt32, d) + } + } + case "FMapUintInt64": + if r.TryDecodeAsNil() { + x.FMapUintInt64 = nil + } else { + if false { + } else { + z.F.DecMapUintInt64X(&x.FMapUintInt64, d) + } + } + case "FptrMapUintInt64": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintInt64 != nil { + x.FptrMapUintInt64 = nil + } + } else { + if x.FptrMapUintInt64 == nil { + x.FptrMapUintInt64 = new(map[uint]int64) + } + + if false { + } else { + z.F.DecMapUintInt64X(x.FptrMapUintInt64, d) + } + } + case "FMapUintFloat32": + if r.TryDecodeAsNil() { + x.FMapUintFloat32 = nil + } else { + if false { + } else { + z.F.DecMapUintFloat32X(&x.FMapUintFloat32, d) + } + } + case "FptrMapUintFloat32": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintFloat32 != nil { + x.FptrMapUintFloat32 = nil + } + } else { + if x.FptrMapUintFloat32 == nil { + x.FptrMapUintFloat32 = new(map[uint]float32) + } + + if false { + } else { + z.F.DecMapUintFloat32X(x.FptrMapUintFloat32, d) + } + } + case "FMapUintFloat64": + if r.TryDecodeAsNil() { + x.FMapUintFloat64 = nil + } else { + if false { + } else { + z.F.DecMapUintFloat64X(&x.FMapUintFloat64, d) + } + } + case "FptrMapUintFloat64": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintFloat64 != nil { + x.FptrMapUintFloat64 = nil + } + } else { + if x.FptrMapUintFloat64 == nil { + x.FptrMapUintFloat64 = new(map[uint]float64) + } + + if false { + } else { + z.F.DecMapUintFloat64X(x.FptrMapUintFloat64, d) + } + } + case "FMapUintBool": + if r.TryDecodeAsNil() { + x.FMapUintBool = nil + } else { + if false { + } else { + z.F.DecMapUintBoolX(&x.FMapUintBool, d) + } + } + case "FptrMapUintBool": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintBool != nil { + x.FptrMapUintBool = nil + } + } else { + if x.FptrMapUintBool == nil { + x.FptrMapUintBool = new(map[uint]bool) + } + + if false { + } else { + z.F.DecMapUintBoolX(x.FptrMapUintBool, d) + } + } + case "FMapUint8Intf": + if r.TryDecodeAsNil() { + x.FMapUint8Intf = nil + } else { + if false { + } else { + z.F.DecMapUint8IntfX(&x.FMapUint8Intf, d) + } + } + case "FptrMapUint8Intf": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Intf != nil { + x.FptrMapUint8Intf = nil + } + } else { + if x.FptrMapUint8Intf == nil { + x.FptrMapUint8Intf = new(map[uint8]interface{}) + } + + if false { + } else { + z.F.DecMapUint8IntfX(x.FptrMapUint8Intf, d) + } + } + case "FMapUint8String": + if r.TryDecodeAsNil() { + x.FMapUint8String = nil + } else { + if false { + } else { + z.F.DecMapUint8StringX(&x.FMapUint8String, d) + } + } + case "FptrMapUint8String": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8String != nil { + x.FptrMapUint8String = nil + } + } else { + if x.FptrMapUint8String == nil { + x.FptrMapUint8String = new(map[uint8]string) + } + + if false { + } else { + z.F.DecMapUint8StringX(x.FptrMapUint8String, d) + } + } + case "FMapUint8Uint": + if r.TryDecodeAsNil() { + x.FMapUint8Uint = nil + } else { + if false { + } else { + z.F.DecMapUint8UintX(&x.FMapUint8Uint, d) + } + } + case "FptrMapUint8Uint": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Uint != nil { + x.FptrMapUint8Uint = nil + } + } else { + if x.FptrMapUint8Uint == nil { + x.FptrMapUint8Uint = new(map[uint8]uint) + } + + if false { + } else { + z.F.DecMapUint8UintX(x.FptrMapUint8Uint, d) + } + } + case "FMapUint8Uint8": + if r.TryDecodeAsNil() { + x.FMapUint8Uint8 = nil + } else { + if false { + } else { + z.F.DecMapUint8Uint8X(&x.FMapUint8Uint8, d) + } + } + case "FptrMapUint8Uint8": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Uint8 != nil { + x.FptrMapUint8Uint8 = nil + } + } else { + if x.FptrMapUint8Uint8 == nil { + x.FptrMapUint8Uint8 = new(map[uint8]uint8) + } + + if false { + } else { + z.F.DecMapUint8Uint8X(x.FptrMapUint8Uint8, d) + } + } + case "FMapUint8Uint16": + if r.TryDecodeAsNil() { + x.FMapUint8Uint16 = nil + } else { + if false { + } else { + z.F.DecMapUint8Uint16X(&x.FMapUint8Uint16, d) + } + } + case "FptrMapUint8Uint16": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Uint16 != nil { + x.FptrMapUint8Uint16 = nil + } + } else { + if x.FptrMapUint8Uint16 == nil { + x.FptrMapUint8Uint16 = new(map[uint8]uint16) + } + + if false { + } else { + z.F.DecMapUint8Uint16X(x.FptrMapUint8Uint16, d) + } + } + case "FMapUint8Uint32": + if r.TryDecodeAsNil() { + x.FMapUint8Uint32 = nil + } else { + if false { + } else { + z.F.DecMapUint8Uint32X(&x.FMapUint8Uint32, d) + } + } + case "FptrMapUint8Uint32": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Uint32 != nil { + x.FptrMapUint8Uint32 = nil + } + } else { + if x.FptrMapUint8Uint32 == nil { + x.FptrMapUint8Uint32 = new(map[uint8]uint32) + } + + if false { + } else { + z.F.DecMapUint8Uint32X(x.FptrMapUint8Uint32, d) + } + } + case "FMapUint8Uint64": + if r.TryDecodeAsNil() { + x.FMapUint8Uint64 = nil + } else { + if false { + } else { + z.F.DecMapUint8Uint64X(&x.FMapUint8Uint64, d) + } + } + case "FptrMapUint8Uint64": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Uint64 != nil { + x.FptrMapUint8Uint64 = nil + } + } else { + if x.FptrMapUint8Uint64 == nil { + x.FptrMapUint8Uint64 = new(map[uint8]uint64) + } + + if false { + } else { + z.F.DecMapUint8Uint64X(x.FptrMapUint8Uint64, d) + } + } + case "FMapUint8Uintptr": + if r.TryDecodeAsNil() { + x.FMapUint8Uintptr = nil + } else { + if false { + } else { + z.F.DecMapUint8UintptrX(&x.FMapUint8Uintptr, d) + } + } + case "FptrMapUint8Uintptr": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Uintptr != nil { + x.FptrMapUint8Uintptr = nil + } + } else { + if x.FptrMapUint8Uintptr == nil { + x.FptrMapUint8Uintptr = new(map[uint8]uintptr) + } + + if false { + } else { + z.F.DecMapUint8UintptrX(x.FptrMapUint8Uintptr, d) + } + } + case "FMapUint8Int": + if r.TryDecodeAsNil() { + x.FMapUint8Int = nil + } else { + if false { + } else { + z.F.DecMapUint8IntX(&x.FMapUint8Int, d) + } + } + case "FptrMapUint8Int": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Int != nil { + x.FptrMapUint8Int = nil + } + } else { + if x.FptrMapUint8Int == nil { + x.FptrMapUint8Int = new(map[uint8]int) + } + + if false { + } else { + z.F.DecMapUint8IntX(x.FptrMapUint8Int, d) + } + } + case "FMapUint8Int8": + if r.TryDecodeAsNil() { + x.FMapUint8Int8 = nil + } else { + if false { + } else { + z.F.DecMapUint8Int8X(&x.FMapUint8Int8, d) + } + } + case "FptrMapUint8Int8": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Int8 != nil { + x.FptrMapUint8Int8 = nil + } + } else { + if x.FptrMapUint8Int8 == nil { + x.FptrMapUint8Int8 = new(map[uint8]int8) + } + + if false { + } else { + z.F.DecMapUint8Int8X(x.FptrMapUint8Int8, d) + } + } + case "FMapUint8Int16": + if r.TryDecodeAsNil() { + x.FMapUint8Int16 = nil + } else { + if false { + } else { + z.F.DecMapUint8Int16X(&x.FMapUint8Int16, d) + } + } + case "FptrMapUint8Int16": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Int16 != nil { + x.FptrMapUint8Int16 = nil + } + } else { + if x.FptrMapUint8Int16 == nil { + x.FptrMapUint8Int16 = new(map[uint8]int16) + } + + if false { + } else { + z.F.DecMapUint8Int16X(x.FptrMapUint8Int16, d) + } + } + case "FMapUint8Int32": + if r.TryDecodeAsNil() { + x.FMapUint8Int32 = nil + } else { + if false { + } else { + z.F.DecMapUint8Int32X(&x.FMapUint8Int32, d) + } + } + case "FptrMapUint8Int32": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Int32 != nil { + x.FptrMapUint8Int32 = nil + } + } else { + if x.FptrMapUint8Int32 == nil { + x.FptrMapUint8Int32 = new(map[uint8]int32) + } + + if false { + } else { + z.F.DecMapUint8Int32X(x.FptrMapUint8Int32, d) + } + } + case "FMapUint8Int64": + if r.TryDecodeAsNil() { + x.FMapUint8Int64 = nil + } else { + if false { + } else { + z.F.DecMapUint8Int64X(&x.FMapUint8Int64, d) + } + } + case "FptrMapUint8Int64": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Int64 != nil { + x.FptrMapUint8Int64 = nil + } + } else { + if x.FptrMapUint8Int64 == nil { + x.FptrMapUint8Int64 = new(map[uint8]int64) + } + + if false { + } else { + z.F.DecMapUint8Int64X(x.FptrMapUint8Int64, d) + } + } + case "FMapUint8Float32": + if r.TryDecodeAsNil() { + x.FMapUint8Float32 = nil + } else { + if false { + } else { + z.F.DecMapUint8Float32X(&x.FMapUint8Float32, d) + } + } + case "FptrMapUint8Float32": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Float32 != nil { + x.FptrMapUint8Float32 = nil + } + } else { + if x.FptrMapUint8Float32 == nil { + x.FptrMapUint8Float32 = new(map[uint8]float32) + } + + if false { + } else { + z.F.DecMapUint8Float32X(x.FptrMapUint8Float32, d) + } + } + case "FMapUint8Float64": + if r.TryDecodeAsNil() { + x.FMapUint8Float64 = nil + } else { + if false { + } else { + z.F.DecMapUint8Float64X(&x.FMapUint8Float64, d) + } + } + case "FptrMapUint8Float64": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Float64 != nil { + x.FptrMapUint8Float64 = nil + } + } else { + if x.FptrMapUint8Float64 == nil { + x.FptrMapUint8Float64 = new(map[uint8]float64) + } + + if false { + } else { + z.F.DecMapUint8Float64X(x.FptrMapUint8Float64, d) + } + } + case "FMapUint8Bool": + if r.TryDecodeAsNil() { + x.FMapUint8Bool = nil + } else { + if false { + } else { + z.F.DecMapUint8BoolX(&x.FMapUint8Bool, d) + } + } + case "FptrMapUint8Bool": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Bool != nil { + x.FptrMapUint8Bool = nil + } + } else { + if x.FptrMapUint8Bool == nil { + x.FptrMapUint8Bool = new(map[uint8]bool) + } + + if false { + } else { + z.F.DecMapUint8BoolX(x.FptrMapUint8Bool, d) + } + } + case "FMapUint16Intf": + if r.TryDecodeAsNil() { + x.FMapUint16Intf = nil + } else { + if false { + } else { + z.F.DecMapUint16IntfX(&x.FMapUint16Intf, d) + } + } + case "FptrMapUint16Intf": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Intf != nil { + x.FptrMapUint16Intf = nil + } + } else { + if x.FptrMapUint16Intf == nil { + x.FptrMapUint16Intf = new(map[uint16]interface{}) + } + + if false { + } else { + z.F.DecMapUint16IntfX(x.FptrMapUint16Intf, d) + } + } + case "FMapUint16String": + if r.TryDecodeAsNil() { + x.FMapUint16String = nil + } else { + if false { + } else { + z.F.DecMapUint16StringX(&x.FMapUint16String, d) + } + } + case "FptrMapUint16String": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16String != nil { + x.FptrMapUint16String = nil + } + } else { + if x.FptrMapUint16String == nil { + x.FptrMapUint16String = new(map[uint16]string) + } + + if false { + } else { + z.F.DecMapUint16StringX(x.FptrMapUint16String, d) + } + } + case "FMapUint16Uint": + if r.TryDecodeAsNil() { + x.FMapUint16Uint = nil + } else { + if false { + } else { + z.F.DecMapUint16UintX(&x.FMapUint16Uint, d) + } + } + case "FptrMapUint16Uint": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Uint != nil { + x.FptrMapUint16Uint = nil + } + } else { + if x.FptrMapUint16Uint == nil { + x.FptrMapUint16Uint = new(map[uint16]uint) + } + + if false { + } else { + z.F.DecMapUint16UintX(x.FptrMapUint16Uint, d) + } + } + case "FMapUint16Uint8": + if r.TryDecodeAsNil() { + x.FMapUint16Uint8 = nil + } else { + if false { + } else { + z.F.DecMapUint16Uint8X(&x.FMapUint16Uint8, d) + } + } + case "FptrMapUint16Uint8": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Uint8 != nil { + x.FptrMapUint16Uint8 = nil + } + } else { + if x.FptrMapUint16Uint8 == nil { + x.FptrMapUint16Uint8 = new(map[uint16]uint8) + } + + if false { + } else { + z.F.DecMapUint16Uint8X(x.FptrMapUint16Uint8, d) + } + } + case "FMapUint16Uint16": + if r.TryDecodeAsNil() { + x.FMapUint16Uint16 = nil + } else { + if false { + } else { + z.F.DecMapUint16Uint16X(&x.FMapUint16Uint16, d) + } + } + case "FptrMapUint16Uint16": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Uint16 != nil { + x.FptrMapUint16Uint16 = nil + } + } else { + if x.FptrMapUint16Uint16 == nil { + x.FptrMapUint16Uint16 = new(map[uint16]uint16) + } + + if false { + } else { + z.F.DecMapUint16Uint16X(x.FptrMapUint16Uint16, d) + } + } + case "FMapUint16Uint32": + if r.TryDecodeAsNil() { + x.FMapUint16Uint32 = nil + } else { + if false { + } else { + z.F.DecMapUint16Uint32X(&x.FMapUint16Uint32, d) + } + } + case "FptrMapUint16Uint32": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Uint32 != nil { + x.FptrMapUint16Uint32 = nil + } + } else { + if x.FptrMapUint16Uint32 == nil { + x.FptrMapUint16Uint32 = new(map[uint16]uint32) + } + + if false { + } else { + z.F.DecMapUint16Uint32X(x.FptrMapUint16Uint32, d) + } + } + case "FMapUint16Uint64": + if r.TryDecodeAsNil() { + x.FMapUint16Uint64 = nil + } else { + if false { + } else { + z.F.DecMapUint16Uint64X(&x.FMapUint16Uint64, d) + } + } + case "FptrMapUint16Uint64": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Uint64 != nil { + x.FptrMapUint16Uint64 = nil + } + } else { + if x.FptrMapUint16Uint64 == nil { + x.FptrMapUint16Uint64 = new(map[uint16]uint64) + } + + if false { + } else { + z.F.DecMapUint16Uint64X(x.FptrMapUint16Uint64, d) + } + } + case "FMapUint16Uintptr": + if r.TryDecodeAsNil() { + x.FMapUint16Uintptr = nil + } else { + if false { + } else { + z.F.DecMapUint16UintptrX(&x.FMapUint16Uintptr, d) + } + } + case "FptrMapUint16Uintptr": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Uintptr != nil { + x.FptrMapUint16Uintptr = nil + } + } else { + if x.FptrMapUint16Uintptr == nil { + x.FptrMapUint16Uintptr = new(map[uint16]uintptr) + } + + if false { + } else { + z.F.DecMapUint16UintptrX(x.FptrMapUint16Uintptr, d) + } + } + case "FMapUint16Int": + if r.TryDecodeAsNil() { + x.FMapUint16Int = nil + } else { + if false { + } else { + z.F.DecMapUint16IntX(&x.FMapUint16Int, d) + } + } + case "FptrMapUint16Int": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Int != nil { + x.FptrMapUint16Int = nil + } + } else { + if x.FptrMapUint16Int == nil { + x.FptrMapUint16Int = new(map[uint16]int) + } + + if false { + } else { + z.F.DecMapUint16IntX(x.FptrMapUint16Int, d) + } + } + case "FMapUint16Int8": + if r.TryDecodeAsNil() { + x.FMapUint16Int8 = nil + } else { + if false { + } else { + z.F.DecMapUint16Int8X(&x.FMapUint16Int8, d) + } + } + case "FptrMapUint16Int8": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Int8 != nil { + x.FptrMapUint16Int8 = nil + } + } else { + if x.FptrMapUint16Int8 == nil { + x.FptrMapUint16Int8 = new(map[uint16]int8) + } + + if false { + } else { + z.F.DecMapUint16Int8X(x.FptrMapUint16Int8, d) + } + } + case "FMapUint16Int16": + if r.TryDecodeAsNil() { + x.FMapUint16Int16 = nil + } else { + if false { + } else { + z.F.DecMapUint16Int16X(&x.FMapUint16Int16, d) + } + } + case "FptrMapUint16Int16": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Int16 != nil { + x.FptrMapUint16Int16 = nil + } + } else { + if x.FptrMapUint16Int16 == nil { + x.FptrMapUint16Int16 = new(map[uint16]int16) + } + + if false { + } else { + z.F.DecMapUint16Int16X(x.FptrMapUint16Int16, d) + } + } + case "FMapUint16Int32": + if r.TryDecodeAsNil() { + x.FMapUint16Int32 = nil + } else { + if false { + } else { + z.F.DecMapUint16Int32X(&x.FMapUint16Int32, d) + } + } + case "FptrMapUint16Int32": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Int32 != nil { + x.FptrMapUint16Int32 = nil + } + } else { + if x.FptrMapUint16Int32 == nil { + x.FptrMapUint16Int32 = new(map[uint16]int32) + } + + if false { + } else { + z.F.DecMapUint16Int32X(x.FptrMapUint16Int32, d) + } + } + case "FMapUint16Int64": + if r.TryDecodeAsNil() { + x.FMapUint16Int64 = nil + } else { + if false { + } else { + z.F.DecMapUint16Int64X(&x.FMapUint16Int64, d) + } + } + case "FptrMapUint16Int64": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Int64 != nil { + x.FptrMapUint16Int64 = nil + } + } else { + if x.FptrMapUint16Int64 == nil { + x.FptrMapUint16Int64 = new(map[uint16]int64) + } + + if false { + } else { + z.F.DecMapUint16Int64X(x.FptrMapUint16Int64, d) + } + } + case "FMapUint16Float32": + if r.TryDecodeAsNil() { + x.FMapUint16Float32 = nil + } else { + if false { + } else { + z.F.DecMapUint16Float32X(&x.FMapUint16Float32, d) + } + } + case "FptrMapUint16Float32": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Float32 != nil { + x.FptrMapUint16Float32 = nil + } + } else { + if x.FptrMapUint16Float32 == nil { + x.FptrMapUint16Float32 = new(map[uint16]float32) + } + + if false { + } else { + z.F.DecMapUint16Float32X(x.FptrMapUint16Float32, d) + } + } + case "FMapUint16Float64": + if r.TryDecodeAsNil() { + x.FMapUint16Float64 = nil + } else { + if false { + } else { + z.F.DecMapUint16Float64X(&x.FMapUint16Float64, d) + } + } + case "FptrMapUint16Float64": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Float64 != nil { + x.FptrMapUint16Float64 = nil + } + } else { + if x.FptrMapUint16Float64 == nil { + x.FptrMapUint16Float64 = new(map[uint16]float64) + } + + if false { + } else { + z.F.DecMapUint16Float64X(x.FptrMapUint16Float64, d) + } + } + case "FMapUint16Bool": + if r.TryDecodeAsNil() { + x.FMapUint16Bool = nil + } else { + if false { + } else { + z.F.DecMapUint16BoolX(&x.FMapUint16Bool, d) + } + } + case "FptrMapUint16Bool": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Bool != nil { + x.FptrMapUint16Bool = nil + } + } else { + if x.FptrMapUint16Bool == nil { + x.FptrMapUint16Bool = new(map[uint16]bool) + } + + if false { + } else { + z.F.DecMapUint16BoolX(x.FptrMapUint16Bool, d) + } + } + case "FMapUint32Intf": + if r.TryDecodeAsNil() { + x.FMapUint32Intf = nil + } else { + if false { + } else { + z.F.DecMapUint32IntfX(&x.FMapUint32Intf, d) + } + } + case "FptrMapUint32Intf": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Intf != nil { + x.FptrMapUint32Intf = nil + } + } else { + if x.FptrMapUint32Intf == nil { + x.FptrMapUint32Intf = new(map[uint32]interface{}) + } + + if false { + } else { + z.F.DecMapUint32IntfX(x.FptrMapUint32Intf, d) + } + } + case "FMapUint32String": + if r.TryDecodeAsNil() { + x.FMapUint32String = nil + } else { + if false { + } else { + z.F.DecMapUint32StringX(&x.FMapUint32String, d) + } + } + case "FptrMapUint32String": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32String != nil { + x.FptrMapUint32String = nil + } + } else { + if x.FptrMapUint32String == nil { + x.FptrMapUint32String = new(map[uint32]string) + } + + if false { + } else { + z.F.DecMapUint32StringX(x.FptrMapUint32String, d) + } + } + case "FMapUint32Uint": + if r.TryDecodeAsNil() { + x.FMapUint32Uint = nil + } else { + if false { + } else { + z.F.DecMapUint32UintX(&x.FMapUint32Uint, d) + } + } + case "FptrMapUint32Uint": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Uint != nil { + x.FptrMapUint32Uint = nil + } + } else { + if x.FptrMapUint32Uint == nil { + x.FptrMapUint32Uint = new(map[uint32]uint) + } + + if false { + } else { + z.F.DecMapUint32UintX(x.FptrMapUint32Uint, d) + } + } + case "FMapUint32Uint8": + if r.TryDecodeAsNil() { + x.FMapUint32Uint8 = nil + } else { + if false { + } else { + z.F.DecMapUint32Uint8X(&x.FMapUint32Uint8, d) + } + } + case "FptrMapUint32Uint8": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Uint8 != nil { + x.FptrMapUint32Uint8 = nil + } + } else { + if x.FptrMapUint32Uint8 == nil { + x.FptrMapUint32Uint8 = new(map[uint32]uint8) + } + + if false { + } else { + z.F.DecMapUint32Uint8X(x.FptrMapUint32Uint8, d) + } + } + case "FMapUint32Uint16": + if r.TryDecodeAsNil() { + x.FMapUint32Uint16 = nil + } else { + if false { + } else { + z.F.DecMapUint32Uint16X(&x.FMapUint32Uint16, d) + } + } + case "FptrMapUint32Uint16": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Uint16 != nil { + x.FptrMapUint32Uint16 = nil + } + } else { + if x.FptrMapUint32Uint16 == nil { + x.FptrMapUint32Uint16 = new(map[uint32]uint16) + } + + if false { + } else { + z.F.DecMapUint32Uint16X(x.FptrMapUint32Uint16, d) + } + } + case "FMapUint32Uint32": + if r.TryDecodeAsNil() { + x.FMapUint32Uint32 = nil + } else { + if false { + } else { + z.F.DecMapUint32Uint32X(&x.FMapUint32Uint32, d) + } + } + case "FptrMapUint32Uint32": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Uint32 != nil { + x.FptrMapUint32Uint32 = nil + } + } else { + if x.FptrMapUint32Uint32 == nil { + x.FptrMapUint32Uint32 = new(map[uint32]uint32) + } + + if false { + } else { + z.F.DecMapUint32Uint32X(x.FptrMapUint32Uint32, d) + } + } + case "FMapUint32Uint64": + if r.TryDecodeAsNil() { + x.FMapUint32Uint64 = nil + } else { + if false { + } else { + z.F.DecMapUint32Uint64X(&x.FMapUint32Uint64, d) + } + } + case "FptrMapUint32Uint64": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Uint64 != nil { + x.FptrMapUint32Uint64 = nil + } + } else { + if x.FptrMapUint32Uint64 == nil { + x.FptrMapUint32Uint64 = new(map[uint32]uint64) + } + + if false { + } else { + z.F.DecMapUint32Uint64X(x.FptrMapUint32Uint64, d) + } + } + case "FMapUint32Uintptr": + if r.TryDecodeAsNil() { + x.FMapUint32Uintptr = nil + } else { + if false { + } else { + z.F.DecMapUint32UintptrX(&x.FMapUint32Uintptr, d) + } + } + case "FptrMapUint32Uintptr": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Uintptr != nil { + x.FptrMapUint32Uintptr = nil + } + } else { + if x.FptrMapUint32Uintptr == nil { + x.FptrMapUint32Uintptr = new(map[uint32]uintptr) + } + + if false { + } else { + z.F.DecMapUint32UintptrX(x.FptrMapUint32Uintptr, d) + } + } + case "FMapUint32Int": + if r.TryDecodeAsNil() { + x.FMapUint32Int = nil + } else { + if false { + } else { + z.F.DecMapUint32IntX(&x.FMapUint32Int, d) + } + } + case "FptrMapUint32Int": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Int != nil { + x.FptrMapUint32Int = nil + } + } else { + if x.FptrMapUint32Int == nil { + x.FptrMapUint32Int = new(map[uint32]int) + } + + if false { + } else { + z.F.DecMapUint32IntX(x.FptrMapUint32Int, d) + } + } + case "FMapUint32Int8": + if r.TryDecodeAsNil() { + x.FMapUint32Int8 = nil + } else { + if false { + } else { + z.F.DecMapUint32Int8X(&x.FMapUint32Int8, d) + } + } + case "FptrMapUint32Int8": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Int8 != nil { + x.FptrMapUint32Int8 = nil + } + } else { + if x.FptrMapUint32Int8 == nil { + x.FptrMapUint32Int8 = new(map[uint32]int8) + } + + if false { + } else { + z.F.DecMapUint32Int8X(x.FptrMapUint32Int8, d) + } + } + case "FMapUint32Int16": + if r.TryDecodeAsNil() { + x.FMapUint32Int16 = nil + } else { + if false { + } else { + z.F.DecMapUint32Int16X(&x.FMapUint32Int16, d) + } + } + case "FptrMapUint32Int16": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Int16 != nil { + x.FptrMapUint32Int16 = nil + } + } else { + if x.FptrMapUint32Int16 == nil { + x.FptrMapUint32Int16 = new(map[uint32]int16) + } + + if false { + } else { + z.F.DecMapUint32Int16X(x.FptrMapUint32Int16, d) + } + } + case "FMapUint32Int32": + if r.TryDecodeAsNil() { + x.FMapUint32Int32 = nil + } else { + if false { + } else { + z.F.DecMapUint32Int32X(&x.FMapUint32Int32, d) + } + } + case "FptrMapUint32Int32": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Int32 != nil { + x.FptrMapUint32Int32 = nil + } + } else { + if x.FptrMapUint32Int32 == nil { + x.FptrMapUint32Int32 = new(map[uint32]int32) + } + + if false { + } else { + z.F.DecMapUint32Int32X(x.FptrMapUint32Int32, d) + } + } + case "FMapUint32Int64": + if r.TryDecodeAsNil() { + x.FMapUint32Int64 = nil + } else { + if false { + } else { + z.F.DecMapUint32Int64X(&x.FMapUint32Int64, d) + } + } + case "FptrMapUint32Int64": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Int64 != nil { + x.FptrMapUint32Int64 = nil + } + } else { + if x.FptrMapUint32Int64 == nil { + x.FptrMapUint32Int64 = new(map[uint32]int64) + } + + if false { + } else { + z.F.DecMapUint32Int64X(x.FptrMapUint32Int64, d) + } + } + case "FMapUint32Float32": + if r.TryDecodeAsNil() { + x.FMapUint32Float32 = nil + } else { + if false { + } else { + z.F.DecMapUint32Float32X(&x.FMapUint32Float32, d) + } + } + case "FptrMapUint32Float32": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Float32 != nil { + x.FptrMapUint32Float32 = nil + } + } else { + if x.FptrMapUint32Float32 == nil { + x.FptrMapUint32Float32 = new(map[uint32]float32) + } + + if false { + } else { + z.F.DecMapUint32Float32X(x.FptrMapUint32Float32, d) + } + } + case "FMapUint32Float64": + if r.TryDecodeAsNil() { + x.FMapUint32Float64 = nil + } else { + if false { + } else { + z.F.DecMapUint32Float64X(&x.FMapUint32Float64, d) + } + } + case "FptrMapUint32Float64": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Float64 != nil { + x.FptrMapUint32Float64 = nil + } + } else { + if x.FptrMapUint32Float64 == nil { + x.FptrMapUint32Float64 = new(map[uint32]float64) + } + + if false { + } else { + z.F.DecMapUint32Float64X(x.FptrMapUint32Float64, d) + } + } + case "FMapUint32Bool": + if r.TryDecodeAsNil() { + x.FMapUint32Bool = nil + } else { + if false { + } else { + z.F.DecMapUint32BoolX(&x.FMapUint32Bool, d) + } + } + case "FptrMapUint32Bool": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Bool != nil { + x.FptrMapUint32Bool = nil + } + } else { + if x.FptrMapUint32Bool == nil { + x.FptrMapUint32Bool = new(map[uint32]bool) + } + + if false { + } else { + z.F.DecMapUint32BoolX(x.FptrMapUint32Bool, d) + } + } + case "FMapUint64Intf": + if r.TryDecodeAsNil() { + x.FMapUint64Intf = nil + } else { + if false { + } else { + z.F.DecMapUint64IntfX(&x.FMapUint64Intf, d) + } + } + case "FptrMapUint64Intf": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Intf != nil { + x.FptrMapUint64Intf = nil + } + } else { + if x.FptrMapUint64Intf == nil { + x.FptrMapUint64Intf = new(map[uint64]interface{}) + } + + if false { + } else { + z.F.DecMapUint64IntfX(x.FptrMapUint64Intf, d) + } + } + case "FMapUint64String": + if r.TryDecodeAsNil() { + x.FMapUint64String = nil + } else { + if false { + } else { + z.F.DecMapUint64StringX(&x.FMapUint64String, d) + } + } + case "FptrMapUint64String": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64String != nil { + x.FptrMapUint64String = nil + } + } else { + if x.FptrMapUint64String == nil { + x.FptrMapUint64String = new(map[uint64]string) + } + + if false { + } else { + z.F.DecMapUint64StringX(x.FptrMapUint64String, d) + } + } + case "FMapUint64Uint": + if r.TryDecodeAsNil() { + x.FMapUint64Uint = nil + } else { + if false { + } else { + z.F.DecMapUint64UintX(&x.FMapUint64Uint, d) + } + } + case "FptrMapUint64Uint": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Uint != nil { + x.FptrMapUint64Uint = nil + } + } else { + if x.FptrMapUint64Uint == nil { + x.FptrMapUint64Uint = new(map[uint64]uint) + } + + if false { + } else { + z.F.DecMapUint64UintX(x.FptrMapUint64Uint, d) + } + } + case "FMapUint64Uint8": + if r.TryDecodeAsNil() { + x.FMapUint64Uint8 = nil + } else { + if false { + } else { + z.F.DecMapUint64Uint8X(&x.FMapUint64Uint8, d) + } + } + case "FptrMapUint64Uint8": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Uint8 != nil { + x.FptrMapUint64Uint8 = nil + } + } else { + if x.FptrMapUint64Uint8 == nil { + x.FptrMapUint64Uint8 = new(map[uint64]uint8) + } + + if false { + } else { + z.F.DecMapUint64Uint8X(x.FptrMapUint64Uint8, d) + } + } + case "FMapUint64Uint16": + if r.TryDecodeAsNil() { + x.FMapUint64Uint16 = nil + } else { + if false { + } else { + z.F.DecMapUint64Uint16X(&x.FMapUint64Uint16, d) + } + } + case "FptrMapUint64Uint16": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Uint16 != nil { + x.FptrMapUint64Uint16 = nil + } + } else { + if x.FptrMapUint64Uint16 == nil { + x.FptrMapUint64Uint16 = new(map[uint64]uint16) + } + + if false { + } else { + z.F.DecMapUint64Uint16X(x.FptrMapUint64Uint16, d) + } + } + case "FMapUint64Uint32": + if r.TryDecodeAsNil() { + x.FMapUint64Uint32 = nil + } else { + if false { + } else { + z.F.DecMapUint64Uint32X(&x.FMapUint64Uint32, d) + } + } + case "FptrMapUint64Uint32": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Uint32 != nil { + x.FptrMapUint64Uint32 = nil + } + } else { + if x.FptrMapUint64Uint32 == nil { + x.FptrMapUint64Uint32 = new(map[uint64]uint32) + } + + if false { + } else { + z.F.DecMapUint64Uint32X(x.FptrMapUint64Uint32, d) + } + } + case "FMapUint64Uint64": + if r.TryDecodeAsNil() { + x.FMapUint64Uint64 = nil + } else { + if false { + } else { + z.F.DecMapUint64Uint64X(&x.FMapUint64Uint64, d) + } + } + case "FptrMapUint64Uint64": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Uint64 != nil { + x.FptrMapUint64Uint64 = nil + } + } else { + if x.FptrMapUint64Uint64 == nil { + x.FptrMapUint64Uint64 = new(map[uint64]uint64) + } + + if false { + } else { + z.F.DecMapUint64Uint64X(x.FptrMapUint64Uint64, d) + } + } + case "FMapUint64Uintptr": + if r.TryDecodeAsNil() { + x.FMapUint64Uintptr = nil + } else { + if false { + } else { + z.F.DecMapUint64UintptrX(&x.FMapUint64Uintptr, d) + } + } + case "FptrMapUint64Uintptr": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Uintptr != nil { + x.FptrMapUint64Uintptr = nil + } + } else { + if x.FptrMapUint64Uintptr == nil { + x.FptrMapUint64Uintptr = new(map[uint64]uintptr) + } + + if false { + } else { + z.F.DecMapUint64UintptrX(x.FptrMapUint64Uintptr, d) + } + } + case "FMapUint64Int": + if r.TryDecodeAsNil() { + x.FMapUint64Int = nil + } else { + if false { + } else { + z.F.DecMapUint64IntX(&x.FMapUint64Int, d) + } + } + case "FptrMapUint64Int": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Int != nil { + x.FptrMapUint64Int = nil + } + } else { + if x.FptrMapUint64Int == nil { + x.FptrMapUint64Int = new(map[uint64]int) + } + + if false { + } else { + z.F.DecMapUint64IntX(x.FptrMapUint64Int, d) + } + } + case "FMapUint64Int8": + if r.TryDecodeAsNil() { + x.FMapUint64Int8 = nil + } else { + if false { + } else { + z.F.DecMapUint64Int8X(&x.FMapUint64Int8, d) + } + } + case "FptrMapUint64Int8": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Int8 != nil { + x.FptrMapUint64Int8 = nil + } + } else { + if x.FptrMapUint64Int8 == nil { + x.FptrMapUint64Int8 = new(map[uint64]int8) + } + + if false { + } else { + z.F.DecMapUint64Int8X(x.FptrMapUint64Int8, d) + } + } + case "FMapUint64Int16": + if r.TryDecodeAsNil() { + x.FMapUint64Int16 = nil + } else { + if false { + } else { + z.F.DecMapUint64Int16X(&x.FMapUint64Int16, d) + } + } + case "FptrMapUint64Int16": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Int16 != nil { + x.FptrMapUint64Int16 = nil + } + } else { + if x.FptrMapUint64Int16 == nil { + x.FptrMapUint64Int16 = new(map[uint64]int16) + } + + if false { + } else { + z.F.DecMapUint64Int16X(x.FptrMapUint64Int16, d) + } + } + case "FMapUint64Int32": + if r.TryDecodeAsNil() { + x.FMapUint64Int32 = nil + } else { + if false { + } else { + z.F.DecMapUint64Int32X(&x.FMapUint64Int32, d) + } + } + case "FptrMapUint64Int32": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Int32 != nil { + x.FptrMapUint64Int32 = nil + } + } else { + if x.FptrMapUint64Int32 == nil { + x.FptrMapUint64Int32 = new(map[uint64]int32) + } + + if false { + } else { + z.F.DecMapUint64Int32X(x.FptrMapUint64Int32, d) + } + } + case "FMapUint64Int64": + if r.TryDecodeAsNil() { + x.FMapUint64Int64 = nil + } else { + if false { + } else { + z.F.DecMapUint64Int64X(&x.FMapUint64Int64, d) + } + } + case "FptrMapUint64Int64": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Int64 != nil { + x.FptrMapUint64Int64 = nil + } + } else { + if x.FptrMapUint64Int64 == nil { + x.FptrMapUint64Int64 = new(map[uint64]int64) + } + + if false { + } else { + z.F.DecMapUint64Int64X(x.FptrMapUint64Int64, d) + } + } + case "FMapUint64Float32": + if r.TryDecodeAsNil() { + x.FMapUint64Float32 = nil + } else { + if false { + } else { + z.F.DecMapUint64Float32X(&x.FMapUint64Float32, d) + } + } + case "FptrMapUint64Float32": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Float32 != nil { + x.FptrMapUint64Float32 = nil + } + } else { + if x.FptrMapUint64Float32 == nil { + x.FptrMapUint64Float32 = new(map[uint64]float32) + } + + if false { + } else { + z.F.DecMapUint64Float32X(x.FptrMapUint64Float32, d) + } + } + case "FMapUint64Float64": + if r.TryDecodeAsNil() { + x.FMapUint64Float64 = nil + } else { + if false { + } else { + z.F.DecMapUint64Float64X(&x.FMapUint64Float64, d) + } + } + case "FptrMapUint64Float64": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Float64 != nil { + x.FptrMapUint64Float64 = nil + } + } else { + if x.FptrMapUint64Float64 == nil { + x.FptrMapUint64Float64 = new(map[uint64]float64) + } + + if false { + } else { + z.F.DecMapUint64Float64X(x.FptrMapUint64Float64, d) + } + } + case "FMapUint64Bool": + if r.TryDecodeAsNil() { + x.FMapUint64Bool = nil + } else { + if false { + } else { + z.F.DecMapUint64BoolX(&x.FMapUint64Bool, d) + } + } + case "FptrMapUint64Bool": + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Bool != nil { + x.FptrMapUint64Bool = nil + } + } else { + if x.FptrMapUint64Bool == nil { + x.FptrMapUint64Bool = new(map[uint64]bool) + } + + if false { + } else { + z.F.DecMapUint64BoolX(x.FptrMapUint64Bool, d) + } + } + case "FMapUintptrIntf": + if r.TryDecodeAsNil() { + x.FMapUintptrIntf = nil + } else { + if false { + } else { + z.F.DecMapUintptrIntfX(&x.FMapUintptrIntf, d) + } + } + case "FptrMapUintptrIntf": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrIntf != nil { + x.FptrMapUintptrIntf = nil + } + } else { + if x.FptrMapUintptrIntf == nil { + x.FptrMapUintptrIntf = new(map[uintptr]interface{}) + } + + if false { + } else { + z.F.DecMapUintptrIntfX(x.FptrMapUintptrIntf, d) + } + } + case "FMapUintptrString": + if r.TryDecodeAsNil() { + x.FMapUintptrString = nil + } else { + if false { + } else { + z.F.DecMapUintptrStringX(&x.FMapUintptrString, d) + } + } + case "FptrMapUintptrString": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrString != nil { + x.FptrMapUintptrString = nil + } + } else { + if x.FptrMapUintptrString == nil { + x.FptrMapUintptrString = new(map[uintptr]string) + } + + if false { + } else { + z.F.DecMapUintptrStringX(x.FptrMapUintptrString, d) + } + } + case "FMapUintptrUint": + if r.TryDecodeAsNil() { + x.FMapUintptrUint = nil + } else { + if false { + } else { + z.F.DecMapUintptrUintX(&x.FMapUintptrUint, d) + } + } + case "FptrMapUintptrUint": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrUint != nil { + x.FptrMapUintptrUint = nil + } + } else { + if x.FptrMapUintptrUint == nil { + x.FptrMapUintptrUint = new(map[uintptr]uint) + } + + if false { + } else { + z.F.DecMapUintptrUintX(x.FptrMapUintptrUint, d) + } + } + case "FMapUintptrUint8": + if r.TryDecodeAsNil() { + x.FMapUintptrUint8 = nil + } else { + if false { + } else { + z.F.DecMapUintptrUint8X(&x.FMapUintptrUint8, d) + } + } + case "FptrMapUintptrUint8": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrUint8 != nil { + x.FptrMapUintptrUint8 = nil + } + } else { + if x.FptrMapUintptrUint8 == nil { + x.FptrMapUintptrUint8 = new(map[uintptr]uint8) + } + + if false { + } else { + z.F.DecMapUintptrUint8X(x.FptrMapUintptrUint8, d) + } + } + case "FMapUintptrUint16": + if r.TryDecodeAsNil() { + x.FMapUintptrUint16 = nil + } else { + if false { + } else { + z.F.DecMapUintptrUint16X(&x.FMapUintptrUint16, d) + } + } + case "FptrMapUintptrUint16": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrUint16 != nil { + x.FptrMapUintptrUint16 = nil + } + } else { + if x.FptrMapUintptrUint16 == nil { + x.FptrMapUintptrUint16 = new(map[uintptr]uint16) + } + + if false { + } else { + z.F.DecMapUintptrUint16X(x.FptrMapUintptrUint16, d) + } + } + case "FMapUintptrUint32": + if r.TryDecodeAsNil() { + x.FMapUintptrUint32 = nil + } else { + if false { + } else { + z.F.DecMapUintptrUint32X(&x.FMapUintptrUint32, d) + } + } + case "FptrMapUintptrUint32": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrUint32 != nil { + x.FptrMapUintptrUint32 = nil + } + } else { + if x.FptrMapUintptrUint32 == nil { + x.FptrMapUintptrUint32 = new(map[uintptr]uint32) + } + + if false { + } else { + z.F.DecMapUintptrUint32X(x.FptrMapUintptrUint32, d) + } + } + case "FMapUintptrUint64": + if r.TryDecodeAsNil() { + x.FMapUintptrUint64 = nil + } else { + if false { + } else { + z.F.DecMapUintptrUint64X(&x.FMapUintptrUint64, d) + } + } + case "FptrMapUintptrUint64": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrUint64 != nil { + x.FptrMapUintptrUint64 = nil + } + } else { + if x.FptrMapUintptrUint64 == nil { + x.FptrMapUintptrUint64 = new(map[uintptr]uint64) + } + + if false { + } else { + z.F.DecMapUintptrUint64X(x.FptrMapUintptrUint64, d) + } + } + case "FMapUintptrUintptr": + if r.TryDecodeAsNil() { + x.FMapUintptrUintptr = nil + } else { + if false { + } else { + z.F.DecMapUintptrUintptrX(&x.FMapUintptrUintptr, d) + } + } + case "FptrMapUintptrUintptr": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrUintptr != nil { + x.FptrMapUintptrUintptr = nil + } + } else { + if x.FptrMapUintptrUintptr == nil { + x.FptrMapUintptrUintptr = new(map[uintptr]uintptr) + } + + if false { + } else { + z.F.DecMapUintptrUintptrX(x.FptrMapUintptrUintptr, d) + } + } + case "FMapUintptrInt": + if r.TryDecodeAsNil() { + x.FMapUintptrInt = nil + } else { + if false { + } else { + z.F.DecMapUintptrIntX(&x.FMapUintptrInt, d) + } + } + case "FptrMapUintptrInt": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrInt != nil { + x.FptrMapUintptrInt = nil + } + } else { + if x.FptrMapUintptrInt == nil { + x.FptrMapUintptrInt = new(map[uintptr]int) + } + + if false { + } else { + z.F.DecMapUintptrIntX(x.FptrMapUintptrInt, d) + } + } + case "FMapUintptrInt8": + if r.TryDecodeAsNil() { + x.FMapUintptrInt8 = nil + } else { + if false { + } else { + z.F.DecMapUintptrInt8X(&x.FMapUintptrInt8, d) + } + } + case "FptrMapUintptrInt8": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrInt8 != nil { + x.FptrMapUintptrInt8 = nil + } + } else { + if x.FptrMapUintptrInt8 == nil { + x.FptrMapUintptrInt8 = new(map[uintptr]int8) + } + + if false { + } else { + z.F.DecMapUintptrInt8X(x.FptrMapUintptrInt8, d) + } + } + case "FMapUintptrInt16": + if r.TryDecodeAsNil() { + x.FMapUintptrInt16 = nil + } else { + if false { + } else { + z.F.DecMapUintptrInt16X(&x.FMapUintptrInt16, d) + } + } + case "FptrMapUintptrInt16": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrInt16 != nil { + x.FptrMapUintptrInt16 = nil + } + } else { + if x.FptrMapUintptrInt16 == nil { + x.FptrMapUintptrInt16 = new(map[uintptr]int16) + } + + if false { + } else { + z.F.DecMapUintptrInt16X(x.FptrMapUintptrInt16, d) + } + } + case "FMapUintptrInt32": + if r.TryDecodeAsNil() { + x.FMapUintptrInt32 = nil + } else { + if false { + } else { + z.F.DecMapUintptrInt32X(&x.FMapUintptrInt32, d) + } + } + case "FptrMapUintptrInt32": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrInt32 != nil { + x.FptrMapUintptrInt32 = nil + } + } else { + if x.FptrMapUintptrInt32 == nil { + x.FptrMapUintptrInt32 = new(map[uintptr]int32) + } + + if false { + } else { + z.F.DecMapUintptrInt32X(x.FptrMapUintptrInt32, d) + } + } + case "FMapUintptrInt64": + if r.TryDecodeAsNil() { + x.FMapUintptrInt64 = nil + } else { + if false { + } else { + z.F.DecMapUintptrInt64X(&x.FMapUintptrInt64, d) + } + } + case "FptrMapUintptrInt64": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrInt64 != nil { + x.FptrMapUintptrInt64 = nil + } + } else { + if x.FptrMapUintptrInt64 == nil { + x.FptrMapUintptrInt64 = new(map[uintptr]int64) + } + + if false { + } else { + z.F.DecMapUintptrInt64X(x.FptrMapUintptrInt64, d) + } + } + case "FMapUintptrFloat32": + if r.TryDecodeAsNil() { + x.FMapUintptrFloat32 = nil + } else { + if false { + } else { + z.F.DecMapUintptrFloat32X(&x.FMapUintptrFloat32, d) + } + } + case "FptrMapUintptrFloat32": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrFloat32 != nil { + x.FptrMapUintptrFloat32 = nil + } + } else { + if x.FptrMapUintptrFloat32 == nil { + x.FptrMapUintptrFloat32 = new(map[uintptr]float32) + } + + if false { + } else { + z.F.DecMapUintptrFloat32X(x.FptrMapUintptrFloat32, d) + } + } + case "FMapUintptrFloat64": + if r.TryDecodeAsNil() { + x.FMapUintptrFloat64 = nil + } else { + if false { + } else { + z.F.DecMapUintptrFloat64X(&x.FMapUintptrFloat64, d) + } + } + case "FptrMapUintptrFloat64": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrFloat64 != nil { + x.FptrMapUintptrFloat64 = nil + } + } else { + if x.FptrMapUintptrFloat64 == nil { + x.FptrMapUintptrFloat64 = new(map[uintptr]float64) + } + + if false { + } else { + z.F.DecMapUintptrFloat64X(x.FptrMapUintptrFloat64, d) + } + } + case "FMapUintptrBool": + if r.TryDecodeAsNil() { + x.FMapUintptrBool = nil + } else { + if false { + } else { + z.F.DecMapUintptrBoolX(&x.FMapUintptrBool, d) + } + } + case "FptrMapUintptrBool": + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrBool != nil { + x.FptrMapUintptrBool = nil + } + } else { + if x.FptrMapUintptrBool == nil { + x.FptrMapUintptrBool = new(map[uintptr]bool) + } + + if false { + } else { + z.F.DecMapUintptrBoolX(x.FptrMapUintptrBool, d) + } + } + case "FMapIntIntf": + if r.TryDecodeAsNil() { + x.FMapIntIntf = nil + } else { + if false { + } else { + z.F.DecMapIntIntfX(&x.FMapIntIntf, d) + } + } + case "FptrMapIntIntf": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntIntf != nil { + x.FptrMapIntIntf = nil + } + } else { + if x.FptrMapIntIntf == nil { + x.FptrMapIntIntf = new(map[int]interface{}) + } + + if false { + } else { + z.F.DecMapIntIntfX(x.FptrMapIntIntf, d) + } + } + case "FMapIntString": + if r.TryDecodeAsNil() { + x.FMapIntString = nil + } else { + if false { + } else { + z.F.DecMapIntStringX(&x.FMapIntString, d) + } + } + case "FptrMapIntString": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntString != nil { + x.FptrMapIntString = nil + } + } else { + if x.FptrMapIntString == nil { + x.FptrMapIntString = new(map[int]string) + } + + if false { + } else { + z.F.DecMapIntStringX(x.FptrMapIntString, d) + } + } + case "FMapIntUint": + if r.TryDecodeAsNil() { + x.FMapIntUint = nil + } else { + if false { + } else { + z.F.DecMapIntUintX(&x.FMapIntUint, d) + } + } + case "FptrMapIntUint": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntUint != nil { + x.FptrMapIntUint = nil + } + } else { + if x.FptrMapIntUint == nil { + x.FptrMapIntUint = new(map[int]uint) + } + + if false { + } else { + z.F.DecMapIntUintX(x.FptrMapIntUint, d) + } + } + case "FMapIntUint8": + if r.TryDecodeAsNil() { + x.FMapIntUint8 = nil + } else { + if false { + } else { + z.F.DecMapIntUint8X(&x.FMapIntUint8, d) + } + } + case "FptrMapIntUint8": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntUint8 != nil { + x.FptrMapIntUint8 = nil + } + } else { + if x.FptrMapIntUint8 == nil { + x.FptrMapIntUint8 = new(map[int]uint8) + } + + if false { + } else { + z.F.DecMapIntUint8X(x.FptrMapIntUint8, d) + } + } + case "FMapIntUint16": + if r.TryDecodeAsNil() { + x.FMapIntUint16 = nil + } else { + if false { + } else { + z.F.DecMapIntUint16X(&x.FMapIntUint16, d) + } + } + case "FptrMapIntUint16": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntUint16 != nil { + x.FptrMapIntUint16 = nil + } + } else { + if x.FptrMapIntUint16 == nil { + x.FptrMapIntUint16 = new(map[int]uint16) + } + + if false { + } else { + z.F.DecMapIntUint16X(x.FptrMapIntUint16, d) + } + } + case "FMapIntUint32": + if r.TryDecodeAsNil() { + x.FMapIntUint32 = nil + } else { + if false { + } else { + z.F.DecMapIntUint32X(&x.FMapIntUint32, d) + } + } + case "FptrMapIntUint32": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntUint32 != nil { + x.FptrMapIntUint32 = nil + } + } else { + if x.FptrMapIntUint32 == nil { + x.FptrMapIntUint32 = new(map[int]uint32) + } + + if false { + } else { + z.F.DecMapIntUint32X(x.FptrMapIntUint32, d) + } + } + case "FMapIntUint64": + if r.TryDecodeAsNil() { + x.FMapIntUint64 = nil + } else { + if false { + } else { + z.F.DecMapIntUint64X(&x.FMapIntUint64, d) + } + } + case "FptrMapIntUint64": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntUint64 != nil { + x.FptrMapIntUint64 = nil + } + } else { + if x.FptrMapIntUint64 == nil { + x.FptrMapIntUint64 = new(map[int]uint64) + } + + if false { + } else { + z.F.DecMapIntUint64X(x.FptrMapIntUint64, d) + } + } + case "FMapIntUintptr": + if r.TryDecodeAsNil() { + x.FMapIntUintptr = nil + } else { + if false { + } else { + z.F.DecMapIntUintptrX(&x.FMapIntUintptr, d) + } + } + case "FptrMapIntUintptr": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntUintptr != nil { + x.FptrMapIntUintptr = nil + } + } else { + if x.FptrMapIntUintptr == nil { + x.FptrMapIntUintptr = new(map[int]uintptr) + } + + if false { + } else { + z.F.DecMapIntUintptrX(x.FptrMapIntUintptr, d) + } + } + case "FMapIntInt": + if r.TryDecodeAsNil() { + x.FMapIntInt = nil + } else { + if false { + } else { + z.F.DecMapIntIntX(&x.FMapIntInt, d) + } + } + case "FptrMapIntInt": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntInt != nil { + x.FptrMapIntInt = nil + } + } else { + if x.FptrMapIntInt == nil { + x.FptrMapIntInt = new(map[int]int) + } + + if false { + } else { + z.F.DecMapIntIntX(x.FptrMapIntInt, d) + } + } + case "FMapIntInt8": + if r.TryDecodeAsNil() { + x.FMapIntInt8 = nil + } else { + if false { + } else { + z.F.DecMapIntInt8X(&x.FMapIntInt8, d) + } + } + case "FptrMapIntInt8": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntInt8 != nil { + x.FptrMapIntInt8 = nil + } + } else { + if x.FptrMapIntInt8 == nil { + x.FptrMapIntInt8 = new(map[int]int8) + } + + if false { + } else { + z.F.DecMapIntInt8X(x.FptrMapIntInt8, d) + } + } + case "FMapIntInt16": + if r.TryDecodeAsNil() { + x.FMapIntInt16 = nil + } else { + if false { + } else { + z.F.DecMapIntInt16X(&x.FMapIntInt16, d) + } + } + case "FptrMapIntInt16": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntInt16 != nil { + x.FptrMapIntInt16 = nil + } + } else { + if x.FptrMapIntInt16 == nil { + x.FptrMapIntInt16 = new(map[int]int16) + } + + if false { + } else { + z.F.DecMapIntInt16X(x.FptrMapIntInt16, d) + } + } + case "FMapIntInt32": + if r.TryDecodeAsNil() { + x.FMapIntInt32 = nil + } else { + if false { + } else { + z.F.DecMapIntInt32X(&x.FMapIntInt32, d) + } + } + case "FptrMapIntInt32": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntInt32 != nil { + x.FptrMapIntInt32 = nil + } + } else { + if x.FptrMapIntInt32 == nil { + x.FptrMapIntInt32 = new(map[int]int32) + } + + if false { + } else { + z.F.DecMapIntInt32X(x.FptrMapIntInt32, d) + } + } + case "FMapIntInt64": + if r.TryDecodeAsNil() { + x.FMapIntInt64 = nil + } else { + if false { + } else { + z.F.DecMapIntInt64X(&x.FMapIntInt64, d) + } + } + case "FptrMapIntInt64": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntInt64 != nil { + x.FptrMapIntInt64 = nil + } + } else { + if x.FptrMapIntInt64 == nil { + x.FptrMapIntInt64 = new(map[int]int64) + } + + if false { + } else { + z.F.DecMapIntInt64X(x.FptrMapIntInt64, d) + } + } + case "FMapIntFloat32": + if r.TryDecodeAsNil() { + x.FMapIntFloat32 = nil + } else { + if false { + } else { + z.F.DecMapIntFloat32X(&x.FMapIntFloat32, d) + } + } + case "FptrMapIntFloat32": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntFloat32 != nil { + x.FptrMapIntFloat32 = nil + } + } else { + if x.FptrMapIntFloat32 == nil { + x.FptrMapIntFloat32 = new(map[int]float32) + } + + if false { + } else { + z.F.DecMapIntFloat32X(x.FptrMapIntFloat32, d) + } + } + case "FMapIntFloat64": + if r.TryDecodeAsNil() { + x.FMapIntFloat64 = nil + } else { + if false { + } else { + z.F.DecMapIntFloat64X(&x.FMapIntFloat64, d) + } + } + case "FptrMapIntFloat64": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntFloat64 != nil { + x.FptrMapIntFloat64 = nil + } + } else { + if x.FptrMapIntFloat64 == nil { + x.FptrMapIntFloat64 = new(map[int]float64) + } + + if false { + } else { + z.F.DecMapIntFloat64X(x.FptrMapIntFloat64, d) + } + } + case "FMapIntBool": + if r.TryDecodeAsNil() { + x.FMapIntBool = nil + } else { + if false { + } else { + z.F.DecMapIntBoolX(&x.FMapIntBool, d) + } + } + case "FptrMapIntBool": + if r.TryDecodeAsNil() { + if true && x.FptrMapIntBool != nil { + x.FptrMapIntBool = nil + } + } else { + if x.FptrMapIntBool == nil { + x.FptrMapIntBool = new(map[int]bool) + } + + if false { + } else { + z.F.DecMapIntBoolX(x.FptrMapIntBool, d) + } + } + case "FMapInt8Intf": + if r.TryDecodeAsNil() { + x.FMapInt8Intf = nil + } else { + if false { + } else { + z.F.DecMapInt8IntfX(&x.FMapInt8Intf, d) + } + } + case "FptrMapInt8Intf": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Intf != nil { + x.FptrMapInt8Intf = nil + } + } else { + if x.FptrMapInt8Intf == nil { + x.FptrMapInt8Intf = new(map[int8]interface{}) + } + + if false { + } else { + z.F.DecMapInt8IntfX(x.FptrMapInt8Intf, d) + } + } + case "FMapInt8String": + if r.TryDecodeAsNil() { + x.FMapInt8String = nil + } else { + if false { + } else { + z.F.DecMapInt8StringX(&x.FMapInt8String, d) + } + } + case "FptrMapInt8String": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8String != nil { + x.FptrMapInt8String = nil + } + } else { + if x.FptrMapInt8String == nil { + x.FptrMapInt8String = new(map[int8]string) + } + + if false { + } else { + z.F.DecMapInt8StringX(x.FptrMapInt8String, d) + } + } + case "FMapInt8Uint": + if r.TryDecodeAsNil() { + x.FMapInt8Uint = nil + } else { + if false { + } else { + z.F.DecMapInt8UintX(&x.FMapInt8Uint, d) + } + } + case "FptrMapInt8Uint": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Uint != nil { + x.FptrMapInt8Uint = nil + } + } else { + if x.FptrMapInt8Uint == nil { + x.FptrMapInt8Uint = new(map[int8]uint) + } + + if false { + } else { + z.F.DecMapInt8UintX(x.FptrMapInt8Uint, d) + } + } + case "FMapInt8Uint8": + if r.TryDecodeAsNil() { + x.FMapInt8Uint8 = nil + } else { + if false { + } else { + z.F.DecMapInt8Uint8X(&x.FMapInt8Uint8, d) + } + } + case "FptrMapInt8Uint8": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Uint8 != nil { + x.FptrMapInt8Uint8 = nil + } + } else { + if x.FptrMapInt8Uint8 == nil { + x.FptrMapInt8Uint8 = new(map[int8]uint8) + } + + if false { + } else { + z.F.DecMapInt8Uint8X(x.FptrMapInt8Uint8, d) + } + } + case "FMapInt8Uint16": + if r.TryDecodeAsNil() { + x.FMapInt8Uint16 = nil + } else { + if false { + } else { + z.F.DecMapInt8Uint16X(&x.FMapInt8Uint16, d) + } + } + case "FptrMapInt8Uint16": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Uint16 != nil { + x.FptrMapInt8Uint16 = nil + } + } else { + if x.FptrMapInt8Uint16 == nil { + x.FptrMapInt8Uint16 = new(map[int8]uint16) + } + + if false { + } else { + z.F.DecMapInt8Uint16X(x.FptrMapInt8Uint16, d) + } + } + case "FMapInt8Uint32": + if r.TryDecodeAsNil() { + x.FMapInt8Uint32 = nil + } else { + if false { + } else { + z.F.DecMapInt8Uint32X(&x.FMapInt8Uint32, d) + } + } + case "FptrMapInt8Uint32": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Uint32 != nil { + x.FptrMapInt8Uint32 = nil + } + } else { + if x.FptrMapInt8Uint32 == nil { + x.FptrMapInt8Uint32 = new(map[int8]uint32) + } + + if false { + } else { + z.F.DecMapInt8Uint32X(x.FptrMapInt8Uint32, d) + } + } + case "FMapInt8Uint64": + if r.TryDecodeAsNil() { + x.FMapInt8Uint64 = nil + } else { + if false { + } else { + z.F.DecMapInt8Uint64X(&x.FMapInt8Uint64, d) + } + } + case "FptrMapInt8Uint64": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Uint64 != nil { + x.FptrMapInt8Uint64 = nil + } + } else { + if x.FptrMapInt8Uint64 == nil { + x.FptrMapInt8Uint64 = new(map[int8]uint64) + } + + if false { + } else { + z.F.DecMapInt8Uint64X(x.FptrMapInt8Uint64, d) + } + } + case "FMapInt8Uintptr": + if r.TryDecodeAsNil() { + x.FMapInt8Uintptr = nil + } else { + if false { + } else { + z.F.DecMapInt8UintptrX(&x.FMapInt8Uintptr, d) + } + } + case "FptrMapInt8Uintptr": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Uintptr != nil { + x.FptrMapInt8Uintptr = nil + } + } else { + if x.FptrMapInt8Uintptr == nil { + x.FptrMapInt8Uintptr = new(map[int8]uintptr) + } + + if false { + } else { + z.F.DecMapInt8UintptrX(x.FptrMapInt8Uintptr, d) + } + } + case "FMapInt8Int": + if r.TryDecodeAsNil() { + x.FMapInt8Int = nil + } else { + if false { + } else { + z.F.DecMapInt8IntX(&x.FMapInt8Int, d) + } + } + case "FptrMapInt8Int": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Int != nil { + x.FptrMapInt8Int = nil + } + } else { + if x.FptrMapInt8Int == nil { + x.FptrMapInt8Int = new(map[int8]int) + } + + if false { + } else { + z.F.DecMapInt8IntX(x.FptrMapInt8Int, d) + } + } + case "FMapInt8Int8": + if r.TryDecodeAsNil() { + x.FMapInt8Int8 = nil + } else { + if false { + } else { + z.F.DecMapInt8Int8X(&x.FMapInt8Int8, d) + } + } + case "FptrMapInt8Int8": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Int8 != nil { + x.FptrMapInt8Int8 = nil + } + } else { + if x.FptrMapInt8Int8 == nil { + x.FptrMapInt8Int8 = new(map[int8]int8) + } + + if false { + } else { + z.F.DecMapInt8Int8X(x.FptrMapInt8Int8, d) + } + } + case "FMapInt8Int16": + if r.TryDecodeAsNil() { + x.FMapInt8Int16 = nil + } else { + if false { + } else { + z.F.DecMapInt8Int16X(&x.FMapInt8Int16, d) + } + } + case "FptrMapInt8Int16": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Int16 != nil { + x.FptrMapInt8Int16 = nil + } + } else { + if x.FptrMapInt8Int16 == nil { + x.FptrMapInt8Int16 = new(map[int8]int16) + } + + if false { + } else { + z.F.DecMapInt8Int16X(x.FptrMapInt8Int16, d) + } + } + case "FMapInt8Int32": + if r.TryDecodeAsNil() { + x.FMapInt8Int32 = nil + } else { + if false { + } else { + z.F.DecMapInt8Int32X(&x.FMapInt8Int32, d) + } + } + case "FptrMapInt8Int32": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Int32 != nil { + x.FptrMapInt8Int32 = nil + } + } else { + if x.FptrMapInt8Int32 == nil { + x.FptrMapInt8Int32 = new(map[int8]int32) + } + + if false { + } else { + z.F.DecMapInt8Int32X(x.FptrMapInt8Int32, d) + } + } + case "FMapInt8Int64": + if r.TryDecodeAsNil() { + x.FMapInt8Int64 = nil + } else { + if false { + } else { + z.F.DecMapInt8Int64X(&x.FMapInt8Int64, d) + } + } + case "FptrMapInt8Int64": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Int64 != nil { + x.FptrMapInt8Int64 = nil + } + } else { + if x.FptrMapInt8Int64 == nil { + x.FptrMapInt8Int64 = new(map[int8]int64) + } + + if false { + } else { + z.F.DecMapInt8Int64X(x.FptrMapInt8Int64, d) + } + } + case "FMapInt8Float32": + if r.TryDecodeAsNil() { + x.FMapInt8Float32 = nil + } else { + if false { + } else { + z.F.DecMapInt8Float32X(&x.FMapInt8Float32, d) + } + } + case "FptrMapInt8Float32": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Float32 != nil { + x.FptrMapInt8Float32 = nil + } + } else { + if x.FptrMapInt8Float32 == nil { + x.FptrMapInt8Float32 = new(map[int8]float32) + } + + if false { + } else { + z.F.DecMapInt8Float32X(x.FptrMapInt8Float32, d) + } + } + case "FMapInt8Float64": + if r.TryDecodeAsNil() { + x.FMapInt8Float64 = nil + } else { + if false { + } else { + z.F.DecMapInt8Float64X(&x.FMapInt8Float64, d) + } + } + case "FptrMapInt8Float64": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Float64 != nil { + x.FptrMapInt8Float64 = nil + } + } else { + if x.FptrMapInt8Float64 == nil { + x.FptrMapInt8Float64 = new(map[int8]float64) + } + + if false { + } else { + z.F.DecMapInt8Float64X(x.FptrMapInt8Float64, d) + } + } + case "FMapInt8Bool": + if r.TryDecodeAsNil() { + x.FMapInt8Bool = nil + } else { + if false { + } else { + z.F.DecMapInt8BoolX(&x.FMapInt8Bool, d) + } + } + case "FptrMapInt8Bool": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Bool != nil { + x.FptrMapInt8Bool = nil + } + } else { + if x.FptrMapInt8Bool == nil { + x.FptrMapInt8Bool = new(map[int8]bool) + } + + if false { + } else { + z.F.DecMapInt8BoolX(x.FptrMapInt8Bool, d) + } + } + case "FMapInt16Intf": + if r.TryDecodeAsNil() { + x.FMapInt16Intf = nil + } else { + if false { + } else { + z.F.DecMapInt16IntfX(&x.FMapInt16Intf, d) + } + } + case "FptrMapInt16Intf": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Intf != nil { + x.FptrMapInt16Intf = nil + } + } else { + if x.FptrMapInt16Intf == nil { + x.FptrMapInt16Intf = new(map[int16]interface{}) + } + + if false { + } else { + z.F.DecMapInt16IntfX(x.FptrMapInt16Intf, d) + } + } + case "FMapInt16String": + if r.TryDecodeAsNil() { + x.FMapInt16String = nil + } else { + if false { + } else { + z.F.DecMapInt16StringX(&x.FMapInt16String, d) + } + } + case "FptrMapInt16String": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16String != nil { + x.FptrMapInt16String = nil + } + } else { + if x.FptrMapInt16String == nil { + x.FptrMapInt16String = new(map[int16]string) + } + + if false { + } else { + z.F.DecMapInt16StringX(x.FptrMapInt16String, d) + } + } + case "FMapInt16Uint": + if r.TryDecodeAsNil() { + x.FMapInt16Uint = nil + } else { + if false { + } else { + z.F.DecMapInt16UintX(&x.FMapInt16Uint, d) + } + } + case "FptrMapInt16Uint": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Uint != nil { + x.FptrMapInt16Uint = nil + } + } else { + if x.FptrMapInt16Uint == nil { + x.FptrMapInt16Uint = new(map[int16]uint) + } + + if false { + } else { + z.F.DecMapInt16UintX(x.FptrMapInt16Uint, d) + } + } + case "FMapInt16Uint8": + if r.TryDecodeAsNil() { + x.FMapInt16Uint8 = nil + } else { + if false { + } else { + z.F.DecMapInt16Uint8X(&x.FMapInt16Uint8, d) + } + } + case "FptrMapInt16Uint8": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Uint8 != nil { + x.FptrMapInt16Uint8 = nil + } + } else { + if x.FptrMapInt16Uint8 == nil { + x.FptrMapInt16Uint8 = new(map[int16]uint8) + } + + if false { + } else { + z.F.DecMapInt16Uint8X(x.FptrMapInt16Uint8, d) + } + } + case "FMapInt16Uint16": + if r.TryDecodeAsNil() { + x.FMapInt16Uint16 = nil + } else { + if false { + } else { + z.F.DecMapInt16Uint16X(&x.FMapInt16Uint16, d) + } + } + case "FptrMapInt16Uint16": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Uint16 != nil { + x.FptrMapInt16Uint16 = nil + } + } else { + if x.FptrMapInt16Uint16 == nil { + x.FptrMapInt16Uint16 = new(map[int16]uint16) + } + + if false { + } else { + z.F.DecMapInt16Uint16X(x.FptrMapInt16Uint16, d) + } + } + case "FMapInt16Uint32": + if r.TryDecodeAsNil() { + x.FMapInt16Uint32 = nil + } else { + if false { + } else { + z.F.DecMapInt16Uint32X(&x.FMapInt16Uint32, d) + } + } + case "FptrMapInt16Uint32": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Uint32 != nil { + x.FptrMapInt16Uint32 = nil + } + } else { + if x.FptrMapInt16Uint32 == nil { + x.FptrMapInt16Uint32 = new(map[int16]uint32) + } + + if false { + } else { + z.F.DecMapInt16Uint32X(x.FptrMapInt16Uint32, d) + } + } + case "FMapInt16Uint64": + if r.TryDecodeAsNil() { + x.FMapInt16Uint64 = nil + } else { + if false { + } else { + z.F.DecMapInt16Uint64X(&x.FMapInt16Uint64, d) + } + } + case "FptrMapInt16Uint64": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Uint64 != nil { + x.FptrMapInt16Uint64 = nil + } + } else { + if x.FptrMapInt16Uint64 == nil { + x.FptrMapInt16Uint64 = new(map[int16]uint64) + } + + if false { + } else { + z.F.DecMapInt16Uint64X(x.FptrMapInt16Uint64, d) + } + } + case "FMapInt16Uintptr": + if r.TryDecodeAsNil() { + x.FMapInt16Uintptr = nil + } else { + if false { + } else { + z.F.DecMapInt16UintptrX(&x.FMapInt16Uintptr, d) + } + } + case "FptrMapInt16Uintptr": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Uintptr != nil { + x.FptrMapInt16Uintptr = nil + } + } else { + if x.FptrMapInt16Uintptr == nil { + x.FptrMapInt16Uintptr = new(map[int16]uintptr) + } + + if false { + } else { + z.F.DecMapInt16UintptrX(x.FptrMapInt16Uintptr, d) + } + } + case "FMapInt16Int": + if r.TryDecodeAsNil() { + x.FMapInt16Int = nil + } else { + if false { + } else { + z.F.DecMapInt16IntX(&x.FMapInt16Int, d) + } + } + case "FptrMapInt16Int": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Int != nil { + x.FptrMapInt16Int = nil + } + } else { + if x.FptrMapInt16Int == nil { + x.FptrMapInt16Int = new(map[int16]int) + } + + if false { + } else { + z.F.DecMapInt16IntX(x.FptrMapInt16Int, d) + } + } + case "FMapInt16Int8": + if r.TryDecodeAsNil() { + x.FMapInt16Int8 = nil + } else { + if false { + } else { + z.F.DecMapInt16Int8X(&x.FMapInt16Int8, d) + } + } + case "FptrMapInt16Int8": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Int8 != nil { + x.FptrMapInt16Int8 = nil + } + } else { + if x.FptrMapInt16Int8 == nil { + x.FptrMapInt16Int8 = new(map[int16]int8) + } + + if false { + } else { + z.F.DecMapInt16Int8X(x.FptrMapInt16Int8, d) + } + } + case "FMapInt16Int16": + if r.TryDecodeAsNil() { + x.FMapInt16Int16 = nil + } else { + if false { + } else { + z.F.DecMapInt16Int16X(&x.FMapInt16Int16, d) + } + } + case "FptrMapInt16Int16": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Int16 != nil { + x.FptrMapInt16Int16 = nil + } + } else { + if x.FptrMapInt16Int16 == nil { + x.FptrMapInt16Int16 = new(map[int16]int16) + } + + if false { + } else { + z.F.DecMapInt16Int16X(x.FptrMapInt16Int16, d) + } + } + case "FMapInt16Int32": + if r.TryDecodeAsNil() { + x.FMapInt16Int32 = nil + } else { + if false { + } else { + z.F.DecMapInt16Int32X(&x.FMapInt16Int32, d) + } + } + case "FptrMapInt16Int32": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Int32 != nil { + x.FptrMapInt16Int32 = nil + } + } else { + if x.FptrMapInt16Int32 == nil { + x.FptrMapInt16Int32 = new(map[int16]int32) + } + + if false { + } else { + z.F.DecMapInt16Int32X(x.FptrMapInt16Int32, d) + } + } + case "FMapInt16Int64": + if r.TryDecodeAsNil() { + x.FMapInt16Int64 = nil + } else { + if false { + } else { + z.F.DecMapInt16Int64X(&x.FMapInt16Int64, d) + } + } + case "FptrMapInt16Int64": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Int64 != nil { + x.FptrMapInt16Int64 = nil + } + } else { + if x.FptrMapInt16Int64 == nil { + x.FptrMapInt16Int64 = new(map[int16]int64) + } + + if false { + } else { + z.F.DecMapInt16Int64X(x.FptrMapInt16Int64, d) + } + } + case "FMapInt16Float32": + if r.TryDecodeAsNil() { + x.FMapInt16Float32 = nil + } else { + if false { + } else { + z.F.DecMapInt16Float32X(&x.FMapInt16Float32, d) + } + } + case "FptrMapInt16Float32": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Float32 != nil { + x.FptrMapInt16Float32 = nil + } + } else { + if x.FptrMapInt16Float32 == nil { + x.FptrMapInt16Float32 = new(map[int16]float32) + } + + if false { + } else { + z.F.DecMapInt16Float32X(x.FptrMapInt16Float32, d) + } + } + case "FMapInt16Float64": + if r.TryDecodeAsNil() { + x.FMapInt16Float64 = nil + } else { + if false { + } else { + z.F.DecMapInt16Float64X(&x.FMapInt16Float64, d) + } + } + case "FptrMapInt16Float64": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Float64 != nil { + x.FptrMapInt16Float64 = nil + } + } else { + if x.FptrMapInt16Float64 == nil { + x.FptrMapInt16Float64 = new(map[int16]float64) + } + + if false { + } else { + z.F.DecMapInt16Float64X(x.FptrMapInt16Float64, d) + } + } + case "FMapInt16Bool": + if r.TryDecodeAsNil() { + x.FMapInt16Bool = nil + } else { + if false { + } else { + z.F.DecMapInt16BoolX(&x.FMapInt16Bool, d) + } + } + case "FptrMapInt16Bool": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Bool != nil { + x.FptrMapInt16Bool = nil + } + } else { + if x.FptrMapInt16Bool == nil { + x.FptrMapInt16Bool = new(map[int16]bool) + } + + if false { + } else { + z.F.DecMapInt16BoolX(x.FptrMapInt16Bool, d) + } + } + case "FMapInt32Intf": + if r.TryDecodeAsNil() { + x.FMapInt32Intf = nil + } else { + if false { + } else { + z.F.DecMapInt32IntfX(&x.FMapInt32Intf, d) + } + } + case "FptrMapInt32Intf": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Intf != nil { + x.FptrMapInt32Intf = nil + } + } else { + if x.FptrMapInt32Intf == nil { + x.FptrMapInt32Intf = new(map[int32]interface{}) + } + + if false { + } else { + z.F.DecMapInt32IntfX(x.FptrMapInt32Intf, d) + } + } + case "FMapInt32String": + if r.TryDecodeAsNil() { + x.FMapInt32String = nil + } else { + if false { + } else { + z.F.DecMapInt32StringX(&x.FMapInt32String, d) + } + } + case "FptrMapInt32String": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32String != nil { + x.FptrMapInt32String = nil + } + } else { + if x.FptrMapInt32String == nil { + x.FptrMapInt32String = new(map[int32]string) + } + + if false { + } else { + z.F.DecMapInt32StringX(x.FptrMapInt32String, d) + } + } + case "FMapInt32Uint": + if r.TryDecodeAsNil() { + x.FMapInt32Uint = nil + } else { + if false { + } else { + z.F.DecMapInt32UintX(&x.FMapInt32Uint, d) + } + } + case "FptrMapInt32Uint": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Uint != nil { + x.FptrMapInt32Uint = nil + } + } else { + if x.FptrMapInt32Uint == nil { + x.FptrMapInt32Uint = new(map[int32]uint) + } + + if false { + } else { + z.F.DecMapInt32UintX(x.FptrMapInt32Uint, d) + } + } + case "FMapInt32Uint8": + if r.TryDecodeAsNil() { + x.FMapInt32Uint8 = nil + } else { + if false { + } else { + z.F.DecMapInt32Uint8X(&x.FMapInt32Uint8, d) + } + } + case "FptrMapInt32Uint8": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Uint8 != nil { + x.FptrMapInt32Uint8 = nil + } + } else { + if x.FptrMapInt32Uint8 == nil { + x.FptrMapInt32Uint8 = new(map[int32]uint8) + } + + if false { + } else { + z.F.DecMapInt32Uint8X(x.FptrMapInt32Uint8, d) + } + } + case "FMapInt32Uint16": + if r.TryDecodeAsNil() { + x.FMapInt32Uint16 = nil + } else { + if false { + } else { + z.F.DecMapInt32Uint16X(&x.FMapInt32Uint16, d) + } + } + case "FptrMapInt32Uint16": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Uint16 != nil { + x.FptrMapInt32Uint16 = nil + } + } else { + if x.FptrMapInt32Uint16 == nil { + x.FptrMapInt32Uint16 = new(map[int32]uint16) + } + + if false { + } else { + z.F.DecMapInt32Uint16X(x.FptrMapInt32Uint16, d) + } + } + case "FMapInt32Uint32": + if r.TryDecodeAsNil() { + x.FMapInt32Uint32 = nil + } else { + if false { + } else { + z.F.DecMapInt32Uint32X(&x.FMapInt32Uint32, d) + } + } + case "FptrMapInt32Uint32": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Uint32 != nil { + x.FptrMapInt32Uint32 = nil + } + } else { + if x.FptrMapInt32Uint32 == nil { + x.FptrMapInt32Uint32 = new(map[int32]uint32) + } + + if false { + } else { + z.F.DecMapInt32Uint32X(x.FptrMapInt32Uint32, d) + } + } + case "FMapInt32Uint64": + if r.TryDecodeAsNil() { + x.FMapInt32Uint64 = nil + } else { + if false { + } else { + z.F.DecMapInt32Uint64X(&x.FMapInt32Uint64, d) + } + } + case "FptrMapInt32Uint64": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Uint64 != nil { + x.FptrMapInt32Uint64 = nil + } + } else { + if x.FptrMapInt32Uint64 == nil { + x.FptrMapInt32Uint64 = new(map[int32]uint64) + } + + if false { + } else { + z.F.DecMapInt32Uint64X(x.FptrMapInt32Uint64, d) + } + } + case "FMapInt32Uintptr": + if r.TryDecodeAsNil() { + x.FMapInt32Uintptr = nil + } else { + if false { + } else { + z.F.DecMapInt32UintptrX(&x.FMapInt32Uintptr, d) + } + } + case "FptrMapInt32Uintptr": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Uintptr != nil { + x.FptrMapInt32Uintptr = nil + } + } else { + if x.FptrMapInt32Uintptr == nil { + x.FptrMapInt32Uintptr = new(map[int32]uintptr) + } + + if false { + } else { + z.F.DecMapInt32UintptrX(x.FptrMapInt32Uintptr, d) + } + } + case "FMapInt32Int": + if r.TryDecodeAsNil() { + x.FMapInt32Int = nil + } else { + if false { + } else { + z.F.DecMapInt32IntX(&x.FMapInt32Int, d) + } + } + case "FptrMapInt32Int": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Int != nil { + x.FptrMapInt32Int = nil + } + } else { + if x.FptrMapInt32Int == nil { + x.FptrMapInt32Int = new(map[int32]int) + } + + if false { + } else { + z.F.DecMapInt32IntX(x.FptrMapInt32Int, d) + } + } + case "FMapInt32Int8": + if r.TryDecodeAsNil() { + x.FMapInt32Int8 = nil + } else { + if false { + } else { + z.F.DecMapInt32Int8X(&x.FMapInt32Int8, d) + } + } + case "FptrMapInt32Int8": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Int8 != nil { + x.FptrMapInt32Int8 = nil + } + } else { + if x.FptrMapInt32Int8 == nil { + x.FptrMapInt32Int8 = new(map[int32]int8) + } + + if false { + } else { + z.F.DecMapInt32Int8X(x.FptrMapInt32Int8, d) + } + } + case "FMapInt32Int16": + if r.TryDecodeAsNil() { + x.FMapInt32Int16 = nil + } else { + if false { + } else { + z.F.DecMapInt32Int16X(&x.FMapInt32Int16, d) + } + } + case "FptrMapInt32Int16": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Int16 != nil { + x.FptrMapInt32Int16 = nil + } + } else { + if x.FptrMapInt32Int16 == nil { + x.FptrMapInt32Int16 = new(map[int32]int16) + } + + if false { + } else { + z.F.DecMapInt32Int16X(x.FptrMapInt32Int16, d) + } + } + case "FMapInt32Int32": + if r.TryDecodeAsNil() { + x.FMapInt32Int32 = nil + } else { + if false { + } else { + z.F.DecMapInt32Int32X(&x.FMapInt32Int32, d) + } + } + case "FptrMapInt32Int32": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Int32 != nil { + x.FptrMapInt32Int32 = nil + } + } else { + if x.FptrMapInt32Int32 == nil { + x.FptrMapInt32Int32 = new(map[int32]int32) + } + + if false { + } else { + z.F.DecMapInt32Int32X(x.FptrMapInt32Int32, d) + } + } + case "FMapInt32Int64": + if r.TryDecodeAsNil() { + x.FMapInt32Int64 = nil + } else { + if false { + } else { + z.F.DecMapInt32Int64X(&x.FMapInt32Int64, d) + } + } + case "FptrMapInt32Int64": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Int64 != nil { + x.FptrMapInt32Int64 = nil + } + } else { + if x.FptrMapInt32Int64 == nil { + x.FptrMapInt32Int64 = new(map[int32]int64) + } + + if false { + } else { + z.F.DecMapInt32Int64X(x.FptrMapInt32Int64, d) + } + } + case "FMapInt32Float32": + if r.TryDecodeAsNil() { + x.FMapInt32Float32 = nil + } else { + if false { + } else { + z.F.DecMapInt32Float32X(&x.FMapInt32Float32, d) + } + } + case "FptrMapInt32Float32": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Float32 != nil { + x.FptrMapInt32Float32 = nil + } + } else { + if x.FptrMapInt32Float32 == nil { + x.FptrMapInt32Float32 = new(map[int32]float32) + } + + if false { + } else { + z.F.DecMapInt32Float32X(x.FptrMapInt32Float32, d) + } + } + case "FMapInt32Float64": + if r.TryDecodeAsNil() { + x.FMapInt32Float64 = nil + } else { + if false { + } else { + z.F.DecMapInt32Float64X(&x.FMapInt32Float64, d) + } + } + case "FptrMapInt32Float64": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Float64 != nil { + x.FptrMapInt32Float64 = nil + } + } else { + if x.FptrMapInt32Float64 == nil { + x.FptrMapInt32Float64 = new(map[int32]float64) + } + + if false { + } else { + z.F.DecMapInt32Float64X(x.FptrMapInt32Float64, d) + } + } + case "FMapInt32Bool": + if r.TryDecodeAsNil() { + x.FMapInt32Bool = nil + } else { + if false { + } else { + z.F.DecMapInt32BoolX(&x.FMapInt32Bool, d) + } + } + case "FptrMapInt32Bool": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Bool != nil { + x.FptrMapInt32Bool = nil + } + } else { + if x.FptrMapInt32Bool == nil { + x.FptrMapInt32Bool = new(map[int32]bool) + } + + if false { + } else { + z.F.DecMapInt32BoolX(x.FptrMapInt32Bool, d) + } + } + case "FMapInt64Intf": + if r.TryDecodeAsNil() { + x.FMapInt64Intf = nil + } else { + if false { + } else { + z.F.DecMapInt64IntfX(&x.FMapInt64Intf, d) + } + } + case "FptrMapInt64Intf": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Intf != nil { + x.FptrMapInt64Intf = nil + } + } else { + if x.FptrMapInt64Intf == nil { + x.FptrMapInt64Intf = new(map[int64]interface{}) + } + + if false { + } else { + z.F.DecMapInt64IntfX(x.FptrMapInt64Intf, d) + } + } + case "FMapInt64String": + if r.TryDecodeAsNil() { + x.FMapInt64String = nil + } else { + if false { + } else { + z.F.DecMapInt64StringX(&x.FMapInt64String, d) + } + } + case "FptrMapInt64String": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64String != nil { + x.FptrMapInt64String = nil + } + } else { + if x.FptrMapInt64String == nil { + x.FptrMapInt64String = new(map[int64]string) + } + + if false { + } else { + z.F.DecMapInt64StringX(x.FptrMapInt64String, d) + } + } + case "FMapInt64Uint": + if r.TryDecodeAsNil() { + x.FMapInt64Uint = nil + } else { + if false { + } else { + z.F.DecMapInt64UintX(&x.FMapInt64Uint, d) + } + } + case "FptrMapInt64Uint": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Uint != nil { + x.FptrMapInt64Uint = nil + } + } else { + if x.FptrMapInt64Uint == nil { + x.FptrMapInt64Uint = new(map[int64]uint) + } + + if false { + } else { + z.F.DecMapInt64UintX(x.FptrMapInt64Uint, d) + } + } + case "FMapInt64Uint8": + if r.TryDecodeAsNil() { + x.FMapInt64Uint8 = nil + } else { + if false { + } else { + z.F.DecMapInt64Uint8X(&x.FMapInt64Uint8, d) + } + } + case "FptrMapInt64Uint8": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Uint8 != nil { + x.FptrMapInt64Uint8 = nil + } + } else { + if x.FptrMapInt64Uint8 == nil { + x.FptrMapInt64Uint8 = new(map[int64]uint8) + } + + if false { + } else { + z.F.DecMapInt64Uint8X(x.FptrMapInt64Uint8, d) + } + } + case "FMapInt64Uint16": + if r.TryDecodeAsNil() { + x.FMapInt64Uint16 = nil + } else { + if false { + } else { + z.F.DecMapInt64Uint16X(&x.FMapInt64Uint16, d) + } + } + case "FptrMapInt64Uint16": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Uint16 != nil { + x.FptrMapInt64Uint16 = nil + } + } else { + if x.FptrMapInt64Uint16 == nil { + x.FptrMapInt64Uint16 = new(map[int64]uint16) + } + + if false { + } else { + z.F.DecMapInt64Uint16X(x.FptrMapInt64Uint16, d) + } + } + case "FMapInt64Uint32": + if r.TryDecodeAsNil() { + x.FMapInt64Uint32 = nil + } else { + if false { + } else { + z.F.DecMapInt64Uint32X(&x.FMapInt64Uint32, d) + } + } + case "FptrMapInt64Uint32": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Uint32 != nil { + x.FptrMapInt64Uint32 = nil + } + } else { + if x.FptrMapInt64Uint32 == nil { + x.FptrMapInt64Uint32 = new(map[int64]uint32) + } + + if false { + } else { + z.F.DecMapInt64Uint32X(x.FptrMapInt64Uint32, d) + } + } + case "FMapInt64Uint64": + if r.TryDecodeAsNil() { + x.FMapInt64Uint64 = nil + } else { + if false { + } else { + z.F.DecMapInt64Uint64X(&x.FMapInt64Uint64, d) + } + } + case "FptrMapInt64Uint64": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Uint64 != nil { + x.FptrMapInt64Uint64 = nil + } + } else { + if x.FptrMapInt64Uint64 == nil { + x.FptrMapInt64Uint64 = new(map[int64]uint64) + } + + if false { + } else { + z.F.DecMapInt64Uint64X(x.FptrMapInt64Uint64, d) + } + } + case "FMapInt64Uintptr": + if r.TryDecodeAsNil() { + x.FMapInt64Uintptr = nil + } else { + if false { + } else { + z.F.DecMapInt64UintptrX(&x.FMapInt64Uintptr, d) + } + } + case "FptrMapInt64Uintptr": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Uintptr != nil { + x.FptrMapInt64Uintptr = nil + } + } else { + if x.FptrMapInt64Uintptr == nil { + x.FptrMapInt64Uintptr = new(map[int64]uintptr) + } + + if false { + } else { + z.F.DecMapInt64UintptrX(x.FptrMapInt64Uintptr, d) + } + } + case "FMapInt64Int": + if r.TryDecodeAsNil() { + x.FMapInt64Int = nil + } else { + if false { + } else { + z.F.DecMapInt64IntX(&x.FMapInt64Int, d) + } + } + case "FptrMapInt64Int": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Int != nil { + x.FptrMapInt64Int = nil + } + } else { + if x.FptrMapInt64Int == nil { + x.FptrMapInt64Int = new(map[int64]int) + } + + if false { + } else { + z.F.DecMapInt64IntX(x.FptrMapInt64Int, d) + } + } + case "FMapInt64Int8": + if r.TryDecodeAsNil() { + x.FMapInt64Int8 = nil + } else { + if false { + } else { + z.F.DecMapInt64Int8X(&x.FMapInt64Int8, d) + } + } + case "FptrMapInt64Int8": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Int8 != nil { + x.FptrMapInt64Int8 = nil + } + } else { + if x.FptrMapInt64Int8 == nil { + x.FptrMapInt64Int8 = new(map[int64]int8) + } + + if false { + } else { + z.F.DecMapInt64Int8X(x.FptrMapInt64Int8, d) + } + } + case "FMapInt64Int16": + if r.TryDecodeAsNil() { + x.FMapInt64Int16 = nil + } else { + if false { + } else { + z.F.DecMapInt64Int16X(&x.FMapInt64Int16, d) + } + } + case "FptrMapInt64Int16": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Int16 != nil { + x.FptrMapInt64Int16 = nil + } + } else { + if x.FptrMapInt64Int16 == nil { + x.FptrMapInt64Int16 = new(map[int64]int16) + } + + if false { + } else { + z.F.DecMapInt64Int16X(x.FptrMapInt64Int16, d) + } + } + case "FMapInt64Int32": + if r.TryDecodeAsNil() { + x.FMapInt64Int32 = nil + } else { + if false { + } else { + z.F.DecMapInt64Int32X(&x.FMapInt64Int32, d) + } + } + case "FptrMapInt64Int32": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Int32 != nil { + x.FptrMapInt64Int32 = nil + } + } else { + if x.FptrMapInt64Int32 == nil { + x.FptrMapInt64Int32 = new(map[int64]int32) + } + + if false { + } else { + z.F.DecMapInt64Int32X(x.FptrMapInt64Int32, d) + } + } + case "FMapInt64Int64": + if r.TryDecodeAsNil() { + x.FMapInt64Int64 = nil + } else { + if false { + } else { + z.F.DecMapInt64Int64X(&x.FMapInt64Int64, d) + } + } + case "FptrMapInt64Int64": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Int64 != nil { + x.FptrMapInt64Int64 = nil + } + } else { + if x.FptrMapInt64Int64 == nil { + x.FptrMapInt64Int64 = new(map[int64]int64) + } + + if false { + } else { + z.F.DecMapInt64Int64X(x.FptrMapInt64Int64, d) + } + } + case "FMapInt64Float32": + if r.TryDecodeAsNil() { + x.FMapInt64Float32 = nil + } else { + if false { + } else { + z.F.DecMapInt64Float32X(&x.FMapInt64Float32, d) + } + } + case "FptrMapInt64Float32": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Float32 != nil { + x.FptrMapInt64Float32 = nil + } + } else { + if x.FptrMapInt64Float32 == nil { + x.FptrMapInt64Float32 = new(map[int64]float32) + } + + if false { + } else { + z.F.DecMapInt64Float32X(x.FptrMapInt64Float32, d) + } + } + case "FMapInt64Float64": + if r.TryDecodeAsNil() { + x.FMapInt64Float64 = nil + } else { + if false { + } else { + z.F.DecMapInt64Float64X(&x.FMapInt64Float64, d) + } + } + case "FptrMapInt64Float64": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Float64 != nil { + x.FptrMapInt64Float64 = nil + } + } else { + if x.FptrMapInt64Float64 == nil { + x.FptrMapInt64Float64 = new(map[int64]float64) + } + + if false { + } else { + z.F.DecMapInt64Float64X(x.FptrMapInt64Float64, d) + } + } + case "FMapInt64Bool": + if r.TryDecodeAsNil() { + x.FMapInt64Bool = nil + } else { + if false { + } else { + z.F.DecMapInt64BoolX(&x.FMapInt64Bool, d) + } + } + case "FptrMapInt64Bool": + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Bool != nil { + x.FptrMapInt64Bool = nil + } + } else { + if x.FptrMapInt64Bool == nil { + x.FptrMapInt64Bool = new(map[int64]bool) + } + + if false { + } else { + z.F.DecMapInt64BoolX(x.FptrMapInt64Bool, d) + } + } + case "FMapBoolIntf": + if r.TryDecodeAsNil() { + x.FMapBoolIntf = nil + } else { + if false { + } else { + z.F.DecMapBoolIntfX(&x.FMapBoolIntf, d) + } + } + case "FptrMapBoolIntf": + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolIntf != nil { + x.FptrMapBoolIntf = nil + } + } else { + if x.FptrMapBoolIntf == nil { + x.FptrMapBoolIntf = new(map[bool]interface{}) + } + + if false { + } else { + z.F.DecMapBoolIntfX(x.FptrMapBoolIntf, d) + } + } + case "FMapBoolString": + if r.TryDecodeAsNil() { + x.FMapBoolString = nil + } else { + if false { + } else { + z.F.DecMapBoolStringX(&x.FMapBoolString, d) + } + } + case "FptrMapBoolString": + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolString != nil { + x.FptrMapBoolString = nil + } + } else { + if x.FptrMapBoolString == nil { + x.FptrMapBoolString = new(map[bool]string) + } + + if false { + } else { + z.F.DecMapBoolStringX(x.FptrMapBoolString, d) + } + } + case "FMapBoolUint": + if r.TryDecodeAsNil() { + x.FMapBoolUint = nil + } else { + if false { + } else { + z.F.DecMapBoolUintX(&x.FMapBoolUint, d) + } + } + case "FptrMapBoolUint": + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolUint != nil { + x.FptrMapBoolUint = nil + } + } else { + if x.FptrMapBoolUint == nil { + x.FptrMapBoolUint = new(map[bool]uint) + } + + if false { + } else { + z.F.DecMapBoolUintX(x.FptrMapBoolUint, d) + } + } + case "FMapBoolUint8": + if r.TryDecodeAsNil() { + x.FMapBoolUint8 = nil + } else { + if false { + } else { + z.F.DecMapBoolUint8X(&x.FMapBoolUint8, d) + } + } + case "FptrMapBoolUint8": + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolUint8 != nil { + x.FptrMapBoolUint8 = nil + } + } else { + if x.FptrMapBoolUint8 == nil { + x.FptrMapBoolUint8 = new(map[bool]uint8) + } + + if false { + } else { + z.F.DecMapBoolUint8X(x.FptrMapBoolUint8, d) + } + } + case "FMapBoolUint16": + if r.TryDecodeAsNil() { + x.FMapBoolUint16 = nil + } else { + if false { + } else { + z.F.DecMapBoolUint16X(&x.FMapBoolUint16, d) + } + } + case "FptrMapBoolUint16": + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolUint16 != nil { + x.FptrMapBoolUint16 = nil + } + } else { + if x.FptrMapBoolUint16 == nil { + x.FptrMapBoolUint16 = new(map[bool]uint16) + } + + if false { + } else { + z.F.DecMapBoolUint16X(x.FptrMapBoolUint16, d) + } + } + case "FMapBoolUint32": + if r.TryDecodeAsNil() { + x.FMapBoolUint32 = nil + } else { + if false { + } else { + z.F.DecMapBoolUint32X(&x.FMapBoolUint32, d) + } + } + case "FptrMapBoolUint32": + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolUint32 != nil { + x.FptrMapBoolUint32 = nil + } + } else { + if x.FptrMapBoolUint32 == nil { + x.FptrMapBoolUint32 = new(map[bool]uint32) + } + + if false { + } else { + z.F.DecMapBoolUint32X(x.FptrMapBoolUint32, d) + } + } + case "FMapBoolUint64": + if r.TryDecodeAsNil() { + x.FMapBoolUint64 = nil + } else { + if false { + } else { + z.F.DecMapBoolUint64X(&x.FMapBoolUint64, d) + } + } + case "FptrMapBoolUint64": + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolUint64 != nil { + x.FptrMapBoolUint64 = nil + } + } else { + if x.FptrMapBoolUint64 == nil { + x.FptrMapBoolUint64 = new(map[bool]uint64) + } + + if false { + } else { + z.F.DecMapBoolUint64X(x.FptrMapBoolUint64, d) + } + } + case "FMapBoolUintptr": + if r.TryDecodeAsNil() { + x.FMapBoolUintptr = nil + } else { + if false { + } else { + z.F.DecMapBoolUintptrX(&x.FMapBoolUintptr, d) + } + } + case "FptrMapBoolUintptr": + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolUintptr != nil { + x.FptrMapBoolUintptr = nil + } + } else { + if x.FptrMapBoolUintptr == nil { + x.FptrMapBoolUintptr = new(map[bool]uintptr) + } + + if false { + } else { + z.F.DecMapBoolUintptrX(x.FptrMapBoolUintptr, d) + } + } + case "FMapBoolInt": + if r.TryDecodeAsNil() { + x.FMapBoolInt = nil + } else { + if false { + } else { + z.F.DecMapBoolIntX(&x.FMapBoolInt, d) + } + } + case "FptrMapBoolInt": + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolInt != nil { + x.FptrMapBoolInt = nil + } + } else { + if x.FptrMapBoolInt == nil { + x.FptrMapBoolInt = new(map[bool]int) + } + + if false { + } else { + z.F.DecMapBoolIntX(x.FptrMapBoolInt, d) + } + } + case "FMapBoolInt8": + if r.TryDecodeAsNil() { + x.FMapBoolInt8 = nil + } else { + if false { + } else { + z.F.DecMapBoolInt8X(&x.FMapBoolInt8, d) + } + } + case "FptrMapBoolInt8": + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolInt8 != nil { + x.FptrMapBoolInt8 = nil + } + } else { + if x.FptrMapBoolInt8 == nil { + x.FptrMapBoolInt8 = new(map[bool]int8) + } + + if false { + } else { + z.F.DecMapBoolInt8X(x.FptrMapBoolInt8, d) + } + } + case "FMapBoolInt16": + if r.TryDecodeAsNil() { + x.FMapBoolInt16 = nil + } else { + if false { + } else { + z.F.DecMapBoolInt16X(&x.FMapBoolInt16, d) + } + } + case "FptrMapBoolInt16": + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolInt16 != nil { + x.FptrMapBoolInt16 = nil + } + } else { + if x.FptrMapBoolInt16 == nil { + x.FptrMapBoolInt16 = new(map[bool]int16) + } + + if false { + } else { + z.F.DecMapBoolInt16X(x.FptrMapBoolInt16, d) + } + } + case "FMapBoolInt32": + if r.TryDecodeAsNil() { + x.FMapBoolInt32 = nil + } else { + if false { + } else { + z.F.DecMapBoolInt32X(&x.FMapBoolInt32, d) + } + } + case "FptrMapBoolInt32": + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolInt32 != nil { + x.FptrMapBoolInt32 = nil + } + } else { + if x.FptrMapBoolInt32 == nil { + x.FptrMapBoolInt32 = new(map[bool]int32) + } + + if false { + } else { + z.F.DecMapBoolInt32X(x.FptrMapBoolInt32, d) + } + } + case "FMapBoolInt64": + if r.TryDecodeAsNil() { + x.FMapBoolInt64 = nil + } else { + if false { + } else { + z.F.DecMapBoolInt64X(&x.FMapBoolInt64, d) + } + } + case "FptrMapBoolInt64": + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolInt64 != nil { + x.FptrMapBoolInt64 = nil + } + } else { + if x.FptrMapBoolInt64 == nil { + x.FptrMapBoolInt64 = new(map[bool]int64) + } + + if false { + } else { + z.F.DecMapBoolInt64X(x.FptrMapBoolInt64, d) + } + } + case "FMapBoolFloat32": + if r.TryDecodeAsNil() { + x.FMapBoolFloat32 = nil + } else { + if false { + } else { + z.F.DecMapBoolFloat32X(&x.FMapBoolFloat32, d) + } + } + case "FptrMapBoolFloat32": + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolFloat32 != nil { + x.FptrMapBoolFloat32 = nil + } + } else { + if x.FptrMapBoolFloat32 == nil { + x.FptrMapBoolFloat32 = new(map[bool]float32) + } + + if false { + } else { + z.F.DecMapBoolFloat32X(x.FptrMapBoolFloat32, d) + } + } + case "FMapBoolFloat64": + if r.TryDecodeAsNil() { + x.FMapBoolFloat64 = nil + } else { + if false { + } else { + z.F.DecMapBoolFloat64X(&x.FMapBoolFloat64, d) + } + } + case "FptrMapBoolFloat64": + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolFloat64 != nil { + x.FptrMapBoolFloat64 = nil + } + } else { + if x.FptrMapBoolFloat64 == nil { + x.FptrMapBoolFloat64 = new(map[bool]float64) + } + + if false { + } else { + z.F.DecMapBoolFloat64X(x.FptrMapBoolFloat64, d) + } + } + case "FMapBoolBool": + if r.TryDecodeAsNil() { + x.FMapBoolBool = nil + } else { + if false { + } else { + z.F.DecMapBoolBoolX(&x.FMapBoolBool, d) + } + } + case "FptrMapBoolBool": + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolBool != nil { + x.FptrMapBoolBool = nil + } + } else { + if x.FptrMapBoolBool == nil { + x.FptrMapBoolBool = new(map[bool]bool) + } + + if false { + } else { + z.F.DecMapBoolBoolX(x.FptrMapBoolBool, d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + r.ReadMapEnd() +} + +func (x *TestMammoth2) codecDecodeSelfFromArray(l int, d *Decoder) { + var h codecSelfer19781 + z, r := GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj1141 int + var yyb1141 bool + var yyhl1141 bool = l >= 0 + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FIntf = nil + } else { + if false { + } else { + z.DecFallback(&x.FIntf, true) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrIntf != nil { + x.FptrIntf = nil + } + } else { + if x.FptrIntf == nil { + x.FptrIntf = new(interface{}) + } + + if false { + } else { + z.DecFallback(x.FptrIntf, true) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FString = "" + } else { + x.FString = (string)(r.DecodeString()) + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrString != nil { + x.FptrString = nil + } + } else { + if x.FptrString == nil { + x.FptrString = new(string) + } + + if false { + } else { + *x.FptrString = (string)(r.DecodeString()) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FFloat32 = 0 + } else { + x.FFloat32 = (float32)(r.DecodeFloat32As64()) + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrFloat32 != nil { + x.FptrFloat32 = nil + } + } else { + if x.FptrFloat32 == nil { + x.FptrFloat32 = new(float32) + } + + if false { + } else { + *x.FptrFloat32 = (float32)(r.DecodeFloat32As64()) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FFloat64 = 0 + } else { + x.FFloat64 = (float64)(r.DecodeFloat64()) + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrFloat64 != nil { + x.FptrFloat64 = nil + } + } else { + if x.FptrFloat64 == nil { + x.FptrFloat64 = new(float64) + } + + if false { + } else { + *x.FptrFloat64 = (float64)(r.DecodeFloat64()) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FUint = 0 + } else { + x.FUint = (uint)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781)) + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrUint != nil { + x.FptrUint = nil + } + } else { + if x.FptrUint == nil { + x.FptrUint = new(uint) + } + + if false { + } else { + *x.FptrUint = (uint)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781)) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FUint8 = 0 + } else { + x.FUint8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrUint8 != nil { + x.FptrUint8 = nil + } + } else { + if x.FptrUint8 == nil { + x.FptrUint8 = new(uint8) + } + + if false { + } else { + *x.FptrUint8 = (uint8)(z.C.UintV(r.DecodeUint64(), 8)) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FUint16 = 0 + } else { + x.FUint16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16)) + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrUint16 != nil { + x.FptrUint16 = nil + } + } else { + if x.FptrUint16 == nil { + x.FptrUint16 = new(uint16) + } + + if false { + } else { + *x.FptrUint16 = (uint16)(z.C.UintV(r.DecodeUint64(), 16)) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FUint32 = 0 + } else { + x.FUint32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrUint32 != nil { + x.FptrUint32 = nil + } + } else { + if x.FptrUint32 == nil { + x.FptrUint32 = new(uint32) + } + + if false { + } else { + *x.FptrUint32 = (uint32)(z.C.UintV(r.DecodeUint64(), 32)) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FUint64 = 0 + } else { + x.FUint64 = (uint64)(r.DecodeUint64()) + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrUint64 != nil { + x.FptrUint64 = nil + } + } else { + if x.FptrUint64 == nil { + x.FptrUint64 = new(uint64) + } + + if false { + } else { + *x.FptrUint64 = (uint64)(r.DecodeUint64()) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FUintptr = 0 + } else { + x.FUintptr = (uintptr)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781)) + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrUintptr != nil { + x.FptrUintptr = nil + } + } else { + if x.FptrUintptr == nil { + x.FptrUintptr = new(uintptr) + } + + if false { + } else { + *x.FptrUintptr = (uintptr)(z.C.UintV(r.DecodeUint64(), codecSelferBitsize19781)) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FInt = 0 + } else { + x.FInt = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19781)) + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrInt != nil { + x.FptrInt = nil + } + } else { + if x.FptrInt == nil { + x.FptrInt = new(int) + } + + if false { + } else { + *x.FptrInt = (int)(z.C.IntV(r.DecodeInt64(), codecSelferBitsize19781)) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FInt8 = 0 + } else { + x.FInt8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrInt8 != nil { + x.FptrInt8 = nil + } + } else { + if x.FptrInt8 == nil { + x.FptrInt8 = new(int8) + } + + if false { + } else { + *x.FptrInt8 = (int8)(z.C.IntV(r.DecodeInt64(), 8)) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FInt16 = 0 + } else { + x.FInt16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrInt16 != nil { + x.FptrInt16 = nil + } + } else { + if x.FptrInt16 == nil { + x.FptrInt16 = new(int16) + } + + if false { + } else { + *x.FptrInt16 = (int16)(z.C.IntV(r.DecodeInt64(), 16)) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FInt32 = 0 + } else { + x.FInt32 = (int32)(z.C.IntV(r.DecodeInt64(), 32)) + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrInt32 != nil { + x.FptrInt32 = nil + } + } else { + if x.FptrInt32 == nil { + x.FptrInt32 = new(int32) + } + + if false { + } else { + *x.FptrInt32 = (int32)(z.C.IntV(r.DecodeInt64(), 32)) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FInt64 = 0 + } else { + x.FInt64 = (int64)(r.DecodeInt64()) + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrInt64 != nil { + x.FptrInt64 = nil + } + } else { + if x.FptrInt64 == nil { + x.FptrInt64 = new(int64) + } + + if false { + } else { + *x.FptrInt64 = (int64)(r.DecodeInt64()) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FBool = false + } else { + x.FBool = (bool)(r.DecodeBool()) + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrBool != nil { + x.FptrBool = nil + } + } else { + if x.FptrBool == nil { + x.FptrBool = new(bool) + } + + if false { + } else { + *x.FptrBool = (bool)(r.DecodeBool()) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FSliceIntf = nil + } else { + if false { + } else { + z.F.DecSliceIntfX(&x.FSliceIntf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrSliceIntf != nil { + x.FptrSliceIntf = nil + } + } else { + if x.FptrSliceIntf == nil { + x.FptrSliceIntf = new([]interface{}) + } + + if false { + } else { + z.F.DecSliceIntfX(x.FptrSliceIntf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FSliceString = nil + } else { + if false { + } else { + z.F.DecSliceStringX(&x.FSliceString, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrSliceString != nil { + x.FptrSliceString = nil + } + } else { + if x.FptrSliceString == nil { + x.FptrSliceString = new([]string) + } + + if false { + } else { + z.F.DecSliceStringX(x.FptrSliceString, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FSliceFloat32 = nil + } else { + if false { + } else { + z.F.DecSliceFloat32X(&x.FSliceFloat32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrSliceFloat32 != nil { + x.FptrSliceFloat32 = nil + } + } else { + if x.FptrSliceFloat32 == nil { + x.FptrSliceFloat32 = new([]float32) + } + + if false { + } else { + z.F.DecSliceFloat32X(x.FptrSliceFloat32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FSliceFloat64 = nil + } else { + if false { + } else { + z.F.DecSliceFloat64X(&x.FSliceFloat64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrSliceFloat64 != nil { + x.FptrSliceFloat64 = nil + } + } else { + if x.FptrSliceFloat64 == nil { + x.FptrSliceFloat64 = new([]float64) + } + + if false { + } else { + z.F.DecSliceFloat64X(x.FptrSliceFloat64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FSliceUint = nil + } else { + if false { + } else { + z.F.DecSliceUintX(&x.FSliceUint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrSliceUint != nil { + x.FptrSliceUint = nil + } + } else { + if x.FptrSliceUint == nil { + x.FptrSliceUint = new([]uint) + } + + if false { + } else { + z.F.DecSliceUintX(x.FptrSliceUint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FSliceUint8 = nil + } else { + if false { + } else { + x.FSliceUint8 = r.DecodeBytes(([]byte)(x.FSliceUint8), false) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrSliceUint8 != nil { + x.FptrSliceUint8 = nil + } + } else { + if x.FptrSliceUint8 == nil { + x.FptrSliceUint8 = new([]uint8) + } + + if false { + } else { + *x.FptrSliceUint8 = r.DecodeBytes(*(*[]byte)(x.FptrSliceUint8), false) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FSliceUint16 = nil + } else { + if false { + } else { + z.F.DecSliceUint16X(&x.FSliceUint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrSliceUint16 != nil { + x.FptrSliceUint16 = nil + } + } else { + if x.FptrSliceUint16 == nil { + x.FptrSliceUint16 = new([]uint16) + } + + if false { + } else { + z.F.DecSliceUint16X(x.FptrSliceUint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FSliceUint32 = nil + } else { + if false { + } else { + z.F.DecSliceUint32X(&x.FSliceUint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrSliceUint32 != nil { + x.FptrSliceUint32 = nil + } + } else { + if x.FptrSliceUint32 == nil { + x.FptrSliceUint32 = new([]uint32) + } + + if false { + } else { + z.F.DecSliceUint32X(x.FptrSliceUint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FSliceUint64 = nil + } else { + if false { + } else { + z.F.DecSliceUint64X(&x.FSliceUint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrSliceUint64 != nil { + x.FptrSliceUint64 = nil + } + } else { + if x.FptrSliceUint64 == nil { + x.FptrSliceUint64 = new([]uint64) + } + + if false { + } else { + z.F.DecSliceUint64X(x.FptrSliceUint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FSliceUintptr = nil + } else { + if false { + } else { + z.F.DecSliceUintptrX(&x.FSliceUintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrSliceUintptr != nil { + x.FptrSliceUintptr = nil + } + } else { + if x.FptrSliceUintptr == nil { + x.FptrSliceUintptr = new([]uintptr) + } + + if false { + } else { + z.F.DecSliceUintptrX(x.FptrSliceUintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FSliceInt = nil + } else { + if false { + } else { + z.F.DecSliceIntX(&x.FSliceInt, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrSliceInt != nil { + x.FptrSliceInt = nil + } + } else { + if x.FptrSliceInt == nil { + x.FptrSliceInt = new([]int) + } + + if false { + } else { + z.F.DecSliceIntX(x.FptrSliceInt, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FSliceInt8 = nil + } else { + if false { + } else { + z.F.DecSliceInt8X(&x.FSliceInt8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrSliceInt8 != nil { + x.FptrSliceInt8 = nil + } + } else { + if x.FptrSliceInt8 == nil { + x.FptrSliceInt8 = new([]int8) + } + + if false { + } else { + z.F.DecSliceInt8X(x.FptrSliceInt8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FSliceInt16 = nil + } else { + if false { + } else { + z.F.DecSliceInt16X(&x.FSliceInt16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrSliceInt16 != nil { + x.FptrSliceInt16 = nil + } + } else { + if x.FptrSliceInt16 == nil { + x.FptrSliceInt16 = new([]int16) + } + + if false { + } else { + z.F.DecSliceInt16X(x.FptrSliceInt16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FSliceInt32 = nil + } else { + if false { + } else { + z.F.DecSliceInt32X(&x.FSliceInt32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrSliceInt32 != nil { + x.FptrSliceInt32 = nil + } + } else { + if x.FptrSliceInt32 == nil { + x.FptrSliceInt32 = new([]int32) + } + + if false { + } else { + z.F.DecSliceInt32X(x.FptrSliceInt32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FSliceInt64 = nil + } else { + if false { + } else { + z.F.DecSliceInt64X(&x.FSliceInt64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrSliceInt64 != nil { + x.FptrSliceInt64 = nil + } + } else { + if x.FptrSliceInt64 == nil { + x.FptrSliceInt64 = new([]int64) + } + + if false { + } else { + z.F.DecSliceInt64X(x.FptrSliceInt64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FSliceBool = nil + } else { + if false { + } else { + z.F.DecSliceBoolX(&x.FSliceBool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrSliceBool != nil { + x.FptrSliceBool = nil + } + } else { + if x.FptrSliceBool == nil { + x.FptrSliceBool = new([]bool) + } + + if false { + } else { + z.F.DecSliceBoolX(x.FptrSliceBool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntfIntf = nil + } else { + if false { + } else { + z.F.DecMapIntfIntfX(&x.FMapIntfIntf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfIntf != nil { + x.FptrMapIntfIntf = nil + } + } else { + if x.FptrMapIntfIntf == nil { + x.FptrMapIntfIntf = new(map[interface{}]interface{}) + } + + if false { + } else { + z.F.DecMapIntfIntfX(x.FptrMapIntfIntf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntfString = nil + } else { + if false { + } else { + z.F.DecMapIntfStringX(&x.FMapIntfString, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfString != nil { + x.FptrMapIntfString = nil + } + } else { + if x.FptrMapIntfString == nil { + x.FptrMapIntfString = new(map[interface{}]string) + } + + if false { + } else { + z.F.DecMapIntfStringX(x.FptrMapIntfString, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntfUint = nil + } else { + if false { + } else { + z.F.DecMapIntfUintX(&x.FMapIntfUint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfUint != nil { + x.FptrMapIntfUint = nil + } + } else { + if x.FptrMapIntfUint == nil { + x.FptrMapIntfUint = new(map[interface{}]uint) + } + + if false { + } else { + z.F.DecMapIntfUintX(x.FptrMapIntfUint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntfUint8 = nil + } else { + if false { + } else { + z.F.DecMapIntfUint8X(&x.FMapIntfUint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfUint8 != nil { + x.FptrMapIntfUint8 = nil + } + } else { + if x.FptrMapIntfUint8 == nil { + x.FptrMapIntfUint8 = new(map[interface{}]uint8) + } + + if false { + } else { + z.F.DecMapIntfUint8X(x.FptrMapIntfUint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntfUint16 = nil + } else { + if false { + } else { + z.F.DecMapIntfUint16X(&x.FMapIntfUint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfUint16 != nil { + x.FptrMapIntfUint16 = nil + } + } else { + if x.FptrMapIntfUint16 == nil { + x.FptrMapIntfUint16 = new(map[interface{}]uint16) + } + + if false { + } else { + z.F.DecMapIntfUint16X(x.FptrMapIntfUint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntfUint32 = nil + } else { + if false { + } else { + z.F.DecMapIntfUint32X(&x.FMapIntfUint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfUint32 != nil { + x.FptrMapIntfUint32 = nil + } + } else { + if x.FptrMapIntfUint32 == nil { + x.FptrMapIntfUint32 = new(map[interface{}]uint32) + } + + if false { + } else { + z.F.DecMapIntfUint32X(x.FptrMapIntfUint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntfUint64 = nil + } else { + if false { + } else { + z.F.DecMapIntfUint64X(&x.FMapIntfUint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfUint64 != nil { + x.FptrMapIntfUint64 = nil + } + } else { + if x.FptrMapIntfUint64 == nil { + x.FptrMapIntfUint64 = new(map[interface{}]uint64) + } + + if false { + } else { + z.F.DecMapIntfUint64X(x.FptrMapIntfUint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntfUintptr = nil + } else { + if false { + } else { + z.F.DecMapIntfUintptrX(&x.FMapIntfUintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfUintptr != nil { + x.FptrMapIntfUintptr = nil + } + } else { + if x.FptrMapIntfUintptr == nil { + x.FptrMapIntfUintptr = new(map[interface{}]uintptr) + } + + if false { + } else { + z.F.DecMapIntfUintptrX(x.FptrMapIntfUintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntfInt = nil + } else { + if false { + } else { + z.F.DecMapIntfIntX(&x.FMapIntfInt, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfInt != nil { + x.FptrMapIntfInt = nil + } + } else { + if x.FptrMapIntfInt == nil { + x.FptrMapIntfInt = new(map[interface{}]int) + } + + if false { + } else { + z.F.DecMapIntfIntX(x.FptrMapIntfInt, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntfInt8 = nil + } else { + if false { + } else { + z.F.DecMapIntfInt8X(&x.FMapIntfInt8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfInt8 != nil { + x.FptrMapIntfInt8 = nil + } + } else { + if x.FptrMapIntfInt8 == nil { + x.FptrMapIntfInt8 = new(map[interface{}]int8) + } + + if false { + } else { + z.F.DecMapIntfInt8X(x.FptrMapIntfInt8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntfInt16 = nil + } else { + if false { + } else { + z.F.DecMapIntfInt16X(&x.FMapIntfInt16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfInt16 != nil { + x.FptrMapIntfInt16 = nil + } + } else { + if x.FptrMapIntfInt16 == nil { + x.FptrMapIntfInt16 = new(map[interface{}]int16) + } + + if false { + } else { + z.F.DecMapIntfInt16X(x.FptrMapIntfInt16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntfInt32 = nil + } else { + if false { + } else { + z.F.DecMapIntfInt32X(&x.FMapIntfInt32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfInt32 != nil { + x.FptrMapIntfInt32 = nil + } + } else { + if x.FptrMapIntfInt32 == nil { + x.FptrMapIntfInt32 = new(map[interface{}]int32) + } + + if false { + } else { + z.F.DecMapIntfInt32X(x.FptrMapIntfInt32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntfInt64 = nil + } else { + if false { + } else { + z.F.DecMapIntfInt64X(&x.FMapIntfInt64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfInt64 != nil { + x.FptrMapIntfInt64 = nil + } + } else { + if x.FptrMapIntfInt64 == nil { + x.FptrMapIntfInt64 = new(map[interface{}]int64) + } + + if false { + } else { + z.F.DecMapIntfInt64X(x.FptrMapIntfInt64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntfFloat32 = nil + } else { + if false { + } else { + z.F.DecMapIntfFloat32X(&x.FMapIntfFloat32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfFloat32 != nil { + x.FptrMapIntfFloat32 = nil + } + } else { + if x.FptrMapIntfFloat32 == nil { + x.FptrMapIntfFloat32 = new(map[interface{}]float32) + } + + if false { + } else { + z.F.DecMapIntfFloat32X(x.FptrMapIntfFloat32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntfFloat64 = nil + } else { + if false { + } else { + z.F.DecMapIntfFloat64X(&x.FMapIntfFloat64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfFloat64 != nil { + x.FptrMapIntfFloat64 = nil + } + } else { + if x.FptrMapIntfFloat64 == nil { + x.FptrMapIntfFloat64 = new(map[interface{}]float64) + } + + if false { + } else { + z.F.DecMapIntfFloat64X(x.FptrMapIntfFloat64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntfBool = nil + } else { + if false { + } else { + z.F.DecMapIntfBoolX(&x.FMapIntfBool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntfBool != nil { + x.FptrMapIntfBool = nil + } + } else { + if x.FptrMapIntfBool == nil { + x.FptrMapIntfBool = new(map[interface{}]bool) + } + + if false { + } else { + z.F.DecMapIntfBoolX(x.FptrMapIntfBool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapStringIntf = nil + } else { + if false { + } else { + z.F.DecMapStringIntfX(&x.FMapStringIntf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapStringIntf != nil { + x.FptrMapStringIntf = nil + } + } else { + if x.FptrMapStringIntf == nil { + x.FptrMapStringIntf = new(map[string]interface{}) + } + + if false { + } else { + z.F.DecMapStringIntfX(x.FptrMapStringIntf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapStringString = nil + } else { + if false { + } else { + z.F.DecMapStringStringX(&x.FMapStringString, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapStringString != nil { + x.FptrMapStringString = nil + } + } else { + if x.FptrMapStringString == nil { + x.FptrMapStringString = new(map[string]string) + } + + if false { + } else { + z.F.DecMapStringStringX(x.FptrMapStringString, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapStringUint = nil + } else { + if false { + } else { + z.F.DecMapStringUintX(&x.FMapStringUint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapStringUint != nil { + x.FptrMapStringUint = nil + } + } else { + if x.FptrMapStringUint == nil { + x.FptrMapStringUint = new(map[string]uint) + } + + if false { + } else { + z.F.DecMapStringUintX(x.FptrMapStringUint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapStringUint8 = nil + } else { + if false { + } else { + z.F.DecMapStringUint8X(&x.FMapStringUint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapStringUint8 != nil { + x.FptrMapStringUint8 = nil + } + } else { + if x.FptrMapStringUint8 == nil { + x.FptrMapStringUint8 = new(map[string]uint8) + } + + if false { + } else { + z.F.DecMapStringUint8X(x.FptrMapStringUint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapStringUint16 = nil + } else { + if false { + } else { + z.F.DecMapStringUint16X(&x.FMapStringUint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapStringUint16 != nil { + x.FptrMapStringUint16 = nil + } + } else { + if x.FptrMapStringUint16 == nil { + x.FptrMapStringUint16 = new(map[string]uint16) + } + + if false { + } else { + z.F.DecMapStringUint16X(x.FptrMapStringUint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapStringUint32 = nil + } else { + if false { + } else { + z.F.DecMapStringUint32X(&x.FMapStringUint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapStringUint32 != nil { + x.FptrMapStringUint32 = nil + } + } else { + if x.FptrMapStringUint32 == nil { + x.FptrMapStringUint32 = new(map[string]uint32) + } + + if false { + } else { + z.F.DecMapStringUint32X(x.FptrMapStringUint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapStringUint64 = nil + } else { + if false { + } else { + z.F.DecMapStringUint64X(&x.FMapStringUint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapStringUint64 != nil { + x.FptrMapStringUint64 = nil + } + } else { + if x.FptrMapStringUint64 == nil { + x.FptrMapStringUint64 = new(map[string]uint64) + } + + if false { + } else { + z.F.DecMapStringUint64X(x.FptrMapStringUint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapStringUintptr = nil + } else { + if false { + } else { + z.F.DecMapStringUintptrX(&x.FMapStringUintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapStringUintptr != nil { + x.FptrMapStringUintptr = nil + } + } else { + if x.FptrMapStringUintptr == nil { + x.FptrMapStringUintptr = new(map[string]uintptr) + } + + if false { + } else { + z.F.DecMapStringUintptrX(x.FptrMapStringUintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapStringInt = nil + } else { + if false { + } else { + z.F.DecMapStringIntX(&x.FMapStringInt, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapStringInt != nil { + x.FptrMapStringInt = nil + } + } else { + if x.FptrMapStringInt == nil { + x.FptrMapStringInt = new(map[string]int) + } + + if false { + } else { + z.F.DecMapStringIntX(x.FptrMapStringInt, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapStringInt8 = nil + } else { + if false { + } else { + z.F.DecMapStringInt8X(&x.FMapStringInt8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapStringInt8 != nil { + x.FptrMapStringInt8 = nil + } + } else { + if x.FptrMapStringInt8 == nil { + x.FptrMapStringInt8 = new(map[string]int8) + } + + if false { + } else { + z.F.DecMapStringInt8X(x.FptrMapStringInt8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapStringInt16 = nil + } else { + if false { + } else { + z.F.DecMapStringInt16X(&x.FMapStringInt16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapStringInt16 != nil { + x.FptrMapStringInt16 = nil + } + } else { + if x.FptrMapStringInt16 == nil { + x.FptrMapStringInt16 = new(map[string]int16) + } + + if false { + } else { + z.F.DecMapStringInt16X(x.FptrMapStringInt16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapStringInt32 = nil + } else { + if false { + } else { + z.F.DecMapStringInt32X(&x.FMapStringInt32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapStringInt32 != nil { + x.FptrMapStringInt32 = nil + } + } else { + if x.FptrMapStringInt32 == nil { + x.FptrMapStringInt32 = new(map[string]int32) + } + + if false { + } else { + z.F.DecMapStringInt32X(x.FptrMapStringInt32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapStringInt64 = nil + } else { + if false { + } else { + z.F.DecMapStringInt64X(&x.FMapStringInt64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapStringInt64 != nil { + x.FptrMapStringInt64 = nil + } + } else { + if x.FptrMapStringInt64 == nil { + x.FptrMapStringInt64 = new(map[string]int64) + } + + if false { + } else { + z.F.DecMapStringInt64X(x.FptrMapStringInt64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapStringFloat32 = nil + } else { + if false { + } else { + z.F.DecMapStringFloat32X(&x.FMapStringFloat32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapStringFloat32 != nil { + x.FptrMapStringFloat32 = nil + } + } else { + if x.FptrMapStringFloat32 == nil { + x.FptrMapStringFloat32 = new(map[string]float32) + } + + if false { + } else { + z.F.DecMapStringFloat32X(x.FptrMapStringFloat32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapStringFloat64 = nil + } else { + if false { + } else { + z.F.DecMapStringFloat64X(&x.FMapStringFloat64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapStringFloat64 != nil { + x.FptrMapStringFloat64 = nil + } + } else { + if x.FptrMapStringFloat64 == nil { + x.FptrMapStringFloat64 = new(map[string]float64) + } + + if false { + } else { + z.F.DecMapStringFloat64X(x.FptrMapStringFloat64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapStringBool = nil + } else { + if false { + } else { + z.F.DecMapStringBoolX(&x.FMapStringBool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapStringBool != nil { + x.FptrMapStringBool = nil + } + } else { + if x.FptrMapStringBool == nil { + x.FptrMapStringBool = new(map[string]bool) + } + + if false { + } else { + z.F.DecMapStringBoolX(x.FptrMapStringBool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat32Intf = nil + } else { + if false { + } else { + z.F.DecMapFloat32IntfX(&x.FMapFloat32Intf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Intf != nil { + x.FptrMapFloat32Intf = nil + } + } else { + if x.FptrMapFloat32Intf == nil { + x.FptrMapFloat32Intf = new(map[float32]interface{}) + } + + if false { + } else { + z.F.DecMapFloat32IntfX(x.FptrMapFloat32Intf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat32String = nil + } else { + if false { + } else { + z.F.DecMapFloat32StringX(&x.FMapFloat32String, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32String != nil { + x.FptrMapFloat32String = nil + } + } else { + if x.FptrMapFloat32String == nil { + x.FptrMapFloat32String = new(map[float32]string) + } + + if false { + } else { + z.F.DecMapFloat32StringX(x.FptrMapFloat32String, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat32Uint = nil + } else { + if false { + } else { + z.F.DecMapFloat32UintX(&x.FMapFloat32Uint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Uint != nil { + x.FptrMapFloat32Uint = nil + } + } else { + if x.FptrMapFloat32Uint == nil { + x.FptrMapFloat32Uint = new(map[float32]uint) + } + + if false { + } else { + z.F.DecMapFloat32UintX(x.FptrMapFloat32Uint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat32Uint8 = nil + } else { + if false { + } else { + z.F.DecMapFloat32Uint8X(&x.FMapFloat32Uint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Uint8 != nil { + x.FptrMapFloat32Uint8 = nil + } + } else { + if x.FptrMapFloat32Uint8 == nil { + x.FptrMapFloat32Uint8 = new(map[float32]uint8) + } + + if false { + } else { + z.F.DecMapFloat32Uint8X(x.FptrMapFloat32Uint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat32Uint16 = nil + } else { + if false { + } else { + z.F.DecMapFloat32Uint16X(&x.FMapFloat32Uint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Uint16 != nil { + x.FptrMapFloat32Uint16 = nil + } + } else { + if x.FptrMapFloat32Uint16 == nil { + x.FptrMapFloat32Uint16 = new(map[float32]uint16) + } + + if false { + } else { + z.F.DecMapFloat32Uint16X(x.FptrMapFloat32Uint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat32Uint32 = nil + } else { + if false { + } else { + z.F.DecMapFloat32Uint32X(&x.FMapFloat32Uint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Uint32 != nil { + x.FptrMapFloat32Uint32 = nil + } + } else { + if x.FptrMapFloat32Uint32 == nil { + x.FptrMapFloat32Uint32 = new(map[float32]uint32) + } + + if false { + } else { + z.F.DecMapFloat32Uint32X(x.FptrMapFloat32Uint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat32Uint64 = nil + } else { + if false { + } else { + z.F.DecMapFloat32Uint64X(&x.FMapFloat32Uint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Uint64 != nil { + x.FptrMapFloat32Uint64 = nil + } + } else { + if x.FptrMapFloat32Uint64 == nil { + x.FptrMapFloat32Uint64 = new(map[float32]uint64) + } + + if false { + } else { + z.F.DecMapFloat32Uint64X(x.FptrMapFloat32Uint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat32Uintptr = nil + } else { + if false { + } else { + z.F.DecMapFloat32UintptrX(&x.FMapFloat32Uintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Uintptr != nil { + x.FptrMapFloat32Uintptr = nil + } + } else { + if x.FptrMapFloat32Uintptr == nil { + x.FptrMapFloat32Uintptr = new(map[float32]uintptr) + } + + if false { + } else { + z.F.DecMapFloat32UintptrX(x.FptrMapFloat32Uintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat32Int = nil + } else { + if false { + } else { + z.F.DecMapFloat32IntX(&x.FMapFloat32Int, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Int != nil { + x.FptrMapFloat32Int = nil + } + } else { + if x.FptrMapFloat32Int == nil { + x.FptrMapFloat32Int = new(map[float32]int) + } + + if false { + } else { + z.F.DecMapFloat32IntX(x.FptrMapFloat32Int, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat32Int8 = nil + } else { + if false { + } else { + z.F.DecMapFloat32Int8X(&x.FMapFloat32Int8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Int8 != nil { + x.FptrMapFloat32Int8 = nil + } + } else { + if x.FptrMapFloat32Int8 == nil { + x.FptrMapFloat32Int8 = new(map[float32]int8) + } + + if false { + } else { + z.F.DecMapFloat32Int8X(x.FptrMapFloat32Int8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat32Int16 = nil + } else { + if false { + } else { + z.F.DecMapFloat32Int16X(&x.FMapFloat32Int16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Int16 != nil { + x.FptrMapFloat32Int16 = nil + } + } else { + if x.FptrMapFloat32Int16 == nil { + x.FptrMapFloat32Int16 = new(map[float32]int16) + } + + if false { + } else { + z.F.DecMapFloat32Int16X(x.FptrMapFloat32Int16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat32Int32 = nil + } else { + if false { + } else { + z.F.DecMapFloat32Int32X(&x.FMapFloat32Int32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Int32 != nil { + x.FptrMapFloat32Int32 = nil + } + } else { + if x.FptrMapFloat32Int32 == nil { + x.FptrMapFloat32Int32 = new(map[float32]int32) + } + + if false { + } else { + z.F.DecMapFloat32Int32X(x.FptrMapFloat32Int32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat32Int64 = nil + } else { + if false { + } else { + z.F.DecMapFloat32Int64X(&x.FMapFloat32Int64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Int64 != nil { + x.FptrMapFloat32Int64 = nil + } + } else { + if x.FptrMapFloat32Int64 == nil { + x.FptrMapFloat32Int64 = new(map[float32]int64) + } + + if false { + } else { + z.F.DecMapFloat32Int64X(x.FptrMapFloat32Int64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat32Float32 = nil + } else { + if false { + } else { + z.F.DecMapFloat32Float32X(&x.FMapFloat32Float32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Float32 != nil { + x.FptrMapFloat32Float32 = nil + } + } else { + if x.FptrMapFloat32Float32 == nil { + x.FptrMapFloat32Float32 = new(map[float32]float32) + } + + if false { + } else { + z.F.DecMapFloat32Float32X(x.FptrMapFloat32Float32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat32Float64 = nil + } else { + if false { + } else { + z.F.DecMapFloat32Float64X(&x.FMapFloat32Float64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Float64 != nil { + x.FptrMapFloat32Float64 = nil + } + } else { + if x.FptrMapFloat32Float64 == nil { + x.FptrMapFloat32Float64 = new(map[float32]float64) + } + + if false { + } else { + z.F.DecMapFloat32Float64X(x.FptrMapFloat32Float64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat32Bool = nil + } else { + if false { + } else { + z.F.DecMapFloat32BoolX(&x.FMapFloat32Bool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat32Bool != nil { + x.FptrMapFloat32Bool = nil + } + } else { + if x.FptrMapFloat32Bool == nil { + x.FptrMapFloat32Bool = new(map[float32]bool) + } + + if false { + } else { + z.F.DecMapFloat32BoolX(x.FptrMapFloat32Bool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat64Intf = nil + } else { + if false { + } else { + z.F.DecMapFloat64IntfX(&x.FMapFloat64Intf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Intf != nil { + x.FptrMapFloat64Intf = nil + } + } else { + if x.FptrMapFloat64Intf == nil { + x.FptrMapFloat64Intf = new(map[float64]interface{}) + } + + if false { + } else { + z.F.DecMapFloat64IntfX(x.FptrMapFloat64Intf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat64String = nil + } else { + if false { + } else { + z.F.DecMapFloat64StringX(&x.FMapFloat64String, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64String != nil { + x.FptrMapFloat64String = nil + } + } else { + if x.FptrMapFloat64String == nil { + x.FptrMapFloat64String = new(map[float64]string) + } + + if false { + } else { + z.F.DecMapFloat64StringX(x.FptrMapFloat64String, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat64Uint = nil + } else { + if false { + } else { + z.F.DecMapFloat64UintX(&x.FMapFloat64Uint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Uint != nil { + x.FptrMapFloat64Uint = nil + } + } else { + if x.FptrMapFloat64Uint == nil { + x.FptrMapFloat64Uint = new(map[float64]uint) + } + + if false { + } else { + z.F.DecMapFloat64UintX(x.FptrMapFloat64Uint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat64Uint8 = nil + } else { + if false { + } else { + z.F.DecMapFloat64Uint8X(&x.FMapFloat64Uint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Uint8 != nil { + x.FptrMapFloat64Uint8 = nil + } + } else { + if x.FptrMapFloat64Uint8 == nil { + x.FptrMapFloat64Uint8 = new(map[float64]uint8) + } + + if false { + } else { + z.F.DecMapFloat64Uint8X(x.FptrMapFloat64Uint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat64Uint16 = nil + } else { + if false { + } else { + z.F.DecMapFloat64Uint16X(&x.FMapFloat64Uint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Uint16 != nil { + x.FptrMapFloat64Uint16 = nil + } + } else { + if x.FptrMapFloat64Uint16 == nil { + x.FptrMapFloat64Uint16 = new(map[float64]uint16) + } + + if false { + } else { + z.F.DecMapFloat64Uint16X(x.FptrMapFloat64Uint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat64Uint32 = nil + } else { + if false { + } else { + z.F.DecMapFloat64Uint32X(&x.FMapFloat64Uint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Uint32 != nil { + x.FptrMapFloat64Uint32 = nil + } + } else { + if x.FptrMapFloat64Uint32 == nil { + x.FptrMapFloat64Uint32 = new(map[float64]uint32) + } + + if false { + } else { + z.F.DecMapFloat64Uint32X(x.FptrMapFloat64Uint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat64Uint64 = nil + } else { + if false { + } else { + z.F.DecMapFloat64Uint64X(&x.FMapFloat64Uint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Uint64 != nil { + x.FptrMapFloat64Uint64 = nil + } + } else { + if x.FptrMapFloat64Uint64 == nil { + x.FptrMapFloat64Uint64 = new(map[float64]uint64) + } + + if false { + } else { + z.F.DecMapFloat64Uint64X(x.FptrMapFloat64Uint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat64Uintptr = nil + } else { + if false { + } else { + z.F.DecMapFloat64UintptrX(&x.FMapFloat64Uintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Uintptr != nil { + x.FptrMapFloat64Uintptr = nil + } + } else { + if x.FptrMapFloat64Uintptr == nil { + x.FptrMapFloat64Uintptr = new(map[float64]uintptr) + } + + if false { + } else { + z.F.DecMapFloat64UintptrX(x.FptrMapFloat64Uintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat64Int = nil + } else { + if false { + } else { + z.F.DecMapFloat64IntX(&x.FMapFloat64Int, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Int != nil { + x.FptrMapFloat64Int = nil + } + } else { + if x.FptrMapFloat64Int == nil { + x.FptrMapFloat64Int = new(map[float64]int) + } + + if false { + } else { + z.F.DecMapFloat64IntX(x.FptrMapFloat64Int, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat64Int8 = nil + } else { + if false { + } else { + z.F.DecMapFloat64Int8X(&x.FMapFloat64Int8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Int8 != nil { + x.FptrMapFloat64Int8 = nil + } + } else { + if x.FptrMapFloat64Int8 == nil { + x.FptrMapFloat64Int8 = new(map[float64]int8) + } + + if false { + } else { + z.F.DecMapFloat64Int8X(x.FptrMapFloat64Int8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat64Int16 = nil + } else { + if false { + } else { + z.F.DecMapFloat64Int16X(&x.FMapFloat64Int16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Int16 != nil { + x.FptrMapFloat64Int16 = nil + } + } else { + if x.FptrMapFloat64Int16 == nil { + x.FptrMapFloat64Int16 = new(map[float64]int16) + } + + if false { + } else { + z.F.DecMapFloat64Int16X(x.FptrMapFloat64Int16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat64Int32 = nil + } else { + if false { + } else { + z.F.DecMapFloat64Int32X(&x.FMapFloat64Int32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Int32 != nil { + x.FptrMapFloat64Int32 = nil + } + } else { + if x.FptrMapFloat64Int32 == nil { + x.FptrMapFloat64Int32 = new(map[float64]int32) + } + + if false { + } else { + z.F.DecMapFloat64Int32X(x.FptrMapFloat64Int32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat64Int64 = nil + } else { + if false { + } else { + z.F.DecMapFloat64Int64X(&x.FMapFloat64Int64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Int64 != nil { + x.FptrMapFloat64Int64 = nil + } + } else { + if x.FptrMapFloat64Int64 == nil { + x.FptrMapFloat64Int64 = new(map[float64]int64) + } + + if false { + } else { + z.F.DecMapFloat64Int64X(x.FptrMapFloat64Int64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat64Float32 = nil + } else { + if false { + } else { + z.F.DecMapFloat64Float32X(&x.FMapFloat64Float32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Float32 != nil { + x.FptrMapFloat64Float32 = nil + } + } else { + if x.FptrMapFloat64Float32 == nil { + x.FptrMapFloat64Float32 = new(map[float64]float32) + } + + if false { + } else { + z.F.DecMapFloat64Float32X(x.FptrMapFloat64Float32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat64Float64 = nil + } else { + if false { + } else { + z.F.DecMapFloat64Float64X(&x.FMapFloat64Float64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Float64 != nil { + x.FptrMapFloat64Float64 = nil + } + } else { + if x.FptrMapFloat64Float64 == nil { + x.FptrMapFloat64Float64 = new(map[float64]float64) + } + + if false { + } else { + z.F.DecMapFloat64Float64X(x.FptrMapFloat64Float64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapFloat64Bool = nil + } else { + if false { + } else { + z.F.DecMapFloat64BoolX(&x.FMapFloat64Bool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapFloat64Bool != nil { + x.FptrMapFloat64Bool = nil + } + } else { + if x.FptrMapFloat64Bool == nil { + x.FptrMapFloat64Bool = new(map[float64]bool) + } + + if false { + } else { + z.F.DecMapFloat64BoolX(x.FptrMapFloat64Bool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintIntf = nil + } else { + if false { + } else { + z.F.DecMapUintIntfX(&x.FMapUintIntf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintIntf != nil { + x.FptrMapUintIntf = nil + } + } else { + if x.FptrMapUintIntf == nil { + x.FptrMapUintIntf = new(map[uint]interface{}) + } + + if false { + } else { + z.F.DecMapUintIntfX(x.FptrMapUintIntf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintString = nil + } else { + if false { + } else { + z.F.DecMapUintStringX(&x.FMapUintString, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintString != nil { + x.FptrMapUintString = nil + } + } else { + if x.FptrMapUintString == nil { + x.FptrMapUintString = new(map[uint]string) + } + + if false { + } else { + z.F.DecMapUintStringX(x.FptrMapUintString, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintUint = nil + } else { + if false { + } else { + z.F.DecMapUintUintX(&x.FMapUintUint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintUint != nil { + x.FptrMapUintUint = nil + } + } else { + if x.FptrMapUintUint == nil { + x.FptrMapUintUint = new(map[uint]uint) + } + + if false { + } else { + z.F.DecMapUintUintX(x.FptrMapUintUint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintUint8 = nil + } else { + if false { + } else { + z.F.DecMapUintUint8X(&x.FMapUintUint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintUint8 != nil { + x.FptrMapUintUint8 = nil + } + } else { + if x.FptrMapUintUint8 == nil { + x.FptrMapUintUint8 = new(map[uint]uint8) + } + + if false { + } else { + z.F.DecMapUintUint8X(x.FptrMapUintUint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintUint16 = nil + } else { + if false { + } else { + z.F.DecMapUintUint16X(&x.FMapUintUint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintUint16 != nil { + x.FptrMapUintUint16 = nil + } + } else { + if x.FptrMapUintUint16 == nil { + x.FptrMapUintUint16 = new(map[uint]uint16) + } + + if false { + } else { + z.F.DecMapUintUint16X(x.FptrMapUintUint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintUint32 = nil + } else { + if false { + } else { + z.F.DecMapUintUint32X(&x.FMapUintUint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintUint32 != nil { + x.FptrMapUintUint32 = nil + } + } else { + if x.FptrMapUintUint32 == nil { + x.FptrMapUintUint32 = new(map[uint]uint32) + } + + if false { + } else { + z.F.DecMapUintUint32X(x.FptrMapUintUint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintUint64 = nil + } else { + if false { + } else { + z.F.DecMapUintUint64X(&x.FMapUintUint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintUint64 != nil { + x.FptrMapUintUint64 = nil + } + } else { + if x.FptrMapUintUint64 == nil { + x.FptrMapUintUint64 = new(map[uint]uint64) + } + + if false { + } else { + z.F.DecMapUintUint64X(x.FptrMapUintUint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintUintptr = nil + } else { + if false { + } else { + z.F.DecMapUintUintptrX(&x.FMapUintUintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintUintptr != nil { + x.FptrMapUintUintptr = nil + } + } else { + if x.FptrMapUintUintptr == nil { + x.FptrMapUintUintptr = new(map[uint]uintptr) + } + + if false { + } else { + z.F.DecMapUintUintptrX(x.FptrMapUintUintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintInt = nil + } else { + if false { + } else { + z.F.DecMapUintIntX(&x.FMapUintInt, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintInt != nil { + x.FptrMapUintInt = nil + } + } else { + if x.FptrMapUintInt == nil { + x.FptrMapUintInt = new(map[uint]int) + } + + if false { + } else { + z.F.DecMapUintIntX(x.FptrMapUintInt, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintInt8 = nil + } else { + if false { + } else { + z.F.DecMapUintInt8X(&x.FMapUintInt8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintInt8 != nil { + x.FptrMapUintInt8 = nil + } + } else { + if x.FptrMapUintInt8 == nil { + x.FptrMapUintInt8 = new(map[uint]int8) + } + + if false { + } else { + z.F.DecMapUintInt8X(x.FptrMapUintInt8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintInt16 = nil + } else { + if false { + } else { + z.F.DecMapUintInt16X(&x.FMapUintInt16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintInt16 != nil { + x.FptrMapUintInt16 = nil + } + } else { + if x.FptrMapUintInt16 == nil { + x.FptrMapUintInt16 = new(map[uint]int16) + } + + if false { + } else { + z.F.DecMapUintInt16X(x.FptrMapUintInt16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintInt32 = nil + } else { + if false { + } else { + z.F.DecMapUintInt32X(&x.FMapUintInt32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintInt32 != nil { + x.FptrMapUintInt32 = nil + } + } else { + if x.FptrMapUintInt32 == nil { + x.FptrMapUintInt32 = new(map[uint]int32) + } + + if false { + } else { + z.F.DecMapUintInt32X(x.FptrMapUintInt32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintInt64 = nil + } else { + if false { + } else { + z.F.DecMapUintInt64X(&x.FMapUintInt64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintInt64 != nil { + x.FptrMapUintInt64 = nil + } + } else { + if x.FptrMapUintInt64 == nil { + x.FptrMapUintInt64 = new(map[uint]int64) + } + + if false { + } else { + z.F.DecMapUintInt64X(x.FptrMapUintInt64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintFloat32 = nil + } else { + if false { + } else { + z.F.DecMapUintFloat32X(&x.FMapUintFloat32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintFloat32 != nil { + x.FptrMapUintFloat32 = nil + } + } else { + if x.FptrMapUintFloat32 == nil { + x.FptrMapUintFloat32 = new(map[uint]float32) + } + + if false { + } else { + z.F.DecMapUintFloat32X(x.FptrMapUintFloat32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintFloat64 = nil + } else { + if false { + } else { + z.F.DecMapUintFloat64X(&x.FMapUintFloat64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintFloat64 != nil { + x.FptrMapUintFloat64 = nil + } + } else { + if x.FptrMapUintFloat64 == nil { + x.FptrMapUintFloat64 = new(map[uint]float64) + } + + if false { + } else { + z.F.DecMapUintFloat64X(x.FptrMapUintFloat64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintBool = nil + } else { + if false { + } else { + z.F.DecMapUintBoolX(&x.FMapUintBool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintBool != nil { + x.FptrMapUintBool = nil + } + } else { + if x.FptrMapUintBool == nil { + x.FptrMapUintBool = new(map[uint]bool) + } + + if false { + } else { + z.F.DecMapUintBoolX(x.FptrMapUintBool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint8Intf = nil + } else { + if false { + } else { + z.F.DecMapUint8IntfX(&x.FMapUint8Intf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Intf != nil { + x.FptrMapUint8Intf = nil + } + } else { + if x.FptrMapUint8Intf == nil { + x.FptrMapUint8Intf = new(map[uint8]interface{}) + } + + if false { + } else { + z.F.DecMapUint8IntfX(x.FptrMapUint8Intf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint8String = nil + } else { + if false { + } else { + z.F.DecMapUint8StringX(&x.FMapUint8String, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8String != nil { + x.FptrMapUint8String = nil + } + } else { + if x.FptrMapUint8String == nil { + x.FptrMapUint8String = new(map[uint8]string) + } + + if false { + } else { + z.F.DecMapUint8StringX(x.FptrMapUint8String, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint8Uint = nil + } else { + if false { + } else { + z.F.DecMapUint8UintX(&x.FMapUint8Uint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Uint != nil { + x.FptrMapUint8Uint = nil + } + } else { + if x.FptrMapUint8Uint == nil { + x.FptrMapUint8Uint = new(map[uint8]uint) + } + + if false { + } else { + z.F.DecMapUint8UintX(x.FptrMapUint8Uint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint8Uint8 = nil + } else { + if false { + } else { + z.F.DecMapUint8Uint8X(&x.FMapUint8Uint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Uint8 != nil { + x.FptrMapUint8Uint8 = nil + } + } else { + if x.FptrMapUint8Uint8 == nil { + x.FptrMapUint8Uint8 = new(map[uint8]uint8) + } + + if false { + } else { + z.F.DecMapUint8Uint8X(x.FptrMapUint8Uint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint8Uint16 = nil + } else { + if false { + } else { + z.F.DecMapUint8Uint16X(&x.FMapUint8Uint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Uint16 != nil { + x.FptrMapUint8Uint16 = nil + } + } else { + if x.FptrMapUint8Uint16 == nil { + x.FptrMapUint8Uint16 = new(map[uint8]uint16) + } + + if false { + } else { + z.F.DecMapUint8Uint16X(x.FptrMapUint8Uint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint8Uint32 = nil + } else { + if false { + } else { + z.F.DecMapUint8Uint32X(&x.FMapUint8Uint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Uint32 != nil { + x.FptrMapUint8Uint32 = nil + } + } else { + if x.FptrMapUint8Uint32 == nil { + x.FptrMapUint8Uint32 = new(map[uint8]uint32) + } + + if false { + } else { + z.F.DecMapUint8Uint32X(x.FptrMapUint8Uint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint8Uint64 = nil + } else { + if false { + } else { + z.F.DecMapUint8Uint64X(&x.FMapUint8Uint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Uint64 != nil { + x.FptrMapUint8Uint64 = nil + } + } else { + if x.FptrMapUint8Uint64 == nil { + x.FptrMapUint8Uint64 = new(map[uint8]uint64) + } + + if false { + } else { + z.F.DecMapUint8Uint64X(x.FptrMapUint8Uint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint8Uintptr = nil + } else { + if false { + } else { + z.F.DecMapUint8UintptrX(&x.FMapUint8Uintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Uintptr != nil { + x.FptrMapUint8Uintptr = nil + } + } else { + if x.FptrMapUint8Uintptr == nil { + x.FptrMapUint8Uintptr = new(map[uint8]uintptr) + } + + if false { + } else { + z.F.DecMapUint8UintptrX(x.FptrMapUint8Uintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint8Int = nil + } else { + if false { + } else { + z.F.DecMapUint8IntX(&x.FMapUint8Int, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Int != nil { + x.FptrMapUint8Int = nil + } + } else { + if x.FptrMapUint8Int == nil { + x.FptrMapUint8Int = new(map[uint8]int) + } + + if false { + } else { + z.F.DecMapUint8IntX(x.FptrMapUint8Int, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint8Int8 = nil + } else { + if false { + } else { + z.F.DecMapUint8Int8X(&x.FMapUint8Int8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Int8 != nil { + x.FptrMapUint8Int8 = nil + } + } else { + if x.FptrMapUint8Int8 == nil { + x.FptrMapUint8Int8 = new(map[uint8]int8) + } + + if false { + } else { + z.F.DecMapUint8Int8X(x.FptrMapUint8Int8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint8Int16 = nil + } else { + if false { + } else { + z.F.DecMapUint8Int16X(&x.FMapUint8Int16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Int16 != nil { + x.FptrMapUint8Int16 = nil + } + } else { + if x.FptrMapUint8Int16 == nil { + x.FptrMapUint8Int16 = new(map[uint8]int16) + } + + if false { + } else { + z.F.DecMapUint8Int16X(x.FptrMapUint8Int16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint8Int32 = nil + } else { + if false { + } else { + z.F.DecMapUint8Int32X(&x.FMapUint8Int32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Int32 != nil { + x.FptrMapUint8Int32 = nil + } + } else { + if x.FptrMapUint8Int32 == nil { + x.FptrMapUint8Int32 = new(map[uint8]int32) + } + + if false { + } else { + z.F.DecMapUint8Int32X(x.FptrMapUint8Int32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint8Int64 = nil + } else { + if false { + } else { + z.F.DecMapUint8Int64X(&x.FMapUint8Int64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Int64 != nil { + x.FptrMapUint8Int64 = nil + } + } else { + if x.FptrMapUint8Int64 == nil { + x.FptrMapUint8Int64 = new(map[uint8]int64) + } + + if false { + } else { + z.F.DecMapUint8Int64X(x.FptrMapUint8Int64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint8Float32 = nil + } else { + if false { + } else { + z.F.DecMapUint8Float32X(&x.FMapUint8Float32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Float32 != nil { + x.FptrMapUint8Float32 = nil + } + } else { + if x.FptrMapUint8Float32 == nil { + x.FptrMapUint8Float32 = new(map[uint8]float32) + } + + if false { + } else { + z.F.DecMapUint8Float32X(x.FptrMapUint8Float32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint8Float64 = nil + } else { + if false { + } else { + z.F.DecMapUint8Float64X(&x.FMapUint8Float64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Float64 != nil { + x.FptrMapUint8Float64 = nil + } + } else { + if x.FptrMapUint8Float64 == nil { + x.FptrMapUint8Float64 = new(map[uint8]float64) + } + + if false { + } else { + z.F.DecMapUint8Float64X(x.FptrMapUint8Float64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint8Bool = nil + } else { + if false { + } else { + z.F.DecMapUint8BoolX(&x.FMapUint8Bool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint8Bool != nil { + x.FptrMapUint8Bool = nil + } + } else { + if x.FptrMapUint8Bool == nil { + x.FptrMapUint8Bool = new(map[uint8]bool) + } + + if false { + } else { + z.F.DecMapUint8BoolX(x.FptrMapUint8Bool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint16Intf = nil + } else { + if false { + } else { + z.F.DecMapUint16IntfX(&x.FMapUint16Intf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Intf != nil { + x.FptrMapUint16Intf = nil + } + } else { + if x.FptrMapUint16Intf == nil { + x.FptrMapUint16Intf = new(map[uint16]interface{}) + } + + if false { + } else { + z.F.DecMapUint16IntfX(x.FptrMapUint16Intf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint16String = nil + } else { + if false { + } else { + z.F.DecMapUint16StringX(&x.FMapUint16String, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16String != nil { + x.FptrMapUint16String = nil + } + } else { + if x.FptrMapUint16String == nil { + x.FptrMapUint16String = new(map[uint16]string) + } + + if false { + } else { + z.F.DecMapUint16StringX(x.FptrMapUint16String, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint16Uint = nil + } else { + if false { + } else { + z.F.DecMapUint16UintX(&x.FMapUint16Uint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Uint != nil { + x.FptrMapUint16Uint = nil + } + } else { + if x.FptrMapUint16Uint == nil { + x.FptrMapUint16Uint = new(map[uint16]uint) + } + + if false { + } else { + z.F.DecMapUint16UintX(x.FptrMapUint16Uint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint16Uint8 = nil + } else { + if false { + } else { + z.F.DecMapUint16Uint8X(&x.FMapUint16Uint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Uint8 != nil { + x.FptrMapUint16Uint8 = nil + } + } else { + if x.FptrMapUint16Uint8 == nil { + x.FptrMapUint16Uint8 = new(map[uint16]uint8) + } + + if false { + } else { + z.F.DecMapUint16Uint8X(x.FptrMapUint16Uint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint16Uint16 = nil + } else { + if false { + } else { + z.F.DecMapUint16Uint16X(&x.FMapUint16Uint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Uint16 != nil { + x.FptrMapUint16Uint16 = nil + } + } else { + if x.FptrMapUint16Uint16 == nil { + x.FptrMapUint16Uint16 = new(map[uint16]uint16) + } + + if false { + } else { + z.F.DecMapUint16Uint16X(x.FptrMapUint16Uint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint16Uint32 = nil + } else { + if false { + } else { + z.F.DecMapUint16Uint32X(&x.FMapUint16Uint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Uint32 != nil { + x.FptrMapUint16Uint32 = nil + } + } else { + if x.FptrMapUint16Uint32 == nil { + x.FptrMapUint16Uint32 = new(map[uint16]uint32) + } + + if false { + } else { + z.F.DecMapUint16Uint32X(x.FptrMapUint16Uint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint16Uint64 = nil + } else { + if false { + } else { + z.F.DecMapUint16Uint64X(&x.FMapUint16Uint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Uint64 != nil { + x.FptrMapUint16Uint64 = nil + } + } else { + if x.FptrMapUint16Uint64 == nil { + x.FptrMapUint16Uint64 = new(map[uint16]uint64) + } + + if false { + } else { + z.F.DecMapUint16Uint64X(x.FptrMapUint16Uint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint16Uintptr = nil + } else { + if false { + } else { + z.F.DecMapUint16UintptrX(&x.FMapUint16Uintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Uintptr != nil { + x.FptrMapUint16Uintptr = nil + } + } else { + if x.FptrMapUint16Uintptr == nil { + x.FptrMapUint16Uintptr = new(map[uint16]uintptr) + } + + if false { + } else { + z.F.DecMapUint16UintptrX(x.FptrMapUint16Uintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint16Int = nil + } else { + if false { + } else { + z.F.DecMapUint16IntX(&x.FMapUint16Int, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Int != nil { + x.FptrMapUint16Int = nil + } + } else { + if x.FptrMapUint16Int == nil { + x.FptrMapUint16Int = new(map[uint16]int) + } + + if false { + } else { + z.F.DecMapUint16IntX(x.FptrMapUint16Int, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint16Int8 = nil + } else { + if false { + } else { + z.F.DecMapUint16Int8X(&x.FMapUint16Int8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Int8 != nil { + x.FptrMapUint16Int8 = nil + } + } else { + if x.FptrMapUint16Int8 == nil { + x.FptrMapUint16Int8 = new(map[uint16]int8) + } + + if false { + } else { + z.F.DecMapUint16Int8X(x.FptrMapUint16Int8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint16Int16 = nil + } else { + if false { + } else { + z.F.DecMapUint16Int16X(&x.FMapUint16Int16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Int16 != nil { + x.FptrMapUint16Int16 = nil + } + } else { + if x.FptrMapUint16Int16 == nil { + x.FptrMapUint16Int16 = new(map[uint16]int16) + } + + if false { + } else { + z.F.DecMapUint16Int16X(x.FptrMapUint16Int16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint16Int32 = nil + } else { + if false { + } else { + z.F.DecMapUint16Int32X(&x.FMapUint16Int32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Int32 != nil { + x.FptrMapUint16Int32 = nil + } + } else { + if x.FptrMapUint16Int32 == nil { + x.FptrMapUint16Int32 = new(map[uint16]int32) + } + + if false { + } else { + z.F.DecMapUint16Int32X(x.FptrMapUint16Int32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint16Int64 = nil + } else { + if false { + } else { + z.F.DecMapUint16Int64X(&x.FMapUint16Int64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Int64 != nil { + x.FptrMapUint16Int64 = nil + } + } else { + if x.FptrMapUint16Int64 == nil { + x.FptrMapUint16Int64 = new(map[uint16]int64) + } + + if false { + } else { + z.F.DecMapUint16Int64X(x.FptrMapUint16Int64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint16Float32 = nil + } else { + if false { + } else { + z.F.DecMapUint16Float32X(&x.FMapUint16Float32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Float32 != nil { + x.FptrMapUint16Float32 = nil + } + } else { + if x.FptrMapUint16Float32 == nil { + x.FptrMapUint16Float32 = new(map[uint16]float32) + } + + if false { + } else { + z.F.DecMapUint16Float32X(x.FptrMapUint16Float32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint16Float64 = nil + } else { + if false { + } else { + z.F.DecMapUint16Float64X(&x.FMapUint16Float64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Float64 != nil { + x.FptrMapUint16Float64 = nil + } + } else { + if x.FptrMapUint16Float64 == nil { + x.FptrMapUint16Float64 = new(map[uint16]float64) + } + + if false { + } else { + z.F.DecMapUint16Float64X(x.FptrMapUint16Float64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint16Bool = nil + } else { + if false { + } else { + z.F.DecMapUint16BoolX(&x.FMapUint16Bool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint16Bool != nil { + x.FptrMapUint16Bool = nil + } + } else { + if x.FptrMapUint16Bool == nil { + x.FptrMapUint16Bool = new(map[uint16]bool) + } + + if false { + } else { + z.F.DecMapUint16BoolX(x.FptrMapUint16Bool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint32Intf = nil + } else { + if false { + } else { + z.F.DecMapUint32IntfX(&x.FMapUint32Intf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Intf != nil { + x.FptrMapUint32Intf = nil + } + } else { + if x.FptrMapUint32Intf == nil { + x.FptrMapUint32Intf = new(map[uint32]interface{}) + } + + if false { + } else { + z.F.DecMapUint32IntfX(x.FptrMapUint32Intf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint32String = nil + } else { + if false { + } else { + z.F.DecMapUint32StringX(&x.FMapUint32String, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32String != nil { + x.FptrMapUint32String = nil + } + } else { + if x.FptrMapUint32String == nil { + x.FptrMapUint32String = new(map[uint32]string) + } + + if false { + } else { + z.F.DecMapUint32StringX(x.FptrMapUint32String, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint32Uint = nil + } else { + if false { + } else { + z.F.DecMapUint32UintX(&x.FMapUint32Uint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Uint != nil { + x.FptrMapUint32Uint = nil + } + } else { + if x.FptrMapUint32Uint == nil { + x.FptrMapUint32Uint = new(map[uint32]uint) + } + + if false { + } else { + z.F.DecMapUint32UintX(x.FptrMapUint32Uint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint32Uint8 = nil + } else { + if false { + } else { + z.F.DecMapUint32Uint8X(&x.FMapUint32Uint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Uint8 != nil { + x.FptrMapUint32Uint8 = nil + } + } else { + if x.FptrMapUint32Uint8 == nil { + x.FptrMapUint32Uint8 = new(map[uint32]uint8) + } + + if false { + } else { + z.F.DecMapUint32Uint8X(x.FptrMapUint32Uint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint32Uint16 = nil + } else { + if false { + } else { + z.F.DecMapUint32Uint16X(&x.FMapUint32Uint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Uint16 != nil { + x.FptrMapUint32Uint16 = nil + } + } else { + if x.FptrMapUint32Uint16 == nil { + x.FptrMapUint32Uint16 = new(map[uint32]uint16) + } + + if false { + } else { + z.F.DecMapUint32Uint16X(x.FptrMapUint32Uint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint32Uint32 = nil + } else { + if false { + } else { + z.F.DecMapUint32Uint32X(&x.FMapUint32Uint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Uint32 != nil { + x.FptrMapUint32Uint32 = nil + } + } else { + if x.FptrMapUint32Uint32 == nil { + x.FptrMapUint32Uint32 = new(map[uint32]uint32) + } + + if false { + } else { + z.F.DecMapUint32Uint32X(x.FptrMapUint32Uint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint32Uint64 = nil + } else { + if false { + } else { + z.F.DecMapUint32Uint64X(&x.FMapUint32Uint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Uint64 != nil { + x.FptrMapUint32Uint64 = nil + } + } else { + if x.FptrMapUint32Uint64 == nil { + x.FptrMapUint32Uint64 = new(map[uint32]uint64) + } + + if false { + } else { + z.F.DecMapUint32Uint64X(x.FptrMapUint32Uint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint32Uintptr = nil + } else { + if false { + } else { + z.F.DecMapUint32UintptrX(&x.FMapUint32Uintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Uintptr != nil { + x.FptrMapUint32Uintptr = nil + } + } else { + if x.FptrMapUint32Uintptr == nil { + x.FptrMapUint32Uintptr = new(map[uint32]uintptr) + } + + if false { + } else { + z.F.DecMapUint32UintptrX(x.FptrMapUint32Uintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint32Int = nil + } else { + if false { + } else { + z.F.DecMapUint32IntX(&x.FMapUint32Int, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Int != nil { + x.FptrMapUint32Int = nil + } + } else { + if x.FptrMapUint32Int == nil { + x.FptrMapUint32Int = new(map[uint32]int) + } + + if false { + } else { + z.F.DecMapUint32IntX(x.FptrMapUint32Int, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint32Int8 = nil + } else { + if false { + } else { + z.F.DecMapUint32Int8X(&x.FMapUint32Int8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Int8 != nil { + x.FptrMapUint32Int8 = nil + } + } else { + if x.FptrMapUint32Int8 == nil { + x.FptrMapUint32Int8 = new(map[uint32]int8) + } + + if false { + } else { + z.F.DecMapUint32Int8X(x.FptrMapUint32Int8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint32Int16 = nil + } else { + if false { + } else { + z.F.DecMapUint32Int16X(&x.FMapUint32Int16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Int16 != nil { + x.FptrMapUint32Int16 = nil + } + } else { + if x.FptrMapUint32Int16 == nil { + x.FptrMapUint32Int16 = new(map[uint32]int16) + } + + if false { + } else { + z.F.DecMapUint32Int16X(x.FptrMapUint32Int16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint32Int32 = nil + } else { + if false { + } else { + z.F.DecMapUint32Int32X(&x.FMapUint32Int32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Int32 != nil { + x.FptrMapUint32Int32 = nil + } + } else { + if x.FptrMapUint32Int32 == nil { + x.FptrMapUint32Int32 = new(map[uint32]int32) + } + + if false { + } else { + z.F.DecMapUint32Int32X(x.FptrMapUint32Int32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint32Int64 = nil + } else { + if false { + } else { + z.F.DecMapUint32Int64X(&x.FMapUint32Int64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Int64 != nil { + x.FptrMapUint32Int64 = nil + } + } else { + if x.FptrMapUint32Int64 == nil { + x.FptrMapUint32Int64 = new(map[uint32]int64) + } + + if false { + } else { + z.F.DecMapUint32Int64X(x.FptrMapUint32Int64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint32Float32 = nil + } else { + if false { + } else { + z.F.DecMapUint32Float32X(&x.FMapUint32Float32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Float32 != nil { + x.FptrMapUint32Float32 = nil + } + } else { + if x.FptrMapUint32Float32 == nil { + x.FptrMapUint32Float32 = new(map[uint32]float32) + } + + if false { + } else { + z.F.DecMapUint32Float32X(x.FptrMapUint32Float32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint32Float64 = nil + } else { + if false { + } else { + z.F.DecMapUint32Float64X(&x.FMapUint32Float64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Float64 != nil { + x.FptrMapUint32Float64 = nil + } + } else { + if x.FptrMapUint32Float64 == nil { + x.FptrMapUint32Float64 = new(map[uint32]float64) + } + + if false { + } else { + z.F.DecMapUint32Float64X(x.FptrMapUint32Float64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint32Bool = nil + } else { + if false { + } else { + z.F.DecMapUint32BoolX(&x.FMapUint32Bool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint32Bool != nil { + x.FptrMapUint32Bool = nil + } + } else { + if x.FptrMapUint32Bool == nil { + x.FptrMapUint32Bool = new(map[uint32]bool) + } + + if false { + } else { + z.F.DecMapUint32BoolX(x.FptrMapUint32Bool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint64Intf = nil + } else { + if false { + } else { + z.F.DecMapUint64IntfX(&x.FMapUint64Intf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Intf != nil { + x.FptrMapUint64Intf = nil + } + } else { + if x.FptrMapUint64Intf == nil { + x.FptrMapUint64Intf = new(map[uint64]interface{}) + } + + if false { + } else { + z.F.DecMapUint64IntfX(x.FptrMapUint64Intf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint64String = nil + } else { + if false { + } else { + z.F.DecMapUint64StringX(&x.FMapUint64String, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64String != nil { + x.FptrMapUint64String = nil + } + } else { + if x.FptrMapUint64String == nil { + x.FptrMapUint64String = new(map[uint64]string) + } + + if false { + } else { + z.F.DecMapUint64StringX(x.FptrMapUint64String, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint64Uint = nil + } else { + if false { + } else { + z.F.DecMapUint64UintX(&x.FMapUint64Uint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Uint != nil { + x.FptrMapUint64Uint = nil + } + } else { + if x.FptrMapUint64Uint == nil { + x.FptrMapUint64Uint = new(map[uint64]uint) + } + + if false { + } else { + z.F.DecMapUint64UintX(x.FptrMapUint64Uint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint64Uint8 = nil + } else { + if false { + } else { + z.F.DecMapUint64Uint8X(&x.FMapUint64Uint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Uint8 != nil { + x.FptrMapUint64Uint8 = nil + } + } else { + if x.FptrMapUint64Uint8 == nil { + x.FptrMapUint64Uint8 = new(map[uint64]uint8) + } + + if false { + } else { + z.F.DecMapUint64Uint8X(x.FptrMapUint64Uint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint64Uint16 = nil + } else { + if false { + } else { + z.F.DecMapUint64Uint16X(&x.FMapUint64Uint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Uint16 != nil { + x.FptrMapUint64Uint16 = nil + } + } else { + if x.FptrMapUint64Uint16 == nil { + x.FptrMapUint64Uint16 = new(map[uint64]uint16) + } + + if false { + } else { + z.F.DecMapUint64Uint16X(x.FptrMapUint64Uint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint64Uint32 = nil + } else { + if false { + } else { + z.F.DecMapUint64Uint32X(&x.FMapUint64Uint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Uint32 != nil { + x.FptrMapUint64Uint32 = nil + } + } else { + if x.FptrMapUint64Uint32 == nil { + x.FptrMapUint64Uint32 = new(map[uint64]uint32) + } + + if false { + } else { + z.F.DecMapUint64Uint32X(x.FptrMapUint64Uint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint64Uint64 = nil + } else { + if false { + } else { + z.F.DecMapUint64Uint64X(&x.FMapUint64Uint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Uint64 != nil { + x.FptrMapUint64Uint64 = nil + } + } else { + if x.FptrMapUint64Uint64 == nil { + x.FptrMapUint64Uint64 = new(map[uint64]uint64) + } + + if false { + } else { + z.F.DecMapUint64Uint64X(x.FptrMapUint64Uint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint64Uintptr = nil + } else { + if false { + } else { + z.F.DecMapUint64UintptrX(&x.FMapUint64Uintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Uintptr != nil { + x.FptrMapUint64Uintptr = nil + } + } else { + if x.FptrMapUint64Uintptr == nil { + x.FptrMapUint64Uintptr = new(map[uint64]uintptr) + } + + if false { + } else { + z.F.DecMapUint64UintptrX(x.FptrMapUint64Uintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint64Int = nil + } else { + if false { + } else { + z.F.DecMapUint64IntX(&x.FMapUint64Int, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Int != nil { + x.FptrMapUint64Int = nil + } + } else { + if x.FptrMapUint64Int == nil { + x.FptrMapUint64Int = new(map[uint64]int) + } + + if false { + } else { + z.F.DecMapUint64IntX(x.FptrMapUint64Int, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint64Int8 = nil + } else { + if false { + } else { + z.F.DecMapUint64Int8X(&x.FMapUint64Int8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Int8 != nil { + x.FptrMapUint64Int8 = nil + } + } else { + if x.FptrMapUint64Int8 == nil { + x.FptrMapUint64Int8 = new(map[uint64]int8) + } + + if false { + } else { + z.F.DecMapUint64Int8X(x.FptrMapUint64Int8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint64Int16 = nil + } else { + if false { + } else { + z.F.DecMapUint64Int16X(&x.FMapUint64Int16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Int16 != nil { + x.FptrMapUint64Int16 = nil + } + } else { + if x.FptrMapUint64Int16 == nil { + x.FptrMapUint64Int16 = new(map[uint64]int16) + } + + if false { + } else { + z.F.DecMapUint64Int16X(x.FptrMapUint64Int16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint64Int32 = nil + } else { + if false { + } else { + z.F.DecMapUint64Int32X(&x.FMapUint64Int32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Int32 != nil { + x.FptrMapUint64Int32 = nil + } + } else { + if x.FptrMapUint64Int32 == nil { + x.FptrMapUint64Int32 = new(map[uint64]int32) + } + + if false { + } else { + z.F.DecMapUint64Int32X(x.FptrMapUint64Int32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint64Int64 = nil + } else { + if false { + } else { + z.F.DecMapUint64Int64X(&x.FMapUint64Int64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Int64 != nil { + x.FptrMapUint64Int64 = nil + } + } else { + if x.FptrMapUint64Int64 == nil { + x.FptrMapUint64Int64 = new(map[uint64]int64) + } + + if false { + } else { + z.F.DecMapUint64Int64X(x.FptrMapUint64Int64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint64Float32 = nil + } else { + if false { + } else { + z.F.DecMapUint64Float32X(&x.FMapUint64Float32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Float32 != nil { + x.FptrMapUint64Float32 = nil + } + } else { + if x.FptrMapUint64Float32 == nil { + x.FptrMapUint64Float32 = new(map[uint64]float32) + } + + if false { + } else { + z.F.DecMapUint64Float32X(x.FptrMapUint64Float32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint64Float64 = nil + } else { + if false { + } else { + z.F.DecMapUint64Float64X(&x.FMapUint64Float64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Float64 != nil { + x.FptrMapUint64Float64 = nil + } + } else { + if x.FptrMapUint64Float64 == nil { + x.FptrMapUint64Float64 = new(map[uint64]float64) + } + + if false { + } else { + z.F.DecMapUint64Float64X(x.FptrMapUint64Float64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUint64Bool = nil + } else { + if false { + } else { + z.F.DecMapUint64BoolX(&x.FMapUint64Bool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUint64Bool != nil { + x.FptrMapUint64Bool = nil + } + } else { + if x.FptrMapUint64Bool == nil { + x.FptrMapUint64Bool = new(map[uint64]bool) + } + + if false { + } else { + z.F.DecMapUint64BoolX(x.FptrMapUint64Bool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintptrIntf = nil + } else { + if false { + } else { + z.F.DecMapUintptrIntfX(&x.FMapUintptrIntf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrIntf != nil { + x.FptrMapUintptrIntf = nil + } + } else { + if x.FptrMapUintptrIntf == nil { + x.FptrMapUintptrIntf = new(map[uintptr]interface{}) + } + + if false { + } else { + z.F.DecMapUintptrIntfX(x.FptrMapUintptrIntf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintptrString = nil + } else { + if false { + } else { + z.F.DecMapUintptrStringX(&x.FMapUintptrString, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrString != nil { + x.FptrMapUintptrString = nil + } + } else { + if x.FptrMapUintptrString == nil { + x.FptrMapUintptrString = new(map[uintptr]string) + } + + if false { + } else { + z.F.DecMapUintptrStringX(x.FptrMapUintptrString, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintptrUint = nil + } else { + if false { + } else { + z.F.DecMapUintptrUintX(&x.FMapUintptrUint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrUint != nil { + x.FptrMapUintptrUint = nil + } + } else { + if x.FptrMapUintptrUint == nil { + x.FptrMapUintptrUint = new(map[uintptr]uint) + } + + if false { + } else { + z.F.DecMapUintptrUintX(x.FptrMapUintptrUint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintptrUint8 = nil + } else { + if false { + } else { + z.F.DecMapUintptrUint8X(&x.FMapUintptrUint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrUint8 != nil { + x.FptrMapUintptrUint8 = nil + } + } else { + if x.FptrMapUintptrUint8 == nil { + x.FptrMapUintptrUint8 = new(map[uintptr]uint8) + } + + if false { + } else { + z.F.DecMapUintptrUint8X(x.FptrMapUintptrUint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintptrUint16 = nil + } else { + if false { + } else { + z.F.DecMapUintptrUint16X(&x.FMapUintptrUint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrUint16 != nil { + x.FptrMapUintptrUint16 = nil + } + } else { + if x.FptrMapUintptrUint16 == nil { + x.FptrMapUintptrUint16 = new(map[uintptr]uint16) + } + + if false { + } else { + z.F.DecMapUintptrUint16X(x.FptrMapUintptrUint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintptrUint32 = nil + } else { + if false { + } else { + z.F.DecMapUintptrUint32X(&x.FMapUintptrUint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrUint32 != nil { + x.FptrMapUintptrUint32 = nil + } + } else { + if x.FptrMapUintptrUint32 == nil { + x.FptrMapUintptrUint32 = new(map[uintptr]uint32) + } + + if false { + } else { + z.F.DecMapUintptrUint32X(x.FptrMapUintptrUint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintptrUint64 = nil + } else { + if false { + } else { + z.F.DecMapUintptrUint64X(&x.FMapUintptrUint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrUint64 != nil { + x.FptrMapUintptrUint64 = nil + } + } else { + if x.FptrMapUintptrUint64 == nil { + x.FptrMapUintptrUint64 = new(map[uintptr]uint64) + } + + if false { + } else { + z.F.DecMapUintptrUint64X(x.FptrMapUintptrUint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintptrUintptr = nil + } else { + if false { + } else { + z.F.DecMapUintptrUintptrX(&x.FMapUintptrUintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrUintptr != nil { + x.FptrMapUintptrUintptr = nil + } + } else { + if x.FptrMapUintptrUintptr == nil { + x.FptrMapUintptrUintptr = new(map[uintptr]uintptr) + } + + if false { + } else { + z.F.DecMapUintptrUintptrX(x.FptrMapUintptrUintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintptrInt = nil + } else { + if false { + } else { + z.F.DecMapUintptrIntX(&x.FMapUintptrInt, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrInt != nil { + x.FptrMapUintptrInt = nil + } + } else { + if x.FptrMapUintptrInt == nil { + x.FptrMapUintptrInt = new(map[uintptr]int) + } + + if false { + } else { + z.F.DecMapUintptrIntX(x.FptrMapUintptrInt, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintptrInt8 = nil + } else { + if false { + } else { + z.F.DecMapUintptrInt8X(&x.FMapUintptrInt8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrInt8 != nil { + x.FptrMapUintptrInt8 = nil + } + } else { + if x.FptrMapUintptrInt8 == nil { + x.FptrMapUintptrInt8 = new(map[uintptr]int8) + } + + if false { + } else { + z.F.DecMapUintptrInt8X(x.FptrMapUintptrInt8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintptrInt16 = nil + } else { + if false { + } else { + z.F.DecMapUintptrInt16X(&x.FMapUintptrInt16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrInt16 != nil { + x.FptrMapUintptrInt16 = nil + } + } else { + if x.FptrMapUintptrInt16 == nil { + x.FptrMapUintptrInt16 = new(map[uintptr]int16) + } + + if false { + } else { + z.F.DecMapUintptrInt16X(x.FptrMapUintptrInt16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintptrInt32 = nil + } else { + if false { + } else { + z.F.DecMapUintptrInt32X(&x.FMapUintptrInt32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrInt32 != nil { + x.FptrMapUintptrInt32 = nil + } + } else { + if x.FptrMapUintptrInt32 == nil { + x.FptrMapUintptrInt32 = new(map[uintptr]int32) + } + + if false { + } else { + z.F.DecMapUintptrInt32X(x.FptrMapUintptrInt32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintptrInt64 = nil + } else { + if false { + } else { + z.F.DecMapUintptrInt64X(&x.FMapUintptrInt64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrInt64 != nil { + x.FptrMapUintptrInt64 = nil + } + } else { + if x.FptrMapUintptrInt64 == nil { + x.FptrMapUintptrInt64 = new(map[uintptr]int64) + } + + if false { + } else { + z.F.DecMapUintptrInt64X(x.FptrMapUintptrInt64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintptrFloat32 = nil + } else { + if false { + } else { + z.F.DecMapUintptrFloat32X(&x.FMapUintptrFloat32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrFloat32 != nil { + x.FptrMapUintptrFloat32 = nil + } + } else { + if x.FptrMapUintptrFloat32 == nil { + x.FptrMapUintptrFloat32 = new(map[uintptr]float32) + } + + if false { + } else { + z.F.DecMapUintptrFloat32X(x.FptrMapUintptrFloat32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintptrFloat64 = nil + } else { + if false { + } else { + z.F.DecMapUintptrFloat64X(&x.FMapUintptrFloat64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrFloat64 != nil { + x.FptrMapUintptrFloat64 = nil + } + } else { + if x.FptrMapUintptrFloat64 == nil { + x.FptrMapUintptrFloat64 = new(map[uintptr]float64) + } + + if false { + } else { + z.F.DecMapUintptrFloat64X(x.FptrMapUintptrFloat64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapUintptrBool = nil + } else { + if false { + } else { + z.F.DecMapUintptrBoolX(&x.FMapUintptrBool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapUintptrBool != nil { + x.FptrMapUintptrBool = nil + } + } else { + if x.FptrMapUintptrBool == nil { + x.FptrMapUintptrBool = new(map[uintptr]bool) + } + + if false { + } else { + z.F.DecMapUintptrBoolX(x.FptrMapUintptrBool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntIntf = nil + } else { + if false { + } else { + z.F.DecMapIntIntfX(&x.FMapIntIntf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntIntf != nil { + x.FptrMapIntIntf = nil + } + } else { + if x.FptrMapIntIntf == nil { + x.FptrMapIntIntf = new(map[int]interface{}) + } + + if false { + } else { + z.F.DecMapIntIntfX(x.FptrMapIntIntf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntString = nil + } else { + if false { + } else { + z.F.DecMapIntStringX(&x.FMapIntString, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntString != nil { + x.FptrMapIntString = nil + } + } else { + if x.FptrMapIntString == nil { + x.FptrMapIntString = new(map[int]string) + } + + if false { + } else { + z.F.DecMapIntStringX(x.FptrMapIntString, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntUint = nil + } else { + if false { + } else { + z.F.DecMapIntUintX(&x.FMapIntUint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntUint != nil { + x.FptrMapIntUint = nil + } + } else { + if x.FptrMapIntUint == nil { + x.FptrMapIntUint = new(map[int]uint) + } + + if false { + } else { + z.F.DecMapIntUintX(x.FptrMapIntUint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntUint8 = nil + } else { + if false { + } else { + z.F.DecMapIntUint8X(&x.FMapIntUint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntUint8 != nil { + x.FptrMapIntUint8 = nil + } + } else { + if x.FptrMapIntUint8 == nil { + x.FptrMapIntUint8 = new(map[int]uint8) + } + + if false { + } else { + z.F.DecMapIntUint8X(x.FptrMapIntUint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntUint16 = nil + } else { + if false { + } else { + z.F.DecMapIntUint16X(&x.FMapIntUint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntUint16 != nil { + x.FptrMapIntUint16 = nil + } + } else { + if x.FptrMapIntUint16 == nil { + x.FptrMapIntUint16 = new(map[int]uint16) + } + + if false { + } else { + z.F.DecMapIntUint16X(x.FptrMapIntUint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntUint32 = nil + } else { + if false { + } else { + z.F.DecMapIntUint32X(&x.FMapIntUint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntUint32 != nil { + x.FptrMapIntUint32 = nil + } + } else { + if x.FptrMapIntUint32 == nil { + x.FptrMapIntUint32 = new(map[int]uint32) + } + + if false { + } else { + z.F.DecMapIntUint32X(x.FptrMapIntUint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntUint64 = nil + } else { + if false { + } else { + z.F.DecMapIntUint64X(&x.FMapIntUint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntUint64 != nil { + x.FptrMapIntUint64 = nil + } + } else { + if x.FptrMapIntUint64 == nil { + x.FptrMapIntUint64 = new(map[int]uint64) + } + + if false { + } else { + z.F.DecMapIntUint64X(x.FptrMapIntUint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntUintptr = nil + } else { + if false { + } else { + z.F.DecMapIntUintptrX(&x.FMapIntUintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntUintptr != nil { + x.FptrMapIntUintptr = nil + } + } else { + if x.FptrMapIntUintptr == nil { + x.FptrMapIntUintptr = new(map[int]uintptr) + } + + if false { + } else { + z.F.DecMapIntUintptrX(x.FptrMapIntUintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntInt = nil + } else { + if false { + } else { + z.F.DecMapIntIntX(&x.FMapIntInt, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntInt != nil { + x.FptrMapIntInt = nil + } + } else { + if x.FptrMapIntInt == nil { + x.FptrMapIntInt = new(map[int]int) + } + + if false { + } else { + z.F.DecMapIntIntX(x.FptrMapIntInt, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntInt8 = nil + } else { + if false { + } else { + z.F.DecMapIntInt8X(&x.FMapIntInt8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntInt8 != nil { + x.FptrMapIntInt8 = nil + } + } else { + if x.FptrMapIntInt8 == nil { + x.FptrMapIntInt8 = new(map[int]int8) + } + + if false { + } else { + z.F.DecMapIntInt8X(x.FptrMapIntInt8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntInt16 = nil + } else { + if false { + } else { + z.F.DecMapIntInt16X(&x.FMapIntInt16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntInt16 != nil { + x.FptrMapIntInt16 = nil + } + } else { + if x.FptrMapIntInt16 == nil { + x.FptrMapIntInt16 = new(map[int]int16) + } + + if false { + } else { + z.F.DecMapIntInt16X(x.FptrMapIntInt16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntInt32 = nil + } else { + if false { + } else { + z.F.DecMapIntInt32X(&x.FMapIntInt32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntInt32 != nil { + x.FptrMapIntInt32 = nil + } + } else { + if x.FptrMapIntInt32 == nil { + x.FptrMapIntInt32 = new(map[int]int32) + } + + if false { + } else { + z.F.DecMapIntInt32X(x.FptrMapIntInt32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntInt64 = nil + } else { + if false { + } else { + z.F.DecMapIntInt64X(&x.FMapIntInt64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntInt64 != nil { + x.FptrMapIntInt64 = nil + } + } else { + if x.FptrMapIntInt64 == nil { + x.FptrMapIntInt64 = new(map[int]int64) + } + + if false { + } else { + z.F.DecMapIntInt64X(x.FptrMapIntInt64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntFloat32 = nil + } else { + if false { + } else { + z.F.DecMapIntFloat32X(&x.FMapIntFloat32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntFloat32 != nil { + x.FptrMapIntFloat32 = nil + } + } else { + if x.FptrMapIntFloat32 == nil { + x.FptrMapIntFloat32 = new(map[int]float32) + } + + if false { + } else { + z.F.DecMapIntFloat32X(x.FptrMapIntFloat32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntFloat64 = nil + } else { + if false { + } else { + z.F.DecMapIntFloat64X(&x.FMapIntFloat64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntFloat64 != nil { + x.FptrMapIntFloat64 = nil + } + } else { + if x.FptrMapIntFloat64 == nil { + x.FptrMapIntFloat64 = new(map[int]float64) + } + + if false { + } else { + z.F.DecMapIntFloat64X(x.FptrMapIntFloat64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapIntBool = nil + } else { + if false { + } else { + z.F.DecMapIntBoolX(&x.FMapIntBool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapIntBool != nil { + x.FptrMapIntBool = nil + } + } else { + if x.FptrMapIntBool == nil { + x.FptrMapIntBool = new(map[int]bool) + } + + if false { + } else { + z.F.DecMapIntBoolX(x.FptrMapIntBool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt8Intf = nil + } else { + if false { + } else { + z.F.DecMapInt8IntfX(&x.FMapInt8Intf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Intf != nil { + x.FptrMapInt8Intf = nil + } + } else { + if x.FptrMapInt8Intf == nil { + x.FptrMapInt8Intf = new(map[int8]interface{}) + } + + if false { + } else { + z.F.DecMapInt8IntfX(x.FptrMapInt8Intf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt8String = nil + } else { + if false { + } else { + z.F.DecMapInt8StringX(&x.FMapInt8String, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8String != nil { + x.FptrMapInt8String = nil + } + } else { + if x.FptrMapInt8String == nil { + x.FptrMapInt8String = new(map[int8]string) + } + + if false { + } else { + z.F.DecMapInt8StringX(x.FptrMapInt8String, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt8Uint = nil + } else { + if false { + } else { + z.F.DecMapInt8UintX(&x.FMapInt8Uint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Uint != nil { + x.FptrMapInt8Uint = nil + } + } else { + if x.FptrMapInt8Uint == nil { + x.FptrMapInt8Uint = new(map[int8]uint) + } + + if false { + } else { + z.F.DecMapInt8UintX(x.FptrMapInt8Uint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt8Uint8 = nil + } else { + if false { + } else { + z.F.DecMapInt8Uint8X(&x.FMapInt8Uint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Uint8 != nil { + x.FptrMapInt8Uint8 = nil + } + } else { + if x.FptrMapInt8Uint8 == nil { + x.FptrMapInt8Uint8 = new(map[int8]uint8) + } + + if false { + } else { + z.F.DecMapInt8Uint8X(x.FptrMapInt8Uint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt8Uint16 = nil + } else { + if false { + } else { + z.F.DecMapInt8Uint16X(&x.FMapInt8Uint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Uint16 != nil { + x.FptrMapInt8Uint16 = nil + } + } else { + if x.FptrMapInt8Uint16 == nil { + x.FptrMapInt8Uint16 = new(map[int8]uint16) + } + + if false { + } else { + z.F.DecMapInt8Uint16X(x.FptrMapInt8Uint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt8Uint32 = nil + } else { + if false { + } else { + z.F.DecMapInt8Uint32X(&x.FMapInt8Uint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Uint32 != nil { + x.FptrMapInt8Uint32 = nil + } + } else { + if x.FptrMapInt8Uint32 == nil { + x.FptrMapInt8Uint32 = new(map[int8]uint32) + } + + if false { + } else { + z.F.DecMapInt8Uint32X(x.FptrMapInt8Uint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt8Uint64 = nil + } else { + if false { + } else { + z.F.DecMapInt8Uint64X(&x.FMapInt8Uint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Uint64 != nil { + x.FptrMapInt8Uint64 = nil + } + } else { + if x.FptrMapInt8Uint64 == nil { + x.FptrMapInt8Uint64 = new(map[int8]uint64) + } + + if false { + } else { + z.F.DecMapInt8Uint64X(x.FptrMapInt8Uint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt8Uintptr = nil + } else { + if false { + } else { + z.F.DecMapInt8UintptrX(&x.FMapInt8Uintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Uintptr != nil { + x.FptrMapInt8Uintptr = nil + } + } else { + if x.FptrMapInt8Uintptr == nil { + x.FptrMapInt8Uintptr = new(map[int8]uintptr) + } + + if false { + } else { + z.F.DecMapInt8UintptrX(x.FptrMapInt8Uintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt8Int = nil + } else { + if false { + } else { + z.F.DecMapInt8IntX(&x.FMapInt8Int, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Int != nil { + x.FptrMapInt8Int = nil + } + } else { + if x.FptrMapInt8Int == nil { + x.FptrMapInt8Int = new(map[int8]int) + } + + if false { + } else { + z.F.DecMapInt8IntX(x.FptrMapInt8Int, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt8Int8 = nil + } else { + if false { + } else { + z.F.DecMapInt8Int8X(&x.FMapInt8Int8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Int8 != nil { + x.FptrMapInt8Int8 = nil + } + } else { + if x.FptrMapInt8Int8 == nil { + x.FptrMapInt8Int8 = new(map[int8]int8) + } + + if false { + } else { + z.F.DecMapInt8Int8X(x.FptrMapInt8Int8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt8Int16 = nil + } else { + if false { + } else { + z.F.DecMapInt8Int16X(&x.FMapInt8Int16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Int16 != nil { + x.FptrMapInt8Int16 = nil + } + } else { + if x.FptrMapInt8Int16 == nil { + x.FptrMapInt8Int16 = new(map[int8]int16) + } + + if false { + } else { + z.F.DecMapInt8Int16X(x.FptrMapInt8Int16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt8Int32 = nil + } else { + if false { + } else { + z.F.DecMapInt8Int32X(&x.FMapInt8Int32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Int32 != nil { + x.FptrMapInt8Int32 = nil + } + } else { + if x.FptrMapInt8Int32 == nil { + x.FptrMapInt8Int32 = new(map[int8]int32) + } + + if false { + } else { + z.F.DecMapInt8Int32X(x.FptrMapInt8Int32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt8Int64 = nil + } else { + if false { + } else { + z.F.DecMapInt8Int64X(&x.FMapInt8Int64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Int64 != nil { + x.FptrMapInt8Int64 = nil + } + } else { + if x.FptrMapInt8Int64 == nil { + x.FptrMapInt8Int64 = new(map[int8]int64) + } + + if false { + } else { + z.F.DecMapInt8Int64X(x.FptrMapInt8Int64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt8Float32 = nil + } else { + if false { + } else { + z.F.DecMapInt8Float32X(&x.FMapInt8Float32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Float32 != nil { + x.FptrMapInt8Float32 = nil + } + } else { + if x.FptrMapInt8Float32 == nil { + x.FptrMapInt8Float32 = new(map[int8]float32) + } + + if false { + } else { + z.F.DecMapInt8Float32X(x.FptrMapInt8Float32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt8Float64 = nil + } else { + if false { + } else { + z.F.DecMapInt8Float64X(&x.FMapInt8Float64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Float64 != nil { + x.FptrMapInt8Float64 = nil + } + } else { + if x.FptrMapInt8Float64 == nil { + x.FptrMapInt8Float64 = new(map[int8]float64) + } + + if false { + } else { + z.F.DecMapInt8Float64X(x.FptrMapInt8Float64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt8Bool = nil + } else { + if false { + } else { + z.F.DecMapInt8BoolX(&x.FMapInt8Bool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt8Bool != nil { + x.FptrMapInt8Bool = nil + } + } else { + if x.FptrMapInt8Bool == nil { + x.FptrMapInt8Bool = new(map[int8]bool) + } + + if false { + } else { + z.F.DecMapInt8BoolX(x.FptrMapInt8Bool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt16Intf = nil + } else { + if false { + } else { + z.F.DecMapInt16IntfX(&x.FMapInt16Intf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Intf != nil { + x.FptrMapInt16Intf = nil + } + } else { + if x.FptrMapInt16Intf == nil { + x.FptrMapInt16Intf = new(map[int16]interface{}) + } + + if false { + } else { + z.F.DecMapInt16IntfX(x.FptrMapInt16Intf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt16String = nil + } else { + if false { + } else { + z.F.DecMapInt16StringX(&x.FMapInt16String, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16String != nil { + x.FptrMapInt16String = nil + } + } else { + if x.FptrMapInt16String == nil { + x.FptrMapInt16String = new(map[int16]string) + } + + if false { + } else { + z.F.DecMapInt16StringX(x.FptrMapInt16String, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt16Uint = nil + } else { + if false { + } else { + z.F.DecMapInt16UintX(&x.FMapInt16Uint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Uint != nil { + x.FptrMapInt16Uint = nil + } + } else { + if x.FptrMapInt16Uint == nil { + x.FptrMapInt16Uint = new(map[int16]uint) + } + + if false { + } else { + z.F.DecMapInt16UintX(x.FptrMapInt16Uint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt16Uint8 = nil + } else { + if false { + } else { + z.F.DecMapInt16Uint8X(&x.FMapInt16Uint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Uint8 != nil { + x.FptrMapInt16Uint8 = nil + } + } else { + if x.FptrMapInt16Uint8 == nil { + x.FptrMapInt16Uint8 = new(map[int16]uint8) + } + + if false { + } else { + z.F.DecMapInt16Uint8X(x.FptrMapInt16Uint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt16Uint16 = nil + } else { + if false { + } else { + z.F.DecMapInt16Uint16X(&x.FMapInt16Uint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Uint16 != nil { + x.FptrMapInt16Uint16 = nil + } + } else { + if x.FptrMapInt16Uint16 == nil { + x.FptrMapInt16Uint16 = new(map[int16]uint16) + } + + if false { + } else { + z.F.DecMapInt16Uint16X(x.FptrMapInt16Uint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt16Uint32 = nil + } else { + if false { + } else { + z.F.DecMapInt16Uint32X(&x.FMapInt16Uint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Uint32 != nil { + x.FptrMapInt16Uint32 = nil + } + } else { + if x.FptrMapInt16Uint32 == nil { + x.FptrMapInt16Uint32 = new(map[int16]uint32) + } + + if false { + } else { + z.F.DecMapInt16Uint32X(x.FptrMapInt16Uint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt16Uint64 = nil + } else { + if false { + } else { + z.F.DecMapInt16Uint64X(&x.FMapInt16Uint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Uint64 != nil { + x.FptrMapInt16Uint64 = nil + } + } else { + if x.FptrMapInt16Uint64 == nil { + x.FptrMapInt16Uint64 = new(map[int16]uint64) + } + + if false { + } else { + z.F.DecMapInt16Uint64X(x.FptrMapInt16Uint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt16Uintptr = nil + } else { + if false { + } else { + z.F.DecMapInt16UintptrX(&x.FMapInt16Uintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Uintptr != nil { + x.FptrMapInt16Uintptr = nil + } + } else { + if x.FptrMapInt16Uintptr == nil { + x.FptrMapInt16Uintptr = new(map[int16]uintptr) + } + + if false { + } else { + z.F.DecMapInt16UintptrX(x.FptrMapInt16Uintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt16Int = nil + } else { + if false { + } else { + z.F.DecMapInt16IntX(&x.FMapInt16Int, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Int != nil { + x.FptrMapInt16Int = nil + } + } else { + if x.FptrMapInt16Int == nil { + x.FptrMapInt16Int = new(map[int16]int) + } + + if false { + } else { + z.F.DecMapInt16IntX(x.FptrMapInt16Int, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt16Int8 = nil + } else { + if false { + } else { + z.F.DecMapInt16Int8X(&x.FMapInt16Int8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Int8 != nil { + x.FptrMapInt16Int8 = nil + } + } else { + if x.FptrMapInt16Int8 == nil { + x.FptrMapInt16Int8 = new(map[int16]int8) + } + + if false { + } else { + z.F.DecMapInt16Int8X(x.FptrMapInt16Int8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt16Int16 = nil + } else { + if false { + } else { + z.F.DecMapInt16Int16X(&x.FMapInt16Int16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Int16 != nil { + x.FptrMapInt16Int16 = nil + } + } else { + if x.FptrMapInt16Int16 == nil { + x.FptrMapInt16Int16 = new(map[int16]int16) + } + + if false { + } else { + z.F.DecMapInt16Int16X(x.FptrMapInt16Int16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt16Int32 = nil + } else { + if false { + } else { + z.F.DecMapInt16Int32X(&x.FMapInt16Int32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Int32 != nil { + x.FptrMapInt16Int32 = nil + } + } else { + if x.FptrMapInt16Int32 == nil { + x.FptrMapInt16Int32 = new(map[int16]int32) + } + + if false { + } else { + z.F.DecMapInt16Int32X(x.FptrMapInt16Int32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt16Int64 = nil + } else { + if false { + } else { + z.F.DecMapInt16Int64X(&x.FMapInt16Int64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Int64 != nil { + x.FptrMapInt16Int64 = nil + } + } else { + if x.FptrMapInt16Int64 == nil { + x.FptrMapInt16Int64 = new(map[int16]int64) + } + + if false { + } else { + z.F.DecMapInt16Int64X(x.FptrMapInt16Int64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt16Float32 = nil + } else { + if false { + } else { + z.F.DecMapInt16Float32X(&x.FMapInt16Float32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Float32 != nil { + x.FptrMapInt16Float32 = nil + } + } else { + if x.FptrMapInt16Float32 == nil { + x.FptrMapInt16Float32 = new(map[int16]float32) + } + + if false { + } else { + z.F.DecMapInt16Float32X(x.FptrMapInt16Float32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt16Float64 = nil + } else { + if false { + } else { + z.F.DecMapInt16Float64X(&x.FMapInt16Float64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Float64 != nil { + x.FptrMapInt16Float64 = nil + } + } else { + if x.FptrMapInt16Float64 == nil { + x.FptrMapInt16Float64 = new(map[int16]float64) + } + + if false { + } else { + z.F.DecMapInt16Float64X(x.FptrMapInt16Float64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt16Bool = nil + } else { + if false { + } else { + z.F.DecMapInt16BoolX(&x.FMapInt16Bool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt16Bool != nil { + x.FptrMapInt16Bool = nil + } + } else { + if x.FptrMapInt16Bool == nil { + x.FptrMapInt16Bool = new(map[int16]bool) + } + + if false { + } else { + z.F.DecMapInt16BoolX(x.FptrMapInt16Bool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt32Intf = nil + } else { + if false { + } else { + z.F.DecMapInt32IntfX(&x.FMapInt32Intf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Intf != nil { + x.FptrMapInt32Intf = nil + } + } else { + if x.FptrMapInt32Intf == nil { + x.FptrMapInt32Intf = new(map[int32]interface{}) + } + + if false { + } else { + z.F.DecMapInt32IntfX(x.FptrMapInt32Intf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt32String = nil + } else { + if false { + } else { + z.F.DecMapInt32StringX(&x.FMapInt32String, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32String != nil { + x.FptrMapInt32String = nil + } + } else { + if x.FptrMapInt32String == nil { + x.FptrMapInt32String = new(map[int32]string) + } + + if false { + } else { + z.F.DecMapInt32StringX(x.FptrMapInt32String, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt32Uint = nil + } else { + if false { + } else { + z.F.DecMapInt32UintX(&x.FMapInt32Uint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Uint != nil { + x.FptrMapInt32Uint = nil + } + } else { + if x.FptrMapInt32Uint == nil { + x.FptrMapInt32Uint = new(map[int32]uint) + } + + if false { + } else { + z.F.DecMapInt32UintX(x.FptrMapInt32Uint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt32Uint8 = nil + } else { + if false { + } else { + z.F.DecMapInt32Uint8X(&x.FMapInt32Uint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Uint8 != nil { + x.FptrMapInt32Uint8 = nil + } + } else { + if x.FptrMapInt32Uint8 == nil { + x.FptrMapInt32Uint8 = new(map[int32]uint8) + } + + if false { + } else { + z.F.DecMapInt32Uint8X(x.FptrMapInt32Uint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt32Uint16 = nil + } else { + if false { + } else { + z.F.DecMapInt32Uint16X(&x.FMapInt32Uint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Uint16 != nil { + x.FptrMapInt32Uint16 = nil + } + } else { + if x.FptrMapInt32Uint16 == nil { + x.FptrMapInt32Uint16 = new(map[int32]uint16) + } + + if false { + } else { + z.F.DecMapInt32Uint16X(x.FptrMapInt32Uint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt32Uint32 = nil + } else { + if false { + } else { + z.F.DecMapInt32Uint32X(&x.FMapInt32Uint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Uint32 != nil { + x.FptrMapInt32Uint32 = nil + } + } else { + if x.FptrMapInt32Uint32 == nil { + x.FptrMapInt32Uint32 = new(map[int32]uint32) + } + + if false { + } else { + z.F.DecMapInt32Uint32X(x.FptrMapInt32Uint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt32Uint64 = nil + } else { + if false { + } else { + z.F.DecMapInt32Uint64X(&x.FMapInt32Uint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Uint64 != nil { + x.FptrMapInt32Uint64 = nil + } + } else { + if x.FptrMapInt32Uint64 == nil { + x.FptrMapInt32Uint64 = new(map[int32]uint64) + } + + if false { + } else { + z.F.DecMapInt32Uint64X(x.FptrMapInt32Uint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt32Uintptr = nil + } else { + if false { + } else { + z.F.DecMapInt32UintptrX(&x.FMapInt32Uintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Uintptr != nil { + x.FptrMapInt32Uintptr = nil + } + } else { + if x.FptrMapInt32Uintptr == nil { + x.FptrMapInt32Uintptr = new(map[int32]uintptr) + } + + if false { + } else { + z.F.DecMapInt32UintptrX(x.FptrMapInt32Uintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt32Int = nil + } else { + if false { + } else { + z.F.DecMapInt32IntX(&x.FMapInt32Int, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Int != nil { + x.FptrMapInt32Int = nil + } + } else { + if x.FptrMapInt32Int == nil { + x.FptrMapInt32Int = new(map[int32]int) + } + + if false { + } else { + z.F.DecMapInt32IntX(x.FptrMapInt32Int, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt32Int8 = nil + } else { + if false { + } else { + z.F.DecMapInt32Int8X(&x.FMapInt32Int8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Int8 != nil { + x.FptrMapInt32Int8 = nil + } + } else { + if x.FptrMapInt32Int8 == nil { + x.FptrMapInt32Int8 = new(map[int32]int8) + } + + if false { + } else { + z.F.DecMapInt32Int8X(x.FptrMapInt32Int8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt32Int16 = nil + } else { + if false { + } else { + z.F.DecMapInt32Int16X(&x.FMapInt32Int16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Int16 != nil { + x.FptrMapInt32Int16 = nil + } + } else { + if x.FptrMapInt32Int16 == nil { + x.FptrMapInt32Int16 = new(map[int32]int16) + } + + if false { + } else { + z.F.DecMapInt32Int16X(x.FptrMapInt32Int16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt32Int32 = nil + } else { + if false { + } else { + z.F.DecMapInt32Int32X(&x.FMapInt32Int32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Int32 != nil { + x.FptrMapInt32Int32 = nil + } + } else { + if x.FptrMapInt32Int32 == nil { + x.FptrMapInt32Int32 = new(map[int32]int32) + } + + if false { + } else { + z.F.DecMapInt32Int32X(x.FptrMapInt32Int32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt32Int64 = nil + } else { + if false { + } else { + z.F.DecMapInt32Int64X(&x.FMapInt32Int64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Int64 != nil { + x.FptrMapInt32Int64 = nil + } + } else { + if x.FptrMapInt32Int64 == nil { + x.FptrMapInt32Int64 = new(map[int32]int64) + } + + if false { + } else { + z.F.DecMapInt32Int64X(x.FptrMapInt32Int64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt32Float32 = nil + } else { + if false { + } else { + z.F.DecMapInt32Float32X(&x.FMapInt32Float32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Float32 != nil { + x.FptrMapInt32Float32 = nil + } + } else { + if x.FptrMapInt32Float32 == nil { + x.FptrMapInt32Float32 = new(map[int32]float32) + } + + if false { + } else { + z.F.DecMapInt32Float32X(x.FptrMapInt32Float32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt32Float64 = nil + } else { + if false { + } else { + z.F.DecMapInt32Float64X(&x.FMapInt32Float64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Float64 != nil { + x.FptrMapInt32Float64 = nil + } + } else { + if x.FptrMapInt32Float64 == nil { + x.FptrMapInt32Float64 = new(map[int32]float64) + } + + if false { + } else { + z.F.DecMapInt32Float64X(x.FptrMapInt32Float64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt32Bool = nil + } else { + if false { + } else { + z.F.DecMapInt32BoolX(&x.FMapInt32Bool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt32Bool != nil { + x.FptrMapInt32Bool = nil + } + } else { + if x.FptrMapInt32Bool == nil { + x.FptrMapInt32Bool = new(map[int32]bool) + } + + if false { + } else { + z.F.DecMapInt32BoolX(x.FptrMapInt32Bool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt64Intf = nil + } else { + if false { + } else { + z.F.DecMapInt64IntfX(&x.FMapInt64Intf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Intf != nil { + x.FptrMapInt64Intf = nil + } + } else { + if x.FptrMapInt64Intf == nil { + x.FptrMapInt64Intf = new(map[int64]interface{}) + } + + if false { + } else { + z.F.DecMapInt64IntfX(x.FptrMapInt64Intf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt64String = nil + } else { + if false { + } else { + z.F.DecMapInt64StringX(&x.FMapInt64String, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64String != nil { + x.FptrMapInt64String = nil + } + } else { + if x.FptrMapInt64String == nil { + x.FptrMapInt64String = new(map[int64]string) + } + + if false { + } else { + z.F.DecMapInt64StringX(x.FptrMapInt64String, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt64Uint = nil + } else { + if false { + } else { + z.F.DecMapInt64UintX(&x.FMapInt64Uint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Uint != nil { + x.FptrMapInt64Uint = nil + } + } else { + if x.FptrMapInt64Uint == nil { + x.FptrMapInt64Uint = new(map[int64]uint) + } + + if false { + } else { + z.F.DecMapInt64UintX(x.FptrMapInt64Uint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt64Uint8 = nil + } else { + if false { + } else { + z.F.DecMapInt64Uint8X(&x.FMapInt64Uint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Uint8 != nil { + x.FptrMapInt64Uint8 = nil + } + } else { + if x.FptrMapInt64Uint8 == nil { + x.FptrMapInt64Uint8 = new(map[int64]uint8) + } + + if false { + } else { + z.F.DecMapInt64Uint8X(x.FptrMapInt64Uint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt64Uint16 = nil + } else { + if false { + } else { + z.F.DecMapInt64Uint16X(&x.FMapInt64Uint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Uint16 != nil { + x.FptrMapInt64Uint16 = nil + } + } else { + if x.FptrMapInt64Uint16 == nil { + x.FptrMapInt64Uint16 = new(map[int64]uint16) + } + + if false { + } else { + z.F.DecMapInt64Uint16X(x.FptrMapInt64Uint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt64Uint32 = nil + } else { + if false { + } else { + z.F.DecMapInt64Uint32X(&x.FMapInt64Uint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Uint32 != nil { + x.FptrMapInt64Uint32 = nil + } + } else { + if x.FptrMapInt64Uint32 == nil { + x.FptrMapInt64Uint32 = new(map[int64]uint32) + } + + if false { + } else { + z.F.DecMapInt64Uint32X(x.FptrMapInt64Uint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt64Uint64 = nil + } else { + if false { + } else { + z.F.DecMapInt64Uint64X(&x.FMapInt64Uint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Uint64 != nil { + x.FptrMapInt64Uint64 = nil + } + } else { + if x.FptrMapInt64Uint64 == nil { + x.FptrMapInt64Uint64 = new(map[int64]uint64) + } + + if false { + } else { + z.F.DecMapInt64Uint64X(x.FptrMapInt64Uint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt64Uintptr = nil + } else { + if false { + } else { + z.F.DecMapInt64UintptrX(&x.FMapInt64Uintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Uintptr != nil { + x.FptrMapInt64Uintptr = nil + } + } else { + if x.FptrMapInt64Uintptr == nil { + x.FptrMapInt64Uintptr = new(map[int64]uintptr) + } + + if false { + } else { + z.F.DecMapInt64UintptrX(x.FptrMapInt64Uintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt64Int = nil + } else { + if false { + } else { + z.F.DecMapInt64IntX(&x.FMapInt64Int, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Int != nil { + x.FptrMapInt64Int = nil + } + } else { + if x.FptrMapInt64Int == nil { + x.FptrMapInt64Int = new(map[int64]int) + } + + if false { + } else { + z.F.DecMapInt64IntX(x.FptrMapInt64Int, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt64Int8 = nil + } else { + if false { + } else { + z.F.DecMapInt64Int8X(&x.FMapInt64Int8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Int8 != nil { + x.FptrMapInt64Int8 = nil + } + } else { + if x.FptrMapInt64Int8 == nil { + x.FptrMapInt64Int8 = new(map[int64]int8) + } + + if false { + } else { + z.F.DecMapInt64Int8X(x.FptrMapInt64Int8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt64Int16 = nil + } else { + if false { + } else { + z.F.DecMapInt64Int16X(&x.FMapInt64Int16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Int16 != nil { + x.FptrMapInt64Int16 = nil + } + } else { + if x.FptrMapInt64Int16 == nil { + x.FptrMapInt64Int16 = new(map[int64]int16) + } + + if false { + } else { + z.F.DecMapInt64Int16X(x.FptrMapInt64Int16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt64Int32 = nil + } else { + if false { + } else { + z.F.DecMapInt64Int32X(&x.FMapInt64Int32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Int32 != nil { + x.FptrMapInt64Int32 = nil + } + } else { + if x.FptrMapInt64Int32 == nil { + x.FptrMapInt64Int32 = new(map[int64]int32) + } + + if false { + } else { + z.F.DecMapInt64Int32X(x.FptrMapInt64Int32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt64Int64 = nil + } else { + if false { + } else { + z.F.DecMapInt64Int64X(&x.FMapInt64Int64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Int64 != nil { + x.FptrMapInt64Int64 = nil + } + } else { + if x.FptrMapInt64Int64 == nil { + x.FptrMapInt64Int64 = new(map[int64]int64) + } + + if false { + } else { + z.F.DecMapInt64Int64X(x.FptrMapInt64Int64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt64Float32 = nil + } else { + if false { + } else { + z.F.DecMapInt64Float32X(&x.FMapInt64Float32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Float32 != nil { + x.FptrMapInt64Float32 = nil + } + } else { + if x.FptrMapInt64Float32 == nil { + x.FptrMapInt64Float32 = new(map[int64]float32) + } + + if false { + } else { + z.F.DecMapInt64Float32X(x.FptrMapInt64Float32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt64Float64 = nil + } else { + if false { + } else { + z.F.DecMapInt64Float64X(&x.FMapInt64Float64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Float64 != nil { + x.FptrMapInt64Float64 = nil + } + } else { + if x.FptrMapInt64Float64 == nil { + x.FptrMapInt64Float64 = new(map[int64]float64) + } + + if false { + } else { + z.F.DecMapInt64Float64X(x.FptrMapInt64Float64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapInt64Bool = nil + } else { + if false { + } else { + z.F.DecMapInt64BoolX(&x.FMapInt64Bool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapInt64Bool != nil { + x.FptrMapInt64Bool = nil + } + } else { + if x.FptrMapInt64Bool == nil { + x.FptrMapInt64Bool = new(map[int64]bool) + } + + if false { + } else { + z.F.DecMapInt64BoolX(x.FptrMapInt64Bool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapBoolIntf = nil + } else { + if false { + } else { + z.F.DecMapBoolIntfX(&x.FMapBoolIntf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolIntf != nil { + x.FptrMapBoolIntf = nil + } + } else { + if x.FptrMapBoolIntf == nil { + x.FptrMapBoolIntf = new(map[bool]interface{}) + } + + if false { + } else { + z.F.DecMapBoolIntfX(x.FptrMapBoolIntf, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapBoolString = nil + } else { + if false { + } else { + z.F.DecMapBoolStringX(&x.FMapBoolString, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolString != nil { + x.FptrMapBoolString = nil + } + } else { + if x.FptrMapBoolString == nil { + x.FptrMapBoolString = new(map[bool]string) + } + + if false { + } else { + z.F.DecMapBoolStringX(x.FptrMapBoolString, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapBoolUint = nil + } else { + if false { + } else { + z.F.DecMapBoolUintX(&x.FMapBoolUint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolUint != nil { + x.FptrMapBoolUint = nil + } + } else { + if x.FptrMapBoolUint == nil { + x.FptrMapBoolUint = new(map[bool]uint) + } + + if false { + } else { + z.F.DecMapBoolUintX(x.FptrMapBoolUint, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapBoolUint8 = nil + } else { + if false { + } else { + z.F.DecMapBoolUint8X(&x.FMapBoolUint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolUint8 != nil { + x.FptrMapBoolUint8 = nil + } + } else { + if x.FptrMapBoolUint8 == nil { + x.FptrMapBoolUint8 = new(map[bool]uint8) + } + + if false { + } else { + z.F.DecMapBoolUint8X(x.FptrMapBoolUint8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapBoolUint16 = nil + } else { + if false { + } else { + z.F.DecMapBoolUint16X(&x.FMapBoolUint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolUint16 != nil { + x.FptrMapBoolUint16 = nil + } + } else { + if x.FptrMapBoolUint16 == nil { + x.FptrMapBoolUint16 = new(map[bool]uint16) + } + + if false { + } else { + z.F.DecMapBoolUint16X(x.FptrMapBoolUint16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapBoolUint32 = nil + } else { + if false { + } else { + z.F.DecMapBoolUint32X(&x.FMapBoolUint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolUint32 != nil { + x.FptrMapBoolUint32 = nil + } + } else { + if x.FptrMapBoolUint32 == nil { + x.FptrMapBoolUint32 = new(map[bool]uint32) + } + + if false { + } else { + z.F.DecMapBoolUint32X(x.FptrMapBoolUint32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapBoolUint64 = nil + } else { + if false { + } else { + z.F.DecMapBoolUint64X(&x.FMapBoolUint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolUint64 != nil { + x.FptrMapBoolUint64 = nil + } + } else { + if x.FptrMapBoolUint64 == nil { + x.FptrMapBoolUint64 = new(map[bool]uint64) + } + + if false { + } else { + z.F.DecMapBoolUint64X(x.FptrMapBoolUint64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapBoolUintptr = nil + } else { + if false { + } else { + z.F.DecMapBoolUintptrX(&x.FMapBoolUintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolUintptr != nil { + x.FptrMapBoolUintptr = nil + } + } else { + if x.FptrMapBoolUintptr == nil { + x.FptrMapBoolUintptr = new(map[bool]uintptr) + } + + if false { + } else { + z.F.DecMapBoolUintptrX(x.FptrMapBoolUintptr, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapBoolInt = nil + } else { + if false { + } else { + z.F.DecMapBoolIntX(&x.FMapBoolInt, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolInt != nil { + x.FptrMapBoolInt = nil + } + } else { + if x.FptrMapBoolInt == nil { + x.FptrMapBoolInt = new(map[bool]int) + } + + if false { + } else { + z.F.DecMapBoolIntX(x.FptrMapBoolInt, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapBoolInt8 = nil + } else { + if false { + } else { + z.F.DecMapBoolInt8X(&x.FMapBoolInt8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolInt8 != nil { + x.FptrMapBoolInt8 = nil + } + } else { + if x.FptrMapBoolInt8 == nil { + x.FptrMapBoolInt8 = new(map[bool]int8) + } + + if false { + } else { + z.F.DecMapBoolInt8X(x.FptrMapBoolInt8, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapBoolInt16 = nil + } else { + if false { + } else { + z.F.DecMapBoolInt16X(&x.FMapBoolInt16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolInt16 != nil { + x.FptrMapBoolInt16 = nil + } + } else { + if x.FptrMapBoolInt16 == nil { + x.FptrMapBoolInt16 = new(map[bool]int16) + } + + if false { + } else { + z.F.DecMapBoolInt16X(x.FptrMapBoolInt16, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapBoolInt32 = nil + } else { + if false { + } else { + z.F.DecMapBoolInt32X(&x.FMapBoolInt32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolInt32 != nil { + x.FptrMapBoolInt32 = nil + } + } else { + if x.FptrMapBoolInt32 == nil { + x.FptrMapBoolInt32 = new(map[bool]int32) + } + + if false { + } else { + z.F.DecMapBoolInt32X(x.FptrMapBoolInt32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapBoolInt64 = nil + } else { + if false { + } else { + z.F.DecMapBoolInt64X(&x.FMapBoolInt64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolInt64 != nil { + x.FptrMapBoolInt64 = nil + } + } else { + if x.FptrMapBoolInt64 == nil { + x.FptrMapBoolInt64 = new(map[bool]int64) + } + + if false { + } else { + z.F.DecMapBoolInt64X(x.FptrMapBoolInt64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapBoolFloat32 = nil + } else { + if false { + } else { + z.F.DecMapBoolFloat32X(&x.FMapBoolFloat32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolFloat32 != nil { + x.FptrMapBoolFloat32 = nil + } + } else { + if x.FptrMapBoolFloat32 == nil { + x.FptrMapBoolFloat32 = new(map[bool]float32) + } + + if false { + } else { + z.F.DecMapBoolFloat32X(x.FptrMapBoolFloat32, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapBoolFloat64 = nil + } else { + if false { + } else { + z.F.DecMapBoolFloat64X(&x.FMapBoolFloat64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolFloat64 != nil { + x.FptrMapBoolFloat64 = nil + } + } else { + if x.FptrMapBoolFloat64 == nil { + x.FptrMapBoolFloat64 = new(map[bool]float64) + } + + if false { + } else { + z.F.DecMapBoolFloat64X(x.FptrMapBoolFloat64, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.FMapBoolBool = nil + } else { + if false { + } else { + z.F.DecMapBoolBoolX(&x.FMapBoolBool, d) + } + } + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + if true && x.FptrMapBoolBool != nil { + x.FptrMapBoolBool = nil + } + } else { + if x.FptrMapBoolBool == nil { + x.FptrMapBoolBool = new(map[bool]bool) + } + + if false { + } else { + z.F.DecMapBoolBoolX(x.FptrMapBoolBool, d) + } + } + for { + yyj1141++ + if yyhl1141 { + yyb1141 = yyj1141 > l + } else { + yyb1141 = r.CheckBreak() + } + if yyb1141 { + break + } + r.ReadArrayElem() + z.DecStructFieldNotFound(yyj1141-1, "") + } + r.ReadArrayEnd() +} + +func (x testMammoth2Binary) CodecEncodeSelf(e *Encoder) { + var h codecSelfer19781 + z, r := GenHelperEncoder(e) + _, _, _ = h, z, r + if false { + } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { + z.EncExtension(x, yyxt1) + } else if z.EncBinary() { + z.EncBinaryMarshal(x) + } else { + r.EncodeUint(uint64(x)) + } +} + +func (x *testMammoth2Binary) CodecDecodeSelf(d *Decoder) { + var h codecSelfer19781 + z, r := GenHelperDecoder(d) + _, _, _ = h, z, r + if false { + } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { + z.DecExtension(x, yyxt1) + } else if z.DecBinary() { + z.DecBinaryUnmarshal(x) + } else { + *x = (testMammoth2Binary)(r.DecodeUint64()) + } +} + +func (x testMammoth2Text) CodecEncodeSelf(e *Encoder) { + var h codecSelfer19781 + z, r := GenHelperEncoder(e) + _, _, _ = h, z, r + if false { + } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { + z.EncExtension(x, yyxt1) + } else if !z.EncBinary() { + z.EncTextMarshal(x) + } else { + r.EncodeUint(uint64(x)) + } +} + +func (x *testMammoth2Text) CodecDecodeSelf(d *Decoder) { + var h codecSelfer19781 + z, r := GenHelperDecoder(d) + _, _, _ = h, z, r + if false { + } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { + z.DecExtension(x, yyxt1) + } else if !z.DecBinary() { + z.DecTextUnmarshal(x) + } else { + *x = (testMammoth2Text)(r.DecodeUint64()) + } +} + +func (x testMammoth2Json) CodecEncodeSelf(e *Encoder) { + var h codecSelfer19781 + z, r := GenHelperEncoder(e) + _, _, _ = h, z, r + if false { + } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { + z.EncExtension(x, yyxt1) + } else if !z.EncBinary() && z.IsJSONHandle() { + z.EncJSONMarshal(x) + } else { + r.EncodeUint(uint64(x)) + } +} + +func (x *testMammoth2Json) CodecDecodeSelf(d *Decoder) { + var h codecSelfer19781 + z, r := GenHelperDecoder(d) + _, _, _ = h, z, r + if false { + } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { + z.DecExtension(x, yyxt1) + } else if !z.DecBinary() && z.IsJSONHandle() { + z.DecJSONUnmarshal(x) + } else { + *x = (testMammoth2Json)(r.DecodeUint64()) + } +} + +func (x *testMammoth2Basic) CodecEncodeSelf(e *Encoder) { + var h codecSelfer19781 + z, r := GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + if false { + } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { + z.EncExtension(x, yyxt1) + } else { + h.enctestMammoth2Basic((*testMammoth2Basic)(x), e) + } + } +} + +func (x *testMammoth2Basic) CodecDecodeSelf(d *Decoder) { + var h codecSelfer19781 + z, r := GenHelperDecoder(d) + _, _, _ = h, z, r + if false { + } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { + z.DecExtension(x, yyxt1) + } else { + h.dectestMammoth2Basic((*testMammoth2Basic)(x), d) + } +} + +func (x *TestMammoth2Wrapper) CodecEncodeSelf(e *Encoder) { + var h codecSelfer19781 + z, r := GenHelperEncoder(e) + _, _, _ = h, z, r + if x == nil { + r.EncodeNil() + } else { + if false { + } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { + z.EncExtension(x, yyxt1) + } else { + yysep2 := !z.EncBinary() + yy2arr2 := z.EncBasicHandle().StructToArray + _, _ = yysep2, yy2arr2 + const yyr2 bool = false // struct tag has 'toArray' + if yyr2 || yy2arr2 { + r.WriteArrayStart(8) + } else { + r.WriteMapStart(8) + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yy4 := &x.V + yy4.CodecEncodeSelf(e) + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `V`) + r.WriteMapElemValue() + yy6 := &x.V + yy6.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + x.T.CodecEncodeSelf(e) + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `T`) + r.WriteMapElemValue() + x.T.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + x.B.CodecEncodeSelf(e) + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `B`) + r.WriteMapElemValue() + x.B.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + x.J.CodecEncodeSelf(e) + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `J`) + r.WriteMapElemValue() + x.J.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yy18 := &x.C + yy18.CodecEncodeSelf(e) + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `C`) + r.WriteMapElemValue() + yy20 := &x.C + yy20.CodecEncodeSelf(e) + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.M == nil { + r.EncodeNil() + } else { + if false { + } else { + h.encMaptestMammoth2BasicTestMammoth2((map[testMammoth2Basic]TestMammoth2)(x.M), e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `M`) + r.WriteMapElemValue() + if x.M == nil { + r.EncodeNil() + } else { + if false { + } else { + h.encMaptestMammoth2BasicTestMammoth2((map[testMammoth2Basic]TestMammoth2)(x.M), e) + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + if x.L == nil { + r.EncodeNil() + } else { + if false { + } else { + h.encSliceTestMammoth2(([]TestMammoth2)(x.L), e) + } + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `L`) + r.WriteMapElemValue() + if x.L == nil { + r.EncodeNil() + } else { + if false { + } else { + h.encSliceTestMammoth2(([]TestMammoth2)(x.L), e) + } + } + } + if yyr2 || yy2arr2 { + r.WriteArrayElem() + yy29 := &x.A + if false { + } else { + h.encArray4int64((*[4]int64)(yy29), e) + } + } else { + r.WriteMapElemKey() + r.EncodeString(codecSelferCcUTF819781, `A`) + r.WriteMapElemValue() + yy31 := &x.A + if false { + } else { + h.encArray4int64((*[4]int64)(yy31), e) + } + } + if yyr2 || yy2arr2 { + r.WriteArrayEnd() + } else { + r.WriteMapEnd() + } + } + } +} + +func (x *TestMammoth2Wrapper) CodecDecodeSelf(d *Decoder) { + var h codecSelfer19781 + z, r := GenHelperDecoder(d) + _, _, _ = h, z, r + if false { + } else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil { + z.DecExtension(x, yyxt1) + } else { + yyct2 := r.ContainerType() + if yyct2 == codecSelferValueTypeMap19781 { + yyl2 := r.ReadMapStart() + if yyl2 == 0 { + r.ReadMapEnd() + } else { + x.codecDecodeSelfFromMap(yyl2, d) + } + } else if yyct2 == codecSelferValueTypeArray19781 { + yyl2 := r.ReadArrayStart() + if yyl2 == 0 { + r.ReadArrayEnd() + } else { + x.codecDecodeSelfFromArray(yyl2, d) + } + } else { + panic(errCodecSelferOnlyMapOrArrayEncodeToStruct19781) + } + } +} + +func (x *TestMammoth2Wrapper) codecDecodeSelfFromMap(l int, d *Decoder) { + var h codecSelfer19781 + z, r := GenHelperDecoder(d) + _, _, _ = h, z, r + var yyhl3 bool = l >= 0 + for yyj3 := 0; ; yyj3++ { + if yyhl3 { + if yyj3 >= l { + break + } + } else { + if r.CheckBreak() { + break + } + } + r.ReadMapElemKey() + yys3 := z.StringView(r.DecodeStringAsBytes()) + r.ReadMapElemValue() + switch yys3 { + case "V": + if r.TryDecodeAsNil() { + x.V = TestMammoth2{} + } else { + x.V.CodecDecodeSelf(d) + } + case "T": + if r.TryDecodeAsNil() { + x.T = 0 + } else { + x.T.CodecDecodeSelf(d) + } + case "B": + if r.TryDecodeAsNil() { + x.B = 0 + } else { + x.B.CodecDecodeSelf(d) + } + case "J": + if r.TryDecodeAsNil() { + x.J = 0 + } else { + x.J.CodecDecodeSelf(d) + } + case "C": + if r.TryDecodeAsNil() { + x.C = testMammoth2Basic{} + } else { + x.C.CodecDecodeSelf(d) + } + case "M": + if r.TryDecodeAsNil() { + x.M = nil + } else { + if false { + } else { + h.decMaptestMammoth2BasicTestMammoth2((*map[testMammoth2Basic]TestMammoth2)(&x.M), d) + } + } + case "L": + if r.TryDecodeAsNil() { + x.L = nil + } else { + if false { + } else { + h.decSliceTestMammoth2((*[]TestMammoth2)(&x.L), d) + } + } + case "A": + if r.TryDecodeAsNil() { + x.A = [4]int64{} + } else { + if false { + } else { + h.decArray4int64((*[4]int64)(&x.A), d) + } + } + default: + z.DecStructFieldNotFound(-1, yys3) + } // end switch yys3 + } // end for yyj3 + r.ReadMapEnd() +} + +func (x *TestMammoth2Wrapper) codecDecodeSelfFromArray(l int, d *Decoder) { + var h codecSelfer19781 + z, r := GenHelperDecoder(d) + _, _, _ = h, z, r + var yyj15 int + var yyb15 bool + var yyhl15 bool = l >= 0 + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.V = TestMammoth2{} + } else { + x.V.CodecDecodeSelf(d) + } + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.T = 0 + } else { + x.T.CodecDecodeSelf(d) + } + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.B = 0 + } else { + x.B.CodecDecodeSelf(d) + } + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.J = 0 + } else { + x.J.CodecDecodeSelf(d) + } + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.C = testMammoth2Basic{} + } else { + x.C.CodecDecodeSelf(d) + } + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.M = nil + } else { + if false { + } else { + h.decMaptestMammoth2BasicTestMammoth2((*map[testMammoth2Basic]TestMammoth2)(&x.M), d) + } + } + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.L = nil + } else { + if false { + } else { + h.decSliceTestMammoth2((*[]TestMammoth2)(&x.L), d) + } + } + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + r.ReadArrayEnd() + return + } + r.ReadArrayElem() + if r.TryDecodeAsNil() { + x.A = [4]int64{} + } else { + if false { + } else { + h.decArray4int64((*[4]int64)(&x.A), d) + } + } + for { + yyj15++ + if yyhl15 { + yyb15 = yyj15 > l + } else { + yyb15 = r.CheckBreak() + } + if yyb15 { + break + } + r.ReadArrayElem() + z.DecStructFieldNotFound(yyj15-1, "") + } + r.ReadArrayEnd() +} + +func (x codecSelfer19781) enctestMammoth2Basic(v *testMammoth2Basic, e *Encoder) { + var h codecSelfer19781 + z, r := GenHelperEncoder(e) + _, _, _ = h, z, r + r.WriteArrayStart(len(v)) + for _, yyv1 := range v { + r.WriteArrayElem() + if false { + } else { + r.EncodeUint(uint64(yyv1)) + } + } + r.WriteArrayEnd() +} + +func (x codecSelfer19781) dectestMammoth2Basic(v *testMammoth2Basic, d *Decoder) { + var h codecSelfer19781 + z, r := GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := v + yyh1, yyl1 := z.DecSliceHelperStart() + if yyl1 == 0 { + + } else { + yyhl1 := yyl1 > 0 + var yyrl1 int + _ = yyrl1 + + var yyj1 int + // var yydn1 bool + for ; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { + + yyh1.ElemContainerState(yyj1) + + // if indefinite, etc, then expand the slice if necessary + var yydb1 bool + if yyj1 >= len(yyv1) { + z.DecArrayCannotExpand(len(v), yyj1+1) + yydb1 = true + + } + if yydb1 { + z.DecSwallow() + } else { + if r.TryDecodeAsNil() { + yyv1[yyj1] = 0 + } else { + yyv1[yyj1] = (uint64)(r.DecodeUint64()) + } + + } + + } + + } + yyh1.End() + +} + +func (x codecSelfer19781) encMaptestMammoth2BasicTestMammoth2(v map[testMammoth2Basic]TestMammoth2, e *Encoder) { + var h codecSelfer19781 + z, r := GenHelperEncoder(e) + _, _, _ = h, z, r + r.WriteMapStart(len(v)) + for yyk1, yyv1 := range v { + r.WriteMapElemKey() + yy2 := &yyk1 + yy2.CodecEncodeSelf(e) + r.WriteMapElemValue() + yy4 := &yyv1 + yy4.CodecEncodeSelf(e) + } + r.WriteMapEnd() +} + +func (x codecSelfer19781) decMaptestMammoth2BasicTestMammoth2(v *map[testMammoth2Basic]TestMammoth2, d *Decoder) { + var h codecSelfer19781 + z, r := GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyl1 := r.ReadMapStart() + yybh1 := z.DecBasicHandle() + if yyv1 == nil { + yyrl1 := z.DecInferLen(yyl1, yybh1.MaxInitLen, 4912) + yyv1 = make(map[testMammoth2Basic]TestMammoth2, yyrl1) + *v = yyv1 + } + var yymk1 testMammoth2Basic + var yymv1 TestMammoth2 + var yymg1, yymdn1 bool + if yybh1.MapValueReset { + yymg1 = true + } + if yyl1 != 0 { + yyhl1 := yyl1 > 0 + for yyj1 := 0; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { + r.ReadMapElemKey() + if r.TryDecodeAsNil() { + yymk1 = testMammoth2Basic{} + } else { + yymk1.CodecDecodeSelf(d) + } + + if yymg1 { + yymv1 = yyv1[yymk1] + } else { + yymv1 = TestMammoth2{} + } + r.ReadMapElemValue() + yymdn1 = false + if r.TryDecodeAsNil() { + yymdn1 = true + } else { + yymv1.CodecDecodeSelf(d) + } + + if yymdn1 { + if yybh1.DeleteOnNilMapValue { + delete(yyv1, yymk1) + } else { + yyv1[yymk1] = TestMammoth2{} + } + } else if yyv1 != nil { + yyv1[yymk1] = yymv1 + } + } + } // else len==0: TODO: Should we clear map entries? + r.ReadMapEnd() +} + +func (x codecSelfer19781) encSliceTestMammoth2(v []TestMammoth2, e *Encoder) { + var h codecSelfer19781 + z, r := GenHelperEncoder(e) + _, _, _ = h, z, r + r.WriteArrayStart(len(v)) + for _, yyv1 := range v { + r.WriteArrayElem() + yy2 := &yyv1 + yy2.CodecEncodeSelf(e) + } + r.WriteArrayEnd() +} + +func (x codecSelfer19781) decSliceTestMammoth2(v *[]TestMammoth2, d *Decoder) { + var h codecSelfer19781 + z, r := GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := *v + yyh1, yyl1 := z.DecSliceHelperStart() + var yyc1 bool + _ = yyc1 + if yyl1 == 0 { + if yyv1 == nil { + yyv1 = []TestMammoth2{} + yyc1 = true + } else if len(yyv1) != 0 { + yyv1 = yyv1[:0] + yyc1 = true + } + } else { + yyhl1 := yyl1 > 0 + var yyrl1 int + _ = yyrl1 + if yyhl1 { + if yyl1 > cap(yyv1) { + yyrl1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 4880) + if yyrl1 <= cap(yyv1) { + yyv1 = yyv1[:yyrl1] + } else { + yyv1 = make([]TestMammoth2, yyrl1) + } + yyc1 = true + } else if yyl1 != len(yyv1) { + yyv1 = yyv1[:yyl1] + yyc1 = true + } + } + var yyj1 int + // var yydn1 bool + for ; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { + if yyj1 == 0 && len(yyv1) == 0 { + if yyhl1 { + yyrl1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 4880) + } else { + yyrl1 = 8 + } + yyv1 = make([]TestMammoth2, yyrl1) + yyc1 = true + } + yyh1.ElemContainerState(yyj1) + + // if indefinite, etc, then expand the slice if necessary + var yydb1 bool + if yyj1 >= len(yyv1) { + yyv1 = append(yyv1, TestMammoth2{}) + yyc1 = true + + } + if yydb1 { + z.DecSwallow() + } else { + if r.TryDecodeAsNil() { + yyv1[yyj1] = TestMammoth2{} + } else { + yyv1[yyj1].CodecDecodeSelf(d) + } + + } + + } + if yyj1 < len(yyv1) { + yyv1 = yyv1[:yyj1] + yyc1 = true + } else if yyj1 == 0 && yyv1 == nil { + yyv1 = make([]TestMammoth2, 0) + yyc1 = true + } + } + yyh1.End() + if yyc1 { + *v = yyv1 + } + +} + +func (x codecSelfer19781) encArray4int64(v *[4]int64, e *Encoder) { + var h codecSelfer19781 + z, r := GenHelperEncoder(e) + _, _, _ = h, z, r + r.WriteArrayStart(len(v)) + for _, yyv1 := range v { + r.WriteArrayElem() + if false { + } else { + r.EncodeInt(int64(yyv1)) + } + } + r.WriteArrayEnd() +} + +func (x codecSelfer19781) decArray4int64(v *[4]int64, d *Decoder) { + var h codecSelfer19781 + z, r := GenHelperDecoder(d) + _, _, _ = h, z, r + + yyv1 := v + yyh1, yyl1 := z.DecSliceHelperStart() + if yyl1 == 0 { + + } else { + yyhl1 := yyl1 > 0 + var yyrl1 int + _ = yyrl1 + + var yyj1 int + // var yydn1 bool + for ; (yyhl1 && yyj1 < yyl1) || !(yyhl1 || r.CheckBreak()); yyj1++ { + + yyh1.ElemContainerState(yyj1) + + // if indefinite, etc, then expand the slice if necessary + var yydb1 bool + if yyj1 >= len(yyv1) { + z.DecArrayCannotExpand(len(v), yyj1+1) + yydb1 = true + + } + if yydb1 { + z.DecSwallow() + } else { + if r.TryDecodeAsNil() { + yyv1[yyj1] = 0 + } else { + yyv1[yyj1] = (int64)(r.DecodeInt64()) + } + + } + + } + + } + yyh1.End() + +} diff --git a/vendor/github.com/ugorji/go/codec/mammoth2_generated_test.go b/vendor/github.com/ugorji/go/codec/mammoth2_generated_test.go new file mode 100644 index 000000000..4c62dffe0 --- /dev/null +++ b/vendor/github.com/ugorji/go/codec/mammoth2_generated_test.go @@ -0,0 +1,658 @@ +// +build !notfastpath + +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// Use of this source code is governed by a MIT license found in the LICENSE file. + +// Code generated from mammoth2-test.go.tmpl - DO NOT EDIT. + +package codec + +// Increase codecoverage by covering all the codecgen paths, in fast-path and gen-helper.go.... +// +// Add: +// - test file for creating a mammoth generated file as _mammoth_generated.go +// - generate a second mammoth files in a different file: mammoth2_generated_test.go +// - mammoth-test.go.tmpl will do this +// - run codecgen on it, into mammoth2_codecgen_generated_test.go (no build tags) +// - as part of TestMammoth, run it also +// - this will cover all the codecgen, gen-helper, etc in one full run +// - check in mammoth* files into github also +// - then +// +// Now, add some types: +// - some that implement BinaryMarshal, TextMarshal, JSONMarshal, and one that implements none of it +// - create a wrapper type that includes TestMammoth2, with it in slices, and maps, and the custom types +// - this wrapper object is what we work encode/decode (so that the codecgen methods are called) + +// import "encoding/binary" +import "fmt" + +type TestMammoth2 struct { + FIntf interface{} + FptrIntf *interface{} + FString string + FptrString *string + FFloat32 float32 + FptrFloat32 *float32 + FFloat64 float64 + FptrFloat64 *float64 + FUint uint + FptrUint *uint + FUint8 uint8 + FptrUint8 *uint8 + FUint16 uint16 + FptrUint16 *uint16 + FUint32 uint32 + FptrUint32 *uint32 + FUint64 uint64 + FptrUint64 *uint64 + FUintptr uintptr + FptrUintptr *uintptr + FInt int + FptrInt *int + FInt8 int8 + FptrInt8 *int8 + FInt16 int16 + FptrInt16 *int16 + FInt32 int32 + FptrInt32 *int32 + FInt64 int64 + FptrInt64 *int64 + FBool bool + FptrBool *bool + + FSliceIntf []interface{} + FptrSliceIntf *[]interface{} + FSliceString []string + FptrSliceString *[]string + FSliceFloat32 []float32 + FptrSliceFloat32 *[]float32 + FSliceFloat64 []float64 + FptrSliceFloat64 *[]float64 + FSliceUint []uint + FptrSliceUint *[]uint + FSliceUint8 []uint8 + FptrSliceUint8 *[]uint8 + FSliceUint16 []uint16 + FptrSliceUint16 *[]uint16 + FSliceUint32 []uint32 + FptrSliceUint32 *[]uint32 + FSliceUint64 []uint64 + FptrSliceUint64 *[]uint64 + FSliceUintptr []uintptr + FptrSliceUintptr *[]uintptr + FSliceInt []int + FptrSliceInt *[]int + FSliceInt8 []int8 + FptrSliceInt8 *[]int8 + FSliceInt16 []int16 + FptrSliceInt16 *[]int16 + FSliceInt32 []int32 + FptrSliceInt32 *[]int32 + FSliceInt64 []int64 + FptrSliceInt64 *[]int64 + FSliceBool []bool + FptrSliceBool *[]bool + + FMapIntfIntf map[interface{}]interface{} + FptrMapIntfIntf *map[interface{}]interface{} + FMapIntfString map[interface{}]string + FptrMapIntfString *map[interface{}]string + FMapIntfUint map[interface{}]uint + FptrMapIntfUint *map[interface{}]uint + FMapIntfUint8 map[interface{}]uint8 + FptrMapIntfUint8 *map[interface{}]uint8 + FMapIntfUint16 map[interface{}]uint16 + FptrMapIntfUint16 *map[interface{}]uint16 + FMapIntfUint32 map[interface{}]uint32 + FptrMapIntfUint32 *map[interface{}]uint32 + FMapIntfUint64 map[interface{}]uint64 + FptrMapIntfUint64 *map[interface{}]uint64 + FMapIntfUintptr map[interface{}]uintptr + FptrMapIntfUintptr *map[interface{}]uintptr + FMapIntfInt map[interface{}]int + FptrMapIntfInt *map[interface{}]int + FMapIntfInt8 map[interface{}]int8 + FptrMapIntfInt8 *map[interface{}]int8 + FMapIntfInt16 map[interface{}]int16 + FptrMapIntfInt16 *map[interface{}]int16 + FMapIntfInt32 map[interface{}]int32 + FptrMapIntfInt32 *map[interface{}]int32 + FMapIntfInt64 map[interface{}]int64 + FptrMapIntfInt64 *map[interface{}]int64 + FMapIntfFloat32 map[interface{}]float32 + FptrMapIntfFloat32 *map[interface{}]float32 + FMapIntfFloat64 map[interface{}]float64 + FptrMapIntfFloat64 *map[interface{}]float64 + FMapIntfBool map[interface{}]bool + FptrMapIntfBool *map[interface{}]bool + FMapStringIntf map[string]interface{} + FptrMapStringIntf *map[string]interface{} + FMapStringString map[string]string + FptrMapStringString *map[string]string + FMapStringUint map[string]uint + FptrMapStringUint *map[string]uint + FMapStringUint8 map[string]uint8 + FptrMapStringUint8 *map[string]uint8 + FMapStringUint16 map[string]uint16 + FptrMapStringUint16 *map[string]uint16 + FMapStringUint32 map[string]uint32 + FptrMapStringUint32 *map[string]uint32 + FMapStringUint64 map[string]uint64 + FptrMapStringUint64 *map[string]uint64 + FMapStringUintptr map[string]uintptr + FptrMapStringUintptr *map[string]uintptr + FMapStringInt map[string]int + FptrMapStringInt *map[string]int + FMapStringInt8 map[string]int8 + FptrMapStringInt8 *map[string]int8 + FMapStringInt16 map[string]int16 + FptrMapStringInt16 *map[string]int16 + FMapStringInt32 map[string]int32 + FptrMapStringInt32 *map[string]int32 + FMapStringInt64 map[string]int64 + FptrMapStringInt64 *map[string]int64 + FMapStringFloat32 map[string]float32 + FptrMapStringFloat32 *map[string]float32 + FMapStringFloat64 map[string]float64 + FptrMapStringFloat64 *map[string]float64 + FMapStringBool map[string]bool + FptrMapStringBool *map[string]bool + FMapFloat32Intf map[float32]interface{} + FptrMapFloat32Intf *map[float32]interface{} + FMapFloat32String map[float32]string + FptrMapFloat32String *map[float32]string + FMapFloat32Uint map[float32]uint + FptrMapFloat32Uint *map[float32]uint + FMapFloat32Uint8 map[float32]uint8 + FptrMapFloat32Uint8 *map[float32]uint8 + FMapFloat32Uint16 map[float32]uint16 + FptrMapFloat32Uint16 *map[float32]uint16 + FMapFloat32Uint32 map[float32]uint32 + FptrMapFloat32Uint32 *map[float32]uint32 + FMapFloat32Uint64 map[float32]uint64 + FptrMapFloat32Uint64 *map[float32]uint64 + FMapFloat32Uintptr map[float32]uintptr + FptrMapFloat32Uintptr *map[float32]uintptr + FMapFloat32Int map[float32]int + FptrMapFloat32Int *map[float32]int + FMapFloat32Int8 map[float32]int8 + FptrMapFloat32Int8 *map[float32]int8 + FMapFloat32Int16 map[float32]int16 + FptrMapFloat32Int16 *map[float32]int16 + FMapFloat32Int32 map[float32]int32 + FptrMapFloat32Int32 *map[float32]int32 + FMapFloat32Int64 map[float32]int64 + FptrMapFloat32Int64 *map[float32]int64 + FMapFloat32Float32 map[float32]float32 + FptrMapFloat32Float32 *map[float32]float32 + FMapFloat32Float64 map[float32]float64 + FptrMapFloat32Float64 *map[float32]float64 + FMapFloat32Bool map[float32]bool + FptrMapFloat32Bool *map[float32]bool + FMapFloat64Intf map[float64]interface{} + FptrMapFloat64Intf *map[float64]interface{} + FMapFloat64String map[float64]string + FptrMapFloat64String *map[float64]string + FMapFloat64Uint map[float64]uint + FptrMapFloat64Uint *map[float64]uint + FMapFloat64Uint8 map[float64]uint8 + FptrMapFloat64Uint8 *map[float64]uint8 + FMapFloat64Uint16 map[float64]uint16 + FptrMapFloat64Uint16 *map[float64]uint16 + FMapFloat64Uint32 map[float64]uint32 + FptrMapFloat64Uint32 *map[float64]uint32 + FMapFloat64Uint64 map[float64]uint64 + FptrMapFloat64Uint64 *map[float64]uint64 + FMapFloat64Uintptr map[float64]uintptr + FptrMapFloat64Uintptr *map[float64]uintptr + FMapFloat64Int map[float64]int + FptrMapFloat64Int *map[float64]int + FMapFloat64Int8 map[float64]int8 + FptrMapFloat64Int8 *map[float64]int8 + FMapFloat64Int16 map[float64]int16 + FptrMapFloat64Int16 *map[float64]int16 + FMapFloat64Int32 map[float64]int32 + FptrMapFloat64Int32 *map[float64]int32 + FMapFloat64Int64 map[float64]int64 + FptrMapFloat64Int64 *map[float64]int64 + FMapFloat64Float32 map[float64]float32 + FptrMapFloat64Float32 *map[float64]float32 + FMapFloat64Float64 map[float64]float64 + FptrMapFloat64Float64 *map[float64]float64 + FMapFloat64Bool map[float64]bool + FptrMapFloat64Bool *map[float64]bool + FMapUintIntf map[uint]interface{} + FptrMapUintIntf *map[uint]interface{} + FMapUintString map[uint]string + FptrMapUintString *map[uint]string + FMapUintUint map[uint]uint + FptrMapUintUint *map[uint]uint + FMapUintUint8 map[uint]uint8 + FptrMapUintUint8 *map[uint]uint8 + FMapUintUint16 map[uint]uint16 + FptrMapUintUint16 *map[uint]uint16 + FMapUintUint32 map[uint]uint32 + FptrMapUintUint32 *map[uint]uint32 + FMapUintUint64 map[uint]uint64 + FptrMapUintUint64 *map[uint]uint64 + FMapUintUintptr map[uint]uintptr + FptrMapUintUintptr *map[uint]uintptr + FMapUintInt map[uint]int + FptrMapUintInt *map[uint]int + FMapUintInt8 map[uint]int8 + FptrMapUintInt8 *map[uint]int8 + FMapUintInt16 map[uint]int16 + FptrMapUintInt16 *map[uint]int16 + FMapUintInt32 map[uint]int32 + FptrMapUintInt32 *map[uint]int32 + FMapUintInt64 map[uint]int64 + FptrMapUintInt64 *map[uint]int64 + FMapUintFloat32 map[uint]float32 + FptrMapUintFloat32 *map[uint]float32 + FMapUintFloat64 map[uint]float64 + FptrMapUintFloat64 *map[uint]float64 + FMapUintBool map[uint]bool + FptrMapUintBool *map[uint]bool + FMapUint8Intf map[uint8]interface{} + FptrMapUint8Intf *map[uint8]interface{} + FMapUint8String map[uint8]string + FptrMapUint8String *map[uint8]string + FMapUint8Uint map[uint8]uint + FptrMapUint8Uint *map[uint8]uint + FMapUint8Uint8 map[uint8]uint8 + FptrMapUint8Uint8 *map[uint8]uint8 + FMapUint8Uint16 map[uint8]uint16 + FptrMapUint8Uint16 *map[uint8]uint16 + FMapUint8Uint32 map[uint8]uint32 + FptrMapUint8Uint32 *map[uint8]uint32 + FMapUint8Uint64 map[uint8]uint64 + FptrMapUint8Uint64 *map[uint8]uint64 + FMapUint8Uintptr map[uint8]uintptr + FptrMapUint8Uintptr *map[uint8]uintptr + FMapUint8Int map[uint8]int + FptrMapUint8Int *map[uint8]int + FMapUint8Int8 map[uint8]int8 + FptrMapUint8Int8 *map[uint8]int8 + FMapUint8Int16 map[uint8]int16 + FptrMapUint8Int16 *map[uint8]int16 + FMapUint8Int32 map[uint8]int32 + FptrMapUint8Int32 *map[uint8]int32 + FMapUint8Int64 map[uint8]int64 + FptrMapUint8Int64 *map[uint8]int64 + FMapUint8Float32 map[uint8]float32 + FptrMapUint8Float32 *map[uint8]float32 + FMapUint8Float64 map[uint8]float64 + FptrMapUint8Float64 *map[uint8]float64 + FMapUint8Bool map[uint8]bool + FptrMapUint8Bool *map[uint8]bool + FMapUint16Intf map[uint16]interface{} + FptrMapUint16Intf *map[uint16]interface{} + FMapUint16String map[uint16]string + FptrMapUint16String *map[uint16]string + FMapUint16Uint map[uint16]uint + FptrMapUint16Uint *map[uint16]uint + FMapUint16Uint8 map[uint16]uint8 + FptrMapUint16Uint8 *map[uint16]uint8 + FMapUint16Uint16 map[uint16]uint16 + FptrMapUint16Uint16 *map[uint16]uint16 + FMapUint16Uint32 map[uint16]uint32 + FptrMapUint16Uint32 *map[uint16]uint32 + FMapUint16Uint64 map[uint16]uint64 + FptrMapUint16Uint64 *map[uint16]uint64 + FMapUint16Uintptr map[uint16]uintptr + FptrMapUint16Uintptr *map[uint16]uintptr + FMapUint16Int map[uint16]int + FptrMapUint16Int *map[uint16]int + FMapUint16Int8 map[uint16]int8 + FptrMapUint16Int8 *map[uint16]int8 + FMapUint16Int16 map[uint16]int16 + FptrMapUint16Int16 *map[uint16]int16 + FMapUint16Int32 map[uint16]int32 + FptrMapUint16Int32 *map[uint16]int32 + FMapUint16Int64 map[uint16]int64 + FptrMapUint16Int64 *map[uint16]int64 + FMapUint16Float32 map[uint16]float32 + FptrMapUint16Float32 *map[uint16]float32 + FMapUint16Float64 map[uint16]float64 + FptrMapUint16Float64 *map[uint16]float64 + FMapUint16Bool map[uint16]bool + FptrMapUint16Bool *map[uint16]bool + FMapUint32Intf map[uint32]interface{} + FptrMapUint32Intf *map[uint32]interface{} + FMapUint32String map[uint32]string + FptrMapUint32String *map[uint32]string + FMapUint32Uint map[uint32]uint + FptrMapUint32Uint *map[uint32]uint + FMapUint32Uint8 map[uint32]uint8 + FptrMapUint32Uint8 *map[uint32]uint8 + FMapUint32Uint16 map[uint32]uint16 + FptrMapUint32Uint16 *map[uint32]uint16 + FMapUint32Uint32 map[uint32]uint32 + FptrMapUint32Uint32 *map[uint32]uint32 + FMapUint32Uint64 map[uint32]uint64 + FptrMapUint32Uint64 *map[uint32]uint64 + FMapUint32Uintptr map[uint32]uintptr + FptrMapUint32Uintptr *map[uint32]uintptr + FMapUint32Int map[uint32]int + FptrMapUint32Int *map[uint32]int + FMapUint32Int8 map[uint32]int8 + FptrMapUint32Int8 *map[uint32]int8 + FMapUint32Int16 map[uint32]int16 + FptrMapUint32Int16 *map[uint32]int16 + FMapUint32Int32 map[uint32]int32 + FptrMapUint32Int32 *map[uint32]int32 + FMapUint32Int64 map[uint32]int64 + FptrMapUint32Int64 *map[uint32]int64 + FMapUint32Float32 map[uint32]float32 + FptrMapUint32Float32 *map[uint32]float32 + FMapUint32Float64 map[uint32]float64 + FptrMapUint32Float64 *map[uint32]float64 + FMapUint32Bool map[uint32]bool + FptrMapUint32Bool *map[uint32]bool + FMapUint64Intf map[uint64]interface{} + FptrMapUint64Intf *map[uint64]interface{} + FMapUint64String map[uint64]string + FptrMapUint64String *map[uint64]string + FMapUint64Uint map[uint64]uint + FptrMapUint64Uint *map[uint64]uint + FMapUint64Uint8 map[uint64]uint8 + FptrMapUint64Uint8 *map[uint64]uint8 + FMapUint64Uint16 map[uint64]uint16 + FptrMapUint64Uint16 *map[uint64]uint16 + FMapUint64Uint32 map[uint64]uint32 + FptrMapUint64Uint32 *map[uint64]uint32 + FMapUint64Uint64 map[uint64]uint64 + FptrMapUint64Uint64 *map[uint64]uint64 + FMapUint64Uintptr map[uint64]uintptr + FptrMapUint64Uintptr *map[uint64]uintptr + FMapUint64Int map[uint64]int + FptrMapUint64Int *map[uint64]int + FMapUint64Int8 map[uint64]int8 + FptrMapUint64Int8 *map[uint64]int8 + FMapUint64Int16 map[uint64]int16 + FptrMapUint64Int16 *map[uint64]int16 + FMapUint64Int32 map[uint64]int32 + FptrMapUint64Int32 *map[uint64]int32 + FMapUint64Int64 map[uint64]int64 + FptrMapUint64Int64 *map[uint64]int64 + FMapUint64Float32 map[uint64]float32 + FptrMapUint64Float32 *map[uint64]float32 + FMapUint64Float64 map[uint64]float64 + FptrMapUint64Float64 *map[uint64]float64 + FMapUint64Bool map[uint64]bool + FptrMapUint64Bool *map[uint64]bool + FMapUintptrIntf map[uintptr]interface{} + FptrMapUintptrIntf *map[uintptr]interface{} + FMapUintptrString map[uintptr]string + FptrMapUintptrString *map[uintptr]string + FMapUintptrUint map[uintptr]uint + FptrMapUintptrUint *map[uintptr]uint + FMapUintptrUint8 map[uintptr]uint8 + FptrMapUintptrUint8 *map[uintptr]uint8 + FMapUintptrUint16 map[uintptr]uint16 + FptrMapUintptrUint16 *map[uintptr]uint16 + FMapUintptrUint32 map[uintptr]uint32 + FptrMapUintptrUint32 *map[uintptr]uint32 + FMapUintptrUint64 map[uintptr]uint64 + FptrMapUintptrUint64 *map[uintptr]uint64 + FMapUintptrUintptr map[uintptr]uintptr + FptrMapUintptrUintptr *map[uintptr]uintptr + FMapUintptrInt map[uintptr]int + FptrMapUintptrInt *map[uintptr]int + FMapUintptrInt8 map[uintptr]int8 + FptrMapUintptrInt8 *map[uintptr]int8 + FMapUintptrInt16 map[uintptr]int16 + FptrMapUintptrInt16 *map[uintptr]int16 + FMapUintptrInt32 map[uintptr]int32 + FptrMapUintptrInt32 *map[uintptr]int32 + FMapUintptrInt64 map[uintptr]int64 + FptrMapUintptrInt64 *map[uintptr]int64 + FMapUintptrFloat32 map[uintptr]float32 + FptrMapUintptrFloat32 *map[uintptr]float32 + FMapUintptrFloat64 map[uintptr]float64 + FptrMapUintptrFloat64 *map[uintptr]float64 + FMapUintptrBool map[uintptr]bool + FptrMapUintptrBool *map[uintptr]bool + FMapIntIntf map[int]interface{} + FptrMapIntIntf *map[int]interface{} + FMapIntString map[int]string + FptrMapIntString *map[int]string + FMapIntUint map[int]uint + FptrMapIntUint *map[int]uint + FMapIntUint8 map[int]uint8 + FptrMapIntUint8 *map[int]uint8 + FMapIntUint16 map[int]uint16 + FptrMapIntUint16 *map[int]uint16 + FMapIntUint32 map[int]uint32 + FptrMapIntUint32 *map[int]uint32 + FMapIntUint64 map[int]uint64 + FptrMapIntUint64 *map[int]uint64 + FMapIntUintptr map[int]uintptr + FptrMapIntUintptr *map[int]uintptr + FMapIntInt map[int]int + FptrMapIntInt *map[int]int + FMapIntInt8 map[int]int8 + FptrMapIntInt8 *map[int]int8 + FMapIntInt16 map[int]int16 + FptrMapIntInt16 *map[int]int16 + FMapIntInt32 map[int]int32 + FptrMapIntInt32 *map[int]int32 + FMapIntInt64 map[int]int64 + FptrMapIntInt64 *map[int]int64 + FMapIntFloat32 map[int]float32 + FptrMapIntFloat32 *map[int]float32 + FMapIntFloat64 map[int]float64 + FptrMapIntFloat64 *map[int]float64 + FMapIntBool map[int]bool + FptrMapIntBool *map[int]bool + FMapInt8Intf map[int8]interface{} + FptrMapInt8Intf *map[int8]interface{} + FMapInt8String map[int8]string + FptrMapInt8String *map[int8]string + FMapInt8Uint map[int8]uint + FptrMapInt8Uint *map[int8]uint + FMapInt8Uint8 map[int8]uint8 + FptrMapInt8Uint8 *map[int8]uint8 + FMapInt8Uint16 map[int8]uint16 + FptrMapInt8Uint16 *map[int8]uint16 + FMapInt8Uint32 map[int8]uint32 + FptrMapInt8Uint32 *map[int8]uint32 + FMapInt8Uint64 map[int8]uint64 + FptrMapInt8Uint64 *map[int8]uint64 + FMapInt8Uintptr map[int8]uintptr + FptrMapInt8Uintptr *map[int8]uintptr + FMapInt8Int map[int8]int + FptrMapInt8Int *map[int8]int + FMapInt8Int8 map[int8]int8 + FptrMapInt8Int8 *map[int8]int8 + FMapInt8Int16 map[int8]int16 + FptrMapInt8Int16 *map[int8]int16 + FMapInt8Int32 map[int8]int32 + FptrMapInt8Int32 *map[int8]int32 + FMapInt8Int64 map[int8]int64 + FptrMapInt8Int64 *map[int8]int64 + FMapInt8Float32 map[int8]float32 + FptrMapInt8Float32 *map[int8]float32 + FMapInt8Float64 map[int8]float64 + FptrMapInt8Float64 *map[int8]float64 + FMapInt8Bool map[int8]bool + FptrMapInt8Bool *map[int8]bool + FMapInt16Intf map[int16]interface{} + FptrMapInt16Intf *map[int16]interface{} + FMapInt16String map[int16]string + FptrMapInt16String *map[int16]string + FMapInt16Uint map[int16]uint + FptrMapInt16Uint *map[int16]uint + FMapInt16Uint8 map[int16]uint8 + FptrMapInt16Uint8 *map[int16]uint8 + FMapInt16Uint16 map[int16]uint16 + FptrMapInt16Uint16 *map[int16]uint16 + FMapInt16Uint32 map[int16]uint32 + FptrMapInt16Uint32 *map[int16]uint32 + FMapInt16Uint64 map[int16]uint64 + FptrMapInt16Uint64 *map[int16]uint64 + FMapInt16Uintptr map[int16]uintptr + FptrMapInt16Uintptr *map[int16]uintptr + FMapInt16Int map[int16]int + FptrMapInt16Int *map[int16]int + FMapInt16Int8 map[int16]int8 + FptrMapInt16Int8 *map[int16]int8 + FMapInt16Int16 map[int16]int16 + FptrMapInt16Int16 *map[int16]int16 + FMapInt16Int32 map[int16]int32 + FptrMapInt16Int32 *map[int16]int32 + FMapInt16Int64 map[int16]int64 + FptrMapInt16Int64 *map[int16]int64 + FMapInt16Float32 map[int16]float32 + FptrMapInt16Float32 *map[int16]float32 + FMapInt16Float64 map[int16]float64 + FptrMapInt16Float64 *map[int16]float64 + FMapInt16Bool map[int16]bool + FptrMapInt16Bool *map[int16]bool + FMapInt32Intf map[int32]interface{} + FptrMapInt32Intf *map[int32]interface{} + FMapInt32String map[int32]string + FptrMapInt32String *map[int32]string + FMapInt32Uint map[int32]uint + FptrMapInt32Uint *map[int32]uint + FMapInt32Uint8 map[int32]uint8 + FptrMapInt32Uint8 *map[int32]uint8 + FMapInt32Uint16 map[int32]uint16 + FptrMapInt32Uint16 *map[int32]uint16 + FMapInt32Uint32 map[int32]uint32 + FptrMapInt32Uint32 *map[int32]uint32 + FMapInt32Uint64 map[int32]uint64 + FptrMapInt32Uint64 *map[int32]uint64 + FMapInt32Uintptr map[int32]uintptr + FptrMapInt32Uintptr *map[int32]uintptr + FMapInt32Int map[int32]int + FptrMapInt32Int *map[int32]int + FMapInt32Int8 map[int32]int8 + FptrMapInt32Int8 *map[int32]int8 + FMapInt32Int16 map[int32]int16 + FptrMapInt32Int16 *map[int32]int16 + FMapInt32Int32 map[int32]int32 + FptrMapInt32Int32 *map[int32]int32 + FMapInt32Int64 map[int32]int64 + FptrMapInt32Int64 *map[int32]int64 + FMapInt32Float32 map[int32]float32 + FptrMapInt32Float32 *map[int32]float32 + FMapInt32Float64 map[int32]float64 + FptrMapInt32Float64 *map[int32]float64 + FMapInt32Bool map[int32]bool + FptrMapInt32Bool *map[int32]bool + FMapInt64Intf map[int64]interface{} + FptrMapInt64Intf *map[int64]interface{} + FMapInt64String map[int64]string + FptrMapInt64String *map[int64]string + FMapInt64Uint map[int64]uint + FptrMapInt64Uint *map[int64]uint + FMapInt64Uint8 map[int64]uint8 + FptrMapInt64Uint8 *map[int64]uint8 + FMapInt64Uint16 map[int64]uint16 + FptrMapInt64Uint16 *map[int64]uint16 + FMapInt64Uint32 map[int64]uint32 + FptrMapInt64Uint32 *map[int64]uint32 + FMapInt64Uint64 map[int64]uint64 + FptrMapInt64Uint64 *map[int64]uint64 + FMapInt64Uintptr map[int64]uintptr + FptrMapInt64Uintptr *map[int64]uintptr + FMapInt64Int map[int64]int + FptrMapInt64Int *map[int64]int + FMapInt64Int8 map[int64]int8 + FptrMapInt64Int8 *map[int64]int8 + FMapInt64Int16 map[int64]int16 + FptrMapInt64Int16 *map[int64]int16 + FMapInt64Int32 map[int64]int32 + FptrMapInt64Int32 *map[int64]int32 + FMapInt64Int64 map[int64]int64 + FptrMapInt64Int64 *map[int64]int64 + FMapInt64Float32 map[int64]float32 + FptrMapInt64Float32 *map[int64]float32 + FMapInt64Float64 map[int64]float64 + FptrMapInt64Float64 *map[int64]float64 + FMapInt64Bool map[int64]bool + FptrMapInt64Bool *map[int64]bool + FMapBoolIntf map[bool]interface{} + FptrMapBoolIntf *map[bool]interface{} + FMapBoolString map[bool]string + FptrMapBoolString *map[bool]string + FMapBoolUint map[bool]uint + FptrMapBoolUint *map[bool]uint + FMapBoolUint8 map[bool]uint8 + FptrMapBoolUint8 *map[bool]uint8 + FMapBoolUint16 map[bool]uint16 + FptrMapBoolUint16 *map[bool]uint16 + FMapBoolUint32 map[bool]uint32 + FptrMapBoolUint32 *map[bool]uint32 + FMapBoolUint64 map[bool]uint64 + FptrMapBoolUint64 *map[bool]uint64 + FMapBoolUintptr map[bool]uintptr + FptrMapBoolUintptr *map[bool]uintptr + FMapBoolInt map[bool]int + FptrMapBoolInt *map[bool]int + FMapBoolInt8 map[bool]int8 + FptrMapBoolInt8 *map[bool]int8 + FMapBoolInt16 map[bool]int16 + FptrMapBoolInt16 *map[bool]int16 + FMapBoolInt32 map[bool]int32 + FptrMapBoolInt32 *map[bool]int32 + FMapBoolInt64 map[bool]int64 + FptrMapBoolInt64 *map[bool]int64 + FMapBoolFloat32 map[bool]float32 + FptrMapBoolFloat32 *map[bool]float32 + FMapBoolFloat64 map[bool]float64 + FptrMapBoolFloat64 *map[bool]float64 + FMapBoolBool map[bool]bool + FptrMapBoolBool *map[bool]bool +} + +// ----------- + +type testMammoth2Binary uint64 + +func (x testMammoth2Binary) MarshalBinary() (data []byte, err error) { + data = make([]byte, 8) + bigen.PutUint64(data, uint64(x)) + return +} +func (x *testMammoth2Binary) UnmarshalBinary(data []byte) (err error) { + *x = testMammoth2Binary(bigen.Uint64(data)) + return +} + +type testMammoth2Text uint64 + +func (x testMammoth2Text) MarshalText() (data []byte, err error) { + data = []byte(fmt.Sprintf("%b", uint64(x))) + return +} +func (x *testMammoth2Text) UnmarshalText(data []byte) (err error) { + _, err = fmt.Sscanf(string(data), "%b", (*uint64)(x)) + return +} + +type testMammoth2Json uint64 + +func (x testMammoth2Json) MarshalJSON() (data []byte, err error) { + data = []byte(fmt.Sprintf("%v", uint64(x))) + return +} +func (x *testMammoth2Json) UnmarshalJSON(data []byte) (err error) { + _, err = fmt.Sscanf(string(data), "%v", (*uint64)(x)) + return +} + +type testMammoth2Basic [4]uint64 + +type TestMammoth2Wrapper struct { + V TestMammoth2 + T testMammoth2Text + B testMammoth2Binary + J testMammoth2Json + C testMammoth2Basic + M map[testMammoth2Basic]TestMammoth2 + L []TestMammoth2 + A [4]int64 +} diff --git a/vendor/github.com/ugorji/go/codec/mammoth_generated_test.go b/vendor/github.com/ugorji/go/codec/mammoth_generated_test.go new file mode 100644 index 000000000..3e15832cb --- /dev/null +++ b/vendor/github.com/ugorji/go/codec/mammoth_generated_test.go @@ -0,0 +1,13188 @@ +// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// Use of this source code is governed by a MIT license found in the LICENSE file. + +// Code generated from mammoth-test.go.tmpl - DO NOT EDIT. + +package codec + +import "testing" +import "fmt" +import "reflect" + +// TestMammoth has all the different paths optimized in fast-path +// It has all the primitives, slices and maps. +// +// For each of those types, it has a pointer and a non-pointer field. + +func init() { _ = fmt.Printf } // so we can include fmt as needed + +type TestMammoth struct { + FIntf interface{} + FptrIntf *interface{} + FString string + FptrString *string + FFloat32 float32 + FptrFloat32 *float32 + FFloat64 float64 + FptrFloat64 *float64 + FUint uint + FptrUint *uint + FUint8 uint8 + FptrUint8 *uint8 + FUint16 uint16 + FptrUint16 *uint16 + FUint32 uint32 + FptrUint32 *uint32 + FUint64 uint64 + FptrUint64 *uint64 + FUintptr uintptr + FptrUintptr *uintptr + FInt int + FptrInt *int + FInt8 int8 + FptrInt8 *int8 + FInt16 int16 + FptrInt16 *int16 + FInt32 int32 + FptrInt32 *int32 + FInt64 int64 + FptrInt64 *int64 + FBool bool + FptrBool *bool + + FSliceIntf []interface{} + FptrSliceIntf *[]interface{} + FSliceString []string + FptrSliceString *[]string + FSliceFloat32 []float32 + FptrSliceFloat32 *[]float32 + FSliceFloat64 []float64 + FptrSliceFloat64 *[]float64 + FSliceUint []uint + FptrSliceUint *[]uint + FSliceUint8 []uint8 + FptrSliceUint8 *[]uint8 + FSliceUint16 []uint16 + FptrSliceUint16 *[]uint16 + FSliceUint32 []uint32 + FptrSliceUint32 *[]uint32 + FSliceUint64 []uint64 + FptrSliceUint64 *[]uint64 + FSliceUintptr []uintptr + FptrSliceUintptr *[]uintptr + FSliceInt []int + FptrSliceInt *[]int + FSliceInt8 []int8 + FptrSliceInt8 *[]int8 + FSliceInt16 []int16 + FptrSliceInt16 *[]int16 + FSliceInt32 []int32 + FptrSliceInt32 *[]int32 + FSliceInt64 []int64 + FptrSliceInt64 *[]int64 + FSliceBool []bool + FptrSliceBool *[]bool + + FMapIntfIntf map[interface{}]interface{} + FptrMapIntfIntf *map[interface{}]interface{} + FMapIntfString map[interface{}]string + FptrMapIntfString *map[interface{}]string + FMapIntfUint map[interface{}]uint + FptrMapIntfUint *map[interface{}]uint + FMapIntfUint8 map[interface{}]uint8 + FptrMapIntfUint8 *map[interface{}]uint8 + FMapIntfUint16 map[interface{}]uint16 + FptrMapIntfUint16 *map[interface{}]uint16 + FMapIntfUint32 map[interface{}]uint32 + FptrMapIntfUint32 *map[interface{}]uint32 + FMapIntfUint64 map[interface{}]uint64 + FptrMapIntfUint64 *map[interface{}]uint64 + FMapIntfUintptr map[interface{}]uintptr + FptrMapIntfUintptr *map[interface{}]uintptr + FMapIntfInt map[interface{}]int + FptrMapIntfInt *map[interface{}]int + FMapIntfInt8 map[interface{}]int8 + FptrMapIntfInt8 *map[interface{}]int8 + FMapIntfInt16 map[interface{}]int16 + FptrMapIntfInt16 *map[interface{}]int16 + FMapIntfInt32 map[interface{}]int32 + FptrMapIntfInt32 *map[interface{}]int32 + FMapIntfInt64 map[interface{}]int64 + FptrMapIntfInt64 *map[interface{}]int64 + FMapIntfFloat32 map[interface{}]float32 + FptrMapIntfFloat32 *map[interface{}]float32 + FMapIntfFloat64 map[interface{}]float64 + FptrMapIntfFloat64 *map[interface{}]float64 + FMapIntfBool map[interface{}]bool + FptrMapIntfBool *map[interface{}]bool + FMapStringIntf map[string]interface{} + FptrMapStringIntf *map[string]interface{} + FMapStringString map[string]string + FptrMapStringString *map[string]string + FMapStringUint map[string]uint + FptrMapStringUint *map[string]uint + FMapStringUint8 map[string]uint8 + FptrMapStringUint8 *map[string]uint8 + FMapStringUint16 map[string]uint16 + FptrMapStringUint16 *map[string]uint16 + FMapStringUint32 map[string]uint32 + FptrMapStringUint32 *map[string]uint32 + FMapStringUint64 map[string]uint64 + FptrMapStringUint64 *map[string]uint64 + FMapStringUintptr map[string]uintptr + FptrMapStringUintptr *map[string]uintptr + FMapStringInt map[string]int + FptrMapStringInt *map[string]int + FMapStringInt8 map[string]int8 + FptrMapStringInt8 *map[string]int8 + FMapStringInt16 map[string]int16 + FptrMapStringInt16 *map[string]int16 + FMapStringInt32 map[string]int32 + FptrMapStringInt32 *map[string]int32 + FMapStringInt64 map[string]int64 + FptrMapStringInt64 *map[string]int64 + FMapStringFloat32 map[string]float32 + FptrMapStringFloat32 *map[string]float32 + FMapStringFloat64 map[string]float64 + FptrMapStringFloat64 *map[string]float64 + FMapStringBool map[string]bool + FptrMapStringBool *map[string]bool + FMapFloat32Intf map[float32]interface{} + FptrMapFloat32Intf *map[float32]interface{} + FMapFloat32String map[float32]string + FptrMapFloat32String *map[float32]string + FMapFloat32Uint map[float32]uint + FptrMapFloat32Uint *map[float32]uint + FMapFloat32Uint8 map[float32]uint8 + FptrMapFloat32Uint8 *map[float32]uint8 + FMapFloat32Uint16 map[float32]uint16 + FptrMapFloat32Uint16 *map[float32]uint16 + FMapFloat32Uint32 map[float32]uint32 + FptrMapFloat32Uint32 *map[float32]uint32 + FMapFloat32Uint64 map[float32]uint64 + FptrMapFloat32Uint64 *map[float32]uint64 + FMapFloat32Uintptr map[float32]uintptr + FptrMapFloat32Uintptr *map[float32]uintptr + FMapFloat32Int map[float32]int + FptrMapFloat32Int *map[float32]int + FMapFloat32Int8 map[float32]int8 + FptrMapFloat32Int8 *map[float32]int8 + FMapFloat32Int16 map[float32]int16 + FptrMapFloat32Int16 *map[float32]int16 + FMapFloat32Int32 map[float32]int32 + FptrMapFloat32Int32 *map[float32]int32 + FMapFloat32Int64 map[float32]int64 + FptrMapFloat32Int64 *map[float32]int64 + FMapFloat32Float32 map[float32]float32 + FptrMapFloat32Float32 *map[float32]float32 + FMapFloat32Float64 map[float32]float64 + FptrMapFloat32Float64 *map[float32]float64 + FMapFloat32Bool map[float32]bool + FptrMapFloat32Bool *map[float32]bool + FMapFloat64Intf map[float64]interface{} + FptrMapFloat64Intf *map[float64]interface{} + FMapFloat64String map[float64]string + FptrMapFloat64String *map[float64]string + FMapFloat64Uint map[float64]uint + FptrMapFloat64Uint *map[float64]uint + FMapFloat64Uint8 map[float64]uint8 + FptrMapFloat64Uint8 *map[float64]uint8 + FMapFloat64Uint16 map[float64]uint16 + FptrMapFloat64Uint16 *map[float64]uint16 + FMapFloat64Uint32 map[float64]uint32 + FptrMapFloat64Uint32 *map[float64]uint32 + FMapFloat64Uint64 map[float64]uint64 + FptrMapFloat64Uint64 *map[float64]uint64 + FMapFloat64Uintptr map[float64]uintptr + FptrMapFloat64Uintptr *map[float64]uintptr + FMapFloat64Int map[float64]int + FptrMapFloat64Int *map[float64]int + FMapFloat64Int8 map[float64]int8 + FptrMapFloat64Int8 *map[float64]int8 + FMapFloat64Int16 map[float64]int16 + FptrMapFloat64Int16 *map[float64]int16 + FMapFloat64Int32 map[float64]int32 + FptrMapFloat64Int32 *map[float64]int32 + FMapFloat64Int64 map[float64]int64 + FptrMapFloat64Int64 *map[float64]int64 + FMapFloat64Float32 map[float64]float32 + FptrMapFloat64Float32 *map[float64]float32 + FMapFloat64Float64 map[float64]float64 + FptrMapFloat64Float64 *map[float64]float64 + FMapFloat64Bool map[float64]bool + FptrMapFloat64Bool *map[float64]bool + FMapUintIntf map[uint]interface{} + FptrMapUintIntf *map[uint]interface{} + FMapUintString map[uint]string + FptrMapUintString *map[uint]string + FMapUintUint map[uint]uint + FptrMapUintUint *map[uint]uint + FMapUintUint8 map[uint]uint8 + FptrMapUintUint8 *map[uint]uint8 + FMapUintUint16 map[uint]uint16 + FptrMapUintUint16 *map[uint]uint16 + FMapUintUint32 map[uint]uint32 + FptrMapUintUint32 *map[uint]uint32 + FMapUintUint64 map[uint]uint64 + FptrMapUintUint64 *map[uint]uint64 + FMapUintUintptr map[uint]uintptr + FptrMapUintUintptr *map[uint]uintptr + FMapUintInt map[uint]int + FptrMapUintInt *map[uint]int + FMapUintInt8 map[uint]int8 + FptrMapUintInt8 *map[uint]int8 + FMapUintInt16 map[uint]int16 + FptrMapUintInt16 *map[uint]int16 + FMapUintInt32 map[uint]int32 + FptrMapUintInt32 *map[uint]int32 + FMapUintInt64 map[uint]int64 + FptrMapUintInt64 *map[uint]int64 + FMapUintFloat32 map[uint]float32 + FptrMapUintFloat32 *map[uint]float32 + FMapUintFloat64 map[uint]float64 + FptrMapUintFloat64 *map[uint]float64 + FMapUintBool map[uint]bool + FptrMapUintBool *map[uint]bool + FMapUint8Intf map[uint8]interface{} + FptrMapUint8Intf *map[uint8]interface{} + FMapUint8String map[uint8]string + FptrMapUint8String *map[uint8]string + FMapUint8Uint map[uint8]uint + FptrMapUint8Uint *map[uint8]uint + FMapUint8Uint8 map[uint8]uint8 + FptrMapUint8Uint8 *map[uint8]uint8 + FMapUint8Uint16 map[uint8]uint16 + FptrMapUint8Uint16 *map[uint8]uint16 + FMapUint8Uint32 map[uint8]uint32 + FptrMapUint8Uint32 *map[uint8]uint32 + FMapUint8Uint64 map[uint8]uint64 + FptrMapUint8Uint64 *map[uint8]uint64 + FMapUint8Uintptr map[uint8]uintptr + FptrMapUint8Uintptr *map[uint8]uintptr + FMapUint8Int map[uint8]int + FptrMapUint8Int *map[uint8]int + FMapUint8Int8 map[uint8]int8 + FptrMapUint8Int8 *map[uint8]int8 + FMapUint8Int16 map[uint8]int16 + FptrMapUint8Int16 *map[uint8]int16 + FMapUint8Int32 map[uint8]int32 + FptrMapUint8Int32 *map[uint8]int32 + FMapUint8Int64 map[uint8]int64 + FptrMapUint8Int64 *map[uint8]int64 + FMapUint8Float32 map[uint8]float32 + FptrMapUint8Float32 *map[uint8]float32 + FMapUint8Float64 map[uint8]float64 + FptrMapUint8Float64 *map[uint8]float64 + FMapUint8Bool map[uint8]bool + FptrMapUint8Bool *map[uint8]bool + FMapUint16Intf map[uint16]interface{} + FptrMapUint16Intf *map[uint16]interface{} + FMapUint16String map[uint16]string + FptrMapUint16String *map[uint16]string + FMapUint16Uint map[uint16]uint + FptrMapUint16Uint *map[uint16]uint + FMapUint16Uint8 map[uint16]uint8 + FptrMapUint16Uint8 *map[uint16]uint8 + FMapUint16Uint16 map[uint16]uint16 + FptrMapUint16Uint16 *map[uint16]uint16 + FMapUint16Uint32 map[uint16]uint32 + FptrMapUint16Uint32 *map[uint16]uint32 + FMapUint16Uint64 map[uint16]uint64 + FptrMapUint16Uint64 *map[uint16]uint64 + FMapUint16Uintptr map[uint16]uintptr + FptrMapUint16Uintptr *map[uint16]uintptr + FMapUint16Int map[uint16]int + FptrMapUint16Int *map[uint16]int + FMapUint16Int8 map[uint16]int8 + FptrMapUint16Int8 *map[uint16]int8 + FMapUint16Int16 map[uint16]int16 + FptrMapUint16Int16 *map[uint16]int16 + FMapUint16Int32 map[uint16]int32 + FptrMapUint16Int32 *map[uint16]int32 + FMapUint16Int64 map[uint16]int64 + FptrMapUint16Int64 *map[uint16]int64 + FMapUint16Float32 map[uint16]float32 + FptrMapUint16Float32 *map[uint16]float32 + FMapUint16Float64 map[uint16]float64 + FptrMapUint16Float64 *map[uint16]float64 + FMapUint16Bool map[uint16]bool + FptrMapUint16Bool *map[uint16]bool + FMapUint32Intf map[uint32]interface{} + FptrMapUint32Intf *map[uint32]interface{} + FMapUint32String map[uint32]string + FptrMapUint32String *map[uint32]string + FMapUint32Uint map[uint32]uint + FptrMapUint32Uint *map[uint32]uint + FMapUint32Uint8 map[uint32]uint8 + FptrMapUint32Uint8 *map[uint32]uint8 + FMapUint32Uint16 map[uint32]uint16 + FptrMapUint32Uint16 *map[uint32]uint16 + FMapUint32Uint32 map[uint32]uint32 + FptrMapUint32Uint32 *map[uint32]uint32 + FMapUint32Uint64 map[uint32]uint64 + FptrMapUint32Uint64 *map[uint32]uint64 + FMapUint32Uintptr map[uint32]uintptr + FptrMapUint32Uintptr *map[uint32]uintptr + FMapUint32Int map[uint32]int + FptrMapUint32Int *map[uint32]int + FMapUint32Int8 map[uint32]int8 + FptrMapUint32Int8 *map[uint32]int8 + FMapUint32Int16 map[uint32]int16 + FptrMapUint32Int16 *map[uint32]int16 + FMapUint32Int32 map[uint32]int32 + FptrMapUint32Int32 *map[uint32]int32 + FMapUint32Int64 map[uint32]int64 + FptrMapUint32Int64 *map[uint32]int64 + FMapUint32Float32 map[uint32]float32 + FptrMapUint32Float32 *map[uint32]float32 + FMapUint32Float64 map[uint32]float64 + FptrMapUint32Float64 *map[uint32]float64 + FMapUint32Bool map[uint32]bool + FptrMapUint32Bool *map[uint32]bool + FMapUint64Intf map[uint64]interface{} + FptrMapUint64Intf *map[uint64]interface{} + FMapUint64String map[uint64]string + FptrMapUint64String *map[uint64]string + FMapUint64Uint map[uint64]uint + FptrMapUint64Uint *map[uint64]uint + FMapUint64Uint8 map[uint64]uint8 + FptrMapUint64Uint8 *map[uint64]uint8 + FMapUint64Uint16 map[uint64]uint16 + FptrMapUint64Uint16 *map[uint64]uint16 + FMapUint64Uint32 map[uint64]uint32 + FptrMapUint64Uint32 *map[uint64]uint32 + FMapUint64Uint64 map[uint64]uint64 + FptrMapUint64Uint64 *map[uint64]uint64 + FMapUint64Uintptr map[uint64]uintptr + FptrMapUint64Uintptr *map[uint64]uintptr + FMapUint64Int map[uint64]int + FptrMapUint64Int *map[uint64]int + FMapUint64Int8 map[uint64]int8 + FptrMapUint64Int8 *map[uint64]int8 + FMapUint64Int16 map[uint64]int16 + FptrMapUint64Int16 *map[uint64]int16 + FMapUint64Int32 map[uint64]int32 + FptrMapUint64Int32 *map[uint64]int32 + FMapUint64Int64 map[uint64]int64 + FptrMapUint64Int64 *map[uint64]int64 + FMapUint64Float32 map[uint64]float32 + FptrMapUint64Float32 *map[uint64]float32 + FMapUint64Float64 map[uint64]float64 + FptrMapUint64Float64 *map[uint64]float64 + FMapUint64Bool map[uint64]bool + FptrMapUint64Bool *map[uint64]bool + FMapUintptrIntf map[uintptr]interface{} + FptrMapUintptrIntf *map[uintptr]interface{} + FMapUintptrString map[uintptr]string + FptrMapUintptrString *map[uintptr]string + FMapUintptrUint map[uintptr]uint + FptrMapUintptrUint *map[uintptr]uint + FMapUintptrUint8 map[uintptr]uint8 + FptrMapUintptrUint8 *map[uintptr]uint8 + FMapUintptrUint16 map[uintptr]uint16 + FptrMapUintptrUint16 *map[uintptr]uint16 + FMapUintptrUint32 map[uintptr]uint32 + FptrMapUintptrUint32 *map[uintptr]uint32 + FMapUintptrUint64 map[uintptr]uint64 + FptrMapUintptrUint64 *map[uintptr]uint64 + FMapUintptrUintptr map[uintptr]uintptr + FptrMapUintptrUintptr *map[uintptr]uintptr + FMapUintptrInt map[uintptr]int + FptrMapUintptrInt *map[uintptr]int + FMapUintptrInt8 map[uintptr]int8 + FptrMapUintptrInt8 *map[uintptr]int8 + FMapUintptrInt16 map[uintptr]int16 + FptrMapUintptrInt16 *map[uintptr]int16 + FMapUintptrInt32 map[uintptr]int32 + FptrMapUintptrInt32 *map[uintptr]int32 + FMapUintptrInt64 map[uintptr]int64 + FptrMapUintptrInt64 *map[uintptr]int64 + FMapUintptrFloat32 map[uintptr]float32 + FptrMapUintptrFloat32 *map[uintptr]float32 + FMapUintptrFloat64 map[uintptr]float64 + FptrMapUintptrFloat64 *map[uintptr]float64 + FMapUintptrBool map[uintptr]bool + FptrMapUintptrBool *map[uintptr]bool + FMapIntIntf map[int]interface{} + FptrMapIntIntf *map[int]interface{} + FMapIntString map[int]string + FptrMapIntString *map[int]string + FMapIntUint map[int]uint + FptrMapIntUint *map[int]uint + FMapIntUint8 map[int]uint8 + FptrMapIntUint8 *map[int]uint8 + FMapIntUint16 map[int]uint16 + FptrMapIntUint16 *map[int]uint16 + FMapIntUint32 map[int]uint32 + FptrMapIntUint32 *map[int]uint32 + FMapIntUint64 map[int]uint64 + FptrMapIntUint64 *map[int]uint64 + FMapIntUintptr map[int]uintptr + FptrMapIntUintptr *map[int]uintptr + FMapIntInt map[int]int + FptrMapIntInt *map[int]int + FMapIntInt8 map[int]int8 + FptrMapIntInt8 *map[int]int8 + FMapIntInt16 map[int]int16 + FptrMapIntInt16 *map[int]int16 + FMapIntInt32 map[int]int32 + FptrMapIntInt32 *map[int]int32 + FMapIntInt64 map[int]int64 + FptrMapIntInt64 *map[int]int64 + FMapIntFloat32 map[int]float32 + FptrMapIntFloat32 *map[int]float32 + FMapIntFloat64 map[int]float64 + FptrMapIntFloat64 *map[int]float64 + FMapIntBool map[int]bool + FptrMapIntBool *map[int]bool + FMapInt8Intf map[int8]interface{} + FptrMapInt8Intf *map[int8]interface{} + FMapInt8String map[int8]string + FptrMapInt8String *map[int8]string + FMapInt8Uint map[int8]uint + FptrMapInt8Uint *map[int8]uint + FMapInt8Uint8 map[int8]uint8 + FptrMapInt8Uint8 *map[int8]uint8 + FMapInt8Uint16 map[int8]uint16 + FptrMapInt8Uint16 *map[int8]uint16 + FMapInt8Uint32 map[int8]uint32 + FptrMapInt8Uint32 *map[int8]uint32 + FMapInt8Uint64 map[int8]uint64 + FptrMapInt8Uint64 *map[int8]uint64 + FMapInt8Uintptr map[int8]uintptr + FptrMapInt8Uintptr *map[int8]uintptr + FMapInt8Int map[int8]int + FptrMapInt8Int *map[int8]int + FMapInt8Int8 map[int8]int8 + FptrMapInt8Int8 *map[int8]int8 + FMapInt8Int16 map[int8]int16 + FptrMapInt8Int16 *map[int8]int16 + FMapInt8Int32 map[int8]int32 + FptrMapInt8Int32 *map[int8]int32 + FMapInt8Int64 map[int8]int64 + FptrMapInt8Int64 *map[int8]int64 + FMapInt8Float32 map[int8]float32 + FptrMapInt8Float32 *map[int8]float32 + FMapInt8Float64 map[int8]float64 + FptrMapInt8Float64 *map[int8]float64 + FMapInt8Bool map[int8]bool + FptrMapInt8Bool *map[int8]bool + FMapInt16Intf map[int16]interface{} + FptrMapInt16Intf *map[int16]interface{} + FMapInt16String map[int16]string + FptrMapInt16String *map[int16]string + FMapInt16Uint map[int16]uint + FptrMapInt16Uint *map[int16]uint + FMapInt16Uint8 map[int16]uint8 + FptrMapInt16Uint8 *map[int16]uint8 + FMapInt16Uint16 map[int16]uint16 + FptrMapInt16Uint16 *map[int16]uint16 + FMapInt16Uint32 map[int16]uint32 + FptrMapInt16Uint32 *map[int16]uint32 + FMapInt16Uint64 map[int16]uint64 + FptrMapInt16Uint64 *map[int16]uint64 + FMapInt16Uintptr map[int16]uintptr + FptrMapInt16Uintptr *map[int16]uintptr + FMapInt16Int map[int16]int + FptrMapInt16Int *map[int16]int + FMapInt16Int8 map[int16]int8 + FptrMapInt16Int8 *map[int16]int8 + FMapInt16Int16 map[int16]int16 + FptrMapInt16Int16 *map[int16]int16 + FMapInt16Int32 map[int16]int32 + FptrMapInt16Int32 *map[int16]int32 + FMapInt16Int64 map[int16]int64 + FptrMapInt16Int64 *map[int16]int64 + FMapInt16Float32 map[int16]float32 + FptrMapInt16Float32 *map[int16]float32 + FMapInt16Float64 map[int16]float64 + FptrMapInt16Float64 *map[int16]float64 + FMapInt16Bool map[int16]bool + FptrMapInt16Bool *map[int16]bool + FMapInt32Intf map[int32]interface{} + FptrMapInt32Intf *map[int32]interface{} + FMapInt32String map[int32]string + FptrMapInt32String *map[int32]string + FMapInt32Uint map[int32]uint + FptrMapInt32Uint *map[int32]uint + FMapInt32Uint8 map[int32]uint8 + FptrMapInt32Uint8 *map[int32]uint8 + FMapInt32Uint16 map[int32]uint16 + FptrMapInt32Uint16 *map[int32]uint16 + FMapInt32Uint32 map[int32]uint32 + FptrMapInt32Uint32 *map[int32]uint32 + FMapInt32Uint64 map[int32]uint64 + FptrMapInt32Uint64 *map[int32]uint64 + FMapInt32Uintptr map[int32]uintptr + FptrMapInt32Uintptr *map[int32]uintptr + FMapInt32Int map[int32]int + FptrMapInt32Int *map[int32]int + FMapInt32Int8 map[int32]int8 + FptrMapInt32Int8 *map[int32]int8 + FMapInt32Int16 map[int32]int16 + FptrMapInt32Int16 *map[int32]int16 + FMapInt32Int32 map[int32]int32 + FptrMapInt32Int32 *map[int32]int32 + FMapInt32Int64 map[int32]int64 + FptrMapInt32Int64 *map[int32]int64 + FMapInt32Float32 map[int32]float32 + FptrMapInt32Float32 *map[int32]float32 + FMapInt32Float64 map[int32]float64 + FptrMapInt32Float64 *map[int32]float64 + FMapInt32Bool map[int32]bool + FptrMapInt32Bool *map[int32]bool + FMapInt64Intf map[int64]interface{} + FptrMapInt64Intf *map[int64]interface{} + FMapInt64String map[int64]string + FptrMapInt64String *map[int64]string + FMapInt64Uint map[int64]uint + FptrMapInt64Uint *map[int64]uint + FMapInt64Uint8 map[int64]uint8 + FptrMapInt64Uint8 *map[int64]uint8 + FMapInt64Uint16 map[int64]uint16 + FptrMapInt64Uint16 *map[int64]uint16 + FMapInt64Uint32 map[int64]uint32 + FptrMapInt64Uint32 *map[int64]uint32 + FMapInt64Uint64 map[int64]uint64 + FptrMapInt64Uint64 *map[int64]uint64 + FMapInt64Uintptr map[int64]uintptr + FptrMapInt64Uintptr *map[int64]uintptr + FMapInt64Int map[int64]int + FptrMapInt64Int *map[int64]int + FMapInt64Int8 map[int64]int8 + FptrMapInt64Int8 *map[int64]int8 + FMapInt64Int16 map[int64]int16 + FptrMapInt64Int16 *map[int64]int16 + FMapInt64Int32 map[int64]int32 + FptrMapInt64Int32 *map[int64]int32 + FMapInt64Int64 map[int64]int64 + FptrMapInt64Int64 *map[int64]int64 + FMapInt64Float32 map[int64]float32 + FptrMapInt64Float32 *map[int64]float32 + FMapInt64Float64 map[int64]float64 + FptrMapInt64Float64 *map[int64]float64 + FMapInt64Bool map[int64]bool + FptrMapInt64Bool *map[int64]bool + FMapBoolIntf map[bool]interface{} + FptrMapBoolIntf *map[bool]interface{} + FMapBoolString map[bool]string + FptrMapBoolString *map[bool]string + FMapBoolUint map[bool]uint + FptrMapBoolUint *map[bool]uint + FMapBoolUint8 map[bool]uint8 + FptrMapBoolUint8 *map[bool]uint8 + FMapBoolUint16 map[bool]uint16 + FptrMapBoolUint16 *map[bool]uint16 + FMapBoolUint32 map[bool]uint32 + FptrMapBoolUint32 *map[bool]uint32 + FMapBoolUint64 map[bool]uint64 + FptrMapBoolUint64 *map[bool]uint64 + FMapBoolUintptr map[bool]uintptr + FptrMapBoolUintptr *map[bool]uintptr + FMapBoolInt map[bool]int + FptrMapBoolInt *map[bool]int + FMapBoolInt8 map[bool]int8 + FptrMapBoolInt8 *map[bool]int8 + FMapBoolInt16 map[bool]int16 + FptrMapBoolInt16 *map[bool]int16 + FMapBoolInt32 map[bool]int32 + FptrMapBoolInt32 *map[bool]int32 + FMapBoolInt64 map[bool]int64 + FptrMapBoolInt64 *map[bool]int64 + FMapBoolFloat32 map[bool]float32 + FptrMapBoolFloat32 *map[bool]float32 + FMapBoolFloat64 map[bool]float64 + FptrMapBoolFloat64 *map[bool]float64 + FMapBoolBool map[bool]bool + FptrMapBoolBool *map[bool]bool +} + +type typMbsSliceIntf []interface{} + +func (_ typMbsSliceIntf) MapBySlice() {} + +type typMbsSliceString []string + +func (_ typMbsSliceString) MapBySlice() {} + +type typMbsSliceFloat32 []float32 + +func (_ typMbsSliceFloat32) MapBySlice() {} + +type typMbsSliceFloat64 []float64 + +func (_ typMbsSliceFloat64) MapBySlice() {} + +type typMbsSliceUint []uint + +func (_ typMbsSliceUint) MapBySlice() {} + +type typMbsSliceUint8 []uint8 + +func (_ typMbsSliceUint8) MapBySlice() {} + +type typMbsSliceUint16 []uint16 + +func (_ typMbsSliceUint16) MapBySlice() {} + +type typMbsSliceUint32 []uint32 + +func (_ typMbsSliceUint32) MapBySlice() {} + +type typMbsSliceUint64 []uint64 + +func (_ typMbsSliceUint64) MapBySlice() {} + +type typMbsSliceUintptr []uintptr + +func (_ typMbsSliceUintptr) MapBySlice() {} + +type typMbsSliceInt []int + +func (_ typMbsSliceInt) MapBySlice() {} + +type typMbsSliceInt8 []int8 + +func (_ typMbsSliceInt8) MapBySlice() {} + +type typMbsSliceInt16 []int16 + +func (_ typMbsSliceInt16) MapBySlice() {} + +type typMbsSliceInt32 []int32 + +func (_ typMbsSliceInt32) MapBySlice() {} + +type typMbsSliceInt64 []int64 + +func (_ typMbsSliceInt64) MapBySlice() {} + +type typMbsSliceBool []bool + +func (_ typMbsSliceBool) MapBySlice() {} + +type typMapMapIntfIntf map[interface{}]interface{} +type typMapMapIntfString map[interface{}]string +type typMapMapIntfUint map[interface{}]uint +type typMapMapIntfUint8 map[interface{}]uint8 +type typMapMapIntfUint16 map[interface{}]uint16 +type typMapMapIntfUint32 map[interface{}]uint32 +type typMapMapIntfUint64 map[interface{}]uint64 +type typMapMapIntfUintptr map[interface{}]uintptr +type typMapMapIntfInt map[interface{}]int +type typMapMapIntfInt8 map[interface{}]int8 +type typMapMapIntfInt16 map[interface{}]int16 +type typMapMapIntfInt32 map[interface{}]int32 +type typMapMapIntfInt64 map[interface{}]int64 +type typMapMapIntfFloat32 map[interface{}]float32 +type typMapMapIntfFloat64 map[interface{}]float64 +type typMapMapIntfBool map[interface{}]bool +type typMapMapStringIntf map[string]interface{} +type typMapMapStringString map[string]string +type typMapMapStringUint map[string]uint +type typMapMapStringUint8 map[string]uint8 +type typMapMapStringUint16 map[string]uint16 +type typMapMapStringUint32 map[string]uint32 +type typMapMapStringUint64 map[string]uint64 +type typMapMapStringUintptr map[string]uintptr +type typMapMapStringInt map[string]int +type typMapMapStringInt8 map[string]int8 +type typMapMapStringInt16 map[string]int16 +type typMapMapStringInt32 map[string]int32 +type typMapMapStringInt64 map[string]int64 +type typMapMapStringFloat32 map[string]float32 +type typMapMapStringFloat64 map[string]float64 +type typMapMapStringBool map[string]bool +type typMapMapFloat32Intf map[float32]interface{} +type typMapMapFloat32String map[float32]string +type typMapMapFloat32Uint map[float32]uint +type typMapMapFloat32Uint8 map[float32]uint8 +type typMapMapFloat32Uint16 map[float32]uint16 +type typMapMapFloat32Uint32 map[float32]uint32 +type typMapMapFloat32Uint64 map[float32]uint64 +type typMapMapFloat32Uintptr map[float32]uintptr +type typMapMapFloat32Int map[float32]int +type typMapMapFloat32Int8 map[float32]int8 +type typMapMapFloat32Int16 map[float32]int16 +type typMapMapFloat32Int32 map[float32]int32 +type typMapMapFloat32Int64 map[float32]int64 +type typMapMapFloat32Float32 map[float32]float32 +type typMapMapFloat32Float64 map[float32]float64 +type typMapMapFloat32Bool map[float32]bool +type typMapMapFloat64Intf map[float64]interface{} +type typMapMapFloat64String map[float64]string +type typMapMapFloat64Uint map[float64]uint +type typMapMapFloat64Uint8 map[float64]uint8 +type typMapMapFloat64Uint16 map[float64]uint16 +type typMapMapFloat64Uint32 map[float64]uint32 +type typMapMapFloat64Uint64 map[float64]uint64 +type typMapMapFloat64Uintptr map[float64]uintptr +type typMapMapFloat64Int map[float64]int +type typMapMapFloat64Int8 map[float64]int8 +type typMapMapFloat64Int16 map[float64]int16 +type typMapMapFloat64Int32 map[float64]int32 +type typMapMapFloat64Int64 map[float64]int64 +type typMapMapFloat64Float32 map[float64]float32 +type typMapMapFloat64Float64 map[float64]float64 +type typMapMapFloat64Bool map[float64]bool +type typMapMapUintIntf map[uint]interface{} +type typMapMapUintString map[uint]string +type typMapMapUintUint map[uint]uint +type typMapMapUintUint8 map[uint]uint8 +type typMapMapUintUint16 map[uint]uint16 +type typMapMapUintUint32 map[uint]uint32 +type typMapMapUintUint64 map[uint]uint64 +type typMapMapUintUintptr map[uint]uintptr +type typMapMapUintInt map[uint]int +type typMapMapUintInt8 map[uint]int8 +type typMapMapUintInt16 map[uint]int16 +type typMapMapUintInt32 map[uint]int32 +type typMapMapUintInt64 map[uint]int64 +type typMapMapUintFloat32 map[uint]float32 +type typMapMapUintFloat64 map[uint]float64 +type typMapMapUintBool map[uint]bool +type typMapMapUint8Intf map[uint8]interface{} +type typMapMapUint8String map[uint8]string +type typMapMapUint8Uint map[uint8]uint +type typMapMapUint8Uint8 map[uint8]uint8 +type typMapMapUint8Uint16 map[uint8]uint16 +type typMapMapUint8Uint32 map[uint8]uint32 +type typMapMapUint8Uint64 map[uint8]uint64 +type typMapMapUint8Uintptr map[uint8]uintptr +type typMapMapUint8Int map[uint8]int +type typMapMapUint8Int8 map[uint8]int8 +type typMapMapUint8Int16 map[uint8]int16 +type typMapMapUint8Int32 map[uint8]int32 +type typMapMapUint8Int64 map[uint8]int64 +type typMapMapUint8Float32 map[uint8]float32 +type typMapMapUint8Float64 map[uint8]float64 +type typMapMapUint8Bool map[uint8]bool +type typMapMapUint16Intf map[uint16]interface{} +type typMapMapUint16String map[uint16]string +type typMapMapUint16Uint map[uint16]uint +type typMapMapUint16Uint8 map[uint16]uint8 +type typMapMapUint16Uint16 map[uint16]uint16 +type typMapMapUint16Uint32 map[uint16]uint32 +type typMapMapUint16Uint64 map[uint16]uint64 +type typMapMapUint16Uintptr map[uint16]uintptr +type typMapMapUint16Int map[uint16]int +type typMapMapUint16Int8 map[uint16]int8 +type typMapMapUint16Int16 map[uint16]int16 +type typMapMapUint16Int32 map[uint16]int32 +type typMapMapUint16Int64 map[uint16]int64 +type typMapMapUint16Float32 map[uint16]float32 +type typMapMapUint16Float64 map[uint16]float64 +type typMapMapUint16Bool map[uint16]bool +type typMapMapUint32Intf map[uint32]interface{} +type typMapMapUint32String map[uint32]string +type typMapMapUint32Uint map[uint32]uint +type typMapMapUint32Uint8 map[uint32]uint8 +type typMapMapUint32Uint16 map[uint32]uint16 +type typMapMapUint32Uint32 map[uint32]uint32 +type typMapMapUint32Uint64 map[uint32]uint64 +type typMapMapUint32Uintptr map[uint32]uintptr +type typMapMapUint32Int map[uint32]int +type typMapMapUint32Int8 map[uint32]int8 +type typMapMapUint32Int16 map[uint32]int16 +type typMapMapUint32Int32 map[uint32]int32 +type typMapMapUint32Int64 map[uint32]int64 +type typMapMapUint32Float32 map[uint32]float32 +type typMapMapUint32Float64 map[uint32]float64 +type typMapMapUint32Bool map[uint32]bool +type typMapMapUint64Intf map[uint64]interface{} +type typMapMapUint64String map[uint64]string +type typMapMapUint64Uint map[uint64]uint +type typMapMapUint64Uint8 map[uint64]uint8 +type typMapMapUint64Uint16 map[uint64]uint16 +type typMapMapUint64Uint32 map[uint64]uint32 +type typMapMapUint64Uint64 map[uint64]uint64 +type typMapMapUint64Uintptr map[uint64]uintptr +type typMapMapUint64Int map[uint64]int +type typMapMapUint64Int8 map[uint64]int8 +type typMapMapUint64Int16 map[uint64]int16 +type typMapMapUint64Int32 map[uint64]int32 +type typMapMapUint64Int64 map[uint64]int64 +type typMapMapUint64Float32 map[uint64]float32 +type typMapMapUint64Float64 map[uint64]float64 +type typMapMapUint64Bool map[uint64]bool +type typMapMapUintptrIntf map[uintptr]interface{} +type typMapMapUintptrString map[uintptr]string +type typMapMapUintptrUint map[uintptr]uint +type typMapMapUintptrUint8 map[uintptr]uint8 +type typMapMapUintptrUint16 map[uintptr]uint16 +type typMapMapUintptrUint32 map[uintptr]uint32 +type typMapMapUintptrUint64 map[uintptr]uint64 +type typMapMapUintptrUintptr map[uintptr]uintptr +type typMapMapUintptrInt map[uintptr]int +type typMapMapUintptrInt8 map[uintptr]int8 +type typMapMapUintptrInt16 map[uintptr]int16 +type typMapMapUintptrInt32 map[uintptr]int32 +type typMapMapUintptrInt64 map[uintptr]int64 +type typMapMapUintptrFloat32 map[uintptr]float32 +type typMapMapUintptrFloat64 map[uintptr]float64 +type typMapMapUintptrBool map[uintptr]bool +type typMapMapIntIntf map[int]interface{} +type typMapMapIntString map[int]string +type typMapMapIntUint map[int]uint +type typMapMapIntUint8 map[int]uint8 +type typMapMapIntUint16 map[int]uint16 +type typMapMapIntUint32 map[int]uint32 +type typMapMapIntUint64 map[int]uint64 +type typMapMapIntUintptr map[int]uintptr +type typMapMapIntInt map[int]int +type typMapMapIntInt8 map[int]int8 +type typMapMapIntInt16 map[int]int16 +type typMapMapIntInt32 map[int]int32 +type typMapMapIntInt64 map[int]int64 +type typMapMapIntFloat32 map[int]float32 +type typMapMapIntFloat64 map[int]float64 +type typMapMapIntBool map[int]bool +type typMapMapInt8Intf map[int8]interface{} +type typMapMapInt8String map[int8]string +type typMapMapInt8Uint map[int8]uint +type typMapMapInt8Uint8 map[int8]uint8 +type typMapMapInt8Uint16 map[int8]uint16 +type typMapMapInt8Uint32 map[int8]uint32 +type typMapMapInt8Uint64 map[int8]uint64 +type typMapMapInt8Uintptr map[int8]uintptr +type typMapMapInt8Int map[int8]int +type typMapMapInt8Int8 map[int8]int8 +type typMapMapInt8Int16 map[int8]int16 +type typMapMapInt8Int32 map[int8]int32 +type typMapMapInt8Int64 map[int8]int64 +type typMapMapInt8Float32 map[int8]float32 +type typMapMapInt8Float64 map[int8]float64 +type typMapMapInt8Bool map[int8]bool +type typMapMapInt16Intf map[int16]interface{} +type typMapMapInt16String map[int16]string +type typMapMapInt16Uint map[int16]uint +type typMapMapInt16Uint8 map[int16]uint8 +type typMapMapInt16Uint16 map[int16]uint16 +type typMapMapInt16Uint32 map[int16]uint32 +type typMapMapInt16Uint64 map[int16]uint64 +type typMapMapInt16Uintptr map[int16]uintptr +type typMapMapInt16Int map[int16]int +type typMapMapInt16Int8 map[int16]int8 +type typMapMapInt16Int16 map[int16]int16 +type typMapMapInt16Int32 map[int16]int32 +type typMapMapInt16Int64 map[int16]int64 +type typMapMapInt16Float32 map[int16]float32 +type typMapMapInt16Float64 map[int16]float64 +type typMapMapInt16Bool map[int16]bool +type typMapMapInt32Intf map[int32]interface{} +type typMapMapInt32String map[int32]string +type typMapMapInt32Uint map[int32]uint +type typMapMapInt32Uint8 map[int32]uint8 +type typMapMapInt32Uint16 map[int32]uint16 +type typMapMapInt32Uint32 map[int32]uint32 +type typMapMapInt32Uint64 map[int32]uint64 +type typMapMapInt32Uintptr map[int32]uintptr +type typMapMapInt32Int map[int32]int +type typMapMapInt32Int8 map[int32]int8 +type typMapMapInt32Int16 map[int32]int16 +type typMapMapInt32Int32 map[int32]int32 +type typMapMapInt32Int64 map[int32]int64 +type typMapMapInt32Float32 map[int32]float32 +type typMapMapInt32Float64 map[int32]float64 +type typMapMapInt32Bool map[int32]bool +type typMapMapInt64Intf map[int64]interface{} +type typMapMapInt64String map[int64]string +type typMapMapInt64Uint map[int64]uint +type typMapMapInt64Uint8 map[int64]uint8 +type typMapMapInt64Uint16 map[int64]uint16 +type typMapMapInt64Uint32 map[int64]uint32 +type typMapMapInt64Uint64 map[int64]uint64 +type typMapMapInt64Uintptr map[int64]uintptr +type typMapMapInt64Int map[int64]int +type typMapMapInt64Int8 map[int64]int8 +type typMapMapInt64Int16 map[int64]int16 +type typMapMapInt64Int32 map[int64]int32 +type typMapMapInt64Int64 map[int64]int64 +type typMapMapInt64Float32 map[int64]float32 +type typMapMapInt64Float64 map[int64]float64 +type typMapMapInt64Bool map[int64]bool +type typMapMapBoolIntf map[bool]interface{} +type typMapMapBoolString map[bool]string +type typMapMapBoolUint map[bool]uint +type typMapMapBoolUint8 map[bool]uint8 +type typMapMapBoolUint16 map[bool]uint16 +type typMapMapBoolUint32 map[bool]uint32 +type typMapMapBoolUint64 map[bool]uint64 +type typMapMapBoolUintptr map[bool]uintptr +type typMapMapBoolInt map[bool]int +type typMapMapBoolInt8 map[bool]int8 +type typMapMapBoolInt16 map[bool]int16 +type typMapMapBoolInt32 map[bool]int32 +type typMapMapBoolInt64 map[bool]int64 +type typMapMapBoolFloat32 map[bool]float32 +type typMapMapBoolFloat64 map[bool]float64 +type typMapMapBoolBool map[bool]bool + +func doTestMammothSlices(t *testing.T, h Handle) { + + var v1va [8]interface{} + for _, v := range [][]interface{}{nil, {}, {"string-is-an-interface-2", nil, nil, "string-is-an-interface"}} { + var v1v1, v1v2 []interface{} + v1v1 = v + bs1 := testMarshalErr(v1v1, h, t, "enc-slice-v1") + if v == nil { + v1v2 = nil + } else { + v1v2 = make([]interface{}, len(v)) + } + testUnmarshalErr(v1v2, bs1, h, t, "dec-slice-v1") + testDeepEqualErr(v1v1, v1v2, t, "equal-slice-v1") + if v == nil { + v1v2 = nil + } else { + v1v2 = make([]interface{}, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v1v2), bs1, h, t, "dec-slice-v1-noaddr") // non-addressable value + testDeepEqualErr(v1v1, v1v2, t, "equal-slice-v1-noaddr") + // ... + bs1 = testMarshalErr(&v1v1, h, t, "enc-slice-v1-p") + v1v2 = nil + testUnmarshalErr(&v1v2, bs1, h, t, "dec-slice-v1-p") + testDeepEqualErr(v1v1, v1v2, t, "equal-slice-v1-p") + v1va = [8]interface{}{} // clear the array + v1v2 = v1va[:1:1] + testUnmarshalErr(&v1v2, bs1, h, t, "dec-slice-v1-p-1") + testDeepEqualErr(v1v1, v1v2, t, "equal-slice-v1-p-1") + v1va = [8]interface{}{} // clear the array + v1v2 = v1va[:len(v1v1):len(v1v1)] + testUnmarshalErr(&v1v2, bs1, h, t, "dec-slice-v1-p-len") + testDeepEqualErr(v1v1, v1v2, t, "equal-slice-v1-p-len") + v1va = [8]interface{}{} // clear the array + v1v2 = v1va[:] + testUnmarshalErr(&v1v2, bs1, h, t, "dec-slice-v1-p-cap") + testDeepEqualErr(v1v1, v1v2, t, "equal-slice-v1-p-cap") + if len(v1v1) > 1 { + v1va = [8]interface{}{} // clear the array + testUnmarshalErr((&v1va)[:len(v1v1)], bs1, h, t, "dec-slice-v1-p-len-noaddr") + testDeepEqualErr(v1v1, v1va[:len(v1v1)], t, "equal-slice-v1-p-len-noaddr") + v1va = [8]interface{}{} // clear the array + testUnmarshalErr((&v1va)[:], bs1, h, t, "dec-slice-v1-p-cap-noaddr") + testDeepEqualErr(v1v1, v1va[:len(v1v1)], t, "equal-slice-v1-p-cap-noaddr") + } + // ... + var v1v3, v1v4 typMbsSliceIntf + v1v2 = nil + if v != nil { + v1v2 = make([]interface{}, len(v)) + } + v1v3 = typMbsSliceIntf(v1v1) + v1v4 = typMbsSliceIntf(v1v2) + bs1 = testMarshalErr(v1v3, h, t, "enc-slice-v1-custom") + testUnmarshalErr(v1v4, bs1, h, t, "dec-slice-v1-custom") + testDeepEqualErr(v1v3, v1v4, t, "equal-slice-v1-custom") + bs1 = testMarshalErr(&v1v3, h, t, "enc-slice-v1-custom-p") + v1v2 = nil + v1v4 = typMbsSliceIntf(v1v2) + testUnmarshalErr(&v1v4, bs1, h, t, "dec-slice-v1-custom-p") + testDeepEqualErr(v1v3, v1v4, t, "equal-slice-v1-custom-p") + } + + var v19va [8]string + for _, v := range [][]string{nil, {}, {"some-string-2", "", "", "some-string"}} { + var v19v1, v19v2 []string + v19v1 = v + bs19 := testMarshalErr(v19v1, h, t, "enc-slice-v19") + if v == nil { + v19v2 = nil + } else { + v19v2 = make([]string, len(v)) + } + testUnmarshalErr(v19v2, bs19, h, t, "dec-slice-v19") + testDeepEqualErr(v19v1, v19v2, t, "equal-slice-v19") + if v == nil { + v19v2 = nil + } else { + v19v2 = make([]string, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v19v2), bs19, h, t, "dec-slice-v19-noaddr") // non-addressable value + testDeepEqualErr(v19v1, v19v2, t, "equal-slice-v19-noaddr") + // ... + bs19 = testMarshalErr(&v19v1, h, t, "enc-slice-v19-p") + v19v2 = nil + testUnmarshalErr(&v19v2, bs19, h, t, "dec-slice-v19-p") + testDeepEqualErr(v19v1, v19v2, t, "equal-slice-v19-p") + v19va = [8]string{} // clear the array + v19v2 = v19va[:1:1] + testUnmarshalErr(&v19v2, bs19, h, t, "dec-slice-v19-p-1") + testDeepEqualErr(v19v1, v19v2, t, "equal-slice-v19-p-1") + v19va = [8]string{} // clear the array + v19v2 = v19va[:len(v19v1):len(v19v1)] + testUnmarshalErr(&v19v2, bs19, h, t, "dec-slice-v19-p-len") + testDeepEqualErr(v19v1, v19v2, t, "equal-slice-v19-p-len") + v19va = [8]string{} // clear the array + v19v2 = v19va[:] + testUnmarshalErr(&v19v2, bs19, h, t, "dec-slice-v19-p-cap") + testDeepEqualErr(v19v1, v19v2, t, "equal-slice-v19-p-cap") + if len(v19v1) > 1 { + v19va = [8]string{} // clear the array + testUnmarshalErr((&v19va)[:len(v19v1)], bs19, h, t, "dec-slice-v19-p-len-noaddr") + testDeepEqualErr(v19v1, v19va[:len(v19v1)], t, "equal-slice-v19-p-len-noaddr") + v19va = [8]string{} // clear the array + testUnmarshalErr((&v19va)[:], bs19, h, t, "dec-slice-v19-p-cap-noaddr") + testDeepEqualErr(v19v1, v19va[:len(v19v1)], t, "equal-slice-v19-p-cap-noaddr") + } + // ... + var v19v3, v19v4 typMbsSliceString + v19v2 = nil + if v != nil { + v19v2 = make([]string, len(v)) + } + v19v3 = typMbsSliceString(v19v1) + v19v4 = typMbsSliceString(v19v2) + bs19 = testMarshalErr(v19v3, h, t, "enc-slice-v19-custom") + testUnmarshalErr(v19v4, bs19, h, t, "dec-slice-v19-custom") + testDeepEqualErr(v19v3, v19v4, t, "equal-slice-v19-custom") + bs19 = testMarshalErr(&v19v3, h, t, "enc-slice-v19-custom-p") + v19v2 = nil + v19v4 = typMbsSliceString(v19v2) + testUnmarshalErr(&v19v4, bs19, h, t, "dec-slice-v19-custom-p") + testDeepEqualErr(v19v3, v19v4, t, "equal-slice-v19-custom-p") + } + + var v37va [8]float32 + for _, v := range [][]float32{nil, {}, {22.2, 0, 0, 11.1}} { + var v37v1, v37v2 []float32 + v37v1 = v + bs37 := testMarshalErr(v37v1, h, t, "enc-slice-v37") + if v == nil { + v37v2 = nil + } else { + v37v2 = make([]float32, len(v)) + } + testUnmarshalErr(v37v2, bs37, h, t, "dec-slice-v37") + testDeepEqualErr(v37v1, v37v2, t, "equal-slice-v37") + if v == nil { + v37v2 = nil + } else { + v37v2 = make([]float32, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v37v2), bs37, h, t, "dec-slice-v37-noaddr") // non-addressable value + testDeepEqualErr(v37v1, v37v2, t, "equal-slice-v37-noaddr") + // ... + bs37 = testMarshalErr(&v37v1, h, t, "enc-slice-v37-p") + v37v2 = nil + testUnmarshalErr(&v37v2, bs37, h, t, "dec-slice-v37-p") + testDeepEqualErr(v37v1, v37v2, t, "equal-slice-v37-p") + v37va = [8]float32{} // clear the array + v37v2 = v37va[:1:1] + testUnmarshalErr(&v37v2, bs37, h, t, "dec-slice-v37-p-1") + testDeepEqualErr(v37v1, v37v2, t, "equal-slice-v37-p-1") + v37va = [8]float32{} // clear the array + v37v2 = v37va[:len(v37v1):len(v37v1)] + testUnmarshalErr(&v37v2, bs37, h, t, "dec-slice-v37-p-len") + testDeepEqualErr(v37v1, v37v2, t, "equal-slice-v37-p-len") + v37va = [8]float32{} // clear the array + v37v2 = v37va[:] + testUnmarshalErr(&v37v2, bs37, h, t, "dec-slice-v37-p-cap") + testDeepEqualErr(v37v1, v37v2, t, "equal-slice-v37-p-cap") + if len(v37v1) > 1 { + v37va = [8]float32{} // clear the array + testUnmarshalErr((&v37va)[:len(v37v1)], bs37, h, t, "dec-slice-v37-p-len-noaddr") + testDeepEqualErr(v37v1, v37va[:len(v37v1)], t, "equal-slice-v37-p-len-noaddr") + v37va = [8]float32{} // clear the array + testUnmarshalErr((&v37va)[:], bs37, h, t, "dec-slice-v37-p-cap-noaddr") + testDeepEqualErr(v37v1, v37va[:len(v37v1)], t, "equal-slice-v37-p-cap-noaddr") + } + // ... + var v37v3, v37v4 typMbsSliceFloat32 + v37v2 = nil + if v != nil { + v37v2 = make([]float32, len(v)) + } + v37v3 = typMbsSliceFloat32(v37v1) + v37v4 = typMbsSliceFloat32(v37v2) + bs37 = testMarshalErr(v37v3, h, t, "enc-slice-v37-custom") + testUnmarshalErr(v37v4, bs37, h, t, "dec-slice-v37-custom") + testDeepEqualErr(v37v3, v37v4, t, "equal-slice-v37-custom") + bs37 = testMarshalErr(&v37v3, h, t, "enc-slice-v37-custom-p") + v37v2 = nil + v37v4 = typMbsSliceFloat32(v37v2) + testUnmarshalErr(&v37v4, bs37, h, t, "dec-slice-v37-custom-p") + testDeepEqualErr(v37v3, v37v4, t, "equal-slice-v37-custom-p") + } + + var v55va [8]float64 + for _, v := range [][]float64{nil, {}, {22.2, 0, 0, 11.1}} { + var v55v1, v55v2 []float64 + v55v1 = v + bs55 := testMarshalErr(v55v1, h, t, "enc-slice-v55") + if v == nil { + v55v2 = nil + } else { + v55v2 = make([]float64, len(v)) + } + testUnmarshalErr(v55v2, bs55, h, t, "dec-slice-v55") + testDeepEqualErr(v55v1, v55v2, t, "equal-slice-v55") + if v == nil { + v55v2 = nil + } else { + v55v2 = make([]float64, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v55v2), bs55, h, t, "dec-slice-v55-noaddr") // non-addressable value + testDeepEqualErr(v55v1, v55v2, t, "equal-slice-v55-noaddr") + // ... + bs55 = testMarshalErr(&v55v1, h, t, "enc-slice-v55-p") + v55v2 = nil + testUnmarshalErr(&v55v2, bs55, h, t, "dec-slice-v55-p") + testDeepEqualErr(v55v1, v55v2, t, "equal-slice-v55-p") + v55va = [8]float64{} // clear the array + v55v2 = v55va[:1:1] + testUnmarshalErr(&v55v2, bs55, h, t, "dec-slice-v55-p-1") + testDeepEqualErr(v55v1, v55v2, t, "equal-slice-v55-p-1") + v55va = [8]float64{} // clear the array + v55v2 = v55va[:len(v55v1):len(v55v1)] + testUnmarshalErr(&v55v2, bs55, h, t, "dec-slice-v55-p-len") + testDeepEqualErr(v55v1, v55v2, t, "equal-slice-v55-p-len") + v55va = [8]float64{} // clear the array + v55v2 = v55va[:] + testUnmarshalErr(&v55v2, bs55, h, t, "dec-slice-v55-p-cap") + testDeepEqualErr(v55v1, v55v2, t, "equal-slice-v55-p-cap") + if len(v55v1) > 1 { + v55va = [8]float64{} // clear the array + testUnmarshalErr((&v55va)[:len(v55v1)], bs55, h, t, "dec-slice-v55-p-len-noaddr") + testDeepEqualErr(v55v1, v55va[:len(v55v1)], t, "equal-slice-v55-p-len-noaddr") + v55va = [8]float64{} // clear the array + testUnmarshalErr((&v55va)[:], bs55, h, t, "dec-slice-v55-p-cap-noaddr") + testDeepEqualErr(v55v1, v55va[:len(v55v1)], t, "equal-slice-v55-p-cap-noaddr") + } + // ... + var v55v3, v55v4 typMbsSliceFloat64 + v55v2 = nil + if v != nil { + v55v2 = make([]float64, len(v)) + } + v55v3 = typMbsSliceFloat64(v55v1) + v55v4 = typMbsSliceFloat64(v55v2) + bs55 = testMarshalErr(v55v3, h, t, "enc-slice-v55-custom") + testUnmarshalErr(v55v4, bs55, h, t, "dec-slice-v55-custom") + testDeepEqualErr(v55v3, v55v4, t, "equal-slice-v55-custom") + bs55 = testMarshalErr(&v55v3, h, t, "enc-slice-v55-custom-p") + v55v2 = nil + v55v4 = typMbsSliceFloat64(v55v2) + testUnmarshalErr(&v55v4, bs55, h, t, "dec-slice-v55-custom-p") + testDeepEqualErr(v55v3, v55v4, t, "equal-slice-v55-custom-p") + } + + var v73va [8]uint + for _, v := range [][]uint{nil, {}, {44, 0, 0, 33}} { + var v73v1, v73v2 []uint + v73v1 = v + bs73 := testMarshalErr(v73v1, h, t, "enc-slice-v73") + if v == nil { + v73v2 = nil + } else { + v73v2 = make([]uint, len(v)) + } + testUnmarshalErr(v73v2, bs73, h, t, "dec-slice-v73") + testDeepEqualErr(v73v1, v73v2, t, "equal-slice-v73") + if v == nil { + v73v2 = nil + } else { + v73v2 = make([]uint, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v73v2), bs73, h, t, "dec-slice-v73-noaddr") // non-addressable value + testDeepEqualErr(v73v1, v73v2, t, "equal-slice-v73-noaddr") + // ... + bs73 = testMarshalErr(&v73v1, h, t, "enc-slice-v73-p") + v73v2 = nil + testUnmarshalErr(&v73v2, bs73, h, t, "dec-slice-v73-p") + testDeepEqualErr(v73v1, v73v2, t, "equal-slice-v73-p") + v73va = [8]uint{} // clear the array + v73v2 = v73va[:1:1] + testUnmarshalErr(&v73v2, bs73, h, t, "dec-slice-v73-p-1") + testDeepEqualErr(v73v1, v73v2, t, "equal-slice-v73-p-1") + v73va = [8]uint{} // clear the array + v73v2 = v73va[:len(v73v1):len(v73v1)] + testUnmarshalErr(&v73v2, bs73, h, t, "dec-slice-v73-p-len") + testDeepEqualErr(v73v1, v73v2, t, "equal-slice-v73-p-len") + v73va = [8]uint{} // clear the array + v73v2 = v73va[:] + testUnmarshalErr(&v73v2, bs73, h, t, "dec-slice-v73-p-cap") + testDeepEqualErr(v73v1, v73v2, t, "equal-slice-v73-p-cap") + if len(v73v1) > 1 { + v73va = [8]uint{} // clear the array + testUnmarshalErr((&v73va)[:len(v73v1)], bs73, h, t, "dec-slice-v73-p-len-noaddr") + testDeepEqualErr(v73v1, v73va[:len(v73v1)], t, "equal-slice-v73-p-len-noaddr") + v73va = [8]uint{} // clear the array + testUnmarshalErr((&v73va)[:], bs73, h, t, "dec-slice-v73-p-cap-noaddr") + testDeepEqualErr(v73v1, v73va[:len(v73v1)], t, "equal-slice-v73-p-cap-noaddr") + } + // ... + var v73v3, v73v4 typMbsSliceUint + v73v2 = nil + if v != nil { + v73v2 = make([]uint, len(v)) + } + v73v3 = typMbsSliceUint(v73v1) + v73v4 = typMbsSliceUint(v73v2) + bs73 = testMarshalErr(v73v3, h, t, "enc-slice-v73-custom") + testUnmarshalErr(v73v4, bs73, h, t, "dec-slice-v73-custom") + testDeepEqualErr(v73v3, v73v4, t, "equal-slice-v73-custom") + bs73 = testMarshalErr(&v73v3, h, t, "enc-slice-v73-custom-p") + v73v2 = nil + v73v4 = typMbsSliceUint(v73v2) + testUnmarshalErr(&v73v4, bs73, h, t, "dec-slice-v73-custom-p") + testDeepEqualErr(v73v3, v73v4, t, "equal-slice-v73-custom-p") + } + + var v91va [8]uint8 + for _, v := range [][]uint8{nil, {}, {44, 0, 0, 33}} { + var v91v1, v91v2 []uint8 + v91v1 = v + bs91 := testMarshalErr(v91v1, h, t, "enc-slice-v91") + if v == nil { + v91v2 = nil + } else { + v91v2 = make([]uint8, len(v)) + } + testUnmarshalErr(v91v2, bs91, h, t, "dec-slice-v91") + testDeepEqualErr(v91v1, v91v2, t, "equal-slice-v91") + if v == nil { + v91v2 = nil + } else { + v91v2 = make([]uint8, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v91v2), bs91, h, t, "dec-slice-v91-noaddr") // non-addressable value + testDeepEqualErr(v91v1, v91v2, t, "equal-slice-v91-noaddr") + // ... + bs91 = testMarshalErr(&v91v1, h, t, "enc-slice-v91-p") + v91v2 = nil + testUnmarshalErr(&v91v2, bs91, h, t, "dec-slice-v91-p") + testDeepEqualErr(v91v1, v91v2, t, "equal-slice-v91-p") + v91va = [8]uint8{} // clear the array + v91v2 = v91va[:1:1] + testUnmarshalErr(&v91v2, bs91, h, t, "dec-slice-v91-p-1") + testDeepEqualErr(v91v1, v91v2, t, "equal-slice-v91-p-1") + v91va = [8]uint8{} // clear the array + v91v2 = v91va[:len(v91v1):len(v91v1)] + testUnmarshalErr(&v91v2, bs91, h, t, "dec-slice-v91-p-len") + testDeepEqualErr(v91v1, v91v2, t, "equal-slice-v91-p-len") + v91va = [8]uint8{} // clear the array + v91v2 = v91va[:] + testUnmarshalErr(&v91v2, bs91, h, t, "dec-slice-v91-p-cap") + testDeepEqualErr(v91v1, v91v2, t, "equal-slice-v91-p-cap") + if len(v91v1) > 1 { + v91va = [8]uint8{} // clear the array + testUnmarshalErr((&v91va)[:len(v91v1)], bs91, h, t, "dec-slice-v91-p-len-noaddr") + testDeepEqualErr(v91v1, v91va[:len(v91v1)], t, "equal-slice-v91-p-len-noaddr") + v91va = [8]uint8{} // clear the array + testUnmarshalErr((&v91va)[:], bs91, h, t, "dec-slice-v91-p-cap-noaddr") + testDeepEqualErr(v91v1, v91va[:len(v91v1)], t, "equal-slice-v91-p-cap-noaddr") + } + // ... + var v91v3, v91v4 typMbsSliceUint8 + v91v2 = nil + if v != nil { + v91v2 = make([]uint8, len(v)) + } + v91v3 = typMbsSliceUint8(v91v1) + v91v4 = typMbsSliceUint8(v91v2) + bs91 = testMarshalErr(v91v3, h, t, "enc-slice-v91-custom") + testUnmarshalErr(v91v4, bs91, h, t, "dec-slice-v91-custom") + testDeepEqualErr(v91v3, v91v4, t, "equal-slice-v91-custom") + bs91 = testMarshalErr(&v91v3, h, t, "enc-slice-v91-custom-p") + v91v2 = nil + v91v4 = typMbsSliceUint8(v91v2) + testUnmarshalErr(&v91v4, bs91, h, t, "dec-slice-v91-custom-p") + testDeepEqualErr(v91v3, v91v4, t, "equal-slice-v91-custom-p") + } + + var v109va [8]uint16 + for _, v := range [][]uint16{nil, {}, {44, 0, 0, 33}} { + var v109v1, v109v2 []uint16 + v109v1 = v + bs109 := testMarshalErr(v109v1, h, t, "enc-slice-v109") + if v == nil { + v109v2 = nil + } else { + v109v2 = make([]uint16, len(v)) + } + testUnmarshalErr(v109v2, bs109, h, t, "dec-slice-v109") + testDeepEqualErr(v109v1, v109v2, t, "equal-slice-v109") + if v == nil { + v109v2 = nil + } else { + v109v2 = make([]uint16, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v109v2), bs109, h, t, "dec-slice-v109-noaddr") // non-addressable value + testDeepEqualErr(v109v1, v109v2, t, "equal-slice-v109-noaddr") + // ... + bs109 = testMarshalErr(&v109v1, h, t, "enc-slice-v109-p") + v109v2 = nil + testUnmarshalErr(&v109v2, bs109, h, t, "dec-slice-v109-p") + testDeepEqualErr(v109v1, v109v2, t, "equal-slice-v109-p") + v109va = [8]uint16{} // clear the array + v109v2 = v109va[:1:1] + testUnmarshalErr(&v109v2, bs109, h, t, "dec-slice-v109-p-1") + testDeepEqualErr(v109v1, v109v2, t, "equal-slice-v109-p-1") + v109va = [8]uint16{} // clear the array + v109v2 = v109va[:len(v109v1):len(v109v1)] + testUnmarshalErr(&v109v2, bs109, h, t, "dec-slice-v109-p-len") + testDeepEqualErr(v109v1, v109v2, t, "equal-slice-v109-p-len") + v109va = [8]uint16{} // clear the array + v109v2 = v109va[:] + testUnmarshalErr(&v109v2, bs109, h, t, "dec-slice-v109-p-cap") + testDeepEqualErr(v109v1, v109v2, t, "equal-slice-v109-p-cap") + if len(v109v1) > 1 { + v109va = [8]uint16{} // clear the array + testUnmarshalErr((&v109va)[:len(v109v1)], bs109, h, t, "dec-slice-v109-p-len-noaddr") + testDeepEqualErr(v109v1, v109va[:len(v109v1)], t, "equal-slice-v109-p-len-noaddr") + v109va = [8]uint16{} // clear the array + testUnmarshalErr((&v109va)[:], bs109, h, t, "dec-slice-v109-p-cap-noaddr") + testDeepEqualErr(v109v1, v109va[:len(v109v1)], t, "equal-slice-v109-p-cap-noaddr") + } + // ... + var v109v3, v109v4 typMbsSliceUint16 + v109v2 = nil + if v != nil { + v109v2 = make([]uint16, len(v)) + } + v109v3 = typMbsSliceUint16(v109v1) + v109v4 = typMbsSliceUint16(v109v2) + bs109 = testMarshalErr(v109v3, h, t, "enc-slice-v109-custom") + testUnmarshalErr(v109v4, bs109, h, t, "dec-slice-v109-custom") + testDeepEqualErr(v109v3, v109v4, t, "equal-slice-v109-custom") + bs109 = testMarshalErr(&v109v3, h, t, "enc-slice-v109-custom-p") + v109v2 = nil + v109v4 = typMbsSliceUint16(v109v2) + testUnmarshalErr(&v109v4, bs109, h, t, "dec-slice-v109-custom-p") + testDeepEqualErr(v109v3, v109v4, t, "equal-slice-v109-custom-p") + } + + var v127va [8]uint32 + for _, v := range [][]uint32{nil, {}, {44, 0, 0, 33}} { + var v127v1, v127v2 []uint32 + v127v1 = v + bs127 := testMarshalErr(v127v1, h, t, "enc-slice-v127") + if v == nil { + v127v2 = nil + } else { + v127v2 = make([]uint32, len(v)) + } + testUnmarshalErr(v127v2, bs127, h, t, "dec-slice-v127") + testDeepEqualErr(v127v1, v127v2, t, "equal-slice-v127") + if v == nil { + v127v2 = nil + } else { + v127v2 = make([]uint32, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v127v2), bs127, h, t, "dec-slice-v127-noaddr") // non-addressable value + testDeepEqualErr(v127v1, v127v2, t, "equal-slice-v127-noaddr") + // ... + bs127 = testMarshalErr(&v127v1, h, t, "enc-slice-v127-p") + v127v2 = nil + testUnmarshalErr(&v127v2, bs127, h, t, "dec-slice-v127-p") + testDeepEqualErr(v127v1, v127v2, t, "equal-slice-v127-p") + v127va = [8]uint32{} // clear the array + v127v2 = v127va[:1:1] + testUnmarshalErr(&v127v2, bs127, h, t, "dec-slice-v127-p-1") + testDeepEqualErr(v127v1, v127v2, t, "equal-slice-v127-p-1") + v127va = [8]uint32{} // clear the array + v127v2 = v127va[:len(v127v1):len(v127v1)] + testUnmarshalErr(&v127v2, bs127, h, t, "dec-slice-v127-p-len") + testDeepEqualErr(v127v1, v127v2, t, "equal-slice-v127-p-len") + v127va = [8]uint32{} // clear the array + v127v2 = v127va[:] + testUnmarshalErr(&v127v2, bs127, h, t, "dec-slice-v127-p-cap") + testDeepEqualErr(v127v1, v127v2, t, "equal-slice-v127-p-cap") + if len(v127v1) > 1 { + v127va = [8]uint32{} // clear the array + testUnmarshalErr((&v127va)[:len(v127v1)], bs127, h, t, "dec-slice-v127-p-len-noaddr") + testDeepEqualErr(v127v1, v127va[:len(v127v1)], t, "equal-slice-v127-p-len-noaddr") + v127va = [8]uint32{} // clear the array + testUnmarshalErr((&v127va)[:], bs127, h, t, "dec-slice-v127-p-cap-noaddr") + testDeepEqualErr(v127v1, v127va[:len(v127v1)], t, "equal-slice-v127-p-cap-noaddr") + } + // ... + var v127v3, v127v4 typMbsSliceUint32 + v127v2 = nil + if v != nil { + v127v2 = make([]uint32, len(v)) + } + v127v3 = typMbsSliceUint32(v127v1) + v127v4 = typMbsSliceUint32(v127v2) + bs127 = testMarshalErr(v127v3, h, t, "enc-slice-v127-custom") + testUnmarshalErr(v127v4, bs127, h, t, "dec-slice-v127-custom") + testDeepEqualErr(v127v3, v127v4, t, "equal-slice-v127-custom") + bs127 = testMarshalErr(&v127v3, h, t, "enc-slice-v127-custom-p") + v127v2 = nil + v127v4 = typMbsSliceUint32(v127v2) + testUnmarshalErr(&v127v4, bs127, h, t, "dec-slice-v127-custom-p") + testDeepEqualErr(v127v3, v127v4, t, "equal-slice-v127-custom-p") + } + + var v145va [8]uint64 + for _, v := range [][]uint64{nil, {}, {44, 0, 0, 33}} { + var v145v1, v145v2 []uint64 + v145v1 = v + bs145 := testMarshalErr(v145v1, h, t, "enc-slice-v145") + if v == nil { + v145v2 = nil + } else { + v145v2 = make([]uint64, len(v)) + } + testUnmarshalErr(v145v2, bs145, h, t, "dec-slice-v145") + testDeepEqualErr(v145v1, v145v2, t, "equal-slice-v145") + if v == nil { + v145v2 = nil + } else { + v145v2 = make([]uint64, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v145v2), bs145, h, t, "dec-slice-v145-noaddr") // non-addressable value + testDeepEqualErr(v145v1, v145v2, t, "equal-slice-v145-noaddr") + // ... + bs145 = testMarshalErr(&v145v1, h, t, "enc-slice-v145-p") + v145v2 = nil + testUnmarshalErr(&v145v2, bs145, h, t, "dec-slice-v145-p") + testDeepEqualErr(v145v1, v145v2, t, "equal-slice-v145-p") + v145va = [8]uint64{} // clear the array + v145v2 = v145va[:1:1] + testUnmarshalErr(&v145v2, bs145, h, t, "dec-slice-v145-p-1") + testDeepEqualErr(v145v1, v145v2, t, "equal-slice-v145-p-1") + v145va = [8]uint64{} // clear the array + v145v2 = v145va[:len(v145v1):len(v145v1)] + testUnmarshalErr(&v145v2, bs145, h, t, "dec-slice-v145-p-len") + testDeepEqualErr(v145v1, v145v2, t, "equal-slice-v145-p-len") + v145va = [8]uint64{} // clear the array + v145v2 = v145va[:] + testUnmarshalErr(&v145v2, bs145, h, t, "dec-slice-v145-p-cap") + testDeepEqualErr(v145v1, v145v2, t, "equal-slice-v145-p-cap") + if len(v145v1) > 1 { + v145va = [8]uint64{} // clear the array + testUnmarshalErr((&v145va)[:len(v145v1)], bs145, h, t, "dec-slice-v145-p-len-noaddr") + testDeepEqualErr(v145v1, v145va[:len(v145v1)], t, "equal-slice-v145-p-len-noaddr") + v145va = [8]uint64{} // clear the array + testUnmarshalErr((&v145va)[:], bs145, h, t, "dec-slice-v145-p-cap-noaddr") + testDeepEqualErr(v145v1, v145va[:len(v145v1)], t, "equal-slice-v145-p-cap-noaddr") + } + // ... + var v145v3, v145v4 typMbsSliceUint64 + v145v2 = nil + if v != nil { + v145v2 = make([]uint64, len(v)) + } + v145v3 = typMbsSliceUint64(v145v1) + v145v4 = typMbsSliceUint64(v145v2) + bs145 = testMarshalErr(v145v3, h, t, "enc-slice-v145-custom") + testUnmarshalErr(v145v4, bs145, h, t, "dec-slice-v145-custom") + testDeepEqualErr(v145v3, v145v4, t, "equal-slice-v145-custom") + bs145 = testMarshalErr(&v145v3, h, t, "enc-slice-v145-custom-p") + v145v2 = nil + v145v4 = typMbsSliceUint64(v145v2) + testUnmarshalErr(&v145v4, bs145, h, t, "dec-slice-v145-custom-p") + testDeepEqualErr(v145v3, v145v4, t, "equal-slice-v145-custom-p") + } + + var v163va [8]uintptr + for _, v := range [][]uintptr{nil, {}, {44, 0, 0, 33}} { + var v163v1, v163v2 []uintptr + v163v1 = v + bs163 := testMarshalErr(v163v1, h, t, "enc-slice-v163") + if v == nil { + v163v2 = nil + } else { + v163v2 = make([]uintptr, len(v)) + } + testUnmarshalErr(v163v2, bs163, h, t, "dec-slice-v163") + testDeepEqualErr(v163v1, v163v2, t, "equal-slice-v163") + if v == nil { + v163v2 = nil + } else { + v163v2 = make([]uintptr, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v163v2), bs163, h, t, "dec-slice-v163-noaddr") // non-addressable value + testDeepEqualErr(v163v1, v163v2, t, "equal-slice-v163-noaddr") + // ... + bs163 = testMarshalErr(&v163v1, h, t, "enc-slice-v163-p") + v163v2 = nil + testUnmarshalErr(&v163v2, bs163, h, t, "dec-slice-v163-p") + testDeepEqualErr(v163v1, v163v2, t, "equal-slice-v163-p") + v163va = [8]uintptr{} // clear the array + v163v2 = v163va[:1:1] + testUnmarshalErr(&v163v2, bs163, h, t, "dec-slice-v163-p-1") + testDeepEqualErr(v163v1, v163v2, t, "equal-slice-v163-p-1") + v163va = [8]uintptr{} // clear the array + v163v2 = v163va[:len(v163v1):len(v163v1)] + testUnmarshalErr(&v163v2, bs163, h, t, "dec-slice-v163-p-len") + testDeepEqualErr(v163v1, v163v2, t, "equal-slice-v163-p-len") + v163va = [8]uintptr{} // clear the array + v163v2 = v163va[:] + testUnmarshalErr(&v163v2, bs163, h, t, "dec-slice-v163-p-cap") + testDeepEqualErr(v163v1, v163v2, t, "equal-slice-v163-p-cap") + if len(v163v1) > 1 { + v163va = [8]uintptr{} // clear the array + testUnmarshalErr((&v163va)[:len(v163v1)], bs163, h, t, "dec-slice-v163-p-len-noaddr") + testDeepEqualErr(v163v1, v163va[:len(v163v1)], t, "equal-slice-v163-p-len-noaddr") + v163va = [8]uintptr{} // clear the array + testUnmarshalErr((&v163va)[:], bs163, h, t, "dec-slice-v163-p-cap-noaddr") + testDeepEqualErr(v163v1, v163va[:len(v163v1)], t, "equal-slice-v163-p-cap-noaddr") + } + // ... + var v163v3, v163v4 typMbsSliceUintptr + v163v2 = nil + if v != nil { + v163v2 = make([]uintptr, len(v)) + } + v163v3 = typMbsSliceUintptr(v163v1) + v163v4 = typMbsSliceUintptr(v163v2) + bs163 = testMarshalErr(v163v3, h, t, "enc-slice-v163-custom") + testUnmarshalErr(v163v4, bs163, h, t, "dec-slice-v163-custom") + testDeepEqualErr(v163v3, v163v4, t, "equal-slice-v163-custom") + bs163 = testMarshalErr(&v163v3, h, t, "enc-slice-v163-custom-p") + v163v2 = nil + v163v4 = typMbsSliceUintptr(v163v2) + testUnmarshalErr(&v163v4, bs163, h, t, "dec-slice-v163-custom-p") + testDeepEqualErr(v163v3, v163v4, t, "equal-slice-v163-custom-p") + } + + var v181va [8]int + for _, v := range [][]int{nil, {}, {44, 0, 0, 33}} { + var v181v1, v181v2 []int + v181v1 = v + bs181 := testMarshalErr(v181v1, h, t, "enc-slice-v181") + if v == nil { + v181v2 = nil + } else { + v181v2 = make([]int, len(v)) + } + testUnmarshalErr(v181v2, bs181, h, t, "dec-slice-v181") + testDeepEqualErr(v181v1, v181v2, t, "equal-slice-v181") + if v == nil { + v181v2 = nil + } else { + v181v2 = make([]int, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v181v2), bs181, h, t, "dec-slice-v181-noaddr") // non-addressable value + testDeepEqualErr(v181v1, v181v2, t, "equal-slice-v181-noaddr") + // ... + bs181 = testMarshalErr(&v181v1, h, t, "enc-slice-v181-p") + v181v2 = nil + testUnmarshalErr(&v181v2, bs181, h, t, "dec-slice-v181-p") + testDeepEqualErr(v181v1, v181v2, t, "equal-slice-v181-p") + v181va = [8]int{} // clear the array + v181v2 = v181va[:1:1] + testUnmarshalErr(&v181v2, bs181, h, t, "dec-slice-v181-p-1") + testDeepEqualErr(v181v1, v181v2, t, "equal-slice-v181-p-1") + v181va = [8]int{} // clear the array + v181v2 = v181va[:len(v181v1):len(v181v1)] + testUnmarshalErr(&v181v2, bs181, h, t, "dec-slice-v181-p-len") + testDeepEqualErr(v181v1, v181v2, t, "equal-slice-v181-p-len") + v181va = [8]int{} // clear the array + v181v2 = v181va[:] + testUnmarshalErr(&v181v2, bs181, h, t, "dec-slice-v181-p-cap") + testDeepEqualErr(v181v1, v181v2, t, "equal-slice-v181-p-cap") + if len(v181v1) > 1 { + v181va = [8]int{} // clear the array + testUnmarshalErr((&v181va)[:len(v181v1)], bs181, h, t, "dec-slice-v181-p-len-noaddr") + testDeepEqualErr(v181v1, v181va[:len(v181v1)], t, "equal-slice-v181-p-len-noaddr") + v181va = [8]int{} // clear the array + testUnmarshalErr((&v181va)[:], bs181, h, t, "dec-slice-v181-p-cap-noaddr") + testDeepEqualErr(v181v1, v181va[:len(v181v1)], t, "equal-slice-v181-p-cap-noaddr") + } + // ... + var v181v3, v181v4 typMbsSliceInt + v181v2 = nil + if v != nil { + v181v2 = make([]int, len(v)) + } + v181v3 = typMbsSliceInt(v181v1) + v181v4 = typMbsSliceInt(v181v2) + bs181 = testMarshalErr(v181v3, h, t, "enc-slice-v181-custom") + testUnmarshalErr(v181v4, bs181, h, t, "dec-slice-v181-custom") + testDeepEqualErr(v181v3, v181v4, t, "equal-slice-v181-custom") + bs181 = testMarshalErr(&v181v3, h, t, "enc-slice-v181-custom-p") + v181v2 = nil + v181v4 = typMbsSliceInt(v181v2) + testUnmarshalErr(&v181v4, bs181, h, t, "dec-slice-v181-custom-p") + testDeepEqualErr(v181v3, v181v4, t, "equal-slice-v181-custom-p") + } + + var v199va [8]int8 + for _, v := range [][]int8{nil, {}, {44, 0, 0, 33}} { + var v199v1, v199v2 []int8 + v199v1 = v + bs199 := testMarshalErr(v199v1, h, t, "enc-slice-v199") + if v == nil { + v199v2 = nil + } else { + v199v2 = make([]int8, len(v)) + } + testUnmarshalErr(v199v2, bs199, h, t, "dec-slice-v199") + testDeepEqualErr(v199v1, v199v2, t, "equal-slice-v199") + if v == nil { + v199v2 = nil + } else { + v199v2 = make([]int8, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v199v2), bs199, h, t, "dec-slice-v199-noaddr") // non-addressable value + testDeepEqualErr(v199v1, v199v2, t, "equal-slice-v199-noaddr") + // ... + bs199 = testMarshalErr(&v199v1, h, t, "enc-slice-v199-p") + v199v2 = nil + testUnmarshalErr(&v199v2, bs199, h, t, "dec-slice-v199-p") + testDeepEqualErr(v199v1, v199v2, t, "equal-slice-v199-p") + v199va = [8]int8{} // clear the array + v199v2 = v199va[:1:1] + testUnmarshalErr(&v199v2, bs199, h, t, "dec-slice-v199-p-1") + testDeepEqualErr(v199v1, v199v2, t, "equal-slice-v199-p-1") + v199va = [8]int8{} // clear the array + v199v2 = v199va[:len(v199v1):len(v199v1)] + testUnmarshalErr(&v199v2, bs199, h, t, "dec-slice-v199-p-len") + testDeepEqualErr(v199v1, v199v2, t, "equal-slice-v199-p-len") + v199va = [8]int8{} // clear the array + v199v2 = v199va[:] + testUnmarshalErr(&v199v2, bs199, h, t, "dec-slice-v199-p-cap") + testDeepEqualErr(v199v1, v199v2, t, "equal-slice-v199-p-cap") + if len(v199v1) > 1 { + v199va = [8]int8{} // clear the array + testUnmarshalErr((&v199va)[:len(v199v1)], bs199, h, t, "dec-slice-v199-p-len-noaddr") + testDeepEqualErr(v199v1, v199va[:len(v199v1)], t, "equal-slice-v199-p-len-noaddr") + v199va = [8]int8{} // clear the array + testUnmarshalErr((&v199va)[:], bs199, h, t, "dec-slice-v199-p-cap-noaddr") + testDeepEqualErr(v199v1, v199va[:len(v199v1)], t, "equal-slice-v199-p-cap-noaddr") + } + // ... + var v199v3, v199v4 typMbsSliceInt8 + v199v2 = nil + if v != nil { + v199v2 = make([]int8, len(v)) + } + v199v3 = typMbsSliceInt8(v199v1) + v199v4 = typMbsSliceInt8(v199v2) + bs199 = testMarshalErr(v199v3, h, t, "enc-slice-v199-custom") + testUnmarshalErr(v199v4, bs199, h, t, "dec-slice-v199-custom") + testDeepEqualErr(v199v3, v199v4, t, "equal-slice-v199-custom") + bs199 = testMarshalErr(&v199v3, h, t, "enc-slice-v199-custom-p") + v199v2 = nil + v199v4 = typMbsSliceInt8(v199v2) + testUnmarshalErr(&v199v4, bs199, h, t, "dec-slice-v199-custom-p") + testDeepEqualErr(v199v3, v199v4, t, "equal-slice-v199-custom-p") + } + + var v217va [8]int16 + for _, v := range [][]int16{nil, {}, {44, 0, 0, 33}} { + var v217v1, v217v2 []int16 + v217v1 = v + bs217 := testMarshalErr(v217v1, h, t, "enc-slice-v217") + if v == nil { + v217v2 = nil + } else { + v217v2 = make([]int16, len(v)) + } + testUnmarshalErr(v217v2, bs217, h, t, "dec-slice-v217") + testDeepEqualErr(v217v1, v217v2, t, "equal-slice-v217") + if v == nil { + v217v2 = nil + } else { + v217v2 = make([]int16, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v217v2), bs217, h, t, "dec-slice-v217-noaddr") // non-addressable value + testDeepEqualErr(v217v1, v217v2, t, "equal-slice-v217-noaddr") + // ... + bs217 = testMarshalErr(&v217v1, h, t, "enc-slice-v217-p") + v217v2 = nil + testUnmarshalErr(&v217v2, bs217, h, t, "dec-slice-v217-p") + testDeepEqualErr(v217v1, v217v2, t, "equal-slice-v217-p") + v217va = [8]int16{} // clear the array + v217v2 = v217va[:1:1] + testUnmarshalErr(&v217v2, bs217, h, t, "dec-slice-v217-p-1") + testDeepEqualErr(v217v1, v217v2, t, "equal-slice-v217-p-1") + v217va = [8]int16{} // clear the array + v217v2 = v217va[:len(v217v1):len(v217v1)] + testUnmarshalErr(&v217v2, bs217, h, t, "dec-slice-v217-p-len") + testDeepEqualErr(v217v1, v217v2, t, "equal-slice-v217-p-len") + v217va = [8]int16{} // clear the array + v217v2 = v217va[:] + testUnmarshalErr(&v217v2, bs217, h, t, "dec-slice-v217-p-cap") + testDeepEqualErr(v217v1, v217v2, t, "equal-slice-v217-p-cap") + if len(v217v1) > 1 { + v217va = [8]int16{} // clear the array + testUnmarshalErr((&v217va)[:len(v217v1)], bs217, h, t, "dec-slice-v217-p-len-noaddr") + testDeepEqualErr(v217v1, v217va[:len(v217v1)], t, "equal-slice-v217-p-len-noaddr") + v217va = [8]int16{} // clear the array + testUnmarshalErr((&v217va)[:], bs217, h, t, "dec-slice-v217-p-cap-noaddr") + testDeepEqualErr(v217v1, v217va[:len(v217v1)], t, "equal-slice-v217-p-cap-noaddr") + } + // ... + var v217v3, v217v4 typMbsSliceInt16 + v217v2 = nil + if v != nil { + v217v2 = make([]int16, len(v)) + } + v217v3 = typMbsSliceInt16(v217v1) + v217v4 = typMbsSliceInt16(v217v2) + bs217 = testMarshalErr(v217v3, h, t, "enc-slice-v217-custom") + testUnmarshalErr(v217v4, bs217, h, t, "dec-slice-v217-custom") + testDeepEqualErr(v217v3, v217v4, t, "equal-slice-v217-custom") + bs217 = testMarshalErr(&v217v3, h, t, "enc-slice-v217-custom-p") + v217v2 = nil + v217v4 = typMbsSliceInt16(v217v2) + testUnmarshalErr(&v217v4, bs217, h, t, "dec-slice-v217-custom-p") + testDeepEqualErr(v217v3, v217v4, t, "equal-slice-v217-custom-p") + } + + var v235va [8]int32 + for _, v := range [][]int32{nil, {}, {44, 0, 0, 33}} { + var v235v1, v235v2 []int32 + v235v1 = v + bs235 := testMarshalErr(v235v1, h, t, "enc-slice-v235") + if v == nil { + v235v2 = nil + } else { + v235v2 = make([]int32, len(v)) + } + testUnmarshalErr(v235v2, bs235, h, t, "dec-slice-v235") + testDeepEqualErr(v235v1, v235v2, t, "equal-slice-v235") + if v == nil { + v235v2 = nil + } else { + v235v2 = make([]int32, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v235v2), bs235, h, t, "dec-slice-v235-noaddr") // non-addressable value + testDeepEqualErr(v235v1, v235v2, t, "equal-slice-v235-noaddr") + // ... + bs235 = testMarshalErr(&v235v1, h, t, "enc-slice-v235-p") + v235v2 = nil + testUnmarshalErr(&v235v2, bs235, h, t, "dec-slice-v235-p") + testDeepEqualErr(v235v1, v235v2, t, "equal-slice-v235-p") + v235va = [8]int32{} // clear the array + v235v2 = v235va[:1:1] + testUnmarshalErr(&v235v2, bs235, h, t, "dec-slice-v235-p-1") + testDeepEqualErr(v235v1, v235v2, t, "equal-slice-v235-p-1") + v235va = [8]int32{} // clear the array + v235v2 = v235va[:len(v235v1):len(v235v1)] + testUnmarshalErr(&v235v2, bs235, h, t, "dec-slice-v235-p-len") + testDeepEqualErr(v235v1, v235v2, t, "equal-slice-v235-p-len") + v235va = [8]int32{} // clear the array + v235v2 = v235va[:] + testUnmarshalErr(&v235v2, bs235, h, t, "dec-slice-v235-p-cap") + testDeepEqualErr(v235v1, v235v2, t, "equal-slice-v235-p-cap") + if len(v235v1) > 1 { + v235va = [8]int32{} // clear the array + testUnmarshalErr((&v235va)[:len(v235v1)], bs235, h, t, "dec-slice-v235-p-len-noaddr") + testDeepEqualErr(v235v1, v235va[:len(v235v1)], t, "equal-slice-v235-p-len-noaddr") + v235va = [8]int32{} // clear the array + testUnmarshalErr((&v235va)[:], bs235, h, t, "dec-slice-v235-p-cap-noaddr") + testDeepEqualErr(v235v1, v235va[:len(v235v1)], t, "equal-slice-v235-p-cap-noaddr") + } + // ... + var v235v3, v235v4 typMbsSliceInt32 + v235v2 = nil + if v != nil { + v235v2 = make([]int32, len(v)) + } + v235v3 = typMbsSliceInt32(v235v1) + v235v4 = typMbsSliceInt32(v235v2) + bs235 = testMarshalErr(v235v3, h, t, "enc-slice-v235-custom") + testUnmarshalErr(v235v4, bs235, h, t, "dec-slice-v235-custom") + testDeepEqualErr(v235v3, v235v4, t, "equal-slice-v235-custom") + bs235 = testMarshalErr(&v235v3, h, t, "enc-slice-v235-custom-p") + v235v2 = nil + v235v4 = typMbsSliceInt32(v235v2) + testUnmarshalErr(&v235v4, bs235, h, t, "dec-slice-v235-custom-p") + testDeepEqualErr(v235v3, v235v4, t, "equal-slice-v235-custom-p") + } + + var v253va [8]int64 + for _, v := range [][]int64{nil, {}, {44, 0, 0, 33}} { + var v253v1, v253v2 []int64 + v253v1 = v + bs253 := testMarshalErr(v253v1, h, t, "enc-slice-v253") + if v == nil { + v253v2 = nil + } else { + v253v2 = make([]int64, len(v)) + } + testUnmarshalErr(v253v2, bs253, h, t, "dec-slice-v253") + testDeepEqualErr(v253v1, v253v2, t, "equal-slice-v253") + if v == nil { + v253v2 = nil + } else { + v253v2 = make([]int64, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v253v2), bs253, h, t, "dec-slice-v253-noaddr") // non-addressable value + testDeepEqualErr(v253v1, v253v2, t, "equal-slice-v253-noaddr") + // ... + bs253 = testMarshalErr(&v253v1, h, t, "enc-slice-v253-p") + v253v2 = nil + testUnmarshalErr(&v253v2, bs253, h, t, "dec-slice-v253-p") + testDeepEqualErr(v253v1, v253v2, t, "equal-slice-v253-p") + v253va = [8]int64{} // clear the array + v253v2 = v253va[:1:1] + testUnmarshalErr(&v253v2, bs253, h, t, "dec-slice-v253-p-1") + testDeepEqualErr(v253v1, v253v2, t, "equal-slice-v253-p-1") + v253va = [8]int64{} // clear the array + v253v2 = v253va[:len(v253v1):len(v253v1)] + testUnmarshalErr(&v253v2, bs253, h, t, "dec-slice-v253-p-len") + testDeepEqualErr(v253v1, v253v2, t, "equal-slice-v253-p-len") + v253va = [8]int64{} // clear the array + v253v2 = v253va[:] + testUnmarshalErr(&v253v2, bs253, h, t, "dec-slice-v253-p-cap") + testDeepEqualErr(v253v1, v253v2, t, "equal-slice-v253-p-cap") + if len(v253v1) > 1 { + v253va = [8]int64{} // clear the array + testUnmarshalErr((&v253va)[:len(v253v1)], bs253, h, t, "dec-slice-v253-p-len-noaddr") + testDeepEqualErr(v253v1, v253va[:len(v253v1)], t, "equal-slice-v253-p-len-noaddr") + v253va = [8]int64{} // clear the array + testUnmarshalErr((&v253va)[:], bs253, h, t, "dec-slice-v253-p-cap-noaddr") + testDeepEqualErr(v253v1, v253va[:len(v253v1)], t, "equal-slice-v253-p-cap-noaddr") + } + // ... + var v253v3, v253v4 typMbsSliceInt64 + v253v2 = nil + if v != nil { + v253v2 = make([]int64, len(v)) + } + v253v3 = typMbsSliceInt64(v253v1) + v253v4 = typMbsSliceInt64(v253v2) + bs253 = testMarshalErr(v253v3, h, t, "enc-slice-v253-custom") + testUnmarshalErr(v253v4, bs253, h, t, "dec-slice-v253-custom") + testDeepEqualErr(v253v3, v253v4, t, "equal-slice-v253-custom") + bs253 = testMarshalErr(&v253v3, h, t, "enc-slice-v253-custom-p") + v253v2 = nil + v253v4 = typMbsSliceInt64(v253v2) + testUnmarshalErr(&v253v4, bs253, h, t, "dec-slice-v253-custom-p") + testDeepEqualErr(v253v3, v253v4, t, "equal-slice-v253-custom-p") + } + + var v271va [8]bool + for _, v := range [][]bool{nil, {}, {true, false, false, true}} { + var v271v1, v271v2 []bool + v271v1 = v + bs271 := testMarshalErr(v271v1, h, t, "enc-slice-v271") + if v == nil { + v271v2 = nil + } else { + v271v2 = make([]bool, len(v)) + } + testUnmarshalErr(v271v2, bs271, h, t, "dec-slice-v271") + testDeepEqualErr(v271v1, v271v2, t, "equal-slice-v271") + if v == nil { + v271v2 = nil + } else { + v271v2 = make([]bool, len(v)) + } + testUnmarshalErr(reflect.ValueOf(v271v2), bs271, h, t, "dec-slice-v271-noaddr") // non-addressable value + testDeepEqualErr(v271v1, v271v2, t, "equal-slice-v271-noaddr") + // ... + bs271 = testMarshalErr(&v271v1, h, t, "enc-slice-v271-p") + v271v2 = nil + testUnmarshalErr(&v271v2, bs271, h, t, "dec-slice-v271-p") + testDeepEqualErr(v271v1, v271v2, t, "equal-slice-v271-p") + v271va = [8]bool{} // clear the array + v271v2 = v271va[:1:1] + testUnmarshalErr(&v271v2, bs271, h, t, "dec-slice-v271-p-1") + testDeepEqualErr(v271v1, v271v2, t, "equal-slice-v271-p-1") + v271va = [8]bool{} // clear the array + v271v2 = v271va[:len(v271v1):len(v271v1)] + testUnmarshalErr(&v271v2, bs271, h, t, "dec-slice-v271-p-len") + testDeepEqualErr(v271v1, v271v2, t, "equal-slice-v271-p-len") + v271va = [8]bool{} // clear the array + v271v2 = v271va[:] + testUnmarshalErr(&v271v2, bs271, h, t, "dec-slice-v271-p-cap") + testDeepEqualErr(v271v1, v271v2, t, "equal-slice-v271-p-cap") + if len(v271v1) > 1 { + v271va = [8]bool{} // clear the array + testUnmarshalErr((&v271va)[:len(v271v1)], bs271, h, t, "dec-slice-v271-p-len-noaddr") + testDeepEqualErr(v271v1, v271va[:len(v271v1)], t, "equal-slice-v271-p-len-noaddr") + v271va = [8]bool{} // clear the array + testUnmarshalErr((&v271va)[:], bs271, h, t, "dec-slice-v271-p-cap-noaddr") + testDeepEqualErr(v271v1, v271va[:len(v271v1)], t, "equal-slice-v271-p-cap-noaddr") + } + // ... + var v271v3, v271v4 typMbsSliceBool + v271v2 = nil + if v != nil { + v271v2 = make([]bool, len(v)) + } + v271v3 = typMbsSliceBool(v271v1) + v271v4 = typMbsSliceBool(v271v2) + bs271 = testMarshalErr(v271v3, h, t, "enc-slice-v271-custom") + testUnmarshalErr(v271v4, bs271, h, t, "dec-slice-v271-custom") + testDeepEqualErr(v271v3, v271v4, t, "equal-slice-v271-custom") + bs271 = testMarshalErr(&v271v3, h, t, "enc-slice-v271-custom-p") + v271v2 = nil + v271v4 = typMbsSliceBool(v271v2) + testUnmarshalErr(&v271v4, bs271, h, t, "dec-slice-v271-custom-p") + testDeepEqualErr(v271v3, v271v4, t, "equal-slice-v271-custom-p") + } + +} + +func doTestMammothMaps(t *testing.T, h Handle) { + + for _, v := range []map[interface{}]interface{}{nil, {}, {"string-is-an-interface-2": nil, "string-is-an-interface": "string-is-an-interface-2"}} { + // fmt.Printf(">>>> running mammoth map v2: %v\n", v) + var v2v1, v2v2 map[interface{}]interface{} + v2v1 = v + bs2 := testMarshalErr(v2v1, h, t, "enc-map-v2") + if v == nil { + v2v2 = nil + } else { + v2v2 = make(map[interface{}]interface{}, len(v)) + } // reset map + testUnmarshalErr(v2v2, bs2, h, t, "dec-map-v2") + testDeepEqualErr(v2v1, v2v2, t, "equal-map-v2") + if v == nil { + v2v2 = nil + } else { + v2v2 = make(map[interface{}]interface{}, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v2v2), bs2, h, t, "dec-map-v2-noaddr") // decode into non-addressable map value + testDeepEqualErr(v2v1, v2v2, t, "equal-map-v2-noaddr") + if v == nil { + v2v2 = nil + } else { + v2v2 = make(map[interface{}]interface{}, len(v)) + } // reset map + testUnmarshalErr(&v2v2, bs2, h, t, "dec-map-v2-p-len") + testDeepEqualErr(v2v1, v2v2, t, "equal-map-v2-p-len") + bs2 = testMarshalErr(&v2v1, h, t, "enc-map-v2-p") + v2v2 = nil + testUnmarshalErr(&v2v2, bs2, h, t, "dec-map-v2-p-nil") + testDeepEqualErr(v2v1, v2v2, t, "equal-map-v2-p-nil") + // ... + if v == nil { + v2v2 = nil + } else { + v2v2 = make(map[interface{}]interface{}, len(v)) + } // reset map + var v2v3, v2v4 typMapMapIntfIntf + v2v3 = typMapMapIntfIntf(v2v1) + v2v4 = typMapMapIntfIntf(v2v2) + bs2 = testMarshalErr(v2v3, h, t, "enc-map-v2-custom") + testUnmarshalErr(v2v4, bs2, h, t, "dec-map-v2-p-len") + testDeepEqualErr(v2v3, v2v4, t, "equal-map-v2-p-len") + } + + for _, v := range []map[interface{}]string{nil, {}, {"string-is-an-interface": "", "string-is-an-interface-2": "some-string-2"}} { + // fmt.Printf(">>>> running mammoth map v3: %v\n", v) + var v3v1, v3v2 map[interface{}]string + v3v1 = v + bs3 := testMarshalErr(v3v1, h, t, "enc-map-v3") + if v == nil { + v3v2 = nil + } else { + v3v2 = make(map[interface{}]string, len(v)) + } // reset map + testUnmarshalErr(v3v2, bs3, h, t, "dec-map-v3") + testDeepEqualErr(v3v1, v3v2, t, "equal-map-v3") + if v == nil { + v3v2 = nil + } else { + v3v2 = make(map[interface{}]string, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v3v2), bs3, h, t, "dec-map-v3-noaddr") // decode into non-addressable map value + testDeepEqualErr(v3v1, v3v2, t, "equal-map-v3-noaddr") + if v == nil { + v3v2 = nil + } else { + v3v2 = make(map[interface{}]string, len(v)) + } // reset map + testUnmarshalErr(&v3v2, bs3, h, t, "dec-map-v3-p-len") + testDeepEqualErr(v3v1, v3v2, t, "equal-map-v3-p-len") + bs3 = testMarshalErr(&v3v1, h, t, "enc-map-v3-p") + v3v2 = nil + testUnmarshalErr(&v3v2, bs3, h, t, "dec-map-v3-p-nil") + testDeepEqualErr(v3v1, v3v2, t, "equal-map-v3-p-nil") + // ... + if v == nil { + v3v2 = nil + } else { + v3v2 = make(map[interface{}]string, len(v)) + } // reset map + var v3v3, v3v4 typMapMapIntfString + v3v3 = typMapMapIntfString(v3v1) + v3v4 = typMapMapIntfString(v3v2) + bs3 = testMarshalErr(v3v3, h, t, "enc-map-v3-custom") + testUnmarshalErr(v3v4, bs3, h, t, "dec-map-v3-p-len") + testDeepEqualErr(v3v3, v3v4, t, "equal-map-v3-p-len") + } + + for _, v := range []map[interface{}]uint{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 44}} { + // fmt.Printf(">>>> running mammoth map v4: %v\n", v) + var v4v1, v4v2 map[interface{}]uint + v4v1 = v + bs4 := testMarshalErr(v4v1, h, t, "enc-map-v4") + if v == nil { + v4v2 = nil + } else { + v4v2 = make(map[interface{}]uint, len(v)) + } // reset map + testUnmarshalErr(v4v2, bs4, h, t, "dec-map-v4") + testDeepEqualErr(v4v1, v4v2, t, "equal-map-v4") + if v == nil { + v4v2 = nil + } else { + v4v2 = make(map[interface{}]uint, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v4v2), bs4, h, t, "dec-map-v4-noaddr") // decode into non-addressable map value + testDeepEqualErr(v4v1, v4v2, t, "equal-map-v4-noaddr") + if v == nil { + v4v2 = nil + } else { + v4v2 = make(map[interface{}]uint, len(v)) + } // reset map + testUnmarshalErr(&v4v2, bs4, h, t, "dec-map-v4-p-len") + testDeepEqualErr(v4v1, v4v2, t, "equal-map-v4-p-len") + bs4 = testMarshalErr(&v4v1, h, t, "enc-map-v4-p") + v4v2 = nil + testUnmarshalErr(&v4v2, bs4, h, t, "dec-map-v4-p-nil") + testDeepEqualErr(v4v1, v4v2, t, "equal-map-v4-p-nil") + // ... + if v == nil { + v4v2 = nil + } else { + v4v2 = make(map[interface{}]uint, len(v)) + } // reset map + var v4v3, v4v4 typMapMapIntfUint + v4v3 = typMapMapIntfUint(v4v1) + v4v4 = typMapMapIntfUint(v4v2) + bs4 = testMarshalErr(v4v3, h, t, "enc-map-v4-custom") + testUnmarshalErr(v4v4, bs4, h, t, "dec-map-v4-p-len") + testDeepEqualErr(v4v3, v4v4, t, "equal-map-v4-p-len") + } + + for _, v := range []map[interface{}]uint8{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 33}} { + // fmt.Printf(">>>> running mammoth map v5: %v\n", v) + var v5v1, v5v2 map[interface{}]uint8 + v5v1 = v + bs5 := testMarshalErr(v5v1, h, t, "enc-map-v5") + if v == nil { + v5v2 = nil + } else { + v5v2 = make(map[interface{}]uint8, len(v)) + } // reset map + testUnmarshalErr(v5v2, bs5, h, t, "dec-map-v5") + testDeepEqualErr(v5v1, v5v2, t, "equal-map-v5") + if v == nil { + v5v2 = nil + } else { + v5v2 = make(map[interface{}]uint8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v5v2), bs5, h, t, "dec-map-v5-noaddr") // decode into non-addressable map value + testDeepEqualErr(v5v1, v5v2, t, "equal-map-v5-noaddr") + if v == nil { + v5v2 = nil + } else { + v5v2 = make(map[interface{}]uint8, len(v)) + } // reset map + testUnmarshalErr(&v5v2, bs5, h, t, "dec-map-v5-p-len") + testDeepEqualErr(v5v1, v5v2, t, "equal-map-v5-p-len") + bs5 = testMarshalErr(&v5v1, h, t, "enc-map-v5-p") + v5v2 = nil + testUnmarshalErr(&v5v2, bs5, h, t, "dec-map-v5-p-nil") + testDeepEqualErr(v5v1, v5v2, t, "equal-map-v5-p-nil") + // ... + if v == nil { + v5v2 = nil + } else { + v5v2 = make(map[interface{}]uint8, len(v)) + } // reset map + var v5v3, v5v4 typMapMapIntfUint8 + v5v3 = typMapMapIntfUint8(v5v1) + v5v4 = typMapMapIntfUint8(v5v2) + bs5 = testMarshalErr(v5v3, h, t, "enc-map-v5-custom") + testUnmarshalErr(v5v4, bs5, h, t, "dec-map-v5-p-len") + testDeepEqualErr(v5v3, v5v4, t, "equal-map-v5-p-len") + } + + for _, v := range []map[interface{}]uint16{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 44}} { + // fmt.Printf(">>>> running mammoth map v6: %v\n", v) + var v6v1, v6v2 map[interface{}]uint16 + v6v1 = v + bs6 := testMarshalErr(v6v1, h, t, "enc-map-v6") + if v == nil { + v6v2 = nil + } else { + v6v2 = make(map[interface{}]uint16, len(v)) + } // reset map + testUnmarshalErr(v6v2, bs6, h, t, "dec-map-v6") + testDeepEqualErr(v6v1, v6v2, t, "equal-map-v6") + if v == nil { + v6v2 = nil + } else { + v6v2 = make(map[interface{}]uint16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v6v2), bs6, h, t, "dec-map-v6-noaddr") // decode into non-addressable map value + testDeepEqualErr(v6v1, v6v2, t, "equal-map-v6-noaddr") + if v == nil { + v6v2 = nil + } else { + v6v2 = make(map[interface{}]uint16, len(v)) + } // reset map + testUnmarshalErr(&v6v2, bs6, h, t, "dec-map-v6-p-len") + testDeepEqualErr(v6v1, v6v2, t, "equal-map-v6-p-len") + bs6 = testMarshalErr(&v6v1, h, t, "enc-map-v6-p") + v6v2 = nil + testUnmarshalErr(&v6v2, bs6, h, t, "dec-map-v6-p-nil") + testDeepEqualErr(v6v1, v6v2, t, "equal-map-v6-p-nil") + // ... + if v == nil { + v6v2 = nil + } else { + v6v2 = make(map[interface{}]uint16, len(v)) + } // reset map + var v6v3, v6v4 typMapMapIntfUint16 + v6v3 = typMapMapIntfUint16(v6v1) + v6v4 = typMapMapIntfUint16(v6v2) + bs6 = testMarshalErr(v6v3, h, t, "enc-map-v6-custom") + testUnmarshalErr(v6v4, bs6, h, t, "dec-map-v6-p-len") + testDeepEqualErr(v6v3, v6v4, t, "equal-map-v6-p-len") + } + + for _, v := range []map[interface{}]uint32{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 33}} { + // fmt.Printf(">>>> running mammoth map v7: %v\n", v) + var v7v1, v7v2 map[interface{}]uint32 + v7v1 = v + bs7 := testMarshalErr(v7v1, h, t, "enc-map-v7") + if v == nil { + v7v2 = nil + } else { + v7v2 = make(map[interface{}]uint32, len(v)) + } // reset map + testUnmarshalErr(v7v2, bs7, h, t, "dec-map-v7") + testDeepEqualErr(v7v1, v7v2, t, "equal-map-v7") + if v == nil { + v7v2 = nil + } else { + v7v2 = make(map[interface{}]uint32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v7v2), bs7, h, t, "dec-map-v7-noaddr") // decode into non-addressable map value + testDeepEqualErr(v7v1, v7v2, t, "equal-map-v7-noaddr") + if v == nil { + v7v2 = nil + } else { + v7v2 = make(map[interface{}]uint32, len(v)) + } // reset map + testUnmarshalErr(&v7v2, bs7, h, t, "dec-map-v7-p-len") + testDeepEqualErr(v7v1, v7v2, t, "equal-map-v7-p-len") + bs7 = testMarshalErr(&v7v1, h, t, "enc-map-v7-p") + v7v2 = nil + testUnmarshalErr(&v7v2, bs7, h, t, "dec-map-v7-p-nil") + testDeepEqualErr(v7v1, v7v2, t, "equal-map-v7-p-nil") + // ... + if v == nil { + v7v2 = nil + } else { + v7v2 = make(map[interface{}]uint32, len(v)) + } // reset map + var v7v3, v7v4 typMapMapIntfUint32 + v7v3 = typMapMapIntfUint32(v7v1) + v7v4 = typMapMapIntfUint32(v7v2) + bs7 = testMarshalErr(v7v3, h, t, "enc-map-v7-custom") + testUnmarshalErr(v7v4, bs7, h, t, "dec-map-v7-p-len") + testDeepEqualErr(v7v3, v7v4, t, "equal-map-v7-p-len") + } + + for _, v := range []map[interface{}]uint64{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 44}} { + // fmt.Printf(">>>> running mammoth map v8: %v\n", v) + var v8v1, v8v2 map[interface{}]uint64 + v8v1 = v + bs8 := testMarshalErr(v8v1, h, t, "enc-map-v8") + if v == nil { + v8v2 = nil + } else { + v8v2 = make(map[interface{}]uint64, len(v)) + } // reset map + testUnmarshalErr(v8v2, bs8, h, t, "dec-map-v8") + testDeepEqualErr(v8v1, v8v2, t, "equal-map-v8") + if v == nil { + v8v2 = nil + } else { + v8v2 = make(map[interface{}]uint64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v8v2), bs8, h, t, "dec-map-v8-noaddr") // decode into non-addressable map value + testDeepEqualErr(v8v1, v8v2, t, "equal-map-v8-noaddr") + if v == nil { + v8v2 = nil + } else { + v8v2 = make(map[interface{}]uint64, len(v)) + } // reset map + testUnmarshalErr(&v8v2, bs8, h, t, "dec-map-v8-p-len") + testDeepEqualErr(v8v1, v8v2, t, "equal-map-v8-p-len") + bs8 = testMarshalErr(&v8v1, h, t, "enc-map-v8-p") + v8v2 = nil + testUnmarshalErr(&v8v2, bs8, h, t, "dec-map-v8-p-nil") + testDeepEqualErr(v8v1, v8v2, t, "equal-map-v8-p-nil") + // ... + if v == nil { + v8v2 = nil + } else { + v8v2 = make(map[interface{}]uint64, len(v)) + } // reset map + var v8v3, v8v4 typMapMapIntfUint64 + v8v3 = typMapMapIntfUint64(v8v1) + v8v4 = typMapMapIntfUint64(v8v2) + bs8 = testMarshalErr(v8v3, h, t, "enc-map-v8-custom") + testUnmarshalErr(v8v4, bs8, h, t, "dec-map-v8-p-len") + testDeepEqualErr(v8v3, v8v4, t, "equal-map-v8-p-len") + } + + for _, v := range []map[interface{}]uintptr{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 33}} { + // fmt.Printf(">>>> running mammoth map v9: %v\n", v) + var v9v1, v9v2 map[interface{}]uintptr + v9v1 = v + bs9 := testMarshalErr(v9v1, h, t, "enc-map-v9") + if v == nil { + v9v2 = nil + } else { + v9v2 = make(map[interface{}]uintptr, len(v)) + } // reset map + testUnmarshalErr(v9v2, bs9, h, t, "dec-map-v9") + testDeepEqualErr(v9v1, v9v2, t, "equal-map-v9") + if v == nil { + v9v2 = nil + } else { + v9v2 = make(map[interface{}]uintptr, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v9v2), bs9, h, t, "dec-map-v9-noaddr") // decode into non-addressable map value + testDeepEqualErr(v9v1, v9v2, t, "equal-map-v9-noaddr") + if v == nil { + v9v2 = nil + } else { + v9v2 = make(map[interface{}]uintptr, len(v)) + } // reset map + testUnmarshalErr(&v9v2, bs9, h, t, "dec-map-v9-p-len") + testDeepEqualErr(v9v1, v9v2, t, "equal-map-v9-p-len") + bs9 = testMarshalErr(&v9v1, h, t, "enc-map-v9-p") + v9v2 = nil + testUnmarshalErr(&v9v2, bs9, h, t, "dec-map-v9-p-nil") + testDeepEqualErr(v9v1, v9v2, t, "equal-map-v9-p-nil") + // ... + if v == nil { + v9v2 = nil + } else { + v9v2 = make(map[interface{}]uintptr, len(v)) + } // reset map + var v9v3, v9v4 typMapMapIntfUintptr + v9v3 = typMapMapIntfUintptr(v9v1) + v9v4 = typMapMapIntfUintptr(v9v2) + bs9 = testMarshalErr(v9v3, h, t, "enc-map-v9-custom") + testUnmarshalErr(v9v4, bs9, h, t, "dec-map-v9-p-len") + testDeepEqualErr(v9v3, v9v4, t, "equal-map-v9-p-len") + } + + for _, v := range []map[interface{}]int{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 44}} { + // fmt.Printf(">>>> running mammoth map v10: %v\n", v) + var v10v1, v10v2 map[interface{}]int + v10v1 = v + bs10 := testMarshalErr(v10v1, h, t, "enc-map-v10") + if v == nil { + v10v2 = nil + } else { + v10v2 = make(map[interface{}]int, len(v)) + } // reset map + testUnmarshalErr(v10v2, bs10, h, t, "dec-map-v10") + testDeepEqualErr(v10v1, v10v2, t, "equal-map-v10") + if v == nil { + v10v2 = nil + } else { + v10v2 = make(map[interface{}]int, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v10v2), bs10, h, t, "dec-map-v10-noaddr") // decode into non-addressable map value + testDeepEqualErr(v10v1, v10v2, t, "equal-map-v10-noaddr") + if v == nil { + v10v2 = nil + } else { + v10v2 = make(map[interface{}]int, len(v)) + } // reset map + testUnmarshalErr(&v10v2, bs10, h, t, "dec-map-v10-p-len") + testDeepEqualErr(v10v1, v10v2, t, "equal-map-v10-p-len") + bs10 = testMarshalErr(&v10v1, h, t, "enc-map-v10-p") + v10v2 = nil + testUnmarshalErr(&v10v2, bs10, h, t, "dec-map-v10-p-nil") + testDeepEqualErr(v10v1, v10v2, t, "equal-map-v10-p-nil") + // ... + if v == nil { + v10v2 = nil + } else { + v10v2 = make(map[interface{}]int, len(v)) + } // reset map + var v10v3, v10v4 typMapMapIntfInt + v10v3 = typMapMapIntfInt(v10v1) + v10v4 = typMapMapIntfInt(v10v2) + bs10 = testMarshalErr(v10v3, h, t, "enc-map-v10-custom") + testUnmarshalErr(v10v4, bs10, h, t, "dec-map-v10-p-len") + testDeepEqualErr(v10v3, v10v4, t, "equal-map-v10-p-len") + } + + for _, v := range []map[interface{}]int8{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 33}} { + // fmt.Printf(">>>> running mammoth map v11: %v\n", v) + var v11v1, v11v2 map[interface{}]int8 + v11v1 = v + bs11 := testMarshalErr(v11v1, h, t, "enc-map-v11") + if v == nil { + v11v2 = nil + } else { + v11v2 = make(map[interface{}]int8, len(v)) + } // reset map + testUnmarshalErr(v11v2, bs11, h, t, "dec-map-v11") + testDeepEqualErr(v11v1, v11v2, t, "equal-map-v11") + if v == nil { + v11v2 = nil + } else { + v11v2 = make(map[interface{}]int8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v11v2), bs11, h, t, "dec-map-v11-noaddr") // decode into non-addressable map value + testDeepEqualErr(v11v1, v11v2, t, "equal-map-v11-noaddr") + if v == nil { + v11v2 = nil + } else { + v11v2 = make(map[interface{}]int8, len(v)) + } // reset map + testUnmarshalErr(&v11v2, bs11, h, t, "dec-map-v11-p-len") + testDeepEqualErr(v11v1, v11v2, t, "equal-map-v11-p-len") + bs11 = testMarshalErr(&v11v1, h, t, "enc-map-v11-p") + v11v2 = nil + testUnmarshalErr(&v11v2, bs11, h, t, "dec-map-v11-p-nil") + testDeepEqualErr(v11v1, v11v2, t, "equal-map-v11-p-nil") + // ... + if v == nil { + v11v2 = nil + } else { + v11v2 = make(map[interface{}]int8, len(v)) + } // reset map + var v11v3, v11v4 typMapMapIntfInt8 + v11v3 = typMapMapIntfInt8(v11v1) + v11v4 = typMapMapIntfInt8(v11v2) + bs11 = testMarshalErr(v11v3, h, t, "enc-map-v11-custom") + testUnmarshalErr(v11v4, bs11, h, t, "dec-map-v11-p-len") + testDeepEqualErr(v11v3, v11v4, t, "equal-map-v11-p-len") + } + + for _, v := range []map[interface{}]int16{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 44}} { + // fmt.Printf(">>>> running mammoth map v12: %v\n", v) + var v12v1, v12v2 map[interface{}]int16 + v12v1 = v + bs12 := testMarshalErr(v12v1, h, t, "enc-map-v12") + if v == nil { + v12v2 = nil + } else { + v12v2 = make(map[interface{}]int16, len(v)) + } // reset map + testUnmarshalErr(v12v2, bs12, h, t, "dec-map-v12") + testDeepEqualErr(v12v1, v12v2, t, "equal-map-v12") + if v == nil { + v12v2 = nil + } else { + v12v2 = make(map[interface{}]int16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v12v2), bs12, h, t, "dec-map-v12-noaddr") // decode into non-addressable map value + testDeepEqualErr(v12v1, v12v2, t, "equal-map-v12-noaddr") + if v == nil { + v12v2 = nil + } else { + v12v2 = make(map[interface{}]int16, len(v)) + } // reset map + testUnmarshalErr(&v12v2, bs12, h, t, "dec-map-v12-p-len") + testDeepEqualErr(v12v1, v12v2, t, "equal-map-v12-p-len") + bs12 = testMarshalErr(&v12v1, h, t, "enc-map-v12-p") + v12v2 = nil + testUnmarshalErr(&v12v2, bs12, h, t, "dec-map-v12-p-nil") + testDeepEqualErr(v12v1, v12v2, t, "equal-map-v12-p-nil") + // ... + if v == nil { + v12v2 = nil + } else { + v12v2 = make(map[interface{}]int16, len(v)) + } // reset map + var v12v3, v12v4 typMapMapIntfInt16 + v12v3 = typMapMapIntfInt16(v12v1) + v12v4 = typMapMapIntfInt16(v12v2) + bs12 = testMarshalErr(v12v3, h, t, "enc-map-v12-custom") + testUnmarshalErr(v12v4, bs12, h, t, "dec-map-v12-p-len") + testDeepEqualErr(v12v3, v12v4, t, "equal-map-v12-p-len") + } + + for _, v := range []map[interface{}]int32{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 33}} { + // fmt.Printf(">>>> running mammoth map v13: %v\n", v) + var v13v1, v13v2 map[interface{}]int32 + v13v1 = v + bs13 := testMarshalErr(v13v1, h, t, "enc-map-v13") + if v == nil { + v13v2 = nil + } else { + v13v2 = make(map[interface{}]int32, len(v)) + } // reset map + testUnmarshalErr(v13v2, bs13, h, t, "dec-map-v13") + testDeepEqualErr(v13v1, v13v2, t, "equal-map-v13") + if v == nil { + v13v2 = nil + } else { + v13v2 = make(map[interface{}]int32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v13v2), bs13, h, t, "dec-map-v13-noaddr") // decode into non-addressable map value + testDeepEqualErr(v13v1, v13v2, t, "equal-map-v13-noaddr") + if v == nil { + v13v2 = nil + } else { + v13v2 = make(map[interface{}]int32, len(v)) + } // reset map + testUnmarshalErr(&v13v2, bs13, h, t, "dec-map-v13-p-len") + testDeepEqualErr(v13v1, v13v2, t, "equal-map-v13-p-len") + bs13 = testMarshalErr(&v13v1, h, t, "enc-map-v13-p") + v13v2 = nil + testUnmarshalErr(&v13v2, bs13, h, t, "dec-map-v13-p-nil") + testDeepEqualErr(v13v1, v13v2, t, "equal-map-v13-p-nil") + // ... + if v == nil { + v13v2 = nil + } else { + v13v2 = make(map[interface{}]int32, len(v)) + } // reset map + var v13v3, v13v4 typMapMapIntfInt32 + v13v3 = typMapMapIntfInt32(v13v1) + v13v4 = typMapMapIntfInt32(v13v2) + bs13 = testMarshalErr(v13v3, h, t, "enc-map-v13-custom") + testUnmarshalErr(v13v4, bs13, h, t, "dec-map-v13-p-len") + testDeepEqualErr(v13v3, v13v4, t, "equal-map-v13-p-len") + } + + for _, v := range []map[interface{}]int64{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 44}} { + // fmt.Printf(">>>> running mammoth map v14: %v\n", v) + var v14v1, v14v2 map[interface{}]int64 + v14v1 = v + bs14 := testMarshalErr(v14v1, h, t, "enc-map-v14") + if v == nil { + v14v2 = nil + } else { + v14v2 = make(map[interface{}]int64, len(v)) + } // reset map + testUnmarshalErr(v14v2, bs14, h, t, "dec-map-v14") + testDeepEqualErr(v14v1, v14v2, t, "equal-map-v14") + if v == nil { + v14v2 = nil + } else { + v14v2 = make(map[interface{}]int64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v14v2), bs14, h, t, "dec-map-v14-noaddr") // decode into non-addressable map value + testDeepEqualErr(v14v1, v14v2, t, "equal-map-v14-noaddr") + if v == nil { + v14v2 = nil + } else { + v14v2 = make(map[interface{}]int64, len(v)) + } // reset map + testUnmarshalErr(&v14v2, bs14, h, t, "dec-map-v14-p-len") + testDeepEqualErr(v14v1, v14v2, t, "equal-map-v14-p-len") + bs14 = testMarshalErr(&v14v1, h, t, "enc-map-v14-p") + v14v2 = nil + testUnmarshalErr(&v14v2, bs14, h, t, "dec-map-v14-p-nil") + testDeepEqualErr(v14v1, v14v2, t, "equal-map-v14-p-nil") + // ... + if v == nil { + v14v2 = nil + } else { + v14v2 = make(map[interface{}]int64, len(v)) + } // reset map + var v14v3, v14v4 typMapMapIntfInt64 + v14v3 = typMapMapIntfInt64(v14v1) + v14v4 = typMapMapIntfInt64(v14v2) + bs14 = testMarshalErr(v14v3, h, t, "enc-map-v14-custom") + testUnmarshalErr(v14v4, bs14, h, t, "dec-map-v14-p-len") + testDeepEqualErr(v14v3, v14v4, t, "equal-map-v14-p-len") + } + + for _, v := range []map[interface{}]float32{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 22.2}} { + // fmt.Printf(">>>> running mammoth map v15: %v\n", v) + var v15v1, v15v2 map[interface{}]float32 + v15v1 = v + bs15 := testMarshalErr(v15v1, h, t, "enc-map-v15") + if v == nil { + v15v2 = nil + } else { + v15v2 = make(map[interface{}]float32, len(v)) + } // reset map + testUnmarshalErr(v15v2, bs15, h, t, "dec-map-v15") + testDeepEqualErr(v15v1, v15v2, t, "equal-map-v15") + if v == nil { + v15v2 = nil + } else { + v15v2 = make(map[interface{}]float32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v15v2), bs15, h, t, "dec-map-v15-noaddr") // decode into non-addressable map value + testDeepEqualErr(v15v1, v15v2, t, "equal-map-v15-noaddr") + if v == nil { + v15v2 = nil + } else { + v15v2 = make(map[interface{}]float32, len(v)) + } // reset map + testUnmarshalErr(&v15v2, bs15, h, t, "dec-map-v15-p-len") + testDeepEqualErr(v15v1, v15v2, t, "equal-map-v15-p-len") + bs15 = testMarshalErr(&v15v1, h, t, "enc-map-v15-p") + v15v2 = nil + testUnmarshalErr(&v15v2, bs15, h, t, "dec-map-v15-p-nil") + testDeepEqualErr(v15v1, v15v2, t, "equal-map-v15-p-nil") + // ... + if v == nil { + v15v2 = nil + } else { + v15v2 = make(map[interface{}]float32, len(v)) + } // reset map + var v15v3, v15v4 typMapMapIntfFloat32 + v15v3 = typMapMapIntfFloat32(v15v1) + v15v4 = typMapMapIntfFloat32(v15v2) + bs15 = testMarshalErr(v15v3, h, t, "enc-map-v15-custom") + testUnmarshalErr(v15v4, bs15, h, t, "dec-map-v15-p-len") + testDeepEqualErr(v15v3, v15v4, t, "equal-map-v15-p-len") + } + + for _, v := range []map[interface{}]float64{nil, {}, {"string-is-an-interface": 0, "string-is-an-interface-2": 11.1}} { + // fmt.Printf(">>>> running mammoth map v16: %v\n", v) + var v16v1, v16v2 map[interface{}]float64 + v16v1 = v + bs16 := testMarshalErr(v16v1, h, t, "enc-map-v16") + if v == nil { + v16v2 = nil + } else { + v16v2 = make(map[interface{}]float64, len(v)) + } // reset map + testUnmarshalErr(v16v2, bs16, h, t, "dec-map-v16") + testDeepEqualErr(v16v1, v16v2, t, "equal-map-v16") + if v == nil { + v16v2 = nil + } else { + v16v2 = make(map[interface{}]float64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v16v2), bs16, h, t, "dec-map-v16-noaddr") // decode into non-addressable map value + testDeepEqualErr(v16v1, v16v2, t, "equal-map-v16-noaddr") + if v == nil { + v16v2 = nil + } else { + v16v2 = make(map[interface{}]float64, len(v)) + } // reset map + testUnmarshalErr(&v16v2, bs16, h, t, "dec-map-v16-p-len") + testDeepEqualErr(v16v1, v16v2, t, "equal-map-v16-p-len") + bs16 = testMarshalErr(&v16v1, h, t, "enc-map-v16-p") + v16v2 = nil + testUnmarshalErr(&v16v2, bs16, h, t, "dec-map-v16-p-nil") + testDeepEqualErr(v16v1, v16v2, t, "equal-map-v16-p-nil") + // ... + if v == nil { + v16v2 = nil + } else { + v16v2 = make(map[interface{}]float64, len(v)) + } // reset map + var v16v3, v16v4 typMapMapIntfFloat64 + v16v3 = typMapMapIntfFloat64(v16v1) + v16v4 = typMapMapIntfFloat64(v16v2) + bs16 = testMarshalErr(v16v3, h, t, "enc-map-v16-custom") + testUnmarshalErr(v16v4, bs16, h, t, "dec-map-v16-p-len") + testDeepEqualErr(v16v3, v16v4, t, "equal-map-v16-p-len") + } + + for _, v := range []map[interface{}]bool{nil, {}, {"string-is-an-interface": false, "string-is-an-interface-2": true}} { + // fmt.Printf(">>>> running mammoth map v17: %v\n", v) + var v17v1, v17v2 map[interface{}]bool + v17v1 = v + bs17 := testMarshalErr(v17v1, h, t, "enc-map-v17") + if v == nil { + v17v2 = nil + } else { + v17v2 = make(map[interface{}]bool, len(v)) + } // reset map + testUnmarshalErr(v17v2, bs17, h, t, "dec-map-v17") + testDeepEqualErr(v17v1, v17v2, t, "equal-map-v17") + if v == nil { + v17v2 = nil + } else { + v17v2 = make(map[interface{}]bool, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v17v2), bs17, h, t, "dec-map-v17-noaddr") // decode into non-addressable map value + testDeepEqualErr(v17v1, v17v2, t, "equal-map-v17-noaddr") + if v == nil { + v17v2 = nil + } else { + v17v2 = make(map[interface{}]bool, len(v)) + } // reset map + testUnmarshalErr(&v17v2, bs17, h, t, "dec-map-v17-p-len") + testDeepEqualErr(v17v1, v17v2, t, "equal-map-v17-p-len") + bs17 = testMarshalErr(&v17v1, h, t, "enc-map-v17-p") + v17v2 = nil + testUnmarshalErr(&v17v2, bs17, h, t, "dec-map-v17-p-nil") + testDeepEqualErr(v17v1, v17v2, t, "equal-map-v17-p-nil") + // ... + if v == nil { + v17v2 = nil + } else { + v17v2 = make(map[interface{}]bool, len(v)) + } // reset map + var v17v3, v17v4 typMapMapIntfBool + v17v3 = typMapMapIntfBool(v17v1) + v17v4 = typMapMapIntfBool(v17v2) + bs17 = testMarshalErr(v17v3, h, t, "enc-map-v17-custom") + testUnmarshalErr(v17v4, bs17, h, t, "dec-map-v17-p-len") + testDeepEqualErr(v17v3, v17v4, t, "equal-map-v17-p-len") + } + + for _, v := range []map[string]interface{}{nil, {}, {"some-string": nil, "some-string-2": "string-is-an-interface"}} { + // fmt.Printf(">>>> running mammoth map v20: %v\n", v) + var v20v1, v20v2 map[string]interface{} + v20v1 = v + bs20 := testMarshalErr(v20v1, h, t, "enc-map-v20") + if v == nil { + v20v2 = nil + } else { + v20v2 = make(map[string]interface{}, len(v)) + } // reset map + testUnmarshalErr(v20v2, bs20, h, t, "dec-map-v20") + testDeepEqualErr(v20v1, v20v2, t, "equal-map-v20") + if v == nil { + v20v2 = nil + } else { + v20v2 = make(map[string]interface{}, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v20v2), bs20, h, t, "dec-map-v20-noaddr") // decode into non-addressable map value + testDeepEqualErr(v20v1, v20v2, t, "equal-map-v20-noaddr") + if v == nil { + v20v2 = nil + } else { + v20v2 = make(map[string]interface{}, len(v)) + } // reset map + testUnmarshalErr(&v20v2, bs20, h, t, "dec-map-v20-p-len") + testDeepEqualErr(v20v1, v20v2, t, "equal-map-v20-p-len") + bs20 = testMarshalErr(&v20v1, h, t, "enc-map-v20-p") + v20v2 = nil + testUnmarshalErr(&v20v2, bs20, h, t, "dec-map-v20-p-nil") + testDeepEqualErr(v20v1, v20v2, t, "equal-map-v20-p-nil") + // ... + if v == nil { + v20v2 = nil + } else { + v20v2 = make(map[string]interface{}, len(v)) + } // reset map + var v20v3, v20v4 typMapMapStringIntf + v20v3 = typMapMapStringIntf(v20v1) + v20v4 = typMapMapStringIntf(v20v2) + bs20 = testMarshalErr(v20v3, h, t, "enc-map-v20-custom") + testUnmarshalErr(v20v4, bs20, h, t, "dec-map-v20-p-len") + testDeepEqualErr(v20v3, v20v4, t, "equal-map-v20-p-len") + } + + for _, v := range []map[string]string{nil, {}, {"some-string": "", "some-string-2": "some-string"}} { + // fmt.Printf(">>>> running mammoth map v21: %v\n", v) + var v21v1, v21v2 map[string]string + v21v1 = v + bs21 := testMarshalErr(v21v1, h, t, "enc-map-v21") + if v == nil { + v21v2 = nil + } else { + v21v2 = make(map[string]string, len(v)) + } // reset map + testUnmarshalErr(v21v2, bs21, h, t, "dec-map-v21") + testDeepEqualErr(v21v1, v21v2, t, "equal-map-v21") + if v == nil { + v21v2 = nil + } else { + v21v2 = make(map[string]string, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v21v2), bs21, h, t, "dec-map-v21-noaddr") // decode into non-addressable map value + testDeepEqualErr(v21v1, v21v2, t, "equal-map-v21-noaddr") + if v == nil { + v21v2 = nil + } else { + v21v2 = make(map[string]string, len(v)) + } // reset map + testUnmarshalErr(&v21v2, bs21, h, t, "dec-map-v21-p-len") + testDeepEqualErr(v21v1, v21v2, t, "equal-map-v21-p-len") + bs21 = testMarshalErr(&v21v1, h, t, "enc-map-v21-p") + v21v2 = nil + testUnmarshalErr(&v21v2, bs21, h, t, "dec-map-v21-p-nil") + testDeepEqualErr(v21v1, v21v2, t, "equal-map-v21-p-nil") + // ... + if v == nil { + v21v2 = nil + } else { + v21v2 = make(map[string]string, len(v)) + } // reset map + var v21v3, v21v4 typMapMapStringString + v21v3 = typMapMapStringString(v21v1) + v21v4 = typMapMapStringString(v21v2) + bs21 = testMarshalErr(v21v3, h, t, "enc-map-v21-custom") + testUnmarshalErr(v21v4, bs21, h, t, "dec-map-v21-p-len") + testDeepEqualErr(v21v3, v21v4, t, "equal-map-v21-p-len") + } + + for _, v := range []map[string]uint{nil, {}, {"some-string-2": 0, "some-string": 33}} { + // fmt.Printf(">>>> running mammoth map v22: %v\n", v) + var v22v1, v22v2 map[string]uint + v22v1 = v + bs22 := testMarshalErr(v22v1, h, t, "enc-map-v22") + if v == nil { + v22v2 = nil + } else { + v22v2 = make(map[string]uint, len(v)) + } // reset map + testUnmarshalErr(v22v2, bs22, h, t, "dec-map-v22") + testDeepEqualErr(v22v1, v22v2, t, "equal-map-v22") + if v == nil { + v22v2 = nil + } else { + v22v2 = make(map[string]uint, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v22v2), bs22, h, t, "dec-map-v22-noaddr") // decode into non-addressable map value + testDeepEqualErr(v22v1, v22v2, t, "equal-map-v22-noaddr") + if v == nil { + v22v2 = nil + } else { + v22v2 = make(map[string]uint, len(v)) + } // reset map + testUnmarshalErr(&v22v2, bs22, h, t, "dec-map-v22-p-len") + testDeepEqualErr(v22v1, v22v2, t, "equal-map-v22-p-len") + bs22 = testMarshalErr(&v22v1, h, t, "enc-map-v22-p") + v22v2 = nil + testUnmarshalErr(&v22v2, bs22, h, t, "dec-map-v22-p-nil") + testDeepEqualErr(v22v1, v22v2, t, "equal-map-v22-p-nil") + // ... + if v == nil { + v22v2 = nil + } else { + v22v2 = make(map[string]uint, len(v)) + } // reset map + var v22v3, v22v4 typMapMapStringUint + v22v3 = typMapMapStringUint(v22v1) + v22v4 = typMapMapStringUint(v22v2) + bs22 = testMarshalErr(v22v3, h, t, "enc-map-v22-custom") + testUnmarshalErr(v22v4, bs22, h, t, "dec-map-v22-p-len") + testDeepEqualErr(v22v3, v22v4, t, "equal-map-v22-p-len") + } + + for _, v := range []map[string]uint8{nil, {}, {"some-string-2": 0, "some-string": 44}} { + // fmt.Printf(">>>> running mammoth map v23: %v\n", v) + var v23v1, v23v2 map[string]uint8 + v23v1 = v + bs23 := testMarshalErr(v23v1, h, t, "enc-map-v23") + if v == nil { + v23v2 = nil + } else { + v23v2 = make(map[string]uint8, len(v)) + } // reset map + testUnmarshalErr(v23v2, bs23, h, t, "dec-map-v23") + testDeepEqualErr(v23v1, v23v2, t, "equal-map-v23") + if v == nil { + v23v2 = nil + } else { + v23v2 = make(map[string]uint8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v23v2), bs23, h, t, "dec-map-v23-noaddr") // decode into non-addressable map value + testDeepEqualErr(v23v1, v23v2, t, "equal-map-v23-noaddr") + if v == nil { + v23v2 = nil + } else { + v23v2 = make(map[string]uint8, len(v)) + } // reset map + testUnmarshalErr(&v23v2, bs23, h, t, "dec-map-v23-p-len") + testDeepEqualErr(v23v1, v23v2, t, "equal-map-v23-p-len") + bs23 = testMarshalErr(&v23v1, h, t, "enc-map-v23-p") + v23v2 = nil + testUnmarshalErr(&v23v2, bs23, h, t, "dec-map-v23-p-nil") + testDeepEqualErr(v23v1, v23v2, t, "equal-map-v23-p-nil") + // ... + if v == nil { + v23v2 = nil + } else { + v23v2 = make(map[string]uint8, len(v)) + } // reset map + var v23v3, v23v4 typMapMapStringUint8 + v23v3 = typMapMapStringUint8(v23v1) + v23v4 = typMapMapStringUint8(v23v2) + bs23 = testMarshalErr(v23v3, h, t, "enc-map-v23-custom") + testUnmarshalErr(v23v4, bs23, h, t, "dec-map-v23-p-len") + testDeepEqualErr(v23v3, v23v4, t, "equal-map-v23-p-len") + } + + for _, v := range []map[string]uint16{nil, {}, {"some-string-2": 0, "some-string": 33}} { + // fmt.Printf(">>>> running mammoth map v24: %v\n", v) + var v24v1, v24v2 map[string]uint16 + v24v1 = v + bs24 := testMarshalErr(v24v1, h, t, "enc-map-v24") + if v == nil { + v24v2 = nil + } else { + v24v2 = make(map[string]uint16, len(v)) + } // reset map + testUnmarshalErr(v24v2, bs24, h, t, "dec-map-v24") + testDeepEqualErr(v24v1, v24v2, t, "equal-map-v24") + if v == nil { + v24v2 = nil + } else { + v24v2 = make(map[string]uint16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v24v2), bs24, h, t, "dec-map-v24-noaddr") // decode into non-addressable map value + testDeepEqualErr(v24v1, v24v2, t, "equal-map-v24-noaddr") + if v == nil { + v24v2 = nil + } else { + v24v2 = make(map[string]uint16, len(v)) + } // reset map + testUnmarshalErr(&v24v2, bs24, h, t, "dec-map-v24-p-len") + testDeepEqualErr(v24v1, v24v2, t, "equal-map-v24-p-len") + bs24 = testMarshalErr(&v24v1, h, t, "enc-map-v24-p") + v24v2 = nil + testUnmarshalErr(&v24v2, bs24, h, t, "dec-map-v24-p-nil") + testDeepEqualErr(v24v1, v24v2, t, "equal-map-v24-p-nil") + // ... + if v == nil { + v24v2 = nil + } else { + v24v2 = make(map[string]uint16, len(v)) + } // reset map + var v24v3, v24v4 typMapMapStringUint16 + v24v3 = typMapMapStringUint16(v24v1) + v24v4 = typMapMapStringUint16(v24v2) + bs24 = testMarshalErr(v24v3, h, t, "enc-map-v24-custom") + testUnmarshalErr(v24v4, bs24, h, t, "dec-map-v24-p-len") + testDeepEqualErr(v24v3, v24v4, t, "equal-map-v24-p-len") + } + + for _, v := range []map[string]uint32{nil, {}, {"some-string-2": 0, "some-string": 44}} { + // fmt.Printf(">>>> running mammoth map v25: %v\n", v) + var v25v1, v25v2 map[string]uint32 + v25v1 = v + bs25 := testMarshalErr(v25v1, h, t, "enc-map-v25") + if v == nil { + v25v2 = nil + } else { + v25v2 = make(map[string]uint32, len(v)) + } // reset map + testUnmarshalErr(v25v2, bs25, h, t, "dec-map-v25") + testDeepEqualErr(v25v1, v25v2, t, "equal-map-v25") + if v == nil { + v25v2 = nil + } else { + v25v2 = make(map[string]uint32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v25v2), bs25, h, t, "dec-map-v25-noaddr") // decode into non-addressable map value + testDeepEqualErr(v25v1, v25v2, t, "equal-map-v25-noaddr") + if v == nil { + v25v2 = nil + } else { + v25v2 = make(map[string]uint32, len(v)) + } // reset map + testUnmarshalErr(&v25v2, bs25, h, t, "dec-map-v25-p-len") + testDeepEqualErr(v25v1, v25v2, t, "equal-map-v25-p-len") + bs25 = testMarshalErr(&v25v1, h, t, "enc-map-v25-p") + v25v2 = nil + testUnmarshalErr(&v25v2, bs25, h, t, "dec-map-v25-p-nil") + testDeepEqualErr(v25v1, v25v2, t, "equal-map-v25-p-nil") + // ... + if v == nil { + v25v2 = nil + } else { + v25v2 = make(map[string]uint32, len(v)) + } // reset map + var v25v3, v25v4 typMapMapStringUint32 + v25v3 = typMapMapStringUint32(v25v1) + v25v4 = typMapMapStringUint32(v25v2) + bs25 = testMarshalErr(v25v3, h, t, "enc-map-v25-custom") + testUnmarshalErr(v25v4, bs25, h, t, "dec-map-v25-p-len") + testDeepEqualErr(v25v3, v25v4, t, "equal-map-v25-p-len") + } + + for _, v := range []map[string]uint64{nil, {}, {"some-string-2": 0, "some-string": 33}} { + // fmt.Printf(">>>> running mammoth map v26: %v\n", v) + var v26v1, v26v2 map[string]uint64 + v26v1 = v + bs26 := testMarshalErr(v26v1, h, t, "enc-map-v26") + if v == nil { + v26v2 = nil + } else { + v26v2 = make(map[string]uint64, len(v)) + } // reset map + testUnmarshalErr(v26v2, bs26, h, t, "dec-map-v26") + testDeepEqualErr(v26v1, v26v2, t, "equal-map-v26") + if v == nil { + v26v2 = nil + } else { + v26v2 = make(map[string]uint64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v26v2), bs26, h, t, "dec-map-v26-noaddr") // decode into non-addressable map value + testDeepEqualErr(v26v1, v26v2, t, "equal-map-v26-noaddr") + if v == nil { + v26v2 = nil + } else { + v26v2 = make(map[string]uint64, len(v)) + } // reset map + testUnmarshalErr(&v26v2, bs26, h, t, "dec-map-v26-p-len") + testDeepEqualErr(v26v1, v26v2, t, "equal-map-v26-p-len") + bs26 = testMarshalErr(&v26v1, h, t, "enc-map-v26-p") + v26v2 = nil + testUnmarshalErr(&v26v2, bs26, h, t, "dec-map-v26-p-nil") + testDeepEqualErr(v26v1, v26v2, t, "equal-map-v26-p-nil") + // ... + if v == nil { + v26v2 = nil + } else { + v26v2 = make(map[string]uint64, len(v)) + } // reset map + var v26v3, v26v4 typMapMapStringUint64 + v26v3 = typMapMapStringUint64(v26v1) + v26v4 = typMapMapStringUint64(v26v2) + bs26 = testMarshalErr(v26v3, h, t, "enc-map-v26-custom") + testUnmarshalErr(v26v4, bs26, h, t, "dec-map-v26-p-len") + testDeepEqualErr(v26v3, v26v4, t, "equal-map-v26-p-len") + } + + for _, v := range []map[string]uintptr{nil, {}, {"some-string-2": 0, "some-string": 44}} { + // fmt.Printf(">>>> running mammoth map v27: %v\n", v) + var v27v1, v27v2 map[string]uintptr + v27v1 = v + bs27 := testMarshalErr(v27v1, h, t, "enc-map-v27") + if v == nil { + v27v2 = nil + } else { + v27v2 = make(map[string]uintptr, len(v)) + } // reset map + testUnmarshalErr(v27v2, bs27, h, t, "dec-map-v27") + testDeepEqualErr(v27v1, v27v2, t, "equal-map-v27") + if v == nil { + v27v2 = nil + } else { + v27v2 = make(map[string]uintptr, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v27v2), bs27, h, t, "dec-map-v27-noaddr") // decode into non-addressable map value + testDeepEqualErr(v27v1, v27v2, t, "equal-map-v27-noaddr") + if v == nil { + v27v2 = nil + } else { + v27v2 = make(map[string]uintptr, len(v)) + } // reset map + testUnmarshalErr(&v27v2, bs27, h, t, "dec-map-v27-p-len") + testDeepEqualErr(v27v1, v27v2, t, "equal-map-v27-p-len") + bs27 = testMarshalErr(&v27v1, h, t, "enc-map-v27-p") + v27v2 = nil + testUnmarshalErr(&v27v2, bs27, h, t, "dec-map-v27-p-nil") + testDeepEqualErr(v27v1, v27v2, t, "equal-map-v27-p-nil") + // ... + if v == nil { + v27v2 = nil + } else { + v27v2 = make(map[string]uintptr, len(v)) + } // reset map + var v27v3, v27v4 typMapMapStringUintptr + v27v3 = typMapMapStringUintptr(v27v1) + v27v4 = typMapMapStringUintptr(v27v2) + bs27 = testMarshalErr(v27v3, h, t, "enc-map-v27-custom") + testUnmarshalErr(v27v4, bs27, h, t, "dec-map-v27-p-len") + testDeepEqualErr(v27v3, v27v4, t, "equal-map-v27-p-len") + } + + for _, v := range []map[string]int{nil, {}, {"some-string-2": 0, "some-string": 33}} { + // fmt.Printf(">>>> running mammoth map v28: %v\n", v) + var v28v1, v28v2 map[string]int + v28v1 = v + bs28 := testMarshalErr(v28v1, h, t, "enc-map-v28") + if v == nil { + v28v2 = nil + } else { + v28v2 = make(map[string]int, len(v)) + } // reset map + testUnmarshalErr(v28v2, bs28, h, t, "dec-map-v28") + testDeepEqualErr(v28v1, v28v2, t, "equal-map-v28") + if v == nil { + v28v2 = nil + } else { + v28v2 = make(map[string]int, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v28v2), bs28, h, t, "dec-map-v28-noaddr") // decode into non-addressable map value + testDeepEqualErr(v28v1, v28v2, t, "equal-map-v28-noaddr") + if v == nil { + v28v2 = nil + } else { + v28v2 = make(map[string]int, len(v)) + } // reset map + testUnmarshalErr(&v28v2, bs28, h, t, "dec-map-v28-p-len") + testDeepEqualErr(v28v1, v28v2, t, "equal-map-v28-p-len") + bs28 = testMarshalErr(&v28v1, h, t, "enc-map-v28-p") + v28v2 = nil + testUnmarshalErr(&v28v2, bs28, h, t, "dec-map-v28-p-nil") + testDeepEqualErr(v28v1, v28v2, t, "equal-map-v28-p-nil") + // ... + if v == nil { + v28v2 = nil + } else { + v28v2 = make(map[string]int, len(v)) + } // reset map + var v28v3, v28v4 typMapMapStringInt + v28v3 = typMapMapStringInt(v28v1) + v28v4 = typMapMapStringInt(v28v2) + bs28 = testMarshalErr(v28v3, h, t, "enc-map-v28-custom") + testUnmarshalErr(v28v4, bs28, h, t, "dec-map-v28-p-len") + testDeepEqualErr(v28v3, v28v4, t, "equal-map-v28-p-len") + } + + for _, v := range []map[string]int8{nil, {}, {"some-string-2": 0, "some-string": 44}} { + // fmt.Printf(">>>> running mammoth map v29: %v\n", v) + var v29v1, v29v2 map[string]int8 + v29v1 = v + bs29 := testMarshalErr(v29v1, h, t, "enc-map-v29") + if v == nil { + v29v2 = nil + } else { + v29v2 = make(map[string]int8, len(v)) + } // reset map + testUnmarshalErr(v29v2, bs29, h, t, "dec-map-v29") + testDeepEqualErr(v29v1, v29v2, t, "equal-map-v29") + if v == nil { + v29v2 = nil + } else { + v29v2 = make(map[string]int8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v29v2), bs29, h, t, "dec-map-v29-noaddr") // decode into non-addressable map value + testDeepEqualErr(v29v1, v29v2, t, "equal-map-v29-noaddr") + if v == nil { + v29v2 = nil + } else { + v29v2 = make(map[string]int8, len(v)) + } // reset map + testUnmarshalErr(&v29v2, bs29, h, t, "dec-map-v29-p-len") + testDeepEqualErr(v29v1, v29v2, t, "equal-map-v29-p-len") + bs29 = testMarshalErr(&v29v1, h, t, "enc-map-v29-p") + v29v2 = nil + testUnmarshalErr(&v29v2, bs29, h, t, "dec-map-v29-p-nil") + testDeepEqualErr(v29v1, v29v2, t, "equal-map-v29-p-nil") + // ... + if v == nil { + v29v2 = nil + } else { + v29v2 = make(map[string]int8, len(v)) + } // reset map + var v29v3, v29v4 typMapMapStringInt8 + v29v3 = typMapMapStringInt8(v29v1) + v29v4 = typMapMapStringInt8(v29v2) + bs29 = testMarshalErr(v29v3, h, t, "enc-map-v29-custom") + testUnmarshalErr(v29v4, bs29, h, t, "dec-map-v29-p-len") + testDeepEqualErr(v29v3, v29v4, t, "equal-map-v29-p-len") + } + + for _, v := range []map[string]int16{nil, {}, {"some-string-2": 0, "some-string": 33}} { + // fmt.Printf(">>>> running mammoth map v30: %v\n", v) + var v30v1, v30v2 map[string]int16 + v30v1 = v + bs30 := testMarshalErr(v30v1, h, t, "enc-map-v30") + if v == nil { + v30v2 = nil + } else { + v30v2 = make(map[string]int16, len(v)) + } // reset map + testUnmarshalErr(v30v2, bs30, h, t, "dec-map-v30") + testDeepEqualErr(v30v1, v30v2, t, "equal-map-v30") + if v == nil { + v30v2 = nil + } else { + v30v2 = make(map[string]int16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v30v2), bs30, h, t, "dec-map-v30-noaddr") // decode into non-addressable map value + testDeepEqualErr(v30v1, v30v2, t, "equal-map-v30-noaddr") + if v == nil { + v30v2 = nil + } else { + v30v2 = make(map[string]int16, len(v)) + } // reset map + testUnmarshalErr(&v30v2, bs30, h, t, "dec-map-v30-p-len") + testDeepEqualErr(v30v1, v30v2, t, "equal-map-v30-p-len") + bs30 = testMarshalErr(&v30v1, h, t, "enc-map-v30-p") + v30v2 = nil + testUnmarshalErr(&v30v2, bs30, h, t, "dec-map-v30-p-nil") + testDeepEqualErr(v30v1, v30v2, t, "equal-map-v30-p-nil") + // ... + if v == nil { + v30v2 = nil + } else { + v30v2 = make(map[string]int16, len(v)) + } // reset map + var v30v3, v30v4 typMapMapStringInt16 + v30v3 = typMapMapStringInt16(v30v1) + v30v4 = typMapMapStringInt16(v30v2) + bs30 = testMarshalErr(v30v3, h, t, "enc-map-v30-custom") + testUnmarshalErr(v30v4, bs30, h, t, "dec-map-v30-p-len") + testDeepEqualErr(v30v3, v30v4, t, "equal-map-v30-p-len") + } + + for _, v := range []map[string]int32{nil, {}, {"some-string-2": 0, "some-string": 44}} { + // fmt.Printf(">>>> running mammoth map v31: %v\n", v) + var v31v1, v31v2 map[string]int32 + v31v1 = v + bs31 := testMarshalErr(v31v1, h, t, "enc-map-v31") + if v == nil { + v31v2 = nil + } else { + v31v2 = make(map[string]int32, len(v)) + } // reset map + testUnmarshalErr(v31v2, bs31, h, t, "dec-map-v31") + testDeepEqualErr(v31v1, v31v2, t, "equal-map-v31") + if v == nil { + v31v2 = nil + } else { + v31v2 = make(map[string]int32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v31v2), bs31, h, t, "dec-map-v31-noaddr") // decode into non-addressable map value + testDeepEqualErr(v31v1, v31v2, t, "equal-map-v31-noaddr") + if v == nil { + v31v2 = nil + } else { + v31v2 = make(map[string]int32, len(v)) + } // reset map + testUnmarshalErr(&v31v2, bs31, h, t, "dec-map-v31-p-len") + testDeepEqualErr(v31v1, v31v2, t, "equal-map-v31-p-len") + bs31 = testMarshalErr(&v31v1, h, t, "enc-map-v31-p") + v31v2 = nil + testUnmarshalErr(&v31v2, bs31, h, t, "dec-map-v31-p-nil") + testDeepEqualErr(v31v1, v31v2, t, "equal-map-v31-p-nil") + // ... + if v == nil { + v31v2 = nil + } else { + v31v2 = make(map[string]int32, len(v)) + } // reset map + var v31v3, v31v4 typMapMapStringInt32 + v31v3 = typMapMapStringInt32(v31v1) + v31v4 = typMapMapStringInt32(v31v2) + bs31 = testMarshalErr(v31v3, h, t, "enc-map-v31-custom") + testUnmarshalErr(v31v4, bs31, h, t, "dec-map-v31-p-len") + testDeepEqualErr(v31v3, v31v4, t, "equal-map-v31-p-len") + } + + for _, v := range []map[string]int64{nil, {}, {"some-string-2": 0, "some-string": 33}} { + // fmt.Printf(">>>> running mammoth map v32: %v\n", v) + var v32v1, v32v2 map[string]int64 + v32v1 = v + bs32 := testMarshalErr(v32v1, h, t, "enc-map-v32") + if v == nil { + v32v2 = nil + } else { + v32v2 = make(map[string]int64, len(v)) + } // reset map + testUnmarshalErr(v32v2, bs32, h, t, "dec-map-v32") + testDeepEqualErr(v32v1, v32v2, t, "equal-map-v32") + if v == nil { + v32v2 = nil + } else { + v32v2 = make(map[string]int64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v32v2), bs32, h, t, "dec-map-v32-noaddr") // decode into non-addressable map value + testDeepEqualErr(v32v1, v32v2, t, "equal-map-v32-noaddr") + if v == nil { + v32v2 = nil + } else { + v32v2 = make(map[string]int64, len(v)) + } // reset map + testUnmarshalErr(&v32v2, bs32, h, t, "dec-map-v32-p-len") + testDeepEqualErr(v32v1, v32v2, t, "equal-map-v32-p-len") + bs32 = testMarshalErr(&v32v1, h, t, "enc-map-v32-p") + v32v2 = nil + testUnmarshalErr(&v32v2, bs32, h, t, "dec-map-v32-p-nil") + testDeepEqualErr(v32v1, v32v2, t, "equal-map-v32-p-nil") + // ... + if v == nil { + v32v2 = nil + } else { + v32v2 = make(map[string]int64, len(v)) + } // reset map + var v32v3, v32v4 typMapMapStringInt64 + v32v3 = typMapMapStringInt64(v32v1) + v32v4 = typMapMapStringInt64(v32v2) + bs32 = testMarshalErr(v32v3, h, t, "enc-map-v32-custom") + testUnmarshalErr(v32v4, bs32, h, t, "dec-map-v32-p-len") + testDeepEqualErr(v32v3, v32v4, t, "equal-map-v32-p-len") + } + + for _, v := range []map[string]float32{nil, {}, {"some-string-2": 0, "some-string": 22.2}} { + // fmt.Printf(">>>> running mammoth map v33: %v\n", v) + var v33v1, v33v2 map[string]float32 + v33v1 = v + bs33 := testMarshalErr(v33v1, h, t, "enc-map-v33") + if v == nil { + v33v2 = nil + } else { + v33v2 = make(map[string]float32, len(v)) + } // reset map + testUnmarshalErr(v33v2, bs33, h, t, "dec-map-v33") + testDeepEqualErr(v33v1, v33v2, t, "equal-map-v33") + if v == nil { + v33v2 = nil + } else { + v33v2 = make(map[string]float32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v33v2), bs33, h, t, "dec-map-v33-noaddr") // decode into non-addressable map value + testDeepEqualErr(v33v1, v33v2, t, "equal-map-v33-noaddr") + if v == nil { + v33v2 = nil + } else { + v33v2 = make(map[string]float32, len(v)) + } // reset map + testUnmarshalErr(&v33v2, bs33, h, t, "dec-map-v33-p-len") + testDeepEqualErr(v33v1, v33v2, t, "equal-map-v33-p-len") + bs33 = testMarshalErr(&v33v1, h, t, "enc-map-v33-p") + v33v2 = nil + testUnmarshalErr(&v33v2, bs33, h, t, "dec-map-v33-p-nil") + testDeepEqualErr(v33v1, v33v2, t, "equal-map-v33-p-nil") + // ... + if v == nil { + v33v2 = nil + } else { + v33v2 = make(map[string]float32, len(v)) + } // reset map + var v33v3, v33v4 typMapMapStringFloat32 + v33v3 = typMapMapStringFloat32(v33v1) + v33v4 = typMapMapStringFloat32(v33v2) + bs33 = testMarshalErr(v33v3, h, t, "enc-map-v33-custom") + testUnmarshalErr(v33v4, bs33, h, t, "dec-map-v33-p-len") + testDeepEqualErr(v33v3, v33v4, t, "equal-map-v33-p-len") + } + + for _, v := range []map[string]float64{nil, {}, {"some-string-2": 0, "some-string": 11.1}} { + // fmt.Printf(">>>> running mammoth map v34: %v\n", v) + var v34v1, v34v2 map[string]float64 + v34v1 = v + bs34 := testMarshalErr(v34v1, h, t, "enc-map-v34") + if v == nil { + v34v2 = nil + } else { + v34v2 = make(map[string]float64, len(v)) + } // reset map + testUnmarshalErr(v34v2, bs34, h, t, "dec-map-v34") + testDeepEqualErr(v34v1, v34v2, t, "equal-map-v34") + if v == nil { + v34v2 = nil + } else { + v34v2 = make(map[string]float64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v34v2), bs34, h, t, "dec-map-v34-noaddr") // decode into non-addressable map value + testDeepEqualErr(v34v1, v34v2, t, "equal-map-v34-noaddr") + if v == nil { + v34v2 = nil + } else { + v34v2 = make(map[string]float64, len(v)) + } // reset map + testUnmarshalErr(&v34v2, bs34, h, t, "dec-map-v34-p-len") + testDeepEqualErr(v34v1, v34v2, t, "equal-map-v34-p-len") + bs34 = testMarshalErr(&v34v1, h, t, "enc-map-v34-p") + v34v2 = nil + testUnmarshalErr(&v34v2, bs34, h, t, "dec-map-v34-p-nil") + testDeepEqualErr(v34v1, v34v2, t, "equal-map-v34-p-nil") + // ... + if v == nil { + v34v2 = nil + } else { + v34v2 = make(map[string]float64, len(v)) + } // reset map + var v34v3, v34v4 typMapMapStringFloat64 + v34v3 = typMapMapStringFloat64(v34v1) + v34v4 = typMapMapStringFloat64(v34v2) + bs34 = testMarshalErr(v34v3, h, t, "enc-map-v34-custom") + testUnmarshalErr(v34v4, bs34, h, t, "dec-map-v34-p-len") + testDeepEqualErr(v34v3, v34v4, t, "equal-map-v34-p-len") + } + + for _, v := range []map[string]bool{nil, {}, {"some-string-2": false, "some-string": true}} { + // fmt.Printf(">>>> running mammoth map v35: %v\n", v) + var v35v1, v35v2 map[string]bool + v35v1 = v + bs35 := testMarshalErr(v35v1, h, t, "enc-map-v35") + if v == nil { + v35v2 = nil + } else { + v35v2 = make(map[string]bool, len(v)) + } // reset map + testUnmarshalErr(v35v2, bs35, h, t, "dec-map-v35") + testDeepEqualErr(v35v1, v35v2, t, "equal-map-v35") + if v == nil { + v35v2 = nil + } else { + v35v2 = make(map[string]bool, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v35v2), bs35, h, t, "dec-map-v35-noaddr") // decode into non-addressable map value + testDeepEqualErr(v35v1, v35v2, t, "equal-map-v35-noaddr") + if v == nil { + v35v2 = nil + } else { + v35v2 = make(map[string]bool, len(v)) + } // reset map + testUnmarshalErr(&v35v2, bs35, h, t, "dec-map-v35-p-len") + testDeepEqualErr(v35v1, v35v2, t, "equal-map-v35-p-len") + bs35 = testMarshalErr(&v35v1, h, t, "enc-map-v35-p") + v35v2 = nil + testUnmarshalErr(&v35v2, bs35, h, t, "dec-map-v35-p-nil") + testDeepEqualErr(v35v1, v35v2, t, "equal-map-v35-p-nil") + // ... + if v == nil { + v35v2 = nil + } else { + v35v2 = make(map[string]bool, len(v)) + } // reset map + var v35v3, v35v4 typMapMapStringBool + v35v3 = typMapMapStringBool(v35v1) + v35v4 = typMapMapStringBool(v35v2) + bs35 = testMarshalErr(v35v3, h, t, "enc-map-v35-custom") + testUnmarshalErr(v35v4, bs35, h, t, "dec-map-v35-p-len") + testDeepEqualErr(v35v3, v35v4, t, "equal-map-v35-p-len") + } + + for _, v := range []map[float32]interface{}{nil, {}, {22.2: nil, 11.1: "string-is-an-interface-2"}} { + // fmt.Printf(">>>> running mammoth map v38: %v\n", v) + var v38v1, v38v2 map[float32]interface{} + v38v1 = v + bs38 := testMarshalErr(v38v1, h, t, "enc-map-v38") + if v == nil { + v38v2 = nil + } else { + v38v2 = make(map[float32]interface{}, len(v)) + } // reset map + testUnmarshalErr(v38v2, bs38, h, t, "dec-map-v38") + testDeepEqualErr(v38v1, v38v2, t, "equal-map-v38") + if v == nil { + v38v2 = nil + } else { + v38v2 = make(map[float32]interface{}, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v38v2), bs38, h, t, "dec-map-v38-noaddr") // decode into non-addressable map value + testDeepEqualErr(v38v1, v38v2, t, "equal-map-v38-noaddr") + if v == nil { + v38v2 = nil + } else { + v38v2 = make(map[float32]interface{}, len(v)) + } // reset map + testUnmarshalErr(&v38v2, bs38, h, t, "dec-map-v38-p-len") + testDeepEqualErr(v38v1, v38v2, t, "equal-map-v38-p-len") + bs38 = testMarshalErr(&v38v1, h, t, "enc-map-v38-p") + v38v2 = nil + testUnmarshalErr(&v38v2, bs38, h, t, "dec-map-v38-p-nil") + testDeepEqualErr(v38v1, v38v2, t, "equal-map-v38-p-nil") + // ... + if v == nil { + v38v2 = nil + } else { + v38v2 = make(map[float32]interface{}, len(v)) + } // reset map + var v38v3, v38v4 typMapMapFloat32Intf + v38v3 = typMapMapFloat32Intf(v38v1) + v38v4 = typMapMapFloat32Intf(v38v2) + bs38 = testMarshalErr(v38v3, h, t, "enc-map-v38-custom") + testUnmarshalErr(v38v4, bs38, h, t, "dec-map-v38-p-len") + testDeepEqualErr(v38v3, v38v4, t, "equal-map-v38-p-len") + } + + for _, v := range []map[float32]string{nil, {}, {22.2: "", 11.1: "some-string-2"}} { + // fmt.Printf(">>>> running mammoth map v39: %v\n", v) + var v39v1, v39v2 map[float32]string + v39v1 = v + bs39 := testMarshalErr(v39v1, h, t, "enc-map-v39") + if v == nil { + v39v2 = nil + } else { + v39v2 = make(map[float32]string, len(v)) + } // reset map + testUnmarshalErr(v39v2, bs39, h, t, "dec-map-v39") + testDeepEqualErr(v39v1, v39v2, t, "equal-map-v39") + if v == nil { + v39v2 = nil + } else { + v39v2 = make(map[float32]string, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v39v2), bs39, h, t, "dec-map-v39-noaddr") // decode into non-addressable map value + testDeepEqualErr(v39v1, v39v2, t, "equal-map-v39-noaddr") + if v == nil { + v39v2 = nil + } else { + v39v2 = make(map[float32]string, len(v)) + } // reset map + testUnmarshalErr(&v39v2, bs39, h, t, "dec-map-v39-p-len") + testDeepEqualErr(v39v1, v39v2, t, "equal-map-v39-p-len") + bs39 = testMarshalErr(&v39v1, h, t, "enc-map-v39-p") + v39v2 = nil + testUnmarshalErr(&v39v2, bs39, h, t, "dec-map-v39-p-nil") + testDeepEqualErr(v39v1, v39v2, t, "equal-map-v39-p-nil") + // ... + if v == nil { + v39v2 = nil + } else { + v39v2 = make(map[float32]string, len(v)) + } // reset map + var v39v3, v39v4 typMapMapFloat32String + v39v3 = typMapMapFloat32String(v39v1) + v39v4 = typMapMapFloat32String(v39v2) + bs39 = testMarshalErr(v39v3, h, t, "enc-map-v39-custom") + testUnmarshalErr(v39v4, bs39, h, t, "dec-map-v39-p-len") + testDeepEqualErr(v39v3, v39v4, t, "equal-map-v39-p-len") + } + + for _, v := range []map[float32]uint{nil, {}, {22.2: 0, 11.1: 44}} { + // fmt.Printf(">>>> running mammoth map v40: %v\n", v) + var v40v1, v40v2 map[float32]uint + v40v1 = v + bs40 := testMarshalErr(v40v1, h, t, "enc-map-v40") + if v == nil { + v40v2 = nil + } else { + v40v2 = make(map[float32]uint, len(v)) + } // reset map + testUnmarshalErr(v40v2, bs40, h, t, "dec-map-v40") + testDeepEqualErr(v40v1, v40v2, t, "equal-map-v40") + if v == nil { + v40v2 = nil + } else { + v40v2 = make(map[float32]uint, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v40v2), bs40, h, t, "dec-map-v40-noaddr") // decode into non-addressable map value + testDeepEqualErr(v40v1, v40v2, t, "equal-map-v40-noaddr") + if v == nil { + v40v2 = nil + } else { + v40v2 = make(map[float32]uint, len(v)) + } // reset map + testUnmarshalErr(&v40v2, bs40, h, t, "dec-map-v40-p-len") + testDeepEqualErr(v40v1, v40v2, t, "equal-map-v40-p-len") + bs40 = testMarshalErr(&v40v1, h, t, "enc-map-v40-p") + v40v2 = nil + testUnmarshalErr(&v40v2, bs40, h, t, "dec-map-v40-p-nil") + testDeepEqualErr(v40v1, v40v2, t, "equal-map-v40-p-nil") + // ... + if v == nil { + v40v2 = nil + } else { + v40v2 = make(map[float32]uint, len(v)) + } // reset map + var v40v3, v40v4 typMapMapFloat32Uint + v40v3 = typMapMapFloat32Uint(v40v1) + v40v4 = typMapMapFloat32Uint(v40v2) + bs40 = testMarshalErr(v40v3, h, t, "enc-map-v40-custom") + testUnmarshalErr(v40v4, bs40, h, t, "dec-map-v40-p-len") + testDeepEqualErr(v40v3, v40v4, t, "equal-map-v40-p-len") + } + + for _, v := range []map[float32]uint8{nil, {}, {22.2: 0, 11.1: 33}} { + // fmt.Printf(">>>> running mammoth map v41: %v\n", v) + var v41v1, v41v2 map[float32]uint8 + v41v1 = v + bs41 := testMarshalErr(v41v1, h, t, "enc-map-v41") + if v == nil { + v41v2 = nil + } else { + v41v2 = make(map[float32]uint8, len(v)) + } // reset map + testUnmarshalErr(v41v2, bs41, h, t, "dec-map-v41") + testDeepEqualErr(v41v1, v41v2, t, "equal-map-v41") + if v == nil { + v41v2 = nil + } else { + v41v2 = make(map[float32]uint8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v41v2), bs41, h, t, "dec-map-v41-noaddr") // decode into non-addressable map value + testDeepEqualErr(v41v1, v41v2, t, "equal-map-v41-noaddr") + if v == nil { + v41v2 = nil + } else { + v41v2 = make(map[float32]uint8, len(v)) + } // reset map + testUnmarshalErr(&v41v2, bs41, h, t, "dec-map-v41-p-len") + testDeepEqualErr(v41v1, v41v2, t, "equal-map-v41-p-len") + bs41 = testMarshalErr(&v41v1, h, t, "enc-map-v41-p") + v41v2 = nil + testUnmarshalErr(&v41v2, bs41, h, t, "dec-map-v41-p-nil") + testDeepEqualErr(v41v1, v41v2, t, "equal-map-v41-p-nil") + // ... + if v == nil { + v41v2 = nil + } else { + v41v2 = make(map[float32]uint8, len(v)) + } // reset map + var v41v3, v41v4 typMapMapFloat32Uint8 + v41v3 = typMapMapFloat32Uint8(v41v1) + v41v4 = typMapMapFloat32Uint8(v41v2) + bs41 = testMarshalErr(v41v3, h, t, "enc-map-v41-custom") + testUnmarshalErr(v41v4, bs41, h, t, "dec-map-v41-p-len") + testDeepEqualErr(v41v3, v41v4, t, "equal-map-v41-p-len") + } + + for _, v := range []map[float32]uint16{nil, {}, {22.2: 0, 11.1: 44}} { + // fmt.Printf(">>>> running mammoth map v42: %v\n", v) + var v42v1, v42v2 map[float32]uint16 + v42v1 = v + bs42 := testMarshalErr(v42v1, h, t, "enc-map-v42") + if v == nil { + v42v2 = nil + } else { + v42v2 = make(map[float32]uint16, len(v)) + } // reset map + testUnmarshalErr(v42v2, bs42, h, t, "dec-map-v42") + testDeepEqualErr(v42v1, v42v2, t, "equal-map-v42") + if v == nil { + v42v2 = nil + } else { + v42v2 = make(map[float32]uint16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v42v2), bs42, h, t, "dec-map-v42-noaddr") // decode into non-addressable map value + testDeepEqualErr(v42v1, v42v2, t, "equal-map-v42-noaddr") + if v == nil { + v42v2 = nil + } else { + v42v2 = make(map[float32]uint16, len(v)) + } // reset map + testUnmarshalErr(&v42v2, bs42, h, t, "dec-map-v42-p-len") + testDeepEqualErr(v42v1, v42v2, t, "equal-map-v42-p-len") + bs42 = testMarshalErr(&v42v1, h, t, "enc-map-v42-p") + v42v2 = nil + testUnmarshalErr(&v42v2, bs42, h, t, "dec-map-v42-p-nil") + testDeepEqualErr(v42v1, v42v2, t, "equal-map-v42-p-nil") + // ... + if v == nil { + v42v2 = nil + } else { + v42v2 = make(map[float32]uint16, len(v)) + } // reset map + var v42v3, v42v4 typMapMapFloat32Uint16 + v42v3 = typMapMapFloat32Uint16(v42v1) + v42v4 = typMapMapFloat32Uint16(v42v2) + bs42 = testMarshalErr(v42v3, h, t, "enc-map-v42-custom") + testUnmarshalErr(v42v4, bs42, h, t, "dec-map-v42-p-len") + testDeepEqualErr(v42v3, v42v4, t, "equal-map-v42-p-len") + } + + for _, v := range []map[float32]uint32{nil, {}, {22.2: 0, 11.1: 33}} { + // fmt.Printf(">>>> running mammoth map v43: %v\n", v) + var v43v1, v43v2 map[float32]uint32 + v43v1 = v + bs43 := testMarshalErr(v43v1, h, t, "enc-map-v43") + if v == nil { + v43v2 = nil + } else { + v43v2 = make(map[float32]uint32, len(v)) + } // reset map + testUnmarshalErr(v43v2, bs43, h, t, "dec-map-v43") + testDeepEqualErr(v43v1, v43v2, t, "equal-map-v43") + if v == nil { + v43v2 = nil + } else { + v43v2 = make(map[float32]uint32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v43v2), bs43, h, t, "dec-map-v43-noaddr") // decode into non-addressable map value + testDeepEqualErr(v43v1, v43v2, t, "equal-map-v43-noaddr") + if v == nil { + v43v2 = nil + } else { + v43v2 = make(map[float32]uint32, len(v)) + } // reset map + testUnmarshalErr(&v43v2, bs43, h, t, "dec-map-v43-p-len") + testDeepEqualErr(v43v1, v43v2, t, "equal-map-v43-p-len") + bs43 = testMarshalErr(&v43v1, h, t, "enc-map-v43-p") + v43v2 = nil + testUnmarshalErr(&v43v2, bs43, h, t, "dec-map-v43-p-nil") + testDeepEqualErr(v43v1, v43v2, t, "equal-map-v43-p-nil") + // ... + if v == nil { + v43v2 = nil + } else { + v43v2 = make(map[float32]uint32, len(v)) + } // reset map + var v43v3, v43v4 typMapMapFloat32Uint32 + v43v3 = typMapMapFloat32Uint32(v43v1) + v43v4 = typMapMapFloat32Uint32(v43v2) + bs43 = testMarshalErr(v43v3, h, t, "enc-map-v43-custom") + testUnmarshalErr(v43v4, bs43, h, t, "dec-map-v43-p-len") + testDeepEqualErr(v43v3, v43v4, t, "equal-map-v43-p-len") + } + + for _, v := range []map[float32]uint64{nil, {}, {22.2: 0, 11.1: 44}} { + // fmt.Printf(">>>> running mammoth map v44: %v\n", v) + var v44v1, v44v2 map[float32]uint64 + v44v1 = v + bs44 := testMarshalErr(v44v1, h, t, "enc-map-v44") + if v == nil { + v44v2 = nil + } else { + v44v2 = make(map[float32]uint64, len(v)) + } // reset map + testUnmarshalErr(v44v2, bs44, h, t, "dec-map-v44") + testDeepEqualErr(v44v1, v44v2, t, "equal-map-v44") + if v == nil { + v44v2 = nil + } else { + v44v2 = make(map[float32]uint64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v44v2), bs44, h, t, "dec-map-v44-noaddr") // decode into non-addressable map value + testDeepEqualErr(v44v1, v44v2, t, "equal-map-v44-noaddr") + if v == nil { + v44v2 = nil + } else { + v44v2 = make(map[float32]uint64, len(v)) + } // reset map + testUnmarshalErr(&v44v2, bs44, h, t, "dec-map-v44-p-len") + testDeepEqualErr(v44v1, v44v2, t, "equal-map-v44-p-len") + bs44 = testMarshalErr(&v44v1, h, t, "enc-map-v44-p") + v44v2 = nil + testUnmarshalErr(&v44v2, bs44, h, t, "dec-map-v44-p-nil") + testDeepEqualErr(v44v1, v44v2, t, "equal-map-v44-p-nil") + // ... + if v == nil { + v44v2 = nil + } else { + v44v2 = make(map[float32]uint64, len(v)) + } // reset map + var v44v3, v44v4 typMapMapFloat32Uint64 + v44v3 = typMapMapFloat32Uint64(v44v1) + v44v4 = typMapMapFloat32Uint64(v44v2) + bs44 = testMarshalErr(v44v3, h, t, "enc-map-v44-custom") + testUnmarshalErr(v44v4, bs44, h, t, "dec-map-v44-p-len") + testDeepEqualErr(v44v3, v44v4, t, "equal-map-v44-p-len") + } + + for _, v := range []map[float32]uintptr{nil, {}, {22.2: 0, 11.1: 33}} { + // fmt.Printf(">>>> running mammoth map v45: %v\n", v) + var v45v1, v45v2 map[float32]uintptr + v45v1 = v + bs45 := testMarshalErr(v45v1, h, t, "enc-map-v45") + if v == nil { + v45v2 = nil + } else { + v45v2 = make(map[float32]uintptr, len(v)) + } // reset map + testUnmarshalErr(v45v2, bs45, h, t, "dec-map-v45") + testDeepEqualErr(v45v1, v45v2, t, "equal-map-v45") + if v == nil { + v45v2 = nil + } else { + v45v2 = make(map[float32]uintptr, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v45v2), bs45, h, t, "dec-map-v45-noaddr") // decode into non-addressable map value + testDeepEqualErr(v45v1, v45v2, t, "equal-map-v45-noaddr") + if v == nil { + v45v2 = nil + } else { + v45v2 = make(map[float32]uintptr, len(v)) + } // reset map + testUnmarshalErr(&v45v2, bs45, h, t, "dec-map-v45-p-len") + testDeepEqualErr(v45v1, v45v2, t, "equal-map-v45-p-len") + bs45 = testMarshalErr(&v45v1, h, t, "enc-map-v45-p") + v45v2 = nil + testUnmarshalErr(&v45v2, bs45, h, t, "dec-map-v45-p-nil") + testDeepEqualErr(v45v1, v45v2, t, "equal-map-v45-p-nil") + // ... + if v == nil { + v45v2 = nil + } else { + v45v2 = make(map[float32]uintptr, len(v)) + } // reset map + var v45v3, v45v4 typMapMapFloat32Uintptr + v45v3 = typMapMapFloat32Uintptr(v45v1) + v45v4 = typMapMapFloat32Uintptr(v45v2) + bs45 = testMarshalErr(v45v3, h, t, "enc-map-v45-custom") + testUnmarshalErr(v45v4, bs45, h, t, "dec-map-v45-p-len") + testDeepEqualErr(v45v3, v45v4, t, "equal-map-v45-p-len") + } + + for _, v := range []map[float32]int{nil, {}, {22.2: 0, 11.1: 44}} { + // fmt.Printf(">>>> running mammoth map v46: %v\n", v) + var v46v1, v46v2 map[float32]int + v46v1 = v + bs46 := testMarshalErr(v46v1, h, t, "enc-map-v46") + if v == nil { + v46v2 = nil + } else { + v46v2 = make(map[float32]int, len(v)) + } // reset map + testUnmarshalErr(v46v2, bs46, h, t, "dec-map-v46") + testDeepEqualErr(v46v1, v46v2, t, "equal-map-v46") + if v == nil { + v46v2 = nil + } else { + v46v2 = make(map[float32]int, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v46v2), bs46, h, t, "dec-map-v46-noaddr") // decode into non-addressable map value + testDeepEqualErr(v46v1, v46v2, t, "equal-map-v46-noaddr") + if v == nil { + v46v2 = nil + } else { + v46v2 = make(map[float32]int, len(v)) + } // reset map + testUnmarshalErr(&v46v2, bs46, h, t, "dec-map-v46-p-len") + testDeepEqualErr(v46v1, v46v2, t, "equal-map-v46-p-len") + bs46 = testMarshalErr(&v46v1, h, t, "enc-map-v46-p") + v46v2 = nil + testUnmarshalErr(&v46v2, bs46, h, t, "dec-map-v46-p-nil") + testDeepEqualErr(v46v1, v46v2, t, "equal-map-v46-p-nil") + // ... + if v == nil { + v46v2 = nil + } else { + v46v2 = make(map[float32]int, len(v)) + } // reset map + var v46v3, v46v4 typMapMapFloat32Int + v46v3 = typMapMapFloat32Int(v46v1) + v46v4 = typMapMapFloat32Int(v46v2) + bs46 = testMarshalErr(v46v3, h, t, "enc-map-v46-custom") + testUnmarshalErr(v46v4, bs46, h, t, "dec-map-v46-p-len") + testDeepEqualErr(v46v3, v46v4, t, "equal-map-v46-p-len") + } + + for _, v := range []map[float32]int8{nil, {}, {22.2: 0, 11.1: 33}} { + // fmt.Printf(">>>> running mammoth map v47: %v\n", v) + var v47v1, v47v2 map[float32]int8 + v47v1 = v + bs47 := testMarshalErr(v47v1, h, t, "enc-map-v47") + if v == nil { + v47v2 = nil + } else { + v47v2 = make(map[float32]int8, len(v)) + } // reset map + testUnmarshalErr(v47v2, bs47, h, t, "dec-map-v47") + testDeepEqualErr(v47v1, v47v2, t, "equal-map-v47") + if v == nil { + v47v2 = nil + } else { + v47v2 = make(map[float32]int8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v47v2), bs47, h, t, "dec-map-v47-noaddr") // decode into non-addressable map value + testDeepEqualErr(v47v1, v47v2, t, "equal-map-v47-noaddr") + if v == nil { + v47v2 = nil + } else { + v47v2 = make(map[float32]int8, len(v)) + } // reset map + testUnmarshalErr(&v47v2, bs47, h, t, "dec-map-v47-p-len") + testDeepEqualErr(v47v1, v47v2, t, "equal-map-v47-p-len") + bs47 = testMarshalErr(&v47v1, h, t, "enc-map-v47-p") + v47v2 = nil + testUnmarshalErr(&v47v2, bs47, h, t, "dec-map-v47-p-nil") + testDeepEqualErr(v47v1, v47v2, t, "equal-map-v47-p-nil") + // ... + if v == nil { + v47v2 = nil + } else { + v47v2 = make(map[float32]int8, len(v)) + } // reset map + var v47v3, v47v4 typMapMapFloat32Int8 + v47v3 = typMapMapFloat32Int8(v47v1) + v47v4 = typMapMapFloat32Int8(v47v2) + bs47 = testMarshalErr(v47v3, h, t, "enc-map-v47-custom") + testUnmarshalErr(v47v4, bs47, h, t, "dec-map-v47-p-len") + testDeepEqualErr(v47v3, v47v4, t, "equal-map-v47-p-len") + } + + for _, v := range []map[float32]int16{nil, {}, {22.2: 0, 11.1: 44}} { + // fmt.Printf(">>>> running mammoth map v48: %v\n", v) + var v48v1, v48v2 map[float32]int16 + v48v1 = v + bs48 := testMarshalErr(v48v1, h, t, "enc-map-v48") + if v == nil { + v48v2 = nil + } else { + v48v2 = make(map[float32]int16, len(v)) + } // reset map + testUnmarshalErr(v48v2, bs48, h, t, "dec-map-v48") + testDeepEqualErr(v48v1, v48v2, t, "equal-map-v48") + if v == nil { + v48v2 = nil + } else { + v48v2 = make(map[float32]int16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v48v2), bs48, h, t, "dec-map-v48-noaddr") // decode into non-addressable map value + testDeepEqualErr(v48v1, v48v2, t, "equal-map-v48-noaddr") + if v == nil { + v48v2 = nil + } else { + v48v2 = make(map[float32]int16, len(v)) + } // reset map + testUnmarshalErr(&v48v2, bs48, h, t, "dec-map-v48-p-len") + testDeepEqualErr(v48v1, v48v2, t, "equal-map-v48-p-len") + bs48 = testMarshalErr(&v48v1, h, t, "enc-map-v48-p") + v48v2 = nil + testUnmarshalErr(&v48v2, bs48, h, t, "dec-map-v48-p-nil") + testDeepEqualErr(v48v1, v48v2, t, "equal-map-v48-p-nil") + // ... + if v == nil { + v48v2 = nil + } else { + v48v2 = make(map[float32]int16, len(v)) + } // reset map + var v48v3, v48v4 typMapMapFloat32Int16 + v48v3 = typMapMapFloat32Int16(v48v1) + v48v4 = typMapMapFloat32Int16(v48v2) + bs48 = testMarshalErr(v48v3, h, t, "enc-map-v48-custom") + testUnmarshalErr(v48v4, bs48, h, t, "dec-map-v48-p-len") + testDeepEqualErr(v48v3, v48v4, t, "equal-map-v48-p-len") + } + + for _, v := range []map[float32]int32{nil, {}, {22.2: 0, 11.1: 33}} { + // fmt.Printf(">>>> running mammoth map v49: %v\n", v) + var v49v1, v49v2 map[float32]int32 + v49v1 = v + bs49 := testMarshalErr(v49v1, h, t, "enc-map-v49") + if v == nil { + v49v2 = nil + } else { + v49v2 = make(map[float32]int32, len(v)) + } // reset map + testUnmarshalErr(v49v2, bs49, h, t, "dec-map-v49") + testDeepEqualErr(v49v1, v49v2, t, "equal-map-v49") + if v == nil { + v49v2 = nil + } else { + v49v2 = make(map[float32]int32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v49v2), bs49, h, t, "dec-map-v49-noaddr") // decode into non-addressable map value + testDeepEqualErr(v49v1, v49v2, t, "equal-map-v49-noaddr") + if v == nil { + v49v2 = nil + } else { + v49v2 = make(map[float32]int32, len(v)) + } // reset map + testUnmarshalErr(&v49v2, bs49, h, t, "dec-map-v49-p-len") + testDeepEqualErr(v49v1, v49v2, t, "equal-map-v49-p-len") + bs49 = testMarshalErr(&v49v1, h, t, "enc-map-v49-p") + v49v2 = nil + testUnmarshalErr(&v49v2, bs49, h, t, "dec-map-v49-p-nil") + testDeepEqualErr(v49v1, v49v2, t, "equal-map-v49-p-nil") + // ... + if v == nil { + v49v2 = nil + } else { + v49v2 = make(map[float32]int32, len(v)) + } // reset map + var v49v3, v49v4 typMapMapFloat32Int32 + v49v3 = typMapMapFloat32Int32(v49v1) + v49v4 = typMapMapFloat32Int32(v49v2) + bs49 = testMarshalErr(v49v3, h, t, "enc-map-v49-custom") + testUnmarshalErr(v49v4, bs49, h, t, "dec-map-v49-p-len") + testDeepEqualErr(v49v3, v49v4, t, "equal-map-v49-p-len") + } + + for _, v := range []map[float32]int64{nil, {}, {22.2: 0, 11.1: 44}} { + // fmt.Printf(">>>> running mammoth map v50: %v\n", v) + var v50v1, v50v2 map[float32]int64 + v50v1 = v + bs50 := testMarshalErr(v50v1, h, t, "enc-map-v50") + if v == nil { + v50v2 = nil + } else { + v50v2 = make(map[float32]int64, len(v)) + } // reset map + testUnmarshalErr(v50v2, bs50, h, t, "dec-map-v50") + testDeepEqualErr(v50v1, v50v2, t, "equal-map-v50") + if v == nil { + v50v2 = nil + } else { + v50v2 = make(map[float32]int64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v50v2), bs50, h, t, "dec-map-v50-noaddr") // decode into non-addressable map value + testDeepEqualErr(v50v1, v50v2, t, "equal-map-v50-noaddr") + if v == nil { + v50v2 = nil + } else { + v50v2 = make(map[float32]int64, len(v)) + } // reset map + testUnmarshalErr(&v50v2, bs50, h, t, "dec-map-v50-p-len") + testDeepEqualErr(v50v1, v50v2, t, "equal-map-v50-p-len") + bs50 = testMarshalErr(&v50v1, h, t, "enc-map-v50-p") + v50v2 = nil + testUnmarshalErr(&v50v2, bs50, h, t, "dec-map-v50-p-nil") + testDeepEqualErr(v50v1, v50v2, t, "equal-map-v50-p-nil") + // ... + if v == nil { + v50v2 = nil + } else { + v50v2 = make(map[float32]int64, len(v)) + } // reset map + var v50v3, v50v4 typMapMapFloat32Int64 + v50v3 = typMapMapFloat32Int64(v50v1) + v50v4 = typMapMapFloat32Int64(v50v2) + bs50 = testMarshalErr(v50v3, h, t, "enc-map-v50-custom") + testUnmarshalErr(v50v4, bs50, h, t, "dec-map-v50-p-len") + testDeepEqualErr(v50v3, v50v4, t, "equal-map-v50-p-len") + } + + for _, v := range []map[float32]float32{nil, {}, {22.2: 0, 11.1: 22.2}} { + // fmt.Printf(">>>> running mammoth map v51: %v\n", v) + var v51v1, v51v2 map[float32]float32 + v51v1 = v + bs51 := testMarshalErr(v51v1, h, t, "enc-map-v51") + if v == nil { + v51v2 = nil + } else { + v51v2 = make(map[float32]float32, len(v)) + } // reset map + testUnmarshalErr(v51v2, bs51, h, t, "dec-map-v51") + testDeepEqualErr(v51v1, v51v2, t, "equal-map-v51") + if v == nil { + v51v2 = nil + } else { + v51v2 = make(map[float32]float32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v51v2), bs51, h, t, "dec-map-v51-noaddr") // decode into non-addressable map value + testDeepEqualErr(v51v1, v51v2, t, "equal-map-v51-noaddr") + if v == nil { + v51v2 = nil + } else { + v51v2 = make(map[float32]float32, len(v)) + } // reset map + testUnmarshalErr(&v51v2, bs51, h, t, "dec-map-v51-p-len") + testDeepEqualErr(v51v1, v51v2, t, "equal-map-v51-p-len") + bs51 = testMarshalErr(&v51v1, h, t, "enc-map-v51-p") + v51v2 = nil + testUnmarshalErr(&v51v2, bs51, h, t, "dec-map-v51-p-nil") + testDeepEqualErr(v51v1, v51v2, t, "equal-map-v51-p-nil") + // ... + if v == nil { + v51v2 = nil + } else { + v51v2 = make(map[float32]float32, len(v)) + } // reset map + var v51v3, v51v4 typMapMapFloat32Float32 + v51v3 = typMapMapFloat32Float32(v51v1) + v51v4 = typMapMapFloat32Float32(v51v2) + bs51 = testMarshalErr(v51v3, h, t, "enc-map-v51-custom") + testUnmarshalErr(v51v4, bs51, h, t, "dec-map-v51-p-len") + testDeepEqualErr(v51v3, v51v4, t, "equal-map-v51-p-len") + } + + for _, v := range []map[float32]float64{nil, {}, {11.1: 0, 22.2: 11.1}} { + // fmt.Printf(">>>> running mammoth map v52: %v\n", v) + var v52v1, v52v2 map[float32]float64 + v52v1 = v + bs52 := testMarshalErr(v52v1, h, t, "enc-map-v52") + if v == nil { + v52v2 = nil + } else { + v52v2 = make(map[float32]float64, len(v)) + } // reset map + testUnmarshalErr(v52v2, bs52, h, t, "dec-map-v52") + testDeepEqualErr(v52v1, v52v2, t, "equal-map-v52") + if v == nil { + v52v2 = nil + } else { + v52v2 = make(map[float32]float64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v52v2), bs52, h, t, "dec-map-v52-noaddr") // decode into non-addressable map value + testDeepEqualErr(v52v1, v52v2, t, "equal-map-v52-noaddr") + if v == nil { + v52v2 = nil + } else { + v52v2 = make(map[float32]float64, len(v)) + } // reset map + testUnmarshalErr(&v52v2, bs52, h, t, "dec-map-v52-p-len") + testDeepEqualErr(v52v1, v52v2, t, "equal-map-v52-p-len") + bs52 = testMarshalErr(&v52v1, h, t, "enc-map-v52-p") + v52v2 = nil + testUnmarshalErr(&v52v2, bs52, h, t, "dec-map-v52-p-nil") + testDeepEqualErr(v52v1, v52v2, t, "equal-map-v52-p-nil") + // ... + if v == nil { + v52v2 = nil + } else { + v52v2 = make(map[float32]float64, len(v)) + } // reset map + var v52v3, v52v4 typMapMapFloat32Float64 + v52v3 = typMapMapFloat32Float64(v52v1) + v52v4 = typMapMapFloat32Float64(v52v2) + bs52 = testMarshalErr(v52v3, h, t, "enc-map-v52-custom") + testUnmarshalErr(v52v4, bs52, h, t, "dec-map-v52-p-len") + testDeepEqualErr(v52v3, v52v4, t, "equal-map-v52-p-len") + } + + for _, v := range []map[float32]bool{nil, {}, {22.2: false, 11.1: true}} { + // fmt.Printf(">>>> running mammoth map v53: %v\n", v) + var v53v1, v53v2 map[float32]bool + v53v1 = v + bs53 := testMarshalErr(v53v1, h, t, "enc-map-v53") + if v == nil { + v53v2 = nil + } else { + v53v2 = make(map[float32]bool, len(v)) + } // reset map + testUnmarshalErr(v53v2, bs53, h, t, "dec-map-v53") + testDeepEqualErr(v53v1, v53v2, t, "equal-map-v53") + if v == nil { + v53v2 = nil + } else { + v53v2 = make(map[float32]bool, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v53v2), bs53, h, t, "dec-map-v53-noaddr") // decode into non-addressable map value + testDeepEqualErr(v53v1, v53v2, t, "equal-map-v53-noaddr") + if v == nil { + v53v2 = nil + } else { + v53v2 = make(map[float32]bool, len(v)) + } // reset map + testUnmarshalErr(&v53v2, bs53, h, t, "dec-map-v53-p-len") + testDeepEqualErr(v53v1, v53v2, t, "equal-map-v53-p-len") + bs53 = testMarshalErr(&v53v1, h, t, "enc-map-v53-p") + v53v2 = nil + testUnmarshalErr(&v53v2, bs53, h, t, "dec-map-v53-p-nil") + testDeepEqualErr(v53v1, v53v2, t, "equal-map-v53-p-nil") + // ... + if v == nil { + v53v2 = nil + } else { + v53v2 = make(map[float32]bool, len(v)) + } // reset map + var v53v3, v53v4 typMapMapFloat32Bool + v53v3 = typMapMapFloat32Bool(v53v1) + v53v4 = typMapMapFloat32Bool(v53v2) + bs53 = testMarshalErr(v53v3, h, t, "enc-map-v53-custom") + testUnmarshalErr(v53v4, bs53, h, t, "dec-map-v53-p-len") + testDeepEqualErr(v53v3, v53v4, t, "equal-map-v53-p-len") + } + + for _, v := range []map[float64]interface{}{nil, {}, {22.2: nil, 11.1: "string-is-an-interface"}} { + // fmt.Printf(">>>> running mammoth map v56: %v\n", v) + var v56v1, v56v2 map[float64]interface{} + v56v1 = v + bs56 := testMarshalErr(v56v1, h, t, "enc-map-v56") + if v == nil { + v56v2 = nil + } else { + v56v2 = make(map[float64]interface{}, len(v)) + } // reset map + testUnmarshalErr(v56v2, bs56, h, t, "dec-map-v56") + testDeepEqualErr(v56v1, v56v2, t, "equal-map-v56") + if v == nil { + v56v2 = nil + } else { + v56v2 = make(map[float64]interface{}, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v56v2), bs56, h, t, "dec-map-v56-noaddr") // decode into non-addressable map value + testDeepEqualErr(v56v1, v56v2, t, "equal-map-v56-noaddr") + if v == nil { + v56v2 = nil + } else { + v56v2 = make(map[float64]interface{}, len(v)) + } // reset map + testUnmarshalErr(&v56v2, bs56, h, t, "dec-map-v56-p-len") + testDeepEqualErr(v56v1, v56v2, t, "equal-map-v56-p-len") + bs56 = testMarshalErr(&v56v1, h, t, "enc-map-v56-p") + v56v2 = nil + testUnmarshalErr(&v56v2, bs56, h, t, "dec-map-v56-p-nil") + testDeepEqualErr(v56v1, v56v2, t, "equal-map-v56-p-nil") + // ... + if v == nil { + v56v2 = nil + } else { + v56v2 = make(map[float64]interface{}, len(v)) + } // reset map + var v56v3, v56v4 typMapMapFloat64Intf + v56v3 = typMapMapFloat64Intf(v56v1) + v56v4 = typMapMapFloat64Intf(v56v2) + bs56 = testMarshalErr(v56v3, h, t, "enc-map-v56-custom") + testUnmarshalErr(v56v4, bs56, h, t, "dec-map-v56-p-len") + testDeepEqualErr(v56v3, v56v4, t, "equal-map-v56-p-len") + } + + for _, v := range []map[float64]string{nil, {}, {22.2: "", 11.1: "some-string"}} { + // fmt.Printf(">>>> running mammoth map v57: %v\n", v) + var v57v1, v57v2 map[float64]string + v57v1 = v + bs57 := testMarshalErr(v57v1, h, t, "enc-map-v57") + if v == nil { + v57v2 = nil + } else { + v57v2 = make(map[float64]string, len(v)) + } // reset map + testUnmarshalErr(v57v2, bs57, h, t, "dec-map-v57") + testDeepEqualErr(v57v1, v57v2, t, "equal-map-v57") + if v == nil { + v57v2 = nil + } else { + v57v2 = make(map[float64]string, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v57v2), bs57, h, t, "dec-map-v57-noaddr") // decode into non-addressable map value + testDeepEqualErr(v57v1, v57v2, t, "equal-map-v57-noaddr") + if v == nil { + v57v2 = nil + } else { + v57v2 = make(map[float64]string, len(v)) + } // reset map + testUnmarshalErr(&v57v2, bs57, h, t, "dec-map-v57-p-len") + testDeepEqualErr(v57v1, v57v2, t, "equal-map-v57-p-len") + bs57 = testMarshalErr(&v57v1, h, t, "enc-map-v57-p") + v57v2 = nil + testUnmarshalErr(&v57v2, bs57, h, t, "dec-map-v57-p-nil") + testDeepEqualErr(v57v1, v57v2, t, "equal-map-v57-p-nil") + // ... + if v == nil { + v57v2 = nil + } else { + v57v2 = make(map[float64]string, len(v)) + } // reset map + var v57v3, v57v4 typMapMapFloat64String + v57v3 = typMapMapFloat64String(v57v1) + v57v4 = typMapMapFloat64String(v57v2) + bs57 = testMarshalErr(v57v3, h, t, "enc-map-v57-custom") + testUnmarshalErr(v57v4, bs57, h, t, "dec-map-v57-p-len") + testDeepEqualErr(v57v3, v57v4, t, "equal-map-v57-p-len") + } + + for _, v := range []map[float64]uint{nil, {}, {22.2: 0, 11.1: 33}} { + // fmt.Printf(">>>> running mammoth map v58: %v\n", v) + var v58v1, v58v2 map[float64]uint + v58v1 = v + bs58 := testMarshalErr(v58v1, h, t, "enc-map-v58") + if v == nil { + v58v2 = nil + } else { + v58v2 = make(map[float64]uint, len(v)) + } // reset map + testUnmarshalErr(v58v2, bs58, h, t, "dec-map-v58") + testDeepEqualErr(v58v1, v58v2, t, "equal-map-v58") + if v == nil { + v58v2 = nil + } else { + v58v2 = make(map[float64]uint, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v58v2), bs58, h, t, "dec-map-v58-noaddr") // decode into non-addressable map value + testDeepEqualErr(v58v1, v58v2, t, "equal-map-v58-noaddr") + if v == nil { + v58v2 = nil + } else { + v58v2 = make(map[float64]uint, len(v)) + } // reset map + testUnmarshalErr(&v58v2, bs58, h, t, "dec-map-v58-p-len") + testDeepEqualErr(v58v1, v58v2, t, "equal-map-v58-p-len") + bs58 = testMarshalErr(&v58v1, h, t, "enc-map-v58-p") + v58v2 = nil + testUnmarshalErr(&v58v2, bs58, h, t, "dec-map-v58-p-nil") + testDeepEqualErr(v58v1, v58v2, t, "equal-map-v58-p-nil") + // ... + if v == nil { + v58v2 = nil + } else { + v58v2 = make(map[float64]uint, len(v)) + } // reset map + var v58v3, v58v4 typMapMapFloat64Uint + v58v3 = typMapMapFloat64Uint(v58v1) + v58v4 = typMapMapFloat64Uint(v58v2) + bs58 = testMarshalErr(v58v3, h, t, "enc-map-v58-custom") + testUnmarshalErr(v58v4, bs58, h, t, "dec-map-v58-p-len") + testDeepEqualErr(v58v3, v58v4, t, "equal-map-v58-p-len") + } + + for _, v := range []map[float64]uint8{nil, {}, {22.2: 0, 11.1: 44}} { + // fmt.Printf(">>>> running mammoth map v59: %v\n", v) + var v59v1, v59v2 map[float64]uint8 + v59v1 = v + bs59 := testMarshalErr(v59v1, h, t, "enc-map-v59") + if v == nil { + v59v2 = nil + } else { + v59v2 = make(map[float64]uint8, len(v)) + } // reset map + testUnmarshalErr(v59v2, bs59, h, t, "dec-map-v59") + testDeepEqualErr(v59v1, v59v2, t, "equal-map-v59") + if v == nil { + v59v2 = nil + } else { + v59v2 = make(map[float64]uint8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v59v2), bs59, h, t, "dec-map-v59-noaddr") // decode into non-addressable map value + testDeepEqualErr(v59v1, v59v2, t, "equal-map-v59-noaddr") + if v == nil { + v59v2 = nil + } else { + v59v2 = make(map[float64]uint8, len(v)) + } // reset map + testUnmarshalErr(&v59v2, bs59, h, t, "dec-map-v59-p-len") + testDeepEqualErr(v59v1, v59v2, t, "equal-map-v59-p-len") + bs59 = testMarshalErr(&v59v1, h, t, "enc-map-v59-p") + v59v2 = nil + testUnmarshalErr(&v59v2, bs59, h, t, "dec-map-v59-p-nil") + testDeepEqualErr(v59v1, v59v2, t, "equal-map-v59-p-nil") + // ... + if v == nil { + v59v2 = nil + } else { + v59v2 = make(map[float64]uint8, len(v)) + } // reset map + var v59v3, v59v4 typMapMapFloat64Uint8 + v59v3 = typMapMapFloat64Uint8(v59v1) + v59v4 = typMapMapFloat64Uint8(v59v2) + bs59 = testMarshalErr(v59v3, h, t, "enc-map-v59-custom") + testUnmarshalErr(v59v4, bs59, h, t, "dec-map-v59-p-len") + testDeepEqualErr(v59v3, v59v4, t, "equal-map-v59-p-len") + } + + for _, v := range []map[float64]uint16{nil, {}, {22.2: 0, 11.1: 33}} { + // fmt.Printf(">>>> running mammoth map v60: %v\n", v) + var v60v1, v60v2 map[float64]uint16 + v60v1 = v + bs60 := testMarshalErr(v60v1, h, t, "enc-map-v60") + if v == nil { + v60v2 = nil + } else { + v60v2 = make(map[float64]uint16, len(v)) + } // reset map + testUnmarshalErr(v60v2, bs60, h, t, "dec-map-v60") + testDeepEqualErr(v60v1, v60v2, t, "equal-map-v60") + if v == nil { + v60v2 = nil + } else { + v60v2 = make(map[float64]uint16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v60v2), bs60, h, t, "dec-map-v60-noaddr") // decode into non-addressable map value + testDeepEqualErr(v60v1, v60v2, t, "equal-map-v60-noaddr") + if v == nil { + v60v2 = nil + } else { + v60v2 = make(map[float64]uint16, len(v)) + } // reset map + testUnmarshalErr(&v60v2, bs60, h, t, "dec-map-v60-p-len") + testDeepEqualErr(v60v1, v60v2, t, "equal-map-v60-p-len") + bs60 = testMarshalErr(&v60v1, h, t, "enc-map-v60-p") + v60v2 = nil + testUnmarshalErr(&v60v2, bs60, h, t, "dec-map-v60-p-nil") + testDeepEqualErr(v60v1, v60v2, t, "equal-map-v60-p-nil") + // ... + if v == nil { + v60v2 = nil + } else { + v60v2 = make(map[float64]uint16, len(v)) + } // reset map + var v60v3, v60v4 typMapMapFloat64Uint16 + v60v3 = typMapMapFloat64Uint16(v60v1) + v60v4 = typMapMapFloat64Uint16(v60v2) + bs60 = testMarshalErr(v60v3, h, t, "enc-map-v60-custom") + testUnmarshalErr(v60v4, bs60, h, t, "dec-map-v60-p-len") + testDeepEqualErr(v60v3, v60v4, t, "equal-map-v60-p-len") + } + + for _, v := range []map[float64]uint32{nil, {}, {22.2: 0, 11.1: 44}} { + // fmt.Printf(">>>> running mammoth map v61: %v\n", v) + var v61v1, v61v2 map[float64]uint32 + v61v1 = v + bs61 := testMarshalErr(v61v1, h, t, "enc-map-v61") + if v == nil { + v61v2 = nil + } else { + v61v2 = make(map[float64]uint32, len(v)) + } // reset map + testUnmarshalErr(v61v2, bs61, h, t, "dec-map-v61") + testDeepEqualErr(v61v1, v61v2, t, "equal-map-v61") + if v == nil { + v61v2 = nil + } else { + v61v2 = make(map[float64]uint32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v61v2), bs61, h, t, "dec-map-v61-noaddr") // decode into non-addressable map value + testDeepEqualErr(v61v1, v61v2, t, "equal-map-v61-noaddr") + if v == nil { + v61v2 = nil + } else { + v61v2 = make(map[float64]uint32, len(v)) + } // reset map + testUnmarshalErr(&v61v2, bs61, h, t, "dec-map-v61-p-len") + testDeepEqualErr(v61v1, v61v2, t, "equal-map-v61-p-len") + bs61 = testMarshalErr(&v61v1, h, t, "enc-map-v61-p") + v61v2 = nil + testUnmarshalErr(&v61v2, bs61, h, t, "dec-map-v61-p-nil") + testDeepEqualErr(v61v1, v61v2, t, "equal-map-v61-p-nil") + // ... + if v == nil { + v61v2 = nil + } else { + v61v2 = make(map[float64]uint32, len(v)) + } // reset map + var v61v3, v61v4 typMapMapFloat64Uint32 + v61v3 = typMapMapFloat64Uint32(v61v1) + v61v4 = typMapMapFloat64Uint32(v61v2) + bs61 = testMarshalErr(v61v3, h, t, "enc-map-v61-custom") + testUnmarshalErr(v61v4, bs61, h, t, "dec-map-v61-p-len") + testDeepEqualErr(v61v3, v61v4, t, "equal-map-v61-p-len") + } + + for _, v := range []map[float64]uint64{nil, {}, {22.2: 0, 11.1: 33}} { + // fmt.Printf(">>>> running mammoth map v62: %v\n", v) + var v62v1, v62v2 map[float64]uint64 + v62v1 = v + bs62 := testMarshalErr(v62v1, h, t, "enc-map-v62") + if v == nil { + v62v2 = nil + } else { + v62v2 = make(map[float64]uint64, len(v)) + } // reset map + testUnmarshalErr(v62v2, bs62, h, t, "dec-map-v62") + testDeepEqualErr(v62v1, v62v2, t, "equal-map-v62") + if v == nil { + v62v2 = nil + } else { + v62v2 = make(map[float64]uint64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v62v2), bs62, h, t, "dec-map-v62-noaddr") // decode into non-addressable map value + testDeepEqualErr(v62v1, v62v2, t, "equal-map-v62-noaddr") + if v == nil { + v62v2 = nil + } else { + v62v2 = make(map[float64]uint64, len(v)) + } // reset map + testUnmarshalErr(&v62v2, bs62, h, t, "dec-map-v62-p-len") + testDeepEqualErr(v62v1, v62v2, t, "equal-map-v62-p-len") + bs62 = testMarshalErr(&v62v1, h, t, "enc-map-v62-p") + v62v2 = nil + testUnmarshalErr(&v62v2, bs62, h, t, "dec-map-v62-p-nil") + testDeepEqualErr(v62v1, v62v2, t, "equal-map-v62-p-nil") + // ... + if v == nil { + v62v2 = nil + } else { + v62v2 = make(map[float64]uint64, len(v)) + } // reset map + var v62v3, v62v4 typMapMapFloat64Uint64 + v62v3 = typMapMapFloat64Uint64(v62v1) + v62v4 = typMapMapFloat64Uint64(v62v2) + bs62 = testMarshalErr(v62v3, h, t, "enc-map-v62-custom") + testUnmarshalErr(v62v4, bs62, h, t, "dec-map-v62-p-len") + testDeepEqualErr(v62v3, v62v4, t, "equal-map-v62-p-len") + } + + for _, v := range []map[float64]uintptr{nil, {}, {22.2: 0, 11.1: 44}} { + // fmt.Printf(">>>> running mammoth map v63: %v\n", v) + var v63v1, v63v2 map[float64]uintptr + v63v1 = v + bs63 := testMarshalErr(v63v1, h, t, "enc-map-v63") + if v == nil { + v63v2 = nil + } else { + v63v2 = make(map[float64]uintptr, len(v)) + } // reset map + testUnmarshalErr(v63v2, bs63, h, t, "dec-map-v63") + testDeepEqualErr(v63v1, v63v2, t, "equal-map-v63") + if v == nil { + v63v2 = nil + } else { + v63v2 = make(map[float64]uintptr, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v63v2), bs63, h, t, "dec-map-v63-noaddr") // decode into non-addressable map value + testDeepEqualErr(v63v1, v63v2, t, "equal-map-v63-noaddr") + if v == nil { + v63v2 = nil + } else { + v63v2 = make(map[float64]uintptr, len(v)) + } // reset map + testUnmarshalErr(&v63v2, bs63, h, t, "dec-map-v63-p-len") + testDeepEqualErr(v63v1, v63v2, t, "equal-map-v63-p-len") + bs63 = testMarshalErr(&v63v1, h, t, "enc-map-v63-p") + v63v2 = nil + testUnmarshalErr(&v63v2, bs63, h, t, "dec-map-v63-p-nil") + testDeepEqualErr(v63v1, v63v2, t, "equal-map-v63-p-nil") + // ... + if v == nil { + v63v2 = nil + } else { + v63v2 = make(map[float64]uintptr, len(v)) + } // reset map + var v63v3, v63v4 typMapMapFloat64Uintptr + v63v3 = typMapMapFloat64Uintptr(v63v1) + v63v4 = typMapMapFloat64Uintptr(v63v2) + bs63 = testMarshalErr(v63v3, h, t, "enc-map-v63-custom") + testUnmarshalErr(v63v4, bs63, h, t, "dec-map-v63-p-len") + testDeepEqualErr(v63v3, v63v4, t, "equal-map-v63-p-len") + } + + for _, v := range []map[float64]int{nil, {}, {22.2: 0, 11.1: 33}} { + // fmt.Printf(">>>> running mammoth map v64: %v\n", v) + var v64v1, v64v2 map[float64]int + v64v1 = v + bs64 := testMarshalErr(v64v1, h, t, "enc-map-v64") + if v == nil { + v64v2 = nil + } else { + v64v2 = make(map[float64]int, len(v)) + } // reset map + testUnmarshalErr(v64v2, bs64, h, t, "dec-map-v64") + testDeepEqualErr(v64v1, v64v2, t, "equal-map-v64") + if v == nil { + v64v2 = nil + } else { + v64v2 = make(map[float64]int, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v64v2), bs64, h, t, "dec-map-v64-noaddr") // decode into non-addressable map value + testDeepEqualErr(v64v1, v64v2, t, "equal-map-v64-noaddr") + if v == nil { + v64v2 = nil + } else { + v64v2 = make(map[float64]int, len(v)) + } // reset map + testUnmarshalErr(&v64v2, bs64, h, t, "dec-map-v64-p-len") + testDeepEqualErr(v64v1, v64v2, t, "equal-map-v64-p-len") + bs64 = testMarshalErr(&v64v1, h, t, "enc-map-v64-p") + v64v2 = nil + testUnmarshalErr(&v64v2, bs64, h, t, "dec-map-v64-p-nil") + testDeepEqualErr(v64v1, v64v2, t, "equal-map-v64-p-nil") + // ... + if v == nil { + v64v2 = nil + } else { + v64v2 = make(map[float64]int, len(v)) + } // reset map + var v64v3, v64v4 typMapMapFloat64Int + v64v3 = typMapMapFloat64Int(v64v1) + v64v4 = typMapMapFloat64Int(v64v2) + bs64 = testMarshalErr(v64v3, h, t, "enc-map-v64-custom") + testUnmarshalErr(v64v4, bs64, h, t, "dec-map-v64-p-len") + testDeepEqualErr(v64v3, v64v4, t, "equal-map-v64-p-len") + } + + for _, v := range []map[float64]int8{nil, {}, {22.2: 0, 11.1: 44}} { + // fmt.Printf(">>>> running mammoth map v65: %v\n", v) + var v65v1, v65v2 map[float64]int8 + v65v1 = v + bs65 := testMarshalErr(v65v1, h, t, "enc-map-v65") + if v == nil { + v65v2 = nil + } else { + v65v2 = make(map[float64]int8, len(v)) + } // reset map + testUnmarshalErr(v65v2, bs65, h, t, "dec-map-v65") + testDeepEqualErr(v65v1, v65v2, t, "equal-map-v65") + if v == nil { + v65v2 = nil + } else { + v65v2 = make(map[float64]int8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v65v2), bs65, h, t, "dec-map-v65-noaddr") // decode into non-addressable map value + testDeepEqualErr(v65v1, v65v2, t, "equal-map-v65-noaddr") + if v == nil { + v65v2 = nil + } else { + v65v2 = make(map[float64]int8, len(v)) + } // reset map + testUnmarshalErr(&v65v2, bs65, h, t, "dec-map-v65-p-len") + testDeepEqualErr(v65v1, v65v2, t, "equal-map-v65-p-len") + bs65 = testMarshalErr(&v65v1, h, t, "enc-map-v65-p") + v65v2 = nil + testUnmarshalErr(&v65v2, bs65, h, t, "dec-map-v65-p-nil") + testDeepEqualErr(v65v1, v65v2, t, "equal-map-v65-p-nil") + // ... + if v == nil { + v65v2 = nil + } else { + v65v2 = make(map[float64]int8, len(v)) + } // reset map + var v65v3, v65v4 typMapMapFloat64Int8 + v65v3 = typMapMapFloat64Int8(v65v1) + v65v4 = typMapMapFloat64Int8(v65v2) + bs65 = testMarshalErr(v65v3, h, t, "enc-map-v65-custom") + testUnmarshalErr(v65v4, bs65, h, t, "dec-map-v65-p-len") + testDeepEqualErr(v65v3, v65v4, t, "equal-map-v65-p-len") + } + + for _, v := range []map[float64]int16{nil, {}, {22.2: 0, 11.1: 33}} { + // fmt.Printf(">>>> running mammoth map v66: %v\n", v) + var v66v1, v66v2 map[float64]int16 + v66v1 = v + bs66 := testMarshalErr(v66v1, h, t, "enc-map-v66") + if v == nil { + v66v2 = nil + } else { + v66v2 = make(map[float64]int16, len(v)) + } // reset map + testUnmarshalErr(v66v2, bs66, h, t, "dec-map-v66") + testDeepEqualErr(v66v1, v66v2, t, "equal-map-v66") + if v == nil { + v66v2 = nil + } else { + v66v2 = make(map[float64]int16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v66v2), bs66, h, t, "dec-map-v66-noaddr") // decode into non-addressable map value + testDeepEqualErr(v66v1, v66v2, t, "equal-map-v66-noaddr") + if v == nil { + v66v2 = nil + } else { + v66v2 = make(map[float64]int16, len(v)) + } // reset map + testUnmarshalErr(&v66v2, bs66, h, t, "dec-map-v66-p-len") + testDeepEqualErr(v66v1, v66v2, t, "equal-map-v66-p-len") + bs66 = testMarshalErr(&v66v1, h, t, "enc-map-v66-p") + v66v2 = nil + testUnmarshalErr(&v66v2, bs66, h, t, "dec-map-v66-p-nil") + testDeepEqualErr(v66v1, v66v2, t, "equal-map-v66-p-nil") + // ... + if v == nil { + v66v2 = nil + } else { + v66v2 = make(map[float64]int16, len(v)) + } // reset map + var v66v3, v66v4 typMapMapFloat64Int16 + v66v3 = typMapMapFloat64Int16(v66v1) + v66v4 = typMapMapFloat64Int16(v66v2) + bs66 = testMarshalErr(v66v3, h, t, "enc-map-v66-custom") + testUnmarshalErr(v66v4, bs66, h, t, "dec-map-v66-p-len") + testDeepEqualErr(v66v3, v66v4, t, "equal-map-v66-p-len") + } + + for _, v := range []map[float64]int32{nil, {}, {22.2: 0, 11.1: 44}} { + // fmt.Printf(">>>> running mammoth map v67: %v\n", v) + var v67v1, v67v2 map[float64]int32 + v67v1 = v + bs67 := testMarshalErr(v67v1, h, t, "enc-map-v67") + if v == nil { + v67v2 = nil + } else { + v67v2 = make(map[float64]int32, len(v)) + } // reset map + testUnmarshalErr(v67v2, bs67, h, t, "dec-map-v67") + testDeepEqualErr(v67v1, v67v2, t, "equal-map-v67") + if v == nil { + v67v2 = nil + } else { + v67v2 = make(map[float64]int32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v67v2), bs67, h, t, "dec-map-v67-noaddr") // decode into non-addressable map value + testDeepEqualErr(v67v1, v67v2, t, "equal-map-v67-noaddr") + if v == nil { + v67v2 = nil + } else { + v67v2 = make(map[float64]int32, len(v)) + } // reset map + testUnmarshalErr(&v67v2, bs67, h, t, "dec-map-v67-p-len") + testDeepEqualErr(v67v1, v67v2, t, "equal-map-v67-p-len") + bs67 = testMarshalErr(&v67v1, h, t, "enc-map-v67-p") + v67v2 = nil + testUnmarshalErr(&v67v2, bs67, h, t, "dec-map-v67-p-nil") + testDeepEqualErr(v67v1, v67v2, t, "equal-map-v67-p-nil") + // ... + if v == nil { + v67v2 = nil + } else { + v67v2 = make(map[float64]int32, len(v)) + } // reset map + var v67v3, v67v4 typMapMapFloat64Int32 + v67v3 = typMapMapFloat64Int32(v67v1) + v67v4 = typMapMapFloat64Int32(v67v2) + bs67 = testMarshalErr(v67v3, h, t, "enc-map-v67-custom") + testUnmarshalErr(v67v4, bs67, h, t, "dec-map-v67-p-len") + testDeepEqualErr(v67v3, v67v4, t, "equal-map-v67-p-len") + } + + for _, v := range []map[float64]int64{nil, {}, {22.2: 0, 11.1: 33}} { + // fmt.Printf(">>>> running mammoth map v68: %v\n", v) + var v68v1, v68v2 map[float64]int64 + v68v1 = v + bs68 := testMarshalErr(v68v1, h, t, "enc-map-v68") + if v == nil { + v68v2 = nil + } else { + v68v2 = make(map[float64]int64, len(v)) + } // reset map + testUnmarshalErr(v68v2, bs68, h, t, "dec-map-v68") + testDeepEqualErr(v68v1, v68v2, t, "equal-map-v68") + if v == nil { + v68v2 = nil + } else { + v68v2 = make(map[float64]int64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v68v2), bs68, h, t, "dec-map-v68-noaddr") // decode into non-addressable map value + testDeepEqualErr(v68v1, v68v2, t, "equal-map-v68-noaddr") + if v == nil { + v68v2 = nil + } else { + v68v2 = make(map[float64]int64, len(v)) + } // reset map + testUnmarshalErr(&v68v2, bs68, h, t, "dec-map-v68-p-len") + testDeepEqualErr(v68v1, v68v2, t, "equal-map-v68-p-len") + bs68 = testMarshalErr(&v68v1, h, t, "enc-map-v68-p") + v68v2 = nil + testUnmarshalErr(&v68v2, bs68, h, t, "dec-map-v68-p-nil") + testDeepEqualErr(v68v1, v68v2, t, "equal-map-v68-p-nil") + // ... + if v == nil { + v68v2 = nil + } else { + v68v2 = make(map[float64]int64, len(v)) + } // reset map + var v68v3, v68v4 typMapMapFloat64Int64 + v68v3 = typMapMapFloat64Int64(v68v1) + v68v4 = typMapMapFloat64Int64(v68v2) + bs68 = testMarshalErr(v68v3, h, t, "enc-map-v68-custom") + testUnmarshalErr(v68v4, bs68, h, t, "dec-map-v68-p-len") + testDeepEqualErr(v68v3, v68v4, t, "equal-map-v68-p-len") + } + + for _, v := range []map[float64]float32{nil, {}, {22.2: 0, 11.1: 22.2}} { + // fmt.Printf(">>>> running mammoth map v69: %v\n", v) + var v69v1, v69v2 map[float64]float32 + v69v1 = v + bs69 := testMarshalErr(v69v1, h, t, "enc-map-v69") + if v == nil { + v69v2 = nil + } else { + v69v2 = make(map[float64]float32, len(v)) + } // reset map + testUnmarshalErr(v69v2, bs69, h, t, "dec-map-v69") + testDeepEqualErr(v69v1, v69v2, t, "equal-map-v69") + if v == nil { + v69v2 = nil + } else { + v69v2 = make(map[float64]float32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v69v2), bs69, h, t, "dec-map-v69-noaddr") // decode into non-addressable map value + testDeepEqualErr(v69v1, v69v2, t, "equal-map-v69-noaddr") + if v == nil { + v69v2 = nil + } else { + v69v2 = make(map[float64]float32, len(v)) + } // reset map + testUnmarshalErr(&v69v2, bs69, h, t, "dec-map-v69-p-len") + testDeepEqualErr(v69v1, v69v2, t, "equal-map-v69-p-len") + bs69 = testMarshalErr(&v69v1, h, t, "enc-map-v69-p") + v69v2 = nil + testUnmarshalErr(&v69v2, bs69, h, t, "dec-map-v69-p-nil") + testDeepEqualErr(v69v1, v69v2, t, "equal-map-v69-p-nil") + // ... + if v == nil { + v69v2 = nil + } else { + v69v2 = make(map[float64]float32, len(v)) + } // reset map + var v69v3, v69v4 typMapMapFloat64Float32 + v69v3 = typMapMapFloat64Float32(v69v1) + v69v4 = typMapMapFloat64Float32(v69v2) + bs69 = testMarshalErr(v69v3, h, t, "enc-map-v69-custom") + testUnmarshalErr(v69v4, bs69, h, t, "dec-map-v69-p-len") + testDeepEqualErr(v69v3, v69v4, t, "equal-map-v69-p-len") + } + + for _, v := range []map[float64]float64{nil, {}, {11.1: 0, 22.2: 11.1}} { + // fmt.Printf(">>>> running mammoth map v70: %v\n", v) + var v70v1, v70v2 map[float64]float64 + v70v1 = v + bs70 := testMarshalErr(v70v1, h, t, "enc-map-v70") + if v == nil { + v70v2 = nil + } else { + v70v2 = make(map[float64]float64, len(v)) + } // reset map + testUnmarshalErr(v70v2, bs70, h, t, "dec-map-v70") + testDeepEqualErr(v70v1, v70v2, t, "equal-map-v70") + if v == nil { + v70v2 = nil + } else { + v70v2 = make(map[float64]float64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v70v2), bs70, h, t, "dec-map-v70-noaddr") // decode into non-addressable map value + testDeepEqualErr(v70v1, v70v2, t, "equal-map-v70-noaddr") + if v == nil { + v70v2 = nil + } else { + v70v2 = make(map[float64]float64, len(v)) + } // reset map + testUnmarshalErr(&v70v2, bs70, h, t, "dec-map-v70-p-len") + testDeepEqualErr(v70v1, v70v2, t, "equal-map-v70-p-len") + bs70 = testMarshalErr(&v70v1, h, t, "enc-map-v70-p") + v70v2 = nil + testUnmarshalErr(&v70v2, bs70, h, t, "dec-map-v70-p-nil") + testDeepEqualErr(v70v1, v70v2, t, "equal-map-v70-p-nil") + // ... + if v == nil { + v70v2 = nil + } else { + v70v2 = make(map[float64]float64, len(v)) + } // reset map + var v70v3, v70v4 typMapMapFloat64Float64 + v70v3 = typMapMapFloat64Float64(v70v1) + v70v4 = typMapMapFloat64Float64(v70v2) + bs70 = testMarshalErr(v70v3, h, t, "enc-map-v70-custom") + testUnmarshalErr(v70v4, bs70, h, t, "dec-map-v70-p-len") + testDeepEqualErr(v70v3, v70v4, t, "equal-map-v70-p-len") + } + + for _, v := range []map[float64]bool{nil, {}, {22.2: false, 11.1: true}} { + // fmt.Printf(">>>> running mammoth map v71: %v\n", v) + var v71v1, v71v2 map[float64]bool + v71v1 = v + bs71 := testMarshalErr(v71v1, h, t, "enc-map-v71") + if v == nil { + v71v2 = nil + } else { + v71v2 = make(map[float64]bool, len(v)) + } // reset map + testUnmarshalErr(v71v2, bs71, h, t, "dec-map-v71") + testDeepEqualErr(v71v1, v71v2, t, "equal-map-v71") + if v == nil { + v71v2 = nil + } else { + v71v2 = make(map[float64]bool, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v71v2), bs71, h, t, "dec-map-v71-noaddr") // decode into non-addressable map value + testDeepEqualErr(v71v1, v71v2, t, "equal-map-v71-noaddr") + if v == nil { + v71v2 = nil + } else { + v71v2 = make(map[float64]bool, len(v)) + } // reset map + testUnmarshalErr(&v71v2, bs71, h, t, "dec-map-v71-p-len") + testDeepEqualErr(v71v1, v71v2, t, "equal-map-v71-p-len") + bs71 = testMarshalErr(&v71v1, h, t, "enc-map-v71-p") + v71v2 = nil + testUnmarshalErr(&v71v2, bs71, h, t, "dec-map-v71-p-nil") + testDeepEqualErr(v71v1, v71v2, t, "equal-map-v71-p-nil") + // ... + if v == nil { + v71v2 = nil + } else { + v71v2 = make(map[float64]bool, len(v)) + } // reset map + var v71v3, v71v4 typMapMapFloat64Bool + v71v3 = typMapMapFloat64Bool(v71v1) + v71v4 = typMapMapFloat64Bool(v71v2) + bs71 = testMarshalErr(v71v3, h, t, "enc-map-v71-custom") + testUnmarshalErr(v71v4, bs71, h, t, "dec-map-v71-p-len") + testDeepEqualErr(v71v3, v71v4, t, "equal-map-v71-p-len") + } + + for _, v := range []map[uint]interface{}{nil, {}, {44: nil, 33: "string-is-an-interface-2"}} { + // fmt.Printf(">>>> running mammoth map v74: %v\n", v) + var v74v1, v74v2 map[uint]interface{} + v74v1 = v + bs74 := testMarshalErr(v74v1, h, t, "enc-map-v74") + if v == nil { + v74v2 = nil + } else { + v74v2 = make(map[uint]interface{}, len(v)) + } // reset map + testUnmarshalErr(v74v2, bs74, h, t, "dec-map-v74") + testDeepEqualErr(v74v1, v74v2, t, "equal-map-v74") + if v == nil { + v74v2 = nil + } else { + v74v2 = make(map[uint]interface{}, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v74v2), bs74, h, t, "dec-map-v74-noaddr") // decode into non-addressable map value + testDeepEqualErr(v74v1, v74v2, t, "equal-map-v74-noaddr") + if v == nil { + v74v2 = nil + } else { + v74v2 = make(map[uint]interface{}, len(v)) + } // reset map + testUnmarshalErr(&v74v2, bs74, h, t, "dec-map-v74-p-len") + testDeepEqualErr(v74v1, v74v2, t, "equal-map-v74-p-len") + bs74 = testMarshalErr(&v74v1, h, t, "enc-map-v74-p") + v74v2 = nil + testUnmarshalErr(&v74v2, bs74, h, t, "dec-map-v74-p-nil") + testDeepEqualErr(v74v1, v74v2, t, "equal-map-v74-p-nil") + // ... + if v == nil { + v74v2 = nil + } else { + v74v2 = make(map[uint]interface{}, len(v)) + } // reset map + var v74v3, v74v4 typMapMapUintIntf + v74v3 = typMapMapUintIntf(v74v1) + v74v4 = typMapMapUintIntf(v74v2) + bs74 = testMarshalErr(v74v3, h, t, "enc-map-v74-custom") + testUnmarshalErr(v74v4, bs74, h, t, "dec-map-v74-p-len") + testDeepEqualErr(v74v3, v74v4, t, "equal-map-v74-p-len") + } + + for _, v := range []map[uint]string{nil, {}, {44: "", 33: "some-string-2"}} { + // fmt.Printf(">>>> running mammoth map v75: %v\n", v) + var v75v1, v75v2 map[uint]string + v75v1 = v + bs75 := testMarshalErr(v75v1, h, t, "enc-map-v75") + if v == nil { + v75v2 = nil + } else { + v75v2 = make(map[uint]string, len(v)) + } // reset map + testUnmarshalErr(v75v2, bs75, h, t, "dec-map-v75") + testDeepEqualErr(v75v1, v75v2, t, "equal-map-v75") + if v == nil { + v75v2 = nil + } else { + v75v2 = make(map[uint]string, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v75v2), bs75, h, t, "dec-map-v75-noaddr") // decode into non-addressable map value + testDeepEqualErr(v75v1, v75v2, t, "equal-map-v75-noaddr") + if v == nil { + v75v2 = nil + } else { + v75v2 = make(map[uint]string, len(v)) + } // reset map + testUnmarshalErr(&v75v2, bs75, h, t, "dec-map-v75-p-len") + testDeepEqualErr(v75v1, v75v2, t, "equal-map-v75-p-len") + bs75 = testMarshalErr(&v75v1, h, t, "enc-map-v75-p") + v75v2 = nil + testUnmarshalErr(&v75v2, bs75, h, t, "dec-map-v75-p-nil") + testDeepEqualErr(v75v1, v75v2, t, "equal-map-v75-p-nil") + // ... + if v == nil { + v75v2 = nil + } else { + v75v2 = make(map[uint]string, len(v)) + } // reset map + var v75v3, v75v4 typMapMapUintString + v75v3 = typMapMapUintString(v75v1) + v75v4 = typMapMapUintString(v75v2) + bs75 = testMarshalErr(v75v3, h, t, "enc-map-v75-custom") + testUnmarshalErr(v75v4, bs75, h, t, "dec-map-v75-p-len") + testDeepEqualErr(v75v3, v75v4, t, "equal-map-v75-p-len") + } + + for _, v := range []map[uint]uint{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v76: %v\n", v) + var v76v1, v76v2 map[uint]uint + v76v1 = v + bs76 := testMarshalErr(v76v1, h, t, "enc-map-v76") + if v == nil { + v76v2 = nil + } else { + v76v2 = make(map[uint]uint, len(v)) + } // reset map + testUnmarshalErr(v76v2, bs76, h, t, "dec-map-v76") + testDeepEqualErr(v76v1, v76v2, t, "equal-map-v76") + if v == nil { + v76v2 = nil + } else { + v76v2 = make(map[uint]uint, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v76v2), bs76, h, t, "dec-map-v76-noaddr") // decode into non-addressable map value + testDeepEqualErr(v76v1, v76v2, t, "equal-map-v76-noaddr") + if v == nil { + v76v2 = nil + } else { + v76v2 = make(map[uint]uint, len(v)) + } // reset map + testUnmarshalErr(&v76v2, bs76, h, t, "dec-map-v76-p-len") + testDeepEqualErr(v76v1, v76v2, t, "equal-map-v76-p-len") + bs76 = testMarshalErr(&v76v1, h, t, "enc-map-v76-p") + v76v2 = nil + testUnmarshalErr(&v76v2, bs76, h, t, "dec-map-v76-p-nil") + testDeepEqualErr(v76v1, v76v2, t, "equal-map-v76-p-nil") + // ... + if v == nil { + v76v2 = nil + } else { + v76v2 = make(map[uint]uint, len(v)) + } // reset map + var v76v3, v76v4 typMapMapUintUint + v76v3 = typMapMapUintUint(v76v1) + v76v4 = typMapMapUintUint(v76v2) + bs76 = testMarshalErr(v76v3, h, t, "enc-map-v76-custom") + testUnmarshalErr(v76v4, bs76, h, t, "dec-map-v76-p-len") + testDeepEqualErr(v76v3, v76v4, t, "equal-map-v76-p-len") + } + + for _, v := range []map[uint]uint8{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v77: %v\n", v) + var v77v1, v77v2 map[uint]uint8 + v77v1 = v + bs77 := testMarshalErr(v77v1, h, t, "enc-map-v77") + if v == nil { + v77v2 = nil + } else { + v77v2 = make(map[uint]uint8, len(v)) + } // reset map + testUnmarshalErr(v77v2, bs77, h, t, "dec-map-v77") + testDeepEqualErr(v77v1, v77v2, t, "equal-map-v77") + if v == nil { + v77v2 = nil + } else { + v77v2 = make(map[uint]uint8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v77v2), bs77, h, t, "dec-map-v77-noaddr") // decode into non-addressable map value + testDeepEqualErr(v77v1, v77v2, t, "equal-map-v77-noaddr") + if v == nil { + v77v2 = nil + } else { + v77v2 = make(map[uint]uint8, len(v)) + } // reset map + testUnmarshalErr(&v77v2, bs77, h, t, "dec-map-v77-p-len") + testDeepEqualErr(v77v1, v77v2, t, "equal-map-v77-p-len") + bs77 = testMarshalErr(&v77v1, h, t, "enc-map-v77-p") + v77v2 = nil + testUnmarshalErr(&v77v2, bs77, h, t, "dec-map-v77-p-nil") + testDeepEqualErr(v77v1, v77v2, t, "equal-map-v77-p-nil") + // ... + if v == nil { + v77v2 = nil + } else { + v77v2 = make(map[uint]uint8, len(v)) + } // reset map + var v77v3, v77v4 typMapMapUintUint8 + v77v3 = typMapMapUintUint8(v77v1) + v77v4 = typMapMapUintUint8(v77v2) + bs77 = testMarshalErr(v77v3, h, t, "enc-map-v77-custom") + testUnmarshalErr(v77v4, bs77, h, t, "dec-map-v77-p-len") + testDeepEqualErr(v77v3, v77v4, t, "equal-map-v77-p-len") + } + + for _, v := range []map[uint]uint16{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v78: %v\n", v) + var v78v1, v78v2 map[uint]uint16 + v78v1 = v + bs78 := testMarshalErr(v78v1, h, t, "enc-map-v78") + if v == nil { + v78v2 = nil + } else { + v78v2 = make(map[uint]uint16, len(v)) + } // reset map + testUnmarshalErr(v78v2, bs78, h, t, "dec-map-v78") + testDeepEqualErr(v78v1, v78v2, t, "equal-map-v78") + if v == nil { + v78v2 = nil + } else { + v78v2 = make(map[uint]uint16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v78v2), bs78, h, t, "dec-map-v78-noaddr") // decode into non-addressable map value + testDeepEqualErr(v78v1, v78v2, t, "equal-map-v78-noaddr") + if v == nil { + v78v2 = nil + } else { + v78v2 = make(map[uint]uint16, len(v)) + } // reset map + testUnmarshalErr(&v78v2, bs78, h, t, "dec-map-v78-p-len") + testDeepEqualErr(v78v1, v78v2, t, "equal-map-v78-p-len") + bs78 = testMarshalErr(&v78v1, h, t, "enc-map-v78-p") + v78v2 = nil + testUnmarshalErr(&v78v2, bs78, h, t, "dec-map-v78-p-nil") + testDeepEqualErr(v78v1, v78v2, t, "equal-map-v78-p-nil") + // ... + if v == nil { + v78v2 = nil + } else { + v78v2 = make(map[uint]uint16, len(v)) + } // reset map + var v78v3, v78v4 typMapMapUintUint16 + v78v3 = typMapMapUintUint16(v78v1) + v78v4 = typMapMapUintUint16(v78v2) + bs78 = testMarshalErr(v78v3, h, t, "enc-map-v78-custom") + testUnmarshalErr(v78v4, bs78, h, t, "dec-map-v78-p-len") + testDeepEqualErr(v78v3, v78v4, t, "equal-map-v78-p-len") + } + + for _, v := range []map[uint]uint32{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v79: %v\n", v) + var v79v1, v79v2 map[uint]uint32 + v79v1 = v + bs79 := testMarshalErr(v79v1, h, t, "enc-map-v79") + if v == nil { + v79v2 = nil + } else { + v79v2 = make(map[uint]uint32, len(v)) + } // reset map + testUnmarshalErr(v79v2, bs79, h, t, "dec-map-v79") + testDeepEqualErr(v79v1, v79v2, t, "equal-map-v79") + if v == nil { + v79v2 = nil + } else { + v79v2 = make(map[uint]uint32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v79v2), bs79, h, t, "dec-map-v79-noaddr") // decode into non-addressable map value + testDeepEqualErr(v79v1, v79v2, t, "equal-map-v79-noaddr") + if v == nil { + v79v2 = nil + } else { + v79v2 = make(map[uint]uint32, len(v)) + } // reset map + testUnmarshalErr(&v79v2, bs79, h, t, "dec-map-v79-p-len") + testDeepEqualErr(v79v1, v79v2, t, "equal-map-v79-p-len") + bs79 = testMarshalErr(&v79v1, h, t, "enc-map-v79-p") + v79v2 = nil + testUnmarshalErr(&v79v2, bs79, h, t, "dec-map-v79-p-nil") + testDeepEqualErr(v79v1, v79v2, t, "equal-map-v79-p-nil") + // ... + if v == nil { + v79v2 = nil + } else { + v79v2 = make(map[uint]uint32, len(v)) + } // reset map + var v79v3, v79v4 typMapMapUintUint32 + v79v3 = typMapMapUintUint32(v79v1) + v79v4 = typMapMapUintUint32(v79v2) + bs79 = testMarshalErr(v79v3, h, t, "enc-map-v79-custom") + testUnmarshalErr(v79v4, bs79, h, t, "dec-map-v79-p-len") + testDeepEqualErr(v79v3, v79v4, t, "equal-map-v79-p-len") + } + + for _, v := range []map[uint]uint64{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v80: %v\n", v) + var v80v1, v80v2 map[uint]uint64 + v80v1 = v + bs80 := testMarshalErr(v80v1, h, t, "enc-map-v80") + if v == nil { + v80v2 = nil + } else { + v80v2 = make(map[uint]uint64, len(v)) + } // reset map + testUnmarshalErr(v80v2, bs80, h, t, "dec-map-v80") + testDeepEqualErr(v80v1, v80v2, t, "equal-map-v80") + if v == nil { + v80v2 = nil + } else { + v80v2 = make(map[uint]uint64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v80v2), bs80, h, t, "dec-map-v80-noaddr") // decode into non-addressable map value + testDeepEqualErr(v80v1, v80v2, t, "equal-map-v80-noaddr") + if v == nil { + v80v2 = nil + } else { + v80v2 = make(map[uint]uint64, len(v)) + } // reset map + testUnmarshalErr(&v80v2, bs80, h, t, "dec-map-v80-p-len") + testDeepEqualErr(v80v1, v80v2, t, "equal-map-v80-p-len") + bs80 = testMarshalErr(&v80v1, h, t, "enc-map-v80-p") + v80v2 = nil + testUnmarshalErr(&v80v2, bs80, h, t, "dec-map-v80-p-nil") + testDeepEqualErr(v80v1, v80v2, t, "equal-map-v80-p-nil") + // ... + if v == nil { + v80v2 = nil + } else { + v80v2 = make(map[uint]uint64, len(v)) + } // reset map + var v80v3, v80v4 typMapMapUintUint64 + v80v3 = typMapMapUintUint64(v80v1) + v80v4 = typMapMapUintUint64(v80v2) + bs80 = testMarshalErr(v80v3, h, t, "enc-map-v80-custom") + testUnmarshalErr(v80v4, bs80, h, t, "dec-map-v80-p-len") + testDeepEqualErr(v80v3, v80v4, t, "equal-map-v80-p-len") + } + + for _, v := range []map[uint]uintptr{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v81: %v\n", v) + var v81v1, v81v2 map[uint]uintptr + v81v1 = v + bs81 := testMarshalErr(v81v1, h, t, "enc-map-v81") + if v == nil { + v81v2 = nil + } else { + v81v2 = make(map[uint]uintptr, len(v)) + } // reset map + testUnmarshalErr(v81v2, bs81, h, t, "dec-map-v81") + testDeepEqualErr(v81v1, v81v2, t, "equal-map-v81") + if v == nil { + v81v2 = nil + } else { + v81v2 = make(map[uint]uintptr, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v81v2), bs81, h, t, "dec-map-v81-noaddr") // decode into non-addressable map value + testDeepEqualErr(v81v1, v81v2, t, "equal-map-v81-noaddr") + if v == nil { + v81v2 = nil + } else { + v81v2 = make(map[uint]uintptr, len(v)) + } // reset map + testUnmarshalErr(&v81v2, bs81, h, t, "dec-map-v81-p-len") + testDeepEqualErr(v81v1, v81v2, t, "equal-map-v81-p-len") + bs81 = testMarshalErr(&v81v1, h, t, "enc-map-v81-p") + v81v2 = nil + testUnmarshalErr(&v81v2, bs81, h, t, "dec-map-v81-p-nil") + testDeepEqualErr(v81v1, v81v2, t, "equal-map-v81-p-nil") + // ... + if v == nil { + v81v2 = nil + } else { + v81v2 = make(map[uint]uintptr, len(v)) + } // reset map + var v81v3, v81v4 typMapMapUintUintptr + v81v3 = typMapMapUintUintptr(v81v1) + v81v4 = typMapMapUintUintptr(v81v2) + bs81 = testMarshalErr(v81v3, h, t, "enc-map-v81-custom") + testUnmarshalErr(v81v4, bs81, h, t, "dec-map-v81-p-len") + testDeepEqualErr(v81v3, v81v4, t, "equal-map-v81-p-len") + } + + for _, v := range []map[uint]int{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v82: %v\n", v) + var v82v1, v82v2 map[uint]int + v82v1 = v + bs82 := testMarshalErr(v82v1, h, t, "enc-map-v82") + if v == nil { + v82v2 = nil + } else { + v82v2 = make(map[uint]int, len(v)) + } // reset map + testUnmarshalErr(v82v2, bs82, h, t, "dec-map-v82") + testDeepEqualErr(v82v1, v82v2, t, "equal-map-v82") + if v == nil { + v82v2 = nil + } else { + v82v2 = make(map[uint]int, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v82v2), bs82, h, t, "dec-map-v82-noaddr") // decode into non-addressable map value + testDeepEqualErr(v82v1, v82v2, t, "equal-map-v82-noaddr") + if v == nil { + v82v2 = nil + } else { + v82v2 = make(map[uint]int, len(v)) + } // reset map + testUnmarshalErr(&v82v2, bs82, h, t, "dec-map-v82-p-len") + testDeepEqualErr(v82v1, v82v2, t, "equal-map-v82-p-len") + bs82 = testMarshalErr(&v82v1, h, t, "enc-map-v82-p") + v82v2 = nil + testUnmarshalErr(&v82v2, bs82, h, t, "dec-map-v82-p-nil") + testDeepEqualErr(v82v1, v82v2, t, "equal-map-v82-p-nil") + // ... + if v == nil { + v82v2 = nil + } else { + v82v2 = make(map[uint]int, len(v)) + } // reset map + var v82v3, v82v4 typMapMapUintInt + v82v3 = typMapMapUintInt(v82v1) + v82v4 = typMapMapUintInt(v82v2) + bs82 = testMarshalErr(v82v3, h, t, "enc-map-v82-custom") + testUnmarshalErr(v82v4, bs82, h, t, "dec-map-v82-p-len") + testDeepEqualErr(v82v3, v82v4, t, "equal-map-v82-p-len") + } + + for _, v := range []map[uint]int8{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v83: %v\n", v) + var v83v1, v83v2 map[uint]int8 + v83v1 = v + bs83 := testMarshalErr(v83v1, h, t, "enc-map-v83") + if v == nil { + v83v2 = nil + } else { + v83v2 = make(map[uint]int8, len(v)) + } // reset map + testUnmarshalErr(v83v2, bs83, h, t, "dec-map-v83") + testDeepEqualErr(v83v1, v83v2, t, "equal-map-v83") + if v == nil { + v83v2 = nil + } else { + v83v2 = make(map[uint]int8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v83v2), bs83, h, t, "dec-map-v83-noaddr") // decode into non-addressable map value + testDeepEqualErr(v83v1, v83v2, t, "equal-map-v83-noaddr") + if v == nil { + v83v2 = nil + } else { + v83v2 = make(map[uint]int8, len(v)) + } // reset map + testUnmarshalErr(&v83v2, bs83, h, t, "dec-map-v83-p-len") + testDeepEqualErr(v83v1, v83v2, t, "equal-map-v83-p-len") + bs83 = testMarshalErr(&v83v1, h, t, "enc-map-v83-p") + v83v2 = nil + testUnmarshalErr(&v83v2, bs83, h, t, "dec-map-v83-p-nil") + testDeepEqualErr(v83v1, v83v2, t, "equal-map-v83-p-nil") + // ... + if v == nil { + v83v2 = nil + } else { + v83v2 = make(map[uint]int8, len(v)) + } // reset map + var v83v3, v83v4 typMapMapUintInt8 + v83v3 = typMapMapUintInt8(v83v1) + v83v4 = typMapMapUintInt8(v83v2) + bs83 = testMarshalErr(v83v3, h, t, "enc-map-v83-custom") + testUnmarshalErr(v83v4, bs83, h, t, "dec-map-v83-p-len") + testDeepEqualErr(v83v3, v83v4, t, "equal-map-v83-p-len") + } + + for _, v := range []map[uint]int16{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v84: %v\n", v) + var v84v1, v84v2 map[uint]int16 + v84v1 = v + bs84 := testMarshalErr(v84v1, h, t, "enc-map-v84") + if v == nil { + v84v2 = nil + } else { + v84v2 = make(map[uint]int16, len(v)) + } // reset map + testUnmarshalErr(v84v2, bs84, h, t, "dec-map-v84") + testDeepEqualErr(v84v1, v84v2, t, "equal-map-v84") + if v == nil { + v84v2 = nil + } else { + v84v2 = make(map[uint]int16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v84v2), bs84, h, t, "dec-map-v84-noaddr") // decode into non-addressable map value + testDeepEqualErr(v84v1, v84v2, t, "equal-map-v84-noaddr") + if v == nil { + v84v2 = nil + } else { + v84v2 = make(map[uint]int16, len(v)) + } // reset map + testUnmarshalErr(&v84v2, bs84, h, t, "dec-map-v84-p-len") + testDeepEqualErr(v84v1, v84v2, t, "equal-map-v84-p-len") + bs84 = testMarshalErr(&v84v1, h, t, "enc-map-v84-p") + v84v2 = nil + testUnmarshalErr(&v84v2, bs84, h, t, "dec-map-v84-p-nil") + testDeepEqualErr(v84v1, v84v2, t, "equal-map-v84-p-nil") + // ... + if v == nil { + v84v2 = nil + } else { + v84v2 = make(map[uint]int16, len(v)) + } // reset map + var v84v3, v84v4 typMapMapUintInt16 + v84v3 = typMapMapUintInt16(v84v1) + v84v4 = typMapMapUintInt16(v84v2) + bs84 = testMarshalErr(v84v3, h, t, "enc-map-v84-custom") + testUnmarshalErr(v84v4, bs84, h, t, "dec-map-v84-p-len") + testDeepEqualErr(v84v3, v84v4, t, "equal-map-v84-p-len") + } + + for _, v := range []map[uint]int32{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v85: %v\n", v) + var v85v1, v85v2 map[uint]int32 + v85v1 = v + bs85 := testMarshalErr(v85v1, h, t, "enc-map-v85") + if v == nil { + v85v2 = nil + } else { + v85v2 = make(map[uint]int32, len(v)) + } // reset map + testUnmarshalErr(v85v2, bs85, h, t, "dec-map-v85") + testDeepEqualErr(v85v1, v85v2, t, "equal-map-v85") + if v == nil { + v85v2 = nil + } else { + v85v2 = make(map[uint]int32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v85v2), bs85, h, t, "dec-map-v85-noaddr") // decode into non-addressable map value + testDeepEqualErr(v85v1, v85v2, t, "equal-map-v85-noaddr") + if v == nil { + v85v2 = nil + } else { + v85v2 = make(map[uint]int32, len(v)) + } // reset map + testUnmarshalErr(&v85v2, bs85, h, t, "dec-map-v85-p-len") + testDeepEqualErr(v85v1, v85v2, t, "equal-map-v85-p-len") + bs85 = testMarshalErr(&v85v1, h, t, "enc-map-v85-p") + v85v2 = nil + testUnmarshalErr(&v85v2, bs85, h, t, "dec-map-v85-p-nil") + testDeepEqualErr(v85v1, v85v2, t, "equal-map-v85-p-nil") + // ... + if v == nil { + v85v2 = nil + } else { + v85v2 = make(map[uint]int32, len(v)) + } // reset map + var v85v3, v85v4 typMapMapUintInt32 + v85v3 = typMapMapUintInt32(v85v1) + v85v4 = typMapMapUintInt32(v85v2) + bs85 = testMarshalErr(v85v3, h, t, "enc-map-v85-custom") + testUnmarshalErr(v85v4, bs85, h, t, "dec-map-v85-p-len") + testDeepEqualErr(v85v3, v85v4, t, "equal-map-v85-p-len") + } + + for _, v := range []map[uint]int64{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v86: %v\n", v) + var v86v1, v86v2 map[uint]int64 + v86v1 = v + bs86 := testMarshalErr(v86v1, h, t, "enc-map-v86") + if v == nil { + v86v2 = nil + } else { + v86v2 = make(map[uint]int64, len(v)) + } // reset map + testUnmarshalErr(v86v2, bs86, h, t, "dec-map-v86") + testDeepEqualErr(v86v1, v86v2, t, "equal-map-v86") + if v == nil { + v86v2 = nil + } else { + v86v2 = make(map[uint]int64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v86v2), bs86, h, t, "dec-map-v86-noaddr") // decode into non-addressable map value + testDeepEqualErr(v86v1, v86v2, t, "equal-map-v86-noaddr") + if v == nil { + v86v2 = nil + } else { + v86v2 = make(map[uint]int64, len(v)) + } // reset map + testUnmarshalErr(&v86v2, bs86, h, t, "dec-map-v86-p-len") + testDeepEqualErr(v86v1, v86v2, t, "equal-map-v86-p-len") + bs86 = testMarshalErr(&v86v1, h, t, "enc-map-v86-p") + v86v2 = nil + testUnmarshalErr(&v86v2, bs86, h, t, "dec-map-v86-p-nil") + testDeepEqualErr(v86v1, v86v2, t, "equal-map-v86-p-nil") + // ... + if v == nil { + v86v2 = nil + } else { + v86v2 = make(map[uint]int64, len(v)) + } // reset map + var v86v3, v86v4 typMapMapUintInt64 + v86v3 = typMapMapUintInt64(v86v1) + v86v4 = typMapMapUintInt64(v86v2) + bs86 = testMarshalErr(v86v3, h, t, "enc-map-v86-custom") + testUnmarshalErr(v86v4, bs86, h, t, "dec-map-v86-p-len") + testDeepEqualErr(v86v3, v86v4, t, "equal-map-v86-p-len") + } + + for _, v := range []map[uint]float32{nil, {}, {33: 0, 44: 22.2}} { + // fmt.Printf(">>>> running mammoth map v87: %v\n", v) + var v87v1, v87v2 map[uint]float32 + v87v1 = v + bs87 := testMarshalErr(v87v1, h, t, "enc-map-v87") + if v == nil { + v87v2 = nil + } else { + v87v2 = make(map[uint]float32, len(v)) + } // reset map + testUnmarshalErr(v87v2, bs87, h, t, "dec-map-v87") + testDeepEqualErr(v87v1, v87v2, t, "equal-map-v87") + if v == nil { + v87v2 = nil + } else { + v87v2 = make(map[uint]float32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v87v2), bs87, h, t, "dec-map-v87-noaddr") // decode into non-addressable map value + testDeepEqualErr(v87v1, v87v2, t, "equal-map-v87-noaddr") + if v == nil { + v87v2 = nil + } else { + v87v2 = make(map[uint]float32, len(v)) + } // reset map + testUnmarshalErr(&v87v2, bs87, h, t, "dec-map-v87-p-len") + testDeepEqualErr(v87v1, v87v2, t, "equal-map-v87-p-len") + bs87 = testMarshalErr(&v87v1, h, t, "enc-map-v87-p") + v87v2 = nil + testUnmarshalErr(&v87v2, bs87, h, t, "dec-map-v87-p-nil") + testDeepEqualErr(v87v1, v87v2, t, "equal-map-v87-p-nil") + // ... + if v == nil { + v87v2 = nil + } else { + v87v2 = make(map[uint]float32, len(v)) + } // reset map + var v87v3, v87v4 typMapMapUintFloat32 + v87v3 = typMapMapUintFloat32(v87v1) + v87v4 = typMapMapUintFloat32(v87v2) + bs87 = testMarshalErr(v87v3, h, t, "enc-map-v87-custom") + testUnmarshalErr(v87v4, bs87, h, t, "dec-map-v87-p-len") + testDeepEqualErr(v87v3, v87v4, t, "equal-map-v87-p-len") + } + + for _, v := range []map[uint]float64{nil, {}, {33: 0, 44: 11.1}} { + // fmt.Printf(">>>> running mammoth map v88: %v\n", v) + var v88v1, v88v2 map[uint]float64 + v88v1 = v + bs88 := testMarshalErr(v88v1, h, t, "enc-map-v88") + if v == nil { + v88v2 = nil + } else { + v88v2 = make(map[uint]float64, len(v)) + } // reset map + testUnmarshalErr(v88v2, bs88, h, t, "dec-map-v88") + testDeepEqualErr(v88v1, v88v2, t, "equal-map-v88") + if v == nil { + v88v2 = nil + } else { + v88v2 = make(map[uint]float64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v88v2), bs88, h, t, "dec-map-v88-noaddr") // decode into non-addressable map value + testDeepEqualErr(v88v1, v88v2, t, "equal-map-v88-noaddr") + if v == nil { + v88v2 = nil + } else { + v88v2 = make(map[uint]float64, len(v)) + } // reset map + testUnmarshalErr(&v88v2, bs88, h, t, "dec-map-v88-p-len") + testDeepEqualErr(v88v1, v88v2, t, "equal-map-v88-p-len") + bs88 = testMarshalErr(&v88v1, h, t, "enc-map-v88-p") + v88v2 = nil + testUnmarshalErr(&v88v2, bs88, h, t, "dec-map-v88-p-nil") + testDeepEqualErr(v88v1, v88v2, t, "equal-map-v88-p-nil") + // ... + if v == nil { + v88v2 = nil + } else { + v88v2 = make(map[uint]float64, len(v)) + } // reset map + var v88v3, v88v4 typMapMapUintFloat64 + v88v3 = typMapMapUintFloat64(v88v1) + v88v4 = typMapMapUintFloat64(v88v2) + bs88 = testMarshalErr(v88v3, h, t, "enc-map-v88-custom") + testUnmarshalErr(v88v4, bs88, h, t, "dec-map-v88-p-len") + testDeepEqualErr(v88v3, v88v4, t, "equal-map-v88-p-len") + } + + for _, v := range []map[uint]bool{nil, {}, {33: false, 44: true}} { + // fmt.Printf(">>>> running mammoth map v89: %v\n", v) + var v89v1, v89v2 map[uint]bool + v89v1 = v + bs89 := testMarshalErr(v89v1, h, t, "enc-map-v89") + if v == nil { + v89v2 = nil + } else { + v89v2 = make(map[uint]bool, len(v)) + } // reset map + testUnmarshalErr(v89v2, bs89, h, t, "dec-map-v89") + testDeepEqualErr(v89v1, v89v2, t, "equal-map-v89") + if v == nil { + v89v2 = nil + } else { + v89v2 = make(map[uint]bool, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v89v2), bs89, h, t, "dec-map-v89-noaddr") // decode into non-addressable map value + testDeepEqualErr(v89v1, v89v2, t, "equal-map-v89-noaddr") + if v == nil { + v89v2 = nil + } else { + v89v2 = make(map[uint]bool, len(v)) + } // reset map + testUnmarshalErr(&v89v2, bs89, h, t, "dec-map-v89-p-len") + testDeepEqualErr(v89v1, v89v2, t, "equal-map-v89-p-len") + bs89 = testMarshalErr(&v89v1, h, t, "enc-map-v89-p") + v89v2 = nil + testUnmarshalErr(&v89v2, bs89, h, t, "dec-map-v89-p-nil") + testDeepEqualErr(v89v1, v89v2, t, "equal-map-v89-p-nil") + // ... + if v == nil { + v89v2 = nil + } else { + v89v2 = make(map[uint]bool, len(v)) + } // reset map + var v89v3, v89v4 typMapMapUintBool + v89v3 = typMapMapUintBool(v89v1) + v89v4 = typMapMapUintBool(v89v2) + bs89 = testMarshalErr(v89v3, h, t, "enc-map-v89-custom") + testUnmarshalErr(v89v4, bs89, h, t, "dec-map-v89-p-len") + testDeepEqualErr(v89v3, v89v4, t, "equal-map-v89-p-len") + } + + for _, v := range []map[uint8]interface{}{nil, {}, {33: nil, 44: "string-is-an-interface"}} { + // fmt.Printf(">>>> running mammoth map v92: %v\n", v) + var v92v1, v92v2 map[uint8]interface{} + v92v1 = v + bs92 := testMarshalErr(v92v1, h, t, "enc-map-v92") + if v == nil { + v92v2 = nil + } else { + v92v2 = make(map[uint8]interface{}, len(v)) + } // reset map + testUnmarshalErr(v92v2, bs92, h, t, "dec-map-v92") + testDeepEqualErr(v92v1, v92v2, t, "equal-map-v92") + if v == nil { + v92v2 = nil + } else { + v92v2 = make(map[uint8]interface{}, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v92v2), bs92, h, t, "dec-map-v92-noaddr") // decode into non-addressable map value + testDeepEqualErr(v92v1, v92v2, t, "equal-map-v92-noaddr") + if v == nil { + v92v2 = nil + } else { + v92v2 = make(map[uint8]interface{}, len(v)) + } // reset map + testUnmarshalErr(&v92v2, bs92, h, t, "dec-map-v92-p-len") + testDeepEqualErr(v92v1, v92v2, t, "equal-map-v92-p-len") + bs92 = testMarshalErr(&v92v1, h, t, "enc-map-v92-p") + v92v2 = nil + testUnmarshalErr(&v92v2, bs92, h, t, "dec-map-v92-p-nil") + testDeepEqualErr(v92v1, v92v2, t, "equal-map-v92-p-nil") + // ... + if v == nil { + v92v2 = nil + } else { + v92v2 = make(map[uint8]interface{}, len(v)) + } // reset map + var v92v3, v92v4 typMapMapUint8Intf + v92v3 = typMapMapUint8Intf(v92v1) + v92v4 = typMapMapUint8Intf(v92v2) + bs92 = testMarshalErr(v92v3, h, t, "enc-map-v92-custom") + testUnmarshalErr(v92v4, bs92, h, t, "dec-map-v92-p-len") + testDeepEqualErr(v92v3, v92v4, t, "equal-map-v92-p-len") + } + + for _, v := range []map[uint8]string{nil, {}, {33: "", 44: "some-string"}} { + // fmt.Printf(">>>> running mammoth map v93: %v\n", v) + var v93v1, v93v2 map[uint8]string + v93v1 = v + bs93 := testMarshalErr(v93v1, h, t, "enc-map-v93") + if v == nil { + v93v2 = nil + } else { + v93v2 = make(map[uint8]string, len(v)) + } // reset map + testUnmarshalErr(v93v2, bs93, h, t, "dec-map-v93") + testDeepEqualErr(v93v1, v93v2, t, "equal-map-v93") + if v == nil { + v93v2 = nil + } else { + v93v2 = make(map[uint8]string, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v93v2), bs93, h, t, "dec-map-v93-noaddr") // decode into non-addressable map value + testDeepEqualErr(v93v1, v93v2, t, "equal-map-v93-noaddr") + if v == nil { + v93v2 = nil + } else { + v93v2 = make(map[uint8]string, len(v)) + } // reset map + testUnmarshalErr(&v93v2, bs93, h, t, "dec-map-v93-p-len") + testDeepEqualErr(v93v1, v93v2, t, "equal-map-v93-p-len") + bs93 = testMarshalErr(&v93v1, h, t, "enc-map-v93-p") + v93v2 = nil + testUnmarshalErr(&v93v2, bs93, h, t, "dec-map-v93-p-nil") + testDeepEqualErr(v93v1, v93v2, t, "equal-map-v93-p-nil") + // ... + if v == nil { + v93v2 = nil + } else { + v93v2 = make(map[uint8]string, len(v)) + } // reset map + var v93v3, v93v4 typMapMapUint8String + v93v3 = typMapMapUint8String(v93v1) + v93v4 = typMapMapUint8String(v93v2) + bs93 = testMarshalErr(v93v3, h, t, "enc-map-v93-custom") + testUnmarshalErr(v93v4, bs93, h, t, "dec-map-v93-p-len") + testDeepEqualErr(v93v3, v93v4, t, "equal-map-v93-p-len") + } + + for _, v := range []map[uint8]uint{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v94: %v\n", v) + var v94v1, v94v2 map[uint8]uint + v94v1 = v + bs94 := testMarshalErr(v94v1, h, t, "enc-map-v94") + if v == nil { + v94v2 = nil + } else { + v94v2 = make(map[uint8]uint, len(v)) + } // reset map + testUnmarshalErr(v94v2, bs94, h, t, "dec-map-v94") + testDeepEqualErr(v94v1, v94v2, t, "equal-map-v94") + if v == nil { + v94v2 = nil + } else { + v94v2 = make(map[uint8]uint, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v94v2), bs94, h, t, "dec-map-v94-noaddr") // decode into non-addressable map value + testDeepEqualErr(v94v1, v94v2, t, "equal-map-v94-noaddr") + if v == nil { + v94v2 = nil + } else { + v94v2 = make(map[uint8]uint, len(v)) + } // reset map + testUnmarshalErr(&v94v2, bs94, h, t, "dec-map-v94-p-len") + testDeepEqualErr(v94v1, v94v2, t, "equal-map-v94-p-len") + bs94 = testMarshalErr(&v94v1, h, t, "enc-map-v94-p") + v94v2 = nil + testUnmarshalErr(&v94v2, bs94, h, t, "dec-map-v94-p-nil") + testDeepEqualErr(v94v1, v94v2, t, "equal-map-v94-p-nil") + // ... + if v == nil { + v94v2 = nil + } else { + v94v2 = make(map[uint8]uint, len(v)) + } // reset map + var v94v3, v94v4 typMapMapUint8Uint + v94v3 = typMapMapUint8Uint(v94v1) + v94v4 = typMapMapUint8Uint(v94v2) + bs94 = testMarshalErr(v94v3, h, t, "enc-map-v94-custom") + testUnmarshalErr(v94v4, bs94, h, t, "dec-map-v94-p-len") + testDeepEqualErr(v94v3, v94v4, t, "equal-map-v94-p-len") + } + + for _, v := range []map[uint8]uint8{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v95: %v\n", v) + var v95v1, v95v2 map[uint8]uint8 + v95v1 = v + bs95 := testMarshalErr(v95v1, h, t, "enc-map-v95") + if v == nil { + v95v2 = nil + } else { + v95v2 = make(map[uint8]uint8, len(v)) + } // reset map + testUnmarshalErr(v95v2, bs95, h, t, "dec-map-v95") + testDeepEqualErr(v95v1, v95v2, t, "equal-map-v95") + if v == nil { + v95v2 = nil + } else { + v95v2 = make(map[uint8]uint8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v95v2), bs95, h, t, "dec-map-v95-noaddr") // decode into non-addressable map value + testDeepEqualErr(v95v1, v95v2, t, "equal-map-v95-noaddr") + if v == nil { + v95v2 = nil + } else { + v95v2 = make(map[uint8]uint8, len(v)) + } // reset map + testUnmarshalErr(&v95v2, bs95, h, t, "dec-map-v95-p-len") + testDeepEqualErr(v95v1, v95v2, t, "equal-map-v95-p-len") + bs95 = testMarshalErr(&v95v1, h, t, "enc-map-v95-p") + v95v2 = nil + testUnmarshalErr(&v95v2, bs95, h, t, "dec-map-v95-p-nil") + testDeepEqualErr(v95v1, v95v2, t, "equal-map-v95-p-nil") + // ... + if v == nil { + v95v2 = nil + } else { + v95v2 = make(map[uint8]uint8, len(v)) + } // reset map + var v95v3, v95v4 typMapMapUint8Uint8 + v95v3 = typMapMapUint8Uint8(v95v1) + v95v4 = typMapMapUint8Uint8(v95v2) + bs95 = testMarshalErr(v95v3, h, t, "enc-map-v95-custom") + testUnmarshalErr(v95v4, bs95, h, t, "dec-map-v95-p-len") + testDeepEqualErr(v95v3, v95v4, t, "equal-map-v95-p-len") + } + + for _, v := range []map[uint8]uint16{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v96: %v\n", v) + var v96v1, v96v2 map[uint8]uint16 + v96v1 = v + bs96 := testMarshalErr(v96v1, h, t, "enc-map-v96") + if v == nil { + v96v2 = nil + } else { + v96v2 = make(map[uint8]uint16, len(v)) + } // reset map + testUnmarshalErr(v96v2, bs96, h, t, "dec-map-v96") + testDeepEqualErr(v96v1, v96v2, t, "equal-map-v96") + if v == nil { + v96v2 = nil + } else { + v96v2 = make(map[uint8]uint16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v96v2), bs96, h, t, "dec-map-v96-noaddr") // decode into non-addressable map value + testDeepEqualErr(v96v1, v96v2, t, "equal-map-v96-noaddr") + if v == nil { + v96v2 = nil + } else { + v96v2 = make(map[uint8]uint16, len(v)) + } // reset map + testUnmarshalErr(&v96v2, bs96, h, t, "dec-map-v96-p-len") + testDeepEqualErr(v96v1, v96v2, t, "equal-map-v96-p-len") + bs96 = testMarshalErr(&v96v1, h, t, "enc-map-v96-p") + v96v2 = nil + testUnmarshalErr(&v96v2, bs96, h, t, "dec-map-v96-p-nil") + testDeepEqualErr(v96v1, v96v2, t, "equal-map-v96-p-nil") + // ... + if v == nil { + v96v2 = nil + } else { + v96v2 = make(map[uint8]uint16, len(v)) + } // reset map + var v96v3, v96v4 typMapMapUint8Uint16 + v96v3 = typMapMapUint8Uint16(v96v1) + v96v4 = typMapMapUint8Uint16(v96v2) + bs96 = testMarshalErr(v96v3, h, t, "enc-map-v96-custom") + testUnmarshalErr(v96v4, bs96, h, t, "dec-map-v96-p-len") + testDeepEqualErr(v96v3, v96v4, t, "equal-map-v96-p-len") + } + + for _, v := range []map[uint8]uint32{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v97: %v\n", v) + var v97v1, v97v2 map[uint8]uint32 + v97v1 = v + bs97 := testMarshalErr(v97v1, h, t, "enc-map-v97") + if v == nil { + v97v2 = nil + } else { + v97v2 = make(map[uint8]uint32, len(v)) + } // reset map + testUnmarshalErr(v97v2, bs97, h, t, "dec-map-v97") + testDeepEqualErr(v97v1, v97v2, t, "equal-map-v97") + if v == nil { + v97v2 = nil + } else { + v97v2 = make(map[uint8]uint32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v97v2), bs97, h, t, "dec-map-v97-noaddr") // decode into non-addressable map value + testDeepEqualErr(v97v1, v97v2, t, "equal-map-v97-noaddr") + if v == nil { + v97v2 = nil + } else { + v97v2 = make(map[uint8]uint32, len(v)) + } // reset map + testUnmarshalErr(&v97v2, bs97, h, t, "dec-map-v97-p-len") + testDeepEqualErr(v97v1, v97v2, t, "equal-map-v97-p-len") + bs97 = testMarshalErr(&v97v1, h, t, "enc-map-v97-p") + v97v2 = nil + testUnmarshalErr(&v97v2, bs97, h, t, "dec-map-v97-p-nil") + testDeepEqualErr(v97v1, v97v2, t, "equal-map-v97-p-nil") + // ... + if v == nil { + v97v2 = nil + } else { + v97v2 = make(map[uint8]uint32, len(v)) + } // reset map + var v97v3, v97v4 typMapMapUint8Uint32 + v97v3 = typMapMapUint8Uint32(v97v1) + v97v4 = typMapMapUint8Uint32(v97v2) + bs97 = testMarshalErr(v97v3, h, t, "enc-map-v97-custom") + testUnmarshalErr(v97v4, bs97, h, t, "dec-map-v97-p-len") + testDeepEqualErr(v97v3, v97v4, t, "equal-map-v97-p-len") + } + + for _, v := range []map[uint8]uint64{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v98: %v\n", v) + var v98v1, v98v2 map[uint8]uint64 + v98v1 = v + bs98 := testMarshalErr(v98v1, h, t, "enc-map-v98") + if v == nil { + v98v2 = nil + } else { + v98v2 = make(map[uint8]uint64, len(v)) + } // reset map + testUnmarshalErr(v98v2, bs98, h, t, "dec-map-v98") + testDeepEqualErr(v98v1, v98v2, t, "equal-map-v98") + if v == nil { + v98v2 = nil + } else { + v98v2 = make(map[uint8]uint64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v98v2), bs98, h, t, "dec-map-v98-noaddr") // decode into non-addressable map value + testDeepEqualErr(v98v1, v98v2, t, "equal-map-v98-noaddr") + if v == nil { + v98v2 = nil + } else { + v98v2 = make(map[uint8]uint64, len(v)) + } // reset map + testUnmarshalErr(&v98v2, bs98, h, t, "dec-map-v98-p-len") + testDeepEqualErr(v98v1, v98v2, t, "equal-map-v98-p-len") + bs98 = testMarshalErr(&v98v1, h, t, "enc-map-v98-p") + v98v2 = nil + testUnmarshalErr(&v98v2, bs98, h, t, "dec-map-v98-p-nil") + testDeepEqualErr(v98v1, v98v2, t, "equal-map-v98-p-nil") + // ... + if v == nil { + v98v2 = nil + } else { + v98v2 = make(map[uint8]uint64, len(v)) + } // reset map + var v98v3, v98v4 typMapMapUint8Uint64 + v98v3 = typMapMapUint8Uint64(v98v1) + v98v4 = typMapMapUint8Uint64(v98v2) + bs98 = testMarshalErr(v98v3, h, t, "enc-map-v98-custom") + testUnmarshalErr(v98v4, bs98, h, t, "dec-map-v98-p-len") + testDeepEqualErr(v98v3, v98v4, t, "equal-map-v98-p-len") + } + + for _, v := range []map[uint8]uintptr{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v99: %v\n", v) + var v99v1, v99v2 map[uint8]uintptr + v99v1 = v + bs99 := testMarshalErr(v99v1, h, t, "enc-map-v99") + if v == nil { + v99v2 = nil + } else { + v99v2 = make(map[uint8]uintptr, len(v)) + } // reset map + testUnmarshalErr(v99v2, bs99, h, t, "dec-map-v99") + testDeepEqualErr(v99v1, v99v2, t, "equal-map-v99") + if v == nil { + v99v2 = nil + } else { + v99v2 = make(map[uint8]uintptr, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v99v2), bs99, h, t, "dec-map-v99-noaddr") // decode into non-addressable map value + testDeepEqualErr(v99v1, v99v2, t, "equal-map-v99-noaddr") + if v == nil { + v99v2 = nil + } else { + v99v2 = make(map[uint8]uintptr, len(v)) + } // reset map + testUnmarshalErr(&v99v2, bs99, h, t, "dec-map-v99-p-len") + testDeepEqualErr(v99v1, v99v2, t, "equal-map-v99-p-len") + bs99 = testMarshalErr(&v99v1, h, t, "enc-map-v99-p") + v99v2 = nil + testUnmarshalErr(&v99v2, bs99, h, t, "dec-map-v99-p-nil") + testDeepEqualErr(v99v1, v99v2, t, "equal-map-v99-p-nil") + // ... + if v == nil { + v99v2 = nil + } else { + v99v2 = make(map[uint8]uintptr, len(v)) + } // reset map + var v99v3, v99v4 typMapMapUint8Uintptr + v99v3 = typMapMapUint8Uintptr(v99v1) + v99v4 = typMapMapUint8Uintptr(v99v2) + bs99 = testMarshalErr(v99v3, h, t, "enc-map-v99-custom") + testUnmarshalErr(v99v4, bs99, h, t, "dec-map-v99-p-len") + testDeepEqualErr(v99v3, v99v4, t, "equal-map-v99-p-len") + } + + for _, v := range []map[uint8]int{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v100: %v\n", v) + var v100v1, v100v2 map[uint8]int + v100v1 = v + bs100 := testMarshalErr(v100v1, h, t, "enc-map-v100") + if v == nil { + v100v2 = nil + } else { + v100v2 = make(map[uint8]int, len(v)) + } // reset map + testUnmarshalErr(v100v2, bs100, h, t, "dec-map-v100") + testDeepEqualErr(v100v1, v100v2, t, "equal-map-v100") + if v == nil { + v100v2 = nil + } else { + v100v2 = make(map[uint8]int, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v100v2), bs100, h, t, "dec-map-v100-noaddr") // decode into non-addressable map value + testDeepEqualErr(v100v1, v100v2, t, "equal-map-v100-noaddr") + if v == nil { + v100v2 = nil + } else { + v100v2 = make(map[uint8]int, len(v)) + } // reset map + testUnmarshalErr(&v100v2, bs100, h, t, "dec-map-v100-p-len") + testDeepEqualErr(v100v1, v100v2, t, "equal-map-v100-p-len") + bs100 = testMarshalErr(&v100v1, h, t, "enc-map-v100-p") + v100v2 = nil + testUnmarshalErr(&v100v2, bs100, h, t, "dec-map-v100-p-nil") + testDeepEqualErr(v100v1, v100v2, t, "equal-map-v100-p-nil") + // ... + if v == nil { + v100v2 = nil + } else { + v100v2 = make(map[uint8]int, len(v)) + } // reset map + var v100v3, v100v4 typMapMapUint8Int + v100v3 = typMapMapUint8Int(v100v1) + v100v4 = typMapMapUint8Int(v100v2) + bs100 = testMarshalErr(v100v3, h, t, "enc-map-v100-custom") + testUnmarshalErr(v100v4, bs100, h, t, "dec-map-v100-p-len") + testDeepEqualErr(v100v3, v100v4, t, "equal-map-v100-p-len") + } + + for _, v := range []map[uint8]int8{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v101: %v\n", v) + var v101v1, v101v2 map[uint8]int8 + v101v1 = v + bs101 := testMarshalErr(v101v1, h, t, "enc-map-v101") + if v == nil { + v101v2 = nil + } else { + v101v2 = make(map[uint8]int8, len(v)) + } // reset map + testUnmarshalErr(v101v2, bs101, h, t, "dec-map-v101") + testDeepEqualErr(v101v1, v101v2, t, "equal-map-v101") + if v == nil { + v101v2 = nil + } else { + v101v2 = make(map[uint8]int8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v101v2), bs101, h, t, "dec-map-v101-noaddr") // decode into non-addressable map value + testDeepEqualErr(v101v1, v101v2, t, "equal-map-v101-noaddr") + if v == nil { + v101v2 = nil + } else { + v101v2 = make(map[uint8]int8, len(v)) + } // reset map + testUnmarshalErr(&v101v2, bs101, h, t, "dec-map-v101-p-len") + testDeepEqualErr(v101v1, v101v2, t, "equal-map-v101-p-len") + bs101 = testMarshalErr(&v101v1, h, t, "enc-map-v101-p") + v101v2 = nil + testUnmarshalErr(&v101v2, bs101, h, t, "dec-map-v101-p-nil") + testDeepEqualErr(v101v1, v101v2, t, "equal-map-v101-p-nil") + // ... + if v == nil { + v101v2 = nil + } else { + v101v2 = make(map[uint8]int8, len(v)) + } // reset map + var v101v3, v101v4 typMapMapUint8Int8 + v101v3 = typMapMapUint8Int8(v101v1) + v101v4 = typMapMapUint8Int8(v101v2) + bs101 = testMarshalErr(v101v3, h, t, "enc-map-v101-custom") + testUnmarshalErr(v101v4, bs101, h, t, "dec-map-v101-p-len") + testDeepEqualErr(v101v3, v101v4, t, "equal-map-v101-p-len") + } + + for _, v := range []map[uint8]int16{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v102: %v\n", v) + var v102v1, v102v2 map[uint8]int16 + v102v1 = v + bs102 := testMarshalErr(v102v1, h, t, "enc-map-v102") + if v == nil { + v102v2 = nil + } else { + v102v2 = make(map[uint8]int16, len(v)) + } // reset map + testUnmarshalErr(v102v2, bs102, h, t, "dec-map-v102") + testDeepEqualErr(v102v1, v102v2, t, "equal-map-v102") + if v == nil { + v102v2 = nil + } else { + v102v2 = make(map[uint8]int16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v102v2), bs102, h, t, "dec-map-v102-noaddr") // decode into non-addressable map value + testDeepEqualErr(v102v1, v102v2, t, "equal-map-v102-noaddr") + if v == nil { + v102v2 = nil + } else { + v102v2 = make(map[uint8]int16, len(v)) + } // reset map + testUnmarshalErr(&v102v2, bs102, h, t, "dec-map-v102-p-len") + testDeepEqualErr(v102v1, v102v2, t, "equal-map-v102-p-len") + bs102 = testMarshalErr(&v102v1, h, t, "enc-map-v102-p") + v102v2 = nil + testUnmarshalErr(&v102v2, bs102, h, t, "dec-map-v102-p-nil") + testDeepEqualErr(v102v1, v102v2, t, "equal-map-v102-p-nil") + // ... + if v == nil { + v102v2 = nil + } else { + v102v2 = make(map[uint8]int16, len(v)) + } // reset map + var v102v3, v102v4 typMapMapUint8Int16 + v102v3 = typMapMapUint8Int16(v102v1) + v102v4 = typMapMapUint8Int16(v102v2) + bs102 = testMarshalErr(v102v3, h, t, "enc-map-v102-custom") + testUnmarshalErr(v102v4, bs102, h, t, "dec-map-v102-p-len") + testDeepEqualErr(v102v3, v102v4, t, "equal-map-v102-p-len") + } + + for _, v := range []map[uint8]int32{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v103: %v\n", v) + var v103v1, v103v2 map[uint8]int32 + v103v1 = v + bs103 := testMarshalErr(v103v1, h, t, "enc-map-v103") + if v == nil { + v103v2 = nil + } else { + v103v2 = make(map[uint8]int32, len(v)) + } // reset map + testUnmarshalErr(v103v2, bs103, h, t, "dec-map-v103") + testDeepEqualErr(v103v1, v103v2, t, "equal-map-v103") + if v == nil { + v103v2 = nil + } else { + v103v2 = make(map[uint8]int32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v103v2), bs103, h, t, "dec-map-v103-noaddr") // decode into non-addressable map value + testDeepEqualErr(v103v1, v103v2, t, "equal-map-v103-noaddr") + if v == nil { + v103v2 = nil + } else { + v103v2 = make(map[uint8]int32, len(v)) + } // reset map + testUnmarshalErr(&v103v2, bs103, h, t, "dec-map-v103-p-len") + testDeepEqualErr(v103v1, v103v2, t, "equal-map-v103-p-len") + bs103 = testMarshalErr(&v103v1, h, t, "enc-map-v103-p") + v103v2 = nil + testUnmarshalErr(&v103v2, bs103, h, t, "dec-map-v103-p-nil") + testDeepEqualErr(v103v1, v103v2, t, "equal-map-v103-p-nil") + // ... + if v == nil { + v103v2 = nil + } else { + v103v2 = make(map[uint8]int32, len(v)) + } // reset map + var v103v3, v103v4 typMapMapUint8Int32 + v103v3 = typMapMapUint8Int32(v103v1) + v103v4 = typMapMapUint8Int32(v103v2) + bs103 = testMarshalErr(v103v3, h, t, "enc-map-v103-custom") + testUnmarshalErr(v103v4, bs103, h, t, "dec-map-v103-p-len") + testDeepEqualErr(v103v3, v103v4, t, "equal-map-v103-p-len") + } + + for _, v := range []map[uint8]int64{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v104: %v\n", v) + var v104v1, v104v2 map[uint8]int64 + v104v1 = v + bs104 := testMarshalErr(v104v1, h, t, "enc-map-v104") + if v == nil { + v104v2 = nil + } else { + v104v2 = make(map[uint8]int64, len(v)) + } // reset map + testUnmarshalErr(v104v2, bs104, h, t, "dec-map-v104") + testDeepEqualErr(v104v1, v104v2, t, "equal-map-v104") + if v == nil { + v104v2 = nil + } else { + v104v2 = make(map[uint8]int64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v104v2), bs104, h, t, "dec-map-v104-noaddr") // decode into non-addressable map value + testDeepEqualErr(v104v1, v104v2, t, "equal-map-v104-noaddr") + if v == nil { + v104v2 = nil + } else { + v104v2 = make(map[uint8]int64, len(v)) + } // reset map + testUnmarshalErr(&v104v2, bs104, h, t, "dec-map-v104-p-len") + testDeepEqualErr(v104v1, v104v2, t, "equal-map-v104-p-len") + bs104 = testMarshalErr(&v104v1, h, t, "enc-map-v104-p") + v104v2 = nil + testUnmarshalErr(&v104v2, bs104, h, t, "dec-map-v104-p-nil") + testDeepEqualErr(v104v1, v104v2, t, "equal-map-v104-p-nil") + // ... + if v == nil { + v104v2 = nil + } else { + v104v2 = make(map[uint8]int64, len(v)) + } // reset map + var v104v3, v104v4 typMapMapUint8Int64 + v104v3 = typMapMapUint8Int64(v104v1) + v104v4 = typMapMapUint8Int64(v104v2) + bs104 = testMarshalErr(v104v3, h, t, "enc-map-v104-custom") + testUnmarshalErr(v104v4, bs104, h, t, "dec-map-v104-p-len") + testDeepEqualErr(v104v3, v104v4, t, "equal-map-v104-p-len") + } + + for _, v := range []map[uint8]float32{nil, {}, {44: 0, 33: 22.2}} { + // fmt.Printf(">>>> running mammoth map v105: %v\n", v) + var v105v1, v105v2 map[uint8]float32 + v105v1 = v + bs105 := testMarshalErr(v105v1, h, t, "enc-map-v105") + if v == nil { + v105v2 = nil + } else { + v105v2 = make(map[uint8]float32, len(v)) + } // reset map + testUnmarshalErr(v105v2, bs105, h, t, "dec-map-v105") + testDeepEqualErr(v105v1, v105v2, t, "equal-map-v105") + if v == nil { + v105v2 = nil + } else { + v105v2 = make(map[uint8]float32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v105v2), bs105, h, t, "dec-map-v105-noaddr") // decode into non-addressable map value + testDeepEqualErr(v105v1, v105v2, t, "equal-map-v105-noaddr") + if v == nil { + v105v2 = nil + } else { + v105v2 = make(map[uint8]float32, len(v)) + } // reset map + testUnmarshalErr(&v105v2, bs105, h, t, "dec-map-v105-p-len") + testDeepEqualErr(v105v1, v105v2, t, "equal-map-v105-p-len") + bs105 = testMarshalErr(&v105v1, h, t, "enc-map-v105-p") + v105v2 = nil + testUnmarshalErr(&v105v2, bs105, h, t, "dec-map-v105-p-nil") + testDeepEqualErr(v105v1, v105v2, t, "equal-map-v105-p-nil") + // ... + if v == nil { + v105v2 = nil + } else { + v105v2 = make(map[uint8]float32, len(v)) + } // reset map + var v105v3, v105v4 typMapMapUint8Float32 + v105v3 = typMapMapUint8Float32(v105v1) + v105v4 = typMapMapUint8Float32(v105v2) + bs105 = testMarshalErr(v105v3, h, t, "enc-map-v105-custom") + testUnmarshalErr(v105v4, bs105, h, t, "dec-map-v105-p-len") + testDeepEqualErr(v105v3, v105v4, t, "equal-map-v105-p-len") + } + + for _, v := range []map[uint8]float64{nil, {}, {44: 0, 33: 11.1}} { + // fmt.Printf(">>>> running mammoth map v106: %v\n", v) + var v106v1, v106v2 map[uint8]float64 + v106v1 = v + bs106 := testMarshalErr(v106v1, h, t, "enc-map-v106") + if v == nil { + v106v2 = nil + } else { + v106v2 = make(map[uint8]float64, len(v)) + } // reset map + testUnmarshalErr(v106v2, bs106, h, t, "dec-map-v106") + testDeepEqualErr(v106v1, v106v2, t, "equal-map-v106") + if v == nil { + v106v2 = nil + } else { + v106v2 = make(map[uint8]float64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v106v2), bs106, h, t, "dec-map-v106-noaddr") // decode into non-addressable map value + testDeepEqualErr(v106v1, v106v2, t, "equal-map-v106-noaddr") + if v == nil { + v106v2 = nil + } else { + v106v2 = make(map[uint8]float64, len(v)) + } // reset map + testUnmarshalErr(&v106v2, bs106, h, t, "dec-map-v106-p-len") + testDeepEqualErr(v106v1, v106v2, t, "equal-map-v106-p-len") + bs106 = testMarshalErr(&v106v1, h, t, "enc-map-v106-p") + v106v2 = nil + testUnmarshalErr(&v106v2, bs106, h, t, "dec-map-v106-p-nil") + testDeepEqualErr(v106v1, v106v2, t, "equal-map-v106-p-nil") + // ... + if v == nil { + v106v2 = nil + } else { + v106v2 = make(map[uint8]float64, len(v)) + } // reset map + var v106v3, v106v4 typMapMapUint8Float64 + v106v3 = typMapMapUint8Float64(v106v1) + v106v4 = typMapMapUint8Float64(v106v2) + bs106 = testMarshalErr(v106v3, h, t, "enc-map-v106-custom") + testUnmarshalErr(v106v4, bs106, h, t, "dec-map-v106-p-len") + testDeepEqualErr(v106v3, v106v4, t, "equal-map-v106-p-len") + } + + for _, v := range []map[uint8]bool{nil, {}, {44: false, 33: true}} { + // fmt.Printf(">>>> running mammoth map v107: %v\n", v) + var v107v1, v107v2 map[uint8]bool + v107v1 = v + bs107 := testMarshalErr(v107v1, h, t, "enc-map-v107") + if v == nil { + v107v2 = nil + } else { + v107v2 = make(map[uint8]bool, len(v)) + } // reset map + testUnmarshalErr(v107v2, bs107, h, t, "dec-map-v107") + testDeepEqualErr(v107v1, v107v2, t, "equal-map-v107") + if v == nil { + v107v2 = nil + } else { + v107v2 = make(map[uint8]bool, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v107v2), bs107, h, t, "dec-map-v107-noaddr") // decode into non-addressable map value + testDeepEqualErr(v107v1, v107v2, t, "equal-map-v107-noaddr") + if v == nil { + v107v2 = nil + } else { + v107v2 = make(map[uint8]bool, len(v)) + } // reset map + testUnmarshalErr(&v107v2, bs107, h, t, "dec-map-v107-p-len") + testDeepEqualErr(v107v1, v107v2, t, "equal-map-v107-p-len") + bs107 = testMarshalErr(&v107v1, h, t, "enc-map-v107-p") + v107v2 = nil + testUnmarshalErr(&v107v2, bs107, h, t, "dec-map-v107-p-nil") + testDeepEqualErr(v107v1, v107v2, t, "equal-map-v107-p-nil") + // ... + if v == nil { + v107v2 = nil + } else { + v107v2 = make(map[uint8]bool, len(v)) + } // reset map + var v107v3, v107v4 typMapMapUint8Bool + v107v3 = typMapMapUint8Bool(v107v1) + v107v4 = typMapMapUint8Bool(v107v2) + bs107 = testMarshalErr(v107v3, h, t, "enc-map-v107-custom") + testUnmarshalErr(v107v4, bs107, h, t, "dec-map-v107-p-len") + testDeepEqualErr(v107v3, v107v4, t, "equal-map-v107-p-len") + } + + for _, v := range []map[uint16]interface{}{nil, {}, {44: nil, 33: "string-is-an-interface-2"}} { + // fmt.Printf(">>>> running mammoth map v110: %v\n", v) + var v110v1, v110v2 map[uint16]interface{} + v110v1 = v + bs110 := testMarshalErr(v110v1, h, t, "enc-map-v110") + if v == nil { + v110v2 = nil + } else { + v110v2 = make(map[uint16]interface{}, len(v)) + } // reset map + testUnmarshalErr(v110v2, bs110, h, t, "dec-map-v110") + testDeepEqualErr(v110v1, v110v2, t, "equal-map-v110") + if v == nil { + v110v2 = nil + } else { + v110v2 = make(map[uint16]interface{}, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v110v2), bs110, h, t, "dec-map-v110-noaddr") // decode into non-addressable map value + testDeepEqualErr(v110v1, v110v2, t, "equal-map-v110-noaddr") + if v == nil { + v110v2 = nil + } else { + v110v2 = make(map[uint16]interface{}, len(v)) + } // reset map + testUnmarshalErr(&v110v2, bs110, h, t, "dec-map-v110-p-len") + testDeepEqualErr(v110v1, v110v2, t, "equal-map-v110-p-len") + bs110 = testMarshalErr(&v110v1, h, t, "enc-map-v110-p") + v110v2 = nil + testUnmarshalErr(&v110v2, bs110, h, t, "dec-map-v110-p-nil") + testDeepEqualErr(v110v1, v110v2, t, "equal-map-v110-p-nil") + // ... + if v == nil { + v110v2 = nil + } else { + v110v2 = make(map[uint16]interface{}, len(v)) + } // reset map + var v110v3, v110v4 typMapMapUint16Intf + v110v3 = typMapMapUint16Intf(v110v1) + v110v4 = typMapMapUint16Intf(v110v2) + bs110 = testMarshalErr(v110v3, h, t, "enc-map-v110-custom") + testUnmarshalErr(v110v4, bs110, h, t, "dec-map-v110-p-len") + testDeepEqualErr(v110v3, v110v4, t, "equal-map-v110-p-len") + } + + for _, v := range []map[uint16]string{nil, {}, {44: "", 33: "some-string-2"}} { + // fmt.Printf(">>>> running mammoth map v111: %v\n", v) + var v111v1, v111v2 map[uint16]string + v111v1 = v + bs111 := testMarshalErr(v111v1, h, t, "enc-map-v111") + if v == nil { + v111v2 = nil + } else { + v111v2 = make(map[uint16]string, len(v)) + } // reset map + testUnmarshalErr(v111v2, bs111, h, t, "dec-map-v111") + testDeepEqualErr(v111v1, v111v2, t, "equal-map-v111") + if v == nil { + v111v2 = nil + } else { + v111v2 = make(map[uint16]string, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v111v2), bs111, h, t, "dec-map-v111-noaddr") // decode into non-addressable map value + testDeepEqualErr(v111v1, v111v2, t, "equal-map-v111-noaddr") + if v == nil { + v111v2 = nil + } else { + v111v2 = make(map[uint16]string, len(v)) + } // reset map + testUnmarshalErr(&v111v2, bs111, h, t, "dec-map-v111-p-len") + testDeepEqualErr(v111v1, v111v2, t, "equal-map-v111-p-len") + bs111 = testMarshalErr(&v111v1, h, t, "enc-map-v111-p") + v111v2 = nil + testUnmarshalErr(&v111v2, bs111, h, t, "dec-map-v111-p-nil") + testDeepEqualErr(v111v1, v111v2, t, "equal-map-v111-p-nil") + // ... + if v == nil { + v111v2 = nil + } else { + v111v2 = make(map[uint16]string, len(v)) + } // reset map + var v111v3, v111v4 typMapMapUint16String + v111v3 = typMapMapUint16String(v111v1) + v111v4 = typMapMapUint16String(v111v2) + bs111 = testMarshalErr(v111v3, h, t, "enc-map-v111-custom") + testUnmarshalErr(v111v4, bs111, h, t, "dec-map-v111-p-len") + testDeepEqualErr(v111v3, v111v4, t, "equal-map-v111-p-len") + } + + for _, v := range []map[uint16]uint{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v112: %v\n", v) + var v112v1, v112v2 map[uint16]uint + v112v1 = v + bs112 := testMarshalErr(v112v1, h, t, "enc-map-v112") + if v == nil { + v112v2 = nil + } else { + v112v2 = make(map[uint16]uint, len(v)) + } // reset map + testUnmarshalErr(v112v2, bs112, h, t, "dec-map-v112") + testDeepEqualErr(v112v1, v112v2, t, "equal-map-v112") + if v == nil { + v112v2 = nil + } else { + v112v2 = make(map[uint16]uint, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v112v2), bs112, h, t, "dec-map-v112-noaddr") // decode into non-addressable map value + testDeepEqualErr(v112v1, v112v2, t, "equal-map-v112-noaddr") + if v == nil { + v112v2 = nil + } else { + v112v2 = make(map[uint16]uint, len(v)) + } // reset map + testUnmarshalErr(&v112v2, bs112, h, t, "dec-map-v112-p-len") + testDeepEqualErr(v112v1, v112v2, t, "equal-map-v112-p-len") + bs112 = testMarshalErr(&v112v1, h, t, "enc-map-v112-p") + v112v2 = nil + testUnmarshalErr(&v112v2, bs112, h, t, "dec-map-v112-p-nil") + testDeepEqualErr(v112v1, v112v2, t, "equal-map-v112-p-nil") + // ... + if v == nil { + v112v2 = nil + } else { + v112v2 = make(map[uint16]uint, len(v)) + } // reset map + var v112v3, v112v4 typMapMapUint16Uint + v112v3 = typMapMapUint16Uint(v112v1) + v112v4 = typMapMapUint16Uint(v112v2) + bs112 = testMarshalErr(v112v3, h, t, "enc-map-v112-custom") + testUnmarshalErr(v112v4, bs112, h, t, "dec-map-v112-p-len") + testDeepEqualErr(v112v3, v112v4, t, "equal-map-v112-p-len") + } + + for _, v := range []map[uint16]uint8{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v113: %v\n", v) + var v113v1, v113v2 map[uint16]uint8 + v113v1 = v + bs113 := testMarshalErr(v113v1, h, t, "enc-map-v113") + if v == nil { + v113v2 = nil + } else { + v113v2 = make(map[uint16]uint8, len(v)) + } // reset map + testUnmarshalErr(v113v2, bs113, h, t, "dec-map-v113") + testDeepEqualErr(v113v1, v113v2, t, "equal-map-v113") + if v == nil { + v113v2 = nil + } else { + v113v2 = make(map[uint16]uint8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v113v2), bs113, h, t, "dec-map-v113-noaddr") // decode into non-addressable map value + testDeepEqualErr(v113v1, v113v2, t, "equal-map-v113-noaddr") + if v == nil { + v113v2 = nil + } else { + v113v2 = make(map[uint16]uint8, len(v)) + } // reset map + testUnmarshalErr(&v113v2, bs113, h, t, "dec-map-v113-p-len") + testDeepEqualErr(v113v1, v113v2, t, "equal-map-v113-p-len") + bs113 = testMarshalErr(&v113v1, h, t, "enc-map-v113-p") + v113v2 = nil + testUnmarshalErr(&v113v2, bs113, h, t, "dec-map-v113-p-nil") + testDeepEqualErr(v113v1, v113v2, t, "equal-map-v113-p-nil") + // ... + if v == nil { + v113v2 = nil + } else { + v113v2 = make(map[uint16]uint8, len(v)) + } // reset map + var v113v3, v113v4 typMapMapUint16Uint8 + v113v3 = typMapMapUint16Uint8(v113v1) + v113v4 = typMapMapUint16Uint8(v113v2) + bs113 = testMarshalErr(v113v3, h, t, "enc-map-v113-custom") + testUnmarshalErr(v113v4, bs113, h, t, "dec-map-v113-p-len") + testDeepEqualErr(v113v3, v113v4, t, "equal-map-v113-p-len") + } + + for _, v := range []map[uint16]uint16{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v114: %v\n", v) + var v114v1, v114v2 map[uint16]uint16 + v114v1 = v + bs114 := testMarshalErr(v114v1, h, t, "enc-map-v114") + if v == nil { + v114v2 = nil + } else { + v114v2 = make(map[uint16]uint16, len(v)) + } // reset map + testUnmarshalErr(v114v2, bs114, h, t, "dec-map-v114") + testDeepEqualErr(v114v1, v114v2, t, "equal-map-v114") + if v == nil { + v114v2 = nil + } else { + v114v2 = make(map[uint16]uint16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v114v2), bs114, h, t, "dec-map-v114-noaddr") // decode into non-addressable map value + testDeepEqualErr(v114v1, v114v2, t, "equal-map-v114-noaddr") + if v == nil { + v114v2 = nil + } else { + v114v2 = make(map[uint16]uint16, len(v)) + } // reset map + testUnmarshalErr(&v114v2, bs114, h, t, "dec-map-v114-p-len") + testDeepEqualErr(v114v1, v114v2, t, "equal-map-v114-p-len") + bs114 = testMarshalErr(&v114v1, h, t, "enc-map-v114-p") + v114v2 = nil + testUnmarshalErr(&v114v2, bs114, h, t, "dec-map-v114-p-nil") + testDeepEqualErr(v114v1, v114v2, t, "equal-map-v114-p-nil") + // ... + if v == nil { + v114v2 = nil + } else { + v114v2 = make(map[uint16]uint16, len(v)) + } // reset map + var v114v3, v114v4 typMapMapUint16Uint16 + v114v3 = typMapMapUint16Uint16(v114v1) + v114v4 = typMapMapUint16Uint16(v114v2) + bs114 = testMarshalErr(v114v3, h, t, "enc-map-v114-custom") + testUnmarshalErr(v114v4, bs114, h, t, "dec-map-v114-p-len") + testDeepEqualErr(v114v3, v114v4, t, "equal-map-v114-p-len") + } + + for _, v := range []map[uint16]uint32{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v115: %v\n", v) + var v115v1, v115v2 map[uint16]uint32 + v115v1 = v + bs115 := testMarshalErr(v115v1, h, t, "enc-map-v115") + if v == nil { + v115v2 = nil + } else { + v115v2 = make(map[uint16]uint32, len(v)) + } // reset map + testUnmarshalErr(v115v2, bs115, h, t, "dec-map-v115") + testDeepEqualErr(v115v1, v115v2, t, "equal-map-v115") + if v == nil { + v115v2 = nil + } else { + v115v2 = make(map[uint16]uint32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v115v2), bs115, h, t, "dec-map-v115-noaddr") // decode into non-addressable map value + testDeepEqualErr(v115v1, v115v2, t, "equal-map-v115-noaddr") + if v == nil { + v115v2 = nil + } else { + v115v2 = make(map[uint16]uint32, len(v)) + } // reset map + testUnmarshalErr(&v115v2, bs115, h, t, "dec-map-v115-p-len") + testDeepEqualErr(v115v1, v115v2, t, "equal-map-v115-p-len") + bs115 = testMarshalErr(&v115v1, h, t, "enc-map-v115-p") + v115v2 = nil + testUnmarshalErr(&v115v2, bs115, h, t, "dec-map-v115-p-nil") + testDeepEqualErr(v115v1, v115v2, t, "equal-map-v115-p-nil") + // ... + if v == nil { + v115v2 = nil + } else { + v115v2 = make(map[uint16]uint32, len(v)) + } // reset map + var v115v3, v115v4 typMapMapUint16Uint32 + v115v3 = typMapMapUint16Uint32(v115v1) + v115v4 = typMapMapUint16Uint32(v115v2) + bs115 = testMarshalErr(v115v3, h, t, "enc-map-v115-custom") + testUnmarshalErr(v115v4, bs115, h, t, "dec-map-v115-p-len") + testDeepEqualErr(v115v3, v115v4, t, "equal-map-v115-p-len") + } + + for _, v := range []map[uint16]uint64{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v116: %v\n", v) + var v116v1, v116v2 map[uint16]uint64 + v116v1 = v + bs116 := testMarshalErr(v116v1, h, t, "enc-map-v116") + if v == nil { + v116v2 = nil + } else { + v116v2 = make(map[uint16]uint64, len(v)) + } // reset map + testUnmarshalErr(v116v2, bs116, h, t, "dec-map-v116") + testDeepEqualErr(v116v1, v116v2, t, "equal-map-v116") + if v == nil { + v116v2 = nil + } else { + v116v2 = make(map[uint16]uint64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v116v2), bs116, h, t, "dec-map-v116-noaddr") // decode into non-addressable map value + testDeepEqualErr(v116v1, v116v2, t, "equal-map-v116-noaddr") + if v == nil { + v116v2 = nil + } else { + v116v2 = make(map[uint16]uint64, len(v)) + } // reset map + testUnmarshalErr(&v116v2, bs116, h, t, "dec-map-v116-p-len") + testDeepEqualErr(v116v1, v116v2, t, "equal-map-v116-p-len") + bs116 = testMarshalErr(&v116v1, h, t, "enc-map-v116-p") + v116v2 = nil + testUnmarshalErr(&v116v2, bs116, h, t, "dec-map-v116-p-nil") + testDeepEqualErr(v116v1, v116v2, t, "equal-map-v116-p-nil") + // ... + if v == nil { + v116v2 = nil + } else { + v116v2 = make(map[uint16]uint64, len(v)) + } // reset map + var v116v3, v116v4 typMapMapUint16Uint64 + v116v3 = typMapMapUint16Uint64(v116v1) + v116v4 = typMapMapUint16Uint64(v116v2) + bs116 = testMarshalErr(v116v3, h, t, "enc-map-v116-custom") + testUnmarshalErr(v116v4, bs116, h, t, "dec-map-v116-p-len") + testDeepEqualErr(v116v3, v116v4, t, "equal-map-v116-p-len") + } + + for _, v := range []map[uint16]uintptr{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v117: %v\n", v) + var v117v1, v117v2 map[uint16]uintptr + v117v1 = v + bs117 := testMarshalErr(v117v1, h, t, "enc-map-v117") + if v == nil { + v117v2 = nil + } else { + v117v2 = make(map[uint16]uintptr, len(v)) + } // reset map + testUnmarshalErr(v117v2, bs117, h, t, "dec-map-v117") + testDeepEqualErr(v117v1, v117v2, t, "equal-map-v117") + if v == nil { + v117v2 = nil + } else { + v117v2 = make(map[uint16]uintptr, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v117v2), bs117, h, t, "dec-map-v117-noaddr") // decode into non-addressable map value + testDeepEqualErr(v117v1, v117v2, t, "equal-map-v117-noaddr") + if v == nil { + v117v2 = nil + } else { + v117v2 = make(map[uint16]uintptr, len(v)) + } // reset map + testUnmarshalErr(&v117v2, bs117, h, t, "dec-map-v117-p-len") + testDeepEqualErr(v117v1, v117v2, t, "equal-map-v117-p-len") + bs117 = testMarshalErr(&v117v1, h, t, "enc-map-v117-p") + v117v2 = nil + testUnmarshalErr(&v117v2, bs117, h, t, "dec-map-v117-p-nil") + testDeepEqualErr(v117v1, v117v2, t, "equal-map-v117-p-nil") + // ... + if v == nil { + v117v2 = nil + } else { + v117v2 = make(map[uint16]uintptr, len(v)) + } // reset map + var v117v3, v117v4 typMapMapUint16Uintptr + v117v3 = typMapMapUint16Uintptr(v117v1) + v117v4 = typMapMapUint16Uintptr(v117v2) + bs117 = testMarshalErr(v117v3, h, t, "enc-map-v117-custom") + testUnmarshalErr(v117v4, bs117, h, t, "dec-map-v117-p-len") + testDeepEqualErr(v117v3, v117v4, t, "equal-map-v117-p-len") + } + + for _, v := range []map[uint16]int{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v118: %v\n", v) + var v118v1, v118v2 map[uint16]int + v118v1 = v + bs118 := testMarshalErr(v118v1, h, t, "enc-map-v118") + if v == nil { + v118v2 = nil + } else { + v118v2 = make(map[uint16]int, len(v)) + } // reset map + testUnmarshalErr(v118v2, bs118, h, t, "dec-map-v118") + testDeepEqualErr(v118v1, v118v2, t, "equal-map-v118") + if v == nil { + v118v2 = nil + } else { + v118v2 = make(map[uint16]int, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v118v2), bs118, h, t, "dec-map-v118-noaddr") // decode into non-addressable map value + testDeepEqualErr(v118v1, v118v2, t, "equal-map-v118-noaddr") + if v == nil { + v118v2 = nil + } else { + v118v2 = make(map[uint16]int, len(v)) + } // reset map + testUnmarshalErr(&v118v2, bs118, h, t, "dec-map-v118-p-len") + testDeepEqualErr(v118v1, v118v2, t, "equal-map-v118-p-len") + bs118 = testMarshalErr(&v118v1, h, t, "enc-map-v118-p") + v118v2 = nil + testUnmarshalErr(&v118v2, bs118, h, t, "dec-map-v118-p-nil") + testDeepEqualErr(v118v1, v118v2, t, "equal-map-v118-p-nil") + // ... + if v == nil { + v118v2 = nil + } else { + v118v2 = make(map[uint16]int, len(v)) + } // reset map + var v118v3, v118v4 typMapMapUint16Int + v118v3 = typMapMapUint16Int(v118v1) + v118v4 = typMapMapUint16Int(v118v2) + bs118 = testMarshalErr(v118v3, h, t, "enc-map-v118-custom") + testUnmarshalErr(v118v4, bs118, h, t, "dec-map-v118-p-len") + testDeepEqualErr(v118v3, v118v4, t, "equal-map-v118-p-len") + } + + for _, v := range []map[uint16]int8{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v119: %v\n", v) + var v119v1, v119v2 map[uint16]int8 + v119v1 = v + bs119 := testMarshalErr(v119v1, h, t, "enc-map-v119") + if v == nil { + v119v2 = nil + } else { + v119v2 = make(map[uint16]int8, len(v)) + } // reset map + testUnmarshalErr(v119v2, bs119, h, t, "dec-map-v119") + testDeepEqualErr(v119v1, v119v2, t, "equal-map-v119") + if v == nil { + v119v2 = nil + } else { + v119v2 = make(map[uint16]int8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v119v2), bs119, h, t, "dec-map-v119-noaddr") // decode into non-addressable map value + testDeepEqualErr(v119v1, v119v2, t, "equal-map-v119-noaddr") + if v == nil { + v119v2 = nil + } else { + v119v2 = make(map[uint16]int8, len(v)) + } // reset map + testUnmarshalErr(&v119v2, bs119, h, t, "dec-map-v119-p-len") + testDeepEqualErr(v119v1, v119v2, t, "equal-map-v119-p-len") + bs119 = testMarshalErr(&v119v1, h, t, "enc-map-v119-p") + v119v2 = nil + testUnmarshalErr(&v119v2, bs119, h, t, "dec-map-v119-p-nil") + testDeepEqualErr(v119v1, v119v2, t, "equal-map-v119-p-nil") + // ... + if v == nil { + v119v2 = nil + } else { + v119v2 = make(map[uint16]int8, len(v)) + } // reset map + var v119v3, v119v4 typMapMapUint16Int8 + v119v3 = typMapMapUint16Int8(v119v1) + v119v4 = typMapMapUint16Int8(v119v2) + bs119 = testMarshalErr(v119v3, h, t, "enc-map-v119-custom") + testUnmarshalErr(v119v4, bs119, h, t, "dec-map-v119-p-len") + testDeepEqualErr(v119v3, v119v4, t, "equal-map-v119-p-len") + } + + for _, v := range []map[uint16]int16{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v120: %v\n", v) + var v120v1, v120v2 map[uint16]int16 + v120v1 = v + bs120 := testMarshalErr(v120v1, h, t, "enc-map-v120") + if v == nil { + v120v2 = nil + } else { + v120v2 = make(map[uint16]int16, len(v)) + } // reset map + testUnmarshalErr(v120v2, bs120, h, t, "dec-map-v120") + testDeepEqualErr(v120v1, v120v2, t, "equal-map-v120") + if v == nil { + v120v2 = nil + } else { + v120v2 = make(map[uint16]int16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v120v2), bs120, h, t, "dec-map-v120-noaddr") // decode into non-addressable map value + testDeepEqualErr(v120v1, v120v2, t, "equal-map-v120-noaddr") + if v == nil { + v120v2 = nil + } else { + v120v2 = make(map[uint16]int16, len(v)) + } // reset map + testUnmarshalErr(&v120v2, bs120, h, t, "dec-map-v120-p-len") + testDeepEqualErr(v120v1, v120v2, t, "equal-map-v120-p-len") + bs120 = testMarshalErr(&v120v1, h, t, "enc-map-v120-p") + v120v2 = nil + testUnmarshalErr(&v120v2, bs120, h, t, "dec-map-v120-p-nil") + testDeepEqualErr(v120v1, v120v2, t, "equal-map-v120-p-nil") + // ... + if v == nil { + v120v2 = nil + } else { + v120v2 = make(map[uint16]int16, len(v)) + } // reset map + var v120v3, v120v4 typMapMapUint16Int16 + v120v3 = typMapMapUint16Int16(v120v1) + v120v4 = typMapMapUint16Int16(v120v2) + bs120 = testMarshalErr(v120v3, h, t, "enc-map-v120-custom") + testUnmarshalErr(v120v4, bs120, h, t, "dec-map-v120-p-len") + testDeepEqualErr(v120v3, v120v4, t, "equal-map-v120-p-len") + } + + for _, v := range []map[uint16]int32{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v121: %v\n", v) + var v121v1, v121v2 map[uint16]int32 + v121v1 = v + bs121 := testMarshalErr(v121v1, h, t, "enc-map-v121") + if v == nil { + v121v2 = nil + } else { + v121v2 = make(map[uint16]int32, len(v)) + } // reset map + testUnmarshalErr(v121v2, bs121, h, t, "dec-map-v121") + testDeepEqualErr(v121v1, v121v2, t, "equal-map-v121") + if v == nil { + v121v2 = nil + } else { + v121v2 = make(map[uint16]int32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v121v2), bs121, h, t, "dec-map-v121-noaddr") // decode into non-addressable map value + testDeepEqualErr(v121v1, v121v2, t, "equal-map-v121-noaddr") + if v == nil { + v121v2 = nil + } else { + v121v2 = make(map[uint16]int32, len(v)) + } // reset map + testUnmarshalErr(&v121v2, bs121, h, t, "dec-map-v121-p-len") + testDeepEqualErr(v121v1, v121v2, t, "equal-map-v121-p-len") + bs121 = testMarshalErr(&v121v1, h, t, "enc-map-v121-p") + v121v2 = nil + testUnmarshalErr(&v121v2, bs121, h, t, "dec-map-v121-p-nil") + testDeepEqualErr(v121v1, v121v2, t, "equal-map-v121-p-nil") + // ... + if v == nil { + v121v2 = nil + } else { + v121v2 = make(map[uint16]int32, len(v)) + } // reset map + var v121v3, v121v4 typMapMapUint16Int32 + v121v3 = typMapMapUint16Int32(v121v1) + v121v4 = typMapMapUint16Int32(v121v2) + bs121 = testMarshalErr(v121v3, h, t, "enc-map-v121-custom") + testUnmarshalErr(v121v4, bs121, h, t, "dec-map-v121-p-len") + testDeepEqualErr(v121v3, v121v4, t, "equal-map-v121-p-len") + } + + for _, v := range []map[uint16]int64{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v122: %v\n", v) + var v122v1, v122v2 map[uint16]int64 + v122v1 = v + bs122 := testMarshalErr(v122v1, h, t, "enc-map-v122") + if v == nil { + v122v2 = nil + } else { + v122v2 = make(map[uint16]int64, len(v)) + } // reset map + testUnmarshalErr(v122v2, bs122, h, t, "dec-map-v122") + testDeepEqualErr(v122v1, v122v2, t, "equal-map-v122") + if v == nil { + v122v2 = nil + } else { + v122v2 = make(map[uint16]int64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v122v2), bs122, h, t, "dec-map-v122-noaddr") // decode into non-addressable map value + testDeepEqualErr(v122v1, v122v2, t, "equal-map-v122-noaddr") + if v == nil { + v122v2 = nil + } else { + v122v2 = make(map[uint16]int64, len(v)) + } // reset map + testUnmarshalErr(&v122v2, bs122, h, t, "dec-map-v122-p-len") + testDeepEqualErr(v122v1, v122v2, t, "equal-map-v122-p-len") + bs122 = testMarshalErr(&v122v1, h, t, "enc-map-v122-p") + v122v2 = nil + testUnmarshalErr(&v122v2, bs122, h, t, "dec-map-v122-p-nil") + testDeepEqualErr(v122v1, v122v2, t, "equal-map-v122-p-nil") + // ... + if v == nil { + v122v2 = nil + } else { + v122v2 = make(map[uint16]int64, len(v)) + } // reset map + var v122v3, v122v4 typMapMapUint16Int64 + v122v3 = typMapMapUint16Int64(v122v1) + v122v4 = typMapMapUint16Int64(v122v2) + bs122 = testMarshalErr(v122v3, h, t, "enc-map-v122-custom") + testUnmarshalErr(v122v4, bs122, h, t, "dec-map-v122-p-len") + testDeepEqualErr(v122v3, v122v4, t, "equal-map-v122-p-len") + } + + for _, v := range []map[uint16]float32{nil, {}, {33: 0, 44: 22.2}} { + // fmt.Printf(">>>> running mammoth map v123: %v\n", v) + var v123v1, v123v2 map[uint16]float32 + v123v1 = v + bs123 := testMarshalErr(v123v1, h, t, "enc-map-v123") + if v == nil { + v123v2 = nil + } else { + v123v2 = make(map[uint16]float32, len(v)) + } // reset map + testUnmarshalErr(v123v2, bs123, h, t, "dec-map-v123") + testDeepEqualErr(v123v1, v123v2, t, "equal-map-v123") + if v == nil { + v123v2 = nil + } else { + v123v2 = make(map[uint16]float32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v123v2), bs123, h, t, "dec-map-v123-noaddr") // decode into non-addressable map value + testDeepEqualErr(v123v1, v123v2, t, "equal-map-v123-noaddr") + if v == nil { + v123v2 = nil + } else { + v123v2 = make(map[uint16]float32, len(v)) + } // reset map + testUnmarshalErr(&v123v2, bs123, h, t, "dec-map-v123-p-len") + testDeepEqualErr(v123v1, v123v2, t, "equal-map-v123-p-len") + bs123 = testMarshalErr(&v123v1, h, t, "enc-map-v123-p") + v123v2 = nil + testUnmarshalErr(&v123v2, bs123, h, t, "dec-map-v123-p-nil") + testDeepEqualErr(v123v1, v123v2, t, "equal-map-v123-p-nil") + // ... + if v == nil { + v123v2 = nil + } else { + v123v2 = make(map[uint16]float32, len(v)) + } // reset map + var v123v3, v123v4 typMapMapUint16Float32 + v123v3 = typMapMapUint16Float32(v123v1) + v123v4 = typMapMapUint16Float32(v123v2) + bs123 = testMarshalErr(v123v3, h, t, "enc-map-v123-custom") + testUnmarshalErr(v123v4, bs123, h, t, "dec-map-v123-p-len") + testDeepEqualErr(v123v3, v123v4, t, "equal-map-v123-p-len") + } + + for _, v := range []map[uint16]float64{nil, {}, {33: 0, 44: 11.1}} { + // fmt.Printf(">>>> running mammoth map v124: %v\n", v) + var v124v1, v124v2 map[uint16]float64 + v124v1 = v + bs124 := testMarshalErr(v124v1, h, t, "enc-map-v124") + if v == nil { + v124v2 = nil + } else { + v124v2 = make(map[uint16]float64, len(v)) + } // reset map + testUnmarshalErr(v124v2, bs124, h, t, "dec-map-v124") + testDeepEqualErr(v124v1, v124v2, t, "equal-map-v124") + if v == nil { + v124v2 = nil + } else { + v124v2 = make(map[uint16]float64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v124v2), bs124, h, t, "dec-map-v124-noaddr") // decode into non-addressable map value + testDeepEqualErr(v124v1, v124v2, t, "equal-map-v124-noaddr") + if v == nil { + v124v2 = nil + } else { + v124v2 = make(map[uint16]float64, len(v)) + } // reset map + testUnmarshalErr(&v124v2, bs124, h, t, "dec-map-v124-p-len") + testDeepEqualErr(v124v1, v124v2, t, "equal-map-v124-p-len") + bs124 = testMarshalErr(&v124v1, h, t, "enc-map-v124-p") + v124v2 = nil + testUnmarshalErr(&v124v2, bs124, h, t, "dec-map-v124-p-nil") + testDeepEqualErr(v124v1, v124v2, t, "equal-map-v124-p-nil") + // ... + if v == nil { + v124v2 = nil + } else { + v124v2 = make(map[uint16]float64, len(v)) + } // reset map + var v124v3, v124v4 typMapMapUint16Float64 + v124v3 = typMapMapUint16Float64(v124v1) + v124v4 = typMapMapUint16Float64(v124v2) + bs124 = testMarshalErr(v124v3, h, t, "enc-map-v124-custom") + testUnmarshalErr(v124v4, bs124, h, t, "dec-map-v124-p-len") + testDeepEqualErr(v124v3, v124v4, t, "equal-map-v124-p-len") + } + + for _, v := range []map[uint16]bool{nil, {}, {33: false, 44: true}} { + // fmt.Printf(">>>> running mammoth map v125: %v\n", v) + var v125v1, v125v2 map[uint16]bool + v125v1 = v + bs125 := testMarshalErr(v125v1, h, t, "enc-map-v125") + if v == nil { + v125v2 = nil + } else { + v125v2 = make(map[uint16]bool, len(v)) + } // reset map + testUnmarshalErr(v125v2, bs125, h, t, "dec-map-v125") + testDeepEqualErr(v125v1, v125v2, t, "equal-map-v125") + if v == nil { + v125v2 = nil + } else { + v125v2 = make(map[uint16]bool, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v125v2), bs125, h, t, "dec-map-v125-noaddr") // decode into non-addressable map value + testDeepEqualErr(v125v1, v125v2, t, "equal-map-v125-noaddr") + if v == nil { + v125v2 = nil + } else { + v125v2 = make(map[uint16]bool, len(v)) + } // reset map + testUnmarshalErr(&v125v2, bs125, h, t, "dec-map-v125-p-len") + testDeepEqualErr(v125v1, v125v2, t, "equal-map-v125-p-len") + bs125 = testMarshalErr(&v125v1, h, t, "enc-map-v125-p") + v125v2 = nil + testUnmarshalErr(&v125v2, bs125, h, t, "dec-map-v125-p-nil") + testDeepEqualErr(v125v1, v125v2, t, "equal-map-v125-p-nil") + // ... + if v == nil { + v125v2 = nil + } else { + v125v2 = make(map[uint16]bool, len(v)) + } // reset map + var v125v3, v125v4 typMapMapUint16Bool + v125v3 = typMapMapUint16Bool(v125v1) + v125v4 = typMapMapUint16Bool(v125v2) + bs125 = testMarshalErr(v125v3, h, t, "enc-map-v125-custom") + testUnmarshalErr(v125v4, bs125, h, t, "dec-map-v125-p-len") + testDeepEqualErr(v125v3, v125v4, t, "equal-map-v125-p-len") + } + + for _, v := range []map[uint32]interface{}{nil, {}, {33: nil, 44: "string-is-an-interface"}} { + // fmt.Printf(">>>> running mammoth map v128: %v\n", v) + var v128v1, v128v2 map[uint32]interface{} + v128v1 = v + bs128 := testMarshalErr(v128v1, h, t, "enc-map-v128") + if v == nil { + v128v2 = nil + } else { + v128v2 = make(map[uint32]interface{}, len(v)) + } // reset map + testUnmarshalErr(v128v2, bs128, h, t, "dec-map-v128") + testDeepEqualErr(v128v1, v128v2, t, "equal-map-v128") + if v == nil { + v128v2 = nil + } else { + v128v2 = make(map[uint32]interface{}, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v128v2), bs128, h, t, "dec-map-v128-noaddr") // decode into non-addressable map value + testDeepEqualErr(v128v1, v128v2, t, "equal-map-v128-noaddr") + if v == nil { + v128v2 = nil + } else { + v128v2 = make(map[uint32]interface{}, len(v)) + } // reset map + testUnmarshalErr(&v128v2, bs128, h, t, "dec-map-v128-p-len") + testDeepEqualErr(v128v1, v128v2, t, "equal-map-v128-p-len") + bs128 = testMarshalErr(&v128v1, h, t, "enc-map-v128-p") + v128v2 = nil + testUnmarshalErr(&v128v2, bs128, h, t, "dec-map-v128-p-nil") + testDeepEqualErr(v128v1, v128v2, t, "equal-map-v128-p-nil") + // ... + if v == nil { + v128v2 = nil + } else { + v128v2 = make(map[uint32]interface{}, len(v)) + } // reset map + var v128v3, v128v4 typMapMapUint32Intf + v128v3 = typMapMapUint32Intf(v128v1) + v128v4 = typMapMapUint32Intf(v128v2) + bs128 = testMarshalErr(v128v3, h, t, "enc-map-v128-custom") + testUnmarshalErr(v128v4, bs128, h, t, "dec-map-v128-p-len") + testDeepEqualErr(v128v3, v128v4, t, "equal-map-v128-p-len") + } + + for _, v := range []map[uint32]string{nil, {}, {33: "", 44: "some-string"}} { + // fmt.Printf(">>>> running mammoth map v129: %v\n", v) + var v129v1, v129v2 map[uint32]string + v129v1 = v + bs129 := testMarshalErr(v129v1, h, t, "enc-map-v129") + if v == nil { + v129v2 = nil + } else { + v129v2 = make(map[uint32]string, len(v)) + } // reset map + testUnmarshalErr(v129v2, bs129, h, t, "dec-map-v129") + testDeepEqualErr(v129v1, v129v2, t, "equal-map-v129") + if v == nil { + v129v2 = nil + } else { + v129v2 = make(map[uint32]string, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v129v2), bs129, h, t, "dec-map-v129-noaddr") // decode into non-addressable map value + testDeepEqualErr(v129v1, v129v2, t, "equal-map-v129-noaddr") + if v == nil { + v129v2 = nil + } else { + v129v2 = make(map[uint32]string, len(v)) + } // reset map + testUnmarshalErr(&v129v2, bs129, h, t, "dec-map-v129-p-len") + testDeepEqualErr(v129v1, v129v2, t, "equal-map-v129-p-len") + bs129 = testMarshalErr(&v129v1, h, t, "enc-map-v129-p") + v129v2 = nil + testUnmarshalErr(&v129v2, bs129, h, t, "dec-map-v129-p-nil") + testDeepEqualErr(v129v1, v129v2, t, "equal-map-v129-p-nil") + // ... + if v == nil { + v129v2 = nil + } else { + v129v2 = make(map[uint32]string, len(v)) + } // reset map + var v129v3, v129v4 typMapMapUint32String + v129v3 = typMapMapUint32String(v129v1) + v129v4 = typMapMapUint32String(v129v2) + bs129 = testMarshalErr(v129v3, h, t, "enc-map-v129-custom") + testUnmarshalErr(v129v4, bs129, h, t, "dec-map-v129-p-len") + testDeepEqualErr(v129v3, v129v4, t, "equal-map-v129-p-len") + } + + for _, v := range []map[uint32]uint{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v130: %v\n", v) + var v130v1, v130v2 map[uint32]uint + v130v1 = v + bs130 := testMarshalErr(v130v1, h, t, "enc-map-v130") + if v == nil { + v130v2 = nil + } else { + v130v2 = make(map[uint32]uint, len(v)) + } // reset map + testUnmarshalErr(v130v2, bs130, h, t, "dec-map-v130") + testDeepEqualErr(v130v1, v130v2, t, "equal-map-v130") + if v == nil { + v130v2 = nil + } else { + v130v2 = make(map[uint32]uint, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v130v2), bs130, h, t, "dec-map-v130-noaddr") // decode into non-addressable map value + testDeepEqualErr(v130v1, v130v2, t, "equal-map-v130-noaddr") + if v == nil { + v130v2 = nil + } else { + v130v2 = make(map[uint32]uint, len(v)) + } // reset map + testUnmarshalErr(&v130v2, bs130, h, t, "dec-map-v130-p-len") + testDeepEqualErr(v130v1, v130v2, t, "equal-map-v130-p-len") + bs130 = testMarshalErr(&v130v1, h, t, "enc-map-v130-p") + v130v2 = nil + testUnmarshalErr(&v130v2, bs130, h, t, "dec-map-v130-p-nil") + testDeepEqualErr(v130v1, v130v2, t, "equal-map-v130-p-nil") + // ... + if v == nil { + v130v2 = nil + } else { + v130v2 = make(map[uint32]uint, len(v)) + } // reset map + var v130v3, v130v4 typMapMapUint32Uint + v130v3 = typMapMapUint32Uint(v130v1) + v130v4 = typMapMapUint32Uint(v130v2) + bs130 = testMarshalErr(v130v3, h, t, "enc-map-v130-custom") + testUnmarshalErr(v130v4, bs130, h, t, "dec-map-v130-p-len") + testDeepEqualErr(v130v3, v130v4, t, "equal-map-v130-p-len") + } + + for _, v := range []map[uint32]uint8{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v131: %v\n", v) + var v131v1, v131v2 map[uint32]uint8 + v131v1 = v + bs131 := testMarshalErr(v131v1, h, t, "enc-map-v131") + if v == nil { + v131v2 = nil + } else { + v131v2 = make(map[uint32]uint8, len(v)) + } // reset map + testUnmarshalErr(v131v2, bs131, h, t, "dec-map-v131") + testDeepEqualErr(v131v1, v131v2, t, "equal-map-v131") + if v == nil { + v131v2 = nil + } else { + v131v2 = make(map[uint32]uint8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v131v2), bs131, h, t, "dec-map-v131-noaddr") // decode into non-addressable map value + testDeepEqualErr(v131v1, v131v2, t, "equal-map-v131-noaddr") + if v == nil { + v131v2 = nil + } else { + v131v2 = make(map[uint32]uint8, len(v)) + } // reset map + testUnmarshalErr(&v131v2, bs131, h, t, "dec-map-v131-p-len") + testDeepEqualErr(v131v1, v131v2, t, "equal-map-v131-p-len") + bs131 = testMarshalErr(&v131v1, h, t, "enc-map-v131-p") + v131v2 = nil + testUnmarshalErr(&v131v2, bs131, h, t, "dec-map-v131-p-nil") + testDeepEqualErr(v131v1, v131v2, t, "equal-map-v131-p-nil") + // ... + if v == nil { + v131v2 = nil + } else { + v131v2 = make(map[uint32]uint8, len(v)) + } // reset map + var v131v3, v131v4 typMapMapUint32Uint8 + v131v3 = typMapMapUint32Uint8(v131v1) + v131v4 = typMapMapUint32Uint8(v131v2) + bs131 = testMarshalErr(v131v3, h, t, "enc-map-v131-custom") + testUnmarshalErr(v131v4, bs131, h, t, "dec-map-v131-p-len") + testDeepEqualErr(v131v3, v131v4, t, "equal-map-v131-p-len") + } + + for _, v := range []map[uint32]uint16{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v132: %v\n", v) + var v132v1, v132v2 map[uint32]uint16 + v132v1 = v + bs132 := testMarshalErr(v132v1, h, t, "enc-map-v132") + if v == nil { + v132v2 = nil + } else { + v132v2 = make(map[uint32]uint16, len(v)) + } // reset map + testUnmarshalErr(v132v2, bs132, h, t, "dec-map-v132") + testDeepEqualErr(v132v1, v132v2, t, "equal-map-v132") + if v == nil { + v132v2 = nil + } else { + v132v2 = make(map[uint32]uint16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v132v2), bs132, h, t, "dec-map-v132-noaddr") // decode into non-addressable map value + testDeepEqualErr(v132v1, v132v2, t, "equal-map-v132-noaddr") + if v == nil { + v132v2 = nil + } else { + v132v2 = make(map[uint32]uint16, len(v)) + } // reset map + testUnmarshalErr(&v132v2, bs132, h, t, "dec-map-v132-p-len") + testDeepEqualErr(v132v1, v132v2, t, "equal-map-v132-p-len") + bs132 = testMarshalErr(&v132v1, h, t, "enc-map-v132-p") + v132v2 = nil + testUnmarshalErr(&v132v2, bs132, h, t, "dec-map-v132-p-nil") + testDeepEqualErr(v132v1, v132v2, t, "equal-map-v132-p-nil") + // ... + if v == nil { + v132v2 = nil + } else { + v132v2 = make(map[uint32]uint16, len(v)) + } // reset map + var v132v3, v132v4 typMapMapUint32Uint16 + v132v3 = typMapMapUint32Uint16(v132v1) + v132v4 = typMapMapUint32Uint16(v132v2) + bs132 = testMarshalErr(v132v3, h, t, "enc-map-v132-custom") + testUnmarshalErr(v132v4, bs132, h, t, "dec-map-v132-p-len") + testDeepEqualErr(v132v3, v132v4, t, "equal-map-v132-p-len") + } + + for _, v := range []map[uint32]uint32{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v133: %v\n", v) + var v133v1, v133v2 map[uint32]uint32 + v133v1 = v + bs133 := testMarshalErr(v133v1, h, t, "enc-map-v133") + if v == nil { + v133v2 = nil + } else { + v133v2 = make(map[uint32]uint32, len(v)) + } // reset map + testUnmarshalErr(v133v2, bs133, h, t, "dec-map-v133") + testDeepEqualErr(v133v1, v133v2, t, "equal-map-v133") + if v == nil { + v133v2 = nil + } else { + v133v2 = make(map[uint32]uint32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v133v2), bs133, h, t, "dec-map-v133-noaddr") // decode into non-addressable map value + testDeepEqualErr(v133v1, v133v2, t, "equal-map-v133-noaddr") + if v == nil { + v133v2 = nil + } else { + v133v2 = make(map[uint32]uint32, len(v)) + } // reset map + testUnmarshalErr(&v133v2, bs133, h, t, "dec-map-v133-p-len") + testDeepEqualErr(v133v1, v133v2, t, "equal-map-v133-p-len") + bs133 = testMarshalErr(&v133v1, h, t, "enc-map-v133-p") + v133v2 = nil + testUnmarshalErr(&v133v2, bs133, h, t, "dec-map-v133-p-nil") + testDeepEqualErr(v133v1, v133v2, t, "equal-map-v133-p-nil") + // ... + if v == nil { + v133v2 = nil + } else { + v133v2 = make(map[uint32]uint32, len(v)) + } // reset map + var v133v3, v133v4 typMapMapUint32Uint32 + v133v3 = typMapMapUint32Uint32(v133v1) + v133v4 = typMapMapUint32Uint32(v133v2) + bs133 = testMarshalErr(v133v3, h, t, "enc-map-v133-custom") + testUnmarshalErr(v133v4, bs133, h, t, "dec-map-v133-p-len") + testDeepEqualErr(v133v3, v133v4, t, "equal-map-v133-p-len") + } + + for _, v := range []map[uint32]uint64{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v134: %v\n", v) + var v134v1, v134v2 map[uint32]uint64 + v134v1 = v + bs134 := testMarshalErr(v134v1, h, t, "enc-map-v134") + if v == nil { + v134v2 = nil + } else { + v134v2 = make(map[uint32]uint64, len(v)) + } // reset map + testUnmarshalErr(v134v2, bs134, h, t, "dec-map-v134") + testDeepEqualErr(v134v1, v134v2, t, "equal-map-v134") + if v == nil { + v134v2 = nil + } else { + v134v2 = make(map[uint32]uint64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v134v2), bs134, h, t, "dec-map-v134-noaddr") // decode into non-addressable map value + testDeepEqualErr(v134v1, v134v2, t, "equal-map-v134-noaddr") + if v == nil { + v134v2 = nil + } else { + v134v2 = make(map[uint32]uint64, len(v)) + } // reset map + testUnmarshalErr(&v134v2, bs134, h, t, "dec-map-v134-p-len") + testDeepEqualErr(v134v1, v134v2, t, "equal-map-v134-p-len") + bs134 = testMarshalErr(&v134v1, h, t, "enc-map-v134-p") + v134v2 = nil + testUnmarshalErr(&v134v2, bs134, h, t, "dec-map-v134-p-nil") + testDeepEqualErr(v134v1, v134v2, t, "equal-map-v134-p-nil") + // ... + if v == nil { + v134v2 = nil + } else { + v134v2 = make(map[uint32]uint64, len(v)) + } // reset map + var v134v3, v134v4 typMapMapUint32Uint64 + v134v3 = typMapMapUint32Uint64(v134v1) + v134v4 = typMapMapUint32Uint64(v134v2) + bs134 = testMarshalErr(v134v3, h, t, "enc-map-v134-custom") + testUnmarshalErr(v134v4, bs134, h, t, "dec-map-v134-p-len") + testDeepEqualErr(v134v3, v134v4, t, "equal-map-v134-p-len") + } + + for _, v := range []map[uint32]uintptr{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v135: %v\n", v) + var v135v1, v135v2 map[uint32]uintptr + v135v1 = v + bs135 := testMarshalErr(v135v1, h, t, "enc-map-v135") + if v == nil { + v135v2 = nil + } else { + v135v2 = make(map[uint32]uintptr, len(v)) + } // reset map + testUnmarshalErr(v135v2, bs135, h, t, "dec-map-v135") + testDeepEqualErr(v135v1, v135v2, t, "equal-map-v135") + if v == nil { + v135v2 = nil + } else { + v135v2 = make(map[uint32]uintptr, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v135v2), bs135, h, t, "dec-map-v135-noaddr") // decode into non-addressable map value + testDeepEqualErr(v135v1, v135v2, t, "equal-map-v135-noaddr") + if v == nil { + v135v2 = nil + } else { + v135v2 = make(map[uint32]uintptr, len(v)) + } // reset map + testUnmarshalErr(&v135v2, bs135, h, t, "dec-map-v135-p-len") + testDeepEqualErr(v135v1, v135v2, t, "equal-map-v135-p-len") + bs135 = testMarshalErr(&v135v1, h, t, "enc-map-v135-p") + v135v2 = nil + testUnmarshalErr(&v135v2, bs135, h, t, "dec-map-v135-p-nil") + testDeepEqualErr(v135v1, v135v2, t, "equal-map-v135-p-nil") + // ... + if v == nil { + v135v2 = nil + } else { + v135v2 = make(map[uint32]uintptr, len(v)) + } // reset map + var v135v3, v135v4 typMapMapUint32Uintptr + v135v3 = typMapMapUint32Uintptr(v135v1) + v135v4 = typMapMapUint32Uintptr(v135v2) + bs135 = testMarshalErr(v135v3, h, t, "enc-map-v135-custom") + testUnmarshalErr(v135v4, bs135, h, t, "dec-map-v135-p-len") + testDeepEqualErr(v135v3, v135v4, t, "equal-map-v135-p-len") + } + + for _, v := range []map[uint32]int{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v136: %v\n", v) + var v136v1, v136v2 map[uint32]int + v136v1 = v + bs136 := testMarshalErr(v136v1, h, t, "enc-map-v136") + if v == nil { + v136v2 = nil + } else { + v136v2 = make(map[uint32]int, len(v)) + } // reset map + testUnmarshalErr(v136v2, bs136, h, t, "dec-map-v136") + testDeepEqualErr(v136v1, v136v2, t, "equal-map-v136") + if v == nil { + v136v2 = nil + } else { + v136v2 = make(map[uint32]int, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v136v2), bs136, h, t, "dec-map-v136-noaddr") // decode into non-addressable map value + testDeepEqualErr(v136v1, v136v2, t, "equal-map-v136-noaddr") + if v == nil { + v136v2 = nil + } else { + v136v2 = make(map[uint32]int, len(v)) + } // reset map + testUnmarshalErr(&v136v2, bs136, h, t, "dec-map-v136-p-len") + testDeepEqualErr(v136v1, v136v2, t, "equal-map-v136-p-len") + bs136 = testMarshalErr(&v136v1, h, t, "enc-map-v136-p") + v136v2 = nil + testUnmarshalErr(&v136v2, bs136, h, t, "dec-map-v136-p-nil") + testDeepEqualErr(v136v1, v136v2, t, "equal-map-v136-p-nil") + // ... + if v == nil { + v136v2 = nil + } else { + v136v2 = make(map[uint32]int, len(v)) + } // reset map + var v136v3, v136v4 typMapMapUint32Int + v136v3 = typMapMapUint32Int(v136v1) + v136v4 = typMapMapUint32Int(v136v2) + bs136 = testMarshalErr(v136v3, h, t, "enc-map-v136-custom") + testUnmarshalErr(v136v4, bs136, h, t, "dec-map-v136-p-len") + testDeepEqualErr(v136v3, v136v4, t, "equal-map-v136-p-len") + } + + for _, v := range []map[uint32]int8{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v137: %v\n", v) + var v137v1, v137v2 map[uint32]int8 + v137v1 = v + bs137 := testMarshalErr(v137v1, h, t, "enc-map-v137") + if v == nil { + v137v2 = nil + } else { + v137v2 = make(map[uint32]int8, len(v)) + } // reset map + testUnmarshalErr(v137v2, bs137, h, t, "dec-map-v137") + testDeepEqualErr(v137v1, v137v2, t, "equal-map-v137") + if v == nil { + v137v2 = nil + } else { + v137v2 = make(map[uint32]int8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v137v2), bs137, h, t, "dec-map-v137-noaddr") // decode into non-addressable map value + testDeepEqualErr(v137v1, v137v2, t, "equal-map-v137-noaddr") + if v == nil { + v137v2 = nil + } else { + v137v2 = make(map[uint32]int8, len(v)) + } // reset map + testUnmarshalErr(&v137v2, bs137, h, t, "dec-map-v137-p-len") + testDeepEqualErr(v137v1, v137v2, t, "equal-map-v137-p-len") + bs137 = testMarshalErr(&v137v1, h, t, "enc-map-v137-p") + v137v2 = nil + testUnmarshalErr(&v137v2, bs137, h, t, "dec-map-v137-p-nil") + testDeepEqualErr(v137v1, v137v2, t, "equal-map-v137-p-nil") + // ... + if v == nil { + v137v2 = nil + } else { + v137v2 = make(map[uint32]int8, len(v)) + } // reset map + var v137v3, v137v4 typMapMapUint32Int8 + v137v3 = typMapMapUint32Int8(v137v1) + v137v4 = typMapMapUint32Int8(v137v2) + bs137 = testMarshalErr(v137v3, h, t, "enc-map-v137-custom") + testUnmarshalErr(v137v4, bs137, h, t, "dec-map-v137-p-len") + testDeepEqualErr(v137v3, v137v4, t, "equal-map-v137-p-len") + } + + for _, v := range []map[uint32]int16{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v138: %v\n", v) + var v138v1, v138v2 map[uint32]int16 + v138v1 = v + bs138 := testMarshalErr(v138v1, h, t, "enc-map-v138") + if v == nil { + v138v2 = nil + } else { + v138v2 = make(map[uint32]int16, len(v)) + } // reset map + testUnmarshalErr(v138v2, bs138, h, t, "dec-map-v138") + testDeepEqualErr(v138v1, v138v2, t, "equal-map-v138") + if v == nil { + v138v2 = nil + } else { + v138v2 = make(map[uint32]int16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v138v2), bs138, h, t, "dec-map-v138-noaddr") // decode into non-addressable map value + testDeepEqualErr(v138v1, v138v2, t, "equal-map-v138-noaddr") + if v == nil { + v138v2 = nil + } else { + v138v2 = make(map[uint32]int16, len(v)) + } // reset map + testUnmarshalErr(&v138v2, bs138, h, t, "dec-map-v138-p-len") + testDeepEqualErr(v138v1, v138v2, t, "equal-map-v138-p-len") + bs138 = testMarshalErr(&v138v1, h, t, "enc-map-v138-p") + v138v2 = nil + testUnmarshalErr(&v138v2, bs138, h, t, "dec-map-v138-p-nil") + testDeepEqualErr(v138v1, v138v2, t, "equal-map-v138-p-nil") + // ... + if v == nil { + v138v2 = nil + } else { + v138v2 = make(map[uint32]int16, len(v)) + } // reset map + var v138v3, v138v4 typMapMapUint32Int16 + v138v3 = typMapMapUint32Int16(v138v1) + v138v4 = typMapMapUint32Int16(v138v2) + bs138 = testMarshalErr(v138v3, h, t, "enc-map-v138-custom") + testUnmarshalErr(v138v4, bs138, h, t, "dec-map-v138-p-len") + testDeepEqualErr(v138v3, v138v4, t, "equal-map-v138-p-len") + } + + for _, v := range []map[uint32]int32{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v139: %v\n", v) + var v139v1, v139v2 map[uint32]int32 + v139v1 = v + bs139 := testMarshalErr(v139v1, h, t, "enc-map-v139") + if v == nil { + v139v2 = nil + } else { + v139v2 = make(map[uint32]int32, len(v)) + } // reset map + testUnmarshalErr(v139v2, bs139, h, t, "dec-map-v139") + testDeepEqualErr(v139v1, v139v2, t, "equal-map-v139") + if v == nil { + v139v2 = nil + } else { + v139v2 = make(map[uint32]int32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v139v2), bs139, h, t, "dec-map-v139-noaddr") // decode into non-addressable map value + testDeepEqualErr(v139v1, v139v2, t, "equal-map-v139-noaddr") + if v == nil { + v139v2 = nil + } else { + v139v2 = make(map[uint32]int32, len(v)) + } // reset map + testUnmarshalErr(&v139v2, bs139, h, t, "dec-map-v139-p-len") + testDeepEqualErr(v139v1, v139v2, t, "equal-map-v139-p-len") + bs139 = testMarshalErr(&v139v1, h, t, "enc-map-v139-p") + v139v2 = nil + testUnmarshalErr(&v139v2, bs139, h, t, "dec-map-v139-p-nil") + testDeepEqualErr(v139v1, v139v2, t, "equal-map-v139-p-nil") + // ... + if v == nil { + v139v2 = nil + } else { + v139v2 = make(map[uint32]int32, len(v)) + } // reset map + var v139v3, v139v4 typMapMapUint32Int32 + v139v3 = typMapMapUint32Int32(v139v1) + v139v4 = typMapMapUint32Int32(v139v2) + bs139 = testMarshalErr(v139v3, h, t, "enc-map-v139-custom") + testUnmarshalErr(v139v4, bs139, h, t, "dec-map-v139-p-len") + testDeepEqualErr(v139v3, v139v4, t, "equal-map-v139-p-len") + } + + for _, v := range []map[uint32]int64{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v140: %v\n", v) + var v140v1, v140v2 map[uint32]int64 + v140v1 = v + bs140 := testMarshalErr(v140v1, h, t, "enc-map-v140") + if v == nil { + v140v2 = nil + } else { + v140v2 = make(map[uint32]int64, len(v)) + } // reset map + testUnmarshalErr(v140v2, bs140, h, t, "dec-map-v140") + testDeepEqualErr(v140v1, v140v2, t, "equal-map-v140") + if v == nil { + v140v2 = nil + } else { + v140v2 = make(map[uint32]int64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v140v2), bs140, h, t, "dec-map-v140-noaddr") // decode into non-addressable map value + testDeepEqualErr(v140v1, v140v2, t, "equal-map-v140-noaddr") + if v == nil { + v140v2 = nil + } else { + v140v2 = make(map[uint32]int64, len(v)) + } // reset map + testUnmarshalErr(&v140v2, bs140, h, t, "dec-map-v140-p-len") + testDeepEqualErr(v140v1, v140v2, t, "equal-map-v140-p-len") + bs140 = testMarshalErr(&v140v1, h, t, "enc-map-v140-p") + v140v2 = nil + testUnmarshalErr(&v140v2, bs140, h, t, "dec-map-v140-p-nil") + testDeepEqualErr(v140v1, v140v2, t, "equal-map-v140-p-nil") + // ... + if v == nil { + v140v2 = nil + } else { + v140v2 = make(map[uint32]int64, len(v)) + } // reset map + var v140v3, v140v4 typMapMapUint32Int64 + v140v3 = typMapMapUint32Int64(v140v1) + v140v4 = typMapMapUint32Int64(v140v2) + bs140 = testMarshalErr(v140v3, h, t, "enc-map-v140-custom") + testUnmarshalErr(v140v4, bs140, h, t, "dec-map-v140-p-len") + testDeepEqualErr(v140v3, v140v4, t, "equal-map-v140-p-len") + } + + for _, v := range []map[uint32]float32{nil, {}, {44: 0, 33: 22.2}} { + // fmt.Printf(">>>> running mammoth map v141: %v\n", v) + var v141v1, v141v2 map[uint32]float32 + v141v1 = v + bs141 := testMarshalErr(v141v1, h, t, "enc-map-v141") + if v == nil { + v141v2 = nil + } else { + v141v2 = make(map[uint32]float32, len(v)) + } // reset map + testUnmarshalErr(v141v2, bs141, h, t, "dec-map-v141") + testDeepEqualErr(v141v1, v141v2, t, "equal-map-v141") + if v == nil { + v141v2 = nil + } else { + v141v2 = make(map[uint32]float32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v141v2), bs141, h, t, "dec-map-v141-noaddr") // decode into non-addressable map value + testDeepEqualErr(v141v1, v141v2, t, "equal-map-v141-noaddr") + if v == nil { + v141v2 = nil + } else { + v141v2 = make(map[uint32]float32, len(v)) + } // reset map + testUnmarshalErr(&v141v2, bs141, h, t, "dec-map-v141-p-len") + testDeepEqualErr(v141v1, v141v2, t, "equal-map-v141-p-len") + bs141 = testMarshalErr(&v141v1, h, t, "enc-map-v141-p") + v141v2 = nil + testUnmarshalErr(&v141v2, bs141, h, t, "dec-map-v141-p-nil") + testDeepEqualErr(v141v1, v141v2, t, "equal-map-v141-p-nil") + // ... + if v == nil { + v141v2 = nil + } else { + v141v2 = make(map[uint32]float32, len(v)) + } // reset map + var v141v3, v141v4 typMapMapUint32Float32 + v141v3 = typMapMapUint32Float32(v141v1) + v141v4 = typMapMapUint32Float32(v141v2) + bs141 = testMarshalErr(v141v3, h, t, "enc-map-v141-custom") + testUnmarshalErr(v141v4, bs141, h, t, "dec-map-v141-p-len") + testDeepEqualErr(v141v3, v141v4, t, "equal-map-v141-p-len") + } + + for _, v := range []map[uint32]float64{nil, {}, {44: 0, 33: 11.1}} { + // fmt.Printf(">>>> running mammoth map v142: %v\n", v) + var v142v1, v142v2 map[uint32]float64 + v142v1 = v + bs142 := testMarshalErr(v142v1, h, t, "enc-map-v142") + if v == nil { + v142v2 = nil + } else { + v142v2 = make(map[uint32]float64, len(v)) + } // reset map + testUnmarshalErr(v142v2, bs142, h, t, "dec-map-v142") + testDeepEqualErr(v142v1, v142v2, t, "equal-map-v142") + if v == nil { + v142v2 = nil + } else { + v142v2 = make(map[uint32]float64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v142v2), bs142, h, t, "dec-map-v142-noaddr") // decode into non-addressable map value + testDeepEqualErr(v142v1, v142v2, t, "equal-map-v142-noaddr") + if v == nil { + v142v2 = nil + } else { + v142v2 = make(map[uint32]float64, len(v)) + } // reset map + testUnmarshalErr(&v142v2, bs142, h, t, "dec-map-v142-p-len") + testDeepEqualErr(v142v1, v142v2, t, "equal-map-v142-p-len") + bs142 = testMarshalErr(&v142v1, h, t, "enc-map-v142-p") + v142v2 = nil + testUnmarshalErr(&v142v2, bs142, h, t, "dec-map-v142-p-nil") + testDeepEqualErr(v142v1, v142v2, t, "equal-map-v142-p-nil") + // ... + if v == nil { + v142v2 = nil + } else { + v142v2 = make(map[uint32]float64, len(v)) + } // reset map + var v142v3, v142v4 typMapMapUint32Float64 + v142v3 = typMapMapUint32Float64(v142v1) + v142v4 = typMapMapUint32Float64(v142v2) + bs142 = testMarshalErr(v142v3, h, t, "enc-map-v142-custom") + testUnmarshalErr(v142v4, bs142, h, t, "dec-map-v142-p-len") + testDeepEqualErr(v142v3, v142v4, t, "equal-map-v142-p-len") + } + + for _, v := range []map[uint32]bool{nil, {}, {44: false, 33: true}} { + // fmt.Printf(">>>> running mammoth map v143: %v\n", v) + var v143v1, v143v2 map[uint32]bool + v143v1 = v + bs143 := testMarshalErr(v143v1, h, t, "enc-map-v143") + if v == nil { + v143v2 = nil + } else { + v143v2 = make(map[uint32]bool, len(v)) + } // reset map + testUnmarshalErr(v143v2, bs143, h, t, "dec-map-v143") + testDeepEqualErr(v143v1, v143v2, t, "equal-map-v143") + if v == nil { + v143v2 = nil + } else { + v143v2 = make(map[uint32]bool, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v143v2), bs143, h, t, "dec-map-v143-noaddr") // decode into non-addressable map value + testDeepEqualErr(v143v1, v143v2, t, "equal-map-v143-noaddr") + if v == nil { + v143v2 = nil + } else { + v143v2 = make(map[uint32]bool, len(v)) + } // reset map + testUnmarshalErr(&v143v2, bs143, h, t, "dec-map-v143-p-len") + testDeepEqualErr(v143v1, v143v2, t, "equal-map-v143-p-len") + bs143 = testMarshalErr(&v143v1, h, t, "enc-map-v143-p") + v143v2 = nil + testUnmarshalErr(&v143v2, bs143, h, t, "dec-map-v143-p-nil") + testDeepEqualErr(v143v1, v143v2, t, "equal-map-v143-p-nil") + // ... + if v == nil { + v143v2 = nil + } else { + v143v2 = make(map[uint32]bool, len(v)) + } // reset map + var v143v3, v143v4 typMapMapUint32Bool + v143v3 = typMapMapUint32Bool(v143v1) + v143v4 = typMapMapUint32Bool(v143v2) + bs143 = testMarshalErr(v143v3, h, t, "enc-map-v143-custom") + testUnmarshalErr(v143v4, bs143, h, t, "dec-map-v143-p-len") + testDeepEqualErr(v143v3, v143v4, t, "equal-map-v143-p-len") + } + + for _, v := range []map[uint64]interface{}{nil, {}, {44: nil, 33: "string-is-an-interface-2"}} { + // fmt.Printf(">>>> running mammoth map v146: %v\n", v) + var v146v1, v146v2 map[uint64]interface{} + v146v1 = v + bs146 := testMarshalErr(v146v1, h, t, "enc-map-v146") + if v == nil { + v146v2 = nil + } else { + v146v2 = make(map[uint64]interface{}, len(v)) + } // reset map + testUnmarshalErr(v146v2, bs146, h, t, "dec-map-v146") + testDeepEqualErr(v146v1, v146v2, t, "equal-map-v146") + if v == nil { + v146v2 = nil + } else { + v146v2 = make(map[uint64]interface{}, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v146v2), bs146, h, t, "dec-map-v146-noaddr") // decode into non-addressable map value + testDeepEqualErr(v146v1, v146v2, t, "equal-map-v146-noaddr") + if v == nil { + v146v2 = nil + } else { + v146v2 = make(map[uint64]interface{}, len(v)) + } // reset map + testUnmarshalErr(&v146v2, bs146, h, t, "dec-map-v146-p-len") + testDeepEqualErr(v146v1, v146v2, t, "equal-map-v146-p-len") + bs146 = testMarshalErr(&v146v1, h, t, "enc-map-v146-p") + v146v2 = nil + testUnmarshalErr(&v146v2, bs146, h, t, "dec-map-v146-p-nil") + testDeepEqualErr(v146v1, v146v2, t, "equal-map-v146-p-nil") + // ... + if v == nil { + v146v2 = nil + } else { + v146v2 = make(map[uint64]interface{}, len(v)) + } // reset map + var v146v3, v146v4 typMapMapUint64Intf + v146v3 = typMapMapUint64Intf(v146v1) + v146v4 = typMapMapUint64Intf(v146v2) + bs146 = testMarshalErr(v146v3, h, t, "enc-map-v146-custom") + testUnmarshalErr(v146v4, bs146, h, t, "dec-map-v146-p-len") + testDeepEqualErr(v146v3, v146v4, t, "equal-map-v146-p-len") + } + + for _, v := range []map[uint64]string{nil, {}, {44: "", 33: "some-string-2"}} { + // fmt.Printf(">>>> running mammoth map v147: %v\n", v) + var v147v1, v147v2 map[uint64]string + v147v1 = v + bs147 := testMarshalErr(v147v1, h, t, "enc-map-v147") + if v == nil { + v147v2 = nil + } else { + v147v2 = make(map[uint64]string, len(v)) + } // reset map + testUnmarshalErr(v147v2, bs147, h, t, "dec-map-v147") + testDeepEqualErr(v147v1, v147v2, t, "equal-map-v147") + if v == nil { + v147v2 = nil + } else { + v147v2 = make(map[uint64]string, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v147v2), bs147, h, t, "dec-map-v147-noaddr") // decode into non-addressable map value + testDeepEqualErr(v147v1, v147v2, t, "equal-map-v147-noaddr") + if v == nil { + v147v2 = nil + } else { + v147v2 = make(map[uint64]string, len(v)) + } // reset map + testUnmarshalErr(&v147v2, bs147, h, t, "dec-map-v147-p-len") + testDeepEqualErr(v147v1, v147v2, t, "equal-map-v147-p-len") + bs147 = testMarshalErr(&v147v1, h, t, "enc-map-v147-p") + v147v2 = nil + testUnmarshalErr(&v147v2, bs147, h, t, "dec-map-v147-p-nil") + testDeepEqualErr(v147v1, v147v2, t, "equal-map-v147-p-nil") + // ... + if v == nil { + v147v2 = nil + } else { + v147v2 = make(map[uint64]string, len(v)) + } // reset map + var v147v3, v147v4 typMapMapUint64String + v147v3 = typMapMapUint64String(v147v1) + v147v4 = typMapMapUint64String(v147v2) + bs147 = testMarshalErr(v147v3, h, t, "enc-map-v147-custom") + testUnmarshalErr(v147v4, bs147, h, t, "dec-map-v147-p-len") + testDeepEqualErr(v147v3, v147v4, t, "equal-map-v147-p-len") + } + + for _, v := range []map[uint64]uint{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v148: %v\n", v) + var v148v1, v148v2 map[uint64]uint + v148v1 = v + bs148 := testMarshalErr(v148v1, h, t, "enc-map-v148") + if v == nil { + v148v2 = nil + } else { + v148v2 = make(map[uint64]uint, len(v)) + } // reset map + testUnmarshalErr(v148v2, bs148, h, t, "dec-map-v148") + testDeepEqualErr(v148v1, v148v2, t, "equal-map-v148") + if v == nil { + v148v2 = nil + } else { + v148v2 = make(map[uint64]uint, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v148v2), bs148, h, t, "dec-map-v148-noaddr") // decode into non-addressable map value + testDeepEqualErr(v148v1, v148v2, t, "equal-map-v148-noaddr") + if v == nil { + v148v2 = nil + } else { + v148v2 = make(map[uint64]uint, len(v)) + } // reset map + testUnmarshalErr(&v148v2, bs148, h, t, "dec-map-v148-p-len") + testDeepEqualErr(v148v1, v148v2, t, "equal-map-v148-p-len") + bs148 = testMarshalErr(&v148v1, h, t, "enc-map-v148-p") + v148v2 = nil + testUnmarshalErr(&v148v2, bs148, h, t, "dec-map-v148-p-nil") + testDeepEqualErr(v148v1, v148v2, t, "equal-map-v148-p-nil") + // ... + if v == nil { + v148v2 = nil + } else { + v148v2 = make(map[uint64]uint, len(v)) + } // reset map + var v148v3, v148v4 typMapMapUint64Uint + v148v3 = typMapMapUint64Uint(v148v1) + v148v4 = typMapMapUint64Uint(v148v2) + bs148 = testMarshalErr(v148v3, h, t, "enc-map-v148-custom") + testUnmarshalErr(v148v4, bs148, h, t, "dec-map-v148-p-len") + testDeepEqualErr(v148v3, v148v4, t, "equal-map-v148-p-len") + } + + for _, v := range []map[uint64]uint8{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v149: %v\n", v) + var v149v1, v149v2 map[uint64]uint8 + v149v1 = v + bs149 := testMarshalErr(v149v1, h, t, "enc-map-v149") + if v == nil { + v149v2 = nil + } else { + v149v2 = make(map[uint64]uint8, len(v)) + } // reset map + testUnmarshalErr(v149v2, bs149, h, t, "dec-map-v149") + testDeepEqualErr(v149v1, v149v2, t, "equal-map-v149") + if v == nil { + v149v2 = nil + } else { + v149v2 = make(map[uint64]uint8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v149v2), bs149, h, t, "dec-map-v149-noaddr") // decode into non-addressable map value + testDeepEqualErr(v149v1, v149v2, t, "equal-map-v149-noaddr") + if v == nil { + v149v2 = nil + } else { + v149v2 = make(map[uint64]uint8, len(v)) + } // reset map + testUnmarshalErr(&v149v2, bs149, h, t, "dec-map-v149-p-len") + testDeepEqualErr(v149v1, v149v2, t, "equal-map-v149-p-len") + bs149 = testMarshalErr(&v149v1, h, t, "enc-map-v149-p") + v149v2 = nil + testUnmarshalErr(&v149v2, bs149, h, t, "dec-map-v149-p-nil") + testDeepEqualErr(v149v1, v149v2, t, "equal-map-v149-p-nil") + // ... + if v == nil { + v149v2 = nil + } else { + v149v2 = make(map[uint64]uint8, len(v)) + } // reset map + var v149v3, v149v4 typMapMapUint64Uint8 + v149v3 = typMapMapUint64Uint8(v149v1) + v149v4 = typMapMapUint64Uint8(v149v2) + bs149 = testMarshalErr(v149v3, h, t, "enc-map-v149-custom") + testUnmarshalErr(v149v4, bs149, h, t, "dec-map-v149-p-len") + testDeepEqualErr(v149v3, v149v4, t, "equal-map-v149-p-len") + } + + for _, v := range []map[uint64]uint16{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v150: %v\n", v) + var v150v1, v150v2 map[uint64]uint16 + v150v1 = v + bs150 := testMarshalErr(v150v1, h, t, "enc-map-v150") + if v == nil { + v150v2 = nil + } else { + v150v2 = make(map[uint64]uint16, len(v)) + } // reset map + testUnmarshalErr(v150v2, bs150, h, t, "dec-map-v150") + testDeepEqualErr(v150v1, v150v2, t, "equal-map-v150") + if v == nil { + v150v2 = nil + } else { + v150v2 = make(map[uint64]uint16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v150v2), bs150, h, t, "dec-map-v150-noaddr") // decode into non-addressable map value + testDeepEqualErr(v150v1, v150v2, t, "equal-map-v150-noaddr") + if v == nil { + v150v2 = nil + } else { + v150v2 = make(map[uint64]uint16, len(v)) + } // reset map + testUnmarshalErr(&v150v2, bs150, h, t, "dec-map-v150-p-len") + testDeepEqualErr(v150v1, v150v2, t, "equal-map-v150-p-len") + bs150 = testMarshalErr(&v150v1, h, t, "enc-map-v150-p") + v150v2 = nil + testUnmarshalErr(&v150v2, bs150, h, t, "dec-map-v150-p-nil") + testDeepEqualErr(v150v1, v150v2, t, "equal-map-v150-p-nil") + // ... + if v == nil { + v150v2 = nil + } else { + v150v2 = make(map[uint64]uint16, len(v)) + } // reset map + var v150v3, v150v4 typMapMapUint64Uint16 + v150v3 = typMapMapUint64Uint16(v150v1) + v150v4 = typMapMapUint64Uint16(v150v2) + bs150 = testMarshalErr(v150v3, h, t, "enc-map-v150-custom") + testUnmarshalErr(v150v4, bs150, h, t, "dec-map-v150-p-len") + testDeepEqualErr(v150v3, v150v4, t, "equal-map-v150-p-len") + } + + for _, v := range []map[uint64]uint32{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v151: %v\n", v) + var v151v1, v151v2 map[uint64]uint32 + v151v1 = v + bs151 := testMarshalErr(v151v1, h, t, "enc-map-v151") + if v == nil { + v151v2 = nil + } else { + v151v2 = make(map[uint64]uint32, len(v)) + } // reset map + testUnmarshalErr(v151v2, bs151, h, t, "dec-map-v151") + testDeepEqualErr(v151v1, v151v2, t, "equal-map-v151") + if v == nil { + v151v2 = nil + } else { + v151v2 = make(map[uint64]uint32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v151v2), bs151, h, t, "dec-map-v151-noaddr") // decode into non-addressable map value + testDeepEqualErr(v151v1, v151v2, t, "equal-map-v151-noaddr") + if v == nil { + v151v2 = nil + } else { + v151v2 = make(map[uint64]uint32, len(v)) + } // reset map + testUnmarshalErr(&v151v2, bs151, h, t, "dec-map-v151-p-len") + testDeepEqualErr(v151v1, v151v2, t, "equal-map-v151-p-len") + bs151 = testMarshalErr(&v151v1, h, t, "enc-map-v151-p") + v151v2 = nil + testUnmarshalErr(&v151v2, bs151, h, t, "dec-map-v151-p-nil") + testDeepEqualErr(v151v1, v151v2, t, "equal-map-v151-p-nil") + // ... + if v == nil { + v151v2 = nil + } else { + v151v2 = make(map[uint64]uint32, len(v)) + } // reset map + var v151v3, v151v4 typMapMapUint64Uint32 + v151v3 = typMapMapUint64Uint32(v151v1) + v151v4 = typMapMapUint64Uint32(v151v2) + bs151 = testMarshalErr(v151v3, h, t, "enc-map-v151-custom") + testUnmarshalErr(v151v4, bs151, h, t, "dec-map-v151-p-len") + testDeepEqualErr(v151v3, v151v4, t, "equal-map-v151-p-len") + } + + for _, v := range []map[uint64]uint64{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v152: %v\n", v) + var v152v1, v152v2 map[uint64]uint64 + v152v1 = v + bs152 := testMarshalErr(v152v1, h, t, "enc-map-v152") + if v == nil { + v152v2 = nil + } else { + v152v2 = make(map[uint64]uint64, len(v)) + } // reset map + testUnmarshalErr(v152v2, bs152, h, t, "dec-map-v152") + testDeepEqualErr(v152v1, v152v2, t, "equal-map-v152") + if v == nil { + v152v2 = nil + } else { + v152v2 = make(map[uint64]uint64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v152v2), bs152, h, t, "dec-map-v152-noaddr") // decode into non-addressable map value + testDeepEqualErr(v152v1, v152v2, t, "equal-map-v152-noaddr") + if v == nil { + v152v2 = nil + } else { + v152v2 = make(map[uint64]uint64, len(v)) + } // reset map + testUnmarshalErr(&v152v2, bs152, h, t, "dec-map-v152-p-len") + testDeepEqualErr(v152v1, v152v2, t, "equal-map-v152-p-len") + bs152 = testMarshalErr(&v152v1, h, t, "enc-map-v152-p") + v152v2 = nil + testUnmarshalErr(&v152v2, bs152, h, t, "dec-map-v152-p-nil") + testDeepEqualErr(v152v1, v152v2, t, "equal-map-v152-p-nil") + // ... + if v == nil { + v152v2 = nil + } else { + v152v2 = make(map[uint64]uint64, len(v)) + } // reset map + var v152v3, v152v4 typMapMapUint64Uint64 + v152v3 = typMapMapUint64Uint64(v152v1) + v152v4 = typMapMapUint64Uint64(v152v2) + bs152 = testMarshalErr(v152v3, h, t, "enc-map-v152-custom") + testUnmarshalErr(v152v4, bs152, h, t, "dec-map-v152-p-len") + testDeepEqualErr(v152v3, v152v4, t, "equal-map-v152-p-len") + } + + for _, v := range []map[uint64]uintptr{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v153: %v\n", v) + var v153v1, v153v2 map[uint64]uintptr + v153v1 = v + bs153 := testMarshalErr(v153v1, h, t, "enc-map-v153") + if v == nil { + v153v2 = nil + } else { + v153v2 = make(map[uint64]uintptr, len(v)) + } // reset map + testUnmarshalErr(v153v2, bs153, h, t, "dec-map-v153") + testDeepEqualErr(v153v1, v153v2, t, "equal-map-v153") + if v == nil { + v153v2 = nil + } else { + v153v2 = make(map[uint64]uintptr, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v153v2), bs153, h, t, "dec-map-v153-noaddr") // decode into non-addressable map value + testDeepEqualErr(v153v1, v153v2, t, "equal-map-v153-noaddr") + if v == nil { + v153v2 = nil + } else { + v153v2 = make(map[uint64]uintptr, len(v)) + } // reset map + testUnmarshalErr(&v153v2, bs153, h, t, "dec-map-v153-p-len") + testDeepEqualErr(v153v1, v153v2, t, "equal-map-v153-p-len") + bs153 = testMarshalErr(&v153v1, h, t, "enc-map-v153-p") + v153v2 = nil + testUnmarshalErr(&v153v2, bs153, h, t, "dec-map-v153-p-nil") + testDeepEqualErr(v153v1, v153v2, t, "equal-map-v153-p-nil") + // ... + if v == nil { + v153v2 = nil + } else { + v153v2 = make(map[uint64]uintptr, len(v)) + } // reset map + var v153v3, v153v4 typMapMapUint64Uintptr + v153v3 = typMapMapUint64Uintptr(v153v1) + v153v4 = typMapMapUint64Uintptr(v153v2) + bs153 = testMarshalErr(v153v3, h, t, "enc-map-v153-custom") + testUnmarshalErr(v153v4, bs153, h, t, "dec-map-v153-p-len") + testDeepEqualErr(v153v3, v153v4, t, "equal-map-v153-p-len") + } + + for _, v := range []map[uint64]int{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v154: %v\n", v) + var v154v1, v154v2 map[uint64]int + v154v1 = v + bs154 := testMarshalErr(v154v1, h, t, "enc-map-v154") + if v == nil { + v154v2 = nil + } else { + v154v2 = make(map[uint64]int, len(v)) + } // reset map + testUnmarshalErr(v154v2, bs154, h, t, "dec-map-v154") + testDeepEqualErr(v154v1, v154v2, t, "equal-map-v154") + if v == nil { + v154v2 = nil + } else { + v154v2 = make(map[uint64]int, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v154v2), bs154, h, t, "dec-map-v154-noaddr") // decode into non-addressable map value + testDeepEqualErr(v154v1, v154v2, t, "equal-map-v154-noaddr") + if v == nil { + v154v2 = nil + } else { + v154v2 = make(map[uint64]int, len(v)) + } // reset map + testUnmarshalErr(&v154v2, bs154, h, t, "dec-map-v154-p-len") + testDeepEqualErr(v154v1, v154v2, t, "equal-map-v154-p-len") + bs154 = testMarshalErr(&v154v1, h, t, "enc-map-v154-p") + v154v2 = nil + testUnmarshalErr(&v154v2, bs154, h, t, "dec-map-v154-p-nil") + testDeepEqualErr(v154v1, v154v2, t, "equal-map-v154-p-nil") + // ... + if v == nil { + v154v2 = nil + } else { + v154v2 = make(map[uint64]int, len(v)) + } // reset map + var v154v3, v154v4 typMapMapUint64Int + v154v3 = typMapMapUint64Int(v154v1) + v154v4 = typMapMapUint64Int(v154v2) + bs154 = testMarshalErr(v154v3, h, t, "enc-map-v154-custom") + testUnmarshalErr(v154v4, bs154, h, t, "dec-map-v154-p-len") + testDeepEqualErr(v154v3, v154v4, t, "equal-map-v154-p-len") + } + + for _, v := range []map[uint64]int8{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v155: %v\n", v) + var v155v1, v155v2 map[uint64]int8 + v155v1 = v + bs155 := testMarshalErr(v155v1, h, t, "enc-map-v155") + if v == nil { + v155v2 = nil + } else { + v155v2 = make(map[uint64]int8, len(v)) + } // reset map + testUnmarshalErr(v155v2, bs155, h, t, "dec-map-v155") + testDeepEqualErr(v155v1, v155v2, t, "equal-map-v155") + if v == nil { + v155v2 = nil + } else { + v155v2 = make(map[uint64]int8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v155v2), bs155, h, t, "dec-map-v155-noaddr") // decode into non-addressable map value + testDeepEqualErr(v155v1, v155v2, t, "equal-map-v155-noaddr") + if v == nil { + v155v2 = nil + } else { + v155v2 = make(map[uint64]int8, len(v)) + } // reset map + testUnmarshalErr(&v155v2, bs155, h, t, "dec-map-v155-p-len") + testDeepEqualErr(v155v1, v155v2, t, "equal-map-v155-p-len") + bs155 = testMarshalErr(&v155v1, h, t, "enc-map-v155-p") + v155v2 = nil + testUnmarshalErr(&v155v2, bs155, h, t, "dec-map-v155-p-nil") + testDeepEqualErr(v155v1, v155v2, t, "equal-map-v155-p-nil") + // ... + if v == nil { + v155v2 = nil + } else { + v155v2 = make(map[uint64]int8, len(v)) + } // reset map + var v155v3, v155v4 typMapMapUint64Int8 + v155v3 = typMapMapUint64Int8(v155v1) + v155v4 = typMapMapUint64Int8(v155v2) + bs155 = testMarshalErr(v155v3, h, t, "enc-map-v155-custom") + testUnmarshalErr(v155v4, bs155, h, t, "dec-map-v155-p-len") + testDeepEqualErr(v155v3, v155v4, t, "equal-map-v155-p-len") + } + + for _, v := range []map[uint64]int16{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v156: %v\n", v) + var v156v1, v156v2 map[uint64]int16 + v156v1 = v + bs156 := testMarshalErr(v156v1, h, t, "enc-map-v156") + if v == nil { + v156v2 = nil + } else { + v156v2 = make(map[uint64]int16, len(v)) + } // reset map + testUnmarshalErr(v156v2, bs156, h, t, "dec-map-v156") + testDeepEqualErr(v156v1, v156v2, t, "equal-map-v156") + if v == nil { + v156v2 = nil + } else { + v156v2 = make(map[uint64]int16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v156v2), bs156, h, t, "dec-map-v156-noaddr") // decode into non-addressable map value + testDeepEqualErr(v156v1, v156v2, t, "equal-map-v156-noaddr") + if v == nil { + v156v2 = nil + } else { + v156v2 = make(map[uint64]int16, len(v)) + } // reset map + testUnmarshalErr(&v156v2, bs156, h, t, "dec-map-v156-p-len") + testDeepEqualErr(v156v1, v156v2, t, "equal-map-v156-p-len") + bs156 = testMarshalErr(&v156v1, h, t, "enc-map-v156-p") + v156v2 = nil + testUnmarshalErr(&v156v2, bs156, h, t, "dec-map-v156-p-nil") + testDeepEqualErr(v156v1, v156v2, t, "equal-map-v156-p-nil") + // ... + if v == nil { + v156v2 = nil + } else { + v156v2 = make(map[uint64]int16, len(v)) + } // reset map + var v156v3, v156v4 typMapMapUint64Int16 + v156v3 = typMapMapUint64Int16(v156v1) + v156v4 = typMapMapUint64Int16(v156v2) + bs156 = testMarshalErr(v156v3, h, t, "enc-map-v156-custom") + testUnmarshalErr(v156v4, bs156, h, t, "dec-map-v156-p-len") + testDeepEqualErr(v156v3, v156v4, t, "equal-map-v156-p-len") + } + + for _, v := range []map[uint64]int32{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v157: %v\n", v) + var v157v1, v157v2 map[uint64]int32 + v157v1 = v + bs157 := testMarshalErr(v157v1, h, t, "enc-map-v157") + if v == nil { + v157v2 = nil + } else { + v157v2 = make(map[uint64]int32, len(v)) + } // reset map + testUnmarshalErr(v157v2, bs157, h, t, "dec-map-v157") + testDeepEqualErr(v157v1, v157v2, t, "equal-map-v157") + if v == nil { + v157v2 = nil + } else { + v157v2 = make(map[uint64]int32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v157v2), bs157, h, t, "dec-map-v157-noaddr") // decode into non-addressable map value + testDeepEqualErr(v157v1, v157v2, t, "equal-map-v157-noaddr") + if v == nil { + v157v2 = nil + } else { + v157v2 = make(map[uint64]int32, len(v)) + } // reset map + testUnmarshalErr(&v157v2, bs157, h, t, "dec-map-v157-p-len") + testDeepEqualErr(v157v1, v157v2, t, "equal-map-v157-p-len") + bs157 = testMarshalErr(&v157v1, h, t, "enc-map-v157-p") + v157v2 = nil + testUnmarshalErr(&v157v2, bs157, h, t, "dec-map-v157-p-nil") + testDeepEqualErr(v157v1, v157v2, t, "equal-map-v157-p-nil") + // ... + if v == nil { + v157v2 = nil + } else { + v157v2 = make(map[uint64]int32, len(v)) + } // reset map + var v157v3, v157v4 typMapMapUint64Int32 + v157v3 = typMapMapUint64Int32(v157v1) + v157v4 = typMapMapUint64Int32(v157v2) + bs157 = testMarshalErr(v157v3, h, t, "enc-map-v157-custom") + testUnmarshalErr(v157v4, bs157, h, t, "dec-map-v157-p-len") + testDeepEqualErr(v157v3, v157v4, t, "equal-map-v157-p-len") + } + + for _, v := range []map[uint64]int64{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v158: %v\n", v) + var v158v1, v158v2 map[uint64]int64 + v158v1 = v + bs158 := testMarshalErr(v158v1, h, t, "enc-map-v158") + if v == nil { + v158v2 = nil + } else { + v158v2 = make(map[uint64]int64, len(v)) + } // reset map + testUnmarshalErr(v158v2, bs158, h, t, "dec-map-v158") + testDeepEqualErr(v158v1, v158v2, t, "equal-map-v158") + if v == nil { + v158v2 = nil + } else { + v158v2 = make(map[uint64]int64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v158v2), bs158, h, t, "dec-map-v158-noaddr") // decode into non-addressable map value + testDeepEqualErr(v158v1, v158v2, t, "equal-map-v158-noaddr") + if v == nil { + v158v2 = nil + } else { + v158v2 = make(map[uint64]int64, len(v)) + } // reset map + testUnmarshalErr(&v158v2, bs158, h, t, "dec-map-v158-p-len") + testDeepEqualErr(v158v1, v158v2, t, "equal-map-v158-p-len") + bs158 = testMarshalErr(&v158v1, h, t, "enc-map-v158-p") + v158v2 = nil + testUnmarshalErr(&v158v2, bs158, h, t, "dec-map-v158-p-nil") + testDeepEqualErr(v158v1, v158v2, t, "equal-map-v158-p-nil") + // ... + if v == nil { + v158v2 = nil + } else { + v158v2 = make(map[uint64]int64, len(v)) + } // reset map + var v158v3, v158v4 typMapMapUint64Int64 + v158v3 = typMapMapUint64Int64(v158v1) + v158v4 = typMapMapUint64Int64(v158v2) + bs158 = testMarshalErr(v158v3, h, t, "enc-map-v158-custom") + testUnmarshalErr(v158v4, bs158, h, t, "dec-map-v158-p-len") + testDeepEqualErr(v158v3, v158v4, t, "equal-map-v158-p-len") + } + + for _, v := range []map[uint64]float32{nil, {}, {33: 0, 44: 22.2}} { + // fmt.Printf(">>>> running mammoth map v159: %v\n", v) + var v159v1, v159v2 map[uint64]float32 + v159v1 = v + bs159 := testMarshalErr(v159v1, h, t, "enc-map-v159") + if v == nil { + v159v2 = nil + } else { + v159v2 = make(map[uint64]float32, len(v)) + } // reset map + testUnmarshalErr(v159v2, bs159, h, t, "dec-map-v159") + testDeepEqualErr(v159v1, v159v2, t, "equal-map-v159") + if v == nil { + v159v2 = nil + } else { + v159v2 = make(map[uint64]float32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v159v2), bs159, h, t, "dec-map-v159-noaddr") // decode into non-addressable map value + testDeepEqualErr(v159v1, v159v2, t, "equal-map-v159-noaddr") + if v == nil { + v159v2 = nil + } else { + v159v2 = make(map[uint64]float32, len(v)) + } // reset map + testUnmarshalErr(&v159v2, bs159, h, t, "dec-map-v159-p-len") + testDeepEqualErr(v159v1, v159v2, t, "equal-map-v159-p-len") + bs159 = testMarshalErr(&v159v1, h, t, "enc-map-v159-p") + v159v2 = nil + testUnmarshalErr(&v159v2, bs159, h, t, "dec-map-v159-p-nil") + testDeepEqualErr(v159v1, v159v2, t, "equal-map-v159-p-nil") + // ... + if v == nil { + v159v2 = nil + } else { + v159v2 = make(map[uint64]float32, len(v)) + } // reset map + var v159v3, v159v4 typMapMapUint64Float32 + v159v3 = typMapMapUint64Float32(v159v1) + v159v4 = typMapMapUint64Float32(v159v2) + bs159 = testMarshalErr(v159v3, h, t, "enc-map-v159-custom") + testUnmarshalErr(v159v4, bs159, h, t, "dec-map-v159-p-len") + testDeepEqualErr(v159v3, v159v4, t, "equal-map-v159-p-len") + } + + for _, v := range []map[uint64]float64{nil, {}, {33: 0, 44: 11.1}} { + // fmt.Printf(">>>> running mammoth map v160: %v\n", v) + var v160v1, v160v2 map[uint64]float64 + v160v1 = v + bs160 := testMarshalErr(v160v1, h, t, "enc-map-v160") + if v == nil { + v160v2 = nil + } else { + v160v2 = make(map[uint64]float64, len(v)) + } // reset map + testUnmarshalErr(v160v2, bs160, h, t, "dec-map-v160") + testDeepEqualErr(v160v1, v160v2, t, "equal-map-v160") + if v == nil { + v160v2 = nil + } else { + v160v2 = make(map[uint64]float64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v160v2), bs160, h, t, "dec-map-v160-noaddr") // decode into non-addressable map value + testDeepEqualErr(v160v1, v160v2, t, "equal-map-v160-noaddr") + if v == nil { + v160v2 = nil + } else { + v160v2 = make(map[uint64]float64, len(v)) + } // reset map + testUnmarshalErr(&v160v2, bs160, h, t, "dec-map-v160-p-len") + testDeepEqualErr(v160v1, v160v2, t, "equal-map-v160-p-len") + bs160 = testMarshalErr(&v160v1, h, t, "enc-map-v160-p") + v160v2 = nil + testUnmarshalErr(&v160v2, bs160, h, t, "dec-map-v160-p-nil") + testDeepEqualErr(v160v1, v160v2, t, "equal-map-v160-p-nil") + // ... + if v == nil { + v160v2 = nil + } else { + v160v2 = make(map[uint64]float64, len(v)) + } // reset map + var v160v3, v160v4 typMapMapUint64Float64 + v160v3 = typMapMapUint64Float64(v160v1) + v160v4 = typMapMapUint64Float64(v160v2) + bs160 = testMarshalErr(v160v3, h, t, "enc-map-v160-custom") + testUnmarshalErr(v160v4, bs160, h, t, "dec-map-v160-p-len") + testDeepEqualErr(v160v3, v160v4, t, "equal-map-v160-p-len") + } + + for _, v := range []map[uint64]bool{nil, {}, {33: false, 44: true}} { + // fmt.Printf(">>>> running mammoth map v161: %v\n", v) + var v161v1, v161v2 map[uint64]bool + v161v1 = v + bs161 := testMarshalErr(v161v1, h, t, "enc-map-v161") + if v == nil { + v161v2 = nil + } else { + v161v2 = make(map[uint64]bool, len(v)) + } // reset map + testUnmarshalErr(v161v2, bs161, h, t, "dec-map-v161") + testDeepEqualErr(v161v1, v161v2, t, "equal-map-v161") + if v == nil { + v161v2 = nil + } else { + v161v2 = make(map[uint64]bool, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v161v2), bs161, h, t, "dec-map-v161-noaddr") // decode into non-addressable map value + testDeepEqualErr(v161v1, v161v2, t, "equal-map-v161-noaddr") + if v == nil { + v161v2 = nil + } else { + v161v2 = make(map[uint64]bool, len(v)) + } // reset map + testUnmarshalErr(&v161v2, bs161, h, t, "dec-map-v161-p-len") + testDeepEqualErr(v161v1, v161v2, t, "equal-map-v161-p-len") + bs161 = testMarshalErr(&v161v1, h, t, "enc-map-v161-p") + v161v2 = nil + testUnmarshalErr(&v161v2, bs161, h, t, "dec-map-v161-p-nil") + testDeepEqualErr(v161v1, v161v2, t, "equal-map-v161-p-nil") + // ... + if v == nil { + v161v2 = nil + } else { + v161v2 = make(map[uint64]bool, len(v)) + } // reset map + var v161v3, v161v4 typMapMapUint64Bool + v161v3 = typMapMapUint64Bool(v161v1) + v161v4 = typMapMapUint64Bool(v161v2) + bs161 = testMarshalErr(v161v3, h, t, "enc-map-v161-custom") + testUnmarshalErr(v161v4, bs161, h, t, "dec-map-v161-p-len") + testDeepEqualErr(v161v3, v161v4, t, "equal-map-v161-p-len") + } + + for _, v := range []map[uintptr]interface{}{nil, {}, {33: nil, 44: "string-is-an-interface"}} { + // fmt.Printf(">>>> running mammoth map v164: %v\n", v) + var v164v1, v164v2 map[uintptr]interface{} + v164v1 = v + bs164 := testMarshalErr(v164v1, h, t, "enc-map-v164") + if v == nil { + v164v2 = nil + } else { + v164v2 = make(map[uintptr]interface{}, len(v)) + } // reset map + testUnmarshalErr(v164v2, bs164, h, t, "dec-map-v164") + testDeepEqualErr(v164v1, v164v2, t, "equal-map-v164") + if v == nil { + v164v2 = nil + } else { + v164v2 = make(map[uintptr]interface{}, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v164v2), bs164, h, t, "dec-map-v164-noaddr") // decode into non-addressable map value + testDeepEqualErr(v164v1, v164v2, t, "equal-map-v164-noaddr") + if v == nil { + v164v2 = nil + } else { + v164v2 = make(map[uintptr]interface{}, len(v)) + } // reset map + testUnmarshalErr(&v164v2, bs164, h, t, "dec-map-v164-p-len") + testDeepEqualErr(v164v1, v164v2, t, "equal-map-v164-p-len") + bs164 = testMarshalErr(&v164v1, h, t, "enc-map-v164-p") + v164v2 = nil + testUnmarshalErr(&v164v2, bs164, h, t, "dec-map-v164-p-nil") + testDeepEqualErr(v164v1, v164v2, t, "equal-map-v164-p-nil") + // ... + if v == nil { + v164v2 = nil + } else { + v164v2 = make(map[uintptr]interface{}, len(v)) + } // reset map + var v164v3, v164v4 typMapMapUintptrIntf + v164v3 = typMapMapUintptrIntf(v164v1) + v164v4 = typMapMapUintptrIntf(v164v2) + bs164 = testMarshalErr(v164v3, h, t, "enc-map-v164-custom") + testUnmarshalErr(v164v4, bs164, h, t, "dec-map-v164-p-len") + testDeepEqualErr(v164v3, v164v4, t, "equal-map-v164-p-len") + } + + for _, v := range []map[uintptr]string{nil, {}, {33: "", 44: "some-string"}} { + // fmt.Printf(">>>> running mammoth map v165: %v\n", v) + var v165v1, v165v2 map[uintptr]string + v165v1 = v + bs165 := testMarshalErr(v165v1, h, t, "enc-map-v165") + if v == nil { + v165v2 = nil + } else { + v165v2 = make(map[uintptr]string, len(v)) + } // reset map + testUnmarshalErr(v165v2, bs165, h, t, "dec-map-v165") + testDeepEqualErr(v165v1, v165v2, t, "equal-map-v165") + if v == nil { + v165v2 = nil + } else { + v165v2 = make(map[uintptr]string, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v165v2), bs165, h, t, "dec-map-v165-noaddr") // decode into non-addressable map value + testDeepEqualErr(v165v1, v165v2, t, "equal-map-v165-noaddr") + if v == nil { + v165v2 = nil + } else { + v165v2 = make(map[uintptr]string, len(v)) + } // reset map + testUnmarshalErr(&v165v2, bs165, h, t, "dec-map-v165-p-len") + testDeepEqualErr(v165v1, v165v2, t, "equal-map-v165-p-len") + bs165 = testMarshalErr(&v165v1, h, t, "enc-map-v165-p") + v165v2 = nil + testUnmarshalErr(&v165v2, bs165, h, t, "dec-map-v165-p-nil") + testDeepEqualErr(v165v1, v165v2, t, "equal-map-v165-p-nil") + // ... + if v == nil { + v165v2 = nil + } else { + v165v2 = make(map[uintptr]string, len(v)) + } // reset map + var v165v3, v165v4 typMapMapUintptrString + v165v3 = typMapMapUintptrString(v165v1) + v165v4 = typMapMapUintptrString(v165v2) + bs165 = testMarshalErr(v165v3, h, t, "enc-map-v165-custom") + testUnmarshalErr(v165v4, bs165, h, t, "dec-map-v165-p-len") + testDeepEqualErr(v165v3, v165v4, t, "equal-map-v165-p-len") + } + + for _, v := range []map[uintptr]uint{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v166: %v\n", v) + var v166v1, v166v2 map[uintptr]uint + v166v1 = v + bs166 := testMarshalErr(v166v1, h, t, "enc-map-v166") + if v == nil { + v166v2 = nil + } else { + v166v2 = make(map[uintptr]uint, len(v)) + } // reset map + testUnmarshalErr(v166v2, bs166, h, t, "dec-map-v166") + testDeepEqualErr(v166v1, v166v2, t, "equal-map-v166") + if v == nil { + v166v2 = nil + } else { + v166v2 = make(map[uintptr]uint, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v166v2), bs166, h, t, "dec-map-v166-noaddr") // decode into non-addressable map value + testDeepEqualErr(v166v1, v166v2, t, "equal-map-v166-noaddr") + if v == nil { + v166v2 = nil + } else { + v166v2 = make(map[uintptr]uint, len(v)) + } // reset map + testUnmarshalErr(&v166v2, bs166, h, t, "dec-map-v166-p-len") + testDeepEqualErr(v166v1, v166v2, t, "equal-map-v166-p-len") + bs166 = testMarshalErr(&v166v1, h, t, "enc-map-v166-p") + v166v2 = nil + testUnmarshalErr(&v166v2, bs166, h, t, "dec-map-v166-p-nil") + testDeepEqualErr(v166v1, v166v2, t, "equal-map-v166-p-nil") + // ... + if v == nil { + v166v2 = nil + } else { + v166v2 = make(map[uintptr]uint, len(v)) + } // reset map + var v166v3, v166v4 typMapMapUintptrUint + v166v3 = typMapMapUintptrUint(v166v1) + v166v4 = typMapMapUintptrUint(v166v2) + bs166 = testMarshalErr(v166v3, h, t, "enc-map-v166-custom") + testUnmarshalErr(v166v4, bs166, h, t, "dec-map-v166-p-len") + testDeepEqualErr(v166v3, v166v4, t, "equal-map-v166-p-len") + } + + for _, v := range []map[uintptr]uint8{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v167: %v\n", v) + var v167v1, v167v2 map[uintptr]uint8 + v167v1 = v + bs167 := testMarshalErr(v167v1, h, t, "enc-map-v167") + if v == nil { + v167v2 = nil + } else { + v167v2 = make(map[uintptr]uint8, len(v)) + } // reset map + testUnmarshalErr(v167v2, bs167, h, t, "dec-map-v167") + testDeepEqualErr(v167v1, v167v2, t, "equal-map-v167") + if v == nil { + v167v2 = nil + } else { + v167v2 = make(map[uintptr]uint8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v167v2), bs167, h, t, "dec-map-v167-noaddr") // decode into non-addressable map value + testDeepEqualErr(v167v1, v167v2, t, "equal-map-v167-noaddr") + if v == nil { + v167v2 = nil + } else { + v167v2 = make(map[uintptr]uint8, len(v)) + } // reset map + testUnmarshalErr(&v167v2, bs167, h, t, "dec-map-v167-p-len") + testDeepEqualErr(v167v1, v167v2, t, "equal-map-v167-p-len") + bs167 = testMarshalErr(&v167v1, h, t, "enc-map-v167-p") + v167v2 = nil + testUnmarshalErr(&v167v2, bs167, h, t, "dec-map-v167-p-nil") + testDeepEqualErr(v167v1, v167v2, t, "equal-map-v167-p-nil") + // ... + if v == nil { + v167v2 = nil + } else { + v167v2 = make(map[uintptr]uint8, len(v)) + } // reset map + var v167v3, v167v4 typMapMapUintptrUint8 + v167v3 = typMapMapUintptrUint8(v167v1) + v167v4 = typMapMapUintptrUint8(v167v2) + bs167 = testMarshalErr(v167v3, h, t, "enc-map-v167-custom") + testUnmarshalErr(v167v4, bs167, h, t, "dec-map-v167-p-len") + testDeepEqualErr(v167v3, v167v4, t, "equal-map-v167-p-len") + } + + for _, v := range []map[uintptr]uint16{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v168: %v\n", v) + var v168v1, v168v2 map[uintptr]uint16 + v168v1 = v + bs168 := testMarshalErr(v168v1, h, t, "enc-map-v168") + if v == nil { + v168v2 = nil + } else { + v168v2 = make(map[uintptr]uint16, len(v)) + } // reset map + testUnmarshalErr(v168v2, bs168, h, t, "dec-map-v168") + testDeepEqualErr(v168v1, v168v2, t, "equal-map-v168") + if v == nil { + v168v2 = nil + } else { + v168v2 = make(map[uintptr]uint16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v168v2), bs168, h, t, "dec-map-v168-noaddr") // decode into non-addressable map value + testDeepEqualErr(v168v1, v168v2, t, "equal-map-v168-noaddr") + if v == nil { + v168v2 = nil + } else { + v168v2 = make(map[uintptr]uint16, len(v)) + } // reset map + testUnmarshalErr(&v168v2, bs168, h, t, "dec-map-v168-p-len") + testDeepEqualErr(v168v1, v168v2, t, "equal-map-v168-p-len") + bs168 = testMarshalErr(&v168v1, h, t, "enc-map-v168-p") + v168v2 = nil + testUnmarshalErr(&v168v2, bs168, h, t, "dec-map-v168-p-nil") + testDeepEqualErr(v168v1, v168v2, t, "equal-map-v168-p-nil") + // ... + if v == nil { + v168v2 = nil + } else { + v168v2 = make(map[uintptr]uint16, len(v)) + } // reset map + var v168v3, v168v4 typMapMapUintptrUint16 + v168v3 = typMapMapUintptrUint16(v168v1) + v168v4 = typMapMapUintptrUint16(v168v2) + bs168 = testMarshalErr(v168v3, h, t, "enc-map-v168-custom") + testUnmarshalErr(v168v4, bs168, h, t, "dec-map-v168-p-len") + testDeepEqualErr(v168v3, v168v4, t, "equal-map-v168-p-len") + } + + for _, v := range []map[uintptr]uint32{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v169: %v\n", v) + var v169v1, v169v2 map[uintptr]uint32 + v169v1 = v + bs169 := testMarshalErr(v169v1, h, t, "enc-map-v169") + if v == nil { + v169v2 = nil + } else { + v169v2 = make(map[uintptr]uint32, len(v)) + } // reset map + testUnmarshalErr(v169v2, bs169, h, t, "dec-map-v169") + testDeepEqualErr(v169v1, v169v2, t, "equal-map-v169") + if v == nil { + v169v2 = nil + } else { + v169v2 = make(map[uintptr]uint32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v169v2), bs169, h, t, "dec-map-v169-noaddr") // decode into non-addressable map value + testDeepEqualErr(v169v1, v169v2, t, "equal-map-v169-noaddr") + if v == nil { + v169v2 = nil + } else { + v169v2 = make(map[uintptr]uint32, len(v)) + } // reset map + testUnmarshalErr(&v169v2, bs169, h, t, "dec-map-v169-p-len") + testDeepEqualErr(v169v1, v169v2, t, "equal-map-v169-p-len") + bs169 = testMarshalErr(&v169v1, h, t, "enc-map-v169-p") + v169v2 = nil + testUnmarshalErr(&v169v2, bs169, h, t, "dec-map-v169-p-nil") + testDeepEqualErr(v169v1, v169v2, t, "equal-map-v169-p-nil") + // ... + if v == nil { + v169v2 = nil + } else { + v169v2 = make(map[uintptr]uint32, len(v)) + } // reset map + var v169v3, v169v4 typMapMapUintptrUint32 + v169v3 = typMapMapUintptrUint32(v169v1) + v169v4 = typMapMapUintptrUint32(v169v2) + bs169 = testMarshalErr(v169v3, h, t, "enc-map-v169-custom") + testUnmarshalErr(v169v4, bs169, h, t, "dec-map-v169-p-len") + testDeepEqualErr(v169v3, v169v4, t, "equal-map-v169-p-len") + } + + for _, v := range []map[uintptr]uint64{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v170: %v\n", v) + var v170v1, v170v2 map[uintptr]uint64 + v170v1 = v + bs170 := testMarshalErr(v170v1, h, t, "enc-map-v170") + if v == nil { + v170v2 = nil + } else { + v170v2 = make(map[uintptr]uint64, len(v)) + } // reset map + testUnmarshalErr(v170v2, bs170, h, t, "dec-map-v170") + testDeepEqualErr(v170v1, v170v2, t, "equal-map-v170") + if v == nil { + v170v2 = nil + } else { + v170v2 = make(map[uintptr]uint64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v170v2), bs170, h, t, "dec-map-v170-noaddr") // decode into non-addressable map value + testDeepEqualErr(v170v1, v170v2, t, "equal-map-v170-noaddr") + if v == nil { + v170v2 = nil + } else { + v170v2 = make(map[uintptr]uint64, len(v)) + } // reset map + testUnmarshalErr(&v170v2, bs170, h, t, "dec-map-v170-p-len") + testDeepEqualErr(v170v1, v170v2, t, "equal-map-v170-p-len") + bs170 = testMarshalErr(&v170v1, h, t, "enc-map-v170-p") + v170v2 = nil + testUnmarshalErr(&v170v2, bs170, h, t, "dec-map-v170-p-nil") + testDeepEqualErr(v170v1, v170v2, t, "equal-map-v170-p-nil") + // ... + if v == nil { + v170v2 = nil + } else { + v170v2 = make(map[uintptr]uint64, len(v)) + } // reset map + var v170v3, v170v4 typMapMapUintptrUint64 + v170v3 = typMapMapUintptrUint64(v170v1) + v170v4 = typMapMapUintptrUint64(v170v2) + bs170 = testMarshalErr(v170v3, h, t, "enc-map-v170-custom") + testUnmarshalErr(v170v4, bs170, h, t, "dec-map-v170-p-len") + testDeepEqualErr(v170v3, v170v4, t, "equal-map-v170-p-len") + } + + for _, v := range []map[uintptr]uintptr{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v171: %v\n", v) + var v171v1, v171v2 map[uintptr]uintptr + v171v1 = v + bs171 := testMarshalErr(v171v1, h, t, "enc-map-v171") + if v == nil { + v171v2 = nil + } else { + v171v2 = make(map[uintptr]uintptr, len(v)) + } // reset map + testUnmarshalErr(v171v2, bs171, h, t, "dec-map-v171") + testDeepEqualErr(v171v1, v171v2, t, "equal-map-v171") + if v == nil { + v171v2 = nil + } else { + v171v2 = make(map[uintptr]uintptr, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v171v2), bs171, h, t, "dec-map-v171-noaddr") // decode into non-addressable map value + testDeepEqualErr(v171v1, v171v2, t, "equal-map-v171-noaddr") + if v == nil { + v171v2 = nil + } else { + v171v2 = make(map[uintptr]uintptr, len(v)) + } // reset map + testUnmarshalErr(&v171v2, bs171, h, t, "dec-map-v171-p-len") + testDeepEqualErr(v171v1, v171v2, t, "equal-map-v171-p-len") + bs171 = testMarshalErr(&v171v1, h, t, "enc-map-v171-p") + v171v2 = nil + testUnmarshalErr(&v171v2, bs171, h, t, "dec-map-v171-p-nil") + testDeepEqualErr(v171v1, v171v2, t, "equal-map-v171-p-nil") + // ... + if v == nil { + v171v2 = nil + } else { + v171v2 = make(map[uintptr]uintptr, len(v)) + } // reset map + var v171v3, v171v4 typMapMapUintptrUintptr + v171v3 = typMapMapUintptrUintptr(v171v1) + v171v4 = typMapMapUintptrUintptr(v171v2) + bs171 = testMarshalErr(v171v3, h, t, "enc-map-v171-custom") + testUnmarshalErr(v171v4, bs171, h, t, "dec-map-v171-p-len") + testDeepEqualErr(v171v3, v171v4, t, "equal-map-v171-p-len") + } + + for _, v := range []map[uintptr]int{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v172: %v\n", v) + var v172v1, v172v2 map[uintptr]int + v172v1 = v + bs172 := testMarshalErr(v172v1, h, t, "enc-map-v172") + if v == nil { + v172v2 = nil + } else { + v172v2 = make(map[uintptr]int, len(v)) + } // reset map + testUnmarshalErr(v172v2, bs172, h, t, "dec-map-v172") + testDeepEqualErr(v172v1, v172v2, t, "equal-map-v172") + if v == nil { + v172v2 = nil + } else { + v172v2 = make(map[uintptr]int, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v172v2), bs172, h, t, "dec-map-v172-noaddr") // decode into non-addressable map value + testDeepEqualErr(v172v1, v172v2, t, "equal-map-v172-noaddr") + if v == nil { + v172v2 = nil + } else { + v172v2 = make(map[uintptr]int, len(v)) + } // reset map + testUnmarshalErr(&v172v2, bs172, h, t, "dec-map-v172-p-len") + testDeepEqualErr(v172v1, v172v2, t, "equal-map-v172-p-len") + bs172 = testMarshalErr(&v172v1, h, t, "enc-map-v172-p") + v172v2 = nil + testUnmarshalErr(&v172v2, bs172, h, t, "dec-map-v172-p-nil") + testDeepEqualErr(v172v1, v172v2, t, "equal-map-v172-p-nil") + // ... + if v == nil { + v172v2 = nil + } else { + v172v2 = make(map[uintptr]int, len(v)) + } // reset map + var v172v3, v172v4 typMapMapUintptrInt + v172v3 = typMapMapUintptrInt(v172v1) + v172v4 = typMapMapUintptrInt(v172v2) + bs172 = testMarshalErr(v172v3, h, t, "enc-map-v172-custom") + testUnmarshalErr(v172v4, bs172, h, t, "dec-map-v172-p-len") + testDeepEqualErr(v172v3, v172v4, t, "equal-map-v172-p-len") + } + + for _, v := range []map[uintptr]int8{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v173: %v\n", v) + var v173v1, v173v2 map[uintptr]int8 + v173v1 = v + bs173 := testMarshalErr(v173v1, h, t, "enc-map-v173") + if v == nil { + v173v2 = nil + } else { + v173v2 = make(map[uintptr]int8, len(v)) + } // reset map + testUnmarshalErr(v173v2, bs173, h, t, "dec-map-v173") + testDeepEqualErr(v173v1, v173v2, t, "equal-map-v173") + if v == nil { + v173v2 = nil + } else { + v173v2 = make(map[uintptr]int8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v173v2), bs173, h, t, "dec-map-v173-noaddr") // decode into non-addressable map value + testDeepEqualErr(v173v1, v173v2, t, "equal-map-v173-noaddr") + if v == nil { + v173v2 = nil + } else { + v173v2 = make(map[uintptr]int8, len(v)) + } // reset map + testUnmarshalErr(&v173v2, bs173, h, t, "dec-map-v173-p-len") + testDeepEqualErr(v173v1, v173v2, t, "equal-map-v173-p-len") + bs173 = testMarshalErr(&v173v1, h, t, "enc-map-v173-p") + v173v2 = nil + testUnmarshalErr(&v173v2, bs173, h, t, "dec-map-v173-p-nil") + testDeepEqualErr(v173v1, v173v2, t, "equal-map-v173-p-nil") + // ... + if v == nil { + v173v2 = nil + } else { + v173v2 = make(map[uintptr]int8, len(v)) + } // reset map + var v173v3, v173v4 typMapMapUintptrInt8 + v173v3 = typMapMapUintptrInt8(v173v1) + v173v4 = typMapMapUintptrInt8(v173v2) + bs173 = testMarshalErr(v173v3, h, t, "enc-map-v173-custom") + testUnmarshalErr(v173v4, bs173, h, t, "dec-map-v173-p-len") + testDeepEqualErr(v173v3, v173v4, t, "equal-map-v173-p-len") + } + + for _, v := range []map[uintptr]int16{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v174: %v\n", v) + var v174v1, v174v2 map[uintptr]int16 + v174v1 = v + bs174 := testMarshalErr(v174v1, h, t, "enc-map-v174") + if v == nil { + v174v2 = nil + } else { + v174v2 = make(map[uintptr]int16, len(v)) + } // reset map + testUnmarshalErr(v174v2, bs174, h, t, "dec-map-v174") + testDeepEqualErr(v174v1, v174v2, t, "equal-map-v174") + if v == nil { + v174v2 = nil + } else { + v174v2 = make(map[uintptr]int16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v174v2), bs174, h, t, "dec-map-v174-noaddr") // decode into non-addressable map value + testDeepEqualErr(v174v1, v174v2, t, "equal-map-v174-noaddr") + if v == nil { + v174v2 = nil + } else { + v174v2 = make(map[uintptr]int16, len(v)) + } // reset map + testUnmarshalErr(&v174v2, bs174, h, t, "dec-map-v174-p-len") + testDeepEqualErr(v174v1, v174v2, t, "equal-map-v174-p-len") + bs174 = testMarshalErr(&v174v1, h, t, "enc-map-v174-p") + v174v2 = nil + testUnmarshalErr(&v174v2, bs174, h, t, "dec-map-v174-p-nil") + testDeepEqualErr(v174v1, v174v2, t, "equal-map-v174-p-nil") + // ... + if v == nil { + v174v2 = nil + } else { + v174v2 = make(map[uintptr]int16, len(v)) + } // reset map + var v174v3, v174v4 typMapMapUintptrInt16 + v174v3 = typMapMapUintptrInt16(v174v1) + v174v4 = typMapMapUintptrInt16(v174v2) + bs174 = testMarshalErr(v174v3, h, t, "enc-map-v174-custom") + testUnmarshalErr(v174v4, bs174, h, t, "dec-map-v174-p-len") + testDeepEqualErr(v174v3, v174v4, t, "equal-map-v174-p-len") + } + + for _, v := range []map[uintptr]int32{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v175: %v\n", v) + var v175v1, v175v2 map[uintptr]int32 + v175v1 = v + bs175 := testMarshalErr(v175v1, h, t, "enc-map-v175") + if v == nil { + v175v2 = nil + } else { + v175v2 = make(map[uintptr]int32, len(v)) + } // reset map + testUnmarshalErr(v175v2, bs175, h, t, "dec-map-v175") + testDeepEqualErr(v175v1, v175v2, t, "equal-map-v175") + if v == nil { + v175v2 = nil + } else { + v175v2 = make(map[uintptr]int32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v175v2), bs175, h, t, "dec-map-v175-noaddr") // decode into non-addressable map value + testDeepEqualErr(v175v1, v175v2, t, "equal-map-v175-noaddr") + if v == nil { + v175v2 = nil + } else { + v175v2 = make(map[uintptr]int32, len(v)) + } // reset map + testUnmarshalErr(&v175v2, bs175, h, t, "dec-map-v175-p-len") + testDeepEqualErr(v175v1, v175v2, t, "equal-map-v175-p-len") + bs175 = testMarshalErr(&v175v1, h, t, "enc-map-v175-p") + v175v2 = nil + testUnmarshalErr(&v175v2, bs175, h, t, "dec-map-v175-p-nil") + testDeepEqualErr(v175v1, v175v2, t, "equal-map-v175-p-nil") + // ... + if v == nil { + v175v2 = nil + } else { + v175v2 = make(map[uintptr]int32, len(v)) + } // reset map + var v175v3, v175v4 typMapMapUintptrInt32 + v175v3 = typMapMapUintptrInt32(v175v1) + v175v4 = typMapMapUintptrInt32(v175v2) + bs175 = testMarshalErr(v175v3, h, t, "enc-map-v175-custom") + testUnmarshalErr(v175v4, bs175, h, t, "dec-map-v175-p-len") + testDeepEqualErr(v175v3, v175v4, t, "equal-map-v175-p-len") + } + + for _, v := range []map[uintptr]int64{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v176: %v\n", v) + var v176v1, v176v2 map[uintptr]int64 + v176v1 = v + bs176 := testMarshalErr(v176v1, h, t, "enc-map-v176") + if v == nil { + v176v2 = nil + } else { + v176v2 = make(map[uintptr]int64, len(v)) + } // reset map + testUnmarshalErr(v176v2, bs176, h, t, "dec-map-v176") + testDeepEqualErr(v176v1, v176v2, t, "equal-map-v176") + if v == nil { + v176v2 = nil + } else { + v176v2 = make(map[uintptr]int64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v176v2), bs176, h, t, "dec-map-v176-noaddr") // decode into non-addressable map value + testDeepEqualErr(v176v1, v176v2, t, "equal-map-v176-noaddr") + if v == nil { + v176v2 = nil + } else { + v176v2 = make(map[uintptr]int64, len(v)) + } // reset map + testUnmarshalErr(&v176v2, bs176, h, t, "dec-map-v176-p-len") + testDeepEqualErr(v176v1, v176v2, t, "equal-map-v176-p-len") + bs176 = testMarshalErr(&v176v1, h, t, "enc-map-v176-p") + v176v2 = nil + testUnmarshalErr(&v176v2, bs176, h, t, "dec-map-v176-p-nil") + testDeepEqualErr(v176v1, v176v2, t, "equal-map-v176-p-nil") + // ... + if v == nil { + v176v2 = nil + } else { + v176v2 = make(map[uintptr]int64, len(v)) + } // reset map + var v176v3, v176v4 typMapMapUintptrInt64 + v176v3 = typMapMapUintptrInt64(v176v1) + v176v4 = typMapMapUintptrInt64(v176v2) + bs176 = testMarshalErr(v176v3, h, t, "enc-map-v176-custom") + testUnmarshalErr(v176v4, bs176, h, t, "dec-map-v176-p-len") + testDeepEqualErr(v176v3, v176v4, t, "equal-map-v176-p-len") + } + + for _, v := range []map[uintptr]float32{nil, {}, {44: 0, 33: 22.2}} { + // fmt.Printf(">>>> running mammoth map v177: %v\n", v) + var v177v1, v177v2 map[uintptr]float32 + v177v1 = v + bs177 := testMarshalErr(v177v1, h, t, "enc-map-v177") + if v == nil { + v177v2 = nil + } else { + v177v2 = make(map[uintptr]float32, len(v)) + } // reset map + testUnmarshalErr(v177v2, bs177, h, t, "dec-map-v177") + testDeepEqualErr(v177v1, v177v2, t, "equal-map-v177") + if v == nil { + v177v2 = nil + } else { + v177v2 = make(map[uintptr]float32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v177v2), bs177, h, t, "dec-map-v177-noaddr") // decode into non-addressable map value + testDeepEqualErr(v177v1, v177v2, t, "equal-map-v177-noaddr") + if v == nil { + v177v2 = nil + } else { + v177v2 = make(map[uintptr]float32, len(v)) + } // reset map + testUnmarshalErr(&v177v2, bs177, h, t, "dec-map-v177-p-len") + testDeepEqualErr(v177v1, v177v2, t, "equal-map-v177-p-len") + bs177 = testMarshalErr(&v177v1, h, t, "enc-map-v177-p") + v177v2 = nil + testUnmarshalErr(&v177v2, bs177, h, t, "dec-map-v177-p-nil") + testDeepEqualErr(v177v1, v177v2, t, "equal-map-v177-p-nil") + // ... + if v == nil { + v177v2 = nil + } else { + v177v2 = make(map[uintptr]float32, len(v)) + } // reset map + var v177v3, v177v4 typMapMapUintptrFloat32 + v177v3 = typMapMapUintptrFloat32(v177v1) + v177v4 = typMapMapUintptrFloat32(v177v2) + bs177 = testMarshalErr(v177v3, h, t, "enc-map-v177-custom") + testUnmarshalErr(v177v4, bs177, h, t, "dec-map-v177-p-len") + testDeepEqualErr(v177v3, v177v4, t, "equal-map-v177-p-len") + } + + for _, v := range []map[uintptr]float64{nil, {}, {44: 0, 33: 11.1}} { + // fmt.Printf(">>>> running mammoth map v178: %v\n", v) + var v178v1, v178v2 map[uintptr]float64 + v178v1 = v + bs178 := testMarshalErr(v178v1, h, t, "enc-map-v178") + if v == nil { + v178v2 = nil + } else { + v178v2 = make(map[uintptr]float64, len(v)) + } // reset map + testUnmarshalErr(v178v2, bs178, h, t, "dec-map-v178") + testDeepEqualErr(v178v1, v178v2, t, "equal-map-v178") + if v == nil { + v178v2 = nil + } else { + v178v2 = make(map[uintptr]float64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v178v2), bs178, h, t, "dec-map-v178-noaddr") // decode into non-addressable map value + testDeepEqualErr(v178v1, v178v2, t, "equal-map-v178-noaddr") + if v == nil { + v178v2 = nil + } else { + v178v2 = make(map[uintptr]float64, len(v)) + } // reset map + testUnmarshalErr(&v178v2, bs178, h, t, "dec-map-v178-p-len") + testDeepEqualErr(v178v1, v178v2, t, "equal-map-v178-p-len") + bs178 = testMarshalErr(&v178v1, h, t, "enc-map-v178-p") + v178v2 = nil + testUnmarshalErr(&v178v2, bs178, h, t, "dec-map-v178-p-nil") + testDeepEqualErr(v178v1, v178v2, t, "equal-map-v178-p-nil") + // ... + if v == nil { + v178v2 = nil + } else { + v178v2 = make(map[uintptr]float64, len(v)) + } // reset map + var v178v3, v178v4 typMapMapUintptrFloat64 + v178v3 = typMapMapUintptrFloat64(v178v1) + v178v4 = typMapMapUintptrFloat64(v178v2) + bs178 = testMarshalErr(v178v3, h, t, "enc-map-v178-custom") + testUnmarshalErr(v178v4, bs178, h, t, "dec-map-v178-p-len") + testDeepEqualErr(v178v3, v178v4, t, "equal-map-v178-p-len") + } + + for _, v := range []map[uintptr]bool{nil, {}, {44: false, 33: true}} { + // fmt.Printf(">>>> running mammoth map v179: %v\n", v) + var v179v1, v179v2 map[uintptr]bool + v179v1 = v + bs179 := testMarshalErr(v179v1, h, t, "enc-map-v179") + if v == nil { + v179v2 = nil + } else { + v179v2 = make(map[uintptr]bool, len(v)) + } // reset map + testUnmarshalErr(v179v2, bs179, h, t, "dec-map-v179") + testDeepEqualErr(v179v1, v179v2, t, "equal-map-v179") + if v == nil { + v179v2 = nil + } else { + v179v2 = make(map[uintptr]bool, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v179v2), bs179, h, t, "dec-map-v179-noaddr") // decode into non-addressable map value + testDeepEqualErr(v179v1, v179v2, t, "equal-map-v179-noaddr") + if v == nil { + v179v2 = nil + } else { + v179v2 = make(map[uintptr]bool, len(v)) + } // reset map + testUnmarshalErr(&v179v2, bs179, h, t, "dec-map-v179-p-len") + testDeepEqualErr(v179v1, v179v2, t, "equal-map-v179-p-len") + bs179 = testMarshalErr(&v179v1, h, t, "enc-map-v179-p") + v179v2 = nil + testUnmarshalErr(&v179v2, bs179, h, t, "dec-map-v179-p-nil") + testDeepEqualErr(v179v1, v179v2, t, "equal-map-v179-p-nil") + // ... + if v == nil { + v179v2 = nil + } else { + v179v2 = make(map[uintptr]bool, len(v)) + } // reset map + var v179v3, v179v4 typMapMapUintptrBool + v179v3 = typMapMapUintptrBool(v179v1) + v179v4 = typMapMapUintptrBool(v179v2) + bs179 = testMarshalErr(v179v3, h, t, "enc-map-v179-custom") + testUnmarshalErr(v179v4, bs179, h, t, "dec-map-v179-p-len") + testDeepEqualErr(v179v3, v179v4, t, "equal-map-v179-p-len") + } + + for _, v := range []map[int]interface{}{nil, {}, {44: nil, 33: "string-is-an-interface-2"}} { + // fmt.Printf(">>>> running mammoth map v182: %v\n", v) + var v182v1, v182v2 map[int]interface{} + v182v1 = v + bs182 := testMarshalErr(v182v1, h, t, "enc-map-v182") + if v == nil { + v182v2 = nil + } else { + v182v2 = make(map[int]interface{}, len(v)) + } // reset map + testUnmarshalErr(v182v2, bs182, h, t, "dec-map-v182") + testDeepEqualErr(v182v1, v182v2, t, "equal-map-v182") + if v == nil { + v182v2 = nil + } else { + v182v2 = make(map[int]interface{}, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v182v2), bs182, h, t, "dec-map-v182-noaddr") // decode into non-addressable map value + testDeepEqualErr(v182v1, v182v2, t, "equal-map-v182-noaddr") + if v == nil { + v182v2 = nil + } else { + v182v2 = make(map[int]interface{}, len(v)) + } // reset map + testUnmarshalErr(&v182v2, bs182, h, t, "dec-map-v182-p-len") + testDeepEqualErr(v182v1, v182v2, t, "equal-map-v182-p-len") + bs182 = testMarshalErr(&v182v1, h, t, "enc-map-v182-p") + v182v2 = nil + testUnmarshalErr(&v182v2, bs182, h, t, "dec-map-v182-p-nil") + testDeepEqualErr(v182v1, v182v2, t, "equal-map-v182-p-nil") + // ... + if v == nil { + v182v2 = nil + } else { + v182v2 = make(map[int]interface{}, len(v)) + } // reset map + var v182v3, v182v4 typMapMapIntIntf + v182v3 = typMapMapIntIntf(v182v1) + v182v4 = typMapMapIntIntf(v182v2) + bs182 = testMarshalErr(v182v3, h, t, "enc-map-v182-custom") + testUnmarshalErr(v182v4, bs182, h, t, "dec-map-v182-p-len") + testDeepEqualErr(v182v3, v182v4, t, "equal-map-v182-p-len") + } + + for _, v := range []map[int]string{nil, {}, {44: "", 33: "some-string-2"}} { + // fmt.Printf(">>>> running mammoth map v183: %v\n", v) + var v183v1, v183v2 map[int]string + v183v1 = v + bs183 := testMarshalErr(v183v1, h, t, "enc-map-v183") + if v == nil { + v183v2 = nil + } else { + v183v2 = make(map[int]string, len(v)) + } // reset map + testUnmarshalErr(v183v2, bs183, h, t, "dec-map-v183") + testDeepEqualErr(v183v1, v183v2, t, "equal-map-v183") + if v == nil { + v183v2 = nil + } else { + v183v2 = make(map[int]string, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v183v2), bs183, h, t, "dec-map-v183-noaddr") // decode into non-addressable map value + testDeepEqualErr(v183v1, v183v2, t, "equal-map-v183-noaddr") + if v == nil { + v183v2 = nil + } else { + v183v2 = make(map[int]string, len(v)) + } // reset map + testUnmarshalErr(&v183v2, bs183, h, t, "dec-map-v183-p-len") + testDeepEqualErr(v183v1, v183v2, t, "equal-map-v183-p-len") + bs183 = testMarshalErr(&v183v1, h, t, "enc-map-v183-p") + v183v2 = nil + testUnmarshalErr(&v183v2, bs183, h, t, "dec-map-v183-p-nil") + testDeepEqualErr(v183v1, v183v2, t, "equal-map-v183-p-nil") + // ... + if v == nil { + v183v2 = nil + } else { + v183v2 = make(map[int]string, len(v)) + } // reset map + var v183v3, v183v4 typMapMapIntString + v183v3 = typMapMapIntString(v183v1) + v183v4 = typMapMapIntString(v183v2) + bs183 = testMarshalErr(v183v3, h, t, "enc-map-v183-custom") + testUnmarshalErr(v183v4, bs183, h, t, "dec-map-v183-p-len") + testDeepEqualErr(v183v3, v183v4, t, "equal-map-v183-p-len") + } + + for _, v := range []map[int]uint{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v184: %v\n", v) + var v184v1, v184v2 map[int]uint + v184v1 = v + bs184 := testMarshalErr(v184v1, h, t, "enc-map-v184") + if v == nil { + v184v2 = nil + } else { + v184v2 = make(map[int]uint, len(v)) + } // reset map + testUnmarshalErr(v184v2, bs184, h, t, "dec-map-v184") + testDeepEqualErr(v184v1, v184v2, t, "equal-map-v184") + if v == nil { + v184v2 = nil + } else { + v184v2 = make(map[int]uint, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v184v2), bs184, h, t, "dec-map-v184-noaddr") // decode into non-addressable map value + testDeepEqualErr(v184v1, v184v2, t, "equal-map-v184-noaddr") + if v == nil { + v184v2 = nil + } else { + v184v2 = make(map[int]uint, len(v)) + } // reset map + testUnmarshalErr(&v184v2, bs184, h, t, "dec-map-v184-p-len") + testDeepEqualErr(v184v1, v184v2, t, "equal-map-v184-p-len") + bs184 = testMarshalErr(&v184v1, h, t, "enc-map-v184-p") + v184v2 = nil + testUnmarshalErr(&v184v2, bs184, h, t, "dec-map-v184-p-nil") + testDeepEqualErr(v184v1, v184v2, t, "equal-map-v184-p-nil") + // ... + if v == nil { + v184v2 = nil + } else { + v184v2 = make(map[int]uint, len(v)) + } // reset map + var v184v3, v184v4 typMapMapIntUint + v184v3 = typMapMapIntUint(v184v1) + v184v4 = typMapMapIntUint(v184v2) + bs184 = testMarshalErr(v184v3, h, t, "enc-map-v184-custom") + testUnmarshalErr(v184v4, bs184, h, t, "dec-map-v184-p-len") + testDeepEqualErr(v184v3, v184v4, t, "equal-map-v184-p-len") + } + + for _, v := range []map[int]uint8{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v185: %v\n", v) + var v185v1, v185v2 map[int]uint8 + v185v1 = v + bs185 := testMarshalErr(v185v1, h, t, "enc-map-v185") + if v == nil { + v185v2 = nil + } else { + v185v2 = make(map[int]uint8, len(v)) + } // reset map + testUnmarshalErr(v185v2, bs185, h, t, "dec-map-v185") + testDeepEqualErr(v185v1, v185v2, t, "equal-map-v185") + if v == nil { + v185v2 = nil + } else { + v185v2 = make(map[int]uint8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v185v2), bs185, h, t, "dec-map-v185-noaddr") // decode into non-addressable map value + testDeepEqualErr(v185v1, v185v2, t, "equal-map-v185-noaddr") + if v == nil { + v185v2 = nil + } else { + v185v2 = make(map[int]uint8, len(v)) + } // reset map + testUnmarshalErr(&v185v2, bs185, h, t, "dec-map-v185-p-len") + testDeepEqualErr(v185v1, v185v2, t, "equal-map-v185-p-len") + bs185 = testMarshalErr(&v185v1, h, t, "enc-map-v185-p") + v185v2 = nil + testUnmarshalErr(&v185v2, bs185, h, t, "dec-map-v185-p-nil") + testDeepEqualErr(v185v1, v185v2, t, "equal-map-v185-p-nil") + // ... + if v == nil { + v185v2 = nil + } else { + v185v2 = make(map[int]uint8, len(v)) + } // reset map + var v185v3, v185v4 typMapMapIntUint8 + v185v3 = typMapMapIntUint8(v185v1) + v185v4 = typMapMapIntUint8(v185v2) + bs185 = testMarshalErr(v185v3, h, t, "enc-map-v185-custom") + testUnmarshalErr(v185v4, bs185, h, t, "dec-map-v185-p-len") + testDeepEqualErr(v185v3, v185v4, t, "equal-map-v185-p-len") + } + + for _, v := range []map[int]uint16{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v186: %v\n", v) + var v186v1, v186v2 map[int]uint16 + v186v1 = v + bs186 := testMarshalErr(v186v1, h, t, "enc-map-v186") + if v == nil { + v186v2 = nil + } else { + v186v2 = make(map[int]uint16, len(v)) + } // reset map + testUnmarshalErr(v186v2, bs186, h, t, "dec-map-v186") + testDeepEqualErr(v186v1, v186v2, t, "equal-map-v186") + if v == nil { + v186v2 = nil + } else { + v186v2 = make(map[int]uint16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v186v2), bs186, h, t, "dec-map-v186-noaddr") // decode into non-addressable map value + testDeepEqualErr(v186v1, v186v2, t, "equal-map-v186-noaddr") + if v == nil { + v186v2 = nil + } else { + v186v2 = make(map[int]uint16, len(v)) + } // reset map + testUnmarshalErr(&v186v2, bs186, h, t, "dec-map-v186-p-len") + testDeepEqualErr(v186v1, v186v2, t, "equal-map-v186-p-len") + bs186 = testMarshalErr(&v186v1, h, t, "enc-map-v186-p") + v186v2 = nil + testUnmarshalErr(&v186v2, bs186, h, t, "dec-map-v186-p-nil") + testDeepEqualErr(v186v1, v186v2, t, "equal-map-v186-p-nil") + // ... + if v == nil { + v186v2 = nil + } else { + v186v2 = make(map[int]uint16, len(v)) + } // reset map + var v186v3, v186v4 typMapMapIntUint16 + v186v3 = typMapMapIntUint16(v186v1) + v186v4 = typMapMapIntUint16(v186v2) + bs186 = testMarshalErr(v186v3, h, t, "enc-map-v186-custom") + testUnmarshalErr(v186v4, bs186, h, t, "dec-map-v186-p-len") + testDeepEqualErr(v186v3, v186v4, t, "equal-map-v186-p-len") + } + + for _, v := range []map[int]uint32{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v187: %v\n", v) + var v187v1, v187v2 map[int]uint32 + v187v1 = v + bs187 := testMarshalErr(v187v1, h, t, "enc-map-v187") + if v == nil { + v187v2 = nil + } else { + v187v2 = make(map[int]uint32, len(v)) + } // reset map + testUnmarshalErr(v187v2, bs187, h, t, "dec-map-v187") + testDeepEqualErr(v187v1, v187v2, t, "equal-map-v187") + if v == nil { + v187v2 = nil + } else { + v187v2 = make(map[int]uint32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v187v2), bs187, h, t, "dec-map-v187-noaddr") // decode into non-addressable map value + testDeepEqualErr(v187v1, v187v2, t, "equal-map-v187-noaddr") + if v == nil { + v187v2 = nil + } else { + v187v2 = make(map[int]uint32, len(v)) + } // reset map + testUnmarshalErr(&v187v2, bs187, h, t, "dec-map-v187-p-len") + testDeepEqualErr(v187v1, v187v2, t, "equal-map-v187-p-len") + bs187 = testMarshalErr(&v187v1, h, t, "enc-map-v187-p") + v187v2 = nil + testUnmarshalErr(&v187v2, bs187, h, t, "dec-map-v187-p-nil") + testDeepEqualErr(v187v1, v187v2, t, "equal-map-v187-p-nil") + // ... + if v == nil { + v187v2 = nil + } else { + v187v2 = make(map[int]uint32, len(v)) + } // reset map + var v187v3, v187v4 typMapMapIntUint32 + v187v3 = typMapMapIntUint32(v187v1) + v187v4 = typMapMapIntUint32(v187v2) + bs187 = testMarshalErr(v187v3, h, t, "enc-map-v187-custom") + testUnmarshalErr(v187v4, bs187, h, t, "dec-map-v187-p-len") + testDeepEqualErr(v187v3, v187v4, t, "equal-map-v187-p-len") + } + + for _, v := range []map[int]uint64{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v188: %v\n", v) + var v188v1, v188v2 map[int]uint64 + v188v1 = v + bs188 := testMarshalErr(v188v1, h, t, "enc-map-v188") + if v == nil { + v188v2 = nil + } else { + v188v2 = make(map[int]uint64, len(v)) + } // reset map + testUnmarshalErr(v188v2, bs188, h, t, "dec-map-v188") + testDeepEqualErr(v188v1, v188v2, t, "equal-map-v188") + if v == nil { + v188v2 = nil + } else { + v188v2 = make(map[int]uint64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v188v2), bs188, h, t, "dec-map-v188-noaddr") // decode into non-addressable map value + testDeepEqualErr(v188v1, v188v2, t, "equal-map-v188-noaddr") + if v == nil { + v188v2 = nil + } else { + v188v2 = make(map[int]uint64, len(v)) + } // reset map + testUnmarshalErr(&v188v2, bs188, h, t, "dec-map-v188-p-len") + testDeepEqualErr(v188v1, v188v2, t, "equal-map-v188-p-len") + bs188 = testMarshalErr(&v188v1, h, t, "enc-map-v188-p") + v188v2 = nil + testUnmarshalErr(&v188v2, bs188, h, t, "dec-map-v188-p-nil") + testDeepEqualErr(v188v1, v188v2, t, "equal-map-v188-p-nil") + // ... + if v == nil { + v188v2 = nil + } else { + v188v2 = make(map[int]uint64, len(v)) + } // reset map + var v188v3, v188v4 typMapMapIntUint64 + v188v3 = typMapMapIntUint64(v188v1) + v188v4 = typMapMapIntUint64(v188v2) + bs188 = testMarshalErr(v188v3, h, t, "enc-map-v188-custom") + testUnmarshalErr(v188v4, bs188, h, t, "dec-map-v188-p-len") + testDeepEqualErr(v188v3, v188v4, t, "equal-map-v188-p-len") + } + + for _, v := range []map[int]uintptr{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v189: %v\n", v) + var v189v1, v189v2 map[int]uintptr + v189v1 = v + bs189 := testMarshalErr(v189v1, h, t, "enc-map-v189") + if v == nil { + v189v2 = nil + } else { + v189v2 = make(map[int]uintptr, len(v)) + } // reset map + testUnmarshalErr(v189v2, bs189, h, t, "dec-map-v189") + testDeepEqualErr(v189v1, v189v2, t, "equal-map-v189") + if v == nil { + v189v2 = nil + } else { + v189v2 = make(map[int]uintptr, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v189v2), bs189, h, t, "dec-map-v189-noaddr") // decode into non-addressable map value + testDeepEqualErr(v189v1, v189v2, t, "equal-map-v189-noaddr") + if v == nil { + v189v2 = nil + } else { + v189v2 = make(map[int]uintptr, len(v)) + } // reset map + testUnmarshalErr(&v189v2, bs189, h, t, "dec-map-v189-p-len") + testDeepEqualErr(v189v1, v189v2, t, "equal-map-v189-p-len") + bs189 = testMarshalErr(&v189v1, h, t, "enc-map-v189-p") + v189v2 = nil + testUnmarshalErr(&v189v2, bs189, h, t, "dec-map-v189-p-nil") + testDeepEqualErr(v189v1, v189v2, t, "equal-map-v189-p-nil") + // ... + if v == nil { + v189v2 = nil + } else { + v189v2 = make(map[int]uintptr, len(v)) + } // reset map + var v189v3, v189v4 typMapMapIntUintptr + v189v3 = typMapMapIntUintptr(v189v1) + v189v4 = typMapMapIntUintptr(v189v2) + bs189 = testMarshalErr(v189v3, h, t, "enc-map-v189-custom") + testUnmarshalErr(v189v4, bs189, h, t, "dec-map-v189-p-len") + testDeepEqualErr(v189v3, v189v4, t, "equal-map-v189-p-len") + } + + for _, v := range []map[int]int{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v190: %v\n", v) + var v190v1, v190v2 map[int]int + v190v1 = v + bs190 := testMarshalErr(v190v1, h, t, "enc-map-v190") + if v == nil { + v190v2 = nil + } else { + v190v2 = make(map[int]int, len(v)) + } // reset map + testUnmarshalErr(v190v2, bs190, h, t, "dec-map-v190") + testDeepEqualErr(v190v1, v190v2, t, "equal-map-v190") + if v == nil { + v190v2 = nil + } else { + v190v2 = make(map[int]int, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v190v2), bs190, h, t, "dec-map-v190-noaddr") // decode into non-addressable map value + testDeepEqualErr(v190v1, v190v2, t, "equal-map-v190-noaddr") + if v == nil { + v190v2 = nil + } else { + v190v2 = make(map[int]int, len(v)) + } // reset map + testUnmarshalErr(&v190v2, bs190, h, t, "dec-map-v190-p-len") + testDeepEqualErr(v190v1, v190v2, t, "equal-map-v190-p-len") + bs190 = testMarshalErr(&v190v1, h, t, "enc-map-v190-p") + v190v2 = nil + testUnmarshalErr(&v190v2, bs190, h, t, "dec-map-v190-p-nil") + testDeepEqualErr(v190v1, v190v2, t, "equal-map-v190-p-nil") + // ... + if v == nil { + v190v2 = nil + } else { + v190v2 = make(map[int]int, len(v)) + } // reset map + var v190v3, v190v4 typMapMapIntInt + v190v3 = typMapMapIntInt(v190v1) + v190v4 = typMapMapIntInt(v190v2) + bs190 = testMarshalErr(v190v3, h, t, "enc-map-v190-custom") + testUnmarshalErr(v190v4, bs190, h, t, "dec-map-v190-p-len") + testDeepEqualErr(v190v3, v190v4, t, "equal-map-v190-p-len") + } + + for _, v := range []map[int]int8{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v191: %v\n", v) + var v191v1, v191v2 map[int]int8 + v191v1 = v + bs191 := testMarshalErr(v191v1, h, t, "enc-map-v191") + if v == nil { + v191v2 = nil + } else { + v191v2 = make(map[int]int8, len(v)) + } // reset map + testUnmarshalErr(v191v2, bs191, h, t, "dec-map-v191") + testDeepEqualErr(v191v1, v191v2, t, "equal-map-v191") + if v == nil { + v191v2 = nil + } else { + v191v2 = make(map[int]int8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v191v2), bs191, h, t, "dec-map-v191-noaddr") // decode into non-addressable map value + testDeepEqualErr(v191v1, v191v2, t, "equal-map-v191-noaddr") + if v == nil { + v191v2 = nil + } else { + v191v2 = make(map[int]int8, len(v)) + } // reset map + testUnmarshalErr(&v191v2, bs191, h, t, "dec-map-v191-p-len") + testDeepEqualErr(v191v1, v191v2, t, "equal-map-v191-p-len") + bs191 = testMarshalErr(&v191v1, h, t, "enc-map-v191-p") + v191v2 = nil + testUnmarshalErr(&v191v2, bs191, h, t, "dec-map-v191-p-nil") + testDeepEqualErr(v191v1, v191v2, t, "equal-map-v191-p-nil") + // ... + if v == nil { + v191v2 = nil + } else { + v191v2 = make(map[int]int8, len(v)) + } // reset map + var v191v3, v191v4 typMapMapIntInt8 + v191v3 = typMapMapIntInt8(v191v1) + v191v4 = typMapMapIntInt8(v191v2) + bs191 = testMarshalErr(v191v3, h, t, "enc-map-v191-custom") + testUnmarshalErr(v191v4, bs191, h, t, "dec-map-v191-p-len") + testDeepEqualErr(v191v3, v191v4, t, "equal-map-v191-p-len") + } + + for _, v := range []map[int]int16{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v192: %v\n", v) + var v192v1, v192v2 map[int]int16 + v192v1 = v + bs192 := testMarshalErr(v192v1, h, t, "enc-map-v192") + if v == nil { + v192v2 = nil + } else { + v192v2 = make(map[int]int16, len(v)) + } // reset map + testUnmarshalErr(v192v2, bs192, h, t, "dec-map-v192") + testDeepEqualErr(v192v1, v192v2, t, "equal-map-v192") + if v == nil { + v192v2 = nil + } else { + v192v2 = make(map[int]int16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v192v2), bs192, h, t, "dec-map-v192-noaddr") // decode into non-addressable map value + testDeepEqualErr(v192v1, v192v2, t, "equal-map-v192-noaddr") + if v == nil { + v192v2 = nil + } else { + v192v2 = make(map[int]int16, len(v)) + } // reset map + testUnmarshalErr(&v192v2, bs192, h, t, "dec-map-v192-p-len") + testDeepEqualErr(v192v1, v192v2, t, "equal-map-v192-p-len") + bs192 = testMarshalErr(&v192v1, h, t, "enc-map-v192-p") + v192v2 = nil + testUnmarshalErr(&v192v2, bs192, h, t, "dec-map-v192-p-nil") + testDeepEqualErr(v192v1, v192v2, t, "equal-map-v192-p-nil") + // ... + if v == nil { + v192v2 = nil + } else { + v192v2 = make(map[int]int16, len(v)) + } // reset map + var v192v3, v192v4 typMapMapIntInt16 + v192v3 = typMapMapIntInt16(v192v1) + v192v4 = typMapMapIntInt16(v192v2) + bs192 = testMarshalErr(v192v3, h, t, "enc-map-v192-custom") + testUnmarshalErr(v192v4, bs192, h, t, "dec-map-v192-p-len") + testDeepEqualErr(v192v3, v192v4, t, "equal-map-v192-p-len") + } + + for _, v := range []map[int]int32{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v193: %v\n", v) + var v193v1, v193v2 map[int]int32 + v193v1 = v + bs193 := testMarshalErr(v193v1, h, t, "enc-map-v193") + if v == nil { + v193v2 = nil + } else { + v193v2 = make(map[int]int32, len(v)) + } // reset map + testUnmarshalErr(v193v2, bs193, h, t, "dec-map-v193") + testDeepEqualErr(v193v1, v193v2, t, "equal-map-v193") + if v == nil { + v193v2 = nil + } else { + v193v2 = make(map[int]int32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v193v2), bs193, h, t, "dec-map-v193-noaddr") // decode into non-addressable map value + testDeepEqualErr(v193v1, v193v2, t, "equal-map-v193-noaddr") + if v == nil { + v193v2 = nil + } else { + v193v2 = make(map[int]int32, len(v)) + } // reset map + testUnmarshalErr(&v193v2, bs193, h, t, "dec-map-v193-p-len") + testDeepEqualErr(v193v1, v193v2, t, "equal-map-v193-p-len") + bs193 = testMarshalErr(&v193v1, h, t, "enc-map-v193-p") + v193v2 = nil + testUnmarshalErr(&v193v2, bs193, h, t, "dec-map-v193-p-nil") + testDeepEqualErr(v193v1, v193v2, t, "equal-map-v193-p-nil") + // ... + if v == nil { + v193v2 = nil + } else { + v193v2 = make(map[int]int32, len(v)) + } // reset map + var v193v3, v193v4 typMapMapIntInt32 + v193v3 = typMapMapIntInt32(v193v1) + v193v4 = typMapMapIntInt32(v193v2) + bs193 = testMarshalErr(v193v3, h, t, "enc-map-v193-custom") + testUnmarshalErr(v193v4, bs193, h, t, "dec-map-v193-p-len") + testDeepEqualErr(v193v3, v193v4, t, "equal-map-v193-p-len") + } + + for _, v := range []map[int]int64{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v194: %v\n", v) + var v194v1, v194v2 map[int]int64 + v194v1 = v + bs194 := testMarshalErr(v194v1, h, t, "enc-map-v194") + if v == nil { + v194v2 = nil + } else { + v194v2 = make(map[int]int64, len(v)) + } // reset map + testUnmarshalErr(v194v2, bs194, h, t, "dec-map-v194") + testDeepEqualErr(v194v1, v194v2, t, "equal-map-v194") + if v == nil { + v194v2 = nil + } else { + v194v2 = make(map[int]int64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v194v2), bs194, h, t, "dec-map-v194-noaddr") // decode into non-addressable map value + testDeepEqualErr(v194v1, v194v2, t, "equal-map-v194-noaddr") + if v == nil { + v194v2 = nil + } else { + v194v2 = make(map[int]int64, len(v)) + } // reset map + testUnmarshalErr(&v194v2, bs194, h, t, "dec-map-v194-p-len") + testDeepEqualErr(v194v1, v194v2, t, "equal-map-v194-p-len") + bs194 = testMarshalErr(&v194v1, h, t, "enc-map-v194-p") + v194v2 = nil + testUnmarshalErr(&v194v2, bs194, h, t, "dec-map-v194-p-nil") + testDeepEqualErr(v194v1, v194v2, t, "equal-map-v194-p-nil") + // ... + if v == nil { + v194v2 = nil + } else { + v194v2 = make(map[int]int64, len(v)) + } // reset map + var v194v3, v194v4 typMapMapIntInt64 + v194v3 = typMapMapIntInt64(v194v1) + v194v4 = typMapMapIntInt64(v194v2) + bs194 = testMarshalErr(v194v3, h, t, "enc-map-v194-custom") + testUnmarshalErr(v194v4, bs194, h, t, "dec-map-v194-p-len") + testDeepEqualErr(v194v3, v194v4, t, "equal-map-v194-p-len") + } + + for _, v := range []map[int]float32{nil, {}, {33: 0, 44: 22.2}} { + // fmt.Printf(">>>> running mammoth map v195: %v\n", v) + var v195v1, v195v2 map[int]float32 + v195v1 = v + bs195 := testMarshalErr(v195v1, h, t, "enc-map-v195") + if v == nil { + v195v2 = nil + } else { + v195v2 = make(map[int]float32, len(v)) + } // reset map + testUnmarshalErr(v195v2, bs195, h, t, "dec-map-v195") + testDeepEqualErr(v195v1, v195v2, t, "equal-map-v195") + if v == nil { + v195v2 = nil + } else { + v195v2 = make(map[int]float32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v195v2), bs195, h, t, "dec-map-v195-noaddr") // decode into non-addressable map value + testDeepEqualErr(v195v1, v195v2, t, "equal-map-v195-noaddr") + if v == nil { + v195v2 = nil + } else { + v195v2 = make(map[int]float32, len(v)) + } // reset map + testUnmarshalErr(&v195v2, bs195, h, t, "dec-map-v195-p-len") + testDeepEqualErr(v195v1, v195v2, t, "equal-map-v195-p-len") + bs195 = testMarshalErr(&v195v1, h, t, "enc-map-v195-p") + v195v2 = nil + testUnmarshalErr(&v195v2, bs195, h, t, "dec-map-v195-p-nil") + testDeepEqualErr(v195v1, v195v2, t, "equal-map-v195-p-nil") + // ... + if v == nil { + v195v2 = nil + } else { + v195v2 = make(map[int]float32, len(v)) + } // reset map + var v195v3, v195v4 typMapMapIntFloat32 + v195v3 = typMapMapIntFloat32(v195v1) + v195v4 = typMapMapIntFloat32(v195v2) + bs195 = testMarshalErr(v195v3, h, t, "enc-map-v195-custom") + testUnmarshalErr(v195v4, bs195, h, t, "dec-map-v195-p-len") + testDeepEqualErr(v195v3, v195v4, t, "equal-map-v195-p-len") + } + + for _, v := range []map[int]float64{nil, {}, {33: 0, 44: 11.1}} { + // fmt.Printf(">>>> running mammoth map v196: %v\n", v) + var v196v1, v196v2 map[int]float64 + v196v1 = v + bs196 := testMarshalErr(v196v1, h, t, "enc-map-v196") + if v == nil { + v196v2 = nil + } else { + v196v2 = make(map[int]float64, len(v)) + } // reset map + testUnmarshalErr(v196v2, bs196, h, t, "dec-map-v196") + testDeepEqualErr(v196v1, v196v2, t, "equal-map-v196") + if v == nil { + v196v2 = nil + } else { + v196v2 = make(map[int]float64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v196v2), bs196, h, t, "dec-map-v196-noaddr") // decode into non-addressable map value + testDeepEqualErr(v196v1, v196v2, t, "equal-map-v196-noaddr") + if v == nil { + v196v2 = nil + } else { + v196v2 = make(map[int]float64, len(v)) + } // reset map + testUnmarshalErr(&v196v2, bs196, h, t, "dec-map-v196-p-len") + testDeepEqualErr(v196v1, v196v2, t, "equal-map-v196-p-len") + bs196 = testMarshalErr(&v196v1, h, t, "enc-map-v196-p") + v196v2 = nil + testUnmarshalErr(&v196v2, bs196, h, t, "dec-map-v196-p-nil") + testDeepEqualErr(v196v1, v196v2, t, "equal-map-v196-p-nil") + // ... + if v == nil { + v196v2 = nil + } else { + v196v2 = make(map[int]float64, len(v)) + } // reset map + var v196v3, v196v4 typMapMapIntFloat64 + v196v3 = typMapMapIntFloat64(v196v1) + v196v4 = typMapMapIntFloat64(v196v2) + bs196 = testMarshalErr(v196v3, h, t, "enc-map-v196-custom") + testUnmarshalErr(v196v4, bs196, h, t, "dec-map-v196-p-len") + testDeepEqualErr(v196v3, v196v4, t, "equal-map-v196-p-len") + } + + for _, v := range []map[int]bool{nil, {}, {33: false, 44: true}} { + // fmt.Printf(">>>> running mammoth map v197: %v\n", v) + var v197v1, v197v2 map[int]bool + v197v1 = v + bs197 := testMarshalErr(v197v1, h, t, "enc-map-v197") + if v == nil { + v197v2 = nil + } else { + v197v2 = make(map[int]bool, len(v)) + } // reset map + testUnmarshalErr(v197v2, bs197, h, t, "dec-map-v197") + testDeepEqualErr(v197v1, v197v2, t, "equal-map-v197") + if v == nil { + v197v2 = nil + } else { + v197v2 = make(map[int]bool, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v197v2), bs197, h, t, "dec-map-v197-noaddr") // decode into non-addressable map value + testDeepEqualErr(v197v1, v197v2, t, "equal-map-v197-noaddr") + if v == nil { + v197v2 = nil + } else { + v197v2 = make(map[int]bool, len(v)) + } // reset map + testUnmarshalErr(&v197v2, bs197, h, t, "dec-map-v197-p-len") + testDeepEqualErr(v197v1, v197v2, t, "equal-map-v197-p-len") + bs197 = testMarshalErr(&v197v1, h, t, "enc-map-v197-p") + v197v2 = nil + testUnmarshalErr(&v197v2, bs197, h, t, "dec-map-v197-p-nil") + testDeepEqualErr(v197v1, v197v2, t, "equal-map-v197-p-nil") + // ... + if v == nil { + v197v2 = nil + } else { + v197v2 = make(map[int]bool, len(v)) + } // reset map + var v197v3, v197v4 typMapMapIntBool + v197v3 = typMapMapIntBool(v197v1) + v197v4 = typMapMapIntBool(v197v2) + bs197 = testMarshalErr(v197v3, h, t, "enc-map-v197-custom") + testUnmarshalErr(v197v4, bs197, h, t, "dec-map-v197-p-len") + testDeepEqualErr(v197v3, v197v4, t, "equal-map-v197-p-len") + } + + for _, v := range []map[int8]interface{}{nil, {}, {33: nil, 44: "string-is-an-interface"}} { + // fmt.Printf(">>>> running mammoth map v200: %v\n", v) + var v200v1, v200v2 map[int8]interface{} + v200v1 = v + bs200 := testMarshalErr(v200v1, h, t, "enc-map-v200") + if v == nil { + v200v2 = nil + } else { + v200v2 = make(map[int8]interface{}, len(v)) + } // reset map + testUnmarshalErr(v200v2, bs200, h, t, "dec-map-v200") + testDeepEqualErr(v200v1, v200v2, t, "equal-map-v200") + if v == nil { + v200v2 = nil + } else { + v200v2 = make(map[int8]interface{}, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v200v2), bs200, h, t, "dec-map-v200-noaddr") // decode into non-addressable map value + testDeepEqualErr(v200v1, v200v2, t, "equal-map-v200-noaddr") + if v == nil { + v200v2 = nil + } else { + v200v2 = make(map[int8]interface{}, len(v)) + } // reset map + testUnmarshalErr(&v200v2, bs200, h, t, "dec-map-v200-p-len") + testDeepEqualErr(v200v1, v200v2, t, "equal-map-v200-p-len") + bs200 = testMarshalErr(&v200v1, h, t, "enc-map-v200-p") + v200v2 = nil + testUnmarshalErr(&v200v2, bs200, h, t, "dec-map-v200-p-nil") + testDeepEqualErr(v200v1, v200v2, t, "equal-map-v200-p-nil") + // ... + if v == nil { + v200v2 = nil + } else { + v200v2 = make(map[int8]interface{}, len(v)) + } // reset map + var v200v3, v200v4 typMapMapInt8Intf + v200v3 = typMapMapInt8Intf(v200v1) + v200v4 = typMapMapInt8Intf(v200v2) + bs200 = testMarshalErr(v200v3, h, t, "enc-map-v200-custom") + testUnmarshalErr(v200v4, bs200, h, t, "dec-map-v200-p-len") + testDeepEqualErr(v200v3, v200v4, t, "equal-map-v200-p-len") + } + + for _, v := range []map[int8]string{nil, {}, {33: "", 44: "some-string"}} { + // fmt.Printf(">>>> running mammoth map v201: %v\n", v) + var v201v1, v201v2 map[int8]string + v201v1 = v + bs201 := testMarshalErr(v201v1, h, t, "enc-map-v201") + if v == nil { + v201v2 = nil + } else { + v201v2 = make(map[int8]string, len(v)) + } // reset map + testUnmarshalErr(v201v2, bs201, h, t, "dec-map-v201") + testDeepEqualErr(v201v1, v201v2, t, "equal-map-v201") + if v == nil { + v201v2 = nil + } else { + v201v2 = make(map[int8]string, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v201v2), bs201, h, t, "dec-map-v201-noaddr") // decode into non-addressable map value + testDeepEqualErr(v201v1, v201v2, t, "equal-map-v201-noaddr") + if v == nil { + v201v2 = nil + } else { + v201v2 = make(map[int8]string, len(v)) + } // reset map + testUnmarshalErr(&v201v2, bs201, h, t, "dec-map-v201-p-len") + testDeepEqualErr(v201v1, v201v2, t, "equal-map-v201-p-len") + bs201 = testMarshalErr(&v201v1, h, t, "enc-map-v201-p") + v201v2 = nil + testUnmarshalErr(&v201v2, bs201, h, t, "dec-map-v201-p-nil") + testDeepEqualErr(v201v1, v201v2, t, "equal-map-v201-p-nil") + // ... + if v == nil { + v201v2 = nil + } else { + v201v2 = make(map[int8]string, len(v)) + } // reset map + var v201v3, v201v4 typMapMapInt8String + v201v3 = typMapMapInt8String(v201v1) + v201v4 = typMapMapInt8String(v201v2) + bs201 = testMarshalErr(v201v3, h, t, "enc-map-v201-custom") + testUnmarshalErr(v201v4, bs201, h, t, "dec-map-v201-p-len") + testDeepEqualErr(v201v3, v201v4, t, "equal-map-v201-p-len") + } + + for _, v := range []map[int8]uint{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v202: %v\n", v) + var v202v1, v202v2 map[int8]uint + v202v1 = v + bs202 := testMarshalErr(v202v1, h, t, "enc-map-v202") + if v == nil { + v202v2 = nil + } else { + v202v2 = make(map[int8]uint, len(v)) + } // reset map + testUnmarshalErr(v202v2, bs202, h, t, "dec-map-v202") + testDeepEqualErr(v202v1, v202v2, t, "equal-map-v202") + if v == nil { + v202v2 = nil + } else { + v202v2 = make(map[int8]uint, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v202v2), bs202, h, t, "dec-map-v202-noaddr") // decode into non-addressable map value + testDeepEqualErr(v202v1, v202v2, t, "equal-map-v202-noaddr") + if v == nil { + v202v2 = nil + } else { + v202v2 = make(map[int8]uint, len(v)) + } // reset map + testUnmarshalErr(&v202v2, bs202, h, t, "dec-map-v202-p-len") + testDeepEqualErr(v202v1, v202v2, t, "equal-map-v202-p-len") + bs202 = testMarshalErr(&v202v1, h, t, "enc-map-v202-p") + v202v2 = nil + testUnmarshalErr(&v202v2, bs202, h, t, "dec-map-v202-p-nil") + testDeepEqualErr(v202v1, v202v2, t, "equal-map-v202-p-nil") + // ... + if v == nil { + v202v2 = nil + } else { + v202v2 = make(map[int8]uint, len(v)) + } // reset map + var v202v3, v202v4 typMapMapInt8Uint + v202v3 = typMapMapInt8Uint(v202v1) + v202v4 = typMapMapInt8Uint(v202v2) + bs202 = testMarshalErr(v202v3, h, t, "enc-map-v202-custom") + testUnmarshalErr(v202v4, bs202, h, t, "dec-map-v202-p-len") + testDeepEqualErr(v202v3, v202v4, t, "equal-map-v202-p-len") + } + + for _, v := range []map[int8]uint8{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v203: %v\n", v) + var v203v1, v203v2 map[int8]uint8 + v203v1 = v + bs203 := testMarshalErr(v203v1, h, t, "enc-map-v203") + if v == nil { + v203v2 = nil + } else { + v203v2 = make(map[int8]uint8, len(v)) + } // reset map + testUnmarshalErr(v203v2, bs203, h, t, "dec-map-v203") + testDeepEqualErr(v203v1, v203v2, t, "equal-map-v203") + if v == nil { + v203v2 = nil + } else { + v203v2 = make(map[int8]uint8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v203v2), bs203, h, t, "dec-map-v203-noaddr") // decode into non-addressable map value + testDeepEqualErr(v203v1, v203v2, t, "equal-map-v203-noaddr") + if v == nil { + v203v2 = nil + } else { + v203v2 = make(map[int8]uint8, len(v)) + } // reset map + testUnmarshalErr(&v203v2, bs203, h, t, "dec-map-v203-p-len") + testDeepEqualErr(v203v1, v203v2, t, "equal-map-v203-p-len") + bs203 = testMarshalErr(&v203v1, h, t, "enc-map-v203-p") + v203v2 = nil + testUnmarshalErr(&v203v2, bs203, h, t, "dec-map-v203-p-nil") + testDeepEqualErr(v203v1, v203v2, t, "equal-map-v203-p-nil") + // ... + if v == nil { + v203v2 = nil + } else { + v203v2 = make(map[int8]uint8, len(v)) + } // reset map + var v203v3, v203v4 typMapMapInt8Uint8 + v203v3 = typMapMapInt8Uint8(v203v1) + v203v4 = typMapMapInt8Uint8(v203v2) + bs203 = testMarshalErr(v203v3, h, t, "enc-map-v203-custom") + testUnmarshalErr(v203v4, bs203, h, t, "dec-map-v203-p-len") + testDeepEqualErr(v203v3, v203v4, t, "equal-map-v203-p-len") + } + + for _, v := range []map[int8]uint16{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v204: %v\n", v) + var v204v1, v204v2 map[int8]uint16 + v204v1 = v + bs204 := testMarshalErr(v204v1, h, t, "enc-map-v204") + if v == nil { + v204v2 = nil + } else { + v204v2 = make(map[int8]uint16, len(v)) + } // reset map + testUnmarshalErr(v204v2, bs204, h, t, "dec-map-v204") + testDeepEqualErr(v204v1, v204v2, t, "equal-map-v204") + if v == nil { + v204v2 = nil + } else { + v204v2 = make(map[int8]uint16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v204v2), bs204, h, t, "dec-map-v204-noaddr") // decode into non-addressable map value + testDeepEqualErr(v204v1, v204v2, t, "equal-map-v204-noaddr") + if v == nil { + v204v2 = nil + } else { + v204v2 = make(map[int8]uint16, len(v)) + } // reset map + testUnmarshalErr(&v204v2, bs204, h, t, "dec-map-v204-p-len") + testDeepEqualErr(v204v1, v204v2, t, "equal-map-v204-p-len") + bs204 = testMarshalErr(&v204v1, h, t, "enc-map-v204-p") + v204v2 = nil + testUnmarshalErr(&v204v2, bs204, h, t, "dec-map-v204-p-nil") + testDeepEqualErr(v204v1, v204v2, t, "equal-map-v204-p-nil") + // ... + if v == nil { + v204v2 = nil + } else { + v204v2 = make(map[int8]uint16, len(v)) + } // reset map + var v204v3, v204v4 typMapMapInt8Uint16 + v204v3 = typMapMapInt8Uint16(v204v1) + v204v4 = typMapMapInt8Uint16(v204v2) + bs204 = testMarshalErr(v204v3, h, t, "enc-map-v204-custom") + testUnmarshalErr(v204v4, bs204, h, t, "dec-map-v204-p-len") + testDeepEqualErr(v204v3, v204v4, t, "equal-map-v204-p-len") + } + + for _, v := range []map[int8]uint32{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v205: %v\n", v) + var v205v1, v205v2 map[int8]uint32 + v205v1 = v + bs205 := testMarshalErr(v205v1, h, t, "enc-map-v205") + if v == nil { + v205v2 = nil + } else { + v205v2 = make(map[int8]uint32, len(v)) + } // reset map + testUnmarshalErr(v205v2, bs205, h, t, "dec-map-v205") + testDeepEqualErr(v205v1, v205v2, t, "equal-map-v205") + if v == nil { + v205v2 = nil + } else { + v205v2 = make(map[int8]uint32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v205v2), bs205, h, t, "dec-map-v205-noaddr") // decode into non-addressable map value + testDeepEqualErr(v205v1, v205v2, t, "equal-map-v205-noaddr") + if v == nil { + v205v2 = nil + } else { + v205v2 = make(map[int8]uint32, len(v)) + } // reset map + testUnmarshalErr(&v205v2, bs205, h, t, "dec-map-v205-p-len") + testDeepEqualErr(v205v1, v205v2, t, "equal-map-v205-p-len") + bs205 = testMarshalErr(&v205v1, h, t, "enc-map-v205-p") + v205v2 = nil + testUnmarshalErr(&v205v2, bs205, h, t, "dec-map-v205-p-nil") + testDeepEqualErr(v205v1, v205v2, t, "equal-map-v205-p-nil") + // ... + if v == nil { + v205v2 = nil + } else { + v205v2 = make(map[int8]uint32, len(v)) + } // reset map + var v205v3, v205v4 typMapMapInt8Uint32 + v205v3 = typMapMapInt8Uint32(v205v1) + v205v4 = typMapMapInt8Uint32(v205v2) + bs205 = testMarshalErr(v205v3, h, t, "enc-map-v205-custom") + testUnmarshalErr(v205v4, bs205, h, t, "dec-map-v205-p-len") + testDeepEqualErr(v205v3, v205v4, t, "equal-map-v205-p-len") + } + + for _, v := range []map[int8]uint64{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v206: %v\n", v) + var v206v1, v206v2 map[int8]uint64 + v206v1 = v + bs206 := testMarshalErr(v206v1, h, t, "enc-map-v206") + if v == nil { + v206v2 = nil + } else { + v206v2 = make(map[int8]uint64, len(v)) + } // reset map + testUnmarshalErr(v206v2, bs206, h, t, "dec-map-v206") + testDeepEqualErr(v206v1, v206v2, t, "equal-map-v206") + if v == nil { + v206v2 = nil + } else { + v206v2 = make(map[int8]uint64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v206v2), bs206, h, t, "dec-map-v206-noaddr") // decode into non-addressable map value + testDeepEqualErr(v206v1, v206v2, t, "equal-map-v206-noaddr") + if v == nil { + v206v2 = nil + } else { + v206v2 = make(map[int8]uint64, len(v)) + } // reset map + testUnmarshalErr(&v206v2, bs206, h, t, "dec-map-v206-p-len") + testDeepEqualErr(v206v1, v206v2, t, "equal-map-v206-p-len") + bs206 = testMarshalErr(&v206v1, h, t, "enc-map-v206-p") + v206v2 = nil + testUnmarshalErr(&v206v2, bs206, h, t, "dec-map-v206-p-nil") + testDeepEqualErr(v206v1, v206v2, t, "equal-map-v206-p-nil") + // ... + if v == nil { + v206v2 = nil + } else { + v206v2 = make(map[int8]uint64, len(v)) + } // reset map + var v206v3, v206v4 typMapMapInt8Uint64 + v206v3 = typMapMapInt8Uint64(v206v1) + v206v4 = typMapMapInt8Uint64(v206v2) + bs206 = testMarshalErr(v206v3, h, t, "enc-map-v206-custom") + testUnmarshalErr(v206v4, bs206, h, t, "dec-map-v206-p-len") + testDeepEqualErr(v206v3, v206v4, t, "equal-map-v206-p-len") + } + + for _, v := range []map[int8]uintptr{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v207: %v\n", v) + var v207v1, v207v2 map[int8]uintptr + v207v1 = v + bs207 := testMarshalErr(v207v1, h, t, "enc-map-v207") + if v == nil { + v207v2 = nil + } else { + v207v2 = make(map[int8]uintptr, len(v)) + } // reset map + testUnmarshalErr(v207v2, bs207, h, t, "dec-map-v207") + testDeepEqualErr(v207v1, v207v2, t, "equal-map-v207") + if v == nil { + v207v2 = nil + } else { + v207v2 = make(map[int8]uintptr, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v207v2), bs207, h, t, "dec-map-v207-noaddr") // decode into non-addressable map value + testDeepEqualErr(v207v1, v207v2, t, "equal-map-v207-noaddr") + if v == nil { + v207v2 = nil + } else { + v207v2 = make(map[int8]uintptr, len(v)) + } // reset map + testUnmarshalErr(&v207v2, bs207, h, t, "dec-map-v207-p-len") + testDeepEqualErr(v207v1, v207v2, t, "equal-map-v207-p-len") + bs207 = testMarshalErr(&v207v1, h, t, "enc-map-v207-p") + v207v2 = nil + testUnmarshalErr(&v207v2, bs207, h, t, "dec-map-v207-p-nil") + testDeepEqualErr(v207v1, v207v2, t, "equal-map-v207-p-nil") + // ... + if v == nil { + v207v2 = nil + } else { + v207v2 = make(map[int8]uintptr, len(v)) + } // reset map + var v207v3, v207v4 typMapMapInt8Uintptr + v207v3 = typMapMapInt8Uintptr(v207v1) + v207v4 = typMapMapInt8Uintptr(v207v2) + bs207 = testMarshalErr(v207v3, h, t, "enc-map-v207-custom") + testUnmarshalErr(v207v4, bs207, h, t, "dec-map-v207-p-len") + testDeepEqualErr(v207v3, v207v4, t, "equal-map-v207-p-len") + } + + for _, v := range []map[int8]int{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v208: %v\n", v) + var v208v1, v208v2 map[int8]int + v208v1 = v + bs208 := testMarshalErr(v208v1, h, t, "enc-map-v208") + if v == nil { + v208v2 = nil + } else { + v208v2 = make(map[int8]int, len(v)) + } // reset map + testUnmarshalErr(v208v2, bs208, h, t, "dec-map-v208") + testDeepEqualErr(v208v1, v208v2, t, "equal-map-v208") + if v == nil { + v208v2 = nil + } else { + v208v2 = make(map[int8]int, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v208v2), bs208, h, t, "dec-map-v208-noaddr") // decode into non-addressable map value + testDeepEqualErr(v208v1, v208v2, t, "equal-map-v208-noaddr") + if v == nil { + v208v2 = nil + } else { + v208v2 = make(map[int8]int, len(v)) + } // reset map + testUnmarshalErr(&v208v2, bs208, h, t, "dec-map-v208-p-len") + testDeepEqualErr(v208v1, v208v2, t, "equal-map-v208-p-len") + bs208 = testMarshalErr(&v208v1, h, t, "enc-map-v208-p") + v208v2 = nil + testUnmarshalErr(&v208v2, bs208, h, t, "dec-map-v208-p-nil") + testDeepEqualErr(v208v1, v208v2, t, "equal-map-v208-p-nil") + // ... + if v == nil { + v208v2 = nil + } else { + v208v2 = make(map[int8]int, len(v)) + } // reset map + var v208v3, v208v4 typMapMapInt8Int + v208v3 = typMapMapInt8Int(v208v1) + v208v4 = typMapMapInt8Int(v208v2) + bs208 = testMarshalErr(v208v3, h, t, "enc-map-v208-custom") + testUnmarshalErr(v208v4, bs208, h, t, "dec-map-v208-p-len") + testDeepEqualErr(v208v3, v208v4, t, "equal-map-v208-p-len") + } + + for _, v := range []map[int8]int8{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v209: %v\n", v) + var v209v1, v209v2 map[int8]int8 + v209v1 = v + bs209 := testMarshalErr(v209v1, h, t, "enc-map-v209") + if v == nil { + v209v2 = nil + } else { + v209v2 = make(map[int8]int8, len(v)) + } // reset map + testUnmarshalErr(v209v2, bs209, h, t, "dec-map-v209") + testDeepEqualErr(v209v1, v209v2, t, "equal-map-v209") + if v == nil { + v209v2 = nil + } else { + v209v2 = make(map[int8]int8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v209v2), bs209, h, t, "dec-map-v209-noaddr") // decode into non-addressable map value + testDeepEqualErr(v209v1, v209v2, t, "equal-map-v209-noaddr") + if v == nil { + v209v2 = nil + } else { + v209v2 = make(map[int8]int8, len(v)) + } // reset map + testUnmarshalErr(&v209v2, bs209, h, t, "dec-map-v209-p-len") + testDeepEqualErr(v209v1, v209v2, t, "equal-map-v209-p-len") + bs209 = testMarshalErr(&v209v1, h, t, "enc-map-v209-p") + v209v2 = nil + testUnmarshalErr(&v209v2, bs209, h, t, "dec-map-v209-p-nil") + testDeepEqualErr(v209v1, v209v2, t, "equal-map-v209-p-nil") + // ... + if v == nil { + v209v2 = nil + } else { + v209v2 = make(map[int8]int8, len(v)) + } // reset map + var v209v3, v209v4 typMapMapInt8Int8 + v209v3 = typMapMapInt8Int8(v209v1) + v209v4 = typMapMapInt8Int8(v209v2) + bs209 = testMarshalErr(v209v3, h, t, "enc-map-v209-custom") + testUnmarshalErr(v209v4, bs209, h, t, "dec-map-v209-p-len") + testDeepEqualErr(v209v3, v209v4, t, "equal-map-v209-p-len") + } + + for _, v := range []map[int8]int16{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v210: %v\n", v) + var v210v1, v210v2 map[int8]int16 + v210v1 = v + bs210 := testMarshalErr(v210v1, h, t, "enc-map-v210") + if v == nil { + v210v2 = nil + } else { + v210v2 = make(map[int8]int16, len(v)) + } // reset map + testUnmarshalErr(v210v2, bs210, h, t, "dec-map-v210") + testDeepEqualErr(v210v1, v210v2, t, "equal-map-v210") + if v == nil { + v210v2 = nil + } else { + v210v2 = make(map[int8]int16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v210v2), bs210, h, t, "dec-map-v210-noaddr") // decode into non-addressable map value + testDeepEqualErr(v210v1, v210v2, t, "equal-map-v210-noaddr") + if v == nil { + v210v2 = nil + } else { + v210v2 = make(map[int8]int16, len(v)) + } // reset map + testUnmarshalErr(&v210v2, bs210, h, t, "dec-map-v210-p-len") + testDeepEqualErr(v210v1, v210v2, t, "equal-map-v210-p-len") + bs210 = testMarshalErr(&v210v1, h, t, "enc-map-v210-p") + v210v2 = nil + testUnmarshalErr(&v210v2, bs210, h, t, "dec-map-v210-p-nil") + testDeepEqualErr(v210v1, v210v2, t, "equal-map-v210-p-nil") + // ... + if v == nil { + v210v2 = nil + } else { + v210v2 = make(map[int8]int16, len(v)) + } // reset map + var v210v3, v210v4 typMapMapInt8Int16 + v210v3 = typMapMapInt8Int16(v210v1) + v210v4 = typMapMapInt8Int16(v210v2) + bs210 = testMarshalErr(v210v3, h, t, "enc-map-v210-custom") + testUnmarshalErr(v210v4, bs210, h, t, "dec-map-v210-p-len") + testDeepEqualErr(v210v3, v210v4, t, "equal-map-v210-p-len") + } + + for _, v := range []map[int8]int32{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v211: %v\n", v) + var v211v1, v211v2 map[int8]int32 + v211v1 = v + bs211 := testMarshalErr(v211v1, h, t, "enc-map-v211") + if v == nil { + v211v2 = nil + } else { + v211v2 = make(map[int8]int32, len(v)) + } // reset map + testUnmarshalErr(v211v2, bs211, h, t, "dec-map-v211") + testDeepEqualErr(v211v1, v211v2, t, "equal-map-v211") + if v == nil { + v211v2 = nil + } else { + v211v2 = make(map[int8]int32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v211v2), bs211, h, t, "dec-map-v211-noaddr") // decode into non-addressable map value + testDeepEqualErr(v211v1, v211v2, t, "equal-map-v211-noaddr") + if v == nil { + v211v2 = nil + } else { + v211v2 = make(map[int8]int32, len(v)) + } // reset map + testUnmarshalErr(&v211v2, bs211, h, t, "dec-map-v211-p-len") + testDeepEqualErr(v211v1, v211v2, t, "equal-map-v211-p-len") + bs211 = testMarshalErr(&v211v1, h, t, "enc-map-v211-p") + v211v2 = nil + testUnmarshalErr(&v211v2, bs211, h, t, "dec-map-v211-p-nil") + testDeepEqualErr(v211v1, v211v2, t, "equal-map-v211-p-nil") + // ... + if v == nil { + v211v2 = nil + } else { + v211v2 = make(map[int8]int32, len(v)) + } // reset map + var v211v3, v211v4 typMapMapInt8Int32 + v211v3 = typMapMapInt8Int32(v211v1) + v211v4 = typMapMapInt8Int32(v211v2) + bs211 = testMarshalErr(v211v3, h, t, "enc-map-v211-custom") + testUnmarshalErr(v211v4, bs211, h, t, "dec-map-v211-p-len") + testDeepEqualErr(v211v3, v211v4, t, "equal-map-v211-p-len") + } + + for _, v := range []map[int8]int64{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v212: %v\n", v) + var v212v1, v212v2 map[int8]int64 + v212v1 = v + bs212 := testMarshalErr(v212v1, h, t, "enc-map-v212") + if v == nil { + v212v2 = nil + } else { + v212v2 = make(map[int8]int64, len(v)) + } // reset map + testUnmarshalErr(v212v2, bs212, h, t, "dec-map-v212") + testDeepEqualErr(v212v1, v212v2, t, "equal-map-v212") + if v == nil { + v212v2 = nil + } else { + v212v2 = make(map[int8]int64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v212v2), bs212, h, t, "dec-map-v212-noaddr") // decode into non-addressable map value + testDeepEqualErr(v212v1, v212v2, t, "equal-map-v212-noaddr") + if v == nil { + v212v2 = nil + } else { + v212v2 = make(map[int8]int64, len(v)) + } // reset map + testUnmarshalErr(&v212v2, bs212, h, t, "dec-map-v212-p-len") + testDeepEqualErr(v212v1, v212v2, t, "equal-map-v212-p-len") + bs212 = testMarshalErr(&v212v1, h, t, "enc-map-v212-p") + v212v2 = nil + testUnmarshalErr(&v212v2, bs212, h, t, "dec-map-v212-p-nil") + testDeepEqualErr(v212v1, v212v2, t, "equal-map-v212-p-nil") + // ... + if v == nil { + v212v2 = nil + } else { + v212v2 = make(map[int8]int64, len(v)) + } // reset map + var v212v3, v212v4 typMapMapInt8Int64 + v212v3 = typMapMapInt8Int64(v212v1) + v212v4 = typMapMapInt8Int64(v212v2) + bs212 = testMarshalErr(v212v3, h, t, "enc-map-v212-custom") + testUnmarshalErr(v212v4, bs212, h, t, "dec-map-v212-p-len") + testDeepEqualErr(v212v3, v212v4, t, "equal-map-v212-p-len") + } + + for _, v := range []map[int8]float32{nil, {}, {44: 0, 33: 22.2}} { + // fmt.Printf(">>>> running mammoth map v213: %v\n", v) + var v213v1, v213v2 map[int8]float32 + v213v1 = v + bs213 := testMarshalErr(v213v1, h, t, "enc-map-v213") + if v == nil { + v213v2 = nil + } else { + v213v2 = make(map[int8]float32, len(v)) + } // reset map + testUnmarshalErr(v213v2, bs213, h, t, "dec-map-v213") + testDeepEqualErr(v213v1, v213v2, t, "equal-map-v213") + if v == nil { + v213v2 = nil + } else { + v213v2 = make(map[int8]float32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v213v2), bs213, h, t, "dec-map-v213-noaddr") // decode into non-addressable map value + testDeepEqualErr(v213v1, v213v2, t, "equal-map-v213-noaddr") + if v == nil { + v213v2 = nil + } else { + v213v2 = make(map[int8]float32, len(v)) + } // reset map + testUnmarshalErr(&v213v2, bs213, h, t, "dec-map-v213-p-len") + testDeepEqualErr(v213v1, v213v2, t, "equal-map-v213-p-len") + bs213 = testMarshalErr(&v213v1, h, t, "enc-map-v213-p") + v213v2 = nil + testUnmarshalErr(&v213v2, bs213, h, t, "dec-map-v213-p-nil") + testDeepEqualErr(v213v1, v213v2, t, "equal-map-v213-p-nil") + // ... + if v == nil { + v213v2 = nil + } else { + v213v2 = make(map[int8]float32, len(v)) + } // reset map + var v213v3, v213v4 typMapMapInt8Float32 + v213v3 = typMapMapInt8Float32(v213v1) + v213v4 = typMapMapInt8Float32(v213v2) + bs213 = testMarshalErr(v213v3, h, t, "enc-map-v213-custom") + testUnmarshalErr(v213v4, bs213, h, t, "dec-map-v213-p-len") + testDeepEqualErr(v213v3, v213v4, t, "equal-map-v213-p-len") + } + + for _, v := range []map[int8]float64{nil, {}, {44: 0, 33: 11.1}} { + // fmt.Printf(">>>> running mammoth map v214: %v\n", v) + var v214v1, v214v2 map[int8]float64 + v214v1 = v + bs214 := testMarshalErr(v214v1, h, t, "enc-map-v214") + if v == nil { + v214v2 = nil + } else { + v214v2 = make(map[int8]float64, len(v)) + } // reset map + testUnmarshalErr(v214v2, bs214, h, t, "dec-map-v214") + testDeepEqualErr(v214v1, v214v2, t, "equal-map-v214") + if v == nil { + v214v2 = nil + } else { + v214v2 = make(map[int8]float64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v214v2), bs214, h, t, "dec-map-v214-noaddr") // decode into non-addressable map value + testDeepEqualErr(v214v1, v214v2, t, "equal-map-v214-noaddr") + if v == nil { + v214v2 = nil + } else { + v214v2 = make(map[int8]float64, len(v)) + } // reset map + testUnmarshalErr(&v214v2, bs214, h, t, "dec-map-v214-p-len") + testDeepEqualErr(v214v1, v214v2, t, "equal-map-v214-p-len") + bs214 = testMarshalErr(&v214v1, h, t, "enc-map-v214-p") + v214v2 = nil + testUnmarshalErr(&v214v2, bs214, h, t, "dec-map-v214-p-nil") + testDeepEqualErr(v214v1, v214v2, t, "equal-map-v214-p-nil") + // ... + if v == nil { + v214v2 = nil + } else { + v214v2 = make(map[int8]float64, len(v)) + } // reset map + var v214v3, v214v4 typMapMapInt8Float64 + v214v3 = typMapMapInt8Float64(v214v1) + v214v4 = typMapMapInt8Float64(v214v2) + bs214 = testMarshalErr(v214v3, h, t, "enc-map-v214-custom") + testUnmarshalErr(v214v4, bs214, h, t, "dec-map-v214-p-len") + testDeepEqualErr(v214v3, v214v4, t, "equal-map-v214-p-len") + } + + for _, v := range []map[int8]bool{nil, {}, {44: false, 33: true}} { + // fmt.Printf(">>>> running mammoth map v215: %v\n", v) + var v215v1, v215v2 map[int8]bool + v215v1 = v + bs215 := testMarshalErr(v215v1, h, t, "enc-map-v215") + if v == nil { + v215v2 = nil + } else { + v215v2 = make(map[int8]bool, len(v)) + } // reset map + testUnmarshalErr(v215v2, bs215, h, t, "dec-map-v215") + testDeepEqualErr(v215v1, v215v2, t, "equal-map-v215") + if v == nil { + v215v2 = nil + } else { + v215v2 = make(map[int8]bool, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v215v2), bs215, h, t, "dec-map-v215-noaddr") // decode into non-addressable map value + testDeepEqualErr(v215v1, v215v2, t, "equal-map-v215-noaddr") + if v == nil { + v215v2 = nil + } else { + v215v2 = make(map[int8]bool, len(v)) + } // reset map + testUnmarshalErr(&v215v2, bs215, h, t, "dec-map-v215-p-len") + testDeepEqualErr(v215v1, v215v2, t, "equal-map-v215-p-len") + bs215 = testMarshalErr(&v215v1, h, t, "enc-map-v215-p") + v215v2 = nil + testUnmarshalErr(&v215v2, bs215, h, t, "dec-map-v215-p-nil") + testDeepEqualErr(v215v1, v215v2, t, "equal-map-v215-p-nil") + // ... + if v == nil { + v215v2 = nil + } else { + v215v2 = make(map[int8]bool, len(v)) + } // reset map + var v215v3, v215v4 typMapMapInt8Bool + v215v3 = typMapMapInt8Bool(v215v1) + v215v4 = typMapMapInt8Bool(v215v2) + bs215 = testMarshalErr(v215v3, h, t, "enc-map-v215-custom") + testUnmarshalErr(v215v4, bs215, h, t, "dec-map-v215-p-len") + testDeepEqualErr(v215v3, v215v4, t, "equal-map-v215-p-len") + } + + for _, v := range []map[int16]interface{}{nil, {}, {44: nil, 33: "string-is-an-interface-2"}} { + // fmt.Printf(">>>> running mammoth map v218: %v\n", v) + var v218v1, v218v2 map[int16]interface{} + v218v1 = v + bs218 := testMarshalErr(v218v1, h, t, "enc-map-v218") + if v == nil { + v218v2 = nil + } else { + v218v2 = make(map[int16]interface{}, len(v)) + } // reset map + testUnmarshalErr(v218v2, bs218, h, t, "dec-map-v218") + testDeepEqualErr(v218v1, v218v2, t, "equal-map-v218") + if v == nil { + v218v2 = nil + } else { + v218v2 = make(map[int16]interface{}, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v218v2), bs218, h, t, "dec-map-v218-noaddr") // decode into non-addressable map value + testDeepEqualErr(v218v1, v218v2, t, "equal-map-v218-noaddr") + if v == nil { + v218v2 = nil + } else { + v218v2 = make(map[int16]interface{}, len(v)) + } // reset map + testUnmarshalErr(&v218v2, bs218, h, t, "dec-map-v218-p-len") + testDeepEqualErr(v218v1, v218v2, t, "equal-map-v218-p-len") + bs218 = testMarshalErr(&v218v1, h, t, "enc-map-v218-p") + v218v2 = nil + testUnmarshalErr(&v218v2, bs218, h, t, "dec-map-v218-p-nil") + testDeepEqualErr(v218v1, v218v2, t, "equal-map-v218-p-nil") + // ... + if v == nil { + v218v2 = nil + } else { + v218v2 = make(map[int16]interface{}, len(v)) + } // reset map + var v218v3, v218v4 typMapMapInt16Intf + v218v3 = typMapMapInt16Intf(v218v1) + v218v4 = typMapMapInt16Intf(v218v2) + bs218 = testMarshalErr(v218v3, h, t, "enc-map-v218-custom") + testUnmarshalErr(v218v4, bs218, h, t, "dec-map-v218-p-len") + testDeepEqualErr(v218v3, v218v4, t, "equal-map-v218-p-len") + } + + for _, v := range []map[int16]string{nil, {}, {44: "", 33: "some-string-2"}} { + // fmt.Printf(">>>> running mammoth map v219: %v\n", v) + var v219v1, v219v2 map[int16]string + v219v1 = v + bs219 := testMarshalErr(v219v1, h, t, "enc-map-v219") + if v == nil { + v219v2 = nil + } else { + v219v2 = make(map[int16]string, len(v)) + } // reset map + testUnmarshalErr(v219v2, bs219, h, t, "dec-map-v219") + testDeepEqualErr(v219v1, v219v2, t, "equal-map-v219") + if v == nil { + v219v2 = nil + } else { + v219v2 = make(map[int16]string, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v219v2), bs219, h, t, "dec-map-v219-noaddr") // decode into non-addressable map value + testDeepEqualErr(v219v1, v219v2, t, "equal-map-v219-noaddr") + if v == nil { + v219v2 = nil + } else { + v219v2 = make(map[int16]string, len(v)) + } // reset map + testUnmarshalErr(&v219v2, bs219, h, t, "dec-map-v219-p-len") + testDeepEqualErr(v219v1, v219v2, t, "equal-map-v219-p-len") + bs219 = testMarshalErr(&v219v1, h, t, "enc-map-v219-p") + v219v2 = nil + testUnmarshalErr(&v219v2, bs219, h, t, "dec-map-v219-p-nil") + testDeepEqualErr(v219v1, v219v2, t, "equal-map-v219-p-nil") + // ... + if v == nil { + v219v2 = nil + } else { + v219v2 = make(map[int16]string, len(v)) + } // reset map + var v219v3, v219v4 typMapMapInt16String + v219v3 = typMapMapInt16String(v219v1) + v219v4 = typMapMapInt16String(v219v2) + bs219 = testMarshalErr(v219v3, h, t, "enc-map-v219-custom") + testUnmarshalErr(v219v4, bs219, h, t, "dec-map-v219-p-len") + testDeepEqualErr(v219v3, v219v4, t, "equal-map-v219-p-len") + } + + for _, v := range []map[int16]uint{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v220: %v\n", v) + var v220v1, v220v2 map[int16]uint + v220v1 = v + bs220 := testMarshalErr(v220v1, h, t, "enc-map-v220") + if v == nil { + v220v2 = nil + } else { + v220v2 = make(map[int16]uint, len(v)) + } // reset map + testUnmarshalErr(v220v2, bs220, h, t, "dec-map-v220") + testDeepEqualErr(v220v1, v220v2, t, "equal-map-v220") + if v == nil { + v220v2 = nil + } else { + v220v2 = make(map[int16]uint, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v220v2), bs220, h, t, "dec-map-v220-noaddr") // decode into non-addressable map value + testDeepEqualErr(v220v1, v220v2, t, "equal-map-v220-noaddr") + if v == nil { + v220v2 = nil + } else { + v220v2 = make(map[int16]uint, len(v)) + } // reset map + testUnmarshalErr(&v220v2, bs220, h, t, "dec-map-v220-p-len") + testDeepEqualErr(v220v1, v220v2, t, "equal-map-v220-p-len") + bs220 = testMarshalErr(&v220v1, h, t, "enc-map-v220-p") + v220v2 = nil + testUnmarshalErr(&v220v2, bs220, h, t, "dec-map-v220-p-nil") + testDeepEqualErr(v220v1, v220v2, t, "equal-map-v220-p-nil") + // ... + if v == nil { + v220v2 = nil + } else { + v220v2 = make(map[int16]uint, len(v)) + } // reset map + var v220v3, v220v4 typMapMapInt16Uint + v220v3 = typMapMapInt16Uint(v220v1) + v220v4 = typMapMapInt16Uint(v220v2) + bs220 = testMarshalErr(v220v3, h, t, "enc-map-v220-custom") + testUnmarshalErr(v220v4, bs220, h, t, "dec-map-v220-p-len") + testDeepEqualErr(v220v3, v220v4, t, "equal-map-v220-p-len") + } + + for _, v := range []map[int16]uint8{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v221: %v\n", v) + var v221v1, v221v2 map[int16]uint8 + v221v1 = v + bs221 := testMarshalErr(v221v1, h, t, "enc-map-v221") + if v == nil { + v221v2 = nil + } else { + v221v2 = make(map[int16]uint8, len(v)) + } // reset map + testUnmarshalErr(v221v2, bs221, h, t, "dec-map-v221") + testDeepEqualErr(v221v1, v221v2, t, "equal-map-v221") + if v == nil { + v221v2 = nil + } else { + v221v2 = make(map[int16]uint8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v221v2), bs221, h, t, "dec-map-v221-noaddr") // decode into non-addressable map value + testDeepEqualErr(v221v1, v221v2, t, "equal-map-v221-noaddr") + if v == nil { + v221v2 = nil + } else { + v221v2 = make(map[int16]uint8, len(v)) + } // reset map + testUnmarshalErr(&v221v2, bs221, h, t, "dec-map-v221-p-len") + testDeepEqualErr(v221v1, v221v2, t, "equal-map-v221-p-len") + bs221 = testMarshalErr(&v221v1, h, t, "enc-map-v221-p") + v221v2 = nil + testUnmarshalErr(&v221v2, bs221, h, t, "dec-map-v221-p-nil") + testDeepEqualErr(v221v1, v221v2, t, "equal-map-v221-p-nil") + // ... + if v == nil { + v221v2 = nil + } else { + v221v2 = make(map[int16]uint8, len(v)) + } // reset map + var v221v3, v221v4 typMapMapInt16Uint8 + v221v3 = typMapMapInt16Uint8(v221v1) + v221v4 = typMapMapInt16Uint8(v221v2) + bs221 = testMarshalErr(v221v3, h, t, "enc-map-v221-custom") + testUnmarshalErr(v221v4, bs221, h, t, "dec-map-v221-p-len") + testDeepEqualErr(v221v3, v221v4, t, "equal-map-v221-p-len") + } + + for _, v := range []map[int16]uint16{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v222: %v\n", v) + var v222v1, v222v2 map[int16]uint16 + v222v1 = v + bs222 := testMarshalErr(v222v1, h, t, "enc-map-v222") + if v == nil { + v222v2 = nil + } else { + v222v2 = make(map[int16]uint16, len(v)) + } // reset map + testUnmarshalErr(v222v2, bs222, h, t, "dec-map-v222") + testDeepEqualErr(v222v1, v222v2, t, "equal-map-v222") + if v == nil { + v222v2 = nil + } else { + v222v2 = make(map[int16]uint16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v222v2), bs222, h, t, "dec-map-v222-noaddr") // decode into non-addressable map value + testDeepEqualErr(v222v1, v222v2, t, "equal-map-v222-noaddr") + if v == nil { + v222v2 = nil + } else { + v222v2 = make(map[int16]uint16, len(v)) + } // reset map + testUnmarshalErr(&v222v2, bs222, h, t, "dec-map-v222-p-len") + testDeepEqualErr(v222v1, v222v2, t, "equal-map-v222-p-len") + bs222 = testMarshalErr(&v222v1, h, t, "enc-map-v222-p") + v222v2 = nil + testUnmarshalErr(&v222v2, bs222, h, t, "dec-map-v222-p-nil") + testDeepEqualErr(v222v1, v222v2, t, "equal-map-v222-p-nil") + // ... + if v == nil { + v222v2 = nil + } else { + v222v2 = make(map[int16]uint16, len(v)) + } // reset map + var v222v3, v222v4 typMapMapInt16Uint16 + v222v3 = typMapMapInt16Uint16(v222v1) + v222v4 = typMapMapInt16Uint16(v222v2) + bs222 = testMarshalErr(v222v3, h, t, "enc-map-v222-custom") + testUnmarshalErr(v222v4, bs222, h, t, "dec-map-v222-p-len") + testDeepEqualErr(v222v3, v222v4, t, "equal-map-v222-p-len") + } + + for _, v := range []map[int16]uint32{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v223: %v\n", v) + var v223v1, v223v2 map[int16]uint32 + v223v1 = v + bs223 := testMarshalErr(v223v1, h, t, "enc-map-v223") + if v == nil { + v223v2 = nil + } else { + v223v2 = make(map[int16]uint32, len(v)) + } // reset map + testUnmarshalErr(v223v2, bs223, h, t, "dec-map-v223") + testDeepEqualErr(v223v1, v223v2, t, "equal-map-v223") + if v == nil { + v223v2 = nil + } else { + v223v2 = make(map[int16]uint32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v223v2), bs223, h, t, "dec-map-v223-noaddr") // decode into non-addressable map value + testDeepEqualErr(v223v1, v223v2, t, "equal-map-v223-noaddr") + if v == nil { + v223v2 = nil + } else { + v223v2 = make(map[int16]uint32, len(v)) + } // reset map + testUnmarshalErr(&v223v2, bs223, h, t, "dec-map-v223-p-len") + testDeepEqualErr(v223v1, v223v2, t, "equal-map-v223-p-len") + bs223 = testMarshalErr(&v223v1, h, t, "enc-map-v223-p") + v223v2 = nil + testUnmarshalErr(&v223v2, bs223, h, t, "dec-map-v223-p-nil") + testDeepEqualErr(v223v1, v223v2, t, "equal-map-v223-p-nil") + // ... + if v == nil { + v223v2 = nil + } else { + v223v2 = make(map[int16]uint32, len(v)) + } // reset map + var v223v3, v223v4 typMapMapInt16Uint32 + v223v3 = typMapMapInt16Uint32(v223v1) + v223v4 = typMapMapInt16Uint32(v223v2) + bs223 = testMarshalErr(v223v3, h, t, "enc-map-v223-custom") + testUnmarshalErr(v223v4, bs223, h, t, "dec-map-v223-p-len") + testDeepEqualErr(v223v3, v223v4, t, "equal-map-v223-p-len") + } + + for _, v := range []map[int16]uint64{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v224: %v\n", v) + var v224v1, v224v2 map[int16]uint64 + v224v1 = v + bs224 := testMarshalErr(v224v1, h, t, "enc-map-v224") + if v == nil { + v224v2 = nil + } else { + v224v2 = make(map[int16]uint64, len(v)) + } // reset map + testUnmarshalErr(v224v2, bs224, h, t, "dec-map-v224") + testDeepEqualErr(v224v1, v224v2, t, "equal-map-v224") + if v == nil { + v224v2 = nil + } else { + v224v2 = make(map[int16]uint64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v224v2), bs224, h, t, "dec-map-v224-noaddr") // decode into non-addressable map value + testDeepEqualErr(v224v1, v224v2, t, "equal-map-v224-noaddr") + if v == nil { + v224v2 = nil + } else { + v224v2 = make(map[int16]uint64, len(v)) + } // reset map + testUnmarshalErr(&v224v2, bs224, h, t, "dec-map-v224-p-len") + testDeepEqualErr(v224v1, v224v2, t, "equal-map-v224-p-len") + bs224 = testMarshalErr(&v224v1, h, t, "enc-map-v224-p") + v224v2 = nil + testUnmarshalErr(&v224v2, bs224, h, t, "dec-map-v224-p-nil") + testDeepEqualErr(v224v1, v224v2, t, "equal-map-v224-p-nil") + // ... + if v == nil { + v224v2 = nil + } else { + v224v2 = make(map[int16]uint64, len(v)) + } // reset map + var v224v3, v224v4 typMapMapInt16Uint64 + v224v3 = typMapMapInt16Uint64(v224v1) + v224v4 = typMapMapInt16Uint64(v224v2) + bs224 = testMarshalErr(v224v3, h, t, "enc-map-v224-custom") + testUnmarshalErr(v224v4, bs224, h, t, "dec-map-v224-p-len") + testDeepEqualErr(v224v3, v224v4, t, "equal-map-v224-p-len") + } + + for _, v := range []map[int16]uintptr{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v225: %v\n", v) + var v225v1, v225v2 map[int16]uintptr + v225v1 = v + bs225 := testMarshalErr(v225v1, h, t, "enc-map-v225") + if v == nil { + v225v2 = nil + } else { + v225v2 = make(map[int16]uintptr, len(v)) + } // reset map + testUnmarshalErr(v225v2, bs225, h, t, "dec-map-v225") + testDeepEqualErr(v225v1, v225v2, t, "equal-map-v225") + if v == nil { + v225v2 = nil + } else { + v225v2 = make(map[int16]uintptr, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v225v2), bs225, h, t, "dec-map-v225-noaddr") // decode into non-addressable map value + testDeepEqualErr(v225v1, v225v2, t, "equal-map-v225-noaddr") + if v == nil { + v225v2 = nil + } else { + v225v2 = make(map[int16]uintptr, len(v)) + } // reset map + testUnmarshalErr(&v225v2, bs225, h, t, "dec-map-v225-p-len") + testDeepEqualErr(v225v1, v225v2, t, "equal-map-v225-p-len") + bs225 = testMarshalErr(&v225v1, h, t, "enc-map-v225-p") + v225v2 = nil + testUnmarshalErr(&v225v2, bs225, h, t, "dec-map-v225-p-nil") + testDeepEqualErr(v225v1, v225v2, t, "equal-map-v225-p-nil") + // ... + if v == nil { + v225v2 = nil + } else { + v225v2 = make(map[int16]uintptr, len(v)) + } // reset map + var v225v3, v225v4 typMapMapInt16Uintptr + v225v3 = typMapMapInt16Uintptr(v225v1) + v225v4 = typMapMapInt16Uintptr(v225v2) + bs225 = testMarshalErr(v225v3, h, t, "enc-map-v225-custom") + testUnmarshalErr(v225v4, bs225, h, t, "dec-map-v225-p-len") + testDeepEqualErr(v225v3, v225v4, t, "equal-map-v225-p-len") + } + + for _, v := range []map[int16]int{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v226: %v\n", v) + var v226v1, v226v2 map[int16]int + v226v1 = v + bs226 := testMarshalErr(v226v1, h, t, "enc-map-v226") + if v == nil { + v226v2 = nil + } else { + v226v2 = make(map[int16]int, len(v)) + } // reset map + testUnmarshalErr(v226v2, bs226, h, t, "dec-map-v226") + testDeepEqualErr(v226v1, v226v2, t, "equal-map-v226") + if v == nil { + v226v2 = nil + } else { + v226v2 = make(map[int16]int, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v226v2), bs226, h, t, "dec-map-v226-noaddr") // decode into non-addressable map value + testDeepEqualErr(v226v1, v226v2, t, "equal-map-v226-noaddr") + if v == nil { + v226v2 = nil + } else { + v226v2 = make(map[int16]int, len(v)) + } // reset map + testUnmarshalErr(&v226v2, bs226, h, t, "dec-map-v226-p-len") + testDeepEqualErr(v226v1, v226v2, t, "equal-map-v226-p-len") + bs226 = testMarshalErr(&v226v1, h, t, "enc-map-v226-p") + v226v2 = nil + testUnmarshalErr(&v226v2, bs226, h, t, "dec-map-v226-p-nil") + testDeepEqualErr(v226v1, v226v2, t, "equal-map-v226-p-nil") + // ... + if v == nil { + v226v2 = nil + } else { + v226v2 = make(map[int16]int, len(v)) + } // reset map + var v226v3, v226v4 typMapMapInt16Int + v226v3 = typMapMapInt16Int(v226v1) + v226v4 = typMapMapInt16Int(v226v2) + bs226 = testMarshalErr(v226v3, h, t, "enc-map-v226-custom") + testUnmarshalErr(v226v4, bs226, h, t, "dec-map-v226-p-len") + testDeepEqualErr(v226v3, v226v4, t, "equal-map-v226-p-len") + } + + for _, v := range []map[int16]int8{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v227: %v\n", v) + var v227v1, v227v2 map[int16]int8 + v227v1 = v + bs227 := testMarshalErr(v227v1, h, t, "enc-map-v227") + if v == nil { + v227v2 = nil + } else { + v227v2 = make(map[int16]int8, len(v)) + } // reset map + testUnmarshalErr(v227v2, bs227, h, t, "dec-map-v227") + testDeepEqualErr(v227v1, v227v2, t, "equal-map-v227") + if v == nil { + v227v2 = nil + } else { + v227v2 = make(map[int16]int8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v227v2), bs227, h, t, "dec-map-v227-noaddr") // decode into non-addressable map value + testDeepEqualErr(v227v1, v227v2, t, "equal-map-v227-noaddr") + if v == nil { + v227v2 = nil + } else { + v227v2 = make(map[int16]int8, len(v)) + } // reset map + testUnmarshalErr(&v227v2, bs227, h, t, "dec-map-v227-p-len") + testDeepEqualErr(v227v1, v227v2, t, "equal-map-v227-p-len") + bs227 = testMarshalErr(&v227v1, h, t, "enc-map-v227-p") + v227v2 = nil + testUnmarshalErr(&v227v2, bs227, h, t, "dec-map-v227-p-nil") + testDeepEqualErr(v227v1, v227v2, t, "equal-map-v227-p-nil") + // ... + if v == nil { + v227v2 = nil + } else { + v227v2 = make(map[int16]int8, len(v)) + } // reset map + var v227v3, v227v4 typMapMapInt16Int8 + v227v3 = typMapMapInt16Int8(v227v1) + v227v4 = typMapMapInt16Int8(v227v2) + bs227 = testMarshalErr(v227v3, h, t, "enc-map-v227-custom") + testUnmarshalErr(v227v4, bs227, h, t, "dec-map-v227-p-len") + testDeepEqualErr(v227v3, v227v4, t, "equal-map-v227-p-len") + } + + for _, v := range []map[int16]int16{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v228: %v\n", v) + var v228v1, v228v2 map[int16]int16 + v228v1 = v + bs228 := testMarshalErr(v228v1, h, t, "enc-map-v228") + if v == nil { + v228v2 = nil + } else { + v228v2 = make(map[int16]int16, len(v)) + } // reset map + testUnmarshalErr(v228v2, bs228, h, t, "dec-map-v228") + testDeepEqualErr(v228v1, v228v2, t, "equal-map-v228") + if v == nil { + v228v2 = nil + } else { + v228v2 = make(map[int16]int16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v228v2), bs228, h, t, "dec-map-v228-noaddr") // decode into non-addressable map value + testDeepEqualErr(v228v1, v228v2, t, "equal-map-v228-noaddr") + if v == nil { + v228v2 = nil + } else { + v228v2 = make(map[int16]int16, len(v)) + } // reset map + testUnmarshalErr(&v228v2, bs228, h, t, "dec-map-v228-p-len") + testDeepEqualErr(v228v1, v228v2, t, "equal-map-v228-p-len") + bs228 = testMarshalErr(&v228v1, h, t, "enc-map-v228-p") + v228v2 = nil + testUnmarshalErr(&v228v2, bs228, h, t, "dec-map-v228-p-nil") + testDeepEqualErr(v228v1, v228v2, t, "equal-map-v228-p-nil") + // ... + if v == nil { + v228v2 = nil + } else { + v228v2 = make(map[int16]int16, len(v)) + } // reset map + var v228v3, v228v4 typMapMapInt16Int16 + v228v3 = typMapMapInt16Int16(v228v1) + v228v4 = typMapMapInt16Int16(v228v2) + bs228 = testMarshalErr(v228v3, h, t, "enc-map-v228-custom") + testUnmarshalErr(v228v4, bs228, h, t, "dec-map-v228-p-len") + testDeepEqualErr(v228v3, v228v4, t, "equal-map-v228-p-len") + } + + for _, v := range []map[int16]int32{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v229: %v\n", v) + var v229v1, v229v2 map[int16]int32 + v229v1 = v + bs229 := testMarshalErr(v229v1, h, t, "enc-map-v229") + if v == nil { + v229v2 = nil + } else { + v229v2 = make(map[int16]int32, len(v)) + } // reset map + testUnmarshalErr(v229v2, bs229, h, t, "dec-map-v229") + testDeepEqualErr(v229v1, v229v2, t, "equal-map-v229") + if v == nil { + v229v2 = nil + } else { + v229v2 = make(map[int16]int32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v229v2), bs229, h, t, "dec-map-v229-noaddr") // decode into non-addressable map value + testDeepEqualErr(v229v1, v229v2, t, "equal-map-v229-noaddr") + if v == nil { + v229v2 = nil + } else { + v229v2 = make(map[int16]int32, len(v)) + } // reset map + testUnmarshalErr(&v229v2, bs229, h, t, "dec-map-v229-p-len") + testDeepEqualErr(v229v1, v229v2, t, "equal-map-v229-p-len") + bs229 = testMarshalErr(&v229v1, h, t, "enc-map-v229-p") + v229v2 = nil + testUnmarshalErr(&v229v2, bs229, h, t, "dec-map-v229-p-nil") + testDeepEqualErr(v229v1, v229v2, t, "equal-map-v229-p-nil") + // ... + if v == nil { + v229v2 = nil + } else { + v229v2 = make(map[int16]int32, len(v)) + } // reset map + var v229v3, v229v4 typMapMapInt16Int32 + v229v3 = typMapMapInt16Int32(v229v1) + v229v4 = typMapMapInt16Int32(v229v2) + bs229 = testMarshalErr(v229v3, h, t, "enc-map-v229-custom") + testUnmarshalErr(v229v4, bs229, h, t, "dec-map-v229-p-len") + testDeepEqualErr(v229v3, v229v4, t, "equal-map-v229-p-len") + } + + for _, v := range []map[int16]int64{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v230: %v\n", v) + var v230v1, v230v2 map[int16]int64 + v230v1 = v + bs230 := testMarshalErr(v230v1, h, t, "enc-map-v230") + if v == nil { + v230v2 = nil + } else { + v230v2 = make(map[int16]int64, len(v)) + } // reset map + testUnmarshalErr(v230v2, bs230, h, t, "dec-map-v230") + testDeepEqualErr(v230v1, v230v2, t, "equal-map-v230") + if v == nil { + v230v2 = nil + } else { + v230v2 = make(map[int16]int64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v230v2), bs230, h, t, "dec-map-v230-noaddr") // decode into non-addressable map value + testDeepEqualErr(v230v1, v230v2, t, "equal-map-v230-noaddr") + if v == nil { + v230v2 = nil + } else { + v230v2 = make(map[int16]int64, len(v)) + } // reset map + testUnmarshalErr(&v230v2, bs230, h, t, "dec-map-v230-p-len") + testDeepEqualErr(v230v1, v230v2, t, "equal-map-v230-p-len") + bs230 = testMarshalErr(&v230v1, h, t, "enc-map-v230-p") + v230v2 = nil + testUnmarshalErr(&v230v2, bs230, h, t, "dec-map-v230-p-nil") + testDeepEqualErr(v230v1, v230v2, t, "equal-map-v230-p-nil") + // ... + if v == nil { + v230v2 = nil + } else { + v230v2 = make(map[int16]int64, len(v)) + } // reset map + var v230v3, v230v4 typMapMapInt16Int64 + v230v3 = typMapMapInt16Int64(v230v1) + v230v4 = typMapMapInt16Int64(v230v2) + bs230 = testMarshalErr(v230v3, h, t, "enc-map-v230-custom") + testUnmarshalErr(v230v4, bs230, h, t, "dec-map-v230-p-len") + testDeepEqualErr(v230v3, v230v4, t, "equal-map-v230-p-len") + } + + for _, v := range []map[int16]float32{nil, {}, {33: 0, 44: 22.2}} { + // fmt.Printf(">>>> running mammoth map v231: %v\n", v) + var v231v1, v231v2 map[int16]float32 + v231v1 = v + bs231 := testMarshalErr(v231v1, h, t, "enc-map-v231") + if v == nil { + v231v2 = nil + } else { + v231v2 = make(map[int16]float32, len(v)) + } // reset map + testUnmarshalErr(v231v2, bs231, h, t, "dec-map-v231") + testDeepEqualErr(v231v1, v231v2, t, "equal-map-v231") + if v == nil { + v231v2 = nil + } else { + v231v2 = make(map[int16]float32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v231v2), bs231, h, t, "dec-map-v231-noaddr") // decode into non-addressable map value + testDeepEqualErr(v231v1, v231v2, t, "equal-map-v231-noaddr") + if v == nil { + v231v2 = nil + } else { + v231v2 = make(map[int16]float32, len(v)) + } // reset map + testUnmarshalErr(&v231v2, bs231, h, t, "dec-map-v231-p-len") + testDeepEqualErr(v231v1, v231v2, t, "equal-map-v231-p-len") + bs231 = testMarshalErr(&v231v1, h, t, "enc-map-v231-p") + v231v2 = nil + testUnmarshalErr(&v231v2, bs231, h, t, "dec-map-v231-p-nil") + testDeepEqualErr(v231v1, v231v2, t, "equal-map-v231-p-nil") + // ... + if v == nil { + v231v2 = nil + } else { + v231v2 = make(map[int16]float32, len(v)) + } // reset map + var v231v3, v231v4 typMapMapInt16Float32 + v231v3 = typMapMapInt16Float32(v231v1) + v231v4 = typMapMapInt16Float32(v231v2) + bs231 = testMarshalErr(v231v3, h, t, "enc-map-v231-custom") + testUnmarshalErr(v231v4, bs231, h, t, "dec-map-v231-p-len") + testDeepEqualErr(v231v3, v231v4, t, "equal-map-v231-p-len") + } + + for _, v := range []map[int16]float64{nil, {}, {33: 0, 44: 11.1}} { + // fmt.Printf(">>>> running mammoth map v232: %v\n", v) + var v232v1, v232v2 map[int16]float64 + v232v1 = v + bs232 := testMarshalErr(v232v1, h, t, "enc-map-v232") + if v == nil { + v232v2 = nil + } else { + v232v2 = make(map[int16]float64, len(v)) + } // reset map + testUnmarshalErr(v232v2, bs232, h, t, "dec-map-v232") + testDeepEqualErr(v232v1, v232v2, t, "equal-map-v232") + if v == nil { + v232v2 = nil + } else { + v232v2 = make(map[int16]float64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v232v2), bs232, h, t, "dec-map-v232-noaddr") // decode into non-addressable map value + testDeepEqualErr(v232v1, v232v2, t, "equal-map-v232-noaddr") + if v == nil { + v232v2 = nil + } else { + v232v2 = make(map[int16]float64, len(v)) + } // reset map + testUnmarshalErr(&v232v2, bs232, h, t, "dec-map-v232-p-len") + testDeepEqualErr(v232v1, v232v2, t, "equal-map-v232-p-len") + bs232 = testMarshalErr(&v232v1, h, t, "enc-map-v232-p") + v232v2 = nil + testUnmarshalErr(&v232v2, bs232, h, t, "dec-map-v232-p-nil") + testDeepEqualErr(v232v1, v232v2, t, "equal-map-v232-p-nil") + // ... + if v == nil { + v232v2 = nil + } else { + v232v2 = make(map[int16]float64, len(v)) + } // reset map + var v232v3, v232v4 typMapMapInt16Float64 + v232v3 = typMapMapInt16Float64(v232v1) + v232v4 = typMapMapInt16Float64(v232v2) + bs232 = testMarshalErr(v232v3, h, t, "enc-map-v232-custom") + testUnmarshalErr(v232v4, bs232, h, t, "dec-map-v232-p-len") + testDeepEqualErr(v232v3, v232v4, t, "equal-map-v232-p-len") + } + + for _, v := range []map[int16]bool{nil, {}, {33: false, 44: true}} { + // fmt.Printf(">>>> running mammoth map v233: %v\n", v) + var v233v1, v233v2 map[int16]bool + v233v1 = v + bs233 := testMarshalErr(v233v1, h, t, "enc-map-v233") + if v == nil { + v233v2 = nil + } else { + v233v2 = make(map[int16]bool, len(v)) + } // reset map + testUnmarshalErr(v233v2, bs233, h, t, "dec-map-v233") + testDeepEqualErr(v233v1, v233v2, t, "equal-map-v233") + if v == nil { + v233v2 = nil + } else { + v233v2 = make(map[int16]bool, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v233v2), bs233, h, t, "dec-map-v233-noaddr") // decode into non-addressable map value + testDeepEqualErr(v233v1, v233v2, t, "equal-map-v233-noaddr") + if v == nil { + v233v2 = nil + } else { + v233v2 = make(map[int16]bool, len(v)) + } // reset map + testUnmarshalErr(&v233v2, bs233, h, t, "dec-map-v233-p-len") + testDeepEqualErr(v233v1, v233v2, t, "equal-map-v233-p-len") + bs233 = testMarshalErr(&v233v1, h, t, "enc-map-v233-p") + v233v2 = nil + testUnmarshalErr(&v233v2, bs233, h, t, "dec-map-v233-p-nil") + testDeepEqualErr(v233v1, v233v2, t, "equal-map-v233-p-nil") + // ... + if v == nil { + v233v2 = nil + } else { + v233v2 = make(map[int16]bool, len(v)) + } // reset map + var v233v3, v233v4 typMapMapInt16Bool + v233v3 = typMapMapInt16Bool(v233v1) + v233v4 = typMapMapInt16Bool(v233v2) + bs233 = testMarshalErr(v233v3, h, t, "enc-map-v233-custom") + testUnmarshalErr(v233v4, bs233, h, t, "dec-map-v233-p-len") + testDeepEqualErr(v233v3, v233v4, t, "equal-map-v233-p-len") + } + + for _, v := range []map[int32]interface{}{nil, {}, {33: nil, 44: "string-is-an-interface"}} { + // fmt.Printf(">>>> running mammoth map v236: %v\n", v) + var v236v1, v236v2 map[int32]interface{} + v236v1 = v + bs236 := testMarshalErr(v236v1, h, t, "enc-map-v236") + if v == nil { + v236v2 = nil + } else { + v236v2 = make(map[int32]interface{}, len(v)) + } // reset map + testUnmarshalErr(v236v2, bs236, h, t, "dec-map-v236") + testDeepEqualErr(v236v1, v236v2, t, "equal-map-v236") + if v == nil { + v236v2 = nil + } else { + v236v2 = make(map[int32]interface{}, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v236v2), bs236, h, t, "dec-map-v236-noaddr") // decode into non-addressable map value + testDeepEqualErr(v236v1, v236v2, t, "equal-map-v236-noaddr") + if v == nil { + v236v2 = nil + } else { + v236v2 = make(map[int32]interface{}, len(v)) + } // reset map + testUnmarshalErr(&v236v2, bs236, h, t, "dec-map-v236-p-len") + testDeepEqualErr(v236v1, v236v2, t, "equal-map-v236-p-len") + bs236 = testMarshalErr(&v236v1, h, t, "enc-map-v236-p") + v236v2 = nil + testUnmarshalErr(&v236v2, bs236, h, t, "dec-map-v236-p-nil") + testDeepEqualErr(v236v1, v236v2, t, "equal-map-v236-p-nil") + // ... + if v == nil { + v236v2 = nil + } else { + v236v2 = make(map[int32]interface{}, len(v)) + } // reset map + var v236v3, v236v4 typMapMapInt32Intf + v236v3 = typMapMapInt32Intf(v236v1) + v236v4 = typMapMapInt32Intf(v236v2) + bs236 = testMarshalErr(v236v3, h, t, "enc-map-v236-custom") + testUnmarshalErr(v236v4, bs236, h, t, "dec-map-v236-p-len") + testDeepEqualErr(v236v3, v236v4, t, "equal-map-v236-p-len") + } + + for _, v := range []map[int32]string{nil, {}, {33: "", 44: "some-string"}} { + // fmt.Printf(">>>> running mammoth map v237: %v\n", v) + var v237v1, v237v2 map[int32]string + v237v1 = v + bs237 := testMarshalErr(v237v1, h, t, "enc-map-v237") + if v == nil { + v237v2 = nil + } else { + v237v2 = make(map[int32]string, len(v)) + } // reset map + testUnmarshalErr(v237v2, bs237, h, t, "dec-map-v237") + testDeepEqualErr(v237v1, v237v2, t, "equal-map-v237") + if v == nil { + v237v2 = nil + } else { + v237v2 = make(map[int32]string, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v237v2), bs237, h, t, "dec-map-v237-noaddr") // decode into non-addressable map value + testDeepEqualErr(v237v1, v237v2, t, "equal-map-v237-noaddr") + if v == nil { + v237v2 = nil + } else { + v237v2 = make(map[int32]string, len(v)) + } // reset map + testUnmarshalErr(&v237v2, bs237, h, t, "dec-map-v237-p-len") + testDeepEqualErr(v237v1, v237v2, t, "equal-map-v237-p-len") + bs237 = testMarshalErr(&v237v1, h, t, "enc-map-v237-p") + v237v2 = nil + testUnmarshalErr(&v237v2, bs237, h, t, "dec-map-v237-p-nil") + testDeepEqualErr(v237v1, v237v2, t, "equal-map-v237-p-nil") + // ... + if v == nil { + v237v2 = nil + } else { + v237v2 = make(map[int32]string, len(v)) + } // reset map + var v237v3, v237v4 typMapMapInt32String + v237v3 = typMapMapInt32String(v237v1) + v237v4 = typMapMapInt32String(v237v2) + bs237 = testMarshalErr(v237v3, h, t, "enc-map-v237-custom") + testUnmarshalErr(v237v4, bs237, h, t, "dec-map-v237-p-len") + testDeepEqualErr(v237v3, v237v4, t, "equal-map-v237-p-len") + } + + for _, v := range []map[int32]uint{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v238: %v\n", v) + var v238v1, v238v2 map[int32]uint + v238v1 = v + bs238 := testMarshalErr(v238v1, h, t, "enc-map-v238") + if v == nil { + v238v2 = nil + } else { + v238v2 = make(map[int32]uint, len(v)) + } // reset map + testUnmarshalErr(v238v2, bs238, h, t, "dec-map-v238") + testDeepEqualErr(v238v1, v238v2, t, "equal-map-v238") + if v == nil { + v238v2 = nil + } else { + v238v2 = make(map[int32]uint, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v238v2), bs238, h, t, "dec-map-v238-noaddr") // decode into non-addressable map value + testDeepEqualErr(v238v1, v238v2, t, "equal-map-v238-noaddr") + if v == nil { + v238v2 = nil + } else { + v238v2 = make(map[int32]uint, len(v)) + } // reset map + testUnmarshalErr(&v238v2, bs238, h, t, "dec-map-v238-p-len") + testDeepEqualErr(v238v1, v238v2, t, "equal-map-v238-p-len") + bs238 = testMarshalErr(&v238v1, h, t, "enc-map-v238-p") + v238v2 = nil + testUnmarshalErr(&v238v2, bs238, h, t, "dec-map-v238-p-nil") + testDeepEqualErr(v238v1, v238v2, t, "equal-map-v238-p-nil") + // ... + if v == nil { + v238v2 = nil + } else { + v238v2 = make(map[int32]uint, len(v)) + } // reset map + var v238v3, v238v4 typMapMapInt32Uint + v238v3 = typMapMapInt32Uint(v238v1) + v238v4 = typMapMapInt32Uint(v238v2) + bs238 = testMarshalErr(v238v3, h, t, "enc-map-v238-custom") + testUnmarshalErr(v238v4, bs238, h, t, "dec-map-v238-p-len") + testDeepEqualErr(v238v3, v238v4, t, "equal-map-v238-p-len") + } + + for _, v := range []map[int32]uint8{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v239: %v\n", v) + var v239v1, v239v2 map[int32]uint8 + v239v1 = v + bs239 := testMarshalErr(v239v1, h, t, "enc-map-v239") + if v == nil { + v239v2 = nil + } else { + v239v2 = make(map[int32]uint8, len(v)) + } // reset map + testUnmarshalErr(v239v2, bs239, h, t, "dec-map-v239") + testDeepEqualErr(v239v1, v239v2, t, "equal-map-v239") + if v == nil { + v239v2 = nil + } else { + v239v2 = make(map[int32]uint8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v239v2), bs239, h, t, "dec-map-v239-noaddr") // decode into non-addressable map value + testDeepEqualErr(v239v1, v239v2, t, "equal-map-v239-noaddr") + if v == nil { + v239v2 = nil + } else { + v239v2 = make(map[int32]uint8, len(v)) + } // reset map + testUnmarshalErr(&v239v2, bs239, h, t, "dec-map-v239-p-len") + testDeepEqualErr(v239v1, v239v2, t, "equal-map-v239-p-len") + bs239 = testMarshalErr(&v239v1, h, t, "enc-map-v239-p") + v239v2 = nil + testUnmarshalErr(&v239v2, bs239, h, t, "dec-map-v239-p-nil") + testDeepEqualErr(v239v1, v239v2, t, "equal-map-v239-p-nil") + // ... + if v == nil { + v239v2 = nil + } else { + v239v2 = make(map[int32]uint8, len(v)) + } // reset map + var v239v3, v239v4 typMapMapInt32Uint8 + v239v3 = typMapMapInt32Uint8(v239v1) + v239v4 = typMapMapInt32Uint8(v239v2) + bs239 = testMarshalErr(v239v3, h, t, "enc-map-v239-custom") + testUnmarshalErr(v239v4, bs239, h, t, "dec-map-v239-p-len") + testDeepEqualErr(v239v3, v239v4, t, "equal-map-v239-p-len") + } + + for _, v := range []map[int32]uint16{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v240: %v\n", v) + var v240v1, v240v2 map[int32]uint16 + v240v1 = v + bs240 := testMarshalErr(v240v1, h, t, "enc-map-v240") + if v == nil { + v240v2 = nil + } else { + v240v2 = make(map[int32]uint16, len(v)) + } // reset map + testUnmarshalErr(v240v2, bs240, h, t, "dec-map-v240") + testDeepEqualErr(v240v1, v240v2, t, "equal-map-v240") + if v == nil { + v240v2 = nil + } else { + v240v2 = make(map[int32]uint16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v240v2), bs240, h, t, "dec-map-v240-noaddr") // decode into non-addressable map value + testDeepEqualErr(v240v1, v240v2, t, "equal-map-v240-noaddr") + if v == nil { + v240v2 = nil + } else { + v240v2 = make(map[int32]uint16, len(v)) + } // reset map + testUnmarshalErr(&v240v2, bs240, h, t, "dec-map-v240-p-len") + testDeepEqualErr(v240v1, v240v2, t, "equal-map-v240-p-len") + bs240 = testMarshalErr(&v240v1, h, t, "enc-map-v240-p") + v240v2 = nil + testUnmarshalErr(&v240v2, bs240, h, t, "dec-map-v240-p-nil") + testDeepEqualErr(v240v1, v240v2, t, "equal-map-v240-p-nil") + // ... + if v == nil { + v240v2 = nil + } else { + v240v2 = make(map[int32]uint16, len(v)) + } // reset map + var v240v3, v240v4 typMapMapInt32Uint16 + v240v3 = typMapMapInt32Uint16(v240v1) + v240v4 = typMapMapInt32Uint16(v240v2) + bs240 = testMarshalErr(v240v3, h, t, "enc-map-v240-custom") + testUnmarshalErr(v240v4, bs240, h, t, "dec-map-v240-p-len") + testDeepEqualErr(v240v3, v240v4, t, "equal-map-v240-p-len") + } + + for _, v := range []map[int32]uint32{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v241: %v\n", v) + var v241v1, v241v2 map[int32]uint32 + v241v1 = v + bs241 := testMarshalErr(v241v1, h, t, "enc-map-v241") + if v == nil { + v241v2 = nil + } else { + v241v2 = make(map[int32]uint32, len(v)) + } // reset map + testUnmarshalErr(v241v2, bs241, h, t, "dec-map-v241") + testDeepEqualErr(v241v1, v241v2, t, "equal-map-v241") + if v == nil { + v241v2 = nil + } else { + v241v2 = make(map[int32]uint32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v241v2), bs241, h, t, "dec-map-v241-noaddr") // decode into non-addressable map value + testDeepEqualErr(v241v1, v241v2, t, "equal-map-v241-noaddr") + if v == nil { + v241v2 = nil + } else { + v241v2 = make(map[int32]uint32, len(v)) + } // reset map + testUnmarshalErr(&v241v2, bs241, h, t, "dec-map-v241-p-len") + testDeepEqualErr(v241v1, v241v2, t, "equal-map-v241-p-len") + bs241 = testMarshalErr(&v241v1, h, t, "enc-map-v241-p") + v241v2 = nil + testUnmarshalErr(&v241v2, bs241, h, t, "dec-map-v241-p-nil") + testDeepEqualErr(v241v1, v241v2, t, "equal-map-v241-p-nil") + // ... + if v == nil { + v241v2 = nil + } else { + v241v2 = make(map[int32]uint32, len(v)) + } // reset map + var v241v3, v241v4 typMapMapInt32Uint32 + v241v3 = typMapMapInt32Uint32(v241v1) + v241v4 = typMapMapInt32Uint32(v241v2) + bs241 = testMarshalErr(v241v3, h, t, "enc-map-v241-custom") + testUnmarshalErr(v241v4, bs241, h, t, "dec-map-v241-p-len") + testDeepEqualErr(v241v3, v241v4, t, "equal-map-v241-p-len") + } + + for _, v := range []map[int32]uint64{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v242: %v\n", v) + var v242v1, v242v2 map[int32]uint64 + v242v1 = v + bs242 := testMarshalErr(v242v1, h, t, "enc-map-v242") + if v == nil { + v242v2 = nil + } else { + v242v2 = make(map[int32]uint64, len(v)) + } // reset map + testUnmarshalErr(v242v2, bs242, h, t, "dec-map-v242") + testDeepEqualErr(v242v1, v242v2, t, "equal-map-v242") + if v == nil { + v242v2 = nil + } else { + v242v2 = make(map[int32]uint64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v242v2), bs242, h, t, "dec-map-v242-noaddr") // decode into non-addressable map value + testDeepEqualErr(v242v1, v242v2, t, "equal-map-v242-noaddr") + if v == nil { + v242v2 = nil + } else { + v242v2 = make(map[int32]uint64, len(v)) + } // reset map + testUnmarshalErr(&v242v2, bs242, h, t, "dec-map-v242-p-len") + testDeepEqualErr(v242v1, v242v2, t, "equal-map-v242-p-len") + bs242 = testMarshalErr(&v242v1, h, t, "enc-map-v242-p") + v242v2 = nil + testUnmarshalErr(&v242v2, bs242, h, t, "dec-map-v242-p-nil") + testDeepEqualErr(v242v1, v242v2, t, "equal-map-v242-p-nil") + // ... + if v == nil { + v242v2 = nil + } else { + v242v2 = make(map[int32]uint64, len(v)) + } // reset map + var v242v3, v242v4 typMapMapInt32Uint64 + v242v3 = typMapMapInt32Uint64(v242v1) + v242v4 = typMapMapInt32Uint64(v242v2) + bs242 = testMarshalErr(v242v3, h, t, "enc-map-v242-custom") + testUnmarshalErr(v242v4, bs242, h, t, "dec-map-v242-p-len") + testDeepEqualErr(v242v3, v242v4, t, "equal-map-v242-p-len") + } + + for _, v := range []map[int32]uintptr{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v243: %v\n", v) + var v243v1, v243v2 map[int32]uintptr + v243v1 = v + bs243 := testMarshalErr(v243v1, h, t, "enc-map-v243") + if v == nil { + v243v2 = nil + } else { + v243v2 = make(map[int32]uintptr, len(v)) + } // reset map + testUnmarshalErr(v243v2, bs243, h, t, "dec-map-v243") + testDeepEqualErr(v243v1, v243v2, t, "equal-map-v243") + if v == nil { + v243v2 = nil + } else { + v243v2 = make(map[int32]uintptr, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v243v2), bs243, h, t, "dec-map-v243-noaddr") // decode into non-addressable map value + testDeepEqualErr(v243v1, v243v2, t, "equal-map-v243-noaddr") + if v == nil { + v243v2 = nil + } else { + v243v2 = make(map[int32]uintptr, len(v)) + } // reset map + testUnmarshalErr(&v243v2, bs243, h, t, "dec-map-v243-p-len") + testDeepEqualErr(v243v1, v243v2, t, "equal-map-v243-p-len") + bs243 = testMarshalErr(&v243v1, h, t, "enc-map-v243-p") + v243v2 = nil + testUnmarshalErr(&v243v2, bs243, h, t, "dec-map-v243-p-nil") + testDeepEqualErr(v243v1, v243v2, t, "equal-map-v243-p-nil") + // ... + if v == nil { + v243v2 = nil + } else { + v243v2 = make(map[int32]uintptr, len(v)) + } // reset map + var v243v3, v243v4 typMapMapInt32Uintptr + v243v3 = typMapMapInt32Uintptr(v243v1) + v243v4 = typMapMapInt32Uintptr(v243v2) + bs243 = testMarshalErr(v243v3, h, t, "enc-map-v243-custom") + testUnmarshalErr(v243v4, bs243, h, t, "dec-map-v243-p-len") + testDeepEqualErr(v243v3, v243v4, t, "equal-map-v243-p-len") + } + + for _, v := range []map[int32]int{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v244: %v\n", v) + var v244v1, v244v2 map[int32]int + v244v1 = v + bs244 := testMarshalErr(v244v1, h, t, "enc-map-v244") + if v == nil { + v244v2 = nil + } else { + v244v2 = make(map[int32]int, len(v)) + } // reset map + testUnmarshalErr(v244v2, bs244, h, t, "dec-map-v244") + testDeepEqualErr(v244v1, v244v2, t, "equal-map-v244") + if v == nil { + v244v2 = nil + } else { + v244v2 = make(map[int32]int, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v244v2), bs244, h, t, "dec-map-v244-noaddr") // decode into non-addressable map value + testDeepEqualErr(v244v1, v244v2, t, "equal-map-v244-noaddr") + if v == nil { + v244v2 = nil + } else { + v244v2 = make(map[int32]int, len(v)) + } // reset map + testUnmarshalErr(&v244v2, bs244, h, t, "dec-map-v244-p-len") + testDeepEqualErr(v244v1, v244v2, t, "equal-map-v244-p-len") + bs244 = testMarshalErr(&v244v1, h, t, "enc-map-v244-p") + v244v2 = nil + testUnmarshalErr(&v244v2, bs244, h, t, "dec-map-v244-p-nil") + testDeepEqualErr(v244v1, v244v2, t, "equal-map-v244-p-nil") + // ... + if v == nil { + v244v2 = nil + } else { + v244v2 = make(map[int32]int, len(v)) + } // reset map + var v244v3, v244v4 typMapMapInt32Int + v244v3 = typMapMapInt32Int(v244v1) + v244v4 = typMapMapInt32Int(v244v2) + bs244 = testMarshalErr(v244v3, h, t, "enc-map-v244-custom") + testUnmarshalErr(v244v4, bs244, h, t, "dec-map-v244-p-len") + testDeepEqualErr(v244v3, v244v4, t, "equal-map-v244-p-len") + } + + for _, v := range []map[int32]int8{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v245: %v\n", v) + var v245v1, v245v2 map[int32]int8 + v245v1 = v + bs245 := testMarshalErr(v245v1, h, t, "enc-map-v245") + if v == nil { + v245v2 = nil + } else { + v245v2 = make(map[int32]int8, len(v)) + } // reset map + testUnmarshalErr(v245v2, bs245, h, t, "dec-map-v245") + testDeepEqualErr(v245v1, v245v2, t, "equal-map-v245") + if v == nil { + v245v2 = nil + } else { + v245v2 = make(map[int32]int8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v245v2), bs245, h, t, "dec-map-v245-noaddr") // decode into non-addressable map value + testDeepEqualErr(v245v1, v245v2, t, "equal-map-v245-noaddr") + if v == nil { + v245v2 = nil + } else { + v245v2 = make(map[int32]int8, len(v)) + } // reset map + testUnmarshalErr(&v245v2, bs245, h, t, "dec-map-v245-p-len") + testDeepEqualErr(v245v1, v245v2, t, "equal-map-v245-p-len") + bs245 = testMarshalErr(&v245v1, h, t, "enc-map-v245-p") + v245v2 = nil + testUnmarshalErr(&v245v2, bs245, h, t, "dec-map-v245-p-nil") + testDeepEqualErr(v245v1, v245v2, t, "equal-map-v245-p-nil") + // ... + if v == nil { + v245v2 = nil + } else { + v245v2 = make(map[int32]int8, len(v)) + } // reset map + var v245v3, v245v4 typMapMapInt32Int8 + v245v3 = typMapMapInt32Int8(v245v1) + v245v4 = typMapMapInt32Int8(v245v2) + bs245 = testMarshalErr(v245v3, h, t, "enc-map-v245-custom") + testUnmarshalErr(v245v4, bs245, h, t, "dec-map-v245-p-len") + testDeepEqualErr(v245v3, v245v4, t, "equal-map-v245-p-len") + } + + for _, v := range []map[int32]int16{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v246: %v\n", v) + var v246v1, v246v2 map[int32]int16 + v246v1 = v + bs246 := testMarshalErr(v246v1, h, t, "enc-map-v246") + if v == nil { + v246v2 = nil + } else { + v246v2 = make(map[int32]int16, len(v)) + } // reset map + testUnmarshalErr(v246v2, bs246, h, t, "dec-map-v246") + testDeepEqualErr(v246v1, v246v2, t, "equal-map-v246") + if v == nil { + v246v2 = nil + } else { + v246v2 = make(map[int32]int16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v246v2), bs246, h, t, "dec-map-v246-noaddr") // decode into non-addressable map value + testDeepEqualErr(v246v1, v246v2, t, "equal-map-v246-noaddr") + if v == nil { + v246v2 = nil + } else { + v246v2 = make(map[int32]int16, len(v)) + } // reset map + testUnmarshalErr(&v246v2, bs246, h, t, "dec-map-v246-p-len") + testDeepEqualErr(v246v1, v246v2, t, "equal-map-v246-p-len") + bs246 = testMarshalErr(&v246v1, h, t, "enc-map-v246-p") + v246v2 = nil + testUnmarshalErr(&v246v2, bs246, h, t, "dec-map-v246-p-nil") + testDeepEqualErr(v246v1, v246v2, t, "equal-map-v246-p-nil") + // ... + if v == nil { + v246v2 = nil + } else { + v246v2 = make(map[int32]int16, len(v)) + } // reset map + var v246v3, v246v4 typMapMapInt32Int16 + v246v3 = typMapMapInt32Int16(v246v1) + v246v4 = typMapMapInt32Int16(v246v2) + bs246 = testMarshalErr(v246v3, h, t, "enc-map-v246-custom") + testUnmarshalErr(v246v4, bs246, h, t, "dec-map-v246-p-len") + testDeepEqualErr(v246v3, v246v4, t, "equal-map-v246-p-len") + } + + for _, v := range []map[int32]int32{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v247: %v\n", v) + var v247v1, v247v2 map[int32]int32 + v247v1 = v + bs247 := testMarshalErr(v247v1, h, t, "enc-map-v247") + if v == nil { + v247v2 = nil + } else { + v247v2 = make(map[int32]int32, len(v)) + } // reset map + testUnmarshalErr(v247v2, bs247, h, t, "dec-map-v247") + testDeepEqualErr(v247v1, v247v2, t, "equal-map-v247") + if v == nil { + v247v2 = nil + } else { + v247v2 = make(map[int32]int32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v247v2), bs247, h, t, "dec-map-v247-noaddr") // decode into non-addressable map value + testDeepEqualErr(v247v1, v247v2, t, "equal-map-v247-noaddr") + if v == nil { + v247v2 = nil + } else { + v247v2 = make(map[int32]int32, len(v)) + } // reset map + testUnmarshalErr(&v247v2, bs247, h, t, "dec-map-v247-p-len") + testDeepEqualErr(v247v1, v247v2, t, "equal-map-v247-p-len") + bs247 = testMarshalErr(&v247v1, h, t, "enc-map-v247-p") + v247v2 = nil + testUnmarshalErr(&v247v2, bs247, h, t, "dec-map-v247-p-nil") + testDeepEqualErr(v247v1, v247v2, t, "equal-map-v247-p-nil") + // ... + if v == nil { + v247v2 = nil + } else { + v247v2 = make(map[int32]int32, len(v)) + } // reset map + var v247v3, v247v4 typMapMapInt32Int32 + v247v3 = typMapMapInt32Int32(v247v1) + v247v4 = typMapMapInt32Int32(v247v2) + bs247 = testMarshalErr(v247v3, h, t, "enc-map-v247-custom") + testUnmarshalErr(v247v4, bs247, h, t, "dec-map-v247-p-len") + testDeepEqualErr(v247v3, v247v4, t, "equal-map-v247-p-len") + } + + for _, v := range []map[int32]int64{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v248: %v\n", v) + var v248v1, v248v2 map[int32]int64 + v248v1 = v + bs248 := testMarshalErr(v248v1, h, t, "enc-map-v248") + if v == nil { + v248v2 = nil + } else { + v248v2 = make(map[int32]int64, len(v)) + } // reset map + testUnmarshalErr(v248v2, bs248, h, t, "dec-map-v248") + testDeepEqualErr(v248v1, v248v2, t, "equal-map-v248") + if v == nil { + v248v2 = nil + } else { + v248v2 = make(map[int32]int64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v248v2), bs248, h, t, "dec-map-v248-noaddr") // decode into non-addressable map value + testDeepEqualErr(v248v1, v248v2, t, "equal-map-v248-noaddr") + if v == nil { + v248v2 = nil + } else { + v248v2 = make(map[int32]int64, len(v)) + } // reset map + testUnmarshalErr(&v248v2, bs248, h, t, "dec-map-v248-p-len") + testDeepEqualErr(v248v1, v248v2, t, "equal-map-v248-p-len") + bs248 = testMarshalErr(&v248v1, h, t, "enc-map-v248-p") + v248v2 = nil + testUnmarshalErr(&v248v2, bs248, h, t, "dec-map-v248-p-nil") + testDeepEqualErr(v248v1, v248v2, t, "equal-map-v248-p-nil") + // ... + if v == nil { + v248v2 = nil + } else { + v248v2 = make(map[int32]int64, len(v)) + } // reset map + var v248v3, v248v4 typMapMapInt32Int64 + v248v3 = typMapMapInt32Int64(v248v1) + v248v4 = typMapMapInt32Int64(v248v2) + bs248 = testMarshalErr(v248v3, h, t, "enc-map-v248-custom") + testUnmarshalErr(v248v4, bs248, h, t, "dec-map-v248-p-len") + testDeepEqualErr(v248v3, v248v4, t, "equal-map-v248-p-len") + } + + for _, v := range []map[int32]float32{nil, {}, {44: 0, 33: 22.2}} { + // fmt.Printf(">>>> running mammoth map v249: %v\n", v) + var v249v1, v249v2 map[int32]float32 + v249v1 = v + bs249 := testMarshalErr(v249v1, h, t, "enc-map-v249") + if v == nil { + v249v2 = nil + } else { + v249v2 = make(map[int32]float32, len(v)) + } // reset map + testUnmarshalErr(v249v2, bs249, h, t, "dec-map-v249") + testDeepEqualErr(v249v1, v249v2, t, "equal-map-v249") + if v == nil { + v249v2 = nil + } else { + v249v2 = make(map[int32]float32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v249v2), bs249, h, t, "dec-map-v249-noaddr") // decode into non-addressable map value + testDeepEqualErr(v249v1, v249v2, t, "equal-map-v249-noaddr") + if v == nil { + v249v2 = nil + } else { + v249v2 = make(map[int32]float32, len(v)) + } // reset map + testUnmarshalErr(&v249v2, bs249, h, t, "dec-map-v249-p-len") + testDeepEqualErr(v249v1, v249v2, t, "equal-map-v249-p-len") + bs249 = testMarshalErr(&v249v1, h, t, "enc-map-v249-p") + v249v2 = nil + testUnmarshalErr(&v249v2, bs249, h, t, "dec-map-v249-p-nil") + testDeepEqualErr(v249v1, v249v2, t, "equal-map-v249-p-nil") + // ... + if v == nil { + v249v2 = nil + } else { + v249v2 = make(map[int32]float32, len(v)) + } // reset map + var v249v3, v249v4 typMapMapInt32Float32 + v249v3 = typMapMapInt32Float32(v249v1) + v249v4 = typMapMapInt32Float32(v249v2) + bs249 = testMarshalErr(v249v3, h, t, "enc-map-v249-custom") + testUnmarshalErr(v249v4, bs249, h, t, "dec-map-v249-p-len") + testDeepEqualErr(v249v3, v249v4, t, "equal-map-v249-p-len") + } + + for _, v := range []map[int32]float64{nil, {}, {44: 0, 33: 11.1}} { + // fmt.Printf(">>>> running mammoth map v250: %v\n", v) + var v250v1, v250v2 map[int32]float64 + v250v1 = v + bs250 := testMarshalErr(v250v1, h, t, "enc-map-v250") + if v == nil { + v250v2 = nil + } else { + v250v2 = make(map[int32]float64, len(v)) + } // reset map + testUnmarshalErr(v250v2, bs250, h, t, "dec-map-v250") + testDeepEqualErr(v250v1, v250v2, t, "equal-map-v250") + if v == nil { + v250v2 = nil + } else { + v250v2 = make(map[int32]float64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v250v2), bs250, h, t, "dec-map-v250-noaddr") // decode into non-addressable map value + testDeepEqualErr(v250v1, v250v2, t, "equal-map-v250-noaddr") + if v == nil { + v250v2 = nil + } else { + v250v2 = make(map[int32]float64, len(v)) + } // reset map + testUnmarshalErr(&v250v2, bs250, h, t, "dec-map-v250-p-len") + testDeepEqualErr(v250v1, v250v2, t, "equal-map-v250-p-len") + bs250 = testMarshalErr(&v250v1, h, t, "enc-map-v250-p") + v250v2 = nil + testUnmarshalErr(&v250v2, bs250, h, t, "dec-map-v250-p-nil") + testDeepEqualErr(v250v1, v250v2, t, "equal-map-v250-p-nil") + // ... + if v == nil { + v250v2 = nil + } else { + v250v2 = make(map[int32]float64, len(v)) + } // reset map + var v250v3, v250v4 typMapMapInt32Float64 + v250v3 = typMapMapInt32Float64(v250v1) + v250v4 = typMapMapInt32Float64(v250v2) + bs250 = testMarshalErr(v250v3, h, t, "enc-map-v250-custom") + testUnmarshalErr(v250v4, bs250, h, t, "dec-map-v250-p-len") + testDeepEqualErr(v250v3, v250v4, t, "equal-map-v250-p-len") + } + + for _, v := range []map[int32]bool{nil, {}, {44: false, 33: true}} { + // fmt.Printf(">>>> running mammoth map v251: %v\n", v) + var v251v1, v251v2 map[int32]bool + v251v1 = v + bs251 := testMarshalErr(v251v1, h, t, "enc-map-v251") + if v == nil { + v251v2 = nil + } else { + v251v2 = make(map[int32]bool, len(v)) + } // reset map + testUnmarshalErr(v251v2, bs251, h, t, "dec-map-v251") + testDeepEqualErr(v251v1, v251v2, t, "equal-map-v251") + if v == nil { + v251v2 = nil + } else { + v251v2 = make(map[int32]bool, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v251v2), bs251, h, t, "dec-map-v251-noaddr") // decode into non-addressable map value + testDeepEqualErr(v251v1, v251v2, t, "equal-map-v251-noaddr") + if v == nil { + v251v2 = nil + } else { + v251v2 = make(map[int32]bool, len(v)) + } // reset map + testUnmarshalErr(&v251v2, bs251, h, t, "dec-map-v251-p-len") + testDeepEqualErr(v251v1, v251v2, t, "equal-map-v251-p-len") + bs251 = testMarshalErr(&v251v1, h, t, "enc-map-v251-p") + v251v2 = nil + testUnmarshalErr(&v251v2, bs251, h, t, "dec-map-v251-p-nil") + testDeepEqualErr(v251v1, v251v2, t, "equal-map-v251-p-nil") + // ... + if v == nil { + v251v2 = nil + } else { + v251v2 = make(map[int32]bool, len(v)) + } // reset map + var v251v3, v251v4 typMapMapInt32Bool + v251v3 = typMapMapInt32Bool(v251v1) + v251v4 = typMapMapInt32Bool(v251v2) + bs251 = testMarshalErr(v251v3, h, t, "enc-map-v251-custom") + testUnmarshalErr(v251v4, bs251, h, t, "dec-map-v251-p-len") + testDeepEqualErr(v251v3, v251v4, t, "equal-map-v251-p-len") + } + + for _, v := range []map[int64]interface{}{nil, {}, {44: nil, 33: "string-is-an-interface-2"}} { + // fmt.Printf(">>>> running mammoth map v254: %v\n", v) + var v254v1, v254v2 map[int64]interface{} + v254v1 = v + bs254 := testMarshalErr(v254v1, h, t, "enc-map-v254") + if v == nil { + v254v2 = nil + } else { + v254v2 = make(map[int64]interface{}, len(v)) + } // reset map + testUnmarshalErr(v254v2, bs254, h, t, "dec-map-v254") + testDeepEqualErr(v254v1, v254v2, t, "equal-map-v254") + if v == nil { + v254v2 = nil + } else { + v254v2 = make(map[int64]interface{}, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v254v2), bs254, h, t, "dec-map-v254-noaddr") // decode into non-addressable map value + testDeepEqualErr(v254v1, v254v2, t, "equal-map-v254-noaddr") + if v == nil { + v254v2 = nil + } else { + v254v2 = make(map[int64]interface{}, len(v)) + } // reset map + testUnmarshalErr(&v254v2, bs254, h, t, "dec-map-v254-p-len") + testDeepEqualErr(v254v1, v254v2, t, "equal-map-v254-p-len") + bs254 = testMarshalErr(&v254v1, h, t, "enc-map-v254-p") + v254v2 = nil + testUnmarshalErr(&v254v2, bs254, h, t, "dec-map-v254-p-nil") + testDeepEqualErr(v254v1, v254v2, t, "equal-map-v254-p-nil") + // ... + if v == nil { + v254v2 = nil + } else { + v254v2 = make(map[int64]interface{}, len(v)) + } // reset map + var v254v3, v254v4 typMapMapInt64Intf + v254v3 = typMapMapInt64Intf(v254v1) + v254v4 = typMapMapInt64Intf(v254v2) + bs254 = testMarshalErr(v254v3, h, t, "enc-map-v254-custom") + testUnmarshalErr(v254v4, bs254, h, t, "dec-map-v254-p-len") + testDeepEqualErr(v254v3, v254v4, t, "equal-map-v254-p-len") + } + + for _, v := range []map[int64]string{nil, {}, {44: "", 33: "some-string-2"}} { + // fmt.Printf(">>>> running mammoth map v255: %v\n", v) + var v255v1, v255v2 map[int64]string + v255v1 = v + bs255 := testMarshalErr(v255v1, h, t, "enc-map-v255") + if v == nil { + v255v2 = nil + } else { + v255v2 = make(map[int64]string, len(v)) + } // reset map + testUnmarshalErr(v255v2, bs255, h, t, "dec-map-v255") + testDeepEqualErr(v255v1, v255v2, t, "equal-map-v255") + if v == nil { + v255v2 = nil + } else { + v255v2 = make(map[int64]string, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v255v2), bs255, h, t, "dec-map-v255-noaddr") // decode into non-addressable map value + testDeepEqualErr(v255v1, v255v2, t, "equal-map-v255-noaddr") + if v == nil { + v255v2 = nil + } else { + v255v2 = make(map[int64]string, len(v)) + } // reset map + testUnmarshalErr(&v255v2, bs255, h, t, "dec-map-v255-p-len") + testDeepEqualErr(v255v1, v255v2, t, "equal-map-v255-p-len") + bs255 = testMarshalErr(&v255v1, h, t, "enc-map-v255-p") + v255v2 = nil + testUnmarshalErr(&v255v2, bs255, h, t, "dec-map-v255-p-nil") + testDeepEqualErr(v255v1, v255v2, t, "equal-map-v255-p-nil") + // ... + if v == nil { + v255v2 = nil + } else { + v255v2 = make(map[int64]string, len(v)) + } // reset map + var v255v3, v255v4 typMapMapInt64String + v255v3 = typMapMapInt64String(v255v1) + v255v4 = typMapMapInt64String(v255v2) + bs255 = testMarshalErr(v255v3, h, t, "enc-map-v255-custom") + testUnmarshalErr(v255v4, bs255, h, t, "dec-map-v255-p-len") + testDeepEqualErr(v255v3, v255v4, t, "equal-map-v255-p-len") + } + + for _, v := range []map[int64]uint{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v256: %v\n", v) + var v256v1, v256v2 map[int64]uint + v256v1 = v + bs256 := testMarshalErr(v256v1, h, t, "enc-map-v256") + if v == nil { + v256v2 = nil + } else { + v256v2 = make(map[int64]uint, len(v)) + } // reset map + testUnmarshalErr(v256v2, bs256, h, t, "dec-map-v256") + testDeepEqualErr(v256v1, v256v2, t, "equal-map-v256") + if v == nil { + v256v2 = nil + } else { + v256v2 = make(map[int64]uint, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v256v2), bs256, h, t, "dec-map-v256-noaddr") // decode into non-addressable map value + testDeepEqualErr(v256v1, v256v2, t, "equal-map-v256-noaddr") + if v == nil { + v256v2 = nil + } else { + v256v2 = make(map[int64]uint, len(v)) + } // reset map + testUnmarshalErr(&v256v2, bs256, h, t, "dec-map-v256-p-len") + testDeepEqualErr(v256v1, v256v2, t, "equal-map-v256-p-len") + bs256 = testMarshalErr(&v256v1, h, t, "enc-map-v256-p") + v256v2 = nil + testUnmarshalErr(&v256v2, bs256, h, t, "dec-map-v256-p-nil") + testDeepEqualErr(v256v1, v256v2, t, "equal-map-v256-p-nil") + // ... + if v == nil { + v256v2 = nil + } else { + v256v2 = make(map[int64]uint, len(v)) + } // reset map + var v256v3, v256v4 typMapMapInt64Uint + v256v3 = typMapMapInt64Uint(v256v1) + v256v4 = typMapMapInt64Uint(v256v2) + bs256 = testMarshalErr(v256v3, h, t, "enc-map-v256-custom") + testUnmarshalErr(v256v4, bs256, h, t, "dec-map-v256-p-len") + testDeepEqualErr(v256v3, v256v4, t, "equal-map-v256-p-len") + } + + for _, v := range []map[int64]uint8{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v257: %v\n", v) + var v257v1, v257v2 map[int64]uint8 + v257v1 = v + bs257 := testMarshalErr(v257v1, h, t, "enc-map-v257") + if v == nil { + v257v2 = nil + } else { + v257v2 = make(map[int64]uint8, len(v)) + } // reset map + testUnmarshalErr(v257v2, bs257, h, t, "dec-map-v257") + testDeepEqualErr(v257v1, v257v2, t, "equal-map-v257") + if v == nil { + v257v2 = nil + } else { + v257v2 = make(map[int64]uint8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v257v2), bs257, h, t, "dec-map-v257-noaddr") // decode into non-addressable map value + testDeepEqualErr(v257v1, v257v2, t, "equal-map-v257-noaddr") + if v == nil { + v257v2 = nil + } else { + v257v2 = make(map[int64]uint8, len(v)) + } // reset map + testUnmarshalErr(&v257v2, bs257, h, t, "dec-map-v257-p-len") + testDeepEqualErr(v257v1, v257v2, t, "equal-map-v257-p-len") + bs257 = testMarshalErr(&v257v1, h, t, "enc-map-v257-p") + v257v2 = nil + testUnmarshalErr(&v257v2, bs257, h, t, "dec-map-v257-p-nil") + testDeepEqualErr(v257v1, v257v2, t, "equal-map-v257-p-nil") + // ... + if v == nil { + v257v2 = nil + } else { + v257v2 = make(map[int64]uint8, len(v)) + } // reset map + var v257v3, v257v4 typMapMapInt64Uint8 + v257v3 = typMapMapInt64Uint8(v257v1) + v257v4 = typMapMapInt64Uint8(v257v2) + bs257 = testMarshalErr(v257v3, h, t, "enc-map-v257-custom") + testUnmarshalErr(v257v4, bs257, h, t, "dec-map-v257-p-len") + testDeepEqualErr(v257v3, v257v4, t, "equal-map-v257-p-len") + } + + for _, v := range []map[int64]uint16{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v258: %v\n", v) + var v258v1, v258v2 map[int64]uint16 + v258v1 = v + bs258 := testMarshalErr(v258v1, h, t, "enc-map-v258") + if v == nil { + v258v2 = nil + } else { + v258v2 = make(map[int64]uint16, len(v)) + } // reset map + testUnmarshalErr(v258v2, bs258, h, t, "dec-map-v258") + testDeepEqualErr(v258v1, v258v2, t, "equal-map-v258") + if v == nil { + v258v2 = nil + } else { + v258v2 = make(map[int64]uint16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v258v2), bs258, h, t, "dec-map-v258-noaddr") // decode into non-addressable map value + testDeepEqualErr(v258v1, v258v2, t, "equal-map-v258-noaddr") + if v == nil { + v258v2 = nil + } else { + v258v2 = make(map[int64]uint16, len(v)) + } // reset map + testUnmarshalErr(&v258v2, bs258, h, t, "dec-map-v258-p-len") + testDeepEqualErr(v258v1, v258v2, t, "equal-map-v258-p-len") + bs258 = testMarshalErr(&v258v1, h, t, "enc-map-v258-p") + v258v2 = nil + testUnmarshalErr(&v258v2, bs258, h, t, "dec-map-v258-p-nil") + testDeepEqualErr(v258v1, v258v2, t, "equal-map-v258-p-nil") + // ... + if v == nil { + v258v2 = nil + } else { + v258v2 = make(map[int64]uint16, len(v)) + } // reset map + var v258v3, v258v4 typMapMapInt64Uint16 + v258v3 = typMapMapInt64Uint16(v258v1) + v258v4 = typMapMapInt64Uint16(v258v2) + bs258 = testMarshalErr(v258v3, h, t, "enc-map-v258-custom") + testUnmarshalErr(v258v4, bs258, h, t, "dec-map-v258-p-len") + testDeepEqualErr(v258v3, v258v4, t, "equal-map-v258-p-len") + } + + for _, v := range []map[int64]uint32{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v259: %v\n", v) + var v259v1, v259v2 map[int64]uint32 + v259v1 = v + bs259 := testMarshalErr(v259v1, h, t, "enc-map-v259") + if v == nil { + v259v2 = nil + } else { + v259v2 = make(map[int64]uint32, len(v)) + } // reset map + testUnmarshalErr(v259v2, bs259, h, t, "dec-map-v259") + testDeepEqualErr(v259v1, v259v2, t, "equal-map-v259") + if v == nil { + v259v2 = nil + } else { + v259v2 = make(map[int64]uint32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v259v2), bs259, h, t, "dec-map-v259-noaddr") // decode into non-addressable map value + testDeepEqualErr(v259v1, v259v2, t, "equal-map-v259-noaddr") + if v == nil { + v259v2 = nil + } else { + v259v2 = make(map[int64]uint32, len(v)) + } // reset map + testUnmarshalErr(&v259v2, bs259, h, t, "dec-map-v259-p-len") + testDeepEqualErr(v259v1, v259v2, t, "equal-map-v259-p-len") + bs259 = testMarshalErr(&v259v1, h, t, "enc-map-v259-p") + v259v2 = nil + testUnmarshalErr(&v259v2, bs259, h, t, "dec-map-v259-p-nil") + testDeepEqualErr(v259v1, v259v2, t, "equal-map-v259-p-nil") + // ... + if v == nil { + v259v2 = nil + } else { + v259v2 = make(map[int64]uint32, len(v)) + } // reset map + var v259v3, v259v4 typMapMapInt64Uint32 + v259v3 = typMapMapInt64Uint32(v259v1) + v259v4 = typMapMapInt64Uint32(v259v2) + bs259 = testMarshalErr(v259v3, h, t, "enc-map-v259-custom") + testUnmarshalErr(v259v4, bs259, h, t, "dec-map-v259-p-len") + testDeepEqualErr(v259v3, v259v4, t, "equal-map-v259-p-len") + } + + for _, v := range []map[int64]uint64{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v260: %v\n", v) + var v260v1, v260v2 map[int64]uint64 + v260v1 = v + bs260 := testMarshalErr(v260v1, h, t, "enc-map-v260") + if v == nil { + v260v2 = nil + } else { + v260v2 = make(map[int64]uint64, len(v)) + } // reset map + testUnmarshalErr(v260v2, bs260, h, t, "dec-map-v260") + testDeepEqualErr(v260v1, v260v2, t, "equal-map-v260") + if v == nil { + v260v2 = nil + } else { + v260v2 = make(map[int64]uint64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v260v2), bs260, h, t, "dec-map-v260-noaddr") // decode into non-addressable map value + testDeepEqualErr(v260v1, v260v2, t, "equal-map-v260-noaddr") + if v == nil { + v260v2 = nil + } else { + v260v2 = make(map[int64]uint64, len(v)) + } // reset map + testUnmarshalErr(&v260v2, bs260, h, t, "dec-map-v260-p-len") + testDeepEqualErr(v260v1, v260v2, t, "equal-map-v260-p-len") + bs260 = testMarshalErr(&v260v1, h, t, "enc-map-v260-p") + v260v2 = nil + testUnmarshalErr(&v260v2, bs260, h, t, "dec-map-v260-p-nil") + testDeepEqualErr(v260v1, v260v2, t, "equal-map-v260-p-nil") + // ... + if v == nil { + v260v2 = nil + } else { + v260v2 = make(map[int64]uint64, len(v)) + } // reset map + var v260v3, v260v4 typMapMapInt64Uint64 + v260v3 = typMapMapInt64Uint64(v260v1) + v260v4 = typMapMapInt64Uint64(v260v2) + bs260 = testMarshalErr(v260v3, h, t, "enc-map-v260-custom") + testUnmarshalErr(v260v4, bs260, h, t, "dec-map-v260-p-len") + testDeepEqualErr(v260v3, v260v4, t, "equal-map-v260-p-len") + } + + for _, v := range []map[int64]uintptr{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v261: %v\n", v) + var v261v1, v261v2 map[int64]uintptr + v261v1 = v + bs261 := testMarshalErr(v261v1, h, t, "enc-map-v261") + if v == nil { + v261v2 = nil + } else { + v261v2 = make(map[int64]uintptr, len(v)) + } // reset map + testUnmarshalErr(v261v2, bs261, h, t, "dec-map-v261") + testDeepEqualErr(v261v1, v261v2, t, "equal-map-v261") + if v == nil { + v261v2 = nil + } else { + v261v2 = make(map[int64]uintptr, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v261v2), bs261, h, t, "dec-map-v261-noaddr") // decode into non-addressable map value + testDeepEqualErr(v261v1, v261v2, t, "equal-map-v261-noaddr") + if v == nil { + v261v2 = nil + } else { + v261v2 = make(map[int64]uintptr, len(v)) + } // reset map + testUnmarshalErr(&v261v2, bs261, h, t, "dec-map-v261-p-len") + testDeepEqualErr(v261v1, v261v2, t, "equal-map-v261-p-len") + bs261 = testMarshalErr(&v261v1, h, t, "enc-map-v261-p") + v261v2 = nil + testUnmarshalErr(&v261v2, bs261, h, t, "dec-map-v261-p-nil") + testDeepEqualErr(v261v1, v261v2, t, "equal-map-v261-p-nil") + // ... + if v == nil { + v261v2 = nil + } else { + v261v2 = make(map[int64]uintptr, len(v)) + } // reset map + var v261v3, v261v4 typMapMapInt64Uintptr + v261v3 = typMapMapInt64Uintptr(v261v1) + v261v4 = typMapMapInt64Uintptr(v261v2) + bs261 = testMarshalErr(v261v3, h, t, "enc-map-v261-custom") + testUnmarshalErr(v261v4, bs261, h, t, "dec-map-v261-p-len") + testDeepEqualErr(v261v3, v261v4, t, "equal-map-v261-p-len") + } + + for _, v := range []map[int64]int{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v262: %v\n", v) + var v262v1, v262v2 map[int64]int + v262v1 = v + bs262 := testMarshalErr(v262v1, h, t, "enc-map-v262") + if v == nil { + v262v2 = nil + } else { + v262v2 = make(map[int64]int, len(v)) + } // reset map + testUnmarshalErr(v262v2, bs262, h, t, "dec-map-v262") + testDeepEqualErr(v262v1, v262v2, t, "equal-map-v262") + if v == nil { + v262v2 = nil + } else { + v262v2 = make(map[int64]int, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v262v2), bs262, h, t, "dec-map-v262-noaddr") // decode into non-addressable map value + testDeepEqualErr(v262v1, v262v2, t, "equal-map-v262-noaddr") + if v == nil { + v262v2 = nil + } else { + v262v2 = make(map[int64]int, len(v)) + } // reset map + testUnmarshalErr(&v262v2, bs262, h, t, "dec-map-v262-p-len") + testDeepEqualErr(v262v1, v262v2, t, "equal-map-v262-p-len") + bs262 = testMarshalErr(&v262v1, h, t, "enc-map-v262-p") + v262v2 = nil + testUnmarshalErr(&v262v2, bs262, h, t, "dec-map-v262-p-nil") + testDeepEqualErr(v262v1, v262v2, t, "equal-map-v262-p-nil") + // ... + if v == nil { + v262v2 = nil + } else { + v262v2 = make(map[int64]int, len(v)) + } // reset map + var v262v3, v262v4 typMapMapInt64Int + v262v3 = typMapMapInt64Int(v262v1) + v262v4 = typMapMapInt64Int(v262v2) + bs262 = testMarshalErr(v262v3, h, t, "enc-map-v262-custom") + testUnmarshalErr(v262v4, bs262, h, t, "dec-map-v262-p-len") + testDeepEqualErr(v262v3, v262v4, t, "equal-map-v262-p-len") + } + + for _, v := range []map[int64]int8{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v263: %v\n", v) + var v263v1, v263v2 map[int64]int8 + v263v1 = v + bs263 := testMarshalErr(v263v1, h, t, "enc-map-v263") + if v == nil { + v263v2 = nil + } else { + v263v2 = make(map[int64]int8, len(v)) + } // reset map + testUnmarshalErr(v263v2, bs263, h, t, "dec-map-v263") + testDeepEqualErr(v263v1, v263v2, t, "equal-map-v263") + if v == nil { + v263v2 = nil + } else { + v263v2 = make(map[int64]int8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v263v2), bs263, h, t, "dec-map-v263-noaddr") // decode into non-addressable map value + testDeepEqualErr(v263v1, v263v2, t, "equal-map-v263-noaddr") + if v == nil { + v263v2 = nil + } else { + v263v2 = make(map[int64]int8, len(v)) + } // reset map + testUnmarshalErr(&v263v2, bs263, h, t, "dec-map-v263-p-len") + testDeepEqualErr(v263v1, v263v2, t, "equal-map-v263-p-len") + bs263 = testMarshalErr(&v263v1, h, t, "enc-map-v263-p") + v263v2 = nil + testUnmarshalErr(&v263v2, bs263, h, t, "dec-map-v263-p-nil") + testDeepEqualErr(v263v1, v263v2, t, "equal-map-v263-p-nil") + // ... + if v == nil { + v263v2 = nil + } else { + v263v2 = make(map[int64]int8, len(v)) + } // reset map + var v263v3, v263v4 typMapMapInt64Int8 + v263v3 = typMapMapInt64Int8(v263v1) + v263v4 = typMapMapInt64Int8(v263v2) + bs263 = testMarshalErr(v263v3, h, t, "enc-map-v263-custom") + testUnmarshalErr(v263v4, bs263, h, t, "dec-map-v263-p-len") + testDeepEqualErr(v263v3, v263v4, t, "equal-map-v263-p-len") + } + + for _, v := range []map[int64]int16{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v264: %v\n", v) + var v264v1, v264v2 map[int64]int16 + v264v1 = v + bs264 := testMarshalErr(v264v1, h, t, "enc-map-v264") + if v == nil { + v264v2 = nil + } else { + v264v2 = make(map[int64]int16, len(v)) + } // reset map + testUnmarshalErr(v264v2, bs264, h, t, "dec-map-v264") + testDeepEqualErr(v264v1, v264v2, t, "equal-map-v264") + if v == nil { + v264v2 = nil + } else { + v264v2 = make(map[int64]int16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v264v2), bs264, h, t, "dec-map-v264-noaddr") // decode into non-addressable map value + testDeepEqualErr(v264v1, v264v2, t, "equal-map-v264-noaddr") + if v == nil { + v264v2 = nil + } else { + v264v2 = make(map[int64]int16, len(v)) + } // reset map + testUnmarshalErr(&v264v2, bs264, h, t, "dec-map-v264-p-len") + testDeepEqualErr(v264v1, v264v2, t, "equal-map-v264-p-len") + bs264 = testMarshalErr(&v264v1, h, t, "enc-map-v264-p") + v264v2 = nil + testUnmarshalErr(&v264v2, bs264, h, t, "dec-map-v264-p-nil") + testDeepEqualErr(v264v1, v264v2, t, "equal-map-v264-p-nil") + // ... + if v == nil { + v264v2 = nil + } else { + v264v2 = make(map[int64]int16, len(v)) + } // reset map + var v264v3, v264v4 typMapMapInt64Int16 + v264v3 = typMapMapInt64Int16(v264v1) + v264v4 = typMapMapInt64Int16(v264v2) + bs264 = testMarshalErr(v264v3, h, t, "enc-map-v264-custom") + testUnmarshalErr(v264v4, bs264, h, t, "dec-map-v264-p-len") + testDeepEqualErr(v264v3, v264v4, t, "equal-map-v264-p-len") + } + + for _, v := range []map[int64]int32{nil, {}, {33: 0, 44: 33}} { + // fmt.Printf(">>>> running mammoth map v265: %v\n", v) + var v265v1, v265v2 map[int64]int32 + v265v1 = v + bs265 := testMarshalErr(v265v1, h, t, "enc-map-v265") + if v == nil { + v265v2 = nil + } else { + v265v2 = make(map[int64]int32, len(v)) + } // reset map + testUnmarshalErr(v265v2, bs265, h, t, "dec-map-v265") + testDeepEqualErr(v265v1, v265v2, t, "equal-map-v265") + if v == nil { + v265v2 = nil + } else { + v265v2 = make(map[int64]int32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v265v2), bs265, h, t, "dec-map-v265-noaddr") // decode into non-addressable map value + testDeepEqualErr(v265v1, v265v2, t, "equal-map-v265-noaddr") + if v == nil { + v265v2 = nil + } else { + v265v2 = make(map[int64]int32, len(v)) + } // reset map + testUnmarshalErr(&v265v2, bs265, h, t, "dec-map-v265-p-len") + testDeepEqualErr(v265v1, v265v2, t, "equal-map-v265-p-len") + bs265 = testMarshalErr(&v265v1, h, t, "enc-map-v265-p") + v265v2 = nil + testUnmarshalErr(&v265v2, bs265, h, t, "dec-map-v265-p-nil") + testDeepEqualErr(v265v1, v265v2, t, "equal-map-v265-p-nil") + // ... + if v == nil { + v265v2 = nil + } else { + v265v2 = make(map[int64]int32, len(v)) + } // reset map + var v265v3, v265v4 typMapMapInt64Int32 + v265v3 = typMapMapInt64Int32(v265v1) + v265v4 = typMapMapInt64Int32(v265v2) + bs265 = testMarshalErr(v265v3, h, t, "enc-map-v265-custom") + testUnmarshalErr(v265v4, bs265, h, t, "dec-map-v265-p-len") + testDeepEqualErr(v265v3, v265v4, t, "equal-map-v265-p-len") + } + + for _, v := range []map[int64]int64{nil, {}, {44: 0, 33: 44}} { + // fmt.Printf(">>>> running mammoth map v266: %v\n", v) + var v266v1, v266v2 map[int64]int64 + v266v1 = v + bs266 := testMarshalErr(v266v1, h, t, "enc-map-v266") + if v == nil { + v266v2 = nil + } else { + v266v2 = make(map[int64]int64, len(v)) + } // reset map + testUnmarshalErr(v266v2, bs266, h, t, "dec-map-v266") + testDeepEqualErr(v266v1, v266v2, t, "equal-map-v266") + if v == nil { + v266v2 = nil + } else { + v266v2 = make(map[int64]int64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v266v2), bs266, h, t, "dec-map-v266-noaddr") // decode into non-addressable map value + testDeepEqualErr(v266v1, v266v2, t, "equal-map-v266-noaddr") + if v == nil { + v266v2 = nil + } else { + v266v2 = make(map[int64]int64, len(v)) + } // reset map + testUnmarshalErr(&v266v2, bs266, h, t, "dec-map-v266-p-len") + testDeepEqualErr(v266v1, v266v2, t, "equal-map-v266-p-len") + bs266 = testMarshalErr(&v266v1, h, t, "enc-map-v266-p") + v266v2 = nil + testUnmarshalErr(&v266v2, bs266, h, t, "dec-map-v266-p-nil") + testDeepEqualErr(v266v1, v266v2, t, "equal-map-v266-p-nil") + // ... + if v == nil { + v266v2 = nil + } else { + v266v2 = make(map[int64]int64, len(v)) + } // reset map + var v266v3, v266v4 typMapMapInt64Int64 + v266v3 = typMapMapInt64Int64(v266v1) + v266v4 = typMapMapInt64Int64(v266v2) + bs266 = testMarshalErr(v266v3, h, t, "enc-map-v266-custom") + testUnmarshalErr(v266v4, bs266, h, t, "dec-map-v266-p-len") + testDeepEqualErr(v266v3, v266v4, t, "equal-map-v266-p-len") + } + + for _, v := range []map[int64]float32{nil, {}, {33: 0, 44: 22.2}} { + // fmt.Printf(">>>> running mammoth map v267: %v\n", v) + var v267v1, v267v2 map[int64]float32 + v267v1 = v + bs267 := testMarshalErr(v267v1, h, t, "enc-map-v267") + if v == nil { + v267v2 = nil + } else { + v267v2 = make(map[int64]float32, len(v)) + } // reset map + testUnmarshalErr(v267v2, bs267, h, t, "dec-map-v267") + testDeepEqualErr(v267v1, v267v2, t, "equal-map-v267") + if v == nil { + v267v2 = nil + } else { + v267v2 = make(map[int64]float32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v267v2), bs267, h, t, "dec-map-v267-noaddr") // decode into non-addressable map value + testDeepEqualErr(v267v1, v267v2, t, "equal-map-v267-noaddr") + if v == nil { + v267v2 = nil + } else { + v267v2 = make(map[int64]float32, len(v)) + } // reset map + testUnmarshalErr(&v267v2, bs267, h, t, "dec-map-v267-p-len") + testDeepEqualErr(v267v1, v267v2, t, "equal-map-v267-p-len") + bs267 = testMarshalErr(&v267v1, h, t, "enc-map-v267-p") + v267v2 = nil + testUnmarshalErr(&v267v2, bs267, h, t, "dec-map-v267-p-nil") + testDeepEqualErr(v267v1, v267v2, t, "equal-map-v267-p-nil") + // ... + if v == nil { + v267v2 = nil + } else { + v267v2 = make(map[int64]float32, len(v)) + } // reset map + var v267v3, v267v4 typMapMapInt64Float32 + v267v3 = typMapMapInt64Float32(v267v1) + v267v4 = typMapMapInt64Float32(v267v2) + bs267 = testMarshalErr(v267v3, h, t, "enc-map-v267-custom") + testUnmarshalErr(v267v4, bs267, h, t, "dec-map-v267-p-len") + testDeepEqualErr(v267v3, v267v4, t, "equal-map-v267-p-len") + } + + for _, v := range []map[int64]float64{nil, {}, {33: 0, 44: 11.1}} { + // fmt.Printf(">>>> running mammoth map v268: %v\n", v) + var v268v1, v268v2 map[int64]float64 + v268v1 = v + bs268 := testMarshalErr(v268v1, h, t, "enc-map-v268") + if v == nil { + v268v2 = nil + } else { + v268v2 = make(map[int64]float64, len(v)) + } // reset map + testUnmarshalErr(v268v2, bs268, h, t, "dec-map-v268") + testDeepEqualErr(v268v1, v268v2, t, "equal-map-v268") + if v == nil { + v268v2 = nil + } else { + v268v2 = make(map[int64]float64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v268v2), bs268, h, t, "dec-map-v268-noaddr") // decode into non-addressable map value + testDeepEqualErr(v268v1, v268v2, t, "equal-map-v268-noaddr") + if v == nil { + v268v2 = nil + } else { + v268v2 = make(map[int64]float64, len(v)) + } // reset map + testUnmarshalErr(&v268v2, bs268, h, t, "dec-map-v268-p-len") + testDeepEqualErr(v268v1, v268v2, t, "equal-map-v268-p-len") + bs268 = testMarshalErr(&v268v1, h, t, "enc-map-v268-p") + v268v2 = nil + testUnmarshalErr(&v268v2, bs268, h, t, "dec-map-v268-p-nil") + testDeepEqualErr(v268v1, v268v2, t, "equal-map-v268-p-nil") + // ... + if v == nil { + v268v2 = nil + } else { + v268v2 = make(map[int64]float64, len(v)) + } // reset map + var v268v3, v268v4 typMapMapInt64Float64 + v268v3 = typMapMapInt64Float64(v268v1) + v268v4 = typMapMapInt64Float64(v268v2) + bs268 = testMarshalErr(v268v3, h, t, "enc-map-v268-custom") + testUnmarshalErr(v268v4, bs268, h, t, "dec-map-v268-p-len") + testDeepEqualErr(v268v3, v268v4, t, "equal-map-v268-p-len") + } + + for _, v := range []map[int64]bool{nil, {}, {33: false, 44: true}} { + // fmt.Printf(">>>> running mammoth map v269: %v\n", v) + var v269v1, v269v2 map[int64]bool + v269v1 = v + bs269 := testMarshalErr(v269v1, h, t, "enc-map-v269") + if v == nil { + v269v2 = nil + } else { + v269v2 = make(map[int64]bool, len(v)) + } // reset map + testUnmarshalErr(v269v2, bs269, h, t, "dec-map-v269") + testDeepEqualErr(v269v1, v269v2, t, "equal-map-v269") + if v == nil { + v269v2 = nil + } else { + v269v2 = make(map[int64]bool, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v269v2), bs269, h, t, "dec-map-v269-noaddr") // decode into non-addressable map value + testDeepEqualErr(v269v1, v269v2, t, "equal-map-v269-noaddr") + if v == nil { + v269v2 = nil + } else { + v269v2 = make(map[int64]bool, len(v)) + } // reset map + testUnmarshalErr(&v269v2, bs269, h, t, "dec-map-v269-p-len") + testDeepEqualErr(v269v1, v269v2, t, "equal-map-v269-p-len") + bs269 = testMarshalErr(&v269v1, h, t, "enc-map-v269-p") + v269v2 = nil + testUnmarshalErr(&v269v2, bs269, h, t, "dec-map-v269-p-nil") + testDeepEqualErr(v269v1, v269v2, t, "equal-map-v269-p-nil") + // ... + if v == nil { + v269v2 = nil + } else { + v269v2 = make(map[int64]bool, len(v)) + } // reset map + var v269v3, v269v4 typMapMapInt64Bool + v269v3 = typMapMapInt64Bool(v269v1) + v269v4 = typMapMapInt64Bool(v269v2) + bs269 = testMarshalErr(v269v3, h, t, "enc-map-v269-custom") + testUnmarshalErr(v269v4, bs269, h, t, "dec-map-v269-p-len") + testDeepEqualErr(v269v3, v269v4, t, "equal-map-v269-p-len") + } + + for _, v := range []map[bool]interface{}{nil, {}, {true: nil}} { + // fmt.Printf(">>>> running mammoth map v272: %v\n", v) + var v272v1, v272v2 map[bool]interface{} + v272v1 = v + bs272 := testMarshalErr(v272v1, h, t, "enc-map-v272") + if v == nil { + v272v2 = nil + } else { + v272v2 = make(map[bool]interface{}, len(v)) + } // reset map + testUnmarshalErr(v272v2, bs272, h, t, "dec-map-v272") + testDeepEqualErr(v272v1, v272v2, t, "equal-map-v272") + if v == nil { + v272v2 = nil + } else { + v272v2 = make(map[bool]interface{}, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v272v2), bs272, h, t, "dec-map-v272-noaddr") // decode into non-addressable map value + testDeepEqualErr(v272v1, v272v2, t, "equal-map-v272-noaddr") + if v == nil { + v272v2 = nil + } else { + v272v2 = make(map[bool]interface{}, len(v)) + } // reset map + testUnmarshalErr(&v272v2, bs272, h, t, "dec-map-v272-p-len") + testDeepEqualErr(v272v1, v272v2, t, "equal-map-v272-p-len") + bs272 = testMarshalErr(&v272v1, h, t, "enc-map-v272-p") + v272v2 = nil + testUnmarshalErr(&v272v2, bs272, h, t, "dec-map-v272-p-nil") + testDeepEqualErr(v272v1, v272v2, t, "equal-map-v272-p-nil") + // ... + if v == nil { + v272v2 = nil + } else { + v272v2 = make(map[bool]interface{}, len(v)) + } // reset map + var v272v3, v272v4 typMapMapBoolIntf + v272v3 = typMapMapBoolIntf(v272v1) + v272v4 = typMapMapBoolIntf(v272v2) + bs272 = testMarshalErr(v272v3, h, t, "enc-map-v272-custom") + testUnmarshalErr(v272v4, bs272, h, t, "dec-map-v272-p-len") + testDeepEqualErr(v272v3, v272v4, t, "equal-map-v272-p-len") + } + + for _, v := range []map[bool]string{nil, {}, {true: ""}} { + // fmt.Printf(">>>> running mammoth map v273: %v\n", v) + var v273v1, v273v2 map[bool]string + v273v1 = v + bs273 := testMarshalErr(v273v1, h, t, "enc-map-v273") + if v == nil { + v273v2 = nil + } else { + v273v2 = make(map[bool]string, len(v)) + } // reset map + testUnmarshalErr(v273v2, bs273, h, t, "dec-map-v273") + testDeepEqualErr(v273v1, v273v2, t, "equal-map-v273") + if v == nil { + v273v2 = nil + } else { + v273v2 = make(map[bool]string, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v273v2), bs273, h, t, "dec-map-v273-noaddr") // decode into non-addressable map value + testDeepEqualErr(v273v1, v273v2, t, "equal-map-v273-noaddr") + if v == nil { + v273v2 = nil + } else { + v273v2 = make(map[bool]string, len(v)) + } // reset map + testUnmarshalErr(&v273v2, bs273, h, t, "dec-map-v273-p-len") + testDeepEqualErr(v273v1, v273v2, t, "equal-map-v273-p-len") + bs273 = testMarshalErr(&v273v1, h, t, "enc-map-v273-p") + v273v2 = nil + testUnmarshalErr(&v273v2, bs273, h, t, "dec-map-v273-p-nil") + testDeepEqualErr(v273v1, v273v2, t, "equal-map-v273-p-nil") + // ... + if v == nil { + v273v2 = nil + } else { + v273v2 = make(map[bool]string, len(v)) + } // reset map + var v273v3, v273v4 typMapMapBoolString + v273v3 = typMapMapBoolString(v273v1) + v273v4 = typMapMapBoolString(v273v2) + bs273 = testMarshalErr(v273v3, h, t, "enc-map-v273-custom") + testUnmarshalErr(v273v4, bs273, h, t, "dec-map-v273-p-len") + testDeepEqualErr(v273v3, v273v4, t, "equal-map-v273-p-len") + } + + for _, v := range []map[bool]uint{nil, {}, {true: 0}} { + // fmt.Printf(">>>> running mammoth map v274: %v\n", v) + var v274v1, v274v2 map[bool]uint + v274v1 = v + bs274 := testMarshalErr(v274v1, h, t, "enc-map-v274") + if v == nil { + v274v2 = nil + } else { + v274v2 = make(map[bool]uint, len(v)) + } // reset map + testUnmarshalErr(v274v2, bs274, h, t, "dec-map-v274") + testDeepEqualErr(v274v1, v274v2, t, "equal-map-v274") + if v == nil { + v274v2 = nil + } else { + v274v2 = make(map[bool]uint, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v274v2), bs274, h, t, "dec-map-v274-noaddr") // decode into non-addressable map value + testDeepEqualErr(v274v1, v274v2, t, "equal-map-v274-noaddr") + if v == nil { + v274v2 = nil + } else { + v274v2 = make(map[bool]uint, len(v)) + } // reset map + testUnmarshalErr(&v274v2, bs274, h, t, "dec-map-v274-p-len") + testDeepEqualErr(v274v1, v274v2, t, "equal-map-v274-p-len") + bs274 = testMarshalErr(&v274v1, h, t, "enc-map-v274-p") + v274v2 = nil + testUnmarshalErr(&v274v2, bs274, h, t, "dec-map-v274-p-nil") + testDeepEqualErr(v274v1, v274v2, t, "equal-map-v274-p-nil") + // ... + if v == nil { + v274v2 = nil + } else { + v274v2 = make(map[bool]uint, len(v)) + } // reset map + var v274v3, v274v4 typMapMapBoolUint + v274v3 = typMapMapBoolUint(v274v1) + v274v4 = typMapMapBoolUint(v274v2) + bs274 = testMarshalErr(v274v3, h, t, "enc-map-v274-custom") + testUnmarshalErr(v274v4, bs274, h, t, "dec-map-v274-p-len") + testDeepEqualErr(v274v3, v274v4, t, "equal-map-v274-p-len") + } + + for _, v := range []map[bool]uint8{nil, {}, {true: 0}} { + // fmt.Printf(">>>> running mammoth map v275: %v\n", v) + var v275v1, v275v2 map[bool]uint8 + v275v1 = v + bs275 := testMarshalErr(v275v1, h, t, "enc-map-v275") + if v == nil { + v275v2 = nil + } else { + v275v2 = make(map[bool]uint8, len(v)) + } // reset map + testUnmarshalErr(v275v2, bs275, h, t, "dec-map-v275") + testDeepEqualErr(v275v1, v275v2, t, "equal-map-v275") + if v == nil { + v275v2 = nil + } else { + v275v2 = make(map[bool]uint8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v275v2), bs275, h, t, "dec-map-v275-noaddr") // decode into non-addressable map value + testDeepEqualErr(v275v1, v275v2, t, "equal-map-v275-noaddr") + if v == nil { + v275v2 = nil + } else { + v275v2 = make(map[bool]uint8, len(v)) + } // reset map + testUnmarshalErr(&v275v2, bs275, h, t, "dec-map-v275-p-len") + testDeepEqualErr(v275v1, v275v2, t, "equal-map-v275-p-len") + bs275 = testMarshalErr(&v275v1, h, t, "enc-map-v275-p") + v275v2 = nil + testUnmarshalErr(&v275v2, bs275, h, t, "dec-map-v275-p-nil") + testDeepEqualErr(v275v1, v275v2, t, "equal-map-v275-p-nil") + // ... + if v == nil { + v275v2 = nil + } else { + v275v2 = make(map[bool]uint8, len(v)) + } // reset map + var v275v3, v275v4 typMapMapBoolUint8 + v275v3 = typMapMapBoolUint8(v275v1) + v275v4 = typMapMapBoolUint8(v275v2) + bs275 = testMarshalErr(v275v3, h, t, "enc-map-v275-custom") + testUnmarshalErr(v275v4, bs275, h, t, "dec-map-v275-p-len") + testDeepEqualErr(v275v3, v275v4, t, "equal-map-v275-p-len") + } + + for _, v := range []map[bool]uint16{nil, {}, {true: 0}} { + // fmt.Printf(">>>> running mammoth map v276: %v\n", v) + var v276v1, v276v2 map[bool]uint16 + v276v1 = v + bs276 := testMarshalErr(v276v1, h, t, "enc-map-v276") + if v == nil { + v276v2 = nil + } else { + v276v2 = make(map[bool]uint16, len(v)) + } // reset map + testUnmarshalErr(v276v2, bs276, h, t, "dec-map-v276") + testDeepEqualErr(v276v1, v276v2, t, "equal-map-v276") + if v == nil { + v276v2 = nil + } else { + v276v2 = make(map[bool]uint16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v276v2), bs276, h, t, "dec-map-v276-noaddr") // decode into non-addressable map value + testDeepEqualErr(v276v1, v276v2, t, "equal-map-v276-noaddr") + if v == nil { + v276v2 = nil + } else { + v276v2 = make(map[bool]uint16, len(v)) + } // reset map + testUnmarshalErr(&v276v2, bs276, h, t, "dec-map-v276-p-len") + testDeepEqualErr(v276v1, v276v2, t, "equal-map-v276-p-len") + bs276 = testMarshalErr(&v276v1, h, t, "enc-map-v276-p") + v276v2 = nil + testUnmarshalErr(&v276v2, bs276, h, t, "dec-map-v276-p-nil") + testDeepEqualErr(v276v1, v276v2, t, "equal-map-v276-p-nil") + // ... + if v == nil { + v276v2 = nil + } else { + v276v2 = make(map[bool]uint16, len(v)) + } // reset map + var v276v3, v276v4 typMapMapBoolUint16 + v276v3 = typMapMapBoolUint16(v276v1) + v276v4 = typMapMapBoolUint16(v276v2) + bs276 = testMarshalErr(v276v3, h, t, "enc-map-v276-custom") + testUnmarshalErr(v276v4, bs276, h, t, "dec-map-v276-p-len") + testDeepEqualErr(v276v3, v276v4, t, "equal-map-v276-p-len") + } + + for _, v := range []map[bool]uint32{nil, {}, {true: 0}} { + // fmt.Printf(">>>> running mammoth map v277: %v\n", v) + var v277v1, v277v2 map[bool]uint32 + v277v1 = v + bs277 := testMarshalErr(v277v1, h, t, "enc-map-v277") + if v == nil { + v277v2 = nil + } else { + v277v2 = make(map[bool]uint32, len(v)) + } // reset map + testUnmarshalErr(v277v2, bs277, h, t, "dec-map-v277") + testDeepEqualErr(v277v1, v277v2, t, "equal-map-v277") + if v == nil { + v277v2 = nil + } else { + v277v2 = make(map[bool]uint32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v277v2), bs277, h, t, "dec-map-v277-noaddr") // decode into non-addressable map value + testDeepEqualErr(v277v1, v277v2, t, "equal-map-v277-noaddr") + if v == nil { + v277v2 = nil + } else { + v277v2 = make(map[bool]uint32, len(v)) + } // reset map + testUnmarshalErr(&v277v2, bs277, h, t, "dec-map-v277-p-len") + testDeepEqualErr(v277v1, v277v2, t, "equal-map-v277-p-len") + bs277 = testMarshalErr(&v277v1, h, t, "enc-map-v277-p") + v277v2 = nil + testUnmarshalErr(&v277v2, bs277, h, t, "dec-map-v277-p-nil") + testDeepEqualErr(v277v1, v277v2, t, "equal-map-v277-p-nil") + // ... + if v == nil { + v277v2 = nil + } else { + v277v2 = make(map[bool]uint32, len(v)) + } // reset map + var v277v3, v277v4 typMapMapBoolUint32 + v277v3 = typMapMapBoolUint32(v277v1) + v277v4 = typMapMapBoolUint32(v277v2) + bs277 = testMarshalErr(v277v3, h, t, "enc-map-v277-custom") + testUnmarshalErr(v277v4, bs277, h, t, "dec-map-v277-p-len") + testDeepEqualErr(v277v3, v277v4, t, "equal-map-v277-p-len") + } + + for _, v := range []map[bool]uint64{nil, {}, {true: 0}} { + // fmt.Printf(">>>> running mammoth map v278: %v\n", v) + var v278v1, v278v2 map[bool]uint64 + v278v1 = v + bs278 := testMarshalErr(v278v1, h, t, "enc-map-v278") + if v == nil { + v278v2 = nil + } else { + v278v2 = make(map[bool]uint64, len(v)) + } // reset map + testUnmarshalErr(v278v2, bs278, h, t, "dec-map-v278") + testDeepEqualErr(v278v1, v278v2, t, "equal-map-v278") + if v == nil { + v278v2 = nil + } else { + v278v2 = make(map[bool]uint64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v278v2), bs278, h, t, "dec-map-v278-noaddr") // decode into non-addressable map value + testDeepEqualErr(v278v1, v278v2, t, "equal-map-v278-noaddr") + if v == nil { + v278v2 = nil + } else { + v278v2 = make(map[bool]uint64, len(v)) + } // reset map + testUnmarshalErr(&v278v2, bs278, h, t, "dec-map-v278-p-len") + testDeepEqualErr(v278v1, v278v2, t, "equal-map-v278-p-len") + bs278 = testMarshalErr(&v278v1, h, t, "enc-map-v278-p") + v278v2 = nil + testUnmarshalErr(&v278v2, bs278, h, t, "dec-map-v278-p-nil") + testDeepEqualErr(v278v1, v278v2, t, "equal-map-v278-p-nil") + // ... + if v == nil { + v278v2 = nil + } else { + v278v2 = make(map[bool]uint64, len(v)) + } // reset map + var v278v3, v278v4 typMapMapBoolUint64 + v278v3 = typMapMapBoolUint64(v278v1) + v278v4 = typMapMapBoolUint64(v278v2) + bs278 = testMarshalErr(v278v3, h, t, "enc-map-v278-custom") + testUnmarshalErr(v278v4, bs278, h, t, "dec-map-v278-p-len") + testDeepEqualErr(v278v3, v278v4, t, "equal-map-v278-p-len") + } + + for _, v := range []map[bool]uintptr{nil, {}, {true: 0}} { + // fmt.Printf(">>>> running mammoth map v279: %v\n", v) + var v279v1, v279v2 map[bool]uintptr + v279v1 = v + bs279 := testMarshalErr(v279v1, h, t, "enc-map-v279") + if v == nil { + v279v2 = nil + } else { + v279v2 = make(map[bool]uintptr, len(v)) + } // reset map + testUnmarshalErr(v279v2, bs279, h, t, "dec-map-v279") + testDeepEqualErr(v279v1, v279v2, t, "equal-map-v279") + if v == nil { + v279v2 = nil + } else { + v279v2 = make(map[bool]uintptr, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v279v2), bs279, h, t, "dec-map-v279-noaddr") // decode into non-addressable map value + testDeepEqualErr(v279v1, v279v2, t, "equal-map-v279-noaddr") + if v == nil { + v279v2 = nil + } else { + v279v2 = make(map[bool]uintptr, len(v)) + } // reset map + testUnmarshalErr(&v279v2, bs279, h, t, "dec-map-v279-p-len") + testDeepEqualErr(v279v1, v279v2, t, "equal-map-v279-p-len") + bs279 = testMarshalErr(&v279v1, h, t, "enc-map-v279-p") + v279v2 = nil + testUnmarshalErr(&v279v2, bs279, h, t, "dec-map-v279-p-nil") + testDeepEqualErr(v279v1, v279v2, t, "equal-map-v279-p-nil") + // ... + if v == nil { + v279v2 = nil + } else { + v279v2 = make(map[bool]uintptr, len(v)) + } // reset map + var v279v3, v279v4 typMapMapBoolUintptr + v279v3 = typMapMapBoolUintptr(v279v1) + v279v4 = typMapMapBoolUintptr(v279v2) + bs279 = testMarshalErr(v279v3, h, t, "enc-map-v279-custom") + testUnmarshalErr(v279v4, bs279, h, t, "dec-map-v279-p-len") + testDeepEqualErr(v279v3, v279v4, t, "equal-map-v279-p-len") + } + + for _, v := range []map[bool]int{nil, {}, {true: 0}} { + // fmt.Printf(">>>> running mammoth map v280: %v\n", v) + var v280v1, v280v2 map[bool]int + v280v1 = v + bs280 := testMarshalErr(v280v1, h, t, "enc-map-v280") + if v == nil { + v280v2 = nil + } else { + v280v2 = make(map[bool]int, len(v)) + } // reset map + testUnmarshalErr(v280v2, bs280, h, t, "dec-map-v280") + testDeepEqualErr(v280v1, v280v2, t, "equal-map-v280") + if v == nil { + v280v2 = nil + } else { + v280v2 = make(map[bool]int, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v280v2), bs280, h, t, "dec-map-v280-noaddr") // decode into non-addressable map value + testDeepEqualErr(v280v1, v280v2, t, "equal-map-v280-noaddr") + if v == nil { + v280v2 = nil + } else { + v280v2 = make(map[bool]int, len(v)) + } // reset map + testUnmarshalErr(&v280v2, bs280, h, t, "dec-map-v280-p-len") + testDeepEqualErr(v280v1, v280v2, t, "equal-map-v280-p-len") + bs280 = testMarshalErr(&v280v1, h, t, "enc-map-v280-p") + v280v2 = nil + testUnmarshalErr(&v280v2, bs280, h, t, "dec-map-v280-p-nil") + testDeepEqualErr(v280v1, v280v2, t, "equal-map-v280-p-nil") + // ... + if v == nil { + v280v2 = nil + } else { + v280v2 = make(map[bool]int, len(v)) + } // reset map + var v280v3, v280v4 typMapMapBoolInt + v280v3 = typMapMapBoolInt(v280v1) + v280v4 = typMapMapBoolInt(v280v2) + bs280 = testMarshalErr(v280v3, h, t, "enc-map-v280-custom") + testUnmarshalErr(v280v4, bs280, h, t, "dec-map-v280-p-len") + testDeepEqualErr(v280v3, v280v4, t, "equal-map-v280-p-len") + } + + for _, v := range []map[bool]int8{nil, {}, {true: 0}} { + // fmt.Printf(">>>> running mammoth map v281: %v\n", v) + var v281v1, v281v2 map[bool]int8 + v281v1 = v + bs281 := testMarshalErr(v281v1, h, t, "enc-map-v281") + if v == nil { + v281v2 = nil + } else { + v281v2 = make(map[bool]int8, len(v)) + } // reset map + testUnmarshalErr(v281v2, bs281, h, t, "dec-map-v281") + testDeepEqualErr(v281v1, v281v2, t, "equal-map-v281") + if v == nil { + v281v2 = nil + } else { + v281v2 = make(map[bool]int8, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v281v2), bs281, h, t, "dec-map-v281-noaddr") // decode into non-addressable map value + testDeepEqualErr(v281v1, v281v2, t, "equal-map-v281-noaddr") + if v == nil { + v281v2 = nil + } else { + v281v2 = make(map[bool]int8, len(v)) + } // reset map + testUnmarshalErr(&v281v2, bs281, h, t, "dec-map-v281-p-len") + testDeepEqualErr(v281v1, v281v2, t, "equal-map-v281-p-len") + bs281 = testMarshalErr(&v281v1, h, t, "enc-map-v281-p") + v281v2 = nil + testUnmarshalErr(&v281v2, bs281, h, t, "dec-map-v281-p-nil") + testDeepEqualErr(v281v1, v281v2, t, "equal-map-v281-p-nil") + // ... + if v == nil { + v281v2 = nil + } else { + v281v2 = make(map[bool]int8, len(v)) + } // reset map + var v281v3, v281v4 typMapMapBoolInt8 + v281v3 = typMapMapBoolInt8(v281v1) + v281v4 = typMapMapBoolInt8(v281v2) + bs281 = testMarshalErr(v281v3, h, t, "enc-map-v281-custom") + testUnmarshalErr(v281v4, bs281, h, t, "dec-map-v281-p-len") + testDeepEqualErr(v281v3, v281v4, t, "equal-map-v281-p-len") + } + + for _, v := range []map[bool]int16{nil, {}, {true: 0}} { + // fmt.Printf(">>>> running mammoth map v282: %v\n", v) + var v282v1, v282v2 map[bool]int16 + v282v1 = v + bs282 := testMarshalErr(v282v1, h, t, "enc-map-v282") + if v == nil { + v282v2 = nil + } else { + v282v2 = make(map[bool]int16, len(v)) + } // reset map + testUnmarshalErr(v282v2, bs282, h, t, "dec-map-v282") + testDeepEqualErr(v282v1, v282v2, t, "equal-map-v282") + if v == nil { + v282v2 = nil + } else { + v282v2 = make(map[bool]int16, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v282v2), bs282, h, t, "dec-map-v282-noaddr") // decode into non-addressable map value + testDeepEqualErr(v282v1, v282v2, t, "equal-map-v282-noaddr") + if v == nil { + v282v2 = nil + } else { + v282v2 = make(map[bool]int16, len(v)) + } // reset map + testUnmarshalErr(&v282v2, bs282, h, t, "dec-map-v282-p-len") + testDeepEqualErr(v282v1, v282v2, t, "equal-map-v282-p-len") + bs282 = testMarshalErr(&v282v1, h, t, "enc-map-v282-p") + v282v2 = nil + testUnmarshalErr(&v282v2, bs282, h, t, "dec-map-v282-p-nil") + testDeepEqualErr(v282v1, v282v2, t, "equal-map-v282-p-nil") + // ... + if v == nil { + v282v2 = nil + } else { + v282v2 = make(map[bool]int16, len(v)) + } // reset map + var v282v3, v282v4 typMapMapBoolInt16 + v282v3 = typMapMapBoolInt16(v282v1) + v282v4 = typMapMapBoolInt16(v282v2) + bs282 = testMarshalErr(v282v3, h, t, "enc-map-v282-custom") + testUnmarshalErr(v282v4, bs282, h, t, "dec-map-v282-p-len") + testDeepEqualErr(v282v3, v282v4, t, "equal-map-v282-p-len") + } + + for _, v := range []map[bool]int32{nil, {}, {true: 0}} { + // fmt.Printf(">>>> running mammoth map v283: %v\n", v) + var v283v1, v283v2 map[bool]int32 + v283v1 = v + bs283 := testMarshalErr(v283v1, h, t, "enc-map-v283") + if v == nil { + v283v2 = nil + } else { + v283v2 = make(map[bool]int32, len(v)) + } // reset map + testUnmarshalErr(v283v2, bs283, h, t, "dec-map-v283") + testDeepEqualErr(v283v1, v283v2, t, "equal-map-v283") + if v == nil { + v283v2 = nil + } else { + v283v2 = make(map[bool]int32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v283v2), bs283, h, t, "dec-map-v283-noaddr") // decode into non-addressable map value + testDeepEqualErr(v283v1, v283v2, t, "equal-map-v283-noaddr") + if v == nil { + v283v2 = nil + } else { + v283v2 = make(map[bool]int32, len(v)) + } // reset map + testUnmarshalErr(&v283v2, bs283, h, t, "dec-map-v283-p-len") + testDeepEqualErr(v283v1, v283v2, t, "equal-map-v283-p-len") + bs283 = testMarshalErr(&v283v1, h, t, "enc-map-v283-p") + v283v2 = nil + testUnmarshalErr(&v283v2, bs283, h, t, "dec-map-v283-p-nil") + testDeepEqualErr(v283v1, v283v2, t, "equal-map-v283-p-nil") + // ... + if v == nil { + v283v2 = nil + } else { + v283v2 = make(map[bool]int32, len(v)) + } // reset map + var v283v3, v283v4 typMapMapBoolInt32 + v283v3 = typMapMapBoolInt32(v283v1) + v283v4 = typMapMapBoolInt32(v283v2) + bs283 = testMarshalErr(v283v3, h, t, "enc-map-v283-custom") + testUnmarshalErr(v283v4, bs283, h, t, "dec-map-v283-p-len") + testDeepEqualErr(v283v3, v283v4, t, "equal-map-v283-p-len") + } + + for _, v := range []map[bool]int64{nil, {}, {true: 0}} { + // fmt.Printf(">>>> running mammoth map v284: %v\n", v) + var v284v1, v284v2 map[bool]int64 + v284v1 = v + bs284 := testMarshalErr(v284v1, h, t, "enc-map-v284") + if v == nil { + v284v2 = nil + } else { + v284v2 = make(map[bool]int64, len(v)) + } // reset map + testUnmarshalErr(v284v2, bs284, h, t, "dec-map-v284") + testDeepEqualErr(v284v1, v284v2, t, "equal-map-v284") + if v == nil { + v284v2 = nil + } else { + v284v2 = make(map[bool]int64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v284v2), bs284, h, t, "dec-map-v284-noaddr") // decode into non-addressable map value + testDeepEqualErr(v284v1, v284v2, t, "equal-map-v284-noaddr") + if v == nil { + v284v2 = nil + } else { + v284v2 = make(map[bool]int64, len(v)) + } // reset map + testUnmarshalErr(&v284v2, bs284, h, t, "dec-map-v284-p-len") + testDeepEqualErr(v284v1, v284v2, t, "equal-map-v284-p-len") + bs284 = testMarshalErr(&v284v1, h, t, "enc-map-v284-p") + v284v2 = nil + testUnmarshalErr(&v284v2, bs284, h, t, "dec-map-v284-p-nil") + testDeepEqualErr(v284v1, v284v2, t, "equal-map-v284-p-nil") + // ... + if v == nil { + v284v2 = nil + } else { + v284v2 = make(map[bool]int64, len(v)) + } // reset map + var v284v3, v284v4 typMapMapBoolInt64 + v284v3 = typMapMapBoolInt64(v284v1) + v284v4 = typMapMapBoolInt64(v284v2) + bs284 = testMarshalErr(v284v3, h, t, "enc-map-v284-custom") + testUnmarshalErr(v284v4, bs284, h, t, "dec-map-v284-p-len") + testDeepEqualErr(v284v3, v284v4, t, "equal-map-v284-p-len") + } + + for _, v := range []map[bool]float32{nil, {}, {true: 0}} { + // fmt.Printf(">>>> running mammoth map v285: %v\n", v) + var v285v1, v285v2 map[bool]float32 + v285v1 = v + bs285 := testMarshalErr(v285v1, h, t, "enc-map-v285") + if v == nil { + v285v2 = nil + } else { + v285v2 = make(map[bool]float32, len(v)) + } // reset map + testUnmarshalErr(v285v2, bs285, h, t, "dec-map-v285") + testDeepEqualErr(v285v1, v285v2, t, "equal-map-v285") + if v == nil { + v285v2 = nil + } else { + v285v2 = make(map[bool]float32, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v285v2), bs285, h, t, "dec-map-v285-noaddr") // decode into non-addressable map value + testDeepEqualErr(v285v1, v285v2, t, "equal-map-v285-noaddr") + if v == nil { + v285v2 = nil + } else { + v285v2 = make(map[bool]float32, len(v)) + } // reset map + testUnmarshalErr(&v285v2, bs285, h, t, "dec-map-v285-p-len") + testDeepEqualErr(v285v1, v285v2, t, "equal-map-v285-p-len") + bs285 = testMarshalErr(&v285v1, h, t, "enc-map-v285-p") + v285v2 = nil + testUnmarshalErr(&v285v2, bs285, h, t, "dec-map-v285-p-nil") + testDeepEqualErr(v285v1, v285v2, t, "equal-map-v285-p-nil") + // ... + if v == nil { + v285v2 = nil + } else { + v285v2 = make(map[bool]float32, len(v)) + } // reset map + var v285v3, v285v4 typMapMapBoolFloat32 + v285v3 = typMapMapBoolFloat32(v285v1) + v285v4 = typMapMapBoolFloat32(v285v2) + bs285 = testMarshalErr(v285v3, h, t, "enc-map-v285-custom") + testUnmarshalErr(v285v4, bs285, h, t, "dec-map-v285-p-len") + testDeepEqualErr(v285v3, v285v4, t, "equal-map-v285-p-len") + } + + for _, v := range []map[bool]float64{nil, {}, {true: 0}} { + // fmt.Printf(">>>> running mammoth map v286: %v\n", v) + var v286v1, v286v2 map[bool]float64 + v286v1 = v + bs286 := testMarshalErr(v286v1, h, t, "enc-map-v286") + if v == nil { + v286v2 = nil + } else { + v286v2 = make(map[bool]float64, len(v)) + } // reset map + testUnmarshalErr(v286v2, bs286, h, t, "dec-map-v286") + testDeepEqualErr(v286v1, v286v2, t, "equal-map-v286") + if v == nil { + v286v2 = nil + } else { + v286v2 = make(map[bool]float64, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v286v2), bs286, h, t, "dec-map-v286-noaddr") // decode into non-addressable map value + testDeepEqualErr(v286v1, v286v2, t, "equal-map-v286-noaddr") + if v == nil { + v286v2 = nil + } else { + v286v2 = make(map[bool]float64, len(v)) + } // reset map + testUnmarshalErr(&v286v2, bs286, h, t, "dec-map-v286-p-len") + testDeepEqualErr(v286v1, v286v2, t, "equal-map-v286-p-len") + bs286 = testMarshalErr(&v286v1, h, t, "enc-map-v286-p") + v286v2 = nil + testUnmarshalErr(&v286v2, bs286, h, t, "dec-map-v286-p-nil") + testDeepEqualErr(v286v1, v286v2, t, "equal-map-v286-p-nil") + // ... + if v == nil { + v286v2 = nil + } else { + v286v2 = make(map[bool]float64, len(v)) + } // reset map + var v286v3, v286v4 typMapMapBoolFloat64 + v286v3 = typMapMapBoolFloat64(v286v1) + v286v4 = typMapMapBoolFloat64(v286v2) + bs286 = testMarshalErr(v286v3, h, t, "enc-map-v286-custom") + testUnmarshalErr(v286v4, bs286, h, t, "dec-map-v286-p-len") + testDeepEqualErr(v286v3, v286v4, t, "equal-map-v286-p-len") + } + + for _, v := range []map[bool]bool{nil, {}, {true: false}} { + // fmt.Printf(">>>> running mammoth map v287: %v\n", v) + var v287v1, v287v2 map[bool]bool + v287v1 = v + bs287 := testMarshalErr(v287v1, h, t, "enc-map-v287") + if v == nil { + v287v2 = nil + } else { + v287v2 = make(map[bool]bool, len(v)) + } // reset map + testUnmarshalErr(v287v2, bs287, h, t, "dec-map-v287") + testDeepEqualErr(v287v1, v287v2, t, "equal-map-v287") + if v == nil { + v287v2 = nil + } else { + v287v2 = make(map[bool]bool, len(v)) + } // reset map + testUnmarshalErr(reflect.ValueOf(v287v2), bs287, h, t, "dec-map-v287-noaddr") // decode into non-addressable map value + testDeepEqualErr(v287v1, v287v2, t, "equal-map-v287-noaddr") + if v == nil { + v287v2 = nil + } else { + v287v2 = make(map[bool]bool, len(v)) + } // reset map + testUnmarshalErr(&v287v2, bs287, h, t, "dec-map-v287-p-len") + testDeepEqualErr(v287v1, v287v2, t, "equal-map-v287-p-len") + bs287 = testMarshalErr(&v287v1, h, t, "enc-map-v287-p") + v287v2 = nil + testUnmarshalErr(&v287v2, bs287, h, t, "dec-map-v287-p-nil") + testDeepEqualErr(v287v1, v287v2, t, "equal-map-v287-p-nil") + // ... + if v == nil { + v287v2 = nil + } else { + v287v2 = make(map[bool]bool, len(v)) + } // reset map + var v287v3, v287v4 typMapMapBoolBool + v287v3 = typMapMapBoolBool(v287v1) + v287v4 = typMapMapBoolBool(v287v2) + bs287 = testMarshalErr(v287v3, h, t, "enc-map-v287-custom") + testUnmarshalErr(v287v4, bs287, h, t, "dec-map-v287-p-len") + testDeepEqualErr(v287v3, v287v4, t, "equal-map-v287-p-len") + } + +} + +func doTestMammothMapsAndSlices(t *testing.T, h Handle) { + doTestMammothSlices(t, h) + doTestMammothMaps(t, h) +} diff --git a/vendor/github.com/ugorji/go/codec/msgpack.go b/vendor/github.com/ugorji/go/codec/msgpack.go index 730976973..31265cc68 100644 --- a/vendor/github.com/ugorji/go/codec/msgpack.go +++ b/vendor/github.com/ugorji/go/codec/msgpack.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. /* @@ -15,8 +15,8 @@ For compatibility with behaviour of msgpack-c reference implementation: - Go intX (<0) IS ENCODED AS msgpack -ve fixnum, signed - */ + package codec import ( @@ -25,6 +25,7 @@ import ( "math" "net/rpc" "reflect" + "time" ) const ( @@ -78,6 +79,9 @@ const ( mpNegFixNumMax = 0xff ) +var mpTimeExtTag int8 = -1 +var mpTimeExtTagU = uint8(mpTimeExtTag) + // MsgpackSpecRpcMultiArgs is a special type which signifies to the MsgpackSpecRpcCodec // that the backend RPC service takes multiple arguments, which have been arranged // in sequence in the slice. @@ -94,21 +98,31 @@ type msgpackContainerType struct { } var ( - msgpackContainerStr = msgpackContainerType{32, mpFixStrMin, mpStr8, mpStr16, mpStr32, true, true, false} - msgpackContainerBin = msgpackContainerType{0, 0, mpBin8, mpBin16, mpBin32, false, true, true} - msgpackContainerList = msgpackContainerType{16, mpFixArrayMin, 0, mpArray16, mpArray32, true, false, false} - msgpackContainerMap = msgpackContainerType{16, mpFixMapMin, 0, mpMap16, mpMap32, true, false, false} + msgpackContainerStr = msgpackContainerType{ + 32, mpFixStrMin, mpStr8, mpStr16, mpStr32, true, true, false, + } + msgpackContainerBin = msgpackContainerType{ + 0, 0, mpBin8, mpBin16, mpBin32, false, true, true, + } + msgpackContainerList = msgpackContainerType{ + 16, mpFixArrayMin, 0, mpArray16, mpArray32, true, false, false, + } + msgpackContainerMap = msgpackContainerType{ + 16, mpFixMapMin, 0, mpMap16, mpMap32, true, false, false, + } ) //--------------------------------------------- type msgpackEncDriver struct { noBuiltInTypes - encNoSeparator + encDriverNoopContainerWriter + // encNoSeparator e *Encoder w encWriter h *MsgpackHandle x [8]byte + _ [3]uint64 // padding } func (e *msgpackEncDriver) EncodeNil() { @@ -116,10 +130,26 @@ func (e *msgpackEncDriver) EncodeNil() { } func (e *msgpackEncDriver) EncodeInt(i int64) { - if i >= 0 { - e.EncodeUint(uint64(i)) + // if i >= 0 { + // e.EncodeUint(uint64(i)) + // } else if false && + if i > math.MaxInt8 { + if i <= math.MaxInt16 { + e.w.writen1(mpInt16) + bigenHelper{e.x[:2], e.w}.writeUint16(uint16(i)) + } else if i <= math.MaxInt32 { + e.w.writen1(mpInt32) + bigenHelper{e.x[:4], e.w}.writeUint32(uint32(i)) + } else { + e.w.writen1(mpInt64) + bigenHelper{e.x[:8], e.w}.writeUint64(uint64(i)) + } } else if i >= -32 { - e.w.writen1(byte(i)) + if e.h.NoFixedNum { + e.w.writen2(mpInt8, byte(i)) + } else { + e.w.writen1(byte(i)) + } } else if i >= math.MinInt8 { e.w.writen2(mpInt8, byte(i)) } else if i >= math.MinInt16 { @@ -136,7 +166,11 @@ func (e *msgpackEncDriver) EncodeInt(i int64) { func (e *msgpackEncDriver) EncodeUint(i uint64) { if i <= math.MaxInt8 { - e.w.writen1(byte(i)) + if e.h.NoFixedNum { + e.w.writen2(mpUint8, byte(i)) + } else { + e.w.writen1(byte(i)) + } } else if i <= math.MaxUint8 { e.w.writen2(mpUint8, byte(i)) } else if i <= math.MaxUint16 { @@ -169,6 +203,39 @@ func (e *msgpackEncDriver) EncodeFloat64(f float64) { bigenHelper{e.x[:8], e.w}.writeUint64(math.Float64bits(f)) } +func (e *msgpackEncDriver) EncodeTime(t time.Time) { + if t.IsZero() { + e.EncodeNil() + return + } + t = t.UTC() + sec, nsec := t.Unix(), uint64(t.Nanosecond()) + var data64 uint64 + var l = 4 + if sec >= 0 && sec>>34 == 0 { + data64 = (nsec << 34) | uint64(sec) + if data64&0xffffffff00000000 != 0 { + l = 8 + } + } else { + l = 12 + } + if e.h.WriteExt { + e.encodeExtPreamble(mpTimeExtTagU, l) + } else { + e.writeContainerLen(msgpackContainerStr, l) + } + switch l { + case 4: + bigenHelper{e.x[:4], e.w}.writeUint32(uint32(data64)) + case 8: + bigenHelper{e.x[:8], e.w}.writeUint64(data64) + case 12: + bigenHelper{e.x[:4], e.w}.writeUint32(uint32(nsec)) + bigenHelper{e.x[:8], e.w}.writeUint64(uint64(sec)) + } +} + func (e *msgpackEncDriver) EncodeExt(v interface{}, xtag uint64, ext Ext, _ *Encoder) { bs := ext.WriteExt(v) if bs == nil { @@ -179,7 +246,7 @@ func (e *msgpackEncDriver) EncodeExt(v interface{}, xtag uint64, ext Ext, _ *Enc e.encodeExtPreamble(uint8(xtag), len(bs)) e.w.writeb(bs) } else { - e.EncodeStringBytes(c_RAW, bs) + e.EncodeStringBytes(cRAW, bs) } } @@ -213,36 +280,38 @@ func (e *msgpackEncDriver) encodeExtPreamble(xtag byte, l int) { } } -func (e *msgpackEncDriver) EncodeArrayStart(length int) { +func (e *msgpackEncDriver) WriteArrayStart(length int) { e.writeContainerLen(msgpackContainerList, length) } -func (e *msgpackEncDriver) EncodeMapStart(length int) { +func (e *msgpackEncDriver) WriteMapStart(length int) { e.writeContainerLen(msgpackContainerMap, length) } func (e *msgpackEncDriver) EncodeString(c charEncoding, s string) { - if c == c_RAW && e.h.WriteExt { - e.writeContainerLen(msgpackContainerBin, len(s)) + slen := len(s) + if c == cRAW && e.h.WriteExt { + e.writeContainerLen(msgpackContainerBin, slen) } else { - e.writeContainerLen(msgpackContainerStr, len(s)) + e.writeContainerLen(msgpackContainerStr, slen) } - if len(s) > 0 { + if slen > 0 { e.w.writestr(s) } } -func (e *msgpackEncDriver) EncodeSymbol(v string) { - e.EncodeString(c_UTF8, v) -} - func (e *msgpackEncDriver) EncodeStringBytes(c charEncoding, bs []byte) { - if c == c_RAW && e.h.WriteExt { - e.writeContainerLen(msgpackContainerBin, len(bs)) - } else { - e.writeContainerLen(msgpackContainerStr, len(bs)) + if bs == nil { + e.EncodeNil() + return } - if len(bs) > 0 { + slen := len(bs) + if c == cRAW && e.h.WriteExt { + e.writeContainerLen(msgpackContainerBin, slen) + } else { + e.writeContainerLen(msgpackContainerStr, slen) + } + if slen > 0 { e.w.writeb(bs) } } @@ -264,16 +333,18 @@ func (e *msgpackEncDriver) writeContainerLen(ct msgpackContainerType, l int) { //--------------------------------------------- type msgpackDecDriver struct { - d *Decoder - r decReader // *Decoder decReader decReaderT - h *MsgpackHandle - b [scratchByteArrayLen]byte + d *Decoder + r decReader // *Decoder decReader decReaderT + h *MsgpackHandle + // b [scratchByteArrayLen]byte bd byte bdRead bool br bool // bytes reader noBuiltInTypes - noStreamingCodec - decNoSeparator + // noStreamingCodec + // decNoSeparator + decDriverNoopContainerReader + _ [3]uint64 // padding } // Note: This returns either a primitive (int, bool, etc) for non-containers, @@ -286,7 +357,7 @@ func (d *msgpackDecDriver) DecodeNaked() { d.readNextBd() } bd := d.bd - n := &d.d.n + n := d.d.n var decodeFurther bool switch bd { @@ -349,11 +420,11 @@ func (d *msgpackDecDriver) DecodeNaked() { n.s = d.DecodeString() } else { n.v = valueTypeBytes - n.l = d.DecodeBytes(nil, false, false) + n.l = d.DecodeBytes(nil, false) } case bd == mpBin8, bd == mpBin16, bd == mpBin32: n.v = valueTypeBytes - n.l = d.DecodeBytes(nil, false, false) + n.l = d.DecodeBytes(nil, false) case bd == mpArray16, bd == mpArray32, bd >= mpFixArrayMin && bd <= mpFixArrayMax: n.v = valueTypeArray decodeFurther = true @@ -364,7 +435,12 @@ func (d *msgpackDecDriver) DecodeNaked() { n.v = valueTypeExt clen := d.readExtLen() n.u = uint64(d.r.readn1()) - n.l = d.r.readx(clen) + if n.u == uint64(mpTimeExtTagU) { + n.v = valueTypeTime + n.t = d.decodeTime(clen) + } else { + n.l = d.r.readx(clen) + } default: d.d.errorf("Nil-Deciphered DecodeValue: %s: hex: %x, dec: %d", msgBadDesc, bd, bd) } @@ -380,7 +456,7 @@ func (d *msgpackDecDriver) DecodeNaked() { } // int can be decoded from msgpack type: intXXX or uintXXX -func (d *msgpackDecDriver) DecodeInt(bitsize uint8) (i int64) { +func (d *msgpackDecDriver) DecodeInt64() (i int64) { if !d.bdRead { d.readNextBd() } @@ -412,19 +488,12 @@ func (d *msgpackDecDriver) DecodeInt(bitsize uint8) (i int64) { return } } - // check overflow (logic adapted from std pkg reflect/value.go OverflowUint() - if bitsize > 0 { - if trunc := (i << (64 - bitsize)) >> (64 - bitsize); i != trunc { - d.d.errorf("Overflow int value: %v", i) - return - } - } d.bdRead = false return } // uint can be decoded from msgpack type: intXXX or uintXXX -func (d *msgpackDecDriver) DecodeUint(bitsize uint8) (ui uint64) { +func (d *msgpackDecDriver) DecodeUint64() (ui uint64) { if !d.bdRead { d.readNextBd() } @@ -477,19 +546,12 @@ func (d *msgpackDecDriver) DecodeUint(bitsize uint8) (ui uint64) { return } } - // check overflow (logic adapted from std pkg reflect/value.go OverflowUint() - if bitsize > 0 { - if trunc := (ui << (64 - bitsize)) >> (64 - bitsize); ui != trunc { - d.d.errorf("Overflow uint value: %v", ui) - return - } - } d.bdRead = false return } // float can either be decoded from msgpack type: float, double or intX -func (d *msgpackDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) { +func (d *msgpackDecDriver) DecodeFloat64() (f float64) { if !d.bdRead { d.readNextBd() } @@ -498,11 +560,7 @@ func (d *msgpackDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) { } else if d.bd == mpDouble { f = math.Float64frombits(bigen.Uint64(d.r.readx(8))) } else { - f = float64(d.DecodeInt(0)) - } - if chkOverflow32 && chkOvf.Float32(f) { - d.d.errorf("msgpack: float32 overflow: %v", f) - return + f = float64(d.DecodeInt64()) } d.bdRead = false return @@ -525,18 +583,38 @@ func (d *msgpackDecDriver) DecodeBool() (b bool) { return } -func (d *msgpackDecDriver) DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut []byte) { +func (d *msgpackDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { if !d.bdRead { d.readNextBd() } + + // check if an "array" of uint8's (see ContainerType for how to infer if an array) + bd := d.bd + // DecodeBytes could be from: bin str fixstr fixarray array ... var clen int - // ignore isstring. Expect that the bytes may be found from msgpackContainerStr or msgpackContainerBin - if bd := d.bd; bd == mpBin8 || bd == mpBin16 || bd == mpBin32 { - clen = d.readContainerLen(msgpackContainerBin) - } else { + vt := d.ContainerType() + switch vt { + case valueTypeBytes: + // valueTypeBytes may be a mpBin or an mpStr container + if bd == mpBin8 || bd == mpBin16 || bd == mpBin32 { + clen = d.readContainerLen(msgpackContainerBin) + } else { + clen = d.readContainerLen(msgpackContainerStr) + } + case valueTypeString: clen = d.readContainerLen(msgpackContainerStr) + case valueTypeArray: + if zerocopy && len(bs) == 0 { + bs = d.d.b[:] + } + bsOut, _ = fastpathTV.DecSliceUint8V(bs, true, d.d) + return + default: + d.d.errorf("invalid container type: expecting bin|str|array, got: 0x%x", uint8(vt)) + return } - // println("DecodeBytes: clen: ", clen) + + // these are (bin|str)(8|16|32) d.bdRead = false // bytes may be nil, so handle it. if nil, clen=-1. if clen < 0 { @@ -546,14 +624,18 @@ func (d *msgpackDecDriver) DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOu if d.br { return d.r.readx(clen) } else if len(bs) == 0 { - bs = d.b[:] + bs = d.d.b[:] } } - return decByteSlice(d.r, clen, d.d.h.MaxInitLen, bs) + return decByteSlice(d.r, clen, d.h.MaxInitLen, bs) } func (d *msgpackDecDriver) DecodeString() (s string) { - return string(d.DecodeBytes(d.b[:], true, true)) + return string(d.DecodeBytes(d.d.b[:], true)) +} + +func (d *msgpackDecDriver) DecodeStringAsBytes() (s []byte) { + return d.DecodeBytes(d.d.b[:], true) } func (d *msgpackDecDriver) readNextBd() { @@ -586,9 +668,10 @@ func (d *msgpackDecDriver) ContainerType() (vt valueType) { return valueTypeArray } else if bd == mpMap16 || bd == mpMap32 || (bd >= mpFixMapMin && bd <= mpFixMapMax) { return valueTypeMap - } else { - // d.d.errorf("isContainerType: unsupported parameter: %v", vt) } + // else { + // d.d.errorf("isContainerType: unsupported parameter: %v", vt) + // } return valueTypeUnset } @@ -598,7 +681,7 @@ func (d *msgpackDecDriver) TryDecodeAsNil() (v bool) { } if d.bd == mpNil { d.bdRead = false - v = true + return true } return } @@ -664,6 +747,57 @@ func (d *msgpackDecDriver) readExtLen() (clen int) { return } +func (d *msgpackDecDriver) DecodeTime() (t time.Time) { + // decode time from string bytes or ext + if !d.bdRead { + d.readNextBd() + } + if d.bd == mpNil { + d.bdRead = false + return + } + var clen int + switch d.ContainerType() { + case valueTypeBytes, valueTypeString: + clen = d.readContainerLen(msgpackContainerStr) + default: + // expect to see mpFixExt4,-1 OR mpFixExt8,-1 OR mpExt8,12,-1 + d.bdRead = false + b2 := d.r.readn1() + if d.bd == mpFixExt4 && b2 == mpTimeExtTagU { + clen = 4 + } else if d.bd == mpFixExt8 && b2 == mpTimeExtTagU { + clen = 8 + } else if d.bd == mpExt8 && b2 == 12 && d.r.readn1() == mpTimeExtTagU { + clen = 12 + } else { + d.d.errorf("invalid bytes for decoding time as extension: got 0x%x, 0x%x", d.bd, b2) + return + } + } + return d.decodeTime(clen) +} + +func (d *msgpackDecDriver) decodeTime(clen int) (t time.Time) { + // bs = d.r.readx(clen) + d.bdRead = false + switch clen { + case 4: + t = time.Unix(int64(bigen.Uint32(d.r.readx(4))), 0).UTC() + case 8: + tv := bigen.Uint64(d.r.readx(8)) + t = time.Unix(int64(tv&0x00000003ffffffff), int64(tv>>34)).UTC() + case 12: + nsec := bigen.Uint32(d.r.readx(4)) + sec := bigen.Uint64(d.r.readx(8)) + t = time.Unix(int64(sec), int64(nsec)).UTC() + default: + d.d.errorf("invalid length of bytes for decoding time - expecting 4 or 8 or 12, got %d", clen) + return + } + return +} + func (d *msgpackDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxtag uint64) { if xtag > 0xff { d.d.errorf("decodeExt: tag must be <= 0xff; got: %v", xtag) @@ -687,10 +821,10 @@ func (d *msgpackDecDriver) decodeExtV(verifyTag bool, tag byte) (xtag byte, xbs } xbd := d.bd if xbd == mpBin8 || xbd == mpBin16 || xbd == mpBin32 { - xbs = d.DecodeBytes(nil, false, true) + xbs = d.DecodeBytes(nil, true) } else if xbd == mpStr8 || xbd == mpStr16 || xbd == mpStr32 || (xbd >= mpFixStrMin && xbd <= mpFixStrMax) { - xbs = d.DecodeBytes(nil, true, true) + xbs = d.DecodeStringAsBytes() } else { clen := d.readExtLen() xtag = d.r.readn1() @@ -713,6 +847,9 @@ type MsgpackHandle struct { // RawToString controls how raw bytes are decoded into a nil interface{}. RawToString bool + // NoFixedNum says to output all signed integers as 2-bytes, never as 1-byte fixednum. + NoFixedNum bool + // WriteExt flag supports encoding configured extensions with extension tags. // It also controls whether other elements of the new spec are encoded (ie Str8). // @@ -724,11 +861,19 @@ type MsgpackHandle struct { // type is provided (e.g. decoding into a nil interface{}), you get back // a []byte or string based on the setting of RawToString. WriteExt bool + binaryEncodingType + noElemSeparators + + _ [1]uint64 // padding } +// Name returns the name of the handle: msgpack +func (h *MsgpackHandle) Name() string { return "msgpack" } + +// SetBytesExt sets an extension func (h *MsgpackHandle) SetBytesExt(rt reflect.Type, tag uint64, ext BytesExt) (err error) { - return h.SetExt(rt, tag, &setExtWrapper{b: ext}) + return h.SetExt(rt, tag, &extWrapper{ext, interfaceExtFailer{}}) } func (h *MsgpackHandle) newEncDriver(e *Encoder) encDriver { @@ -766,7 +911,7 @@ func (c *msgpackSpecRpcCodec) WriteRequest(r *rpc.Request, body interface{}) err bodyArr = []interface{}{body} } r2 := []interface{}{0, uint32(r.Seq), r.ServiceMethod, bodyArr} - return c.write(r2, nil, false, true) + return c.write(r2, nil, false) } func (c *msgpackSpecRpcCodec) WriteResponse(r *rpc.Response, body interface{}) error { @@ -778,7 +923,7 @@ func (c *msgpackSpecRpcCodec) WriteResponse(r *rpc.Response, body interface{}) e body = nil } r2 := []interface{}{1, uint32(r.Seq), moe, body} - return c.write(r2, nil, false, true) + return c.write(r2, nil, false) } func (c *msgpackSpecRpcCodec) ReadResponseHeader(r *rpc.Response) error { @@ -798,7 +943,6 @@ func (c *msgpackSpecRpcCodec) ReadRequestBody(body interface{}) error { } func (c *msgpackSpecRpcCodec) parseCustomHeader(expectTypeByte byte, msgid *uint64, methodOrError *string) (err error) { - if c.isClosed() { return io.EOF } @@ -812,28 +956,34 @@ func (c *msgpackSpecRpcCodec) parseCustomHeader(expectTypeByte byte, msgid *uint // err = fmt.Errorf("Unexpected value for array descriptor: Expecting %v. Received %v", fia, bs1) // return // } - var b byte - b, err = c.br.ReadByte() - if err != nil { - return - } - if b != fia { - err = fmt.Errorf("Unexpected value for array descriptor: Expecting %v. Received %v", fia, b) - return + var ba [1]byte + var n int + for { + n, err = c.r.Read(ba[:]) + if err != nil { + return + } + if n == 1 { + break + } } - if err = c.read(&b); err != nil { - return - } - if b != expectTypeByte { - err = fmt.Errorf("Unexpected byte descriptor in header. Expecting %v. Received %v", expectTypeByte, b) - return - } - if err = c.read(msgid); err != nil { - return - } - if err = c.read(methodOrError); err != nil { - return + var b = ba[0] + if b != fia { + err = fmt.Errorf("Unexpected value for array descriptor: Expecting %v. Received %v", fia, b) + } else { + err = c.read(&b) + if err == nil { + if b != expectTypeByte { + err = fmt.Errorf("Unexpected byte descriptor. Expecting %v; Received %v", + expectTypeByte, b) + } else { + err = c.read(msgid) + if err == nil { + err = c.read(methodOrError) + } + } + } } return } @@ -846,7 +996,8 @@ type msgpackSpecRpc struct{} // MsgpackSpecRpc implements Rpc using the communication protocol defined in // the msgpack spec at https://github.com/msgpack-rpc/msgpack-rpc/blob/master/spec.md . -// Its methods (ServerCodec and ClientCodec) return values that implement RpcCodecBuffered. +// +// See GoRpc documentation, for information on buffering for better performance. var MsgpackSpecRpc msgpackSpecRpc func (x msgpackSpecRpc) ServerCodec(conn io.ReadWriteCloser, h Handle) rpc.ServerCodec { diff --git a/vendor/github.com/ugorji/go/codec/noop.go b/vendor/github.com/ugorji/go/codec/noop.go index cfee3d084..424bd49d7 100644 --- a/vendor/github.com/ugorji/go/codec/noop.go +++ b/vendor/github.com/ugorji/go/codec/noop.go @@ -1,6 +1,8 @@ -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. +// +build ignore + package codec import ( @@ -89,8 +91,9 @@ func (h *noopDrv) EncodeArrayStart(length int) { h.start(true) } func (h *noopDrv) EncodeMapStart(length int) { h.start(false) } func (h *noopDrv) EncodeEnd() { h.end() } -func (h *noopDrv) EncodeString(c charEncoding, v string) {} -func (h *noopDrv) EncodeSymbol(v string) {} +func (h *noopDrv) EncodeString(c charEncoding, v string) {} + +// func (h *noopDrv) EncodeSymbol(v string) {} func (h *noopDrv) EncodeStringBytes(c charEncoding, v []byte) {} func (h *noopDrv) EncodeExt(rv interface{}, xtag uint64, ext Ext, e *Encoder) {} @@ -105,10 +108,9 @@ func (h *noopDrv) DecodeUint(bitsize uint8) (ui uint64) { return uint64(h. func (h *noopDrv) DecodeFloat(chkOverflow32 bool) (f float64) { return float64(h.m(95)) } func (h *noopDrv) DecodeBool() (b bool) { return h.m(2) == 0 } func (h *noopDrv) DecodeString() (s string) { return h.S[h.m(8)] } +func (h *noopDrv) DecodeStringAsBytes() []byte { return h.DecodeBytes(nil, true) } -// func (h *noopDrv) DecodeStringAsBytes(bs []byte) []byte { return h.DecodeBytes(bs) } - -func (h *noopDrv) DecodeBytes(bs []byte, isstring, zerocopy bool) []byte { return h.B[h.m(len(h.B))] } +func (h *noopDrv) DecodeBytes(bs []byte, zerocopy bool) []byte { return h.B[h.m(len(h.B))] } func (h *noopDrv) ReadEnd() { h.end() } @@ -118,9 +120,12 @@ func (h *noopDrv) ReadArrayStart() int { h.start(false); return h.m(10) } func (h *noopDrv) ContainerType() (vt valueType) { // return h.m(2) == 0 - // handle kStruct, which will bomb is it calls this and doesn't get back a map or array. - // consequently, if the return value is not map or array, reset it to one of them based on h.m(7) % 2 - // for kstruct: at least one out of every 2 times, return one of valueTypeMap or Array (else kstruct bombs) + // handle kStruct, which will bomb is it calls this and + // doesn't get back a map or array. + // consequently, if the return value is not map or array, + // reset it to one of them based on h.m(7) % 2 + // for kstruct: at least one out of every 2 times, + // return one of valueTypeMap or Array (else kstruct bombs) // however, every 10th time it is called, we just return something else. var vals = [...]valueType{valueTypeArray, valueTypeMap} // ------------ TAKE ------------ @@ -149,7 +154,8 @@ func (h *noopDrv) ContainerType() (vt valueType) { // } // return valueTypeUnset // TODO: may need to tweak this so it works. - // if h.ct == valueTypeMap && vt == valueTypeArray || h.ct == valueTypeArray && vt == valueTypeMap { + // if h.ct == valueTypeMap && vt == valueTypeArray || + // h.ct == valueTypeArray && vt == valueTypeMap { // h.cb = !h.cb // h.ct = vt // return h.cb diff --git a/vendor/github.com/ugorji/go/codec/prebuild.go b/vendor/github.com/ugorji/go/codec/prebuild.go deleted file mode 100644 index 2353263e8..000000000 --- a/vendor/github.com/ugorji/go/codec/prebuild.go +++ /dev/null @@ -1,3 +0,0 @@ -package codec - -//go:generate bash prebuild.sh diff --git a/vendor/github.com/ugorji/go/codec/prebuild.sh b/vendor/github.com/ugorji/go/codec/prebuild.sh deleted file mode 100755 index 04c61e48f..000000000 --- a/vendor/github.com/ugorji/go/codec/prebuild.sh +++ /dev/null @@ -1,205 +0,0 @@ -#!/bin/bash - -# _needgen is a helper function to tell if we need to generate files for msgp, codecgen. -_needgen() { - local a="$1" - zneedgen=0 - if [[ ! -e "$a" ]] - then - zneedgen=1 - echo 1 - return 0 - fi - for i in `ls -1 *.go.tmpl gen.go values_test.go` - do - if [[ "$a" -ot "$i" ]] - then - zneedgen=1 - echo 1 - return 0 - fi - done - echo 0 -} - -# _build generates fast-path.go and gen-helper.go. -# -# It is needed because there is some dependency between the generated code -# and the other classes. Consequently, we have to totally remove the -# generated files and put stubs in place, before calling "go run" again -# to recreate them. -_build() { - if ! [[ "${zforce}" == "1" || - "1" == $( _needgen "fast-path.generated.go" ) || - "1" == $( _needgen "gen-helper.generated.go" ) || - "1" == $( _needgen "gen.generated.go" ) || - 1 == 0 ]] - then - return 0 - fi - - # echo "Running prebuild" - if [ "${zbak}" == "1" ] - then - # echo "Backing up old generated files" - _zts=`date '+%m%d%Y_%H%M%S'` - _gg=".generated.go" - [ -e "gen-helper${_gg}" ] && mv gen-helper${_gg} gen-helper${_gg}__${_zts}.bak - [ -e "fast-path${_gg}" ] && mv fast-path${_gg} fast-path${_gg}__${_zts}.bak - [ -e "gen${_gg}" ] && mv gen${_gg} gen${_gg}__${_zts}.bak - # [ -e "safe${_gg}" ] && mv safe${_gg} safe${_gg}__${_zts}.bak - # [ -e "unsafe${_gg}" ] && mv unsafe${_gg} unsafe${_gg}__${_zts}.bak - fi - rm -f gen-helper.generated.go fast-path.generated.go \ - gen.generated.go \ - *safe.generated.go *_generated_test.go *.generated_ffjson_expose.go - - cat > gen.generated.go <> gen.generated.go < gen-dec-map.go.tmpl - - cat >> gen.generated.go <> gen.generated.go < gen-dec-array.go.tmpl - - cat >> gen.generated.go < gen-from-tmpl.codec.generated.go < gen-from-tmpl.generated.go < +// go test "-tags=x codecgen" -bench=. // // To fully test everything: // go test -tags=x -benchtime=100ms -tv -bg -bi -brw -bu -v -run=. -bench=. @@ -43,7 +43,12 @@ package codec import ( "bytes" "flag" + "fmt" + "io" + "io/ioutil" + "log" "sync" + "testing" ) // DO NOT REMOVE - replacement line for go-codec-bench import declaration tag // @@ -54,8 +59,24 @@ type testHED struct { D *Decoder } +type ioReaderWrapper struct { + r io.Reader +} + +func (x ioReaderWrapper) Read(p []byte) (n int, err error) { + return x.r.Read(p) +} + +type ioWriterWrapper struct { + w io.Writer +} + +func (x ioWriterWrapper) Write(p []byte) (n int, err error) { + return x.w.Write(p) +} + var ( - testNoopH = NoopHandle(8) + // testNoopH = NoopHandle(8) testMsgpackH = &MsgpackHandle{} testBincH = &BincHandle{} testSimpleH = &SimpleHandle{} @@ -73,21 +94,32 @@ var ( // flag variables used by tests (and bench) var ( - testVerbose bool - testInitDebug bool - testUseIoEncDec bool - testStructToArray bool - testCanonical bool - testUseReset bool - testWriteNoSymbols bool - testSkipIntf bool - testInternStr bool - testUseMust bool - testCheckCircRef bool - testJsonIndent int - testMaxInitLen int + testDepth int - testJsonHTMLCharsAsIs bool + testVerbose bool + testInitDebug bool + testStructToArray bool + testCanonical bool + testUseReset bool + testSkipIntf bool + testInternStr bool + testUseMust bool + testCheckCircRef bool + + testUseIoEncDec int + testUseIoWrapper bool + + testMaxInitLen int + + testNumRepeatString int + + testRpcBufsize int +) + +// variables that are not flags, but which can configure the handles +var ( + testEncodeOptions EncodeOptions + testDecodeOptions DecodeOptions ) // flag variables used by bench @@ -103,9 +135,11 @@ var ( ) func init() { + log.SetOutput(ioutil.Discard) // don't allow things log to standard out/err testHEDs = make([]testHED, 0, 32) testHandles = append(testHandles, - testNoopH, testMsgpackH, testBincH, testSimpleH, + // testNoopH, + testMsgpackH, testBincH, testSimpleH, testCborH, testJsonH) testInitFlags() benchInitFlags() @@ -113,20 +147,20 @@ func init() { func testInitFlags() { // delete(testDecOpts.ExtFuncs, timeTyp) - flag.BoolVar(&testVerbose, "tv", false, "Test Verbose") + flag.IntVar(&testDepth, "tsd", 0, "Test Struc Depth") + flag.BoolVar(&testVerbose, "tv", false, "Test Verbose (no longer used - here for compatibility)") flag.BoolVar(&testInitDebug, "tg", false, "Test Init Debug") - flag.BoolVar(&testUseIoEncDec, "ti", false, "Use IO Reader/Writer for Marshal/Unmarshal") + flag.IntVar(&testUseIoEncDec, "ti", -1, "Use IO Reader/Writer for Marshal/Unmarshal ie >= 0") + flag.BoolVar(&testUseIoWrapper, "tiw", false, "Wrap the IO Reader/Writer with a base pass-through reader/writer") flag.BoolVar(&testStructToArray, "ts", false, "Set StructToArray option") - flag.BoolVar(&testWriteNoSymbols, "tn", false, "Set NoSymbols option") flag.BoolVar(&testCanonical, "tc", false, "Set Canonical option") flag.BoolVar(&testInternStr, "te", false, "Set InternStr option") flag.BoolVar(&testSkipIntf, "tf", false, "Skip Interfaces") flag.BoolVar(&testUseReset, "tr", false, "Use Reset") - flag.IntVar(&testJsonIndent, "td", 0, "Use JSON Indent") + flag.IntVar(&testNumRepeatString, "trs", 8, "Create string variables by repeating a string N times") flag.IntVar(&testMaxInitLen, "tx", 0, "Max Init Len") flag.BoolVar(&testUseMust, "tm", true, "Use Must(En|De)code") flag.BoolVar(&testCheckCircRef, "tl", false, "Use Check Circular Ref") - flag.BoolVar(&testJsonHTMLCharsAsIs, "tas", false, "Set JSON HTMLCharsAsIs") } func benchInitFlags() { @@ -149,8 +183,16 @@ func testHEDGet(h Handle) *testHED { return &testHEDs[len(testHEDs)-1] } +func testReinit() { + testOnce = sync.Once{} + testHEDs = nil +} + func testInitAll() { - flag.Parse() + // only parse it once. + if !flag.Parsed() { + flag.Parse() + } for _, f := range testPreInitFns { f() } @@ -159,8 +201,8 @@ func testInitAll() { } } -func testCodecEncode(ts interface{}, bsIn []byte, - fn func([]byte) *bytes.Buffer, h Handle) (bs []byte, err error) { +func sTestCodecEncode(ts interface{}, bsIn []byte, fn func([]byte) *bytes.Buffer, + h Handle, bh *BasicHandle) (bs []byte, err error) { // bs = make([]byte, 0, approxSize) var e *Encoder var buf *bytes.Buffer @@ -169,9 +211,17 @@ func testCodecEncode(ts interface{}, bsIn []byte, } else { e = NewEncoder(nil, h) } - if testUseIoEncDec { + var oldWriteBufferSize int + if testUseIoEncDec >= 0 { buf = fn(bsIn) - e.Reset(buf) + // set the encode options for using a buffer + oldWriteBufferSize = bh.WriterBufferSize + bh.WriterBufferSize = testUseIoEncDec + if testUseIoWrapper { + e.Reset(ioWriterWrapper{buf}) + } else { + e.Reset(buf) + } } else { bs = bsIn e.ResetBytes(&bs) @@ -181,23 +231,31 @@ func testCodecEncode(ts interface{}, bsIn []byte, } else { err = e.Encode(ts) } - if testUseIoEncDec { + if testUseIoEncDec >= 0 { bs = buf.Bytes() + bh.WriterBufferSize = oldWriteBufferSize } return } -func testCodecDecode(bs []byte, ts interface{}, h Handle) (err error) { +func sTestCodecDecode(bs []byte, ts interface{}, h Handle, bh *BasicHandle) (err error) { var d *Decoder - var buf *bytes.Reader + // var buf *bytes.Reader if testUseReset { d = testHEDGet(h).D } else { d = NewDecoder(nil, h) } - if testUseIoEncDec { - buf = bytes.NewReader(bs) - d.Reset(buf) + var oldReadBufferSize int + if testUseIoEncDec >= 0 { + buf := bytes.NewReader(bs) + oldReadBufferSize = bh.ReaderBufferSize + bh.ReaderBufferSize = testUseIoEncDec + if testUseIoWrapper { + d.Reset(ioReaderWrapper{buf}) + } else { + d.Reset(buf) + } } else { d.ResetBytes(bs) } @@ -206,10 +264,28 @@ func testCodecDecode(bs []byte, ts interface{}, h Handle) (err error) { } else { err = d.Decode(ts) } + if testUseIoEncDec >= 0 { + bh.ReaderBufferSize = oldReadBufferSize + } return } -// ----- functions below are used only by benchmarks alone +// --- functions below are used by both benchmarks and tests + +func logT(x interface{}, format string, args ...interface{}) { + if t, ok := x.(*testing.T); ok && t != nil { + t.Logf(format, args...) + } else if b, ok := x.(*testing.B); ok && b != nil { + b.Logf(format, args...) + } else { // if testing.Verbose() { // if testVerbose { + if len(format) == 0 || format[len(format)-1] != '\n' { + format = format + "\n" + } + fmt.Printf(format, args...) + } +} + +// --- functions below are used only by benchmarks alone func fnBenchmarkByteBuf(bsIn []byte) (buf *bytes.Buffer) { // var buf bytes.Buffer @@ -219,10 +295,10 @@ func fnBenchmarkByteBuf(bsIn []byte) (buf *bytes.Buffer) { return } -func benchFnCodecEncode(ts interface{}, bsIn []byte, h Handle) (bs []byte, err error) { - return testCodecEncode(ts, bsIn, fnBenchmarkByteBuf, h) -} +// func benchFnCodecEncode(ts interface{}, bsIn []byte, h Handle) (bs []byte, err error) { +// return testCodecEncode(ts, bsIn, fnBenchmarkByteBuf, h) +// } -func benchFnCodecDecode(bs []byte, ts interface{}, h Handle) (err error) { - return testCodecDecode(bs, ts, h) -} +// func benchFnCodecDecode(bs []byte, ts interface{}, h Handle) (err error) { +// return testCodecDecode(bs, ts, h) +// } diff --git a/vendor/github.com/ugorji/go/codec/simple.go b/vendor/github.com/ugorji/go/codec/simple.go index 656bc691b..a839d810e 100644 --- a/vendor/github.com/ugorji/go/codec/simple.go +++ b/vendor/github.com/ugorji/go/codec/simple.go @@ -1,4 +1,4 @@ -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec @@ -6,6 +6,7 @@ package codec import ( "math" "reflect" + "time" ) const ( @@ -20,6 +21,8 @@ const ( simpleVdPosInt = 8 simpleVdNegInt = 12 + simpleVdTime = 24 + // containers: each lasts for 4 (ie n, n+1, n+2, ... n+7) simpleVdString = 216 simpleVdByteArray = 224 @@ -30,11 +33,15 @@ const ( type simpleEncDriver struct { noBuiltInTypes - encNoSeparator + // encNoSeparator e *Encoder h *SimpleHandle w encWriter b [8]byte + // c containerState + encDriverTrackContainerWriter + // encDriverNoopContainerWriter + _ [2]uint64 // padding } func (e *simpleEncDriver) EncodeNil() { @@ -42,6 +49,10 @@ func (e *simpleEncDriver) EncodeNil() { } func (e *simpleEncDriver) EncodeBool(b bool) { + if e.h.EncZeroValuesAsNil && e.c != containerMapKey && !b { + e.EncodeNil() + return + } if b { e.w.writen1(simpleVdTrue) } else { @@ -50,11 +61,19 @@ func (e *simpleEncDriver) EncodeBool(b bool) { } func (e *simpleEncDriver) EncodeFloat32(f float32) { + if e.h.EncZeroValuesAsNil && e.c != containerMapKey && f == 0.0 { + e.EncodeNil() + return + } e.w.writen1(simpleVdFloat32) bigenHelper{e.b[:4], e.w}.writeUint32(math.Float32bits(f)) } func (e *simpleEncDriver) EncodeFloat64(f float64) { + if e.h.EncZeroValuesAsNil && e.c != containerMapKey && f == 0.0 { + e.EncodeNil() + return + } e.w.writen1(simpleVdFloat64) bigenHelper{e.b[:8], e.w}.writeUint64(math.Float64bits(f)) } @@ -72,6 +91,10 @@ func (e *simpleEncDriver) EncodeUint(v uint64) { } func (e *simpleEncDriver) encUint(v uint64, bd uint8) { + if e.h.EncZeroValuesAsNil && e.c != containerMapKey && v == 0 { + e.EncodeNil() + return + } if v <= math.MaxUint8 { e.w.writen2(bd, uint8(v)) } else if v <= math.MaxUint16 { @@ -124,28 +147,55 @@ func (e *simpleEncDriver) encodeExtPreamble(xtag byte, length int) { e.w.writen1(xtag) } -func (e *simpleEncDriver) EncodeArrayStart(length int) { +func (e *simpleEncDriver) WriteArrayStart(length int) { + e.c = containerArrayStart e.encLen(simpleVdArray, length) } -func (e *simpleEncDriver) EncodeMapStart(length int) { +func (e *simpleEncDriver) WriteMapStart(length int) { + e.c = containerMapStart e.encLen(simpleVdMap, length) } func (e *simpleEncDriver) EncodeString(c charEncoding, v string) { + if false && e.h.EncZeroValuesAsNil && e.c != containerMapKey && v == "" { + e.EncodeNil() + return + } e.encLen(simpleVdString, len(v)) e.w.writestr(v) } -func (e *simpleEncDriver) EncodeSymbol(v string) { - e.EncodeString(c_UTF8, v) -} +// func (e *simpleEncDriver) EncodeSymbol(v string) { +// e.EncodeString(cUTF8, v) +// } func (e *simpleEncDriver) EncodeStringBytes(c charEncoding, v []byte) { + // if e.h.EncZeroValuesAsNil && e.c != containerMapKey && v == nil { + if v == nil { + e.EncodeNil() + return + } e.encLen(simpleVdByteArray, len(v)) e.w.writeb(v) } +func (e *simpleEncDriver) EncodeTime(t time.Time) { + // if e.h.EncZeroValuesAsNil && e.c != containerMapKey && t.IsZero() { + if t.IsZero() { + e.EncodeNil() + return + } + v, err := t.MarshalBinary() + if err != nil { + e.e.errorv(err) + return + } + // time.Time marshalbinary takes about 14 bytes. + e.w.writen2(simpleVdTime, uint8(len(v))) + e.w.writeb(v) +} + //------------------------------------ type simpleDecDriver struct { @@ -154,11 +204,13 @@ type simpleDecDriver struct { r decReader bdRead bool bd byte - br bool // bytes reader + br bool // a bytes reader? + c containerState + // b [scratchByteArrayLen]byte noBuiltInTypes - noStreamingCodec - decNoSeparator - b [scratchByteArrayLen]byte + // noStreamingCodec + decDriverNoopContainerReader + _ [3]uint64 // padding } func (d *simpleDecDriver) readNextBd() { @@ -177,23 +229,27 @@ func (d *simpleDecDriver) ContainerType() (vt valueType) { if !d.bdRead { d.readNextBd() } - if d.bd == simpleVdNil { + switch d.bd { + case simpleVdNil: return valueTypeNil - } else if d.bd == simpleVdByteArray || d.bd == simpleVdByteArray+1 || - d.bd == simpleVdByteArray+2 || d.bd == simpleVdByteArray+3 || d.bd == simpleVdByteArray+4 { + case simpleVdByteArray, simpleVdByteArray + 1, + simpleVdByteArray + 2, simpleVdByteArray + 3, simpleVdByteArray + 4: return valueTypeBytes - } else if d.bd == simpleVdString || d.bd == simpleVdString+1 || - d.bd == simpleVdString+2 || d.bd == simpleVdString+3 || d.bd == simpleVdString+4 { + case simpleVdString, simpleVdString + 1, + simpleVdString + 2, simpleVdString + 3, simpleVdString + 4: return valueTypeString - } else if d.bd == simpleVdArray || d.bd == simpleVdArray+1 || - d.bd == simpleVdArray+2 || d.bd == simpleVdArray+3 || d.bd == simpleVdArray+4 { + case simpleVdArray, simpleVdArray + 1, + simpleVdArray + 2, simpleVdArray + 3, simpleVdArray + 4: return valueTypeArray - } else if d.bd == simpleVdMap || d.bd == simpleVdMap+1 || - d.bd == simpleVdMap+2 || d.bd == simpleVdMap+3 || d.bd == simpleVdMap+4 { + case simpleVdMap, simpleVdMap + 1, + simpleVdMap + 2, simpleVdMap + 3, simpleVdMap + 4: return valueTypeMap - } else { - // d.d.errorf("isContainerType: unsupported parameter: %v", vt) + // case simpleVdTime: + // return valueTypeTime } + // else { + // d.d.errorf("isContainerType: unsupported parameter: %v", vt) + // } return valueTypeUnset } @@ -234,7 +290,7 @@ func (d *simpleDecDriver) decCheckInteger() (ui uint64, neg bool) { ui = uint64(bigen.Uint64(d.r.readx(8))) neg = true default: - d.d.errorf("decIntAny: Integer only valid from pos/neg integer1..8. Invalid descriptor: %v", d.bd) + d.d.errorf("Integer only valid from pos/neg integer1..8. Invalid descriptor: %v", d.bd) return } // don't do this check, because callers may only want the unsigned value. @@ -245,39 +301,27 @@ func (d *simpleDecDriver) decCheckInteger() (ui uint64, neg bool) { return } -func (d *simpleDecDriver) DecodeInt(bitsize uint8) (i int64) { +func (d *simpleDecDriver) DecodeInt64() (i int64) { ui, neg := d.decCheckInteger() - i, overflow := chkOvf.SignedInt(ui) - if overflow { - d.d.errorf("simple: overflow converting %v to signed integer", ui) - return - } + i = chkOvf.SignedIntV(ui) if neg { i = -i } - if chkOvf.Int(i, bitsize) { - d.d.errorf("simple: overflow integer: %v", i) - return - } d.bdRead = false return } -func (d *simpleDecDriver) DecodeUint(bitsize uint8) (ui uint64) { +func (d *simpleDecDriver) DecodeUint64() (ui uint64) { ui, neg := d.decCheckInteger() if neg { d.d.errorf("Assigning negative signed value to unsigned type") return } - if chkOvf.Uint(ui, bitsize) { - d.d.errorf("simple: overflow integer: %v", ui) - return - } d.bdRead = false return } -func (d *simpleDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) { +func (d *simpleDecDriver) DecodeFloat64() (f float64) { if !d.bdRead { d.readNextBd() } @@ -287,16 +331,12 @@ func (d *simpleDecDriver) DecodeFloat(chkOverflow32 bool) (f float64) { f = math.Float64frombits(bigen.Uint64(d.r.readx(8))) } else { if d.bd >= simpleVdPosInt && d.bd <= simpleVdNegInt+3 { - f = float64(d.DecodeInt(64)) + f = float64(d.DecodeInt64()) } else { d.d.errorf("Float only valid from float32/64: Invalid descriptor: %v", d.bd) return } } - if chkOverflow32 && chkOvf.Float32(f) { - d.d.errorf("msgpack: float32 overflow: %v", f) - return - } d.bdRead = false return } @@ -322,6 +362,7 @@ func (d *simpleDecDriver) ReadMapStart() (length int) { d.readNextBd() } d.bdRead = false + d.c = containerMapStart return d.decLen() } @@ -330,9 +371,30 @@ func (d *simpleDecDriver) ReadArrayStart() (length int) { d.readNextBd() } d.bdRead = false + d.c = containerArrayStart return d.decLen() } +func (d *simpleDecDriver) ReadArrayElem() { + d.c = containerArrayElem +} + +func (d *simpleDecDriver) ReadArrayEnd() { + d.c = containerArrayEnd +} + +func (d *simpleDecDriver) ReadMapElemKey() { + d.c = containerMapKey +} + +func (d *simpleDecDriver) ReadMapElemValue() { + d.c = containerMapValue +} + +func (d *simpleDecDriver) ReadMapEnd() { + d.c = containerMapEnd +} + func (d *simpleDecDriver) decLen() int { switch d.bd % 8 { case 0: @@ -344,14 +406,14 @@ func (d *simpleDecDriver) decLen() int { case 3: ui := uint64(bigen.Uint32(d.r.readx(4))) if chkOvf.Uint(ui, intBitsize) { - d.d.errorf("simple: overflow integer: %v", ui) + d.d.errorf("overflow integer: %v", ui) return 0 } return int(ui) case 4: ui := bigen.Uint64(d.r.readx(8)) if chkOvf.Uint(ui, intBitsize) { - d.d.errorf("simple: overflow integer: %v", ui) + d.d.errorf("overflow integer: %v", ui) return 0 } return int(ui) @@ -361,10 +423,14 @@ func (d *simpleDecDriver) decLen() int { } func (d *simpleDecDriver) DecodeString() (s string) { - return string(d.DecodeBytes(d.b[:], true, true)) + return string(d.DecodeBytes(d.d.b[:], true)) } -func (d *simpleDecDriver) DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut []byte) { +func (d *simpleDecDriver) DecodeStringAsBytes() (s []byte) { + return d.DecodeBytes(d.d.b[:], true) +} + +func (d *simpleDecDriver) DecodeBytes(bs []byte, zerocopy bool) (bsOut []byte) { if !d.bdRead { d.readNextBd() } @@ -372,18 +438,48 @@ func (d *simpleDecDriver) DecodeBytes(bs []byte, isstring, zerocopy bool) (bsOut d.bdRead = false return } + // check if an "array" of uint8's (see ContainerType for how to infer if an array) + if d.bd >= simpleVdArray && d.bd <= simpleVdMap+4 { + if len(bs) == 0 && zerocopy { + bs = d.d.b[:] + } + bsOut, _ = fastpathTV.DecSliceUint8V(bs, true, d.d) + return + } + clen := d.decLen() d.bdRead = false if zerocopy { if d.br { return d.r.readx(clen) } else if len(bs) == 0 { - bs = d.b[:] + bs = d.d.b[:] } } return decByteSlice(d.r, clen, d.d.h.MaxInitLen, bs) } +func (d *simpleDecDriver) DecodeTime() (t time.Time) { + if !d.bdRead { + d.readNextBd() + } + if d.bd == simpleVdNil { + d.bdRead = false + return + } + if d.bd != simpleVdTime { + d.d.errorf("invalid descriptor for time.Time - expect 0x%x, received 0x%x", simpleVdTime, d.bd) + return + } + d.bdRead = false + clen := int(d.r.readn1()) + b := d.r.readx(clen) + if err := (&t).UnmarshalBinary(b); err != nil { + d.d.errorv(err) + } + return +} + func (d *simpleDecDriver) DecodeExt(rv interface{}, xtag uint64, ext Ext) (realxtag uint64) { if xtag > 0xff { d.d.errorf("decodeExt: tag must be <= 0xff; got: %v", xtag) @@ -414,10 +510,11 @@ func (d *simpleDecDriver) decodeExtV(verifyTag bool, tag byte) (xtag byte, xbs [ return } xbs = d.r.readx(l) - case simpleVdByteArray, simpleVdByteArray + 1, simpleVdByteArray + 2, simpleVdByteArray + 3, simpleVdByteArray + 4: - xbs = d.DecodeBytes(nil, false, true) + case simpleVdByteArray, simpleVdByteArray + 1, + simpleVdByteArray + 2, simpleVdByteArray + 3, simpleVdByteArray + 4: + xbs = d.DecodeBytes(nil, true) default: - d.d.errorf("Invalid d.bd for extensions (Expecting extensions or byte array). Got: 0x%x", d.bd) + d.d.errorf("Invalid descriptor - expecting extensions/bytearray, got: 0x%x", d.bd) return } d.bdRead = false @@ -429,7 +526,7 @@ func (d *simpleDecDriver) DecodeNaked() { d.readNextBd() } - n := &d.d.n + n := d.d.n var decodeFurther bool switch d.bd { @@ -444,32 +541,38 @@ func (d *simpleDecDriver) DecodeNaked() { case simpleVdPosInt, simpleVdPosInt + 1, simpleVdPosInt + 2, simpleVdPosInt + 3: if d.h.SignedInteger { n.v = valueTypeInt - n.i = d.DecodeInt(64) + n.i = d.DecodeInt64() } else { n.v = valueTypeUint - n.u = d.DecodeUint(64) + n.u = d.DecodeUint64() } case simpleVdNegInt, simpleVdNegInt + 1, simpleVdNegInt + 2, simpleVdNegInt + 3: n.v = valueTypeInt - n.i = d.DecodeInt(64) + n.i = d.DecodeInt64() case simpleVdFloat32: n.v = valueTypeFloat - n.f = d.DecodeFloat(true) + n.f = d.DecodeFloat64() case simpleVdFloat64: n.v = valueTypeFloat - n.f = d.DecodeFloat(false) - case simpleVdString, simpleVdString + 1, simpleVdString + 2, simpleVdString + 3, simpleVdString + 4: + n.f = d.DecodeFloat64() + case simpleVdTime: + n.v = valueTypeTime + n.t = d.DecodeTime() + case simpleVdString, simpleVdString + 1, + simpleVdString + 2, simpleVdString + 3, simpleVdString + 4: n.v = valueTypeString n.s = d.DecodeString() - case simpleVdByteArray, simpleVdByteArray + 1, simpleVdByteArray + 2, simpleVdByteArray + 3, simpleVdByteArray + 4: + case simpleVdByteArray, simpleVdByteArray + 1, + simpleVdByteArray + 2, simpleVdByteArray + 3, simpleVdByteArray + 4: n.v = valueTypeBytes - n.l = d.DecodeBytes(nil, false, false) + n.l = d.DecodeBytes(nil, false) case simpleVdExt, simpleVdExt + 1, simpleVdExt + 2, simpleVdExt + 3, simpleVdExt + 4: n.v = valueTypeExt l := d.decLen() n.u = uint64(d.r.readn1()) n.l = d.r.readx(l) - case simpleVdArray, simpleVdArray + 1, simpleVdArray + 2, simpleVdArray + 3, simpleVdArray + 4: + case simpleVdArray, simpleVdArray + 1, simpleVdArray + 2, + simpleVdArray + 3, simpleVdArray + 4: n.v = valueTypeArray decodeFurther = true case simpleVdMap, simpleVdMap + 1, simpleVdMap + 2, simpleVdMap + 3, simpleVdMap + 4: @@ -495,7 +598,7 @@ func (d *simpleDecDriver) DecodeNaked() { // - Integers (intXXX, uintXXX) are encoded in 1, 2, 4 or 8 bytes (plus a descriptor byte). // There are positive (uintXXX and intXXX >= 0) and negative (intXXX < 0) integers. // - Floats are encoded in 4 or 8 bytes (plus a descriptor byte) -// - Lenght of containers (strings, bytes, array, map, extensions) +// - Length of containers (strings, bytes, array, map, extensions) // are encoded in 0, 1, 2, 4 or 8 bytes. // Zero-length containers have no length encoded. // For others, the number of bytes is given by pow(2, bd%3) @@ -503,17 +606,29 @@ func (d *simpleDecDriver) DecodeNaked() { // - arrays are encoded as [bd] [length] [value]... // - extensions are encoded as [bd] [length] [tag] [byte]... // - strings/bytearrays are encoded as [bd] [length] [byte]... +// - time.Time are encoded as [bd] [length] [byte]... // // The full spec will be published soon. type SimpleHandle struct { BasicHandle binaryEncodingType + noElemSeparators + // EncZeroValuesAsNil says to encode zero values for numbers, bool, string, etc as nil + EncZeroValuesAsNil bool + + _ [1]uint64 // padding } +// Name returns the name of the handle: simple +func (h *SimpleHandle) Name() string { return "simple" } + +// SetBytesExt sets an extension func (h *SimpleHandle) SetBytesExt(rt reflect.Type, tag uint64, ext BytesExt) (err error) { - return h.SetExt(rt, tag, &setExtWrapper{b: ext}) + return h.SetExt(rt, tag, &extWrapper{ext, interfaceExtFailer{}}) } +func (h *SimpleHandle) hasElemSeparators() bool { return true } // as it implements Write(Map|Array)XXX + func (h *SimpleHandle) newEncDriver(e *Encoder) encDriver { return &simpleEncDriver{e: e, w: e.w, h: h} } @@ -523,10 +638,12 @@ func (h *SimpleHandle) newDecDriver(d *Decoder) decDriver { } func (e *simpleEncDriver) reset() { + e.c = 0 e.w = e.e.w } func (d *simpleDecDriver) reset() { + d.c = 0 d.r, d.br = d.d.r, d.d.bytes d.bd, d.bdRead = 0, false } diff --git a/vendor/github.com/ugorji/go/codec/tests.sh b/vendor/github.com/ugorji/go/codec/tests.sh deleted file mode 100755 index fc9f5dee3..000000000 --- a/vendor/github.com/ugorji/go/codec/tests.sh +++ /dev/null @@ -1,107 +0,0 @@ -#!/bin/bash - -# Run all the different permutations of all the tests. -# This helps ensure that nothing gets broken. - -_run() { - # 1. VARIATIONS: regular (t), canonical (c), IO R/W (i), - # binc-nosymbols (n), struct2array (s), intern string (e), - # json-indent (d), circular (l) - # 2. MODE: reflection (r), external (x), codecgen (g), unsafe (u), notfastpath (f) - # 3. OPTIONS: verbose (v), reset (z), must (m), - # - # Use combinations of mode to get exactly what you want, - # and then pass the variations you need. - - ztags="" - zargs="" - local OPTIND - OPTIND=1 - # "_xurtcinsvgzmefdl" === "_cdefgilmnrtsuvxz" - while getopts "_cdefgilmnrtsuvwxz" flag - do - case "x$flag" in - 'xr') ;; - 'xf') ztags="$ztags notfastpath" ;; - 'xg') ztags="$ztags codecgen" ;; - 'xx') ztags="$ztags x" ;; - 'xu') ztags="$ztags unsafe" ;; - 'xv') zargs="$zargs -tv" ;; - 'xz') zargs="$zargs -tr" ;; - 'xm') zargs="$zargs -tm" ;; - 'xl') zargs="$zargs -tl" ;; - 'xw') zargs="$zargs -tx=10" ;; - *) ;; - esac - done - # shift $((OPTIND-1)) - printf '............. TAGS: %s .............\n' "$ztags" - # echo ">>>>>>> TAGS: $ztags" - - OPTIND=1 - while getopts "_cdefgilmnrtsuvwxz" flag - do - case "x$flag" in - 'xt') printf ">>>>>>> REGULAR : "; go test "-tags=$ztags" $zargs ; sleep 2 ;; - 'xc') printf ">>>>>>> CANONICAL : "; go test "-tags=$ztags" $zargs -tc; sleep 2 ;; - 'xi') printf ">>>>>>> I/O : "; go test "-tags=$ztags" $zargs -ti; sleep 2 ;; - 'xn') printf ">>>>>>> NO_SYMBOLS : "; go test "-tags=$ztags" -run=Binc $zargs -tn; sleep 2 ;; - 'xs') printf ">>>>>>> TO_ARRAY : "; go test "-tags=$ztags" $zargs -ts; sleep 2 ;; - 'xe') printf ">>>>>>> INTERN : "; go test "-tags=$ztags" $zargs -te; sleep 2 ;; - 'xd') printf ">>>>>>> INDENT : "; - go test "-tags=$ztags" -run=JsonCodecsTable -td=-1 $zargs; - go test "-tags=$ztags" -run=JsonCodecsTable -td=8 $zargs; - sleep 2 ;; - *) ;; - esac - done - shift $((OPTIND-1)) - - OPTIND=1 -} - -# echo ">>>>>>> RUNNING VARIATIONS OF TESTS" -if [[ "x$@" = "x" || "x$@" = "x-A" ]]; then - # All: r, x, g, gu - _run "-_tcinsed_ml" # regular - _run "-_tcinsed_ml_z" # regular with reset - _run "-w_tcinsed_ml" # regular with max init len - _run "-_tcinsed_ml_f" # regular with no fastpath (notfastpath) - _run "-x_tcinsed_ml" # external - _run "-gx_tcinsed_ml" # codecgen: requires external - _run "-gxu_tcinsed_ml" # codecgen + unsafe -elif [[ "x$@" = "x-Z" ]]; then - # Regular - _run "-_tcinsed_ml" # regular - _run "-_tcinsed_ml_z" # regular with reset -elif [[ "x$@" = "x-F" ]]; then - # regular with notfastpath - _run "-_tcinsed_ml_f" # regular - _run "-_tcinsed_ml_zf" # regular with reset -elif [[ "x$@" = "x-C" ]]; then - # codecgen - _run "-gx_tcinsed_ml" # codecgen: requires external - _run "-gxu_tcinsed_ml" # codecgen + unsafe - _run "-gxuw_tcinsed_ml" # codecgen + unsafe + maxinitlen -elif [[ "x$@" = "x-X" ]]; then - # external - _run "-x_tcinsed_ml" # external -elif [[ "x$@" = "x-h" || "x$@" = "x-?" ]]; then - cat <= 0) - bd = bd | (byte(7-f) << 2) - copy(bs[i:], btmp[f:]) - i = i + (8 - f) - } - if tnsecs != 0 { - bd = bd | 0x40 - bigen.PutUint32(btmp[:4], uint32(tnsecs)) - f := pruneSignExt(btmp[:4], true) - bd = bd | byte(3-f) - copy(bs[i:], btmp[f:4]) - i = i + (4 - f) - } - if l != nil { - bd = bd | 0x20 - // Note that Go Libs do not give access to dst flag. - _, zoneOffset := t.Zone() - //zoneName, zoneOffset := t.Zone() - zoneOffset /= 60 - z := uint16(zoneOffset) - bigen.PutUint16(btmp[:2], z) - // clear dst flags - bs[i] = btmp[0] & 0x3f - bs[i+1] = btmp[1] - i = i + 2 - } - bs[0] = bd - return bs[0:i] -} - -// DecodeTime decodes a []byte into a time.Time. -func decodeTime(bs []byte) (tt time.Time, err error) { - bd := bs[0] - var ( - tsec int64 - tnsec uint32 - tz uint16 - i byte = 1 - i2 byte - n byte - ) - if bd&(1<<7) != 0 { - var btmp [8]byte - n = ((bd >> 2) & 0x7) + 1 - i2 = i + n - copy(btmp[8-n:], bs[i:i2]) - //if first bit of bs[i] is set, then fill btmp[0..8-n] with 0xff (ie sign extend it) - if bs[i]&(1<<7) != 0 { - copy(btmp[0:8-n], bsAll0xff) - //for j,k := byte(0), 8-n; j < k; j++ { btmp[j] = 0xff } - } - i = i2 - tsec = int64(bigen.Uint64(btmp[:])) - } - if bd&(1<<6) != 0 { - var btmp [4]byte - n = (bd & 0x3) + 1 - i2 = i + n - copy(btmp[4-n:], bs[i:i2]) - i = i2 - tnsec = bigen.Uint32(btmp[:]) - } - if bd&(1<<5) == 0 { - tt = time.Unix(tsec, int64(tnsec)).UTC() - return - } - // In stdlib time.Parse, when a date is parsed without a zone name, it uses "" as zone name. - // However, we need name here, so it can be shown when time is printed. - // Zone name is in form: UTC-08:00. - // Note that Go Libs do not give access to dst flag, so we ignore dst bits - - i2 = i + 2 - tz = bigen.Uint16(bs[i:i2]) - i = i2 - // sign extend sign bit into top 2 MSB (which were dst bits): - if tz&(1<<13) == 0 { // positive - tz = tz & 0x3fff //clear 2 MSBs: dst bits - } else { // negative - tz = tz | 0xc000 //set 2 MSBs: dst bits - //tzname[3] = '-' (TODO: verify. this works here) - } - tzint := int16(tz) - if tzint == 0 { - tt = time.Unix(tsec, int64(tnsec)).UTC() - } else { - // For Go Time, do not use a descriptive timezone. - // It's unnecessary, and makes it harder to do a reflect.DeepEqual. - // The Offset already tells what the offset should be, if not on UTC and unknown zone name. - // var zoneName = timeLocUTCName(tzint) - tt = time.Unix(tsec, int64(tnsec)).In(time.FixedZone("", int(tzint)*60)) - } - return -} - -func timeLocUTCName(tzint int16) string { - if tzint == 0 { - return "UTC" - } - var tzname = []byte("UTC+00:00") - //tzname := fmt.Sprintf("UTC%s%02d:%02d", tzsign, tz/60, tz%60) //perf issue using Sprintf. inline below. - //tzhr, tzmin := tz/60, tz%60 //faster if u convert to int first - var tzhr, tzmin int16 - if tzint < 0 { - tzname[3] = '-' // (TODO: verify. this works here) - tzhr, tzmin = -tzint/60, (-tzint)%60 - } else { - tzhr, tzmin = tzint/60, tzint%60 - } - tzname[4] = timeDigits[tzhr/10] - tzname[5] = timeDigits[tzhr%10] - tzname[7] = timeDigits[tzmin/10] - tzname[8] = timeDigits[tzmin%10] - return string(tzname) - //return time.FixedZone(string(tzname), int(tzint)*60) -} diff --git a/vendor/github.com/ugorji/go/codec/values_flex_test.go b/vendor/github.com/ugorji/go/codec/values_flex_test.go new file mode 100644 index 000000000..3b7da27e1 --- /dev/null +++ b/vendor/github.com/ugorji/go/codec/values_flex_test.go @@ -0,0 +1,186 @@ +/* // +build testing */ + +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Use of this source code is governed by a MIT license found in the LICENSE file. + +package codec + +import "time" + +// This file contains values used by tests alone. +// This is where we may try out different things, +// that other engines may not support or may barf upon +// e.g. custom extensions for wrapped types, maps with non-string keys, etc. + +// Some unused types just stored here +type Bbool bool +type Sstring string +type Sstructsmall struct { + A int +} + +type Sstructbig struct { + A int + B bool + c string + // Sval Sstruct + Ssmallptr *Sstructsmall + Ssmall *Sstructsmall + Sptr *Sstructbig +} + +type SstructbigMapBySlice struct { + _struct struct{} `codec:",toarray"` + A int + B bool + c string + // Sval Sstruct + Ssmallptr *Sstructsmall + Ssmall *Sstructsmall + Sptr *Sstructbig +} + +type Sinterface interface { + Noop() +} + +// small struct for testing that codecgen works for unexported types +type tLowerFirstLetter struct { + I int + u uint64 + S string + b []byte +} + +// Some used types +type wrapInt64 int64 +type wrapUint8 uint8 +type wrapBytes []uint8 + +type AnonInTestStrucIntf struct { + Islice []interface{} + Ms map[string]interface{} + Nintf interface{} //don't set this, so we can test for nil + T time.Time +} + +var testWRepeated512 wrapBytes +var testStrucTime = time.Date(2012, 2, 2, 2, 2, 2, 2000, time.UTC).UTC() + +func init() { + var testARepeated512 [512]byte + for i := range testARepeated512 { + testARepeated512[i] = 'A' + } + testWRepeated512 = wrapBytes(testARepeated512[:]) +} + +type TestStrucFlex struct { + _struct struct{} `codec:",omitempty"` //set omitempty for every field + TestStrucCommon + + Mis map[int]string + Mbu64 map[bool]struct{} + Miwu64s map[int]wrapUint64Slice + Mfwss map[float64]wrapStringSlice + Mf32wss map[float32]wrapStringSlice + Mui2wss map[uint64]wrapStringSlice + Msu2wss map[stringUint64T]wrapStringSlice + + Ci64 wrapInt64 + Swrapbytes []wrapBytes + Swrapuint8 []wrapUint8 + + ArrStrUi64T [4]stringUint64T + + Ui64array [4]uint64 + Ui64slicearray []*[4]uint64 + + // make this a ptr, so that it could be set or not. + // for comparison (e.g. with msgp), give it a struct tag (so it is not inlined), + // make this one omitempty (so it is excluded if nil). + *AnonInTestStrucIntf `json:",omitempty"` + + //M map[interface{}]interface{} `json:"-",bson:"-"` + Mtsptr map[string]*TestStrucFlex + Mts map[string]TestStrucFlex + Its []*TestStrucFlex + Nteststruc *TestStrucFlex +} + +func newTestStrucFlex(depth, n int, bench, useInterface, useStringKeyOnly bool) (ts *TestStrucFlex) { + ts = &TestStrucFlex{ + Miwu64s: map[int]wrapUint64Slice{ + 5: []wrapUint64{1, 2, 3, 4, 5}, + 3: []wrapUint64{1, 2, 3}, + }, + + Mf32wss: map[float32]wrapStringSlice{ + 5.0: []wrapString{"1.0", "2.0", "3.0", "4.0", "5.0"}, + 3.0: []wrapString{"1.0", "2.0", "3.0"}, + }, + + Mui2wss: map[uint64]wrapStringSlice{ + 5: []wrapString{"1.0", "2.0", "3.0", "4.0", "5.0"}, + 3: []wrapString{"1.0", "2.0", "3.0"}, + }, + + Mfwss: map[float64]wrapStringSlice{ + 5.0: []wrapString{"1.0", "2.0", "3.0", "4.0", "5.0"}, + 3.0: []wrapString{"1.0", "2.0", "3.0"}, + }, + Mis: map[int]string{ + 1: "one", + 22: "twenty two", + -44: "minus forty four", + }, + Mbu64: map[bool]struct{}{false: {}, true: {}}, + + Ci64: -22, + Swrapbytes: []wrapBytes{ // lengths of 1, 2, 4, 8, 16, 32, 64, 128, 256, + testWRepeated512[:1], + testWRepeated512[:2], + testWRepeated512[:4], + testWRepeated512[:8], + testWRepeated512[:16], + testWRepeated512[:32], + testWRepeated512[:64], + testWRepeated512[:128], + testWRepeated512[:256], + testWRepeated512[:512], + }, + Swrapuint8: []wrapUint8{ + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', + }, + Ui64array: [4]uint64{4, 16, 64, 256}, + ArrStrUi64T: [4]stringUint64T{{"4", 4}, {"3", 3}, {"2", 2}, {"1", 1}}, + } + + ts.Ui64slicearray = []*[4]uint64{&ts.Ui64array, &ts.Ui64array} + + if useInterface { + ts.AnonInTestStrucIntf = &AnonInTestStrucIntf{ + Islice: []interface{}{strRpt(n, "true"), true, strRpt(n, "no"), false, uint64(288), float64(0.4)}, + Ms: map[string]interface{}{ + strRpt(n, "true"): strRpt(n, "true"), + strRpt(n, "int64(9)"): false, + }, + T: testStrucTime, + } + } + + populateTestStrucCommon(&ts.TestStrucCommon, n, bench, useInterface, useStringKeyOnly) + if depth > 0 { + depth-- + if ts.Mtsptr == nil { + ts.Mtsptr = make(map[string]*TestStrucFlex) + } + if ts.Mts == nil { + ts.Mts = make(map[string]TestStrucFlex) + } + ts.Mtsptr["0"] = newTestStrucFlex(depth, n, bench, useInterface, useStringKeyOnly) + ts.Mts["0"] = *(ts.Mtsptr["0"]) + ts.Its = append(ts.Its, ts.Mtsptr["0"]) + } + return +} diff --git a/vendor/github.com/ugorji/go/codec/values_test.go b/vendor/github.com/ugorji/go/codec/values_test.go index a1a383746..7eaec803a 100644 --- a/vendor/github.com/ugorji/go/codec/values_test.go +++ b/vendor/github.com/ugorji/go/codec/values_test.go @@ -1,51 +1,118 @@ /* // +build testing */ -// Copyright (c) 2012-2015 Ugorji Nwoke. All rights reserved. +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. // Use of this source code is governed by a MIT license found in the LICENSE file. package codec // This file contains values used by tests and benchmarks. -// JSON/BSON do not like maps with keys that are not strings, -// so we only use maps with string keys here. +// The benchmarks will test performance against other libraries +// (encoding/json, json-iterator, bson, gob, etc). +// Consequently, we only use values that will parse well in all engines, +// and only leverage features that work across multiple libraries for a truer comparison. +// For example, +// - JSON/BSON do not like maps with keys that are not strings, +// so we only use maps with string keys here. +// - _struct options are not honored by other libraries, +// so we don't use them in this file. import ( "math" - "time" + "strings" ) -var testStrucTime = time.Date(2012, 2, 2, 2, 2, 2, 2000, time.UTC).UTC() +// func init() { +// rt := reflect.TypeOf((*TestStruc)(nil)).Elem() +// defTypeInfos.get(rt2id(rt), rt) +// } + +type wrapSliceUint64 []uint64 +type wrapSliceString []string +type wrapUint64 uint64 +type wrapString string +type wrapUint64Slice []wrapUint64 +type wrapStringSlice []wrapString + +type stringUint64T struct { + S string + U uint64 +} type AnonInTestStruc struct { - AS string - AI64 int64 - AI16 int16 - AUi64 uint64 - ASslice []string - AI64slice []int64 - AF64slice []float64 + AS string + AI64 int64 + AI16 int16 + AUi64 uint64 + ASslice []string + AI64slice []int64 + AUi64slice []uint64 + AF64slice []float64 + AF32slice []float32 + // AMI32U32 map[int32]uint32 // AMU32F64 map[uint32]float64 // json/bson do not like it AMSU16 map[string]uint16 + + // use these to test 0-len or nil slices/maps/arrays + AI64arr0 [0]int64 + A164slice0 []int64 + AUi64sliceN []uint64 + AMSU16N map[string]uint16 + AMSU16E map[string]uint16 } -type AnonInTestStrucIntf struct { - Islice []interface{} - Ms map[string]interface{} - Nintf interface{} //don't set this, so we can test for nil - T time.Time -} +// testSimpleFields is a sub-set of TestStrucCommon +type testSimpleFields struct { + S string -type TestStruc struct { - _struct struct{} `codec:",omitempty"` //set omitempty for every field + I64 int64 + I8 int8 - S string - I64 int64 - I16 int16 Ui64 uint64 Ui8 uint8 - B bool - By uint8 // byte: msgp doesn't like byte + + F64 float64 + F32 float32 + + B bool + + Sslice []string + I16slice []int16 + Ui64slice []uint64 + Ui8slice []uint8 + Bslice []bool + + Iptrslice []*int64 + + WrapSliceInt64 wrapSliceUint64 + WrapSliceString wrapSliceString + + Msi64 map[string]int64 +} + +type TestStrucCommon struct { + S string + + I64 int64 + I32 int32 + I16 int16 + I8 int8 + + I64n int64 + I32n int32 + I16n int16 + I8n int8 + + Ui64 uint64 + Ui32 uint32 + Ui16 uint16 + Ui8 uint8 + + F64 float64 + F32 float32 + + B bool + By uint8 // byte: msgp doesn't like byte Sslice []string I64slice []int64 @@ -57,51 +124,151 @@ type TestStruc struct { Iptrslice []*int64 - // TODO: test these separately, specifically for reflection and codecgen. - // Unfortunately, ffjson doesn't support these. Its compilation even fails. - // Ui64array [4]uint64 - // Ui64slicearray [][4]uint64 + WrapSliceInt64 wrapSliceUint64 + WrapSliceString wrapSliceString + + Msi64 map[string]int64 + + Simplef testSimpleFields + + SstrUi64T []stringUint64T AnonInTestStruc - //M map[interface{}]interface{} `json:"-",bson:"-"` - Msi64 map[string]int64 + NotAnon AnonInTestStruc - // make this a ptr, so that it could be set or not. - // for comparison (e.g. with msgp), give it a struct tag (so it is not inlined), - // make this one omitempty (so it is included if nil). - *AnonInTestStrucIntf `codec:",omitempty"` + // R Raw // Testing Raw must be explicitly turned on, so use standalone test + // Rext RawExt // Testing RawExt is tricky, so use standalone test + + Nmap map[string]bool //don't set this, so we can test for nil + Nslice []byte //don't set this, so we can test for nil + Nint64 *int64 //don't set this, so we can test for nil +} + +type TestStruc struct { + // _struct struct{} `json:",omitempty"` //set omitempty for every field + + TestStrucCommon - Nmap map[string]bool //don't set this, so we can test for nil - Nslice []byte //don't set this, so we can test for nil - Nint64 *int64 //don't set this, so we can test for nil Mtsptr map[string]*TestStruc Mts map[string]TestStruc Its []*TestStruc Nteststruc *TestStruc } -// small struct for testing that codecgen works for unexported types -type tLowerFirstLetter struct { - I int - u uint64 - S string - b []byte -} - -func newTestStruc(depth int, bench bool, useInterface, useStringKeyOnly bool) (ts *TestStruc) { +func populateTestStrucCommon(ts *TestStrucCommon, n int, bench, useInterface, useStringKeyOnly bool) { var i64a, i64b, i64c, i64d int64 = 64, 6464, 646464, 64646464 - ts = &TestStruc{ - S: "some string", - I64: math.MaxInt64 * 2 / 3, // 64, - I16: 1616, - Ui64: uint64(int64(math.MaxInt64 * 2 / 3)), // 64, //don't use MaxUint64, as bson can't write it - Ui8: 160, - B: true, - By: 5, + // if bench, do not use uint64 values > math.MaxInt64, as bson, etc cannot decode them - Sslice: []string{"one", "two", "three"}, + var a = AnonInTestStruc{ + // There's more leeway in altering this. + AS: strRpt(n, "A-String"), + AI64: -64646464, + AI16: 1616, + AUi64: 64646464, + // (U+1D11E)G-clef character may be represented in json as "\uD834\uDD1E". + // single reverse solidus character may be represented in json as "\u005C". + // include these in ASslice below. + ASslice: []string{ + strRpt(n, "Aone"), + strRpt(n, "Atwo"), + strRpt(n, "Athree"), + strRpt(n, "Afour.reverse_solidus.\u005c"), + strRpt(n, "Afive.Gclef.\U0001d11E\"ugorji\"done.")}, + AI64slice: []int64{ + 0, 1, -1, -22, 333, -4444, 55555, -666666, + // msgpack ones + -48, -32, -24, -8, 32, 127, 192, 255, + // standard ones + 0, -1, 1, + math.MaxInt8, math.MaxInt8 + 4, math.MaxInt8 - 4, + math.MaxInt16, math.MaxInt16 + 4, math.MaxInt16 - 4, + math.MaxInt32, math.MaxInt32 + 4, math.MaxInt32 - 4, + math.MaxInt64, math.MaxInt64 - 4, + math.MinInt8, math.MinInt8 + 4, math.MinInt8 - 4, + math.MinInt16, math.MinInt16 + 4, math.MinInt16 - 4, + math.MinInt32, math.MinInt32 + 4, math.MinInt32 - 4, + math.MinInt64, math.MinInt64 + 4, + }, + AUi64slice: []uint64{ + 0, 1, 22, 333, 4444, 55555, 666666, + // standard ones + math.MaxUint8, math.MaxUint8 + 4, math.MaxUint8 - 4, + math.MaxUint16, math.MaxUint16 + 4, math.MaxUint16 - 4, + math.MaxUint32, math.MaxUint32 + 4, math.MaxUint32 - 4, + }, + AMSU16: map[string]uint16{strRpt(n, "1"): 1, strRpt(n, "22"): 2, strRpt(n, "333"): 3, strRpt(n, "4444"): 4}, + + // Note: +/- inf, NaN, and other non-representable numbers should not be explicitly tested here + + AF64slice: []float64{ + 11.11e-11, -11.11e+11, + 2.222E+12, -2.222E-12, + -555.55E-5, 555.55E+5, + 666.66E-6, -666.66E+6, + 7777.7777E-7, -7777.7777E-7, + -8888.8888E+8, 8888.8888E+8, + -99999.9999E+9, 99999.9999E+9, + // these below are hairy enough to need strconv.ParseFloat + 33.33E-33, -33.33E+33, + 44.44e+44, -44.44e-44, + // standard ones + 0, -1, 1, + // math.Inf(1), math.Inf(-1), + math.Pi, math.Phi, math.E, + math.MaxFloat64, math.SmallestNonzeroFloat64, + }, + AF32slice: []float32{ + 11.11e-11, -11.11e+11, + 2.222E+12, -2.222E-12, + -555.55E-5, 555.55E+5, + 666.66E-6, -666.66E+6, + 7777.7777E-7, -7777.7777E-7, + -8888.8888E+8, 8888.8888E+8, + -99999.9999E+9, 99999.9999E+9, + // these below are hairy enough to need strconv.ParseFloat + 33.33E-33, -33.33E+33, + // standard ones + 0, -1, 1, + // math.Float32frombits(0x7FF00000), math.Float32frombits(0xFFF00000), //+inf and -inf + math.MaxFloat32, math.SmallestNonzeroFloat32, + }, + + A164slice0: []int64{}, + AUi64sliceN: nil, + AMSU16N: nil, + AMSU16E: map[string]uint16{}, + } + + if !bench { + a.AUi64slice = append(a.AUi64slice, math.MaxUint64, math.MaxUint64-4) + } + *ts = TestStrucCommon{ + S: strRpt(n, `some really really cool names that are nigerian and american like "ugorji melody nwoke" - get it? `), + + // set the numbers close to the limits + I8: math.MaxInt8 * 2 / 3, // 8, + I8n: math.MinInt8 * 2 / 3, // 8, + I16: math.MaxInt16 * 2 / 3, // 16, + I16n: math.MinInt16 * 2 / 3, // 16, + I32: math.MaxInt32 * 2 / 3, // 32, + I32n: math.MinInt32 * 2 / 3, // 32, + I64: math.MaxInt64 * 2 / 3, // 64, + I64n: math.MinInt64 * 2 / 3, // 64, + + Ui64: math.MaxUint64 * 2 / 3, // 64 + Ui32: math.MaxUint32 * 2 / 3, // 32 + Ui16: math.MaxUint16 * 2 / 3, // 16 + Ui8: math.MaxUint8 * 2 / 3, // 8 + + F32: 3.402823e+38, // max representable float32 without losing precision + F64: 3.40281991833838838338e+53, + + B: true, + By: 5, + + Sslice: []string{strRpt(n, "one"), strRpt(n, "two"), strRpt(n, "three")}, I64slice: []int64{1111, 2222, 3333}, I16slice: []int16{44, 55, 66}, Ui64slice: []uint64{12121212, 34343434, 56565656}, @@ -110,34 +277,66 @@ func newTestStruc(depth int, bench bool, useInterface, useStringKeyOnly bool) (t Byslice: []byte{13, 14, 15}, Msi64: map[string]int64{ - "one": 1, - "two": 2, + strRpt(n, "one"): 1, + strRpt(n, "two"): 2, + strRpt(n, "\"three\""): 3, }, - AnonInTestStruc: AnonInTestStruc{ - // There's more leeway in altering this. - AS: "A-String", - AI64: -64646464, - AI16: 1616, - AUi64: 64646464, - // (U+1D11E)G-clef character may be represented in json as "\uD834\uDD1E". - // single reverse solidus character may be represented in json as "\u005C". - // include these in ASslice below. - ASslice: []string{"Aone", "Atwo", "Athree", - "Afour.reverse_solidus.\u005c", "Afive.Gclef.\U0001d11E"}, - AI64slice: []int64{1, -22, 333, -4444, 55555, -666666}, - AMSU16: map[string]uint16{"1": 1, "22": 2, "333": 3, "4444": 4}, - AF64slice: []float64{11.11e-11, 22.22E+22, 33.33E-33, 44.44e+44, 555.55E-6, 666.66E6}, - }, - } - if useInterface { - ts.AnonInTestStrucIntf = &AnonInTestStrucIntf{ - Islice: []interface{}{"true", true, "no", false, uint64(288), float64(0.4)}, - Ms: map[string]interface{}{ - "true": "true", - "int64(9)": false, + + WrapSliceInt64: []uint64{4, 16, 64, 256}, + WrapSliceString: []string{strRpt(n, "4"), strRpt(n, "16"), strRpt(n, "64"), strRpt(n, "256")}, + + // R: Raw([]byte("goodbye")), + // Rext: RawExt{ 120, []byte("hello"), }, // TODO: don't set this - it's hard to test + + // DecodeNaked bombs here, because the stringUint64T is decoded as a map, + // and a map cannot be the key type of a map. + // Thus, don't initialize this here. + // Msu2wss: map[stringUint64T]wrapStringSlice{ + // {"5", 5}: []wrapString{"1", "2", "3", "4", "5"}, + // {"3", 3}: []wrapString{"1", "2", "3"}, + // }, + + // make Simplef same as top-level + // TODO: should this have slightly different values??? + Simplef: testSimpleFields{ + S: strRpt(n, `some really really cool names that are nigerian and american like "ugorji melody nwoke" - get it? `), + + // set the numbers close to the limits + I8: math.MaxInt8 * 2 / 3, // 8, + I64: math.MaxInt64 * 2 / 3, // 64, + + Ui64: math.MaxUint64 * 2 / 3, // 64 + Ui8: math.MaxUint8 * 2 / 3, // 8 + + F32: 3.402823e+38, // max representable float32 without losing precision + F64: 3.40281991833838838338e+53, + + B: true, + + Sslice: []string{strRpt(n, "one"), strRpt(n, "two"), strRpt(n, "three")}, + I16slice: []int16{44, 55, 66}, + Ui64slice: []uint64{12121212, 34343434, 56565656}, + Ui8slice: []uint8{210, 211, 212}, + Bslice: []bool{true, false, true, false}, + + Msi64: map[string]int64{ + strRpt(n, "one"): 1, + strRpt(n, "two"): 2, + strRpt(n, "\"three\""): 3, }, - T: testStrucTime, - } + + WrapSliceInt64: []uint64{4, 16, 64, 256}, + WrapSliceString: []string{strRpt(n, "4"), strRpt(n, "16"), strRpt(n, "64"), strRpt(n, "256")}, + }, + + SstrUi64T: []stringUint64T{{"1", 1}, {"2", 2}, {"3", 3}, {"4", 4}}, + AnonInTestStruc: a, + NotAnon: a, + } + + if bench { + ts.Ui64 = math.MaxInt64 * 2 / 3 + ts.Simplef.Ui64 = ts.Ui64 } //For benchmarks, some things will not work. @@ -154,6 +353,11 @@ func newTestStruc(depth int, bench bool, useInterface, useStringKeyOnly bool) (t if !useStringKeyOnly { // ts.AnonInTestStruc.AMU32F64 = map[uint32]float64{1: 1, 2: 2, 3: 3} // Json/Bson barf } +} + +func newTestStruc(depth, n int, bench, useInterface, useStringKeyOnly bool) (ts *TestStruc) { + ts = &TestStruc{} + populateTestStrucCommon(&ts.TestStrucCommon, n, bench, useInterface, useStringKeyOnly) if depth > 0 { depth-- if ts.Mtsptr == nil { @@ -162,42 +366,35 @@ func newTestStruc(depth int, bench bool, useInterface, useStringKeyOnly bool) (t if ts.Mts == nil { ts.Mts = make(map[string]TestStruc) } - ts.Mtsptr["0"] = newTestStruc(depth, bench, useInterface, useStringKeyOnly) - ts.Mts["0"] = *(ts.Mtsptr["0"]) - ts.Its = append(ts.Its, ts.Mtsptr["0"]) + ts.Mtsptr[strRpt(n, "0")] = newTestStruc(depth, n, bench, useInterface, useStringKeyOnly) + ts.Mts[strRpt(n, "0")] = *(ts.Mtsptr[strRpt(n, "0")]) + ts.Its = append(ts.Its, ts.Mtsptr[strRpt(n, "0")]) } return } -// Some other types +var testStrRptMap = make(map[int]map[string]string) -type Sstring string -type Bbool bool -type Sstructsmall struct { - A int +func strRpt(n int, s string) string { + if false { + // fmt.Printf(">>>> calling strings.Repeat on n: %d, key: %s\n", n, s) + return strings.Repeat(s, n) + } + m1, ok := testStrRptMap[n] + if !ok { + // fmt.Printf(">>>> making new map for n: %v\n", n) + m1 = make(map[string]string) + testStrRptMap[n] = m1 + } + v1, ok := m1[s] + if !ok { + // fmt.Printf(">>>> creating new entry for key: %s\n", s) + v1 = strings.Repeat(s, n) + m1[s] = v1 + } + return v1 } -type Sstructbig struct { - A int - B bool - c string - // Sval Sstruct - Ssmallptr *Sstructsmall - Ssmall *Sstructsmall - Sptr *Sstructbig -} - -type SstructbigMapBySlice struct { - _struct struct{} `codec:",toarray"` - A int - B bool - c string - // Sval Sstruct - Ssmallptr *Sstructsmall - Ssmall *Sstructsmall - Sptr *Sstructbig -} - -type Sinterface interface { - Noop() -} +// func wstrRpt(n int, s string) wrapBytes { +// return wrapBytes(bytes.Repeat([]byte(s), n)) +// } diff --git a/vendor/github.com/ugorji/go/codec/xml.go b/vendor/github.com/ugorji/go/codec/xml.go new file mode 100644 index 000000000..19fc36caf --- /dev/null +++ b/vendor/github.com/ugorji/go/codec/xml.go @@ -0,0 +1,508 @@ +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Use of this source code is governed by a MIT license found in the LICENSE file. + +// +build ignore + +package codec + +import "reflect" + +/* + +A strict Non-validating namespace-aware XML 1.0 parser and (en|de)coder. + +We are attempting this due to perceived issues with encoding/xml: + - Complicated. It tried to do too much, and is not as simple to use as json. + - Due to over-engineering, reflection is over-used AND performance suffers: + java is 6X faster:http://fabsk.eu/blog/category/informatique/dev/golang/ + even PYTHON performs better: http://outgoing.typepad.com/outgoing/2014/07/exploring-golang.html + +codec framework will offer the following benefits + - VASTLY improved performance (when using reflection-mode or codecgen) + - simplicity and consistency: with the rest of the supported formats + - all other benefits of codec framework (streaming, codegeneration, etc) + +codec is not a drop-in replacement for encoding/xml. +It is a replacement, based on the simplicity and performance of codec. +Look at it like JAXB for Go. + +Challenges: + - Need to output XML preamble, with all namespaces at the right location in the output. + - Each "end" block is dynamic, so we need to maintain a context-aware stack + - How to decide when to use an attribute VS an element + - How to handle chardata, attr, comment EXPLICITLY. + - Should it output fragments? + e.g. encoding a bool should just output true OR false, which is not well-formed XML. + +Extend the struct tag. See representative example: + type X struct { + ID uint8 `codec:"http://ugorji.net/x-namespace xid id,omitempty,toarray,attr,cdata"` + // format: [namespace-uri ][namespace-prefix ]local-name, ... + } + +Based on this, we encode + - fields as elements, BUT + encode as attributes if struct tag contains ",attr" and is a scalar (bool, number or string) + - text as entity-escaped text, BUT encode as CDATA if struct tag contains ",cdata". + +To handle namespaces: + - XMLHandle is denoted as being namespace-aware. + Consequently, we WILL use the ns:name pair to encode and decode if defined, else use the plain name. + - *Encoder and *Decoder know whether the Handle "prefers" namespaces. + - add *Encoder.getEncName(*structFieldInfo). + No one calls *structFieldInfo.indexForEncName directly anymore + - OR better yet: indexForEncName is namespace-aware, and helper.go is all namespace-aware + indexForEncName takes a parameter of the form namespace:local-name OR local-name + - add *Decoder.getStructFieldInfo(encName string) // encName here is either like abc, or h1:nsabc + by being a method on *Decoder, or maybe a method on the Handle itself. + No one accesses .encName anymore + - let encode.go and decode.go use these (for consistency) + - only problem exists for gen.go, where we create a big switch on encName. + Now, we also have to add a switch on strings.endsWith(kName, encNsName) + - gen.go will need to have many more methods, and then double-on the 2 switch loops like: + switch k { + case "abc" : x.abc() + case "def" : x.def() + default { + switch { + case !nsAware: panic(...) + case strings.endsWith(":abc"): x.abc() + case strings.endsWith(":def"): x.def() + default: panic(...) + } + } + } + +The structure below accommodates this: + + type typeInfo struct { + sfi []*structFieldInfo // sorted by encName + sfins // sorted by namespace + sfia // sorted, to have those with attributes at the top. Needed to write XML appropriately. + sfip // unsorted + } + type structFieldInfo struct { + encName + nsEncName + ns string + attr bool + cdata bool + } + +indexForEncName is now an internal helper function that takes a sorted array +(one of ti.sfins or ti.sfi). It is only used by *Encoder.getStructFieldInfo(...) + +There will be a separate parser from the builder. +The parser will have a method: next() xmlToken method. It has lookahead support, +so you can pop multiple tokens, make a determination, and push them back in the order popped. +This will be needed to determine whether we are "nakedly" decoding a container or not. +The stack will be implemented using a slice and push/pop happens at the [0] element. + +xmlToken has fields: + - type uint8: 0 | ElementStart | ElementEnd | AttrKey | AttrVal | Text + - value string + - ns string + +SEE: http://www.xml.com/pub/a/98/10/guide0.html?page=3#ENTDECL + +The following are skipped when parsing: + - External Entities (from external file) + - Notation Declaration e.g. + - Entity Declarations & References + - XML Declaration (assume UTF-8) + - XML Directive i.e. + - Other Declarations: Notation, etc. + - Comment + - Processing Instruction + - schema / DTD for validation: + We are not a VALIDATING parser. Validation is done elsewhere. + However, some parts of the DTD internal subset are used (SEE BELOW). + For Attribute List Declarations e.g. + + We considered using the ATTLIST to get "default" value, but not to validate the contents. (VETOED) + +The following XML features are supported + - Namespace + - Element + - Attribute + - cdata + - Unicode escape + +The following DTD (when as an internal sub-set) features are supported: + - Internal Entities e.g. + AND entities for the set: [<>&"'] + - Parameter entities e.g. + + +At decode time, a structure containing the following is kept + - namespace mapping + - default attribute values + - all internal entities (<>&"' and others written in the document) + +When decode starts, it parses XML namespace declarations and creates a map in the +xmlDecDriver. While parsing, that map continuously gets updated. +The only problem happens when a namespace declaration happens on the node that it defines. +e.g. +To handle this, each Element must be fully parsed at a time, +even if it amounts to multiple tokens which are returned one at a time on request. + +xmlns is a special attribute name. + - It is used to define namespaces, including the default + - It is never returned as an AttrKey or AttrVal. + *We may decide later to allow user to use it e.g. you want to parse the xmlns mappings into a field.* + +Number, bool, null, mapKey, etc can all be decoded from any xmlToken. +This accommodates map[int]string for example. + +It should be possible to create a schema from the types, +or vice versa (generate types from schema with appropriate tags). +This is however out-of-scope from this parsing project. + +We should write all namespace information at the first point that it is referenced in the tree, +and use the mapping for all child nodes and attributes. This means that state is maintained +at a point in the tree. This also means that calls to Decode or MustDecode will reset some state. + +When decoding, it is important to keep track of entity references and default attribute values. +It seems these can only be stored in the DTD components. We should honor them when decoding. + +Configuration for XMLHandle will look like this: + + XMLHandle + DefaultNS string + // Encoding: + NS map[string]string // ns URI to key, used for encoding + // Decoding: in case ENTITY declared in external schema or dtd, store info needed here + Entities map[string]string // map of entity rep to character + + +During encode, if a namespace mapping is not defined for a namespace found on a struct, +then we create a mapping for it using nsN (where N is 1..1000000, and doesn't conflict +with any other namespace mapping). + +Note that different fields in a struct can have different namespaces. +However, all fields will default to the namespace on the _struct field (if defined). + +An XML document is a name, a map of attributes and a list of children. +Consequently, we cannot "DecodeNaked" into a map[string]interface{} (for example). +We have to "DecodeNaked" into something that resembles XML data. + +To support DecodeNaked (decode into nil interface{}), we have to define some "supporting" types: + type Name struct { // Preferred. Less allocations due to conversions. + Local string + Space string + } + type Element struct { + Name Name + Attrs map[Name]string + Children []interface{} // each child is either *Element or string + } +Only two "supporting" types are exposed for XML: Name and Element. + +// ------------------ + +We considered 'type Name string' where Name is like "Space Local" (space-separated). +We decided against it, because each creation of a name would lead to +double allocation (first convert []byte to string, then concatenate them into a string). +The benefit is that it is faster to read Attrs from a map. But given that Element is a value +object, we want to eschew methods and have public exposed variables. + +We also considered the following, where xml types were not value objects, and we used +intelligent accessor methods to extract information and for performance. +*** WE DECIDED AGAINST THIS. *** + type Attr struct { + Name Name + Value string + } + // Element is a ValueObject: There are no accessor methods. + // Make element self-contained. + type Element struct { + Name Name + attrsMap map[string]string // where key is "Space Local" + attrs []Attr + childrenT []string + childrenE []Element + childrenI []int // each child is a index into T or E. + } + func (x *Element) child(i) interface{} // returns string or *Element + +// ------------------ + +Per XML spec and our default handling, white space is always treated as +insignificant between elements, except in a text node. The xml:space='preserve' +attribute is ignored. + +**Note: there is no xml: namespace. The xml: attributes were defined before namespaces.** +**So treat them as just "directives" that should be interpreted to mean something**. + +On encoding, we support indenting aka prettifying markup in the same way we support it for json. + +A document or element can only be encoded/decoded from/to a struct. In this mode: + - struct name maps to element name (or tag-info from _struct field) + - fields are mapped to child elements or attributes + +A map is either encoded as attributes on current element, or as a set of child elements. +Maps are encoded as attributes iff their keys and values are primitives (number, bool, string). + +A list is encoded as a set of child elements. + +Primitives (number, bool, string) are encoded as an element, attribute or text +depending on the context. + +Extensions must encode themselves as a text string. + +Encoding is tough, specifically when encoding mappings, because we need to encode +as either attribute or element. To do this, we need to default to encoding as attributes, +and then let Encoder inform the Handle when to start encoding as nodes. +i.e. Encoder does something like: + + h.EncodeMapStart() + h.Encode(), h.Encode(), ... + h.EncodeMapNotAttrSignal() // this is not a bool, because it's a signal + h.Encode(), h.Encode(), ... + h.EncodeEnd() + +Only XMLHandle understands this, and will set itself to start encoding as elements. + +This support extends to maps. For example, if a struct field is a map, and it has +the struct tag signifying it should be attr, then all its fields are encoded as attributes. +e.g. + + type X struct { + M map[string]int `codec:"m,attr"` // encode keys as attributes named + } + +Question: + - if encoding a map, what if map keys have spaces in them??? + Then they cannot be attributes or child elements. Error. + +Options to consider adding later: + - For attribute values, normalize by trimming beginning and ending white space, + and converting every white space sequence to a single space. + - ATTLIST restrictions are enforced. + e.g. default value of xml:space, skipping xml:XYZ style attributes, etc. + - Consider supporting NON-STRICT mode (e.g. to handle HTML parsing). + Some elements e.g. br, hr, etc need not close and should be auto-closed + ... (see http://www.w3.org/TR/html4/loose.dtd) + An expansive set of entities are pre-defined. + - Have easy way to create a HTML parser: + add a HTML() method to XMLHandle, that will set Strict=false, specify AutoClose, + and add HTML Entities to the list. + - Support validating element/attribute XMLName before writing it. + Keep this behind a flag, which is set to false by default (for performance). + type XMLHandle struct { + CheckName bool + } + +Misc: + +ROADMAP (1 weeks): + - build encoder (1 day) + - build decoder (based off xmlParser) (1 day) + - implement xmlParser (2 days). + Look at encoding/xml for inspiration. + - integrate and TEST (1 days) + - write article and post it (1 day) + +// ---------- MORE NOTES FROM 2017-11-30 ------------ + +when parsing +- parse the attributes first +- then parse the nodes + +basically: +- if encoding a field: we use the field name for the wrapper +- if encoding a non-field, then just use the element type name + + map[string]string ==> abcval... or + val... OR + val1val2... <- PREFERED + []string ==> v1v2... + string v1 ==> v1 + bool true ==> true + float 1.0 ==> 1.0 + ... + + F1 map[string]string ==> abcval... OR + val... OR + val... <- PREFERED + F2 []string ==> v1v2... + F3 bool ==> true + ... + +- a scalar is encoded as: + (value) of type T ==> + (value) of field F ==> +- A kv-pair is encoded as: + (key,value) ==> OR + (key,value) of field F ==> OR +- A map or struct is just a list of kv-pairs +- A list is encoded as sequences of same node e.g. + + + value21 + value22 +- we may have to singularize the field name, when entering into xml, + and pluralize them when encoding. +- bi-directional encode->decode->encode is not a MUST. + even encoding/xml cannot decode correctly what was encoded: + + see https://play.golang.org/p/224V_nyhMS + func main() { + fmt.Println("Hello, playground") + v := []interface{}{"hello", 1, true, nil, time.Now()} + s, err := xml.Marshal(v) + fmt.Printf("err: %v, \ns: %s\n", err, s) + var v2 []interface{} + err = xml.Unmarshal(s, &v2) + fmt.Printf("err: %v, \nv2: %v\n", err, v2) + type T struct { + V []interface{} + } + v3 := T{V: v} + s, err = xml.Marshal(v3) + fmt.Printf("err: %v, \ns: %s\n", err, s) + var v4 T + err = xml.Unmarshal(s, &v4) + fmt.Printf("err: %v, \nv4: %v\n", err, v4) + } + Output: + err: , + s: hello1true + err: , + v2: [] + err: , + s: hello1true2009-11-10T23:00:00Z + err: , + v4: {[ ]} +- +*/ + +// ----------- PARSER ------------------- + +type xmlTokenType uint8 + +const ( + _ xmlTokenType = iota << 1 + xmlTokenElemStart + xmlTokenElemEnd + xmlTokenAttrKey + xmlTokenAttrVal + xmlTokenText +) + +type xmlToken struct { + Type xmlTokenType + Value string + Namespace string // blank for AttrVal and Text +} + +type xmlParser struct { + r decReader + toks []xmlToken // list of tokens. + ptr int // ptr into the toks slice + done bool // nothing else to parse. r now returns EOF. +} + +func (x *xmlParser) next() (t *xmlToken) { + // once x.done, or x.ptr == len(x.toks) == 0, then return nil (to signify finish) + if !x.done && len(x.toks) == 0 { + x.nextTag() + } + // parses one element at a time (into possible many tokens) + if x.ptr < len(x.toks) { + t = &(x.toks[x.ptr]) + x.ptr++ + if x.ptr == len(x.toks) { + x.ptr = 0 + x.toks = x.toks[:0] + } + } + return +} + +// nextTag will parses the next element and fill up toks. +// It set done flag if/once EOF is reached. +func (x *xmlParser) nextTag() { + // TODO: implement. +} + +// ----------- ENCODER ------------------- + +type xmlEncDriver struct { + e *Encoder + w encWriter + h *XMLHandle + b [64]byte // scratch + bs []byte // scratch + // s jsonStack + noBuiltInTypes +} + +// ----------- DECODER ------------------- + +type xmlDecDriver struct { + d *Decoder + h *XMLHandle + r decReader // *bytesDecReader decReader + ct valueType // container type. one of unset, array or map. + bstr [8]byte // scratch used for string \UXXX parsing + b [64]byte // scratch + + // wsSkipped bool // whitespace skipped + + // s jsonStack + + noBuiltInTypes +} + +// DecodeNaked will decode into an XMLNode + +// XMLName is a value object representing a namespace-aware NAME +type XMLName struct { + Local string + Space string +} + +// XMLNode represents a "union" of the different types of XML Nodes. +// Only one of fields (Text or *Element) is set. +type XMLNode struct { + Element *Element + Text string +} + +// XMLElement is a value object representing an fully-parsed XML element. +type XMLElement struct { + Name Name + Attrs map[XMLName]string + // Children is a list of child nodes, each being a *XMLElement or string + Children []XMLNode +} + +// ----------- HANDLE ------------------- + +type XMLHandle struct { + BasicHandle + textEncodingType + + DefaultNS string + NS map[string]string // ns URI to key, for encoding + Entities map[string]string // entity representation to string, for encoding. +} + +func (h *XMLHandle) newEncDriver(e *Encoder) encDriver { + return &xmlEncDriver{e: e, w: e.w, h: h} +} + +func (h *XMLHandle) newDecDriver(d *Decoder) decDriver { + // d := xmlDecDriver{r: r.(*bytesDecReader), h: h} + hd := xmlDecDriver{d: d, r: d.r, h: h} + hd.n.bytes = d.b[:] + return &hd +} + +func (h *XMLHandle) SetInterfaceExt(rt reflect.Type, tag uint64, ext InterfaceExt) (err error) { + return h.SetExt(rt, tag, &extWrapper{bytesExtFailer{}, ext}) +} + +var _ decDriver = (*xmlDecDriver)(nil) +var _ encDriver = (*xmlEncDriver)(nil) diff --git a/vendor/github.com/ugorji/go/codec/z_all_test.go b/vendor/github.com/ugorji/go/codec/z_all_test.go new file mode 100644 index 000000000..58a3aa069 --- /dev/null +++ b/vendor/github.com/ugorji/go/codec/z_all_test.go @@ -0,0 +1,475 @@ +// Copyright (c) 2012-2018 Ugorji Nwoke. All rights reserved. +// Use of this source code is governed by a MIT license found in the LICENSE file. + +// +build alltests +// +build go1.7 + +package codec + +// Run this using: +// go test -tags=alltests -run=Suite -coverprofile=cov.out +// go tool cover -html=cov.out +// +// Because build tags are a build time parameter, we will have to test out the +// different tags separately. +// Tags: x codecgen safe appengine notfastpath +// +// These tags should be added to alltests, e.g. +// go test '-tags=alltests x codecgen' -run=Suite -coverprofile=cov.out +// +// To run all tests before submitting code, run: +// a=( "" "safe" "codecgen" "notfastpath" "codecgen notfastpath" "codecgen safe" "safe notfastpath" ) +// for i in "${a[@]}"; do echo ">>>> TAGS: $i"; go test "-tags=alltests $i" -run=Suite; done +// +// This only works on go1.7 and above. This is when subtests and suites were supported. + +import "testing" + +// func TestMain(m *testing.M) { +// println("calling TestMain") +// // set some parameters +// exitcode := m.Run() +// os.Exit(exitcode) +// } + +func testGroupResetFlags() { + testUseMust = false + testCanonical = false + testUseMust = false + testInternStr = false + testUseIoEncDec = -1 + testStructToArray = false + testCheckCircRef = false + testUseReset = false + testMaxInitLen = 0 + testUseIoWrapper = false + testNumRepeatString = 8 + testEncodeOptions.RecursiveEmptyCheck = false + testDecodeOptions.MapValueReset = false + testUseIoEncDec = -1 + testDepth = 0 +} + +func testSuite(t *testing.T, f func(t *testing.T)) { + // find . -name "*_test.go" | xargs grep -e 'flag.' | cut -d '&' -f 2 | cut -d ',' -f 1 | grep -e '^test' + // Disregard the following: testInitDebug, testSkipIntf, testJsonIndent (Need a test for it) + + testReinit() // so flag.Parse() is called first, and never called again + + testDecodeOptions = DecodeOptions{} + testEncodeOptions = EncodeOptions{} + + testGroupResetFlags() + + testReinit() + t.Run("optionsFalse", f) + + testCanonical = true + testUseMust = true + testInternStr = true + testUseIoEncDec = 0 + testStructToArray = true + testCheckCircRef = true + testUseReset = true + testDecodeOptions.MapValueReset = true + testEncodeOptions.RecursiveEmptyCheck = true + testReinit() + t.Run("optionsTrue", f) + + testDepth = 6 + testReinit() + t.Run("optionsTrue-deepstruct", f) + testDepth = 0 + + // testEncodeOptions.AsSymbols = AsSymbolAll + testUseIoWrapper = true + testReinit() + t.Run("optionsTrue-ioWrapper", f) + + testUseIoEncDec = -1 + + // make buffer small enough so that we have to re-fill multiple times. + testSkipRPCTests = true + testUseIoEncDec = 128 + // testDecodeOptions.ReaderBufferSize = 128 + // testEncodeOptions.WriterBufferSize = 128 + testReinit() + t.Run("optionsTrue-bufio", f) + // testDecodeOptions.ReaderBufferSize = 0 + // testEncodeOptions.WriterBufferSize = 0 + testUseIoEncDec = -1 + testSkipRPCTests = false + + testNumRepeatString = 32 + testReinit() + t.Run("optionsTrue-largestrings", f) + + // The following here MUST be tested individually, as they create + // side effects i.e. the decoded value is different. + // testDecodeOptions.MapValueReset = true // ok - no side effects + // testDecodeOptions.InterfaceReset = true // error??? because we do deepEquals to verify + // testDecodeOptions.ErrorIfNoField = true // error, as expected, as fields not there + // testDecodeOptions.ErrorIfNoArrayExpand = true // no error, but no error case either + // testDecodeOptions.PreferArrayOverSlice = true // error??? because slice != array. + // .... however, update deepEqual to take this option + // testReinit() + // t.Run("optionsTrue-resetOptions", f) + + testGroupResetFlags() +} + +/* +find . -name "codec_test.go" | xargs grep -e '^func Test' | \ + cut -d '(' -f 1 | cut -d ' ' -f 2 | \ + while read f; do echo "t.Run(\"$f\", $f)"; done +*/ + +func testCodecGroup(t *testing.T) { + // println("running testcodecsuite") + // + + t.Run("TestBincCodecsTable", TestBincCodecsTable) + t.Run("TestBincCodecsMisc", TestBincCodecsMisc) + t.Run("TestBincCodecsEmbeddedPointer", TestBincCodecsEmbeddedPointer) + t.Run("TestBincStdEncIntf", TestBincStdEncIntf) + t.Run("TestBincMammoth", TestBincMammoth) + t.Run("TestSimpleCodecsTable", TestSimpleCodecsTable) + t.Run("TestSimpleCodecsMisc", TestSimpleCodecsMisc) + t.Run("TestSimpleCodecsEmbeddedPointer", TestSimpleCodecsEmbeddedPointer) + t.Run("TestSimpleStdEncIntf", TestSimpleStdEncIntf) + t.Run("TestSimpleMammoth", TestSimpleMammoth) + t.Run("TestMsgpackCodecsTable", TestMsgpackCodecsTable) + t.Run("TestMsgpackCodecsMisc", TestMsgpackCodecsMisc) + t.Run("TestMsgpackCodecsEmbeddedPointer", TestMsgpackCodecsEmbeddedPointer) + t.Run("TestMsgpackStdEncIntf", TestMsgpackStdEncIntf) + t.Run("TestMsgpackMammoth", TestMsgpackMammoth) + t.Run("TestCborCodecsTable", TestCborCodecsTable) + t.Run("TestCborCodecsMisc", TestCborCodecsMisc) + t.Run("TestCborCodecsEmbeddedPointer", TestCborCodecsEmbeddedPointer) + t.Run("TestCborMapEncodeForCanonical", TestCborMapEncodeForCanonical) + t.Run("TestCborCodecChan", TestCborCodecChan) + t.Run("TestCborStdEncIntf", TestCborStdEncIntf) + t.Run("TestCborMammoth", TestCborMammoth) + t.Run("TestJsonCodecsTable", TestJsonCodecsTable) + t.Run("TestJsonCodecsMisc", TestJsonCodecsMisc) + t.Run("TestJsonCodecsEmbeddedPointer", TestJsonCodecsEmbeddedPointer) + t.Run("TestJsonCodecChan", TestJsonCodecChan) + t.Run("TestJsonStdEncIntf", TestJsonStdEncIntf) + t.Run("TestJsonMammoth", TestJsonMammoth) + t.Run("TestJsonRaw", TestJsonRaw) + t.Run("TestBincRaw", TestBincRaw) + t.Run("TestMsgpackRaw", TestMsgpackRaw) + t.Run("TestSimpleRaw", TestSimpleRaw) + t.Run("TestCborRaw", TestCborRaw) + t.Run("TestAllEncCircularRef", TestAllEncCircularRef) + t.Run("TestAllAnonCycle", TestAllAnonCycle) + t.Run("TestBincRpcGo", TestBincRpcGo) + t.Run("TestSimpleRpcGo", TestSimpleRpcGo) + t.Run("TestMsgpackRpcGo", TestMsgpackRpcGo) + t.Run("TestCborRpcGo", TestCborRpcGo) + t.Run("TestJsonRpcGo", TestJsonRpcGo) + t.Run("TestMsgpackRpcSpec", TestMsgpackRpcSpec) + t.Run("TestBincUnderlyingType", TestBincUnderlyingType) + t.Run("TestJsonLargeInteger", TestJsonLargeInteger) + t.Run("TestJsonDecodeNonStringScalarInStringContext", TestJsonDecodeNonStringScalarInStringContext) + t.Run("TestJsonEncodeIndent", TestJsonEncodeIndent) + + t.Run("TestJsonSwallowAndZero", TestJsonSwallowAndZero) + t.Run("TestCborSwallowAndZero", TestCborSwallowAndZero) + t.Run("TestMsgpackSwallowAndZero", TestMsgpackSwallowAndZero) + t.Run("TestBincSwallowAndZero", TestBincSwallowAndZero) + t.Run("TestSimpleSwallowAndZero", TestSimpleSwallowAndZero) + t.Run("TestJsonRawExt", TestJsonRawExt) + t.Run("TestCborRawExt", TestCborRawExt) + t.Run("TestMsgpackRawExt", TestMsgpackRawExt) + t.Run("TestBincRawExt", TestBincRawExt) + t.Run("TestSimpleRawExt", TestSimpleRawExt) + t.Run("TestJsonMapStructKey", TestJsonMapStructKey) + t.Run("TestCborMapStructKey", TestCborMapStructKey) + t.Run("TestMsgpackMapStructKey", TestMsgpackMapStructKey) + t.Run("TestBincMapStructKey", TestBincMapStructKey) + t.Run("TestSimpleMapStructKey", TestSimpleMapStructKey) + t.Run("TestJsonDecodeNilMapValue", TestJsonDecodeNilMapValue) + t.Run("TestCborDecodeNilMapValue", TestCborDecodeNilMapValue) + t.Run("TestMsgpackDecodeNilMapValue", TestMsgpackDecodeNilMapValue) + t.Run("TestBincDecodeNilMapValue", TestBincDecodeNilMapValue) + t.Run("TestSimpleDecodeNilMapValue", TestSimpleDecodeNilMapValue) + t.Run("TestJsonEmbeddedFieldPrecedence", TestJsonEmbeddedFieldPrecedence) + t.Run("TestCborEmbeddedFieldPrecedence", TestCborEmbeddedFieldPrecedence) + t.Run("TestMsgpackEmbeddedFieldPrecedence", TestMsgpackEmbeddedFieldPrecedence) + t.Run("TestBincEmbeddedFieldPrecedence", TestBincEmbeddedFieldPrecedence) + t.Run("TestSimpleEmbeddedFieldPrecedence", TestSimpleEmbeddedFieldPrecedence) + t.Run("TestJsonLargeContainerLen", TestJsonLargeContainerLen) + t.Run("TestCborLargeContainerLen", TestCborLargeContainerLen) + t.Run("TestMsgpackLargeContainerLen", TestMsgpackLargeContainerLen) + t.Run("TestBincLargeContainerLen", TestBincLargeContainerLen) + t.Run("TestSimpleLargeContainerLen", TestSimpleLargeContainerLen) + t.Run("TestJsonMammothMapsAndSlices", TestJsonMammothMapsAndSlices) + t.Run("TestCborMammothMapsAndSlices", TestCborMammothMapsAndSlices) + t.Run("TestMsgpackMammothMapsAndSlices", TestMsgpackMammothMapsAndSlices) + t.Run("TestBincMammothMapsAndSlices", TestBincMammothMapsAndSlices) + t.Run("TestSimpleMammothMapsAndSlices", TestSimpleMammothMapsAndSlices) + t.Run("TestJsonTime", TestJsonTime) + t.Run("TestCborTime", TestCborTime) + t.Run("TestMsgpackTime", TestMsgpackTime) + t.Run("TestBincTime", TestBincTime) + t.Run("TestSimpleTime", TestSimpleTime) + t.Run("TestJsonUintToInt", TestJsonUintToInt) + t.Run("TestCborUintToInt", TestCborUintToInt) + t.Run("TestMsgpackUintToInt", TestMsgpackUintToInt) + t.Run("TestBincUintToInt", TestBincUintToInt) + t.Run("TestSimpleUintToInt", TestSimpleUintToInt) + t.Run("TestJsonDifferentMapOrSliceType", TestJsonDifferentMapOrSliceType) + t.Run("TestCborDifferentMapOrSliceType", TestCborDifferentMapOrSliceType) + t.Run("TestMsgpackDifferentMapOrSliceType", TestMsgpackDifferentMapOrSliceType) + t.Run("TestBincDifferentMapOrSliceType", TestBincDifferentMapOrSliceType) + t.Run("TestSimpleDifferentMapOrSliceType", TestSimpleDifferentMapOrSliceType) + t.Run("TestJsonScalars", TestJsonScalars) + t.Run("TestCborScalars", TestCborScalars) + t.Run("TestMsgpackScalars", TestMsgpackScalars) + t.Run("TestBincScalars", TestBincScalars) + t.Run("TestSimpleScalars", TestSimpleScalars) + t.Run("TestJsonIntfMapping", TestJsonIntfMapping) + t.Run("TestCborIntfMapping", TestCborIntfMapping) + t.Run("TestMsgpackIntfMapping", TestMsgpackIntfMapping) + t.Run("TestBincIntfMapping", TestBincIntfMapping) + t.Run("TestSimpleIntfMapping", TestSimpleIntfMapping) + + t.Run("TestJsonInvalidUnicode", TestJsonInvalidUnicode) + t.Run("TestCborHalfFloat", TestCborHalfFloat) + // +} + +func testJsonGroup(t *testing.T) { + t.Run("TestJsonCodecsTable", TestJsonCodecsTable) + t.Run("TestJsonCodecsMisc", TestJsonCodecsMisc) + t.Run("TestJsonCodecsEmbeddedPointer", TestJsonCodecsEmbeddedPointer) + t.Run("TestJsonCodecChan", TestJsonCodecChan) + t.Run("TestJsonStdEncIntf", TestJsonStdEncIntf) + t.Run("TestJsonMammoth", TestJsonMammoth) + t.Run("TestJsonRaw", TestJsonRaw) + t.Run("TestJsonRpcGo", TestJsonRpcGo) + t.Run("TestJsonLargeInteger", TestJsonLargeInteger) + t.Run("TestJsonDecodeNonStringScalarInStringContext", TestJsonDecodeNonStringScalarInStringContext) + t.Run("TestJsonEncodeIndent", TestJsonEncodeIndent) + + t.Run("TestJsonSwallowAndZero", TestJsonSwallowAndZero) + t.Run("TestJsonRawExt", TestJsonRawExt) + t.Run("TestJsonMapStructKey", TestJsonMapStructKey) + t.Run("TestJsonDecodeNilMapValue", TestJsonDecodeNilMapValue) + t.Run("TestJsonEmbeddedFieldPrecedence", TestJsonEmbeddedFieldPrecedence) + t.Run("TestJsonLargeContainerLen", TestJsonLargeContainerLen) + t.Run("TestJsonMammothMapsAndSlices", TestJsonMammothMapsAndSlices) + t.Run("TestJsonInvalidUnicode", TestJsonInvalidUnicode) + t.Run("TestJsonTime", TestJsonTime) + t.Run("TestJsonUintToInt", TestJsonUintToInt) + t.Run("TestJsonDifferentMapOrSliceType", TestJsonDifferentMapOrSliceType) + t.Run("TestJsonScalars", TestJsonScalars) + t.Run("TestJsonIntfMapping", TestJsonIntfMapping) +} + +func testBincGroup(t *testing.T) { + t.Run("TestBincCodecsTable", TestBincCodecsTable) + t.Run("TestBincCodecsMisc", TestBincCodecsMisc) + t.Run("TestBincCodecsEmbeddedPointer", TestBincCodecsEmbeddedPointer) + t.Run("TestBincStdEncIntf", TestBincStdEncIntf) + t.Run("TestBincMammoth", TestBincMammoth) + t.Run("TestBincRaw", TestBincRaw) + t.Run("TestSimpleRpcGo", TestSimpleRpcGo) + t.Run("TestBincUnderlyingType", TestBincUnderlyingType) + + t.Run("TestBincSwallowAndZero", TestBincSwallowAndZero) + t.Run("TestBincRawExt", TestBincRawExt) + t.Run("TestBincMapStructKey", TestBincMapStructKey) + t.Run("TestBincDecodeNilMapValue", TestBincDecodeNilMapValue) + t.Run("TestBincEmbeddedFieldPrecedence", TestBincEmbeddedFieldPrecedence) + t.Run("TestBincLargeContainerLen", TestBincLargeContainerLen) + t.Run("TestBincMammothMapsAndSlices", TestBincMammothMapsAndSlices) + t.Run("TestBincTime", TestBincTime) + t.Run("TestBincUintToInt", TestBincUintToInt) + t.Run("TestBincDifferentMapOrSliceType", TestBincDifferentMapOrSliceType) + t.Run("TestBincScalars", TestBincScalars) +} + +func testCborGroup(t *testing.T) { + t.Run("TestCborCodecsTable", TestCborCodecsTable) + t.Run("TestCborCodecsMisc", TestCborCodecsMisc) + t.Run("TestCborCodecsEmbeddedPointer", TestCborCodecsEmbeddedPointer) + t.Run("TestCborMapEncodeForCanonical", TestCborMapEncodeForCanonical) + t.Run("TestCborCodecChan", TestCborCodecChan) + t.Run("TestCborStdEncIntf", TestCborStdEncIntf) + t.Run("TestCborMammoth", TestCborMammoth) + t.Run("TestCborRaw", TestCborRaw) + t.Run("TestCborRpcGo", TestCborRpcGo) + + t.Run("TestCborSwallowAndZero", TestCborSwallowAndZero) + t.Run("TestCborRawExt", TestCborRawExt) + t.Run("TestCborMapStructKey", TestCborMapStructKey) + t.Run("TestCborDecodeNilMapValue", TestCborDecodeNilMapValue) + t.Run("TestCborEmbeddedFieldPrecedence", TestCborEmbeddedFieldPrecedence) + t.Run("TestCborLargeContainerLen", TestCborLargeContainerLen) + t.Run("TestCborMammothMapsAndSlices", TestCborMammothMapsAndSlices) + t.Run("TestCborTime", TestCborTime) + t.Run("TestCborUintToInt", TestCborUintToInt) + t.Run("TestCborDifferentMapOrSliceType", TestCborDifferentMapOrSliceType) + t.Run("TestCborScalars", TestCborScalars) + + t.Run("TestCborHalfFloat", TestCborHalfFloat) +} + +func testMsgpackGroup(t *testing.T) { + t.Run("TestMsgpackCodecsTable", TestMsgpackCodecsTable) + t.Run("TestMsgpackCodecsMisc", TestMsgpackCodecsMisc) + t.Run("TestMsgpackCodecsEmbeddedPointer", TestMsgpackCodecsEmbeddedPointer) + t.Run("TestMsgpackStdEncIntf", TestMsgpackStdEncIntf) + t.Run("TestMsgpackMammoth", TestMsgpackMammoth) + t.Run("TestMsgpackRaw", TestMsgpackRaw) + t.Run("TestMsgpackRpcGo", TestMsgpackRpcGo) + t.Run("TestMsgpackRpcSpec", TestMsgpackRpcSpec) + t.Run("TestMsgpackSwallowAndZero", TestMsgpackSwallowAndZero) + t.Run("TestMsgpackRawExt", TestMsgpackRawExt) + t.Run("TestMsgpackMapStructKey", TestMsgpackMapStructKey) + t.Run("TestMsgpackDecodeNilMapValue", TestMsgpackDecodeNilMapValue) + t.Run("TestMsgpackEmbeddedFieldPrecedence", TestMsgpackEmbeddedFieldPrecedence) + t.Run("TestMsgpackLargeContainerLen", TestMsgpackLargeContainerLen) + t.Run("TestMsgpackMammothMapsAndSlices", TestMsgpackMammothMapsAndSlices) + t.Run("TestMsgpackTime", TestMsgpackTime) + t.Run("TestMsgpackUintToInt", TestMsgpackUintToInt) + t.Run("TestMsgpackDifferentMapOrSliceType", TestMsgpackDifferentMapOrSliceType) + t.Run("TestMsgpackScalars", TestMsgpackScalars) +} + +func testSimpleGroup(t *testing.T) { + t.Run("TestSimpleCodecsTable", TestSimpleCodecsTable) + t.Run("TestSimpleCodecsMisc", TestSimpleCodecsMisc) + t.Run("TestSimpleCodecsEmbeddedPointer", TestSimpleCodecsEmbeddedPointer) + t.Run("TestSimpleStdEncIntf", TestSimpleStdEncIntf) + t.Run("TestSimpleMammoth", TestSimpleMammoth) + t.Run("TestSimpleRaw", TestSimpleRaw) + t.Run("TestSimpleRpcGo", TestSimpleRpcGo) + t.Run("TestSimpleSwallowAndZero", TestSimpleSwallowAndZero) + t.Run("TestSimpleRawExt", TestSimpleRawExt) + t.Run("TestSimpleMapStructKey", TestSimpleMapStructKey) + t.Run("TestSimpleDecodeNilMapValue", TestSimpleDecodeNilMapValue) + t.Run("TestSimpleEmbeddedFieldPrecedence", TestSimpleEmbeddedFieldPrecedence) + t.Run("TestSimpleLargeContainerLen", TestSimpleLargeContainerLen) + t.Run("TestSimpleMammothMapsAndSlices", TestSimpleMammothMapsAndSlices) + t.Run("TestSimpleTime", TestSimpleTime) + t.Run("TestSimpleUintToInt", TestSimpleUintToInt) + t.Run("TestSimpleDifferentMapOrSliceType", TestSimpleDifferentMapOrSliceType) + t.Run("TestSimpleScalars", TestSimpleScalars) +} + +func testSimpleMammothGroup(t *testing.T) { + t.Run("TestSimpleMammothMapsAndSlices", TestSimpleMammothMapsAndSlices) +} + +func testRpcGroup(t *testing.T) { + t.Run("TestBincRpcGo", TestBincRpcGo) + t.Run("TestSimpleRpcGo", TestSimpleRpcGo) + t.Run("TestMsgpackRpcGo", TestMsgpackRpcGo) + t.Run("TestCborRpcGo", TestCborRpcGo) + t.Run("TestJsonRpcGo", TestJsonRpcGo) + t.Run("TestMsgpackRpcSpec", TestMsgpackRpcSpec) +} + +func TestCodecSuite(t *testing.T) { + testSuite(t, testCodecGroup) + + testGroupResetFlags() + + oldIndent, oldCharsAsis, oldPreferFloat, oldMapKeyAsString := + testJsonH.Indent, testJsonH.HTMLCharsAsIs, testJsonH.PreferFloat, testJsonH.MapKeyAsString + + testMaxInitLen = 10 + testJsonH.Indent = 8 + testJsonH.HTMLCharsAsIs = true + testJsonH.MapKeyAsString = true + // testJsonH.PreferFloat = true + testReinit() + t.Run("json-spaces-htmlcharsasis-initLen10", testJsonGroup) + + testMaxInitLen = 10 + testJsonH.Indent = -1 + testJsonH.HTMLCharsAsIs = false + testJsonH.MapKeyAsString = true + // testJsonH.PreferFloat = false + testReinit() + t.Run("json-tabs-initLen10", testJsonGroup) + + testJsonH.Indent, testJsonH.HTMLCharsAsIs, testJsonH.PreferFloat, testJsonH.MapKeyAsString = + oldIndent, oldCharsAsis, oldPreferFloat, oldMapKeyAsString + + oldIndefLen := testCborH.IndefiniteLength + + testCborH.IndefiniteLength = true + testReinit() + t.Run("cbor-indefinitelength", testCborGroup) + + testCborH.IndefiniteLength = oldIndefLen + + oldTimeRFC3339 := testCborH.TimeRFC3339 + testCborH.TimeRFC3339 = !testCborH.TimeRFC3339 + testReinit() + t.Run("cbor-rfc3339", testCborGroup) + testCborH.TimeRFC3339 = oldTimeRFC3339 + + oldSymbols := testBincH.AsSymbols + + testBincH.AsSymbols = 2 // AsSymbolNone + testReinit() + t.Run("binc-no-symbols", testBincGroup) + + testBincH.AsSymbols = 1 // AsSymbolAll + testReinit() + t.Run("binc-all-symbols", testBincGroup) + + testBincH.AsSymbols = oldSymbols + + oldWriteExt := testMsgpackH.WriteExt + oldNoFixedNum := testMsgpackH.NoFixedNum + + testMsgpackH.WriteExt = !testMsgpackH.WriteExt + testReinit() + t.Run("msgpack-inverse-writeext", testMsgpackGroup) + + testMsgpackH.WriteExt = oldWriteExt + + testMsgpackH.NoFixedNum = !testMsgpackH.NoFixedNum + testReinit() + t.Run("msgpack-fixednum", testMsgpackGroup) + + testMsgpackH.NoFixedNum = oldNoFixedNum + + oldEncZeroValuesAsNil := testSimpleH.EncZeroValuesAsNil + testSimpleH.EncZeroValuesAsNil = !testSimpleH.EncZeroValuesAsNil + testUseMust = true + testReinit() + t.Run("simple-enczeroasnil", testSimpleMammothGroup) // testSimpleGroup + testSimpleH.EncZeroValuesAsNil = oldEncZeroValuesAsNil + + oldRpcBufsize := testRpcBufsize + testRpcBufsize = 0 + t.Run("rpc-buf-0", testRpcGroup) + testRpcBufsize = 0 + t.Run("rpc-buf-00", testRpcGroup) + testRpcBufsize = 0 + t.Run("rpc-buf-000", testRpcGroup) + testRpcBufsize = 16 + t.Run("rpc-buf-16", testRpcGroup) + testRpcBufsize = 2048 + t.Run("rpc-buf-2048", testRpcGroup) + testRpcBufsize = oldRpcBufsize + + testGroupResetFlags() +} + +// func TestCodecSuite(t *testing.T) { +// testReinit() // so flag.Parse() is called first, and never called again +// testDecodeOptions, testEncodeOptions = DecodeOptions{}, EncodeOptions{} +// testGroupResetFlags() +// testReinit() +// t.Run("optionsFalse", func(t *testing.T) { +// t.Run("TestJsonMammothMapsAndSlices", TestJsonMammothMapsAndSlices) +// }) +// } diff --git a/vendor/github.com/v2pro/plz/.gitignore b/vendor/github.com/v2pro/plz/.gitignore new file mode 100644 index 000000000..a09c56df5 --- /dev/null +++ b/vendor/github.com/v2pro/plz/.gitignore @@ -0,0 +1 @@ +/.idea diff --git a/vendor/github.com/v2pro/plz/LICENSE b/vendor/github.com/v2pro/plz/LICENSE new file mode 100644 index 000000000..8dada3eda --- /dev/null +++ b/vendor/github.com/v2pro/plz/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/v2pro/plz/README.md b/vendor/github.com/v2pro/plz/README.md new file mode 100644 index 000000000..abd789e71 --- /dev/null +++ b/vendor/github.com/v2pro/plz/README.md @@ -0,0 +1,13 @@ +# plz + +PLZ has three parts + +* plz: observability, test helper, message format, utility +* plz.sql: use sql to query anything +* plz.service: junction for distributed computing + +Observability is the primary goal: + +* countlog: log event, record how state change over the time +* dump: take snapshot of data, record the moment +* witch: a WEB UI to make log and snapshot visible \ No newline at end of file diff --git a/vendor/github.com/v2pro/plz/closer.go b/vendor/github.com/v2pro/plz/closer.go new file mode 100644 index 000000000..3ab67c953 --- /dev/null +++ b/vendor/github.com/v2pro/plz/closer.go @@ -0,0 +1,71 @@ +package plz + +import ( + "fmt" + "github.com/v2pro/plz/countlog" + "io" + "runtime" +) + +type MultiError []error + +func (errs MultiError) Error() string { + return "multiple errors" +} + +func MergeErrors(errs ...error) error { + var nonNilErrs []error + for _, err := range errs { + if err != nil { + nonNilErrs = append(nonNilErrs, err) + } + } + if len(nonNilErrs) == 0 { + return nil + } + return MultiError(nonNilErrs) +} + +func Close(resource io.Closer, properties ...interface{}) error { + err := resource.Close() + if err != nil { + _, file, line, _ := runtime.Caller(1) + closedAt := fmt.Sprintf("%s:%d", file, line) + properties = append(properties, "err", err) + countlog.Error("event!close "+closedAt, properties...) + return err + } + return nil +} + +func CloseAll(resources []io.Closer, properties ...interface{}) error { + var errs []error + for _, resource := range resources { + err := resource.Close() + if err != nil { + _, file, line, _ := runtime.Caller(1) + closedAt := fmt.Sprintf("%s:%d", file, line) + properties = append(properties, "err", err) + countlog.Error("event!CloseAll called from "+closedAt, properties...) + errs = append(errs, err) + } + } + if len(errs) == 0 && len(properties) > 0 { + _, file, line, _ := runtime.Caller(1) + closedAt := fmt.Sprintf("%s:%d", file, line) + countlog.Debug("event!CloseAll called from "+closedAt, properties...) + } + return MergeErrors(errs...) +} + +type funcResource struct { + f func() error +} + +func (res funcResource) Close() error { + return res.f() +} + +func WrapCloser(f func() error) io.Closer { + return &funcResource{f} +} diff --git a/vendor/github.com/v2pro/plz/concurrent/executor.go b/vendor/github.com/v2pro/plz/concurrent/executor.go new file mode 100644 index 000000000..56e5d22bf --- /dev/null +++ b/vendor/github.com/v2pro/plz/concurrent/executor.go @@ -0,0 +1,7 @@ +package concurrent + +import "context" + +type Executor interface { + Go(handler func(ctx context.Context)) +} \ No newline at end of file diff --git a/vendor/github.com/v2pro/plz/concurrent/go_above_19.go b/vendor/github.com/v2pro/plz/concurrent/go_above_19.go new file mode 100644 index 000000000..a9f259347 --- /dev/null +++ b/vendor/github.com/v2pro/plz/concurrent/go_above_19.go @@ -0,0 +1,13 @@ +//+build go1.9 + +package concurrent + +import "sync" + +type Map struct { + sync.Map +} + +func NewMap() *Map { + return &Map{} +} \ No newline at end of file diff --git a/vendor/github.com/v2pro/plz/concurrent/go_below_19.go b/vendor/github.com/v2pro/plz/concurrent/go_below_19.go new file mode 100644 index 000000000..3f79f4fe4 --- /dev/null +++ b/vendor/github.com/v2pro/plz/concurrent/go_below_19.go @@ -0,0 +1,30 @@ +//+build !go1.9 + +package concurrent + +import "sync" + +type Map struct { + lock sync.RWMutex + data map[interface{}]interface{} +} + +func NewMap() *Map { + return &Map{ + data: make(map[interface{}]interface{}, 32), + } +} + +func (m *Map) Load(key interface{}) (elem interface{}, found bool) { + m.lock.RLock() + elem, found = m.data[key] + m.lock.RUnlock() + return +} + +func (m *Map) Store(key interface{}, elem interface{}) { + m.lock.Lock() + m.data[key] = elem + m.lock.Unlock() +} + diff --git a/vendor/github.com/v2pro/plz/concurrent/unbounded_executor.go b/vendor/github.com/v2pro/plz/concurrent/unbounded_executor.go new file mode 100644 index 000000000..70a1cf0f1 --- /dev/null +++ b/vendor/github.com/v2pro/plz/concurrent/unbounded_executor.go @@ -0,0 +1,99 @@ +package concurrent + +import ( + "context" + "fmt" + "runtime" + "sync" + "time" + "runtime/debug" +) + +var LogInfo = func(event string, properties ...interface{}) { +} + +var LogPanic = func(recovered interface{}, properties ...interface{}) interface{} { + fmt.Println(fmt.Sprintf("paniced: %v", recovered)) + debug.PrintStack() + return recovered +} + +const StopSignal = "STOP!" + +type UnboundedExecutor struct { + ctx context.Context + cancel context.CancelFunc + activeGoroutinesMutex *sync.Mutex + activeGoroutines map[string]int +} + +// GlobalUnboundedExecutor has the life cycle of the program itself +// any goroutine want to be shutdown before main exit can be started from this executor +var GlobalUnboundedExecutor = NewUnboundedExecutor() + +func NewUnboundedExecutor() *UnboundedExecutor { + ctx, cancel := context.WithCancel(context.TODO()) + return &UnboundedExecutor{ + ctx: ctx, + cancel: cancel, + activeGoroutinesMutex: &sync.Mutex{}, + activeGoroutines: map[string]int{}, + } +} + +func (executor *UnboundedExecutor) Go(handler func(ctx context.Context)) { + _, file, line, _ := runtime.Caller(1) + executor.activeGoroutinesMutex.Lock() + defer executor.activeGoroutinesMutex.Unlock() + startFrom := fmt.Sprintf("%s:%d", file, line) + executor.activeGoroutines[startFrom] += 1 + go func() { + defer func() { + recovered := recover() + if recovered != nil && recovered != StopSignal { + LogPanic(recovered) + } + executor.activeGoroutinesMutex.Lock() + defer executor.activeGoroutinesMutex.Unlock() + executor.activeGoroutines[startFrom] -= 1 + }() + handler(executor.ctx) + }() +} + +func (executor *UnboundedExecutor) Stop() { + executor.cancel() +} + +func (executor *UnboundedExecutor) StopAndWaitForever() { + executor.StopAndWait(context.Background()) +} + +func (executor *UnboundedExecutor) StopAndWait(ctx context.Context) { + executor.cancel() + for { + fiveSeconds := time.NewTimer(time.Millisecond * 100) + select { + case <-fiveSeconds.C: + case <-ctx.Done(): + return + } + if executor.checkGoroutines() { + return + } + } +} + +func (executor *UnboundedExecutor) checkGoroutines() bool { + executor.activeGoroutinesMutex.Lock() + defer executor.activeGoroutinesMutex.Unlock() + for startFrom, count := range executor.activeGoroutines { + if count > 0 { + LogInfo("event!unbounded_executor.still waiting goroutines to quit", + "startFrom", startFrom, + "count", count) + return false + } + } + return true +} diff --git a/vendor/github.com/v2pro/plz/reflect2/README.md b/vendor/github.com/v2pro/plz/reflect2/README.md new file mode 100644 index 000000000..61aebf0a1 --- /dev/null +++ b/vendor/github.com/v2pro/plz/reflect2/README.md @@ -0,0 +1,3 @@ +# Reflect2 + +unsafe reflect api \ No newline at end of file diff --git a/vendor/github.com/v2pro/plz/reflect2/go_above_17.go b/vendor/github.com/v2pro/plz/reflect2/go_above_17.go new file mode 100644 index 000000000..5c1cea868 --- /dev/null +++ b/vendor/github.com/v2pro/plz/reflect2/go_above_17.go @@ -0,0 +1,8 @@ +//+build go1.7 + +package reflect2 + +import "unsafe" + +//go:linkname resolveTypeOff reflect.resolveTypeOff +func resolveTypeOff(rtype unsafe.Pointer, off int32) unsafe.Pointer diff --git a/vendor/github.com/v2pro/plz/reflect2/go_above_19.go b/vendor/github.com/v2pro/plz/reflect2/go_above_19.go new file mode 100644 index 000000000..c7e3b7801 --- /dev/null +++ b/vendor/github.com/v2pro/plz/reflect2/go_above_19.go @@ -0,0 +1,14 @@ +//+build go1.9 + +package reflect2 + +import ( + "unsafe" +) + +//go:linkname makemap reflect.makemap +func makemap(rtype unsafe.Pointer, cap int) (m unsafe.Pointer) + +func makeMapWithSize(rtype unsafe.Pointer, cap int) unsafe.Pointer { + return makemap(rtype, cap) +} diff --git a/vendor/github.com/v2pro/plz/reflect2/go_below_17.go b/vendor/github.com/v2pro/plz/reflect2/go_below_17.go new file mode 100644 index 000000000..81142317a --- /dev/null +++ b/vendor/github.com/v2pro/plz/reflect2/go_below_17.go @@ -0,0 +1,9 @@ +//+build !go1.7 + +package reflect2 + +import "unsafe" + +func resolveTypeOff(rtype unsafe.Pointer, off int32) unsafe.Pointer { + return nil +} \ No newline at end of file diff --git a/vendor/github.com/v2pro/plz/reflect2/go_below_19.go b/vendor/github.com/v2pro/plz/reflect2/go_below_19.go new file mode 100644 index 000000000..b050ef70c --- /dev/null +++ b/vendor/github.com/v2pro/plz/reflect2/go_below_19.go @@ -0,0 +1,14 @@ +//+build !go1.9 + +package reflect2 + +import ( + "unsafe" +) + +//go:linkname makemap reflect.makemap +func makemap(rtype unsafe.Pointer) (m unsafe.Pointer) + +func makeMapWithSize(rtype unsafe.Pointer, cap int) unsafe.Pointer { + return makemap(rtype) +} diff --git a/vendor/github.com/v2pro/plz/reflect2/reflect2.go b/vendor/github.com/v2pro/plz/reflect2/reflect2.go new file mode 100644 index 000000000..7cf036554 --- /dev/null +++ b/vendor/github.com/v2pro/plz/reflect2/reflect2.go @@ -0,0 +1,282 @@ +package reflect2 + +import ( + "reflect" + "unsafe" + "github.com/v2pro/plz/concurrent" +) + +type Type interface { + Kind() reflect.Kind + // New return pointer to data of this type + New() interface{} + // UnsafeNew return the allocated space pointed by unsafe.Pointer + UnsafeNew() unsafe.Pointer + // PackEFace cast a unsafe pointer to object represented pointer + PackEFace(ptr unsafe.Pointer) interface{} + // Indirect dereference object represented pointer to this type + Indirect(obj interface{}) interface{} + // UnsafeIndirect dereference pointer to this type + UnsafeIndirect(ptr unsafe.Pointer) interface{} + // Type1 returns reflect.Type + Type1() reflect.Type + Implements(thatType Type) bool + String() string + RType() uintptr + // interface{} of this type has pointer like behavior + LikePtr() bool + IsNullable() bool + IsNil(obj interface{}) bool + UnsafeIsNil(ptr unsafe.Pointer) bool + Set(obj interface{}, val interface{}) + UnsafeSet(ptr unsafe.Pointer, val unsafe.Pointer) + AssignableTo(anotherType Type) bool +} + +type ListType interface { + Type + Elem() Type + SetIndex(obj interface{}, index int, elem interface{}) + UnsafeSetIndex(obj unsafe.Pointer, index int, elem unsafe.Pointer) + GetIndex(obj interface{}, index int) interface{} + UnsafeGetIndex(obj unsafe.Pointer, index int) unsafe.Pointer +} + +type ArrayType interface { + ListType + Len() int +} + +type SliceType interface { + ListType + MakeSlice(length int, cap int) interface{} + UnsafeMakeSlice(length int, cap int) unsafe.Pointer + Grow(obj interface{}, newLength int) + UnsafeGrow(ptr unsafe.Pointer, newLength int) + Append(obj interface{}, elem interface{}) + UnsafeAppend(obj unsafe.Pointer, elem unsafe.Pointer) + LengthOf(obj interface{}) int + UnsafeLengthOf(ptr unsafe.Pointer) int + SetNil(obj interface{}) + UnsafeSetNil(ptr unsafe.Pointer) + Cap(obj interface{}) int + UnsafeCap(ptr unsafe.Pointer) int +} + +type StructType interface { + Type + NumField() int + Field(i int) StructField + FieldByName(name string) StructField + FieldByIndex(index []int) StructField + FieldByNameFunc(match func(string) bool) StructField +} + +type StructField interface { + Offset() uintptr + Name() string + PkgPath() string + Type() Type + Tag() reflect.StructTag + Index() []int + Anonymous() bool + Set(obj interface{}, value interface{}) + UnsafeSet(obj unsafe.Pointer, value unsafe.Pointer) + Get(obj interface{}) interface{} + UnsafeGet(obj unsafe.Pointer) unsafe.Pointer +} + +type MapType interface { + Type + Key() Type + Elem() Type + MakeMap(cap int) interface{} + UnsafeMakeMap(cap int) unsafe.Pointer + SetIndex(obj interface{}, key interface{}, elem interface{}) + UnsafeSetIndex(obj unsafe.Pointer, key unsafe.Pointer, elem unsafe.Pointer) + TryGetIndex(obj interface{}, key interface{}) (interface{}, bool) + GetIndex(obj interface{}, key interface{}) interface{} + UnsafeGetIndex(obj unsafe.Pointer, key unsafe.Pointer) unsafe.Pointer + Iterate(obj interface{}) MapIterator + UnsafeIterate(obj unsafe.Pointer) MapIterator +} + +type MapIterator interface { + HasNext() bool + Next() (key interface{}, elem interface{}) + UnsafeNext() (key unsafe.Pointer, elem unsafe.Pointer) +} + +type PtrType interface { + Type + Elem() Type +} + +type InterfaceType interface { + NumMethod() int +} + +type Config struct { + UseSafeImplementation bool +} + +type API interface { + TypeOf(obj interface{}) Type + Type2(type1 reflect.Type) Type +} + +var ConfigUnsafe = Config{UseSafeImplementation: false}.Froze() +var ConfigSafe = Config{UseSafeImplementation: true}.Froze() + +type frozenConfig struct { + useSafeImplementation bool + cache *concurrent.Map +} + +func (cfg Config) Froze() *frozenConfig { + return &frozenConfig{ + useSafeImplementation: cfg.UseSafeImplementation, + cache: concurrent.NewMap(), + } +} + +func (cfg *frozenConfig) TypeOf(obj interface{}) Type { + cacheKey := uintptr(unpackEFace(obj).rtype) + typeObj, found := cfg.cache.Load(cacheKey) + if found { + return typeObj.(Type) + } + return cfg.Type2(reflect.TypeOf(obj)) +} + +func (cfg *frozenConfig) Type2(type1 reflect.Type) Type { + cacheKey := uintptr(unpackEFace(type1).data) + typeObj, found := cfg.cache.Load(cacheKey) + if found { + return typeObj.(Type) + } + type2 := cfg.wrapType(type1) + cfg.cache.Store(cacheKey, type2) + return type2 +} + +func (cfg *frozenConfig) wrapType(type1 reflect.Type) Type { + safeType := safeType{Type: type1, cfg: cfg} + switch type1.Kind() { + case reflect.Struct: + if cfg.useSafeImplementation { + return &safeStructType{safeType} + } + return newUnsafeStructType(cfg, type1) + case reflect.Array: + if cfg.useSafeImplementation { + return &safeSliceType{safeType} + } + return newUnsafeArrayType(cfg, type1) + case reflect.Slice: + if cfg.useSafeImplementation { + return &safeSliceType{safeType} + } + return newUnsafeSliceType(cfg, type1) + case reflect.Map: + if cfg.useSafeImplementation { + return &safeMapType{safeType} + } + return newUnsafeMapType(cfg, type1) + case reflect.Ptr, reflect.Chan, reflect.Func: + if cfg.useSafeImplementation { + return &safeMapType{safeType} + } + return newUnsafePtrType(cfg, type1) + case reflect.Interface: + if cfg.useSafeImplementation { + return &safeMapType{safeType} + } + if type1.NumMethod() == 0 { + return newUnsafeEFaceType(cfg, type1) + } + return newUnsafeIFaceType(cfg, type1) + default: + if cfg.useSafeImplementation { + return &safeType + } + return newUnsafeType(cfg, type1) + } +} + +func TypeOf(obj interface{}) Type { + return ConfigUnsafe.TypeOf(obj) +} + +func TypeOfPtr(obj interface{}) PtrType { + return TypeOf(obj).(PtrType) +} + +func Type2(type1 reflect.Type) Type { + return ConfigUnsafe.Type2(type1) +} + +func PtrTo(typ Type) Type { + return Type2(reflect.PtrTo(typ.Type1())) +} + +func PtrOf(obj interface{}) unsafe.Pointer { + return unpackEFace(obj).data +} + +func RTypeOf(obj interface{}) uintptr { + return uintptr(unpackEFace(obj).rtype) +} + +func IsNil(obj interface{}) bool { + if obj == nil { + return true + } + return unpackEFace(obj).data == nil +} + +func IsNullable(kind reflect.Kind) bool { + switch kind { + case reflect.Ptr, reflect.Map, reflect.Chan, reflect.Func, reflect.Slice, reflect.Interface: + return true + } + return false +} + +func likePtrKind(kind reflect.Kind) bool { + switch kind { + case reflect.Ptr, reflect.Map, reflect.Chan, reflect.Func: + return true + } + return false +} + +func likePtrType(typ reflect.Type) bool { + if likePtrKind(typ.Kind()) { + return true + } + if typ.Kind() == reflect.Struct { + if typ.NumField() != 1 { + return false + } + return likePtrType(typ.Field(0).Type) + } + if typ.Kind() == reflect.Array { + if typ.Len() != 1 { + return false + } + return likePtrType(typ.Elem()) + } + return false +} + +// NoEscape hides a pointer from escape analysis. noescape is +// the identity function but escape analysis doesn't think the +// output depends on the input. noescape is inlined and currently +// compiles down to zero instructions. +// USE CAREFULLY! +//go:nosplit +func NoEscape(p unsafe.Pointer) unsafe.Pointer { + x := uintptr(p) + return unsafe.Pointer(x ^ 0) +} \ No newline at end of file diff --git a/vendor/google.golang.org/grpc/.please-update b/vendor/github.com/v2pro/plz/reflect2/reflect2_amd64.s similarity index 100% rename from vendor/google.golang.org/grpc/.please-update rename to vendor/github.com/v2pro/plz/reflect2/reflect2_amd64.s diff --git a/vendor/github.com/v2pro/plz/reflect2/reflect2_kind.go b/vendor/github.com/v2pro/plz/reflect2/reflect2_kind.go new file mode 100644 index 000000000..f13cbe13d --- /dev/null +++ b/vendor/github.com/v2pro/plz/reflect2/reflect2_kind.go @@ -0,0 +1,30 @@ +package reflect2 + +import ( + "reflect" + "unsafe" +) + +// DefaultTypeOfKind return the non aliased default type for the kind +func DefaultTypeOfKind(kind reflect.Kind) Type { + return kindTypes[kind] +} + +var kindTypes = map[reflect.Kind]Type{ + reflect.Bool: TypeOf(true), + reflect.Uint8: TypeOf(uint8(0)), + reflect.Int8: TypeOf(int8(0)), + reflect.Uint16: TypeOf(uint16(0)), + reflect.Int16: TypeOf(int16(0)), + reflect.Uint32: TypeOf(uint32(0)), + reflect.Int32: TypeOf(int32(0)), + reflect.Uint64: TypeOf(uint64(0)), + reflect.Int64: TypeOf(int64(0)), + reflect.Uint: TypeOf(uint(0)), + reflect.Int: TypeOf(int(0)), + reflect.Float32: TypeOf(float32(0)), + reflect.Float64: TypeOf(float64(0)), + reflect.Uintptr: TypeOf(uintptr(0)), + reflect.String: TypeOf(""), + reflect.UnsafePointer: TypeOf(unsafe.Pointer(nil)), +} \ No newline at end of file diff --git a/vendor/github.com/v2pro/plz/reflect2/relfect2_386.s b/vendor/github.com/v2pro/plz/reflect2/relfect2_386.s new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/v2pro/plz/reflect2/relfect2_amd64p32.s b/vendor/github.com/v2pro/plz/reflect2/relfect2_amd64p32.s new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/v2pro/plz/reflect2/relfect2_arm.s b/vendor/github.com/v2pro/plz/reflect2/relfect2_arm.s new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/v2pro/plz/reflect2/relfect2_arm64.s b/vendor/github.com/v2pro/plz/reflect2/relfect2_arm64.s new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/v2pro/plz/reflect2/relfect2_mips64x.s b/vendor/github.com/v2pro/plz/reflect2/relfect2_mips64x.s new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/v2pro/plz/reflect2/relfect2_mipsx.s b/vendor/github.com/v2pro/plz/reflect2/relfect2_mipsx.s new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/v2pro/plz/reflect2/relfect2_ppc64x.s b/vendor/github.com/v2pro/plz/reflect2/relfect2_ppc64x.s new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/v2pro/plz/reflect2/relfect2_s390x.s b/vendor/github.com/v2pro/plz/reflect2/relfect2_s390x.s new file mode 100644 index 000000000..e69de29bb diff --git a/vendor/github.com/v2pro/plz/reflect2/safe_field.go b/vendor/github.com/v2pro/plz/reflect2/safe_field.go new file mode 100644 index 000000000..f68de456a --- /dev/null +++ b/vendor/github.com/v2pro/plz/reflect2/safe_field.go @@ -0,0 +1,58 @@ +package reflect2 + +import ( + "reflect" + "unsafe" +) + +type safeField struct { + reflect.StructField +} + +func (field *safeField) Offset() uintptr { + return field.StructField.Offset +} + +func (field *safeField) Name() string { + return field.StructField.Name +} + +func (field *safeField) PkgPath() string { + return field.StructField.PkgPath +} + +func (field *safeField) Type() Type { + panic("not implemented") +} + +func (field *safeField) Tag() reflect.StructTag { + return field.StructField.Tag +} + +func (field *safeField) Index() []int { + return field.StructField.Index +} + +func (field *safeField) Anonymous() bool { + return field.StructField.Anonymous +} + +func (field *safeField) Set(obj interface{}, value interface{}) { + val := reflect.ValueOf(obj).Elem() + val.FieldByIndex(field.Index()).Set(reflect.ValueOf(value).Elem()) +} + +func (field *safeField) UnsafeSet(obj unsafe.Pointer, value unsafe.Pointer) { + panic("unsafe operation is not supported") +} + +func (field *safeField) Get(obj interface{}) interface{} { + val := reflect.ValueOf(obj).Elem().FieldByIndex(field.Index()) + ptr := reflect.New(val.Type()) + ptr.Elem().Set(val) + return ptr.Interface() +} + +func (field *safeField) UnsafeGet(obj unsafe.Pointer) unsafe.Pointer { + panic("does not support unsafe operation") +} \ No newline at end of file diff --git a/vendor/github.com/v2pro/plz/reflect2/safe_map.go b/vendor/github.com/v2pro/plz/reflect2/safe_map.go new file mode 100644 index 000000000..6a1ba23d5 --- /dev/null +++ b/vendor/github.com/v2pro/plz/reflect2/safe_map.go @@ -0,0 +1,101 @@ +package reflect2 + +import ( + "reflect" + "unsafe" +) + +type safeMapType struct { + safeType +} + +func (type2 *safeMapType) Key() Type { + return type2.safeType.cfg.Type2(type2.Type.Key()) +} + +func (type2 *safeMapType) MakeMap(cap int) interface{} { + ptr := reflect.New(type2.Type) + ptr.Elem().Set(reflect.MakeMap(type2.Type)) + return ptr.Interface() +} + +func (type2 *safeMapType) UnsafeMakeMap(cap int) unsafe.Pointer { + panic("does not support unsafe operation") +} + +func (type2 *safeMapType) SetIndex(obj interface{}, key interface{}, elem interface{}) { + keyVal := reflect.ValueOf(key) + elemVal := reflect.ValueOf(elem) + val := reflect.ValueOf(obj) + val.Elem().SetMapIndex(keyVal.Elem(), elemVal.Elem()) +} + +func (type2 *safeMapType) UnsafeSetIndex(obj unsafe.Pointer, key unsafe.Pointer, elem unsafe.Pointer) { + panic("does not support unsafe operation") +} + +func (type2 *safeMapType) TryGetIndex(obj interface{}, key interface{}) (interface{}, bool) { + keyVal := reflect.ValueOf(key) + if key == nil { + keyVal = reflect.New(type2.Type.Key()).Elem() + } + val := reflect.ValueOf(obj).MapIndex(keyVal) + if !val.IsValid() { + return nil, false + } + return val.Interface(), true +} + +func (type2 *safeMapType) GetIndex(obj interface{}, key interface{}) interface{} { + val := reflect.ValueOf(obj).Elem() + keyVal := reflect.ValueOf(key).Elem() + elemVal := val.MapIndex(keyVal) + if !elemVal.IsValid() { + ptr := reflect.New(reflect.PtrTo(val.Type().Elem())) + return ptr.Elem().Interface() + } + ptr := reflect.New(elemVal.Type()) + ptr.Elem().Set(elemVal) + return ptr.Interface() +} + +func (type2 *safeMapType) UnsafeGetIndex(obj unsafe.Pointer, key unsafe.Pointer) unsafe.Pointer { + panic("does not support unsafe operation") +} + +func (type2 *safeMapType) Iterate(obj interface{}) MapIterator { + m := reflect.ValueOf(obj).Elem() + return &safeMapIterator{ + m: m, + keys: m.MapKeys(), + } +} + +func (type2 *safeMapType) UnsafeIterate(obj unsafe.Pointer) MapIterator { + panic("does not support unsafe operation") +} + +type safeMapIterator struct { + i int + m reflect.Value + keys []reflect.Value +} + +func (iter *safeMapIterator) HasNext() bool { + return iter.i != len(iter.keys) +} + +func (iter *safeMapIterator) Next() (interface{}, interface{}) { + key := iter.keys[iter.i] + elem := iter.m.MapIndex(key) + iter.i += 1 + keyPtr := reflect.New(key.Type()) + keyPtr.Elem().Set(key) + elemPtr := reflect.New(elem.Type()) + elemPtr.Elem().Set(elem) + return keyPtr.Interface(), elemPtr.Interface() +} + +func (iter *safeMapIterator) UnsafeNext() (unsafe.Pointer, unsafe.Pointer) { + panic("does not support unsafe operation") +} \ No newline at end of file diff --git a/vendor/github.com/v2pro/plz/reflect2/safe_slice.go b/vendor/github.com/v2pro/plz/reflect2/safe_slice.go new file mode 100644 index 000000000..7e348c1ac --- /dev/null +++ b/vendor/github.com/v2pro/plz/reflect2/safe_slice.go @@ -0,0 +1,92 @@ +package reflect2 + +import ( + "reflect" + "unsafe" +) + +type safeSliceType struct { + safeType +} + +func (type2 *safeSliceType) SetIndex(obj interface{}, index int, value interface{}) { + val := reflect.ValueOf(obj).Elem() + elem := reflect.ValueOf(value).Elem() + val.Index(index).Set(elem) +} + +func (type2 *safeSliceType) UnsafeSetIndex(obj unsafe.Pointer, index int, value unsafe.Pointer) { + panic("does not support unsafe operation") +} + +func (type2 *safeSliceType) GetIndex(obj interface{}, index int) interface{} { + val := reflect.ValueOf(obj).Elem() + elem := val.Index(index) + ptr := reflect.New(elem.Type()) + ptr.Elem().Set(elem) + return ptr.Interface() +} + +func (type2 *safeSliceType) UnsafeGetIndex(obj unsafe.Pointer, index int) unsafe.Pointer { + panic("does not support unsafe operation") +} + +func (type2 *safeSliceType) MakeSlice(length int, cap int) interface{} { + val := reflect.MakeSlice(type2.Type, length, cap) + ptr := reflect.New(val.Type()) + ptr.Elem().Set(val) + return ptr.Interface() +} + +func (type2 *safeSliceType) UnsafeMakeSlice(length int, cap int) unsafe.Pointer { + panic("does not support unsafe operation") +} + +func (type2 *safeSliceType) Grow(obj interface{}, newLength int) { + oldCap := type2.Cap(obj) + oldSlice := reflect.ValueOf(obj).Elem() + delta := newLength - oldCap + deltaVals := make([]reflect.Value, delta) + newSlice := reflect.Append(oldSlice, deltaVals...) + oldSlice.Set(newSlice) +} + +func (type2 *safeSliceType) UnsafeGrow(ptr unsafe.Pointer, newLength int) { + panic("does not support unsafe operation") +} + +func (type2 *safeSliceType) Append(obj interface{}, elem interface{}) { + val := reflect.ValueOf(obj).Elem() + elemVal := reflect.ValueOf(elem).Elem() + newVal := reflect.Append(val, elemVal) + val.Set(newVal) +} + +func (type2 *safeSliceType) UnsafeAppend(obj unsafe.Pointer, elem unsafe.Pointer) { + panic("does not support unsafe operation") +} + +func (type2 *safeSliceType) SetNil(obj interface{}) { + val := reflect.ValueOf(obj).Elem() + val.Set(reflect.Zero(val.Type())) +} + +func (type2 *safeSliceType) UnsafeSetNil(ptr unsafe.Pointer) { + panic("does not support unsafe operation") +} + +func (type2 *safeSliceType) LengthOf(obj interface{}) int { + return reflect.ValueOf(obj).Elem().Len() +} + +func (type2 *safeSliceType) UnsafeLengthOf(ptr unsafe.Pointer) int { + panic("does not support unsafe operation") +} + +func (type2 *safeSliceType) Cap(obj interface{}) int { + return reflect.ValueOf(obj).Elem().Cap() +} + +func (type2 *safeSliceType) UnsafeCap(ptr unsafe.Pointer) int { + panic("does not support unsafe operation") +} \ No newline at end of file diff --git a/vendor/github.com/v2pro/plz/reflect2/safe_struct.go b/vendor/github.com/v2pro/plz/reflect2/safe_struct.go new file mode 100644 index 000000000..d8eb45348 --- /dev/null +++ b/vendor/github.com/v2pro/plz/reflect2/safe_struct.go @@ -0,0 +1,13 @@ +package reflect2 + +type safeStructType struct { + safeType +} + +func (type2 *safeStructType) FieldByName(name string) StructField { + field, found := type2.Type.FieldByName(name) + if !found { + panic("field " + name + " not found") + } + return &safeField{StructField: field} +} \ No newline at end of file diff --git a/vendor/github.com/v2pro/plz/reflect2/safe_type.go b/vendor/github.com/v2pro/plz/reflect2/safe_type.go new file mode 100644 index 000000000..3cd6331ae --- /dev/null +++ b/vendor/github.com/v2pro/plz/reflect2/safe_type.go @@ -0,0 +1,78 @@ +package reflect2 + +import ( + "reflect" + "unsafe" +) + +type safeType struct { + reflect.Type + cfg *frozenConfig +} + +func (type2 *safeType) New() interface{} { + return reflect.New(type2.Type).Interface() +} + +func (type2 *safeType) UnsafeNew() unsafe.Pointer { + panic("does not support unsafe operation") +} + +func (type2 *safeType) Elem() Type { + return type2.cfg.Type2(type2.Type.Elem()) +} + +func (type2 *safeType) Type1() reflect.Type { + return type2.Type +} + +func (type2 *safeType) PackEFace(ptr unsafe.Pointer) interface{} { + panic("does not support unsafe operation") +} + +func (type2 *safeType) Implements(thatType Type) bool { + return type2.Type.Implements(thatType.Type1()) +} + +func (type2 *safeType) RType() uintptr { + panic("does not support unsafe operation") +} + +func (type2 *safeType) Indirect(obj interface{}) interface{} { + return reflect.Indirect(reflect.ValueOf(obj)).Interface() +} + +func (type2 *safeType) UnsafeIndirect(ptr unsafe.Pointer) interface{} { + panic("does not support unsafe operation") +} + +func (type2 *safeType) LikePtr() bool { + panic("does not support unsafe operation") +} + +func (type2 *safeType) IsNullable() bool { + return IsNullable(type2.Kind()) +} + +func (type2 *safeType) IsNil(obj interface{}) bool { + if obj == nil { + return true + } + return reflect.ValueOf(obj).Elem().IsNil() +} + +func (type2 *safeType) UnsafeIsNil(ptr unsafe.Pointer) bool { + panic("does not support unsafe operation") +} + +func (type2 *safeType) Set(obj interface{}, val interface{}) { + reflect.ValueOf(obj).Elem().Set(reflect.ValueOf(val).Elem()) +} + +func (type2 *safeType) UnsafeSet(ptr unsafe.Pointer, val unsafe.Pointer) { + panic("does not support unsafe operation") +} + +func (type2 *safeType) AssignableTo(anotherType Type) bool { + return type2.Type1().AssignableTo(anotherType.Type1()) +} \ No newline at end of file diff --git a/vendor/github.com/v2pro/plz/reflect2/type_map.go b/vendor/github.com/v2pro/plz/reflect2/type_map.go new file mode 100644 index 000000000..122141f81 --- /dev/null +++ b/vendor/github.com/v2pro/plz/reflect2/type_map.go @@ -0,0 +1,72 @@ +package reflect2 + +import ( + "unsafe" + "reflect" + "runtime" + "strings" +) + +// typelinks1 for 1.5 ~ 1.6 +//go:linkname typelinks1 reflect.typelinks +func typelinks1() [][]unsafe.Pointer + +// typelinks2 for 1.7 ~ +//go:linkname typelinks2 reflect.typelinks +func typelinks2() (sections []unsafe.Pointer, offset [][]int32) + +var types = map[string]reflect.Type{} + +func init() { + ver := runtime.Version() + if ver == "go1.5" || strings.HasPrefix(ver, "go1.5.") { + loadGo15Types() + } else if ver == "go1.6" || strings.HasPrefix(ver, "go1.6.") { + loadGo15Types() + } else { + loadGo17Types() + } +} + +func loadGo15Types() { + var obj interface{} = reflect.TypeOf(0) + typePtrss := typelinks1() + for _, typePtrs := range typePtrss { + for _, typePtr := range typePtrs { + (*emptyInterface)(unsafe.Pointer(&obj)).word = typePtr + typ := obj.(reflect.Type) + if typ.Kind() == reflect.Ptr && typ.Elem().Kind() == reflect.Struct { + types[typ.Elem().String()] = typ.Elem() + } + if typ.Kind() == reflect.Slice && typ.Elem().Kind() == reflect.Ptr && + typ.Elem().Elem().Kind() == reflect.Struct { + types[typ.Elem().Elem().String()] = typ.Elem().Elem() + } + } + } +} + +func loadGo17Types() { + var obj interface{} = reflect.TypeOf(0) + sections, offset := typelinks2() + for i, offs := range offset { + rodata := sections[i] + for _, off := range offs { + (*emptyInterface)(unsafe.Pointer(&obj)).word = resolveTypeOff(unsafe.Pointer(rodata), off) + typ := obj.(reflect.Type) + if typ.Kind() == reflect.Ptr && typ.Elem().Kind() == reflect.Struct { + types[typ.Elem().String()] = typ.Elem() + } + } + } +} + +type emptyInterface struct { + typ unsafe.Pointer + word unsafe.Pointer +} + +// TypeByName return the type by its name, just like Class.forName in java +func TypeByName(typeName string) Type { + return Type2(types[typeName]) +} diff --git a/vendor/github.com/v2pro/plz/reflect2/unsafe_array.go b/vendor/github.com/v2pro/plz/reflect2/unsafe_array.go new file mode 100644 index 000000000..924b0262b --- /dev/null +++ b/vendor/github.com/v2pro/plz/reflect2/unsafe_array.go @@ -0,0 +1,65 @@ +package reflect2 + +import ( + "unsafe" + "reflect" +) + +type UnsafeArrayType struct { + unsafeType + elemRType unsafe.Pointer + pElemRType unsafe.Pointer + elemSize uintptr + likePtr bool +} + +func newUnsafeArrayType(cfg *frozenConfig, type1 reflect.Type) *UnsafeArrayType { + return &UnsafeArrayType{ + unsafeType: *newUnsafeType(cfg, type1), + elemRType: unpackEFace(type1.Elem()).data, + pElemRType: unpackEFace(reflect.PtrTo(type1.Elem())).data, + elemSize: type1.Elem().Size(), + likePtr: likePtrType(type1), + } +} + +func (type2 *UnsafeArrayType) LikePtr() bool { + return type2.likePtr +} + +func (type2 *UnsafeArrayType) Indirect(obj interface{}) interface{} { + objEFace := unpackEFace(obj) + assertType("Type.Indirect argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIndirect(objEFace.data) +} + +func (type2 *UnsafeArrayType) UnsafeIndirect(ptr unsafe.Pointer) interface{} { + if type2.likePtr { + return packEFace(type2.rtype, *(*unsafe.Pointer)(ptr)) + } + return packEFace(type2.rtype, ptr) +} + +func (type2 *UnsafeArrayType) SetIndex(obj interface{}, index int, elem interface{}) { + objEFace := unpackEFace(obj) + assertType("ArrayType.SetIndex argument 1", type2.ptrRType, objEFace.rtype) + elemEFace := unpackEFace(elem) + assertType("ArrayType.SetIndex argument 3", type2.pElemRType, elemEFace.rtype) + type2.UnsafeSetIndex(objEFace.data, index, elemEFace.data) +} + +func (type2 *UnsafeArrayType) UnsafeSetIndex(obj unsafe.Pointer, index int, elem unsafe.Pointer) { + elemPtr := arrayAt(obj, index, type2.elemSize, "i < s.Len") + typedmemmove(type2.elemRType, elemPtr, elem) +} + +func (type2 *UnsafeArrayType) GetIndex(obj interface{}, index int) interface{} { + objEFace := unpackEFace(obj) + assertType("ArrayType.GetIndex argument 1", type2.ptrRType, objEFace.rtype) + elemPtr := type2.UnsafeGetIndex(objEFace.data, index) + return packEFace(type2.pElemRType, elemPtr) +} + +func (type2 *UnsafeArrayType) UnsafeGetIndex(obj unsafe.Pointer, index int) unsafe.Pointer { + return arrayAt(obj, index, type2.elemSize, "i < s.Len") +} diff --git a/vendor/github.com/v2pro/plz/reflect2/unsafe_eface.go b/vendor/github.com/v2pro/plz/reflect2/unsafe_eface.go new file mode 100644 index 000000000..446f4206c --- /dev/null +++ b/vendor/github.com/v2pro/plz/reflect2/unsafe_eface.go @@ -0,0 +1,59 @@ +package reflect2 + +import ( + "unsafe" + "reflect" +) + +type eface struct { + rtype unsafe.Pointer + data unsafe.Pointer +} + +func unpackEFace(obj interface{}) *eface { + return (*eface)(unsafe.Pointer(&obj)) +} + +func packEFace(rtype unsafe.Pointer, data unsafe.Pointer) interface{} { + var i interface{} + e := (*eface)(unsafe.Pointer(&i)) + e.rtype = rtype + e.data = data + return i +} + +type UnsafeEFaceType struct { + unsafeType +} + +func newUnsafeEFaceType(cfg *frozenConfig, type1 reflect.Type) *UnsafeEFaceType { + return &UnsafeEFaceType{ + unsafeType: *newUnsafeType(cfg, type1), + } +} + +func (type2 *UnsafeEFaceType) IsNil(obj interface{}) bool { + if obj == nil { + return true + } + objEFace := unpackEFace(obj) + assertType("Type.IsNil argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIsNil(objEFace.data) +} + +func (type2 *UnsafeEFaceType) UnsafeIsNil(ptr unsafe.Pointer) bool { + if ptr == nil { + return true + } + return unpackEFace(*(*interface{})(ptr)).data == nil +} + +func (type2 *UnsafeEFaceType) Indirect(obj interface{}) interface{} { + objEFace := unpackEFace(obj) + assertType("Type.Indirect argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIndirect(objEFace.data) +} + +func (type2 *UnsafeEFaceType) UnsafeIndirect(ptr unsafe.Pointer) interface{} { + return *(*interface{})(ptr) +} \ No newline at end of file diff --git a/vendor/github.com/v2pro/plz/reflect2/unsafe_field.go b/vendor/github.com/v2pro/plz/reflect2/unsafe_field.go new file mode 100644 index 000000000..5eb53130a --- /dev/null +++ b/vendor/github.com/v2pro/plz/reflect2/unsafe_field.go @@ -0,0 +1,74 @@ +package reflect2 + +import ( + "reflect" + "unsafe" +) + +type UnsafeStructField struct { + reflect.StructField + structType *UnsafeStructType + rtype unsafe.Pointer + ptrRType unsafe.Pointer +} + +func newUnsafeStructField(structType *UnsafeStructType, structField reflect.StructField) *UnsafeStructField { + return &UnsafeStructField{ + StructField: structField, + rtype: unpackEFace(structField.Type).data, + ptrRType: unpackEFace(reflect.PtrTo(structField.Type)).data, + structType: structType, + } +} + +func (field *UnsafeStructField) Offset() uintptr { + return field.StructField.Offset +} + +func (field *UnsafeStructField) Name() string { + return field.StructField.Name +} + +func (field *UnsafeStructField) PkgPath() string { + return field.StructField.PkgPath +} + +func (field *UnsafeStructField) Type() Type { + return field.structType.cfg.Type2(field.StructField.Type) +} + +func (field *UnsafeStructField) Tag() reflect.StructTag { + return field.StructField.Tag +} + +func (field *UnsafeStructField) Index() []int { + return field.StructField.Index +} + +func (field *UnsafeStructField) Anonymous() bool { + return field.StructField.Anonymous +} + +func (field *UnsafeStructField) Set(obj interface{}, value interface{}) { + objEFace := unpackEFace(obj) + assertType("StructField.SetIndex argument 1", field.structType.ptrRType, objEFace.rtype) + valueEFace := unpackEFace(value) + assertType("StructField.SetIndex argument 2", field.ptrRType, valueEFace.rtype) + field.UnsafeSet(objEFace.data, valueEFace.data) +} + +func (field *UnsafeStructField) UnsafeSet(obj unsafe.Pointer, value unsafe.Pointer) { + fieldPtr := add(obj, field.StructField.Offset, "same as non-reflect &v.field") + typedmemmove(field.rtype, fieldPtr, value) +} + +func (field *UnsafeStructField) Get(obj interface{}) interface{} { + objEFace := unpackEFace(obj) + assertType("StructField.GetIndex argument 1", field.structType.ptrRType, objEFace.rtype) + value := field.UnsafeGet(objEFace.data) + return packEFace(field.ptrRType, value) +} + +func (field *UnsafeStructField) UnsafeGet(obj unsafe.Pointer) unsafe.Pointer { + return add(obj, field.StructField.Offset, "same as non-reflect &v.field") +} diff --git a/vendor/github.com/v2pro/plz/reflect2/unsafe_iface.go b/vendor/github.com/v2pro/plz/reflect2/unsafe_iface.go new file mode 100644 index 000000000..8f451ca36 --- /dev/null +++ b/vendor/github.com/v2pro/plz/reflect2/unsafe_iface.go @@ -0,0 +1,64 @@ +package reflect2 + +import ( + "unsafe" + "reflect" +) + +type iface struct { + itab *itab + data unsafe.Pointer +} + +type itab struct { + ignore unsafe.Pointer + rtype unsafe.Pointer +} + +func IFaceToEFace(ptr unsafe.Pointer) interface{} { + iface := (*iface)(ptr) + if iface.itab == nil { + return nil + } + return packEFace(iface.itab.rtype, iface.data) +} + +type UnsafeIFaceType struct { + unsafeType +} + +func newUnsafeIFaceType(cfg *frozenConfig, type1 reflect.Type) *UnsafeIFaceType { + return &UnsafeIFaceType{ + unsafeType: *newUnsafeType(cfg, type1), + } +} + +func (type2 *UnsafeIFaceType) Indirect(obj interface{}) interface{} { + objEFace := unpackEFace(obj) + assertType("Type.Indirect argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIndirect(objEFace.data) +} + +func (type2 *UnsafeIFaceType) UnsafeIndirect(ptr unsafe.Pointer) interface{} { + return IFaceToEFace(ptr) +} + +func (type2 *UnsafeIFaceType) IsNil(obj interface{}) bool { + if obj == nil { + return true + } + objEFace := unpackEFace(obj) + assertType("Type.IsNil argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIsNil(objEFace.data) +} + +func (type2 *UnsafeIFaceType) UnsafeIsNil(ptr unsafe.Pointer) bool { + if ptr == nil { + return true + } + iface := (*iface)(ptr) + if iface.itab == nil { + return true + } + return false +} \ No newline at end of file diff --git a/vendor/github.com/v2pro/plz/reflect2/unsafe_link.go b/vendor/github.com/v2pro/plz/reflect2/unsafe_link.go new file mode 100644 index 000000000..a25a5f4d0 --- /dev/null +++ b/vendor/github.com/v2pro/plz/reflect2/unsafe_link.go @@ -0,0 +1,70 @@ +package reflect2 + +import "unsafe" + +//go:linkname unsafe_New reflect.unsafe_New +func unsafe_New(rtype unsafe.Pointer) unsafe.Pointer + +//go:linkname typedmemmove reflect.typedmemmove +func typedmemmove(rtype unsafe.Pointer, dst, src unsafe.Pointer) + +//go:linkname unsafe_NewArray reflect.unsafe_NewArray +func unsafe_NewArray(rtype unsafe.Pointer, length int) unsafe.Pointer + +// typedslicecopy copies a slice of elemType values from src to dst, +// returning the number of elements copied. +//go:linkname typedslicecopy reflect.typedslicecopy +//go:noescape +func typedslicecopy(elemType unsafe.Pointer, dst, src sliceHeader) int + +//go:linkname mapassign reflect.mapassign +//go:noescape +func mapassign(rtype unsafe.Pointer, m unsafe.Pointer, key, val unsafe.Pointer) + +//go:linkname mapaccess reflect.mapaccess +//go:noescape +func mapaccess(rtype unsafe.Pointer, m unsafe.Pointer, key unsafe.Pointer) (val unsafe.Pointer) + +// m escapes into the return value, but the caller of mapiterinit +// doesn't let the return value escape. +//go:noescape +//go:linkname mapiterinit reflect.mapiterinit +func mapiterinit(rtype unsafe.Pointer, m unsafe.Pointer) *hiter + +//go:noescape +//go:linkname mapiternext reflect.mapiternext +func mapiternext(it *hiter) + +//go:linkname ifaceE2I reflect.ifaceE2I +func ifaceE2I(rtype unsafe.Pointer, src interface{}, dst unsafe.Pointer) + +// A hash iteration structure. +// If you modify hiter, also change cmd/internal/gc/reflect.go to indicate +// the layout of this structure. +type hiter struct { + key unsafe.Pointer // Must be in first position. Write nil to indicate iteration end (see cmd/internal/gc/range.go). + value unsafe.Pointer // Must be in second position (see cmd/internal/gc/range.go). + // rest fields are ignored +} + +// add returns p+x. +// +// The whySafe string is ignored, so that the function still inlines +// as efficiently as p+x, but all call sites should use the string to +// record why the addition is safe, which is to say why the addition +// does not cause x to advance to the very end of p's allocation +// and therefore point incorrectly at the next block in memory. +func add(p unsafe.Pointer, x uintptr, whySafe string) unsafe.Pointer { + return unsafe.Pointer(uintptr(p) + x) +} + +// arrayAt returns the i-th element of p, +// an array whose elements are eltSize bytes wide. +// The array pointed at by p must have at least i+1 elements: +// it is invalid (but impossible to check here) to pass i >= len, +// because then the result will point outside the array. +// whySafe must explain why i < len. (Passing "i < len" is fine; +// the benefit is to surface this assumption at the call site.) +func arrayAt(p unsafe.Pointer, i int, eltSize uintptr, whySafe string) unsafe.Pointer { + return add(p, uintptr(i)*eltSize, "i < len") +} \ No newline at end of file diff --git a/vendor/github.com/v2pro/plz/reflect2/unsafe_map.go b/vendor/github.com/v2pro/plz/reflect2/unsafe_map.go new file mode 100644 index 000000000..f2e76e6bb --- /dev/null +++ b/vendor/github.com/v2pro/plz/reflect2/unsafe_map.go @@ -0,0 +1,138 @@ +package reflect2 + +import ( + "reflect" + "unsafe" +) + +type UnsafeMapType struct { + unsafeType + pKeyRType unsafe.Pointer + pElemRType unsafe.Pointer +} + +func newUnsafeMapType(cfg *frozenConfig, type1 reflect.Type) MapType { + return &UnsafeMapType{ + unsafeType: *newUnsafeType(cfg, type1), + pKeyRType: unpackEFace(reflect.PtrTo(type1.Key())).data, + pElemRType: unpackEFace(reflect.PtrTo(type1.Elem())).data, + } +} + +func (type2 *UnsafeMapType) IsNil(obj interface{}) bool { + if obj == nil { + return true + } + objEFace := unpackEFace(obj) + assertType("Type.IsNil argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIsNil(objEFace.data) +} + +func (type2 *UnsafeMapType) UnsafeIsNil(ptr unsafe.Pointer) bool { + if ptr == nil { + return true + } + return *(*unsafe.Pointer)(ptr) == nil +} + +func (type2 *UnsafeMapType) LikePtr() bool { + return true +} + +func (type2 *UnsafeMapType) Indirect(obj interface{}) interface{} { + objEFace := unpackEFace(obj) + assertType("MapType.Indirect argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIndirect(objEFace.data) +} + +func (type2 *UnsafeMapType) UnsafeIndirect(ptr unsafe.Pointer) interface{} { + return packEFace(type2.rtype, *(*unsafe.Pointer)(ptr)) +} + +func (type2 *UnsafeMapType) Key() Type { + return type2.cfg.Type2(type2.Type.Key()) +} + +func (type2 *UnsafeMapType) MakeMap(cap int) interface{} { + return packEFace(type2.ptrRType, type2.UnsafeMakeMap(cap)) +} + +func (type2 *UnsafeMapType) UnsafeMakeMap(cap int) unsafe.Pointer { + m := makeMapWithSize(type2.rtype, cap) + return unsafe.Pointer(&m) +} + +func (type2 *UnsafeMapType) SetIndex(obj interface{}, key interface{}, elem interface{}) { + objEFace := unpackEFace(obj) + assertType("MapType.SetIndex argument 1", type2.ptrRType, objEFace.rtype) + keyEFace := unpackEFace(key) + assertType("MapType.SetIndex argument 2", type2.pKeyRType, keyEFace.rtype) + elemEFace := unpackEFace(elem) + assertType("MapType.SetIndex argument 3", type2.pElemRType, elemEFace.rtype) + type2.UnsafeSetIndex(objEFace.data, keyEFace.data, elemEFace.data) +} + +func (type2 *UnsafeMapType) UnsafeSetIndex(obj unsafe.Pointer, key unsafe.Pointer, elem unsafe.Pointer) { + mapassign(type2.rtype, *(*unsafe.Pointer)(obj), key, elem) +} + +func (type2 *UnsafeMapType) TryGetIndex(obj interface{}, key interface{}) (interface{}, bool) { + objEFace := unpackEFace(obj) + assertType("MapType.TryGetIndex argument 1", type2.ptrRType, objEFace.rtype) + keyEFace := unpackEFace(key) + assertType("MapType.TryGetIndex argument 2", type2.pKeyRType, keyEFace.rtype) + elemPtr := type2.UnsafeGetIndex(objEFace.data, keyEFace.data) + if elemPtr == nil { + return nil, false + } + return packEFace(type2.pElemRType, elemPtr), true +} + +func (type2 *UnsafeMapType) GetIndex(obj interface{}, key interface{}) interface{} { + objEFace := unpackEFace(obj) + assertType("MapType.GetIndex argument 1", type2.ptrRType, objEFace.rtype) + keyEFace := unpackEFace(key) + assertType("MapType.GetIndex argument 2", type2.pKeyRType, keyEFace.rtype) + elemPtr := type2.UnsafeGetIndex(objEFace.data, keyEFace.data) + return packEFace(type2.pElemRType, elemPtr) +} + +func (type2 *UnsafeMapType) UnsafeGetIndex(obj unsafe.Pointer, key unsafe.Pointer) unsafe.Pointer { + return mapaccess(type2.rtype, *(*unsafe.Pointer)(obj), key) +} + +func (type2 *UnsafeMapType) Iterate(obj interface{}) MapIterator { + objEFace := unpackEFace(obj) + assertType("MapType.Iterate argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIterate(objEFace.data) +} + +func (type2 *UnsafeMapType) UnsafeIterate(obj unsafe.Pointer) MapIterator { + return &UnsafeMapIterator{ + hiter: mapiterinit(type2.rtype, *(*unsafe.Pointer)(obj)), + pKeyRType: type2.pKeyRType, + pElemRType: type2.pElemRType, + } +} + +type UnsafeMapIterator struct { + *hiter + pKeyRType unsafe.Pointer + pElemRType unsafe.Pointer +} + +func (iter *UnsafeMapIterator) HasNext() bool { + return iter.key != nil +} + +func (iter *UnsafeMapIterator) Next() (interface{}, interface{}) { + key, elem := iter.UnsafeNext() + return packEFace(iter.pKeyRType, key), packEFace(iter.pElemRType, elem) +} + +func (iter *UnsafeMapIterator) UnsafeNext() (unsafe.Pointer, unsafe.Pointer) { + key := iter.key + elem := iter.value + mapiternext(iter.hiter) + return key, elem +} diff --git a/vendor/github.com/v2pro/plz/reflect2/unsafe_ptr.go b/vendor/github.com/v2pro/plz/reflect2/unsafe_ptr.go new file mode 100644 index 000000000..843724d8c --- /dev/null +++ b/vendor/github.com/v2pro/plz/reflect2/unsafe_ptr.go @@ -0,0 +1,46 @@ +package reflect2 + +import ( + "unsafe" + "reflect" +) + +type UnsafePtrType struct { + unsafeType +} + +func newUnsafePtrType(cfg *frozenConfig, type1 reflect.Type) *UnsafePtrType { + return &UnsafePtrType{ + unsafeType: *newUnsafeType(cfg, type1), + } +} + +func (type2 *UnsafePtrType) IsNil(obj interface{}) bool { + if obj == nil { + return true + } + objEFace := unpackEFace(obj) + assertType("Type.IsNil argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIsNil(objEFace.data) +} + +func (type2 *UnsafePtrType) UnsafeIsNil(ptr unsafe.Pointer) bool { + if ptr == nil { + return true + } + return *(*unsafe.Pointer)(ptr) == nil +} + +func (type2 *UnsafePtrType) LikePtr() bool { + return true +} + +func (type2 *UnsafePtrType) Indirect(obj interface{}) interface{} { + objEFace := unpackEFace(obj) + assertType("Type.Indirect argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIndirect(objEFace.data) +} + +func (type2 *UnsafePtrType) UnsafeIndirect(ptr unsafe.Pointer) interface{} { + return packEFace(type2.rtype, *(*unsafe.Pointer)(ptr)) +} diff --git a/vendor/github.com/v2pro/plz/reflect2/unsafe_slice.go b/vendor/github.com/v2pro/plz/reflect2/unsafe_slice.go new file mode 100644 index 000000000..5ce85afbb --- /dev/null +++ b/vendor/github.com/v2pro/plz/reflect2/unsafe_slice.go @@ -0,0 +1,177 @@ +package reflect2 + +import ( + "unsafe" + "reflect" +) + +// sliceHeader is a safe version of SliceHeader used within this package. +type sliceHeader struct { + Data unsafe.Pointer + Len int + Cap int +} + +type UnsafeSliceType struct { + unsafeType + elemRType unsafe.Pointer + pElemRType unsafe.Pointer + elemSize uintptr +} + +func newUnsafeSliceType(cfg *frozenConfig, type1 reflect.Type) SliceType { + elemType := type1.Elem() + return &UnsafeSliceType{ + unsafeType: *newUnsafeType(cfg, type1), + pElemRType: unpackEFace(reflect.PtrTo(elemType)).data, + elemRType: unpackEFace(elemType).data, + elemSize: elemType.Size(), + } +} + +func (type2 *UnsafeSliceType) Set(obj interface{}, val interface{}) { + objEFace := unpackEFace(obj) + assertType("Type.Set argument 1", type2.ptrRType, objEFace.rtype) + valEFace := unpackEFace(val) + assertType("Type.Set argument 2", type2.ptrRType, valEFace.rtype) + type2.UnsafeSet(objEFace.data, valEFace.data) +} + +func (type2 *UnsafeSliceType) UnsafeSet(ptr unsafe.Pointer, val unsafe.Pointer) { + *(*sliceHeader)(ptr) = *(*sliceHeader)(val) +} + +func (type2 *UnsafeSliceType) IsNil(obj interface{}) bool { + if obj == nil { + return true + } + objEFace := unpackEFace(obj) + assertType("Type.IsNil argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIsNil(objEFace.data) +} + +func (type2 *UnsafeSliceType) UnsafeIsNil(ptr unsafe.Pointer) bool { + if ptr == nil { + return true + } + return (*sliceHeader)(ptr).Data == nil +} + +func (type2 *UnsafeSliceType) SetNil(obj interface{}) { + objEFace := unpackEFace(obj) + assertType("SliceType.SetNil argument 1", type2.ptrRType, objEFace.rtype) + type2.UnsafeSetNil(objEFace.data) +} + +func (type2 *UnsafeSliceType) UnsafeSetNil(ptr unsafe.Pointer) { + header := (*sliceHeader)(ptr) + header.Len = 0 + header.Cap = 0 + header.Data = nil +} + +func (type2 *UnsafeSliceType) MakeSlice(length int, cap int) interface{} { + return packEFace(type2.ptrRType, type2.UnsafeMakeSlice(length, cap)) +} + +func (type2 *UnsafeSliceType) UnsafeMakeSlice(length int, cap int) unsafe.Pointer { + header := &sliceHeader{unsafe_NewArray(type2.elemRType, cap), length, cap} + return unsafe.Pointer(header) +} + +func (type2 *UnsafeSliceType) LengthOf(obj interface{}) int { + objEFace := unpackEFace(obj) + assertType("SliceType.Len argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeLengthOf(objEFace.data) +} + +func (type2 *UnsafeSliceType) UnsafeLengthOf(obj unsafe.Pointer) int { + header := (*sliceHeader)(obj) + return header.Len +} + +func (type2 *UnsafeSliceType) SetIndex(obj interface{}, index int, elem interface{}) { + objEFace := unpackEFace(obj) + assertType("SliceType.SetIndex argument 1", type2.ptrRType, objEFace.rtype) + elemEFace := unpackEFace(elem) + assertType("SliceType.SetIndex argument 3", type2.pElemRType, elemEFace.rtype) + type2.UnsafeSetIndex(objEFace.data, index, elemEFace.data) +} + +func (type2 *UnsafeSliceType) UnsafeSetIndex(obj unsafe.Pointer, index int, elem unsafe.Pointer) { + header := (*sliceHeader)(obj) + elemPtr := arrayAt(header.Data, index, type2.elemSize, "i < s.Len") + typedmemmove(type2.elemRType, elemPtr, elem) +} + +func (type2 *UnsafeSliceType) GetIndex(obj interface{}, index int) interface{} { + objEFace := unpackEFace(obj) + assertType("SliceType.GetIndex argument 1", type2.ptrRType, objEFace.rtype) + elemPtr := type2.UnsafeGetIndex(objEFace.data, index) + return packEFace(type2.pElemRType, elemPtr) +} + +func (type2 *UnsafeSliceType) UnsafeGetIndex(obj unsafe.Pointer, index int) unsafe.Pointer { + header := (*sliceHeader)(obj) + return arrayAt(header.Data, index, type2.elemSize, "i < s.Len") +} + +func (type2 *UnsafeSliceType) Append(obj interface{}, elem interface{}) { + objEFace := unpackEFace(obj) + assertType("SliceType.Append argument 1", type2.ptrRType, objEFace.rtype) + elemEFace := unpackEFace(elem) + assertType("SliceType.Append argument 2", type2.pElemRType, elemEFace.rtype) + type2.UnsafeAppend(objEFace.data, elemEFace.data) +} + +func (type2 *UnsafeSliceType) UnsafeAppend(obj unsafe.Pointer, elem unsafe.Pointer) { + header := (*sliceHeader)(obj) + oldLen := header.Len + type2.UnsafeGrow(obj, oldLen+1) + type2.UnsafeSetIndex(obj, oldLen, elem) +} + +func (type2 *UnsafeSliceType) Cap(obj interface{}) int { + objEFace := unpackEFace(obj) + assertType("SliceType.Cap argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeCap(objEFace.data) +} + +func (type2 *UnsafeSliceType) UnsafeCap(ptr unsafe.Pointer) int { + return (*sliceHeader)(ptr).Cap +} + +func (type2 *UnsafeSliceType) Grow(obj interface{}, newLength int) { + objEFace := unpackEFace(obj) + assertType("SliceType.Grow argument 1", type2.ptrRType, objEFace.rtype) + type2.UnsafeGrow(objEFace.data, newLength) +} + +func (type2 *UnsafeSliceType) UnsafeGrow(obj unsafe.Pointer, newLength int) { + header := (*sliceHeader)(obj) + if newLength <= header.Cap { + header.Len = newLength + return + } + newCap := calcNewCap(header.Cap, newLength) + newHeader := (*sliceHeader)(type2.UnsafeMakeSlice(header.Len, newCap)) + typedslicecopy(type2.elemRType, *newHeader, *header) + header.Data = newHeader.Data + header.Cap = newHeader.Cap + header.Len = newLength +} + +func calcNewCap(cap int, expectedCap int) int { + if cap == 0 { + cap = expectedCap + } else { + for cap < expectedCap { + if cap < 1024 { + cap += cap + } else { + cap += cap / 4 + } + } + } + return cap +} diff --git a/vendor/github.com/v2pro/plz/reflect2/unsafe_struct.go b/vendor/github.com/v2pro/plz/reflect2/unsafe_struct.go new file mode 100644 index 000000000..f91ef1792 --- /dev/null +++ b/vendor/github.com/v2pro/plz/reflect2/unsafe_struct.go @@ -0,0 +1,59 @@ +package reflect2 + +import ( + "reflect" + "unsafe" +) + +type UnsafeStructType struct { + unsafeType + likePtr bool +} + +func newUnsafeStructType(cfg *frozenConfig, type1 reflect.Type) *UnsafeStructType { + return &UnsafeStructType{ + unsafeType: *newUnsafeType(cfg, type1), + likePtr: likePtrType(type1), + } +} + +func (type2 *UnsafeStructType) LikePtr() bool { + return type2.likePtr +} + +func (type2 *UnsafeStructType) Indirect(obj interface{}) interface{} { + objEFace := unpackEFace(obj) + assertType("Type.Indirect argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIndirect(objEFace.data) +} + +func (type2 *UnsafeStructType) UnsafeIndirect(ptr unsafe.Pointer) interface{} { + if type2.likePtr { + return packEFace(type2.rtype, *(*unsafe.Pointer)(ptr)) + } + return packEFace(type2.rtype, ptr) +} + +func (type2 *UnsafeStructType) FieldByName(name string) StructField { + structField, found := type2.Type.FieldByName(name) + if !found { + return nil + } + return newUnsafeStructField(type2, structField) +} + +func (type2 *UnsafeStructType) Field(i int) StructField { + return newUnsafeStructField(type2, type2.Type.Field(i)) +} + +func (type2 *UnsafeStructType) FieldByIndex(index []int) StructField { + return newUnsafeStructField(type2, type2.Type.FieldByIndex(index)) +} + +func (type2 *UnsafeStructType) FieldByNameFunc(match func(string) bool) StructField { + structField, found := type2.Type.FieldByNameFunc(match) + if !found { + panic("field match condition not found in " + type2.Type.String()) + } + return newUnsafeStructField(type2, structField) +} \ No newline at end of file diff --git a/vendor/github.com/v2pro/plz/reflect2/unsafe_type.go b/vendor/github.com/v2pro/plz/reflect2/unsafe_type.go new file mode 100644 index 000000000..e7ad4a655 --- /dev/null +++ b/vendor/github.com/v2pro/plz/reflect2/unsafe_type.go @@ -0,0 +1,85 @@ +package reflect2 + +import ( + "unsafe" + "reflect" +) + +type unsafeType struct { + safeType + rtype unsafe.Pointer + ptrRType unsafe.Pointer +} + +func newUnsafeType(cfg *frozenConfig, type1 reflect.Type) *unsafeType { + return &unsafeType{ + safeType: safeType{ + Type: type1, + cfg: cfg, + }, + rtype: unpackEFace(type1).data, + ptrRType: unpackEFace(reflect.PtrTo(type1)).data, + } +} + +func (type2 *unsafeType) Set(obj interface{}, val interface{}) { + objEFace := unpackEFace(obj) + assertType("Type.Set argument 1", type2.ptrRType, objEFace.rtype) + valEFace := unpackEFace(val) + assertType("Type.Set argument 2", type2.ptrRType, valEFace.rtype) + type2.UnsafeSet(objEFace.data, valEFace.data) +} + +func (type2 *unsafeType) UnsafeSet(ptr unsafe.Pointer, val unsafe.Pointer) { + typedmemmove(type2.rtype, ptr, val) +} + +func (type2 *unsafeType) IsNil(obj interface{}) bool { + objEFace := unpackEFace(obj) + assertType("Type.IsNil argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIsNil(objEFace.data) +} + +func (type2 *unsafeType) UnsafeIsNil(ptr unsafe.Pointer) bool { + return ptr == nil +} + +func (type2 *unsafeType) UnsafeNew() unsafe.Pointer { + return unsafe_New(type2.rtype) +} + +func (type2 *unsafeType) New() interface{} { + return packEFace(type2.ptrRType, type2.UnsafeNew()) +} + +func (type2 *unsafeType) PackEFace(ptr unsafe.Pointer) interface{} { + return packEFace(type2.ptrRType, ptr) +} + +func (type2 *unsafeType) RType() uintptr { + return uintptr(type2.rtype) +} + +func (type2 *unsafeType) Indirect(obj interface{}) interface{} { + objEFace := unpackEFace(obj) + assertType("Type.Indirect argument 1", type2.ptrRType, objEFace.rtype) + return type2.UnsafeIndirect(objEFace.data) +} + +func (type2 *unsafeType) UnsafeIndirect(obj unsafe.Pointer) interface{} { + return packEFace(type2.rtype, obj) +} + +func (type2 *unsafeType) LikePtr() bool { + return false +} + +func assertType(where string, expectRType unsafe.Pointer, actualRType unsafe.Pointer) { + if expectRType != actualRType { + expectType := reflect.TypeOf(0) + (*iface)(unsafe.Pointer(&expectType)).data = expectRType + actualType := reflect.TypeOf(0) + (*iface)(unsafe.Pointer(&actualType)).data = actualRType + panic(where + ": expect " + expectType.String() + ", actual " + actualType.String()) + } +} diff --git a/vendor/golang.org/x/crypto/ssh/certs.go b/vendor/golang.org/x/crypto/ssh/certs.go index cfc8ead1b..42106f3f2 100644 --- a/vendor/golang.org/x/crypto/ssh/certs.go +++ b/vendor/golang.org/x/crypto/ssh/certs.go @@ -44,7 +44,9 @@ type Signature struct { const CertTimeInfinity = 1<<64 - 1 // An Certificate represents an OpenSSH certificate as defined in -// [PROTOCOL.certkeys]?rev=1.8. +// [PROTOCOL.certkeys]?rev=1.8. The Certificate type implements the +// PublicKey interface, so it can be unmarshaled using +// ParsePublicKey. type Certificate struct { Nonce []byte Key PublicKey diff --git a/vendor/golang.org/x/crypto/ssh/cipher.go b/vendor/golang.org/x/crypto/ssh/cipher.go index e67c5e0aa..30a49fdf2 100644 --- a/vendor/golang.org/x/crypto/ssh/cipher.go +++ b/vendor/golang.org/x/crypto/ssh/cipher.go @@ -16,6 +16,9 @@ import ( "hash" "io" "io/ioutil" + + "golang.org/x/crypto/internal/chacha20" + "golang.org/x/crypto/poly1305" ) const ( @@ -53,78 +56,78 @@ func newRC4(key, iv []byte) (cipher.Stream, error) { return rc4.NewCipher(key) } -type streamCipherMode struct { - keySize int - ivSize int - skip int - createFunc func(key, iv []byte) (cipher.Stream, error) +type cipherMode struct { + keySize int + ivSize int + create func(key, iv []byte, macKey []byte, algs directionAlgorithms) (packetCipher, error) } -func (c *streamCipherMode) createStream(key, iv []byte) (cipher.Stream, error) { - if len(key) < c.keySize { - panic("ssh: key length too small for cipher") - } - if len(iv) < c.ivSize { - panic("ssh: iv too small for cipher") - } - - stream, err := c.createFunc(key[:c.keySize], iv[:c.ivSize]) - if err != nil { - return nil, err - } - - var streamDump []byte - if c.skip > 0 { - streamDump = make([]byte, 512) - } - - for remainingToDump := c.skip; remainingToDump > 0; { - dumpThisTime := remainingToDump - if dumpThisTime > len(streamDump) { - dumpThisTime = len(streamDump) +func streamCipherMode(skip int, createFunc func(key, iv []byte) (cipher.Stream, error)) func(key, iv []byte, macKey []byte, algs directionAlgorithms) (packetCipher, error) { + return func(key, iv, macKey []byte, algs directionAlgorithms) (packetCipher, error) { + stream, err := createFunc(key, iv) + if err != nil { + return nil, err } - stream.XORKeyStream(streamDump[:dumpThisTime], streamDump[:dumpThisTime]) - remainingToDump -= dumpThisTime - } - return stream, nil + var streamDump []byte + if skip > 0 { + streamDump = make([]byte, 512) + } + + for remainingToDump := skip; remainingToDump > 0; { + dumpThisTime := remainingToDump + if dumpThisTime > len(streamDump) { + dumpThisTime = len(streamDump) + } + stream.XORKeyStream(streamDump[:dumpThisTime], streamDump[:dumpThisTime]) + remainingToDump -= dumpThisTime + } + + mac := macModes[algs.MAC].new(macKey) + return &streamPacketCipher{ + mac: mac, + etm: macModes[algs.MAC].etm, + macResult: make([]byte, mac.Size()), + cipher: stream, + }, nil + } } // cipherModes documents properties of supported ciphers. Ciphers not included // are not supported and will not be negotiated, even if explicitly requested in // ClientConfig.Crypto.Ciphers. -var cipherModes = map[string]*streamCipherMode{ +var cipherModes = map[string]*cipherMode{ // Ciphers from RFC4344, which introduced many CTR-based ciphers. Algorithms // are defined in the order specified in the RFC. - "aes128-ctr": {16, aes.BlockSize, 0, newAESCTR}, - "aes192-ctr": {24, aes.BlockSize, 0, newAESCTR}, - "aes256-ctr": {32, aes.BlockSize, 0, newAESCTR}, + "aes128-ctr": {16, aes.BlockSize, streamCipherMode(0, newAESCTR)}, + "aes192-ctr": {24, aes.BlockSize, streamCipherMode(0, newAESCTR)}, + "aes256-ctr": {32, aes.BlockSize, streamCipherMode(0, newAESCTR)}, // Ciphers from RFC4345, which introduces security-improved arcfour ciphers. // They are defined in the order specified in the RFC. - "arcfour128": {16, 0, 1536, newRC4}, - "arcfour256": {32, 0, 1536, newRC4}, + "arcfour128": {16, 0, streamCipherMode(1536, newRC4)}, + "arcfour256": {32, 0, streamCipherMode(1536, newRC4)}, // Cipher defined in RFC 4253, which describes SSH Transport Layer Protocol. // Note that this cipher is not safe, as stated in RFC 4253: "Arcfour (and // RC4) has problems with weak keys, and should be used with caution." // RFC4345 introduces improved versions of Arcfour. - "arcfour": {16, 0, 0, newRC4}, + "arcfour": {16, 0, streamCipherMode(0, newRC4)}, - // AES-GCM is not a stream cipher, so it is constructed with a - // special case. If we add any more non-stream ciphers, we - // should invest a cleaner way to do this. - gcmCipherID: {16, 12, 0, nil}, + // AEAD ciphers + gcmCipherID: {16, 12, newGCMCipher}, + chacha20Poly1305ID: {64, 0, newChaCha20Cipher}, // CBC mode is insecure and so is not included in the default config. // (See http://www.isg.rhul.ac.uk/~kp/SandPfinal.pdf). If absolutely // needed, it's possible to specify a custom Config to enable it. // You should expect that an active attacker can recover plaintext if // you do. - aes128cbcID: {16, aes.BlockSize, 0, nil}, + aes128cbcID: {16, aes.BlockSize, newAESCBCCipher}, - // 3des-cbc is insecure and is disabled by default. - tripledescbcID: {24, des.BlockSize, 0, nil}, + // 3des-cbc is insecure and is not included in the default + // config. + tripledescbcID: {24, des.BlockSize, newTripleDESCBCCipher}, } // prefixLen is the length of the packet prefix that contains the packet length @@ -304,7 +307,7 @@ type gcmCipher struct { buf []byte } -func newGCMCipher(iv, key []byte) (packetCipher, error) { +func newGCMCipher(key, iv, unusedMacKey []byte, unusedAlgs directionAlgorithms) (packetCipher, error) { c, err := aes.NewCipher(key) if err != nil { return nil, err @@ -422,7 +425,7 @@ type cbcCipher struct { oracleCamouflage uint32 } -func newCBCCipher(c cipher.Block, iv, key, macKey []byte, algs directionAlgorithms) (packetCipher, error) { +func newCBCCipher(c cipher.Block, key, iv, macKey []byte, algs directionAlgorithms) (packetCipher, error) { cbc := &cbcCipher{ mac: macModes[algs.MAC].new(macKey), decrypter: cipher.NewCBCDecrypter(c, iv), @@ -436,13 +439,13 @@ func newCBCCipher(c cipher.Block, iv, key, macKey []byte, algs directionAlgorith return cbc, nil } -func newAESCBCCipher(iv, key, macKey []byte, algs directionAlgorithms) (packetCipher, error) { +func newAESCBCCipher(key, iv, macKey []byte, algs directionAlgorithms) (packetCipher, error) { c, err := aes.NewCipher(key) if err != nil { return nil, err } - cbc, err := newCBCCipher(c, iv, key, macKey, algs) + cbc, err := newCBCCipher(c, key, iv, macKey, algs) if err != nil { return nil, err } @@ -450,13 +453,13 @@ func newAESCBCCipher(iv, key, macKey []byte, algs directionAlgorithms) (packetCi return cbc, nil } -func newTripleDESCBCCipher(iv, key, macKey []byte, algs directionAlgorithms) (packetCipher, error) { +func newTripleDESCBCCipher(key, iv, macKey []byte, algs directionAlgorithms) (packetCipher, error) { c, err := des.NewTripleDESCipher(key) if err != nil { return nil, err } - cbc, err := newCBCCipher(c, iv, key, macKey, algs) + cbc, err := newCBCCipher(c, key, iv, macKey, algs) if err != nil { return nil, err } @@ -627,3 +630,142 @@ func (c *cbcCipher) writePacket(seqNum uint32, w io.Writer, rand io.Reader, pack return nil } + +const chacha20Poly1305ID = "chacha20-poly1305@openssh.com" + +// chacha20Poly1305Cipher implements the chacha20-poly1305@openssh.com +// AEAD, which is described here: +// +// https://tools.ietf.org/html/draft-josefsson-ssh-chacha20-poly1305-openssh-00 +// +// the methods here also implement padding, which RFC4253 Section 6 +// also requires of stream ciphers. +type chacha20Poly1305Cipher struct { + lengthKey [32]byte + contentKey [32]byte + buf []byte +} + +func newChaCha20Cipher(key, unusedIV, unusedMACKey []byte, unusedAlgs directionAlgorithms) (packetCipher, error) { + if len(key) != 64 { + panic(len(key)) + } + + c := &chacha20Poly1305Cipher{ + buf: make([]byte, 256), + } + + copy(c.contentKey[:], key[:32]) + copy(c.lengthKey[:], key[32:]) + return c, nil +} + +// The Poly1305 key is obtained by encrypting 32 0-bytes. +var chacha20PolyKeyInput [32]byte + +func (c *chacha20Poly1305Cipher) readPacket(seqNum uint32, r io.Reader) ([]byte, error) { + var counter [16]byte + binary.BigEndian.PutUint64(counter[8:], uint64(seqNum)) + + var polyKey [32]byte + chacha20.XORKeyStream(polyKey[:], chacha20PolyKeyInput[:], &counter, &c.contentKey) + + encryptedLength := c.buf[:4] + if _, err := io.ReadFull(r, encryptedLength); err != nil { + return nil, err + } + + var lenBytes [4]byte + chacha20.XORKeyStream(lenBytes[:], encryptedLength, &counter, &c.lengthKey) + + length := binary.BigEndian.Uint32(lenBytes[:]) + if length > maxPacket { + return nil, errors.New("ssh: invalid packet length, packet too large") + } + + contentEnd := 4 + length + packetEnd := contentEnd + poly1305.TagSize + if uint32(cap(c.buf)) < packetEnd { + c.buf = make([]byte, packetEnd) + copy(c.buf[:], encryptedLength) + } else { + c.buf = c.buf[:packetEnd] + } + + if _, err := io.ReadFull(r, c.buf[4:packetEnd]); err != nil { + return nil, err + } + + var mac [poly1305.TagSize]byte + copy(mac[:], c.buf[contentEnd:packetEnd]) + if !poly1305.Verify(&mac, c.buf[:contentEnd], &polyKey) { + return nil, errors.New("ssh: MAC failure") + } + + counter[0] = 1 + + plain := c.buf[4:contentEnd] + chacha20.XORKeyStream(plain, plain, &counter, &c.contentKey) + + padding := plain[0] + if padding < 4 { + // padding is a byte, so it automatically satisfies + // the maximum size, which is 255. + return nil, fmt.Errorf("ssh: illegal padding %d", padding) + } + + if int(padding)+1 >= len(plain) { + return nil, fmt.Errorf("ssh: padding %d too large", padding) + } + + plain = plain[1 : len(plain)-int(padding)] + + return plain, nil +} + +func (c *chacha20Poly1305Cipher) writePacket(seqNum uint32, w io.Writer, rand io.Reader, payload []byte) error { + var counter [16]byte + binary.BigEndian.PutUint64(counter[8:], uint64(seqNum)) + + var polyKey [32]byte + chacha20.XORKeyStream(polyKey[:], chacha20PolyKeyInput[:], &counter, &c.contentKey) + + // There is no blocksize, so fall back to multiple of 8 byte + // padding, as described in RFC 4253, Sec 6. + const packetSizeMultiple = 8 + + padding := packetSizeMultiple - (1+len(payload))%packetSizeMultiple + if padding < 4 { + padding += packetSizeMultiple + } + + // size (4 bytes), padding (1), payload, padding, tag. + totalLength := 4 + 1 + len(payload) + padding + poly1305.TagSize + if cap(c.buf) < totalLength { + c.buf = make([]byte, totalLength) + } else { + c.buf = c.buf[:totalLength] + } + + binary.BigEndian.PutUint32(c.buf, uint32(1+len(payload)+padding)) + chacha20.XORKeyStream(c.buf, c.buf[:4], &counter, &c.lengthKey) + c.buf[4] = byte(padding) + copy(c.buf[5:], payload) + packetEnd := 5 + len(payload) + padding + if _, err := io.ReadFull(rand, c.buf[5+len(payload):packetEnd]); err != nil { + return err + } + + counter[0] = 1 + chacha20.XORKeyStream(c.buf[4:], c.buf[4:packetEnd], &counter, &c.contentKey) + + var mac [poly1305.TagSize]byte + poly1305.Sum(&mac, c.buf[:packetEnd], &polyKey) + + copy(c.buf[packetEnd:], mac[:]) + + if _, err := w.Write(c.buf); err != nil { + return err + } + return nil +} diff --git a/vendor/golang.org/x/crypto/ssh/cipher_test.go b/vendor/golang.org/x/crypto/ssh/cipher_test.go index 6a35d8708..a52d6e486 100644 --- a/vendor/golang.org/x/crypto/ssh/cipher_test.go +++ b/vendor/golang.org/x/crypto/ssh/cipher_test.go @@ -7,7 +7,6 @@ package ssh import ( "bytes" "crypto" - "crypto/aes" "crypto/rand" "testing" ) @@ -15,7 +14,12 @@ import ( func TestDefaultCiphersExist(t *testing.T) { for _, cipherAlgo := range supportedCiphers { if _, ok := cipherModes[cipherAlgo]; !ok { - t.Errorf("default cipher %q is unknown", cipherAlgo) + t.Errorf("supported cipher %q is unknown", cipherAlgo) + } + } + for _, cipherAlgo := range preferredCiphers { + if _, ok := cipherModes[cipherAlgo]; !ok { + t.Errorf("preferred cipher %q is unknown", cipherAlgo) } } } @@ -67,9 +71,6 @@ func testPacketCipher(t *testing.T, cipher, mac string) { } func TestCBCOracleCounterMeasure(t *testing.T) { - cipherModes[aes128cbcID] = &streamCipherMode{16, aes.BlockSize, 0, nil} - defer delete(cipherModes, aes128cbcID) - kr := &kexResult{Hash: crypto.SHA1} algs := directionAlgorithms{ Cipher: aes128cbcID, diff --git a/vendor/golang.org/x/crypto/ssh/client_auth.go b/vendor/golang.org/x/crypto/ssh/client_auth.go index a1252cb9b..5f44b7740 100644 --- a/vendor/golang.org/x/crypto/ssh/client_auth.go +++ b/vendor/golang.org/x/crypto/ssh/client_auth.go @@ -11,6 +11,14 @@ import ( "io" ) +type authResult int + +const ( + authFailure authResult = iota + authPartialSuccess + authSuccess +) + // clientAuthenticate authenticates with the remote server. See RFC 4252. func (c *connection) clientAuthenticate(config *ClientConfig) error { // initiate user auth session @@ -37,11 +45,12 @@ func (c *connection) clientAuthenticate(config *ClientConfig) error { if err != nil { return err } - if ok { + if ok == authSuccess { // success return nil + } else if ok == authFailure { + tried[auth.method()] = true } - tried[auth.method()] = true if methods == nil { methods = lastMethods } @@ -82,7 +91,7 @@ type AuthMethod interface { // If authentication is not successful, a []string of alternative // method names is returned. If the slice is nil, it will be ignored // and the previous set of possible methods will be reused. - auth(session []byte, user string, p packetConn, rand io.Reader) (bool, []string, error) + auth(session []byte, user string, p packetConn, rand io.Reader) (authResult, []string, error) // method returns the RFC 4252 method name. method() string @@ -91,13 +100,13 @@ type AuthMethod interface { // "none" authentication, RFC 4252 section 5.2. type noneAuth int -func (n *noneAuth) auth(session []byte, user string, c packetConn, rand io.Reader) (bool, []string, error) { +func (n *noneAuth) auth(session []byte, user string, c packetConn, rand io.Reader) (authResult, []string, error) { if err := c.writePacket(Marshal(&userAuthRequestMsg{ User: user, Service: serviceSSH, Method: "none", })); err != nil { - return false, nil, err + return authFailure, nil, err } return handleAuthResponse(c) @@ -111,7 +120,7 @@ func (n *noneAuth) method() string { // a function call, e.g. by prompting the user. type passwordCallback func() (password string, err error) -func (cb passwordCallback) auth(session []byte, user string, c packetConn, rand io.Reader) (bool, []string, error) { +func (cb passwordCallback) auth(session []byte, user string, c packetConn, rand io.Reader) (authResult, []string, error) { type passwordAuthMsg struct { User string `sshtype:"50"` Service string @@ -125,7 +134,7 @@ func (cb passwordCallback) auth(session []byte, user string, c packetConn, rand // The program may only find out that the user doesn't have a password // when prompting. if err != nil { - return false, nil, err + return authFailure, nil, err } if err := c.writePacket(Marshal(&passwordAuthMsg{ @@ -135,7 +144,7 @@ func (cb passwordCallback) auth(session []byte, user string, c packetConn, rand Reply: false, Password: pw, })); err != nil { - return false, nil, err + return authFailure, nil, err } return handleAuthResponse(c) @@ -178,7 +187,7 @@ func (cb publicKeyCallback) method() string { return "publickey" } -func (cb publicKeyCallback) auth(session []byte, user string, c packetConn, rand io.Reader) (bool, []string, error) { +func (cb publicKeyCallback) auth(session []byte, user string, c packetConn, rand io.Reader) (authResult, []string, error) { // Authentication is performed by sending an enquiry to test if a key is // acceptable to the remote. If the key is acceptable, the client will // attempt to authenticate with the valid key. If not the client will repeat @@ -186,13 +195,13 @@ func (cb publicKeyCallback) auth(session []byte, user string, c packetConn, rand signers, err := cb() if err != nil { - return false, nil, err + return authFailure, nil, err } var methods []string for _, signer := range signers { ok, err := validateKey(signer.PublicKey(), user, c) if err != nil { - return false, nil, err + return authFailure, nil, err } if !ok { continue @@ -206,7 +215,7 @@ func (cb publicKeyCallback) auth(session []byte, user string, c packetConn, rand Method: cb.method(), }, []byte(pub.Type()), pubKey)) if err != nil { - return false, nil, err + return authFailure, nil, err } // manually wrap the serialized signature in a string @@ -224,24 +233,24 @@ func (cb publicKeyCallback) auth(session []byte, user string, c packetConn, rand } p := Marshal(&msg) if err := c.writePacket(p); err != nil { - return false, nil, err + return authFailure, nil, err } - var success bool + var success authResult success, methods, err = handleAuthResponse(c) if err != nil { - return false, nil, err + return authFailure, nil, err } // If authentication succeeds or the list of available methods does not // contain the "publickey" method, do not attempt to authenticate with any // other keys. According to RFC 4252 Section 7, the latter can occur when // additional authentication methods are required. - if success || !containsMethod(methods, cb.method()) { + if success == authSuccess || !containsMethod(methods, cb.method()) { return success, methods, err } } - return false, methods, nil + return authFailure, methods, nil } func containsMethod(methods []string, method string) bool { @@ -318,28 +327,31 @@ func PublicKeysCallback(getSigners func() (signers []Signer, err error)) AuthMet // handleAuthResponse returns whether the preceding authentication request succeeded // along with a list of remaining authentication methods to try next and // an error if an unexpected response was received. -func handleAuthResponse(c packetConn) (bool, []string, error) { +func handleAuthResponse(c packetConn) (authResult, []string, error) { for { packet, err := c.readPacket() if err != nil { - return false, nil, err + return authFailure, nil, err } switch packet[0] { case msgUserAuthBanner: if err := handleBannerResponse(c, packet); err != nil { - return false, nil, err + return authFailure, nil, err } case msgUserAuthFailure: var msg userAuthFailureMsg if err := Unmarshal(packet, &msg); err != nil { - return false, nil, err + return authFailure, nil, err } - return false, msg.Methods, nil + if msg.PartialSuccess { + return authPartialSuccess, msg.Methods, nil + } + return authFailure, msg.Methods, nil case msgUserAuthSuccess: - return true, nil, nil + return authSuccess, nil, nil default: - return false, nil, unexpectedMessageError(msgUserAuthSuccess, packet[0]) + return authFailure, nil, unexpectedMessageError(msgUserAuthSuccess, packet[0]) } } } @@ -381,7 +393,7 @@ func (cb KeyboardInteractiveChallenge) method() string { return "keyboard-interactive" } -func (cb KeyboardInteractiveChallenge) auth(session []byte, user string, c packetConn, rand io.Reader) (bool, []string, error) { +func (cb KeyboardInteractiveChallenge) auth(session []byte, user string, c packetConn, rand io.Reader) (authResult, []string, error) { type initiateMsg struct { User string `sshtype:"50"` Service string @@ -395,20 +407,20 @@ func (cb KeyboardInteractiveChallenge) auth(session []byte, user string, c packe Service: serviceSSH, Method: "keyboard-interactive", })); err != nil { - return false, nil, err + return authFailure, nil, err } for { packet, err := c.readPacket() if err != nil { - return false, nil, err + return authFailure, nil, err } // like handleAuthResponse, but with less options. switch packet[0] { case msgUserAuthBanner: if err := handleBannerResponse(c, packet); err != nil { - return false, nil, err + return authFailure, nil, err } continue case msgUserAuthInfoRequest: @@ -416,18 +428,21 @@ func (cb KeyboardInteractiveChallenge) auth(session []byte, user string, c packe case msgUserAuthFailure: var msg userAuthFailureMsg if err := Unmarshal(packet, &msg); err != nil { - return false, nil, err + return authFailure, nil, err } - return false, msg.Methods, nil + if msg.PartialSuccess { + return authPartialSuccess, msg.Methods, nil + } + return authFailure, msg.Methods, nil case msgUserAuthSuccess: - return true, nil, nil + return authSuccess, nil, nil default: - return false, nil, unexpectedMessageError(msgUserAuthInfoRequest, packet[0]) + return authFailure, nil, unexpectedMessageError(msgUserAuthInfoRequest, packet[0]) } var msg userAuthInfoRequestMsg if err := Unmarshal(packet, &msg); err != nil { - return false, nil, err + return authFailure, nil, err } // Manually unpack the prompt/echo pairs. @@ -437,7 +452,7 @@ func (cb KeyboardInteractiveChallenge) auth(session []byte, user string, c packe for i := 0; i < int(msg.NumPrompts); i++ { prompt, r, ok := parseString(rest) if !ok || len(r) == 0 { - return false, nil, errors.New("ssh: prompt format error") + return authFailure, nil, errors.New("ssh: prompt format error") } prompts = append(prompts, string(prompt)) echos = append(echos, r[0] != 0) @@ -445,16 +460,16 @@ func (cb KeyboardInteractiveChallenge) auth(session []byte, user string, c packe } if len(rest) != 0 { - return false, nil, errors.New("ssh: extra data following keyboard-interactive pairs") + return authFailure, nil, errors.New("ssh: extra data following keyboard-interactive pairs") } answers, err := cb(msg.User, msg.Instruction, prompts, echos) if err != nil { - return false, nil, err + return authFailure, nil, err } if len(answers) != len(prompts) { - return false, nil, errors.New("ssh: not enough answers from keyboard-interactive callback") + return authFailure, nil, errors.New("ssh: not enough answers from keyboard-interactive callback") } responseLength := 1 + 4 for _, a := range answers { @@ -470,7 +485,7 @@ func (cb KeyboardInteractiveChallenge) auth(session []byte, user string, c packe } if err := c.writePacket(serialized); err != nil { - return false, nil, err + return authFailure, nil, err } } } @@ -480,10 +495,10 @@ type retryableAuthMethod struct { maxTries int } -func (r *retryableAuthMethod) auth(session []byte, user string, c packetConn, rand io.Reader) (ok bool, methods []string, err error) { +func (r *retryableAuthMethod) auth(session []byte, user string, c packetConn, rand io.Reader) (ok authResult, methods []string, err error) { for i := 0; r.maxTries <= 0 || i < r.maxTries; i++ { ok, methods, err = r.authMethod.auth(session, user, c, rand) - if ok || err != nil { // either success or error terminate + if ok != authFailure || err != nil { // either success, partial success or error terminate return ok, methods, err } } diff --git a/vendor/golang.org/x/crypto/ssh/client_auth_test.go b/vendor/golang.org/x/crypto/ssh/client_auth_test.go index 145b57a2b..e457ca535 100644 --- a/vendor/golang.org/x/crypto/ssh/client_auth_test.go +++ b/vendor/golang.org/x/crypto/ssh/client_auth_test.go @@ -614,8 +614,8 @@ func TestClientAuthErrorList(t *testing.T) { for i, e := range authErrs.Errors { switch i { case 0: - if e.Error() != "no auth passed yet" { - t.Fatalf("errors: got %v, want no auth passed yet", e.Error()) + if e != NoAuthError { + t.Fatalf("errors: got error %v, want NoAuthError", e) } case 1: if e != publicKeyErr { diff --git a/vendor/golang.org/x/crypto/ssh/common.go b/vendor/golang.org/x/crypto/ssh/common.go index 135b4edd7..04f3620b3 100644 --- a/vendor/golang.org/x/crypto/ssh/common.go +++ b/vendor/golang.org/x/crypto/ssh/common.go @@ -24,11 +24,21 @@ const ( serviceSSH = "ssh-connection" ) -// supportedCiphers specifies the supported ciphers in preference order. +// supportedCiphers lists ciphers we support but might not recommend. var supportedCiphers = []string{ "aes128-ctr", "aes192-ctr", "aes256-ctr", "aes128-gcm@openssh.com", - "arcfour256", "arcfour128", + chacha20Poly1305ID, + "arcfour256", "arcfour128", "arcfour", + aes128cbcID, + tripledescbcID, +} + +// preferredCiphers specifies the default preference for ciphers. +var preferredCiphers = []string{ + "aes128-gcm@openssh.com", + chacha20Poly1305ID, + "aes128-ctr", "aes192-ctr", "aes256-ctr", } // supportedKexAlgos specifies the supported key-exchange algorithms in @@ -211,7 +221,7 @@ func (c *Config) SetDefaults() { c.Rand = rand.Reader } if c.Ciphers == nil { - c.Ciphers = supportedCiphers + c.Ciphers = preferredCiphers } var ciphers []string for _, c := range c.Ciphers { diff --git a/vendor/golang.org/x/crypto/ssh/keys_test.go b/vendor/golang.org/x/crypto/ssh/keys_test.go index 20ab954e2..9a90abc0c 100644 --- a/vendor/golang.org/x/crypto/ssh/keys_test.go +++ b/vendor/golang.org/x/crypto/ssh/keys_test.go @@ -234,7 +234,7 @@ func TestMarshalParsePublicKey(t *testing.T) { } } -type authResult struct { +type testAuthResult struct { pubKey PublicKey options []string comments string @@ -242,11 +242,11 @@ type authResult struct { ok bool } -func testAuthorizedKeys(t *testing.T, authKeys []byte, expected []authResult) { +func testAuthorizedKeys(t *testing.T, authKeys []byte, expected []testAuthResult) { rest := authKeys - var values []authResult + var values []testAuthResult for len(rest) > 0 { - var r authResult + var r testAuthResult var err error r.pubKey, r.comments, r.options, rest, err = ParseAuthorizedKey(rest) r.ok = (err == nil) @@ -264,7 +264,7 @@ func TestAuthorizedKeyBasic(t *testing.T) { pub, pubSerialized := getTestKey() line := "ssh-rsa " + pubSerialized + " user@host" testAuthorizedKeys(t, []byte(line), - []authResult{ + []testAuthResult{ {pub, nil, "user@host", "", true}, }) } @@ -286,7 +286,7 @@ func TestAuth(t *testing.T) { authOptions := strings.Join(authWithOptions, eol) rest2 := strings.Join(authWithOptions[3:], eol) rest3 := strings.Join(authWithOptions[6:], eol) - testAuthorizedKeys(t, []byte(authOptions), []authResult{ + testAuthorizedKeys(t, []byte(authOptions), []testAuthResult{ {pub, []string{`env="HOME=/home/root"`, "no-port-forwarding"}, "user@host", rest2, true}, {pub, []string{`env="HOME=/home/root2"`}, "user2@host2", rest3, true}, {nil, nil, "", "", false}, @@ -297,7 +297,7 @@ func TestAuth(t *testing.T) { func TestAuthWithQuotedSpaceInEnv(t *testing.T) { pub, pubSerialized := getTestKey() authWithQuotedSpaceInEnv := []byte(`env="HOME=/home/root dir",no-port-forwarding ssh-rsa ` + pubSerialized + ` user@host`) - testAuthorizedKeys(t, []byte(authWithQuotedSpaceInEnv), []authResult{ + testAuthorizedKeys(t, []byte(authWithQuotedSpaceInEnv), []testAuthResult{ {pub, []string{`env="HOME=/home/root dir"`, "no-port-forwarding"}, "user@host", "", true}, }) } @@ -305,7 +305,7 @@ func TestAuthWithQuotedSpaceInEnv(t *testing.T) { func TestAuthWithQuotedCommaInEnv(t *testing.T) { pub, pubSerialized := getTestKey() authWithQuotedCommaInEnv := []byte(`env="HOME=/home/root,dir",no-port-forwarding ssh-rsa ` + pubSerialized + ` user@host`) - testAuthorizedKeys(t, []byte(authWithQuotedCommaInEnv), []authResult{ + testAuthorizedKeys(t, []byte(authWithQuotedCommaInEnv), []testAuthResult{ {pub, []string{`env="HOME=/home/root,dir"`, "no-port-forwarding"}, "user@host", "", true}, }) } @@ -314,11 +314,11 @@ func TestAuthWithQuotedQuoteInEnv(t *testing.T) { pub, pubSerialized := getTestKey() authWithQuotedQuoteInEnv := []byte(`env="HOME=/home/\"root dir",no-port-forwarding` + "\t" + `ssh-rsa` + "\t" + pubSerialized + ` user@host`) authWithDoubleQuotedQuote := []byte(`no-port-forwarding,env="HOME=/home/ \"root dir\"" ssh-rsa ` + pubSerialized + "\t" + `user@host`) - testAuthorizedKeys(t, []byte(authWithQuotedQuoteInEnv), []authResult{ + testAuthorizedKeys(t, []byte(authWithQuotedQuoteInEnv), []testAuthResult{ {pub, []string{`env="HOME=/home/\"root dir"`, "no-port-forwarding"}, "user@host", "", true}, }) - testAuthorizedKeys(t, []byte(authWithDoubleQuotedQuote), []authResult{ + testAuthorizedKeys(t, []byte(authWithDoubleQuotedQuote), []testAuthResult{ {pub, []string{"no-port-forwarding", `env="HOME=/home/ \"root dir\""`}, "user@host", "", true}, }) } @@ -327,7 +327,7 @@ func TestAuthWithInvalidSpace(t *testing.T) { _, pubSerialized := getTestKey() authWithInvalidSpace := []byte(`env="HOME=/home/root dir", no-port-forwarding ssh-rsa ` + pubSerialized + ` user@host #more to follow but still no valid keys`) - testAuthorizedKeys(t, []byte(authWithInvalidSpace), []authResult{ + testAuthorizedKeys(t, []byte(authWithInvalidSpace), []testAuthResult{ {nil, nil, "", "", false}, }) } @@ -337,7 +337,7 @@ func TestAuthWithMissingQuote(t *testing.T) { authWithMissingQuote := []byte(`env="HOME=/home/root,no-port-forwarding ssh-rsa ` + pubSerialized + ` user@host env="HOME=/home/root",shared-control ssh-rsa ` + pubSerialized + ` user@host`) - testAuthorizedKeys(t, []byte(authWithMissingQuote), []authResult{ + testAuthorizedKeys(t, []byte(authWithMissingQuote), []testAuthResult{ {pub, []string{`env="HOME=/home/root"`, `shared-control`}, "user@host", "", true}, }) } diff --git a/vendor/golang.org/x/crypto/ssh/server.go b/vendor/golang.org/x/crypto/ssh/server.go index b83d47388..6262f3416 100644 --- a/vendor/golang.org/x/crypto/ssh/server.go +++ b/vendor/golang.org/x/crypto/ssh/server.go @@ -297,7 +297,7 @@ func checkSourceAddress(addr net.Addr, sourceAddrs string) error { // provided by the user failed to authenticate. type ServerAuthError struct { // Errors contains authentication errors returned by the authentication - // callback methods. + // callback methods. The first entry typically is NoAuthError. Errors []error } @@ -309,6 +309,12 @@ func (l ServerAuthError) Error() string { return "[" + strings.Join(errs, ", ") + "]" } +// NoAuthError is the unique error that is returned if no +// authentication method has been passed yet. This happens as a normal +// part of the authentication loop, since the client first tries +// 'none' authentication to discover available methods. +var NoAuthError = errors.New("ssh: no auth passed yet") + func (s *connection) serverAuthenticate(config *ServerConfig) (*Permissions, error) { sessionID := s.transport.getSessionID() var cache pubKeyCache @@ -363,7 +369,7 @@ userAuthLoop: } perms = nil - authErr := errors.New("no auth passed yet") + authErr := NoAuthError switch userAuthReq.Method { case "none": diff --git a/vendor/golang.org/x/crypto/ssh/terminal/util_windows.go b/vendor/golang.org/x/crypto/ssh/terminal/util_windows.go index 92944f3b4..4933ac361 100644 --- a/vendor/golang.org/x/crypto/ssh/terminal/util_windows.go +++ b/vendor/golang.org/x/crypto/ssh/terminal/util_windows.go @@ -93,5 +93,13 @@ func ReadPassword(fd int) ([]byte, error) { windows.SetConsoleMode(windows.Handle(fd), old) }() - return readPasswordLine(os.NewFile(uintptr(fd), "stdin")) + var h windows.Handle + p, _ := windows.GetCurrentProcess() + if err := windows.DuplicateHandle(p, windows.Handle(fd), p, &h, 0, false, windows.DUPLICATE_SAME_ACCESS); err != nil { + return nil, err + } + + f := os.NewFile(uintptr(h), "stdin") + defer f.Close() + return readPasswordLine(f) } diff --git a/vendor/golang.org/x/crypto/ssh/transport.go b/vendor/golang.org/x/crypto/ssh/transport.go index 82da0d75c..f6fae1db4 100644 --- a/vendor/golang.org/x/crypto/ssh/transport.go +++ b/vendor/golang.org/x/crypto/ssh/transport.go @@ -233,52 +233,22 @@ var ( clientKeys = direction{[]byte{'A'}, []byte{'C'}, []byte{'E'}} ) -// generateKeys generates key material for IV, MAC and encryption. -func generateKeys(d direction, algs directionAlgorithms, kex *kexResult) (iv, key, macKey []byte) { - cipherMode := cipherModes[algs.Cipher] - macMode := macModes[algs.MAC] - - iv = make([]byte, cipherMode.ivSize) - key = make([]byte, cipherMode.keySize) - macKey = make([]byte, macMode.keySize) - - generateKeyMaterial(iv, d.ivTag, kex) - generateKeyMaterial(key, d.keyTag, kex) - generateKeyMaterial(macKey, d.macKeyTag, kex) - return -} - // setupKeys sets the cipher and MAC keys from kex.K, kex.H and sessionId, as // described in RFC 4253, section 6.4. direction should either be serverKeys // (to setup server->client keys) or clientKeys (for client->server keys). func newPacketCipher(d direction, algs directionAlgorithms, kex *kexResult) (packetCipher, error) { - iv, key, macKey := generateKeys(d, algs, kex) + cipherMode := cipherModes[algs.Cipher] + macMode := macModes[algs.MAC] - if algs.Cipher == gcmCipherID { - return newGCMCipher(iv, key) - } + iv := make([]byte, cipherMode.ivSize) + key := make([]byte, cipherMode.keySize) + macKey := make([]byte, macMode.keySize) - if algs.Cipher == aes128cbcID { - return newAESCBCCipher(iv, key, macKey, algs) - } + generateKeyMaterial(iv, d.ivTag, kex) + generateKeyMaterial(key, d.keyTag, kex) + generateKeyMaterial(macKey, d.macKeyTag, kex) - if algs.Cipher == tripledescbcID { - return newTripleDESCBCCipher(iv, key, macKey, algs) - } - - c := &streamPacketCipher{ - mac: macModes[algs.MAC].new(macKey), - etm: macModes[algs.MAC].etm, - } - c.macResult = make([]byte, c.mac.Size()) - - var err error - c.cipher, err = cipherModes[algs.Cipher].createStream(key, iv) - if err != nil { - return nil, err - } - - return c, nil + return cipherModes[algs.Cipher].create(key, iv, macKey, algs) } // generateKeyMaterial fills out with key material generated from tag, K, H diff --git a/vendor/golang.org/x/sys/unix/affinity_linux.go b/vendor/golang.org/x/sys/unix/affinity_linux.go index d81fbb5b4..72afe3338 100644 --- a/vendor/golang.org/x/sys/unix/affinity_linux.go +++ b/vendor/golang.org/x/sys/unix/affinity_linux.go @@ -16,7 +16,7 @@ const cpuSetSize = _CPU_SETSIZE / _NCPUBITS type CPUSet [cpuSetSize]cpuMask func schedAffinity(trap uintptr, pid int, set *CPUSet) error { - _, _, e := RawSyscall(trap, uintptr(pid), uintptr(unsafe.Sizeof(set)), uintptr(unsafe.Pointer(set))) + _, _, e := RawSyscall(trap, uintptr(pid), uintptr(unsafe.Sizeof(*set)), uintptr(unsafe.Pointer(set))) if e != 0 { return errnoErr(e) } diff --git a/vendor/golang.org/x/sys/unix/dirent.go b/vendor/golang.org/x/sys/unix/dirent.go index bd475812b..95fd35317 100644 --- a/vendor/golang.org/x/sys/unix/dirent.go +++ b/vendor/golang.org/x/sys/unix/dirent.go @@ -6,97 +6,12 @@ package unix -import "unsafe" - -// readInt returns the size-bytes unsigned integer in native byte order at offset off. -func readInt(b []byte, off, size uintptr) (u uint64, ok bool) { - if len(b) < int(off+size) { - return 0, false - } - if isBigEndian { - return readIntBE(b[off:], size), true - } - return readIntLE(b[off:], size), true -} - -func readIntBE(b []byte, size uintptr) uint64 { - switch size { - case 1: - return uint64(b[0]) - case 2: - _ = b[1] // bounds check hint to compiler; see golang.org/issue/14808 - return uint64(b[1]) | uint64(b[0])<<8 - case 4: - _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808 - return uint64(b[3]) | uint64(b[2])<<8 | uint64(b[1])<<16 | uint64(b[0])<<24 - case 8: - _ = b[7] // bounds check hint to compiler; see golang.org/issue/14808 - return uint64(b[7]) | uint64(b[6])<<8 | uint64(b[5])<<16 | uint64(b[4])<<24 | - uint64(b[3])<<32 | uint64(b[2])<<40 | uint64(b[1])<<48 | uint64(b[0])<<56 - default: - panic("syscall: readInt with unsupported size") - } -} - -func readIntLE(b []byte, size uintptr) uint64 { - switch size { - case 1: - return uint64(b[0]) - case 2: - _ = b[1] // bounds check hint to compiler; see golang.org/issue/14808 - return uint64(b[0]) | uint64(b[1])<<8 - case 4: - _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808 - return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 - case 8: - _ = b[7] // bounds check hint to compiler; see golang.org/issue/14808 - return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | - uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 - default: - panic("syscall: readInt with unsupported size") - } -} +import "syscall" // ParseDirent parses up to max directory entries in buf, // appending the names to names. It returns the number of // bytes consumed from buf, the number of entries added // to names, and the new names slice. func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) { - origlen := len(buf) - count = 0 - for max != 0 && len(buf) > 0 { - reclen, ok := direntReclen(buf) - if !ok || reclen > uint64(len(buf)) { - return origlen, count, names - } - rec := buf[:reclen] - buf = buf[reclen:] - ino, ok := direntIno(rec) - if !ok { - break - } - if ino == 0 { // File absent in directory. - continue - } - const namoff = uint64(unsafe.Offsetof(Dirent{}.Name)) - namlen, ok := direntNamlen(rec) - if !ok || namoff+namlen > uint64(len(rec)) { - break - } - name := rec[namoff : namoff+namlen] - for i, c := range name { - if c == 0 { - name = name[:i] - break - } - } - // Check for useless names before allocating a string. - if string(name) == "." || string(name) == ".." { - continue - } - max-- - count++ - names = append(names, string(name)) - } - return origlen - len(buf), count, names + return syscall.ParseDirent(buf, max, names) } diff --git a/vendor/golang.org/x/sys/unix/mkerrors.sh b/vendor/golang.org/x/sys/unix/mkerrors.sh index a452554bc..3b5e2c07b 100755 --- a/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -187,6 +187,7 @@ struct ltchars { #include #include #include +#include #include #include #include @@ -363,6 +364,7 @@ ccflags="$@" $2 ~ /^IGN/ || $2 ~ /^IX(ON|ANY|OFF)$/ || $2 ~ /^IN(LCR|PCK)$/ || + $2 !~ "X86_CR3_PCID_NOFLUSH" && $2 ~ /(^FLU?SH)|(FLU?SH$)/ || $2 ~ /^C(LOCAL|READ|MSPAR|RTSCTS)$/ || $2 == "BRKINT" || @@ -428,6 +430,7 @@ ccflags="$@" $2 ~ /^(TASKSTATS|TS)_/ || $2 ~ /^CGROUPSTATS_/ || $2 ~ /^GENL_/ || + $2 ~ /^STATX_/ || $2 ~ /^UTIME_/ || $2 ~ /^XATTR_(CREATE|REPLACE)/ || $2 ~ /^ATTR_(BIT_MAP_COUNT|(CMN|VOL|FILE)_)/ || diff --git a/vendor/golang.org/x/sys/unix/mkpost.go b/vendor/golang.org/x/sys/unix/mkpost.go index dbdfd0a3f..23590bda3 100644 --- a/vendor/golang.org/x/sys/unix/mkpost.go +++ b/vendor/golang.org/x/sys/unix/mkpost.go @@ -61,14 +61,18 @@ func main() { convertUtsnameRegex := regexp.MustCompile(`((Sys|Node|Domain)name|Release|Version|Machine)(\s+)\[(\d+)\]u?int8`) b = convertUtsnameRegex.ReplaceAll(b, []byte("$1$3[$4]byte")) + // Remove spare fields (e.g. in Statx_t) + spareFieldsRegex := regexp.MustCompile(`X__spare\S*`) + b = spareFieldsRegex.ReplaceAll(b, []byte("_")) + + // Remove cgo padding fields + removePaddingFieldsRegex := regexp.MustCompile(`Pad_cgo_\d+`) + b = removePaddingFieldsRegex.ReplaceAll(b, []byte("_")) + // We refuse to export private fields on s390x if goarch == "s390x" && goos == "linux" { - // Remove cgo padding fields - removeFieldsRegex := regexp.MustCompile(`Pad_cgo_\d+`) - b = removeFieldsRegex.ReplaceAll(b, []byte("_")) - // Remove padding, hidden, or unused fields - removeFieldsRegex = regexp.MustCompile(`X_\S+`) + removeFieldsRegex = regexp.MustCompile(`\bX_\S+`) b = removeFieldsRegex.ReplaceAll(b, []byte("_")) } diff --git a/vendor/golang.org/x/sys/unix/mksyscall.pl b/vendor/golang.org/x/sys/unix/mksyscall.pl index 73e26cafa..1f6b926f8 100755 --- a/vendor/golang.org/x/sys/unix/mksyscall.pl +++ b/vendor/golang.org/x/sys/unix/mksyscall.pl @@ -210,13 +210,13 @@ while(<>) { # Determine which form to use; pad args with zeros. my $asm = "Syscall"; if ($nonblock) { - if ($errvar ne "") { - $asm = "RawSyscall"; - } else { + if ($errvar eq "" && $ENV{'GOOS'} eq "linux") { $asm = "RawSyscallNoError"; + } else { + $asm = "RawSyscall"; } } else { - if ($errvar eq "") { + if ($errvar eq "" && $ENV{'GOOS'} eq "linux") { $asm = "SyscallNoError"; } } @@ -292,10 +292,11 @@ while(<>) { if ($ret[0] eq "_" && $ret[1] eq "_" && $ret[2] eq "_") { $text .= "\t$call\n"; } else { - if ($errvar ne "") { - $text .= "\t$ret[0], $ret[1], $ret[2] := $call\n"; - } else { + if ($errvar eq "" && $ENV{'GOOS'} eq "linux") { + # raw syscall without error on Linux, see golang.org/issue/22924 $text .= "\t$ret[0], $ret[1] := $call\n"; + } else { + $text .= "\t$ret[0], $ret[1], $ret[2] := $call\n"; } } $text .= $body; diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go index d6c472a75..b9598694c 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -36,6 +36,7 @@ func Getwd() (string, error) { return "", ENOTSUP } +// SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets. type SockaddrDatalink struct { Len uint8 Family uint8 @@ -76,18 +77,6 @@ func nametomib(name string) (mib []_C_int, err error) { return buf[0 : n/siz], nil } -func direntIno(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino)) -} - -func direntReclen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) -} - -func direntNamlen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) -} - //sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error) func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) } func PtraceDetach(pid int) (err error) { return ptrace(PT_DETACH, pid, 0, 0) } diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go index 6dfc89a7e..777860bf0 100644 --- a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go +++ b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go @@ -14,6 +14,7 @@ package unix import "unsafe" +// SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets. type SockaddrDatalink struct { Len uint8 Family uint8 @@ -56,22 +57,6 @@ func nametomib(name string) (mib []_C_int, err error) { return buf[0 : n/siz], nil } -func direntIno(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno)) -} - -func direntReclen(buf []byte) (uint64, bool) { - namlen, ok := direntNamlen(buf) - if !ok { - return 0, false - } - return (16 + namlen + 1 + 7) &^ 7, true -} - -func direntNamlen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) -} - //sysnb pipe() (r int, w int, err error) func Pipe(p []int) (err error) { diff --git a/vendor/golang.org/x/sys/unix/syscall_freebsd.go b/vendor/golang.org/x/sys/unix/syscall_freebsd.go index b8ecf6c78..89f2c3fc1 100644 --- a/vendor/golang.org/x/sys/unix/syscall_freebsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_freebsd.go @@ -14,6 +14,7 @@ package unix import "unsafe" +// SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets. type SockaddrDatalink struct { Len uint8 Family uint8 @@ -54,18 +55,6 @@ func nametomib(name string) (mib []_C_int, err error) { return buf[0 : n/siz], nil } -func direntIno(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno)) -} - -func direntReclen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) -} - -func direntNamlen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) -} - //sysnb pipe() (r int, w int, err error) func Pipe(p []int) (err error) { diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index 44628566f..76cf81f57 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -16,13 +16,6 @@ import ( "unsafe" ) -// SyscallNoError may be used instead of Syscall for syscalls that don't fail. -func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) - -// RawSyscallNoError may be used instead of RawSyscall for syscalls that don't -// fail. -func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) - /* * Wrapped */ @@ -420,6 +413,7 @@ func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, _Socklen, error) { return unsafe.Pointer(&sa.raw), sl, nil } +// SockaddrLinklayer implements the Sockaddr interface for AF_PACKET type sockets. type SockaddrLinklayer struct { Protocol uint16 Ifindex int @@ -446,6 +440,7 @@ func (sa *SockaddrLinklayer) sockaddr() (unsafe.Pointer, _Socklen, error) { return unsafe.Pointer(&sa.raw), SizeofSockaddrLinklayer, nil } +// SockaddrNetlink implements the Sockaddr interface for AF_NETLINK type sockets. type SockaddrNetlink struct { Family uint16 Pad uint16 @@ -462,6 +457,8 @@ func (sa *SockaddrNetlink) sockaddr() (unsafe.Pointer, _Socklen, error) { return unsafe.Pointer(&sa.raw), SizeofSockaddrNetlink, nil } +// SockaddrHCI implements the Sockaddr interface for AF_BLUETOOTH type sockets +// using the HCI protocol. type SockaddrHCI struct { Dev uint16 Channel uint16 @@ -475,6 +472,31 @@ func (sa *SockaddrHCI) sockaddr() (unsafe.Pointer, _Socklen, error) { return unsafe.Pointer(&sa.raw), SizeofSockaddrHCI, nil } +// SockaddrL2 implements the Sockaddr interface for AF_BLUETOOTH type sockets +// using the L2CAP protocol. +type SockaddrL2 struct { + PSM uint16 + CID uint16 + Addr [6]uint8 + AddrType uint8 + raw RawSockaddrL2 +} + +func (sa *SockaddrL2) sockaddr() (unsafe.Pointer, _Socklen, error) { + sa.raw.Family = AF_BLUETOOTH + psm := (*[2]byte)(unsafe.Pointer(&sa.raw.Psm)) + psm[0] = byte(sa.PSM) + psm[1] = byte(sa.PSM >> 8) + for i := 0; i < len(sa.Addr); i++ { + sa.raw.Bdaddr[i] = sa.Addr[len(sa.Addr)-1-i] + } + cid := (*[2]byte)(unsafe.Pointer(&sa.raw.Cid)) + cid[0] = byte(sa.CID) + cid[1] = byte(sa.CID >> 8) + sa.raw.Bdaddr_type = sa.AddrType + return unsafe.Pointer(&sa.raw), SizeofSockaddrL2, nil +} + // SockaddrCAN implements the Sockaddr interface for AF_CAN type sockets. // The RxID and TxID fields are used for transport protocol addressing in // (CAN_TP16, CAN_TP20, CAN_MCNET, and CAN_ISOTP), they can be left with @@ -1197,22 +1219,6 @@ func ReadDirent(fd int, buf []byte) (n int, err error) { return Getdents(fd, buf) } -func direntIno(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino)) -} - -func direntReclen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) -} - -func direntNamlen(buf []byte) (uint64, bool) { - reclen, ok := direntReclen(buf) - if !ok { - return 0, false - } - return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true -} - //sys mount(source string, target string, fstype string, flags uintptr, data *byte) (err error) func Mount(source string, target string, fstype string, flags uintptr, data string) (err error) { @@ -1318,6 +1324,7 @@ func Setgid(uid int) (err error) { //sys Setpriority(which int, who int, prio int) (err error) //sys Setxattr(path string, attr string, data []byte, flags int) (err error) +//sys Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) //sys Sync() //sys Syncfs(fd int) (err error) //sysnb Sysinfo(info *Sysinfo_t) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_gc.go b/vendor/golang.org/x/sys/unix/syscall_linux_gc.go new file mode 100644 index 000000000..c26e6ec23 --- /dev/null +++ b/vendor/golang.org/x/sys/unix/syscall_linux_gc.go @@ -0,0 +1,14 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build linux,!gccgo + +package unix + +// SyscallNoError may be used instead of Syscall for syscalls that don't fail. +func SyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) + +// RawSyscallNoError may be used instead of RawSyscall for syscalls that don't +// fail. +func RawSyscallNoError(trap, a1, a2, a3 uintptr) (r1, r2 uintptr) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_test.go b/vendor/golang.org/x/sys/unix/syscall_linux_test.go index 31ae24c3e..78d28792d 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_test.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_test.go @@ -20,9 +20,12 @@ func TestFchmodat(t *testing.T) { defer chtmpdir(t)() touch(t, "file1") - os.Symlink("file1", "symlink1") + err := os.Symlink("file1", "symlink1") + if err != nil { + t.Fatal(err) + } - err := unix.Fchmodat(unix.AT_FDCWD, "symlink1", 0444, 0) + err = unix.Fchmodat(unix.AT_FDCWD, "symlink1", 0444, 0) if err != nil { t.Fatalf("Fchmodat: unexpected error: %v", err) } @@ -239,7 +242,10 @@ func TestFstatat(t *testing.T) { t.Errorf("Fstatat: returned stat does not match Stat") } - os.Symlink("file1", "symlink1") + err = os.Symlink("file1", "symlink1") + if err != nil { + t.Fatal(err) + } err = unix.Lstat("symlink1", &st1) if err != nil { @@ -308,6 +314,96 @@ func TestSchedSetaffinity(t *testing.T) { } } +func TestStatx(t *testing.T) { + var stx unix.Statx_t + err := unix.Statx(unix.AT_FDCWD, ".", 0, 0, &stx) + if err == unix.ENOSYS { + t.Skip("statx syscall is not available, skipping test") + } else if err != nil { + t.Fatalf("Statx: %v", err) + } + + defer chtmpdir(t)() + touch(t, "file1") + + var st unix.Stat_t + err = unix.Stat("file1", &st) + if err != nil { + t.Fatalf("Stat: %v", err) + } + + flags := unix.AT_STATX_SYNC_AS_STAT + err = unix.Statx(unix.AT_FDCWD, "file1", flags, unix.STATX_ALL, &stx) + if err != nil { + t.Fatalf("Statx: %v", err) + } + + if uint32(stx.Mode) != st.Mode { + t.Errorf("Statx: returned stat mode does not match Stat") + } + + atime := unix.StatxTimestamp{Sec: int64(st.Atim.Sec), Nsec: uint32(st.Atim.Nsec)} + ctime := unix.StatxTimestamp{Sec: int64(st.Ctim.Sec), Nsec: uint32(st.Ctim.Nsec)} + mtime := unix.StatxTimestamp{Sec: int64(st.Mtim.Sec), Nsec: uint32(st.Mtim.Nsec)} + + if stx.Atime != atime { + t.Errorf("Statx: returned stat atime does not match Stat") + } + if stx.Ctime != ctime { + t.Errorf("Statx: returned stat ctime does not match Stat") + } + if stx.Mtime != mtime { + t.Errorf("Statx: returned stat mtime does not match Stat") + } + + err = os.Symlink("file1", "symlink1") + if err != nil { + t.Fatal(err) + } + + err = unix.Lstat("symlink1", &st) + if err != nil { + t.Fatalf("Lstat: %v", err) + } + + err = unix.Statx(unix.AT_FDCWD, "symlink1", flags, unix.STATX_BASIC_STATS, &stx) + if err != nil { + t.Fatalf("Statx: %v", err) + } + + // follow symlink, expect a regulat file + if stx.Mode&unix.S_IFREG == 0 { + t.Errorf("Statx: didn't follow symlink") + } + + err = unix.Statx(unix.AT_FDCWD, "symlink1", flags|unix.AT_SYMLINK_NOFOLLOW, unix.STATX_ALL, &stx) + if err != nil { + t.Fatalf("Statx: %v", err) + } + + // follow symlink, expect a symlink + if stx.Mode&unix.S_IFLNK == 0 { + t.Errorf("Statx: unexpectedly followed symlink") + } + if uint32(stx.Mode) != st.Mode { + t.Errorf("Statx: returned stat mode does not match Lstat") + } + + atime = unix.StatxTimestamp{Sec: int64(st.Atim.Sec), Nsec: uint32(st.Atim.Nsec)} + ctime = unix.StatxTimestamp{Sec: int64(st.Ctim.Sec), Nsec: uint32(st.Ctim.Nsec)} + mtime = unix.StatxTimestamp{Sec: int64(st.Mtim.Sec), Nsec: uint32(st.Mtim.Nsec)} + + if stx.Atime != atime { + t.Errorf("Statx: returned stat atime does not match Lstat") + } + if stx.Ctime != ctime { + t.Errorf("Statx: returned stat ctime does not match Lstat") + } + if stx.Mtime != mtime { + t.Errorf("Statx: returned stat mtime does not match Lstat") + } +} + // utilities taken from os/os_test.go func touch(t *testing.T, name string) { diff --git a/vendor/golang.org/x/sys/unix/syscall_netbsd.go b/vendor/golang.org/x/sys/unix/syscall_netbsd.go index d81106d10..71b707838 100644 --- a/vendor/golang.org/x/sys/unix/syscall_netbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_netbsd.go @@ -17,6 +17,7 @@ import ( "unsafe" ) +// SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets. type SockaddrDatalink struct { Len uint8 Family uint8 @@ -92,18 +93,6 @@ func nametomib(name string) (mib []_C_int, err error) { return mib, nil } -func direntIno(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno)) -} - -func direntReclen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) -} - -func direntNamlen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) -} - //sysnb pipe() (fd1 int, fd2 int, err error) func Pipe(p []int) (err error) { if len(p) != 2 { diff --git a/vendor/golang.org/x/sys/unix/syscall_openbsd.go b/vendor/golang.org/x/sys/unix/syscall_openbsd.go index 553c2fb85..37556e775 100644 --- a/vendor/golang.org/x/sys/unix/syscall_openbsd.go +++ b/vendor/golang.org/x/sys/unix/syscall_openbsd.go @@ -18,6 +18,7 @@ import ( "unsafe" ) +// SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets. type SockaddrDatalink struct { Len uint8 Family uint8 @@ -42,18 +43,6 @@ func nametomib(name string) (mib []_C_int, err error) { return nil, EINVAL } -func direntIno(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno)) -} - -func direntReclen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) -} - -func direntNamlen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen)) -} - //sysnb pipe(p *[2]_C_int) (err error) func Pipe(p []int) (err error) { if len(p) != 2 { diff --git a/vendor/golang.org/x/sys/unix/syscall_solaris.go b/vendor/golang.org/x/sys/unix/syscall_solaris.go index 9dc01e742..eca8d1d09 100644 --- a/vendor/golang.org/x/sys/unix/syscall_solaris.go +++ b/vendor/golang.org/x/sys/unix/syscall_solaris.go @@ -23,6 +23,7 @@ type syscallFunc uintptr func rawSysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) +// SockaddrDatalink implements the Sockaddr interface for AF_LINK type sockets. type SockaddrDatalink struct { Family uint16 Index uint16 @@ -34,22 +35,6 @@ type SockaddrDatalink struct { raw RawSockaddrDatalink } -func direntIno(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino)) -} - -func direntReclen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) -} - -func direntNamlen(buf []byte) (uint64, bool) { - reclen, ok := direntReclen(buf) - if !ok { - return 0, false - } - return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true -} - //sysnb pipe(p *[2]_C_int) (n int, err error) func Pipe(p []int) (err error) { diff --git a/vendor/golang.org/x/sys/unix/syscall_unix.go b/vendor/golang.org/x/sys/unix/syscall_unix.go index 35c1cd5ca..cd8f3a9c2 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix.go @@ -50,8 +50,7 @@ func errnoErr(e syscall.Errno) error { return e } -// clen returns the index of the first NULL byte in n or len(n) if n contains no -// NULL byte or len(n) if n contains no NULL byte +// clen returns the index of the first NULL byte in n or len(n) if n contains no NULL byte. func clen(n []byte) int { for i := 0; i < len(n); i++ { if n[i] == 0 { @@ -149,16 +148,19 @@ func Write(fd int, p []byte) (n int, err error) { // creation of IPv6 sockets to return EAFNOSUPPORT. var SocketDisableIPv6 bool +// Sockaddr represents a socket address. type Sockaddr interface { sockaddr() (ptr unsafe.Pointer, len _Socklen, err error) // lowercase; only we can define Sockaddrs } +// SockaddrInet4 implements the Sockaddr interface for AF_INET type sockets. type SockaddrInet4 struct { Port int Addr [4]byte raw RawSockaddrInet4 } +// SockaddrInet6 implements the Sockaddr interface for AF_INET6 type sockets. type SockaddrInet6 struct { Port int ZoneId uint32 @@ -166,6 +168,7 @@ type SockaddrInet6 struct { raw RawSockaddrInet6 } +// SockaddrUnix implements the Sockaddr interface for AF_UNIX type sockets. type SockaddrUnix struct { Name string raw RawSockaddrUnix diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index 8947248f6..fa0637408 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -121,6 +121,7 @@ const ( ARPHRD_PPP = 0x200 ARPHRD_PRONET = 0x4 ARPHRD_RAWHDLC = 0x206 + ARPHRD_RAWIP = 0x207 ARPHRD_ROSE = 0x10e ARPHRD_RSRVD = 0x104 ARPHRD_SIT = 0x308 @@ -390,6 +391,7 @@ const ( ETH_P_DSA = 0x1b ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada + ETH_P_ERSPAN = 0x88be ETH_P_FCOE = 0x8906 ETH_P_FIP = 0x8914 ETH_P_HDLC = 0x19 @@ -398,6 +400,7 @@ const ( ETH_P_IEEE802154 = 0xf6 ETH_P_IEEEPUP = 0xa00 ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IFE = 0xed3e ETH_P_IP = 0x800 ETH_P_IPV6 = 0x86dd ETH_P_IPX = 0x8137 @@ -408,11 +411,13 @@ const ( ETH_P_LOOP = 0x60 ETH_P_LOOPBACK = 0x9000 ETH_P_MACSEC = 0x88e5 + ETH_P_MAP = 0xf9 ETH_P_MOBITEX = 0x15 ETH_P_MPLS_MC = 0x8848 ETH_P_MPLS_UC = 0x8847 ETH_P_MVRP = 0x88f5 ETH_P_NCSI = 0x88f8 + ETH_P_NSH = 0x894f ETH_P_PAE = 0x888e ETH_P_PAUSE = 0x8808 ETH_P_PHONET = 0xf5 @@ -476,6 +481,7 @@ const ( FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 FS_POLICY_FLAGS_VALID = 0x3 + F_ADD_SEALS = 0x409 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -488,6 +494,9 @@ const ( F_GETOWN_EX = 0x10 F_GETPIPE_SZ = 0x408 F_GETSIG = 0xb + F_GET_FILE_RW_HINT = 0x40d + F_GET_RW_HINT = 0x40b + F_GET_SEALS = 0x40a F_LOCK = 0x1 F_NOTIFY = 0x402 F_OFD_GETLK = 0x24 @@ -495,6 +504,10 @@ const ( F_OFD_SETLKW = 0x26 F_OK = 0x0 F_RDLCK = 0x0 + F_SEAL_GROW = 0x4 + F_SEAL_SEAL = 0x1 + F_SEAL_SHRINK = 0x2 + F_SEAL_WRITE = 0x8 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLEASE = 0x400 @@ -506,6 +519,8 @@ const ( F_SETOWN_EX = 0xf F_SETPIPE_SZ = 0x407 F_SETSIG = 0xa + F_SET_FILE_RW_HINT = 0x40e + F_SET_RW_HINT = 0x40c F_SHLCK = 0x8 F_TEST = 0x3 F_TLOCK = 0x2 @@ -561,6 +576,8 @@ const ( IFF_MASTER = 0x400 IFF_MULTICAST = 0x1000 IFF_MULTI_QUEUE = 0x100 + IFF_NAPI = 0x10 + IFF_NAPI_FRAGS = 0x20 IFF_NOARP = 0x80 IFF_NOFILTER = 0x1000 IFF_NOTRAILERS = 0x20 @@ -845,6 +862,7 @@ const ( MADV_FREE = 0x8 MADV_HUGEPAGE = 0xe MADV_HWPOISON = 0x64 + MADV_KEEPONFORK = 0x13 MADV_MERGEABLE = 0xc MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 @@ -853,6 +871,7 @@ const ( MADV_SEQUENTIAL = 0x2 MADV_UNMERGEABLE = 0xd MADV_WILLNEED = 0x3 + MADV_WIPEONFORK = 0x12 MAP_32BIT = 0x40 MAP_ANON = 0x20 MAP_ANONYMOUS = 0x20 @@ -899,6 +918,7 @@ const ( MSG_TRYHARD = 0x4 MSG_WAITALL = 0x100 MSG_WAITFORONE = 0x10000 + MSG_ZEROCOPY = 0x4000000 MS_ACTIVE = 0x40000000 MS_ASYNC = 0x1 MS_BIND = 0x1000 @@ -998,6 +1018,7 @@ const ( NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 NLM_F_MULTI = 0x2 + NLM_F_NONREC = 0x100 NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 @@ -1196,6 +1217,11 @@ const ( PR_SET_TIMING = 0xe PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 + PR_SVE_GET_VL = 0x33 + PR_SVE_SET_VL = 0x32 + PR_SVE_SET_VL_ONEXEC = 0x40000 + PR_SVE_VL_INHERIT = 0x20000 + PR_SVE_VL_LEN_MASK = 0xffff PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 PR_TIMING_STATISTICAL = 0x0 @@ -1282,6 +1308,7 @@ const ( RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 + RTAX_FASTOPEN_NO_COOKIE = 0x11 RTAX_FEATURES = 0xc RTAX_FEATURE_ALLFRAG = 0x8 RTAX_FEATURE_ECN = 0x1 @@ -1292,7 +1319,7 @@ const ( RTAX_INITCWND = 0xb RTAX_INITRWND = 0xe RTAX_LOCK = 0x1 - RTAX_MAX = 0x10 + RTAX_MAX = 0x11 RTAX_MTU = 0x2 RTAX_QUICKACK = 0xf RTAX_REORDERING = 0x9 @@ -1566,6 +1593,7 @@ const ( SOL_SOCKET = 0x1 SOL_TCP = 0x6 SOL_TIPC = 0x10f + SOL_TLS = 0x11a SOL_X25 = 0x106 SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1e @@ -1634,10 +1662,32 @@ const ( SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 SO_VM_SOCKETS_TRUSTED = 0x5 SO_WIFI_STATUS = 0x29 + SO_ZEROCOPY = 0x3c SPLICE_F_GIFT = 0x8 SPLICE_F_MORE = 0x4 SPLICE_F_MOVE = 0x1 SPLICE_F_NONBLOCK = 0x2 + STATX_ALL = 0xfff + STATX_ATIME = 0x20 + STATX_ATTR_APPEND = 0x20 + STATX_ATTR_AUTOMOUNT = 0x1000 + STATX_ATTR_COMPRESSED = 0x4 + STATX_ATTR_ENCRYPTED = 0x800 + STATX_ATTR_IMMUTABLE = 0x10 + STATX_ATTR_NODUMP = 0x40 + STATX_BASIC_STATS = 0x7ff + STATX_BLOCKS = 0x400 + STATX_BTIME = 0x800 + STATX_CTIME = 0x80 + STATX_GID = 0x10 + STATX_INO = 0x100 + STATX_MODE = 0x2 + STATX_MTIME = 0x40 + STATX_NLINK = 0x4 + STATX_SIZE = 0x200 + STATX_TYPE = 0x1 + STATX_UID = 0x8 + STATX__RESERVED = 0x80000000 S_BLKSIZE = 0x200 S_IEXEC = 0x40 S_IFBLK = 0x6000 @@ -1709,6 +1759,8 @@ const ( TCP_MAXWIN = 0xffff TCP_MAX_WINSHIFT = 0xe TCP_MD5SIG = 0xe + TCP_MD5SIG_EXT = 0x20 + TCP_MD5SIG_FLAG_PREFIX = 0x1 TCP_MD5SIG_MAXKEYLEN = 0x50 TCP_MSS = 0x200 TCP_MSS_DEFAULT = 0x218 @@ -1729,6 +1781,7 @@ const ( TCP_THIN_DUPACK = 0x11 TCP_THIN_LINEAR_TIMEOUTS = 0x10 TCP_TIMESTAMP = 0x18 + TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa TCSAFLUSH = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index 4083cb2a8..eb2a22f65 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -121,6 +121,7 @@ const ( ARPHRD_PPP = 0x200 ARPHRD_PRONET = 0x4 ARPHRD_RAWHDLC = 0x206 + ARPHRD_RAWIP = 0x207 ARPHRD_ROSE = 0x10e ARPHRD_RSRVD = 0x104 ARPHRD_SIT = 0x308 @@ -390,6 +391,7 @@ const ( ETH_P_DSA = 0x1b ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada + ETH_P_ERSPAN = 0x88be ETH_P_FCOE = 0x8906 ETH_P_FIP = 0x8914 ETH_P_HDLC = 0x19 @@ -398,6 +400,7 @@ const ( ETH_P_IEEE802154 = 0xf6 ETH_P_IEEEPUP = 0xa00 ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IFE = 0xed3e ETH_P_IP = 0x800 ETH_P_IPV6 = 0x86dd ETH_P_IPX = 0x8137 @@ -408,11 +411,13 @@ const ( ETH_P_LOOP = 0x60 ETH_P_LOOPBACK = 0x9000 ETH_P_MACSEC = 0x88e5 + ETH_P_MAP = 0xf9 ETH_P_MOBITEX = 0x15 ETH_P_MPLS_MC = 0x8848 ETH_P_MPLS_UC = 0x8847 ETH_P_MVRP = 0x88f5 ETH_P_NCSI = 0x88f8 + ETH_P_NSH = 0x894f ETH_P_PAE = 0x888e ETH_P_PAUSE = 0x8808 ETH_P_PHONET = 0xf5 @@ -476,6 +481,7 @@ const ( FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 FS_POLICY_FLAGS_VALID = 0x3 + F_ADD_SEALS = 0x409 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -488,6 +494,9 @@ const ( F_GETOWN_EX = 0x10 F_GETPIPE_SZ = 0x408 F_GETSIG = 0xb + F_GET_FILE_RW_HINT = 0x40d + F_GET_RW_HINT = 0x40b + F_GET_SEALS = 0x40a F_LOCK = 0x1 F_NOTIFY = 0x402 F_OFD_GETLK = 0x24 @@ -495,6 +504,10 @@ const ( F_OFD_SETLKW = 0x26 F_OK = 0x0 F_RDLCK = 0x0 + F_SEAL_GROW = 0x4 + F_SEAL_SEAL = 0x1 + F_SEAL_SHRINK = 0x2 + F_SEAL_WRITE = 0x8 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLEASE = 0x400 @@ -506,6 +519,8 @@ const ( F_SETOWN_EX = 0xf F_SETPIPE_SZ = 0x407 F_SETSIG = 0xa + F_SET_FILE_RW_HINT = 0x40e + F_SET_RW_HINT = 0x40c F_SHLCK = 0x8 F_TEST = 0x3 F_TLOCK = 0x2 @@ -561,6 +576,8 @@ const ( IFF_MASTER = 0x400 IFF_MULTICAST = 0x1000 IFF_MULTI_QUEUE = 0x100 + IFF_NAPI = 0x10 + IFF_NAPI_FRAGS = 0x20 IFF_NOARP = 0x80 IFF_NOFILTER = 0x1000 IFF_NOTRAILERS = 0x20 @@ -845,6 +862,7 @@ const ( MADV_FREE = 0x8 MADV_HUGEPAGE = 0xe MADV_HWPOISON = 0x64 + MADV_KEEPONFORK = 0x13 MADV_MERGEABLE = 0xc MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 @@ -853,6 +871,7 @@ const ( MADV_SEQUENTIAL = 0x2 MADV_UNMERGEABLE = 0xd MADV_WILLNEED = 0x3 + MADV_WIPEONFORK = 0x12 MAP_32BIT = 0x40 MAP_ANON = 0x20 MAP_ANONYMOUS = 0x20 @@ -899,6 +918,7 @@ const ( MSG_TRYHARD = 0x4 MSG_WAITALL = 0x100 MSG_WAITFORONE = 0x10000 + MSG_ZEROCOPY = 0x4000000 MS_ACTIVE = 0x40000000 MS_ASYNC = 0x1 MS_BIND = 0x1000 @@ -998,6 +1018,7 @@ const ( NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 NLM_F_MULTI = 0x2 + NLM_F_NONREC = 0x100 NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 @@ -1196,6 +1217,11 @@ const ( PR_SET_TIMING = 0xe PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 + PR_SVE_GET_VL = 0x33 + PR_SVE_SET_VL = 0x32 + PR_SVE_SET_VL_ONEXEC = 0x40000 + PR_SVE_VL_INHERIT = 0x20000 + PR_SVE_VL_LEN_MASK = 0xffff PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 PR_TIMING_STATISTICAL = 0x0 @@ -1283,6 +1309,7 @@ const ( RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 + RTAX_FASTOPEN_NO_COOKIE = 0x11 RTAX_FEATURES = 0xc RTAX_FEATURE_ALLFRAG = 0x8 RTAX_FEATURE_ECN = 0x1 @@ -1293,7 +1320,7 @@ const ( RTAX_INITCWND = 0xb RTAX_INITRWND = 0xe RTAX_LOCK = 0x1 - RTAX_MAX = 0x10 + RTAX_MAX = 0x11 RTAX_MTU = 0x2 RTAX_QUICKACK = 0xf RTAX_REORDERING = 0x9 @@ -1567,6 +1594,7 @@ const ( SOL_SOCKET = 0x1 SOL_TCP = 0x6 SOL_TIPC = 0x10f + SOL_TLS = 0x11a SOL_X25 = 0x106 SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1e @@ -1635,10 +1663,32 @@ const ( SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 SO_VM_SOCKETS_TRUSTED = 0x5 SO_WIFI_STATUS = 0x29 + SO_ZEROCOPY = 0x3c SPLICE_F_GIFT = 0x8 SPLICE_F_MORE = 0x4 SPLICE_F_MOVE = 0x1 SPLICE_F_NONBLOCK = 0x2 + STATX_ALL = 0xfff + STATX_ATIME = 0x20 + STATX_ATTR_APPEND = 0x20 + STATX_ATTR_AUTOMOUNT = 0x1000 + STATX_ATTR_COMPRESSED = 0x4 + STATX_ATTR_ENCRYPTED = 0x800 + STATX_ATTR_IMMUTABLE = 0x10 + STATX_ATTR_NODUMP = 0x40 + STATX_BASIC_STATS = 0x7ff + STATX_BLOCKS = 0x400 + STATX_BTIME = 0x800 + STATX_CTIME = 0x80 + STATX_GID = 0x10 + STATX_INO = 0x100 + STATX_MODE = 0x2 + STATX_MTIME = 0x40 + STATX_NLINK = 0x4 + STATX_SIZE = 0x200 + STATX_TYPE = 0x1 + STATX_UID = 0x8 + STATX__RESERVED = 0x80000000 S_BLKSIZE = 0x200 S_IEXEC = 0x40 S_IFBLK = 0x6000 @@ -1710,6 +1760,8 @@ const ( TCP_MAXWIN = 0xffff TCP_MAX_WINSHIFT = 0xe TCP_MD5SIG = 0xe + TCP_MD5SIG_EXT = 0x20 + TCP_MD5SIG_FLAG_PREFIX = 0x1 TCP_MD5SIG_MAXKEYLEN = 0x50 TCP_MSS = 0x200 TCP_MSS_DEFAULT = 0x218 @@ -1730,6 +1782,7 @@ const ( TCP_THIN_DUPACK = 0x11 TCP_THIN_LINEAR_TIMEOUTS = 0x10 TCP_TIMESTAMP = 0x18 + TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa TCSAFLUSH = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index 27d38352b..37d212ca4 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -121,6 +121,7 @@ const ( ARPHRD_PPP = 0x200 ARPHRD_PRONET = 0x4 ARPHRD_RAWHDLC = 0x206 + ARPHRD_RAWIP = 0x207 ARPHRD_ROSE = 0x10e ARPHRD_RSRVD = 0x104 ARPHRD_SIT = 0x308 @@ -390,6 +391,7 @@ const ( ETH_P_DSA = 0x1b ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada + ETH_P_ERSPAN = 0x88be ETH_P_FCOE = 0x8906 ETH_P_FIP = 0x8914 ETH_P_HDLC = 0x19 @@ -398,6 +400,7 @@ const ( ETH_P_IEEE802154 = 0xf6 ETH_P_IEEEPUP = 0xa00 ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IFE = 0xed3e ETH_P_IP = 0x800 ETH_P_IPV6 = 0x86dd ETH_P_IPX = 0x8137 @@ -408,11 +411,13 @@ const ( ETH_P_LOOP = 0x60 ETH_P_LOOPBACK = 0x9000 ETH_P_MACSEC = 0x88e5 + ETH_P_MAP = 0xf9 ETH_P_MOBITEX = 0x15 ETH_P_MPLS_MC = 0x8848 ETH_P_MPLS_UC = 0x8847 ETH_P_MVRP = 0x88f5 ETH_P_NCSI = 0x88f8 + ETH_P_NSH = 0x894f ETH_P_PAE = 0x888e ETH_P_PAUSE = 0x8808 ETH_P_PHONET = 0xf5 @@ -476,6 +481,7 @@ const ( FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 FS_POLICY_FLAGS_VALID = 0x3 + F_ADD_SEALS = 0x409 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -488,6 +494,9 @@ const ( F_GETOWN_EX = 0x10 F_GETPIPE_SZ = 0x408 F_GETSIG = 0xb + F_GET_FILE_RW_HINT = 0x40d + F_GET_RW_HINT = 0x40b + F_GET_SEALS = 0x40a F_LOCK = 0x1 F_NOTIFY = 0x402 F_OFD_GETLK = 0x24 @@ -495,6 +504,10 @@ const ( F_OFD_SETLKW = 0x26 F_OK = 0x0 F_RDLCK = 0x0 + F_SEAL_GROW = 0x4 + F_SEAL_SEAL = 0x1 + F_SEAL_SHRINK = 0x2 + F_SEAL_WRITE = 0x8 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLEASE = 0x400 @@ -506,6 +519,8 @@ const ( F_SETOWN_EX = 0xf F_SETPIPE_SZ = 0x407 F_SETSIG = 0xa + F_SET_FILE_RW_HINT = 0x40e + F_SET_RW_HINT = 0x40c F_SHLCK = 0x8 F_TEST = 0x3 F_TLOCK = 0x2 @@ -561,6 +576,8 @@ const ( IFF_MASTER = 0x400 IFF_MULTICAST = 0x1000 IFF_MULTI_QUEUE = 0x100 + IFF_NAPI = 0x10 + IFF_NAPI_FRAGS = 0x20 IFF_NOARP = 0x80 IFF_NOFILTER = 0x1000 IFF_NOTRAILERS = 0x20 @@ -845,6 +862,7 @@ const ( MADV_FREE = 0x8 MADV_HUGEPAGE = 0xe MADV_HWPOISON = 0x64 + MADV_KEEPONFORK = 0x13 MADV_MERGEABLE = 0xc MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 @@ -853,6 +871,7 @@ const ( MADV_SEQUENTIAL = 0x2 MADV_UNMERGEABLE = 0xd MADV_WILLNEED = 0x3 + MADV_WIPEONFORK = 0x12 MAP_ANON = 0x20 MAP_ANONYMOUS = 0x20 MAP_DENYWRITE = 0x800 @@ -898,6 +917,7 @@ const ( MSG_TRYHARD = 0x4 MSG_WAITALL = 0x100 MSG_WAITFORONE = 0x10000 + MSG_ZEROCOPY = 0x4000000 MS_ACTIVE = 0x40000000 MS_ASYNC = 0x1 MS_BIND = 0x1000 @@ -997,6 +1017,7 @@ const ( NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 NLM_F_MULTI = 0x2 + NLM_F_NONREC = 0x100 NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 @@ -1195,6 +1216,11 @@ const ( PR_SET_TIMING = 0xe PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 + PR_SVE_GET_VL = 0x33 + PR_SVE_SET_VL = 0x32 + PR_SVE_SET_VL_ONEXEC = 0x40000 + PR_SVE_VL_INHERIT = 0x20000 + PR_SVE_VL_LEN_MASK = 0xffff PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 PR_TIMING_STATISTICAL = 0x0 @@ -1216,6 +1242,9 @@ const ( PTRACE_EVENT_VFORK_DONE = 0x5 PTRACE_GETCRUNCHREGS = 0x19 PTRACE_GETEVENTMSG = 0x4201 + PTRACE_GETFDPIC = 0x1f + PTRACE_GETFDPIC_EXEC = 0x0 + PTRACE_GETFDPIC_INTERP = 0x1 PTRACE_GETFPREGS = 0xe PTRACE_GETHBPREGS = 0x1d PTRACE_GETREGS = 0xc @@ -1287,6 +1316,7 @@ const ( RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 + RTAX_FASTOPEN_NO_COOKIE = 0x11 RTAX_FEATURES = 0xc RTAX_FEATURE_ALLFRAG = 0x8 RTAX_FEATURE_ECN = 0x1 @@ -1297,7 +1327,7 @@ const ( RTAX_INITCWND = 0xb RTAX_INITRWND = 0xe RTAX_LOCK = 0x1 - RTAX_MAX = 0x10 + RTAX_MAX = 0x11 RTAX_MTU = 0x2 RTAX_QUICKACK = 0xf RTAX_REORDERING = 0x9 @@ -1571,6 +1601,7 @@ const ( SOL_SOCKET = 0x1 SOL_TCP = 0x6 SOL_TIPC = 0x10f + SOL_TLS = 0x11a SOL_X25 = 0x106 SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1e @@ -1639,10 +1670,32 @@ const ( SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 SO_VM_SOCKETS_TRUSTED = 0x5 SO_WIFI_STATUS = 0x29 + SO_ZEROCOPY = 0x3c SPLICE_F_GIFT = 0x8 SPLICE_F_MORE = 0x4 SPLICE_F_MOVE = 0x1 SPLICE_F_NONBLOCK = 0x2 + STATX_ALL = 0xfff + STATX_ATIME = 0x20 + STATX_ATTR_APPEND = 0x20 + STATX_ATTR_AUTOMOUNT = 0x1000 + STATX_ATTR_COMPRESSED = 0x4 + STATX_ATTR_ENCRYPTED = 0x800 + STATX_ATTR_IMMUTABLE = 0x10 + STATX_ATTR_NODUMP = 0x40 + STATX_BASIC_STATS = 0x7ff + STATX_BLOCKS = 0x400 + STATX_BTIME = 0x800 + STATX_CTIME = 0x80 + STATX_GID = 0x10 + STATX_INO = 0x100 + STATX_MODE = 0x2 + STATX_MTIME = 0x40 + STATX_NLINK = 0x4 + STATX_SIZE = 0x200 + STATX_TYPE = 0x1 + STATX_UID = 0x8 + STATX__RESERVED = 0x80000000 S_BLKSIZE = 0x200 S_IEXEC = 0x40 S_IFBLK = 0x6000 @@ -1714,6 +1767,8 @@ const ( TCP_MAXWIN = 0xffff TCP_MAX_WINSHIFT = 0xe TCP_MD5SIG = 0xe + TCP_MD5SIG_EXT = 0x20 + TCP_MD5SIG_FLAG_PREFIX = 0x1 TCP_MD5SIG_MAXKEYLEN = 0x50 TCP_MSS = 0x200 TCP_MSS_DEFAULT = 0x218 @@ -1734,6 +1789,7 @@ const ( TCP_THIN_DUPACK = 0x11 TCP_THIN_LINEAR_TIMEOUTS = 0x10 TCP_TIMESTAMP = 0x18 + TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa TCSAFLUSH = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index 69ad31470..51d84a35c 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -121,6 +121,7 @@ const ( ARPHRD_PPP = 0x200 ARPHRD_PRONET = 0x4 ARPHRD_RAWHDLC = 0x206 + ARPHRD_RAWIP = 0x207 ARPHRD_ROSE = 0x10e ARPHRD_RSRVD = 0x104 ARPHRD_SIT = 0x308 @@ -391,6 +392,7 @@ const ( ETH_P_DSA = 0x1b ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada + ETH_P_ERSPAN = 0x88be ETH_P_FCOE = 0x8906 ETH_P_FIP = 0x8914 ETH_P_HDLC = 0x19 @@ -399,6 +401,7 @@ const ( ETH_P_IEEE802154 = 0xf6 ETH_P_IEEEPUP = 0xa00 ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IFE = 0xed3e ETH_P_IP = 0x800 ETH_P_IPV6 = 0x86dd ETH_P_IPX = 0x8137 @@ -409,11 +412,13 @@ const ( ETH_P_LOOP = 0x60 ETH_P_LOOPBACK = 0x9000 ETH_P_MACSEC = 0x88e5 + ETH_P_MAP = 0xf9 ETH_P_MOBITEX = 0x15 ETH_P_MPLS_MC = 0x8848 ETH_P_MPLS_UC = 0x8847 ETH_P_MVRP = 0x88f5 ETH_P_NCSI = 0x88f8 + ETH_P_NSH = 0x894f ETH_P_PAE = 0x888e ETH_P_PAUSE = 0x8808 ETH_P_PHONET = 0xf5 @@ -478,6 +483,7 @@ const ( FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 FS_POLICY_FLAGS_VALID = 0x3 + F_ADD_SEALS = 0x409 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -490,6 +496,9 @@ const ( F_GETOWN_EX = 0x10 F_GETPIPE_SZ = 0x408 F_GETSIG = 0xb + F_GET_FILE_RW_HINT = 0x40d + F_GET_RW_HINT = 0x40b + F_GET_SEALS = 0x40a F_LOCK = 0x1 F_NOTIFY = 0x402 F_OFD_GETLK = 0x24 @@ -497,6 +506,10 @@ const ( F_OFD_SETLKW = 0x26 F_OK = 0x0 F_RDLCK = 0x0 + F_SEAL_GROW = 0x4 + F_SEAL_SEAL = 0x1 + F_SEAL_SHRINK = 0x2 + F_SEAL_WRITE = 0x8 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLEASE = 0x400 @@ -508,6 +521,8 @@ const ( F_SETOWN_EX = 0xf F_SETPIPE_SZ = 0x407 F_SETSIG = 0xa + F_SET_FILE_RW_HINT = 0x40e + F_SET_RW_HINT = 0x40c F_SHLCK = 0x8 F_TEST = 0x3 F_TLOCK = 0x2 @@ -563,6 +578,8 @@ const ( IFF_MASTER = 0x400 IFF_MULTICAST = 0x1000 IFF_MULTI_QUEUE = 0x100 + IFF_NAPI = 0x10 + IFF_NAPI_FRAGS = 0x20 IFF_NOARP = 0x80 IFF_NOFILTER = 0x1000 IFF_NOTRAILERS = 0x20 @@ -847,6 +864,7 @@ const ( MADV_FREE = 0x8 MADV_HUGEPAGE = 0xe MADV_HWPOISON = 0x64 + MADV_KEEPONFORK = 0x13 MADV_MERGEABLE = 0xc MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 @@ -855,6 +873,7 @@ const ( MADV_SEQUENTIAL = 0x2 MADV_UNMERGEABLE = 0xd MADV_WILLNEED = 0x3 + MADV_WIPEONFORK = 0x12 MAP_ANON = 0x20 MAP_ANONYMOUS = 0x20 MAP_DENYWRITE = 0x800 @@ -900,6 +919,7 @@ const ( MSG_TRYHARD = 0x4 MSG_WAITALL = 0x100 MSG_WAITFORONE = 0x10000 + MSG_ZEROCOPY = 0x4000000 MS_ACTIVE = 0x40000000 MS_ASYNC = 0x1 MS_BIND = 0x1000 @@ -999,6 +1019,7 @@ const ( NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 NLM_F_MULTI = 0x2 + NLM_F_NONREC = 0x100 NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 @@ -1197,6 +1218,11 @@ const ( PR_SET_TIMING = 0xe PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 + PR_SVE_GET_VL = 0x33 + PR_SVE_SET_VL = 0x32 + PR_SVE_SET_VL_ONEXEC = 0x40000 + PR_SVE_VL_INHERIT = 0x20000 + PR_SVE_VL_LEN_MASK = 0xffff PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 PR_TIMING_STATISTICAL = 0x0 @@ -1273,6 +1299,7 @@ const ( RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 + RTAX_FASTOPEN_NO_COOKIE = 0x11 RTAX_FEATURES = 0xc RTAX_FEATURE_ALLFRAG = 0x8 RTAX_FEATURE_ECN = 0x1 @@ -1283,7 +1310,7 @@ const ( RTAX_INITCWND = 0xb RTAX_INITRWND = 0xe RTAX_LOCK = 0x1 - RTAX_MAX = 0x10 + RTAX_MAX = 0x11 RTAX_MTU = 0x2 RTAX_QUICKACK = 0xf RTAX_REORDERING = 0x9 @@ -1557,6 +1584,7 @@ const ( SOL_SOCKET = 0x1 SOL_TCP = 0x6 SOL_TIPC = 0x10f + SOL_TLS = 0x11a SOL_X25 = 0x106 SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1e @@ -1625,10 +1653,32 @@ const ( SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 SO_VM_SOCKETS_TRUSTED = 0x5 SO_WIFI_STATUS = 0x29 + SO_ZEROCOPY = 0x3c SPLICE_F_GIFT = 0x8 SPLICE_F_MORE = 0x4 SPLICE_F_MOVE = 0x1 SPLICE_F_NONBLOCK = 0x2 + STATX_ALL = 0xfff + STATX_ATIME = 0x20 + STATX_ATTR_APPEND = 0x20 + STATX_ATTR_AUTOMOUNT = 0x1000 + STATX_ATTR_COMPRESSED = 0x4 + STATX_ATTR_ENCRYPTED = 0x800 + STATX_ATTR_IMMUTABLE = 0x10 + STATX_ATTR_NODUMP = 0x40 + STATX_BASIC_STATS = 0x7ff + STATX_BLOCKS = 0x400 + STATX_BTIME = 0x800 + STATX_CTIME = 0x80 + STATX_GID = 0x10 + STATX_INO = 0x100 + STATX_MODE = 0x2 + STATX_MTIME = 0x40 + STATX_NLINK = 0x4 + STATX_SIZE = 0x200 + STATX_TYPE = 0x1 + STATX_UID = 0x8 + STATX__RESERVED = 0x80000000 S_BLKSIZE = 0x200 S_IEXEC = 0x40 S_IFBLK = 0x6000 @@ -1700,6 +1750,8 @@ const ( TCP_MAXWIN = 0xffff TCP_MAX_WINSHIFT = 0xe TCP_MD5SIG = 0xe + TCP_MD5SIG_EXT = 0x20 + TCP_MD5SIG_FLAG_PREFIX = 0x1 TCP_MD5SIG_MAXKEYLEN = 0x50 TCP_MSS = 0x200 TCP_MSS_DEFAULT = 0x218 @@ -1720,6 +1772,7 @@ const ( TCP_THIN_DUPACK = 0x11 TCP_THIN_LINEAR_TIMEOUTS = 0x10 TCP_TIMESTAMP = 0x18 + TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa TCSAFLUSH = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index d131a4cc5..8aec95d6c 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -121,6 +121,7 @@ const ( ARPHRD_PPP = 0x200 ARPHRD_PRONET = 0x4 ARPHRD_RAWHDLC = 0x206 + ARPHRD_RAWIP = 0x207 ARPHRD_ROSE = 0x10e ARPHRD_RSRVD = 0x104 ARPHRD_SIT = 0x308 @@ -390,6 +391,7 @@ const ( ETH_P_DSA = 0x1b ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada + ETH_P_ERSPAN = 0x88be ETH_P_FCOE = 0x8906 ETH_P_FIP = 0x8914 ETH_P_HDLC = 0x19 @@ -398,6 +400,7 @@ const ( ETH_P_IEEE802154 = 0xf6 ETH_P_IEEEPUP = 0xa00 ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IFE = 0xed3e ETH_P_IP = 0x800 ETH_P_IPV6 = 0x86dd ETH_P_IPX = 0x8137 @@ -408,11 +411,13 @@ const ( ETH_P_LOOP = 0x60 ETH_P_LOOPBACK = 0x9000 ETH_P_MACSEC = 0x88e5 + ETH_P_MAP = 0xf9 ETH_P_MOBITEX = 0x15 ETH_P_MPLS_MC = 0x8848 ETH_P_MPLS_UC = 0x8847 ETH_P_MVRP = 0x88f5 ETH_P_NCSI = 0x88f8 + ETH_P_NSH = 0x894f ETH_P_PAE = 0x888e ETH_P_PAUSE = 0x8808 ETH_P_PHONET = 0xf5 @@ -476,6 +481,7 @@ const ( FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 FS_POLICY_FLAGS_VALID = 0x3 + F_ADD_SEALS = 0x409 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -488,6 +494,9 @@ const ( F_GETOWN_EX = 0x10 F_GETPIPE_SZ = 0x408 F_GETSIG = 0xb + F_GET_FILE_RW_HINT = 0x40d + F_GET_RW_HINT = 0x40b + F_GET_SEALS = 0x40a F_LOCK = 0x1 F_NOTIFY = 0x402 F_OFD_GETLK = 0x24 @@ -495,6 +504,10 @@ const ( F_OFD_SETLKW = 0x26 F_OK = 0x0 F_RDLCK = 0x0 + F_SEAL_GROW = 0x4 + F_SEAL_SEAL = 0x1 + F_SEAL_SHRINK = 0x2 + F_SEAL_WRITE = 0x8 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLEASE = 0x400 @@ -506,6 +519,8 @@ const ( F_SETOWN_EX = 0xf F_SETPIPE_SZ = 0x407 F_SETSIG = 0xa + F_SET_FILE_RW_HINT = 0x40e + F_SET_RW_HINT = 0x40c F_SHLCK = 0x8 F_TEST = 0x3 F_TLOCK = 0x2 @@ -561,6 +576,8 @@ const ( IFF_MASTER = 0x400 IFF_MULTICAST = 0x1000 IFF_MULTI_QUEUE = 0x100 + IFF_NAPI = 0x10 + IFF_NAPI_FRAGS = 0x20 IFF_NOARP = 0x80 IFF_NOFILTER = 0x1000 IFF_NOTRAILERS = 0x20 @@ -845,6 +862,7 @@ const ( MADV_FREE = 0x8 MADV_HUGEPAGE = 0xe MADV_HWPOISON = 0x64 + MADV_KEEPONFORK = 0x13 MADV_MERGEABLE = 0xc MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 @@ -853,6 +871,7 @@ const ( MADV_SEQUENTIAL = 0x2 MADV_UNMERGEABLE = 0xd MADV_WILLNEED = 0x3 + MADV_WIPEONFORK = 0x12 MAP_ANON = 0x800 MAP_ANONYMOUS = 0x800 MAP_DENYWRITE = 0x2000 @@ -899,6 +918,7 @@ const ( MSG_TRYHARD = 0x4 MSG_WAITALL = 0x100 MSG_WAITFORONE = 0x10000 + MSG_ZEROCOPY = 0x4000000 MS_ACTIVE = 0x40000000 MS_ASYNC = 0x1 MS_BIND = 0x1000 @@ -998,6 +1018,7 @@ const ( NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 NLM_F_MULTI = 0x2 + NLM_F_NONREC = 0x100 NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 @@ -1196,6 +1217,11 @@ const ( PR_SET_TIMING = 0xe PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 + PR_SVE_GET_VL = 0x33 + PR_SVE_SET_VL = 0x32 + PR_SVE_SET_VL_ONEXEC = 0x40000 + PR_SVE_VL_INHERIT = 0x20000 + PR_SVE_VL_LEN_MASK = 0xffff PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 PR_TIMING_STATISTICAL = 0x0 @@ -1284,6 +1310,7 @@ const ( RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 + RTAX_FASTOPEN_NO_COOKIE = 0x11 RTAX_FEATURES = 0xc RTAX_FEATURE_ALLFRAG = 0x8 RTAX_FEATURE_ECN = 0x1 @@ -1294,7 +1321,7 @@ const ( RTAX_INITCWND = 0xb RTAX_INITRWND = 0xe RTAX_LOCK = 0x1 - RTAX_MAX = 0x10 + RTAX_MAX = 0x11 RTAX_MTU = 0x2 RTAX_QUICKACK = 0xf RTAX_REORDERING = 0x9 @@ -1568,6 +1595,7 @@ const ( SOL_SOCKET = 0xffff SOL_TCP = 0x6 SOL_TIPC = 0x10f + SOL_TLS = 0x11a SOL_X25 = 0x106 SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1009 @@ -1637,10 +1665,32 @@ const ( SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 SO_VM_SOCKETS_TRUSTED = 0x5 SO_WIFI_STATUS = 0x29 + SO_ZEROCOPY = 0x3c SPLICE_F_GIFT = 0x8 SPLICE_F_MORE = 0x4 SPLICE_F_MOVE = 0x1 SPLICE_F_NONBLOCK = 0x2 + STATX_ALL = 0xfff + STATX_ATIME = 0x20 + STATX_ATTR_APPEND = 0x20 + STATX_ATTR_AUTOMOUNT = 0x1000 + STATX_ATTR_COMPRESSED = 0x4 + STATX_ATTR_ENCRYPTED = 0x800 + STATX_ATTR_IMMUTABLE = 0x10 + STATX_ATTR_NODUMP = 0x40 + STATX_BASIC_STATS = 0x7ff + STATX_BLOCKS = 0x400 + STATX_BTIME = 0x800 + STATX_CTIME = 0x80 + STATX_GID = 0x10 + STATX_INO = 0x100 + STATX_MODE = 0x2 + STATX_MTIME = 0x40 + STATX_NLINK = 0x4 + STATX_SIZE = 0x200 + STATX_TYPE = 0x1 + STATX_UID = 0x8 + STATX__RESERVED = 0x80000000 S_BLKSIZE = 0x200 S_IEXEC = 0x40 S_IFBLK = 0x6000 @@ -1711,6 +1761,8 @@ const ( TCP_MAXWIN = 0xffff TCP_MAX_WINSHIFT = 0xe TCP_MD5SIG = 0xe + TCP_MD5SIG_EXT = 0x20 + TCP_MD5SIG_FLAG_PREFIX = 0x1 TCP_MD5SIG_MAXKEYLEN = 0x50 TCP_MSS = 0x200 TCP_MSS_DEFAULT = 0x218 @@ -1731,6 +1783,7 @@ const ( TCP_THIN_DUPACK = 0x11 TCP_THIN_LINEAR_TIMEOUTS = 0x10 TCP_TIMESTAMP = 0x18 + TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa TCSAFLUSH = 0x5410 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index 62dd20352..423f48ae0 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -121,6 +121,7 @@ const ( ARPHRD_PPP = 0x200 ARPHRD_PRONET = 0x4 ARPHRD_RAWHDLC = 0x206 + ARPHRD_RAWIP = 0x207 ARPHRD_ROSE = 0x10e ARPHRD_RSRVD = 0x104 ARPHRD_SIT = 0x308 @@ -390,6 +391,7 @@ const ( ETH_P_DSA = 0x1b ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada + ETH_P_ERSPAN = 0x88be ETH_P_FCOE = 0x8906 ETH_P_FIP = 0x8914 ETH_P_HDLC = 0x19 @@ -398,6 +400,7 @@ const ( ETH_P_IEEE802154 = 0xf6 ETH_P_IEEEPUP = 0xa00 ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IFE = 0xed3e ETH_P_IP = 0x800 ETH_P_IPV6 = 0x86dd ETH_P_IPX = 0x8137 @@ -408,11 +411,13 @@ const ( ETH_P_LOOP = 0x60 ETH_P_LOOPBACK = 0x9000 ETH_P_MACSEC = 0x88e5 + ETH_P_MAP = 0xf9 ETH_P_MOBITEX = 0x15 ETH_P_MPLS_MC = 0x8848 ETH_P_MPLS_UC = 0x8847 ETH_P_MVRP = 0x88f5 ETH_P_NCSI = 0x88f8 + ETH_P_NSH = 0x894f ETH_P_PAE = 0x888e ETH_P_PAUSE = 0x8808 ETH_P_PHONET = 0xf5 @@ -476,6 +481,7 @@ const ( FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 FS_POLICY_FLAGS_VALID = 0x3 + F_ADD_SEALS = 0x409 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -488,6 +494,9 @@ const ( F_GETOWN_EX = 0x10 F_GETPIPE_SZ = 0x408 F_GETSIG = 0xb + F_GET_FILE_RW_HINT = 0x40d + F_GET_RW_HINT = 0x40b + F_GET_SEALS = 0x40a F_LOCK = 0x1 F_NOTIFY = 0x402 F_OFD_GETLK = 0x24 @@ -495,6 +504,10 @@ const ( F_OFD_SETLKW = 0x26 F_OK = 0x0 F_RDLCK = 0x0 + F_SEAL_GROW = 0x4 + F_SEAL_SEAL = 0x1 + F_SEAL_SHRINK = 0x2 + F_SEAL_WRITE = 0x8 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLEASE = 0x400 @@ -506,6 +519,8 @@ const ( F_SETOWN_EX = 0xf F_SETPIPE_SZ = 0x407 F_SETSIG = 0xa + F_SET_FILE_RW_HINT = 0x40e + F_SET_RW_HINT = 0x40c F_SHLCK = 0x8 F_TEST = 0x3 F_TLOCK = 0x2 @@ -561,6 +576,8 @@ const ( IFF_MASTER = 0x400 IFF_MULTICAST = 0x1000 IFF_MULTI_QUEUE = 0x100 + IFF_NAPI = 0x10 + IFF_NAPI_FRAGS = 0x20 IFF_NOARP = 0x80 IFF_NOFILTER = 0x1000 IFF_NOTRAILERS = 0x20 @@ -845,6 +862,7 @@ const ( MADV_FREE = 0x8 MADV_HUGEPAGE = 0xe MADV_HWPOISON = 0x64 + MADV_KEEPONFORK = 0x13 MADV_MERGEABLE = 0xc MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 @@ -853,6 +871,7 @@ const ( MADV_SEQUENTIAL = 0x2 MADV_UNMERGEABLE = 0xd MADV_WILLNEED = 0x3 + MADV_WIPEONFORK = 0x12 MAP_ANON = 0x800 MAP_ANONYMOUS = 0x800 MAP_DENYWRITE = 0x2000 @@ -899,6 +918,7 @@ const ( MSG_TRYHARD = 0x4 MSG_WAITALL = 0x100 MSG_WAITFORONE = 0x10000 + MSG_ZEROCOPY = 0x4000000 MS_ACTIVE = 0x40000000 MS_ASYNC = 0x1 MS_BIND = 0x1000 @@ -998,6 +1018,7 @@ const ( NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 NLM_F_MULTI = 0x2 + NLM_F_NONREC = 0x100 NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 @@ -1196,6 +1217,11 @@ const ( PR_SET_TIMING = 0xe PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 + PR_SVE_GET_VL = 0x33 + PR_SVE_SET_VL = 0x32 + PR_SVE_SET_VL_ONEXEC = 0x40000 + PR_SVE_VL_INHERIT = 0x20000 + PR_SVE_VL_LEN_MASK = 0xffff PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 PR_TIMING_STATISTICAL = 0x0 @@ -1284,6 +1310,7 @@ const ( RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 + RTAX_FASTOPEN_NO_COOKIE = 0x11 RTAX_FEATURES = 0xc RTAX_FEATURE_ALLFRAG = 0x8 RTAX_FEATURE_ECN = 0x1 @@ -1294,7 +1321,7 @@ const ( RTAX_INITCWND = 0xb RTAX_INITRWND = 0xe RTAX_LOCK = 0x1 - RTAX_MAX = 0x10 + RTAX_MAX = 0x11 RTAX_MTU = 0x2 RTAX_QUICKACK = 0xf RTAX_REORDERING = 0x9 @@ -1568,6 +1595,7 @@ const ( SOL_SOCKET = 0xffff SOL_TCP = 0x6 SOL_TIPC = 0x10f + SOL_TLS = 0x11a SOL_X25 = 0x106 SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1009 @@ -1637,10 +1665,32 @@ const ( SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 SO_VM_SOCKETS_TRUSTED = 0x5 SO_WIFI_STATUS = 0x29 + SO_ZEROCOPY = 0x3c SPLICE_F_GIFT = 0x8 SPLICE_F_MORE = 0x4 SPLICE_F_MOVE = 0x1 SPLICE_F_NONBLOCK = 0x2 + STATX_ALL = 0xfff + STATX_ATIME = 0x20 + STATX_ATTR_APPEND = 0x20 + STATX_ATTR_AUTOMOUNT = 0x1000 + STATX_ATTR_COMPRESSED = 0x4 + STATX_ATTR_ENCRYPTED = 0x800 + STATX_ATTR_IMMUTABLE = 0x10 + STATX_ATTR_NODUMP = 0x40 + STATX_BASIC_STATS = 0x7ff + STATX_BLOCKS = 0x400 + STATX_BTIME = 0x800 + STATX_CTIME = 0x80 + STATX_GID = 0x10 + STATX_INO = 0x100 + STATX_MODE = 0x2 + STATX_MTIME = 0x40 + STATX_NLINK = 0x4 + STATX_SIZE = 0x200 + STATX_TYPE = 0x1 + STATX_UID = 0x8 + STATX__RESERVED = 0x80000000 S_BLKSIZE = 0x200 S_IEXEC = 0x40 S_IFBLK = 0x6000 @@ -1711,6 +1761,8 @@ const ( TCP_MAXWIN = 0xffff TCP_MAX_WINSHIFT = 0xe TCP_MD5SIG = 0xe + TCP_MD5SIG_EXT = 0x20 + TCP_MD5SIG_FLAG_PREFIX = 0x1 TCP_MD5SIG_MAXKEYLEN = 0x50 TCP_MSS = 0x200 TCP_MSS_DEFAULT = 0x218 @@ -1731,6 +1783,7 @@ const ( TCP_THIN_DUPACK = 0x11 TCP_THIN_LINEAR_TIMEOUTS = 0x10 TCP_TIMESTAMP = 0x18 + TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa TCSAFLUSH = 0x5410 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index dc8e56e30..5e4060701 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -121,6 +121,7 @@ const ( ARPHRD_PPP = 0x200 ARPHRD_PRONET = 0x4 ARPHRD_RAWHDLC = 0x206 + ARPHRD_RAWIP = 0x207 ARPHRD_ROSE = 0x10e ARPHRD_RSRVD = 0x104 ARPHRD_SIT = 0x308 @@ -390,6 +391,7 @@ const ( ETH_P_DSA = 0x1b ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada + ETH_P_ERSPAN = 0x88be ETH_P_FCOE = 0x8906 ETH_P_FIP = 0x8914 ETH_P_HDLC = 0x19 @@ -398,6 +400,7 @@ const ( ETH_P_IEEE802154 = 0xf6 ETH_P_IEEEPUP = 0xa00 ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IFE = 0xed3e ETH_P_IP = 0x800 ETH_P_IPV6 = 0x86dd ETH_P_IPX = 0x8137 @@ -408,11 +411,13 @@ const ( ETH_P_LOOP = 0x60 ETH_P_LOOPBACK = 0x9000 ETH_P_MACSEC = 0x88e5 + ETH_P_MAP = 0xf9 ETH_P_MOBITEX = 0x15 ETH_P_MPLS_MC = 0x8848 ETH_P_MPLS_UC = 0x8847 ETH_P_MVRP = 0x88f5 ETH_P_NCSI = 0x88f8 + ETH_P_NSH = 0x894f ETH_P_PAE = 0x888e ETH_P_PAUSE = 0x8808 ETH_P_PHONET = 0xf5 @@ -476,6 +481,7 @@ const ( FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 FS_POLICY_FLAGS_VALID = 0x3 + F_ADD_SEALS = 0x409 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -488,6 +494,9 @@ const ( F_GETOWN_EX = 0x10 F_GETPIPE_SZ = 0x408 F_GETSIG = 0xb + F_GET_FILE_RW_HINT = 0x40d + F_GET_RW_HINT = 0x40b + F_GET_SEALS = 0x40a F_LOCK = 0x1 F_NOTIFY = 0x402 F_OFD_GETLK = 0x24 @@ -495,6 +504,10 @@ const ( F_OFD_SETLKW = 0x26 F_OK = 0x0 F_RDLCK = 0x0 + F_SEAL_GROW = 0x4 + F_SEAL_SEAL = 0x1 + F_SEAL_SHRINK = 0x2 + F_SEAL_WRITE = 0x8 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLEASE = 0x400 @@ -506,6 +519,8 @@ const ( F_SETOWN_EX = 0xf F_SETPIPE_SZ = 0x407 F_SETSIG = 0xa + F_SET_FILE_RW_HINT = 0x40e + F_SET_RW_HINT = 0x40c F_SHLCK = 0x8 F_TEST = 0x3 F_TLOCK = 0x2 @@ -561,6 +576,8 @@ const ( IFF_MASTER = 0x400 IFF_MULTICAST = 0x1000 IFF_MULTI_QUEUE = 0x100 + IFF_NAPI = 0x10 + IFF_NAPI_FRAGS = 0x20 IFF_NOARP = 0x80 IFF_NOFILTER = 0x1000 IFF_NOTRAILERS = 0x20 @@ -845,6 +862,7 @@ const ( MADV_FREE = 0x8 MADV_HUGEPAGE = 0xe MADV_HWPOISON = 0x64 + MADV_KEEPONFORK = 0x13 MADV_MERGEABLE = 0xc MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 @@ -853,6 +871,7 @@ const ( MADV_SEQUENTIAL = 0x2 MADV_UNMERGEABLE = 0xd MADV_WILLNEED = 0x3 + MADV_WIPEONFORK = 0x12 MAP_ANON = 0x800 MAP_ANONYMOUS = 0x800 MAP_DENYWRITE = 0x2000 @@ -899,6 +918,7 @@ const ( MSG_TRYHARD = 0x4 MSG_WAITALL = 0x100 MSG_WAITFORONE = 0x10000 + MSG_ZEROCOPY = 0x4000000 MS_ACTIVE = 0x40000000 MS_ASYNC = 0x1 MS_BIND = 0x1000 @@ -998,6 +1018,7 @@ const ( NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 NLM_F_MULTI = 0x2 + NLM_F_NONREC = 0x100 NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 @@ -1196,6 +1217,11 @@ const ( PR_SET_TIMING = 0xe PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 + PR_SVE_GET_VL = 0x33 + PR_SVE_SET_VL = 0x32 + PR_SVE_SET_VL_ONEXEC = 0x40000 + PR_SVE_VL_INHERIT = 0x20000 + PR_SVE_VL_LEN_MASK = 0xffff PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 PR_TIMING_STATISTICAL = 0x0 @@ -1284,6 +1310,7 @@ const ( RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 + RTAX_FASTOPEN_NO_COOKIE = 0x11 RTAX_FEATURES = 0xc RTAX_FEATURE_ALLFRAG = 0x8 RTAX_FEATURE_ECN = 0x1 @@ -1294,7 +1321,7 @@ const ( RTAX_INITCWND = 0xb RTAX_INITRWND = 0xe RTAX_LOCK = 0x1 - RTAX_MAX = 0x10 + RTAX_MAX = 0x11 RTAX_MTU = 0x2 RTAX_QUICKACK = 0xf RTAX_REORDERING = 0x9 @@ -1568,6 +1595,7 @@ const ( SOL_SOCKET = 0xffff SOL_TCP = 0x6 SOL_TIPC = 0x10f + SOL_TLS = 0x11a SOL_X25 = 0x106 SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1009 @@ -1637,10 +1665,32 @@ const ( SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 SO_VM_SOCKETS_TRUSTED = 0x5 SO_WIFI_STATUS = 0x29 + SO_ZEROCOPY = 0x3c SPLICE_F_GIFT = 0x8 SPLICE_F_MORE = 0x4 SPLICE_F_MOVE = 0x1 SPLICE_F_NONBLOCK = 0x2 + STATX_ALL = 0xfff + STATX_ATIME = 0x20 + STATX_ATTR_APPEND = 0x20 + STATX_ATTR_AUTOMOUNT = 0x1000 + STATX_ATTR_COMPRESSED = 0x4 + STATX_ATTR_ENCRYPTED = 0x800 + STATX_ATTR_IMMUTABLE = 0x10 + STATX_ATTR_NODUMP = 0x40 + STATX_BASIC_STATS = 0x7ff + STATX_BLOCKS = 0x400 + STATX_BTIME = 0x800 + STATX_CTIME = 0x80 + STATX_GID = 0x10 + STATX_INO = 0x100 + STATX_MODE = 0x2 + STATX_MTIME = 0x40 + STATX_NLINK = 0x4 + STATX_SIZE = 0x200 + STATX_TYPE = 0x1 + STATX_UID = 0x8 + STATX__RESERVED = 0x80000000 S_BLKSIZE = 0x200 S_IEXEC = 0x40 S_IFBLK = 0x6000 @@ -1711,6 +1761,8 @@ const ( TCP_MAXWIN = 0xffff TCP_MAX_WINSHIFT = 0xe TCP_MD5SIG = 0xe + TCP_MD5SIG_EXT = 0x20 + TCP_MD5SIG_FLAG_PREFIX = 0x1 TCP_MD5SIG_MAXKEYLEN = 0x50 TCP_MSS = 0x200 TCP_MSS_DEFAULT = 0x218 @@ -1731,6 +1783,7 @@ const ( TCP_THIN_DUPACK = 0x11 TCP_THIN_LINEAR_TIMEOUTS = 0x10 TCP_TIMESTAMP = 0x18 + TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa TCSAFLUSH = 0x5410 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index 906766254..b9b9d6374 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -121,6 +121,7 @@ const ( ARPHRD_PPP = 0x200 ARPHRD_PRONET = 0x4 ARPHRD_RAWHDLC = 0x206 + ARPHRD_RAWIP = 0x207 ARPHRD_ROSE = 0x10e ARPHRD_RSRVD = 0x104 ARPHRD_SIT = 0x308 @@ -390,6 +391,7 @@ const ( ETH_P_DSA = 0x1b ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada + ETH_P_ERSPAN = 0x88be ETH_P_FCOE = 0x8906 ETH_P_FIP = 0x8914 ETH_P_HDLC = 0x19 @@ -398,6 +400,7 @@ const ( ETH_P_IEEE802154 = 0xf6 ETH_P_IEEEPUP = 0xa00 ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IFE = 0xed3e ETH_P_IP = 0x800 ETH_P_IPV6 = 0x86dd ETH_P_IPX = 0x8137 @@ -408,11 +411,13 @@ const ( ETH_P_LOOP = 0x60 ETH_P_LOOPBACK = 0x9000 ETH_P_MACSEC = 0x88e5 + ETH_P_MAP = 0xf9 ETH_P_MOBITEX = 0x15 ETH_P_MPLS_MC = 0x8848 ETH_P_MPLS_UC = 0x8847 ETH_P_MVRP = 0x88f5 ETH_P_NCSI = 0x88f8 + ETH_P_NSH = 0x894f ETH_P_PAE = 0x888e ETH_P_PAUSE = 0x8808 ETH_P_PHONET = 0xf5 @@ -476,6 +481,7 @@ const ( FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 FS_POLICY_FLAGS_VALID = 0x3 + F_ADD_SEALS = 0x409 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -488,6 +494,9 @@ const ( F_GETOWN_EX = 0x10 F_GETPIPE_SZ = 0x408 F_GETSIG = 0xb + F_GET_FILE_RW_HINT = 0x40d + F_GET_RW_HINT = 0x40b + F_GET_SEALS = 0x40a F_LOCK = 0x1 F_NOTIFY = 0x402 F_OFD_GETLK = 0x24 @@ -495,6 +504,10 @@ const ( F_OFD_SETLKW = 0x26 F_OK = 0x0 F_RDLCK = 0x0 + F_SEAL_GROW = 0x4 + F_SEAL_SEAL = 0x1 + F_SEAL_SHRINK = 0x2 + F_SEAL_WRITE = 0x8 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLEASE = 0x400 @@ -506,6 +519,8 @@ const ( F_SETOWN_EX = 0xf F_SETPIPE_SZ = 0x407 F_SETSIG = 0xa + F_SET_FILE_RW_HINT = 0x40e + F_SET_RW_HINT = 0x40c F_SHLCK = 0x8 F_TEST = 0x3 F_TLOCK = 0x2 @@ -561,6 +576,8 @@ const ( IFF_MASTER = 0x400 IFF_MULTICAST = 0x1000 IFF_MULTI_QUEUE = 0x100 + IFF_NAPI = 0x10 + IFF_NAPI_FRAGS = 0x20 IFF_NOARP = 0x80 IFF_NOFILTER = 0x1000 IFF_NOTRAILERS = 0x20 @@ -845,6 +862,7 @@ const ( MADV_FREE = 0x8 MADV_HUGEPAGE = 0xe MADV_HWPOISON = 0x64 + MADV_KEEPONFORK = 0x13 MADV_MERGEABLE = 0xc MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 @@ -853,6 +871,7 @@ const ( MADV_SEQUENTIAL = 0x2 MADV_UNMERGEABLE = 0xd MADV_WILLNEED = 0x3 + MADV_WIPEONFORK = 0x12 MAP_ANON = 0x800 MAP_ANONYMOUS = 0x800 MAP_DENYWRITE = 0x2000 @@ -899,6 +918,7 @@ const ( MSG_TRYHARD = 0x4 MSG_WAITALL = 0x100 MSG_WAITFORONE = 0x10000 + MSG_ZEROCOPY = 0x4000000 MS_ACTIVE = 0x40000000 MS_ASYNC = 0x1 MS_BIND = 0x1000 @@ -998,6 +1018,7 @@ const ( NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 NLM_F_MULTI = 0x2 + NLM_F_NONREC = 0x100 NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 @@ -1196,6 +1217,11 @@ const ( PR_SET_TIMING = 0xe PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 + PR_SVE_GET_VL = 0x33 + PR_SVE_SET_VL = 0x32 + PR_SVE_SET_VL_ONEXEC = 0x40000 + PR_SVE_VL_INHERIT = 0x20000 + PR_SVE_VL_LEN_MASK = 0xffff PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 PR_TIMING_STATISTICAL = 0x0 @@ -1284,6 +1310,7 @@ const ( RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 + RTAX_FASTOPEN_NO_COOKIE = 0x11 RTAX_FEATURES = 0xc RTAX_FEATURE_ALLFRAG = 0x8 RTAX_FEATURE_ECN = 0x1 @@ -1294,7 +1321,7 @@ const ( RTAX_INITCWND = 0xb RTAX_INITRWND = 0xe RTAX_LOCK = 0x1 - RTAX_MAX = 0x10 + RTAX_MAX = 0x11 RTAX_MTU = 0x2 RTAX_QUICKACK = 0xf RTAX_REORDERING = 0x9 @@ -1568,6 +1595,7 @@ const ( SOL_SOCKET = 0xffff SOL_TCP = 0x6 SOL_TIPC = 0x10f + SOL_TLS = 0x11a SOL_X25 = 0x106 SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1009 @@ -1637,10 +1665,32 @@ const ( SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 SO_VM_SOCKETS_TRUSTED = 0x5 SO_WIFI_STATUS = 0x29 + SO_ZEROCOPY = 0x3c SPLICE_F_GIFT = 0x8 SPLICE_F_MORE = 0x4 SPLICE_F_MOVE = 0x1 SPLICE_F_NONBLOCK = 0x2 + STATX_ALL = 0xfff + STATX_ATIME = 0x20 + STATX_ATTR_APPEND = 0x20 + STATX_ATTR_AUTOMOUNT = 0x1000 + STATX_ATTR_COMPRESSED = 0x4 + STATX_ATTR_ENCRYPTED = 0x800 + STATX_ATTR_IMMUTABLE = 0x10 + STATX_ATTR_NODUMP = 0x40 + STATX_BASIC_STATS = 0x7ff + STATX_BLOCKS = 0x400 + STATX_BTIME = 0x800 + STATX_CTIME = 0x80 + STATX_GID = 0x10 + STATX_INO = 0x100 + STATX_MODE = 0x2 + STATX_MTIME = 0x40 + STATX_NLINK = 0x4 + STATX_SIZE = 0x200 + STATX_TYPE = 0x1 + STATX_UID = 0x8 + STATX__RESERVED = 0x80000000 S_BLKSIZE = 0x200 S_IEXEC = 0x40 S_IFBLK = 0x6000 @@ -1711,6 +1761,8 @@ const ( TCP_MAXWIN = 0xffff TCP_MAX_WINSHIFT = 0xe TCP_MD5SIG = 0xe + TCP_MD5SIG_EXT = 0x20 + TCP_MD5SIG_FLAG_PREFIX = 0x1 TCP_MD5SIG_MAXKEYLEN = 0x50 TCP_MSS = 0x200 TCP_MSS_DEFAULT = 0x218 @@ -1731,6 +1783,7 @@ const ( TCP_THIN_DUPACK = 0x11 TCP_THIN_LINEAR_TIMEOUTS = 0x10 TCP_TIMESTAMP = 0x18 + TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa TCSAFLUSH = 0x5410 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index f6ca82c71..509418ef2 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -121,6 +121,7 @@ const ( ARPHRD_PPP = 0x200 ARPHRD_PRONET = 0x4 ARPHRD_RAWHDLC = 0x206 + ARPHRD_RAWIP = 0x207 ARPHRD_ROSE = 0x10e ARPHRD_RSRVD = 0x104 ARPHRD_SIT = 0x308 @@ -390,6 +391,7 @@ const ( ETH_P_DSA = 0x1b ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada + ETH_P_ERSPAN = 0x88be ETH_P_FCOE = 0x8906 ETH_P_FIP = 0x8914 ETH_P_HDLC = 0x19 @@ -398,6 +400,7 @@ const ( ETH_P_IEEE802154 = 0xf6 ETH_P_IEEEPUP = 0xa00 ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IFE = 0xed3e ETH_P_IP = 0x800 ETH_P_IPV6 = 0x86dd ETH_P_IPX = 0x8137 @@ -408,11 +411,13 @@ const ( ETH_P_LOOP = 0x60 ETH_P_LOOPBACK = 0x9000 ETH_P_MACSEC = 0x88e5 + ETH_P_MAP = 0xf9 ETH_P_MOBITEX = 0x15 ETH_P_MPLS_MC = 0x8848 ETH_P_MPLS_UC = 0x8847 ETH_P_MVRP = 0x88f5 ETH_P_NCSI = 0x88f8 + ETH_P_NSH = 0x894f ETH_P_PAE = 0x888e ETH_P_PAUSE = 0x8808 ETH_P_PHONET = 0xf5 @@ -476,6 +481,7 @@ const ( FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 FS_POLICY_FLAGS_VALID = 0x3 + F_ADD_SEALS = 0x409 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -488,6 +494,9 @@ const ( F_GETOWN_EX = 0x10 F_GETPIPE_SZ = 0x408 F_GETSIG = 0xb + F_GET_FILE_RW_HINT = 0x40d + F_GET_RW_HINT = 0x40b + F_GET_SEALS = 0x40a F_LOCK = 0x1 F_NOTIFY = 0x402 F_OFD_GETLK = 0x24 @@ -495,6 +504,10 @@ const ( F_OFD_SETLKW = 0x26 F_OK = 0x0 F_RDLCK = 0x0 + F_SEAL_GROW = 0x4 + F_SEAL_SEAL = 0x1 + F_SEAL_SHRINK = 0x2 + F_SEAL_WRITE = 0x8 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLEASE = 0x400 @@ -506,6 +519,8 @@ const ( F_SETOWN_EX = 0xf F_SETPIPE_SZ = 0x407 F_SETSIG = 0xa + F_SET_FILE_RW_HINT = 0x40e + F_SET_RW_HINT = 0x40c F_SHLCK = 0x8 F_TEST = 0x3 F_TLOCK = 0x2 @@ -561,6 +576,8 @@ const ( IFF_MASTER = 0x400 IFF_MULTICAST = 0x1000 IFF_MULTI_QUEUE = 0x100 + IFF_NAPI = 0x10 + IFF_NAPI_FRAGS = 0x20 IFF_NOARP = 0x80 IFF_NOFILTER = 0x1000 IFF_NOTRAILERS = 0x20 @@ -845,6 +862,7 @@ const ( MADV_FREE = 0x8 MADV_HUGEPAGE = 0xe MADV_HWPOISON = 0x64 + MADV_KEEPONFORK = 0x13 MADV_MERGEABLE = 0xc MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 @@ -853,6 +871,7 @@ const ( MADV_SEQUENTIAL = 0x2 MADV_UNMERGEABLE = 0xd MADV_WILLNEED = 0x3 + MADV_WIPEONFORK = 0x12 MAP_ANON = 0x20 MAP_ANONYMOUS = 0x20 MAP_DENYWRITE = 0x800 @@ -898,6 +917,7 @@ const ( MSG_TRYHARD = 0x4 MSG_WAITALL = 0x100 MSG_WAITFORONE = 0x10000 + MSG_ZEROCOPY = 0x4000000 MS_ACTIVE = 0x40000000 MS_ASYNC = 0x1 MS_BIND = 0x1000 @@ -999,6 +1019,7 @@ const ( NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 NLM_F_MULTI = 0x2 + NLM_F_NONREC = 0x100 NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 @@ -1198,6 +1219,11 @@ const ( PR_SET_TIMING = 0xe PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 + PR_SVE_GET_VL = 0x33 + PR_SVE_SET_VL = 0x32 + PR_SVE_SET_VL_ONEXEC = 0x40000 + PR_SVE_VL_INHERIT = 0x20000 + PR_SVE_VL_LEN_MASK = 0xffff PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 PR_TIMING_STATISTICAL = 0x0 @@ -1340,6 +1366,7 @@ const ( RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 + RTAX_FASTOPEN_NO_COOKIE = 0x11 RTAX_FEATURES = 0xc RTAX_FEATURE_ALLFRAG = 0x8 RTAX_FEATURE_ECN = 0x1 @@ -1350,7 +1377,7 @@ const ( RTAX_INITCWND = 0xb RTAX_INITRWND = 0xe RTAX_LOCK = 0x1 - RTAX_MAX = 0x10 + RTAX_MAX = 0x11 RTAX_MTU = 0x2 RTAX_QUICKACK = 0xf RTAX_REORDERING = 0x9 @@ -1624,6 +1651,7 @@ const ( SOL_SOCKET = 0x1 SOL_TCP = 0x6 SOL_TIPC = 0x10f + SOL_TLS = 0x11a SOL_X25 = 0x106 SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1e @@ -1692,10 +1720,32 @@ const ( SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 SO_VM_SOCKETS_TRUSTED = 0x5 SO_WIFI_STATUS = 0x29 + SO_ZEROCOPY = 0x3c SPLICE_F_GIFT = 0x8 SPLICE_F_MORE = 0x4 SPLICE_F_MOVE = 0x1 SPLICE_F_NONBLOCK = 0x2 + STATX_ALL = 0xfff + STATX_ATIME = 0x20 + STATX_ATTR_APPEND = 0x20 + STATX_ATTR_AUTOMOUNT = 0x1000 + STATX_ATTR_COMPRESSED = 0x4 + STATX_ATTR_ENCRYPTED = 0x800 + STATX_ATTR_IMMUTABLE = 0x10 + STATX_ATTR_NODUMP = 0x40 + STATX_BASIC_STATS = 0x7ff + STATX_BLOCKS = 0x400 + STATX_BTIME = 0x800 + STATX_CTIME = 0x80 + STATX_GID = 0x10 + STATX_INO = 0x100 + STATX_MODE = 0x2 + STATX_MTIME = 0x40 + STATX_NLINK = 0x4 + STATX_SIZE = 0x200 + STATX_TYPE = 0x1 + STATX_UID = 0x8 + STATX__RESERVED = 0x80000000 S_BLKSIZE = 0x200 S_IEXEC = 0x40 S_IFBLK = 0x6000 @@ -1765,6 +1815,8 @@ const ( TCP_MAXWIN = 0xffff TCP_MAX_WINSHIFT = 0xe TCP_MD5SIG = 0xe + TCP_MD5SIG_EXT = 0x20 + TCP_MD5SIG_FLAG_PREFIX = 0x1 TCP_MD5SIG_MAXKEYLEN = 0x50 TCP_MSS = 0x200 TCP_MSS_DEFAULT = 0x218 @@ -1785,6 +1837,7 @@ const ( TCP_THIN_DUPACK = 0x11 TCP_THIN_LINEAR_TIMEOUTS = 0x10 TCP_TIMESTAMP = 0x18 + TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa TCSAFLUSH = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index ddd256254..26afbb8de 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -121,6 +121,7 @@ const ( ARPHRD_PPP = 0x200 ARPHRD_PRONET = 0x4 ARPHRD_RAWHDLC = 0x206 + ARPHRD_RAWIP = 0x207 ARPHRD_ROSE = 0x10e ARPHRD_RSRVD = 0x104 ARPHRD_SIT = 0x308 @@ -390,6 +391,7 @@ const ( ETH_P_DSA = 0x1b ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada + ETH_P_ERSPAN = 0x88be ETH_P_FCOE = 0x8906 ETH_P_FIP = 0x8914 ETH_P_HDLC = 0x19 @@ -398,6 +400,7 @@ const ( ETH_P_IEEE802154 = 0xf6 ETH_P_IEEEPUP = 0xa00 ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IFE = 0xed3e ETH_P_IP = 0x800 ETH_P_IPV6 = 0x86dd ETH_P_IPX = 0x8137 @@ -408,11 +411,13 @@ const ( ETH_P_LOOP = 0x60 ETH_P_LOOPBACK = 0x9000 ETH_P_MACSEC = 0x88e5 + ETH_P_MAP = 0xf9 ETH_P_MOBITEX = 0x15 ETH_P_MPLS_MC = 0x8848 ETH_P_MPLS_UC = 0x8847 ETH_P_MVRP = 0x88f5 ETH_P_NCSI = 0x88f8 + ETH_P_NSH = 0x894f ETH_P_PAE = 0x888e ETH_P_PAUSE = 0x8808 ETH_P_PHONET = 0xf5 @@ -476,6 +481,7 @@ const ( FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 FS_POLICY_FLAGS_VALID = 0x3 + F_ADD_SEALS = 0x409 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -488,6 +494,9 @@ const ( F_GETOWN_EX = 0x10 F_GETPIPE_SZ = 0x408 F_GETSIG = 0xb + F_GET_FILE_RW_HINT = 0x40d + F_GET_RW_HINT = 0x40b + F_GET_SEALS = 0x40a F_LOCK = 0x1 F_NOTIFY = 0x402 F_OFD_GETLK = 0x24 @@ -495,6 +504,10 @@ const ( F_OFD_SETLKW = 0x26 F_OK = 0x0 F_RDLCK = 0x0 + F_SEAL_GROW = 0x4 + F_SEAL_SEAL = 0x1 + F_SEAL_SHRINK = 0x2 + F_SEAL_WRITE = 0x8 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLEASE = 0x400 @@ -506,6 +519,8 @@ const ( F_SETOWN_EX = 0xf F_SETPIPE_SZ = 0x407 F_SETSIG = 0xa + F_SET_FILE_RW_HINT = 0x40e + F_SET_RW_HINT = 0x40c F_SHLCK = 0x8 F_TEST = 0x3 F_TLOCK = 0x2 @@ -561,6 +576,8 @@ const ( IFF_MASTER = 0x400 IFF_MULTICAST = 0x1000 IFF_MULTI_QUEUE = 0x100 + IFF_NAPI = 0x10 + IFF_NAPI_FRAGS = 0x20 IFF_NOARP = 0x80 IFF_NOFILTER = 0x1000 IFF_NOTRAILERS = 0x20 @@ -845,6 +862,7 @@ const ( MADV_FREE = 0x8 MADV_HUGEPAGE = 0xe MADV_HWPOISON = 0x64 + MADV_KEEPONFORK = 0x13 MADV_MERGEABLE = 0xc MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 @@ -853,6 +871,7 @@ const ( MADV_SEQUENTIAL = 0x2 MADV_UNMERGEABLE = 0xd MADV_WILLNEED = 0x3 + MADV_WIPEONFORK = 0x12 MAP_ANON = 0x20 MAP_ANONYMOUS = 0x20 MAP_DENYWRITE = 0x800 @@ -898,6 +917,7 @@ const ( MSG_TRYHARD = 0x4 MSG_WAITALL = 0x100 MSG_WAITFORONE = 0x10000 + MSG_ZEROCOPY = 0x4000000 MS_ACTIVE = 0x40000000 MS_ASYNC = 0x1 MS_BIND = 0x1000 @@ -999,6 +1019,7 @@ const ( NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 NLM_F_MULTI = 0x2 + NLM_F_NONREC = 0x100 NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 @@ -1198,6 +1219,11 @@ const ( PR_SET_TIMING = 0xe PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 + PR_SVE_GET_VL = 0x33 + PR_SVE_SET_VL = 0x32 + PR_SVE_SET_VL_ONEXEC = 0x40000 + PR_SVE_VL_INHERIT = 0x20000 + PR_SVE_VL_LEN_MASK = 0xffff PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 PR_TIMING_STATISTICAL = 0x0 @@ -1340,6 +1366,7 @@ const ( RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 + RTAX_FASTOPEN_NO_COOKIE = 0x11 RTAX_FEATURES = 0xc RTAX_FEATURE_ALLFRAG = 0x8 RTAX_FEATURE_ECN = 0x1 @@ -1350,7 +1377,7 @@ const ( RTAX_INITCWND = 0xb RTAX_INITRWND = 0xe RTAX_LOCK = 0x1 - RTAX_MAX = 0x10 + RTAX_MAX = 0x11 RTAX_MTU = 0x2 RTAX_QUICKACK = 0xf RTAX_REORDERING = 0x9 @@ -1624,6 +1651,7 @@ const ( SOL_SOCKET = 0x1 SOL_TCP = 0x6 SOL_TIPC = 0x10f + SOL_TLS = 0x11a SOL_X25 = 0x106 SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1e @@ -1692,10 +1720,32 @@ const ( SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 SO_VM_SOCKETS_TRUSTED = 0x5 SO_WIFI_STATUS = 0x29 + SO_ZEROCOPY = 0x3c SPLICE_F_GIFT = 0x8 SPLICE_F_MORE = 0x4 SPLICE_F_MOVE = 0x1 SPLICE_F_NONBLOCK = 0x2 + STATX_ALL = 0xfff + STATX_ATIME = 0x20 + STATX_ATTR_APPEND = 0x20 + STATX_ATTR_AUTOMOUNT = 0x1000 + STATX_ATTR_COMPRESSED = 0x4 + STATX_ATTR_ENCRYPTED = 0x800 + STATX_ATTR_IMMUTABLE = 0x10 + STATX_ATTR_NODUMP = 0x40 + STATX_BASIC_STATS = 0x7ff + STATX_BLOCKS = 0x400 + STATX_BTIME = 0x800 + STATX_CTIME = 0x80 + STATX_GID = 0x10 + STATX_INO = 0x100 + STATX_MODE = 0x2 + STATX_MTIME = 0x40 + STATX_NLINK = 0x4 + STATX_SIZE = 0x200 + STATX_TYPE = 0x1 + STATX_UID = 0x8 + STATX__RESERVED = 0x80000000 S_BLKSIZE = 0x200 S_IEXEC = 0x40 S_IFBLK = 0x6000 @@ -1765,6 +1815,8 @@ const ( TCP_MAXWIN = 0xffff TCP_MAX_WINSHIFT = 0xe TCP_MD5SIG = 0xe + TCP_MD5SIG_EXT = 0x20 + TCP_MD5SIG_FLAG_PREFIX = 0x1 TCP_MD5SIG_MAXKEYLEN = 0x50 TCP_MSS = 0x200 TCP_MSS_DEFAULT = 0x218 @@ -1785,6 +1837,7 @@ const ( TCP_THIN_DUPACK = 0x11 TCP_THIN_LINEAR_TIMEOUTS = 0x10 TCP_TIMESTAMP = 0x18 + TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa TCSAFLUSH = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index fc304a68f..eeb9941de 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -121,6 +121,7 @@ const ( ARPHRD_PPP = 0x200 ARPHRD_PRONET = 0x4 ARPHRD_RAWHDLC = 0x206 + ARPHRD_RAWIP = 0x207 ARPHRD_ROSE = 0x10e ARPHRD_RSRVD = 0x104 ARPHRD_SIT = 0x308 @@ -390,6 +391,7 @@ const ( ETH_P_DSA = 0x1b ETH_P_ECONET = 0x18 ETH_P_EDSA = 0xdada + ETH_P_ERSPAN = 0x88be ETH_P_FCOE = 0x8906 ETH_P_FIP = 0x8914 ETH_P_HDLC = 0x19 @@ -398,6 +400,7 @@ const ( ETH_P_IEEE802154 = 0xf6 ETH_P_IEEEPUP = 0xa00 ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IFE = 0xed3e ETH_P_IP = 0x800 ETH_P_IPV6 = 0x86dd ETH_P_IPX = 0x8137 @@ -408,11 +411,13 @@ const ( ETH_P_LOOP = 0x60 ETH_P_LOOPBACK = 0x9000 ETH_P_MACSEC = 0x88e5 + ETH_P_MAP = 0xf9 ETH_P_MOBITEX = 0x15 ETH_P_MPLS_MC = 0x8848 ETH_P_MPLS_UC = 0x8847 ETH_P_MVRP = 0x88f5 ETH_P_NCSI = 0x88f8 + ETH_P_NSH = 0x894f ETH_P_PAE = 0x888e ETH_P_PAUSE = 0x8808 ETH_P_PHONET = 0xf5 @@ -476,6 +481,7 @@ const ( FS_POLICY_FLAGS_PAD_8 = 0x1 FS_POLICY_FLAGS_PAD_MASK = 0x3 FS_POLICY_FLAGS_VALID = 0x3 + F_ADD_SEALS = 0x409 F_DUPFD = 0x0 F_DUPFD_CLOEXEC = 0x406 F_EXLCK = 0x4 @@ -488,6 +494,9 @@ const ( F_GETOWN_EX = 0x10 F_GETPIPE_SZ = 0x408 F_GETSIG = 0xb + F_GET_FILE_RW_HINT = 0x40d + F_GET_RW_HINT = 0x40b + F_GET_SEALS = 0x40a F_LOCK = 0x1 F_NOTIFY = 0x402 F_OFD_GETLK = 0x24 @@ -495,6 +504,10 @@ const ( F_OFD_SETLKW = 0x26 F_OK = 0x0 F_RDLCK = 0x0 + F_SEAL_GROW = 0x4 + F_SEAL_SEAL = 0x1 + F_SEAL_SHRINK = 0x2 + F_SEAL_WRITE = 0x8 F_SETFD = 0x2 F_SETFL = 0x4 F_SETLEASE = 0x400 @@ -506,6 +519,8 @@ const ( F_SETOWN_EX = 0xf F_SETPIPE_SZ = 0x407 F_SETSIG = 0xa + F_SET_FILE_RW_HINT = 0x40e + F_SET_RW_HINT = 0x40c F_SHLCK = 0x8 F_TEST = 0x3 F_TLOCK = 0x2 @@ -561,6 +576,8 @@ const ( IFF_MASTER = 0x400 IFF_MULTICAST = 0x1000 IFF_MULTI_QUEUE = 0x100 + IFF_NAPI = 0x10 + IFF_NAPI_FRAGS = 0x20 IFF_NOARP = 0x80 IFF_NOFILTER = 0x1000 IFF_NOTRAILERS = 0x20 @@ -845,6 +862,7 @@ const ( MADV_FREE = 0x8 MADV_HUGEPAGE = 0xe MADV_HWPOISON = 0x64 + MADV_KEEPONFORK = 0x13 MADV_MERGEABLE = 0xc MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 @@ -853,6 +871,7 @@ const ( MADV_SEQUENTIAL = 0x2 MADV_UNMERGEABLE = 0xd MADV_WILLNEED = 0x3 + MADV_WIPEONFORK = 0x12 MAP_ANON = 0x20 MAP_ANONYMOUS = 0x20 MAP_DENYWRITE = 0x800 @@ -898,6 +917,7 @@ const ( MSG_TRYHARD = 0x4 MSG_WAITALL = 0x100 MSG_WAITFORONE = 0x10000 + MSG_ZEROCOPY = 0x4000000 MS_ACTIVE = 0x40000000 MS_ASYNC = 0x1 MS_BIND = 0x1000 @@ -997,6 +1017,7 @@ const ( NLM_F_EXCL = 0x200 NLM_F_MATCH = 0x200 NLM_F_MULTI = 0x2 + NLM_F_NONREC = 0x100 NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 @@ -1195,6 +1216,11 @@ const ( PR_SET_TIMING = 0xe PR_SET_TSC = 0x1a PR_SET_UNALIGN = 0x6 + PR_SVE_GET_VL = 0x33 + PR_SVE_SET_VL = 0x32 + PR_SVE_SET_VL_ONEXEC = 0x40000 + PR_SVE_VL_INHERIT = 0x20000 + PR_SVE_VL_LEN_MASK = 0xffff PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 PR_TIMING_STATISTICAL = 0x0 @@ -1344,6 +1370,7 @@ const ( RTAX_ADVMSS = 0x8 RTAX_CC_ALGO = 0x10 RTAX_CWND = 0x7 + RTAX_FASTOPEN_NO_COOKIE = 0x11 RTAX_FEATURES = 0xc RTAX_FEATURE_ALLFRAG = 0x8 RTAX_FEATURE_ECN = 0x1 @@ -1354,7 +1381,7 @@ const ( RTAX_INITCWND = 0xb RTAX_INITRWND = 0xe RTAX_LOCK = 0x1 - RTAX_MAX = 0x10 + RTAX_MAX = 0x11 RTAX_MTU = 0x2 RTAX_QUICKACK = 0xf RTAX_REORDERING = 0x9 @@ -1628,6 +1655,7 @@ const ( SOL_SOCKET = 0x1 SOL_TCP = 0x6 SOL_TIPC = 0x10f + SOL_TLS = 0x11a SOL_X25 = 0x106 SOMAXCONN = 0x80 SO_ACCEPTCONN = 0x1e @@ -1696,10 +1724,32 @@ const ( SO_VM_SOCKETS_PEER_HOST_VM_ID = 0x3 SO_VM_SOCKETS_TRUSTED = 0x5 SO_WIFI_STATUS = 0x29 + SO_ZEROCOPY = 0x3c SPLICE_F_GIFT = 0x8 SPLICE_F_MORE = 0x4 SPLICE_F_MOVE = 0x1 SPLICE_F_NONBLOCK = 0x2 + STATX_ALL = 0xfff + STATX_ATIME = 0x20 + STATX_ATTR_APPEND = 0x20 + STATX_ATTR_AUTOMOUNT = 0x1000 + STATX_ATTR_COMPRESSED = 0x4 + STATX_ATTR_ENCRYPTED = 0x800 + STATX_ATTR_IMMUTABLE = 0x10 + STATX_ATTR_NODUMP = 0x40 + STATX_BASIC_STATS = 0x7ff + STATX_BLOCKS = 0x400 + STATX_BTIME = 0x800 + STATX_CTIME = 0x80 + STATX_GID = 0x10 + STATX_INO = 0x100 + STATX_MODE = 0x2 + STATX_MTIME = 0x40 + STATX_NLINK = 0x4 + STATX_SIZE = 0x200 + STATX_TYPE = 0x1 + STATX_UID = 0x8 + STATX__RESERVED = 0x80000000 S_BLKSIZE = 0x200 S_IEXEC = 0x40 S_IFBLK = 0x6000 @@ -1771,6 +1821,8 @@ const ( TCP_MAXWIN = 0xffff TCP_MAX_WINSHIFT = 0xe TCP_MD5SIG = 0xe + TCP_MD5SIG_EXT = 0x20 + TCP_MD5SIG_FLAG_PREFIX = 0x1 TCP_MD5SIG_MAXKEYLEN = 0x50 TCP_MSS = 0x200 TCP_MSS_DEFAULT = 0x218 @@ -1791,6 +1843,7 @@ const ( TCP_THIN_DUPACK = 0x11 TCP_THIN_LINEAR_TIMEOUTS = 0x10 TCP_TIMESTAMP = 0x18 + TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 TCP_WINDOW_CLAMP = 0xa TCSAFLUSH = 0x2 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go index dcb95473c..ef9602c1e 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go @@ -1238,6 +1238,21 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_STATX, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mask), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Sync() { SyscallNoError(SYS_SYNC, 0, 0, 0) return diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go index badf57ee0..63054b358 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go @@ -1238,6 +1238,21 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_STATX, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mask), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Sync() { SyscallNoError(SYS_SYNC, 0, 0, 0) return diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go index 69765c3a1..8b10ee144 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go @@ -1238,6 +1238,21 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_STATX, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mask), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Sync() { SyscallNoError(SYS_SYNC, 0, 0, 0) return diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go index dc8e6422b..8f276d65f 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go @@ -1238,6 +1238,21 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_STATX, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mask), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Sync() { SyscallNoError(SYS_SYNC, 0, 0, 0) return diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go index 59f50c8cd..61169b331 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go @@ -1238,6 +1238,21 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_STATX, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mask), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Sync() { SyscallNoError(SYS_SYNC, 0, 0, 0) return diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go index 38033805b..4cb59b4a5 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go @@ -1238,6 +1238,21 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_STATX, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mask), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Sync() { SyscallNoError(SYS_SYNC, 0, 0, 0) return diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go index fee2f8532..0b547ae30 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go @@ -1238,6 +1238,21 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_STATX, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mask), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Sync() { SyscallNoError(SYS_SYNC, 0, 0, 0) return diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go index 4094d3d1c..cd94d3a83 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go @@ -1238,6 +1238,21 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_STATX, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mask), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Sync() { SyscallNoError(SYS_SYNC, 0, 0, 0) return diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go index d83bafb39..cdad555a5 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go @@ -1238,6 +1238,21 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_STATX, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mask), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Sync() { SyscallNoError(SYS_SYNC, 0, 0, 0) return diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go index 460971c06..38f4e44b6 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go @@ -1238,6 +1238,21 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_STATX, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mask), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Sync() { SyscallNoError(SYS_SYNC, 0, 0, 0) return diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go index b7ef121be..c443baf63 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go @@ -1238,6 +1238,21 @@ func Setxattr(path string, attr string, data []byte, flags int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := Syscall6(SYS_STATX, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(flags), uintptr(mask), uintptr(unsafe.Pointer(stat)), 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Sync() { SyscallNoError(SYS_SYNC, 0, 0, 0) return diff --git a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go index 8ea18e6c2..8bf50c8d4 100644 --- a/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go @@ -308,6 +308,7 @@ const ( SYS_PWRITEV2 = 377 SYS_S390_GUARDED_STORAGE = 378 SYS_STATX = 379 + SYS_S390_STHYI = 380 SYS_SELECT = 142 SYS_GETRLIMIT = 191 SYS_LCHOWN = 198 diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index 1bb1a5e77..f9a99358a 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -52,7 +52,7 @@ type Timex struct { Errcnt int32 Stbcnt int32 Tai int32 - Pad_cgo_0 [44]byte + _ [44]byte } type Time_t int32 @@ -98,7 +98,7 @@ type _Gid_t uint32 type Stat_t struct { Dev uint64 X__pad1 uint16 - Pad_cgo_0 [2]byte + _ [2]byte X__st_ino uint32 Mode uint32 Nlink uint32 @@ -106,7 +106,7 @@ type Stat_t struct { Gid uint32 Rdev uint64 X__pad2 uint16 - Pad_cgo_1 [2]byte + _ [2]byte Size int64 Blksize int32 Blocks int64 @@ -131,13 +131,43 @@ type Statfs_t struct { Spare [4]int32 } +type StatxTimestamp struct { + Sec int64 + Nsec uint32 + X__reserved int32 +} + +type Statx_t struct { + Mask uint32 + Blksize uint32 + Attributes uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Mode uint16 + _ [1]uint16 + Ino uint64 + Size uint64 + Blocks uint64 + Attributes_mask uint64 + Atime StatxTimestamp + Btime StatxTimestamp + Ctime StatxTimestamp + Mtime StatxTimestamp + Rdev_major uint32 + Rdev_minor uint32 + Dev_major uint32 + Dev_minor uint32 + _ [14]uint64 +} + type Dirent struct { - Ino uint64 - Off int64 - Reclen uint16 - Type uint8 - Name [256]int8 - Pad_cgo_0 [1]byte + Ino uint64 + Off int64 + Reclen uint16 + Type uint8 + Name [256]int8 + _ [1]byte } type Fsid struct { @@ -224,11 +254,20 @@ type RawSockaddrHCI struct { Channel uint16 } +type RawSockaddrL2 struct { + Family uint16 + Psm uint16 + Bdaddr [6]uint8 + Cid uint16 + Bdaddr_type uint8 + _ [1]byte +} + type RawSockaddrCAN struct { - Family uint16 - Pad_cgo_0 [2]byte - Ifindex int32 - Addr [8]byte + Family uint16 + _ [2]byte + Ifindex int32 + Addr [8]byte } type RawSockaddrALG struct { @@ -341,7 +380,7 @@ type TCPInfo struct { Probes uint8 Backoff uint8 Options uint8 - Pad_cgo_0 [2]byte + _ [2]byte Rto uint32 Ato uint32 Snd_mss uint32 @@ -376,6 +415,7 @@ const ( SizeofSockaddrLinklayer = 0x14 SizeofSockaddrNetlink = 0xc SizeofSockaddrHCI = 0x6 + SizeofSockaddrL2 = 0xe SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 @@ -396,97 +436,123 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x2c - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x2e + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { @@ -565,9 +631,9 @@ type SockFilter struct { } type SockFprog struct { - Len uint16 - Pad_cgo_0 [2]byte - Filter *SockFilter + Len uint16 + _ [2]byte + Filter *SockFilter } type InotifyEvent struct { @@ -643,9 +709,15 @@ type EpollEvent struct { } const ( - AT_FDCWD = -0x64 - AT_NO_AUTOMOUNT = 0x800 - AT_REMOVEDIR = 0x200 + AT_EMPTY_PATH = 0x1000 + AT_FDCWD = -0x64 + AT_NO_AUTOMOUNT = 0x800 + AT_REMOVEDIR = 0x200 + + AT_STATX_SYNC_AS_STAT = 0x0 + AT_STATX_FORCE_SYNC = 0x2000 + AT_STATX_DONT_SYNC = 0x4000 + AT_SYMLINK_FOLLOW = 0x400 AT_SYMLINK_NOFOLLOW = 0x100 ) @@ -694,11 +766,11 @@ type Winsize struct { type Taskstats struct { Version uint16 - Pad_cgo_0 [2]byte + _ [2]byte Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 - Pad_cgo_1 [6]byte + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -710,13 +782,13 @@ type Taskstats struct { Ac_comm [32]int8 Ac_sched uint8 Ac_pad [3]uint8 - Pad_cgo_2 [4]byte + _ [4]byte Ac_uid uint32 Ac_gid uint32 Ac_pid uint32 Ac_ppid uint32 Ac_btime uint32 - Pad_cgo_3 [4]byte + _ [4]byte Ac_etime uint64 Ac_utime uint64 Ac_stime uint64 @@ -817,3 +889,9 @@ const ( _CPU_SETSIZE = 0x400 _NCPUBITS = 0x20 ) + +const ( + BDADDR_BREDR = 0x0 + BDADDR_LE_PUBLIC = 0x1 + BDADDR_LE_RANDOM = 0x2 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index 081c60797..4df7088d4 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -33,13 +33,13 @@ type Timeval struct { type Timex struct { Modes uint32 - Pad_cgo_0 [4]byte + _ [4]byte Offset int64 Freq int64 Maxerror int64 Esterror int64 Status int32 - Pad_cgo_1 [4]byte + _ [4]byte Constant int64 Precision int64 Tolerance int64 @@ -48,14 +48,14 @@ type Timex struct { Ppsfreq int64 Jitter int64 Shift int32 - Pad_cgo_2 [4]byte + _ [4]byte Stabil int64 Jitcnt int64 Calcnt int64 Errcnt int64 Stbcnt int64 Tai int32 - Pad_cgo_3 [44]byte + _ [44]byte } type Time_t int64 @@ -131,13 +131,43 @@ type Statfs_t struct { Spare [4]int64 } +type StatxTimestamp struct { + Sec int64 + Nsec uint32 + X__reserved int32 +} + +type Statx_t struct { + Mask uint32 + Blksize uint32 + Attributes uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Mode uint16 + _ [1]uint16 + Ino uint64 + Size uint64 + Blocks uint64 + Attributes_mask uint64 + Atime StatxTimestamp + Btime StatxTimestamp + Ctime StatxTimestamp + Mtime StatxTimestamp + Rdev_major uint32 + Rdev_minor uint32 + Dev_major uint32 + Dev_minor uint32 + _ [14]uint64 +} + type Dirent struct { - Ino uint64 - Off int64 - Reclen uint16 - Type uint8 - Name [256]int8 - Pad_cgo_0 [5]byte + Ino uint64 + Off int64 + Reclen uint16 + Type uint8 + Name [256]int8 + _ [5]byte } type Fsid struct { @@ -145,13 +175,13 @@ type Fsid struct { } type Flock_t struct { - Type int16 - Whence int16 - Pad_cgo_0 [4]byte - Start int64 - Len int64 - Pid int32 - Pad_cgo_1 [4]byte + Type int16 + Whence int16 + _ [4]byte + Start int64 + Len int64 + Pid int32 + _ [4]byte } type FscryptPolicy struct { @@ -226,11 +256,20 @@ type RawSockaddrHCI struct { Channel uint16 } +type RawSockaddrL2 struct { + Family uint16 + Psm uint16 + Bdaddr [6]uint8 + Cid uint16 + Bdaddr_type uint8 + _ [1]byte +} + type RawSockaddrCAN struct { - Family uint16 - Pad_cgo_0 [2]byte - Ifindex int32 - Addr [8]byte + Family uint16 + _ [2]byte + Ifindex int32 + Addr [8]byte } type RawSockaddrALG struct { @@ -297,13 +336,13 @@ type PacketMreq struct { type Msghdr struct { Name *byte Namelen uint32 - Pad_cgo_0 [4]byte + _ [4]byte Iov *Iovec Iovlen uint64 Control *byte Controllen uint64 Flags int32 - Pad_cgo_1 [4]byte + _ [4]byte } type Cmsghdr struct { @@ -345,7 +384,7 @@ type TCPInfo struct { Probes uint8 Backoff uint8 Options uint8 - Pad_cgo_0 [2]byte + _ [2]byte Rto uint32 Ato uint32 Snd_mss uint32 @@ -380,6 +419,7 @@ const ( SizeofSockaddrLinklayer = 0x14 SizeofSockaddrNetlink = 0xc SizeofSockaddrHCI = 0x6 + SizeofSockaddrL2 = 0xe SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 @@ -400,97 +440,123 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x2c - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x2e + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { @@ -569,9 +635,9 @@ type SockFilter struct { } type SockFprog struct { - Len uint16 - Pad_cgo_0 [6]byte - Filter *SockFilter + Len uint16 + _ [6]byte + Filter *SockFilter } type InotifyEvent struct { @@ -628,12 +694,12 @@ type Sysinfo_t struct { Freeswap uint64 Procs uint16 Pad uint16 - Pad_cgo_0 [4]byte + _ [4]byte Totalhigh uint64 Freehigh uint64 Unit uint32 X_f [0]int8 - Pad_cgo_1 [4]byte + _ [4]byte } type Utsname struct { @@ -646,12 +712,12 @@ type Utsname struct { } type Ustat_t struct { - Tfree int32 - Pad_cgo_0 [4]byte - Tinode uint64 - Fname [6]int8 - Fpack [6]int8 - Pad_cgo_1 [4]byte + Tfree int32 + _ [4]byte + Tinode uint64 + Fname [6]int8 + Fpack [6]int8 + _ [4]byte } type EpollEvent struct { @@ -661,9 +727,15 @@ type EpollEvent struct { } const ( - AT_FDCWD = -0x64 - AT_NO_AUTOMOUNT = 0x800 - AT_REMOVEDIR = 0x200 + AT_EMPTY_PATH = 0x1000 + AT_FDCWD = -0x64 + AT_NO_AUTOMOUNT = 0x800 + AT_REMOVEDIR = 0x200 + + AT_STATX_SYNC_AS_STAT = 0x0 + AT_STATX_FORCE_SYNC = 0x2000 + AT_STATX_DONT_SYNC = 0x4000 + AT_SYMLINK_FOLLOW = 0x400 AT_SYMLINK_NOFOLLOW = 0x100 ) @@ -712,11 +784,11 @@ type Winsize struct { type Taskstats struct { Version uint16 - Pad_cgo_0 [2]byte + _ [2]byte Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 - Pad_cgo_1 [6]byte + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -728,13 +800,13 @@ type Taskstats struct { Ac_comm [32]int8 Ac_sched uint8 Ac_pad [3]uint8 - Pad_cgo_2 [4]byte + _ [4]byte Ac_uid uint32 Ac_gid uint32 Ac_pid uint32 Ac_ppid uint32 Ac_btime uint32 - Pad_cgo_3 [4]byte + _ [4]byte Ac_etime uint64 Ac_utime uint64 Ac_stime uint64 @@ -835,3 +907,9 @@ const ( _CPU_SETSIZE = 0x400 _NCPUBITS = 0x40 ) + +const ( + BDADDR_BREDR = 0x0 + BDADDR_LE_PUBLIC = 0x1 + BDADDR_LE_RANDOM = 0x2 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index 904510d40..a181469ca 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -52,7 +52,7 @@ type Timex struct { Errcnt int32 Stbcnt int32 Tai int32 - Pad_cgo_0 [44]byte + _ [44]byte } type Time_t int32 @@ -98,7 +98,7 @@ type _Gid_t uint32 type Stat_t struct { Dev uint64 X__pad1 uint16 - Pad_cgo_0 [2]byte + _ [2]byte X__st_ino uint32 Mode uint32 Nlink uint32 @@ -106,10 +106,10 @@ type Stat_t struct { Gid uint32 Rdev uint64 X__pad2 uint16 - Pad_cgo_1 [6]byte + _ [6]byte Size int64 Blksize int32 - Pad_cgo_2 [4]byte + _ [4]byte Blocks int64 Atim Timespec Mtim Timespec @@ -118,28 +118,58 @@ type Stat_t struct { } type Statfs_t struct { - Type int32 - Bsize int32 - Blocks uint64 - Bfree uint64 - Bavail uint64 - Files uint64 - Ffree uint64 - Fsid Fsid - Namelen int32 - Frsize int32 - Flags int32 - Spare [4]int32 - Pad_cgo_0 [4]byte + Type int32 + Bsize int32 + Blocks uint64 + Bfree uint64 + Bavail uint64 + Files uint64 + Ffree uint64 + Fsid Fsid + Namelen int32 + Frsize int32 + Flags int32 + Spare [4]int32 + _ [4]byte +} + +type StatxTimestamp struct { + Sec int64 + Nsec uint32 + X__reserved int32 +} + +type Statx_t struct { + Mask uint32 + Blksize uint32 + Attributes uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Mode uint16 + _ [1]uint16 + Ino uint64 + Size uint64 + Blocks uint64 + Attributes_mask uint64 + Atime StatxTimestamp + Btime StatxTimestamp + Ctime StatxTimestamp + Mtime StatxTimestamp + Rdev_major uint32 + Rdev_minor uint32 + Dev_major uint32 + Dev_minor uint32 + _ [14]uint64 } type Dirent struct { - Ino uint64 - Off int64 - Reclen uint16 - Type uint8 - Name [256]uint8 - Pad_cgo_0 [5]byte + Ino uint64 + Off int64 + Reclen uint16 + Type uint8 + Name [256]uint8 + _ [5]byte } type Fsid struct { @@ -147,13 +177,13 @@ type Fsid struct { } type Flock_t struct { - Type int16 - Whence int16 - Pad_cgo_0 [4]byte - Start int64 - Len int64 - Pid int32 - Pad_cgo_1 [4]byte + Type int16 + Whence int16 + _ [4]byte + Start int64 + Len int64 + Pid int32 + _ [4]byte } type FscryptPolicy struct { @@ -228,11 +258,20 @@ type RawSockaddrHCI struct { Channel uint16 } +type RawSockaddrL2 struct { + Family uint16 + Psm uint16 + Bdaddr [6]uint8 + Cid uint16 + Bdaddr_type uint8 + _ [1]byte +} + type RawSockaddrCAN struct { - Family uint16 - Pad_cgo_0 [2]byte - Ifindex int32 - Addr [8]byte + Family uint16 + _ [2]byte + Ifindex int32 + Addr [8]byte } type RawSockaddrALG struct { @@ -345,7 +384,7 @@ type TCPInfo struct { Probes uint8 Backoff uint8 Options uint8 - Pad_cgo_0 [2]byte + _ [2]byte Rto uint32 Ato uint32 Snd_mss uint32 @@ -380,6 +419,7 @@ const ( SizeofSockaddrLinklayer = 0x14 SizeofSockaddrNetlink = 0xc SizeofSockaddrHCI = 0x6 + SizeofSockaddrL2 = 0xe SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 @@ -400,97 +440,123 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x2c - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x2e + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { @@ -569,9 +635,9 @@ type SockFilter struct { } type SockFprog struct { - Len uint16 - Pad_cgo_0 [2]byte - Filter *SockFilter + Len uint16 + _ [2]byte + Filter *SockFilter } type InotifyEvent struct { @@ -632,9 +698,15 @@ type EpollEvent struct { } const ( - AT_FDCWD = -0x64 - AT_NO_AUTOMOUNT = 0x800 - AT_REMOVEDIR = 0x200 + AT_EMPTY_PATH = 0x1000 + AT_FDCWD = -0x64 + AT_NO_AUTOMOUNT = 0x800 + AT_REMOVEDIR = 0x200 + + AT_STATX_SYNC_AS_STAT = 0x0 + AT_STATX_FORCE_SYNC = 0x2000 + AT_STATX_DONT_SYNC = 0x4000 + AT_SYMLINK_FOLLOW = 0x400 AT_SYMLINK_NOFOLLOW = 0x100 ) @@ -683,11 +755,11 @@ type Winsize struct { type Taskstats struct { Version uint16 - Pad_cgo_0 [2]byte + _ [2]byte Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 - Pad_cgo_1 [6]byte + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -699,13 +771,13 @@ type Taskstats struct { Ac_comm [32]uint8 Ac_sched uint8 Ac_pad [3]uint8 - Pad_cgo_2 [4]byte + _ [4]byte Ac_uid uint32 Ac_gid uint32 Ac_pid uint32 Ac_ppid uint32 Ac_btime uint32 - Pad_cgo_3 [4]byte + _ [4]byte Ac_etime uint64 Ac_utime uint64 Ac_stime uint64 @@ -806,3 +878,9 @@ const ( _CPU_SETSIZE = 0x400 _NCPUBITS = 0x20 ) + +const ( + BDADDR_BREDR = 0x0 + BDADDR_LE_PUBLIC = 0x1 + BDADDR_LE_RANDOM = 0x2 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go index 5da8cef72..cff50c3d3 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -33,13 +33,13 @@ type Timeval struct { type Timex struct { Modes uint32 - Pad_cgo_0 [4]byte + _ [4]byte Offset int64 Freq int64 Maxerror int64 Esterror int64 Status int32 - Pad_cgo_1 [4]byte + _ [4]byte Constant int64 Precision int64 Tolerance int64 @@ -48,14 +48,14 @@ type Timex struct { Ppsfreq int64 Jitter int64 Shift int32 - Pad_cgo_2 [4]byte + _ [4]byte Stabil int64 Jitcnt int64 Calcnt int64 Errcnt int64 Stbcnt int64 Tai int32 - Pad_cgo_3 [44]byte + _ [44]byte } type Time_t int64 @@ -132,13 +132,43 @@ type Statfs_t struct { Spare [4]int64 } +type StatxTimestamp struct { + Sec int64 + Nsec uint32 + X__reserved int32 +} + +type Statx_t struct { + Mask uint32 + Blksize uint32 + Attributes uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Mode uint16 + _ [1]uint16 + Ino uint64 + Size uint64 + Blocks uint64 + Attributes_mask uint64 + Atime StatxTimestamp + Btime StatxTimestamp + Ctime StatxTimestamp + Mtime StatxTimestamp + Rdev_major uint32 + Rdev_minor uint32 + Dev_major uint32 + Dev_minor uint32 + _ [14]uint64 +} + type Dirent struct { - Ino uint64 - Off int64 - Reclen uint16 - Type uint8 - Name [256]int8 - Pad_cgo_0 [5]byte + Ino uint64 + Off int64 + Reclen uint16 + Type uint8 + Name [256]int8 + _ [5]byte } type Fsid struct { @@ -146,13 +176,13 @@ type Fsid struct { } type Flock_t struct { - Type int16 - Whence int16 - Pad_cgo_0 [4]byte - Start int64 - Len int64 - Pid int32 - Pad_cgo_1 [4]byte + Type int16 + Whence int16 + _ [4]byte + Start int64 + Len int64 + Pid int32 + _ [4]byte } type FscryptPolicy struct { @@ -227,11 +257,20 @@ type RawSockaddrHCI struct { Channel uint16 } +type RawSockaddrL2 struct { + Family uint16 + Psm uint16 + Bdaddr [6]uint8 + Cid uint16 + Bdaddr_type uint8 + _ [1]byte +} + type RawSockaddrCAN struct { - Family uint16 - Pad_cgo_0 [2]byte - Ifindex int32 - Addr [8]byte + Family uint16 + _ [2]byte + Ifindex int32 + Addr [8]byte } type RawSockaddrALG struct { @@ -298,13 +337,13 @@ type PacketMreq struct { type Msghdr struct { Name *byte Namelen uint32 - Pad_cgo_0 [4]byte + _ [4]byte Iov *Iovec Iovlen uint64 Control *byte Controllen uint64 Flags int32 - Pad_cgo_1 [4]byte + _ [4]byte } type Cmsghdr struct { @@ -346,7 +385,7 @@ type TCPInfo struct { Probes uint8 Backoff uint8 Options uint8 - Pad_cgo_0 [2]byte + _ [2]byte Rto uint32 Ato uint32 Snd_mss uint32 @@ -381,6 +420,7 @@ const ( SizeofSockaddrLinklayer = 0x14 SizeofSockaddrNetlink = 0xc SizeofSockaddrHCI = 0x6 + SizeofSockaddrL2 = 0xe SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 @@ -401,97 +441,123 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x2c - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x2e + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { @@ -570,9 +636,9 @@ type SockFilter struct { } type SockFprog struct { - Len uint16 - Pad_cgo_0 [6]byte - Filter *SockFilter + Len uint16 + _ [6]byte + Filter *SockFilter } type InotifyEvent struct { @@ -606,12 +672,12 @@ type Sysinfo_t struct { Freeswap uint64 Procs uint16 Pad uint16 - Pad_cgo_0 [4]byte + _ [4]byte Totalhigh uint64 Freehigh uint64 Unit uint32 X_f [0]int8 - Pad_cgo_1 [4]byte + _ [4]byte } type Utsname struct { @@ -624,12 +690,12 @@ type Utsname struct { } type Ustat_t struct { - Tfree int32 - Pad_cgo_0 [4]byte - Tinode uint64 - Fname [6]int8 - Fpack [6]int8 - Pad_cgo_1 [4]byte + Tfree int32 + _ [4]byte + Tinode uint64 + Fname [6]int8 + Fpack [6]int8 + _ [4]byte } type EpollEvent struct { @@ -640,9 +706,15 @@ type EpollEvent struct { } const ( - AT_FDCWD = -0x64 - AT_NO_AUTOMOUNT = 0x800 - AT_REMOVEDIR = 0x200 + AT_EMPTY_PATH = 0x1000 + AT_FDCWD = -0x64 + AT_NO_AUTOMOUNT = 0x800 + AT_REMOVEDIR = 0x200 + + AT_STATX_SYNC_AS_STAT = 0x0 + AT_STATX_FORCE_SYNC = 0x2000 + AT_STATX_DONT_SYNC = 0x4000 + AT_SYMLINK_FOLLOW = 0x400 AT_SYMLINK_NOFOLLOW = 0x100 ) @@ -691,11 +763,11 @@ type Winsize struct { type Taskstats struct { Version uint16 - Pad_cgo_0 [2]byte + _ [2]byte Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 - Pad_cgo_1 [6]byte + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -707,13 +779,13 @@ type Taskstats struct { Ac_comm [32]int8 Ac_sched uint8 Ac_pad [3]uint8 - Pad_cgo_2 [4]byte + _ [4]byte Ac_uid uint32 Ac_gid uint32 Ac_pid uint32 Ac_ppid uint32 Ac_btime uint32 - Pad_cgo_3 [4]byte + _ [4]byte Ac_etime uint64 Ac_utime uint64 Ac_stime uint64 @@ -814,3 +886,9 @@ const ( _CPU_SETSIZE = 0x400 _NCPUBITS = 0x40 ) + +const ( + BDADDR_BREDR = 0x0 + BDADDR_LE_PUBLIC = 0x1 + BDADDR_LE_RANDOM = 0x2 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go index 2707c3661..87d0a8b1b 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -52,7 +52,7 @@ type Timex struct { Errcnt int32 Stbcnt int32 Tai int32 - Pad_cgo_0 [44]byte + _ [44]byte } type Time_t int32 @@ -116,29 +116,59 @@ type Stat_t struct { } type Statfs_t struct { - Type int32 - Bsize int32 - Frsize int32 - Pad_cgo_0 [4]byte - Blocks uint64 - Bfree uint64 - Files uint64 - Ffree uint64 - Bavail uint64 - Fsid Fsid - Namelen int32 - Flags int32 - Spare [5]int32 - Pad_cgo_1 [4]byte + Type int32 + Bsize int32 + Frsize int32 + _ [4]byte + Blocks uint64 + Bfree uint64 + Files uint64 + Ffree uint64 + Bavail uint64 + Fsid Fsid + Namelen int32 + Flags int32 + Spare [5]int32 + _ [4]byte +} + +type StatxTimestamp struct { + Sec int64 + Nsec uint32 + X__reserved int32 +} + +type Statx_t struct { + Mask uint32 + Blksize uint32 + Attributes uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Mode uint16 + _ [1]uint16 + Ino uint64 + Size uint64 + Blocks uint64 + Attributes_mask uint64 + Atime StatxTimestamp + Btime StatxTimestamp + Ctime StatxTimestamp + Mtime StatxTimestamp + Rdev_major uint32 + Rdev_minor uint32 + Dev_major uint32 + Dev_minor uint32 + _ [14]uint64 } type Dirent struct { - Ino uint64 - Off int64 - Reclen uint16 - Type uint8 - Name [256]int8 - Pad_cgo_0 [5]byte + Ino uint64 + Off int64 + Reclen uint16 + Type uint8 + Name [256]int8 + _ [5]byte } type Fsid struct { @@ -146,13 +176,13 @@ type Fsid struct { } type Flock_t struct { - Type int16 - Whence int16 - Pad_cgo_0 [4]byte - Start int64 - Len int64 - Pid int32 - Pad_cgo_1 [4]byte + Type int16 + Whence int16 + _ [4]byte + Start int64 + Len int64 + Pid int32 + _ [4]byte } type FscryptPolicy struct { @@ -227,11 +257,20 @@ type RawSockaddrHCI struct { Channel uint16 } +type RawSockaddrL2 struct { + Family uint16 + Psm uint16 + Bdaddr [6]uint8 + Cid uint16 + Bdaddr_type uint8 + _ [1]byte +} + type RawSockaddrCAN struct { - Family uint16 - Pad_cgo_0 [2]byte - Ifindex int32 - Addr [8]byte + Family uint16 + _ [2]byte + Ifindex int32 + Addr [8]byte } type RawSockaddrALG struct { @@ -344,7 +383,7 @@ type TCPInfo struct { Probes uint8 Backoff uint8 Options uint8 - Pad_cgo_0 [2]byte + _ [2]byte Rto uint32 Ato uint32 Snd_mss uint32 @@ -379,6 +418,7 @@ const ( SizeofSockaddrLinklayer = 0x14 SizeofSockaddrNetlink = 0xc SizeofSockaddrHCI = 0x6 + SizeofSockaddrL2 = 0xe SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 @@ -399,97 +439,123 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x2c - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x2e + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { @@ -568,9 +634,9 @@ type SockFilter struct { } type SockFprog struct { - Len uint16 - Pad_cgo_0 [2]byte - Filter *SockFilter + Len uint16 + _ [2]byte + Filter *SockFilter } type InotifyEvent struct { @@ -637,9 +703,15 @@ type EpollEvent struct { } const ( - AT_FDCWD = -0x64 - AT_NO_AUTOMOUNT = 0x800 - AT_REMOVEDIR = 0x200 + AT_EMPTY_PATH = 0x1000 + AT_FDCWD = -0x64 + AT_NO_AUTOMOUNT = 0x800 + AT_REMOVEDIR = 0x200 + + AT_STATX_SYNC_AS_STAT = 0x0 + AT_STATX_FORCE_SYNC = 0x2000 + AT_STATX_DONT_SYNC = 0x4000 + AT_SYMLINK_FOLLOW = 0x400 AT_SYMLINK_NOFOLLOW = 0x100 ) @@ -688,11 +760,11 @@ type Winsize struct { type Taskstats struct { Version uint16 - Pad_cgo_0 [2]byte + _ [2]byte Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 - Pad_cgo_1 [6]byte + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -704,13 +776,13 @@ type Taskstats struct { Ac_comm [32]int8 Ac_sched uint8 Ac_pad [3]uint8 - Pad_cgo_2 [4]byte + _ [4]byte Ac_uid uint32 Ac_gid uint32 Ac_pid uint32 Ac_ppid uint32 Ac_btime uint32 - Pad_cgo_3 [4]byte + _ [4]byte Ac_etime uint64 Ac_utime uint64 Ac_stime uint64 @@ -811,3 +883,9 @@ const ( _CPU_SETSIZE = 0x400 _NCPUBITS = 0x20 ) + +const ( + BDADDR_BREDR = 0x0 + BDADDR_LE_PUBLIC = 0x1 + BDADDR_LE_RANDOM = 0x2 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go index 23e9da62b..cf4e2bd29 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -33,13 +33,13 @@ type Timeval struct { type Timex struct { Modes uint32 - Pad_cgo_0 [4]byte + _ [4]byte Offset int64 Freq int64 Maxerror int64 Esterror int64 Status int32 - Pad_cgo_1 [4]byte + _ [4]byte Constant int64 Precision int64 Tolerance int64 @@ -48,14 +48,14 @@ type Timex struct { Ppsfreq int64 Jitter int64 Shift int32 - Pad_cgo_2 [4]byte + _ [4]byte Stabil int64 Jitcnt int64 Calcnt int64 Errcnt int64 Stbcnt int64 Tai int32 - Pad_cgo_3 [44]byte + _ [44]byte } type Time_t int64 @@ -132,13 +132,43 @@ type Statfs_t struct { Spare [5]int64 } +type StatxTimestamp struct { + Sec int64 + Nsec uint32 + X__reserved int32 +} + +type Statx_t struct { + Mask uint32 + Blksize uint32 + Attributes uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Mode uint16 + _ [1]uint16 + Ino uint64 + Size uint64 + Blocks uint64 + Attributes_mask uint64 + Atime StatxTimestamp + Btime StatxTimestamp + Ctime StatxTimestamp + Mtime StatxTimestamp + Rdev_major uint32 + Rdev_minor uint32 + Dev_major uint32 + Dev_minor uint32 + _ [14]uint64 +} + type Dirent struct { - Ino uint64 - Off int64 - Reclen uint16 - Type uint8 - Name [256]int8 - Pad_cgo_0 [5]byte + Ino uint64 + Off int64 + Reclen uint16 + Type uint8 + Name [256]int8 + _ [5]byte } type Fsid struct { @@ -146,13 +176,13 @@ type Fsid struct { } type Flock_t struct { - Type int16 - Whence int16 - Pad_cgo_0 [4]byte - Start int64 - Len int64 - Pid int32 - Pad_cgo_1 [4]byte + Type int16 + Whence int16 + _ [4]byte + Start int64 + Len int64 + Pid int32 + _ [4]byte } type FscryptPolicy struct { @@ -227,11 +257,20 @@ type RawSockaddrHCI struct { Channel uint16 } +type RawSockaddrL2 struct { + Family uint16 + Psm uint16 + Bdaddr [6]uint8 + Cid uint16 + Bdaddr_type uint8 + _ [1]byte +} + type RawSockaddrCAN struct { - Family uint16 - Pad_cgo_0 [2]byte - Ifindex int32 - Addr [8]byte + Family uint16 + _ [2]byte + Ifindex int32 + Addr [8]byte } type RawSockaddrALG struct { @@ -298,13 +337,13 @@ type PacketMreq struct { type Msghdr struct { Name *byte Namelen uint32 - Pad_cgo_0 [4]byte + _ [4]byte Iov *Iovec Iovlen uint64 Control *byte Controllen uint64 Flags int32 - Pad_cgo_1 [4]byte + _ [4]byte } type Cmsghdr struct { @@ -346,7 +385,7 @@ type TCPInfo struct { Probes uint8 Backoff uint8 Options uint8 - Pad_cgo_0 [2]byte + _ [2]byte Rto uint32 Ato uint32 Snd_mss uint32 @@ -381,6 +420,7 @@ const ( SizeofSockaddrLinklayer = 0x14 SizeofSockaddrNetlink = 0xc SizeofSockaddrHCI = 0x6 + SizeofSockaddrL2 = 0xe SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 @@ -401,97 +441,123 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x2c - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x2e + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { @@ -570,9 +636,9 @@ type SockFilter struct { } type SockFprog struct { - Len uint16 - Pad_cgo_0 [6]byte - Filter *SockFilter + Len uint16 + _ [6]byte + Filter *SockFilter } type InotifyEvent struct { @@ -609,12 +675,12 @@ type Sysinfo_t struct { Freeswap uint64 Procs uint16 Pad uint16 - Pad_cgo_0 [4]byte + _ [4]byte Totalhigh uint64 Freehigh uint64 Unit uint32 X_f [0]int8 - Pad_cgo_1 [4]byte + _ [4]byte } type Utsname struct { @@ -627,12 +693,12 @@ type Utsname struct { } type Ustat_t struct { - Tfree int32 - Pad_cgo_0 [4]byte - Tinode uint64 - Fname [6]int8 - Fpack [6]int8 - Pad_cgo_1 [4]byte + Tfree int32 + _ [4]byte + Tinode uint64 + Fname [6]int8 + Fpack [6]int8 + _ [4]byte } type EpollEvent struct { @@ -642,9 +708,15 @@ type EpollEvent struct { } const ( - AT_FDCWD = -0x64 - AT_NO_AUTOMOUNT = 0x800 - AT_REMOVEDIR = 0x200 + AT_EMPTY_PATH = 0x1000 + AT_FDCWD = -0x64 + AT_NO_AUTOMOUNT = 0x800 + AT_REMOVEDIR = 0x200 + + AT_STATX_SYNC_AS_STAT = 0x0 + AT_STATX_FORCE_SYNC = 0x2000 + AT_STATX_DONT_SYNC = 0x4000 + AT_SYMLINK_FOLLOW = 0x400 AT_SYMLINK_NOFOLLOW = 0x100 ) @@ -693,11 +765,11 @@ type Winsize struct { type Taskstats struct { Version uint16 - Pad_cgo_0 [2]byte + _ [2]byte Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 - Pad_cgo_1 [6]byte + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -709,13 +781,13 @@ type Taskstats struct { Ac_comm [32]int8 Ac_sched uint8 Ac_pad [3]uint8 - Pad_cgo_2 [4]byte + _ [4]byte Ac_uid uint32 Ac_gid uint32 Ac_pid uint32 Ac_ppid uint32 Ac_btime uint32 - Pad_cgo_3 [4]byte + _ [4]byte Ac_etime uint64 Ac_utime uint64 Ac_stime uint64 @@ -816,3 +888,9 @@ const ( _CPU_SETSIZE = 0x400 _NCPUBITS = 0x40 ) + +const ( + BDADDR_BREDR = 0x0 + BDADDR_LE_PUBLIC = 0x1 + BDADDR_LE_RANDOM = 0x2 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go index 1090dc159..b8da482ca 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -33,13 +33,13 @@ type Timeval struct { type Timex struct { Modes uint32 - Pad_cgo_0 [4]byte + _ [4]byte Offset int64 Freq int64 Maxerror int64 Esterror int64 Status int32 - Pad_cgo_1 [4]byte + _ [4]byte Constant int64 Precision int64 Tolerance int64 @@ -48,14 +48,14 @@ type Timex struct { Ppsfreq int64 Jitter int64 Shift int32 - Pad_cgo_2 [4]byte + _ [4]byte Stabil int64 Jitcnt int64 Calcnt int64 Errcnt int64 Stbcnt int64 Tai int32 - Pad_cgo_3 [44]byte + _ [44]byte } type Time_t int64 @@ -132,13 +132,43 @@ type Statfs_t struct { Spare [5]int64 } +type StatxTimestamp struct { + Sec int64 + Nsec uint32 + X__reserved int32 +} + +type Statx_t struct { + Mask uint32 + Blksize uint32 + Attributes uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Mode uint16 + _ [1]uint16 + Ino uint64 + Size uint64 + Blocks uint64 + Attributes_mask uint64 + Atime StatxTimestamp + Btime StatxTimestamp + Ctime StatxTimestamp + Mtime StatxTimestamp + Rdev_major uint32 + Rdev_minor uint32 + Dev_major uint32 + Dev_minor uint32 + _ [14]uint64 +} + type Dirent struct { - Ino uint64 - Off int64 - Reclen uint16 - Type uint8 - Name [256]int8 - Pad_cgo_0 [5]byte + Ino uint64 + Off int64 + Reclen uint16 + Type uint8 + Name [256]int8 + _ [5]byte } type Fsid struct { @@ -146,13 +176,13 @@ type Fsid struct { } type Flock_t struct { - Type int16 - Whence int16 - Pad_cgo_0 [4]byte - Start int64 - Len int64 - Pid int32 - Pad_cgo_1 [4]byte + Type int16 + Whence int16 + _ [4]byte + Start int64 + Len int64 + Pid int32 + _ [4]byte } type FscryptPolicy struct { @@ -227,11 +257,20 @@ type RawSockaddrHCI struct { Channel uint16 } +type RawSockaddrL2 struct { + Family uint16 + Psm uint16 + Bdaddr [6]uint8 + Cid uint16 + Bdaddr_type uint8 + _ [1]byte +} + type RawSockaddrCAN struct { - Family uint16 - Pad_cgo_0 [2]byte - Ifindex int32 - Addr [8]byte + Family uint16 + _ [2]byte + Ifindex int32 + Addr [8]byte } type RawSockaddrALG struct { @@ -298,13 +337,13 @@ type PacketMreq struct { type Msghdr struct { Name *byte Namelen uint32 - Pad_cgo_0 [4]byte + _ [4]byte Iov *Iovec Iovlen uint64 Control *byte Controllen uint64 Flags int32 - Pad_cgo_1 [4]byte + _ [4]byte } type Cmsghdr struct { @@ -346,7 +385,7 @@ type TCPInfo struct { Probes uint8 Backoff uint8 Options uint8 - Pad_cgo_0 [2]byte + _ [2]byte Rto uint32 Ato uint32 Snd_mss uint32 @@ -381,6 +420,7 @@ const ( SizeofSockaddrLinklayer = 0x14 SizeofSockaddrNetlink = 0xc SizeofSockaddrHCI = 0x6 + SizeofSockaddrL2 = 0xe SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 @@ -401,97 +441,123 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x2c - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x2e + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { @@ -570,9 +636,9 @@ type SockFilter struct { } type SockFprog struct { - Len uint16 - Pad_cgo_0 [6]byte - Filter *SockFilter + Len uint16 + _ [6]byte + Filter *SockFilter } type InotifyEvent struct { @@ -609,12 +675,12 @@ type Sysinfo_t struct { Freeswap uint64 Procs uint16 Pad uint16 - Pad_cgo_0 [4]byte + _ [4]byte Totalhigh uint64 Freehigh uint64 Unit uint32 X_f [0]int8 - Pad_cgo_1 [4]byte + _ [4]byte } type Utsname struct { @@ -627,12 +693,12 @@ type Utsname struct { } type Ustat_t struct { - Tfree int32 - Pad_cgo_0 [4]byte - Tinode uint64 - Fname [6]int8 - Fpack [6]int8 - Pad_cgo_1 [4]byte + Tfree int32 + _ [4]byte + Tinode uint64 + Fname [6]int8 + Fpack [6]int8 + _ [4]byte } type EpollEvent struct { @@ -642,9 +708,15 @@ type EpollEvent struct { } const ( - AT_FDCWD = -0x64 - AT_NO_AUTOMOUNT = 0x800 - AT_REMOVEDIR = 0x200 + AT_EMPTY_PATH = 0x1000 + AT_FDCWD = -0x64 + AT_NO_AUTOMOUNT = 0x800 + AT_REMOVEDIR = 0x200 + + AT_STATX_SYNC_AS_STAT = 0x0 + AT_STATX_FORCE_SYNC = 0x2000 + AT_STATX_DONT_SYNC = 0x4000 + AT_SYMLINK_FOLLOW = 0x400 AT_SYMLINK_NOFOLLOW = 0x100 ) @@ -693,11 +765,11 @@ type Winsize struct { type Taskstats struct { Version uint16 - Pad_cgo_0 [2]byte + _ [2]byte Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 - Pad_cgo_1 [6]byte + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -709,13 +781,13 @@ type Taskstats struct { Ac_comm [32]int8 Ac_sched uint8 Ac_pad [3]uint8 - Pad_cgo_2 [4]byte + _ [4]byte Ac_uid uint32 Ac_gid uint32 Ac_pid uint32 Ac_ppid uint32 Ac_btime uint32 - Pad_cgo_3 [4]byte + _ [4]byte Ac_etime uint64 Ac_utime uint64 Ac_stime uint64 @@ -816,3 +888,9 @@ const ( _CPU_SETSIZE = 0x400 _NCPUBITS = 0x40 ) + +const ( + BDADDR_BREDR = 0x0 + BDADDR_LE_PUBLIC = 0x1 + BDADDR_LE_RANDOM = 0x2 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go index dff3f1f9c..7106b512d 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -52,7 +52,7 @@ type Timex struct { Errcnt int32 Stbcnt int32 Tai int32 - Pad_cgo_0 [44]byte + _ [44]byte } type Time_t int32 @@ -116,29 +116,59 @@ type Stat_t struct { } type Statfs_t struct { - Type int32 - Bsize int32 - Frsize int32 - Pad_cgo_0 [4]byte - Blocks uint64 - Bfree uint64 - Files uint64 - Ffree uint64 - Bavail uint64 - Fsid Fsid - Namelen int32 - Flags int32 - Spare [5]int32 - Pad_cgo_1 [4]byte + Type int32 + Bsize int32 + Frsize int32 + _ [4]byte + Blocks uint64 + Bfree uint64 + Files uint64 + Ffree uint64 + Bavail uint64 + Fsid Fsid + Namelen int32 + Flags int32 + Spare [5]int32 + _ [4]byte +} + +type StatxTimestamp struct { + Sec int64 + Nsec uint32 + X__reserved int32 +} + +type Statx_t struct { + Mask uint32 + Blksize uint32 + Attributes uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Mode uint16 + _ [1]uint16 + Ino uint64 + Size uint64 + Blocks uint64 + Attributes_mask uint64 + Atime StatxTimestamp + Btime StatxTimestamp + Ctime StatxTimestamp + Mtime StatxTimestamp + Rdev_major uint32 + Rdev_minor uint32 + Dev_major uint32 + Dev_minor uint32 + _ [14]uint64 } type Dirent struct { - Ino uint64 - Off int64 - Reclen uint16 - Type uint8 - Name [256]int8 - Pad_cgo_0 [5]byte + Ino uint64 + Off int64 + Reclen uint16 + Type uint8 + Name [256]int8 + _ [5]byte } type Fsid struct { @@ -146,13 +176,13 @@ type Fsid struct { } type Flock_t struct { - Type int16 - Whence int16 - Pad_cgo_0 [4]byte - Start int64 - Len int64 - Pid int32 - Pad_cgo_1 [4]byte + Type int16 + Whence int16 + _ [4]byte + Start int64 + Len int64 + Pid int32 + _ [4]byte } type FscryptPolicy struct { @@ -227,11 +257,20 @@ type RawSockaddrHCI struct { Channel uint16 } +type RawSockaddrL2 struct { + Family uint16 + Psm uint16 + Bdaddr [6]uint8 + Cid uint16 + Bdaddr_type uint8 + _ [1]byte +} + type RawSockaddrCAN struct { - Family uint16 - Pad_cgo_0 [2]byte - Ifindex int32 - Addr [8]byte + Family uint16 + _ [2]byte + Ifindex int32 + Addr [8]byte } type RawSockaddrALG struct { @@ -344,7 +383,7 @@ type TCPInfo struct { Probes uint8 Backoff uint8 Options uint8 - Pad_cgo_0 [2]byte + _ [2]byte Rto uint32 Ato uint32 Snd_mss uint32 @@ -379,6 +418,7 @@ const ( SizeofSockaddrLinklayer = 0x14 SizeofSockaddrNetlink = 0xc SizeofSockaddrHCI = 0x6 + SizeofSockaddrL2 = 0xe SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 @@ -399,97 +439,123 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x2c - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x2e + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { @@ -568,9 +634,9 @@ type SockFilter struct { } type SockFprog struct { - Len uint16 - Pad_cgo_0 [2]byte - Filter *SockFilter + Len uint16 + _ [2]byte + Filter *SockFilter } type InotifyEvent struct { @@ -637,9 +703,15 @@ type EpollEvent struct { } const ( - AT_FDCWD = -0x64 - AT_NO_AUTOMOUNT = 0x800 - AT_REMOVEDIR = 0x200 + AT_EMPTY_PATH = 0x1000 + AT_FDCWD = -0x64 + AT_NO_AUTOMOUNT = 0x800 + AT_REMOVEDIR = 0x200 + + AT_STATX_SYNC_AS_STAT = 0x0 + AT_STATX_FORCE_SYNC = 0x2000 + AT_STATX_DONT_SYNC = 0x4000 + AT_SYMLINK_FOLLOW = 0x400 AT_SYMLINK_NOFOLLOW = 0x100 ) @@ -688,11 +760,11 @@ type Winsize struct { type Taskstats struct { Version uint16 - Pad_cgo_0 [2]byte + _ [2]byte Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 - Pad_cgo_1 [6]byte + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -704,13 +776,13 @@ type Taskstats struct { Ac_comm [32]int8 Ac_sched uint8 Ac_pad [3]uint8 - Pad_cgo_2 [4]byte + _ [4]byte Ac_uid uint32 Ac_gid uint32 Ac_pid uint32 Ac_ppid uint32 Ac_btime uint32 - Pad_cgo_3 [4]byte + _ [4]byte Ac_etime uint64 Ac_utime uint64 Ac_stime uint64 @@ -811,3 +883,9 @@ const ( _CPU_SETSIZE = 0x400 _NCPUBITS = 0x20 ) + +const ( + BDADDR_BREDR = 0x0 + BDADDR_LE_PUBLIC = 0x1 + BDADDR_LE_RANDOM = 0x2 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go index 86c747558..319071c8b 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -33,13 +33,13 @@ type Timeval struct { type Timex struct { Modes uint32 - Pad_cgo_0 [4]byte + _ [4]byte Offset int64 Freq int64 Maxerror int64 Esterror int64 Status int32 - Pad_cgo_1 [4]byte + _ [4]byte Constant int64 Precision int64 Tolerance int64 @@ -48,14 +48,14 @@ type Timex struct { Ppsfreq int64 Jitter int64 Shift int32 - Pad_cgo_2 [4]byte + _ [4]byte Stabil int64 Jitcnt int64 Calcnt int64 Errcnt int64 Stbcnt int64 Tai int32 - Pad_cgo_3 [44]byte + _ [44]byte } type Time_t int64 @@ -133,13 +133,43 @@ type Statfs_t struct { Spare [4]int64 } +type StatxTimestamp struct { + Sec int64 + Nsec uint32 + X__reserved int32 +} + +type Statx_t struct { + Mask uint32 + Blksize uint32 + Attributes uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Mode uint16 + _ [1]uint16 + Ino uint64 + Size uint64 + Blocks uint64 + Attributes_mask uint64 + Atime StatxTimestamp + Btime StatxTimestamp + Ctime StatxTimestamp + Mtime StatxTimestamp + Rdev_major uint32 + Rdev_minor uint32 + Dev_major uint32 + Dev_minor uint32 + _ [14]uint64 +} + type Dirent struct { - Ino uint64 - Off int64 - Reclen uint16 - Type uint8 - Name [256]uint8 - Pad_cgo_0 [5]byte + Ino uint64 + Off int64 + Reclen uint16 + Type uint8 + Name [256]uint8 + _ [5]byte } type Fsid struct { @@ -147,13 +177,13 @@ type Fsid struct { } type Flock_t struct { - Type int16 - Whence int16 - Pad_cgo_0 [4]byte - Start int64 - Len int64 - Pid int32 - Pad_cgo_1 [4]byte + Type int16 + Whence int16 + _ [4]byte + Start int64 + Len int64 + Pid int32 + _ [4]byte } type FscryptPolicy struct { @@ -228,11 +258,20 @@ type RawSockaddrHCI struct { Channel uint16 } +type RawSockaddrL2 struct { + Family uint16 + Psm uint16 + Bdaddr [6]uint8 + Cid uint16 + Bdaddr_type uint8 + _ [1]byte +} + type RawSockaddrCAN struct { - Family uint16 - Pad_cgo_0 [2]byte - Ifindex int32 - Addr [8]byte + Family uint16 + _ [2]byte + Ifindex int32 + Addr [8]byte } type RawSockaddrALG struct { @@ -299,13 +338,13 @@ type PacketMreq struct { type Msghdr struct { Name *byte Namelen uint32 - Pad_cgo_0 [4]byte + _ [4]byte Iov *Iovec Iovlen uint64 Control *byte Controllen uint64 Flags int32 - Pad_cgo_1 [4]byte + _ [4]byte } type Cmsghdr struct { @@ -347,7 +386,7 @@ type TCPInfo struct { Probes uint8 Backoff uint8 Options uint8 - Pad_cgo_0 [2]byte + _ [2]byte Rto uint32 Ato uint32 Snd_mss uint32 @@ -382,6 +421,7 @@ const ( SizeofSockaddrLinklayer = 0x14 SizeofSockaddrNetlink = 0xc SizeofSockaddrHCI = 0x6 + SizeofSockaddrL2 = 0xe SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 @@ -402,97 +442,123 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x2c - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x2e + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { @@ -571,9 +637,9 @@ type SockFilter struct { } type SockFprog struct { - Len uint16 - Pad_cgo_0 [6]byte - Filter *SockFilter + Len uint16 + _ [6]byte + Filter *SockFilter } type InotifyEvent struct { @@ -616,12 +682,12 @@ type Sysinfo_t struct { Freeswap uint64 Procs uint16 Pad uint16 - Pad_cgo_0 [4]byte + _ [4]byte Totalhigh uint64 Freehigh uint64 Unit uint32 X_f [0]uint8 - Pad_cgo_1 [4]byte + _ [4]byte } type Utsname struct { @@ -634,12 +700,12 @@ type Utsname struct { } type Ustat_t struct { - Tfree int32 - Pad_cgo_0 [4]byte - Tinode uint64 - Fname [6]uint8 - Fpack [6]uint8 - Pad_cgo_1 [4]byte + Tfree int32 + _ [4]byte + Tinode uint64 + Fname [6]uint8 + Fpack [6]uint8 + _ [4]byte } type EpollEvent struct { @@ -650,9 +716,15 @@ type EpollEvent struct { } const ( - AT_FDCWD = -0x64 - AT_NO_AUTOMOUNT = 0x800 - AT_REMOVEDIR = 0x200 + AT_EMPTY_PATH = 0x1000 + AT_FDCWD = -0x64 + AT_NO_AUTOMOUNT = 0x800 + AT_REMOVEDIR = 0x200 + + AT_STATX_SYNC_AS_STAT = 0x0 + AT_STATX_FORCE_SYNC = 0x2000 + AT_STATX_DONT_SYNC = 0x4000 + AT_SYMLINK_FOLLOW = 0x400 AT_SYMLINK_NOFOLLOW = 0x100 ) @@ -701,11 +773,11 @@ type Winsize struct { type Taskstats struct { Version uint16 - Pad_cgo_0 [2]byte + _ [2]byte Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 - Pad_cgo_1 [6]byte + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -717,13 +789,13 @@ type Taskstats struct { Ac_comm [32]uint8 Ac_sched uint8 Ac_pad [3]uint8 - Pad_cgo_2 [4]byte + _ [4]byte Ac_uid uint32 Ac_gid uint32 Ac_pid uint32 Ac_ppid uint32 Ac_btime uint32 - Pad_cgo_3 [4]byte + _ [4]byte Ac_etime uint64 Ac_utime uint64 Ac_stime uint64 @@ -824,3 +896,9 @@ const ( _CPU_SETSIZE = 0x400 _NCPUBITS = 0x40 ) + +const ( + BDADDR_BREDR = 0x0 + BDADDR_LE_PUBLIC = 0x1 + BDADDR_LE_RANDOM = 0x2 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go index 1cc159ed9..ef00ed498 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -33,13 +33,13 @@ type Timeval struct { type Timex struct { Modes uint32 - Pad_cgo_0 [4]byte + _ [4]byte Offset int64 Freq int64 Maxerror int64 Esterror int64 Status int32 - Pad_cgo_1 [4]byte + _ [4]byte Constant int64 Precision int64 Tolerance int64 @@ -48,14 +48,14 @@ type Timex struct { Ppsfreq int64 Jitter int64 Shift int32 - Pad_cgo_2 [4]byte + _ [4]byte Stabil int64 Jitcnt int64 Calcnt int64 Errcnt int64 Stbcnt int64 Tai int32 - Pad_cgo_3 [44]byte + _ [44]byte } type Time_t int64 @@ -133,13 +133,43 @@ type Statfs_t struct { Spare [4]int64 } +type StatxTimestamp struct { + Sec int64 + Nsec uint32 + X__reserved int32 +} + +type Statx_t struct { + Mask uint32 + Blksize uint32 + Attributes uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Mode uint16 + _ [1]uint16 + Ino uint64 + Size uint64 + Blocks uint64 + Attributes_mask uint64 + Atime StatxTimestamp + Btime StatxTimestamp + Ctime StatxTimestamp + Mtime StatxTimestamp + Rdev_major uint32 + Rdev_minor uint32 + Dev_major uint32 + Dev_minor uint32 + _ [14]uint64 +} + type Dirent struct { - Ino uint64 - Off int64 - Reclen uint16 - Type uint8 - Name [256]uint8 - Pad_cgo_0 [5]byte + Ino uint64 + Off int64 + Reclen uint16 + Type uint8 + Name [256]uint8 + _ [5]byte } type Fsid struct { @@ -147,13 +177,13 @@ type Fsid struct { } type Flock_t struct { - Type int16 - Whence int16 - Pad_cgo_0 [4]byte - Start int64 - Len int64 - Pid int32 - Pad_cgo_1 [4]byte + Type int16 + Whence int16 + _ [4]byte + Start int64 + Len int64 + Pid int32 + _ [4]byte } type FscryptPolicy struct { @@ -228,11 +258,20 @@ type RawSockaddrHCI struct { Channel uint16 } +type RawSockaddrL2 struct { + Family uint16 + Psm uint16 + Bdaddr [6]uint8 + Cid uint16 + Bdaddr_type uint8 + _ [1]byte +} + type RawSockaddrCAN struct { - Family uint16 - Pad_cgo_0 [2]byte - Ifindex int32 - Addr [8]byte + Family uint16 + _ [2]byte + Ifindex int32 + Addr [8]byte } type RawSockaddrALG struct { @@ -299,13 +338,13 @@ type PacketMreq struct { type Msghdr struct { Name *byte Namelen uint32 - Pad_cgo_0 [4]byte + _ [4]byte Iov *Iovec Iovlen uint64 Control *byte Controllen uint64 Flags int32 - Pad_cgo_1 [4]byte + _ [4]byte } type Cmsghdr struct { @@ -347,7 +386,7 @@ type TCPInfo struct { Probes uint8 Backoff uint8 Options uint8 - Pad_cgo_0 [2]byte + _ [2]byte Rto uint32 Ato uint32 Snd_mss uint32 @@ -382,6 +421,7 @@ const ( SizeofSockaddrLinklayer = 0x14 SizeofSockaddrNetlink = 0xc SizeofSockaddrHCI = 0x6 + SizeofSockaddrL2 = 0xe SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 @@ -402,97 +442,123 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x2c - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x2e + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { @@ -571,9 +637,9 @@ type SockFilter struct { } type SockFprog struct { - Len uint16 - Pad_cgo_0 [6]byte - Filter *SockFilter + Len uint16 + _ [6]byte + Filter *SockFilter } type InotifyEvent struct { @@ -616,12 +682,12 @@ type Sysinfo_t struct { Freeswap uint64 Procs uint16 Pad uint16 - Pad_cgo_0 [4]byte + _ [4]byte Totalhigh uint64 Freehigh uint64 Unit uint32 X_f [0]uint8 - Pad_cgo_1 [4]byte + _ [4]byte } type Utsname struct { @@ -634,12 +700,12 @@ type Utsname struct { } type Ustat_t struct { - Tfree int32 - Pad_cgo_0 [4]byte - Tinode uint64 - Fname [6]uint8 - Fpack [6]uint8 - Pad_cgo_1 [4]byte + Tfree int32 + _ [4]byte + Tinode uint64 + Fname [6]uint8 + Fpack [6]uint8 + _ [4]byte } type EpollEvent struct { @@ -650,9 +716,15 @@ type EpollEvent struct { } const ( - AT_FDCWD = -0x64 - AT_NO_AUTOMOUNT = 0x800 - AT_REMOVEDIR = 0x200 + AT_EMPTY_PATH = 0x1000 + AT_FDCWD = -0x64 + AT_NO_AUTOMOUNT = 0x800 + AT_REMOVEDIR = 0x200 + + AT_STATX_SYNC_AS_STAT = 0x0 + AT_STATX_FORCE_SYNC = 0x2000 + AT_STATX_DONT_SYNC = 0x4000 + AT_SYMLINK_FOLLOW = 0x400 AT_SYMLINK_NOFOLLOW = 0x100 ) @@ -701,11 +773,11 @@ type Winsize struct { type Taskstats struct { Version uint16 - Pad_cgo_0 [2]byte + _ [2]byte Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 - Pad_cgo_1 [6]byte + _ [6]byte Cpu_count uint64 Cpu_delay_total uint64 Blkio_count uint64 @@ -717,13 +789,13 @@ type Taskstats struct { Ac_comm [32]uint8 Ac_sched uint8 Ac_pad [3]uint8 - Pad_cgo_2 [4]byte + _ [4]byte Ac_uid uint32 Ac_gid uint32 Ac_pid uint32 Ac_ppid uint32 Ac_btime uint32 - Pad_cgo_3 [4]byte + _ [4]byte Ac_etime uint64 Ac_utime uint64 Ac_stime uint64 @@ -824,3 +896,9 @@ const ( _CPU_SETSIZE = 0x400 _NCPUBITS = 0x40 ) + +const ( + BDADDR_BREDR = 0x0 + BDADDR_LE_PUBLIC = 0x1 + BDADDR_LE_RANDOM = 0x2 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go index 2d27c0fc5..e9ee49706 100644 --- a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -132,6 +132,36 @@ type Statfs_t struct { _ [4]byte } +type StatxTimestamp struct { + Sec int64 + Nsec uint32 + _ int32 +} + +type Statx_t struct { + Mask uint32 + Blksize uint32 + Attributes uint64 + Nlink uint32 + Uid uint32 + Gid uint32 + Mode uint16 + _ [1]uint16 + Ino uint64 + Size uint64 + Blocks uint64 + Attributes_mask uint64 + Atime StatxTimestamp + Btime StatxTimestamp + Ctime StatxTimestamp + Mtime StatxTimestamp + Rdev_major uint32 + Rdev_minor uint32 + Dev_major uint32 + Dev_minor uint32 + _ [14]uint64 +} + type Dirent struct { Ino uint64 Off int64 @@ -227,6 +257,15 @@ type RawSockaddrHCI struct { Channel uint16 } +type RawSockaddrL2 struct { + Family uint16 + Psm uint16 + Bdaddr [6]uint8 + Cid uint16 + Bdaddr_type uint8 + _ [1]byte +} + type RawSockaddrCAN struct { Family uint16 _ [2]byte @@ -381,6 +420,7 @@ const ( SizeofSockaddrLinklayer = 0x14 SizeofSockaddrNetlink = 0xc SizeofSockaddrHCI = 0x6 + SizeofSockaddrL2 = 0xe SizeofSockaddrCAN = 0x10 SizeofSockaddrALG = 0x58 SizeofSockaddrVM = 0x10 @@ -401,97 +441,123 @@ const ( ) const ( - IFA_UNSPEC = 0x0 - IFA_ADDRESS = 0x1 - IFA_LOCAL = 0x2 - IFA_LABEL = 0x3 - IFA_BROADCAST = 0x4 - IFA_ANYCAST = 0x5 - IFA_CACHEINFO = 0x6 - IFA_MULTICAST = 0x7 - IFLA_UNSPEC = 0x0 - IFLA_ADDRESS = 0x1 - IFLA_BROADCAST = 0x2 - IFLA_IFNAME = 0x3 - IFLA_MTU = 0x4 - IFLA_LINK = 0x5 - IFLA_QDISC = 0x6 - IFLA_STATS = 0x7 - IFLA_COST = 0x8 - IFLA_PRIORITY = 0x9 - IFLA_MASTER = 0xa - IFLA_WIRELESS = 0xb - IFLA_PROTINFO = 0xc - IFLA_TXQLEN = 0xd - IFLA_MAP = 0xe - IFLA_WEIGHT = 0xf - IFLA_OPERSTATE = 0x10 - IFLA_LINKMODE = 0x11 - IFLA_LINKINFO = 0x12 - IFLA_NET_NS_PID = 0x13 - IFLA_IFALIAS = 0x14 - IFLA_MAX = 0x2c - RT_SCOPE_UNIVERSE = 0x0 - RT_SCOPE_SITE = 0xc8 - RT_SCOPE_LINK = 0xfd - RT_SCOPE_HOST = 0xfe - RT_SCOPE_NOWHERE = 0xff - RT_TABLE_UNSPEC = 0x0 - RT_TABLE_COMPAT = 0xfc - RT_TABLE_DEFAULT = 0xfd - RT_TABLE_MAIN = 0xfe - RT_TABLE_LOCAL = 0xff - RT_TABLE_MAX = 0xffffffff - RTA_UNSPEC = 0x0 - RTA_DST = 0x1 - RTA_SRC = 0x2 - RTA_IIF = 0x3 - RTA_OIF = 0x4 - RTA_GATEWAY = 0x5 - RTA_PRIORITY = 0x6 - RTA_PREFSRC = 0x7 - RTA_METRICS = 0x8 - RTA_MULTIPATH = 0x9 - RTA_FLOW = 0xb - RTA_CACHEINFO = 0xc - RTA_TABLE = 0xf - RTN_UNSPEC = 0x0 - RTN_UNICAST = 0x1 - RTN_LOCAL = 0x2 - RTN_BROADCAST = 0x3 - RTN_ANYCAST = 0x4 - RTN_MULTICAST = 0x5 - RTN_BLACKHOLE = 0x6 - RTN_UNREACHABLE = 0x7 - RTN_PROHIBIT = 0x8 - RTN_THROW = 0x9 - RTN_NAT = 0xa - RTN_XRESOLVE = 0xb - RTNLGRP_NONE = 0x0 - RTNLGRP_LINK = 0x1 - RTNLGRP_NOTIFY = 0x2 - RTNLGRP_NEIGH = 0x3 - RTNLGRP_TC = 0x4 - RTNLGRP_IPV4_IFADDR = 0x5 - RTNLGRP_IPV4_MROUTE = 0x6 - RTNLGRP_IPV4_ROUTE = 0x7 - RTNLGRP_IPV4_RULE = 0x8 - RTNLGRP_IPV6_IFADDR = 0x9 - RTNLGRP_IPV6_MROUTE = 0xa - RTNLGRP_IPV6_ROUTE = 0xb - RTNLGRP_IPV6_IFINFO = 0xc - RTNLGRP_IPV6_PREFIX = 0x12 - RTNLGRP_IPV6_RULE = 0x13 - RTNLGRP_ND_USEROPT = 0x14 - SizeofNlMsghdr = 0x10 - SizeofNlMsgerr = 0x14 - SizeofRtGenmsg = 0x1 - SizeofNlAttr = 0x4 - SizeofRtAttr = 0x4 - SizeofIfInfomsg = 0x10 - SizeofIfAddrmsg = 0x8 - SizeofRtMsg = 0xc - SizeofRtNexthop = 0x8 + IFA_UNSPEC = 0x0 + IFA_ADDRESS = 0x1 + IFA_LOCAL = 0x2 + IFA_LABEL = 0x3 + IFA_BROADCAST = 0x4 + IFA_ANYCAST = 0x5 + IFA_CACHEINFO = 0x6 + IFA_MULTICAST = 0x7 + IFLA_UNSPEC = 0x0 + IFLA_ADDRESS = 0x1 + IFLA_BROADCAST = 0x2 + IFLA_IFNAME = 0x3 + IFLA_MTU = 0x4 + IFLA_LINK = 0x5 + IFLA_QDISC = 0x6 + IFLA_STATS = 0x7 + IFLA_COST = 0x8 + IFLA_PRIORITY = 0x9 + IFLA_MASTER = 0xa + IFLA_WIRELESS = 0xb + IFLA_PROTINFO = 0xc + IFLA_TXQLEN = 0xd + IFLA_MAP = 0xe + IFLA_WEIGHT = 0xf + IFLA_OPERSTATE = 0x10 + IFLA_LINKMODE = 0x11 + IFLA_LINKINFO = 0x12 + IFLA_NET_NS_PID = 0x13 + IFLA_IFALIAS = 0x14 + IFLA_NUM_VF = 0x15 + IFLA_VFINFO_LIST = 0x16 + IFLA_STATS64 = 0x17 + IFLA_VF_PORTS = 0x18 + IFLA_PORT_SELF = 0x19 + IFLA_AF_SPEC = 0x1a + IFLA_GROUP = 0x1b + IFLA_NET_NS_FD = 0x1c + IFLA_EXT_MASK = 0x1d + IFLA_PROMISCUITY = 0x1e + IFLA_NUM_TX_QUEUES = 0x1f + IFLA_NUM_RX_QUEUES = 0x20 + IFLA_CARRIER = 0x21 + IFLA_PHYS_PORT_ID = 0x22 + IFLA_CARRIER_CHANGES = 0x23 + IFLA_PHYS_SWITCH_ID = 0x24 + IFLA_LINK_NETNSID = 0x25 + IFLA_PHYS_PORT_NAME = 0x26 + IFLA_PROTO_DOWN = 0x27 + IFLA_GSO_MAX_SEGS = 0x28 + IFLA_GSO_MAX_SIZE = 0x29 + IFLA_PAD = 0x2a + IFLA_XDP = 0x2b + IFLA_EVENT = 0x2c + IFLA_NEW_NETNSID = 0x2d + IFLA_IF_NETNSID = 0x2e + IFLA_MAX = 0x2e + RT_SCOPE_UNIVERSE = 0x0 + RT_SCOPE_SITE = 0xc8 + RT_SCOPE_LINK = 0xfd + RT_SCOPE_HOST = 0xfe + RT_SCOPE_NOWHERE = 0xff + RT_TABLE_UNSPEC = 0x0 + RT_TABLE_COMPAT = 0xfc + RT_TABLE_DEFAULT = 0xfd + RT_TABLE_MAIN = 0xfe + RT_TABLE_LOCAL = 0xff + RT_TABLE_MAX = 0xffffffff + RTA_UNSPEC = 0x0 + RTA_DST = 0x1 + RTA_SRC = 0x2 + RTA_IIF = 0x3 + RTA_OIF = 0x4 + RTA_GATEWAY = 0x5 + RTA_PRIORITY = 0x6 + RTA_PREFSRC = 0x7 + RTA_METRICS = 0x8 + RTA_MULTIPATH = 0x9 + RTA_FLOW = 0xb + RTA_CACHEINFO = 0xc + RTA_TABLE = 0xf + RTN_UNSPEC = 0x0 + RTN_UNICAST = 0x1 + RTN_LOCAL = 0x2 + RTN_BROADCAST = 0x3 + RTN_ANYCAST = 0x4 + RTN_MULTICAST = 0x5 + RTN_BLACKHOLE = 0x6 + RTN_UNREACHABLE = 0x7 + RTN_PROHIBIT = 0x8 + RTN_THROW = 0x9 + RTN_NAT = 0xa + RTN_XRESOLVE = 0xb + RTNLGRP_NONE = 0x0 + RTNLGRP_LINK = 0x1 + RTNLGRP_NOTIFY = 0x2 + RTNLGRP_NEIGH = 0x3 + RTNLGRP_TC = 0x4 + RTNLGRP_IPV4_IFADDR = 0x5 + RTNLGRP_IPV4_MROUTE = 0x6 + RTNLGRP_IPV4_ROUTE = 0x7 + RTNLGRP_IPV4_RULE = 0x8 + RTNLGRP_IPV6_IFADDR = 0x9 + RTNLGRP_IPV6_MROUTE = 0xa + RTNLGRP_IPV6_ROUTE = 0xb + RTNLGRP_IPV6_IFINFO = 0xc + RTNLGRP_IPV6_PREFIX = 0x12 + RTNLGRP_IPV6_RULE = 0x13 + RTNLGRP_ND_USEROPT = 0x14 + SizeofNlMsghdr = 0x10 + SizeofNlMsgerr = 0x14 + SizeofRtGenmsg = 0x1 + SizeofNlAttr = 0x4 + SizeofRtAttr = 0x4 + SizeofIfInfomsg = 0x10 + SizeofIfAddrmsg = 0x8 + SizeofRtMsg = 0xc + SizeofRtNexthop = 0x8 ) type NlMsghdr struct { @@ -667,9 +733,15 @@ type EpollEvent struct { } const ( - AT_FDCWD = -0x64 - AT_NO_AUTOMOUNT = 0x800 - AT_REMOVEDIR = 0x200 + AT_EMPTY_PATH = 0x1000 + AT_FDCWD = -0x64 + AT_NO_AUTOMOUNT = 0x800 + AT_REMOVEDIR = 0x200 + + AT_STATX_SYNC_AS_STAT = 0x0 + AT_STATX_FORCE_SYNC = 0x2000 + AT_STATX_DONT_SYNC = 0x4000 + AT_SYMLINK_FOLLOW = 0x400 AT_SYMLINK_NOFOLLOW = 0x100 ) @@ -841,3 +913,9 @@ const ( _CPU_SETSIZE = 0x400 _NCPUBITS = 0x40 ) + +const ( + BDADDR_BREDR = 0x0 + BDADDR_LE_PUBLIC = 0x1 + BDADDR_LE_RANDOM = 0x2 +) diff --git a/vendor/golang.org/x/text/.gitattributes b/vendor/golang.org/x/text/.gitattributes deleted file mode 100644 index d2f212e5d..000000000 --- a/vendor/golang.org/x/text/.gitattributes +++ /dev/null @@ -1,10 +0,0 @@ -# Treat all files in this repo as binary, with no git magic updating -# line endings. Windows users contributing to Go will need to use a -# modern version of git and editors capable of LF line endings. -# -# We'll prevent accidental CRLF line endings from entering the repo -# via the git-review gofmt checks. -# -# See golang.org/issue/9281 - -* -text diff --git a/vendor/golang.org/x/text/.gitignore b/vendor/golang.org/x/text/.gitignore deleted file mode 100644 index b2de568ba..000000000 --- a/vendor/golang.org/x/text/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -# Add no patterns to .gitignore except for files generated by the build. -last-change -/DATA -# This file is rather large and the tests really only need to be run -# after generation. -/unicode/norm/data_test.go \ No newline at end of file diff --git a/vendor/golang.org/x/text/AUTHORS b/vendor/golang.org/x/text/AUTHORS deleted file mode 100644 index 15167cd74..000000000 --- a/vendor/golang.org/x/text/AUTHORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code refers to The Go Authors for copyright purposes. -# The master list of authors is in the main Go distribution, -# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/golang.org/x/text/CONTRIBUTING.md b/vendor/golang.org/x/text/CONTRIBUTING.md deleted file mode 100644 index 88dff59bc..000000000 --- a/vendor/golang.org/x/text/CONTRIBUTING.md +++ /dev/null @@ -1,31 +0,0 @@ -# Contributing to Go - -Go is an open source project. - -It is the work of hundreds of contributors. We appreciate your help! - - -## Filing issues - -When [filing an issue](https://golang.org/issue/new), make sure to answer these five questions: - -1. What version of Go are you using (`go version`)? -2. What operating system and processor architecture are you using? -3. What did you do? -4. What did you expect to see? -5. What did you see instead? - -General questions should go to the [golang-nuts mailing list](https://groups.google.com/group/golang-nuts) instead of the issue tracker. -The gophers there will answer or ask you to file an issue if you've tripped over a bug. - -## Contributing code - -Please read the [Contribution Guidelines](https://golang.org/doc/contribute.html) -before sending patches. - -**We do not accept GitHub pull requests** -(we use [Gerrit](https://code.google.com/p/gerrit/) instead for code review). - -Unless otherwise noted, the Go source files are distributed under -the BSD-style license found in the LICENSE file. - diff --git a/vendor/golang.org/x/text/CONTRIBUTORS b/vendor/golang.org/x/text/CONTRIBUTORS deleted file mode 100644 index 1c4577e96..000000000 --- a/vendor/golang.org/x/text/CONTRIBUTORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code was written by the Go contributors. -# The master list of contributors is in the main Go distribution, -# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/vendor/golang.org/x/text/LICENSE b/vendor/golang.org/x/text/LICENSE deleted file mode 100644 index 6a66aea5e..000000000 --- a/vendor/golang.org/x/text/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. - * Neither the name of Google Inc. nor the names of its -contributors may be used to endorse or promote products derived from -this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/golang.org/x/text/PATENTS b/vendor/golang.org/x/text/PATENTS deleted file mode 100644 index 733099041..000000000 --- a/vendor/golang.org/x/text/PATENTS +++ /dev/null @@ -1,22 +0,0 @@ -Additional IP Rights Grant (Patents) - -"This implementation" means the copyrightable works distributed by -Google as part of the Go project. - -Google hereby grants to You a perpetual, worldwide, non-exclusive, -no-charge, royalty-free, irrevocable (except as stated in this section) -patent license to make, have made, use, offer to sell, sell, import, -transfer and otherwise run, modify and propagate the contents of this -implementation of Go, where such license applies only to those patent -claims, both currently owned or controlled by Google and acquired in -the future, licensable by Google that are necessarily infringed by this -implementation of Go. This grant does not include claims that would be -infringed only as a consequence of further modification of this -implementation. If you or your agent or exclusive licensee institute or -order or agree to the institution of patent litigation against any -entity (including a cross-claim or counterclaim in a lawsuit) alleging -that this implementation of Go or any code incorporated within this -implementation of Go constitutes direct or contributory patent -infringement, or inducement of patent infringement, then any patent -rights granted to you under this License for this implementation of Go -shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/text/README.md b/vendor/golang.org/x/text/README.md deleted file mode 100644 index b3f365eed..000000000 --- a/vendor/golang.org/x/text/README.md +++ /dev/null @@ -1,93 +0,0 @@ -# Go Text - -This repository holds supplementary Go libraries for text processing, many involving Unicode. - -## Semantic Versioning -This repo uses Semantic versioning (http://semver.org/), so -1. MAJOR version when you make incompatible API changes, -1. MINOR version when you add functionality in a backwards-compatible manner, - and -1. PATCH version when you make backwards-compatible bug fixes. - -Until version 1.0.0 of x/text is reached, the minor version is considered a -major version. So going from 0.1.0 to 0.2.0 is considered to be a major version -bump. - -A major new CLDR version is mapped to a minor version increase in x/text. -Any other new CLDR version is mapped to a patch version increase in x/text. - -It is important that the Unicode version used in `x/text` matches the one used -by your Go compiler. The `x/text` repository supports multiple versions of -Unicode and will match the version of Unicode to that of the Go compiler. At the -moment this is supported for Go compilers from version 1.7. - -## Download/Install - -The easiest way to install is to run `go get -u golang.org/x/text`. You can -also manually git clone the repository to `$GOPATH/src/golang.org/x/text`. - -## Contribute -To submit changes to this repository, see http://golang.org/doc/contribute.html. - -To generate the tables in this repository (except for the encoding tables), -run go generate from this directory. By default tables are generated for the -Unicode version in core and the CLDR version defined in -golang.org/x/text/unicode/cldr. - -Running go generate will as a side effect create a DATA subdirectory in this -directory, which holds all files that are used as a source for generating the -tables. This directory will also serve as a cache. - -## Testing -Run - - go test ./... - -from this directory to run all tests. Add the "-tags icu" flag to also run -ICU conformance tests (if available). This requires that you have the correct -ICU version installed on your system. - -TODO: -- updating unversioned source files. - -## Generating Tables - -To generate the tables in this repository (except for the encoding -tables), run `go generate` from this directory. By default tables are -generated for the Unicode version in core and the CLDR version defined in -golang.org/x/text/unicode/cldr. - -Running go generate will as a side effect create a DATA subdirectory in this -directory which holds all files that are used as a source for generating the -tables. This directory will also serve as a cache. - -## Versions -To update a Unicode version run - - UNICODE_VERSION=x.x.x go generate - -where `x.x.x` must correspond to a directory in http://www.unicode.org/Public/. -If this version is newer than the version in core it will also update the -relevant packages there. The idna package in x/net will always be updated. - -To update a CLDR version run - - CLDR_VERSION=version go generate - -where `version` must correspond to a directory in -http://www.unicode.org/Public/cldr/. - -Note that the code gets adapted over time to changes in the data and that -backwards compatibility is not maintained. -So updating to a different version may not work. - -The files in DATA/{iana|icu|w3|whatwg} are currently not versioned. - -## Report Issues / Send Patches - -This repository uses Gerrit for code changes. To learn how to submit changes to -this repository, see https://golang.org/doc/contribute.html. - -The main issue tracker for the image repository is located at -https://github.com/golang/go/issues. Prefix your issue with "x/image:" in the -subject line, so it is easy to find. diff --git a/vendor/golang.org/x/text/codereview.cfg b/vendor/golang.org/x/text/codereview.cfg deleted file mode 100644 index 3f8b14b64..000000000 --- a/vendor/golang.org/x/text/codereview.cfg +++ /dev/null @@ -1 +0,0 @@ -issuerepo: golang/go diff --git a/vendor/golang.org/x/text/doc.go b/vendor/golang.org/x/text/doc.go deleted file mode 100644 index a48e2843f..000000000 --- a/vendor/golang.org/x/text/doc.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:generate go run gen.go - -// text is a repository of text-related packages related to internationalization -// (i18n) and localization (l10n), such as character encodings, text -// transformations, and locale-specific text handling. -package text - -// TODO: more documentation on general concepts, such as Transformers, use -// of normalization, etc. diff --git a/vendor/golang.org/x/text/gen.go b/vendor/golang.org/x/text/gen.go deleted file mode 100644 index 757fefb74..000000000 --- a/vendor/golang.org/x/text/gen.go +++ /dev/null @@ -1,319 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build ignore - -// gen runs go generate on Unicode- and CLDR-related package in the text -// repositories, taking into account dependencies and versions. -package main - -import ( - "bytes" - "flag" - "fmt" - "go/build" - "go/format" - "io/ioutil" - "os" - "os/exec" - "path" - "path/filepath" - "regexp" - "runtime" - "strings" - "sync" - "unicode" - - "golang.org/x/text/collate" - "golang.org/x/text/internal/gen" - "golang.org/x/text/language" -) - -var ( - verbose = flag.Bool("v", false, "verbose output") - force = flag.Bool("force", false, "ignore failing dependencies") - doCore = flag.Bool("core", false, "force an update to core") - excludeList = flag.String("exclude", "", - "comma-separated list of packages to exclude") - - // The user can specify a selection of packages to build on the command line. - args []string -) - -func exclude(pkg string) bool { - if len(args) > 0 { - return !contains(args, pkg) - } - return contains(strings.Split(*excludeList, ","), pkg) -} - -// TODO: -// - Better version handling. -// - Generate tables for the core unicode package? -// - Add generation for encodings. This requires some retooling here and there. -// - Running repo-wide "long" tests. - -var vprintf = fmt.Printf - -func main() { - gen.Init() - args = flag.Args() - if !*verbose { - // Set vprintf to a no-op. - vprintf = func(string, ...interface{}) (int, error) { return 0, nil } - } - - // TODO: create temporary cache directory to load files and create and set - // a "cache" option if the user did not specify the UNICODE_DIR environment - // variable. This will prevent duplicate downloads and also will enable long - // tests, which really need to be run after each generated package. - - updateCore := *doCore - if gen.UnicodeVersion() != unicode.Version { - fmt.Printf("Requested Unicode version %s; core unicode version is %s.\n", - gen.UnicodeVersion(), - unicode.Version) - c := collate.New(language.Und, collate.Numeric) - if c.CompareString(gen.UnicodeVersion(), unicode.Version) < 0 && !*force { - os.Exit(2) - } - updateCore = true - goroot := os.Getenv("GOROOT") - appendToFile( - filepath.Join(goroot, "api", "except.txt"), - fmt.Sprintf("pkg unicode, const Version = %q\n", unicode.Version), - ) - const lines = `pkg unicode, const Version = %q -// TODO: add a new line of the following form for each new script and property. -pkg unicode, var *RangeTable -` - appendToFile( - filepath.Join(goroot, "api", "next.txt"), - fmt.Sprintf(lines, gen.UnicodeVersion()), - ) - } - - var unicode = &dependency{} - if updateCore { - fmt.Printf("Updating core to version %s...\n", gen.UnicodeVersion()) - unicode = generate("unicode") - - // Test some users of the unicode packages, especially the ones that - // keep a mirrored table. These may need to be corrected by hand. - generate("regexp", unicode) - generate("strconv", unicode) // mimics Unicode table - generate("strings", unicode) - generate("testing", unicode) // mimics Unicode table - } - - var ( - cldr = generate("./unicode/cldr", unicode) - language = generate("./language", cldr) - internal = generate("./internal", unicode, language) - norm = generate("./unicode/norm", unicode) - rangetable = generate("./unicode/rangetable", unicode) - cases = generate("./cases", unicode, norm, language, rangetable) - width = generate("./width", unicode) - bidi = generate("./unicode/bidi", unicode, norm, rangetable) - mib = generate("./encoding/internal/identifier", unicode) - number = generate("./internal/number", unicode, cldr, language, internal) - _ = generate("./encoding/htmlindex", unicode, language, mib) - _ = generate("./encoding/ianaindex", unicode, language, mib) - _ = generate("./secure/precis", unicode, norm, rangetable, cases, width, bidi) - _ = generate("./internal/cldrtree", language) - _ = generate("./currency", unicode, cldr, language, internal, number) - _ = generate("./feature/plural", unicode, cldr, language, internal, number) - _ = generate("./internal/export/idna", unicode, bidi, norm) - _ = generate("./language/display", unicode, cldr, language, internal, number) - _ = generate("./collate", unicode, norm, cldr, language, rangetable) - _ = generate("./search", unicode, norm, cldr, language, rangetable) - ) - all.Wait() - - // Copy exported packages to the destination golang.org repo. - copyExported("golang.org/x/net/idna") - - if updateCore { - copyVendored() - } - - if hasErrors { - fmt.Println("FAIL") - os.Exit(1) - } - vprintf("SUCCESS\n") -} - -func appendToFile(file, text string) { - fmt.Println("Augmenting", file) - w, err := os.OpenFile(file, os.O_APPEND|os.O_WRONLY, 0600) - if err != nil { - fmt.Println("Failed to open file:", err) - os.Exit(1) - } - defer w.Close() - if _, err := w.WriteString(text); err != nil { - fmt.Println("Failed to write to file:", err) - os.Exit(1) - } -} - -var ( - all sync.WaitGroup - hasErrors bool -) - -type dependency struct { - sync.WaitGroup - hasErrors bool -} - -func generate(pkg string, deps ...*dependency) *dependency { - var wg dependency - if exclude(pkg) { - return &wg - } - wg.Add(1) - all.Add(1) - go func() { - defer wg.Done() - defer all.Done() - // Wait for dependencies to finish. - for _, d := range deps { - d.Wait() - if d.hasErrors && !*force { - fmt.Printf("--- ABORT: %s\n", pkg) - wg.hasErrors = true - return - } - } - vprintf("=== GENERATE %s\n", pkg) - args := []string{"generate"} - if *verbose { - args = append(args, "-v") - } - args = append(args, pkg) - cmd := exec.Command(filepath.Join(runtime.GOROOT(), "bin", "go"), args...) - w := &bytes.Buffer{} - cmd.Stderr = w - cmd.Stdout = w - if err := cmd.Run(); err != nil { - fmt.Printf("--- FAIL: %s:\n\t%v\n\tError: %v\n", pkg, indent(w), err) - hasErrors = true - wg.hasErrors = true - return - } - - vprintf("=== TEST %s\n", pkg) - args[0] = "test" - cmd = exec.Command(filepath.Join(runtime.GOROOT(), "bin", "go"), args...) - wt := &bytes.Buffer{} - cmd.Stderr = wt - cmd.Stdout = wt - if err := cmd.Run(); err != nil { - fmt.Printf("--- FAIL: %s:\n\t%v\n\tError: %v\n", pkg, indent(wt), err) - hasErrors = true - wg.hasErrors = true - return - } - vprintf("--- SUCCESS: %s\n\t%v\n", pkg, indent(w)) - fmt.Print(wt.String()) - }() - return &wg -} - -// copyExported copies a package in x/text/internal/export to the -// destination repository. -func copyExported(p string) { - copyPackage( - filepath.Join("internal", "export", path.Base(p)), - filepath.Join("..", filepath.FromSlash(p[len("golang.org/x"):])), - "golang.org/x/text/internal/export/"+path.Base(p), - p) -} - -// copyVendored copies packages used by Go core into the vendored directory. -func copyVendored() { - root := filepath.Join(build.Default.GOROOT, filepath.FromSlash("src/vendor/golang_org/x")) - - err := filepath.Walk(root, func(dir string, info os.FileInfo, err error) error { - if err != nil || !info.IsDir() || root == dir { - return err - } - src := dir[len(root)+1:] - const slash = string(filepath.Separator) - if c := strings.Split(src, slash); c[0] == "text" { - // Copy a text repo package from its normal location. - src = strings.Join(c[1:], slash) - } else { - // Copy the vendored package if it exists in the export directory. - src = filepath.Join("internal", "export", filepath.Base(src)) - } - copyPackage(src, dir, "golang.org", "golang_org") - return nil - }) - if err != nil { - fmt.Printf("Seeding directory %s has failed %v:", root, err) - os.Exit(1) - } -} - -// goGenRE is used to remove go:generate lines. -var goGenRE = regexp.MustCompile("//go:generate[^\n]*\n") - -// copyPackage copies relevant files from a directory in x/text to the -// destination package directory. The destination package is assumed to have -// the same name. For each copied file go:generate lines are removed and -// and package comments are rewritten to the new path. -func copyPackage(dirSrc, dirDst, search, replace string) { - err := filepath.Walk(dirSrc, func(file string, info os.FileInfo, err error) error { - base := filepath.Base(file) - if err != nil || info.IsDir() || - !strings.HasSuffix(base, ".go") || - strings.HasSuffix(base, "_test.go") || - // Don't process subdirectories. - filepath.Dir(file) != dirSrc { - return nil - } - b, err := ioutil.ReadFile(file) - if err != nil || bytes.Contains(b, []byte("\n// +build ignore")) { - return err - } - // Fix paths. - b = bytes.Replace(b, []byte(search), []byte(replace), -1) - // Remove go:generate lines. - b = goGenRE.ReplaceAllLiteral(b, nil) - comment := "// Code generated by running \"go generate\" in golang.org/x/text. DO NOT EDIT.\n\n" - if *doCore { - comment = "// Code generated by running \"go run gen.go -core\" in golang.org/x/text. DO NOT EDIT.\n\n" - } - if !bytes.HasPrefix(b, []byte(comment)) { - b = append([]byte(comment), b...) - } - if b, err = format.Source(b); err != nil { - fmt.Println("Failed to format file:", err) - os.Exit(1) - } - file = filepath.Join(dirDst, base) - vprintf("=== COPY %s\n", file) - return ioutil.WriteFile(file, b, 0666) - }) - if err != nil { - fmt.Println("Copying exported files failed:", err) - os.Exit(1) - } -} - -func contains(a []string, s string) bool { - for _, e := range a { - if s == e { - return true - } - } - return false -} - -func indent(b *bytes.Buffer) string { - return strings.Replace(strings.TrimSpace(b.String()), "\n", "\n\t", -1) -} diff --git a/vendor/golang.org/x/text/internal/gen.go b/vendor/golang.org/x/text/internal/gen.go deleted file mode 100644 index 1d678af57..000000000 --- a/vendor/golang.org/x/text/internal/gen.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build ignore - -package main - -import ( - "log" - - "golang.org/x/text/internal/gen" - "golang.org/x/text/language" - "golang.org/x/text/unicode/cldr" -) - -func main() { - r := gen.OpenCLDRCoreZip() - defer r.Close() - - d := &cldr.Decoder{} - data, err := d.DecodeZip(r) - if err != nil { - log.Fatalf("DecodeZip: %v", err) - } - - w := gen.NewCodeWriter() - defer w.WriteGoFile("tables.go", "internal") - - // Create parents table. - parents := make([]uint16, language.NumCompactTags) - for _, loc := range data.Locales() { - tag := language.MustParse(loc) - index, ok := language.CompactIndex(tag) - if !ok { - continue - } - parentIndex := 0 // und - for p := tag.Parent(); p != language.Und; p = p.Parent() { - if x, ok := language.CompactIndex(p); ok { - parentIndex = x - break - } - } - parents[index] = uint16(parentIndex) - } - - w.WriteComment(` - Parent maps a compact index of a tag to the compact index of the parent of - this tag.`) - w.WriteVar("Parent", parents) -} diff --git a/vendor/golang.org/x/text/internal/gen/code.go b/vendor/golang.org/x/text/internal/gen/code.go deleted file mode 100644 index 0389509f2..000000000 --- a/vendor/golang.org/x/text/internal/gen/code.go +++ /dev/null @@ -1,369 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package gen - -import ( - "bytes" - "encoding/gob" - "fmt" - "hash" - "hash/fnv" - "io" - "log" - "os" - "reflect" - "strings" - "unicode" - "unicode/utf8" -) - -// This file contains utilities for generating code. - -// TODO: other write methods like: -// - slices, maps, types, etc. - -// CodeWriter is a utility for writing structured code. It computes the content -// hash and size of written content. It ensures there are newlines between -// written code blocks. -type CodeWriter struct { - buf bytes.Buffer - Size int - Hash hash.Hash32 // content hash - gob *gob.Encoder - // For comments we skip the usual one-line separator if they are followed by - // a code block. - skipSep bool -} - -func (w *CodeWriter) Write(p []byte) (n int, err error) { - return w.buf.Write(p) -} - -// NewCodeWriter returns a new CodeWriter. -func NewCodeWriter() *CodeWriter { - h := fnv.New32() - return &CodeWriter{Hash: h, gob: gob.NewEncoder(h)} -} - -// WriteGoFile appends the buffer with the total size of all created structures -// and writes it as a Go file to the the given file with the given package name. -func (w *CodeWriter) WriteGoFile(filename, pkg string) { - f, err := os.Create(filename) - if err != nil { - log.Fatalf("Could not create file %s: %v", filename, err) - } - defer f.Close() - if _, err = w.WriteGo(f, pkg, ""); err != nil { - log.Fatalf("Error writing file %s: %v", filename, err) - } -} - -// WriteVersionedGoFile appends the buffer with the total size of all created -// structures and writes it as a Go file to the the given file with the given -// package name and build tags for the current Unicode version, -func (w *CodeWriter) WriteVersionedGoFile(filename, pkg string) { - tags := buildTags() - if tags != "" { - filename = insertVersion(filename, UnicodeVersion()) - } - f, err := os.Create(filename) - if err != nil { - log.Fatalf("Could not create file %s: %v", filename, err) - } - defer f.Close() - if _, err = w.WriteGo(f, pkg, tags); err != nil { - log.Fatalf("Error writing file %s: %v", filename, err) - } -} - -// WriteGo appends the buffer with the total size of all created structures and -// writes it as a Go file to the the given writer with the given package name. -func (w *CodeWriter) WriteGo(out io.Writer, pkg, tags string) (n int, err error) { - sz := w.Size - w.WriteComment("Total table size %d bytes (%dKiB); checksum: %X\n", sz, sz/1024, w.Hash.Sum32()) - defer w.buf.Reset() - return WriteGo(out, pkg, tags, w.buf.Bytes()) -} - -func (w *CodeWriter) printf(f string, x ...interface{}) { - fmt.Fprintf(w, f, x...) -} - -func (w *CodeWriter) insertSep() { - if w.skipSep { - w.skipSep = false - return - } - // Use at least two newlines to ensure a blank space between the previous - // block. WriteGoFile will remove extraneous newlines. - w.printf("\n\n") -} - -// WriteComment writes a comment block. All line starts are prefixed with "//". -// Initial empty lines are gobbled. The indentation for the first line is -// stripped from consecutive lines. -func (w *CodeWriter) WriteComment(comment string, args ...interface{}) { - s := fmt.Sprintf(comment, args...) - s = strings.Trim(s, "\n") - - // Use at least two newlines to ensure a blank space between the previous - // block. WriteGoFile will remove extraneous newlines. - w.printf("\n\n// ") - w.skipSep = true - - // strip first indent level. - sep := "\n" - for ; len(s) > 0 && (s[0] == '\t' || s[0] == ' '); s = s[1:] { - sep += s[:1] - } - - strings.NewReplacer(sep, "\n// ", "\n", "\n// ").WriteString(w, s) - - w.printf("\n") -} - -func (w *CodeWriter) writeSizeInfo(size int) { - w.printf("// Size: %d bytes\n", size) -} - -// WriteConst writes a constant of the given name and value. -func (w *CodeWriter) WriteConst(name string, x interface{}) { - w.insertSep() - v := reflect.ValueOf(x) - - switch v.Type().Kind() { - case reflect.String: - w.printf("const %s %s = ", name, typeName(x)) - w.WriteString(v.String()) - w.printf("\n") - default: - w.printf("const %s = %#v\n", name, x) - } -} - -// WriteVar writes a variable of the given name and value. -func (w *CodeWriter) WriteVar(name string, x interface{}) { - w.insertSep() - v := reflect.ValueOf(x) - oldSize := w.Size - sz := int(v.Type().Size()) - w.Size += sz - - switch v.Type().Kind() { - case reflect.String: - w.printf("var %s %s = ", name, typeName(x)) - w.WriteString(v.String()) - case reflect.Struct: - w.gob.Encode(x) - fallthrough - case reflect.Slice, reflect.Array: - w.printf("var %s = ", name) - w.writeValue(v) - w.writeSizeInfo(w.Size - oldSize) - default: - w.printf("var %s %s = ", name, typeName(x)) - w.gob.Encode(x) - w.writeValue(v) - w.writeSizeInfo(w.Size - oldSize) - } - w.printf("\n") -} - -func (w *CodeWriter) writeValue(v reflect.Value) { - x := v.Interface() - switch v.Kind() { - case reflect.String: - w.WriteString(v.String()) - case reflect.Array: - // Don't double count: callers of WriteArray count on the size being - // added, so we need to discount it here. - w.Size -= int(v.Type().Size()) - w.writeSlice(x, true) - case reflect.Slice: - w.writeSlice(x, false) - case reflect.Struct: - w.printf("%s{\n", typeName(v.Interface())) - t := v.Type() - for i := 0; i < v.NumField(); i++ { - w.printf("%s: ", t.Field(i).Name) - w.writeValue(v.Field(i)) - w.printf(",\n") - } - w.printf("}") - default: - w.printf("%#v", x) - } -} - -// WriteString writes a string literal. -func (w *CodeWriter) WriteString(s string) { - s = strings.Replace(s, `\`, `\\`, -1) - io.WriteString(w.Hash, s) // content hash - w.Size += len(s) - - const maxInline = 40 - if len(s) <= maxInline { - w.printf("%q", s) - return - } - - // We will render the string as a multi-line string. - const maxWidth = 80 - 4 - len(`"`) - len(`" +`) - - // When starting on its own line, go fmt indents line 2+ an extra level. - n, max := maxWidth, maxWidth-4 - - // As per https://golang.org/issue/18078, the compiler has trouble - // compiling the concatenation of many strings, s0 + s1 + s2 + ... + sN, - // for large N. We insert redundant, explicit parentheses to work around - // that, lowering the N at any given step: (s0 + s1 + ... + s63) + (s64 + - // ... + s127) + etc + (etc + ... + sN). - explicitParens, extraComment := len(s) > 128*1024, "" - if explicitParens { - w.printf(`(`) - extraComment = "; the redundant, explicit parens are for https://golang.org/issue/18078" - } - - // Print "" +\n, if a string does not start on its own line. - b := w.buf.Bytes() - if p := len(bytes.TrimRight(b, " \t")); p > 0 && b[p-1] != '\n' { - w.printf("\"\" + // Size: %d bytes%s\n", len(s), extraComment) - n, max = maxWidth, maxWidth - } - - w.printf(`"`) - - for sz, p, nLines := 0, 0, 0; p < len(s); { - var r rune - r, sz = utf8.DecodeRuneInString(s[p:]) - out := s[p : p+sz] - chars := 1 - if !unicode.IsPrint(r) || r == utf8.RuneError || r == '"' { - switch sz { - case 1: - out = fmt.Sprintf("\\x%02x", s[p]) - case 2, 3: - out = fmt.Sprintf("\\u%04x", r) - case 4: - out = fmt.Sprintf("\\U%08x", r) - } - chars = len(out) - } - if n -= chars; n < 0 { - nLines++ - if explicitParens && nLines&63 == 63 { - w.printf("\") + (\"") - } - w.printf("\" +\n\"") - n = max - len(out) - } - w.printf("%s", out) - p += sz - } - w.printf(`"`) - if explicitParens { - w.printf(`)`) - } -} - -// WriteSlice writes a slice value. -func (w *CodeWriter) WriteSlice(x interface{}) { - w.writeSlice(x, false) -} - -// WriteArray writes an array value. -func (w *CodeWriter) WriteArray(x interface{}) { - w.writeSlice(x, true) -} - -func (w *CodeWriter) writeSlice(x interface{}, isArray bool) { - v := reflect.ValueOf(x) - w.gob.Encode(v.Len()) - w.Size += v.Len() * int(v.Type().Elem().Size()) - name := typeName(x) - if isArray { - name = fmt.Sprintf("[%d]%s", v.Len(), name[strings.Index(name, "]")+1:]) - } - if isArray { - w.printf("%s{\n", name) - } else { - w.printf("%s{ // %d elements\n", name, v.Len()) - } - - switch kind := v.Type().Elem().Kind(); kind { - case reflect.String: - for _, s := range x.([]string) { - w.WriteString(s) - w.printf(",\n") - } - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, - reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - // nLine and nBlock are the number of elements per line and block. - nLine, nBlock, format := 8, 64, "%d," - switch kind { - case reflect.Uint8: - format = "%#02x," - case reflect.Uint16: - format = "%#04x," - case reflect.Uint32: - nLine, nBlock, format = 4, 32, "%#08x," - case reflect.Uint, reflect.Uint64: - nLine, nBlock, format = 4, 32, "%#016x," - case reflect.Int8: - nLine = 16 - } - n := nLine - for i := 0; i < v.Len(); i++ { - if i%nBlock == 0 && v.Len() > nBlock { - w.printf("// Entry %X - %X\n", i, i+nBlock-1) - } - x := v.Index(i).Interface() - w.gob.Encode(x) - w.printf(format, x) - if n--; n == 0 { - n = nLine - w.printf("\n") - } - } - w.printf("\n") - case reflect.Struct: - zero := reflect.Zero(v.Type().Elem()).Interface() - for i := 0; i < v.Len(); i++ { - x := v.Index(i).Interface() - w.gob.EncodeValue(v) - if !reflect.DeepEqual(zero, x) { - line := fmt.Sprintf("%#v,\n", x) - line = line[strings.IndexByte(line, '{'):] - w.printf("%d: ", i) - w.printf(line) - } - } - case reflect.Array: - for i := 0; i < v.Len(); i++ { - w.printf("%d: %#v,\n", i, v.Index(i).Interface()) - } - default: - panic("gen: slice elem type not supported") - } - w.printf("}") -} - -// WriteType writes a definition of the type of the given value and returns the -// type name. -func (w *CodeWriter) WriteType(x interface{}) string { - t := reflect.TypeOf(x) - w.printf("type %s struct {\n", t.Name()) - for i := 0; i < t.NumField(); i++ { - w.printf("\t%s %s\n", t.Field(i).Name, t.Field(i).Type) - } - w.printf("}\n") - return t.Name() -} - -// typeName returns the name of the go type of x. -func typeName(x interface{}) string { - t := reflect.ValueOf(x).Type() - return strings.Replace(fmt.Sprint(t), "main.", "", 1) -} diff --git a/vendor/golang.org/x/text/internal/gen/gen.go b/vendor/golang.org/x/text/internal/gen/gen.go deleted file mode 100644 index 4c3f76068..000000000 --- a/vendor/golang.org/x/text/internal/gen/gen.go +++ /dev/null @@ -1,333 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package gen contains common code for the various code generation tools in the -// text repository. Its usage ensures consistency between tools. -// -// This package defines command line flags that are common to most generation -// tools. The flags allow for specifying specific Unicode and CLDR versions -// in the public Unicode data repository (http://www.unicode.org/Public). -// -// A local Unicode data mirror can be set through the flag -local or the -// environment variable UNICODE_DIR. The former takes precedence. The local -// directory should follow the same structure as the public repository. -// -// IANA data can also optionally be mirrored by putting it in the iana directory -// rooted at the top of the local mirror. Beware, though, that IANA data is not -// versioned. So it is up to the developer to use the right version. -package gen // import "golang.org/x/text/internal/gen" - -import ( - "bytes" - "flag" - "fmt" - "go/build" - "go/format" - "io" - "io/ioutil" - "log" - "net/http" - "os" - "path" - "path/filepath" - "strings" - "sync" - "unicode" - - "golang.org/x/text/unicode/cldr" -) - -var ( - url = flag.String("url", - "http://www.unicode.org/Public", - "URL of Unicode database directory") - iana = flag.String("iana", - "http://www.iana.org", - "URL of the IANA repository") - unicodeVersion = flag.String("unicode", - getEnv("UNICODE_VERSION", unicode.Version), - "unicode version to use") - cldrVersion = flag.String("cldr", - getEnv("CLDR_VERSION", cldr.Version), - "cldr version to use") -) - -func getEnv(name, def string) string { - if v := os.Getenv(name); v != "" { - return v - } - return def -} - -// Init performs common initialization for a gen command. It parses the flags -// and sets up the standard logging parameters. -func Init() { - log.SetPrefix("") - log.SetFlags(log.Lshortfile) - flag.Parse() -} - -const header = `// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. - -` - -// UnicodeVersion reports the requested Unicode version. -func UnicodeVersion() string { - return *unicodeVersion -} - -// CLDRVersion reports the requested CLDR version. -func CLDRVersion() string { - return *cldrVersion -} - -var tags = []struct{ version, buildTags string }{ - {"10.0.0", "go1.10"}, - {"", "!go1.10"}, -} - -// buildTags reports the build tags used for the current Unicode version. -func buildTags() string { - v := UnicodeVersion() - for _, x := range tags { - // We should do a numeric comparison, but including the collate package - // would create an import cycle. We approximate it by assuming that - // longer version strings are later. - if len(x.version) <= len(v) { - return x.buildTags - } - if len(x.version) == len(v) && x.version <= v { - return x.buildTags - } - } - return tags[0].buildTags -} - -// IsLocal reports whether data files are available locally. -func IsLocal() bool { - dir, err := localReadmeFile() - if err != nil { - return false - } - if _, err = os.Stat(dir); err != nil { - return false - } - return true -} - -// OpenUCDFile opens the requested UCD file. The file is specified relative to -// the public Unicode root directory. It will call log.Fatal if there are any -// errors. -func OpenUCDFile(file string) io.ReadCloser { - return openUnicode(path.Join(*unicodeVersion, "ucd", file)) -} - -// OpenCLDRCoreZip opens the CLDR core zip file. It will call log.Fatal if there -// are any errors. -func OpenCLDRCoreZip() io.ReadCloser { - return OpenUnicodeFile("cldr", *cldrVersion, "core.zip") -} - -// OpenUnicodeFile opens the requested file of the requested category from the -// root of the Unicode data archive. The file is specified relative to the -// public Unicode root directory. If version is "", it will use the default -// Unicode version. It will call log.Fatal if there are any errors. -func OpenUnicodeFile(category, version, file string) io.ReadCloser { - if version == "" { - version = UnicodeVersion() - } - return openUnicode(path.Join(category, version, file)) -} - -// OpenIANAFile opens the requested IANA file. The file is specified relative -// to the IANA root, which is typically either http://www.iana.org or the -// iana directory in the local mirror. It will call log.Fatal if there are any -// errors. -func OpenIANAFile(path string) io.ReadCloser { - return Open(*iana, "iana", path) -} - -var ( - dirMutex sync.Mutex - localDir string -) - -const permissions = 0755 - -func localReadmeFile() (string, error) { - p, err := build.Import("golang.org/x/text", "", build.FindOnly) - if err != nil { - return "", fmt.Errorf("Could not locate package: %v", err) - } - return filepath.Join(p.Dir, "DATA", "README"), nil -} - -func getLocalDir() string { - dirMutex.Lock() - defer dirMutex.Unlock() - - readme, err := localReadmeFile() - if err != nil { - log.Fatal(err) - } - dir := filepath.Dir(readme) - if _, err := os.Stat(readme); err != nil { - if err := os.MkdirAll(dir, permissions); err != nil { - log.Fatalf("Could not create directory: %v", err) - } - ioutil.WriteFile(readme, []byte(readmeTxt), permissions) - } - return dir -} - -const readmeTxt = `Generated by golang.org/x/text/internal/gen. DO NOT EDIT. - -This directory contains downloaded files used to generate the various tables -in the golang.org/x/text subrepo. - -Note that the language subtag repo (iana/assignments/language-subtag-registry) -and all other times in the iana subdirectory are not versioned and will need -to be periodically manually updated. The easiest way to do this is to remove -the entire iana directory. This is mostly of concern when updating the language -package. -` - -// Open opens subdir/path if a local directory is specified and the file exists, -// where subdir is a directory relative to the local root, or fetches it from -// urlRoot/path otherwise. It will call log.Fatal if there are any errors. -func Open(urlRoot, subdir, path string) io.ReadCloser { - file := filepath.Join(getLocalDir(), subdir, filepath.FromSlash(path)) - return open(file, urlRoot, path) -} - -func openUnicode(path string) io.ReadCloser { - file := filepath.Join(getLocalDir(), filepath.FromSlash(path)) - return open(file, *url, path) -} - -// TODO: automatically periodically update non-versioned files. - -func open(file, urlRoot, path string) io.ReadCloser { - if f, err := os.Open(file); err == nil { - return f - } - r := get(urlRoot, path) - defer r.Close() - b, err := ioutil.ReadAll(r) - if err != nil { - log.Fatalf("Could not download file: %v", err) - } - os.MkdirAll(filepath.Dir(file), permissions) - if err := ioutil.WriteFile(file, b, permissions); err != nil { - log.Fatalf("Could not create file: %v", err) - } - return ioutil.NopCloser(bytes.NewReader(b)) -} - -func get(root, path string) io.ReadCloser { - url := root + "/" + path - fmt.Printf("Fetching %s...", url) - defer fmt.Println(" done.") - resp, err := http.Get(url) - if err != nil { - log.Fatalf("HTTP GET: %v", err) - } - if resp.StatusCode != 200 { - log.Fatalf("Bad GET status for %q: %q", url, resp.Status) - } - return resp.Body -} - -// TODO: use Write*Version in all applicable packages. - -// WriteUnicodeVersion writes a constant for the Unicode version from which the -// tables are generated. -func WriteUnicodeVersion(w io.Writer) { - fmt.Fprintf(w, "// UnicodeVersion is the Unicode version from which the tables in this package are derived.\n") - fmt.Fprintf(w, "const UnicodeVersion = %q\n\n", UnicodeVersion()) -} - -// WriteCLDRVersion writes a constant for the CLDR version from which the -// tables are generated. -func WriteCLDRVersion(w io.Writer) { - fmt.Fprintf(w, "// CLDRVersion is the CLDR version from which the tables in this package are derived.\n") - fmt.Fprintf(w, "const CLDRVersion = %q\n\n", CLDRVersion()) -} - -// WriteGoFile prepends a standard file comment and package statement to the -// given bytes, applies gofmt, and writes them to a file with the given name. -// It will call log.Fatal if there are any errors. -func WriteGoFile(filename, pkg string, b []byte) { - w, err := os.Create(filename) - if err != nil { - log.Fatalf("Could not create file %s: %v", filename, err) - } - defer w.Close() - if _, err = WriteGo(w, pkg, "", b); err != nil { - log.Fatalf("Error writing file %s: %v", filename, err) - } -} - -func insertVersion(filename, version string) string { - suffix := ".go" - if strings.HasSuffix(filename, "_test.go") { - suffix = "_test.go" - } - return fmt.Sprint(filename[:len(filename)-len(suffix)], version, suffix) -} - -// WriteVersionedGoFile prepends a standard file comment, adds build tags to -// version the file for the current Unicode version, and package statement to -// the given bytes, applies gofmt, and writes them to a file with the given -// name. It will call log.Fatal if there are any errors. -func WriteVersionedGoFile(filename, pkg string, b []byte) { - tags := buildTags() - if tags != "" { - filename = insertVersion(filename, UnicodeVersion()) - } - w, err := os.Create(filename) - if err != nil { - log.Fatalf("Could not create file %s: %v", filename, err) - } - defer w.Close() - if _, err = WriteGo(w, pkg, tags, b); err != nil { - log.Fatalf("Error writing file %s: %v", filename, err) - } -} - -// WriteGo prepends a standard file comment and package statement to the given -// bytes, applies gofmt, and writes them to w. -func WriteGo(w io.Writer, pkg, tags string, b []byte) (n int, err error) { - src := []byte(header) - if tags != "" { - src = append(src, fmt.Sprintf("// +build %s\n\n", tags)...) - } - src = append(src, fmt.Sprintf("package %s\n\n", pkg)...) - src = append(src, b...) - formatted, err := format.Source(src) - if err != nil { - // Print the generated code even in case of an error so that the - // returned error can be meaningfully interpreted. - n, _ = w.Write(src) - return n, err - } - return w.Write(formatted) -} - -// Repackage rewrites a Go file from belonging to package main to belonging to -// the given package. -func Repackage(inFile, outFile, pkg string) { - src, err := ioutil.ReadFile(inFile) - if err != nil { - log.Fatalf("reading %s: %v", inFile, err) - } - const toDelete = "package main\n\n" - i := bytes.Index(src, []byte(toDelete)) - if i < 0 { - log.Fatalf("Could not find %q in %s.", toDelete, inFile) - } - w := &bytes.Buffer{} - w.Write(src[i+len(toDelete):]) - WriteGoFile(outFile, pkg, w.Bytes()) -} diff --git a/vendor/golang.org/x/text/internal/gen_test.go b/vendor/golang.org/x/text/internal/gen_test.go deleted file mode 100644 index a2e1981ae..000000000 --- a/vendor/golang.org/x/text/internal/gen_test.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package internal - -import ( - "testing" - - "golang.org/x/text/language" -) - -func TestParents(t *testing.T) { - testCases := []struct { - tag, parent string - }{ - {"af", "und"}, - {"en", "und"}, - {"en-001", "en"}, - {"en-AU", "en-001"}, - {"en-US", "en"}, - {"en-US-u-va-posix", "en-US"}, - {"ca-ES-valencia", "ca-ES"}, - } - for _, tc := range testCases { - tag, ok := language.CompactIndex(language.MustParse(tc.tag)) - if !ok { - t.Fatalf("Could not get index of flag %s", tc.tag) - } - want, ok := language.CompactIndex(language.MustParse(tc.parent)) - if !ok { - t.Fatalf("Could not get index of parent %s of tag %s", tc.parent, tc.tag) - } - if got := int(Parent[tag]); got != want { - t.Errorf("Parent[%s] = %d; want %d (%s)", tc.tag, got, want, tc.parent) - } - } -} diff --git a/vendor/golang.org/x/text/internal/internal.go b/vendor/golang.org/x/text/internal/internal.go deleted file mode 100644 index eac832850..000000000 --- a/vendor/golang.org/x/text/internal/internal.go +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:generate go run gen.go - -// Package internal contains non-exported functionality that are used by -// packages in the text repository. -package internal // import "golang.org/x/text/internal" - -import ( - "sort" - - "golang.org/x/text/language" -) - -// SortTags sorts tags in place. -func SortTags(tags []language.Tag) { - sort.Sort(sorter(tags)) -} - -type sorter []language.Tag - -func (s sorter) Len() int { - return len(s) -} - -func (s sorter) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} - -func (s sorter) Less(i, j int) bool { - return s[i].String() < s[j].String() -} - -// UniqueTags sorts and filters duplicate tags in place and returns a slice with -// only unique tags. -func UniqueTags(tags []language.Tag) []language.Tag { - if len(tags) <= 1 { - return tags - } - SortTags(tags) - k := 0 - for i := 1; i < len(tags); i++ { - if tags[k].String() < tags[i].String() { - k++ - tags[k] = tags[i] - } - } - return tags[:k+1] -} diff --git a/vendor/golang.org/x/text/internal/internal_test.go b/vendor/golang.org/x/text/internal/internal_test.go deleted file mode 100644 index ce1b9a382..000000000 --- a/vendor/golang.org/x/text/internal/internal_test.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package internal - -import ( - "fmt" - "strings" - "testing" - - "golang.org/x/text/language" -) - -func TestUnique(t *testing.T) { - testCases := []struct { - in, want string - }{ - {"", "[]"}, - {"en", "[en]"}, - {"en en", "[en]"}, - {"en en en", "[en]"}, - {"en-u-cu-eur en", "[en en-u-cu-eur]"}, - {"nl en", "[en nl]"}, - {"pt-Pt pt", "[pt pt-PT]"}, - } - for _, tc := range testCases { - tags := []language.Tag{} - for _, s := range strings.Split(tc.in, " ") { - if s != "" { - tags = append(tags, language.MustParse(s)) - } - } - if got := fmt.Sprint(UniqueTags(tags)); got != tc.want { - t.Errorf("Unique(%s) = %s; want %s", tc.in, got, tc.want) - } - } -} diff --git a/vendor/golang.org/x/text/internal/match.go b/vendor/golang.org/x/text/internal/match.go deleted file mode 100644 index a67fcaca1..000000000 --- a/vendor/golang.org/x/text/internal/match.go +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package internal - -// This file contains matchers that implement CLDR inheritance. -// -// See http://unicode.org/reports/tr35/#Locale_Inheritance. -// -// Some of the inheritance described in this document is already handled by -// the cldr package. - -import ( - "golang.org/x/text/language" -) - -// TODO: consider if (some of the) matching algorithm needs to be public after -// getting some feel about what is generic and what is specific. - -// NewInheritanceMatcher returns a matcher that matches based on the inheritance -// chain. -// -// The matcher uses canonicalization and the parent relationship to find a -// match. The resulting match will always be either Und or a language with the -// same language and script as the requested language. It will not match -// languages for which there is understood to be mutual or one-directional -// intelligibility. -// -// A Match will indicate an Exact match if the language matches after -// canonicalization and High if the matched tag is a parent. -func NewInheritanceMatcher(t []language.Tag) *InheritanceMatcher { - tags := &InheritanceMatcher{make(map[language.Tag]int)} - for i, tag := range t { - ct, err := language.All.Canonicalize(tag) - if err != nil { - ct = tag - } - tags.index[ct] = i - } - return tags -} - -type InheritanceMatcher struct { - index map[language.Tag]int -} - -func (m InheritanceMatcher) Match(want ...language.Tag) (language.Tag, int, language.Confidence) { - for _, t := range want { - ct, err := language.All.Canonicalize(t) - if err != nil { - ct = t - } - conf := language.Exact - for { - if index, ok := m.index[ct]; ok { - return ct, index, conf - } - if ct == language.Und { - break - } - ct = ct.Parent() - conf = language.High - } - } - return language.Und, 0, language.No -} diff --git a/vendor/golang.org/x/text/internal/match_test.go b/vendor/golang.org/x/text/internal/match_test.go deleted file mode 100644 index 8a3fe6572..000000000 --- a/vendor/golang.org/x/text/internal/match_test.go +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package internal - -import ( - "strings" - "testing" - - "golang.org/x/text/language" -) - -func TestInheritanceMatcher(t *testing.T) { - for i, tt := range []struct { - haveTags string - wantTags string - match string - conf language.Confidence - }{ - {"und,en,en-US", "en-US", "en-US", language.Exact}, // most specific match - {"zh-Hant,zh", "zh-TW", "zh-Hant", language.High}, // zh-TW implies Hant. - {"und,zh", "zh-TW", "und", language.High}, // zh-TW does not match zh. - {"zh", "zh-TW", "und", language.No}, // zh-TW does not match zh. - {"iw,en,nl", "he", "he", language.Exact}, // matches after canonicalization - {"he,en,nl", "iw", "he", language.Exact}, // matches after canonicalization - // Prefer first match over more specific match for various reasons: - // a) consistency of user interface is more important than an exact match, - // b) _if_ und is specified, it should be considered a correct and useful match, - // Note that a call to this Match will almost always be with a single tag. - {"und,en,en-US", "he,en-US", "und", language.High}, - } { - have := parseTags(tt.haveTags) - m := NewInheritanceMatcher(have) - tag, index, conf := m.Match(parseTags(tt.wantTags)...) - want := language.Raw.Make(tt.match) - if tag != want { - t.Errorf("%d:tag: got %q; want %q", i, tag, want) - } - if conf != language.No { - if got, _ := language.All.Canonicalize(have[index]); got != want { - t.Errorf("%d:index: got %q; want %q ", i, got, want) - } - } - if conf != tt.conf { - t.Errorf("%d:conf: got %v; want %v", i, conf, tt.conf) - } - } -} - -func parseTags(list string) (out []language.Tag) { - for _, s := range strings.Split(list, ",") { - out = append(out, language.Raw.Make(strings.TrimSpace(s))) - } - return out -} diff --git a/vendor/golang.org/x/text/internal/tables.go b/vendor/golang.org/x/text/internal/tables.go deleted file mode 100644 index 85991d3d2..000000000 --- a/vendor/golang.org/x/text/internal/tables.go +++ /dev/null @@ -1,118 +0,0 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. - -package internal - -// Parent maps a compact index of a tag to the compact index of the parent of -// this tag. -var Parent = []uint16{ // 768 elements - // Entry 0 - 3F - 0x0000, 0x0053, 0x00e8, 0x0000, 0x0003, 0x0003, 0x0000, 0x0006, - 0x0000, 0x0008, 0x0000, 0x000a, 0x0000, 0x000c, 0x000c, 0x000c, - 0x000c, 0x000c, 0x000c, 0x000c, 0x000c, 0x000c, 0x000c, 0x000c, - 0x000c, 0x000c, 0x000c, 0x000c, 0x000c, 0x000c, 0x000c, 0x000c, - 0x000c, 0x000c, 0x000c, 0x000c, 0x000c, 0x000c, 0x000c, 0x000c, - 0x000c, 0x0000, 0x0000, 0x002a, 0x0000, 0x002c, 0x0000, 0x002e, - 0x0000, 0x0000, 0x0031, 0x0030, 0x0030, 0x0000, 0x0035, 0x0000, - 0x0037, 0x0000, 0x0039, 0x0000, 0x003b, 0x0000, 0x003d, 0x0000, - // Entry 40 - 7F - 0x0000, 0x0040, 0x0000, 0x0042, 0x0042, 0x0000, 0x0045, 0x0045, - 0x0000, 0x0048, 0x0000, 0x004a, 0x0000, 0x0000, 0x004d, 0x004c, - 0x004c, 0x0000, 0x0051, 0x0051, 0x0051, 0x0051, 0x0000, 0x0056, - 0x0056, 0x0000, 0x0059, 0x0000, 0x005b, 0x0000, 0x005d, 0x0000, - 0x005f, 0x005f, 0x0000, 0x0062, 0x0000, 0x0064, 0x0000, 0x0066, - 0x0000, 0x0068, 0x0068, 0x0000, 0x006b, 0x0000, 0x006d, 0x006d, - 0x006d, 0x006d, 0x006d, 0x006d, 0x006d, 0x0000, 0x0075, 0x0000, - 0x0077, 0x0000, 0x0079, 0x0000, 0x0000, 0x007c, 0x0000, 0x007e, - // Entry 80 - BF - 0x0000, 0x0080, 0x0000, 0x0082, 0x0082, 0x0000, 0x0085, 0x0085, - 0x0000, 0x0088, 0x0089, 0x0089, 0x0089, 0x0088, 0x008a, 0x0089, - 0x0089, 0x0089, 0x0088, 0x0089, 0x0089, 0x0089, 0x0089, 0x0089, - 0x0089, 0x008a, 0x0089, 0x0089, 0x0089, 0x0089, 0x008a, 0x0089, - 0x008a, 0x0089, 0x0089, 0x008a, 0x0089, 0x0089, 0x0089, 0x0089, - 0x0089, 0x0089, 0x0089, 0x0089, 0x0089, 0x0088, 0x0089, 0x0089, - 0x0089, 0x0089, 0x0089, 0x0089, 0x0089, 0x0089, 0x0089, 0x0089, - 0x0089, 0x0089, 0x0089, 0x0089, 0x0089, 0x0089, 0x0089, 0x0088, - // Entry C0 - FF - 0x0089, 0x0088, 0x0089, 0x0089, 0x0089, 0x0089, 0x0089, 0x0089, - 0x0089, 0x0089, 0x008a, 0x0089, 0x0089, 0x0089, 0x0089, 0x0089, - 0x0089, 0x0089, 0x0088, 0x0089, 0x0089, 0x0089, 0x0089, 0x0089, - 0x008a, 0x0089, 0x0089, 0x008a, 0x0089, 0x0089, 0x0089, 0x0089, - 0x0089, 0x0089, 0x0089, 0x0089, 0x0089, 0x0089, 0x0089, 0x0088, - 0x0088, 0x0089, 0x0089, 0x0088, 0x0089, 0x0089, 0x0089, 0x0089, - 0x0089, 0x0000, 0x00f1, 0x0000, 0x00f3, 0x00f4, 0x00f4, 0x00f4, - 0x00f4, 0x00f4, 0x00f4, 0x00f4, 0x00f4, 0x00f4, 0x00f3, 0x00f4, - // Entry 100 - 13F - 0x00f3, 0x00f3, 0x00f4, 0x00f4, 0x00f3, 0x00f4, 0x00f4, 0x00f4, - 0x00f4, 0x00f3, 0x00f4, 0x00f4, 0x00f4, 0x00f4, 0x00f4, 0x00f4, - 0x0000, 0x0110, 0x0000, 0x0112, 0x0000, 0x0114, 0x0000, 0x0116, - 0x0116, 0x0000, 0x0119, 0x0119, 0x0119, 0x0119, 0x0000, 0x011e, - 0x0000, 0x0120, 0x0000, 0x0122, 0x0122, 0x0000, 0x0125, 0x0125, - 0x0125, 0x0125, 0x0125, 0x0125, 0x0125, 0x0125, 0x0125, 0x0125, - 0x0125, 0x0125, 0x0125, 0x0125, 0x0125, 0x0125, 0x0125, 0x0125, - 0x0125, 0x0125, 0x0125, 0x0125, 0x0125, 0x0125, 0x0125, 0x0125, - // Entry 140 - 17F - 0x0125, 0x0125, 0x0125, 0x0125, 0x0125, 0x0125, 0x0125, 0x0125, - 0x0125, 0x0125, 0x0125, 0x0125, 0x0125, 0x0125, 0x0125, 0x0125, - 0x0125, 0x0125, 0x0125, 0x0125, 0x0000, 0x0154, 0x0000, 0x0156, - 0x0000, 0x0158, 0x0000, 0x015a, 0x0000, 0x015c, 0x0000, 0x015e, - 0x015e, 0x015e, 0x0000, 0x0162, 0x0000, 0x0000, 0x0165, 0x0000, - 0x0167, 0x0000, 0x0169, 0x0169, 0x0169, 0x0000, 0x016d, 0x0000, - 0x016f, 0x0000, 0x0171, 0x0000, 0x0173, 0x0173, 0x0000, 0x0176, - 0x0000, 0x0178, 0x0000, 0x017a, 0x0000, 0x017c, 0x0000, 0x017e, - // Entry 180 - 1BF - 0x0000, 0x0180, 0x0000, 0x0000, 0x0183, 0x0000, 0x0185, 0x0185, - 0x0185, 0x0185, 0x0000, 0x0000, 0x018b, 0x0000, 0x0000, 0x018e, - 0x0000, 0x0190, 0x0000, 0x0000, 0x0193, 0x0000, 0x0195, 0x0000, - 0x0000, 0x0198, 0x0000, 0x0000, 0x019b, 0x0000, 0x019d, 0x0000, - 0x019f, 0x0000, 0x01a1, 0x0000, 0x01a3, 0x0000, 0x01a5, 0x0000, - 0x01a7, 0x0000, 0x01a9, 0x0000, 0x01ab, 0x0000, 0x01ad, 0x0000, - 0x01af, 0x01af, 0x0000, 0x01b2, 0x0000, 0x01b4, 0x0000, 0x01b6, - 0x0000, 0x01b8, 0x0000, 0x01ba, 0x0000, 0x0000, 0x01bd, 0x0000, - // Entry 1C0 - 1FF - 0x01bf, 0x0000, 0x01c1, 0x0000, 0x01c3, 0x0000, 0x01c5, 0x0000, - 0x01c7, 0x0000, 0x01c9, 0x01c9, 0x01c9, 0x01c9, 0x0000, 0x01ce, - 0x0000, 0x01d0, 0x01d0, 0x0000, 0x01d3, 0x0000, 0x01d5, 0x0000, - 0x01d7, 0x0000, 0x01d9, 0x0000, 0x01db, 0x0000, 0x01dd, 0x01dd, - 0x0000, 0x01e0, 0x0000, 0x01e2, 0x0000, 0x01e4, 0x0000, 0x01e6, - 0x0000, 0x01e8, 0x0000, 0x01ea, 0x0000, 0x01ec, 0x0000, 0x01ee, - 0x0000, 0x01f0, 0x0000, 0x01f2, 0x01f2, 0x01f2, 0x0000, 0x01f6, - 0x0000, 0x01f8, 0x0000, 0x01fa, 0x0000, 0x01fc, 0x0000, 0x0000, - // Entry 200 - 23F - 0x01ff, 0x0000, 0x0201, 0x0201, 0x0000, 0x0204, 0x0000, 0x0206, - 0x0206, 0x0000, 0x0209, 0x0209, 0x0000, 0x020c, 0x020c, 0x020c, - 0x020c, 0x020c, 0x020c, 0x020c, 0x0000, 0x0214, 0x0000, 0x0216, - 0x0000, 0x0218, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x021e, - 0x0000, 0x0000, 0x0221, 0x0000, 0x0223, 0x0223, 0x0000, 0x0226, - 0x0000, 0x0228, 0x0228, 0x0000, 0x0000, 0x022c, 0x022b, 0x022b, - 0x0000, 0x0000, 0x0231, 0x0000, 0x0233, 0x0000, 0x0235, 0x0000, - 0x0241, 0x0237, 0x0241, 0x0241, 0x0241, 0x0241, 0x0241, 0x0241, - // Entry 240 - 27F - 0x0241, 0x0237, 0x0241, 0x0241, 0x0000, 0x0244, 0x0244, 0x0244, - 0x0000, 0x0248, 0x0000, 0x024a, 0x0000, 0x024c, 0x024c, 0x0000, - 0x024f, 0x0000, 0x0251, 0x0251, 0x0251, 0x0251, 0x0251, 0x0251, - 0x0000, 0x0258, 0x0000, 0x025a, 0x0000, 0x025c, 0x0000, 0x025e, - 0x0000, 0x0260, 0x0000, 0x0262, 0x0000, 0x0000, 0x0265, 0x0265, - 0x0265, 0x0000, 0x0269, 0x0000, 0x026b, 0x0000, 0x026d, 0x0000, - 0x0000, 0x0270, 0x026f, 0x026f, 0x0000, 0x0274, 0x0000, 0x0276, - 0x0000, 0x0278, 0x0000, 0x0000, 0x0000, 0x0000, 0x027d, 0x0000, - // Entry 280 - 2BF - 0x0000, 0x0280, 0x0000, 0x0282, 0x0282, 0x0282, 0x0282, 0x0000, - 0x0287, 0x0287, 0x0287, 0x0000, 0x028b, 0x028b, 0x028b, 0x028b, - 0x028b, 0x0000, 0x0291, 0x0291, 0x0291, 0x0291, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0299, 0x0299, 0x0299, 0x0000, 0x029d, 0x029d, - 0x029d, 0x029d, 0x0000, 0x0000, 0x02a3, 0x02a3, 0x02a3, 0x02a3, - 0x0000, 0x02a8, 0x0000, 0x02aa, 0x02aa, 0x0000, 0x02ad, 0x0000, - 0x02af, 0x0000, 0x02b1, 0x02b1, 0x0000, 0x0000, 0x02b5, 0x0000, - 0x0000, 0x02b8, 0x0000, 0x02ba, 0x02ba, 0x0000, 0x0000, 0x02be, - // Entry 2C0 - 2FF - 0x0000, 0x02c0, 0x0000, 0x02c2, 0x0000, 0x02c4, 0x0000, 0x02c6, - 0x0000, 0x02c8, 0x02c8, 0x0000, 0x0000, 0x02cc, 0x0000, 0x02ce, - 0x02cb, 0x02cb, 0x0000, 0x0000, 0x02d3, 0x02d2, 0x02d2, 0x0000, - 0x0000, 0x02d8, 0x0000, 0x02da, 0x0000, 0x02dc, 0x0000, 0x0000, - 0x02df, 0x0000, 0x02e1, 0x0000, 0x0000, 0x02e4, 0x0000, 0x02e6, - 0x0000, 0x02e8, 0x0000, 0x02ea, 0x02ea, 0x0000, 0x0000, 0x02ee, - 0x02ed, 0x02ed, 0x0000, 0x02f2, 0x0000, 0x02f4, 0x02f4, 0x02f4, - 0x02f4, 0x02f4, 0x0000, 0x02fa, 0x02fb, 0x02fa, 0x0000, 0x02fe, -} // Size: 1560 bytes - -// Total table size 1560 bytes (1KiB); checksum: 4897681C diff --git a/vendor/golang.org/x/text/internal/triegen/compact.go b/vendor/golang.org/x/text/internal/triegen/compact.go deleted file mode 100644 index 397b975c1..000000000 --- a/vendor/golang.org/x/text/internal/triegen/compact.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package triegen - -// This file defines Compacter and its implementations. - -import "io" - -// A Compacter generates an alternative, more space-efficient way to store a -// trie value block. A trie value block holds all possible values for the last -// byte of a UTF-8 encoded rune. Excluding ASCII characters, a trie value block -// always has 64 values, as a UTF-8 encoding ends with a byte in [0x80, 0xC0). -type Compacter interface { - // Size returns whether the Compacter could encode the given block as well - // as its size in case it can. len(v) is always 64. - Size(v []uint64) (sz int, ok bool) - - // Store stores the block using the Compacter's compression method. - // It returns a handle with which the block can be retrieved. - // len(v) is always 64. - Store(v []uint64) uint32 - - // Print writes the data structures associated to the given store to w. - Print(w io.Writer) error - - // Handler returns the name of a function that gets called during trie - // lookup for blocks generated by the Compacter. The function should be of - // the form func (n uint32, b byte) uint64, where n is the index returned by - // the Compacter's Store method and b is the last byte of the UTF-8 - // encoding, where 0x80 <= b < 0xC0, for which to do the lookup in the - // block. - Handler() string -} - -// simpleCompacter is the default Compacter used by builder. It implements a -// normal trie block. -type simpleCompacter builder - -func (b *simpleCompacter) Size([]uint64) (sz int, ok bool) { - return blockSize * b.ValueSize, true -} - -func (b *simpleCompacter) Store(v []uint64) uint32 { - h := uint32(len(b.ValueBlocks) - blockOffset) - b.ValueBlocks = append(b.ValueBlocks, v) - return h -} - -func (b *simpleCompacter) Print(io.Writer) error { - // Structures are printed in print.go. - return nil -} - -func (b *simpleCompacter) Handler() string { - panic("Handler should be special-cased for this Compacter") -} diff --git a/vendor/golang.org/x/text/internal/triegen/data_test.go b/vendor/golang.org/x/text/internal/triegen/data_test.go deleted file mode 100644 index 91de547a5..000000000 --- a/vendor/golang.org/x/text/internal/triegen/data_test.go +++ /dev/null @@ -1,875 +0,0 @@ -// This file is generated with "go test -tags generate". DO NOT EDIT! -// +build !generate - -package triegen_test - -// lookup returns the trie value for the first UTF-8 encoding in s and -// the width in bytes of this encoding. The size will be 0 if s does not -// hold enough bytes to complete the encoding. len(s) must be greater than 0. -func (t *randTrie) lookup(s []byte) (v uint8, sz int) { - c0 := s[0] - switch { - case c0 < 0x80: // is ASCII - return randValues[c0], 1 - case c0 < 0xC2: - return 0, 1 // Illegal UTF-8: not a starter, not ASCII. - case c0 < 0xE0: // 2-byte UTF-8 - if len(s) < 2 { - return 0, 0 - } - i := randIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c1), 2 - case c0 < 0xF0: // 3-byte UTF-8 - if len(s) < 3 { - return 0, 0 - } - i := randIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = randIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c2), 3 - case c0 < 0xF8: // 4-byte UTF-8 - if len(s) < 4 { - return 0, 0 - } - i := randIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = randIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - o = uint32(i)<<6 + uint32(c2) - i = randIndex[o] - c3 := s[3] - if c3 < 0x80 || 0xC0 <= c3 { - return 0, 3 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c3), 4 - } - // Illegal rune - return 0, 1 -} - -// lookupUnsafe returns the trie value for the first UTF-8 encoding in s. -// s must start with a full and valid UTF-8 encoded rune. -func (t *randTrie) lookupUnsafe(s []byte) uint8 { - c0 := s[0] - if c0 < 0x80 { // is ASCII - return randValues[c0] - } - i := randIndex[c0] - if c0 < 0xE0 { // 2-byte UTF-8 - return t.lookupValue(uint32(i), s[1]) - } - i = randIndex[uint32(i)<<6+uint32(s[1])] - if c0 < 0xF0 { // 3-byte UTF-8 - return t.lookupValue(uint32(i), s[2]) - } - i = randIndex[uint32(i)<<6+uint32(s[2])] - if c0 < 0xF8 { // 4-byte UTF-8 - return t.lookupValue(uint32(i), s[3]) - } - return 0 -} - -// lookupString returns the trie value for the first UTF-8 encoding in s and -// the width in bytes of this encoding. The size will be 0 if s does not -// hold enough bytes to complete the encoding. len(s) must be greater than 0. -func (t *randTrie) lookupString(s string) (v uint8, sz int) { - c0 := s[0] - switch { - case c0 < 0x80: // is ASCII - return randValues[c0], 1 - case c0 < 0xC2: - return 0, 1 // Illegal UTF-8: not a starter, not ASCII. - case c0 < 0xE0: // 2-byte UTF-8 - if len(s) < 2 { - return 0, 0 - } - i := randIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c1), 2 - case c0 < 0xF0: // 3-byte UTF-8 - if len(s) < 3 { - return 0, 0 - } - i := randIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = randIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c2), 3 - case c0 < 0xF8: // 4-byte UTF-8 - if len(s) < 4 { - return 0, 0 - } - i := randIndex[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = randIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - o = uint32(i)<<6 + uint32(c2) - i = randIndex[o] - c3 := s[3] - if c3 < 0x80 || 0xC0 <= c3 { - return 0, 3 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c3), 4 - } - // Illegal rune - return 0, 1 -} - -// lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. -// s must start with a full and valid UTF-8 encoded rune. -func (t *randTrie) lookupStringUnsafe(s string) uint8 { - c0 := s[0] - if c0 < 0x80 { // is ASCII - return randValues[c0] - } - i := randIndex[c0] - if c0 < 0xE0 { // 2-byte UTF-8 - return t.lookupValue(uint32(i), s[1]) - } - i = randIndex[uint32(i)<<6+uint32(s[1])] - if c0 < 0xF0 { // 3-byte UTF-8 - return t.lookupValue(uint32(i), s[2]) - } - i = randIndex[uint32(i)<<6+uint32(s[2])] - if c0 < 0xF8 { // 4-byte UTF-8 - return t.lookupValue(uint32(i), s[3]) - } - return 0 -} - -// randTrie. Total size: 9280 bytes (9.06 KiB). Checksum: 6debd324a8debb8f. -type randTrie struct{} - -func newRandTrie(i int) *randTrie { - return &randTrie{} -} - -// lookupValue determines the type of block n and looks up the value for b. -func (t *randTrie) lookupValue(n uint32, b byte) uint8 { - switch { - default: - return uint8(randValues[n<<6+uint32(b)]) - } -} - -// randValues: 56 blocks, 3584 entries, 3584 bytes -// The third block is the zero block. -var randValues = [3584]uint8{ - // Block 0x0, offset 0x0 - // Block 0x1, offset 0x40 - // Block 0x2, offset 0x80 - // Block 0x3, offset 0xc0 - 0xc9: 0x0001, - // Block 0x4, offset 0x100 - 0x100: 0x0001, - // Block 0x5, offset 0x140 - 0x155: 0x0001, - // Block 0x6, offset 0x180 - 0x196: 0x0001, - // Block 0x7, offset 0x1c0 - 0x1ef: 0x0001, - // Block 0x8, offset 0x200 - 0x206: 0x0001, - // Block 0x9, offset 0x240 - 0x258: 0x0001, - // Block 0xa, offset 0x280 - 0x288: 0x0001, - // Block 0xb, offset 0x2c0 - 0x2f2: 0x0001, - // Block 0xc, offset 0x300 - 0x304: 0x0001, - // Block 0xd, offset 0x340 - 0x34b: 0x0001, - // Block 0xe, offset 0x380 - 0x3ba: 0x0001, - // Block 0xf, offset 0x3c0 - 0x3f5: 0x0001, - // Block 0x10, offset 0x400 - 0x41d: 0x0001, - // Block 0x11, offset 0x440 - 0x442: 0x0001, - // Block 0x12, offset 0x480 - 0x4bb: 0x0001, - // Block 0x13, offset 0x4c0 - 0x4e9: 0x0001, - // Block 0x14, offset 0x500 - 0x53e: 0x0001, - // Block 0x15, offset 0x540 - 0x55f: 0x0001, - // Block 0x16, offset 0x580 - 0x5b7: 0x0001, - // Block 0x17, offset 0x5c0 - 0x5d9: 0x0001, - // Block 0x18, offset 0x600 - 0x60e: 0x0001, - // Block 0x19, offset 0x640 - 0x652: 0x0001, - // Block 0x1a, offset 0x680 - 0x68f: 0x0001, - // Block 0x1b, offset 0x6c0 - 0x6dc: 0x0001, - // Block 0x1c, offset 0x700 - 0x703: 0x0001, - // Block 0x1d, offset 0x740 - 0x741: 0x0001, - // Block 0x1e, offset 0x780 - 0x79b: 0x0001, - // Block 0x1f, offset 0x7c0 - 0x7f1: 0x0001, - // Block 0x20, offset 0x800 - 0x833: 0x0001, - // Block 0x21, offset 0x840 - 0x853: 0x0001, - // Block 0x22, offset 0x880 - 0x8a2: 0x0001, - // Block 0x23, offset 0x8c0 - 0x8f8: 0x0001, - // Block 0x24, offset 0x900 - 0x917: 0x0001, - // Block 0x25, offset 0x940 - 0x945: 0x0001, - // Block 0x26, offset 0x980 - 0x99e: 0x0001, - // Block 0x27, offset 0x9c0 - 0x9fd: 0x0001, - // Block 0x28, offset 0xa00 - 0xa0d: 0x0001, - // Block 0x29, offset 0xa40 - 0xa66: 0x0001, - // Block 0x2a, offset 0xa80 - 0xaab: 0x0001, - // Block 0x2b, offset 0xac0 - 0xaea: 0x0001, - // Block 0x2c, offset 0xb00 - 0xb2d: 0x0001, - // Block 0x2d, offset 0xb40 - 0xb54: 0x0001, - // Block 0x2e, offset 0xb80 - 0xb90: 0x0001, - // Block 0x2f, offset 0xbc0 - 0xbe5: 0x0001, - // Block 0x30, offset 0xc00 - 0xc28: 0x0001, - // Block 0x31, offset 0xc40 - 0xc7c: 0x0001, - // Block 0x32, offset 0xc80 - 0xcbf: 0x0001, - // Block 0x33, offset 0xcc0 - 0xcc7: 0x0001, - // Block 0x34, offset 0xd00 - 0xd34: 0x0001, - // Block 0x35, offset 0xd40 - 0xd61: 0x0001, - // Block 0x36, offset 0xd80 - 0xdb9: 0x0001, - // Block 0x37, offset 0xdc0 - 0xdda: 0x0001, -} - -// randIndex: 89 blocks, 5696 entries, 5696 bytes -// Block 0 is the zero block. -var randIndex = [5696]uint8{ - // Block 0x0, offset 0x0 - // Block 0x1, offset 0x40 - // Block 0x2, offset 0x80 - // Block 0x3, offset 0xc0 - 0xe1: 0x02, 0xe3: 0x03, 0xe4: 0x04, - 0xea: 0x05, 0xeb: 0x06, 0xec: 0x07, - 0xf0: 0x10, 0xf1: 0x24, 0xf2: 0x3d, 0xf3: 0x4f, 0xf4: 0x56, - // Block 0x4, offset 0x100 - 0x107: 0x01, - // Block 0x5, offset 0x140 - 0x16c: 0x02, - // Block 0x6, offset 0x180 - 0x19c: 0x03, - 0x1ae: 0x04, - // Block 0x7, offset 0x1c0 - 0x1d8: 0x05, - 0x1f7: 0x06, - // Block 0x8, offset 0x200 - 0x20c: 0x07, - // Block 0x9, offset 0x240 - 0x24a: 0x08, - // Block 0xa, offset 0x280 - 0x2b6: 0x09, - // Block 0xb, offset 0x2c0 - 0x2d5: 0x0a, - // Block 0xc, offset 0x300 - 0x31a: 0x0b, - // Block 0xd, offset 0x340 - 0x373: 0x0c, - // Block 0xe, offset 0x380 - 0x38b: 0x0d, - // Block 0xf, offset 0x3c0 - 0x3f0: 0x0e, - // Block 0x10, offset 0x400 - 0x433: 0x0f, - // Block 0x11, offset 0x440 - 0x45d: 0x10, - // Block 0x12, offset 0x480 - 0x491: 0x08, 0x494: 0x09, 0x497: 0x0a, - 0x49b: 0x0b, 0x49c: 0x0c, - 0x4a1: 0x0d, - 0x4ad: 0x0e, - 0x4ba: 0x0f, - // Block 0x13, offset 0x4c0 - 0x4c1: 0x11, - // Block 0x14, offset 0x500 - 0x531: 0x12, - // Block 0x15, offset 0x540 - 0x546: 0x13, - // Block 0x16, offset 0x580 - 0x5ab: 0x14, - // Block 0x17, offset 0x5c0 - 0x5d4: 0x11, - 0x5fe: 0x11, - // Block 0x18, offset 0x600 - 0x618: 0x0a, - // Block 0x19, offset 0x640 - 0x65b: 0x15, - // Block 0x1a, offset 0x680 - 0x6a0: 0x16, - // Block 0x1b, offset 0x6c0 - 0x6d2: 0x17, - 0x6f6: 0x18, - // Block 0x1c, offset 0x700 - 0x711: 0x19, - // Block 0x1d, offset 0x740 - 0x768: 0x1a, - // Block 0x1e, offset 0x780 - 0x783: 0x1b, - // Block 0x1f, offset 0x7c0 - 0x7f9: 0x1c, - // Block 0x20, offset 0x800 - 0x831: 0x1d, - // Block 0x21, offset 0x840 - 0x85e: 0x1e, - // Block 0x22, offset 0x880 - 0x898: 0x1f, - // Block 0x23, offset 0x8c0 - 0x8c7: 0x18, - 0x8d5: 0x14, - 0x8f7: 0x20, - 0x8fe: 0x1f, - // Block 0x24, offset 0x900 - 0x905: 0x21, - // Block 0x25, offset 0x940 - 0x966: 0x03, - // Block 0x26, offset 0x980 - 0x981: 0x07, 0x983: 0x11, - 0x989: 0x12, 0x98a: 0x13, 0x98e: 0x14, 0x98f: 0x15, - 0x992: 0x16, 0x995: 0x17, 0x996: 0x18, - 0x998: 0x19, 0x999: 0x1a, 0x99b: 0x1b, 0x99f: 0x1c, - 0x9a3: 0x1d, - 0x9ad: 0x1e, 0x9af: 0x1f, - 0x9b0: 0x20, 0x9b1: 0x21, - 0x9b8: 0x22, 0x9bd: 0x23, - // Block 0x27, offset 0x9c0 - 0x9cd: 0x22, - // Block 0x28, offset 0xa00 - 0xa0c: 0x08, - // Block 0x29, offset 0xa40 - 0xa6f: 0x1c, - // Block 0x2a, offset 0xa80 - 0xa90: 0x1a, - 0xaaf: 0x23, - // Block 0x2b, offset 0xac0 - 0xae3: 0x19, - 0xae8: 0x24, - 0xafc: 0x25, - // Block 0x2c, offset 0xb00 - 0xb13: 0x26, - // Block 0x2d, offset 0xb40 - 0xb67: 0x1c, - // Block 0x2e, offset 0xb80 - 0xb8f: 0x0b, - // Block 0x2f, offset 0xbc0 - 0xbcb: 0x27, - 0xbe7: 0x26, - // Block 0x30, offset 0xc00 - 0xc34: 0x16, - // Block 0x31, offset 0xc40 - 0xc62: 0x03, - // Block 0x32, offset 0xc80 - 0xcbb: 0x12, - // Block 0x33, offset 0xcc0 - 0xcdf: 0x09, - // Block 0x34, offset 0xd00 - 0xd34: 0x0a, - // Block 0x35, offset 0xd40 - 0xd41: 0x1e, - // Block 0x36, offset 0xd80 - 0xd83: 0x28, - // Block 0x37, offset 0xdc0 - 0xdc0: 0x15, - // Block 0x38, offset 0xe00 - 0xe1a: 0x15, - // Block 0x39, offset 0xe40 - 0xe65: 0x29, - // Block 0x3a, offset 0xe80 - 0xe86: 0x1f, - // Block 0x3b, offset 0xec0 - 0xeec: 0x18, - // Block 0x3c, offset 0xf00 - 0xf28: 0x2a, - // Block 0x3d, offset 0xf40 - 0xf53: 0x08, - // Block 0x3e, offset 0xf80 - 0xfa2: 0x2b, - 0xfaa: 0x17, - // Block 0x3f, offset 0xfc0 - 0xfc0: 0x25, 0xfc2: 0x26, - 0xfc9: 0x27, 0xfcd: 0x28, 0xfce: 0x29, - 0xfd5: 0x2a, - 0xfd8: 0x2b, 0xfd9: 0x2c, 0xfdf: 0x2d, - 0xfe1: 0x2e, 0xfe2: 0x2f, 0xfe3: 0x30, 0xfe6: 0x31, - 0xfe9: 0x32, 0xfec: 0x33, 0xfed: 0x34, 0xfef: 0x35, - 0xff1: 0x36, 0xff2: 0x37, 0xff3: 0x38, 0xff4: 0x39, - 0xffa: 0x3a, 0xffc: 0x3b, 0xffe: 0x3c, - // Block 0x40, offset 0x1000 - 0x102c: 0x2c, - // Block 0x41, offset 0x1040 - 0x1074: 0x2c, - // Block 0x42, offset 0x1080 - 0x108c: 0x08, - 0x10a0: 0x2d, - // Block 0x43, offset 0x10c0 - 0x10e8: 0x10, - // Block 0x44, offset 0x1100 - 0x110f: 0x13, - // Block 0x45, offset 0x1140 - 0x114b: 0x2e, - // Block 0x46, offset 0x1180 - 0x118b: 0x23, - 0x119d: 0x0c, - // Block 0x47, offset 0x11c0 - 0x11c3: 0x12, - 0x11f9: 0x0f, - // Block 0x48, offset 0x1200 - 0x121e: 0x1b, - // Block 0x49, offset 0x1240 - 0x1270: 0x2f, - // Block 0x4a, offset 0x1280 - 0x128a: 0x1b, - 0x12a7: 0x02, - // Block 0x4b, offset 0x12c0 - 0x12fb: 0x14, - // Block 0x4c, offset 0x1300 - 0x1333: 0x30, - // Block 0x4d, offset 0x1340 - 0x134d: 0x31, - // Block 0x4e, offset 0x1380 - 0x138e: 0x15, - // Block 0x4f, offset 0x13c0 - 0x13f4: 0x32, - // Block 0x50, offset 0x1400 - 0x141b: 0x33, - // Block 0x51, offset 0x1440 - 0x1448: 0x3e, 0x1449: 0x3f, 0x144a: 0x40, 0x144f: 0x41, - 0x1459: 0x42, 0x145c: 0x43, 0x145e: 0x44, 0x145f: 0x45, - 0x1468: 0x46, 0x1469: 0x47, 0x146c: 0x48, 0x146d: 0x49, 0x146e: 0x4a, - 0x1472: 0x4b, 0x1473: 0x4c, - 0x1479: 0x4d, 0x147b: 0x4e, - // Block 0x52, offset 0x1480 - 0x1480: 0x34, - 0x1499: 0x11, - 0x14b6: 0x2c, - // Block 0x53, offset 0x14c0 - 0x14e4: 0x0d, - // Block 0x54, offset 0x1500 - 0x1527: 0x08, - // Block 0x55, offset 0x1540 - 0x1555: 0x2b, - // Block 0x56, offset 0x1580 - 0x15b2: 0x35, - // Block 0x57, offset 0x15c0 - 0x15f2: 0x1c, 0x15f4: 0x29, - // Block 0x58, offset 0x1600 - 0x1600: 0x50, 0x1603: 0x51, - 0x1608: 0x52, 0x160a: 0x53, 0x160d: 0x54, 0x160e: 0x55, -} - -// lookup returns the trie value for the first UTF-8 encoding in s and -// the width in bytes of this encoding. The size will be 0 if s does not -// hold enough bytes to complete the encoding. len(s) must be greater than 0. -func (t *multiTrie) lookup(s []byte) (v uint64, sz int) { - c0 := s[0] - switch { - case c0 < 0x80: // is ASCII - return t.ascii[c0], 1 - case c0 < 0xC2: - return 0, 1 // Illegal UTF-8: not a starter, not ASCII. - case c0 < 0xE0: // 2-byte UTF-8 - if len(s) < 2 { - return 0, 0 - } - i := t.utf8Start[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c1), 2 - case c0 < 0xF0: // 3-byte UTF-8 - if len(s) < 3 { - return 0, 0 - } - i := t.utf8Start[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = multiIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c2), 3 - case c0 < 0xF8: // 4-byte UTF-8 - if len(s) < 4 { - return 0, 0 - } - i := t.utf8Start[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = multiIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - o = uint32(i)<<6 + uint32(c2) - i = multiIndex[o] - c3 := s[3] - if c3 < 0x80 || 0xC0 <= c3 { - return 0, 3 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c3), 4 - } - // Illegal rune - return 0, 1 -} - -// lookupUnsafe returns the trie value for the first UTF-8 encoding in s. -// s must start with a full and valid UTF-8 encoded rune. -func (t *multiTrie) lookupUnsafe(s []byte) uint64 { - c0 := s[0] - if c0 < 0x80 { // is ASCII - return t.ascii[c0] - } - i := t.utf8Start[c0] - if c0 < 0xE0 { // 2-byte UTF-8 - return t.lookupValue(uint32(i), s[1]) - } - i = multiIndex[uint32(i)<<6+uint32(s[1])] - if c0 < 0xF0 { // 3-byte UTF-8 - return t.lookupValue(uint32(i), s[2]) - } - i = multiIndex[uint32(i)<<6+uint32(s[2])] - if c0 < 0xF8 { // 4-byte UTF-8 - return t.lookupValue(uint32(i), s[3]) - } - return 0 -} - -// lookupString returns the trie value for the first UTF-8 encoding in s and -// the width in bytes of this encoding. The size will be 0 if s does not -// hold enough bytes to complete the encoding. len(s) must be greater than 0. -func (t *multiTrie) lookupString(s string) (v uint64, sz int) { - c0 := s[0] - switch { - case c0 < 0x80: // is ASCII - return t.ascii[c0], 1 - case c0 < 0xC2: - return 0, 1 // Illegal UTF-8: not a starter, not ASCII. - case c0 < 0xE0: // 2-byte UTF-8 - if len(s) < 2 { - return 0, 0 - } - i := t.utf8Start[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c1), 2 - case c0 < 0xF0: // 3-byte UTF-8 - if len(s) < 3 { - return 0, 0 - } - i := t.utf8Start[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = multiIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c2), 3 - case c0 < 0xF8: // 4-byte UTF-8 - if len(s) < 4 { - return 0, 0 - } - i := t.utf8Start[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = multiIndex[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - o = uint32(i)<<6 + uint32(c2) - i = multiIndex[o] - c3 := s[3] - if c3 < 0x80 || 0xC0 <= c3 { - return 0, 3 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c3), 4 - } - // Illegal rune - return 0, 1 -} - -// lookupStringUnsafe returns the trie value for the first UTF-8 encoding in s. -// s must start with a full and valid UTF-8 encoded rune. -func (t *multiTrie) lookupStringUnsafe(s string) uint64 { - c0 := s[0] - if c0 < 0x80 { // is ASCII - return t.ascii[c0] - } - i := t.utf8Start[c0] - if c0 < 0xE0 { // 2-byte UTF-8 - return t.lookupValue(uint32(i), s[1]) - } - i = multiIndex[uint32(i)<<6+uint32(s[1])] - if c0 < 0xF0 { // 3-byte UTF-8 - return t.lookupValue(uint32(i), s[2]) - } - i = multiIndex[uint32(i)<<6+uint32(s[2])] - if c0 < 0xF8 { // 4-byte UTF-8 - return t.lookupValue(uint32(i), s[3]) - } - return 0 -} - -// multiTrie. Total size: 18250 bytes (17.82 KiB). Checksum: a69a609d8696aa5e. -type multiTrie struct { - ascii []uint64 // index for ASCII bytes - utf8Start []uint8 // index for UTF-8 bytes >= 0xC0 -} - -func newMultiTrie(i int) *multiTrie { - h := multiTrieHandles[i] - return &multiTrie{multiValues[uint32(h.ascii)<<6:], multiIndex[uint32(h.multi)<<6:]} -} - -type multiTrieHandle struct { - ascii, multi uint8 -} - -// multiTrieHandles: 5 handles, 10 bytes -var multiTrieHandles = [5]multiTrieHandle{ - {0, 0}, // 8c1e77823143d35c: all - {0, 23}, // 8fb58ff8243b45b0: ASCII only - {0, 23}, // 8fb58ff8243b45b0: ASCII only 2 - {0, 24}, // 2ccc43994f11046f: BMP only - {30, 25}, // ce448591bdcb4733: No BMP -} - -// lookupValue determines the type of block n and looks up the value for b. -func (t *multiTrie) lookupValue(n uint32, b byte) uint64 { - switch { - default: - return uint64(multiValues[n<<6+uint32(b)]) - } -} - -// multiValues: 32 blocks, 2048 entries, 16384 bytes -// The third block is the zero block. -var multiValues = [2048]uint64{ - // Block 0x0, offset 0x0 - 0x03: 0x6e361699800b9fb8, 0x04: 0x52d3935a34f6f0b, 0x05: 0x2948319393e7ef10, - 0x07: 0x20f03b006704f663, 0x08: 0x6c15c0732bb2495f, 0x09: 0xe54e2c59d953551, - 0x0f: 0x33d8a825807d8037, 0x10: 0x6ecd93cb12168b92, 0x11: 0x6a81c9c0ce86e884, - 0x1f: 0xa03e77aac8be79b, 0x20: 0x28591d0e7e486efa, 0x21: 0x716fa3bc398dec8, - 0x3f: 0x4fd3bcfa72bce8b0, - // Block 0x1, offset 0x40 - 0x40: 0x3cbaef3db8ba5f12, 0x41: 0x2d262347c1f56357, - 0x7f: 0x782caa2d25a418a9, - // Block 0x2, offset 0x80 - // Block 0x3, offset 0xc0 - 0xc0: 0x6bbd1f937b1ff5d2, 0xc1: 0x732e23088d2eb8a4, - // Block 0x4, offset 0x100 - 0x13f: 0x56f8c4c82f5962dc, - // Block 0x5, offset 0x140 - 0x140: 0x57dc4544729a5da2, 0x141: 0x2f62f9cd307ffa0d, - // Block 0x6, offset 0x180 - 0x1bf: 0x7bf4d0ebf302a088, - // Block 0x7, offset 0x1c0 - 0x1c0: 0x1f0d67f249e59931, 0x1c1: 0x3011def73aa550c7, - // Block 0x8, offset 0x200 - 0x23f: 0x5de81c1dff6bf29d, - // Block 0x9, offset 0x240 - 0x240: 0x752c035737b825e8, 0x241: 0x1e793399081e3bb3, - // Block 0xa, offset 0x280 - 0x2bf: 0x6a28f01979cbf059, - // Block 0xb, offset 0x2c0 - 0x2c0: 0x373a4b0f2cbd4c74, 0x2c1: 0x4fd2c288683b767c, - // Block 0xc, offset 0x300 - 0x33f: 0x5a10ffa9e29184fb, - // Block 0xd, offset 0x340 - 0x340: 0x700f9bdb53fff6a5, 0x341: 0xcde93df0427eb79, - // Block 0xe, offset 0x380 - 0x3bf: 0x74071288fff39c76, - // Block 0xf, offset 0x3c0 - 0x3c0: 0x481fc2f510e5268a, 0x3c1: 0x7565c28164204849, - // Block 0x10, offset 0x400 - 0x43f: 0x5676a62fd49c6bec, - // Block 0x11, offset 0x440 - 0x440: 0x2f2d15776cbafc6b, 0x441: 0x4c55e8dc0ff11a3f, - // Block 0x12, offset 0x480 - 0x4bf: 0x69d6f0fe711fafc9, - // Block 0x13, offset 0x4c0 - 0x4c0: 0x33181de28cfb062d, 0x4c1: 0x2ef3adc6bb2f2d02, - // Block 0x14, offset 0x500 - 0x53f: 0xe03b31814c95f8b, - // Block 0x15, offset 0x540 - 0x540: 0x3bf6dc9a1c115603, 0x541: 0x6984ec9b7f51f7fc, - // Block 0x16, offset 0x580 - 0x5bf: 0x3c02ea92fb168559, - // Block 0x17, offset 0x5c0 - 0x5c0: 0x1badfe42e7629494, 0x5c1: 0x6dc4a554005f7645, - // Block 0x18, offset 0x600 - 0x63f: 0x3bb2ed2a72748f4b, - // Block 0x19, offset 0x640 - 0x640: 0x291354cd6767ec10, 0x641: 0x2c3a4715e3c070d6, - // Block 0x1a, offset 0x680 - 0x6bf: 0x352711cfb7236418, - // Block 0x1b, offset 0x6c0 - 0x6c0: 0x3a59d34fb8bceda, 0x6c1: 0x5e90d8ebedd64fa1, - // Block 0x1c, offset 0x700 - 0x73f: 0x7191a77b28d23110, - // Block 0x1d, offset 0x740 - 0x740: 0x4ca7f0c1623423d8, 0x741: 0x4f7156d996e2d0de, - // Block 0x1e, offset 0x780 - // Block 0x1f, offset 0x7c0 -} - -// multiIndex: 29 blocks, 1856 entries, 1856 bytes -// Block 0 is the zero block. -var multiIndex = [1856]uint8{ - // Block 0x0, offset 0x0 - // Block 0x1, offset 0x40 - // Block 0x2, offset 0x80 - // Block 0x3, offset 0xc0 - 0xc2: 0x01, 0xc3: 0x02, 0xc4: 0x03, 0xc7: 0x04, - 0xc8: 0x05, 0xcf: 0x06, - 0xd0: 0x07, - 0xdf: 0x08, - 0xe0: 0x02, 0xe1: 0x03, 0xe2: 0x04, 0xe3: 0x05, 0xe4: 0x06, 0xe7: 0x07, - 0xe8: 0x08, 0xef: 0x09, - 0xf0: 0x0e, 0xf1: 0x11, 0xf2: 0x13, 0xf3: 0x15, 0xf4: 0x17, - // Block 0x4, offset 0x100 - 0x120: 0x09, - 0x13f: 0x0a, - // Block 0x5, offset 0x140 - 0x140: 0x0b, - 0x17f: 0x0c, - // Block 0x6, offset 0x180 - 0x180: 0x0d, - // Block 0x7, offset 0x1c0 - 0x1ff: 0x0e, - // Block 0x8, offset 0x200 - 0x200: 0x0f, - // Block 0x9, offset 0x240 - 0x27f: 0x10, - // Block 0xa, offset 0x280 - 0x280: 0x11, - // Block 0xb, offset 0x2c0 - 0x2ff: 0x12, - // Block 0xc, offset 0x300 - 0x300: 0x13, - // Block 0xd, offset 0x340 - 0x37f: 0x14, - // Block 0xe, offset 0x380 - 0x380: 0x15, - // Block 0xf, offset 0x3c0 - 0x3ff: 0x16, - // Block 0x10, offset 0x400 - 0x410: 0x0a, - 0x41f: 0x0b, - 0x420: 0x0c, - 0x43f: 0x0d, - // Block 0x11, offset 0x440 - 0x440: 0x17, - // Block 0x12, offset 0x480 - 0x4bf: 0x18, - // Block 0x13, offset 0x4c0 - 0x4c0: 0x0f, - 0x4ff: 0x10, - // Block 0x14, offset 0x500 - 0x500: 0x19, - // Block 0x15, offset 0x540 - 0x540: 0x12, - // Block 0x16, offset 0x580 - 0x5bf: 0x1a, - // Block 0x17, offset 0x5c0 - 0x5ff: 0x14, - // Block 0x18, offset 0x600 - 0x600: 0x1b, - // Block 0x19, offset 0x640 - 0x640: 0x16, - // Block 0x1a, offset 0x680 - // Block 0x1b, offset 0x6c0 - 0x6c2: 0x01, 0x6c3: 0x02, 0x6c4: 0x03, 0x6c7: 0x04, - 0x6c8: 0x05, 0x6cf: 0x06, - 0x6d0: 0x07, - 0x6df: 0x08, - 0x6e0: 0x02, 0x6e1: 0x03, 0x6e2: 0x04, 0x6e3: 0x05, 0x6e4: 0x06, 0x6e7: 0x07, - 0x6e8: 0x08, 0x6ef: 0x09, - // Block 0x1c, offset 0x700 - 0x730: 0x0e, 0x731: 0x11, 0x732: 0x13, 0x733: 0x15, 0x734: 0x17, -} diff --git a/vendor/golang.org/x/text/internal/triegen/example_compact_test.go b/vendor/golang.org/x/text/internal/triegen/example_compact_test.go deleted file mode 100644 index 7cf604ca4..000000000 --- a/vendor/golang.org/x/text/internal/triegen/example_compact_test.go +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package triegen_test - -import ( - "fmt" - "io" - "io/ioutil" - - "golang.org/x/text/internal/triegen" -) - -func ExampleCompacter() { - t := triegen.NewTrie("root") - for r := rune(0); r < 10000; r += 64 { - t.Insert(r, 0x9015BADA55^uint64(r)) - } - sz, _ := t.Gen(ioutil.Discard) - - fmt.Printf("Size normal: %5d\n", sz) - - var c myCompacter - sz, _ = t.Gen(ioutil.Discard, triegen.Compact(&c)) - - fmt.Printf("Size compacted: %5d\n", sz) - - // Output: - // Size normal: 81344 - // Size compacted: 3224 -} - -// A myCompacter accepts a block if only the first value is given. -type myCompacter []uint64 - -func (c *myCompacter) Size(values []uint64) (sz int, ok bool) { - for _, v := range values[1:] { - if v != 0 { - return 0, false - } - } - return 8, true // the size of a uint64 -} - -func (c *myCompacter) Store(v []uint64) uint32 { - x := uint32(len(*c)) - *c = append(*c, v[0]) - return x -} - -func (c *myCompacter) Print(w io.Writer) error { - fmt.Fprintln(w, "var firstValue = []uint64{") - for _, v := range *c { - fmt.Fprintf(w, "\t%#x,\n", v) - } - fmt.Fprintln(w, "}") - return nil -} - -func (c *myCompacter) Handler() string { - return "getFirstValue" - - // Where getFirstValue is included along with the generated code: - // func getFirstValue(n uint32, b byte) uint64 { - // if b == 0x80 { // the first continuation byte - // return firstValue[n] - // } - // return 0 - // } -} diff --git a/vendor/golang.org/x/text/internal/triegen/example_test.go b/vendor/golang.org/x/text/internal/triegen/example_test.go deleted file mode 100644 index 557a152e7..000000000 --- a/vendor/golang.org/x/text/internal/triegen/example_test.go +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package triegen_test - -import ( - "fmt" - "io/ioutil" - "math/rand" - "unicode" - - "golang.org/x/text/internal/triegen" -) - -const seed = 0x12345 - -var genWriter = ioutil.Discard - -func randomRunes() map[rune]uint8 { - rnd := rand.New(rand.NewSource(seed)) - m := map[rune]uint8{} - for len(m) < 100 { - // Only set our random rune if it is a valid Unicode code point. - if r := rune(rnd.Int31n(unicode.MaxRune + 1)); []rune(string(r))[0] == r { - m[r] = 1 - } - } - return m -} - -// Example_build shows how to build a simple trie. It assigns the value 1 to -// 100 random runes generated by randomRunes. -func Example_build() { - t := triegen.NewTrie("rand") - - for r, _ := range randomRunes() { - t.Insert(r, 1) - } - sz, err := t.Gen(genWriter) - - fmt.Printf("Trie size: %d bytes\n", sz) - fmt.Printf("Error: %v\n", err) - - // Output: - // Trie size: 9280 bytes - // Error: -} - -// Example_lookup demonstrates how to use the trie generated by Example_build. -func Example_lookup() { - trie := newRandTrie(0) - - // The same set of runes used by Example_build. - runes := randomRunes() - - // Verify the right value is returned for all runes. - for r := rune(0); r <= unicode.MaxRune; r++ { - // Note that the return type of lookup is uint8. - if v, _ := trie.lookupString(string(r)); v != runes[r] { - fmt.Println("FAILURE") - return - } - } - fmt.Println("SUCCESS") - - // Output: - // SUCCESS -} - -// runeValues generates some random values for a set of interesting runes. -func runeValues() map[rune]uint64 { - rnd := rand.New(rand.NewSource(seed)) - m := map[rune]uint64{} - for p := 4; p <= unicode.MaxRune; p <<= 1 { - for d := -1; d <= 1; d++ { - m[rune(p+d)] = uint64(rnd.Int63()) - } - } - return m -} - -// ExampleGen_build demonstrates the creation of multiple tries sharing common -// blocks. ExampleGen_lookup demonstrates how to use the generated tries. -func ExampleGen_build() { - var tries []*triegen.Trie - - rv := runeValues() - for _, c := range []struct { - include func(rune) bool - name string - }{ - {func(r rune) bool { return true }, "all"}, - {func(r rune) bool { return r < 0x80 }, "ASCII only"}, - {func(r rune) bool { return r < 0x80 }, "ASCII only 2"}, - {func(r rune) bool { return r <= 0xFFFF }, "BMP only"}, - {func(r rune) bool { return r > 0xFFFF }, "No BMP"}, - } { - t := triegen.NewTrie(c.name) - tries = append(tries, t) - - for r, v := range rv { - if c.include(r) { - t.Insert(r, v) - } - } - } - sz, err := triegen.Gen(genWriter, "multi", tries) - - fmt.Printf("Trie size: %d bytes\n", sz) - fmt.Printf("Error: %v\n", err) - - // Output: - // Trie size: 18250 bytes - // Error: -} - -// ExampleGen_lookup shows how to look up values in the trie generated by -// ExampleGen_build. -func ExampleGen_lookup() { - rv := runeValues() - for i, include := range []func(rune) bool{ - func(r rune) bool { return true }, // all - func(r rune) bool { return r < 0x80 }, // ASCII only - func(r rune) bool { return r < 0x80 }, // ASCII only 2 - func(r rune) bool { return r <= 0xFFFF }, // BMP only - func(r rune) bool { return r > 0xFFFF }, // No BMP - } { - t := newMultiTrie(i) - - for r := rune(0); r <= unicode.MaxRune; r++ { - x := uint64(0) - if include(r) { - x = rv[r] - } - // As we convert from a valid rune, we know it is safe to use - // lookupStringUnsafe. - if v := t.lookupStringUnsafe(string(r)); x != v { - fmt.Println("FAILURE") - return - } - } - } - fmt.Println("SUCCESS") - - // Output: - // SUCCESS -} diff --git a/vendor/golang.org/x/text/internal/triegen/gen_test.go b/vendor/golang.org/x/text/internal/triegen/gen_test.go deleted file mode 100644 index 831627d7a..000000000 --- a/vendor/golang.org/x/text/internal/triegen/gen_test.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build generate - -package triegen_test - -// The code in this file generates captures and writes the tries generated in -// the examples to data_test.go. To invoke it, run: -// go test -tags=generate -// -// Making the generation code a "test" allows us to link in the necessary test -// code. - -import ( - "log" - "os" - "os/exec" -) - -func init() { - const tmpfile = "tmpout" - const dstfile = "data_test.go" - - f, err := os.Create(tmpfile) - if err != nil { - log.Fatalf("Could not create output file: %v", err) - } - defer os.Remove(tmpfile) - defer f.Close() - - // We exit before this function returns, regardless of success or failure, - // so there's no need to save (and later restore) the existing genWriter - // value. - genWriter = f - - f.Write([]byte(header)) - - Example_build() - ExampleGen_build() - - if err := exec.Command("gofmt", "-w", tmpfile).Run(); err != nil { - log.Fatal(err) - } - os.Remove(dstfile) - os.Rename(tmpfile, dstfile) - - os.Exit(0) -} - -const header = `// This file is generated with "go test -tags generate". DO NOT EDIT! -// +build !generate - -package triegen_test -` - -// Stubs for generated tries. These are needed as we exclude data_test.go if -// the generate flag is set. This will clearly make the tests fail, but that -// is okay. It allows us to bootstrap. - -type trie struct{} - -func (t *trie) lookupString(string) (uint8, int) { return 0, 1 } -func (t *trie) lookupStringUnsafe(string) uint64 { return 0 } - -func newRandTrie(i int) *trie { return &trie{} } -func newMultiTrie(i int) *trie { return &trie{} } diff --git a/vendor/golang.org/x/text/internal/triegen/print.go b/vendor/golang.org/x/text/internal/triegen/print.go deleted file mode 100644 index 8d9f120bc..000000000 --- a/vendor/golang.org/x/text/internal/triegen/print.go +++ /dev/null @@ -1,251 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package triegen - -import ( - "bytes" - "fmt" - "io" - "strings" - "text/template" -) - -// print writes all the data structures as well as the code necessary to use the -// trie to w. -func (b *builder) print(w io.Writer) error { - b.Stats.NValueEntries = len(b.ValueBlocks) * blockSize - b.Stats.NValueBytes = len(b.ValueBlocks) * blockSize * b.ValueSize - b.Stats.NIndexEntries = len(b.IndexBlocks) * blockSize - b.Stats.NIndexBytes = len(b.IndexBlocks) * blockSize * b.IndexSize - b.Stats.NHandleBytes = len(b.Trie) * 2 * b.IndexSize - - // If we only have one root trie, all starter blocks are at position 0 and - // we can access the arrays directly. - if len(b.Trie) == 1 { - // At this point we cannot refer to the generated tables directly. - b.ASCIIBlock = b.Name + "Values" - b.StarterBlock = b.Name + "Index" - } else { - // Otherwise we need to have explicit starter indexes in the trie - // structure. - b.ASCIIBlock = "t.ascii" - b.StarterBlock = "t.utf8Start" - } - - b.SourceType = "[]byte" - if err := lookupGen.Execute(w, b); err != nil { - return err - } - - b.SourceType = "string" - if err := lookupGen.Execute(w, b); err != nil { - return err - } - - if err := trieGen.Execute(w, b); err != nil { - return err - } - - for _, c := range b.Compactions { - if err := c.c.Print(w); err != nil { - return err - } - } - - return nil -} - -func printValues(n int, values []uint64) string { - w := &bytes.Buffer{} - boff := n * blockSize - fmt.Fprintf(w, "\t// Block %#x, offset %#x", n, boff) - var newline bool - for i, v := range values { - if i%6 == 0 { - newline = true - } - if v != 0 { - if newline { - fmt.Fprintf(w, "\n") - newline = false - } - fmt.Fprintf(w, "\t%#02x:%#04x, ", boff+i, v) - } - } - return w.String() -} - -func printIndex(b *builder, nr int, n *node) string { - w := &bytes.Buffer{} - boff := nr * blockSize - fmt.Fprintf(w, "\t// Block %#x, offset %#x", nr, boff) - var newline bool - for i, c := range n.children { - if i%8 == 0 { - newline = true - } - if c != nil { - v := b.Compactions[c.index.compaction].Offset + uint32(c.index.index) - if v != 0 { - if newline { - fmt.Fprintf(w, "\n") - newline = false - } - fmt.Fprintf(w, "\t%#02x:%#02x, ", boff+i, v) - } - } - } - return w.String() -} - -var ( - trieGen = template.Must(template.New("trie").Funcs(template.FuncMap{ - "printValues": printValues, - "printIndex": printIndex, - "title": strings.Title, - "dec": func(x int) int { return x - 1 }, - "psize": func(n int) string { - return fmt.Sprintf("%d bytes (%.2f KiB)", n, float64(n)/1024) - }, - }).Parse(trieTemplate)) - lookupGen = template.Must(template.New("lookup").Parse(lookupTemplate)) -) - -// TODO: consider the return type of lookup. It could be uint64, even if the -// internal value type is smaller. We will have to verify this with the -// performance of unicode/norm, which is very sensitive to such changes. -const trieTemplate = `{{$b := .}}{{$multi := gt (len .Trie) 1}} -// {{.Name}}Trie. Total size: {{psize .Size}}. Checksum: {{printf "%08x" .Checksum}}. -type {{.Name}}Trie struct { {{if $multi}} - ascii []{{.ValueType}} // index for ASCII bytes - utf8Start []{{.IndexType}} // index for UTF-8 bytes >= 0xC0 -{{end}}} - -func new{{title .Name}}Trie(i int) *{{.Name}}Trie { {{if $multi}} - h := {{.Name}}TrieHandles[i] - return &{{.Name}}Trie{ {{.Name}}Values[uint32(h.ascii)<<6:], {{.Name}}Index[uint32(h.multi)<<6:] } -} - -type {{.Name}}TrieHandle struct { - ascii, multi {{.IndexType}} -} - -// {{.Name}}TrieHandles: {{len .Trie}} handles, {{.Stats.NHandleBytes}} bytes -var {{.Name}}TrieHandles = [{{len .Trie}}]{{.Name}}TrieHandle{ -{{range .Trie}} { {{.ASCIIIndex}}, {{.StarterIndex}} }, // {{printf "%08x" .Checksum}}: {{.Name}} -{{end}}}{{else}} - return &{{.Name}}Trie{} -} -{{end}} -// lookupValue determines the type of block n and looks up the value for b. -func (t *{{.Name}}Trie) lookupValue(n uint32, b byte) {{.ValueType}}{{$last := dec (len .Compactions)}} { - switch { {{range $i, $c := .Compactions}} - {{if eq $i $last}}default{{else}}case n < {{$c.Cutoff}}{{end}}:{{if ne $i 0}} - n -= {{$c.Offset}}{{end}} - return {{print $b.ValueType}}({{$c.Handler}}){{end}} - } -} - -// {{.Name}}Values: {{len .ValueBlocks}} blocks, {{.Stats.NValueEntries}} entries, {{.Stats.NValueBytes}} bytes -// The third block is the zero block. -var {{.Name}}Values = [{{.Stats.NValueEntries}}]{{.ValueType}} { -{{range $i, $v := .ValueBlocks}}{{printValues $i $v}} -{{end}}} - -// {{.Name}}Index: {{len .IndexBlocks}} blocks, {{.Stats.NIndexEntries}} entries, {{.Stats.NIndexBytes}} bytes -// Block 0 is the zero block. -var {{.Name}}Index = [{{.Stats.NIndexEntries}}]{{.IndexType}} { -{{range $i, $v := .IndexBlocks}}{{printIndex $b $i $v}} -{{end}}} -` - -// TODO: consider allowing zero-length strings after evaluating performance with -// unicode/norm. -const lookupTemplate = ` -// lookup{{if eq .SourceType "string"}}String{{end}} returns the trie value for the first UTF-8 encoding in s and -// the width in bytes of this encoding. The size will be 0 if s does not -// hold enough bytes to complete the encoding. len(s) must be greater than 0. -func (t *{{.Name}}Trie) lookup{{if eq .SourceType "string"}}String{{end}}(s {{.SourceType}}) (v {{.ValueType}}, sz int) { - c0 := s[0] - switch { - case c0 < 0x80: // is ASCII - return {{.ASCIIBlock}}[c0], 1 - case c0 < 0xC2: - return 0, 1 // Illegal UTF-8: not a starter, not ASCII. - case c0 < 0xE0: // 2-byte UTF-8 - if len(s) < 2 { - return 0, 0 - } - i := {{.StarterBlock}}[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c1), 2 - case c0 < 0xF0: // 3-byte UTF-8 - if len(s) < 3 { - return 0, 0 - } - i := {{.StarterBlock}}[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = {{.Name}}Index[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c2), 3 - case c0 < 0xF8: // 4-byte UTF-8 - if len(s) < 4 { - return 0, 0 - } - i := {{.StarterBlock}}[c0] - c1 := s[1] - if c1 < 0x80 || 0xC0 <= c1 { - return 0, 1 // Illegal UTF-8: not a continuation byte. - } - o := uint32(i)<<6 + uint32(c1) - i = {{.Name}}Index[o] - c2 := s[2] - if c2 < 0x80 || 0xC0 <= c2 { - return 0, 2 // Illegal UTF-8: not a continuation byte. - } - o = uint32(i)<<6 + uint32(c2) - i = {{.Name}}Index[o] - c3 := s[3] - if c3 < 0x80 || 0xC0 <= c3 { - return 0, 3 // Illegal UTF-8: not a continuation byte. - } - return t.lookupValue(uint32(i), c3), 4 - } - // Illegal rune - return 0, 1 -} - -// lookup{{if eq .SourceType "string"}}String{{end}}Unsafe returns the trie value for the first UTF-8 encoding in s. -// s must start with a full and valid UTF-8 encoded rune. -func (t *{{.Name}}Trie) lookup{{if eq .SourceType "string"}}String{{end}}Unsafe(s {{.SourceType}}) {{.ValueType}} { - c0 := s[0] - if c0 < 0x80 { // is ASCII - return {{.ASCIIBlock}}[c0] - } - i := {{.StarterBlock}}[c0] - if c0 < 0xE0 { // 2-byte UTF-8 - return t.lookupValue(uint32(i), s[1]) - } - i = {{.Name}}Index[uint32(i)<<6+uint32(s[1])] - if c0 < 0xF0 { // 3-byte UTF-8 - return t.lookupValue(uint32(i), s[2]) - } - i = {{.Name}}Index[uint32(i)<<6+uint32(s[2])] - if c0 < 0xF8 { // 4-byte UTF-8 - return t.lookupValue(uint32(i), s[3]) - } - return 0 -} -` diff --git a/vendor/golang.org/x/text/internal/triegen/triegen.go b/vendor/golang.org/x/text/internal/triegen/triegen.go deleted file mode 100644 index adb010812..000000000 --- a/vendor/golang.org/x/text/internal/triegen/triegen.go +++ /dev/null @@ -1,494 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package triegen implements a code generator for a trie for associating -// unsigned integer values with UTF-8 encoded runes. -// -// Many of the go.text packages use tries for storing per-rune information. A -// trie is especially useful if many of the runes have the same value. If this -// is the case, many blocks can be expected to be shared allowing for -// information on many runes to be stored in little space. -// -// As most of the lookups are done directly on []byte slices, the tries use the -// UTF-8 bytes directly for the lookup. This saves a conversion from UTF-8 to -// runes and contributes a little bit to better performance. It also naturally -// provides a fast path for ASCII. -// -// Space is also an issue. There are many code points defined in Unicode and as -// a result tables can get quite large. So every byte counts. The triegen -// package automatically chooses the smallest integer values to represent the -// tables. Compacters allow further compression of the trie by allowing for -// alternative representations of individual trie blocks. -// -// triegen allows generating multiple tries as a single structure. This is -// useful when, for example, one wants to generate tries for several languages -// that have a lot of values in common. Some existing libraries for -// internationalization store all per-language data as a dynamically loadable -// chunk. The go.text packages are designed with the assumption that the user -// typically wants to compile in support for all supported languages, in line -// with the approach common to Go to create a single standalone binary. The -// multi-root trie approach can give significant storage savings in this -// scenario. -// -// triegen generates both tables and code. The code is optimized to use the -// automatically chosen data types. The following code is generated for a Trie -// or multiple Tries named "foo": -// - type fooTrie -// The trie type. -// -// - func newFooTrie(x int) *fooTrie -// Trie constructor, where x is the index of the trie passed to Gen. -// -// - func (t *fooTrie) lookup(s []byte) (v uintX, sz int) -// The lookup method, where uintX is automatically chosen. -// -// - func lookupString, lookupUnsafe and lookupStringUnsafe -// Variants of the above. -// -// - var fooValues and fooIndex and any tables generated by Compacters. -// The core trie data. -// -// - var fooTrieHandles -// Indexes of starter blocks in case of multiple trie roots. -// -// It is recommended that users test the generated trie by checking the returned -// value for every rune. Such exhaustive tests are possible as the the number of -// runes in Unicode is limited. -package triegen // import "golang.org/x/text/internal/triegen" - -// TODO: Arguably, the internally optimized data types would not have to be -// exposed in the generated API. We could also investigate not generating the -// code, but using it through a package. We would have to investigate the impact -// on performance of making such change, though. For packages like unicode/norm, -// small changes like this could tank performance. - -import ( - "encoding/binary" - "fmt" - "hash/crc64" - "io" - "log" - "unicode/utf8" -) - -// builder builds a set of tries for associating values with runes. The set of -// tries can share common index and value blocks. -type builder struct { - Name string - - // ValueType is the type of the trie values looked up. - ValueType string - - // ValueSize is the byte size of the ValueType. - ValueSize int - - // IndexType is the type of trie index values used for all UTF-8 bytes of - // a rune except the last one. - IndexType string - - // IndexSize is the byte size of the IndexType. - IndexSize int - - // SourceType is used when generating the lookup functions. If the user - // requests StringSupport, all lookup functions will be generated for - // string input as well. - SourceType string - - Trie []*Trie - - IndexBlocks []*node - ValueBlocks [][]uint64 - Compactions []compaction - Checksum uint64 - - ASCIIBlock string - StarterBlock string - - indexBlockIdx map[uint64]int - valueBlockIdx map[uint64]nodeIndex - asciiBlockIdx map[uint64]int - - // Stats are used to fill out the template. - Stats struct { - NValueEntries int - NValueBytes int - NIndexEntries int - NIndexBytes int - NHandleBytes int - } - - err error -} - -// A nodeIndex encodes the index of a node, which is defined by the compaction -// which stores it and an index within the compaction. For internal nodes, the -// compaction is always 0. -type nodeIndex struct { - compaction int - index int -} - -// compaction keeps track of stats used for the compaction. -type compaction struct { - c Compacter - blocks []*node - maxHandle uint32 - totalSize int - - // Used by template-based generator and thus exported. - Cutoff uint32 - Offset uint32 - Handler string -} - -func (b *builder) setError(err error) { - if b.err == nil { - b.err = err - } -} - -// An Option can be passed to Gen. -type Option func(b *builder) error - -// Compact configures the trie generator to use the given Compacter. -func Compact(c Compacter) Option { - return func(b *builder) error { - b.Compactions = append(b.Compactions, compaction{ - c: c, - Handler: c.Handler() + "(n, b)"}) - return nil - } -} - -// Gen writes Go code for a shared trie lookup structure to w for the given -// Tries. The generated trie type will be called nameTrie. newNameTrie(x) will -// return the *nameTrie for tries[x]. A value can be looked up by using one of -// the various lookup methods defined on nameTrie. It returns the table size of -// the generated trie. -func Gen(w io.Writer, name string, tries []*Trie, opts ...Option) (sz int, err error) { - // The index contains two dummy blocks, followed by the zero block. The zero - // block is at offset 0x80, so that the offset for the zero block for - // continuation bytes is 0. - b := &builder{ - Name: name, - Trie: tries, - IndexBlocks: []*node{{}, {}, {}}, - Compactions: []compaction{{ - Handler: name + "Values[n<<6+uint32(b)]", - }}, - // The 0 key in indexBlockIdx and valueBlockIdx is the hash of the zero - // block. - indexBlockIdx: map[uint64]int{0: 0}, - valueBlockIdx: map[uint64]nodeIndex{0: {}}, - asciiBlockIdx: map[uint64]int{}, - } - b.Compactions[0].c = (*simpleCompacter)(b) - - for _, f := range opts { - if err := f(b); err != nil { - return 0, err - } - } - b.build() - if b.err != nil { - return 0, b.err - } - if err = b.print(w); err != nil { - return 0, err - } - return b.Size(), nil -} - -// A Trie represents a single root node of a trie. A builder may build several -// overlapping tries at once. -type Trie struct { - root *node - - hiddenTrie -} - -// hiddenTrie contains values we want to be visible to the template generator, -// but hidden from the API documentation. -type hiddenTrie struct { - Name string - Checksum uint64 - ASCIIIndex int - StarterIndex int -} - -// NewTrie returns a new trie root. -func NewTrie(name string) *Trie { - return &Trie{ - &node{ - children: make([]*node, blockSize), - values: make([]uint64, utf8.RuneSelf), - }, - hiddenTrie{Name: name}, - } -} - -// Gen is a convenience wrapper around the Gen func passing t as the only trie -// and uses the name passed to NewTrie. It returns the size of the generated -// tables. -func (t *Trie) Gen(w io.Writer, opts ...Option) (sz int, err error) { - return Gen(w, t.Name, []*Trie{t}, opts...) -} - -// node is a node of the intermediate trie structure. -type node struct { - // children holds this node's children. It is always of length 64. - // A child node may be nil. - children []*node - - // values contains the values of this node. If it is non-nil, this node is - // either a root or leaf node: - // For root nodes, len(values) == 128 and it maps the bytes in [0x00, 0x7F]. - // For leaf nodes, len(values) == 64 and it maps the bytes in [0x80, 0xBF]. - values []uint64 - - index nodeIndex -} - -// Insert associates value with the given rune. Insert will panic if a non-zero -// value is passed for an invalid rune. -func (t *Trie) Insert(r rune, value uint64) { - if value == 0 { - return - } - s := string(r) - if []rune(s)[0] != r && value != 0 { - // Note: The UCD tables will always assign what amounts to a zero value - // to a surrogate. Allowing a zero value for an illegal rune allows - // users to iterate over [0..MaxRune] without having to explicitly - // exclude surrogates, which would be tedious. - panic(fmt.Sprintf("triegen: non-zero value for invalid rune %U", r)) - } - if len(s) == 1 { - // It is a root node value (ASCII). - t.root.values[s[0]] = value - return - } - - n := t.root - for ; len(s) > 1; s = s[1:] { - if n.children == nil { - n.children = make([]*node, blockSize) - } - p := s[0] % blockSize - c := n.children[p] - if c == nil { - c = &node{} - n.children[p] = c - } - if len(s) > 2 && c.values != nil { - log.Fatalf("triegen: insert(%U): found internal node with values", r) - } - n = c - } - if n.values == nil { - n.values = make([]uint64, blockSize) - } - if n.children != nil { - log.Fatalf("triegen: insert(%U): found leaf node that also has child nodes", r) - } - n.values[s[0]-0x80] = value -} - -// Size returns the number of bytes the generated trie will take to store. It -// needs to be exported as it is used in the templates. -func (b *builder) Size() int { - // Index blocks. - sz := len(b.IndexBlocks) * blockSize * b.IndexSize - - // Skip the first compaction, which represents the normal value blocks, as - // its totalSize does not account for the ASCII blocks, which are managed - // separately. - sz += len(b.ValueBlocks) * blockSize * b.ValueSize - for _, c := range b.Compactions[1:] { - sz += c.totalSize - } - - // TODO: this computation does not account for the fixed overhead of a using - // a compaction, either code or data. As for data, though, the typical - // overhead of data is in the order of bytes (2 bytes for cases). Further, - // the savings of using a compaction should anyway be substantial for it to - // be worth it. - - // For multi-root tries, we also need to account for the handles. - if len(b.Trie) > 1 { - sz += 2 * b.IndexSize * len(b.Trie) - } - return sz -} - -func (b *builder) build() { - // Compute the sizes of the values. - var vmax uint64 - for _, t := range b.Trie { - vmax = maxValue(t.root, vmax) - } - b.ValueType, b.ValueSize = getIntType(vmax) - - // Compute all block allocations. - // TODO: first compute the ASCII blocks for all tries and then the other - // nodes. ASCII blocks are more restricted in placement, as they require two - // blocks to be placed consecutively. Processing them first may improve - // sharing (at least one zero block can be expected to be saved.) - for _, t := range b.Trie { - b.Checksum += b.buildTrie(t) - } - - // Compute the offsets for all the Compacters. - offset := uint32(0) - for i := range b.Compactions { - c := &b.Compactions[i] - c.Offset = offset - offset += c.maxHandle + 1 - c.Cutoff = offset - } - - // Compute the sizes of indexes. - // TODO: different byte positions could have different sizes. So far we have - // not found a case where this is beneficial. - imax := uint64(b.Compactions[len(b.Compactions)-1].Cutoff) - for _, ib := range b.IndexBlocks { - if x := uint64(ib.index.index); x > imax { - imax = x - } - } - b.IndexType, b.IndexSize = getIntType(imax) -} - -func maxValue(n *node, max uint64) uint64 { - if n == nil { - return max - } - for _, c := range n.children { - max = maxValue(c, max) - } - for _, v := range n.values { - if max < v { - max = v - } - } - return max -} - -func getIntType(v uint64) (string, int) { - switch { - case v < 1<<8: - return "uint8", 1 - case v < 1<<16: - return "uint16", 2 - case v < 1<<32: - return "uint32", 4 - } - return "uint64", 8 -} - -const ( - blockSize = 64 - - // Subtract two blocks to offset 0x80, the first continuation byte. - blockOffset = 2 - - // Subtract three blocks to offset 0xC0, the first non-ASCII starter. - rootBlockOffset = 3 -) - -var crcTable = crc64.MakeTable(crc64.ISO) - -func (b *builder) buildTrie(t *Trie) uint64 { - n := t.root - - // Get the ASCII offset. For the first trie, the ASCII block will be at - // position 0. - hasher := crc64.New(crcTable) - binary.Write(hasher, binary.BigEndian, n.values) - hash := hasher.Sum64() - - v, ok := b.asciiBlockIdx[hash] - if !ok { - v = len(b.ValueBlocks) - b.asciiBlockIdx[hash] = v - - b.ValueBlocks = append(b.ValueBlocks, n.values[:blockSize], n.values[blockSize:]) - if v == 0 { - // Add the zero block at position 2 so that it will be assigned a - // zero reference in the lookup blocks. - // TODO: always do this? This would allow us to remove a check from - // the trie lookup, but at the expense of extra space. Analyze - // performance for unicode/norm. - b.ValueBlocks = append(b.ValueBlocks, make([]uint64, blockSize)) - } - } - t.ASCIIIndex = v - - // Compute remaining offsets. - t.Checksum = b.computeOffsets(n, true) - // We already subtracted the normal blockOffset from the index. Subtract the - // difference for starter bytes. - t.StarterIndex = n.index.index - (rootBlockOffset - blockOffset) - return t.Checksum -} - -func (b *builder) computeOffsets(n *node, root bool) uint64 { - // For the first trie, the root lookup block will be at position 3, which is - // the offset for UTF-8 non-ASCII starter bytes. - first := len(b.IndexBlocks) == rootBlockOffset - if first { - b.IndexBlocks = append(b.IndexBlocks, n) - } - - // We special-case the cases where all values recursively are 0. This allows - // for the use of a zero block to which all such values can be directed. - hash := uint64(0) - if n.children != nil || n.values != nil { - hasher := crc64.New(crcTable) - for _, c := range n.children { - var v uint64 - if c != nil { - v = b.computeOffsets(c, false) - } - binary.Write(hasher, binary.BigEndian, v) - } - binary.Write(hasher, binary.BigEndian, n.values) - hash = hasher.Sum64() - } - - if first { - b.indexBlockIdx[hash] = rootBlockOffset - blockOffset - } - - // Compacters don't apply to internal nodes. - if n.children != nil { - v, ok := b.indexBlockIdx[hash] - if !ok { - v = len(b.IndexBlocks) - blockOffset - b.IndexBlocks = append(b.IndexBlocks, n) - b.indexBlockIdx[hash] = v - } - n.index = nodeIndex{0, v} - } else { - h, ok := b.valueBlockIdx[hash] - if !ok { - bestI, bestSize := 0, blockSize*b.ValueSize - for i, c := range b.Compactions[1:] { - if sz, ok := c.c.Size(n.values); ok && bestSize > sz { - bestI, bestSize = i+1, sz - } - } - c := &b.Compactions[bestI] - c.totalSize += bestSize - v := c.c.Store(n.values) - if c.maxHandle < v { - c.maxHandle = v - } - h = nodeIndex{bestI, int(v)} - b.valueBlockIdx[hash] = h - } - n.index = h - } - return hash -} diff --git a/vendor/golang.org/x/text/internal/ucd/example_test.go b/vendor/golang.org/x/text/internal/ucd/example_test.go deleted file mode 100644 index 338a50d1c..000000000 --- a/vendor/golang.org/x/text/internal/ucd/example_test.go +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package ucd_test - -import ( - "fmt" - "strings" - - "golang.org/x/text/internal/ucd" -) - -func Example() { - // Read rune-by-rune from UnicodeData. - var count int - p := ucd.New(strings.NewReader(unicodeData)) - for p.Next() { - count++ - if lower := p.Runes(ucd.SimpleLowercaseMapping); lower != nil { - fmt.Printf("lower(%U) -> %U\n", p.Rune(0), lower[0]) - } - } - if err := p.Err(); err != nil { - fmt.Println(err) - } - fmt.Println("Number of runes visited:", count) - - // Read raw ranges from Scripts. - p = ucd.New(strings.NewReader(scripts), ucd.KeepRanges) - for p.Next() { - start, end := p.Range(0) - fmt.Printf("%04X..%04X: %s\n", start, end, p.String(1)) - } - if err := p.Err(); err != nil { - fmt.Println(err) - } - - // Output: - // lower(U+00C0) -> U+00E0 - // lower(U+00C1) -> U+00E1 - // lower(U+00C2) -> U+00E2 - // lower(U+00C3) -> U+00E3 - // lower(U+00C4) -> U+00E4 - // Number of runes visited: 6594 - // 0000..001F: Common - // 0020..0020: Common - // 0021..0023: Common - // 0024..0024: Common -} - -// Excerpt from UnicodeData.txt -const unicodeData = ` -00B9;SUPERSCRIPT ONE;No;0;EN; 0031;;1;1;N;SUPERSCRIPT DIGIT ONE;;;; -00BA;MASCULINE ORDINAL INDICATOR;Lo;0;L; 006F;;;;N;;;;; -00BB;RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK;Pf;0;ON;;;;;Y;RIGHT POINTING GUILLEMET;;;; -00BC;VULGAR FRACTION ONE QUARTER;No;0;ON; 0031 2044 0034;;;1/4;N;FRACTION ONE QUARTER;;;; -00BD;VULGAR FRACTION ONE HALF;No;0;ON; 0031 2044 0032;;;1/2;N;FRACTION ONE HALF;;;; -00BE;VULGAR FRACTION THREE QUARTERS;No;0;ON; 0033 2044 0034;;;3/4;N;FRACTION THREE QUARTERS;;;; -00BF;INVERTED QUESTION MARK;Po;0;ON;;;;;N;;;;; -00C0;LATIN CAPITAL LETTER A WITH GRAVE;Lu;0;L;0041 0300;;;;N;LATIN CAPITAL LETTER A GRAVE;;;00E0; -00C1;LATIN CAPITAL LETTER A WITH ACUTE;Lu;0;L;0041 0301;;;;N;LATIN CAPITAL LETTER A ACUTE;;;00E1; -00C2;LATIN CAPITAL LETTER A WITH CIRCUMFLEX;Lu;0;L;0041 0302;;;;N;LATIN CAPITAL LETTER A CIRCUMFLEX;;;00E2; -00C3;LATIN CAPITAL LETTER A WITH TILDE;Lu;0;L;0041 0303;;;;N;LATIN CAPITAL LETTER A TILDE;;;00E3; -00C4;LATIN CAPITAL LETTER A WITH DIAERESIS;Lu;0;L;0041 0308;;;;N;LATIN CAPITAL LETTER A DIAERESIS;;;00E4; - -# A legacy rune range. -3400;;Lo;0;L;;;;;N;;;;; -4DB5;;Lo;0;L;;;;;N;;;;; -` - -// Excerpt from Scripts.txt -const scripts = ` -# Property: Script -# ================================================ - -0000..001F ; Common # Cc [32] .. -0020 ; Common # Zs SPACE -0021..0023 ; Common # Po [3] EXCLAMATION MARK..NUMBER SIGN -0024 ; Common # Sc DOLLAR SIGN -` diff --git a/vendor/golang.org/x/text/internal/ucd/ucd.go b/vendor/golang.org/x/text/internal/ucd/ucd.go deleted file mode 100644 index 8c45b5f3d..000000000 --- a/vendor/golang.org/x/text/internal/ucd/ucd.go +++ /dev/null @@ -1,371 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package ucd provides a parser for Unicode Character Database files, the -// format of which is defined in http://www.unicode.org/reports/tr44/. See -// http://www.unicode.org/Public/UCD/latest/ucd/ for example files. -// -// It currently does not support substitutions of missing fields. -package ucd // import "golang.org/x/text/internal/ucd" - -import ( - "bufio" - "errors" - "fmt" - "io" - "log" - "regexp" - "strconv" - "strings" -) - -// UnicodeData.txt fields. -const ( - CodePoint = iota - Name - GeneralCategory - CanonicalCombiningClass - BidiClass - DecompMapping - DecimalValue - DigitValue - NumericValue - BidiMirrored - Unicode1Name - ISOComment - SimpleUppercaseMapping - SimpleLowercaseMapping - SimpleTitlecaseMapping -) - -// Parse calls f for each entry in the given reader of a UCD file. It will close -// the reader upon return. It will call log.Fatal if any error occurred. -// -// This implements the most common usage pattern of using Parser. -func Parse(r io.ReadCloser, f func(p *Parser)) { - defer r.Close() - - p := New(r) - for p.Next() { - f(p) - } - if err := p.Err(); err != nil { - r.Close() // os.Exit will cause defers not to be called. - log.Fatal(err) - } -} - -// An Option is used to configure a Parser. -type Option func(p *Parser) - -func keepRanges(p *Parser) { - p.keepRanges = true -} - -var ( - // KeepRanges prevents the expansion of ranges. The raw ranges can be - // obtained by calling Range(0) on the parser. - KeepRanges Option = keepRanges -) - -// The Part option register a handler for lines starting with a '@'. The text -// after a '@' is available as the first field. Comments are handled as usual. -func Part(f func(p *Parser)) Option { - return func(p *Parser) { - p.partHandler = f - } -} - -// The CommentHandler option passes comments that are on a line by itself to -// a given handler. -func CommentHandler(f func(s string)) Option { - return func(p *Parser) { - p.commentHandler = f - } -} - -// A Parser parses Unicode Character Database (UCD) files. -type Parser struct { - scanner *bufio.Scanner - - keepRanges bool // Don't expand rune ranges in field 0. - - err error - comment string - field []string - // parsedRange is needed in case Range(0) is called more than once for one - // field. In some cases this requires scanning ahead. - line int - parsedRange bool - rangeStart, rangeEnd rune - - partHandler func(p *Parser) - commentHandler func(s string) -} - -func (p *Parser) setError(err error, msg string) { - if p.err == nil && err != nil { - if msg == "" { - p.err = fmt.Errorf("ucd:line:%d: %v", p.line, err) - } else { - p.err = fmt.Errorf("ucd:line:%d:%s: %v", p.line, msg, err) - } - } -} - -func (p *Parser) getField(i int) string { - if i >= len(p.field) { - return "" - } - return p.field[i] -} - -// Err returns a non-nil error if any error occurred during parsing. -func (p *Parser) Err() error { - return p.err -} - -// New returns a Parser for the given Reader. -func New(r io.Reader, o ...Option) *Parser { - p := &Parser{ - scanner: bufio.NewScanner(r), - } - for _, f := range o { - f(p) - } - return p -} - -// Next parses the next line in the file. It returns true if a line was parsed -// and false if it reached the end of the file. -func (p *Parser) Next() bool { - if !p.keepRanges && p.rangeStart < p.rangeEnd { - p.rangeStart++ - return true - } - p.comment = "" - p.field = p.field[:0] - p.parsedRange = false - - for p.scanner.Scan() && p.err == nil { - p.line++ - s := p.scanner.Text() - if s == "" { - continue - } - if s[0] == '#' { - if p.commentHandler != nil { - p.commentHandler(strings.TrimSpace(s[1:])) - } - continue - } - - // Parse line - if i := strings.IndexByte(s, '#'); i != -1 { - p.comment = strings.TrimSpace(s[i+1:]) - s = s[:i] - } - if s[0] == '@' { - if p.partHandler != nil { - p.field = append(p.field, strings.TrimSpace(s[1:])) - p.partHandler(p) - p.field = p.field[:0] - } - p.comment = "" - continue - } - for { - i := strings.IndexByte(s, ';') - if i == -1 { - p.field = append(p.field, strings.TrimSpace(s)) - break - } - p.field = append(p.field, strings.TrimSpace(s[:i])) - s = s[i+1:] - } - if !p.keepRanges { - p.rangeStart, p.rangeEnd = p.getRange(0) - } - return true - } - p.setError(p.scanner.Err(), "scanner failed") - return false -} - -func parseRune(b string) (rune, error) { - if len(b) > 2 && b[0] == 'U' && b[1] == '+' { - b = b[2:] - } - x, err := strconv.ParseUint(b, 16, 32) - return rune(x), err -} - -func (p *Parser) parseRune(s string) rune { - x, err := parseRune(s) - p.setError(err, "failed to parse rune") - return x -} - -// Rune parses and returns field i as a rune. -func (p *Parser) Rune(i int) rune { - if i > 0 || p.keepRanges { - return p.parseRune(p.getField(i)) - } - return p.rangeStart -} - -// Runes interprets and returns field i as a sequence of runes. -func (p *Parser) Runes(i int) (runes []rune) { - add := func(s string) { - if s = strings.TrimSpace(s); len(s) > 0 { - runes = append(runes, p.parseRune(s)) - } - } - for b := p.getField(i); ; { - i := strings.IndexByte(b, ' ') - if i == -1 { - add(b) - break - } - add(b[:i]) - b = b[i+1:] - } - return -} - -var ( - errIncorrectLegacyRange = errors.New("ucd: unmatched <* First>") - - // reRange matches one line of a legacy rune range. - reRange = regexp.MustCompile("^([0-9A-F]*);<([^,]*), ([^>]*)>(.*)$") -) - -// Range parses and returns field i as a rune range. A range is inclusive at -// both ends. If the field only has one rune, first and last will be identical. -// It supports the legacy format for ranges used in UnicodeData.txt. -func (p *Parser) Range(i int) (first, last rune) { - if !p.keepRanges { - return p.rangeStart, p.rangeStart - } - return p.getRange(i) -} - -func (p *Parser) getRange(i int) (first, last rune) { - b := p.getField(i) - if k := strings.Index(b, ".."); k != -1 { - return p.parseRune(b[:k]), p.parseRune(b[k+2:]) - } - // The first field may not be a rune, in which case we may ignore any error - // and set the range as 0..0. - x, err := parseRune(b) - if err != nil { - // Disable range parsing henceforth. This ensures that an error will be - // returned if the user subsequently will try to parse this field as - // a Rune. - p.keepRanges = true - } - // Special case for UnicodeData that was retained for backwards compatibility. - if i == 0 && len(p.field) > 1 && strings.HasSuffix(p.field[1], "First>") { - if p.parsedRange { - return p.rangeStart, p.rangeEnd - } - mf := reRange.FindStringSubmatch(p.scanner.Text()) - p.line++ - if mf == nil || !p.scanner.Scan() { - p.setError(errIncorrectLegacyRange, "") - return x, x - } - // Using Bytes would be more efficient here, but Text is a lot easier - // and this is not a frequent case. - ml := reRange.FindStringSubmatch(p.scanner.Text()) - if ml == nil || mf[2] != ml[2] || ml[3] != "Last" || mf[4] != ml[4] { - p.setError(errIncorrectLegacyRange, "") - return x, x - } - p.rangeStart, p.rangeEnd = x, p.parseRune(p.scanner.Text()[:len(ml[1])]) - p.parsedRange = true - return p.rangeStart, p.rangeEnd - } - return x, x -} - -// bools recognizes all valid UCD boolean values. -var bools = map[string]bool{ - "": false, - "N": false, - "No": false, - "F": false, - "False": false, - "Y": true, - "Yes": true, - "T": true, - "True": true, -} - -// Bool parses and returns field i as a boolean value. -func (p *Parser) Bool(i int) bool { - f := p.getField(i) - for s, v := range bools { - if f == s { - return v - } - } - p.setError(strconv.ErrSyntax, "error parsing bool") - return false -} - -// Int parses and returns field i as an integer value. -func (p *Parser) Int(i int) int { - x, err := strconv.ParseInt(string(p.getField(i)), 10, 64) - p.setError(err, "error parsing int") - return int(x) -} - -// Uint parses and returns field i as an unsigned integer value. -func (p *Parser) Uint(i int) uint { - x, err := strconv.ParseUint(string(p.getField(i)), 10, 64) - p.setError(err, "error parsing uint") - return uint(x) -} - -// Float parses and returns field i as a decimal value. -func (p *Parser) Float(i int) float64 { - x, err := strconv.ParseFloat(string(p.getField(i)), 64) - p.setError(err, "error parsing float") - return x -} - -// String parses and returns field i as a string value. -func (p *Parser) String(i int) string { - return string(p.getField(i)) -} - -// Strings parses and returns field i as a space-separated list of strings. -func (p *Parser) Strings(i int) []string { - ss := strings.Split(string(p.getField(i)), " ") - for i, s := range ss { - ss[i] = strings.TrimSpace(s) - } - return ss -} - -// Comment returns the comments for the current line. -func (p *Parser) Comment() string { - return string(p.comment) -} - -var errUndefinedEnum = errors.New("ucd: undefined enum value") - -// Enum interprets and returns field i as a value that must be one of the values -// in enum. -func (p *Parser) Enum(i int, enum ...string) string { - f := p.getField(i) - for _, s := range enum { - if f == s { - return s - } - } - p.setError(errUndefinedEnum, "error parsing enum") - return "" -} diff --git a/vendor/golang.org/x/text/internal/ucd/ucd_test.go b/vendor/golang.org/x/text/internal/ucd/ucd_test.go deleted file mode 100644 index 11a6542e4..000000000 --- a/vendor/golang.org/x/text/internal/ucd/ucd_test.go +++ /dev/null @@ -1,105 +0,0 @@ -package ucd - -import ( - "strings" - "testing" -) - -const file = ` -# Comments should be skipped -# rune; bool; uint; int; float; runes; # Y -0..0005; Y; 0; 2; -5.25 ; 0 1 2 3 4 5; -6..0007; Yes ; 6; 1; -4.25 ; 0006 0007; -8; T ; 8 ; 0 ;-3.25 ;;# T -9; True ;9 ; -1;-2.25 ; 0009; - -# more comments to be ignored -@Part0 - -A; N; 10 ; -2; -1.25; ;# N -B; No; 11 ; -3; -0.25; -C; False;12; -4; 0.75; -D; ;13;-5;1.75; - -@Part1 # Another part. -# We test part comments get removed by not commenting the the next line. -E..10FFFF; F; 14 ; -6; 2.75; -` - -var want = []struct { - start, end rune -}{ - {0x00, 0x05}, - {0x06, 0x07}, - {0x08, 0x08}, - {0x09, 0x09}, - {0x0A, 0x0A}, - {0x0B, 0x0B}, - {0x0C, 0x0C}, - {0x0D, 0x0D}, - {0x0E, 0x10FFFF}, -} - -func TestGetters(t *testing.T) { - parts := [][2]string{ - {"Part0", ""}, - {"Part1", "Another part."}, - } - handler := func(p *Parser) { - if len(parts) == 0 { - t.Error("Part handler invoked too many times.") - return - } - want := parts[0] - parts = parts[1:] - if got0, got1 := p.String(0), p.Comment(); got0 != want[0] || got1 != want[1] { - t.Errorf(`part: got %q, %q; want %q"`, got0, got1, want) - } - } - - p := New(strings.NewReader(file), KeepRanges, Part(handler)) - for i := 0; p.Next(); i++ { - start, end := p.Range(0) - w := want[i] - if start != w.start || end != w.end { - t.Fatalf("%d:Range(0); got %#x..%#x; want %#x..%#x", i, start, end, w.start, w.end) - } - if w.start == w.end && p.Rune(0) != w.start { - t.Errorf("%d:Range(0).start: got %U; want %U", i, p.Rune(0), w.start) - } - if got, want := p.Bool(1), w.start <= 9; got != want { - t.Errorf("%d:Bool(1): got %v; want %v", i, got, want) - } - if got := p.Rune(4); got != 0 || p.Err() == nil { - t.Errorf("%d:Rune(%q): got no error; want error", i, p.String(1)) - } - p.err = nil - if got := p.Uint(2); rune(got) != start { - t.Errorf("%d:Uint(2): got %v; want %v", i, got, start) - } - if got, want := p.Int(3), 2-i; got != want { - t.Errorf("%d:Int(3): got %v; want %v", i, got, want) - } - if got, want := p.Float(4), -5.25+float64(i); got != want { - t.Errorf("%d:Int(3): got %v; want %v", i, got, want) - } - if got := p.Runes(5); got == nil { - if p.String(5) != "" { - t.Errorf("%d:Runes(5): expected non-empty list", i) - } - } else { - if got[0] != start || got[len(got)-1] != end { - t.Errorf("%d:Runes(5): got %#x; want %#x..%#x", i, got, start, end) - } - } - if got := p.Comment(); got != "" && got != p.String(1) { - t.Errorf("%d:Comment(): got %v; want %v", i, got, p.String(1)) - } - } - if err := p.Err(); err != nil { - t.Errorf("Parser error: %v", err) - } - if len(parts) != 0 { - t.Errorf("expected %d more invocations of part handler", len(parts)) - } -} diff --git a/vendor/golang.org/x/text/transform/examples_test.go b/vendor/golang.org/x/text/transform/examples_test.go deleted file mode 100644 index f2e284dba..000000000 --- a/vendor/golang.org/x/text/transform/examples_test.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package transform_test - -import ( - "fmt" - "unicode" - - "golang.org/x/text/transform" - "golang.org/x/text/unicode/norm" -) - -func ExampleRemoveFunc() { - input := []byte(`tschüß; до свидания`) - - b := make([]byte, len(input)) - - t := transform.RemoveFunc(unicode.IsSpace) - n, _, _ := t.Transform(b, input, true) - fmt.Println(string(b[:n])) - - t = transform.RemoveFunc(func(r rune) bool { - return !unicode.Is(unicode.Latin, r) - }) - n, _, _ = t.Transform(b, input, true) - fmt.Println(string(b[:n])) - - n, _, _ = t.Transform(b, norm.NFD.Bytes(input), true) - fmt.Println(string(b[:n])) - - // Output: - // tschüß;досвидания - // tschüß - // tschuß -} diff --git a/vendor/golang.org/x/text/transform/transform.go b/vendor/golang.org/x/text/transform/transform.go deleted file mode 100644 index fe47b9b35..000000000 --- a/vendor/golang.org/x/text/transform/transform.go +++ /dev/null @@ -1,705 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package transform provides reader and writer wrappers that transform the -// bytes passing through as well as various transformations. Example -// transformations provided by other packages include normalization and -// conversion between character sets. -package transform // import "golang.org/x/text/transform" - -import ( - "bytes" - "errors" - "io" - "unicode/utf8" -) - -var ( - // ErrShortDst means that the destination buffer was too short to - // receive all of the transformed bytes. - ErrShortDst = errors.New("transform: short destination buffer") - - // ErrShortSrc means that the source buffer has insufficient data to - // complete the transformation. - ErrShortSrc = errors.New("transform: short source buffer") - - // ErrEndOfSpan means that the input and output (the transformed input) - // are not identical. - ErrEndOfSpan = errors.New("transform: input and output are not identical") - - // errInconsistentByteCount means that Transform returned success (nil - // error) but also returned nSrc inconsistent with the src argument. - errInconsistentByteCount = errors.New("transform: inconsistent byte count returned") - - // errShortInternal means that an internal buffer is not large enough - // to make progress and the Transform operation must be aborted. - errShortInternal = errors.New("transform: short internal buffer") -) - -// Transformer transforms bytes. -type Transformer interface { - // Transform writes to dst the transformed bytes read from src, and - // returns the number of dst bytes written and src bytes read. The - // atEOF argument tells whether src represents the last bytes of the - // input. - // - // Callers should always process the nDst bytes produced and account - // for the nSrc bytes consumed before considering the error err. - // - // A nil error means that all of the transformed bytes (whether freshly - // transformed from src or left over from previous Transform calls) - // were written to dst. A nil error can be returned regardless of - // whether atEOF is true. If err is nil then nSrc must equal len(src); - // the converse is not necessarily true. - // - // ErrShortDst means that dst was too short to receive all of the - // transformed bytes. ErrShortSrc means that src had insufficient data - // to complete the transformation. If both conditions apply, then - // either error may be returned. Other than the error conditions listed - // here, implementations are free to report other errors that arise. - Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) - - // Reset resets the state and allows a Transformer to be reused. - Reset() -} - -// SpanningTransformer extends the Transformer interface with a Span method -// that determines how much of the input already conforms to the Transformer. -type SpanningTransformer interface { - Transformer - - // Span returns a position in src such that transforming src[:n] results in - // identical output src[:n] for these bytes. It does not necessarily return - // the largest such n. The atEOF argument tells whether src represents the - // last bytes of the input. - // - // Callers should always account for the n bytes consumed before - // considering the error err. - // - // A nil error means that all input bytes are known to be identical to the - // output produced by the Transformer. A nil error can be be returned - // regardless of whether atEOF is true. If err is nil, then then n must - // equal len(src); the converse is not necessarily true. - // - // ErrEndOfSpan means that the Transformer output may differ from the - // input after n bytes. Note that n may be len(src), meaning that the output - // would contain additional bytes after otherwise identical output. - // ErrShortSrc means that src had insufficient data to determine whether the - // remaining bytes would change. Other than the error conditions listed - // here, implementations are free to report other errors that arise. - // - // Calling Span can modify the Transformer state as a side effect. In - // effect, it does the transformation just as calling Transform would, only - // without copying to a destination buffer and only up to a point it can - // determine the input and output bytes are the same. This is obviously more - // limited than calling Transform, but can be more efficient in terms of - // copying and allocating buffers. Calls to Span and Transform may be - // interleaved. - Span(src []byte, atEOF bool) (n int, err error) -} - -// NopResetter can be embedded by implementations of Transformer to add a nop -// Reset method. -type NopResetter struct{} - -// Reset implements the Reset method of the Transformer interface. -func (NopResetter) Reset() {} - -// Reader wraps another io.Reader by transforming the bytes read. -type Reader struct { - r io.Reader - t Transformer - err error - - // dst[dst0:dst1] contains bytes that have been transformed by t but - // not yet copied out via Read. - dst []byte - dst0, dst1 int - - // src[src0:src1] contains bytes that have been read from r but not - // yet transformed through t. - src []byte - src0, src1 int - - // transformComplete is whether the transformation is complete, - // regardless of whether or not it was successful. - transformComplete bool -} - -const defaultBufSize = 4096 - -// NewReader returns a new Reader that wraps r by transforming the bytes read -// via t. It calls Reset on t. -func NewReader(r io.Reader, t Transformer) *Reader { - t.Reset() - return &Reader{ - r: r, - t: t, - dst: make([]byte, defaultBufSize), - src: make([]byte, defaultBufSize), - } -} - -// Read implements the io.Reader interface. -func (r *Reader) Read(p []byte) (int, error) { - n, err := 0, error(nil) - for { - // Copy out any transformed bytes and return the final error if we are done. - if r.dst0 != r.dst1 { - n = copy(p, r.dst[r.dst0:r.dst1]) - r.dst0 += n - if r.dst0 == r.dst1 && r.transformComplete { - return n, r.err - } - return n, nil - } else if r.transformComplete { - return 0, r.err - } - - // Try to transform some source bytes, or to flush the transformer if we - // are out of source bytes. We do this even if r.r.Read returned an error. - // As the io.Reader documentation says, "process the n > 0 bytes returned - // before considering the error". - if r.src0 != r.src1 || r.err != nil { - r.dst0 = 0 - r.dst1, n, err = r.t.Transform(r.dst, r.src[r.src0:r.src1], r.err == io.EOF) - r.src0 += n - - switch { - case err == nil: - if r.src0 != r.src1 { - r.err = errInconsistentByteCount - } - // The Transform call was successful; we are complete if we - // cannot read more bytes into src. - r.transformComplete = r.err != nil - continue - case err == ErrShortDst && (r.dst1 != 0 || n != 0): - // Make room in dst by copying out, and try again. - continue - case err == ErrShortSrc && r.src1-r.src0 != len(r.src) && r.err == nil: - // Read more bytes into src via the code below, and try again. - default: - r.transformComplete = true - // The reader error (r.err) takes precedence over the - // transformer error (err) unless r.err is nil or io.EOF. - if r.err == nil || r.err == io.EOF { - r.err = err - } - continue - } - } - - // Move any untransformed source bytes to the start of the buffer - // and read more bytes. - if r.src0 != 0 { - r.src0, r.src1 = 0, copy(r.src, r.src[r.src0:r.src1]) - } - n, r.err = r.r.Read(r.src[r.src1:]) - r.src1 += n - } -} - -// TODO: implement ReadByte (and ReadRune??). - -// Writer wraps another io.Writer by transforming the bytes read. -// The user needs to call Close to flush unwritten bytes that may -// be buffered. -type Writer struct { - w io.Writer - t Transformer - dst []byte - - // src[:n] contains bytes that have not yet passed through t. - src []byte - n int -} - -// NewWriter returns a new Writer that wraps w by transforming the bytes written -// via t. It calls Reset on t. -func NewWriter(w io.Writer, t Transformer) *Writer { - t.Reset() - return &Writer{ - w: w, - t: t, - dst: make([]byte, defaultBufSize), - src: make([]byte, defaultBufSize), - } -} - -// Write implements the io.Writer interface. If there are not enough -// bytes available to complete a Transform, the bytes will be buffered -// for the next write. Call Close to convert the remaining bytes. -func (w *Writer) Write(data []byte) (n int, err error) { - src := data - if w.n > 0 { - // Append bytes from data to the last remainder. - // TODO: limit the amount copied on first try. - n = copy(w.src[w.n:], data) - w.n += n - src = w.src[:w.n] - } - for { - nDst, nSrc, err := w.t.Transform(w.dst, src, false) - if _, werr := w.w.Write(w.dst[:nDst]); werr != nil { - return n, werr - } - src = src[nSrc:] - if w.n == 0 { - n += nSrc - } else if len(src) <= n { - // Enough bytes from w.src have been consumed. We make src point - // to data instead to reduce the copying. - w.n = 0 - n -= len(src) - src = data[n:] - if n < len(data) && (err == nil || err == ErrShortSrc) { - continue - } - } - switch err { - case ErrShortDst: - // This error is okay as long as we are making progress. - if nDst > 0 || nSrc > 0 { - continue - } - case ErrShortSrc: - if len(src) < len(w.src) { - m := copy(w.src, src) - // If w.n > 0, bytes from data were already copied to w.src and n - // was already set to the number of bytes consumed. - if w.n == 0 { - n += m - } - w.n = m - err = nil - } else if nDst > 0 || nSrc > 0 { - // Not enough buffer to store the remainder. Keep processing as - // long as there is progress. Without this case, transforms that - // require a lookahead larger than the buffer may result in an - // error. This is not something one may expect to be common in - // practice, but it may occur when buffers are set to small - // sizes during testing. - continue - } - case nil: - if w.n > 0 { - err = errInconsistentByteCount - } - } - return n, err - } -} - -// Close implements the io.Closer interface. -func (w *Writer) Close() error { - src := w.src[:w.n] - for { - nDst, nSrc, err := w.t.Transform(w.dst, src, true) - if _, werr := w.w.Write(w.dst[:nDst]); werr != nil { - return werr - } - if err != ErrShortDst { - return err - } - src = src[nSrc:] - } -} - -type nop struct{ NopResetter } - -func (nop) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { - n := copy(dst, src) - if n < len(src) { - err = ErrShortDst - } - return n, n, err -} - -func (nop) Span(src []byte, atEOF bool) (n int, err error) { - return len(src), nil -} - -type discard struct{ NopResetter } - -func (discard) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { - return 0, len(src), nil -} - -var ( - // Discard is a Transformer for which all Transform calls succeed - // by consuming all bytes and writing nothing. - Discard Transformer = discard{} - - // Nop is a SpanningTransformer that copies src to dst. - Nop SpanningTransformer = nop{} -) - -// chain is a sequence of links. A chain with N Transformers has N+1 links and -// N+1 buffers. Of those N+1 buffers, the first and last are the src and dst -// buffers given to chain.Transform and the middle N-1 buffers are intermediate -// buffers owned by the chain. The i'th link transforms bytes from the i'th -// buffer chain.link[i].b at read offset chain.link[i].p to the i+1'th buffer -// chain.link[i+1].b at write offset chain.link[i+1].n, for i in [0, N). -type chain struct { - link []link - err error - // errStart is the index at which the error occurred plus 1. Processing - // errStart at this level at the next call to Transform. As long as - // errStart > 0, chain will not consume any more source bytes. - errStart int -} - -func (c *chain) fatalError(errIndex int, err error) { - if i := errIndex + 1; i > c.errStart { - c.errStart = i - c.err = err - } -} - -type link struct { - t Transformer - // b[p:n] holds the bytes to be transformed by t. - b []byte - p int - n int -} - -func (l *link) src() []byte { - return l.b[l.p:l.n] -} - -func (l *link) dst() []byte { - return l.b[l.n:] -} - -// Chain returns a Transformer that applies t in sequence. -func Chain(t ...Transformer) Transformer { - if len(t) == 0 { - return nop{} - } - c := &chain{link: make([]link, len(t)+1)} - for i, tt := range t { - c.link[i].t = tt - } - // Allocate intermediate buffers. - b := make([][defaultBufSize]byte, len(t)-1) - for i := range b { - c.link[i+1].b = b[i][:] - } - return c -} - -// Reset resets the state of Chain. It calls Reset on all the Transformers. -func (c *chain) Reset() { - for i, l := range c.link { - if l.t != nil { - l.t.Reset() - } - c.link[i].p, c.link[i].n = 0, 0 - } -} - -// TODO: make chain use Span (is going to be fun to implement!) - -// Transform applies the transformers of c in sequence. -func (c *chain) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { - // Set up src and dst in the chain. - srcL := &c.link[0] - dstL := &c.link[len(c.link)-1] - srcL.b, srcL.p, srcL.n = src, 0, len(src) - dstL.b, dstL.n = dst, 0 - var lastFull, needProgress bool // for detecting progress - - // i is the index of the next Transformer to apply, for i in [low, high]. - // low is the lowest index for which c.link[low] may still produce bytes. - // high is the highest index for which c.link[high] has a Transformer. - // The error returned by Transform determines whether to increase or - // decrease i. We try to completely fill a buffer before converting it. - for low, i, high := c.errStart, c.errStart, len(c.link)-2; low <= i && i <= high; { - in, out := &c.link[i], &c.link[i+1] - nDst, nSrc, err0 := in.t.Transform(out.dst(), in.src(), atEOF && low == i) - out.n += nDst - in.p += nSrc - if i > 0 && in.p == in.n { - in.p, in.n = 0, 0 - } - needProgress, lastFull = lastFull, false - switch err0 { - case ErrShortDst: - // Process the destination buffer next. Return if we are already - // at the high index. - if i == high { - return dstL.n, srcL.p, ErrShortDst - } - if out.n != 0 { - i++ - // If the Transformer at the next index is not able to process any - // source bytes there is nothing that can be done to make progress - // and the bytes will remain unprocessed. lastFull is used to - // detect this and break out of the loop with a fatal error. - lastFull = true - continue - } - // The destination buffer was too small, but is completely empty. - // Return a fatal error as this transformation can never complete. - c.fatalError(i, errShortInternal) - case ErrShortSrc: - if i == 0 { - // Save ErrShortSrc in err. All other errors take precedence. - err = ErrShortSrc - break - } - // Source bytes were depleted before filling up the destination buffer. - // Verify we made some progress, move the remaining bytes to the errStart - // and try to get more source bytes. - if needProgress && nSrc == 0 || in.n-in.p == len(in.b) { - // There were not enough source bytes to proceed while the source - // buffer cannot hold any more bytes. Return a fatal error as this - // transformation can never complete. - c.fatalError(i, errShortInternal) - break - } - // in.b is an internal buffer and we can make progress. - in.p, in.n = 0, copy(in.b, in.src()) - fallthrough - case nil: - // if i == low, we have depleted the bytes at index i or any lower levels. - // In that case we increase low and i. In all other cases we decrease i to - // fetch more bytes before proceeding to the next index. - if i > low { - i-- - continue - } - default: - c.fatalError(i, err0) - } - // Exhausted level low or fatal error: increase low and continue - // to process the bytes accepted so far. - i++ - low = i - } - - // If c.errStart > 0, this means we found a fatal error. We will clear - // all upstream buffers. At this point, no more progress can be made - // downstream, as Transform would have bailed while handling ErrShortDst. - if c.errStart > 0 { - for i := 1; i < c.errStart; i++ { - c.link[i].p, c.link[i].n = 0, 0 - } - err, c.errStart, c.err = c.err, 0, nil - } - return dstL.n, srcL.p, err -} - -// Deprecated: use runes.Remove instead. -func RemoveFunc(f func(r rune) bool) Transformer { - return removeF(f) -} - -type removeF func(r rune) bool - -func (removeF) Reset() {} - -// Transform implements the Transformer interface. -func (t removeF) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { - for r, sz := rune(0), 0; len(src) > 0; src = src[sz:] { - - if r = rune(src[0]); r < utf8.RuneSelf { - sz = 1 - } else { - r, sz = utf8.DecodeRune(src) - - if sz == 1 { - // Invalid rune. - if !atEOF && !utf8.FullRune(src) { - err = ErrShortSrc - break - } - // We replace illegal bytes with RuneError. Not doing so might - // otherwise turn a sequence of invalid UTF-8 into valid UTF-8. - // The resulting byte sequence may subsequently contain runes - // for which t(r) is true that were passed unnoticed. - if !t(r) { - if nDst+3 > len(dst) { - err = ErrShortDst - break - } - nDst += copy(dst[nDst:], "\uFFFD") - } - nSrc++ - continue - } - } - - if !t(r) { - if nDst+sz > len(dst) { - err = ErrShortDst - break - } - nDst += copy(dst[nDst:], src[:sz]) - } - nSrc += sz - } - return -} - -// grow returns a new []byte that is longer than b, and copies the first n bytes -// of b to the start of the new slice. -func grow(b []byte, n int) []byte { - m := len(b) - if m <= 32 { - m = 64 - } else if m <= 256 { - m *= 2 - } else { - m += m >> 1 - } - buf := make([]byte, m) - copy(buf, b[:n]) - return buf -} - -const initialBufSize = 128 - -// String returns a string with the result of converting s[:n] using t, where -// n <= len(s). If err == nil, n will be len(s). It calls Reset on t. -func String(t Transformer, s string) (result string, n int, err error) { - t.Reset() - if s == "" { - // Fast path for the common case for empty input. Results in about a - // 86% reduction of running time for BenchmarkStringLowerEmpty. - if _, _, err := t.Transform(nil, nil, true); err == nil { - return "", 0, nil - } - } - - // Allocate only once. Note that both dst and src escape when passed to - // Transform. - buf := [2 * initialBufSize]byte{} - dst := buf[:initialBufSize:initialBufSize] - src := buf[initialBufSize : 2*initialBufSize] - - // The input string s is transformed in multiple chunks (starting with a - // chunk size of initialBufSize). nDst and nSrc are per-chunk (or - // per-Transform-call) indexes, pDst and pSrc are overall indexes. - nDst, nSrc := 0, 0 - pDst, pSrc := 0, 0 - - // pPrefix is the length of a common prefix: the first pPrefix bytes of the - // result will equal the first pPrefix bytes of s. It is not guaranteed to - // be the largest such value, but if pPrefix, len(result) and len(s) are - // all equal after the final transform (i.e. calling Transform with atEOF - // being true returned nil error) then we don't need to allocate a new - // result string. - pPrefix := 0 - for { - // Invariant: pDst == pPrefix && pSrc == pPrefix. - - n := copy(src, s[pSrc:]) - nDst, nSrc, err = t.Transform(dst, src[:n], pSrc+n == len(s)) - pDst += nDst - pSrc += nSrc - - // TODO: let transformers implement an optional Spanner interface, akin - // to norm's QuickSpan. This would even allow us to avoid any allocation. - if !bytes.Equal(dst[:nDst], src[:nSrc]) { - break - } - pPrefix = pSrc - if err == ErrShortDst { - // A buffer can only be short if a transformer modifies its input. - break - } else if err == ErrShortSrc { - if nSrc == 0 { - // No progress was made. - break - } - // Equal so far and !atEOF, so continue checking. - } else if err != nil || pPrefix == len(s) { - return string(s[:pPrefix]), pPrefix, err - } - } - // Post-condition: pDst == pPrefix + nDst && pSrc == pPrefix + nSrc. - - // We have transformed the first pSrc bytes of the input s to become pDst - // transformed bytes. Those transformed bytes are discontiguous: the first - // pPrefix of them equal s[:pPrefix] and the last nDst of them equal - // dst[:nDst]. We copy them around, into a new dst buffer if necessary, so - // that they become one contiguous slice: dst[:pDst]. - if pPrefix != 0 { - newDst := dst - if pDst > len(newDst) { - newDst = make([]byte, len(s)+nDst-nSrc) - } - copy(newDst[pPrefix:pDst], dst[:nDst]) - copy(newDst[:pPrefix], s[:pPrefix]) - dst = newDst - } - - // Prevent duplicate Transform calls with atEOF being true at the end of - // the input. Also return if we have an unrecoverable error. - if (err == nil && pSrc == len(s)) || - (err != nil && err != ErrShortDst && err != ErrShortSrc) { - return string(dst[:pDst]), pSrc, err - } - - // Transform the remaining input, growing dst and src buffers as necessary. - for { - n := copy(src, s[pSrc:]) - nDst, nSrc, err := t.Transform(dst[pDst:], src[:n], pSrc+n == len(s)) - pDst += nDst - pSrc += nSrc - - // If we got ErrShortDst or ErrShortSrc, do not grow as long as we can - // make progress. This may avoid excessive allocations. - if err == ErrShortDst { - if nDst == 0 { - dst = grow(dst, pDst) - } - } else if err == ErrShortSrc { - if nSrc == 0 { - src = grow(src, 0) - } - } else if err != nil || pSrc == len(s) { - return string(dst[:pDst]), pSrc, err - } - } -} - -// Bytes returns a new byte slice with the result of converting b[:n] using t, -// where n <= len(b). If err == nil, n will be len(b). It calls Reset on t. -func Bytes(t Transformer, b []byte) (result []byte, n int, err error) { - return doAppend(t, 0, make([]byte, len(b)), b) -} - -// Append appends the result of converting src[:n] using t to dst, where -// n <= len(src), If err == nil, n will be len(src). It calls Reset on t. -func Append(t Transformer, dst, src []byte) (result []byte, n int, err error) { - if len(dst) == cap(dst) { - n := len(src) + len(dst) // It is okay for this to be 0. - b := make([]byte, n) - dst = b[:copy(b, dst)] - } - return doAppend(t, len(dst), dst[:cap(dst)], src) -} - -func doAppend(t Transformer, pDst int, dst, src []byte) (result []byte, n int, err error) { - t.Reset() - pSrc := 0 - for { - nDst, nSrc, err := t.Transform(dst[pDst:], src[pSrc:], true) - pDst += nDst - pSrc += nSrc - if err != ErrShortDst { - return dst[:pDst], pSrc, err - } - - // Grow the destination buffer, but do not grow as long as we can make - // progress. This may avoid excessive allocations. - if nDst == 0 { - dst = grow(dst, pDst) - } - } -} diff --git a/vendor/golang.org/x/text/transform/transform_test.go b/vendor/golang.org/x/text/transform/transform_test.go deleted file mode 100644 index 771633d1d..000000000 --- a/vendor/golang.org/x/text/transform/transform_test.go +++ /dev/null @@ -1,1317 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package transform - -import ( - "bytes" - "errors" - "fmt" - "io/ioutil" - "strconv" - "strings" - "testing" - "time" - "unicode/utf8" - - "golang.org/x/text/internal/testtext" -) - -type lowerCaseASCII struct{ NopResetter } - -func (lowerCaseASCII) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { - n := len(src) - if n > len(dst) { - n, err = len(dst), ErrShortDst - } - for i, c := range src[:n] { - if 'A' <= c && c <= 'Z' { - c += 'a' - 'A' - } - dst[i] = c - } - return n, n, err -} - -// lowerCaseASCIILookahead lowercases the string and reports ErrShortSrc as long -// as the input is not atEOF. -type lowerCaseASCIILookahead struct{ NopResetter } - -func (lowerCaseASCIILookahead) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { - n := len(src) - if n > len(dst) { - n, err = len(dst), ErrShortDst - } - for i, c := range src[:n] { - if 'A' <= c && c <= 'Z' { - c += 'a' - 'A' - } - dst[i] = c - } - if !atEOF { - err = ErrShortSrc - } - return n, n, err -} - -var errYouMentionedX = errors.New("you mentioned X") - -type dontMentionX struct{ NopResetter } - -func (dontMentionX) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { - n := len(src) - if n > len(dst) { - n, err = len(dst), ErrShortDst - } - for i, c := range src[:n] { - if c == 'X' { - return i, i, errYouMentionedX - } - dst[i] = c - } - return n, n, err -} - -var errAtEnd = errors.New("error after all text") - -type errorAtEnd struct{ NopResetter } - -func (errorAtEnd) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { - n := copy(dst, src) - if n < len(src) { - return n, n, ErrShortDst - } - if atEOF { - return n, n, errAtEnd - } - return n, n, nil -} - -type replaceWithConstant struct { - replacement string - written int -} - -func (t *replaceWithConstant) Reset() { - t.written = 0 -} - -func (t *replaceWithConstant) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { - if atEOF { - nDst = copy(dst, t.replacement[t.written:]) - t.written += nDst - if t.written < len(t.replacement) { - err = ErrShortDst - } - } - return nDst, len(src), err -} - -type addAnXAtTheEnd struct{ NopResetter } - -func (addAnXAtTheEnd) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { - n := copy(dst, src) - if n < len(src) { - return n, n, ErrShortDst - } - if !atEOF { - return n, n, nil - } - if len(dst) == n { - return n, n, ErrShortDst - } - dst[n] = 'X' - return n + 1, n, nil -} - -// doublerAtEOF is a strange Transformer that transforms "this" to "tthhiiss", -// but only if atEOF is true. -type doublerAtEOF struct{ NopResetter } - -func (doublerAtEOF) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { - if !atEOF { - return 0, 0, ErrShortSrc - } - for i, c := range src { - if 2*i+2 >= len(dst) { - return 2 * i, i, ErrShortDst - } - dst[2*i+0] = c - dst[2*i+1] = c - } - return 2 * len(src), len(src), nil -} - -// rleDecode and rleEncode implement a toy run-length encoding: "aabbbbbbbbbb" -// is encoded as "2a10b". The decoding is assumed to not contain any numbers. - -type rleDecode struct{ NopResetter } - -func (rleDecode) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { -loop: - for len(src) > 0 { - n := 0 - for i, c := range src { - if '0' <= c && c <= '9' { - n = 10*n + int(c-'0') - continue - } - if i == 0 { - return nDst, nSrc, errors.New("rleDecode: bad input") - } - if n > len(dst) { - return nDst, nSrc, ErrShortDst - } - for j := 0; j < n; j++ { - dst[j] = c - } - dst, src = dst[n:], src[i+1:] - nDst, nSrc = nDst+n, nSrc+i+1 - continue loop - } - if atEOF { - return nDst, nSrc, errors.New("rleDecode: bad input") - } - return nDst, nSrc, ErrShortSrc - } - return nDst, nSrc, nil -} - -type rleEncode struct { - NopResetter - - // allowStutter means that "xxxxxxxx" can be encoded as "5x3x" - // instead of always as "8x". - allowStutter bool -} - -func (e rleEncode) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { - for len(src) > 0 { - n, c0 := len(src), src[0] - for i, c := range src[1:] { - if c != c0 { - n = i + 1 - break - } - } - if n == len(src) && !atEOF && !e.allowStutter { - return nDst, nSrc, ErrShortSrc - } - s := strconv.Itoa(n) - if len(s) >= len(dst) { - return nDst, nSrc, ErrShortDst - } - copy(dst, s) - dst[len(s)] = c0 - dst, src = dst[len(s)+1:], src[n:] - nDst, nSrc = nDst+len(s)+1, nSrc+n - } - return nDst, nSrc, nil -} - -// trickler consumes all input bytes, but writes a single byte at a time to dst. -type trickler []byte - -func (t *trickler) Reset() { - *t = nil -} - -func (t *trickler) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { - *t = append(*t, src...) - if len(*t) == 0 { - return 0, 0, nil - } - if len(dst) == 0 { - return 0, len(src), ErrShortDst - } - dst[0] = (*t)[0] - *t = (*t)[1:] - if len(*t) > 0 { - err = ErrShortDst - } - return 1, len(src), err -} - -// delayedTrickler is like trickler, but delays writing output to dst. This is -// highly unlikely to be relevant in practice, but it seems like a good idea -// to have some tolerance as long as progress can be detected. -type delayedTrickler []byte - -func (t *delayedTrickler) Reset() { - *t = nil -} - -func (t *delayedTrickler) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error) { - if len(*t) > 0 && len(dst) > 0 { - dst[0] = (*t)[0] - *t = (*t)[1:] - nDst = 1 - } - *t = append(*t, src...) - if len(*t) > 0 { - err = ErrShortDst - } - return nDst, len(src), err -} - -type testCase struct { - desc string - t Transformer - src string - dstSize int - srcSize int - ioSize int - wantStr string - wantErr error - wantIter int // number of iterations taken; 0 means we don't care. -} - -func (t testCase) String() string { - return tstr(t.t) + "; " + t.desc -} - -func tstr(t Transformer) string { - if stringer, ok := t.(fmt.Stringer); ok { - return stringer.String() - } - s := fmt.Sprintf("%T", t) - return s[1+strings.Index(s, "."):] -} - -func (c chain) String() string { - buf := &bytes.Buffer{} - buf.WriteString("Chain(") - for i, l := range c.link[:len(c.link)-1] { - if i != 0 { - fmt.Fprint(buf, ", ") - } - buf.WriteString(tstr(l.t)) - } - buf.WriteString(")") - return buf.String() -} - -var testCases = []testCase{ - { - desc: "empty", - t: lowerCaseASCII{}, - src: "", - dstSize: 100, - srcSize: 100, - wantStr: "", - }, - - { - desc: "basic", - t: lowerCaseASCII{}, - src: "Hello WORLD.", - dstSize: 100, - srcSize: 100, - wantStr: "hello world.", - }, - - { - desc: "small dst", - t: lowerCaseASCII{}, - src: "Hello WORLD.", - dstSize: 3, - srcSize: 100, - wantStr: "hello world.", - }, - - { - desc: "small src", - t: lowerCaseASCII{}, - src: "Hello WORLD.", - dstSize: 100, - srcSize: 4, - wantStr: "hello world.", - }, - - { - desc: "small buffers", - t: lowerCaseASCII{}, - src: "Hello WORLD.", - dstSize: 3, - srcSize: 4, - wantStr: "hello world.", - }, - - { - desc: "very small buffers", - t: lowerCaseASCII{}, - src: "Hello WORLD.", - dstSize: 1, - srcSize: 1, - wantStr: "hello world.", - }, - - { - desc: "small dst with lookahead", - t: lowerCaseASCIILookahead{}, - src: "Hello WORLD.", - dstSize: 3, - srcSize: 100, - wantStr: "hello world.", - }, - - { - desc: "small src with lookahead", - t: lowerCaseASCIILookahead{}, - src: "Hello WORLD.", - dstSize: 100, - srcSize: 4, - wantStr: "hello world.", - }, - - { - desc: "small buffers with lookahead", - t: lowerCaseASCIILookahead{}, - src: "Hello WORLD.", - dstSize: 3, - srcSize: 4, - wantStr: "hello world.", - }, - - { - desc: "very small buffers with lookahead", - t: lowerCaseASCIILookahead{}, - src: "Hello WORLD.", - dstSize: 1, - srcSize: 2, - wantStr: "hello world.", - }, - - { - desc: "user error", - t: dontMentionX{}, - src: "The First Rule of Transform Club: don't mention Mister X, ever.", - dstSize: 100, - srcSize: 100, - wantStr: "The First Rule of Transform Club: don't mention Mister ", - wantErr: errYouMentionedX, - }, - - { - desc: "user error at end", - t: errorAtEnd{}, - src: "All goes well until it doesn't.", - dstSize: 100, - srcSize: 100, - wantStr: "All goes well until it doesn't.", - wantErr: errAtEnd, - }, - - { - desc: "user error at end, incremental", - t: errorAtEnd{}, - src: "All goes well until it doesn't.", - dstSize: 10, - srcSize: 10, - wantStr: "All goes well until it doesn't.", - wantErr: errAtEnd, - }, - - { - desc: "replace entire non-empty string with one byte", - t: &replaceWithConstant{replacement: "X"}, - src: "none of this will be copied", - dstSize: 1, - srcSize: 10, - wantStr: "X", - }, - - { - desc: "replace entire empty string with one byte", - t: &replaceWithConstant{replacement: "X"}, - src: "", - dstSize: 1, - srcSize: 10, - wantStr: "X", - }, - - { - desc: "replace entire empty string with seven bytes", - t: &replaceWithConstant{replacement: "ABCDEFG"}, - src: "", - dstSize: 3, - srcSize: 10, - wantStr: "ABCDEFG", - }, - - { - desc: "add an X (initialBufSize-1)", - t: addAnXAtTheEnd{}, - src: aaa[:initialBufSize-1], - dstSize: 10, - srcSize: 10, - wantStr: aaa[:initialBufSize-1] + "X", - }, - - { - desc: "add an X (initialBufSize+0)", - t: addAnXAtTheEnd{}, - src: aaa[:initialBufSize+0], - dstSize: 10, - srcSize: 10, - wantStr: aaa[:initialBufSize+0] + "X", - }, - - { - desc: "add an X (initialBufSize+1)", - t: addAnXAtTheEnd{}, - src: aaa[:initialBufSize+1], - dstSize: 10, - srcSize: 10, - wantStr: aaa[:initialBufSize+1] + "X", - }, - - { - desc: "small buffers", - t: dontMentionX{}, - src: "The First Rule of Transform Club: don't mention Mister X, ever.", - dstSize: 10, - srcSize: 10, - wantStr: "The First Rule of Transform Club: don't mention Mister ", - wantErr: errYouMentionedX, - }, - - { - desc: "very small buffers", - t: dontMentionX{}, - src: "The First Rule of Transform Club: don't mention Mister X, ever.", - dstSize: 1, - srcSize: 1, - wantStr: "The First Rule of Transform Club: don't mention Mister ", - wantErr: errYouMentionedX, - }, - - { - desc: "only transform at EOF", - t: doublerAtEOF{}, - src: "this", - dstSize: 100, - srcSize: 100, - wantStr: "tthhiiss", - }, - - { - desc: "basic", - t: rleDecode{}, - src: "1a2b3c10d11e0f1g", - dstSize: 100, - srcSize: 100, - wantStr: "abbcccddddddddddeeeeeeeeeeeg", - }, - - { - desc: "long", - t: rleDecode{}, - src: "12a23b34c45d56e99z", - dstSize: 100, - srcSize: 100, - wantStr: strings.Repeat("a", 12) + - strings.Repeat("b", 23) + - strings.Repeat("c", 34) + - strings.Repeat("d", 45) + - strings.Repeat("e", 56) + - strings.Repeat("z", 99), - }, - - { - desc: "tight buffers", - t: rleDecode{}, - src: "1a2b3c10d11e0f1g", - dstSize: 11, - srcSize: 3, - wantStr: "abbcccddddddddddeeeeeeeeeeeg", - }, - - { - desc: "short dst", - t: rleDecode{}, - src: "1a2b3c10d11e0f1g", - dstSize: 10, - srcSize: 3, - wantStr: "abbcccdddddddddd", - wantErr: ErrShortDst, - }, - - { - desc: "short src", - t: rleDecode{}, - src: "1a2b3c10d11e0f1g", - dstSize: 11, - srcSize: 2, - ioSize: 2, - wantStr: "abbccc", - wantErr: ErrShortSrc, - }, - - { - desc: "basic", - t: rleEncode{}, - src: "abbcccddddddddddeeeeeeeeeeeg", - dstSize: 100, - srcSize: 100, - wantStr: "1a2b3c10d11e1g", - }, - - { - desc: "long", - t: rleEncode{}, - src: strings.Repeat("a", 12) + - strings.Repeat("b", 23) + - strings.Repeat("c", 34) + - strings.Repeat("d", 45) + - strings.Repeat("e", 56) + - strings.Repeat("z", 99), - dstSize: 100, - srcSize: 100, - wantStr: "12a23b34c45d56e99z", - }, - - { - desc: "tight buffers", - t: rleEncode{}, - src: "abbcccddddddddddeeeeeeeeeeeg", - dstSize: 3, - srcSize: 12, - wantStr: "1a2b3c10d11e1g", - }, - - { - desc: "short dst", - t: rleEncode{}, - src: "abbcccddddddddddeeeeeeeeeeeg", - dstSize: 2, - srcSize: 12, - wantStr: "1a2b3c", - wantErr: ErrShortDst, - }, - - { - desc: "short src", - t: rleEncode{}, - src: "abbcccddddddddddeeeeeeeeeeeg", - dstSize: 3, - srcSize: 11, - ioSize: 11, - wantStr: "1a2b3c10d", - wantErr: ErrShortSrc, - }, - - { - desc: "allowStutter = false", - t: rleEncode{allowStutter: false}, - src: "aaaabbbbbbbbccccddddd", - dstSize: 10, - srcSize: 10, - wantStr: "4a8b4c5d", - }, - - { - desc: "allowStutter = true", - t: rleEncode{allowStutter: true}, - src: "aaaabbbbbbbbccccddddd", - dstSize: 10, - srcSize: 10, - ioSize: 10, - wantStr: "4a6b2b4c4d1d", - }, - - { - desc: "trickler", - t: &trickler{}, - src: "abcdefghijklm", - dstSize: 3, - srcSize: 15, - wantStr: "abcdefghijklm", - }, - - { - desc: "delayedTrickler", - t: &delayedTrickler{}, - src: "abcdefghijklm", - dstSize: 3, - srcSize: 15, - wantStr: "abcdefghijklm", - }, -} - -func TestReader(t *testing.T) { - for _, tc := range testCases { - testtext.Run(t, tc.desc, func(t *testing.T) { - r := NewReader(strings.NewReader(tc.src), tc.t) - // Differently sized dst and src buffers are not part of the - // exported API. We override them manually. - r.dst = make([]byte, tc.dstSize) - r.src = make([]byte, tc.srcSize) - got, err := ioutil.ReadAll(r) - str := string(got) - if str != tc.wantStr || err != tc.wantErr { - t.Errorf("\ngot %q, %v\nwant %q, %v", str, err, tc.wantStr, tc.wantErr) - } - }) - } -} - -func TestWriter(t *testing.T) { - tests := append(testCases, chainTests()...) - for _, tc := range tests { - sizes := []int{1, 2, 3, 4, 5, 10, 100, 1000} - if tc.ioSize > 0 { - sizes = []int{tc.ioSize} - } - for _, sz := range sizes { - testtext.Run(t, fmt.Sprintf("%s/%d", tc.desc, sz), func(t *testing.T) { - bb := &bytes.Buffer{} - w := NewWriter(bb, tc.t) - // Differently sized dst and src buffers are not part of the - // exported API. We override them manually. - w.dst = make([]byte, tc.dstSize) - w.src = make([]byte, tc.srcSize) - src := make([]byte, sz) - var err error - for b := tc.src; len(b) > 0 && err == nil; { - n := copy(src, b) - b = b[n:] - m := 0 - m, err = w.Write(src[:n]) - if m != n && err == nil { - t.Errorf("did not consume all bytes %d < %d", m, n) - } - } - if err == nil { - err = w.Close() - } - str := bb.String() - if str != tc.wantStr || err != tc.wantErr { - t.Errorf("\ngot %q, %v\nwant %q, %v", str, err, tc.wantStr, tc.wantErr) - } - }) - } - } -} - -func TestNop(t *testing.T) { - testCases := []struct { - str string - dstSize int - err error - }{ - {"", 0, nil}, - {"", 10, nil}, - {"a", 0, ErrShortDst}, - {"a", 1, nil}, - {"a", 10, nil}, - } - for i, tc := range testCases { - dst := make([]byte, tc.dstSize) - nDst, nSrc, err := Nop.Transform(dst, []byte(tc.str), true) - want := tc.str - if tc.dstSize < len(want) { - want = want[:tc.dstSize] - } - if got := string(dst[:nDst]); got != want || err != tc.err || nSrc != nDst { - t.Errorf("%d:\ngot %q, %d, %v\nwant %q, %d, %v", i, got, nSrc, err, want, nDst, tc.err) - } - } -} - -func TestDiscard(t *testing.T) { - testCases := []struct { - str string - dstSize int - }{ - {"", 0}, - {"", 10}, - {"a", 0}, - {"ab", 10}, - } - for i, tc := range testCases { - nDst, nSrc, err := Discard.Transform(make([]byte, tc.dstSize), []byte(tc.str), true) - if nDst != 0 || nSrc != len(tc.str) || err != nil { - t.Errorf("%d:\ngot %q, %d, %v\nwant 0, %d, nil", i, nDst, nSrc, err, len(tc.str)) - } - } -} - -// mkChain creates a Chain transformer. x must be alternating between transformer -// and bufSize, like T, (sz, T)* -func mkChain(x ...interface{}) *chain { - t := []Transformer{} - for i := 0; i < len(x); i += 2 { - t = append(t, x[i].(Transformer)) - } - c := Chain(t...).(*chain) - for i, j := 1, 1; i < len(x); i, j = i+2, j+1 { - c.link[j].b = make([]byte, x[i].(int)) - } - return c -} - -func chainTests() []testCase { - return []testCase{ - { - desc: "nil error", - t: mkChain(rleEncode{}, 100, lowerCaseASCII{}), - src: "ABB", - dstSize: 100, - srcSize: 100, - wantStr: "1a2b", - wantErr: nil, - wantIter: 1, - }, - - { - desc: "short dst buffer", - t: mkChain(lowerCaseASCII{}, 3, rleDecode{}), - src: "1a2b3c10d11e0f1g", - dstSize: 10, - srcSize: 3, - wantStr: "abbcccdddddddddd", - wantErr: ErrShortDst, - }, - - { - desc: "short internal dst buffer", - t: mkChain(lowerCaseASCII{}, 3, rleDecode{}, 10, Nop), - src: "1a2b3c10d11e0f1g", - dstSize: 100, - srcSize: 3, - wantStr: "abbcccdddddddddd", - wantErr: errShortInternal, - }, - - { - desc: "short internal dst buffer from input", - t: mkChain(rleDecode{}, 10, Nop), - src: "1a2b3c10d11e0f1g", - dstSize: 100, - srcSize: 3, - wantStr: "abbcccdddddddddd", - wantErr: errShortInternal, - }, - - { - desc: "empty short internal dst buffer", - t: mkChain(lowerCaseASCII{}, 3, rleDecode{}, 10, Nop), - src: "4a7b11e0f1g", - dstSize: 100, - srcSize: 3, - wantStr: "aaaabbbbbbb", - wantErr: errShortInternal, - }, - - { - desc: "empty short internal dst buffer from input", - t: mkChain(rleDecode{}, 10, Nop), - src: "4a7b11e0f1g", - dstSize: 100, - srcSize: 3, - wantStr: "aaaabbbbbbb", - wantErr: errShortInternal, - }, - - { - desc: "short internal src buffer after full dst buffer", - t: mkChain(Nop, 5, rleEncode{}, 10, Nop), - src: "cccccddddd", - dstSize: 100, - srcSize: 100, - wantStr: "", - wantErr: errShortInternal, - wantIter: 1, - }, - - { - desc: "short internal src buffer after short dst buffer; test lastFull", - t: mkChain(rleDecode{}, 5, rleEncode{}, 4, Nop), - src: "2a1b4c6d", - dstSize: 100, - srcSize: 100, - wantStr: "2a1b", - wantErr: errShortInternal, - }, - - { - desc: "short internal src buffer after successful complete fill", - t: mkChain(Nop, 3, rleDecode{}), - src: "123a4b", - dstSize: 4, - srcSize: 3, - wantStr: "", - wantErr: errShortInternal, - wantIter: 1, - }, - - { - desc: "short internal src buffer after short dst buffer; test lastFull", - t: mkChain(rleDecode{}, 5, rleEncode{}), - src: "2a1b4c6d", - dstSize: 4, - srcSize: 100, - wantStr: "2a1b", - wantErr: errShortInternal, - }, - - { - desc: "short src buffer", - t: mkChain(rleEncode{}, 5, Nop), - src: "abbcccddddeeeee", - dstSize: 4, - srcSize: 4, - ioSize: 4, - wantStr: "1a2b3c", - wantErr: ErrShortSrc, - }, - - { - desc: "process all in one go", - t: mkChain(rleEncode{}, 5, Nop), - src: "abbcccddddeeeeeffffff", - dstSize: 100, - srcSize: 100, - wantStr: "1a2b3c4d5e6f", - wantErr: nil, - wantIter: 1, - }, - - { - desc: "complete processing downstream after error", - t: mkChain(dontMentionX{}, 2, rleDecode{}, 5, Nop), - src: "3a4b5eX", - dstSize: 100, - srcSize: 100, - ioSize: 100, - wantStr: "aaabbbbeeeee", - wantErr: errYouMentionedX, - }, - - { - desc: "return downstream fatal errors first (followed by short dst)", - t: mkChain(dontMentionX{}, 8, rleDecode{}, 4, Nop), - src: "3a4b5eX", - dstSize: 100, - srcSize: 100, - ioSize: 100, - wantStr: "aaabbbb", - wantErr: errShortInternal, - }, - - { - desc: "return downstream fatal errors first (followed by short src)", - t: mkChain(dontMentionX{}, 5, Nop, 1, rleDecode{}), - src: "1a5bX", - dstSize: 100, - srcSize: 100, - ioSize: 100, - wantStr: "", - wantErr: errShortInternal, - }, - - { - desc: "short internal", - t: mkChain(Nop, 11, rleEncode{}, 3, Nop), - src: "abbcccddddddddddeeeeeeeeeeeg", - dstSize: 3, - srcSize: 100, - wantStr: "1a2b3c10d", - wantErr: errShortInternal, - }, - } -} - -func doTransform(tc testCase) (res string, iter int, err error) { - tc.t.Reset() - dst := make([]byte, tc.dstSize) - out, in := make([]byte, 0, 2*len(tc.src)), []byte(tc.src) - for { - iter++ - src, atEOF := in, true - if len(src) > tc.srcSize { - src, atEOF = src[:tc.srcSize], false - } - nDst, nSrc, err := tc.t.Transform(dst, src, atEOF) - out = append(out, dst[:nDst]...) - in = in[nSrc:] - switch { - case err == nil && len(in) != 0: - case err == ErrShortSrc && nSrc > 0: - case err == ErrShortDst && (nDst > 0 || nSrc > 0): - default: - return string(out), iter, err - } - } -} - -func TestChain(t *testing.T) { - if c, ok := Chain().(nop); !ok { - t.Errorf("empty chain: %v; want Nop", c) - } - - // Test Chain for a single Transformer. - for _, tc := range testCases { - tc.t = Chain(tc.t) - str, _, err := doTransform(tc) - if str != tc.wantStr || err != tc.wantErr { - t.Errorf("%s:\ngot %q, %v\nwant %q, %v", tc, str, err, tc.wantStr, tc.wantErr) - } - } - - tests := chainTests() - sizes := []int{1, 2, 3, 4, 5, 7, 10, 100, 1000} - addTest := func(tc testCase, t *chain) { - if t.link[0].t != tc.t && tc.wantErr == ErrShortSrc { - tc.wantErr = errShortInternal - } - if t.link[len(t.link)-2].t != tc.t && tc.wantErr == ErrShortDst { - tc.wantErr = errShortInternal - } - tc.t = t - tests = append(tests, tc) - } - for _, tc := range testCases { - for _, sz := range sizes { - tt := tc - tt.dstSize = sz - addTest(tt, mkChain(tc.t, tc.dstSize, Nop)) - addTest(tt, mkChain(tc.t, tc.dstSize, Nop, 2, Nop)) - addTest(tt, mkChain(Nop, tc.srcSize, tc.t, tc.dstSize, Nop)) - if sz >= tc.dstSize && (tc.wantErr != ErrShortDst || sz == tc.dstSize) { - addTest(tt, mkChain(Nop, tc.srcSize, tc.t)) - addTest(tt, mkChain(Nop, 100, Nop, tc.srcSize, tc.t)) - } - } - } - for _, tc := range testCases { - tt := tc - tt.dstSize = 1 - tt.wantStr = "" - addTest(tt, mkChain(tc.t, tc.dstSize, Discard)) - addTest(tt, mkChain(Nop, tc.srcSize, tc.t, tc.dstSize, Discard)) - addTest(tt, mkChain(Nop, tc.srcSize, tc.t, tc.dstSize, Nop, tc.dstSize, Discard)) - } - for _, tc := range testCases { - tt := tc - tt.dstSize = 100 - tt.wantStr = strings.Replace(tc.src, "0f", "", -1) - // Chain encoders and decoders. - if _, ok := tc.t.(rleEncode); ok && tc.wantErr == nil { - addTest(tt, mkChain(tc.t, tc.dstSize, Nop, 1000, rleDecode{})) - addTest(tt, mkChain(tc.t, tc.dstSize, Nop, tc.dstSize, rleDecode{})) - addTest(tt, mkChain(Nop, tc.srcSize, tc.t, tc.dstSize, Nop, 100, rleDecode{})) - // decoding needs larger destinations - addTest(tt, mkChain(Nop, tc.srcSize, tc.t, tc.dstSize, rleDecode{}, 100, Nop)) - addTest(tt, mkChain(Nop, tc.srcSize, tc.t, tc.dstSize, Nop, 100, rleDecode{}, 100, Nop)) - } else if _, ok := tc.t.(rleDecode); ok && tc.wantErr == nil { - // The internal buffer size may need to be the sum of the maximum segment - // size of the two encoders! - addTest(tt, mkChain(tc.t, 2*tc.dstSize, rleEncode{})) - addTest(tt, mkChain(tc.t, tc.dstSize, Nop, 101, rleEncode{})) - addTest(tt, mkChain(Nop, tc.srcSize, tc.t, tc.dstSize, Nop, 100, rleEncode{})) - addTest(tt, mkChain(Nop, tc.srcSize, tc.t, tc.dstSize, Nop, 200, rleEncode{}, 100, Nop)) - } - } - for _, tc := range tests { - str, iter, err := doTransform(tc) - mi := tc.wantIter != 0 && tc.wantIter != iter - if str != tc.wantStr || err != tc.wantErr || mi { - t.Errorf("%s:\ngot iter:%d, %q, %v\nwant iter:%d, %q, %v", tc, iter, str, err, tc.wantIter, tc.wantStr, tc.wantErr) - } - break - } -} - -func TestRemoveFunc(t *testing.T) { - filter := RemoveFunc(func(r rune) bool { - return strings.IndexRune("ab\u0300\u1234,", r) != -1 - }) - tests := []testCase{ - { - src: ",", - wantStr: "", - }, - - { - src: "c", - wantStr: "c", - }, - - { - src: "\u2345", - wantStr: "\u2345", - }, - - { - src: "tschüß", - wantStr: "tschüß", - }, - - { - src: ",до,свидания,", - wantStr: "досвидания", - }, - - { - src: "a\xbd\xb2=\xbc ⌘", - wantStr: "\uFFFD\uFFFD=\uFFFD ⌘", - }, - - { - // If we didn't replace illegal bytes with RuneError, the result - // would be \u0300 or the code would need to be more complex. - src: "\xcc\u0300\x80", - wantStr: "\uFFFD\uFFFD", - }, - - { - src: "\xcc\u0300\x80", - dstSize: 3, - wantStr: "\uFFFD\uFFFD", - wantIter: 2, - }, - - { - // Test a long buffer greater than the internal buffer size - src: "hello\xcc\xcc\xccworld", - srcSize: 13, - wantStr: "hello\uFFFD\uFFFD\uFFFDworld", - wantIter: 1, - }, - - { - src: "\u2345", - dstSize: 2, - wantStr: "", - wantErr: ErrShortDst, - }, - - { - src: "\xcc", - dstSize: 2, - wantStr: "", - wantErr: ErrShortDst, - }, - - { - src: "\u0300", - dstSize: 2, - srcSize: 1, - wantStr: "", - wantErr: ErrShortSrc, - }, - - { - t: RemoveFunc(func(r rune) bool { - return r == utf8.RuneError - }), - src: "\xcc\u0300\x80", - wantStr: "\u0300", - }, - } - - for _, tc := range tests { - tc.desc = tc.src - if tc.t == nil { - tc.t = filter - } - if tc.dstSize == 0 { - tc.dstSize = 100 - } - if tc.srcSize == 0 { - tc.srcSize = 100 - } - str, iter, err := doTransform(tc) - mi := tc.wantIter != 0 && tc.wantIter != iter - if str != tc.wantStr || err != tc.wantErr || mi { - t.Errorf("%+q:\ngot iter:%d, %+q, %v\nwant iter:%d, %+q, %v", tc.src, iter, str, err, tc.wantIter, tc.wantStr, tc.wantErr) - } - - tc.src = str - idem, _, _ := doTransform(tc) - if str != idem { - t.Errorf("%+q: found %+q; want %+q", tc.src, idem, str) - } - } -} - -func testString(t *testing.T, f func(Transformer, string) (string, int, error)) { - for _, tt := range append(testCases, chainTests()...) { - if tt.desc == "allowStutter = true" { - // We don't have control over the buffer size, so we eliminate tests - // that depend on a specific buffer size being set. - continue - } - if tt.wantErr == ErrShortDst || tt.wantErr == ErrShortSrc { - // The result string will be different. - continue - } - testtext.Run(t, tt.desc, func(t *testing.T) { - got, n, err := f(tt.t, tt.src) - if tt.wantErr != err { - t.Errorf("error: got %v; want %v", err, tt.wantErr) - } - // Check that err == nil implies that n == len(tt.src). Note that vice - // versa isn't necessarily true. - if err == nil && n != len(tt.src) { - t.Errorf("err == nil: got %d bytes, want %d", n, err) - } - if got != tt.wantStr { - t.Errorf("string: got %q; want %q", got, tt.wantStr) - } - }) - } -} - -func TestBytes(t *testing.T) { - testString(t, func(z Transformer, s string) (string, int, error) { - b, n, err := Bytes(z, []byte(s)) - return string(b), n, err - }) -} - -func TestAppend(t *testing.T) { - // Create a bunch of subtests for different buffer sizes. - testCases := [][]byte{ - nil, - make([]byte, 0, 0), - make([]byte, 0, 1), - make([]byte, 1, 1), - make([]byte, 1, 5), - make([]byte, 100, 100), - make([]byte, 100, 200), - } - for _, tc := range testCases { - testString(t, func(z Transformer, s string) (string, int, error) { - b, n, err := Append(z, tc, []byte(s)) - return string(b[len(tc):]), n, err - }) - } -} - -func TestString(t *testing.T) { - testtext.Run(t, "transform", func(t *testing.T) { testString(t, String) }) - - // Overrun the internal destination buffer. - for i, s := range []string{ - aaa[:1*initialBufSize-1], - aaa[:1*initialBufSize+0], - aaa[:1*initialBufSize+1], - AAA[:1*initialBufSize-1], - AAA[:1*initialBufSize+0], - AAA[:1*initialBufSize+1], - AAA[:2*initialBufSize-1], - AAA[:2*initialBufSize+0], - AAA[:2*initialBufSize+1], - aaa[:1*initialBufSize-2] + "A", - aaa[:1*initialBufSize-1] + "A", - aaa[:1*initialBufSize+0] + "A", - aaa[:1*initialBufSize+1] + "A", - } { - testtext.Run(t, fmt.Sprint("dst buffer test using lower/", i), func(t *testing.T) { - got, _, _ := String(lowerCaseASCII{}, s) - if want := strings.ToLower(s); got != want { - t.Errorf("got %s (%d); want %s (%d)", got, len(got), want, len(want)) - } - }) - } - - // Overrun the internal source buffer. - for i, s := range []string{ - aaa[:1*initialBufSize-1], - aaa[:1*initialBufSize+0], - aaa[:1*initialBufSize+1], - aaa[:2*initialBufSize+1], - aaa[:2*initialBufSize+0], - aaa[:2*initialBufSize+1], - } { - testtext.Run(t, fmt.Sprint("src buffer test using rleEncode/", i), func(t *testing.T) { - got, _, _ := String(rleEncode{}, s) - if want := fmt.Sprintf("%da", len(s)); got != want { - t.Errorf("got %s (%d); want %s (%d)", got, len(got), want, len(want)) - } - }) - } - - // Test allocations for non-changing strings. - // Note we still need to allocate a single buffer. - for i, s := range []string{ - "", - "123456789", - aaa[:initialBufSize-1], - aaa[:initialBufSize+0], - aaa[:initialBufSize+1], - aaa[:10*initialBufSize], - } { - testtext.Run(t, fmt.Sprint("alloc/", i), func(t *testing.T) { - if n := testtext.AllocsPerRun(5, func() { String(&lowerCaseASCIILookahead{}, s) }); n > 1 { - t.Errorf("#allocs was %f; want 1", n) - } - }) - } -} - -// TestBytesAllocation tests that buffer growth stays limited with the trickler -// transformer, which behaves oddly but within spec. In case buffer growth is -// not correctly handled, the test will either panic with a failed allocation or -// thrash. To ensure the tests terminate under the last condition, we time out -// after some sufficiently long period of time. -func TestBytesAllocation(t *testing.T) { - done := make(chan bool) - go func() { - in := bytes.Repeat([]byte{'a'}, 1000) - tr := trickler(make([]byte, 1)) - Bytes(&tr, in) - done <- true - }() - select { - case <-done: - case <-time.After(3 * time.Second): - t.Error("time out, likely due to excessive allocation") - } -} - -// TestStringAllocation tests that buffer growth stays limited with the trickler -// transformer, which behaves oddly but within spec. In case buffer growth is -// not correctly handled, the test will either panic with a failed allocation or -// thrash. To ensure the tests terminate under the last condition, we time out -// after some sufficiently long period of time. -func TestStringAllocation(t *testing.T) { - done := make(chan bool) - go func() { - tr := trickler(make([]byte, 1)) - String(&tr, aaa[:1000]) - done <- true - }() - select { - case <-done: - case <-time.After(3 * time.Second): - t.Error("time out, likely due to excessive allocation") - } -} - -func BenchmarkStringLowerEmpty(b *testing.B) { - for i := 0; i < b.N; i++ { - String(&lowerCaseASCIILookahead{}, "") - } -} - -func BenchmarkStringLowerIdentical(b *testing.B) { - for i := 0; i < b.N; i++ { - String(&lowerCaseASCIILookahead{}, aaa[:4096]) - } -} - -func BenchmarkStringLowerChanged(b *testing.B) { - for i := 0; i < b.N; i++ { - String(&lowerCaseASCIILookahead{}, AAA[:4096]) - } -} - -var ( - aaa = strings.Repeat("a", 4096) - AAA = strings.Repeat("A", 4096) -) diff --git a/vendor/golang.org/x/text/unicode/cldr/base.go b/vendor/golang.org/x/text/unicode/cldr/base.go deleted file mode 100644 index 63cdc16c6..000000000 --- a/vendor/golang.org/x/text/unicode/cldr/base.go +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cldr - -import ( - "encoding/xml" - "regexp" - "strconv" -) - -// Elem is implemented by every XML element. -type Elem interface { - setEnclosing(Elem) - setName(string) - enclosing() Elem - - GetCommon() *Common -} - -type hidden struct { - CharData string `xml:",chardata"` - Alias *struct { - Common - Source string `xml:"source,attr"` - Path string `xml:"path,attr"` - } `xml:"alias"` - Def *struct { - Common - Choice string `xml:"choice,attr,omitempty"` - Type string `xml:"type,attr,omitempty"` - } `xml:"default"` -} - -// Common holds several of the most common attributes and sub elements -// of an XML element. -type Common struct { - XMLName xml.Name - name string - enclElem Elem - Type string `xml:"type,attr,omitempty"` - Reference string `xml:"reference,attr,omitempty"` - Alt string `xml:"alt,attr,omitempty"` - ValidSubLocales string `xml:"validSubLocales,attr,omitempty"` - Draft string `xml:"draft,attr,omitempty"` - hidden -} - -// Default returns the default type to select from the enclosed list -// or "" if no default value is specified. -func (e *Common) Default() string { - if e.Def == nil { - return "" - } - if e.Def.Choice != "" { - return e.Def.Choice - } else if e.Def.Type != "" { - // Type is still used by the default element in collation. - return e.Def.Type - } - return "" -} - -// Element returns the XML element name. -func (e *Common) Element() string { - return e.name -} - -// GetCommon returns e. It is provided such that Common implements Elem. -func (e *Common) GetCommon() *Common { - return e -} - -// Data returns the character data accumulated for this element. -func (e *Common) Data() string { - e.CharData = charRe.ReplaceAllStringFunc(e.CharData, replaceUnicode) - return e.CharData -} - -func (e *Common) setName(s string) { - e.name = s -} - -func (e *Common) enclosing() Elem { - return e.enclElem -} - -func (e *Common) setEnclosing(en Elem) { - e.enclElem = en -} - -// Escape characters that can be escaped without further escaping the string. -var charRe = regexp.MustCompile(`&#x[0-9a-fA-F]*;|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|\\x[0-9a-fA-F]{2}|\\[0-7]{3}|\\[abtnvfr]`) - -// replaceUnicode converts hexadecimal Unicode codepoint notations to a one-rune string. -// It assumes the input string is correctly formatted. -func replaceUnicode(s string) string { - if s[1] == '#' { - r, _ := strconv.ParseInt(s[3:len(s)-1], 16, 32) - return string(r) - } - r, _, _, _ := strconv.UnquoteChar(s, 0) - return string(r) -} diff --git a/vendor/golang.org/x/text/unicode/cldr/cldr.go b/vendor/golang.org/x/text/unicode/cldr/cldr.go deleted file mode 100644 index 2197f8ac2..000000000 --- a/vendor/golang.org/x/text/unicode/cldr/cldr.go +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:generate go run makexml.go -output xml.go - -// Package cldr provides a parser for LDML and related XML formats. -// This package is intended to be used by the table generation tools -// for the various internationalization-related packages. -// As the XML types are generated from the CLDR DTD, and as the CLDR standard -// is periodically amended, this package may change considerably over time. -// This mostly means that data may appear and disappear between versions. -// That is, old code should keep compiling for newer versions, but data -// may have moved or changed. -// CLDR version 22 is the first version supported by this package. -// Older versions may not work. -package cldr // import "golang.org/x/text/unicode/cldr" - -import ( - "fmt" - "sort" -) - -// CLDR provides access to parsed data of the Unicode Common Locale Data Repository. -type CLDR struct { - parent map[string][]string - locale map[string]*LDML - resolved map[string]*LDML - bcp47 *LDMLBCP47 - supp *SupplementalData -} - -func makeCLDR() *CLDR { - return &CLDR{ - parent: make(map[string][]string), - locale: make(map[string]*LDML), - resolved: make(map[string]*LDML), - bcp47: &LDMLBCP47{}, - supp: &SupplementalData{}, - } -} - -// BCP47 returns the parsed BCP47 LDML data. If no such data was parsed, nil is returned. -func (cldr *CLDR) BCP47() *LDMLBCP47 { - return nil -} - -// Draft indicates the draft level of an element. -type Draft int - -const ( - Approved Draft = iota - Contributed - Provisional - Unconfirmed -) - -var drafts = []string{"unconfirmed", "provisional", "contributed", "approved", ""} - -// ParseDraft returns the Draft value corresponding to the given string. The -// empty string corresponds to Approved. -func ParseDraft(level string) (Draft, error) { - if level == "" { - return Approved, nil - } - for i, s := range drafts { - if level == s { - return Unconfirmed - Draft(i), nil - } - } - return Approved, fmt.Errorf("cldr: unknown draft level %q", level) -} - -func (d Draft) String() string { - return drafts[len(drafts)-1-int(d)] -} - -// SetDraftLevel sets which draft levels to include in the evaluated LDML. -// Any draft element for which the draft level is higher than lev will be excluded. -// If multiple draft levels are available for a single element, the one with the -// lowest draft level will be selected, unless preferDraft is true, in which case -// the highest draft will be chosen. -// It is assumed that the underlying LDML is canonicalized. -func (cldr *CLDR) SetDraftLevel(lev Draft, preferDraft bool) { - // TODO: implement - cldr.resolved = make(map[string]*LDML) -} - -// RawLDML returns the LDML XML for id in unresolved form. -// id must be one of the strings returned by Locales. -func (cldr *CLDR) RawLDML(loc string) *LDML { - return cldr.locale[loc] -} - -// LDML returns the fully resolved LDML XML for loc, which must be one of -// the strings returned by Locales. -func (cldr *CLDR) LDML(loc string) (*LDML, error) { - return cldr.resolve(loc) -} - -// Supplemental returns the parsed supplemental data. If no such data was parsed, -// nil is returned. -func (cldr *CLDR) Supplemental() *SupplementalData { - return cldr.supp -} - -// Locales returns the locales for which there exist files. -// Valid sublocales for which there is no file are not included. -// The root locale is always sorted first. -func (cldr *CLDR) Locales() []string { - loc := []string{"root"} - hasRoot := false - for l, _ := range cldr.locale { - if l == "root" { - hasRoot = true - continue - } - loc = append(loc, l) - } - sort.Strings(loc[1:]) - if !hasRoot { - return loc[1:] - } - return loc -} - -// Get fills in the fields of x based on the XPath path. -func Get(e Elem, path string) (res Elem, err error) { - return walkXPath(e, path) -} diff --git a/vendor/golang.org/x/text/unicode/cldr/cldr_test.go b/vendor/golang.org/x/text/unicode/cldr/cldr_test.go deleted file mode 100644 index 951028d7e..000000000 --- a/vendor/golang.org/x/text/unicode/cldr/cldr_test.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cldr - -import "testing" - -func TestParseDraft(t *testing.T) { - tests := []struct { - in string - draft Draft - err bool - }{ - {"unconfirmed", Unconfirmed, false}, - {"provisional", Provisional, false}, - {"contributed", Contributed, false}, - {"approved", Approved, false}, - {"", Approved, false}, - {"foo", Approved, true}, - } - for _, tt := range tests { - if d, err := ParseDraft(tt.in); d != tt.draft || (err != nil) != tt.err { - t.Errorf("%q: was %v, %v; want %v, %v", tt.in, d, err != nil, tt.draft, tt.err) - } - } -} diff --git a/vendor/golang.org/x/text/unicode/cldr/collate.go b/vendor/golang.org/x/text/unicode/cldr/collate.go deleted file mode 100644 index 80ee28d79..000000000 --- a/vendor/golang.org/x/text/unicode/cldr/collate.go +++ /dev/null @@ -1,359 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package cldr - -import ( - "bufio" - "encoding/xml" - "errors" - "fmt" - "strconv" - "strings" - "unicode" - "unicode/utf8" -) - -// RuleProcessor can be passed to Collator's Process method, which -// parses the rules and calls the respective method for each rule found. -type RuleProcessor interface { - Reset(anchor string, before int) error - Insert(level int, str, context, extend string) error - Index(id string) -} - -const ( - // cldrIndex is a Unicode-reserved sentinel value used to mark the start - // of a grouping within an index. - // We ignore any rule that starts with this rune. - // See http://unicode.org/reports/tr35/#Collation_Elements for details. - cldrIndex = "\uFDD0" - - // specialAnchor is the format in which to represent logical reset positions, - // such as "first tertiary ignorable". - specialAnchor = "<%s/>" -) - -// Process parses the rules for the tailorings of this collation -// and calls the respective methods of p for each rule found. -func (c Collation) Process(p RuleProcessor) (err error) { - if len(c.Cr) > 0 { - if len(c.Cr) > 1 { - return fmt.Errorf("multiple cr elements, want 0 or 1") - } - return processRules(p, c.Cr[0].Data()) - } - if c.Rules.Any != nil { - return c.processXML(p) - } - return errors.New("no tailoring data") -} - -// processRules parses rules in the Collation Rule Syntax defined in -// http://www.unicode.org/reports/tr35/tr35-collation.html#Collation_Tailorings. -func processRules(p RuleProcessor, s string) (err error) { - chk := func(s string, e error) string { - if err == nil { - err = e - } - return s - } - i := 0 // Save the line number for use after the loop. - scanner := bufio.NewScanner(strings.NewReader(s)) - for ; scanner.Scan() && err == nil; i++ { - for s := skipSpace(scanner.Text()); s != "" && s[0] != '#'; s = skipSpace(s) { - level := 5 - var ch byte - switch ch, s = s[0], s[1:]; ch { - case '&': // followed by or '[' ']' - if s = skipSpace(s); consume(&s, '[') { - s = chk(parseSpecialAnchor(p, s)) - } else { - s = chk(parseAnchor(p, 0, s)) - } - case '<': // sort relation '<'{1,4}, optionally followed by '*'. - for level = 1; consume(&s, '<'); level++ { - } - if level > 4 { - err = fmt.Errorf("level %d > 4", level) - } - fallthrough - case '=': // identity relation, optionally followed by *. - if consume(&s, '*') { - s = chk(parseSequence(p, level, s)) - } else { - s = chk(parseOrder(p, level, s)) - } - default: - chk("", fmt.Errorf("illegal operator %q", ch)) - break - } - } - } - if chk("", scanner.Err()); err != nil { - return fmt.Errorf("%d: %v", i, err) - } - return nil -} - -// parseSpecialAnchor parses the anchor syntax which is either of the form -// ['before' ] -// or -// [
NameOptionTypeDescriptionDefault
gostring Message bool if true, a `GoString` method is generated. This returns a string representing valid go code to reproduce the current state of the struct. false
onlyone (deprecated) Message bool if true, all fields must be nullable and only one of the fields may be set, like a union. Two methods are generated: `GetValue() interface{}` and `SetValue(v interface{}) (set bool)`. These provide easier interaction with a union. false
onlyone Message bool if true, all fields must be nullable and only one of the fields may be set, like a union. Two methods are generated: `GetValue() interface{}` and `SetValue(v interface{}) (set bool)`. These provide easier interaction with a union. false
equal Message bool if true, an Equal method is generated false
compare Message bool if true, a Compare method is generated. This is very useful for quickly implementing sort on a list of protobuf structs false
verbose_equal Message bool if true, a verbose equal method is generated for the message. This returns an error which describes the exact element which is not equal to the exact element in the other struct. false