diff options
Diffstat (limited to 'src/fl_utf8.cxx')
| -rw-r--r-- | src/fl_utf8.cxx | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/src/fl_utf8.cxx b/src/fl_utf8.cxx index 0080cf2e0..cc0a139e0 100644 --- a/src/fl_utf8.cxx +++ b/src/fl_utf8.cxx @@ -341,9 +341,9 @@ unsigned int fl_codepage = 0; // character buffers to support the conversions. // NOTE: Our re-use of these buffers means this code is not // going to be thread-safe. -static xchar *mbwbuf = NULL; -static xchar *wbuf = NULL; -static xchar *wbuf1 = NULL; +static wchar_t *mbwbuf = NULL; +static wchar_t *wbuf = NULL; +static wchar_t *wbuf1 = NULL; static char *buf = NULL; static int buf_len = 0; static unsigned short *wbufa = NULL; @@ -386,7 +386,7 @@ char *fl_locale_to_utf8(const char *s, int len, UINT codepage) l = MultiByteToWideChar(codepage, 0, s, len, (WCHAR*)wbufa, buf_len); if (l < 0) l = 0; wbufa[l] = 0; - l = fl_utf8fromwc(buf, buf_len, (xchar*)wbufa, l); + l = fl_utf8fromwc(buf, buf_len, (wchar_t*)wbufa, l); buf[l] = 0; return buf; } @@ -405,7 +405,7 @@ char * fl_utf2mbcs(const char *s) static char *buf = NULL; unsigned wn = fl_utf8toUtf16(s, (unsigned) l, NULL, 0) + 7; // Query length - mbwbuf = (xchar*)realloc(mbwbuf, sizeof(xchar)*wn); + mbwbuf = (wchar_t*)realloc(mbwbuf, sizeof(wchar_t)*wn); l = fl_utf8toUtf16(s, (unsigned) l, (unsigned short *)mbwbuf, wn); // Convert string mbwbuf[l] = 0; @@ -438,10 +438,10 @@ char *fl_getenv(const char* v) { size_t l = strlen(v); unsigned wn = fl_utf8toUtf16(v, (unsigned) l, NULL, 0) + 1; // Query length - wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn); + wbuf = (wchar_t*)realloc(wbuf, sizeof(wchar_t)*wn); wn = fl_utf8toUtf16(v, (unsigned) l, (unsigned short *)wbuf, wn); // Convert string wbuf[wn] = 0; - xchar *ret = _wgetenv(wbuf); + wchar_t *ret = _wgetenv(wbuf); static char *buf = NULL; if (ret) { l = (unsigned) wcslen(ret); @@ -484,7 +484,7 @@ int fl_open(const char* f, int oflags, ...) unsigned l = (unsigned) strlen(f); unsigned wn = fl_utf8toUtf16(f, l, NULL, 0) + 1; // Query length - wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn); + wbuf = (wchar_t*)realloc(wbuf, sizeof(wchar_t)*wn); wn = fl_utf8toUtf16(f, l, (unsigned short *)wbuf, wn); // Convert string wbuf[wn] = 0; if (pmode == -1) return _wopen(wbuf, oflags); @@ -520,12 +520,12 @@ FILE *fl_fopen(const char* f, const char *mode) { size_t l = strlen(f); unsigned wn = fl_utf8toUtf16(f, (unsigned) l, NULL, 0) + 1; // Query length - wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn); + wbuf = (wchar_t*)realloc(wbuf, sizeof(wchar_t)*wn); wn = fl_utf8toUtf16(f, (unsigned) l, (unsigned short *)wbuf, wn); // Convert string wbuf[wn] = 0; l = strlen(mode); wn = fl_utf8toUtf16(mode, (unsigned) l, NULL, 0) + 1; // Query length - wbuf1 = (xchar*)realloc(wbuf1, sizeof(xchar)*wn); + wbuf1 = (wchar_t*)realloc(wbuf1, sizeof(wchar_t)*wn); wn = fl_utf8toUtf16(mode, (unsigned) l, (unsigned short *)wbuf1, wn); // Convert string wbuf1[wn] = 0; return _wfopen(wbuf, wbuf1); @@ -559,7 +559,7 @@ int fl_system(const char* cmd) # else size_t l = strlen(cmd); unsigned wn = fl_utf8toUtf16(cmd, (unsigned) l, NULL, 0) + 1; // Query length - wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn); + wbuf = (wchar_t*)realloc(wbuf, sizeof(wchar_t)*wn); wn = fl_utf8toUtf16(cmd, (unsigned) l, (unsigned short *)wbuf, wn); // Convert string wbuf[wn] = 0; return _wsystem(wbuf); @@ -579,21 +579,21 @@ int fl_execvp(const char *file, char *const *argv) # else size_t l = strlen(file); int i, n; - xchar **ar; + wchar_t **ar; unsigned wn = fl_utf8toUtf16(file, (unsigned) l, NULL, 0) + 1; // Query length - wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn); + wbuf = (wchar_t*)realloc(wbuf, sizeof(wchar_t)*wn); wn = fl_utf8toUtf16(file, (unsigned) l, (unsigned short *)wbuf, wn); // Convert string wbuf[wn] = 0; i = 0; n = 0; while (argv[i]) {i++; n++;} - ar = (xchar**) malloc(sizeof(xchar*) * (n + 1)); + ar = (wchar_t**) malloc(sizeof(wchar_t*) * (n + 1)); i = 0; while (i <= n) { unsigned wn; l = strlen(argv[i]); wn = fl_utf8toUtf16(argv[i], (unsigned) l, NULL, 0) + 1; // Query length - ar[i] = (xchar *)malloc(sizeof(xchar)*wn); + ar[i] = (wchar_t *)malloc(sizeof(wchar_t)*wn); wn = fl_utf8toUtf16(argv[i], (unsigned) l, (unsigned short *)ar[i], wn); // Convert string ar[i][wn] = 0; i++; @@ -636,7 +636,7 @@ int fl_chmod(const char* f, int mode) { size_t l = strlen(f); unsigned wn = fl_utf8toUtf16(f, (unsigned) l, NULL, 0) + 1; // Query length - wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn); + wbuf = (wchar_t*)realloc(wbuf, sizeof(wchar_t)*wn); wn = fl_utf8toUtf16(f, (unsigned) l, (unsigned short *)wbuf, wn); // Convert string wbuf[wn] = 0; return _wchmod(wbuf, mode); @@ -671,7 +671,7 @@ int fl_access(const char* f, int mode) { size_t l = strlen(f); unsigned wn = fl_utf8toUtf16(f, (unsigned) l, NULL, 0) + 1; // Query length - wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn); + wbuf = (wchar_t*)realloc(wbuf, sizeof(wchar_t)*wn); wn = fl_utf8toUtf16(f, (unsigned) l, (unsigned short *)wbuf, wn); // Convert string wbuf[wn] = 0; return _waccess(wbuf, mode); @@ -706,7 +706,7 @@ int fl_stat(const char* f, struct stat *b) { size_t l = strlen(f); unsigned wn = fl_utf8toUtf16(f, (unsigned) l, NULL, 0) + 1; // Query length - wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn); + wbuf = (wchar_t*)realloc(wbuf, sizeof(wchar_t)*wn); wn = fl_utf8toUtf16(f, (unsigned) l, (unsigned short *)wbuf, wn); // Convert string wbuf[wn] = 0; return _wstat(wbuf, (struct _stat*)b); @@ -744,9 +744,9 @@ char *fl_getcwd(char* b, int l) { #if defined(WIN32) && !defined(__CYGWIN__) // Windows - static xchar *wbuf = NULL; - wbuf = (xchar*)realloc(wbuf, sizeof(xchar) * (l+1)); - xchar *ret = _wgetcwd(wbuf, l); + static wchar_t *wbuf = NULL; + wbuf = (wchar_t*)realloc(wbuf, sizeof(wchar_t) * (l+1)); + wchar_t *ret = _wgetcwd(wbuf, l); if (ret) { unsigned dstlen = l; l = (int) wcslen(wbuf); @@ -786,7 +786,7 @@ int fl_unlink(const char* f) { size_t l = strlen(f); unsigned wn = fl_utf8toUtf16(f, (unsigned) l, NULL, 0) + 1; // Query length - wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn); + wbuf = (wchar_t*)realloc(wbuf, sizeof(wchar_t)*wn); wn = fl_utf8toUtf16(f, (unsigned) l, (unsigned short *)wbuf, wn); // Convert string wbuf[wn] = 0; return _wunlink(wbuf); @@ -821,7 +821,7 @@ int fl_mkdir(const char* f, int mode) { size_t l = strlen(f); unsigned wn = fl_utf8toUtf16(f, (unsigned) l, NULL, 0) + 1; // Query length - wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn); + wbuf = (wchar_t*)realloc(wbuf, sizeof(wchar_t)*wn); wn = fl_utf8toUtf16(f, (unsigned) l, (unsigned short *)wbuf, wn); // Convert string wbuf[wn] = 0; return _wmkdir(wbuf); @@ -855,7 +855,7 @@ int fl_rmdir(const char* f) { size_t l = strlen(f); unsigned wn = fl_utf8toUtf16(f, (unsigned) l, NULL, 0) + 1; // Query length - wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn); + wbuf = (wchar_t*)realloc(wbuf, sizeof(wchar_t)*wn); wn = fl_utf8toUtf16(f, (unsigned) l, (unsigned short *)wbuf, wn); // Convert string wbuf[wn] = 0; return _wrmdir(wbuf); @@ -890,12 +890,12 @@ int fl_rename(const char* f, const char *n) { size_t l = strlen(f); unsigned wn = fl_utf8toUtf16(f, (unsigned) l, NULL, 0) + 1; // Query length - wbuf = (xchar*)realloc(wbuf, sizeof(xchar)*wn); + wbuf = (wchar_t*)realloc(wbuf, sizeof(wchar_t)*wn); wn = fl_utf8toUtf16(f, (unsigned) l, (unsigned short *)wbuf, wn); // Convert string wbuf[wn] = 0; l = strlen(n); wn = fl_utf8toUtf16(n, (unsigned) l, NULL, 0) + 1; // Query length - wbuf1 = (xchar*)realloc(wbuf1, sizeof(xchar)*wn); + wbuf1 = (wchar_t*)realloc(wbuf1, sizeof(wchar_t)*wn); wn = fl_utf8toUtf16(n, (unsigned) l, (unsigned short *)wbuf1, wn); // Convert string wbuf1[wn] = 0; return _wrename(wbuf, wbuf1); |
