1
0
Fork 0

Place #ifdef's around MSVC #pragma's

Rewrite some signed/unsigned unions to use casts.


Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@956
This commit is contained in:
Sjoerd van der Berg 2003-04-23 07:33:06 +00:00
parent d8eae49c04
commit 4916b5fb6c
10 changed files with 55 additions and 21 deletions

View file

@ -22,14 +22,16 @@
#include <dos_system.h>
#include <mem.h>
#ifdef _MSC_VER
#pragma pack (1)
#endif
struct CommandTail{
Bit8u count; /* number of bytes returned */
char buffer[127]; /* the buffer itself */
} GCC_ATTRIBUTE(packed);
#ifdef _MSC_VER
#pragma pack ()
#endif
struct DOS_Date {
Bit16u year;
@ -263,7 +265,9 @@ public:
Bit16u FindEntryByHandle (Bit8u handle);
private:
#ifdef _MSC_VER
#pragma pack(1)
#endif
struct sPSP {
Bit8u exit[2]; /* CP/M-like exit poimt */
Bit16u next_seg; /* Segment of first byte beyond memory allocated or program */
@ -289,7 +293,9 @@ private:
Bit8u fill_4[4]; /* unused */
CommandTail cmdtail;
} GCC_ATTRIBUTE(packed);
#pragma pack()
#ifdef _MSC_VER
#pragma pack()
#endif
Bit16u seg;
sPSP* psp;
public:
@ -302,7 +308,9 @@ public:
void Clear(void);
void LoadData(void);
void SaveData(void); /* Save it as an exec block */
#ifdef _MSC_VER
#pragma pack (1)
#endif
struct sOverlay {
Bit16u loadseg;
Bit16u relocation;
@ -315,7 +323,9 @@ public:
RealPt initsssp;
RealPt initcsip;
}GCC_ATTRIBUTE(packed);
#ifdef _MSC_VER
#pragma pack()
#endif
sExec exec;
sOverlay overlay;
};
@ -328,7 +338,9 @@ public:
void SetfirstFileTable(RealPt _first_table);
RealPt GetPointer (void);
private:
#ifdef _MSC_VER
#pragma pack(1)
#endif
struct sDIB {
Bit8u stuff1[22]; // some stuff, hopefully never used....
Bit16u firstMCB; // first memory control block
@ -342,7 +354,9 @@ private:
RealPt fcbTable; // pointer to system FCB table
// some more stuff, hopefully never used.
} GCC_ATTRIBUTE(packed);
#ifdef _MSC_VER
#pragma pack ()
#endif
Bit16u seg;
};
@ -360,7 +374,9 @@ public:
void SetDirID(Bit16u entry) { sSave(sDTA,dirID,entry); };
Bit16u GetDirID(void) { return sGet(sDTA,dirID); };
private:
#ifdef _MSC_VER
#pragma pack(1)
#endif
struct sDTA {
Bit8u sdrive; /* The Drive the search is taking place */
Bit8u sattr; /* The Attributes that need to be found */
@ -374,7 +390,9 @@ private:
Bit32u size;
char name[DOS_NAMELENGTH_ASCII];
} GCC_ATTRIBUTE(packed);
#ifdef _MSC_VER
#pragma pack()
#endif
};
class DOS_FCB: public MemStruct {
@ -397,7 +415,9 @@ public:
private:
bool extended;
PhysPt real_pt;
#ifdef _MSC_VER
#pragma pack (1)
#endif
struct sFCB {
Bit8u drive; /* Drive number 0=default, 1=A, etc */
Bit8u filename[8]; /* Space padded name */
@ -414,7 +434,9 @@ private:
Bit8u cur_rec; /* Current record in current block */
Bit32u rndm; /* Current relative record number */
} GCC_ATTRIBUTE(packed);
#ifdef _MSC_VER
#pragma pack ()
#endif
};
class DOS_MCB : public MemStruct{
@ -429,7 +451,9 @@ public:
Bit16u GetSize(void) { return sGet(sMCB,size);}
Bit16u GetPSPSeg(void) { return sGet(sMCB,psp_segment);}
private:
#ifdef _MSC_VER
#pragma pack (1)
#endif
struct sMCB {
Bit8u type;
Bit16u psp_segment;
@ -437,7 +461,9 @@ private:
Bit8u unused[3];
Bit8u filename[8];
} GCC_ATTRIBUTE(packed);
#ifdef _MSC_VER
#pragma pack ()
#endif
};
extern DOS_InfoBlock dos_infoblock;;

View file

@ -19,7 +19,9 @@
#ifndef _SETUP_H_
#define _SETUP_H_
#ifdef _MSC_VER
#pragma warning ( disable : 4786 )
#endif
#include <cross.h>
#include <string>

View file

