Merge branch 'master' into gltf_o3dgc

This commit is contained in:
Alexandr Arutjunov
2016-08-14 16:49:53 +03:00
25 changed files with 232 additions and 396 deletions

View File

@@ -749,6 +749,7 @@ if (UNZIP_FOUND)
SET (unzip_compile_SRCS "")
else (UNZIP_FOUND)
SET (unzip_compile_SRCS ${unzip_SRCS})
INCLUDE_DIRECTORIES( "../contrib/unzip/" )
endif (UNZIP_FOUND)
MESSAGE(STATUS "Enabled formats:${ASSIMP_IMPORTERS_ENABLED}")

View File

@@ -55,6 +55,7 @@ DefaultIOStream::~DefaultIOStream()
{
if (mFile) {
::fclose(mFile);
mFile = nullptr;
}
}
@@ -109,9 +110,9 @@ size_t DefaultIOStream::FileSize() const
return 0;
}
if (SIZE_MAX == cachedSize) {
if (SIZE_MAX == mCachedSize ) {
// Although fseek/ftell would allow us to reuse the exising file handle here,
// Although fseek/ftell would allow us to reuse the existing file handle here,
// it is generally unsafe because:
// - For binary streams, it is not technically well-defined
// - For text files the results are meaningless
@@ -124,16 +125,19 @@ size_t DefaultIOStream::FileSize() const
int err = _stat64( mFilename.c_str(), &fileStat );
if (0 != err)
return 0;
cachedSize = (size_t) (fileStat.st_size);
#else
mCachedSize = (size_t) (fileStat.st_size);
#elif defined __gnu_linux__ || defined __APPLE__ || defined __MACH__
struct stat fileStat;
int err = stat(mFilename.c_str(), &fileStat );
if (0 != err)
return 0;
cachedSize = (size_t) (fileStat.st_size);
const unsigned long long cachedSize = fileStat.st_size;
mCachedSize = static_cast< size_t >( cachedSize );
#else
# error "Unknown platform"
#endif
}
return cachedSize;
return mCachedSize;
}
// ----------------------------------------------------------------------------------

View File

@@ -59,11 +59,11 @@ class ASSIMP_API DefaultIOStream : public IOStream
{
friend class DefaultIOSystem;
#if __ANDROID__
#if __ANDROID_API__ > 9
#if defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT)
# if __ANDROID_API__ > 9
# if defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT)
friend class AndroidJNIIOSystem;
#endif // defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT)
#endif // __ANDROID_API__ > 9
# endif // defined(AI_CONFIG_ANDROID_JNI_ASSIMP_MANAGER_SUPPORT)
# endif // __ANDROID_API__ > 9
#endif // __ANDROID__
protected:
@@ -111,7 +111,7 @@ private:
std::string mFilename;
// Cached file size
mutable size_t cachedSize;
mutable size_t mCachedSize;
};
@@ -119,7 +119,7 @@ private:
inline DefaultIOStream::DefaultIOStream () :
mFile (NULL),
mFilename (""),
cachedSize (SIZE_MAX)
mCachedSize(SIZE_MAX)
{
// empty
}
@@ -130,7 +130,7 @@ inline DefaultIOStream::DefaultIOStream (FILE* pFile,
const std::string &strFilename) :
mFile(pFile),
mFilename(strFilename),
cachedSize (SIZE_MAX)
mCachedSize(SIZE_MAX)
{
// empty
}