--- oless/h/page.hxx Sat Dec 23 17:37:48 2000 +++ oless/h/page.hxx Fri Apr 25 12:43:54 2003 @@ -60,5 +60,5 @@ inline ULONG GetOffset(void) const; inline SECT GetSect(void) const; - inline void *GetData(void) const; + inline BYTE *GetData(void) const; inline DWORD GetFlags(void) const; inline CPagedVector * GetVector(void) const; @@ -92,19 +92,4 @@ DWORD _dwFlags; LONG _cReferences; - -#ifdef _MSC_VER - // disable compiler warning C4200: nonstandard extension used : - // zero-sized array in struct/union -#pragma warning(disable: 4200) - BYTE _ab[0]; -#pragma warning(default: 4200) -#else -# ifdef __GNUC__ - BYTE _ab[0]; -# else - // FIXME: brain damage - BYTE* _ab; -# endif -#endif }; @@ -234,7 +219,7 @@ //---------------------------------------------------------------------------- -inline void * CMSFPage::GetData(void) const +inline BYTE * CMSFPage::GetData(void) const { - return (void *) _ab; + return ((BYTE *)this) + sizeof(CMSFPage); } --- oless/h/dir.hxx Wed Apr 23 22:20:35 2003 +++ oless/h/dir.hxx Fri Apr 25 16:39:34 2003 @@ -167,18 +167,13 @@ private: -#ifdef _MSC_VER -#pragma warning(disable: 4200) - CDirEntry _adeEntry[]; -#pragma warning(default: 4200) -#else -# ifdef __GNUC__ - CDirEntry _adeEntry[0]; -# else - // FIXME: braindamage - CDirEntry* _adeEntry; -# endif -#endif - + // GetEntries() relies on the fact, there are no data + // fields in the class... + inline CDirEntry* GetEntries(void) const; }; + +inline CDirEntry * CDirSect::GetEntries(void) const +{ + return (CDirEntry *)this; +} //+------------------------------------------------------------------------- --- oless/h/fat.hxx Sat Dec 23 17:37:48 2000 +++ oless/h/fat.hxx Fri Apr 25 16:35:20 2003 @@ -51,23 +51,18 @@ inline void ByteSwap(USHORT cbSector); -private: - -#ifdef _MSC_VER -#pragma warning(disable: 4200) - SECT _asectEntry[]; -#pragma warning(default: 4200) -#else -# ifdef __GNUC__ - SECT _asectEntry[0]; -# else -// FIXME: brain damage - SECT* _asectEntry; -# endif -#endif +private: + // GetSects() relies on the fact, that the class has no + // data fields... + inline SECT * GetSects(void) const; }; +inline SECT * CFatSect::GetSects(void) const +{ + return (SECT *)this; +} + inline SECT CFatSect::GetSect(const FSOFFSET sect) const { - return _asectEntry[sect]; + return GetSects()[sect]; } @@ -75,15 +70,15 @@ const SECT sectNew) { - _asectEntry[sect] = sectNew; + GetSects()[sect] = sectNew; } inline SECT CFatSect::GetNextFat(USHORT uSize) const { - return _asectEntry[uSize]; + return GetSects()[uSize]; } inline void CFatSect::SetNextFat(USHORT uSize, const SECT sect) { - _asectEntry[uSize] = sect; + GetSects()[uSize] = sect; } @@ -92,5 +87,5 @@ // swap all sectors in the sector for (FSOFFSET i=0; i < cbSector; i++) - ::ByteSwap(&(_asectEntry[i])); + ::ByteSwap(GetSects() + i); } --- oless/h/dirfunc.hxx Sat Dec 23 17:37:48 2000 +++ oless/h/dirfunc.hxx Fri Apr 25 13:55:34 2003 @@ -168,5 +168,5 @@ inline CDirEntry* CDirSect::GetEntry(DIROFFSET iEntry) { - return &(_adeEntry[iEntry]); + return GetEntries() + iEntry; } @@ -207,5 +207,5 @@ { for (unsigned int i=0; i< (cbSector/sizeof(CDirEntry)); i++) - _adeEntry[i].ByteSwap(); + GetEntries()[i].ByteSwap(); } --- oless/fat.cxx Thu Nov 14 18:45:51 2002 +++ oless/fat.cxx Fri Apr 25 13:43:19 2003 @@ -38,5 +38,5 @@ //This assumes that FREESECT is always 0xFFFFFFFF - memset(_asectEntry, 0xFF, uEntries * sizeof(SECT)); + memset(GetSects(), 0xFF, uEntries * sizeof(SECT)); msfDebugOut((DEB_FAT,"Out CFatSect constructor\n")); @@ -68,5 +68,5 @@ msfDebugOut((DEB_FAT,"Sector size is %u sectors\n",uSize)); - memcpy(_asectEntry,fsOld._asectEntry,sizeof(SECT)*uSize); + memcpy(GetSects(),fsOld.GetSects(),sizeof(SECT)*uSize); msfDebugOut((DEB_FAT,"Out CFatSect copy constructor\n")); return S_OK; --- oless/dir.cxx Thu Nov 14 18:45:51 2002 +++ oless/dir.cxx Fri Apr 25 13:53:12 2003 @@ -152,5 +152,5 @@ for (ULONG i = 0; i < cdeEntries; i++) { - _adeEntry[i].Init(STGTY_INVALID); + GetEntries()[i].Init(STGTY_INVALID); } --- oless/page.cxx Thu Nov 14 18:45:51 2002 +++ oless/page.cxx Fri Apr 25 12:53:03 2003 @@ -39,5 +39,5 @@ { case SIDDIR: - ((CDirSect *)_ab)-> + ((CDirSect *)GetData())-> ByteSwap( ((CDirVector*)pVect)->GetSectorSize() ); break; @@ -45,5 +45,5 @@ case SIDMINIFAT: case SIDDIF: - ((CFatSect *)_ab)-> + ((CFatSect *)GetData())-> ByteSwap( ((CFatVector*)pVect)->GetSectBlock() ); break;