Added namespace rtc to some base classes and functions. It was causing linker error in the FYI bots: http://chromegw.corp.google.com/i/internal.chromium.webrtc.fyi/builders/Android%20Builder%20%28dbg%29/builds/1808/steps/compile/logs/stdio but also, not doing it pollutes the global namespace.
BUG=N/A R=andrew@webrtc.org Review URL: https://webrtc-codereview.appspot.com/19479005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6157 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
3147b97f8c
commit
c50bf7cbd0
@ -15,6 +15,8 @@
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
|
||||
namespace rtc {
|
||||
|
||||
void Fatal(const char* file, int line, const char* format, ...) {
|
||||
char msg[256];
|
||||
|
||||
@ -28,3 +30,5 @@ void Fatal(const char* file, int line, const char* format, ...) {
|
||||
<< "\n#\n";
|
||||
abort();
|
||||
}
|
||||
|
||||
} // namespace rtc
|
||||
|
@ -16,12 +16,15 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
namespace rtc {
|
||||
|
||||
// Prints an error message to stderr and aborts execution.
|
||||
void Fatal(const char* file, int line, const char* format, ...);
|
||||
|
||||
} // namespace rtc
|
||||
|
||||
// The UNREACHABLE macro is very useful during development.
|
||||
#define UNREACHABLE() \
|
||||
Fatal(__FILE__, __LINE__, "unreachable code")
|
||||
rtc::Fatal(__FILE__, __LINE__, "unreachable code")
|
||||
|
||||
#endif // WEBRTC_BASE_CHECKS_H_
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "webrtc/base/flags.h"
|
||||
|
||||
|
||||
namespace rtc {
|
||||
// -----------------------------------------------------------------------------
|
||||
// Implementation of Flag
|
||||
|
||||
@ -296,3 +296,4 @@ WindowsCommandLineArguments::~WindowsCommandLineArguments() {
|
||||
}
|
||||
#endif // WEBRTC_WIN
|
||||
|
||||
} // namespace rtc
|
||||
|
@ -28,6 +28,8 @@
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/common.h"
|
||||
|
||||
namespace rtc {
|
||||
|
||||
// Internal use only.
|
||||
union FlagValue {
|
||||
// Note: Because in C++ non-bool values are silently converted into
|
||||
@ -155,9 +157,9 @@ class Flag {
|
||||
/* define and initialize the flag */ \
|
||||
c_type FLAG_##name = (default); \
|
||||
/* register the flag */ \
|
||||
static Flag Flag_##name(__FILE__, #name, (comment), \
|
||||
Flag::type, &FLAG_##name, \
|
||||
FlagValue::New_##type(default))
|
||||
static rtc::Flag Flag_##name(__FILE__, #name, (comment), \
|
||||
rtc::Flag::type, &FLAG_##name, \
|
||||
rtc::FlagValue::New_##type(default))
|
||||
|
||||
|
||||
// Internal use only.
|
||||
@ -263,5 +265,6 @@ class WindowsCommandLineArguments {
|
||||
};
|
||||
#endif // WEBRTC_WIN
|
||||
|
||||
} // namespace rtc
|
||||
|
||||
#endif // SHARED_COMMANDLINEFLAGS_FLAGS_H__
|
||||
|
@ -23,14 +23,18 @@
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
|
||||
namespace {
|
||||
|
||||
struct netlinkrequest {
|
||||
nlmsghdr header;
|
||||
ifaddrmsg msg;
|
||||
};
|
||||
|
||||
namespace {
|
||||
const int kMaxReadSize = 4096;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace rtc {
|
||||
|
||||
int set_ifname(struct ifaddrs* ifaddr, int interface) {
|
||||
char buf[IFNAMSIZ] = {0};
|
||||
@ -215,3 +219,5 @@ void freeifaddrs(struct ifaddrs* addrs) {
|
||||
}
|
||||
}
|
||||
#endif // defined(WEBRTC_ANDROID)
|
||||
|
||||
} // namespace rtc
|
||||
|
@ -13,6 +13,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
|
||||
// Implementation of getifaddrs for Android.
|
||||
// Fills out a list of ifaddr structs (see below) which contain information
|
||||
// about every network interface available on the host.
|
||||
@ -27,7 +29,11 @@ struct ifaddrs {
|
||||
// We don't need them (yet?).
|
||||
};
|
||||
|
||||
namespace rtc {
|
||||
|
||||
int getifaddrs(struct ifaddrs** result);
|
||||
void freeifaddrs(struct ifaddrs* addrs);
|
||||
|
||||
} // namespace rtc
|
||||
|
||||
#endif // WEBRTC_BASE_IFADDRS_ANDROID_H_
|
||||
|
@ -25,6 +25,8 @@
|
||||
|
||||
#include "webrtc/base/byteorder.h" // for ARCH_CPU_LITTLE_ENDIAN.
|
||||
|
||||
namespace rtc {
|
||||
|
||||
#ifdef ARCH_CPU_LITTLE_ENDIAN
|
||||
#define ByteReverse(buf, len) // Nothing.
|
||||
#else // ARCH_CPU_BIG_ENDIAN
|
||||
@ -216,3 +218,5 @@ void MD5Transform(uint32 buf[4], const uint32 in[16]) {
|
||||
buf[2] += c;
|
||||
buf[3] += d;
|
||||
}
|
||||
|
||||
} // namespace rtc
|
||||
|
@ -17,12 +17,15 @@
|
||||
|
||||
// Changes(fbarchard): Ported to C++ and Google style guide.
|
||||
// Made context first parameter in MD5Final for consistency with Sha1.
|
||||
// Changes(hellner): added rtc namespace
|
||||
|
||||
#ifndef WEBRTC_BASE_MD5_H_
|
||||
#define WEBRTC_BASE_MD5_H_
|
||||
|
||||
#include "webrtc/base/basictypes.h"
|
||||
|
||||
namespace rtc {
|
||||
|
||||
// Canonical name for a MD5 context structure, used in many crypto libs.
|
||||
typedef struct MD5Context MD5_CTX;
|
||||
|
||||
@ -37,4 +40,6 @@ void MD5Update(MD5Context* context, const uint8* data, size_t len);
|
||||
void MD5Final(MD5Context* context, uint8 digest[16]);
|
||||
void MD5Transform(uint32 buf[4], const uint32 in[16]);
|
||||
|
||||
} // namespace rtc
|
||||
|
||||
#endif // WEBRTC_BASE_MD5_H_
|
||||
|
@ -84,9 +84,9 @@ static BIO_METHOD methods_socket = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
BIO_METHOD* BIO_s_socket2() { return(&methods_socket); }
|
||||
static BIO_METHOD* BIO_s_socket2() { return(&methods_socket); }
|
||||
|
||||
BIO* BIO_new_socket(rtc::AsyncSocket* socket) {
|
||||
static BIO* BIO_new_socket(rtc::AsyncSocket* socket) {
|
||||
BIO* ret = BIO_new(BIO_s_socket2());
|
||||
if (ret == NULL) {
|
||||
return NULL;
|
||||
|
@ -102,6 +102,8 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
namespace rtc {
|
||||
|
||||
void SHA1Transform(uint32 state[5], const uint8 buffer[64]);
|
||||
|
||||
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
|
||||
@ -280,3 +282,5 @@ void SHA1Final(SHA1_CTX* context, uint8 digest[SHA1_DIGEST_SIZE]) {
|
||||
SHA1Transform(context->state, context->buffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace rtc
|
||||
|
@ -5,13 +5,15 @@
|
||||
*
|
||||
*/
|
||||
|
||||
// Ported to C++, Google style and uses basictypes.h
|
||||
// Ported to C++, Google style, under namespace rtc and uses basictypes.h
|
||||
|
||||
#ifndef WEBRTC_BASE_SHA1_H_
|
||||
#define WEBRTC_BASE_SHA1_H_
|
||||
|
||||
#include "webrtc/base/basictypes.h"
|
||||
|
||||
namespace rtc {
|
||||
|
||||
struct SHA1_CTX {
|
||||
uint32 state[5];
|
||||
// TODO: Change bit count to uint64.
|
||||
@ -26,3 +28,5 @@ void SHA1Update(SHA1_CTX* context, const uint8* data, size_t len);
|
||||
void SHA1Final(SHA1_CTX* context, uint8 digest[SHA1_DIGEST_SIZE]);
|
||||
|
||||
#endif // WEBRTC_BASE_SHA1_H_
|
||||
|
||||
} // namespace rtc
|
||||
|
@ -8,6 +8,7 @@
|
||||
/* subject:/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root */
|
||||
/* issuer :/C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root */
|
||||
|
||||
namespace rtc {
|
||||
|
||||
const unsigned char AddTrust_External_Root_certificate[1082]={
|
||||
0x30,0x82,0x04,0x36,0x30,0x82,0x03,0x1E,0xA0,0x03,0x02,0x01,0x02,0x02,0x01,0x01,
|
||||
@ -4928,3 +4929,4 @@ const size_t kSSLCertCertificateSizeList[] = {
|
||||
1076,
|
||||
};
|
||||
|
||||
} // namspace rtc
|
||||
|
@ -77,9 +77,9 @@ rtc::Pathname GetTalkDirectory() {
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
FlagList::SetFlagsFromCommandLine(&argc, argv, false);
|
||||
rtc::FlagList::SetFlagsFromCommandLine(&argc, argv, false);
|
||||
if (FLAG_help) {
|
||||
FlagList::Print(NULL, false);
|
||||
rtc::FlagList::Print(NULL, false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -36,8 +36,8 @@ static int HexPairValue(const char * code) {
|
||||
}
|
||||
}
|
||||
|
||||
int InternalUrlDecode(const char *source, char *dest,
|
||||
bool encode_space_as_plus) {
|
||||
static int InternalUrlDecode(const char *source, char *dest,
|
||||
bool encode_space_as_plus) {
|
||||
char * start = dest;
|
||||
|
||||
while (*source) {
|
||||
@ -74,6 +74,16 @@ int InternalUrlDecode(const char *source, char *dest,
|
||||
return static_cast<int>(dest - start);
|
||||
}
|
||||
|
||||
static bool IsValidUrlChar(char ch, bool unsafe_only) {
|
||||
if (unsafe_only) {
|
||||
return !(ch <= ' ' || strchr("\\\"^&`<>[]{}", ch));
|
||||
} else {
|
||||
return isalnum(ch) || strchr("-_.!~*'()", ch);
|
||||
}
|
||||
}
|
||||
|
||||
namespace rtc {
|
||||
|
||||
int UrlDecode(const char *source, char *dest) {
|
||||
return InternalUrlDecode(source, dest, true);
|
||||
}
|
||||
@ -82,14 +92,6 @@ int UrlDecodeWithoutEncodingSpaceAsPlus(const char *source, char *dest) {
|
||||
return InternalUrlDecode(source, dest, false);
|
||||
}
|
||||
|
||||
bool IsValidUrlChar(char ch, bool unsafe_only) {
|
||||
if (unsafe_only) {
|
||||
return !(ch <= ' ' || strchr("\\\"^&`<>[]{}", ch));
|
||||
} else {
|
||||
return isalnum(ch) || strchr("-_.!~*'()", ch);
|
||||
}
|
||||
}
|
||||
|
||||
int InternalUrlEncode(const char *source, char *dest, unsigned int max,
|
||||
bool encode_space_as_plus, bool unsafe_only) {
|
||||
static const char *digits = "0123456789ABCDEF";
|
||||
@ -177,3 +179,5 @@ std::string
|
||||
UrlEncodeStringForOnlyUnsafeChars(const std::string & decoded) {
|
||||
return InternalUrlEncodeString(decoded, false, true);
|
||||
}
|
||||
|
||||
} // namespace rtc
|
||||
|
@ -13,6 +13,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace rtc {
|
||||
|
||||
// Decode all encoded characters. Also decode + as space.
|
||||
int UrlDecode(const char *source, char *dest);
|
||||
|
||||
@ -41,3 +43,4 @@ std::string UrlEncodeStringForOnlyUnsafeChars(const std::string & decoded);
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace rtc
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "webrtc/base/thread.h"
|
||||
#include "webrtc/base/urlencode.h"
|
||||
|
||||
using rtc::UrlEncode;
|
||||
|
||||
TEST(Urlencode, SourceTooLong) {
|
||||
char source[] = "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
|
||||
"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^";
|
||||
@ -61,21 +63,21 @@ TEST(Urlencode, Encoding1) {
|
||||
TEST(Urlencode, Encoding2) {
|
||||
char source[] = "A^ ";
|
||||
char dest[8];
|
||||
ASSERT_EQ(7, UrlEncodeWithoutEncodingSpaceAsPlus(source, dest,
|
||||
ARRAY_SIZE(dest)));
|
||||
ASSERT_EQ(7, rtc::UrlEncodeWithoutEncodingSpaceAsPlus(source, dest,
|
||||
ARRAY_SIZE(dest)));
|
||||
ASSERT_STREQ("A%5E%20", dest);
|
||||
}
|
||||
|
||||
TEST(Urldecode, Decoding1) {
|
||||
char source[] = "A%5E+";
|
||||
char dest[8];
|
||||
ASSERT_EQ(3, UrlDecode(source, dest));
|
||||
ASSERT_EQ(3, rtc::UrlDecode(source, dest));
|
||||
ASSERT_STREQ("A^ ", dest);
|
||||
}
|
||||
|
||||
TEST(Urldecode, Decoding2) {
|
||||
char source[] = "A%5E+";
|
||||
char dest[8];
|
||||
ASSERT_EQ(3, UrlDecodeWithoutEncodingSpaceAsPlus(source, dest));
|
||||
ASSERT_EQ(3, rtc::UrlDecodeWithoutEncodingSpaceAsPlus(source, dest));
|
||||
ASSERT_STREQ("A^+", dest);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user