Fix Chromium clang plugin warnings

NOTRY=true
BUG=webrtc:163

Review-Url: https://codereview.webrtc.org/2291503002
Cr-Commit-Position: refs/heads/master@{#13959}
This commit is contained in:
kwiberg
2016-08-29 10:05:24 -07:00
committed by Commit bot
parent e39f251dac
commit 65fc8b9138
11 changed files with 41 additions and 30 deletions

View File

@ -331,6 +331,8 @@ if (!build_with_chromium) {
source_set("webrtc_common") { source_set("webrtc_common") {
sources = [ sources = [
"audio_sink.h", "audio_sink.h",
"common.cc",
"common.h",
"common_types.cc", "common_types.cc",
"common_types.h", "common_types.h",
"config.cc", "config.cc",

23
webrtc/common.cc Normal file
View File

@ -0,0 +1,23 @@
/*
* Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/common.h"
namespace webrtc {
Config::Config() {}
Config::~Config() {
for (OptionMap::iterator it = options_.begin(); it != options_.end(); ++it) {
delete it->second;
}
}
} // namespace webrtc

View File

@ -13,6 +13,8 @@
'type': 'static_library', 'type': 'static_library',
'sources': [ 'sources': [
'audio_sink.h', 'audio_sink.h',
'common.cc',
'common.h',
'common_types.cc', 'common_types.cc',
'common_types.h', 'common_types.h',
'config.h', 'config.h',

View File

@ -71,15 +71,8 @@ class Config {
// This instance gets ownership of the newly set value. // This instance gets ownership of the newly set value.
template<typename T> void Set(T* value); template<typename T> void Set(T* value);
Config() {} Config();
~Config() { ~Config();
// Note: this method is inline so webrtc public API depends only
// on the headers.
for (OptionMap::iterator it = options_.begin();
it != options_.end(); ++it) {
delete it->second;
}
}
private: private:
struct BaseOption { struct BaseOption {

View File

@ -917,11 +917,6 @@ if (rtc_include_tests) {
configs += [ "../..:common_config" ] configs += [ "../..:common_config" ]
public_configs = [ "../..:common_inherited_config" ] public_configs = [ "../..:common_inherited_config" ]
if (is_clang) {
# Suppress warnings from the Chromium Clang plugins (bugs.webrtc.org/163).
configs -= [ "//build/config/clang:find_bad_constructs" ]
}
defines = audio_coding_defines defines = audio_coding_defines
deps = audio_coding_deps + [ deps = audio_coding_deps + [
@ -943,12 +938,6 @@ if (rtc_include_tests) {
configs += [ "../..:common_config" ] configs += [ "../..:common_config" ]
public_configs = [ "../..:common_inherited_config" ] public_configs = [ "../..:common_inherited_config" ]
if (is_clang) {
# Suppress warnings from Chrome's Clang plugins.
# See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
configs -= [ "//build/config/clang:find_bad_constructs" ]
}
deps = [ deps = [
":audio_coding", ":audio_coding",
"../../:webrtc_common", "../../:webrtc_common",

View File

@ -47,6 +47,8 @@ AcmSendTestOldApi::AcmSendTestOldApi(InputAudioFile* audio_source,
acm_->RegisterTransportCallback(this); acm_->RegisterTransportCallback(this);
} }
AcmSendTestOldApi::~AcmSendTestOldApi() = default;
bool AcmSendTestOldApi::RegisterCodec(const char* payload_name, bool AcmSendTestOldApi::RegisterCodec(const char* payload_name,
int sampling_freq_hz, int sampling_freq_hz,
int channels, int channels,

View File

@ -32,7 +32,7 @@ class AcmSendTestOldApi : public AudioPacketizationCallback,
AcmSendTestOldApi(InputAudioFile* audio_source, AcmSendTestOldApi(InputAudioFile* audio_source,
int source_rate_hz, int source_rate_hz,
int test_duration_ms); int test_duration_ms);
virtual ~AcmSendTestOldApi() {} ~AcmSendTestOldApi() override;
// Registers the send codec. Returns true on success, false otherwise. // Registers the send codec. Returns true on success, false otherwise.
bool RegisterCodec(const char* payload_name, bool RegisterCodec(const char* payload_name,

View File

@ -47,7 +47,7 @@ class Channel : public AudioPacketizationCallback {
public: public:
Channel(int16_t chID = -1); Channel(int16_t chID = -1);
~Channel(); ~Channel() override;
int32_t SendData(FrameType frameType, int32_t SendData(FrameType frameType,
uint8_t payloadType, uint8_t payloadType,

View File

@ -46,6 +46,12 @@ PCMFile::PCMFile(uint32_t timestamp)
timestamp_ = timestamp; timestamp_ = timestamp;
} }
PCMFile::~PCMFile() {
if (pcm_file_) {
fclose(pcm_file_);
}
}
int16_t PCMFile::ChooseFile(std::string* file_name, int16_t max_len, int16_t PCMFile::ChooseFile(std::string* file_name, int16_t max_len,
uint16_t* frequency_hz) { uint16_t* frequency_hz) {
char tmp_name[MAX_FILE_NAME_LENGTH_BYTE]; char tmp_name[MAX_FILE_NAME_LENGTH_BYTE];

View File

@ -26,11 +26,7 @@ class PCMFile {
public: public:
PCMFile(); PCMFile();
PCMFile(uint32_t timestamp); PCMFile(uint32_t timestamp);
~PCMFile() { ~PCMFile();
if (pcm_file_ != NULL) {
fclose(pcm_file_);
}
}
void Open(const std::string& filename, uint16_t frequency, const char* mode, void Open(const std::string& filename, uint16_t frequency, const char* mode,
bool auto_rewind = false); bool auto_rewind = false);

View File

@ -118,10 +118,8 @@ bool FixedPayloadTypeCodec(const char* payloadName);
class VADCallback : public ACMVADCallback { class VADCallback : public ACMVADCallback {
public: public:
VADCallback(); VADCallback();
~VADCallback() {
}
int32_t InFrameType(FrameType frame_type); int32_t InFrameType(FrameType frame_type) override;
void PrintFrameTypes(); void PrintFrameTypes();
void Reset(); void Reset();