FS-7967 SmartOS compatibility

configure.ac: honor NetBSD and SmartOS in search for system lua
src/switch_utf8.c: remove switch_u8_vprintf and switch_u8_printf
replace u_int32_t with C99 standard uint32_t, and also the same for
  8,16,64 bit
This commit is contained in:
Stanislav Sinyagin
2015-09-09 21:23:18 +00:00
parent 4df2476564
commit 98a190a107
9 changed files with 29 additions and 69 deletions
+1 -34
View File
@@ -463,45 +463,12 @@ SWITCH_DECLARE(int) switch_u8_is_locale_utf8(char *locale)
return 0;
}
SWITCH_DECLARE(int) switch_u8_vprintf(char *fmt, va_list ap)
{
int cnt, sz=0;
char *buf;
uint32_t *wcs;
sz = 512;
buf = (char*)alloca(sz);
try_print:
cnt = vsnprintf(buf, sz, fmt, ap);
if (cnt >= sz) {
buf = (char*)alloca(cnt - sz + 1);
sz = cnt + 1;
goto try_print;
}
wcs = (uint32_t*)alloca((cnt+1) * sizeof(uint32_t));
cnt = switch_u8_toucs(wcs, cnt+1, buf, cnt);
printf("%ls", (wchar_t*)wcs);
return cnt;
}
SWITCH_DECLARE(int) switch_u8_printf(char *fmt, ...)
{
int cnt;
va_list args;
va_start(args, fmt);
cnt = switch_u8_vprintf(fmt, args);
va_end(args);
return cnt;
}
/* reads the next utf-8 sequence out of a string, updating an index */
SWITCH_DECLARE(uint32_t) switch_u8_get_char(char *s, int *i)
{
u_int32_t ch = 0;
uint32_t ch = 0;
int sz = 0;
do {