From d9c05e3d06cd37178ddabfe3127edb630a668a7a Mon Sep 17 00:00:00 2001 From: JinmingHu Date: Thu, 17 Dec 2020 18:51:01 +0800 Subject: [PATCH] replace #ifdef/#ifndef with #if defined() in storage (#1203) --- sdk/storage/azure-storage-common/sample/main.cpp | 2 +- sdk/storage/azure-storage-common/src/crypt.cpp | 4 ++-- sdk/storage/azure-storage-common/src/file_io.cpp | 4 ++-- .../azure-storage-common/src/storage_per_retry_policy.cpp | 2 +- sdk/storage/azure-storage-common/test/test_base.cpp | 8 ++++---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sdk/storage/azure-storage-common/sample/main.cpp b/sdk/storage/azure-storage-common/sample/main.cpp index d9a53df61..05fc1afce 100644 --- a/sdk/storage/azure-storage-common/sample/main.cpp +++ b/sdk/storage/azure-storage-common/sample/main.cpp @@ -1,7 +1,7 @@ // Copyright(c) Microsoft Corporation.All rights reserved. // SPDX - License - Identifier : MIT -#ifdef _MSC_VER +#if defined(_MSC_VER) #define _CRT_SECURE_NO_WARNINGS #endif diff --git a/sdk/storage/azure-storage-common/src/crypt.cpp b/sdk/storage/azure-storage-common/src/crypt.cpp index 697924635..7e1e460ab 100644 --- a/sdk/storage/azure-storage-common/src/crypt.cpp +++ b/sdk/storage/azure-storage-common/src/crypt.cpp @@ -4,7 +4,7 @@ #include #include "azure/storage/common/crypt.hpp" -#ifdef AZ_PLATFORM_WINDOWS +#if defined(AZ_PLATFORM_WINDOWS) #ifndef NOMINMAX #define NOMINMAX #endif @@ -75,7 +75,7 @@ namespace Azure { namespace Storage { } } // namespace Details -#ifdef AZ_PLATFORM_WINDOWS +#if defined(AZ_PLATFORM_WINDOWS) namespace Details { diff --git a/sdk/storage/azure-storage-common/src/file_io.cpp b/sdk/storage/azure-storage-common/src/file_io.cpp index ba664ce1f..ca94a8b1b 100644 --- a/sdk/storage/azure-storage-common/src/file_io.cpp +++ b/sdk/storage/azure-storage-common/src/file_io.cpp @@ -4,7 +4,7 @@ #include #include "azure/storage/common/file_io.hpp" -#ifdef AZ_PLATFORM_POSIX +#if defined(AZ_PLATFORM_POSIX) #include #include #include @@ -16,7 +16,7 @@ namespace Azure { namespace Storage { namespace Details { -#ifdef AZ_PLATFORM_WINDOWS +#if defined(AZ_PLATFORM_WINDOWS) FileReader::FileReader(const std::string& filename) { m_handle = CreateFile( diff --git a/sdk/storage/azure-storage-common/src/storage_per_retry_policy.cpp b/sdk/storage/azure-storage-common/src/storage_per_retry_policy.cpp index 93e0810cc..59ceb23f9 100644 --- a/sdk/storage/azure-storage-common/src/storage_per_retry_policy.cpp +++ b/sdk/storage/azure-storage-common/src/storage_per_retry_policy.cpp @@ -23,7 +23,7 @@ namespace Azure { namespace Storage { namespace Details { // TODO: call helper function provided by Azure Core when they provide one. time_t t = std::time(nullptr); struct tm ct; -#ifdef AZ_PLATFORM_WINDOWS +#if defined(AZ_PLATFORM_WINDOWS) gmtime_s(&ct, &t); #elif defined(AZ_PLATFORM_POSIX) gmtime_r(&t, &ct); diff --git a/sdk/storage/azure-storage-common/test/test_base.cpp b/sdk/storage/azure-storage-common/test/test_base.cpp index db7a65860..35e71c2ea 100644 --- a/sdk/storage/azure-storage-common/test/test_base.cpp +++ b/sdk/storage/azure-storage-common/test/test_base.cpp @@ -3,7 +3,7 @@ #include -#ifdef _MSC_VER +#if defined(_MSC_VER) #define _CRT_SECURE_NO_WARNINGS #endif @@ -242,7 +242,7 @@ namespace Azure { namespace Storage { namespace Test { { std::time_t epoch_seconds = std::chrono::system_clock::to_time_t(timePoint); struct tm ct; -#ifdef AZ_PLATFORM_WINDOWS +#if defined(AZ_PLATFORM_WINDOWS) gmtime_s(&ct, &epoch_seconds); #elif defined(AZ_PLATFORM_POSIX) gmtime_r(&epoch_seconds, &ct); @@ -271,7 +271,7 @@ namespace Azure { namespace Storage { namespace Test { { std::time_t epoch_seconds = std::chrono::system_clock::to_time_t(timePoint); struct tm ct; -#ifdef AZ_PLATFORM_WINDOWS +#if defined(AZ_PLATFORM_WINDOWS) gmtime_s(&ct, &epoch_seconds); #elif defined(AZ_PLATFORM_POSIX) gmtime_r(&epoch_seconds, &ct); @@ -288,7 +288,7 @@ namespace Azure { namespace Storage { namespace Test { std::stringstream ss(timeStr); ss.imbue(std::locale("C")); ss >> std::get_time(&t, "%a, %d %b %Y %H:%M:%S GMT"); -#ifdef AZ_PLATFORM_WINDOWS +#if defined(AZ_PLATFORM_WINDOWS) time_t tt = _mkgmtime(&t); #elif defined(AZ_PLATFORM_POSIX) time_t tt = timegm(&t);