Removed mtw() for windows.
Instead, defined windows native functions for mbstowcs()/wcstombs().
This commit is contained in:
parent
7305768d38
commit
907c739679
2 changed files with 4 additions and 23 deletions
|
|
@ -63,7 +63,7 @@ static void print_composemap(osk_composenode * composemap, char *sp);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#define mbstowcs(wtok, tok, size) MultiByteToWideChar(CP_UTF8,MB_COMPOSITE,tok,-1,wtok,size)
|
#define mbstowcs(wtok, tok, size) MultiByteToWideChar(CP_UTF8,0,tok,-1,wtok,size)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct osk_keyboard *osk_create(char * layout_name, SDL_Surface * canvas,
|
struct osk_keyboard *osk_create(char * layout_name, SDL_Surface * canvas,
|
||||||
|
|
|
||||||
|
|
@ -341,27 +341,8 @@ typedef struct safer_dirent
|
||||||
#undef max
|
#undef max
|
||||||
#define mkdir(path,access) _mkdir(path)
|
#define mkdir(path,access) _mkdir(path)
|
||||||
|
|
||||||
static void mtw(wchar_t * wtok, char *tok, size_t size)
|
#define mbstowcs(wtok, tok, size) MultiByteToWideChar(CP_UTF8,0,tok,-1,wtok,size)
|
||||||
{
|
#define wcstombs(tok, wtok, size) WideCharToMultiByte(CP_UTF8,0,wtok,-1,tok,size,NULL,NULL)
|
||||||
/* workaround using iconv to get a functionallity somewhat approximate as mbstowcs() */
|
|
||||||
Uint16 *ui16;
|
|
||||||
|
|
||||||
ui16 = malloc(size);
|
|
||||||
char *wrptr = (char *)ui16;
|
|
||||||
size_t in, out, n;
|
|
||||||
iconv_t trans;
|
|
||||||
|
|
||||||
in = size;
|
|
||||||
out = size;
|
|
||||||
n = size / sizeof(wchar_t);
|
|
||||||
|
|
||||||
trans = iconv_open("WCHAR_T", "UTF-8");
|
|
||||||
iconv(trans, (char **)&tok, &in, &wrptr, &out);
|
|
||||||
*((wchar_t *) wrptr) = L'\0';
|
|
||||||
swprintf(wtok, n, L"%ls", ui16);
|
|
||||||
free(ui16);
|
|
||||||
iconv_close(trans);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern int win32_trash(const char *path);
|
extern int win32_trash(const char *path);
|
||||||
|
|
||||||
|
|
@ -23897,7 +23878,7 @@ static void load_info_about_label_surface(FILE * lfi)
|
||||||
tmpstr = malloc(1024);
|
tmpstr = malloc(1024);
|
||||||
wtmpstr = malloc(1024);
|
wtmpstr = malloc(1024);
|
||||||
fgets(tmpstr, 1024, lfi);
|
fgets(tmpstr, 1024, lfi);
|
||||||
mtw(wtmpstr, tmpstr, 1024);
|
mbstowcs(wtmpstr, tmpstr, 1024);
|
||||||
for (l = 0; l < new_node->save_texttool_len; l++)
|
for (l = 0; l < new_node->save_texttool_len; l++)
|
||||||
{
|
{
|
||||||
new_node->save_texttool_str[l] = wtmpstr[l];
|
new_node->save_texttool_str[l] = wtmpstr[l];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue