Delete rtc_base/format_macros.h It defined RTC_PRIuS, which was needed for compatibility with MSVC prior to version 2015. Bug: webrtc:6424 Change-Id: I5668d473376201cad3e8da65927c967fc397804b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/261314 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> Cr-Commit-Position: refs/heads/main@{#36814}
diff --git a/api/call/audio_sink.h b/api/call/audio_sink.h index fa4c3f6..76feb13 100644 --- a/api/call/audio_sink.h +++ b/api/call/audio_sink.h
@@ -11,13 +11,7 @@ #ifndef API_CALL_AUDIO_SINK_H_ #define API_CALL_AUDIO_SINK_H_ -#if defined(WEBRTC_POSIX) && !defined(__STDC_FORMAT_MACROS) -// Avoid conflict with format_macros.h. -#define __STDC_FORMAT_MACROS -#endif - -#include <inttypes.h> -#include <stddef.h> +#include <stdint.h> namespace webrtc {
diff --git a/audio/channel_receive.cc b/audio/channel_receive.cc index f2fd34a..93f534e 100644 --- a/audio/channel_receive.cc +++ b/audio/channel_receive.cc
@@ -40,7 +40,6 @@ #include "modules/rtp_rtcp/source/rtp_rtcp_config.h" #include "modules/rtp_rtcp/source/rtp_rtcp_impl2.h" #include "rtc_base/checks.h" -#include "rtc_base/format_macros.h" #include "rtc_base/location.h" #include "rtc_base/logging.h" #include "rtc_base/numerics/safe_minmax.h"
diff --git a/audio/channel_send.cc b/audio/channel_send.cc index 6deb4f1..05341b9 100644 --- a/audio/channel_send.cc +++ b/audio/channel_send.cc
@@ -33,7 +33,6 @@ #include "modules/rtp_rtcp/source/rtp_rtcp_impl2.h" #include "rtc_base/checks.h" #include "rtc_base/event.h" -#include "rtc_base/format_macros.h" #include "rtc_base/location.h" #include "rtc_base/logging.h" #include "rtc_base/numerics/safe_conversions.h"
diff --git a/audio/remix_resample_unittest.cc b/audio/remix_resample_unittest.cc index a80476e..30079bf 100644 --- a/audio/remix_resample_unittest.cc +++ b/audio/remix_resample_unittest.cc
@@ -15,7 +15,6 @@ #include "common_audio/resampler/include/push_resampler.h" #include "rtc_base/arraysize.h" #include "rtc_base/checks.h" -#include "rtc_base/format_macros.h" #include "test/gtest.h" namespace webrtc { @@ -140,7 +139,7 @@ best_delay = delay; } } - printf("SNR=%.1f dB at delay=%" RTC_PRIuS "\n", best_snr, best_delay); + printf("SNR=%.1f dB at delay=%zu\n", best_snr, best_delay); return best_snr; }
diff --git a/common_audio/audio_converter_unittest.cc b/common_audio/audio_converter_unittest.cc index 018e7b8..97937c8 100644 --- a/common_audio/audio_converter_unittest.cc +++ b/common_audio/audio_converter_unittest.cc
@@ -18,7 +18,6 @@ #include "common_audio/channel_buffer.h" #include "common_audio/resampler/push_sinc_resampler.h" #include "rtc_base/arraysize.h" -#include "rtc_base/format_macros.h" #include "test/gtest.h" namespace webrtc { @@ -79,7 +78,7 @@ best_delay = delay; } } - printf("SNR=%.1f dB at delay=%" RTC_PRIuS "\n", best_snr, best_delay); + printf("SNR=%.1f dB at delay=%zu\n", best_snr, best_delay); return best_snr; } @@ -131,8 +130,8 @@ PushSincResampler::AlgorithmicDelaySeconds(src_sample_rate_hz) * dst_sample_rate_hz); // SNR reported on the same line later. - printf("(%" RTC_PRIuS ", %d Hz) -> (%" RTC_PRIuS ", %d Hz) ", src_channels, - src_sample_rate_hz, dst_channels, dst_sample_rate_hz); + printf("(%zu, %d Hz) -> (%zu, %d Hz) ", src_channels, src_sample_rate_hz, + dst_channels, dst_sample_rate_hz); std::unique_ptr<AudioConverter> converter = AudioConverter::Create( src_channels, src_frames, dst_channels, dst_frames);
diff --git a/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc b/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc index 9129df8f..57ebb54 100644 --- a/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc +++ b/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc
@@ -22,7 +22,6 @@ /* include API */ #include "modules/audio_coding/codecs/isac/main/include/isac.h" #include "modules/audio_coding/codecs/isac/main/util/utility.h" -#include "rtc_base/format_macros.h" /* Defines */ #define SEED_FILE \ @@ -887,7 +886,7 @@ #endif } printf("\n"); - printf("total bits = %" RTC_PRIuS " bits\n", totalbits); + printf("total bits = %zu bits\n", totalbits); printf("measured average bitrate = %0.3f kbits/s\n", (double)totalbits * (sampFreqKHz) / totalsmpls); if (doTransCoding) { @@ -906,14 +905,16 @@ (100 * runtime / length_file)); if (maxStreamLen30 != 0) { - printf("Maximum payload size 30ms Frames %" RTC_PRIuS - " bytes (%0.3f kbps)\n", - maxStreamLen30, maxStreamLen30 * 8 / 30.); + printf( + "Maximum payload size 30ms Frames %zu" + " bytes (%0.3f kbps)\n", + maxStreamLen30, maxStreamLen30 * 8 / 30.); } if (maxStreamLen60 != 0) { - printf("Maximum payload size 60ms Frames %" RTC_PRIuS - " bytes (%0.3f kbps)\n", - maxStreamLen60, maxStreamLen60 * 8 / 60.); + printf( + "Maximum payload size 60ms Frames %zu" + " bytes (%0.3f kbps)\n", + maxStreamLen60, maxStreamLen60 * 8 / 60.); } // fprintf(stderr, "\n"); @@ -921,12 +922,12 @@ fprintf(stderr, " %0.1f kbps", (double)totalbits * (sampFreqKHz) / totalsmpls); if (maxStreamLen30 != 0) { - fprintf(stderr, " plmax-30ms %" RTC_PRIuS " bytes (%0.0f kbps)", - maxStreamLen30, maxStreamLen30 * 8 / 30.); + fprintf(stderr, " plmax-30ms %zu bytes (%0.0f kbps)", maxStreamLen30, + maxStreamLen30 * 8 / 30.); } if (maxStreamLen60 != 0) { - fprintf(stderr, " plmax-60ms %" RTC_PRIuS " bytes (%0.0f kbps)", - maxStreamLen60, maxStreamLen60 * 8 / 60.); + fprintf(stderr, " plmax-60ms %zu bytes (%0.0f kbps)", maxStreamLen60, + maxStreamLen60 * 8 / 60.); } if (doTransCoding) { fprintf(stderr, " transcoding rate %.0f kbps",
diff --git a/modules/audio_coding/codecs/isac/main/test/simpleKenny.c b/modules/audio_coding/codecs/isac/main/test/simpleKenny.c index 116b051..96b9b23 100644 --- a/modules/audio_coding/codecs/isac/main/test/simpleKenny.c +++ b/modules/audio_coding/codecs/isac/main/test/simpleKenny.c
@@ -28,7 +28,6 @@ /* include API */ #include "modules/audio_coding/codecs/isac/main/include/isac.h" #include "modules/audio_coding/codecs/isac/main/util/utility.h" -#include "rtc_base/format_macros.h" /* max number of samples per frame (= 60 ms frame) */ #define MAX_FRAMESAMPLES_SWB 1920 @@ -420,7 +419,7 @@ printf("\n"); printf("Measured bit-rate........... %0.3f kbps\n", rate); printf("Measured RCU bit-ratre...... %0.3f kbps\n", rateRCU); - printf("Maximum bit-rate/payloadsize %0.3f / %" RTC_PRIuS "\n", + printf("Maximum bit-rate/payloadsize %0.3f / %zu\n", maxStreamLen * 8 / 0.03, maxStreamLen); printf("Measured packet-loss........ %0.1f%% \n", 100.0f * (float)lostPacketCntr / (float)packetCntr);
diff --git a/modules/audio_coding/codecs/opus/opus_complexity_unittest.cc b/modules/audio_coding/codecs/opus/opus_complexity_unittest.cc index dbb808c..6388f33 100644 --- a/modules/audio_coding/codecs/opus/opus_complexity_unittest.cc +++ b/modules/audio_coding/codecs/opus/opus_complexity_unittest.cc
@@ -10,7 +10,6 @@ #include "api/audio_codecs/opus/audio_encoder_opus.h" #include "modules/audio_coding/neteq/tools/audio_loop.h" -#include "rtc_base/format_macros.h" #include "rtc_base/time_utils.h" #include "test/gtest.h" #include "test/testsupport/file_utils.h"
diff --git a/modules/audio_coding/codecs/opus/opus_fec_test.cc b/modules/audio_coding/codecs/opus/opus_fec_test.cc index 0636935..815f26e 100644 --- a/modules/audio_coding/codecs/opus/opus_fec_test.cc +++ b/modules/audio_coding/codecs/opus/opus_fec_test.cc
@@ -11,7 +11,6 @@ #include <memory> #include "modules/audio_coding/codecs/opus/opus_interface.h" -#include "rtc_base/format_macros.h" #include "test/gtest.h" #include "test/testsupport/file_utils.h" @@ -70,8 +69,7 @@ void OpusFecTest::SetUp() { channels_ = get<0>(GetParam()); bit_rate_ = get<1>(GetParam()); - printf("Coding %" RTC_PRIuS " channel signal at %d bps.\n", channels_, - bit_rate_); + printf("Coding %zu channel signal at %d bps.\n", channels_, bit_rate_); in_filename_ = test::ResourcePath(get<2>(GetParam()), get<3>(GetParam()));
diff --git a/modules/audio_coding/codecs/tools/audio_codec_speed_test.cc b/modules/audio_coding/codecs/tools/audio_codec_speed_test.cc index f61aacc..537e6fc 100644 --- a/modules/audio_coding/codecs/tools/audio_codec_speed_test.cc +++ b/modules/audio_coding/codecs/tools/audio_codec_speed_test.cc
@@ -11,7 +11,6 @@ #include "modules/audio_coding/codecs/tools/audio_codec_speed_test.h" #include "rtc_base/checks.h" -#include "rtc_base/format_macros.h" #include "test/gtest.h" #include "test/testsupport/file_utils.h" @@ -100,7 +99,7 @@ size_t time_now_ms = 0; float time_ms; - printf("Coding %d kHz-sampled %" RTC_PRIuS "-channel audio at %d bps ...\n", + printf("Coding %d kHz-sampled %zu-channel audio at %d bps ...\n", input_sampling_khz_, channels_, bit_rate_); while (time_now_ms < audio_duration_sec * 1000) {
diff --git a/modules/audio_coding/test/Channel.cc b/modules/audio_coding/test/Channel.cc index ec0eccb..b85f9f4 100644 --- a/modules/audio_coding/test/Channel.cc +++ b/modules/audio_coding/test/Channel.cc
@@ -10,10 +10,8 @@ #include "modules/audio_coding/test/Channel.h" - #include <iostream> -#include "rtc_base/format_macros.h" #include "rtc_base/time_utils.h" namespace webrtc {
diff --git a/modules/audio_device/android/audio_device_unittest.cc b/modules/audio_device/android/audio_device_unittest.cc index 79cd69f..4e607bc 100644 --- a/modules/audio_device/android/audio_device_unittest.cc +++ b/modules/audio_device/android/audio_device_unittest.cc
@@ -29,7 +29,6 @@ #include "modules/audio_device/include/mock_audio_transport.h" #include "rtc_base/arraysize.h" #include "rtc_base/event.h" -#include "rtc_base/format_macros.h" #include "rtc_base/synchronization/mutex.h" #include "rtc_base/time_utils.h" #include "test/gmock.h" @@ -187,7 +186,7 @@ const size_t size = fifo_->size(); if (size > largest_size_) { largest_size_ = size; - PRINTD("(%" RTC_PRIuS ")", largest_size_); + PRINTD("(%zu)", largest_size_); } total_written_elements_ += size; } @@ -532,13 +531,12 @@ #ifdef ENABLE_PRINTF PRINT("file name: %s\n", file_name.c_str()); const size_t bytes = test::GetFileSize(file_name); - PRINT("file size: %" RTC_PRIuS " [bytes]\n", bytes); - PRINT("file size: %" RTC_PRIuS " [samples]\n", bytes / kBytesPerSample); + PRINT("file size: %zu [bytes]\n", bytes); + PRINT("file size: %zu [samples]\n", bytes / kBytesPerSample); const int seconds = static_cast<int>(bytes / (sample_rate * kBytesPerSample)); PRINT("file size: %d [secs]\n", seconds); - PRINT("file size: %" RTC_PRIuS " [callbacks]\n", - seconds * kNumCallbacksPerSecond); + PRINT("file size: %zu [callbacks]\n", seconds * kNumCallbacksPerSecond); #endif return file_name; }
diff --git a/modules/audio_device/android/audio_manager_unittest.cc b/modules/audio_device/android/audio_manager_unittest.cc index 1b81904..093eddd 100644 --- a/modules/audio_device/android/audio_manager_unittest.cc +++ b/modules/audio_device/android/audio_manager_unittest.cc
@@ -15,7 +15,6 @@ #include "modules/audio_device/android/build_info.h" #include "modules/audio_device/android/ensure_initialized.h" #include "rtc_base/arraysize.h" -#include "rtc_base/format_macros.h" #include "test/gtest.h" #define PRINT(...) fprintf(stderr, __VA_ARGS__); @@ -153,16 +152,16 @@ PRINT("%saudio layer: %s\n", kTag, low_latency_out ? "Low latency OpenSL" : "Java/JNI based AudioTrack"); PRINT("%ssample rate: %d Hz\n", kTag, playout_parameters_.sample_rate()); - PRINT("%schannels: %" RTC_PRIuS "\n", kTag, playout_parameters_.channels()); - PRINT("%sframes per buffer: %" RTC_PRIuS " <=> %.2f ms\n", kTag, + PRINT("%schannels: %zu\n", kTag, playout_parameters_.channels()); + PRINT("%sframes per buffer: %zu <=> %.2f ms\n", kTag, playout_parameters_.frames_per_buffer(), playout_parameters_.GetBufferSizeInMilliseconds()); PRINT("RECORD: \n"); PRINT("%saudio layer: %s\n", kTag, low_latency_in ? "Low latency OpenSL" : "Java/JNI based AudioRecord"); PRINT("%ssample rate: %d Hz\n", kTag, record_parameters_.sample_rate()); - PRINT("%schannels: %" RTC_PRIuS "\n", kTag, record_parameters_.channels()); - PRINT("%sframes per buffer: %" RTC_PRIuS " <=> %.2f ms\n", kTag, + PRINT("%schannels: %zu\n", kTag, record_parameters_.channels()); + PRINT("%sframes per buffer: %zu <=> %.2f ms\n", kTag, record_parameters_.frames_per_buffer(), record_parameters_.GetBufferSizeInMilliseconds()); }
diff --git a/modules/audio_device/android/audio_record_jni.cc b/modules/audio_device/android/audio_record_jni.cc index 9d7bf73..919eabb 100644 --- a/modules/audio_device/android/audio_record_jni.cc +++ b/modules/audio_device/android/audio_record_jni.cc
@@ -16,7 +16,6 @@ #include "modules/audio_device/android/audio_common.h" #include "rtc_base/arraysize.h" #include "rtc_base/checks.h" -#include "rtc_base/format_macros.h" #include "rtc_base/logging.h" #include "rtc_base/platform_thread.h" #include "rtc_base/time_utils.h"
diff --git a/modules/audio_device/android/audio_track_jni.cc b/modules/audio_device/android/audio_track_jni.cc index 178ccad..5afa1ec 100644 --- a/modules/audio_device/android/audio_track_jni.cc +++ b/modules/audio_device/android/audio_track_jni.cc
@@ -15,7 +15,6 @@ #include "modules/audio_device/android/audio_manager.h" #include "rtc_base/arraysize.h" #include "rtc_base/checks.h" -#include "rtc_base/format_macros.h" #include "rtc_base/logging.h" #include "rtc_base/platform_thread.h" #include "system_wrappers/include/field_trial.h"
diff --git a/modules/audio_device/android/opensles_player.cc b/modules/audio_device/android/opensles_player.cc index b5851f7..f2b3a37 100644 --- a/modules/audio_device/android/opensles_player.cc +++ b/modules/audio_device/android/opensles_player.cc
@@ -20,7 +20,6 @@ #include "modules/audio_device/fine_audio_buffer.h" #include "rtc_base/arraysize.h" #include "rtc_base/checks.h" -#include "rtc_base/format_macros.h" #include "rtc_base/platform_thread.h" #include "rtc_base/time_utils.h" @@ -193,7 +192,7 @@ ALOGD("SetPlayoutSampleRate(%d)", sample_rate_hz); audio_device_buffer_->SetPlayoutSampleRate(sample_rate_hz); const size_t channels = audio_parameters_.channels(); - ALOGD("SetPlayoutChannels(%" RTC_PRIuS ")", channels); + ALOGD("SetPlayoutChannels(%zu)", channels); audio_device_buffer_->SetPlayoutChannels(channels); RTC_CHECK(audio_device_buffer_); AllocateDataBuffers(); @@ -214,7 +213,7 @@ // which reduces jitter. const size_t buffer_size_in_samples = audio_parameters_.frames_per_buffer() * audio_parameters_.channels(); - ALOGD("native buffer size: %" RTC_PRIuS, buffer_size_in_samples); + ALOGD("native buffer size: %zu", buffer_size_in_samples); ALOGD("native buffer size in ms: %.2f", audio_parameters_.GetBufferSizeInMilliseconds()); fine_audio_buffer_ = std::make_unique<FineAudioBuffer>(audio_device_buffer_);
diff --git a/modules/audio_device/android/opensles_recorder.cc b/modules/audio_device/android/opensles_recorder.cc index 8becd20..4e0c26d 100644 --- a/modules/audio_device/android/opensles_recorder.cc +++ b/modules/audio_device/android/opensles_recorder.cc
@@ -20,7 +20,6 @@ #include "modules/audio_device/fine_audio_buffer.h" #include "rtc_base/arraysize.h" #include "rtc_base/checks.h" -#include "rtc_base/format_macros.h" #include "rtc_base/platform_thread.h" #include "rtc_base/time_utils.h" @@ -178,7 +177,7 @@ // Ensure that the audio device buffer is informed about the number of // channels preferred by the OS on the recording side. const size_t channels = audio_parameters_.channels(); - ALOGD("SetRecordingChannels(%" RTC_PRIuS ")", channels); + ALOGD("SetRecordingChannels(%zu)", channels); audio_device_buffer_->SetRecordingChannels(channels); // Allocated memory for internal data buffers given existing audio parameters. AllocateDataBuffers(); @@ -334,12 +333,10 @@ // Create a modified audio buffer class which allows us to deliver any number // of samples (and not only multiple of 10ms) to match the native audio unit // buffer size. - ALOGD("frames per native buffer: %" RTC_PRIuS, - audio_parameters_.frames_per_buffer()); - ALOGD("frames per 10ms buffer: %" RTC_PRIuS, + ALOGD("frames per native buffer: %zu", audio_parameters_.frames_per_buffer()); + ALOGD("frames per 10ms buffer: %zu", audio_parameters_.frames_per_10ms_buffer()); - ALOGD("bytes per native buffer: %" RTC_PRIuS, - audio_parameters_.GetBytesPerBuffer()); + ALOGD("bytes per native buffer: %zu", audio_parameters_.GetBytesPerBuffer()); ALOGD("native sample rate: %d", audio_parameters_.sample_rate()); RTC_DCHECK(audio_device_buffer_); fine_audio_buffer_ = std::make_unique<FineAudioBuffer>(audio_device_buffer_);
diff --git a/modules/remote_bitrate_estimator/test/bwe_test_logging.cc b/modules/remote_bitrate_estimator/test/bwe_test_logging.cc index f99576f..c8f6faa 100644 --- a/modules/remote_bitrate_estimator/test/bwe_test_logging.cc +++ b/modules/remote_bitrate_estimator/test/bwe_test_logging.cc
@@ -12,13 +12,13 @@ #if BWE_TEST_LOGGING_COMPILE_TIME_ENABLE +#include <inttypes.h> #include <stdarg.h> #include <stdio.h> #include <algorithm> #include "rtc_base/checks.h" -#include "rtc_base/format_macros.h" #include "rtc_base/platform_thread.h" #include "rtc_base/strings/string_builder.h"
diff --git a/modules/remote_bitrate_estimator/tools/rtp_to_text.cc b/modules/remote_bitrate_estimator/tools/rtp_to_text.cc index 98f502a..e8dc59f 100644 --- a/modules/remote_bitrate_estimator/tools/rtp_to_text.cc +++ b/modules/remote_bitrate_estimator/tools/rtp_to_text.cc
@@ -16,7 +16,6 @@ #include "modules/rtp_rtcp/include/rtp_header_extension_map.h" #include "modules/rtp_rtcp/source/rtp_header_extensions.h" #include "modules/rtp_rtcp/source/rtp_packet.h" -#include "rtc_base/format_macros.h" #include "rtc_base/strings/string_builder.h" #include "test/rtp_file_reader.h" @@ -52,10 +51,10 @@ ss << static_cast<int64_t>(packet.time_ms) * 1000000; fprintf(stdout, "%s\n", ss.str().c_str()); } else { - fprintf(stdout, "%u %u %d %u %u %d %u %" RTC_PRIuS " %" RTC_PRIuS "\n", - header.SequenceNumber(), header.Timestamp(), toffset, - abs_send_time, packet.time_ms, header.Marker(), header.Ssrc(), - packet.length, packet.original_length); + fprintf(stdout, "%u %u %d %u %u %d %u %zu %zu\n", header.SequenceNumber(), + header.Timestamp(), toffset, abs_send_time, packet.time_ms, + header.Marker(), header.Ssrc(), packet.length, + packet.original_length); } ++packet_counter; }
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn index 7765c61..b4cf481 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn
@@ -127,7 +127,6 @@ rtc_source_set("macromagic") { sources = [ "arraysize.h", - "format_macros.h", "thread_annotations.h", ] deps = [ "system:arch" ]
diff --git a/rtc_base/format_macros.h b/rtc_base/format_macros.h deleted file mode 100644 index 83240fb..0000000 --- a/rtc_base/format_macros.h +++ /dev/null
@@ -1,59 +0,0 @@ -/* - * Copyright (c) 2014 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. - */ - -#ifndef RTC_BASE_FORMAT_MACROS_H_ -#define RTC_BASE_FORMAT_MACROS_H_ - -// This file defines the format macros for some integer types and is derived -// from Chromium's base/format_macros.h. - -// To print a 64-bit value in a portable way: -// int64_t value; -// printf("xyz:%" PRId64, value); -// The "d" in the macro corresponds to %d; you can also use PRIu64 etc. -// -// To print a size_t value in a portable way: -// size_t size; -// printf("xyz: %" RTC_PRIuS, size); -// The "u" in the macro corresponds to %u, and S is for "size". - -#if defined(WEBRTC_POSIX) - -#if (defined(_INTTYPES_H) || defined(_INTTYPES_H_)) && !defined(PRId64) -#error "inttypes.h has already been included before this header file, but " -#error "without __STDC_FORMAT_MACROS defined." -#endif - -#if !defined(__STDC_FORMAT_MACROS) -#define __STDC_FORMAT_MACROS -#endif - -#include <inttypes.h> - -#include "rtc_base/system/arch.h" - -#define RTC_PRIuS "zu" - -#else // WEBRTC_WIN - -#include <inttypes.h> - -#if !defined(PRId64) || !defined(PRIu64) || !defined(PRIx64) -#error "inttypes.h provided by win toolchain should define these." -#endif - -// PRI*64 were added in MSVC 2013, while "%zu" is supported since MSVC 2015 -// (so needs to be special-cased to "%Iu" instead). - -#define RTC_PRIuS "Iu" - -#endif - -#endif // RTC_BASE_FORMAT_MACROS_H_
diff --git a/rtc_tools/rtc_event_log_visualizer/alerts.cc b/rtc_tools/rtc_event_log_visualizer/alerts.cc index c0d8784..9ef5e9a 100644 --- a/rtc_tools/rtc_event_log_visualizer/alerts.cc +++ b/rtc_tools/rtc_event_log_visualizer/alerts.cc
@@ -19,7 +19,6 @@ #include "logging/rtc_event_log/rtc_event_processor.h" #include "rtc_base/checks.h" -#include "rtc_base/format_macros.h" #include "rtc_base/logging.h" #include "rtc_base/numerics/sequence_number_util.h" #include "rtc_base/strings/string_builder.h"
diff --git a/rtc_tools/rtc_event_log_visualizer/analyzer.cc b/rtc_tools/rtc_event_log_visualizer/analyzer.cc index 0185c7d..bdbb438 100644 --- a/rtc_tools/rtc_event_log_visualizer/analyzer.cc +++ b/rtc_tools/rtc_event_log_visualizer/analyzer.cc
@@ -48,7 +48,6 @@ #include "modules/rtp_rtcp/source/rtp_header_extensions.h" #include "modules/rtp_rtcp/source/rtp_rtcp_interface.h" #include "rtc_base/checks.h" -#include "rtc_base/format_macros.h" #include "rtc_base/logging.h" #include "rtc_base/numerics/sequence_number_util.h" #include "rtc_base/rate_statistics.h"
diff --git a/rtc_tools/unpack_aecdump/unpack.cc b/rtc_tools/unpack_aecdump/unpack.cc index 0850e75..49b62d2 100644 --- a/rtc_tools/unpack_aecdump/unpack.cc +++ b/rtc_tools/unpack_aecdump/unpack.cc
@@ -28,7 +28,6 @@ #include "common_audio/wav_file.h" #include "modules/audio_processing/test/protobuf_utils.h" #include "modules/audio_processing/test/test_utils.h" -#include "rtc_base/format_macros.h" #include "rtc_base/ignore_wundef.h" #include "rtc_base/strings/string_builder.h" @@ -480,14 +479,11 @@ fprintf(settings_file, " Reverse sample rate: %d\n", reverse_sample_rate); num_input_channels = msg.num_input_channels(); - fprintf(settings_file, " Input channels: %" RTC_PRIuS "\n", - num_input_channels); + fprintf(settings_file, " Input channels: %zu\n", num_input_channels); num_output_channels = msg.num_output_channels(); - fprintf(settings_file, " Output channels: %" RTC_PRIuS "\n", - num_output_channels); + fprintf(settings_file, " Output channels: %zu\n", num_output_channels); num_reverse_channels = msg.num_reverse_channels(); - fprintf(settings_file, " Reverse channels: %" RTC_PRIuS "\n", - num_reverse_channels); + fprintf(settings_file, " Reverse channels: %zu\n", num_reverse_channels); if (msg.has_timestamp_ms()) { const int64_t timestamp = msg.timestamp_ms(); fprintf(settings_file, " Timestamp in millisecond: %" PRId64 "\n",
diff --git a/sdk/android/native_unittests/audio_device/audio_device_unittest.cc b/sdk/android/native_unittests/audio_device/audio_device_unittest.cc index 717c074..7d582d4 100644 --- a/sdk/android/native_unittests/audio_device/audio_device_unittest.cc +++ b/sdk/android/native_unittests/audio_device/audio_device_unittest.cc
@@ -8,16 +8,16 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include "modules/audio_device/include/audio_device.h" + #include <list> #include <memory> #include <numeric> #include "api/scoped_refptr.h" -#include "modules/audio_device/include/audio_device.h" #include "modules/audio_device/include/mock_audio_transport.h" #include "rtc_base/arraysize.h" #include "rtc_base/event.h" -#include "rtc_base/format_macros.h" #include "rtc_base/synchronization/mutex.h" #include "rtc_base/time_utils.h" #include "sdk/android/generated_native_unittests_jni/BuildInfo_jni.h" @@ -184,7 +184,7 @@ const size_t size = fifo_->size(); if (size > largest_size_) { largest_size_ = size; - PRINTD("(%" RTC_PRIuS ")", largest_size_); + PRINTD("(%zu)", largest_size_); } total_written_elements_ += size; } @@ -547,13 +547,12 @@ #ifdef ENABLE_PRINTF PRINT("file name: %s\n", file_name.c_str()); const size_t bytes = test::GetFileSize(file_name); - PRINT("file size: %" RTC_PRIuS " [bytes]\n", bytes); - PRINT("file size: %" RTC_PRIuS " [samples]\n", bytes / kBytesPerSample); + PRINT("file size: %zu [bytes]\n", bytes); + PRINT("file size: %zu [samples]\n", bytes / kBytesPerSample); const int seconds = static_cast<int>(bytes / (sample_rate * kBytesPerSample)); PRINT("file size: %d [secs]\n", seconds); - PRINT("file size: %" RTC_PRIuS " [callbacks]\n", - seconds * kNumCallbacksPerSecond); + PRINT("file size: %zu [callbacks]\n", seconds * kNumCallbacksPerSecond); #endif return file_name; } @@ -972,16 +971,16 @@ PRINT("%saudio layer: %s\n", kTag, low_latency_out ? "Low latency OpenSL" : "Java/JNI based AudioTrack"); PRINT("%ssample rate: %d Hz\n", kTag, output_parameters_.sample_rate()); - PRINT("%schannels: %" RTC_PRIuS "\n", kTag, output_parameters_.channels()); - PRINT("%sframes per buffer: %" RTC_PRIuS " <=> %.2f ms\n", kTag, + PRINT("%schannels: %zu\n", kTag, output_parameters_.channels()); + PRINT("%sframes per buffer: %zu <=> %.2f ms\n", kTag, output_parameters_.frames_per_buffer(), output_parameters_.GetBufferSizeInMilliseconds()); PRINT("RECORD: \n"); PRINT("%saudio layer: %s\n", kTag, low_latency_in ? "Low latency OpenSL" : "Java/JNI based AudioRecord"); PRINT("%ssample rate: %d Hz\n", kTag, input_parameters_.sample_rate()); - PRINT("%schannels: %" RTC_PRIuS "\n", kTag, input_parameters_.channels()); - PRINT("%sframes per buffer: %" RTC_PRIuS " <=> %.2f ms\n", kTag, + PRINT("%schannels: %zu\n", kTag, input_parameters_.channels()); + PRINT("%sframes per buffer: %zu <=> %.2f ms\n", kTag, input_parameters_.frames_per_buffer(), input_parameters_.GetBufferSizeInMilliseconds()); }
diff --git a/sdk/android/src/jni/audio_device/audio_record_jni.cc b/sdk/android/src/jni/audio_device/audio_record_jni.cc index f5f1089..d206297 100644 --- a/sdk/android/src/jni/audio_device/audio_record_jni.cc +++ b/sdk/android/src/jni/audio_device/audio_record_jni.cc
@@ -15,7 +15,6 @@ #include "rtc_base/arraysize.h" #include "rtc_base/checks.h" -#include "rtc_base/format_macros.h" #include "rtc_base/logging.h" #include "rtc_base/platform_thread.h" #include "rtc_base/time_utils.h"
diff --git a/sdk/android/src/jni/audio_device/audio_track_jni.cc b/sdk/android/src/jni/audio_device/audio_track_jni.cc index f2f22f9..c1ff4c3 100644 --- a/sdk/android/src/jni/audio_device/audio_track_jni.cc +++ b/sdk/android/src/jni/audio_device/audio_track_jni.cc
@@ -14,7 +14,6 @@ #include "rtc_base/arraysize.h" #include "rtc_base/checks.h" -#include "rtc_base/format_macros.h" #include "rtc_base/logging.h" #include "rtc_base/platform_thread.h" #include "sdk/android/generated_java_audio_device_module_native_jni/WebRtcAudioTrack_jni.h"
diff --git a/sdk/android/src/jni/audio_device/opensles_player.cc b/sdk/android/src/jni/audio_device/opensles_player.cc index 5192acc..6300a3a 100644 --- a/sdk/android/src/jni/audio_device/opensles_player.cc +++ b/sdk/android/src/jni/audio_device/opensles_player.cc
@@ -13,11 +13,11 @@ #include <android/log.h> #include <memory> + #include "api/array_view.h" #include "modules/audio_device/fine_audio_buffer.h" #include "rtc_base/arraysize.h" #include "rtc_base/checks.h" -#include "rtc_base/format_macros.h" #include "rtc_base/platform_thread.h" #include "rtc_base/time_utils.h" #include "sdk/android/src/jni/audio_device/audio_common.h" @@ -202,7 +202,7 @@ ALOGD("SetPlayoutSampleRate(%d)", sample_rate_hz); audio_device_buffer_->SetPlayoutSampleRate(sample_rate_hz); const size_t channels = audio_parameters_.channels(); - ALOGD("SetPlayoutChannels(%" RTC_PRIuS ")", channels); + ALOGD("SetPlayoutChannels(%zu)", channels); audio_device_buffer_->SetPlayoutChannels(channels); RTC_CHECK(audio_device_buffer_); AllocateDataBuffers(); @@ -223,7 +223,7 @@ // which reduces jitter. const size_t buffer_size_in_samples = audio_parameters_.frames_per_buffer() * audio_parameters_.channels(); - ALOGD("native buffer size: %" RTC_PRIuS, buffer_size_in_samples); + ALOGD("native buffer size: %zu", buffer_size_in_samples); ALOGD("native buffer size in ms: %.2f", audio_parameters_.GetBufferSizeInMilliseconds()); fine_audio_buffer_ = std::make_unique<FineAudioBuffer>(audio_device_buffer_);
diff --git a/sdk/android/src/jni/audio_device/opensles_recorder.cc b/sdk/android/src/jni/audio_device/opensles_recorder.cc index d2eb2de..c426a8d9 100644 --- a/sdk/android/src/jni/audio_device/opensles_recorder.cc +++ b/sdk/android/src/jni/audio_device/opensles_recorder.cc
@@ -13,11 +13,11 @@ #include <android/log.h> #include <memory> + #include "api/array_view.h" #include "modules/audio_device/fine_audio_buffer.h" #include "rtc_base/arraysize.h" #include "rtc_base/checks.h" -#include "rtc_base/format_macros.h" #include "rtc_base/platform_thread.h" #include "rtc_base/time_utils.h" #include "sdk/android/src/jni/audio_device/audio_common.h" @@ -188,7 +188,7 @@ // Ensure that the audio device buffer is informed about the number of // channels preferred by the OS on the recording side. const size_t channels = audio_parameters_.channels(); - ALOGD("SetRecordingChannels(%" RTC_PRIuS ")", channels); + ALOGD("SetRecordingChannels(%zu)", channels); audio_device_buffer_->SetRecordingChannels(channels); // Allocated memory for internal data buffers given existing audio parameters. AllocateDataBuffers(); @@ -345,12 +345,10 @@ // Create a modified audio buffer class which allows us to deliver any number // of samples (and not only multiple of 10ms) to match the native audio unit // buffer size. - ALOGD("frames per native buffer: %" RTC_PRIuS, - audio_parameters_.frames_per_buffer()); - ALOGD("frames per 10ms buffer: %" RTC_PRIuS, + ALOGD("frames per native buffer: %zu", audio_parameters_.frames_per_buffer()); + ALOGD("frames per 10ms buffer: %zu", audio_parameters_.frames_per_10ms_buffer()); - ALOGD("bytes per native buffer: %" RTC_PRIuS, - audio_parameters_.GetBytesPerBuffer()); + ALOGD("bytes per native buffer: %zu", audio_parameters_.GetBytesPerBuffer()); ALOGD("native sample rate: %d", audio_parameters_.sample_rate()); RTC_DCHECK(audio_device_buffer_); fine_audio_buffer_ = std::make_unique<FineAudioBuffer>(audio_device_buffer_);
diff --git a/test/rtp_file_reader.cc b/test/rtp_file_reader.cc index 15a0513..7fc91be 100644 --- a/test/rtp_file_reader.cc +++ b/test/rtp_file_reader.cc
@@ -18,7 +18,6 @@ #include "modules/rtp_rtcp/source/rtp_util.h" #include "rtc_base/checks.h" -#include "rtc_base/format_macros.h" #include "rtc_base/logging.h" #include "rtc_base/system/arch.h" @@ -290,15 +289,15 @@ } printf("Total packets in file: %d\n", total_packet_count); - printf("Total RTP/RTCP packets: %" RTC_PRIuS "\n", packets_.size()); + printf("Total RTP/RTCP packets: %zu\n", packets_.size()); for (SsrcMapIterator mit = packets_by_ssrc_.begin(); mit != packets_by_ssrc_.end(); ++mit) { uint32_t ssrc = mit->first; const std::vector<uint32_t>& packet_indices = mit->second; int pt = packets_[packet_indices[0]].payload_type; - printf("SSRC: %08x, %" RTC_PRIuS " packets, pt=%d\n", ssrc, - packet_indices.size(), pt); + printf("SSRC: %08x, %zu packets, pt=%d\n", ssrc, packet_indices.size(), + pt); } // TODO(solenberg): Better validation of identified SSRC streams.
diff --git a/video/video_analyzer.cc b/video/video_analyzer.cc index 62ee7b4..c55bf96 100644 --- a/video/video_analyzer.cc +++ b/video/video_analyzer.cc
@@ -9,6 +9,8 @@ */ #include "video/video_analyzer.h" +#include <inttypes.h> + #include <algorithm> #include <utility> @@ -20,7 +22,6 @@ #include "modules/rtp_rtcp/source/rtp_packet.h" #include "modules/rtp_rtcp/source/rtp_util.h" #include "rtc_base/cpu_time.h" -#include "rtc_base/format_macros.h" #include "rtc_base/memory_usage.h" #include "rtc_base/task_queue_for_test.h" #include "rtc_base/task_utils/repeating_task.h" @@ -854,7 +855,7 @@ }); fprintf(out, "%s\n", graph_title_.c_str()); - fprintf(out, "%" RTC_PRIuS "\n", samples_.size()); + fprintf(out, "%zu\n", samples_.size()); fprintf(out, "dropped " "input_time_ms " @@ -867,8 +868,7 @@ "encode_time_ms\n"); for (const Sample& sample : samples_) { fprintf(out, - "%d %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" RTC_PRIuS - " %lf %lf\n", + "%d %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %zu %lf %lf\n", sample.dropped, sample.input_time_ms, sample.send_time_ms, sample.recv_time_ms, sample.render_time_ms, sample.encoded_frame_size, sample.psnr, sample.ssim);