Remove std:: prefixes from C functions in talk/.
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/9559004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5657 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
46509c8d58
commit
371243dfa3
@ -27,8 +27,9 @@
|
||||
|
||||
#include "talk/app/webrtc/webrtcsession.h"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <climits>
|
||||
#include <vector>
|
||||
|
||||
#include "talk/app/webrtc/jsepicecandidate.h"
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include "talk/base/asynctcpsocket.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <string.h>
|
||||
|
||||
#include "talk/base/byteorder.h"
|
||||
#include "talk/base/common.h"
|
||||
|
@ -28,7 +28,7 @@
|
||||
#ifndef TALK_BASE_BUFFER_H_
|
||||
#define TALK_BASE_BUFFER_H_
|
||||
|
||||
#include <cstring>
|
||||
#include <string.h>
|
||||
|
||||
#include "talk/base/scoped_ptr.h"
|
||||
|
||||
|
@ -27,9 +27,10 @@
|
||||
|
||||
#include "talk/base/bytebuffer.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
#include "talk/base/basictypes.h"
|
||||
#include "talk/base/byteorder.h"
|
||||
|
@ -28,9 +28,11 @@
|
||||
#ifndef _TALK_BASE_CRYPTSTRING_H_
|
||||
#define _TALK_BASE_CRYPTSTRING_H_
|
||||
|
||||
#include <cstring>
|
||||
#include <string.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "talk/base/linked_ptr.h"
|
||||
#include "talk/base/scoped_ptr.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);
|
||||
|
@ -25,7 +25,7 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef WIN32
|
||||
// TODO(grunell): Remove io.h includes when Chromium has started
|
||||
|
@ -27,7 +27,8 @@
|
||||
|
||||
#include "talk/base/firewallsocketserver.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <assert.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "talk/base/asyncsocket.h"
|
||||
|
@ -28,9 +28,9 @@
|
||||
#include "talk/base/json.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <climits>
|
||||
#include <cstdlib>
|
||||
#include <sstream>
|
||||
|
||||
bool GetStringFromJson(const Json::Value& in, std::string* out) {
|
||||
|
@ -28,8 +28,9 @@
|
||||
#ifndef TALK_BASE_MESSAGEQUEUE_H_
|
||||
#define TALK_BASE_MESSAGEQUEUE_H_
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <list>
|
||||
#include <queue>
|
||||
#include <vector>
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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<int>(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_)) {
|
||||
|
@ -25,7 +25,7 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
#include <assert.h>
|
||||
|
||||
#include "talk/base/nattypes.h"
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#ifdef POSIX
|
||||
#include <netdb.h>
|
||||
#include <cstddef>
|
||||
#include <stddef.h>
|
||||
#elif WIN32
|
||||
#include <winsock2.h> // NOLINT
|
||||
#endif
|
||||
|
@ -60,8 +60,9 @@
|
||||
#include <Iphlpapi.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
|
||||
#include "talk/base/logging.h"
|
||||
#include "talk/base/scoped_ptr.h"
|
||||
|
@ -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))
|
||||
|
@ -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;
|
||||
|
@ -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_,
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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_,
|
||||
|
@ -29,7 +29,7 @@
|
||||
#pragma warning(disable:4786)
|
||||
#endif
|
||||
|
||||
#include <cassert>
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef POSIX
|
||||
#include <string.h>
|
||||
|
@ -28,7 +28,7 @@
|
||||
#ifndef TALK_APP_BASE_REFCOUNT_H_
|
||||
#define TALK_APP_BASE_REFCOUNT_H_
|
||||
|
||||
#include <cstring>
|
||||
#include <string.h>
|
||||
|
||||
#include "talk/base/criticalsection.h"
|
||||
|
||||
|
@ -88,7 +88,7 @@
|
||||
#ifndef TALK_BASE_SCOPED_PTR_H__
|
||||
#define TALK_BASE_SCOPED_PTR_H__
|
||||
|
||||
#include <cstddef> // for std::ptrdiff_t
|
||||
#include <stddef.h> // for ptrdiff_t
|
||||
#include <stdlib.h> // for free() decl
|
||||
|
||||
#include <algorithm> // For std::swap().
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -27,8 +27,8 @@
|
||||
|
||||
#include "talk/base/stringencode.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "talk/base/basictypes.h"
|
||||
#include "talk/base/common.h"
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <ctype.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <malloc.h>
|
||||
@ -46,7 +47,6 @@
|
||||
#endif // !BSD
|
||||
#endif // POSIX
|
||||
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
#include "talk/base/basictypes.h"
|
||||
|
@ -5,7 +5,7 @@
|
||||
#ifndef TALK_BASE_TEMPLATE_UTIL_H_
|
||||
#define TALK_BASE_TEMPLATE_UTIL_H_
|
||||
|
||||
#include <cstddef> // For size_t.
|
||||
#include <stddef.h> // For size_t.
|
||||
|
||||
namespace talk_base {
|
||||
|
||||
|
@ -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;
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include "talk/base/transformadapter.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <string.h>
|
||||
|
||||
#include "talk/base/common.h"
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include "talk/base/versionparsing.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace talk_base {
|
||||
|
||||
|
@ -25,11 +25,11 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
#ifdef POSIX
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#include <cmath>
|
||||
|
||||
#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
|
||||
|
@ -28,9 +28,9 @@
|
||||
#include "talk/base/virtualsocketserver.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
@ -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
|
||||
|
@ -28,7 +28,8 @@
|
||||
#ifndef TALK_BASE_VIRTUALSOCKETSERVER_H_
|
||||
#define TALK_BASE_VIRTUALSOCKETSERVER_H_
|
||||
|
||||
#include <cassert>
|
||||
#include <assert.h>
|
||||
|
||||
#include <deque>
|
||||
#include <map>
|
||||
|
||||
|
@ -27,8 +27,8 @@
|
||||
|
||||
#include "talk/base/winping.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <Iphlpapi.h>
|
||||
#include <cassert>
|
||||
|
||||
#include "talk/base/byteorder.h"
|
||||
#include "talk/base/common.h"
|
||||
|
@ -25,9 +25,10 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
@ -27,12 +27,14 @@
|
||||
|
||||
#define _CRT_SECURE_NO_DEPRECATE 1
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef POSIX
|
||||
#include <signal.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
#endif // POSIX
|
||||
#include <cassert>
|
||||
|
||||
#include "talk/base/logging.h"
|
||||
#include "talk/base/messagequeue.h"
|
||||
#include "talk/base/stringutils.h"
|
||||
|
@ -28,7 +28,7 @@
|
||||
#ifndef TALK_EXAMPLES_CALL_CONSOLE_H_
|
||||
#define TALK_EXAMPLES_CALL_CONSOLE_H_
|
||||
|
||||
#include <cstdio>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "talk/base/thread.h"
|
||||
#include "talk/base/messagequeue.h"
|
||||
|
@ -25,7 +25,8 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <cstdio>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "talk/base/thread.h"
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#include "talk/media/base/filemediaengine.h"
|
||||
|
||||
#include <climits>
|
||||
#include <limits.h>
|
||||
|
||||
#include "talk/base/buffer.h"
|
||||
#include "talk/base/event.h"
|
||||
|
@ -32,7 +32,8 @@
|
||||
#include <CoreAudio/CoreAudio.h>
|
||||
#endif
|
||||
|
||||
#include <climits>
|
||||
#include <limits.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -28,7 +28,8 @@
|
||||
#ifndef TALK_MEDIA_BASE_RTPDUMP_H_
|
||||
#define TALK_MEDIA_BASE_RTPDUMP_H_
|
||||
|
||||
#include <cstring>
|
||||
#include <string.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include "talk/media/base/videoframe.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <string.h>
|
||||
|
||||
#if !defined(DISABLE_YUV)
|
||||
#include "libyuv/compare.h"
|
||||
|
@ -12,13 +12,12 @@
|
||||
#include <fcntl.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/videodev2.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "talk/base/logging.h"
|
||||
|
||||
namespace cricket {
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include "talk/p2p/base/asyncstuntcpsocket.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <string.h>
|
||||
|
||||
#include "talk/base/common.h"
|
||||
#include "talk/base/logging.h"
|
||||
|
@ -28,8 +28,9 @@
|
||||
#ifndef TALK_P2P_BASE_CANDIDATE_H_
|
||||
#define TALK_P2P_BASE_CANDIDATE_H_
|
||||
|
||||
#include <climits>
|
||||
#include <cmath>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
@ -27,8 +27,9 @@
|
||||
|
||||
#include "talk/p2p/base/pseudotcp.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <set>
|
||||
|
||||
#include "talk/base/basictypes.h"
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ class RelayServerTest : public testing::Test {
|
||||
TEST_F(RelayServerTest, TestBadRequest) {
|
||||
talk_base::scoped_ptr<StunMessage> res;
|
||||
|
||||
SendRaw1(bad, static_cast<int>(std::strlen(bad)));
|
||||
SendRaw1(bad, static_cast<int>(strlen(bad)));
|
||||
res.reset(Receive1());
|
||||
|
||||
ASSERT_TRUE(!res);
|
||||
@ -340,7 +340,7 @@ TEST_F(RelayServerTest, TestRemoteBadRequest) {
|
||||
Allocate();
|
||||
Bind();
|
||||
|
||||
SendRaw1(bad, static_cast<int>(std::strlen(bad)));
|
||||
SendRaw1(bad, static_cast<int>(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<int>(std::strlen(msg2)));
|
||||
SendRaw2(msg2, static_cast<int>(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<int>(std::strlen(msg2)));
|
||||
SendRaw2(msg2, static_cast<int>(strlen(msg2)));
|
||||
EXPECT_TRUE(ReceiveRaw1().empty());
|
||||
}
|
||||
|
@ -25,7 +25,8 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
#include <string.h>
|
||||
|
||||
#include <sstream>
|
||||
#include <deque>
|
||||
#include <map>
|
||||
@ -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)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include "talk/p2p/base/stun.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <string.h>
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
|
@ -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<int>(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<int>(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<int>(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<int>(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,7 +1390,9 @@ 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,
|
||||
EXPECT_EQ(0,
|
||||
memcmp(bytes->bytes(),
|
||||
TURN_MAGIC_COOKIE_VALUE,
|
||||
sizeof(TURN_MAGIC_COOKIE_VALUE)));
|
||||
|
||||
bytes2 = StunAttribute::CreateByteString(STUN_ATTR_MAGIC_COOKIE);
|
||||
@ -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
|
||||
|
@ -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<int>(std::strlen(bad)));
|
||||
Send(bad, static_cast<int>(strlen(bad)));
|
||||
|
||||
StunMessage* msg = Receive();
|
||||
ASSERT_TRUE(msg == NULL);
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
#include "talk/session/media/audiomonitor.h"
|
||||
#include "talk/session/media/voicechannel.h"
|
||||
#include <cassert>
|
||||
#include <assert.h>
|
||||
|
||||
namespace cricket {
|
||||
|
||||
|
@ -29,8 +29,9 @@
|
||||
|
||||
#include "talk/session/media/srtpfilter.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
#include "talk/base/base64.h"
|
||||
#include "talk/base/logging.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user