rtc::Buffer: Remove backwards compatibility band-aids

This CL makes two changes to rtc::Buffer that have had to wait for
Chromium's use of it to be modernized:

  1. Change default return type of rtc::Buffer::data() from char* to
     uint8_t*. uint8_t is a more natural type for bytes, and won't
     accidentally convert to a string. (Chromium previously expected
     the default return type to be char, which is why
     rtc::Buffer::data() initially got char as default return type in
     9478437f, but that's been fixed now.)

  2. Stop accepting void* inputs in constructors and methods. While
     this is convenient, it's also dangerous since any pointer type
     will implicitly convert to void*.

R=tommi@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#9121}
This commit is contained in:
Karl Wiberg
2015-04-30 14:25:03 +02:00
parent ff019b0b55
commit 9e1a6d7c23
4 changed files with 18 additions and 33 deletions

View File

@ -82,7 +82,7 @@ class LoopbackTransportTest : public webrtc::Transport {
packets_sent_++;
rtc::Buffer* buffer =
new rtc::Buffer(reinterpret_cast<const uint8_t*>(data), len);
last_sent_packet_ = buffer->data<uint8_t>();
last_sent_packet_ = buffer->data();
last_sent_packet_len_ = len;
total_bytes_sent_ += len;
sent_packets_.push_back(buffer);