mirror of
https://github.com/Tha14/toxic.git
synced 2025-07-06 09:26:44 +02:00
Fix bug causing messages containing newline byte to disappear
The wcswidth() function was silently failing when trying to convert messages containing a newline to a widechar buffer which resulted in the message showing up as an empty line. we now fall back to using strlen to get the width of the string, which might still cause minor display bugs when the message contains unicode, but is still better than losing messages entirely.
This commit is contained in:
@ -477,10 +477,9 @@ on_error:
|
||||
returns length of msg, which will be no larger than size-1 */
|
||||
size_t copy_tox_str(char *msg, size_t size, const char *data, size_t length)
|
||||
{
|
||||
size_t i;
|
||||
size_t j = 0;
|
||||
|
||||
for (i = 0; (i < length) && (j < size - 1); ++i) {
|
||||
for (size_t i = 0; (i < length) && (j < size - 1); ++i) {
|
||||
if (data[i] != '\r') {
|
||||
msg[j++] = data[i];
|
||||
}
|
||||
|
Reference in New Issue
Block a user