Add CodeQL for GitHub code scanning (#1548)

* Create codeql.yml

* Addressing codeql findings
This commit is contained in:
LordGrey
2022-12-27 08:36:10 +01:00
committed by GitHub
parent 1189f86c1a
commit 6fa7bab6f7
83 changed files with 1984 additions and 2094 deletions

View File

@@ -223,13 +223,11 @@ void EncoderThread::processImageMjpeg()
{
_xform->options = TJXOPT_CROP;
_xform->r = tjregion {_cropLeft,_cropTop,transformedWidth,transformedHeight};
//qDebug() << "processImageMjpeg() | _doTransform - Image cropped: transformedWidth: " << transformedWidth << " transformedHeight: " << transformedHeight;
}
else
{
_xform->options = 0;
_xform->r = tjregion {0,0,_width,_height};
//qDebug() << "processImageMjpeg() | _doTransform - Image not cropped: _width: " << _width << " _height: " << _height;
}
_xform->options |= TJXOPT_TRIM;
@@ -344,11 +342,9 @@ bool EncoderThread::onError(const QString context) const
#if LIBJPEG_TURBO_VERSION_NUMBER > 2000000
if (tjGetErrorCode(_tjInstance) == TJERR_FATAL)
{
//qDebug() << context << "Error: " << QString(tjGetErrorStr2(_tjInstance));
treatAsError = true;
}
#else
//qDebug() << context << "Error: " << QString(tjGetErrorStr());
treatAsError = true;
#endif

View File

@@ -1209,7 +1209,7 @@ void V4L2Grabber::setCecDetectionEnable(bool enable)
{
_cecDetectionEnabled = enable;
if(_initialized)
Info(_log, QString("CEC detection is now %1").arg(enable ? "enabled" : "disabled").toLocal8Bit());
Info(_log, "%s", QSTRING_CSTR(QString("CEC detection is now %1").arg(enable ? "enabled" : "disabled")));
}
}
@@ -1501,19 +1501,19 @@ void V4L2Grabber::enumVideoCaptureDevices()
// Enumerate video control IDs
QList<DeviceControls> deviceControlList;
for (auto it = _controlIDPropertyMap->constBegin(); it != _controlIDPropertyMap->constEnd(); it++)
for (auto itDeviceControls = _controlIDPropertyMap->constBegin(); itDeviceControls != _controlIDPropertyMap->constEnd(); itDeviceControls++)
{
struct v4l2_queryctrl queryctrl;
CLEAR(queryctrl);
queryctrl.id = it.key();
queryctrl.id = itDeviceControls.key();
if (xioctl(fd, VIDIOC_QUERYCTRL, &queryctrl) < 0)
break;
if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED)
break;
DeviceControls control;
control.property = it.value();
control.property = itDeviceControls.value();
control.minValue = queryctrl.minimum;
control.maxValue = queryctrl.maximum;
control.step = queryctrl.step;
@@ -1524,13 +1524,13 @@ void V4L2Grabber::enumVideoCaptureDevices()
CLEAR(ctrl);
CLEAR(ctrls);
ctrl.id = it.key();
ctrl.id = itDeviceControls.key();
ctrls.count = 1;
ctrls.controls = &ctrl;
if (xioctl(fd, VIDIOC_G_EXT_CTRLS, &ctrls) == 0)
{
control.currentValue = ctrl.value;
DebugIf(verbose, _log, "%s: min=%i, max=%i, step=%i, default=%i, current=%i", QSTRING_CSTR(it.value()), control.minValue, control.maxValue, control.step, control.defaultValue, control.currentValue);
DebugIf(verbose, _log, "%s: min=%i, max=%i, step=%i, default=%i, current=%i", QSTRING_CSTR(itDeviceControls.value()), control.minValue, control.maxValue, control.step, control.defaultValue, control.currentValue);
}
else
break;