From 0dc15480e03e6df3f5473e7594f81e623bd9d483 Mon Sep 17 00:00:00 2001 From: Matt Koscumb Date: Thu, 6 Sep 2018 14:08:44 -0700 Subject: [PATCH] Build break fixes in Devmain --- lib/filter/EventFilter.cpp | 2 +- lib/include/public/CorrelationVector.hpp | 4 ++-- lib/offline/FifoFileStorage.cpp | 13 +------------ lib/offline/FifoFileStorage.hpp | 2 +- lib/offline/MemoryStorage.cpp | 2 +- lib/offline/OfflineStorage_SQLite.cpp | 3 +++ lib/offline/SQLiteWrapper.hpp | 6 +++--- .../win32/WindowsDesktopDeviceInformationImpl.cpp | 2 ++ lib/system/traceloggingdynamic.h | 3 +++ tests/common/SocketTools.hpp | 2 +- tests/functests/APITest.cpp | 4 +++- tests/functests/MultipleLogManagersTests.cpp | 2 ++ tests/unittests/HttpClientTests.cpp | 2 ++ tests/unittests/HttpServerTests.cpp | 2 ++ 14 files changed, 27 insertions(+), 22 deletions(-) diff --git a/lib/filter/EventFilter.cpp b/lib/filter/EventFilter.cpp index 1967bb07..61d7971a 100644 --- a/lib/filter/EventFilter.cpp +++ b/lib/filter/EventFilter.cpp @@ -91,7 +91,7 @@ namespace ARIASDK_NS_BEGIN uint32_t filterRate = filterRates[i]; if (nullptr != filterString) { - assert(filterRates[i] >= 0 && filterRates[i] <= 100); + assert(filterRates[i] <= 100); _filterRules[std::string(filterString)] = filterRate; } } diff --git a/lib/include/public/CorrelationVector.hpp b/lib/include/public/CorrelationVector.hpp index e38d2a9d..79fb55cd 100644 --- a/lib/include/public/CorrelationVector.hpp +++ b/lib/include/public/CorrelationVector.hpp @@ -102,11 +102,11 @@ namespace ARIASDK_NS_BEGIN public: // String constant to use for sending a CV through EventProperties.SetProperty API. - ARIASDK_LIBABI static constexpr const char* PropertyName = "__TlgCV__"; + static constexpr const char* PropertyName = "__TlgCV__"; // String constant to use when sending a CV through any transport other than // this telemetry API, e.g. as a name for an HTTP header. - ARIASDK_LIBABI static constexpr const char* HeaderName = "MS-CV"; + static constexpr const char* HeaderName = "MS-CV"; private: diff --git a/lib/offline/FifoFileStorage.cpp b/lib/offline/FifoFileStorage.cpp index 5604032e..443fa8a1 100644 --- a/lib/offline/FifoFileStorage.cpp +++ b/lib/offline/FifoFileStorage.cpp @@ -209,11 +209,6 @@ SAVE_FAILED: // nullptr-terminate the buffer (empty buffer) buffer[0]=0; goto LOAD_OK; - } else - if (readSize < 0) - { - LOG_ERROR("load offline data failed: pos=%d, left=%d", bufferPosition, bytesToRead); - goto LOAD_FAILED; } bytesToRead -= readSize; @@ -223,11 +218,6 @@ SAVE_FAILED: LOAD_OK: m_FileStatus = oldStatus; return RES_SUCC; - -LOAD_FAILED: - - m_FileStatus = oldStatus; - return RES_ERROR; } int FIFOFileStorage::ReadFileHeader() @@ -264,7 +254,7 @@ LOAD_FAILED: //size_t checkCount = 0; PhysicalBlockInfo block = {}; - AssertAbort(m_FileHeader.physicalBlockCount >= 0 && m_FileHeader.fileSize > 0); + AssertAbort(m_FileHeader.fileSize > 0); fileOffset += sizeof(struct FileHeader); @@ -438,7 +428,6 @@ LOAD_FAILED: if (blockId == -1) { - AssertAbort(m_LogicalBlocks.size() >= 0); if (m_LogicalBlocks.size() > 0) { //if there is no block exist, release one oldest block diff --git a/lib/offline/FifoFileStorage.hpp b/lib/offline/FifoFileStorage.hpp index 272930a4..da15dc9d 100644 --- a/lib/offline/FifoFileStorage.hpp +++ b/lib/offline/FifoFileStorage.hpp @@ -113,7 +113,7 @@ namespace ARIASDK_NS_BEGIN { } else { - return idResult < 0; + return false; } } else diff --git a/lib/offline/MemoryStorage.cpp b/lib/offline/MemoryStorage.cpp index 8bc2bab0..5a537e3e 100644 --- a/lib/offline/MemoryStorage.cpp +++ b/lib/offline/MemoryStorage.cpp @@ -179,7 +179,7 @@ namespace ARIASDK_NS_BEGIN { /// unsigned MemoryStorage::LastReadRecordCount() { - return m_lastReadCount.load(); + return static_cast(m_lastReadCount.load()); } /// diff --git a/lib/offline/OfflineStorage_SQLite.cpp b/lib/offline/OfflineStorage_SQLite.cpp index 88608cb2..0f38f51a 100644 --- a/lib/offline/OfflineStorage_SQLite.cpp +++ b/lib/offline/OfflineStorage_SQLite.cpp @@ -653,6 +653,8 @@ namespace ARIASDK_NS_BEGIN { } // *INDENT-OFF* Uncrustify insists on adding a namespace closing comment after the closing curly brace +#pragma warning(push) +#pragma warning(disable:4296) // expression always false. #define PREPARE_SQL(var_, stmt_) \ if ((var_ = m_db->prepare(stmt_)) < 0) { return false; } // *INDENT-ON* @@ -729,6 +731,7 @@ namespace ARIASDK_NS_BEGIN { "SELECT value FROM " TABLE_NAME_SETTINGS " WHERE name=?"); #undef PREPARE_SQL +#pragma warning(pop) m_currentlyAddedBytes = 0; m_isInTransaction = false; diff --git a/lib/offline/SQLiteWrapper.hpp b/lib/offline/SQLiteWrapper.hpp index 83f7770c..a0da906d 100644 --- a/lib/offline/SQLiteWrapper.hpp +++ b/lib/offline/SQLiteWrapper.hpp @@ -486,7 +486,7 @@ namespace ARIASDK_NS_BEGIN { SqliteStatement(SqliteDB& db, size_t stmtId) : m_db(db), m_stmtId(stmtId), - m_stmt((stmtId >= 0) ? db.statement(stmtId) : nullptr), + m_stmt(db.statement(stmtId)), m_changes(0), m_duration(0), m_ownStmt(false), @@ -499,7 +499,7 @@ namespace ARIASDK_NS_BEGIN { SqliteStatement(SqliteDB& db, char const* statement) : m_db(db), m_stmtId(db.prepare(statement)), - m_stmt((m_stmtId >= 0) ? db.statement(m_stmtId) : nullptr), + m_stmt(db.statement(m_stmtId)), m_changes(0), m_duration(0), m_ownStmt(true), @@ -511,7 +511,7 @@ namespace ARIASDK_NS_BEGIN { ~SqliteStatement() { - if (m_ownStmt && m_stmtId >= 0) { + if (m_ownStmt) { m_db.release(m_stmtId); } } diff --git a/lib/pal/win32/WindowsDesktopDeviceInformationImpl.cpp b/lib/pal/win32/WindowsDesktopDeviceInformationImpl.cpp index 03d6d925..7af36e28 100644 --- a/lib/pal/win32/WindowsDesktopDeviceInformationImpl.cpp +++ b/lib/pal/win32/WindowsDesktopDeviceInformationImpl.cpp @@ -1,5 +1,7 @@ #define LOG_MODULE DBG_API +#ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif #include "pal/PAL.hpp" #include "pal/DeviceInformationImpl.hpp" #include "WindowsEnvironmentInfo.h" diff --git a/lib/system/traceloggingdynamic.h b/lib/system/traceloggingdynamic.h index 32e7c6a8..1eb9b2d6 100644 --- a/lib/system/traceloggingdynamic.h +++ b/lib/system/traceloggingdynamic.h @@ -300,6 +300,8 @@ namespace tld It is ok to create an array of nested structures where fields in the structure have TypeNone or TypeBinary. */ +#pragma warning(push) +#pragma warning(disable:4471) //a forward declaration of an unscoped enumeration must have an underlying type. Not fixing Windows code. enum Type; /* @@ -345,6 +347,7 @@ namespace tld The type of a provider trait. Used when building up provider metadata. */ enum ProviderTraitType; +#pragma warning(pop) /* class ProviderMetadataBuilder (low-level API): diff --git a/tests/common/SocketTools.hpp b/tests/common/SocketTools.hpp index 4ae458c0..13cbd660 100644 --- a/tests/common/SocketTools.hpp +++ b/tests/common/SocketTools.hpp @@ -567,7 +567,7 @@ namespace testing { continue; } - assert(dwResult >= WSA_WAIT_EVENT_0 && dwResult <= WSA_WAIT_EVENT_0 + m_events.size()); + assert(dwResult <= WSA_WAIT_EVENT_0 + m_events.size()); int index = dwResult - WSA_WAIT_EVENT_0; Socket socket = m_sockets[index].socket; int flags = m_sockets[index].flags; diff --git a/tests/functests/APITest.cpp b/tests/functests/APITest.cpp index 5094cc1c..9e0e0994 100644 --- a/tests/functests/APITest.cpp +++ b/tests/functests/APITest.cpp @@ -1,4 +1,6 @@ -#define _CRT_SECURE_NO_WARNINGS +#ifndef _CRT_SECURE_NO_WARNINGS +#define _CRT_SECURE_NO_WARNINGS +#endif #pragma warning (disable : 4389) //#include "gtest/gtest.h" diff --git a/tests/functests/MultipleLogManagersTests.cpp b/tests/functests/MultipleLogManagersTests.cpp index 715bbba9..edbe7e7b 100644 --- a/tests/functests/MultipleLogManagersTests.cpp +++ b/tests/functests/MultipleLogManagersTests.cpp @@ -1,5 +1,7 @@ // Copyright (c) Microsoft. All rights reserved. +#ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif #include "Common/Common.hpp" #include "common/HttpServer.hpp" #include diff --git a/tests/unittests/HttpClientTests.cpp b/tests/unittests/HttpClientTests.cpp index 135f73c1..3b0bdf54 100644 --- a/tests/unittests/HttpClientTests.cpp +++ b/tests/unittests/HttpClientTests.cpp @@ -1,5 +1,7 @@ // Copyright (c) Microsoft. All rights reserved. +#ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif #include "common/Common.hpp" #if ARIASDK_PAL_SKYPE #include "http/HttpClient_HttpStack.hpp" diff --git a/tests/unittests/HttpServerTests.cpp b/tests/unittests/HttpServerTests.cpp index a3864c90..392b136c 100644 --- a/tests/unittests/HttpServerTests.cpp +++ b/tests/unittests/HttpServerTests.cpp @@ -1,5 +1,7 @@ // Copyright (c) Microsoft. All rights reserved. +#ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif #include "common/Common.hpp" #include "common/HttpServer.hpp"