Crashpad
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Loading...
Searching...
No Matches
crashpad::internal::MinidumpWriterUtil Class Referencefinal

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

#include "minidump/minidump_writer_util.h"

Public Member Functions

 MinidumpWriterUtil (const MinidumpWriterUtil &)=delete
 
MinidumpWriterUtiloperator= (const MinidumpWriterUtil &)=delete
 

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.
 
static std::u16string 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.
 
static void AssignUTF8ToUTF16 (char16_t *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.
 

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 ( char16_t * 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_t 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_t units, including space used by a NUL terminator.
[in]sourceThe UTF-8-encoded input string.

◆ ConvertUTF8ToUTF16()

std::u16string 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: