Fix a few compiler warnings

Mostly uninitialized class members.  Should not cause a change in
behavior.
This commit is contained in:
Andy McFadden 2021-05-09 18:17:49 -07:00
parent adaeb2c6eb
commit eff69cce86
14 changed files with 284 additions and 139 deletions

View File

@ -227,7 +227,7 @@ BEGIN
PUSHBUTTON "Enter registration code",IDC_ABOUT_ENTER_REG,157,132,86,14 PUSHBUTTON "Enter registration code",IDC_ABOUT_ENTER_REG,157,132,86,14
CONTROL IDB_FSLOGO,IDC_STATIC,"Static",SS_BITMAP,7,6,64,59 CONTROL IDB_FSLOGO,IDC_STATIC,"Static",SS_BITMAP,7,6,64,59
LTEXT "CiderPress v%d.%d.%d%ls%ls",IDC_CIDERPRESS_VERS_TEXT,77,7,167,9 LTEXT "CiderPress v%d.%d.%d%ls%ls",IDC_CIDERPRESS_VERS_TEXT,77,7,167,9
LTEXT "Copyright © 2017 by CiderPress project authors.\rAll Rights Reserved.",IDC_STATIC,77,20,167,19 LTEXT "Copyright © 2021 by CiderPress project authors.\rAll Rights Reserved.",IDC_STATIC,77,20,167,19
ICON IDR_MAINFRAME,IDC_STATIC,77,45,20,20 ICON IDR_MAINFRAME,IDC_STATIC,77,45,20,20
ICON IDI_FILE_NUFX,IDC_STATIC,106,45,20,20 ICON IDI_FILE_NUFX,IDC_STATIC,106,45,20,20
ICON IDI_FILE_BINARY2,IDC_STATIC,136,45,20,20 ICON IDI_FILE_BINARY2,IDC_STATIC,136,45,20,20

View File

@ -1798,8 +1798,8 @@ bail:
DIError DiskArchive::AddForksToDisk(DiskFS* pDiskFS, DIError DiskArchive::AddForksToDisk(DiskFS* pDiskFS,
const DiskFS::CreateParms* pParms, const DiskFS::CreateParms* pParms,
const unsigned char* dataBuf, long dataLen, const uint8_t* dataBuf, long dataLen,
const unsigned char* rsrcBuf, long rsrcLen) const const uint8_t* rsrcBuf, long rsrcLen) const
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
const int kFileTypeBIN = 0x06; const int kFileTypeBIN = 0x06;

View File

