#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "url/url_canon_internal.h"
#include <errno.h>
#include <stddef.h>
#include <stdlib.h>
#ifdef __SSE2__
#include <immintrin.h>
#elif defined(__aarch64__)
#include <arm_neon.h>
#endif
#include <cstdio>
#include <string>
#include "base/bits.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/utf_string_conversion_utils.h"
#include "url/url_features.h"
namespace url {
namespace {
size_t FindInitialQuerySafeString(const char* source, size_t length) { … }
template <typename CHAR, typename UCHAR>
void DoAppendStringOfType(const CHAR* source,
size_t length,
SharedCharTypes type,
CanonOutput* output) { … }
template <typename CHAR, typename UCHAR>
void DoAppendInvalidNarrowString(const CHAR* spec,
size_t begin,
size_t end,
CanonOutput* output) { … }
void DoOverrideComponent(const char* override_source,
const Component& override_component,
const char** dest,
Component* dest_component) { … }
bool PrepareUTF16OverrideComponent(const char16_t* override_source,
const Component& override_component,
CanonOutput* utf8_buffer,
Component* dest_component) { … }
}
const unsigned char kSharedCharTypeTable[0x100] = …;
const char kCharToHexLookup[8] = …;
const base_icu::UChar32 kUnicodeReplacementCharacter = …;
void AppendStringOfType(const char* source,
size_t length,
SharedCharTypes type,
CanonOutput* output) { … }
void AppendStringOfType(const char16_t* source,
size_t length,
SharedCharTypes type,
CanonOutput* output) { … }
bool ReadUTFCharLossy(const char* str,
size_t* begin,
size_t length,
base_icu::UChar32* code_point_out) { … }
bool ReadUTFCharLossy(const char16_t* str,
size_t* begin,
size_t length,
base_icu::UChar32* code_point_out) { … }
void AppendInvalidNarrowString(const char* spec,
size_t begin,
size_t end,
CanonOutput* output) { … }
void AppendInvalidNarrowString(const char16_t* spec,
size_t begin,
size_t end,
CanonOutput* output) { … }
bool ConvertUTF16ToUTF8(const char16_t* input,
size_t input_len,
CanonOutput* output) { … }
bool ConvertUTF8ToUTF16(const char* input,
size_t input_len,
CanonOutputT<char16_t>* output) { … }
void SetupOverrideComponents(const char* base,
const Replacements<char>& repl,
URLComponentSource<char>* source,
Parsed* parsed) { … }
bool SetupUTF16OverrideComponents(const char* base,
const Replacements<char16_t>& repl,
CanonOutput* utf8_buffer,
URLComponentSource<char>* source,
Parsed* parsed) { … }
#ifndef WIN32
int _itoa_s(int value, char* buffer, size_t size_in_chars, int radix) { … }
int _itow_s(int value, char16_t* buffer, size_t size_in_chars, int radix) { … }
#endif
}