Skip to content

Commit de66975

Browse files
committed
Address compile warnings
1 parent 6791461 commit de66975

File tree

4 files changed

+22
-20
lines changed

4 files changed

+22
-20
lines changed

libsrc/api/JsonAPI.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -922,13 +922,17 @@ void JsonAPI::handleSchemaGetCommand(const QJsonObject& /*message*/, const JsonA
922922
// Add infor about the type of setting elements
923923
QJsonObject settingTypes;
924924
QJsonArray globalSettingTypes;
925-
for (const QString &type : SettingsTable().getGlobalSettingTypes()) {
925+
926+
SettingsTable settingsTable;
927+
for (const QString &type : settingsTable.getGlobalSettingTypes())
928+
{
926929
globalSettingTypes.append(type);
927930
}
928931
settingTypes.insert("globalProperties", globalSettingTypes);
929932

930933
QJsonArray instanceSettingTypes;
931-
for (const QString &type : SettingsTable().getInstanceSettingTypes()) {
934+
for (const QString &type : settingsTable.getInstanceSettingTypes())
935+
{
932936
instanceSettingTypes.append(type);
933937
}
934938
settingTypes.insert("instanceProperties", instanceSettingTypes);

libsrc/leddevice/dev_ftdi/ProviderFtdi.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ int ProviderFtdi::open()
6767

6868
Debug(_log, "Opening FTDI device=%s", QSTRING_CSTR(_deviceName));
6969

70-
FTDI_CHECK_RESULT((rc = ftdi_usb_open_string(_ftdic, QSTRING_CSTR(_deviceName))) < 0);
70+
FTDI_CHECK_RESULT((rc = ftdi_usb_open_string(_ftdic, QSTRING_CSTR(_deviceName))) < 0)
7171
/* doing this disable resets things if they were in a bad state */
72-
FTDI_CHECK_RESULT((rc = ftdi_disable_bitbang(_ftdic)) < 0);
73-
FTDI_CHECK_RESULT((rc = ftdi_setflowctrl(_ftdic, SIO_DISABLE_FLOW_CTRL)) < 0);
74-
FTDI_CHECK_RESULT((rc = ftdi_set_bitmode(_ftdic, 0x00, BITMODE_RESET)) < 0);
75-
FTDI_CHECK_RESULT((rc = ftdi_set_bitmode(_ftdic, 0xff, BITMODE_MPSSE)) < 0);
72+
FTDI_CHECK_RESULT((rc = ftdi_disable_bitbang(_ftdic)) < 0)
73+
FTDI_CHECK_RESULT((rc = ftdi_setflowctrl(_ftdic, SIO_DISABLE_FLOW_CTRL)) < 0)
74+
FTDI_CHECK_RESULT((rc = ftdi_set_bitmode(_ftdic, 0x00, BITMODE_RESET)) < 0)
75+
FTDI_CHECK_RESULT((rc = ftdi_set_bitmode(_ftdic, 0xff, BITMODE_MPSSE)) < 0)
7676

7777
double reference_clock = 60e6;
7878
int divisor = (reference_clock / 2 / _baudRate_Hz) - 1;
@@ -86,7 +86,7 @@ int ProviderFtdi::open()
8686
pinDirection
8787
};
8888

89-
FTDI_CHECK_RESULT((rc = ftdi_write_data(_ftdic, buf.data(), buf.size())) != buf.size());
89+
FTDI_CHECK_RESULT(static_cast<size_t>(rc = ftdi_write_data(_ftdic, buf.data(), static_cast<int>(buf.size()))) != buf.size())
9090

9191
_isDeviceReady = true;
9292
return rc;
@@ -134,7 +134,7 @@ int ProviderFtdi::writeBytes(const qint64 size, const uint8_t *data)
134134
// SET_BITS_LOW takes 2 arguments, so we're inserting data in -3 position from the end
135135
buf.insert(buf.end() - 3, &data[0], &data[size]);
136136

137-
FTDI_CHECK_RESULT((rc = ftdi_write_data(_ftdic, buf.data(), buf.size())) != buf.size());
137+
FTDI_CHECK_RESULT(static_cast<size_t>(rc = ftdi_write_data(_ftdic, buf.data(), static_cast<int>(buf.size()))) != buf.size())
138138
return rc;
139139
}
140140

@@ -152,7 +152,7 @@ QJsonObject ProviderFtdi::discover(const QJsonObject & /*params*/)
152152
struct ftdi_device_list *curdev = devlist;
153153
QMap<QString, uint8_t> deviceIndexes;
154154

155-
while (curdev)
155+
while (curdev != nullptr)
156156
{
157157
libusb_device_descriptor desc;
158158
int rc = libusb_get_device_descriptor(curdev->dev, &desc);
@@ -161,8 +161,7 @@ QJsonObject ProviderFtdi::discover(const QJsonObject & /*params*/)
161161
QString vendorIdentifier = QString("0x%1").arg(desc.idVendor, 4, 16, QChar{'0'});
162162
QString productIdentifier = QString("0x%1").arg(desc.idProduct, 4, 16, QChar{'0'});
163163
QString vendorAndProduct = QString("%1:%2")
164-
.arg(vendorIdentifier)
165-
.arg(productIdentifier);
164+
.arg(vendorIdentifier,productIdentifier);
166165
uint8_t deviceIndex = deviceIndexes.value(vendorAndProduct, 0);
167166

168167
char serial_string[128] = {0};
@@ -174,7 +173,7 @@ QJsonObject ProviderFtdi::discover(const QJsonObject & /*params*/)
174173
QString ftdiOpenString;
175174
if(!serialNumber.isEmpty())
176175
{
177-
ftdiOpenString = QString("s:%1:%2").arg(vendorAndProduct).arg(serialNumber);
176+
ftdiOpenString = QString("s:%1:%2").arg(vendorAndProduct, serialNumber);
178177
}
179178
else
180179
{

libsrc/python/PythonProgram.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ PythonProgram::PythonProgram(const QString& name, Logger* log) :
2525
PyEval_RestoreThread(mainThreadState);
2626
_tstate = Py_NewInterpreter();
2727
#else
28-
PyThreadState* prev = PyThreadState_Swap(NULL);
28+
PyThreadState_Swap(NULL);
2929

3030
// Create a new interpreter configuration object
3131
PyInterpreterConfig config{};

libsrc/utils/ImageResampler.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,15 @@ void ImageResampler::processImage(const uint8_t * data, int width, int height, i
5050

5151
outputImage.resize(outputWidth, outputHeight);
5252

53-
int xDestStart, xDestEnd;
54-
int yDestStart, yDestEnd;
53+
int xDestStart {0};
54+
int xDestEnd = {outputWidth-1};
55+
int yDestStart = {0};
56+
int yDestEnd = {outputWidth-1};
5557

5658
switch (_flipMode)
5759
{
5860
case FlipMode::NO_CHANGE:
59-
xDestStart = 0;
60-
xDestEnd = outputWidth-1;
61-
yDestStart = 0;
62-
yDestEnd = outputHeight-1;
61+
//use the initalized values
6362
break;
6463
case FlipMode::HORIZONTAL:
6564
xDestStart = 0;

0 commit comments

Comments
 (0)