@ -186,11 +186,11 @@ private:
class SectorEditDialog : public DiskEditDialog { class SectorEditDialog : public DiskEditDialog {
public: public:
SectorEditDialog(CWnd* pParentWnd = NULL) : SectorEditDialog(CWnd* pParentWnd = NULL) :
DiskEditDialog(IDD_DISKEDIT, pParentWnd) DiskEditDialog(IDD_DISKEDIT, pParentWnd),
{ fTrack(0),
fTrack = 0; fSector(0),
fSector = 0; fSectorData()
} { }
virtual ~SectorEditDialog() {} virtual ~SectorEditDialog() {}
virtual int LoadData(void) override; // load the current track/sector virtual int LoadData(void) override; // load the current track/sector
@ -234,11 +234,15 @@ protected:
class SectorFileEditDialog : public SectorEditDialog { class SectorFileEditDialog : public SectorEditDialog {
public: public:
SectorFileEditDialog(SectorEditDialog* pSectEdit, CWnd* pParentWnd = NULL): SectorFileEditDialog(SectorEditDialog* pSectEdit, CWnd* pParentWnd = NULL):
SectorEditDialog(pParentWnd) SectorEditDialog(pParentWnd),
fOpenRsrcFork(false),
fpFile(NULL),
fpOpenFile(NULL),
fSectorIdx(0),
fLength(0)
{ {
DiskEditDialog::Setup(pSectEdit->GetDiskFS(), DiskEditDialog::Setup(pSectEdit->GetDiskFS(),
pSectEdit->GetFileName()); pSectEdit->GetFileName());
fSectorIdx = 0;
} }
virtual ~SectorFileEditDialog() {} virtual ~SectorFileEditDialog() {}
@ -326,7 +330,12 @@ protected:
class BlockFileEditDialog : public BlockEditDialog { class BlockFileEditDialog : public BlockEditDialog {
public: public:
BlockFileEditDialog(BlockEditDialog* pBlockEdit, CWnd* pParentWnd = NULL) : BlockFileEditDialog(BlockEditDialog* pBlockEdit, CWnd* pParentWnd = NULL) :
BlockEditDialog(pParentWnd) BlockEditDialog(pParentWnd),
fOpenRsrcFork(false),
fpFile(NULL),
fpOpenFile(NULL),
fBlockIdx(0),
fLength(0)
{ {
DiskEditDialog::Setup(pBlockEdit->GetDiskFS(), DiskEditDialog::Setup(pBlockEdit->GetDiskFS(),
pBlockEdit->GetFileName()); pBlockEdit->GetFileName());
@ -379,10 +388,11 @@ private:
class NibbleEditDialog : public DiskEditDialog { class NibbleEditDialog : public DiskEditDialog {
public: public:
NibbleEditDialog(CWnd* pParentWnd = NULL) : NibbleEditDialog(CWnd* pParentWnd = NULL) :
DiskEditDialog(IDD_DISKEDIT, pParentWnd) DiskEditDialog(IDD_DISKEDIT, pParentWnd),
{ fTrack(0),
fTrack = 0; fNibbleData(),
} fNibbleDataLen(0)
{ }
virtual ~NibbleEditDialog() {} virtual ~NibbleEditDialog() {}
virtual int LoadData(void) override; // load the current track/sector virtual int LoadData(void) override; // load the current track/sector

View File

@ -17,7 +17,12 @@
class EOLScanDialog : public CDialog { class EOLScanDialog : public CDialog {
public: public:
EOLScanDialog(CWnd* pParentWnd = NULL) : EOLScanDialog(CWnd* pParentWnd = NULL) :
CDialog(IDD_EOLSCAN, pParentWnd) CDialog(IDD_EOLSCAN, pParentWnd),
fCountChars(0),
fCountCR(0),
fCountLF(0),
fCountCRLF(0),
fCountHighASCII(0)
{} {}
virtual ~EOLScanDialog(void) {} virtual ~EOLScanDialog(void) {}

View File

@ -71,8 +71,8 @@ public:
void ApplyNow(PrefsSheet*); void ApplyNow(PrefsSheet*);
// get the text of the next file in the selection list // get the text of the next file in the selection list
int GetPrevFileText(ReformatHolder* pHolder, CString* pTitle); //int GetPrevFileText(ReformatHolder* pHolder, CString* pTitle);
int GetNextFileText(ReformatHolder* pHolder, CString* pTitle); //int GetNextFileText(ReformatHolder* pHolder, CString* pTitle);
// update the progress meter // update the progress meter
void SetProgressBegin(void); void SetProgressBegin(void);
@ -607,7 +607,7 @@ private:
*/ */
void HandleView(void); void HandleView(void);
void DeleteFileOnExit(const WCHAR* name); //void DeleteFileOnExit(const WCHAR* name);
/* /*
* Close and re-open the current archive. * Close and re-open the current archive.

View File

@ -1787,7 +1787,7 @@ long MainWindow::SSTGetBufOffset(int track)
return offset; return offset;
} }
long MainWindow::SSTCountBadBytes(const unsigned char* sctBuf, int count) long MainWindow::SSTCountBadBytes(const uint8_t* sctBuf, int count)
{ {
long badCount = 0; long badCount = 0;
unsigned char uch; unsigned char uch;
@ -1802,7 +1802,7 @@ long MainWindow::SSTCountBadBytes(const unsigned char* sctBuf, int count)
return badCount; return badCount;
} }
void MainWindow::SSTProcessTrackData(unsigned char* trackBuf) void MainWindow::SSTProcessTrackData(uint8_t* trackBuf)
{ {
unsigned char* trackPtr; unsigned char* trackPtr;
int track; int track;
@ -1812,7 +1812,7 @@ void MainWindow::SSTProcessTrackData(unsigned char* trackBuf)
{ {
bool inRun; bool inRun;
int start, longestStart; int start, longestStart;
int count7f, longest = -1; int count7f = 0, longest = -1;
int i; int i;
inRun = false; inRun = false;

View File

@ -211,6 +211,10 @@ DiskImg::DiskImg(void)
fNumBlocks = -1; fNumBlocks = -1;
fpScanProgressCallback = NULL; fpScanProgressCallback = NULL;
fScanProgressCookie = NULL;
fScanCount = 0;
fScanMsg[0] = '\0';
fScanLastMsgWhen = 0;
/* /*
* Create a working copy of the nibble descr table. We want to leave * Create a working copy of the nibble descr table. We want to leave

View File

@ -1472,13 +1472,15 @@ public:
* The filename returned is defined to be null-terminated Mac OS Roman. * The filename returned is defined to be null-terminated Mac OS Roman.
* For most filesystems this is automatic, as filenames are restricted * For most filesystems this is automatic, as filenames are restricted
* to ASCII, but for DOS 3.3 it requires stripping high bits. It also * to ASCII, but for DOS 3.3 it requires stripping high bits. It also
* means that embedded nulls in HFS filenames (which are discouraged but * means that embedded nulls will be lost. (Some HFS references indicate
* allowed) will be lost. * that '\0' is allowed, but I think people assume that because the API
* uses a string with an explicit length. Looking at "Inside Mac: Files"
* chapter 2, page 2-71, HFS filenames are stored in a fixed 31-byte
* field that is padded with zeroes, so embedded nulls are impossible.)
* *
* The original unmodified filename is availale through GetRawFileName, * The original unmodified filename is available through GetRawFileName,
* which can be optionally passed a size_t pointer to get the size * which can be optionally passed a size_t pointer to get the size
* of the raw file name, which is helpful for getting a HFS filename with * of the raw file name, in case it has embedded nulls.
* embedded nulls.
* *
* We do guarantee that the contents of subdirectories are grouped * We do guarantee that the contents of subdirectories are grouped
* together. This makes it much easier to construct a hierarchy out of * together. This makes it much easier to construct a hierarchy out of

View File

@ -630,7 +630,7 @@ private:
class WrapperFDI : public ImageWrapper { class WrapperFDI : public ImageWrapper {
public: public:
WrapperFDI(void) {} WrapperFDI(void) : fHeaderBuf(), fImageTracks(0), fStorageName(NULL) {}
virtual ~WrapperFDI(void) {} virtual ~WrapperFDI(void) {}
static DIError Test(GenericFD* pGFD, di_off_t wrappedLength); static DIError Test(GenericFD* pGFD, di_off_t wrappedLength);
@ -1213,10 +1213,21 @@ class A2FileDOS;
*/ */
class DISKIMG_API DiskFSDOS33 : public DiskFS { class DISKIMG_API DiskFSDOS33 : public DiskFS {
public: public:
DiskFSDOS33(void) : DiskFS() { DiskFSDOS33(void) :
fVTOCLoaded = false; DiskFS(),
fDiskIsGood = false; fFirstCatTrack(0),
} fFirstCatSector(0),
fVTOCVolumeNumber(0),
fVTOCNumTracks(0),
fVTOCNumSectors(0),
fDiskVolumeNum(0),
fDiskVolumeName(),
fDiskVolumeID(),
fVTOC(),
fVTOCLoaded(false),
fCatalogSectors(),
fDiskIsGood(false)
{}
virtual ~DiskFSDOS33(void) {} virtual ~DiskFSDOS33(void) {}
static DIError TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, static DIError TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder,
@ -1259,7 +1270,7 @@ public:
// utility function // utility function
static void LowerASCII(uint8_t* buf, long len); static void LowerASCII(uint8_t* buf, long len);
static void ReplaceFssep(char* str, char replacement); //static void ReplaceFssep(char* str, char replacement);
enum { enum {
kMinTracks = 17, // need to put the catalog track here kMinTracks = 17, // need to put the catalog track here
@ -1360,12 +1371,17 @@ private:
*/ */
class DISKIMG_API A2FDDOS : public A2FileDescr { class DISKIMG_API A2FDDOS : public A2FileDescr {
public: public:
A2FDDOS(A2File* pFile) : A2FileDescr(pFile) { A2FDDOS(A2File* pFile) :
fTSList = NULL; A2FileDescr(pFile),
fIndexList = NULL; fTSList(NULL),
fOffset = 0; fTSCount(0),
fModified = false; fIndexList(NULL),
} fIndexCount(0),
fOffset(0),
fOpenEOF(0),
fOpenSectorsUsed(0),
fModified(false)
{}
virtual ~A2FDDOS(void) { virtual ~A2FDDOS(void) {
delete[] fTSList; delete[] fTSList;
delete[] fIndexList; delete[] fIndexList;
@ -1538,8 +1554,19 @@ class A2FileProDOS;
*/ */
class DISKIMG_API DiskFSProDOS : public DiskFS { class DISKIMG_API DiskFSProDOS : public DiskFS {
public: public:
DiskFSProDOS(void) : fBitMapPointer(0), fTotalBlocks(0), fBlockUseMap(NULL) DiskFSProDOS(void) :
{} fVolumeName(),
fVolumeID(),
fAccess(0),
fCreateWhen(0),
fModWhen(0),
fBitMapPointer(0),
fTotalBlocks(0),
fVolDirFileCount(0),
fBlockUseMap(NULL),
fDiskIsGood(false),
fEarlyDamage(false)
{}
virtual ~DiskFSProDOS(void) { virtual ~DiskFSProDOS(void) {
if (fBlockUseMap != NULL) { if (fBlockUseMap != NULL) {
assert(false); // unexpected assert(false); // unexpected
@ -1700,8 +1727,16 @@ private:
*/ */
class DISKIMG_API A2FDProDOS : public A2FileDescr { class DISKIMG_API A2FDProDOS : public A2FileDescr {
public: public:
A2FDProDOS(A2File* pFile) : A2FileDescr(pFile), fModified(false), A2FDProDOS(A2File* pFile) :
fBlockList(NULL), fOffset(0) A2FileDescr(pFile),
fModified(false),
fBlockCount(0),
fBlockList(NULL),
fOpenEOF(0),
fOpenBlocksUsed(0),
fOpenStorageType(0),
fOpenRsrcFork(false),
fOffset(0)
{} {}
virtual ~A2FDProDOS(void) { virtual ~A2FDProDOS(void) {
delete[] fBlockList; delete[] fBlockList;
@ -1745,14 +1780,16 @@ private:
*/ */
class DISKIMG_API A2FileProDOS : public A2File { class DISKIMG_API A2FileProDOS : public A2File {
public: public:
A2FileProDOS(DiskFS* pDiskFS) : A2File(pDiskFS) { A2FileProDOS(DiskFS* pDiskFS) :
fPathName = NULL; A2File(pDiskFS),
fSparseDataEof = fSparseRsrcEof = -1; fParentDirBlock(0),
fpOpenFile = NULL; fParentDirIdx(0),
fParentDirBlock = 0; fSparseDataEof(0),
fParentDirIdx = -1; fSparseRsrcEof(0),
fpParent = NULL; fPathName(NULL),
} fpOpenFile(NULL),
fpParent(NULL)
{}
virtual ~A2FileProDOS(void) { virtual ~A2FileProDOS(void) {
delete fpOpenFile; delete fpOpenFile;
delete[] fPathName; delete[] fPathName;
@ -1952,7 +1989,21 @@ class A2FilePascal;
class DISKIMG_API DiskFSPascal : public DiskFS { class DISKIMG_API DiskFSPascal : public DiskFS {
public: public:
DiskFSPascal(void) : fDirectory(NULL) {} DiskFSPascal(void) :
fStartBlock(0),
fNextBlock(0),
fVolumeName(),
fVolumeID(),
fTotalBlocks(0),
fNumFiles(0),
fAccessWhen(0),
fDateSetWhen(0),
fStuff1(0),
fStuff2(0),
fDiskIsGood(false),
fEarlyDamage(false),
fDirectory(NULL)
{}
virtual ~DiskFSPascal(void) { virtual ~DiskFSPascal(void) {
if (fDirectory != NULL) { if (fDirectory != NULL) {
assert(false); // unexpected assert(false); // unexpected
@ -2054,9 +2105,13 @@ private:
*/ */
class DISKIMG_API A2FDPascal : public A2FileDescr { class DISKIMG_API A2FDPascal : public A2FileDescr {
public: public:
A2FDPascal(A2File* pFile) : A2FileDescr(pFile) { A2FDPascal(A2File* pFile) :
fOffset = 0; A2FileDescr(pFile),
} fOffset(0),
fOpenEOF(0),
fOpenBlocksUsed(0),
fModified(0)
{}
virtual ~A2FDPascal(void) { virtual ~A2FDPascal(void) {
/* nothing to clean up */ /* nothing to clean up */
} }
@ -2088,9 +2143,17 @@ private:
*/ */
class DISKIMG_API A2FilePascal : public A2File { class DISKIMG_API A2FilePascal : public A2File {
public: public:
A2FilePascal(DiskFS* pDiskFS) : A2File(pDiskFS) { A2FilePascal(DiskFS* pDiskFS) :
fpOpenFile = NULL; A2File(pDiskFS),
} fStartBlock(0),
fNextBlock(0),
fFileType(A2FilePascal::FileType::kTypeUntyped),
fFileName(),
fBytesRemaining(0),
fModWhen(0),
fLength(0),
fpOpenFile(NULL)
{}
virtual ~A2FilePascal(void) { virtual ~A2FilePascal(void) {
/* this comes back and calls CloseDescr */ /* this comes back and calls CloseDescr */
if (fpOpenFile != NULL) if (fpOpenFile != NULL)
@ -2188,7 +2251,7 @@ private:
class A2FileCPM; class A2FileCPM;
class DISKIMG_API DiskFSCPM : public DiskFS { class DISKIMG_API DiskFSCPM : public DiskFS {
public: public:
DiskFSCPM(void) : fDiskIsGood(false) {} DiskFSCPM(void) : fDirEntry(), fDiskIsGood(false) {}
virtual ~DiskFSCPM(void) {} virtual ~DiskFSCPM(void) {}
static DIError TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, static DIError TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder,
@ -2272,10 +2335,12 @@ private:
*/ */
class DISKIMG_API A2FDCPM : public A2FileDescr { class DISKIMG_API A2FDCPM : public A2FileDescr {
public: public:
A2FDCPM(A2File* pFile) : A2FileDescr(pFile) { A2FDCPM(A2File* pFile) :
//fOpen = false; A2FileDescr(pFile),
fBlockList = NULL; fOffset(0),
} fBlockCount(0),
fBlockList(NULL)
{}
virtual ~A2FDCPM(void) { virtual ~A2FDCPM(void) {
delete fBlockList; delete fBlockList;
fBlockList = NULL; fBlockList = NULL;
@ -2311,7 +2376,13 @@ public:
typedef DiskFSCPM::DirEntry DirEntry; typedef DiskFSCPM::DirEntry DirEntry;
A2FileCPM(DiskFS* pDiskFS, DirEntry* pDirEntry) : A2FileCPM(DiskFS* pDiskFS, DirEntry* pDirEntry) :
A2File(pDiskFS), fpDirEntry(pDirEntry) A2File(pDiskFS),
fFileName(),
fReadOnly(false),
fLength(0),
fDirIdx(0),
fpDirEntry(pDirEntry),
fpOpenFile(NULL)
{ {
fDirIdx = -1; fDirIdx = -1;
fpOpenFile = NULL; fpOpenFile = NULL;
@ -2392,7 +2463,7 @@ private:
class A2FileRDOS; class A2FileRDOS;
class DISKIMG_API DiskFSRDOS : public DiskFS { class DISKIMG_API DiskFSRDOS : public DiskFS {
public: public:
DiskFSRDOS(void) {} DiskFSRDOS(void) : fVolumeName(), fOurSectPerTrack(0) {}
virtual ~DiskFSRDOS(void) {} virtual ~DiskFSRDOS(void) {}
static DIError TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, static DIError TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder,
@ -2471,10 +2542,17 @@ private:
*/ */
class DISKIMG_API A2FileRDOS : public A2File { class DISKIMG_API A2FileRDOS : public A2File {
public: public:
A2FileRDOS(DiskFS* pDiskFS) : A2File(pDiskFS) { A2FileRDOS(DiskFS* pDiskFS) :
//fOpen = false; A2File(pDiskFS),
fpOpenFile = NULL; fFileName(),
} fRawFileName(),
fFileType(A2FileRDOS::FileType::kTypeUnknown),
fNumSectors(0),
fLoadAddr(0),
fLength(0),
fStartSector(0),
fpOpenFile(NULL)
{}
virtual ~A2FileRDOS(void) { virtual ~A2FileRDOS(void) {
delete fpOpenFile; delete fpOpenFile;
} }
@ -2547,9 +2625,19 @@ private:
class A2FileHFS; class A2FileHFS;
class DISKIMG_API DiskFSHFS : public DiskFS { class DISKIMG_API DiskFSHFS : public DiskFS {
public: public:
DiskFSHFS(void) { DiskFSHFS(void) :
fLocalTimeOffset = -1; fVolumeName(),
fDiskIsGood = true; fVolumeID(),
fTotalBlocks(0),
fAllocationBlockSize(0),
fNumAllocationBlocks(0),
fCreatedDateTime(0),
fModifiedDateTime(0),
fNumFiles(0),
fNumDirectories(0),
fLocalTimeOffset(-1),
fDiskIsGood(true)
{
#ifndef EXCISE_GPL_CODE #ifndef EXCISE_GPL_CODE
fHfsVol = NULL; fHfsVol = NULL;
#endif #endif
@ -2722,12 +2810,25 @@ private:
*/ */
class DISKIMG_API A2FileHFS : public A2File { class DISKIMG_API A2FileHFS : public A2File {
public: public:
A2FileHFS(DiskFS* pDiskFS) : A2File(pDiskFS) { A2FileHFS(DiskFS* pDiskFS) :
fPathName = NULL; A2File(pDiskFS),
fpOpenFile = NULL; fIsDir(false),
fIsVolumeDir(false),
fType(0),
fCreator(0),
fFileName(),
fPathName(NULL),
fDataLength(0),
fRsrcLength(0),
fCreateWhen(0),
fModWhen(0),
fAccess(0),
fpOpenFile(NULL)
{
#ifdef EXCISE_GPL_CODE #ifdef EXCISE_GPL_CODE
fFakeFileBuf = NULL; fFakeFileBuf = NULL;
#else #else
fpParent = NULL;
//fOrigPathName = NULL; //fOrigPathName = NULL;
#endif #endif
} }
@ -2833,10 +2934,19 @@ class A2FileGutenberg;
*/ */
class DISKIMG_API DiskFSGutenberg : public DiskFS { class DISKIMG_API DiskFSGutenberg : public DiskFS {
public: public:
DiskFSGutenberg(void) : DiskFS() { DiskFSGutenberg(void) : DiskFS(),
fVTOCLoaded = false; fFirstCatTrack(0),
fDiskIsGood = false; fFirstCatSector(0),
} fVTOCVolumeNumber(0),
fVTOCNumTracks(0),
fVTOCNumSectors(0),
fDiskVolumeName(),
fDiskVolumeID(),
fVTOC(),
fVTOCLoaded(false),
fCatalogSectors(),
fDiskIsGood(false)
{}
virtual ~DiskFSGutenberg(void) {} virtual ~DiskFSGutenberg(void) {}
static DIError TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, static DIError TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder,
@ -2857,12 +2967,12 @@ public:
virtual DIError GetFreeSpaceCount(long* pTotalUnits, long* pFreeUnits, virtual DIError GetFreeSpaceCount(long* pTotalUnits, long* pFreeUnits,
int* pUnitSize) const override; int* pUnitSize) const override;
static bool IsValidFileName(const char* name); //static bool IsValidFileName(const char* name);
static bool IsValidVolumeName(const char* name); //static bool IsValidVolumeName(const char* name);
// utility function // utility function
static void LowerASCII(uint8_t* buf, long len); static void LowerASCII(uint8_t* buf, long len);
static void ReplaceFssep(char* str, char replacement); //static void ReplaceFssep(char* str, char replacement);
enum { enum {
kMinTracks = 17, // need to put the catalog track here kMinTracks = 17, // need to put the catalog track here
@ -2880,43 +2990,13 @@ public:
private: private:
DIError Initialize(InitMode initMode); DIError Initialize(InitMode initMode);
DIError ReadVTOC(void);
void UpdateVolumeNum(void);
void DumpVTOC(void);
void SetSectorUsage(long track, long sector,
VolumeUsage::ChunkPurpose purpose);
void FixVolumeUsageMap(void);
DIError ReadCatalog(void); DIError ReadCatalog(void);
DIError ProcessCatalogSector(int catTrack, int catSect, DIError ProcessCatalogSector(int catTrack, int catSect,
const uint8_t* sctBuf); const uint8_t* sctBuf);
DIError GetFileLengths(void); DIError GetFileLengths(void);
DIError ComputeLength(A2FileGutenberg* pFile, const TrackSector* tsList,
int tsCount);
DIError TrimLastSectorUp(A2FileGutenberg* pFile, TrackSector lastTS);
void MarkFileUsage(A2FileGutenberg* pFile, TrackSector* tsList, int tsCount,
TrackSector* indexList, int indexCount);
DIError MakeFileNameUnique(char* fileName);
DIError GetFreeCatalogEntry(TrackSector* pCatSect, int* pCatEntry,
uint8_t* sctBuf, A2FileGutenberg** ppPrevEntry);
void CreateDirEntry(uint8_t* sctBuf, int catEntry,
const char* fileName, TrackSector* pTSSect, uint8_t fileType,
int access);
void FreeTrackSectors(TrackSector* pList, int count);
bool CheckDiskIsGood(void); bool CheckDiskIsGood(void);
DIError WriteDOSTracks(int sectPerTrack);
DIError ScanVolBitmap(void);
DIError LoadVolBitmap(void);
DIError SaveVolBitmap(void);
void FreeVolBitmap(void);
DIError AllocSector(TrackSector* pTS);
DIError CreateEmptyBlockMap(bool withDOS);
bool GetSectorUseEntry(long track, int sector) const;
void SetSectorUseEntry(long track, int sector, bool inUse);
inline uint32_t GetVTOCEntry(const uint8_t* pVTOC, long track) const;
// Largest interesting volume is 400K (50 tracks, 32 sectors), but // Largest interesting volume is 400K (50 tracks, 32 sectors), but
// we may be looking at it in 16-sector mode, so max tracks is 100. // we may be looking at it in 16-sector mode, so max tracks is 100.
enum { enum {
@ -2936,7 +3016,7 @@ private:
/* private data */ /* private data */
char fDiskVolumeName[10]; // char fDiskVolumeName[10]; //
char fDiskVolumeID[11+12+1]; // sizeof "Gutenberg: " + 12 + null char fDiskVolumeID[11+12+1]; // sizeof "Gutenberg: " + 12 + null
uint8_t fVTOC[kSectorSize]; uint8_t fVTOC[kSectorSize];
bool fVTOCLoaded; bool fVTOCLoaded;
/* /*
@ -2955,12 +3035,15 @@ private:
*/ */
class DISKIMG_API A2FDGutenberg : public A2FileDescr { class DISKIMG_API A2FDGutenberg : public A2FileDescr {
public: public:
A2FDGutenberg(A2File* pFile) : A2FileDescr(pFile) { A2FDGutenberg(A2File* pFile) :
fOffset = 0; A2FileDescr(pFile),
fModified = false; fTSCount(0),
} fOffset(0),
virtual ~A2FDGutenberg(void) { fOpenEOF(0),
} fOpenSectorsUsed(0),
fModified(false)
{}
virtual ~A2FDGutenberg(void) {}
friend class A2FileGutenberg; friend class A2FileGutenberg;
@ -3060,16 +3143,11 @@ public:
void FixFilename(void); void FixFilename(void);
static FileType ConvertFileType(long prodosType, di_off_t fileLen);
static bool IsValidType(long prodosType);
static void MakeDOSName(char* buf, const char* name); static void MakeDOSName(char* buf, const char* name);
static void TrimTrailingSpaces(char* filename); static void TrimTrailingSpaces(char* filename);
private: private:
DIError ExtractTSPairs(const uint8_t* sctBuf, TrackSector* tsList, A2FDGutenberg* fpOpenFile;
int* pLastNonZero);
A2FDGutenberg* fpOpenFile;
}; };
@ -3088,7 +3166,11 @@ private:
class A2FileFAT; class A2FileFAT;
class DISKIMG_API DiskFSFAT : public DiskFS { class DISKIMG_API DiskFSFAT : public DiskFS {
public: public:
DiskFSFAT(void) {} DiskFSFAT(void) :
fVolumeName(),
fVolumeID(),
fTotalBlocks(0)
{}
virtual ~DiskFSFAT(void) {} virtual ~DiskFSFAT(void) {}
static DIError TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, static DIError TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder,
@ -3173,11 +3255,13 @@ private:
*/ */
class DISKIMG_API A2FileFAT : public A2File { class DISKIMG_API A2FileFAT : public A2File {
public: public:
A2FileFAT(DiskFS* pDiskFS) : A2File(pDiskFS) { A2FileFAT(DiskFS* pDiskFS) :
fFakeFileBuf = NULL; A2File(pDiskFS),
//fFakeFileLen = -1; fFileName(),
fpOpenFile = NULL; fLength(0),
} fFakeFileBuf(NULL),
fpOpenFile(NULL)
{}
virtual ~A2FileFAT(void) { virtual ~A2FileFAT(void) {
delete fpOpenFile; delete fpOpenFile;
delete[] fFakeFileBuf; delete[] fFakeFileBuf;

View File

@ -337,6 +337,7 @@ void DiskFSFAT::CreateFakeFile(void)
fVolumeName, fVolumeName,
capacity, capacity,
(double) capacity / 2048.0); (double) capacity / 2048.0);
buf[sizeof(buf) - 1] = '\0';
pFile = new A2FileFAT(this); pFile = new A2FileFAT(this);
pFile->SetFakeFile(buf, strlen(buf)); pFile->SetFakeFile(buf, strlen(buf));

View File

@ -175,8 +175,12 @@ private:
#ifdef _WIN32 #ifdef _WIN32
class GFDWinVolume : public GenericFD { class GFDWinVolume : public GenericFD {
public: public:
GFDWinVolume(void) : fPathName(NULL), fCurrentOffset(0), fVolumeEOF(-1) GFDWinVolume(void) :
{} fPathName(NULL),
fCurrentOffset(0),
fVolumeEOF(-1),
fBlockSize(0)
{}
virtual ~GFDWinVolume(void) { delete[] fPathName; } virtual ~GFDWinVolume(void) { delete[] fPathName; }
virtual DIError Open(const char* deviceName, bool readOnly); virtual DIError Open(const char* deviceName, bool readOnly);
@ -203,7 +207,14 @@ private:
class GFDBuffer : public GenericFD { class GFDBuffer : public GenericFD {
public: public:
GFDBuffer(void) : fBuffer(NULL) {} GFDBuffer(void) :
fBuffer(NULL),
fLength(0),
fAllocLength(0),
fDoDelete(false),
fDoExpand(false),
fCurrentOffset(0)
{}
virtual ~GFDBuffer(void) { Close(); } virtual ~GFDBuffer(void) { Close(); }
// If "doDelete" is set, the buffer will be freed with delete[] when // If "doDelete" is set, the buffer will be freed with delete[] when

View File

@ -30,7 +30,27 @@ namespace DiskImgLib {
*/ */
class DISKIMG_API TwoImgHeader { class DISKIMG_API TwoImgHeader {
public: public:
TwoImgHeader(void) : fDOSVolumeNum(-1), fComment(NULL), fCreatorChunk(NULL) TwoImgHeader(void) :
fMagic(0),
fCreator(0),
fHeaderLen(0),
fVersion(0),
fImageFormat(0),
fFlags(0),
fNumBlocks(0),
fDataOffset(0),
fDataLen(0),
fCmtOffset(0),
fCmtLen(0),
fCreatorOffset(0),
fCreatorLen(0),
fSpare(),
fDOSVolumeNum(-1),
fMagicStr(),
fCreatorStr(),
fComment(NULL),
fCreatorChunk(NULL)
{} {}
virtual ~TwoImgHeader(void) { virtual ~TwoImgHeader(void) {
delete[] fComment; delete[] fComment;

View File

@ -20,7 +20,7 @@
*/ */
class ReformatAsm : public ReformatText { class ReformatAsm : public ReformatText {
public: public:
ReformatAsm(void) {} ReformatAsm(void) : fOutBuf(), fOutBufIndex(0) {}
virtual ~ReformatAsm(void) {} virtual ~ReformatAsm(void) {}
void OutputStart(void) { void OutputStart(void) {
@ -129,7 +129,7 @@ private:
*/ */
class ReformatLISA3 : public ReformatAsm { class ReformatLISA3 : public ReformatAsm {
public: public:
ReformatLISA3(void) : fSymTab(NULL) {} ReformatLISA3(void) : fSymTab(NULL), fSymCount(0) {}
virtual ~ReformatLISA3(void) {} virtual ~ReformatLISA3(void) {}
virtual void Examine(ReformatHolder* pHolder) override; virtual void Examine(ReformatHolder* pHolder) override;
@ -197,7 +197,14 @@ private:
*/ */
class ReformatLISA4 : public ReformatAsm { class ReformatLISA4 : public ReformatAsm {
public: public:
ReformatLISA4(void) : fSymTab(NULL) {} ReformatLISA4(void) :
fSymTab(NULL),
fSymCount(0),
fOpTab(0),
fAdTab(0),
fComTab(0),
fCpuType(0)
{}
virtual ~ReformatLISA4(void) { delete[] fSymTab; } virtual ~ReformatLISA4(void) { delete[] fSymTab; }
virtual void Examine(ReformatHolder* pHolder) override; virtual void Examine(ReformatHolder* pHolder) override;

View File

@ -362,7 +362,7 @@ void CreateSimpleFont(CFont* pFont, CWnd* pWnd, const WCHAR* typeFace,
void GetWin32ErrorString(DWORD err, CString* pStr) void GetWin32ErrorString(DWORD err, CString* pStr)
{ {
DWORD count; DWORD count;
LPVOID lpMsgBuf; LPVOID lpMsgBuf = NULL;
count = FormatMessage( count = FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_ALLOCATE_BUFFER |
@ -486,6 +486,7 @@ void LogHexDump(const void* vbuf, long len)
cp = outBuf + strlen(outBuf); cp = outBuf + strlen(outBuf);
} }
ASSERT(cp != NULL);
sprintf(cp, "%02x ", *buf++); sprintf(cp, "%02x ", *buf++);
cp += 3; cp += 3;
} }