From 09b056975dacd1f0f815ad820b6dc9913b0118a3 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 23 Jun 2020 18:55:43 -0400 Subject: fix pointer style to match the style guide We do this in a lot of places, but we're inconsistent. Normalize the code to the Google C++ style guide. Change-Id: Ic2aceab661ce8f6b993dda21b1cdf5d2198dcbbf Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2262932 Reviewed-by: Sterling Augustine Reviewed-by: Mark Mentovai --- src/common/string_conversion.cc | 58 ++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'src/common/string_conversion.cc') diff --git a/src/common/string_conversion.cc b/src/common/string_conversion.cc index 11d60a36..6a78ed7e 100644 --- a/src/common/string_conversion.cc +++ b/src/common/string_conversion.cc @@ -38,15 +38,15 @@ namespace google_breakpad { using std::vector; -void UTF8ToUTF16(const char *in, vector *out) { +void UTF8ToUTF16(const char* in, vector* out) { size_t source_length = strlen(in); - const UTF8 *source_ptr = reinterpret_cast(in); - const UTF8 *source_end_ptr = source_ptr + source_length; + const UTF8* source_ptr = reinterpret_cast(in); + const UTF8* source_end_ptr = source_ptr + source_length; // Erase the contents and zero fill to the expected size out->clear(); out->insert(out->begin(), source_length, 0); - uint16_t *target_ptr = &(*out)[0]; - uint16_t *target_end_ptr = target_ptr + out->capacity(); + uint16_t* target_ptr = &(*out)[0]; + uint16_t* target_end_ptr = target_ptr + out->capacity(); ConversionResult result = ConvertUTF8toUTF16(&source_ptr, source_end_ptr, &target_ptr, target_end_ptr, strictConversion); @@ -55,11 +55,11 @@ void UTF8ToUTF16(const char *in, vector *out) { out->resize(result == conversionOK ? target_ptr - &(*out)[0] + 1: 0); } -int UTF8ToUTF16Char(const char *in, int in_length, uint16_t out[2]) { - const UTF8 *source_ptr = reinterpret_cast(in); - const UTF8 *source_end_ptr = source_ptr + 1; - uint16_t *target_ptr = out; - uint16_t *target_end_ptr = target_ptr + 2; +int UTF8ToUTF16Char(const char* in, int in_length, uint16_t out[2]) { + const UTF8* source_ptr = reinterpret_cast(in); + const UTF8* source_end_ptr = source_ptr + 1; + uint16_t* target_ptr = out; + uint16_t* target_end_ptr = target_ptr + 2; out[0] = out[1] = 0; // Process one character at a time @@ -69,28 +69,28 @@ int UTF8ToUTF16Char(const char *in, int in_length, uint16_t out[2]) { strictConversion); if (result == conversionOK) - return static_cast(source_ptr - reinterpret_cast(in)); + return static_cast(source_ptr - reinterpret_cast(in)); // Add another character to the input stream and try again - source_ptr = reinterpret_cast(in); + source_ptr = reinterpret_cast(in); ++source_end_ptr; - if (source_end_ptr > reinterpret_cast(in) + in_length) + if (source_end_ptr > reinterpret_cast(in) + in_length) break; } return 0; } -void UTF32ToUTF16(const wchar_t *in, vector *out) { +void UTF32ToUTF16(const wchar_t* in, vector* out) { size_t source_length = wcslen(in); - const UTF32 *source_ptr = reinterpret_cast(in); - const UTF32 *source_end_ptr = source_ptr + source_length; + const UTF32* source_ptr = reinterpret_cast(in); + const UTF32* source_end_ptr = source_ptr + source_length; // Erase the contents and zero fill to the expected size out->clear(); out->insert(out->begin(), source_length, 0); - uint16_t *target_ptr = &(*out)[0]; - uint16_t *target_end_ptr = target_ptr + out->capacity(); + uint16_t* target_ptr = &(*out)[0]; + uint16_t* target_end_ptr = target_ptr + out->capacity(); ConversionResult result = ConvertUTF32toUTF16(&source_ptr, source_end_ptr, &target_ptr, target_end_ptr, strictConversion); @@ -100,10 +100,10 @@ void UTF32ToUTF16(const wchar_t *in, vector *out) { } void UTF32ToUTF16Char(wchar_t in, uint16_t out[2]) { - const UTF32 *source_ptr = reinterpret_cast(&in); - const UTF32 *source_end_ptr = source_ptr + 1; - uint16_t *target_ptr = out; - uint16_t *target_end_ptr = target_ptr + 2; + const UTF32* source_ptr = reinterpret_cast(&in); + const UTF32* source_end_ptr = source_ptr + 1; + uint16_t* target_ptr = out; + uint16_t* target_end_ptr = target_ptr + 2; out[0] = out[1] = 0; ConversionResult result = ConvertUTF32toUTF16(&source_ptr, source_end_ptr, &target_ptr, target_end_ptr, @@ -118,15 +118,15 @@ static inline uint16_t Swap(uint16_t value) { return (value >> 8) | static_cast(value << 8); } -string UTF16ToUTF8(const vector &in, bool swap) { - const UTF16 *source_ptr = &in[0]; +string UTF16ToUTF8(const vector& in, bool swap) { + const UTF16* source_ptr = &in[0]; scoped_array source_buffer; // If we're to swap, we need to make a local copy and swap each byte pair if (swap) { int idx = 0; source_buffer.reset(new uint16_t[in.size()]); - UTF16 *source_buffer_ptr = source_buffer.get(); + UTF16* source_buffer_ptr = source_buffer.get(); for (vector::const_iterator it = in.begin(); it != in.end(); ++it, ++idx) source_buffer_ptr[idx] = Swap(*it); @@ -135,17 +135,17 @@ string UTF16ToUTF8(const vector &in, bool swap) { } // The maximum expansion would be 4x the size of the input string. - const UTF16 *source_end_ptr = source_ptr + in.size(); + const UTF16* source_end_ptr = source_ptr + in.size(); size_t target_capacity = in.size() * 4; scoped_array target_buffer(new UTF8[target_capacity]); - UTF8 *target_ptr = target_buffer.get(); - UTF8 *target_end_ptr = target_ptr + target_capacity; + UTF8* target_ptr = target_buffer.get(); + UTF8* target_end_ptr = target_ptr + target_capacity; ConversionResult result = ConvertUTF16toUTF8(&source_ptr, source_end_ptr, &target_ptr, target_end_ptr, strictConversion); if (result == conversionOK) { - const char *targetPtr = reinterpret_cast(target_buffer.get()); + const char* targetPtr = reinterpret_cast(target_buffer.get()); return targetPtr; } -- cgit v1.2.1