Crashpad
Static Public Member Functions | List of all members
crashpad::internal::MinidumpWriterUtil Class Referencefinal

A collection of utility functions used by the MinidumpWritable family of classes. More...

#include "minidump/minidump_writer_util.h"

Static Public Member Functions

static void AssignTimeT (uint32_t *destination, time_t source)
 Assigns a time_t value, logging a warning if the result overflows the destination buffer and will be truncated. More...
 
static base::string16 ConvertUTF8ToUTF16 (const std::string &utf8)
 Converts a UTF-8 string to UTF-16 and returns it. If the string cannot be converted losslessly, indicating that the input is not well-formed UTF-8, a warning is logged. More...
 
static void AssignUTF8ToUTF16 (base::char16 *destination, size_t destination_size, const std::string &source)
 Converts a UTF-8 string to UTF-16 and places it into a buffer of fixed size, taking care to NUL-terminate the buffer and not to overflow it. If the string will be truncated or if it cannot be converted losslessly, a warning is logged. More...
 

Detailed Description

A collection of utility functions used by the MinidumpWritable family of classes.

Member Function Documentation

◆ AssignTimeT()

void crashpad::internal::MinidumpWriterUtil::AssignTimeT ( uint32_t *  destination,
time_t  source 
)
static

Assigns a time_t value, logging a warning if the result overflows the destination buffer and will be truncated.

Parameters
[out]destinationA pointer to the variable to be assigned to.
[in]sourceThe value to assign.

The minidump format uses uint32_t for many timestamp values, but time_t may be wider than this. These year 2038 bugs are a limitation of the minidump format. An out-of-range error will be noted with a warning, but is not considered fatal. source will be truncated and assigned to destination in this case.

For time_t values with nonfatal overflow semantics, this function is used in preference to AssignIfInRange(), which fails without performing an assignment when an out-of-range condition is detected.

◆ AssignUTF8ToUTF16()

void crashpad::internal::MinidumpWriterUtil::AssignUTF8ToUTF16 ( base::char16 *  destination,
size_t  destination_size,
const std::string &  source 
)
static

Converts a UTF-8 string to UTF-16 and places it into a buffer of fixed size, taking care to NUL-terminate the buffer and not to overflow it. If the string will be truncated or if it cannot be converted losslessly, a warning is logged.

Any unused portion of the destination buffer that is not written to by the converted string will be overwritten with NUL UTF-16 code units, thus, this function always writes destination_size char16 units.

If the conversion is lossy, U+FFFD “replacement characters” will be introduced.

Parameters
[out]destinationA pointer to the destination buffer, where the UTF-16-encoded string will be written.
[in]destination_sizeThe size of destination in char16 units, including space used by a NUL terminator.
[in]sourceThe UTF-8-encoded input string.

◆ ConvertUTF8ToUTF16()

base::string16 crashpad::internal::MinidumpWriterUtil::ConvertUTF8ToUTF16 ( const std::string &  utf8)
static

Converts a UTF-8 string to UTF-16 and returns it. If the string cannot be converted losslessly, indicating that the input is not well-formed UTF-8, a warning is logged.

Parameters
[in]utf8The UTF-8-encoded string to convert.
Returns
The utf8 string, converted to UTF-16 encoding. If the conversion is lossy, U+FFFD “replacement characters” will be introduced.

The documentation for this class was generated from the following files: