diff --git a/talk/app/webrtc/webrtcsession.cc b/talk/app/webrtc/webrtcsession.cc index b72291c5e..2f70ea096 100644 --- a/talk/app/webrtc/webrtcsession.cc +++ b/talk/app/webrtc/webrtcsession.cc @@ -27,8 +27,9 @@ #include "talk/app/webrtc/webrtcsession.h" +#include + #include -#include #include #include "talk/app/webrtc/jsepicecandidate.h" diff --git a/talk/base/asynctcpsocket.cc b/talk/base/asynctcpsocket.cc index 6e390b448..781fb0ade 100644 --- a/talk/base/asynctcpsocket.cc +++ b/talk/base/asynctcpsocket.cc @@ -27,7 +27,7 @@ #include "talk/base/asynctcpsocket.h" -#include +#include #include "talk/base/byteorder.h" #include "talk/base/common.h" diff --git a/talk/base/buffer.h b/talk/base/buffer.h index 47096332c..2d589f27e 100644 --- a/talk/base/buffer.h +++ b/talk/base/buffer.h @@ -28,7 +28,7 @@ #ifndef TALK_BASE_BUFFER_H_ #define TALK_BASE_BUFFER_H_ -#include +#include #include "talk/base/scoped_ptr.h" diff --git a/talk/base/bytebuffer.cc b/talk/base/bytebuffer.cc index 523475d82..396a1d342 100644 --- a/talk/base/bytebuffer.cc +++ b/talk/base/bytebuffer.cc @@ -27,9 +27,10 @@ #include "talk/base/bytebuffer.h" +#include +#include + #include -#include -#include #include "talk/base/basictypes.h" #include "talk/base/byteorder.h" diff --git a/talk/base/cryptstring.h b/talk/base/cryptstring.h index eb39be229..600474f2a 100644 --- a/talk/base/cryptstring.h +++ b/talk/base/cryptstring.h @@ -28,9 +28,11 @@ #ifndef _TALK_BASE_CRYPTSTRING_H_ #define _TALK_BASE_CRYPTSTRING_H_ -#include +#include + #include #include + #include "talk/base/linked_ptr.h" #include "talk/base/scoped_ptr.h" diff --git a/talk/base/fakesslidentity.h b/talk/base/fakesslidentity.h index ee0e0a2dc..fbe5e6484 100644 --- a/talk/base/fakesslidentity.h +++ b/talk/base/fakesslidentity.h @@ -68,9 +68,10 @@ class FakeSSLCertificate : public talk_base::SSLCertificate { *algorithm = digest_algorithm_; return true; } - virtual bool ComputeDigest(const std::string &algorithm, - unsigned char *digest, std::size_t size, - std::size_t *length) const { + virtual bool ComputeDigest(const std::string& algorithm, + unsigned char* digest, + size_t size, + size_t* length) const { *length = talk_base::ComputeDigest(algorithm, data_.c_str(), data_.size(), digest, size); return (*length != 0); diff --git a/talk/base/fileutils.cc b/talk/base/fileutils.cc index d73997afe..72797f3d0 100644 --- a/talk/base/fileutils.cc +++ b/talk/base/fileutils.cc @@ -25,7 +25,7 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #ifdef WIN32 // TODO(grunell): Remove io.h includes when Chromium has started diff --git a/talk/base/firewallsocketserver.cc b/talk/base/firewallsocketserver.cc index be8f2e183..4a8a66d43 100644 --- a/talk/base/firewallsocketserver.cc +++ b/talk/base/firewallsocketserver.cc @@ -27,7 +27,8 @@ #include "talk/base/firewallsocketserver.h" -#include +#include + #include #include "talk/base/asyncsocket.h" diff --git a/talk/base/json.cc b/talk/base/json.cc index af81e0694..6b9fce1ae 100644 --- a/talk/base/json.cc +++ b/talk/base/json.cc @@ -28,9 +28,9 @@ #include "talk/base/json.h" #include +#include +#include -#include -#include #include bool GetStringFromJson(const Json::Value& in, std::string* out) { diff --git a/talk/base/messagequeue.h b/talk/base/messagequeue.h index 7b38ba008..fc72166e4 100644 --- a/talk/base/messagequeue.h +++ b/talk/base/messagequeue.h @@ -28,8 +28,9 @@ #ifndef TALK_BASE_MESSAGEQUEUE_H_ #define TALK_BASE_MESSAGEQUEUE_H_ +#include + #include -#include #include #include #include diff --git a/talk/base/natserver.cc b/talk/base/natserver.cc index 48ea3cd4f..f69baa0c4 100644 --- a/talk/base/natserver.cc +++ b/talk/base/natserver.cc @@ -155,7 +155,7 @@ void NATServer::OnExternalPacket( remote_addr); // Copy the data part after the address. talk_base::PacketOptions options; - std::memcpy(real_buf.get() + addrlength, buf, size); + memcpy(real_buf.get() + addrlength, buf, size); server_socket_->SendTo(real_buf.get(), size + addrlength, iter->second->route.source(), options); } diff --git a/talk/base/natsocketfactory.cc b/talk/base/natsocketfactory.cc index 395069e66..6ce09fd25 100644 --- a/talk/base/natsocketfactory.cc +++ b/talk/base/natsocketfactory.cc @@ -47,12 +47,12 @@ size_t PackAddressForNAT(char* buf, size_t buf_size, if (family == AF_INET) { ASSERT(buf_size >= kNATEncodedIPv4AddressSize); in_addr v4addr = ip.ipv4_address(); - std::memcpy(&buf[4], &v4addr, kNATEncodedIPv4AddressSize - 4); + memcpy(&buf[4], &v4addr, kNATEncodedIPv4AddressSize - 4); return kNATEncodedIPv4AddressSize; } else if (family == AF_INET6) { ASSERT(buf_size >= kNATEncodedIPv6AddressSize); in6_addr v6addr = ip.ipv6_address(); - std::memcpy(&buf[4], &v6addr, kNATEncodedIPv6AddressSize - 4); + memcpy(&buf[4], &v6addr, kNATEncodedIPv6AddressSize - 4); return kNATEncodedIPv6AddressSize; } return 0U; @@ -159,7 +159,7 @@ class NATSocket : public AsyncSocket, public sigslot::has_slots<> { size + kNATEncodedIPv6AddressSize, addr); size_t encoded_size = size + addrlength; - std::memcpy(buf.get() + addrlength, data, size); + memcpy(buf.get() + addrlength, data, size); int result = socket_->SendTo(buf.get(), encoded_size, server_addr_); if (result >= 0) { ASSERT(result == static_cast(encoded_size)); @@ -196,7 +196,7 @@ class NATSocket : public AsyncSocket, public sigslot::has_slots<> { SocketAddress real_remote_addr; size_t addrlength = UnpackAddressFromNAT(buf_, result, &real_remote_addr); - std::memcpy(data, buf_ + addrlength, result - addrlength); + memcpy(data, buf_ + addrlength, result - addrlength); // Make sure this packet should be delivered before returning it. if (!connected_ || (real_remote_addr == remote_addr_)) { diff --git a/talk/base/nattypes.cc b/talk/base/nattypes.cc index 290c3adde..da1d01161 100644 --- a/talk/base/nattypes.cc +++ b/talk/base/nattypes.cc @@ -25,7 +25,7 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include "talk/base/nattypes.h" diff --git a/talk/base/nethelpers.h b/talk/base/nethelpers.h index a49f48ac7..5b385bbc5 100644 --- a/talk/base/nethelpers.h +++ b/talk/base/nethelpers.h @@ -30,7 +30,7 @@ #ifdef POSIX #include -#include +#include #elif WIN32 #include // NOLINT #endif diff --git a/talk/base/network.cc b/talk/base/network.cc index 95a2e4d81..49901138b 100644 --- a/talk/base/network.cc +++ b/talk/base/network.cc @@ -60,8 +60,9 @@ #include #endif +#include + #include -#include #include "talk/base/logging.h" #include "talk/base/scoped_ptr.h" diff --git a/talk/base/nssidentity.cc b/talk/base/nssidentity.cc index 05c82de8a..8c020a6b4 100644 --- a/talk/base/nssidentity.cc +++ b/talk/base/nssidentity.cc @@ -211,8 +211,8 @@ bool NSSCertificate::IsValidChain(const CERTCertList* cert_list) { return true; } -bool NSSCertificate::GetDigestLength(const std::string &algorithm, - std::size_t *length) { +bool NSSCertificate::GetDigestLength(const std::string& algorithm, + size_t* length) { const SECHashObject *ho; if (!GetDigestObject(algorithm, &ho)) @@ -271,9 +271,10 @@ bool NSSCertificate::GetSignatureDigestAlgorithm(std::string* algorithm) const { return true; } -bool NSSCertificate::ComputeDigest(const std::string &algorithm, - unsigned char *digest, std::size_t size, - std::size_t *length) const { +bool NSSCertificate::ComputeDigest(const std::string& algorithm, + unsigned char* digest, + size_t size, + size_t* length) const { const SECHashObject *ho; if (!GetDigestObject(algorithm, &ho)) diff --git a/talk/base/nssidentity.h b/talk/base/nssidentity.h index 7bf7c6519..b4376d521 100644 --- a/talk/base/nssidentity.h +++ b/talk/base/nssidentity.h @@ -84,8 +84,9 @@ class NSSCertificate : public SSLCertificate { virtual bool GetSignatureDigestAlgorithm(std::string* algorithm) const; virtual bool ComputeDigest(const std::string& algorithm, - unsigned char* digest, std::size_t size, - std::size_t* length) const; + unsigned char* digest, + size_t size, + size_t* length) const; virtual bool GetChain(SSLCertChain** chain) const; @@ -97,8 +98,7 @@ class NSSCertificate : public SSLCertificate { static bool IsValidChain(const CERTCertList* cert_list); // Helper function to get the length of a digest - static bool GetDigestLength(const std::string& algorithm, - std::size_t* length); + static bool GetDigestLength(const std::string& algorithm, size_t* length); // Comparison. Only the certificate itself is considered, not the chain. bool Equals(const NSSCertificate* tocompare) const; diff --git a/talk/base/nssstreamadapter.cc b/talk/base/nssstreamadapter.cc index ca7fa74e9..60fa738b3 100644 --- a/talk/base/nssstreamadapter.cc +++ b/talk/base/nssstreamadapter.cc @@ -825,7 +825,7 @@ SECStatus NSSStreamAdapter::AuthCertificateHook(void *arg, LOG(LS_INFO) << "Checking against specified digest"; // The peer certificate digest was specified unsigned char digest[64]; // Maximum size - std::size_t digest_length; + size_t digest_length; if (!peer_cert.ComputeDigest( stream->peer_certificate_digest_algorithm_, diff --git a/talk/base/nssstreamadapter.h b/talk/base/nssstreamadapter.h index 219f6193f..3919c5a15 100644 --- a/talk/base/nssstreamadapter.h +++ b/talk/base/nssstreamadapter.h @@ -103,8 +103,7 @@ class NSSStreamAdapter : public SSLStreamAdapterHelper { // Override SSLStreamAdapterHelper virtual int BeginSSL(); virtual void Cleanup(); - virtual bool GetDigestLength(const std::string &algorithm, - std::size_t *length) { + virtual bool GetDigestLength(const std::string& algorithm, size_t* length) { return NSSCertificate::GetDigestLength(algorithm, length); } diff --git a/talk/base/opensslidentity.cc b/talk/base/opensslidentity.cc index bd361d10f..a58f83967 100644 --- a/talk/base/opensslidentity.cc +++ b/talk/base/opensslidentity.cc @@ -235,18 +235,18 @@ bool OpenSSLCertificate::GetSignatureDigestAlgorithm( EVP_get_digestbyobj(x509_->sig_alg->algorithm), algorithm); } -bool OpenSSLCertificate::ComputeDigest(const std::string &algorithm, - unsigned char *digest, - std::size_t size, - std::size_t *length) const { +bool OpenSSLCertificate::ComputeDigest(const std::string& algorithm, + unsigned char* digest, + size_t size, + size_t* length) const { return ComputeDigest(x509_, algorithm, digest, size, length); } -bool OpenSSLCertificate::ComputeDigest(const X509 *x509, - const std::string &algorithm, - unsigned char *digest, - std::size_t size, - std::size_t *length) { +bool OpenSSLCertificate::ComputeDigest(const X509* x509, + const std::string& algorithm, + unsigned char* digest, + size_t size, + size_t* length) { const EVP_MD *md; unsigned int n; diff --git a/talk/base/opensslidentity.h b/talk/base/opensslidentity.h index ede731855..84b28261e 100644 --- a/talk/base/opensslidentity.h +++ b/talk/base/opensslidentity.h @@ -94,16 +94,17 @@ class OpenSSLCertificate : public SSLCertificate { virtual void ToDER(Buffer* der_buffer) const; // Compute the digest of the certificate given algorithm - virtual bool ComputeDigest(const std::string &algorithm, - unsigned char *digest, std::size_t size, - std::size_t *length) const; + virtual bool ComputeDigest(const std::string& algorithm, + unsigned char* digest, + size_t size, + size_t* length) const; // Compute the digest of a certificate as an X509 * - static bool ComputeDigest(const X509 *x509, - const std::string &algorithm, - unsigned char *digest, - std::size_t size, - std::size_t *length); + static bool ComputeDigest(const X509* x509, + const std::string& algorithm, + unsigned char* digest, + size_t size, + size_t* length); virtual bool GetSignatureDigestAlgorithm(std::string* algorithm) const; diff --git a/talk/base/opensslstreamadapter.cc b/talk/base/opensslstreamadapter.cc index ba88a6853..08798a158 100644 --- a/talk/base/opensslstreamadapter.cc +++ b/talk/base/opensslstreamadapter.cc @@ -780,7 +780,7 @@ int OpenSSLStreamAdapter::SSLVerifyCallback(int ok, X509_STORE_CTX* store) { } X509* cert = X509_STORE_CTX_get_current_cert(store); unsigned char digest[EVP_MAX_MD_SIZE]; - std::size_t digest_length; + size_t digest_length; if (!OpenSSLCertificate::ComputeDigest( cert, stream->peer_certificate_digest_algorithm_, diff --git a/talk/base/physicalsocketserver.cc b/talk/base/physicalsocketserver.cc index 07a9d4b01..a16e5802c 100644 --- a/talk/base/physicalsocketserver.cc +++ b/talk/base/physicalsocketserver.cc @@ -29,7 +29,7 @@ #pragma warning(disable:4786) #endif -#include +#include #ifdef POSIX #include diff --git a/talk/base/refcount.h b/talk/base/refcount.h index 38cf14762..e8950e9b0 100644 --- a/talk/base/refcount.h +++ b/talk/base/refcount.h @@ -28,7 +28,7 @@ #ifndef TALK_APP_BASE_REFCOUNT_H_ #define TALK_APP_BASE_REFCOUNT_H_ -#include +#include #include "talk/base/criticalsection.h" diff --git a/talk/base/scoped_ptr.h b/talk/base/scoped_ptr.h index 90f743c62..5158a9e69 100644 --- a/talk/base/scoped_ptr.h +++ b/talk/base/scoped_ptr.h @@ -88,8 +88,8 @@ #ifndef TALK_BASE_SCOPED_PTR_H__ #define TALK_BASE_SCOPED_PTR_H__ -#include // for std::ptrdiff_t -#include // for free() decl +#include // for ptrdiff_t +#include // for free() decl #include // For std::swap(). diff --git a/talk/base/sslidentity.h b/talk/base/sslidentity.h index 00ec53349..b930f063c 100644 --- a/talk/base/sslidentity.h +++ b/talk/base/sslidentity.h @@ -81,9 +81,10 @@ class SSLCertificate { virtual bool GetSignatureDigestAlgorithm(std::string* algorithm) const = 0; // Compute the digest of the certificate given algorithm - virtual bool ComputeDigest(const std::string &algorithm, - unsigned char* digest, std::size_t size, - std::size_t* length) const = 0; + virtual bool ComputeDigest(const std::string& algorithm, + unsigned char* digest, + size_t size, + size_t* length) const = 0; }; // SSLCertChain is a simple wrapper for a vector of SSLCertificates. It serves diff --git a/talk/base/sslstreamadapterhelper.h b/talk/base/sslstreamadapterhelper.h index e0eed3e4e..5023d52ec 100644 --- a/talk/base/sslstreamadapterhelper.h +++ b/talk/base/sslstreamadapterhelper.h @@ -87,8 +87,8 @@ class SSLStreamAdapterHelper : public SSLStreamAdapter { // Must be implemented by descendents virtual int BeginSSL() = 0; virtual void Cleanup() = 0; - virtual bool GetDigestLength(const std::string &algorithm, - std::size_t *length) = 0; + virtual bool GetDigestLength(const std::string& algorithm, + size_t* length) = 0; enum SSLState { // Before calling one of the StartSSL methods, data flows diff --git a/talk/base/stringencode.cc b/talk/base/stringencode.cc index 194848e1e..4c88a9772 100644 --- a/talk/base/stringencode.cc +++ b/talk/base/stringencode.cc @@ -27,8 +27,8 @@ #include "talk/base/stringencode.h" -#include -#include +#include +#include #include "talk/base/basictypes.h" #include "talk/base/common.h" diff --git a/talk/base/stringutils.h b/talk/base/stringutils.h index 9f9e1a65a..2c12118b9 100644 --- a/talk/base/stringutils.h +++ b/talk/base/stringutils.h @@ -31,6 +31,7 @@ #include #include #include +#include #ifdef WIN32 #include @@ -46,7 +47,6 @@ #endif // !BSD #endif // POSIX -#include #include #include "talk/base/basictypes.h" diff --git a/talk/base/template_util.h b/talk/base/template_util.h index 5cc4ba430..00f1d7d4a 100644 --- a/talk/base/template_util.h +++ b/talk/base/template_util.h @@ -5,7 +5,7 @@ #ifndef TALK_BASE_TEMPLATE_UTIL_H_ #define TALK_BASE_TEMPLATE_UTIL_H_ -#include // For size_t. +#include // For size_t. namespace talk_base { diff --git a/talk/base/testclient.cc b/talk/base/testclient.cc index 280c2fb6a..92e1f3974 100644 --- a/talk/base/testclient.cc +++ b/talk/base/testclient.cc @@ -107,7 +107,7 @@ bool TestClient::CheckNextPacket(const char* buf, size_t size, bool res = false; Packet* packet = NextPacket(); if (packet) { - res = (packet->size == size && std::memcmp(packet->buf, buf, size) == 0); + res = (packet->size == size && memcmp(packet->buf, buf, size) == 0); if (addr) *addr = packet->addr; delete packet; diff --git a/talk/base/transformadapter.cc b/talk/base/transformadapter.cc index 53a55a85b..2a240eb9f 100644 --- a/talk/base/transformadapter.cc +++ b/talk/base/transformadapter.cc @@ -27,7 +27,7 @@ #include "talk/base/transformadapter.h" -#include +#include #include "talk/base/common.h" diff --git a/talk/base/versionparsing.cc b/talk/base/versionparsing.cc index 03f3dec1e..6a57dc9fe 100644 --- a/talk/base/versionparsing.cc +++ b/talk/base/versionparsing.cc @@ -27,7 +27,7 @@ #include "talk/base/versionparsing.h" -#include +#include namespace talk_base { diff --git a/talk/base/virtualsocket_unittest.cc b/talk/base/virtualsocket_unittest.cc index 8188e1de3..58dab143a 100644 --- a/talk/base/virtualsocket_unittest.cc +++ b/talk/base/virtualsocket_unittest.cc @@ -25,11 +25,11 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #ifdef POSIX #include #endif -#include #include "talk/base/logging.h" #include "talk/base/gunit.h" @@ -686,7 +686,7 @@ class VirtualSocketServerTest : public testing::Test { double num = receiver.samples * receiver.sum_sq - receiver.sum * receiver.sum; double den = receiver.samples * (receiver.samples - 1); - const double sample_stddev = std::sqrt(num / den); + const double sample_stddev = sqrt(num / den); LOG(LS_VERBOSE) << "mean=" << sample_mean << " stddev=" << sample_stddev; EXPECT_LE(500u, receiver.samples); @@ -1002,7 +1002,7 @@ TEST_F(VirtualSocketServerTest, CreatesStandardDistribution) { double dev = (*f)[i].second - mean; sum_sq_dev += dev * dev; } - const double stddev = std::sqrt(sum_sq_dev / f->size()); + const double stddev = sqrt(sum_sq_dev / f->size()); EXPECT_NEAR(kTestMean[midx], mean, 0.1 * kTestMean[midx]) << "M=" << kTestMean[midx] << " SD=" << kStdDev diff --git a/talk/base/virtualsocketserver.cc b/talk/base/virtualsocketserver.cc index 6d95c19d1..6589ebb5a 100644 --- a/talk/base/virtualsocketserver.cc +++ b/talk/base/virtualsocketserver.cc @@ -28,9 +28,9 @@ #include "talk/base/virtualsocketserver.h" #include +#include #include -#include #include #include @@ -80,7 +80,7 @@ class Packet : public MessageData { : size_(size), consumed_(0), from_(from) { ASSERT(NULL != data); data_ = new char[size_]; - std::memcpy(data_, data, size_); + memcpy(data_, data, size_); } virtual ~Packet() { @@ -283,7 +283,7 @@ class VirtualSocket : public AsyncSocket, public MessageHandler { // Return the packet at the front of the queue. Packet* packet = recv_buffer_.front(); size_t data_read = _min(cb, packet->size()); - std::memcpy(pv, packet->data(), data_read); + memcpy(pv, packet->data(), data_read); *paddr = packet->from(); if (data_read < packet->size()) { @@ -963,11 +963,11 @@ void VirtualSocketServer::UpdateDelayDistribution() { } } -static double PI = 4 * std::atan(1.0); +static double PI = 4 * atan(1.0); static double Normal(double x, double mean, double stddev) { double a = (x - mean) * (x - mean) / (2 * stddev * stddev); - return std::exp(-a) / (stddev * sqrt(2 * PI)); + return exp(-a) / (stddev * sqrt(2 * PI)); } #if 0 // static unused gives a warning diff --git a/talk/base/virtualsocketserver.h b/talk/base/virtualsocketserver.h index 280ae6572..56e37a14e 100644 --- a/talk/base/virtualsocketserver.h +++ b/talk/base/virtualsocketserver.h @@ -28,7 +28,8 @@ #ifndef TALK_BASE_VIRTUALSOCKETSERVER_H_ #define TALK_BASE_VIRTUALSOCKETSERVER_H_ -#include +#include + #include #include diff --git a/talk/base/winping.cc b/talk/base/winping.cc index 001740ad2..fd25a2374 100644 --- a/talk/base/winping.cc +++ b/talk/base/winping.cc @@ -27,8 +27,8 @@ #include "talk/base/winping.h" +#include #include -#include #include "talk/base/byteorder.h" #include "talk/base/common.h" diff --git a/talk/examples/call/call_main.cc b/talk/examples/call/call_main.cc index 25c33ff0e..33d538571 100644 --- a/talk/examples/call/call_main.cc +++ b/talk/examples/call/call_main.cc @@ -25,9 +25,10 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include +#include +#include #include + #include #include #include diff --git a/talk/examples/call/console.cc b/talk/examples/call/console.cc index dec3b4abc..9ad8bc754 100644 --- a/talk/examples/call/console.cc +++ b/talk/examples/call/console.cc @@ -27,12 +27,14 @@ #define _CRT_SECURE_NO_DEPRECATE 1 +#include + #ifdef POSIX #include #include #include #endif // POSIX -#include + #include "talk/base/logging.h" #include "talk/base/messagequeue.h" #include "talk/base/stringutils.h" diff --git a/talk/examples/call/console.h b/talk/examples/call/console.h index 4a90a7fe5..589603896 100644 --- a/talk/examples/call/console.h +++ b/talk/examples/call/console.h @@ -28,7 +28,7 @@ #ifndef TALK_EXAMPLES_CALL_CONSOLE_H_ #define TALK_EXAMPLES_CALL_CONSOLE_H_ -#include +#include #include "talk/base/thread.h" #include "talk/base/messagequeue.h" diff --git a/talk/examples/login/login_main.cc b/talk/examples/login/login_main.cc index 55bb893ad..5c5d1d783 100644 --- a/talk/examples/login/login_main.cc +++ b/talk/examples/login/login_main.cc @@ -25,7 +25,8 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include + #include #include "talk/base/thread.h" diff --git a/talk/media/base/filemediaengine.cc b/talk/media/base/filemediaengine.cc index dfec607d2..e8c356e4f 100644 --- a/talk/media/base/filemediaengine.cc +++ b/talk/media/base/filemediaengine.cc @@ -25,7 +25,7 @@ #include "talk/media/base/filemediaengine.h" -#include +#include #include "talk/base/buffer.h" #include "talk/base/event.h" diff --git a/talk/media/base/mediaengine.h b/talk/media/base/mediaengine.h index bccae9951..326b722bd 100644 --- a/talk/media/base/mediaengine.h +++ b/talk/media/base/mediaengine.h @@ -32,7 +32,8 @@ #include #endif -#include +#include + #include #include diff --git a/talk/media/base/rtpdump.h b/talk/media/base/rtpdump.h index 9d7b679d5..ceacab2cd 100644 --- a/talk/media/base/rtpdump.h +++ b/talk/media/base/rtpdump.h @@ -28,7 +28,8 @@ #ifndef TALK_MEDIA_BASE_RTPDUMP_H_ #define TALK_MEDIA_BASE_RTPDUMP_H_ -#include +#include + #include #include diff --git a/talk/media/base/videoframe.cc b/talk/media/base/videoframe.cc index 7a82305f5..cf5f852fc 100644 --- a/talk/media/base/videoframe.cc +++ b/talk/media/base/videoframe.cc @@ -27,7 +27,7 @@ #include "talk/media/base/videoframe.h" -#include +#include #if !defined(DISABLE_YUV) #include "libyuv/compare.h" diff --git a/talk/media/devices/v4llookup.cc b/talk/media/devices/v4llookup.cc index e1ef9feaa..76eafa716 100644 --- a/talk/media/devices/v4llookup.cc +++ b/talk/media/devices/v4llookup.cc @@ -12,13 +12,12 @@ #include #include #include +#include #include #include #include #include -#include - #include "talk/base/logging.h" namespace cricket { diff --git a/talk/p2p/base/asyncstuntcpsocket.cc b/talk/p2p/base/asyncstuntcpsocket.cc index 22f15ea9e..8bcfa3ad2 100644 --- a/talk/p2p/base/asyncstuntcpsocket.cc +++ b/talk/p2p/base/asyncstuntcpsocket.cc @@ -27,7 +27,7 @@ #include "talk/p2p/base/asyncstuntcpsocket.h" -#include +#include #include "talk/base/common.h" #include "talk/base/logging.h" diff --git a/talk/p2p/base/candidate.h b/talk/p2p/base/candidate.h index 0fa9f0ef8..547725df8 100644 --- a/talk/p2p/base/candidate.h +++ b/talk/p2p/base/candidate.h @@ -28,8 +28,9 @@ #ifndef TALK_P2P_BASE_CANDIDATE_H_ #define TALK_P2P_BASE_CANDIDATE_H_ -#include -#include +#include +#include + #include #include #include diff --git a/talk/p2p/base/pseudotcp.cc b/talk/p2p/base/pseudotcp.cc index fce179bd3..8b838774d 100644 --- a/talk/p2p/base/pseudotcp.cc +++ b/talk/p2p/base/pseudotcp.cc @@ -27,8 +27,9 @@ #include "talk/p2p/base/pseudotcp.h" -#include -#include +#include +#include + #include #include "talk/base/basictypes.h" diff --git a/talk/p2p/base/relayport.cc b/talk/p2p/base/relayport.cc index 0190aad5a..af768e4f6 100644 --- a/talk/p2p/base/relayport.cc +++ b/talk/p2p/base/relayport.cc @@ -258,8 +258,9 @@ bool RelayPort::HasMagicCookie(const char* data, size_t size) { if (size < 24 + sizeof(TURN_MAGIC_COOKIE_VALUE)) { return false; } else { - return 0 == std::memcmp(data + 24, TURN_MAGIC_COOKIE_VALUE, - sizeof(TURN_MAGIC_COOKIE_VALUE)); + return memcmp(data + 24, + TURN_MAGIC_COOKIE_VALUE, + sizeof(TURN_MAGIC_COOKIE_VALUE)) == 0; } } @@ -430,7 +431,7 @@ void RelayConnection::OnSendPacket(const void* data, size_t size, int sent = socket_->SendTo(data, size, GetAddress(), options); if (sent <= 0) { LOG(LS_VERBOSE) << "OnSendPacket: failed sending to " << GetAddress() << - std::strerror(socket_->GetError()); + strerror(socket_->GetError()); ASSERT(sent < 0); } } diff --git a/talk/p2p/base/relayserver.cc b/talk/p2p/base/relayserver.cc index aacc2c825..990c818ca 100644 --- a/talk/p2p/base/relayserver.cc +++ b/talk/p2p/base/relayserver.cc @@ -713,8 +713,7 @@ bool RelayServerBinding::HasMagicCookie(const char* bytes, size_t size) const { if (size < 24 + magic_cookie_.size()) { return false; } else { - return 0 == std::memcmp( - bytes + 24, magic_cookie_.c_str(), magic_cookie_.size()); + return memcmp(bytes + 24, magic_cookie_.c_str(), magic_cookie_.size()) == 0; } } diff --git a/talk/p2p/base/relayserver_unittest.cc b/talk/p2p/base/relayserver_unittest.cc index ea4f6fcdc..239f644b4 100644 --- a/talk/p2p/base/relayserver_unittest.cc +++ b/talk/p2p/base/relayserver_unittest.cc @@ -197,7 +197,7 @@ class RelayServerTest : public testing::Test { TEST_F(RelayServerTest, TestBadRequest) { talk_base::scoped_ptr res; - SendRaw1(bad, static_cast(std::strlen(bad))); + SendRaw1(bad, static_cast(strlen(bad))); res.reset(Receive1()); ASSERT_TRUE(!res); @@ -340,7 +340,7 @@ TEST_F(RelayServerTest, TestRemoteBadRequest) { Allocate(); Bind(); - SendRaw1(bad, static_cast(std::strlen(bad))); + SendRaw1(bad, static_cast(strlen(bad))); EXPECT_TRUE(Receive1() == NULL); EXPECT_TRUE(Receive2() == NULL); } @@ -486,7 +486,7 @@ TEST_F(RelayServerTest, TestSendRaw) { Send1(req.get()); EXPECT_EQ(msg1, ReceiveRaw2()); - SendRaw2(msg2, static_cast(std::strlen(msg2))); + SendRaw2(msg2, static_cast(strlen(msg2))); res.reset(Receive1()); ASSERT_TRUE(res); @@ -539,6 +539,6 @@ TEST_F(RelayServerTest, TestExpiration) { EXPECT_EQ("Operation Not Supported", err->reason()); // Also verify that traffic from the external client is ignored. - SendRaw2(msg2, static_cast(std::strlen(msg2))); + SendRaw2(msg2, static_cast(strlen(msg2))); EXPECT_TRUE(ReceiveRaw1().empty()); } diff --git a/talk/p2p/base/session_unittest.cc b/talk/p2p/base/session_unittest.cc index bfc4dcb94..074cb1c0a 100644 --- a/talk/p2p/base/session_unittest.cc +++ b/talk/p2p/base/session_unittest.cc @@ -25,7 +25,8 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include + #include #include #include @@ -823,7 +824,7 @@ struct ChannelHandler : sigslot::has_slots<> { EXPECT_LE(size, sizeof(last_data)); data_count += 1; last_size = size; - std::memcpy(last_data, buf, size); + memcpy(last_data, buf, size); } void Send(const char* data, size_t size) { @@ -1170,14 +1171,10 @@ class SessionTest : public testing::Test { EXPECT_EQ(strlen(dat1a), chan2a->last_size); EXPECT_EQ(strlen(dat1b), chan2b->last_size); - EXPECT_EQ(0, std::memcmp(chan1a->last_data, dat2a, - strlen(dat2a))); - EXPECT_EQ(0, std::memcmp(chan1b->last_data, dat2b, - strlen(dat2b))); - EXPECT_EQ(0, std::memcmp(chan2a->last_data, dat1a, - strlen(dat1a))); - EXPECT_EQ(0, std::memcmp(chan2b->last_data, dat1b, - strlen(dat1b))); + EXPECT_EQ(0, memcmp(chan1a->last_data, dat2a, strlen(dat2a))); + EXPECT_EQ(0, memcmp(chan1b->last_data, dat2b, strlen(dat2b))); + EXPECT_EQ(0, memcmp(chan2a->last_data, dat1a, strlen(dat1a))); + EXPECT_EQ(0, memcmp(chan2b->last_data, dat1b, strlen(dat1b))); } } diff --git a/talk/p2p/base/stun.cc b/talk/p2p/base/stun.cc index 38fc96ee1..6331ba9eb 100644 --- a/talk/p2p/base/stun.cc +++ b/talk/p2p/base/stun.cc @@ -27,7 +27,7 @@ #include "talk/p2p/base/stun.h" -#include +#include #include "talk/base/byteorder.h" #include "talk/base/common.h" @@ -217,8 +217,9 @@ bool StunMessage::ValidateMessageIntegrity(const char* data, size_t size, return false; // Comparing the calculated HMAC with the one present in the message. - return (std::memcmp(data + current_pos + kStunAttributeHeaderSize, - hmac, sizeof(hmac)) == 0); + return memcmp(data + current_pos + kStunAttributeHeaderSize, + hmac, + sizeof(hmac)) == 0; } bool StunMessage::AddMessageIntegrity(const std::string& password) { @@ -734,7 +735,7 @@ void StunByteStringAttribute::CopyBytes(const char* bytes) { void StunByteStringAttribute::CopyBytes(const void* bytes, size_t length) { char* new_bytes = new char[length]; - std::memcpy(new_bytes, bytes, length); + memcpy(new_bytes, bytes, length); SetBytes(new_bytes, length); } diff --git a/talk/p2p/base/stun_unittest.cc b/talk/p2p/base/stun_unittest.cc index 6a5bcd9bb..dc78d38a8 100644 --- a/talk/p2p/base/stun_unittest.cc +++ b/talk/p2p/base/stun_unittest.cc @@ -50,8 +50,7 @@ class StunTest : public ::testing::Test { ASSERT_EQ(length, msg.transaction_id().size()); ASSERT_EQ(length == kStunTransactionIdLength + 4, msg.IsLegacy()); ASSERT_EQ(length == kStunTransactionIdLength, !msg.IsLegacy()); - ASSERT_EQ(0, std::memcmp(msg.transaction_id().c_str(), - expectedID, length)); + ASSERT_EQ(0, memcmp(msg.transaction_id().c_str(), expectedID, length)); } void CheckStunAddressAttribute(const StunAddressAttribute* addr, @@ -64,13 +63,11 @@ class StunTest : public ::testing::Test { if (addr->family() == STUN_ADDRESS_IPV4) { in_addr v4_address = expected_address.ipv4_address(); in_addr stun_address = addr->ipaddr().ipv4_address(); - ASSERT_EQ(0, std::memcmp(&v4_address, &stun_address, - sizeof(stun_address))); + ASSERT_EQ(0, memcmp(&v4_address, &stun_address, sizeof(stun_address))); } else if (addr->family() == STUN_ADDRESS_IPV6) { in6_addr v6_address = expected_address.ipv6_address(); in6_addr stun_address = addr->ipaddr().ipv6_address(); - ASSERT_EQ(0, std::memcmp(&v6_address, &stun_address, - sizeof(stun_address))); + ASSERT_EQ(0, memcmp(&v6_address, &stun_address, sizeof(stun_address))); } else { ASSERT_TRUE(addr->family() == STUN_ADDRESS_IPV6 || addr->family() == STUN_ADDRESS_IPV4); @@ -788,9 +785,8 @@ TEST_F(StunTest, SetIPv6XorAddressAttributeOwner) { EXPECT_TRUE(addr->Write(&correct_buf)); EXPECT_TRUE(addr2.Write(&wrong_buf)); // But when written out, the buffers should look different. - ASSERT_NE(0, std::memcmp(correct_buf.Data(), - wrong_buf.Data(), - wrong_buf.Length())); + ASSERT_NE(0, + memcmp(correct_buf.Data(), wrong_buf.Data(), wrong_buf.Length())); // And when reading a known good value, the address should be wrong. addr2.Read(&correct_buf); ASSERT_NE(addr->ipaddr(), addr2.ipaddr()); @@ -836,9 +832,8 @@ TEST_F(StunTest, SetIPv4XorAddressAttributeOwner) { EXPECT_TRUE(addr->Write(&correct_buf)); EXPECT_TRUE(addr2.Write(&wrong_buf)); // The same address data should be written. - ASSERT_EQ(0, std::memcmp(correct_buf.Data(), - wrong_buf.Data(), - wrong_buf.Length())); + ASSERT_EQ(0, + memcmp(correct_buf.Data(), wrong_buf.Data(), wrong_buf.Length())); // And an attribute should be able to un-XOR an address belonging to a message // with a different transaction ID. EXPECT_TRUE(addr2.Read(&correct_buf)); @@ -927,9 +922,7 @@ TEST_F(StunTest, WriteMessageWithIPv6AddressAttribute) { int len1 = static_cast(out.Length()); std::string bytes; out.ReadString(&bytes, len1); - ASSERT_EQ(0, std::memcmp(bytes.c_str(), - kStunMessageWithIPv6MappedAddress, - len1)); + ASSERT_EQ(0, memcmp(bytes.c_str(), kStunMessageWithIPv6MappedAddress, len1)); } TEST_F(StunTest, WriteMessageWithIPv4AddressAttribute) { @@ -958,9 +951,7 @@ TEST_F(StunTest, WriteMessageWithIPv4AddressAttribute) { int len1 = static_cast(out.Length()); std::string bytes; out.ReadString(&bytes, len1); - ASSERT_EQ(0, std::memcmp(bytes.c_str(), - kStunMessageWithIPv4MappedAddress, - len1)); + ASSERT_EQ(0, memcmp(bytes.c_str(), kStunMessageWithIPv4MappedAddress, len1)); } TEST_F(StunTest, WriteMessageWithIPv6XorAddressAttribute) { @@ -989,9 +980,8 @@ TEST_F(StunTest, WriteMessageWithIPv6XorAddressAttribute) { int len1 = static_cast(out.Length()); std::string bytes; out.ReadString(&bytes, len1); - ASSERT_EQ(0, std::memcmp(bytes.c_str(), - kStunMessageWithIPv6XorMappedAddress, - len1)); + ASSERT_EQ(0, + memcmp(bytes.c_str(), kStunMessageWithIPv6XorMappedAddress, len1)); } TEST_F(StunTest, WriteMessageWithIPv4XoreAddressAttribute) { @@ -1020,9 +1010,8 @@ TEST_F(StunTest, WriteMessageWithIPv4XoreAddressAttribute) { int len1 = static_cast(out.Length()); std::string bytes; out.ReadString(&bytes, len1); - ASSERT_EQ(0, std::memcmp(bytes.c_str(), - kStunMessageWithIPv4XorMappedAddress, - len1)); + ASSERT_EQ(0, + memcmp(bytes.c_str(), kStunMessageWithIPv4XorMappedAddress, len1)); } TEST_F(StunTest, ReadByteStringAttribute) { @@ -1107,7 +1096,7 @@ TEST_F(StunTest, WriteMessageWithAnErrorCodeAttribute) { EXPECT_TRUE(msg.Write(&out)); ASSERT_EQ(size, out.Length()); // No padding. - ASSERT_EQ(0, std::memcmp(out.Data(), kStunMessageWithErrorAttribute, size)); + ASSERT_EQ(0, memcmp(out.Data(), kStunMessageWithErrorAttribute, size)); } TEST_F(StunTest, WriteMessageWithAUInt16ListAttribute) { @@ -1130,8 +1119,8 @@ TEST_F(StunTest, WriteMessageWithAUInt16ListAttribute) { EXPECT_TRUE(msg.Write(&out)); ASSERT_EQ(size, out.Length()); // Check everything up to the padding. - ASSERT_EQ(0, std::memcmp(out.Data(), kStunMessageWithUInt16ListAttribute, - size - 2)); + ASSERT_EQ(0, + memcmp(out.Data(), kStunMessageWithUInt16ListAttribute, size - 2)); } // Test that we fail to read messages with invalid lengths. @@ -1238,7 +1227,7 @@ TEST_F(StunTest, AddMessageIntegrity) { const StunByteStringAttribute* mi_attr = msg.GetByteString(STUN_ATTR_MESSAGE_INTEGRITY); EXPECT_EQ(20U, mi_attr->length()); - EXPECT_EQ(0, std::memcmp( + EXPECT_EQ(0, memcmp( mi_attr->bytes(), kCalculatedHmac1, sizeof(kCalculatedHmac1))); talk_base::ByteBuffer buf1; @@ -1256,8 +1245,8 @@ TEST_F(StunTest, AddMessageIntegrity) { const StunByteStringAttribute* mi_attr2 = msg2.GetByteString(STUN_ATTR_MESSAGE_INTEGRITY); EXPECT_EQ(20U, mi_attr2->length()); - EXPECT_EQ(0, std::memcmp( - mi_attr2->bytes(), kCalculatedHmac2, sizeof(kCalculatedHmac2))); + EXPECT_EQ( + 0, memcmp(mi_attr2->bytes(), kCalculatedHmac2, sizeof(kCalculatedHmac2))); talk_base::ByteBuffer buf3; EXPECT_TRUE(msg2.Write(&buf3)); @@ -1401,8 +1390,10 @@ TEST_F(StunTest, ReadRelayMessage) { bytes = msg.GetByteString(STUN_ATTR_MAGIC_COOKIE); ASSERT_TRUE(bytes != NULL); EXPECT_EQ(4U, bytes->length()); - EXPECT_EQ(0, std::memcmp(bytes->bytes(), TURN_MAGIC_COOKIE_VALUE, - sizeof(TURN_MAGIC_COOKIE_VALUE))); + EXPECT_EQ(0, + memcmp(bytes->bytes(), + TURN_MAGIC_COOKIE_VALUE, + sizeof(TURN_MAGIC_COOKIE_VALUE))); bytes2 = StunAttribute::CreateByteString(STUN_ATTR_MAGIC_COOKIE); bytes2->CopyBytes(reinterpret_cast(TURN_MAGIC_COOKIE_VALUE), @@ -1454,7 +1445,7 @@ TEST_F(StunTest, ReadRelayMessage) { size_t len1 = out.Length(); std::string outstring; out.ReadString(&outstring, len1); - EXPECT_EQ(0, std::memcmp(outstring.c_str(), input, len1)); + EXPECT_EQ(0, memcmp(outstring.c_str(), input, len1)); talk_base::ByteBuffer out2; EXPECT_TRUE(msg2.Write(&out2)); @@ -1462,7 +1453,7 @@ TEST_F(StunTest, ReadRelayMessage) { size_t len2 = out2.Length(); std::string outstring2; out2.ReadString(&outstring2, len2); - EXPECT_EQ(0, std::memcmp(outstring2.c_str(), input, len2)); + EXPECT_EQ(0, memcmp(outstring2.c_str(), input, len2)); } } // namespace cricket diff --git a/talk/p2p/base/stunserver_unittest.cc b/talk/p2p/base/stunserver_unittest.cc index abb195786..a6f56a517 100644 --- a/talk/p2p/base/stunserver_unittest.cc +++ b/talk/p2p/base/stunserver_unittest.cc @@ -119,7 +119,7 @@ TEST_F(StunServerTest, TestBad) { const char* bad = "this is a completely nonsensical message whose only " "purpose is to make the parser go 'ack'. it doesn't " "look anything like a normal stun message"; - Send(bad, static_cast(std::strlen(bad))); + Send(bad, static_cast(strlen(bad))); StunMessage* msg = Receive(); ASSERT_TRUE(msg == NULL); diff --git a/talk/session/media/audiomonitor.cc b/talk/session/media/audiomonitor.cc index 385702f75..c3a2eb0cb 100644 --- a/talk/session/media/audiomonitor.cc +++ b/talk/session/media/audiomonitor.cc @@ -27,7 +27,7 @@ #include "talk/session/media/audiomonitor.h" #include "talk/session/media/voicechannel.h" -#include +#include namespace cricket { diff --git a/talk/session/media/srtpfilter.cc b/talk/session/media/srtpfilter.cc index 2e8c5f281..9145dd771 100644 --- a/talk/session/media/srtpfilter.cc +++ b/talk/session/media/srtpfilter.cc @@ -29,8 +29,9 @@ #include "talk/session/media/srtpfilter.h" +#include + #include -#include #include "talk/base/base64.h" #include "talk/base/logging.h"