From 9f7d9becb280e21b4a93fb19e40234b1963abe5b Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Sat, 21 Mar 2020 08:56:49 +0100 Subject: [PATCH] fix the linux build. --- code/ASE/ASEParser.h | 17 ++++++++++++++--- code/B3D/B3DImporter.cpp | 4 ++-- code/Obj/ObjFileParser.cpp | 11 +++++++++-- code/Step/STEPFile.h | 7 +++++-- contrib/zip/src/zip.c | 13 ++++++++++--- include/assimp/types.h | 8 ++++---- 6 files changed, 44 insertions(+), 16 deletions(-) diff --git a/code/ASE/ASEParser.h b/code/ASE/ASEParser.h index e55949f99..aba37d38f 100644 --- a/code/ASE/ASEParser.h +++ b/code/ASE/ASEParser.h @@ -80,7 +80,18 @@ struct Material : public D3DS::Material } Material(const Material &other) = default; - Material &operator=(const Material &other) = default; + + Material &operator=(const Material &other) { + if (this == &other) { + return *this; + } + + avSubMaterials = other.avSubMaterials; + pcInstance = other.pcInstance; + bNeed = other.bNeed; + + return *this; + } //! Move constructor. This is explicitly written because MSVC doesn't support defaulting it @@ -94,12 +105,12 @@ struct Material : public D3DS::Material } - Material &operator=(Material &&other) AI_NO_EXCEPT { + Material &operator=( Material &&other) AI_NO_EXCEPT { if (this == &other) { return *this; } - D3DS::Material::operator=(std::move(other)); + //D3DS::Material::operator=(std::move(other)); avSubMaterials = std::move(other.avSubMaterials); pcInstance = std::move(other.pcInstance); diff --git a/code/B3D/B3DImporter.cpp b/code/B3D/B3DImporter.cpp index 80da4c814..dbf002bd1 100644 --- a/code/B3D/B3DImporter.cpp +++ b/code/B3D/B3DImporter.cpp @@ -364,7 +364,7 @@ void B3DImporter::ReadVRTS(){ int v0=static_cast(_vertices.size()); _vertices.resize( v0+n_verts ); - for( int i=0;imFaces = new aiFace[n_tris]; - for (int i = 0; i < n_tris; ++i) { + for (unsigned int i = 0; i < n_tris; ++i) { int i0 = ReadInt() + v0; int i1 = ReadInt() + v0; int i2 = ReadInt() + v0; diff --git a/code/Obj/ObjFileParser.cpp b/code/Obj/ObjFileParser.cpp index 2f7b8c4f9..79d5dc284 100644 --- a/code/Obj/ObjFileParser.cpp +++ b/code/Obj/ObjFileParser.cpp @@ -59,7 +59,14 @@ namespace Assimp { const std::string ObjFileParser::DEFAULT_MATERIAL = AI_DEFAULT_MATERIAL_NAME; ObjFileParser::ObjFileParser() : - m_DataIt(), m_DataItEnd(), m_pModel(nullptr), m_uiLine(0), m_pIO(nullptr), m_progress(nullptr), m_originalObjFileName() { + m_DataIt(), + m_DataItEnd(), + m_pModel(nullptr), + m_uiLine(0), + m_buffer(), + m_pIO(nullptr), + m_progress(nullptr), + m_originalObjFileName() { // empty } @@ -69,8 +76,8 @@ ObjFileParser::ObjFileParser(IOStreamBuffer &streamBuffer, const std::stri m_DataIt(), m_DataItEnd(), m_pModel(nullptr), - m_buffer(), m_uiLine(0), + m_buffer(), m_pIO(io), m_progress(progress), m_originalObjFileName(originalObjFileName) { diff --git a/code/Step/STEPFile.h b/code/Step/STEPFile.h index 2996e4e80..dcfffbeb8 100644 --- a/code/Step/STEPFile.h +++ b/code/Step/STEPFile.h @@ -727,8 +727,11 @@ struct InternGenericConvert> { } }; +#ifdef _WIN32 #pragma warning(push) #pragma warning(disable : 4127) +#endif // _WIN32 + template struct InternGenericConvertList { void operator()(ListOf &out, const std::shared_ptr &inp_base, const STEP::DB &db) { @@ -759,8 +762,6 @@ struct InternGenericConvertList { } }; -#pragma warning(pop) - template struct InternGenericConvert> { void operator()(Lazy &out, const std::shared_ptr &in_base, const STEP::DB &db) { @@ -959,7 +960,9 @@ private: const EXPRESS::ConversionSchema *schema; }; +#ifdef _WIN32 #pragma warning(pop) +#endif // _WIN32 } // namespace STEP diff --git a/contrib/zip/src/zip.c b/contrib/zip/src/zip.c index 2310842c8..0020df0ed 100644 --- a/contrib/zip/src/zip.c +++ b/contrib/zip/src/zip.c @@ -701,7 +701,10 @@ ssize_t zip_entry_noallocread(struct zip_t *zip, void *buf, size_t bufsize) { int zip_entry_fread(struct zip_t *zip, const char *filename) { mz_zip_archive *pzip = NULL; mz_uint idx; - //mz_uint32 xattr = 0; +#if defined(_MSC_VER) +#else + mz_uint32 xattr = 0; +#endif mz_zip_archive_file_stat info; if (!zip) { @@ -844,7 +847,11 @@ int zip_extract(const char *zipname, const char *dir, mz_zip_archive zip_archive; mz_zip_archive_file_stat info; size_t dirlen = 0; - //mz_uint32 xattr = 0; +#if defined(_MSC_VER) +#else + mz_uint32 xattr = 0; +#endif + memset(path, 0, sizeof(path)); memset(symlink_to, 0, sizeof(symlink_to)); @@ -961,4 +968,4 @@ out: return status; } -#pragma warning(pop) \ No newline at end of file +#pragma warning(pop) diff --git a/include/assimp/types.h b/include/assimp/types.h index 8c20c44ca..74763d496 100644 --- a/include/assimp/types.h +++ b/include/assimp/types.h @@ -61,12 +61,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include // Some types moved to separate header due to size of operators +#include +#include #include #include #include #include -#include -#include typedef int32_t ai_int32; typedef uint32_t ai_uint32; @@ -525,11 +525,11 @@ struct aiMemoryInfo { #endif //! __cplusplus // Include implementation files +#include "vector2.inl" +#include "vector3.inl" #include "color4.inl" #include "matrix3x3.inl" #include "matrix4x4.inl" #include "quaternion.inl" -#include "vector2.inl" -#include "vector3.inl" #endif // AI_TYPES_H_INC