FreeRDP
|
#include <wchar.h>
#include <stdio.h>
#include <string.h>
#include <winpr/config.h>
#include <winpr/winpr.h>
#include <winpr/wtypes.h>
Macros | |
#define | CSTR_LESS_THAN 1 |
#define | CSTR_EQUAL 2 |
#define | CSTR_GREATER_THAN 3 |
#define | CP_ACP 0 |
#define | CP_OEMCP 1 |
#define | CP_MACCP 2 |
#define | CP_THREAD_ACP 3 |
#define | CP_SYMBOL 42 |
#define | CP_UTF7 65000 |
#define | CP_UTF8 65001 |
#define | MB_PRECOMPOSED 0x00000001 |
#define | MB_COMPOSITE 0x00000002 |
#define | MB_USEGLYPHCHARS 0x00000004 |
#define | MB_ERR_INVALID_CHARS 0x00000008 |
#define | CharUpper CharUpperA |
#define | CharUpperBuff CharUpperBuffA |
#define | CharLower CharLowerA |
#define | CharLowerBuff CharLowerBuffA |
#define | IsCharAlpha IsCharAlphaA |
#define | IsCharAlphaNumeric IsCharAlphaNumericA |
#define | IsCharUpper IsCharUpperA |
#define | IsCharLower IsCharLowerA |
#define | sprintf_s snprintf |
#define | _snprintf snprintf |
#define | _scprintf(...) snprintf(NULL, 0, __VA_ARGS__) |
#define | _scprintf(...) snprintf(NULL, 0, __VA_ARGS__) |
Functions | |
WINPR_API char * | winpr_str_url_encode (const char *str, size_t len) |
WINPR_API char * | winpr_str_url_decode (const char *str, size_t len) |
WINPR_API BOOL | winpr_str_append (const char *what, char *buffer, size_t size, const char *separator) |
WINPR_API int | winpr_asprintf (char **s, size_t *slen, const char *templ,...) |
WINPR_API int | winpr_vasprintf (char **s, size_t *slen, const char *templ, va_list ap) |
WINPR_API char * | _strdup (const char *strSource) |
WINPR_API WCHAR * | _wcsdup (const WCHAR *strSource) |
WINPR_API int | _stricmp (const char *string1, const char *string2) |
WINPR_API int | _strnicmp (const char *string1, const char *string2, size_t count) |
WINPR_API int | _wcscmp (const WCHAR *string1, const WCHAR *string2) |
WINPR_API int | _wcsncmp (const WCHAR *string1, const WCHAR *string2, size_t count) |
WINPR_API size_t | _wcslen (const WCHAR *str) |
WINPR_API size_t | _wcsnlen (const WCHAR *str, size_t maxNumberOfElements) |
WINPR_API WCHAR * | _wcsstr (const WCHAR *str, const WCHAR *strSearch) |
WINPR_API WCHAR * | _wcschr (const WCHAR *str, WCHAR c) |
WINPR_API WCHAR * | _wcsrchr (const WCHAR *str, WCHAR c) |
WINPR_API char * | strtok_s (char *strToken, const char *strDelimit, char **context) |
WINPR_API WCHAR * | wcstok_s (WCHAR *strToken, const WCHAR *strDelimit, WCHAR **context) |
WINPR_API WCHAR * | _wcsncat (WCHAR *dst, const WCHAR *src, size_t sz) |
WINPR_API LPSTR | CharUpperA (LPSTR lpsz) |
WINPR_API LPWSTR | CharUpperW (LPWSTR lpsz) |
WINPR_API DWORD | CharUpperBuffA (LPSTR lpsz, DWORD cchLength) |
WINPR_API DWORD | CharUpperBuffW (LPWSTR lpsz, DWORD cchLength) |
WINPR_API LPSTR | CharLowerA (LPSTR lpsz) |
WINPR_API LPWSTR | CharLowerW (LPWSTR lpsz) |
WINPR_API DWORD | CharLowerBuffA (LPSTR lpsz, DWORD cchLength) |
WINPR_API DWORD | CharLowerBuffW (LPWSTR lpsz, DWORD cchLength) |
WINPR_API BOOL | IsCharAlphaA (CHAR ch) |
WINPR_API BOOL | IsCharAlphaW (WCHAR ch) |
WINPR_API BOOL | IsCharAlphaNumericA (CHAR ch) |
WINPR_API BOOL | IsCharAlphaNumericW (WCHAR ch) |
WINPR_API BOOL | IsCharUpperA (CHAR ch) |
WINPR_API BOOL | IsCharUpperW (WCHAR ch) |
WINPR_API BOOL | IsCharLowerA (CHAR ch) |
WINPR_API BOOL | IsCharLowerW (WCHAR ch) |
WINPR_API SSIZE_T | ConvertWCharToUtf8 (const WCHAR *wstr, char *str, size_t len) |
Converts form UTF-16 to UTF-8. More... | |
WINPR_API SSIZE_T | ConvertWCharNToUtf8 (const WCHAR *wstr, size_t wlen, char *str, size_t len) |
Converts form UTF-16 to UTF-8. More... | |
WINPR_API SSIZE_T | ConvertMszWCharNToUtf8 (const WCHAR *wstr, size_t wlen, char *str, size_t len) |
Converts multistrings form UTF-16 to UTF-8. More... | |
WINPR_API SSIZE_T | ConvertUtf8ToWChar (const char *str, WCHAR *wstr, size_t wlen) |
Converts form UTF-8 to UTF-16. More... | |
WINPR_API SSIZE_T | ConvertUtf8NToWChar (const char *str, size_t len, WCHAR *wstr, size_t wlen) |
Converts form UTF-8 to UTF-16. More... | |
WINPR_API SSIZE_T | ConvertMszUtf8NToWChar (const char *str, size_t len, WCHAR *wstr, size_t wlen) |
Converts multistrings form UTF-8 to UTF-16. More... | |
WINPR_API char * | ConvertWCharToUtf8Alloc (const WCHAR *wstr, size_t *pSize) |
Converts form UTF-16 to UTF-8, returns an allocated string. More... | |
WINPR_API char * | ConvertWCharNToUtf8Alloc (const WCHAR *wstr, size_t wlen, size_t *pSize) |
Converts form UTF-16 to UTF-8, returns an allocated string. More... | |
WINPR_API char * | ConvertMszWCharNToUtf8Alloc (const WCHAR *wstr, size_t wlen, size_t *pSize) |
Converts multistring form UTF-16 to UTF-8, returns an allocated string. More... | |
WINPR_API WCHAR * | ConvertUtf8ToWCharAlloc (const char *str, size_t *pSize) |
Converts form UTF-8 to UTF-16, returns an allocated string. More... | |
WINPR_API WCHAR * | ConvertUtf8NToWCharAlloc (const char *str, size_t len, size_t *pSize) |
Converts form UTF-8 to UTF-16, returns an allocated string. More... | |
WINPR_API WCHAR * | ConvertMszUtf8NToWCharAlloc (const char *str, size_t len, size_t *pSize) |
Converts multistring form UTF-8 to UTF-16, returns an allocated string. More... | |
WINPR_API const WCHAR * | InitializeConstWCharFromUtf8 (const char *str, WCHAR *buffer, size_t len) |
Helper function to initialize const WCHAR pointer from a Utf8 string. More... | |
WINPR_API const WCHAR * | ByteSwapUnicode (WCHAR *wstr, size_t length) |
WINPR_API size_t | ConvertLineEndingToLF (char *str, size_t size) |
WINPR_API char * | ConvertLineEndingToCRLF (const char *str, size_t *size) |
WINPR_API char * | StrSep (char **stringp, const char *delim) |
WINPR_API INT64 | GetLine (char **lineptr, size_t *size, FILE *stream) |
WINPR_API char * | strndup (const char *s, size_t n) |
#define _scprintf | ( | ... | ) | snprintf(NULL, 0, __VA_ARGS__) |
#define _scprintf | ( | ... | ) | snprintf(NULL, 0, __VA_ARGS__) |
#define _snprintf snprintf |
#define CharLower CharLowerA |
#define CharLowerBuff CharLowerBuffA |
#define CharUpper CharUpperA |
#define CharUpperBuff CharUpperBuffA |
#define CP_ACP 0 |
#define CP_MACCP 2 |
#define CP_OEMCP 1 |
#define CP_SYMBOL 42 |
#define CP_THREAD_ACP 3 |
#define CP_UTF7 65000 |
#define CP_UTF8 65001 |
#define CSTR_EQUAL 2 |
#define CSTR_GREATER_THAN 3 |
#define CSTR_LESS_THAN 1 |
#define IsCharAlpha IsCharAlphaA |
#define IsCharAlphaNumeric IsCharAlphaNumericA |
#define IsCharLower IsCharLowerA |
#define IsCharUpper IsCharUpperA |
#define MB_COMPOSITE 0x00000002 |
#define MB_ERR_INVALID_CHARS 0x00000008 |
#define MB_PRECOMPOSED 0x00000001 |
#define MB_USEGLYPHCHARS 0x00000004 |
#define sprintf_s snprintf |
WINPR_API char* _strdup | ( | const char * | strSource | ) |
WINPR_API int _stricmp | ( | const char * | string1, |
const char * | string2 | ||
) |
WINPR_API int _strnicmp | ( | const char * | string1, |
const char * | string2, | ||
size_t | count | ||
) |
WINPR_API WCHAR* _wcschr | ( | const WCHAR * | str, |
WCHAR | c | ||
) |
WINPR_API int _wcscmp | ( | const WCHAR * | string1, |
const WCHAR * | string2 | ||
) |
WINPR_API WCHAR* _wcsdup | ( | const WCHAR * | strSource | ) |
WINPR_API size_t _wcslen | ( | const WCHAR * | str | ) |
WINPR_API WCHAR* _wcsncat | ( | WCHAR * | dst, |
const WCHAR * | src, | ||
size_t | sz | ||
) |
WINPR_API int _wcsncmp | ( | const WCHAR * | string1, |
const WCHAR * | string2, | ||
size_t | count | ||
) |
WINPR_API size_t _wcsnlen | ( | const WCHAR * | str, |
size_t | maxNumberOfElements | ||
) |
WINPR_API WCHAR* _wcsrchr | ( | const WCHAR * | str, |
WCHAR | c | ||
) |
WINPR_API WCHAR* _wcsstr | ( | const WCHAR * | str, |
const WCHAR * | strSearch | ||
) |
WINPR_API const WCHAR* ByteSwapUnicode | ( | WCHAR * | wstr, |
size_t | length | ||
) |
ConvertToUnicode is a convenience wrapper for MultiByteToWideChar:
If the lpWideCharStr parameter for the converted string points to NULL or if the cchWideChar parameter is set to 0 this function will automatically allocate the required memory which is guaranteed to be null-terminated after the conversion, even if the source c string isn't.
If the cbMultiByte parameter is set to -1 the passed lpMultiByteStr must be null-terminated and the required length for the converted string will be calculated accordingly. ConvertFromUnicode is a convenience wrapper for WideCharToMultiByte:
If the lpMultiByteStr parameter for the converted string points to NULL or if the cbMultiByte parameter is set to 0 this function will automatically allocate the required memory which is guaranteed to be null-terminated after the conversion, even if the source unicode string isn't.
If the cchWideChar parameter is set to -1 the passed lpWideCharStr must be null-terminated and the required length for the converted string will be calculated accordingly. Swap Unicode byte order (UTF16LE <-> UTF16BE)
WINPR_API LPSTR CharLowerA | ( | LPSTR | lpsz | ) |
WINPR_API DWORD CharLowerBuffA | ( | LPSTR | lpsz, |
DWORD | cchLength | ||
) |
WINPR_API DWORD CharLowerBuffW | ( | LPWSTR | lpsz, |
DWORD | cchLength | ||
) |
WINPR_API LPWSTR CharLowerW | ( | LPWSTR | lpsz | ) |
WINPR_API LPSTR CharUpperA | ( | LPSTR | lpsz | ) |
WINPR_API DWORD CharUpperBuffA | ( | LPSTR | lpsz, |
DWORD | cchLength | ||
) |
WINPR_API DWORD CharUpperBuffW | ( | LPWSTR | lpsz, |
DWORD | cchLength | ||
) |
WINPR_API LPWSTR CharUpperW | ( | LPWSTR | lpsz | ) |
WINPR_API char* ConvertLineEndingToCRLF | ( | const char * | str, |
size_t * | size | ||
) |
WINPR_API size_t ConvertLineEndingToLF | ( | char * | str, |
size_t | size | ||
) |
WINPR_API SSIZE_T ConvertMszUtf8NToWChar | ( | const char * | str, |
size_t | len, | ||
WCHAR * | wstr, | ||
size_t | wlen | ||
) |
Converts multistrings form UTF-8 to UTF-16.
The function does string conversions of any input string of len characters. Any character in the buffer (incuding any '\0') is converted.
Supplying wlen = 0 will return the required size of the buffer in characters.
str | A CHAR string of len length |
len | The (buffer) length in characters of str |
wstr | A pointer to the result WCHAR string |
wlen | The length in WCHAR characters of the result buffer |
WINPR_API WCHAR* ConvertMszUtf8NToWCharAlloc | ( | const char * | str, |
size_t | len, | ||
size_t * | pSize | ||
) |
Converts multistring form UTF-8 to UTF-16, returns an allocated string.
The function does string conversions of any input string of len characters. Any character in the buffer (incuding any '\0') is converted.
str | A CHAR string of len byte length |
len | The (buffer) length in characters of str |
pSize | Ignored if NULL, otherwise receives the length of the result string in characters (including any '\0' character) |
WINPR_API SSIZE_T ConvertMszWCharNToUtf8 | ( | const WCHAR * | wstr, |
size_t | wlen, | ||
char * | str, | ||
size_t | len | ||
) |
Converts multistrings form UTF-16 to UTF-8.
The function does string conversions of any input string of wlen characters. Any character in the buffer (incuding any '\0') is converted.
Supplying len = 0 will return the required size of the buffer in characters.
wstr | A WCHAR string of wlen length |
wlen | The (buffer) length in characters of wstr |
str | A pointer to the result string |
len | The length in characters of the result buffer |
WINPR_API char* ConvertMszWCharNToUtf8Alloc | ( | const WCHAR * | wstr, |
size_t | wlen, | ||
size_t * | pSize | ||
) |
Converts multistring form UTF-16 to UTF-8, returns an allocated string.
The function does string conversions of any input string of len characters. Any character in the buffer (incuding any '\0') is converted.
wstr | A WCHAR string of len character length |
wlen | The (buffer) length in characters of str |
pSize | Ignored if NULL, otherwise receives the length of the result string in characters (including any '\0' character) |
WINPR_API SSIZE_T ConvertUtf8NToWChar | ( | const char * | str, |
size_t | len, | ||
WCHAR * | wstr, | ||
size_t | wlen | ||
) |
Converts form UTF-8 to UTF-16.
The function does string conversions of any input string of len (or less) characters until it reaches the first '\0'.
Supplying wlen = 0 will return the required size of the buffer in characters.
str | A CHAR string of len length |
len | The (buffer) length in characters of str |
wstr | A pointer to the result WCHAR string |
wlen | The length in WCHAR characters of the result buffer |
WINPR_API WCHAR* ConvertUtf8NToWCharAlloc | ( | const char * | str, |
size_t | len, | ||
size_t * | pSize | ||
) |
Converts form UTF-8 to UTF-16, returns an allocated string.
The function does string conversions of any input string of len (or less) characters until it reaches the first '\0'.
str | A CHAR string of len length |
len | The (buffer) length in characters of str |
pSize | Ignored if NULL, otherwise receives the length of the result string in characters (wcslen) |
WINPR_API SSIZE_T ConvertUtf8ToWChar | ( | const char * | str, |
WCHAR * | wstr, | ||
size_t | wlen | ||
) |
Converts form UTF-8 to UTF-16.
The function does string conversions of any '\0' terminated input string
Supplying wlen = 0 will return the required size of the buffer in characters.
str | A '\0' terminated CHAR string, may be NULL |
wstr | A pointer to the result WCHAR string |
wlen | The length in WCHAR characters of the result buffer |
WINPR_API WCHAR* ConvertUtf8ToWCharAlloc | ( | const char * | str, |
size_t * | pSize | ||
) |
Converts form UTF-8 to UTF-16, returns an allocated string.
The function does string conversions of any '\0' terminated input string
str | A '\0' terminated CHAR string, may be NULL |
pSize | Ignored if NULL, otherwise receives the length of the result string in characters (wcslen) |
WINPR_API SSIZE_T ConvertWCharNToUtf8 | ( | const WCHAR * | wstr, |
size_t | wlen, | ||
char * | str, | ||
size_t | len | ||
) |
Converts form UTF-16 to UTF-8.
The function does string conversions of any input string of wlen (or less) characters until it reaches the first '\0'.
Supplying len = 0 will return the required size of the buffer in characters.
wstr | A WCHAR string of wlen length |
wlen | The (buffer) length in characters of wstr |
str | A pointer to the result string |
len | The length in characters of the result buffer |
WINPR_API char* ConvertWCharNToUtf8Alloc | ( | const WCHAR * | wstr, |
size_t | wlen, | ||
size_t * | pSize | ||
) |
Converts form UTF-16 to UTF-8, returns an allocated string.
The function does string conversions of any input string of wlen (or less) characters until it reaches the first '\0'.
wstr | A WCHAR string of wlen length |
wlen | The (buffer) length in characters of wstr |
pSize | Ignored if NULL, otherwise receives the length of the result string in characters (strlen) |
WINPR_API SSIZE_T ConvertWCharToUtf8 | ( | const WCHAR * | wstr, |
char * | str, | ||
size_t | len | ||
) |
Converts form UTF-16 to UTF-8.
The function does string conversions of any '\0' terminated input string
Supplying len = 0 will return the required size of the buffer in characters.
wstr | A '\0' terminated WCHAR string, may be NULL |
str | A pointer to the result string |
len | The length in characters of the result buffer |
WINPR_API char* ConvertWCharToUtf8Alloc | ( | const WCHAR * | wstr, |
size_t * | pSize | ||
) |
Converts form UTF-16 to UTF-8, returns an allocated string.
The function does string conversions of any '\0' terminated input string
wstr | A '\0' terminated WCHAR string, may be NULL |
pSize | Ignored if NULL, otherwise receives the length of the result string in characters (strlen) |
WINPR_API INT64 GetLine | ( | char ** | lineptr, |
size_t * | size, | ||
FILE * | stream | ||
) |
WINPR_API const WCHAR* InitializeConstWCharFromUtf8 | ( | const char * | str, |
WCHAR * | buffer, | ||
size_t | len | ||
) |
Helper function to initialize const WCHAR pointer from a Utf8 string.
str | The Utf8 string to use for initialization |
buffer | The WCHAR buffer used to store the converted data |
len | The size of the buffer in number of WCHAR |
WINPR_API BOOL IsCharAlphaA | ( | CHAR | ch | ) |
WINPR_API BOOL IsCharAlphaNumericA | ( | CHAR | ch | ) |
WINPR_API BOOL IsCharAlphaNumericW | ( | WCHAR | ch | ) |
WINPR_API BOOL IsCharAlphaW | ( | WCHAR | ch | ) |
WINPR_API BOOL IsCharLowerA | ( | CHAR | ch | ) |
WINPR_API BOOL IsCharLowerW | ( | WCHAR | ch | ) |
WINPR_API BOOL IsCharUpperA | ( | CHAR | ch | ) |
WINPR_API BOOL IsCharUpperW | ( | WCHAR | ch | ) |
WINPR_API char* strndup | ( | const char * | s, |
size_t | n | ||
) |
WINPR_API char* StrSep | ( | char ** | stringp, |
const char * | delim | ||
) |
WINPR_API char* strtok_s | ( | char * | strToken, |
const char * | strDelimit, | ||
char ** | context | ||
) |
WINPR_API WCHAR* wcstok_s | ( | WCHAR * | strToken, |
const WCHAR * | strDelimit, | ||
WCHAR ** | context | ||
) |
WINPR_API int winpr_asprintf | ( | char ** | s, |
size_t * | slen, | ||
const char * | templ, | ||
... | |||
) |
WINPR_API BOOL winpr_str_append | ( | const char * | what, |
char * | buffer, | ||
size_t | size, | ||
const char * | separator | ||
) |
WINPR_API char* winpr_str_url_decode | ( | const char * | str, |
size_t | len | ||
) |
WINPR_API char* winpr_str_url_encode | ( | const char * | str, |
size_t | len | ||
) |
WinPR: Windows Portable Runtime String Manipulation (CRT)
Copyright 2012 Marc-Andre Moreau marca Copyright 2016 David PHAM-VAN ndre .more au@g mail. comd.pha mvan @inuv ika. com
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
WINPR_API int winpr_vasprintf | ( | char ** | s, |
size_t * | slen, | ||
const char * | templ, | ||
va_list | ap | ||
) |