[mapguide-commits] r7253 - in sandbox/adsk/2.5k: Common/Foundation/System Server/src/Common/Manager Server/src/Services/Tile Server/src/UnitTesting
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Tue Dec 11 01:00:33 PST 2012
Author: hubu
Date: 2012-12-11 01:00:32 -0800 (Tue, 11 Dec 2012)
New Revision: 7253
Modified:
sandbox/adsk/2.5k/Common/Foundation/System/FileUtil.cpp
sandbox/adsk/2.5k/Common/Foundation/System/FileUtil.h
sandbox/adsk/2.5k/Server/src/Common/Manager/LogManager.cpp
sandbox/adsk/2.5k/Server/src/Services/Tile/ServerTileService.cpp
sandbox/adsk/2.5k/Server/src/UnitTesting/TestCoordinateSystem.cpp
sandbox/adsk/2.5k/Server/src/UnitTesting/TestCoordinateSystem.h
Log:
Submit on behalf of Andy Zhang
Fix ticket #2195 http://trac.osgeo.org/mapguide/ticket/2195
The behavior of system call _wstat in VC9 and VC10 is different when handling file which size is bigger than 2^31. In VC9, it returns 0. But in VC10, it returns -1. Then some checks will be failed when opening a big file.
To fix this issue, we need to use _wstat64 instead of _wstat.
Modified: sandbox/adsk/2.5k/Common/Foundation/System/FileUtil.cpp
===================================================================
--- sandbox/adsk/2.5k/Common/Foundation/System/FileUtil.cpp 2012-12-08 15:15:44 UTC (rev 7252)
+++ sandbox/adsk/2.5k/Common/Foundation/System/FileUtil.cpp 2012-12-11 09:00:32 UTC (rev 7253)
@@ -203,7 +203,7 @@
/// </summary>
///----------------------------------------------------------------------------
-bool MgFileUtil::GetFileStatus(CREFSTRING pathname, struct _stat& statInfo,
+bool MgFileUtil::GetFileStatus(CREFSTRING pathname, struct _stat64& statInfo,
bool strict)
{
bool success = false;
@@ -227,7 +227,7 @@
ACE_MT(ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, ace_mon, sm_mutex, false));
#ifdef _WIN32
- success = ::_wstat(path.c_str(), &statInfo) == 0;
+ success = ::_wstat64(path.c_str(), &statInfo) == 0;
#else
success = ::stat(MgUtil::WideCharToMultiByte(path).c_str(), &statInfo) == 0;
#endif
@@ -263,7 +263,7 @@
bool MgFileUtil::PathnameExists(CREFSTRING pathname)
{
- struct _stat statInfo;
+ struct _stat64 statInfo;
return GetFileStatus(pathname, statInfo);
}
@@ -277,7 +277,7 @@
bool MgFileUtil::IsDirectory(CREFSTRING pathname)
{
bool result = false;
- struct _stat statInfo;
+ struct _stat64 statInfo;
if (GetFileStatus(pathname, statInfo))
{
@@ -744,7 +744,7 @@
bool MgFileUtil::IsFile(CREFSTRING pathname)
{
bool result = false;
- struct _stat statInfo;
+ struct _stat64 statInfo;
if (GetFileStatus(pathname, statInfo))
{
@@ -1145,7 +1145,7 @@
///
MgDateTime MgFileUtil::GetFileCreationTime(CREFSTRING pathname)
{
- struct _stat statInfo;
+ struct _stat64 statInfo;
if (GetFileStatus(pathname, statInfo, true))
{
@@ -1161,7 +1161,7 @@
///
MgDateTime MgFileUtil::GetFileModificationTime(CREFSTRING pathname)
{
- struct _stat statInfo;
+ struct _stat64 statInfo;
if (GetFileStatus(pathname, statInfo, true))
{
@@ -1177,7 +1177,7 @@
///
INT64 MgFileUtil::GetFileSize(CREFSTRING pathname)
{
- struct _stat statInfo;
+ struct _stat64 statInfo;
if (GetFileStatus(pathname, statInfo, true))
{
Modified: sandbox/adsk/2.5k/Common/Foundation/System/FileUtil.h
===================================================================
--- sandbox/adsk/2.5k/Common/Foundation/System/FileUtil.h 2012-12-08 15:15:44 UTC (rev 7252)
+++ sandbox/adsk/2.5k/Common/Foundation/System/FileUtil.h 2012-12-11 09:00:32 UTC (rev 7253)
@@ -28,7 +28,7 @@
#include <sys/file.h>
#define _rmdir rmdir
- #define _stat stat
+ #define _stat64 stat
#endif
class MG_FOUNDATION_API ACE_Recursive_Thread_Mutex;
@@ -67,7 +67,7 @@
static void AppendSlashToEndOfPath(REFSTRING path);
static void RemoveSlashFromEndOfPath(REFSTRING path);
- static bool GetFileStatus(CREFSTRING pathname, struct _stat& statInfo,
+ static bool GetFileStatus(CREFSTRING pathname, struct _stat64& statInfo,
bool strict = false);
static bool PathnameExists(CREFSTRING pathname);
Modified: sandbox/adsk/2.5k/Server/src/Common/Manager/LogManager.cpp
===================================================================
--- sandbox/adsk/2.5k/Server/src/Common/Manager/LogManager.cpp 2012-12-08 15:15:44 UTC (rev 7252)
+++ sandbox/adsk/2.5k/Server/src/Common/Manager/LogManager.cpp 2012-12-11 09:00:32 UTC (rev 7253)
@@ -2233,7 +2233,7 @@
STRING path;
int statResult;
#ifdef _WIN32
- struct _stat statBuf;
+ struct _stat64 statBuf;
#else
struct stat statBuf;
#endif
@@ -2246,7 +2246,7 @@
path = m_path + name;
#ifdef _WIN32
- statResult = ::_wstat(path.c_str(), &statBuf);
+ statResult = ::_wstat64(path.c_str(), &statBuf);
#else
statResult = ::stat(MgUtil::WideCharToMultiByte(path).c_str(),
&statBuf);
Modified: sandbox/adsk/2.5k/Server/src/Services/Tile/ServerTileService.cpp
===================================================================
--- sandbox/adsk/2.5k/Server/src/Services/Tile/ServerTileService.cpp 2012-12-08 15:15:44 UTC (rev 7252)
+++ sandbox/adsk/2.5k/Server/src/Services/Tile/ServerTileService.cpp 2012-12-11 09:00:32 UTC (rev 7253)
@@ -94,7 +94,7 @@
bool MgServerTileService::DetectTileLockFile(CREFSTRING lockPathname)
{
bool found = false;
- struct _stat lockFileInfo;
+ struct _stat64 lockFileInfo;
// Check the lock file to see if another thread/process is writing the tile file.
while (MgFileUtil::GetFileStatus(lockPathname, lockFileInfo))
Modified: sandbox/adsk/2.5k/Server/src/UnitTesting/TestCoordinateSystem.cpp
===================================================================
--- sandbox/adsk/2.5k/Server/src/UnitTesting/TestCoordinateSystem.cpp 2012-12-08 15:15:44 UTC (rev 7252)
+++ sandbox/adsk/2.5k/Server/src/UnitTesting/TestCoordinateSystem.cpp 2012-12-11 09:00:32 UTC (rev 7253)
@@ -477,7 +477,7 @@
CPPUNIT_ASSERT(updateCsdFileSize == csdFileSize);
//the user CSD file now must exist
- struct _stat fileStatus;
+ struct _stat64 fileStatus;
bool fileExists = MgFileUtil::GetFileStatus(csCsdUserFile, fileStatus);
CPPUNIT_ASSERT(fileExists && fileStatus.st_size);
Modified: sandbox/adsk/2.5k/Server/src/UnitTesting/TestCoordinateSystem.h
===================================================================
--- sandbox/adsk/2.5k/Server/src/UnitTesting/TestCoordinateSystem.h 2012-12-08 15:15:44 UTC (rev 7252)
+++ sandbox/adsk/2.5k/Server/src/UnitTesting/TestCoordinateSystem.h 2012-12-11 09:00:32 UTC (rev 7253)
@@ -497,7 +497,7 @@
FileAutoBackup(const CREFSTRING filename, const CREFSTRING rotateSuffix, bool keepFile = false)
: m_sFilename(filename), m_sRotateSuffix(rotateSuffix), m_bRotated(false), m_bKeepFile(keepFile)
{
- struct _stat fileStatus;
+ struct _stat64 fileStatus;
bool fileExists = MgFileUtil::GetFileStatus(filename, fileStatus);
this->m_sBackupFilename = (this->m_sFilename + this->m_sRotateSuffix);
More information about the mapguide-commits
mailing list