| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/uri.h" | 5 #include "src/uri.h" |
| 6 | 6 |
| 7 #include "src/char-predicates-inl.h" | 7 #include "src/char-predicates-inl.h" |
| 8 #include "src/handles.h" | 8 #include "src/handles.h" |
| 9 #include "src/isolate-inl.h" | 9 #include "src/isolate-inl.h" |
| 10 #include "src/list.h" | 10 #include "src/list.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 } | 44 } |
| 45 | 45 |
| 46 bool DecodeOctets(const uint8_t* octets, int length, List<uc16>* buffer) { | 46 bool DecodeOctets(const uint8_t* octets, int length, List<uc16>* buffer) { |
| 47 size_t cursor = 0; | 47 size_t cursor = 0; |
| 48 uc32 value = unibrow::Utf8::ValueOf(octets, length, &cursor); | 48 uc32 value = unibrow::Utf8::ValueOf(octets, length, &cursor); |
| 49 if (value == unibrow::Utf8::kBadChar && | 49 if (value == unibrow::Utf8::kBadChar && |
| 50 !IsReplacementCharacter(octets, length)) { | 50 !IsReplacementCharacter(octets, length)) { |
| 51 return false; | 51 return false; |
| 52 } | 52 } |
| 53 | 53 |
| 54 if (value <= unibrow::Utf16::kMaxNonSurrogateCharCode) { | 54 if (value <= static_cast<uc32>(unibrow::Utf16::kMaxNonSurrogateCharCode)) { |
| 55 buffer->Add(value); | 55 buffer->Add(value); |
| 56 } else { | 56 } else { |
| 57 buffer->Add(unibrow::Utf16::LeadSurrogate(value)); | 57 buffer->Add(unibrow::Utf16::LeadSurrogate(value)); |
| 58 buffer->Add(unibrow::Utf16::TrailSurrogate(value)); | 58 buffer->Add(unibrow::Utf16::TrailSurrogate(value)); |
| 59 } | 59 } |
| 60 return true; | 60 return true; |
| 61 } | 61 } |
| 62 | 62 |
| 63 int TwoDigitHex(uc16 character1, uc16 character2) { | 63 int TwoDigitHex(uc16 character1, uc16 character2) { |
| 64 if (character1 > 'f') return -1; | 64 if (character1 > 'f') return -1; |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 MaybeHandle<String> Uri::Unescape(Isolate* isolate, Handle<String> string) { | 496 MaybeHandle<String> Uri::Unescape(Isolate* isolate, Handle<String> string) { |
| 497 Handle<String> result; | 497 Handle<String> result; |
| 498 string = String::Flatten(string); | 498 string = String::Flatten(string); |
| 499 return string->IsOneByteRepresentationUnderneath() | 499 return string->IsOneByteRepresentationUnderneath() |
| 500 ? UnescapePrivate<uint8_t>(isolate, string) | 500 ? UnescapePrivate<uint8_t>(isolate, string) |
| 501 : UnescapePrivate<uc16>(isolate, string); | 501 : UnescapePrivate<uc16>(isolate, string); |
| 502 } | 502 } |
| 503 | 503 |
| 504 } // namespace internal | 504 } // namespace internal |
| 505 } // namespace v8 | 505 } // namespace v8 |
| OLD | NEW |