Remove std:: prefixes from C functions in webrtc/.
std::memcpy -> memcpy for instance. This change was motivated by a compile report complaining that std::rand() was used instead of rand(), probably with a stdlib.h include instead of cstdlib. Use of C functions without the std:: prefix is a lot more common, so removing std:: to address this. BUG= R=tommi@webrtc.org Review URL: https://webrtc-codereview.appspot.com/9549004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5658 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include "webrtc/modules/audio_coding/main/acm2/call_statistics.h"
|
#include "webrtc/modules/audio_coding/main/acm2/call_statistics.h"
|
||||||
|
|
||||||
#include <cassert>
|
#include <assert.h>
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
* be found in the AUTHORS file in the root of the source tree.
|
* be found in the AUTHORS file in the root of the source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cstring>
|
#include <string.h>
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
#include "webrtc/modules/audio_coding/main/acm2/initial_delay_manager.h"
|
#include "webrtc/modules/audio_coding/main/acm2/initial_delay_manager.h"
|
||||||
|
@@ -14,10 +14,10 @@
|
|||||||
|
|
||||||
#include "webrtc/modules/audio_coding/neteq4/interface/neteq.h"
|
#include "webrtc/modules/audio_coding/neteq4/interface/neteq.h"
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h> // memset
|
#include <string.h> // memset
|
||||||
|
|
||||||
#include <cmath>
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include "webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
|
#include "webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
|
||||||
|
|
||||||
#include <cstddef>
|
#include <stddef.h>
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
@@ -10,13 +10,14 @@
|
|||||||
|
|
||||||
#include "webrtc/modules/desktop_capture/window_capturer.h"
|
#include "webrtc/modules/desktop_capture/window_capturer.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <X11/extensions/Xcomposite.h>
|
#include <X11/extensions/Xcomposite.h>
|
||||||
#include <X11/extensions/Xrender.h>
|
#include <X11/extensions/Xrender.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
|
#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
|
||||||
#include "webrtc/modules/desktop_capture/desktop_frame.h"
|
#include "webrtc/modules/desktop_capture/desktop_frame.h"
|
||||||
|
@@ -10,8 +10,9 @@
|
|||||||
|
|
||||||
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_baselinefile.h"
|
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_baselinefile.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdio>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_fileutils.h"
|
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_fileutils.h"
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
#else
|
#else
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#endif
|
#endif
|
||||||
#include <cassert>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h"
|
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h"
|
||||||
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||||
|
@@ -11,7 +11,8 @@
|
|||||||
#ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_TEST_FILEUTILS_H_
|
#ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_TEST_FILEUTILS_H_
|
||||||
#define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_TEST_FILEUTILS_H_
|
#define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_TEST_FILEUTILS_H_
|
||||||
|
|
||||||
#include <cstdio>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "webrtc/modules/interface/module_common_types.h"
|
#include "webrtc/modules/interface/module_common_types.h"
|
||||||
|
@@ -10,7 +10,8 @@
|
|||||||
|
|
||||||
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h"
|
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
@@ -83,7 +84,7 @@ int Random::Gaussian(int mean, int standard_deviation) {
|
|||||||
a_ ^= b_;
|
a_ ^= b_;
|
||||||
b_ += a_;
|
b_ += a_;
|
||||||
return static_cast<int>(mean + standard_deviation *
|
return static_cast<int>(mean + standard_deviation *
|
||||||
std::sqrt(-2 * std::log(u1)) * std::cos(2 * kPi * u2));
|
sqrt(-2 * log(u1)) * cos(2 * kPi * u2));
|
||||||
}
|
}
|
||||||
|
|
||||||
Packet::Packet()
|
Packet::Packet()
|
||||||
|
@@ -11,9 +11,10 @@
|
|||||||
#ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_TEST_FRAMEWORK_H_
|
#ifndef WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_TEST_FRAMEWORK_H_
|
||||||
#define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_TEST_FRAMEWORK_H_
|
#define WEBRTC_MODULES_REMOTE_BITRATE_ESTIMATOR_TEST_BWE_TEST_FRAMEWORK_H_
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
|
||||||
#include <cmath>
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <numeric>
|
#include <numeric>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -71,7 +72,7 @@ template<typename T> class Stats {
|
|||||||
return variance_;
|
return variance_;
|
||||||
}
|
}
|
||||||
T GetStdDev() {
|
T GetStdDev() {
|
||||||
return std::sqrt(static_cast<double>(GetVariance()));
|
return sqrt(static_cast<double>(GetVariance()));
|
||||||
}
|
}
|
||||||
T GetMin() {
|
T GetMin() {
|
||||||
RefreshMinMax();
|
RefreshMinMax();
|
||||||
|
@@ -41,12 +41,12 @@ TEST(BweTestFramework_RandomTest, Gaussian) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const double kPi = 3.14159265358979323846;
|
const double kPi = 3.14159265358979323846;
|
||||||
const double kScale = kN / (kStddev * std::sqrt(2.0 * kPi));
|
const double kScale = kN / (kStddev * sqrt(2.0 * kPi));
|
||||||
const double kDiv = -2.0 * kStddev * kStddev;
|
const double kDiv = -2.0 * kStddev * kStddev;
|
||||||
double self_corr = 0.0;
|
double self_corr = 0.0;
|
||||||
double bucket_corr = 0.0;
|
double bucket_corr = 0.0;
|
||||||
for (int n = 0; n < kBuckets; ++n) {
|
for (int n = 0; n < kBuckets; ++n) {
|
||||||
double normal_dist = kScale * std::exp((n - kMean) * (n - kMean) / kDiv);
|
double normal_dist = kScale * exp((n - kMean) * (n - kMean) / kDiv);
|
||||||
self_corr += normal_dist * normal_dist;
|
self_corr += normal_dist * normal_dist;
|
||||||
bucket_corr += normal_dist * buckets[n];
|
bucket_corr += normal_dist * buckets[n];
|
||||||
}
|
}
|
||||||
|
@@ -12,9 +12,10 @@
|
|||||||
|
|
||||||
#if BWE_TEST_LOGGING_COMPILE_TIME_ENABLE
|
#if BWE_TEST_LOGGING_COMPILE_TIME_ENABLE
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdarg>
|
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||||
#include "webrtc/system_wrappers/interface/thread_wrapper.h"
|
#include "webrtc/system_wrappers/interface/thread_wrapper.h"
|
||||||
|
@@ -90,7 +90,7 @@ inline double PacketManipulatorImpl::RandomUniform() {
|
|||||||
// get the same behavior as long as we're using a fixed initial seed.
|
// get the same behavior as long as we're using a fixed initial seed.
|
||||||
critsect_->Enter();
|
critsect_->Enter();
|
||||||
srand(random_seed_);
|
srand(random_seed_);
|
||||||
random_seed_ = std::rand();
|
random_seed_ = rand();
|
||||||
critsect_->Leave();
|
critsect_->Leave();
|
||||||
return (random_seed_ + 1.0)/(RAND_MAX + 1.0);
|
return (random_seed_ + 1.0)/(RAND_MAX + 1.0);
|
||||||
}
|
}
|
||||||
|
@@ -41,7 +41,7 @@ protected:
|
|||||||
virtual void Teardown();
|
virtual void Teardown();
|
||||||
double ActualBitRate(int nFrames);
|
double ActualBitRate(int nFrames);
|
||||||
virtual bool PacketLoss(double lossRate, int /*thrown*/);
|
virtual bool PacketLoss(double lossRate, int /*thrown*/);
|
||||||
static double RandUniform() { return (std::rand() + 1.0)/(RAND_MAX + 1.0); }
|
static double RandUniform() { return (rand() + 1.0)/(RAND_MAX + 1.0); }
|
||||||
static void VideoEncodedBufferToEncodedImage(
|
static void VideoEncodedBufferToEncodedImage(
|
||||||
webrtc::VideoFrame& videoBuffer,
|
webrtc::VideoFrame& videoBuffer,
|
||||||
webrtc::EncodedImage &image);
|
webrtc::EncodedImage &image);
|
||||||
|
@@ -17,7 +17,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
double const pi = 4*std::atan(1.0);
|
double const pi = 4 * atan(1.0);
|
||||||
|
|
||||||
class GaussDist
|
class GaussDist
|
||||||
{
|
{
|
||||||
@@ -26,9 +26,10 @@ public:
|
|||||||
|
|
||||||
double RandValue() // returns a single normally distributed number
|
double RandValue() // returns a single normally distributed number
|
||||||
{
|
{
|
||||||
double r1 = (std::rand() + 1.0)/(RAND_MAX + 1.0); // gives equal distribution in (0, 1]
|
double r1 = (rand() + 1.0) /
|
||||||
double r2 = (std::rand() + 1.0)/(RAND_MAX + 1.0);
|
(RAND_MAX + 1.0); // gives equal distribution in (0, 1]
|
||||||
return _mu + _sigma * sqrt(-2*std::log(r1))*std::cos(2*pi*r2);
|
double r2 = (rand() + 1.0) / (RAND_MAX + 1.0);
|
||||||
|
return _mu + _sigma * sqrt(-2 * log(r1)) * cos(2 * pi * r2);
|
||||||
}
|
}
|
||||||
|
|
||||||
double GetAverage()
|
double GetAverage()
|
||||||
@@ -86,7 +87,7 @@ public:
|
|||||||
void SetLossRate(double rate);
|
void SetLossRate(double rate);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double RandUniform() { return (std::rand() + 1.0)/(RAND_MAX + 1.0); }
|
double RandUniform() { return (rand() + 1.0)/(RAND_MAX + 1.0); }
|
||||||
unsigned int _frameRate;
|
unsigned int _frameRate;
|
||||||
unsigned int _capacity;
|
unsigned int _capacity;
|
||||||
unsigned int _rate;
|
unsigned int _rate;
|
||||||
|
@@ -406,7 +406,7 @@ RTPSendCompleteCallback::PacketLoss()
|
|||||||
bool
|
bool
|
||||||
RTPSendCompleteCallback::UnifomLoss(double lossPct)
|
RTPSendCompleteCallback::UnifomLoss(double lossPct)
|
||||||
{
|
{
|
||||||
double randVal = (std::rand() + 1.0)/(RAND_MAX + 1.0);
|
double randVal = (rand() + 1.0) / (RAND_MAX + 1.0);
|
||||||
return randVal < lossPct/100;
|
return randVal < lossPct/100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_TEMPLATE_UTIL_H_
|
#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_TEMPLATE_UTIL_H_
|
||||||
#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_TEMPLATE_UTIL_H_
|
#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_TEMPLATE_UTIL_H_
|
||||||
|
|
||||||
#include <cstddef> // For size_t.
|
#include <stddef.h> // For size_t.
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user