Fix warnings

Added explicit casts and class initializers.  The problems were
identified by the VS2019 compiler.
This commit is contained in:
Andy McFadden 2021-04-24 13:43:04 -07:00
parent 8a6a4ada5c
commit adaeb2c6eb
13 changed files with 97 additions and 35 deletions

View File

@ -28,14 +28,8 @@ public:
kActionConvFile,
} Action;
ActionProgressDialog(void) {
fAction = kActionUnknown;
//fpSelSet = NULL;
//fpOptionsDlg = NULL;
fCancel = false;
//fResult = 0;
}
virtual ~ActionProgressDialog(void) {}
ActionProgressDialog(void) : fAction(kActionUnknown), fCancel(false) { }
virtual ~ActionProgressDialog(void) { }
BOOL Create(Action action, CWnd* pParentWnd = NULL) {
fAction = action;

View File

@ -459,7 +459,7 @@ CString MainWindow::CopyToCollection(GenericEntry* pEntry, void** pBuf,
memset(&collEnt, 0x99, sizeof(collEnt));
collEnt.signature = kEntrySignature;
collEnt.dataOffset = sizeof(collEnt);
collEnt.fileNameLen = (wcslen(pEntry->GetPathNameUNI()) +1) * sizeof(WCHAR);
collEnt.fileNameLen = (uint16_t)((wcslen(pEntry->GetPathNameUNI()) +1) * sizeof(WCHAR));
if (pEntry->GetRecordKind() == GenericEntry::kRecordKindDirectory) {
collEnt.dataLen = collEnt.rsrcLen = collEnt.cmmtLen = 0;
} else {

View File

@ -64,8 +64,14 @@ private:
*/
class DiskArchive : public GenericArchive {
public:
DiskArchive(void) : fpPrimaryDiskFS(NULL), fIsReadOnly(false),
fpAddDataHead(NULL), fpAddDataTail(NULL)
DiskArchive(void) :
fpPrimaryDiskFS(NULL),
fIsReadOnly(false),
fpAddDataHead(NULL),
fpAddDataTail(NULL),
fOverwriteExisting(false),
fOverwriteNoAsk(false),
fpXferTargetFS(NULL)
{}
virtual ~DiskArchive(void) { (void) Close(); }

View File

@ -23,11 +23,14 @@ public:
PrefsGeneralPage(void) :
CPropertyPage(IDD_PREF_GENERAL),
fReady(false),
fColumn(),
fMimicShrinkIt(FALSE),
fBadMacSHK(FALSE),
fReduceSHKErrorChecks(FALSE),
fCoerceDOSFilenames(FALSE),
fSpacesToUnder(FALSE),
fPasteJunkPaths(FALSE),
fBeepOnSuccess(FALSE),
fDefaultsPushed(FALSE),
fOurAssociations(NULL)
{}
@ -82,6 +85,7 @@ public:
fReady(false),
fQueryImageFormat(FALSE),
fOpenVolumeRO(FALSE),
fOpenVolumePhys0(FALSE),
fProDOSAllowLower(FALSE),
fProDOSUseSparse(FALSE)
{}
@ -119,7 +123,9 @@ class PrefsCompressionPage : public CPropertyPage
{
public:
PrefsCompressionPage(void) :
CPropertyPage(IDD_PREF_COMPRESSION), fReady(false)
CPropertyPage(IDD_PREF_COMPRESSION),
fReady(false),
fCompressType(-1)
{}
bool fReady;
@ -159,7 +165,39 @@ class PrefsFviewPage : public CPropertyPage
{
public:
PrefsFviewPage(void) :
CPropertyPage(IDD_PREF_FVIEW), fReady(false)
CPropertyPage(IDD_PREF_FVIEW),
fReady(false),
fEOLConvRaw(FALSE),
fNoWrapText(FALSE),
fHighlightHexDump(FALSE),
fHighlightBASIC(FALSE),
fConvDisasmOneByteBrkCop(FALSE),
fConvMouseTextToASCII(FALSE),
fConvHiResBlackWhite(FALSE),
fConvDHRAlgorithm(-1),
fConvTextEOL_HA(FALSE),
fConvCPMText(FALSE),
fConvPascalText(FALSE),
fConvPascalCode(FALSE),
fConvApplesoft(FALSE),
fConvInteger(FALSE),
fConvBusiness(FALSE),
fConvGWP(FALSE),
fConvText8(FALSE),
fConvAWP(FALSE),
fConvADB(FALSE),
fConvASP(FALSE),
fConvSCAssem(FALSE),
fConvDisasm(FALSE),
fConvHiRes(FALSE),
fConvDHR(FALSE),
fConvSHR(FALSE),
fConvPrintShop(FALSE),
fConvMacPaint(FALSE),
fConvProDOSFolder(FALSE),
fConvResources(FALSE),
fRelaxGfxTypeCheck(FALSE),
fMaxViewFileSizeKB(0)
{}
bool fReady;

View File

@ -17,7 +17,13 @@
class UseSelectionDialog : public CDialog {
public:
UseSelectionDialog(int selCount, CWnd* pParentWnd = NULL, int rsrcID = IDD_USE_SELECTION) :
CDialog(rsrcID, pParentWnd), fSelectedCount(selCount)
CDialog(rsrcID, pParentWnd),
fSelectedCount(selCount),
fTitleID(-1),
fOkLabelID(-1),
fSelCountID(-1),
fSelCountsID(-1),
fAllID(-1)
{
// init values; these should be overridden before DoModal
fFilesToAction = 0;

View File

@ -25,6 +25,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/types.h>
#include <assert.h>
//#define EXCISE_GPL_CODE
@ -1582,7 +1583,12 @@ private:
*/
class DISKIMG_API A2FileDescr {
public:
A2FileDescr(A2File* pFile) : fpFile(pFile), fProgressUpdateFunc(NULL) {}
A2FileDescr(A2File* pFile) :
fpFile(pFile),
fProgressUpdateFunc(NULL),
fProgressUpdateMax(0),
fProgressUpdateState(NULL)
{}
virtual ~A2FileDescr(void) { fpFile = NULL; /*paranoia*/ }
virtual DIError Read(void* buf, size_t len, size_t* pActual = NULL) = 0;

View File

@ -1220,7 +1220,7 @@ void OuterZip::LocalFileHeader::SetFileName(const char* name)
fFileNameLength = 0;
if (name != NULL) {
fFileNameLength = strlen(name);
fFileNameLength = (uint16_t)strlen(name);
fFileName = new uint8_t[fFileNameLength+1];
if (fFileName == NULL) {
LOGW("Malloc failure in SetFileName %u", fFileNameLength);
@ -1388,7 +1388,7 @@ void OuterZip::CentralDirEntry::SetFileName(const char* name)
fFileNameLength = 0;
if (name != NULL) {
fFileNameLength = strlen(name);
fFileNameLength = (uint16_t)strlen(name);
fFileName = new uint8_t[fFileNameLength+1];
if (fFileName == NULL) {
LOGI("Malloc failure in SetFileName %u", fFileNameLength);

View File

@ -535,7 +535,7 @@ DIError DiskFSPascal::Format(DiskImg* pDiskImg, const char* volName)
PutShortLE(&blkBuf[0x00], 0); // start block
PutShortLE(&blkBuf[0x02], 6); // next block
PutShortLE(&blkBuf[0x04], 0); // "file" type
blkBuf[0x06] = strlen(volName);
blkBuf[0x06] = (uint8_t)strlen(volName);
memcpy(&blkBuf[0x07], volName, strlen(volName));
PutShortLE(&blkBuf[0x0e], (uint16_t) pDiskImg->GetNumBlocks());
PutShortLE(&blkBuf[0x10], 0); // num files
@ -1255,7 +1255,7 @@ DIError DiskFSPascal::RenameFile(A2File* pGenericFile, const char* newName)
goto bail;
}
pEntry[0x06] = strlen(normalName);
pEntry[0x06] = (uint8_t)strlen(normalName);
memcpy(&pEntry[0x07], normalName, A2FilePascal::kMaxFileName);
strcpy(pFile->fFileName, normalName);
@ -1339,7 +1339,7 @@ DIError DiskFSPascal::RenameVolume(const char* newName)
if (dierr != kDIErrNone)
goto bail;
fDirectory[0x06] = strlen(normalName);
fDirectory[0x06] = (uint8_t)strlen(normalName);
memcpy(&fDirectory[0x07], normalName, fDirectory[0x06]);
strcpy(fVolumeName, normalName);

View File

@ -1571,7 +1571,7 @@ DIError DiskFSProDOS::Format(DiskImg* pDiskImg, const char* volName)
PutShortLE(&blkBuf[0x00], 0);
PutShortLE(&blkBuf[0x02], kVolHeaderBlock+1);
blkBuf[0x04] = strlen(upperName) | (A2FileProDOS::kStorageVolumeDirHeader << 4);
blkBuf[0x04] = (uint8_t)(strlen(upperName) | (A2FileProDOS::kStorageVolumeDirHeader << 4));
strncpy((char*) &blkBuf[0x05], upperName, A2FileProDOS::kMaxFileName);
PutLongLE(&blkBuf[0x16], A2FileProDOS::ConvertProDate(now));
PutShortLE(&blkBuf[0x1a], lcFlags);
@ -2014,7 +2014,7 @@ DIError DiskFSProDOS::CreateFile(const CreateParms* pParms, A2File** ppNewFile)
* are lower case. (Some parts of the original may have been stomped
* when the name was made unique, so we need to watch for that.)
*/
dirEntryPtr[0x00] = (pParms->storageType << 4) | strlen(upperName);
dirEntryPtr[0x00] = (uint8_t)((pParms->storageType << 4) | strlen(upperName));
strncpy((char*) &dirEntryPtr[0x01], upperName, A2FileProDOS::kMaxFileName);
if (pParms->fileType >= 0 && pParms->fileType <= 0xff)
dirEntryPtr[0x10] = (uint8_t) pParms->fileType;
@ -2270,7 +2270,7 @@ DIError DiskFSProDOS::AllocInitialFileStorage(const CreateParms* pParms,
/* fill in directory header fields */
// 0x00: prev, set to zero
// 0x02: next, set to zero
blkBuf[0x04] = (A2FileProDOS::kStorageSubdirHeader << 4) | strlen(upperName);
blkBuf[0x04] = (uint8_t)((A2FileProDOS::kStorageSubdirHeader << 4) | strlen(upperName));
strncpy((char*) &blkBuf[0x05], upperName, A2FileProDOS::kMaxFileName);
blkBuf[0x14] = 0x76; // 0x75 under old P8, 0x76 under GS/OS
PutLongLE(&blkBuf[0x1c], A2FileProDOS::ConvertProDate(pParms->createWhen));
@ -3511,7 +3511,7 @@ DIError DiskFSProDOS::RenameFile(A2File* pGenericFile, const char* newName)
dierr = kDIErrBadDirectory;
goto bail;
}
ptr[0x00] = (ptr[0x00] & 0xf0) | strlen(upperName);
ptr[0x00] = (uint8_t)((ptr[0x00] & 0xf0) | strlen(upperName));
memcpy(&ptr[0x01], upperName, A2FileProDOS::kMaxFileName);
PutShortLE(&ptr[0x1c], lcFlags); // version/min_version
if (isAW)
@ -3526,7 +3526,7 @@ DIError DiskFSProDOS::RenameFile(A2File* pGenericFile, const char* newName)
dierr = kDIErrBadDirectory;
goto bail;
}
ptr[0x00] = (ptr[0x00] & 0xf0) | strlen(upperName);
ptr[0x00] = (uint8_t)((ptr[0x00] & 0xf0) | strlen(upperName));
memcpy(&ptr[0x01], upperName, A2FileProDOS::kMaxFileName);
PutShortLE(&ptr[0x1c], lcFlags); // version/min_version
}
@ -3777,7 +3777,7 @@ DIError DiskFSProDOS::RenameVolume(const char* newName)
dierr = kDIErrBadDirectory;
goto bail;
}
ptr[0x00] = (ptr[0x00] & 0xf0) | strlen(upperName);
ptr[0x00] = (uint8_t)((ptr[0x00] & 0xf0) | strlen(upperName));
memcpy(&ptr[0x01], upperName, A2FileProDOS::kMaxFileName);
PutShortLE(&ptr[0x16], lcFlags); // reserved fields

View File

@ -119,7 +119,9 @@ private:
*/
class Win32VolumeAccess {
public:
Win32VolumeAccess(void) : fpBlockAccess(NULL)
Win32VolumeAccess(void) :
fTotalBlocks(-1),
fpBlockAccess(NULL)
{}
virtual ~Win32VolumeAccess(void) {
if (fpBlockAccess != NULL) {
@ -305,7 +307,11 @@ private:
*/
class PhysicalBlockAccess : public BlockAccess {
public:
PhysicalBlockAccess(void) : fHandle(NULL), fInt13Unit(-1) {}
PhysicalBlockAccess(void) :
fHandle(NULL),
fInt13Unit(-1),
fFloppyKind(kFloppyUnknown)
{}
virtual ~PhysicalBlockAccess(void) {}
virtual DIError Open(const WCHAR* deviceName, bool readOnly);

View File

@ -200,7 +200,16 @@ public:
/*
* Construct/destruct our object.
*/
ReformatHolder(void) {
ReformatHolder(void) :
fApplies(),
fFileType(0),
fAuxType(0),
fSourceFormat(kSourceFormatGeneric),
fNameExt(NULL),
fSourceBuf(),
fSourceLen(),
fErrorBuf()
{
int i;
for (int part = 0; part < kPartMAX; part++) {
if (part == kPartUnknown)
@ -216,10 +225,6 @@ public:
}
for (i = 0; i < kOptMAX; i++)
fOption[i] = 0;
fFileType = fAuxType = 0;
fSourceFormat = kSourceFormatGeneric;
fNameExt = NULL;
}
~ReformatHolder(void) {
LOGI("In ~ReformatHolder");

View File

@ -23,7 +23,7 @@
*/
class CancelDialog : public ModelessDialog {
public:
CancelDialog(void) {}
CancelDialog(void) : fpCancelFlag(NULL) {}
virtual ~CancelDialog(void) {}
BOOL Create(bool* pCancelFlag, int dialogID, CWnd* pParentWnd = NULL) {

View File

@ -46,7 +46,8 @@ class SelectFilesDialog : public CFileDialog {
public:
SelectFilesDialog(const WCHAR* rctmpl, bool showHelp, CWnd* pParentWnd = NULL) :
CFileDialog(true, NULL, NULL, OFN_HIDEREADONLY, NULL, pParentWnd,
0, FALSE /*disable Vista style*/)
0, FALSE /*disable Vista style*/),
fPrevWndProc(NULL)
{
// Set flags. We specify ALLOWMULTISELECT but no filename buffer;
// we want the multi-select behavior but we don't want to return