diff --git a/Detectors/Base/src/Detector.cxx b/Detectors/Base/src/Detector.cxx index 3dccf732517b6..0af94d7672bd2 100644 --- a/Detectors/Base/src/Detector.cxx +++ b/Detectors/Base/src/Detector.cxx @@ -200,7 +200,8 @@ int Detector::registerSensitiveVolumeAndGetVolID(std::string const& name) namespace o2::base { // this goes into the source -void attachMessageBufferToParts(fair::mq::Parts& parts, fair::mq::Channel& channel, void* data, TClass* cl) { +void attachMessageBufferToParts(fair::mq::Parts& parts, fair::mq::Channel& channel, void* data, TClass* cl) +{ auto msg = channel.Transport()->CreateMessage(4096, fair::mq::Alignment{64}); // This will serialize the data directly into the message buffer, without any further // buffer or copying. Notice how the message will have 8 bytes of header and then @@ -252,7 +253,7 @@ void* decodeTMessageCore(fair::mq::Parts& dataparts, int index) auto rawmessage = std::move(dataparts.At(index)); o2::framework::FairInputTBuffer buffer((char*)rawmessage->GetData(), rawmessage->GetSize()); buffer.InitMap(); - auto *cl = buffer.ReadClass(); + auto* cl = buffer.ReadClass(); buffer.SetBufferOffset(0); buffer.ResetMap(); return buffer.ReadObjectAny(cl); diff --git a/Framework/Core/include/Framework/DataRefUtils.h b/Framework/Core/include/Framework/DataRefUtils.h index e59f986f09250..264533def326d 100644 --- a/Framework/Core/include/Framework/DataRefUtils.h +++ b/Framework/Core/include/Framework/DataRefUtils.h @@ -151,7 +151,7 @@ struct DataRefUtils { typename RSS::FairInputTBuffer ftm(const_cast(ref.payload), payloadSize); ftm.InitMap(); - auto *classInfo = ftm.ReadClass(); + auto* classInfo = ftm.ReadClass(); ftm.SetBufferOffset(0); ftm.ResetMap(); result.reset(static_cast(ftm.ReadObjectAny(cl))); diff --git a/Framework/Core/include/Framework/TMessageSerializer.h b/Framework/Core/include/Framework/TMessageSerializer.h index ca18eb21abfa1..34a5156074b81 100644 --- a/Framework/Core/include/Framework/TMessageSerializer.h +++ b/Framework/Core/include/Framework/TMessageSerializer.h @@ -65,8 +65,8 @@ class FairInputTBuffer : public TBufferFile // of overhead, where the source embedded the pointer for the reallocation. // Notice this will break if the sender and receiver are not using the same // size for a pointer. - FairInputTBuffer(char * data, size_t size) - : TBufferFile(TBuffer::kRead, size-sizeof(char*), data + sizeof(char*), false, nullptr) + FairInputTBuffer(char* data, size_t size) + : TBufferFile(TBuffer::kRead, size - sizeof(char*), data + sizeof(char*), false, nullptr) { } }; @@ -86,7 +86,7 @@ struct TMessageSerializer { static void serialize(o2::framework::FairOutputTBuffer& msg, const T* input, const TClass* cl); template - static inline std::unique_ptr deserialize(FairInputTBuffer & buffer); + static inline std::unique_ptr deserialize(FairInputTBuffer& buffer); }; inline void TMessageSerializer::serialize(FairOutputTBuffer& tm, const TObject* input) @@ -106,7 +106,7 @@ inline void TMessageSerializer::serialize(FairOutputTBuffer& tm, const T* input, } template -inline std::unique_ptr TMessageSerializer::deserialize(FairInputTBuffer & buffer) +inline std::unique_ptr TMessageSerializer::deserialize(FairInputTBuffer& buffer) { TClass* tgtClass = TClass::GetClass(typeid(T)); if (tgtClass == nullptr) { diff --git a/Framework/Core/src/TMessageSerializer.cxx b/Framework/Core/src/TMessageSerializer.cxx index 9f09c3ade0089..5358f8e9c1ab0 100644 --- a/Framework/Core/src/TMessageSerializer.cxx +++ b/Framework/Core/src/TMessageSerializer.cxx @@ -15,7 +15,8 @@ using namespace o2::framework; -void* FairOutputTBuffer::embedInItself(fair::mq::Message& msg) { +void* FairOutputTBuffer::embedInItself(fair::mq::Message& msg) +{ // The first bytes of the message are used to store the pointer to the message itself // so that we can reallocate it if needed. if (sizeof(char*) > msg.GetSize()) { @@ -28,7 +29,8 @@ void* FairOutputTBuffer::embedInItself(fair::mq::Message& msg) { } // Reallocation function. Get the message pointer from the data and call Rebuild. -char *FairOutputTBuffer::fairMQrealloc(char *oldData, size_t newSize, size_t oldSize) { +char* FairOutputTBuffer::fairMQrealloc(char* oldData, size_t newSize, size_t oldSize) +{ auto* msg = reinterpret_cast(oldData - sizeof(char*)); if (newSize <= msg->GetSize()) { // no need to reallocate, the message is already big enough diff --git a/Framework/Core/test/test_DataRefUtils.cxx b/Framework/Core/test/test_DataRefUtils.cxx index 081adc81ebf69..d4accde0fecf0 100644 --- a/Framework/Core/test/test_DataRefUtils.cxx +++ b/Framework/Core/test/test_DataRefUtils.cxx @@ -21,7 +21,8 @@ using namespace o2::framework; -TEST_CASE("PureRootTest") { +TEST_CASE("PureRootTest") +{ TBufferFile buffer(TBuffer::kWrite); TObjString s("test"); buffer.WriteObject(&s); @@ -29,12 +30,12 @@ TEST_CASE("PureRootTest") { TBufferFile buffer2(TBuffer::kRead, buffer.BufferSize(), buffer.Buffer(), false); buffer2.SetReadMode(); buffer2.InitMap(); - TClass *storedClass = buffer2.ReadClass(); + TClass* storedClass = buffer2.ReadClass(); // ReadClass advances the buffer, so we need to reset it. buffer2.SetBufferOffset(0); buffer2.ResetMap(); REQUIRE(storedClass != nullptr); - auto *outS = (TObjString*)buffer2.ReadObjectAny(storedClass); + auto* outS = (TObjString*)buffer2.ReadObjectAny(storedClass); REQUIRE(outS != nullptr); REQUIRE(outS->GetString() == "test"); }