Skip to content

Commit

Permalink
Resolve a few more compiler warnings and Qt6 deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
ximion committed Jul 9, 2024
1 parent 5ad3132 commit 9bbad9c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 21 deletions.
7 changes: 3 additions & 4 deletions Engine/API/Abstract/abstractrhxcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,14 +665,13 @@ unsigned int AbstractRHXController::fifoCapacityInWords()
// Print a command list to the console in readable form.
void AbstractRHXController::printCommandList(const vector<unsigned int> &commandList) const
{
unsigned int i, cmd;
int channel, reg, data, uFlag, mFlag, dFlag, hFlag;

cout << '\n';
for (i = 0; i < commandList.size(); ++i) {
cmd = commandList[i];
for (uint i = 0; i < commandList.size(); ++i) {
auto cmd = commandList[i];
if (type != ControllerStimRecord) {
if (cmd < 0 || cmd > 0xffff) {
if ((int)cmd < 0 || cmd > 0xffff) {
cout << " command[" << i << "] = INVALID COMMAND: " << cmd << '\n';
} else if ((cmd & 0xc000) == 0x0000) {
channel = (cmd & 0x3f00) >> 8;
Expand Down
8 changes: 4 additions & 4 deletions Engine/API/Hardware/rhxregisters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1122,15 +1122,15 @@ unsigned int RHXRegisters::createRHXCommand(RHXCommandType commandType, unsigned
} else {
switch (commandType) {
case RHXCommandConvert:
if ((arg1 < 0) || (arg1 > 63)) {
if (((int)arg1 < 0) || (arg1 > 63)) {
cerr << "Error in RHXRegisters::createRHXCommand: " <<
"Channel number out of range.\n";
return -1;
}
return 0x0000 + (arg1 << 8); // 00cccccc0000000h; if the command is 'Convert',
// arg1 is the channel number.
case RHXCommandRegRead:
if ((arg1 < 0) || (arg1 > 63)) {
if (((int)arg1 < 0) || (arg1 > 63)) {
cerr << "Error in RHXRegisters::createRHXCommand: " <<
"Register address out of range.\n";
return -1;
Expand Down Expand Up @@ -1182,12 +1182,12 @@ unsigned int RHXRegisters::createRHXCommand(RHXCommandType commandType, unsigned
} else {
switch (commandType) {
case RHXCommandRegWrite:
if ((arg1 < 0) || (arg1 > 63)) {
if (((int)arg1 < 0) || (arg1 > 63)) {
cerr << "Error in RHXRegisters::createRHXCommand: " <<
"Register address out of range.\n";
return -1;
}
if ((arg2 < 0) || (arg2 > 255)) {
if (((int)arg2 < 0) || (arg2 > 255)) {
cerr << "Error in RHXRegisters::createRHXCommand: " <<
"Register data out of range.\n";
return -1;
Expand Down
6 changes: 3 additions & 3 deletions Engine/Processing/xmlinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ void XMLInterface::parseSignalGroupsAttributes(const QByteArray &byteArray, QStr
{
QXmlStreamReader stream(byteArray);
while (!stream.atEnd()) {
while (stream.name() != "SignalGroup") {
while (stream.name() != QStringLiteral("SignalGroup")) {
QXmlStreamReader::TokenType token = stream.readNext();
if (token == QXmlStreamReader::EndDocument) {
return;
Expand All @@ -894,7 +894,7 @@ void XMLInterface::parseSignalGroupsAttributes(const QByteArray &byteArray, QStr
QXmlStreamAttributes attributes = stream.attributes();
QString portName("");
for (auto attribute : attributes) {
if (attribute.name().toString().toLower() == "prefix") {
if (attribute.name().toString().toLower() == QStringLiteral("prefix")) {
portName = "Port " + attribute.value().toString();
break;
}
Expand All @@ -910,7 +910,7 @@ void XMLInterface::parseSignalGroupsAttributes(const QByteArray &byteArray, QStr
QString attributeName = attribute.name().toString();
QString attributeValue = attribute.value().toString();

if (attributeValue != "N/A") {
if (attributeValue != QStringLiteral("N/A")) {
StateSingleItem *singleItem = state->locateStateSingleItem(thisSignalGroup->portItems, attributeName);

// If the attribute is a StateSingleItem, set it according to XMLIncludeParameters.
Expand Down
4 changes: 2 additions & 2 deletions GUI/Widgets/pageview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1266,8 +1266,8 @@ QString PageView::getSiteShape(int port, int site)

void PageView::overwriteColor(QColor &color, const QString& colorName)
{
if (color.isValidColor(colorName))
color.setNamedColor(colorName);
if (color.isValidColorName(colorName))
color = QColor::fromString(colorName);
}

void PageView::overwriteFloat(float &original, float newValue) {
Expand Down
12 changes: 4 additions & 8 deletions GUI/Widgets/testcontrolpanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ TestControlPanel::TestControlPanel(ControllerInterface *controllerInterface_, Ab
helpDialogCheckInputWave(nullptr),
helpDialogTestChip(nullptr),
helpDialogUploadTestStimParameters(nullptr),
previousDelay(-1),
portComboBox(nullptr),
previousDelay(-1),
auxIn1Min(3.3),
auxIn1Max(0),
auxIn1Median(0),
Expand Down Expand Up @@ -830,13 +830,11 @@ void TestControlPanel::recordDummySegment(double duration, int portIndex)
void TestControlPanel::allocateDoubleArray3D(QVector<QVector<QVector<double> > > &array3D,
int xSize, int ySize, int zSize)
{
int i, j;

if (xSize == 0) return;
array3D.resize(xSize);
for (i = 0; i < xSize; ++i) {
for (int i = 0; i < xSize; ++i) {
array3D[i].resize(ySize);
for (j = 0; j < ySize; ++j) {
for (int j = 0; j < ySize; ++j) {
array3D[i][j].resize(zSize);
}
}
Expand All @@ -846,11 +844,9 @@ void TestControlPanel::allocateDoubleArray3D(QVector<QVector<QVector<double> > >
void TestControlPanel::allocateDoubleArray2D(QVector<QVector<double> > &array2D,
int xSize, int ySize)
{
int i, j;

if (xSize == 0) return;
array2D.resize(xSize);
for (i = 0; i < xSize; ++i) {
for (int i = 0; i < xSize; ++i) {
array2D[i].resize(ySize);
}
}
Expand Down

0 comments on commit 9bbad9c

Please sign in to comment.