UNSAFE_BUFFER_USAGE BASE_EXPORT bool ReadUnicodeCharacter(Add a comment marking this as deprecated and suggest that people should migrate to the safe span versions?
template void PrepareForUTF8Output(std::basic_string_view<wchar_t>,
std::string*);
#endif
template void PrepareForUTF8Output(std::basic_string_view<char16_t>,There are using statements for these
I think std::u16string_view and std::wstring_view
you only need base_string_view if you yourself have a template.
base::ReadUnicodeCharacter(std::u16string_view(text.c_str(), text.size() + 1),Can we just use base::cstring_view (and the associated other types: https://source.chromium.org/chromium/chromium/src/+/main:base/strings/cstring_view.h;l=515-540;drc=a0655c229239abdb783bd381987b54add9e3b779)
if (!base::ReadUnicodeCharacter(std::u16_string_view(c_str, size), &i,| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
UNSAFE_BUFFER_USAGE BASE_EXPORT bool ReadUnicodeCharacter(Add a comment marking this as deprecated and suggest that people should migrate to the safe span versions?
Done
template void PrepareForUTF8Output(std::basic_string_view<wchar_t>,
std::string*);
#endif
template void PrepareForUTF8Output(std::basic_string_view<char16_t>,There are using statements for these
I think std::u16string_view and std::wstring_view
you only need base_string_view if you yourself have a template.
Done
base::ReadUnicodeCharacter(std::u16string_view(text.c_str(), text.size() + 1),Can we just use base::cstring_view (and the associated other types: https://source.chromium.org/chromium/chromium/src/+/main:base/strings/cstring_view.h;l=515-540;drc=a0655c229239abdb783bd381987b54add9e3b779)
Made a quick check and seems like base::u16cstring_view doesn't include the null terminator in its length.
```
auto test_str = base::u16cstring_view(text);
CHECK_EQ(test_str.size(), text.size() + 1);
```
And that crashed!
if (!base::ReadUnicodeCharacter(std::u16_string_view(c_str, size), &i,Can we use AsStringPiece16: https://source.chromium.org/chromium/chromium/src/+/main:base/strings/string_util_win.h;l=110;drc=35b7499d1941df1fceb8d1eb2efb32346a903df5
I think we can't because `AsStringPiece16` uses all the size of the string.
And in this function we want to truncate the string to a given size.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
if (UTF8ToUTF16WithAdjustments(unescaped_url,
&result, adjustments)) {This can fit on a single line. `git cl format` should do it automatically.
if (!ReadUnicodeCharacter(text, &index,
&unused)) {This can fit on a single line. `git cl format` should do it automatically.
To avoid code duplication, implement one of the 2 functions below by invoking the other function.
base_icu::UChar32* code_point_out) {Early return if `*char_index >= src.size()`, similar to what the function below. I think this will avoid an potentially out-of-bounds access here https://source.chromium.org/chromium/chromium/src/+/main:base/third_party/icu/icu_utf.h;l=241;drc=cac93fac787ed4ef28e8ea6e8b6282dfeddd698c
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
if (UTF8ToUTF16WithAdjustments(unescaped_url,
&result, adjustments)) {This can fit on a single line. `git cl format` should do it automatically.
Done
if (!ReadUnicodeCharacter(text, &index,
&unused)) {This can fit on a single line. `git cl format` should do it automatically.
Done
To avoid code duplication, implement one of the 2 functions below by invoking the other function.
Done
Early return if `*char_index >= src.size()`, similar to what the function below. I think this will avoid an potentially out-of-bounds access here https://source.chromium.org/chromium/chromium/src/+/main:base/third_party/icu/icu_utf.h;l=241;drc=cac93fac787ed4ef28e8ea6e8b6282dfeddd698c
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
base_icu::UChar32 code_point;LGTM because this preserves an existing behavior, but it is very surprising to me that we include the null terminator in the range inspected by base::ReadUnicodeCharacter. Worth asking an owner whether this was intentional? If not, the code can be simplified by passing base::u16cstring_view directly.
Splitted the CL because of changes on many files. CLs:
http://crrev.com/c/7426427
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |