Fix MinGW builds (issues related to pragmas and format strings)
parent
67a710efad
commit
700d8e6614
|
@ -60,10 +60,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if _MSC_VER
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4706)
|
#pragma warning(disable : 4706)
|
||||||
#endif // _WIN32
|
#endif // _MSC_VER
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
|
@ -825,8 +825,8 @@ void DumpSceneToAssbin(
|
||||||
AssbinFileWriter fileWriter(shortened, compressed);
|
AssbinFileWriter fileWriter(shortened, compressed);
|
||||||
fileWriter.WriteBinaryDump(pFile, cmd, pIOSystem, pScene);
|
fileWriter.WriteBinaryDump(pFile, cmd, pIOSystem, pScene);
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
#if _MSC_VER
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif // _WIN32
|
#endif // _MSC_VER
|
||||||
|
|
||||||
} // end of namespace Assimp
|
} // end of namespace Assimp
|
||||||
|
|
|
@ -8,9 +8,9 @@ For details, see http://sourceforge.net/projects/libb64
|
||||||
#ifndef BASE64_CENCODE_H
|
#ifndef BASE64_CENCODE_H
|
||||||
#define BASE64_CENCODE_H
|
#define BASE64_CENCODE_H
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _MSC_VER
|
||||||
#pragma warning(disable : 4127 )
|
#pragma warning(disable : 4127 )
|
||||||
#endif // _WIN32
|
#endif // _MSC_VER
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,10 +57,10 @@ namespace glTF {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if _MSC_VER
|
||||||
# pragma warning(push)
|
# pragma warning(push)
|
||||||
# pragma warning(disable : 4706)
|
# pragma warning(disable : 4706)
|
||||||
#endif // _WIN32
|
#endif // _MSC_VER
|
||||||
|
|
||||||
//
|
//
|
||||||
// JSON Value reading helpers
|
// 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];
|
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.");
|
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];
|
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.");
|
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;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if _MSC_VER
|
||||||
# pragma warning(pop)
|
# pragma warning(pop)
|
||||||
#endif // WIN32
|
#endif // _MSC_VER
|
||||||
|
|
||||||
} // namespace glTF
|
} // namespace glTF
|
||||||
|
|
|
@ -43,10 +43,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <rapidjson/writer.h>
|
#include <rapidjson/writer.h>
|
||||||
#include <rapidjson/prettywriter.h>
|
#include <rapidjson/prettywriter.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if _MSC_VER
|
||||||
# pragma warning(push)
|
# pragma warning(push)
|
||||||
# pragma warning( disable : 4706)
|
# pragma warning( disable : 4706)
|
||||||
#endif // _WIN32
|
#endif // _MSC_VER
|
||||||
|
|
||||||
namespace glTF {
|
namespace glTF {
|
||||||
|
|
||||||
|
@ -707,7 +707,7 @@ namespace glTF {
|
||||||
w.WriteObjects(d);
|
w.WriteObjects(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if _MSC_VER
|
||||||
# pragma warning(pop)
|
# pragma warning(pop)
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
|
|
||||||
|
|
|
@ -190,10 +190,10 @@ inline void CopyValue(const glTFCommon::mat4 &v, aiMatrix4x4 &o) {
|
||||||
o.d4 = v[15];
|
o.d4 = v[15];
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if _MSC_VER
|
||||||
# pragma warning(push)
|
# pragma warning(push)
|
||||||
# pragma warning(disable : 4310)
|
# pragma warning(disable : 4310)
|
||||||
#endif // _WIN32
|
#endif // _MSC_VER
|
||||||
|
|
||||||
inline std::string getCurrentAssetDir(const std::string &pFile) {
|
inline std::string getCurrentAssetDir(const std::string &pFile) {
|
||||||
std::string path = pFile;
|
std::string path = pFile;
|
||||||
|
@ -204,9 +204,9 @@ inline std::string getCurrentAssetDir(const std::string &pFile) {
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
#if _MSC_VER
|
||||||
# pragma warning(pop)
|
# pragma warning(pop)
|
||||||
#endif // _WIN32
|
#endif // _MSC_VER
|
||||||
|
|
||||||
namespace Util {
|
namespace Util {
|
||||||
|
|
||||||
|
|
|
@ -525,6 +525,10 @@ void ExportSkin(Asset& mAsset, const aiMesh* aimesh, Ref<Mesh>& meshRef, Ref<Buf
|
||||||
delete[] vertexJointData;
|
delete[] vertexJointData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if __GNUC__
|
||||||
|
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
|
||||||
|
#endif // __GNUC__
|
||||||
|
|
||||||
void glTFExporter::ExportMeshes()
|
void glTFExporter::ExportMeshes()
|
||||||
{
|
{
|
||||||
// Not for
|
// Not for
|
||||||
|
@ -677,7 +681,7 @@ void glTFExporter::ExportMeshes()
|
||||||
{
|
{
|
||||||
#ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC
|
#ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC
|
||||||
// Only one type of compression supported at now - Open3DGC.
|
// Only one type of compression supported at now - Open3DGC.
|
||||||
//
|
//
|
||||||
o3dgc::BinaryStream bs;
|
o3dgc::BinaryStream bs;
|
||||||
o3dgc::SC3DMCEncoder<IndicesType> encoder;
|
o3dgc::SC3DMCEncoder<IndicesType> encoder;
|
||||||
o3dgc::IndexedFaceSet<IndicesType> comp_o3dgc_ifs;
|
o3dgc::IndexedFaceSet<IndicesType> 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.
|
* Export the root node of the node hierarchy.
|
||||||
* Calls ExportNode for all children.
|
* Calls ExportNode for all children.
|
||||||
|
|
|
@ -436,7 +436,7 @@ inline void Buffer::EncodedRegion_Mark(const size_t pOffset, const size_t pEncod
|
||||||
|
|
||||||
char val[val_size];
|
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.");
|
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];
|
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.");
|
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;
|
return (strncmp(attr, str, N - 1) == 0) ? N - 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if _MSC_VER
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4706)
|
#pragma warning(disable : 4706)
|
||||||
#endif // _WIN32
|
#endif // _MSC_VER
|
||||||
|
|
||||||
inline bool GetAttribVector(Mesh::Primitive &p, const char *attr, Mesh::AccessorList *&v, int &pos) {
|
inline bool GetAttribVector(Mesh::Primitive &p, const char *attr, Mesh::AccessorList *&v, int &pos) {
|
||||||
if ((pos = Compare(attr, "POSITION"))) {
|
if ((pos = Compare(attr, "POSITION"))) {
|
||||||
|
@ -1723,8 +1723,8 @@ inline std::string Asset::FindUniqueID(const std::string &str, const char *suffi
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if _MSC_VER
|
||||||
#pragma warning(pop)
|
# pragma warning(pop)
|
||||||
#endif // _WIN32
|
#endif // _MSC_VER
|
||||||
|
|
||||||
} // namespace glTF2
|
} // namespace glTF2
|
||||||
|
|
|
@ -36,10 +36,10 @@
|
||||||
|
|
||||||
namespace p2t {
|
namespace p2t {
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _MSC_VER
|
||||||
# pragma warning(push)
|
# pragma warning(push)
|
||||||
# pragma warning( disable : 4702 )
|
# pragma warning( disable : 4702 )
|
||||||
#endif // _WIN32
|
#endif // _MSC_VER
|
||||||
|
|
||||||
// Triangulate simple polygon with holes
|
// Triangulate simple polygon with holes
|
||||||
void Sweep::Triangulate(SweepContext& tcx)
|
void Sweep::Triangulate(SweepContext& tcx)
|
||||||
|
@ -800,8 +800,8 @@ Sweep::~Sweep() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _MSC_VER
|
||||||
# pragma warning( pop )
|
# pragma warning( pop )
|
||||||
#endif // _WIN32
|
#endif // _MSC_VER
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,9 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _MSC_VER
|
||||||
#pragma warning(disable : 4127 )
|
#pragma warning(disable : 4127 )
|
||||||
#endif //_WIN32
|
#endif //_MSC_VER
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -53,6 +53,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
# define AI_SIZEFMT "%Iu"
|
||||||
|
#else
|
||||||
|
# define AI_SIZEFMT "%zu"
|
||||||
|
#endif
|
||||||
|
|
||||||
/// @fn ai_snprintf
|
/// @fn ai_snprintf
|
||||||
/// @brief The portable version of the function snprintf ( C99 standard ), which works on visual studio compilers 2013 and earlier.
|
/// @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
|
/// @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;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#elif defined(__MINGW32__)
|
||||||
|
# define ai_snprintf __mingw_snprintf
|
||||||
#else
|
#else
|
||||||
# define ai_snprintf snprintf
|
# define ai_snprintf snprintf
|
||||||
#endif
|
#endif
|
||||||
|
@ -150,7 +158,7 @@ std::string DecimalToHexa( T toConvert ) {
|
||||||
/// @param g aiColor.g
|
/// @param g aiColor.g
|
||||||
/// @param b aiColor.b
|
/// @param b aiColor.b
|
||||||
/// @param a aiColor.a
|
/// @param a aiColor.a
|
||||||
/// @param with_head #
|
/// @param with_head #
|
||||||
/// @return The hexadecimal string, is empty in case of an error.
|
/// @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) {
|
AI_FORCE_INLINE std::string Rgba2Hex(int r, int g, int b, int a, bool with_head) {
|
||||||
std::stringstream ss;
|
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 << "#";
|
||||||
}
|
}
|
||||||
ss << std::hex << (r << 24 | g << 16 | b << 8 | a);
|
ss << std::hex << (r << 24 | g << 16 | b << 8 | a);
|
||||||
|
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue