From 8f69330310bf786cff373c225967e7459fb0b560 Mon Sep 17 00:00:00 2001 From: "andrew@webrtc.org" Date: Fri, 25 Apr 2014 23:10:28 +0000 Subject: [PATCH] Replace scoped_array with scoped_ptr. scoped_array is deprecated. This was done using a Chromium clang tool: http://src.chromium.org/viewvc/chrome/trunk/src/tools/clang/rewrite_scoped_ar... except for the few not-built-on-Linux files which were updated manually. TESTED=trybots BUG=2515 R=niklas.enbom@webrtc.org Review URL: https://webrtc-codereview.appspot.com/12429004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5985 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../resampler/sinc_resampler_unittest.cc | 10 +-- webrtc/common_video/libyuv/libyuv_unittest.cc | 20 ++--- webrtc/common_video/libyuv/scaler_unittest.cc | 4 +- .../fake_audio_device_buffer.cc | 2 +- .../fake_audio_device_buffer.h | 2 +- .../audio_coding/main/acm2/nack_unittest.cc | 2 +- .../audio_coding/neteq4/background_noise.h | 2 +- webrtc/modules/audio_coding/neteq4/expand.h | 2 +- .../modules/audio_coding/neteq4/neteq_impl.cc | 1 - .../modules/audio_coding/neteq4/neteq_impl.h | 4 +- .../audio_coding/neteq4/time_stretch.cc | 2 +- .../audio_coding/neteq4/tools/audio_loop.h | 5 +- .../audio_device/android/fine_audio_buffer.h | 2 +- .../android/fine_audio_buffer_unittest.cc | 2 +- .../audio_device/android/opensles_input.cc | 2 +- .../audio_device/android/opensles_input.h | 2 +- .../audio_device/android/opensles_output.cc | 2 +- .../audio_device/android/opensles_output.h | 2 +- .../audio_device/android/single_rw_fifo.h | 2 +- .../android/single_rw_fifo_unittest.cc | 2 +- .../audio_processing/test/process_test.cc | 4 +- .../utility/ring_buffer_unittest.cc | 4 +- webrtc/modules/desktop_capture/differ.h | 2 +- .../desktop_capture/differ_unittest.cc | 4 +- webrtc/modules/desktop_capture/win/cursor.cc | 2 +- .../desktop_capture/win/cursor_unittest.cc | 2 +- .../rate_statistics.h | 2 +- .../test/testFec/test_packet_masks_metrics.cc | 6 +- .../test/video_capture_unittest.cc | 8 +- .../codecs/test/videoprocessor.cc | 4 +- .../codecs/test_framework/unit_test.cc | 4 +- .../codecs/vp8/test/vp8_impl_unittest.cc | 2 +- .../codecs/vp8/vp8_sequence_coder.cc | 2 +- .../video_coding/main/test/rtp_player.cc | 2 +- .../unit_test/brightness_detection_test.cc | 2 +- .../test/unit_test/color_enhancement_test.cc | 6 +- .../test/unit_test/content_metrics_test.cc | 2 +- .../main/test/unit_test/deflickering_test.cc | 2 +- .../main/test/unit_test/denoising_test.cc | 2 +- .../unit_test/video_processing_unittest.cc | 8 +- webrtc/system_wrappers/interface/scoped_ptr.h | 78 ------------------- webrtc/test/fake_network_pipe_unittest.cc | 2 +- .../test/testsupport/metrics/video_metrics.cc | 4 +- .../tools/frame_editing/frame_editing_lib.cc | 2 +- .../frame_editing/frame_editing_unittest.cc | 8 +- .../helpers/vie_to_file_renderer.cc | 2 +- webrtc/video_engine/vie_capturer.cc | 2 +- webrtc/video_engine/vie_channel.cc | 2 +- webrtc/video_engine/vie_encoder.cc | 2 +- webrtc/voice_engine/channel.cc | 4 +- .../include/mock/fake_voe_external_media.h | 2 +- webrtc/voice_engine/transmit_mixer.cc | 2 +- 52 files changed, 86 insertions(+), 166 deletions(-) diff --git a/webrtc/common_audio/resampler/sinc_resampler_unittest.cc b/webrtc/common_audio/resampler/sinc_resampler_unittest.cc index c085cfc20e..97908625d2 100644 --- a/webrtc/common_audio/resampler/sinc_resampler_unittest.cc +++ b/webrtc/common_audio/resampler/sinc_resampler_unittest.cc @@ -62,7 +62,7 @@ TEST(SincResamplerTest, ChunkedResample) { static const int kChunks = 2; int max_chunk_size = resampler.ChunkSize() * kChunks; - scoped_array resampled_destination(new float[max_chunk_size]); + scoped_ptr resampled_destination(new float[max_chunk_size]); // Verify requesting ChunkSize() frames causes a single callback. EXPECT_CALL(mock_source, Run(_, _)) @@ -81,7 +81,7 @@ TEST(SincResamplerTest, Flush) { MockSource mock_source; SincResampler resampler(kSampleRateRatio, SincResampler::kDefaultRequestSize, &mock_source); - scoped_array resampled_destination(new float[resampler.ChunkSize()]); + scoped_ptr resampled_destination(new float[resampler.ChunkSize()]); // Fill the resampler with junk data. EXPECT_CALL(mock_source, Run(_, _)) @@ -266,7 +266,7 @@ TEST_P(SincResamplerTest, Resample) { // Force an update to the sample rate ratio to ensure dyanmic sample rate // changes are working correctly. - scoped_array kernel(new float[SincResampler::kKernelStorageSize]); + scoped_ptr kernel(new float[SincResampler::kKernelStorageSize]); memcpy(kernel.get(), resampler.get_kernel_for_testing(), SincResampler::kKernelStorageSize); resampler.SetRatio(M_PI); @@ -278,8 +278,8 @@ TEST_P(SincResamplerTest, Resample) { // TODO(dalecurtis): If we switch to AVX/SSE optimization, we'll need to // allocate these on 32-byte boundaries and ensure they're sized % 32 bytes. - scoped_array resampled_destination(new float[output_samples]); - scoped_array pure_destination(new float[output_samples]); + scoped_ptr resampled_destination(new float[output_samples]); + scoped_ptr pure_destination(new float[output_samples]); // Generate resampled signal. resampler.Resample(output_samples, resampled_destination.get()); diff --git a/webrtc/common_video/libyuv/libyuv_unittest.cc b/webrtc/common_video/libyuv/libyuv_unittest.cc index 3df520ed6c..0abe7f3cc0 100644 --- a/webrtc/common_video/libyuv/libyuv_unittest.cc +++ b/webrtc/common_video/libyuv/libyuv_unittest.cc @@ -84,7 +84,7 @@ class TestLibYuv : public ::testing::Test { FILE* source_file_; I420VideoFrame orig_frame_; - scoped_array orig_buffer_; + scoped_ptr orig_buffer_; const int width_; const int height_; const int size_y_; @@ -147,7 +147,7 @@ TEST_F(TestLibYuv, ConvertTest) { (width_ + 1) / 2, (width_ + 1) / 2)); printf("\nConvert #%d I420 <-> I420 \n", j); - scoped_array out_i420_buffer(new uint8_t[frame_length_]); + scoped_ptr out_i420_buffer(new uint8_t[frame_length_]); EXPECT_EQ(0, ConvertFromI420(orig_frame_, kI420, 0, out_i420_buffer.get())); EXPECT_EQ(0, ConvertToI420(kI420, out_i420_buffer.get(), 0, 0, @@ -162,7 +162,7 @@ TEST_F(TestLibYuv, ConvertTest) { j++; printf("\nConvert #%d I420 <-> RGB24\n", j); - scoped_array res_rgb_buffer2(new uint8_t[width_ * height_ * 3]); + scoped_ptr res_rgb_buffer2(new uint8_t[width_ * height_ * 3]); // Align the stride values for the output frame. int stride_y = 0; int stride_uv = 0; @@ -184,7 +184,7 @@ TEST_F(TestLibYuv, ConvertTest) { j++; printf("\nConvert #%d I420 <-> UYVY\n", j); - scoped_array out_uyvy_buffer(new uint8_t[width_ * height_ * 2]); + scoped_ptr out_uyvy_buffer(new uint8_t[width_ * height_ * 2]); EXPECT_EQ(0, ConvertFromI420(orig_frame_, kUYVY, 0, out_uyvy_buffer.get())); EXPECT_EQ(0, ConvertToI420(kUYVY, out_uyvy_buffer.get(), 0, 0, width_, height_, 0, kRotateNone, &res_i420_frame)); @@ -196,8 +196,8 @@ TEST_F(TestLibYuv, ConvertTest) { j++; printf("\nConvert #%d I420 <-> YV12\n", j); - scoped_array outYV120Buffer(new uint8_t[frame_length_]); - scoped_array res_i420_buffer(new uint8_t[frame_length_]); + scoped_ptr outYV120Buffer(new uint8_t[frame_length_]); + scoped_ptr res_i420_buffer(new uint8_t[frame_length_]); I420VideoFrame yv12_frame; EXPECT_EQ(0, ConvertFromI420(orig_frame_, kYV12, 0, outYV120Buffer.get())); yv12_frame.CreateFrame(size_y_, outYV120Buffer.get(), @@ -218,7 +218,7 @@ TEST_F(TestLibYuv, ConvertTest) { j++; printf("\nConvert #%d I420 <-> YUY2\n", j); - scoped_array out_yuy2_buffer(new uint8_t[width_ * height_ * 2]); + scoped_ptr out_yuy2_buffer(new uint8_t[width_ * height_ * 2]); EXPECT_EQ(0, ConvertFromI420(orig_frame_, kYUY2, 0, out_yuy2_buffer.get())); EXPECT_EQ(0, ConvertToI420(kYUY2, out_yuy2_buffer.get(), 0, 0, width_, @@ -231,7 +231,7 @@ TEST_F(TestLibYuv, ConvertTest) { psnr = I420PSNR(&orig_frame_, &res_i420_frame); EXPECT_EQ(48.0, psnr); printf("\nConvert #%d I420 <-> RGB565\n", j); - scoped_array out_rgb565_buffer(new uint8_t[width_ * height_ * 2]); + scoped_ptr out_rgb565_buffer(new uint8_t[width_ * height_ * 2]); EXPECT_EQ(0, ConvertFromI420(orig_frame_, kRGB565, 0, out_rgb565_buffer.get())); @@ -250,7 +250,7 @@ TEST_F(TestLibYuv, ConvertTest) { EXPECT_GT(ceil(psnr), 40); printf("\nConvert #%d I420 <-> ARGB8888\n", j); - scoped_array out_argb8888_buffer(new uint8_t[width_ * height_ * 4]); + scoped_ptr out_argb8888_buffer(new uint8_t[width_ * height_ * 4]); EXPECT_EQ(0, ConvertFromI420(orig_frame_, kARGB, 0, out_argb8888_buffer.get())); @@ -283,7 +283,7 @@ TEST_F(TestLibYuv, ConvertAlignedFrame) { Calc16ByteAlignedStride(width_, &stride_y, &stride_uv); EXPECT_EQ(0,res_i420_frame.CreateEmptyFrame(width_, height_, stride_y, stride_uv, stride_uv)); - scoped_array out_i420_buffer(new uint8_t[frame_length_]); + scoped_ptr out_i420_buffer(new uint8_t[frame_length_]); EXPECT_EQ(0, ConvertFromI420(orig_frame_, kI420, 0, out_i420_buffer.get())); EXPECT_EQ(0, ConvertToI420(kI420, out_i420_buffer.get(), 0, 0, diff --git a/webrtc/common_video/libyuv/scaler_unittest.cc b/webrtc/common_video/libyuv/scaler_unittest.cc index fee10df718..f186d82d89 100644 --- a/webrtc/common_video/libyuv/scaler_unittest.cc +++ b/webrtc/common_video/libyuv/scaler_unittest.cc @@ -99,7 +99,7 @@ TEST_F(TestScaler, ScaleSendingBufferTooSmall) { kI420, kI420, kScalePoint)); I420VideoFrame test_frame2; - scoped_array orig_buffer(new uint8_t[frame_length_]); + scoped_ptr orig_buffer(new uint8_t[frame_length_]); EXPECT_GT(fread(orig_buffer.get(), 1, frame_length_, source_file_), 0U); test_frame_.CreateFrame(size_y_, orig_buffer.get(), size_uv_, orig_buffer.get() + size_y_, @@ -442,7 +442,7 @@ void TestScaler::ScaleSequence(ScaleMethod method, total_clock = 0; int frame_count = 0; int src_required_size = CalcBufferSize(kI420, src_width, src_height); - scoped_array frame_buffer(new uint8_t[src_required_size]); + scoped_ptr frame_buffer(new uint8_t[src_required_size]); int size_y = src_width * src_height; int size_uv = ((src_width + 1) / 2) * ((src_height + 1) / 2); diff --git a/webrtc/examples/android/opensl_loopback/fake_audio_device_buffer.cc b/webrtc/examples/android/opensl_loopback/fake_audio_device_buffer.cc index 81adc8ff9a..23b60eebf3 100644 --- a/webrtc/examples/android/opensl_loopback/fake_audio_device_buffer.cc +++ b/webrtc/examples/android/opensl_loopback/fake_audio_device_buffer.cc @@ -22,7 +22,7 @@ FakeAudioDeviceBuffer::FakeAudioDeviceBuffer() next_available_buffer_(0), record_channels_(0), play_channels_(0) { - buf_.reset(new scoped_array[kNumBuffers]); + buf_.reset(new scoped_ptr[kNumBuffers]); for (int i = 0; i < kNumBuffers; ++i) { buf_[i].reset(new int8_t[buffer_size_bytes()]); } diff --git a/webrtc/examples/android/opensl_loopback/fake_audio_device_buffer.h b/webrtc/examples/android/opensl_loopback/fake_audio_device_buffer.h index b98ee1e814..1ef866cb34 100644 --- a/webrtc/examples/android/opensl_loopback/fake_audio_device_buffer.h +++ b/webrtc/examples/android/opensl_loopback/fake_audio_device_buffer.h @@ -55,7 +55,7 @@ class FakeAudioDeviceBuffer : public AudioDeviceBuffer { AudioManagerJni audio_manager_; SingleRwFifo fifo_; - scoped_array > buf_; + scoped_ptr[]> buf_; int next_available_buffer_; uint8_t record_channels_; diff --git a/webrtc/modules/audio_coding/main/acm2/nack_unittest.cc b/webrtc/modules/audio_coding/main/acm2/nack_unittest.cc index 8011d8856c..5837c31a89 100644 --- a/webrtc/modules/audio_coding/main/acm2/nack_unittest.cc +++ b/webrtc/modules/audio_coding/main/acm2/nack_unittest.cc @@ -398,7 +398,7 @@ TEST(NackTest, ChangeOfListSizeAppliedAndOldElementsRemoved) { // Packet lost more than NACK-list size limit. uint16_t num_lost_packets = kNackThreshold + kNackListSize + 5; - scoped_array seq_num_lost(new uint16_t[num_lost_packets]); + scoped_ptr seq_num_lost(new uint16_t[num_lost_packets]); for (int n = 0; n < num_lost_packets; ++n) { seq_num_lost[n] = ++seq_num; } diff --git a/webrtc/modules/audio_coding/neteq4/background_noise.h b/webrtc/modules/audio_coding/neteq4/background_noise.h index ac5446bf7f..141d71dc5e 100644 --- a/webrtc/modules/audio_coding/neteq4/background_noise.h +++ b/webrtc/modules/audio_coding/neteq4/background_noise.h @@ -126,7 +126,7 @@ class BackgroundNoise { int32_t residual_energy); size_t num_channels_; - scoped_array channel_parameters_; + scoped_ptr channel_parameters_; bool initialized_; NetEqBackgroundNoiseMode mode_; diff --git a/webrtc/modules/audio_coding/neteq4/expand.h b/webrtc/modules/audio_coding/neteq4/expand.h index aec1cd9b60..6962aa0493 100644 --- a/webrtc/modules/audio_coding/neteq4/expand.h +++ b/webrtc/modules/audio_coding/neteq4/expand.h @@ -167,7 +167,7 @@ class Expand { int lag_index_direction_; int current_lag_index_; bool stop_muting_; - scoped_array channel_parameters_; + scoped_ptr channel_parameters_; DISALLOW_COPY_AND_ASSIGN(Expand); }; diff --git a/webrtc/modules/audio_coding/neteq4/neteq_impl.cc b/webrtc/modules/audio_coding/neteq4/neteq_impl.cc index dcf48ad417..cf73f71d4c 100644 --- a/webrtc/modules/audio_coding/neteq4/neteq_impl.cc +++ b/webrtc/modules/audio_coding/neteq4/neteq_impl.cc @@ -77,7 +77,6 @@ NetEqImpl::NetEqImpl(int fs, accelerate_factory_(accelerate_factory), preemptive_expand_factory_(preemptive_expand_factory), last_mode_(kModeNormal), - mute_factor_array_(NULL), decoded_buffer_length_(kMaxFrameSize), decoded_buffer_(new int16_t[decoded_buffer_length_]), playout_timestamp_(0), diff --git a/webrtc/modules/audio_coding/neteq4/neteq_impl.h b/webrtc/modules/audio_coding/neteq4/neteq_impl.h index 09a0049fbb..6fef213090 100644 --- a/webrtc/modules/audio_coding/neteq4/neteq_impl.h +++ b/webrtc/modules/audio_coding/neteq4/neteq_impl.h @@ -371,9 +371,9 @@ class NetEqImpl : public webrtc::NetEq { int output_size_samples_ GUARDED_BY(crit_sect_); int decoder_frame_length_ GUARDED_BY(crit_sect_); Modes last_mode_ GUARDED_BY(crit_sect_); - scoped_array mute_factor_array_ GUARDED_BY(crit_sect_); + scoped_ptr mute_factor_array_ GUARDED_BY(crit_sect_); size_t decoded_buffer_length_ GUARDED_BY(crit_sect_); - scoped_array decoded_buffer_ GUARDED_BY(crit_sect_); + scoped_ptr decoded_buffer_ GUARDED_BY(crit_sect_); uint32_t playout_timestamp_ GUARDED_BY(crit_sect_); bool new_codec_ GUARDED_BY(crit_sect_); uint32_t timestamp_ GUARDED_BY(crit_sect_); diff --git a/webrtc/modules/audio_coding/neteq4/time_stretch.cc b/webrtc/modules/audio_coding/neteq4/time_stretch.cc index 5b6b3ba966..5b246c1134 100644 --- a/webrtc/modules/audio_coding/neteq4/time_stretch.cc +++ b/webrtc/modules/audio_coding/neteq4/time_stretch.cc @@ -29,7 +29,7 @@ TimeStretch::ReturnCodes TimeStretch::Process( int fs_mult_120 = fs_mult_ * 120; // Corresponds to 15 ms. const int16_t* signal; - scoped_array signal_array; + scoped_ptr signal_array; size_t signal_len; if (num_channels_ == 1) { signal = input; diff --git a/webrtc/modules/audio_coding/neteq4/tools/audio_loop.h b/webrtc/modules/audio_coding/neteq4/tools/audio_loop.h index 038ca370e7..0499a75cbe 100644 --- a/webrtc/modules/audio_coding/neteq4/tools/audio_loop.h +++ b/webrtc/modules/audio_coding/neteq4/tools/audio_loop.h @@ -27,8 +27,7 @@ class AudioLoop { AudioLoop() : next_index_(0), loop_length_samples_(0), - block_length_samples_(0), - audio_array_(NULL) { + block_length_samples_(0) { } virtual ~AudioLoop() {} @@ -50,7 +49,7 @@ class AudioLoop { size_t next_index_; size_t loop_length_samples_; size_t block_length_samples_; - scoped_array audio_array_; + scoped_ptr audio_array_; DISALLOW_COPY_AND_ASSIGN(AudioLoop); }; diff --git a/webrtc/modules/audio_device/android/fine_audio_buffer.h b/webrtc/modules/audio_device/android/fine_audio_buffer.h index 597b8aaa38..e577b72fd4 100644 --- a/webrtc/modules/audio_device/android/fine_audio_buffer.h +++ b/webrtc/modules/audio_device/android/fine_audio_buffer.h @@ -56,7 +56,7 @@ class FineAudioBuffer { int bytes_per_10_ms_; // Storage for samples that are not yet asked for. - scoped_array cache_buffer_; + scoped_ptr cache_buffer_; int cached_buffer_start_; // Location of first unread sample. int cached_bytes_; // Number of bytes stored in cache. }; diff --git a/webrtc/modules/audio_device/android/fine_audio_buffer_unittest.cc b/webrtc/modules/audio_device/android/fine_audio_buffer_unittest.cc index 69ba741d18..e1f03f8f3c 100644 --- a/webrtc/modules/audio_device/android/fine_audio_buffer_unittest.cc +++ b/webrtc/modules/audio_device/android/fine_audio_buffer_unittest.cc @@ -80,7 +80,7 @@ void RunFineBufferTest(int sample_rate, int frame_size_in_samples) { FineAudioBuffer fine_buffer(&audio_device_buffer, kFrameSizeBytes, sample_rate); - scoped_array out_buffer; + scoped_ptr out_buffer; out_buffer.reset( new int8_t[fine_buffer.RequiredBufferSizeBytes()]); for (int i = 0; i < kNumberOfFrames; ++i) { diff --git a/webrtc/modules/audio_device/android/opensles_input.cc b/webrtc/modules/audio_device/android/opensles_input.cc index 6b600c9fde..f22d8bf7ef 100644 --- a/webrtc/modules/audio_device/android/opensles_input.cc +++ b/webrtc/modules/audio_device/android/opensles_input.cc @@ -289,7 +289,7 @@ void OpenSlesInput::AllocateBuffers() { fifo_.reset(new SingleRwFifo(num_fifo_buffers_needed_)); // Allocate the memory area to be used. - rec_buf_.reset(new scoped_array[TotalBuffersUsed()]); + rec_buf_.reset(new scoped_ptr[TotalBuffersUsed()]); for (int i = 0; i < TotalBuffersUsed(); ++i) { rec_buf_[i].reset(new int8_t[buffer_size_bytes()]); } diff --git a/webrtc/modules/audio_device/android/opensles_input.h b/webrtc/modules/audio_device/android/opensles_input.h index 48e4fd2df8..d27d82435d 100644 --- a/webrtc/modules/audio_device/android/opensles_input.h +++ b/webrtc/modules/audio_device/android/opensles_input.h @@ -205,7 +205,7 @@ class OpenSlesInput { // Audio buffers AudioDeviceBuffer* audio_buffer_; // Holds all allocated memory such that it is deallocated properly. - scoped_array > rec_buf_; + scoped_ptr[]> rec_buf_; // Index in |rec_buf_| pointing to the audio buffer that will be ready the // next time RecorderSimpleBufferQueueCallbackHandler is invoked. // Ready means buffer contains audio data from the device. diff --git a/webrtc/modules/audio_device/android/opensles_output.cc b/webrtc/modules/audio_device/android/opensles_output.cc index 6185b2ad28..377789b237 100644 --- a/webrtc/modules/audio_device/android/opensles_output.cc +++ b/webrtc/modules/audio_device/android/opensles_output.cc @@ -340,7 +340,7 @@ void OpenSlesOutput::AllocateBuffers() { fifo_.reset(new SingleRwFifo(num_fifo_buffers_needed_)); // Allocate the memory area to be used. - play_buf_.reset(new scoped_array[TotalBuffersUsed()]); + play_buf_.reset(new scoped_ptr[TotalBuffersUsed()]); int required_buffer_size = fine_buffer_->RequiredBufferSizeBytes(); for (int i = 0; i < TotalBuffersUsed(); ++i) { play_buf_[i].reset(new int8_t[required_buffer_size]); diff --git a/webrtc/modules/audio_device/android/opensles_output.h b/webrtc/modules/audio_device/android/opensles_output.h index 464a7e41ad..aa9b5bf121 100644 --- a/webrtc/modules/audio_device/android/opensles_output.h +++ b/webrtc/modules/audio_device/android/opensles_output.h @@ -223,7 +223,7 @@ class OpenSlesOutput : public PlayoutDelayProvider { // Audio buffers AudioDeviceBuffer* audio_buffer_; scoped_ptr fine_buffer_; - scoped_array > play_buf_; + scoped_ptr[]> play_buf_; // Index in |rec_buf_| pointing to the audio buffer that will be ready the // next time PlayerSimpleBufferQueueCallbackHandler is invoked. // Ready means buffer is ready to be played out to device. diff --git a/webrtc/modules/audio_device/android/single_rw_fifo.h b/webrtc/modules/audio_device/android/single_rw_fifo.h index a1fcfaab41..092b1d5e09 100644 --- a/webrtc/modules/audio_device/android/single_rw_fifo.h +++ b/webrtc/modules/audio_device/android/single_rw_fifo.h @@ -35,7 +35,7 @@ class SingleRwFifo { int capacity() const { return capacity_; } private: - scoped_array queue_; + scoped_ptr queue_; int capacity_; Atomic32 size_; diff --git a/webrtc/modules/audio_device/android/single_rw_fifo_unittest.cc b/webrtc/modules/audio_device/android/single_rw_fifo_unittest.cc index c722c2756c..9925baaa88 100644 --- a/webrtc/modules/audio_device/android/single_rw_fifo_unittest.cc +++ b/webrtc/modules/audio_device/android/single_rw_fifo_unittest.cc @@ -90,7 +90,7 @@ class SingleRwFifoTest : public testing::Test { protected: SingleRwFifo fifo_; // Memory area for proper de-allocation. - scoped_array buffer_[kCapacity]; + scoped_ptr buffer_[kCapacity]; std::list memory_queue_; int pushed_; diff --git a/webrtc/modules/audio_processing/test/process_test.cc b/webrtc/modules/audio_processing/test/process_test.cc index 95984f54c4..01f9dcecb7 100644 --- a/webrtc/modules/audio_processing/test/process_test.cc +++ b/webrtc/modules/audio_processing/test/process_test.cc @@ -518,7 +518,7 @@ void void_main(int argc, char* argv[]) { const size_t path_size = apm->echo_control_mobile()->echo_path_size_bytes(); - scoped_array echo_path(new char[path_size]); + scoped_ptr echo_path(new char[path_size]); ASSERT_EQ(path_size, fread(echo_path.get(), sizeof(char), path_size, @@ -1004,7 +1004,7 @@ void void_main(int argc, char* argv[]) { if (aecm_echo_path_out_file != NULL) { const size_t path_size = apm->echo_control_mobile()->echo_path_size_bytes(); - scoped_array echo_path(new char[path_size]); + scoped_ptr echo_path(new char[path_size]); apm->echo_control_mobile()->GetEchoPath(echo_path.get(), path_size); ASSERT_EQ(path_size, fwrite(echo_path.get(), sizeof(char), diff --git a/webrtc/modules/audio_processing/utility/ring_buffer_unittest.cc b/webrtc/modules/audio_processing/utility/ring_buffer_unittest.cc index bd68f9489b..5dacf0b804 100644 --- a/webrtc/modules/audio_processing/utility/ring_buffer_unittest.cc +++ b/webrtc/modules/audio_processing/utility/ring_buffer_unittest.cc @@ -61,8 +61,8 @@ static void RandomStressTest(int** data_ptr) { srand(seed); for (int i = 0; i < kNumTests; i++) { const int buffer_size = std::max(rand() % kMaxBufferSize, 1); - scoped_array write_data(new int[buffer_size]); - scoped_array read_data(new int[buffer_size]); + scoped_ptr write_data(new int[buffer_size]); + scoped_ptr read_data(new int[buffer_size]); scoped_ring_buffer buffer(WebRtc_CreateBuffer(buffer_size, sizeof(int))); ASSERT_TRUE(buffer.get() != NULL); ASSERT_EQ(0, WebRtc_InitBuffer(buffer.get())); diff --git a/webrtc/modules/desktop_capture/differ.h b/webrtc/modules/desktop_capture/differ.h index 8edce80b4e..0b419d2dde 100644 --- a/webrtc/modules/desktop_capture/differ.h +++ b/webrtc/modules/desktop_capture/differ.h @@ -76,7 +76,7 @@ class Differ { int bytes_per_row_; // Diff information for each block in the image. - scoped_array diff_info_; + scoped_ptr diff_info_; // Dimensions and total size of diff info array. int diff_info_width_; diff --git a/webrtc/modules/desktop_capture/differ_unittest.cc b/webrtc/modules/desktop_capture/differ_unittest.cc index 40fde4dbc4..da1a21461d 100644 --- a/webrtc/modules/desktop_capture/differ_unittest.cc +++ b/webrtc/modules/desktop_capture/differ_unittest.cc @@ -200,8 +200,8 @@ class DifferTest : public testing::Test { int buffer_size_; // Previous and current screen buffers. - scoped_array prev_; - scoped_array curr_; + scoped_ptr prev_; + scoped_ptr curr_; private: DISALLOW_COPY_AND_ASSIGN(DifferTest); diff --git a/webrtc/modules/desktop_capture/win/cursor.cc b/webrtc/modules/desktop_capture/win/cursor.cc index 11bb2dbb6d..00055c44ad 100644 --- a/webrtc/modules/desktop_capture/win/cursor.cc +++ b/webrtc/modules/desktop_capture/win/cursor.cc @@ -137,7 +137,7 @@ MouseCursor* CreateMouseCursorFromHCursor(HDC dc, HCURSOR cursor) { int width = bitmap_info.bmWidth; int height = bitmap_info.bmHeight; - scoped_array mask_data(new uint32_t[width * height]); + scoped_ptr mask_data(new uint32_t[width * height]); // Get pixel data from |scoped_mask| converting it to 32bpp along the way. // GetDIBits() sets the alpha component of every pixel to 0. diff --git a/webrtc/modules/desktop_capture/win/cursor_unittest.cc b/webrtc/modules/desktop_capture/win/cursor_unittest.cc index 9d2387483d..b046ace315 100644 --- a/webrtc/modules/desktop_capture/win/cursor_unittest.cc +++ b/webrtc/modules/desktop_capture/win/cursor_unittest.cc @@ -62,7 +62,7 @@ bool ConvertToMouseShapeAndCompare(unsigned left, unsigned right) { // Get the pixels from |scoped_color|. int size = width * height; - scoped_array data(new uint32_t[size]); + scoped_ptr data(new uint32_t[size]); EXPECT_TRUE(GetBitmapBits(scoped_color, size * sizeof(uint32_t), data.get())); // Compare the 32bpp image in |mouse_shape| with the one loaded from |right|. diff --git a/webrtc/modules/remote_bitrate_estimator/rate_statistics.h b/webrtc/modules/remote_bitrate_estimator/rate_statistics.h index 429669059a..f97371bd62 100644 --- a/webrtc/modules/remote_bitrate_estimator/rate_statistics.h +++ b/webrtc/modules/remote_bitrate_estimator/rate_statistics.h @@ -34,7 +34,7 @@ class RateStatistics { // Counters are kept in buckets (circular buffer), with one bucket // per millisecond. const int num_buckets_; - scoped_array buckets_; + scoped_ptr buckets_; // Total count recorded in buckets. uint32_t accumulated_count_; diff --git a/webrtc/modules/rtp_rtcp/test/testFec/test_packet_masks_metrics.cc b/webrtc/modules/rtp_rtcp/test/testFec/test_packet_masks_metrics.cc index cc1ee84e34..2fb09683eb 100644 --- a/webrtc/modules/rtp_rtcp/test/testFec/test_packet_masks_metrics.cc +++ b/webrtc/modules/rtp_rtcp/test/testFec/test_packet_masks_metrics.cc @@ -198,7 +198,7 @@ class FecPacketMaskMetricsTest : public ::testing::Test { int RecoveredMediaPackets(int num_media_packets, int num_fec_packets, uint8_t* state) { - scoped_array state_tmp( + scoped_ptr state_tmp( new uint8_t[num_media_packets + num_fec_packets]); memcpy(state_tmp.get(), state, num_media_packets + num_fec_packets); int num_recovered_packets = 0; @@ -392,7 +392,7 @@ class FecPacketMaskMetricsTest : public ::testing::Test { // (which containes the code size parameters/protection length). void ComputeMetricsForCode(CodeType code_type, int code_index) { - scoped_array prob_weight(new double[kNumLossModels]); + scoped_ptr prob_weight(new double[kNumLossModels]); memset(prob_weight.get() , 0, sizeof(double) * kNumLossModels); MetricsFecCode metrics_code; SetMetricsZero(&metrics_code); @@ -400,7 +400,7 @@ class FecPacketMaskMetricsTest : public ::testing::Test { int num_media_packets = code_params_[code_index].num_media_packets; int num_fec_packets = code_params_[code_index].num_fec_packets; int tot_num_packets = num_media_packets + num_fec_packets; - scoped_array state(new uint8_t[tot_num_packets]); + scoped_ptr state(new uint8_t[tot_num_packets]); memset(state.get() , 0, tot_num_packets); int num_loss_configurations = static_cast(pow(2.0f, tot_num_packets)); diff --git a/webrtc/modules/video_capture/test/video_capture_unittest.cc b/webrtc/modules/video_capture/test/video_capture_unittest.cc index db0c81872f..bf3be83987 100644 --- a/webrtc/modules/video_capture/test/video_capture_unittest.cc +++ b/webrtc/modules/video_capture/test/video_capture_unittest.cc @@ -473,7 +473,7 @@ TEST_F(VideoCaptureExternalTest, TestExternalCapture) { unsigned int length = webrtc::CalcBufferSize(webrtc::kI420, test_frame_.width(), test_frame_.height()); - webrtc::scoped_array test_buffer(new uint8_t[length]); + webrtc::scoped_ptr test_buffer(new uint8_t[length]); webrtc::ExtractBuffer(test_frame_, length, test_buffer.get()); EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), length, capture_callback_.capability(), 0)); @@ -558,7 +558,7 @@ TEST_F(VideoCaptureExternalTest , FrameRate) { unsigned int length = webrtc::CalcBufferSize(webrtc::kI420, test_frame_.width(), test_frame_.height()); - webrtc::scoped_array test_buffer(new uint8_t[length]); + webrtc::scoped_ptr test_buffer(new uint8_t[length]); webrtc::ExtractBuffer(test_frame_, length, test_buffer.get()); EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), length, capture_callback_.capability(), 0)); @@ -574,7 +574,7 @@ TEST_F(VideoCaptureExternalTest , FrameRate) { unsigned int length = webrtc::CalcBufferSize(webrtc::kI420, test_frame_.width(), test_frame_.height()); - webrtc::scoped_array test_buffer(new uint8_t[length]); + webrtc::scoped_ptr test_buffer(new uint8_t[length]); webrtc::ExtractBuffer(test_frame_, length, test_buffer.get()); EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), length, capture_callback_.capability(), 0)); @@ -592,7 +592,7 @@ TEST_F(VideoCaptureExternalTest, Rotation) { unsigned int length = webrtc::CalcBufferSize(webrtc::kI420, test_frame_.width(), test_frame_.height()); - webrtc::scoped_array test_buffer(new uint8_t[length]); + webrtc::scoped_ptr test_buffer(new uint8_t[length]); webrtc::ExtractBuffer(test_frame_, length, test_buffer.get()); EXPECT_EQ(0, capture_input_interface_->IncomingFrame(test_buffer.get(), length, capture_callback_.capability(), 0)); diff --git a/webrtc/modules/video_coding/codecs/test/videoprocessor.cc b/webrtc/modules/video_coding/codecs/test/videoprocessor.cc index 30ee6a8e0e..93738caf12 100644 --- a/webrtc/modules/video_coding/codecs/test/videoprocessor.cc +++ b/webrtc/modules/video_coding/codecs/test/videoprocessor.cc @@ -331,7 +331,7 @@ void VideoProcessorImpl::FrameDecoded(const I420VideoFrame& image) { } // TODO(mikhal): Extracting the buffer for now - need to update test. int length = CalcBufferSize(kI420, up_image.width(), up_image.height()); - scoped_array image_buffer(new uint8_t[length]); + scoped_ptr image_buffer(new uint8_t[length]); length = ExtractBuffer(up_image, length, image_buffer.get()); // Update our copy of the last successful frame: memcpy(last_successful_frame_buffer_, image_buffer.get(), length); @@ -344,7 +344,7 @@ void VideoProcessorImpl::FrameDecoded(const I420VideoFrame& image) { // Update our copy of the last successful frame: // TODO(mikhal): Add as a member function, so won't be allocated per frame. int length = CalcBufferSize(kI420, image.width(), image.height()); - scoped_array image_buffer(new uint8_t[length]); + scoped_ptr image_buffer(new uint8_t[length]); length = ExtractBuffer(image, length, image_buffer.get()); assert(length > 0); memcpy(last_successful_frame_buffer_, image_buffer.get(), length); diff --git a/webrtc/modules/video_coding/codecs/test_framework/unit_test.cc b/webrtc/modules/video_coding/codecs/test_framework/unit_test.cc index 3b034e01c6..ec12a51693 100644 --- a/webrtc/modules/video_coding/codecs/test_framework/unit_test.cc +++ b/webrtc/modules/video_coding/codecs/test_framework/unit_test.cc @@ -565,7 +565,7 @@ UnitTest::Perform() frameLength = WaitForDecodedFrame(); } unsigned int length = CalcBufferSize(kI420, width, height); - scoped_array decoded_buffer(new uint8_t[length]); + scoped_ptr decoded_buffer(new uint8_t[length]); ExtractBuffer(_decodedVideoBuffer, _lengthSourceFrame, decoded_buffer.get()); EXPECT_TRUE(CheckIfBitExact(decoded_buffer.get(), frameLength, _refDecFrame, @@ -645,7 +645,7 @@ UnitTest::Perform() // check that decoded frame matches with reference unsigned int length = CalcBufferSize(kI420, width, height); - scoped_array decoded_buffer(new uint8_t[length]); + scoped_ptr decoded_buffer(new uint8_t[length]); ExtractBuffer(_decodedVideoBuffer, length, decoded_buffer.get()); EXPECT_TRUE(CheckIfBitExact(decoded_buffer.get(), length, _refDecFrame, _lengthSourceFrame) == true); diff --git a/webrtc/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc b/webrtc/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc index ff99ed2792..3cc8bc330d 100644 --- a/webrtc/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc +++ b/webrtc/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc @@ -181,7 +181,7 @@ class TestVp8Impl : public ::testing::Test { scoped_ptr encode_complete_callback_; scoped_ptr decode_complete_callback_; - scoped_array source_buffer_; + scoped_ptr source_buffer_; FILE* source_file_; I420VideoFrame input_frame_; scoped_ptr encoder_; diff --git a/webrtc/modules/video_coding/codecs/vp8/vp8_sequence_coder.cc b/webrtc/modules/video_coding/codecs/vp8/vp8_sequence_coder.cc index 1bd3e1a623..ffa0bcc681 100644 --- a/webrtc/modules/video_coding/codecs/vp8/vp8_sequence_coder.cc +++ b/webrtc/modules/video_coding/codecs/vp8/vp8_sequence_coder.cc @@ -142,7 +142,7 @@ int SequenceCoder(webrtc::test::CommandLineParser& parser) { EXPECT_EQ(0, decoder->InitDecode(&inst, 1)); webrtc::I420VideoFrame input_frame; unsigned int length = webrtc::CalcBufferSize(webrtc::kI420, width, height); - webrtc::scoped_array frame_buffer(new uint8_t[length]); + webrtc::scoped_ptr frame_buffer(new uint8_t[length]); int half_width = (width + 1) / 2; // Set and register callbacks. diff --git a/webrtc/modules/video_coding/main/test/rtp_player.cc b/webrtc/modules/video_coding/main/test/rtp_player.cc index e314a7c9b1..f02aebba5e 100644 --- a/webrtc/modules/video_coding/main/test/rtp_player.cc +++ b/webrtc/modules/video_coding/main/test/rtp_player.cc @@ -61,7 +61,7 @@ class RawRtpPacket { uint16_t seq_num() const { return seq_num_; } private: - scoped_array data_; + scoped_ptr data_; uint32_t length_; int64_t resend_time_ms_; uint32_t ssrc_; diff --git a/webrtc/modules/video_processing/main/test/unit_test/brightness_detection_test.cc b/webrtc/modules/video_processing/main/test/unit_test/brightness_detection_test.cc index d7ac72908a..c53c1fb838 100644 --- a/webrtc/modules/video_processing/main/test/unit_test/brightness_detection_test.cc +++ b/webrtc/modules/video_processing/main/test/unit_test/brightness_detection_test.cc @@ -19,7 +19,7 @@ TEST_F(VideoProcessingModuleTest, BrightnessDetection) uint32_t frameNum = 0; int32_t brightnessWarning = 0; uint32_t warningCount = 0; - scoped_array video_buffer(new uint8_t[frame_length_]); + scoped_ptr video_buffer(new uint8_t[frame_length_]); while (fread(video_buffer.get(), 1, frame_length_, source_file_) == frame_length_) { diff --git a/webrtc/modules/video_processing/main/test/unit_test/color_enhancement_test.cc b/webrtc/modules/video_processing/main/test/unit_test/color_enhancement_test.cc index fc560bef13..c1cd462319 100644 --- a/webrtc/modules/video_processing/main/test/unit_test/color_enhancement_test.cc +++ b/webrtc/modules/video_processing/main/test/unit_test/color_enhancement_test.cc @@ -39,7 +39,7 @@ TEST_F(VideoProcessingModuleTest, ColorEnhancement) ASSERT_TRUE(modFile != NULL) << "Could not open output file.\n"; uint32_t frameNum = 0; - scoped_array video_buffer(new uint8_t[frame_length_]); + scoped_ptr video_buffer(new uint8_t[frame_length_]); while (fread(video_buffer.get(), 1, frame_length_, source_file_) == frame_length_) { @@ -86,7 +86,7 @@ TEST_F(VideoProcessingModuleTest, ColorEnhancement) width_, half_width_, half_width_); // Compare frame-by-frame. - scoped_array ref_buffer(new uint8_t[frame_length_]); + scoped_ptr ref_buffer(new uint8_t[frame_length_]); while (fread(video_buffer.get(), 1, frame_length_, modFile) == frame_length_) { @@ -114,7 +114,7 @@ TEST_F(VideoProcessingModuleTest, ColorEnhancement) // Verify that all color pixels are enhanced, and no luminance values are // altered. - scoped_array testFrame(new uint8_t[frame_length_]); + scoped_ptr testFrame(new uint8_t[frame_length_]); // Use value 128 as probe value, since we know that this will be changed // in the enhancement. diff --git a/webrtc/modules/video_processing/main/test/unit_test/content_metrics_test.cc b/webrtc/modules/video_processing/main/test/unit_test/content_metrics_test.cc index 36a1ad7625..c0d1ab4343 100644 --- a/webrtc/modules/video_processing/main/test/unit_test/content_metrics_test.cc +++ b/webrtc/modules/video_processing/main/test/unit_test/content_metrics_test.cc @@ -23,7 +23,7 @@ TEST_F(VideoProcessingModuleTest, ContentAnalysis) { ca__c.Initialize(width_,height_); ca__sse.Initialize(width_,height_); - scoped_array video_buffer(new uint8_t[frame_length_]); + scoped_ptr video_buffer(new uint8_t[frame_length_]); while (fread(video_buffer.get(), 1, frame_length_, source_file_) == frame_length_) { // Using ConvertToI420 to add stride to the image. diff --git a/webrtc/modules/video_processing/main/test/unit_test/deflickering_test.cc b/webrtc/modules/video_processing/main/test/unit_test/deflickering_test.cc index 0fa3f48b4f..1bf53fc897 100644 --- a/webrtc/modules/video_processing/main/test/unit_test/deflickering_test.cc +++ b/webrtc/modules/video_processing/main/test/unit_test/deflickering_test.cc @@ -43,7 +43,7 @@ TEST_F(VideoProcessingModuleTest, Deflickering) "Could not open output file: " << output_file << "\n"; printf("\nRun time [us / frame]:\n"); - scoped_array video_buffer(new uint8_t[frame_length_]); + scoped_ptr video_buffer(new uint8_t[frame_length_]); for (uint32_t run_idx = 0; run_idx < NumRuns; run_idx++) { TickTime t0; diff --git a/webrtc/modules/video_processing/main/test/unit_test/denoising_test.cc b/webrtc/modules/video_processing/main/test/unit_test/denoising_test.cc index 3023a2d7af..c00db6ab57 100644 --- a/webrtc/modules/video_processing/main/test/unit_test/denoising_test.cc +++ b/webrtc/modules/video_processing/main/test/unit_test/denoising_test.cc @@ -49,7 +49,7 @@ TEST_F(VideoProcessingModuleTest, DISABLED_ON_ANDROID(Denoising)) int32_t modifiedPixels = 0; frameNum = 0; - scoped_array video_buffer(new uint8_t[frame_length_]); + scoped_ptr video_buffer(new uint8_t[frame_length_]); while (fread(video_buffer.get(), 1, frame_length_, source_file_) == frame_length_) { diff --git a/webrtc/modules/video_processing/main/test/unit_test/video_processing_unittest.cc b/webrtc/modules/video_processing/main/test/unit_test/video_processing_unittest.cc index 6e54923063..9d70e67a12 100644 --- a/webrtc/modules/video_processing/main/test/unit_test/video_processing_unittest.cc +++ b/webrtc/modules/video_processing/main/test/unit_test/video_processing_unittest.cc @@ -89,7 +89,7 @@ TEST_F(VideoProcessingModuleTest, HandleNullBuffer) { TEST_F(VideoProcessingModuleTest, HandleBadStats) { VideoProcessingModule::FrameStats stats; - scoped_array video_buffer(new uint8_t[frame_length_]); + scoped_ptr video_buffer(new uint8_t[frame_length_]); ASSERT_EQ(frame_length_, fread(video_buffer.get(), 1, frame_length_, source_file_)); EXPECT_EQ(0, ConvertToI420(kI420, video_buffer.get(), 0, 0, @@ -129,7 +129,7 @@ TEST_F(VideoProcessingModuleTest, IdenticalResultsAfterReset) { I420VideoFrame video_frame2; VideoProcessingModule::FrameStats stats; // Only testing non-static functions here. - scoped_array video_buffer(new uint8_t[frame_length_]); + scoped_ptr video_buffer(new uint8_t[frame_length_]); ASSERT_EQ(frame_length_, fread(video_buffer.get(), 1, frame_length_, source_file_)); EXPECT_EQ(0, ConvertToI420(kI420, video_buffer.get(), 0, 0, @@ -172,7 +172,7 @@ TEST_F(VideoProcessingModuleTest, IdenticalResultsAfterReset) { TEST_F(VideoProcessingModuleTest, FrameStats) { VideoProcessingModule::FrameStats stats; - scoped_array video_buffer(new uint8_t[frame_length_]); + scoped_ptr video_buffer(new uint8_t[frame_length_]); ASSERT_EQ(frame_length_, fread(video_buffer.get(), 1, frame_length_, source_file_)); EXPECT_EQ(0, ConvertToI420(kI420, video_buffer.get(), 0, 0, @@ -242,7 +242,7 @@ TEST_F(VideoProcessingModuleTest, Resampler) { vpm_->EnableTemporalDecimation(false); // Reading test frame - scoped_array video_buffer(new uint8_t[frame_length_]); + scoped_ptr video_buffer(new uint8_t[frame_length_]); ASSERT_EQ(frame_length_, fread(video_buffer.get(), 1, frame_length_, source_file_)); // Using ConvertToI420 to add stride to the image. diff --git a/webrtc/system_wrappers/interface/scoped_ptr.h b/webrtc/system_wrappers/interface/scoped_ptr.h index fb203638f9..8998f817dd 100644 --- a/webrtc/system_wrappers/interface/scoped_ptr.h +++ b/webrtc/system_wrappers/interface/scoped_ptr.h @@ -563,82 +563,4 @@ bool operator!=(T* p1, const webrtc::scoped_ptr& p2) { return p1 != p2.get(); } -namespace webrtc { - -// DEPRECATED: Use scoped_ptr instead. -// TODO(ajm): Remove scoped_array. -// -// scoped_array extends scoped_ptr to arrays. Deletion of the array pointed to -// is guaranteed, either on destruction of the scoped_array or via an explicit -// reset(). Use shared_array or std::vector if your needs are more complex. - -template -class scoped_array { - private: - - T* ptr; - - scoped_array(scoped_array const &); - scoped_array & operator=(scoped_array const &); - - public: - - typedef T element_type; - - explicit scoped_array(T* p = NULL) : ptr(p) {} - - ~scoped_array() { - typedef char type_must_be_complete[sizeof(T)]; - delete[] ptr; - } - - void reset(T* p = NULL) { - typedef char type_must_be_complete[sizeof(T)]; - - if (ptr != p) { - T* arr = ptr; - ptr = p; - // Delete last, in case arr destructor indirectly results in ~scoped_array - delete [] arr; - } - } - - T& operator[](ptrdiff_t i) const { - assert(ptr != NULL); - assert(i >= 0); - return ptr[i]; - } - - T* get() const { - return ptr; - } - - void swap(scoped_array & b) { - T* tmp = b.ptr; - b.ptr = ptr; - ptr = tmp; - } - - T* release() { - T* tmp = ptr; - ptr = NULL; - return tmp; - } - - T** accept() { - if (ptr) { - delete [] ptr; - ptr = NULL; - } - return &ptr; - } -}; - -template inline -void swap(scoped_array& a, scoped_array& b) { - a.swap(b); -} - -} // namespace webrtc - #endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_SCOPED_PTR_H_ diff --git a/webrtc/test/fake_network_pipe_unittest.cc b/webrtc/test/fake_network_pipe_unittest.cc index 5076bc0ac6..6655fa1658 100644 --- a/webrtc/test/fake_network_pipe_unittest.cc +++ b/webrtc/test/fake_network_pipe_unittest.cc @@ -47,7 +47,7 @@ class FakeNetworkPipeTest : public ::testing::Test { } void SendPackets(FakeNetworkPipe* pipe, int number_packets, int kPacketSize) { - scoped_array packet(new uint8_t[kPacketSize]); + scoped_ptr packet(new uint8_t[kPacketSize]); for (int i = 0; i < number_packets; ++i) { pipe->SendPacket(packet.get(), kPacketSize); } diff --git a/webrtc/test/testsupport/metrics/video_metrics.cc b/webrtc/test/testsupport/metrics/video_metrics.cc index f537e03925..1e19806b4d 100644 --- a/webrtc/test/testsupport/metrics/video_metrics.cc +++ b/webrtc/test/testsupport/metrics/video_metrics.cc @@ -111,8 +111,8 @@ int CalculateMetrics(VideoMetricsType video_metrics_type, const size_t frame_length = 3 * width * height >> 1; I420VideoFrame ref_frame; I420VideoFrame test_frame; - scoped_array ref_buffer(new uint8_t[frame_length]); - scoped_array test_buffer(new uint8_t[frame_length]); + scoped_ptr ref_buffer(new uint8_t[frame_length]); + scoped_ptr test_buffer(new uint8_t[frame_length]); // Set decoded image parameters. int half_width = (width + 1) / 2; diff --git a/webrtc/tools/frame_editing/frame_editing_lib.cc b/webrtc/tools/frame_editing/frame_editing_lib.cc index 6e252e8711..93a548fe56 100644 --- a/webrtc/tools/frame_editing/frame_editing_lib.cc +++ b/webrtc/tools/frame_editing/frame_editing_lib.cc @@ -38,7 +38,7 @@ int EditFrames(const string& in_path, int width, int height, // Frame size of I420. int frame_length = CalcBufferSize(kI420, width, height); - webrtc::scoped_array temp_buffer(new uint8_t[frame_length]); + webrtc::scoped_ptr temp_buffer(new uint8_t[frame_length]); FILE* out_fid = fopen(out_path.c_str(), "wb"); diff --git a/webrtc/tools/frame_editing/frame_editing_unittest.cc b/webrtc/tools/frame_editing/frame_editing_unittest.cc index 83302181fb..bdcc2f21f5 100644 --- a/webrtc/tools/frame_editing/frame_editing_unittest.cc +++ b/webrtc/tools/frame_editing/frame_editing_unittest.cc @@ -53,8 +53,8 @@ class FrameEditingTest : public ::testing::Test { } // Compares the frames in both streams to the end of one of the streams. void CompareToTheEnd(FILE* test_video_fid, FILE* ref_video_fid, - scoped_array* ref_buffer, - scoped_array* test_buffer) { + scoped_ptr* ref_buffer, + scoped_ptr* test_buffer) { while (!feof(test_video_fid) && !feof(ref_video_fid)) { num_bytes_read_ = fread(ref_buffer->get(), 1, kFrameSize, ref_video_fid); if (!feof(ref_video_fid)) { @@ -78,8 +78,8 @@ class FrameEditingTest : public ::testing::Test { FILE* original_fid_; FILE* edited_fid_; int num_bytes_read_; - scoped_array original_buffer_; - scoped_array edited_buffer_; + scoped_ptr original_buffer_; + scoped_ptr edited_buffer_; int num_frames_read_; }; diff --git a/webrtc/video_engine/test/libvietest/helpers/vie_to_file_renderer.cc b/webrtc/video_engine/test/libvietest/helpers/vie_to_file_renderer.cc index 78649576bb..16c73f4e6f 100644 --- a/webrtc/video_engine/test/libvietest/helpers/vie_to_file_renderer.cc +++ b/webrtc/video_engine/test/libvietest/helpers/vie_to_file_renderer.cc @@ -30,7 +30,7 @@ struct Frame { memcpy(this->buffer.get(), buffer, buffer_size); } - webrtc::scoped_array buffer; + webrtc::scoped_ptr buffer; int buffer_size; uint32_t timestamp; int64_t render_time; diff --git a/webrtc/video_engine/vie_capturer.cc b/webrtc/video_engine/vie_capturer.cc index 94993ca408..65159a1d86 100644 --- a/webrtc/video_engine/vie_capturer.cc +++ b/webrtc/video_engine/vie_capturer.cc @@ -535,7 +535,7 @@ void ViECapturer::DeliverI420Frame(I420VideoFrame* video_frame) { unsigned int length = CalcBufferSize(kI420, video_frame->width(), video_frame->height()); - scoped_array video_buffer(new uint8_t[length]); + scoped_ptr video_buffer(new uint8_t[length]); ExtractBuffer(*video_frame, length, video_buffer.get()); effect_filter_->Transform(length, video_buffer.get(), diff --git a/webrtc/video_engine/vie_channel.cc b/webrtc/video_engine/vie_channel.cc index 94210a373f..d5e08787f8 100644 --- a/webrtc/video_engine/vie_channel.cc +++ b/webrtc/video_engine/vie_channel.cc @@ -1401,7 +1401,7 @@ int32_t ViEChannel::FrameToRender( unsigned int length = CalcBufferSize(kI420, video_frame.width(), video_frame.height()); - scoped_array video_buffer(new uint8_t[length]); + scoped_ptr video_buffer(new uint8_t[length]); ExtractBuffer(video_frame, length, video_buffer.get()); effect_filter_->Transform(length, video_buffer.get(), diff --git a/webrtc/video_engine/vie_encoder.cc b/webrtc/video_engine/vie_encoder.cc index e2b70eb632..957407daa8 100644 --- a/webrtc/video_engine/vie_encoder.cc +++ b/webrtc/video_engine/vie_encoder.cc @@ -503,7 +503,7 @@ void ViEEncoder::DeliverFrame(int id, unsigned int length = CalcBufferSize(kI420, video_frame->width(), video_frame->height()); - scoped_array video_buffer(new uint8_t[length]); + scoped_ptr video_buffer(new uint8_t[length]); ExtractBuffer(*video_frame, length, video_buffer.get()); effect_filter_->Transform(length, video_buffer.get(), diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc index 5f6de0e3be..b3c53f854f 100644 --- a/webrtc/voice_engine/channel.cc +++ b/webrtc/voice_engine/channel.cc @@ -4279,7 +4279,7 @@ Channel::GetRtpRtcp(RtpRtcp** rtpRtcpModule, RtpReceiver** rtp_receiver) const int32_t Channel::MixOrReplaceAudioWithFile(int mixingFrequency) { - scoped_array fileBuffer(new int16_t[640]); + scoped_ptr fileBuffer(new int16_t[640]); int fileSamples(0); { @@ -4349,7 +4349,7 @@ Channel::MixAudioWithFile(AudioFrame& audioFrame, { assert(mixingFrequency <= 32000); - scoped_array fileBuffer(new int16_t[640]); + scoped_ptr fileBuffer(new int16_t[640]); int fileSamples(0); { diff --git a/webrtc/voice_engine/include/mock/fake_voe_external_media.h b/webrtc/voice_engine/include/mock/fake_voe_external_media.h index f45e1ba0f2..b327f3c52a 100644 --- a/webrtc/voice_engine/include/mock/fake_voe_external_media.h +++ b/webrtc/voice_engine/include/mock/fake_voe_external_media.h @@ -53,7 +53,7 @@ class FakeVoEExternalMedia : public VoEExternalMedia { int samples_per_channel, int sample_rate_hz, int num_channels) { const int length = samples_per_channel * num_channels; - scoped_array data; + scoped_ptr data; if (!audio) { data.reset(new int16_t[length]); memset(data.get(), 0, length * sizeof(data[0])); diff --git a/webrtc/voice_engine/transmit_mixer.cc b/webrtc/voice_engine/transmit_mixer.cc index d2467cf979..cce2f9461e 100644 --- a/webrtc/voice_engine/transmit_mixer.cc +++ b/webrtc/voice_engine/transmit_mixer.cc @@ -1217,7 +1217,7 @@ int32_t TransmitMixer::RecordAudioToFile( int32_t TransmitMixer::MixOrReplaceAudioWithFile( int mixingFrequency) { - scoped_array fileBuffer(new int16_t[640]); + scoped_ptr fileBuffer(new int16_t[640]); int fileSamples(0); {