mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-04-05 20:36:28 +02:00
Create warning whitelist system
This commit is contained in:
parent
539899e799
commit
3347cc563b
16 changed files with 193 additions and 30 deletions
|
@ -133,6 +133,40 @@ if( NOT WIN32 )
|
|||
message($ENV{CXXFLAGS})
|
||||
endif()
|
||||
|
||||
# OVERTE_WARNINGS
|
||||
#
|
||||
# Here we add the ability to whitelist warnings we've determined we can't fix, or are safe to
|
||||
# ignore for one reason or another. The way of doing so is compiler-specific, so we deal with
|
||||
# the detection of that in cmake, and just pass it down to the code from here.
|
||||
#
|
||||
# We can also treat warnings as errors. Without the whitelist this will almost certainly lead
|
||||
# to a build failure.
|
||||
|
||||
if(NOT DEFINED OVERTE_WARNINGS_WHITELIST)
|
||||
set(OVERTE_WARNINGS_WHITELIST true CACHE BOOL "Whitelist some warnings we can't currently fix")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED OVERTE_WARNINGS_AS_ERRORS)
|
||||
#message("Enabling warnings as errors")
|
||||
set(OVERTE_WARNINGS_AS_ERRORS false CACHE BOOL "Count warnings as errors")
|
||||
endif()
|
||||
|
||||
if(OVERTE_WARNINGS_WHITELIST)
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
message("GCC compiler detected, suppressing some unsolvable warnings.")
|
||||
add_compile_definitions(OVERTE_WARNINGS_WHITELIST_GCC)
|
||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
message("Clang compiler detected, suppressing some unsolvable warnings.")
|
||||
add_compile_definitions(OVERTE_WARNINGS_WHITELIST_GLANG)
|
||||
else()
|
||||
message("We don't know yet how to whitelist warnings for ${CMAKE_CXX_COMPILER_ID}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(OVERTE_WARNINGS_AS_ERRORS)
|
||||
set(ENV{CXXFLAGS "$ENV{CXXFLAGS} -Werror"})
|
||||
set(ENV{CFLAGS "$ENV{CXXFLAGS} -Werror"})
|
||||
endif()
|
||||
|
||||
|
||||
if (HIFI_ANDROID)
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
#include <QtQuick/QQuickWindow>
|
||||
#include <memory>
|
||||
#include "WarningsSuppression.h"
|
||||
|
||||
void addAvatarEntities(const QVariantList& avatarEntities) {
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
@ -167,7 +168,10 @@ void AvatarBookmarks::updateAvatarEntities(const QVariantList &avatarEntities) {
|
|||
if (propertiesItr != avatarEntityVariantMap.end()) {
|
||||
EntityItemID id = idItr.value().toUuid();
|
||||
newAvatarEntities.insert(id);
|
||||
OVERTE_IGNORE_DEPRECATED_BEGIN
|
||||
// We're not transitioning to CBOR yet, since it'd break the protocol.
|
||||
myAvatar->updateAvatarEntity(id, QJsonDocument::fromVariant(propertiesItr.value()).toBinaryData());
|
||||
OVERTE_IGNORE_DEPRECATED_END
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,12 +23,18 @@
|
|||
|
||||
#include <mutex>
|
||||
#include "ui/TabletScriptingInterface.h"
|
||||
#include "WarningsSuppression.h"
|
||||
|
||||
std::once_flag setupQMLTypesFlag;
|
||||
AvatarPackager::AvatarPackager() {
|
||||
std::call_once(setupQMLTypesFlag, []() {
|
||||
OVERTE_IGNORE_DEPRECATED_BEGIN
|
||||
|
||||
qmlRegisterType<FST>();
|
||||
qmlRegisterType<MarketplaceItemUploader>();
|
||||
|
||||
OVERTE_IGNORE_DEPRECATED_END
|
||||
|
||||
qRegisterMetaType<AvatarPackager*>();
|
||||
qRegisterMetaType<AvatarProject*>();
|
||||
qRegisterMetaType<AvatarDoctor*>();
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
#include "EntityEditPacketSender.h"
|
||||
#include "MovingEntitiesOperator.h"
|
||||
#include "SceneScriptingInterface.h"
|
||||
#include "WarningsSuppression.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -2017,7 +2018,10 @@ void MyAvatar::updateAvatarEntity(const QUuid& entityID, const QByteArray& entit
|
|||
|
||||
bool changed = false;
|
||||
_avatarEntitiesLock.withWriteLock([&] {
|
||||
OVERTE_IGNORE_DEPRECATED_BEGIN
|
||||
// We're not transitioning to CBOR yet, since it'd break the protocol.
|
||||
auto data = QJsonDocument::fromBinaryData(entityData);
|
||||
OVERTE_IGNORE_DEPRECATED_END
|
||||
if (data.isEmpty() || data.isNull() || !data.isObject() || data.object().isEmpty()) {
|
||||
qDebug() << "ERROR! Trying to update with invalid avatar entity data. Skipping." << data;
|
||||
} else {
|
||||
|
|
|
@ -40,7 +40,12 @@
|
|||
#include "Ledger.h"
|
||||
#include "ui/SecurityImageProvider.h"
|
||||
#include "scripting/HMDScriptingInterface.h"
|
||||
#include "WarningsSuppression.h"
|
||||
|
||||
OVERTE_IGNORE_DEPRECATED_BEGIN;
|
||||
// We're ignoring deprecated warnings in this entire file, since it's pretty much
|
||||
// entirely obsolete anyway, and probably safe to remove. But until that decision
|
||||
// is taken, we'll get the OpenSSL annoyances out of the way.
|
||||
namespace {
|
||||
const char* KEY_FILE = "hifikey";
|
||||
const char* INSTRUCTIONS_FILE = "backup_instructions.html";
|
||||
|
@ -950,3 +955,5 @@ void Wallet::getWalletStatus() {
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
OVERTE_IGNORE_DEPRECATED_END
|
|
@ -22,6 +22,7 @@
|
|||
#include <NodeList.h>
|
||||
#include <OffscreenUi.h>
|
||||
#include <UserActivityLogger.h>
|
||||
#include "WarningsSuppression.h"
|
||||
|
||||
static const int AUTO_REFRESH_INTERVAL = 1000;
|
||||
|
||||
|
@ -167,7 +168,11 @@ void AssetMappingsScriptingInterface::getAllMappings(QJSValue callback) {
|
|||
|
||||
connect(request, &GetAllMappingsRequest::finished, this, [callback](GetAllMappingsRequest* request) mutable {
|
||||
auto mappings = request->getMappings();
|
||||
|
||||
OVERTE_IGNORE_DEPRECATED_BEGIN
|
||||
// Still using QScriptEngine
|
||||
auto map = callback.engine()->newObject();
|
||||
OVERTE_IGNORE_DEPRECATED_END
|
||||
|
||||
for (auto& kv : mappings ) {
|
||||
map.setProperty(kv.first, kv.second.hash);
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "AvatarTraits.h"
|
||||
#include "ClientTraitsHandler.h"
|
||||
#include "ResourceRequestObserver.h"
|
||||
#include "WarningsSuppression.h"
|
||||
|
||||
//#define WANT_DEBUG
|
||||
|
||||
|
@ -2858,12 +2859,17 @@ QByteArray AvatarData::toFrame(const AvatarData& avatar) {
|
|||
qCDebug(avatars).noquote() << QJsonDocument(obj).toJson(QJsonDocument::JsonFormat::Indented);
|
||||
}
|
||||
#endif
|
||||
OVERTE_IGNORE_DEPRECATED_BEGIN
|
||||
// Can't use CBOR yet, would break the protocol
|
||||
return QJsonDocument(root).toBinaryData();
|
||||
OVERTE_IGNORE_DEPRECATED_END
|
||||
}
|
||||
|
||||
|
||||
void AvatarData::fromFrame(const QByteArray& frameData, AvatarData& result, bool useFrameSkeleton) {
|
||||
OVERTE_IGNORE_DEPRECATED_BEGIN
|
||||
QJsonDocument doc = QJsonDocument::fromBinaryData(frameData);
|
||||
OVERTE_IGNORE_DEPRECATED_END
|
||||
|
||||
#ifdef WANT_JSON_DEBUG
|
||||
{
|
||||
|
@ -3190,7 +3196,9 @@ QScriptValue AvatarEntityMapToScriptValue(QScriptEngine* engine, const AvatarEnt
|
|||
QScriptValue obj = engine->newObject();
|
||||
for (auto entityID : value.keys()) {
|
||||
QByteArray entityProperties = value.value(entityID);
|
||||
OVERTE_IGNORE_DEPRECATED_BEGIN
|
||||
QJsonDocument jsonEntityProperties = QJsonDocument::fromBinaryData(entityProperties);
|
||||
OVERTE_IGNORE_DEPRECATED_END
|
||||
if (!jsonEntityProperties.isObject()) {
|
||||
qCDebug(avatars) << "bad AvatarEntityData in AvatarEntityMap" << QString(entityProperties.toHex());
|
||||
}
|
||||
|
@ -3214,8 +3222,9 @@ void AvatarEntityMapFromScriptValue(const QScriptValue& object, AvatarEntityMap&
|
|||
QScriptValue scriptEntityProperties = itr.value();
|
||||
QVariant variantEntityProperties = scriptEntityProperties.toVariant();
|
||||
QJsonDocument jsonEntityProperties = QJsonDocument::fromVariant(variantEntityProperties);
|
||||
OVERTE_IGNORE_DEPRECATED_BEGIN
|
||||
QByteArray binaryEntityProperties = jsonEntityProperties.toBinaryData();
|
||||
|
||||
OVERTE_IGNORE_DEPRECATED_END
|
||||
value[EntityID] = binaryEntityProperties;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "EntityItem.h"
|
||||
#include "ModelEntityItem.h"
|
||||
#include "PolyLineEntityItem.h"
|
||||
#include "WarningsSuppression.h"
|
||||
|
||||
AnimationPropertyGroup EntityItemProperties::_staticAnimation;
|
||||
SkyboxPropertyGroup EntityItemProperties::_staticSkybox;
|
||||
|
@ -5097,6 +5098,9 @@ QByteArray EntityItemProperties::getStaticCertificateHash() const {
|
|||
// I also don't like the nested-if style, but for this step I'm deliberately preserving the similarity.
|
||||
bool EntityItemProperties::verifySignature(const QString& publicKey, const QByteArray& digestByteArray, const QByteArray& signatureByteArray) {
|
||||
|
||||
OVERTE_IGNORE_DEPRECATED_BEGIN
|
||||
// We're not really verifying these anymore
|
||||
|
||||
if (digestByteArray.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -5167,6 +5171,8 @@ bool EntityItemProperties::verifySignature(const QString& publicKey, const QByte
|
|||
qCWarning(entities) << "Failed to verify signature! key" << publicKey << " EC PEM error:" << error_str;
|
||||
return false;
|
||||
}
|
||||
|
||||
OVERTE_IGNORE_DEPRECATED_END
|
||||
}
|
||||
|
||||
bool EntityItemProperties::verifyStaticCertificateProperties() {
|
||||
|
@ -5202,7 +5208,9 @@ void EntityItemProperties::convertToCloneProperties(const EntityItemID& entityID
|
|||
bool EntityItemProperties::blobToProperties(QScriptEngine& scriptEngine, const QByteArray& blob, EntityItemProperties& properties) {
|
||||
// DANGER: this method is NOT efficient.
|
||||
// begin recipe for converting unfortunately-formatted-binary-blob to EntityItemProperties
|
||||
OVERTE_IGNORE_DEPRECATED_BEGIN
|
||||
QJsonDocument jsonProperties = QJsonDocument::fromBinaryData(blob);
|
||||
OVERTE_IGNORE_DEPRECATED_END
|
||||
if (jsonProperties.isEmpty() || jsonProperties.isNull() || !jsonProperties.isObject() || jsonProperties.object().isEmpty()) {
|
||||
qCDebug(entities) << "bad avatarEntityData json" << QString(blob.toHex());
|
||||
return false;
|
||||
|
@ -5232,7 +5240,9 @@ void EntityItemProperties::propertiesToBlob(QScriptEngine& scriptEngine, const Q
|
|||
}
|
||||
}
|
||||
jsonProperties = QJsonDocument(jsonObject);
|
||||
OVERTE_IGNORE_DEPRECATED_BEGIN
|
||||
blob = jsonProperties.toBinaryData();
|
||||
OVERTE_IGNORE_DEPRECATED_END
|
||||
// end recipe
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <UUID.h>
|
||||
|
||||
#include "NetworkLogging.h"
|
||||
#include "WarningsSuppression.h"
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
@ -120,6 +121,9 @@ QByteArray DataServerAccountInfo::getUsernameSignature(const QUuid& connectionTo
|
|||
}
|
||||
|
||||
QByteArray DataServerAccountInfo::signPlaintext(const QByteArray& plaintext) {
|
||||
OVERTE_IGNORE_DEPRECATED_BEGIN
|
||||
// Deprecated OpenSSL API code -- this should be fixed eventually.
|
||||
|
||||
if (!_privateKey.isEmpty()) {
|
||||
const char* privateKeyData = _privateKey.constData();
|
||||
RSA* rsaPrivateKey = d2i_RSAPrivateKey(NULL,
|
||||
|
@ -149,6 +153,7 @@ QByteArray DataServerAccountInfo::signPlaintext(const QByteArray& plaintext) {
|
|||
}
|
||||
}
|
||||
return QByteArray();
|
||||
OVERTE_IGNORE_DEPRECATED_END
|
||||
}
|
||||
|
||||
QDataStream& operator<<(QDataStream &out, const DataServerAccountInfo& info) {
|
||||
|
|
|
@ -17,6 +17,12 @@
|
|||
#include <QUuid>
|
||||
#include "NetworkLogging.h"
|
||||
#include <cassert>
|
||||
#include "WarningsSuppression.h"
|
||||
|
||||
|
||||
OVERTE_IGNORE_DEPRECATED_BEGIN
|
||||
// Qt provides HMAC, do we actually need this here?
|
||||
// But for the time being, suppress this.
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000
|
||||
HMACAuth::HMACAuth(AuthMethod authMethod)
|
||||
|
@ -115,3 +121,5 @@ bool HMACAuth::calculateHash(HMACHash& hashResult, const char* data, int dataLen
|
|||
hashResult = result();
|
||||
return true;
|
||||
}
|
||||
|
||||
OVERTE_IGNORE_DEPRECATED_END
|
|
@ -43,6 +43,7 @@
|
|||
#include "SharedUtil.h"
|
||||
#include <Trace.h>
|
||||
#include <ModerationFlags.h>
|
||||
#include "WarningsSuppression.h"
|
||||
|
||||
using namespace std::chrono;
|
||||
|
||||
|
@ -187,7 +188,11 @@ qint64 NodeList::sendStats(QJsonObject statsObject, SockAddr destination) {
|
|||
auto statsPacketList = NLPacketList::create(PacketType::NodeJsonStats, QByteArray(), true, true);
|
||||
|
||||
QJsonDocument jsonDocument(statsObject);
|
||||
|
||||
OVERTE_IGNORE_DEPRECATED_BEGIN
|
||||
// Can't use CBOR yet, will break protocol.
|
||||
statsPacketList->write(jsonDocument.toBinaryData());
|
||||
OVERTE_IGNORE_DEPRECATED_END
|
||||
|
||||
sendPacketList(std::move(statsPacketList), destination);
|
||||
return 0;
|
||||
|
|
|
@ -18,10 +18,15 @@
|
|||
#include <qdebug.h>
|
||||
|
||||
#include "NetworkLogging.h"
|
||||
#include "WarningsSuppression.h"
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
OVERTE_IGNORE_DEPRECATED_BEGIN
|
||||
// Deprecated OpenSSL functions being used here.
|
||||
// Should look into modernizing this.
|
||||
|
||||
RSAKeypairGenerator::RSAKeypairGenerator(QObject* parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
|
@ -33,70 +38,72 @@ void RSAKeypairGenerator::run() {
|
|||
}
|
||||
|
||||
void RSAKeypairGenerator::generateKeypair() {
|
||||
|
||||
|
||||
RSA* keyPair = RSA_new();
|
||||
BIGNUM* exponent = BN_new();
|
||||
|
||||
|
||||
const unsigned long RSA_KEY_EXPONENT = 65537;
|
||||
BN_set_word(exponent, RSA_KEY_EXPONENT);
|
||||
|
||||
|
||||
// seed the random number generator before we call RSA_generate_key_ex
|
||||
srand(time(NULL));
|
||||
|
||||
|
||||
const int RSA_KEY_BITS = 2048;
|
||||
|
||||
|
||||
if (!RSA_generate_key_ex(keyPair, RSA_KEY_BITS, exponent, NULL)) {
|
||||
qCDebug(networking) << "Error generating 2048-bit RSA Keypair -" << ERR_get_error();
|
||||
|
||||
|
||||
emit errorGeneratingKeypair();
|
||||
|
||||
|
||||
// we're going to bust out of here but first we cleanup the BIGNUM
|
||||
BN_free(exponent);
|
||||
return;
|
||||
}
|
||||
qCDebug(networking) << "KEYPAIR: OpenSSL generated a" << RSA_KEY_BITS << "bit RSA key-pair";
|
||||
|
||||
|
||||
// we don't need the BIGNUM anymore so clean that up
|
||||
BN_free(exponent);
|
||||
|
||||
|
||||
// grab the public key and private key from the file
|
||||
unsigned char* publicKeyDER = NULL;
|
||||
int publicKeyLength = i2d_RSAPublicKey(keyPair, &publicKeyDER);
|
||||
|
||||
|
||||
unsigned char* privateKeyDER = NULL;
|
||||
int privateKeyLength = i2d_RSAPrivateKey(keyPair, &privateKeyDER);
|
||||
|
||||
|
||||
if (publicKeyLength <= 0 || privateKeyLength <= 0) {
|
||||
qCDebug(networking) << "Error getting DER public or private key from RSA struct -" << ERR_get_error();
|
||||
|
||||
|
||||
emit errorGeneratingKeypair();
|
||||
|
||||
|
||||
// cleanup the RSA struct
|
||||
RSA_free(keyPair);
|
||||
|
||||
|
||||
// cleanup the public and private key DER data, if required
|
||||
if (publicKeyLength > 0) {
|
||||
OPENSSL_free(publicKeyDER);
|
||||
}
|
||||
|
||||
|
||||
if (privateKeyLength > 0) {
|
||||
OPENSSL_free(privateKeyDER);
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// we have the public key and private key in memory
|
||||
// we can cleanup the RSA struct before we continue on
|
||||
RSA_free(keyPair);
|
||||
|
||||
|
||||
_publicKey = QByteArray { reinterpret_cast<char*>(publicKeyDER), publicKeyLength };
|
||||
_privateKey = QByteArray { reinterpret_cast<char*>(privateKeyDER), privateKeyLength };
|
||||
|
||||
|
||||
// cleanup the publicKeyDER and publicKeyDER data
|
||||
OPENSSL_free(publicKeyDER);
|
||||
OPENSSL_free(privateKeyDER);
|
||||
|
||||
|
||||
qCDebug(networking) << "KEYPAIR: emitting generated signal and finishing";
|
||||
emit generatedKeypair(_publicKey, _privateKey);
|
||||
}
|
||||
|
||||
OVERTE_IGNORE_DEPRECATED_END
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include <GLMHelpers.h>
|
||||
#include <udt/PacketHeaders.h>
|
||||
#include "WarningsSuppression.h"
|
||||
|
||||
OctreeQuery::OctreeQuery(bool randomizeConnectionID) {
|
||||
if (randomizeConnectionID) {
|
||||
|
@ -61,19 +62,22 @@ int OctreeQuery::getBroadcastData(unsigned char* destinationBuffer) {
|
|||
// desired boundaryLevelAdjust
|
||||
memcpy(destinationBuffer, &_boundaryLevelAdjust, sizeof(_boundaryLevelAdjust));
|
||||
destinationBuffer += sizeof(_boundaryLevelAdjust);
|
||||
|
||||
|
||||
// create a QByteArray that holds the binary representation of the JSON parameters
|
||||
QByteArray binaryParametersDocument;
|
||||
|
||||
|
||||
if (!_jsonParameters.isEmpty()) {
|
||||
OVERTE_IGNORE_DEPRECATED_BEGIN
|
||||
// Can't use CBOR yet, will break the protocol.
|
||||
binaryParametersDocument = QJsonDocument(_jsonParameters).toBinaryData();
|
||||
OVERTE_IGNORE_DEPRECATED_END
|
||||
}
|
||||
|
||||
|
||||
// write the size of the JSON parameters
|
||||
uint16_t binaryParametersBytes = binaryParametersDocument.size();
|
||||
memcpy(destinationBuffer, &binaryParametersBytes, sizeof(binaryParametersBytes));
|
||||
destinationBuffer += sizeof(binaryParametersBytes);
|
||||
|
||||
|
||||
// pack the binary JSON parameters
|
||||
// NOTE: for now we assume that the filters that will be set are all small enough that we will not have a packet > MTU
|
||||
if (binaryParametersDocument.size() > 0) {
|
||||
|
@ -141,21 +145,23 @@ int OctreeQuery::parseData(ReceivedMessage& message) {
|
|||
// desired boundaryLevelAdjust
|
||||
memcpy(&_boundaryLevelAdjust, sourceBuffer, sizeof(_boundaryLevelAdjust));
|
||||
sourceBuffer += sizeof(_boundaryLevelAdjust);
|
||||
|
||||
|
||||
// check if we have a packed JSON filter
|
||||
uint16_t binaryParametersBytes;
|
||||
memcpy(&binaryParametersBytes, sourceBuffer, sizeof(binaryParametersBytes));
|
||||
sourceBuffer += sizeof(binaryParametersBytes);
|
||||
|
||||
|
||||
if (binaryParametersBytes > 0) {
|
||||
// unpack the binary JSON parameters
|
||||
QByteArray binaryJSONParameters { binaryParametersBytes, 0 };
|
||||
memcpy(binaryJSONParameters.data(), sourceBuffer, binaryParametersBytes);
|
||||
sourceBuffer += binaryParametersBytes;
|
||||
|
||||
|
||||
// grab the parameter object from the packed binary representation of JSON
|
||||
OVERTE_IGNORE_DEPRECATED_BEGIN
|
||||
auto newJsonDocument = QJsonDocument::fromBinaryData(binaryJSONParameters);
|
||||
|
||||
OVERTE_IGNORE_DEPRECATED_END
|
||||
|
||||
QWriteLocker jsonParameterLocker { &_jsonParametersLock };
|
||||
_jsonParameters = newJsonDocument.object();
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <QtCore/QJsonObject>
|
||||
#include <QtCore/QBuffer>
|
||||
#include <QtCore/QDebug>
|
||||
#include "WarningsSuppression.h"
|
||||
|
||||
using namespace recording;
|
||||
|
||||
|
@ -104,7 +105,10 @@ bool Clip::write(QIODevice& output) {
|
|||
rootObject.insert(FRAME_TYPE_MAP, frameTypeObj);
|
||||
// Always mark new files as compressed
|
||||
rootObject.insert(FRAME_COMREPSSION_FLAG, true);
|
||||
OVERTE_IGNORE_DEPRECATED_BEGIN
|
||||
// Can't use CBOR yet, will break the protocol.
|
||||
QByteArray headerFrameData = QJsonDocument(rootObject).toBinaryData();
|
||||
OVERTE_IGNORE_DEPRECATED_END
|
||||
// Never compress the header frame
|
||||
if (!writeFrame(output, Frame({ Frame::TYPE_HEADER, 0, headerFrameData }), false)) {
|
||||
return false;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "../Frame.h"
|
||||
#include "../Logging.h"
|
||||
#include "BufferClip.h"
|
||||
|
||||
#include "WarningsSuppression.h"
|
||||
|
||||
using namespace recording;
|
||||
|
||||
|
@ -106,7 +106,11 @@ void PointerClip::init(uchar* data, size_t size) {
|
|||
}
|
||||
|
||||
QByteArray fileHeaderData((char*)_data + fileHeaderFrameHeader.fileOffset, fileHeaderFrameHeader.size);
|
||||
|
||||
OVERTE_IGNORE_DEPRECATED_BEGIN
|
||||
// Can't use CBOR yet, will break the protocol.
|
||||
_header = QJsonDocument::fromBinaryData(fileHeaderData);
|
||||
OVERTE_IGNORE_DEPRECATED_END
|
||||
}
|
||||
|
||||
// Check for compression
|
||||
|
|
45
libraries/shared/src/WarningsSuppression.h
Normal file
45
libraries/shared/src/WarningsSuppression.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
//
|
||||
// WarningsSuppression.h
|
||||
//
|
||||
//
|
||||
// Created by Dale Glass on 5/6/2022
|
||||
// Copyright 2022 Dale Glass
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
/*
|
||||
* This file provides macros to suppress compile-time warnings.
|
||||
* They should be used with extreme caution, only when the compiler is definitely mistaken,
|
||||
* when the problem is in third party code that's not practical to patch, or where something
|
||||
* is deprecated but can't be dealt with for the time being.
|
||||
*
|
||||
* Usage of these macros should come with an explanation of why we're using them.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef OVERTE_WARNINGS_WHITELIST_GCC
|
||||
|
||||
#define OVERTE_IGNORE_DEPRECATED_BEGIN \
|
||||
_Pragma("GCC diagnostic push") \
|
||||
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
|
||||
|
||||
#define OVERTE_IGNORE_DEPRECATED_END _Pragma("GCC diagnostic pop")
|
||||
|
||||
#elif OVERTE_WARNINGS_WHITELIST_CLANG
|
||||
|
||||
#define OVERTE_IGNORE_DEPRECATED_BEGIN \
|
||||
_Pragma("clang diagnostic push") \
|
||||
_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
|
||||
|
||||
#define OVERTE_IGNORE_DEPRECATED_END _Pragma("clang diagnostic pop")
|
||||
|
||||
#else
|
||||
|
||||
#warning "Don't know how to suppress warnings on this compiler. Please fix me."
|
||||
|
||||
#define OVERTE_IGNORE_DEPRECATED_BEGIN
|
||||
#define OVERTE_IGNORE_DEPRECATED_END
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue