C++: Remove compile warnings with Qt 5.15
authorjani <jani@asema.com>
Thu, 5 Nov 2020 14:00:03 +0000 (16:00 +0200)
committerjani <jani@asema.com>
Thu, 5 Nov 2020 14:00:03 +0000 (16:00 +0200)
Common/C++/SmartAPI/smartapi/common/HttpMessage.cpp
Common/C++/SmartAPI/smartapi/common/SmartAPICrypto.cpp
Common/C++/SmartAPI/smartapi/rdf/Variant.h

index 6d3cf56bc1ea4fb6004c5eac681098caa0c41544..13942d8d094e27fe3045325d05301368f9291af1 100644 (file)
@@ -72,8 +72,8 @@ void HttpMessage::add(QString partId, QByteArray body, QMap<QByteArray, QList<QB
 void HttpMessage::add(QString partId, QByteArray part, QString contentType)
 {
        mBodies.insert(partId, part);
-       addHeader(partId, "Content-ID", partId.toUtf8());
-       addHeader(partId, "Content-Type", contentType.toUtf8());
+       addHeader(partId, CONTENT_ID_HEADER, partId.toUtf8());
+       addHeader(partId, CONTENT_TYPE_HEADER, contentType.toUtf8());
 }
 
 void HttpMessage::addMainPart(QString part, QString contentType)
@@ -324,8 +324,6 @@ QByteArray HttpMessage::getMultiPartAsByteArray()
 
 QHttpMultiPart* HttpMessage::getMultiPart()
 {
-       // qDebug() << "%%% ENTER HttpMessage::getMultiPart()";
-       // qDebug() << "parts() =" << parts();
        QHttpMultiPart* multiPart = new QHttpMultiPart(QHttpMultiPart::MixedType);
        multiPart->setBoundary(getBoundary().toLocal8Bit());
 
@@ -336,8 +334,6 @@ QHttpMultiPart* HttpMessage::getMultiPart()
                QHttpPart nextPart;
 
                nextPart.setBody(bi.value());
-               // qDebug() << "body set";
-               // printf("%s\n", bi.value().constData());
 
                // collect headers
                QMap<QByteArray, QList<QByteArray> > headers = mHeaders.value(partId);
@@ -363,6 +359,5 @@ QHttpMultiPart* HttpMessage::getMultiPart()
                multiPart->append(nextPart);
        }
 
-       // qDebug() << "%%% EXIT HttpMessage::getMultiPart()";
        return multiPart;
 }
index 322ac7ff8835c314e3b559fdc6ad8c2e0bfdba33..7357be0d0e9e5186ce3e74f8fa0f1aa5d8c70d10 100644 (file)
@@ -229,7 +229,7 @@ QString SmartAPICrypto::asymmetricEncrypt(EVP_PKEY *pubKey, QString text, QByteA
 
 cleanup:
        RSA_free(rsa);
-       free(aesEncryptCtx);
+       EVP_CIPHER_CTX_free(aesEncryptCtx);
        free(encryptedMessage);
        free(encryptedKey);
        free(iv);
@@ -309,9 +309,8 @@ QString SmartAPICrypto::asymmetricDecrypt(EVP_PKEY *privKey, QString text, QByte
        }
 
 cleanup:
-       EVP_CIPHER_CTX_cleanup(aesDecryptCtx);
+       EVP_CIPHER_CTX_free(aesDecryptCtx);
        RSA_free(rsa);
-       free(aesDecryptCtx);
        free(decryptedMessage);
        free(decryptedKey);
 
index 75cdedbcd376e62c1d8e90825de5bf95700e5f1a..8ffd352210a4656f5f4c7dbc2a2e7373ef9215f1 100644 (file)
@@ -36,8 +36,8 @@ public:
        Variant(QTime time)         : GraphItem(), value(time), type(SMARTAPIVARIANT::TIME) {}
        Variant(Duration* duration) : GraphItem(), type(SMARTAPIVARIANT::DURATION) { value = duration->toString(); delete duration; }
        Variant(QVariantList l)     : GraphItem(), value(l), type(SMARTAPIVARIANT::LIST) {}
-       Variant(Map* obj)           : GraphItem(), value(qVariantFromValue((void *)obj)), type(SMARTAPIVARIANT::MAP) {}
-       Variant(Obj* obj)           : GraphItem(), value(qVariantFromValue((void *)obj)), type(SMARTAPIVARIANT::OBJ) {}
+       Variant(Map* obj)           : GraphItem(), value(QVariant::fromValue((void *)obj)), type(SMARTAPIVARIANT::MAP) {}
+       Variant(Obj* obj)           : GraphItem(), value(QVariant::fromValue((void *)obj)), type(SMARTAPIVARIANT::OBJ) {}
        Variant(QList<GraphItem*> l): GraphItem(), type(SMARTAPIVARIANT::LIST) { value = makeVariantList(l); }
        Variant(QList<Obj*> l)      : GraphItem(), type(SMARTAPIVARIANT::LIST) { value = makeVariantList(l); }
        Variant(QList<Map*> l)      : GraphItem(), type(SMARTAPIVARIANT::LIST) { value = makeVariantList(l); }