Fix WebRtc ninja x86 build using Visual Studio 2015 (set GYP_MSVS_VERSION=2015).

Visual Studio 2015 balks at the implicit truncation of values. Easily fixed with an explicit cast.

Fixed redefinition of CLOCKS_PER_SEC when using Visual Studio 2015 and the Windows 10 SDK. CLOCKS_PER_SEC is also defined in "<WIN10 SDK DIR>\include\10.0.10240.0\ucrt\time.h" and also has the value of 1000

Hiding snprintf definition if building with Visual Studio 2015

Fixed C4573 compiler complaint in audio_processing_impl_locking_unittest.cc.

BUG=webrtc:5183

Review URL: https://codereview.webrtc.org/1412653006

Cr-Commit-Position: refs/heads/master@{#11434}
This commit is contained in:
conceptgenesis 2016-01-30 14:40:44 -08:00 committed by Commit bot
parent c97c886e3a
commit 3f70562bbb
6 changed files with 19 additions and 8 deletions

View File

@ -1,12 +1,14 @@
# Names should be added to this file like so: # Names should be added to this file like so:
# Name or Organization <email address> # Name or Organization <email address>
Alexander Brauckmann <a.brauckmann@gmail.com>
Andrew MacDonald <andrew@webrtc.org> Andrew MacDonald <andrew@webrtc.org>
Anil Kumar <an1kumar@gmail.com> Anil Kumar <an1kumar@gmail.com>
Ben Strong <bstrong@gmail.com> Ben Strong <bstrong@gmail.com>
Bob Withers <bwit@pobox.com> Bob Withers <bwit@pobox.com>
Bridger Maxwell <bridgeyman@gmail.com> Bridger Maxwell <bridgeyman@gmail.com>
Christophe Dumez <ch.dumez@samsung.com> Christophe Dumez <ch.dumez@samsung.com>
Cody Barnes <conceptgenesis@gmail.com>
Colin Plumb Colin Plumb
Eric Rescorla, RTFM Inc. <ekr@rtfm.com> Eric Rescorla, RTFM Inc. <ekr@rtfm.com>
Giji Gangadharan <giji.g@samsung.com> Giji Gangadharan <giji.g@samsung.com>
@ -32,7 +34,6 @@ Silviu Caragea <silviu.cpp@gmail.com>
Steve Reid <sreid@sea-to-sky.net> Steve Reid <sreid@sea-to-sky.net>
Vicken Simonian <vsimon@gmail.com> Vicken Simonian <vsimon@gmail.com>
Victor Costan <costan@gmail.com> Victor Costan <costan@gmail.com>
Alexander Brauckmann <a.brauckmann@gmail.com>
&yet LLC &yet LLC
Agora IO Agora IO

View File

@ -13,7 +13,9 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
#include <windows.h> #include <windows.h>
#if _MSC_VER < 1900
#define snprintf _snprintf #define snprintf _snprintf
#endif
#undef ERROR // wingdi.h #undef ERROR // wingdi.h
#endif #endif

View File

@ -33,8 +33,10 @@
//#define FS 16000 /* sampling frequency (Hz) */ //#define FS 16000 /* sampling frequency (Hz) */
#ifdef WIN32 #ifdef WIN32
#ifndef CLOCKS_PER_SEC
#define CLOCKS_PER_SEC 1000 /* Runtime statistics */ #define CLOCKS_PER_SEC 1000 /* Runtime statistics */
#endif #endif
#endif
using namespace std; using namespace std;

View File

@ -17,8 +17,10 @@
#ifdef WIN32 #ifdef WIN32
#include "windows.h" #include "windows.h"
#ifndef CLOCKS_PER_SEC
#define CLOCKS_PER_SEC 1000 #define CLOCKS_PER_SEC 1000
#endif #endif
#endif
#include <ctype.h> #include <ctype.h>
#include <math.h> #include <math.h>
@ -218,7 +220,7 @@ int main(int argc, char* argv[]) {
_makepath(bitrateFileName, outDrive, outPath, "bitrate", ".txt"); _makepath(bitrateFileName, outDrive, outPath, "bitrate", ".txt");
bitrateFile = fopen(bitrateFileName, "a"); bitrateFile = fopen(bitrateFileName, "a");
fprintf(bitrateFile, "% %%s \n", inname); fprintf(bitrateFile, "%% %s \n", inname);
#endif #endif
printf("\n"); printf("\n");

View File

@ -198,8 +198,12 @@ struct TestConfig {
AecType::BasicWebRtcAecSettingsWithDelayAgnosticAec, AecType::BasicWebRtcAecSettingsWithDelayAgnosticAec,
AecType::BasicWebRtcAecSettingsWithAecMobile}; AecType::BasicWebRtcAecSettingsWithAecMobile};
for (auto test_config : in) { for (auto test_config : in) {
for (auto aec_type : aec_types) { // Due to a VisualStudio 2015 compiler issue, the internal loop
test_config.aec_type = aec_type; // variable here cannot override a previously defined name.
// In other words "type" cannot be named "aec_type" here.
// https://connect.microsoft.com/VisualStudio/feedback/details/2291755
for (auto type : aec_types) {
test_config.aec_type = type;
out.push_back(test_config); out.push_back(test_config);
} }
} }

View File

@ -419,9 +419,9 @@ TEST_F(TransientFileUtilsTest, MAYBE_WriteFloatBufferToFile) {
rtc::scoped_ptr<float[]> written_buffer(new float[kBufferLength]); rtc::scoped_ptr<float[]> written_buffer(new float[kBufferLength]);
rtc::scoped_ptr<float[]> read_buffer(new float[kBufferLength]); rtc::scoped_ptr<float[]> read_buffer(new float[kBufferLength]);
written_buffer[0] = kPi; written_buffer[0] = static_cast<float>(kPi);
written_buffer[1] = kE; written_buffer[1] = static_cast<float>(kE);
written_buffer[2] = kAvogadro; written_buffer[2] = static_cast<float>(kAvogadro);
EXPECT_EQ(kBufferLength, WriteFloatBufferToFile(file.get(), EXPECT_EQ(kBufferLength, WriteFloatBufferToFile(file.get(),
kBufferLength, kBufferLength,