diff --git a/include/rogue/hardware/drivers/DmaDriver.h b/include/rogue/hardware/drivers/DmaDriver.h index 71fd6cc26..4e400886c 100644 --- a/include/rogue/hardware/drivers/DmaDriver.h +++ b/include/rogue/hardware/drivers/DmaDriver.h @@ -133,10 +133,6 @@ struct DmaRegisterData { // Conditional inclusion for non-kernel environments #ifndef DMA_IN_KERNEL - #include - #include - #include - #include #include #include #include @@ -144,6 +140,11 @@ struct DmaRegisterData { #include #include + #include + #include + #include + #include + /** * dmaWrite - Writes data to a DMA channel. * @fd: File descriptor for the DMA device. @@ -167,7 +168,7 @@ static inline ssize_t dmaWrite(int32_t fd, const void* buf, size_t size, uint32_ w.flags = flags; w.size = size; w.is32 = (sizeof(void*) == 4); - w.data = (uint64_t)buf; + w.data = (uint64_t)buf; // NOLINT return (write(fd, &w, sizeof(struct DmaWriteData))); } @@ -237,7 +238,7 @@ static inline ssize_t dmaWriteVector(int32_t fd, w.flags = (x == 0) ? begFlags : ((x == (iovlen - 1)) ? endFlags : midFlags); w.size = iov[x].iov_len; w.is32 = (sizeof(void*) == 4); - w.data = (uint64_t)iov[x].iov_base; + w.data = (uint64_t)iov[x].iov_base; // NOLINT do { res = write(fd, &w, sizeof(struct DmaWriteData)); @@ -288,7 +289,7 @@ static inline ssize_t dmaWriteIndexVector(int32_t fd, w.flags = (x == 0) ? begFlags : ((x == (iovlen - 1)) ? endFlags : midFlags); w.size = iov[x].iov_len; w.is32 = (sizeof(void*) == 4); - w.index = (uint32_t)(((uint64_t)iov[x].iov_base) & 0xFFFFFFFF); + w.index = (uint32_t)(((uint64_t)iov[x].iov_base) & 0xFFFFFFFF); // NOLINT do { res = write(fd, &w, sizeof(struct DmaWriteData)); @@ -324,7 +325,7 @@ static inline ssize_t dmaRead(int32_t fd, void* buf, size_t maxSize, uint32_t* f memset(&r, 0, sizeof(struct DmaReadData)); r.size = maxSize; r.is32 = (sizeof(void*) == 4); - r.data = (uint64_t)buf; + r.data = (uint64_t)buf; // NOLINT ret = read(fd, &r, sizeof(struct DmaReadData)); diff --git a/include/rogue/interfaces/stream/Master.h b/include/rogue/interfaces/stream/Master.h index f64316074..02951561c 100644 --- a/include/rogue/interfaces/stream/Master.h +++ b/include/rogue/interfaces/stream/Master.h @@ -19,8 +19,8 @@ #include "rogue/Directives.h" #include -#include +#include #include #include #include diff --git a/include/rogue/protocols/xilinx/JtagDriver.h b/include/rogue/protocols/xilinx/JtagDriver.h index cecb8c5c6..263c9e530 100644 --- a/include/rogue/protocols/xilinx/JtagDriver.h +++ b/include/rogue/protocols/xilinx/JtagDriver.h @@ -20,13 +20,13 @@ #include "rogue/Directives.h" -#include #include #include -#include -#include #include +#include +#include +#include #include #include #include diff --git a/src/package.cpp b/src/package.cpp index 2832749df..f9e02bfe7 100644 --- a/src/package.cpp +++ b/src/package.cpp @@ -18,6 +18,7 @@ #include "rogue/Directives.h" #include +#include #include "rogue/Version.h" #include "rogue/module.h" diff --git a/src/rogue/GeneralError.cpp b/src/rogue/GeneralError.cpp index aa349c417..e6e83aa78 100644 --- a/src/rogue/GeneralError.cpp +++ b/src/rogue/GeneralError.cpp @@ -20,6 +20,9 @@ #include +#include +#include + #ifndef NO_PYTHON #include namespace bp = boost::python; diff --git a/src/rogue/Logging.cpp b/src/rogue/Logging.cpp index 658d23395..5f6c7729c 100644 --- a/src/rogue/Logging.cpp +++ b/src/rogue/Logging.cpp @@ -20,11 +20,14 @@ #include #include -#include #include #include +#include +#include #include +#include +#include #if defined(__linux__) #include @@ -156,7 +159,7 @@ void rogue::Logging::logThreadId() { #elif defined(__APPLE__) && defined(__MACH__) uint64_t tid64; pthread_threadid_np(NULL, &tid64); - tid = (uint32_t)tid64; + tid = static_cast(tid64); #else tid = 0; #endif diff --git a/src/rogue/Version.cpp b/src/rogue/Version.cpp index 92e07721d..2c5c8c4b4 100644 --- a/src/rogue/Version.cpp +++ b/src/rogue/Version.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include diff --git a/src/rogue/hardware/MemMap.cpp b/src/rogue/hardware/MemMap.cpp index 33fe8c8d1..3de1fd946 100644 --- a/src/rogue/hardware/MemMap.cpp +++ b/src/rogue/hardware/MemMap.cpp @@ -20,12 +20,12 @@ #include #include -#include #include #include #include #include +#include #include #include #include diff --git a/src/rogue/hardware/axi/AxiMemMap.cpp b/src/rogue/hardware/axi/AxiMemMap.cpp index 2be33d6d2..628df613f 100644 --- a/src/rogue/hardware/axi/AxiMemMap.cpp +++ b/src/rogue/hardware/axi/AxiMemMap.cpp @@ -20,14 +20,15 @@ #include #include -#include #include #include #include #include +#include #include #include +#include #include #include "rogue/GeneralError.h" diff --git a/src/rogue/hardware/axi/AxiStreamDma.cpp b/src/rogue/hardware/axi/AxiStreamDma.cpp index 40111d6a7..540fc5239 100644 --- a/src/rogue/hardware/axi/AxiStreamDma.cpp +++ b/src/rogue/hardware/axi/AxiStreamDma.cpp @@ -19,9 +19,12 @@ #include "rogue/hardware/axi/AxiStreamDma.h" #include -#include +#include +#include +#include #include +#include #include "rogue/GeneralError.h" #include "rogue/GilRelease.h" diff --git a/src/rogue/interfaces/ZmqClient.cpp b/src/rogue/interfaces/ZmqClient.cpp index cc37bf36e..9de23e302 100644 --- a/src/rogue/interfaces/ZmqClient.cpp +++ b/src/rogue/interfaces/ZmqClient.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include diff --git a/src/rogue/interfaces/api/Bsp.cpp b/src/rogue/interfaces/api/Bsp.cpp index b4b8d3066..757607377 100644 --- a/src/rogue/interfaces/api/Bsp.cpp +++ b/src/rogue/interfaces/api/Bsp.cpp @@ -17,6 +17,7 @@ #include "rogue/interfaces/api/Bsp.h" #include +#include #include #include "rogue/GeneralError.h" diff --git a/src/rogue/interfaces/memory/Block.cpp b/src/rogue/interfaces/memory/Block.cpp index 563d5c923..d6d21ae87 100644 --- a/src/rogue/interfaces/memory/Block.cpp +++ b/src/rogue/interfaces/memory/Block.cpp @@ -20,14 +20,17 @@ #include "rogue/interfaces/memory/Block.h" #include -#include #include #include +#include +#include #include #include #include #include +#include +#include #include "rogue/GeneralError.h" #include "rogue/GilRelease.h" @@ -195,12 +198,12 @@ void rim::Block::intStartTransaction(uint32_t type, bool forceWr, bool check, ri } else { if (type == rim::Read || type == rim::Verify) { if (index < 0 || index >= var->numValues_) { - lowByte = var->lowTranByte_[0]; + lowByte = var->lowTranByte_[0]; - if ( var->numValues_ == 0 ) { + if (var->numValues_ == 0) { highByte = var->highTranByte_[0]; } else { - highByte = var->highTranByte_[var->numValues_-1]; + highByte = var->highTranByte_[var->numValues_ - 1]; } } else { lowByte = var->lowTranByte_[index]; @@ -511,14 +514,14 @@ void rim::Block::addVariables(std::vector variables) { (*vit)->verifyEn_); } - // List variables + // List variables } else { for (x = 0; x < (*vit)->numValues_; x++) { // Variable allows overlaps, add to overlap enable mask if ((*vit)->overlapEn_) { setBits(oleMask, x * (*vit)->valueStride_ + (*vit)->bitOffset_[0], (*vit)->valueBits_); - // Otherwise add to exclusive mask and check for existing mapping + // Otherwise add to exclusive mask and check for existing mapping } else { if (anyBits(excMask, x * (*vit)->valueStride_ + (*vit)->bitOffset_[0], (*vit)->valueBits_)) throw(rogue::GeneralError::create( @@ -572,7 +575,7 @@ void rim::Block::addVariables(std::vector variables) { x = 0; while (rem > 0) { - ss << "0x" << std::setfill('0') << std::hex << std::setw(2) << (uint32_t)(verifyMask_[x]) << " "; + ss << "0x" << std::setfill('0') << std::hex << std::setw(2) << static_cast(verifyMask_[x]) << " "; x++; rem--; if (rem == 0 || x % 10 == 0) { @@ -1010,7 +1013,7 @@ bp::object rim::Block::getUIntPy(rim::Variable* var, int32_t index) { PyArrayObject* arr = reinterpret_cast(obj); uint32_t* dst = reinterpret_cast(PyArray_DATA(arr)); - for (x = 0; x < var->numValues_; x++) dst[x] = (uint32_t)getUInt(var, x); + for (x = 0; x < var->numValues_; x++) dst[x] = static_cast(getUInt(var, x)); } boost::python::handle<> handle(obj); ret = bp::object(handle); @@ -1086,13 +1089,13 @@ void rim::Block::setIntPy(bp::object& value, rim::Variable* var, int32_t index) var->name_.c_str())); if (PyArray_TYPE(arr) == NPY_INT64) { - int64_t* src = reinterpret_cast(PyArray_DATA(arr)); + int64_t* src = reinterpret_cast(PyArray_DATA(arr)); npy_intp stride = strides[0] / sizeof(int64_t); for (x = 0; x < dims[0]; x++) { setInt(src[x * stride], var, index + x); } } else if (PyArray_TYPE(arr) == NPY_INT32) { - int32_t* src = reinterpret_cast(PyArray_DATA(arr)); + int32_t* src = reinterpret_cast(PyArray_DATA(arr)); npy_intp stride = strides[0] / sizeof(int32_t); for (x = 0; x < dims[0]; x++) { setInt(src[x * stride], var, index + x); @@ -1175,7 +1178,7 @@ bp::object rim::Block::getIntPy(rim::Variable* var, int32_t index) { PyArrayObject* arr = reinterpret_cast(obj); int32_t* dst = reinterpret_cast(PyArray_DATA(arr)); - for (x = 0; x < var->numValues_; x++) dst[x] = (int32_t)getInt(var, x); + for (x = 0; x < var->numValues_; x++) dst[x] = static_cast(getInt(var, x)); } boost::python::handle<> handle(obj); ret = bp::object(handle); @@ -1214,7 +1217,9 @@ int64_t rim::Block::getInt(rim::Variable* var, int32_t index) { getBytes(reinterpret_cast(&tmp), var, index); if (var->valueBits_ != 64) { - if (tmp >= (uint64_t)pow(2, var->valueBits_ - 1)) tmp -= (uint64_t)pow(2, var->valueBits_); + if (tmp >= static_cast(pow(2, var->valueBits_ - 1))) { + tmp -= static_cast(pow(2, var->valueBits_)); + } } return tmp; } @@ -1255,7 +1260,7 @@ void rim::Block::setBoolPy(bp::object& value, rim::Variable* var, int32_t index) var->name_.c_str())); if (PyArray_TYPE(arr) == NPY_BOOL) { - bool* src = reinterpret_cast(PyArray_DATA(arr)); + bool* src = reinterpret_cast(PyArray_DATA(arr)); npy_intp stride = strides[0] / sizeof(bool); for (x = 0; x < dims[0]; x++) { setBool(src[x * stride], var, index + x); @@ -1467,7 +1472,7 @@ void rim::Block::setFloatPy(bp::object& value, rim::Variable* var, int32_t index var->name_.c_str())); if (PyArray_TYPE(arr) == NPY_FLOAT32) { - float* src = reinterpret_cast(PyArray_DATA(arr)); + float* src = reinterpret_cast(PyArray_DATA(arr)); npy_intp stride = strides[0] / sizeof(float); for (x = 0; x < dims[0]; x++) { setFloat(src[x * stride], var, index + x); @@ -1616,7 +1621,7 @@ void rim::Block::setDoublePy(bp::object& value, rim::Variable* var, int32_t inde var->name_.c_str())); if (PyArray_TYPE(arr) == NPY_FLOAT64) { - double* src = reinterpret_cast(PyArray_DATA(arr)); + double* src = reinterpret_cast(PyArray_DATA(arr)); npy_intp stride = strides[0] / sizeof(double); for (x = 0; x < dims[0]; x++) { setDouble(src[x * stride], var, index + x); @@ -1765,7 +1770,7 @@ void rim::Block::setFixedPy(bp::object& value, rim::Variable* var, int32_t index var->name_.c_str())); if (PyArray_TYPE(arr) == NPY_FLOAT64) { - double* src = reinterpret_cast(PyArray_DATA(arr)); + double* src = reinterpret_cast(PyArray_DATA(arr)); npy_intp stride = strides[0] / sizeof(double); for (x = 0; x < dims[0]; x++) { setFixed(src[x * stride], var, index + x); @@ -1867,7 +1872,7 @@ void rim::Block::setFixed(const double& val, rim::Variable* var, int32_t index) var->maxValue_)); // Convert - int64_t fPoint = (int64_t)round(val * pow(2, var->binPoint_)); + int64_t fPoint = static_cast(round(val * pow(2, var->binPoint_))); // Check for positive edge case uint64_t mask = 1 << (var->valueBits_ - 1); if (val > 0 && ((fPoint & mask) != 0)) { diff --git a/src/rogue/interfaces/memory/Emulate.cpp b/src/rogue/interfaces/memory/Emulate.cpp index 0cdce91d9..62520905c 100644 --- a/src/rogue/interfaces/memory/Emulate.cpp +++ b/src/rogue/interfaces/memory/Emulate.cpp @@ -21,9 +21,11 @@ #include "rogue/interfaces/memory/Emulate.h" #include -#include +#include #include +#include +#include #include "rogue/GilRelease.h" #include "rogue/interfaces/memory/Constants.h" diff --git a/src/rogue/interfaces/memory/Hub.cpp b/src/rogue/interfaces/memory/Hub.cpp index 742f15cc5..95c1958ef 100644 --- a/src/rogue/interfaces/memory/Hub.cpp +++ b/src/rogue/interfaces/memory/Hub.cpp @@ -24,6 +24,7 @@ #include #include +#include #include "rogue/GilRelease.h" #include "rogue/ScopedGil.h" diff --git a/src/rogue/interfaces/memory/Master.cpp b/src/rogue/interfaces/memory/Master.cpp index e4c9e84ac..be47fe6eb 100644 --- a/src/rogue/interfaces/memory/Master.cpp +++ b/src/rogue/interfaces/memory/Master.cpp @@ -19,10 +19,11 @@ #include "rogue/interfaces/memory/Master.h" #include -#include +#include #include #include +#include #include "rogue/GeneralError.h" #include "rogue/GilRelease.h" diff --git a/src/rogue/interfaces/memory/Slave.cpp b/src/rogue/interfaces/memory/Slave.cpp index 709e7e709..80d4e8bf6 100644 --- a/src/rogue/interfaces/memory/Slave.cpp +++ b/src/rogue/interfaces/memory/Slave.cpp @@ -19,6 +19,7 @@ #include "rogue/interfaces/memory/Slave.h" #include +#include #include "rogue/GeneralError.h" #include "rogue/GilRelease.h" diff --git a/src/rogue/interfaces/memory/TcpClient.cpp b/src/rogue/interfaces/memory/TcpClient.cpp index 9d451024f..586561a2c 100644 --- a/src/rogue/interfaces/memory/TcpClient.cpp +++ b/src/rogue/interfaces/memory/TcpClient.cpp @@ -19,11 +19,11 @@ #include "rogue/interfaces/memory/TcpClient.h" #include -#include #include #include #include +#include #include "rogue/GeneralError.h" #include "rogue/GilRelease.h" diff --git a/src/rogue/interfaces/memory/TcpServer.cpp b/src/rogue/interfaces/memory/TcpServer.cpp index 77eb287a7..be04cf6da 100644 --- a/src/rogue/interfaces/memory/TcpServer.cpp +++ b/src/rogue/interfaces/memory/TcpServer.cpp @@ -19,11 +19,11 @@ #include "rogue/interfaces/memory/TcpServer.h" #include -#include #include #include #include +#include #include "rogue/GeneralError.h" #include "rogue/GilRelease.h" diff --git a/src/rogue/interfaces/memory/Transaction.cpp b/src/rogue/interfaces/memory/Transaction.cpp index f5962d1b2..f33956335 100644 --- a/src/rogue/interfaces/memory/Transaction.cpp +++ b/src/rogue/interfaces/memory/Transaction.cpp @@ -22,7 +22,9 @@ #include #include +#include #include +#include #include "rogue/GeneralError.h" #include "rogue/GilRelease.h" diff --git a/src/rogue/interfaces/memory/Variable.cpp b/src/rogue/interfaces/memory/Variable.cpp index 3bb928625..a9523981c 100644 --- a/src/rogue/interfaces/memory/Variable.cpp +++ b/src/rogue/interfaces/memory/Variable.cpp @@ -18,14 +18,17 @@ #include "rogue/interfaces/memory/Variable.h" -#include #include #include +#include +#include #include #include #include #include +#include +#include #include "rogue/GeneralError.h" #include "rogue/GilRelease.h" @@ -470,7 +473,7 @@ void rim::Variable::shiftOffsetDown(uint32_t shift, uint32_t minSize) { highTranByte_[0] = varBytes_ - 1; staleHighByte_ = highTranByte_[0]; - // List variable + // List variable } else { for (x = 0; x < numValues_; x++) { lowTranByte_[x] = @@ -702,7 +705,7 @@ std::string rim::Variable::getDumpValue(bool read) { else index = 0; - while (index < (int32_t)numValues_) { + while (index < static_cast(numValues_)) { ret << " "; switch (modelId_) { @@ -710,7 +713,7 @@ std::string rim::Variable::getDumpValue(bool read) { (block_->*getByteArray_)(byteData, this, index); ret << "0x"; for (x = 0; x < valueBytes_; x++) - ret << std::setfill('0') << std::setw(2) << std::hex << (uint32_t)byteData[x]; + ret << std::setfill('0') << std::setw(2) << std::hex << static_cast(byteData[x]); break; case rim::UInt: @@ -718,7 +721,7 @@ std::string rim::Variable::getDumpValue(bool read) { (block_->*getByteArray_)(byteData, this, index); ret << "0x"; for (x = 0; x < valueBytes_; x++) - ret << std::setfill('0') << std::setw(2) << std::hex << (uint32_t)byteData[x]; + ret << std::setfill('0') << std::setw(2) << std::hex << static_cast(byteData[x]); } else { ret << (block_->*getUInt_)(this, index); } @@ -729,7 +732,7 @@ std::string rim::Variable::getDumpValue(bool read) { (block_->*getByteArray_)(byteData, this, index); ret << "0x"; for (x = 0; x < valueBytes_; x++) - ret << std::setfill('0') << std::setw(2) << std::hex << (uint32_t)byteData[x]; + ret << std::setfill('0') << std::setw(2) << std::hex << static_cast(byteData[x]); } else { ret << (block_->*getInt_)(this, index); } diff --git a/src/rogue/interfaces/stream/Buffer.cpp b/src/rogue/interfaces/stream/Buffer.cpp index 8608f8202..21b18c88e 100644 --- a/src/rogue/interfaces/stream/Buffer.cpp +++ b/src/rogue/interfaces/stream/Buffer.cpp @@ -19,6 +19,7 @@ #include +#include #include #include "rogue/GeneralError.h" @@ -77,14 +78,14 @@ void ris::Buffer::setMeta(uint32_t meta) { //! Adjust header by passed value void ris::Buffer::adjustHeader(int32_t value) { // Decreasing header size - if (value < 0 && (uint32_t)abs(value) > headRoom_) + if (value < 0 && static_cast(abs(value)) > headRoom_) throw(rogue::GeneralError::create("Buffer::adjustHeader", "Attempt to reduce header with size %" PRIu32 " by %" PRIi32, headRoom_, value)); // Increasing header size - if (value > 0 && (uint32_t)value > (rawSize_ - (headRoom_ + tailRoom_))) + if (value > 0 && static_cast(value) > (rawSize_ - (headRoom_ + tailRoom_))) throw(rogue::GeneralError::create("Buffer::adjustHeader", "Attempt to increase header by %" PRIi32 " in buffer with size %" PRIu32, value, @@ -111,14 +112,14 @@ void ris::Buffer::zeroHeader() { //! Adjust tail by passed value void ris::Buffer::adjustTail(int32_t value) { // Decreasing tail size - if (value < 0 && (uint32_t)abs(value) > tailRoom_) + if (value < 0 && static_cast(abs(value)) > tailRoom_) throw(rogue::GeneralError::create("Buffer::adjustTail", "Attempt to reduce tail with size %" PRIu32 " by %" PRIi32, tailRoom_, value)); // Increasing tail size - if (value > 0 && (uint32_t)value > (rawSize_ - (headRoom_ + tailRoom_))) + if (value > 0 && static_cast(value) > (rawSize_ - (headRoom_ + tailRoom_))) throw(rogue::GeneralError::create("Buffer::adjustTail", "Attempt to increase header by %" PRIi32 " in buffer with size %" PRIu32, value, @@ -226,7 +227,7 @@ void ris::Buffer::minPayload(uint32_t size) { //! Adjust payload size void ris::Buffer::adjustPayload(int32_t value) { - if (value < 0 && (uint32_t)abs(value) > getPayload()) + if (value < 0 && static_cast(abs(value)) > getPayload()) throw(rogue::GeneralError::create("Buffer::adjustPayload", "Attempt to decrease payload by %" PRIi32 " in buffer with size %" PRIu32, value, diff --git a/src/rogue/interfaces/stream/Frame.cpp b/src/rogue/interfaces/stream/Frame.cpp index aeaa74fad..2348aeefb 100644 --- a/src/rogue/interfaces/stream/Frame.cpp +++ b/src/rogue/interfaces/stream/Frame.cpp @@ -20,6 +20,7 @@ #include +#include #include #include "rogue/GeneralError.h" @@ -219,7 +220,7 @@ void ris::Frame::minPayload(uint32_t size) { void ris::Frame::adjustPayload(int32_t value) { uint32_t size = getPayload(); - if (value < 0 && (uint32_t)abs(value) > size) + if (value < 0 && static_cast(abs(value)) > size) throw(rogue::GeneralError::create("Frame::adjustPayload", "Attempt to reduce payload by %" PRIi32 " in frame with size %" PRIu32, value, diff --git a/src/rogue/interfaces/stream/FrameIterator.cpp b/src/rogue/interfaces/stream/FrameIterator.cpp index bfc345178..abf860461 100644 --- a/src/rogue/interfaces/stream/FrameIterator.cpp +++ b/src/rogue/interfaces/stream/FrameIterator.cpp @@ -156,7 +156,7 @@ uint8_t* ris::FrameIterator::ptr() const { //! De-reference by index uint8_t ris::FrameIterator::operator[](const uint32_t offset) const { ris::FrameIterator ret(*this); - ret.increment((int32_t)offset); + ret.increment(static_cast(offset)); return *ret; } diff --git a/src/rogue/interfaces/stream/Master.cpp b/src/rogue/interfaces/stream/Master.cpp index 3fdb9927e..34bcff666 100644 --- a/src/rogue/interfaces/stream/Master.cpp +++ b/src/rogue/interfaces/stream/Master.cpp @@ -21,6 +21,7 @@ #include #include +#include #include "rogue/GeneralError.h" #include "rogue/GilRelease.h" diff --git a/src/rogue/interfaces/stream/RateDrop.cpp b/src/rogue/interfaces/stream/RateDrop.cpp index 34773d223..a369b5b2c 100644 --- a/src/rogue/interfaces/stream/RateDrop.cpp +++ b/src/rogue/interfaces/stream/RateDrop.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include "rogue/Logging.h" @@ -57,12 +58,12 @@ ris::RateDrop::RateDrop(bool period, double value) : ris::Master(), ris::Slave() if ((!period) || value == 0) { periodFlag_ = false; - dropCount_ = (uint32_t)value; - dropTarget_ = (uint32_t)value; + dropCount_ = static_cast(value); + dropTarget_ = static_cast(value); } else { periodFlag_ = true; - per = (uint32_t)(value * 1e6); + per = static_cast(value * 1e6); div_t divResult = div(per, 1000000); timePeriod_.tv_sec = divResult.quot; diff --git a/src/rogue/interfaces/stream/Slave.cpp b/src/rogue/interfaces/stream/Slave.cpp index ccbba1fe6..d7504bdb6 100644 --- a/src/rogue/interfaces/stream/Slave.cpp +++ b/src/rogue/interfaces/stream/Slave.cpp @@ -21,9 +21,10 @@ #include "rogue/interfaces/stream/Slave.h" #include -#include #include +#include +#include #include #include diff --git a/src/rogue/interfaces/stream/TcpClient.cpp b/src/rogue/interfaces/stream/TcpClient.cpp index 0de7abde3..30f1388a9 100644 --- a/src/rogue/interfaces/stream/TcpClient.cpp +++ b/src/rogue/interfaces/stream/TcpClient.cpp @@ -21,6 +21,7 @@ #include #include +#include #include "rogue/GeneralError.h" #include "rogue/GilRelease.h" diff --git a/src/rogue/interfaces/stream/TcpCore.cpp b/src/rogue/interfaces/stream/TcpCore.cpp index 9e15ef204..514ab3311 100644 --- a/src/rogue/interfaces/stream/TcpCore.cpp +++ b/src/rogue/interfaces/stream/TcpCore.cpp @@ -19,10 +19,11 @@ #include "rogue/interfaces/stream/TcpCore.h" #include -#include #include +#include #include +#include #include "rogue/GeneralError.h" #include "rogue/GilRelease.h" diff --git a/src/rogue/interfaces/stream/TcpServer.cpp b/src/rogue/interfaces/stream/TcpServer.cpp index b680b4dd8..693dbae6e 100644 --- a/src/rogue/interfaces/stream/TcpServer.cpp +++ b/src/rogue/interfaces/stream/TcpServer.cpp @@ -21,6 +21,7 @@ #include #include +#include #include "rogue/GeneralError.h" #include "rogue/GilRelease.h" diff --git a/src/rogue/protocols/batcher/CoreV1.cpp b/src/rogue/protocols/batcher/CoreV1.cpp index fff5014f2..cfbedada8 100644 --- a/src/rogue/protocols/batcher/CoreV1.cpp +++ b/src/rogue/protocols/batcher/CoreV1.cpp @@ -41,9 +41,9 @@ #include "rogue/protocols/batcher/CoreV1.h" #include -#include #include +#include #include #include diff --git a/src/rogue/protocols/batcher/InverterV1.cpp b/src/rogue/protocols/batcher/InverterV1.cpp index 56aed6007..ad6ab7437 100644 --- a/src/rogue/protocols/batcher/InverterV1.cpp +++ b/src/rogue/protocols/batcher/InverterV1.cpp @@ -18,9 +18,9 @@ #include "rogue/protocols/batcher/InverterV1.h" -#include #include +#include #include #include diff --git a/src/rogue/protocols/batcher/SplitterV1.cpp b/src/rogue/protocols/batcher/SplitterV1.cpp index df8a82b07..1048bf349 100644 --- a/src/rogue/protocols/batcher/SplitterV1.cpp +++ b/src/rogue/protocols/batcher/SplitterV1.cpp @@ -18,9 +18,9 @@ #include "rogue/protocols/batcher/SplitterV1.h" -#include #include +#include #include #include diff --git a/src/rogue/protocols/packetizer/Controller.cpp b/src/rogue/protocols/packetizer/Controller.cpp index a70d0d99c..90146cc0b 100644 --- a/src/rogue/protocols/packetizer/Controller.cpp +++ b/src/rogue/protocols/packetizer/Controller.cpp @@ -17,8 +17,8 @@ #include "rogue/protocols/packetizer/Controller.h" #include -#include +#include #include #include "rogue/GeneralError.h" diff --git a/src/rogue/protocols/packetizer/ControllerV1.cpp b/src/rogue/protocols/packetizer/ControllerV1.cpp index 880b29e4e..659f0a6b7 100644 --- a/src/rogue/protocols/packetizer/ControllerV1.cpp +++ b/src/rogue/protocols/packetizer/ControllerV1.cpp @@ -17,11 +17,11 @@ #include "rogue/protocols/packetizer/ControllerV1.h" #include -#include -#include #include #include +#include +#include #include #include "rogue/GeneralError.h" @@ -87,12 +87,12 @@ void rpp::ControllerV1::transportRx(ris::FramePtr frame) { return; } - tmpIdx = uint32_t(data[0]) >> 4; - tmpIdx |= uint32_t(data[1]) << 4; + tmpIdx = static_cast(data[0]) >> 4; + tmpIdx |= static_cast(data[1]) << 4; - tmpCount = uint32_t(data[2]); - tmpCount |= uint32_t(data[3]) << 8; - tmpCount |= uint32_t(data[4]) << 16; + tmpCount = static_cast(data[2]); + tmpCount |= static_cast(data[3]) << 8; + tmpCount |= static_cast(data[4]) << 16; tmpDest = data[5]; tmpId = data[6]; diff --git a/src/rogue/protocols/packetizer/ControllerV2.cpp b/src/rogue/protocols/packetizer/ControllerV2.cpp index 87fd38462..b9ccffd58 100644 --- a/src/rogue/protocols/packetizer/ControllerV2.cpp +++ b/src/rogue/protocols/packetizer/ControllerV2.cpp @@ -17,11 +17,11 @@ #include "rogue/protocols/packetizer/ControllerV2.h" #include -#include -#include #include #include +#include +#include #include #include "rogue/GeneralError.h" @@ -118,21 +118,21 @@ void rpp::ControllerV2::transportRx(ris::FramePtr frame) { tmpId = data[3]; // Header word 1 - tmpCount = uint32_t(data[4]) << 0; - tmpCount |= uint32_t(data[5]) << 8; + tmpCount = static_cast(data[4]) << 0; + tmpCount |= static_cast(data[5]) << 8; tmpSof = ((data[7] & 0x80) ? true : false); // SOF (PACKETIZER2_HDR_SOF_BIT_C = 63) // Tail word 0 tmpLuser = data[size - 8]; tmpEof = ((data[size - 7] & 0x1) ? true : false); - last = uint32_t(data[size - 6]); + last = static_cast(data[size - 6]); if (enIbCrc_) { // Tail word 1 - tmpCrc = uint32_t(data[size - 1]) << 0; - tmpCrc |= uint32_t(data[size - 2]) << 8; - tmpCrc |= uint32_t(data[size - 3]) << 16; - tmpCrc |= uint32_t(data[size - 4]) << 24; + tmpCrc = static_cast(data[size - 1]) << 0; + tmpCrc |= static_cast(data[size - 2]) << 8; + tmpCrc |= static_cast(data[size - 3]) << 16; + tmpCrc |= static_cast(data[size - 4]) << 24; // Compute CRC if (tmpSof) @@ -179,7 +179,7 @@ void rpp::ControllerV2::transportRx(ris::FramePtr frame) { // Shorten message by removing tail and adjusting for last value // Do this before adjusting tail reservation - buff->adjustPayload(-8 + ((int32_t)last - 8)); + buff->adjustPayload(-8 + (static_cast(last) - 8)); // Add 8 bytes to headroom and tail reservation buff->adjustHeader(8); diff --git a/src/rogue/protocols/rssi/Controller.cpp b/src/rogue/protocols/rssi/Controller.cpp index 7a8e73a1d..0da04ad32 100644 --- a/src/rogue/protocols/rssi/Controller.cpp +++ b/src/rogue/protocols/rssi/Controller.cpp @@ -17,14 +17,15 @@ #include "rogue/protocols/rssi/Controller.h" #include -#include -#include -#include #include #include #include +#include +#include +#include #include +#include #include "rogue/GeneralError.h" #include "rogue/GilRelease.h" @@ -700,7 +701,7 @@ void rpr::Controller::convTime(struct timeval& tme, uint32_t rssiTime) { float units = std::pow(10, -TimeoutUnit); float value = units * static_cast(rssiTime); - uint32_t usec = (uint32_t)(value / 1e-6); + uint32_t usec = static_cast(value / 1e-6); div_t divResult = div(usec, 1000000); tme.tv_sec = divResult.quot; diff --git a/src/rogue/protocols/rssi/Header.cpp b/src/rogue/protocols/rssi/Header.cpp index 1958412b9..93cf22910 100644 --- a/src/rogue/protocols/rssi/Header.cpp +++ b/src/rogue/protocols/rssi/Header.cpp @@ -19,13 +19,14 @@ #include #include #include -#include #include +#include #include #include #include #include +#include #include "rogue/GeneralError.h" #include "rogue/GilRelease.h" @@ -232,7 +233,7 @@ std::string rpr::Header::dump() { ret << " Raw Header : "; for (x = 0; x < data[1]; x++) { - ret << "0x" << std::hex << std::setw(2) << std::setfill('0') << (uint32_t)data[x] << " "; + ret << "0x" << std::hex << std::setw(2) << std::setfill('0') << static_cast(data[x]) << " "; if ((x % 8) == 7 && (x + 1) != data[1]) ret << std::endl << " "; } ret << std::endl; @@ -242,22 +243,22 @@ std::string rpr::Header::dump() { ret << " Rst : " << std::dec << rst << std::endl; ret << " Nul : " << std::dec << nul << std::endl; ret << " Busy : " << std::dec << busy << std::endl; - ret << " Sequence : " << std::dec << (uint32_t)sequence << std::endl; - ret << " Acknowledge : " << std::dec << (uint32_t)acknowledge << std::endl; + ret << " Sequence : " << std::dec << static_cast(sequence) << std::endl; + ret << " Acknowledge : " << std::dec << static_cast(acknowledge) << std::endl; if (!syn) return (ret.str()); - ret << " Version : " << std::dec << (uint32_t)version << std::endl; + ret << " Version : " << std::dec << static_cast(version) << std::endl; ret << " Chk : " << std::dec << chk << std::endl; - ret << " Max Out Seg : " << std::dec << (uint32_t)maxOutstandingSegments << std::endl; - ret << " Max Seg Size : " << std::dec << (uint32_t)maxSegmentSize << std::endl; - ret << " Retran Tout : " << std::dec << (uint32_t)retransmissionTimeout << std::endl; - ret << " Cum Ack Tout : " << std::dec << (uint32_t)cumulativeAckTimeout << std::endl; - ret << " Null Tout : " << std::dec << (uint32_t)nullTimeout << std::endl; - ret << " Max Retrans : " << std::dec << (uint32_t)maxRetransmissions << std::endl; - ret << " Max Cum Ack : " << std::dec << (uint32_t)maxCumulativeAck << std::endl; - ret << " Timeout Unit : " << std::dec << (uint32_t)timeoutUnit << std::endl; - ret << " Conn Id : " << std::dec << (uint32_t)connectionId << std::endl; + ret << " Max Out Seg : " << std::dec << static_cast(maxOutstandingSegments) << std::endl; + ret << " Max Seg Size : " << std::dec << static_cast(maxSegmentSize) << std::endl; + ret << " Retran Tout : " << std::dec << static_cast(retransmissionTimeout) << std::endl; + ret << " Cum Ack Tout : " << std::dec << static_cast(cumulativeAckTimeout) << std::endl; + ret << " Null Tout : " << std::dec << static_cast(nullTimeout) << std::endl; + ret << " Max Retrans : " << std::dec << static_cast(maxRetransmissions) << std::endl; + ret << " Max Cum Ack : " << std::dec << static_cast(maxCumulativeAck) << std::endl; + ret << " Timeout Unit : " << std::dec << static_cast(timeoutUnit) << std::endl; + ret << " Conn Id : " << std::dec << static_cast(connectionId) << std::endl; return (ret.str()); } diff --git a/src/rogue/protocols/srp/SrpV0.cpp b/src/rogue/protocols/srp/SrpV0.cpp index ff9a71742..cd66d4d65 100644 --- a/src/rogue/protocols/srp/SrpV0.cpp +++ b/src/rogue/protocols/srp/SrpV0.cpp @@ -20,8 +20,8 @@ #include #include -#include +#include #include #include diff --git a/src/rogue/protocols/srp/SrpV3.cpp b/src/rogue/protocols/srp/SrpV3.cpp index 754e56902..73a4fdb01 100644 --- a/src/rogue/protocols/srp/SrpV3.cpp +++ b/src/rogue/protocols/srp/SrpV3.cpp @@ -20,8 +20,8 @@ #include #include -#include +#include #include #include diff --git a/src/rogue/protocols/udp/Client.cpp b/src/rogue/protocols/udp/Client.cpp index f5a88c2a4..e64120b7c 100644 --- a/src/rogue/protocols/udp/Client.cpp +++ b/src/rogue/protocols/udp/Client.cpp @@ -19,11 +19,12 @@ #include "rogue/protocols/udp/Client.h" #include -#include -#include #include +#include +#include #include +#include #include "rogue/GeneralError.h" #include "rogue/GilRelease.h" diff --git a/src/rogue/protocols/udp/Server.cpp b/src/rogue/protocols/udp/Server.cpp index 5b201ce5d..a24a4f63b 100644 --- a/src/rogue/protocols/udp/Server.cpp +++ b/src/rogue/protocols/udp/Server.cpp @@ -19,10 +19,10 @@ #include "rogue/protocols/udp/Server.h" #include -#include -#include #include +#include +#include #include #include diff --git a/src/rogue/protocols/xilinx/JtagDriver.cpp b/src/rogue/protocols/xilinx/JtagDriver.cpp index 28232cca3..6103b7ed4 100644 --- a/src/rogue/protocols/xilinx/JtagDriver.cpp +++ b/src/rogue/protocols/xilinx/JtagDriver.cpp @@ -21,11 +21,13 @@ #include #include -#include #include #include #include +#include +#include +#include #include namespace rpx = rogue::protocols::xilinx; @@ -136,7 +138,7 @@ uint32_t rpx::JtagDriver::cvtPerNs(Header reply) { tmp = static_cast(rawVal) * 4.0 / 256.0; - return (uint32_t)round(pow(10.0, tmp) * 1.0E9 / REF_FREQ_HZ()); + return static_cast(round(pow(10.0, tmp) * 1.0E9 / REF_FREQ_HZ())); } unsigned rpx::JtagDriver::getWordSize() { @@ -235,7 +237,7 @@ uint64_t rpx::JtagDriver::query() { log_->debug("Query result: wordSize %" PRId32 ", memDepth %" PRId32 ", period %l" PRId32 "ns\n", wordSize_, memDepth_, - (uint64_t)periodNs_); + static_cast(periodNs_)); if (0 == memDepth_) retry_ = 0; @@ -299,7 +301,7 @@ void rpx::JtagDriver::dumpInfo(FILE* f) { fprintf(f, "Word size: %d\n", getWordSize()); fprintf(f, "Target Memory Depth (bytes) %d\n", getWordSize() * getMemDepth()); fprintf(f, "Max. Vector Length (bytes) %ld\n", getMaxVectorSize()); - fprintf(f, "TCK Period (ns) %ld\n", (uint64_t)getPeriodNs()); + fprintf(f, "TCK Period (ns) %ld\n", static_cast(getPeriodNs())); } void rpx::JtagDriver::setup_python() { diff --git a/src/rogue/protocols/xilinx/Xvc.cpp b/src/rogue/protocols/xilinx/Xvc.cpp index b56545f59..23e990774 100644 --- a/src/rogue/protocols/xilinx/Xvc.cpp +++ b/src/rogue/protocols/xilinx/Xvc.cpp @@ -19,11 +19,12 @@ #include "rogue/protocols/xilinx/Xvc.h" #include -#include -#include #include +#include +#include #include +#include #include "rogue/GeneralError.h" #include "rogue/GilRelease.h" diff --git a/src/rogue/protocols/xilinx/XvcConnection.cpp b/src/rogue/protocols/xilinx/XvcConnection.cpp index b69458794..b8735edcc 100644 --- a/src/rogue/protocols/xilinx/XvcConnection.cpp +++ b/src/rogue/protocols/xilinx/XvcConnection.cpp @@ -21,6 +21,8 @@ #include #include +#include + namespace rpx = rogue::protocols::xilinx; rpx::XvcConnection::XvcConnection(int sd, JtagDriver* drv, uint64_t maxVecLen) diff --git a/src/rogue/protocols/xilinx/XvcServer.cpp b/src/rogue/protocols/xilinx/XvcServer.cpp index b7c8bca86..60d6690b0 100644 --- a/src/rogue/protocols/xilinx/XvcServer.cpp +++ b/src/rogue/protocols/xilinx/XvcServer.cpp @@ -19,12 +19,12 @@ #include #include -#include #include #include #include #include +#include #include #include "rogue/protocols/xilinx/XvcConnection.h" diff --git a/src/rogue/utilities/Prbs.cpp b/src/rogue/utilities/Prbs.cpp index 45dceffdd..40852689d 100644 --- a/src/rogue/utilities/Prbs.cpp +++ b/src/rogue/utilities/Prbs.cpp @@ -20,10 +20,11 @@ #include #include -#include #include #include +#include +#include #include #include "rogue/GeneralError.h" diff --git a/src/rogue/utilities/fileio/LegacyStreamReader.cpp b/src/rogue/utilities/fileio/LegacyStreamReader.cpp index b2ed5ebff..d2911e187 100644 --- a/src/rogue/utilities/fileio/LegacyStreamReader.cpp +++ b/src/rogue/utilities/fileio/LegacyStreamReader.cpp @@ -21,11 +21,12 @@ #include #include #include -#include #include +#include #include #include +#include #include #include "rogue/GeneralError.h" diff --git a/src/rogue/utilities/fileio/StreamReader.cpp b/src/rogue/utilities/fileio/StreamReader.cpp index 40e15c1c5..849663d72 100644 --- a/src/rogue/utilities/fileio/StreamReader.cpp +++ b/src/rogue/utilities/fileio/StreamReader.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include "rogue/GeneralError.h" diff --git a/src/rogue/utilities/fileio/StreamWriter.cpp b/src/rogue/utilities/fileio/StreamWriter.cpp index 230c27570..6e614d285 100644 --- a/src/rogue/utilities/fileio/StreamWriter.cpp +++ b/src/rogue/utilities/fileio/StreamWriter.cpp @@ -35,12 +35,13 @@ #include #include #include -#include #include #include #include +#include #include +#include #include #include "rogue/GeneralError.h" @@ -298,7 +299,7 @@ void ruf::StreamWriter::intWrite(void* data, uint32_t size) { // Attempted write is larger than buffer, raw write // This is called if buffer is disabled if (size > buffSize_) { - if (write(fd_, data, size) != (int32_t)size) { + if (write(fd_, data, size) != static_cast(size)) { ::close(fd_); fd_ = -1; log_->error("Write failed, closing file!"); @@ -347,7 +348,7 @@ void ruf::StreamWriter::checkSize(uint32_t size) { //! Flush file void ruf::StreamWriter::flush() { if (currBuffer_ > 0) { - if (write(fd_, buffer_, currBuffer_) != (int32_t)currBuffer_) { + if (write(fd_, buffer_, currBuffer_) != static_cast(currBuffer_)) { ::close(fd_); fd_ = -1; log_->error("Write failed, closing file!"); diff --git a/tests/api_test/src/api_test.cpp b/tests/api_test/src/api_test.cpp index 2f1fb9f70..2be13af88 100644 --- a/tests/api_test/src/api_test.cpp +++ b/tests/api_test/src/api_test.cpp @@ -9,6 +9,9 @@ * ---------------------------------------------------------------------------- **/ +#include +#include + #include "rogue/interfaces/api/Bsp.h" void varListener(std::string path, std::string value) {