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:
pbos@webrtc.org
2014-03-07 15:23:34 +00:00
parent 371243dfa3
commit 3ecc162d01
17 changed files with 33 additions and 26 deletions

View File

@@ -10,7 +10,7 @@
#include "webrtc/modules/audio_coding/main/acm2/call_statistics.h"
#include <cassert>
#include <assert.h>
namespace webrtc {

View File

@@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <cstring>
#include <string.h>
#include "gtest/gtest.h"
#include "webrtc/modules/audio_coding/main/acm2/initial_delay_manager.h"

View File

@@ -14,10 +14,10 @@
#include "webrtc/modules/audio_coding/neteq4/interface/neteq.h"
#include <math.h>
#include <stdlib.h>
#include <string.h> // memset
#include <cmath>
#include <set>
#include <string>
#include <vector>

View File

@@ -10,7 +10,7 @@
#include "webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
#include <cstddef>
#include <stddef.h>
namespace webrtc {

View File

@@ -10,13 +10,14 @@
#include "webrtc/modules/desktop_capture/window_capturer.h"
#include <assert.h>
#include <string.h>
#include <X11/Xatom.h>
#include <X11/extensions/Xcomposite.h>
#include <X11/extensions/Xrender.h>
#include <X11/Xutil.h>
#include <algorithm>
#include <cassert>
#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
#include "webrtc/modules/desktop_capture/desktop_frame.h"

View File

@@ -10,8 +10,9 @@
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_baselinefile.h"
#include <stdio.h>
#include <algorithm>
#include <cstdio>
#include <vector>
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_fileutils.h"

View File

@@ -15,7 +15,7 @@
#else
#include <arpa/inet.h>
#endif
#include <cassert>
#include <assert.h>
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.h"
#include "webrtc/system_wrappers/interface/scoped_ptr.h"

View File

@@ -11,7 +11,8 @@
#ifndef 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 "webrtc/modules/interface/module_common_types.h"

View File

@@ -10,7 +10,8 @@
#include "webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h"
#include <cstdio>
#include <stdio.h>
#include <sstream>
namespace webrtc {
@@ -83,7 +84,7 @@ int Random::Gaussian(int mean, int standard_deviation) {
a_ ^= b_;
b_ += a_;
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()

View File

@@ -11,9 +11,10 @@
#ifndef 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 <cassert>
#include <cmath>
#include <list>
#include <numeric>
#include <string>
@@ -71,7 +72,7 @@ template<typename T> class Stats {
return variance_;
}
T GetStdDev() {
return std::sqrt(static_cast<double>(GetVariance()));
return sqrt(static_cast<double>(GetVariance()));
}
T GetMin() {
RefreshMinMax();

View File

@@ -41,12 +41,12 @@ TEST(BweTestFramework_RandomTest, Gaussian) {
}
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;
double self_corr = 0.0;
double bucket_corr = 0.0;
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;
bucket_corr += normal_dist * buckets[n];
}

View File

@@ -12,9 +12,10 @@
#if BWE_TEST_LOGGING_COMPILE_TIME_ENABLE
#include <stdarg.h>
#include <stdio.h>
#include <algorithm>
#include <cstdarg>
#include <cstdio>
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
#include "webrtc/system_wrappers/interface/thread_wrapper.h"

View File

@@ -90,7 +90,7 @@ inline double PacketManipulatorImpl::RandomUniform() {
// get the same behavior as long as we're using a fixed initial seed.
critsect_->Enter();
srand(random_seed_);
random_seed_ = std::rand();
random_seed_ = rand();
critsect_->Leave();
return (random_seed_ + 1.0)/(RAND_MAX + 1.0);
}

View File

@@ -41,7 +41,7 @@ protected:
virtual void Teardown();
double ActualBitRate(int nFrames);
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(
webrtc::VideoFrame& videoBuffer,
webrtc::EncodedImage &image);

View File

@@ -17,7 +17,7 @@
#include <stdlib.h>
#include <math.h>
double const pi = 4*std::atan(1.0);
double const pi = 4 * atan(1.0);
class GaussDist
{
@@ -26,9 +26,10 @@ public:
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 r2 = (std::rand() + 1.0)/(RAND_MAX + 1.0);
return _mu + _sigma * sqrt(-2*std::log(r1))*std::cos(2*pi*r2);
double r1 = (rand() + 1.0) /
(RAND_MAX + 1.0); // gives equal distribution in (0, 1]
double r2 = (rand() + 1.0) / (RAND_MAX + 1.0);
return _mu + _sigma * sqrt(-2 * log(r1)) * cos(2 * pi * r2);
}
double GetAverage()
@@ -86,7 +87,7 @@ public:
void SetLossRate(double rate);
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 _capacity;
unsigned int _rate;

View File

@@ -406,7 +406,7 @@ RTPSendCompleteCallback::PacketLoss()
bool
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;
}

View File

@@ -13,7 +13,7 @@
#ifndef 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 {