diff options
author | dtorilov <dtorilov@yandex-team.com> | 2025-01-11 18:07:21 +0300 |
---|---|---|
committer | dtorilov <dtorilov@yandex-team.com> | 2025-01-11 18:27:59 +0300 |
commit | dbd433e8011091346b3a3740428e392a2ddc76c1 (patch) | |
tree | 107bb447f2f16a3492d4a53cfa3e523e6e368e0e | |
parent | 291b8c2ac8281e6511c2ecaf102514e9906b9829 (diff) | |
download | ydb-dbd433e8011091346b3a3740428e392a2ddc76c1.tar.gz |
Cosmetics
commit_hash:f51f172878d227b49cb480296f61a6575e5d6e67
-rw-r--r-- | library/cpp/yt/memory/ref-inl.h | 6 | ||||
-rw-r--r-- | yt/yt/client/api/rpc_proxy/row_stream.cpp | 14 | ||||
-rw-r--r-- | yt/yt/client/object_client/public.cpp | 4 | ||||
-rw-r--r-- | yt/yt/client/table_client/row_buffer.cpp | 6 | ||||
-rw-r--r-- | yt/yt/client/table_client/unversioned_row.cpp | 24 | ||||
-rw-r--r-- | yt/yt/client/table_client/versioned_row.cpp | 8 | ||||
-rw-r--r-- | yt/yt/core/bus/tcp/packet.cpp | 2 | ||||
-rw-r--r-- | yt/yt/core/misc/protobuf_helpers-inl.h | 2 | ||||
-rw-r--r-- | yt/yt/core/misc/protobuf_helpers.cpp | 22 | ||||
-rw-r--r-- | yt/yt/core/misc/ring_queue.h | 2 | ||||
-rw-r--r-- | yt/yt/core/net/socket.cpp | 2 | ||||
-rw-r--r-- | yt/yt/core/rpc/grpc/helpers.cpp | 6 | ||||
-rw-r--r-- | yt/yt/core/rpc/message.cpp | 4 |
13 files changed, 51 insertions, 51 deletions
diff --git a/library/cpp/yt/memory/ref-inl.h b/library/cpp/yt/memory/ref-inl.h index 13541a285a..62a0a4e6b4 100644 --- a/library/cpp/yt/memory/ref-inl.h +++ b/library/cpp/yt/memory/ref-inl.h @@ -49,7 +49,7 @@ template <class T> Y_FORCE_INLINE TRef TRef::FromPod(const T& data) { static_assert(TTypeTraits<T>::IsPod || (std::is_standard_layout_v<T> && std::is_trivial_v<T>), "T must be a pod-type."); - return TRef(&data, sizeof (data)); + return TRef(&data, sizeof(data)); } Y_FORCE_INLINE TStringBuf TRef::ToStringBuf() const @@ -87,7 +87,7 @@ template <class T> Y_FORCE_INLINE TMutableRef TMutableRef::FromPod(T& data) { static_assert(TTypeTraits<T>::IsPod || (std::is_standard_layout_v<T> && std::is_trivial_v<T>), "T must be a pod-type."); - return TMutableRef(&data, sizeof (data)); + return TMutableRef(&data, sizeof(data)); } Y_FORCE_INLINE TMutableRef TMutableRef::FromString(TString& str) @@ -550,7 +550,7 @@ TSharedRefArrayImplPtr TSharedRefArray::NewImpl( TRefCountedTypeCookie tagCookie, As&&... args) { - auto extraSpaceSize = sizeof (TSharedRef) * size + poolCapacity; + auto extraSpaceSize = sizeof(TSharedRef) * size + poolCapacity; return NewWithExtraSpace<TSharedRefArrayImpl>( extraSpaceSize, extraSpaceSize, diff --git a/yt/yt/client/api/rpc_proxy/row_stream.cpp b/yt/yt/client/api/rpc_proxy/row_stream.cpp index 1db8352d4c..6626f648b9 100644 --- a/yt/yt/client/api/rpc_proxy/row_stream.cpp +++ b/yt/yt/client/api/rpc_proxy/row_stream.cpp @@ -36,13 +36,13 @@ std::tuple<TSharedRef, TMutableRef> SerializeRowStreamBlockEnvelope( */ i64 totalSize = 0; - totalSize += sizeof (i32); // partCount - totalSize += sizeof (i64) * 2; // partLength * 2 + totalSize += sizeof(i32); // partCount + totalSize += sizeof(i64) * 2; // partLength * 2 totalSize += descriptor.ByteSizeLong(); // descriptor totalSize += payloadSize; if (statistics) { - totalSize += sizeof (i32); // partCount - totalSize += sizeof (i64) * 2; // partLength * 2 + totalSize += sizeof(i32); // partCount + totalSize += sizeof(i64) * 2; // partLength * 2 totalSize += statistics->ByteSizeLong(); } @@ -53,12 +53,12 @@ std::tuple<TSharedRef, TMutableRef> SerializeRowStreamBlockEnvelope( auto writeInt32 = [&] (i32 value) { *reinterpret_cast<i32*>(current) = value; - current += sizeof (i32); + current += sizeof(i32); }; auto writeInt64 = [&] (i64 value) { *reinterpret_cast<i64*>(current) = value; - current += sizeof (i64); + current += sizeof(i64); }; TMutableRef payloadRef; @@ -73,7 +73,7 @@ std::tuple<TSharedRef, TMutableRef> SerializeRowStreamBlockEnvelope( if (statistics) { writeInt32(2); // partCount - writeInt64(sizeof (i32) + 2 * sizeof (i64) + descriptor.ByteSizeLong() + payloadSize); // partLength + writeInt64(sizeof(i32) + 2 * sizeof(i64) + descriptor.ByteSizeLong() + payloadSize); // partLength } writeInt32(2); // partCount diff --git a/yt/yt/client/object_client/public.cpp b/yt/yt/client/object_client/public.cpp index 958a266120..a7c9010194 100644 --- a/yt/yt/client/object_client/public.cpp +++ b/yt/yt/client/object_client/public.cpp @@ -44,12 +44,12 @@ void FormatValue(TStringBuilderBase* builder, const TVersionedObjectId& id, TStr bool operator == (const TVersionedObjectId& lhs, const TVersionedObjectId& rhs) { - return memcmp(&lhs, &rhs, sizeof (TVersionedObjectId)) == 0; + return memcmp(&lhs, &rhs, sizeof(TVersionedObjectId)) == 0; } bool operator < (const TVersionedObjectId& lhs, const TVersionedObjectId& rhs) { - return memcmp(&lhs, &rhs, sizeof (TVersionedObjectId)) < 0; + return memcmp(&lhs, &rhs, sizeof(TVersionedObjectId)) < 0; } //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/client/table_client/row_buffer.cpp b/yt/yt/client/table_client/row_buffer.cpp index 35f5ee568b..bb16d61c1b 100644 --- a/yt/yt/client/table_client/row_buffer.cpp +++ b/yt/yt/client/table_client/row_buffer.cpp @@ -99,7 +99,7 @@ TMutableUnversionedRow TRowBuffer::CaptureRow(TUnversionedValueRange values, boo auto capturedRow = TMutableUnversionedRow::Allocate(&Pool_, count); auto* capturedBegin = capturedRow.Begin(); - ::memcpy(capturedBegin, values.Begin(), count * sizeof (TUnversionedValue)); + ::memcpy(capturedBegin, values.Begin(), count * sizeof(TUnversionedValue)); if (captureValues) { for (int index = 0; index < count; ++index) { @@ -270,8 +270,8 @@ TMutableVersionedRow TRowBuffer::CaptureAndPermuteRow( writeTimestampCount, deleteTimestampCount); - ::memcpy(capturedRow.BeginWriteTimestamps(), writeTimestamps.data(), sizeof (TTimestamp) * writeTimestampCount); - ::memcpy(capturedRow.BeginDeleteTimestamps(), row.BeginDeleteTimestamps(), sizeof (TTimestamp) * deleteTimestampCount); + ::memcpy(capturedRow.BeginWriteTimestamps(), writeTimestamps.data(), sizeof(TTimestamp) * writeTimestampCount); + ::memcpy(capturedRow.BeginDeleteTimestamps(), row.BeginDeleteTimestamps(), sizeof(TTimestamp) * deleteTimestampCount); if (!allowMissingKeyColumns) { int index = 0; diff --git a/yt/yt/client/table_client/unversioned_row.cpp b/yt/yt/client/table_client/unversioned_row.cpp index 2c71c617f2..f6f953a7a5 100644 --- a/yt/yt/client/table_client/unversioned_row.cpp +++ b/yt/yt/client/table_client/unversioned_row.cpp @@ -109,8 +109,8 @@ size_t WriteRowValue(char* output, const TUnversionedValue& value, bool isInline break; case EValueType::Double: - ::memcpy(current, &value.Data.Double, sizeof (double)); - current += sizeof (double); + ::memcpy(current, &value.Data.Double, sizeof(double)); + current += sizeof(double); break; case EValueType::Boolean: @@ -170,8 +170,8 @@ size_t ReadRowValue(const char* input, TUnversionedValue* value) case EValueType::Double: { double data; - ::memcpy(&data, current, sizeof (double)); - current += sizeof (double); + ::memcpy(&data, current, sizeof(double)); + current += sizeof(double); *value = MakeUnversionedDoubleValue(data, id); break; } @@ -205,19 +205,19 @@ void Save(TStreamSaveContext& context, const TUnversionedValue& value) { auto* output = context.GetOutput(); if (IsStringLikeType(value.Type)) { - output->Write(&value, sizeof (ui16) + sizeof (ui16) + sizeof (ui32)); // Id, Type, Length + output->Write(&value, sizeof(ui16) + sizeof(ui16) + sizeof(ui32)); // Id, Type, Length if (value.Length != 0) { output->Write(value.Data.String, value.Length); } } else { - output->Write(&value, sizeof (TUnversionedValue)); + output->Write(&value, sizeof(TUnversionedValue)); } } void Load(TStreamLoadContext& context, TUnversionedValue& value, TChunkedMemoryPool* pool) { auto* input = context.GetInput(); - const size_t fixedSize = sizeof (ui16) + sizeof (ui16) + sizeof (ui32); // Id, Type, Length + const size_t fixedSize = sizeof(ui16) + sizeof(ui16) + sizeof(ui32); // Id, Type, Length YT_VERIFY(input->Load(&value, fixedSize) == fixedSize); if (IsStringLikeType(value.Type)) { if (value.Length != 0) { @@ -227,7 +227,7 @@ void Load(TStreamLoadContext& context, TUnversionedValue& value, TChunkedMemoryP value.Data.String = nullptr; } } else { - YT_VERIFY(input->Load(&value.Data, sizeof (value.Data)) == sizeof (value.Data)); + YT_VERIFY(input->Load(&value.Data, sizeof(value.Data)) == sizeof(value.Data)); } } @@ -248,7 +248,7 @@ size_t GetYsonSize(const TUnversionedValue& value) return 1 + MaxVarInt64Size; case EValueType::Double: - // Type marker + sizeof double. + // Type marker + sizeofdouble. return 1 + 8; case EValueType::String: @@ -1547,7 +1547,7 @@ std::pair<TSharedRange<TUnversionedRow>, i64> CaptureRowsImpl( TRefCountedTypeCookie tagCookie) { size_t bufferSize = 0; - bufferSize += sizeof (TUnversionedRow) * rows.Size(); + bufferSize += sizeof(TUnversionedRow) * rows.Size(); for (auto row : rows) { bufferSize += GetUnversionedRowByteSize(row.GetCount()); for (const auto& value : row) { @@ -1571,7 +1571,7 @@ std::pair<TSharedRange<TUnversionedRow>, i64> CaptureRowsImpl( return unalignedPtr; }; - auto* capturedRows = reinterpret_cast<TUnversionedRow*>(allocateAligned(sizeof (TUnversionedRow) * rows.Size())); + auto* capturedRows = reinterpret_cast<TUnversionedRow*>(allocateAligned(sizeof(TUnversionedRow) * rows.Size())); for (size_t index = 0; index < rows.Size(); ++index) { auto row = rows[index]; int valueCount = row.GetCount(); @@ -1580,7 +1580,7 @@ std::pair<TSharedRange<TUnversionedRow>, i64> CaptureRowsImpl( capturedHeader->Count = valueCount; auto capturedRow = TMutableUnversionedRow(capturedHeader); capturedRows[index] = capturedRow; - ::memcpy(capturedRow.Begin(), row.Begin(), sizeof (TUnversionedValue) * row.GetCount()); + ::memcpy(capturedRow.Begin(), row.Begin(), sizeof(TUnversionedValue) * row.GetCount()); for (auto& capturedValue : capturedRow) { if (IsStringLikeType(capturedValue.Type)) { auto* capturedString = allocateUnaligned(capturedValue.Length); diff --git a/yt/yt/client/table_client/versioned_row.cpp b/yt/yt/client/table_client/versioned_row.cpp index 5a5fcd6bc2..15c4da9b50 100644 --- a/yt/yt/client/table_client/versioned_row.cpp +++ b/yt/yt/client/table_client/versioned_row.cpp @@ -368,10 +368,10 @@ TMutableVersionedRow TVersionedRowBuilder::FinishRow() WriteTimestamps_.size(), DeleteTimestamps_.size()); - memcpy(row.BeginKeys(), Keys_.data(), sizeof (TUnversionedValue) * Keys_.size()); - memcpy(row.BeginValues(), Values_.data(), sizeof (TVersionedValue)* Values_.size()); - memcpy(row.BeginWriteTimestamps(), WriteTimestamps_.data(), sizeof (TTimestamp) * WriteTimestamps_.size()); - memcpy(row.BeginDeleteTimestamps(), DeleteTimestamps_.data(), sizeof (TTimestamp) * DeleteTimestamps_.size()); + memcpy(row.BeginKeys(), Keys_.data(), sizeof(TUnversionedValue) * Keys_.size()); + memcpy(row.BeginValues(), Values_.data(), sizeof(TVersionedValue)* Values_.size()); + memcpy(row.BeginWriteTimestamps(), WriteTimestamps_.data(), sizeof(TTimestamp) * WriteTimestamps_.size()); + memcpy(row.BeginDeleteTimestamps(), DeleteTimestamps_.data(), sizeof(TTimestamp) * DeleteTimestamps_.size()); Keys_.clear(); Values_.clear(); diff --git a/yt/yt/core/bus/tcp/packet.cpp b/yt/yt/core/bus/tcp/packet.cpp index 2519a18943..d04e9a0e86 100644 --- a/yt/yt/core/bus/tcp/packet.cpp +++ b/yt/yt/core/bus/tcp/packet.cpp @@ -451,7 +451,7 @@ public: SetPartChecksum(Message_.Size(), generateChecksums ? GetVariableChecksum() : NullChecksum); } - BeginPhase(EPacketPhase::FixedHeader, &FixedHeader_, sizeof (TPacketHeader)); + BeginPhase(EPacketPhase::FixedHeader, &FixedHeader_, sizeof(TPacketHeader)); return true; } diff --git a/yt/yt/core/misc/protobuf_helpers-inl.h b/yt/yt/core/misc/protobuf_helpers-inl.h index 39cf53d165..4ad0fb2272 100644 --- a/yt/yt/core/misc/protobuf_helpers-inl.h +++ b/yt/yt/core/misc/protobuf_helpers-inl.h @@ -576,7 +576,7 @@ void TRefCountedProto<TProto>::RegisterExtraSpace() auto spaceUsed = TProto::SpaceUsed(); YT_ASSERT(static_cast<size_t>(spaceUsed) >= sizeof(TProto)); YT_ASSERT(ExtraSpace_ == 0); - ExtraSpace_ = TProto::SpaceUsed() - sizeof (TProto); + ExtraSpace_ = TProto::SpaceUsed() - sizeof(TProto); auto cookie = GetRefCountedTypeCookie<TRefCountedProto<TProto>>(); TRefCountedTrackerFacade::AllocateSpace(cookie, ExtraSpace_); } diff --git a/yt/yt/core/misc/protobuf_helpers.cpp b/yt/yt/core/misc/protobuf_helpers.cpp index 044bbbacd1..37428337c4 100644 --- a/yt/yt/core/misc/protobuf_helpers.cpp +++ b/yt/yt/core/misc/protobuf_helpers.cpp @@ -125,17 +125,17 @@ TSharedRef SerializeProtoToRefWithEnvelope( fixedHeader.MessageSize = static_cast<ui32>(compressedMessage.Size()); size_t totalSize = - sizeof (TEnvelopeFixedHeader) + + sizeof(TEnvelopeFixedHeader) + fixedHeader.EnvelopeSize + fixedHeader.MessageSize; auto data = TSharedMutableRef::Allocate<TSerializedMessageTag>(totalSize, {.InitializeStorage = false}); char* targetFixedHeader = data.Begin(); - char* targetHeader = targetFixedHeader + sizeof (TEnvelopeFixedHeader); + char* targetHeader = targetFixedHeader + sizeof(TEnvelopeFixedHeader); char* targetMessage = targetHeader + fixedHeader.EnvelopeSize; - memcpy(targetFixedHeader, &fixedHeader, sizeof (fixedHeader)); + memcpy(targetFixedHeader, &fixedHeader, sizeof(fixedHeader)); YT_VERIFY(envelope.SerializeToArray(targetHeader, fixedHeader.EnvelopeSize)); memcpy(targetMessage, compressedMessage.Begin(), fixedHeader.MessageSize); @@ -159,14 +159,14 @@ TString SerializeProtoToStringWithEnvelope( fixedHeader.MessageSize = CheckedCastToI32(message.ByteSizeLong()); auto totalSize = - sizeof (fixedHeader) + + sizeof(fixedHeader) + fixedHeader.EnvelopeSize + fixedHeader.MessageSize; auto data = TString::Uninitialized(totalSize); char* ptr = data.begin(); - ::memcpy(ptr, &fixedHeader, sizeof (fixedHeader)); - ptr += sizeof (fixedHeader); + ::memcpy(ptr, &fixedHeader, sizeof(fixedHeader)); + ptr += sizeof(fixedHeader); ptr = reinterpret_cast<char*>(envelope.SerializeWithCachedSizesToArray(reinterpret_cast<ui8*>(ptr))); ptr = reinterpret_cast<char*>(message.SerializeWithCachedSizesToArray(reinterpret_cast<ui8*>(ptr))); YT_ASSERT(ptr == data.end()); @@ -178,13 +178,13 @@ bool TryDeserializeProtoWithEnvelope( google::protobuf::MessageLite* message, TRef data) { - if (data.Size() < sizeof (TEnvelopeFixedHeader)) { + if (data.Size() < sizeof(TEnvelopeFixedHeader)) { return false; } const auto* fixedHeader = reinterpret_cast<const TEnvelopeFixedHeader*>(data.Begin()); - const char* sourceHeader = data.Begin() + sizeof (TEnvelopeFixedHeader); - if (fixedHeader->EnvelopeSize + sizeof (*fixedHeader) > data.Size()) { + const char* sourceHeader = data.Begin() + sizeof(TEnvelopeFixedHeader); + if (fixedHeader->EnvelopeSize + sizeof(*fixedHeader) > data.Size()) { return false; } @@ -200,7 +200,7 @@ bool TryDeserializeProtoWithEnvelope( return false; } - if (fixedHeader->MessageSize + fixedHeader->EnvelopeSize + sizeof (*fixedHeader) > data.Size()) { + if (fixedHeader->MessageSize + fixedHeader->EnvelopeSize + sizeof(*fixedHeader) > data.Size()) { return false; } @@ -293,7 +293,7 @@ TSharedRef PushEnvelope(const TSharedRef& data, NCompression::ECodec codec) header.MessageSize = static_cast<ui32>(data.Size()); auto headerRef = TSharedMutableRef::Allocate( - sizeof (header) + + sizeof(header) + header.EnvelopeSize); memcpy(headerRef.Begin(), &header, sizeof(header)); diff --git a/yt/yt/core/misc/ring_queue.h b/yt/yt/core/misc/ring_queue.h index 5f2bdc4e8c..3a3b645609 100644 --- a/yt/yt/core/misc/ring_queue.h +++ b/yt/yt/core/misc/ring_queue.h @@ -280,7 +280,7 @@ private: static void MoveRange(T* begin, T* end, T* result) { if (std::is_trivially_move_constructible<T>::value) { - ::memcpy(result, begin, sizeof (T) * (end - begin)); + ::memcpy(result, begin, sizeof(T) * (end - begin)); } else { for (auto* current = begin; current != end; ++current) { new(result++) T(std::move(*current)); diff --git a/yt/yt/core/net/socket.cpp b/yt/yt/core/net/socket.cpp index b0bc8cd42a..44d6adafce 100644 --- a/yt/yt/core/net/socket.cpp +++ b/yt/yt/core/net/socket.cpp @@ -420,7 +420,7 @@ void CloseSocket(SOCKET socket) int GetSocketError(SOCKET socket) { int error; - socklen_t errorLen = sizeof (error); + socklen_t errorLen = sizeof(error); getsockopt(socket, SOL_SOCKET, SO_ERROR, reinterpret_cast<char*>(&error), &errorLen); return error; } diff --git a/yt/yt/core/rpc/grpc/helpers.cpp b/yt/yt/core/rpc/grpc/helpers.cpp index 42b7819013..2ff1735021 100644 --- a/yt/yt/core/rpc/grpc/helpers.cpp +++ b/yt/yt/core/rpc/grpc/helpers.cpp @@ -292,7 +292,7 @@ TMessageWithAttachments ByteBufferToMessageWithAttachments( fixedHeader.MessageSize = *messageBodySize; size_t totalMessageSize = - sizeof (TEnvelopeFixedHeader) + + sizeof(TEnvelopeFixedHeader) + fixedHeader.EnvelopeSize + fixedHeader.MessageSize; @@ -301,10 +301,10 @@ TMessageWithAttachments ByteBufferToMessageWithAttachments( {.InitializeStorage = false}); char* targetFixedHeader = data.Begin(); - char* targetHeader = targetFixedHeader + sizeof (TEnvelopeFixedHeader); + char* targetHeader = targetFixedHeader + sizeof(TEnvelopeFixedHeader); targetMessage = targetHeader + fixedHeader.EnvelopeSize; - memcpy(targetFixedHeader, &fixedHeader, sizeof (fixedHeader)); + memcpy(targetFixedHeader, &fixedHeader, sizeof(fixedHeader)); YT_VERIFY(envelope.SerializeToArray(targetHeader, fixedHeader.EnvelopeSize)); } else { data = TSharedMutableRef::Allocate<TMessageTag>( diff --git a/yt/yt/core/rpc/message.cpp b/yt/yt/core/rpc/message.cpp index ef57174935..fb8054bf8e 100644 --- a/yt/yt/core/rpc/message.cpp +++ b/yt/yt/core/rpc/message.cpp @@ -35,7 +35,7 @@ namespace { size_t GetAllocationSpaceForProtoWithHeader(const google::protobuf::MessageLite& message) { return - sizeof (TFixedMessageHeader) + + sizeof(TFixedMessageHeader) + message.ByteSizeLong(); } @@ -45,7 +45,7 @@ void SerializeAndAddProtoWithHeader( const google::protobuf::MessageLite& message) { auto ref = builder->AllocateAndAdd( - sizeof (TFixedMessageHeader) + + sizeof(TFixedMessageHeader) + message.GetCachedSize()); ::memcpy(ref.Begin(), &fixedHeader, sizeof(fixedHeader)); message.SerializeWithCachedSizesToArray(reinterpret_cast<google::protobuf::uint8*>(ref.Begin() + sizeof(fixedHeader))); |