Fix clang style warnings in webrtc/base

Mostly this consists of marking functions with override when
applicable, and moving function bodies from .h to .cc files.

Not inlining virtual functions with simple bodies such as

  { return false; }

strikes me as probably losing more in readability than we gain in
binary size and compilation time, but I guess it's just like any other
case where enabling a generally good warning forces us to write
slightly worse code in a couple of places.

BUG=163
R=kjellander@webrtc.org, tommi@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/47429004

Cr-Commit-Position: refs/heads/master@{#8656}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8656 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
kwiberg@webrtc.org
2015-03-09 22:21:53 +00:00
parent 2989204130
commit 67186fe00c
111 changed files with 1610 additions and 1061 deletions

View File

@ -51,11 +51,9 @@ class RandomGenerator {
class SecureRandomGenerator : public RandomGenerator {
public:
SecureRandomGenerator() {}
~SecureRandomGenerator() {}
virtual bool Init(const void* seed, size_t len) {
return true;
}
virtual bool Generate(void* buf, size_t len) {
~SecureRandomGenerator() override {}
bool Init(const void* seed, size_t len) override { return true; }
bool Generate(void* buf, size_t len) override {
return (RAND_bytes(reinterpret_cast<unsigned char*>(buf), len) > 0);
}
};
@ -65,11 +63,9 @@ class SecureRandomGenerator : public RandomGenerator {
class SecureRandomGenerator : public RandomGenerator {
public:
SecureRandomGenerator() {}
~SecureRandomGenerator() {}
virtual bool Init(const void* seed, size_t len) {
return true;
}
virtual bool Generate(void* buf, size_t len) {
~SecureRandomGenerator() override {}
bool Init(const void* seed, size_t len) override { return true; }
bool Generate(void* buf, size_t len) override {
return (PK11_GenerateRandom(reinterpret_cast<unsigned char*>(buf),
static_cast<int>(len)) == SECSuccess);
}
@ -153,12 +149,10 @@ class TestRandomGenerator : public RandomGenerator {
public:
TestRandomGenerator() : seed_(7) {
}
~TestRandomGenerator() {
~TestRandomGenerator() override {
}
virtual bool Init(const void* seed, size_t len) {
return true;
}
virtual bool Generate(void* buf, size_t len) {
bool Init(const void* seed, size_t len) override { return true; }
bool Generate(void* buf, size_t len) override {
for (size_t i = 0; i < len; ++i) {
static_cast<uint8*>(buf)[i] = static_cast<uint8>(GetRandom());
}