Fix compiler warnings.

pull/1318/head
Kim Kulling 2017-06-21 23:02:46 +02:00
parent 5011e382c7
commit bd2af6591f
5 changed files with 66 additions and 99 deletions

View File

@ -337,7 +337,6 @@ void BaseImporter::ConvertToUTF8(std::vector<char>& data)
if(*((uint32_t*)&data.front()) == 0x0000FFFE) {
DefaultLogger::get()->debug("Found UTF-32 BOM ...");
const uint32_t* sstart = (uint32_t*)&data.front()+1, *send = (uint32_t*)&data.back()+1;
std::vector<char> output;
int *ptr = (int*)&data[ 0 ];
int *end = ptr + ( data.size() / sizeof(int) ) +1;
@ -358,11 +357,8 @@ void BaseImporter::ConvertToUTF8(std::vector<char>& data)
if(*((uint16_t*)&data.front()) == 0xFEFF) {
DefaultLogger::get()->debug("Found UTF-16 BOM ...");
const uint16_t* sstart = (uint16_t*)&data.front()+1, *send = (uint16_t*)(&data.back()+1);
std::vector<unsigned char> output;
int16_t *ptr = (int16_t*) &data[ 0 ];
int16_t *end = ptr + (data.size() / sizeof(int)) + 1;
utf8::utf16to8(data.begin(), data.end(), back_inserter(output));
return;
}

View File

@ -66,8 +66,7 @@ namespace MDL {
* \brief Data structure for the HL2 main header
*/
// ---------------------------------------------------------------------------
struct Header_HL2
{
struct Header_HL2 {
//! magic number: "IDST"/"IDSQ"
char ident[4];
@ -139,7 +138,7 @@ struct Header_HL2
//! Number of animation transitions
int32_t numtransitions;
int32_t transitionindex;
} PACK_STRUCT;
} /* PACK_STRUCT */;
#include "./../include/assimp/Compiler/poppack1.h"

View File

@ -142,14 +142,14 @@ struct Frame
//! name of frame
char name[ AI_MD3_MAXFRAME ];
} PACK_STRUCT;
} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------
/** @brief Data structure for the tag header
/**
* @brief Data structure for the tag header
*/
struct Tag
{
struct Tag {
//! name of the tag
char NAME[ AI_MD3_MAXQPATH ];
@ -157,14 +157,13 @@ struct Tag
aiVector3D origin;
ai_real orientation[3][3];
} PACK_STRUCT;
} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------
/** @brief Data structure for the surface header
*/
struct Surface
{
struct Surface {
//! magic number
int32_t IDENT;
@ -186,7 +185,6 @@ struct Surface
//! number of triangles in the surface
uint32_t NUM_TRIANGLES;
//! offset to the triangle data
uint32_t OFS_TRIANGLES;
@ -201,19 +199,18 @@ struct Surface
//! offset to the end of the Surface object
int32_t OFS_END;
} PACK_STRUCT;
} /*PACK_STRUCT*/;
// -------------------------------------------------------------------------------
/** @brief Data structure for a shader defined in there
*/
struct Shader
{
struct Shader {
//! filename of the shader
char NAME[ AI_MD3_MAXQPATH ];
//! index of the shader
uint32_t SHADER_INDEX;
} PACK_STRUCT;
} /*PACK_STRUCT*/;
// -------------------------------------------------------------------------------
@ -223,7 +220,7 @@ struct Triangle
{
//! triangle indices
uint32_t INDEXES[3];
} PACK_STRUCT;
} /*PACK_STRUCT*/;
// -------------------------------------------------------------------------------
@ -233,7 +230,7 @@ struct TexCoord
{
//! UV coordinates
ai_real U,V;
} PACK_STRUCT;
} /*PACK_STRUCT*/;
// -------------------------------------------------------------------------------
@ -246,7 +243,7 @@ struct Vertex
//! encoded normal vector
uint16_t NORMAL;
} PACK_STRUCT;
} /*PACK_STRUCT*/;
#include "./../include/assimp/Compiler/poppack1.h"

