diff --git a/code/AssetLib/Assbin/AssbinFileWriter.cpp b/code/AssetLib/Assbin/AssbinFileWriter.cpp index a879e637c..83a647a0b 100644 --- a/code/AssetLib/Assbin/AssbinFileWriter.cpp +++ b/code/AssetLib/Assbin/AssbinFileWriter.cpp @@ -60,10 +60,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include -#ifdef _WIN32 +#if _MSC_VER #pragma warning(push) #pragma warning(disable : 4706) -#endif // _WIN32 +#endif // _MSC_VER namespace Assimp { @@ -825,8 +825,8 @@ void DumpSceneToAssbin( AssbinFileWriter fileWriter(shortened, compressed); fileWriter.WriteBinaryDump(pFile, cmd, pIOSystem, pScene); } -#ifdef _WIN32 +#if _MSC_VER #pragma warning(pop) -#endif // _WIN32 +#endif // _MSC_VER } // end of namespace Assimp diff --git a/code/AssetLib/Assjson/cencode.h b/code/AssetLib/Assjson/cencode.h index 6bf76724e..a7893c434 100644 --- a/code/AssetLib/Assjson/cencode.h +++ b/code/AssetLib/Assjson/cencode.h @@ -8,9 +8,9 @@ For details, see http://sourceforge.net/projects/libb64 #ifndef BASE64_CENCODE_H #define BASE64_CENCODE_H -#ifdef _WIN32 +#ifdef _MSC_VER #pragma warning(disable : 4127 ) -#endif // _WIN32 +#endif // _MSC_VER typedef enum { diff --git a/code/AssetLib/glTF/glTFAsset.inl b/code/AssetLib/glTF/glTFAsset.inl index 116f76535..eae56a64d 100644 --- a/code/AssetLib/glTF/glTFAsset.inl +++ b/code/AssetLib/glTF/glTFAsset.inl @@ -57,10 +57,10 @@ namespace glTF { namespace { -#ifdef _WIN32 +#if _MSC_VER # pragma warning(push) # pragma warning(disable : 4706) -#endif // _WIN32 +#endif // _MSC_VER // // JSON Value reading helpers @@ -372,7 +372,7 @@ inline void Buffer::EncodedRegion_Mark(const size_t pOffset, const size_t pEncod char val[val_size]; - ai_snprintf(val, val_size, "%llu", (long long)pOffset); + ai_snprintf(val, val_size, AI_SIZEFMT, pOffset); throw DeadlyImportError(std::string("GLTF: incorrect offset value (") + val + ") for marking encoded region."); } @@ -382,7 +382,7 @@ inline void Buffer::EncodedRegion_Mark(const size_t pOffset, const size_t pEncod char val[val_size]; - ai_snprintf(val, val_size, "%llu, %llu", (long long)pOffset, (long long)pEncodedData_Length); + ai_snprintf(val, val_size, AI_SIZEFMT, AI_SIZEFMT, pOffset, pEncodedData_Length); throw DeadlyImportError(std::string("GLTF: encoded region with offset/length (") + val + ") is out of range."); } @@ -1412,8 +1412,8 @@ inline std::string Asset::FindUniqueID(const std::string &str, const char *suffi return id; } -#ifdef _WIN32 +#if _MSC_VER # pragma warning(pop) -#endif // WIN32 +#endif // _MSC_VER } // namespace glTF diff --git a/code/AssetLib/glTF/glTFAssetWriter.inl b/code/AssetLib/glTF/glTFAssetWriter.inl index d8d2556fa..779c8ce58 100644 --- a/code/AssetLib/glTF/glTFAssetWriter.inl +++ b/code/AssetLib/glTF/glTFAssetWriter.inl @@ -43,10 +43,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#ifdef _WIN32 +#if _MSC_VER # pragma warning(push) # pragma warning( disable : 4706) -#endif // _WIN32 +#endif // _MSC_VER namespace glTF { @@ -707,7 +707,7 @@ namespace glTF { w.WriteObjects(d); } -#ifdef _WIN32 +#if _MSC_VER # pragma warning(pop) #endif // _WIN32 diff --git a/code/AssetLib/glTF/glTFCommon.h b/code/AssetLib/glTF/glTFCommon.h index b151918b6..f70780ed4 100644 --- a/code/AssetLib/glTF/glTFCommon.h +++ b/code/AssetLib/glTF/glTFCommon.h @@ -190,10 +190,10 @@ inline void CopyValue(const glTFCommon::mat4 &v, aiMatrix4x4 &o) { o.d4 = v[15]; } -#ifdef _WIN32 +#if _MSC_VER # pragma warning(push) # pragma warning(disable : 4310) -#endif // _WIN32 +#endif // _MSC_VER inline std::string getCurrentAssetDir(const std::string &pFile) { std::string path = pFile; @@ -204,9 +204,9 @@ inline std::string getCurrentAssetDir(const std::string &pFile) { return path; } -#ifdef _WIN32 +#if _MSC_VER # pragma warning(pop) -#endif // _WIN32 +#endif // _MSC_VER namespace Util { diff --git a/code/AssetLib/glTF/glTFExporter.cpp b/code/AssetLib/glTF/glTFExporter.cpp index b85affc08..3edb87623 100644 --- a/code/AssetLib/glTF/glTFExporter.cpp +++ b/code/AssetLib/glTF/glTFExporter.cpp @@ -525,6 +525,10 @@ void ExportSkin(Asset& mAsset, const aiMesh* aimesh, Ref& meshRef, Ref encoder; o3dgc::IndexedFaceSet comp_o3dgc_ifs; @@ -793,6 +797,10 @@ void glTFExporter::ExportMeshes() } } +#if __GNUC__ +#pragma GCC diagnostic pop +#endif // __GNUC__ + /* * Export the root node of the node hierarchy. * Calls ExportNode for all children. diff --git a/code/AssetLib/glTF2/glTF2Asset.inl b/code/AssetLib/glTF2/glTF2Asset.inl index 142f39841..ca622d1e2 100644 --- a/code/AssetLib/glTF2/glTF2Asset.inl +++ b/code/AssetLib/glTF2/glTF2Asset.inl @@ -436,7 +436,7 @@ inline void Buffer::EncodedRegion_Mark(const size_t pOffset, const size_t pEncod char val[val_size]; - ai_snprintf(val, val_size, "%llu", (long long)pOffset); + ai_snprintf(val, val_size, AI_SIZEFMT, pOffset); throw DeadlyImportError(std::string("GLTF: incorrect offset value (") + val + ") for marking encoded region."); } @@ -446,7 +446,7 @@ inline void Buffer::EncodedRegion_Mark(const size_t pOffset, const size_t pEncod char val[val_size]; - ai_snprintf(val, val_size, "%llu, %llu", (long long)pOffset, (long long)pEncodedData_Length); + ai_snprintf(val, val_size, AI_SIZEFMT, AI_SIZEFMT, pOffset, pEncodedData_Length); throw DeadlyImportError(std::string("GLTF: encoded region with offset/length (") + val + ") is out of range."); } @@ -1042,10 +1042,10 @@ inline int Compare(const char *attr, const char (&str)[N]) { return (strncmp(attr, str, N - 1) == 0) ? N - 1 : 0; } -#ifdef _WIN32 +#if _MSC_VER #pragma warning(push) #pragma warning(disable : 4706) -#endif // _WIN32 +#endif // _MSC_VER inline bool GetAttribVector(Mesh::Primitive &p, const char *attr, Mesh::AccessorList *&v, int &pos) { if ((pos = Compare(attr, "POSITION"))) { @@ -1723,8 +1723,8 @@ inline std::string Asset::FindUniqueID(const std::string &str, const char *suffi return id; } -#ifdef _WIN32 -#pragma warning(pop) -#endif // _WIN32 +#if _MSC_VER +# pragma warning(pop) +#endif // _MSC_VER } // namespace glTF2 diff --git a/contrib/poly2tri/poly2tri/sweep/sweep.cc b/contrib/poly2tri/poly2tri/sweep/sweep.cc index 9e3666001..23aeb6b57 100644 --- a/contrib/poly2tri/poly2tri/sweep/sweep.cc +++ b/contrib/poly2tri/poly2tri/sweep/sweep.cc @@ -36,10 +36,10 @@ namespace p2t { -#ifdef _WIN32 +#ifdef _MSC_VER # pragma warning(push) # pragma warning( disable : 4702 ) -#endif // _WIN32 +#endif // _MSC_VER // Triangulate simple polygon with holes void Sweep::Triangulate(SweepContext& tcx) @@ -800,8 +800,8 @@ Sweep::~Sweep() { } -#ifdef _WIN32 +#ifdef _MSC_VER # pragma warning( pop ) -#endif // _WIN32 +#endif // _MSC_VER } diff --git a/contrib/zip/src/zip.h b/contrib/zip/src/zip.h index 807e328a8..2ebe9394d 100644 --- a/contrib/zip/src/zip.h +++ b/contrib/zip/src/zip.h @@ -15,9 +15,9 @@ #include #include -#ifdef _WIN32 +#ifdef _MSC_VER #pragma warning(disable : 4127 ) -#endif //_WIN32 +#endif //_MSC_VER #ifdef __cplusplus extern "C" { @@ -319,6 +319,10 @@ extern int zip_extract(const char *zipname, const char *dir, /** @} */ +#ifdef _MSC_VER +#pragma warning(pop) +#endif //_MSC_VER + #ifdef __cplusplus } #endif diff --git a/include/assimp/StringUtils.h b/include/assimp/StringUtils.h index 7e1cb4ce0..d848a6527 100644 --- a/include/assimp/StringUtils.h +++ b/include/assimp/StringUtils.h @@ -53,6 +53,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include +#ifdef _MSC_VER +# define AI_SIZEFMT "%Iu" +#else +# define AI_SIZEFMT "%zu" +#endif + /// @fn ai_snprintf /// @brief The portable version of the function snprintf ( C99 standard ), which works on visual studio compilers 2013 and earlier. /// @param outBuf The buffer to write in @@ -87,6 +93,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. return count; } +#elif defined(__MINGW32__) +# define ai_snprintf __mingw_snprintf #else # define ai_snprintf snprintf #endif @@ -150,7 +158,7 @@ std::string DecimalToHexa( T toConvert ) { /// @param g aiColor.g /// @param b aiColor.b /// @param a aiColor.a -/// @param with_head # +/// @param with_head # /// @return The hexadecimal string, is empty in case of an error. AI_FORCE_INLINE std::string Rgba2Hex(int r, int g, int b, int a, bool with_head) { std::stringstream ss; @@ -158,7 +166,7 @@ AI_FORCE_INLINE std::string Rgba2Hex(int r, int g, int b, int a, bool with_head) ss << "#"; } ss << std::hex << (r << 24 | g << 16 | b << 8 | a); - + return ss.str(); }