From 4a20cde554b8ea794858e6cd65571db0e42bf368 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 12:52:48 +0200 Subject: [PATCH 01/41] Create warning whitelist system --- CMakeLists.txt | 34 ++++++++++++++ interface/src/AvatarBookmarks.cpp | 4 ++ interface/src/avatar/AvatarPackager.cpp | 6 +++ interface/src/avatar/MyAvatar.cpp | 4 ++ interface/src/commerce/Wallet.cpp | 7 +++ .../AssetMappingsScriptingInterface.cpp | 5 ++ libraries/avatars/src/AvatarData.cpp | 11 ++++- .../entities/src/EntityItemProperties.cpp | 10 ++++ .../networking/src/DataServerAccountInfo.cpp | 5 ++ libraries/networking/src/HMACAuth.cpp | 8 ++++ libraries/networking/src/NodeList.cpp | 5 ++ .../networking/src/RSAKeypairGenerator.cpp | 47 +++++++++++-------- libraries/octree/src/OctreeQuery.cpp | 22 +++++---- libraries/recording/src/recording/Clip.cpp | 4 ++ .../src/recording/impl/PointerClip.cpp | 6 ++- libraries/shared/src/WarningsSuppression.h | 45 ++++++++++++++++++ 16 files changed, 193 insertions(+), 30 deletions(-) create mode 100644 libraries/shared/src/WarningsSuppression.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b58222a318..d65279452b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,6 +125,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) diff --git a/interface/src/AvatarBookmarks.cpp b/interface/src/AvatarBookmarks.cpp index f5d7eadc4d0..67f749516f7 100644 --- a/interface/src/AvatarBookmarks.cpp +++ b/interface/src/AvatarBookmarks.cpp @@ -38,6 +38,7 @@ #include #include +#include "WarningsSuppression.h" void addAvatarEntities(const QVariantList& avatarEntities) { auto nodeList = DependencyManager::get(); @@ -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 } } } diff --git a/interface/src/avatar/AvatarPackager.cpp b/interface/src/avatar/AvatarPackager.cpp index d43b7d95756..eb362ce470a 100644 --- a/interface/src/avatar/AvatarPackager.cpp +++ b/interface/src/avatar/AvatarPackager.cpp @@ -23,12 +23,18 @@ #include #include "ui/TabletScriptingInterface.h" +#include "WarningsSuppression.h" std::once_flag setupQMLTypesFlag; AvatarPackager::AvatarPackager() { std::call_once(setupQMLTypesFlag, []() { + OVERTE_IGNORE_DEPRECATED_BEGIN + qmlRegisterType(); qmlRegisterType(); + + OVERTE_IGNORE_DEPRECATED_END + qRegisterMetaType(); qRegisterMetaType(); qRegisterMetaType(); diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 0d650bf2e73..1e7232016e7 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -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 { diff --git a/interface/src/commerce/Wallet.cpp b/interface/src/commerce/Wallet.cpp index 7dfb908844c..52968ef413b 100644 --- a/interface/src/commerce/Wallet.cpp +++ b/interface/src/commerce/Wallet.cpp @@ -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 \ No newline at end of file diff --git a/interface/src/scripting/AssetMappingsScriptingInterface.cpp b/interface/src/scripting/AssetMappingsScriptingInterface.cpp index 5b90474d233..44ff4b2d101 100644 --- a/interface/src/scripting/AssetMappingsScriptingInterface.cpp +++ b/interface/src/scripting/AssetMappingsScriptingInterface.cpp @@ -22,6 +22,7 @@ #include #include #include +#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); diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index cfea4fedd53..3bce6020350 100755 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -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; } } diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 8df85bcfe62..119e2ed2ca0 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -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 } diff --git a/libraries/networking/src/DataServerAccountInfo.cpp b/libraries/networking/src/DataServerAccountInfo.cpp index 8756a0cc4bf..c6cd9661648 100644 --- a/libraries/networking/src/DataServerAccountInfo.cpp +++ b/libraries/networking/src/DataServerAccountInfo.cpp @@ -22,6 +22,7 @@ #include #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) { diff --git a/libraries/networking/src/HMACAuth.cpp b/libraries/networking/src/HMACAuth.cpp index 515af9a070a..c6a21d4d79c 100644 --- a/libraries/networking/src/HMACAuth.cpp +++ b/libraries/networking/src/HMACAuth.cpp @@ -17,6 +17,12 @@ #include #include "NetworkLogging.h" #include +#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 \ No newline at end of file diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index 790c005bc13..8fb6bf28f22 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -43,6 +43,7 @@ #include "SharedUtil.h" #include #include +#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; diff --git a/libraries/networking/src/RSAKeypairGenerator.cpp b/libraries/networking/src/RSAKeypairGenerator.cpp index df042973837..2fd6f4ef18a 100644 --- a/libraries/networking/src/RSAKeypairGenerator.cpp +++ b/libraries/networking/src/RSAKeypairGenerator.cpp @@ -18,10 +18,15 @@ #include #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(publicKeyDER), publicKeyLength }; _privateKey = QByteArray { reinterpret_cast(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 \ No newline at end of file diff --git a/libraries/octree/src/OctreeQuery.cpp b/libraries/octree/src/OctreeQuery.cpp index 8c3685dc699..4afd075196c 100644 --- a/libraries/octree/src/OctreeQuery.cpp +++ b/libraries/octree/src/OctreeQuery.cpp @@ -17,6 +17,7 @@ #include #include +#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(); } diff --git a/libraries/recording/src/recording/Clip.cpp b/libraries/recording/src/recording/Clip.cpp index 27b6a2b6c91..3de72b7357a 100644 --- a/libraries/recording/src/recording/Clip.cpp +++ b/libraries/recording/src/recording/Clip.cpp @@ -18,6 +18,7 @@ #include #include #include +#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; diff --git a/libraries/recording/src/recording/impl/PointerClip.cpp b/libraries/recording/src/recording/impl/PointerClip.cpp index bb8d6cfb339..228cfcde2f6 100644 --- a/libraries/recording/src/recording/impl/PointerClip.cpp +++ b/libraries/recording/src/recording/impl/PointerClip.cpp @@ -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 diff --git a/libraries/shared/src/WarningsSuppression.h b/libraries/shared/src/WarningsSuppression.h new file mode 100644 index 00000000000..16516137fa0 --- /dev/null +++ b/libraries/shared/src/WarningsSuppression.h @@ -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 From 1fd6ae0fb439c0df6921ebde3d6f8dd554d50732 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 14:54:47 +0200 Subject: [PATCH 02/41] Only whitespace changes --- interface/src/AvatarBookmarks.cpp | 2 +- interface/src/avatar/MyAvatar.cpp | 46 +++--- .../GooglePolyScriptingInterface.cpp | 4 +- interface/src/ui/HMDToolsDialog.cpp | 12 +- interface/src/ui/overlays/TextOverlay.cpp | 2 +- .../animation/src/AnimInverseKinematics.cpp | 4 +- libraries/animation/src/Rig.cpp | 154 +++++++++--------- libraries/avatars/src/AvatarData.cpp | 26 +-- .../src/controllers/InputRecorder.cpp | 16 +- .../entities/src/EntityItemProperties.cpp | 2 +- libraries/graphics/src/graphics/Geometry.cpp | 2 +- .../networking/src/DataServerAccountInfo.cpp | 2 +- libraries/networking/src/HMACAuth.cpp | 4 +- .../networking/src/udt/NetworkSocket.cpp | 2 +- .../src/webrtc/WebRTCDataChannels.cpp | 8 +- libraries/octree/src/OctreeQuery.cpp | 4 +- libraries/qml/src/qml/OffscreenSurface.cpp | 2 +- .../script-engine/src/ArrayBufferClass.cpp | 16 +- libraries/script-engine/src/ScriptEngine.cpp | 30 ++-- libraries/script-engine/src/WheelEvent.cpp | 10 +- libraries/shared/src/LogHandler.cpp | 2 +- libraries/shared/src/LogHandler.h | 2 +- libraries/shared/src/SharedUtil.cpp | 4 +- 23 files changed, 178 insertions(+), 178 deletions(-) diff --git a/interface/src/AvatarBookmarks.cpp b/interface/src/AvatarBookmarks.cpp index 67f749516f7..0d999b2ff13 100644 --- a/interface/src/AvatarBookmarks.cpp +++ b/interface/src/AvatarBookmarks.cpp @@ -190,7 +190,7 @@ void AvatarBookmarks::updateAvatarEntities(const QVariantList &avatarEntities) { * @property {number} version - The version of the bookmark data format. * @property {string} avatarUrl - The URL of the avatar model. * @property {number} avatarScale - The target scale of the avatar. - * @property {Array>} [avatarEntites] - The avatar entities included with the + * @property {Array>} [avatarEntites] - The avatar entities included with the * bookmark. * @property {AttachmentData[]} [attachments] - The attachments included with the bookmark. *

