Commit 4bf7ef38 authored by hybrid's avatar hybrid

Fix pack and unpack include file to properly work under MSVC as well. Needs to...

Fix pack and unpack include file to properly work under MSVC as well. Needs to suppress warning as we don't have the push and pop together anymore.
Fix push and pop usage - some files forgot to add the define, so effectively not work under gcc with special architectures - and move all files to use the new include files.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4196 dfc29bdd-3216-0410-991c-e03cc46cb475
parent b4f7ef5f
......@@ -75,31 +75,23 @@ namespace scene
// byte-align structures
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error compiler not supported
#endif
#include "irrpack.h"
//! this holds the header info of the MD3 file
struct SMD3Header
{
c8 headerID[4]; //id of file, always "IDP3"
s32 Version; //this is a version number, always 15
s32 Version; //this is a version number, always 15
s8 fileName[68]; //sometimes left Blank... 65 chars, 32bit aligned == 68 chars
s32 numFrames; //number of KeyFrames
s32 numTags; //number of 'tags' per frame
s32 numMeshes; //number of meshes/skins
s32 numFrames; //number of KeyFrames
s32 numTags; //number of 'tags' per frame
s32 numMeshes; //number of meshes/skins
s32 numMaxSkins; //maximum number of unique skins used in md3 file. artefact md2
s32 frameStart; //starting position of frame-structur
s32 tagStart; //starting position of tag-structures
s32 tagEnd; //ending position of tag-structures/starting position of mesh-structures
s32 frameStart; //starting position of frame-structur
s32 tagStart; //starting position of tag-structures
s32 tagEnd; //ending position of tag-structures/starting position of mesh-structures
s32 fileSize;
};
} PACK_STRUCT;
//! this holds the header info of an MD3 mesh section
struct SMD3MeshHeader
......@@ -117,7 +109,7 @@ namespace scene
s32 offset_st; //starting position of texvector data, relative to start of Mesh_Header
s32 vertexStart; //starting position of vertex data,relative to start of Mesh_Header
s32 offset_end;
};
} PACK_STRUCT;
//! Compressed Vertex Data
......@@ -125,28 +117,24 @@ namespace scene
{
s16 position[3];
u8 normal[2];
};
} PACK_STRUCT;
//! Texture Coordinate
struct SMD3TexCoord
{
f32 u;
f32 v;
};
} PACK_STRUCT;
//! Triangle Index
struct SMD3Face
{
s32 Index[3];
};
} PACK_STRUCT;
// Default alignment
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#endif
#undef PACK_STRUCT
#include "irrunpack.h"
//! Holding Frame Data for a Mesh
struct SMD3MeshBuffer : public IReferenceCounted
......
......@@ -2,11 +2,25 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
// include this file right before the data structures to be 1-aligned
// and add to each structure the PACK_STRUCT define just like this:
// struct mystruct
// {
// ...
// } PACK_STRUCT;
// Always include the irrunpack.h file right after the last type declared
// like this, and do not put any other types with different alignment
// in between!
// byte-align structures
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma warning(disable: 4103)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __DMC__ )
# pragma pack( push, 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
......
......@@ -2,9 +2,14 @@
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
// include this file to switch back to default alignment
// file belongs to irrpack.h, see there for more info
// Default alignment
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#elif defined (__DMC__)
# pragma pack( pop )
#endif
#undef PACK_STRUCT
......
......@@ -40,16 +40,8 @@ public:
private:
// byte-align structures
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error compiler not supported
#endif
// byte-align structures
#include "irrpack.h"
struct ChunkHeader
{
......@@ -57,13 +49,8 @@ private:
s32 length;
} PACK_STRUCT;
// Default alignment
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#endif
#undef PACK_STRUCT
// Default alignment
#include "irrunpack.h"
struct ChunkData
{
......
......@@ -19,16 +19,6 @@ namespace scene
{
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error compiler not supported
#endif
// STUDIO MODELS, Copyright (c) 1998, Valve LLC. All rights reserved.
#define MAXSTUDIOTRIANGLES 20000 // TODO: tune this
#define MAXSTUDIOVERTS 2048 // TODO: tune this
......@@ -48,6 +38,9 @@ namespace scene
typedef f32 vec3_hl[3]; // x,y,z
typedef f32 vec4_hl[4]; // x,y,z,w
// byte-align structures
#include "irrpack.h"
struct SHalflifeHeader
{
c8 id[4];
......@@ -104,14 +97,14 @@ namespace scene
} PACK_STRUCT;
// header for demand loaded sequence group data
typedef struct
struct studioseqhdr_t
{
s32 id;
s32 version;
c8 name[64];
s32 length;
} PACK_STRUCT studioseqhdr_t;
} PACK_STRUCT;
// bones
struct SHalflifeBone
......@@ -207,22 +200,22 @@ namespace scene
} PACK_STRUCT;
// events
typedef struct
struct mstudioevent_t
{
s32 frame;
s32 event;
s32 type;
c8 options[64];
} PACK_STRUCT mstudioevent_t;
} PACK_STRUCT;
// pivots
typedef struct
struct mstudiopivot_t
{
vec3_hl org; // pivot point
s32 start;
s32 end;
} PACK_STRUCT mstudiopivot_t;
} PACK_STRUCT;
// attachment
struct SHalflifeAttachment
......@@ -298,14 +291,17 @@ namespace scene
// meshes
typedef struct
struct SHalflifeMesh
{
u32 numtris;
u32 triindex;
u32 skinref;
u32 numnorms; // per mesh normals
u32 normindex; // normal vec3_hl
} PACK_STRUCT SHalflifeMesh;
} PACK_STRUCT;
// Default alignment
#include "irrunpack.h"
// lighting options
#define STUDIO_NF_FLATSHADE 0x0001
......@@ -343,12 +339,6 @@ namespace scene
#define RAD_TO_STUDIO (32768.0/M_PI)
#define STUDIO_TO_RAD (M_PI/32768.0)
// Default alignment
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#endif
#undef PACK_STRUCT
/*!
Textureatlas
Combine Source Images with arbitrary size and bithdepth to an Image with 2^n size
......
......@@ -14,16 +14,8 @@ namespace scene
{
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error compiler not supported
#endif
// byte-align structures
#include "irrpack.h"
//! General properties of a single animation frame.
struct SMD3Frame
......@@ -33,7 +25,7 @@ struct SMD3Frame
f32 position[3]; // position of bounding box
f32 radius; // radius of bounding sphere
c8 creator[16]; // name of frame
};
} PACK_STRUCT;
//! An attachment point for another MD3 model.
......@@ -42,23 +34,17 @@ struct SMD3Tag
c8 Name[64]; //name of 'tag' as it's usually called in the md3 files try to see it as a sub-mesh/seperate mesh-part.
f32 position[3]; //relative position of tag
f32 rotationMatrix[9]; //3x3 rotation direction of tag
};
} PACK_STRUCT;
//!Shader
struct SMD3Shader
{
c8 name[64]; // name of shader
s32 shaderIndex;
};
} PACK_STRUCT;
// Default alignment
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#endif
#undef PACK_STRUCT
#include "irrunpack.h"
//! Constructor
......
......@@ -18,16 +18,8 @@ namespace video
#if defined(_IRR_COMPILE_WITH_BMP_LOADER_) || defined(_IRR_COMPILE_WITH_BMP_WRITER_)
// byte-align structures
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error compiler not supported
#endif
// byte-align structures
#include "irrpack.h"
struct SBMPHeader
{
......@@ -64,13 +56,8 @@ namespace video
u32 ImportantColors;
} PACK_STRUCT;
// Default alignment
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#endif
#undef PACK_STRUCT
#include "irrunpack.h"
#endif // defined with loader or writer
......
......@@ -16,18 +16,6 @@ namespace video
#if defined(_IRR_COMPILE_WITH_DDS_LOADER_)
// byte-align structures
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# define PACK_STRUCT
#endif
/* dependencies */
/* dds definition */
enum eDDSPixelFormat
......@@ -49,6 +37,9 @@ enum eDDSPixelFormat
#define DDS_HI_555 0x7C00;
// byte-align structures
#include "irrpack.h"
/* structures */
struct ddsColorKey
{
......@@ -193,6 +184,9 @@ struct ddsColor
u8 r, g, b, a;
} PACK_STRUCT;
// Default alignment
#include "irrunpack.h"
/* endian tomfoolery */
typedef union
......@@ -275,13 +269,6 @@ floatSwapUnion;
#endif /*__BIG_ENDIAN__*/
// Default alignment
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#endif
#undef PACK_STRUCT
#endif // compiled with loader or reader
#ifdef _IRR_COMPILE_WITH_DDS_LOADER_
......
......@@ -17,15 +17,7 @@ namespace video
#if defined(_IRR_COMPILE_WITH_PCX_LOADER_) || defined(_IRR_COMPILE_WITH_PCX_WRITER_)
// byte-align structures
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error compiler not supported
#endif
#include "irrpack.h"
struct SPCXHeader
{
......@@ -51,11 +43,7 @@ namespace video
// Default alignment
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#endif
#undef PACK_STRUCT
#include "irrunpack.h"
#endif // compile with loader or writer
......
......@@ -18,15 +18,7 @@ namespace video
// byte-align structures
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error compiler not supported
#endif
#include "irrpack.h"
struct PsdHeader
{
......@@ -42,11 +34,7 @@ namespace video
// Default alignment
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#endif
#undef PACK_STRUCT
#include "irrunpack.h"
/*!
Surface Loader for psd images
......
......@@ -32,41 +32,29 @@ namespace video
{
// byte-align structures
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error compiler not supported
#endif
#include "irrpack.h"
// the RGB image file header structure
struct SRGBHeader
{
u16 Magic; // IRIS image file magic number
u8 Storage; // Storage format
u8 BPC; // Number of bytes per pixel channel
u16 Dimension; // Number of dimensions
u16 Xsize; // X size in pixels
u16 Ysize; // Y size in pixels
u16 Zsize; // Z size in pixels
u32 Pixmin; // Minimum pixel value
u32 Pixmax; // Maximum pixel value
u32 Dummy1; // ignored
char Imagename[80]; // Image name
u32 Colormap; // Colormap ID
// char Dummy2[404]; // Ignored
u16 Magic; // IRIS image file magic number
u8 Storage; // Storage format
u8 BPC; // Number of bytes per pixel channel
u16 Dimension; // Number of dimensions
u16 Xsize; // X size in pixels
u16 Ysize; // Y size in pixels
u16 Zsize; // Z size in pixels
u32 Pixmin; // Minimum pixel value
u32 Pixmax; // Maximum pixel value
u32 Dummy1; // ignored
char Imagename[80];// Image name
u32 Colormap; // Colormap ID
// char Dummy2[404];// Ignored
} PACK_STRUCT;
// Default alignment
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#endif
#undef PACK_STRUCT
#include "irrunpack.h"
// this structure holds context specific data about the file being loaded.
......
......@@ -18,15 +18,7 @@ namespace video
#if defined(_IRR_COMPILE_WITH_TGA_LOADER_) || defined(_IRR_COMPILE_WITH_TGA_WRITER_)
// byte-align structures
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# define PACK_STRUCT
#endif
#include "irrpack.h"
// these structs are also used in the TGA writer
struct STGAHeader{
......@@ -52,11 +44,7 @@ namespace video
} PACK_STRUCT;
// Default alignment
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#endif
#undef PACK_STRUCT
#include "irrunpack.h"
#endif // compiled with loader or reader
......
......@@ -17,53 +17,6 @@ namespace irr
{
namespace video
{
#if 0
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error compiler not supported
#endif
struct SWALHeader {
char FrameName[32];
u32 ImageWidth;
u32 ImageHeight;
s32 MipmapOffset[4];
char NextFrameName[32];
u32 Flags; // surface properties, i.e. slick, sky, nodraw
u32 Contents; // i.e. solid, clip, area portal
u32 Value; // light
} PACK_STRUCT;
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#endif
#undef PACK_STRUCT
//! An Irrlicht image loader for Quake engine WAL textures
class CImageLoaderWAL : public irr::video::IImageLoader
{
public:
virtual bool isALoadableFileExtension(const io::path& filename) const;
virtual bool isALoadableFileFormat(irr::io::IReadFile* file) const;
virtual irr::video::IImage* loadImage(irr::io::IReadFile* file) const;
private:
static s32 DefaultPaletteQ2[256];
};
#endif
//! An Irrlicht image loader for Quake1,2 engine lmp textures/palette
class CImageLoaderLMP : public irr::video::IImageLoader
......@@ -92,23 +45,14 @@ public:
virtual irr::video::IImage* loadImage(irr::io::IReadFile* file) const;
};
// byte-align structures
#include "irrpack.h"
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error compiler not supported
#endif
struct SLMPHeader {
u32 width; // width
u32 height; // height
// variably sized
} PACK_STRUCT;
struct SLMPHeader {
u32 width; // width
u32 height; // height
// variably sized
} PACK_STRUCT;
// Halfelife wad3 type 67 file
struct miptex_halflife
......@@ -131,11 +75,8 @@ public:
s32 value;
};
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#endif
#undef PACK_STRUCT
// Default alignment
#include "irrunpack.h"
}
}
......
......@@ -50,15 +50,7 @@ private:
void cleanup();
// byte-align structures
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error compiler not supported
#endif
#include "irrpack.h"
struct SLMTSHeader
{
......@@ -98,11 +90,7 @@ private:
} PACK_STRUCT;
// Default alignment
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#endif
#undef PACK_STRUCT
#include "irrunpack.h"
SLMTSHeader Header;
SLMTSTextureInfoEntry* Textures;
......
......@@ -15,22 +15,15 @@ namespace scene
{
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error compiler not supported
#endif
// structs needed to load the md2-format
const s32 MD2_MAGIC_NUMBER = 844121161;
const s32 MD2_VERSION = 8;
const s32 MD2_MAX_VERTS = 2048;
// byte-align structures
#include "irrpack.h"
struct SMD2Header
{
s32 magic; // four character code "IDP2"
......@@ -85,11 +78,7 @@ namespace scene
} PACK_STRUCT;
// Default alignment
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#endif
#undef PACK_STRUCT
#include "irrunpack.h"
//! Constructor
CMD2MeshFileLoader::CMD2MeshFileLoader()
......
......@@ -21,15 +21,7 @@ namespace scene
#endif
// byte-align structures
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error compiler not supported
#endif
#include "irrpack.h"
namespace {
// File header
......@@ -103,11 +95,7 @@ struct MS3DVertexWeights
} // end namespace
// Default alignment
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#endif
#undef PACK_STRUCT
#include "irrunpack.h"
struct SGroup
{
......
......@@ -29,18 +29,8 @@ namespace scene
// MY3D stuff
//**********************************************************************
//--------------------------------------------------------------------
// byte-align structures
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error compiler not supported
#endif
//----------------------------------------------------------------------
#include "irrpack.h"
struct SMyVector3
{ SMyVector3 () {;}
......@@ -135,9 +125,7 @@ struct SMyRLEHeader
} PACK_STRUCT;
// Default alignment
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#endif
#include "irrunpack.h"
} // end namespace
} // end namespace
......
......@@ -43,18 +43,9 @@ namespace irr
namespace scene
{
//--------------------------------------------------------------------
// byte-align structures
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error compiler not supported
#endif
//----------------------------------------------------------------------
#include "irrpack.h"
struct SMyColor
{ SMyColor () {;}
SMyColor (s32 __R, s32 __G, s32 __B, s32 __A)
......@@ -76,9 +67,7 @@ struct SMyMaterialHeader
} PACK_STRUCT;
// Default alignment
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#endif
#include "irrunpack.h"
class CMY3DMeshFileLoader : public IMeshLoader
{
......
......@@ -46,16 +46,8 @@ public:
private:
// byte-align structures
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error compiler not supported
#endif
// byte-align structures
#include "irrpack.h"
struct ChunkHeader
{
......@@ -63,12 +55,8 @@ private:
u32 length;
} PACK_STRUCT;
// Default alignment
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#endif
#undef PACK_STRUCT
// Default alignment
#include "irrunpack.h"
struct ChunkData
......
......@@ -21,16 +21,6 @@ namespace irr
namespace io
{
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error compiler not supported
#endif
enum E_TAR_LINK_INDICATOR
{
ETLI_REGULAR_FILE_OLD = 0 ,
......@@ -44,6 +34,9 @@ namespace io
ETLI_CONTIGUOUS_FILE = '7'
};
// byte-align structures
#include "irrpack.h"
struct STarHeader
{
c8 FileName[100];
......@@ -64,13 +57,8 @@ namespace io
c8 FileNamePrefix[155];
} PACK_STRUCT;
// Default alignment
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#endif
#undef PACK_STRUCT
#include "irrunpack.h"
//! Archiveloader capable of loading ZIP Archives
class CArchiveLoaderTAR : public IArchiveLoader
......
......@@ -20,16 +20,6 @@ namespace irr
{
namespace io
{
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error compiler not supported
#endif
enum eWADFileTypes
{
......@@ -53,6 +43,9 @@ namespace io
WAD_TYP_FONT = 70,
};
// byte-align structures
#include "irrpack.h"
struct SWADFileHeader
{
c8 tag[4]; // type of WAD format WAD2 = quake2, WAD3 = halflife
......@@ -72,11 +65,7 @@ namespace io
} PACK_STRUCT;
// Default alignment
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#endif
#undef PACK_STRUCT
#include "irrunpack.h"
struct SWADFileEntry
{
......
......@@ -25,16 +25,8 @@ namespace io
// zero in the local header
const s16 ZIP_INFO_IN_DATA_DESCRIPTOR = 0x0008;
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error compiler not supported
#endif
// byte-align structures
#include "irrpack.h"
struct SZIPFileDataDescriptor
{
......@@ -131,11 +123,7 @@ namespace io
} PACK_STRUCT;
// Default alignment
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#endif
#undef PACK_STRUCT
#include "irrunpack.h"
//! Contains extended info about zip files in the archive
struct SZipFileEntry
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment