Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting it to build on macosx which has done away w/the stat64 stuff #7

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/VTSMisc.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ using namespace csm;

#ifdef _WIN32
#define STATTYPE stat
#elif __APPLE__
#define STATTYPE stat
#else
#define STATTYPE stat64
#endif
Expand Down Expand Up @@ -191,7 +193,9 @@ OSSIM_PLUGINS_DLL void initNitf21ISD(Nitf21Isd *isd,

FILE * fillBuff (std::string fname,
#ifdef _WIN32
struct stat &statbuf,
struct stat &statbuf,
#elif __APPLE__
struct stat &statbuf,
#else
struct stat64 &statbuf,
#endif
Expand All @@ -204,6 +208,8 @@ void parseFile(Nitf20Isd *isd,
FILE *ifile,
#ifdef _WIN32
struct stat &statbuf,
#elif __APPLE__
struct stat &statbuf,
#else
struct stat64 &statbuf,
#endif
Expand All @@ -215,6 +221,8 @@ void parseFile(Nitf21Isd *isd,
FILE *ifile,
#ifdef _WIN32
struct stat &statbuf,
#elif __APPLE__
struct stat &statbuf,
#else
struct stat64 &statbuf,
#endif
Expand Down
8 changes: 4 additions & 4 deletions src/ossimCsmLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#ifdef _WIN32
#include <windows.h>
# include <io.h>
#include <io.h>
#else
# include <cstdio> // for sprintf
# include <cstring> // for strstr
Expand Down Expand Up @@ -345,8 +345,8 @@ void ossimCsmLoader::getAvailableSensorModelNames(List& models, const string& pl
}
}

RasterGM* ossimCsmLoader::loadModelFromState(const string& /* pPluginName */,
const string& /* pSensorModelName */,
RasterGM* ossimCsmLoader::loadModelFromState(const string& pPluginName,
const string& pSensorModelName,
const string& pSensorState )
{
static const char* MODULE = "ossimCsmLoader::loadModelFromState() -- ";
Expand Down Expand Up @@ -440,7 +440,7 @@ RasterGM* ossimCsmLoader::loadModelFromState(const string& /* pPluginName */,
}


RasterGM* ossimCsmLoader::loadModelFromFile(const string& /* pPluginName */,
RasterGM* ossimCsmLoader::loadModelFromFile(const string& pPluginName,
const string& pSensorModelName,
const string& pInputImage,
ossim_uint32 index )
Expand Down
32 changes: 31 additions & 1 deletion src/vts_isd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ void initBytestreamISD( BytestreamIsd *bytestream,
size_t totread = 0;

FILE *ifp = NULL;
#ifdef _WIN32
#ifdef _WIN32
ifp = fopen (filename.c_str(), "rb");
#elif __APPLE__
ifp = fopen (filename.c_str(), "rb");
#else
ifp = fopen64 (filename.c_str(), "rb");
Expand Down Expand Up @@ -209,6 +211,8 @@ void initNitf20ISD( Nitf20Isd *isd,

#ifdef _WIN32
struct stat statbuf; // to check for file presence and size
#elif __APPLE__
struct stat statbuf; // to check for file presence and size
#else
struct stat64 statbuf; // to check for file presence and size
#endif
Expand Down Expand Up @@ -258,6 +262,8 @@ void initNitf21ISD( Nitf21Isd *isd,
std::string ftype ("NITF21");
#ifdef _WIN32
struct stat statbuf; // to check for file presence and size
#elif __APPLE__
struct stat statbuf; // to check for file presence and size
#else
struct stat64 statbuf; // to check for file presence and size
#endif
Expand Down Expand Up @@ -300,6 +306,8 @@ void initNitf21ISD( Nitf21Isd *isd,
FILE * fillBuff( std::string fname,
#ifdef _WIN32
struct stat &statbuf,
#elif __APPLE__
struct stat &statbuf,
#else
struct stat64 &statbuf,
#endif
Expand All @@ -312,6 +320,9 @@ FILE * fillBuff( std::string fname,
#ifdef _WIN32
off_t buffsize; // st_size is defined as off_t
if (stat(fname.c_str(), &statbuf))
#elif __APPLE__
off_t buffsize; // st_size is defined as off_t
if (stat(fname.c_str(), &statbuf))
#else
off64_t buffsize; // st_size is defined as off64_t
if (stat64(fname.c_str(), &statbuf))
Expand All @@ -336,6 +347,8 @@ FILE * fillBuff( std::string fname,
// malloc ok
#ifdef _WIN32
ifile = fopen (fname.c_str(), "rb");
#elif __APPLE__
ifile = fopen (fname.c_str(), "rb");
#else
ifile = fopen64 (fname.c_str(), "rb");
#endif
Expand Down Expand Up @@ -562,6 +575,8 @@ void parseFile(Nitf20Isd *isd,
FILE *ifile,
#ifdef _WIN32
struct stat &statbuf,
#elif __APPLE__
struct stat &statbuf,
#else
struct stat64 &statbuf,
#endif
Expand Down Expand Up @@ -951,6 +966,8 @@ void parseFile(Nitf21Isd *isd,
FILE *ifile,
#ifdef _WIN32
struct stat &statbuf,
#elif __APPLE__
struct stat &statbuf,
#else
struct stat64 &statbuf,
#endif
Expand Down Expand Up @@ -1854,6 +1871,9 @@ char* getSegment(FILE *pFile,
#if defined (WIN32)
fpos_t f_offset = offset;
fsetpos(pFile, &f_offset);
#elif __APPLE__
fpos_t f_offset = offset;
fsetpos(pFile, &f_offset);
#else
#if defined (__linux)
off64_t f_offset = offset;
Expand Down Expand Up @@ -2725,6 +2745,8 @@ void writeStateFile(std::string fname, std::string state)// throw (Error)

#ifdef _WIN32
ofile = fopen (fname.c_str(), "w");
#elif __APPLE__
ofile = fopen (fname.c_str(), "w");
#else
ofile = fopen64 (fname.c_str(), "w");
#endif
Expand Down Expand Up @@ -2780,6 +2802,8 @@ std::string readStateFile(std::string fname)// throw (Error)

#ifdef _WIN32
off_t byte_size_of_file;
#elif __APPLE__
off_t byte_size_of_file;
#else
off64_t byte_size_of_file;
#endif
Expand All @@ -2789,6 +2813,8 @@ std::string readStateFile(std::string fname)// throw (Error)

#ifdef _WIN32
ifile = fopen (fname.c_str(), "rb");
#elif __APPLE__
ifile = fopen (fname.c_str(), "rb");
#else
ifile = fopen64 (fname.c_str(), "rb");
#endif
Expand All @@ -2807,6 +2833,10 @@ std::string readStateFile(std::string fname)// throw (Error)
fseek(ifile, 0, SEEK_END);
byte_size_of_file = ftell(ifile);
fseek(ifile, 0, SEEK_SET);
#elif __APPLE__
fseek(ifile, 0, SEEK_END);
byte_size_of_file = ftell(ifile);
fseek(ifile, 0, SEEK_SET);
#else
fseeko64(ifile, 0, SEEK_END);
byte_size_of_file = ftello64(ifile);
Expand Down