Various Fixes/Updates (#1549)

* Update FindWindowsSDK.cmake

* cmake support libcec without version

* Ensure Light-Ids are strings

* Fix type - do not have dbus as requried

* Fixing #1544

* Cleanup

* CleanupFix #1551

* Consistently return instance number with JSON replies (#1504)

* hyperion-remote- Fix extracting reply for configGet request

* Qt 6.6 - Fix iterator finds

* Fix test_image2ledsmap

* Ensure window.currentHyperionInstanceName is set, cleanup system/log clipboard report

* Address protobuf cmake warning

* Update License

* Update ChangeLog

* Address CodeQL and clang findings
This commit is contained in:
LordGrey
2023-01-16 11:01:28 +00:00
committed by GitHub
parent f665f1e1b6
commit fa7a5b6b56
23 changed files with 187 additions and 102 deletions

View File

@@ -21,6 +21,8 @@
#include <hyperion/GrabberWrapper.h>
#include <grabber/QtGrabber.h>
#include <utils/WeakConnect.h>
#if defined(ENABLE_MF)
#include <grabber/MFGrabber.h>
#elif defined(ENABLE_V4L2)
@@ -1453,7 +1455,7 @@ void JsonAPI::handleAuthorizeCommand(const QJsonObject &message, const QString &
void JsonAPI::handleInstanceCommand(const QJsonObject &message, const QString &command, int tan)
{
const QString &subc = message["subcommand"].toString();
const quint8 &inst = message["instance"].toInt();
const quint8 &inst = static_cast<quint8>(message["instance"].toInt());
const QString &name = message["name"].toString();
if (subc == "switchTo")
@@ -1471,7 +1473,12 @@ void JsonAPI::handleInstanceCommand(const QJsonObject &message, const QString &c
if (subc == "startInstance")
{
connect(this, &API::onStartInstanceResponse, [=] (const int &tan) { sendSuccessReply(command + "-" + subc, tan); });
//Only send update once
weakConnect(this, &API::onStartInstanceResponse, [this, command, subc] (int tan)
{
sendSuccessReply(command + "-" + subc, tan);
});
if (!API::startInstance(inst, tan))
sendErrorReply("Can't start Hyperion instance index " + QString::number(inst), command + "-" + subc, tan);
@@ -1825,6 +1832,7 @@ void JsonAPI::sendSuccessReply(const QString &command, int tan)
{
// create reply
QJsonObject reply;
reply["instance"] = _hyperion->getInstanceIndex();
reply["success"] = true;
reply["command"] = command;
reply["tan"] = tan;
@@ -1836,6 +1844,7 @@ void JsonAPI::sendSuccessReply(const QString &command, int tan)
void JsonAPI::sendSuccessDataReply(const QJsonDocument &doc, const QString &command, int tan)
{
QJsonObject reply;
reply["instance"] = _hyperion->getInstanceIndex();
reply["success"] = true;
reply["command"] = command;
reply["tan"] = tan;
@@ -1851,6 +1860,7 @@ void JsonAPI::sendErrorReply(const QString &error, const QString &command, int t
{
// create reply
QJsonObject reply;
reply["instance"] = _hyperion->getInstanceIndex();
reply["success"] = false;
reply["error"] = error;
reply["command"] = command;

View File

@@ -64,7 +64,7 @@ QJsonObject QJsonSchemaChecker::getAutoCorrectedConfig(const QJsonObject& value,
_messages.clear();
_autoCorrected = value;
for (const QString& correct : sequence)
for (const QString& correct : qAsConst(sequence))
{
_correct = correct;
_currentPath.clear();
@@ -234,7 +234,6 @@ void QJsonSchemaChecker::checkProperties(const QJsonObject& value, const QJsonOb
const QJsonValue& propertyValue = *i;
_currentPath.append("." + property);
QJsonObject::const_iterator required = propertyValue.toObject().find("required");
if (value.contains(property))
{
@@ -242,7 +241,8 @@ void QJsonSchemaChecker::checkProperties(const QJsonObject& value, const QJsonOb
}
else if (!verifyDeps(property, value, schema))
{
if (required != propertyValue.toObject().end() && propertyValue.toObject().find("required").value().toBool() && !_ignoreRequired)
bool isRequired = propertyValue.toObject().value("required").toBool(false);
if (isRequired && !_ignoreRequired)
{
_error = true;
@@ -273,9 +273,10 @@ bool QJsonSchemaChecker::verifyDeps(const QString& property, const QJsonObject&
{
const QJsonObject& depends = ((schema[property].toObject())["options"].toObject())["dependencies"].toObject();
if (depends.keys().size() > 0)
const QStringList dependsKeys = depends.keys();
if (!dependsKeys.isEmpty())
{
QString firstName = depends.keys().first();
const QString firstName = dependsKeys.constFirst();
if (value.contains(firstName))
{
if (value[firstName] != depends[firstName])