Delete unused utf8 conversion utilities
And drop a few unneeded includes of rtc_base/stringencode.h. Bug: webrtc:6424 Change-Id: I8be92a2ca199afaae1d3a177c23acbf2b9bdc465 Reviewed-on: https://webrtc-review.googlesource.com/c/105002 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25125}
This commit is contained in:
parent
e8038e9aab
commit
26968bafc2
@ -38,7 +38,6 @@
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/race_checker.h"
|
||||
#include "rtc_base/stringencode.h"
|
||||
#include "rtc_base/strings/audio_format_to_string.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "rtc_base/stringutils.h"
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
#include "p2p/base/icetransportinternal.h"
|
||||
#include "p2p/base/packettransportinternal.h"
|
||||
#include "rtc_base/sslstreamadapter.h"
|
||||
#include "rtc_base/stringencode.h"
|
||||
|
||||
namespace cricket {
|
||||
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
#include "p2p/base/packettransportinternal.h"
|
||||
#include "p2p/base/port.h"
|
||||
#include "p2p/base/transportdescription.h"
|
||||
#include "rtc_base/stringencode.h"
|
||||
|
||||
namespace cricket {
|
||||
|
||||
|
||||
@ -22,7 +22,6 @@
|
||||
#include "rtc_base/crc32.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/messagedigest.h"
|
||||
#include "rtc_base/stringencode.h"
|
||||
|
||||
using rtc::ByteBufferReader;
|
||||
using rtc::ByteBufferWriter;
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/stringencode.h"
|
||||
#include "rtc_base/timeutils.h" // For TimeMillis
|
||||
|
||||
namespace cricket {
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/nethelpers.h"
|
||||
#include "rtc_base/socketaddress.h"
|
||||
#include "rtc_base/stringencode.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
|
||||
namespace cricket {
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/messagedigest.h"
|
||||
#include "rtc_base/socketadapters.h"
|
||||
#include "rtc_base/stringencode.h"
|
||||
#include "rtc_base/strings/string_builder.h"
|
||||
#include "rtc_base/thread.h"
|
||||
|
||||
|
||||
@ -14,7 +14,6 @@
|
||||
|
||||
#include "absl/memory/memory.h"
|
||||
#include "pc/webrtcsdp.h"
|
||||
#include "rtc_base/stringencode.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
#include "pc/mediasession.h"
|
||||
#include "pc/webrtcsdp.h"
|
||||
#include "rtc_base/arraysize.h"
|
||||
#include "rtc_base/stringencode.h"
|
||||
|
||||
using cricket::SessionDescription;
|
||||
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
|
||||
#include "rtc_base/gunit.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/stringencode.h"
|
||||
#include "rtc_base/stringutils.h"
|
||||
|
||||
#ifdef WEBRTC_ANDROID
|
||||
|
||||
@ -19,7 +19,6 @@
|
||||
#include "rtc_base/byteorder.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/stringencode.h"
|
||||
#include "rtc_base/third_party/base64/base64.h"
|
||||
#include "rtc_base/timeutils.h"
|
||||
#include "rtc_base/zero_memory.h"
|
||||
|
||||
@ -14,7 +14,6 @@
|
||||
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/stream.h"
|
||||
#include "rtc_base/stringencode.h"
|
||||
|
||||
namespace rtc {
|
||||
|
||||
|
||||
@ -48,67 +48,6 @@ size_t url_decode(char* buffer,
|
||||
return bufpos;
|
||||
}
|
||||
|
||||
size_t utf8_decode(const char* source, size_t srclen, unsigned long* value) {
|
||||
const unsigned char* s = reinterpret_cast<const unsigned char*>(source);
|
||||
if ((s[0] & 0x80) == 0x00) { // Check s[0] == 0xxxxxxx
|
||||
*value = s[0];
|
||||
return 1;
|
||||
}
|
||||
if ((srclen < 2) || ((s[1] & 0xC0) != 0x80)) { // Check s[1] != 10xxxxxx
|
||||
return 0;
|
||||
}
|
||||
// Accumulate the trailer byte values in value16, and combine it with the
|
||||
// relevant bits from s[0], once we've determined the sequence length.
|
||||
unsigned long value16 = (s[1] & 0x3F);
|
||||
if ((s[0] & 0xE0) == 0xC0) { // Check s[0] == 110xxxxx
|
||||
*value = ((s[0] & 0x1F) << 6) | value16;
|
||||
return 2;
|
||||
}
|
||||
if ((srclen < 3) || ((s[2] & 0xC0) != 0x80)) { // Check s[2] != 10xxxxxx
|
||||
return 0;
|
||||
}
|
||||
value16 = (value16 << 6) | (s[2] & 0x3F);
|
||||
if ((s[0] & 0xF0) == 0xE0) { // Check s[0] == 1110xxxx
|
||||
*value = ((s[0] & 0x0F) << 12) | value16;
|
||||
return 3;
|
||||
}
|
||||
if ((srclen < 4) || ((s[3] & 0xC0) != 0x80)) { // Check s[3] != 10xxxxxx
|
||||
return 0;
|
||||
}
|
||||
value16 = (value16 << 6) | (s[3] & 0x3F);
|
||||
if ((s[0] & 0xF8) == 0xF0) { // Check s[0] == 11110xxx
|
||||
*value = ((s[0] & 0x07) << 18) | value16;
|
||||
return 4;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t utf8_encode(char* buffer, size_t buflen, unsigned long value) {
|
||||
if ((value <= 0x7F) && (buflen >= 1)) {
|
||||
buffer[0] = static_cast<unsigned char>(value);
|
||||
return 1;
|
||||
}
|
||||
if ((value <= 0x7FF) && (buflen >= 2)) {
|
||||
buffer[0] = 0xC0 | static_cast<unsigned char>(value >> 6);
|
||||
buffer[1] = 0x80 | static_cast<unsigned char>(value & 0x3F);
|
||||
return 2;
|
||||
}
|
||||
if ((value <= 0xFFFF) && (buflen >= 3)) {
|
||||
buffer[0] = 0xE0 | static_cast<unsigned char>(value >> 12);
|
||||
buffer[1] = 0x80 | static_cast<unsigned char>((value >> 6) & 0x3F);
|
||||
buffer[2] = 0x80 | static_cast<unsigned char>(value & 0x3F);
|
||||
return 3;
|
||||
}
|
||||
if ((value <= 0x1FFFFF) && (buflen >= 4)) {
|
||||
buffer[0] = 0xF0 | static_cast<unsigned char>(value >> 18);
|
||||
buffer[1] = 0x80 | static_cast<unsigned char>((value >> 12) & 0x3F);
|
||||
buffer[2] = 0x80 | static_cast<unsigned char>((value >> 6) & 0x3F);
|
||||
buffer[3] = 0x80 | static_cast<unsigned char>(value & 0x3F);
|
||||
return 4;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char HEX[] = "0123456789abcdef";
|
||||
|
||||
char hex_encode(unsigned char val) {
|
||||
|
||||
@ -12,7 +12,6 @@
|
||||
|
||||
#include "rtc_base/flags.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/stringencode.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
#include "test/field_trial.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
@ -12,7 +12,6 @@
|
||||
|
||||
#include "rtc_base/flags.h"
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/stringencode.h"
|
||||
#include "system_wrappers/include/field_trial.h"
|
||||
#include "test/field_trial.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user