Commit 5c3e8715 authored by Andreas Haas's avatar Andreas Haas Committed by Commit Bot

[encoding] Replace uses of deprecatedLengthAsUnsigned

The ArrayBuffer is the destination here, so, it the destination is
bigger than expected until now, it should not be a problem.

R=haraken@chromium.org

Bug: chromium:1008840
Change-Id: I36cc5d708411c586665a9c498ff4fe624efee610
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1975879Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarAdam Rice <ricea@chromium.org>
Commit-Queue: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#733601}
parent 7ca3cae8
......@@ -92,11 +92,11 @@ TextEncoderEncodeIntoResult* TextEncoder::encodeInto(
if (source.Is8Bit()) {
encode_into_result_data = codec_->EncodeInto(
source.Characters8(), source.length(), destination_buffer,
destination.View()->deprecatedLengthAsUnsigned());
destination.View()->lengthAsSizeT());
} else {
encode_into_result_data = codec_->EncodeInto(
source.Characters16(), source.length(), destination_buffer,
destination.View()->deprecatedLengthAsUnsigned());
destination.View()->lengthAsSizeT());
}
encode_into_result->setRead(encode_into_result_data.code_units_read);
......
......@@ -82,7 +82,7 @@ class WTF_EXPORT TextCodec {
struct EncodeIntoResult {
wtf_size_t code_units_read;
wtf_size_t bytes_written;
size_t bytes_written;
};
String Decode(const char* str,
......@@ -108,14 +108,14 @@ class WTF_EXPORT TextCodec {
virtual EncodeIntoResult EncodeInto(const LChar*,
wtf_size_t length,
unsigned char* destination,
wtf_size_t capacity) {
size_t capacity) {
NOTREACHED();
return EncodeIntoResult{0, 0};
}
virtual EncodeIntoResult EncodeInto(const UChar*,
wtf_size_t length,
unsigned char* destination,
wtf_size_t capacity) {
size_t capacity) {
NOTREACHED();
return EncodeIntoResult{0, 0};
}
......
......@@ -497,7 +497,7 @@ TextCodec::EncodeIntoResult TextCodecUTF8::EncodeIntoCommon(
const CharType* characters,
wtf_size_t length,
unsigned char* destination,
wtf_size_t capacity) {
size_t capacity) {
TextCodec::EncodeIntoResult encode_into_result{0, 0};
wtf_size_t i = 0;
......@@ -544,7 +544,7 @@ TextCodec::EncodeIntoResult TextCodecUTF8::EncodeInto(
const UChar* characters,
wtf_size_t length,
unsigned char* destination,
wtf_size_t capacity) {
size_t capacity) {
return EncodeIntoCommon(characters, length, destination, capacity);
}
......@@ -552,7 +552,7 @@ TextCodec::EncodeIntoResult TextCodecUTF8::EncodeInto(
const LChar* characters,
wtf_size_t length,
unsigned char* destination,
wtf_size_t capacity) {
size_t capacity) {
return EncodeIntoCommon(characters, length, destination, capacity);
}
......
......@@ -62,11 +62,11 @@ class TextCodecUTF8 : public TextCodec {
EncodeIntoResult EncodeInto(const UChar*,
wtf_size_t length,
unsigned char* destination,
wtf_size_t capacity) override;
size_t capacity) override;
EncodeIntoResult EncodeInto(const LChar*,
wtf_size_t length,
unsigned char* destination,
wtf_size_t capacity) override;
size_t capacity) override;
template <typename CharType>
std::string EncodeCommon(const CharType* characters, wtf_size_t length);
......@@ -74,7 +74,7 @@ class TextCodecUTF8 : public TextCodec {
EncodeIntoResult EncodeIntoCommon(const CharType* characters,
wtf_size_t length,
unsigned char* destination,
wtf_size_t capacity);
size_t capacity);
template <typename CharType>
bool HandlePartialSequence(CharType*& destination,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment