Skip to content

Commit

Permalink
Fix Travis warning: multi-character character constant [-Wmultichar]
Browse files Browse the repository at this point in the history
  • Loading branch information
boxa committed Jun 22, 2017
1 parent 8525e89 commit 7157b29
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 78 deletions.
15 changes: 6 additions & 9 deletions contrib/extractor/loadlib/adt.cpp
Expand Up @@ -53,7 +53,7 @@ bool ADT_file::prepareLoadedData()

bool adt_MHDR::prepareLoadedData()
{
if (fcc != uint32('MHDR'))
if (fcc != fcc_MHDR)
return false;

if (size != sizeof(adt_MHDR) - 8)
Expand All @@ -72,7 +72,7 @@ bool adt_MHDR::prepareLoadedData()

bool adt_MCIN::prepareLoadedData()
{
if (fcc != uint32('MCIN'))
if (fcc != fcc_MCIN)
return false;

// Check cells data
Expand All @@ -86,7 +86,7 @@ bool adt_MCIN::prepareLoadedData()

bool adt_MH2O::prepareLoadedData()
{
if (fcc != uint32('MH2O'))
if (fcc != fcc_MH2O)
return false;

// Check liquid data
Expand All @@ -98,7 +98,7 @@ bool adt_MH2O::prepareLoadedData()

bool adt_MCNK::prepareLoadedData()
{
if (fcc != uint32('MCNK'))
if (fcc != fcc_MCNK)
return false;

// Check height map
Expand All @@ -113,7 +113,7 @@ bool adt_MCNK::prepareLoadedData()

bool adt_MCVT::prepareLoadedData()
{
if (fcc != uint32('MCVT'))
if (fcc != fcc_MCVT)
return false;

if (size != sizeof(adt_MCVT) - 8)
Expand All @@ -124,8 +124,5 @@ bool adt_MCVT::prepareLoadedData()

bool adt_MCLQ::prepareLoadedData()
{
if (fcc != uint32('MCLQ'))
return false;

return true;
return fcc == fcc_MCLQ;
}
63 changes: 28 additions & 35 deletions contrib/extractor/loadlib/adt.h
Expand Up @@ -18,21 +18,27 @@ enum LiquidType
//**************************************************************************************
// ADT file class
//**************************************************************************************

#define ADT_CELLS_PER_GRID 16
#define ADT_CELL_SIZE 8
#define ADT_GRID_SIZE (ADT_CELLS_PER_GRID*ADT_CELL_SIZE)

#define fcc_MHDR 0x4d484452 // MHDR
#define fcc_MCIN 0x4d43494e // MCIN
#define fcc_MH2O 0x4d48324f // MH2O
#define fcc_MCNK 0x4d434e4b // MCNK
#define fcc_MCVT 0x4d435654 // MCVT
#define fcc_MCLQ 0x4d434c51 // MCLQ

//
// Adt file height map chunk
//
class adt_MCVT
{
union
{
uint32 fcc;
char fcc_txt[4];
};
private:
uint32 fcc;
uint32 size;

public:
float height_map[(ADT_CELL_SIZE + 1) * (ADT_CELL_SIZE + 1) + ADT_CELL_SIZE * ADT_CELL_SIZE];

Expand All @@ -44,12 +50,10 @@ class adt_MCVT
//
class adt_MCLQ
{
union
{
uint32 fcc;
char fcc_txt[4];
};
private:
uint32 fcc;
uint32 size;

public:
float height1;
float height2;
Expand All @@ -75,12 +79,10 @@ class adt_MCLQ
//
class adt_MCNK
{
union
{
uint32 fcc;
char fcc_txt[4];
};
private:
uint32 fcc;
uint32 size;

public:
uint32 flags;
uint32 ix;
Expand Down Expand Up @@ -136,12 +138,10 @@ class adt_MCNK
//
class adt_MCIN
{
union
{
uint32 fcc;
char fcc_txt[4];
};
private:
uint32 fcc;
uint32 size;

public:
struct adt_CELLS
{
Expand Down Expand Up @@ -183,14 +183,11 @@ struct adt_liquid_header
//
class adt_MH2O
{
public:
union
{
uint32 fcc;
char fcc_txt[4];
};
private:
uint32 fcc;
uint32 size;

public:
struct adt_LIQUID
{
uint32 offsData1;
Expand Down Expand Up @@ -256,14 +253,10 @@ class adt_MH2O
//
class adt_MHDR
{
union
{
uint32 fcc;
char fcc_txt[4];
};
private:
uint32 fcc;
uint32 size;

uint32 pad;
uint32 flags;
uint32 offsMCIN; // MCIN
uint32 offsTex; // MTEX
uint32 offsModels; // MMDX
Expand All @@ -281,8 +274,8 @@ class adt_MHDR
uint32 data5;
public:
bool prepareLoadedData();
adt_MCIN* getMCIN() { return (adt_MCIN*)((uint8*)&pad + offsMCIN); }
adt_MH2O* getMH2O() { return offsMH2O ? (adt_MH2O*)((uint8*)&pad + offsMH2O) : 0; }
adt_MCIN* getMCIN() { return (adt_MCIN*)((uint8*)&flags + offsMCIN); }
adt_MH2O* getMH2O() { return offsMH2O ? (adt_MH2O*)((uint8*)&flags + offsMH2O) : 0; }
};

class ADT_file : public FileLoader
Expand Down
2 changes: 1 addition & 1 deletion contrib/extractor/loadlib/loadlib.cpp
Expand Up @@ -50,7 +50,7 @@ bool FileLoader::prepareLoadedData()
{
// Check version
version = (file_MVER*) data;
if (version->fcc != uint32('MVER'))
if (version->fcc != fcc_MVER)
return false;
if (version->ver != FILE_FORMAT_VERSION)
return false;
Expand Down
12 changes: 7 additions & 5 deletions contrib/extractor/loadlib/loadlib.h
Expand Up @@ -29,24 +29,25 @@ typedef uint8_t uint8;

#define FILE_FORMAT_VERSION 18

#define fcc_MVER 0x4d564552 // MVER

//
// File version chunk
//

struct file_MVER
{
union
{
uint32 fcc;
char fcc_txt[4];
};
uint32 fcc;
uint32 size;
uint32 ver;
};

class FileLoader
{
private:
uint8* data;
uint32 data_size;

public:
virtual bool prepareLoadedData();
uint8* GetData() {return data;}
Expand All @@ -58,4 +59,5 @@ class FileLoader
bool loadFile(char* filename, bool log = true);
virtual void free();
};

#endif
12 changes: 3 additions & 9 deletions contrib/extractor/loadlib/wdt.cpp
Expand Up @@ -4,23 +4,17 @@

bool wdt_MWMO::prepareLoadedData()
{
if (fcc != uint32('MWMO'))
return false;
return true;
return fcc == fcc_MWMO;
}

bool wdt_MPHD::prepareLoadedData()
{
if (fcc != uint32('MPHD'))
return false;
return true;
return fcc == fcc_MPHD;
}

bool wdt_MAIN::prepareLoadedData()
{
if (fcc != uint32('MAIN'))
return false;
return true;
return fcc == fcc_MAIN;
}

WDT_file::WDT_file()
Expand Down
35 changes: 16 additions & 19 deletions contrib/extractor/loadlib/wdt.h
Expand Up @@ -5,30 +5,30 @@
//**************************************************************************************
// WDT file class and structures
//**************************************************************************************

#define WDT_MAP_SIZE 64

#define fcc_MWMO 0x4d574d4f // MWMO
#define fcc_MPHD 0x4d504844 // MPHD
#define fcc_MAIN 0x4d41494e // MAIN

class wdt_MWMO
{
union
{
uint32 fcc;
char fcc_txt[4];
};
private:
uint32 fcc;

public:
uint32 size;
bool prepareLoadedData();
};

class wdt_MPHD
{
union
{
uint32 fcc;
char fcc_txt[4];
};
private:
uint32 fcc;

public:
uint32 size;

uint32 data1;
uint32 data2;
uint32 data3;
Expand All @@ -42,14 +42,11 @@ class wdt_MPHD

class wdt_MAIN
{
union
{
uint32 fcc;
char fcc_txt[4];
};
private:
uint32 fcc;

public:
uint32 size;

struct adtData
{
uint32 exist;
Expand All @@ -62,7 +59,7 @@ class wdt_MAIN
class WDT_file : public FileLoader
{
public:
bool prepareLoadedData();
bool prepareLoadedData();

WDT_file();
~WDT_file();
Expand All @@ -73,4 +70,4 @@ class WDT_file : public FileLoader
wdt_MWMO* wmo;
};

#endif
#endif

1 comment on commit 7157b29

@boxa
Copy link
Contributor Author

@boxa boxa commented on 7157b29 Jun 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finally there is not any warnings

Please sign in to comment.