diff options
| author | Manolo Gouy <Manolo> | 2016-03-29 09:29:51 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-03-29 09:29:51 +0000 |
| commit | 4fcefc68f8cf9c2648c7140a08fa492c29896c3f (patch) | |
| tree | 0b21a8db3670e0a410fabb83e0cda5d5fe769b61 /src/fl_utf8.cxx | |
| parent | 21655099a71718f7671e634a9b4c4079d135cfaf (diff) | |
Remove the platform-dependent type xchar
File fl_utf8.h defines the xchar type with a platform-dependent value (wchar_t or unsigned short).
But it is used exclusively by WIN32 code (0 use in cross-platform code, 0 use in APPLE
or in USE_X11 code).
Thus, we can just get rid of this type and replace it by wchar_t where it is used.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11459 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
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); |
