Merge pull request #28 from vigejolla/getattr-fix

IppMsg: Don't encode job attributes if there are none
This commit is contained in:
attah 2020-05-19 20:25:59 +02:00 committed by GitHub
commit fe4e24ab3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -199,12 +199,14 @@ QByteArray IppMsg::encode(Operation op)
}
for(QJsonArray::iterator ait = _jobAttrs.begin(); ait != _jobAttrs.end(); ait++)
{
ipp << quint8(2);
QJsonObject tmpObj = ait->toObject();
for(QJsonObject::iterator it = tmpObj.begin(); it != tmpObj.end(); it++)
{
QJsonObject val = it.value().toObject();
ipp << encode_attr(val["tag"].toInt(), it.key(), val["value"]);
if (!tmpObj.isEmpty()) {
ipp << quint8(2);
for(QJsonObject::iterator it = tmpObj.begin(); it != tmpObj.end(); it++)
{
QJsonObject val = it.value().toObject();
ipp << encode_attr(val["tag"].toInt(), it.key(), val["value"]);
}
}
}