Skip to content

Commit

Permalink
fix all compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
carltimmer committed Sep 19, 2024
1 parent 6d345ae commit ca95c57
Show file tree
Hide file tree
Showing 29 changed files with 73 additions and 95 deletions.
2 changes: 1 addition & 1 deletion src/libsrc++/BankHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace evio {
* @author timmer
* @date 4/23/2020
*/
class BankHeader : public BaseStructureHeader {
class BankHeader final : public BaseStructureHeader {

friend class EvioReader;

Expand Down
12 changes: 6 additions & 6 deletions src/libsrc++/BaseStructure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ namespace evio {

if (dataType.isStructure()) {
children.clear();
for (auto const kid : structure->children) {
for (auto kid : structure->children) {
children.push_back(kid);
}
}
Expand Down Expand Up @@ -1436,7 +1436,7 @@ namespace evio {
}

if (!(structure->isLeaf())) {
for (auto const child : structure->getChildren()) {
for (auto child : structure->getChildren()) {
visitAllDescendants(child, listener, filter);
}
}
Expand All @@ -1452,7 +1452,7 @@ namespace evio {
void BaseStructure::getMatchingStructures(std::shared_ptr<IEvioFilter> filter,
std::vector<std::shared_ptr<BaseStructure>> & vec) {

class myListener : public IEvioListener {
class myListener final : public IEvioListener {
std::vector<std::shared_ptr<BaseStructure>> & vec;
public:
explicit myListener(std::vector<std::shared_ptr<BaseStructure>> & v) : vec(v) {}
Expand Down Expand Up @@ -2657,7 +2657,7 @@ namespace evio {
else {
datalen = 0;

for (auto const child : children) {
for (auto child : children) {
len = child->setAllHeaderLengths();
//std::cout << " setAllHeaderLengths: child len = " << len << "\n";
// Add this check to make sure structure is not being overfilled
Expand Down Expand Up @@ -2885,7 +2885,7 @@ namespace evio {
}
} // isLeaf
else if (!children.empty()) {
for (auto const child : children) {
for (auto child : children) {
curPos += child->write(curPos, order);
}
} // not leaf
Expand Down Expand Up @@ -3376,7 +3376,7 @@ namespace evio {
rawBytes.clear();
// Get a rough idea of the size
size_t sz = 0;
for (auto const cd : compositeData) {
for (auto cd : compositeData) {
size_t cdSz = cd->getRawBytes().size();
//std::cout << "updateCompositeData: ADDing cd item of size = " << cdSz << "\n";
if (cdSz < 20) {
Expand Down
2 changes: 2 additions & 0 deletions src/libsrc++/BaseStructure.h
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,8 @@ namespace evio {

public:

virtual ~BaseStructure() = default;

void transform(std::shared_ptr<BaseStructure> structure);

virtual StructureType getStructureType() const {return StructureType::STRUCT_UNKNOWN32;};
Expand Down
1 change: 1 addition & 0 deletions src/libsrc++/BaseStructureHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ namespace evio {

BaseStructureHeader() = default;
BaseStructureHeader(uint16_t tag, DataType const & dataType, uint8_t num = 0);
virtual ~BaseStructureHeader() = default;

uint8_t getNumber() const;
void setNumber(uint8_t number);
Expand Down
2 changes: 1 addition & 1 deletion src/libsrc++/BlockHeaderV2.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace evio {
* @author heddle (original java version)
* @author timmer
*/
class BlockHeaderV2 : public IBlockHeader {
class BlockHeaderV2 final : public IBlockHeader {

public:

Expand Down
2 changes: 1 addition & 1 deletion src/libsrc++/BlockHeaderV4.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ namespace evio {
* @author heddle
* @author timmer
*/
class BlockHeaderV4 : public IBlockHeader {
class BlockHeaderV4 final : public IBlockHeader {

public:

Expand Down
22 changes: 11 additions & 11 deletions src/libsrc++/CompositeData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ namespace evio {

// Get a total length (# bytes)
size_t totalLen = 0, len;
for (auto const cd : data) {
for (auto cd : data) {
len = cd->getRawBytes().size();
totalLen += len;
}
Expand All @@ -447,7 +447,7 @@ namespace evio {

// Copy everything in
int offset = 0;
for (auto const cd : data) {
for (auto cd : data) {
len = cd->getRawBytes().size();
if (cd->byteOrder != order) {
//std::cout << "CompositeData::generateRawBytes call swapAll()" << std::endl;
Expand Down Expand Up @@ -1474,7 +1474,7 @@ namespace evio {
int imt = 0; // ifmt[] index
int lev = 0; // parenthesis level
int ncnf = 0; // how many times must repeat a format
int iterm = 0;
// int iterm = 0;

LV lv[10];

Expand Down Expand Up @@ -1827,7 +1827,8 @@ namespace evio {
int imt = 0; /* ifmt[] index */
int ncnf = 0; /* how many times must repeat a format */
int lev = 0; /* parenthesis level */
int kcnf, mcnf, iterm = 0;
int kcnf, mcnf;
// int iterm = 0;
int64_t *b64, *b64end, *b64dest;
int32_t *b32, *b32end, *b32dest;
int16_t *b16, *b16end, *b16dest;
Expand Down Expand Up @@ -2499,7 +2500,6 @@ namespace evio {
void CompositeData::dataToRawBytes(ByteBuffer & rawBuf, CompositeData::Data const & data,
std::vector<uint16_t> & ifmt) {

bool debug = false;
int kcnf, mcnf;

// check args
Expand All @@ -2515,7 +2515,7 @@ namespace evio {
int imt = 0; // ifmt[] index
int lev = 0; // parenthesis level
int ncnf = 0; // how many times must repeat a format
int iterm = 0;
// int iterm = 0;

int itemIndex = 0;
int itemCount = data.dataItems.size();
Expand All @@ -2538,7 +2538,7 @@ namespace evio {
// if format in parenthesis was processed the required number of times
if (lv[lev-1].irepeat >= lv[lev-1].nrepeat) {
// store left parenthesis index minus 1
iterm = lv[lev-1].left - 1;
//iterm = lv[lev-1].left - 1;
// done with this level - decrease parenthesis level
lev--;
}
Expand Down Expand Up @@ -2863,7 +2863,7 @@ namespace evio {
int imt = 0; // formatInts[] index
int lev = 0; // parenthesis level
int ncnf = 0; // how many times must repeat a format
int iterm = 0;
// int iterm = 0;

// start of data, index into data array
int dataIndex = 0;
Expand All @@ -2890,7 +2890,7 @@ namespace evio {
lv[lev-1].irepeat++;

if (lv[lev-1].irepeat >= lv[lev-1].nrepeat) {
iterm = lv[lev-1].left - 1;
//iterm = lv[lev-1].left - 1;
lev--;
}
else {
Expand Down Expand Up @@ -3267,7 +3267,7 @@ namespace evio {
int imt = 0; // formatInts[] index
int lev = 0; // parenthesis level
int ncnf = 0; // how many times must repeat a format
int iterm = 0;
// int iterm = 0;
int kcnf, mcnf;

// start of data, index into data array
Expand Down Expand Up @@ -3303,7 +3303,7 @@ namespace evio {
lv[lev-1].irepeat++;
// if format in parenthesis was processed
if (lv[lev-1].irepeat >= lv[lev-1].nrepeat) {
iterm = lv[lev-1].left - 1;
//iterm = lv[lev-1].left - 1;
lev--;
}
// go for another round of processing by setting 'imt' to the left parenthesis
Expand Down
2 changes: 1 addition & 1 deletion src/libsrc++/EventParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ namespace evio {
structs.reserve(25);

// Create a listener that puts all structures into a vector
class matchListener : public IEvioListener {
class matchListener final : public IEvioListener {
std::vector<std::shared_ptr<BaseStructure>> & vec;
public:
explicit matchListener(std::vector<std::shared_ptr<BaseStructure>> & v) : vec(v) {}
Expand Down
18 changes: 1 addition & 17 deletions src/libsrc++/EventWriterV4.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,9 @@ namespace evio {
private:
boost::asio::io_context ioContext;
boost::thread_group threadPool;
int size;

public:
FileCloserV4(int poolSize) : size(poolSize) {
FileCloserV4(int poolSize) {
// Create a work object to keep the io_context busy
boost::asio::io_context::work work(ioContext);

Expand Down Expand Up @@ -438,12 +437,6 @@ namespace evio {
*/
uint32_t splitIncrement = 0;

/** Track bytes written to help split a file. */
uint64_t splitEventBytes = 0ULL;

/** Track events written to help split a file. */
uint32_t splitEventCount = 0;

/**
* Id of this specific data stream.
* In CODA, a data stream is a chain of ROCS and EBs ending in a final EB (SEB or PEB) or ER.
Expand Down Expand Up @@ -472,15 +465,6 @@ namespace evio {
* so as to allow writing speed not to dip so low. */
std::shared_ptr<FileCloserV4> fileCloser = nullptr;

//-----------------------
/**
* Flag to do everything except the actual writing of data to file.
* Set true for testing purposes ONLY.
*/
bool noFileWriting = false;
//-----------------------



public:

Expand Down
17 changes: 9 additions & 8 deletions src/libsrc++/EvioBank.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ namespace evio {
*/
class EvioBank : public BaseStructure {

public:

protected:
// These constructors should be protected, but on the Mac clang will not allow getInstance
// to create shared pointers with protected constructors.

/** Constructor. */
EvioBank() : BaseStructure() {}
Expand All @@ -47,6 +49,8 @@ namespace evio {
*/
explicit EvioBank(std::shared_ptr<BankHeader> head) : BaseStructure(head) {}

virtual ~EvioBank() = default;

public:

/**
Expand All @@ -55,8 +59,7 @@ namespace evio {
* @return shared pointer to new EvioBank.
*/
static std::shared_ptr<EvioBank> getInstance() {
std::shared_ptr<EvioBank> pNode(new EvioBank());
return pNode;
return std::make_shared<EvioBank>();
}

/**
Expand All @@ -65,8 +68,7 @@ namespace evio {
* @return shared pointer to new EvioBank.
*/
static std::shared_ptr<EvioBank> getInstance(std::shared_ptr<BankHeader> head) {
std::shared_ptr<EvioBank> pNode(new EvioBank(head));
return pNode;
return std::make_shared<EvioBank>(head);
}

/**
Expand All @@ -77,9 +79,8 @@ namespace evio {
* @return shared pointer to new EvioBank.
*/
static std::shared_ptr<EvioBank> getInstance(uint16_t tag, DataType const & typ, uint8_t num) {
std::shared_ptr<BankHeader> head(new BankHeader(tag, typ, num));
std::shared_ptr<EvioBank> pNode(new EvioBank(head));
return pNode;
auto head = std::make_shared<BankHeader>(tag, typ, num);
return std::make_shared<EvioBank>(head);
}

/**
Expand Down
12 changes: 6 additions & 6 deletions src/libsrc++/EvioCompactReaderV4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ namespace evio {
//" for tag/num = " << tag << "/" << num << std::endl;

// Now look for matches in this event
for (auto const enode: list) {
for (auto enode: list) {
// std::cout << "searchEvent: desired tag = " << tag << " found " << enode->getTag() << std::endl;
// std::cout << " : desired num = " << num << " found " << enode->getNum() << std::endl;
if (enode->getTag() == tag && enode->getNum() == num) {
Expand Down Expand Up @@ -695,7 +695,7 @@ namespace evio {
uint32_t removeNodePlace = 0;

// Locate the node to be removed ...
for (auto const ev : eventNodes) {
for (auto ev : eventNodes) {
removeNodePlace = 0;

// See if it's an event ...
Expand All @@ -706,7 +706,7 @@ namespace evio {
break;
}

for (auto const n : ev->getAllNodes()) {
for (auto n : ev->getAllNodes()) {
// The first node in allNodes is the event node,
// so do not increment removeNodePlace now.

Expand Down Expand Up @@ -747,8 +747,8 @@ namespace evio {
byteBuffer = newBuffer;

// All nodes need to use this new buffer
for (auto const ev : eventNodes) {
for (auto const n : ev->getAllNodes()) {
for (auto ev : eventNodes) {
for (auto n : ev->getAllNodes()) {
n->setBuffer(byteBuffer);
}
}
Expand Down Expand Up @@ -988,7 +988,7 @@ namespace evio {
uint32_t place = eventNode->place;

for (int i=0; i < eventCount; i++) {
for (auto const n : eventNodes[i]->getAllNodes()) {
for (auto n : eventNodes[i]->getAllNodes()) {
// Make sure nodes are using the new buffer
n->setBuffer(newBuffer);

Expand Down
2 changes: 1 addition & 1 deletion src/libsrc++/EvioCompactReaderV4.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace evio {
* @date 07/01/2020
* @author timmer
*/
class EvioCompactReaderV4 : public IEvioCompactReader {
class EvioCompactReaderV4 final : public IEvioCompactReader {

public:

Expand Down
2 changes: 1 addition & 1 deletion src/libsrc++/EvioCompactReaderV6.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace evio {
* @date 07/09/2020
* @author timmer
*/
class EvioCompactReaderV6 : public IEvioCompactReader {
class EvioCompactReaderV6 final : public IEvioCompactReader {

private:

Expand Down
2 changes: 1 addition & 1 deletion src/libsrc++/EvioEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace evio {
* @author timmer
* @date 5/19/2020
*/
class EvioEvent : public EvioBank {
class EvioEvent final : public EvioBank {

private:

Expand Down
2 changes: 1 addition & 1 deletion src/libsrc++/EvioReaderV4.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace evio {
* @author heddle (original java version)
* @author timmer
*/
class EvioReaderV4 : public IEvioReader {
class EvioReaderV4 final : public IEvioReader {

public:

Expand Down
2 changes: 1 addition & 1 deletion src/libsrc++/EvioReaderV6.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace evio {
* @author timmer
* @date 6/16/2020
*/
class EvioReaderV6 : public IEvioReader {
class EvioReaderV6 final : public IEvioReader {

private:

Expand Down
1 change: 0 additions & 1 deletion src/libsrc++/EvioSwap.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@ namespace evio {
static void swapData(std::shared_ptr<BaseStructure> strc) {
auto type = strc->getHeader()->getDataType();
uint32_t length = strc->getHeader()->getDataLength();
bool srcIsLocal = strc->getByteOrder().isLocalEndian();

if (type == DataType::UINT32) {
auto & vec = strc->getUIntData();
Expand Down
Loading

0 comments on commit ca95c57

Please sign in to comment.