diff --git a/Utilities/DataCompression/include/DataCompression/HuffmanCodec.h b/Utilities/DataCompression/include/DataCompression/HuffmanCodec.h index 2e07e0b5a31dc..5b6cda6bac249 100644 --- a/Utilities/DataCompression/include/DataCompression/HuffmanCodec.h +++ b/Utilities/DataCompression/include/DataCompression/HuffmanCodec.h @@ -436,8 +436,9 @@ class HuffmanModel : public _BASE } node->getLeftChild()->setBinaryCode(codelen + 1, c); int branchlen = assignCode(node->getLeftChild()); - if (retcodelen < branchlen) + if (retcodelen < branchlen) { retcodelen = branchlen; + } } if (node->getRightChild()) { // bit '0' branch code_type c = node->getBinaryCode(); @@ -449,8 +450,9 @@ class HuffmanModel : public _BASE } node->getRightChild()->setBinaryCode(codelen + 1, c); int branchlen = assignCode(node->getRightChild()); - if (retcodelen < branchlen) + if (retcodelen < branchlen) { retcodelen = branchlen; + } } return retcodelen; } diff --git a/Utilities/DataFlow/src/EPNReceiverDevice.cxx b/Utilities/DataFlow/src/EPNReceiverDevice.cxx index 8c5649680e31d..9424bd58d9f25 100644 --- a/Utilities/DataFlow/src/EPNReceiverDevice.cxx +++ b/Utilities/DataFlow/src/EPNReceiverDevice.cxx @@ -94,8 +94,9 @@ void EPNReceiverDevice::Run() while (compatibility::FairMQ13::IsRunning(this)) { FairMQParts subtimeframeParts; - if (Receive(subtimeframeParts, mInChannelName, 0, 100) <= 0) + if (Receive(subtimeframeParts, mInChannelName, 0, 100) <= 0) { continue; + } assert(subtimeframeParts.Size() >= 2); diff --git a/Utilities/DataFlow/src/FLPSenderDevice.cxx b/Utilities/DataFlow/src/FLPSenderDevice.cxx index 1cecd8ed3d62a..cc37be574bb6d 100644 --- a/Utilities/DataFlow/src/FLPSenderDevice.cxx +++ b/Utilities/DataFlow/src/FLPSenderDevice.cxx @@ -50,8 +50,9 @@ void FLPSenderDevice::Run() // - Add the current FLP id to the SubtimeframeMetadata // - Forward to the EPN the whole subtimeframe FairMQParts subtimeframeParts; - if (Receive(subtimeframeParts, mInChannelName, 0, 100) <= 0) + if (Receive(subtimeframeParts, mInChannelName, 0, 100) <= 0) { continue; + } assert(subtimeframeParts.Size() != 0); assert(subtimeframeParts.Size() >= 2); diff --git a/Utilities/DataFlow/src/FakeTimeframeBuilder.cxx b/Utilities/DataFlow/src/FakeTimeframeBuilder.cxx index 432ea03e95be7..66bcc4fbcea08 100644 --- a/Utilities/DataFlow/src/FakeTimeframeBuilder.cxx +++ b/Utilities/DataFlow/src/FakeTimeframeBuilder.cxx @@ -25,29 +25,34 @@ namespace { o2::header::DataDescription lookupDataDescription(const char* key) { - if (strcmp(key, "RAWDATA") == 0) + if (strcmp(key, "RAWDATA") == 0) { return o2::header::gDataDescriptionRawData; - else if (strcmp(key, "CLUSTERS") == 0) + } else if (strcmp(key, "CLUSTERS") == 0) { return o2::header::gDataDescriptionClusters; - else if (strcmp(key, "TRACKS") == 0) + } else if (strcmp(key, "TRACKS") == 0) { return o2::header::gDataDescriptionTracks; - else if (strcmp(key, "CONFIG") == 0) + } else if (strcmp(key, "CONFIG") == 0) { return o2::header::gDataDescriptionConfig; - else if (strcmp(key, "INFO") == 0) + } else if (strcmp(key, "INFO") == 0) { return o2::header::gDataDescriptionInfo; + } return o2::header::gDataDescriptionInvalid; } o2::header::DataOrigin lookupDataOrigin(const char* key) { - if (strcmp(key, "TPC") == 0) + if (strcmp(key, "TPC") == 0) { return o2::header::gDataOriginTPC; - if (strcmp(key, "TRD") == 0) + } + if (strcmp(key, "TRD") == 0) { return o2::header::gDataOriginTRD; - if (strcmp(key, "TOF") == 0) + } + if (strcmp(key, "TOF") == 0) { return o2::header::gDataOriginTOF; - if (strcmp(key, "ITS") == 0) + } + if (strcmp(key, "ITS") == 0) { return o2::header::gDataOriginITS; + } return o2::header::gDataOriginInvalid; } diff --git a/Utilities/DataFlow/src/SubframeBuilderDevice.cxx b/Utilities/DataFlow/src/SubframeBuilderDevice.cxx index 9047f74a207d4..adad827e04a1f 100644 --- a/Utilities/DataFlow/src/SubframeBuilderDevice.cxx +++ b/Utilities/DataFlow/src/SubframeBuilderDevice.cxx @@ -86,8 +86,9 @@ bool o2::data_flow::SubframeBuilderDevice::BuildAndSendFrame(FairMQParts& inPart size_t outSize = mMerger->finalise(outBuffer, id); // In this case we do not have enough subtimeframes for id, // so we simply return. - if (outSize == 0) + if (outSize == 0) { return true; + } // If we reach here, it means we do have enough subtimeframes. // top level subframe header, the DataHeader is going to be used with diff --git a/Utilities/DataFlow/src/TimeframeValidationTool.cxx b/Utilities/DataFlow/src/TimeframeValidationTool.cxx index 81ff1038ff78a..b3f1168006fc6 100644 --- a/Utilities/DataFlow/src/TimeframeValidationTool.cxx +++ b/Utilities/DataFlow/src/TimeframeValidationTool.cxx @@ -28,12 +28,13 @@ int main(int argc, char** argv) while ((c = getopt(argc, argv, "")) != -1) { switch (c) { case '?': - if (isprint(optopt)) + if (isprint(optopt)) { fprintf(stderr, "Unknown option `-%c'.\n", optopt); - else + } else { fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt); + } return 1; default: abort(); diff --git a/Utilities/DataFlow/src/TimeframeValidatorDevice.cxx b/Utilities/DataFlow/src/TimeframeValidatorDevice.cxx index f1468e8e7527e..4f62bc621ef46 100644 --- a/Utilities/DataFlow/src/TimeframeValidatorDevice.cxx +++ b/Utilities/DataFlow/src/TimeframeValidatorDevice.cxx @@ -43,8 +43,9 @@ void o2::data_flow::TimeframeValidatorDevice::Run() { while (compatibility::FairMQ13::IsRunning(this)) { FairMQParts timeframeParts; - if (Receive(timeframeParts, mInChannelName, 0, 100) <= 0) + if (Receive(timeframeParts, mInChannelName, 0, 100) <= 0) { continue; + } if (timeframeParts.Size() < 2) { LOG(ERROR) << "Expecting at least 2 parts\n"; diff --git a/Utilities/DataFlow/src/TimeframeWriterDevice.cxx b/Utilities/DataFlow/src/TimeframeWriterDevice.cxx index 84b41bf2efe11..151ac59424880 100644 --- a/Utilities/DataFlow/src/TimeframeWriterDevice.cxx +++ b/Utilities/DataFlow/src/TimeframeWriterDevice.cxx @@ -70,8 +70,9 @@ void TimeframeWriterDevice::Run() } FairMQParts timeframeParts; - if (Receive(timeframeParts, mInChannelName, 0, 100) <= 0) + if (Receive(timeframeParts, mInChannelName, 0, 100) <= 0) { continue; + } streamTimeframe(mFile, timeframeParts); if ((mFile.tellp() > mMaxFileSize) || (streamedTimeframes++ > mMaxTimeframes)) { diff --git a/Utilities/O2MessageMonitor/src/O2MessageMonitor.cxx b/Utilities/O2MessageMonitor/src/O2MessageMonitor.cxx index 9181b194e35d0..1d2dc6f8dfa0b 100644 --- a/Utilities/O2MessageMonitor/src/O2MessageMonitor.cxx +++ b/Utilities/O2MessageMonitor/src/O2MessageMonitor.cxx @@ -45,8 +45,9 @@ void O2MessageMonitor::InitTask() mIterations = GetConfig()->GetValue("n"); mPayload = GetConfig()->GetValue("payload"); std::string tmp = GetConfig()->GetValue("name"); - if (!tmp.empty()) + if (!tmp.empty()) { mName = tmp; + } mLimitOutputCharacters = GetConfig()->GetValue("limit"); } diff --git a/Utilities/PCG/include/PCG/pcg_extras.hpp b/Utilities/PCG/include/PCG/pcg_extras.hpp index 9a612a2cbdee2..cb40f933426b1 100644 --- a/Utilities/PCG/include/PCG/pcg_extras.hpp +++ b/Utilities/PCG/include/PCG/pcg_extras.hpp @@ -132,8 +132,9 @@ std::basic_ostream& if (desired_width > 16) { out.width(desired_width - 16); } - if (highpart != 0 || desired_width > 16) + if (highpart != 0 || desired_width > 16) { out << highpart; + } CharT oldfill = '\0'; if (highpart != 0) { out.width(16); @@ -168,8 +169,9 @@ std::basic_istream& { typename std::basic_istream::sentry s(in); - if (!s) + if (!s) { return in; + } constexpr auto BASE = pcg128_t(10ULL); pcg128_t current(0ULL); @@ -177,8 +179,9 @@ std::basic_istream& bool overflow = false; for (;;) { CharT wide_ch = in.get(); - if (!in.good()) + if (!in.good()) { break; + } auto ch = in.narrow(wide_ch, '\0'); if (ch < '0' || ch > '9') { in.unget(); @@ -194,8 +197,9 @@ std::basic_istream& if (did_nothing || overflow) { in.setstate(std::ios::failbit); - if (overflow) + if (overflow) { current = ~pcg128_t(0ULL); + } } value = current; @@ -223,8 +227,9 @@ std::basic_istream& { uint32_t value = 0xdecea5edU; in >> value; - if (!in && value == 0xdecea5edU) + if (!in && value == 0xdecea5edU) { return in; + } if (value > uint8_t(~0)) { in.setstate(std::ios::failbit); value = ~0U; @@ -425,10 +430,11 @@ SrcIter uneven_copy_impl( src_t value = 0; while (dest_first != dest_last) { - if ((count++ % SCALE) == 0) + if ((count++ % SCALE) == 0) { value = *src_first++; // Get more bits - else + } else { value >>= DEST_BITS; // Move down bits + } *dest_first++ = dest_t(value); // Truncates, ignores high bits. } @@ -549,8 +555,9 @@ auto bounded_rand(RngType& rng, typename RngType::result_type upper_bound) rtype threshold = (RngType::max() - RngType::min() + rtype(1) - upper_bound) % upper_bound; for (;;) { rtype r = rng() - RngType::min(); - if (r >= threshold) + if (r >= threshold) { return r % upper_bound; + } } } @@ -599,8 +606,9 @@ class seed_seq_from template void generate(Iter start, Iter finish) { - for (auto i = start; i != finish; ++i) + for (auto i = start; i != finish; ++i) { *i = result_type(rng_()); + } } constexpr size_t size() const @@ -654,11 +662,13 @@ std::ostream& operator<<(std::ostream& out, printable_typename) int status; char* pretty_name = abi::__cxa_demangle(implementation_typename, nullptr, nullptr, &status); - if (status == 0) + if (status == 0) { out << pretty_name; + } free(static_cast(pretty_name)); - if (status == 0) + if (status == 0) { return out; + } #endif out << implementation_typename; return out; diff --git a/Utilities/PCG/include/PCG/pcg_random.hpp b/Utilities/PCG/include/PCG/pcg_random.hpp index f98b863c1cffb..467167e9ff361 100644 --- a/Utilities/PCG/include/PCG/pcg_random.hpp +++ b/Utilities/PCG/include/PCG/pcg_random.hpp @@ -419,10 +419,11 @@ class engine : protected output_mixin, public: result_type operator()() { - if (output_previous) + if (output_previous) { return this->output(base_generate0()); - else + } else { return this->output(base_generate()); + } } result_type operator()(result_type upper_bound) @@ -1155,8 +1156,9 @@ struct inside_out : private baseclass { bool crosses_zero = forwards ? dist_to_zero <= delta : (-dist_to_zero) <= delta; - if (!forwards) + if (!forwards) { delta = -delta; + } state = baseclass::advance(state, delta, mult, inc); randval = baseclass::output(state); return crosses_zero; @@ -1212,13 +1214,15 @@ class extended : public baseclass if (may_tick) { bool tick = kdd ? (state & tick_mask) == state_type(0u) : (state >> tick_shift) == state_type(0u); - if (tick) + if (tick) { advance_table(); + } } if (may_tock) { bool tock = state == state_type(0u); - if (tock) + if (tock) { advance_table(); + } } return data_[index]; } @@ -1348,8 +1352,9 @@ template ::datainit( const result_type* data) { - for (size_t i = 0; i < table_size; ++i) + for (size_t i = 0; i < table_size; ++i) { data_[i] = data[i]; + } } template & << rng.increment() << space << rng.state_; - for (const auto& datum : rng.data_) + for (const auto& datum : rng.data_) { out << space << datum; + } out.flags(orig_flags); out.fill(orig_fill); @@ -1434,15 +1440,17 @@ std::basic_istream& auto& base_rng = static_cast(new_rng); in >> base_rng; - if (in.fail()) + if (in.fail()) { return in; + } auto orig_flags = in.flags(std::ios_base::dec | std::ios_base::skipws); for (auto& datum : new_rng.data_) { in >> datum; - if (in.fail()) + if (in.fail()) { goto bail; + } } rng = new_rng; @@ -1509,21 +1517,25 @@ void extended::advance( state_type adv_mask = baseclass::is_mcg ? tick_mask << 2 : tick_mask; state_type next_advance_distance = this->distance(zero, adv_mask); - if (!forwards) + if (!forwards) { next_advance_distance = (-next_advance_distance) & tick_mask; + } if (next_advance_distance < (distance & tick_mask)) { ++ticks; } - if (ticks) + if (ticks) { advance_table(ticks, forwards); + } } if (forwards) { - if (may_tock && this->distance(zero) <= distance) + if (may_tock && this->distance(zero) <= distance) { advance_table(); + } baseclass::advance(distance); } else { - if (may_tock && -(this->distance(zero)) <= distance) + if (may_tock && -(this->distance(zero)) <= distance) { advance_table(state_type(1U), false); + } baseclass::advance(-distance); } } diff --git a/Utilities/Publishers/src/DataPublisherDevice.cxx b/Utilities/Publishers/src/DataPublisherDevice.cxx index 0e3a6b1e9c727..598ac8c5413e7 100644 --- a/Utilities/Publishers/src/DataPublisherDevice.cxx +++ b/Utilities/Publishers/src/DataPublisherDevice.cxx @@ -126,8 +126,9 @@ bool DataPublisherDevice::HandleO2LogicalBlock(const byte* headerBuffer, // not handled in O2Device::ForEach at the moment // indicate that the block has not been processed by a 'false' if (!dataHeader || - (dataHeader->dataDescription) != o2::header::gDataDescriptionHeartbeatFrame) + (dataHeader->dataDescription) != o2::header::gDataDescriptionHeartbeatFrame) { return false; + } if (!hbfEnvelope) { LOG(ERROR) << "no heartbeat frame envelope header found"; @@ -190,8 +191,9 @@ bool DataPublisherDevice::AppendFile(const char* name, std::vector& bu { bool result = true; std::ifstream ifile(name, std::ifstream::binary); - if (ifile.bad()) + if (ifile.bad()) { return false; + } // get length of file: ifile.seekg(0, ifile.end); diff --git a/Utilities/aliceHLTwrapper/include/aliceHLTwrapper/AliHLTDataTypes.h b/Utilities/aliceHLTwrapper/include/aliceHLTwrapper/AliHLTDataTypes.h index f9bf1ce387c22..f618d117c388c 100644 --- a/Utilities/aliceHLTwrapper/include/aliceHLTwrapper/AliHLTDataTypes.h +++ b/Utilities/aliceHLTwrapper/include/aliceHLTwrapper/AliHLTDataTypes.h @@ -1579,12 +1579,16 @@ namespace std */ inline bool MatchExactly(const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2) { - for (int i = 0; i < kAliHLTComponentDataTypefIDsize; i++) - if (dt1.fID[i] != dt2.fID[i]) + for (int i = 0; i < kAliHLTComponentDataTypefIDsize; i++) { + if (dt1.fID[i] != dt2.fID[i]) { return false; - for (int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++) - if (dt1.fOrigin[i] != dt2.fOrigin[i]) + } + } + for (int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++) { + if (dt1.fOrigin[i] != dt2.fOrigin[i]) { return false; + } + } return true; } @@ -1595,10 +1599,12 @@ inline bool MatchExactly(const AliHLTComponentDataType& dt1, const AliHLTCompone */ inline bool operator==(const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2) { - if (MatchExactly(dt1, kAliHLTAllDataTypes)) + if (MatchExactly(dt1, kAliHLTAllDataTypes)) { return true; - if (MatchExactly(dt2, kAliHLTAllDataTypes)) + } + if (MatchExactly(dt2, kAliHLTAllDataTypes)) { return true; + } bool any1 = true, any2 = true, void1 = true, void2 = true, match = true; for (int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++) { @@ -1607,8 +1613,9 @@ inline bool operator==(const AliHLTComponentDataType& dt1, const AliHLTComponent void1 &= (dt1.fOrigin[i] == kAliHLTDataOriginVoid[i]); void2 &= (dt2.fOrigin[i] == kAliHLTDataOriginVoid[i]); match &= dt1.fOrigin[i] == dt2.fOrigin[i]; - if (!(match || (any2 && !void1) || (any1 && !void2))) + if (!(match || (any2 && !void1) || (any1 && !void2))) { return false; + } } any1 = true, any2 = true, match = true; @@ -1618,8 +1625,9 @@ inline bool operator==(const AliHLTComponentDataType& dt1, const AliHLTComponent void1 &= (dt1.fID[i] == kAliHLTVoidDataTypeID[i]); void2 &= (dt2.fID[i] == kAliHLTVoidDataTypeID[i]); match &= dt1.fID[i] == dt2.fID[i]; - if (!(match || (any2 && !void1) || (any1 && !void2))) + if (!(match || (any2 && !void1) || (any1 && !void2))) { return false; + } } return true; } @@ -1639,8 +1647,9 @@ inline bool operator!=(const AliHLTComponentDataType& dt1, const AliHLTComponent inline AliHLTComponentDataType operator|(const AliHLTComponentDataType srcdt, const char origin[kAliHLTComponentDataTypefOriginSize]) { AliHLTComponentDataType dt = srcdt; - for (int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++) + for (int i = 0; i < kAliHLTComponentDataTypefOriginSize; i++) { dt.fOrigin[i] = origin[i]; + } return dt; } @@ -1653,10 +1662,12 @@ inline AliHLTComponentDataType AliHLTComponentDataTypeInitializer(const char id[ { AliHLTComponentDataType dt = kAliHLTVoidDataType; int i = 0; - for (i = 0; i < kAliHLTComponentDataTypefIDsize && id[i] != 0; i++) + for (i = 0; i < kAliHLTComponentDataTypefIDsize && id[i] != 0; i++) { dt.fID[i] = id[i]; - for (i = 0; i < kAliHLTComponentDataTypefOriginSize && origin[i] != 0; i++) + } + for (i = 0; i < kAliHLTComponentDataTypefOriginSize && origin[i] != 0; i++) { dt.fOrigin[i] = origin[i]; + } return dt; } diff --git a/Utilities/aliceHLTwrapper/include/aliceHLTwrapper/AliHLTHOMERData.h b/Utilities/aliceHLTwrapper/include/aliceHLTwrapper/AliHLTHOMERData.h index 8d408e5c4e2eb..59c0ab41f93e3 100644 --- a/Utilities/aliceHLTwrapper/include/aliceHLTwrapper/AliHLTHOMERData.h +++ b/Utilities/aliceHLTwrapper/include/aliceHLTwrapper/AliHLTHOMERData.h @@ -220,8 +220,9 @@ class AliHLTHOMERBlockDescriptor void Initialize() { if (fHeader) { - for (unsigned ii = 0; ii < kCount_64b_Words; ii++) + for (unsigned ii = 0; ii < kCount_64b_Words; ii++) { ((homer_uint64*)fHeader)[ii] = (homer_uint64)0; + } ((homer_uint64*)fHeader)[kID_64b_Offset] = HOMER_BLOCK_DESCRIPTOR_TYPEID; ((homer_uint64*)fHeader)[kLength_64b_Offset] = GetHOMERBlockDescriptorSize(); ((homer_uint8*)fHeader)[kByteOrderAttribute_8b_Offset] = kHOMERNativeByteOrder; @@ -231,132 +232,157 @@ class AliHLTHOMERBlockDescriptor void SetByteOrder(homer_uint8 bo) const { - if (fHeader) + if (fHeader) { ((homer_uint8*)fHeader)[kByteOrderAttribute_8b_Offset] = bo; + } } homer_uint8 GetByteOrder() const { - if (fHeader) + if (fHeader) { return ((homer_uint8*)fHeader)[kByteOrderAttribute_8b_Offset]; + } return 0xFF; } void SetVersion(homer_uint8 v) const { - if (fHeader) + if (fHeader) { ((homer_uint8*)fHeader)[kVersionAttribute_8b_Offset] = v; + } } void SetID(homer_uint64 id) const { - if (fHeader) + if (fHeader) { ((homer_uint64*)fHeader)[kID_64b_Offset] = id; + } } void SetHeaderLength(homer_uint64 l) const { - if (fHeader) + if (fHeader) { ((homer_uint64*)fHeader)[kLength_64b_Offset] = l; + } } homer_uint64 GetHeaderLength() const { - if (fHeader) + if (fHeader) { return ((homer_uint64*)fHeader)[kLength_64b_Offset]; + } return 0; } void SetAlignment(homer_uint8 type, homer_uint8 align) const { - if (fHeader && type < 6) + if (fHeader && type < 6) { ((homer_uint8*)fHeader)[kAlignment_8b_StartOffset + type] = align; + } } void SetUInt64Alignment(homer_uint8 align) const { - if (fHeader) + if (fHeader) { ((homer_uint8*)fHeader)[kUInt64Alignment_8b_Offset] = align; + } } void SetUInt32Alignment(homer_uint8 align) const { - if (fHeader) + if (fHeader) { ((homer_uint8*)fHeader)[kUInt32Alignment_8b_Offset] = align; + } } void SetUInt16Alignment(homer_uint8 align) const { - if (fHeader) + if (fHeader) { ((homer_uint8*)fHeader)[kUInt16Alignment_8b_Offset] = align; + } } void SetUInt8Alignment(homer_uint8 align) const { - if (fHeader) + if (fHeader) { ((homer_uint8*)fHeader)[kUInt8Alignment_8b_Offset] = align; + } } void SetDoubleAlignment(homer_uint8 align) const { - if (fHeader) + if (fHeader) { ((homer_uint8*)fHeader)[kDoubleAlignment_8b_Offset] = align; + } } void SetFloatAlignment(homer_uint8 align) const { - if (fHeader) + if (fHeader) { ((homer_uint8*)fHeader)[kFloatAlignment_8b_Offset] = align; + } } void SetType(homer_uint64 t) const { - if (fHeader) + if (fHeader) { ((homer_uint64*)fHeader)[kType_64b_Offset] = t; + } } void SetSubType1(homer_uint64 st1) const { - if (fHeader) + if (fHeader) { ((homer_uint64*)fHeader)[kSubType1_64b_Offset] = st1; + } } void SetSubType2(homer_uint64 st2) const { - if (fHeader) + if (fHeader) { ((homer_uint64*)fHeader)[kSubType2_64b_Offset] = st2; + } } void SetBirth_s(homer_uint64 bs) const { - if (fHeader) + if (fHeader) { ((homer_uint64*)fHeader)[kBirth_s_64b_Offset] = bs; + } } void SetBirth_us(homer_uint64 bus) const { - if (fHeader) + if (fHeader) { ((homer_uint64*)fHeader)[kBirth_us_64b_Offset] = bus; + } } void SetProducerNode(homer_uint64 pn) const { - if (fHeader) + if (fHeader) { ((homer_uint64*)fHeader)[kProducerNode_64b_Offset] = pn; + } } void SetBlockOffset(homer_uint64 bo) const { - if (fHeader) + if (fHeader) { ((homer_uint64*)fHeader)[kOffset_64b_Offset] = bo; + } } homer_uint64 GetBlockOffset() const { - if (fHeader) + if (fHeader) { return ((homer_uint64*)fHeader)[kOffset_64b_Offset]; + } return 0; } void SetBlockSize(homer_uint64 bs) const { - if (fHeader) + if (fHeader) { ((homer_uint64*)fHeader)[kSize_64b_Offset] = bs; + } } homer_uint64 GetBlockSize() const { - if (fHeader) + if (fHeader) { return ((homer_uint64*)fHeader)[kSize_64b_Offset]; + } return 0; } void SetStatusFlags(homer_uint64 bs) const { - if (fHeader) + if (fHeader) { ((homer_uint64*)fHeader)[kStatusFlags_64b_Offset] = bs; + } } homer_uint64 GetStatusFlags() const { - if (fHeader) + if (fHeader) { return ((homer_uint64*)fHeader)[kStatusFlags_64b_Offset]; + } return 0; } diff --git a/Utilities/aliceHLTwrapper/src/Component.cxx b/Utilities/aliceHLTwrapper/src/Component.cxx index 41b8a6eaaf9b8..115faa1b3f765 100644 --- a/Utilities/aliceHLTwrapper/src/Component.cxx +++ b/Utilities/aliceHLTwrapper/src/Component.cxx @@ -120,7 +120,9 @@ int Component::init(int argc, char** argv) bpo::store(bpo::parse_command_line(argc, argv, od), varmap); for (int option = 0; option < OptionKeyLast; ++option) { - if (varmap.count(OptionKeys[option]) == 0) continue; + if (varmap.count(OptionKeys[option]) == 0) { + continue; + } switch (option) { case OptionKeyLibrary: break; case OptionKeyComponent: break; @@ -186,8 +188,9 @@ int Component::init(int argc, char** argv) mpSystem = iface.release(); // load the component library - if ((iResult = mpSystem->loadLibrary(varmap[OptionKeys[OptionKeyLibrary]].as().c_str())) != 0) + if ((iResult = mpSystem->loadLibrary(varmap[OptionKeys[OptionKeyLibrary]].as().c_str())) != 0) { return iResult > 0 ? -iResult : iResult; + } // chop the parameter string in order to provide parameters in the argc/argv format vector parameters; @@ -198,9 +201,13 @@ int Component::init(int argc, char** argv) char* iterator = parameterBuffer.get(); parameters.emplace_back(iterator); for (; *iterator != 0; iterator++) { - if (*iterator != ' ') continue; + if (*iterator != ' ') { + continue; + } *iterator = 0; // separate strings - if (*(iterator + 1) != ' ' && *(iterator + 1) != 0) parameters.emplace_back(iterator + 1); + if (*(iterator + 1) != ' ' && *(iterator + 1) != 0) { + parameters.emplace_back(iterator + 1); + } } } @@ -222,7 +229,9 @@ int Component::init(int argc, char** argv) int Component::process(vector& dataArray, cballoc_signal_t* cbAllocate) { - if (!mpSystem) return -ENOSYS; + if (!mpSystem) { + return -ENOSYS; + } int iResult = 0; unsigned outputBufferSize = 0; @@ -294,9 +303,13 @@ int Component::process(vector& dataArray, outputBlockCnt = 0; // TODO: check if that is working with the corresponding allocation method of the // component environment - if (pOutputBlocks) delete[] pOutputBlocks; + if (pOutputBlocks) { + delete[] pOutputBlocks; + } pOutputBlocks = nullptr; - if (pEventDoneData) delete pEventDoneData; + if (pEventDoneData) { + delete pEventDoneData; + } pEventDoneData = nullptr; iResult = mpSystem->processEvent(mProcessor, &evtData, &inputBlocks[0], &trigData, @@ -336,7 +349,9 @@ int Component::process(vector& dataArray, AliHLTComponentBlockData* pFiltered = pOutputBlocks; for (unsigned blockIndex = 0; blockIndex < outputBlockCnt; blockIndex++, pOutputBlock++) { // filter special data blocks - if (pOutputBlock->fDataType == kDataTypeEvent) continue; + if (pOutputBlock->fDataType == kDataTypeEvent) { + continue; + } // block descriptors without any attached payload are propagated bool bValid = pOutputBlock->fSize == 0; @@ -387,9 +402,13 @@ int Component::process(vector& dataArray, // until released. inputBlocks.clear(); outputBlockCnt = 0; - if (pOutputBlocks) delete[] pOutputBlocks; + if (pOutputBlocks) { + delete[] pOutputBlocks; + } pOutputBlocks = nullptr; - if (pEventDoneData) delete pEventDoneData; + if (pEventDoneData) { + delete pEventDoneData; + } pEventDoneData = nullptr; return -iResult; diff --git a/Utilities/aliceHLTwrapper/src/EventSampler.cxx b/Utilities/aliceHLTwrapper/src/EventSampler.cxx index 1bc9d827468c1..46a4b7f601a79 100644 --- a/Utilities/aliceHLTwrapper/src/EventSampler.cxx +++ b/Utilities/aliceHLTwrapper/src/EventSampler.cxx @@ -216,7 +216,9 @@ void EventSampler::samplerLoop() unsigned initialDelayInSeconds=mInitialDelay/1000; unsigned initialDelayInUSeconds=mInitialDelay%1000; unsigned eventPeriodInSeconds=mEventPeriod/1000000; - if (initialDelayInSeconds>0) sleep(initialDelayInSeconds); + if (initialDelayInSeconds > 0) { + sleep(initialDelayInSeconds); + } usleep(initialDelayInUSeconds); unique_ptr msg(fTransportFactory->CreateMessage()); @@ -253,7 +255,10 @@ void EventSampler::samplerLoop() } mNEvents++; - if (eventPeriodInSeconds>0) sleep(eventPeriodInSeconds); - else usleep(mEventPeriod); + if (eventPeriodInSeconds > 0) { + sleep(eventPeriodInSeconds); + } else { + usleep(mEventPeriod); + } } } diff --git a/Utilities/aliceHLTwrapper/src/HOMERFactory.cxx b/Utilities/aliceHLTwrapper/src/HOMERFactory.cxx index 9b75e367754af..f9c70a1da1ad6 100644 --- a/Utilities/aliceHLTwrapper/src/HOMERFactory.cxx +++ b/Utilities/aliceHLTwrapper/src/HOMERFactory.cxx @@ -88,8 +88,9 @@ HOMERFactory::~HOMERFactory() = default; AliHLTHOMERReader* HOMERFactory::OpenReader(const char* hostname, unsigned short port) { // Open Reader instance for host - if (sLibraryStatus < 0) + if (sLibraryStatus < 0) { return nullptr; + } sLibraryStatus = LoadHOMERLibrary(); if (sLibraryStatus <= 0) { @@ -107,8 +108,9 @@ AliHLTHOMERReader* HOMERFactory::OpenReader(const char* hostname, unsigned short AliHLTHOMERReader* HOMERFactory::OpenReader(unsigned int tcpCnt, const char** hostnames, unsigned short* ports) { // Open Reader instance for a list of hosts - if (sLibraryStatus < 0) + if (sLibraryStatus < 0) { return nullptr; + } sLibraryStatus = LoadHOMERLibrary(); if (sLibraryStatus <= 0) { @@ -127,8 +129,9 @@ AliHLTHOMERReader* HOMERFactory::OpenReader(unsigned int tcpCnt, const char** ho AliHLTHOMERReader* HOMERFactory::OpenReaderBuffer(const AliHLTUInt8_t* pBuffer, int size) { // Open Reader instance for a data buffer - if (sLibraryStatus < 0) + if (sLibraryStatus < 0) { return nullptr; + } sLibraryStatus = LoadHOMERLibrary(); if (sLibraryStatus <= 0) { @@ -148,8 +151,9 @@ int HOMERFactory::DeleteReader(AliHLTHOMERReader* pReader) // delete a reader // the actual deletion function is inside the HOMER library - if (sLibraryStatus < 0) + if (sLibraryStatus < 0) { return sLibraryStatus; + } sLibraryStatus = LoadHOMERLibrary(); if (sLibraryStatus <= 0) { @@ -166,8 +170,9 @@ int HOMERFactory::DeleteReader(AliHLTHOMERReader* pReader) AliHLTHOMERWriter* HOMERFactory::OpenWriter() { // open a Writer instance - if (sLibraryStatus < 0) + if (sLibraryStatus < 0) { return nullptr; + } sLibraryStatus = LoadHOMERLibrary(); if (sLibraryStatus <= 0) { @@ -185,8 +190,9 @@ AliHLTHOMERWriter* HOMERFactory::OpenWriter() int HOMERFactory::DeleteWriter(AliHLTHOMERWriter* pWriter) { // see header file for class documentation - if (sLibraryStatus < 0) + if (sLibraryStatus < 0) { return sLibraryStatus; + } sLibraryStatus = LoadHOMERLibrary(); if (sLibraryStatus <= 0) { @@ -262,15 +268,17 @@ int HOMERFactory::UnloadHOMERLibrary() const char** library = &sLibraries[0]; int* refcount = &sLibRefCount[0]; while (*library != nullptr) { - if (strcmp(*library, mLoadedLib) == 0) + if (strcmp(*library, mLoadedLib) == 0) { break; + } ++library; ++refcount; } // Decrease the reference count and remove the library if it is zero. - if (*refcount >= 0) + if (*refcount >= 0) { --(*refcount); + } if (*refcount == 0) { /* Matthias 2014-05-08 that part of the code has been disabled for the ROOT-independent version. TODO: dlopen is maintaining an internal reference count, which also makes the diff --git a/Utilities/aliceHLTwrapper/src/MessageFormat.cxx b/Utilities/aliceHLTwrapper/src/MessageFormat.cxx index ca6ef9c62589f..6d383f068ae9f 100644 --- a/Utilities/aliceHLTwrapper/src/MessageFormat.cxx +++ b/Utilities/aliceHLTwrapper/src/MessageFormat.cxx @@ -58,8 +58,9 @@ MessageFormat::MessageFormat() MessageFormat::~MessageFormat() { - if (mpFactory) + if (mpFactory) { delete mpFactory; + } mpFactory = nullptr; } @@ -144,9 +145,9 @@ int MessageFormat::addMessages(const std::vector& list) if (data.mSize > 0) { unsigned nofEventHeaders = mListEvtData.size(); int result = addMessage(data.mP, data.mSize); - if (result >= 0) + if (result >= 0) { totalCount += result; - else { + } else { cerr << "warning: no valid data blocks in message " << i << endl; } } else { @@ -161,8 +162,9 @@ int MessageFormat::readBlockSequence(uint8_t* buffer, unsigned size, { // read a sequence of blocks consisting of AliHLTComponentBlockData followed by payload // from a buffer - if (buffer == nullptr) + if (buffer == nullptr) { return 0; + } unsigned position = 0; std::vector input; while (position + sizeof(AliHLTComponentBlockData) < size) { @@ -197,13 +199,16 @@ int MessageFormat::readHOMERFormat(uint8_t* buffer, unsigned size, std::vector& descriptorList) const { // read message payload in HOMER format - if (mpFactory == nullptr) + if (mpFactory == nullptr) { const_cast(this)->mpFactory = new o2::alice_hlt::HOMERFactory; - if (buffer == nullptr || mpFactory == nullptr) + } + if (buffer == nullptr || mpFactory == nullptr) { return -EINVAL; + } unique_ptr reader(mpFactory->OpenReaderBuffer(buffer, size)); - if (reader.get() == nullptr) + if (reader.get() == nullptr) { return -ENOMEM; + } unsigned nofBlocks = 0; if (reader->ReadNextEvent() == 0) { @@ -377,14 +382,16 @@ std::vector MessageFormat::createMessages(const Ali pTarget = MakeTarget(msgSize, position, cbAllocate); memcpy(pTarget, headerMessage.data(), msgSize); mMessages.emplace_back(pTarget, msgSize); - if (cbAllocate == nullptr) + if (cbAllocate == nullptr) { position += msgSize; + } msgSize = dh.payloadSize; pTarget = MakeTarget(msgSize, position, cbAllocate); memcpy(pTarget, &hbfPayload, msgSize); mMessages.emplace_back(pTarget, msgSize); - if (cbAllocate == nullptr) + if (cbAllocate == nullptr) { position += msgSize; + } } unsigned msgSize = 0; do { @@ -442,8 +449,9 @@ std::vector MessageFormat::createMessages(const Ali if (mOutputMode == kOutputModeMultiPart) { // send one descriptor per block back to device mMessages.emplace_back(pTarget, offset); - if (cbAllocate == nullptr) + if (cbAllocate == nullptr) { position += offset; + } offset = 0; } else if (mOutputMode == kOutputModeO2) { o2::header::DataHeader dh; @@ -454,8 +462,9 @@ std::vector MessageFormat::createMessages(const Ali memcpy(pTarget, &dh, sizeof(o2::header::DataHeader)); offset += sizeof(o2::header::DataHeader); mMessages.emplace_back(pTarget, offset); - if (cbAllocate == nullptr) + if (cbAllocate == nullptr) { position += offset; + } offset = 0; if (mHeartbeatHeader.headerWord == 0) { // no heartbeat information availalbe, send the buffer @@ -472,8 +481,9 @@ std::vector MessageFormat::createMessages(const Ali memcpy(pTarget + offset, &mHeartbeatTrailer, sizeof(mHeartbeatTrailer)); offset += sizeof(mHeartbeatTrailer); mMessages.emplace_back(pTarget, offset); - if (cbAllocate == nullptr) + if (cbAllocate == nullptr) { position += offset; + } offset = 0; } } @@ -518,13 +528,16 @@ AliHLTHOMERWriter* MessageFormat::createHOMERFormat(const AliHLTComponentBlockDa { // send data blocks in HOMER format in one message int iResult = 0; - if (mpFactory == nullptr) + if (mpFactory == nullptr) { const_cast(this)->mpFactory = new o2::alice_hlt::HOMERFactory; - if (!mpFactory) + } + if (!mpFactory) { return nullptr; + } unique_ptr writer(mpFactory->OpenWriter()); - if (writer.get() == nullptr) + if (writer.get() == nullptr) { return nullptr; + } homer_uint64 homerHeader[kCount_64b_Words]; HOMERBlockDescriptor homerDescriptor(homerHeader); diff --git a/Utilities/aliceHLTwrapper/src/SystemInterface.cxx b/Utilities/aliceHLTwrapper/src/SystemInterface.cxx index da2a99e531f58..4026f55be909d 100644 --- a/Utilities/aliceHLTwrapper/src/SystemInterface.cxx +++ b/Utilities/aliceHLTwrapper/src/SystemInterface.cxx @@ -169,23 +169,26 @@ int SystemInterface::releaseSystem() bookkeeping of loaded libraries and unloading them before releasing the system? */ int iResult = 0; - if (mpAliHLTExtFctDeinitSystem) + if (mpAliHLTExtFctDeinitSystem) { iResult = (*mpAliHLTExtFctDeinitSystem)(); + } clear(); return iResult; } int SystemInterface::loadLibrary(const char* libname) { - if (!mpAliHLTExtFctLoadLibrary) + if (!mpAliHLTExtFctLoadLibrary) { return -ENOSYS; + } return (*mpAliHLTExtFctLoadLibrary)(libname); } int SystemInterface::unloadLibrary(const char* libname) { - if (!mpAliHLTExtFctUnloadLibrary) + if (!mpAliHLTExtFctUnloadLibrary) { return -ENOSYS; + } return (*mpAliHLTExtFctUnloadLibrary)(libname); } @@ -196,15 +199,17 @@ int SystemInterface::createComponent(const char* componentId, AliHLTComponentHandle* handle, const char* description) { - if (!mpAliHLTExtFctCreateComponent) + if (!mpAliHLTExtFctCreateComponent) { return -ENOSYS; + } return (*mpAliHLTExtFctCreateComponent)(componentId, environParam, argc, argv, handle, description); } int SystemInterface::destroyComponent(AliHLTComponentHandle handle) { - if (!mpAliHLTExtFctDestroyComponent) + if (!mpAliHLTExtFctDestroyComponent) { return -ENOSYS; + } return (*mpAliHLTExtFctDestroyComponent)(handle); } @@ -215,24 +220,27 @@ int SystemInterface::processEvent(AliHLTComponentHandle handle, AliHLTUInt32_t* outputBlockCnt, AliHLTComponentBlockData** outputBlocks, AliHLTComponentEventDoneData** edd) { - if (!mpAliHLTExtFctProcessEvent) + if (!mpAliHLTExtFctProcessEvent) { return -ENOSYS; + } return (*mpAliHLTExtFctProcessEvent)(handle, evtData, blocks, trigData, outputPtr, size, outputBlockCnt, outputBlocks, edd); } int SystemInterface::getOutputDataType(AliHLTComponentHandle handle, AliHLTComponentDataType* dataType) { - if (!mpAliHLTExtFctGetOutputDataType) + if (!mpAliHLTExtFctGetOutputDataType) { return -ENOSYS; + } return (*mpAliHLTExtFctGetOutputDataType)(handle, dataType); } int SystemInterface::getOutputSize(AliHLTComponentHandle handle, unsigned long* constEventBase, unsigned long* constBlockBase, double* inputBlockMultiplier) { - if (!mpAliHLTExtFctGetOutputSize) + if (!mpAliHLTExtFctGetOutputSize) { return -ENOSYS; + } return (*mpAliHLTExtFctGetOutputSize)(handle, constEventBase, constEventBase, inputBlockMultiplier); } @@ -264,7 +272,8 @@ void* SystemInterface::alloc(void* /*param*/, unsigned long size) void SystemInterface::dealloc(void* buffer, unsigned long /*size*/) { // deallocate memory - if (buffer == nullptr) + if (buffer == nullptr) { return; + } free(buffer); } diff --git a/Utilities/aliceHLTwrapper/src/WrapperDevice.cxx b/Utilities/aliceHLTwrapper/src/WrapperDevice.cxx index 6ad1f5155bee5..7ba026f7ba714 100644 --- a/Utilities/aliceHLTwrapper/src/WrapperDevice.cxx +++ b/Utilities/aliceHLTwrapper/src/WrapperDevice.cxx @@ -80,8 +80,9 @@ void WrapperDevice::InitTask() int iResult = 0; std::unique_ptr component(new o2::alice_hlt::Component); - if (!component.get()) + if (!component.get()) { return /*-ENOMEM*/; + } // loop over program options, check if the option was used and // add it together with the parameter to the argument vector. @@ -192,15 +193,17 @@ void WrapperDevice::Run() } } } - if (receivedAtLeastOneMessage) + if (receivedAtLeastOneMessage) { nReadCycles++; + } if (inputsReceived < numInputs) { continue; } mNSamples++; mTotalReadCycles += nReadCycles; - if (mMaxReadCycles < 0 || mMaxReadCycles < nReadCycles) + if (mMaxReadCycles < 0 || mMaxReadCycles < nReadCycles) { mMaxReadCycles = nReadCycles; + } // if (nReadCycles>1) { // LOG(INFO) << "------ recieved complete Msg from " << numInputs << " input(s) after " << nReadCycles << " read cycles" ; // } @@ -210,10 +213,12 @@ void WrapperDevice::Run() if (mLastSampleTime >= 0) { int sampleTimeDiff = duration.count() - mLastSampleTime; - if (mMinTimeBetweenSample < 0 || sampleTimeDiff < mMinTimeBetweenSample) + if (mMinTimeBetweenSample < 0 || sampleTimeDiff < mMinTimeBetweenSample) { mMinTimeBetweenSample = sampleTimeDiff; - if (mMaxTimeBetweenSample < 0 || sampleTimeDiff > mMaxTimeBetweenSample) + } + if (mMaxTimeBetweenSample < 0 || sampleTimeDiff > mMaxTimeBetweenSample) { mMaxTimeBetweenSample = sampleTimeDiff; + } } mLastSampleTime = duration.count(); if (duration.count() - mLastCalcTime > 1000) { diff --git a/Utilities/aliceHLTwrapper/src/runComponent.cxx b/Utilities/aliceHLTwrapper/src/runComponent.cxx index 4ed7636cab512..17d07cc37d61f 100644 --- a/Utilities/aliceHLTwrapper/src/runComponent.cxx +++ b/Utilities/aliceHLTwrapper/src/runComponent.cxx @@ -59,10 +59,11 @@ int main(int argc, char** argv) if (arg[1] == 'i' || arg[1] == 'o') { if (i + 1 >= argc) { cerr << "missing file name for option " << arg << endl; - } else if (arg[1] == 'i') + } else if (arg[1] == 'i') { inputFileName = argv[i + 1]; - else + } else { outputFileName = argv[i + 1]; + } break; } } @@ -101,11 +102,13 @@ int main(int argc, char** argv) if ((iResult = component.process(blockData)) < 0) { cerr << "error: init failed with " << iResult << endl; } - if (inputBuffer) + if (inputBuffer) { delete[] inputBuffer; + } inputBuffer = nullptr; - if (iResult < 0) + if (iResult < 0) { return -iResult; + } // for now, only the first buffer is written if (blockData.size() > 0) { diff --git a/Utilities/aliceHLTwrapper/test/testMessageFormat.cxx b/Utilities/aliceHLTwrapper/test/testMessageFormat.cxx index b28091e839e35..83681cbc2d117 100644 --- a/Utilities/aliceHLTwrapper/test/testMessageFormat.cxx +++ b/Utilities/aliceHLTwrapper/test/testMessageFormat.cxx @@ -50,8 +50,9 @@ BOOST_AUTO_TEST_CASE(test_createMessagesModeMultiPart) for (auto& desc : dataDescriptors) { totalPayloadSize += desc.fSize; hexDump("HLT data descriptor", &desc, sizeof(desc)); - if (!desc.fPtr) + if (!desc.fPtr) { continue; + } hexDump(" data payload", (char*)desc.fPtr + desc.fOffset, desc.fSize); } @@ -100,8 +101,9 @@ BOOST_AUTO_TEST_CASE(test_createMessagesModeSequence) for (auto& desc : dataDescriptors) { totalPayloadSize += desc.fSize; hexDump("HLT data descriptor", &desc, sizeof(desc)); - if (!desc.fPtr) + if (!desc.fPtr) { continue; + } hexDump(" data payload", (char*)desc.fPtr + desc.fOffset, desc.fSize); } @@ -142,8 +144,9 @@ BOOST_AUTO_TEST_CASE(test_createMessagesModeO2) for (auto& desc : dataDescriptors) { totalPayloadSize += desc.fSize; hexDump("HLT data descriptor", &desc, sizeof(desc)); - if (!desc.fPtr) + if (!desc.fPtr) { continue; + } hexDump(" data payload", (char*)desc.fPtr + desc.fOffset, desc.fSize); } @@ -173,8 +176,9 @@ BOOST_AUTO_TEST_CASE(test_createMessagesModeO2) dataidx = 0; for (auto& desc : descriptors) { hexDump("Readback: HLT data descriptor", &desc, sizeof(desc)); - if (!desc.fPtr) + if (!desc.fPtr) { continue; + } const char* data = (char*)desc.fPtr + desc.fOffset; hexDump(" data payload", data, desc.fSize); BOOST_CHECK(dataFields[dataidx++] == data); @@ -226,8 +230,9 @@ BOOST_AUTO_TEST_CASE(test_createHeartbeatFrame) for (auto& desc : dataDescriptors) { totalPayloadSize += desc.fSize; hexDump("HLT data descriptor", &desc, sizeof(desc)); - if (!desc.fPtr) + if (!desc.fPtr) { continue; + } hexDump(" data payload", (char*)desc.fPtr + desc.fOffset, desc.fSize); } diff --git a/Utilities/rANS/include/rANS/internal/EncoderSymbol.h b/Utilities/rANS/include/rANS/internal/EncoderSymbol.h index 133a97f10bae5..08fccf7fff284 100644 --- a/Utilities/rANS/include/rANS/internal/EncoderSymbol.h +++ b/Utilities/rANS/include/rANS/internal/EncoderSymbol.h @@ -92,8 +92,9 @@ struct EncoderSymbol { // Alverson, "Integer Division using reciprocals" // shift=ceil(log2(freq)) uint32_t shift = 0; - while (freq > (1u << shift)) + while (freq > (1u << shift)) { shift++; + } if constexpr (needs64Bit()) { uint64_t x0, x1, t0, t1; diff --git a/Utilities/rANS/src/SymbolStatistics.cxx b/Utilities/rANS/src/SymbolStatistics.cxx index 2b6a82793ad59..ca9934b236443 100644 --- a/Utilities/rANS/src/SymbolStatistics.cxx +++ b/Utilities/rANS/src/SymbolStatistics.cxx @@ -82,10 +82,11 @@ void SymbolStatistics::rescale() mCumulativeFrequencyTable.back() == newCumulatedFrequency); for (size_t i = 0; i < mFrequencyTable.size(); i++) { - if (mFrequencyTable[i] == 0) + if (mFrequencyTable[i] == 0) { assert(mCumulativeFrequencyTable[i + 1] == mCumulativeFrequencyTable[i]); - else + } else { assert(mCumulativeFrequencyTable[i + 1] > mCumulativeFrequencyTable[i]); + } // calc updated freq mFrequencyTable[i] = getFrequency(i);