Commit 73b95f09 authored by Simon Morlat's avatar Simon Morlat
Browse files

use mbrlen, which should work on windows 10

parent c2bac8d7
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "belle_sip_internal.h" #include "belle_sip_internal.h"
#include <limits.h> #include <limits.h>
#include <ctype.h> #include <ctype.h>
#include <wchar.h>
#ifdef ANDROID #ifdef ANDROID
#include "wakelock_internal.h" #include "wakelock_internal.h"
...@@ -937,10 +938,11 @@ static size_t find_non_printable(const char *buffer, size_t size){ ...@@ -937,10 +938,11 @@ static size_t find_non_printable(const char *buffer, size_t size){
return size; return size;
#else #else
size_t i=0; size_t i=0;
mbstate_t mbs;
memset(&mbs, 0, sizeof(mbs));
do { do {
int valid_multibyte_len = mblen(buffer+i, size-i); size_t valid_multibyte_len = mbrlen(buffer+i, size-i, &mbs);
if (valid_multibyte_len <= 0) break; if (valid_multibyte_len == (size_t)-1 || valid_multibyte_len == (size_t)-2 || valid_multibyte_len == 0) break;
i += valid_multibyte_len; i += valid_multibyte_len;
}while(1); }while(1);
return i; return i;
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
#define snprintf _snprintf #define snprintf _snprintf
#define vsnprintf _vsnprintf #define vsnprintf _vsnprintf
#define strdup _strdup #define strdup _strdup
#define mblen _mblen
#else #else
#include <stdint.h> #include <stdint.h>
#endif #endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment