Blender  V3.3
Functions
#include "utfconv.h"

Go to the source code of this file.

Functions

size_t count_utf_8_from_16 (const wchar_t *string16)
 
size_t count_utf_16_from_8 (const char *string8)
 
int conv_utf_16_to_8 (const wchar_t *in16, char *out8, size_t size8)
 
int conv_utf_8_to_16 (const char *in8, wchar_t *out16, size_t size16)
 
char * alloc_utf_8_from_16 (const wchar_t *in16, size_t add)
 
wchar_t * alloc_utf16_from_8 (const char *in8, size_t add)
 

Function Documentation

◆ alloc_utf16_from_8()

wchar_t* alloc_utf16_from_8 ( const char *  in8,
size_t  add 
)

Allocates and converts the utf-16 string from utf-8

Parameters
in8utf-8 string to convert
addany additional size which will be allocated for new utf-16 string in wchar_t (two bytes)
Returns
New allocated and converted utf-16 string or NULL if in8 is 0.

Definition at line 291 of file utfconv.c.

References blender::bke::attribute_accessor_functions::add(), conv_utf_8_to_16(), count_utf_16_from_8(), and NULL.

Referenced by BLI_exists(), BLI_getenv(), GHOST_WindowWin32::GHOST_WindowWin32(), IFileStream::IFileStream(), imb_save_dds(), imb_savetiff(), OFileStream::OFileStream(), GHOST_WindowWin32::setTitle(), and GHOST_SystemWin32::showMessageBox().

◆ alloc_utf_8_from_16()

char* alloc_utf_8_from_16 ( const wchar_t *  in16,
size_t  add 
)

Allocates and converts the utf-8 string from utf-16

Parameters
in16utf-16 string to convert
addany additional size which will be allocated for new utf-8 string in bytes
Returns
New allocated and converted utf-8 string or NULL if in16 is 0.

Definition at line 279 of file utfconv.c.

References blender::bke::attribute_accessor_functions::add(), conv_utf_16_to_8(), count_utf_8_from_16(), and NULL.

Referenced by BLI_getenv(), GHOST_SystemWin32::getClipboard(), main(), and u_alloc_getenv().

◆ conv_utf_16_to_8()

int conv_utf_16_to_8 ( const wchar_t *  in16,
char *  out8,
size_t  size8 
)

Converts utf-16 string to allocated utf-8 string

Parameters
in16utf-16 string to convert
out8utf-8 string to string the conversion
size8the allocated size in bytes of out8
Returns
Returns any errors occurred during conversion. See the block above,

Definition at line 115 of file utfconv.c.

References err, u2, UTF_ERROR_ILLCHAR, UTF_ERROR_NULL_IN, and UTF_ERROR_SMALL.

Referenced by alloc_utf_8_from_16(), BLI_file_alias_target(), get_thumb_dir(), GHOST_SystemPathsWin32::getBinaryDir(), GHOST_SystemPathsWin32::getSystemDir(), GHOST_WindowWin32::getTitle(), GHOST_SystemPathsWin32::getUserDir(), GHOST_SystemPathsWin32::getUserSpecialDir(), GHOST_SystemWin32::processKeyEvent(), uput_getenv(), and where_am_i().

◆ conv_utf_8_to_16()

int conv_utf_8_to_16 ( const char *  in8,
wchar_t *  out16,
size_t  size16 
)

Converts utf-8 string to allocated utf-16 string

Parameters
in8utf-8 string to convert
out16utf-16 string to string the conversion
size16the allocated size in wchar_t (two byte) of out16
Returns
Returns any errors occurred during conversion. See the block above,

Definition at line 181 of file utfconv.c.

References err, type, UTF_ERROR_ILLCHAR, UTF_ERROR_ILLSEQ, UTF_ERROR_NULL_IN, and UTF_ERROR_SMALL.

Referenced by alloc_utf16_from_8(), BLI_file_alias_target(), BLI_file_attributes(), BLI_strncpy_wchar_from_utf8(), and GHOST_SystemWin32::putClipboard().

◆ count_utf_16_from_8()

size_t count_utf_16_from_8 ( const char *  string8)

Counts how many wchar_t (two byte) is required for future utf-16 string using utf-8

Parameters
string8pointer to working utf-8 string
Returns
How many bytes must be allocated including NULL.

Definition at line 57 of file utfconv.c.

References count, and type.

Referenced by alloc_utf16_from_8(), and GHOST_SystemWin32::putClipboard().

◆ count_utf_8_from_16()

size_t count_utf_8_from_16 ( const wchar_t *  string16)

Counts how many bytes is required for future utf-8 string using utf-16

Parameters
string16pointer to working utf-16 string
Returns
How many bytes must be allocated including NULL.

Definition at line 10 of file utfconv.c.

References count.

Referenced by alloc_utf_8_from_16(), and GHOST_WindowWin32::getTitle().