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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 } | 234 } |
235 } | 235 } |
236 | 236 |
237 void AddHexEncodedToBuffer(uint8_t octet, List<uint8_t>* buffer) { | 237 void AddHexEncodedToBuffer(uint8_t octet, List<uint8_t>* buffer) { |
238 buffer->Add('%'); | 238 buffer->Add('%'); |
239 buffer->Add(HexCharOfValue(octet >> 4)); | 239 buffer->Add(HexCharOfValue(octet >> 4)); |
240 buffer->Add(HexCharOfValue(octet & 0x0F)); | 240 buffer->Add(HexCharOfValue(octet & 0x0F)); |
241 } | 241 } |
242 | 242 |
243 void EncodeSingle(uc16 c, List<uint8_t>* buffer) { | 243 void EncodeSingle(uc16 c, List<uint8_t>* buffer) { |
244 char s[4]; | 244 char s[4] = {}; |
245 int number_of_bytes; | 245 int number_of_bytes; |
246 number_of_bytes = | 246 number_of_bytes = |
247 unibrow::Utf8::Encode(s, c, unibrow::Utf16::kNoPreviousCharacter, false); | 247 unibrow::Utf8::Encode(s, c, unibrow::Utf16::kNoPreviousCharacter, false); |
248 for (int k = 0; k < number_of_bytes; k++) { | 248 for (int k = 0; k < number_of_bytes; k++) { |
249 AddHexEncodedToBuffer(s[k], buffer); | 249 AddHexEncodedToBuffer(s[k], buffer); |
250 } | 250 } |
251 } | 251 } |
252 | 252 |
253 void EncodePair(uc16 cc1, uc16 cc2, List<uint8_t>* buffer) { | 253 void EncodePair(uc16 cc1, uc16 cc2, List<uint8_t>* buffer) { |
254 char s[4]; | 254 char s[4]; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 AllowHeapAllocation allocate_error_and_return; | 296 AllowHeapAllocation allocate_error_and_return; |
297 THROW_NEW_ERROR(isolate, NewURIError(), String); | 297 THROW_NEW_ERROR(isolate, NewURIError(), String); |
298 } | 298 } |
299 } | 299 } |
300 | 300 |
301 return isolate->factory()->NewStringFromOneByte(buffer.ToConstVector()); | 301 return isolate->factory()->NewStringFromOneByte(buffer.ToConstVector()); |
302 } | 302 } |
303 | 303 |
304 } // namespace internal | 304 } // namespace internal |
305 } // namespace v8 | 305 } // namespace v8 |
OLD | NEW |