Skip to content

Commit

Permalink
Fixed use of old 'stat' function that leads to vs build not being abl…
Browse files Browse the repository at this point in the history
…e to access large files
  • Loading branch information
Andrew Dowsey committed Dec 8, 2014
1 parent 082a93a commit cf73876
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion spatialindex-src-1.8.5/include/spatialindex/tools/Tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

// Nuke this annoying warning. See http://www.unknownroad.com/rtfm/VisualStudio/warningC4251.html
#pragma warning( disable: 4251 )
#pragma warning( disable: 1125 )
//#pragma warning( disable: 1125 )
#endif

#include <stdint.h>
Expand Down
14 changes: 13 additions & 1 deletion spatialindex-src-1.8.5/src/storagemanager/DiskStorageManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <cstring>

// For checking if a file exists - hobu
#define _USE_INT64 1 // awd97 - needed for large file support on VS2010
#include <sys/stat.h>

#include <spatialindex/SpatialIndex.h>
Expand Down Expand Up @@ -58,20 +59,31 @@ bool CheckFilesExists(Tools::PropertySet& ps)
if (dat_name.m_varType != Tools::VT_EMPTY) idx = std::string(dat_name.m_val.pcVal);
if (fn.m_varType != Tools::VT_EMPTY) filename = std::string(fn.m_val.pcVal);

#if (defined _WIN32 || defined _WIN64 || defined WIN32 || defined WIN64) && !defined __GNUC__
struct __stat64 stats;
#else
struct stat stats;

#endif
std::ostringstream os;
int ret;
os << filename <<"."<<dat;
std::string data_name = os.str();
#if (defined _WIN32 || defined _WIN64 || defined WIN32 || defined WIN64) && !defined __GNUC__
ret = _stat64(data_name.c_str(), &stats);
#else
ret = stat(data_name.c_str(), &stats);
#endif

if (ret == 0) bExists = true;

os.str("");
os << filename <<"."<<idx;
std::string index_name = os.str();
#if (defined _WIN32 || defined _WIN64 || defined WIN32 || defined WIN64) && !defined __GNUC__
ret = __stat64(index_name.c_str(), &stats);
#else
ret = stat(index_name.c_str(), &stats);
#endif

if ((ret == 0) && (bExists == true)) bExists = true;

Expand Down

0 comments on commit cf73876

Please sign in to comment.