From 75b4c05741e4cb42a0705341b2b696aa0e9a73c0 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Mon, 30 Aug 2021 20:44:51 +0200 Subject: [PATCH] Drop _IRR_WCHAR_FILESYSTEM never used and never worked for us. --- include/IrrCompileConfig.h | 14 -------- include/irrTypes.h | 26 --------------- include/irrUString.h | 4 --- source/Irrlicht/CFileSystem.cpp | 44 -------------------------- source/Irrlicht/CGUIFileOpenDialog.cpp | 9 ------ source/Irrlicht/CReadFile.cpp | 4 --- source/Irrlicht/CWriteFile.cpp | 4 --- 7 files changed, 105 deletions(-) diff --git a/include/IrrCompileConfig.h b/include/IrrCompileConfig.h index 6dc28615..1b98e35c 100644 --- a/include/IrrCompileConfig.h +++ b/include/IrrCompileConfig.h @@ -332,16 +332,6 @@ you will not be able to use anything provided by the GUI Environment, including #undef _IRR_COMPILE_WITH_GUI_ #endif -//! Define _IRR_WCHAR_FILESYSTEM to enable unicode filesystem support for the engine. -/** This enables the engine to read/write from unicode filesystem. If you -disable this feature, the engine behave as before (ansi). This is currently only supported -for Windows based systems. You also have to set #define UNICODE for this to compile. -*/ -//#define _IRR_WCHAR_FILESYSTEM -#ifdef NO_IRR_WCHAR_FILESYSTEM -#undef _IRR_WCHAR_FILESYSTEM -#endif - //! Define _IRR_COMPILE_WITH_LIBJPEG_ to enable compiling the engine using libjpeg. /** This enables the engine to read jpeg images. If you comment this out, the engine will no longer read .jpeg images. */ @@ -529,10 +519,6 @@ ones. */ #endif // _IRR_WINDOWS_API_ -#ifndef _IRR_WINDOWS_API_ - #undef _IRR_WCHAR_FILESYSTEM -#endif - #if defined(_IRR_SOLARIS_PLATFORM_) #undef _IRR_COMPILE_WITH_JOYSTICK_EVENTS_ #endif diff --git a/include/irrTypes.h b/include/irrTypes.h index 184870d5..e3561cfb 100644 --- a/include/irrTypes.h +++ b/include/irrTypes.h @@ -73,22 +73,6 @@ typedef double f64; #define swprintf_irr _snwprintf #define snprintf_irr _snprintf #endif - -// define the wchar_t type if not already built in. -#ifdef _MSC_VER -#ifndef _WCHAR_T_DEFINED -//! A 16 bit wide character type. -/** - Defines the wchar_t-type. - In VS6, its not possible to tell - the standard compiler to treat wchar_t as a built-in type, and - sometimes we just don't want to include the huge stdlib.h or wchar.h, - so we'll use this. -*/ -typedef unsigned short wchar_t; -#define _WCHAR_T_DEFINED -#endif // wchar is not defined -#endif // microsoft compiler #else #define swprintf_irr swprintf #define snprintf_irr snprintf @@ -98,18 +82,8 @@ namespace irr { //! Type name for character type used by the file system. -/** Should the wide character version of the FileSystem be used it is a -16 bit character variable. Used for Unicode Filesystem and Unicode strings. -Else it is a 8 bit character variable. Used for ansi Filesystem and non-unicode -strings -*/ -#if defined(_IRR_WCHAR_FILESYSTEM) - typedef wchar_t fschar_t; - #define _IRR_TEXT(X) L##X -#else typedef char fschar_t; #define _IRR_TEXT(X) X -#endif } // end namespace irr diff --git a/include/irrUString.h b/include/irrUString.h index c1c7925e..49cc6704 100644 --- a/include/irrUString.h +++ b/include/irrUString.h @@ -3015,11 +3015,7 @@ public: //! \return An io::path string containing the properly encoded string. io::path toPATH_s(const unicode::EUTF_ENDIAN endian = unicode::EUTFEE_NATIVE, const bool addBOM = false) const { -#if defined(_IRR_WCHAR_FILESYSTEM) - return toWCHAR_s(endian, addBOM); -#else return toUTF8_s(addBOM); -#endif } //! Loads an unknown stream of data. diff --git a/source/Irrlicht/CFileSystem.cpp b/source/Irrlicht/CFileSystem.cpp index 7ba441f6..5a9e1f4d 100644 --- a/source/Irrlicht/CFileSystem.cpp +++ b/source/Irrlicht/CFileSystem.cpp @@ -515,15 +515,9 @@ const io::path& CFileSystem::getWorkingDirectory() { #if defined(_IRR_WINDOWS_API_) fschar_t tmp[_MAX_PATH]; - #if defined(_IRR_WCHAR_FILESYSTEM ) - _wgetcwd(tmp, _MAX_PATH); - WorkingDirectory[FILESYSTEM_NATIVE] = tmp; - WorkingDirectory[FILESYSTEM_NATIVE].replace(L'\\', L'/'); - #else _getcwd(tmp, _MAX_PATH); WorkingDirectory[FILESYSTEM_NATIVE] = tmp; WorkingDirectory[FILESYSTEM_NATIVE].replace('\\', '/'); - #endif #endif #if (defined(_IRR_POSIX_API_) || defined(_IRR_OSX_PLATFORM_)) @@ -532,21 +526,6 @@ const io::path& CFileSystem::getWorkingDirectory() // so try it until the call was successful // Note that neither the first nor the second parameter may be 0 according to POSIX - #if defined(_IRR_WCHAR_FILESYSTEM ) - u32 pathSize=256; - wchar_t *tmpPath = new wchar_t[pathSize]; - while ((pathSize < (1<<16)) && !(wgetcwd(tmpPath,pathSize))) - { - delete [] tmpPath; - pathSize *= 2; - tmpPath = new char[pathSize]; - } - if (tmpPath) - { - WorkingDirectory[FILESYSTEM_NATIVE] = tmpPath; - delete [] tmpPath; - } - #else u32 pathSize=256; char *tmpPath = new char[pathSize]; while ((pathSize < (1<<16)) && !(getcwd(tmpPath,pathSize))) @@ -560,7 +539,6 @@ const io::path& CFileSystem::getWorkingDirectory() WorkingDirectory[FILESYSTEM_NATIVE] = tmpPath; delete [] tmpPath; } - #endif #endif WorkingDirectory[type].validate(); @@ -587,17 +565,9 @@ bool CFileSystem::changeWorkingDirectoryTo(const io::path& newDirectory) WorkingDirectory[FILESYSTEM_NATIVE] = newDirectory; #if defined(_MSC_VER) - #if defined(_IRR_WCHAR_FILESYSTEM) - success = (_wchdir(newDirectory.c_str()) == 0); - #else success = (_chdir(newDirectory.c_str()) == 0); - #endif #else - #if defined(_IRR_WCHAR_FILESYSTEM) - success = (_wchdir(newDirectory.c_str()) == 0); - #else success = (chdir(newDirectory.c_str()) == 0); - #endif #endif } @@ -612,15 +582,9 @@ io::path CFileSystem::getAbsolutePath(const io::path& filename) const #if defined(_IRR_WINDOWS_API_) fschar_t *p=0; fschar_t fpath[_MAX_PATH]; - #if defined(_IRR_WCHAR_FILESYSTEM ) - p = _wfullpath(fpath, filename.c_str(), _MAX_PATH); - core::stringw tmp(p); - tmp.replace(L'\\', L'/'); - #else p = _fullpath(fpath, filename.c_str(), _MAX_PATH); core::stringc tmp(p); tmp.replace('\\', '/'); - #endif return tmp; #elif (defined(_IRR_POSIX_API_) || defined(_IRR_OSX_PLATFORM_)) c8* p=0; @@ -958,17 +922,9 @@ bool CFileSystem::existFile(const io::path& filename) const return true; #if defined(_MSC_VER) - #if defined(_IRR_WCHAR_FILESYSTEM) - return (_waccess(filename.c_str(), 0) != -1); - #else return (_access(filename.c_str(), 0) != -1); - #endif #elif defined(F_OK) - #if defined(_IRR_WCHAR_FILESYSTEM) - return (_waccess(filename.c_str(), F_OK) != -1); - #else return (access(filename.c_str(), F_OK) != -1); - #endif #else return (access(filename.c_str(), 0) != -1); #endif diff --git a/source/Irrlicht/CGUIFileOpenDialog.cpp b/source/Irrlicht/CGUIFileOpenDialog.cpp index 25da8976..52b6808d 100644 --- a/source/Irrlicht/CGUIFileOpenDialog.cpp +++ b/source/Irrlicht/CGUIFileOpenDialog.cpp @@ -5,8 +5,6 @@ #include "CGUIFileOpenDialog.h" #ifdef _IRR_COMPILE_WITH_GUI_ -#include - #include "IGUISkin.h" #include "IGUIEnvironment.h" #include "IVideoDriver.h" @@ -382,14 +380,7 @@ void CGUIFileOpenDialog::deserializeAttributes(io::IAttributes* in, io::SAttribu void CGUIFileOpenDialog::pathToStringW(irr::core::stringw& result, const irr::io::path& p) { -#ifndef _IRR_WCHAR_FILESYSTEM - char* oldLocale = setlocale(LC_CTYPE, NULL); - setlocale(LC_CTYPE,""); // multibyteToWString is affected by LC_CTYPE. Filenames seem to need the system-locale. core::multibyteToWString(result, p); - setlocale(LC_CTYPE, oldLocale); -#else - result = p.c_str(); -#endif } //! fills the listbox with files. diff --git a/source/Irrlicht/CReadFile.cpp b/source/Irrlicht/CReadFile.cpp index cf90f54b..3205d1c1 100644 --- a/source/Irrlicht/CReadFile.cpp +++ b/source/Irrlicht/CReadFile.cpp @@ -73,11 +73,7 @@ void CReadFile::openFile() return; } -#if defined ( _IRR_WCHAR_FILESYSTEM ) - File = _wfopen(Filename.c_str(), L"rb"); -#else File = fopen(Filename.c_str(), "rb"); -#endif if (File) { diff --git a/source/Irrlicht/CWriteFile.cpp b/source/Irrlicht/CWriteFile.cpp index ef816b6b..3279402a 100644 --- a/source/Irrlicht/CWriteFile.cpp +++ b/source/Irrlicht/CWriteFile.cpp @@ -81,11 +81,7 @@ void CWriteFile::openFile(bool append) return; } -#if defined(_IRR_WCHAR_FILESYSTEM) - File = _wfopen(Filename.c_str(), append ? L"ab" : L"wb"); -#else File = fopen(Filename.c_str(), append ? "ab" : "wb"); -#endif if (File) {