|
|
@ -10886,25 +10886,31 @@ mdb_mutex_failed(MDB_env *env, mdb_mutexref_t mutex, int rc) |
|
|
|
return rc; |
|
|
|
return rc; |
|
|
|
} |
|
|
|
} |
|
|
|
#endif /* MDB_ROBUST_SUPPORTED */ |
|
|
|
#endif /* MDB_ROBUST_SUPPORTED */ |
|
|
|
/** @} */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(_WIN32) |
|
|
|
#if defined(_WIN32) |
|
|
|
static int utf8_to_utf16(const char *src, int srcsize, wchar_t **dst, int *dstsize) |
|
|
|
static int ESECT |
|
|
|
{ |
|
|
|
utf8_to_utf16(const char *src, int srcsize, wchar_t **dst, int *dstsize) |
|
|
|
int need; |
|
|
|
{ |
|
|
|
wchar_t *result; |
|
|
|
int rc, need = 0; |
|
|
|
need = MultiByteToWideChar(CP_UTF8, 0, src, srcsize, NULL, 0); |
|
|
|
wchar_t *result = NULL; |
|
|
|
if (need == 0xFFFD) |
|
|
|
for (;;) { /* malloc result, then fill it in */ |
|
|
|
return EILSEQ; |
|
|
|
need = MultiByteToWideChar(CP_UTF8, 0, src, srcsize, result, need); |
|
|
|
if (need == 0) |
|
|
|
if (!need) { |
|
|
|
return EINVAL; |
|
|
|
rc = ErrCode(); |
|
|
|
|
|
|
|
free(result); |
|
|
|
|
|
|
|
return rc; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!result) { |
|
|
|
result = malloc(sizeof(wchar_t) * need); |
|
|
|
result = malloc(sizeof(wchar_t) * need); |
|
|
|
if (!result) |
|
|
|
if (!result) |
|
|
|
return ENOMEM; |
|
|
|
return ENOMEM; |
|
|
|
MultiByteToWideChar(CP_UTF8, 0, src, srcsize, result, need); |
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
if (dstsize) |
|
|
|
if (dstsize) |
|
|
|
*dstsize = need; |
|
|
|
*dstsize = need; |
|
|
|
*dst = result; |
|
|
|
*dst = result; |
|
|
|
return 0; |
|
|
|
return MDB_SUCCESS; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
#endif /* defined(_WIN32) */ |
|
|
|
#endif /* defined(_WIN32) */ |
|
|
|
|
|
|
|
/** @} */ |
|
|
|