[Cleanup] Add missing #include. Remove useless ones.
This CL is the result of running include-what-you-use tool on part
of the code base (audio target and dependencies) plus manual fixes.
bug: webrtc:8311
Change-Id: I277d281ce943c3ecc1bd45fd8d83055931743604
Reviewed-on: https://webrtc-review.googlesource.com/c/106280
Commit-Queue: Yves Gerey <yvesg@google.com>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25311}
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index 36e4f57..86bdf2b 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -285,6 +285,7 @@
visibility = [ "*" ]
libs = []
deps = [
+ ":checks",
":criticalsection",
":macromagic",
":platform_thread_types",
@@ -370,6 +371,7 @@
deps = [
":rtc_base_approved",
"../system_wrappers",
+ "//third_party/abseil-cpp/absl/types:optional",
]
}
diff --git a/rtc_base/asynctcpsocket.h b/rtc_base/asynctcpsocket.h
index c145d6f..9567dd9 100644
--- a/rtc_base/asynctcpsocket.h
+++ b/rtc_base/asynctcpsocket.h
@@ -11,14 +11,15 @@
#ifndef RTC_BASE_ASYNCTCPSOCKET_H_
#define RTC_BASE_ASYNCTCPSOCKET_H_
+#include <stddef.h>
#include <memory>
-#include "rtc_base/asyncpacketsocket.h" // for PacketOptions, AsyncPacketSo...
-#include "rtc_base/asyncsocket.h" // for AsyncSocket
-#include "rtc_base/buffer.h" // for Buffer
-#include "rtc_base/constructormagic.h" // for RTC_DISALLOW_COPY_AND_ASSIGN
-#include "rtc_base/socket.h" // for Socket, Socket::Option
-#include "rtc_base/socketaddress.h" // for SocketAddress
+#include "rtc_base/asyncpacketsocket.h"
+#include "rtc_base/asyncsocket.h"
+#include "rtc_base/buffer.h"
+#include "rtc_base/constructormagic.h"
+#include "rtc_base/socket.h"
+#include "rtc_base/socketaddress.h"
namespace rtc {
diff --git a/rtc_base/asyncudpsocket.h b/rtc_base/asyncudpsocket.h
index d814b4b..030946d 100644
--- a/rtc_base/asyncudpsocket.h
+++ b/rtc_base/asyncudpsocket.h
@@ -11,9 +11,13 @@
#ifndef RTC_BASE_ASYNCUDPSOCKET_H_
#define RTC_BASE_ASYNCUDPSOCKET_H_
+#include <stddef.h>
#include <memory>
#include "rtc_base/asyncpacketsocket.h"
+#include "rtc_base/asyncsocket.h"
+#include "rtc_base/socket.h"
+#include "rtc_base/socketaddress.h"
#include "rtc_base/socketfactory.h"
namespace rtc {
diff --git a/rtc_base/bitrateallocationstrategy.cc b/rtc_base/bitrateallocationstrategy.cc
index c9fa937..3c41207 100644
--- a/rtc_base/bitrateallocationstrategy.cc
+++ b/rtc_base/bitrateallocationstrategy.cc
@@ -11,6 +11,8 @@
#include "rtc_base/bitrateallocationstrategy.h"
#include <algorithm>
+#include <cstddef>
+#include <cstdint>
#include <map>
#include <utility>
diff --git a/rtc_base/bitrateallocationstrategy.h b/rtc_base/bitrateallocationstrategy.h
index e1e47ba..e68ea74 100644
--- a/rtc_base/bitrateallocationstrategy.h
+++ b/rtc_base/bitrateallocationstrategy.h
@@ -11,8 +11,10 @@
#ifndef RTC_BASE_BITRATEALLOCATIONSTRATEGY_H_
#define RTC_BASE_BITRATEALLOCATIONSTRATEGY_H_
+#include <stdint.h>
#include <string>
#include <vector>
+
#include "api/array_view.h"
#include "rtc_base/experiments/field_trial_parser.h"
#include "rtc_base/experiments/field_trial_units.h"
diff --git a/rtc_base/bufferqueue.cc b/rtc_base/bufferqueue.cc
index 48ff2e6..74f7a50 100644
--- a/rtc_base/bufferqueue.cc
+++ b/rtc_base/bufferqueue.cc
@@ -10,6 +10,8 @@
#include "rtc_base/bufferqueue.h"
+#include <stdint.h>
+#include <string.h>
#include <algorithm>
namespace rtc {
diff --git a/rtc_base/bufferqueue.h b/rtc_base/bufferqueue.h
index 94ab0ca..63f5182 100644
--- a/rtc_base/bufferqueue.h
+++ b/rtc_base/bufferqueue.h
@@ -11,12 +11,14 @@
#ifndef RTC_BASE_BUFFERQUEUE_H_
#define RTC_BASE_BUFFERQUEUE_H_
+#include <stddef.h>
#include <deque>
#include <vector>
#include "rtc_base/buffer.h"
#include "rtc_base/constructormagic.h"
#include "rtc_base/criticalsection.h"
+#include "rtc_base/thread_annotations.h"
namespace rtc {
diff --git a/rtc_base/bytebuffer.h b/rtc_base/bytebuffer.h
index 9e08f02..4d25c21 100644
--- a/rtc_base/bytebuffer.h
+++ b/rtc_base/bytebuffer.h
@@ -11,6 +11,8 @@
#ifndef RTC_BASE_BYTEBUFFER_H_
#define RTC_BASE_BYTEBUFFER_H_
+#include <stddef.h>
+#include <stdint.h>
#include <string>
#include "rtc_base/buffer.h"
diff --git a/rtc_base/copyonwritebuffer.cc b/rtc_base/copyonwritebuffer.cc
index 6c48d52..8f5126a 100644
--- a/rtc_base/copyonwritebuffer.cc
+++ b/rtc_base/copyonwritebuffer.cc
@@ -10,6 +10,8 @@
#include "rtc_base/copyonwritebuffer.h"
+#include <stddef.h>
+
namespace rtc {
CopyOnWriteBuffer::CopyOnWriteBuffer() {
diff --git a/rtc_base/copyonwritebuffer.h b/rtc_base/copyonwritebuffer.h
index 177e38f..cc174df 100644
--- a/rtc_base/copyonwritebuffer.h
+++ b/rtc_base/copyonwritebuffer.h
@@ -11,7 +11,11 @@
#ifndef RTC_BASE_COPYONWRITEBUFFER_H_
#define RTC_BASE_COPYONWRITEBUFFER_H_
+#include <stdint.h>
#include <algorithm>
+#include <cstring>
+#include <string>
+#include <type_traits>
#include <utility>
#include "rtc_base/buffer.h"
diff --git a/rtc_base/criticalsection.cc b/rtc_base/criticalsection.cc
index d8a5b48..4e00be9 100644
--- a/rtc_base/criticalsection.cc
+++ b/rtc_base/criticalsection.cc
@@ -10,6 +10,8 @@
#include "rtc_base/criticalsection.h"
+#include <time.h>
+
#include "rtc_base/atomicops.h"
#include "rtc_base/checks.h"
#include "rtc_base/platform_thread_types.h"
diff --git a/rtc_base/event_tracer.cc b/rtc_base/event_tracer.cc
index c61def9..201abdd 100644
--- a/rtc_base/event_tracer.cc
+++ b/rtc_base/event_tracer.cc
@@ -10,7 +10,9 @@
#include "rtc_base/event_tracer.h"
#include <inttypes.h>
-
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
#include <string>
#include <vector>
@@ -20,6 +22,9 @@
#include "rtc_base/event.h"
#include "rtc_base/logging.h"
#include "rtc_base/platform_thread.h"
+#include "rtc_base/platform_thread_types.h"
+#include "rtc_base/thread_annotations.h"
+#include "rtc_base/thread_checker.h"
#include "rtc_base/timeutils.h"
#include "rtc_base/trace_event.h"
diff --git a/rtc_base/experiments/alr_experiment.cc b/rtc_base/experiments/alr_experiment.cc
index dff5ace..25e948d 100644
--- a/rtc_base/experiments/alr_experiment.cc
+++ b/rtc_base/experiments/alr_experiment.cc
@@ -10,9 +10,10 @@
#include "rtc_base/experiments/alr_experiment.h"
+#include <inttypes.h>
+#include <stdio.h>
#include <string>
-#include "rtc_base/format_macros.h"
#include "rtc_base/logging.h"
#include "system_wrappers/include/field_trial.h"
diff --git a/rtc_base/experiments/alr_experiment.h b/rtc_base/experiments/alr_experiment.h
index 4d9fd00..876bd02 100644
--- a/rtc_base/experiments/alr_experiment.h
+++ b/rtc_base/experiments/alr_experiment.h
@@ -11,6 +11,8 @@
#ifndef RTC_BASE_EXPERIMENTS_ALR_EXPERIMENT_H_
#define RTC_BASE_EXPERIMENTS_ALR_EXPERIMENT_H_
+#include <stdint.h>
+
#include "absl/types/optional.h"
namespace webrtc {
diff --git a/rtc_base/experiments/field_trial_units.cc b/rtc_base/experiments/field_trial_units.cc
index f53978b..8c201a6 100644
--- a/rtc_base/experiments/field_trial_units.cc
+++ b/rtc_base/experiments/field_trial_units.cc
@@ -9,6 +9,7 @@
*/
#include "rtc_base/experiments/field_trial_units.h"
+#include <stdio.h>
#include <limits>
#include <string>
diff --git a/rtc_base/fakesslidentity.h b/rtc_base/fakesslidentity.h
index 9d5770c..b19cbfb 100644
--- a/rtc_base/fakesslidentity.h
+++ b/rtc_base/fakesslidentity.h
@@ -14,6 +14,7 @@
#include <memory>
#include <vector>
+#include "rtc_base/sslcertificate.h"
#include "rtc_base/sslidentity.h"
namespace rtc {
diff --git a/rtc_base/file.h b/rtc_base/file.h
index 75fd93d..bc0974a 100644
--- a/rtc_base/file.h
+++ b/rtc_base/file.h
@@ -11,8 +11,8 @@
#ifndef RTC_BASE_FILE_H_
#define RTC_BASE_FILE_H_
+#include <stddef.h>
#include <stdint.h>
-
#include <string>
#include "rtc_base/constructormagic.h"
diff --git a/rtc_base/file_posix.cc b/rtc_base/file_posix.cc
index b0fec9f..4920192 100644
--- a/rtc_base/file_posix.cc
+++ b/rtc_base/file_posix.cc
@@ -8,17 +8,16 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "rtc_base/file.h"
-
#include <errno.h>
#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
+#include <stddef.h>
+#include <stdint.h>
#include <unistd.h>
-
#include <limits>
#include "rtc_base/checks.h"
+#include "rtc_base/file.h"
+#include "rtc_base/platform_file.h"
namespace rtc {
diff --git a/rtc_base/filerotatingstream.cc b/rtc_base/filerotatingstream.cc
index 31b0051..c28616d 100644
--- a/rtc_base/filerotatingstream.cc
+++ b/rtc_base/filerotatingstream.cc
@@ -13,12 +13,12 @@
#include <algorithm>
#include <cstdio>
#include <string>
+#include <utility>
#include "rtc_base/checks.h"
#include "rtc_base/fileutils.h"
#include "rtc_base/logging.h"
#include "rtc_base/pathutils.h"
-#include "rtc_base/strings/string_builder.h"
// Note: We use fprintf for logging in the write paths of this stream to avoid
// infinite loops when logging.
diff --git a/rtc_base/filerotatingstream.h b/rtc_base/filerotatingstream.h
index 4dab345..1d3da92 100644
--- a/rtc_base/filerotatingstream.h
+++ b/rtc_base/filerotatingstream.h
@@ -11,6 +11,7 @@
#ifndef RTC_BASE_FILEROTATINGSTREAM_H_
#define RTC_BASE_FILEROTATINGSTREAM_H_
+#include <stddef.h>
#include <memory>
#include <string>
#include <vector>
diff --git a/rtc_base/fileutils.h b/rtc_base/fileutils.h
index f7afaf9..deaf2e3 100644
--- a/rtc_base/fileutils.h
+++ b/rtc_base/fileutils.h
@@ -19,15 +19,12 @@
#include <dirent.h>
#include <stdio.h>
#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
#endif // WEBRTC_WIN
#include "rtc_base/constructormagic.h"
namespace rtc {
-class FileStream;
class Pathname;
//////////////////////////
diff --git a/rtc_base/helpers.h b/rtc_base/helpers.h
index d3b09cf..a93b321 100644
--- a/rtc_base/helpers.h
+++ b/rtc_base/helpers.h
@@ -11,6 +11,8 @@
#ifndef RTC_BASE_HELPERS_H_
#define RTC_BASE_HELPERS_H_
+#include <stddef.h>
+#include <stdint.h>
#include <string>
namespace rtc {
diff --git a/rtc_base/ipaddress.cc b/rtc_base/ipaddress.cc
index 9967ff3..027a7b2 100644
--- a/rtc_base/ipaddress.cc
+++ b/rtc_base/ipaddress.cc
@@ -11,24 +11,17 @@
#if defined(WEBRTC_POSIX)
#include <netinet/in.h>
#include <sys/socket.h>
-#include <sys/types.h>
#ifdef OPENBSD
#include <netinet/in_systm.h>
#endif
#ifndef __native_client__
#include <netinet/ip.h>
#endif
-#include <arpa/inet.h>
#include <netdb.h>
-#include <unistd.h>
#endif
-#include <stdio.h>
-
#include "rtc_base/byteorder.h"
-#include "rtc_base/checks.h"
#include "rtc_base/ipaddress.h"
-#include "rtc_base/logging.h"
#include "rtc_base/nethelpers.h"
#include "rtc_base/stringutils.h"
diff --git a/rtc_base/logging.cc b/rtc_base/logging.cc
index 53a1ed8..9c4ee41 100644
--- a/rtc_base/logging.cc
+++ b/rtc_base/logging.cc
@@ -20,24 +20,28 @@
#include <CoreServices/CoreServices.h>
#elif defined(WEBRTC_ANDROID)
#include <android/log.h>
+
// Android has a 1024 limit on log inputs. We use 60 chars as an
// approx for the header/tag portion.
// See android/system/core/liblog/logd_write.c
static const int kMaxLogLineSize = 1024 - 60;
#endif // WEBRTC_MAC && !defined(WEBRTC_IOS) || WEBRTC_ANDROID
+#include <stdio.h>
+#include <string.h>
#include <time.h>
-
#include <algorithm>
#include <cstdarg>
#include <vector>
+#include "rtc_base/checks.h"
#include "rtc_base/criticalsection.h"
#include "rtc_base/logging.h"
#include "rtc_base/platform_thread_types.h"
#include "rtc_base/stringencode.h"
#include "rtc_base/strings/string_builder.h"
#include "rtc_base/stringutils.h"
+#include "rtc_base/thread_annotations.h"
#include "rtc_base/timeutils.h"
namespace rtc {
diff --git a/rtc_base/logsinks.cc b/rtc_base/logsinks.cc
index 662b1f2..c01bafb 100644
--- a/rtc_base/logsinks.cc
+++ b/rtc_base/logsinks.cc
@@ -10,10 +10,12 @@
#include "rtc_base/logsinks.h"
+#include <string.h>
#include <cstdio>
#include <string>
#include "rtc_base/checks.h"
+#include "rtc_base/stream.h"
namespace rtc {
diff --git a/rtc_base/logsinks.h b/rtc_base/logsinks.h
index caf4a5f..d0867a2 100644
--- a/rtc_base/logsinks.h
+++ b/rtc_base/logsinks.h
@@ -11,6 +11,7 @@
#ifndef RTC_BASE_LOGSINKS_H_
#define RTC_BASE_LOGSINKS_H_
+#include <stddef.h>
#include <memory>
#include <string>
diff --git a/rtc_base/messagedigest.cc b/rtc_base/messagedigest.cc
index 9c10bcd..5a0d16a 100644
--- a/rtc_base/messagedigest.cc
+++ b/rtc_base/messagedigest.cc
@@ -10,9 +10,9 @@
#include "rtc_base/messagedigest.h"
-#include <memory>
-
#include <string.h>
+#include <cstdint>
+#include <memory>
#include "rtc_base/openssldigest.h"
#include "rtc_base/stringencode.h"
diff --git a/rtc_base/messagedigest.h b/rtc_base/messagedigest.h
index fc82088..757f914 100644
--- a/rtc_base/messagedigest.h
+++ b/rtc_base/messagedigest.h
@@ -11,6 +11,7 @@
#ifndef RTC_BASE_MESSAGEDIGEST_H_
#define RTC_BASE_MESSAGEDIGEST_H_
+#include <stddef.h>
#include <string>
namespace rtc {
diff --git a/rtc_base/messagequeue.cc b/rtc_base/messagequeue.cc
index 84d3a96..d710ba5 100644
--- a/rtc_base/messagequeue.cc
+++ b/rtc_base/messagequeue.cc
@@ -8,14 +8,15 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <algorithm>
-#include <utility> // for move
+#include <string>
+#include <utility>
#include "rtc_base/atomicops.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/messagequeue.h"
#include "rtc_base/thread.h"
-#include "rtc_base/timeutils.h" // for TimeMillis, TimeDiff, TimeUntil
+#include "rtc_base/timeutils.h"
#include "rtc_base/trace_event.h"
namespace rtc {
diff --git a/rtc_base/nethelpers.h b/rtc_base/nethelpers.h
index 429f0c0..138f958 100644
--- a/rtc_base/nethelpers.h
+++ b/rtc_base/nethelpers.h
@@ -12,8 +12,7 @@
#define RTC_BASE_NETHELPERS_H_
#if defined(WEBRTC_POSIX)
-#include <netdb.h>
-#include <stddef.h>
+#include <sys/socket.h>
#elif WEBRTC_WIN
#include <winsock2.h> // NOLINT
#endif
@@ -21,7 +20,7 @@
#include <vector>
#include "rtc_base/asyncresolverinterface.h"
-#include "rtc_base/ipaddress.h" // for IPAddress
+#include "rtc_base/ipaddress.h"
#include "rtc_base/signalthread.h"
#include "rtc_base/socketaddress.h"
diff --git a/rtc_base/network/sent_packet.h b/rtc_base/network/sent_packet.h
index ec80982..0cad31c 100644
--- a/rtc_base/network/sent_packet.h
+++ b/rtc_base/network/sent_packet.h
@@ -11,7 +11,8 @@
#ifndef RTC_BASE_NETWORK_SENT_PACKET_H_
#define RTC_BASE_NETWORK_SENT_PACKET_H_
-#include <inttypes.h>
+#include <stddef.h>
+#include <stdint.h>
#include "absl/types/optional.h"
diff --git a/rtc_base/networkmonitor.cc b/rtc_base/networkmonitor.cc
index e3b2efd..0185eab 100644
--- a/rtc_base/networkmonitor.cc
+++ b/rtc_base/networkmonitor.cc
@@ -10,7 +10,10 @@
#include "rtc_base/networkmonitor.h"
+#include <stdint.h>
+
#include "rtc_base/checks.h"
+#include "rtc_base/location.h"
#include "rtc_base/logging.h"
namespace {
diff --git a/rtc_base/nullsocketserver.h b/rtc_base/nullsocketserver.h
index 408bcd1..47a7fa6 100644
--- a/rtc_base/nullsocketserver.h
+++ b/rtc_base/nullsocketserver.h
@@ -11,7 +11,9 @@
#ifndef RTC_BASE_NULLSOCKETSERVER_H_
#define RTC_BASE_NULLSOCKETSERVER_H_
+#include "rtc_base/asyncsocket.h"
#include "rtc_base/event.h"
+#include "rtc_base/socket.h"
#include "rtc_base/socketserver.h"
namespace rtc {
diff --git a/rtc_base/numerics/sample_counter.h b/rtc_base/numerics/sample_counter.h
index 4fe71d1..18bd36b 100644
--- a/rtc_base/numerics/sample_counter.h
+++ b/rtc_base/numerics/sample_counter.h
@@ -11,6 +11,8 @@
#ifndef RTC_BASE_NUMERICS_SAMPLE_COUNTER_H_
#define RTC_BASE_NUMERICS_SAMPLE_COUNTER_H_
+#include <stdint.h>
+
#include "absl/types/optional.h"
namespace rtc {
diff --git a/rtc_base/openssladapter.cc b/rtc_base/openssladapter.cc
index 2ca17a6..fcfa53b 100644
--- a/rtc_base/openssladapter.cc
+++ b/rtc_base/openssladapter.cc
@@ -10,26 +10,25 @@
#include "rtc_base/openssladapter.h"
-#if defined(WEBRTC_POSIX)
-#include <unistd.h>
-#endif
+#include <errno.h>
#include <openssl/bio.h>
-#include <openssl/crypto.h>
#include <openssl/err.h>
-#include <openssl/opensslv.h>
#include <openssl/rand.h>
#include <openssl/x509.h>
-#include <openssl/x509v3.h>
#include "rtc_base/openssl.h"
-#include "absl/memory/memory.h" // for make_unique
+#include <string.h>
+#include <time.h>
+
+#include "absl/memory/memory.h"
#include "rtc_base/checks.h"
+#include "rtc_base/location.h"
#include "rtc_base/logging.h"
#include "rtc_base/numerics/safe_conversions.h"
+#include "rtc_base/opensslcertificate.h"
#include "rtc_base/opensslutility.h"
#include "rtc_base/stringencode.h"
-#include "rtc_base/stringutils.h"
#include "rtc_base/thread.h"
#ifndef OPENSSL_IS_BORINGSSL
diff --git a/rtc_base/openssladapter.h b/rtc_base/openssladapter.h
index 45ffc6f..e77575e 100644
--- a/rtc_base/openssladapter.h
+++ b/rtc_base/openssladapter.h
@@ -11,24 +11,24 @@
#ifndef RTC_BASE_OPENSSLADAPTER_H_
#define RTC_BASE_OPENSSLADAPTER_H_
-#include <openssl/ossl_typ.h>
-
+#include <stddef.h>
+#include <stdint.h>
#include <memory>
#include <string>
#include <vector>
-#include "rtc_base/asyncsocket.h" // for AsyncSocket
-#include "rtc_base/buffer.h" // for Buffer
-#include "rtc_base/messagehandler.h" // for MessageHandler
-#include "rtc_base/messagequeue.h" // for Message
-#include "rtc_base/opensslidentity.h" // for SSL_CTX, OpenSSLIdentity
-#include "rtc_base/opensslsessioncache.h" // for OpenSSLSessionCache
-#include "rtc_base/socket.h" // for Socket::ConnState
-#include "rtc_base/socketaddress.h" // for SocketAddress
-#include "rtc_base/ssladapter.h" // for SSLAdapter, SSLAdapterFactory
-#include "rtc_base/sslcertificate.h" // for SSLCertificateVerifier
-#include "rtc_base/sslidentity.h" // for SSLIdentity
-#include "rtc_base/sslstreamadapter.h" // for SSLMode, SSLRole, SSL_MODE...
+#include "rtc_base/asyncsocket.h"
+#include "rtc_base/buffer.h"
+#include "rtc_base/messagehandler.h"
+#include "rtc_base/messagequeue.h"
+#include "rtc_base/opensslidentity.h"
+#include "rtc_base/opensslsessioncache.h"
+#include "rtc_base/socket.h"
+#include "rtc_base/socketaddress.h"
+#include "rtc_base/ssladapter.h"
+#include "rtc_base/sslcertificate.h"
+#include "rtc_base/sslidentity.h"
+#include "rtc_base/sslstreamadapter.h"
namespace rtc {
diff --git a/rtc_base/opensslcertificate.cc b/rtc_base/opensslcertificate.cc
index 92443a4..fa41065 100644
--- a/rtc_base/opensslcertificate.cc
+++ b/rtc_base/opensslcertificate.cc
@@ -10,10 +10,6 @@
#include "rtc_base/opensslcertificate.h"
-#include <memory>
-#include <utility>
-#include <vector>
-
#if defined(WEBRTC_WIN)
// Must be included first before openssl headers.
#include "rtc_base/win32.h" // NOLINT
@@ -21,24 +17,17 @@
#include <openssl/bio.h>
#include <openssl/bn.h>
-#include <openssl/crypto.h>
-#include <openssl/err.h>
#include <openssl/pem.h>
-#include <openssl/rsa.h>
+#include <time.h>
#include "absl/memory/memory.h"
-#include "rtc_base/arraysize.h"
#include "rtc_base/checks.h"
#include "rtc_base/helpers.h"
#include "rtc_base/logging.h"
-#include "rtc_base/numerics/safe_conversions.h"
-#include "rtc_base/openssl.h"
+#include "rtc_base/messagedigest.h"
#include "rtc_base/openssldigest.h"
#include "rtc_base/opensslidentity.h"
#include "rtc_base/opensslutility.h"
-#ifndef WEBRTC_EXCLUDE_BUILT_IN_SSL_ROOT_CERTS
-#include "rtc_base/sslroots.h"
-#endif // WEBRTC_EXCLUDE_BUILT_IN_SSL_ROOT_CERTS
namespace rtc {
diff --git a/rtc_base/opensslcertificate.h b/rtc_base/opensslcertificate.h
index ef416a1..40de021 100644
--- a/rtc_base/opensslcertificate.h
+++ b/rtc_base/opensslcertificate.h
@@ -11,16 +11,16 @@
#ifndef RTC_BASE_OPENSSLCERTIFICATE_H_
#define RTC_BASE_OPENSSLCERTIFICATE_H_
-#include <openssl/ossl_typ.h> // for X509, SSL_CTX
+#include <openssl/ossl_typ.h>
-#include <stddef.h> // for size_t
-#include <stdint.h> // for int64_t
+#include <stddef.h>
+#include <stdint.h>
#include <string>
-#include "rtc_base/buffer.h" // for Buffer
-#include "rtc_base/constructormagic.h" // for RTC_DISALLOW_COPY_AND_ASSIGN
-#include "rtc_base/sslcertificate.h" // for SSLCertificate
-#include "rtc_base/sslidentity.h" // for SSLIdentityParams
+#include "rtc_base/buffer.h"
+#include "rtc_base/constructormagic.h"
+#include "rtc_base/sslcertificate.h"
+#include "rtc_base/sslidentity.h"
namespace rtc {
diff --git a/rtc_base/openssldigest.cc b/rtc_base/openssldigest.cc
index 9b644c4..da90b65 100644
--- a/rtc_base/openssldigest.cc
+++ b/rtc_base/openssldigest.cc
@@ -10,7 +10,7 @@
#include "rtc_base/openssldigest.h"
-#include "rtc_base/checks.h"
+#include "rtc_base/checks.h" // RTC_DCHECK, RTC_CHECK
#include "rtc_base/openssl.h"
namespace rtc {
diff --git a/rtc_base/openssldigest.h b/rtc_base/openssldigest.h
index 78d28d7..78986f5 100644
--- a/rtc_base/openssldigest.h
+++ b/rtc_base/openssldigest.h
@@ -11,7 +11,8 @@
#ifndef RTC_BASE_OPENSSLDIGEST_H_
#define RTC_BASE_OPENSSLDIGEST_H_
-#include <openssl/ossl_typ.h> // for EVP_MD, EVP_MD_CTX
+#include <openssl/base.h>
+#include <stddef.h>
#include <string>
#include "rtc_base/messagedigest.h"
diff --git a/rtc_base/opensslidentity.cc b/rtc_base/opensslidentity.cc
index a5bbd5d..9850c85 100644
--- a/rtc_base/opensslidentity.cc
+++ b/rtc_base/opensslidentity.cc
@@ -21,18 +21,17 @@
#include <openssl/bio.h>
#include <openssl/bn.h>
-#include <openssl/crypto.h>
#include <openssl/err.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>
+#include <stdint.h>
+
#include "absl/memory/memory.h"
#include "rtc_base/checks.h"
-#include "rtc_base/helpers.h"
#include "rtc_base/logging.h"
#include "rtc_base/numerics/safe_conversions.h"
#include "rtc_base/openssl.h"
-#include "rtc_base/openssldigest.h"
#include "rtc_base/opensslutility.h"
namespace rtc {
diff --git a/rtc_base/opensslidentity.h b/rtc_base/opensslidentity.h
index d0e87a0..21bee91 100644
--- a/rtc_base/opensslidentity.h
+++ b/rtc_base/opensslidentity.h
@@ -11,17 +11,17 @@
#ifndef RTC_BASE_OPENSSLIDENTITY_H_
#define RTC_BASE_OPENSSLIDENTITY_H_
-#include <openssl/ossl_typ.h> // for EVP_PKEY, SSL_CTX
+#include <openssl/ossl_typ.h>
-#include <ctime> // for time_t
-#include <memory> // for unique_ptr
+#include <ctime>
+#include <memory>
#include <string>
-#include "rtc_base/checks.h" // for RTC_DCHECK
-#include "rtc_base/constructormagic.h" // for RTC_DISALLOW_COPY_AND_ASSIGN
-#include "rtc_base/opensslcertificate.h" // for OpenSSLCertificate
-#include "rtc_base/sslcertificate.h" // for SSLCertChain
-#include "rtc_base/sslidentity.h" // for SSLIdentity, KeyParams, SSL...
+#include "rtc_base/checks.h"
+#include "rtc_base/constructormagic.h"
+#include "rtc_base/opensslcertificate.h"
+#include "rtc_base/sslcertificate.h"
+#include "rtc_base/sslidentity.h"
namespace rtc {
diff --git a/rtc_base/opensslstreamadapter.cc b/rtc_base/opensslstreamadapter.cc
index 3eb3b80..47ca125 100644
--- a/rtc_base/opensslstreamadapter.cc
+++ b/rtc_base/opensslstreamadapter.cc
@@ -32,6 +32,7 @@
#include "rtc_base/openssladapter.h"
#include "rtc_base/openssldigest.h"
#include "rtc_base/opensslidentity.h"
+#include "rtc_base/sslcertificate.h"
#include "rtc_base/stream.h"
#include "rtc_base/stringutils.h"
#include "rtc_base/thread.h"
diff --git a/rtc_base/opensslstreamadapter.h b/rtc_base/opensslstreamadapter.h
index 61ffc3d..d282932 100644
--- a/rtc_base/opensslstreamadapter.h
+++ b/rtc_base/opensslstreamadapter.h
@@ -13,13 +13,18 @@
#include <openssl/ossl_typ.h>
+#include <stddef.h>
+#include <stdint.h>
#include <memory>
#include <string>
#include <vector>
#include "rtc_base/buffer.h"
+#include "rtc_base/messagequeue.h"
#include "rtc_base/opensslidentity.h"
+#include "rtc_base/sslidentity.h"
#include "rtc_base/sslstreamadapter.h"
+#include "rtc_base/stream.h"
namespace rtc {
@@ -47,7 +52,7 @@
// Look in sslstreamadapter.h for documentation of the methods.
-class OpenSSLIdentity;
+class SSLCertChain;
///////////////////////////////////////////////////////////////////////////////
diff --git a/rtc_base/opensslutility.cc b/rtc_base/opensslutility.cc
index 46f4547..a3f3347 100644
--- a/rtc_base/opensslutility.cc
+++ b/rtc_base/opensslutility.cc
@@ -9,29 +9,21 @@
*/
#include "rtc_base/opensslutility.h"
-
-#include <memory>
-
-#if defined(WEBRTC_POSIX)
-#include <unistd.h>
-#endif
-
#if defined(WEBRTC_WIN)
// Must be included first before openssl headers.
#include "rtc_base/win32.h" // NOLINT
#endif // WEBRTC_WIN
-#include <openssl/bio.h>
-#include <openssl/crypto.h>
#include <openssl/err.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
+#include "rtc_base/openssl.h"
+
+#include <stddef.h>
#include "rtc_base/arraysize.h"
-#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/numerics/safe_conversions.h"
-#include "rtc_base/openssl.h"
#include "rtc_base/opensslcertificate.h"
#ifndef WEBRTC_EXCLUDE_BUILT_IN_SSL_ROOT_CERTS
#include "rtc_base/sslroots.h"
diff --git a/rtc_base/platform_file.cc b/rtc_base/platform_file.cc
index d74acdd..baefb22 100644
--- a/rtc_base/platform_file.cc
+++ b/rtc_base/platform_file.cc
@@ -12,11 +12,11 @@
#if defined(WEBRTC_WIN)
#include <io.h>
+
#include "rtc_base/stringutils.h" // For ToUtf16
#else
#include <fcntl.h>
#include <sys/stat.h>
-#include <sys/types.h>
#include <unistd.h>
#endif
diff --git a/rtc_base/platform_thread.cc b/rtc_base/platform_thread.cc
index 79d9d53..ba84b6a 100644
--- a/rtc_base/platform_thread.cc
+++ b/rtc_base/platform_thread.cc
@@ -10,15 +10,17 @@
#include "rtc_base/platform_thread.h"
+#if !defined(WEBRTC_WIN)
+#include <sched.h>
+#endif
+#include <stdint.h>
+#include <time.h>
+#include <algorithm>
+
#include "rtc_base/atomicops.h"
#include "rtc_base/checks.h"
#include "rtc_base/timeutils.h"
-#if defined(WEBRTC_LINUX)
-#include <sys/prctl.h>
-#include <sys/syscall.h>
-#endif
-
namespace rtc {
namespace {
#if defined(WEBRTC_WIN)
diff --git a/rtc_base/platform_thread.h b/rtc_base/platform_thread.h
index ea67aca..47c23dc 100644
--- a/rtc_base/platform_thread.h
+++ b/rtc_base/platform_thread.h
@@ -11,6 +11,9 @@
#ifndef RTC_BASE_PLATFORM_THREAD_H_
#define RTC_BASE_PLATFORM_THREAD_H_
+#ifndef WEBRTC_WIN
+#include <pthread.h>
+#endif
#include <string>
#include "rtc_base/constructormagic.h"
diff --git a/rtc_base/race_checker.h b/rtc_base/race_checker.h
index d6eba08..4d57460 100644
--- a/rtc_base/race_checker.h
+++ b/rtc_base/race_checker.h
@@ -12,7 +12,7 @@
#define RTC_BASE_RACE_CHECKER_H_
#include "rtc_base/checks.h"
-#include "rtc_base/platform_thread_types.h" // for PlatformThreadRef
+#include "rtc_base/platform_thread_types.h"
#include "rtc_base/thread_annotations.h"
namespace rtc {
diff --git a/rtc_base/random.h b/rtc_base/random.h
index 2faa985..e1c3bb7 100644
--- a/rtc_base/random.h
+++ b/rtc_base/random.h
@@ -11,6 +11,7 @@
#ifndef RTC_BASE_RANDOM_H_
#define RTC_BASE_RANDOM_H_
+#include <stdint.h>
#include <limits>
#include "rtc_base/checks.h"
diff --git a/rtc_base/rate_limiter.cc b/rtc_base/rate_limiter.cc
index 0343f25..5c7bdef 100644
--- a/rtc_base/rate_limiter.cc
+++ b/rtc_base/rate_limiter.cc
@@ -9,6 +9,10 @@
*/
#include "rtc_base/rate_limiter.h"
+
+#include <limits>
+
+#include "absl/types/optional.h"
#include "system_wrappers/include/clock.h"
namespace webrtc {
diff --git a/rtc_base/rate_limiter.h b/rtc_base/rate_limiter.h
index 0bfde0d..43ef88d 100644
--- a/rtc_base/rate_limiter.h
+++ b/rtc_base/rate_limiter.h
@@ -11,11 +11,13 @@
#ifndef RTC_BASE_RATE_LIMITER_H_
#define RTC_BASE_RATE_LIMITER_H_
-#include <limits>
+#include <stddef.h>
+#include <stdint.h>
#include "rtc_base/constructormagic.h"
#include "rtc_base/criticalsection.h"
#include "rtc_base/rate_statistics.h"
+#include "rtc_base/thread_annotations.h"
namespace webrtc {
diff --git a/rtc_base/rate_statistics.h b/rtc_base/rate_statistics.h
index 68035c9..d4ccc59 100644
--- a/rtc_base/rate_statistics.h
+++ b/rtc_base/rate_statistics.h
@@ -11,6 +11,8 @@
#ifndef RTC_BASE_RATE_STATISTICS_H_
#define RTC_BASE_RATE_STATISTICS_H_
+#include <stddef.h>
+#include <stdint.h>
#include <memory>
#include "absl/types/optional.h"
diff --git a/rtc_base/rtccertificate.cc b/rtc_base/rtccertificate.cc
index 786333f..17c1575 100644
--- a/rtc_base/rtccertificate.cc
+++ b/rtc_base/rtccertificate.cc
@@ -14,6 +14,8 @@
#include "rtc_base/checks.h"
#include "rtc_base/refcountedobject.h"
+#include "rtc_base/sslcertificate.h"
+#include "rtc_base/sslidentity.h"
#include "rtc_base/timeutils.h"
namespace rtc {
diff --git a/rtc_base/rtccertificate.h b/rtc_base/rtccertificate.h
index d5422f8..0adefbc 100644
--- a/rtc_base/rtccertificate.h
+++ b/rtc_base/rtccertificate.h
@@ -12,15 +12,18 @@
#define RTC_BASE_RTCCERTIFICATE_H_
#include <stdint.h>
-
#include <memory>
+#include <string>
#include "rtc_base/refcount.h"
#include "rtc_base/scoped_ref_ptr.h"
-#include "rtc_base/sslidentity.h"
namespace rtc {
+class SSLCertChain;
+class SSLCertificate;
+class SSLIdentity;
+
// This class contains PEM strings of an RTCCertificate's private key and
// certificate and acts as a text representation of RTCCertificate. Certificates
// can be serialized and deserialized to and from this format, which allows for
diff --git a/rtc_base/rtccertificategenerator.cc b/rtc_base/rtccertificategenerator.cc
index 0b51c61..3867ceb 100644
--- a/rtc_base/rtccertificategenerator.cc
+++ b/rtc_base/rtccertificategenerator.cc
@@ -10,10 +10,15 @@
#include "rtc_base/rtccertificategenerator.h"
+#include <time.h>
#include <algorithm>
#include <memory>
+#include <utility>
#include "rtc_base/checks.h"
+#include "rtc_base/location.h"
+#include "rtc_base/messagehandler.h"
+#include "rtc_base/messagequeue.h"
#include "rtc_base/refcountedobject.h"
#include "rtc_base/sslidentity.h"
diff --git a/rtc_base/rtccertificategenerator.h b/rtc_base/rtccertificategenerator.h
index a6c503a..fed075e 100644
--- a/rtc_base/rtccertificategenerator.h
+++ b/rtc_base/rtccertificategenerator.h
@@ -11,6 +11,8 @@
#ifndef RTC_BASE_RTCCERTIFICATEGENERATOR_H_
#define RTC_BASE_RTCCERTIFICATEGENERATOR_H_
+#include <stdint.h>
+
#include "absl/types/optional.h"
#include "rtc_base/refcount.h"
#include "rtc_base/rtccertificate.h"
diff --git a/rtc_base/sequenced_task_checker_impl.cc b/rtc_base/sequenced_task_checker_impl.cc
index 16069c2..717cb95 100644
--- a/rtc_base/sequenced_task_checker_impl.cc
+++ b/rtc_base/sequenced_task_checker_impl.cc
@@ -14,6 +14,7 @@
#include <dispatch/dispatch.h>
#endif
+#include "rtc_base/checks.h"
#include "rtc_base/sequenced_task_checker.h"
#include "rtc_base/task_queue.h"
diff --git a/rtc_base/signalthread.cc b/rtc_base/signalthread.cc
index 2e0fa0c..5dd9387 100644
--- a/rtc_base/signalthread.cc
+++ b/rtc_base/signalthread.cc
@@ -10,9 +10,13 @@
#include "rtc_base/signalthread.h"
+#include <memory>
+
#include "absl/memory/memory.h"
#include "rtc_base/checks.h"
+#include "rtc_base/location.h"
#include "rtc_base/nullsocketserver.h"
+#include "rtc_base/socketserver.h"
namespace rtc {
diff --git a/rtc_base/signalthread.h b/rtc_base/signalthread.h
index 448b289..9208e2c 100644
--- a/rtc_base/signalthread.h
+++ b/rtc_base/signalthread.h
@@ -14,13 +14,13 @@
#include <string>
#include "rtc_base/checks.h"
-#include "rtc_base/constructormagic.h" // for RTC_DISALLOW_IMPLI...
-#include "rtc_base/criticalsection.h" // for CriticalSection
-#include "rtc_base/messagehandler.h" // for MessageHandler
-#include "rtc_base/messagequeue.h" // for Message
-#include "rtc_base/third_party/sigslot/sigslot.h" // for has_slots, signal_...
-#include "rtc_base/thread.h" // for Thread
-#include "rtc_base/thread_annotations.h" // for RTC_EXCLUSIVE_LOCK...
+#include "rtc_base/constructormagic.h"
+#include "rtc_base/criticalsection.h"
+#include "rtc_base/messagehandler.h"
+#include "rtc_base/messagequeue.h"
+#include "rtc_base/third_party/sigslot/sigslot.h"
+#include "rtc_base/thread.h"
+#include "rtc_base/thread_annotations.h"
namespace rtc {
diff --git a/rtc_base/socketadapters.cc b/rtc_base/socketadapters.cc
index 98be868..45e002a 100644
--- a/rtc_base/socketadapters.cc
+++ b/rtc_base/socketadapters.cc
@@ -13,18 +13,23 @@
#endif
#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <time.h>
#if defined(WEBRTC_WIN)
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
+
#define SECURITY_WIN32
#include <security.h>
#endif
#include <algorithm>
+#include "rtc_base/buffer.h"
#include "rtc_base/bytebuffer.h"
#include "rtc_base/checks.h"
#include "rtc_base/httpcommon.h"
diff --git a/rtc_base/socketaddresspair.h b/rtc_base/socketaddresspair.h
index 5ff148a..6691386 100644
--- a/rtc_base/socketaddresspair.h
+++ b/rtc_base/socketaddresspair.h
@@ -11,6 +11,8 @@
#ifndef RTC_BASE_SOCKETADDRESSPAIR_H_
#define RTC_BASE_SOCKETADDRESSPAIR_H_
+#include <stddef.h>
+
#include "rtc_base/socketaddress.h"
namespace rtc {
diff --git a/rtc_base/socketstream.cc b/rtc_base/socketstream.cc
index 2ea1cec..8978404 100644
--- a/rtc_base/socketstream.cc
+++ b/rtc_base/socketstream.cc
@@ -11,6 +11,7 @@
#include "rtc_base/socketstream.h"
#include "rtc_base/checks.h"
+#include "rtc_base/socket.h"
namespace rtc {
diff --git a/rtc_base/ssladapter.h b/rtc_base/ssladapter.h
index 4843d26..7ebedca 100644
--- a/rtc_base/ssladapter.h
+++ b/rtc_base/ssladapter.h
@@ -16,6 +16,7 @@
#include "rtc_base/asyncsocket.h"
#include "rtc_base/sslcertificate.h"
+#include "rtc_base/sslidentity.h"
#include "rtc_base/sslstreamadapter.h"
namespace rtc {
diff --git a/rtc_base/sslcertificate.cc b/rtc_base/sslcertificate.cc
index d735ebf..934848f 100644
--- a/rtc_base/sslcertificate.cc
+++ b/rtc_base/sslcertificate.cc
@@ -10,15 +10,15 @@
#include "rtc_base/sslcertificate.h"
-#include <algorithm> // for transform
+#include <algorithm>
#include <string>
#include <utility>
-#include "absl/memory/memory.h" // for WrapUnique, make_unique
-#include "rtc_base/checks.h" // for FatalLogCall, RTC_DC...
-#include "rtc_base/opensslcertificate.h" // for OpenSSLCertificate
-#include "rtc_base/sslfingerprint.h" // for SSLFingerprint
-#include "rtc_base/third_party/base64/base64.h" // for Base64
+#include "absl/memory/memory.h"
+#include "rtc_base/checks.h"
+#include "rtc_base/opensslcertificate.h"
+#include "rtc_base/sslfingerprint.h"
+#include "rtc_base/third_party/base64/base64.h"
namespace rtc {
diff --git a/rtc_base/sslcertificate.h b/rtc_base/sslcertificate.h
index c04852f..59567c9 100644
--- a/rtc_base/sslcertificate.h
+++ b/rtc_base/sslcertificate.h
@@ -15,6 +15,8 @@
#ifndef RTC_BASE_SSLCERTIFICATE_H_
#define RTC_BASE_SSLCERTIFICATE_H_
+#include <stddef.h>
+#include <stdint.h>
#include <memory>
#include <string>
#include <vector>
diff --git a/rtc_base/sslfingerprint.cc b/rtc_base/sslfingerprint.cc
index 03a627f..db13cf6 100644
--- a/rtc_base/sslfingerprint.cc
+++ b/rtc_base/sslfingerprint.cc
@@ -11,11 +11,16 @@
#include "rtc_base/sslfingerprint.h"
#include <ctype.h>
+#include <algorithm>
+#include <cstdint>
#include <string>
#include "absl/memory/memory.h"
#include "rtc_base/logging.h"
#include "rtc_base/messagedigest.h"
+#include "rtc_base/rtccertificate.h"
+#include "rtc_base/sslcertificate.h"
+#include "rtc_base/sslidentity.h"
#include "rtc_base/stringencode.h"
namespace rtc {
diff --git a/rtc_base/sslfingerprint.h b/rtc_base/sslfingerprint.h
index b8109e8..ea10ede 100644
--- a/rtc_base/sslfingerprint.h
+++ b/rtc_base/sslfingerprint.h
@@ -11,15 +11,17 @@
#ifndef RTC_BASE_SSLFINGERPRINT_H_
#define RTC_BASE_SSLFINGERPRINT_H_
+#include <stddef.h>
+#include <stdint.h>
#include <string>
#include "rtc_base/copyonwritebuffer.h"
-#include "rtc_base/rtccertificate.h"
-#include "rtc_base/sslidentity.h"
namespace rtc {
+class RTCCertificate;
class SSLCertificate;
+class SSLIdentity;
struct SSLFingerprint {
// TODO(steveanton): Remove once downstream projects have moved off of this.
diff --git a/rtc_base/sslidentity.cc b/rtc_base/sslidentity.cc
index 1d136d7..e15fde6 100644
--- a/rtc_base/sslidentity.cc
+++ b/rtc_base/sslidentity.cc
@@ -11,15 +11,16 @@
// Handling of certificates and keypairs for SSLStreamAdapter's peer mode.
#include "rtc_base/sslidentity.h"
-#include <string.h> // for strspn
-#include <ctime>
+#include <string.h>
+#include <time.h>
#include <string>
-#include "rtc_base/checks.h" // for FatalLogCall, RTC_DC...
-#include "rtc_base/opensslidentity.h" // for OpenSSLIdentity
-#include "rtc_base/strings/string_builder.h" // for StringBuilder
-#include "rtc_base/third_party/base64/base64.h" // for Base64, Base64::DO_P...
-#include "rtc_base/timeutils.h" // for TmToSeconds
+#include "rtc_base/checks.h"
+#include "rtc_base/opensslidentity.h"
+#include "rtc_base/sslcertificate.h"
+#include "rtc_base/strings/string_builder.h"
+#include "rtc_base/third_party/base64/base64.h"
+#include "rtc_base/timeutils.h"
namespace rtc {
@@ -239,7 +240,7 @@
year += 100;
}
- std::tm tm;
+ tm tm;
tm.tm_year = year;
// Read out remaining ASN1 time data and store it in |tm| in documented
diff --git a/rtc_base/sslidentity.h b/rtc_base/sslidentity.h
index d17d38b..39feeab 100644
--- a/rtc_base/sslidentity.h
+++ b/rtc_base/sslidentity.h
@@ -13,13 +13,15 @@
#ifndef RTC_BASE_SSLIDENTITY_H_
#define RTC_BASE_SSLIDENTITY_H_
+#include <stdint.h>
#include <ctime>
#include <string>
-#include "rtc_base/sslcertificate.h"
-
namespace rtc {
+class SSLCertChain;
+class SSLCertificate;
+
// KT_LAST is intended for vector declarations and loops over all key types;
// it does not represent any key type in itself.
// KT_DEFAULT is used as the default KeyType for KeyParams.
diff --git a/rtc_base/stream.cc b/rtc_base/stream.cc
index ea2e47a..abaa96e 100644
--- a/rtc_base/stream.cc
+++ b/rtc_base/stream.cc
@@ -7,28 +7,23 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
-
-#if defined(WEBRTC_POSIX)
-#include <sys/file.h>
-#endif // WEBRTC_POSIX
#include <errno.h>
+#include <string.h>
#include <sys/stat.h>
-#include <sys/types.h>
-
-#include <string.h> // for memcpy, memmove, strlen
#include <algorithm>
#include <string>
#include "rtc_base/checks.h"
-#include "rtc_base/location.h" // for RTC_FROM_HERE
+#include "rtc_base/location.h"
#include "rtc_base/messagequeue.h"
#include "rtc_base/stream.h"
#include "rtc_base/thread.h"
#if defined(WEBRTC_WIN)
#include <windows.h>
+
#define fileno _fileno
-#include "rtc_base/stringutils.h" // for ToUtf16
+#include "rtc_base/stringutils.h"
#endif
namespace rtc {
diff --git a/rtc_base/string_to_number.cc b/rtc_base/string_to_number.cc
index 9201242..634652b 100644
--- a/rtc_base/string_to_number.cc
+++ b/rtc_base/string_to_number.cc
@@ -10,6 +10,7 @@
#include "rtc_base/string_to_number.h"
+#include <ctype.h>
#include <cerrno>
#include <cstdlib>
diff --git a/rtc_base/string_to_number.h b/rtc_base/string_to_number.h
index 7ea9f25..4cb5215 100644
--- a/rtc_base/string_to_number.h
+++ b/rtc_base/string_to_number.h
@@ -13,6 +13,7 @@
#include <limits>
#include <string>
+#include <type_traits>
#include "absl/types/optional.h"
diff --git a/rtc_base/stringencode.cc b/rtc_base/stringencode.cc
index 36c3f91..df981b0 100644
--- a/rtc_base/stringencode.cc
+++ b/rtc_base/stringencode.cc
@@ -10,6 +10,8 @@
#include "rtc_base/stringencode.h"
+#include <cstdio>
+
#include "rtc_base/arraysize.h"
#include "rtc_base/checks.h"
#include "rtc_base/stringutils.h"
diff --git a/rtc_base/stringencode.h b/rtc_base/stringencode.h
index 5d436df..09bf77f 100644
--- a/rtc_base/stringencode.h
+++ b/rtc_base/stringencode.h
@@ -11,9 +11,12 @@
#ifndef RTC_BASE_STRINGENCODE_H_
#define RTC_BASE_STRINGENCODE_H_
+#include <stddef.h>
#include <string>
+#include <type_traits>
#include <vector>
+#include "absl/types/optional.h"
#include "rtc_base/checks.h"
#include "rtc_base/string_to_number.h"
diff --git a/rtc_base/strings/audio_format_to_string.cc b/rtc_base/strings/audio_format_to_string.cc
index a149344..7e91c3b 100644
--- a/rtc_base/strings/audio_format_to_string.cc
+++ b/rtc_base/strings/audio_format_to_string.cc
@@ -10,6 +10,8 @@
#include "rtc_base/strings/audio_format_to_string.h"
+#include <utility>
+
#include "rtc_base/strings/string_builder.h"
namespace rtc {
diff --git a/rtc_base/strings/string_builder.cc b/rtc_base/strings/string_builder.cc
index 0dca938..adf4fa9 100644
--- a/rtc_base/strings/string_builder.cc
+++ b/rtc_base/strings/string_builder.cc
@@ -10,11 +10,11 @@
#include "rtc_base/strings/string_builder.h"
-#include <stdarg.h> // for va_end, va_list, va_start
-#include <cstring> // for strlen
+#include <stdarg.h>
+#include <cstring>
-#include "rtc_base/checks.h" // for FatalLogCall, RTC_DCHECK
-#include "rtc_base/numerics/safe_minmax.h" // for SafeMin
+#include "rtc_base/checks.h"
+#include "rtc_base/numerics/safe_minmax.h"
namespace rtc {
diff --git a/rtc_base/stringutils.cc b/rtc_base/stringutils.cc
index 333c060..c808eb2 100644
--- a/rtc_base/stringutils.cc
+++ b/rtc_base/stringutils.cc
@@ -10,8 +10,6 @@
#include "rtc_base/stringutils.h"
-#include "rtc_base/checks.h"
-
namespace rtc {
size_t strcpyn(char* buffer,
diff --git a/rtc_base/stringutils.h b/rtc_base/stringutils.h
index 2f75c09..45f3a3a 100644
--- a/rtc_base/stringutils.h
+++ b/rtc_base/stringutils.h
@@ -20,6 +20,7 @@
#include <malloc.h>
#include <wchar.h>
#include <windows.h>
+
#define alloca _alloca
#endif // WEBRTC_WIN
@@ -29,6 +30,7 @@
#else // BSD
#include <alloca.h>
#endif // !BSD
+#include <strings.h>
#endif // WEBRTC_POSIX
#include <string>
diff --git a/rtc_base/synchronization/rw_lock_posix.cc b/rtc_base/synchronization/rw_lock_posix.cc
index 7e37dc9..15ef3d7 100644
--- a/rtc_base/synchronization/rw_lock_posix.cc
+++ b/rtc_base/synchronization/rw_lock_posix.cc
@@ -10,6 +10,8 @@
#include "rtc_base/synchronization/rw_lock_posix.h"
+#include <stddef.h>
+
namespace webrtc {
RWLockPosix::RWLockPosix() : lock_() {}
diff --git a/rtc_base/system/file_wrapper.cc b/rtc_base/system/file_wrapper.cc
index 72f5f25..c033a79 100644
--- a/rtc_base/system/file_wrapper.cc
+++ b/rtc_base/system/file_wrapper.cc
@@ -13,14 +13,11 @@
#ifdef _WIN32
#include <Windows.h>
#else
-#include <stdarg.h>
#include <string.h>
#endif
#include <utility>
-#include "rtc_base/checks.h"
-
namespace webrtc {
namespace {
FILE* FileOpen(const char* file_name_utf8, bool read_only) {
diff --git a/rtc_base/system/file_wrapper.h b/rtc_base/system/file_wrapper.h
index 5411b04..0bb86a3 100644
--- a/rtc_base/system/file_wrapper.h
+++ b/rtc_base/system/file_wrapper.h
@@ -14,7 +14,6 @@
#include <stddef.h>
#include <stdio.h>
-#include "common_types.h" // NOLINT(build/include)
#include "rtc_base/criticalsection.h"
// Implementation that can read (exclusive) or write from/to a file.
diff --git a/rtc_base/task_queue_libevent.cc b/rtc_base/task_queue_libevent.cc
index ce05bae..905bbda 100644
--- a/rtc_base/task_queue_libevent.cc
+++ b/rtc_base/task_queue_libevent.cc
@@ -10,17 +10,17 @@
#include "rtc_base/task_queue.h"
-#include <errno.h> // for EAGAIN, errno
+#include <errno.h>
#include <fcntl.h>
-#include <pthread.h> // for pthread_getspecific
+#include <pthread.h>
#include <signal.h>
-#include <stdint.h> // for uint32_t
-#include <time.h> // for nanosleep, timespec
+#include <stdint.h>
+#include <time.h>
#include <unistd.h>
#include <list>
-#include <memory> // for unique_ptr, allocator
-#include <type_traits> // for remove_reference<>::...
-#include <utility> // for move
+#include <memory>
+#include <type_traits>
+#include <utility>
#include "base/third_party/libevent/event.h"
#include "rtc_base/checks.h"
@@ -28,13 +28,13 @@
#include "rtc_base/logging.h"
#include "rtc_base/numerics/safe_conversions.h"
#include "rtc_base/platform_thread.h"
-#include "rtc_base/platform_thread_types.h" // for CurrentThreadRef
+#include "rtc_base/platform_thread_types.h"
#include "rtc_base/refcount.h"
#include "rtc_base/refcountedobject.h"
-#include "rtc_base/scoped_ref_ptr.h" // for scoped_refptr
+#include "rtc_base/scoped_ref_ptr.h"
#include "rtc_base/system/unused.h"
#include "rtc_base/task_queue_posix.h"
-#include "rtc_base/thread_annotations.h" // for RTC_GUARDED_BY
+#include "rtc_base/thread_annotations.h"
#include "rtc_base/timeutils.h"
namespace rtc {
diff --git a/rtc_base/thread.cc b/rtc_base/thread.cc
index b6c6a47..4dd5fd2 100644
--- a/rtc_base/thread.cc
+++ b/rtc_base/thread.cc
@@ -24,9 +24,11 @@
#pragma warning(disable : 4722)
#endif
-#include <utility> // for move
+#include <stdio.h>
+#include <utility>
#include "rtc_base/checks.h"
+#include "rtc_base/criticalsection.h"
#include "rtc_base/logging.h"
#include "rtc_base/nullsocketserver.h"
#include "rtc_base/timeutils.h"
@@ -34,6 +36,7 @@
#if defined(WEBRTC_MAC)
#include "rtc_base/system/cocoa_threading.h"
+
/*
* These are forward-declarations for methods that are part of the
* ObjC runtime. They are declared in the private header objc-internal.h.
diff --git a/rtc_base/thread.h b/rtc_base/thread.h
index fde5e8b..039192c 100644
--- a/rtc_base/thread.h
+++ b/rtc_base/thread.h
@@ -11,16 +11,22 @@
#ifndef RTC_BASE_THREAD_H_
#define RTC_BASE_THREAD_H_
+#include <stdint.h>
#include <list>
#include <memory>
#include <string>
+#include <type_traits>
#if defined(WEBRTC_POSIX)
#include <pthread.h>
#endif
#include "rtc_base/constructormagic.h"
+#include "rtc_base/location.h"
+#include "rtc_base/messagehandler.h"
#include "rtc_base/messagequeue.h"
#include "rtc_base/platform_thread_types.h"
+#include "rtc_base/socketserver.h"
+#include "rtc_base/thread_annotations.h"
#if defined(WEBRTC_WIN)
#include "rtc_base/win32.h"
diff --git a/rtc_base/timestampaligner.cc b/rtc_base/timestampaligner.cc
index a9bcafb..f2da101 100644
--- a/rtc_base/timestampaligner.cc
+++ b/rtc_base/timestampaligner.cc
@@ -8,6 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include <cstdlib>
#include <limits>
#include "rtc_base/checks.h"
diff --git a/rtc_base/timeutils.cc b/rtc_base/timeutils.cc
index de8fc32..dc5b611 100644
--- a/rtc_base/timeutils.cc
+++ b/rtc_base/timeutils.cc
@@ -14,6 +14,7 @@
#include <sys/time.h>
#if defined(WEBRTC_MAC)
#include <mach/mach_time.h>
+#include "rtc_base/numerics/safe_conversions.h"
#endif
#endif
@@ -28,7 +29,6 @@
#endif
#include "rtc_base/checks.h"
-#include "rtc_base/numerics/safe_conversions.h"
#include "rtc_base/timeutils.h"
namespace rtc {
@@ -154,7 +154,7 @@
return ts + (num_wrap_ << 32);
}
-int64_t TmToSeconds(const std::tm& tm) {
+int64_t TmToSeconds(const tm& tm) {
static short int mdays[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
static short int cumul_mdays[12] = {0, 31, 59, 90, 120, 151,
181, 212, 243, 273, 304, 334};
diff --git a/rtc_base/timeutils.h b/rtc_base/timeutils.h
index 3a412a4..4e38a03 100644
--- a/rtc_base/timeutils.h
+++ b/rtc_base/timeutils.h
@@ -13,8 +13,6 @@
#include <stdint.h>
#include <time.h>
-
-#include <ctime>
#include <string>
#include "rtc_base/checks.h"
@@ -110,10 +108,10 @@
int64_t num_wrap_;
};
-// Convert from std::tm, which is relative to 1900-01-01 00:00 to number of
-// seconds from 1970-01-01 00:00 ("epoch"). Don't return time_t since that
+// Convert from tm, which is relative to 1900-01-01 00:00 to number of
+// seconds from 1970-01-01 00:00 ("epoch"). Don't return time_t since that
// is still 32 bits on many systems.
-int64_t TmToSeconds(const std::tm& tm);
+int64_t TmToSeconds(const tm& tm);
// Return the number of microseconds since January 1, 1970, UTC.
// Useful mainly when producing logs to be correlated with other
diff --git a/rtc_base/unixfilesystem.cc b/rtc_base/unixfilesystem.cc
index 818cb8a..2a941e2 100644
--- a/rtc_base/unixfilesystem.cc
+++ b/rtc_base/unixfilesystem.cc
@@ -10,16 +10,15 @@
#include "rtc_base/unixfilesystem.h"
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <string>
#if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
#include <CoreServices/CoreServices.h>
#include <IOKit/IOCFBundle.h>
#include <sys/statvfs.h>
+
#include "rtc_base/macutils.h"
#endif // WEBRTC_MAC && !defined(WEBRTC_IOS)
@@ -30,27 +29,16 @@
#elif !defined(__native_client__)
#include <sys/statvfs.h>
#endif // !defined(__native_client__)
-#include <limits.h>
-#include <pwd.h>
#include <stdio.h>
#endif // WEBRTC_POSIX && !WEBRTC_MAC || WEBRTC_IOS
-#if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID)
-#include <ctype.h>
-#include <algorithm>
-#endif
-
#if defined(__native_client__) && !defined(__GLIBC__)
#include <sys/syslimits.h>
#endif
-#include "rtc_base/arraysize.h"
#include "rtc_base/checks.h"
-#include "rtc_base/fileutils.h"
#include "rtc_base/logging.h"
#include "rtc_base/pathutils.h"
-#include "rtc_base/stream.h"
-#include "rtc_base/stringutils.h"
namespace rtc {
diff --git a/rtc_base/unixfilesystem.h b/rtc_base/unixfilesystem.h
index 711d7b3..d95132c 100644
--- a/rtc_base/unixfilesystem.h
+++ b/rtc_base/unixfilesystem.h
@@ -11,9 +11,10 @@
#ifndef RTC_BASE_UNIXFILESYSTEM_H_
#define RTC_BASE_UNIXFILESYSTEM_H_
-#include <sys/types.h>
+#include <stddef.h>
#include "rtc_base/fileutils.h"
+#include "rtc_base/pathutils.h"
namespace rtc {
diff --git a/rtc_base/zero_memory.h b/rtc_base/zero_memory.h
index cb4646c..f697bcb 100644
--- a/rtc_base/zero_memory.h
+++ b/rtc_base/zero_memory.h
@@ -11,6 +11,7 @@
#ifndef RTC_BASE_ZERO_MEMORY_H_
#define RTC_BASE_ZERO_MEMORY_H_
+#include <stddef.h>
#include <type_traits>
#include "api/array_view.h"