Merge pull request #3347 from rbsheth/rbsheth_fix_warn

Fixing more build warnings
pull/3349/head
Kim Kulling 2020-07-25 19:06:21 +02:00 committed by GitHub
commit 575ce6136d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 12 deletions

View File

@ -45,6 +45,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "IFCReaderGen_2x3.h" #include "IFCReaderGen_2x3.h"
#if _MSC_VER
# pragma warning(push)
# pragma warning(disable : 4702)
#endif // _MSC_VER
namespace Assimp { namespace Assimp {
using namespace ::Assimp::IFC; using namespace ::Assimp::IFC;
@ -3165,4 +3170,8 @@ template <> size_t GenericFill<IfcLightSourceDirectional>(const DB& db, const LI
} // ! STEP } // ! STEP
} // ! Assimp } // ! Assimp
#if _MSC_VER
# pragma warning(pop)
#endif // _MSC_VER
#endif #endif

View File

@ -43,6 +43,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "IFCReaderGen_2x3.h" #include "IFCReaderGen_2x3.h"
#if _MSC_VER
# pragma warning(push)
# pragma warning(disable : 4702)
#endif // _MSC_VER
namespace Assimp { namespace Assimp {
using namespace IFC; using namespace IFC;
using namespace ::Assimp::IFC::Schema_2x3; using namespace ::Assimp::IFC::Schema_2x3;
@ -1915,4 +1920,8 @@ template <> size_t GenericFill<IfcConditionCriterion>(const DB& db, const LIST&
} // ! STEP } // ! STEP
} // ! Assimp } // ! Assimp
#if _MSC_VER
# pragma warning(pop)
#endif // _MSC_VER
#endif #endif

View File

@ -686,7 +686,11 @@ typedef struct
} _m3dstbi__result_info; } _m3dstbi__result_info;
#define STBI_ASSERT(v) #define STBI_ASSERT(v)
#ifdef _MSC_VER
#define STBI_NOTUSED(v) (void)(v)
#else
#define STBI_NOTUSED(v) (void)sizeof(v) #define STBI_NOTUSED(v) (void)sizeof(v)
#endif
#define STBI__BYTECAST(x) ((unsigned char)((x)&255)) #define STBI__BYTECAST(x) ((unsigned char)((x)&255))
#define STBI_MALLOC(sz) M3D_MALLOC(sz) #define STBI_MALLOC(sz) M3D_MALLOC(sz)
#define STBI_REALLOC(p, newsz) M3D_REALLOC(p, newsz) #define STBI_REALLOC(p, newsz) M3D_REALLOC(p, newsz)
@ -699,10 +703,6 @@ _inline static unsigned char _m3dstbi__get8(_m3dstbi__context *s) {
return 0; return 0;
} }
_inline static int _m3dstbi__at_eof(_m3dstbi__context *s) {
return s->img_buffer >= s->img_buffer_end;
}
static void _m3dstbi__skip(_m3dstbi__context *s, int n) { static void _m3dstbi__skip(_m3dstbi__context *s, int n) {
if (n < 0) { if (n < 0) {
s->img_buffer = s->img_buffer_end; s->img_buffer = s->img_buffer_end;
@ -4347,7 +4347,7 @@ unsigned char *m3d_save(m3d_t *model, int quality, int flags, unsigned int *size
char vc_s, vi_s, si_s, ci_s, ti_s, bi_s, nb_s, sk_s, fc_s, hi_s, fi_s; char vc_s, vi_s, si_s, ci_s, ti_s, bi_s, nb_s, sk_s, fc_s, hi_s, fi_s;
char *sn = NULL, *sl = NULL, *sa = NULL, *sd = NULL; char *sn = NULL, *sl = NULL, *sa = NULL, *sd = NULL;
unsigned char *out = NULL, *z = NULL, weights[M3D_NUMBONE], *norm = NULL; unsigned char *out = NULL, *z = NULL, weights[M3D_NUMBONE], *norm = NULL;
unsigned int i, j, k, l, n, len, chunklen, *length; unsigned int i = 0, j = 0, k = 0, l = 0, n = 0, len = 0, chunklen = 0, *length = NULL;
M3D_FLOAT scale = (M3D_FLOAT)0.0, min_x, max_x, min_y, max_y, min_z, max_z; M3D_FLOAT scale = (M3D_FLOAT)0.0, min_x, max_x, min_y, max_y, min_z, max_z;
M3D_INDEX last, *vrtxidx = NULL, *mtrlidx = NULL, *tmapidx = NULL, *skinidx = NULL; M3D_INDEX last, *vrtxidx = NULL, *mtrlidx = NULL, *tmapidx = NULL, *skinidx = NULL;
uint32_t idx, numcmap = 0, *cmap = NULL, numvrtx = 0, maxvrtx = 0, numtmap = 0, maxtmap = 0, numproc = 0; uint32_t idx, numcmap = 0, *cmap = NULL, numvrtx = 0, maxvrtx = 0, numtmap = 0, maxtmap = 0, numproc = 0;
@ -5578,9 +5578,9 @@ unsigned char *m3d_save(m3d_t *model, int quality, int flags, unsigned int *size
} else } else
out--; out--;
break; break;
case m3dpf_uint8: *out++ = m->prop[i].value.num; break; case m3dpf_uint8: *out++ = (uint8_t)m->prop[i].value.num; break;
case m3dpf_uint16: case m3dpf_uint16:
*((uint16_t *)out) = m->prop[i].value.num; *((uint16_t *)out) = (uint16_t)m->prop[i].value.num;
out += 2; out += 2;
break; break;
case m3dpf_uint32: case m3dpf_uint32:
@ -5655,7 +5655,7 @@ unsigned char *m3d_save(m3d_t *model, int quality, int flags, unsigned int *size
face[i].data.normal[1] == M3D_UNDEF || face[i].data.normal[2] == M3D_UNDEF) ? face[i].data.normal[1] == M3D_UNDEF || face[i].data.normal[2] == M3D_UNDEF) ?
0 : 0 :
2); 2);
*out++ = k; *out++ = (uint8_t)k;
for (j = 0; j < 3; j++) { for (j = 0; j < 3; j++) {
out = _m3d_addidx(out, vi_s, vrtxidx[face[i].data.vertex[j]]); out = _m3d_addidx(out, vi_s, vrtxidx[face[i].data.vertex[j]]);
if (k & 1) if (k & 1)
@ -6149,7 +6149,7 @@ public:
#endif /* M3D_CPPWRAPPER */ #endif /* M3D_CPPWRAPPER */
#ifdef _MSC_VER #if _MSC_VER > 1920 && !defined(__clang__)
# pragma warning(pop) # pragma warning(pop)
#endif /* _MSC_VER */ #endif /* _MSC_VER */

View File

@ -542,10 +542,12 @@ void glTFExporter::ExportMeshes()
// Variables needed for compression. BEGIN. // Variables needed for compression. BEGIN.
// Indices, not pointers - because pointer to buffer is changing while writing to it. // Indices, not pointers - because pointer to buffer is changing while writing to it.
#ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC
size_t idx_srcdata_begin = 0; // Index of buffer before writing mesh data. Also, index of begin of coordinates array in buffer. size_t idx_srcdata_begin = 0; // Index of buffer before writing mesh data. Also, index of begin of coordinates array in buffer.
size_t idx_srcdata_normal = SIZE_MAX;// Index of begin of normals array in buffer. SIZE_MAX - mean that mesh has no normals. size_t idx_srcdata_normal = SIZE_MAX;// Index of begin of normals array in buffer. SIZE_MAX - mean that mesh has no normals.
std::vector<size_t> idx_srcdata_tc;// Array of indices. Every index point to begin of texture coordinates array in buffer.
size_t idx_srcdata_ind;// Index of begin of coordinates indices array in buffer. size_t idx_srcdata_ind;// Index of begin of coordinates indices array in buffer.
#endif
std::vector<size_t> idx_srcdata_tc;// Array of indices. Every index point to begin of texture coordinates array in buffer.
bool comp_allow;// Point that data of current mesh can be compressed. bool comp_allow;// Point that data of current mesh can be compressed.
// Variables needed for compression. END. // Variables needed for compression. END.
@ -615,13 +617,17 @@ void glTFExporter::ExportMeshes()
/******************* Vertices ********************/ /******************* Vertices ********************/
// If compression is used then you need parameters of uncompressed region: begin and size. At this step "begin" is stored. // If compression is used then you need parameters of uncompressed region: begin and size. At this step "begin" is stored.
#ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC
if(comp_allow) idx_srcdata_begin = b->byteLength; if(comp_allow) idx_srcdata_begin = b->byteLength;
#endif
Ref<Accessor> v = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mVertices, AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT, BufferViewTarget_ARRAY_BUFFER); Ref<Accessor> v = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mVertices, AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT, BufferViewTarget_ARRAY_BUFFER);
if (v) p.attributes.position.push_back(v); if (v) p.attributes.position.push_back(v);
/******************** Normals ********************/ /******************** Normals ********************/
#ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC
if(comp_allow && (aim->mNormals != 0)) idx_srcdata_normal = b->byteLength;// Store index of normals array. if(comp_allow && (aim->mNormals != 0)) idx_srcdata_normal = b->byteLength;// Store index of normals array.
#endif
Ref<Accessor> n = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mNormals, AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT, BufferViewTarget_ARRAY_BUFFER); Ref<Accessor> n = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mNormals, AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT, BufferViewTarget_ARRAY_BUFFER);
if (n) p.attributes.normal.push_back(n); if (n) p.attributes.normal.push_back(n);
@ -646,7 +652,9 @@ void glTFExporter::ExportMeshes()
} }
/*************** Vertices indices ****************/ /*************** Vertices indices ****************/
#ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC
idx_srcdata_ind = b->byteLength;// Store index of indices array. idx_srcdata_ind = b->byteLength;// Store index of indices array.
#endif
if (aim->mNumFaces > 0) { if (aim->mNumFaces > 0) {
std::vector<IndicesType> indices; std::vector<IndicesType> indices;

View File

@ -804,7 +804,7 @@ struct CustomExtension : public Object {
Nullable<std::vector<CustomExtension>> mValues; Nullable<std::vector<CustomExtension>> mValues;
operator bool() const { operator bool() const {
return Size(); return Size() != 0;
} }
size_t Size() const { size_t Size() const {