View File

@ -157,7 +157,7 @@ struct Frame
//! Name of the frame
char name [ 16 ] ;
} PACK_STRUCT;
} /*PACK_STRUCT*/;
// ---------------------------------------------------------------------------
/** \brief Data structure for a MDC triangle

View File

@ -53,10 +53,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef AI_MDLFILEHELPER_H_INC
#define AI_MDLFILEHELPER_H_INC
#include <assimp/anim.h>
#include <assimp/mesh.h>
#include <assimp/Compiler/pushpack1.h>
#include "ByteSwapper.h"
#include "./../include/assimp/anim.h"
#include "./../include/assimp/mesh.h"
#include "./../include/assimp/Compiler/pushpack1.h"
#include <stdint.h>
#include <vector>
@ -90,7 +90,6 @@ namespace MDL {
#define AI_MDL_MAGIC_NUMBER_BE_GS7 AI_MAKE_MAGIC("MDL7")
#define AI_MDL_MAGIC_NUMBER_LE_GS7 AI_MAKE_MAGIC("7LDM")
// common limitations for Quake1 meshes. The loader does not check them,
// (however it warns) but models should not exceed these limits.
#if (!defined AI_MDL_VERSION)
@ -119,8 +118,7 @@ namespace MDL {
/** \struct Header
* \brief Data structure for the MDL main header
*/
struct Header
{
struct Header {
//! magic number: "IDPO"
uint32_t ident;
@ -166,15 +164,14 @@ struct Header
//! Could be the total size of the file (and not a float)
float size;
} PACK_STRUCT;
} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct Header_MDL7
* \brief Data structure for the MDL 7 main header
*/
struct Header_MDL7
{
struct Header_MDL7 {
//! magic number: "MDL7"
char ident[4];
@ -226,15 +223,14 @@ struct Header_MDL7
//! Size of the Frame_MDL7 data structure used in the file
uint16_t frame_stc_size;
} PACK_STRUCT;
} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct Bone_MDL7
* \brief Data structure for a bone in a MDL7 file
*/
struct Bone_MDL7
{
struct Bone_MDL7 {
//! Index of the parent bone of *this* bone. 0xffff means:
//! "hey, I have no parent, I'm an orphan"
uint16_t parent_index;
@ -246,7 +242,7 @@ struct Bone_MDL7
//! Optional name of the bone
char name[1 /* DUMMY SIZE */];
} PACK_STRUCT;
} /* PACK_STRUCT */;
#if (!defined AI_MDL7_BONE_STRUCT_SIZE__NAME_IS_20_CHARS)
# define AI_MDL7_BONE_STRUCT_SIZE__NAME_IS_20_CHARS (16 + 20)
@ -268,8 +264,7 @@ struct Bone_MDL7
/** \struct Group_MDL7
* \brief Group in a MDL7 file
*/
struct Group_MDL7
{
struct Group_MDL7 {
//! = '1' -> triangle based Mesh
unsigned char typ;
@ -295,7 +290,7 @@ struct Group_MDL7
//! Number of frames
int32_t numframes;
} PACK_STRUCT;
} /* PACK_STRUCT */;
#define AI_MDL7_SKINTYPE_MIPFLAG 0x08
#define AI_MDL7_SKINTYPE_MATERIAL 0x10
@ -310,41 +305,36 @@ struct Group_MDL7
/** \struct Deformer_MDL7
* \brief Deformer in a MDL7 file
*/
struct Deformer_MDL7
{
struct Deformer_MDL7 {
int8_t deformer_version; // 0
int8_t deformer_typ; // 0 - bones
int8_t _unused_[2];
int32_t group_index;
int32_t elements;
int32_t deformerdata_size;
} PACK_STRUCT;
} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct DeformerElement_MDL7
* \brief Deformer element in a MDL7 file
*/
struct DeformerElement_MDL7
{
struct DeformerElement_MDL7 {
//! bei deformer_typ==0 (==bones) element_index == bone index
int32_t element_index;
char element_name[AI_MDL7_MAX_BONENAMESIZE];
int32_t weights;
} PACK_STRUCT;
} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct DeformerWeight_MDL7
* \brief Deformer weight in a MDL7 file
*/
struct DeformerWeight_MDL7
{
struct DeformerWeight_MDL7 {
//! for deformer_typ==0 (==bones) index == vertex index
int32_t index;
float weight;
} PACK_STRUCT;
} /* PACK_STRUCT */;
// don't know why this was in the original headers ...
typedef int32_t MD7_MATERIAL_ASCDEFSIZE;
@ -353,17 +343,15 @@ typedef int32_t MD7_MATERIAL_ASCDEFSIZE;
/** \struct ColorValue_MDL7
* \brief Data structure for a color value in a MDL7 file
*/
struct ColorValue_MDL7
{
struct ColorValue_MDL7 {
float r,g,b,a;
} PACK_STRUCT;
} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct Material_MDL7
* \brief Data structure for a Material in a MDL7 file
*/
struct Material_MDL7
{
struct Material_MDL7 {
//! Diffuse base color of the material
ColorValue_MDL7 Diffuse;
@ -378,15 +366,13 @@ struct Material_MDL7
//! Phong power
float Power;
} PACK_STRUCT;
} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct Skin
* \brief Skin data structure #1 - used by Quake1, MDL2, MDL3 and MDL4
*/
struct Skin
{
struct Skin {
//! 0 = single (Skin), 1 = group (GroupSkin)
//! For MDL3-5: Defines the type of the skin and there
//! fore the size of the data to skip:
@ -402,7 +388,7 @@ struct Skin
//! Texture data
uint8_t *data;
} PACK_STRUCT;
} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
@ -410,11 +396,10 @@ struct Skin
* \brief Skin data structure #2 - used by MDL5, MDL6 and MDL7
* \see Skin
*/
struct Skin_MDL5
{
struct Skin_MDL5 {
int32_t size, width, height;
uint8_t *data;
} PACK_STRUCT;
} /* PACK_STRUCT */;
// maximum length of texture file name
#if (!defined AI_MDL7_MAX_TEXNAMESIZE)
@ -425,44 +410,40 @@ struct Skin_MDL5
/** \struct Skin_MDL7
* \brief Skin data structure #3 - used by MDL7 and HMP7
*/
struct Skin_MDL7
{
struct Skin_MDL7 {
uint8_t typ;
int8_t _unused_[3];
int32_t width;
int32_t height;
char texture_name[AI_MDL7_MAX_TEXNAMESIZE];
} PACK_STRUCT;
} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct RGB565
* \brief Data structure for a RGB565 pixel in a texture
*/
struct RGB565
{
struct RGB565 {
uint16_t r : 5;
uint16_t g : 6;
uint16_t b : 5;
} PACK_STRUCT;
} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct ARGB4
* \brief Data structure for a ARGB4444 pixel in a texture
*/
struct ARGB4
{
struct ARGB4 {
uint16_t a : 4;
uint16_t r : 4;
uint16_t g : 4;
uint16_t b : 4;
} PACK_STRUCT;
} /*PACK_STRUCT*/;
// -------------------------------------------------------------------------------------
/** \struct GroupSkin
* \brief Skin data structure #2 (group of pictures)
*/
struct GroupSkin
{
struct GroupSkin {
//! 0 = single (Skin), 1 = group (GroupSkin)
int32_t group;
@ -474,14 +455,13 @@ struct GroupSkin
//! Data of each image
uint8_t **data;
} PACK_STRUCT;
} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct TexCoord
* \brief Texture coordinate data structure used by the Quake1 MDL format
*/
struct TexCoord
{
struct TexCoord {
//! Is the vertex on the noundary between front and back piece?
int32_t onseam;
@ -490,33 +470,31 @@ struct TexCoord
//! Texture coordinate in the ty direction
int32_t t;
} PACK_STRUCT;
} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct TexCoord_MDL3
* \brief Data structure for an UV coordinate in the 3DGS MDL3 format
*/
struct TexCoord_MDL3
{
struct TexCoord_MDL3 {
//! position, horizontally in range 0..skinwidth-1
int16_t u;
//! position, vertically in range 0..skinheight-1
int16_t v;
} PACK_STRUCT;
} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct TexCoord_MDL7
* \brief Data structure for an UV coordinate in the 3DGS MDL7 format
*/
struct TexCoord_MDL7
{
struct TexCoord_MDL7 {
//! position, horizontally in range 0..1
float u;
//! position, vertically in range 0..1
float v;
} PACK_STRUCT;
} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct SkinSet_MDL7
@ -532,7 +510,7 @@ struct SkinSet_MDL7
//! Material index
int32_t material; // size 4
} PACK_STRUCT;
} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct Triangle
@ -545,7 +523,7 @@ struct Triangle
//! Vertex indices
int32_t vertex[3];
} PACK_STRUCT;
} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct Triangle_MDL3
@ -558,7 +536,7 @@ struct Triangle_MDL3
//! Index of 3 skin vertices in range 0..numskinverts
uint16_t index_uv[3];
} PACK_STRUCT;
} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct Triangle_MDL7
@ -571,7 +549,7 @@ struct Triangle_MDL7
//! Two skinsets. The second will be used for multi-texturing
SkinSet_MDL7 skinsets[2];
} PACK_STRUCT;
} /* PACK_STRUCT */;
#if (!defined AI_MDL7_TRIANGLE_STD_SIZE_ONE_UV)
# define AI_MDL7_TRIANGLE_STD_SIZE_ONE_UV (6+sizeof(SkinSet_MDL7)-sizeof(uint32_t))
@ -599,7 +577,7 @@ struct Vertex
{
uint8_t v[3];
uint8_t normalIndex;
} PACK_STRUCT;
} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
@ -625,8 +603,7 @@ struct Vertex_MDL7
uint8_t norm162index;
float norm[3];
};
} PACK_STRUCT;
} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct BoneTransform_MDL7
@ -643,12 +620,11 @@ struct BoneTransform_MDL7
//! I HATE 3DGS AND THE SILLY DEVELOPER WHO DESIGNED
//! THIS STUPID FILE FORMAT!
int8_t _unused_[2];
} PACK_STRUCT;
} /* PACK_STRUCT */;
#define AI_MDL7_MAX_FRAMENAMESIZE 16
// -------------------------------------------------------------------------------------
/** \struct Frame_MDL7
* \brief Frame data structure used by MDL7 files
@ -678,7 +654,7 @@ struct SimpleFrame
//! Vertex list of the frame
Vertex *verts;
} PACK_STRUCT;
} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct Frame
@ -691,7 +667,7 @@ struct Frame
//! Frame data
SimpleFrame frame;
} PACK_STRUCT;
} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
@ -708,7 +684,7 @@ struct SimpleFrame_MDLn_SP
//! Vertex list of the frame
Vertex_MDL4 *verts;
} PACK_STRUCT;
} /* PACK_STRUCT */;
// -------------------------------------------------------------------------------------
/** \struct GroupFrame
@ -730,7 +706,7 @@ struct GroupFrame
//! List of single frames
SimpleFrame *frames;
} PACK_STRUCT;
} /* PACK_STRUCT */;
#include "./../include/assimp/Compiler/poppack1.h"
@ -738,8 +714,7 @@ struct GroupFrame
/** \struct IntFace_MDL7
* \brief Internal data structure to temporarily represent a face
*/
struct IntFace_MDL7
{
struct IntFace_MDL7 {
// provide a constructor for our own convenience
IntFace_MDL7()
{