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
diff --git a/webrtc/modules/audio_coding/main/acm2/call_statistics.cc b/webrtc/modules/audio_coding/main/acm2/call_statistics.cc
index 9153325..4c3e9fc 100644
--- a/webrtc/modules/audio_coding/main/acm2/call_statistics.cc
+++ b/webrtc/modules/audio_coding/main/acm2/call_statistics.cc
@@ -10,7 +10,7 @@
#include "webrtc/modules/audio_coding/main/acm2/call_statistics.h"
-#include <cassert>
+#include <assert.h>
namespace webrtc {
diff --git a/webrtc/modules/audio_coding/main/acm2/initial_delay_manager_unittest.cc b/webrtc/modules/audio_coding/main/acm2/initial_delay_manager_unittest.cc
index 1e129f3..15e88a5 100644
--- a/webrtc/modules/audio_coding/main/acm2/initial_delay_manager_unittest.cc
+++ b/webrtc/modules/audio_coding/main/acm2/initial_delay_manager_unittest.cc
@@ -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"
diff --git a/webrtc/modules/audio_coding/neteq4/neteq_unittest.cc b/webrtc/modules/audio_coding/neteq4/neteq_unittest.cc
index b337276..32f5bf4 100644
--- a/webrtc/modules/audio_coding/neteq4/neteq_unittest.cc
+++ b/webrtc/modules/audio_coding/neteq4/neteq_unittest.cc
@@ -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>
diff --git a/webrtc/modules/desktop_capture/mouse_cursor_monitor_null.cc b/webrtc/modules/desktop_capture/mouse_cursor_monitor_null.cc
index 94a20e1..3a632cc 100644
--- a/webrtc/modules/desktop_capture/mouse_cursor_monitor_null.cc
+++ b/webrtc/modules/desktop_capture/mouse_cursor_monitor_null.cc
@@ -10,7 +10,7 @@
#include "webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
-#include <cstddef>
+#include <stddef.h>
namespace webrtc {
diff --git a/webrtc/modules/desktop_capture/window_capturer_x11.cc b/webrtc/modules/desktop_capture/window_capturer_x11.cc
index 3d51794..473231f 100755
--- a/webrtc/modules/desktop_capture/window_capturer_x11.cc
+++ b/webrtc/modules/desktop_capture/window_capturer_x11.cc
@@ -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"
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_baselinefile.cc b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_baselinefile.cc
index 30723be..48b66a4 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_baselinefile.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_baselinefile.cc
@@ -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"
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_fileutils.cc b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_fileutils.cc
index 4e5d407..0d2021e 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_fileutils.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_fileutils.cc
@@ -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"
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_fileutils.h b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_fileutils.h
index 397a169..dddbdeeb2 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_fileutils.h
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_fileutils.h
@@ -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"
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc
index 86506fb..f93b148 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.cc
@@ -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 @@
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()
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h
index f5bd326..8d2bf80 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework.h
@@ -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 @@
return variance_;
}
T GetStdDev() {
- return std::sqrt(static_cast<double>(GetVariance()));
+ return sqrt(static_cast<double>(GetVariance()));
}
T GetMin() {
RefreshMinMax();
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework_unittest.cc b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework_unittest.cc
index 31bb27e..274dc76 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework_unittest.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_framework_unittest.cc
@@ -41,12 +41,12 @@
}
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];
}
diff --git a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.cc b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.cc
index 1a43f09..65369fd 100644
--- a/webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.cc
+++ b/webrtc/modules/remote_bitrate_estimator/test/bwe_test_logging.cc
@@ -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"
diff --git a/webrtc/modules/video_coding/codecs/test/packet_manipulator.cc b/webrtc/modules/video_coding/codecs/test/packet_manipulator.cc
index 0583e9e..f4ca92a 100644
--- a/webrtc/modules/video_coding/codecs/test/packet_manipulator.cc
+++ b/webrtc/modules/video_coding/codecs/test/packet_manipulator.cc
@@ -90,7 +90,7 @@
// 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);
}
diff --git a/webrtc/modules/video_coding/codecs/test_framework/test.h b/webrtc/modules/video_coding/codecs/test_framework/test.h
index 890d0cb..7558abe 100644
--- a/webrtc/modules/video_coding/codecs/test_framework/test.h
+++ b/webrtc/modules/video_coding/codecs/test_framework/test.h
@@ -41,7 +41,7 @@
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);
diff --git a/webrtc/modules/video_coding/main/test/jitter_estimate_test.h b/webrtc/modules/video_coding/main/test/jitter_estimate_test.h
index 9318a49..dd349b2 100644
--- a/webrtc/modules/video_coding/main/test/jitter_estimate_test.h
+++ b/webrtc/modules/video_coding/main/test/jitter_estimate_test.h
@@ -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 @@
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 @@
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;
diff --git a/webrtc/modules/video_coding/main/test/test_callbacks.cc b/webrtc/modules/video_coding/main/test/test_callbacks.cc
index 8e96776..710a06e 100644
--- a/webrtc/modules/video_coding/main/test/test_callbacks.cc
+++ b/webrtc/modules/video_coding/main/test/test_callbacks.cc
@@ -406,7 +406,7 @@
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;
}
diff --git a/webrtc/system_wrappers/interface/template_util.h b/webrtc/system_wrappers/interface/template_util.h
index 5ae415b..410e04c 100644
--- a/webrtc/system_wrappers/interface/template_util.h
+++ b/webrtc/system_wrappers/interface/template_util.h
@@ -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 {