mirror of
https://github.com/Tha14/toxic.git
synced 2025-06-29 11:46:45 +02:00
fix memory leaks and safer way to convert strings from wc to mb
This commit is contained in:
@ -20,13 +20,13 @@ int string_is_empty(char *string);
|
||||
int char_to_wcs_buf(wchar_t *buf, const uint8_t *string, size_t n);
|
||||
|
||||
/* converts wide character string into a multibyte string.
|
||||
Same thing as wcs_to_char() but caller must provide its own buffer */
|
||||
int wcs_to_char_buf(uint8_t *buf, const wchar_t *string, size_t n);
|
||||
Same thing as wcs_to_mbs() but caller must provide its own buffer */
|
||||
int wcs_to_mbs_buf(uint8_t *buf, const wchar_t *string, size_t n);
|
||||
|
||||
/* convert wide characters to multibyte string string */
|
||||
uint8_t *wcs_to_char(wchar_t *string);
|
||||
/* convert wide characters to multibyte string: string returned must be free'd */
|
||||
uint8_t *wcs_to_mbs(wchar_t *string);
|
||||
|
||||
/* convert a wide char to multibyte string string */
|
||||
/* convert a wide char to multibyte char */
|
||||
char *wc_to_char(wchar_t ch);
|
||||
|
||||
/* Returns true if connection has timed out, false otherwise */
|
||||
@ -66,11 +66,12 @@ void kill_buf(wchar_t *buf, size_t *pos, size_t *len);
|
||||
/* nulls buf and sets pos and len to 0 */
|
||||
void reset_buf(wchar_t *buf, size_t *pos, size_t *len);
|
||||
|
||||
/* looks for the first instance in list that begins with the last entered word in buf,
|
||||
then completes the word. e.g. "Hello jo" would complete the buffer with "Hello john".
|
||||
/* looks for the first instance in list that begins with the last entered word in buf according to pos,
|
||||
then fills buf with the complete word. e.g. "Hello jo" would complete the buffer
|
||||
with "Hello john".
|
||||
|
||||
list is a pointer to the list of strings being compared, n_items is the number of items
|
||||
in the list, and size is the size of each item in the list.
|
||||
in the list, and size is the size of each item in the list.
|
||||
|
||||
Returns the difference between the old len and new len of buf */
|
||||
Returns the difference between the old len and new len of buf on success, -1 if error */
|
||||
int complete_line(wchar_t *buf, size_t *pos, size_t *len, const uint8_t *list, int n_items, int size);
|
Reference in New Issue
Block a user