fix text handling for wide strinbgs with max length.

This commit is contained in:
Vitor Santos Costa
2014-03-18 15:40:50 +00:00
parent a6cb6f6a25
commit 5a83e7c7a6
6 changed files with 54 additions and 27 deletions

View File

@@ -26,7 +26,10 @@
#include <string.h>
#ifndef HAVE_WCSNLEN
#define wcsnlen(S, N) wcslen(S)
inline static min(size_t i, size_t j) {
i < j ? return i : return j;
}
#define wcsnlen(S, N) min(N, wcslen(S))
#endif
static inline unsigned char *get_char(unsigned char *p, int *c) { *c = *p; return p+1; }