aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.com>2025-01-09 18:55:49 +0300
committerthegeorg <thegeorg@yandex-team.com>2025-01-09 19:18:39 +0300
commitf619272b3b015bfb7a1a466a22bbfdd2dbfd9913 (patch)
tree68f392dd6b17ff45b5b18ef6aa7b690db2b937f5 /contrib
parent938eb92a49988b4a9a3453b6b69993a019441a73 (diff)
downloadydb-f619272b3b015bfb7a1a466a22bbfdd2dbfd9913.tar.gz
Update contrib/libs/apache/avro to 1.12.0
commit_hash:84d2cf3f32ee00d4d0617ff09def69b83d7ece8b
Diffstat (limited to 'contrib')
-rw-r--r--contrib/libs/apache/avro/.yandex_meta/__init__.py11
-rw-r--r--contrib/libs/apache/avro/.yandex_meta/devtools.copyrights.report70
-rw-r--r--contrib/libs/apache/avro/.yandex_meta/devtools.licenses.report83
-rw-r--r--contrib/libs/apache/avro/.yandex_meta/licenses.list.txt28
-rw-r--r--contrib/libs/apache/avro/.yandex_meta/override.nix11
-rw-r--r--contrib/libs/apache/avro/LICENSE30
-rw-r--r--contrib/libs/apache/avro/README8
-rw-r--r--contrib/libs/apache/avro/api/AvroParse.hh80
-rw-r--r--contrib/libs/apache/avro/api/AvroSerialize.hh64
-rw-r--r--contrib/libs/apache/avro/api/Parser.hh143
-rw-r--r--contrib/libs/apache/avro/api/ResolvingReader.hh49
-rw-r--r--contrib/libs/apache/avro/api/Serializer.hh127
-rw-r--r--contrib/libs/apache/avro/api/Writer.hh182
-rw-r--r--contrib/libs/apache/avro/avro/AvroParse.hh1
-rw-r--r--contrib/libs/apache/avro/avro/AvroSerialize.hh1
-rw-r--r--contrib/libs/apache/avro/avro/AvroTraits.hh1
-rw-r--r--contrib/libs/apache/avro/avro/Compiler.hh1
-rw-r--r--contrib/libs/apache/avro/avro/Config.hh1
-rw-r--r--contrib/libs/apache/avro/avro/CustomAttributes.hh1
-rw-r--r--contrib/libs/apache/avro/avro/DataFile.hh1
-rw-r--r--contrib/libs/apache/avro/avro/Decoder.hh1
-rw-r--r--contrib/libs/apache/avro/avro/Encoder.hh1
-rw-r--r--contrib/libs/apache/avro/avro/Exception.hh1
-rw-r--r--contrib/libs/apache/avro/avro/Generic.hh1
-rw-r--r--contrib/libs/apache/avro/avro/GenericDatum.hh1
-rw-r--r--contrib/libs/apache/avro/avro/Layout.hh1
-rw-r--r--contrib/libs/apache/avro/avro/LogicalType.hh1
-rw-r--r--contrib/libs/apache/avro/avro/Node.hh1
-rw-r--r--contrib/libs/apache/avro/avro/NodeConcepts.hh1
-rw-r--r--contrib/libs/apache/avro/avro/NodeImpl.hh1
-rw-r--r--contrib/libs/apache/avro/avro/Parser.hh1
-rw-r--r--contrib/libs/apache/avro/avro/Reader.hh1
-rw-r--r--contrib/libs/apache/avro/avro/Resolver.hh1
-rw-r--r--contrib/libs/apache/avro/avro/ResolverSchema.hh1
-rw-r--r--contrib/libs/apache/avro/avro/ResolvingReader.hh1
-rw-r--r--contrib/libs/apache/avro/avro/Schema.hh1
-rw-r--r--contrib/libs/apache/avro/avro/SchemaResolution.hh1
-rw-r--r--contrib/libs/apache/avro/avro/Serializer.hh1
-rw-r--r--contrib/libs/apache/avro/avro/Specific.hh1
-rw-r--r--contrib/libs/apache/avro/avro/Stream.hh1
-rw-r--r--contrib/libs/apache/avro/avro/Types.hh1
-rw-r--r--contrib/libs/apache/avro/avro/ValidSchema.hh1
-rw-r--r--contrib/libs/apache/avro/avro/Validator.hh1
-rw-r--r--contrib/libs/apache/avro/avro/Writer.hh1
-rw-r--r--contrib/libs/apache/avro/avro/Zigzag.hh1
-rw-r--r--contrib/libs/apache/avro/impl/BinaryDecoder.cc8
-rw-r--r--contrib/libs/apache/avro/impl/Compiler.cc119
-rw-r--r--contrib/libs/apache/avro/impl/CustomAttributes.cc24
-rw-r--r--contrib/libs/apache/avro/impl/DataFile.cc29
-rw-r--r--contrib/libs/apache/avro/impl/FileStream.cc30
-rw-r--r--contrib/libs/apache/avro/impl/Generic.cc6
-rw-r--r--contrib/libs/apache/avro/impl/GenericDatum.cc2
-rw-r--r--contrib/libs/apache/avro/impl/LogicalType.cc8
-rw-r--r--contrib/libs/apache/avro/impl/Node.cc73
-rw-r--r--contrib/libs/apache/avro/impl/NodeImpl.cc122
-rw-r--r--contrib/libs/apache/avro/impl/Resolver.cc36
-rw-r--r--contrib/libs/apache/avro/impl/Schema.cc2
-rw-r--r--contrib/libs/apache/avro/impl/Stream.cc4
-rw-r--r--contrib/libs/apache/avro/impl/ValidSchema.cc7
-rw-r--r--contrib/libs/apache/avro/impl/Validator.cc17
-rw-r--r--contrib/libs/apache/avro/impl/Zigzag.cc8
-rw-r--r--contrib/libs/apache/avro/impl/json/JsonDom.cc6
-rw-r--r--contrib/libs/apache/avro/impl/json/JsonDom.hh12
-rw-r--r--contrib/libs/apache/avro/impl/json/JsonIO.cc104
-rw-r--r--contrib/libs/apache/avro/impl/json/JsonIO.hh20
-rw-r--r--contrib/libs/apache/avro/impl/parsing/JsonCodec.cc7
-rw-r--r--contrib/libs/apache/avro/impl/parsing/ResolvingDecoder.cc109
-rw-r--r--contrib/libs/apache/avro/impl/parsing/Symbol.cc6
-rw-r--r--contrib/libs/apache/avro/impl/parsing/Symbol.hh14
-rw-r--r--contrib/libs/apache/avro/impl/parsing/ValidatingCodec.cc3
-rw-r--r--contrib/libs/apache/avro/include/avro/AvroTraits.hh (renamed from contrib/libs/apache/avro/api/AvroTraits.hh)0
-rw-r--r--contrib/libs/apache/avro/include/avro/Compiler.hh (renamed from contrib/libs/apache/avro/api/Compiler.hh)0
-rw-r--r--contrib/libs/apache/avro/include/avro/Config.hh (renamed from contrib/libs/apache/avro/api/Config.hh)0
-rw-r--r--contrib/libs/apache/avro/include/avro/CustomAttributes.hh (renamed from contrib/libs/apache/avro/api/CustomAttributes.hh)10
-rw-r--r--contrib/libs/apache/avro/include/avro/DataFile.hh (renamed from contrib/libs/apache/avro/api/DataFile.hh)0
-rw-r--r--contrib/libs/apache/avro/include/avro/Decoder.hh (renamed from contrib/libs/apache/avro/api/Decoder.hh)0
-rw-r--r--contrib/libs/apache/avro/include/avro/Encoder.hh (renamed from contrib/libs/apache/avro/api/Encoder.hh)0
-rw-r--r--contrib/libs/apache/avro/include/avro/Exception.hh (renamed from contrib/libs/apache/avro/api/Exception.hh)8
-rw-r--r--contrib/libs/apache/avro/include/avro/Generic.hh (renamed from contrib/libs/apache/avro/api/Generic.hh)0
-rw-r--r--contrib/libs/apache/avro/include/avro/GenericDatum.hh (renamed from contrib/libs/apache/avro/api/GenericDatum.hh)59
-rw-r--r--contrib/libs/apache/avro/include/avro/Layout.hh (renamed from contrib/libs/apache/avro/api/Layout.hh)0
-rw-r--r--contrib/libs/apache/avro/include/avro/LogicalType.hh (renamed from contrib/libs/apache/avro/api/LogicalType.hh)12
-rw-r--r--contrib/libs/apache/avro/include/avro/Node.hh (renamed from contrib/libs/apache/avro/api/Node.hh)36
-rw-r--r--contrib/libs/apache/avro/include/avro/NodeConcepts.hh (renamed from contrib/libs/apache/avro/api/NodeConcepts.hh)4
-rw-r--r--contrib/libs/apache/avro/include/avro/NodeImpl.hh (renamed from contrib/libs/apache/avro/api/NodeImpl.hh)67
-rw-r--r--contrib/libs/apache/avro/include/avro/Reader.hh (renamed from contrib/libs/apache/avro/api/Reader.hh)10
-rw-r--r--contrib/libs/apache/avro/include/avro/Resolver.hh (renamed from contrib/libs/apache/avro/api/Resolver.hh)0
-rw-r--r--contrib/libs/apache/avro/include/avro/ResolverSchema.hh (renamed from contrib/libs/apache/avro/api/ResolverSchema.hh)0
-rw-r--r--contrib/libs/apache/avro/include/avro/Schema.hh (renamed from contrib/libs/apache/avro/api/Schema.hh)2
-rw-r--r--contrib/libs/apache/avro/include/avro/SchemaResolution.hh (renamed from contrib/libs/apache/avro/api/SchemaResolution.hh)0
-rw-r--r--contrib/libs/apache/avro/include/avro/Specific.hh (renamed from contrib/libs/apache/avro/api/Specific.hh)0
-rw-r--r--contrib/libs/apache/avro/include/avro/Stream.hh (renamed from contrib/libs/apache/avro/api/Stream.hh)1
-rw-r--r--contrib/libs/apache/avro/include/avro/Types.hh (renamed from contrib/libs/apache/avro/api/Types.hh)9
-rw-r--r--contrib/libs/apache/avro/include/avro/ValidSchema.hh (renamed from contrib/libs/apache/avro/api/ValidSchema.hh)0
-rw-r--r--contrib/libs/apache/avro/include/avro/Validator.hh (renamed from contrib/libs/apache/avro/api/Validator.hh)30
-rw-r--r--contrib/libs/apache/avro/include/avro/Zigzag.hh (renamed from contrib/libs/apache/avro/api/Zigzag.hh)6
-rw-r--r--contrib/libs/apache/avro/include/avro/buffer/Buffer.hh (renamed from contrib/libs/apache/avro/api/buffer/Buffer.hh)10
-rw-r--r--contrib/libs/apache/avro/include/avro/buffer/BufferReader.hh (renamed from contrib/libs/apache/avro/api/buffer/BufferReader.hh)0
-rw-r--r--contrib/libs/apache/avro/include/avro/buffer/detail/BufferDetail.hh (renamed from contrib/libs/apache/avro/api/buffer/detail/BufferDetail.hh)4
-rw-r--r--contrib/libs/apache/avro/include/avro/buffer/detail/BufferDetailIterator.hh (renamed from contrib/libs/apache/avro/api/buffer/detail/BufferDetailIterator.hh)0
-rw-r--r--contrib/libs/apache/avro/ya.make14
101 files changed, 641 insertions, 1335 deletions
diff --git a/contrib/libs/apache/avro/.yandex_meta/__init__.py b/contrib/libs/apache/avro/.yandex_meta/__init__.py
index 3b03915f17..87d048e50d 100644
--- a/contrib/libs/apache/avro/.yandex_meta/__init__.py
+++ b/contrib/libs/apache/avro/.yandex_meta/__init__.py
@@ -5,6 +5,7 @@ from devtools.yamaker.project import CMakeNinjaNixProject
def post_install(self):
with self.yamakes["."] as m:
m.CFLAGS.remove("-DAVRO_DYN_LINK")
+ m.CFLAGS.remove("-DFMT_HEADER_ONLY=1")
m.PEERDIR += [
boost.make_arcdir("any"),
boost.make_arcdir("asio"),
@@ -23,17 +24,15 @@ apache_avro = CMakeNinjaNixProject(
copy_sources=[
"api/*.hh",
],
- inclink={
- # ClickHouse invokes CMake INSTALL which copies avro headers
- # from source/lang/c++/api/*.hh to avro/*.hh.
- # Emulate this step via inclink
- "avro": ["api/*.hh"]
- },
build_targets=[
"avrocpp",
],
install_targets=[
"avrocpp",
],
+ unbundle_from={
+ "fmt": "_deps/fmt-src",
+ },
+ write_public_incs=False,
post_install=post_install,
)
diff --git a/contrib/libs/apache/avro/.yandex_meta/devtools.copyrights.report b/contrib/libs/apache/avro/.yandex_meta/devtools.copyrights.report
index 0878480045..c06b3a03fb 100644
--- a/contrib/libs/apache/avro/.yandex_meta/devtools.copyrights.report
+++ b/contrib/libs/apache/avro/.yandex_meta/devtools.copyrights.report
@@ -29,76 +29,6 @@
# FILE_INCLUDE - include all file data into licenses text file
# =======================
-KEEP COPYRIGHT_SERVICE_LABEL 362654e2bddceaa39b9405fd18b41b54
-BELONGS ya.make
- Note: matched license text is too long. Read it in the source files.
- Scancode info:
- Original SPDX id: COPYRIGHT_SERVICE_LABEL
- Score : 100.00
- Match type : COPYRIGHT
- Files with this license:
- LICENSE [209:226]
-
-KEEP COPYRIGHT_SERVICE_LABEL 5733e0465642e34bab988d8fce438ddb
-BELONGS ya.make
- Note: matched license text is too long. Read it in the source files.
- Scancode info:
- Original SPDX id: COPYRIGHT_SERVICE_LABEL
- Score : 100.00
- Match type : COPYRIGHT
- Files with this license:
- LICENSE [209:226]
-
-KEEP COPYRIGHT_SERVICE_LABEL 6ba24a29ab5b7a1bfdd9d290dfa9064f
-BELONGS ya.make
- Note: matched license text is too long. Read it in the source files.
- Scancode info:
- Original SPDX id: COPYRIGHT_SERVICE_LABEL
- Score : 100.00
- Match type : COPYRIGHT
- Files with this license:
- LICENSE [209:226]
-
-KEEP COPYRIGHT_SERVICE_LABEL 8b006a24625280b012306a63e42070ba
-BELONGS ya.make
- Note: matched license text is too long. Read it in the source files.
- Scancode info:
- Original SPDX id: COPYRIGHT_SERVICE_LABEL
- Score : 100.00
- Match type : COPYRIGHT
- Files with this license:
- LICENSE [209:226]
-
-KEEP COPYRIGHT_SERVICE_LABEL a5736cd81119372c16f8231dd921802a
-BELONGS ya.make
- Note: matched license text is too long. Read it in the source files.
- Scancode info:
- Original SPDX id: COPYRIGHT_SERVICE_LABEL
- Score : 100.00
- Match type : COPYRIGHT
- Files with this license:
- LICENSE [209:226]
-
-KEEP COPYRIGHT_SERVICE_LABEL abe721aee6c9dfcf403426f6b471b754
-BELONGS ya.make
- Note: matched license text is too long. Read it in the source files.
- Scancode info:
- Original SPDX id: COPYRIGHT_SERVICE_LABEL
- Score : 100.00
- Match type : COPYRIGHT
- Files with this license:
- LICENSE [209:226]
-
-KEEP COPYRIGHT_SERVICE_LABEL b063fba9817e39a550c03593d29c05b1
-BELONGS ya.make
- Note: matched license text is too long. Read it in the source files.
- Scancode info:
- Original SPDX id: COPYRIGHT_SERVICE_LABEL
- Score : 100.00
- Match type : COPYRIGHT
- Files with this license:
- LICENSE [209:226]
-
KEEP COPYRIGHT_SERVICE_LABEL d8489776a135deadae4ae63c3b0243da
BELONGS ya.make
License text:
diff --git a/contrib/libs/apache/avro/.yandex_meta/devtools.licenses.report b/contrib/libs/apache/avro/.yandex_meta/devtools.licenses.report
index 9d7b8dbc6b..bdbc2e2642 100644
--- a/contrib/libs/apache/avro/.yandex_meta/devtools.licenses.report
+++ b/contrib/libs/apache/avro/.yandex_meta/devtools.licenses.report
@@ -31,7 +31,7 @@
KEEP Apache-2.0 44dc743c95835a9e71d7b3cca63dcc7c
BELONGS ya.make
-FILE_INCLUDE NOTICE found in files: api/CustomAttributes.hh at line 3, impl/CustomAttributes.cc at line 4
+FILE_INCLUDE NOTICE found in files: impl/CustomAttributes.cc at line 4, include/avro/CustomAttributes.hh at line 3
Note: matched license text is too long. Read it in the source files.
Scancode info:
Original SPDX id: Apache-2.0
@@ -39,8 +39,8 @@ FILE_INCLUDE NOTICE found in files: api/CustomAttributes.hh at line 3, impl/Cust
Match type : NOTICE
Links : http://www.apache.org/licenses/, http://www.apache.org/licenses/LICENSE-2.0, https://spdx.org/licenses/Apache-2.0
Files with this license:
- api/CustomAttributes.hh [2:16]
impl/CustomAttributes.cc [3:17]
+ include/avro/CustomAttributes.hh [2:16]
KEEP Apache-2.0 4f346bf0c154a20942ca3ab627264c4e
BELONGS ya.make
@@ -57,7 +57,7 @@ BELONGS ya.make
KEEP Apache-2.0 807648c73ed5fa476be45e9005a86248
BELONGS ya.make
-FILE_INCLUDE NOTICE found in files: api/AvroParse.hh at line 3, api/AvroSerialize.hh at line 3, api/AvroTraits.hh at line 3, api/Compiler.hh at line 3, api/Config.hh at line 3, api/DataFile.hh at line 3, api/Decoder.hh at line 3, api/Encoder.hh at line 3, api/Exception.hh at line 3, api/Generic.hh at line 3, api/GenericDatum.hh at line 3, api/Layout.hh at line 3, api/LogicalType.hh at line 3, api/Node.hh at line 3, api/NodeConcepts.hh at line 3, api/NodeImpl.hh at line 3, api/Parser.hh at line 3, api/Reader.hh at line 3, api/Resolver.hh at line 3, api/ResolverSchema.hh at line 3, api/ResolvingReader.hh at line 3, api/Schema.hh at line 3, api/SchemaResolution.hh at line 3, api/Serializer.hh at line 3, api/Specific.hh at line 3, api/Stream.hh at line 3, api/Types.hh at line 3, api/ValidSchema.hh at line 3, api/Validator.hh at line 3, api/Writer.hh at line 3, api/Zigzag.hh at line 3, api/buffer/Buffer.hh at line 3, api/buffer/BufferReader.hh at line 3, api/buffer/detail/BufferDetail.hh at line 3, api/buffer/detail/BufferDetailIterator.hh at line 3, impl/BinaryDecoder.cc at line 3, impl/BinaryEncoder.cc at line 3, impl/Compiler.cc at line 3, impl/DataFile.cc at line 3, impl/FileStream.cc at line 3, impl/Generic.cc at line 3, impl/GenericDatum.cc at line 3, impl/LogicalType.cc at line 3, impl/Node.cc at line 3, impl/NodeImpl.cc at line 3, impl/Resolver.cc at line 4, impl/ResolverSchema.cc at line 4, impl/Schema.cc at line 3, impl/Stream.cc at line 3, impl/Types.cc at line 3, impl/ValidSchema.cc at line 3, impl/Validator.cc at line 3, impl/Zigzag.cc at line 3, impl/json/JsonDom.cc at line 3, impl/json/JsonDom.hh at line 3, impl/json/JsonIO.cc at line 3, impl/json/JsonIO.hh at line 3, impl/parsing/JsonCodec.cc at line 3, impl/parsing/ResolvingDecoder.cc at line 3, impl/parsing/Symbol.cc at line 3, impl/parsing/Symbol.hh at line 3, impl/parsing/ValidatingCodec.cc at line 3, impl/parsing/ValidatingCodec.hh at line 3
+FILE_INCLUDE NOTICE found in files: impl/BinaryDecoder.cc at line 3, impl/BinaryEncoder.cc at line 3, impl/Compiler.cc at line 3, impl/DataFile.cc at line 3, impl/FileStream.cc at line 3, impl/Generic.cc at line 3, impl/GenericDatum.cc at line 3, impl/LogicalType.cc at line 3, impl/Node.cc at line 3, impl/NodeImpl.cc at line 3, impl/Resolver.cc at line 4, impl/ResolverSchema.cc at line 4, impl/Schema.cc at line 3, impl/Stream.cc at line 3, impl/Types.cc at line 3, impl/ValidSchema.cc at line 3, impl/Validator.cc at line 3, impl/Zigzag.cc at line 3, impl/json/JsonDom.cc at line 3, impl/json/JsonDom.hh at line 3, impl/json/JsonIO.cc at line 3, impl/json/JsonIO.hh at line 3, impl/parsing/JsonCodec.cc at line 3, impl/parsing/ResolvingDecoder.cc at line 3, impl/parsing/Symbol.cc at line 3, impl/parsing/Symbol.hh at line 3, impl/parsing/ValidatingCodec.cc at line 3, impl/parsing/ValidatingCodec.hh at line 3, include/avro/AvroTraits.hh at line 3, include/avro/Compiler.hh at line 3, include/avro/Config.hh at line 3, include/avro/DataFile.hh at line 3, include/avro/Decoder.hh at line 3, include/avro/Encoder.hh at line 3, include/avro/Exception.hh at line 3, include/avro/Generic.hh at line 3, include/avro/GenericDatum.hh at line 3, include/avro/Layout.hh at line 3, include/avro/LogicalType.hh at line 3, include/avro/Node.hh at line 3, include/avro/NodeConcepts.hh at line 3, include/avro/NodeImpl.hh at line 3, include/avro/Reader.hh at line 3, include/avro/Resolver.hh at line 3, include/avro/ResolverSchema.hh at line 3, include/avro/Schema.hh at line 3, include/avro/SchemaResolution.hh at line 3, include/avro/Specific.hh at line 3, include/avro/Stream.hh at line 3, include/avro/Types.hh at line 3, include/avro/ValidSchema.hh at line 3, include/avro/Validator.hh at line 3, include/avro/Zigzag.hh at line 3, include/avro/buffer/Buffer.hh at line 3, include/avro/buffer/BufferReader.hh at line 3, include/avro/buffer/detail/BufferDetail.hh at line 3, include/avro/buffer/detail/BufferDetailIterator.hh at line 3
Note: matched license text is too long. Read it in the source files.
Scancode info:
Original SPDX id: Apache-2.0
@@ -65,41 +65,6 @@ FILE_INCLUDE NOTICE found in files: api/AvroParse.hh at line 3, api/AvroSerializ
Match type : NOTICE
Links : http://www.apache.org/licenses/, http://www.apache.org/licenses/LICENSE-2.0, https://spdx.org/licenses/Apache-2.0
Files with this license:
- api/AvroParse.hh [2:16]
- api/AvroSerialize.hh [2:16]
- api/AvroTraits.hh [2:16]
- api/Compiler.hh [2:16]
- api/Config.hh [2:16]
- api/DataFile.hh [2:16]
- api/Decoder.hh [2:16]
- api/Encoder.hh [2:16]
- api/Exception.hh [2:16]
- api/Generic.hh [2:16]
- api/GenericDatum.hh [2:16]
- api/Layout.hh [2:16]
- api/LogicalType.hh [2:16]
- api/Node.hh [2:16]
- api/NodeConcepts.hh [2:16]
- api/NodeImpl.hh [2:16]
- api/Parser.hh [2:16]
- api/Reader.hh [2:16]
- api/Resolver.hh [2:16]
- api/ResolverSchema.hh [2:16]
- api/ResolvingReader.hh [2:16]
- api/Schema.hh [2:16]
- api/SchemaResolution.hh [2:16]
- api/Serializer.hh [2:16]
- api/Specific.hh [2:16]
- api/Stream.hh [2:16]
- api/Types.hh [2:16]
- api/ValidSchema.hh [2:16]
- api/Validator.hh [2:16]
- api/Writer.hh [2:16]
- api/Zigzag.hh [2:16]
- api/buffer/Buffer.hh [2:16]
- api/buffer/BufferReader.hh [2:16]
- api/buffer/detail/BufferDetail.hh [2:16]
- api/buffer/detail/BufferDetailIterator.hh [2:16]
impl/BinaryDecoder.cc [2:16]
impl/BinaryEncoder.cc [2:16]
impl/Compiler.cc [2:16]
@@ -128,6 +93,35 @@ FILE_INCLUDE NOTICE found in files: api/AvroParse.hh at line 3, api/AvroSerializ
impl/parsing/Symbol.hh [2:16]
impl/parsing/ValidatingCodec.cc [2:16]
impl/parsing/ValidatingCodec.hh [2:16]
+ include/avro/AvroTraits.hh [2:16]
+ include/avro/Compiler.hh [2:16]
+ include/avro/Config.hh [2:16]
+ include/avro/DataFile.hh [2:16]
+ include/avro/Decoder.hh [2:16]
+ include/avro/Encoder.hh [2:16]
+ include/avro/Exception.hh [2:16]
+ include/avro/Generic.hh [2:16]
+ include/avro/GenericDatum.hh [2:16]
+ include/avro/Layout.hh [2:16]
+ include/avro/LogicalType.hh [2:16]
+ include/avro/Node.hh [2:16]
+ include/avro/NodeConcepts.hh [2:16]
+ include/avro/NodeImpl.hh [2:16]
+ include/avro/Reader.hh [2:16]
+ include/avro/Resolver.hh [2:16]
+ include/avro/ResolverSchema.hh [2:16]
+ include/avro/Schema.hh [2:16]
+ include/avro/SchemaResolution.hh [2:16]
+ include/avro/Specific.hh [2:16]
+ include/avro/Stream.hh [2:16]
+ include/avro/Types.hh [2:16]
+ include/avro/ValidSchema.hh [2:16]
+ include/avro/Validator.hh [2:16]
+ include/avro/Zigzag.hh [2:16]
+ include/avro/buffer/Buffer.hh [2:16]
+ include/avro/buffer/BufferReader.hh [2:16]
+ include/avro/buffer/detail/BufferDetail.hh [2:16]
+ include/avro/buffer/detail/BufferDetailIterator.hh [2:16]
KEEP BSL-1.0 b0697f9b33869dfe57770c633aa69b1e
BELONGS ya.make
@@ -138,7 +132,7 @@ BELONGS ya.make
Match type : TEXT
Links : http://www.boost.org/LICENSE_1_0.txt, http://www.boost.org/users/license.html, https://spdx.org/licenses/BSL-1.0
Files with this license:
- LICENSE [238:260]
+ LICENSE [208:230]
KEEP Apache-2.0 b9e4e3dbf9b124f5bba77e989c2ff648
BELONGS ya.make
@@ -163,14 +157,3 @@ FILE_INCLUDE NOTICE found in files: LICENSE at line 107, LICENSE at line 110, LI
Links : http://www.apache.org/licenses/, http://www.apache.org/licenses/LICENSE-2.0, https://spdx.org/licenses/Apache-2.0
Files with this license:
LICENSE [2:202]
-
-KEEP FSFAP d2bd1ace1a9d67611b72b735b3b25e91
-BELONGS ya.make
- Note: matched license text is too long. Read it in the source files.
- Scancode info:
- Original SPDX id: FSFAP
- Score : 100.00
- Match type : TEXT
- Links : http://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html, https://spdx.org/licenses/FSFAP
- Files with this license:
- LICENSE [229:232]
diff --git a/contrib/libs/apache/avro/.yandex_meta/licenses.list.txt b/contrib/libs/apache/avro/.yandex_meta/licenses.list.txt
index cad37a8b45..feb9ba1cf5 100644
--- a/contrib/libs/apache/avro/.yandex_meta/licenses.list.txt
+++ b/contrib/libs/apache/avro/.yandex_meta/licenses.list.txt
@@ -288,37 +288,9 @@ The Apache Software Foundation (https://www.apache.org/).
====================COPYRIGHT====================
- Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
- Copyright (c) 2008 Michael Tindal
- Copyright (c) 2008 Daniel Casimiro <dan.casimiro@gmail.com>
-* lang/c++/m4/m4_ax_boost_asio.m4
- Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
- Copyright (c) 2008 Pete Greenwell <pete@mu.org>
-* lang/c++/m4/m4_ax_boost_filesystem.m4
- Copyright (c) 2009 Thomas Porschberg <thomas@randspringer.de>
- Copyright (c) 2009 Michael Tindal
- Copyright (c) 2009 Roman Rybalko <libtorrent@romanr.info>
-* lang/c++/m4/m4_ax_boost_thread.m4
- Copyright (c) 2009 Thomas Porschberg <thomas@randspringer.de>
- Copyright (c) 2009 Michael Tindal
-* lang/c++/m4/m4_ax_boost_regex.m4
- Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
- Copyright (c) 2008 Michael Tindal
-* lang/c++/m4/m4_ax_boost_base.m4
- Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
-
-
-====================COPYRIGHT====================
Copyright 2010-2015 The Apache Software Foundation
-====================FSFAP====================
-| Copying and distribution of this file, with or without modification, are
-| permitted in any medium without royalty provided the copyright notice
-| and this notice are preserved. This file is offered as-is, without any
-| warranty.
-
-
====================File: NOTICE====================
Apache Avro
Copyright 2010-2015 The Apache Software Foundation
diff --git a/contrib/libs/apache/avro/.yandex_meta/override.nix b/contrib/libs/apache/avro/.yandex_meta/override.nix
index 49a5c61f2c..6bd2aa1d97 100644
--- a/contrib/libs/apache/avro/.yandex_meta/override.nix
+++ b/contrib/libs/apache/avro/.yandex_meta/override.nix
@@ -1,13 +1,20 @@
pkgs: attrs: with pkgs; with attrs; rec {
- version = "1.11.3";
+ version = "1.12.0";
src = fetchFromGitHub {
owner = "apache";
repo = "avro";
rev = "release-${version}";
- hash = "sha256-yHr/mQfGU8RjauE2Jkz6rHmoELlchLOjq0nPamU6bcM=";
+ hash = "sha256-n6NtSFGgpd0D6ZXN7xz2UTkKjdkbX7QwHwwq6OTwFg0=";
};
+ nativeBuildInputs = [
+ cmake
+ cacert
+ git
+ python3
+ ];
+
buildInputs = [
boost
snappy
diff --git a/contrib/libs/apache/avro/LICENSE b/contrib/libs/apache/avro/LICENSE
index d641439cde..d7f066e1d8 100644
--- a/contrib/libs/apache/avro/LICENSE
+++ b/contrib/libs/apache/avro/LICENSE
@@ -202,36 +202,6 @@
limitations under the License.
----------------------------------------------------------------------
-License for the m4 macros used by the C++ implementation:
-
-Files:
-* lang/c++/m4/m4_ax_boost_system.m4
- Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
- Copyright (c) 2008 Michael Tindal
- Copyright (c) 2008 Daniel Casimiro <dan.casimiro@gmail.com>
-* lang/c++/m4/m4_ax_boost_asio.m4
- Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
- Copyright (c) 2008 Pete Greenwell <pete@mu.org>
-* lang/c++/m4/m4_ax_boost_filesystem.m4
- Copyright (c) 2009 Thomas Porschberg <thomas@randspringer.de>
- Copyright (c) 2009 Michael Tindal
- Copyright (c) 2009 Roman Rybalko <libtorrent@romanr.info>
-* lang/c++/m4/m4_ax_boost_thread.m4
- Copyright (c) 2009 Thomas Porschberg <thomas@randspringer.de>
- Copyright (c) 2009 Michael Tindal
-* lang/c++/m4/m4_ax_boost_regex.m4
- Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
- Copyright (c) 2008 Michael Tindal
-* lang/c++/m4/m4_ax_boost_base.m4
- Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
-
-License text:
-| Copying and distribution of this file, with or without modification, are
-| permitted in any medium without royalty provided the copyright notice
-| and this notice are preserved. This file is offered as-is, without any
-| warranty.
-
-----------------------------------------------------------------------
License for the AVRO_BOOT_NO_TRAIT code in the C++ implementation:
File: lang/c++/api/Boost.hh
diff --git a/contrib/libs/apache/avro/README b/contrib/libs/apache/avro/README
index 6b081f13a8..be5f2ff62d 100644
--- a/contrib/libs/apache/avro/README
+++ b/contrib/libs/apache/avro/README
@@ -29,9 +29,9 @@ INSTRUCTIONS
Pre-requisites:
-To compile requires boost headers, and the boost regex library. Optionally, it requires Snappy compression library. If Snappy is available, it builds support for Snappy compression and skips it otherwise. (Please see your OS-specific instructions on how to install Boost and Snappy for your OS).
+To compile requires boost headers. Optionally, it requires Snappy compression library. If Snappy is available, it builds support for Snappy compression and skips it otherwise. (Please see your OS-specific instructions on how to install Boost and Snappy for your OS).
-To build one requires cmake 2.6 or later.
+To build one requires cmake 3.5 or later and a compiler supporting C++17 or later.
To generate a Makefile under Unix, MacOS (using GNU) or Cygwin use:
@@ -39,8 +39,8 @@ mkdir build
cd build
cmake -G "Unix Makefiles" ..
-If it doesn't work, either you are missing some packages (boost, flex or bison),
-or you need to help configure locate them.
+If it doesn't work, either you are missing boost package or you need to help
+configure locate it.
If the Makefile is configured correctly, then you can make and run tests:
diff --git a/contrib/libs/apache/avro/api/AvroParse.hh b/contrib/libs/apache/avro/api/AvroParse.hh
deleted file mode 100644
index b0333e8bec..0000000000
--- a/contrib/libs/apache/avro/api/AvroParse.hh
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
- *
- * https://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.
- */
-
-#ifndef avro_AvroParse_hh__
-#define avro_AvroParse_hh__
-
-#include "AvroTraits.hh"
-#include "Config.hh"
-#include "ResolvingReader.hh"
-
-/// \file
-///
-/// Standalone parse functions for Avro types.
-
-namespace avro {
-
-/// The main parse entry point function. Takes a parser (either validating or
-/// plain) and the object that should receive the parsed data.
-
-template<typename Reader, typename T>
-void parse(Reader &p, T &val) {
- parse(p, val, is_serializable<T>());
-}
-
-template<typename T>
-void parse(ResolvingReader &p, T &val) {
- translatingParse(p, val, is_serializable<T>());
-}
-
-/// Type trait should be set to is_serializable in otherwise force the compiler to complain.
-
-template<typename Reader, typename T>
-void parse(Reader &p, T &val, const std::false_type &) {
- static_assert(sizeof(T) == 0, "Not a valid type to parse");
-}
-
-template<typename Reader, typename T>
-void translatingParse(Reader &p, T &val, const std::false_type &) {
- static_assert(sizeof(T) == 0, "Not a valid type to parse");
-}
-
-// @{
-
-/// The remainder of the file includes default implementations for serializable types.
-
-template<typename Reader, typename T>
-void parse(Reader &p, T &val, const std::true_type &) {
- p.readValue(val);
-}
-
-template<typename Reader>
-void parse(Reader &p, std::vector<uint8_t> &val, const std::true_type &) {
- p.readBytes(val);
-}
-
-template<typename T>
-void translatingParse(ResolvingReader &p, T &val, const std::true_type &) {
- p.parse(val);
-}
-
-// @}
-
-} // namespace avro
-
-#endif
diff --git a/contrib/libs/apache/avro/api/AvroSerialize.hh b/contrib/libs/apache/avro/api/AvroSerialize.hh
deleted file mode 100644
index 0bc60475d5..0000000000
--- a/contrib/libs/apache/avro/api/AvroSerialize.hh
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
- *
- * https://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.
- */
-
-#ifndef avro_AvroSerialize_hh__
-#define avro_AvroSerialize_hh__
-
-#include "AvroTraits.hh"
-#include "Config.hh"
-
-/// \file
-///
-/// Standalone serialize functions for Avro types.
-
-namespace avro {
-
-/// The main serializer entry point function. Takes a serializer (either validating or
-/// plain) and the object that should be serialized.
-
-template<typename Writer, typename T>
-void serialize(Writer &s, const T &val) {
- serialize(s, val, is_serializable<T>());
-}
-
-/// Type trait should be set to is_serializable in otherwise force the compiler to complain.
-
-template<typename Writer, typename T>
-void serialize(Writer &s, const T &val, const std::false_type &) {
- static_assert(sizeof(T) == 0, "Not a valid type to serialize");
-}
-
-/// The remainder of the file includes default implementations for serializable types.
-
-// @{
-
-template<typename Writer, typename T>
-void serialize(Writer &s, T val, const std::true_type &) {
- s.writeValue(val);
-}
-
-template<typename Writer>
-void serialize(Writer &s, const std::vector<uint8_t> &val, const std::true_type &) {
- s.writeBytes(val.data(), val.size());
-}
-
-// @}
-
-} // namespace avro
-
-#endif
diff --git a/contrib/libs/apache/avro/api/Parser.hh b/contrib/libs/apache/avro/api/Parser.hh
deleted file mode 100644
index f6bc74874c..0000000000
--- a/contrib/libs/apache/avro/api/Parser.hh
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
- *
- * https://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.
- */
-
-#ifndef avro_Parser_hh__
-#define avro_Parser_hh__
-
-#include "Config.hh"
-#include "Reader.hh"
-
-#include <array>
-
-namespace avro {
-
-///
-/// Class that wraps a reader or ValidatingReade with an interface that uses
-/// explicit get* names instead of getValue
-///
-
-template<class Reader>
-class Parser : private boost::noncopyable {
-
-public:
- // Constructor only works with Writer
- explicit Parser(const InputBuffer &in) : reader_(in) {}
-
- /// Constructor only works with ValidatingWriter
- Parser(const ValidSchema &schema, const InputBuffer &in) : reader_(schema, in) {}
-
- void readNull() {
- Null null;
- reader_.readValue(null);
- }
-
- bool readBool() {
- bool val;
- reader_.readValue(val);
- return val;
- }
-
- int32_t readInt() {
- int32_t val;
- reader_.readValue(val);
- return val;
- }
-
- int64_t readLong() {
- int64_t val;
- reader_.readValue(val);
- return val;
- }
-
- float readFloat() {
- float val;
- reader_.readValue(val);
- return val;
- }
-
- double readDouble() {
- double val;
- reader_.readValue(val);
- return val;
- }
-
- void readString(std::string &val) {
- reader_.readValue(val);
- }
-
- void readBytes(std::vector<uint8_t> &val) {
- reader_.readBytes(val);
- }
-
- template<size_t N>
- void readFixed(uint8_t (&val)[N]) {
- reader_.readFixed(val);
- }
-
- template<size_t N>
- void readFixed(std::array<uint8_t, N> &val) {
- reader_.readFixed(val);
- }
-
- void readRecord() {
- reader_.readRecord();
- }
-
- void readRecordEnd() {
- reader_.readRecordEnd();
- }
-
- int64_t readArrayBlockSize() {
- return reader_.readArrayBlockSize();
- }
-
- int64_t readUnion() {
- return reader_.readUnion();
- }
-
- int64_t readEnum() {
- return reader_.readEnum();
- }
-
- int64_t readMapBlockSize() {
- return reader_.readMapBlockSize();
- }
-
-private:
- friend Type nextType(Parser<ValidatingReader> &p);
- friend bool currentRecordName(Parser<ValidatingReader> &p, std::string &name);
- friend bool nextFieldName(Parser<ValidatingReader> &p, std::string &name);
-
- Reader reader_;
-};
-
-inline Type nextType(Parser<ValidatingReader> &p) {
- return p.reader_.nextType();
-}
-
-inline bool currentRecordName(Parser<ValidatingReader> &p, std::string &name) {
- return p.reader_.currentRecordName(name);
-}
-
-inline bool nextFieldName(Parser<ValidatingReader> &p, std::string &name) {
- return p.reader_.nextFieldName(name);
-}
-
-} // namespace avro
-
-#endif
diff --git a/contrib/libs/apache/avro/api/ResolvingReader.hh b/contrib/libs/apache/avro/api/ResolvingReader.hh
deleted file mode 100644
index c7aed39743..0000000000
--- a/contrib/libs/apache/avro/api/ResolvingReader.hh
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
- *
- * https://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.
- */
-
-#ifndef avro_ResolvingReader_hh__
-#define avro_ResolvingReader_hh__
-
-#include <boost/noncopyable.hpp>
-#include <stdint.h>
-
-#include "Config.hh"
-#include "Reader.hh"
-#include "ResolverSchema.hh"
-
-namespace avro {
-
-class AVRO_DECL ResolvingReader : private boost::noncopyable {
-
-public:
- ResolvingReader(const ResolverSchema &schema, const InputBuffer &in) : reader_(in),
- schema_(schema) {}
-
- template<typename T>
- void parse(T &object) {
- schema_.parse(reader_, reinterpret_cast<uint8_t *>(&object));
- }
-
-private:
- Reader reader_;
- ResolverSchema schema_;
-};
-
-} // namespace avro
-
-#endif
diff --git a/contrib/libs/apache/avro/api/Serializer.hh b/contrib/libs/apache/avro/api/Serializer.hh
deleted file mode 100644
index 1a2c8e029f..0000000000
--- a/contrib/libs/apache/avro/api/Serializer.hh
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
- *
- * https://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.
- */
-
-#ifndef avro_Serializer_hh__
-#define avro_Serializer_hh__
-
-#include <array>
-#include <boost/noncopyable.hpp>
-
-#include "Config.hh"
-#include "Writer.hh"
-
-namespace avro {
-
-/// Class that wraps a Writer or ValidatingWriter with an interface that uses
-/// explicit write* names instead of writeValue
-
-template<class Writer>
-class Serializer : private boost::noncopyable {
-
-public:
- /// Constructor only works with Writer
- explicit Serializer() : writer_() {}
-
- /// Constructor only works with ValidatingWriter
- explicit Serializer(const ValidSchema &schema) : writer_(schema) {}
-
- void writeNull() {
- writer_.writeValue(Null());
- }
-
- void writeBool(bool val) {
- writer_.writeValue(val);
- }
-
- void writeInt(int32_t val) {
- writer_.writeValue(val);
- }
-
- void writeLong(int64_t val) {
- writer_.writeValue(val);
- }
-
- void writeFloat(float val) {
- writer_.writeValue(val);
- }
-
- void writeDouble(double val) {
- writer_.writeValue(val);
- }
-
- void writeBytes(const void *val, size_t size) {
- writer_.writeBytes(val, size);
- }
-
- template<size_t N>
- void writeFixed(const uint8_t (&val)[N]) {
- writer_.writeFixed(val);
- }
-
- template<size_t N>
- void writeFixed(const std::array<uint8_t, N> &val) {
- writer_.writeFixed(val);
- }
-
- void writeString(const std::string &val) {
- writer_.writeValue(val);
- }
-
- void writeRecord() {
- writer_.writeRecord();
- }
-
- void writeRecordEnd() {
- writer_.writeRecordEnd();
- }
-
- void writeArrayBlock(int64_t size) {
- writer_.writeArrayBlock(size);
- }
-
- void writeArrayEnd() {
- writer_.writeArrayEnd();
- }
-
- void writeMapBlock(int64_t size) {
- writer_.writeMapBlock(size);
- }
-
- void writeMapEnd() {
- writer_.writeMapEnd();
- }
-
- void writeUnion(int64_t choice) {
- writer_.writeUnion(choice);
- }
-
- void writeEnum(int64_t choice) {
- writer_.writeEnum(choice);
- }
-
- InputBuffer buffer() const {
- return writer_.buffer();
- }
-
-private:
- Writer writer_;
-};
-
-} // namespace avro
-
-#endif
diff --git a/contrib/libs/apache/avro/api/Writer.hh b/contrib/libs/apache/avro/api/Writer.hh
deleted file mode 100644
index 930ea398c4..0000000000
--- a/contrib/libs/apache/avro/api/Writer.hh
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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
- *
- * https://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.
- */
-
-#ifndef avro_Writer_hh__
-#define avro_Writer_hh__
-
-#include <array>
-#include <boost/noncopyable.hpp>
-
-#include "Config.hh"
-#include "Types.hh"
-#include "Validator.hh"
-#include "Zigzag.hh"
-#include "buffer/Buffer.hh"
-
-namespace avro {
-
-/// Class for writing avro data to a stream.
-
-template<class ValidatorType>
-class WriterImpl : private boost::noncopyable {
-
-public:
- WriterImpl() = default;
-
- explicit WriterImpl(const ValidSchema &schema) : validator_(schema) {}
-
- void writeValue(const Null &) {
- validator_.checkTypeExpected(AVRO_NULL);
- }
-
- void writeValue(bool val) {
- validator_.checkTypeExpected(AVRO_BOOL);
- int8_t byte = (val != 0);
- buffer_.writeTo(byte);
- }
-
- void writeValue(int32_t val) {
- validator_.checkTypeExpected(AVRO_INT);
- // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
- std::array<uint8_t, 5> bytes;
- size_t size = encodeInt32(val, bytes);
- buffer_.writeTo(reinterpret_cast<const char *>(bytes.data()), size);
- }
-
- void writeValue(int64_t val) {
- validator_.checkTypeExpected(AVRO_LONG);
- putLong(val);
- }
-
- void writeValue(float val) {
- validator_.checkTypeExpected(AVRO_FLOAT);
- union {
- float f;
- int32_t i;
- } v;
-
- v.f = val;
- buffer_.writeTo(v.i);
- }
-
- void writeValue(double val) {
- validator_.checkTypeExpected(AVRO_DOUBLE);
- union {
- double d;
- int64_t i;
- } v;
-
- v.d = val;
- buffer_.writeTo(v.i);
- }
-
- void writeValue(const std::string &val) {
- validator_.checkTypeExpected(AVRO_STRING);
- putBytes(val.c_str(), val.size());
- }
-
- void writeBytes(const void *val, size_t size) {
- validator_.checkTypeExpected(AVRO_BYTES);
- putBytes(val, size);
- }
-
- template<size_t N>
- void writeFixed(const uint8_t (&val)[N]) {
- validator_.checkFixedSizeExpected(N);
- buffer_.writeTo(reinterpret_cast<const char *>(val), N);
- }
-
- template<size_t N>
- void writeFixed(const std::array<uint8_t, N> &val) {
- validator_.checkFixedSizeExpected(val.size());
- buffer_.writeTo(reinterpret_cast<const char *>(val.data()), val.size());
- }
-
- void writeRecord() {
- validator_.checkTypeExpected(AVRO_RECORD);
- validator_.checkTypeExpected(AVRO_LONG);
- validator_.setCount(1);
- }
-
- void writeRecordEnd() {
- validator_.checkTypeExpected(AVRO_RECORD);
- validator_.checkTypeExpected(AVRO_LONG);
- validator_.setCount(0);
- }
-
- void writeArrayBlock(int64_t size) {
- validator_.checkTypeExpected(AVRO_ARRAY);
- writeCount(size);
- }
-
- void writeArrayEnd() {
- writeArrayBlock(0);
- }
-
- void writeMapBlock(int64_t size) {
- validator_.checkTypeExpected(AVRO_MAP);
- writeCount(size);
- }
-
- void writeMapEnd() {
- writeMapBlock(0);
- }
-
- void writeUnion(int64_t choice) {
- validator_.checkTypeExpected(AVRO_UNION);
- writeCount(choice);
- }
-
- void writeEnum(int64_t choice) {
- validator_.checkTypeExpected(AVRO_ENUM);
- writeCount(choice);
- }
-
- InputBuffer buffer() const {
- return buffer_;
- }
-
-private:
- void putLong(int64_t val) {
- // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
- std::array<uint8_t, 10> bytes;
- size_t size = encodeInt64(val, bytes);
- buffer_.writeTo(reinterpret_cast<const char *>(bytes.data()), size);
- }
-
- void putBytes(const void *val, size_t size) {
- putLong(size);
- buffer_.writeTo(reinterpret_cast<const char *>(val), size);
- }
-
- void writeCount(int64_t count) {
- validator_.checkTypeExpected(AVRO_LONG);
- validator_.setCount(count);
- putLong(count);
- }
-
- ValidatorType validator_;
- OutputBuffer buffer_;
-};
-
-using Writer = WriterImpl<NullValidator>;
-using ValidatingWriter = WriterImpl<Validator>;
-
-} // namespace avro
-
-#endif
diff --git a/contrib/libs/apache/avro/avro/AvroParse.hh b/contrib/libs/apache/avro/avro/AvroParse.hh
deleted file mode 100644
index 1ce878e5d1..0000000000
--- a/contrib/libs/apache/avro/avro/AvroParse.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/AvroParse.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/AvroSerialize.hh b/contrib/libs/apache/avro/avro/AvroSerialize.hh
deleted file mode 100644
index 17f3da8cc5..0000000000
--- a/contrib/libs/apache/avro/avro/AvroSerialize.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/AvroSerialize.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/AvroTraits.hh b/contrib/libs/apache/avro/avro/AvroTraits.hh
deleted file mode 100644
index edb19eb840..0000000000
--- a/contrib/libs/apache/avro/avro/AvroTraits.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/AvroTraits.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/Compiler.hh b/contrib/libs/apache/avro/avro/Compiler.hh
deleted file mode 100644
index fa43ede18a..0000000000
--- a/contrib/libs/apache/avro/avro/Compiler.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/Compiler.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/Config.hh b/contrib/libs/apache/avro/avro/Config.hh
deleted file mode 100644
index ae19fb85b8..0000000000
--- a/contrib/libs/apache/avro/avro/Config.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/Config.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/CustomAttributes.hh b/contrib/libs/apache/avro/avro/CustomAttributes.hh
deleted file mode 100644
index 8344df9d2a..0000000000
--- a/contrib/libs/apache/avro/avro/CustomAttributes.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/CustomAttributes.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/DataFile.hh b/contrib/libs/apache/avro/avro/DataFile.hh
deleted file mode 100644
index 401cb5fc6d..0000000000
--- a/contrib/libs/apache/avro/avro/DataFile.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/DataFile.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/Decoder.hh b/contrib/libs/apache/avro/avro/Decoder.hh
deleted file mode 100644
index 1d8d79c4e5..0000000000
--- a/contrib/libs/apache/avro/avro/Decoder.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/Decoder.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/Encoder.hh b/contrib/libs/apache/avro/avro/Encoder.hh
deleted file mode 100644
index b390aee4df..0000000000
--- a/contrib/libs/apache/avro/avro/Encoder.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/Encoder.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/Exception.hh b/contrib/libs/apache/avro/avro/Exception.hh
deleted file mode 100644
index 63ad410a4c..0000000000
--- a/contrib/libs/apache/avro/avro/Exception.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/Exception.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/Generic.hh b/contrib/libs/apache/avro/avro/Generic.hh
deleted file mode 100644
index 8d64997183..0000000000
--- a/contrib/libs/apache/avro/avro/Generic.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/Generic.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/GenericDatum.hh b/contrib/libs/apache/avro/avro/GenericDatum.hh
deleted file mode 100644
index e98719027e..0000000000
--- a/contrib/libs/apache/avro/avro/GenericDatum.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/GenericDatum.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/Layout.hh b/contrib/libs/apache/avro/avro/Layout.hh
deleted file mode 100644
index f0c927217f..0000000000
--- a/contrib/libs/apache/avro/avro/Layout.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/Layout.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/LogicalType.hh b/contrib/libs/apache/avro/avro/LogicalType.hh
deleted file mode 100644
index 2a7eaa375a..0000000000
--- a/contrib/libs/apache/avro/avro/LogicalType.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/LogicalType.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/Node.hh b/contrib/libs/apache/avro/avro/Node.hh
deleted file mode 100644
index 600d9e8e22..0000000000
--- a/contrib/libs/apache/avro/avro/Node.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/Node.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/NodeConcepts.hh b/contrib/libs/apache/avro/avro/NodeConcepts.hh
deleted file mode 100644
index 5e532e20b1..0000000000
--- a/contrib/libs/apache/avro/avro/NodeConcepts.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/NodeConcepts.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/NodeImpl.hh b/contrib/libs/apache/avro/avro/NodeImpl.hh
deleted file mode 100644
index d4893d50a8..0000000000
--- a/contrib/libs/apache/avro/avro/NodeImpl.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/NodeImpl.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/Parser.hh b/contrib/libs/apache/avro/avro/Parser.hh
deleted file mode 100644
index 28eb7c4e16..0000000000
--- a/contrib/libs/apache/avro/avro/Parser.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/Parser.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/Reader.hh b/contrib/libs/apache/avro/avro/Reader.hh
deleted file mode 100644
index cdfa6dec44..0000000000
--- a/contrib/libs/apache/avro/avro/Reader.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/Reader.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/Resolver.hh b/contrib/libs/apache/avro/avro/Resolver.hh
deleted file mode 100644
index bc3b3fb08f..0000000000
--- a/contrib/libs/apache/avro/avro/Resolver.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/Resolver.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/ResolverSchema.hh b/contrib/libs/apache/avro/avro/ResolverSchema.hh
deleted file mode 100644
index f4d41e1de2..0000000000
--- a/contrib/libs/apache/avro/avro/ResolverSchema.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/ResolverSchema.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/ResolvingReader.hh b/contrib/libs/apache/avro/avro/ResolvingReader.hh
deleted file mode 100644
index 04e4912747..0000000000
--- a/contrib/libs/apache/avro/avro/ResolvingReader.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/ResolvingReader.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/Schema.hh b/contrib/libs/apache/avro/avro/Schema.hh
deleted file mode 100644
index 515b9d5855..0000000000
--- a/contrib/libs/apache/avro/avro/Schema.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/Schema.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/SchemaResolution.hh b/contrib/libs/apache/avro/avro/SchemaResolution.hh
deleted file mode 100644
index 3aef7ff60e..0000000000
--- a/contrib/libs/apache/avro/avro/SchemaResolution.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/SchemaResolution.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/Serializer.hh b/contrib/libs/apache/avro/avro/Serializer.hh
deleted file mode 100644
index 538b57dfa2..0000000000
--- a/contrib/libs/apache/avro/avro/Serializer.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/Serializer.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/Specific.hh b/contrib/libs/apache/avro/avro/Specific.hh
deleted file mode 100644
index 4f8595c03f..0000000000
--- a/contrib/libs/apache/avro/avro/Specific.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/Specific.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/Stream.hh b/contrib/libs/apache/avro/avro/Stream.hh
deleted file mode 100644
index e056f5ae29..0000000000
--- a/contrib/libs/apache/avro/avro/Stream.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/Stream.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/Types.hh b/contrib/libs/apache/avro/avro/Types.hh
deleted file mode 100644
index ad7ee126f4..0000000000
--- a/contrib/libs/apache/avro/avro/Types.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/Types.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/ValidSchema.hh b/contrib/libs/apache/avro/avro/ValidSchema.hh
deleted file mode 100644
index a0845d77b1..0000000000
--- a/contrib/libs/apache/avro/avro/ValidSchema.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/ValidSchema.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/Validator.hh b/contrib/libs/apache/avro/avro/Validator.hh
deleted file mode 100644
index bca184c46d..0000000000
--- a/contrib/libs/apache/avro/avro/Validator.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/Validator.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/Writer.hh b/contrib/libs/apache/avro/avro/Writer.hh
deleted file mode 100644
index f0ebac09dd..0000000000
--- a/contrib/libs/apache/avro/avro/Writer.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/Writer.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/avro/Zigzag.hh b/contrib/libs/apache/avro/avro/Zigzag.hh
deleted file mode 100644
index db263917ca..0000000000
--- a/contrib/libs/apache/avro/avro/Zigzag.hh
+++ /dev/null
@@ -1 +0,0 @@
-#include "../api/Zigzag.hh" /* inclink generated by yamaker */
diff --git a/contrib/libs/apache/avro/impl/BinaryDecoder.cc b/contrib/libs/apache/avro/impl/BinaryDecoder.cc
index 248b503342..a970d60520 100644
--- a/contrib/libs/apache/avro/impl/BinaryDecoder.cc
+++ b/contrib/libs/apache/avro/impl/BinaryDecoder.cc
@@ -74,14 +74,13 @@ bool BinaryDecoder::decodeBool() {
} else if (v == 1) {
return true;
}
- throw Exception(boost::format("Invalid value for bool: %1%") % v);
+ throw Exception("Invalid value for bool: {}", v);
}
int32_t BinaryDecoder::decodeInt() {
auto val = doDecodeLong();
if (val < INT32_MIN || val > INT32_MAX) {
- throw Exception(
- boost::format("Value out of range for Avro int: %1%") % val);
+ throw Exception("Value out of range for Avro int: {}", val);
}
return static_cast<int32_t>(val);
}
@@ -105,8 +104,7 @@ double BinaryDecoder::decodeDouble() {
size_t BinaryDecoder::doDecodeLength() {
ssize_t len = decodeInt();
if (len < 0) {
- throw Exception(
- boost::format("Cannot have negative length: %1%") % len);
+ throw Exception("Cannot have negative length: {}", len);
}
return len;
}
diff --git a/contrib/libs/apache/avro/impl/Compiler.cc b/contrib/libs/apache/avro/impl/Compiler.cc
index 383798c4d6..3b287c9eeb 100644
--- a/contrib/libs/apache/avro/impl/Compiler.cc
+++ b/contrib/libs/apache/avro/impl/Compiler.cc
@@ -96,7 +96,7 @@ static NodePtr makeNode(const string &t, SymbolTable &st, const string &ns) {
if (it != st.end()) {
return NodePtr(new NodeSymbolic(asSingleAttribute(n), it->second));
}
- throw Exception(boost::format("Unknown type: %1%") % n.fullname());
+ throw Exception("Unknown type: {}", n);
}
/** Returns "true" if the field is in the container */
@@ -112,7 +112,7 @@ json::Object::const_iterator findField(const Entity &e,
template<typename T>
void ensureType(const Entity &e, const string &name) {
if (e.type() != json::type_traits<T>::type()) {
- throw Exception(boost::format("Json field \"%1%\" is not a %2%: %3%") % name % json::type_traits<T>::name() % e.toString());
+ throw Exception("Json field \"{}\" is not a {}: {}", name, json::type_traits<T>::name(), e.toString());
}
}
@@ -147,17 +147,20 @@ string getDocField(const Entity &e, const Object &m) {
struct Field {
const string name;
+ const vector<string> aliases;
const NodePtr schema;
const GenericDatum defaultValue;
const CustomAttributes customAttributes;
- Field(string n, NodePtr v, GenericDatum dv, const CustomAttributes& ca) : name(std::move(n)), schema(std::move(v)), defaultValue(std::move(dv)), customAttributes(std::move(ca)) {}
+
+ Field(string n, vector<string> a, NodePtr v, GenericDatum dv, const CustomAttributes &ca)
+ : name(std::move(n)), aliases(std::move(a)), schema(std::move(v)), defaultValue(std::move(dv)), customAttributes(ca) {}
};
static void assertType(const Entity &e, EntityType et) {
if (e.type() != et) {
- throw Exception(boost::format("Unexpected type for default value: "
- "Expected %1%, but found %2% in line %3%")
- % json::typeToString(et) % json::typeToString(e.type()) % e.line());
+ throw Exception(
+ "Unexpected type for default value: Expected {}, but found {} in line {}",
+ json::typeToString(et), json::typeToString(e.type()), e.line());
}
}
@@ -216,9 +219,9 @@ static GenericDatum makeGenericDatum(NodePtr n,
for (size_t i = 0; i < n->leaves(); ++i) {
auto it = v.find(n->nameAt(i));
if (it == v.end()) {
- throw Exception(boost::format(
- "No value found in default for %1%")
- % n->nameAt(i));
+ throw Exception(
+ "No value found in default for {}",
+ n->nameAt(i));
}
result.setFieldAt(i,
makeGenericDatum(n->leafAt(i), it->second, st));
@@ -256,33 +259,39 @@ static GenericDatum makeGenericDatum(NodePtr n,
case AVRO_FIXED:
assertType(e, json::EntityType::String);
return GenericDatum(n, GenericFixed(n, toBin(e.bytesValue())));
- default: throw Exception(boost::format("Unknown type: %1%") % t);
+ default: throw Exception("Unknown type: {}", t);
}
}
-static const std::unordered_set<std::string>& getKnownFields() {
+static const std::unordered_set<std::string> &getKnownFields() {
// return known fields
static const std::unordered_set<std::string> kKnownFields =
- {"name", "type", "default", "doc", "size", "logicalType",
+ {"name", "type", "aliases", "default", "doc", "size", "logicalType",
"values", "precision", "scale", "namespace"};
- return kKnownFields;
+ return kKnownFields;
}
-static void getCustomAttributes(const Object& m, CustomAttributes &customAttributes)
-{
- // Don't add known fields on primitive type and fixed type into custom
- // fields.
- const std::unordered_set<std::string>& kKnownFields = getKnownFields();
- for (const auto &entry : m) {
- if (kKnownFields.find(entry.first) == kKnownFields.end()) {
- customAttributes.addAttribute(entry.first, entry.second.stringValue());
+static void getCustomAttributes(const Object &m, CustomAttributes &customAttributes) {
+ // Don't add known fields on primitive type and fixed type into custom
+ // fields.
+ const std::unordered_set<std::string> &kKnownFields = getKnownFields();
+ for (const auto &entry : m) {
+ if (kKnownFields.find(entry.first) == kKnownFields.end()) {
+ customAttributes.addAttribute(entry.first, entry.second.stringValue());
+ }
}
- }
}
static Field makeField(const Entity &e, SymbolTable &st, const string &ns) {
const Object &m = e.objectValue();
- const string &n = getStringField(e, m, "name");
+ string n = getStringField(e, m, "name");
+ vector<string> aliases;
+ string aliasesName = "aliases";
+ if (containsField(m, aliasesName)) {
+ for (const auto &alias : getArrayField(e, m, aliasesName)) {
+ aliases.emplace_back(alias.stringValue());
+ }
+ }
auto it = findField(e, m, "type");
auto it2 = m.find("default");
NodePtr node = makeNode(it->second, st, ns);
@@ -293,34 +302,35 @@ static Field makeField(const Entity &e, SymbolTable &st, const string &ns) {
// Get custom attributes
CustomAttributes customAttributes;
getCustomAttributes(m, customAttributes);
-
- return Field(n, node, d, customAttributes);
+ return Field(std::move(n), std::move(aliases), node, d, customAttributes);
}
// Extended makeRecordNode (with doc).
static NodePtr makeRecordNode(const Entity &e, const Name &name,
const string *doc, const Object &m,
SymbolTable &st, const string &ns) {
- const Array &v = getArrayField(e, m, "fields");
concepts::MultiAttribute<string> fieldNames;
+ vector<vector<string>> fieldAliases;
concepts::MultiAttribute<NodePtr> fieldValues;
concepts::MultiAttribute<CustomAttributes> customAttributes;
vector<GenericDatum> defaultValues;
-
- for (const auto &it : v) {
+ string fields = "fields";
+ for (const auto &it : getArrayField(e, m, fields)) {
Field f = makeField(it, st, ns);
fieldNames.add(f.name);
+ fieldAliases.push_back(f.aliases);
fieldValues.add(f.schema);
defaultValues.push_back(f.defaultValue);
customAttributes.add(f.customAttributes);
}
+
NodeRecord *node;
if (doc == nullptr) {
node = new NodeRecord(asSingleAttribute(name), fieldValues, fieldNames,
- defaultValues, customAttributes);
+ fieldAliases, defaultValues, customAttributes);
} else {
node = new NodeRecord(asSingleAttribute(name), asSingleAttribute(*doc),
- fieldValues, fieldNames, defaultValues, customAttributes);
+ fieldValues, fieldNames, fieldAliases, defaultValues, customAttributes);
}
return NodePtr(node);
}
@@ -335,9 +345,10 @@ static LogicalType makeLogicalType(const Entity &e, const Object &m) {
if (typeField == "decimal") {
LogicalType decimalType(LogicalType::DECIMAL);
try {
- decimalType.setPrecision(getLongField(e, m, "precision"));
+ // Precision probably won't go over 38 and scale beyond -77/+77
+ decimalType.setPrecision(static_cast<int32_t>(getLongField(e, m, "precision")));
if (containsField(m, "scale")) {
- decimalType.setScale(getLongField(e, m, "scale"));
+ decimalType.setScale(static_cast<int32_t>(getLongField(e, m, "scale")));
}
} catch (Exception &ex) {
// If any part of the logical type is malformed, per the standard we
@@ -367,11 +378,12 @@ static LogicalType makeLogicalType(const Entity &e, const Object &m) {
static NodePtr makeEnumNode(const Entity &e,
const Name &name, const Object &m) {
- const Array &v = getArrayField(e, m, "symbols");
+ string symbolsName = "symbols";
+ const Array &v = getArrayField(e, m, symbolsName);
concepts::MultiAttribute<string> symbols;
for (const auto &it : v) {
if (it.type() != json::EntityType::String) {
- throw Exception(boost::format("Enum symbol not a string: %1%") % it.toString());
+ throw Exception("Enum symbol not a string: {}", it.toString());
}
symbols.add(it.stringValue());
}
@@ -384,12 +396,12 @@ static NodePtr makeEnumNode(const Entity &e,
static NodePtr makeFixedNode(const Entity &e,
const Name &name, const Object &m) {
- int v = static_cast<int>(getLongField(e, m, "size"));
+ int64_t v = getLongField(e, m, "size");
if (v <= 0) {
- throw Exception(boost::format("Size for fixed is not positive: %1%") % e.toString());
+ throw Exception("Size for fixed is not positive: {}", e.toString());
}
NodePtr node =
- NodePtr(new NodeFixed(asSingleAttribute(name), asSingleAttribute(v)));
+ NodePtr(new NodeFixed(asSingleAttribute(name), asSingleAttribute(static_cast<size_t>(v))));
if (containsField(m, "doc")) {
node->setDoc(getDocField(e, m));
}
@@ -422,21 +434,31 @@ static NodePtr makeMapNode(const Entity &e, const Object &m,
static Name getName(const Entity &e, const Object &m, const string &ns) {
const string &name = getStringField(e, m, "name");
+ Name result;
if (isFullName(name)) {
- return Name(name);
+ result = Name(name);
} else {
auto it = m.find("namespace");
if (it != m.end()) {
if (it->second.type() != json::type_traits<string>::type()) {
- throw Exception(boost::format(
- "Json field \"%1%\" is not a %2%: %3%")
- % "namespace" % json::type_traits<string>::name() % it->second.toString());
+ throw Exception(
+ "Json field \"namespace\" is not a string: {}",
+ it->second.toString());
}
- Name result = Name(name, it->second.stringValue());
- return result;
+ result = Name(name, it->second.stringValue());
+ } else {
+ result = Name(name, ns);
}
- return Name(name, ns);
}
+
+ std::string aliases = "aliases";
+ if (containsField(m, aliases)) {
+ for (const auto &alias : getArrayField(e, m, aliases)) {
+ result.addAlias(alias.stringValue());
+ }
+ }
+
+ return result;
}
static NodePtr makeNode(const Entity &e, const Object &m,
@@ -482,11 +504,10 @@ static NodePtr makeNode(const Entity &e, const Object &m,
return result;
}
- throw Exception(boost::format("Unknown type definition: %1%")
- % e.toString());
+ throw Exception("Unknown type definition: %1%", e.toString());
}
-static NodePtr makeNode(const Entity &e, const Array &m,
+static NodePtr makeNode(const Entity &, const Array &m,
SymbolTable &st, const string &ns) {
concepts::MultiAttribute<NodePtr> mm;
for (const auto &it : m) {
@@ -500,13 +521,13 @@ static NodePtr makeNode(const json::Entity &e, SymbolTable &st, const string &ns
case json::EntityType::String: return makeNode(e.stringValue(), st, ns);
case json::EntityType::Obj: return makeNode(e, e.objectValue(), st, ns);
case json::EntityType::Arr: return makeNode(e, e.arrayValue(), st, ns);
- default: throw Exception(boost::format("Invalid Avro type: %1%") % e.toString());
+ default: throw Exception("Invalid Avro type: {}", e.toString());
}
}
json::Object::const_iterator findField(const Entity &e, const Object &m, const string &fieldName) {
auto it = m.find(fieldName);
if (it == m.end()) {
- throw Exception(boost::format("Missing Json field \"%1%\": %2%") % fieldName % e.toString());
+ throw Exception("Missing Json field \"{}\": {}", fieldName, e.toString());
} else {
return it;
}
diff --git a/contrib/libs/apache/avro/impl/CustomAttributes.cc b/contrib/libs/apache/avro/impl/CustomAttributes.cc
index 1186d9e26a..13c56a5e92 100644
--- a/contrib/libs/apache/avro/impl/CustomAttributes.cc
+++ b/contrib/libs/apache/avro/impl/CustomAttributes.cc
@@ -17,9 +17,9 @@
* limitations under the License.
*/
#include "CustomAttributes.hh"
+#include "Exception.hh"
#include <map>
#include <memory>
-#include "Exception.hh"
namespace avro {
@@ -28,26 +28,26 @@ boost::optional<std::string> CustomAttributes::getAttribute(const std::string &n
std::map<std::string, std::string>::const_iterator iter =
attributes_.find(name);
if (iter == attributes_.end()) {
- return result;
+ return result;
}
result = iter->second;
return result;
}
-void CustomAttributes::addAttribute(const std::string& name,
- const std::string& value) {
- auto iter_and_find =
- attributes_.insert(std::pair<std::string, std::string>(name, value));
- if (!iter_and_find.second) {
- throw Exception(name + " already exists and cannot be added");
- }
+void CustomAttributes::addAttribute(const std::string &name,
+ const std::string &value) {
+ auto iter_and_find =
+ attributes_.insert(std::pair<std::string, std::string>(name, value));
+ if (!iter_and_find.second) {
+ throw Exception(name + " already exists and cannot be added");
+ }
}
-void CustomAttributes::printJson(std::ostream& os,
- const std::string& name) const {
+void CustomAttributes::printJson(std::ostream &os,
+ const std::string &name) const {
if (attributes().find(name) == attributes().end()) {
throw Exception(name + " doesn't exist");
}
os << "\"" << name << "\": \"" << attributes().at(name) << "\"";
}
-} // namespace avro
+} // namespace avro
diff --git a/contrib/libs/apache/avro/impl/DataFile.cc b/contrib/libs/apache/avro/impl/DataFile.cc
index 45fdbb649d..66281ae982 100644
--- a/contrib/libs/apache/avro/impl/DataFile.cc
+++ b/contrib/libs/apache/avro/impl/DataFile.cc
@@ -93,9 +93,9 @@ DataFileWriterBase::DataFileWriterBase(std::unique_ptr<OutputStream> outputStrea
void DataFileWriterBase::init(const ValidSchema &schema, size_t syncInterval, const Codec &codec) {
if (syncInterval < minSyncInterval || syncInterval > maxSyncInterval) {
- throw Exception(boost::format("Invalid sync interval: %1%. "
- "Should be between %2% and %3%")
- % syncInterval % minSyncInterval % maxSyncInterval);
+ throw Exception(
+ "Invalid sync interval: {}. Should be between {} and {}",
+ syncInterval, minSyncInterval, maxSyncInterval);
}
setMetadata(AVRO_CODEC_KEY, AVRO_NULL_CODEC);
@@ -108,7 +108,7 @@ void DataFileWriterBase::init(const ValidSchema &schema, size_t syncInterval, co
setMetadata(AVRO_CODEC_KEY, AVRO_SNAPPY_CODEC);
#endif
} else {
- throw Exception(boost::format("Unknown codec: %1%") % codec);
+ throw Exception("Unknown codec: {}", int(codec));
}
setMetadata(AVRO_SCHEMA_KEY, schema.toJson(false));
@@ -120,7 +120,9 @@ void DataFileWriterBase::init(const ValidSchema &schema, size_t syncInterval, co
DataFileWriterBase::~DataFileWriterBase() {
if (stream_) {
- close();
+ try {
+ close();
+ } catch (...) {}
}
}
@@ -193,10 +195,10 @@ void DataFileWriterBase::sync() {
os.push(boost::iostreams::back_inserter(temp));
boost::iostreams::write(os, compressed.c_str(), compressed_size);
}
- temp.push_back((checksum >> 24) & 0xFF);
- temp.push_back((checksum >> 16) & 0xFF);
- temp.push_back((checksum >> 8) & 0xFF);
- temp.push_back(checksum & 0xFF);
+ temp.push_back(static_cast<char>((checksum >> 24) & 0xFF));
+ temp.push_back(static_cast<char>((checksum >> 16) & 0xFF));
+ temp.push_back(static_cast<char>((checksum >> 8) & 0xFF));
+ temp.push_back(static_cast<char>(checksum & 0xFF));
std::unique_ptr<InputStream> in = memoryInputStream(
reinterpret_cast<const uint8_t *>(temp.data()), temp.size());
int64_t byteCount = temp.size();
@@ -409,8 +411,8 @@ void DataFileReaderBase::readDataBlock() {
uint32_t c = crc();
if (checksum != c) {
throw Exception(
- boost::format("Checksum did not match for Snappy compression: Expected: %1%, computed: %2%") % checksum
- % c);
+ "Checksum did not match for Snappy compression: Expected: {}, computed: {}",
+ checksum, c);
}
os_.reset(new boost::iostreams::filtering_istream());
os_->push(
@@ -453,7 +455,7 @@ static ValidSchema makeSchema(const vector<uint8_t> &v) {
istringstream iss(toString(v));
ValidSchema vs;
compileJsonSchema(iss, vs);
- return ValidSchema(vs);
+ return vs;
}
void DataFileReaderBase::readHeader() {
@@ -525,8 +527,7 @@ void DataFileReaderBase::sync(int64_t position) {
eof_ = true;
return;
}
- int len =
- std::min(static_cast<size_t>(SyncSize - i), n);
+ size_t len = std::min(SyncSize - i, n);
memcpy(&sync_buffer[i], p, len);
p += len;
n -= len;
diff --git a/contrib/libs/apache/avro/impl/FileStream.cc b/contrib/libs/apache/avro/impl/FileStream.cc
index 749fd835ab..9063cf1f73 100644
--- a/contrib/libs/apache/avro/impl/FileStream.cc
+++ b/contrib/libs/apache/avro/impl/FileStream.cc
@@ -49,9 +49,9 @@ struct BufferCopyIn {
struct FileBufferCopyIn : public BufferCopyIn {
#ifdef _WIN32
HANDLE h_;
- FileBufferCopyIn(const char *filename) : h_(::CreateFileA(filename, GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)) {
+ explicit FileBufferCopyIn(const char *filename) : h_(::CreateFileA(filename, GENERIC_READ, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)) {
if (h_ == INVALID_HANDLE_VALUE) {
- throw Exception(boost::format("Cannot open file: %1%") % ::GetLastError());
+ throw Exception("Cannot open file: {}", ::GetLastError());
}
}
@@ -59,16 +59,16 @@ struct FileBufferCopyIn : public BufferCopyIn {
::CloseHandle(h_);
}
- void seek(size_t len) {
+ void seek(size_t len) override {
if (::SetFilePointer(h_, len, NULL, FILE_CURRENT) == INVALID_SET_FILE_POINTER && ::GetLastError() != NO_ERROR) {
- throw Exception(boost::format("Cannot skip file: %1%") % ::GetLastError());
+ throw Exception("Cannot skip file: {}", ::GetLastError());
}
}
- bool read(uint8_t *b, size_t toRead, size_t &actual) {
+ bool read(uint8_t *b, size_t toRead, size_t &actual) override {
DWORD dw = 0;
if (!::ReadFile(h_, b, toRead, &dw, NULL)) {
- throw Exception(boost::format("Cannot read file: %1%") % ::GetLastError());
+ throw Exception("Cannot read file: {}", ::GetLastError());
}
actual = static_cast<size_t>(dw);
return actual != 0;
@@ -78,7 +78,7 @@ struct FileBufferCopyIn : public BufferCopyIn {
explicit FileBufferCopyIn(const char *filename) : fd_(open(filename, O_RDONLY | O_BINARY)) {
if (fd_ < 0) {
- throw Exception(boost::format("Cannot open file: %1%") % ::strerror(errno));
+ throw Exception("Cannot open file: {}", strerror(errno));
}
}
@@ -89,12 +89,12 @@ struct FileBufferCopyIn : public BufferCopyIn {
void seek(size_t len) final {
off_t r = ::lseek(fd_, len, SEEK_CUR);
if (r == static_cast<off_t>(-1)) {
- throw Exception(boost::format("Cannot skip file: %1%") % strerror(errno));
+ throw Exception("Cannot skip file: {}", strerror(errno));
}
}
bool read(uint8_t *b, size_t toRead, size_t &actual) final {
- int n = ::read(fd_, b, toRead);
+ auto n = ::read(fd_, b, toRead);
if (n > 0) {
actual = n;
return true;
@@ -232,9 +232,9 @@ struct BufferCopyOut {
struct FileBufferCopyOut : public BufferCopyOut {
#ifdef _WIN32
HANDLE h_;
- FileBufferCopyOut(const char *filename) : h_(::CreateFileA(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)) {
+ explicit FileBufferCopyOut(const char *filename) : h_(::CreateFileA(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)) {
if (h_ == INVALID_HANDLE_VALUE) {
- throw Exception(boost::format("Cannot open file: %1%") % ::GetLastError());
+ throw Exception("Cannot open file: {}", ::GetLastError());
}
}
@@ -242,11 +242,11 @@ struct FileBufferCopyOut : public BufferCopyOut {
::CloseHandle(h_);
}
- void write(const uint8_t *b, size_t len) {
+ void write(const uint8_t *b, size_t len) override {
while (len > 0) {
DWORD dw = 0;
if (!::WriteFile(h_, b, len, &dw, NULL)) {
- throw Exception(boost::format("Cannot read file: %1%") % ::GetLastError());
+ throw Exception("Cannot read file: {}", ::GetLastError());
}
b += dw;
len -= dw;
@@ -258,7 +258,7 @@ struct FileBufferCopyOut : public BufferCopyOut {
explicit FileBufferCopyOut(const char *filename) : fd_(::open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0644)) {
if (fd_ < 0) {
- throw Exception(boost::format("Cannot open file: %1%") % ::strerror(errno));
+ throw Exception("Cannot open file: {}", ::strerror(errno));
}
}
@@ -268,7 +268,7 @@ struct FileBufferCopyOut : public BufferCopyOut {
void write(const uint8_t *b, size_t len) final {
if (::write(fd_, b, len) < 0) {
- throw Exception(boost::format("Cannot write file: %1%") % ::strerror(errno));
+ throw Exception("Cannot write file: {}", ::strerror(errno));
}
}
#endif
diff --git a/contrib/libs/apache/avro/impl/Generic.cc b/contrib/libs/apache/avro/impl/Generic.cc
index 6e0436ae34..1535c604be 100644
--- a/contrib/libs/apache/avro/impl/Generic.cc
+++ b/contrib/libs/apache/avro/impl/Generic.cc
@@ -29,7 +29,7 @@ typedef vector<uint8_t> bytes;
void GenericContainer::assertType(const NodePtr &schema, Type type) {
if (schema->type() != type) {
- throw Exception(boost::format("Schema type %1 expected %2") % toString(schema->type()) % toString(type));
+ throw Exception("Schema type {} expected {}", schema->type(), type);
}
}
@@ -129,7 +129,7 @@ void GenericReader::read(GenericDatum &datum, Decoder &d, bool isResolving) {
}
} break;
default:
- throw Exception(boost::format("Unknown schema type %1%") % toString(datum.type()));
+ throw Exception("Unknown schema type {}", datum.type());
}
}
@@ -217,7 +217,7 @@ void GenericWriter::write(const GenericDatum &datum, Encoder &e) {
e.mapEnd();
} break;
default:
- throw Exception(boost::format("Unknown schema type %1%") % toString(datum.type()));
+ throw Exception("Unknown schema type {}", datum.type());
}
}
diff --git a/contrib/libs/apache/avro/impl/GenericDatum.cc b/contrib/libs/apache/avro/impl/GenericDatum.cc
index 7b2bf93bca..49700a927f 100644
--- a/contrib/libs/apache/avro/impl/GenericDatum.cc
+++ b/contrib/libs/apache/avro/impl/GenericDatum.cc
@@ -83,7 +83,7 @@ void GenericDatum::init(const NodePtr &schema) {
value_ = GenericUnion(sc);
break;
default:
- throw Exception(boost::format("Unknown schema type %1%") % toString(type_));
+ throw Exception("Unknown schema type {}", toString(type_));
}
}
diff --git a/contrib/libs/apache/avro/impl/LogicalType.cc b/contrib/libs/apache/avro/impl/LogicalType.cc
index 1aa24bf20d..5e03a313d8 100644
--- a/contrib/libs/apache/avro/impl/LogicalType.cc
+++ b/contrib/libs/apache/avro/impl/LogicalType.cc
@@ -28,22 +28,22 @@ LogicalType::Type LogicalType::type() const {
return type_;
}
-void LogicalType::setPrecision(int precision) {
+void LogicalType::setPrecision(int32_t precision) {
if (type_ != DECIMAL) {
throw Exception("Only logical type DECIMAL can have precision");
}
if (precision <= 0) {
- throw Exception(boost::format("Precision cannot be: %1%") % precision);
+ throw Exception("Precision cannot be: {}", precision);
}
precision_ = precision;
}
-void LogicalType::setScale(int scale) {
+void LogicalType::setScale(int32_t scale) {
if (type_ != DECIMAL) {
throw Exception("Only logical type DECIMAL can have scale");
}
if (scale < 0) {
- throw Exception(boost::format("Scale cannot be: %1%") % scale);
+ throw Exception("Scale cannot be: {}", scale);
}
scale_ = scale;
}
diff --git a/contrib/libs/apache/avro/impl/Node.cc b/contrib/libs/apache/avro/impl/Node.cc
index 46310d0f9e..14ce6ecf05 100644
--- a/contrib/libs/apache/avro/impl/Node.cc
+++ b/contrib/libs/apache/avro/impl/Node.cc
@@ -17,6 +17,7 @@
*/
#include <cmath>
+#include <unordered_set>
#include "Node.hh"
@@ -26,12 +27,44 @@ using std::string;
Node::~Node() = default;
+struct Name::Aliases {
+ std::vector<std::string> raw;
+ std::unordered_set<std::string> fullyQualified;
+};
+
+Name::Name() = default;
+
Name::Name(const std::string &name) {
fullname(name);
}
+Name::Name(std::string simpleName, std::string ns) : ns_(std::move(ns)), simpleName_(std::move(simpleName)) {
+ check();
+}
+
+Name::Name(const Name &other) {
+ *this = other;
+}
+
+Name &Name::operator=(const Name &other) {
+ if (this != &other) {
+ ns_ = other.ns_;
+ simpleName_ = other.simpleName_;
+ if (other.aliases_) {
+ aliases_ = std::make_unique<Aliases>(*other.aliases_);
+ }
+ }
+ return *this;
+}
+
+Name::Name(Name &&other) = default;
+
+Name &Name::operator=(Name &&other) = default;
+
+Name::~Name() = default;
+
string Name::fullname() const {
- return (ns_.empty()) ? simpleName_ : ns_ + "." + simpleName_;
+ return ns_.empty() ? simpleName_ : ns_ + "." + simpleName_;
}
void Name::fullname(const string &name) {
@@ -46,6 +79,23 @@ void Name::fullname(const string &name) {
check();
}
+const std::vector<std::string> &Name::aliases() const {
+ static const std::vector<std::string> emptyAliases;
+ return aliases_ ? aliases_->raw : emptyAliases;
+}
+
+void Name::addAlias(const std::string &alias) {
+ if (!aliases_) {
+ aliases_ = std::make_unique<Aliases>();
+ }
+ aliases_->raw.push_back(alias);
+ if (!ns_.empty() && alias.find_last_of('.') == string::npos) {
+ aliases_->fullyQualified.emplace(ns_ + "." + alias);
+ } else {
+ aliases_->fullyQualified.insert(alias);
+ }
+}
+
bool Name::operator<(const Name &n) const {
return (ns_ < n.ns_) || (!(n.ns_ < ns_) && (simpleName_ < n.simpleName_));
}
@@ -72,6 +122,16 @@ bool Name::operator==(const Name &n) const {
return ns_ == n.ns_ && simpleName_ == n.simpleName_;
}
+bool Name::equalOrAliasedBy(const Name &n) const {
+ return *this == n || (n.aliases_ && n.aliases_->fullyQualified.find(fullname()) != n.aliases_->fullyQualified.end());
+}
+
+void Name::clear() {
+ ns_.clear();
+ simpleName_.clear();
+ aliases_.reset();
+}
+
void Node::setLogicalType(LogicalType logicalType) {
checkLock();
@@ -86,14 +146,13 @@ void Node::setLogicalType(LogicalType logicalType) {
if (type_ == AVRO_FIXED) {
// Max precision that can be supported by the current size of
// the FIXED type.
- long maxPrecision = floor(log10(2.0) * (8.0 * fixedSize() - 1));
+ auto maxPrecision = static_cast<int32_t>(floor(log10(2.0) * (8.0 * static_cast<double>(fixedSize()) - 1)));
if (logicalType.precision() > maxPrecision) {
throw Exception(
- boost::format(
- "DECIMAL precision %1% is too large for the "
- "FIXED type of size %2%, precision cannot be "
- "larger than %3%")
- % logicalType.precision() % fixedSize() % maxPrecision);
+ "DECIMAL precision {} is too large for the "
+ "FIXED type of size {}, precision cannot be "
+ "larger than {}",
+ logicalType.precision(), fixedSize(), maxPrecision);
}
}
if (logicalType.scale() > logicalType.precision()) {
diff --git a/contrib/libs/apache/avro/impl/NodeImpl.cc b/contrib/libs/apache/avro/impl/NodeImpl.cc
index 5549c68fd4..e3073aaaef 100644
--- a/contrib/libs/apache/avro/impl/NodeImpl.cc
+++ b/contrib/libs/apache/avro/impl/NodeImpl.cc
@@ -71,7 +71,7 @@ string escape(const string &unescaped) {
// Wrap an indentation in a struct for ostream operator<<
struct indent {
explicit indent(size_t depth) : d(depth) {}
- int d;
+ size_t d;
};
/// ostream operator for indent
@@ -83,14 +83,15 @@ std::ostream &operator<<(std::ostream &os, indent x) {
return os;
}
-void printCustomAttributes(const CustomAttributes& customAttributes, int depth,
- std::ostream &os) {
+void printCustomAttributes(const CustomAttributes &customAttributes, size_t depth,
+ std::ostream &os) {
std::map<std::string, std::string>::const_iterator iter =
customAttributes.attributes().begin();
while (iter != customAttributes.attributes().end()) {
- os << ",\n" << indent(depth);
- customAttributes.printJson(os, iter->first);
- ++iter;
+ os << ",\n"
+ << indent(depth);
+ customAttributes.printJson(os, iter->first);
+ ++iter;
}
}
@@ -112,7 +113,7 @@ NodePrimitive::resolve(const Node &reader) const {
return RESOLVE_PROMOTABLE_TO_LONG;
}
- // fall-through intentional
+ [[fallthrough]];
case AVRO_LONG:
@@ -120,7 +121,7 @@ NodePrimitive::resolve(const Node &reader) const {
return RESOLVE_PROMOTABLE_TO_FLOAT;
}
- // fall-through intentional
+ [[fallthrough]];
case AVRO_FLOAT:
@@ -254,17 +255,34 @@ static void printName(std::ostream &os, const Name &n, size_t depth) {
void NodeRecord::printJson(std::ostream &os, size_t depth) const {
os << "{\n";
os << indent(++depth) << "\"type\": \"record\",\n";
- printName(os, nameAttribute_.get(), depth);
+ const Name &name = nameAttribute_.get();
+ printName(os, name, depth);
+
+ const auto &aliases = name.aliases();
+ if (!aliases.empty()) {
+ os << indent(depth) << "\"aliases\": [";
+ ++depth;
+ for (size_t i = 0; i < aliases.size(); ++i) {
+ if (i > 0) {
+ os << ',';
+ }
+ os << '\n'
+ << indent(depth) << "\"" << aliases[i] << "\"";
+ }
+ os << '\n'
+ << indent(--depth) << "]\n";
+ }
+
if (!getDoc().empty()) {
os << indent(depth) << R"("doc": ")"
<< escape(getDoc()) << "\",\n";
}
- os << indent(depth) << "\"fields\": [";
+ os << indent(depth) << "\"fields\": [";
size_t fields = leafAttributes_.size();
++depth;
- // Serialize "default" field:
- assert(defaultValues.empty() || (defaultValues.size() == fields));
+ assert(fieldsAliases_.empty() || (fieldsAliases_.size() == fields));
+ assert(fieldsDefaultValues_.empty() || (fieldsDefaultValues_.size() == fields));
assert(customAttributes_.size() == 0 || customAttributes_.size() == fields);
for (size_t i = 0; i < fields; ++i) {
if (i > 0) {
@@ -276,19 +294,37 @@ void NodeRecord::printJson(std::ostream &os, size_t depth) const {
os << indent(depth) << "\"type\": ";
leafAttributes_.get(i)->printJson(os, depth);
- if (!defaultValues.empty()) {
- if (!defaultValues[i].isUnion() && defaultValues[i].type() == AVRO_NULL) {
+ if (!fieldsAliases_.empty() && !fieldsAliases_[i].empty()) {
+ os << ",\n"
+ << indent(depth) << "\"aliases\": [";
+ ++depth;
+ for (size_t j = 0; j < fieldsAliases_[i].size(); ++j) {
+ if (j > 0) {
+ os << ',';
+ }
+ os << '\n'
+ << indent(depth) << "\"" << fieldsAliases_[i][j] << "\"";
+ }
+ os << '\n'
+ << indent(--depth) << ']';
+ }
+
+ // Serialize "default" field:
+ if (!fieldsDefaultValues_.empty()) {
+ if (!fieldsDefaultValues_[i].isUnion() && fieldsDefaultValues_[i].type() == AVRO_NULL) {
// No "default" field.
} else {
os << ",\n"
<< indent(depth) << "\"default\": ";
- leafAttributes_.get(i)->printDefaultToJson(defaultValues[i], os,
+ leafAttributes_.get(i)->printDefaultToJson(fieldsDefaultValues_[i], os,
depth);
}
}
- if(customAttributes_.size() == fields) {
- printCustomAttributes(customAttributes_.get(i), depth, os);
+
+ if (customAttributes_.size() == fields) {
+ printCustomAttributes(customAttributes_.get(i), depth, os);
}
+
os << '\n';
os << indent(--depth) << '}';
}
@@ -298,7 +334,7 @@ void NodeRecord::printJson(std::ostream &os, size_t depth) const {
}
void NodePrimitive::printDefaultToJson(const GenericDatum &g, std::ostream &os,
- size_t depth) const {
+ size_t) const {
assert(isPrimitive(g.type()));
switch (g.type()) {
@@ -339,13 +375,13 @@ void NodePrimitive::printDefaultToJson(const GenericDatum &g, std::ostream &os,
}
void NodeEnum::printDefaultToJson(const GenericDatum &g, std::ostream &os,
- size_t depth) const {
+ size_t) const {
assert(g.type() == AVRO_ENUM);
os << "\"" << g.value<GenericEnum>().symbol() << "\"";
}
void NodeFixed::printDefaultToJson(const GenericDatum &g, std::ostream &os,
- size_t depth) const {
+ size_t) const {
assert(g.type() == AVRO_FIXED);
// ex: "\uOOff"
// Convert to a string
@@ -424,16 +460,38 @@ void NodeRecord::printDefaultToJson(const GenericDatum &g, std::ostream &os,
<< indent(--depth) << "}";
}
}
-NodeRecord::NodeRecord(const HasName &name,
- const MultiLeaves &fields,
- const LeafNames &fieldsNames,
- std::vector<GenericDatum> dv) : NodeImplRecord(AVRO_RECORD, name, fields, fieldsNames, MultiAttributes(), NoSize()),
- defaultValues(std::move(dv)) {
+
+NodeRecord::NodeRecord(const HasName &name, const MultiLeaves &fields,
+ const LeafNames &fieldsNames, std::vector<GenericDatum> dv)
+ : NodeRecord(name, HasDoc(), fields, fieldsNames, {}, std::move(dv), MultiAttributes()) {}
+
+NodeRecord::NodeRecord(const HasName &name, const HasDoc &doc, const MultiLeaves &fields,
+ const LeafNames &fieldsNames, std::vector<GenericDatum> dv)
+ : NodeRecord(name, doc, fields, fieldsNames, {}, std::move(dv), MultiAttributes()) {}
+
+NodeRecord::NodeRecord(const HasName &name, const MultiLeaves &fields,
+ const LeafNames &fieldsNames, std::vector<std::vector<std::string>> fieldsAliases,
+ std::vector<GenericDatum> dv, const MultiAttributes &customAttributes)
+ : NodeRecord(name, HasDoc(), fields, fieldsNames, std::move(fieldsAliases), std::move(dv), customAttributes) {}
+
+NodeRecord::NodeRecord(const HasName &name, const HasDoc &doc, const MultiLeaves &fields,
+ const LeafNames &fieldsNames, std::vector<std::vector<std::string>> fieldsAliases,
+ std::vector<GenericDatum> dv, const MultiAttributes &customAttributes)
+ : NodeImplRecord(AVRO_RECORD, name, doc, fields, fieldsNames, customAttributes, NoSize()),
+ fieldsAliases_(std::move(fieldsAliases)),
+ fieldsDefaultValues_(std::move(dv)) {
+
for (size_t i = 0; i < leafNameAttributes_.size(); ++i) {
if (!nameIndex_.add(leafNameAttributes_.get(i), i)) {
- throw Exception(boost::format(
- "Cannot add duplicate field: %1%")
- % leafNameAttributes_.get(i));
+ throw Exception("Cannot add duplicate field: {}", leafNameAttributes_.get(i));
+ }
+
+ if (!fieldsAliases_.empty()) {
+ for (const auto &alias : fieldsAliases_[i]) {
+ if (!nameIndex_.add(alias, i)) {
+ throw Exception("Cannot add duplicate field: {}", alias);
+ }
+ }
}
}
}
@@ -473,9 +531,9 @@ void NodeEnum::printJson(std::ostream &os, size_t depth) const {
printName(os, nameAttribute_.get(), depth);
os << indent(depth) << "\"symbols\": [\n";
- int names = leafNameAttributes_.size();
+ auto names = leafNameAttributes_.size();
++depth;
- for (int i = 0; i < names; ++i) {
+ for (size_t i = 0; i < names; ++i) {
if (i > 0) {
os << ",\n";
}
@@ -519,9 +577,9 @@ NodeMap::NodeMap() : NodeImplMap(AVRO_MAP) {
void NodeUnion::printJson(std::ostream &os, size_t depth) const {
os << "[\n";
- int fields = leafAttributes_.size();
+ auto fields = leafAttributes_.size();
++depth;
- for (int i = 0; i < fields; ++i) {
+ for (size_t i = 0; i < fields; ++i) {
if (i > 0) {
os << ",\n";
}
diff --git a/contrib/libs/apache/avro/impl/Resolver.cc b/contrib/libs/apache/avro/impl/Resolver.cc
index d19a04ad76..5fdd551a31 100644
--- a/contrib/libs/apache/avro/impl/Resolver.cc
+++ b/contrib/libs/apache/avro/impl/Resolver.cc
@@ -51,7 +51,7 @@ class PrimitiveSkipper : public Resolver {
public:
PrimitiveSkipper() : Resolver() {}
- void parse(Reader &reader, uint8_t *address) const final {
+ void parse(Reader &reader, uint8_t *) const final {
T val;
reader.readValue(val);
DEBUG_OUT("Skipping " << val);
@@ -93,7 +93,7 @@ private:
DEBUG_OUT("Promoting " << val);
}
- void parseIt(Reader &reader, uint8_t *, const std::false_type &) const {}
+ void parseIt(Reader &, uint8_t *, const std::false_type &) const {}
template<typename T>
void parseIt(Reader &reader, uint8_t *address) const {
@@ -108,7 +108,7 @@ class PrimitiveSkipper<std::vector<uint8_t>> : public Resolver {
public:
PrimitiveSkipper() : Resolver() {}
- void parse(Reader &reader, uint8_t *address) const final {
+ void parse(Reader &reader, uint8_t *) const final {
std::vector<uint8_t> val;
reader.readBytes(val);
DEBUG_OUT("Skipping bytes");
@@ -276,9 +276,9 @@ protected:
class EnumSkipper : public Resolver {
public:
- EnumSkipper(ResolverFactory &factory, const NodePtr &writer) : Resolver() {}
+ EnumSkipper(ResolverFactory &, const NodePtr &) : Resolver() {}
- void parse(Reader &reader, uint8_t *address) const final {
+ void parse(Reader &reader, uint8_t *) const final {
int64_t val = reader.readEnum();
DEBUG_OUT("Skipping enum" << val);
}
@@ -290,9 +290,9 @@ public:
VAL
};
- EnumParser(ResolverFactory &factory, const NodePtr &writer, const NodePtr &reader, const CompoundLayout &offsets) : Resolver(),
- offset_(offsets.at(0).offset()),
- readerSize_(reader->names()) {
+ EnumParser(ResolverFactory &, const NodePtr &writer, const NodePtr &reader, const CompoundLayout &offsets) : Resolver(),
+ offset_(offsets.at(0).offset()),
+ readerSize_(reader->names()) {
const size_t writerSize = writer->names();
mapping_.reserve(writerSize);
@@ -307,7 +307,7 @@ public:
void parse(Reader &reader, uint8_t *address) const final {
auto val = static_cast<size_t>(reader.readEnum());
- assert(static_cast<size_t>(val) < mapping_.size());
+ assert(val < mapping_.size());
if (mapping_[val] < readerSize_) {
auto *location = reinterpret_cast<EnumRepresentation *>(address + offset_);
@@ -349,7 +349,7 @@ public:
*readerChoice = choiceMapping_[writerChoice];
auto *setter = reinterpret_cast<GenericUnionSetter *>(address + setFuncOffset_);
- auto *value = reinterpret_cast<uint8_t *>(address + offset_);
+ uint8_t *value = address + offset_;
uint8_t *location = (*setter)(value, *readerChoice);
resolvers_[writerChoice]->parse(reader, location);
@@ -397,7 +397,7 @@ public:
auto *choice = reinterpret_cast<int64_t *>(address + choiceOffset_);
*choice = choice_;
auto *setter = reinterpret_cast<GenericUnionSetter *>(address + setFuncOffset_);
- auto *value = reinterpret_cast<uint8_t *>(address + offset_);
+ uint8_t *value = address + offset_;
uint8_t *location = (*setter)(value, choice_);
resolver_->parse(reader, location);
@@ -413,35 +413,35 @@ protected:
class FixedSkipper : public Resolver {
public:
- FixedSkipper(ResolverFactory &factory, const NodePtr &writer) : Resolver() {
+ FixedSkipper(ResolverFactory &, const NodePtr &writer) : Resolver() {
size_ = writer->fixedSize();
}
- void parse(Reader &reader, uint8_t *address) const final {
+ void parse(Reader &reader, uint8_t *) const final {
DEBUG_OUT("Skipping fixed");
std::unique_ptr<uint8_t[]> val(new uint8_t[size_]);
reader.readFixed(&val[0], size_);
}
protected:
- int size_;
+ size_t size_;
};
class FixedParser : public Resolver {
public:
- FixedParser(ResolverFactory &factory, const NodePtr &writer, const NodePtr &reader, const CompoundLayout &offsets) : Resolver() {
+ FixedParser(ResolverFactory &, const NodePtr &writer, const NodePtr &, const CompoundLayout &offsets) : Resolver() {
size_ = writer->fixedSize();
offset_ = offsets.at(0).offset();
}
void parse(Reader &reader, uint8_t *address) const final {
DEBUG_OUT("Reading fixed");
- auto *location = reinterpret_cast<uint8_t *>(address + offset_);
+ uint8_t *location = address + offset_;
reader.readFixed(location, size_);
}
protected:
- int size_;
+ size_t size_;
size_t offset_;
};
@@ -449,7 +449,7 @@ class ResolverFactory : private boost::noncopyable {
template<typename T>
unique_ptr<Resolver>
- constructPrimitiveSkipper(const NodePtr &writer) {
+ constructPrimitiveSkipper(const NodePtr &) {
return unique_ptr<Resolver>(new PrimitiveSkipper<T>());
}
diff --git a/contrib/libs/apache/avro/impl/Schema.cc b/contrib/libs/apache/avro/impl/Schema.cc
index 3315f25258..8f42b850a0 100644
--- a/contrib/libs/apache/avro/impl/Schema.cc
+++ b/contrib/libs/apache/avro/impl/Schema.cc
@@ -18,8 +18,8 @@
#include <utility>
-#include "Schema.hh"
#include "CustomAttributes.hh"
+#include "Schema.hh"
namespace avro {
diff --git a/contrib/libs/apache/avro/impl/Stream.cc b/contrib/libs/apache/avro/impl/Stream.cc
index 63a8b4e8fc..738b1e4052 100644
--- a/contrib/libs/apache/avro/impl/Stream.cc
+++ b/contrib/libs/apache/avro/impl/Stream.cc
@@ -117,7 +117,7 @@ public:
}
};
-class MemoryOutputStream : public OutputStream {
+class MemoryOutputStream final : public OutputStream {
public:
const size_t chunkSize_;
std::vector<uint8_t *> data_;
@@ -129,7 +129,7 @@ public:
~MemoryOutputStream() final {
for (std::vector<uint8_t *>::const_iterator it = data_.begin();
it != data_.end(); ++it) {
- delete[] * it;
+ delete[] *it;
}
}
diff --git a/contrib/libs/apache/avro/impl/ValidSchema.cc b/contrib/libs/apache/avro/impl/ValidSchema.cc
index 1356d84489..d99d7e2419 100644
--- a/contrib/libs/apache/avro/impl/ValidSchema.cc
+++ b/contrib/libs/apache/avro/impl/ValidSchema.cc
@@ -16,7 +16,6 @@
* limitations under the License.
*/
-#include <boost/format.hpp>
#include <cctype>
#include <sstream>
#include <utility>
@@ -25,7 +24,6 @@
#include "Schema.hh"
#include "ValidSchema.hh"
-using boost::format;
using std::make_pair;
using std::ostringstream;
using std::shared_ptr;
@@ -37,8 +35,7 @@ using SymbolMap = std::map<Name, NodePtr>;
static bool validate(const NodePtr &node, SymbolMap &symbolMap) {
if (!node->isValid()) {
- throw Exception(format("Schema is invalid, due to bad node of type %1%")
- % node->type());
+ throw Exception("Schema is invalid, due to bad node of type {}", node->type());
}
if (node->hasName()) {
@@ -51,7 +48,7 @@ static bool validate(const NodePtr &node, SymbolMap &symbolMap) {
if (node->type() == AVRO_SYMBOLIC) {
if (!found) {
- throw Exception(format("Symbolic name \"%1%\" is unknown") % node->name());
+ throw Exception("Symbolic name \"{}\" is unknown", node->name());
}
shared_ptr<NodeSymbolic> symNode =
diff --git a/contrib/libs/apache/avro/impl/Validator.cc b/contrib/libs/apache/avro/impl/Validator.cc
index 3cd4e9e499..c00460480b 100644
--- a/contrib/libs/apache/avro/impl/Validator.cc
+++ b/contrib/libs/apache/avro/impl/Validator.cc
@@ -62,7 +62,7 @@ bool Validator::countingSetup() {
compoundStack_.pop_back();
proceed = false;
} else {
- counters_.push_back(static_cast<size_t>(count_));
+ counters_.push_back(count_);
}
}
@@ -78,7 +78,7 @@ void Validator::countingAdvance() {
setupOperation(node->leafAt(index));
} else {
compoundStack_.back().pos = 0;
- int count = --counters_.back();
+ size_t count = --counters_.back();
if (count == 0) {
counters_.pop_back();
compoundStarted_ = true;
@@ -100,14 +100,13 @@ void Validator::unionAdvance() {
waitingForCount_ = false;
NodePtr node = compoundStack_.back().node;
- if (count_ < static_cast<int64_t>(node->leaves())) {
+ if (count_ < node->leaves()) {
compoundStack_.pop_back();
setupOperation(node->leafAt(static_cast<int>(count_)));
} else {
throw Exception(
- boost::format("Union selection out of range, got %1%,"
- " expecting 0-%2%")
- % count_ % (node->leaves() - 1));
+ "Union selection out of range, got {}, expecting 0-{}",
+ count_, node->leaves() - 1);
}
}
}
@@ -117,7 +116,7 @@ void Validator::fixedAdvance() {
compoundStack_.pop_back();
}
-int Validator::nextSizeExpected() const {
+size_t Validator::nextSizeExpected() const {
return compoundStack_.back().node->fixedSize();
}
@@ -169,11 +168,9 @@ void Validator::advance() {
}
}
-void Validator::setCount(int64_t count) {
+void Validator::setCount(size_t count) {
if (!waitingForCount_) {
throw Exception("Not expecting count");
- } else if (count_ < 0) {
- throw Exception("Count cannot be negative");
}
count_ = count;
diff --git a/contrib/libs/apache/avro/impl/Zigzag.cc b/contrib/libs/apache/avro/impl/Zigzag.cc
index 538a89cbaa..7875f789bd 100644
--- a/contrib/libs/apache/avro/impl/Zigzag.cc
+++ b/contrib/libs/apache/avro/impl/Zigzag.cc
@@ -30,11 +30,11 @@ encodeInt64(int64_t input, std::array<uint8_t, 10> &output) noexcept {
auto v = val & mask;
size_t bytesOut = 0;
while (val >>= 7) {
- output[bytesOut++] = (v | 0x80);
+ output[bytesOut++] = static_cast<uint8_t>(v | 0x80);
v = val & mask;
}
- output[bytesOut++] = v;
+ output[bytesOut++] = static_cast<uint8_t>(v);
return bytesOut;
}
size_t
@@ -46,11 +46,11 @@ encodeInt32(int32_t input, std::array<uint8_t, 5> &output) noexcept {
auto v = val & mask;
size_t bytesOut = 0;
while (val >>= 7) {
- output[bytesOut++] = (v | 0x80);
+ output[bytesOut++] = static_cast<uint8_t>(v | 0x80);
v = val & mask;
}
- output[bytesOut++] = v;
+ output[bytesOut++] = static_cast<uint8_t>(v);
return bytesOut;
}
diff --git a/contrib/libs/apache/avro/impl/json/JsonDom.cc b/contrib/libs/apache/avro/impl/json/JsonDom.cc
index 5bffda2559..c2696d827a 100644
--- a/contrib/libs/apache/avro/impl/json/JsonDom.cc
+++ b/contrib/libs/apache/avro/impl/json/JsonDom.cc
@@ -25,9 +25,6 @@
#include "JsonIO.hh"
#include "Stream.hh"
-using boost::format;
-using std::string;
-
namespace avro {
namespace json {
const char *typeToString(EntityType t) {
@@ -142,8 +139,7 @@ void writeEntity(JsonGenerator<JsonNullFormatter> &g, const Entity &n) {
void Entity::ensureType(EntityType type) const {
if (type_ != type) {
- format msg = format("Invalid type. Expected \"%1%\" actual %2%") % typeToString(type) % typeToString(type_);
- throw Exception(msg);
+ throw Exception("Invalid type. Expected \"{}\" actual {}", typeToString(type), typeToString(type_));
}
}
diff --git a/contrib/libs/apache/avro/impl/json/JsonDom.hh b/contrib/libs/apache/avro/impl/json/JsonDom.hh
index 3fb5670b70..2a0695adff 100644
--- a/contrib/libs/apache/avro/impl/json/JsonDom.hh
+++ b/contrib/libs/apache/avro/impl/json/JsonDom.hh
@@ -76,22 +76,22 @@ public:
explicit Entity(size_t line = 0) : type_(EntityType::Null), line_(line) {}
// Not explicit because do want implicit conversion
// NOLINTNEXTLINE(google-explicit-constructor)
- Entity(Bool v, size_t line = 0) : type_(EntityType::Bool), value_(v), line_(line) {}
+ explicit Entity(Bool v, size_t line = 0) : type_(EntityType::Bool), value_(v), line_(line) {}
// Not explicit because do want implicit conversion
// NOLINTNEXTLINE(google-explicit-constructor)
- Entity(Long v, size_t line = 0) : type_(EntityType::Long), value_(v), line_(line) {}
+ explicit Entity(Long v, size_t line = 0) : type_(EntityType::Long), value_(v), line_(line) {}
// Not explicit because do want implicit conversion
// NOLINTNEXTLINE(google-explicit-constructor)
- Entity(Double v, size_t line = 0) : type_(EntityType::Double), value_(v), line_(line) {}
+ explicit Entity(Double v, size_t line = 0) : type_(EntityType::Double), value_(v), line_(line) {}
// Not explicit because do want implicit conversion
// NOLINTNEXTLINE(google-explicit-constructor)
- Entity(const std::shared_ptr<String> &v, size_t line = 0) : type_(EntityType::String), value_(v), line_(line) {}
+ explicit Entity(const std::shared_ptr<String> &v, size_t line = 0) : type_(EntityType::String), value_(v), line_(line) {}
// Not explicit because do want implicit conversion
// NOLINTNEXTLINE(google-explicit-constructor)
- Entity(const std::shared_ptr<Array> &v, size_t line = 0) : type_(EntityType::Arr), value_(v), line_(line) {}
+ explicit Entity(const std::shared_ptr<Array> &v, size_t line = 0) : type_(EntityType::Arr), value_(v), line_(line) {}
// Not explicit because do want implicit conversion
// NOLINTNEXTLINE(google-explicit-constructor)
- Entity(const std::shared_ptr<Object> &v, size_t line = 0) : type_(EntityType::Obj), value_(v), line_(line) {}
+ explicit Entity(const std::shared_ptr<Object> &v, size_t line = 0) : type_(EntityType::Obj), value_(v), line_(line) {}
EntityType type() const { return type_; }
diff --git a/contrib/libs/apache/avro/impl/json/JsonIO.cc b/contrib/libs/apache/avro/impl/json/JsonIO.cc
index 62549484a9..8273f392e8 100644
--- a/contrib/libs/apache/avro/impl/json/JsonIO.cc
+++ b/contrib/libs/apache/avro/impl/json/JsonIO.cc
@@ -55,7 +55,8 @@ void JsonParser::expectToken(Token tk) {
if (cur() == Token::String
&& (sv == "Infinity" || sv == "-Infinity" || sv == "NaN")) {
curToken = Token::Double;
- dv = sv == "Infinity" ? std::numeric_limits<double>::infinity() : sv == "-Infinity" ? -std::numeric_limits<double>::infinity() : std::numeric_limits<double>::quiet_NaN();
+ dv = sv == "Infinity" ? std::numeric_limits<double>::infinity() : sv == "-Infinity" ? -std::numeric_limits<double>::infinity()
+ : std::numeric_limits<double>::quiet_NaN();
return;
} else if (cur() == Token::Long) {
dv = double(lv);
@@ -146,7 +147,8 @@ JsonParser::Token JsonParser::tryNumber(char ch) {
sv.push_back(ch);
hasNext = false;
- int state = (ch == '-') ? 0 : (ch == '0') ? 1 : 2;
+ int state = (ch == '-') ? 0 : (ch == '0') ? 1
+ : 2;
for (;;) {
switch (state) {
case 0:
@@ -314,12 +316,40 @@ JsonParser::Token JsonParser::tryString() {
}
}
+// Decode the given string and return contents as UTF8-encoded bytes.
+// The input does not have the enclosing double-quotes.
string JsonParser::decodeString(const string &s, bool binary) {
string result;
- for (string::const_iterator it = s.begin(); it != s.end(); ++it) {
- char ch = *it;
+ auto it = s.cbegin();
+ const auto end = s.cend();
+ const auto readNextByte = [&]() -> char {
+ if (it == end) {
+ throw Exception("Unexpected EOF");
+ }
+ return *it++;
+ };
+ const auto unicodeParse = [&]() {
+ uint32_t n = 0;
+ for (int i = 0; i < 4; i++) {
+ auto c = readNextByte();
+ n *= 16;
+ if (isdigit(c)) {
+ n += c - '0';
+ } else if (c >= 'a' && c <= 'f') {
+ n += c - 'a' + 10;
+ } else if (c >= 'A' && c <= 'F') {
+ n += c - 'A' + 10;
+ } else {
+ throw Exception("Invalid hex character: {}", c);
+ }
+ }
+ return n;
+ };
+ while (it != end) {
+ string::const_iterator startSeq = it;
+ char ch = readNextByte();
if (ch == '\\') {
- ch = *++it;
+ ch = readNextByte();
switch (ch) {
case '"':
case '\\':
@@ -343,48 +373,48 @@ string JsonParser::decodeString(const string &s, bool binary) {
continue;
case 'u':
case 'U': {
- uint32_t n = 0;
- char e[4];
- for (char &i : e) {
- n *= 16;
- char c = *++it;
- i = c;
- if (isdigit(c)) {
- n += c - '0';
- } else if (c >= 'a' && c <= 'f') {
- n += c - 'a' + 10;
- } else if (c >= 'A' && c <= 'F') {
- n += c - 'A' + 10;
- }
- }
+ uint32_t n = unicodeParse();
if (binary) {
if (n > 0xff) {
- throw Exception(boost::format(
- "Invalid byte for binary: %1%%2%")
- % ch % string(e, 4));
+ throw Exception("Invalid byte for binary: {}{}", ch, string(startSeq, ++it));
} else {
- result.push_back(n);
+ result.push_back(static_cast<char>(n));
continue;
}
}
+ if (n >= 0xd800 && n < 0xdc00) {
+ ch = readNextByte();
+ if (ch != '\\') {
+ throw Exception("Invalid unicode sequence: {}", string(startSeq, it));
+ }
+ ch = readNextByte();
+ if (ch != 'u' && ch != 'U') {
+ throw Exception("Invalid unicode sequence: {}", string(startSeq, it));
+ }
+ uint32_t m = unicodeParse();
+ if (m < 0xdc00 || m > 0xdfff) {
+ throw Exception("Invalid unicode sequence: {}", string(startSeq, it));
+ }
+ n = 0x10000 + (((n - 0xd800) << 10) | (m - 0xdc00));
+ } else if (n >= 0xdc00 && n < 0xdfff) {
+ throw Exception("Invalid unicode sequence: {}", string(startSeq, it));
+ }
if (n < 0x80) {
- result.push_back(n);
+ result.push_back(static_cast<char>(n));
} else if (n < 0x800) {
- result.push_back((n >> 6) | 0xc0);
- result.push_back((n & 0x3f) | 0x80);
+ result.push_back(static_cast<char>((n >> 6) | 0xc0));
+ result.push_back(static_cast<char>((n & 0x3f) | 0x80));
} else if (n < 0x10000) {
- result.push_back((n >> 12) | 0xe0);
- result.push_back(((n >> 6) & 0x3f) | 0x80);
- result.push_back((n & 0x3f) | 0x80);
- } else if (n < 110000) {
- result.push_back((n >> 18) | 0xf0);
- result.push_back(((n >> 12) & 0x3f) | 0x80);
- result.push_back(((n >> 6) & 0x3f) | 0x80);
- result.push_back((n & 0x3f) | 0x80);
+ result.push_back(static_cast<char>((n >> 12) | 0xe0));
+ result.push_back(static_cast<char>(((n >> 6) & 0x3f) | 0x80));
+ result.push_back(static_cast<char>((n & 0x3f) | 0x80));
+ } else if (n < 0x110000) {
+ result.push_back(static_cast<char>((n >> 18) | 0xf0));
+ result.push_back(static_cast<char>(((n >> 12) & 0x3f) | 0x80));
+ result.push_back(static_cast<char>(((n >> 6) & 0x3f) | 0x80));
+ result.push_back(static_cast<char>((n & 0x3f) | 0x80));
} else {
- throw Exception(boost::format(
- "Invalid unicode value: %1%i%2%")
- % ch % string(e, 4));
+ throw Exception("Invalid unicode value: {}{}", n, string(startSeq, ++it));
}
}
continue;
diff --git a/contrib/libs/apache/avro/impl/json/JsonIO.hh b/contrib/libs/apache/avro/impl/json/JsonIO.hh
index 94889e5d01..203bf895fd 100644
--- a/contrib/libs/apache/avro/impl/json/JsonIO.hh
+++ b/contrib/libs/apache/avro/impl/json/JsonIO.hh
@@ -34,7 +34,7 @@ namespace avro {
namespace json {
inline char toHex(unsigned int n) {
- return (n < 10) ? (n + '0') : (n + 'a' - 10);
+ return static_cast<char>((n < 10) ? (n + '0') : (n + 'a' - 10));
}
class AVRO_DECL JsonParser : boost::noncopyable {
@@ -263,11 +263,22 @@ class AVRO_DECL JsonGenerator {
out_.write(toHex((static_cast<unsigned char>(c)) % 16));
}
- void escapeUnicode(uint32_t c) {
+ void escapeUnicode16(uint32_t c) {
out_.write('\\');
out_.write('u');
- writeHex((c >> 8) & 0xff);
- writeHex(c & 0xff);
+ writeHex(static_cast<char>((c >> 8) & 0xff));
+ writeHex(static_cast<char>(c & 0xff));
+ }
+ void escapeUnicode(uint32_t c) {
+ if (c < 0x10000) {
+ escapeUnicode16(c);
+ } else if (c < 0x110000) {
+ c -= 0x10000;
+ escapeUnicode16(((c >> 10) & 0x3ff) | 0xd800);
+ escapeUnicode16((c & 0x3ff) | 0xdc00);
+ } else {
+ throw Exception("Invalid code-point: {}", c);
+ }
}
void doEncodeString(const char *b, size_t len, bool binary) {
const char *e = b + len;
@@ -310,7 +321,6 @@ class AVRO_DECL JsonGenerator {
switch (*p) {
case '\\':
case '"':
- case '/':
escape(*p, b, p);
break;
case '\b':
diff --git a/contrib/libs/apache/avro/impl/parsing/JsonCodec.cc b/contrib/libs/apache/avro/impl/parsing/JsonCodec.cc
index 4fd0481606..84b366606f 100644
--- a/contrib/libs/apache/avro/impl/parsing/JsonCodec.cc
+++ b/contrib/libs/apache/avro/impl/parsing/JsonCodec.cc
@@ -162,8 +162,7 @@ public:
case Symbol::Kind::Field:
expectToken(in_, JsonParser::Token::String);
if (s.extra<string>() != in_.stringValue()) {
- throw Exception(boost::format("Incorrect field: expected \"%1%\" but got \"%2%\".") %
- s.extra<string>() % in_.stringValue());
+ throw Exception(R"(Incorrect field: expected "{}" but got "{}".)", s.extra<string>(), in_.stringValue());
}
break;
default:
@@ -241,8 +240,7 @@ int32_t JsonDecoder<P>::decodeInt() {
expect(JsonParser::Token::Long);
int64_t result = in_.longValue();
if (result < INT32_MIN || result > INT32_MAX) {
- throw Exception(boost::format("Value out of range for Avro int: %1%")
- % result);
+ throw Exception("Value out of range for Avro int: {}", result);
}
return static_cast<int32_t>(result);
}
@@ -496,6 +494,7 @@ public:
template<typename P, typename F>
void JsonEncoder<P, F>::init(OutputStream &os) {
out_.init(os);
+ parser_.reset();
}
template<typename P, typename F>
diff --git a/contrib/libs/apache/avro/impl/parsing/ResolvingDecoder.cc b/contrib/libs/apache/avro/impl/parsing/ResolvingDecoder.cc
index d86f6e5829..1553b8a4b6 100644
--- a/contrib/libs/apache/avro/impl/parsing/ResolvingDecoder.cc
+++ b/contrib/libs/apache/avro/impl/parsing/ResolvingDecoder.cc
@@ -19,6 +19,8 @@
#include <algorithm>
#include <map>
#include <memory>
+#include <optional>
+#include <set>
#include <string>
#include <utility>
@@ -38,17 +40,14 @@ using std::make_shared;
namespace parsing {
-using std::make_shared;
using std::shared_ptr;
using std::static_pointer_cast;
-using std::find_if;
-using std::istringstream;
using std::make_pair;
using std::map;
-using std::ostringstream;
using std::pair;
using std::reverse;
+using std::set;
using std::stack;
using std::string;
using std::unique_ptr;
@@ -67,16 +66,7 @@ class ResolvingGrammarGenerator : public ValidatingGrammarGenerator {
const NodePtr &reader, map<NodePair, ProductionPtr> &m,
map<NodePtr, ProductionPtr> &m2);
- static vector<pair<string, size_t>> fields(const NodePtr &n) {
- vector<pair<string, size_t>> result;
- size_t c = n->names();
- for (size_t i = 0; i < c; ++i) {
- result.emplace_back(n->nameAt(i), i);
- }
- return result;
- }
-
- static int bestBranch(const NodePtr &writer, const NodePtr &reader);
+ static std::optional<size_t> bestBranch(const NodePtr &writer, const NodePtr &reader);
ProductionPtr getWriterProduction(const NodePtr &n,
map<NodePtr, ProductionPtr> &m2);
@@ -101,8 +91,8 @@ Symbol ResolvingGrammarGenerator::generate(
return Symbol::rootSymbol(main, backup);
}
-int ResolvingGrammarGenerator::bestBranch(const NodePtr &writer,
- const NodePtr &reader) {
+std::optional<size_t> ResolvingGrammarGenerator::bestBranch(const NodePtr &writer,
+ const NodePtr &reader) {
Type t = writer->type();
const size_t c = reader->leaves();
@@ -141,7 +131,7 @@ int ResolvingGrammarGenerator::bestBranch(const NodePtr &writer,
break;
}
}
- return -1;
+ return std::nullopt;
}
static shared_ptr<vector<uint8_t>> getAvroBinary(
@@ -154,15 +144,6 @@ static shared_ptr<vector<uint8_t>> getAvroBinary(
return snapshot(*os);
}
-template<typename T1, typename T2>
-struct equalsFirst {
- const T1 &v_;
- explicit equalsFirst(const T1 &v) : v_(v) {}
- bool operator()(const pair<T1, T2> &p) {
- return p.first == v_;
- }
-};
-
ProductionPtr ResolvingGrammarGenerator::getWriterProduction(
const NodePtr &n, map<NodePtr, ProductionPtr> &m2) {
const NodePtr &nn = (n->type() == AVRO_SYMBOLIC) ? static_cast<const NodeSymbolic &>(*n).getNode() : n;
@@ -182,10 +163,18 @@ ProductionPtr ResolvingGrammarGenerator::resolveRecords(
map<NodePtr, ProductionPtr> &m2) {
ProductionPtr result = make_shared<Production>();
- vector<pair<string, size_t>> wf = fields(writer);
- vector<pair<string, size_t>> rf = fields(reader);
+ vector<string> wf(writer->names());
+ for (size_t i = 0; i < wf.size(); ++i) {
+ wf[i] = writer->nameAt(i);
+ }
+
+ set<size_t> rf;
+ for (size_t i = 0; i < reader->names(); ++i) {
+ rf.emplace(i);
+ }
+
vector<size_t> fieldOrder;
- fieldOrder.reserve(reader->names());
+ fieldOrder.reserve(rf.size());
/*
* We look for all writer fields in the reader. If found, recursively
@@ -193,19 +182,15 @@ ProductionPtr ResolvingGrammarGenerator::resolveRecords(
* If no matching field is found for reader, arrange to skip the writer
* field.
*/
- for (vector<pair<string, size_t>>::const_iterator it = wf.begin();
- it != wf.end(); ++it) {
- auto it2 = find_if(rf.begin(), rf.end(),
- equalsFirst<string, size_t>(it->first));
- if (it2 != rf.end()) {
- ProductionPtr p = doGenerate2(writer->leafAt(it->second),
- reader->leafAt(it2->second), m, m2);
+ for (size_t wi = 0; wi != wf.size(); ++wi) {
+ size_t ri;
+ if (reader->nameIndex(wf[wi], ri)) {
+ ProductionPtr p = doGenerate2(writer->leafAt(wi), reader->leafAt(ri), m, m2);
copy(p->rbegin(), p->rend(), back_inserter(*result));
- fieldOrder.push_back(it2->second);
- rf.erase(it2);
+ fieldOrder.push_back(ri);
+ rf.erase(ri);
} else {
- ProductionPtr p = getWriterProduction(
- writer->leafAt(it->second), m2);
+ ProductionPtr p = getWriterProduction(writer->leafAt(wi), m2);
result->push_back(Symbol::skipStart());
if (p->size() == 1) {
result->push_back((*p)[0]);
@@ -216,24 +201,21 @@ ProductionPtr ResolvingGrammarGenerator::resolveRecords(
}
/*
- * Examine the reader fields left out, (i.e. those didn't have corresponding
+ * Examine the reader fields left out (i.e. those didn't have corresponding
* writer field).
*/
- for (vector<pair<string, size_t>>::const_iterator it = rf.begin();
- it != rf.end(); ++it) {
-
- NodePtr s = reader->leafAt(it->second);
- fieldOrder.push_back(it->second);
+ for (const auto ri : rf) {
+ NodePtr s = reader->leafAt(ri);
+ fieldOrder.push_back(ri);
if (s->type() == AVRO_SYMBOLIC) {
s = resolveSymbol(s);
}
shared_ptr<vector<uint8_t>> defaultBinary =
- getAvroBinary(reader->defaultValueAt(it->second));
+ getAvroBinary(reader->defaultValueAt(ri));
result->push_back(Symbol::defaultStartAction(defaultBinary));
- map<NodePair, shared_ptr<Production>>::const_iterator it2 =
- m.find(NodePair(s, s));
- ProductionPtr p = (it2 == m.end()) ? doGenerate2(s, s, m, m2) : it2->second;
+ auto it = m.find(NodePair(s, s));
+ ProductionPtr p = it == m.end() ? doGenerate2(s, s, m, m2) : it->second;
copy(p->rbegin(), p->rend(), back_inserter(*result));
result->push_back(Symbol::defaultEndAction());
}
@@ -289,7 +271,7 @@ ProductionPtr ResolvingGrammarGenerator::doGenerate2(
case AVRO_BYTES:
return make_shared<Production>(1, Symbol::bytesSymbol());
case AVRO_FIXED:
- if (writer->name() == reader->name() && writer->fixedSize() == reader->fixedSize()) {
+ if (writer->name().equalOrAliasedBy(reader->name()) && writer->fixedSize() == reader->fixedSize()) {
ProductionPtr result = make_shared<Production>();
result->push_back(Symbol::sizeCheckSymbol(reader->fixedSize()));
result->push_back(Symbol::fixedSymbol());
@@ -298,7 +280,7 @@ ProductionPtr ResolvingGrammarGenerator::doGenerate2(
}
break;
case AVRO_RECORD:
- if (writer->name() == reader->name()) {
+ if (writer->name().equalOrAliasedBy(reader->name())) {
const pair<NodePtr, NodePtr> key(writer, reader);
map<NodePair, ProductionPtr>::const_iterator kp = m.find(key);
if (kp != m.end()) {
@@ -312,7 +294,7 @@ ProductionPtr ResolvingGrammarGenerator::doGenerate2(
break;
case AVRO_ENUM:
- if (writer->name() == reader->name()) {
+ if (writer->name().equalOrAliasedBy(reader->name())) {
ProductionPtr result = make_shared<Production>();
result->push_back(Symbol::enumAdjustSymbol(writer, reader));
result->push_back(Symbol::enumSymbol());
@@ -385,16 +367,18 @@ ProductionPtr ResolvingGrammarGenerator::doGenerate2(
if (writerType == AVRO_INT || writerType == AVRO_LONG
|| writerType == AVRO_FLOAT) {
return make_shared<Production>(1,
- Symbol::resolveSymbol(writerType == AVRO_INT ? Symbol::Kind::Int : writerType == AVRO_LONG ? Symbol::Kind::Long : Symbol::Kind::Float, Symbol::Kind::Double));
+ Symbol::resolveSymbol(writerType == AVRO_INT ? Symbol::Kind::Int : writerType == AVRO_LONG ? Symbol::Kind::Long
+ : Symbol::Kind::Float,
+ Symbol::Kind::Double));
}
break;
case AVRO_UNION: {
- int j = bestBranch(writer, reader);
- if (j >= 0) {
- ProductionPtr p = doGenerate2(writer, reader->leafAt(j), m, m2);
+ auto j = bestBranch(writer, reader);
+ if (j) {
+ ProductionPtr p = doGenerate2(writer, reader->leafAt(*j), m, m2);
ProductionPtr result = make_shared<Production>();
- result->push_back(Symbol::unionAdjustSymbol(j, p));
+ result->push_back(Symbol::unionAdjustSymbol(*j, p));
result->push_back(Symbol::unionSymbol());
return result;
}
@@ -530,13 +514,18 @@ int64_t ResolvingDecoderImpl<P>::decodeLong() {
template<typename P>
float ResolvingDecoderImpl<P>::decodeFloat() {
Symbol::Kind k = parser_.advance(Symbol::Kind::Float);
- return k == Symbol::Kind::Int ? base_->decodeInt() : k == Symbol::Kind::Long ? base_->decodeLong() : base_->decodeFloat();
+ return k == Symbol::Kind::Int ? static_cast<float>(base_->decodeInt())
+ : k == Symbol::Kind::Long ? static_cast<float>(base_->decodeLong())
+ : base_->decodeFloat();
}
template<typename P>
double ResolvingDecoderImpl<P>::decodeDouble() {
Symbol::Kind k = parser_.advance(Symbol::Kind::Double);
- return k == Symbol::Kind::Int ? base_->decodeInt() : k == Symbol::Kind::Long ? base_->decodeLong() : k == Symbol::Kind::Float ? base_->decodeFloat() : base_->decodeDouble();
+ return k == Symbol::Kind::Int ? static_cast<double>(base_->decodeInt())
+ : k == Symbol::Kind::Long ? static_cast<double>(base_->decodeLong())
+ : k == Symbol::Kind::Float ? base_->decodeFloat()
+ : base_->decodeDouble();
}
template<typename P>
diff --git a/contrib/libs/apache/avro/impl/parsing/Symbol.cc b/contrib/libs/apache/avro/impl/parsing/Symbol.cc
index b7a35517af..fe87c5205b 100644
--- a/contrib/libs/apache/avro/impl/parsing/Symbol.cc
+++ b/contrib/libs/apache/avro/impl/parsing/Symbol.cc
@@ -75,7 +75,7 @@ Symbol Symbol::enumAdjustSymbol(const NodePtr &writer, const NodePtr &reader) {
}
size_t wc = writer->names();
- vector<int> adj;
+ vector<int> adj; // enums are encoded as ints
adj.reserve(wc);
vector<string> err;
@@ -85,10 +85,10 @@ Symbol Symbol::enumAdjustSymbol(const NodePtr &writer, const NodePtr &reader) {
vector<string>::const_iterator it = find(rs.begin(), rs.end(), s);
if (it == rs.end()) {
auto pos = err.size() + 1;
- adj.push_back(-pos);
+ adj.push_back(static_cast<int>(-pos));
err.push_back(s);
} else {
- adj.push_back(it - rs.begin());
+ adj.push_back(static_cast<int>(it - rs.begin()));
}
}
return Symbol(Kind::EnumAdjust, make_pair(adj, err));
diff --git a/contrib/libs/apache/avro/impl/parsing/Symbol.hh b/contrib/libs/apache/avro/impl/parsing/Symbol.hh
index 21e46a85ae..c8760c34df 100644
--- a/contrib/libs/apache/avro/impl/parsing/Symbol.hh
+++ b/contrib/libs/apache/avro/impl/parsing/Symbol.hh
@@ -363,6 +363,10 @@ template<typename Handler>
class SimpleParser {
Decoder *decoder_;
Handler &handler_;
+ /*
+ * parsingStack always has root at the bottom of it.
+ * So it is safe to call top() on it.
+ */
std::stack<Symbol> parsingStack;
static void throwMismatch(Symbol::Kind actual, Symbol::Kind expected) {
@@ -742,6 +746,14 @@ public:
} else if (s.kind() == Symbol::Kind::SkipStart) {
parsingStack.pop();
skip(*decoder_);
+ } else if (s.kind() == Symbol::Kind::Indirect) {
+ ProductionPtr pp = s.extra<ProductionPtr>();
+ parsingStack.pop();
+ append(pp);
+ } else if (s.kind() == Symbol::Kind::Symbolic) {
+ ProductionPtr pp(s.extra<std::weak_ptr<Production>>());
+ parsingStack.pop();
+ append(pp);
} else {
break;
}
@@ -756,6 +768,8 @@ public:
while (parsingStack.size() > 1) {
parsingStack.pop();
}
+ Symbol &s = parsingStack.top();
+ append(boost::tuples::get<0>(*s.extrap<RootInfo>()));
}
};
diff --git a/contrib/libs/apache/avro/impl/parsing/ValidatingCodec.cc b/contrib/libs/apache/avro/impl/parsing/ValidatingCodec.cc
index cfb82225f1..7a1f8d91bc 100644
--- a/contrib/libs/apache/avro/impl/parsing/ValidatingCodec.cc
+++ b/contrib/libs/apache/avro/impl/parsing/ValidatingCodec.cc
@@ -152,7 +152,7 @@ ProductionPtr ValidatingGrammarGenerator::doGenerate(const NodePtr &n,
}
struct DummyHandler {
- static size_t handle(const Symbol &s) {
+ static size_t handle(const Symbol &) {
return 0;
}
};
@@ -502,6 +502,7 @@ void ValidatingEncoder<P>::setItemCount(size_t count) {
template<typename P>
void ValidatingEncoder<P>::startItem() {
+ parser_.processImplicitActions();
if (parser_.top() != Symbol::Kind::Repeater) {
throw Exception("startItem at not an item boundary");
}
diff --git a/contrib/libs/apache/avro/api/AvroTraits.hh b/contrib/libs/apache/avro/include/avro/AvroTraits.hh
index 465470a938..465470a938 100644
--- a/contrib/libs/apache/avro/api/AvroTraits.hh
+++ b/contrib/libs/apache/avro/include/avro/AvroTraits.hh
diff --git a/contrib/libs/apache/avro/api/Compiler.hh b/contrib/libs/apache/avro/include/avro/Compiler.hh
index bdcbb355e2..bdcbb355e2 100644
--- a/contrib/libs/apache/avro/api/Compiler.hh
+++ b/contrib/libs/apache/avro/include/avro/Compiler.hh
diff --git a/contrib/libs/apache/avro/api/Config.hh b/contrib/libs/apache/avro/include/avro/Config.hh
index dd2438debb..dd2438debb 100644
--- a/contrib/libs/apache/avro/api/Config.hh
+++ b/contrib/libs/apache/avro/include/avro/Config.hh
diff --git a/contrib/libs/apache/avro/api/CustomAttributes.hh b/contrib/libs/apache/avro/include/avro/CustomAttributes.hh
index adad6f6de0..b4cc6fbbaf 100644
--- a/contrib/libs/apache/avro/api/CustomAttributes.hh
+++ b/contrib/libs/apache/avro/include/avro/CustomAttributes.hh
@@ -19,11 +19,11 @@
#ifndef avro_CustomAttributes_hh__
#define avro_CustomAttributes_hh__
+#include "Config.hh"
#include <boost/optional.hpp>
#include <iostream>
#include <map>
#include <string>
-#include "Config.hh"
namespace avro {
@@ -31,7 +31,7 @@ namespace avro {
// Each attribute is represented by a unique name and value.
// User is supposed to create CustomAttributes object and then add it to Schema.
class AVRO_DECL CustomAttributes {
- public:
+public:
// Retrieves the custom attribute json entity for that attributeName, returns an
// null if the attribute doesn't exist.
boost::optional<std::string> getAttribute(const std::string &name) const;
@@ -45,12 +45,12 @@ class AVRO_DECL CustomAttributes {
}
// Prints the attribute value for the specific attribute.
- void printJson(std::ostream& os, const std::string &name) const;
+ void printJson(std::ostream &os, const std::string &name) const;
- private:
+private:
std::map<std::string, std::string> attributes_;
};
-} // namespace avro
+} // namespace avro
#endif
diff --git a/contrib/libs/apache/avro/api/DataFile.hh b/contrib/libs/apache/avro/include/avro/DataFile.hh
index 94a1dab8e3..94a1dab8e3 100644
--- a/contrib/libs/apache/avro/api/DataFile.hh
+++ b/contrib/libs/apache/avro/include/avro/DataFile.hh
diff --git a/contrib/libs/apache/avro/api/Decoder.hh b/contrib/libs/apache/avro/include/avro/Decoder.hh
index 77b3f9489f..77b3f9489f 100644
--- a/contrib/libs/apache/avro/api/Decoder.hh
+++ b/contrib/libs/apache/avro/include/avro/Decoder.hh
diff --git a/contrib/libs/apache/avro/api/Encoder.hh b/contrib/libs/apache/avro/include/avro/Encoder.hh
index 4ba5fa7594..4ba5fa7594 100644
--- a/contrib/libs/apache/avro/api/Encoder.hh
+++ b/contrib/libs/apache/avro/include/avro/Encoder.hh
diff --git a/contrib/libs/apache/avro/api/Exception.hh b/contrib/libs/apache/avro/include/avro/Exception.hh
index 691869bed8..234a1c9302 100644
--- a/contrib/libs/apache/avro/api/Exception.hh
+++ b/contrib/libs/apache/avro/include/avro/Exception.hh
@@ -20,19 +20,21 @@
#define avro_Exception_hh__
#include "Config.hh"
-#include <boost/format.hpp>
+#include <fmt/core.h>
#include <stdexcept>
namespace avro {
/// Wrapper for std::runtime_error that provides convenience constructor
-/// for boost::format objects
+/// for formatted messages
class AVRO_DECL Exception : public virtual std::runtime_error {
public:
explicit Exception(const std::string &msg) : std::runtime_error(msg) {}
- explicit Exception(const boost::format &msg) : std::runtime_error(boost::str(msg)) {}
+ template<typename... Args>
+ Exception(fmt::format_string<Args...> fmt, Args &&...args)
+ : std::runtime_error(fmt::format(fmt, std::forward<Args>(args)...)) {}
};
} // namespace avro
diff --git a/contrib/libs/apache/avro/api/Generic.hh b/contrib/libs/apache/avro/include/avro/Generic.hh
index f35e8cf689..f35e8cf689 100644
--- a/contrib/libs/apache/avro/api/Generic.hh
+++ b/contrib/libs/apache/avro/include/avro/Generic.hh
diff --git a/contrib/libs/apache/avro/api/GenericDatum.hh b/contrib/libs/apache/avro/include/avro/GenericDatum.hh
index f58fd94995..a6ce2463ca 100644
--- a/contrib/libs/apache/avro/api/GenericDatum.hh
+++ b/contrib/libs/apache/avro/include/avro/GenericDatum.hh
@@ -19,17 +19,12 @@
#ifndef avro_GenericDatum_hh__
#define avro_GenericDatum_hh__
+#include <any>
#include <cstdint>
#include <map>
#include <string>
#include <vector>
-#if __cplusplus >= 201703L
-#include <any>
-#else
-#include "boost/any.hpp"
-#endif
-
#include "LogicalType.hh"
#include "Node.hh"
#include "ValidSchema.hh"
@@ -62,11 +57,7 @@ class AVRO_DECL GenericDatum {
protected:
Type type_;
LogicalType logicalType_;
-#if __cplusplus >= 201703L
std::any value_;
-#else
- boost::any value_;
-#endif
explicit GenericDatum(Type t)
: type_(t), logicalType_(LogicalType::NONE) {}
@@ -192,11 +183,7 @@ public:
template<typename T>
GenericDatum(const NodePtr &schema, const T &v) : type_(schema->type()), logicalType_(schema->logicalType()) {
init(schema);
-#if __cplusplus >= 201703L
*std::any_cast<T>(&value_) = v;
-#else
- *boost::any_cast<T>(&value_) = v;
-#endif
}
/**
@@ -539,65 +526,33 @@ public:
};
inline Type GenericDatum::type() const {
- return (type_ == AVRO_UNION) ?
-#if __cplusplus >= 201703L
- std::any_cast<GenericUnion>(&value_)->datum().type()
- :
-#else
- boost::any_cast<GenericUnion>(&value_)->datum().type()
- :
-#endif
- type_;
+ return (type_ == AVRO_UNION) ? std::any_cast<GenericUnion>(&value_)->datum().type()
+ : type_;
}
inline LogicalType GenericDatum::logicalType() const {
- return (type_ == AVRO_UNION) ?
-#if __cplusplus >= 201703L
- std::any_cast<GenericUnion>(&value_)->datum().logicalType() :
-#else
- boost::any_cast<GenericUnion>(&value_)->datum().logicalType() :
-#endif
- logicalType_;
+ return (type_ == AVRO_UNION) ? std::any_cast<GenericUnion>(&value_)->datum().logicalType()
+ : logicalType_;
}
template<typename T>
T &GenericDatum::value() {
- return (type_ == AVRO_UNION) ?
-#if __cplusplus >= 201703L
- std::any_cast<GenericUnion>(&value_)->datum().value<T>()
+ return (type_ == AVRO_UNION) ? std::any_cast<GenericUnion>(&value_)->datum().value<T>()
: *std::any_cast<T>(&value_);
-#else
- boost::any_cast<GenericUnion>(&value_)->datum().value<T>()
- : *boost::any_cast<T>(&value_);
-#endif
}
template<typename T>
const T &GenericDatum::value() const {
- return (type_ == AVRO_UNION) ?
-#if __cplusplus >= 201703L
- std::any_cast<GenericUnion>(&value_)->datum().value<T>()
+ return (type_ == AVRO_UNION) ? std::any_cast<GenericUnion>(&value_)->datum().value<T>()
: *std::any_cast<T>(&value_);
-#else
- boost::any_cast<GenericUnion>(&value_)->datum().value<T>()
- : *boost::any_cast<T>(&value_);
-#endif
}
inline size_t GenericDatum::unionBranch() const {
-#if __cplusplus >= 201703L
return std::any_cast<GenericUnion>(&value_)->currentBranch();
-#else
- return boost::any_cast<GenericUnion>(&value_)->currentBranch();
-#endif
}
inline void GenericDatum::selectBranch(size_t branch) {
-#if __cplusplus >= 201703L
std::any_cast<GenericUnion>(&value_)->selectBranch(branch);
-#else
- boost::any_cast<GenericUnion>(&value_)->selectBranch(branch);
-#endif
}
} // namespace avro
diff --git a/contrib/libs/apache/avro/api/Layout.hh b/contrib/libs/apache/avro/include/avro/Layout.hh
index 56d2c1d9c7..56d2c1d9c7 100644
--- a/contrib/libs/apache/avro/api/Layout.hh
+++ b/contrib/libs/apache/avro/include/avro/Layout.hh
diff --git a/contrib/libs/apache/avro/api/LogicalType.hh b/contrib/libs/apache/avro/include/avro/LogicalType.hh
index 4d06e74f63..ff430fd086 100644
--- a/contrib/libs/apache/avro/api/LogicalType.hh
+++ b/contrib/libs/apache/avro/include/avro/LogicalType.hh
@@ -47,17 +47,17 @@ public:
// Precision must be positive and scale must be either positive or zero. The
// setters will throw an exception if they are called on any type other
// than DECIMAL.
- void setPrecision(int precision);
- int precision() const { return precision_; }
- void setScale(int scale);
- int scale() const { return scale_; }
+ void setPrecision(int32_t precision);
+ int32_t precision() const { return precision_; }
+ void setScale(int32_t scale);
+ int32_t scale() const { return scale_; }
void printJson(std::ostream &os) const;
private:
Type type_;
- int precision_;
- int scale_;
+ int32_t precision_;
+ int32_t scale_;
};
} // namespace avro
diff --git a/contrib/libs/apache/avro/api/Node.hh b/contrib/libs/apache/avro/include/avro/Node.hh
index 3f5fe5b05d..f76078b052 100644
--- a/contrib/libs/apache/avro/api/Node.hh
+++ b/contrib/libs/apache/avro/include/avro/Node.hh
@@ -40,30 +40,38 @@ class GenericDatum;
using NodePtr = std::shared_ptr<Node>;
class AVRO_DECL Name {
+ struct Aliases;
+
std::string ns_;
std::string simpleName_;
+ std::unique_ptr<Aliases> aliases_;
public:
- Name() = default;
- explicit Name(const std::string &fullname);
- Name(std::string simpleName, std::string ns) : ns_(std::move(ns)), simpleName_(std::move(simpleName)) { check(); }
+ Name();
+ explicit Name(const std::string &name);
+ Name(std::string simpleName, std::string ns);
+ Name(const Name &other);
+ Name &operator=(const Name &other);
+ Name(Name &&other);
+ Name &operator=(Name &&other);
+ ~Name();
std::string fullname() const;
const std::string &ns() const { return ns_; }
const std::string &simpleName() const { return simpleName_; }
+ const std::vector<std::string> &aliases() const;
void ns(std::string n) { ns_ = std::move(n); }
void simpleName(std::string n) { simpleName_ = std::move(n); }
void fullname(const std::string &n);
+ void addAlias(const std::string &alias);
bool operator<(const Name &n) const;
void check() const;
bool operator==(const Name &n) const;
bool operator!=(const Name &n) const { return !((*this) == n); }
- void clear() {
- ns_.clear();
- simpleName_.clear();
- }
+ bool equalOrAliasedBy(const Name &n) const;
+ void clear();
explicit operator std::string() const {
return fullname();
}
@@ -136,7 +144,7 @@ public:
virtual size_t leaves() const = 0;
virtual const NodePtr &leafAt(size_t index) const = 0;
virtual const GenericDatum &defaultValueAt(size_t index) {
- throw Exception(boost::format("No default value at: %1%") % index);
+ throw Exception("No default value at: {}", index);
}
void addName(const std::string &name) {
@@ -154,7 +162,7 @@ public:
}
virtual size_t fixedSize() const = 0;
- void addCustomAttributesForField(const CustomAttributes& customAttributes) {
+ void addCustomAttributesForField(const CustomAttributes &customAttributes) {
checkLock();
doAddCustomAttribute(customAttributes);
}
@@ -191,7 +199,7 @@ protected:
virtual void doAddLeaf(const NodePtr &newLeaf) = 0;
virtual void doAddName(const std::string &name) = 0;
virtual void doSetFixedSize(size_t size) = 0;
- virtual void doAddCustomAttribute(const CustomAttributes& customAttributes) = 0;
+ virtual void doAddCustomAttribute(const CustomAttributes &customAttributes) = 0;
private:
const Type type_;
@@ -208,4 +216,12 @@ inline std::ostream &operator<<(std::ostream &os, const avro::Node &n) {
}
} // namespace std
+template<>
+struct fmt::formatter<avro::Name> : fmt::formatter<std::string> {
+ template<typename FormatContext>
+ auto format(const avro::Name &n, FormatContext &ctx) {
+ return fmt::formatter<std::string>::format(n.fullname(), ctx);
+ }
+};
+
#endif
diff --git a/contrib/libs/apache/avro/api/NodeConcepts.hh b/contrib/libs/apache/avro/include/avro/NodeConcepts.hh
index 155c8ed919..2f219cd94c 100644
--- a/contrib/libs/apache/avro/api/NodeConcepts.hh
+++ b/contrib/libs/apache/avro/include/avro/NodeConcepts.hh
@@ -159,11 +159,11 @@ private:
template<typename T>
struct NameIndexConcept {
- bool lookup(const std::string &name, size_t &index) const {
+ bool lookup(const std::string &, size_t &) const {
throw Exception("Name index does not exist");
}
- bool add(const ::std::string &name, size_t) {
+ bool add(const ::std::string &, size_t) {
throw Exception("Name index does not exist");
}
};
diff --git a/contrib/libs/apache/avro/api/NodeImpl.hh b/contrib/libs/apache/avro/include/avro/NodeImpl.hh
index ef1c1dac9b..3e5546c94e 100644
--- a/contrib/libs/apache/avro/api/NodeImpl.hh
+++ b/contrib/libs/apache/avro/include/avro/NodeImpl.hh
@@ -30,9 +30,9 @@
#include <sstream>
#include <utility>
+#include "CustomAttributes.hh"
#include "Node.hh"
#include "NodeConcepts.hh"
-#include "CustomAttributes.hh"
namespace avro {
@@ -129,7 +129,7 @@ protected:
void doAddName(const std::string &name) override {
if (!nameIndex_.add(name, leafNameAttributes_.size())) {
- throw Exception(boost::format("Cannot add duplicate name: %1%") % name);
+ throw Exception("Cannot add duplicate name: {}", name);
}
leafNameAttributes_.add(name);
}
@@ -161,7 +161,7 @@ protected:
void setLeafToSymbolic(size_t index, const NodePtr &node) override;
void doAddCustomAttribute(const CustomAttributes &customAttributes) override {
- customAttributes_.add(customAttributes);
+ customAttributes_.add(customAttributes);
}
SchemaResolution furtherResolution(const Node &reader) const {
@@ -226,8 +226,8 @@ using LeafNames = concepts::MultiAttribute<std::string>;
using MultiAttributes = concepts::MultiAttribute<CustomAttributes>;
using NoAttributes = concepts::NoAttribute<CustomAttributes>;
-using NoSize = concepts::NoAttribute<int>;
-using HasSize = concepts::SingleAttribute<int>;
+using NoSize = concepts::NoAttribute<size_t>;
+using HasSize = concepts::SingleAttribute<size_t>;
using NodeImplPrimitive = NodeImpl<NoName, NoLeaves, NoLeafNames, MultiAttributes, NoSize>;
using NodeImplSymbolic = NodeImpl<HasName, NoLeaves, NoLeafNames, NoAttributes, NoSize>;
@@ -280,7 +280,7 @@ public:
NodePtr getNode() const {
NodePtr node = actualNode_.lock();
if (!node) {
- throw Exception(boost::format("Could not follow symbol %1%") % name());
+ throw Exception("Could not follow symbol {}", name());
}
return node;
}
@@ -294,42 +294,30 @@ protected:
};
class AVRO_DECL NodeRecord : public NodeImplRecord {
- std::vector<GenericDatum> defaultValues;
+ std::vector<std::vector<std::string>> fieldsAliases_;
+ std::vector<GenericDatum> fieldsDefaultValues_;
public:
NodeRecord() : NodeImplRecord(AVRO_RECORD) {}
+
NodeRecord(const HasName &name, const MultiLeaves &fields,
- const LeafNames &fieldsNames,
- std::vector<GenericDatum> dv);
+ const LeafNames &fieldsNames, std::vector<GenericDatum> dv);
NodeRecord(const HasName &name, const HasDoc &doc, const MultiLeaves &fields,
- const LeafNames &fieldsNames,
- std::vector<GenericDatum> dv) : NodeImplRecord(AVRO_RECORD, name, doc, fields, fieldsNames, MultiAttributes(), NoSize()),
- defaultValues(std::move(dv)) {
- leafNameCheck();
- }
+ const LeafNames &fieldsNames, std::vector<GenericDatum> dv);
NodeRecord(const HasName &name, const MultiLeaves &fields,
- const LeafNames &fieldsNames,
- const std::vector<GenericDatum>& dv,
- const MultiAttributes &customAttributes) :
- NodeImplRecord(AVRO_RECORD, name, fields, fieldsNames, customAttributes, NoSize()),
- defaultValues(dv) {
- leafNameCheck();
- }
+ const LeafNames &fieldsNames, std::vector<std::vector<std::string>> fieldsAliases,
+ std::vector<GenericDatum> dv, const MultiAttributes &customAttributes);
NodeRecord(const HasName &name, const HasDoc &doc, const MultiLeaves &fields,
- const LeafNames &fieldsNames,
- const std::vector<GenericDatum>& dv,
- const MultiAttributes &customAttributes) :
- NodeImplRecord(AVRO_RECORD, name, doc, fields, fieldsNames, customAttributes, NoSize()),
- defaultValues(dv) {
- leafNameCheck();
- }
+ const LeafNames &fieldsNames, std::vector<std::vector<std::string>> fieldsAliases,
+ std::vector<GenericDatum> dv, const MultiAttributes &customAttributes);
void swap(NodeRecord &r) {
NodeImplRecord::swap(r);
- defaultValues.swap(r.defaultValues);
+ fieldsAliases_.swap(r.fieldsAliases_);
+ fieldsDefaultValues_.swap(r.fieldsDefaultValues_);
}
SchemaResolution resolve(const Node &reader) const override;
@@ -337,29 +325,14 @@ public:
void printJson(std::ostream &os, size_t depth) const override;
bool isValid() const override {
- return ((nameAttribute_.size() == 1) &&
- (leafAttributes_.size() == leafNameAttributes_.size()) &&
- (customAttributes_.size() == 0 ||
- customAttributes_.size() == leafAttributes_.size()));
+ return ((nameAttribute_.size() == 1) && (leafAttributes_.size() == leafNameAttributes_.size()) && (customAttributes_.size() == 0 || customAttributes_.size() == leafAttributes_.size()));
}
const GenericDatum &defaultValueAt(size_t index) override {
- return defaultValues[index];
+ return fieldsDefaultValues_[index];
}
void printDefaultToJson(const GenericDatum &g, std::ostream &os, size_t depth) const override;
-
-private:
- // check if leaf name is valid Name and is not duplicate
- void leafNameCheck() {
- for (size_t i = 0; i < leafNameAttributes_.size(); ++i) {
- if (!nameIndex_.add(leafNameAttributes_.get(i), i)) {
- throw Exception(boost::format(
- "Cannot add duplicate field: %1%")
- % leafNameAttributes_.get(i));
- }
- }
- }
};
class AVRO_DECL NodeEnum : public NodeImplEnum {
@@ -369,7 +342,7 @@ public:
NodeEnum(const HasName &name, const LeafNames &symbols) : NodeImplEnum(AVRO_ENUM, name, NoLeaves(), symbols, NoAttributes(), NoSize()) {
for (size_t i = 0; i < leafNameAttributes_.size(); ++i) {
if (!nameIndex_.add(leafNameAttributes_.get(i), i)) {
- throw Exception(boost::format("Cannot add duplicate enum: %1%") % leafNameAttributes_.get(i));
+ throw Exception("Cannot add duplicate enum: {}", leafNameAttributes_.get(i));
}
}
}
diff --git a/contrib/libs/apache/avro/api/Reader.hh b/contrib/libs/apache/avro/include/avro/Reader.hh
index 588a912648..62d81c2365 100644
--- a/contrib/libs/apache/avro/api/Reader.hh
+++ b/contrib/libs/apache/avro/include/avro/Reader.hh
@@ -84,7 +84,7 @@ public:
union {
double d;
uint64_t i;
- } v = { 0 };
+ } v = {0};
reader_.read(v.i);
val = v.d;
}
@@ -176,15 +176,15 @@ private:
return encoded;
}
- int64_t readSize() {
+ size_t readSize() {
uint64_t encoded = readVarInt();
- int64_t size = decodeZigzag64(encoded);
+ auto size = static_cast<size_t>(decodeZigzag64(encoded));
return size;
}
- int64_t readCount() {
+ size_t readCount() {
validator_.checkTypeExpected(AVRO_LONG);
- int64_t count = readSize();
+ size_t count = readSize();
validator_.setCount(count);
return count;
}
diff --git a/contrib/libs/apache/avro/api/Resolver.hh b/contrib/libs/apache/avro/include/avro/Resolver.hh
index 06c33e76c6..06c33e76c6 100644
--- a/contrib/libs/apache/avro/api/Resolver.hh
+++ b/contrib/libs/apache/avro/include/avro/Resolver.hh
diff --git a/contrib/libs/apache/avro/api/ResolverSchema.hh b/contrib/libs/apache/avro/include/avro/ResolverSchema.hh
index d641d08f8c..d641d08f8c 100644
--- a/contrib/libs/apache/avro/api/ResolverSchema.hh
+++ b/contrib/libs/apache/avro/include/avro/ResolverSchema.hh
diff --git a/contrib/libs/apache/avro/api/Schema.hh b/contrib/libs/apache/avro/include/avro/Schema.hh
index 163b50049c..6eec0e8b6e 100644
--- a/contrib/libs/apache/avro/api/Schema.hh
+++ b/contrib/libs/apache/avro/include/avro/Schema.hh
@@ -20,8 +20,8 @@
#define avro_Schema_hh__
#include "Config.hh"
-#include "NodeImpl.hh"
#include "CustomAttributes.hh"
+#include "NodeImpl.hh"
#include <string>
/// \file
diff --git a/contrib/libs/apache/avro/api/SchemaResolution.hh b/contrib/libs/apache/avro/include/avro/SchemaResolution.hh
index 905d1b49cf..905d1b49cf 100644
--- a/contrib/libs/apache/avro/api/SchemaResolution.hh
+++ b/contrib/libs/apache/avro/include/avro/SchemaResolution.hh
diff --git a/contrib/libs/apache/avro/api/Specific.hh b/contrib/libs/apache/avro/include/avro/Specific.hh
index 247d86da72..247d86da72 100644
--- a/contrib/libs/apache/avro/api/Specific.hh
+++ b/contrib/libs/apache/avro/include/avro/Specific.hh
diff --git a/contrib/libs/apache/avro/api/Stream.hh b/contrib/libs/apache/avro/include/avro/Stream.hh
index fe2c97ee2d..81448d26d0 100644
--- a/contrib/libs/apache/avro/api/Stream.hh
+++ b/contrib/libs/apache/avro/include/avro/Stream.hh
@@ -22,6 +22,7 @@
#include <cstdint>
#include <cstring>
#include <memory>
+#include <vector>
#include "boost/utility.hpp"
diff --git a/contrib/libs/apache/avro/api/Types.hh b/contrib/libs/apache/avro/include/avro/Types.hh
index e3296ae0d0..84a33976e9 100644
--- a/contrib/libs/apache/avro/api/Types.hh
+++ b/contrib/libs/apache/avro/include/avro/Types.hh
@@ -19,6 +19,7 @@
#ifndef avro_Types_hh__
#define avro_Types_hh__
+#include <fmt/format.h>
#include <iostream>
#include "Config.hh"
@@ -109,4 +110,12 @@ std::ostream &operator<<(std::ostream &os, const Null &null);
} // namespace avro
+template<>
+struct fmt::formatter<avro::Type> : fmt::formatter<std::string> {
+ template<typename FormatContext>
+ auto format(avro::Type t, FormatContext &ctx) {
+ return fmt::formatter<std::string>::format(avro::toString(t), ctx);
+ }
+};
+
#endif
diff --git a/contrib/libs/apache/avro/api/ValidSchema.hh b/contrib/libs/apache/avro/include/avro/ValidSchema.hh
index 718c8f4733..718c8f4733 100644
--- a/contrib/libs/apache/avro/api/ValidSchema.hh
+++ b/contrib/libs/apache/avro/include/avro/ValidSchema.hh
diff --git a/contrib/libs/apache/avro/api/Validator.hh b/contrib/libs/apache/avro/include/avro/Validator.hh
index ab5d068df0..6437a549ff 100644
--- a/contrib/libs/apache/avro/api/Validator.hh
+++ b/contrib/libs/apache/avro/include/avro/Validator.hh
@@ -32,10 +32,10 @@ namespace avro {
class AVRO_DECL NullValidator : private boost::noncopyable {
public:
- explicit NullValidator(const ValidSchema &schema) {}
+ explicit NullValidator(const ValidSchema &) {}
NullValidator() = default;
- void setCount(int64_t) {}
+ void setCount(size_t) {}
static bool typeIsExpected(Type) {
return true;
@@ -45,20 +45,20 @@ public:
return AVRO_UNKNOWN;
}
- static int nextSizeExpected() {
+ static size_t nextSizeExpected() {
return 0;
}
- static bool getCurrentRecordName(std::string &name) {
+ static bool getCurrentRecordName(std::string &) {
return true;
}
- static bool getNextFieldName(std::string &name) {
+ static bool getNextFieldName(std::string &) {
return true;
}
void checkTypeExpected(Type) {}
- void checkFixedSizeExpected(int) {}
+ void checkFixedSizeExpected(size_t) {}
};
/// This class is used by both the ValidatingSerializer and ValidationParser
@@ -71,7 +71,7 @@ class AVRO_DECL Validator : private boost::noncopyable {
public:
explicit Validator(ValidSchema schema);
- void setCount(int64_t val);
+ void setCount(size_t val);
bool typeIsExpected(Type type) const {
return (expectedTypesFlag_ & typeToFlag(type)) != 0;
@@ -81,25 +81,21 @@ public:
return nextType_;
}
- int nextSizeExpected() const;
+ size_t nextSizeExpected() const;
bool getCurrentRecordName(std::string &name) const;
bool getNextFieldName(std::string &name) const;
void checkTypeExpected(Type type) {
if (!typeIsExpected(type)) {
- throw Exception(
- boost::format("Type %1% does not match schema %2%")
- % type % nextType_);
+ throw Exception("Type {} does not match schema {}", type, nextType_);
}
advance();
}
- void checkFixedSizeExpected(int size) {
+ void checkFixedSizeExpected(size_t size) {
if (nextSizeExpected() != size) {
- throw Exception(
- boost::format("Wrong size for fixed, got %1%, expected %2%")
- % size % nextSizeExpected());
+ throw Exception("Wrong size for fixed, got {}, expected {}", size, nextSizeExpected());
}
checkTypeExpected(AVRO_FIXED);
}
@@ -108,7 +104,7 @@ private:
using flag_t = uint32_t;
static flag_t typeToFlag(Type type) {
- flag_t flag = (1L << type);
+ flag_t flag = 1u << static_cast<flag_t>(type);
return flag;
}
@@ -133,7 +129,7 @@ private:
flag_t expectedTypesFlag_;
bool compoundStarted_;
bool waitingForCount_;
- int64_t count_;
+ size_t count_;
struct CompoundType {
explicit CompoundType(NodePtr n) : node(std::move(n)), pos(0) {}
diff --git a/contrib/libs/apache/avro/api/Zigzag.hh b/contrib/libs/apache/avro/include/avro/Zigzag.hh
index fefdc3f32e..5d20e028b2 100644
--- a/contrib/libs/apache/avro/api/Zigzag.hh
+++ b/contrib/libs/apache/avro/include/avro/Zigzag.hh
@@ -30,16 +30,14 @@
namespace avro {
AVRO_DECL constexpr uint64_t encodeZigzag64(int64_t input) noexcept {
- // cppcheck-suppress shiftTooManyBitsSigned
- return ((input << 1) ^ (input >> 63));
+ return ((static_cast<uint64_t>(input) << 1) ^ (input >> 63));
}
AVRO_DECL constexpr int64_t decodeZigzag64(uint64_t input) noexcept {
return static_cast<int64_t>(((input >> 1) ^ -(static_cast<int64_t>(input) & 1)));
}
AVRO_DECL constexpr uint32_t encodeZigzag32(int32_t input) noexcept {
- // cppcheck-suppress shiftTooManyBitsSigned
- return ((input << 1) ^ (input >> 31));
+ return (static_cast<uint32_t>(input) << 1) ^ (input >> 31);
}
AVRO_DECL constexpr int32_t decodeZigzag32(uint32_t input) noexcept {
return static_cast<int32_t>(((input >> 1) ^ -(static_cast<int64_t>(input) & 1)));
diff --git a/contrib/libs/apache/avro/api/buffer/Buffer.hh b/contrib/libs/apache/avro/include/avro/buffer/Buffer.hh
index 45c439d6d4..16a22ef626 100644
--- a/contrib/libs/apache/avro/api/buffer/Buffer.hh
+++ b/contrib/libs/apache/avro/include/avro/buffer/Buffer.hh
@@ -276,7 +276,7 @@ public:
* Returns the number of chunks that contain free space.
**/
- int numChunks() const {
+ size_t numChunks() const {
return pimpl_->numFreeChunks();
}
@@ -284,7 +284,7 @@ public:
* Returns the number of chunks that contain data
**/
- int numDataChunks() const {
+ size_t numDataChunks() const {
return pimpl_->numDataChunks();
}
@@ -384,7 +384,7 @@ public:
* Returns the number of chunks containing data.
**/
- int numChunks() const {
+ size_t numChunks() const {
return pimpl_->numDataChunks();
}
@@ -476,10 +476,10 @@ inline InputBuffer OutputBuffer::extractData(size_type bytes) {
template<class BufferType>
inline void toIovec(BufferType &buf, std::vector<struct iovec> &iov) {
- const int chunks = buf.numChunks();
+ const size_t chunks = buf.numChunks();
iov.resize(chunks);
typename BufferType::const_iterator iter = buf.begin();
- for (int i = 0; i < chunks; ++i) {
+ for (size_t i = 0; i < chunks; ++i) {
iov[i].iov_base = const_cast<typename BufferType::data_type *>(iter->data());
iov[i].iov_len = iter->size();
++iter;
diff --git a/contrib/libs/apache/avro/api/buffer/BufferReader.hh b/contrib/libs/apache/avro/include/avro/buffer/BufferReader.hh
index 7f49518e64..7f49518e64 100644
--- a/contrib/libs/apache/avro/api/buffer/BufferReader.hh
+++ b/contrib/libs/apache/avro/include/avro/buffer/BufferReader.hh
diff --git a/contrib/libs/apache/avro/api/buffer/detail/BufferDetail.hh b/contrib/libs/apache/avro/include/avro/buffer/detail/BufferDetail.hh
index b487cdb393..652e98d51b 100644
--- a/contrib/libs/apache/avro/api/buffer/detail/BufferDetail.hh
+++ b/contrib/libs/apache/avro/include/avro/buffer/detail/BufferDetail.hh
@@ -481,13 +481,13 @@ public:
}
/// The number of chunks containing data. Used for debugging.
- int numDataChunks() const {
+ size_t numDataChunks() const {
return readChunks_.size();
}
/// The number of chunks containing free space (note that an entire chunk
/// may not be free). Used for debugging.
- int numFreeChunks() const {
+ size_t numFreeChunks() const {
return writeChunks_.size();
}
diff --git a/contrib/libs/apache/avro/api/buffer/detail/BufferDetailIterator.hh b/contrib/libs/apache/avro/include/avro/buffer/detail/BufferDetailIterator.hh
index 44e35dd013..44e35dd013 100644
--- a/contrib/libs/apache/avro/api/buffer/detail/BufferDetailIterator.hh
+++ b/contrib/libs/apache/avro/include/avro/buffer/detail/BufferDetailIterator.hh
diff --git a/contrib/libs/apache/avro/ya.make b/contrib/libs/apache/avro/ya.make
index cd073fa7fb..fe16642795 100644
--- a/contrib/libs/apache/avro/ya.make
+++ b/contrib/libs/apache/avro/ya.make
@@ -4,17 +4,17 @@ LIBRARY()
LICENSE(
Apache-2.0 AND
- BSL-1.0 AND
- FSFAP
+ BSL-1.0
)
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-VERSION(1.11.3)
+VERSION(1.12.0)
-ORIGINAL_SOURCE(https://github.com/apache/avro/archive/release-1.11.3.tar.gz)
+ORIGINAL_SOURCE(https://github.com/apache/avro/archive/release-1.12.0.tar.gz)
PEERDIR(
+ contrib/libs/fmt
contrib/libs/snappy
contrib/restricted/boost/any
contrib/restricted/boost/asio
@@ -25,7 +25,9 @@ PEERDIR(
)
ADDINCL(
- contrib/libs/apache/avro/api
+ contrib/libs/apache/avro
+ contrib/libs/apache/avro/include
+ contrib/libs/apache/avro/include/avro
)
NO_COMPILER_WARNINGS()
@@ -34,7 +36,7 @@ NO_UTIL()
CFLAGS(
-DAVRO_SOURCE
- -DAVRO_VERSION=\"1.11.3\"
+ -DAVRO_VERSION=\"1.12.0\"
-DSNAPPY_CODEC_AVAILABLE
)