| OLD | NEW |
| 1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 //! \brief Converts a UTF-8 string to UTF-16 and returns it. If the string | 51 //! \brief Converts a UTF-8 string to UTF-16 and returns it. If the string |
| 52 //! cannot be converted losslessly, indicating that the input is not | 52 //! cannot be converted losslessly, indicating that the input is not |
| 53 //! well-formed UTF-8, a warning is logged. | 53 //! well-formed UTF-8, a warning is logged. |
| 54 //! | 54 //! |
| 55 //! \param[in] utf8 The UTF-8-encoded string to convert. | 55 //! \param[in] utf8 The UTF-8-encoded string to convert. |
| 56 //! | 56 //! |
| 57 //! \return The \a utf8 string, converted to UTF-16 encoding. If the | 57 //! \return The \a utf8 string, converted to UTF-16 encoding. If the |
| 58 //! conversion is lossy, U+FFFD “replacement characters” will be | 58 //! conversion is lossy, U+FFFD “replacement characters” will be |
| 59 //! introduced. | 59 //! introduced. |
| 60 static string16 ConvertUTF8ToUTF16(const std::string& utf8); | 60 static base::string16 ConvertUTF8ToUTF16(const std::string& utf8); |
| 61 | 61 |
| 62 //! \brief Converts a UTF-8 string to UTF-16 and places it into a buffer of | 62 //! \brief Converts a UTF-8 string to UTF-16 and places it into a buffer of |
| 63 //! fixed size, taking care to `NUL`-terminate the buffer and not to | 63 //! fixed size, taking care to `NUL`-terminate the buffer and not to |
| 64 //! overflow it. If the string will be truncated or if it cannot be | 64 //! overflow it. If the string will be truncated or if it cannot be |
| 65 //! converted losslessly, a warning is logged. | 65 //! converted losslessly, a warning is logged. |
| 66 //! | 66 //! |
| 67 //! Any unused portion of the \a destination buffer that is not written to by | 67 //! Any unused portion of the \a destination buffer that is not written to by |
| 68 //! the converted string will be overwritten with `NUL` UTF-16 code units, | 68 //! the converted string will be overwritten with `NUL` UTF-16 code units, |
| 69 //! thus, this function always writes \a destination_size `char16` units. | 69 //! thus, this function always writes \a destination_size `char16` units. |
| 70 //! | 70 //! |
| 71 //! If the conversion is lossy, U+FFFD “replacement characters” will be | 71 //! If the conversion is lossy, U+FFFD “replacement characters” will be |
| 72 //! introduced. | 72 //! introduced. |
| 73 //! | 73 //! |
| 74 //! \param[out] destination A pointer to the destination buffer, where the | 74 //! \param[out] destination A pointer to the destination buffer, where the |
| 75 //! UTF-16-encoded string will be written. | 75 //! UTF-16-encoded string will be written. |
| 76 //! \param[in] destination_size The size of \a destination in `char16` units, | 76 //! \param[in] destination_size The size of \a destination in `char16` units, |
| 77 //! including space used by a `NUL` terminator. | 77 //! including space used by a `NUL` terminator. |
| 78 //! \param[in] source The UTF-8-encoded input string. | 78 //! \param[in] source The UTF-8-encoded input string. |
| 79 static void AssignUTF8ToUTF16(char16* destination, | 79 static void AssignUTF8ToUTF16(base::char16* destination, |
| 80 size_t destination_size, | 80 size_t destination_size, |
| 81 const std::string& source); | 81 const std::string& source); |
| 82 | 82 |
| 83 private: | 83 private: |
| 84 DISALLOW_IMPLICIT_CONSTRUCTORS(MinidumpWriterUtil); | 84 DISALLOW_IMPLICIT_CONSTRUCTORS(MinidumpWriterUtil); |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 } // namespace internal | 87 } // namespace internal |
| 88 } // namespace crashpad | 88 } // namespace crashpad |
| 89 | 89 |
| 90 #endif // CRASHPAD_MINIDUMP_MINIDUMP_WRITER_UTIL_H_ | 90 #endif // CRASHPAD_MINIDUMP_MINIDUMP_WRITER_UTIL_H_ |
| OLD | NEW |