@ -162,14 +162,14 @@ switch (Fetchb()) {
case 0xbe: /* MOVSX Gd,Eb */
{
GetRMrd;
if (rm >= 0xc0 ) {GetEArb;*rmrd=*earbs;}
if (rm >= 0xc0 ) {GetEArb;*rmrd=*(Bit8s *)earb;}
else {GetEAa;*rmrd=LoadMbs(eaa);}
break;
}
case 0xbf: /* MOVSX Gd,Ew */
{
GetRMrd;
if (rm >= 0xc0 ) {GetEArw;*rmrd=*earws;}
if (rm >= 0xc0 ) {GetEArw;*rmrd=*(Bit16s *)earw;}
else {GetEAa;*rmrd=LoadMws(eaa);}
break;
}

View file

@ -381,7 +381,7 @@ switch(Fetchb()) {
case 0xbe: /* MOVSX Gw,Eb */
{
GetRMrw;
if (rm >= 0xc0 ) {GetEArb;*rmrw=*earbs;}
if (rm >= 0xc0 ) {GetEArb;*rmrw=*(Bit8s *)earb;}
else {GetEAa;*rmrw=LoadMbs(eaa);}
break;
}

View file

@ -53,24 +53,12 @@ extern Bit32u * lookupRMEAregd[256];
#define GetEArb \
union { \
Bit8u * earb; \
Bit8s * earbs; \
}; \
earb=lookupRMEAregb[rm];
Bit8u * earb=lookupRMEAregb[rm];
#define GetEArw \
union { \
Bit16u * earw; \
Bit16s * earws; \
}; \
earw=lookupRMEAregw[rm];
Bit16u * earw=lookupRMEAregw[rm];
#define GetEArd \
union { \
Bit32u * eard; \
Bit32s * eards; \
}; \
eard=lookupRMEAregd[rm];
Bit32u * eard=lookupRMEAregd[rm];

View file

@ -24,7 +24,9 @@
#include "callback.h"
#include "debug.h"
#ifdef _MSC_VER
#pragma pack(1)
#endif
struct EXE_Header {
Bit16u signature; /* EXE Signature MZ or ZM */
Bit16u extrabytes; /* Bytes on the last page */
@ -41,7 +43,9 @@ struct EXE_Header {
Bit16u reloctable;
Bit16u overlay;
} GCC_ATTRIBUTE(packed);
#ifdef _MSC_VER
#pragma pack()
#endif
#define MAGIC1 0x5a4d
#define MAGIC2 0x4d5a

View file

@ -518,7 +518,9 @@ Bit8u FCB_Parsename(Bit16u seg,Bit16u offset,Bit8u parser ,char *string, Bit8u *
hasdrive=hasname=hasext=false;
Bitu index;bool finished;Bit8u fill;
/* First get the old data from the fcb */
#ifdef _MSC_VER
#pragma pack (1)
#endif
union {
struct {
char drive[2];
@ -527,7 +529,9 @@ Bit8u FCB_Parsename(Bit16u seg,Bit16u offset,Bit8u parser ,char *string, Bit8u *
} part GCC_ATTRIBUTE (packed) ;
char full[DOS_FCBNAME];
} fcb_name;
#ifdef _MSC_VER
#pragma pack()
#endif
/* Get the old information from the previous fcb */
fcb.GetName(fcb_name.full);fcb_name.part.drive[1]=0;fcb_name.part.name[8]=0;fcb_name.part.ext[3]=0;
/* Strip of the leading sepetaror */

View file

@ -61,7 +61,9 @@ public:
void SetStrategy (Bit16u ofs) { sSave(sDeviceHeader,strategy,ofs); };
public:
#ifdef _MSC_VER
#pragma pack(1)
#endif
struct sDeviceHeader{
RealPt nextDeviceHeader;
Bit16u devAttributes;
@ -72,7 +74,9 @@ public:
Bit8u driveLetter;
Bit8u numSubUnits;
} TDeviceHeader;
#ifdef _MSC_VER
#pragma pack()
#endif
};
class CMscdex

View file

@ -20,13 +20,17 @@
#include "mem.h"
#include "dos_inc.h"
#ifdef _MSC_VER
#pragma pack(1)
#endif
struct DOS_TableCase {
Bit16u size;
Bit8u chars[256];
}
GCC_ATTRIBUTE (packed);
#ifdef _MSC_VER
#pragma pack ()
#endif
RealPt DOS_TableUpCase;
RealPt DOS_TableLowCase;

View file

@ -33,9 +33,11 @@ namespace MAME {
/* Defines */
# define logerror(x)
#ifdef _MSC_VER
/* Disable recurring warnings */
# pragma warning ( disable : 4018 )
# pragma warning ( disable : 4244 )
#endif
/* Work around ANSI compliance problem (see driver.h) */
struct __MALLOCPTR {