diff --git a/Algorithm/include/Algorithm/TableView.h b/Algorithm/include/Algorithm/TableView.h index 462a5ef74d74c..c0584c9d01fb7 100644 --- a/Algorithm/include/Algorithm/TableView.h +++ b/Algorithm/include/Algorithm/TableView.h @@ -79,7 +79,7 @@ class TableView /// descriptor pointing to payload of one frame struct FrameData { - const byte* buffer = nullptr; + const std::byte* buffer = nullptr; size_t size = 0; }; @@ -94,7 +94,7 @@ class TableView * @param seqSize Length of sequence * @return number of inserted elements */ - size_t addRow(RowDescType rowData, byte* seqData, size_t seqSize) + size_t addRow(RowDescType rowData, std::byte* seqData, size_t seqSize) { unsigned nFrames = mFrames.size(); unsigned currentRow = mRowData.size(); @@ -118,7 +118,7 @@ class TableView // insert frame descriptor under key composed from header and row auto result = mFrames.emplace(FrameIndex{*entry.header, currentRow}, - FrameData{entry.payload, entry.length}); + FrameData{(std::byte*)entry.payload, entry.length}); return result.second; }); auto insertedFrames = mFrames.size() - nFrames; diff --git a/Algorithm/test/tableview.cxx b/Algorithm/test/tableview.cxx index 9be76a92bcfb3..ae497da46943e 100644 --- a/Algorithm/test/tableview.cxx +++ b/Algorithm/test/tableview.cxx @@ -78,8 +78,8 @@ BOOST_AUTO_TEST_CASE(test_tableview_reverse) dh2.subSpecification = 0xdeadbeef; dh2.payloadSize = 0; - heartbeatview.addRow(dh1, tf1.buffer.get(), tf1.size()); - heartbeatview.addRow(dh2, tf2.buffer.get(), tf2.size()); + heartbeatview.addRow(dh1, (std::byte*)tf1.buffer.get(), tf1.size()); + heartbeatview.addRow(dh2, (std::byte*)tf2.buffer.get(), tf2.size()); std::cout << "slots: " << heartbeatview.getNRows() << " columns: " << heartbeatview.getNColumns() @@ -145,7 +145,7 @@ BOOST_AUTO_TEST_CASE(test_tableview_formaterror) dh.subSpecification = 0; dh.payloadSize = 0; - heartbeatview.addRow(dh, tf1.buffer.get(), tf1.size()); + heartbeatview.addRow(dh, (std::byte*)tf1.buffer.get(), tf1.size()); BOOST_CHECK(heartbeatview.getNRows() == 0); BOOST_CHECK(heartbeatview.getNColumns() == 0); diff --git a/DataFormats/Headers/include/Headers/DataHeader.h b/DataFormats/Headers/include/Headers/DataHeader.h index 27efe514fc4cf..0021003b1b05a 100644 --- a/DataFormats/Headers/include/Headers/DataHeader.h +++ b/DataFormats/Headers/include/Headers/DataHeader.h @@ -30,18 +30,15 @@ #ifndef ALICEO2_BASE_DATA_HEADER_ #define ALICEO2_BASE_DATA_HEADER_ +#include #include #include #include #include //needed for memcmp -#include // std::min -#include #include +#include #include #include -// FIXME: for o2::byte. Use std::byte as soon as we move to C++17.. -#include "MemoryResources/Types.h" -#include namespace o2::header { @@ -285,7 +282,7 @@ struct Descriptor { { static_assert(L <= N + 1, "initializer string must not exceed descriptor size"); unsigned i = 0; - for (; in[i] && i < std::min(N, L); ++i) { + for (; in[i] && i < (N < L ? N : L); ++i) { str[i] = in[i]; } } @@ -436,7 +433,7 @@ struct BaseHeader { /// @brief access header in buffer /// /// this is to guess if the buffer starting at b looks like a header - inline static const BaseHeader* get(const o2::byte* b, size_t /*len*/ = 0) + inline static const BaseHeader* get(const std::byte* b, size_t /*len*/ = 0) { return (b != nullptr && *(reinterpret_cast(b)) == sMagicString) ? reinterpret_cast(b) @@ -446,27 +443,27 @@ struct BaseHeader { /// @brief access header in buffer /// /// this is to guess if the buffer starting at b looks like a header - inline static BaseHeader* get(o2::byte* b, size_t /*len*/ = 0) + inline static BaseHeader* get(std::byte* b, size_t /*len*/ = 0) { return (b != nullptr && *(reinterpret_cast(b)) == sMagicString) ? reinterpret_cast(b) : nullptr; } constexpr uint32_t size() const noexcept { return headerSize; } - inline const o2::byte* data() const noexcept { return reinterpret_cast(this); } + inline const std::byte* data() const noexcept { return reinterpret_cast(this); } /// get the next header if any (const version) inline const BaseHeader* next() const noexcept { // BaseHeader::get checks that next header starts with the BaseHeader information at the // offset given by the size of the current header. - return (flagsNextHeader) ? BaseHeader::get(reinterpret_cast(this) + headerSize) : nullptr; + return (flagsNextHeader) ? BaseHeader::get(reinterpret_cast(this) + headerSize) : nullptr; } /// get the next header if any (non-const version) inline BaseHeader* next() noexcept { - return (flagsNextHeader) ? BaseHeader::get(reinterpret_cast(this) + headerSize) : nullptr; + return (flagsNextHeader) ? BaseHeader::get(reinterpret_cast(this) + headerSize) : nullptr; } /// check if the header matches expected version @@ -485,7 +482,7 @@ struct BaseHeader { /// use like this: /// HeaderType* h = get(buffer) template ::value, int> = 0> -auto get(const o2::byte* buffer, size_t /*len*/ = 0) +auto get(const std::byte* buffer, size_t /*len*/ = 0) { using HeaderConstPtrType = const typename std::remove_pointer::type*; using HeaderValueType = typename std::remove_pointer::type; @@ -526,7 +523,7 @@ auto get(const o2::byte* buffer, size_t /*len*/ = 0) template ::value, int> = 0> auto get(const void* buffer, size_t len = 0) { - return get(reinterpret_cast(buffer), len); + return get(reinterpret_cast(buffer), len); } //__________________________________________________________________________________________________ diff --git a/DataFormats/Headers/include/Headers/Stack.h b/DataFormats/Headers/include/Headers/Stack.h index 27924f3b53036..216cb6bf71694 100644 --- a/DataFormats/Headers/include/Headers/Stack.h +++ b/DataFormats/Headers/include/Headers/Stack.h @@ -39,12 +39,12 @@ struct Stack { struct freeobj { freeobj(memory_resource* mr) : resource(mr) {} memory_resource* resource{nullptr}; - void operator()(o2::byte* ptr) { resource->deallocate(ptr, 0, 0); } + void operator()(std::byte* ptr) { resource->deallocate(ptr, 0, 0); } }; public: - using allocator_type = boost::container::pmr::polymorphic_allocator; - using value_type = o2::byte; + using allocator_type = boost::container::pmr::polymorphic_allocator; + using value_type = std::byte; using BufferType = std::unique_ptr; //this gives us proper default move semantics for free Stack() = default; @@ -57,8 +57,8 @@ struct Stack { size_t size() const { return bufferSize; } allocator_type get_allocator() const { return allocator; } const BaseHeader* first() const { return reinterpret_cast(this->data()); } - static const BaseHeader* firstHeader(o2::byte const* buf) { return BaseHeader::get(buf); } - static const BaseHeader* lastHeader(o2::byte const* buf) + static const BaseHeader* firstHeader(std::byte const* buf) { return BaseHeader::get(buf); } + static const BaseHeader* lastHeader(std::byte const* buf) { const BaseHeader* last{firstHeader(buf)}; while (last && last->flagsNextHeader) { @@ -66,7 +66,7 @@ struct Stack { } return last; } - static size_t headerStackSize(o2::byte const* buf) + static size_t headerStackSize(std::byte const* buf) { size_t result = 0; const BaseHeader* last{firstHeader(buf)}; @@ -88,7 +88,7 @@ struct Stack { /// all headers must derive from BaseHeader, in addition also other stacks can be passed to ctor. template >::value, int> = 0> + !std::is_convertible>::value, int> = 0> Stack(FirstArgType&& firstHeader, Headers&&... headers) : Stack(boost::container::pmr::new_delete_resource(), std::forward(firstHeader), std::forward(headers)...) @@ -100,7 +100,7 @@ struct Stack { Stack(const allocator_type allocatorArg, Headers&&... headers) : allocator{allocatorArg}, bufferSize{calculateSize(std::forward(headers)...)}, - buffer{static_cast(allocator.resource()->allocate(bufferSize, alignof(std::max_align_t))), freeobj{allocator.resource()}} + buffer{static_cast(allocator.resource()->allocate(bufferSize, alignof(std::max_align_t))), freeobj{allocator.resource()}} { inject(buffer.get(), std::forward(headers)...); } @@ -117,7 +117,7 @@ struct Stack { constexpr static size_t calculateSize(T&& h) noexcept { //if it's a pointer (to a stack) traverse it - if constexpr (std::is_convertible_v) { + if constexpr (std::is_convertible_v) { const BaseHeader* next = BaseHeader::get(std::forward(h)); if (!next) { return 0; @@ -143,7 +143,7 @@ struct Stack { //______________________________________________________________________________________________ template - static o2::byte* inject(o2::byte* here, T&& h, bool more = false) noexcept + static std::byte* inject(std::byte* here, T&& h, bool more = false) noexcept { using headerType = typename std::remove_cv::type>::type; if (here == nullptr) { @@ -168,7 +168,7 @@ struct Stack { ::new (static_cast(here)) headerType(std::forward(h)); reinterpret_cast(here)->flagsNextHeader = more; return here + h.size(); - } else if constexpr (std::is_same_v) { + } else if constexpr (std::is_same_v) { BaseHeader* from{BaseHeader::get(h)}; BaseHeader* last{nullptr}; while (from) { @@ -188,7 +188,7 @@ struct Stack { //______________________________________________________________________________________________ template - static o2::byte* inject(o2::byte* here, T&& h, Args&&... args) noexcept + static std::byte* inject(std::byte* here, T&& h, Args&&... args) noexcept { bool more = hasNonEmptyArg(args...); auto alsohere = inject(here, h, more); @@ -210,7 +210,7 @@ struct Stack { template static bool hasNonEmptyArg(const T& h) noexcept { - if constexpr (std::is_convertible_v) { + if constexpr (std::is_convertible_v) { return get(h); } else { if (h.size() > 0) { diff --git a/DataFormats/Headers/src/DataHeader.cxx b/DataFormats/Headers/src/DataHeader.cxx index 33f7f47c70df8..61a38628f7728 100644 --- a/DataFormats/Headers/src/DataHeader.cxx +++ b/DataFormats/Headers/src/DataHeader.cxx @@ -108,7 +108,7 @@ void o2::header::hexDump(const char* desc, const void* voidaddr, size_t len, siz size_t i; unsigned char buff[17]; // stores the ASCII data memset(&buff[0], '\0', 17); - const byte* addr = reinterpret_cast(voidaddr); + const std::byte* addr = reinterpret_cast(voidaddr); // Output description if given. if (desc != nullptr) { @@ -143,13 +143,13 @@ void o2::header::hexDump(const char* desc, const void* voidaddr, size_t len, siz } // Now the hex code for the specific character. - printf(" %02x", addr[i]); + printf(" %02x", (char)addr[i]); // And store a printable ASCII character for later. - if ((addr[i] < 0x20) || (addr[i] > 0x7e)) { + if (((char)addr[i] < 0x20) || ((char)addr[i] > 0x7e)) { buff[i % 16] = '.'; } else { - buff[i % 16] = addr[i]; + buff[i % 16] = (char)addr[i]; } buff[(i % 16) + 1] = '\0'; fflush(stdout); diff --git a/DataFormats/MemoryResources/include/MemoryResources/MemoryResources.h b/DataFormats/MemoryResources/include/MemoryResources/MemoryResources.h index 693b3c43d936f..eaf88137a2618 100644 --- a/DataFormats/MemoryResources/include/MemoryResources/MemoryResources.h +++ b/DataFormats/MemoryResources/include/MemoryResources/MemoryResources.h @@ -41,7 +41,6 @@ #include #include #include -#include "Types.h" namespace o2 { @@ -305,8 +304,8 @@ class NoConstructAllocator : public boost::container::pmr::polymorphic_allocator //__________________________________________________________________________________________________ //__________________________________________________________________________________________________ -using ByteSpectatorAllocator = SpectatorAllocator; -using BytePmrAllocator = boost::container::pmr::polymorphic_allocator; +using ByteSpectatorAllocator = SpectatorAllocator; +using BytePmrAllocator = boost::container::pmr::polymorphic_allocator; template using vector = std::vector>; diff --git a/DataFormats/MemoryResources/include/MemoryResources/Types.h b/DataFormats/MemoryResources/include/MemoryResources/Types.h deleted file mode 100644 index 14639f0b8aa2b..0000000000000 --- a/DataFormats/MemoryResources/include/MemoryResources/Types.h +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright CERN and copyright holders of ALICE O2. This software is -// distributed under the terms of the GNU General Public License v3 (GPL -// Version 3), copied verbatim in the file "COPYING". -// -// See http://alice-o2.web.cern.ch/license for full licensing information. -// -// In applying this license CERN does not waive the privileges and immunities -// granted to it by virtue of its status as an Intergovernmental Organization -// or submit itself to any jurisdiction. - -#ifndef O2_MEMORY_RESOURCES_TYPES_ -#define O2_MEMORY_RESOURCES_TYPES_ - -namespace o2 -{ -using byte = unsigned char; -} // namespace o2 - -#endif diff --git a/DataFormats/MemoryResources/test/testMemoryResources.cxx b/DataFormats/MemoryResources/test/testMemoryResources.cxx index 1f60cabcf0722..f5fe8dd664cda 100644 --- a/DataFormats/MemoryResources/test/testMemoryResources.cxx +++ b/DataFormats/MemoryResources/test/testMemoryResources.cxx @@ -82,7 +82,7 @@ BOOST_AUTO_TEST_CASE(allocator_test) v.emplace_back(1); v.emplace_back(2); v.emplace_back(3); - BOOST_CHECK((byte*)&(*v.end()) - (byte*)&(*v.begin()) == 3 * sizeof(testData)); + BOOST_CHECK((std::byte*)&(*v.end()) - (std::byte*)&(*v.begin()) == 3 * sizeof(testData)); BOOST_CHECK(testData::nconstructions == 3); } diff --git a/Detectors/TPC/reconstruction/include/TPCReconstruction/RawReaderCRU.h b/Detectors/TPC/reconstruction/include/TPCReconstruction/RawReaderCRU.h index d61893cd36f14..ec5a15639d199 100644 --- a/Detectors/TPC/reconstruction/include/TPCReconstruction/RawReaderCRU.h +++ b/Detectors/TPC/reconstruction/include/TPCReconstruction/RawReaderCRU.h @@ -31,7 +31,6 @@ #include #include "DetectorsRaw/RDHUtils.h" -#include "MemoryResources/Types.h" #include "TPCBase/CRU.h" #include "Headers/RAWDataHeader.h" #include "Headers/RDHAny.h" @@ -239,7 +238,7 @@ class GBTFrame void getAdcValues(ADCRawData& rawData); /// read from memory - void readFromMemory(gsl::span data); + void readFromMemory(gsl::span data); /// read from istream void streamFrom(std::istream& input); @@ -610,7 +609,7 @@ class RawReaderCRU /// Process data from memory for a single link /// The data must be collected before, merged over 8k packets - int processMemory(const std::vector& data, ADCRawData& rawData); + int processMemory(const std::vector& data, ADCRawData& rawData); /// process links void processLinks(const uint32_t linkMask = 0); @@ -798,7 +797,7 @@ class RawReaderCRU std::ifstream mFileHandle; ///< file handle for input file /// collect raw GBT data - void collectGBTData(std::vector& data); + void collectGBTData(std::vector& data); /// fill adc data to output map void fillADCdataMap(const ADCRawData& rawData); @@ -915,7 +914,7 @@ inline void GBTFrame::getAdcValues(ADCRawData& rawData) // std::cout << std::endl; } -inline void GBTFrame::readFromMemory(gsl::span data) +inline void GBTFrame::readFromMemory(gsl::span data) { assert(sizeof(mData) == data.size_bytes()); memcpy(mData.data(), data.data(), data.size_bytes()); diff --git a/Detectors/TPC/reconstruction/src/RawReaderCRU.cxx b/Detectors/TPC/reconstruction/src/RawReaderCRU.cxx index 334deee94cdcb..b2047d1065631 100644 --- a/Detectors/TPC/reconstruction/src/RawReaderCRU.cxx +++ b/Detectors/TPC/reconstruction/src/RawReaderCRU.cxx @@ -491,7 +491,7 @@ int RawReaderCRU::processPacket(GBTFrame& gFrame, uint32_t startPos, uint32_t si return 0; } -int RawReaderCRU::processMemory(const std::vector& data, ADCRawData& rawData) +int RawReaderCRU::processMemory(const std::vector& data, ADCRawData& rawData) { GBTFrame gFrame; @@ -507,7 +507,7 @@ int RawReaderCRU::processMemory(const std::vector& data, ADCRawData& r // reinterpret_cast(data.data() + iFrame * 16), so it could be accessed the // same way as the mData array. // however, this was ~5% slower in execution time. I suspect due to cache misses - gFrame.readFromMemory(gsl::span(data.data() + iFrame * 16, 16)); + gFrame.readFromMemory(gsl::span(data.data() + iFrame * 16, 16)); // extract the half words from the 4 32-bit words gFrame.getFrameHalfWords(); @@ -702,7 +702,7 @@ void RawReaderCRU::processDataMemory() //dataSize = 4000 * 16; //} - std::vector data; + std::vector data; data.reserve(dataSize); collectGBTData(data); @@ -718,7 +718,7 @@ void RawReaderCRU::processDataMemory() } } -void RawReaderCRU::collectGBTData(std::vector& data) +void RawReaderCRU::collectGBTData(std::vector& data) { const auto& linkInfoArray = mManager->mEventSync.getLinkInfoArrayForEvent(mEventNumber, mCRU); auto& file = getFileHandle(); @@ -732,7 +732,7 @@ void RawReaderCRU::collectGBTData(std::vector& data) const auto payloadStart = packet.getPayloadOffset(); const auto payloadSize = size_t(packet.getPayloadSize()); - data.insert(data.end(), payloadSize, 0); + data.insert(data.end(), payloadSize, (std::byte)0); // jump to the start position of the packet file.seekg(payloadStart, std::ios::beg); diff --git a/Detectors/TPC/workflow/src/CalibProcessingHelper.cxx b/Detectors/TPC/workflow/src/CalibProcessingHelper.cxx index bc42e59097cd8..da8ef1bdd27fe 100644 --- a/Detectors/TPC/workflow/src/CalibProcessingHelper.cxx +++ b/Detectors/TPC/workflow/src/CalibProcessingHelper.cxx @@ -135,7 +135,7 @@ void processGBT(o2::framework::RawParser<>& parser, std::unique_ptr(data + i, 16)); + gFrame.readFromMemory(gsl::span((std::byte*)data + i, 16)); // extract the half words from the 4 32-bit words gFrame.getFrameHalfWords(); diff --git a/Framework/Core/include/Framework/InputRecord.h b/Framework/Core/include/Framework/InputRecord.h index 47813bdb89757..9695a9e34bfd8 100644 --- a/Framework/Core/include/Framework/InputRecord.h +++ b/Framework/Core/include/Framework/InputRecord.h @@ -18,7 +18,6 @@ #include "Framework/TableConsumer.h" #include "Framework/Traits.h" #include "Framework/RuntimeError.h" -#include "MemoryResources/Types.h" #include "Headers/DataHeader.h" #include "CommonUtils/BoostSerializer.h" diff --git a/Framework/Core/include/Framework/TMessageSerializer.h b/Framework/Core/include/Framework/TMessageSerializer.h index a30c1a19dd796..ed3eb3a4b014c 100644 --- a/Framework/Core/include/Framework/TMessageSerializer.h +++ b/Framework/Core/include/Framework/TMessageSerializer.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include namespace o2 { @@ -32,8 +32,8 @@ class FairTMessage; // utilities to produce a span over a byte buffer held by various message types // this is to avoid littering code with casts and conversions (span has a signed index type(!)) -gsl::span as_span(const FairTMessage& msg); -gsl::span as_span(const FairMQMessage& msg); +gsl::span as_span(const FairTMessage& msg); +gsl::span as_span(const FairMQMessage& msg); class FairTMessage : public TMessage { @@ -41,7 +41,7 @@ class FairTMessage : public TMessage using TMessage::TMessage; FairTMessage() : TMessage(kMESS_OBJECT) {} FairTMessage(void* buf, Int_t len) : TMessage(buf, len) { ResetBit(kIsOwner); } - FairTMessage(gsl::span buf) : TMessage(buf.data(), buf.size()) { ResetBit(kIsOwner); } + FairTMessage(gsl::span buf) : TMessage(buf.data(), buf.size()) { ResetBit(kIsOwner); } // helper function to clean up the object holding the data after it is transported. static void free(void* /*data*/, void* hint); }; @@ -74,13 +74,13 @@ struct TMessageSerializer { CompressionLevel compressionLevel = -1); template - static std::unique_ptr deserialize(gsl::span buffer); + static std::unique_ptr deserialize(gsl::span buffer); template - static inline std::unique_ptr deserialize(byte* buffer, size_t size); + static inline std::unique_ptr deserialize(std::byte* buffer, size_t size); // load the schema information from a message/buffer static void loadSchema(const FairMQMessage& msg); - static void loadSchema(gsl::span buffer); + static void loadSchema(gsl::span buffer); // write the schema into an empty message/buffer static void fillSchema(FairMQMessage& msg, const StreamerList& streamers); @@ -135,7 +135,7 @@ inline void TMessageSerializer::serialize(FairTMessage& tm, const T* input, } template -inline std::unique_ptr TMessageSerializer::deserialize(gsl::span buffer) +inline std::unique_ptr TMessageSerializer::deserialize(gsl::span buffer) { TClass* tgtClass = TClass::GetClass(typeid(T)); if (tgtClass == nullptr) { @@ -158,9 +158,9 @@ inline std::unique_ptr TMessageSerializer::deserialize(gsl::span bu } template -inline std::unique_ptr TMessageSerializer::deserialize(byte* buffer, size_t size) +inline std::unique_ptr TMessageSerializer::deserialize(std::byte* buffer, size_t size) { - return deserialize(gsl::span(buffer, gsl::narrow::size_type>(size))); + return deserialize(gsl::span(buffer, gsl::narrow::size_type>(size))); } inline void FairTMessage::free(void* /*data*/, void* hint) @@ -211,15 +211,15 @@ inline TMessageSerializer::StreamerList TMessageSerializer::getStreamers() // gsl::narrow is used to do a runtime narrowing check, this might be a bit paranoid, // we would probably be fine with e.g. gsl::narrow_cast (or just a static_cast) -inline gsl::span as_span(const FairMQMessage& msg) +inline gsl::span as_span(const FairMQMessage& msg) { - return gsl::span{static_cast(msg.GetData()), gsl::narrow::size_type>(msg.GetSize())}; + return gsl::span{static_cast(msg.GetData()), gsl::narrow::size_type>(msg.GetSize())}; } -inline gsl::span as_span(const FairTMessage& msg) +inline gsl::span as_span(const FairTMessage& msg) { - return gsl::span{reinterpret_cast(msg.Buffer()), - gsl::narrow::size_type>(msg.BufferSize())}; + return gsl::span{reinterpret_cast(msg.Buffer()), + gsl::narrow::size_type>(msg.BufferSize())}; } } // namespace framework diff --git a/Framework/Core/src/ExternalFairMQDeviceProxy.cxx b/Framework/Core/src/ExternalFairMQDeviceProxy.cxx index d4a89c71ae2d8..591ba0d1d824c 100644 --- a/Framework/Core/src/ExternalFairMQDeviceProxy.cxx +++ b/Framework/Core/src/ExternalFairMQDeviceProxy.cxx @@ -440,7 +440,7 @@ DataProcessorSpec specifyFairMQDeviceOutputProxy(char const* name, // TODO: we need to make a copy of the messages, maybe we can implement functionality in // the RawDeviceService to forward messages, but this also needs to take into account that // other consumers might exist - size_t headerMsgSize = o2::header::Stack::headerStackSize(reinterpret_cast(part.header)); + size_t headerMsgSize = o2::header::Stack::headerStackSize(reinterpret_cast(part.header)); auto* dh = o2::header::get(part.header); if (!dh) { std::stringstream errorMessage; @@ -510,7 +510,7 @@ DataProcessorSpec specifyFairMQDeviceMultiOutputProxy(char const* name, // TODO: we need to make a copy of the messages, maybe we can implement functionality in // the RawDeviceService to forward messages, but this also needs to take into account that // other consumers might exist - size_t headerMsgSize = o2::header::Stack::headerStackSize(reinterpret_cast(part.header)); + size_t headerMsgSize = o2::header::Stack::headerStackSize(reinterpret_cast(part.header)); auto* dh = o2::header::get(part.header); if (!dh) { std::stringstream errorMessage; diff --git a/Framework/Core/src/TMessageSerializer.cxx b/Framework/Core/src/TMessageSerializer.cxx index c8b5f5d95d99c..8c0c5b4e9cacb 100644 --- a/Framework/Core/src/TMessageSerializer.cxx +++ b/Framework/Core/src/TMessageSerializer.cxx @@ -16,7 +16,7 @@ using namespace o2::framework; TMessageSerializer::StreamerList TMessageSerializer::sStreamers{}; std::mutex TMessageSerializer::sStreamersLock{}; -void TMessageSerializer::loadSchema(gsl::span buffer) +void TMessageSerializer::loadSchema(gsl::span buffer) { std::unique_ptr obj = deserialize(buffer); diff --git a/Framework/Core/test/test_DataAllocator.cxx b/Framework/Core/test/test_DataAllocator.cxx index bfbb7ceef1c10..d0f0395e2ab58 100644 --- a/Framework/Core/test/test_DataAllocator.cxx +++ b/Framework/Core/test/test_DataAllocator.cxx @@ -199,7 +199,7 @@ DataProcessorSpec getSinkSpec() DumpStackFctType dumpStack = [&](const o2::header::BaseHeader* h) { o2::header::hexDump("", h, h->size()); if (h->flagsNextHeader) { - auto next = reinterpret_cast(h) + h->size(); + auto next = reinterpret_cast(h) + h->size(); dumpStack(reinterpret_cast(next)); } }; diff --git a/Framework/Core/test/test_FairMQ.cxx b/Framework/Core/test/test_FairMQ.cxx index a0f025683ffef..d8d3bb4d912b2 100644 --- a/Framework/Core/test/test_FairMQ.cxx +++ b/Framework/Core/test/test_FairMQ.cxx @@ -70,21 +70,21 @@ template auto forEach(I begin, I end, F&& function) { - using span = gsl::span; + using span = gsl::span; using SPAN_SIZE_TYPE = span::size_type; using gsl::narrow_cast; for (auto it = begin; it != end; ++it) { - o2::byte* headerBuffer{nullptr}; + std::byte* headerBuffer{nullptr}; SPAN_SIZE_TYPE headerBufferSize{0}; if (*it != nullptr) { - headerBuffer = reinterpret_cast((*it)->GetData()); + headerBuffer = reinterpret_cast((*it)->GetData()); headerBufferSize = narrow_cast((*it)->GetSize()); } ++it; - o2::byte* dataBuffer{nullptr}; + std::byte* dataBuffer{nullptr}; SPAN_SIZE_TYPE dataBufferSize{0}; if (*it != nullptr) { - dataBuffer = reinterpret_cast((*it)->GetData()); + dataBuffer = reinterpret_cast((*it)->GetData()); dataBufferSize = narrow_cast((*it)->GetSize()); } diff --git a/Framework/Core/test/test_TMessageSerializer.cxx b/Framework/Core/test/test_TMessageSerializer.cxx index bea66936c3452..1637811e4e6bc 100644 --- a/Framework/Core/test/test_TMessageSerializer.cxx +++ b/Framework/Core/test/test_TMessageSerializer.cxx @@ -90,7 +90,7 @@ BOOST_AUTO_TEST_CASE(TestTMessageSerializer_InvalidBuffer) // FIXME: at the moment, TMessage fails directly with a segfault, which it shouldn't do /* try { - auto out = TMessageSerializer::deserialize((o2::byte*)buffer, strlen(buffer)); + auto out = TMessageSerializer::deserialize((std::byte*)buffer, strlen(buffer)); BOOST_ERROR("here we should never get, the function call must fail with exception"); } catch (std::exception& e) { std::string expected(""); @@ -100,7 +100,7 @@ BOOST_AUTO_TEST_CASE(TestTMessageSerializer_InvalidBuffer) // test deserialization of invalid target class and check the exception struct Dummy { }; - BOOST_CHECK_EXCEPTION(TMessageSerializer::deserialize((o2::byte*)buffer, strlen(buffer)), + BOOST_CHECK_EXCEPTION(TMessageSerializer::deserialize((std::byte*)buffer, strlen(buffer)), RuntimeErrorRef, [](RuntimeErrorRef const& ref) { auto& err = error_from_ref(ref); diff --git a/Utilities/DataSampling/src/Dispatcher.cxx b/Utilities/DataSampling/src/Dispatcher.cxx index e4e434ff66fa8..1e4680e12e01a 100644 --- a/Utilities/DataSampling/src/Dispatcher.cxx +++ b/Utilities/DataSampling/src/Dispatcher.cxx @@ -141,7 +141,7 @@ header::Stack Dispatcher::extractAdditionalHeaders(const char* inputHeaderStack) { header::Stack headerStack; - const auto* first = header::BaseHeader::get(reinterpret_cast(inputHeaderStack)); + const auto* first = header::BaseHeader::get(reinterpret_cast(inputHeaderStack)); for (const auto* current = first; current != nullptr; current = current->next()) { if (current->description != header::DataHeader::sHeaderType && current->description != DataProcessingHeader::sHeaderType) { diff --git a/Utilities/Mergers/src/FullHistoryMerger.cxx b/Utilities/Mergers/src/FullHistoryMerger.cxx index 9504e603e2246..e4ca213abfc5f 100644 --- a/Utilities/Mergers/src/FullHistoryMerger.cxx +++ b/Utilities/Mergers/src/FullHistoryMerger.cxx @@ -84,7 +84,7 @@ void FullHistoryMerger::updateCache(const DataRef& ref) mFirstObjectSerialized.first = sourceID; mFirstObjectSerialized.second.spec = new InputSpec(*ref.spec); - mFirstObjectSerialized.second.header = new char[Stack::headerStackSize(reinterpret_cast(dh))]; + mFirstObjectSerialized.second.header = new char[Stack::headerStackSize(reinterpret_cast(dh))]; memcpy((void*)mFirstObjectSerialized.second.header, ref.header, dh->headerSize); mFirstObjectSerialized.second.payload = new char[dh->payloadSize]; memcpy((void*)mFirstObjectSerialized.second.payload, ref.payload, dh->payloadSize);