Fix compiling with _IRR_WCHAR_FILESYSTEM on MinGW. Thx @ alexzk for reporting. Note that I tested this with gcc 4.7.0 and only compiling is tested.

Also added some documentation that UNICODE must be set as well for compiling with _IRR_WCHAR_FILESYSTEM ('cause I always forget to set that at first otherwise...).

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4322 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2012-10-03 10:51:20 +00:00
parent cbe3f1ac70
commit 5a265656cc
4 changed files with 23 additions and 12 deletions

View File

@ -1,5 +1,7 @@
Changes in 1.8 (??.10.2012)
- Gcc on Win32 (MinGW) now also works with the _w file access functions when compiled with _IRR_WCHAR_FILESYSTEM. (thx @ alexzk for reporting compile troubles)
- Fix a bunch of off-by one errors in irr::core::string in functions equals_substring_ignore_case, findFirst, findFirstChar, findNext, findLast, findLastChar, replace, remove and removeChars.
This prevents some potential memory access errors, find functions no longer try to find the \0, replace no longer replaces the \0 and remove no longer tries to remove it (which did remove the last character instead).

View File

@ -227,7 +227,8 @@ you will not be able to use anything provided by the GUI Environment, including
//! 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. */
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

View File

@ -458,7 +458,7 @@ bool CFileSystem::removeFileArchive(u32 index)
//! removes an archive from the file system.
bool CFileSystem::removeFileArchive(const io::path& filename)
{
const path absPath = getAbsolutePath(filename);
const path absPath = getAbsolutePath(filename);
for (u32 i=0; i < FileArchives.size(); ++i)
{
if (absPath == FileArchives[i]->getFileList()->getPath())
@ -593,7 +593,11 @@ bool CFileSystem::changeWorkingDirectoryTo(const io::path& newDirectory)
success = (_chdir(newDirectory.c_str()) == 0);
#endif
#else
success = (chdir(newDirectory.c_str()) == 0);
#if defined(_IRR_WCHAR_FILESYSTEM)
success = (_wchdir(newDirectory.c_str()) == 0);
#else
success = (chdir(newDirectory.c_str()) == 0);
#endif
#endif
}
@ -777,7 +781,7 @@ path CFileSystem::getRelativeFilename(const path& filename, const path& director
#endif
for (; i<list1.size() && i<list2.size()
for (; i<list1.size() && i<list2.size()
#if defined (_IRR_WINDOWS_API_)
&& (io::path(*it1).make_lower()==io::path(*it2).make_lower())
#else
@ -969,13 +973,17 @@ bool CFileSystem::existFile(const io::path& filename) const
#else
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
#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
#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)
return (access(filename.c_str(), F_OK) != -1);
#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

View File

@ -1598,12 +1598,12 @@ void CIrrDeviceWin32::getWindowsVersion(core::stringc& out)
sprintf(tmp, "version %ld.%ld %s (Build %ld)",
osvi.dwMajorVersion,
osvi.dwMinorVersion,
osvi.szCSDVersion,
irr::core::stringc(osvi.szCSDVersion).c_str(),
osvi.dwBuildNumber & 0xFFFF);
}
else
{
sprintf(tmp, "%s (Build %ld)", osvi.szCSDVersion,
sprintf(tmp, "%s (Build %ld)", irr::core::stringc(osvi.szCSDVersion).c_str(),
osvi.dwBuildNumber & 0xFFFF);
}