Deprecated: Use avatar entities instead. diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 1e7232016e7..f9a9f076862 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -1147,11 +1147,11 @@ void MyAvatar::updateSensorToWorldMatrix() { _sensorToWorldMatrixCache.set(_sensorToWorldMatrix); updateJointFromController(controller::Action::LEFT_HAND, _controllerLeftHandMatrixCache); updateJointFromController(controller::Action::RIGHT_HAND, _controllerRightHandMatrixCache); - + if (hasSensorToWorldScaleChanged) { emit sensorToWorldScaleChanged(sensorToWorldScale); } - + } glm::vec3 MyAvatar::getLeftHandPosition() const { @@ -1602,7 +1602,7 @@ bool MyAvatar::hasAvatarEntities() const { void MyAvatar::handleCanRezAvatarEntitiesChanged(bool canRezAvatarEntities) { if (canRezAvatarEntities) { // Start displaying avatar entities. - // Allow time for the avatar mixer to be updated with the user's permissions so that it doesn't discard the avatar + // Allow time for the avatar mixer to be updated with the user's permissions so that it doesn't discard the avatar // entities sent. In theory, typical worst case would be Interface running on same PC as server and the timings of // Interface and the avatar mixer sending DomainListRequest to the domain server being such that the avatar sends its // DomainListRequest and gets its DomainList response DOMAIN_SERVER_CHECK_IN_MSECS after Interface does. Allow extra @@ -1734,7 +1734,7 @@ void MyAvatar::handleChangedAvatarEntityData() { } }); } - + } // CHANGE real entities @@ -2593,7 +2593,7 @@ void MyAvatar::setSkeletonModelURL(const QUrl& skeletonModelURL) { } QObject::disconnect(*skeletonConnection); }); - + saveAvatarUrl(); emit skeletonChanged(); } @@ -2972,9 +2972,9 @@ void MyAvatar::attach(const QString& modelURL, const QString& jointName, bool allowDuplicates, bool useSaved) { if (QThread::currentThread() != thread()) { BLOCKING_INVOKE_METHOD(this, "attach", - Q_ARG(const QString&, modelURL), - Q_ARG(const QString&, jointName), - Q_ARG(const glm::vec3&, translation), + Q_ARG(const QString&, modelURL), + Q_ARG(const QString&, jointName), + Q_ARG(const glm::vec3&, translation), Q_ARG(const glm::quat&, rotation), Q_ARG(float, scale), Q_ARG(bool, isSoft), @@ -3072,7 +3072,7 @@ void MyAvatar::setAttachmentData(const QVector& attachmentData) emit attachmentsChanged(); } -QVector MyAvatar::getAttachmentData() const { +QVector MyAvatar::getAttachmentData() const { QVector attachmentData; if (!DependencyManager::get()->getThisNodeCanRezAvatarEntities()) { @@ -3128,7 +3128,7 @@ void MyAvatar::setAttachmentsVariant(const QVariantList& variant) { newAttachments.append(attachment); } } - setAttachmentData(newAttachments); + setAttachmentData(newAttachments); } bool MyAvatar::findAvatarEntity(const QString& modelURL, const QString& jointName, QUuid& entityID) { @@ -3519,7 +3519,7 @@ void MyAvatar::updateOrientation(float deltaTime) { // Smoothly rotate body with arrow keys float targetSpeed = getDriveKey(YAW) * _yawSpeed; CameraMode mode = qApp->getCamera().getMode(); - bool computeLookAt = isReadyForPhysics() && !qApp->isHMDMode() && + bool computeLookAt = isReadyForPhysics() && !qApp->isHMDMode() && (mode == CAMERA_MODE_FIRST_PERSON_LOOK_AT || mode == CAMERA_MODE_LOOK_AT || mode == CAMERA_MODE_SELFIE); bool smoothCameraYaw = computeLookAt && mode != CAMERA_MODE_FIRST_PERSON_LOOK_AT; if (smoothCameraYaw) { @@ -3819,16 +3819,16 @@ void MyAvatar::updateOrientation(float deltaTime) { if (_firstPersonSteadyHeadTimer < FIRST_PERSON_RECENTER_SECONDS) { if (_firstPersonSteadyHeadTimer > 0.0f) { _firstPersonSteadyHeadTimer += deltaTime; - } + } } else { _shouldTurnToFaceCamera = true; _firstPersonSteadyHeadTimer = 0.0f; - } + } } else { _firstPersonSteadyHeadTimer = deltaTime; } } - + } else { head->setBaseYaw(0.0f); head->setBasePitch(getHead()->getBasePitch() + getDriveKey(PITCH) * _pitchSpeed * deltaTime @@ -3906,7 +3906,7 @@ glm::vec3 MyAvatar::scaleMotorSpeed(const glm::vec3 forward, const glm::vec3 rig zSpeed != 0.0f && xSpeed != 0.0f && !isFlying()){ direction = (zSpeed * forward); } - + auto length = glm::length(direction); if (length > EPSILON) { direction /= length; @@ -5457,7 +5457,7 @@ void MyAvatar::setIsInSittingState(bool isSitting) { // In updateSitStandState, we only change state if this timer is above a threshold (STANDING_TIMEOUT, SITTING_TIMEOUT). // This avoids changing state if the user sits and stands up quickly. _sitStandStateTimer = 0.0f; - + _isInSittingState.set(isSitting); setResetMode(true); setSitStandStateChange(true); @@ -5545,7 +5545,7 @@ void MyAvatar::setWalkBackwardSpeed(float value) { changed = false; break; } - + if (changed && prevVal != value) { emit walkBackwardSpeedChanged(value); } @@ -5867,7 +5867,7 @@ bool MyAvatar::FollowHelper::shouldActivateHorizontal_userStanding( } } } - + if (!stepDetected) { glm::vec3 defaultHipsPosition = myAvatar.getAbsoluteDefaultJointTranslationInObjectFrame(myAvatar.getJointIndex("Hips")); glm::vec3 defaultHeadPosition = myAvatar.getAbsoluteDefaultJointTranslationInObjectFrame(myAvatar.getJointIndex("Head")); @@ -6701,15 +6701,15 @@ void MyAvatar::useFlow(bool isActive, bool isCollidable, const QVariantMap& phys /*@jsdoc * Flow options currently used in flow simulation. * @typedef {object} MyAvatar.FlowData - * @property {boolean} initialized - true if flow has been initialized for the current avatar, false + * @property {boolean} initialized - true if flow has been initialized for the current avatar, false * if it hasn't. * @property {boolean} active - true if flow is enabled, false if it isn't. * @property {boolean} colliding - true if collisions are enabled, false if they aren't. - * @property {Object} physicsData - The physics configuration for each group of joints + * @property {Object} physicsData - The physics configuration for each group of joints * that has been configured. - * @property {Object} collisions - The collisions configuration for each joint that + * @property {Object} collisions - The collisions configuration for each joint that * has collisions configured. - * @property {Object} threads - The threads that have been configured, with the first joint's name as the + * @property {Object} threads - The threads that have been configured, with the first joint's name as the * ThreadName and value as an array of the indexes of all the joints in the thread. */ /*@jsdoc @@ -6760,7 +6760,7 @@ QVariantMap MyAvatar::getFlowData() { } groupJointsMap[groupName].push_back(joint.second.getIndex()); } - } + } for (auto &group : groups) { QVariantMap settingsObject; QString groupName = group.first; diff --git a/interface/src/scripting/GooglePolyScriptingInterface.cpp b/interface/src/scripting/GooglePolyScriptingInterface.cpp index e1b51d402ab..7507208e277 100644 --- a/interface/src/scripting/GooglePolyScriptingInterface.cpp +++ b/interface/src/scripting/GooglePolyScriptingInterface.cpp @@ -29,7 +29,7 @@ const QString LIST_POLY_URL = "https://poly.googleapis.com/v1/assets?"; const QString GET_POLY_URL = "https://poly.googleapis.com/v1/assets/model?"; const QStringList VALID_FORMATS = QStringList() << "BLOCKS" << "FBX" << "GLTF" << "GLTF2" << "OBJ" << "TILT" << ""; -const QStringList VALID_CATEGORIES = QStringList() << "animals" << "architecture" << "art" << "food" << +const QStringList VALID_CATEGORIES = QStringList() << "animals" << "architecture" << "art" << "food" << "nature" << "objects" << "people" << "scenes" << "technology" << "transport" << ""; GooglePolyScriptingInterface::GooglePolyScriptingInterface() { @@ -75,7 +75,7 @@ QString GooglePolyScriptingInterface::getGLTF2(const QString& keyword, const QSt QUrl url = formatURLQuery(keyword, category, "GLTF2"); return getModelURL(url); } - + // This method will not be useful until we support Tilt models QString GooglePolyScriptingInterface::getTilt(const QString& keyword, const QString& category) { QUrl url = formatURLQuery(keyword, category, "TILT"); diff --git a/interface/src/ui/HMDToolsDialog.cpp b/interface/src/ui/HMDToolsDialog.cpp index 761f5c85a34..3f7ac9f4cc6 100644 --- a/interface/src/ui/HMDToolsDialog.cpp +++ b/interface/src/ui/HMDToolsDialog.cpp @@ -43,7 +43,7 @@ HMDToolsDialog::HMDToolsDialog(QWidget* parent) : _defaultPluginName = displayPlugin->getName(); continue; } - + if (displayPlugin->isHmd()) { // Not all HMD's have corresponding screens if (displayPlugin->getHmdScreen() >= 0) { @@ -90,7 +90,7 @@ HMDToolsDialog::HMDToolsDialog(QWidget* parent) : connect(_switchModeButton, &QPushButton::clicked, [this]{ toggleHMDMode(); }); - + // when the application is about to quit, leave HDM mode connect(qApp, &Application::beforeAboutToQuit, [this]{ // FIXME this is ineffective because it doesn't trigger the menu to @@ -211,7 +211,7 @@ void HMDToolsDialog::screenCountChanged(int newCount) { if (qApp->isHMDMode() && _hmdScreenNumber != hmdScreenNumber) { qDebug() << "HMD Display changed WHILE IN HMD MODE"; leaveHMDMode(); - + // if there is a new best HDM screen then go back into HDM mode after done leaving if (hmdScreenNumber >= 0) { qDebug() << "Trying to go back into HMD Mode"; @@ -254,7 +254,7 @@ void HMDWindowWatcher::windowGeometryChanged(int arg) { } void HMDWindowWatcher::windowScreenChanged(QScreen* screen) { - // if we have more than one screen, and a known hmdScreen then try to + // if we have more than one screen, and a known hmdScreen then try to // keep our dialog off of the hmdScreen if (QApplication::desktop()->screenCount() > 1) { int hmdScreenNumber = _hmdTools->_hmdScreenNumber; @@ -263,10 +263,10 @@ void HMDWindowWatcher::windowScreenChanged(QScreen* screen) { QScreen* hmdScreen = QGuiApplication::screens()[hmdScreenNumber]; if (screen == hmdScreen) { qDebug() << "HMD Tools: Whoa! What are you doing? You don't want to move me to the HMD Screen!"; - + // try to pick a better screen QScreen* betterScreen = NULL; - + QScreen* lastApplicationScreen = _hmdTools->getLastApplicationScreen(); QWindow* appWindow = qApp->getWindow()->windowHandle(); QScreen* appScreen = appWindow->screen(); diff --git a/interface/src/ui/overlays/TextOverlay.cpp b/interface/src/ui/overlays/TextOverlay.cpp index 6760c918d34..16327223982 100644 --- a/interface/src/ui/overlays/TextOverlay.cpp +++ b/interface/src/ui/overlays/TextOverlay.cpp @@ -20,7 +20,7 @@ QUrl const TextOverlay::URL(QString("hifi/overlays/TextOverlay.qml")); TextOverlay::TextOverlay() : QmlOverlay(URL) { } -TextOverlay::TextOverlay(const TextOverlay* textOverlay) +TextOverlay::TextOverlay(const TextOverlay* textOverlay) : QmlOverlay(URL, textOverlay) { } diff --git a/libraries/animation/src/AnimInverseKinematics.cpp b/libraries/animation/src/AnimInverseKinematics.cpp index 095e8333ee2..e25c84f20a9 100644 --- a/libraries/animation/src/AnimInverseKinematics.cpp +++ b/libraries/animation/src/AnimInverseKinematics.cpp @@ -269,7 +269,7 @@ void AnimInverseKinematics::solve(const AnimContext& context, const std::vector< break; } } - + // on last iteration, interpolate jointChains, if necessary if (numLoops == MAX_IK_LOOPS) { for (size_t i = 0; i < _prevJointChainInfoVec.size(); i++) { @@ -357,7 +357,7 @@ void AnimInverseKinematics::solve(const AnimContext& context, const std::vector< bool needsInterpolation = _prevJointChainInfoVec[chainIndex].timer > 0.0f; float alpha = needsInterpolation ? getInterpolationAlpha(_prevJointChainInfoVec[chainIndex].timer) : 0.0f; // update rotationOnly targets that don't lie on the ik chain of other ik targets. - if (parentIndex != AnimSkeleton::INVALID_JOINT_INDEX && !_rotationAccumulators[tipIndex].isDirty() && + if (parentIndex != AnimSkeleton::INVALID_JOINT_INDEX && !_rotationAccumulators[tipIndex].isDirty() && (target.getType() == IKTarget::Type::RotationOnly || target.getType() == IKTarget::Type::Unknown)) { if (target.getType() == IKTarget::Type::RotationOnly) { const glm::quat& targetRotation = target.getRotation(); diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index ba042d31a88..21b4fbc2c4d 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -90,7 +90,7 @@ static const QString MAIN_STATE_MACHINE_RIGHT_HAND_POSITION("mainStateMachineRig /*@jsdoc - *

An AnimStateDictionary object may have the following properties. It may also have other properties, set by + *

An AnimStateDictionary object may have the following properties. It may also have other properties, set by * scripts.

*

Warning: These properties are subject to change. * @@ -98,117 +98,117 @@ static const QString MAIN_STATE_MACHINE_RIGHT_HAND_POSITION("mainStateMachineRig * * * - * - * - * * * - * - * - * * - * - * - * - * - * - * * * - * - * * * * - * - * * - * - * * * - * - * * - * - * - * - * * - * - * - * - * - * - * * * - * - * - * - * - * * - * - * * - * * - * - * - * * - * - * * * @@ -216,60 +216,60 @@ static const QString MAIN_STATE_MACHINE_RIGHT_HAND_POSITION("mainStateMachineRig * * * - * * * - * - * - * - * - * - * * * * - * - * * - * * - * - * - * - * * - * - * - * * - * - * - * * * @@ -521,7 +521,7 @@ void Rig::triggerNetworkRole(const QString& role) { _networkVars.set("postTransitAnim", true); _networkAnimState.clipNodeEnum = NetworkAnimState::PostTransit; } - + } void Rig::restoreNetworkAnimation() { @@ -640,10 +640,10 @@ void Rig::initJointStates(const HFMModel& hfmModel, const glm::mat4& modelOffset _internalPoseSet._overrideFlags.clear(); _internalPoseSet._overrideFlags.resize(_animSkeleton->getNumJoints(), false); - + _networkPoseSet._overridePoses.clear(); _networkPoseSet._overridePoses = _animSkeleton->getRelativeDefaultPoses(); - + _networkPoseSet._overrideFlags.clear(); _networkPoseSet._overrideFlags.resize(_animSkeleton->getNumJoints(), false); @@ -1496,7 +1496,7 @@ void Rig::computeMotionAnimationState(float deltaTime, const glm::vec3& worldPos _animVars.set("isInputLeft", false); // directly reflects input - _animVars.set("isNotInput", true); + _animVars.set("isNotInput", true); // no input + speed drops to SLOW_SPEED_THRESHOLD // (don't transition run->idle - slow to walk first) @@ -1728,10 +1728,10 @@ void Rig::updateAnimations(float deltaTime, const glm::mat4& rootTransform, cons _networkVars = networkTriggersOut; _lastContext = context; } - + applyOverridePoses(); - buildAbsoluteRigPoses(_internalPoseSet._relativePoses, _internalPoseSet._absolutePoses); + buildAbsoluteRigPoses(_internalPoseSet._relativePoses, _internalPoseSet._absolutePoses); _internalFlow.update(deltaTime, _internalPoseSet._relativePoses, _internalPoseSet._absolutePoses, _internalPoseSet._overrideFlags); if (_sendNetworkNode) { @@ -1747,7 +1747,7 @@ void Rig::updateAnimations(float deltaTime, const glm::mat4& rootTransform, cons // copy internal poses to external poses { QWriteLocker writeLock(&_externalPoseSetLock); - + _externalPoseSet = _internalPoseSet; } } @@ -2503,7 +2503,7 @@ void Rig::initAnimGraph(const QUrl& url) { triggerNetworkRole("postTransitAnim"); } } - + }); connect(_networkLoader.get(), &AnimNodeLoader::error, [networkUrl](int error, QString str) { qCritical(animation) << "Error loading: code = " << error << "str =" << str; diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index 3bce6020350..2076a88d324 100755 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -471,7 +471,7 @@ QByteArray AvatarData::toByteArray(AvatarDataDetail dataDetail, quint64 lastSent IF_AVATAR_SPACE(PACKET_HAS_AVATAR_GLOBAL_POSITION, sizeof _globalPosition) { auto startSection = destinationBuffer; AVATAR_MEMCPY(_globalPosition); - + int numBytes = destinationBuffer - startSection; if (outboundDataRateOut) { @@ -1200,7 +1200,7 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) { auto newHasProceduralBlinkFaceMovement = oneAtBit16(bitItems, PROCEDURAL_BLINK_FACE_MOVEMENT); auto newCollideWithOtherAvatars = oneAtBit16(bitItems, COLLIDE_WITH_OTHER_AVATARS); - auto newHasPriority = oneAtBit16(bitItems, HAS_HERO_PRIORITY); + auto newHasPriority = oneAtBit16(bitItems, HAS_HERO_PRIORITY); bool keyStateChanged = (_keyState != newKeyState); bool handStateChanged = (_handState != newHandState); @@ -1212,7 +1212,7 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) { bool proceduralBlinkFaceMovementChanged = (_headData->getProceduralAnimationFlag(HeadData::BlinkProceduralBlendshapeAnimation) != newHasProceduralBlinkFaceMovement); bool collideWithOtherAvatarsChanged = (_collideWithOtherAvatars != newCollideWithOtherAvatars); bool hasPriorityChanged = (getHasPriority() != newHasPriority); - bool somethingChanged = keyStateChanged || handStateChanged || faceStateChanged || eyeStateChanged || audioEnableFaceMovementChanged || + bool somethingChanged = keyStateChanged || handStateChanged || faceStateChanged || eyeStateChanged || audioEnableFaceMovementChanged || proceduralEyeFaceMovementChanged || proceduralBlinkFaceMovementChanged || collideWithOtherAvatarsChanged || hasPriorityChanged; @@ -1785,7 +1785,7 @@ glm::vec3 AvatarData::getJointTranslation(int index) const { } glm::vec3 AvatarData::getJointTranslation(const QString& name) const { - // Can't do this, because the lock needs to cover the entire set of logic. In theory, the joints could change + // Can't do this, because the lock needs to cover the entire set of logic. In theory, the joints could change // on another thread in between the call to getJointIndex and getJointTranslation // return getJointTranslation(getJointIndex(name)); return readLockWithNamedJointIndex(name, [this](int index) { @@ -1865,7 +1865,7 @@ bool AvatarData::isJointDataValid(const QString& name) const { // return isJointDataValid(getJointIndex(name)); return readLockWithNamedJointIndex(name, false, [&](int index) { - // This is technically superfluous.... the lambda is only called if index is a valid + // This is technically superfluous.... the lambda is only called if index is a valid // offset for _jointData. Nevertheless, it would be confusing to leave the lamdba as // `return true` return index < _jointData.size(); @@ -2144,7 +2144,7 @@ void AvatarData::unpackSkeletonData(const QByteArray& data) { const unsigned char* startPosition = reinterpret_cast(data.data()); const unsigned char* sourceBuffer = startPosition; - + auto header = reinterpret_cast(sourceBuffer); sourceBuffer += sizeof(const AvatarSkeletonTrait::Header); @@ -2157,7 +2157,7 @@ void AvatarData::unpackSkeletonData(const QByteArray& data) { uJointData.jointIndex = (int)i; uJointData.stringLength = (int)jointData->stringLength; uJointData.stringStart = (int)jointData->stringStart; - uJointData.parentIndex = ((uJointData.boneType == AvatarSkeletonTrait::BoneType::SkeletonRoot) || + uJointData.parentIndex = ((uJointData.boneType == AvatarSkeletonTrait::BoneType::SkeletonRoot) || (uJointData.boneType == AvatarSkeletonTrait::BoneType::NonSkeletonRoot)) ? -1 : (int)jointData->parentIndex; unpackOrientationQuatFromSixBytes(reinterpret_cast(&jointData->defaultRotation), uJointData.defaultRotation); unpackFloatVec3FromSignedTwoByteFixed(reinterpret_cast(&jointData->defaultTranslation), uJointData.defaultTranslation, TRANSLATION_COMPRESSION_RADIX); @@ -2307,7 +2307,7 @@ void AvatarData::setSkeletonModelURL(const QUrl& skeletonModelURL) { if (expanded == _skeletonModelURL) { return; } - + _skeletonModelURL = expanded; if (_clientTraitsHandler) { _clientTraitsHandler->markTraitUpdated(AvatarTraits::SkeletonModelURL); @@ -2935,14 +2935,14 @@ glm::vec3 AvatarData::getAbsoluteJointTranslationInObjectFrame(int index) const /*@jsdoc * Information on an attachment worn by the avatar. * @typedef {object} AttachmentData - * @property {string} modelUrl - The URL of the glTF, FBX, or OBJ model file. glTF models may be in JSON or binary format + * @property {string} modelUrl - The URL of the glTF, FBX, or OBJ model file. glTF models may be in JSON or binary format * (".gltf" or ".glb" URLs respectively). * @property {string} jointName - The name of the joint that the attachment is parented to. * @property {Vec3} translation - The offset from the joint that the attachment is positioned at. * @property {Vec3} rotation - The rotation applied to the model relative to the joint orientation. * @property {number} scale - The scale applied to the attachment model. - * @property {boolean} soft - If true and the model has a skeleton, the bones of the attached model's skeleton are - * rotated to fit the avatar's current pose. If true, the translation, rotation, and + * @property {boolean} soft - If true and the model has a skeleton, the bones of the attached model's skeleton are + * rotated to fit the avatar's current pose. If true, the translation, rotation, and * scale parameters are ignored. */ QVariant AttachmentData::toVariant() const { @@ -3138,12 +3138,12 @@ glm::mat4 AvatarData::getControllerRightHandMatrix() const { * @property {boolean} intersects - true if an avatar is intersected, false if it isn't. * @property {string} avatarID - The ID of the avatar that is intersected. * @property {number} distance - The distance from the ray origin to the intersection. - * @property {string} face - The name of the box face that is intersected; "UNKNOWN_FACE" if mesh was picked + * @property {string} face - The name of the box face that is intersected; "UNKNOWN_FACE" if mesh was picked * against. * @property {Vec3} intersection - The ray intersection point in world coordinates. * @property {Vec3} surfaceNormal - The surface normal at the intersection point. * @property {number} jointIndex - The index of the joint intersected. - * @property {SubmeshIntersection} extraInfo - Extra information on the mesh intersected if mesh was picked against, + * @property {SubmeshIntersection} extraInfo - Extra information on the mesh intersected if mesh was picked against, * {} if it wasn't. */ QScriptValue RayToAvatarIntersectionResultToScriptValue(QScriptEngine* engine, const RayToAvatarIntersectionResult& value) { diff --git a/libraries/controllers/src/controllers/InputRecorder.cpp b/libraries/controllers/src/controllers/InputRecorder.cpp index 928dbf0521d..49ac0920865 100644 --- a/libraries/controllers/src/controllers/InputRecorder.cpp +++ b/libraries/controllers/src/controllers/InputRecorder.cpp @@ -98,7 +98,7 @@ namespace controller { if (!QDir(SAVE_DIRECTORY).exists()) { QDir().mkdir(SAVE_DIRECTORY); } - + QFile saveFile (fileName); if (!saveFile.open(QIODevice::WriteOnly)) { qWarning() << "could not open file: " << fileName; @@ -112,7 +112,7 @@ namespace controller { qCritical("unable to gzip while saving to json."); return; } - + saveFile.write(jsonDataForFile); saveFile.close(); } @@ -133,7 +133,7 @@ namespace controller { status = false; return object; } - + QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonData); object = jsonDoc.object(); status = true; @@ -217,12 +217,12 @@ namespace controller { QString filePath = urlPath.toLocalFile(); QFileInfo info(filePath); QString extension = info.suffix(); - + if (extension != "gz") { qWarning() << "can not load file with exentsion of " << extension; return; } - + bool success = false; QJsonObject data = openFile(filePath, success); auto keyValue = data.find("version"); @@ -250,15 +250,15 @@ namespace controller { _poseStateList.push_back(_currentFramePoses); _currentFramePoses.clear(); } - } + } _loading = false; } - + void InputRecorder::stopRecording() { _recording = false; _framesRecorded = (int)_actionStateList.size(); } - + void InputRecorder::startPlayback() { _playback = true; _recording = false; diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 119e2ed2ca0..2f92cf1eb78 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -1414,7 +1414,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { * false if the web entity's background should be transparent. The webpage must have CSS properties for transparency set * on the background-color for this property to have an effect. * @property {string} userAgent - The user agent for the web entity to use when visiting web pages. - * Default value: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) + * Default value: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) * Chrome/69.0.3497.113 Mobile Safari/537.36 * @example * var METERS_TO_INCHES = 39.3701; diff --git a/libraries/graphics/src/graphics/Geometry.cpp b/libraries/graphics/src/graphics/Geometry.cpp index 2f9f0a51e92..5ac3fc0d5a5 100755 --- a/libraries/graphics/src/graphics/Geometry.cpp +++ b/libraries/graphics/src/graphics/Geometry.cpp @@ -362,7 +362,7 @@ MeshPointer Mesh::createIndexedTriangles_P3F(uint32_t numVertices, uint32_t numI mesh->setIndexBuffer(gpu::BufferView(new gpu::Buffer(numIndices * sizeof(uint32_t), (gpu::Byte*) indices), gpu::Element::INDEX_INT32)); } - + std::vector parts; parts.push_back(graphics::Mesh::Part(0, numIndices, 0, graphics::Mesh::TRIANGLES)); mesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(graphics::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL)); diff --git a/libraries/networking/src/DataServerAccountInfo.cpp b/libraries/networking/src/DataServerAccountInfo.cpp index c6cd9661648..662d52438f9 100644 --- a/libraries/networking/src/DataServerAccountInfo.cpp +++ b/libraries/networking/src/DataServerAccountInfo.cpp @@ -69,7 +69,7 @@ void DataServerAccountInfo::setAccessTokenFromJSON(const QJsonObject& jsonObject void DataServerAccountInfo::setUsername(const QString& username) { if (_username != username) { _username = username; - + qCDebug(networking) << "Username changed to" << username; } } diff --git a/libraries/networking/src/HMACAuth.cpp b/libraries/networking/src/HMACAuth.cpp index c6a21d4d79c..c1f62fac2e5 100644 --- a/libraries/networking/src/HMACAuth.cpp +++ b/libraries/networking/src/HMACAuth.cpp @@ -94,9 +94,9 @@ HMACAuth::HMACHash HMACAuth::result() { HMACHash hashValue(EVP_MAX_MD_SIZE); unsigned int hashLen; QMutexLocker lock(&_lock); - + auto hmacResult = HMAC_Final(_hmacContext, &hashValue[0], &hashLen); - + if (hmacResult) { hashValue.resize((size_t)hashLen); } else { diff --git a/libraries/networking/src/udt/NetworkSocket.cpp b/libraries/networking/src/udt/NetworkSocket.cpp index cc28cbfc734..7c7ab41ddbc 100644 --- a/libraries/networking/src/udt/NetworkSocket.cpp +++ b/libraries/networking/src/udt/NetworkSocket.cpp @@ -157,7 +157,7 @@ qint64 NetworkSocket::bytesToWrite(SocketType socketType, const SockAddr& addres bool NetworkSocket::hasPendingDatagrams() const { - return + return #if defined(WEBRTC_DATA_CHANNELS) _webrtcSocket.hasPendingDatagrams() || #endif diff --git a/libraries/networking/src/webrtc/WebRTCDataChannels.cpp b/libraries/networking/src/webrtc/WebRTCDataChannels.cpp index 44c1c5e82cb..610afc46688 100644 --- a/libraries/networking/src/webrtc/WebRTCDataChannels.cpp +++ b/libraries/networking/src/webrtc/WebRTCDataChannels.cpp @@ -394,8 +394,8 @@ qint64 WDCConnection::getBufferedAmount() const { #ifdef WEBRTC_DEBUG qCDebug(networking_webrtc) << "WDCConnection::getBufferedAmount()"; #endif - return _dataChannel && _dataChannel->state() != DataChannelInterface::kClosing - && _dataChannel->state() != DataChannelInterface::kClosed + return _dataChannel && _dataChannel->state() != DataChannelInterface::kClosing + && _dataChannel->state() != DataChannelInterface::kClosed ? _dataChannel->buffered_amount() : 0; } @@ -407,7 +407,7 @@ bool WDCConnection::sendDataMessage(const DataBuffer& buffer) { qCDebug(networking_webrtc) << "No data channel to send on"; } #endif - if (!_dataChannel || _dataChannel->state() == DataChannelInterface::kClosing + if (!_dataChannel || _dataChannel->state() == DataChannelInterface::kClosing || _dataChannel->state() == DataChannelInterface::kClosed) { // Data channel may have been closed while message to send was being prepared. return false; @@ -625,7 +625,7 @@ void WebRTCDataChannels::closePeerConnection(WDCConnection* connection) { #ifdef WEBRTC_DEBUG qCDebug(networking_webrtc) << "WebRTCDataChannels::closePeerConnection()"; #endif - // Use Qt's signals/slots mechanism to close the peer connection on its own call stack, separate from the DataChannel + // Use Qt's signals/slots mechanism to close the peer connection on its own call stack, separate from the DataChannel // callback that initiated the peer connection. // https://bugs.chromium.org/p/webrtc/issues/detail?id=3721 emit closePeerConnectionSoon(connection); diff --git a/libraries/octree/src/OctreeQuery.cpp b/libraries/octree/src/OctreeQuery.cpp index 4afd075196c..2abb82e489b 100644 --- a/libraries/octree/src/OctreeQuery.cpp +++ b/libraries/octree/src/OctreeQuery.cpp @@ -50,7 +50,7 @@ int OctreeQuery::getBroadcastData(unsigned char* destinationBuffer) { destinationBuffer += view.serialize(destinationBuffer); } } - + // desired Max Octree PPS memcpy(destinationBuffer, &_maxQueryPPS, sizeof(_maxQueryPPS)); destinationBuffer += sizeof(_maxQueryPPS); @@ -95,7 +95,7 @@ int OctreeQuery::getBroadcastData(unsigned char* destinationBuffer) { // called on the other nodes - assigns it to my views of the others int OctreeQuery::parseData(ReceivedMessage& message) { - + const unsigned char* startPosition = reinterpret_cast(message.getRawMessage()); const unsigned char* sourceBuffer = startPosition; diff --git a/libraries/qml/src/qml/OffscreenSurface.cpp b/libraries/qml/src/qml/OffscreenSurface.cpp index 2678cb55916..a5ac7348977 100644 --- a/libraries/qml/src/qml/OffscreenSurface.cpp +++ b/libraries/qml/src/qml/OffscreenSurface.cpp @@ -35,7 +35,7 @@ using namespace hifi::qml; using namespace hifi::qml::impl; -QmlUrlValidator OffscreenSurface::validator = [](const QUrl& url) -> bool { +QmlUrlValidator OffscreenSurface::validator = [](const QUrl& url) -> bool { if (url.isRelative()) { return true; } diff --git a/libraries/script-engine/src/ArrayBufferClass.cpp b/libraries/script-engine/src/ArrayBufferClass.cpp index 6734114932f..a1826bc0872 100644 --- a/libraries/script-engine/src/ArrayBufferClass.cpp +++ b/libraries/script-engine/src/ArrayBufferClass.cpp @@ -33,11 +33,11 @@ QObject(scriptEngine), QScriptClass(scriptEngine) { qScriptRegisterMetaType(engine(), toScriptValue, fromScriptValue); QScriptValue global = engine()->globalObject(); - + // Save string handles for quick lookup _name = engine()->toStringHandle(CLASS_NAME.toLatin1()); _byteLength = engine()->toStringHandle(BYTE_LENGTH_PROPERTY_NAME.toLatin1()); - + // build prototype _proto = engine()->newQObject(new ArrayBufferPrototype(this), QScriptEngine::QtOwnership, @@ -45,13 +45,13 @@ QScriptClass(scriptEngine) { QScriptEngine::ExcludeSuperClassMethods | QScriptEngine::ExcludeSuperClassProperties); _proto.setPrototype(global.property("Object").property("prototype")); - + // Register constructor _ctor = engine()->newFunction(construct, _proto); _ctor.setData(engine()->toScriptValue(this)); - + engine()->globalObject().setProperty(name(), _ctor); - + // Registering other array types // The script engine is there parent so it'll delete them with itself new DataViewClass(scriptEngine); @@ -101,16 +101,16 @@ QScriptValue ArrayBufferClass::construct(QScriptContext* context, QScriptEngine* if (!arg.isValid() || !arg.isNumber()) { return QScriptValue(); } - + quint32 size = arg.toInt32(); QScriptValue newObject = cls->newInstance(size); - + if (context->isCalledAsConstructor()) { // if called with keyword new, replace this object. context->setThisObject(newObject); return engine->undefinedValue(); } - + return newObject; } diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index c1578265e3a..3bbe72822d8 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -139,7 +139,7 @@ static QScriptValue debugPrint(QScriptContext* context, QScriptEngine* engine) { QString fileName = contextInfo.fileName(); int lineNumber = contextInfo.lineNumber(); QString functionName = contextInfo.functionName(); - + location = functionName; if (!fileName.isEmpty()) { if (location.isEmpty()) { @@ -155,10 +155,10 @@ static QScriptValue debugPrint(QScriptContext* context, QScriptEngine* engine) { if (location.isEmpty()) { location = scriptEngine->getFilename(); } - + // give the script engine a chance to notify the system about this message scriptEngine->print(message); - + // send the message to debug log qCDebug(scriptengine_script, "[%s] %s", qUtf8Printable(location), qUtf8Printable(message)); } else { @@ -366,20 +366,20 @@ void ScriptEngine::executeOnScriptThread(std::function function, const Q void ScriptEngine::waitTillDoneRunning(bool shutdown) { // Engine should be stopped already, but be defensive stop(); - + auto workerThread = thread(); - + if (workerThread == QThread::currentThread()) { qCWarning(scriptengine) << "ScriptEngine::waitTillDoneRunning called, but the script is on the same thread:" << getFilename(); return; } - + if (_isThreaded && workerThread) { // We should never be waiting (blocking) on our own thread assert(workerThread != QThread::currentThread()); #if 0 - // 26 Feb 2021 - Disabled this OSX-specific code because it causes OSX to crash on shutdown; without this code, OSX + // 26 Feb 2021 - Disabled this OSX-specific code because it causes OSX to crash on shutdown; without this code, OSX // doesn't crash on shutdown. Qt 5.12.3 and Qt 5.15.2. // // On mac, don't call QCoreApplication::processEvents() here. This is to prevent @@ -1042,7 +1042,7 @@ void ScriptEngine::addEventHandler(const EntityItemID& entityID, const QString& }; /*@jsdoc - *

The name of an entity event. When the entity event occurs, any function that has been registered for that event + *

The name of an entity event. When the entity event occurs, any function that has been registered for that event * via {@link Script.addEventHandler} is called with parameters per the entity event.

*
NameTypeDescription
userAnimNonebooleantrue when no user overrideAnimation is + *
userAnimNonebooleantrue when no user overrideAnimation is * playing.
userAnimAbooleantrue when a user overrideAnimation is + *
userAnimAbooleantrue when a user overrideAnimation is * playing.
userAnimBbooleantrue when a user overrideAnimation is + *
userAnimBbooleantrue when a user overrideAnimation is * playing.
sinenumberOscillating sine wave.
moveForwardSpeednumberControls the blend between the various forward walking + *
moveForwardSpeednumberControls the blend between the various forward walking * & running animations.
moveBackwardSpeednumberControls the blend between the various backward walking + *
moveBackwardSpeednumberControls the blend between the various backward walking * & running animations.
moveLateralSpeednumberControls the blend between the various sidestep walking + *
moveLateralSpeednumberControls the blend between the various sidestep walking * & running animations.
isMovingForwardbooleantrue if the avatar is moving + *
isMovingForwardbooleantrue if the avatar is moving * forward.
isMovingBackwardbooleantrue if the avatar is moving + *
isMovingBackwardbooleantrue if the avatar is moving * backward.
isMovingRightbooleantrue if the avatar is moving to the + *
isMovingRightbooleantrue if the avatar is moving to the * right.
isMovingLeftbooleantrue if the avatar is moving to the + *
isMovingLeftbooleantrue if the avatar is moving to the * left.
isMovingRightHmdbooleantrue if the avatar is moving to the right + *
isMovingRightHmdbooleantrue if the avatar is moving to the right * while the user is in HMD mode.
isMovingLeftHmdbooleantrue if the avatar is moving to the left while + *
isMovingLeftHmdbooleantrue if the avatar is moving to the left while * the user is in HMD mode.
isNotMovingbooleantrue if the avatar is stationary.
isTurningRightbooleantrue if the avatar is turning + *
isTurningRightbooleantrue if the avatar is turning * clockwise.
isTurningLeftbooleantrue if the avatar is turning + *
isTurningLeftbooleantrue if the avatar is turning * counter-clockwise.
isNotTurningbooleantrue if the avatar is not turning.
isFlyingbooleantrue if the avatar is flying.
isNotFlyingbooleantrue if the avatar is not flying.
isTakeoffStandbooleantrue if the avatar is about to execute a + *
isTakeoffStandbooleantrue if the avatar is about to execute a * standing jump.
isTakeoffRunbooleantrue if the avatar is about to execute a running + *
isTakeoffRunbooleantrue if the avatar is about to execute a running * jump.
isNotTakeoffbooleantrue if the avatar is not jumping.
isInAirStandbooleantrue if the avatar is in the air after a standing + *
isInAirStandbooleantrue if the avatar is in the air after a standing * jump.
isInAirRunbooleantrue if the avatar is in the air after a running + *
isInAirRunbooleantrue if the avatar is in the air after a running * jump.
isNotInAirbooleantrue if the avatar on the ground.
inAirAlphanumberUsed to interpolate between the up, apex, and down in-air + *
inAirAlphanumberUsed to interpolate between the up, apex, and down in-air * animations.
ikOverlayAlphanumberThe blend between upper body and spline IK versus the + *
ikOverlayAlphanumberThe blend between upper body and spline IK versus the * underlying animation
headPosition{@link Vec3}The desired position of the Head joint in + *
headPosition{@link Vec3}The desired position of the Head joint in * rig coordinates.
headRotation{@link Quat}The desired orientation of the Head joint in + *
headRotation{@link Quat}The desired orientation of the Head joint in * rig coordinates.
headType{@link MyAvatar.IKTargetType|IKTargetType}The type of IK used for the + *
headType{@link MyAvatar.IKTargetType|IKTargetType}The type of IK used for the * head.
headWeightnumberHow strongly the head chain blends with the other IK + *
headWeightnumberHow strongly the head chain blends with the other IK * chains.
leftHandPosition{@link Vec3}The desired position of the LeftHand + *
leftHandPosition{@link Vec3}The desired position of the LeftHand * joint in rig coordinates.
leftHandRotation{@link Quat}The desired orientation of the LeftHand + *
leftHandRotation{@link Quat}The desired orientation of the LeftHand * joint in rig coordinates.
leftHandType{@link MyAvatar.IKTargetType|IKTargetType}The type of IK used for the + *
leftHandType{@link MyAvatar.IKTargetType|IKTargetType}The type of IK used for the * left arm.
leftHandPoleVectorEnabledbooleanWhen true, the elbow angle is - * controlled by the rightHandPoleVector property value. Otherwise the elbow direction comes from the + *
leftHandPoleVectorEnabledbooleanWhen true, the elbow angle is + * controlled by the rightHandPoleVector property value. Otherwise the elbow direction comes from the * underlying animation.
leftHandPoleReferenceVector{@link Vec3}The direction of the elbow in the local + *
leftHandPoleReferenceVector{@link Vec3}The direction of the elbow in the local * coordinate system of the elbow.
leftHandPoleVector{@link Vec3}The direction the elbow should point in rig + *
leftHandPoleVector{@link Vec3}The direction the elbow should point in rig * coordinates.
rightHandPosition{@link Vec3}The desired position of the RightHand * joint in rig coordinates.
rightHandRotation{@link Quat}The desired orientation of the + *
rightHandRotation{@link Quat}The desired orientation of the * RightHand joint in rig coordinates.
rightHandType{@link MyAvatar.IKTargetType|IKTargetType}The type of IK used for + *
rightHandType{@link MyAvatar.IKTargetType|IKTargetType}The type of IK used for * the right arm.
rightHandPoleVectorEnabledbooleanWhen true, the elbow angle is - * controlled by the rightHandPoleVector property value. Otherwise the elbow direction comes from the + *
rightHandPoleVectorEnabledbooleanWhen true, the elbow angle is + * controlled by the rightHandPoleVector property value. Otherwise the elbow direction comes from the * underlying animation.
rightHandPoleReferenceVector{@link Vec3}The direction of the elbow in the local + *
rightHandPoleReferenceVector{@link Vec3}The direction of the elbow in the local * coordinate system of the elbow.
rightHandPoleVector{@link Vec3}The direction the elbow should point in rig + *
rightHandPoleVector{@link Vec3}The direction the elbow should point in rig * coordinates.
leftFootIKEnabledbooleantrue if IK is enabled for the left + *
leftFootIKEnabledbooleantrue if IK is enabled for the left * foot.
rightFootIKEnabledbooleantrue if IK is enabled for the right + *
rightFootIKEnabledbooleantrue if IK is enabled for the right * foot.
leftFootIKPositionVarstringThe name of the source for the desired position + *
leftFootIKPositionVarstringThe name of the source for the desired position * of the LeftFoot joint. If not set, the foot rotation of the underlying animation will be used.
leftFootIKRotationVarstringThe name of the source for the desired rotation * of the LeftFoot joint. If not set, the foot rotation of the underlying animation will be used.
leftFootPoleVectorEnabledbooleanWhen true, the knee angle is - * controlled by the leftFootPoleVector property value. Otherwise the knee direction comes from the + *
leftFootPoleVectorEnabledbooleanWhen true, the knee angle is + * controlled by the leftFootPoleVector property value. Otherwise the knee direction comes from the * underlying animation.
leftFootPoleVector{@link Vec3}The direction the knee should face in rig + *
leftFootPoleVector{@link Vec3}The direction the knee should face in rig * coordinates.
rightFootIKPositionVarstringThe name of the source for the desired position + *
rightFootIKPositionVarstringThe name of the source for the desired position * of the RightFoot joint. If not set, the foot rotation of the underlying animation will be used.
rightFootIKRotationVarstringThe name of the source for the desired rotation * of the RightFoot joint. If not set, the foot rotation of the underlying animation will be used.
rightFootPoleVectorEnabledbooleanWhen true, the knee angle is - * controlled by the rightFootPoleVector property value. Otherwise the knee direction comes from the + *
rightFootPoleVectorEnabledbooleanWhen true, the knee angle is + * controlled by the rightFootPoleVector property value. Otherwise the knee direction comes from the * underlying animation.
rightFootPoleVector{@link Vec3}The direction the knee should face in rig + *
rightFootPoleVector{@link Vec3}The direction the knee should face in rig * coordinates.
isTalkingbooleantrue if the avatar is talking.
solutionSource{@link MyAvatar.AnimIKSolutionSource|AnimIKSolutionSource}Determines the initial conditions of the IK solver.
defaultPoseOverlayAlphanumberControls the blend between the main animation state - * machine and the default pose. Mostly used during full body tracking so that walking & jumping animations do not + *
defaultPoseOverlayAlphanumberControls the blend between the main animation state + * machine and the default pose. Mostly used during full body tracking so that walking & jumping animations do not * affect the IK of the figure.
defaultPoseOverlayBoneSet{@link MyAvatar.AnimOverlayBoneSet|AnimOverlayBoneSet}Specifies which bones will be replace by the source overlay.
hipsType{@link MyAvatar.IKTargetType|IKTargetType}The type of IK used for the + *
hipsType{@link MyAvatar.IKTargetType|IKTargetType}The type of IK used for the * hips.
hipsPosition{@link Vec3}The desired position of Hips joint in rig + *
hipsPosition{@link Vec3}The desired position of Hips joint in rig * coordinates.
hipsRotation{@link Quat}the desired orientation of the Hips joint in + *
hipsRotation{@link Quat}the desired orientation of the Hips joint in * rig coordinates.
spine2Type{@link MyAvatar.IKTargetType|IKTargetType}The type of IK used for the + *
spine2Type{@link MyAvatar.IKTargetType|IKTargetType}The type of IK used for the * Spine2 joint.
spine2Position{@link Vec3}The desired position of the Spine2 joint + *
spine2Position{@link Vec3}The desired position of the Spine2 joint * in rig coordinates.
spine2Rotation{@link Quat}The desired orientation of the Spine2 + *
spine2Rotation{@link Quat}The desired orientation of the Spine2 * joint in rig coordinates.
leftFootIKAlphanumberBlends between full IK for the leg and the underlying * animation.
rightFootIKAlphanumberBlends between full IK for the leg and the underlying * animation.
hipsWeightnumberHow strongly the hips target blends with the IK solution for + *
hipsWeightnumberHow strongly the hips target blends with the IK solution for * other IK chains.
leftHandWeightnumberHow strongly the left hand blends with IK solution of other + *
leftHandWeightnumberHow strongly the left hand blends with IK solution of other * IK chains.
rightHandWeightnumberHow strongly the right hand blends with IK solution of other * IK chains.
spine2WeightnumberHow strongly the spine2 chain blends with the rest of the IK + *
spine2WeightnumberHow strongly the spine2 chain blends with the rest of the IK * solution.
leftHandOverlayAlphanumberUsed to blend in the animated hand gesture poses, such + *
leftHandOverlayAlphanumberUsed to blend in the animated hand gesture poses, such * as point and thumbs up.
leftHandGraspAlphanumberUsed to blend between an open hand and a closed hand. + *
leftHandGraspAlphanumberUsed to blend between an open hand and a closed hand. * Usually changed as you squeeze the trigger of the hand controller.
rightHandOverlayAlphanumberUsed to blend in the animated hand gesture poses, + *
rightHandOverlayAlphanumberUsed to blend in the animated hand gesture poses, * such as point and thumbs up.
rightHandGraspAlphanumberUsed to blend between an open hand and a closed hand. + *
rightHandGraspAlphanumberUsed to blend between an open hand and a closed hand. * Usually changed as you squeeze the trigger of the hand controller.
isLeftIndexPointbooleantrue if the left hand should be * pointing.
isLeftThumbRaisebooleantrue if the left hand should be + *
isLeftThumbRaisebooleantrue if the left hand should be * thumbs-up.
isLeftIndexPointAndThumbRaisebooleantrue if the left hand should be + *
isLeftIndexPointAndThumbRaisebooleantrue if the left hand should be * pointing and thumbs-up.
isLeftHandGraspbooleantrue if the left hand should be at rest, + *
isLeftHandGraspbooleantrue if the left hand should be at rest, * grasping the controller.
isRightIndexPointbooleantrue if the right hand should be * pointing.
isRightThumbRaisebooleantrue if the right hand should be + *
isRightThumbRaisebooleantrue if the right hand should be * thumbs-up.
isRightIndexPointAndThumbRaisebooleantrue if the right hand should + *
isRightIndexPointAndThumbRaisebooleantrue if the right hand should * be pointing and thumbs-up.
isRightHandGraspbooleantrue if the right hand should be at rest, + *
isRightHandGraspbooleantrue if the right hand should be at rest, * grasping the controller.
Create a Web entity displaying at 1920 x 1080 resolution.
* @@ -1338,7 +1338,7 @@ void ScriptEngine::run() { emit finished(_fileNameString, qSharedPointerCast(sharedFromThis())); - // Don't leave our local-file-access flag laying around, reset it to false when the scriptengine + // Don't leave our local-file-access flag laying around, reset it to false when the scriptengine // thread is finished hifi::scripting::setLocalAccessSafeThread(false); _isRunning = false; @@ -1852,7 +1852,7 @@ QScriptValue ScriptEngine::require(const QString& moduleId) { // modules get cached in `Script.require.cache` and (similar to Node.js) users can access it // to inspect particular entries and invalidate them by deleting the key: // `delete Script.require.cache[Script.require.resolve(moduleId)];` - + // Check to see if we should invalidate the cache based on a user setting. Setting::Handle getCachebustSetting {"cachebustScriptRequire", false }; @@ -2390,25 +2390,25 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co // Entity Script Whitelist toggle check. Setting::Handle whitelistEnabled {"private/whitelistEnabled", false }; - + if (!whitelistEnabled.get()) { passList = true; } - + // Pull SAFEURLS from the Interface.JSON settings. QVariant raw = Setting::Handle("private/settingsSafeURLS").get(); QStringList settingsSafeURLS = raw.toString().trimmed().split(QRegExp("\\s*[,\r\n]+\\s*"), Qt::SkipEmptyParts); safeURLPrefixes += settingsSafeURLS; // END Pull SAFEURLS from the Interface.JSON settings. - + // Get current domain whitelist bypass, in case an entire domain is whitelisted. QString currentDomain = DependencyManager::get()->getDomainURL().host(); - + QString domainSafeIP = nodeList->getDomainHandler().getHostname(); QString domainSafeURL = URL_SCHEME_VIRCADIA + "://" + currentDomain; for (const auto& str : safeURLPrefixes) { if (domainSafeURL.startsWith(str) || domainSafeIP.startsWith(str)) { - qCDebug(scriptengine) << whitelistPrefix << "Whitelist Bypassed, entire domain is whitelisted. Current Domain Host: " + qCDebug(scriptengine) << whitelistPrefix << "Whitelist Bypassed, entire domain is whitelisted. Current Domain Host: " << nodeList->getDomainHandler().getHostname() << "Current Domain: " << currentDomain; passList = true; diff --git a/libraries/script-engine/src/WheelEvent.cpp b/libraries/script-engine/src/WheelEvent.cpp index 565c2ddb501..690d65847ba 100644 --- a/libraries/script-engine/src/WheelEvent.cpp +++ b/libraries/script-engine/src/WheelEvent.cpp @@ -58,15 +58,15 @@ WheelEvent::WheelEvent(const QWheelEvent& event) { * @typedef {object} WheelEvent * @property {number} x - Integer x-coordinate of the event on the Interface window or HMD HUD. * @property {number} y - Integer y-coordinate of the event on the Interface window or HMD HUD. - * @property {number} delta - Integer number indicating the direction and speed to scroll: positive numbers to scroll up, and + * @property {number} delta - Integer number indicating the direction and speed to scroll: positive numbers to scroll up, and * negative numers to scroll down. - * @property {string} orientation - The orientation of the wheel: "VERTICAL" for a typical mouse; + * @property {string} orientation - The orientation of the wheel: "VERTICAL" for a typical mouse; * "HORIZONTAL" for a "horizontal" wheel. - * @property {boolean} isLeftButton - true if the left button was pressed when the event was generated, otherwise + * @property {boolean} isLeftButton - true if the left button was pressed when the event was generated, otherwise * false. - * @property {boolean} isMiddleButton - true if the middle button was pressed when the event was generated, + * @property {boolean} isMiddleButton - true if the middle button was pressed when the event was generated, * otherwise false. - * @property {boolean} isRightButton - true if the right button was pressed when the event was generated, + * @property {boolean} isRightButton - true if the right button was pressed when the event was generated, * otherwise false. * @property {boolean} isShifted - true if the Shift key was pressed when the event was generated, otherwise * false. diff --git a/libraries/shared/src/LogHandler.cpp b/libraries/shared/src/LogHandler.cpp index 098e5e9a801..000d2d5e3b4 100644 --- a/libraries/shared/src/LogHandler.cpp +++ b/libraries/shared/src/LogHandler.cpp @@ -258,6 +258,6 @@ void LogHandler::printRepeatedMessage(int messageID, LogMsgType type, const QMes } else { _repeatedMessageRecords[messageID].repeatString = message; } - + ++_repeatedMessageRecords[messageID].repeatCount; } diff --git a/libraries/shared/src/LogHandler.h b/libraries/shared/src/LogHandler.h index 71df2a4189a..b3a7805848c 100644 --- a/libraries/shared/src/LogHandler.h +++ b/libraries/shared/src/LogHandler.h @@ -95,7 +95,7 @@ class LogHandler : public QObject { } while (false) #define HIFI_FDEBUG(message) HIFI_FCDEBUG((*QLoggingCategory::defaultCategory()), message) - + #define HIFI_FCDEBUG_ID(category, messageID, message) \ do { \ if (category.isDebugEnabled()) { \ diff --git a/libraries/shared/src/SharedUtil.cpp b/libraries/shared/src/SharedUtil.cpp index f14be72a716..e96165576ce 100644 --- a/libraries/shared/src/SharedUtil.cpp +++ b/libraries/shared/src/SharedUtil.cpp @@ -738,7 +738,7 @@ QString formatSecTime(qint64 secs) { QString formatSecondsElapsed(float seconds) { QString result; - const float SECONDS_IN_DAY = 60.0f * 60.0f * 24.0f; + const float SECONDS_IN_DAY = 60.0f * 60.0f * 24.0f; if (seconds > SECONDS_IN_DAY) { float days = floor(seconds / SECONDS_IN_DAY); float rest = seconds - (days * SECONDS_IN_DAY); @@ -978,7 +978,7 @@ bool getProcessorInfo(ProcessorInfo& info) { break; case RelationCache: - // Cache data is in ptr->Cache, one CACHE_DESCRIPTOR structure for each cache. + // Cache data is in ptr->Cache, one CACHE_DESCRIPTOR structure for each cache. Cache = &ptr->Cache; if (Cache->Level == 1) { processorL1CacheCount++; From b01929ee2eb7812524924f3cf7c9f9c199d7f651 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 14:55:48 +0200 Subject: [PATCH 03/41] Replace deprecated toList() with values() --- libraries/networking/src/NodeList.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index 8fb6bf28f22..7cf3e936f69 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -501,7 +501,7 @@ void NodeList::sendDomainServerCheckIn() { // pack our data to send to the domain-server including // the hostname information (so the domain-server can see which place name we came in on) - packetStream << _ownerType.load() << publicSockAddr.getType() << publicSockAddr << localSockAddr.getType() + packetStream << _ownerType.load() << publicSockAddr.getType() << publicSockAddr << localSockAddr.getType() << localSockAddr << _nodeTypesOfInterest.values(); packetStream << DependencyManager::get()->getPlaceName(); From e3f0a6bce155e1786e6fbafc9a18cd2060fa6441 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 14:56:24 +0200 Subject: [PATCH 04/41] Fix operator precedence warning --- libraries/networking/src/NodeList.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index 7cf3e936f69..aeb87c70eea 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -1427,7 +1427,7 @@ bool NodeList::adjustCanRezAvatarEntitiesPermissions(const QJsonObject& domainSe const double CANREZAVATARENTITIES_INTRODUCED_VERSION = 2.5; auto version = domainSettingsObject.value("version"); - if (version.isUndefined() || version.isDouble() && version.toDouble() < CANREZAVATARENTITIES_INTRODUCED_VERSION) { + if (version.isUndefined() || (version.isDouble() && version.toDouble() < CANREZAVATARENTITIES_INTRODUCED_VERSION)) { // On domains without the canRezAvatarEntities permission available, set it to the same as canConnectToDomain. if (permissions.can(NodePermissions::Permission::canConnectToDomain)) { if (!permissions.can(NodePermissions::Permission::canRezAvatarEntities)) { From bb067e11bc853063fe69d1e15ea29352086b303a Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 13:00:36 +0200 Subject: [PATCH 05/41] Replace deprecated Qt code with STL --- interface/src/Bookmarks.cpp | 2 +- libraries/avatars-renderer/src/avatars-renderer/Head.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/interface/src/Bookmarks.cpp b/interface/src/Bookmarks.cpp index 263723ebe01..1ead451cd01 100644 --- a/interface/src/Bookmarks.cpp +++ b/interface/src/Bookmarks.cpp @@ -115,7 +115,7 @@ bool Bookmarks::sortOrder(QAction* a, QAction* b) { void Bookmarks::sortActions(Menu* menubar, MenuWrapper* menu) { QList actions = menu->actions(); - qSort(actions.begin(), actions.end(), sortOrder); + std::sort(actions.begin(), actions.end(), sortOrder); for (QAction* action : menu->actions()) { menu->removeAction(action); } diff --git a/libraries/avatars-renderer/src/avatars-renderer/Head.cpp b/libraries/avatars-renderer/src/avatars-renderer/Head.cpp index 8e6a746f555..a5f6cd2be87 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Head.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Head.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include "Logging.h" #include "Avatar.h" @@ -29,7 +30,7 @@ static void updateFakeCoefficients(float leftBlink, float rightBlink, float brow float jawOpen, float mouth2, float mouth3, float mouth4, QVector& coefficients) { coefficients.resize(std::max((int)coefficients.size(), (int)Blendshapes::BlendshapeCount)); - qFill(coefficients.begin(), coefficients.end(), 0.0f); + std::fill(coefficients.begin(), coefficients.end(), 0.0f); coefficients[(int)Blendshapes::EyeBlink_L] = leftBlink; coefficients[(int)Blendshapes::EyeBlink_R] = rightBlink; coefficients[(int)Blendshapes::BrowsU_C] = browUp; From 94dfef10d3df0466857320291420113575e69331 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 13:01:30 +0200 Subject: [PATCH 06/41] Annotate fall-through --- interface/src/InterfaceDynamicFactory.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/interface/src/InterfaceDynamicFactory.cpp b/interface/src/InterfaceDynamicFactory.cpp index e0d912b252a..d06ff784b39 100644 --- a/interface/src/InterfaceDynamicFactory.cpp +++ b/interface/src/InterfaceDynamicFactory.cpp @@ -30,6 +30,7 @@ EntityDynamicPointer interfaceDynamicFactory(EntityDynamicType type, const QUuid return std::make_shared(id, ownerEntity); case DYNAMIC_TYPE_SPRING: qDebug() << "The 'spring' Action is deprecated. Replacing with 'tractor' Action."; + /* fall-thru */ case DYNAMIC_TYPE_TRACTOR: return std::make_shared(id, ownerEntity); case DYNAMIC_TYPE_HOLD: From 37e3936f737c10ec2c45b70bb2ef803fcc867318 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 13:02:14 +0200 Subject: [PATCH 07/41] Rewrite outputBits without sprintf (deprecated) --- libraries/shared/src/SharedUtil.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/libraries/shared/src/SharedUtil.cpp b/libraries/shared/src/SharedUtil.cpp index e96165576ce..de350cd8ce5 100644 --- a/libraries/shared/src/SharedUtil.cpp +++ b/libraries/shared/src/SharedUtil.cpp @@ -183,19 +183,23 @@ void outputBits(unsigned char byte, QDebug* continuedDebug) { } QString resultString; + QTextStream qts (&resultString); + + qts << "[ "; + qts << qSetFieldWidth(3) << byte << qSetFieldWidth(0); + qts << qSetPadChar('0'); if (isalnum(byte)) { - resultString.sprintf("[ %d (%c): ", byte, byte); + qts << " (" << QString(byte) << ") : "; } else { - resultString.sprintf("[ %d (0x%x): ", byte, byte); - } - debug << qPrintable(resultString); - - for (int i = 0; i < 8; i++) { - resultString.sprintf("%d", byte >> (7 - i) & 1); - debug << qPrintable(resultString); + qts << " (0x" << Qt::hex << qSetFieldWidth(2) << byte << qSetFieldWidth(0) << "): "; } - debug << " ]"; + + qts << Qt::bin << qSetFieldWidth(8) << byte << qSetFieldWidth(0); + qts << " ]"; + + debug.noquote(); + debug << resultString; } int numberOfOnes(unsigned char byte) { From 725fd9aac3d13dd90ce22e57a8500d0fa28f49dc Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 13:03:01 +0200 Subject: [PATCH 08/41] Replace mutex with recursive mutex (deprecated) --- libraries/shared/src/LogHandler.cpp | 5 +++-- libraries/shared/src/LogHandler.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libraries/shared/src/LogHandler.cpp b/libraries/shared/src/LogHandler.cpp index 000d2d5e3b4..50d2d53640a 100644 --- a/libraries/shared/src/LogHandler.cpp +++ b/libraries/shared/src/LogHandler.cpp @@ -28,8 +28,9 @@ #include #include #include +#include -QMutex LogHandler::_mutex(QMutex::Recursive); +QRecursiveMutex LogHandler::_mutex; LogHandler& LogHandler::getInstance() { static LogHandler staticInstance; @@ -148,7 +149,7 @@ void LogHandler::flushRepeatedMessages() { for (int m = 0; m < (int)_repeatedMessageRecords.size(); ++m) { int repeatCount = _repeatedMessageRecords[m].repeatCount; if (repeatCount > 1) { - QString repeatLogMessage = QString().setNum(repeatCount) + " repeated log entries - Last entry: \"" + QString repeatLogMessage = QString().setNum(repeatCount) + " repeated log entries - Last entry: \"" + _repeatedMessageRecords[m].repeatString + "\""; printMessage(LogSuppressed, QMessageLogContext(), repeatLogMessage); _repeatedMessageRecords[m].repeatCount = 0; diff --git a/libraries/shared/src/LogHandler.h b/libraries/shared/src/LogHandler.h index b3a7805848c..d314a4f7c2a 100644 --- a/libraries/shared/src/LogHandler.h +++ b/libraries/shared/src/LogHandler.h @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include @@ -79,7 +79,7 @@ class LogHandler : public QObject { QString repeatString; }; std::vector _repeatedMessageRecords; - static QMutex _mutex; + static QRecursiveMutex _mutex; }; #define HIFI_FCDEBUG(category, message) \ From c3e8350155b15f56485efc6029f347598d872328 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 13:06:42 +0200 Subject: [PATCH 09/41] Replace deprecated qrand --- interface/src/scripting/GooglePolyScriptingInterface.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/interface/src/scripting/GooglePolyScriptingInterface.cpp b/interface/src/scripting/GooglePolyScriptingInterface.cpp index 7507208e277..ba4afaba275 100644 --- a/interface/src/scripting/GooglePolyScriptingInterface.cpp +++ b/interface/src/scripting/GooglePolyScriptingInterface.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include "ScriptEngineLogging.h" @@ -102,9 +103,7 @@ QString GooglePolyScriptingInterface::getModelInfo(const QString& input) { } int GooglePolyScriptingInterface::getRandIntInRange(int length) { - QTime time = QTime::currentTime(); - qsrand((uint)time.msec()); - return qrand() % length; + return QRandomGenerator::global()->bounded(length); } QUrl GooglePolyScriptingInterface::formatURLQuery(const QString& keyword, const QString& category, const QString& format) { From 59ecaf8078bf0d32afde29ca87ca42aa3f6c3172 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 13:08:09 +0200 Subject: [PATCH 10/41] Don't use memcpy with non-trivially-copyable type --- libraries/workload/src/workload/Space.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libraries/workload/src/workload/Space.cpp b/libraries/workload/src/workload/Space.cpp index 5704ba8c4db..c57b8ae3a76 100644 --- a/libraries/workload/src/workload/Space.cpp +++ b/libraries/workload/src/workload/Space.cpp @@ -123,7 +123,9 @@ void Space::categorizeAndGetChanges(std::vector& changes) { uint32_t Space::copyProxyValues(Proxy* proxies, uint32_t numDestProxies) const { std::unique_lock lock(_proxiesMutex); auto numCopied = std::min(numDestProxies, (uint32_t)_proxies.size()); - memcpy(proxies, _proxies.data(), numCopied * sizeof(Proxy)); + for(unsigned int i=0;i Date: Sun, 5 Jun 2022 13:08:51 +0200 Subject: [PATCH 11/41] Remove unused variable --- interface/src/avatar/MyAvatar.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index f9a9f076862..08ed879fffb 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -3918,8 +3918,6 @@ glm::vec3 MyAvatar::scaleMotorSpeed(const glm::vec3 forward, const glm::vec3 rig // Calculate the world-space motor velocity for the avatar. glm::vec3 MyAvatar::calculateScaledDirection() { - CharacterController::State state = _characterController.getState(); - // compute action input // Determine if we're head or controller relative... glm::vec3 forward, right; From 8986dff354d80e234e6a69d8033d9995bfd77df1 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 13:09:13 +0200 Subject: [PATCH 12/41] Fix type range comparison --- interface/src/avatar/MyAvatar.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 08ed879fffb..c40545d0142 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -5738,7 +5738,8 @@ void MyAvatar::FollowHelper::deactivate() { } void MyAvatar::FollowHelper::deactivate(CharacterController::FollowType type) { - assert(static_cast(type) >= 0 && type < CharacterController::FollowType::Count); + int int_type = static_cast(type); + assert(int_type >= 0 && int_type < static_cast(CharacterController::FollowType::Count)); _timeRemaining[(int)type] = 0.0f; } @@ -5746,14 +5747,16 @@ void MyAvatar::FollowHelper::deactivate(CharacterController::FollowType type) { // eg. activate(FollowType::Rotation, true) snaps the FollowHelper's rotation immediately // to the rotation of its _followDesiredBodyTransform. void MyAvatar::FollowHelper::activate(CharacterController::FollowType type, const bool snapFollow) { - assert(static_cast(type) >= 0 && type < CharacterController::FollowType::Count); + int int_type = static_cast(type); + assert(int_type >= 0 && int_type < static_cast(CharacterController::FollowType::Count)); // TODO: Perhaps, the follow time should be proportional to the displacement. _timeRemaining[(int)type] = snapFollow ? CharacterController::FOLLOW_TIME_IMMEDIATE_SNAP : FOLLOW_TIME; } bool MyAvatar::FollowHelper::isActive(CharacterController::FollowType type) const { - assert(static_cast(type) >= 0 && type < CharacterController::FollowType::Count); + int int_type = static_cast(type); + assert(int_type >= 0 && int_type < static_cast(CharacterController::FollowType::Count)); return _timeRemaining[(int)type] > 0.0f; } From 96137e2669d5db9b9b769da30538fd2197d477a9 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 13:10:30 +0200 Subject: [PATCH 13/41] Replace deprecated screenCountChanged event --- interface/src/ui/HMDToolsDialog.cpp | 18 +++++++++--------- interface/src/ui/HMDToolsDialog.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/interface/src/ui/HMDToolsDialog.cpp b/interface/src/ui/HMDToolsDialog.cpp index 3f7ac9f4cc6..d04509efa68 100644 --- a/interface/src/ui/HMDToolsDialog.cpp +++ b/interface/src/ui/HMDToolsDialog.cpp @@ -108,9 +108,11 @@ HMDToolsDialog::HMDToolsDialog(QWidget* parent) : updateUi(); }); + // keep track of changes to the number of screens - connect(QApplication::desktop(), &QDesktopWidget::screenCountChanged, this, &HMDToolsDialog::screenCountChanged); - + connect(qApp, &QGuiApplication::screenAdded, this, &HMDToolsDialog::screenCountChanged); + connect(qApp, &QGuiApplication::screenRemoved, this, &HMDToolsDialog::screenCountChanged); + updateUi(); } @@ -130,14 +132,13 @@ QString HMDToolsDialog::getDebugDetails() const { results += "HMD Screen Name: N/A\n"; } - int desktopPrimaryScreenNumber = QApplication::desktop()->primaryScreen(); - QScreen* desktopPrimaryScreen = QGuiApplication::screens()[desktopPrimaryScreenNumber]; + QScreen* desktopPrimaryScreen = QGuiApplication::primaryScreen(); results += "Desktop's Primary Screen: " + desktopPrimaryScreen->name() + "\n"; results += "Application Primary Screen: " + QGuiApplication::primaryScreen()->name() + "\n"; QScreen* mainWindowScreen = qApp->getWindow()->windowHandle()->screen(); results += "Application Main Window Screen: " + mainWindowScreen->name() + "\n"; - results += "Total Screens: " + QString::number(QApplication::desktop()->screenCount()) + "\n"; + results += "Total Screens: " + QString::number(QGuiApplication::screens().count()) + "\n"; return results; } @@ -196,7 +197,7 @@ void HMDToolsDialog::hideEvent(QHideEvent* event) { centerCursorOnWidget(qApp->getWindow()); } -void HMDToolsDialog::screenCountChanged(int newCount) { +void HMDToolsDialog::screenCountChanged() { int hmdScreenNumber = -1; const auto& displayPlugins = PluginManager::getInstance()->getDisplayPlugins(); for(const auto& dp : displayPlugins) { @@ -256,7 +257,7 @@ void HMDWindowWatcher::windowGeometryChanged(int arg) { void HMDWindowWatcher::windowScreenChanged(QScreen* screen) { // if we have more than one screen, and a known hmdScreen then try to // keep our dialog off of the hmdScreen - if (QApplication::desktop()->screenCount() > 1) { + if (QGuiApplication::screens().count() > 1) { int hmdScreenNumber = _hmdTools->_hmdScreenNumber; // we want to use a local variable here because we are not necesarily in HMD mode if (hmdScreenNumber >= 0) { @@ -283,8 +284,7 @@ void HMDWindowWatcher::windowScreenChanged(QScreen* screen) { betterScreen = lastApplicationScreen; } else { // last, if we can't use the previous screen the use the primary desktop screen - int desktopPrimaryScreenNumber = QApplication::desktop()->primaryScreen(); - QScreen* desktopPrimaryScreen = QGuiApplication::screens()[desktopPrimaryScreenNumber]; + QScreen* desktopPrimaryScreen = QGuiApplication::primaryScreen(); betterScreen = desktopPrimaryScreen; } diff --git a/interface/src/ui/HMDToolsDialog.h b/interface/src/ui/HMDToolsDialog.h index 16ea090d95d..d23aafd23a5 100644 --- a/interface/src/ui/HMDToolsDialog.h +++ b/interface/src/ui/HMDToolsDialog.h @@ -35,7 +35,7 @@ class HMDToolsDialog : public QDialog { public slots: void reject() override; - void screenCountChanged(int newCount); + void screenCountChanged(); protected: virtual void closeEvent(QCloseEvent*) override; // Emits a 'closed' signal when this dialog is closed. From 756e0be24449ae5c9d74de0ba16a1571e6c90e03 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 13:11:08 +0200 Subject: [PATCH 14/41] Replace deprecated QFontMetrics.width() --- interface/src/ui/overlays/TextOverlay.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/src/ui/overlays/TextOverlay.cpp b/interface/src/ui/overlays/TextOverlay.cpp index 16327223982..0ecc2d62873 100644 --- a/interface/src/ui/overlays/TextOverlay.cpp +++ b/interface/src/ui/overlays/TextOverlay.cpp @@ -38,6 +38,6 @@ QSizeF TextOverlay::textSize(const QString& text) const { QFont font(ROBOTO_FONT_FAMILY); font.setPixelSize(18); QFontMetrics fm(font); - QSizeF result = QSizeF(fm.width(text), 18 * lines); - return result; + QSizeF result = QSizeF(fm.horizontalAdvance(text), 18 * lines); + return result; } \ No newline at end of file From f58f0fdff6f93c73c11da6ddbd313d25aca30379 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 13:11:43 +0200 Subject: [PATCH 15/41] Replace QTime with QElapsedTimer (deprecated) --- libraries/animation/src/AnimInverseKinematics.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/animation/src/AnimInverseKinematics.cpp b/libraries/animation/src/AnimInverseKinematics.cpp index e25c84f20a9..4253002114b 100644 --- a/libraries/animation/src/AnimInverseKinematics.cpp +++ b/libraries/animation/src/AnimInverseKinematics.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include "Rig.h" #include "ElbowConstraint.h" @@ -27,7 +28,7 @@ static const int MAX_TARGET_MARKERS = 30; static const float JOINT_CHAIN_INTERP_TIME = 0.5f; -static QTime debounceJointWarningsClock; +static QElapsedTimer debounceJointWarningsClock; static const int JOINT_WARNING_DEBOUNCE_TIME = 30000; // 30 seconds static void lookupJointInfo(const AnimInverseKinematics::JointChainInfo& jointChainInfo, From 8709d3b3b622e229819ebaab2ab9cccbae264ae7 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 13:12:17 +0200 Subject: [PATCH 16/41] Remove unused variable --- libraries/animation/src/Rig.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libraries/animation/src/Rig.cpp b/libraries/animation/src/Rig.cpp index 21b4fbc2c4d..32e44a11818 100644 --- a/libraries/animation/src/Rig.cpp +++ b/libraries/animation/src/Rig.cpp @@ -2761,7 +2761,6 @@ void Rig::initFlow(bool isActive) { float Rig::getUnscaledEyeHeight() const { // Normally the model offset transform will contain the avatar scale factor, we explicitly remove it here. AnimPose modelOffsetWithoutAvatarScale(glm::vec3(1.0f), getModelOffsetPose().rot(), getModelOffsetPose().trans()); - AnimPose geomToRigWithoutAvatarScale = modelOffsetWithoutAvatarScale * getGeometryOffsetPose(); // Factor to scale distances in the geometry frame into the unscaled rig frame. float scaleFactor = GetScaleFactorGeometryToUnscaledRig(); From e0fc1c8a7b3030c407455d1fb0d7ef37877b3674 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 13:13:40 +0200 Subject: [PATCH 17/41] Ensure memory is cleared to make compiler happy --- libraries/audio/src/Sound.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/audio/src/Sound.cpp b/libraries/audio/src/Sound.cpp index 7c5dd3813bc..385ebf66729 100644 --- a/libraries/audio/src/Sound.cpp +++ b/libraries/audio/src/Sound.cpp @@ -44,7 +44,7 @@ AudioDataPointer AudioData::make(uint32_t numSamples, uint32_t numChannels, const size_t memorySize = sizeof(AudioData) + bufferSize; // Allocate the memory for the audio data object and the buffer - void* memory = ::malloc(memorySize); + void* memory = ::calloc(1, memorySize); auto audioData = reinterpret_cast(memory); auto buffer = reinterpret_cast(audioData + 1); assert(((char*)buffer - (char*)audioData) == sizeof(AudioData)); From b2d7f8101d661ea8a4bbf1e34d65453f3e2bf5d7 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 13:14:09 +0200 Subject: [PATCH 18/41] Fix new[]/delete mismatch warning --- libraries/graphics/src/graphics/Geometry.cpp | 6 +++--- libraries/script-engine/src/ModelScriptingInterface.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libraries/graphics/src/graphics/Geometry.cpp b/libraries/graphics/src/graphics/Geometry.cpp index 5ac3fc0d5a5..bc89dbfc3db 100755 --- a/libraries/graphics/src/graphics/Geometry.cpp +++ b/libraries/graphics/src/graphics/Geometry.cpp @@ -175,7 +175,7 @@ graphics::MeshPointer Mesh::map(std::function vertexFunc, gpu::BufferView::Index numColors = (gpu::BufferView::Index)colorsBufferView.getNumElements(); gpu::Resource::Size colorSize = numColors * sizeof(glm::vec3); - std::unique_ptr resultColorData{ new unsigned char[colorSize] }; + std::unique_ptr resultColorData{ new unsigned char[colorSize] }; unsigned char* colorDataCursor = resultColorData.get(); auto colorAttribute = vertexFormat->getAttribute(attributeTypeColor); @@ -200,7 +200,7 @@ graphics::MeshPointer Mesh::map(std::function vertexFunc, const gpu::BufferView& normalsBufferView = getAttributeBuffer(attributeTypeNormal); gpu::BufferView::Index numNormals = (gpu::BufferView::Index)normalsBufferView.getNumElements(); gpu::Resource::Size normalSize = numNormals * sizeof(glm::vec3); - std::unique_ptr resultNormalData{ new unsigned char[normalSize] }; + std::unique_ptr resultNormalData{ new unsigned char[normalSize] }; unsigned char* normalDataCursor = resultNormalData.get(); auto normalAttribute = vertexFormat->getAttribute(attributeTypeNormal); @@ -226,7 +226,7 @@ graphics::MeshPointer Mesh::map(std::function vertexFunc, const gpu::BufferView& indexBufferView = getIndexBuffer(); gpu::BufferView::Index numIndexes = (gpu::BufferView::Index)getNumIndices(); gpu::Resource::Size indexSize = numIndexes * sizeof(uint32_t); - std::unique_ptr resultIndexData{ new unsigned char[indexSize] }; + std::unique_ptr resultIndexData{ new unsigned char[indexSize] }; unsigned char* indexDataCursor = resultIndexData.get(); for (gpu::BufferView::Index i = 0; i < numIndexes; i++) { diff --git a/libraries/script-engine/src/ModelScriptingInterface.cpp b/libraries/script-engine/src/ModelScriptingInterface.cpp index 499678ff06a..82ad8081b1c 100644 --- a/libraries/script-engine/src/ModelScriptingInterface.cpp +++ b/libraries/script-engine/src/ModelScriptingInterface.cpp @@ -60,19 +60,19 @@ QScriptValue ModelScriptingInterface::appendMeshes(MeshProxyList in) { // alloc the resulting mesh gpu::Resource::Size combinedVertexSize = totalVertexCount * sizeof(glm::vec3); - std::unique_ptr combinedVertexData{ new unsigned char[combinedVertexSize] }; + std::unique_ptr combinedVertexData{ new unsigned char[combinedVertexSize] }; unsigned char* combinedVertexDataCursor = combinedVertexData.get(); gpu::Resource::Size combinedColorSize = totalColorCount * sizeof(glm::vec3); - std::unique_ptr combinedColorData{ new unsigned char[combinedColorSize] }; + std::unique_ptr combinedColorData{ new unsigned char[combinedColorSize] }; unsigned char* combinedColorDataCursor = combinedColorData.get(); gpu::Resource::Size combinedNormalSize = totalNormalCount * sizeof(glm::vec3); - std::unique_ptr combinedNormalData{ new unsigned char[combinedNormalSize] }; + std::unique_ptr combinedNormalData{ new unsigned char[combinedNormalSize] }; unsigned char* combinedNormalDataCursor = combinedNormalData.get(); gpu::Resource::Size combinedIndexSize = totalIndexCount * sizeof(uint32_t); - std::unique_ptr combinedIndexData{ new unsigned char[combinedIndexSize] }; + std::unique_ptr combinedIndexData{ new unsigned char[combinedIndexSize] }; unsigned char* combinedIndexDataCursor = combinedIndexData.get(); uint32_t indexStartOffset { 0 }; From 492ccc43c4135cc9d3ec5d7cc71901bd1d667721 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 13:15:39 +0200 Subject: [PATCH 19/41] Replace deprecated qVariantFromValue --- libraries/script-engine/src/ScriptEngine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index 3bbe72822d8..18747ab56be 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -2120,7 +2120,7 @@ void ScriptEngine::updateEntityScriptStatus(const EntityItemID& entityID, const } QVariant ScriptEngine::cloneEntityScriptDetails(const EntityItemID& entityID) { - static const QVariant NULL_VARIANT { qVariantFromValue((QObject*)nullptr) }; + static const QVariant NULL_VARIANT = QVariant::fromValue(nullptr); QVariantMap map; if (entityID.isNull()) { // TODO: find better way to report JS Error across thread/process boundaries From db2d5cbbb993494cc07a71223e2205f713f722cc Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 13:17:36 +0200 Subject: [PATCH 20/41] Fix deprecated int to flags conversion --- libraries/script-engine/src/ArrayBufferClass.cpp | 2 +- libraries/script-engine/src/ArrayBufferViewClass.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/script-engine/src/ArrayBufferClass.cpp b/libraries/script-engine/src/ArrayBufferClass.cpp index a1826bc0872..4844428eb4c 100644 --- a/libraries/script-engine/src/ArrayBufferClass.cpp +++ b/libraries/script-engine/src/ArrayBufferClass.cpp @@ -122,7 +122,7 @@ QScriptClass::QueryFlags ArrayBufferClass::queryProperty(const QScriptValue& obj // if the property queried is byteLength, only handle read access return flags &= HandlesReadAccess; } - return 0; // No access + return QScriptClass::QueryFlags(); // No access } QScriptValue ArrayBufferClass::property(const QScriptValue& object, diff --git a/libraries/script-engine/src/ArrayBufferViewClass.cpp b/libraries/script-engine/src/ArrayBufferViewClass.cpp index cf776ed8340..64cbcc53523 100644 --- a/libraries/script-engine/src/ArrayBufferViewClass.cpp +++ b/libraries/script-engine/src/ArrayBufferViewClass.cpp @@ -29,7 +29,7 @@ QScriptClass::QueryFlags ArrayBufferViewClass::queryProperty(const QScriptValue& if (name == _bufferName || name == _byteOffsetName || name == _byteLengthName) { return flags &= HandlesReadAccess; // Only keep read access flags } - return 0; // No access + return QScriptClass::QueryFlags(); // No access } QScriptValue ArrayBufferViewClass::property(const QScriptValue& object, From f3ef7a4f837fe6001f115c43b7596ea90ae4857a Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 13:19:06 +0200 Subject: [PATCH 21/41] Fix operator precedence warning --- libraries/networking/src/udt/NetworkSocket.cpp | 2 +- libraries/networking/src/webrtc/WebRTCDataChannels.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/networking/src/udt/NetworkSocket.cpp b/libraries/networking/src/udt/NetworkSocket.cpp index 7c7ab41ddbc..179abe9f783 100644 --- a/libraries/networking/src/udt/NetworkSocket.cpp +++ b/libraries/networking/src/udt/NetworkSocket.cpp @@ -193,7 +193,7 @@ qint64 NetworkSocket::readDatagram(char* data, qint64 maxSize, SockAddr* sockAdd #if defined(WEBRTC_DATA_CHANNELS) // Read per preceding pendingDatagramSize() if any, otherwise alternate socket types. if (_pendingDatagramSizeSocketType == SocketType::UDP - || _pendingDatagramSizeSocketType == SocketType::Unknown && _lastSocketTypeRead == SocketType::WebRTC) { + || (_pendingDatagramSizeSocketType == SocketType::Unknown && _lastSocketTypeRead == SocketType::WebRTC)) { _lastSocketTypeRead = SocketType::UDP; _pendingDatagramSizeSocketType = SocketType::Unknown; if (sockAddr) { diff --git a/libraries/networking/src/webrtc/WebRTCDataChannels.cpp b/libraries/networking/src/webrtc/WebRTCDataChannels.cpp index 610afc46688..5da937c2116 100644 --- a/libraries/networking/src/webrtc/WebRTCDataChannels.cpp +++ b/libraries/networking/src/webrtc/WebRTCDataChannels.cpp @@ -508,8 +508,8 @@ void WebRTCDataChannels::onSignalingMessage(const QJsonObject& message) { auto data = message.value("data").isObject() ? message.value("data").toObject() : QJsonObject(); auto from = message.value("from").toString(); auto to = NodeType::fromChar(message.value("to").toString().at(0)); - if (!DATA_CHANNEL_ID_REGEX.match(from).hasMatch() || to == NodeType::Unassigned - || !data.contains("description") && !data.contains("candidate")) { + if (!DATA_CHANNEL_ID_REGEX.match(from).hasMatch() || to == NodeType::Unassigned + || (!data.contains("description") && !data.contains("candidate"))) { qCWarning(networking_webrtc) << "Invalid or unexpected signaling message:" << QJsonDocument(message).toJson(QJsonDocument::Compact).left(MAX_DEBUG_DETAIL_LENGTH); return; From b809a13681089b2c100c624c2fb3580c8817a813 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 13:19:54 +0200 Subject: [PATCH 22/41] Replace deprecated error() signal --- libraries/networking/src/AtpReply.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/networking/src/AtpReply.cpp b/libraries/networking/src/AtpReply.cpp index 3ec9b23f5f7..6bcf74d7255 100644 --- a/libraries/networking/src/AtpReply.cpp +++ b/libraries/networking/src/AtpReply.cpp @@ -78,7 +78,7 @@ void AtpReply::handleRequestFinish() { setHeader(QNetworkRequest::ContentLengthHeader, QVariant(_content.size())); if (error() != NoError) { - emit error(error()); + emit errorOccurred(error()); } setFinished(true); From e84481a00bf77569099caed65727e88ca607c204 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 13:20:50 +0200 Subject: [PATCH 23/41] Fix StrongRef warning --- libraries/model-networking/src/model-networking/ModelCache.cpp | 2 +- libraries/networking/src/ResourceCache.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/model-networking/src/model-networking/ModelCache.cpp b/libraries/model-networking/src/model-networking/ModelCache.cpp index b4115fd36a8..738c61874f4 100644 --- a/libraries/model-networking/src/model-networking/ModelCache.cpp +++ b/libraries/model-networking/src/model-networking/ModelCache.cpp @@ -119,7 +119,7 @@ void GeometryReader::run() { QThread::currentThread()->setPriority(originalPriority); }); - if (!_resource.data()) { + if (!_resource.toStrongRef().data()) { return; } diff --git a/libraries/networking/src/ResourceCache.cpp b/libraries/networking/src/ResourceCache.cpp index 8c706b2e018..41cf7cfe5fe 100644 --- a/libraries/networking/src/ResourceCache.cpp +++ b/libraries/networking/src/ResourceCache.cpp @@ -97,7 +97,7 @@ void ResourceCacheSharedItems::removeRequest(QWeakPointer resource) { for (int i = 0; i < _loadingRequests.size();) { auto request = _loadingRequests.at(i); // Clear our resource and any freed resources - if (!request || request.data() == resource.data()) { + if (!request || request.toStrongRef().data() == resource.toStrongRef().data()) { _loadingRequests.removeAt(i); continue; } From 7c0415a9fca659e75c9638dfe06745dac8b08f7a Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 13:21:18 +0200 Subject: [PATCH 24/41] Fix signed/unsigned comparison warning --- libraries/controllers/src/controllers/UserInputMapper.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/controllers/src/controllers/UserInputMapper.cpp b/libraries/controllers/src/controllers/UserInputMapper.cpp index 6a46dea7d94..dc37798fc5d 100755 --- a/libraries/controllers/src/controllers/UserInputMapper.cpp +++ b/libraries/controllers/src/controllers/UserInputMapper.cpp @@ -1256,7 +1256,7 @@ float UserInputMapper::getActionState(Action action) const { Locker locker(_lock); int index = toInt(action); - if (index >= 0 && index < _actionStates.size()) { + if (index >= 0 && (unsigned int)index < _actionStates.size()) { return _actionStates[index]; } @@ -1268,7 +1268,7 @@ bool UserInputMapper::getActionStateValid(Action action) const { Locker locker(_lock); int index = toInt(action); - if (index >= 0 && index < _actionStatesValid.size()) { + if (index >= 0 && (unsigned int)index < _actionStatesValid.size()) { return _actionStatesValid[index]; } From 6a9a1e102c18df2b22da0e9fc10b245445ab4f17 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 13:21:46 +0200 Subject: [PATCH 25/41] Fix writing to buffer out of bounds warning --- libraries/entities/src/EntityItemProperties.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 2f92cf1eb78..02a21cfd92c 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -3977,24 +3977,16 @@ QVector EntityItemProperties::unpackStrokeColors(const QByteArray& strokeC // edit packet sender... bool EntityItemProperties::encodeEraseEntityMessage(const EntityItemID& entityItemID, QByteArray& buffer) { - char* copyAt = buffer.data(); uint16_t numberOfIds = 1; // only one entity ID in this message - int outputLength = 0; - if (buffer.size() < (int)(sizeof(numberOfIds) + NUM_BYTES_RFC4122_UUID)) { qCDebug(entities) << "ERROR - encodeEraseEntityMessage() called with buffer that is too small!"; return false; } - memcpy(copyAt, &numberOfIds, sizeof(numberOfIds)); - copyAt += sizeof(numberOfIds); - outputLength = sizeof(numberOfIds); - - memcpy(copyAt, entityItemID.toRfc4122().constData(), NUM_BYTES_RFC4122_UUID); - outputLength += NUM_BYTES_RFC4122_UUID; - - buffer.resize(outputLength); + buffer.resize(0); + buffer.append(reinterpret_cast(&numberOfIds), sizeof(numberOfIds)); + buffer.append(entityItemID.toRfc4122().constData(), NUM_BYTES_RFC4122_UUID); return true; } From 66f70e40ec761eeb138d050dc167f5aaff27f229 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 13:22:55 +0200 Subject: [PATCH 26/41] Replace use of deprecated sprintf --- libraries/octree/src/OctreeElement.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libraries/octree/src/OctreeElement.cpp b/libraries/octree/src/OctreeElement.cpp index b94d0d57e17..c4e66c81556 100644 --- a/libraries/octree/src/OctreeElement.cpp +++ b/libraries/octree/src/OctreeElement.cpp @@ -443,10 +443,13 @@ void OctreeElement::printDebugDetails(const char* label) const { } QString resultString; - resultString.sprintf("%s - Voxel at corner=(%f,%f,%f) size=%f\n isLeaf=%s isDirty=%s shouldRender=%s\n children=", label, - (double)_cube.getCorner().x, (double)_cube.getCorner().y, (double)_cube.getCorner().z, - (double)_cube.getScale(), - debug::valueOf(isLeaf()), debug::valueOf(isDirty()), debug::valueOf(getShouldRender())); + qCDebug(octree).noquote() << label + << QString(" - Voxel at corner=(%1,%2,%3)").arg((double)_cube.getCorner().x, (double)_cube.getCorner().y, (double)_cube.getCorner().z) + << "size=" << (double)_cube.getScale() + << " isLeaf=" << debug::valueOf(isLeaf()) + << " isDirty=" << debug::valueOf(isDirty()) + << " shouldRender=" << debug::valueOf(getShouldRender()); + qCDebug(octree).nospace() << resultString; } From 9ac338ec7ad31417720db5e74308ff51a8dadc44 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 13:23:25 +0200 Subject: [PATCH 27/41] Replace usage of deprecated QWheelEvent members --- libraries/qml/src/qml/OffscreenSurface.cpp | 10 +++++++--- libraries/script-engine/src/WheelEvent.cpp | 15 +++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/libraries/qml/src/qml/OffscreenSurface.cpp b/libraries/qml/src/qml/OffscreenSurface.cpp index a5ac7348977..097d8d48d5d 100644 --- a/libraries/qml/src/qml/OffscreenSurface.cpp +++ b/libraries/qml/src/qml/OffscreenSurface.cpp @@ -173,9 +173,13 @@ bool OffscreenSurface::eventFilter(QObject* originalDestination, QEvent* event) case QEvent::Wheel: { QWheelEvent* wheelEvent = static_cast(event); - QPointF transformedPos = mapToVirtualScreen(wheelEvent->pos()); - QWheelEvent mappedEvent(transformedPos, wheelEvent->delta(), wheelEvent->buttons(), wheelEvent->modifiers(), - wheelEvent->orientation()); + QPointF transformedPos = mapToVirtualScreen(wheelEvent->position()); + + + QWheelEvent mappedEvent(transformedPos, wheelEvent->globalPosition(), wheelEvent->pixelDelta(), wheelEvent->angleDelta(), + wheelEvent->buttons(), wheelEvent->modifiers(), wheelEvent->phase(), + wheelEvent->inverted(), wheelEvent->source()); + mappedEvent.ignore(); if (QCoreApplication::sendEvent(_sharedObject->getWindow(), &mappedEvent)) { return mappedEvent.isAccepted(); diff --git a/libraries/script-engine/src/WheelEvent.cpp b/libraries/script-engine/src/WheelEvent.cpp index 690d65847ba..4d7a2bc4799 100644 --- a/libraries/script-engine/src/WheelEvent.cpp +++ b/libraries/script-engine/src/WheelEvent.cpp @@ -27,25 +27,24 @@ WheelEvent::WheelEvent() : isMeta(false), isAlt(false) { - + } WheelEvent::WheelEvent(const QWheelEvent& event) { - x = event.x(); - y = event.y(); - - delta = event.delta(); - if (event.orientation() == Qt::Horizontal) { + x = event.position().x(); + y = event.position().y(); + + if (event.angleDelta().x() != 0) { orientation = "HORIZONTAL"; } else { orientation = "VERTICAL"; } - + // button pressed state isLeftButton = (event.buttons().testFlag(Qt::LeftButton)); isRightButton = (event.buttons().testFlag(Qt::RightButton)); isMiddleButton = (event.buttons().testFlag(Qt::MiddleButton)); - + // keyboard modifiers isShifted = event.modifiers().testFlag(Qt::ShiftModifier); isMeta = event.modifiers().testFlag(Qt::MetaModifier); From 900f16281c1ebd19458f8c68227f8a5ebfb48d9a Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 13:24:16 +0200 Subject: [PATCH 28/41] Use const reference (warning) --- .../controllers/src/controllers/InputRecorder.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/controllers/src/controllers/InputRecorder.cpp b/libraries/controllers/src/controllers/InputRecorder.cpp index 49ac0920865..0bd447ac5f5 100644 --- a/libraries/controllers/src/controllers/InputRecorder.cpp +++ b/libraries/controllers/src/controllers/InputRecorder.cpp @@ -166,12 +166,12 @@ namespace controller { QJsonObject data; data["frameCount"] = _framesRecorded; data["version"] = "0.0"; - + QJsonArray actionArrayList; QJsonArray poseArrayList; - for(const ActionStates actionState: _actionStateList) { + for(const ActionStates& actionState: _actionStateList) { QJsonArray actionArray; - for (const auto action: actionState) { + for (const auto& action: actionState) { QJsonObject actionJson; actionJson["name"] = action.first; actionJson["value"] = action.second; @@ -180,9 +180,9 @@ namespace controller { actionArrayList.append(actionArray); } - for (const PoseStates poseState: _poseStateList) { + for (const PoseStates& poseState: _poseStateList) { QJsonArray poseArray; - for (const auto pose: poseState) { + for (const auto& pose: poseState) { QJsonObject poseJson; poseJson["name"] = pose.first; poseJson["pose"] = poseToJsonObject(pose.second); From 7d8aa04359a2ff98bc8dc1293c4816e11626fd14 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 13:39:33 +0200 Subject: [PATCH 29/41] Fix writing to buffer out of bounds warning (another one) --- libraries/entities/src/EntityItemProperties.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 02a21cfd92c..dd56bb9c07b 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -3992,22 +3992,14 @@ bool EntityItemProperties::encodeEraseEntityMessage(const EntityItemID& entityIt } bool EntityItemProperties::encodeCloneEntityMessage(const EntityItemID& entityIDToClone, const EntityItemID& newEntityID, QByteArray& buffer) { - char* copyAt = buffer.data(); - int outputLength = 0; - if (buffer.size() < (int)(NUM_BYTES_RFC4122_UUID * 2)) { qCDebug(entities) << "ERROR - encodeCloneEntityMessage() called with buffer that is too small!"; return false; } - memcpy(copyAt, entityIDToClone.toRfc4122().constData(), NUM_BYTES_RFC4122_UUID); - copyAt += NUM_BYTES_RFC4122_UUID; - outputLength += NUM_BYTES_RFC4122_UUID; - - memcpy(copyAt, newEntityID.toRfc4122().constData(), NUM_BYTES_RFC4122_UUID); - outputLength += NUM_BYTES_RFC4122_UUID; - - buffer.resize(outputLength); + buffer.resize(0); + buffer.append(entityIDToClone.toRfc4122().constData(), NUM_BYTES_RFC4122_UUID); + buffer.append(newEntityID.toRfc4122().constData(), NUM_BYTES_RFC4122_UUID); return true; } From b0d8414aee9dcfbb792df20e33783fd66c486f7a Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 5 Jun 2022 14:21:56 +0200 Subject: [PATCH 30/41] =?UTF-8?q?Fix=20'warning:=20=E2=80=98size=5Ft=20str?= =?UTF-8?q?len(const=20char*)=E2=80=99=20reading=201=20or=20more=20bytes?= =?UTF-8?q?=20from=20a=20region=20of=20size=200=20[-Wstringop-overread]'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libraries/networking/src/SockAddr.cpp | 6 +++--- libraries/shared/src/SettingHelpers.cpp | 13 +++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/libraries/networking/src/SockAddr.cpp b/libraries/networking/src/SockAddr.cpp index 8dbbf39ec45..29fbde39349 100644 --- a/libraries/networking/src/SockAddr.cpp +++ b/libraries/networking/src/SockAddr.cpp @@ -83,7 +83,7 @@ void SockAddr::swap(SockAddr& otherSockAddr) { swap(_socketType, otherSockAddr._socketType); swap(_address, otherSockAddr._address); swap(_port, otherSockAddr._port); - + // Swap objects name auto temp = otherSockAddr.objectName(); otherSockAddr.setObjectName(objectName()); @@ -135,8 +135,8 @@ bool SockAddr::hasPrivateAddress() const { QDebug operator<<(QDebug debug, const SockAddr& sockAddr) { debug.nospace() << (sockAddr._socketType != SocketType::Unknown - ? (SocketTypeToString::socketTypeToString(sockAddr._socketType) + " ").toLocal8Bit().constData() : "") - << sockAddr._address.toString().toLocal8Bit().constData() << ":" << sockAddr._port; + ? (SocketTypeToString::socketTypeToString(sockAddr._socketType) + " ") : QString("")) + << sockAddr._address.toString() << ":" << sockAddr._port; return debug.space(); } diff --git a/libraries/shared/src/SettingHelpers.cpp b/libraries/shared/src/SettingHelpers.cpp index c6b8ac8f831..d8fcc6b6de3 100644 --- a/libraries/shared/src/SettingHelpers.cpp +++ b/libraries/shared/src/SettingHelpers.cpp @@ -164,7 +164,12 @@ QJsonDocument variantMapToJsonDocument(const QSettings::SettingsMap& map) { case QVariant::ByteArray: { QByteArray a = variant.toByteArray(); QString result = QLatin1String("@ByteArray("); - result += QString::fromLatin1(a.constData(), a.size()); + int sz = a.size(); + if ( sz > 0 ) { + // Work around 'warning: ‘size_t strlen(const char*)’ reading 1 or more bytes from a region of size 0 [-Wstringop-overread]' + // size() indeed could be zero bytes, so make sure that can't be the case. + result += QString::fromLatin1(a.constData(), sz); + } result += QLatin1Char(')'); object.insert(key, result); break; @@ -213,7 +218,11 @@ QJsonDocument variantMapToJsonDocument(const QSettings::SettingsMap& map) { } QString result = QLatin1String("@Variant("); - result += QString::fromLatin1(array.constData(), array.size()); + int sz = array.size(); + if ( sz > 0 ) { + // See comment in the case handling QVariant::ByteArray + result += QString::fromLatin1(array.constData(), sz); + } result += QLatin1Char(')'); object.insert(key, result); break; From 366bd7bda2b218d6714eac5cab18a12910c3d0b9 Mon Sep 17 00:00:00 2001 From: Dale Glass <51060919+daleglass@users.noreply.github.com> Date: Sun, 5 Jun 2022 23:51:36 +0200 Subject: [PATCH 31/41] Fix typo in CMakeLists.txt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Julian Groß --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d65279452b6..07214eadde6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -149,7 +149,7 @@ if(OVERTE_WARNINGS_WHITELIST) 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) + add_compile_definitions(OVERTE_WARNINGS_WHITELIST_CLANG) else() message("We don't know yet how to whitelist warnings for ${CMAKE_CXX_COMPILER_ID}") endif() From 9566960faa187f03531311357ef5221199eb962b Mon Sep 17 00:00:00 2001 From: Dale Glass <51060919+daleglass@users.noreply.github.com> Date: Sun, 5 Jun 2022 23:52:28 +0200 Subject: [PATCH 32/41] Remove mistaken line from CMakeLists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Julian Groß --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 07214eadde6..82f49f8f33b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,7 +139,6 @@ if(NOT DEFINED OVERTE_WARNINGS_WHITELIST) 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() From 9c4ab1e1f7b4fa3fae4e6f6a06fda347838ef3b0 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Tue, 7 Jun 2022 20:42:12 +0200 Subject: [PATCH 33/41] Prototype for MSVC support, still need to figure out the right directives --- CMakeLists.txt | 3 +++ libraries/shared/src/WarningsSuppression.h | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 82f49f8f33b..e6917a21c49 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -149,6 +149,9 @@ if(OVERTE_WARNINGS_WHITELIST) elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") message("Clang compiler detected, suppressing some unsolvable warnings.") add_compile_definitions(OVERTE_WARNINGS_WHITELIST_CLANG) + elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + message("Clang compiler detected, suppressing some unsolvable warnings.") + add_compile_definitions(OVERTE_WARNINGS_WHITELIST_MSVC) else() message("We don't know yet how to whitelist warnings for ${CMAKE_CXX_COMPILER_ID}") endif() diff --git a/libraries/shared/src/WarningsSuppression.h b/libraries/shared/src/WarningsSuppression.h index 16516137fa0..83a81d9c819 100644 --- a/libraries/shared/src/WarningsSuppression.h +++ b/libraries/shared/src/WarningsSuppression.h @@ -35,6 +35,11 @@ #define OVERTE_IGNORE_DEPRECATED_END _Pragma("clang diagnostic pop") +#elif OVERTE_WARNINGS_WHITELIST_MSVC + +// Nothing here yet. Avoids problems with the #warning below, MSVC doesn't like it. + + #else #warning "Don't know how to suppress warnings on this compiler. Please fix me." From aa9c88508c94c5c0fa58705f18a8eea723895b1b Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Wed, 8 Jun 2022 16:39:32 +0200 Subject: [PATCH 34/41] Fix compiler detection for warning whitelisting --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e6917a21c49..1e1457fc56f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -143,6 +143,8 @@ if(NOT DEFINED OVERTE_WARNINGS_AS_ERRORS) endif() if(OVERTE_WARNINGS_WHITELIST) + include(CMakeDetermineCXXCompiler) + if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") message("GCC compiler detected, suppressing some unsolvable warnings.") add_compile_definitions(OVERTE_WARNINGS_WHITELIST_GCC) @@ -150,7 +152,7 @@ if(OVERTE_WARNINGS_WHITELIST) message("Clang compiler detected, suppressing some unsolvable warnings.") add_compile_definitions(OVERTE_WARNINGS_WHITELIST_CLANG) elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - message("Clang compiler detected, suppressing some unsolvable warnings.") + message("Microsoft Visual Studio compiler detected, suppressing some unsolvable warnings.") add_compile_definitions(OVERTE_WARNINGS_WHITELIST_MSVC) else() message("We don't know yet how to whitelist warnings for ${CMAKE_CXX_COMPILER_ID}") From 0a7d815d461df139e4bef2889c8262673d7f2667 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Wed, 8 Jun 2022 20:27:34 +0200 Subject: [PATCH 35/41] Apparently Windows compiler detection needs a variable --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e1457fc56f..7b3625d6d3d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -143,6 +143,7 @@ if(NOT DEFINED OVERTE_WARNINGS_AS_ERRORS) endif() if(OVERTE_WARNINGS_WHITELIST) + set(CMAKE_PLATFORM_INFO_DIR "${CMAKE_CURRENT_BINARY_DIR}") include(CMakeDetermineCXXCompiler) if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") From 0b4358ce7b3c94fd1364a54d68d993c3785f7cfa Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Thu, 9 Jun 2022 00:40:12 +0200 Subject: [PATCH 36/41] Fix cmake syntax error --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b3625d6d3d..22018451473 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -161,8 +161,8 @@ if(OVERTE_WARNINGS_WHITELIST) endif() if(OVERTE_WARNINGS_AS_ERRORS) - set(ENV{CXXFLAGS "$ENV{CXXFLAGS} -Werror"}) - set(ENV{CFLAGS "$ENV{CXXFLAGS} -Werror"}) + set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} -Werror") + set(ENV{CFLAGS} "$ENV{CXXFLAGS} -Werror") endif() From 29b3db8c98948a4063983425bb468a8cc1860264 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Thu, 9 Jun 2022 00:40:28 +0200 Subject: [PATCH 37/41] Don't call CMakeDetermineCXXCompiler on Win32, work around lack of CMAKE_CXX_COMPILER_ID being set --- CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 22018451473..8ec493bf3b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -143,8 +143,10 @@ if(NOT DEFINED OVERTE_WARNINGS_AS_ERRORS) endif() if(OVERTE_WARNINGS_WHITELIST) - set(CMAKE_PLATFORM_INFO_DIR "${CMAKE_CURRENT_BINARY_DIR}") - include(CMakeDetermineCXXCompiler) + if (NOT WIN32) + set(CMAKE_PLATFORM_INFO_DIR "${CMAKE_CURRENT_BINARY_DIR}") + include(CMakeDetermineCXXCompiler) + endif() if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") message("GCC compiler detected, suppressing some unsolvable warnings.") @@ -152,7 +154,7 @@ if(OVERTE_WARNINGS_WHITELIST) elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") message("Clang compiler detected, suppressing some unsolvable warnings.") add_compile_definitions(OVERTE_WARNINGS_WHITELIST_CLANG) - elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC" OR (CMAKE_CXX_COMPILER_ID MATCHES "" AND WIN32)) message("Microsoft Visual Studio compiler detected, suppressing some unsolvable warnings.") add_compile_definitions(OVERTE_WARNINGS_WHITELIST_MSVC) else() From eb32034136fe64b044e7937a578422111a2730f8 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Thu, 9 Jun 2022 16:43:11 +0200 Subject: [PATCH 38/41] Implement Visual C warnings suppression --- libraries/shared/src/WarningsSuppression.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/shared/src/WarningsSuppression.h b/libraries/shared/src/WarningsSuppression.h index 83a81d9c819..a8459ac2e64 100644 --- a/libraries/shared/src/WarningsSuppression.h +++ b/libraries/shared/src/WarningsSuppression.h @@ -37,8 +37,11 @@ #elif OVERTE_WARNINGS_WHITELIST_MSVC -// Nothing here yet. Avoids problems with the #warning below, MSVC doesn't like it. + #define OVERTE_IGNORE_DEPRECATED_BEGIN \ + _Pragma("warning(push)") \ + _Pragma("warning(disable : 4996)") + #define OVERTE_IGNORE_DEPRECATED_END _Pragma("warning(pop)") #else From 56aa7d5a05277a0b434a83476bd90a4375f4b2ca Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Tue, 14 Jun 2022 17:09:59 +0200 Subject: [PATCH 39/41] Rename warning constants --- CMakeLists.txt | 20 ++++++++--------- interface/src/AvatarBookmarks.cpp | 4 ++-- interface/src/avatar/AvatarPackager.cpp | 4 ++-- interface/src/avatar/MyAvatar.cpp | 4 ++-- interface/src/commerce/Wallet.cpp | 4 ++-- .../AssetMappingsScriptingInterface.cpp | 4 ++-- libraries/avatars/src/AvatarData.cpp | 16 +++++++------- .../entities/src/EntityItemProperties.cpp | 12 +++++----- .../networking/src/DataServerAccountInfo.cpp | 4 ++-- libraries/networking/src/HMACAuth.cpp | 4 ++-- libraries/networking/src/NodeList.cpp | 4 ++-- .../networking/src/RSAKeypairGenerator.cpp | 4 ++-- libraries/octree/src/OctreeQuery.cpp | 8 +++---- libraries/recording/src/recording/Clip.cpp | 4 ++-- .../src/recording/impl/PointerClip.cpp | 4 ++-- libraries/shared/src/WarningsSuppression.h | 22 +++++++++---------- 16 files changed, 61 insertions(+), 61 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ec493bf3b4..6bd1ea14b88 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,7 +125,7 @@ if( NOT WIN32 ) message($ENV{CXXFLAGS}) endif() -# OVERTE_WARNINGS +# 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 @@ -134,15 +134,15 @@ endif() # 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") +if(NOT DEFINED WARNINGS_WHITELIST) + set(WARNINGS_WHITELIST true CACHE BOOL "Whitelist some warnings we can't currently fix") endif() -if(NOT DEFINED OVERTE_WARNINGS_AS_ERRORS) - set(OVERTE_WARNINGS_AS_ERRORS false CACHE BOOL "Count warnings as errors") +if(NOT DEFINED WARNINGS_AS_ERRORS) + set(WARNINGS_AS_ERRORS false CACHE BOOL "Count warnings as errors") endif() -if(OVERTE_WARNINGS_WHITELIST) +if(WARNINGS_WHITELIST) if (NOT WIN32) set(CMAKE_PLATFORM_INFO_DIR "${CMAKE_CURRENT_BINARY_DIR}") include(CMakeDetermineCXXCompiler) @@ -150,19 +150,19 @@ 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) + add_compile_definitions(WARNINGS_WHITELIST_GCC) elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") message("Clang compiler detected, suppressing some unsolvable warnings.") - add_compile_definitions(OVERTE_WARNINGS_WHITELIST_CLANG) + add_compile_definitions(WARNINGS_WHITELIST_CLANG) elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC" OR (CMAKE_CXX_COMPILER_ID MATCHES "" AND WIN32)) message("Microsoft Visual Studio compiler detected, suppressing some unsolvable warnings.") - add_compile_definitions(OVERTE_WARNINGS_WHITELIST_MSVC) + add_compile_definitions(WARNINGS_WHITELIST_MSVC) else() message("We don't know yet how to whitelist warnings for ${CMAKE_CXX_COMPILER_ID}") endif() endif() -if(OVERTE_WARNINGS_AS_ERRORS) +if(WARNINGS_AS_ERRORS) set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} -Werror") set(ENV{CFLAGS} "$ENV{CXXFLAGS} -Werror") endif() diff --git a/interface/src/AvatarBookmarks.cpp b/interface/src/AvatarBookmarks.cpp index 0d999b2ff13..ad993453e78 100644 --- a/interface/src/AvatarBookmarks.cpp +++ b/interface/src/AvatarBookmarks.cpp @@ -168,10 +168,10 @@ void AvatarBookmarks::updateAvatarEntities(const QVariantList &avatarEntities) { if (propertiesItr != avatarEntityVariantMap.end()) { EntityItemID id = idItr.value().toUuid(); newAvatarEntities.insert(id); - OVERTE_IGNORE_DEPRECATED_BEGIN + 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 + IGNORE_DEPRECATED_END } } } diff --git a/interface/src/avatar/AvatarPackager.cpp b/interface/src/avatar/AvatarPackager.cpp index eb362ce470a..b55cbbde938 100644 --- a/interface/src/avatar/AvatarPackager.cpp +++ b/interface/src/avatar/AvatarPackager.cpp @@ -28,12 +28,12 @@ std::once_flag setupQMLTypesFlag; AvatarPackager::AvatarPackager() { std::call_once(setupQMLTypesFlag, []() { - OVERTE_IGNORE_DEPRECATED_BEGIN + IGNORE_DEPRECATED_BEGIN qmlRegisterType(); qmlRegisterType(); - OVERTE_IGNORE_DEPRECATED_END + IGNORE_DEPRECATED_END qRegisterMetaType(); qRegisterMetaType(); diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index c40545d0142..3c6e74f7966 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -2018,10 +2018,10 @@ void MyAvatar::updateAvatarEntity(const QUuid& entityID, const QByteArray& entit bool changed = false; _avatarEntitiesLock.withWriteLock([&] { - OVERTE_IGNORE_DEPRECATED_BEGIN + 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 + 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 { diff --git a/interface/src/commerce/Wallet.cpp b/interface/src/commerce/Wallet.cpp index 52968ef413b..223f4021126 100644 --- a/interface/src/commerce/Wallet.cpp +++ b/interface/src/commerce/Wallet.cpp @@ -42,7 +42,7 @@ #include "scripting/HMDScriptingInterface.h" #include "WarningsSuppression.h" -OVERTE_IGNORE_DEPRECATED_BEGIN; +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. @@ -956,4 +956,4 @@ void Wallet::getWalletStatus() { } } -OVERTE_IGNORE_DEPRECATED_END \ No newline at end of file +IGNORE_DEPRECATED_END \ No newline at end of file diff --git a/interface/src/scripting/AssetMappingsScriptingInterface.cpp b/interface/src/scripting/AssetMappingsScriptingInterface.cpp index 44ff4b2d101..9c88a516d48 100644 --- a/interface/src/scripting/AssetMappingsScriptingInterface.cpp +++ b/interface/src/scripting/AssetMappingsScriptingInterface.cpp @@ -169,10 +169,10 @@ void AssetMappingsScriptingInterface::getAllMappings(QJSValue callback) { connect(request, &GetAllMappingsRequest::finished, this, [callback](GetAllMappingsRequest* request) mutable { auto mappings = request->getMappings(); - OVERTE_IGNORE_DEPRECATED_BEGIN + IGNORE_DEPRECATED_BEGIN // Still using QScriptEngine auto map = callback.engine()->newObject(); - OVERTE_IGNORE_DEPRECATED_END + IGNORE_DEPRECATED_END for (auto& kv : mappings ) { map.setProperty(kv.first, kv.second.hash); diff --git a/libraries/avatars/src/AvatarData.cpp b/libraries/avatars/src/AvatarData.cpp index 2076a88d324..721664af252 100755 --- a/libraries/avatars/src/AvatarData.cpp +++ b/libraries/avatars/src/AvatarData.cpp @@ -2859,17 +2859,17 @@ QByteArray AvatarData::toFrame(const AvatarData& avatar) { qCDebug(avatars).noquote() << QJsonDocument(obj).toJson(QJsonDocument::JsonFormat::Indented); } #endif - OVERTE_IGNORE_DEPRECATED_BEGIN + IGNORE_DEPRECATED_BEGIN // Can't use CBOR yet, would break the protocol return QJsonDocument(root).toBinaryData(); - OVERTE_IGNORE_DEPRECATED_END + IGNORE_DEPRECATED_END } void AvatarData::fromFrame(const QByteArray& frameData, AvatarData& result, bool useFrameSkeleton) { - OVERTE_IGNORE_DEPRECATED_BEGIN + IGNORE_DEPRECATED_BEGIN QJsonDocument doc = QJsonDocument::fromBinaryData(frameData); - OVERTE_IGNORE_DEPRECATED_END + IGNORE_DEPRECATED_END #ifdef WANT_JSON_DEBUG { @@ -3196,9 +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 + IGNORE_DEPRECATED_BEGIN QJsonDocument jsonEntityProperties = QJsonDocument::fromBinaryData(entityProperties); - OVERTE_IGNORE_DEPRECATED_END + IGNORE_DEPRECATED_END if (!jsonEntityProperties.isObject()) { qCDebug(avatars) << "bad AvatarEntityData in AvatarEntityMap" << QString(entityProperties.toHex()); } @@ -3222,9 +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 + IGNORE_DEPRECATED_BEGIN QByteArray binaryEntityProperties = jsonEntityProperties.toBinaryData(); - OVERTE_IGNORE_DEPRECATED_END + IGNORE_DEPRECATED_END value[EntityID] = binaryEntityProperties; } } diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index dd56bb9c07b..717b5b276ec 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -5082,7 +5082,7 @@ 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 + IGNORE_DEPRECATED_BEGIN // We're not really verifying these anymore if (digestByteArray.isEmpty()) { @@ -5156,7 +5156,7 @@ bool EntityItemProperties::verifySignature(const QString& publicKey, const QByte return false; } - OVERTE_IGNORE_DEPRECATED_END + IGNORE_DEPRECATED_END } bool EntityItemProperties::verifyStaticCertificateProperties() { @@ -5192,9 +5192,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 + IGNORE_DEPRECATED_BEGIN QJsonDocument jsonProperties = QJsonDocument::fromBinaryData(blob); - OVERTE_IGNORE_DEPRECATED_END + IGNORE_DEPRECATED_END if (jsonProperties.isEmpty() || jsonProperties.isNull() || !jsonProperties.isObject() || jsonProperties.object().isEmpty()) { qCDebug(entities) << "bad avatarEntityData json" << QString(blob.toHex()); return false; @@ -5224,9 +5224,9 @@ void EntityItemProperties::propertiesToBlob(QScriptEngine& scriptEngine, const Q } } jsonProperties = QJsonDocument(jsonObject); - OVERTE_IGNORE_DEPRECATED_BEGIN + IGNORE_DEPRECATED_BEGIN blob = jsonProperties.toBinaryData(); - OVERTE_IGNORE_DEPRECATED_END + IGNORE_DEPRECATED_END // end recipe } diff --git a/libraries/networking/src/DataServerAccountInfo.cpp b/libraries/networking/src/DataServerAccountInfo.cpp index 662d52438f9..df0a39e3ee4 100644 --- a/libraries/networking/src/DataServerAccountInfo.cpp +++ b/libraries/networking/src/DataServerAccountInfo.cpp @@ -121,7 +121,7 @@ QByteArray DataServerAccountInfo::getUsernameSignature(const QUuid& connectionTo } QByteArray DataServerAccountInfo::signPlaintext(const QByteArray& plaintext) { - OVERTE_IGNORE_DEPRECATED_BEGIN + IGNORE_DEPRECATED_BEGIN // Deprecated OpenSSL API code -- this should be fixed eventually. if (!_privateKey.isEmpty()) { @@ -153,7 +153,7 @@ QByteArray DataServerAccountInfo::signPlaintext(const QByteArray& plaintext) { } } return QByteArray(); - OVERTE_IGNORE_DEPRECATED_END + IGNORE_DEPRECATED_END } QDataStream& operator<<(QDataStream &out, const DataServerAccountInfo& info) { diff --git a/libraries/networking/src/HMACAuth.cpp b/libraries/networking/src/HMACAuth.cpp index c1f62fac2e5..e08cccaab01 100644 --- a/libraries/networking/src/HMACAuth.cpp +++ b/libraries/networking/src/HMACAuth.cpp @@ -20,7 +20,7 @@ #include "WarningsSuppression.h" -OVERTE_IGNORE_DEPRECATED_BEGIN +IGNORE_DEPRECATED_BEGIN // Qt provides HMAC, do we actually need this here? // But for the time being, suppress this. @@ -122,4 +122,4 @@ bool HMACAuth::calculateHash(HMACHash& hashResult, const char* data, int dataLen return true; } -OVERTE_IGNORE_DEPRECATED_END \ No newline at end of file +IGNORE_DEPRECATED_END \ No newline at end of file diff --git a/libraries/networking/src/NodeList.cpp b/libraries/networking/src/NodeList.cpp index aeb87c70eea..19324ae89c4 100644 --- a/libraries/networking/src/NodeList.cpp +++ b/libraries/networking/src/NodeList.cpp @@ -189,10 +189,10 @@ qint64 NodeList::sendStats(QJsonObject statsObject, SockAddr destination) { QJsonDocument jsonDocument(statsObject); - OVERTE_IGNORE_DEPRECATED_BEGIN + IGNORE_DEPRECATED_BEGIN // Can't use CBOR yet, will break protocol. statsPacketList->write(jsonDocument.toBinaryData()); - OVERTE_IGNORE_DEPRECATED_END + IGNORE_DEPRECATED_END sendPacketList(std::move(statsPacketList), destination); return 0; diff --git a/libraries/networking/src/RSAKeypairGenerator.cpp b/libraries/networking/src/RSAKeypairGenerator.cpp index 2fd6f4ef18a..4625330284b 100644 --- a/libraries/networking/src/RSAKeypairGenerator.cpp +++ b/libraries/networking/src/RSAKeypairGenerator.cpp @@ -23,7 +23,7 @@ #pragma clang diagnostic ignored "-Wdeprecated-declarations" #endif -OVERTE_IGNORE_DEPRECATED_BEGIN +IGNORE_DEPRECATED_BEGIN // Deprecated OpenSSL functions being used here. // Should look into modernizing this. @@ -106,4 +106,4 @@ void RSAKeypairGenerator::generateKeypair() { emit generatedKeypair(_publicKey, _privateKey); } -OVERTE_IGNORE_DEPRECATED_END \ No newline at end of file +IGNORE_DEPRECATED_END \ No newline at end of file diff --git a/libraries/octree/src/OctreeQuery.cpp b/libraries/octree/src/OctreeQuery.cpp index 2abb82e489b..31d96362fb2 100644 --- a/libraries/octree/src/OctreeQuery.cpp +++ b/libraries/octree/src/OctreeQuery.cpp @@ -67,10 +67,10 @@ int OctreeQuery::getBroadcastData(unsigned char* destinationBuffer) { QByteArray binaryParametersDocument; if (!_jsonParameters.isEmpty()) { - OVERTE_IGNORE_DEPRECATED_BEGIN + IGNORE_DEPRECATED_BEGIN // Can't use CBOR yet, will break the protocol. binaryParametersDocument = QJsonDocument(_jsonParameters).toBinaryData(); - OVERTE_IGNORE_DEPRECATED_END + IGNORE_DEPRECATED_END } // write the size of the JSON parameters @@ -158,9 +158,9 @@ int OctreeQuery::parseData(ReceivedMessage& message) { sourceBuffer += binaryParametersBytes; // grab the parameter object from the packed binary representation of JSON - OVERTE_IGNORE_DEPRECATED_BEGIN + IGNORE_DEPRECATED_BEGIN auto newJsonDocument = QJsonDocument::fromBinaryData(binaryJSONParameters); - OVERTE_IGNORE_DEPRECATED_END + IGNORE_DEPRECATED_END QWriteLocker jsonParameterLocker { &_jsonParametersLock }; _jsonParameters = newJsonDocument.object(); diff --git a/libraries/recording/src/recording/Clip.cpp b/libraries/recording/src/recording/Clip.cpp index 3de72b7357a..7b7380b216c 100644 --- a/libraries/recording/src/recording/Clip.cpp +++ b/libraries/recording/src/recording/Clip.cpp @@ -105,10 +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 + IGNORE_DEPRECATED_BEGIN // Can't use CBOR yet, will break the protocol. QByteArray headerFrameData = QJsonDocument(rootObject).toBinaryData(); - OVERTE_IGNORE_DEPRECATED_END + IGNORE_DEPRECATED_END // Never compress the header frame if (!writeFrame(output, Frame({ Frame::TYPE_HEADER, 0, headerFrameData }), false)) { return false; diff --git a/libraries/recording/src/recording/impl/PointerClip.cpp b/libraries/recording/src/recording/impl/PointerClip.cpp index 228cfcde2f6..c39692e9fc1 100644 --- a/libraries/recording/src/recording/impl/PointerClip.cpp +++ b/libraries/recording/src/recording/impl/PointerClip.cpp @@ -107,10 +107,10 @@ void PointerClip::init(uchar* data, size_t size) { QByteArray fileHeaderData((char*)_data + fileHeaderFrameHeader.fileOffset, fileHeaderFrameHeader.size); - OVERTE_IGNORE_DEPRECATED_BEGIN + IGNORE_DEPRECATED_BEGIN // Can't use CBOR yet, will break the protocol. _header = QJsonDocument::fromBinaryData(fileHeaderData); - OVERTE_IGNORE_DEPRECATED_END + IGNORE_DEPRECATED_END } // Check for compression diff --git a/libraries/shared/src/WarningsSuppression.h b/libraries/shared/src/WarningsSuppression.h index a8459ac2e64..46b935e3d66 100644 --- a/libraries/shared/src/WarningsSuppression.h +++ b/libraries/shared/src/WarningsSuppression.h @@ -19,35 +19,35 @@ */ -#ifdef OVERTE_WARNINGS_WHITELIST_GCC +#ifdef WARNINGS_WHITELIST_GCC - #define OVERTE_IGNORE_DEPRECATED_BEGIN \ + #define IGNORE_DEPRECATED_BEGIN \ _Pragma("GCC diagnostic push") \ _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") - #define OVERTE_IGNORE_DEPRECATED_END _Pragma("GCC diagnostic pop") + #define IGNORE_DEPRECATED_END _Pragma("GCC diagnostic pop") -#elif OVERTE_WARNINGS_WHITELIST_CLANG +#elif WARNINGS_WHITELIST_CLANG - #define OVERTE_IGNORE_DEPRECATED_BEGIN \ + #define IGNORE_DEPRECATED_BEGIN \ _Pragma("clang diagnostic push") \ _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") - #define OVERTE_IGNORE_DEPRECATED_END _Pragma("clang diagnostic pop") + #define IGNORE_DEPRECATED_END _Pragma("clang diagnostic pop") -#elif OVERTE_WARNINGS_WHITELIST_MSVC +#elif WARNINGS_WHITELIST_MSVC - #define OVERTE_IGNORE_DEPRECATED_BEGIN \ + #define IGNORE_DEPRECATED_BEGIN \ _Pragma("warning(push)") \ _Pragma("warning(disable : 4996)") - #define OVERTE_IGNORE_DEPRECATED_END _Pragma("warning(pop)") + #define IGNORE_DEPRECATED_END _Pragma("warning(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 +#define IGNORE_DEPRECATED_BEGIN +#define IGNORE_DEPRECATED_END #endif From 737edcd19ec491fb6c6c814bdcbe30beb63a7bbe Mon Sep 17 00:00:00 2001 From: Dale Glass <51060919+daleglass@users.noreply.github.com> Date: Fri, 24 Jun 2022 16:19:35 +0200 Subject: [PATCH 40/41] Update libraries/shared/src/WarningsSuppression.h Co-authored-by: Kalila <69767640+digisomni@users.noreply.github.com> --- libraries/shared/src/WarningsSuppression.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/shared/src/WarningsSuppression.h b/libraries/shared/src/WarningsSuppression.h index 46b935e3d66..4a7f9fe8d6e 100644 --- a/libraries/shared/src/WarningsSuppression.h +++ b/libraries/shared/src/WarningsSuppression.h @@ -3,7 +3,7 @@ // // // Created by Dale Glass on 5/6/2022 -// Copyright 2022 Dale Glass +// Copyright 2022 Vircadia contributors. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html From f26a3f0bebd012ba6ab098511fc93e00e811c067 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Thu, 7 Jul 2022 23:04:23 +0200 Subject: [PATCH 41/41] Review fixes --- interface/src/avatar/AvatarPackager.cpp | 9 ++------- interface/src/commerce/Wallet.cpp | 2 +- libraries/networking/src/HMACAuth.cpp | 2 +- libraries/octree/src/OctreeElement.cpp | 6 +++--- libraries/shared/src/SettingHelpers.cpp | 4 ++-- libraries/workload/src/workload/Space.cpp | 2 +- 6 files changed, 10 insertions(+), 15 deletions(-) diff --git a/interface/src/avatar/AvatarPackager.cpp b/interface/src/avatar/AvatarPackager.cpp index b55cbbde938..1486391e724 100644 --- a/interface/src/avatar/AvatarPackager.cpp +++ b/interface/src/avatar/AvatarPackager.cpp @@ -28,13 +28,8 @@ std::once_flag setupQMLTypesFlag; AvatarPackager::AvatarPackager() { std::call_once(setupQMLTypesFlag, []() { - IGNORE_DEPRECATED_BEGIN - - qmlRegisterType(); - qmlRegisterType(); - - IGNORE_DEPRECATED_END - + qmlRegisterAnonymousType("Hifi", 1); + qmlRegisterAnonymousType("Hifi", 1); qRegisterMetaType(); qRegisterMetaType(); qRegisterMetaType(); diff --git a/interface/src/commerce/Wallet.cpp b/interface/src/commerce/Wallet.cpp index 223f4021126..764f57a1604 100644 --- a/interface/src/commerce/Wallet.cpp +++ b/interface/src/commerce/Wallet.cpp @@ -956,4 +956,4 @@ void Wallet::getWalletStatus() { } } -IGNORE_DEPRECATED_END \ No newline at end of file +IGNORE_DEPRECATED_END diff --git a/libraries/networking/src/HMACAuth.cpp b/libraries/networking/src/HMACAuth.cpp index e08cccaab01..57f9a028e13 100644 --- a/libraries/networking/src/HMACAuth.cpp +++ b/libraries/networking/src/HMACAuth.cpp @@ -122,4 +122,4 @@ bool HMACAuth::calculateHash(HMACHash& hashResult, const char* data, int dataLen return true; } -IGNORE_DEPRECATED_END \ No newline at end of file +IGNORE_DEPRECATED_END diff --git a/libraries/octree/src/OctreeElement.cpp b/libraries/octree/src/OctreeElement.cpp index c4e66c81556..d61664ba041 100644 --- a/libraries/octree/src/OctreeElement.cpp +++ b/libraries/octree/src/OctreeElement.cpp @@ -446,9 +446,9 @@ void OctreeElement::printDebugDetails(const char* label) const { qCDebug(octree).noquote() << label << QString(" - Voxel at corner=(%1,%2,%3)").arg((double)_cube.getCorner().x, (double)_cube.getCorner().y, (double)_cube.getCorner().z) << "size=" << (double)_cube.getScale() - << " isLeaf=" << debug::valueOf(isLeaf()) - << " isDirty=" << debug::valueOf(isDirty()) - << " shouldRender=" << debug::valueOf(getShouldRender()); + << "isLeaf=" << debug::valueOf(isLeaf()) + << "isDirty=" << debug::valueOf(isDirty()) + << "shouldRender=" << debug::valueOf(getShouldRender()); qCDebug(octree).nospace() << resultString; } diff --git a/libraries/shared/src/SettingHelpers.cpp b/libraries/shared/src/SettingHelpers.cpp index d8fcc6b6de3..6b7c6b061a1 100644 --- a/libraries/shared/src/SettingHelpers.cpp +++ b/libraries/shared/src/SettingHelpers.cpp @@ -165,7 +165,7 @@ QJsonDocument variantMapToJsonDocument(const QSettings::SettingsMap& map) { QByteArray a = variant.toByteArray(); QString result = QLatin1String("@ByteArray("); int sz = a.size(); - if ( sz > 0 ) { + if (sz > 0) { // Work around 'warning: ‘size_t strlen(const char*)’ reading 1 or more bytes from a region of size 0 [-Wstringop-overread]' // size() indeed could be zero bytes, so make sure that can't be the case. result += QString::fromLatin1(a.constData(), sz); @@ -219,7 +219,7 @@ QJsonDocument variantMapToJsonDocument(const QSettings::SettingsMap& map) { QString result = QLatin1String("@Variant("); int sz = array.size(); - if ( sz > 0 ) { + if (sz > 0) { // See comment in the case handling QVariant::ByteArray result += QString::fromLatin1(array.constData(), sz); } diff --git a/libraries/workload/src/workload/Space.cpp b/libraries/workload/src/workload/Space.cpp index c57b8ae3a76..bba1a9b5f07 100644 --- a/libraries/workload/src/workload/Space.cpp +++ b/libraries/workload/src/workload/Space.cpp @@ -123,7 +123,7 @@ void Space::categorizeAndGetChanges(std::vector& changes) { uint32_t Space::copyProxyValues(Proxy* proxies, uint32_t numDestProxies) const { std::unique_lock lock(_proxiesMutex); auto numCopied = std::min(numDestProxies, (uint32_t)_proxies.size()); - for(unsigned int i=0;i