Change "nil" to "NULL"

This commit is contained in:
Andy McFadden 2014-11-17 21:13:13 -08:00
parent d21ba553ab
commit bf5e2bce50
156 changed files with 2590 additions and 2595 deletions

View File

@ -61,11 +61,11 @@
/* /*
* Extract data from an entry. * Extract data from an entry.
* *
* If "*ppText" is non-nil, the data will be read into the pointed-to buffer * If "*ppText" is non-NULL, the data will be read into the pointed-to buffer
* so long as it's shorter than *pLength bytes. The value in "*pLength" * so long as it's shorter than *pLength bytes. The value in "*pLength"
* will be set to the actual length used. * will be set to the actual length used.
* *
* If "*ppText" is nil, the uncompressed data will be placed into a buffer * If "*ppText" is NULL, the uncompressed data will be placed into a buffer
* allocated with "new[]". * allocated with "new[]".
* *
* Returns IDOK on success, IDCANCEL if the operation was cancelled by the * Returns IDOK on success, IDCANCEL if the operation was cancelled by the
@ -80,15 +80,15 @@ AcuEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength,
{ {
NuError nerr; NuError nerr;
ExpandBuffer expBuf; ExpandBuffer expBuf;
char* dataBuf = nil; char* dataBuf = NULL;
long len; long len;
bool needAlloc = true; bool needAlloc = true;
int result = -1; int result = -1;
ASSERT(fpArchive != nil); ASSERT(fpArchive != NULL);
ASSERT(fpArchive->fFp != nil); ASSERT(fpArchive->fFp != NULL);
if (*ppText != nil) if (*ppText != NULL)
needAlloc = false; needAlloc = false;
if (which != kDataThread) { if (which != kDataThread) {
@ -124,7 +124,7 @@ AcuEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength,
goto bail; goto bail;
} }
char* unsqBuf = nil; char* unsqBuf = NULL;
long unsqLen = 0; long unsqLen = 0;
expBuf.SeizeBuffer(&unsqBuf, &unsqLen); expBuf.SeizeBuffer(&unsqBuf, &unsqLen);
WMSG2("Unsqueezed %ld bytes to %d\n", WMSG2("Unsqueezed %ld bytes to %d\n",
@ -132,7 +132,7 @@ AcuEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength,
if (unsqLen == 0) { if (unsqLen == 0) {
// some bonehead squeezed a zero-length file // some bonehead squeezed a zero-length file
delete[] unsqBuf; delete[] unsqBuf;
ASSERT(*ppText == nil); ASSERT(*ppText == NULL);
WMSG0("Handling zero-length squeezed file!\n"); WMSG0("Handling zero-length squeezed file!\n");
if (needAlloc) { if (needAlloc) {
*ppText = new char[1]; *ppText = new char[1];
@ -161,7 +161,7 @@ AcuEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength,
} else { } else {
if (needAlloc) { if (needAlloc) {
dataBuf = new char[len]; dataBuf = new char[len];
if (dataBuf == nil) { if (dataBuf == NULL) {
pErrMsg->Format(L"allocation of %ld bytes failed", len); pErrMsg->Format(L"allocation of %ld bytes failed", len);
goto bail; goto bail;
} }
@ -193,7 +193,7 @@ bail:
ASSERT(result == IDCANCEL || !pErrMsg->IsEmpty()); ASSERT(result == IDCANCEL || !pErrMsg->IsEmpty());
if (needAlloc) { if (needAlloc) {
delete[] dataBuf; delete[] dataBuf;
ASSERT(*ppText == nil); ASSERT(*ppText == NULL);
} }
} }
return result; return result;
@ -264,7 +264,7 @@ AcuEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv,
// some bonehead squeezed a zero-length file // some bonehead squeezed a zero-length file
if (uncLen == 0) { if (uncLen == 0) {
ASSERT(buf == nil); ASSERT(buf == NULL);
WMSG0("Handling zero-length squeezed file!\n"); WMSG0("Handling zero-length squeezed file!\n");
result = IDOK; result = IDOK;
goto bail; goto bail;
@ -355,7 +355,7 @@ bail:
* Test this entry by extracting it. * Test this entry by extracting it.
* *
* If the file isn't compressed, just make sure the file is big enough. If * If the file isn't compressed, just make sure the file is big enough. If
* it's squeezed, invoke the un-squeeze function with a "nil" buffer pointer. * it's squeezed, invoke the un-squeeze function with a "NULL" buffer pointer.
*/ */
NuError NuError
AcuEntry::TestEntry(CWnd* pMsgWnd) AcuEntry::TestEntry(CWnd* pMsgWnd)
@ -380,7 +380,7 @@ AcuEntry::TestEntry(CWnd* pMsgWnd)
if (GetSqueezed()) { if (GetSqueezed()) {
nerr = UnSqueeze(fpArchive->fFp, (unsigned long) GetCompressedLen(), nerr = UnSqueeze(fpArchive->fFp, (unsigned long) GetCompressedLen(),
nil, false, 0); NULL, false, 0);
if (nerr != kNuErrNone) { if (nerr != kNuErrNone) {
errMsg.Format(L"Unsqueeze failed: %hs.", NuStrError(nerr)); errMsg.Format(L"Unsqueeze failed: %hs.", NuStrError(nerr));
ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED); ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED);
@ -436,7 +436,7 @@ AcuArchive::Open(const WCHAR* filename, bool readOnly, CString* pErrMsg)
errno = 0; errno = 0;
fFp = _wfopen(filename, L"rb"); fFp = _wfopen(filename, L"rb");
if (fFp == nil) { if (fFp == NULL) {
errMsg.Format(L"Unable to open %ls: %hs.", filename, strerror(errno)); errMsg.Format(L"Unable to open %ls: %hs.", filename, strerror(errno));
goto bail; goto bail;
} }
@ -528,7 +528,7 @@ AcuArchive::LoadContents(void)
NuError nerr; NuError nerr;
int numEntries; int numEntries;
ASSERT(fFp != nil); ASSERT(fFp != NULL);
rewind(fFp); rewind(fFp);
/* /*
@ -625,7 +625,7 @@ AcuArchive::ReadFileHeader(AcuFileEntry* pEntry)
NuError err = kNuErrNone; NuError err = kNuErrNone;
unsigned char buf[kAcuEntryHeaderLen]; unsigned char buf[kAcuEntryHeaderLen];
ASSERT(pEntry != nil); ASSERT(pEntry != NULL);
err = AcuRead(buf, kAcuEntryHeaderLen); err = AcuRead(buf, kAcuEntryHeaderLen);
if (err != kNuErrNone) if (err != kNuErrNone)
@ -794,9 +794,9 @@ AcuArchive::AcuRead(void* buf, size_t nbyte)
{ {
size_t result; size_t result;
ASSERT(buf != nil); ASSERT(buf != NULL);
ASSERT(nbyte > 0); ASSERT(nbyte > 0);
ASSERT(fFp != nil); ASSERT(fFp != NULL);
errno = 0; errno = 0;
result = fread(buf, 1, nbyte, fFp); result = fread(buf, 1, nbyte, fFp);
@ -813,7 +813,7 @@ AcuArchive::AcuRead(void* buf, size_t nbyte)
NuError NuError
AcuArchive::AcuSeek(long offset) AcuArchive::AcuSeek(long offset)
{ {
ASSERT(fFp != nil); ASSERT(fFp != NULL);
ASSERT(offset > 0); ASSERT(offset > 0);
/*DBUG(("--- seeking forward %ld bytes\n", offset));*/ /*DBUG(("--- seeking forward %ld bytes\n", offset));*/
@ -862,18 +862,18 @@ AcuArchive::TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
CString errMsg; CString errMsg;
bool retVal = false; bool retVal = false;
ASSERT(fFp != nil); ASSERT(fFp != NULL);
WMSG1("Testing %d entries\n", pSelSet->GetNumEntries()); WMSG1("Testing %d entries\n", pSelSet->GetNumEntries());
SelectionEntry* pSelEntry = pSelSet->IterNext(); SelectionEntry* pSelEntry = pSelSet->IterNext();
while (pSelEntry != nil) { while (pSelEntry != NULL) {
pEntry = (AcuEntry*) pSelEntry->GetEntry(); pEntry = (AcuEntry*) pSelEntry->GetEntry();
WMSG2(" Testing '%hs' (offset=%ld)\n", pEntry->GetDisplayName(), WMSG2(" Testing '%hs' (offset=%ld)\n", pEntry->GetDisplayName(),
pEntry->GetOffset()); pEntry->GetOffset());
SET_PROGRESS_UPDATE2(0, pEntry->GetDisplayName(), nil); SET_PROGRESS_UPDATE2(0, pEntry->GetDisplayName(), NULL);
nerr = pEntry->TestEntry(pMsgWnd); nerr = pEntry->TestEntry(pMsgWnd);
if (nerr != kNuErrNone) { if (nerr != kNuErrNone) {

View File

@ -62,7 +62,7 @@ private:
*/ */
class AcuArchive : public GenericArchive { class AcuArchive : public GenericArchive {
public: public:
AcuArchive(void) : fIsReadOnly(false), fFp(nil) AcuArchive(void) : fIsReadOnly(false), fFp(NULL)
{} {}
virtual ~AcuArchive(void) { (void) Close(); } virtual ~AcuArchive(void) { (void) Close(); }
@ -124,9 +124,9 @@ public:
private: private:
virtual CString Close(void) { virtual CString Close(void) {
if (fFp != nil) { if (fFp != NULL) {
fclose(fFp); fclose(fFp);
fFp = nil; fFp = NULL;
} }
return ""; return "";
} }

View File

@ -49,7 +49,7 @@ AboutDialog::OnInitDialog(void)
/* CiderPress version string */ /* CiderPress version string */
pStatic = (CStatic*) GetDlgItem(IDC_CIDERPRESS_VERS_TEXT); pStatic = (CStatic*) GetDlgItem(IDC_CIDERPRESS_VERS_TEXT);
ASSERT(pStatic != nil); ASSERT(pStatic != NULL);
pStatic->GetWindowText(tmpStr); pStatic->GetWindowText(tmpStr);
newVersion.Format(tmpStr, newVersion.Format(tmpStr,
kAppMajorVersion, kAppMinorVersion, kAppBugVersion, kAppMajorVersion, kAppMinorVersion, kAppBugVersion,
@ -58,7 +58,7 @@ AboutDialog::OnInitDialog(void)
/* grab the static text control with the NufxLib version info */ /* grab the static text control with the NufxLib version info */
pStatic = (CStatic*) GetDlgItem(IDC_NUFXLIB_VERS_TEXT); pStatic = (CStatic*) GetDlgItem(IDC_NUFXLIB_VERS_TEXT);
ASSERT(pStatic != nil); ASSERT(pStatic != NULL);
nerr = NuGetVersion(&major, &minor, &bug, NULL, NULL); nerr = NuGetVersion(&major, &minor, &bug, NULL, NULL);
ASSERT(nerr == kNuErrNone); ASSERT(nerr == kNuErrNone);
@ -68,7 +68,7 @@ AboutDialog::OnInitDialog(void)
/* grab the static text control with the DiskImg version info */ /* grab the static text control with the DiskImg version info */
pStatic = (CStatic*) GetDlgItem(IDC_DISKIMG_VERS_TEXT); pStatic = (CStatic*) GetDlgItem(IDC_DISKIMG_VERS_TEXT);
ASSERT(pStatic != nil); ASSERT(pStatic != NULL);
DiskImgLib::Global::GetVersion(&major, &minor, &bug); DiskImgLib::Global::GetVersion(&major, &minor, &bug);
pStatic->GetWindowText(tmpStr); pStatic->GetWindowText(tmpStr);
@ -77,7 +77,7 @@ AboutDialog::OnInitDialog(void)
/* set the zlib version */ /* set the zlib version */
pStatic = (CStatic*) GetDlgItem(IDC_ZLIB_VERS_TEXT); pStatic = (CStatic*) GetDlgItem(IDC_ZLIB_VERS_TEXT);
ASSERT(pStatic != nil); ASSERT(pStatic != NULL);
pStatic->GetWindowText(tmpStr); pStatic->GetWindowText(tmpStr);
CString zlibVersionStr(zlibVersion()); CString zlibVersionStr(zlibVersion());
newVersion.Format(tmpStr, zlibVersionStr); newVersion.Format(tmpStr, zlibVersionStr);
@ -85,7 +85,7 @@ AboutDialog::OnInitDialog(void)
/* and, finally, the ASPI version */ /* and, finally, the ASPI version */
pStatic = (CStatic*) GetDlgItem(IDC_ASPI_VERS_TEXT); pStatic = (CStatic*) GetDlgItem(IDC_ASPI_VERS_TEXT);
ASSERT(pStatic != nil); ASSERT(pStatic != NULL);
if (DiskImgLib::Global::GetHasASPI()) { if (DiskImgLib::Global::GetHasASPI()) {
CString versionStr; CString versionStr;
DWORD version = DiskImgLib::Global::GetASPIVersion(); DWORD version = DiskImgLib::Global::GetASPIVersion();
@ -104,7 +104,7 @@ AboutDialog::OnInitDialog(void)
//ShowRegistrationInfo(); //ShowRegistrationInfo();
{ {
CWnd* pWnd = GetDlgItem(IDC_ABOUT_ENTER_REG); CWnd* pWnd = GetDlgItem(IDC_ABOUT_ENTER_REG);
if (pWnd != nil) { if (pWnd != NULL) {
pWnd->EnableWindow(FALSE); pWnd->EnableWindow(FALSE);
pWnd->ShowWindow(FALSE); pWnd->ShowWindow(FALSE);
} }
@ -139,11 +139,11 @@ AboutDialog::ShowRegistrationInfo(void)
//CWnd* pExpireWnd; //CWnd* pExpireWnd;
pUserWnd = GetDlgItem(IDC_REG_USER_NAME); pUserWnd = GetDlgItem(IDC_REG_USER_NAME);
ASSERT(pUserWnd != nil); ASSERT(pUserWnd != NULL);
pCompanyWnd = GetDlgItem(IDC_REG_COMPANY_NAME); pCompanyWnd = GetDlgItem(IDC_REG_COMPANY_NAME);
ASSERT(pCompanyWnd != nil); ASSERT(pCompanyWnd != NULL);
//pExpireWnd = GetDlgItem(IDC_REG_EXPIRES); //pExpireWnd = GetDlgItem(IDC_REG_EXPIRES);
//ASSERT(pExpireWnd != nil); //ASSERT(pExpireWnd != NULL);
if (gMyApp.fRegistry.GetRegistration(&user, &company, &reg, &versions, if (gMyApp.fRegistry.GetRegistration(&user, &company, &reg, &versions,
&expire) == 0) &expire) == 0)
@ -160,7 +160,7 @@ AboutDialog::ShowRegistrationInfo(void)
expireWhen = atol(expire); expireWhen = atol(expire);
if (expireWhen > 0) { if (expireWhen > 0) {
CString expireStr; CString expireStr;
time_t now = time(nil); time_t now = time(NULL);
expireStr.Format(IDS_REG_EVAL_REM, expireStr.Format(IDS_REG_EVAL_REM,
((expireWhen - now) + kDay-1) / kDay); ((expireWhen - now) + kDay-1) / kDay);
/* leave pUserWnd and pCompanyWnd set to defaults */ /* leave pUserWnd and pCompanyWnd set to defaults */
@ -176,7 +176,7 @@ AboutDialog::ShowRegistrationInfo(void)
/* remove "Enter Registration" button */ /* remove "Enter Registration" button */
CWnd* pWnd = GetDlgItem(IDC_ABOUT_ENTER_REG); CWnd* pWnd = GetDlgItem(IDC_ABOUT_ENTER_REG);
if (pWnd != nil) { if (pWnd != NULL) {
pWnd->EnableWindow(FALSE); pWnd->EnableWindow(FALSE);
} }
} }

View File

@ -31,10 +31,10 @@ ActionProgressDialog::OnInitDialog(void)
// clear the filename fields // clear the filename fields
pWnd = GetDlgItem(IDC_PROG_ARC_NAME); pWnd = GetDlgItem(IDC_PROG_ARC_NAME);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->SetWindowText(_T("-")); pWnd->SetWindowText(_T("-"));
pWnd = GetDlgItem(IDC_PROG_FILE_NAME); pWnd = GetDlgItem(IDC_PROG_FILE_NAME);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->SetWindowText(_T("-")); pWnd->SetWindowText(_T("-"));
pWnd->SetFocus(); // get the focus off the Cancel button pWnd->SetFocus(); // get the focus off the Cancel button
@ -44,12 +44,12 @@ ActionProgressDialog::OnInitDialog(void)
} else if (fAction == kActionRecompress) { } else if (fAction == kActionRecompress) {
CString tmpStr; CString tmpStr;
pWnd = GetDlgItem(IDC_PROG_VERB); pWnd = GetDlgItem(IDC_PROG_VERB);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
tmpStr.LoadString(IDS_NOW_EXPANDING); tmpStr.LoadString(IDS_NOW_EXPANDING);
pWnd->SetWindowText(tmpStr); pWnd->SetWindowText(tmpStr);
pWnd = GetDlgItem(IDC_PROG_TOFROM); pWnd = GetDlgItem(IDC_PROG_TOFROM);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
tmpStr.LoadString(IDS_NOW_COMPRESSING); tmpStr.LoadString(IDS_NOW_COMPRESSING);
pWnd->SetWindowText(tmpStr); pWnd->SetWindowText(tmpStr);
} else if (fAction == kActionAdd || fAction == kActionAddDisk || } else if (fAction == kActionAdd || fAction == kActionAddDisk ||
@ -57,37 +57,37 @@ ActionProgressDialog::OnInitDialog(void)
{ {
CString tmpStr; CString tmpStr;
pWnd = GetDlgItem(IDC_PROG_VERB); pWnd = GetDlgItem(IDC_PROG_VERB);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
tmpStr.LoadString(IDS_NOW_ADDING); tmpStr.LoadString(IDS_NOW_ADDING);
pWnd->SetWindowText(tmpStr); pWnd->SetWindowText(tmpStr);
pWnd = GetDlgItem(IDC_PROG_TOFROM); pWnd = GetDlgItem(IDC_PROG_TOFROM);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
tmpStr.LoadString(IDS_ADDING_AS); tmpStr.LoadString(IDS_ADDING_AS);
pWnd->SetWindowText(tmpStr); pWnd->SetWindowText(tmpStr);
} else if (fAction == kActionDelete) { } else if (fAction == kActionDelete) {
CString tmpStr; CString tmpStr;
pWnd = GetDlgItem(IDC_PROG_VERB); pWnd = GetDlgItem(IDC_PROG_VERB);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
tmpStr.LoadString(IDS_NOW_DELETING); tmpStr.LoadString(IDS_NOW_DELETING);
pWnd->SetWindowText(tmpStr); pWnd->SetWindowText(tmpStr);
pWnd = GetDlgItem(IDC_PROG_TOFROM); pWnd = GetDlgItem(IDC_PROG_TOFROM);
pWnd->DestroyWindow(); pWnd->DestroyWindow();
pWnd = GetDlgItem(IDC_PROG_FILE_NAME); pWnd = GetDlgItem(IDC_PROG_FILE_NAME);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->SetWindowText(_T("")); pWnd->SetWindowText(_T(""));
} else if (fAction == kActionTest) { } else if (fAction == kActionTest) {
CString tmpStr; CString tmpStr;
pWnd = GetDlgItem(IDC_PROG_VERB); pWnd = GetDlgItem(IDC_PROG_VERB);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
tmpStr.LoadString(IDS_NOW_TESTING); tmpStr.LoadString(IDS_NOW_TESTING);
pWnd->SetWindowText(tmpStr); pWnd->SetWindowText(tmpStr);
pWnd = GetDlgItem(IDC_PROG_TOFROM); pWnd = GetDlgItem(IDC_PROG_TOFROM);
pWnd->DestroyWindow(); pWnd->DestroyWindow();
pWnd = GetDlgItem(IDC_PROG_FILE_NAME); pWnd = GetDlgItem(IDC_PROG_FILE_NAME);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->SetWindowText(_T("")); pWnd->SetWindowText(_T(""));
} else { } else {
ASSERT(false); ASSERT(false);
@ -105,7 +105,7 @@ ActionProgressDialog::SetArcName(const WCHAR* str)
CString oldStr; CString oldStr;
CWnd* pWnd = GetDlgItem(IDC_PROG_ARC_NAME); CWnd* pWnd = GetDlgItem(IDC_PROG_ARC_NAME);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->GetWindowText(oldStr); pWnd->GetWindowText(oldStr);
if (oldStr != str) if (oldStr != str)
pWnd->SetWindowText(str); pWnd->SetWindowText(str);
@ -117,7 +117,7 @@ ActionProgressDialog::GetFileName(void)
CString str; CString str;
CWnd* pWnd = GetDlgItem(IDC_PROG_FILE_NAME); CWnd* pWnd = GetDlgItem(IDC_PROG_FILE_NAME);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->GetWindowText(str); pWnd->GetWindowText(str);
return str; return str;
@ -132,7 +132,7 @@ ActionProgressDialog::SetFileName(const WCHAR* str)
CString oldStr; CString oldStr;
CWnd* pWnd = GetDlgItem(IDC_PROG_FILE_NAME); CWnd* pWnd = GetDlgItem(IDC_PROG_FILE_NAME);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->GetWindowText(oldStr); pWnd->GetWindowText(oldStr);
if (oldStr != str) if (oldStr != str)
pWnd->SetWindowText(str); pWnd->SetWindowText(str);

View File

@ -30,8 +30,8 @@ public:
ActionProgressDialog(void) { ActionProgressDialog(void) {
fAction = kActionUnknown; fAction = kActionUnknown;
//fpSelSet = nil; //fpSelSet = NULL;
//fpOptionsDlg = nil; //fpOptionsDlg = NULL;
fCancel = false; fCancel = false;
//fResult = 0; //fResult = 0;
} }

View File

@ -56,7 +56,7 @@ MainWindow::OnActionsView(void)
void void
MainWindow::OnUpdateActionsView(CCmdUI* pCmdUI) MainWindow::OnUpdateActionsView(CCmdUI* pCmdUI)
{ {
pCmdUI->Enable(fpContentList != nil && pCmdUI->Enable(fpContentList != NULL &&
fpContentList->GetSelectedCount() > 0); fpContentList->GetSelectedCount() > 0);
} }
@ -73,7 +73,7 @@ MainWindow::OnUpdateActionsView(CCmdUI* pCmdUI)
void void
MainWindow::HandleView(void) MainWindow::HandleView(void)
{ {
ASSERT(fpContentList != nil); ASSERT(fpContentList != NULL);
SelectionSet selSet; SelectionSet selSet;
int threadMask = GenericEntry::kAnyThread | GenericEntry::kAllowDamaged | int threadMask = GenericEntry::kAnyThread | GenericEntry::kAllowDamaged |
@ -96,7 +96,7 @@ MainWindow::HandleView(void)
vfd.SetNoWrapText(fPreferences.GetPrefBool(kPrNoWrapText)); vfd.SetNoWrapText(fPreferences.GetPrefBool(kPrNoWrapText));
vfd.DoModal(); vfd.DoModal();
//fpSelSet = nil; //fpSelSet = NULL;
// remember which font they used (sticky pref, not in registry) // remember which font they used (sticky pref, not in registry)
fPreferences.SetPrefString(kPrViewTextTypeFace, vfd.GetTextTypeFace()); fPreferences.SetPrefString(kPrViewTextTypeFace, vfd.GetTextTypeFace());
@ -122,7 +122,7 @@ MainWindow::HandleView(void)
void void
MainWindow::OnActionsOpenAsDisk(void) MainWindow::OnActionsOpenAsDisk(void)
{ {
ASSERT(fpContentList != nil); ASSERT(fpContentList != NULL);
ASSERT(fpContentList->GetSelectedCount() == 1); ASSERT(fpContentList->GetSelectedCount() == 1);
GenericEntry* pEntry = GetSelectedItem(fpContentList); GenericEntry* pEntry = GetSelectedItem(fpContentList);
@ -137,9 +137,9 @@ MainWindow::OnUpdateActionsOpenAsDisk(CCmdUI* pCmdUI)
const int kMinLen = 512 * 7; const int kMinLen = 512 * 7;
bool allow = false; bool allow = false;
if (fpContentList != nil && fpContentList->GetSelectedCount() == 1) { if (fpContentList != NULL && fpContentList->GetSelectedCount() == 1) {
GenericEntry* pEntry = GetSelectedItem(fpContentList); GenericEntry* pEntry = GetSelectedItem(fpContentList);
if (pEntry != nil) { if (pEntry != NULL) {
if ((pEntry->GetHasDataFork() || pEntry->GetHasDiskImage()) && if ((pEntry->GetHasDataFork() || pEntry->GetHasDiskImage()) &&
pEntry->GetUncompressedLen() > kMinLen) pEntry->GetUncompressedLen() > kMinLen)
{ {
@ -165,7 +165,7 @@ MainWindow::OnActionsAddFiles(void)
{ {
WMSG0("Add files!\n"); WMSG0("Add files!\n");
AddFilesDialog addFiles(this); AddFilesDialog addFiles(this);
DiskImgLib::A2File* pTargetSubdir = nil; DiskImgLib::A2File* pTargetSubdir = NULL;
/* /*
* Special handling for adding files to disk images. * Special handling for adding files to disk images.
@ -199,11 +199,11 @@ MainWindow::OnActionsAddFiles(void)
* stripping to be on for non-hierarchical filesystems (i.e. everything * stripping to be on for non-hierarchical filesystems (i.e. everything
* but ProDOS and HFS). * but ProDOS and HFS).
*/ */
if (addFiles.fpTargetDiskFS != nil) { if (addFiles.fpTargetDiskFS != NULL) {
DiskImg::FSFormat format; DiskImg::FSFormat format;
format = addFiles.fpTargetDiskFS->GetDiskImg()->GetFSFormat(); format = addFiles.fpTargetDiskFS->GetDiskImg()->GetFSFormat();
if (pTargetSubdir != nil) { if (pTargetSubdir != NULL) {
ASSERT(!pTargetSubdir->IsVolumeDirectory()); ASSERT(!pTargetSubdir->IsVolumeDirectory());
addFiles.fStoragePrefix = pTargetSubdir->GetPathName(); addFiles.fStoragePrefix = pTargetSubdir->GetPathName();
} }
@ -259,7 +259,7 @@ MainWindow::OnActionsAddFiles(void)
fpContentList->Reload(); fpContentList->Reload();
fpActionProgress->Cleanup(this); fpActionProgress->Cleanup(this);
fpActionProgress = nil; fpActionProgress = NULL;
if (result) if (result)
SuccessBeep(); SuccessBeep();
} else { } else {
@ -269,7 +269,7 @@ MainWindow::OnActionsAddFiles(void)
void void
MainWindow::OnUpdateActionsAddFiles(CCmdUI* pCmdUI) MainWindow::OnUpdateActionsAddFiles(CCmdUI* pCmdUI)
{ {
pCmdUI->Enable(fpContentList != nil && !fpOpenArchive->IsReadOnly()); pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly());
} }
@ -277,20 +277,20 @@ MainWindow::OnUpdateActionsAddFiles(CCmdUI* pCmdUI)
* Figure out where they want to add files. * Figure out where they want to add files.
* *
* If the volume directory of a disk is chosen, "*ppTargetSubdir" will * If the volume directory of a disk is chosen, "*ppTargetSubdir" will
* be set to nil. * be set to NULL.
*/ */
bool bool
MainWindow::ChooseAddTarget(DiskImgLib::A2File** ppTargetSubdir, MainWindow::ChooseAddTarget(DiskImgLib::A2File** ppTargetSubdir,
DiskImgLib::DiskFS** ppTargetDiskFS) DiskImgLib::DiskFS** ppTargetDiskFS)
{ {
ASSERT(ppTargetSubdir != nil); ASSERT(ppTargetSubdir != NULL);
ASSERT(ppTargetDiskFS != nil); ASSERT(ppTargetDiskFS != NULL);
*ppTargetSubdir = nil; *ppTargetSubdir = NULL;
*ppTargetDiskFS = nil; *ppTargetDiskFS = NULL;
GenericEntry* pEntry = GetSelectedItem(fpContentList); GenericEntry* pEntry = GetSelectedItem(fpContentList);
if (pEntry != nil && if (pEntry != NULL &&
(pEntry->GetRecordKind() == GenericEntry::kRecordKindDirectory || (pEntry->GetRecordKind() == GenericEntry::kRecordKindDirectory ||
pEntry->GetRecordKind() == GenericEntry::kRecordKindVolumeDir)) pEntry->GetRecordKind() == GenericEntry::kRecordKindVolumeDir))
{ {
@ -324,12 +324,12 @@ MainWindow::ChooseAddTarget(DiskImgLib::A2File** ppTargetSubdir,
*ppTargetDiskFS = targetDialog.fpChosenDiskFS; *ppTargetDiskFS = targetDialog.fpChosenDiskFS;
/* make sure the subdir is part of the diskfs */ /* make sure the subdir is part of the diskfs */
ASSERT(*ppTargetSubdir == nil || ASSERT(*ppTargetSubdir == NULL ||
(*ppTargetSubdir)->GetDiskFS() == *ppTargetDiskFS); (*ppTargetSubdir)->GetDiskFS() == *ppTargetDiskFS);
} }
if (*ppTargetSubdir != nil && (*ppTargetSubdir)->IsVolumeDirectory()) if (*ppTargetSubdir != NULL && (*ppTargetSubdir)->IsVolumeDirectory())
*ppTargetSubdir = nil; *ppTargetSubdir = NULL;
return true; return true;
} }
@ -481,7 +481,7 @@ MainWindow::OnActionsAddDisks(void)
fpContentList->Reload(); fpContentList->Reload();
fpActionProgress->Cleanup(this); fpActionProgress->Cleanup(this);
fpActionProgress = nil; fpActionProgress = NULL;
if (result) if (result)
SuccessBeep(); SuccessBeep();
@ -492,7 +492,7 @@ bail:
void void
MainWindow::OnUpdateActionsAddDisks(CCmdUI* pCmdUI) MainWindow::OnUpdateActionsAddDisks(CCmdUI* pCmdUI)
{ {
pCmdUI->Enable(fpContentList != nil && !fpOpenArchive->IsReadOnly() && pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly() &&
fpOpenArchive->GetCapability(GenericArchive::kCapCanAddDisk)); fpOpenArchive->GetCapability(GenericArchive::kCapCanAddDisk));
} }
@ -516,12 +516,12 @@ MainWindow::OnActionsCreateSubdir(void)
{ {
CreateSubdirDialog csDialog; CreateSubdirDialog csDialog;
ASSERT(fpContentList != nil); ASSERT(fpContentList != NULL);
ASSERT(fpOpenArchive != nil); ASSERT(fpOpenArchive != NULL);
ASSERT(!fpOpenArchive->IsReadOnly()); ASSERT(!fpOpenArchive->IsReadOnly());
GenericEntry* pEntry = GetSelectedItem(fpContentList); GenericEntry* pEntry = GetSelectedItem(fpContentList);
if (pEntry == nil) { if (pEntry == NULL) {
// can happen for no selection or multi-selection; should not be here // can happen for no selection or multi-selection; should not be here
ASSERT(false); ASSERT(false);
return; return;
@ -552,14 +552,14 @@ MainWindow::OnActionsCreateSubdir(void)
void void
MainWindow::OnUpdateActionsCreateSubdir(CCmdUI* pCmdUI) MainWindow::OnUpdateActionsCreateSubdir(CCmdUI* pCmdUI)
{ {
bool enable = fpContentList != nil && !fpOpenArchive->IsReadOnly() && bool enable = fpContentList != NULL && !fpOpenArchive->IsReadOnly() &&
fpContentList->GetSelectedCount() == 1 && fpContentList->GetSelectedCount() == 1 &&
fpOpenArchive->GetCapability(GenericArchive::kCapCanCreateSubdir); fpOpenArchive->GetCapability(GenericArchive::kCapCanCreateSubdir);
if (enable) { if (enable) {
/* second-level check: make sure it's a subdir */ /* second-level check: make sure it's a subdir */
GenericEntry* pEntry = GetSelectedItem(fpContentList); GenericEntry* pEntry = GetSelectedItem(fpContentList);
if (pEntry == nil) { if (pEntry == NULL) {
ASSERT(false); ASSERT(false);
return; return;
} }
@ -586,7 +586,7 @@ MainWindow::OnUpdateActionsCreateSubdir(CCmdUI* pCmdUI)
void void
MainWindow::OnActionsExtract(void) MainWindow::OnActionsExtract(void)
{ {
ASSERT(fpContentList != nil); ASSERT(fpContentList != NULL);
/* /*
* Ask the user about various options. * Ask the user about various options.
@ -664,12 +664,12 @@ MainWindow::OnActionsExtract(void)
fpActionProgress->Create(ActionProgressDialog::kActionExtract, this); fpActionProgress->Create(ActionProgressDialog::kActionExtract, this);
DoBulkExtract(&selSet, &extOpts); DoBulkExtract(&selSet, &extOpts);
fpActionProgress->Cleanup(this); fpActionProgress->Cleanup(this);
fpActionProgress = nil; fpActionProgress = NULL;
} }
void void
MainWindow::OnUpdateActionsExtract(CCmdUI* pCmdUI) MainWindow::OnUpdateActionsExtract(CCmdUI* pCmdUI)
{ {
pCmdUI->Enable(fpContentList != nil); pCmdUI->Enable(fpContentList != NULL);
} }
/* /*
@ -685,11 +685,11 @@ void
MainWindow::DoBulkExtract(SelectionSet* pSelSet, MainWindow::DoBulkExtract(SelectionSet* pSelSet,
const ExtractOptionsDialog* pExtOpts) const ExtractOptionsDialog* pExtOpts)
{ {
ReformatHolder* pHolder = nil; ReformatHolder* pHolder = NULL;
bool overwriteExisting, ovwrForAll; bool overwriteExisting, ovwrForAll;
ASSERT(pSelSet != nil); ASSERT(pSelSet != NULL);
ASSERT(fpActionProgress != nil); ASSERT(fpActionProgress != NULL);
pSelSet->IterReset(); pSelSet->IterReset();
@ -704,7 +704,7 @@ MainWindow::DoBulkExtract(SelectionSet* pSelSet,
PeekAndPump(); PeekAndPump();
pSelEntry = pSelSet->IterNext(); pSelEntry = pSelSet->IterNext();
if (pSelEntry == nil) { if (pSelEntry == NULL) {
SuccessBeep(); SuccessBeep();
break; // out of while (all done!) break; // out of while (all done!)
} }
@ -783,7 +783,7 @@ MainWindow::DoBulkExtract(SelectionSet* pSelSet,
break; break;
} }
delete pHolder; delete pHolder;
pHolder = nil; pHolder = NULL;
} }
// if they cancelled, delete the "stray" // if they cancelled, delete the "stray"
@ -793,8 +793,8 @@ MainWindow::DoBulkExtract(SelectionSet* pSelSet,
/* /*
* Extract a single entry. * Extract a single entry.
* *
* If "pHolder" is non-nil, it holds the data from the file, and can be * If "pHolder" is non-NULL, it holds the data from the file, and can be
* used for formatted or non-formatted output. If it's nil, we need to * used for formatted or non-formatted output. If it's NULL, we need to
* extract the data ourselves. * extract the data ourselves.
* *
* Returns "true" on success, "false" on failure. * Returns "true" on success, "false" on failure.
@ -849,10 +849,10 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
failed.LoadString(IDS_FAILED); failed.LoadString(IDS_FAILED);
bool writeFailed = false; bool writeFailed = false;
bool extractAs2MG = false; bool extractAs2MG = false;
char* reformatText = nil; char* reformatText = NULL;
MyDIBitmap* reformatDib = nil; MyDIBitmap* reformatDib = NULL;
ASSERT(pEntry != nil); ASSERT(pEntry != NULL);
/* /*
* If we're interested in extracting disk images as 2MG files, * If we're interested in extracting disk images as 2MG files,
@ -909,7 +909,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
*/ */
ASSERT(pExtOpts->fExtractPath.Right(1) == "\\"); ASSERT(pExtOpts->fExtractPath.Right(1) == "\\");
CString adjustedExtractPath(pExtOpts->fExtractPath); CString adjustedExtractPath(pExtOpts->fExtractPath);
if (!pExtOpts->fStripFolderNames && pEntry->GetSubVolName() != nil) { if (!pExtOpts->fStripFolderNames && pEntry->GetSubVolName() != NULL) {
adjustedExtractPath += pEntry->GetSubVolName(); adjustedExtractPath += pEntry->GetSubVolName();
adjustedExtractPath += "\\"; adjustedExtractPath += "\\";
} }
@ -917,12 +917,12 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
outputPath += convNameExtdPlus; outputPath += convNameExtdPlus;
ReformatOutput* pOutput = nil; ReformatOutput* pOutput = NULL;
/* /*
* If requested, try to reformat this file. * If requested, try to reformat this file.
*/ */
if (pHolder != nil) { if (pHolder != NULL) {
ReformatHolder::ReformatPart part = ReformatHolder::kPartUnknown; ReformatHolder::ReformatPart part = ReformatHolder::kPartUnknown;
ReformatHolder::ReformatID id; ReformatHolder::ReformatID id;
CString title; CString title;
@ -952,7 +952,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
pOutput = pHolder->Apply(part, id); pOutput = pHolder->Apply(part, id);
} }
if (pOutput != nil) { if (pOutput != NULL) {
/* use output pathname without preservation */ /* use output pathname without preservation */
CString tmpPath; CString tmpPath;
bool goodReformat = true; bool goodReformat = true;
@ -999,7 +999,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
outputPath = tmpPath; outputPath = tmpPath;
} else { } else {
delete pOutput; delete pOutput;
pOutput = nil; pOutput = NULL;
} }
} }
} }
@ -1035,7 +1035,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
* *
* Returns IDCANCEL on failures as well as user cancellation. * Returns IDCANCEL on failures as well as user cancellation.
*/ */
FILE* fp = nil; FILE* fp = NULL;
int result; int result;
result = OpenOutputFile(&outputPath, pathProp, pEntry->GetModWhen(), result = OpenOutputFile(&outputPath, pathProp, pEntry->GetModWhen(),
pOverwriteExisting, pOvwrForAll, &fp); pOverwriteExisting, pOvwrForAll, &fp);
@ -1053,7 +1053,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
fpActionProgress->SetFileName(outputPath); fpActionProgress->SetFileName(outputPath);
} }
if (fp == nil) { if (fp == NULL) {
/* looks like they elected to skip extraction of this file */ /* looks like they elected to skip extraction of this file */
delete pOutput; delete pOutput;
return true; return true;
@ -1143,7 +1143,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
* *
* (Could also be due to extraction failure, e.g. bad CRC.) * (Could also be due to extraction failure, e.g. bad CRC.)
*/ */
if (pOutput != nil) { if (pOutput != NULL) {
/* /*
* We have the data in our buffer. Write it out. No need * We have the data in our buffer. Write it out. No need
* to tweak the progress updater, which already shows 100%. * to tweak the progress updater, which already shows 100%.
@ -1160,7 +1160,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
pOutput->GetOutputKind() == ReformatOutput::kOutputCSV) pOutput->GetOutputKind() == ReformatOutput::kOutputCSV)
{ {
WMSG0(" Writing text, RTF, CSV, or raw\n"); WMSG0(" Writing text, RTF, CSV, or raw\n");
ASSERT(pOutput->GetTextBuf() != nil); ASSERT(pOutput->GetTextBuf() != NULL);
int err = 0; int err = 0;
if (fwrite(pOutput->GetTextBuf(), if (fwrite(pOutput->GetTextBuf(),
pOutput->GetTextLen(), 1, fp) != 1) pOutput->GetTextLen(), 1, fp) != 1)
@ -1176,7 +1176,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
} }
} else if (pOutput->GetOutputKind() == ReformatOutput::kOutputBitmap) { } else if (pOutput->GetOutputKind() == ReformatOutput::kOutputBitmap) {
WMSG0(" Writing bitmap\n"); WMSG0(" Writing bitmap\n");
ASSERT(pOutput->GetDIB() != nil); ASSERT(pOutput->GetDIB() != NULL);
int err = pOutput->GetDIB()->WriteToFile(fp); int err = pOutput->GetDIB()->WriteToFile(fp);
if (err != 0) { if (err != 0) {
errMsg.Format(L"Unable to save bitmap '%ls': %hs\n", errMsg.Format(L"Unable to save bitmap '%ls': %hs\n",
@ -1198,7 +1198,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
*/ */
WMSG1(" Writing un-reformatted data (%ld bytes)\n", WMSG1(" Writing un-reformatted data (%ld bytes)\n",
pOutput->GetTextLen()); pOutput->GetTextLen());
ASSERT(pOutput->GetTextBuf() != nil); ASSERT(pOutput->GetTextBuf() != NULL);
bool lastCR = false; bool lastCR = false;
GenericEntry::ConvertHighASCII thisConvHA = convHA; GenericEntry::ConvertHighASCII thisConvHA = convHA;
int err; int err;
@ -1229,7 +1229,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
*/ */
CString msg; CString msg;
int result; int result;
ASSERT(fpActionProgress != nil); ASSERT(fpActionProgress != NULL);
WMSG3("Extracting '%ls', requesting thisConv=%d, convHA=%d\n", WMSG3("Extracting '%ls', requesting thisConv=%d, convHA=%d\n",
outputPath, thisConv, convHA); outputPath, thisConv, convHA);
result = pEntry->ExtractThreadToFile(thread, fp, result = pEntry->ExtractThreadToFile(thread, fp,
@ -1284,7 +1284,7 @@ open_file_fail:
* is false, then we will put up the "do you want to overwrite?" dialog. * is false, then we will put up the "do you want to overwrite?" dialog.
* One possible outcome of the dialog is renaming the output path. * One possible outcome of the dialog is renaming the output path.
* *
* On success, "*pFp" will be non-nil, and IDOK will be returned. On * On success, "*pFp" will be non-NULL, and IDOK will be returned. On
* failure, IDCANCEL will be returned. The values in "*pOverwriteExisting" * failure, IDCANCEL will be returned. The values in "*pOverwriteExisting"
* and "*pOvwrForAll" may be updated, and "*pOutputPath" will change if * and "*pOvwrForAll" may be updated, and "*pOutputPath" will change if
* the user chose to rename the file. * the user chose to rename the file.
@ -1301,7 +1301,7 @@ MainWindow::OpenOutputFile(CString* pOutputPath, const PathProposal& pathProp,
failed.LoadString(IDS_FAILED); failed.LoadString(IDS_FAILED);
*pFp = nil; *pFp = NULL;
did_rename: did_rename:
PathName path(*pOutputPath); PathName path(*pOutputPath);
@ -1361,7 +1361,7 @@ do_overwrite:
goto bail; goto bail;
*pFp = _wfopen(*pOutputPath, L"wb"); *pFp = _wfopen(*pOutputPath, L"wb");
if (*pFp == nil) if (*pFp == NULL)
err = errno ? errno : -1; err = errno ? errno : -1;
/* fall through with error */ /* fall through with error */
@ -1407,8 +1407,8 @@ bail:
void void
MainWindow::OnActionsTest(void) MainWindow::OnActionsTest(void)
{ {
ASSERT(fpContentList != nil); ASSERT(fpContentList != NULL);
ASSERT(fpOpenArchive != nil); ASSERT(fpOpenArchive != NULL);
/* /*
* Ask the user about various options. * Ask the user about various options.
@ -1461,14 +1461,14 @@ MainWindow::OnActionsTest(void)
result = fpOpenArchive->TestSelection(fpActionProgress, &selSet); result = fpOpenArchive->TestSelection(fpActionProgress, &selSet);
fpActionProgress->Cleanup(this); fpActionProgress->Cleanup(this);
fpActionProgress = nil; fpActionProgress = NULL;
//if (result) //if (result)
// SuccessBeep(); // SuccessBeep();
} }
void void
MainWindow::OnUpdateActionsTest(CCmdUI* pCmdUI) MainWindow::OnUpdateActionsTest(CCmdUI* pCmdUI)
{ {
pCmdUI->Enable(fpContentList != nil && fpContentList->GetItemCount() > 0 pCmdUI->Enable(fpContentList != NULL && fpContentList->GetItemCount() > 0
&& fpOpenArchive->GetCapability(GenericArchive::kCapCanTest)); && fpOpenArchive->GetCapability(GenericArchive::kCapCanTest));
} }
@ -1485,8 +1485,8 @@ MainWindow::OnUpdateActionsTest(CCmdUI* pCmdUI)
void void
MainWindow::OnActionsDelete(void) MainWindow::OnActionsDelete(void)
{ {
ASSERT(fpContentList != nil); ASSERT(fpContentList != NULL);
ASSERT(fpOpenArchive != nil); ASSERT(fpOpenArchive != NULL);
ASSERT(!fpOpenArchive->IsReadOnly()); ASSERT(!fpOpenArchive->IsReadOnly());
/* /*
@ -1565,7 +1565,7 @@ MainWindow::OnActionsDelete(void)
fpContentList->Reload(); fpContentList->Reload();
fpActionProgress->Cleanup(this); fpActionProgress->Cleanup(this);
fpActionProgress = nil; fpActionProgress = NULL;
if (result) if (result)
SuccessBeep(); SuccessBeep();
@ -1573,7 +1573,7 @@ MainWindow::OnActionsDelete(void)
void void
MainWindow::OnUpdateActionsDelete(CCmdUI* pCmdUI) MainWindow::OnUpdateActionsDelete(CCmdUI* pCmdUI)
{ {
pCmdUI->Enable(fpContentList != nil && !fpOpenArchive->IsReadOnly() pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly()
&& fpContentList->GetSelectedCount() > 0); && fpContentList->GetSelectedCount() > 0);
} }
@ -1592,8 +1592,8 @@ MainWindow::OnUpdateActionsDelete(CCmdUI* pCmdUI)
void void
MainWindow::OnActionsRename(void) MainWindow::OnActionsRename(void)
{ {
ASSERT(fpContentList != nil); ASSERT(fpContentList != NULL);
ASSERT(fpOpenArchive != nil); ASSERT(fpOpenArchive != NULL);
ASSERT(!fpOpenArchive->IsReadOnly()); ASSERT(!fpOpenArchive->IsReadOnly());
/* /*
@ -1628,7 +1628,7 @@ MainWindow::OnActionsRename(void)
void void
MainWindow::OnUpdateActionsRename(CCmdUI* pCmdUI) MainWindow::OnUpdateActionsRename(CCmdUI* pCmdUI)
{ {
pCmdUI->Enable(fpContentList != nil && !fpOpenArchive->IsReadOnly() pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly()
&& fpContentList->GetSelectedCount() > 0); && fpContentList->GetSelectedCount() > 0);
} }
@ -1645,15 +1645,15 @@ MainWindow::OnUpdateActionsRename(CCmdUI* pCmdUI)
void void
MainWindow::OnActionsEditComment(void) MainWindow::OnActionsEditComment(void)
{ {
ASSERT(fpContentList != nil); ASSERT(fpContentList != NULL);
ASSERT(fpOpenArchive != nil); ASSERT(fpOpenArchive != NULL);
ASSERT(!fpOpenArchive->IsReadOnly()); ASSERT(!fpOpenArchive->IsReadOnly());
EditCommentDialog editDlg(this); EditCommentDialog editDlg(this);
CString oldComment; CString oldComment;
GenericEntry* pEntry = GetSelectedItem(fpContentList); GenericEntry* pEntry = GetSelectedItem(fpContentList);
if (pEntry == nil) { if (pEntry == NULL) {
ASSERT(false); ASSERT(false);
return; return;
} }
@ -1690,7 +1690,7 @@ MainWindow::OnActionsEditComment(void)
void void
MainWindow::OnUpdateActionsEditComment(CCmdUI* pCmdUI) MainWindow::OnUpdateActionsEditComment(CCmdUI* pCmdUI)
{ {
pCmdUI->Enable(fpContentList != nil && !fpOpenArchive->IsReadOnly() && pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly() &&
fpContentList->GetSelectedCount() == 1 && fpContentList->GetSelectedCount() == 1 &&
fpOpenArchive->GetCapability(GenericArchive::kCapCanEditComment)); fpOpenArchive->GetCapability(GenericArchive::kCapCanEditComment));
} }
@ -1714,14 +1714,14 @@ MainWindow::OnUpdateActionsEditComment(CCmdUI* pCmdUI)
void void
MainWindow::OnActionsEditProps(void) MainWindow::OnActionsEditProps(void)
{ {
ASSERT(fpContentList != nil); ASSERT(fpContentList != NULL);
ASSERT(fpOpenArchive != nil); ASSERT(fpOpenArchive != NULL);
EditPropsDialog propsDlg(this); EditPropsDialog propsDlg(this);
CString oldComment; CString oldComment;
GenericEntry* pEntry = GetSelectedItem(fpContentList); GenericEntry* pEntry = GetSelectedItem(fpContentList);
if (pEntry == nil) { if (pEntry == NULL) {
ASSERT(false); ASSERT(false);
return; return;
} }
@ -1745,7 +1745,7 @@ void
MainWindow::OnUpdateActionsEditProps(CCmdUI* pCmdUI) MainWindow::OnUpdateActionsEditProps(CCmdUI* pCmdUI)
{ {
// allow it in read-only mode, so we can view the props // allow it in read-only mode, so we can view the props
pCmdUI->Enable(fpContentList != nil && pCmdUI->Enable(fpContentList != NULL &&
fpContentList->GetSelectedCount() == 1); fpContentList->GetSelectedCount() == 1);
} }
@ -1764,8 +1764,8 @@ MainWindow::OnActionsRenameVolume(void)
{ {
RenameVolumeDialog rvDialog; RenameVolumeDialog rvDialog;
ASSERT(fpContentList != nil); ASSERT(fpContentList != NULL);
ASSERT(fpOpenArchive != nil); ASSERT(fpOpenArchive != NULL);
ASSERT(!fpOpenArchive->IsReadOnly()); ASSERT(!fpOpenArchive->IsReadOnly());
/* only know how to deal with disk images */ /* only know how to deal with disk images */
@ -1777,7 +1777,7 @@ MainWindow::OnActionsRenameVolume(void)
DiskImgLib::DiskFS* pDiskFS; DiskImgLib::DiskFS* pDiskFS;
pDiskFS = ((DiskArchive*) fpOpenArchive)->GetDiskFS(); pDiskFS = ((DiskArchive*) fpOpenArchive)->GetDiskFS();
ASSERT(pDiskFS != nil); ASSERT(pDiskFS != NULL);
rvDialog.fpArchive = (DiskArchive*) fpOpenArchive; rvDialog.fpArchive = (DiskArchive*) fpOpenArchive;
if (rvDialog.DoModal() != IDOK) if (rvDialog.DoModal() != IDOK)
@ -1808,7 +1808,7 @@ MainWindow::OnActionsRenameVolume(void)
void void
MainWindow::OnUpdateActionsRenameVolume(CCmdUI* pCmdUI) MainWindow::OnUpdateActionsRenameVolume(CCmdUI* pCmdUI)
{ {
pCmdUI->Enable(fpContentList != nil && !fpOpenArchive->IsReadOnly() && pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly() &&
fpOpenArchive->GetCapability(GenericArchive::kCapCanRenameVolume)); fpOpenArchive->GetCapability(GenericArchive::kCapCanRenameVolume));
} }
@ -1825,8 +1825,8 @@ MainWindow::OnUpdateActionsRenameVolume(CCmdUI* pCmdUI)
void void
MainWindow::OnActionsRecompress(void) MainWindow::OnActionsRecompress(void)
{ {
ASSERT(fpContentList != nil); ASSERT(fpContentList != NULL);
ASSERT(fpOpenArchive != nil); ASSERT(fpOpenArchive != NULL);
/* /*
* Ask the user about various options. * Ask the user about various options.
@ -1886,7 +1886,7 @@ MainWindow::OnActionsRecompress(void)
fpContentList->Reload(); fpContentList->Reload();
fpActionProgress->Cleanup(this); fpActionProgress->Cleanup(this);
fpActionProgress = nil; fpActionProgress = NULL;
if (result) { if (result) {
@ -1908,7 +1908,7 @@ MainWindow::OnActionsRecompress(void)
void void
MainWindow::OnUpdateActionsRecompress(CCmdUI* pCmdUI) MainWindow::OnUpdateActionsRecompress(CCmdUI* pCmdUI)
{ {
pCmdUI->Enable(fpContentList != nil && !fpOpenArchive->IsReadOnly() && pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly() &&
fpContentList->GetItemCount() > 0 && fpContentList->GetItemCount() > 0 &&
fpOpenArchive->GetCapability(GenericArchive::kCapCanRecompress)); fpOpenArchive->GetCapability(GenericArchive::kCapCanRecompress));
} }
@ -1922,7 +1922,7 @@ MainWindow::CalcTotalSize(LONGLONG* pUncomp, LONGLONG* pComp) const
GenericEntry* pEntry = fpOpenArchive->GetEntries(); GenericEntry* pEntry = fpOpenArchive->GetEntries();
LONGLONG uncomp = 0, comp = 0; LONGLONG uncomp = 0, comp = 0;
while (pEntry != nil) { while (pEntry != NULL) {
uncomp += pEntry->GetUncompressedLen(); uncomp += pEntry->GetUncompressedLen();
comp += pEntry->GetCompressedLen(); comp += pEntry->GetCompressedLen();
pEntry = pEntry->GetNext(); pEntry = pEntry->GetNext();
@ -1945,8 +1945,8 @@ MainWindow::CalcTotalSize(LONGLONG* pUncomp, LONGLONG* pComp) const
void void
MainWindow::OnActionsConvDisk(void) MainWindow::OnActionsConvDisk(void)
{ {
ASSERT(fpContentList != nil); ASSERT(fpContentList != NULL);
ASSERT(fpOpenArchive != nil); ASSERT(fpOpenArchive != NULL);
/* /*
* Ask the user about various options. * Ask the user about various options.
@ -2065,7 +2065,7 @@ MainWindow::OnActionsConvDisk(void)
fpActionProgress, &xferOpts); fpActionProgress, &xferOpts);
fpActionProgress->Cleanup(this); fpActionProgress->Cleanup(this);
fpActionProgress = nil; fpActionProgress = NULL;
if (result == GenericArchive::kXferOK) if (result == GenericArchive::kXferOK)
SuccessBeep(); SuccessBeep();
@ -2077,7 +2077,7 @@ void
MainWindow::OnUpdateActionsConvDisk(CCmdUI* pCmdUI) MainWindow::OnUpdateActionsConvDisk(CCmdUI* pCmdUI)
{ {
/* right now, only NufxArchive has the Xfer stuff implemented */ /* right now, only NufxArchive has the Xfer stuff implemented */
pCmdUI->Enable(fpContentList != nil && pCmdUI->Enable(fpContentList != NULL &&
fpContentList->GetItemCount() > 0 && fpContentList->GetItemCount() > 0 &&
fpOpenArchive->GetArchiveKind() == GenericArchive::kArchiveNuFX); fpOpenArchive->GetArchiveKind() == GenericArchive::kArchiveNuFX);
} }
@ -2095,8 +2095,8 @@ MainWindow::OnUpdateActionsConvDisk(CCmdUI* pCmdUI)
void void
MainWindow::OnActionsConvFile(void) MainWindow::OnActionsConvFile(void)
{ {
ASSERT(fpContentList != nil); ASSERT(fpContentList != NULL);
ASSERT(fpOpenArchive != nil); ASSERT(fpOpenArchive != NULL);
/* /*
* Ask the user about various options. * Ask the user about various options.
@ -2192,7 +2192,7 @@ MainWindow::OnActionsConvFile(void)
} }
xferOpts.fTarget = new NufxArchive; xferOpts.fTarget = new NufxArchive;
errStr = xferOpts.fTarget->New(filename, nil); errStr = xferOpts.fTarget->New(filename, NULL);
if (!errStr.IsEmpty()) { if (!errStr.IsEmpty()) {
ShowFailureMsg(this, errStr, IDS_FAILED); ShowFailureMsg(this, errStr, IDS_FAILED);
delete xferOpts.fTarget; delete xferOpts.fTarget;
@ -2211,7 +2211,7 @@ MainWindow::OnActionsConvFile(void)
fpActionProgress, &xferOpts); fpActionProgress, &xferOpts);
fpActionProgress->Cleanup(this); fpActionProgress->Cleanup(this);
fpActionProgress = nil; fpActionProgress = NULL;
if (result == GenericArchive::kXferOK) if (result == GenericArchive::kXferOK)
SuccessBeep(); SuccessBeep();
@ -2221,7 +2221,7 @@ MainWindow::OnActionsConvFile(void)
void void
MainWindow::OnUpdateActionsConvFile(CCmdUI* pCmdUI) MainWindow::OnUpdateActionsConvFile(CCmdUI* pCmdUI)
{ {
pCmdUI->Enable(fpContentList != nil && pCmdUI->Enable(fpContentList != NULL &&
fpContentList->GetItemCount() > 0 && fpContentList->GetItemCount() > 0 &&
fpOpenArchive->GetArchiveKind() == GenericArchive::kArchiveDiskImage); fpOpenArchive->GetArchiveKind() == GenericArchive::kArchiveDiskImage);
} }
@ -2247,7 +2247,7 @@ MainWindow::OnUpdateActionsConvToWav(CCmdUI* pCmdUI)
{ {
BOOL enable = false; BOOL enable = false;
if (fpContentList != nil && fpContentList->GetSelectedCount() == 1) { if (fpContentList != NULL && fpContentList->GetSelectedCount() == 1) {
/* only BAS, INT, and BIN shorter than 64K */ /* only BAS, INT, and BIN shorter than 64K */
GenericEntry* pEntry = GetSelectedItem(fpContentList); GenericEntry* pEntry = GetSelectedItem(fpContentList);
@ -2293,7 +2293,7 @@ MainWindow::OnActionsConvFromWav(void)
dlg.DoModal(); dlg.DoModal();
if (dlg.IsDirty()) { if (dlg.IsDirty()) {
assert(fpContentList != nil); assert(fpContentList != NULL);
fpContentList->Reload(); fpContentList->Reload();
} }
@ -2303,7 +2303,7 @@ bail:
void void
MainWindow::OnUpdateActionsConvFromWav(CCmdUI* pCmdUI) MainWindow::OnUpdateActionsConvFromWav(CCmdUI* pCmdUI)
{ {
pCmdUI->Enable(fpContentList != nil && !fpOpenArchive->IsReadOnly()); pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly());
} }
@ -2322,13 +2322,13 @@ MainWindow::SaveToArchive(GenericArchive::FileDetails* pDetails,
{ {
MainWindow* pMain = GET_MAIN_WINDOW(); MainWindow* pMain = GET_MAIN_WINDOW();
GenericArchive* pArchive = pMain->GetOpenArchive(); GenericArchive* pArchive = pMain->GetOpenArchive();
DiskImgLib::A2File* pTargetSubdir = nil; DiskImgLib::A2File* pTargetSubdir = NULL;
XferFileOptions xferOpts; XferFileOptions xferOpts;
CString storagePrefix; CString storagePrefix;
unsigned char* dataBuf = nil; unsigned char* dataBuf = NULL;
unsigned char* rsrcBuf = nil; unsigned char* rsrcBuf = NULL;
ASSERT(pArchive != nil); ASSERT(pArchive != NULL);
ASSERT(errMsg.IsEmpty()); ASSERT(errMsg.IsEmpty());
/* /*
@ -2339,7 +2339,7 @@ MainWindow::SaveToArchive(GenericArchive::FileDetails* pDetails,
dataBuf = new unsigned char[1]; dataBuf = new unsigned char[1];
else else
dataBuf = new unsigned char[dataLen]; dataBuf = new unsigned char[dataLen];
if (dataBuf == nil) { if (dataBuf == NULL) {
errMsg.Format(L"Unable to allocate %ld bytes", dataLen); errMsg.Format(L"Unable to allocate %ld bytes", dataLen);
goto bail; goto bail;
} }
@ -2366,7 +2366,7 @@ MainWindow::SaveToArchive(GenericArchive::FileDetails* pDetails,
//details.storageName.Replace(':', '_'); //details.storageName.Replace(':', '_');
pDetails->fileSysInfo = ':'; pDetails->fileSysInfo = ':';
} }
if (pTargetSubdir != nil) { if (pTargetSubdir != NULL) {
storagePrefix = pTargetSubdir->GetPathName(); storagePrefix = pTargetSubdir->GetPathName();
WMSG1("--- using storagePrefix '%ls'\n", storagePrefix); WMSG1("--- using storagePrefix '%ls'\n", storagePrefix);
} }
@ -2441,7 +2441,7 @@ MainWindow::OnActionsImportBAS(void)
dlg.DoModal(); dlg.DoModal();
if (dlg.IsDirty()) { if (dlg.IsDirty()) {
assert(fpContentList != nil); assert(fpContentList != NULL);
fpContentList->Reload(); fpContentList->Reload();
} }
@ -2451,7 +2451,7 @@ bail:
void void
MainWindow::OnUpdateActionsImportBAS(CCmdUI* pCmdUI) MainWindow::OnUpdateActionsImportBAS(CCmdUI* pCmdUI)
{ {
pCmdUI->Enable(fpContentList != nil && !fpOpenArchive->IsReadOnly()); pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly());
} }
@ -2475,7 +2475,7 @@ MainWindow::GetFileParts(const GenericEntry* pEntry,
ReformatHolder* pHolder = new ReformatHolder; ReformatHolder* pHolder = new ReformatHolder;
CString errMsg; CString errMsg;
if (pHolder == nil) if (pHolder == NULL)
return -1; return -1;
if (pEntry->GetHasDataFork()) if (pEntry->GetHasDataFork())
@ -2501,7 +2501,7 @@ MainWindow::GetFilePart(const GenericEntry* pEntry, int whichThread,
{ {
CString errMsg; CString errMsg;
ReformatHolder::ReformatPart part; ReformatHolder::ReformatPart part;
char* buf = nil; char* buf = NULL;
long len = 0; long len = 0;
di_off_t threadLen; di_off_t threadLen;
int result; int result;
@ -2542,19 +2542,19 @@ MainWindow::GetFilePart(const GenericEntry* pEntry, int whichThread,
if (result == IDOK) { if (result == IDOK) {
/* on success, ETTB guarantees a buffer, even for zero-len file */ /* on success, ETTB guarantees a buffer, even for zero-len file */
ASSERT(buf != nil); ASSERT(buf != NULL);
pHolder->SetSourceBuf(part, (unsigned char*) buf, len); pHolder->SetSourceBuf(part, (unsigned char*) buf, len);
} else if (result == IDCANCEL) { } else if (result == IDCANCEL) {
/* not expected */ /* not expected */
errMsg = L"Cancelled!"; errMsg = L"Cancelled!";
pHolder->SetErrorMsg(part, errMsg); pHolder->SetErrorMsg(part, errMsg);
ASSERT(buf == nil); ASSERT(buf == NULL);
} else { } else {
/* transfer error message to ReformatHolder buffer */ /* transfer error message to ReformatHolder buffer */
WMSG1("Got error message from ExtractThread: '%ls'\n", WMSG1("Got error message from ExtractThread: '%ls'\n",
(LPCWSTR) errMsg); (LPCWSTR) errMsg);
pHolder->SetErrorMsg(part, errMsg); pHolder->SetErrorMsg(part, errMsg);
ASSERT(buf == nil); ASSERT(buf == NULL);
} }
bail: bail:

View File

@ -25,11 +25,11 @@ AddClashDialog::OnInitDialog(void)
CWnd* pWnd; CWnd* pWnd;
pWnd = GetDlgItem(IDC_CLASH_WINNAME); pWnd = GetDlgItem(IDC_CLASH_WINNAME);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->SetWindowText(fWindowsName); pWnd->SetWindowText(fWindowsName);
pWnd = GetDlgItem(IDC_CLASH_STORAGENAME); pWnd = GetDlgItem(IDC_CLASH_STORAGENAME);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->SetWindowText(fStorageName); pWnd->SetWindowText(fStorageName);
return CDialog::OnInitDialog(); return CDialog::OnInitDialog();

View File

@ -14,7 +14,7 @@
*/ */
class AddClashDialog : public CDialog { class AddClashDialog : public CDialog {
public: public:
AddClashDialog(CWnd* pParentWnd = nil) : AddClashDialog(CWnd* pParentWnd = NULL) :
CDialog(IDD_ADD_CLASH, pParentWnd) CDialog(IDD_ADD_CLASH, pParentWnd)
{ {
fDoRename = false; fDoRename = false;

View File

@ -61,7 +61,7 @@ AddFilesDialog::MyDataExchange(bool saveAndValidate)
(GetDlgButtonCheck(this, IDC_ADDFILES_OVERWRITE) == BST_CHECKED); (GetDlgButtonCheck(this, IDC_ADDFILES_OVERWRITE) == BST_CHECKED);
pWnd = GetDlgItem(IDC_ADDFILES_PREFIX); pWnd = GetDlgItem(IDC_ADDFILES_PREFIX);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->GetWindowText(fStoragePrefix); pWnd->GetWindowText(fStoragePrefix);
if (!ValidateStoragePrefix()) if (!ValidateStoragePrefix())
@ -93,7 +93,7 @@ AddFilesDialog::MyDataExchange(bool saveAndValidate)
fOverwriteExisting != FALSE); fOverwriteExisting != FALSE);
pWnd = GetDlgItem(IDC_ADDFILES_PREFIX); pWnd = GetDlgItem(IDC_ADDFILES_PREFIX);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->SetWindowText(fStoragePrefix); pWnd->SetWindowText(fStoragePrefix);
if (!fStoragePrefixEnable) if (!fStoragePrefixEnable)
pWnd->EnableWindow(FALSE); pWnd->EnableWindow(FALSE);

View File

@ -38,9 +38,9 @@ public:
fAcceptButtonID = IDC_SELECT_ACCEPT; fAcceptButtonID = IDC_SELECT_ACCEPT;
fpTargetDiskFS = nil; fpTargetDiskFS = NULL;
//fpTargetSubdir = nil; //fpTargetSubdir = NULL;
fpDiskImg = nil; fpDiskImg = NULL;
} }
virtual ~AddFilesDialog(void) {} virtual ~AddFilesDialog(void) {}

View File

@ -52,12 +52,12 @@ NufxArchiveInfoDialog::OnInitDialog(void)
NuError nerr; NuError nerr;
time_t when; time_t when;
ASSERT(fpArchive != nil); ASSERT(fpArchive != NULL);
pNuArchive = fpArchive->GetNuArchivePointer(); pNuArchive = fpArchive->GetNuArchivePointer();
ASSERT(pNuArchive != nil); ASSERT(pNuArchive != NULL);
(void) NuGetMasterHeader(pNuArchive, &pMasterHeader); (void) NuGetMasterHeader(pNuArchive, &pMasterHeader);
ASSERT(pMasterHeader != nil); ASSERT(pMasterHeader != NULL);
pWnd = GetDlgItem(IDC_AI_FILENAME); pWnd = GetDlgItem(IDC_AI_FILENAME);
CString pathName(fpArchive->GetPathName()); CString pathName(fpArchive->GetPathName());
@ -133,12 +133,12 @@ DiskArchiveInfoDialog::OnInitDialog(void)
const DiskImg* pDiskImg; const DiskImg* pDiskImg;
const DiskFS* pDiskFS; const DiskFS* pDiskFS;
ASSERT(fpArchive != nil); ASSERT(fpArchive != NULL);
pDiskImg = fpArchive->GetDiskImg(); pDiskImg = fpArchive->GetDiskImg();
ASSERT(pDiskImg != nil); ASSERT(pDiskImg != NULL);
pDiskFS = fpArchive->GetDiskFS(); pDiskFS = fpArchive->GetDiskFS();
ASSERT(pDiskFS != nil); ASSERT(pDiskFS != NULL);
/* /*
* Volume characteristics. * Volume characteristics.
@ -162,7 +162,7 @@ DiskArchiveInfoDialog::OnInitDialog(void)
{ {
CString tmpStr; CString tmpStr;
const DiskImg::NibbleDescr* pNibbleDescr = pDiskImg->GetNibbleDescr(); const DiskImg::NibbleDescr* pNibbleDescr = pDiskImg->GetNibbleDescr();
if (pNibbleDescr != nil) if (pNibbleDescr != NULL)
tmpStr.Format(L"%hs, layout is \"%hs\"", tmpStr.Format(L"%hs, layout is \"%hs\"",
DiskImg::ToString(physicalFormat), pNibbleDescr->description); DiskImg::ToString(physicalFormat), pNibbleDescr->description);
else else
@ -215,10 +215,10 @@ DiskArchiveInfoDialog::AddSubVolumes(const DiskFS* pDiskFS, const WCHAR* prefix,
* Add everything beneath the current level. * Add everything beneath the current level.
*/ */
DiskFS::SubVolume* pSubVol; DiskFS::SubVolume* pSubVol;
pSubVol = pDiskFS->GetNextSubVolume(nil); pSubVol = pDiskFS->GetNextSubVolume(NULL);
tmpStr = prefix; tmpStr = prefix;
tmpStr += L" "; tmpStr += L" ";
while (pSubVol != nil) { while (pSubVol != NULL) {
AddSubVolumes(pSubVol->GetDiskFS(), tmpStr, pIdx); AddSubVolumes(pSubVol->GetDiskFS(), tmpStr, pIdx);
pSubVol = pDiskFS->GetNextSubVolume(pSubVol); pSubVol = pDiskFS->GetNextSubVolume(pSubVol);
@ -232,12 +232,12 @@ void
DiskArchiveInfoDialog::OnSubVolSelChange(void) DiskArchiveInfoDialog::OnSubVolSelChange(void)
{ {
CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_AIDISK_SUBVOLSEL); CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_AIDISK_SUBVOLSEL);
ASSERT(pCombo != nil); ASSERT(pCombo != NULL);
//WMSG1("+++ SELECTION IS NOW %d\n", pCombo->GetCurSel()); //WMSG1("+++ SELECTION IS NOW %d\n", pCombo->GetCurSel());
const DiskFS* pDiskFS; const DiskFS* pDiskFS;
pDiskFS = (DiskFS*) pCombo->GetItemData(pCombo->GetCurSel()); pDiskFS = (DiskFS*) pCombo->GetItemData(pCombo->GetCurSel());
ASSERT(pDiskFS != nil); ASSERT(pDiskFS != NULL);
FillInVolumeInfo(pDiskFS); FillInVolumeInfo(pDiskFS);
} }
@ -402,7 +402,7 @@ BnyArchiveInfoDialog::OnInitDialog(void)
CWnd* pWnd; CWnd* pWnd;
CString tmpStr; CString tmpStr;
ASSERT(fpArchive != nil); ASSERT(fpArchive != NULL);
pWnd = GetDlgItem(IDC_AI_FILENAME); pWnd = GetDlgItem(IDC_AI_FILENAME);
pWnd->SetWindowText(fpArchive->GetPathName()); pWnd->SetWindowText(fpArchive->GetPathName());
@ -429,7 +429,7 @@ AcuArchiveInfoDialog::OnInitDialog(void)
CWnd* pWnd; CWnd* pWnd;
CString tmpStr; CString tmpStr;
ASSERT(fpArchive != nil); ASSERT(fpArchive != NULL);
pWnd = GetDlgItem(IDC_AI_FILENAME); pWnd = GetDlgItem(IDC_AI_FILENAME);
pWnd->SetWindowText(fpArchive->GetPathName()); pWnd->SetWindowText(fpArchive->GetPathName());

View File

@ -24,11 +24,11 @@
/* /*
* Extract data from an entry. * Extract data from an entry.
* *
* If "*ppText" is non-nil, the data will be read into the pointed-to buffer * If "*ppText" is non-NULL, the data will be read into the pointed-to buffer
* so long as it's shorter than *pLength bytes. The value in "*pLength" * so long as it's shorter than *pLength bytes. The value in "*pLength"
* will be set to the actual length used. * will be set to the actual length used.
* *
* If "*ppText" is nil, the uncompressed data will be placed into a buffer * If "*ppText" is NULL, the uncompressed data will be placed into a buffer
* allocated with "new[]". * allocated with "new[]".
* *
* Returns IDOK on success, IDCANCEL if the operation was cancelled by the * Returns IDOK on success, IDCANCEL if the operation was cancelled by the
@ -43,15 +43,15 @@ BnyEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength,
{ {
NuError nerr; NuError nerr;
ExpandBuffer expBuf; ExpandBuffer expBuf;
char* dataBuf = nil; char* dataBuf = NULL;
long len; long len;
bool needAlloc = true; bool needAlloc = true;
int result = -1; int result = -1;
ASSERT(fpArchive != nil); ASSERT(fpArchive != NULL);
ASSERT(fpArchive->fFp != nil); ASSERT(fpArchive->fFp != NULL);
if (*ppText != nil) if (*ppText != NULL)
needAlloc = false; needAlloc = false;
if (which != kDataThread) { if (which != kDataThread) {
@ -87,14 +87,14 @@ BnyEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength,
goto bail; goto bail;
} }
char* unsqBuf = nil; char* unsqBuf = NULL;
long unsqLen = 0; long unsqLen = 0;
expBuf.SeizeBuffer(&unsqBuf, &unsqLen); expBuf.SeizeBuffer(&unsqBuf, &unsqLen);
WMSG2("Unsqueezed %ld bytes to %d\n", len, unsqLen); WMSG2("Unsqueezed %ld bytes to %d\n", len, unsqLen);
if (unsqLen == 0) { if (unsqLen == 0) {
// some bonehead squeezed a zero-length file // some bonehead squeezed a zero-length file
delete[] unsqBuf; delete[] unsqBuf;
ASSERT(*ppText == nil); ASSERT(*ppText == NULL);
WMSG0("Handling zero-length squeezed file!\n"); WMSG0("Handling zero-length squeezed file!\n");
if (needAlloc) { if (needAlloc) {
*ppText = new char[1]; *ppText = new char[1];
@ -123,7 +123,7 @@ BnyEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength,
} else { } else {
if (needAlloc) { if (needAlloc) {
dataBuf = new char[len]; dataBuf = new char[len];
if (dataBuf == nil) { if (dataBuf == NULL) {
pErrMsg->Format(L"allocation of %ld bytes failed", len); pErrMsg->Format(L"allocation of %ld bytes failed", len);
goto bail; goto bail;
} }
@ -155,7 +155,7 @@ bail:
ASSERT(result == IDCANCEL || !pErrMsg->IsEmpty()); ASSERT(result == IDCANCEL || !pErrMsg->IsEmpty());
if (needAlloc) { if (needAlloc) {
delete[] dataBuf; delete[] dataBuf;
ASSERT(*ppText == nil); ASSERT(*ppText == NULL);
} }
} }
return result; return result;
@ -226,7 +226,7 @@ BnyEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv,
// some bonehead squeezed a zero-length file // some bonehead squeezed a zero-length file
if (uncLen == 0) { if (uncLen == 0) {
ASSERT(buf == nil); ASSERT(buf == NULL);
WMSG0("Handling zero-length squeezed file!\n"); WMSG0("Handling zero-length squeezed file!\n");
result = IDOK; result = IDOK;
goto bail; goto bail;
@ -317,7 +317,7 @@ bail:
* Test this entry by extracting it. * Test this entry by extracting it.
* *
* If the file isn't compressed, just make sure the file is big enough. If * If the file isn't compressed, just make sure the file is big enough. If
* it's squeezed, invoke the un-squeeze function with a "nil" buffer pointer. * it's squeezed, invoke the un-squeeze function with a "NULL" buffer pointer.
*/ */
NuError NuError
BnyEntry::TestEntry(CWnd* pMsgWnd) BnyEntry::TestEntry(CWnd* pMsgWnd)
@ -342,7 +342,7 @@ BnyEntry::TestEntry(CWnd* pMsgWnd)
if (GetSqueezed()) { if (GetSqueezed()) {
nerr = UnSqueeze(fpArchive->fFp, (unsigned long) GetUncompressedLen(), nerr = UnSqueeze(fpArchive->fFp, (unsigned long) GetUncompressedLen(),
nil, true, kBNYBlockSize); NULL, true, kBNYBlockSize);
if (nerr != kNuErrNone) { if (nerr != kNuErrNone) {
errMsg.Format(L"Unsqueeze failed: %hs.", NuStrError(nerr)); errMsg.Format(L"Unsqueeze failed: %hs.", NuStrError(nerr));
ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED); ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED);
@ -399,7 +399,7 @@ BnyArchive::Open(const WCHAR* filename, bool readOnly, CString* pErrMsg)
errno = 0; errno = 0;
fFp = _wfopen(filename, L"rb"); fFp = _wfopen(filename, L"rb");
if (fFp == nil) { if (fFp == NULL) {
errMsg.Format(L"Unable to open %ls: %hs.", filename, strerror(errno)); errMsg.Format(L"Unable to open %ls: %hs.", filename, strerror(errno));
goto bail; goto bail;
} }
@ -485,7 +485,7 @@ BnyArchive::LoadContents(void)
{ {
NuError nerr; NuError nerr;
ASSERT(fFp != nil); ASSERT(fFp != NULL);
rewind(fFp); rewind(fFp);
nerr = BNYIterate(); nerr = BNYIterate();
@ -631,9 +631,9 @@ BnyArchive::BNYRead(void* buf, size_t nbyte)
{ {
size_t result; size_t result;
ASSERT(buf != nil); ASSERT(buf != NULL);
ASSERT(nbyte > 0); ASSERT(nbyte > 0);
ASSERT(fFp != nil); ASSERT(fFp != NULL);
errno = 0; errno = 0;
result = fread(buf, 1, nbyte, fFp); result = fread(buf, 1, nbyte, fFp);
@ -650,7 +650,7 @@ BnyArchive::BNYRead(void* buf, size_t nbyte)
NuError NuError
BnyArchive::BNYSeek(long offset) BnyArchive::BNYSeek(long offset)
{ {
ASSERT(fFp != nil); ASSERT(fFp != NULL);
ASSERT(offset > 0); ASSERT(offset > 0);
/*DBUG(("--- seeking forward %ld bytes\n", offset));*/ /*DBUG(("--- seeking forward %ld bytes\n", offset));*/
@ -694,7 +694,7 @@ BnyArchive::BNYDecodeHeader(BnyFileEntry* pEntry)
uchar* raw; uchar* raw;
int len; int len;
ASSERT(pEntry != nil); ASSERT(pEntry != NULL);
raw = pEntry->blockBuf; raw = pEntry->blockBuf;
@ -788,9 +788,9 @@ BNYNormalizePath(BnyFileEntry* pEntry)
pathProposal.pRecord = &fakeRecord; pathProposal.pRecord = &fakeRecord;
pathProposal.pThread = &fakeThread; pathProposal.pThread = &fakeThread;
pathProposal.newPathname = nil; pathProposal.newPathname = NULL;
pathProposal.newFilenameSeparator = '\0'; pathProposal.newFilenameSeparator = '\0';
pathProposal.newDataSink = nil; pathProposal.newDataSink = NULL;
/* need the filetype and auxtype for -e/-ee */ /* need the filetype and auxtype for -e/-ee */
fakeRecord.recFileType = pEntry->fileType; fakeRecord.recFileType = pEntry->fileType;
@ -827,7 +827,7 @@ BnyArchive::BNYCopyBlocks(BnyFileEntry* pEntry, FILE* outfp)
if (toWrite > kBNYBlockSize) if (toWrite > kBNYBlockSize)
toWrite = kBNYBlockSize; toWrite = kBNYBlockSize;
if (outfp != nil) { if (outfp != NULL) {
if (fwrite(pEntry->blockBuf, toWrite, 1, outfp) != 1) { if (fwrite(pEntry->blockBuf, toWrite, 1, outfp) != 1) {
err = errno ? (NuError) errno : kNuErrFileWrite; err = errno ? (NuError) errno : kNuErrFileWrite;
WMSG0("BNY write failed\n"); WMSG0("BNY write failed\n");
@ -955,18 +955,18 @@ BnyArchive::TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
CString errMsg; CString errMsg;
bool retVal = false; bool retVal = false;
ASSERT(fFp != nil); ASSERT(fFp != NULL);
WMSG1("Testing %d entries\n", pSelSet->GetNumEntries()); WMSG1("Testing %d entries\n", pSelSet->GetNumEntries());
SelectionEntry* pSelEntry = pSelSet->IterNext(); SelectionEntry* pSelEntry = pSelSet->IterNext();
while (pSelEntry != nil) { while (pSelEntry != NULL) {
pEntry = (BnyEntry*) pSelEntry->GetEntry(); pEntry = (BnyEntry*) pSelEntry->GetEntry();
WMSG2(" Testing '%ls' (offset=%ld)\n", pEntry->GetDisplayName(), WMSG2(" Testing '%ls' (offset=%ld)\n", pEntry->GetDisplayName(),
pEntry->GetOffset()); pEntry->GetOffset());
SET_PROGRESS_UPDATE2(0, pEntry->GetDisplayName(), nil); SET_PROGRESS_UPDATE2(0, pEntry->GetDisplayName(), NULL);
nerr = pEntry->TestEntry(pMsgWnd); nerr = pEntry->TestEntry(pMsgWnd);
if (nerr != kNuErrNone) { if (nerr != kNuErrNone) {

View File

@ -66,7 +66,7 @@ private:
*/ */
class BnyArchive : public GenericArchive { class BnyArchive : public GenericArchive {
public: public:
BnyArchive(void) : fIsReadOnly(false), fFp(nil) BnyArchive(void) : fIsReadOnly(false), fFp(NULL)
{} {}
virtual ~BnyArchive(void) { (void) Close(); } virtual ~BnyArchive(void) { (void) Close(); }
@ -128,9 +128,9 @@ public:
private: private:
virtual CString Close(void) { virtual CString Close(void) {
if (fFp != nil) { if (fFp != NULL) {
fclose(fFp); fclose(fFp);
fFp = nil; fFp = NULL;
} }
return ""; return "";
} }

View File

@ -30,7 +30,7 @@ BASTokenLookup::Init(const char* tokenList, int numTokens,
{ {
int i; int i;
ASSERT(tokenList != nil); ASSERT(tokenList != NULL);
ASSERT(numTokens > 0); ASSERT(numTokens > 0);
ASSERT(tokenLen > 0); ASSERT(tokenLen > 0);
@ -131,8 +131,8 @@ ImportBASDialog::ImportBAS(const WCHAR* fileName)
FILE* fp = NULL; FILE* fp = NULL;
ExpandBuffer msgs(1024); ExpandBuffer msgs(1024);
long fileLen, outLen, count; long fileLen, outLen, count;
char* buf = nil; char* buf = NULL;
char* outBuf = nil; char* outBuf = NULL;
bool result = false; bool result = false;
msgs.Printf("Importing from '%ls'...", fileName); msgs.Printf("Importing from '%ls'...", fileName);
@ -187,7 +187,7 @@ bail:
/* copy our error messages out */ /* copy our error messages out */
CEdit* pEdit = (CEdit*) GetDlgItem(IDC_IMPORT_BAS_RESULTS); CEdit* pEdit = (CEdit*) GetDlgItem(IDC_IMPORT_BAS_RESULTS);
char* msgBuf = nil; char* msgBuf = NULL;
long msgLen; long msgLen;
msgs.SeizeBuffer(&msgBuf, &msgLen); msgs.SeizeBuffer(&msgBuf, &msgLen);
CString msgStr(msgBuf); CString msgStr(msgBuf);
@ -599,7 +599,7 @@ ImportBASDialog::FindEOL(const char* buf, long max)
{ {
ASSERT(max >= 0); ASSERT(max >= 0);
if (max == 0) if (max == 0)
return nil; return NULL;
while (max) { while (max) {
if (*buf == '\r' || *buf == '\n') { if (*buf == '\r' || *buf == '\n') {
@ -639,7 +639,7 @@ ImportBASDialog::GetNextNWC(const char** pBuf, int* pLen, char* pCh)
(*pBuf)++; (*pBuf)++;
(*pLen)--; (*pLen)--;
if (ptr == nil) { if (ptr == NULL) {
*pCh = ch; *pCh = ch;
return true; return true;
} }
@ -678,7 +678,7 @@ void ImportBASDialog::OnOK(void)
details.fileType = kFileTypeBAS; details.fileType = kFileTypeBAS;
details.extraType = 0x0801; details.extraType = 0x0801;
details.storageType = DiskFS::kStorageSeedling; details.storageType = DiskFS::kStorageSeedling;
time_t now = time(nil); time_t now = time(NULL);
GenericArchive::UNIXTimeToDateTime(&now, &details.createWhen); GenericArchive::UNIXTimeToDateTime(&now, &details.createWhen);
GenericArchive::UNIXTimeToDateTime(&now, &details.archiveWhen); GenericArchive::UNIXTimeToDateTime(&now, &details.archiveWhen);
GenericArchive::UNIXTimeToDateTime(&now, &details.modWhen); GenericArchive::UNIXTimeToDateTime(&now, &details.modWhen);
@ -687,7 +687,7 @@ void ImportBASDialog::OnOK(void)
fDirty = true; fDirty = true;
if (!MainWindow::SaveToArchive(&details, (const unsigned char*) fOutput, if (!MainWindow::SaveToArchive(&details, (const unsigned char*) fOutput,
fOutputLen, nil, -1, /*ref*/errMsg, this)) fOutputLen, NULL, -1, /*ref*/errMsg, this))
{ {
goto bail; goto bail;
} }

View File

@ -24,7 +24,7 @@
class BASTokenLookup { class BASTokenLookup {
public: public:
BASTokenLookup(void) BASTokenLookup(void)
: fTokenPtr(nil), fTokenLen(nil) : fTokenPtr(NULL), fTokenLen(NULL)
{} {}
~BASTokenLookup(void) { ~BASTokenLookup(void) {
delete[] fTokenPtr; delete[] fTokenPtr;
@ -58,7 +58,7 @@ class ImportBASDialog : public CDialog {
public: public:
ImportBASDialog(CWnd* pParentWnd = NULL) : ImportBASDialog(CWnd* pParentWnd = NULL) :
CDialog(IDD_IMPORT_BAS, pParentWnd), fDirty(false), CDialog(IDD_IMPORT_BAS, pParentWnd), fDirty(false),
fOutput(nil), fOutputLen(-1) fOutput(NULL), fOutputLen(-1)
{} {}
virtual ~ImportBASDialog(void) { virtual ~ImportBASDialog(void) {
delete[] fOutput; delete[] fOutput;

View File

@ -129,7 +129,7 @@ long
CassImpTargetDialog::GetStartAddr(void) const CassImpTargetDialog::GetStartAddr(void) const
{ {
CWnd* pWnd = GetDlgItem(IDC_CASSIMPTARG_BINADDR); CWnd* pWnd = GetDlgItem(IDC_CASSIMPTARG_BINADDR);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
CString aux; CString aux;
pWnd->GetWindowText(aux); pWnd->GetWindowText(aux);

View File

@ -288,7 +288,7 @@ CassetteDialog::OnInitDialog(void)
/* prep the combo box */ /* prep the combo box */
CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_CASSETTE_ALG); CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_CASSETTE_ALG);
ASSERT(pCombo != nil); ASSERT(pCombo != NULL);
int defaultAlg = pPreferences->GetPrefLong(kPrCassetteAlgorithm); int defaultAlg = pPreferences->GetPrefLong(kPrCassetteAlgorithm);
if (defaultAlg > CassetteData::kAlgorithmMIN && if (defaultAlg > CassetteData::kAlgorithmMIN &&
defaultAlg < CassetteData::kAlgorithmMAX) defaultAlg < CassetteData::kAlgorithmMAX)
@ -307,7 +307,7 @@ CassetteDialog::OnInitDialog(void)
* [icon] Index | Format | Length | Checksum OK * [icon] Index | Format | Length | Checksum OK
*/ */
CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_CASSETTE_LIST); CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_CASSETTE_LIST);
ASSERT(pListView != nil); ASSERT(pListView != NULL);
ListView_SetExtendedListViewStyleEx(pListView->m_hWnd, ListView_SetExtendedListViewStyleEx(pListView->m_hWnd,
LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT); LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
@ -397,7 +397,7 @@ void
CassetteDialog::OnAlgorithmChange(void) CassetteDialog::OnAlgorithmChange(void)
{ {
CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_CASSETTE_ALG); CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_CASSETTE_ALG);
ASSERT(pCombo != nil); ASSERT(pCombo != NULL);
WMSG1("+++ SELECTION IS NOW %d\n", pCombo->GetCurSel()); WMSG1("+++ SELECTION IS NOW %d\n", pCombo->GetCurSel());
fAlgorithm = (CassetteData::Algorithm) pCombo->GetCurSel(); fAlgorithm = (CassetteData::Algorithm) pCombo->GetCurSel();
AnalyzeWAV(); AnalyzeWAV();
@ -423,12 +423,12 @@ CassetteDialog::OnImport(void)
* Figure out which item they have selected. * Figure out which item they have selected.
*/ */
CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_CASSETTE_LIST); CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_CASSETTE_LIST);
ASSERT(pListView != nil); ASSERT(pListView != NULL);
assert(pListView->GetSelectedCount() == 1); assert(pListView->GetSelectedCount() == 1);
POSITION posn; POSITION posn;
posn = pListView->GetFirstSelectedItemPosition(); posn = pListView->GetFirstSelectedItemPosition();
if (posn == nil) { if (posn == NULL) {
ASSERT(false); ASSERT(false);
return; return;
} }
@ -463,7 +463,7 @@ CassetteDialog::OnImport(void)
else else
details.extraType = 0x0000; details.extraType = 0x0000;
details.storageType = DiskFS::kStorageSeedling; details.storageType = DiskFS::kStorageSeedling;
time_t now = time(nil); time_t now = time(NULL);
GenericArchive::UNIXTimeToDateTime(&now, &details.createWhen); GenericArchive::UNIXTimeToDateTime(&now, &details.createWhen);
GenericArchive::UNIXTimeToDateTime(&now, &details.archiveWhen); GenericArchive::UNIXTimeToDateTime(&now, &details.archiveWhen);
@ -471,7 +471,7 @@ CassetteDialog::OnImport(void)
fDirty = true; fDirty = true;
if (!MainWindow::SaveToArchive(&details, fDataArray[idx].GetDataBuf(), if (!MainWindow::SaveToArchive(&details, fDataArray[idx].GetDataBuf(),
fDataArray[idx].GetDataLen(), nil, -1, /*ref*/errMsg, this)) fDataArray[idx].GetDataLen(), NULL, -1, /*ref*/errMsg, this))
{ {
goto bail; goto bail;
} }
@ -558,7 +558,7 @@ CassetteDialog::AddEntry(int idx, CListCtrl* pListCtrl, long* pFileType)
const CassetteData* pData = &fDataArray[idx]; const CassetteData* pData = &fDataArray[idx];
const unsigned char* pDataBuf = pData->GetDataBuf(); const unsigned char* pDataBuf = pData->GetDataBuf();
ASSERT(pDataBuf != nil); ASSERT(pDataBuf != NULL);
tmpStr.Format(L"%d", idx); tmpStr.Format(L"%d", idx);
pListCtrl->InsertItem(idx, tmpStr); pListCtrl->InsertItem(idx, tmpStr);
@ -621,8 +621,8 @@ CassetteDialog::CassetteData::Scan(SoundFile* pSoundFile, Algorithm alg,
ScanState scanState; ScanState scanState;
long initialLen, dataLen, chunkLen, byteOffset; long initialLen, dataLen, chunkLen, byteOffset;
long sampleStartIndex; long sampleStartIndex;
unsigned char* buf = nil; unsigned char* buf = NULL;
float* sampleBuf = nil; float* sampleBuf = NULL;
int bytesPerSample; int bytesPerSample;
bool result = false; bool result = false;
unsigned char checkSum; unsigned char checkSum;
@ -641,9 +641,9 @@ CassetteDialog::CassetteData::Scan(SoundFile* pSoundFile, Algorithm alg,
buf = new unsigned char[kSampleChunkSize]; buf = new unsigned char[kSampleChunkSize];
sampleBuf = new float[kSampleChunkSize/bytesPerSample]; sampleBuf = new float[kSampleChunkSize/bytesPerSample];
if (fOutputBuf == nil) // alloc on first use if (fOutputBuf == NULL) // alloc on first use
fOutputBuf = new unsigned char[kMaxFileLen]; fOutputBuf = new unsigned char[kMaxFileLen];
if (buf == nil || sampleBuf == nil || fOutputBuf == nil) { if (buf == NULL || sampleBuf == NULL || fOutputBuf == NULL) {
WMSG0("Buffer alloc failed\n"); WMSG0("Buffer alloc failed\n");
goto bail; goto bail;
} }

View File

@ -43,7 +43,7 @@ private:
*/ */
class CassetteData { class CassetteData {
public: public:
CassetteData(void) : fFileType(0x00), fOutputBuf(nil), fOutputLen(-1), CassetteData(void) : fFileType(0x00), fOutputBuf(NULL), fOutputLen(-1),
fStartSample(-1), fEndSample(-1), fChecksum(0x00), fStartSample(-1), fEndSample(-1), fChecksum(0x00),
fChecksumGood(false) fChecksumGood(false)
{} {}

View File

@ -28,8 +28,8 @@ ChooseAddTargetDialog::OnInitDialog(void)
CTreeCtrl* pTree = (CTreeCtrl*) GetDlgItem(IDC_ADD_TARGET_TREE); CTreeCtrl* pTree = (CTreeCtrl*) GetDlgItem(IDC_ADD_TARGET_TREE);
ASSERT(fpDiskFS != nil); ASSERT(fpDiskFS != NULL);
ASSERT(pTree != nil); ASSERT(pTree != NULL);
fDiskFSTree.fIncludeSubdirs = true; fDiskFSTree.fIncludeSubdirs = true;
fDiskFSTree.fExpandDepth = -1; fDiskFSTree.fExpandDepth = -1;
@ -44,7 +44,7 @@ ChooseAddTargetDialog::OnInitDialog(void)
WMSG0(" Skipping out of target selection\n"); WMSG0(" Skipping out of target selection\n");
// adding to root volume of the sole DiskFS // adding to root volume of the sole DiskFS
fpChosenDiskFS = fpDiskFS; fpChosenDiskFS = fpDiskFS;
ASSERT(fpChosenSubdir == nil); ASSERT(fpChosenSubdir == NULL);
OnOK(); OnOK();
} }
@ -65,12 +65,12 @@ ChooseAddTargetDialog::DoDataExchange(CDataExchange* pDX)
appName.LoadString(IDS_MB_APP_NAME); appName.LoadString(IDS_MB_APP_NAME);
/* shortcut for simple disk images */ /* shortcut for simple disk images */
if (pTree->GetCount() == 1 && fpChosenDiskFS != nil) if (pTree->GetCount() == 1 && fpChosenDiskFS != NULL)
return; return;
HTREEITEM selected; HTREEITEM selected;
selected = pTree->GetSelectedItem(); selected = pTree->GetSelectedItem();
if (selected == nil) { if (selected == NULL) {
errMsg = "Please select a disk or subdirectory to add files to."; errMsg = "Please select a disk or subdirectory to add files to.";
MessageBox(errMsg, appName, MB_OK); MessageBox(errMsg, appName, MB_OK);
pDX->Fail(); pDX->Fail();

View File

@ -22,15 +22,15 @@ public:
ChooseAddTargetDialog(CWnd* pParentWnd = NULL) : ChooseAddTargetDialog(CWnd* pParentWnd = NULL) :
CDialog(IDD_CHOOSE_ADD_TARGET, pParentWnd) CDialog(IDD_CHOOSE_ADD_TARGET, pParentWnd)
{ {
fpDiskFS = fpChosenDiskFS = nil; fpDiskFS = fpChosenDiskFS = NULL;
fpChosenSubdir = nil; fpChosenSubdir = NULL;
} }
virtual ~ChooseAddTargetDialog(void) {} virtual ~ChooseAddTargetDialog(void) {}
/* set this before calling DoModal */ /* set this before calling DoModal */
DiskImgLib::DiskFS* fpDiskFS; DiskImgLib::DiskFS* fpDiskFS;
/* results; fpChosenSubdir will be nil if root vol selected */ /* results; fpChosenSubdir will be NULL if root vol selected */
DiskImgLib::DiskFS* fpChosenDiskFS; DiskImgLib::DiskFS* fpChosenDiskFS;
DiskImgLib::A2File* fpChosenSubdir; DiskImgLib::A2File* fpChosenSubdir;

View File

@ -112,7 +112,7 @@ ChooseDirDialog::OnSelChanged(NMHDR* pnmh, LRESULT* pResult)
{ {
CString path; CString path;
CWnd* pWnd = GetDlgItem(IDC_CHOOSEDIR_PATH); CWnd* pWnd = GetDlgItem(IDC_CHOOSEDIR_PATH);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
if (fShellTree.GetFolderPath(&path)) if (fShellTree.GetFolderPath(&path))
fPathName = path; fPathName = path;
@ -122,7 +122,7 @@ ChooseDirDialog::OnSelChanged(NMHDR* pnmh, LRESULT* pResult)
// disable the "Select" button when there's no path ready // disable the "Select" button when there's no path ready
pWnd = GetDlgItem(IDOK); pWnd = GetDlgItem(IDOK);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->EnableWindow(!fPathName.IsEmpty()); pWnd->EnableWindow(!fPathName.IsEmpty());
// It's confusing to have two different paths showing, so wipe out the // It's confusing to have two different paths showing, so wipe out the
@ -144,7 +144,7 @@ ChooseDirDialog::OnExpandTree(void)
CString msg; CString msg;
pWnd = GetDlgItem(IDC_CHOOSEDIR_PATHEDIT); pWnd = GetDlgItem(IDC_CHOOSEDIR_PATHEDIT);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->GetWindowText(str); pWnd->GetWindowText(str);
if (!str.IsEmpty()) { if (!str.IsEmpty()) {

View File

@ -106,7 +106,7 @@ MainWindow::OnEditCopy(void)
bool isOpen = false; bool isOpen = false;
HGLOBAL hGlobal; HGLOBAL hGlobal;
LPVOID pGlobal; LPVOID pGlobal;
unsigned char* buf = nil; unsigned char* buf = NULL;
long bufLen = -1; long bufLen = -1;
/* associate a number with the format name */ /* associate a number with the format name */
@ -153,7 +153,7 @@ MainWindow::OnEditCopy(void)
*/ */
size_t neededLen = (fileList.GetLength() + 1) * sizeof(WCHAR); size_t neededLen = (fileList.GetLength() + 1) * sizeof(WCHAR);
hGlobal = ::GlobalAlloc(GHND | GMEM_SHARE, neededLen); hGlobal = ::GlobalAlloc(GHND | GMEM_SHARE, neededLen);
if (hGlobal == nil) { if (hGlobal == NULL) {
WMSG1("Failed allocating %d bytes\n", neededLen); WMSG1("Failed allocating %d bytes\n", neededLen);
errStr.LoadString(IDS_CLIPBOARD_ALLOCFAILED); errStr.LoadString(IDS_CLIPBOARD_ALLOCFAILED);
ShowFailureMsg(this, errStr, IDS_FAILED); ShowFailureMsg(this, errStr, IDS_FAILED);
@ -161,7 +161,7 @@ MainWindow::OnEditCopy(void)
} }
WMSG1(" Allocated %ld bytes for file list on clipboard\n", neededLen); WMSG1(" Allocated %ld bytes for file list on clipboard\n", neededLen);
pGlobal = ::GlobalLock(hGlobal); pGlobal = ::GlobalLock(hGlobal);
ASSERT(pGlobal != nil); ASSERT(pGlobal != NULL);
wcscpy((WCHAR*) pGlobal, fileList); wcscpy((WCHAR*) pGlobal, fileList);
::GlobalUnlock(hGlobal); ::GlobalUnlock(hGlobal);
@ -172,7 +172,7 @@ MainWindow::OnEditCopy(void)
* files in it. This may fail for any number of reasons. * files in it. This may fail for any number of reasons.
*/ */
hGlobal = CreateFileCollection(&selSet); hGlobal = CreateFileCollection(&selSet);
if (hGlobal != nil) { if (hGlobal != NULL) {
SetClipboardData(myFormat, hGlobal); SetClipboardData(myFormat, hGlobal);
// beep annoys me on copy // beep annoys me on copy
//SuccessBeep(); //SuccessBeep();
@ -184,7 +184,7 @@ bail:
void void
MainWindow::OnUpdateEditCopy(CCmdUI* pCmdUI) MainWindow::OnUpdateEditCopy(CCmdUI* pCmdUI)
{ {
pCmdUI->Enable(fpContentList != nil && pCmdUI->Enable(fpContentList != NULL &&
fpContentList->GetSelectedCount() > 0); fpContentList->GetSelectedCount() > 0);
} }
@ -206,9 +206,9 @@ MainWindow::CreateFileList(SelectionSet* pSelSet)
CString fileName, subVol, fileType, auxType, modDate, format, length; CString fileName, subVol, fileType, auxType, modDate, format, length;
pSelEntry = pSelSet->IterNext(); pSelEntry = pSelSet->IterNext();
while (pSelEntry != nil) { while (pSelEntry != NULL) {
pEntry = pSelEntry->GetEntry(); pEntry = pSelEntry->GetEntry();
ASSERT(pEntry != nil); ASSERT(pEntry != NULL);
fileName = DblDblQuote(pEntry->GetPathName()); fileName = DblDblQuote(pEntry->GetPathName());
subVol = pEntry->GetSubVolName(); subVol = pEntry->GetSubVolName();
@ -269,7 +269,7 @@ MainWindow::GetClipboardContentLen(void)
while ((format = EnumClipboardFormats(format)) != 0) { while ((format = EnumClipboardFormats(format)) != 0) {
hGlobal = GetClipboardData(format); hGlobal = GetClipboardData(format);
ASSERT(hGlobal != nil); ASSERT(hGlobal != NULL);
len += GlobalSize(hGlobal); len += GlobalSize(hGlobal);
} }
@ -284,8 +284,8 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet)
{ {
SelectionEntry* pSelEntry; SelectionEntry* pSelEntry;
GenericEntry* pEntry; GenericEntry* pEntry;
HGLOBAL hGlobal = nil; HGLOBAL hGlobal = NULL;
HGLOBAL hResult = nil; HGLOBAL hResult = NULL;
LPVOID pGlobal; LPVOID pGlobal;
size_t totalLength, numFiles; size_t totalLength, numFiles;
long priorLength; long priorLength;
@ -303,9 +303,9 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet)
*/ */
pSelSet->IterReset(); pSelSet->IterReset();
pSelEntry = pSelSet->IterNext(); pSelEntry = pSelSet->IterNext();
while (pSelEntry != nil) { while (pSelEntry != NULL) {
pEntry = pSelEntry->GetEntry(); pEntry = pSelEntry->GetEntry();
ASSERT(pEntry != nil); ASSERT(pEntry != NULL);
//WMSG1("+++ Examining '%s'\n", pEntry->GetDisplayName()); //WMSG1("+++ Examining '%s'\n", pEntry->GetDisplayName());
@ -322,7 +322,7 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet)
if (totalLength < 0) { if (totalLength < 0) {
DebugBreak(); DebugBreak();
WMSG0("Overflow\n"); // pretty hard to do right now! WMSG0("Overflow\n"); // pretty hard to do right now!
return nil; return NULL;
} }
pSelEntry = pSelSet->IterNext(); pSelEntry = pSelSet->IterNext();
@ -333,7 +333,7 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet)
CString msg; CString msg;
msg.Format("totalLength is %ld+%ld = %ld", msg.Format("totalLength is %ld+%ld = %ld",
totalLength, priorLength, totalLength+priorLength); totalLength, priorLength, totalLength+priorLength);
if (MessageBox(msg, nil, MB_OKCANCEL) == IDCANCEL) if (MessageBox(msg, NULL, MB_OKCANCEL) == IDCANCEL)
goto bail; goto bail;
} }
#endif #endif
@ -353,7 +353,7 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet)
* Create a big buffer to hold it all. * Create a big buffer to hold it all.
*/ */
hGlobal = ::GlobalAlloc(GHND | GMEM_SHARE, totalLength); hGlobal = ::GlobalAlloc(GHND | GMEM_SHARE, totalLength);
if (hGlobal == nil) { if (hGlobal == NULL) {
CString errMsg; CString errMsg;
errMsg.Format(L"ERROR: unable to allocate %ld bytes for copy", errMsg.Format(L"ERROR: unable to allocate %ld bytes for copy",
totalLength); totalLength);
@ -363,7 +363,7 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet)
} }
pGlobal = ::GlobalLock(hGlobal); pGlobal = ::GlobalLock(hGlobal);
ASSERT(pGlobal != nil); ASSERT(pGlobal != NULL);
ASSERT(GlobalSize(hGlobal) >= (DWORD) totalLength); ASSERT(GlobalSize(hGlobal) >= (DWORD) totalLength);
WMSG3("hGlobal=0x%08lx pGlobal=0x%08lx size=%ld\n", WMSG3("hGlobal=0x%08lx pGlobal=0x%08lx size=%ld\n",
(long) hGlobal, (long) pGlobal, GlobalSize(hGlobal)); (long) hGlobal, (long) pGlobal, GlobalSize(hGlobal));
@ -371,7 +371,7 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet)
/* /*
* Set up a progress dialog to track it. * Set up a progress dialog to track it.
*/ */
ASSERT(fpActionProgress == nil); ASSERT(fpActionProgress == NULL);
fpActionProgress = new ActionProgressDialog; fpActionProgress = new ActionProgressDialog;
fpActionProgress->Create(ActionProgressDialog::kActionExtract, this); fpActionProgress->Create(ActionProgressDialog::kActionExtract, this);
fpActionProgress->SetFileName(L"Clipboard"); fpActionProgress->SetFileName(L"Clipboard");
@ -386,11 +386,11 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet)
buf = (unsigned char*) pGlobal + sizeof(FileCollection); buf = (unsigned char*) pGlobal + sizeof(FileCollection);
pSelSet->IterReset(); pSelSet->IterReset();
pSelEntry = pSelSet->IterNext(); pSelEntry = pSelSet->IterNext();
while (pSelEntry != nil) { while (pSelEntry != NULL) {
CString errStr; CString errStr;
pEntry = pSelEntry->GetEntry(); pEntry = pSelEntry->GetEntry();
ASSERT(pEntry != nil); ASSERT(pEntry != NULL);
CString displayName(pEntry->GetDisplayName()); CString displayName(pEntry->GetDisplayName());
fpActionProgress->SetArcName(displayName); fpActionProgress->SetArcName(displayName);
@ -424,17 +424,17 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet)
::GlobalUnlock(hGlobal); ::GlobalUnlock(hGlobal);
hResult = hGlobal; hResult = hGlobal;
hGlobal = nil; hGlobal = NULL;
bail: bail:
if (hGlobal != nil) { if (hGlobal != NULL) {
ASSERT(hResult == nil); ASSERT(hResult == NULL);
::GlobalUnlock(hGlobal); ::GlobalUnlock(hGlobal);
::GlobalFree(hGlobal); ::GlobalFree(hGlobal);
} }
if (fpActionProgress != nil) { if (fpActionProgress != NULL) {
fpActionProgress->Cleanup(this); fpActionProgress->Cleanup(this);
fpActionProgress = nil; fpActionProgress = NULL;
} }
return hResult; return hResult;
} }
@ -634,7 +634,7 @@ MainWindow::OnUpdateEditPaste(CCmdUI* pCmdUI)
if (myFormat != 0 && IsClipboardFormatAvailable(myFormat)) if (myFormat != 0 && IsClipboardFormatAvailable(myFormat))
dataAvailable = true; dataAvailable = true;
pCmdUI->Enable(fpContentList != nil && !fpOpenArchive->IsReadOnly() && pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly() &&
dataAvailable); dataAvailable);
} }
@ -688,7 +688,7 @@ MainWindow::DoPaste(bool pasteJunkPaths)
UINT myFormat; UINT myFormat;
bool isOpen = false; bool isOpen = false;
if (fpContentList == nil || fpOpenArchive->IsReadOnly()) { if (fpContentList == NULL || fpOpenArchive->IsReadOnly()) {
ASSERT(false); ASSERT(false);
return; return;
} }
@ -738,12 +738,12 @@ MainWindow::DoPaste(bool pasteJunkPaths)
LPVOID pGlobal; LPVOID pGlobal;
hGlobal = GetClipboardData(myFormat); hGlobal = GetClipboardData(myFormat);
if (hGlobal == nil) { if (hGlobal == NULL) {
ASSERT(false); ASSERT(false);
goto bail; goto bail;
} }
pGlobal = GlobalLock(hGlobal); pGlobal = GlobalLock(hGlobal);
ASSERT(pGlobal != nil); ASSERT(pGlobal != NULL);
errStr = ProcessClipboard(pGlobal, GlobalSize(hGlobal), pasteJunkPaths); errStr = ProcessClipboard(pGlobal, GlobalSize(hGlobal), pasteJunkPaths);
fpContentList->Reload(); fpContentList->Reload();
@ -770,7 +770,7 @@ MainWindow::ProcessClipboard(const void* vbuf, long bufLen, bool pasteJunkPaths)
FileCollection fileColl; FileCollection fileColl;
CString errMsg, storagePrefix; CString errMsg, storagePrefix;
const unsigned char* buf = (const unsigned char*) vbuf; const unsigned char* buf = (const unsigned char*) vbuf;
DiskImgLib::A2File* pTargetSubdir = nil; DiskImgLib::A2File* pTargetSubdir = NULL;
XferFileOptions xferOpts; XferFileOptions xferOpts;
bool xferPrepped = false; bool xferPrepped = false;
@ -828,7 +828,7 @@ MainWindow::ProcessClipboard(const void* vbuf, long bufLen, bool pasteJunkPaths)
fpOpenArchive->XferPrepare(&xferOpts); fpOpenArchive->XferPrepare(&xferOpts);
xferPrepped = true; xferPrepped = true;
if (pTargetSubdir != nil) { if (pTargetSubdir != NULL) {
storagePrefix = pTargetSubdir->GetPathName(); storagePrefix = pTargetSubdir->GetPathName();
WMSG1("--- using storagePrefix '%ls'\n", (LPCWSTR) storagePrefix); WMSG1("--- using storagePrefix '%ls'\n", (LPCWSTR) storagePrefix);
} }
@ -836,7 +836,7 @@ MainWindow::ProcessClipboard(const void* vbuf, long bufLen, bool pasteJunkPaths)
/* /*
* Set up a progress dialog to track it. * Set up a progress dialog to track it.
*/ */
ASSERT(fpActionProgress == nil); ASSERT(fpActionProgress == NULL);
fpActionProgress = new ActionProgressDialog; fpActionProgress = new ActionProgressDialog;
fpActionProgress->Create(ActionProgressDialog::kActionAdd, this); fpActionProgress->Create(ActionProgressDialog::kActionAdd, this);
fpActionProgress->SetArcName(L"Clipboard data"); fpActionProgress->SetArcName(L"Clipboard data");
@ -945,9 +945,9 @@ bail:
else else
fpOpenArchive->XferAbort(this); fpOpenArchive->XferAbort(this);
} }
if (fpActionProgress != nil) { if (fpActionProgress != NULL) {
fpActionProgress->Cleanup(this); fpActionProgress->Cleanup(this);
fpActionProgress = nil; fpActionProgress = NULL;
} }
return errMsg; return errMsg;
} }
@ -966,8 +966,8 @@ MainWindow::ProcessClipboardEntry(const FileCollectionEntry* pCollEnt,
{ {
GenericArchive::FileDetails::FileKind entryKind; GenericArchive::FileDetails::FileKind entryKind;
GenericArchive::FileDetails details; GenericArchive::FileDetails details;
unsigned char* dataBuf = nil; unsigned char* dataBuf = NULL;
unsigned char* rsrcBuf = nil; unsigned char* rsrcBuf = NULL;
long dataLen, rsrcLen, cmmtLen; long dataLen, rsrcLen, cmmtLen;
CString errMsg; CString errMsg;
@ -986,7 +986,7 @@ MainWindow::ProcessClipboardEntry(const FileCollectionEntry* pCollEnt,
&details.createWhen); &details.createWhen);
GenericArchive::UNIXTimeToDateTime(&pCollEnt->modWhen, GenericArchive::UNIXTimeToDateTime(&pCollEnt->modWhen,
&details.modWhen); &details.modWhen);
time_t now = time(nil); time_t now = time(NULL);
GenericArchive::UNIXTimeToDateTime(&now, &details.archiveWhen); GenericArchive::UNIXTimeToDateTime(&now, &details.archiveWhen);
/* /*
@ -1036,14 +1036,14 @@ MainWindow::ProcessClipboardEntry(const FileCollectionEntry* pCollEnt,
} else { } else {
dataLen = pCollEnt->dataLen; dataLen = pCollEnt->dataLen;
dataBuf = new unsigned char[dataLen]; dataBuf = new unsigned char[dataLen];
if (dataBuf == nil) if (dataBuf == NULL)
return "memory allocation failed."; return "memory allocation failed.";
memcpy(dataBuf, buf, dataLen); memcpy(dataBuf, buf, dataLen);
buf += dataLen; buf += dataLen;
remLen -= dataLen; remLen -= dataLen;
} }
} else { } else {
ASSERT(dataBuf == nil); ASSERT(dataBuf == NULL);
dataLen = -1; dataLen = -1;
} }
@ -1054,14 +1054,14 @@ MainWindow::ProcessClipboardEntry(const FileCollectionEntry* pCollEnt,
} else { } else {
rsrcLen = pCollEnt->rsrcLen; rsrcLen = pCollEnt->rsrcLen;
rsrcBuf = new unsigned char[rsrcLen]; rsrcBuf = new unsigned char[rsrcLen];
if (rsrcBuf == nil) if (rsrcBuf == NULL)
return "Memory allocation failed."; return "Memory allocation failed.";
memcpy(rsrcBuf, buf, rsrcLen); memcpy(rsrcBuf, buf, rsrcLen);
buf += rsrcLen; buf += rsrcLen;
remLen -= rsrcLen; remLen -= rsrcLen;
} }
} else { } else {
ASSERT(rsrcBuf == nil); ASSERT(rsrcBuf == NULL);
rsrcLen = -1; rsrcLen = -1;
} }
@ -1076,7 +1076,7 @@ MainWindow::ProcessClipboardEntry(const FileCollectionEntry* pCollEnt,
&rsrcBuf, rsrcLen); &rsrcBuf, rsrcLen);
delete[] dataBuf; delete[] dataBuf;
delete[] rsrcBuf; delete[] rsrcBuf;
dataBuf = rsrcBuf = nil; dataBuf = rsrcBuf = NULL;
return errMsg; return errMsg;
} }

View File

@ -31,7 +31,7 @@ RenameOverwriteDialog::OnInitDialog(void)
CWnd* pWnd; CWnd* pWnd;
pWnd = GetDlgItem(IDC_RENOVWR_SOURCE_NAME); pWnd = GetDlgItem(IDC_RENOVWR_SOURCE_NAME);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->SetWindowText(fNewFileSource); pWnd->SetWindowText(fNewFileSource);
return CDialog::OnInitDialog(); return CDialog::OnInitDialog();
@ -92,27 +92,27 @@ ConfirmOverwriteDialog::OnInitDialog(void)
CString tmpStr, dateStr; CString tmpStr, dateStr;
pWnd = GetDlgItem(IDC_OVWR_EXIST_NAME); pWnd = GetDlgItem(IDC_OVWR_EXIST_NAME);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->SetWindowText(fExistingFile); pWnd->SetWindowText(fExistingFile);
pWnd = GetDlgItem(IDC_OVWR_EXIST_INFO); pWnd = GetDlgItem(IDC_OVWR_EXIST_INFO);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
FormatDate(fExistingFileModWhen, &dateStr); FormatDate(fExistingFileModWhen, &dateStr);
tmpStr.Format(L"Modified %ls", dateStr); tmpStr.Format(L"Modified %ls", dateStr);
pWnd->SetWindowText(tmpStr); pWnd->SetWindowText(tmpStr);
pWnd = GetDlgItem(IDC_OVWR_NEW_NAME); pWnd = GetDlgItem(IDC_OVWR_NEW_NAME);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->SetWindowText(fNewFileSource); pWnd->SetWindowText(fNewFileSource);
pWnd = GetDlgItem(IDC_OVWR_NEW_INFO); pWnd = GetDlgItem(IDC_OVWR_NEW_INFO);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
FormatDate(fNewFileModWhen, &dateStr); FormatDate(fNewFileModWhen, &dateStr);
tmpStr.Format(L"Modified %ls", dateStr); tmpStr.Format(L"Modified %ls", dateStr);
pWnd->SetWindowText(tmpStr); pWnd->SetWindowText(tmpStr);
pWnd = GetDlgItem(IDC_OVWR_RENAME); pWnd = GetDlgItem(IDC_OVWR_RENAME);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->EnableWindow(fAllowRename); pWnd->EnableWindow(fAllowRename);
return CDialog::OnInitDialog(); return CDialog::OnInitDialog();

View File

@ -16,7 +16,7 @@
*/ */
class ConfirmOverwriteDialog : public CDialog { class ConfirmOverwriteDialog : public CDialog {
public: public:
ConfirmOverwriteDialog(CWnd* pParentWnd = nil) : ConfirmOverwriteDialog(CWnd* pParentWnd = NULL) :
CDialog(IDD_CONFIRM_OVERWRITE, pParentWnd) CDialog(IDD_CONFIRM_OVERWRITE, pParentWnd)
{ {
fResultOverwrite = false; fResultOverwrite = false;
@ -67,7 +67,7 @@ private:
*/ */
class RenameOverwriteDialog : public CDialog { class RenameOverwriteDialog : public CDialog {
public: public:
RenameOverwriteDialog(CWnd* pParentWnd = nil) : RenameOverwriteDialog(CWnd* pParentWnd = NULL) :
CDialog(IDD_RENAME_OVERWRITE, pParentWnd) CDialog(IDD_RENAME_OVERWRITE, pParentWnd)
{} {}
~RenameOverwriteDialog(void) {} ~RenameOverwriteDialog(void) {}

View File

@ -103,7 +103,7 @@ ContentList::OnCreate(LPCREATESTRUCT lpcs)
/* add our up/down arrow bitmaps */ /* add our up/down arrow bitmaps */
LoadHeaderImages(); LoadHeaderImages();
CHeaderCtrl* pHeader = GetHeaderCtrl(); CHeaderCtrl* pHeader = GetHeaderCtrl();
if (pHeader == nil) if (pHeader == NULL)
WMSG0("GLITCH: couldn't get header ctrl\n"); WMSG0("GLITCH: couldn't get header ctrl\n");
ASSERT(pHeader != NULL); ASSERT(pHeader != NULL);
pHeader->SetImageList(&fHdrImageList); pHeader->SetImageList(&fHdrImageList);
@ -244,7 +244,7 @@ ContentList::Reload(bool saveSelection)
// fInvalid = false; // fInvalid = false;
fpArchive->ClearReloadFlag(); fpArchive->ClearReloadFlag();
long* savedSel = nil; long* savedSel = NULL;
long selCount = 0; long selCount = 0;
if (saveSelection) { if (saveSelection) {
@ -260,7 +260,7 @@ ContentList::Reload(bool saveSelection)
LoadData(); LoadData();
NewSortOrder(); NewSortOrder();
if (savedSel != nil) { if (savedSel != NULL) {
/* restore the selection */ /* restore the selection */
RestoreSelection(savedSel, selCount); RestoreSelection(savedSel, selCount);
delete[] savedSel; delete[] savedSel;
@ -280,7 +280,7 @@ ContentList::Reload(bool saveSelection)
long* long*
ContentList::GetSelectionSerials(long* pSelCount) ContentList::GetSelectionSerials(long* pSelCount)
{ {
long* savedSel = nil; long* savedSel = NULL;
long maxCount; long maxCount;
maxCount = GetSelectedCount(); maxCount = GetSelectedCount();
@ -292,10 +292,10 @@ ContentList::GetSelectionSerials(long* pSelCount)
POSITION posn; POSITION posn;
posn = GetFirstSelectedItemPosition(); posn = GetFirstSelectedItemPosition();
ASSERT(posn != nil); ASSERT(posn != NULL);
if (posn == nil) if (posn == NULL)
return nil; return NULL;
while (posn != nil) { while (posn != NULL) {
int num = GetNextSelectedItem(posn); int num = GetNextSelectedItem(posn);
GenericEntry* pEntry = (GenericEntry*) GetItemData(num); GenericEntry* pEntry = (GenericEntry*) GetItemData(num);
@ -320,7 +320,7 @@ void
ContentList::RestoreSelection(const long* savedSel, long selCount) ContentList::RestoreSelection(const long* savedSel, long selCount)
{ {
WMSG1("RestoreSelection (selCount=%d)\n", selCount); WMSG1("RestoreSelection (selCount=%d)\n", selCount);
if (savedSel == nil) if (savedSel == NULL)
return; return;
int i, j; int i, j;
@ -574,7 +574,7 @@ ContentList::OnGetDispInfo(NMHDR* pnmh, LRESULT* pResult)
} }
break; break;
case 4: // format case 4: // format
ASSERT(pEntry->GetFormatStr() != nil); ASSERT(pEntry->GetFormatStr() != NULL);
wcscpy(plvdi->item.pszText, pEntry->GetFormatStr()); wcscpy(plvdi->item.pszText, pEntry->GetFormatStr());
break; break;
case 5: // size case 5: // size
@ -739,7 +739,7 @@ ContentList::LoadData(void)
DeleteAllItems(); // for Reload case DeleteAllItems(); // for Reload case
pEntry = fpArchive->GetEntries(); pEntry = fpArchive->GetEntries();
while (pEntry != nil) { while (pEntry != NULL) {
pEntry->SetIndex(idx); pEntry->SetIndex(idx);
lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
@ -968,12 +968,12 @@ ContentList::SelectSubdirContents(void)
{ {
POSITION posn; POSITION posn;
posn = GetFirstSelectedItemPosition(); posn = GetFirstSelectedItemPosition();
if (posn == nil) { if (posn == NULL) {
WMSG0("SelectSubdirContents: nothing is selected\n"); WMSG0("SelectSubdirContents: nothing is selected\n");
return; return;
} }
/* mark all selected items with LVIS_CUT */ /* mark all selected items with LVIS_CUT */
while (posn != nil) { while (posn != NULL) {
int num = GetNextSelectedItem(/*ref*/ posn); int num = GetNextSelectedItem(/*ref*/ posn);
SetItemState(num, LVIS_CUT, LVIS_CUT); SetItemState(num, LVIS_CUT, LVIS_CUT);
} }
@ -1002,7 +1002,7 @@ ContentList::SelectSubdirContents(void)
/* clear the LVIS_CUT flags */ /* clear the LVIS_CUT flags */
posn = GetFirstSelectedItemPosition(); posn = GetFirstSelectedItemPosition();
while (posn != nil) { while (posn != NULL) {
int num = GetNextSelectedItem(/*ref*/ posn); int num = GetNextSelectedItem(/*ref*/ posn);
SetItemState(num, 0, LVIS_CUT); SetItemState(num, 0, LVIS_CUT);
} }
@ -1109,7 +1109,7 @@ ContentList::CompareFindString(int num, const WCHAR* str, bool matchCase,
{ {
GenericEntry* pEntry = (GenericEntry*) GetItemData(num); GenericEntry* pEntry = (GenericEntry*) GetItemData(num);
char fssep = pEntry->GetFssep(); char fssep = pEntry->GetFssep();
const WCHAR* (*pSubCompare)(const WCHAR* str, const WCHAR* subStr) = nil; const WCHAR* (*pSubCompare)(const WCHAR* str, const WCHAR* subStr) = NULL;
if (matchCase) if (matchCase)
pSubCompare = wcsstr; pSubCompare = wcsstr;
@ -1127,7 +1127,7 @@ ContentList::CompareFindString(int num, const WCHAR* str, bool matchCase,
match = (*pSubCompare)(start, str); match = (*pSubCompare)(start, str);
if (match == nil) if (match == NULL)
break; break;
if ((match == src || *(match-1) == fssep) && if ((match == src || *(match-1) == fssep) &&
(match[strLen] == '\0' || match[strLen] == fssep)) (match[strLen] == '\0' || match[strLen] == fssep))
@ -1138,7 +1138,7 @@ ContentList::CompareFindString(int num, const WCHAR* str, bool matchCase,
start++; start++;
} }
} else { } else {
if ((*pSubCompare)(pEntry->GetDisplayName(), str) != nil) if ((*pSubCompare)(pEntry->GetDisplayName(), str) != NULL)
return true; return true;
} }

View File

@ -35,8 +35,8 @@ class ContentList: public CListCtrl
{ {
public: public:
ContentList(GenericArchive* pArchive, ColumnLayout* pLayout) { ContentList(GenericArchive* pArchive, ColumnLayout* pLayout) {
ASSERT(pArchive != nil); ASSERT(pArchive != NULL);
ASSERT(pLayout != nil); ASSERT(pLayout != NULL);
fpArchive = pArchive; fpArchive = pArchive;
fpLayout = pLayout; fpLayout = pLayout;
// fInvalid = false; // fInvalid = false;

View File

@ -37,13 +37,13 @@ BOOL
ConvDiskOptionsDialog::OnInitDialog(void) ConvDiskOptionsDialog::OnInitDialog(void)
{ {
CEdit* pEdit = (CEdit*) GetDlgItem(IDC_CONVDISK_VOLNAME); CEdit* pEdit = (CEdit*) GetDlgItem(IDC_CONVDISK_VOLNAME);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
pEdit->SetLimitText(kProDOSVolNameMax); pEdit->SetLimitText(kProDOSVolNameMax);
ResetSizeControls(); ResetSizeControls();
pEdit = (CEdit*) GetDlgItem(IDC_CONVDISK_SPECIFY_EDIT); pEdit = (CEdit*) GetDlgItem(IDC_CONVDISK_SPECIFY_EDIT);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
pEdit->SetLimitText(5); // enough for "65535" pEdit->SetLimitText(5); // enough for "65535"
pEdit->EnableWindow(FALSE); pEdit->EnableWindow(FALSE);
@ -141,14 +141,14 @@ ConvDiskOptionsDialog::ResetSizeControls(void)
WMSG0("Resetting size controls\n"); WMSG0("Resetting size controls\n");
spaceReq.Format(IDS_CONVDISK_SPACEREQ, "(unknown)"); spaceReq.Format(IDS_CONVDISK_SPACEREQ, "(unknown)");
pWnd = GetDlgItem(IDC_CONVDISK_SPACEREQ); pWnd = GetDlgItem(IDC_CONVDISK_SPACEREQ);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->SetWindowText(spaceReq); pWnd->SetWindowText(spaceReq);
#if 0 #if 0
int i; int i;
for (i = 0; i < NELEM(gDiskSizes); i++) { for (i = 0; i < NELEM(gDiskSizes); i++) {
pWnd = GetDlgItem(gDiskSizes[i].ctrlID); pWnd = GetDlgItem(gDiskSizes[i].ctrlID);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->EnableWindow(TRUE); pWnd->EnableWindow(TRUE);
} }
#endif #endif
@ -177,7 +177,7 @@ ConvDiskOptionsDialog::LimitSizeControls(long totalBlocks, long blocksUsed)
spaceReq.Format(IDS_CONVDISK_SPACEREQ, sizeStr); spaceReq.Format(IDS_CONVDISK_SPACEREQ, sizeStr);
pWnd = GetDlgItem(IDC_CONVDISK_SPACEREQ); pWnd = GetDlgItem(IDC_CONVDISK_SPACEREQ);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->SetWindowText(spaceReq); pWnd->SetWindowText(spaceReq);
NewDiskSize::EnableButtons_ProDOS(this, totalBlocks, blocksUsed); NewDiskSize::EnableButtons_ProDOS(this, totalBlocks, blocksUsed);
@ -190,7 +190,7 @@ ConvDiskOptionsDialog::LimitSizeControls(long totalBlocks, long blocksUsed)
CButton* pButton; CButton* pButton;
pButton = (CButton*) GetDlgItem(gDiskSizes[i].ctrlID); pButton = (CButton*) GetDlgItem(gDiskSizes[i].ctrlID);
ASSERT(pButton != nil); ASSERT(pButton != NULL);
if (usedWithoutBitmap + GetNumBitmapBlocks(gDiskSizes[i].blocks) <= if (usedWithoutBitmap + GetNumBitmapBlocks(gDiskSizes[i].blocks) <=
gDiskSizes[i].blocks) gDiskSizes[i].blocks)
{ {
@ -303,7 +303,7 @@ ConvDiskOptionsDialog::OnCompute(void)
result = pMain->GetOpenArchive()->XferSelection(pActionProgress, &selSet, result = pMain->GetOpenArchive()->XferSelection(pActionProgress, &selSet,
pActionProgress, &xferOpts); pActionProgress, &xferOpts);
pActionProgress->Cleanup(this); pActionProgress->Cleanup(this);
pMain->SetActionProgressDialog(nil); pMain->SetActionProgressDialog(NULL);
if (result == GenericArchive::kXferOK) { if (result == GenericArchive::kXferOK) {
DiskFS* pDiskFS; DiskFS* pDiskFS;
@ -314,7 +314,7 @@ ConvDiskOptionsDialog::OnCompute(void)
WMSG0("SUCCESS\n"); WMSG0("SUCCESS\n");
pDiskFS = ((DiskArchive*) xferOpts.fTarget)->GetDiskFS(); pDiskFS = ((DiskArchive*) xferOpts.fTarget)->GetDiskFS();
ASSERT(pDiskFS != nil); ASSERT(pDiskFS != NULL);
dierr = pDiskFS->GetFreeSpaceCount(&totalBlocks, &freeBlocks, dierr = pDiskFS->GetFreeSpaceCount(&totalBlocks, &freeBlocks,
&unitSize); &unitSize);

View File

@ -41,23 +41,23 @@ CreateImageDialog::OnInitDialog(void)
} }
CEdit* pEdit = (CEdit*) GetDlgItem(IDC_CREATEFSPRODOS_VOLNAME); CEdit* pEdit = (CEdit*) GetDlgItem(IDC_CREATEFSPRODOS_VOLNAME);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
pEdit->SetLimitText(kProDOSVolNameMax); pEdit->SetLimitText(kProDOSVolNameMax);
pEdit = (CEdit*) GetDlgItem(IDC_CREATEFSPASCAL_VOLNAME); pEdit = (CEdit*) GetDlgItem(IDC_CREATEFSPASCAL_VOLNAME);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
pEdit->SetLimitText(kPascalVolNameMax); pEdit->SetLimitText(kPascalVolNameMax);
pEdit = (CEdit*) GetDlgItem(IDC_CREATEFSHFS_VOLNAME); pEdit = (CEdit*) GetDlgItem(IDC_CREATEFSHFS_VOLNAME);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
pEdit->SetLimitText(kHFSVolNameMax); pEdit->SetLimitText(kHFSVolNameMax);
pEdit = (CEdit*) GetDlgItem(IDC_CREATEFSDOS_VOLNUM); pEdit = (CEdit*) GetDlgItem(IDC_CREATEFSDOS_VOLNUM);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
pEdit->SetLimitText(3); // 3 digit volume number pEdit->SetLimitText(3); // 3 digit volume number
pEdit = (CEdit*) GetDlgItem(IDC_CONVDISK_SPECIFY_EDIT); pEdit = (CEdit*) GetDlgItem(IDC_CONVDISK_SPECIFY_EDIT);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
pEdit->EnableWindow(FALSE); pEdit->EnableWindow(FALSE);
return CDialog::OnInitDialog(); return CDialog::OnInitDialog();
@ -234,7 +234,7 @@ CreateImageDialog::OnFormatChangeRange(UINT nID)
for (i = 0; i < NELEM(kDetailControls); i++) { for (i = 0; i < NELEM(kDetailControls); i++) {
CWnd* pWnd = GetDlgItem(kDetailControls[i]); CWnd* pWnd = GetDlgItem(kDetailControls[i]);
if (pWnd != nil) if (pWnd != NULL)
pWnd->EnableWindow(FALSE); pWnd->EnableWindow(FALSE);
} }
@ -242,8 +242,8 @@ CreateImageDialog::OnFormatChangeRange(UINT nID)
for (i = 0; i < NELEM(kFormatTab); i++) { for (i = 0; i < NELEM(kFormatTab); i++) {
if (kFormatTab[i].buttonID == nID) { if (kFormatTab[i].buttonID == nID) {
CWnd* pWnd = GetDlgItem(kFormatTab[i].ctrlID); CWnd* pWnd = GetDlgItem(kFormatTab[i].ctrlID);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
if (pWnd != nil) if (pWnd != NULL)
pWnd->EnableWindow(TRUE); pWnd->EnableWindow(TRUE);
} }
} }

View File

@ -27,7 +27,7 @@ CreateSubdirDialog::OnInitDialog(void)
/* select the default text and set the focus */ /* select the default text and set the focus */
CEdit* pEdit = (CEdit*) GetDlgItem(IDC_CREATESUBDIR_NEW); CEdit* pEdit = (CEdit*) GetDlgItem(IDC_CREATESUBDIR_NEW);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
pEdit->SetSel(0, -1); pEdit->SetSel(0, -1);
pEdit->SetFocus(); pEdit->SetFocus();

View File

@ -20,8 +20,8 @@ public:
CreateSubdirDialog(CWnd* pParentWnd = NULL) : CreateSubdirDialog(CWnd* pParentWnd = NULL) :
CDialog(IDD_CREATE_SUBDIR, pParentWnd) CDialog(IDD_CREATE_SUBDIR, pParentWnd)
{ {
fpArchive = nil; fpArchive = NULL;
fpParentEntry = nil; fpParentEntry = NULL;
} }
virtual ~CreateSubdirDialog(void) {} virtual ~CreateSubdirDialog(void) {}

View File

@ -23,7 +23,7 @@ BOOL
DEFileDialog::OnInitDialog(void) DEFileDialog::OnInitDialog(void)
{ {
CWnd* pWnd = GetDlgItem(IDOK); CWnd* pWnd = GetDlgItem(IDOK);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->EnableWindow(FALSE); pWnd->EnableWindow(FALSE);
return CDialog::OnInitDialog(); return CDialog::OnInitDialog();
@ -47,14 +47,14 @@ void
DEFileDialog::OnChange(void) DEFileDialog::OnChange(void)
{ {
CEdit* pEdit = (CEdit*) GetDlgItem(IDC_DEFILE_FILENAME); CEdit* pEdit = (CEdit*) GetDlgItem(IDC_DEFILE_FILENAME);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
CString str; CString str;
pEdit->GetWindowText(str); pEdit->GetWindowText(str);
//WMSG2("STR is '%ls' (%d)\n", str, str.GetLength()); //WMSG2("STR is '%ls' (%d)\n", str, str.GetLength());
CWnd* pWnd = GetDlgItem(IDOK); CWnd* pWnd = GetDlgItem(IDOK);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->EnableWindow(!str.IsEmpty()); pWnd->EnableWindow(!str.IsEmpty());
} }

View File

@ -29,11 +29,11 @@ static const char* kEmptyFolderMarker = ".$$EmptyFolder";
/* /*
* Extract data from a disk image. * Extract data from a disk image.
* *
* If "*ppText" is non-nil, the data will be read into the pointed-to buffer * If "*ppText" is non-NULL, the data will be read into the pointed-to buffer
* so long as it's shorter than *pLength bytes. The value in "*pLength" * so long as it's shorter than *pLength bytes. The value in "*pLength"
* will be set to the actual length used. * will be set to the actual length used.
* *
* If "*ppText" is nil, the uncompressed data will be placed into a buffer * If "*ppText" is NULL, the uncompressed data will be placed into a buffer
* allocated with "new[]". * allocated with "new[]".
* *
* Returns IDOK on success, IDCANCEL if the operation was cancelled by the * Returns IDOK on success, IDCANCEL if the operation was cancelled by the
@ -47,17 +47,17 @@ DiskEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength,
CString* pErrMsg) const CString* pErrMsg) const
{ {
DIError dierr; DIError dierr;
A2FileDescr* pOpenFile = nil; A2FileDescr* pOpenFile = NULL;
char* dataBuf = nil; char* dataBuf = NULL;
bool rsrcFork; bool rsrcFork;
bool needAlloc = true; bool needAlloc = true;
int result = -1; int result = -1;
ASSERT(fpFile != nil); ASSERT(fpFile != NULL);
ASSERT(pErrMsg != nil); ASSERT(pErrMsg != NULL);
*pErrMsg = ""; *pErrMsg = "";
if (*ppText != nil) if (*ppText != NULL)
needAlloc = false; needAlloc = false;
if (GetDamaged()) { if (GetDamaged()) {
@ -101,11 +101,11 @@ DiskEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength,
} }
SET_PROGRESS_BEGIN(); SET_PROGRESS_BEGIN();
pOpenFile->SetProgressUpdater(DiskArchive::ProgressCallback, len, nil); pOpenFile->SetProgressUpdater(DiskArchive::ProgressCallback, len, NULL);
if (needAlloc) { if (needAlloc) {
dataBuf = new char[(int) len]; dataBuf = new char[(int) len];
if (dataBuf == nil) { if (dataBuf == NULL) {
pErrMsg->Format(L"ERROR: allocation of %ld bytes failed", len); pErrMsg->Format(L"ERROR: allocation of %ld bytes failed", len);
goto bail; goto bail;
} }
@ -135,7 +135,7 @@ DiskEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength,
result = IDOK; result = IDOK;
bail: bail:
if (pOpenFile != nil) if (pOpenFile != NULL)
pOpenFile->Close(); pOpenFile->Close();
if (result == IDOK) { if (result == IDOK) {
SET_PROGRESS_END(); SET_PROGRESS_END();
@ -144,7 +144,7 @@ bail:
ASSERT(result == IDCANCEL || !pErrMsg->IsEmpty()); ASSERT(result == IDCANCEL || !pErrMsg->IsEmpty());
if (needAlloc) { if (needAlloc) {
delete[] dataBuf; delete[] dataBuf;
ASSERT(*ppText == nil); ASSERT(*ppText == NULL);
} }
} }
return result; return result;
@ -162,12 +162,12 @@ int
DiskEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv, DiskEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv,
ConvertHighASCII convHA, CString* pErrMsg) const ConvertHighASCII convHA, CString* pErrMsg) const
{ {
A2FileDescr* pOpenFile = nil; A2FileDescr* pOpenFile = NULL;
bool rsrcFork; bool rsrcFork;
int result = -1; int result = -1;
ASSERT(IDOK != -1 && IDCANCEL != -1); ASSERT(IDOK != -1 && IDCANCEL != -1);
ASSERT(fpFile != nil); ASSERT(fpFile != NULL);
if (which == kDataThread) if (which == kDataThread)
rsrcFork = false; rsrcFork = false;
@ -214,7 +214,7 @@ DiskEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv,
result = IDOK; result = IDOK;
bail: bail:
if (pOpenFile != nil) if (pOpenFile != NULL)
pOpenFile->Close(); pOpenFile->Close();
return result; return result;
} }
@ -246,7 +246,7 @@ DiskEntry::CopyData(A2FileDescr* pOpenFile, FILE* outfp, ConvertEOL conv,
ASSERT(srcLen > 0); // empty files should've been caught earlier ASSERT(srcLen > 0); // empty files should've been caught earlier
SET_PROGRESS_BEGIN(); SET_PROGRESS_BEGIN();
pOpenFile->SetProgressUpdater(DiskArchive::ProgressCallback, srcLen, nil); pOpenFile->SetProgressUpdater(DiskArchive::ProgressCallback, srcLen, NULL);
/* /*
* Loop until all data copied. * Loop until all data copied.
@ -443,8 +443,8 @@ DiskArchive::AppCleanup(void)
/*static*/ void /*static*/ void
DiskArchive::DebugMsgHandler(const char* file, int line, const char* msg) DiskArchive::DebugMsgHandler(const char* file, int line, const char* msg)
{ {
ASSERT(file != nil); ASSERT(file != NULL);
ASSERT(msg != nil); ASSERT(msg != NULL);
LOG_BASE(DebugLog::LOG_INFO, file, line, "<diskimg> %hs", msg); LOG_BASE(DebugLog::LOG_INFO, file, line, "<diskimg> %hs", msg);
} }
@ -510,11 +510,11 @@ DiskArchive::Open(const WCHAR* filename, bool readOnly, CString* pErrMsg)
OpenResult result = kResultUnknown; OpenResult result = kResultUnknown;
const Preferences* pPreferences = GET_PREFERENCES(); const Preferences* pPreferences = GET_PREFERENCES();
ASSERT(fpPrimaryDiskFS == nil); ASSERT(fpPrimaryDiskFS == NULL);
ASSERT(filename != nil); ASSERT(filename != NULL);
//ASSERT(ext != nil); //ASSERT(ext != NULL);
ASSERT(pPreferences != nil); ASSERT(pPreferences != NULL);
fIsReadOnly = readOnly; fIsReadOnly = readOnly;
@ -603,7 +603,7 @@ DiskArchive::Open(const WCHAR* filename, bool readOnly, CString* pErrMsg)
/* create an appropriate DiskFS object */ /* create an appropriate DiskFS object */
fpPrimaryDiskFS = fDiskImg.OpenAppropriateDiskFS(); fpPrimaryDiskFS = fDiskImg.OpenAppropriateDiskFS();
if (fpPrimaryDiskFS == nil) { if (fpPrimaryDiskFS == NULL) {
/* unknown FS should've been caught above! */ /* unknown FS should've been caught above! */
ASSERT(false); ASSERT(false);
result = kResultFailure; result = kResultFailure;
@ -640,8 +640,8 @@ DiskArchive::Open(const WCHAR* filename, bool readOnly, CString* pErrMsg)
dierr = fpPrimaryDiskFS->Initialize(&fDiskImg, DiskFS::kInitFull); dierr = fpPrimaryDiskFS->Initialize(&fDiskImg, DiskFS::kInitFull);
fDiskImg.SetScanProgressCallback(nil, nil); fDiskImg.SetScanProgressCallback(NULL, NULL);
pMain->SetProgressCounterDialog(nil); pMain->SetProgressCounterDialog(NULL);
pProgress->DestroyWindow(); pProgress->DestroyWindow();
if (dierr != kDIErrNone) { if (dierr != kDIErrNone) {
@ -673,8 +673,8 @@ DiskArchive::Open(const WCHAR* filename, bool readOnly, CString* pErrMsg)
const DiskFS::SubVolume* pSubVol; const DiskFS::SubVolume* pSubVol;
fIsReadOnly = true; fIsReadOnly = true;
pSubVol = fpPrimaryDiskFS->GetNextSubVolume(nil); pSubVol = fpPrimaryDiskFS->GetNextSubVolume(NULL);
while (pSubVol != nil) { while (pSubVol != NULL) {
if (pSubVol->GetDiskFS()->GetReadWriteSupported()) { if (pSubVol->GetDiskFS()->GetReadWriteSupported()) {
fIsReadOnly = false; fIsReadOnly = false;
break; break;
@ -708,7 +708,7 @@ bail:
if (!errMsg.IsEmpty()) { if (!errMsg.IsEmpty()) {
assert(result == kResultFailure); assert(result == kResultFailure);
delete fpPrimaryDiskFS; delete fpPrimaryDiskFS;
fpPrimaryDiskFS = nil; fpPrimaryDiskFS = NULL;
} else { } else {
assert(result != kResultFailure); assert(result != kResultFailure);
} }
@ -735,8 +735,8 @@ DiskArchive::New(const WCHAR* fileName, const void* vOptions)
DIError dierr; DIError dierr;
bool allowLowerCase; bool allowLowerCase;
ASSERT(fileName != nil); ASSERT(fileName != NULL);
ASSERT(pOptions != nil); ASSERT(pOptions != NULL);
allowLowerCase = pPreferences->GetPrefBool(kPrProDOSAllowLower) != 0; allowLowerCase = pPreferences->GetPrefBool(kPrProDOSAllowLower) != 0;
@ -817,22 +817,22 @@ DiskArchive::New(const WCHAR* fileName, const void* vOptions)
*/ */
fileNameA = fileName; fileNameA = fileName;
if (numBlocks > 0) { if (numBlocks > 0) {
dierr = fDiskImg.CreateImage(fileNameA, nil, dierr = fDiskImg.CreateImage(fileNameA, NULL,
DiskImg::kOuterFormatNone, DiskImg::kOuterFormatNone,
DiskImg::kFileFormatUnadorned, DiskImg::kFileFormatUnadorned,
DiskImg::kPhysicalFormatSectors, DiskImg::kPhysicalFormatSectors,
nil, NULL,
pOptions->base.sectorOrder, pOptions->base.sectorOrder,
DiskImg::kFormatGenericProDOSOrd, // arg must be generic DiskImg::kFormatGenericProDOSOrd, // arg must be generic
numBlocks, numBlocks,
canSkipFormat); canSkipFormat);
} else { } else {
ASSERT(numTracks > 0); ASSERT(numTracks > 0);
dierr = fDiskImg.CreateImage(fileNameA, nil, dierr = fDiskImg.CreateImage(fileNameA, NULL,
DiskImg::kOuterFormatNone, DiskImg::kOuterFormatNone,
DiskImg::kFileFormatUnadorned, DiskImg::kFileFormatUnadorned,
DiskImg::kPhysicalFormatSectors, DiskImg::kPhysicalFormatSectors,
nil, NULL,
pOptions->base.sectorOrder, pOptions->base.sectorOrder,
DiskImg::kFormatGenericProDOSOrd, // arg must be generic DiskImg::kFormatGenericProDOSOrd, // arg must be generic
numTracks, numSectors, numTracks, numSectors,
@ -872,7 +872,7 @@ DiskArchive::New(const WCHAR* fileName, const void* vOptions)
goto bail; goto bail;
} }
fpPrimaryDiskFS = fDiskImg.OpenAppropriateDiskFS(false); fpPrimaryDiskFS = fDiskImg.OpenAppropriateDiskFS(false);
if (fpPrimaryDiskFS == nil) { if (fpPrimaryDiskFS == NULL) {
retmsg = L"Unable to create DiskFS."; retmsg = L"Unable to create DiskFS.";
goto bail; goto bail;
} }
@ -907,10 +907,10 @@ bail:
CString CString
DiskArchive::Close(void) DiskArchive::Close(void)
{ {
if (fpPrimaryDiskFS != nil) { if (fpPrimaryDiskFS != NULL) {
WMSG0("DiskArchive shutdown closing disk image\n"); WMSG0("DiskArchive shutdown closing disk image\n");
delete fpPrimaryDiskFS; delete fpPrimaryDiskFS;
fpPrimaryDiskFS = nil; fpPrimaryDiskFS = NULL;
} }
DIError dierr; DIError dierr;
@ -945,7 +945,7 @@ DiskArchive::Flush(void)
DIError dierr; DIError dierr;
CWaitCursor waitc; CWaitCursor waitc;
assert(fpPrimaryDiskFS != nil); assert(fpPrimaryDiskFS != NULL);
dierr = fpPrimaryDiskFS->Flush(DiskImg::kFlushAll); dierr = fpPrimaryDiskFS->Flush(DiskImg::kFlushAll);
if (dierr != kDIErrNone) { if (dierr != kDIErrNone) {
@ -965,7 +965,7 @@ DiskArchive::Flush(void)
bool bool
DiskArchive::IsModified(void) const DiskArchive::IsModified(void) const
{ {
assert(fpPrimaryDiskFS != nil); assert(fpPrimaryDiskFS != NULL);
return fpPrimaryDiskFS->GetDiskImg()->GetDirtyFlag(); return fpPrimaryDiskFS->GetDiskImg()->GetDirtyFlag();
} }
@ -977,10 +977,10 @@ DiskArchive::IsModified(void) const
void void
DiskArchive::GetDescription(CString* pStr) const DiskArchive::GetDescription(CString* pStr) const
{ {
if (fpPrimaryDiskFS == nil) if (fpPrimaryDiskFS == NULL)
return; return;
if (fpPrimaryDiskFS->GetVolumeID() != nil) { if (fpPrimaryDiskFS->GetVolumeID() != NULL) {
pStr->Format(L"Disk Image - %hs", fpPrimaryDiskFS->GetVolumeID()); pStr->Format(L"Disk Image - %hs", fpPrimaryDiskFS->GetVolumeID());
} }
} }
@ -997,7 +997,7 @@ DiskArchive::LoadContents(void)
int result; int result;
WMSG0("DiskArchive LoadContents\n"); WMSG0("DiskArchive LoadContents\n");
ASSERT(fpPrimaryDiskFS != nil); ASSERT(fpPrimaryDiskFS != NULL);
{ {
MainWindow* pMain = GET_MAIN_WINDOW(); MainWindow* pMain = GET_MAIN_WINDOW();
@ -1090,11 +1090,11 @@ DiskArchive::LoadDiskFSContents(DiskFS* pDiskFS, const WCHAR* volName)
WMSG2("Notes for disk image '%ls':\n%hs", WMSG2("Notes for disk image '%ls':\n%hs",
volName, pDiskFS->GetDiskImg()->GetNotes()); volName, pDiskFS->GetDiskImg()->GetNotes());
ASSERT(pDiskFS != nil); ASSERT(pDiskFS != NULL);
pFile = pDiskFS->GetNextFile(nil); pFile = pDiskFS->GetNextFile(NULL);
while (pFile != nil) { while (pFile != NULL) {
pNewEntry = new DiskEntry(pFile); pNewEntry = new DiskEntry(pFile);
if (pNewEntry == nil) if (pNewEntry == NULL)
return -1; return -1;
CString path(pFile->GetPathName()); CString path(pFile->GetPathName());
@ -1208,14 +1208,14 @@ DiskArchive::LoadDiskFSContents(DiskFS* pDiskFS, const WCHAR* volName)
* its full path with no risk of conflict. (The extraction code relies * its full path with no risk of conflict. (The extraction code relies
* on this, so don't put a ':' in the subvol name or Windows will choke.) * on this, so don't put a ':' in the subvol name or Windows will choke.)
*/ */
pSubVol = pDiskFS->GetNextSubVolume(nil); pSubVol = pDiskFS->GetNextSubVolume(NULL);
while (pSubVol != nil) { while (pSubVol != NULL) {
CString concatSubVolName; CString concatSubVolName;
const char* subVolName; const char* subVolName;
int ret; int ret;
subVolName = pSubVol->GetDiskFS()->GetVolumeName(); subVolName = pSubVol->GetDiskFS()->GetVolumeName();
if (subVolName == nil) if (subVolName == NULL)
subVolName = "+++"; // call it *something* subVolName = "+++"; // call it *something*
if (volName[0] == '\0') if (volName[0] == '\0')
@ -1243,7 +1243,7 @@ DiskArchive::PreferencesChanged(void)
{ {
const Preferences* pPreferences = GET_PREFERENCES(); const Preferences* pPreferences = GET_PREFERENCES();
if (fpPrimaryDiskFS != nil) { if (fpPrimaryDiskFS != NULL) {
fpPrimaryDiskFS->SetParameter(DiskFS::kParmProDOS_AllowLowerCase, fpPrimaryDiskFS->SetParameter(DiskFS::kParmProDOS_AllowLowerCase,
pPreferences->GetPrefBool(kPrProDOSAllowLower) != 0); pPreferences->GetPrefBool(kPrProDOSAllowLower) != 0);
fpPrimaryDiskFS->SetParameter(DiskFS::kParmProDOS_AllocSparse, fpPrimaryDiskFS->SetParameter(DiskFS::kParmProDOS_AllocSparse,
@ -1317,7 +1317,7 @@ DiskArchive::BulkAdd(ActionProgressDialog* pActionProgress,
pAddOpts->fIncludeSubfolders, pAddOpts->fStripFolderNames, pAddOpts->fIncludeSubfolders, pAddOpts->fStripFolderNames,
pAddOpts->fOverwriteExisting); pAddOpts->fOverwriteExisting);
ASSERT(fpAddDataHead == nil); ASSERT(fpAddDataHead == NULL);
/* these reset on every new add */ /* these reset on every new add */
fOverwriteExisting = false; fOverwriteExisting = false;
@ -1364,7 +1364,7 @@ DiskArchive::BulkAdd(ActionProgressDialog* pActionProgress,
buf += wcslen(buf)+1; buf += wcslen(buf)+1;
} }
if (fpAddDataHead == nil) { if (fpAddDataHead == NULL) {
CString title; CString title;
title.LoadString(IDS_MB_APP_NAME); title.LoadString(IDS_MB_APP_NAME);
errMsg = L"No files added.\n"; errMsg = L"No files added.\n";
@ -1438,7 +1438,7 @@ DiskArchive::DoAddFile(const AddFilesDialog* pAddOpts,
DIError dierr; DIError dierr;
int neededLen = 64; // reasonable guess int neededLen = 64; // reasonable guess
char* fsNormalBuf = nil; // name as it will appear on disk image char* fsNormalBuf = NULL; // name as it will appear on disk image
WMSG2(" +++ ADD file: orig='%ls' stor='%ls'\n", WMSG2(" +++ ADD file: orig='%ls' stor='%ls'\n",
(LPCWSTR) pDetails->origName, (LPCWSTR) pDetails->storageName); (LPCWSTR) pDetails->origName, (LPCWSTR) pDetails->storageName);
@ -1477,7 +1477,7 @@ retry:
*/ */
A2File* pExisting; A2File* pExisting;
pExisting = pDiskFS->GetFileByName(fsNormalBuf); pExisting = pDiskFS->GetFileByName(fsNormalBuf);
if (pExisting != nil) { if (pExisting != NULL) {
NuResult result; NuResult result;
result = HandleReplaceExisting(pExisting, pDetails); result = HandleReplaceExisting(pExisting, pDetails);
@ -1513,7 +1513,7 @@ retry:
*/ */
FileAddData* pAddData; FileAddData* pAddData;
pAddData = new FileAddData(pDetails, fsNormalBuf); pAddData = new FileAddData(pDetails, fsNormalBuf);
if (pAddData == nil) { if (pAddData == NULL) {
nuerr = kNuErrMalloc; nuerr = kNuErrMalloc;
goto bail; goto bail;
} }
@ -1613,8 +1613,8 @@ DiskArchive::ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL)
{ {
CString errMsg; CString errMsg;
FileAddData* pData; FileAddData* pData;
unsigned char* dataBuf = nil; unsigned char* dataBuf = NULL;
unsigned char* rsrcBuf = nil; unsigned char* rsrcBuf = NULL;
long dataLen, rsrcLen; long dataLen, rsrcLen;
MainWindow* pMainWin = (MainWindow*)::AfxGetMainWnd(); MainWindow* pMainWin = (MainWindow*)::AfxGetMainWnd();
@ -1645,9 +1645,9 @@ DiskArchive::ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL)
pData = fpAddDataHead; pData = fpAddDataHead;
while (pData != nil) { while (pData != NULL) {
const FileDetails* pDataDetails = nil; const FileDetails* pDataDetails = NULL;
const FileDetails* pRsrcDetails = nil; const FileDetails* pRsrcDetails = NULL;
const FileDetails* pDetails = pData->GetDetails(); const FileDetails* pDetails = pData->GetDetails();
const char* typeStr = "????"; // for debug msg only const char* typeStr = "????"; // for debug msg only
@ -1671,17 +1671,17 @@ DiskArchive::ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL)
return L"internal error"; return L"internal error";
} }
if (pData->GetOtherFork() != nil) { if (pData->GetOtherFork() != NULL) {
pDetails = pData->GetOtherFork()->GetDetails(); pDetails = pData->GetOtherFork()->GetDetails();
typeStr = "both"; typeStr = "both";
switch (pDetails->entryKind) { switch (pDetails->entryKind) {
case FileDetails::kFileKindDataFork: case FileDetails::kFileKindDataFork:
assert(pDataDetails == nil); assert(pDataDetails == NULL);
pDataDetails = pDetails; pDataDetails = pDetails;
break; break;
case FileDetails::kFileKindRsrcFork: case FileDetails::kFileKindRsrcFork:
assert(pRsrcDetails == nil); assert(pRsrcDetails == NULL);
pRsrcDetails = pDetails; pRsrcDetails = pDetails;
break; break;
case FileDetails::kFileKindDiskImage: case FileDetails::kFileKindDiskImage:
@ -1697,7 +1697,7 @@ DiskArchive::ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL)
WMSG2("Adding file '%ls' (%hs)\n", WMSG2("Adding file '%ls' (%hs)\n",
(LPCWSTR) pDetails->storageName, typeStr); (LPCWSTR) pDetails->storageName, typeStr);
ASSERT(pDataDetails != nil || pRsrcDetails != nil); ASSERT(pDataDetails != NULL || pRsrcDetails != NULL);
/* /*
* The current implementation of DiskImg/DiskFS requires writing each * The current implementation of DiskImg/DiskFS requires writing each
@ -1707,7 +1707,7 @@ DiskArchive::ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL)
*/ */
DiskFS::CreateParms parms; DiskFS::CreateParms parms;
ConvertFDToCP(pData->GetDetails(), &parms); ConvertFDToCP(pData->GetDetails(), &parms);
if (pRsrcDetails != nil) if (pRsrcDetails != NULL)
parms.storageType = kNuStorageExtended; parms.storageType = kNuStorageExtended;
else else
parms.storageType = kNuStorageSeedling; parms.storageType = kNuStorageSeedling;
@ -1716,7 +1716,7 @@ DiskArchive::ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL)
parms.pathName = pData->GetFSNormalPath(); parms.pathName = pData->GetFSNormalPath();
dataLen = rsrcLen = -1; dataLen = rsrcLen = -1;
if (pDataDetails != nil) { if (pDataDetails != NULL) {
/* figure out text conversion, including high ASCII for DOS */ /* figure out text conversion, including high ASCII for DOS */
/* (HA conversion only happens if text conversion happens) */ /* (HA conversion only happens if text conversion happens) */
GenericEntry::ConvertHighASCII convHA; GenericEntry::ConvertHighASCII convHA;
@ -1740,7 +1740,7 @@ DiskArchive::ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL)
if (!errMsg.IsEmpty()) if (!errMsg.IsEmpty())
goto bail; goto bail;
} }
if (pRsrcDetails != nil) { if (pRsrcDetails != NULL) {
/* no text conversion on resource forks */ /* no text conversion on resource forks */
errMsg = LoadFile(pRsrcDetails->origName, &rsrcBuf, &rsrcLen, errMsg = LoadFile(pRsrcDetails->origName, &rsrcBuf, &rsrcLen,
GenericEntry::kConvertEOLOff, GenericEntry::kConvertHAOff); GenericEntry::kConvertEOLOff, GenericEntry::kConvertHAOff);
@ -1764,7 +1764,7 @@ DiskArchive::ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL)
} }
delete[] dataBuf; delete[] dataBuf;
delete[] rsrcBuf; delete[] rsrcBuf;
dataBuf = rsrcBuf = nil; dataBuf = rsrcBuf = NULL;
pData = pData->GetNext(); pData = pData->GetNext();
} }
@ -1803,12 +1803,12 @@ DiskArchive::LoadFile(const WCHAR* pathName, BYTE** pBuf, long* pLen,
ASSERT(conv == GenericEntry::kConvertEOLOn || ASSERT(conv == GenericEntry::kConvertEOLOn ||
conv == GenericEntry::kConvertEOLOff || conv == GenericEntry::kConvertEOLOff ||
conv == GenericEntry::kConvertEOLAuto); conv == GenericEntry::kConvertEOLAuto);
ASSERT(pathName != nil); ASSERT(pathName != NULL);
ASSERT(pBuf != nil); ASSERT(pBuf != NULL);
ASSERT(pLen != nil); ASSERT(pLen != NULL);
fp = _wfopen(pathName, L"rb"); fp = _wfopen(pathName, L"rb");
if (fp == nil) { if (fp == NULL) {
errMsg.Format(L"Unable to open '%ls': %hs.", pathName, errMsg.Format(L"Unable to open '%ls': %hs.", pathName,
strerror(errno)); strerror(errno));
goto bail; goto bail;
@ -1828,7 +1828,7 @@ DiskArchive::LoadFile(const WCHAR* pathName, BYTE** pBuf, long* pLen,
rewind(fp); rewind(fp);
if (fileLen == 0) { // handle zero-length files if (fileLen == 0) { // handle zero-length files
*pBuf = nil; *pBuf = NULL;
*pLen = 0; *pLen = 0;
goto bail; goto bail;
} else if (fileLen > 0x00ffffff) { } else if (fileLen > 0x00ffffff) {
@ -1837,7 +1837,7 @@ DiskArchive::LoadFile(const WCHAR* pathName, BYTE** pBuf, long* pLen,
} }
*pBuf = new BYTE[fileLen]; *pBuf = new BYTE[fileLen];
if (*pBuf == nil) { if (*pBuf == NULL) {
errMsg.Format(L"Unable to allocate %ld bytes for '%ls'.", errMsg.Format(L"Unable to allocate %ld bytes for '%ls'.",
fileLen, pathName); fileLen, pathName);
goto bail; goto bail;
@ -1864,7 +1864,7 @@ DiskArchive::LoadFile(const WCHAR* pathName, BYTE** pBuf, long* pLen,
errMsg.Format(L"Unable to read initial chunk of '%ls': %hs.", errMsg.Format(L"Unable to read initial chunk of '%ls': %hs.",
pathName, strerror(errno)); pathName, strerror(errno));
delete[] *pBuf; delete[] *pBuf;
*pBuf = nil; *pBuf = NULL;
goto bail; goto bail;
} }
rewind(fp); rewind(fp);
@ -1895,7 +1895,7 @@ DiskArchive::LoadFile(const WCHAR* pathName, BYTE** pBuf, long* pLen,
if (fread(*pBuf, fileLen, 1, fp) != 1) { if (fread(*pBuf, fileLen, 1, fp) != 1) {
errMsg.Format(L"Unable to read '%ls': %hs.", pathName, strerror(errno)); errMsg.Format(L"Unable to read '%ls': %hs.", pathName, strerror(errno));
delete[] *pBuf; delete[] *pBuf;
*pBuf = nil; *pBuf = NULL;
goto bail; goto bail;
} }
} else { } else {
@ -1967,8 +1967,8 @@ DiskArchive::AddForksToDisk(DiskFS* pDiskFS, const DiskFS::CreateParms* pParms,
const int kFileTypeBIN = 0x06; const int kFileTypeBIN = 0x06;
const int kFileTypeINT = 0xfa; const int kFileTypeINT = 0xfa;
const int kFileTypeBAS = 0xfc; const int kFileTypeBAS = 0xfc;
A2File* pNewFile = nil; A2File* pNewFile = NULL;
A2FileDescr* pOpenFile = nil; A2FileDescr* pOpenFile = NULL;
DiskFS::CreateParms parmCopy; DiskFS::CreateParms parmCopy;
/* /*
@ -1998,7 +1998,7 @@ DiskArchive::AddForksToDisk(DiskFS* pDiskFS, const DiskFS::CreateParms* pParms,
if (parmCopy.fssep != '\0' && parmCopy.storageType == kNuStorageSeedling) { if (parmCopy.fssep != '\0' && parmCopy.storageType == kNuStorageSeedling) {
const char* cp; const char* cp;
cp = strrchr(parmCopy.pathName, parmCopy.fssep); cp = strrchr(parmCopy.pathName, parmCopy.fssep);
if (cp != nil) { if (cp != NULL) {
if (strcmp(cp+1, kEmptyFolderMarker) == 0 && dataLen == 0) { if (strcmp(cp+1, kEmptyFolderMarker) == 0 && dataLen == 0) {
/* drop the junk on the end */ /* drop the junk on the end */
parmCopy.storageType = kNuStorageDirectory; parmCopy.storageType = kNuStorageDirectory;
@ -2081,20 +2081,20 @@ DiskArchive::AddForksToDisk(DiskFS* pDiskFS, const DiskFS::CreateParms* pParms,
/* /*
* Note: if this was an empty directory holder, pNewFile will be set * Note: if this was an empty directory holder, pNewFile will be set
* to nil. We used to avoid handling this by just not opening the file * to NULL. We used to avoid handling this by just not opening the file
* if it had a length of zero. However, DOS 3.3 needs to write some * if it had a length of zero. However, DOS 3.3 needs to write some
* kinds of zero-length files, because e.g. a zero-length 'B' file * kinds of zero-length files, because e.g. a zero-length 'B' file
* actually has 4 bytes of data in it. * actually has 4 bytes of data in it.
* *
* Of course, if dataLen is zero then dataBuf is nil, so we need to * Of course, if dataLen is zero then dataBuf is NULL, so we need to
* supply a dummy write buffer. None of this is an issue for resource * supply a dummy write buffer. None of this is an issue for resource
* forks, because DOS 3.3 doesn't have those. * forks, because DOS 3.3 doesn't have those.
*/ */
if (dataLen > 0 || if (dataLen > 0 ||
(dataLen == 0 && pNewFile != nil)) (dataLen == 0 && pNewFile != NULL))
{ {
ASSERT(pNewFile != nil); ASSERT(pNewFile != NULL);
unsigned char dummyBuf[1] = { '\0' }; unsigned char dummyBuf[1] = { '\0' };
dierr = pNewFile->Open(&pOpenFile, false, false); dierr = pNewFile->Open(&pOpenFile, false, false);
@ -2102,27 +2102,27 @@ DiskArchive::AddForksToDisk(DiskFS* pDiskFS, const DiskFS::CreateParms* pParms,
goto bail; goto bail;
pOpenFile->SetProgressUpdater(DiskArchive::ProgressCallback, pOpenFile->SetProgressUpdater(DiskArchive::ProgressCallback,
dataLen, nil); dataLen, NULL);
dierr = pOpenFile->Write(dataBuf != nil ? dataBuf : dummyBuf, dataLen); dierr = pOpenFile->Write(dataBuf != NULL ? dataBuf : dummyBuf, dataLen);
if (dierr != kDIErrNone) if (dierr != kDIErrNone)
goto bail; goto bail;
dierr = pOpenFile->Close(); dierr = pOpenFile->Close();
if (dierr != kDIErrNone) if (dierr != kDIErrNone)
goto bail; goto bail;
pOpenFile = nil; pOpenFile = NULL;
} }
if (rsrcLen > 0) { if (rsrcLen > 0) {
ASSERT(pNewFile != nil); ASSERT(pNewFile != NULL);
dierr = pNewFile->Open(&pOpenFile, false, true); dierr = pNewFile->Open(&pOpenFile, false, true);
if (dierr != kDIErrNone) if (dierr != kDIErrNone)
goto bail; goto bail;
pOpenFile->SetProgressUpdater(DiskArchive::ProgressCallback, pOpenFile->SetProgressUpdater(DiskArchive::ProgressCallback,
rsrcLen, nil); rsrcLen, NULL);
dierr = pOpenFile->Write(rsrcBuf, rsrcLen); dierr = pOpenFile->Write(rsrcBuf, rsrcLen);
if (dierr != kDIErrNone) if (dierr != kDIErrNone)
@ -2131,13 +2131,13 @@ DiskArchive::AddForksToDisk(DiskFS* pDiskFS, const DiskFS::CreateParms* pParms,
dierr = pOpenFile->Close(); dierr = pOpenFile->Close();
if (dierr != kDIErrNone) if (dierr != kDIErrNone)
goto bail; goto bail;
pOpenFile = nil; pOpenFile = NULL;
} }
bail: bail:
if (pOpenFile != nil) if (pOpenFile != NULL)
pOpenFile->Close(); pOpenFile->Close();
if (dierr != kDIErrNone && pNewFile != nil) { if (dierr != kDIErrNone && pNewFile != NULL) {
/* /*
* Clean up the partially-written file. This does not, of course, * Clean up the partially-written file. This does not, of course,
* erase any subdirectories that were created to contain this file. * erase any subdirectories that were created to contain this file.
@ -2184,8 +2184,8 @@ DiskArchive::ConvertFDToCP(const FileDetails* pDetails,
void void
DiskArchive::AddToAddDataList(FileAddData* pData) DiskArchive::AddToAddDataList(FileAddData* pData)
{ {
ASSERT(pData != nil); ASSERT(pData != NULL);
ASSERT(pData->GetNext() == nil); ASSERT(pData->GetNext() == NULL);
/* /*
* Run through the entire existing list, looking for a match. This is * Run through the entire existing list, looking for a match. This is
@ -2198,8 +2198,8 @@ DiskArchive::AddToAddDataList(FileAddData* pData)
FileDetails::FileKind dataKind, listKind; FileDetails::FileKind dataKind, listKind;
dataKind = pData->GetDetails()->entryKind; dataKind = pData->GetDetails()->entryKind;
while (pSearch != nil) { while (pSearch != NULL) {
if (pSearch->GetOtherFork() == nil && if (pSearch->GetOtherFork() == NULL &&
wcscmp(pSearch->GetDetails()->storageName, wcscmp(pSearch->GetDetails()->storageName,
pData->GetDetails()->storageName) == 0) pData->GetDetails()->storageName) == 0)
{ {
@ -2225,8 +2225,8 @@ DiskArchive::AddToAddDataList(FileAddData* pData)
pSearch = pSearch->GetNext(); pSearch = pSearch->GetNext();
} }
if (fpAddDataHead == nil) { if (fpAddDataHead == NULL) {
assert(fpAddDataTail == nil); assert(fpAddDataTail == NULL);
fpAddDataHead = fpAddDataTail = pData; fpAddDataHead = fpAddDataTail = pData;
} else { } else {
fpAddDataTail->SetNext(pData); fpAddDataTail->SetNext(pData);
@ -2244,14 +2244,14 @@ DiskArchive::FreeAddDataList(void)
FileAddData* pNext; FileAddData* pNext;
pData = fpAddDataHead; pData = fpAddDataHead;
while (pData != nil) { while (pData != NULL) {
pNext = pData->GetNext(); pNext = pData->GetNext();
delete pData->GetOtherFork(); delete pData->GetOtherFork();
delete pData; delete pData;
pData = pNext; pData = pNext;
} }
fpAddDataHead = fpAddDataTail = nil; fpAddDataHead = fpAddDataTail = NULL;
} }
@ -2268,13 +2268,13 @@ bool
DiskArchive::CreateSubdir(CWnd* pMsgWnd, GenericEntry* pParentEntry, DiskArchive::CreateSubdir(CWnd* pMsgWnd, GenericEntry* pParentEntry,
const WCHAR* newName) const WCHAR* newName)
{ {
ASSERT(newName != nil && wcslen(newName) > 0); ASSERT(newName != NULL && wcslen(newName) > 0);
DiskEntry* pEntry = (DiskEntry*) pParentEntry; DiskEntry* pEntry = (DiskEntry*) pParentEntry;
ASSERT(pEntry != nil); ASSERT(pEntry != NULL);
A2File* pFile = pEntry->GetA2File(); A2File* pFile = pEntry->GetA2File();
ASSERT(pFile != nil); ASSERT(pFile != NULL);
DiskFS* pDiskFS = pFile->GetDiskFS(); DiskFS* pDiskFS = pFile->GetDiskFS();
ASSERT(pDiskFS != nil); ASSERT(pDiskFS != NULL);
if (!pFile->IsDirectory()) { if (!pFile->IsDirectory()) {
ASSERT(false); ASSERT(false);
@ -2282,10 +2282,10 @@ DiskArchive::CreateSubdir(CWnd* pMsgWnd, GenericEntry* pParentEntry,
} }
DIError dierr; DIError dierr;
A2File* pNewFile = nil; A2File* pNewFile = NULL;
DiskFS::CreateParms parms; DiskFS::CreateParms parms;
CStringA pathName; CStringA pathName;
time_t now = time(nil); time_t now = time(NULL);
/* /*
* Create the full path. * Create the full path.
@ -2297,7 +2297,7 @@ DiskArchive::CreateSubdir(CWnd* pMsgWnd, GenericEntry* pParentEntry,
pathName += pParentEntry->GetFssep(); pathName += pParentEntry->GetFssep();
pathName += newName; pathName += newName;
} }
ASSERT(wcschr(newName, pParentEntry->GetFssep()) == nil); ASSERT(wcschr(newName, pParentEntry->GetFssep()) == NULL);
/* using NufxLib constants; they match with ProDOS */ /* using NufxLib constants; they match with ProDOS */
memset(&parms, 0, sizeof(parms)); memset(&parms, 0, sizeof(parms));
@ -2379,9 +2379,9 @@ DiskArchive::DeleteSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
int idx = 0; int idx = 0;
pSelEntry = pSelSet->IterNext(); pSelEntry = pSelSet->IterNext();
while (pSelEntry != nil) { while (pSelEntry != NULL) {
pEntry = (DiskEntry*) pSelEntry->GetEntry(); pEntry = (DiskEntry*) pSelEntry->GetEntry();
ASSERT(pEntry != nil); ASSERT(pEntry != NULL);
entryArray[idx++] = pEntry; entryArray[idx++] = pEntry;
WMSG2("Added 0x%08lx '%ls'\n", (long) entryArray[idx-1], WMSG2("Added 0x%08lx '%ls'\n", (long) entryArray[idx-1],
@ -2421,7 +2421,7 @@ DiskArchive::DeleteSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
WMSG2(" Deleting '%ls' from '%hs'\n", (LPCWSTR) pEntry->GetPathName(), WMSG2(" Deleting '%ls' from '%hs'\n", (LPCWSTR) pEntry->GetPathName(),
(LPCSTR) pFile->GetDiskFS()->GetVolumeName()); (LPCSTR) pFile->GetDiskFS()->GetVolumeName());
SET_PROGRESS_UPDATE2(0, pEntry->GetPathName(), nil); SET_PROGRESS_UPDATE2(0, pEntry->GetPathName(), NULL);
/* /*
* Ask the DiskFS to delete the file. As soon as this completes, * Ask the DiskFS to delete the file. As soon as this completes,
@ -2447,7 +2447,7 @@ DiskArchive::DeleteSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
* changes we'll need to raise the "reload" flag here, before the * changes we'll need to raise the "reload" flag here, before the
* reload, to prevent the ContentList from chasing a bad pointer. * reload, to prevent the ContentList from chasing a bad pointer.
*/ */
pEntry->SetA2File(nil); pEntry->SetA2File(NULL);
} }
retVal = true; retVal = true;
@ -2496,7 +2496,7 @@ DiskArchive::RenameSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
* sorts of archives (e.g. disk archives). * sorts of archives (e.g. disk archives).
*/ */
SelectionEntry* pSelEntry = pSelSet->IterNext(); SelectionEntry* pSelEntry = pSelSet->IterNext();
while (pSelEntry != nil) { while (pSelEntry != NULL) {
RenameEntryDialog renameDlg(pMsgWnd); RenameEntryDialog renameDlg(pMsgWnd);
DiskEntry* pEntry = (DiskEntry*) pSelEntry->GetEntry(); DiskEntry* pEntry = (DiskEntry*) pSelEntry->GetEntry();
@ -2557,7 +2557,7 @@ DiskArchive::SetRenameFields(CWnd* pMsgWnd, DiskEntry* pEntry,
{ {
DiskFS* pDiskFS; DiskFS* pDiskFS;
ASSERT(pEntry != nil); ASSERT(pEntry != NULL);
/* /*
* Figure out if we're allowed to change the entire path. (This is * Figure out if we're allowed to change the entire path. (This is
@ -2630,7 +2630,7 @@ DiskArchive::TestPathName(const GenericEntry* pGenericEntry,
A2File* existingFile; A2File* existingFile;
CStringA pathNameA(pathName); CStringA pathNameA(pathName);
existingFile = pDiskFS->GetFileByName(pathNameA); existingFile = pDiskFS->GetFileByName(pathNameA);
if (existingFile != nil && existingFile != pEntry->GetA2File()) { if (existingFile != NULL && existingFile != pEntry->GetA2File()) {
errMsg = "A file with that name already exists."; errMsg = "A file with that name already exists.";
goto bail; goto bail;
} }
@ -2709,8 +2709,8 @@ DiskArchive::TestVolumeName(const DiskFS* pDiskFS,
DiskImg::FSFormat format; DiskImg::FSFormat format;
CString errMsg; CString errMsg;
ASSERT(pDiskFS != nil); ASSERT(pDiskFS != NULL);
ASSERT(newName != nil); ASSERT(newName != NULL);
format = pDiskFS->GetDiskImg()->GetFSFormat(); format = pDiskFS->GetDiskImg()->GetFSFormat();
@ -2816,8 +2816,8 @@ DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
ActionProgressDialog* pActionProgress, const XferFileOptions* pXferOpts) ActionProgressDialog* pActionProgress, const XferFileOptions* pXferOpts)
{ {
WMSG0("DiskArchive XferSelection!\n"); WMSG0("DiskArchive XferSelection!\n");
unsigned char* dataBuf = nil; unsigned char* dataBuf = NULL;
unsigned char* rsrcBuf = nil; unsigned char* rsrcBuf = NULL;
FileDetails fileDetails; FileDetails fileDetails;
CString errMsg, extractErrMsg, cmpStr; CString errMsg, extractErrMsg, cmpStr;
CString fixedPathName; CString fixedPathName;
@ -2826,14 +2826,14 @@ DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
pXferOpts->fTarget->XferPrepare(pXferOpts); pXferOpts->fTarget->XferPrepare(pXferOpts);
SelectionEntry* pSelEntry = pSelSet->IterNext(); SelectionEntry* pSelEntry = pSelSet->IterNext();
for ( ; pSelEntry != nil; pSelEntry = pSelSet->IterNext()) { for ( ; pSelEntry != NULL; pSelEntry = pSelSet->IterNext()) {
long dataLen=-1, rsrcLen=-1; long dataLen=-1, rsrcLen=-1;
DiskEntry* pEntry = (DiskEntry*) pSelEntry->GetEntry(); DiskEntry* pEntry = (DiskEntry*) pSelEntry->GetEntry();
int typeOverride = -1; int typeOverride = -1;
int result; int result;
ASSERT(dataBuf == nil); ASSERT(dataBuf == NULL);
ASSERT(rsrcBuf == nil); ASSERT(rsrcBuf == NULL);
if (pEntry->GetDamaged()) { if (pEntry->GetDamaged()) {
WMSG1(" XFER skipping damaged entry '%ls'\n", WMSG1(" XFER skipping damaged entry '%ls'\n",
@ -2850,7 +2850,7 @@ DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
fixedPathName = _T("(no filename)"); fixedPathName = _T("(no filename)");
if (pEntry->GetFSFormat() != DiskImg::kFormatProDOS) if (pEntry->GetFSFormat() != DiskImg::kFormatProDOS)
fixedPathName.Replace(PathProposal::kDefaultStoredFssep, '.'); fixedPathName.Replace(PathProposal::kDefaultStoredFssep, '.');
if (pEntry->GetSubVolName() != nil) { if (pEntry->GetSubVolName() != NULL) {
CString tmpStr; CString tmpStr;
tmpStr = pEntry->GetSubVolName(); tmpStr = pEntry->GetSubVolName();
tmpStr += (char)PathProposal::kDefaultStoredFssep; tmpStr += (char)PathProposal::kDefaultStoredFssep;
@ -2894,7 +2894,7 @@ DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
(LPCWSTR) fixedPathName, pEntry->GetHasDataFork(), (LPCWSTR) fixedPathName, pEntry->GetHasDataFork(),
pEntry->GetHasRsrcFork()); pEntry->GetHasRsrcFork());
dataBuf = nil; dataBuf = NULL;
dataLen = 0; dataLen = 0;
result = pEntry->ExtractThreadToBuffer(GenericEntry::kDataThread, result = pEntry->ExtractThreadToBuffer(GenericEntry::kDataThread,
(char**) &dataBuf, &dataLen, &extractErrMsg); (char**) &dataBuf, &dataLen, &extractErrMsg);
@ -2907,7 +2907,7 @@ DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED); ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED);
goto bail; goto bail;
} }
ASSERT(dataBuf != nil); ASSERT(dataBuf != NULL);
ASSERT(dataLen >= 0); ASSERT(dataLen >= 0);
#if 0 #if 0
@ -2935,7 +2935,7 @@ DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
#endif #endif
if (pEntry->GetHasRsrcFork()) { if (pEntry->GetHasRsrcFork()) {
rsrcBuf = nil; rsrcBuf = NULL;
rsrcLen = 0; rsrcLen = 0;
result = pEntry->ExtractThreadToBuffer(GenericEntry::kRsrcThread, result = pEntry->ExtractThreadToBuffer(GenericEntry::kRsrcThread,
(char**) &rsrcBuf, &rsrcLen, &extractErrMsg); (char**) &rsrcBuf, &rsrcLen, &extractErrMsg);
@ -2949,7 +2949,7 @@ DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
goto bail; goto bail;
} }
} else { } else {
ASSERT(rsrcBuf == nil); ASSERT(rsrcBuf == NULL);
} }
if (pEntry->GetHasDataFork() && pEntry->GetHasRsrcFork()) if (pEntry->GetHasDataFork() && pEntry->GetHasRsrcFork())
@ -2976,7 +2976,7 @@ have_stuff2:
fileDetails.storageType = kNuStorageUnknown; /* let NufxLib deal */ fileDetails.storageType = kNuStorageUnknown; /* let NufxLib deal */
time_t when; time_t when;
when = time(nil); when = time(NULL);
UNIXTimeToDateTime(&when, &fileDetails.archiveWhen); UNIXTimeToDateTime(&when, &fileDetails.archiveWhen);
when = pEntry->GetModWhen(); when = pEntry->GetModWhen();
UNIXTimeToDateTime(&when, &fileDetails.modWhen); UNIXTimeToDateTime(&when, &fileDetails.modWhen);
@ -2998,8 +2998,8 @@ have_stuff2:
ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED); ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED);
goto bail; goto bail;
} }
ASSERT(dataBuf == nil); ASSERT(dataBuf == NULL);
ASSERT(rsrcBuf == nil); ASSERT(rsrcBuf == NULL);
if (pActionProgress->SetProgress(100) == IDCANCEL) { if (pActionProgress->SetProgress(100) == IDCANCEL) {
retval = kXferCancelled; retval = kXferCancelled;
@ -3050,7 +3050,7 @@ DiskArchive::XferPrepare(const XferFileOptions* pXferOpts)
* *
* Returns 0 on success, nonzero on failure. * Returns 0 on success, nonzero on failure.
* *
* On success, *pDataBuf and *pRsrcBuf are freed and set to nil. (It's * On success, *pDataBuf and *pRsrcBuf are freed and set to NULL. (It's
* necessary for the interface to work this way because the NufxArchive * necessary for the interface to work this way because the NufxArchive
* version just tucks the pointers into NufxLib structures.) * version just tucks the pointers into NufxLib structures.)
*/ */
@ -3067,13 +3067,13 @@ DiskArchive::XferFile(FileDetails* pDetails, BYTE** pDataBuf,
WMSG3(" XFER: transfer '%ls' (dataLen=%ld rsrcLen=%ld)\n", WMSG3(" XFER: transfer '%ls' (dataLen=%ld rsrcLen=%ld)\n",
pDetails->storageName, dataLen, rsrcLen); pDetails->storageName, dataLen, rsrcLen);
ASSERT(pDataBuf != nil); ASSERT(pDataBuf != NULL);
ASSERT(pRsrcBuf != nil); ASSERT(pRsrcBuf != NULL);
/* fill out CreateParms from FileDetails */ /* fill out CreateParms from FileDetails */
ConvertFDToCP(pDetails, &createParms); ConvertFDToCP(pDetails, &createParms);
if (fpXferTargetFS == nil) if (fpXferTargetFS == NULL)
pDiskFS = fpPrimaryDiskFS; pDiskFS = fpPrimaryDiskFS;
else else
pDiskFS = fpXferTargetFS; pDiskFS = fpXferTargetFS;
@ -3134,9 +3134,9 @@ DiskArchive::XferFile(FileDetails* pDetails, BYTE** pDataBuf,
/* clean up */ /* clean up */
delete[] *pDataBuf; delete[] *pDataBuf;
*pDataBuf = nil; *pDataBuf = NULL;
delete[] *pRsrcBuf; delete[] *pRsrcBuf;
*pRsrcBuf = nil; *pRsrcBuf = NULL;
bail: bail:
return errMsg; return errMsg;

View File

@ -35,7 +35,7 @@ public:
// return the underlying FS format for this file // return the underlying FS format for this file
virtual DiskImg::FSFormat GetFSFormat(void) const { virtual DiskImg::FSFormat GetFSFormat(void) const {
ASSERT(fpFile != nil); ASSERT(fpFile != NULL);
return fpFile->GetFSFormat(); return fpFile->GetFSFormat();
} }
@ -55,8 +55,8 @@ private:
*/ */
class DiskArchive : public GenericArchive { class DiskArchive : public GenericArchive {
public: public:
DiskArchive(void) : fpPrimaryDiskFS(nil), fIsReadOnly(false), DiskArchive(void) : fpPrimaryDiskFS(NULL), fIsReadOnly(false),
fpAddDataHead(nil), fpAddDataTail(nil) fpAddDataHead(NULL), fpAddDataTail(NULL)
{} {}
virtual ~DiskArchive(void) { (void) Close(); } virtual ~DiskArchive(void) { (void) Close(); }
@ -172,8 +172,8 @@ private:
fDetails = *pDetails; fDetails = *pDetails;
fFSNormalPath = fsNormalPath; fFSNormalPath = fsNormalPath;
fpOtherFork = nil; fpOtherFork = NULL;
fpNext = nil; fpNext = NULL;
} }
virtual ~FileAddData(void) {} virtual ~FileAddData(void) {}

View File

@ -25,7 +25,7 @@ END_MESSAGE_MAP()
void void
DiskConvertDialog::Init(const DiskImg* pDiskImg) DiskConvertDialog::Init(const DiskImg* pDiskImg)
{ {
ASSERT(pDiskImg != nil); ASSERT(pDiskImg != NULL);
const int kMagicNibbles = -1234; const int kMagicNibbles = -1234;
bool hasBlocks = pDiskImg->GetHasBlocks(); bool hasBlocks = pDiskImg->GetHasBlocks();
bool hasSectors = pDiskImg->GetHasSectors(); bool hasSectors = pDiskImg->GetHasSectors();
@ -275,9 +275,9 @@ void
DiskConvertDialog::OnChangeRadio(UINT nID) DiskConvertDialog::OnChangeRadio(UINT nID)
{ {
CWnd* pGzip = GetDlgItem(IDC_DISKCONV_GZIP); CWnd* pGzip = GetDlgItem(IDC_DISKCONV_GZIP);
ASSERT(pGzip != nil); ASSERT(pGzip != NULL);
CButton* pNuFX = (CButton*)GetDlgItem(IDC_DISKCONV_SDK); CButton* pNuFX = (CButton*)GetDlgItem(IDC_DISKCONV_SDK);
ASSERT(pNuFX != nil); ASSERT(pNuFX != NULL);
if (fSizeInBlocks > DiskImgLib::kGzipMax / 512) if (fSizeInBlocks > DiskImgLib::kGzipMax / 512)
pGzip->EnableWindow(FALSE); pGzip->EnableWindow(FALSE);

View File

@ -52,14 +52,14 @@ BOOL
DiskEditDialog::OnInitDialog(void) DiskEditDialog::OnInitDialog(void)
{ {
ASSERT(!fFileName.IsEmpty()); ASSERT(!fFileName.IsEmpty());
ASSERT(fpDiskFS != nil); ASSERT(fpDiskFS != NULL);
/* /*
* Disable the write button. * Disable the write button.
*/ */
if (fReadOnly) { if (fReadOnly) {
CButton* pButton = (CButton*) GetDlgItem(IDC_DISKEDIT_DOWRITE); CButton* pButton = (CButton*) GetDlgItem(IDC_DISKEDIT_DOWRITE);
ASSERT(pButton != nil); ASSERT(pButton != NULL);
pButton->EnableWindow(FALSE); pButton->EnableWindow(FALSE);
} }
@ -77,7 +77,7 @@ DiskEditDialog::OnInitDialog(void)
* Configure the RichEdit control. * Configure the RichEdit control.
*/ */
CRichEditCtrl* pEdit = (CRichEditCtrl*) GetDlgItem(IDC_DISKEDIT_EDIT); CRichEditCtrl* pEdit = (CRichEditCtrl*) GetDlgItem(IDC_DISKEDIT_EDIT);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
/* set the font to 10-point Courier New */ /* set the font to 10-point Courier New */
CHARFORMAT cf; CHARFORMAT cf;
@ -100,11 +100,11 @@ DiskEditDialog::OnInitDialog(void)
* Disable the sub-volume and/or file open buttons if the DiskFS doesn't * Disable the sub-volume and/or file open buttons if the DiskFS doesn't
* have the appropriate stuff inside. * have the appropriate stuff inside.
*/ */
if (fpDiskFS->GetNextFile(nil) == nil) { if (fpDiskFS->GetNextFile(NULL) == NULL) {
CWnd* pWnd = GetDlgItem(IDC_DISKEDIT_OPENFILE); CWnd* pWnd = GetDlgItem(IDC_DISKEDIT_OPENFILE);
pWnd->EnableWindow(FALSE); pWnd->EnableWindow(FALSE);
} }
if (fpDiskFS->GetNextSubVolume(nil) == nil) { if (fpDiskFS->GetNextSubVolume(NULL) == NULL) {
CWnd* pWnd = GetDlgItem(IDC_DISKEDIT_SUBVOLUME); CWnd* pWnd = GetDlgItem(IDC_DISKEDIT_SUBVOLUME);
pWnd->EnableWindow(FALSE); pWnd->EnableWindow(FALSE);
} }
@ -134,7 +134,7 @@ DiskEditDialog::OnInitDialog(void)
*/ */
CString title("Disk Viewer - "); CString title("Disk Viewer - ");
title += fFileName; title += fFileName;
if (fpDiskFS->GetVolumeID() != nil) { if (fpDiskFS->GetVolumeID() != NULL) {
title += " ("; title += " (";
title += fpDiskFS->GetVolumeID(); title += fpDiskFS->GetVolumeID();
title += ")"; title += ")";
@ -150,12 +150,12 @@ DiskEditDialog::OnInitDialog(void)
void void
DiskEditDialog::InitNibbleParmList(void) DiskEditDialog::InitNibbleParmList(void)
{ {
ASSERT(fpDiskFS != nil); ASSERT(fpDiskFS != NULL);
DiskImg* pDiskImg = fpDiskFS->GetDiskImg(); DiskImg* pDiskImg = fpDiskFS->GetDiskImg();
CComboBox* pCombo; CComboBox* pCombo;
pCombo = (CComboBox*) GetDlgItem(IDC_DISKEDIT_NIBBLE_PARMS); pCombo = (CComboBox*) GetDlgItem(IDC_DISKEDIT_NIBBLE_PARMS);
ASSERT(pCombo != nil); ASSERT(pCombo != NULL);
if (pDiskImg->GetHasNibbles()) { if (pDiskImg->GetHasNibbles()) {
const DiskImg::NibbleDescr* pTable; const DiskImg::NibbleDescr* pTable;
@ -163,7 +163,7 @@ DiskEditDialog::InitNibbleParmList(void)
int i, count; int i, count;
pTable = pDiskImg->GetNibbleDescrTable(&count); pTable = pDiskImg->GetNibbleDescrTable(&count);
if (pTable == nil || count <= 0) { if (pTable == NULL || count <= 0) {
WMSG2("WHOOPS: nibble parm got table=0x%08lx, count=%d\n", WMSG2("WHOOPS: nibble parm got table=0x%08lx, count=%d\n",
(long) pTable, count); (long) pTable, count);
return; return;
@ -172,7 +172,7 @@ DiskEditDialog::InitNibbleParmList(void)
/* configure the selection to match the disk analysis */ /* configure the selection to match the disk analysis */
int dflt = -1; int dflt = -1;
if (pCurrent != nil) { if (pCurrent != NULL) {
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
if (memcmp(&pTable[i], pCurrent, sizeof(*pCurrent)) == 0) { if (memcmp(&pTable[i], pCurrent, sizeof(*pCurrent)) == 0) {
WMSG1(" NibbleParm match on entry %d\n", i); WMSG1(" NibbleParm match on entry %d\n", i);
@ -216,7 +216,7 @@ DiskEditDialog::ReplaceSpinCtrl(MySpinCtrl* pNewSpin, int idSpin, int idEdit)
DWORD style; DWORD style;
pSpin = (CSpinButtonCtrl*)GetDlgItem(idSpin); pSpin = (CSpinButtonCtrl*)GetDlgItem(idSpin);
if (pSpin == nil) if (pSpin == NULL)
return -1; return -1;
// pSpin->GetWindowRect(&rect); // pSpin->GetWindowRect(&rect);
// ScreenToClient(&rect); // ScreenToClient(&rect);
@ -305,7 +305,7 @@ DiskEditDialog::OnHexMode(void)
int base; int base;
CButton* pButton = (CButton*) GetDlgItem(IDC_DISKEDIT_HEX); CButton* pButton = (CButton*) GetDlgItem(IDC_DISKEDIT_HEX);
ASSERT(pButton != nil); ASSERT(pButton != NULL);
if (pButton->GetCheck() == 0) if (pButton->GetCheck() == 0)
base = 10; base = 10;
@ -328,14 +328,14 @@ DiskEditDialog::OnSubVolume(void)
subv.Setup(fpDiskFS); subv.Setup(fpDiskFS);
if (subv.DoModal() == IDOK) { if (subv.DoModal() == IDOK) {
WMSG1("SELECTED subv %d\n", subv.fListBoxIndex); WMSG1("SELECTED subv %d\n", subv.fListBoxIndex);
DiskFS::SubVolume* pSubVol = fpDiskFS->GetNextSubVolume(nil); DiskFS::SubVolume* pSubVol = fpDiskFS->GetNextSubVolume(NULL);
if (pSubVol == nil) if (pSubVol == NULL)
return; return;
while (subv.fListBoxIndex-- > 0) { while (subv.fListBoxIndex-- > 0) {
pSubVol = fpDiskFS->GetNextSubVolume(pSubVol); pSubVol = fpDiskFS->GetNextSubVolume(pSubVol);
} }
ASSERT(pSubVol != nil); ASSERT(pSubVol != NULL);
BlockEditDialog blockEdit; BlockEditDialog blockEdit;
SectorEditDialog sectorEdit; SectorEditDialog sectorEdit;
@ -367,7 +367,7 @@ DiskEditDialog::SetSpinMode(int id, int base)
ASSERT(base == 10 || base == 16); ASSERT(base == 10 || base == 16);
MySpinCtrl* pSpin = (MySpinCtrl*) GetDlgItem(id); MySpinCtrl* pSpin = (MySpinCtrl*) GetDlgItem(id);
if (pSpin == nil) { if (pSpin == NULL) {
// expected behavior in "block" mode for sector button // expected behavior in "block" mode for sector button
WMSG1("Couldn't find spin button %d\n", id); WMSG1("Couldn't find spin button %d\n", id);
return; return;
@ -399,7 +399,7 @@ int
DiskEditDialog::ReadSpinner(int id, long* pVal) DiskEditDialog::ReadSpinner(int id, long* pVal)
{ {
MySpinCtrl* pSpin = (MySpinCtrl*) GetDlgItem(id); MySpinCtrl* pSpin = (MySpinCtrl*) GetDlgItem(id);
ASSERT(pSpin != nil); ASSERT(pSpin != NULL);
long val = pSpin->GetPos(); long val = pSpin->GetPos();
if (val & 0xff000000) { if (val & 0xff000000) {
@ -426,7 +426,7 @@ void
DiskEditDialog::SetSpinner(int id, long val) DiskEditDialog::SetSpinner(int id, long val)
{ {
MySpinCtrl* pSpin = (MySpinCtrl*) GetDlgItem(id); MySpinCtrl* pSpin = (MySpinCtrl*) GetDlgItem(id);
ASSERT(pSpin != nil); ASSERT(pSpin != NULL);
/* sanity check */ /* sanity check */
int lower, upper; int lower, upper;
@ -446,11 +446,11 @@ DiskEditDialog::DisplayData(const BYTE* srcBuf, int size)
WCHAR* cp; WCHAR* cp;
int i, j; int i, j;
ASSERT(srcBuf != nil); ASSERT(srcBuf != NULL);
ASSERT(size == kSectorSize || size == kBlockSize); ASSERT(size == kSectorSize || size == kBlockSize);
CRichEditCtrl* pEdit = (CRichEditCtrl*)GetDlgItem(IDC_DISKEDIT_EDIT); CRichEditCtrl* pEdit = (CRichEditCtrl*)GetDlgItem(IDC_DISKEDIT_EDIT);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
/* /*
* If we have an alert message, show that instead. * If we have an alert message, show that instead.
@ -523,7 +523,7 @@ DiskEditDialog::DisplayData(const BYTE* srcBuf, int size)
void void
DiskEditDialog::DisplayNibbleData(const unsigned char* srcBuf, int size) DiskEditDialog::DisplayNibbleData(const unsigned char* srcBuf, int size)
{ {
ASSERT(srcBuf != nil); ASSERT(srcBuf != NULL);
ASSERT(size > 0); ASSERT(size > 0);
ASSERT(fAlertMsg.IsEmpty()); ASSERT(fAlertMsg.IsEmpty());
@ -532,7 +532,7 @@ DiskEditDialog::DisplayNibbleData(const unsigned char* srcBuf, int size)
WCHAR* cp; WCHAR* cp;
int i; int i;
if (textBuf == nil) if (textBuf == NULL)
return; return;
cp = textBuf; cp = textBuf;
@ -567,7 +567,7 @@ DiskEditDialog::DisplayNibbleData(const unsigned char* srcBuf, int size)
*cp = '\0'; *cp = '\0';
CRichEditCtrl* pEdit = (CRichEditCtrl*)GetDlgItem(IDC_DISKEDIT_EDIT); CRichEditCtrl* pEdit = (CRichEditCtrl*)GetDlgItem(IDC_DISKEDIT_EDIT);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
pEdit->SetWindowText(textBuf); pEdit->SetWindowText(textBuf);
/* /*
@ -599,7 +599,7 @@ DiskEditDialog::DisplayNibbleData(const unsigned char* srcBuf, int size)
/* /*
* Open a file in a disk image. * Open a file in a disk image.
* *
* Returns a pointer to the A2File and A2FileDescr structures on success, nil * Returns a pointer to the A2File and A2FileDescr structures on success, NULL
* on failure. The pointer placed in "ppOpenFile" must be freed by invoking * on failure. The pointer placed in "ppOpenFile" must be freed by invoking
* its Close function. * its Close function.
*/ */
@ -608,12 +608,12 @@ DiskEditDialog::OpenFile(const WCHAR* fileName, bool openRsrc, A2File** ppFile,
A2FileDescr** ppOpenFile) A2FileDescr** ppOpenFile)
{ {
A2File* pFile; A2File* pFile;
A2FileDescr* pOpenFile = nil; A2FileDescr* pOpenFile = NULL;
WMSG2(" OpenFile '%ls' rsrc=%d\n", fileName, openRsrc); WMSG2(" OpenFile '%ls' rsrc=%d\n", fileName, openRsrc);
CStringA fileNameA(fileName); CStringA fileNameA(fileName);
pFile = fpDiskFS->GetFileByName(fileNameA); pFile = fpDiskFS->GetFileByName(fileNameA);
if (pFile == nil) { if (pFile == NULL) {
CString msg, failed; CString msg, failed;
msg.Format(IDS_DEFILE_FIND_FAILED, fileName); msg.Format(IDS_DEFILE_FIND_FAILED, fileName);
@ -653,11 +653,11 @@ DiskEditDialog::OnNibbleParms(void)
CComboBox* pCombo; CComboBox* pCombo;
int sel; int sel;
ASSERT(pDiskImg != nil); ASSERT(pDiskImg != NULL);
ASSERT(pDiskImg->GetHasNibbles()); ASSERT(pDiskImg->GetHasNibbles());
pCombo = (CComboBox*) GetDlgItem(IDC_DISKEDIT_NIBBLE_PARMS); pCombo = (CComboBox*) GetDlgItem(IDC_DISKEDIT_NIBBLE_PARMS);
ASSERT(pCombo != nil); ASSERT(pCombo != NULL);
sel = pCombo->GetCurSel(); sel = pCombo->GetCurSel();
if (sel == CB_ERR) if (sel == CB_ERR)
@ -721,11 +721,11 @@ SectorEditDialog::OnInitDialog(void)
CWnd* pWnd; CWnd* pWnd;
trackStr.Format(L"Track (%d):", fpDiskFS->GetDiskImg()->GetNumTracks()); trackStr.Format(L"Track (%d):", fpDiskFS->GetDiskImg()->GetNumTracks());
pWnd = GetDlgItem(IDC_STEXT_TRACK); pWnd = GetDlgItem(IDC_STEXT_TRACK);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->SetWindowText(trackStr); pWnd->SetWindowText(trackStr);
trackStr.Format(L"Sector (%d):", fpDiskFS->GetDiskImg()->GetNumSectPerTrack()); trackStr.Format(L"Sector (%d):", fpDiskFS->GetDiskImg()->GetNumSectPerTrack());
pWnd = GetDlgItem(IDC_STEXT_SECTOR); pWnd = GetDlgItem(IDC_STEXT_SECTOR);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->SetWindowText(trackStr); pWnd->SetWindowText(trackStr);
/* /*
@ -733,11 +733,11 @@ SectorEditDialog::OnInitDialog(void)
*/ */
MySpinCtrl* pSpin; MySpinCtrl* pSpin;
pSpin = (MySpinCtrl*)GetDlgItem(IDC_DISKEDIT_TRACKSPIN); pSpin = (MySpinCtrl*)GetDlgItem(IDC_DISKEDIT_TRACKSPIN);
ASSERT(pSpin != nil); ASSERT(pSpin != NULL);
pSpin->SetRange32(0, fpDiskFS->GetDiskImg()->GetNumTracks()-1); pSpin->SetRange32(0, fpDiskFS->GetDiskImg()->GetNumTracks()-1);
pSpin->SetPos(0); pSpin->SetPos(0);
pSpin = (MySpinCtrl*)GetDlgItem(IDC_DISKEDIT_SECTORSPIN); pSpin = (MySpinCtrl*)GetDlgItem(IDC_DISKEDIT_SECTORSPIN);
ASSERT(pSpin != nil); ASSERT(pSpin != NULL);
pSpin->SetRange32(0, fpDiskFS->GetDiskImg()->GetNumSectPerTrack()-1); pSpin->SetRange32(0, fpDiskFS->GetDiskImg()->GetNumSectPerTrack()-1);
pSpin->SetPos(0); pSpin->SetPos(0);
@ -756,8 +756,8 @@ int
SectorEditDialog::LoadData(void) SectorEditDialog::LoadData(void)
{ {
//WMSG0("SED LoadData\n"); //WMSG0("SED LoadData\n");
ASSERT(fpDiskFS != nil); ASSERT(fpDiskFS != NULL);
ASSERT(fpDiskFS->GetDiskImg() != nil); ASSERT(fpDiskFS->GetDiskImg() != NULL);
if (ReadSpinner(IDC_DISKEDIT_TRACKSPIN, &fTrack) != 0) if (ReadSpinner(IDC_DISKEDIT_TRACKSPIN, &fTrack) != 0)
return -1; return -1;
@ -863,7 +863,7 @@ SectorEditDialog::OnOpenFile(void)
if (fileDialog.DoModal() == IDOK) { if (fileDialog.DoModal() == IDOK) {
SectorFileEditDialog fileEdit(this, this); SectorFileEditDialog fileEdit(this, this);
A2File* pFile; A2File* pFile;
A2FileDescr* pOpenFile = nil; A2FileDescr* pOpenFile = NULL;
DIError dierr; DIError dierr;
dierr = OpenFile(fileDialog.fName, fileDialog.fOpenRsrcFork != 0, dierr = OpenFile(fileDialog.fName, fileDialog.fOpenRsrcFork != 0,
@ -901,10 +901,10 @@ SectorFileEditDialog::OnInitDialog(void)
/* disable direct entry of tracks and sectors */ /* disable direct entry of tracks and sectors */
CWnd* pWnd; CWnd* pWnd;
pWnd = GetDlgItem(IDC_DISKEDIT_TRACKSPIN); pWnd = GetDlgItem(IDC_DISKEDIT_TRACKSPIN);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->EnableWindow(FALSE); pWnd->EnableWindow(FALSE);
pWnd = GetDlgItem(IDC_DISKEDIT_SECTORSPIN); pWnd = GetDlgItem(IDC_DISKEDIT_SECTORSPIN);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->EnableWindow(FALSE); pWnd->EnableWindow(FALSE);
/* disallow opening of sub-volumes and files */ /* disallow opening of sub-volumes and files */
@ -915,10 +915,10 @@ SectorFileEditDialog::OnInitDialog(void)
CEdit* pEdit; CEdit* pEdit;
pEdit = (CEdit*) GetDlgItem(IDC_DISKEDIT_TRACK); pEdit = (CEdit*) GetDlgItem(IDC_DISKEDIT_TRACK);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
pEdit->SetReadOnly(TRUE); pEdit->SetReadOnly(TRUE);
pEdit = (CEdit*) GetDlgItem(IDC_DISKEDIT_SECTOR); pEdit = (CEdit*) GetDlgItem(IDC_DISKEDIT_SECTOR);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
pEdit->SetReadOnly(TRUE); pEdit->SetReadOnly(TRUE);
/* set the window title */ /* set the window title */
@ -941,8 +941,8 @@ SectorFileEditDialog::OnInitDialog(void)
int int
SectorFileEditDialog::LoadData(void) SectorFileEditDialog::LoadData(void)
{ {
ASSERT(fpDiskFS != nil); ASSERT(fpDiskFS != NULL);
ASSERT(fpDiskFS->GetDiskImg() != nil); ASSERT(fpDiskFS->GetDiskImg() != NULL);
DIError dierr; DIError dierr;
WMSG1("SFED LoadData reading index=%d\n", fSectorIdx); WMSG1("SFED LoadData reading index=%d\n", fSectorIdx);
@ -1021,15 +1021,15 @@ SectorFileEditDialog::LoadData(void)
CWnd* pWnd; CWnd* pWnd;
pWnd = GetDlgItem(IDC_DISKEDIT_PREV); pWnd = GetDlgItem(IDC_DISKEDIT_PREV);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->EnableWindow(fSectorIdx > 0); pWnd->EnableWindow(fSectorIdx > 0);
if (!pWnd->IsWindowEnabled() && GetFocus() == nil) if (!pWnd->IsWindowEnabled() && GetFocus() == NULL)
GetDlgItem(IDC_DISKEDIT_NEXT)->SetFocus(); GetDlgItem(IDC_DISKEDIT_NEXT)->SetFocus();
pWnd = GetDlgItem(IDC_DISKEDIT_NEXT); pWnd = GetDlgItem(IDC_DISKEDIT_NEXT);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->EnableWindow(fSectorIdx+1 < fpOpenFile->GetSectorCount()); pWnd->EnableWindow(fSectorIdx+1 < fpOpenFile->GetSectorCount());
if (!pWnd->IsWindowEnabled() && GetFocus() == nil) if (!pWnd->IsWindowEnabled() && GetFocus() == NULL)
GetDlgItem(IDC_DISKEDIT_PREV)->SetFocus(); GetDlgItem(IDC_DISKEDIT_PREV)->SetFocus();
DisplayData(); DisplayData();
@ -1096,7 +1096,7 @@ BlockEditDialog::OnInitDialog(void)
//blockStr.LoadString(IDS_BLOCK); //blockStr.LoadString(IDS_BLOCK);
blockStr.Format(L"Block (%d):", fpDiskFS->GetDiskImg()->GetNumBlocks()); blockStr.Format(L"Block (%d):", fpDiskFS->GetDiskImg()->GetNumBlocks());
pWnd = GetDlgItem(IDC_STEXT_TRACK); pWnd = GetDlgItem(IDC_STEXT_TRACK);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->SetWindowText(blockStr); pWnd->SetWindowText(blockStr);
/* /*
@ -1110,7 +1110,7 @@ BlockEditDialog::OnInitDialog(void)
MoveWindow(&rect); MoveWindow(&rect);
CRichEditCtrl* pEdit = (CRichEditCtrl*)GetDlgItem(IDC_DISKEDIT_EDIT); CRichEditCtrl* pEdit = (CRichEditCtrl*)GetDlgItem(IDC_DISKEDIT_EDIT);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
CRect inner; CRect inner;
pEdit->GetRect(&inner); pEdit->GetRect(&inner);
inner.bottom += kStretchHeight; inner.bottom += kStretchHeight;
@ -1136,7 +1136,7 @@ BlockEditDialog::OnInitDialog(void)
*/ */
MySpinCtrl* pSpin; MySpinCtrl* pSpin;
pSpin = (MySpinCtrl*)GetDlgItem(IDC_DISKEDIT_TRACKSPIN); pSpin = (MySpinCtrl*)GetDlgItem(IDC_DISKEDIT_TRACKSPIN);
ASSERT(pSpin != nil); ASSERT(pSpin != NULL);
pSpin->SetRange32(0, fpDiskFS->GetDiskImg()->GetNumBlocks()-1); pSpin->SetRange32(0, fpDiskFS->GetDiskImg()->GetNumBlocks()-1);
pSpin->SetPos(0); pSpin->SetPos(0);
@ -1160,7 +1160,7 @@ BlockEditDialog::MoveControl(int id, int deltaX, int deltaY)
CRect rect; CRect rect;
pWnd = GetDlgItem(id); pWnd = GetDlgItem(id);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->GetWindowRect(&rect); pWnd->GetWindowRect(&rect);
ScreenToClient(&rect); ScreenToClient(&rect);
@ -1180,8 +1180,8 @@ int
BlockEditDialog::LoadData(void) BlockEditDialog::LoadData(void)
{ {
//WMSG0("BED LoadData\n"); //WMSG0("BED LoadData\n");
ASSERT(fpDiskFS != nil); ASSERT(fpDiskFS != NULL);
ASSERT(fpDiskFS->GetDiskImg() != nil); ASSERT(fpDiskFS->GetDiskImg() != NULL);
if (ReadSpinner(IDC_DISKEDIT_TRACKSPIN, &fBlock) != 0) if (ReadSpinner(IDC_DISKEDIT_TRACKSPIN, &fBlock) != 0)
return -1; return -1;
@ -1246,7 +1246,7 @@ BlockEditDialog::OnReadPrev(void)
void void
BlockEditDialog::OnReadNext(void) BlockEditDialog::OnReadNext(void)
{ {
ASSERT(fpDiskFS != nil); ASSERT(fpDiskFS != NULL);
if (fBlock == fpDiskFS->GetDiskImg()->GetNumBlocks() - 1) if (fBlock == fpDiskFS->GetDiskImg()->GetNumBlocks() - 1)
return; return;
@ -1267,7 +1267,7 @@ BlockEditDialog::OnOpenFile(void)
if (fileDialog.DoModal() == IDOK) { if (fileDialog.DoModal() == IDOK) {
BlockFileEditDialog fileEdit(this, this); BlockFileEditDialog fileEdit(this, this);
A2File* pFile; A2File* pFile;
A2FileDescr* pOpenFile = nil; A2FileDescr* pOpenFile = NULL;
DIError dierr; DIError dierr;
dierr = OpenFile(fileDialog.fName, fileDialog.fOpenRsrcFork != 0, dierr = OpenFile(fileDialog.fName, fileDialog.fOpenRsrcFork != 0,
@ -1305,7 +1305,7 @@ BlockFileEditDialog::OnInitDialog(void)
/* disable direct entry of tracks and Blocks */ /* disable direct entry of tracks and Blocks */
CWnd* pWnd; CWnd* pWnd;
pWnd = GetDlgItem(IDC_DISKEDIT_TRACKSPIN); pWnd = GetDlgItem(IDC_DISKEDIT_TRACKSPIN);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->EnableWindow(FALSE); pWnd->EnableWindow(FALSE);
/* disallow opening of sub-volumes and files */ /* disallow opening of sub-volumes and files */
@ -1316,7 +1316,7 @@ BlockFileEditDialog::OnInitDialog(void)
CEdit* pEdit; CEdit* pEdit;
pEdit = (CEdit*) GetDlgItem(IDC_DISKEDIT_TRACK); pEdit = (CEdit*) GetDlgItem(IDC_DISKEDIT_TRACK);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
pEdit->SetReadOnly(TRUE); pEdit->SetReadOnly(TRUE);
/* set the window title */ /* set the window title */
@ -1339,8 +1339,8 @@ BlockFileEditDialog::OnInitDialog(void)
int int
BlockFileEditDialog::LoadData(void) BlockFileEditDialog::LoadData(void)
{ {
ASSERT(fpDiskFS != nil); ASSERT(fpDiskFS != NULL);
ASSERT(fpDiskFS->GetDiskImg() != nil); ASSERT(fpDiskFS->GetDiskImg() != NULL);
DIError dierr; DIError dierr;
WMSG1("BFED LoadData reading index=%d\n", fBlockIdx); WMSG1("BFED LoadData reading index=%d\n", fBlockIdx);
@ -1416,15 +1416,15 @@ BlockFileEditDialog::LoadData(void)
CWnd* pWnd; CWnd* pWnd;
pWnd = GetDlgItem(IDC_DISKEDIT_PREV); pWnd = GetDlgItem(IDC_DISKEDIT_PREV);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->EnableWindow(fBlockIdx > 0); pWnd->EnableWindow(fBlockIdx > 0);
if (!pWnd->IsWindowEnabled() && GetFocus() == nil) if (!pWnd->IsWindowEnabled() && GetFocus() == NULL)
GetDlgItem(IDC_DISKEDIT_NEXT)->SetFocus(); GetDlgItem(IDC_DISKEDIT_NEXT)->SetFocus();
pWnd = GetDlgItem(IDC_DISKEDIT_NEXT); pWnd = GetDlgItem(IDC_DISKEDIT_NEXT);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->EnableWindow(fBlockIdx+1 < fpOpenFile->GetBlockCount()); pWnd->EnableWindow(fBlockIdx+1 < fpOpenFile->GetBlockCount());
if (!pWnd->IsWindowEnabled() && GetFocus() == nil) if (!pWnd->IsWindowEnabled() && GetFocus() == NULL)
GetDlgItem(IDC_DISKEDIT_PREV)->SetFocus(); GetDlgItem(IDC_DISKEDIT_PREV)->SetFocus();
DisplayData(); DisplayData();
@ -1489,7 +1489,7 @@ NibbleEditDialog::OnInitDialog(void)
CString trackStr; CString trackStr;
trackStr.Format(L"Track (%d):", fpDiskFS->GetDiskImg()->GetNumTracks()); trackStr.Format(L"Track (%d):", fpDiskFS->GetDiskImg()->GetNumTracks());
pWnd = GetDlgItem(IDC_STEXT_TRACK); pWnd = GetDlgItem(IDC_STEXT_TRACK);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->SetWindowText(trackStr); pWnd->SetWindowText(trackStr);
/* /*
@ -1500,7 +1500,7 @@ NibbleEditDialog::OnInitDialog(void)
* device context. * device context.
*/ */
CRichEditCtrl* pEdit = (CRichEditCtrl*)GetDlgItem(IDC_DISKEDIT_EDIT); CRichEditCtrl* pEdit = (CRichEditCtrl*)GetDlgItem(IDC_DISKEDIT_EDIT);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
const int kStretchHeight = 249; const int kStretchHeight = 249;
CRect rect; CRect rect;
@ -1556,7 +1556,7 @@ NibbleEditDialog::OnInitDialog(void)
*/ */
MySpinCtrl* pSpin; MySpinCtrl* pSpin;
pSpin = (MySpinCtrl*)GetDlgItem(IDC_DISKEDIT_TRACKSPIN); pSpin = (MySpinCtrl*)GetDlgItem(IDC_DISKEDIT_TRACKSPIN);
ASSERT(pSpin != nil); ASSERT(pSpin != NULL);
pSpin->SetRange32(0, fpDiskFS->GetDiskImg()->GetNumTracks()-1); pSpin->SetRange32(0, fpDiskFS->GetDiskImg()->GetNumTracks()-1);
pSpin->SetPos(0); pSpin->SetPos(0);
@ -1573,8 +1573,8 @@ int
NibbleEditDialog::LoadData(void) NibbleEditDialog::LoadData(void)
{ {
//WMSG0("BED LoadData\n"); //WMSG0("BED LoadData\n");
ASSERT(fpDiskFS != nil); ASSERT(fpDiskFS != NULL);
ASSERT(fpDiskFS->GetDiskImg() != nil); ASSERT(fpDiskFS->GetDiskImg() != NULL);
if (ReadSpinner(IDC_DISKEDIT_TRACKSPIN, &fTrack) != 0) if (ReadSpinner(IDC_DISKEDIT_TRACKSPIN, &fTrack) != 0)
return -1; return -1;
@ -1634,7 +1634,7 @@ NibbleEditDialog::OnReadPrev(void)
void void
NibbleEditDialog::OnReadNext(void) NibbleEditDialog::OnReadNext(void)
{ {
ASSERT(fpDiskFS != nil); ASSERT(fpDiskFS != NULL);
if (fTrack == fpDiskFS->GetDiskImg()->GetNumTracks() - 1) if (fTrack == fpDiskFS->GetDiskImg()->GetNumTracks() - 1)
return; return;

View File

@ -30,7 +30,7 @@ public:
CDialog(nIDTemplate, pParentWnd) CDialog(nIDTemplate, pParentWnd)
{ {
fReadOnly = true; fReadOnly = true;
fpDiskFS = nil; fpDiskFS = NULL;
fFileName = ""; fFileName = "";
fPositionShift = 0; fPositionShift = 0;
fFirstResize = true; fFirstResize = true;
@ -38,8 +38,8 @@ public:
virtual ~DiskEditDialog() {} virtual ~DiskEditDialog() {}
void Setup(DiskFS* pDiskFS, const WCHAR* fileName) { void Setup(DiskFS* pDiskFS, const WCHAR* fileName) {
ASSERT(pDiskFS != nil); ASSERT(pDiskFS != NULL);
ASSERT(fileName != nil); ASSERT(fileName != NULL);
fpDiskFS = pDiskFS; fpDiskFS = pDiskFS;
fFileName = fileName; fFileName = fileName;
} }

View File

@ -21,7 +21,7 @@ DiskEditOpenDialog::OnInitDialog(void)
{ {
if (!fArchiveOpen) { if (!fArchiveOpen) {
CButton* pButton = (CButton*) GetDlgItem(IDC_DEOW_CURRENT); CButton* pButton = (CButton*) GetDlgItem(IDC_DEOW_CURRENT);
ASSERT(pButton != nil); ASSERT(pButton != NULL);
pButton->EnableWindow(FALSE); pButton->EnableWindow(FALSE);
} }

View File

@ -18,8 +18,8 @@ using namespace DiskImgLib;
bool bool
DiskFSTree::BuildTree(DiskFS* pDiskFS, CTreeCtrl* pTree) DiskFSTree::BuildTree(DiskFS* pDiskFS, CTreeCtrl* pTree)
{ {
ASSERT(pDiskFS != nil); ASSERT(pDiskFS != NULL);
ASSERT(pTree != nil); ASSERT(pTree != NULL);
pTree->SetImageList(&fTreeImageList, TVSIL_NORMAL); pTree->SetImageList(&fTreeImageList, TVSIL_NORMAL);
return AddDiskFS(pTree, TVI_ROOT, pDiskFS, 1); return AddDiskFS(pTree, TVI_ROOT, pDiskFS, 1);
@ -49,7 +49,7 @@ DiskFSTree::AddDiskFS(CTreeCtrl* pTree, HTREEITEM parent,
pTarget = AllocTargetData(); pTarget = AllocTargetData();
pTarget->kind = kTargetDiskFS; pTarget->kind = kTargetDiskFS;
pTarget->pDiskFS = pDiskFS; pTarget->pDiskFS = pDiskFS;
pTarget->pFile = nil; // could also use volume dir for ProDOS pTarget->pFile = NULL; // could also use volume dir for ProDOS
tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM; tvi.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_PARAM;
// TODO(xyzzy): need storage for wide-char version // TODO(xyzzy): need storage for wide-char version
tvi.pszText = L"XYZZY-DiskFSTree1"; // pDiskFS->GetVolumeID(); tvi.pszText = L"XYZZY-DiskFSTree1"; // pDiskFS->GetVolumeID();
@ -69,7 +69,7 @@ DiskFSTree::AddDiskFS(CTreeCtrl* pTree, HTREEITEM parent,
tvins.hInsertAfter = parent; tvins.hInsertAfter = parent;
tvins.hParent = parent; tvins.hParent = parent;
hLocalRoot = pTree->InsertItem(&tvins); hLocalRoot = pTree->InsertItem(&tvins);
if (hLocalRoot == nil) { if (hLocalRoot == NULL) {
WMSG0("Tree root InsertItem failed\n"); WMSG0("Tree root InsertItem failed\n");
return false; return false;
} }
@ -77,8 +77,8 @@ DiskFSTree::AddDiskFS(CTreeCtrl* pTree, HTREEITEM parent,
/* /*
* Scan for and handle all sub-volumes. * Scan for and handle all sub-volumes.
*/ */
pSubVol = pDiskFS->GetNextSubVolume(nil); pSubVol = pDiskFS->GetNextSubVolume(NULL);
while (pSubVol != nil) { while (pSubVol != NULL) {
if (!AddDiskFS(pTree, hLocalRoot, pSubVol->GetDiskFS(), depth+1)) if (!AddDiskFS(pTree, hLocalRoot, pSubVol->GetDiskFS(), depth+1))
return false; return false;
@ -96,7 +96,7 @@ DiskFSTree::AddDiskFS(CTreeCtrl* pTree, HTREEITEM parent,
if (fIncludeSubdirs && pDiskFS->GetReadWriteSupported() && if (fIncludeSubdirs && pDiskFS->GetReadWriteSupported() &&
!pDiskFS->GetFSDamaged()) !pDiskFS->GetFSDamaged())
{ {
AddSubdir(pTree, hLocalRoot, pDiskFS, nil, depth); AddSubdir(pTree, hLocalRoot, pDiskFS, NULL, depth);
} }
/* /*
@ -121,7 +121,7 @@ DiskFSTree::AddDiskFS(CTreeCtrl* pTree, HTREEITEM parent,
* Add the subdir and all of the subdirectories of the current subdir. * Add the subdir and all of the subdirectories of the current subdir.
* *
* The files are held in a linear list in the DiskFS, so we have to * The files are held in a linear list in the DiskFS, so we have to
* reconstruct the hierarchy from the path names. Pass in nil for the * reconstruct the hierarchy from the path names. Pass in NULL for the
* root volume. * root volume.
* *
* Returns a pointer to the next A2File in the list (i.e. the first one * Returns a pointer to the next A2File in the list (i.e. the first one
@ -141,15 +141,15 @@ DiskFSTree::AddSubdir(CTreeCtrl* pTree, HTREEITEM parent,
TVINSERTSTRUCT tvins; TVINSERTSTRUCT tvins;
pFile = pDiskFS->GetNextFile(pParentFile); pFile = pDiskFS->GetNextFile(pParentFile);
if (pFile == nil && pParentFile == nil) { if (pFile == NULL && pParentFile == NULL) {
/* this can happen on an empty DOS 3.3 disk; under ProDOS, we always /* this can happen on an empty DOS 3.3 disk; under ProDOS, we always
have the volume entry */ have the volume entry */
/* note pFile will be nil if this happens to be a subdirectory /* note pFile will be NULL if this happens to be a subdirectory
positioned as the very last file on the disk */ positioned as the very last file on the disk */
return nil; return NULL;
} }
if (pParentFile == nil) { if (pParentFile == NULL) {
/* /*
* This is the root of the disk. We already have a DiskFS entry for * This is the root of the disk. We already have a DiskFS entry for
* it, so don't add a new tree item here. * it, so don't add a new tree item here.
@ -181,20 +181,20 @@ DiskFSTree::AddSubdir(CTreeCtrl* pTree, HTREEITEM parent,
tvins.hInsertAfter = parent; tvins.hInsertAfter = parent;
tvins.hParent = parent; tvins.hParent = parent;
hLocalRoot = pTree->InsertItem(&tvins); hLocalRoot = pTree->InsertItem(&tvins);
if (hLocalRoot == nil) { if (hLocalRoot == NULL) {
WMSG1("Tree insert '%ls' failed\n", tvi.pszText); WMSG1("Tree insert '%ls' failed\n", tvi.pszText);
return nil; return NULL;
} }
} }
while (pFile != nil) { while (pFile != NULL) {
if (pFile->IsDirectory()) { if (pFile->IsDirectory()) {
ASSERT(!pFile->IsVolumeDirectory()); ASSERT(!pFile->IsVolumeDirectory());
if (pFile->GetParent() == pParentFile) { if (pFile->GetParent() == pParentFile) {
/* this is a subdir of us */ /* this is a subdir of us */
pFile = AddSubdir(pTree, hLocalRoot, pDiskFS, pFile, depth+1); pFile = AddSubdir(pTree, hLocalRoot, pDiskFS, pFile, depth+1);
if (pFile == nil) if (pFile == NULL)
break; // out of while -- disk is done break; // out of while -- disk is done
} else { } else {
/* not one of our subdirs; pop up a level */ /* not one of our subdirs; pop up a level */
@ -221,8 +221,8 @@ DiskFSTree::AllocTargetData(void)
{ {
TargetData* pNew = new TargetData; TargetData* pNew = new TargetData;
if (pNew == nil) if (pNew == NULL)
return nil; return NULL;
memset(pNew, 0, sizeof(*pNew)); memset(pNew, 0, sizeof(*pNew));
/* insert it at the head of the list, and update the head pointer */ /* insert it at the head of the list, and update the head pointer */
@ -244,11 +244,11 @@ DiskFSTree::FreeAllTargetData(void)
TargetData* pNext; TargetData* pNext;
pTarget = fpTargetData; pTarget = fpTargetData;
while (pTarget != nil) { while (pTarget != NULL) {
pNext = pTarget->pNext; pNext = pTarget->pNext;
delete pTarget; delete pTarget;
pTarget = pNext; pTarget = pNext;
} }
fpTargetData = nil; fpTargetData = NULL;
} }

View File

@ -23,8 +23,8 @@ public:
fIncludeSubdirs = false; fIncludeSubdirs = false;
fExpandDepth = 0; fExpandDepth = 0;
fpDiskFS = nil; fpDiskFS = NULL;
fpTargetData = nil; fpTargetData = NULL;
LoadTreeImages(); LoadTreeImages();
} }
virtual ~DiskFSTree(void) { FreeAllTargetData(); } virtual ~DiskFSTree(void) { FreeAllTargetData(); }

View File

@ -32,7 +32,7 @@ EditAssocDialog::OnInitDialog(void)
{ {
CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_ASSOCIATION_LIST); CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_ASSOCIATION_LIST);
ASSERT(pListView != nil); ASSERT(pListView != NULL);
//pListView->ModifyStyleEx(0, LVS_EX_CHECKBOXES); //pListView->ModifyStyleEx(0, LVS_EX_CHECKBOXES);
ListView_SetExtendedListViewStyleEx(pListView->m_hWnd, ListView_SetExtendedListViewStyleEx(pListView->m_hWnd,
LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES); LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES);
@ -49,7 +49,7 @@ EditAssocDialog::OnInitDialog(void)
* Initialize this before DDX stuff happens. If the caller didn't * Initialize this before DDX stuff happens. If the caller didn't
* provide a set, load our own. * provide a set, load our own.
*/ */
if (fOurAssociations == nil) { if (fOurAssociations == NULL) {
fOurAssociations = new bool[gMyApp.fRegistry.GetNumFileAssocs()]; fOurAssociations = new bool[gMyApp.fRegistry.GetNumFileAssocs()];
Setup(true); Setup(true);
} else { } else {
@ -73,9 +73,9 @@ EditAssocDialog::Setup(bool loadAssoc)
WMSG0("Setup!\n"); WMSG0("Setup!\n");
CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_ASSOCIATION_LIST); CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_ASSOCIATION_LIST);
ASSERT(pListView != nil); ASSERT(pListView != NULL);
ASSERT(fOurAssociations != nil); ASSERT(fOurAssociations != NULL);
/* two columns */ /* two columns */
CRect rect; CRect rect;
@ -115,8 +115,8 @@ EditAssocDialog::DoDataExchange(CDataExchange* pDX)
{ {
CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_ASSOCIATION_LIST); CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_ASSOCIATION_LIST);
ASSERT(fOurAssociations != nil); ASSERT(fOurAssociations != NULL);
if (fOurAssociations == nil) if (fOurAssociations == NULL)
return; return;
int num = gMyApp.fRegistry.GetNumFileAssocs(); int num = gMyApp.fRegistry.GetNumFileAssocs();

View File

@ -16,9 +16,9 @@
*/ */
class EditAssocDialog : public CDialog { class EditAssocDialog : public CDialog {
public: public:
EditAssocDialog(CWnd* pParentWnd = nil) : EditAssocDialog(CWnd* pParentWnd = NULL) :
CDialog(IDD_ASSOCIATIONS, pParentWnd), CDialog(IDD_ASSOCIATIONS, pParentWnd),
fOurAssociations(nil) fOurAssociations(NULL)
{} {}
virtual ~EditAssocDialog() { virtual ~EditAssocDialog() {
delete[] fOurAssociations; delete[] fOurAssociations;

View File

@ -83,7 +83,7 @@ EditPropsDialog::OnInitDialog(void)
int comboIdx; int comboIdx;
pCombo = (CComboBox*) GetDlgItem(IDC_PROPS_FILETYPE); pCombo = (CComboBox*) GetDlgItem(IDC_PROPS_FILETYPE);
ASSERT(pCombo != nil); ASSERT(pCombo != NULL);
pCombo->InitStorage(256, 256 * 8); pCombo->InitStorage(256, 256 * 8);
@ -134,18 +134,18 @@ EditPropsDialog::OnInitDialog(void)
CString dateStr; CString dateStr;
pWnd = GetDlgItem(IDC_PROPS_CREATEWHEN); pWnd = GetDlgItem(IDC_PROPS_CREATEWHEN);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
FormatDate(fProps.createWhen, &dateStr); FormatDate(fProps.createWhen, &dateStr);
pWnd->SetWindowText(dateStr); pWnd->SetWindowText(dateStr);
pWnd = GetDlgItem(IDC_PROPS_MODWHEN); pWnd = GetDlgItem(IDC_PROPS_MODWHEN);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
FormatDate(fProps.modWhen, &dateStr); FormatDate(fProps.modWhen, &dateStr);
pWnd->SetWindowText(dateStr); pWnd->SetWindowText(dateStr);
//WMSG2("USING DATE '%ls' from 0x%08lx\n", dateStr, fProps.modWhen); //WMSG2("USING DATE '%ls' from 0x%08lx\n", dateStr, fProps.modWhen);
CEdit* pEdit = (CEdit*) GetDlgItem(IDC_PROPS_AUXTYPE); CEdit* pEdit = (CEdit*) GetDlgItem(IDC_PROPS_AUXTYPE);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
pEdit->SetLimitText(4); // max len of aux type str pEdit->SetLimitText(4); // max len of aux type str
pEdit = (CEdit*) GetDlgItem(IDC_PROPS_HFS_FILETYPE); pEdit = (CEdit*) GetDlgItem(IDC_PROPS_HFS_FILETYPE);
pEdit->SetLimitText(4); pEdit->SetLimitText(4);
@ -359,10 +359,10 @@ EditPropsDialog::OnTypeChange(void)
CWnd* pWnd; CWnd* pWnd;
int fileType, fileTypeIdx; int fileType, fileTypeIdx;
long auxType; long auxType;
const WCHAR* descr = nil; const WCHAR* descr = NULL;
pCombo = (CComboBox*) GetDlgItem(IDC_PROPS_FILETYPE); pCombo = (CComboBox*) GetDlgItem(IDC_PROPS_FILETYPE);
ASSERT(pCombo != nil); ASSERT(pCombo != NULL);
fileTypeIdx = pCombo->GetCurSel(); fileTypeIdx = pCombo->GetCurSel();
fileType = pCombo->GetItemData(fileTypeIdx); fileType = pCombo->GetItemData(fileTypeIdx);
@ -373,12 +373,12 @@ EditPropsDialog::OnTypeChange(void)
if (auxType < 0) if (auxType < 0)
auxType = 0; auxType = 0;
descr = PathProposal::FileTypeDescription(fileType, auxType); descr = PathProposal::FileTypeDescription(fileType, auxType);
if (descr == nil) if (descr == NULL)
descr = kUnknownFileType; descr = kUnknownFileType;
} }
pWnd = GetDlgItem(IDC_PROPS_TYPEDESCR); pWnd = GetDlgItem(IDC_PROPS_TYPEDESCR);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->SetWindowText(descr); pWnd->SetWindowText(descr);
/* DOS aux type only applies to BIN */ /* DOS aux type only applies to BIN */
@ -427,7 +427,7 @@ EditPropsDialog::UpdateHFSMode(void)
pWnd->EnableWindow(FALSE); pWnd->EnableWindow(FALSE);
pWnd = GetDlgItem(IDC_PROPS_TYPEDESCR); pWnd = GetDlgItem(IDC_PROPS_TYPEDESCR);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->SetWindowText(L"(HFS type)"); pWnd->SetWindowText(L"(HFS type)");
OnHFSTypeChange(); OnHFSTypeChange();
} else { } else {
@ -483,7 +483,7 @@ long
EditPropsDialog::GetAuxType(void) EditPropsDialog::GetAuxType(void)
{ {
CWnd* pWnd = GetDlgItem(IDC_PROPS_AUXTYPE); CWnd* pWnd = GetDlgItem(IDC_PROPS_AUXTYPE);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
CString aux; CString aux;
pWnd->GetWindowText(aux); pWnd->GetWindowText(aux);

View File

@ -27,7 +27,7 @@ BOOL
EnterRegDialog::OnInitDialog(void) EnterRegDialog::OnInitDialog(void)
{ {
//CWnd* pWnd = GetDlgItem(IDOK); //CWnd* pWnd = GetDlgItem(IDOK);
//ASSERT(pWnd != nil); //ASSERT(pWnd != NULL);
//pWnd->EnableWindow(false); //pWnd->EnableWindow(false);
fMyEdit.ReplaceDlgCtrl(this, IDC_REGENTER_REG); fMyEdit.ReplaceDlgCtrl(this, IDC_REGENTER_REG);
@ -37,13 +37,13 @@ EnterRegDialog::OnInitDialog(void)
straight into the registry */ straight into the registry */
CEdit* pEdit; CEdit* pEdit;
pEdit = (CEdit*) GetDlgItem(IDC_REGENTER_USER); pEdit = (CEdit*) GetDlgItem(IDC_REGENTER_USER);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
pEdit->SetLimitText(120); pEdit->SetLimitText(120);
pEdit = (CEdit*) GetDlgItem(IDC_REGENTER_COMPANY); pEdit = (CEdit*) GetDlgItem(IDC_REGENTER_COMPANY);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
pEdit->SetLimitText(120); pEdit->SetLimitText(120);
pEdit = (CEdit*) GetDlgItem(IDC_REGENTER_REG); pEdit = (CEdit*) GetDlgItem(IDC_REGENTER_REG);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
pEdit->SetLimitText(40); pEdit->SetLimitText(40);
return CDialog::OnInitDialog(); return CDialog::OnInitDialog();
@ -102,28 +102,28 @@ EnterRegDialog::HandleEditChange(int editID, int crcID)
* Update the CRC for the modified control. * Update the CRC for the modified control.
*/ */
pEdit = (CEdit*) GetDlgItem(editID); pEdit = (CEdit*) GetDlgItem(editID);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
pEdit->GetWindowText(userStr); pEdit->GetWindowText(userStr);
unsigned short crc; unsigned short crc;
crc = gMyApp.fRegistry.ComputeStringCRC(userStr); crc = gMyApp.fRegistry.ComputeStringCRC(userStr);
userStr.Format("%04X", crc); userStr.Format("%04X", crc);
pWnd = GetDlgItem(crcID); pWnd = GetDlgItem(crcID);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->SetWindowText(userStr); pWnd->SetWindowText(userStr);
/* /*
* Update the OK button. * Update the OK button.
*/ */
pEdit = (CEdit*) GetDlgItem(IDC_REGENTER_USER); pEdit = (CEdit*) GetDlgItem(IDC_REGENTER_USER);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
pEdit->GetWindowText(userStr); pEdit->GetWindowText(userStr);
pEdit = (CEdit*) GetDlgItem(IDC_REGENTER_REG); pEdit = (CEdit*) GetDlgItem(IDC_REGENTER_REG);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
pEdit->GetWindowText(regStr); pEdit->GetWindowText(regStr);
pWnd = GetDlgItem(IDOK); pWnd = GetDlgItem(IDOK);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->EnableWindow(!userStr.IsEmpty() && !regStr.IsEmpty()); pWnd->EnableWindow(!userStr.IsEmpty() && !regStr.IsEmpty());
} }

View File

@ -19,7 +19,7 @@
*/ */
class EnterRegDialog : public CDialog { class EnterRegDialog : public CDialog {
public: public:
EnterRegDialog(CWnd* pParent = nil) : CDialog(IDD_REGISTRATION, pParent) EnterRegDialog(CWnd* pParent = NULL) : CDialog(IDD_REGISTRATION, pParent)
{ fDepth = 0; } { fDepth = 0; }
virtual ~EnterRegDialog(void) {} virtual ~EnterRegDialog(void) {}

View File

@ -39,7 +39,7 @@ ExtractOptionsDialog::OnInitDialog(void)
/* grab the radio button with the selection count */ /* grab the radio button with the selection count */
pWnd = GetDlgItem(IDC_EXT_SELECTED); pWnd = GetDlgItem(IDC_EXT_SELECTED);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
/* set the count string using a string table entry */ /* set the count string using a string table entry */
if (fSelectedCount == 1) { if (fSelectedCount == 1) {
@ -156,11 +156,11 @@ void
ExtractOptionsDialog::OnChangeTextConv(void) ExtractOptionsDialog::OnChangeTextConv(void)
{ {
CButton* pButton = (CButton*) GetDlgItem(IDC_EXT_CONVEOLNONE); CButton* pButton = (CButton*) GetDlgItem(IDC_EXT_CONVEOLNONE);
ASSERT(pButton != nil); ASSERT(pButton != NULL);
bool convDisabled = (pButton->GetCheck() == BST_CHECKED); bool convDisabled = (pButton->GetCheck() == BST_CHECKED);
CWnd* pWnd = GetDlgItem(IDC_EXT_CONVHIGHASCII); CWnd* pWnd = GetDlgItem(IDC_EXT_CONVHIGHASCII);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->EnableWindow(!convDisabled); pWnd->EnableWindow(!convDisabled);
} }
@ -176,7 +176,7 @@ ExtractOptionsDialog::OnChooseFolder(void)
/* get the currently-showing text from the edit field */ /* get the currently-showing text from the edit field */
pEditWnd = GetDlgItem(IDC_EXT_PATH); pEditWnd = GetDlgItem(IDC_EXT_PATH);
ASSERT(pEditWnd != nil); ASSERT(pEditWnd != NULL);
pEditWnd->GetWindowText(editPath); pEditWnd->GetWindowText(editPath);
chooseDir.SetPathName(editPath); chooseDir.SetPathName(editPath);

View File

@ -591,7 +591,7 @@ static const struct {
/* /*
* Find an entry in the type description table that matches both file type and * Find an entry in the type description table that matches both file type and
* aux type. If no match is found, nil is returned. * aux type. If no match is found, NULL is returned.
*/ */
/*static*/ const WCHAR* /*static*/ const WCHAR*
PathProposal::FileTypeDescription(long fileType, long auxType) PathProposal::FileTypeDescription(long fileType, long auxType)
@ -607,7 +607,7 @@ PathProposal::FileTypeDescription(long fileType, long auxType)
} }
} }
return nil; return NULL;
} }
@ -644,7 +644,7 @@ PathProposal::ArchiveToLocal(void)
*/ */
newBufLen = fStoredPathName.GetLength()*3 + kMaxPathGrowth +1; newBufLen = fStoredPathName.GetLength()*3 + kMaxPathGrowth +1;
pathBuf = fLocalPathName.GetBuffer(newBufLen); pathBuf = fLocalPathName.GetBuffer(newBufLen);
ASSERT(pathBuf != nil); ASSERT(pathBuf != NULL);
startp = fStoredPathName; startp = fStoredPathName;
dstp = pathBuf; dstp = pathBuf;
@ -654,17 +654,17 @@ PathProposal::ArchiveToLocal(void)
} }
/* normalize all directory components and the filename component */ /* normalize all directory components and the filename component */
while (startp != nil) { while (startp != NULL) {
endp = nil; endp = NULL;
if (fStoredFssep != '\0') if (fStoredFssep != '\0')
endp = wcschr(startp, fStoredFssep); endp = wcschr(startp, fStoredFssep);
if (endp != nil && endp == startp) { if (endp != NULL && endp == startp) {
/* zero-length subdir component */ /* zero-length subdir component */
WMSG1("WARNING: zero-length subdir component in '%ls'\n", startp); WMSG1("WARNING: zero-length subdir component in '%ls'\n", startp);
startp++; startp++;
continue; continue;
} }
if (endp != nil) { if (endp != NULL) {
/* normalize directory component */ /* normalize directory component */
NormalizeDirectoryName(startp, endp - startp, NormalizeDirectoryName(startp, endp - startp,
fStoredFssep, &dstp, newBufLen); fStoredFssep, &dstp, newBufLen);
@ -692,7 +692,7 @@ PathProposal::ArchiveToLocal(void)
ASSERT(wcslen(extBuf) <= kMaxPathGrowth); ASSERT(wcslen(extBuf) <= kMaxPathGrowth);
wcscat(pathBuf, extBuf); wcscat(pathBuf, extBuf);
startp = nil; /* we're done, break out of loop */ startp = NULL; /* we're done, break out of loop */
} }
} }
@ -705,7 +705,7 @@ PathProposal::ArchiveToLocal(void)
if (fJunkPaths) { if (fJunkPaths) {
WCHAR* lastFssep; WCHAR* lastFssep;
lastFssep = wcsrchr(pathBuf, fLocalFssep); lastFssep = wcsrchr(pathBuf, fLocalFssep);
if (lastFssep != nil) { if (lastFssep != NULL) {
ASSERT(*(lastFssep+1) != '\0'); /* should already have been caught*/ ASSERT(*(lastFssep+1) != '\0'); /* should already have been caught*/
memmove(pathBuf, lastFssep+1, memmove(pathBuf, lastFssep+1,
(wcslen(lastFssep+1)+1) * sizeof(WCHAR)); (wcslen(lastFssep+1)+1) * sizeof(WCHAR));
@ -728,12 +728,12 @@ PathProposal::ArchiveToLocal(void)
* that the name is just "aux", or it could be "aux.this.txt". * that the name is just "aux", or it could be "aux.this.txt".
*/ */
static const WCHAR* gFatReservedNames3[] = { static const WCHAR* gFatReservedNames3[] = {
L"CON", L"PRN", L"NUL", L"AUX", nil L"CON", L"PRN", L"NUL", L"AUX", NULL
}; };
static const WCHAR* gFatReservedNames4[] = { static const WCHAR* gFatReservedNames4[] = {
L"LPT1", L"LPT2", L"LPT3", L"LPT4", L"LPT5", L"LPT6", L"LPT7", L"LPT8", L"LPT9", L"LPT1", L"LPT2", L"LPT3", L"LPT4", L"LPT5", L"LPT6", L"LPT7", L"LPT8", L"LPT9",
L"COM1", L"COM2", L"COM3", L"COM4", L"COM5", L"COM6", L"COM7", L"COM8", L"COM9", L"COM1", L"COM2", L"COM3", L"COM4", L"COM5", L"COM6", L"COM7", L"COM8", L"COM9",
nil NULL
}; };
/* /*
@ -755,7 +755,7 @@ PathProposal::Win32NormalizeFileName(const WCHAR* srcp, long srcLen,
if (srcLen >= 3) { if (srcLen >= 3) {
const WCHAR** ppcch; const WCHAR** ppcch;
for (ppcch = gFatReservedNames3; *ppcch != nil; ppcch++) { for (ppcch = gFatReservedNames3; *ppcch != NULL; ppcch++) {
if (wcsnicmp(srcp, *ppcch, 3) == 0 && if (wcsnicmp(srcp, *ppcch, 3) == 0 &&
(srcp[3] == '.' || srcLen == 3)) (srcp[3] == '.' || srcLen == 3))
{ {
@ -773,7 +773,7 @@ PathProposal::Win32NormalizeFileName(const WCHAR* srcp, long srcLen,
if (srcLen >= 4) { if (srcLen >= 4) {
const WCHAR** ppcch; const WCHAR** ppcch;
for (ppcch = gFatReservedNames4; *ppcch != nil; ppcch++) { for (ppcch = gFatReservedNames4; *ppcch != NULL; ppcch++) {
if (wcsnicmp(srcp, *ppcch, 4) == 0 && if (wcsnicmp(srcp, *ppcch, 4) == 0 &&
(srcp[4] == '.' || srcLen == 4)) (srcp[4] == '.' || srcLen == 4))
{ {
@ -798,7 +798,7 @@ PathProposal::Win32NormalizeFileName(const WCHAR* srcp, long srcLen,
if (fPreservation) if (fPreservation)
*dstp++ = *srcp; *dstp++ = *srcp;
*dstp++ = *srcp++; *dstp++ = *srcp++;
} else if (wcschr(kInvalid, *srcp) != nil || } else if (wcschr(kInvalid, *srcp) != NULL ||
*srcp < 0x20 || *srcp >= 0x7f) *srcp < 0x20 || *srcp >= 0x7f)
{ {
/* change invalid char to "%2f" or '_' */ /* change invalid char to "%2f" or '_' */
@ -837,11 +837,11 @@ void
PathProposal::NormalizeFileName(const WCHAR* srcp, long srcLen, PathProposal::NormalizeFileName(const WCHAR* srcp, long srcLen,
char fssep, WCHAR** pDstp, long dstLen) char fssep, WCHAR** pDstp, long dstLen)
{ {
ASSERT(srcp != nil); ASSERT(srcp != NULL);
ASSERT(srcLen > 0); ASSERT(srcLen > 0);
ASSERT(dstLen > srcLen); ASSERT(dstLen > srcLen);
ASSERT(pDstp != nil); ASSERT(pDstp != NULL);
ASSERT(*pDstp != nil); ASSERT(*pDstp != NULL);
#if defined(UNIX_LIKE) #if defined(UNIX_LIKE)
UNIXNormalizeFileName(srcp, srcLen, fssep, pDstp, dstLen); UNIXNormalizeFileName(srcp, srcLen, fssep, pDstp, dstLen);
@ -877,8 +877,8 @@ PathProposal::AddPreservationString(const WCHAR* pathBuf, WCHAR* extBuf)
{ {
WCHAR* cp; WCHAR* cp;
ASSERT(pathBuf != nil); ASSERT(pathBuf != NULL);
ASSERT(extBuf != nil); ASSERT(extBuf != NULL);
ASSERT(fPreservation); ASSERT(fPreservation);
cp = extBuf + wcslen(extBuf); cp = extBuf + wcslen(extBuf);
@ -914,9 +914,9 @@ PathProposal::AddPreservationString(const WCHAR* pathBuf, WCHAR* extBuf)
void void
PathProposal::AddTypeExtension(const WCHAR* pathBuf, WCHAR* extBuf) PathProposal::AddTypeExtension(const WCHAR* pathBuf, WCHAR* extBuf)
{ {
const WCHAR* pPathExt = nil; const WCHAR* pPathExt = NULL;
const WCHAR* pWantedExt = nil; const WCHAR* pWantedExt = NULL;
const WCHAR* pTypeExt = nil; const WCHAR* pTypeExt = NULL;
WCHAR* end; WCHAR* end;
WCHAR* cp; WCHAR* cp;
@ -927,7 +927,7 @@ PathProposal::AddTypeExtension(const WCHAR* pathBuf, WCHAR* extBuf)
* Note FindExtension guarantees there's at least one char after '.'. * Note FindExtension guarantees there's at least one char after '.'.
*/ */
pPathExt = PathName::FindExtension(pathBuf, fLocalFssep); pPathExt = PathName::FindExtension(pathBuf, fLocalFssep);
if (pPathExt == nil) { if (pPathExt == NULL) {
/* /*
* There's no extension on the filename. Use the standard * There's no extension on the filename. Use the standard
* ProDOS type, if one exists for this entry. We don't use * ProDOS type, if one exists for this entry. We don't use
@ -936,7 +936,7 @@ PathProposal::AddTypeExtension(const WCHAR* pathBuf, WCHAR* extBuf)
if (fFileType) { if (fFileType) {
pTypeExt = FileTypeString(fFileType); pTypeExt = FileTypeString(fFileType);
if (pTypeExt[0] == '?' || pTypeExt[0] == '$') if (pTypeExt[0] == '?' || pTypeExt[0] == '$')
pTypeExt = nil; pTypeExt = NULL;
} }
} else { } else {
pPathExt++; // skip leading '.' pPathExt++; // skip leading '.'
@ -957,37 +957,37 @@ PathProposal::AddTypeExtension(const WCHAR* pathBuf, WCHAR* extBuf)
* We want to use the extension currently on the file, if it has one. * We want to use the extension currently on the file, if it has one.
* If not, use the one from the file type. * If not, use the one from the file type.
*/ */
if (pPathExt != nil) { if (pPathExt != NULL) {
pWantedExt = pPathExt; pWantedExt = pPathExt;
} else { } else {
pWantedExt = pTypeExt; pWantedExt = pTypeExt;
} }
} }
/* pWantedExt != nil unless we failed to find a pTypeExt */ /* pWantedExt != NULL unless we failed to find a pTypeExt */
/* /*
* Now we know which one we want. Figure out if we want to add it. * Now we know which one we want. Figure out if we want to add it.
*/ */
if (pWantedExt != nil) { if (pWantedExt != NULL) {
if (extBuf[0] == '\0' && pPathExt != nil && if (extBuf[0] == '\0' && pPathExt != NULL &&
wcsicmp(pPathExt, pWantedExt) == 0) wcsicmp(pPathExt, pWantedExt) == 0)
{ {
/* don't add an extension that's already there */ /* don't add an extension that's already there */
pWantedExt = nil; pWantedExt = NULL;
goto know_ext; goto know_ext;
} }
if (wcslen(pWantedExt) >= kMaxExtLen) { if (wcslen(pWantedExt) >= kMaxExtLen) {
/* too long, forget it */ /* too long, forget it */
pWantedExt = nil; pWantedExt = NULL;
goto know_ext; goto know_ext;
} }
/* if it's strictly decimal-numeric, don't use it (.1, .2, etc) */ /* if it's strictly decimal-numeric, don't use it (.1, .2, etc) */
(void) wcstoul(pWantedExt, &end, 10); (void) wcstoul(pWantedExt, &end, 10);
if (*end == '\0') { if (*end == '\0') {
pWantedExt = nil; pWantedExt = NULL;
goto know_ext; goto know_ext;
} }
@ -996,7 +996,7 @@ PathProposal::AddTypeExtension(const WCHAR* pathBuf, WCHAR* extBuf)
const WCHAR* ccp = pWantedExt; const WCHAR* ccp = pWantedExt;
while (*ccp != '\0') { while (*ccp != '\0') {
if (*ccp == kPreserveIndic) { if (*ccp == kPreserveIndic) {
pWantedExt = nil; pWantedExt = NULL;
goto know_ext; goto know_ext;
} }
ccp++; ccp++;
@ -1005,10 +1005,10 @@ PathProposal::AddTypeExtension(const WCHAR* pathBuf, WCHAR* extBuf)
know_ext: know_ext:
/* /*
* If pWantedExt is non-nil, it points to a filename extension without * If pWantedExt is non-NULL, it points to a filename extension without
* the leading '.'. * the leading '.'.
*/ */
if (pWantedExt != nil) { if (pWantedExt != NULL) {
*cp++ = kFilenameExtDelim; *cp++ = kFilenameExtDelim;
wcscpy(cp, pWantedExt); wcscpy(cp, pWantedExt);
//cp += strlen(pWantedExt); //cp += strlen(pWantedExt);
@ -1132,7 +1132,7 @@ PathProposal::LocalToArchive(const AddFilesDialog* pAddOpts)
slashDotDotSlash[0] = kLocalFssep; slashDotDotSlash[0] = kLocalFssep;
slashDotDotSlash[3] = kLocalFssep; slashDotDotSlash[3] = kLocalFssep;
if ((livePathStr[0] == '.' && livePathStr[1] == '.') || if ((livePathStr[0] == '.' && livePathStr[1] == '.') ||
(wcsstr(livePathStr, slashDotDotSlash) != nil)) (wcsstr(livePathStr, slashDotDotSlash) != NULL))
{ {
WMSG1("Found dot dot in '%ls', keeping only filename\n", livePathStr); WMSG1("Found dot dot in '%ls', keeping only filename\n", livePathStr);
doJunk = true; doJunk = true;
@ -1151,7 +1151,7 @@ PathProposal::LocalToArchive(const AddFilesDialog* pAddOpts)
if (pAddOpts->fStripFolderNames || doJunk) { if (pAddOpts->fStripFolderNames || doJunk) {
WCHAR* lastFssep; WCHAR* lastFssep;
lastFssep = wcsrchr(livePathStr, kLocalFssep); lastFssep = wcsrchr(livePathStr, kLocalFssep);
if (lastFssep != nil) { if (lastFssep != NULL) {
ASSERT(*(lastFssep+1) != '\0'); /* should already have been caught*/ ASSERT(*(lastFssep+1) != '\0'); /* should already have been caught*/
memmove(livePathStr, lastFssep+1, memmove(livePathStr, lastFssep+1,
(wcslen(lastFssep+1)+1) * sizeof(WCHAR)); (wcslen(lastFssep+1)+1) * sizeof(WCHAR));
@ -1250,10 +1250,10 @@ PathProposal::InterpretExtension(const WCHAR* pathName)
{ {
const WCHAR* pExt; const WCHAR* pExt;
ASSERT(pathName != nil); ASSERT(pathName != NULL);
pExt = PathName::FindExtension(pathName, fLocalFssep); pExt = PathName::FindExtension(pathName, fLocalFssep);
if (pExt != nil) if (pExt != NULL)
LookupExtension(pExt+1); LookupExtension(pExt+1);
} }
@ -1276,10 +1276,10 @@ PathProposal::ExtractPreservationString(WCHAR* pathname)
WCHAR* cp; WCHAR* cp;
int digitCount; int digitCount;
ASSERT(pathname != nil); ASSERT(pathname != NULL);
pPreserve = wcsrchr(pathname, kPreserveIndic); pPreserve = wcsrchr(pathname, kPreserveIndic);
if (pPreserve == nil) if (pPreserve == NULL)
return false; return false;
/* count up the #of hex digits */ /* count up the #of hex digits */
@ -1418,7 +1418,7 @@ PathProposal::StripDiskImageSuffix(WCHAR* pathName)
int i; int i;
pExt = PathName::FindExtension(pathName, fLocalFssep); pExt = PathName::FindExtension(pathName, fLocalFssep);
if (pExt == nil || pExt == pathName) if (pExt == NULL || pExt == pathName)
return; return;
for (i = 0; i < NELEM(diskExt); i++) { for (i = 0; i < NELEM(diskExt); i++) {

View File

@ -50,11 +50,11 @@
*/ */
GenericEntry::GenericEntry(void) GenericEntry::GenericEntry(void)
{ {
fPathName = nil; fPathName = NULL;
fFileName = nil; fFileName = NULL;
fFssep = '\0'; fFssep = '\0';
fSubVolName = nil; fSubVolName = NULL;
fDisplayName = nil; fDisplayName = NULL;
fFileType = 0; fFileType = 0;
fAuxType = 0; fAuxType = 0;
fAccess = 0; fAccess = 0;
@ -75,8 +75,8 @@ GenericEntry::GenericEntry(void)
fHasNonEmptyComment = false; fHasNonEmptyComment = false;
fIndex = -1; fIndex = -1;
fpPrev = nil; fpPrev = NULL;
fpNext = nil; fpNext = NULL;
fDamaged = fSuspicious = false; fDamaged = fSuspicious = false;
} }
@ -97,15 +97,15 @@ GenericEntry::~GenericEntry(void)
void void
GenericEntry::SetPathName(const WCHAR* path) GenericEntry::SetPathName(const WCHAR* path)
{ {
ASSERT(path != nil && wcslen(path) > 0); ASSERT(path != NULL && wcslen(path) > 0);
if (fPathName != nil) if (fPathName != NULL)
delete fPathName; delete fPathName;
fPathName = wcsdup(path); fPathName = wcsdup(path);
// nuke the derived fields // nuke the derived fields
fFileName = nil; fFileName = NULL;
fFileNameExtension = nil; fFileNameExtension = NULL;
delete[] fDisplayName; delete[] fDisplayName;
fDisplayName = nil; fDisplayName = NULL;
/* /*
* Warning: to be 100% pedantically correct here, we should NOT do this * Warning: to be 100% pedantically correct here, we should NOT do this
@ -120,16 +120,16 @@ GenericEntry::SetPathName(const WCHAR* path)
const WCHAR* const WCHAR*
GenericEntry::GetFileName(void) GenericEntry::GetFileName(void)
{ {
ASSERT(fPathName != nil); ASSERT(fPathName != NULL);
if (fFileName == nil) if (fFileName == NULL)
fFileName = PathName::FilenameOnly(fPathName, fFssep); fFileName = PathName::FilenameOnly(fPathName, fFssep);
return fFileName; return fFileName;
} }
const WCHAR* const WCHAR*
GenericEntry::GetFileNameExtension(void) GenericEntry::GetFileNameExtension(void)
{ {
ASSERT(fPathName != nil); ASSERT(fPathName != NULL);
if (fFileNameExtension == nil) if (fFileNameExtension == NULL)
fFileNameExtension = PathName::FindExtension(fPathName, fFssep); fFileNameExtension = PathName::FindExtension(fPathName, fFssep);
return fFileNameExtension; return fFileNameExtension;
} }
@ -142,26 +142,26 @@ void
GenericEntry::SetSubVolName(const WCHAR* name) GenericEntry::SetSubVolName(const WCHAR* name)
{ {
delete[] fSubVolName; delete[] fSubVolName;
fSubVolName = nil; fSubVolName = NULL;
if (name != nil) { if (name != NULL) {
fSubVolName = wcsdup(name); fSubVolName = wcsdup(name);
} }
} }
const WCHAR* const WCHAR*
GenericEntry::GetDisplayName(void) const GenericEntry::GetDisplayName(void) const
{ {
ASSERT(fPathName != nil); ASSERT(fPathName != NULL);
if (fDisplayName != nil) if (fDisplayName != NULL)
return fDisplayName; return fDisplayName;
// TODO: hmm... // TODO: hmm...
GenericEntry* pThis = const_cast<GenericEntry*>(this); GenericEntry* pThis = const_cast<GenericEntry*>(this);
int len = wcslen(fPathName) +1; int len = wcslen(fPathName) +1;
if (fSubVolName != nil) if (fSubVolName != NULL)
len += wcslen(fSubVolName) +1; len += wcslen(fSubVolName) +1;
pThis->fDisplayName = new WCHAR[len]; pThis->fDisplayName = new WCHAR[len];
if (fSubVolName != nil) { if (fSubVolName != NULL) {
WCHAR xtra[2] = { DiskFS::kDIFssep, '\0' }; WCHAR xtra[2] = { DiskFS::kDIFssep, '\0' };
wcscpy(pThis->fDisplayName, fSubVolName); wcscpy(pThis->fDisplayName, fSubVolName);
wcscat(pThis->fDisplayName, xtra); wcscat(pThis->fDisplayName, xtra);
@ -214,7 +214,7 @@ GenericEntry::CheckHighASCII(const unsigned char* buffer,
{ {
bool isHighASCII; bool isHighASCII;
ASSERT(buffer != nil); ASSERT(buffer != NULL);
ASSERT(count != 0); ASSERT(count != 0);
isHighASCII = true; isHighASCII = true;
@ -492,27 +492,27 @@ GenericEntry::WriteConvert(FILE* fp, const char* buf, size_t len,
void void
GenericArchive::AddEntry(GenericEntry* pEntry) GenericArchive::AddEntry(GenericEntry* pEntry)
{ {
if (fEntryHead == nil) { if (fEntryHead == NULL) {
ASSERT(fEntryTail == nil); ASSERT(fEntryTail == NULL);
fEntryHead = pEntry; fEntryHead = pEntry;
fEntryTail = pEntry; fEntryTail = pEntry;
ASSERT(pEntry->GetPrev() == nil); ASSERT(pEntry->GetPrev() == NULL);
ASSERT(pEntry->GetNext() == nil); ASSERT(pEntry->GetNext() == NULL);
} else { } else {
ASSERT(fEntryTail != nil); ASSERT(fEntryTail != NULL);
ASSERT(pEntry->GetPrev() == nil); ASSERT(pEntry->GetPrev() == NULL);
pEntry->SetPrev(fEntryTail); pEntry->SetPrev(fEntryTail);
ASSERT(fEntryTail->GetNext() == nil); ASSERT(fEntryTail->GetNext() == NULL);
fEntryTail->SetNext(pEntry); fEntryTail->SetNext(pEntry);
fEntryTail = pEntry; fEntryTail = pEntry;
} }
fNumEntries++; fNumEntries++;
//if (fEntryIndex != nil) { //if (fEntryIndex != NULL) {
// WMSG0("Resetting fEntryIndex\n"); // WMSG0("Resetting fEntryIndex\n");
// delete [] fEntryIndex; // delete [] fEntryIndex;
// fEntryIndex = nil; // fEntryIndex = NULL;
//} //}
} }
@ -528,7 +528,7 @@ GenericArchive::DeleteEntries(void)
WMSG1("Deleting %d archive entries\n", fNumEntries); WMSG1("Deleting %d archive entries\n", fNumEntries);
pEntry = GetEntries(); pEntry = GetEntries();
while (pEntry != nil) { while (pEntry != NULL) {
pNext = pEntry->GetNext(); pNext = pEntry->GetNext();
delete pEntry; delete pEntry;
pEntry = pNext; pEntry = pNext;
@ -536,7 +536,7 @@ GenericArchive::DeleteEntries(void)
//delete [] fEntryIndex; //delete [] fEntryIndex;
fNumEntries = 0; fNumEntries = 0;
fEntryHead = fEntryTail = nil; fEntryHead = fEntryTail = NULL;
} }
#if 0 #if 0
@ -554,12 +554,12 @@ GenericArchive::CreateIndex(void)
ASSERT(fNumEntries != 0); ASSERT(fNumEntries != 0);
fEntryIndex = new GenericEntry*[fNumEntries]; fEntryIndex = new GenericEntry*[fNumEntries];
if (fEntryIndex == nil) if (fEntryIndex == NULL)
return; return;
pEntry = GetEntries(); pEntry = GetEntries();
num = 0; num = 0;
while (pEntry != nil) { while (pEntry != NULL) {
fEntryIndex[num] = pEntry; fEntryIndex[num] = pEntry;
pEntry = pEntry->GetNext(); pEntry = pEntry->GetNext();
num++; num++;
@ -585,7 +585,7 @@ GenericArchive::GenDerivedTempName(const WCHAR* filename)
CString mangle(filename); CString mangle(filename);
int idx, len; int idx, len;
ASSERT(filename != nil); ASSERT(filename != NULL);
len = mangle.GetLength(); len = mangle.GetLength();
ASSERT(len > 0); ASSERT(len > 0);
@ -676,11 +676,11 @@ GenericArchive::UNIXTimeToDateTime(const time_t* pWhen, NuDateTime* pDateTime)
{ {
struct tm* ptm; struct tm* ptm;
ASSERT(pWhen != nil); ASSERT(pWhen != NULL);
ASSERT(pDateTime != nil); ASSERT(pDateTime != NULL);
ptm = localtime(pWhen); ptm = localtime(pWhen);
if (ptm == nil) { if (ptm == NULL) {
ASSERT(*pWhen == kDateNone || *pWhen == kDateInvalid); ASSERT(*pWhen == kDateNone || *pWhen == kDateInvalid);
memset(pDateTime, 0, sizeof(*pDateTime)); memset(pDateTime, 0, sizeof(*pDateTime));
return; return;
@ -710,9 +710,9 @@ GenericArchive::GetFileDetails(const AddFilesDialog* pAddOpts,
//char* livePathStr; //char* livePathStr;
time_t now; time_t now;
ASSERT(pAddOpts != nil); ASSERT(pAddOpts != NULL);
ASSERT(pathname != nil); ASSERT(pathname != NULL);
ASSERT(pDetails != nil); ASSERT(pDetails != NULL);
/* init to defaults */ /* init to defaults */
//pDetails->threadID = kNuThreadIDDataFork; //pDetails->threadID = kNuThreadIDDataFork;
@ -744,7 +744,7 @@ GenericArchive::GetFileDetails(const AddFilesDialog* pAddOpts,
} }
#endif #endif
now = time(nil); now = time(NULL);
UNIXTimeToDateTime(&now, &pDetails->archiveWhen); UNIXTimeToDateTime(&now, &pDetails->archiveWhen);
UNIXTimeToDateTime(&psb->st_mtime, &pDetails->modWhen); UNIXTimeToDateTime(&psb->st_mtime, &pDetails->modWhen);
UNIXTimeToDateTime(&psb->st_ctime, &pDetails->createWhen); UNIXTimeToDateTime(&psb->st_ctime, &pDetails->createWhen);
@ -817,14 +817,14 @@ static const WCHAR kWildMatchAll[] = L"*.*";
Win32dirent* Win32dirent*
GenericArchive::OpenDir(const WCHAR* name) GenericArchive::OpenDir(const WCHAR* name)
{ {
Win32dirent* dir = nil; Win32dirent* dir = NULL;
WCHAR* tmpStr = nil; WCHAR* tmpStr = NULL;
WCHAR* cp; WCHAR* cp;
WIN32_FIND_DATA fnd; WIN32_FIND_DATA fnd;
dir = (Win32dirent*) malloc(sizeof(*dir)); dir = (Win32dirent*) malloc(sizeof(*dir));
tmpStr = (WCHAR*) malloc((wcslen(name) + 2 + wcslen(kWildMatchAll)) * sizeof(WCHAR)); tmpStr = (WCHAR*) malloc((wcslen(name) + 2 + wcslen(kWildMatchAll)) * sizeof(WCHAR));
if (dir == nil || tmpStr == nil) if (dir == NULL || tmpStr == NULL)
goto failed; goto failed;
wcscpy(tmpStr, name); wcscpy(tmpStr, name);
@ -854,14 +854,14 @@ bail:
failed: failed:
free(dir); free(dir);
dir = nil; dir = NULL;
goto bail; goto bail;
} }
/* /*
* Get an entry from an open directory. * Get an entry from an open directory.
* *
* Returns a nil pointer after the last entry has been read. * Returns a NULL pointer after the last entry has been read.
*/ */
Win32dirent* Win32dirent*
GenericArchive::ReadDir(Win32dirent* dir) GenericArchive::ReadDir(Win32dirent* dir)
@ -872,7 +872,7 @@ GenericArchive::ReadDir(Win32dirent* dir)
WIN32_FIND_DATA fnd; WIN32_FIND_DATA fnd;
if (!FindNextFile(dir->d_hFindFile, &fnd)) if (!FindNextFile(dir->d_hFindFile, &fnd))
return nil; return NULL;
wcscpy(dir->d_name, fnd.cFileName); wcscpy(dir->d_name, fnd.cFileName);
dir->d_attr = (unsigned char) fnd.dwFileAttributes; dir->d_attr = (unsigned char) fnd.dwFileAttributes;
} }
@ -886,7 +886,7 @@ GenericArchive::ReadDir(Win32dirent* dir)
void void
GenericArchive::CloseDir(Win32dirent* dir) GenericArchive::CloseDir(Win32dirent* dir)
{ {
if (dir == nil) if (dir == NULL)
return; return;
FindClose(dir->d_hFindFile); FindClose(dir->d_hFindFile);
@ -903,19 +903,19 @@ GenericArchive::Win32AddDirectory(const AddFilesDialog* pAddOpts,
const WCHAR* dirName, CString* pErrMsg) const WCHAR* dirName, CString* pErrMsg)
{ {
NuError err = kNuErrNone; NuError err = kNuErrNone;
Win32dirent* dirp = nil; Win32dirent* dirp = NULL;
Win32dirent* entry; Win32dirent* entry;
WCHAR nbuf[MAX_PATH]; /* malloc might be better; this soaks stack */ WCHAR nbuf[MAX_PATH]; /* malloc might be better; this soaks stack */
char fssep; char fssep;
int len; int len;
ASSERT(pAddOpts != nil); ASSERT(pAddOpts != NULL);
ASSERT(dirName != nil); ASSERT(dirName != NULL);
WMSG1("+++ DESCEND: '%ls'\n", dirName); WMSG1("+++ DESCEND: '%ls'\n", dirName);
dirp = OpenDir(dirName); dirp = OpenDir(dirName);
if (dirp == nil) { if (dirp == NULL) {
if (errno == ENOTDIR) if (errno == ENOTDIR)
err = kNuErrNotDir; err = kNuErrNotDir;
else else
@ -928,7 +928,7 @@ GenericArchive::Win32AddDirectory(const AddFilesDialog* pAddOpts,
fssep = PathProposal::kLocalFssep; fssep = PathProposal::kLocalFssep;
/* could use readdir_r, but we don't care about reentrancy here */ /* could use readdir_r, but we don't care about reentrancy here */
while ((entry = ReadDir(dirp)) != nil) { while ((entry = ReadDir(dirp)) != NULL) {
/* skip the dotsies */ /* skip the dotsies */
if (wcscmp(entry->d_name, L".") == 0 || if (wcscmp(entry->d_name, L".") == 0 ||
wcscmp(entry->d_name, L"..") == 0) wcscmp(entry->d_name, L"..") == 0)
@ -956,7 +956,7 @@ GenericArchive::Win32AddDirectory(const AddFilesDialog* pAddOpts,
} }
bail: bail:
if (dirp != nil) if (dirp != NULL)
(void)CloseDir(dirp); (void)CloseDir(dirp);
return err; return err;
} }
@ -977,8 +977,8 @@ GenericArchive::Win32AddFile(const AddFilesDialog* pAddOpts,
FileDetails details; FileDetails details;
struct _stat sb; struct _stat sb;
ASSERT(pAddOpts != nil); ASSERT(pAddOpts != NULL);
ASSERT(pathname != nil); ASSERT(pathname != NULL);
PathName checkPath(pathname); PathName checkPath(pathname);
int ierr = checkPath.CheckFileStatus(&sb, &exists, &isReadable, &isDir); int ierr = checkPath.CheckFileStatus(&sb, &exists, &isReadable, &isDir);
@ -1041,7 +1041,7 @@ bail:
* *
* [ I figure the GS/OS version will want to pass a copy of the file * [ I figure the GS/OS version will want to pass a copy of the file
* info from the GSOSAddDirectory function back into GSOSAddFile, so we'd * info from the GSOSAddDirectory function back into GSOSAddFile, so we'd
* want to call it from here with a nil pointer indicating that we * want to call it from here with a NULL pointer indicating that we
* don't yet have the file info. That way we can get the file info * don't yet have the file info. That way we can get the file info
* from the directory read call and won't have to check it again in * from the directory read call and won't have to check it again in
* GSOSAddFile. ] * GSOSAddFile. ]
@ -1200,10 +1200,10 @@ SelectionSet::CreateFromSelection(ContentList* pContentList, int threadMask)
POSITION posn; POSITION posn;
posn = pContentList->GetFirstSelectedItemPosition(); posn = pContentList->GetFirstSelectedItemPosition();
ASSERT(posn != nil); ASSERT(posn != NULL);
if (posn == nil) if (posn == NULL)
return; return;
while (posn != nil) { while (posn != NULL) {
int num = pContentList->GetNextSelectedItem(/*ref*/ posn); int num = pContentList->GetNextSelectedItem(/*ref*/ posn);
GenericEntry* pEntry = (GenericEntry*) pContentList->GetItemData(num); GenericEntry* pEntry = (GenericEntry*) pContentList->GetItemData(num);
@ -1286,17 +1286,17 @@ SelectionSet::AddToSet(GenericEntry* pEntry, int threadMask)
void void
SelectionSet::AddEntry(SelectionEntry* pEntry) SelectionSet::AddEntry(SelectionEntry* pEntry)
{ {
if (fEntryHead == nil) { if (fEntryHead == NULL) {
ASSERT(fEntryTail == nil); ASSERT(fEntryTail == NULL);
fEntryHead = pEntry; fEntryHead = pEntry;
fEntryTail = pEntry; fEntryTail = pEntry;
ASSERT(pEntry->GetPrev() == nil); ASSERT(pEntry->GetPrev() == NULL);
ASSERT(pEntry->GetNext() == nil); ASSERT(pEntry->GetNext() == NULL);
} else { } else {
ASSERT(fEntryTail != nil); ASSERT(fEntryTail != NULL);
ASSERT(pEntry->GetPrev() == nil); ASSERT(pEntry->GetPrev() == NULL);
pEntry->SetPrev(fEntryTail); pEntry->SetPrev(fEntryTail);
ASSERT(fEntryTail->GetNext() == nil); ASSERT(fEntryTail->GetNext() == NULL);
fEntryTail->SetNext(pEntry); fEntryTail->SetNext(pEntry);
fEntryTail = pEntry; fEntryTail = pEntry;
} }
@ -1316,7 +1316,7 @@ SelectionSet::DeleteEntries(void)
WMSG0("Deleting selection entries\n"); WMSG0("Deleting selection entries\n");
pEntry = GetEntries(); pEntry = GetEntries();
while (pEntry != nil) { while (pEntry != NULL) {
pNext = pEntry->GetNext(); pNext = pEntry->GetNext();
delete pEntry; delete pEntry;
pEntry = pNext; pEntry = pNext;
@ -1335,7 +1335,7 @@ SelectionSet::CountMatchingPrefix(const WCHAR* prefix)
ASSERT(len > 0); ASSERT(len > 0);
pEntry = GetEntries(); pEntry = GetEntries();
while (pEntry != nil) { while (pEntry != NULL) {
GenericEntry* pGeneric = pEntry->GetEntry(); GenericEntry* pGeneric = pEntry->GetEntry();
if (wcsnicmp(prefix, pGeneric->GetDisplayName(), len) == 0) if (wcsnicmp(prefix, pGeneric->GetDisplayName(), len) == 0)
@ -1357,7 +1357,7 @@ SelectionSet::Dump(void)
WMSG1("SelectionSet: %d entries\n", fNumEntries); WMSG1("SelectionSet: %d entries\n", fNumEntries);
pEntry = fEntryHead; pEntry = fEntryHead;
while (pEntry != nil) { while (pEntry != NULL) {
WMSG1(" : name='%ls'\n", pEntry->GetEntry()->GetPathName()); WMSG1(" : name='%ls'\n", pEntry->GetEntry()->GetPathName());
pEntry = pEntry->GetNext(); pEntry = pEntry->GetNext();
} }

View File

@ -52,7 +52,7 @@ typedef struct FileProps {
class XferFileOptions { class XferFileOptions {
public: public:
XferFileOptions(void) : XferFileOptions(void) :
fTarget(nil), fPreserveEmptyFolders(false), fpTargetFS(nil) fTarget(NULL), fPreserveEmptyFolders(false), fpTargetFS(NULL)
{} {}
~XferFileOptions(void) {} ~XferFileOptions(void) {}
@ -245,7 +245,7 @@ private:
const WCHAR* fFileName; // points within fPathName const WCHAR* fFileName; // points within fPathName
const WCHAR* fFileNameExtension; // points within fPathName const WCHAR* fFileNameExtension; // points within fPathName
char fFssep; char fFssep;
WCHAR* fSubVolName; // sub-volume prefix, or nil if none WCHAR* fSubVolName; // sub-volume prefix, or NULL if none
WCHAR* fDisplayName; // combination of sub-vol and path WCHAR* fDisplayName; // combination of sub-vol and path
long fFileType; long fFileType;
long fAuxType; long fAuxType;
@ -285,11 +285,11 @@ private:
class GenericArchive { class GenericArchive {
public: public:
GenericArchive(void) { GenericArchive(void) {
fPathName = nil; fPathName = NULL;
fNumEntries = 0; fNumEntries = 0;
fEntryHead = fEntryTail = nil; fEntryHead = fEntryTail = NULL;
fReloadFlag = true; fReloadFlag = true;
//fEntryIndex = nil; //fEntryIndex = NULL;
} }
virtual ~GenericArchive(void) { virtual ~GenericArchive(void) {
//WMSG0("Deleting GenericArchive\n"); //WMSG0("Deleting GenericArchive\n");
@ -305,7 +305,7 @@ public:
} }
//virtual GenericEntry* GetEntry(long num) { //virtual GenericEntry* GetEntry(long num) {
// ASSERT(num >= 0 && num < fNumEntries); // ASSERT(num >= 0 && num < fNumEntries);
// if (fEntryIndex == nil) // if (fEntryIndex == NULL)
// CreateIndex(); // CreateIndex();
// return fEntryIndex[num]; // return fEntryIndex[num];
//} //}
@ -563,10 +563,10 @@ protected:
void SetPathName(const WCHAR* pathName) { void SetPathName(const WCHAR* pathName) {
free(fPathName); free(fPathName);
if (pathName != nil) { if (pathName != NULL) {
fPathName = _wcsdup(pathName); fPathName = _wcsdup(pathName);
} else { } else {
fPathName = nil; fPathName = NULL;
} }
} }
@ -595,7 +595,7 @@ public:
//fThreadKind = threadKind; //fThreadKind = threadKind;
//fFilter = filter; //fFilter = filter;
//fReformatName = ""; //fReformatName = "";
fpPrev = fpNext = nil; fpPrev = fpNext = NULL;
} }
~SelectionEntry(void) {} ~SelectionEntry(void) {}
@ -634,7 +634,7 @@ class SelectionSet {
public: public:
SelectionSet(void) { SelectionSet(void) {
fNumEntries = 0; fNumEntries = 0;
fEntryHead = fEntryTail = fIterCurrent = nil; fEntryHead = fEntryTail = fIterCurrent = NULL;
} }
~SelectionSet(void) { ~SelectionSet(void) {
DeleteEntries(); DeleteEntries();
@ -649,18 +649,18 @@ public:
SelectionEntry* GetEntries(void) const { return fEntryHead; } SelectionEntry* GetEntries(void) const { return fEntryHead; }
void IterReset(void) { void IterReset(void) {
fIterCurrent = nil; fIterCurrent = NULL;
} }
// move to the next or previous entry as part of iterating // move to the next or previous entry as part of iterating
SelectionEntry* IterPrev(void) { SelectionEntry* IterPrev(void) {
if (fIterCurrent == nil) if (fIterCurrent == NULL)
fIterCurrent = fEntryTail; fIterCurrent = fEntryTail;
else else
fIterCurrent = fIterCurrent->GetPrev(); fIterCurrent = fIterCurrent->GetPrev();
return fIterCurrent; return fIterCurrent;
} }
SelectionEntry* IterNext(void) { SelectionEntry* IterNext(void) {
if (fIterCurrent == nil) if (fIterCurrent == NULL)
fIterCurrent = fEntryHead; fIterCurrent = fEntryHead;
else else
fIterCurrent = fIterCurrent->GetNext(); fIterCurrent = fIterCurrent->GetNext();
@ -670,16 +670,16 @@ public:
return fIterCurrent; return fIterCurrent;
} }
bool IterHasPrev(void) const { bool IterHasPrev(void) const {
if (fIterCurrent == nil) if (fIterCurrent == NULL)
return fEntryTail != nil; return fEntryTail != NULL;
else else
return (fIterCurrent->GetPrev() != nil); return (fIterCurrent->GetPrev() != NULL);
} }
bool IterHasNext(void) const { bool IterHasNext(void) const {
if (fIterCurrent == nil) if (fIterCurrent == NULL)
return fEntryHead != nil; return fEntryHead != NULL;
else else
return (fIterCurrent->GetNext() != nil); return (fIterCurrent->GetNext() != NULL);
} }
int GetNumEntries(void) const { return fNumEntries; } int GetNumEntries(void) const { return fNumEntries; }

View File

@ -44,7 +44,7 @@ static const ConvTable gOuterFormats[] = {
{ DiskImg::kOuterFormatGzip, L"gzip" }, { DiskImg::kOuterFormatGzip, L"gzip" },
// { DiskImg::kOuterFormatBzip2, L"bzip2" }, // { DiskImg::kOuterFormatBzip2, L"bzip2" },
{ DiskImg::kOuterFormatZip, L"Zip archive" }, { DiskImg::kOuterFormatZip, L"Zip archive" },
{ kLastEntry, nil } { kLastEntry, NULL }
}; };
/* DiskImg::FileFormat */ /* DiskImg::FileFormat */
static const ConvTable gFileFormats[] = { static const ConvTable gFileFormats[] = {
@ -60,7 +60,7 @@ static const ConvTable gFileFormats[] = {
{ DiskImg::kFileFormatTrackStar, L"TrackStar image" }, { DiskImg::kFileFormatTrackStar, L"TrackStar image" },
{ DiskImg::kFileFormatFDI, L"FDI image" }, { DiskImg::kFileFormatFDI, L"FDI image" },
// { DiskImg::kFileFormatDDDDeluxe, L"DDDDeluxe" }, // { DiskImg::kFileFormatDDDDeluxe, L"DDDDeluxe" },
{ kLastEntry, nil } { kLastEntry, NULL }
}; };
/* DiskImg::PhysicalFormat */ /* DiskImg::PhysicalFormat */
static const ConvTable gPhysicalFormats[] = { static const ConvTable gPhysicalFormats[] = {
@ -69,7 +69,7 @@ static const ConvTable gPhysicalFormats[] = {
{ DiskImg::kPhysicalFormatNib525_6656, L"Raw nibbles (6656-byte)" }, { DiskImg::kPhysicalFormatNib525_6656, L"Raw nibbles (6656-byte)" },
{ DiskImg::kPhysicalFormatNib525_6384, L"Raw nibbles (6384-byte)" }, { DiskImg::kPhysicalFormatNib525_6384, L"Raw nibbles (6384-byte)" },
{ DiskImg::kPhysicalFormatNib525_Var, L"Raw nibbles (variable len)" }, { DiskImg::kPhysicalFormatNib525_Var, L"Raw nibbles (variable len)" },
{ kLastEntry, nil } { kLastEntry, NULL }
}; };
/* DiskImg::SectorOrder */ /* DiskImg::SectorOrder */
static const ConvTable gSectorOrders[] = { static const ConvTable gSectorOrders[] = {
@ -78,7 +78,7 @@ static const ConvTable gSectorOrders[] = {
{ DiskImg::kSectorOrderDOS, L"DOS sector ordering" }, { DiskImg::kSectorOrderDOS, L"DOS sector ordering" },
{ DiskImg::kSectorOrderCPM, L"CP/M block ordering" }, { DiskImg::kSectorOrderCPM, L"CP/M block ordering" },
{ DiskImg::kSectorOrderPhysical, L"Physical sector ordering" }, { DiskImg::kSectorOrderPhysical, L"Physical sector ordering" },
{ kLastEntry, nil } { kLastEntry, NULL }
}; };
/* DiskImg::FSFormat */ /* DiskImg::FSFormat */
static const ConvTable gFSFormats[] = { static const ConvTable gFSFormats[] = {
@ -107,7 +107,7 @@ static const ConvTable gFSFormats[] = {
{ DiskImg::kFormatRDOS33, L"RDOS 3.3 (16-sector)" }, { DiskImg::kFormatRDOS33, L"RDOS 3.3 (16-sector)" },
{ DiskImg::kFormatRDOS32, L"RDOS 3.2 (13-sector)" }, { DiskImg::kFormatRDOS32, L"RDOS 3.2 (13-sector)" },
{ DiskImg::kFormatRDOS3, L"RDOS 3 (cracked 13-sector)" }, { DiskImg::kFormatRDOS3, L"RDOS 3 (cracked 13-sector)" },
{ kLastEntry, nil } { kLastEntry, NULL }
}; };
@ -169,24 +169,24 @@ ImageFormatDialog::LoadComboBoxes(void)
CButton* pButton; CButton* pButton;
pWnd = GetDlgItem(IDC_DECONF_SOURCE); pWnd = GetDlgItem(IDC_DECONF_SOURCE);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->SetWindowText(fFileSource); pWnd->SetWindowText(fFileSource);
if (fQueryDisplayFormat) { if (fQueryDisplayFormat) {
pButton = (CButton*) GetDlgItem(IDC_DECONF_VIEWASSECTORS); pButton = (CButton*) GetDlgItem(IDC_DECONF_VIEWASSECTORS);
ASSERT(pButton != nil); ASSERT(pButton != NULL);
pButton->SetCheck(fDisplayFormat == kShowAsSectors); pButton->SetCheck(fDisplayFormat == kShowAsSectors);
if (!fHasSectors) if (!fHasSectors)
pButton->EnableWindow(FALSE); pButton->EnableWindow(FALSE);
pButton = (CButton*) GetDlgItem(IDC_DECONF_VIEWASBLOCKS); pButton = (CButton*) GetDlgItem(IDC_DECONF_VIEWASBLOCKS);
ASSERT(pButton != nil); ASSERT(pButton != NULL);
pButton->SetCheck(fDisplayFormat == kShowAsBlocks); pButton->SetCheck(fDisplayFormat == kShowAsBlocks);
if (!fHasBlocks) if (!fHasBlocks)
pButton->EnableWindow(FALSE); pButton->EnableWindow(FALSE);
pButton = (CButton*) GetDlgItem(IDC_DECONF_VIEWASNIBBLES); pButton = (CButton*) GetDlgItem(IDC_DECONF_VIEWASNIBBLES);
ASSERT(pButton != nil); ASSERT(pButton != NULL);
pButton->SetCheck(fDisplayFormat == kShowAsNibbles); pButton->SetCheck(fDisplayFormat == kShowAsNibbles);
if (!fHasNibbles) if (!fHasNibbles)
pButton->EnableWindow(FALSE); pButton->EnableWindow(FALSE);
@ -222,7 +222,7 @@ ImageFormatDialog::LoadComboBox(int boxID, const ConvTable* pTable, int dflt)
int idx, idxShift; int idx, idxShift;
pCombo = (CComboBox*) GetDlgItem(boxID); pCombo = (CComboBox*) GetDlgItem(boxID);
ASSERT(pCombo != nil); ASSERT(pCombo != NULL);
idx = idxShift = 0; idx = idxShift = 0;
while (pTable[idx].enumval != kLastEntry) { while (pTable[idx].enumval != kLastEntry) {
@ -264,7 +264,7 @@ ImageFormatDialog::ConvComboSel(int boxID, const ConvTable* pTable)
int idx, enumval; int idx, enumval;
pCombo = (CComboBox*) GetDlgItem(boxID); pCombo = (CComboBox*) GetDlgItem(boxID);
ASSERT(pCombo != nil); ASSERT(pCombo != NULL);
idx = pCombo->GetCurSel(); idx = pCombo->GetCurSel();
if (idx < 0) { if (idx < 0) {
@ -298,17 +298,17 @@ ImageFormatDialog::OnOK(void)
if (fQueryDisplayFormat) { if (fQueryDisplayFormat) {
pButton = (CButton*) GetDlgItem(IDC_DECONF_VIEWASSECTORS); pButton = (CButton*) GetDlgItem(IDC_DECONF_VIEWASSECTORS);
ASSERT(pButton != nil); ASSERT(pButton != NULL);
if (pButton->GetCheck()) if (pButton->GetCheck())
fDisplayFormat = kShowAsSectors; fDisplayFormat = kShowAsSectors;
pButton = (CButton*) GetDlgItem(IDC_DECONF_VIEWASBLOCKS); pButton = (CButton*) GetDlgItem(IDC_DECONF_VIEWASBLOCKS);
ASSERT(pButton != nil); ASSERT(pButton != NULL);
if (pButton->GetCheck()) if (pButton->GetCheck())
fDisplayFormat = kShowAsBlocks; fDisplayFormat = kShowAsBlocks;
pButton = (CButton*) GetDlgItem(IDC_DECONF_VIEWASNIBBLES); pButton = (CButton*) GetDlgItem(IDC_DECONF_VIEWASNIBBLES);
ASSERT(pButton != nil); ASSERT(pButton != NULL);
if (pButton->GetCheck()) if (pButton->GetCheck())
fDisplayFormat = kShowAsNibbles; fDisplayFormat = kShowAsNibbles;
} }

View File

@ -199,20 +199,20 @@ MainWindow::MainWindow()
{ {
static const WCHAR kAppName[] = L"CiderPress"; static const WCHAR kAppName[] = L"CiderPress";
fpContentList = nil; fpContentList = NULL;
fpOpenArchive = nil; fpOpenArchive = NULL;
//fpSelSet = nil; //fpSelSet = NULL;
fpActionProgress = nil; fpActionProgress = NULL;
fpProgressCounter = nil; fpProgressCounter = NULL;
fpFindDialog = nil; fpFindDialog = NULL;
fFindDown = true; fFindDown = true;
fFindMatchCase = false; fFindMatchCase = false;
fFindMatchWholeWord = false; fFindMatchWholeWord = false;
fAbortPrinting = false; fAbortPrinting = false;
fhDevMode = nil; fhDevMode = NULL;
fhDevNames = nil; fhDevNames = NULL;
fNeedReopen = false; fNeedReopen = false;
CString wndClass = AfxRegisterWndClass( CString wndClass = AfxRegisterWndClass(
@ -312,7 +312,7 @@ MainWindow::DoIdle(void)
* be nice to have a way to prevent it, but for now we'll just shove * be nice to have a way to prevent it, but for now we'll just shove
* things back where they're supposed to be. * things back where they're supposed to be.
*/ */
if (fpContentList != nil) { if (fpContentList != NULL) {
/* get the current column 0 width, with current user adjustments */ /* get the current column 0 width, with current user adjustments */
fpContentList->ExportColumnWidths(); fpContentList->ExportColumnWidths();
int width = fPreferences.GetColumnLayout()->GetColumnWidth(0); int width = fPreferences.GetColumnLayout()->GetColumnWidth(0);
@ -332,7 +332,7 @@ MainWindow::DoIdle(void)
* Put an asterisk at the end of the title if we have an open archive * Put an asterisk at the end of the title if we have an open archive
* and it has pending modifications. Remove it if nothing is pending. * and it has pending modifications. Remove it if nothing is pending.
*/ */
if (fpOpenArchive != nil) { if (fpOpenArchive != NULL) {
CString title; CString title;
int len; int len;
@ -368,11 +368,11 @@ MainWindow::ProcessCommandLine(void)
* Get the command line and break it down into an argument vector. * Get the command line and break it down into an argument vector.
*/ */
const WCHAR* cmdLine = ::GetCommandLine(); const WCHAR* cmdLine = ::GetCommandLine();
if (cmdLine == nil || wcslen(cmdLine) == 0) if (cmdLine == NULL || wcslen(cmdLine) == 0)
return; return;
WCHAR* mangle = wcsdup(cmdLine); WCHAR* mangle = wcsdup(cmdLine);
if (mangle == nil) if (mangle == NULL)
return; return;
WMSG1("Mangling '%ls'\n", mangle); WMSG1("Mangling '%ls'\n", mangle);
@ -388,8 +388,8 @@ MainWindow::ProcessCommandLine(void)
/* /*
* Figure out what the arguments are. * Figure out what the arguments are.
*/ */
const WCHAR* filename = nil; const WCHAR* filename = NULL;
const WCHAR* dispName = nil; const WCHAR* dispName = NULL;
int filterIndex = kFilterIndexGeneric; int filterIndex = kFilterIndexGeneric;
bool temp = false; bool temp = false;
@ -438,15 +438,15 @@ MainWindow::ProcessCommandLine(void)
break; break;
} }
} }
if (argc != 1 && filename == nil) { if (argc != 1 && filename == NULL) {
WMSG0("WARNING: args specified but no filename found\n"); WMSG0("WARNING: args specified but no filename found\n");
} }
WMSG0("Argument handling:\n"); WMSG0("Argument handling:\n");
WMSG3(" index=%d temp=%d filename='%ls'\n", WMSG3(" index=%d temp=%d filename='%ls'\n",
filterIndex, temp, filename == nil ? L"(null)" : filename); filterIndex, temp, filename == NULL ? L"(null)" : filename);
if (filename != nil) { if (filename != NULL) {
PathName path(filename); PathName path(filename);
CString ext = path.GetExtension(); CString ext = path.GetExtension();
@ -461,7 +461,7 @@ MainWindow::ProcessCommandLine(void)
fOpenArchivePathName = path.GetFileName(); fOpenArchivePathName = path.GetFileName();
else else
fOpenArchivePathName = filename; fOpenArchivePathName = filename;
if (dispName != nil) if (dispName != NULL)
fOpenArchivePathName = dispName; fOpenArchivePathName = dispName;
SetCPTitle(fOpenArchivePathName, fpOpenArchive); SetCPTitle(fOpenArchivePathName, fpOpenArchive);
} }
@ -716,7 +716,7 @@ MainWindow::OnPaint(void)
* If there's no control in the window, fill in the client area with * If there's no control in the window, fill in the client area with
* what looks like an empty MDI client rect. * what looks like an empty MDI client rect.
*/ */
if (fpContentList == nil) { if (fpContentList == NULL) {
DrawEmptyClientArea(&dc, clientRect); DrawEmptyClientArea(&dc, clientRect);
} }
@ -746,7 +746,7 @@ MainWindow::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
wparam = nFlags | (zDelta << 16); wparam = nFlags | (zDelta << 16);
lparam = pt.x | (pt.y << 16); lparam = pt.x | (pt.y << 16);
if (fpContentList != nil) if (fpContentList != NULL)
fpContentList->SendMessage(WM_MOUSEWHEEL, wparam, lparam); fpContentList->SendMessage(WM_MOUSEWHEEL, wparam, lparam);
return CWnd::OnMouseWheel(nFlags, zDelta, pt); return CWnd::OnMouseWheel(nFlags, zDelta, pt);
// return TRUE; // return TRUE;
@ -759,7 +759,7 @@ MainWindow::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
void void
MainWindow::OnSetFocus(CWnd* /*pOldWnd*/) MainWindow::OnSetFocus(CWnd* /*pOldWnd*/)
{ {
if (fpContentList != nil) { if (fpContentList != NULL) {
WMSG0("Returning focus to ContentList\n"); WMSG0("Returning focus to ContentList\n");
fpContentList->SetFocus(); fpContentList->SetFocus();
} }
@ -804,7 +804,7 @@ MainWindow::OnEditPreferences(void)
ColumnLayout* pColLayout = fPreferences.GetColumnLayout(); ColumnLayout* pColLayout = fPreferences.GetColumnLayout();
/* pull any user header tweaks out of list so we can configure prefs */ /* pull any user header tweaks out of list so we can configure prefs */
if (fpContentList != nil) if (fpContentList != NULL)
fpContentList->ExportColumnWidths(); fpContentList->ExportColumnWidths();
/* set up PrefsGeneralPage */ /* set up PrefsGeneralPage */
@ -909,7 +909,7 @@ MainWindow::ApplyNow(PrefsSheet* pPS)
pColLayout->SetColumnWidth(i, 0); pColLayout->SetColumnWidth(i, 0);
} }
} }
if (fpContentList != nil) if (fpContentList != NULL)
fpContentList->NewColumnWidths(); fpContentList->NewColumnWidths();
fPreferences.SetPrefBool(kPrMimicShrinkIt, fPreferences.SetPrefBool(kPrMimicShrinkIt,
pPS->fGeneralPage.fMimicShrinkIt != 0); pPS->fGeneralPage.fMimicShrinkIt != 0);
@ -935,7 +935,7 @@ MainWindow::ApplyNow(PrefsSheet* pPS)
fPreferences.SetPrefBool(kPrPasteJunkPaths, pPS->fGeneralPage.fPasteJunkPaths != 0); fPreferences.SetPrefBool(kPrPasteJunkPaths, pPS->fGeneralPage.fPasteJunkPaths != 0);
fPreferences.SetPrefBool(kPrBeepOnSuccess, pPS->fGeneralPage.fBeepOnSuccess != 0); fPreferences.SetPrefBool(kPrBeepOnSuccess, pPS->fGeneralPage.fBeepOnSuccess != 0);
if (pPS->fGeneralPage.fOurAssociations != nil) { if (pPS->fGeneralPage.fOurAssociations != NULL) {
WMSG0("NEW ASSOCIATIONS!\n"); WMSG0("NEW ASSOCIATIONS!\n");
for (int assoc = 0; assoc < gMyApp.fRegistry.GetNumFileAssocs(); assoc++) for (int assoc = 0; assoc < gMyApp.fRegistry.GetNumFileAssocs(); assoc++)
@ -946,7 +946,7 @@ MainWindow::ApplyNow(PrefsSheet* pPS)
/* delete them so, if they hit "apply" again, we only update once */ /* delete them so, if they hit "apply" again, we only update once */
delete[] pPS->fGeneralPage.fOurAssociations; delete[] pPS->fGeneralPage.fOurAssociations;
pPS->fGeneralPage.fOurAssociations = nil; pPS->fGeneralPage.fOurAssociations = NULL;
} }
fPreferences.SetPrefBool(kPrQueryImageFormat, pPS->fDiskImagePage.fQueryImageFormat != 0); fPreferences.SetPrefBool(kPrQueryImageFormat, pPS->fDiskImagePage.fQueryImageFormat != 0);
@ -1002,14 +1002,14 @@ MainWindow::ApplyNow(PrefsSheet* pPS)
// } // }
/* allow open archive to track changes to preferences */ /* allow open archive to track changes to preferences */
if (fpOpenArchive != nil) if (fpOpenArchive != NULL)
fpOpenArchive->PreferencesChanged(); fpOpenArchive->PreferencesChanged();
if (mustReload) { if (mustReload) {
WMSG0("Preferences apply requesting GA/CL reload\n"); WMSG0("Preferences apply requesting GA/CL reload\n");
if (fpOpenArchive != nil) if (fpOpenArchive != NULL)
fpOpenArchive->Reload(); fpOpenArchive->Reload();
if (fpContentList != nil) if (fpContentList != NULL)
fpContentList->Reload(); fpContentList->Reload();
} }
@ -1027,7 +1027,7 @@ MainWindow::OnEditFind(void)
{ {
DWORD flags = 0; DWORD flags = 0;
if (fpFindDialog != nil) if (fpFindDialog != NULL)
return; return;
if (fFindDown) if (fFindDown)
@ -1048,7 +1048,7 @@ MainWindow::OnEditFind(void)
void void
MainWindow::OnUpdateEditFind(CCmdUI* pCmdUI) MainWindow::OnUpdateEditFind(CCmdUI* pCmdUI)
{ {
pCmdUI->Enable(fpOpenArchive != nil); pCmdUI->Enable(fpOpenArchive != NULL);
} }
/* /*
@ -1057,14 +1057,14 @@ MainWindow::OnUpdateEditFind(CCmdUI* pCmdUI)
LRESULT LRESULT
MainWindow::OnFindDialogMessage(WPARAM wParam, LPARAM lParam) MainWindow::OnFindDialogMessage(WPARAM wParam, LPARAM lParam)
{ {
assert(fpFindDialog != nil); assert(fpFindDialog != NULL);
fFindDown = (fpFindDialog->SearchDown() != 0); fFindDown = (fpFindDialog->SearchDown() != 0);
fFindMatchCase = (fpFindDialog->MatchCase() != 0); fFindMatchCase = (fpFindDialog->MatchCase() != 0);
fFindMatchWholeWord = (fpFindDialog->MatchWholeWord() != 0); fFindMatchWholeWord = (fpFindDialog->MatchWholeWord() != 0);
if (fpFindDialog->IsTerminating()) { if (fpFindDialog->IsTerminating()) {
fpFindDialog = nil; fpFindDialog = NULL;
return 0; return 0;
} }
@ -1093,7 +1093,7 @@ MainWindow::OnEditSort(UINT id)
ASSERT(id >= IDM_SORT_PATHNAME && id <= IDM_SORT_ORIGINAL); ASSERT(id >= IDM_SORT_PATHNAME && id <= IDM_SORT_ORIGINAL);
fPreferences.GetColumnLayout()->SetSortColumn(id - IDM_SORT_PATHNAME); fPreferences.GetColumnLayout()->SetSortColumn(id - IDM_SORT_PATHNAME);
fPreferences.GetColumnLayout()->SetAscending(true); fPreferences.GetColumnLayout()->SetAscending(true);
if (fpContentList != nil) if (fpContentList != NULL)
fpContentList->NewSortOrder(); fpContentList->NewSortOrder();
} }
void void
@ -1163,7 +1163,7 @@ MainWindow::OnHelpAbout(void)
* User could've changed registration. If we're showing the registered * User could've changed registration. If we're showing the registered
* user name in the title bar, update it. * user name in the title bar, update it.
*/ */
if (fpOpenArchive == nil) if (fpOpenArchive == NULL)
SetCPTitle(); SetCPTitle();
} }
@ -1202,7 +1202,7 @@ MainWindow::OnFileNewArchive(void)
} }
pOpenArchive = new NufxArchive; pOpenArchive = new NufxArchive;
errStr = pOpenArchive->New(filename, nil); errStr = pOpenArchive->New(filename, NULL);
if (!errStr.IsEmpty()) { if (!errStr.IsEmpty()) {
CString failed; CString failed;
failed.LoadString(IDS_FAILED); failed.LoadString(IDS_FAILED);
@ -1299,7 +1299,7 @@ MainWindow::DoOpenArchive(const WCHAR* pathName, const WCHAR* ext,
SetCPTitle(fOpenArchivePathName, fpOpenArchive); SetCPTitle(fOpenArchivePathName, fpOpenArchive);
} else { } else {
/* some failures will close an open archive */ /* some failures will close an open archive */
//if (fpOpenArchive == nil) //if (fpOpenArchive == NULL)
// SetCPTitle(); // SetCPTitle();
} }
} }
@ -1318,7 +1318,7 @@ MainWindow::OnFileReopen(void)
void void
MainWindow::OnUpdateFileReopen(CCmdUI* pCmdUI) MainWindow::OnUpdateFileReopen(CCmdUI* pCmdUI)
{ {
pCmdUI->Enable(fpOpenArchive != nil); pCmdUI->Enable(fpOpenArchive != NULL);
} }
@ -1333,7 +1333,7 @@ MainWindow::OnFileSave(void)
{ {
CString errMsg; CString errMsg;
if (fpOpenArchive == nil) if (fpOpenArchive == NULL)
return; return;
{ {
@ -1349,7 +1349,7 @@ MainWindow::OnFileSave(void)
void void
MainWindow::OnUpdateFileSave(CCmdUI* pCmdUI) MainWindow::OnUpdateFileSave(CCmdUI* pCmdUI)
{ {
pCmdUI->Enable(fpOpenArchive != nil && fpOpenArchive->IsModified()); pCmdUI->Enable(fpOpenArchive != NULL && fpOpenArchive->IsModified());
} }
/* /*
@ -1365,7 +1365,7 @@ MainWindow::OnFileClose(void)
void void
MainWindow::OnUpdateFileClose(CCmdUI* pCmdUI) MainWindow::OnUpdateFileClose(CCmdUI* pCmdUI)
{ {
pCmdUI->Enable(fpOpenArchive != nil); pCmdUI->Enable(fpOpenArchive != NULL);
} }
@ -1375,8 +1375,8 @@ MainWindow::OnUpdateFileClose(CCmdUI* pCmdUI)
void void
MainWindow::OnFileArchiveInfo(void) MainWindow::OnFileArchiveInfo(void)
{ {
ArchiveInfoDialog* pDlg = nil; ArchiveInfoDialog* pDlg = NULL;
ASSERT(fpOpenArchive != nil); ASSERT(fpOpenArchive != NULL);
switch (fpOpenArchive->GetArchiveKind()) { switch (fpOpenArchive->GetArchiveKind()) {
case GenericArchive::kArchiveNuFX: case GenericArchive::kArchiveNuFX:
@ -1404,7 +1404,7 @@ MainWindow::OnFileArchiveInfo(void)
void void
MainWindow::OnUpdateFileArchiveInfo(CCmdUI* pCmdUI) MainWindow::OnUpdateFileArchiveInfo(CCmdUI* pCmdUI)
{ {
pCmdUI->Enable(fpContentList != nil); pCmdUI->Enable(fpContentList != NULL);
} }
/* /*
@ -1418,7 +1418,7 @@ MainWindow::OnFilePrint(void)
void void
MainWindow::OnUpdateFilePrint(CCmdUI* pCmdUI) MainWindow::OnUpdateFilePrint(CCmdUI* pCmdUI)
{ {
pCmdUI->Enable(fpContentList != nil && fpContentList->GetItemCount() > 0); pCmdUI->Enable(fpContentList != NULL && fpContentList->GetItemCount() > 0);
} }
/* /*
@ -1478,13 +1478,13 @@ MainWindow::OnFileExit(void)
void void
MainWindow::OnEditSelectAll(void) MainWindow::OnEditSelectAll(void)
{ {
ASSERT(fpContentList != nil); ASSERT(fpContentList != NULL);
fpContentList->SelectAll(); fpContentList->SelectAll();
} }
void void
MainWindow::OnUpdateEditSelectAll(CCmdUI* pCmdUI) MainWindow::OnUpdateEditSelectAll(CCmdUI* pCmdUI)
{ {
pCmdUI->Enable(fpContentList != nil); pCmdUI->Enable(fpContentList != NULL);
} }
/* /*
@ -1493,13 +1493,13 @@ MainWindow::OnUpdateEditSelectAll(CCmdUI* pCmdUI)
void void
MainWindow::OnEditInvertSelection(void) MainWindow::OnEditInvertSelection(void)
{ {
ASSERT(fpContentList != nil); ASSERT(fpContentList != NULL);
fpContentList->InvertSelection(); fpContentList->InvertSelection();
} }
void void
MainWindow::OnUpdateEditInvertSelection(CCmdUI* pCmdUI) MainWindow::OnUpdateEditInvertSelection(CCmdUI* pCmdUI)
{ {
pCmdUI->Enable(fpContentList != nil); pCmdUI->Enable(fpContentList != NULL);
} }
@ -1508,24 +1508,24 @@ MainWindow::OnUpdateEditInvertSelection(CCmdUI* pCmdUI)
* for the double-click handler, but also used for "action" menu items * for the double-click handler, but also used for "action" menu items
* that insist on operating on a single menu item (edit prefs, create subdir). * that insist on operating on a single menu item (edit prefs, create subdir).
* *
* Returns nil if the item couldn't be found or if more than one item was * Returns NULL if the item couldn't be found or if more than one item was
* selected. * selected.
*/ */
GenericEntry* GenericEntry*
MainWindow::GetSelectedItem(ContentList* pContentList) MainWindow::GetSelectedItem(ContentList* pContentList)
{ {
if (pContentList->GetSelectedCount() != 1) if (pContentList->GetSelectedCount() != 1)
return nil; return NULL;
POSITION posn; POSITION posn;
posn = pContentList->GetFirstSelectedItemPosition(); posn = pContentList->GetFirstSelectedItemPosition();
if (posn == nil) { if (posn == NULL) {
ASSERT(false); ASSERT(false);
return nil; return NULL;
} }
int num = pContentList->GetNextSelectedItem(/*ref*/ posn); int num = pContentList->GetNextSelectedItem(/*ref*/ posn);
GenericEntry* pEntry = (GenericEntry*) pContentList->GetItemData(num); GenericEntry* pEntry = (GenericEntry*) pContentList->GetItemData(num);
if (pEntry == nil) { if (pEntry == NULL) {
WMSG1(" Glitch: couldn't find entry %d\n", num); WMSG1(" Glitch: couldn't find entry %d\n", num);
ASSERT(false); ASSERT(false);
} }
@ -1544,7 +1544,7 @@ MainWindow::HandleDoubleClick(void)
{ {
bool handled = false; bool handled = false;
ASSERT(fpContentList != nil); ASSERT(fpContentList != NULL);
if (fpContentList->GetSelectedCount() == 0) { if (fpContentList->GetSelectedCount() == 0) {
/* nothing selected, they double-clicked outside first column */ /* nothing selected, they double-clicked outside first column */
WMSG0("Double-click but nothing selected\n"); WMSG0("Double-click but nothing selected\n");
@ -1560,7 +1560,7 @@ MainWindow::HandleDoubleClick(void)
* Find the GenericEntry that corresponds to this item. * Find the GenericEntry that corresponds to this item.
*/ */
GenericEntry* pEntry = GetSelectedItem(fpContentList); GenericEntry* pEntry = GetSelectedItem(fpContentList);
if (pEntry == nil) if (pEntry == NULL)
return; return;
WMSG1(" Double-click GOT '%ls'\n", pEntry->GetPathName()); WMSG1(" Double-click GOT '%ls'\n", pEntry->GetPathName());
@ -1593,12 +1593,12 @@ MainWindow::HandleDoubleClick(void)
*/ */
CString extViewerExts; CString extViewerExts;
extViewerExts = fPreferences.GetPrefString(kPrExtViewerExts); extViewerExts = fPreferences.GetPrefString(kPrExtViewerExts);
if (ext != nil && MatchSemicolonList(extViewerExts, ext+1)) { if (ext != NULL && MatchSemicolonList(extViewerExts, ext+1)) {
WMSG1(" Launching external viewer for '%ls'\n", ext); WMSG1(" Launching external viewer for '%ls'\n", ext);
TmpExtractForExternal(pEntry); TmpExtractForExternal(pEntry);
handled = true; handled = true;
} else if (pEntry->GetRecordKind() == GenericEntry::kRecordKindFile) { } else if (pEntry->GetRecordKind() == GenericEntry::kRecordKindFile) {
if ((ext != nil && ( if ((ext != NULL && (
wcsicmp(ext, L".shk") == 0 || wcsicmp(ext, L".shk") == 0 ||
wcsicmp(ext, L".sdk") == 0 || wcsicmp(ext, L".sdk") == 0 ||
wcsicmp(ext, L".bxy") == 0)) || wcsicmp(ext, L".bxy") == 0)) ||
@ -1608,7 +1608,7 @@ MainWindow::HandleDoubleClick(void)
TmpExtractAndOpen(pEntry, GenericEntry::kDataThread, kModeNuFX); TmpExtractAndOpen(pEntry, GenericEntry::kDataThread, kModeNuFX);
handled = true; handled = true;
} else } else
if ((ext != nil && ( if ((ext != NULL && (
wcsicmp(ext, L".bny") == 0 || wcsicmp(ext, L".bny") == 0 ||
wcsicmp(ext, L".bqy") == 0)) || wcsicmp(ext, L".bqy") == 0)) ||
(fileType == 0xe0 && auxType == 0x8000)) (fileType == 0xe0 && auxType == 0x8000))
@ -1617,7 +1617,7 @@ MainWindow::HandleDoubleClick(void)
TmpExtractAndOpen(pEntry, GenericEntry::kDataThread, kModeBinaryII); TmpExtractAndOpen(pEntry, GenericEntry::kDataThread, kModeBinaryII);
handled = true; handled = true;
} else } else
if ((ext != nil && ( if ((ext != NULL && (
wcsicmp(ext, L".acu") == 0)) || wcsicmp(ext, L".acu") == 0)) ||
(fileType == 0xe0 && auxType == 0x8001)) (fileType == 0xe0 && auxType == 0x8001))
{ {
@ -1693,7 +1693,7 @@ MainWindow::TmpExtractAndOpen(GenericEntry* pEntry, int threadKind,
FILE* fp; FILE* fp;
fp = _wfopen(nameBuf, L"wb"); fp = _wfopen(nameBuf, L"wb");
if (fp != nil) { if (fp != NULL) {
WMSG2("Extracting to '%ls' (unique=%d)\n", nameBuf, unique); WMSG2("Extracting to '%ls' (unique=%d)\n", nameBuf, unique);
result = pEntry->ExtractThreadToFile(threadKind, fp, result = pEntry->ExtractThreadToFile(threadKind, fp,
GenericEntry::kConvertEOLOff, GenericEntry::kConvertHAOff, GenericEntry::kConvertEOLOff, GenericEntry::kConvertHAOff,
@ -1783,7 +1783,7 @@ MainWindow::TmpExtractForExternal(GenericEntry* pEntry)
FILE* fp; FILE* fp;
fp = _wfopen(nameBuf, L"wb"); fp = _wfopen(nameBuf, L"wb");
if (fp != nil) { if (fp != NULL) {
fDeleteList.Add(nameBuf); // second file created by fopen fDeleteList.Add(nameBuf); // second file created by fopen
WMSG2("Extracting to '%ls' (unique=%d)\n", nameBuf, unique); WMSG2("Extracting to '%ls' (unique=%d)\n", nameBuf, unique);
result = pEntry->ExtractThreadToFile(GenericEntry::kDataThread, fp, result = pEntry->ExtractThreadToFile(GenericEntry::kDataThread, fp,
@ -1826,7 +1826,7 @@ MainWindow::OnRtClkDefault(void)
{ {
int idx; int idx;
ASSERT(fpContentList != nil); ASSERT(fpContentList != NULL);
idx = fpContentList->GetRightClickItem(); idx = fpContentList->GetRightClickItem();
ASSERT(idx != -1); ASSERT(idx != -1);
@ -1854,7 +1854,7 @@ MainWindow::OnRtClkDefault(void)
void void
MainWindow::SetProgressBegin(void) MainWindow::SetProgressBegin(void)
{ {
if (fpActionProgress != nil) if (fpActionProgress != NULL)
fpActionProgress->SetProgress(0); fpActionProgress->SetProgress(0);
else else
fStatusBar.SetPaneText(kProgressPane, L"--%"); fStatusBar.SetPaneText(kProgressPane, L"--%");
@ -1870,11 +1870,11 @@ MainWindow::SetProgressUpdate(int percent, const WCHAR* oldName,
{ {
int status = IDOK; int status = IDOK;
if (fpActionProgress != nil) { if (fpActionProgress != NULL) {
status = fpActionProgress->SetProgress(percent); status = fpActionProgress->SetProgress(percent);
if (oldName != nil) if (oldName != NULL)
fpActionProgress->SetArcName(oldName); fpActionProgress->SetArcName(oldName);
if (newName != nil) if (newName != NULL)
fpActionProgress->SetFileName(newName); fpActionProgress->SetFileName(newName);
} else { } else {
WCHAR buf[8]; WCHAR buf[8];
@ -1894,7 +1894,7 @@ MainWindow::SetProgressUpdate(int percent, const WCHAR* oldName,
void void
MainWindow::SetProgressEnd(void) MainWindow::SetProgressEnd(void)
{ {
if (fpActionProgress != nil) if (fpActionProgress != NULL)
fpActionProgress->SetProgress(100); fpActionProgress->SetProgress(100);
else else
fStatusBar.SetPaneText(kProgressPane, L""); fStatusBar.SetPaneText(kProgressPane, L"");
@ -1918,11 +1918,11 @@ MainWindow::SetProgressCounter(const WCHAR* str, long val)
/* if the main window is enabled, user could activate menus */ /* if the main window is enabled, user could activate menus */
ASSERT(!IsWindowEnabled()); ASSERT(!IsWindowEnabled());
if (fpProgressCounter != nil) { if (fpProgressCounter != NULL) {
//WMSG2("SetProgressCounter '%ls' %d\n", str, val); //WMSG2("SetProgressCounter '%ls' %d\n", str, val);
CString msg; CString msg;
if (str != nil) if (str != NULL)
fpProgressCounter->SetCounterFormat(str); fpProgressCounter->SetCounterFormat(str);
fpProgressCounter->SetCount((int) val); fpProgressCounter->SetCount((int) val);
} else { } else {
@ -1940,7 +1940,7 @@ MainWindow::SetProgressCounter(const WCHAR* str, long val)
} }
//EventPause(10); // DEBUG DEBUG //EventPause(10); // DEBUG DEBUG
if (fpProgressCounter != nil) if (fpProgressCounter != NULL)
return !fpProgressCounter->GetCancel(); return !fpProgressCounter->GetCancel();
else else
return true; return true;
@ -2077,7 +2077,7 @@ MainWindow::LoadArchive(const WCHAR* fileName, const WCHAR* extension,
{ {
GenericArchive::OpenResult openResult; GenericArchive::OpenResult openResult;
int result = -1; int result = -1;
GenericArchive* pOpenArchive = nil; GenericArchive* pOpenArchive = NULL;
int origFilterIndex = filterIndex; int origFilterIndex = filterIndex;
CString errStr, appName; CString errStr, appName;
@ -2152,7 +2152,7 @@ try_again:
goto bail; goto bail;
} else if (openResult == GenericArchive::kResultFileArchive) { } else if (openResult == GenericArchive::kResultFileArchive) {
delete pOpenArchive; delete pOpenArchive;
pOpenArchive = nil; pOpenArchive = NULL;
if (wcsicmp(extension, L"zip") == 0) { if (wcsicmp(extension, L"zip") == 0) {
errStr = "ZIP archives with multiple files are not supported."; errStr = "ZIP archives with multiple files are not supported.";
@ -2201,11 +2201,11 @@ try_again:
SwitchContentList(pOpenArchive); SwitchContentList(pOpenArchive);
pOpenArchive = nil; pOpenArchive = NULL;
result = 0; result = 0;
bail: bail:
if (pOpenArchive != nil) { if (pOpenArchive != NULL) {
ASSERT(result != 0); ASSERT(result != 0);
delete pOpenArchive; delete pOpenArchive;
} }
@ -2238,7 +2238,7 @@ MainWindow::DoOpenVolume(CString drive, bool readOnly)
/* close existing archive */ /* close existing archive */
CloseArchive(); CloseArchive();
GenericArchive* pOpenArchive = nil; GenericArchive* pOpenArchive = NULL;
pOpenArchive = new DiskArchive; pOpenArchive = new DiskArchive;
{ {
CWaitCursor waitc; CWaitCursor waitc;
@ -2257,7 +2257,7 @@ MainWindow::DoOpenVolume(CString drive, bool readOnly)
// success! // success!
SwitchContentList(pOpenArchive); SwitchContentList(pOpenArchive);
pOpenArchive = nil; pOpenArchive = NULL;
fOpenArchivePathName = drive; fOpenArchivePathName = drive;
result = 0; result = 0;
@ -2265,7 +2265,7 @@ MainWindow::DoOpenVolume(CString drive, bool readOnly)
SetCPTitle(fOpenArchivePathName, fpOpenArchive); SetCPTitle(fOpenArchivePathName, fpOpenArchive);
bail: bail:
if (pOpenArchive != nil) { if (pOpenArchive != NULL) {
ASSERT(result != 0); ASSERT(result != 0);
delete pOpenArchive; delete pOpenArchive;
} }
@ -2279,7 +2279,7 @@ bail:
void void
MainWindow::ReopenArchive(void) MainWindow::ReopenArchive(void)
{ {
if (fpOpenArchive == nil) { if (fpOpenArchive == NULL) {
ASSERT(false); ASSERT(false);
return; return;
} }
@ -2287,7 +2287,7 @@ MainWindow::ReopenArchive(void)
/* clear the flag, regardless of success or failure */ /* clear the flag, regardless of success or failure */
fNeedReopen = false; fNeedReopen = false;
GenericArchive* pOpenArchive = nil; GenericArchive* pOpenArchive = NULL;
CString pathName = fpOpenArchive->GetPathName(); CString pathName = fpOpenArchive->GetPathName();
bool readOnly = fpOpenArchive->IsReadOnly(); bool readOnly = fpOpenArchive->IsReadOnly();
GenericArchive::ArchiveKind archiveKind = fpOpenArchive->GetArchiveKind(); GenericArchive::ArchiveKind archiveKind = fpOpenArchive->GetArchiveKind();
@ -2326,7 +2326,7 @@ MainWindow::ReopenArchive(void)
WMSG0(" Reopen was successful\n"); WMSG0(" Reopen was successful\n");
SwitchContentList(pOpenArchive); SwitchContentList(pOpenArchive);
pOpenArchive = nil; pOpenArchive = NULL;
SetCPTitle(pathName, fpOpenArchive); SetCPTitle(pathName, fpOpenArchive);
bail: bail:
@ -2339,7 +2339,7 @@ bail:
bool bool
MainWindow::IsOpenPathName(const WCHAR* path) MainWindow::IsOpenPathName(const WCHAR* path)
{ {
if (fpOpenArchive == nil) if (fpOpenArchive == NULL)
return false; return false;
if (wcsicmp(path, fpOpenArchive->GetPathName()) == 0) if (wcsicmp(path, fpOpenArchive->GetPathName()) == 0)
@ -2356,7 +2356,7 @@ MainWindow::IsOpenPathName(const WCHAR* path)
void void
MainWindow::SwitchContentList(GenericArchive* pOpenArchive) MainWindow::SwitchContentList(GenericArchive* pOpenArchive)
{ {
assert(pOpenArchive != nil); assert(pOpenArchive != NULL);
/* /*
* We've got an archive opened successfully. If we already had one * We've got an archive opened successfully. If we already had one
@ -2365,11 +2365,11 @@ MainWindow::SwitchContentList(GenericArchive* pOpenArchive)
* something that might fail, like flush changes, we should've done * something that might fail, like flush changes, we should've done
* that before getting this far to avoid confusion.) * that before getting this far to avoid confusion.)
*/ */
if (fpOpenArchive != nil) if (fpOpenArchive != NULL)
CloseArchive(); CloseArchive();
ASSERT(fpOpenArchive == nil); ASSERT(fpOpenArchive == NULL);
ASSERT(fpContentList == nil); ASSERT(fpContentList == NULL);
/* /*
* Without this we get an assertion failure in CImageList::Attach if we * Without this we get an assertion failure in CImageList::Attach if we
@ -2410,11 +2410,11 @@ MainWindow::SwitchContentList(GenericArchive* pOpenArchive)
void void
MainWindow::CloseArchiveWOControls(void) MainWindow::CloseArchiveWOControls(void)
{ {
if (fpOpenArchive != nil) { if (fpOpenArchive != NULL) {
//fpOpenArchive->Close(); //fpOpenArchive->Close();
WMSG0("Deleting OpenArchive\n"); WMSG0("Deleting OpenArchive\n");
delete fpOpenArchive; delete fpOpenArchive;
fpOpenArchive = nil; fpOpenArchive = NULL;
} }
} }
@ -2428,10 +2428,10 @@ MainWindow::CloseArchive(void)
CWaitCursor waitc; // closing large compressed archive can be slow CWaitCursor waitc; // closing large compressed archive can be slow
// destroy the ContentList // destroy the ContentList
if (fpContentList != nil) { if (fpContentList != NULL) {
WMSG0("Destroying ContentList\n"); WMSG0("Destroying ContentList\n");
fpContentList->DestroyWindow(); // auto-cleanup invokes "delete" fpContentList->DestroyWindow(); // auto-cleanup invokes "delete"
fpContentList = nil; fpContentList = NULL;
} }
// destroy the GenericArchive // destroy the GenericArchive
@ -2452,7 +2452,7 @@ MainWindow::CloseArchive(void)
void void
MainWindow::SetCPTitle(const WCHAR* pathname, GenericArchive* pOpenArchive) MainWindow::SetCPTitle(const WCHAR* pathname, GenericArchive* pOpenArchive)
{ {
ASSERT(pathname != nil); ASSERT(pathname != NULL);
CString title; CString title;
CString appName; CString appName;
CString archiveDescription; CString archiveDescription;
@ -2513,7 +2513,7 @@ MainWindow::GetPrintTitle(void)
CString archiveDescription; CString archiveDescription;
CString appName; CString appName;
if (fpOpenArchive == nil) { if (fpOpenArchive == NULL) {
ASSERT(false); ASSERT(false);
return title; return title;
} }

View File

@ -374,7 +374,7 @@ private:
class DeleteListNode { class DeleteListNode {
public: public:
DeleteListNode(const CString& name) : fName(name), DeleteListNode(const CString& name) : fName(name),
fPrev(nil), fNext(nil) {} fPrev(NULL), fNext(NULL) {}
~DeleteListNode(void) {} ~DeleteListNode(void) {}
DeleteListNode* fPrev; DeleteListNode* fPrev;
@ -383,13 +383,13 @@ private:
}; };
public: public:
DeleteList(void) { fHead = nil; } DeleteList(void) { fHead = NULL; }
~DeleteList(void) { ~DeleteList(void) {
WMSG1("Processing DeleteList (head=0x%08lx)\n", fHead); WMSG1("Processing DeleteList (head=0x%08lx)\n", fHead);
DeleteListNode* pNode = fHead; DeleteListNode* pNode = fHead;
DeleteListNode* pNext; DeleteListNode* pNext;
while (pNode != nil) { while (pNode != NULL) {
pNext = pNode->fNext; pNext = pNode->fNext;
if (_wunlink(pNode->fName) != 0) { if (_wunlink(pNode->fName) != 0) {
WMSG2(" WARNING: delete of '%ls' failed, err=%d\n", WMSG2(" WARNING: delete of '%ls' failed, err=%d\n",
@ -405,7 +405,7 @@ private:
void Add(const CString& name) { void Add(const CString& name) {
DeleteListNode* pNode = new DeleteListNode(name); DeleteListNode* pNode = new DeleteListNode(name);
if (fHead != nil) { if (fHead != NULL) {
fHead->fPrev = pNode; fHead->fPrev = pNode;
pNode->fNext = fHead; pNode->fNext = fHead;
} }
@ -424,13 +424,13 @@ private:
#define SET_PROGRESS_BEGIN() ((MainWindow*)::AfxGetMainWnd())->SetProgressBegin() #define SET_PROGRESS_BEGIN() ((MainWindow*)::AfxGetMainWnd())->SetProgressBegin()
#define SET_PROGRESS_UPDATE(perc) \ #define SET_PROGRESS_UPDATE(perc) \
((MainWindow*)::AfxGetMainWnd())->SetProgressUpdate(perc, nil, nil) ((MainWindow*)::AfxGetMainWnd())->SetProgressUpdate(perc, NULL, NULL)
#define SET_PROGRESS_UPDATE2(perc, oldName, newName) \ #define SET_PROGRESS_UPDATE2(perc, oldName, newName) \
((MainWindow*)::AfxGetMainWnd())->SetProgressUpdate(perc, oldName, newName) ((MainWindow*)::AfxGetMainWnd())->SetProgressUpdate(perc, oldName, newName)
#define SET_PROGRESS_END() ((MainWindow*)::AfxGetMainWnd())->SetProgressEnd() #define SET_PROGRESS_END() ((MainWindow*)::AfxGetMainWnd())->SetProgressEnd()
#define SET_PROGRESS_COUNTER(val) \ #define SET_PROGRESS_COUNTER(val) \
((MainWindow*)::AfxGetMainWnd())->SetProgressCounter(nil, val) ((MainWindow*)::AfxGetMainWnd())->SetProgressCounter(NULL, val)
#define SET_PROGRESS_COUNTER_2(fmt, val) \ #define SET_PROGRESS_COUNTER_2(fmt, val) \
((MainWindow*)::AfxGetMainWnd())->SetProgressCounter(fmt, val) ((MainWindow*)::AfxGetMainWnd())->SetProgressCounter(fmt, val)

View File

@ -28,7 +28,7 @@ MyApp::MyApp(LPCTSTR lpszAppName) : CWinApp(lpszAppName)
{ {
gDebugLog = new DebugLog(L"C:\\src\\cplog.txt"); gDebugLog = new DebugLog(L"C:\\src\\cplog.txt");
time_t now = time(nil); time_t now = time(NULL);
LOGI("CiderPress v%d.%d.%d%ls started at %.24hs\n", LOGI("CiderPress v%d.%d.%d%ls started at %.24hs\n",
kAppMajorVersion, kAppMinorVersion, kAppBugVersion, kAppMajorVersion, kAppMinorVersion, kAppBugVersion,
@ -76,12 +76,12 @@ MyApp::InitInstance(void)
/* find our .EXE file */ /* find our .EXE file */
//HMODULE hModule = ::GetModuleHandle(NULL); //HMODULE hModule = ::GetModuleHandle(NULL);
WCHAR buf[MAX_PATH]; WCHAR buf[MAX_PATH];
if (::GetModuleFileName(nil /*hModule*/, buf, NELEM(buf)) != 0) { if (::GetModuleFileName(NULL /*hModule*/, buf, NELEM(buf)) != 0) {
WMSG1("Module name is '%ls'\n", buf); WMSG1("Module name is '%ls'\n", buf);
fExeFileName = buf; fExeFileName = buf;
WCHAR* cp = wcsrchr(buf, '\\'); WCHAR* cp = wcsrchr(buf, '\\');
if (cp == nil) if (cp == NULL)
fExeBaseName = L""; fExeBaseName = L"";
else else
fExeBaseName = fExeFileName.Left(cp - buf +1); fExeBaseName = fExeFileName.Left(cp - buf +1);
@ -97,7 +97,7 @@ MyApp::InitInstance(void)
#if 0 #if 0
/* find our .INI file by tweaking the EXE path */ /* find our .INI file by tweaking the EXE path */
char* cp = strrchr(buf, '\\'); char* cp = strrchr(buf, '\\');
if (cp == nil) if (cp == NULL)
cp = buf; cp = buf;
else else
cp++; cp++;
@ -149,7 +149,7 @@ MyApp::InitInstance(void)
/* /*
* Show where we got something from. Handy for checking DLL load locations. * Show where we got something from. Handy for checking DLL load locations.
* *
* If "name" is nil, we show the EXE info. * If "name" is NULL, we show the EXE info.
*/ */
void void
MyApp::LogModuleLocation(const WCHAR* name) MyApp::LogModuleLocation(const WCHAR* name)
@ -157,7 +157,7 @@ MyApp::LogModuleLocation(const WCHAR* name)
HMODULE hModule; HMODULE hModule;
WCHAR fileNameBuf[256]; WCHAR fileNameBuf[256];
hModule = ::GetModuleHandle(name); hModule = ::GetModuleHandle(name);
if (hModule != nil && if (hModule != NULL &&
::GetModuleFileName(hModule, fileNameBuf, NELEM(fileNameBuf)) != 0) ::GetModuleFileName(hModule, fileNameBuf, NELEM(fileNameBuf)) != 0)
{ {
// GetModuleHandle does not increase ref count, so no need to release // GetModuleHandle does not increase ref count, so no need to release

View File

@ -53,7 +53,7 @@ NewDiskSize::EnableButtons(CDialog* pDialog, BOOL state /*=true*/)
for (int i = 0; i < NELEM(kCtrlMap); i++) { for (int i = 0; i < NELEM(kCtrlMap); i++) {
pWnd = pDialog->GetDlgItem(kCtrlMap[i].ctrlID); pWnd = pDialog->GetDlgItem(kCtrlMap[i].ctrlID);
if (pWnd != nil) if (pWnd != NULL)
pWnd->EnableWindow(state); pWnd->EnableWindow(state);
} }
} }
@ -84,7 +84,7 @@ NewDiskSize::EnableButtons_ProDOS(CDialog* pDialog, long totalBlocks,
for (int i = 0; i < NELEM(kCtrlMap); i++) { for (int i = 0; i < NELEM(kCtrlMap); i++) {
pButton = (CButton*) pDialog->GetDlgItem(kCtrlMap[i].ctrlID); pButton = (CButton*) pDialog->GetDlgItem(kCtrlMap[i].ctrlID);
if (pButton == nil) { if (pButton == NULL) {
WMSG1("WARNING: couldn't find ctrlID %d\n", kCtrlMap[i].ctrlID); WMSG1("WARNING: couldn't find ctrlID %d\n", kCtrlMap[i].ctrlID);
continue; continue;
} }
@ -137,14 +137,14 @@ NewDiskSize::UpdateSpecifyEdit(CDialog* pDialog)
CEdit* pEdit = (CEdit*) pDialog->GetDlgItem(kEditBoxID); CEdit* pEdit = (CEdit*) pDialog->GetDlgItem(kEditBoxID);
int i; int i;
if (pEdit == nil) { if (pEdit == NULL) {
ASSERT(false); ASSERT(false);
return; return;
} }
for (i = 0; i < NELEM(kCtrlMap); i++) { for (i = 0; i < NELEM(kCtrlMap); i++) {
CButton* pButton = (CButton*) pDialog->GetDlgItem(kCtrlMap[i].ctrlID); CButton* pButton = (CButton*) pDialog->GetDlgItem(kCtrlMap[i].ctrlID);
if (pButton == nil) { if (pButton == NULL) {
WMSG1("WARNING: couldn't find ctrlID %d\n", kCtrlMap[i].ctrlID); WMSG1("WARNING: couldn't find ctrlID %d\n", kCtrlMap[i].ctrlID);
continue; continue;
} }

View File

@ -54,7 +54,7 @@ NewFolderDialog::DoDataExchange(CDataExchange* pDX)
fNewFullPath += "\\"; fNewFullPath += "\\";
fNewFullPath += fNewFolder; fNewFullPath += fNewFolder;
WMSG1("CREATING '%ls'\n", (LPCWSTR) fNewFullPath); WMSG1("CREATING '%ls'\n", (LPCWSTR) fNewFullPath);
if (!::CreateDirectory(fNewFullPath, nil)) { if (!::CreateDirectory(fNewFullPath, NULL)) {
/* show the sometimes-bizarre Windows error string */ /* show the sometimes-bizarre Windows error string */
CString msg, errStr, failed; CString msg, errStr, failed;
DWORD dwerr = ::GetLastError(); DWORD dwerr = ::GetLastError();

View File

@ -32,11 +32,11 @@ const unsigned char kNufxNoFssep = 0xff;
/* /*
* Extract data from a thread into a buffer. * Extract data from a thread into a buffer.
* *
* If "*ppText" is non-nil and "*pLength" is > 0, the data will be read into * If "*ppText" is non-NULL and "*pLength" is > 0, the data will be read into
* the pointed-to buffer so long as it's shorter than *pLength bytes. The * the pointed-to buffer so long as it's shorter than *pLength bytes. The
* value in "*pLength" will be set to the actual length used. * value in "*pLength" will be set to the actual length used.
* *
* If "*ppText" is nil or the length is <= 0, the uncompressed data will be * If "*ppText" is NULL or the length is <= 0, the uncompressed data will be
* placed into a buffer allocated with "new[]". * placed into a buffer allocated with "new[]".
* *
* Returns IDOK on success, IDCANCEL if the operation was cancelled by the * Returns IDOK on success, IDCANCEL if the operation was cancelled by the
@ -50,8 +50,8 @@ NufxEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength,
CString* pErrMsg) const CString* pErrMsg) const
{ {
NuError nerr; NuError nerr;
char* dataBuf = nil; char* dataBuf = NULL;
NuDataSink* pDataSink = nil; NuDataSink* pDataSink = NULL;
NuThread thread; NuThread thread;
unsigned long actualThreadEOF; unsigned long actualThreadEOF;
NuThreadIdx threadIdx; NuThreadIdx threadIdx;
@ -60,7 +60,7 @@ NufxEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength,
ASSERT(IDOK != -1 && IDCANCEL != -1); // make sure return vals don't clash ASSERT(IDOK != -1 && IDCANCEL != -1); // make sure return vals don't clash
if (*ppText != nil) if (*ppText != NULL)
needAlloc = false; needAlloc = false;
FindThreadInfo(which, &thread, pErrMsg); FindThreadInfo(which, &thread, pErrMsg);
@ -88,7 +88,7 @@ NufxEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength,
if (needAlloc) { if (needAlloc) {
dataBuf = new char[actualThreadEOF]; dataBuf = new char[actualThreadEOF];
if (dataBuf == nil) { if (dataBuf == NULL) {
pErrMsg->Format(L"allocation of %ld bytes failed", pErrMsg->Format(L"allocation of %ld bytes failed",
actualThreadEOF); actualThreadEOF);
goto bail; goto bail;
@ -140,10 +140,10 @@ bail:
ASSERT(result == IDCANCEL || !pErrMsg->IsEmpty()); ASSERT(result == IDCANCEL || !pErrMsg->IsEmpty());
if (needAlloc) { if (needAlloc) {
delete[] dataBuf; delete[] dataBuf;
ASSERT(*ppText == nil); ASSERT(*ppText == NULL);
} }
} }
if (pDataSink != nil) if (pDataSink != NULL)
NuFreeDataSink(pDataSink); NuFreeDataSink(pDataSink);
return result; return result;
} }
@ -160,14 +160,14 @@ int
NufxEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv, NufxEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv,
ConvertHighASCII convHA, CString* pErrMsg) const ConvertHighASCII convHA, CString* pErrMsg) const
{ {
NuDataSink* pDataSink = nil; NuDataSink* pDataSink = NULL;
NuError nerr; NuError nerr;
NuThread thread; NuThread thread;
unsigned long actualThreadEOF; unsigned long actualThreadEOF;
NuThreadIdx threadIdx; NuThreadIdx threadIdx;
int result = -1; int result = -1;
ASSERT(outfp != nil); ASSERT(outfp != NULL);
//CString errMsg; //CString errMsg;
FindThreadInfo(which, &thread, pErrMsg); FindThreadInfo(which, &thread, pErrMsg);
@ -254,7 +254,7 @@ bail:
if (result == IDOK) { if (result == IDOK) {
SET_PROGRESS_END(); SET_PROGRESS_END();
} }
if (pDataSink != nil) if (pDataSink != NULL)
NuFreeDataSink(pDataSink); NuFreeDataSink(pDataSink);
return result; return result;
} }
@ -304,7 +304,7 @@ NufxEntry::FindThreadInfo(int which, NuThread* pRetThread,
} }
int i; int i;
pThread = nil; pThread = NULL;
for (i = 0; i < (int)NuRecordGetNumThreads(pRecord); i++) { for (i = 0; i < (int)NuRecordGetNumThreads(pRecord); i++) {
pThread = NuGetThread(pRecord, i); pThread = NuGetThread(pRecord, i);
if (NuGetThreadID(pThread) == wantedThreadID) if (NuGetThreadID(pThread) == wantedThreadID)
@ -369,7 +369,7 @@ NufxEntry::AnalyzeRecord(const NuRecord* pRecord)
for (idx = 0; idx < pRecord->recTotalThreads; idx++) { for (idx = 0; idx < pRecord->recTotalThreads; idx++) {
pThread = NuGetThread(pRecord, idx); pThread = NuGetThread(pRecord, idx);
ASSERT(pThread != nil); ASSERT(pThread != NULL);
threadID = NuMakeThreadID(pThread->thThreadClass, threadID = NuMakeThreadID(pThread->thThreadClass,
pThread->thThreadKind); pThread->thThreadKind);
@ -558,14 +558,14 @@ NufxArchive::ProgressUpdater(NuArchive* pArchive, void* vpProgress)
const char* newName; const char* newName;
int perc; int perc;
ASSERT(pProgress != nil); ASSERT(pProgress != NULL);
ASSERT(pMainWin != nil); ASSERT(pMainWin != NULL);
ASSERT(pArchive != nil); ASSERT(pArchive != NULL);
(void) NuGetExtraData(pArchive, (void**) &pThis); (void) NuGetExtraData(pArchive, (void**) &pThis);
ASSERT(pThis != nil); ASSERT(pThis != NULL);
oldName = newName = nil; oldName = newName = NULL;
if (pProgress->operation == kNuOpAdd) { if (pProgress->operation == kNuOpAdd) {
oldName = pProgress->origPathname; oldName = pProgress->origPathname;
newName = pProgress->pathname; newName = pProgress->pathname;
@ -585,8 +585,8 @@ NufxArchive::ProgressUpdater(NuArchive* pArchive, void* vpProgress)
perc = 100; perc = 100;
//WMSG3("Progress: %d%% '%hs' '%hs'\n", perc, //WMSG3("Progress: %d%% '%hs' '%hs'\n", perc,
// oldName == nil ? "(nil)" : oldName, // oldName == NULL ? "(null)" : oldName,
// newName == nil ? "(nil)" : newName); // newName == NULL ? "(null)" : newName);
//status = pMainWin->SetProgressUpdate(perc, oldName, newName); //status = pMainWin->SetProgressUpdate(perc, oldName, newName);
CString oldNameW(oldName); CString oldNameW(oldName);
@ -610,7 +610,7 @@ NufxArchive::ProgressUpdater(NuArchive* pArchive, void* vpProgress)
/* /*
* Finish instantiating a NufxArchive object by opening an existing file. * Finish instantiating a NufxArchive object by opening an existing file.
* *
* Returns an error string on failure, or nil on success. * Returns an error string on failure, or NULL on success.
*/ */
GenericArchive::OpenResult GenericArchive::OpenResult
NufxArchive::Open(const WCHAR* filename, bool readOnly, CString* pErrMsg) NufxArchive::Open(const WCHAR* filename, bool readOnly, CString* pErrMsg)
@ -618,7 +618,7 @@ NufxArchive::Open(const WCHAR* filename, bool readOnly, CString* pErrMsg)
NuError nerr; NuError nerr;
CString errMsg; CString errMsg;
ASSERT(fpArchive == nil); ASSERT(fpArchive == NULL);
CStringA filenameA(filename); CStringA filenameA(filename);
if (!readOnly) { if (!readOnly) {
@ -678,8 +678,8 @@ NufxArchive::New(const WCHAR* filename, const void* options)
NuError nerr; NuError nerr;
CString retmsg; CString retmsg;
ASSERT(fpArchive == nil); ASSERT(fpArchive == NULL);
ASSERT(options == nil); ASSERT(options == NULL);
CString tmpname = GenDerivedTempName(filename); CString tmpname = GenDerivedTempName(filename);
WMSG2("Creating file '%ls' (tmp='%ls')\n", filename, (LPCWSTR) tmpname); WMSG2("Creating file '%ls' (tmp='%ls')\n", filename, (LPCWSTR) tmpname);
@ -822,7 +822,7 @@ NufxArchive::LoadContents(void)
NuError result; NuError result;
WMSG0("NufxArchive LoadContents\n"); WMSG0("NufxArchive LoadContents\n");
ASSERT(fpArchive != nil); ASSERT(fpArchive != NULL);
{ {
MainWindow* pMain = GET_MAIN_WINDOW(); MainWindow* pMain = GET_MAIN_WINDOW();
@ -897,8 +897,8 @@ NufxArchive::ContentFunc(NuArchive* pArchive, void* vpRecord)
NufxArchive* pThis; NufxArchive* pThis;
NufxEntry* pNewEntry; NufxEntry* pNewEntry;
ASSERT(pArchive != nil); ASSERT(pArchive != NULL);
ASSERT(vpRecord != nil); ASSERT(vpRecord != NULL);
NuGetExtraData(pArchive, (void**) &pThis); NuGetExtraData(pArchive, (void**) &pThis);
@ -1113,8 +1113,8 @@ NufxArchive::AddDisk(ActionProgressDialog* pActionProgress,
PathProposal pathProp; PathProposal pathProp;
PathName pathName; PathName pathName;
DiskImg* pDiskImg; DiskImg* pDiskImg;
NuDataSource* pSource = nil; NuDataSource* pSource = NULL;
unsigned char* diskData = nil; unsigned char* diskData = NULL;
WCHAR curDir[MAX_PATH] = L"\\"; WCHAR curDir[MAX_PATH] = L"\\";
bool retVal = false; bool retVal = false;
CStringA storageNameA, origNameA; CStringA storageNameA, origNameA;
@ -1128,11 +1128,11 @@ NufxArchive::AddDisk(ActionProgressDialog* pActionProgress,
pAddOpts->fOverwriteExisting); pAddOpts->fOverwriteExisting);
pDiskImg = pAddOpts->fpDiskImg; pDiskImg = pAddOpts->fpDiskImg;
ASSERT(pDiskImg != nil); ASSERT(pDiskImg != NULL);
/* allocate storage for the entire disk */ /* allocate storage for the entire disk */
diskData = new BYTE[pDiskImg->GetNumBlocks() * kBlockSize]; diskData = new BYTE[pDiskImg->GetNumBlocks() * kBlockSize];
if (diskData == nil) { if (diskData == NULL) {
errMsg.Format(L"Unable to allocate %d bytes.", errMsg.Format(L"Unable to allocate %d bytes.",
pDiskImg->GetNumBlocks() * kBlockSize); pDiskImg->GetNumBlocks() * kBlockSize);
ShowFailureMsg(fpMsgWnd, errMsg, IDS_FAILED); ShowFailureMsg(fpMsgWnd, errMsg, IDS_FAILED);
@ -1183,7 +1183,7 @@ NufxArchive::AddDisk(ActionProgressDialog* pActionProgress,
time_t now, then; time_t now, then;
pathName = buf; pathName = buf;
now = time(nil); now = time(NULL);
then = pathName.GetModWhen(); then = pathName.GetModWhen();
UNIXTimeToDateTime(&now, &details.archiveWhen); UNIXTimeToDateTime(&now, &details.archiveWhen);
UNIXTimeToDateTime(&then, &details.modWhen); UNIXTimeToDateTime(&then, &details.modWhen);
@ -1217,7 +1217,7 @@ NufxArchive::AddDisk(ActionProgressDialog* pActionProgress,
/* create a data source for the disk */ /* create a data source for the disk */
nerr = NuCreateDataSourceForBuffer(kNuThreadFormatUncompressed, 0, nerr = NuCreateDataSourceForBuffer(kNuThreadFormatUncompressed, 0,
diskData, 0, pAddOpts->fpDiskImg->GetNumBlocks() * kBlockSize, diskData, 0, pAddOpts->fpDiskImg->GetNumBlocks() * kBlockSize,
nil, &pSource); NULL, &pSource);
if (nerr != kNuErrNone) { if (nerr != kNuErrNone) {
errMsg = "Unable to create NufxLib data source."; errMsg = "Unable to create NufxLib data source.";
ShowFailureMsg(fpMsgWnd, errMsg, IDS_FAILED); ShowFailureMsg(fpMsgWnd, errMsg, IDS_FAILED);
@ -1237,13 +1237,13 @@ NufxArchive::AddDisk(ActionProgressDialog* pActionProgress,
/* do the compression */ /* do the compression */
nerr = NuAddThread(fpArchive, recordIdx, kNuThreadIDDiskImage, nerr = NuAddThread(fpArchive, recordIdx, kNuThreadIDDiskImage,
pSource, nil); pSource, NULL);
if (nerr != kNuErrNone) { if (nerr != kNuErrNone) {
errMsg.Format(L"Failed adding thread: %hs.", NuStrError(nerr)); errMsg.Format(L"Failed adding thread: %hs.", NuStrError(nerr));
ShowFailureMsg(fpMsgWnd, errMsg, IDS_FAILED); ShowFailureMsg(fpMsgWnd, errMsg, IDS_FAILED);
goto bail; goto bail;
} }
pSource = nil; /* NufxLib owns it now */ pSource = NULL; /* NufxLib owns it now */
/* actually do the work */ /* actually do the work */
long statusFlags; long statusFlags;
@ -1344,13 +1344,13 @@ NufxArchive::AddPrep(CWnd* pMsgWnd, const AddFilesDialog* pAddOpts)
const Preferences* pPreferences = GET_PREFERENCES(); const Preferences* pPreferences = GET_PREFERENCES();
int defaultCompression; int defaultCompression;
ASSERT(fpArchive != nil); ASSERT(fpArchive != NULL);
fpMsgWnd = pMsgWnd; fpMsgWnd = pMsgWnd;
ASSERT(fpMsgWnd != nil); ASSERT(fpMsgWnd != NULL);
fpAddOpts = pAddOpts; fpAddOpts = pAddOpts;
ASSERT(fpAddOpts != nil); ASSERT(fpAddOpts != NULL);
//fBulkProgress = true; //fBulkProgress = true;
@ -1380,10 +1380,10 @@ NufxArchive::AddPrep(CWnd* pMsgWnd, const AddFilesDialog* pAddOpts)
void void
NufxArchive::AddFinish(void) NufxArchive::AddFinish(void)
{ {
NuSetErrorHandler(fpArchive, nil); NuSetErrorHandler(fpArchive, NULL);
NuSetValue(fpArchive, kNuValueHandleExisting, kNuMaybeOverwrite); NuSetValue(fpArchive, kNuValueHandleExisting, kNuMaybeOverwrite);
fpMsgWnd = nil; fpMsgWnd = NULL;
fpAddOpts = nil; fpAddOpts = NULL;
//fBulkProgress = false; //fBulkProgress = false;
} }
@ -1398,9 +1398,9 @@ NufxArchive::BulkAddErrorHandler(NuArchive* pArchive, void* vErrorStatus)
NufxArchive* pThis; NufxArchive* pThis;
NuResult result; NuResult result;
ASSERT(pArchive != nil); ASSERT(pArchive != NULL);
(void) NuGetExtraData(pArchive, (void**) &pThis); (void) NuGetExtraData(pArchive, (void**) &pThis);
ASSERT(pThis != nil); ASSERT(pThis != NULL);
ASSERT(pArchive == pThis->fpArchive); ASSERT(pArchive == pThis->fpArchive);
/* default action is to abort the current operation */ /* default action is to abort the current operation */
@ -1443,8 +1443,8 @@ NufxArchive::HandleReplaceExisting(const NuErrorStatus* pErrorStatus)
{ {
NuResult result = kNuOK; NuResult result = kNuOK;
ASSERT(pErrorStatus != nil); ASSERT(pErrorStatus != NULL);
ASSERT(pErrorStatus->pathname != nil); ASSERT(pErrorStatus->pathname != NULL);
ASSERT(pErrorStatus->canOverwrite); ASSERT(pErrorStatus->canOverwrite);
ASSERT(pErrorStatus->canSkip); ASSERT(pErrorStatus->canSkip);
@ -1458,7 +1458,7 @@ NufxArchive::HandleReplaceExisting(const NuErrorStatus* pErrorStatus)
confOvwr.fExistingFile = pErrorStatus->pRecord->filename; confOvwr.fExistingFile = pErrorStatus->pRecord->filename;
confOvwr.fExistingFileModWhen = confOvwr.fExistingFileModWhen =
DateTimeToSeconds(&pErrorStatus->pRecord->recModWhen); DateTimeToSeconds(&pErrorStatus->pRecord->recModWhen);
if (pErrorStatus->origPathname != nil) { if (pErrorStatus->origPathname != NULL) {
confOvwr.fNewFileSource = pErrorStatus->origPathname; confOvwr.fNewFileSource = pErrorStatus->origPathname;
PathName checkPath(confOvwr.fNewFileSource); PathName checkPath(confOvwr.fNewFileSource);
confOvwr.fNewFileModWhen = checkPath.GetModWhen(); confOvwr.fNewFileModWhen = checkPath.GetModWhen();
@ -1530,12 +1530,12 @@ NufxArchive::TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
CString errMsg; CString errMsg;
bool retVal = false; bool retVal = false;
ASSERT(fpArchive != nil); ASSERT(fpArchive != NULL);
WMSG1("Testing %d entries\n", pSelSet->GetNumEntries()); WMSG1("Testing %d entries\n", pSelSet->GetNumEntries());
SelectionEntry* pSelEntry = pSelSet->IterNext(); SelectionEntry* pSelEntry = pSelSet->IterNext();
while (pSelEntry != nil) { while (pSelEntry != NULL) {
pEntry = (NufxEntry*) pSelEntry->GetEntry(); pEntry = (NufxEntry*) pSelEntry->GetEntry();
WMSG2(" Testing %ld '%ls'\n", pEntry->GetRecordIdx(), WMSG2(" Testing %ld '%ls'\n", pEntry->GetRecordIdx(),
@ -1587,13 +1587,13 @@ NufxArchive::DeleteSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
CString errMsg; CString errMsg;
bool retVal = false; bool retVal = false;
ASSERT(fpArchive != nil); ASSERT(fpArchive != NULL);
WMSG1("Deleting %d entries\n", pSelSet->GetNumEntries()); WMSG1("Deleting %d entries\n", pSelSet->GetNumEntries());
/* mark entries for deletion */ /* mark entries for deletion */
SelectionEntry* pSelEntry = pSelSet->IterNext(); SelectionEntry* pSelEntry = pSelSet->IterNext();
while (pSelEntry != nil) { while (pSelEntry != NULL) {
pEntry = (NufxEntry*) pSelEntry->GetEntry(); pEntry = (NufxEntry*) pSelEntry->GetEntry();
WMSG2(" Deleting %ld '%ls'\n", pEntry->GetRecordIdx(), WMSG2(" Deleting %ld '%ls'\n", pEntry->GetRecordIdx(),
@ -1645,7 +1645,7 @@ NufxArchive::RenameSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
NuError nerr; NuError nerr;
bool retVal = false; bool retVal = false;
ASSERT(fpArchive != nil); ASSERT(fpArchive != NULL);
WMSG1("Renaming %d entries\n", pSelSet->GetNumEntries()); WMSG1("Renaming %d entries\n", pSelSet->GetNumEntries());
@ -1668,7 +1668,7 @@ NufxArchive::RenameSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
* sorts of archives (e.g. disk archives). * sorts of archives (e.g. disk archives).
*/ */
SelectionEntry* pSelEntry = pSelSet->IterNext(); SelectionEntry* pSelEntry = pSelSet->IterNext();
while (pSelEntry != nil) { while (pSelEntry != NULL) {
NufxEntry* pEntry = (NufxEntry*) pSelEntry->GetEntry(); NufxEntry* pEntry = (NufxEntry*) pSelEntry->GetEntry();
WMSG1(" Renaming '%ls'\n", pEntry->GetPathName()); WMSG1(" Renaming '%ls'\n", pEntry->GetPathName());
@ -1743,7 +1743,7 @@ NufxArchive::TestPathName(const GenericEntry* pGenericEntry,
const CString& basePath, const CString& newName, char newFssep) const const CString& basePath, const CString& newName, char newFssep) const
{ {
CString errMsg; CString errMsg;
ASSERT(pGenericEntry != nil); ASSERT(pGenericEntry != NULL);
ASSERT(basePath.IsEmpty()); ASSERT(basePath.IsEmpty());
@ -1771,7 +1771,7 @@ NufxArchive::TestPathName(const GenericEntry* pGenericEntry,
*/ */
GenericEntry* pEntry; GenericEntry* pEntry;
pEntry = GetEntries(); pEntry = GetEntries();
while (pEntry != nil) { while (pEntry != NULL) {
if (pEntry != pGenericEntry && if (pEntry != pGenericEntry &&
ComparePaths(pEntry->GetPathName(), pEntry->GetFssep(), ComparePaths(pEntry->GetPathName(), pEntry->GetFssep(),
newName, newFssep) == 0) newName, newFssep) == 0)
@ -1839,8 +1839,8 @@ NufxArchive::RecompressSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
SelectionEntry* pSelEntry = pSelSet->IterNext(); SelectionEntry* pSelEntry = pSelSet->IterNext();
long sizeInMemory = 0; long sizeInMemory = 0;
bool result = true; bool result = true;
NufxEntry* pEntry = nil; NufxEntry* pEntry = NULL;
for ( ; pSelEntry != nil; pSelEntry = pSelSet->IterNext()) { for ( ; pSelEntry != NULL; pSelEntry = pSelSet->IterNext()) {
pEntry = (NufxEntry*) pSelEntry->GetEntry(); pEntry = (NufxEntry*) pSelEntry->GetEntry();
/* /*
@ -1893,7 +1893,7 @@ NufxArchive::RecompressSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
/* handle errors that threw us out of the while loop */ /* handle errors that threw us out of the while loop */
if (!result) { if (!result) {
ASSERT(pEntry != nil); ASSERT(pEntry != NULL);
CString dispStr; CString dispStr;
dispStr.Format(L"Failed while recompressing '%ls': %ls.", dispStr.Format(L"Failed while recompressing '%ls': %ls.",
pEntry->GetDisplayName(), (LPCWSTR) errMsg); pEntry->GetDisplayName(), (LPCWSTR) errMsg);
@ -1944,10 +1944,10 @@ NufxArchive::RecompressThread(NufxEntry* pEntry, int threadKind,
NuThread thread; NuThread thread;
NuThreadID threadID; NuThreadID threadID;
NuError nerr; NuError nerr;
NuDataSource* pSource = nil; NuDataSource* pSource = NULL;
CString subErrMsg; CString subErrMsg;
bool retVal = false; bool retVal = false;
char* buf = nil; char* buf = NULL;
long len = 0; long len = 0;
WMSG2(" Recompressing %ld '%ls'\n", pEntry->GetRecordIdx(), WMSG2(" Recompressing %ld '%ls'\n", pEntry->GetRecordIdx(),
@ -1974,7 +1974,7 @@ NufxArchive::RecompressThread(NufxEntry* pEntry, int threadKind,
result = pEntry->ExtractThreadToBuffer(threadKind, &buf, &len, &subErrMsg); result = pEntry->ExtractThreadToBuffer(threadKind, &buf, &len, &subErrMsg);
if (result == IDCANCEL) { if (result == IDCANCEL) {
WMSG0("Cancelled during extract!\n"); WMSG0("Cancelled during extract!\n");
ASSERT(buf == nil); ASSERT(buf == NULL);
goto bail; /* abort anything that was pending */ goto bail; /* abort anything that was pending */
} else if (result != IDOK) { } else if (result != IDOK) {
pErrMsg->Format(L"Failed while extracting '%ls': %ls", pErrMsg->Format(L"Failed while extracting '%ls': %ls",
@ -1992,7 +1992,7 @@ NufxArchive::RecompressThread(NufxEntry* pEntry, int threadKind,
len); len);
goto bail; goto bail;
} }
buf = nil; // data source owns it now buf = NULL; // data source owns it now
/* delete the existing thread */ /* delete the existing thread */
//WMSG1("+++ DELETE threadIdx=%d\n", thread.threadIdx); //WMSG1("+++ DELETE threadIdx=%d\n", thread.threadIdx);
@ -2006,13 +2006,13 @@ NufxArchive::RecompressThread(NufxEntry* pEntry, int threadKind,
/* mark the new thread for addition */ /* mark the new thread for addition */
//WMSG1("+++ ADD threadID=0x%08lx\n", threadID); //WMSG1("+++ ADD threadID=0x%08lx\n", threadID);
nerr = NuAddThread(fpArchive, pEntry->GetRecordIdx(), threadID, nerr = NuAddThread(fpArchive, pEntry->GetRecordIdx(), threadID,
pSource, nil); pSource, NULL);
if (nerr != kNuErrNone) { if (nerr != kNuErrNone) {
pErrMsg->Format(L"Unable to add thread type %d: %hs", pErrMsg->Format(L"Unable to add thread type %d: %hs",
threadID, NuStrError(nerr)); threadID, NuStrError(nerr));
goto bail; goto bail;
} }
pSource = nil; // now owned by nufxlib pSource = NULL; // now owned by nufxlib
/* at this point, we just wait for the flush in the outer loop */ /* at this point, we just wait for the flush in the outer loop */
retVal = true; retVal = true;
@ -2043,21 +2043,21 @@ NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
{ {
WMSG0("NufxArchive XferSelection!\n"); WMSG0("NufxArchive XferSelection!\n");
XferStatus retval = kXferFailed; XferStatus retval = kXferFailed;
unsigned char* dataBuf = nil; unsigned char* dataBuf = NULL;
unsigned char* rsrcBuf = nil; unsigned char* rsrcBuf = NULL;
CString errMsg, dispMsg; CString errMsg, dispMsg;
pXferOpts->fTarget->XferPrepare(pXferOpts); pXferOpts->fTarget->XferPrepare(pXferOpts);
SelectionEntry* pSelEntry = pSelSet->IterNext(); SelectionEntry* pSelEntry = pSelSet->IterNext();
for ( ; pSelEntry != nil; pSelEntry = pSelSet->IterNext()) { for ( ; pSelEntry != NULL; pSelEntry = pSelSet->IterNext()) {
long dataLen=-1, rsrcLen=-1; long dataLen=-1, rsrcLen=-1;
NufxEntry* pEntry = (NufxEntry*) pSelEntry->GetEntry(); NufxEntry* pEntry = (NufxEntry*) pSelEntry->GetEntry();
FileDetails fileDetails; FileDetails fileDetails;
CString errMsg; CString errMsg;
ASSERT(dataBuf == nil); ASSERT(dataBuf == NULL);
ASSERT(rsrcBuf == nil); ASSERT(rsrcBuf == NULL);
/* in case we start handling CRC errors better */ /* in case we start handling CRC errors better */
if (pEntry->GetDamaged()) { if (pEntry->GetDamaged()) {
@ -2077,7 +2077,7 @@ NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
fileDetails.storageType = kNuStorageSeedling; fileDetails.storageType = kNuStorageSeedling;
time_t when; time_t when;
when = time(nil); when = time(NULL);
UNIXTimeToDateTime(&when, &fileDetails.archiveWhen); UNIXTimeToDateTime(&when, &fileDetails.archiveWhen);
when = pEntry->GetModWhen(); when = pEntry->GetModWhen();
UNIXTimeToDateTime(&when, &fileDetails.modWhen); UNIXTimeToDateTime(&when, &fileDetails.modWhen);
@ -2099,7 +2099,7 @@ NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
* Found a data thread. * Found a data thread.
*/ */
int result; int result;
dataBuf = nil; dataBuf = NULL;
dataLen = 0; dataLen = 0;
result = pEntry->ExtractThreadToBuffer(GenericEntry::kDataThread, result = pEntry->ExtractThreadToBuffer(GenericEntry::kDataThread,
(char**) &dataBuf, &dataLen, &errMsg); (char**) &dataBuf, &dataLen, &errMsg);
@ -2113,7 +2113,7 @@ NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
ShowFailureMsg(pMsgWnd, dispMsg, IDS_FAILED); ShowFailureMsg(pMsgWnd, dispMsg, IDS_FAILED);
goto bail; goto bail;
} }
ASSERT(dataBuf != nil); ASSERT(dataBuf != NULL);
ASSERT(dataLen >= 0); ASSERT(dataLen >= 0);
} else if (pEntry->GetHasDiskImage()) { } else if (pEntry->GetHasDiskImage()) {
@ -2121,7 +2121,7 @@ NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
* No data thread found. Look for a disk image. * No data thread found. Look for a disk image.
*/ */
int result; int result;
dataBuf = nil; dataBuf = NULL;
dataLen = 0; dataLen = 0;
result = pEntry->ExtractThreadToBuffer(GenericEntry::kDiskImageThread, result = pEntry->ExtractThreadToBuffer(GenericEntry::kDiskImageThread,
(char**) &dataBuf, &dataLen, &errMsg); (char**) &dataBuf, &dataLen, &errMsg);
@ -2134,7 +2134,7 @@ NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
ShowFailureMsg(pMsgWnd, dispMsg, IDS_FAILED); ShowFailureMsg(pMsgWnd, dispMsg, IDS_FAILED);
goto bail; goto bail;
} }
ASSERT(dataBuf != nil); ASSERT(dataBuf != NULL);
ASSERT(dataLen >= 0); ASSERT(dataLen >= 0);
} }
@ -2144,7 +2144,7 @@ NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
*/ */
if (pEntry->GetHasRsrcFork()) { if (pEntry->GetHasRsrcFork()) {
int result; int result;
rsrcBuf = nil; rsrcBuf = NULL;
rsrcLen = 0; rsrcLen = 0;
result = pEntry->ExtractThreadToBuffer(GenericEntry::kRsrcThread, result = pEntry->ExtractThreadToBuffer(GenericEntry::kRsrcThread,
(char**) &rsrcBuf, &rsrcLen, &errMsg); (char**) &rsrcBuf, &rsrcLen, &errMsg);
@ -2160,7 +2160,7 @@ NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
fileDetails.storageType = kNuStorageExtended; fileDetails.storageType = kNuStorageExtended;
} else { } else {
ASSERT(rsrcBuf == nil); ASSERT(rsrcBuf == NULL);
} }
if (dataLen < 0 && rsrcLen < 0) { if (dataLen < 0 && rsrcLen < 0) {
@ -2178,8 +2178,8 @@ NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED); ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED);
goto bail; goto bail;
} }
ASSERT(dataBuf == nil); ASSERT(dataBuf == NULL);
ASSERT(rsrcBuf == nil); ASSERT(rsrcBuf == NULL);
if (pActionProgress->SetProgress(100) == IDCANCEL) { if (pActionProgress->SetProgress(100) == IDCANCEL) {
retval = kXferCancelled; retval = kXferCancelled;
@ -2220,7 +2220,7 @@ NufxArchive::XferPrepare(const XferFileOptions* pXferOpts)
* exist. * exist.
* *
* Returns 0 on success, -1 on failure. On success, "*pDataBuf" and * Returns 0 on success, -1 on failure. On success, "*pDataBuf" and
* "*pRsrcBuf" are set to nil (ownership transfers to NufxLib). * "*pRsrcBuf" are set to NULL (ownership transfers to NufxLib).
*/ */
CString CString
NufxArchive::XferFile(FileDetails* pDetails, unsigned char** pDataBuf, NufxArchive::XferFile(FileDetails* pDetails, unsigned char** pDataBuf,
@ -2228,25 +2228,25 @@ NufxArchive::XferFile(FileDetails* pDetails, unsigned char** pDataBuf,
{ {
NuError nerr; NuError nerr;
const int kFileTypeTXT = 0x04; const int kFileTypeTXT = 0x04;
NuDataSource* pSource = nil; NuDataSource* pSource = NULL;
CString errMsg; CString errMsg;
WMSG1(" NufxArchive::XferFile '%ls'\n", (LPCWSTR) pDetails->storageName); WMSG1(" NufxArchive::XferFile '%ls'\n", (LPCWSTR) pDetails->storageName);
WMSG4(" dataBuf=0x%08lx dataLen=%ld rsrcBuf=0x%08lx rsrcLen=%ld\n", WMSG4(" dataBuf=0x%08lx dataLen=%ld rsrcBuf=0x%08lx rsrcLen=%ld\n",
*pDataBuf, dataLen, *pRsrcBuf, rsrcLen); *pDataBuf, dataLen, *pRsrcBuf, rsrcLen);
ASSERT(pDataBuf != nil); ASSERT(pDataBuf != NULL);
ASSERT(pRsrcBuf != nil); ASSERT(pRsrcBuf != NULL);
/* NuFX doesn't explicitly store directories */ /* NuFX doesn't explicitly store directories */
if (pDetails->entryKind == FileDetails::kFileKindDirectory) { if (pDetails->entryKind == FileDetails::kFileKindDirectory) {
delete[] *pDataBuf; delete[] *pDataBuf;
delete[] *pRsrcBuf; delete[] *pRsrcBuf;
*pDataBuf = *pRsrcBuf = nil; *pDataBuf = *pRsrcBuf = NULL;
goto bail; goto bail;
} }
ASSERT(dataLen >= 0 || rsrcLen >= 0); ASSERT(dataLen >= 0 || rsrcLen >= 0);
ASSERT(*pDataBuf != nil || *pRsrcBuf != nil); ASSERT(*pDataBuf != NULL || *pRsrcBuf != NULL);
/* add the record; we have "allow duplicates" enabled for clashes */ /* add the record; we have "allow duplicates" enabled for clashes */
NuRecordIdx recordIdx; NuRecordIdx recordIdx;
@ -2286,7 +2286,7 @@ NufxArchive::XferFile(FileDetails* pDetails, unsigned char** pDataBuf,
} }
if (dataLen >= 0) { if (dataLen >= 0) {
ASSERT(*pDataBuf != nil); ASSERT(*pDataBuf != NULL);
/* strip the high ASCII from DOS and RDOS text files */ /* strip the high ASCII from DOS and RDOS text files */
if (pDetails->entryKind != FileDetails::kFileKindDiskImage && if (pDetails->entryKind != FileDetails::kFileKindDiskImage &&
@ -2310,7 +2310,7 @@ NufxArchive::XferFile(FileDetails* pDetails, unsigned char** pDataBuf,
//ShowFailureMsg(fpMsgWnd, errMsg, IDS_FAILED); //ShowFailureMsg(fpMsgWnd, errMsg, IDS_FAILED);
goto bail; goto bail;
} }
*pDataBuf = nil; /* owned by data source */ *pDataBuf = NULL; /* owned by data source */
/* add the data fork, as a disk image if appropriate */ /* add the data fork, as a disk image if appropriate */
NuThreadID targetID; NuThreadID targetID;
@ -2319,18 +2319,18 @@ NufxArchive::XferFile(FileDetails* pDetails, unsigned char** pDataBuf,
else else
targetID = kNuThreadIDDataFork; targetID = kNuThreadIDDataFork;
nerr = NuAddThread(fpArchive, recordIdx, targetID, pSource, nil); nerr = NuAddThread(fpArchive, recordIdx, targetID, pSource, NULL);
if (nerr != kNuErrNone) { if (nerr != kNuErrNone) {
errMsg.Format(L"Failed adding thread: %hs.", NuStrError(nerr)); errMsg.Format(L"Failed adding thread: %hs.", NuStrError(nerr));
//ShowFailureMsg(fpMsgWnd, errMsg, IDS_FAILED); //ShowFailureMsg(fpMsgWnd, errMsg, IDS_FAILED);
goto bail; goto bail;
} }
pSource = nil; /* NufxLib owns it now */ pSource = NULL; /* NufxLib owns it now */
} }
/* add the resource fork, if one was provided */ /* add the resource fork, if one was provided */
if (rsrcLen >= 0) { if (rsrcLen >= 0) {
ASSERT(*pRsrcBuf != nil); ASSERT(*pRsrcBuf != NULL);
nerr = NuCreateDataSourceForBuffer(kNuThreadFormatUncompressed, 0, nerr = NuCreateDataSourceForBuffer(kNuThreadFormatUncompressed, 0,
*pRsrcBuf, 0, rsrcLen, ArrayDeleteHandler, &pSource); *pRsrcBuf, 0, rsrcLen, ArrayDeleteHandler, &pSource);
@ -2339,17 +2339,17 @@ NufxArchive::XferFile(FileDetails* pDetails, unsigned char** pDataBuf,
//ShowFailureMsg(fpMsgWnd, errMsg, IDS_FAILED); //ShowFailureMsg(fpMsgWnd, errMsg, IDS_FAILED);
goto bail; goto bail;
} }
*pRsrcBuf = nil; /* owned by data source */ *pRsrcBuf = NULL; /* owned by data source */
/* add the data fork */ /* add the data fork */
nerr = NuAddThread(fpArchive, recordIdx, kNuThreadIDRsrcFork, nerr = NuAddThread(fpArchive, recordIdx, kNuThreadIDRsrcFork,
pSource, nil); pSource, NULL);
if (nerr != kNuErrNone) { if (nerr != kNuErrNone) {
errMsg.Format(L"Failed adding thread: %hs.", NuStrError(nerr)); errMsg.Format(L"Failed adding thread: %hs.", NuStrError(nerr));
//ShowFailureMsg(fpMsgWnd, errMsg, IDS_FAILED); //ShowFailureMsg(fpMsgWnd, errMsg, IDS_FAILED);
goto bail; goto bail;
} }
pSource = nil; /* NufxLib owns it now */ pSource = NULL; /* NufxLib owns it now */
} }
bail: bail:
@ -2436,13 +2436,13 @@ NufxArchive::GetComment(CWnd* pMsgWnd, const GenericEntry* pGenericEntry,
ASSERT(pGenericEntry->GetHasComment()); ASSERT(pGenericEntry->GetHasComment());
/* use standard extract function to pull comment out */ /* use standard extract function to pull comment out */
buf = nil; buf = NULL;
len = 0; len = 0;
result = pEntry->ExtractThreadToBuffer(GenericEntry::kCommentThread, result = pEntry->ExtractThreadToBuffer(GenericEntry::kCommentThread,
&buf, &len, &errMsg); &buf, &len, &errMsg);
if (result != IDOK) { if (result != IDOK) {
WMSG1("Failed getting comment: %hs\n", buf); WMSG1("Failed getting comment: %hs\n", buf);
ASSERT(buf == nil); ASSERT(buf == NULL);
return false; return false;
} }
@ -2487,7 +2487,7 @@ bool
NufxArchive::SetComment(CWnd* pMsgWnd, GenericEntry* pGenericEntry, NufxArchive::SetComment(CWnd* pMsgWnd, GenericEntry* pGenericEntry,
const CString& str) const CString& str)
{ {
NuDataSource* pSource = nil; NuDataSource* pSource = NULL;
NufxEntry* pEntry = (NufxEntry*) pGenericEntry; NufxEntry* pEntry = (NufxEntry*) pGenericEntry;
NuError nerr; NuError nerr;
bool retVal = false; bool retVal = false;
@ -2536,7 +2536,7 @@ NufxArchive::SetComment(CWnd* pMsgWnd, GenericEntry* pGenericEntry,
/* create a data source to write from */ /* create a data source to write from */
nerr = NuCreateDataSourceForBuffer(kNuThreadFormatUncompressed, nerr = NuCreateDataSourceForBuffer(kNuThreadFormatUncompressed,
maxLen, (const BYTE*)(LPCSTR)newStr, 0, maxLen, (const BYTE*)(LPCSTR)newStr, 0,
newStr.GetLength(), nil, &pSource); newStr.GetLength(), NULL, &pSource);
if (nerr != kNuErrNone) { if (nerr != kNuErrNone) {
errMsg.Format(L"Unable to create NufxLib data source (len=%d, maxLen=%d).", errMsg.Format(L"Unable to create NufxLib data source (len=%d, maxLen=%d).",
newStr.GetLength(), maxLen); newStr.GetLength(), maxLen);
@ -2545,13 +2545,13 @@ NufxArchive::SetComment(CWnd* pMsgWnd, GenericEntry* pGenericEntry,
/* add the new thread */ /* add the new thread */
nerr = NuAddThread(fpArchive, pEntry->GetRecordIdx(), nerr = NuAddThread(fpArchive, pEntry->GetRecordIdx(),
kNuThreadIDComment, pSource, nil); kNuThreadIDComment, pSource, NULL);
if (nerr != kNuErrNone) { if (nerr != kNuErrNone) {
errMsg.Format(L"Unable to add comment thread: %hs.", errMsg.Format(L"Unable to add comment thread: %hs.",
NuStrError(nerr)); NuStrError(nerr));
goto bail; goto bail;
} }
pSource = nil; // nufxlib owns it now pSource = NULL; // nufxlib owns it now
/* flush changes */ /* flush changes */
long statusFlags; long statusFlags;

View File

@ -60,12 +60,12 @@ private:
class NufxArchive : public GenericArchive { class NufxArchive : public GenericArchive {
public: public:
NufxArchive(void) : NufxArchive(void) :
fpArchive(nil), fpArchive(NULL),
fIsReadOnly(false), fIsReadOnly(false),
fProgressAsRecompress(false), fProgressAsRecompress(false),
fNumAdded(-1), fNumAdded(-1),
fpMsgWnd(nil), fpMsgWnd(NULL),
fpAddOpts(nil) fpAddOpts(NULL)
{} {}
virtual ~NufxArchive(void) { (void) Close(); } virtual ~NufxArchive(void) { (void) Close(); }
@ -123,11 +123,11 @@ public:
private: private:
virtual CString Close(void) { virtual CString Close(void) {
if (fpArchive != nil) { if (fpArchive != NULL) {
WMSG0("Closing archive (aborting any un-flushed changes)\n"); WMSG0("Closing archive (aborting any un-flushed changes)\n");
NuAbort(fpArchive); NuAbort(fpArchive);
NuClose(fpArchive); NuClose(fpArchive);
fpArchive = nil; fpArchive = NULL;
} }
return L""; return L"";
} }

View File

@ -36,14 +36,14 @@ OpenVolumeDialog::OnInitDialog(void)
/* highlight/select entire line, not just filename */ /* highlight/select entire line, not just filename */
CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_VOLUME_LIST); CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_VOLUME_LIST);
ASSERT(pListView != nil); ASSERT(pListView != NULL);
ListView_SetExtendedListViewStyleEx(pListView->m_hWnd, ListView_SetExtendedListViewStyleEx(pListView->m_hWnd,
LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT); LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
/* disable the OK button until they click on something */ /* disable the OK button until they click on something */
CButton* pButton = (CButton*) GetDlgItem(IDOK); CButton* pButton = (CButton*) GetDlgItem(IDOK);
ASSERT(pButton != nil); ASSERT(pButton != NULL);
pButton->EnableWindow(FALSE); pButton->EnableWindow(FALSE);
@ -51,13 +51,13 @@ OpenVolumeDialog::OnInitDialog(void)
if (!fAllowROChange) { if (!fAllowROChange) {
CButton* pButton; CButton* pButton;
pButton = (CButton*) GetDlgItem(IDC_OPENVOL_READONLY); pButton = (CButton*) GetDlgItem(IDC_OPENVOL_READONLY);
ASSERT(pButton != nil); ASSERT(pButton != NULL);
pButton->EnableWindow(FALSE); pButton->EnableWindow(FALSE);
} }
/* prep the combo box */ /* prep the combo box */
CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_VOLUME_FILTER); CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_VOLUME_FILTER);
ASSERT(pCombo != nil); ASSERT(pCombo != NULL);
defaultFilter = pPreferences->GetPrefLong(kPrVolumeFilter); defaultFilter = pPreferences->GetPrefLong(kPrVolumeFilter);
if (defaultFilter >= kBoth && defaultFilter <= kPhysical) if (defaultFilter >= kBoth && defaultFilter <= kPhysical)
pCombo->SetCurSel(defaultFilter); pCombo->SetCurSel(defaultFilter);
@ -108,9 +108,9 @@ OpenVolumeDialog::LoadDriveList(void)
int filterSelection; int filterSelection;
pListView = (CListCtrl*) GetDlgItem(IDC_VOLUME_LIST); pListView = (CListCtrl*) GetDlgItem(IDC_VOLUME_LIST);
ASSERT(pListView != nil); ASSERT(pListView != NULL);
pCombo = (CComboBox*) GetDlgItem(IDC_VOLUME_FILTER); pCombo = (CComboBox*) GetDlgItem(IDC_VOLUME_FILTER);
ASSERT(pCombo != nil); ASSERT(pCombo != NULL);
pListView->DeleteAllItems(); pListView->DeleteAllItems();
@ -136,7 +136,7 @@ OpenVolumeDialog::LoadLogicalDriveList(CListCtrl* pListView, int* pItemIndex)
bool isWin9x = IsWin9x(); bool isWin9x = IsWin9x();
int itemIndex = *pItemIndex; int itemIndex = *pItemIndex;
ASSERT(pListView != nil); ASSERT(pListView != NULL);
drivesAvailable = GetLogicalDrives(); drivesAvailable = GetLogicalDrives();
if (drivesAvailable == 0) { if (drivesAvailable == 0) {
@ -157,7 +157,7 @@ OpenVolumeDialog::LoadLogicalDriveList(CListCtrl* pListView, int* pItemIndex)
driveName[0] = 'A' + i; driveName[0] = 'A' + i;
unsigned int driveType; unsigned int driveType;
const WCHAR* driveTypeComment = nil; const WCHAR* driveTypeComment = NULL;
BOOL result; BOOL result;
driveType = fVolumeInfo[i].driveType = GetDriveType(driveName); driveType = fVolumeInfo[i].driveType = GetDriveType(driveName);
@ -201,7 +201,7 @@ OpenVolumeDialog::LoadLogicalDriveList(CListCtrl* pListView, int* pItemIndex)
WCHAR volNameBuf[256]; WCHAR volNameBuf[256];
WCHAR fsNameBuf[64]; WCHAR fsNameBuf[64];
const WCHAR* errorComment = nil; const WCHAR* errorComment = NULL;
//DWORD fsFlags; //DWORD fsFlags;
CString entryName, entryRemarks; CString entryName, entryRemarks;
@ -255,17 +255,17 @@ OpenVolumeDialog::LoadLogicalDriveList(CListCtrl* pListView, int* pItemIndex)
driveName, GetLastError()); driveName, GetLastError());
continue; continue;
} }
ASSERT(errorComment != nil); ASSERT(errorComment != NULL);
entryName.Format(L"(%c:)", 'A' + i); entryName.Format(L"(%c:)", 'A' + i);
if (driveTypeComment != nil) if (driveTypeComment != NULL)
entryRemarks.Format(L"%ls - %ls", driveTypeComment, entryRemarks.Format(L"%ls - %ls", driveTypeComment,
errorComment); errorComment);
else else
entryRemarks.Format(L"%ls", errorComment); entryRemarks.Format(L"%ls", errorComment);
} else { } else {
entryName.Format(L"%ls (%c:)", volNameBuf, 'A' + i); entryName.Format(L"%ls (%c:)", volNameBuf, 'A' + i);
if (driveTypeComment != nil) if (driveTypeComment != NULL)
entryRemarks.Format(L"%ls", driveTypeComment); entryRemarks.Format(L"%ls", driveTypeComment);
else else
entryRemarks = ""; entryRemarks = "";
@ -356,7 +356,7 @@ OpenVolumeDialog::LoadPhysicalDriveList(CListCtrl* pListView, int* pItemIndex)
#if 0 // can we remove this? #if 0 // can we remove this?
DIError dierr; DIError dierr;
DiskImgLib::ASPI* pASPI = DiskImgLib::Global::GetASPI(); DiskImgLib::ASPI* pASPI = DiskImgLib::Global::GetASPI();
ASPIDevice* deviceArray = nil; ASPIDevice* deviceArray = NULL;
int numDevices; int numDevices;
dierr = pASPI->GetAccessibleDevices( dierr = pASPI->GetAccessibleDevices(
@ -419,7 +419,7 @@ OpenVolumeDialog::LoadPhysicalDriveList(CListCtrl* pListView, int* pItemIndex)
bool bool
OpenVolumeDialog::HasPhysicalDriveWin9x(int unit, CString* pRemark) OpenVolumeDialog::HasPhysicalDriveWin9x(int unit, CString* pRemark)
{ {
HANDLE handle = nil; HANDLE handle = NULL;
const int VWIN32_DIOC_DOS_INT13 = 4; const int VWIN32_DIOC_DOS_INT13 = 4;
const int CARRY_FLAG = 1; const int CARRY_FLAG = 1;
BOOL result; BOOL result;
@ -623,7 +623,7 @@ void
OpenVolumeDialog::OnVolumeFilterSelChange(void) OpenVolumeDialog::OnVolumeFilterSelChange(void)
{ {
CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_VOLUME_FILTER); CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_VOLUME_FILTER);
ASSERT(pCombo != nil); ASSERT(pCombo != NULL);
WMSG1("+++ SELECTION IS NOW %d\n", pCombo->GetCurSel()); WMSG1("+++ SELECTION IS NOW %d\n", pCombo->GetCurSel());
LoadDriveList(); LoadDriveList();
} }
@ -638,7 +638,7 @@ OpenVolumeDialog::OnOK(void)
* Figure out the (zero-based) drive letter. * Figure out the (zero-based) drive letter.
*/ */
CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_VOLUME_LIST); CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_VOLUME_LIST);
ASSERT(pListView != nil); ASSERT(pListView != NULL);
if (pListView->GetSelectedCount() != 1) { if (pListView->GetSelectedCount() != 1) {
CString msg, failed; CString msg, failed;
@ -650,7 +650,7 @@ OpenVolumeDialog::OnOK(void)
POSITION posn; POSITION posn;
posn = pListView->GetFirstSelectedItemPosition(); posn = pListView->GetFirstSelectedItemPosition();
if (posn == nil) { if (posn == NULL) {
ASSERT(false); ASSERT(false);
return; return;
} }
@ -732,7 +732,7 @@ void
OpenVolumeDialog::ForceReadOnly(bool readOnly) const OpenVolumeDialog::ForceReadOnly(bool readOnly) const
{ {
CButton* pButton = (CButton*) GetDlgItem(IDC_OPENVOL_READONLY); CButton* pButton = (CButton*) GetDlgItem(IDC_OPENVOL_READONLY);
ASSERT(pButton != nil); ASSERT(pButton != NULL);
if (readOnly) if (readOnly)
pButton->SetCheck(BST_CHECKED); pButton->SetCheck(BST_CHECKED);

View File

@ -16,7 +16,7 @@
*/ */
class PasteSpecialDialog : public CDialog { class PasteSpecialDialog : public CDialog {
public: public:
PasteSpecialDialog(CWnd* pParentWnd = nil) : PasteSpecialDialog(CWnd* pParentWnd = NULL) :
CDialog(IDD_PASTE_SPECIAL, pParentWnd), CDialog(IDD_PASTE_SPECIAL, pParentWnd),
fPasteHow(kPastePaths) fPasteHow(kPastePaths)
{} {}

View File

@ -44,7 +44,7 @@ static const WCHAR kMiscSect[] = L"misc";
* index into the table. * index into the table.
*/ */
const Preferences::PrefMap Preferences::fPrefMaps[kPrefNumLastEntry] = { const Preferences::PrefMap Preferences::fPrefMaps[kPrefNumLastEntry] = {
/**/ { kPrefNumUnknown, kPTNone, nil, nil }, /**/ { kPrefNumUnknown, kPTNone, NULL, NULL },
{ kPrAddIncludeSubFolders, kBool, kAddSect, L"include-sub-folders" }, { kPrAddIncludeSubFolders, kBool, kAddSect, L"include-sub-folders" },
{ kPrAddStripFolderNames, kBool, kAddSect, L"strip-folder-names" }, { kPrAddStripFolderNames, kBool, kAddSect, L"strip-folder-names" },
@ -137,13 +137,13 @@ const Preferences::PrefMap Preferences::fPrefMaps[kPrefNumLastEntry] = {
{ kPrLastOpenFilterIndex, kLong, kMiscSect, L"open-filter-index" }, { kPrLastOpenFilterIndex, kLong, kMiscSect, L"open-filter-index" },
/**/ { kPrefNumLastRegistry, kPTNone, nil, nil }, /**/ { kPrefNumLastRegistry, kPTNone, NULL, NULL },
{ kPrViewTextTypeFace, kString, nil, nil }, { kPrViewTextTypeFace, kString, NULL, NULL },
{ kPrViewTextPointSize, kLong, nil, nil }, { kPrViewTextPointSize, kLong, NULL, NULL },
{ kPrFileViewerWidth, kLong, nil, nil }, { kPrFileViewerWidth, kLong, NULL, NULL },
{ kPrFileViewerHeight, kLong, nil, nil }, { kPrFileViewerHeight, kLong, NULL, NULL },
{ kPrDiskImageCreateFormat, kLong, nil, nil }, { kPrDiskImageCreateFormat, kLong, NULL, NULL },
}; };
/* /*
@ -384,16 +384,16 @@ Preferences::InitFolders(void)
bool bool
Preferences::GetMyDocuments(CString* pPath) Preferences::GetMyDocuments(CString* pPath)
{ {
LPITEMIDLIST pidl = nil; LPITEMIDLIST pidl = NULL;
LPMALLOC lpMalloc = nil; LPMALLOC lpMalloc = NULL;
HRESULT hr; HRESULT hr;
bool result = false; bool result = false;
hr = ::SHGetMalloc(&lpMalloc); hr = ::SHGetMalloc(&lpMalloc);
if (FAILED(hr)) if (FAILED(hr))
return nil; return NULL;
hr = SHGetSpecialFolderLocation(nil, CSIDL_PERSONAL, &pidl); hr = SHGetSpecialFolderLocation(NULL, CSIDL_PERSONAL, &pidl);
if (FAILED(hr)) { if (FAILED(hr)) {
WMSG0("WARNING: unable to get CSIDL_PERSONAL\n"); WMSG0("WARNING: unable to get CSIDL_PERSONAL\n");
goto bail; goto bail;
@ -463,7 +463,7 @@ const WCHAR*
Preferences::GetPrefString(PrefNum num) const Preferences::GetPrefString(PrefNum num) const
{ {
if (!ValidateEntry(num, kString)) if (!ValidateEntry(num, kString))
return nil; return NULL;
return (const WCHAR*) fValues[num]; return (const WCHAR*) fValues[num];
} }
void void
@ -472,8 +472,8 @@ Preferences::SetPrefString(PrefNum num, const WCHAR* str)
if (!ValidateEntry(num, kString)) if (!ValidateEntry(num, kString))
return; return;
free(fValues[num]); free(fValues[num]);
if (str == nil) { if (str == NULL) {
fValues[num] = nil; fValues[num] = NULL;
} else { } else {
fValues[num] = wcsdup(str); fValues[num] = wcsdup(str);
} }
@ -516,8 +516,8 @@ Preferences::ScanPrefMaps(void)
/* look for duplicate strings */ /* look for duplicate strings */
for (i = 0; i < kPrefNumLastEntry; i++) { for (i = 0; i < kPrefNumLastEntry; i++) {
for (j = i+1; j < kPrefNumLastEntry; j++) { for (j = i+1; j < kPrefNumLastEntry; j++) {
if (fPrefMaps[i].registryKey == nil || if (fPrefMaps[i].registryKey == NULL ||
fPrefMaps[j].registryKey == nil) fPrefMaps[j].registryKey == NULL)
{ {
continue; continue;
} }
@ -552,7 +552,7 @@ Preferences::LoadFromRegistry(void)
int i; int i;
for (i = 0; i < kPrefNumLastRegistry; i++) { for (i = 0; i < kPrefNumLastRegistry; i++) {
if (fPrefMaps[i].registryKey == nil) if (fPrefMaps[i].registryKey == NULL)
continue; continue;
switch (fPrefMaps[i].type) { switch (fPrefMaps[i].type) {
@ -593,7 +593,7 @@ Preferences::SaveToRegistry(void)
int i; int i;
for (i = 0; i < kPrefNumLastRegistry; i++) { for (i = 0; i < kPrefNumLastRegistry; i++) {
if (fPrefMaps[i].registryKey == nil) if (fPrefMaps[i].registryKey == NULL)
continue; continue;
switch (fPrefMaps[i].type) { switch (fPrefMaps[i].type) {

View File

@ -11,7 +11,7 @@
* - Add a corresponding entry to Preferences::fPrefMaps, adding a new * - Add a corresponding entry to Preferences::fPrefMaps, adding a new
* section to the registry if appropriate. * section to the registry if appropriate.
* - Add a default value to Preferences::Preferences. If not specified, * - Add a default value to Preferences::Preferences. If not specified,
* strings will be nil and numeric values will be zero. * strings will be NULL and numeric values will be zero.
*/ */
#ifndef APP_PREFERENCES_H #ifndef APP_PREFERENCES_H
#define APP_PREFERENCES_H #define APP_PREFERENCES_H

View File

@ -76,7 +76,7 @@ PrefsGeneralPage::OnDefaults(void)
/* assumes that the controls are numbered sequentially */ /* assumes that the controls are numbered sequentially */
for (int i = 0; i < kNumVisibleColumns; i++) { for (int i = 0; i < kNumVisibleColumns; i++) {
pButton = (CButton*) GetDlgItem(IDC_COL_PATHNAME+i); pButton = (CButton*) GetDlgItem(IDC_COL_PATHNAME+i);
ASSERT(pButton != nil); ASSERT(pButton != NULL);
pButton->SetCheck(1); // 0=unchecked, 1=checked, 2=indeterminate pButton->SetCheck(1); // 0=unchecked, 1=checked, 2=indeterminate
} }
@ -94,13 +94,13 @@ PrefsGeneralPage::OnAssociations(void)
EditAssocDialog assocDlg; EditAssocDialog assocDlg;
assocDlg.fOurAssociations = fOurAssociations; assocDlg.fOurAssociations = fOurAssociations;
fOurAssociations = nil; fOurAssociations = NULL;
if (assocDlg.DoModal() == IDOK) { if (assocDlg.DoModal() == IDOK) {
// steal the modified associations // steal the modified associations
delete[] fOurAssociations; delete[] fOurAssociations;
fOurAssociations = assocDlg.fOurAssociations; fOurAssociations = assocDlg.fOurAssociations;
assocDlg.fOurAssociations = nil; assocDlg.fOurAssociations = NULL;
SetModified(TRUE); SetModified(TRUE);
} }
} }
@ -301,7 +301,7 @@ PrefsCompressionPage::DisableWnd(int id)
{ {
CWnd* pWnd; CWnd* pWnd;
pWnd = GetDlgItem(id); pWnd = GetDlgItem(id);
if (pWnd == nil) { if (pWnd == NULL) {
ASSERT(false); ASSERT(false);
return; return;
} }
@ -378,7 +378,7 @@ PrefsFviewPage::OnInitDialog(void)
//WMSG0("Configuring spin\n"); //WMSG0("Configuring spin\n");
pSpin = (CSpinButtonCtrl*) GetDlgItem(IDC_PVIEW_SIZE_SPIN); pSpin = (CSpinButtonCtrl*) GetDlgItem(IDC_PVIEW_SIZE_SPIN);
ASSERT(pSpin != nil); ASSERT(pSpin != NULL);
UDACCEL uda; UDACCEL uda;
uda.nSec = 0; uda.nSec = 0;
@ -541,7 +541,7 @@ PrefsFilesPage::OnChooseFolder(void)
/* get the currently-showing text from the edit field */ /* get the currently-showing text from the edit field */
pEditWnd = GetDlgItem(IDC_PREF_TEMP_FOLDER); pEditWnd = GetDlgItem(IDC_PREF_TEMP_FOLDER);
ASSERT(pEditWnd != nil); ASSERT(pEditWnd != NULL);
pEditWnd->GetWindowText(editPath); pEditWnd->GetWindowText(editPath);
chooseDir.SetPathName(editPath); chooseDir.SetPathName(editPath);

View File

@ -28,7 +28,7 @@ public:
fCoerceDOSFilenames(FALSE), fCoerceDOSFilenames(FALSE),
fSpacesToUnder(FALSE), fSpacesToUnder(FALSE),
fDefaultsPushed(FALSE), fDefaultsPushed(FALSE),
fOurAssociations(nil) fOurAssociations(NULL)
{} {}
virtual ~PrefsGeneralPage(void) { virtual ~PrefsGeneralPage(void) {
delete[] fOurAssociations; delete[] fOurAssociations;

View File

@ -27,8 +27,8 @@
void void
PrintStuff::InitBasics(CDC* pDC) PrintStuff::InitBasics(CDC* pDC)
{ {
ASSERT(pDC != nil); ASSERT(pDC != NULL);
ASSERT(fpDC == nil); ASSERT(fpDC == NULL);
fpDC = pDC; fpDC = pDC;
@ -50,9 +50,9 @@ PrintStuff::InitBasics(CDC* pDC)
void void
PrintStuff::CreateFontByNumLines(CFont* pFont, int numLines) PrintStuff::CreateFontByNumLines(CFont* pFont, int numLines)
{ {
ASSERT(pFont != nil); ASSERT(pFont != NULL);
ASSERT(numLines > 0); ASSERT(numLines > 0);
ASSERT(fpDC != nil); ASSERT(fpDC != NULL);
/* required height */ /* required height */
int reqCharHeight; int reqCharHeight;
@ -172,7 +172,7 @@ void
PrintContentList::CalcNumPages(void) PrintContentList::CalcNumPages(void)
{ {
/* set up our local goodies */ /* set up our local goodies */
ASSERT(fpContentList != nil); ASSERT(fpContentList != NULL);
int numLines = fpContentList->GetItemCount(); int numLines = fpContentList->GetItemCount();
ASSERT(numLines > 0); ASSERT(numLines > 0);
@ -270,7 +270,7 @@ bail:
// destroy print-cancel dialog and restore main window // destroy print-cancel dialog and restore main window
fpParentWnd->EnableWindow(TRUE); fpParentWnd->EnableWindow(TRUE);
//fpParentWnd->SetActiveWindow(); //fpParentWnd->SetActiveWindow();
if (pPCD != nil) if (pPCD != NULL)
pPCD->DestroyWindow(); pPCD->DestroyWindow();
return result; return result;
@ -437,7 +437,7 @@ void
PrintRichEdit::Setup(CDC* pDC, CWnd* pParent) PrintRichEdit::Setup(CDC* pDC, CWnd* pParent)
{ {
/* preflighting can cause this to be initialized twice */ /* preflighting can cause this to be initialized twice */
fpDC = nil; fpDC = NULL;
/* init base class */ /* init base class */
InitBasics(pDC); InitBasics(pDC);
@ -485,7 +485,7 @@ PrintRichEdit::PrintAll(CRichEditCtrl* pREC, const WCHAR* title)
fEndChar = -1; fEndChar = -1;
fStartPage = 0; fStartPage = 0;
fEndPage = -1; fEndPage = -1;
return StartPrint(pREC, title, nil, true); return StartPrint(pREC, title, NULL, true);
} }
/* /*
@ -499,7 +499,7 @@ PrintRichEdit::PrintPages(CRichEditCtrl* pREC, const WCHAR* title,
fEndChar = -1; fEndChar = -1;
fStartPage = startPage; fStartPage = startPage;
fEndPage = endPage; fEndPage = endPage;
return StartPrint(pREC, title, nil, true); return StartPrint(pREC, title, NULL, true);
} }
/* /*
@ -513,7 +513,7 @@ PrintRichEdit::PrintSelection(CRichEditCtrl* pREC, const WCHAR* title,
fEndChar = endChar; fEndChar = endChar;
fStartPage = 0; fStartPage = 0;
fEndPage = -1; fEndPage = -1;
return StartPrint(pREC, title, nil, true); return StartPrint(pREC, title, NULL, true);
} }
/* /*
@ -523,7 +523,7 @@ int
PrintRichEdit::StartPrint(CRichEditCtrl* pREC, const WCHAR* title, PrintRichEdit::StartPrint(CRichEditCtrl* pREC, const WCHAR* title,
int* pNumPages, bool doPrint) int* pNumPages, bool doPrint)
{ {
CancelDialog* pPCD = nil; CancelDialog* pPCD = NULL;
MainWindow* pMain = (MainWindow*)::AfxGetMainWnd(); MainWindow* pMain = (MainWindow*)::AfxGetMainWnd();
int result; int result;
@ -547,7 +547,7 @@ PrintRichEdit::StartPrint(CRichEditCtrl* pREC, const WCHAR* title,
if (doPrint) { if (doPrint) {
fpParentWnd->EnableWindow(TRUE); fpParentWnd->EnableWindow(TRUE);
if (pPCD != nil) if (pPCD != NULL)
pPCD->DestroyWindow(); pPCD->DestroyWindow();
} }
@ -806,14 +806,14 @@ PrintRichEdit::DoPrint(CRichEditCtrl* pREC, const WCHAR* title,
} }
} while (textPrinted < textLength); } while (textPrinted < textLength);
//WMSG0(" +++ calling FormatRange(nil, FALSE)\n"); //WMSG0(" +++ calling FormatRange(NULL, FALSE)\n");
pREC->FormatRange(nil, FALSE); pREC->FormatRange(NULL, FALSE);
//WMSG0(" +++ returned from final FormatRange\n"); //WMSG0(" +++ returned from final FormatRange\n");
if (doPrint) if (doPrint)
fpDC->EndDoc(); fpDC->EndDoc();
if (pNumPages != nil) if (pNumPages != NULL)
*pNumPages = pageNum; *pNumPages = pageNum;
WMSG1("Printing completed (textPrinted=%ld)\n", textPrinted); WMSG1("Printing completed (textPrinted=%ld)\n", textPrinted);

View File

@ -18,7 +18,7 @@
*/ */
class PrintStuff { class PrintStuff {
protected: protected:
PrintStuff(void) : fpDC(nil) {} PrintStuff(void) : fpDC(NULL) {}
virtual ~PrintStuff(void) {} virtual ~PrintStuff(void) {}
/* get basic goodies, based on the DC */ /* get basic goodies, based on the DC */
@ -58,7 +58,7 @@ protected:
*/ */
class PrintContentList : public PrintStuff { class PrintContentList : public PrintStuff {
public: public:
PrintContentList(void) : fpContentList(nil), fCLLinesPerPage(0) {} PrintContentList(void) : fpContentList(NULL), fCLLinesPerPage(0) {}
virtual ~PrintContentList(void) {} virtual ~PrintContentList(void) {}
/* set the DC and the parent window (for the cancel box) */ /* set the DC and the parent window (for the cancel box) */
@ -103,7 +103,7 @@ private:
*/ */
class PrintRichEdit : public PrintStuff { class PrintRichEdit : public PrintStuff {
public: public:
PrintRichEdit(void) : fInitialized(false), fpParentWnd(nil) {} PrintRichEdit(void) : fInitialized(false), fpParentWnd(NULL) {}
virtual ~PrintRichEdit(void) {} virtual ~PrintRichEdit(void) {}
/* set the DC and the parent window (for the cancel box) */ /* set the DC and the parent window (for the cancel box) */

View File

@ -31,7 +31,7 @@ public:
} }
/* enable the parent window before we're destroyed */ /* enable the parent window before we're destroyed */
virtual BOOL DestroyWindow(void) { virtual BOOL DestroyWindow(void) {
if (fpParentWnd != nil) if (fpParentWnd != NULL)
fpParentWnd->EnableWindow(TRUE); fpParentWnd->EnableWindow(TRUE);
return ModelessDialog::DestroyWindow(); return ModelessDialog::DestroyWindow();
} }

View File

@ -56,7 +56,7 @@ RecompressOptionsDialog::LoadComboBox(NuThreadFormat fmt)
int retIdx = 0; int retIdx = 0;
pCombo = (CComboBox*) GetDlgItem(IDC_RECOMP_COMP); pCombo = (CComboBox*) GetDlgItem(IDC_RECOMP_COMP);
ASSERT(pCombo != nil); ASSERT(pCombo != NULL);
for (idx = comboIdx = 0; idx < NELEM(kComboStrings); idx++) { for (idx = comboIdx = 0; idx < NELEM(kComboStrings); idx++) {
if (NufxArchive::IsCompressionSupported(kComboStrings[idx].format)) { if (NufxArchive::IsCompressionSupported(kComboStrings[idx].format)) {
@ -84,7 +84,7 @@ RecompressOptionsDialog::DoDataExchange(CDataExchange* pDX)
if (pDX->m_bSaveAndValidate) { if (pDX->m_bSaveAndValidate) {
CComboBox* pCombo; CComboBox* pCombo;
pCombo = (CComboBox*) GetDlgItem(IDC_RECOMP_COMP); pCombo = (CComboBox*) GetDlgItem(IDC_RECOMP_COMP);
ASSERT(pCombo != nil); ASSERT(pCombo != NULL);
fCompressionType = pCombo->GetItemData(fCompressionIdx); fCompressionType = pCombo->GetItemData(fCompressionIdx);
WMSG2("DDX got type=%d from combo index %d\n", WMSG2("DDX got type=%d from combo index %d\n",

View File

@ -230,7 +230,7 @@ void
MyRegistry::FixBasicSettings(void) const MyRegistry::FixBasicSettings(void) const
{ {
const WCHAR* exeName = gMyApp.GetExeFileName(); const WCHAR* exeName = gMyApp.GetExeFileName();
ASSERT(exeName != nil && wcslen(exeName) > 0); ASSERT(exeName != NULL && wcslen(exeName) > 0);
WMSG0("Fixing any missing file type AppID entries in registry\n"); WMSG0("Fixing any missing file type AppID entries in registry\n");
@ -248,8 +248,8 @@ MyRegistry::ConfigureAppID(const WCHAR* appID, const WCHAR* descr,
{ {
WMSG2(" Configuring '%ls' for '%ls'\n", appID, exeName); WMSG2(" Configuring '%ls' for '%ls'\n", appID, exeName);
HKEY hAppKey = nil; HKEY hAppKey = NULL;
HKEY hIconKey = nil; HKEY hIconKey = NULL;
DWORD dw; DWORD dw;
if (RegCreateKeyEx(HKEY_CLASSES_ROOT, appID, 0, REG_NONE, if (RegCreateKeyEx(HKEY_CLASSES_ROOT, appID, 0, REG_NONE,
@ -267,7 +267,7 @@ MyRegistry::ConfigureAppID(const WCHAR* appID, const WCHAR* descr,
long res; long res;
size = sizeof(buf); // size in bytes size = sizeof(buf); // size in bytes
res = RegQueryValueEx(hIconKey, L"", nil, &type, buf, &size); res = RegQueryValueEx(hIconKey, L"", NULL, &type, buf, &size);
if (res == ERROR_SUCCESS && size > 1) { if (res == ERROR_SUCCESS && size > 1) {
WMSG1(" Icon for '%ls' already exists, not altering\n", appID); WMSG1(" Icon for '%ls' already exists, not altering\n", appID);
} else { } else {
@ -307,10 +307,10 @@ MyRegistry::ConfigureAppIDSubFields(HKEY hAppKey, const WCHAR* descr,
HKEY hShellKey, hOpenKey, hCommandKey; HKEY hShellKey, hOpenKey, hCommandKey;
DWORD dw; DWORD dw;
ASSERT(hAppKey != nil); ASSERT(hAppKey != NULL);
ASSERT(descr != nil); ASSERT(descr != NULL);
ASSERT(exeName != nil); ASSERT(exeName != NULL);
hShellKey = hOpenKey = hCommandKey = nil; hShellKey = hOpenKey = hCommandKey = NULL;
if (RegSetValueEx(hAppKey, L"", 0, REG_SZ, (const BYTE*) descr, if (RegSetValueEx(hAppKey, L"", 0, REG_SZ, (const BYTE*) descr,
wcslen(descr) * sizeof(WCHAR)) != ERROR_SUCCESS) wcslen(descr) * sizeof(WCHAR)) != ERROR_SUCCESS)
@ -335,7 +335,7 @@ MyRegistry::ConfigureAppIDSubFields(HKEY hAppKey, const WCHAR* descr,
long res; long res;
size = sizeof(buf); // size in bytes size = sizeof(buf); // size in bytes
res = RegQueryValueEx(hCommandKey, L"", nil, &type, (LPBYTE) buf, res = RegQueryValueEx(hCommandKey, L"", NULL, &type, (LPBYTE) buf,
&size); &size);
if (res == ERROR_SUCCESS && size > 1) { if (res == ERROR_SUCCESS && size > 1) {
WMSG1(" Command already exists, not altering ('%ls')\n", buf); WMSG1(" Command already exists, not altering ('%ls')\n", buf);
@ -423,7 +423,7 @@ MyRegistry::GetFileAssoc(int idx, CString* pExt, CString* pHandler,
*pHandler = ""; *pHandler = "";
CString appID; CString appID;
HKEY hExtKey = nil; HKEY hExtKey = NULL;
res = RegOpenKeyEx(HKEY_CLASSES_ROOT, *pExt, 0, KEY_READ, &hExtKey); res = RegOpenKeyEx(HKEY_CLASSES_ROOT, *pExt, 0, KEY_READ, &hExtKey);
if (res == ERROR_SUCCESS) { if (res == ERROR_SUCCESS) {
@ -431,7 +431,7 @@ MyRegistry::GetFileAssoc(int idx, CString* pExt, CString* pHandler,
DWORD type; DWORD type;
DWORD size = sizeof(buf); // size in bytes DWORD size = sizeof(buf); // size in bytes
res = RegQueryValueEx(hExtKey, L"", nil, &type, (LPBYTE)buf, &size); res = RegQueryValueEx(hExtKey, L"", NULL, &type, (LPBYTE)buf, &size);
if (res == ERROR_SUCCESS) { if (res == ERROR_SUCCESS) {
WMSG1(" Got '%ls'\n", buf); WMSG1(" Got '%ls'\n", buf);
appID = buf; appID = buf;
@ -465,7 +465,7 @@ MyRegistry::GetAssocAppName(const CString& appID, CString* pCmd) const
{ {
CString keyName; CString keyName;
WCHAR buf[260]; WCHAR buf[260];
HKEY hAppKey = nil; HKEY hAppKey = NULL;
long res; long res;
int result = -1; int result = -1;
@ -476,7 +476,7 @@ MyRegistry::GetAssocAppName(const CString& appID, CString* pCmd) const
DWORD type; DWORD type;
DWORD size = sizeof(buf); // size in bytes DWORD size = sizeof(buf); // size in bytes
res = RegQueryValueEx(hAppKey, L"", nil, &type, (LPBYTE) buf, &size); res = RegQueryValueEx(hAppKey, L"", NULL, &type, (LPBYTE) buf, &size);
if (res == ERROR_SUCCESS) { if (res == ERROR_SUCCESS) {
CString cmd(buf); CString cmd(buf);
int pos; int pos;
@ -574,7 +574,7 @@ bool
MyRegistry::GetAssocState(const WCHAR* ext) const MyRegistry::GetAssocState(const WCHAR* ext) const
{ {
WCHAR buf[260]; WCHAR buf[260];
HKEY hExtKey = nil; HKEY hExtKey = NULL;
int res; int res;
bool result = false; bool result = false;
@ -582,7 +582,7 @@ MyRegistry::GetAssocState(const WCHAR* ext) const
if (res == ERROR_SUCCESS) { if (res == ERROR_SUCCESS) {
DWORD type; DWORD type;
DWORD size = sizeof(buf); // size in bytes DWORD size = sizeof(buf); // size in bytes
res = RegQueryValueEx(hExtKey, L"", nil, &type, (LPBYTE) buf, &size); res = RegQueryValueEx(hExtKey, L"", NULL, &type, (LPBYTE) buf, &size);
if (res == ERROR_SUCCESS && type == REG_SZ) { if (res == ERROR_SUCCESS && type == REG_SZ) {
/* compare it to known appID values */ /* compare it to known appID values */
WMSG2(" Found '%ls', testing '%ls'\n", ext, buf); WMSG2(" Found '%ls', testing '%ls'\n", ext, buf);
@ -605,9 +605,9 @@ MyRegistry::GetAssocState(const WCHAR* ext) const
int int
MyRegistry::DisownExtension(const WCHAR* ext) const MyRegistry::DisownExtension(const WCHAR* ext) const
{ {
ASSERT(ext != nil); ASSERT(ext != NULL);
ASSERT(ext[0] == '.'); ASSERT(ext[0] == '.');
if (ext == nil || wcslen(ext) < 2) if (ext == NULL || wcslen(ext) < 2)
return -1; return -1;
if (RegDeleteKeyNT(HKEY_CLASSES_ROOT, ext) == ERROR_SUCCESS) { if (RegDeleteKeyNT(HKEY_CLASSES_ROOT, ext) == ERROR_SUCCESS) {
@ -628,12 +628,12 @@ MyRegistry::DisownExtension(const WCHAR* ext) const
int int
MyRegistry::OwnExtension(const WCHAR* ext, const WCHAR* appID) const MyRegistry::OwnExtension(const WCHAR* ext, const WCHAR* appID) const
{ {
ASSERT(ext != nil); ASSERT(ext != NULL);
ASSERT(ext[0] == '.'); ASSERT(ext[0] == '.');
if (ext == nil || wcslen(ext) < 2) if (ext == NULL || wcslen(ext) < 2)
return -1; return -1;
HKEY hExtKey = nil; HKEY hExtKey = NULL;
DWORD dw; DWORD dw;
int res, result = -1; int res, result = -1;

View File

@ -55,7 +55,7 @@ RenameEntryDialog::OnInitDialog(void)
/* select the editable text and set the focus */ /* select the editable text and set the focus */
pEdit = (CEdit*) GetDlgItem(IDC_RENAME_NEW); pEdit = (CEdit*) GetDlgItem(IDC_RENAME_NEW);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
pEdit->SetSel(0, -1); pEdit->SetSel(0, -1);
pEdit->SetFocus(); pEdit->SetFocus();

View File

@ -30,8 +30,8 @@ public:
{ {
fFssep = '='; fFssep = '=';
//fNewNameLimit = 0; //fNewNameLimit = 0;
fpArchive = nil; fpArchive = NULL;
fpEntry = nil; fpEntry = NULL;
fCanRenameFullPath = false; fCanRenameFullPath = false;
fCanChangeFssep = false; fCanChangeFssep = false;
} }

View File

@ -37,7 +37,7 @@ RenameVolumeDialog::OnInitDialog(void)
CTreeCtrl* pTree = (CTreeCtrl*) GetDlgItem(IDC_RENAMEVOL_TREE); CTreeCtrl* pTree = (CTreeCtrl*) GetDlgItem(IDC_RENAMEVOL_TREE);
DiskImgLib::DiskFS* pDiskFS = fpArchive->GetDiskFS(); DiskImgLib::DiskFS* pDiskFS = fpArchive->GetDiskFS();
ASSERT(pTree != nil); ASSERT(pTree != NULL);
fDiskFSTree.fIncludeSubdirs = false; fDiskFSTree.fIncludeSubdirs = false;
fDiskFSTree.fExpandDepth = -1; fDiskFSTree.fExpandDepth = -1;
@ -51,7 +51,7 @@ RenameVolumeDialog::OnInitDialog(void)
/* select the default text and set the focus */ /* select the default text and set the focus */
CEdit* pEdit = (CEdit*) GetDlgItem(IDC_RENAMEVOL_NEW); CEdit* pEdit = (CEdit*) GetDlgItem(IDC_RENAMEVOL_NEW);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
pEdit->SetSel(0, -1); pEdit->SetSel(0, -1);
pEdit->SetFocus(); pEdit->SetFocus();
@ -84,7 +84,7 @@ RenameVolumeDialog::DoDataExchange(CDataExchange* pDX)
HTREEITEM selected; HTREEITEM selected;
selected = pTree->GetSelectedItem(); selected = pTree->GetSelectedItem();
if (selected == nil) { if (selected == NULL) {
errMsg = "Please select a disk to rename."; errMsg = "Please select a disk to rename.";
MessageBox(errMsg, appName, MB_OK); MessageBox(errMsg, appName, MB_OK);
pDX->Fail(); pDX->Fail();
@ -142,7 +142,7 @@ RenameVolumeDialog::OnSelChanged(NMHDR* pnmh, LRESULT* pResult)
CString newText; CString newText;
selected = pTree->GetSelectedItem(); selected = pTree->GetSelectedItem();
if (selected != nil) { if (selected != NULL) {
DiskFSTree::TargetData* pTargetData; DiskFSTree::TargetData* pTargetData;
pTargetData = (DiskFSTree::TargetData*) pTree->GetItemData(selected); pTargetData = (DiskFSTree::TargetData*) pTree->GetItemData(selected);
if (pTargetData->selectable) { if (pTargetData->selectable) {
@ -153,7 +153,7 @@ RenameVolumeDialog::OnSelChanged(NMHDR* pnmh, LRESULT* pResult)
} }
CEdit* pEdit = (CEdit*) GetDlgItem(IDC_RENAMEVOL_NEW); CEdit* pEdit = (CEdit*) GetDlgItem(IDC_RENAMEVOL_NEW);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
pEdit->SetWindowText(newText); pEdit->SetWindowText(newText);
pEdit->SetSel(0, -1); pEdit->SetSel(0, -1);

View File

@ -23,7 +23,7 @@ public:
RenameVolumeDialog(CWnd* pParentWnd = NULL) : RenameVolumeDialog(CWnd* pParentWnd = NULL) :
CDialog(IDD_RENAME_VOLUME, pParentWnd) CDialog(IDD_RENAME_VOLUME, pParentWnd)
{ {
fpArchive = nil; fpArchive = NULL;
} }
virtual ~RenameVolumeDialog(void) {} virtual ~RenameVolumeDialog(void) {}

View File

@ -112,9 +112,9 @@ SQRead(FILE* fp, void* buf, size_t nbyte)
{ {
size_t result; size_t result;
ASSERT(buf != nil); ASSERT(buf != NULL);
ASSERT(nbyte > 0); ASSERT(nbyte > 0);
ASSERT(fp != nil); ASSERT(fp != NULL);
errno = 0; errno = 0;
result = fread(buf, 1, nbyte, fp); result = fread(buf, 1, nbyte, fp);
@ -130,7 +130,7 @@ SQRead(FILE* fp, void* buf, size_t nbyte)
* Because we have a stop symbol, knowing the uncompressed length of * Because we have a stop symbol, knowing the uncompressed length of
* the file is not essential. * the file is not essential.
* *
* If "outExp" is nil, no output is produced (useful for "test" mode). * If "outExp" is NULL, no output is produced (useful for "test" mode).
*/ */
NuError NuError
UnSqueeze(FILE* fp, unsigned long realEOF, ExpandBuffer* outExp, UnSqueeze(FILE* fp, unsigned long realEOF, ExpandBuffer* outExp,
@ -142,11 +142,11 @@ UnSqueeze(FILE* fp, unsigned long realEOF, ExpandBuffer* outExp,
unsigned short magic, fileChecksum, checksum; // fullSqHeader only unsigned short magic, fileChecksum, checksum; // fullSqHeader only
short nodeCount; short nodeCount;
int i, inrep; int i, inrep;
unsigned char* tmpBuf = nil; unsigned char* tmpBuf = NULL;
unsigned char lastc = 0; unsigned char lastc = 0;
tmpBuf = (unsigned char*) malloc(kSqBufferSize); tmpBuf = (unsigned char*) malloc(kSqBufferSize);
if (tmpBuf == nil) { if (tmpBuf == NULL) {
err = kNuErrMalloc; err = kNuErrMalloc;
goto bail; goto bail;
} }
@ -340,9 +340,9 @@ UnSqueeze(FILE* fp, unsigned long realEOF, ExpandBuffer* outExp,
val = 2; val = 2;
} }
while (--val) { while (--val) {
/*if (pCrc != nil) /*if (pCrc != NULL)
*pCrc = Nu_CalcCRC16(*pCrc, &lastc, 1);*/ *pCrc = Nu_CalcCRC16(*pCrc, &lastc, 1);*/
if (outExp != nil) if (outExp != NULL)
outExp->Putc(lastc); outExp->Putc(lastc);
if (fullSqHeader) { if (fullSqHeader) {
checksum += lastc; checksum += lastc;
@ -356,9 +356,9 @@ UnSqueeze(FILE* fp, unsigned long realEOF, ExpandBuffer* outExp,
inrep = true; inrep = true;
} else { } else {
lastc = val; lastc = val;
/*if (pCrc != nil) /*if (pCrc != NULL)
*pCrc = Nu_CalcCRC16(*pCrc, &lastc, 1);*/ *pCrc = Nu_CalcCRC16(*pCrc, &lastc, 1);*/
if (outExp != nil) if (outExp != NULL)
outExp->Putc(lastc); outExp->Putc(lastc);
if (fullSqHeader) { if (fullSqHeader) {
checksum += lastc; checksum += lastc;
@ -404,7 +404,7 @@ UnSqueeze(FILE* fp, unsigned long realEOF, ExpandBuffer* outExp,
} }
bail: bail:
//if (outfp != nil) //if (outfp != NULL)
// fflush(outfp); // fflush(outfp);
free(tmpBuf); free(tmpBuf);
return err; return err;

View File

@ -25,18 +25,18 @@ END_MESSAGE_MAP()
BOOL BOOL
SubVolumeDialog::OnInitDialog(void) SubVolumeDialog::OnInitDialog(void)
{ {
ASSERT(fpDiskFS != nil); ASSERT(fpDiskFS != NULL);
CListBox* pListBox = (CListBox*) GetDlgItem(IDC_SUBV_LIST); CListBox* pListBox = (CListBox*) GetDlgItem(IDC_SUBV_LIST);
ASSERT(pListBox != nil); ASSERT(pListBox != NULL);
// if (pListBox->SetTabStops(12) != TRUE) { // if (pListBox->SetTabStops(12) != TRUE) {
// ASSERT(false); // ASSERT(false);
// } // }
DiskFS::SubVolume* pSubVol = fpDiskFS->GetNextSubVolume(nil); DiskFS::SubVolume* pSubVol = fpDiskFS->GetNextSubVolume(NULL);
ASSERT(pSubVol != nil); // shouldn't be here otherwise ASSERT(pSubVol != NULL); // shouldn't be here otherwise
while (pSubVol != nil) { while (pSubVol != NULL) {
CString volumeIdW(pSubVol->GetDiskFS()->GetVolumeID()); CString volumeIdW(pSubVol->GetDiskFS()->GetVolumeID());
pListBox->AddString(volumeIdW); // makes a copy of the string pListBox->AddString(volumeIdW); // makes a copy of the string

View File

@ -30,7 +30,7 @@
* Put up the ImageFormatDialog and apply changes to "pImg". * Put up the ImageFormatDialog and apply changes to "pImg".
* *
* "*pDisplayFormat" gets the result of user changes to the display format. * "*pDisplayFormat" gets the result of user changes to the display format.
* If "pDisplayFormat" is nil, the "query image format" feature will be * If "pDisplayFormat" is NULL, the "query image format" feature will be
* disabled. * disabled.
* *
* Returns IDCANCEL if the user cancelled out of the dialog, IDOK otherwise. * Returns IDCANCEL if the user cancelled out of the dialog, IDOK otherwise.
@ -47,7 +47,7 @@ MainWindow::TryDiskImgOverride(DiskImg* pImg, const WCHAR* fileSource,
imf.InitializeValues(pImg); imf.InitializeValues(pImg);
imf.fFileSource = fileSource; imf.fFileSource = fileSource;
imf.fAllowUnknown = allowUnknown; imf.fAllowUnknown = allowUnknown;
if (pDisplayFormat == nil) if (pDisplayFormat == NULL)
imf.SetQueryDisplayFormat(false); imf.SetQueryDisplayFormat(false);
/* don't show "unknown format" if we have a default value */ /* don't show "unknown format" if we have a default value */
@ -68,7 +68,7 @@ MainWindow::TryDiskImgOverride(DiskImg* pImg, const WCHAR* fileSource,
WMSG2(" On exit, sectord=%d format=%d\n", WMSG2(" On exit, sectord=%d format=%d\n",
imf.fSectorOrder, imf.fFSFormat); imf.fSectorOrder, imf.fFSFormat);
if (pDisplayFormat != nil) if (pDisplayFormat != NULL)
*pDisplayFormat = imf.fDisplayFormat; *pDisplayFormat = imf.fDisplayFormat;
if (imf.fSectorOrder != pImg->GetSectorOrder() || if (imf.fSectorOrder != pImg->GetSectorOrder() ||
imf.fFSFormat != pImg->GetFSFormat()) imf.fFSFormat != pImg->GetFSFormat())
@ -120,7 +120,7 @@ MainWindow::OnToolsDiskEdit(void)
failed.LoadString(IDS_FAILED); failed.LoadString(IDS_FAILED);
diskEditOpen.fArchiveOpen = false; diskEditOpen.fArchiveOpen = false;
if (fpOpenArchive != nil && if (fpOpenArchive != NULL &&
fpOpenArchive->GetArchiveKind() == GenericArchive::kArchiveDiskImage) fpOpenArchive->GetArchiveKind() == GenericArchive::kArchiveDiskImage)
{ {
diskEditOpen.fArchiveOpen = true; diskEditOpen.fArchiveOpen = true;
@ -190,7 +190,7 @@ MainWindow::OnToolsDiskEdit(void)
long length; long length;
tmpfp = fopen(loadName, "rb"); tmpfp = fopen(loadName, "rb");
ASSERT(tmpfp != nil); ASSERT(tmpfp != NULL);
fseek(tmpfp, 0, SEEK_END); fseek(tmpfp, 0, SEEK_END);
length = ftell(tmpfp); length = ftell(tmpfp);
rewind(tmpfp); rewind(tmpfp);
@ -307,7 +307,7 @@ MainWindow::OnToolsDiskEdit(void)
*/ */
DiskFS* pDiskFS; DiskFS* pDiskFS;
pDiskFS = img.OpenAppropriateDiskFS(true); pDiskFS = img.OpenAppropriateDiskFS(true);
if (pDiskFS == nil) { if (pDiskFS == NULL) {
WMSG0("HEY: OpenAppropriateDiskFS failed!\n"); WMSG0("HEY: OpenAppropriateDiskFS failed!\n");
goto bail; goto bail;
} }
@ -413,7 +413,7 @@ MainWindow::OnToolsDiskConv(void)
fPreferences.GetPrefBool(kPrQueryImageFormat)) fPreferences.GetPrefBool(kPrQueryImageFormat))
{ {
if (TryDiskImgOverride(&srcImg, loadName, DiskImg::kFormatGenericProDOSOrd, if (TryDiskImgOverride(&srcImg, loadName, DiskImg::kFormatGenericProDOSOrd,
nil, false, &errMsg) != IDOK) NULL, false, &errMsg) != IDOK)
{ {
goto bail; goto bail;
} }
@ -492,7 +492,7 @@ MainWindow::OnToolsDiskConv(void)
const DiskImg::NibbleDescr* pNibbleDescr; const DiskImg::NibbleDescr* pNibbleDescr;
pNibbleDescr = srcImg.GetNibbleDescr(); pNibbleDescr = srcImg.GetNibbleDescr();
if (pNibbleDescr == nil && DiskImg::IsNibbleFormat(physicalFormat)) { if (pNibbleDescr == NULL && DiskImg::IsNibbleFormat(physicalFormat)) {
/* /*
* We're writing to a nibble format, so we have to decide how the * We're writing to a nibble format, so we have to decide how the
* disk should be formatted. The source doesn't specify it, so we * disk should be formatted. The source doesn't specify it, so we
@ -508,7 +508,7 @@ MainWindow::OnToolsDiskConv(void)
} }
} }
WMSG2(" NibbleDescr is 0x%08lx (%hs)\n", (long) pNibbleDescr, WMSG2(" NibbleDescr is 0x%08lx (%hs)\n", (long) pNibbleDescr,
pNibbleDescr != nil ? pNibbleDescr->description : "---"); pNibbleDescr != NULL ? pNibbleDescr->description : "---");
if (srcImg.GetFileFormat() == DiskImg::kFileFormatTrackStar && if (srcImg.GetFileFormat() == DiskImg::kFileFormatTrackStar &&
fileFormat != DiskImg::kFileFormatTrackStar) fileFormat != DiskImg::kFileFormatTrackStar)
@ -723,7 +723,7 @@ MainWindow::OnToolsDiskConv(void)
/* /*
* Do the actual copy, either as blocks or tracks. * Do the actual copy, either as blocks or tracks.
*/ */
dierr = CopyDiskImage(&dstImg, &srcImg, false, isPartial, nil); dierr = CopyDiskImage(&dstImg, &srcImg, false, isPartial, NULL);
if (dierr != kDIErrNone) { if (dierr != kDIErrNone) {
errMsg.Format(L"Copy failed: %hs.", DiskImgLib::DIStrError(dierr)); errMsg.Format(L"Copy failed: %hs.", DiskImgLib::DIStrError(dierr));
ShowFailureMsg(this, errMsg, IDS_FAILED); ShowFailureMsg(this, errMsg, IDS_FAILED);
@ -872,7 +872,7 @@ MainWindow::CopyDiskImage(DiskImg* pDstImg, DiskImg* pSrcImg, bool bulk,
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
CString errMsg; CString errMsg;
unsigned char* dataBuf = nil; unsigned char* dataBuf = NULL;
if (pSrcImg->GetHasNibbles() && pDstImg->GetHasNibbles() && if (pSrcImg->GetHasNibbles() && pDstImg->GetHasNibbles() &&
pSrcImg->GetPhysicalFormat() == pDstImg->GetPhysicalFormat()) pSrcImg->GetPhysicalFormat() == pDstImg->GetPhysicalFormat())
@ -892,7 +892,7 @@ MainWindow::CopyDiskImage(DiskImg* pDstImg, DiskImg* pSrcImg, bool bulk,
int numTracks; int numTracks;
dataBuf = new unsigned char[kTrackAllocSize]; dataBuf = new unsigned char[kTrackAllocSize];
if (dataBuf == nil) { if (dataBuf == NULL) {
dierr = kDIErrMalloc; dierr = kDIErrMalloc;
goto bail; goto bail;
} }
@ -930,7 +930,7 @@ MainWindow::CopyDiskImage(DiskImg* pDstImg, DiskImg* pSrcImg, bool bulk,
int numBadSectors = 0; int numBadSectors = 0;
dataBuf = new unsigned char[256]; // one sector dataBuf = new unsigned char[256]; // one sector
if (dataBuf == nil) { if (dataBuf == NULL) {
dierr = kDIErrMalloc; dierr = kDIErrMalloc;
goto bail; goto bail;
} }
@ -988,7 +988,7 @@ MainWindow::CopyDiskImage(DiskImg* pDstImg, DiskImg* pSrcImg, bool bulk,
blocksPerRead = 64; // 32K per read; max seems to be 64K? blocksPerRead = 64; // 32K per read; max seems to be 64K?
dataBuf = new unsigned char[blocksPerRead * 512]; dataBuf = new unsigned char[blocksPerRead * 512];
if (dataBuf == nil) { if (dataBuf == NULL) {
dierr = kDIErrMalloc; dierr = kDIErrMalloc;
goto bail; goto bail;
} }
@ -1026,7 +1026,7 @@ MainWindow::CopyDiskImage(DiskImg* pDstImg, DiskImg* pSrcImg, bool bulk,
} }
/* if we have a cancel dialog, keep it lively */ /* if we have a cancel dialog, keep it lively */
if (pPCDialog != nil && (block % 18) == 0) { if (pPCDialog != NULL && (block % 18) == 0) {
int status; int status;
PeekAndPump(); PeekAndPump();
LONGLONG bigBlock = block; LONGLONG bigBlock = block;
@ -1077,7 +1077,7 @@ public:
void SetCurrentFile(const WCHAR* fileName) { void SetCurrentFile(const WCHAR* fileName) {
CWnd* pWnd = GetDlgItem(IDC_BULKCONV_PATHNAME); CWnd* pWnd = GetDlgItem(IDC_BULKCONV_PATHNAME);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->SetWindowText(fileName); pWnd->SetWindowText(fileName);
} }
@ -1137,7 +1137,7 @@ MainWindow::OnToolsBulkDiskConv(void)
POSITION posn; POSITION posn;
posn = dlg.GetStartPosition(); posn = dlg.GetStartPosition();
nameCount = 0; nameCount = 0;
while (posn != nil) { while (posn != NULL) {
CString pathName; CString pathName;
pathName = dlg.GetNextPathName(posn); pathName = dlg.GetNextPathName(posn);
nameCount++; nameCount++;
@ -1181,7 +1181,7 @@ MainWindow::OnToolsBulkDiskConv(void)
* Loop through all selected files and convert them one at a time. * Loop through all selected files and convert them one at a time.
*/ */
posn = dlg.GetStartPosition(); posn = dlg.GetStartPosition();
while (posn != nil) { while (posn != NULL) {
CString pathName; CString pathName;
pathName = dlg.GetNextPathName(posn); pathName = dlg.GetNextPathName(posn);
WMSG1(" BulkConv: source path='%ls'\n", (LPCWSTR) pathName); WMSG1(" BulkConv: source path='%ls'\n", (LPCWSTR) pathName);
@ -1219,7 +1219,7 @@ bail:
// restore the main window to prominence // restore the main window to prominence
EnableWindow(TRUE); EnableWindow(TRUE);
//SetActiveWindow(); //SetActiveWindow();
if (pCancelDialog != nil) if (pCancelDialog != NULL)
pCancelDialog->DestroyWindow(); pCancelDialog->DestroyWindow();
delete[] dlg.m_ofn.lpstrFile; delete[] dlg.m_ofn.lpstrFile;
@ -1273,7 +1273,7 @@ MainWindow::BulkConvertImage(const WCHAR* pathName, const WCHAR* targetDir,
*/ */
if (srcImg.GetSectorOrder() == DiskImg::kSectorOrderUnknown) { if (srcImg.GetSectorOrder() == DiskImg::kSectorOrderUnknown) {
if (TryDiskImgOverride(&srcImg, pathName, DiskImg::kFormatGenericProDOSOrd, if (TryDiskImgOverride(&srcImg, pathName, DiskImg::kFormatGenericProDOSOrd,
nil, pErrMsg) != IDOK) NULL, pErrMsg) != IDOK)
{ {
*pErrMsg = "Image conversion cancelled."; *pErrMsg = "Image conversion cancelled.";
} }
@ -1326,7 +1326,7 @@ MainWindow::BulkConvertImage(const WCHAR* pathName, const WCHAR* targetDir,
const DiskImg::NibbleDescr* pNibbleDescr; const DiskImg::NibbleDescr* pNibbleDescr;
pNibbleDescr = srcImg.GetNibbleDescr(); pNibbleDescr = srcImg.GetNibbleDescr();
if (pNibbleDescr == nil && DiskImg::IsNibbleFormat(physicalFormat)) { if (pNibbleDescr == NULL && DiskImg::IsNibbleFormat(physicalFormat)) {
/* /*
* We're writing to a nibble format, so we have to decide how the * We're writing to a nibble format, so we have to decide how the
* disk should be formatted. The source doesn't specify it, so we * disk should be formatted. The source doesn't specify it, so we
@ -1342,7 +1342,7 @@ MainWindow::BulkConvertImage(const WCHAR* pathName, const WCHAR* targetDir,
} }
} }
WMSG2(" NibbleDescr is 0x%08lx (%hs)\n", (long) pNibbleDescr, WMSG2(" NibbleDescr is 0x%08lx (%hs)\n", (long) pNibbleDescr,
pNibbleDescr != nil ? pNibbleDescr->description : "---"); pNibbleDescr != NULL ? pNibbleDescr->description : "---");
/* /*
* Create the new filename based on the old filename. * Create the new filename based on the old filename.
@ -1511,7 +1511,7 @@ MainWindow::BulkConvertImage(const WCHAR* pathName, const WCHAR* targetDir,
/* /*
* Do the actual copy, either as blocks or tracks. * Do the actual copy, either as blocks or tracks.
*/ */
dierr = CopyDiskImage(&dstImg, &srcImg, true, isPartial, nil); dierr = CopyDiskImage(&dstImg, &srcImg, true, isPartial, NULL);
if (dierr != kDIErrNone) if (dierr != kDIErrNone)
goto bail; goto bail;
@ -1551,7 +1551,7 @@ MainWindow::OnToolsSSTMerge(void)
const int kBadCountThreshold = 3072; const int kBadCountThreshold = 3072;
DiskImg srcImg0, srcImg1; DiskImg srcImg0, srcImg1;
CString appName, saveName, saveFolder, errMsg; CString appName, saveName, saveFolder, errMsg;
BYTE* trackBuf = nil; BYTE* trackBuf = NULL;
long badCount; long badCount;
// no need to flush -- can't really open raw SST images // no need to flush -- can't really open raw SST images
@ -1563,7 +1563,7 @@ MainWindow::OnToolsSSTMerge(void)
appName.LoadString(IDS_MB_APP_NAME); appName.LoadString(IDS_MB_APP_NAME);
trackBuf = new BYTE[kSSTNumTracks * kSSTTrackLen]; trackBuf = new BYTE[kSSTNumTracks * kSSTTrackLen];
if (trackBuf == nil) if (trackBuf == NULL)
goto bail; goto bail;
/* /*
@ -1623,7 +1623,7 @@ MainWindow::OnToolsSSTMerge(void)
FILE* fp; FILE* fp;
fp = _wfopen(saveName, L"wb"); fp = _wfopen(saveName, L"wb");
if (fp == nil) { if (fp == NULL) {
errMsg.Format(L"Unable to create '%ls': %hs.", errMsg.Format(L"Unable to create '%ls': %hs.",
(LPCWSTR) saveName, strerror(errno)); (LPCWSTR) saveName, strerror(errno));
ShowFailureMsg(this, errMsg, IDS_FAILED); ShowFailureMsg(this, errMsg, IDS_FAILED);
@ -1723,7 +1723,7 @@ MainWindow::SSTOpenImage(int seqNum, DiskImg* pDiskImg)
fPreferences.GetPrefBool(kPrQueryImageFormat)) fPreferences.GetPrefBool(kPrQueryImageFormat))
{ {
if (TryDiskImgOverride(pDiskImg, loadName, if (TryDiskImgOverride(pDiskImg, loadName,
DiskImg::kFormatGenericDOSOrd, nil, false, &errMsg) != IDOK) DiskImg::kFormatGenericDOSOrd, NULL, false, &errMsg) != IDOK)
{ {
goto bail; goto bail;
} }
@ -1968,7 +1968,7 @@ MainWindow::VolumeCopier(bool openFile)
{ {
VolumeCopyDialog copyDlg(this); VolumeCopyDialog copyDlg(this);
DiskImg srcImg; DiskImg srcImg;
//DiskFS* pDiskFS = nil; //DiskFS* pDiskFS = NULL;
DIError dierr; DIError dierr;
CString failed, errMsg, msg; CString failed, errMsg, msg;
CString deviceName; CString deviceName;
@ -2060,7 +2060,7 @@ MainWindow::VolumeCopier(bool openFile)
fPreferences.GetPrefBool(kPrQueryImageFormat)) fPreferences.GetPrefBool(kPrQueryImageFormat))
{ {
if (TryDiskImgOverride(&srcImg, deviceName, DiskImg::kFormatUnknown, if (TryDiskImgOverride(&srcImg, deviceName, DiskImg::kFormatUnknown,
nil, true, &errMsg) != IDOK) NULL, true, &errMsg) != IDOK)
{ {
goto bail; goto bail;
} }
@ -2105,7 +2105,7 @@ void
MainWindow::OnToolsDiskImageCreator(void) MainWindow::OnToolsDiskImageCreator(void)
{ {
CreateImageDialog createDlg(this); CreateImageDialog createDlg(this);
DiskArchive* pNewArchive = nil; DiskArchive* pNewArchive = NULL;
createDlg.fDiskFormatIdx = createDlg.fDiskFormatIdx =
fPreferences.GetPrefLong(kPrDiskImageCreateFormat); fPreferences.GetPrefLong(kPrDiskImageCreateFormat);
@ -2312,7 +2312,7 @@ MainWindow::OnToolsEOLScanner(void)
WMSG1("Scanning '%ls'\n", (LPCWSTR) fileName); WMSG1("Scanning '%ls'\n", (LPCWSTR) fileName);
FILE* fp = _wfopen(fileName, L"rb"); FILE* fp = _wfopen(fileName, L"rb");
if (fp == nil) { if (fp == NULL) {
errMsg.Format(L"Unable to open '%ls': %hs.", errMsg.Format(L"Unable to open '%ls': %hs.",
(LPCWSTR) fileName, strerror(errno)); (LPCWSTR) fileName, strerror(errno));
ShowFailureMsg(this, errMsg, IDS_FAILED); ShowFailureMsg(this, errMsg, IDS_FAILED);
@ -2428,7 +2428,7 @@ MainWindow::EditTwoImgProps(const WCHAR* fileName)
{ {
TwoImgPropsDialog dialog; TwoImgPropsDialog dialog;
TwoImgHeader header; TwoImgHeader header;
FILE* fp = nil; FILE* fp = NULL;
bool dirty = false; bool dirty = false;
CString errMsg; CString errMsg;
long totalLength; long totalLength;
@ -2436,10 +2436,10 @@ MainWindow::EditTwoImgProps(const WCHAR* fileName)
WMSG1("EditTwoImgProps '%ls'\n", fileName); WMSG1("EditTwoImgProps '%ls'\n", fileName);
fp = _wfopen(fileName, L"r+b"); fp = _wfopen(fileName, L"r+b");
if (fp == nil) { if (fp == NULL) {
int firstError = errno; int firstError = errno;
fp = _wfopen(fileName, L"rb"); fp = _wfopen(fileName, L"rb");
if (fp == nil) { if (fp == NULL) {
errMsg.Format(L"Unable to open '%ls': %hs.", errMsg.Format(L"Unable to open '%ls': %hs.",
fileName, strerror(firstError)); fileName, strerror(firstError));
goto bail; goto bail;
@ -2499,7 +2499,7 @@ MainWindow::EditTwoImgProps(const WCHAR* fileName)
} }
bail: bail:
if (fp != nil) if (fp != NULL)
fclose(fp); fclose(fp);
if (!errMsg.IsEmpty()) { if (!errMsg.IsEmpty()) {
ShowFailureMsg(this, errMsg, IDS_FAILED); ShowFailureMsg(this, errMsg, IDS_FAILED);

View File

@ -28,7 +28,7 @@ TwoImgPropsDialog::OnInitDialog(void)
CEdit* pEdit; CEdit* pEdit;
CString tmpStr; CString tmpStr;
ASSERT(fpHeader != nil); ASSERT(fpHeader != NULL);
/* /*
* Set up the static fields. * Set up the static fields.
@ -125,7 +125,7 @@ TwoImgPropsDialog::DoDataExchange(CDataExchange* pDX)
CStringA commentA(comment); CStringA commentA(comment);
fpHeader->SetComment(commentA); fpHeader->SetComment(commentA);
} else { } else {
fpHeader->SetComment(nil); fpHeader->SetComment(NULL);
} }
} else { } else {
CWnd* pWnd; CWnd* pWnd;

View File

@ -33,7 +33,7 @@ UseSelectionDialog::OnInitDialog(void)
/* grab the radio button with the selection count */ /* grab the radio button with the selection count */
pWnd = GetDlgItem(IDC_USE_SELECTED); pWnd = GetDlgItem(IDC_USE_SELECTED);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
/* set the string using a string table entry */ /* set the string using a string table entry */
if (fSelectedCount == 1) { if (fSelectedCount == 1) {
@ -53,12 +53,12 @@ UseSelectionDialog::OnInitDialog(void)
SetWindowText(str); SetWindowText(str);
pWnd = GetDlgItem(IDC_USE_ALL); pWnd = GetDlgItem(IDC_USE_ALL);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
str.LoadString(fAllID); str.LoadString(fAllID);
pWnd->SetWindowText(str); pWnd->SetWindowText(str);
pWnd = GetDlgItem(IDOK); pWnd = GetDlgItem(IDOK);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
str.LoadString(fOkLabelID); str.LoadString(fOkLabelID);
pWnd->SetWindowText(str); pWnd->SetWindowText(str);

View File

@ -51,11 +51,11 @@ ViewFilesDialog::OnInitDialog(void)
{ {
WMSG0("Now in VFD OnInitDialog!\n"); WMSG0("Now in VFD OnInitDialog!\n");
ASSERT(fpSelSet != nil); ASSERT(fpSelSet != NULL);
/* delete dummy control and insert our own with modded styles */ /* delete dummy control and insert our own with modded styles */
CRichEditCtrl* pEdit = (CRichEditCtrl*)GetDlgItem(IDC_FVIEW_EDITBOX); CRichEditCtrl* pEdit = (CRichEditCtrl*)GetDlgItem(IDC_FVIEW_EDITBOX);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
CRect rect; CRect rect;
pEdit->GetWindowRect(&rect); pEdit->GetWindowRect(&rect);
pEdit->DestroyWindow(); pEdit->DestroyWindow();
@ -264,7 +264,7 @@ ViewFilesDialog::ShiftControls(int deltaX, int deltaY)
*/ */
CRect rect; CRect rect;
CRichEditCtrl* pEdit = (CRichEditCtrl*) GetDlgItem(IDC_FVIEW_EDITBOX); CRichEditCtrl* pEdit = (CRichEditCtrl*) GetDlgItem(IDC_FVIEW_EDITBOX);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
//pEdit->GetClientRect(&rect); //pEdit->GetClientRect(&rect);
pEdit->GetWindowRect(&rect); pEdit->GetWindowRect(&rect);
//GetClientRect(&rect); //GetClientRect(&rect);
@ -325,15 +325,15 @@ ViewFilesDialog::DisplayText(const WCHAR* fileName)
bool emptyFlg = false; bool emptyFlg = false;
bool editHadFocus = false; bool editHadFocus = false;
ASSERT(fpOutput != nil); ASSERT(fpOutput != NULL);
ASSERT(fileName != nil); ASSERT(fileName != NULL);
errFlg = fpOutput->GetOutputKind() == ReformatOutput::kOutputErrorMsg; errFlg = fpOutput->GetOutputKind() == ReformatOutput::kOutputErrorMsg;
ASSERT(fpOutput->GetOutputKind() != ReformatOutput::kOutputUnknown); ASSERT(fpOutput->GetOutputKind() != ReformatOutput::kOutputUnknown);
CRichEditCtrl* pEdit = (CRichEditCtrl*) GetDlgItem(IDC_FVIEW_EDITBOX); CRichEditCtrl* pEdit = (CRichEditCtrl*) GetDlgItem(IDC_FVIEW_EDITBOX);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
/* retain the selection even if we lose focus [can't do this in OnInit] */ /* retain the selection even if we lose focus [can't do this in OnInit] */
pEdit->SetOptions(ECOOP_OR, ECO_SAVESEL); pEdit->SetOptions(ECOOP_OR, ECO_SAVESEL);
@ -373,7 +373,7 @@ ViewFilesDialog::DisplayText(const WCHAR* fileName)
* holder". * holder".
*/ */
CWnd* pFocusWnd = GetFocus(); CWnd* pFocusWnd = GetFocus();
if (pFocusWnd == nil || pFocusWnd->m_hWnd == pEdit->m_hWnd) { if (pFocusWnd == NULL || pFocusWnd->m_hWnd == pEdit->m_hWnd) {
editHadFocus = true; editHadFocus = true;
GetDlgItem(IDOK)->SetFocus(); GetDlgItem(IDOK)->SetFocus();
} }
@ -405,20 +405,20 @@ ViewFilesDialog::DisplayText(const WCHAR* fileName)
CClientDC dcScreen(this); CClientDC dcScreen(this);
HBITMAP hBitmap; HBITMAP hBitmap;
if (fpRichEditOle == nil) { if (fpRichEditOle == NULL) {
/* can't do this in OnInitDialog -- m_pWnd isn't initialized */ /* can't do this in OnInitDialog -- m_pWnd isn't initialized */
fpRichEditOle = pEdit->GetIRichEditOle(); fpRichEditOle = pEdit->GetIRichEditOle();
ASSERT(fpRichEditOle != nil); ASSERT(fpRichEditOle != NULL);
} }
//FILE* fp = fopen("C:/test/output.bmp", "wb"); //FILE* fp = fopen("C:/test/output.bmp", "wb");
//if (fp != nil) { //if (fp != NULL) {
// pDib->WriteToFile(fp); // pDib->WriteToFile(fp);
// fclose(fp); // fclose(fp);
//} //}
hBitmap = fpOutput->GetDIB()->ConvertToDDB(dcScreen.m_hDC); hBitmap = fpOutput->GetDIB()->ConvertToDDB(dcScreen.m_hDC);
if (hBitmap == nil) { if (hBitmap == NULL) {
WMSG0("ConvertToDDB failed!\n"); WMSG0("ConvertToDDB failed!\n");
pEdit->SetWindowText(L"Internal error."); pEdit->SetWindowText(L"Internal error.");
errFlg = true; errFlg = true;
@ -660,16 +660,16 @@ ViewFilesDialog::OnFviewNext(void)
// for debugging -- simulate failure // for debugging -- simulate failure
result = -1; result = -1;
delete fpHolder; delete fpHolder;
fpHolder = nil; fpHolder = NULL;
delete fpOutput; delete fpOutput;
fpOutput = nil; fpOutput = NULL;
} }
#endif #endif
fBusy = false; fBusy = false;
if (result != 0) { if (result != 0) {
ASSERT(fpHolder == nil); ASSERT(fpHolder == NULL);
ASSERT(fpOutput == nil); ASSERT(fpOutput == NULL);
return; return;
} }
@ -715,8 +715,8 @@ ViewFilesDialog::OnFviewPrev(void)
fBusy = false; fBusy = false;
if (result != 0) { if (result != 0) {
ASSERT(fpHolder == nil); ASSERT(fpHolder == NULL);
ASSERT(fpOutput == nil); ASSERT(fpOutput == NULL);
return; return;
} }
@ -737,7 +737,7 @@ ViewFilesDialog::OnFviewPrev(void)
* *
* Try to keep the previously-set button set. * Try to keep the previously-set button set.
* *
* If "pEntry" is nil, all buttons are disabled (useful for first-time * If "pEntry" is NULL, all buttons are disabled (useful for first-time
* initialization). * initialization).
*/ */
void void
@ -748,7 +748,7 @@ ViewFilesDialog::ConfigurePartButtons(const GenericEntry* pEntry)
CButton* pDataWnd = (CButton*) GetDlgItem(IDC_FVIEW_DATA); CButton* pDataWnd = (CButton*) GetDlgItem(IDC_FVIEW_DATA);
CButton* pRsrcWnd = (CButton*) GetDlgItem(IDC_FVIEW_RSRC); CButton* pRsrcWnd = (CButton*) GetDlgItem(IDC_FVIEW_RSRC);
CButton* pCmmtWnd = (CButton*) GetDlgItem(IDC_FVIEW_CMMT); CButton* pCmmtWnd = (CButton*) GetDlgItem(IDC_FVIEW_CMMT);
ASSERT(pDataWnd != nil && pRsrcWnd != nil && pCmmtWnd != nil); ASSERT(pDataWnd != NULL && pRsrcWnd != NULL && pCmmtWnd != NULL);
/* figure out what was checked before, ignoring if it's not available */ /* figure out what was checked before, ignoring if it's not available */
if (pDataWnd->GetCheck() == BST_CHECKED && pEntry->GetHasDataFork()) if (pDataWnd->GetCheck() == BST_CHECKED && pEntry->GetHasDataFork())
@ -774,7 +774,7 @@ ViewFilesDialog::ConfigurePartButtons(const GenericEntry* pEntry)
pRsrcWnd->SetCheck(BST_UNCHECKED); pRsrcWnd->SetCheck(BST_UNCHECKED);
pCmmtWnd->SetCheck(BST_UNCHECKED); pCmmtWnd->SetCheck(BST_UNCHECKED);
if (pEntry == nil) { if (pEntry == NULL) {
pDataWnd->EnableWindow(FALSE); pDataWnd->EnableWindow(FALSE);
pRsrcWnd->EnableWindow(FALSE); pRsrcWnd->EnableWindow(FALSE);
pCmmtWnd->EnableWindow(FALSE); pCmmtWnd->EnableWindow(FALSE);
@ -803,7 +803,7 @@ ViewFilesDialog::GetSelectedPart(void)
CButton* pDataWnd = (CButton*) GetDlgItem(IDC_FVIEW_DATA); CButton* pDataWnd = (CButton*) GetDlgItem(IDC_FVIEW_DATA);
CButton* pRsrcWnd = (CButton*) GetDlgItem(IDC_FVIEW_RSRC); CButton* pRsrcWnd = (CButton*) GetDlgItem(IDC_FVIEW_RSRC);
CButton* pCmmtWnd = (CButton*) GetDlgItem(IDC_FVIEW_CMMT); CButton* pCmmtWnd = (CButton*) GetDlgItem(IDC_FVIEW_CMMT);
ASSERT(pDataWnd != nil && pRsrcWnd != nil && pCmmtWnd != nil); ASSERT(pDataWnd != NULL && pRsrcWnd != NULL && pCmmtWnd != NULL);
if (pDataWnd->GetCheck() == BST_CHECKED) if (pDataWnd->GetCheck() == BST_CHECKED)
return ReformatHolder::kPartData; return ReformatHolder::kPartData;
@ -831,12 +831,12 @@ ViewFilesDialog::ReformatPrep(GenericEntry* pEntry)
int result; int result;
delete fpHolder; delete fpHolder;
fpHolder = nil; fpHolder = NULL;
result = pMainWindow->GetFileParts(pEntry, &fpHolder); result = pMainWindow->GetFileParts(pEntry, &fpHolder);
if (result != 0) { if (result != 0) {
WMSG0("GetFileParts(prev) failed!\n"); WMSG0("GetFileParts(prev) failed!\n");
ASSERT(fpHolder == nil); ASSERT(fpHolder == NULL);
return -1; return -1;
} }
@ -869,29 +869,29 @@ ViewFilesDialog::Reformat(const GenericEntry* pEntry,
CWaitCursor waitc; CWaitCursor waitc;
delete fpOutput; delete fpOutput;
fpOutput = nil; fpOutput = NULL;
/* run the best one */ /* run the best one */
fpOutput = fpHolder->Apply(part, id); fpOutput = fpHolder->Apply(part, id);
//bail: //bail:
if (fpOutput != nil) { if (fpOutput != NULL) {
// success -- do some sanity checks // success -- do some sanity checks
switch (fpOutput->GetOutputKind()) { switch (fpOutput->GetOutputKind()) {
case ReformatOutput::kOutputText: case ReformatOutput::kOutputText:
case ReformatOutput::kOutputRTF: case ReformatOutput::kOutputRTF:
case ReformatOutput::kOutputCSV: case ReformatOutput::kOutputCSV:
case ReformatOutput::kOutputErrorMsg: case ReformatOutput::kOutputErrorMsg:
ASSERT(fpOutput->GetTextBuf() != nil); ASSERT(fpOutput->GetTextBuf() != NULL);
ASSERT(fpOutput->GetDIB() == nil); ASSERT(fpOutput->GetDIB() == NULL);
break; break;
case ReformatOutput::kOutputBitmap: case ReformatOutput::kOutputBitmap:
ASSERT(fpOutput->GetDIB() != nil); ASSERT(fpOutput->GetDIB() != NULL);
ASSERT(fpOutput->GetTextBuf() == nil); ASSERT(fpOutput->GetTextBuf() == NULL);
break; break;
case ReformatOutput::kOutputRaw: case ReformatOutput::kOutputRaw:
// text buf might be nil // text buf might be NULL
ASSERT(fpOutput->GetDIB() == nil); ASSERT(fpOutput->GetDIB() == NULL);
break; break;
} }
return 0; return 0;
@ -1014,7 +1014,7 @@ void
ViewFilesDialog::OnFormatSelChange(void) ViewFilesDialog::OnFormatSelChange(void)
{ {
CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_FVIEW_FORMATSEL); CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_FVIEW_FORMATSEL);
ASSERT(pCombo != nil); ASSERT(pCombo != NULL);
WMSG1("+++ SELECTION IS NOW %d\n", pCombo->GetCurSel()); WMSG1("+++ SELECTION IS NOW %d\n", pCombo->GetCurSel());
SelectionEntry* pSelEntry = fpSelSet->IterCurrent(); SelectionEntry* pSelEntry = fpSelSet->IterCurrent();
@ -1054,11 +1054,11 @@ ViewFilesDialog::ForkSelectCommon(ReformatHolder::ReformatPart part)
ReformatHolder::ReformatID id; ReformatHolder::ReformatID id;
WMSG1("Switching to file part=%d\n", part); WMSG1("Switching to file part=%d\n", part);
ASSERT(fpHolder != nil); ASSERT(fpHolder != NULL);
ASSERT(fpSelSet != nil); ASSERT(fpSelSet != NULL);
ASSERT(fpSelSet->IterCurrent() != nil); ASSERT(fpSelSet->IterCurrent() != NULL);
pEntry = fpSelSet->IterCurrent()->GetEntry(); pEntry = fpSelSet->IterCurrent()->GetEntry();
ASSERT(pEntry != nil); ASSERT(pEntry != NULL);
id = ConfigureFormatSel(part); id = ConfigureFormatSel(part);
@ -1176,7 +1176,7 @@ void
ViewFilesDialog::NewFontSelected(bool resetBold) ViewFilesDialog::NewFontSelected(bool resetBold)
{ {
CRichEditCtrl* pEdit = (CRichEditCtrl*) GetDlgItem(IDC_FVIEW_EDITBOX); CRichEditCtrl* pEdit = (CRichEditCtrl*) GetDlgItem(IDC_FVIEW_EDITBOX);
ASSERT(pEdit != nil); ASSERT(pEdit != NULL);
CHARFORMAT cf; CHARFORMAT cf;
cf.cbSize = sizeof(CHARFORMAT); cf.cbSize = sizeof(CHARFORMAT);
@ -1291,7 +1291,7 @@ ViewFilesDialog::OnFviewFind(void)
{ {
DWORD flags = 0; DWORD flags = 0;
if (fpFindDialog != nil) if (fpFindDialog != NULL)
return; return;
if (fFindDown) if (fFindDown)
@ -1322,7 +1322,7 @@ ViewFilesDialog::OnFviewFind(void)
LRESULT LRESULT
ViewFilesDialog::OnFindDialogMessage(WPARAM wParam, LPARAM lParam) ViewFilesDialog::OnFindDialogMessage(WPARAM wParam, LPARAM lParam)
{ {
assert(fpFindDialog != nil); assert(fpFindDialog != NULL);
fFindDown = (fpFindDialog->SearchDown() != 0); fFindDown = (fpFindDialog->SearchDown() != 0);
fFindMatchCase = (fpFindDialog->MatchCase() != 0); fFindMatchCase = (fpFindDialog->MatchCase() != 0);
@ -1330,7 +1330,7 @@ ViewFilesDialog::OnFindDialogMessage(WPARAM wParam, LPARAM lParam)
if (fpFindDialog->IsTerminating()) { if (fpFindDialog->IsTerminating()) {
WMSG0("VFD find dialog closing\n"); WMSG0("VFD find dialog closing\n");
fpFindDialog = nil; fpFindDialog = NULL;
return 0; return 0;
} }

View File

@ -25,18 +25,18 @@ public:
ViewFilesDialog(CWnd* pParentWnd = NULL) : ViewFilesDialog(CWnd* pParentWnd = NULL) :
CDialog(IDD_FILE_VIEWER, pParentWnd) CDialog(IDD_FILE_VIEWER, pParentWnd)
{ {
//fpMainWindow = nil; //fpMainWindow = NULL;
fpSelSet = nil; fpSelSet = NULL;
fpHolder = nil; fpHolder = NULL;
fpOutput = nil; fpOutput = NULL;
fTypeFace = ""; fTypeFace = "";
fPointSize = 0; fPointSize = 0;
fNoWrapText = false; fNoWrapText = false;
fBusy = false; fBusy = false;
fpRichEditOle = nil; fpRichEditOle = NULL;
fFirstResize = false; fFirstResize = false;
fpFindDialog = nil; fpFindDialog = NULL;
fFindDown = false; fFindDown = false;
fFindMatchCase = false; fFindMatchCase = false;
fFindMatchWholeWord = false; fFindMatchWholeWord = false;

View File

@ -39,10 +39,10 @@ public:
void SetCurrentFiles(const WCHAR* fromName, const WCHAR* toName) { void SetCurrentFiles(const WCHAR* fromName, const WCHAR* toName) {
CWnd* pWnd = GetDlgItem(IDC_VOLUMECOPYPROG_FROM); CWnd* pWnd = GetDlgItem(IDC_VOLUMECOPYPROG_FROM);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->SetWindowText(fromName); pWnd->SetWindowText(fromName);
pWnd = GetDlgItem(IDC_VOLUMECOPYPROG_TO); pWnd = GetDlgItem(IDC_VOLUMECOPYPROG_TO);
ASSERT(pWnd != nil); ASSERT(pWnd != NULL);
pWnd->SetWindowText(toName); pWnd->SetWindowText(toName);
} }
@ -70,7 +70,7 @@ VolumeCopyDialog::OnInitDialog(void)
//this->GetWindowRect(&rect); //this->GetWindowRect(&rect);
//WMSG4("RECT is %d, %d, %d, %d\n", rect.left, rect.top, rect.bottom, rect.right); //WMSG4("RECT is %d, %d, %d, %d\n", rect.left, rect.top, rect.bottom, rect.right);
ASSERT(fpDiskImg != nil); ASSERT(fpDiskImg != NULL);
ScanDiskInfo(false); ScanDiskInfo(false);
CDialog::OnInitDialog(); // does DDX init CDialog::OnInitDialog(); // does DDX init
@ -94,7 +94,7 @@ VolumeCopyDialog::OnInitDialog(void)
* [icon] Volume name | Format | Size (MB/GB) | Block count * [icon] Volume name | Format | Size (MB/GB) | Block count
*/ */
CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_VOLUMECOPYSEL_LIST); CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_VOLUMECOPYSEL_LIST);
ASSERT(pListView != nil); ASSERT(pListView != NULL);
ListView_SetExtendedListViewStyleEx(pListView->m_hWnd, ListView_SetExtendedListViewStyleEx(pListView->m_hWnd,
LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT); LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
@ -150,7 +150,7 @@ VolumeCopyDialog::Cleanup(void)
{ {
WMSG0(" VolumeCopyDialog is done, cleaning up DiskFS\n"); WMSG0(" VolumeCopyDialog is done, cleaning up DiskFS\n");
delete fpDiskFS; delete fpDiskFS;
fpDiskFS = nil; fpDiskFS = NULL;
} }
/* /*
@ -164,7 +164,7 @@ VolumeCopyDialog::OnListChange(NMHDR*, LRESULT* pResult)
//WMSG4("RECT is %d, %d, %d, %d\n", rect.left, rect.top, rect.bottom, rect.right); //WMSG4("RECT is %d, %d, %d, %d\n", rect.left, rect.top, rect.bottom, rect.right);
CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_VOLUMECOPYSEL_LIST); CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_VOLUMECOPYSEL_LIST);
ASSERT(pListView != nil); ASSERT(pListView != NULL);
CButton* pButton; CButton* pButton;
UINT selectedCount; UINT selectedCount;
@ -201,8 +201,8 @@ VolumeCopyDialog::ScanDiskInfo(bool scanTop)
DIError dierr; DIError dierr;
CString errMsg, failed; CString errMsg, failed;
assert(fpDiskImg != nil); assert(fpDiskImg != NULL);
assert(fpDiskFS == nil); assert(fpDiskFS == NULL);
if (scanTop) { if (scanTop) {
DiskImg::FSFormat oldFormat; DiskImg::FSFormat oldFormat;
@ -224,7 +224,7 @@ VolumeCopyDialog::ScanDiskInfo(bool scanTop)
{ {
// ignore them if they hit "cancel" // ignore them if they hit "cancel"
(void) pMain->TryDiskImgOverride(fpDiskImg, fPathName, (void) pMain->TryDiskImgOverride(fpDiskImg, fPathName,
DiskImg::kFormatUnknown, nil, true, &errMsg); DiskImg::kFormatUnknown, NULL, true, &errMsg);
if (!errMsg.IsEmpty()) { if (!errMsg.IsEmpty()) {
ShowFailureMsg(this, errMsg, IDS_FAILED); ShowFailureMsg(this, errMsg, IDS_FAILED);
return; return;
@ -262,7 +262,7 @@ VolumeCopyDialog::ScanDiskInfo(bool scanTop)
* the sub-volume info, which is unfortunate since it can be slow. * the sub-volume info, which is unfortunate since it can be slow.
*/ */
fpDiskFS = fpDiskImg->OpenAppropriateDiskFS(true); fpDiskFS = fpDiskImg->OpenAppropriateDiskFS(true);
if (fpDiskFS == nil) { if (fpDiskFS == NULL) {
WMSG0("HEY: OpenAppropriateDiskFS failed!\n"); WMSG0("HEY: OpenAppropriateDiskFS failed!\n");
/* this is fatal, but there's no easy way to die */ /* this is fatal, but there's no easy way to die */
/* (could we do a DestroyWindow from here?) */ /* (could we do a DestroyWindow from here?) */
@ -281,9 +281,9 @@ VolumeCopyDialog::ScanDiskInfo(bool scanTop)
} }
} }
if (!deferDestroy && fpWaitDlg != nil) { if (!deferDestroy && fpWaitDlg != NULL) {
fpWaitDlg->DestroyWindow(); fpWaitDlg->DestroyWindow();
fpWaitDlg = nil; fpWaitDlg = NULL;
} }
return; return;
@ -296,10 +296,10 @@ VolumeCopyDialog::ScanDiskInfo(bool scanTop)
LONG LONG
VolumeCopyDialog::OnDialogReady(UINT, LONG) VolumeCopyDialog::OnDialogReady(UINT, LONG)
{ {
if (fpWaitDlg != nil) { if (fpWaitDlg != NULL) {
WMSG0("OnDialogReady found active window, destroying\n"); WMSG0("OnDialogReady found active window, destroying\n");
fpWaitDlg->DestroyWindow(); fpWaitDlg->DestroyWindow();
fpWaitDlg = nil; fpWaitDlg = NULL;
} }
return 0; return 0;
} }
@ -316,13 +316,13 @@ void
VolumeCopyDialog::LoadList(void) VolumeCopyDialog::LoadList(void)
{ {
CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_VOLUMECOPYSEL_LIST); CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_VOLUMECOPYSEL_LIST);
ASSERT(pListView != nil); ASSERT(pListView != NULL);
int itemIndex = 0; int itemIndex = 0;
CString unknown = "(unknown)"; CString unknown = "(unknown)";
pListView->DeleteAllItems(); pListView->DeleteAllItems();
if (fpDiskFS == nil) { if (fpDiskFS == NULL) {
/* can only happen if imported volume is unrecognizeable */ /* can only happen if imported volume is unrecognizeable */
return; return;
} }
@ -330,10 +330,10 @@ VolumeCopyDialog::LoadList(void)
AddToList(pListView, fpDiskImg, fpDiskFS, &itemIndex); AddToList(pListView, fpDiskImg, fpDiskFS, &itemIndex);
DiskImgLib::DiskFS::SubVolume* pSubVolume; DiskImgLib::DiskFS::SubVolume* pSubVolume;
pSubVolume = fpDiskFS->GetNextSubVolume(nil); pSubVolume = fpDiskFS->GetNextSubVolume(NULL);
while (pSubVolume != nil) { while (pSubVolume != NULL) {
if (pSubVolume->GetDiskFS() == nil) { if (pSubVolume->GetDiskFS() == NULL) {
WMSG0("WARNING: sub-volume DiskFS is nil?!\n"); WMSG0("WARNING: sub-volume DiskFS is NULL?!\n");
assert(false); assert(false);
} else { } else {
AddToList(pListView, pSubVolume->GetDiskImg(), AddToList(pListView, pSubVolume->GetDiskImg(),
@ -353,10 +353,10 @@ VolumeCopyDialog::AddToList(CListCtrl* pListView, DiskImg* pDiskImg,
CString volName, format, sizeStr, blocksStr; CString volName, format, sizeStr, blocksStr;
long numBlocks; long numBlocks;
assert(pListView != nil); assert(pListView != NULL);
assert(pDiskImg != nil); assert(pDiskImg != NULL);
assert(pDiskFS != nil); assert(pDiskFS != NULL);
assert(pIndex != nil); assert(pIndex != NULL);
numBlocks = pDiskImg->GetNumBlocks(); numBlocks = pDiskImg->GetNumBlocks();
@ -391,17 +391,17 @@ bool
VolumeCopyDialog::GetSelectedDisk(DiskImg** ppDiskImg, DiskFS** ppDiskFS) VolumeCopyDialog::GetSelectedDisk(DiskImg** ppDiskImg, DiskFS** ppDiskFS)
{ {
CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_VOLUMECOPYSEL_LIST); CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_VOLUMECOPYSEL_LIST);
ASSERT(pListView != nil); ASSERT(pListView != NULL);
ASSERT(ppDiskImg != nil); ASSERT(ppDiskImg != NULL);
ASSERT(ppDiskFS != nil); ASSERT(ppDiskFS != NULL);
if (pListView->GetSelectedCount() != 1) if (pListView->GetSelectedCount() != 1)
return false; return false;
POSITION posn; POSITION posn;
posn = pListView->GetFirstSelectedItemPosition(); posn = pListView->GetFirstSelectedItemPosition();
if (posn == nil) { if (posn == NULL) {
ASSERT(false); ASSERT(false);
return false; return false;
} }
@ -409,7 +409,7 @@ VolumeCopyDialog::GetSelectedDisk(DiskImg** ppDiskImg, DiskFS** ppDiskFS)
DWORD data = pListView->GetItemData(num); DWORD data = pListView->GetItemData(num);
*ppDiskFS = (DiskFS*) data; *ppDiskFS = (DiskFS*) data;
assert(*ppDiskFS != nil); assert(*ppDiskFS != NULL);
*ppDiskImg = (*ppDiskFS)->GetDiskImg(); *ppDiskImg = (*ppDiskFS)->GetDiskImg();
return true; return true;
} }
@ -431,12 +431,12 @@ VolumeCopyDialog::OnHelp(void)
void void
VolumeCopyDialog::OnCopyToFile(void) VolumeCopyDialog::OnCopyToFile(void)
{ {
VolumeXferProgressDialog* pProgressDialog = nil; VolumeXferProgressDialog* pProgressDialog = NULL;
Preferences* pPreferences = GET_PREFERENCES_WR(); Preferences* pPreferences = GET_PREFERENCES_WR();
MainWindow* pMain = (MainWindow*)::AfxGetMainWnd(); MainWindow* pMain = (MainWindow*)::AfxGetMainWnd();
DiskImg::FSFormat originalFormat = DiskImg::kFormatUnknown; DiskImg::FSFormat originalFormat = DiskImg::kFormatUnknown;
DiskImg* pSrcImg = nil; DiskImg* pSrcImg = NULL;
DiskFS* pSrcFS = nil; DiskFS* pSrcFS = NULL;
DiskImg dstImg; DiskImg dstImg;
DIError dierr; DIError dierr;
CString errMsg, saveName, msg, srcName; CString errMsg, saveName, msg, srcName;
@ -445,8 +445,8 @@ VolumeCopyDialog::OnCopyToFile(void)
result = GetSelectedDisk(&pSrcImg, &pSrcFS); result = GetSelectedDisk(&pSrcImg, &pSrcFS);
if (!result) if (!result)
return; return;
assert(pSrcImg != nil); assert(pSrcImg != NULL);
assert(pSrcFS != nil); assert(pSrcFS != NULL);
srcName = pSrcFS->GetVolumeName(); srcName = pSrcFS->GetVolumeName();
@ -511,11 +511,11 @@ VolumeCopyDialog::OnCopyToFile(void)
CWaitCursor waitc; CWaitCursor waitc;
CStringA saveNameA(saveName); CStringA saveNameA(saveName);
dierr = dstImg.CreateImage(saveNameA, nil, dierr = dstImg.CreateImage(saveNameA, NULL,
DiskImg::kOuterFormatNone, DiskImg::kOuterFormatNone,
DiskImg::kFileFormatUnadorned, DiskImg::kFileFormatUnadorned,
DiskImg::kPhysicalFormatSectors, DiskImg::kPhysicalFormatSectors,
nil, NULL,
DiskImg::kSectorOrderProDOS, DiskImg::kSectorOrderProDOS,
DiskImg::kFormatGenericProDOSOrd, DiskImg::kFormatGenericProDOSOrd,
dstNumBlocks, dstNumBlocks,
@ -542,7 +542,7 @@ VolumeCopyDialog::OnCopyToFile(void)
pProgressDialog->SetCurrentFiles(srcName, saveName); pProgressDialog->SetCurrentFiles(srcName, saveName);
time_t startWhen, endWhen; time_t startWhen, endWhen;
startWhen = time(nil); startWhen = time(NULL);
/* /*
* Do the actual block copy. * Do the actual block copy.
@ -570,7 +570,7 @@ VolumeCopyDialog::OnCopyToFile(void)
} }
/* put elapsed time in the debug log */ /* put elapsed time in the debug log */
endWhen = time(nil); endWhen = time(NULL);
float elapsed; float elapsed;
if (endWhen == startWhen) if (endWhen == startWhen)
elapsed = 1.0; elapsed = 1.0;
@ -591,7 +591,7 @@ bail:
// restore the dialog window to prominence // restore the dialog window to prominence
EnableWindow(TRUE); EnableWindow(TRUE);
//SetActiveWindow(); //SetActiveWindow();
if (pProgressDialog != nil) if (pProgressDialog != NULL)
pProgressDialog->DestroyWindow(); pProgressDialog->DestroyWindow();
/* un-override the source disk */ /* un-override the source disk */
@ -614,14 +614,14 @@ bail:
void void
VolumeCopyDialog::OnCopyFromFile(void) VolumeCopyDialog::OnCopyFromFile(void)
{ {
VolumeXferProgressDialog* pProgressDialog = nil; VolumeXferProgressDialog* pProgressDialog = NULL;
Preferences* pPreferences = GET_PREFERENCES_WR(); Preferences* pPreferences = GET_PREFERENCES_WR();
MainWindow* pMain = (MainWindow*)::AfxGetMainWnd(); MainWindow* pMain = (MainWindow*)::AfxGetMainWnd();
//DiskImg::FSFormat originalFormat = DiskImg::kFormatUnknown; //DiskImg::FSFormat originalFormat = DiskImg::kFormatUnknown;
CString openFilters; CString openFilters;
CString loadName, targetName, errMsg, warning; CString loadName, targetName, errMsg, warning;
DiskImg* pDstImg = nil; DiskImg* pDstImg = NULL;
DiskFS* pDstFS = nil; DiskFS* pDstFS = NULL;
DiskImg srcImg; DiskImg srcImg;
DIError dierr; DIError dierr;
int result; int result;
@ -639,7 +639,7 @@ VolumeCopyDialog::OnCopyFromFile(void)
if (!result) if (!result)
return; return;
// if (pDstFS == nil) // if (pDstFS == NULL)
// targetName = "the target volume"; // targetName = "the target volume";
// else // else
targetName = pDstFS->GetVolumeName(); targetName = pDstFS->GetVolumeName();
@ -786,7 +786,7 @@ VolumeCopyDialog::OnCopyFromFile(void)
ASSERT(false); ASSERT(false);
return; return;
} }
// if (pDstFS == nil) // if (pDstFS == NULL)
// pProgressDialog->SetCurrentFiles(loadName, "target"); // pProgressDialog->SetCurrentFiles(loadName, "target");
// else // else
pProgressDialog->SetCurrentFiles(loadName, targetName); pProgressDialog->SetCurrentFiles(loadName, targetName);
@ -800,7 +800,7 @@ VolumeCopyDialog::OnCopyFromFile(void)
fpDiskFS->Flush(DiskImg::kFlushAll); fpDiskFS->Flush(DiskImg::kFlushAll);
time_t startWhen, endWhen; time_t startWhen, endWhen;
startWhen = time(nil); startWhen = time(NULL);
/* /*
* Do the actual block copy. * Do the actual block copy.
@ -825,7 +825,7 @@ VolumeCopyDialog::OnCopyFromFile(void)
goto bail; goto bail;
} }
endWhen = time(nil); endWhen = time(NULL);
float elapsed; float elapsed;
if (endWhen == startWhen) if (endWhen == startWhen)
elapsed = 1.0; elapsed = 1.0;
@ -849,7 +849,7 @@ VolumeCopyDialog::OnCopyFromFile(void)
assert(!fpDiskImg->GetReadOnly()); assert(!fpDiskImg->GetReadOnly());
fpDiskFS->SetAllReadOnly(true); fpDiskFS->SetAllReadOnly(true);
delete fpDiskFS; delete fpDiskFS;
fpDiskFS = nil; fpDiskFS = NULL;
assert(fpDiskImg->GetReadOnly()); assert(fpDiskImg->GetReadOnly());
fpDiskImg->SetReadOnly(false); fpDiskImg->SetReadOnly(false);
@ -857,7 +857,7 @@ bail:
// restore the dialog window to prominence // restore the dialog window to prominence
EnableWindow(TRUE); EnableWindow(TRUE);
//SetActiveWindow(); //SetActiveWindow();
if (pProgressDialog != nil) if (pProgressDialog != NULL)
pProgressDialog->DestroyWindow(); pProgressDialog->DestroyWindow();
/* /*

View File

@ -22,11 +22,11 @@ class VolumeCopyDialog : public CDialog {
public: public:
VolumeCopyDialog(CWnd* pParentWnd = NULL) : VolumeCopyDialog(CWnd* pParentWnd = NULL) :
CDialog(IDD_VOLUMECOPYSEL, pParentWnd), CDialog(IDD_VOLUMECOPYSEL, pParentWnd),
fpDiskImg(nil), fpDiskImg(NULL),
fpDiskFS(nil), fpDiskFS(NULL),
fpWaitDlg(nil) fpWaitDlg(NULL)
{} {}
~VolumeCopyDialog(void) { assert(fpDiskFS == nil); } ~VolumeCopyDialog(void) { assert(fpDiskFS == NULL); }
/* disk image to work with; we don't own it */ /* disk image to work with; we don't own it */
DiskImgLib::DiskImg* fpDiskImg; DiskImgLib::DiskImg* fpDiskImg;

View File

@ -35,7 +35,7 @@ ASPI::Init(void)
* Try to load the DLL. * Try to load the DLL.
*/ */
fhASPI = ::LoadLibrary(kASPIDllName); fhASPI = ::LoadLibrary(kASPIDllName);
if (fhASPI == nil) { if (fhASPI == NULL) {
DWORD lastErr = ::GetLastError(); DWORD lastErr = ::GetLastError();
if (lastErr == ERROR_MOD_NOT_FOUND) { if (lastErr == ERROR_MOD_NOT_FOUND) {
WMSG1("ASPI DLL '%s' not found\n", kASPIDllName); WMSG1("ASPI DLL '%s' not found\n", kASPIDllName);
@ -49,14 +49,14 @@ ASPI::Init(void)
GetASPI32SupportInfo = (DWORD(*)(void))::GetProcAddress(fhASPI, "GetASPI32SupportInfo"); GetASPI32SupportInfo = (DWORD(*)(void))::GetProcAddress(fhASPI, "GetASPI32SupportInfo");
SendASPI32Command = (DWORD(*)(LPSRB))::GetProcAddress(fhASPI, "SendASPI32Command"); SendASPI32Command = (DWORD(*)(LPSRB))::GetProcAddress(fhASPI, "SendASPI32Command");
GetASPI32DLLVersion = (DWORD(*)(void))::GetProcAddress(fhASPI, "GetASPI32DLLVersion"); GetASPI32DLLVersion = (DWORD(*)(void))::GetProcAddress(fhASPI, "GetASPI32DLLVersion");
if (GetASPI32SupportInfo == nil || SendASPI32Command == nil) { if (GetASPI32SupportInfo == NULL || SendASPI32Command == NULL) {
WMSG0("ASPI functions not found in dll\n"); WMSG0("ASPI functions not found in dll\n");
::FreeLibrary(fhASPI); ::FreeLibrary(fhASPI);
fhASPI = nil; fhASPI = NULL;
return kDIErrGeneric; return kDIErrGeneric;
} }
if (GetASPI32DLLVersion != nil) { if (GetASPI32DLLVersion != NULL) {
fASPIVersion = GetASPI32DLLVersion(); fASPIVersion = GetASPI32DLLVersion();
WMSG4(" ASPI version is %d.%d.%d.%d\n", WMSG4(" ASPI version is %d.%d.%d.%d\n",
fASPIVersion & 0x0ff, fASPIVersion & 0x0ff,
@ -75,7 +75,7 @@ ASPI::Init(void)
WMSG1("ASPI loaded but not working (status=%d)\n", WMSG1("ASPI loaded but not working (status=%d)\n",
HIBYTE(LOWORD(aspiStatus))); HIBYTE(LOWORD(aspiStatus)));
::FreeLibrary(fhASPI); ::FreeLibrary(fhASPI);
fhASPI = nil; fhASPI = NULL;
return kDIErrASPIFailure; return kDIErrASPIFailure;
} }
@ -91,10 +91,10 @@ ASPI::Init(void)
*/ */
ASPI::~ASPI(void) ASPI::~ASPI(void)
{ {
if (fhASPI != nil) { if (fhASPI != NULL) {
WMSG0("Unloading ASPI DLL\n"); WMSG0("Unloading ASPI DLL\n");
::FreeLibrary(fhASPI); ::FreeLibrary(fhASPI);
fhASPI = nil; fhASPI = NULL;
} }
} }
@ -150,7 +150,7 @@ ASPI::GetDeviceType(unsigned char adapter, unsigned char target,
assert(adapter >= 0 && adapter < kMaxAdapters); assert(adapter >= 0 && adapter < kMaxAdapters);
assert(target >= 0 && target < kMaxTargets); assert(target >= 0 && target < kMaxTargets);
assert(lun >= 0 && lun < kMaxLuns); assert(lun >= 0 && lun < kMaxLuns);
assert(pType != nil); assert(pType != NULL);
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.SRB_Cmd = SC_GET_DEV_TYPE; req.SRB_Cmd = SC_GET_DEV_TYPE;
@ -311,7 +311,7 @@ ASPI::TestUnitReady(unsigned char adapter, unsigned char target,
srb.SRB_Lun = lun; srb.SRB_Lun = lun;
srb.SRB_Flags = 0; //SRB_DIR_IN; srb.SRB_Flags = 0; //SRB_DIR_IN;
srb.SRB_BufLen = 0; srb.SRB_BufLen = 0;
srb.SRB_BufPointer = nil; srb.SRB_BufPointer = NULL;
srb.SRB_SenseLen = SENSE_LEN; srb.SRB_SenseLen = SENSE_LEN;
srb.SRB_CDBLen = sizeof(*pCDB); srb.SRB_CDBLen = sizeof(*pCDB);
@ -369,7 +369,7 @@ ASPI::ReadBlocks(unsigned char adapter, unsigned char target,
assert(sizeof(CDB10) == 10); assert(sizeof(CDB10) == 10);
assert(startBlock >= 0); assert(startBlock >= 0);
assert(numBlocks > 0); assert(numBlocks > 0);
assert(buf != nil); assert(buf != NULL);
memset(&srb, 0, sizeof(srb)); memset(&srb, 0, sizeof(srb));
srb.SRB_Cmd = SC_EXEC_SCSI_CMD; srb.SRB_Cmd = SC_EXEC_SCSI_CMD;
@ -411,7 +411,7 @@ ASPI::WriteBlocks(unsigned char adapter, unsigned char target,
assert(sizeof(CDB10) == 10); assert(sizeof(CDB10) == 10);
assert(startBlock >= 0); assert(startBlock >= 0);
assert(numBlocks > 0); assert(numBlocks > 0);
assert(buf != nil); assert(buf != NULL);
memset(&srb, 0, sizeof(srb)); memset(&srb, 0, sizeof(srb));
srb.SRB_Cmd = SC_EXEC_SCSI_CMD; srb.SRB_Cmd = SC_EXEC_SCSI_CMD;
@ -449,7 +449,7 @@ ASPI::WriteBlocks(unsigned char adapter, unsigned char target,
DIError DIError
ASPI::ExecSCSICommand(SRB_ExecSCSICmd* pSRB) ASPI::ExecSCSICommand(SRB_ExecSCSICmd* pSRB)
{ {
HANDLE completionEvent = nil; HANDLE completionEvent = NULL;
DWORD eventStatus; DWORD eventStatus;
DWORD aspiStatus; DWORD aspiStatus;
@ -464,7 +464,7 @@ ASPI::ExecSCSICommand(SRB_ExecSCSICmd* pSRB)
pSRB->SRB_Flags |= SRB_EVENT_NOTIFY; pSRB->SRB_Flags |= SRB_EVENT_NOTIFY;
completionEvent = ::CreateEvent(NULL, FALSE, FALSE, NULL); completionEvent = ::CreateEvent(NULL, FALSE, FALSE, NULL);
if (completionEvent == nil) { if (completionEvent == NULL) {
WMSG0("Failed creating a completion event?\n"); WMSG0("Failed creating a completion event?\n");
return kDIErrGeneric; return kDIErrGeneric;
} }
@ -527,16 +527,16 @@ ASPI::GetAccessibleDevices(int deviceMask, ASPIDevice** ppDeviceArray,
int* pNumDevices) int* pNumDevices)
{ {
DIError dierr; DIError dierr;
ASPIDevice* deviceArray = nil; ASPIDevice* deviceArray = NULL;
int idx = 0; int idx = 0;
assert(deviceMask != 0); assert(deviceMask != 0);
assert((deviceMask & ~(kDevMaskCDROM | kDevMaskHardDrive)) == 0); assert((deviceMask & ~(kDevMaskCDROM | kDevMaskHardDrive)) == 0);
assert(ppDeviceArray != nil); assert(ppDeviceArray != NULL);
assert(pNumDevices != nil); assert(pNumDevices != NULL);
deviceArray = new ASPIDevice[kMaxAccessibleDrives]; deviceArray = new ASPIDevice[kMaxAccessibleDrives];
if (deviceArray == nil) if (deviceArray == NULL)
return kDIErrMalloc; return kDIErrMalloc;
WMSG1("ASPI scanning %d host adapters\n", fHostAdapterCount); WMSG1("ASPI scanning %d host adapters\n", fHostAdapterCount);

View File

@ -42,7 +42,7 @@ namespace DiskImgLib {
*/ */
class DISKIMG_API ASPIDevice { class DISKIMG_API ASPIDevice {
public: public:
ASPIDevice(void) : fVendorID(nil), fProductID(nil), ASPIDevice(void) : fVendorID(NULL), fProductID(NULL),
fAdapter(0xff), fTarget(0xff), fLun(0xff), fDeviceReady(false) fAdapter(0xff), fTarget(0xff), fLun(0xff), fDeviceReady(false)
{} {}
virtual ~ASPIDevice(void) { virtual ~ASPIDevice(void) {
@ -57,10 +57,10 @@ public:
fAdapter = adapter; fAdapter = adapter;
fTarget = target; fTarget = target;
fLun = lun; fLun = lun;
assert(fVendorID == nil); assert(fVendorID == NULL);
fVendorID = new char[strlen((const char*)vendor)+1]; fVendorID = new char[strlen((const char*)vendor)+1];
strcpy(fVendorID, (const char*)vendor); strcpy(fVendorID, (const char*)vendor);
assert(fProductID == nil); assert(fProductID == NULL);
fProductID = new char[strlen((const char*)product)+1]; fProductID = new char[strlen((const char*)product)+1];
strcpy(fProductID, (const char*)product); strcpy(fProductID, (const char*)product);
fDeviceReady = ready; fDeviceReady = ready;
@ -101,10 +101,10 @@ private:
class DISKIMG_API ASPI { class DISKIMG_API ASPI {
public: public:
ASPI(void) : ASPI(void) :
fhASPI(nil), fhASPI(NULL),
GetASPI32SupportInfo(nil), GetASPI32SupportInfo(NULL),
SendASPI32Command(nil), SendASPI32Command(NULL),
GetASPI32DLLVersion(nil), GetASPI32DLLVersion(NULL),
fASPIVersion(0), fASPIVersion(0),
fHostAdapterCount(-1) fHostAdapterCount(-1)
{} {}
@ -115,7 +115,7 @@ public:
// return the version returned by the loaded DLL // return the version returned by the loaded DLL
DWORD GetVersion(void) const { DWORD GetVersion(void) const {
assert(fhASPI != nil); assert(fhASPI != NULL);
return fASPIVersion; return fASPIVersion;
} }

View File

@ -58,8 +58,8 @@ DiskFSCFFA::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder,
long totalBlocks = pImg->GetNumBlocks(); long totalBlocks = pImg->GetNumBlocks();
long startBlock, maxBlocks, totalBlocksLeft; long startBlock, maxBlocks, totalBlocksLeft;
long fsNumBlocks; long fsNumBlocks;
DiskFS* pNewFS = nil; DiskFS* pNewFS = NULL;
DiskImg* pNewImg = nil; DiskImg* pNewImg = NULL;
//bool fiveIs32MB; //bool fiveIs32MB;
assert(totalBlocks > kEarlyVolExpectedSize); assert(totalBlocks > kEarlyVolExpectedSize);
@ -364,11 +364,11 @@ DiskFSCFFA::OpenSubVolume(DiskImg* pImg, long startBlock, long numBlocks,
bool scanOnly, DiskImg** ppNewImg, DiskFS** ppNewFS) bool scanOnly, DiskImg** ppNewImg, DiskFS** ppNewFS)
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
DiskFS* pNewFS = nil; DiskFS* pNewFS = NULL;
DiskImg* pNewImg = nil; DiskImg* pNewImg = NULL;
pNewImg = new DiskImg; pNewImg = new DiskImg;
if (pNewImg == nil) { if (pNewImg == NULL) {
dierr = kDIErrMalloc; dierr = kDIErrMalloc;
goto bail; goto bail;
} }
@ -400,7 +400,7 @@ DiskFSCFFA::OpenSubVolume(DiskImg* pImg, long startBlock, long numBlocks,
/* open a DiskFS for the sub-image */ /* open a DiskFS for the sub-image */
WMSG2(" CFFASub (%ld,%ld) analyze succeeded!\n", startBlock, numBlocks); WMSG2(" CFFASub (%ld,%ld) analyze succeeded!\n", startBlock, numBlocks);
pNewFS = pNewImg->OpenAppropriateDiskFS(); pNewFS = pNewImg->OpenAppropriateDiskFS();
if (pNewFS == nil) { if (pNewFS == NULL) {
WMSG0(" CFFASub: OpenAppropriateDiskFS failed\n"); WMSG0(" CFFASub: OpenAppropriateDiskFS failed\n");
dierr = kDIErrUnsupportedFSFmt; dierr = kDIErrUnsupportedFSFmt;
goto bail; goto bail;
@ -547,8 +547,8 @@ DiskFSCFFA::AddVolumeSeries(int start, int count, long blocksPerVolume,
long& startBlock, long& totalBlocksLeft) long& startBlock, long& totalBlocksLeft)
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
DiskFS* pNewFS = nil; DiskFS* pNewFS = NULL;
DiskImg* pNewImg = nil; DiskImg* pNewImg = NULL;
long maxBlocks, fsNumBlocks; long maxBlocks, fsNumBlocks;
bool scanOnly = false; bool scanOnly = false;

View File

@ -161,8 +161,8 @@ DiskFSCPM::Initialize(void)
fVolumeUsage.Dump(); fVolumeUsage.Dump();
//A2File* pFile; //A2File* pFile;
//pFile = GetNextFile(nil); //pFile = GetNextFile(NULL);
//while (pFile != nil) { //while (pFile != NULL) {
// pFile->Dump(); // pFile->Dump();
// pFile = GetNextFile(pFile); // pFile = GetNextFile(pFile);
//} //}
@ -459,9 +459,9 @@ A2FileCPM::Open(A2FileDescr** ppOpenFile, bool readOnly,
bool rsrcFork /*=false*/) bool rsrcFork /*=false*/)
{ {
DIError dierr; DIError dierr;
A2FDCPM* pOpenFile = nil; A2FDCPM* pOpenFile = NULL;
if (fpOpenFile != nil) if (fpOpenFile != NULL)
return kDIErrAlreadyOpen; return kDIErrAlreadyOpen;
if (rsrcFork) if (rsrcFork)
return kDIErrForkNotFound; return kDIErrForkNotFound;
@ -470,7 +470,7 @@ A2FileCPM::Open(A2FileDescr** ppOpenFile, bool readOnly,
pOpenFile = new A2FDCPM(this); pOpenFile = new A2FDCPM(this);
dierr = GetBlockList(&pOpenFile->fBlockCount, nil); dierr = GetBlockList(&pOpenFile->fBlockCount, NULL);
if (dierr != kDIErrNone) if (dierr != kDIErrNone)
goto bail; goto bail;
@ -488,7 +488,7 @@ A2FileCPM::Open(A2FileDescr** ppOpenFile, bool readOnly,
fpOpenFile = pOpenFile; fpOpenFile = pOpenFile;
*ppOpenFile = pOpenFile; *ppOpenFile = pOpenFile;
pOpenFile = nil; pOpenFile = NULL;
bail: bail:
delete pOpenFile; delete pOpenFile;
@ -500,7 +500,7 @@ bail:
* Get the complete block list for a file. This will involve reading * Get the complete block list for a file. This will involve reading
* one or more directory entries. * one or more directory entries.
* *
* Call this once with "blockBuf" equal to "nil" to get the block count, * Call this once with "blockBuf" equal to "NULL" to get the block count,
* then call a second time after allocating blockBuf. * then call a second time after allocating blockBuf.
*/ */
DIError DIError
@ -534,7 +534,7 @@ A2FileCPM::GetBlockList(long* pBlockCount, unsigned char* blockBuf) const
} }
blockCount++; blockCount++;
if (blockBuf != nil) { if (blockBuf != NULL) {
long listOffset = j + long listOffset = j +
fpDirEntry[i].extent * DiskFSCPM::kDirEntryBlockCount; fpDirEntry[i].extent * DiskFSCPM::kDirEntryBlockCount;
blockBuf[listOffset] = fpDirEntry[i].blocks[j]; blockBuf[listOffset] = fpDirEntry[i].blocks[j];
@ -554,8 +554,8 @@ A2FileCPM::GetBlockList(long* pBlockCount, unsigned char* blockBuf) const
//WMSG2(" Returning blockCount=%d for '%s'\n", blockCount, //WMSG2(" Returning blockCount=%d for '%s'\n", blockCount,
// fpDirEntry[fDirIdx].fileName); // fpDirEntry[fDirIdx].fileName);
if (pBlockCount != nil) { if (pBlockCount != NULL) {
assert(blockBuf == nil || *pBlockCount == blockCount); assert(blockBuf == NULL || *pBlockCount == blockCount);
*pBlockCount = blockCount; *pBlockCount = blockCount;
} }
@ -591,11 +591,11 @@ A2FDCPM::Read(void* buf, size_t len, size_t* pActual)
/* don't allow them to read past the end of the file */ /* don't allow them to read past the end of the file */
if (fOffset + (long)len > pFile->fLength) { if (fOffset + (long)len > pFile->fLength) {
if (pActual == nil) if (pActual == NULL)
return kDIErrDataUnderrun; return kDIErrDataUnderrun;
len = (size_t) (pFile->fLength - fOffset); len = (size_t) (pFile->fLength - fOffset);
} }
if (pActual != nil) if (pActual != NULL)
*pActual = len; *pActual = len;
long incrLen = len; long incrLen = len;

View File

@ -40,8 +40,8 @@ DiskFSContainer::CreatePlaceholder(long startBlock, long numBlocks,
DiskImg** ppNewImg, DiskFS** ppNewFS) DiskImg** ppNewImg, DiskFS** ppNewFS)
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
DiskFS* pNewFS = nil; DiskFS* pNewFS = NULL;
DiskImg* pNewImg = nil; DiskImg* pNewImg = NULL;
WMSG3(" %s/CrPl creating placeholder for %ld +%ld\n", GetDebugName(), WMSG3(" %s/CrPl creating placeholder for %ld +%ld\n", GetDebugName(),
startBlock, numBlocks); startBlock, numBlocks);
@ -53,13 +53,13 @@ DiskFSContainer::CreatePlaceholder(long startBlock, long numBlocks,
} }
pNewImg = new DiskImg; pNewImg = new DiskImg;
if (pNewImg == nil) { if (pNewImg == NULL) {
dierr = kDIErrMalloc; dierr = kDIErrMalloc;
goto bail; goto bail;
} }
if (partName != nil) { if (partName != NULL) {
if (partType != nil) if (partType != NULL)
pNewImg->AddNote(DiskImg::kNoteInfo, pNewImg->AddNote(DiskImg::kNoteInfo,
"Partition name='%s' type='%s'.", partName, partType); "Partition name='%s' type='%s'.", partName, partType);
else else
@ -97,7 +97,7 @@ DiskFSContainer::CreatePlaceholder(long startBlock, long numBlocks,
/* open a DiskFS for the sub-image, allowing "unknown" */ /* open a DiskFS for the sub-image, allowing "unknown" */
pNewFS = pNewImg->OpenAppropriateDiskFS(true); pNewFS = pNewImg->OpenAppropriateDiskFS(true);
if (pNewFS == nil) { if (pNewFS == NULL) {
WMSG1(" %s/CrPl: OpenAppropriateDiskFS failed\n", GetDebugName()); WMSG1(" %s/CrPl: OpenAppropriateDiskFS failed\n", GetDebugName());
dierr = kDIErrUnsupportedFSFmt; dierr = kDIErrUnsupportedFSFmt;
goto bail; goto bail;

View File

@ -99,7 +99,7 @@ const unsigned long kDDDProSignature = 0xd0bfc903;
*/ */
class WrapperDDD::BitBuffer { class WrapperDDD::BitBuffer {
public: public:
BitBuffer(void) : fpGFD(nil), fBits(0), fBitCount(0), fIOFailure(false) {} BitBuffer(void) : fpGFD(NULL), fBits(0), fBitCount(0), fIOFailure(false) {}
~BitBuffer(void) {} ~BitBuffer(void) {}
void SetFile(GenericFD* pGFD) { fpGFD = pGFD; } void SetFile(GenericFD* pGFD) { fpGFD = pGFD; }
@ -129,7 +129,7 @@ WrapperDDD::BitBuffer::PutBits(unsigned char bits, int numBits)
{ {
assert(fBitCount >= 0 && fBitCount < 8); assert(fBitCount >= 0 && fBitCount < 8);
assert(numBits > 0 && numBits <= 8); assert(numBits > 0 && numBits <= 8);
assert(fpGFD != nil); assert(fpGFD != NULL);
DIError dierr; DIError dierr;
@ -158,7 +158,7 @@ WrapperDDD::BitBuffer::GetBits(int numBits)
{ {
assert(fBitCount >= 0 && fBitCount < 8); assert(fBitCount >= 0 && fBitCount < 8);
assert(numBits > 0 && numBits <= 8); assert(numBits > 0 && numBits <= 8);
assert(fpGFD != nil); assert(fpGFD != NULL);
DIError dierr; DIError dierr;
unsigned char retVal; unsigned char retVal;
@ -464,8 +464,8 @@ WrapperDDD::UnpackDisk(GenericFD* pGFD, GenericFD* pNewGFD,
unsigned char val; unsigned char val;
long lbuf; long lbuf;
assert(pGFD != nil); assert(pGFD != NULL);
assert(pNewGFD != nil); assert(pNewGFD != NULL);
/* read four zeroes to skip the DOS addr/len bytes */ /* read four zeroes to skip the DOS addr/len bytes */
assert(sizeof(lbuf) >= 4); assert(sizeof(lbuf) >= 4);

View File

@ -217,23 +217,23 @@ DiskImgLib::WriteLongBE(GenericFD* pGFD, unsigned long val)
* in. If the fssep is '\0' (as is the case for DOS 3.3), then the entire * in. If the fssep is '\0' (as is the case for DOS 3.3), then the entire
* pathname is returned. * pathname is returned.
* *
* Always returns a pointer to a string; never returns nil. * Always returns a pointer to a string; never returns NULL.
*/ */
const char* const char*
DiskImgLib::FilenameOnly(const char* pathname, char fssep) DiskImgLib::FilenameOnly(const char* pathname, char fssep)
{ {
const char* retstr; const char* retstr;
const char* pSlash; const char* pSlash;
char* tmpStr = nil; char* tmpStr = NULL;
assert(pathname != nil); assert(pathname != NULL);
if (fssep == '\0') { if (fssep == '\0') {
retstr = pathname; retstr = pathname;
goto bail; goto bail;
} }
pSlash = strrchr(pathname, fssep); pSlash = strrchr(pathname, fssep);
if (pSlash == nil) { if (pSlash == NULL) {
retstr = pathname; /* whole thing is the filename */ retstr = pathname; /* whole thing is the filename */
goto bail; goto bail;
} }
@ -251,7 +251,7 @@ DiskImgLib::FilenameOnly(const char* pathname, char fssep)
tmpStr[strlen(pathname)-1] = '\0'; tmpStr[strlen(pathname)-1] = '\0';
pSlash = strrchr(tmpStr, fssep); pSlash = strrchr(tmpStr, fssep);
if (pSlash == nil) { if (pSlash == NULL) {
retstr = pathname; /* just a filename with a '/' after it */ retstr = pathname; /* just a filename with a '/' after it */
goto bail; goto bail;
} }
@ -279,7 +279,7 @@ bail:
* An extension is the stuff following the last '.' in the filename. If * An extension is the stuff following the last '.' in the filename. If
* there is nothing following the last '.', then there is no extension. * there is nothing following the last '.', then there is no extension.
* *
* Returns a pointer to the '.' preceding the extension, or nil if no * Returns a pointer to the '.' preceding the extension, or NULL if no
* extension was found. * extension was found.
* *
* We guarantee that there is at least one character after the '.'. * We guarantee that there is at least one character after the '.'.
@ -295,20 +295,20 @@ DiskImgLib::FindExtension(const char* pathname, char fssep)
* about "/foo.bar/file". * about "/foo.bar/file".
*/ */
pFilename = FilenameOnly(pathname, fssep); pFilename = FilenameOnly(pathname, fssep);
assert(pFilename != nil); assert(pFilename != NULL);
pExt = strrchr(pFilename, kFilenameExtDelim); pExt = strrchr(pFilename, kFilenameExtDelim);
/* also check for "/blah/foo.", which doesn't count */ /* also check for "/blah/foo.", which doesn't count */
if (pExt != nil && *(pExt+1) != '\0') if (pExt != NULL && *(pExt+1) != '\0')
return pExt; return pExt;
return nil; return NULL;
} }
/* /*
* Like strcpy(), but allocate with new[] instead. * Like strcpy(), but allocate with new[] instead.
* *
* If "str" is nil, or "new" fails, this returns nil. * If "str" is NULL, or "new" fails, this returns NULL.
* *
* TODO: should be "StrdupNew()" * TODO: should be "StrdupNew()"
*/ */
@ -317,10 +317,10 @@ DiskImgLib::StrcpyNew(const char* str)
{ {
char* newStr; char* newStr;
if (str == nil) if (str == NULL)
return nil; return NULL;
newStr = new char[strlen(str)+1]; newStr = new char[strlen(str)+1];
if (newStr != nil) if (newStr != NULL)
strcpy(newStr, str); strcpy(newStr, str);
return newStr; return newStr;
} }

View File

@ -237,8 +237,8 @@ DiskFSDOS33::Initialize(InitMode initMode)
fVolumeUsage.Dump(); fVolumeUsage.Dump();
// A2File* pFile; // A2File* pFile;
// pFile = GetNextFile(nil); // pFile = GetNextFile(NULL);
// while (pFile != nil) { // while (pFile != NULL) {
// pFile->Dump(); // pFile->Dump();
// pFile = GetNextFile(pFile); // pFile = GetNextFile(pFile);
// } // }
@ -998,13 +998,13 @@ DIError
DiskFSDOS33::GetFileLengths(void) DiskFSDOS33::GetFileLengths(void)
{ {
A2FileDOS* pFile; A2FileDOS* pFile;
TrackSector* tsList = nil; TrackSector* tsList = NULL;
TrackSector* indexList = nil; TrackSector* indexList = NULL;
int tsCount; int tsCount;
int indexCount; int indexCount;
pFile = (A2FileDOS*) GetNextFile(nil); pFile = (A2FileDOS*) GetNextFile(NULL);
while (pFile != nil) { while (pFile != NULL) {
DIError dierr; DIError dierr;
dierr = pFile->LoadTSList(&tsList, &tsCount, &indexList, &indexCount); dierr = pFile->LoadTSList(&tsList, &tsCount, &indexList, &indexCount);
if (dierr != kDIErrNone) { if (dierr != kDIErrNone) {
@ -1030,7 +1030,7 @@ DiskFSDOS33::GetFileLengths(void)
delete[] tsList; delete[] tsList;
delete[] indexList; delete[] indexList;
tsList = indexList = nil; tsList = indexList = NULL;
pFile = (A2FileDOS*) GetNextFile(pFile); pFile = (A2FileDOS*) GetNextFile(pFile);
} }
@ -1083,8 +1083,8 @@ DiskFSDOS33::ComputeLength(A2FileDOS* pFile, const TrackSector* tsList,
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
unsigned char sctBuf[kSctSize]; unsigned char sctBuf[kSctSize];
assert(pFile != nil); assert(pFile != NULL);
assert(tsList != nil); assert(tsList != NULL);
assert(tsCount >= 0); assert(tsCount >= 0);
pFile->fDataOffset = 0; pFile->fDataOffset = 0;
@ -1123,8 +1123,8 @@ DiskFSDOS33::ComputeLength(A2FileDOS* pFile, const TrackSector* tsList,
if (pFile->fFileType == A2FileDOS::kTypeBinary && if (pFile->fFileType == A2FileDOS::kTypeBinary &&
pFile->fLength == 0 && pFile->fAuxType == 0 && pFile->fLength == 0 && pFile->fAuxType == 0 &&
tsCount >= 8 && tsCount >= 8 &&
strchr(pFile->fFileName, '<') != nil && strchr(pFile->fFileName, '<') != NULL &&
strchr(pFile->fFileName, '>') != nil) strchr(pFile->fFileName, '>') != NULL)
{ {
WMSG2(" DOS found probable DDD archive, tweaking '%s' (lis=%u)\n", WMSG2(" DOS found probable DDD archive, tweaking '%s' (lis=%u)\n",
pFile->GetPathName(), pFile->fLengthInSectors); pFile->GetPathName(), pFile->fLengthInSectors);
@ -1440,7 +1440,7 @@ DiskFSDOS33::Format(DiskImg* pDiskImg, const char* volName)
return kDIErrInvalidArg; return kDIErrInvalidArg;
} }
if (volName != nil && strcmp(volName, "DOS") == 0) { if (volName != NULL && strcmp(volName, "DOS") == 0) {
if (pDiskImg->GetNumSectPerTrack() != 16 && if (pDiskImg->GetNumSectPerTrack() != 16 &&
pDiskImg->GetNumSectPerTrack() != 13) pDiskImg->GetNumSectPerTrack() != 13)
{ {
@ -1452,7 +1452,7 @@ DiskFSDOS33::Format(DiskImg* pDiskImg, const char* volName)
} }
/* set fpImg so calls that rely on it will work; we un-set it later */ /* set fpImg so calls that rely on it will work; we un-set it later */
assert(fpImg == nil); assert(fpImg == NULL);
SetDiskImg(pDiskImg); SetDiskImg(pDiskImg);
WMSG1(" DOS33 formatting disk image (sectorOrder=%d)\n", WMSG1(" DOS33 formatting disk image (sectorOrder=%d)\n",
@ -1543,7 +1543,7 @@ DiskFSDOS33::Format(DiskImg* pDiskImg, const char* volName)
//ScanVolBitmap(); //ScanVolBitmap();
bail: bail:
SetDiskImg(nil); // shouldn't really be set by us SetDiskImg(NULL); // shouldn't really be set by us
return dierr; return dierr;
} }
@ -1639,7 +1639,7 @@ DiskFSDOS33::DoNormalizePath(const char* name, char fssep, char* outBuf)
/* throw out leading pathname, if any */ /* throw out leading pathname, if any */
if (fssep != '\0') { if (fssep != '\0') {
cp = strrchr(name, fssep); cp = strrchr(name, fssep);
if (cp != nil) if (cp != NULL)
name = cp+1; name = cp+1;
} }
@ -1692,19 +1692,19 @@ DiskFSDOS33::CreateFile(const CreateParms* pParms, A2File** ppNewFile)
char normalName[A2FileDOS::kMaxFileName+1]; char normalName[A2FileDOS::kMaxFileName+1];
// char storageName[A2FileDOS::kMaxFileName+1]; // char storageName[A2FileDOS::kMaxFileName+1];
A2FileDOS::FileType fileType; A2FileDOS::FileType fileType;
A2FileDOS* pNewFile = nil; A2FileDOS* pNewFile = NULL;
if (fpImg->GetReadOnly()) if (fpImg->GetReadOnly())
return kDIErrAccessDenied; return kDIErrAccessDenied;
if (!fDiskIsGood) if (!fDiskIsGood)
return kDIErrBadDiskImage; return kDIErrBadDiskImage;
assert(pParms != nil); assert(pParms != NULL);
assert(pParms->pathName != nil); assert(pParms->pathName != NULL);
assert(pParms->storageType == A2FileProDOS::kStorageSeedling); assert(pParms->storageType == A2FileProDOS::kStorageSeedling);
WMSG1(" DOS33 ---v--- CreateFile '%s'\n", pParms->pathName); WMSG1(" DOS33 ---v--- CreateFile '%s'\n", pParms->pathName);
*ppNewFile = nil; *ppNewFile = NULL;
DoNormalizePath(pParms->pathName, pParms->fssep, normalName); DoNormalizePath(pParms->pathName, pParms->fssep, normalName);
@ -1717,7 +1717,7 @@ DiskFSDOS33::CreateFile(const CreateParms* pParms, A2File** ppNewFile)
if (createUnique) { if (createUnique) {
MakeFileNameUnique(normalName); MakeFileNameUnique(normalName);
} else { } else {
if (GetFileByName(normalName) != nil) { if (GetFileByName(normalName) != NULL) {
WMSG1(" DOS33 create: normalized name '%s' already exists\n", WMSG1(" DOS33 create: normalized name '%s' already exists\n",
normalName); normalName);
dierr = kDIErrFileExists; dierr = kDIErrFileExists;
@ -1781,7 +1781,7 @@ DiskFSDOS33::CreateFile(const CreateParms* pParms, A2File** ppNewFile)
* Create a new entry for our file list. * Create a new entry for our file list.
*/ */
pNewFile = new A2FileDOS(this); pNewFile = new A2FileDOS(this);
if (pNewFile == nil) { if (pNewFile == NULL) {
dierr = kDIErrMalloc; dierr = kDIErrMalloc;
goto bail; goto bail;
} }
@ -1822,7 +1822,7 @@ DiskFSDOS33::CreateFile(const CreateParms* pParms, A2File** ppNewFile)
InsertFileInList(pNewFile, pPrevEntry); InsertFileInList(pNewFile, pPrevEntry);
*ppNewFile = pNewFile; *ppNewFile = pNewFile;
pNewFile = nil; pNewFile = NULL;
bail: bail:
delete pNewFile; delete pNewFile;
@ -1846,10 +1846,10 @@ bail:
DIError DIError
DiskFSDOS33::MakeFileNameUnique(char* fileName) DiskFSDOS33::MakeFileNameUnique(char* fileName)
{ {
assert(fileName != nil); assert(fileName != NULL);
assert(strlen(fileName) <= A2FileDOS::kMaxFileName); assert(strlen(fileName) <= A2FileDOS::kMaxFileName);
if (GetFileByName(fileName) == nil) if (GetFileByName(fileName) == NULL)
return kDIErrNone; return kDIErrNone;
WMSG1(" DOS found duplicate of '%s', making unique\n", fileName); WMSG1(" DOS found duplicate of '%s', making unique\n", fileName);
@ -1866,7 +1866,7 @@ DiskFSDOS33::MakeFileNameUnique(char* fileName)
* to preserve ".gif", ".c", etc. * to preserve ".gif", ".c", etc.
*/ */
const char* cp = strrchr(fileName, '.'); const char* cp = strrchr(fileName, '.');
if (cp != nil) { if (cp != NULL) {
int tmpOffset = cp - fileName; int tmpOffset = cp - fileName;
if (tmpOffset > 0 && nameLen - tmpOffset <= kMaxExtensionLen) { if (tmpOffset > 0 && nameLen - tmpOffset <= kMaxExtensionLen) {
WMSG1(" DOS (keeping extension '%s')\n", cp); WMSG1(" DOS (keeping extension '%s')\n", cp);
@ -1897,7 +1897,7 @@ DiskFSDOS33::MakeFileNameUnique(char* fileName)
memcpy(fileName + copyOffset, digitBuf, digitLen); memcpy(fileName + copyOffset, digitBuf, digitLen);
if (dotLen != 0) if (dotLen != 0)
memcpy(fileName + copyOffset + digitLen, dotBuf, dotLen); memcpy(fileName + copyOffset + digitLen, dotBuf, dotLen);
} while (GetFileByName(fileName) != nil); } while (GetFileByName(fileName) != NULL);
WMSG1(" DOS converted to unique name: %s\n", fileName); WMSG1(" DOS converted to unique name: %s\n", fileName);
@ -1974,10 +1974,10 @@ DiskFSDOS33::GetFreeCatalogEntry(TrackSector* pCatSect, int* pCatEntry,
} }
/* now find it in the linear file list */ /* now find it in the linear file list */
*ppPrevEntry = nil; *ppPrevEntry = NULL;
if (prevEntry >= 0) { if (prevEntry >= 0) {
A2FileDOS* pFile = (A2FileDOS*) GetNextFile(nil); A2FileDOS* pFile = (A2FileDOS*) GetNextFile(NULL);
while (pFile != nil) { while (pFile != NULL) {
if (pFile->fCatTS.track == prevTS.track && if (pFile->fCatTS.track == prevTS.track &&
pFile->fCatTS.sector == prevTS.sector && pFile->fCatTS.sector == prevTS.sector &&
pFile->fCatEntryNum == prevEntry) pFile->fCatEntryNum == prevEntry)
@ -1987,7 +1987,7 @@ DiskFSDOS33::GetFreeCatalogEntry(TrackSector* pCatSect, int* pCatEntry,
} }
pFile = (A2FileDOS*) GetNextFile(pFile); pFile = (A2FileDOS*) GetNextFile(pFile);
} }
assert(*ppPrevEntry != nil); assert(*ppPrevEntry != NULL);
} }
} }
@ -2035,13 +2035,13 @@ DiskFSDOS33::DeleteFile(A2File* pGenericFile)
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
A2FileDOS* pFile = (A2FileDOS*) pGenericFile; A2FileDOS* pFile = (A2FileDOS*) pGenericFile;
TrackSector* tsList = nil; TrackSector* tsList = NULL;
TrackSector* indexList = nil; TrackSector* indexList = NULL;
int tsCount, indexCount; int tsCount, indexCount;
unsigned char sctBuf[kSctSize]; unsigned char sctBuf[kSctSize];
unsigned char* pEntry; unsigned char* pEntry;
if (pGenericFile == nil) { if (pGenericFile == NULL) {
assert(false); assert(false);
return kDIErrInvalidArg; return kDIErrInvalidArg;
} }
@ -2150,7 +2150,7 @@ DiskFSDOS33::RenameFile(A2File* pGenericFile, const char* newName)
unsigned char sctBuf[kSctSize]; unsigned char sctBuf[kSctSize];
unsigned char* pEntry; unsigned char* pEntry;
if (pFile == nil || newName == nil) if (pFile == NULL || newName == NULL)
return kDIErrInvalidArg; return kDIErrInvalidArg;
if (!IsValidFileName(newName)) if (!IsValidFileName(newName))
return kDIErrInvalidArg; return kDIErrInvalidArg;
@ -2211,12 +2211,12 @@ DiskFSDOS33::SetFileInfo(A2File* pGenericFile, long fileType, long auxType,
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
A2FileDOS* pFile = (A2FileDOS*) pGenericFile; A2FileDOS* pFile = (A2FileDOS*) pGenericFile;
TrackSector* tsList = nil; TrackSector* tsList = NULL;
int tsCount; int tsCount;
bool nowLocked; bool nowLocked;
bool typeChanged; bool typeChanged;
if (pFile == nil) if (pFile == NULL)
return kDIErrInvalidArg; return kDIErrInvalidArg;
if (fpImg->GetReadOnly()) if (fpImg->GetReadOnly())
return kDIErrAccessDenied; return kDIErrAccessDenied;
@ -2426,7 +2426,7 @@ A2FileDOS::A2FileDOS(DiskFS* pDiskFS) : A2File(pDiskFS)
fLength = -1; fLength = -1;
fSparseLength = -1; fSparseLength = -1;
fpOpenFile = nil; fpOpenFile = NULL;
} }
/* /*
@ -2614,7 +2614,7 @@ A2FileDOS::Open(A2FileDescr** ppOpenFile, bool readOnly,
bool rsrcFork /*=false*/) bool rsrcFork /*=false*/)
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
A2FDDOS* pOpenFile = nil; A2FDDOS* pOpenFile = NULL;
if (!readOnly) { if (!readOnly) {
if (fpDiskFS->GetDiskImg()->GetReadOnly()) if (fpDiskFS->GetDiskImg()->GetReadOnly())
@ -2623,7 +2623,7 @@ A2FileDOS::Open(A2FileDescr** ppOpenFile, bool readOnly,
return kDIErrBadDiskImage; return kDIErrBadDiskImage;
} }
if (fpOpenFile != nil) { if (fpOpenFile != NULL) {
dierr = kDIErrAlreadyOpen; dierr = kDIErrAlreadyOpen;
goto bail; goto bail;
} }
@ -2646,7 +2646,7 @@ A2FileDOS::Open(A2FileDescr** ppOpenFile, bool readOnly,
fpOpenFile = pOpenFile; // add it to our single-member "open file set" fpOpenFile = pOpenFile; // add it to our single-member "open file set"
*ppOpenFile = pOpenFile; *ppOpenFile = pOpenFile;
pOpenFile = nil; pOpenFile = NULL;
bail: bail:
delete pOpenFile; delete pOpenFile;
@ -2676,7 +2676,7 @@ A2FileDOS::Dump(void) const
* possible for a random-access text file to have a very large number of * possible for a random-access text file to have a very large number of
* entries. * entries.
* *
* If "pIndexList" and "pIndexCount" are non-nil, the list of index blocks is * If "pIndexList" and "pIndexCount" are non-NULL, the list of index blocks is
* also loaded. * also loaded.
* *
* It's entirely possible to get a large T/S list back that is filled * It's entirely possible to get a large T/S list back that is filled
@ -2698,8 +2698,8 @@ A2FileDOS::LoadTSList(TrackSector** pTSList, int* pTSCount,
DiskImg* pDiskImg; DiskImg* pDiskImg;
const int kDefaultTSAlloc = 2; const int kDefaultTSAlloc = 2;
const int kDefaultIndexAlloc = 8; const int kDefaultIndexAlloc = 8;
TrackSector* tsList = nil; TrackSector* tsList = NULL;
TrackSector* indexList = nil; TrackSector* indexList = NULL;
int tsCount, tsAlloc; int tsCount, tsAlloc;
int indexCount, indexAlloc; int indexCount, indexAlloc;
unsigned char sctBuf[kSctSize]; unsigned char sctBuf[kSctSize];
@ -2716,14 +2716,14 @@ A2FileDOS::LoadTSList(TrackSector** pTSList, int* pTSCount,
indexList = new TrackSector[indexAlloc]; indexList = new TrackSector[indexAlloc];
indexCount = 0; indexCount = 0;
if (tsList == nil || indexList == nil) { if (tsList == NULL || indexList == NULL) {
dierr = kDIErrMalloc; dierr = kDIErrMalloc;
goto bail; goto bail;
} }
assert(fpDiskFS != nil); assert(fpDiskFS != NULL);
pDiskImg = fpDiskFS->GetDiskImg(); pDiskImg = fpDiskFS->GetDiskImg();
assert(pDiskImg != nil); assert(pDiskImg != NULL);
/* get the first T/S sector for this file */ /* get the first T/S sector for this file */
track = fTSListTrack; track = fTSListTrack;
@ -2753,7 +2753,7 @@ A2FileDOS::LoadTSList(TrackSector** pTSList, int* pTSCount,
TrackSector* newList; TrackSector* newList;
indexAlloc += kDefaultIndexAlloc; indexAlloc += kDefaultIndexAlloc;
newList = new TrackSector[indexAlloc]; newList = new TrackSector[indexAlloc];
if (newList == nil) { if (newList == NULL) {
dierr = kDIErrMalloc; dierr = kDIErrMalloc;
goto bail; goto bail;
} }
@ -2801,7 +2801,7 @@ A2FileDOS::LoadTSList(TrackSector** pTSList, int* pTSCount,
TrackSector* newList; TrackSector* newList;
tsAlloc += kMaxTSPairs * kDefaultTSAlloc; tsAlloc += kMaxTSPairs * kDefaultTSAlloc;
newList = new TrackSector[tsAlloc]; newList = new TrackSector[tsAlloc];
if (newList == nil) { if (newList == NULL) {
dierr = kDIErrMalloc; dierr = kDIErrMalloc;
goto bail; goto bail;
} }
@ -2843,12 +2843,12 @@ A2FileDOS::LoadTSList(TrackSector** pTSList, int* pTSCount,
*pTSList = tsList; *pTSList = tsList;
*pTSCount = tsCount; *pTSCount = tsCount;
tsList = nil; tsList = NULL;
if (pIndexList != nil) { if (pIndexList != NULL) {
*pIndexList = indexList; *pIndexList = indexList;
*pIndexCount = indexCount; *pIndexCount = indexCount;
indexList = nil; indexList = NULL;
} }
bail: bail:
@ -2949,11 +2949,11 @@ A2FDDOS::Read(void* buf, size_t len, size_t* pActual)
* from the actual data length, so don't factor it in again. * from the actual data length, so don't factor it in again.
*/ */
if (fOffset + (long)len > fOpenEOF) { if (fOffset + (long)len > fOpenEOF) {
if (pActual == nil) if (pActual == NULL)
return kDIErrDataUnderrun; return kDIErrDataUnderrun;
len = (size_t) (fOpenEOF - fOffset); len = (size_t) (fOpenEOF - fOffset);
} }
if (pActual != nil) if (pActual != NULL)
*pActual = len; *pActual = len;
long incrLen = len; long incrLen = len;
@ -3042,7 +3042,7 @@ A2FDDOS::Write(const void* buf, size_t len, size_t* pActual)
assert(fTSCount == 0); // must hold for our newly-created files assert(fTSCount == 0); // must hold for our newly-created files
assert(fIndexCount == 1); // must hold for our newly-created files assert(fIndexCount == 1); // must hold for our newly-created files
assert(fOpenSectorsUsed == fTSCount + fIndexCount); assert(fOpenSectorsUsed == fTSCount + fIndexCount);
assert(buf != nil); assert(buf != NULL);
long actualLen = (long) len + pFile->fDataOffset; long actualLen = (long) len + pFile->fDataOffset;
long numSectors = (actualLen + kSctSize -1) / kSctSize; long numSectors = (actualLen + kSctSize -1) / kSctSize;
@ -3074,14 +3074,14 @@ A2FDDOS::Write(const void* buf, size_t len, size_t* pActual)
firstIndex = fIndexList[0]; firstIndex = fIndexList[0];
delete[] fTSList; delete[] fTSList;
delete[] fIndexList; delete[] fIndexList;
fTSList = fIndexList = nil; fTSList = fIndexList = NULL;
fTSCount = numSectors; fTSCount = numSectors;
fTSList = new TrackSector[fTSCount]; fTSList = new TrackSector[fTSCount];
fIndexCount = (numSectors + kMaxTSPairs -1) / kMaxTSPairs; fIndexCount = (numSectors + kMaxTSPairs -1) / kMaxTSPairs;
assert(fIndexCount > 0); assert(fIndexCount > 0);
fIndexList = new TrackSector[fIndexCount]; fIndexList = new TrackSector[fIndexCount];
if (fTSList == nil || fIndexList == nil) { if (fTSList == NULL || fIndexList == NULL) {
dierr = kDIErrMalloc; dierr = kDIErrMalloc;
goto bail; goto bail;
} }

View File

@ -62,17 +62,17 @@ A2File::ResetQuality(void)
void void
DiskFS::SetDiskImg(DiskImg* pImg) DiskFS::SetDiskImg(DiskImg* pImg)
{ {
if (pImg == nil && fpImg == nil) { if (pImg == NULL && fpImg == NULL) {
WMSG0("SetDiskImg: no-op (both nil)\n"); WMSG0("SetDiskImg: no-op (both NULL)\n");
return; return;
} else if (fpImg == pImg) { } else if (fpImg == pImg) {
WMSG0("SetDiskImg: no-op (old == new)\n"); WMSG0("SetDiskImg: no-op (old == new)\n");
return; return;
} }
if (fpImg != nil) if (fpImg != NULL)
fpImg->RemoveDiskFS(this); fpImg->RemoveDiskFS(this);
if (pImg != nil) if (pImg != NULL)
pImg->AddDiskFS(this); pImg->AddDiskFS(this);
fpImg = pImg; fpImg = pImg;
} }
@ -83,10 +83,10 @@ DiskFS::SetDiskImg(DiskImg* pImg)
DIError DIError
DiskFS::Flush(DiskImg::FlushMode mode) DiskFS::Flush(DiskImg::FlushMode mode)
{ {
SubVolume* pSubVol = GetNextSubVolume(nil); SubVolume* pSubVol = GetNextSubVolume(NULL);
DIError dierr; DIError dierr;
while (pSubVol != nil) { while (pSubVol != NULL) {
// quick sanity check // quick sanity check
assert(pSubVol->GetDiskFS()->GetDiskImg() == pSubVol->GetDiskImg()); assert(pSubVol->GetDiskFS()->GetDiskImg() == pSubVol->GetDiskImg());
@ -98,7 +98,7 @@ DiskFS::Flush(DiskImg::FlushMode mode)
pSubVol = GetNextSubVolume(pSubVol); pSubVol = GetNextSubVolume(pSubVol);
} }
assert(fpImg != nil); assert(fpImg != NULL);
return fpImg->FlushImage(mode); return fpImg->FlushImage(mode);
} }
@ -109,14 +109,14 @@ DiskFS::Flush(DiskImg::FlushMode mode)
void void
DiskFS::SetAllReadOnly(bool val) DiskFS::SetAllReadOnly(bool val)
{ {
SubVolume* pSubVol = GetNextSubVolume(nil); SubVolume* pSubVol = GetNextSubVolume(NULL);
/* put current volume in read-only mode */ /* put current volume in read-only mode */
if (fpImg != nil) if (fpImg != NULL)
fpImg->SetReadOnly(val); fpImg->SetReadOnly(val);
/* handle our kids */ /* handle our kids */
while (pSubVol != nil) { while (pSubVol != NULL) {
// quick sanity check // quick sanity check
assert(pSubVol->GetDiskFS()->GetDiskImg() == pSubVol->GetDiskImg()); assert(pSubVol->GetDiskFS()->GetDiskImg() == pSubVol->GetDiskImg());
@ -164,10 +164,10 @@ DiskFS::SetAllReadOnly(bool val)
void void
DiskFS::AddFileToList(A2File* pFile) DiskFS::AddFileToList(A2File* pFile)
{ {
assert(pFile->GetNext() == nil); assert(pFile->GetNext() == NULL);
if (fpA2Head == nil) { if (fpA2Head == NULL) {
assert(fpA2Tail == nil); assert(fpA2Tail == NULL);
fpA2Head = fpA2Tail = pFile; fpA2Head = fpA2Tail = pFile;
} else { } else {
pFile->SetPrev(fpA2Tail); pFile->SetPrev(fpA2Tail);
@ -196,13 +196,13 @@ DiskFS::AddFileToList(A2File* pFile)
void void
DiskFS::InsertFileInList(A2File* pFile, A2File* pPrev) DiskFS::InsertFileInList(A2File* pFile, A2File* pPrev)
{ {
assert(pFile->GetNext() == nil); assert(pFile->GetNext() == NULL);
if (fpA2Head == nil) { if (fpA2Head == NULL) {
assert(pPrev == nil); assert(pPrev == NULL);
fpA2Head = fpA2Tail = pFile; fpA2Head = fpA2Tail = pFile;
return; return;
} else if (pPrev == nil) { } else if (pPrev == NULL) {
// create two entries on DOS disk, delete first, add new file // create two entries on DOS disk, delete first, add new file
pFile->SetNext(fpA2Head); pFile->SetNext(fpA2Head);
fpA2Head = pFile; fpA2Head = pFile;
@ -231,17 +231,17 @@ DiskFS::InsertFileInList(A2File* pFile, A2File* pPrev)
A2File* A2File*
DiskFS::SkipSubdir(A2File* pSubdir) DiskFS::SkipSubdir(A2File* pSubdir)
{ {
if (pSubdir->GetNext() == nil) if (pSubdir->GetNext() == NULL)
return pSubdir; // end of list reached -- subdir is empty return pSubdir; // end of list reached -- subdir is empty
A2File* pCur = pSubdir; A2File* pCur = pSubdir;
A2File* pNext = nil; A2File* pNext = NULL;
assert(pCur != nil); // at least one time through the loop assert(pCur != NULL); // at least one time through the loop
while (pCur != nil) { while (pCur != NULL) {
pNext = pCur->GetNext(); pNext = pCur->GetNext();
if (pNext == nil) // end of list reached if (pNext == NULL) // end of list reached
return pCur; return pCur;
if (pNext->GetParent() != pSubdir) // end of dir reached if (pNext->GetParent() != pSubdir) // end of dir reached
@ -271,7 +271,7 @@ DiskFS::DeleteFileFromList(A2File* pFile)
delete pFile; delete pFile;
} else { } else {
A2File* pCur = fpA2Head; A2File* pCur = fpA2Head;
while (pCur != nil) { while (pCur != NULL) {
if (pCur->GetNext() == pFile) { if (pCur->GetNext() == pFile) {
/* found it */ /* found it */
A2File* pNextNext = pCur->GetNext()->GetNext(); A2File* pNextNext = pCur->GetNext()->GetNext();
@ -282,7 +282,7 @@ DiskFS::DeleteFileFromList(A2File* pFile)
pCur = pCur->GetNext(); pCur = pCur->GetNext();
} }
if (pCur == nil) { if (pCur == NULL) {
WMSG0("GLITCH: couldn't find element to delete!\n"); WMSG0("GLITCH: couldn't find element to delete!\n");
assert(false); assert(false);
} }
@ -317,7 +317,7 @@ DiskFS::GetFileCount(void) const
long count = 0; long count = 0;
A2File* pFile = fpA2Head; A2File* pFile = fpA2Head;
while (pFile != nil) { while (pFile != NULL) {
count++; count++;
pFile = pFile->GetNext(); pFile = pFile->GetNext();
} }
@ -335,7 +335,7 @@ DiskFS::DeleteFileList(void)
A2File* pNext; A2File* pNext;
pFile = fpA2Head; pFile = fpA2Head;
while (pFile != nil) { while (pFile != NULL) {
pNext = pFile->GetNext(); pNext = pFile->GetNext();
delete pFile; delete pFile;
pFile = pNext; pFile = pNext;
@ -352,8 +352,8 @@ DiskFS::DumpFileList(void)
WMSG0("DiskFS file list contents:\n"); WMSG0("DiskFS file list contents:\n");
pFile = GetNextFile(nil); pFile = GetNextFile(NULL);
while (pFile != nil) { while (pFile != NULL) {
WMSG1(" %s\n", pFile->GetPathName()); WMSG1(" %s\n", pFile->GetPathName());
pFile = GetNextFile(pFile); pFile = GetNextFile(pFile);
} }
@ -372,18 +372,18 @@ DiskFS::GetFileByName(const char* fileName, StringCompareFunc func)
{ {
A2File* pFile; A2File* pFile;
if (func == nil) if (func == NULL)
func = ::strcasecmp; func = ::strcasecmp;
pFile = GetNextFile(nil); pFile = GetNextFile(NULL);
while (pFile != nil) { while (pFile != NULL) {
if ((*func)(pFile->GetPathName(), fileName) == 0) if ((*func)(pFile->GetPathName(), fileName) == 0)
return pFile; return pFile;
pFile = GetNextFile(pFile); pFile = GetNextFile(pFile);
} }
return nil; return NULL;
} }
@ -403,7 +403,7 @@ DiskFS::AddSubVolumeToList(DiskImg* pDiskImg, DiskFS* pDiskFS)
/* /*
* Check the arguments. * Check the arguments.
*/ */
if (pDiskImg == nil || pDiskFS == nil) { if (pDiskImg == NULL || pDiskFS == NULL) {
WMSG2(" DiskFS bogus sub volume ptrs %08lx %08lx\n", WMSG2(" DiskFS bogus sub volume ptrs %08lx %08lx\n",
(long) pDiskImg, (long) pDiskFS); (long) pDiskImg, (long) pDiskFS);
assert(false); assert(false);
@ -414,13 +414,13 @@ DiskFS::AddSubVolumeToList(DiskImg* pDiskImg, DiskFS* pDiskFS)
assert(false); assert(false);
return; return;
} }
if (pDiskFS->GetDiskImg() == nil) { if (pDiskFS->GetDiskImg() == NULL) {
WMSG0(" DiskFS lacks a DiskImg pointer\n"); WMSG0(" DiskFS lacks a DiskImg pointer\n");
assert(false); assert(false);
return; return;
} }
pSubVol = fpSubVolumeHead; pSubVol = fpSubVolumeHead;
while (pSubVol != nil) { while (pSubVol != NULL) {
if (pSubVol->GetDiskImg() == pDiskImg || if (pSubVol->GetDiskImg() == pDiskImg ||
pSubVol->GetDiskFS() == pDiskFS) pSubVol->GetDiskFS() == pDiskFS)
{ {
@ -437,13 +437,13 @@ DiskFS::AddSubVolumeToList(DiskImg* pDiskImg, DiskFS* pDiskFS)
* Looks good. Add it. * Looks good. Add it.
*/ */
pSubVol = new SubVolume; pSubVol = new SubVolume;
if (pSubVol == nil) if (pSubVol == NULL)
return; return;
pSubVol->Create(pDiskImg, pDiskFS); pSubVol->Create(pDiskImg, pDiskFS);
if (fpSubVolumeHead == nil) { if (fpSubVolumeHead == NULL) {
assert(fpSubVolumeTail == nil); assert(fpSubVolumeTail == NULL);
fpSubVolumeHead = fpSubVolumeTail = pSubVol; fpSubVolumeHead = fpSubVolumeTail = pSubVol;
} else { } else {
pSubVol->SetPrev(fpSubVolumeTail); pSubVol->SetPrev(fpSubVolumeTail);
@ -500,7 +500,7 @@ DiskFS::DeleteSubVolumeList(void)
SubVolume* pNext; SubVolume* pNext;
pSubVol = fpSubVolumeHead; pSubVol = fpSubVolumeHead;
while (pSubVol != nil) { while (pSubVol != NULL) {
pNext = pSubVol->GetNext(); pNext = pSubVol->GetNext();
delete pSubVol; delete pSubVol;
pSubVol = pNext; pSubVol = pNext;
@ -529,8 +529,8 @@ DiskFS::SetParameter(DiskFSParameter parm, long val)
assert(parm > kParmUnknown && parm < kParmMax); assert(parm > kParmUnknown && parm < kParmMax);
fParmTable[parm] = val; fParmTable[parm] = val;
SubVolume* pSubVol = GetNextSubVolume(nil); SubVolume* pSubVol = GetNextSubVolume(NULL);
while (pSubVol != nil) { while (pSubVol != NULL) {
pSubVol->GetDiskFS()->SetParameter(parm, val); pSubVol->GetDiskFS()->SetParameter(parm, val);
pSubVol = GetNextSubVolume(pSubVol); pSubVol = GetNextSubVolume(pSubVol);
} }
@ -547,8 +547,8 @@ DiskFS::ScanForDamagedFiles(bool* pDamaged, bool* pSuspicious)
*pDamaged = *pSuspicious = false; *pDamaged = *pSuspicious = false;
pFile = GetNextFile(nil); pFile = GetNextFile(NULL);
while (pFile != nil) { while (pFile != NULL) {
if (pFile->GetQuality() == A2File::kQualityDamaged) if (pFile->GetQuality() == A2File::kQualityDamaged)
*pDamaged = true; *pDamaged = true;
if (pFile->GetQuality() != A2File::kQualityGood) if (pFile->GetQuality() != A2File::kQualityGood)

View File

@ -165,7 +165,7 @@
DiskImg::GetStdNibbleDescr(StdNibbleDescr idx) DiskImg::GetStdNibbleDescr(StdNibbleDescr idx)
{ {
if ((int)idx < 0 || (int)idx >= (int) NELEM(kStdNibbleDescrs)) if ((int)idx < 0 || (int)idx >= (int) NELEM(kStdNibbleDescrs))
return nil; return NULL;
return &kStdNibbleDescrs[(int)idx]; return &kStdNibbleDescrs[(int)idx];
} }
@ -180,7 +180,7 @@ DiskImg::DiskImg(void)
fOuterFormat = kOuterFormatUnknown; fOuterFormat = kOuterFormatUnknown;
fFileFormat = kFileFormatUnknown; fFileFormat = kFileFormatUnknown;
fPhysical = kPhysicalFormatUnknown; fPhysical = kPhysicalFormatUnknown;
fpNibbleDescr = nil; fpNibbleDescr = NULL;
fOrder = kSectorOrderUnknown; fOrder = kSectorOrderUnknown;
fFormat = kFormatUnknown; fFormat = kFormatUnknown;
@ -188,12 +188,12 @@ DiskImg::DiskImg(void)
fSectorPairing = false; fSectorPairing = false;
fSectorPairOffset = -1; fSectorPairOffset = -1;
fpOuterGFD = nil; fpOuterGFD = NULL;
fpWrapperGFD = nil; fpWrapperGFD = NULL;
fpDataGFD = nil; fpDataGFD = NULL;
fpOuterWrapper = nil; fpOuterWrapper = NULL;
fpImageWrapper = nil; fpImageWrapper = NULL;
fpParentImg = nil; fpParentImg = NULL;
fDOSVolumeNum = kVolumeNumNotSet; fDOSVolumeNum = kVolumeNumNotSet;
fOuterLength = -1; fOuterLength = -1;
fWrappedLength = -1; fWrappedLength = -1;
@ -227,13 +227,13 @@ DiskImg::DiskImg(void)
fNumNibbleDescrEntries = NELEM(kStdNibbleDescrs); fNumNibbleDescrEntries = NELEM(kStdNibbleDescrs);
memcpy(fpNibbleDescrTable, kStdNibbleDescrs, sizeof(kStdNibbleDescrs)); memcpy(fpNibbleDescrTable, kStdNibbleDescrs, sizeof(kStdNibbleDescrs));
fNibbleTrackBuf = nil; fNibbleTrackBuf = NULL;
fNibbleTrackLoaded = -1; fNibbleTrackLoaded = -1;
fNuFXCompressType = kNuThreadFormatLZW2; fNuFXCompressType = kNuThreadFormatLZW2;
fNotes = nil; fNotes = NULL;
fpBadBlockMap = nil; fpBadBlockMap = NULL;
fDiskFSRefCnt = 0; fDiskFSRefCnt = 0;
} }
@ -242,7 +242,7 @@ DiskImg::DiskImg(void)
*/ */
DiskImg::~DiskImg(void) DiskImg::~DiskImg(void)
{ {
if (fpDataGFD != nil) { if (fpDataGFD != NULL) {
WMSG0("~DiskImg closing GenericFD(s)\n"); WMSG0("~DiskImg closing GenericFD(s)\n");
} }
(void) CloseImage(); (void) CloseImage();
@ -252,15 +252,15 @@ DiskImg::~DiskImg(void)
delete fpBadBlockMap; delete fpBadBlockMap;
/* normally these will be closed, but perhaps not if something failed */ /* normally these will be closed, but perhaps not if something failed */
if (fpOuterGFD != nil) if (fpOuterGFD != NULL)
delete fpOuterGFD; delete fpOuterGFD;
if (fpWrapperGFD != nil) if (fpWrapperGFD != NULL)
delete fpWrapperGFD; delete fpWrapperGFD;
if (fpDataGFD != nil) if (fpDataGFD != NULL)
delete fpDataGFD; delete fpDataGFD;
if (fpOuterWrapper != nil) if (fpOuterWrapper != NULL)
delete fpOuterWrapper; delete fpOuterWrapper;
if (fpImageWrapper != nil) if (fpImageWrapper != NULL)
delete fpImageWrapper; delete fpImageWrapper;
fDiskFSRefCnt = 100; // flag as freed fDiskFSRefCnt = 100; // flag as freed
@ -307,7 +307,7 @@ DiskImg::OpenImage(const char* pathName, char fssep, bool readOnly)
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
bool isWinDevice = false; bool isWinDevice = false;
if (fpDataGFD != nil) { if (fpDataGFD != NULL) {
WMSG0(" DI already open!\n"); WMSG0(" DI already open!\n");
return kDIErrAlreadyOpen; return kDIErrAlreadyOpen;
} }
@ -367,7 +367,7 @@ DiskImg::OpenImage(const char* pathName, char fssep, bool readOnly)
//strcpy(fImageFileName, pathName); //strcpy(fImageFileName, pathName);
fpWrapperGFD = pGFDFile; fpWrapperGFD = pGFDFile;
pGFDFile = nil; pGFDFile = NULL;
dierr = AnalyzeImageFile(pathName, fssep); dierr = AnalyzeImageFile(pathName, fssep);
if (dierr != kDIErrNone) if (dierr != kDIErrNone)
@ -375,7 +375,7 @@ DiskImg::OpenImage(const char* pathName, char fssep, bool readOnly)
} }
assert(fpDataGFD != nil); assert(fpDataGFD != NULL);
bail: bail:
return dierr; return dierr;
@ -388,7 +388,7 @@ bail:
DIError DIError
DiskImg::OpenImage(const void* buffer, long length, bool readOnly) DiskImg::OpenImage(const void* buffer, long length, bool readOnly)
{ {
if (fpDataGFD != nil) { if (fpDataGFD != NULL) {
WMSG0(" DI already open!\n"); WMSG0(" DI already open!\n");
return kDIErrAlreadyOpen; return kDIErrAlreadyOpen;
} }
@ -408,13 +408,13 @@ DiskImg::OpenImage(const void* buffer, long length, bool readOnly)
} }
fpWrapperGFD = pGFDBuffer; fpWrapperGFD = pGFDBuffer;
pGFDBuffer = nil; pGFDBuffer = NULL;
dierr = AnalyzeImageFile("", '\0'); dierr = AnalyzeImageFile("", '\0');
if (dierr != kDIErrNone) if (dierr != kDIErrNone)
return dierr; return dierr;
assert(fpDataGFD != nil); assert(fpDataGFD != NULL);
return kDIErrNone; return kDIErrNone;
} }
@ -438,12 +438,12 @@ DiskImg::OpenImage(DiskImg* pParent, long firstBlock, long numBlocks)
{ {
WMSG3(" DI OpenImage parent=0x%08lx %ld %ld\n", (long) pParent, firstBlock, WMSG3(" DI OpenImage parent=0x%08lx %ld %ld\n", (long) pParent, firstBlock,
numBlocks); numBlocks);
if (fpDataGFD != nil) { if (fpDataGFD != NULL) {
WMSG0(" DI already open!\n"); WMSG0(" DI already open!\n");
return kDIErrAlreadyOpen; return kDIErrAlreadyOpen;
} }
if (pParent == nil || firstBlock < 0 || numBlocks <= 0 || if (pParent == NULL || firstBlock < 0 || numBlocks <= 0 ||
firstBlock + numBlocks > pParent->GetNumBlocks()) firstBlock + numBlocks > pParent->GetNumBlocks())
{ {
assert(false); assert(false);
@ -463,7 +463,7 @@ DiskImg::OpenImage(DiskImg* pParent, long firstBlock, long numBlocks)
} }
fpDataGFD = pGFDGFD; fpDataGFD = pGFDGFD;
assert(fpWrapperGFD == nil); assert(fpWrapperGFD == NULL);
/* /*
* This replaces the call to "analyze image file" because we know we * This replaces the call to "analyze image file" because we know we
@ -486,12 +486,12 @@ DiskImg::OpenImage(DiskImg* pParent, long firstTrack, long firstSector,
{ {
WMSG4(" DI OpenImage parent=0x%08lx %ld %ld %ld\n", (long) pParent, WMSG4(" DI OpenImage parent=0x%08lx %ld %ld %ld\n", (long) pParent,
firstTrack, firstSector, numSectors); firstTrack, firstSector, numSectors);
if (fpDataGFD != nil) { if (fpDataGFD != NULL) {
WMSG0(" DI already open!\n"); WMSG0(" DI already open!\n");
return kDIErrAlreadyOpen; return kDIErrAlreadyOpen;
} }
if (pParent == nil) if (pParent == NULL)
return kDIErrInvalidArg; return kDIErrInvalidArg;
int prntSectPerTrack = pParent->GetNumSectPerTrack(); int prntSectPerTrack = pParent->GetNumSectPerTrack();
@ -517,7 +517,7 @@ DiskImg::OpenImage(DiskImg* pParent, long firstTrack, long firstSector,
} }
fpDataGFD = pGFDGFD; fpDataGFD = pGFDGFD;
assert(fpWrapperGFD == nil); assert(fpWrapperGFD == NULL);
/* /*
* This replaces the call to "analyze image file" because we know we * This replaces the call to "analyze image file" because we know we
@ -591,25 +591,25 @@ DiskImg::CloseImage(void)
* In some cases we will have the file open more than once (e.g. a * In some cases we will have the file open more than once (e.g. a
* NuFX archive, which must be opened on disk). * NuFX archive, which must be opened on disk).
*/ */
if (fpDataGFD != nil) { if (fpDataGFD != NULL) {
fpDataGFD->Close(); fpDataGFD->Close();
delete fpDataGFD; delete fpDataGFD;
fpDataGFD = nil; fpDataGFD = NULL;
} }
if (fpWrapperGFD != nil) { if (fpWrapperGFD != NULL) {
fpWrapperGFD->Close(); fpWrapperGFD->Close();
delete fpWrapperGFD; delete fpWrapperGFD;
fpWrapperGFD = nil; fpWrapperGFD = NULL;
} }
if (fpOuterGFD != nil) { if (fpOuterGFD != NULL) {
fpOuterGFD->Close(); fpOuterGFD->Close();
delete fpOuterGFD; delete fpOuterGFD;
fpOuterGFD = nil; fpOuterGFD = NULL;
} }
delete fpImageWrapper; delete fpImageWrapper;
fpImageWrapper = nil; fpImageWrapper = NULL;
delete fpOuterWrapper; delete fpOuterWrapper;
fpOuterWrapper = nil; fpOuterWrapper = NULL;
return dierr; return dierr;
} }
@ -641,7 +641,7 @@ DiskImg::FlushImage(FlushMode mode)
WMSG2(" DI FlushImage (dirty=%d mode=%d)\n", fDirty, mode); WMSG2(" DI FlushImage (dirty=%d mode=%d)\n", fDirty, mode);
if (!fDirty) if (!fDirty)
return kDIErrNone; return kDIErrNone;
if (fpDataGFD == nil) { if (fpDataGFD == NULL) {
/* /*
* This can happen if we tried to create a disk image but failed, e.g. * This can happen if we tried to create a disk image but failed, e.g.
* couldn't create the output file because of access denied on the * couldn't create the output file because of access denied on the
@ -655,8 +655,8 @@ DiskImg::FlushImage(FlushMode mode)
} }
if (mode == kFlushFastOnly && if (mode == kFlushFastOnly &&
((fpImageWrapper != nil && !fpImageWrapper->HasFastFlush()) || ((fpImageWrapper != NULL && !fpImageWrapper->HasFastFlush()) ||
(fpOuterWrapper != nil && !fpOuterWrapper->HasFastFlush()) )) (fpOuterWrapper != NULL && !fpOuterWrapper->HasFastFlush()) ))
{ {
WMSG0("DI fast flush requested, but one or both wrappers are slow\n"); WMSG0("DI fast flush requested, but one or both wrappers are slow\n");
return kDIErrNone; return kDIErrNone;
@ -680,10 +680,10 @@ DiskImg::FlushImage(FlushMode mode)
* rename over the old will close fpWrapperGFD and just access it * rename over the old will close fpWrapperGFD and just access it
* directly. This is bad, because it doesn't allow them to have an * directly. This is bad, because it doesn't allow them to have an
* "outer" format, but it's the way life is. The point is that it's * "outer" format, but it's the way life is. The point is that it's
* okay for fpWrapperGFD to be non-nil but represent a closed file, * okay for fpWrapperGFD to be non-NULL but represent a closed file,
* so long as the "Flush" function has it figured out.) * so long as the "Flush" function has it figured out.)
*/ */
if (fpWrapperGFD != nil) { if (fpWrapperGFD != NULL) {
WMSG2(" DI flushing data changes to wrapper (fLen=%ld fWrapLen=%ld)\n", WMSG2(" DI flushing data changes to wrapper (fLen=%ld fWrapLen=%ld)\n",
(long) fLength, (long) fWrappedLength); (long) fLength, (long) fWrappedLength);
dierr = fpImageWrapper->Flush(fpWrapperGFD, fpDataGFD, fLength, dierr = fpImageWrapper->Flush(fpWrapperGFD, fpDataGFD, fLength,
@ -695,17 +695,17 @@ DiskImg::FlushImage(FlushMode mode)
/* flush the GFD in case it's a Win32 volume with block caching */ /* flush the GFD in case it's a Win32 volume with block caching */
dierr = fpWrapperGFD->Flush(); dierr = fpWrapperGFD->Flush();
} else { } else {
assert(fpParentImg != nil); assert(fpParentImg != NULL);
} }
/* /*
* Step 3: if we have an fpOuterGFD, rebuild the file with the data * Step 3: if we have an fpOuterGFD, rebuild the file with the data
* in fpWrapperGFD. * in fpWrapperGFD.
*/ */
if (fpOuterWrapper != nil) { if (fpOuterWrapper != NULL) {
WMSG1(" DI saving wrapper to outer, fWrapLen=%ld\n", WMSG1(" DI saving wrapper to outer, fWrapLen=%ld\n",
(long) fWrappedLength); (long) fWrappedLength);
assert(fpOuterGFD != nil); assert(fpOuterGFD != NULL);
dierr = fpOuterWrapper->Save(fpOuterGFD, fpWrapperGFD, dierr = fpOuterWrapper->Save(fpOuterGFD, fpWrapperGFD,
fWrappedLength); fWrappedLength);
if (dierr != kDIErrNone) { if (dierr != kDIErrNone) {
@ -755,7 +755,7 @@ DiskImg::FlushImage(FlushMode mode)
* fWrappedLength, fOuterLength - set appropriately * fWrappedLength, fOuterLength - set appropriately
* fpDataGFD - GFD for the raw data, possibly just a GFDGFD with an offset * fpDataGFD - GFD for the raw data, possibly just a GFDGFD with an offset
* fLength - length of unadorned data in the file, or the length of * fLength - length of unadorned data in the file, or the length of
* data stored in fBuffer (test for fBuffer!=nil) * data stored in fBuffer (test for fBuffer!=NULL)
* fFileFormat - set to the overall file format, mostly interesting * fFileFormat - set to the overall file format, mostly interesting
* for identification of the file "wrapper" * for identification of the file "wrapper"
* fPhysicalFormat - set to the type of data this holds * fPhysicalFormat - set to the type of data this holds
@ -773,10 +773,10 @@ DiskImg::AnalyzeImageFile(const char* pathName, char fssep)
FileFormat probableFormat; FileFormat probableFormat;
bool reliableExt; bool reliableExt;
const char* ext = FindExtension(pathName, fssep); const char* ext = FindExtension(pathName, fssep);
char* extBuf = nil; // uses malloc/free char* extBuf = NULL; // uses malloc/free
bool needExtFromOuter = false; bool needExtFromOuter = false;
if (ext != nil) { if (ext != NULL) {
assert(*ext == '.'); assert(*ext == '.');
ext++; ext++;
} else } else
@ -820,7 +820,7 @@ DiskImg::AnalyzeImageFile(const char* pathName, char fssep)
WMSG0(" DI found gz outer wrapper\n"); WMSG0(" DI found gz outer wrapper\n");
fpOuterWrapper = new OuterGzip(); fpOuterWrapper = new OuterGzip();
if (fpOuterWrapper == nil) { if (fpOuterWrapper == NULL) {
dierr = kDIErrMalloc; dierr = kDIErrMalloc;
goto bail; goto bail;
} }
@ -829,20 +829,20 @@ DiskImg::AnalyzeImageFile(const char* pathName, char fssep)
/* drop the ".gz" and get down to the next extension */ /* drop the ".gz" and get down to the next extension */
ext = ""; ext = "";
extBuf = strdup(pathName); extBuf = strdup(pathName);
if (extBuf != nil) { if (extBuf != NULL) {
char* localExt; char* localExt;
localExt = (char*) FindExtension(extBuf, fssep); localExt = (char*) FindExtension(extBuf, fssep);
if (localExt != nil) if (localExt != NULL)
*localExt = '\0'; *localExt = '\0';
localExt = (char*) FindExtension(extBuf, fssep); localExt = (char*) FindExtension(extBuf, fssep);
if (localExt != nil) { if (localExt != NULL) {
ext = localExt; ext = localExt;
assert(*ext == '.'); assert(*ext == '.');
ext++; ext++;
} }
} }
WMSG1(" DI after gz, ext='%s'\n", ext == nil ? "(nil)" : ext); WMSG1(" DI after gz, ext='%s'\n", ext == NULL ? "(NULL)" : ext);
} else if (strcasecmp(ext, "zip") == 0) { } else if (strcasecmp(ext, "zip") == 0) {
dierr = OuterZip::Test(fpWrapperGFD, fOuterLength); dierr = OuterZip::Test(fpWrapperGFD, fOuterLength);
@ -852,7 +852,7 @@ DiskImg::AnalyzeImageFile(const char* pathName, char fssep)
WMSG0(" DI found ZIP outer wrapper\n"); WMSG0(" DI found ZIP outer wrapper\n");
fpOuterWrapper = new OuterZip(); fpOuterWrapper = new OuterZip();
if (fpOuterWrapper == nil) { if (fpOuterWrapper == NULL) {
dierr = kDIErrMalloc; dierr = kDIErrMalloc;
goto bail; goto bail;
} }
@ -866,7 +866,7 @@ DiskImg::AnalyzeImageFile(const char* pathName, char fssep)
/* finish up outer wrapper stuff */ /* finish up outer wrapper stuff */
if (fOuterFormat != kOuterFormatNone) { if (fOuterFormat != kOuterFormatNone) {
GenericFD* pNewGFD = nil; GenericFD* pNewGFD = NULL;
dierr = fpOuterWrapper->Load(fpWrapperGFD, fOuterLength, fReadOnly, dierr = fpOuterWrapper->Load(fpWrapperGFD, fOuterLength, fReadOnly,
&fWrappedLength, &pNewGFD); &fWrappedLength, &pNewGFD);
if (dierr != kDIErrNone) { if (dierr != kDIErrNone) {
@ -887,7 +887,7 @@ DiskImg::AnalyzeImageFile(const char* pathName, char fssep)
if (needExtFromOuter) { if (needExtFromOuter) {
ext = fpOuterWrapper->GetExtension(); ext = fpOuterWrapper->GetExtension();
if (ext == nil) if (ext == NULL)
ext = ""; ext = "";
} }
} }
@ -1098,8 +1098,8 @@ gotit: ;
dierr = kDIErrUnrecognizedFileFmt; dierr = kDIErrUnrecognizedFileFmt;
break; break;
} }
if (fpImageWrapper != nil) { if (fpImageWrapper != NULL) {
assert(fpDataGFD == nil); assert(fpDataGFD == NULL);
dierr = fpImageWrapper->Prep(fpWrapperGFD, fWrappedLength, fReadOnly, dierr = fpImageWrapper->Prep(fpWrapperGFD, fWrappedLength, fReadOnly,
&fLength, &fPhysical, &fOrder, &fDOSVolumeNum, &fLength, &fPhysical, &fOrder, &fDOSVolumeNum,
&fpBadBlockMap, &fpDataGFD); &fpBadBlockMap, &fpDataGFD);
@ -1123,7 +1123,7 @@ gotit: ;
fFileFormat = probableFormat; fFileFormat = probableFormat;
assert(fLength >= 0); assert(fLength >= 0);
assert(fpDataGFD != nil); assert(fpDataGFD != NULL);
assert(fOuterFormat != kOuterFormatUnknown); assert(fOuterFormat != kOuterFormatUnknown);
assert(fFileFormat != kFileFormatUnknown); assert(fFileFormat != kFileFormatUnknown);
assert(fPhysical != kPhysicalFormatUnknown); assert(fPhysical != kPhysicalFormatUnknown);
@ -1157,7 +1157,7 @@ DIError
DiskImg::AnalyzeImage(void) DiskImg::AnalyzeImage(void)
{ {
assert(fLength >= 0); assert(fLength >= 0);
assert(fpDataGFD != nil); assert(fpDataGFD != NULL);
assert(fFileFormat != kFileFormatUnknown); assert(fFileFormat != kFileFormatUnknown);
assert(fPhysical != kPhysicalFormatUnknown); assert(fPhysical != kPhysicalFormatUnknown);
assert(fFormat == kFormatUnknown); assert(fFormat == kFormatUnknown);
@ -1165,7 +1165,7 @@ DiskImg::AnalyzeImage(void)
assert(fNumTracks == -1); assert(fNumTracks == -1);
assert(fNumSectPerTrack == -1); assert(fNumSectPerTrack == -1);
assert(fNumBlocks == -1); assert(fNumBlocks == -1);
if (fpDataGFD == nil) if (fpDataGFD == NULL)
return kDIErrInternal; return kDIErrInternal;
/* /*
@ -1235,7 +1235,7 @@ DiskImg::AnalyzeImage(void)
DIError dierr; DIError dierr;
dierr = AnalyzeNibbleData(); // sets nibbleDescr and DOS vol num dierr = AnalyzeNibbleData(); // sets nibbleDescr and DOS vol num
if (dierr == kDIErrNone) { if (dierr == kDIErrNone) {
assert(fpNibbleDescr != nil); assert(fpNibbleDescr != NULL);
fNumSectPerTrack = fpNibbleDescr->numSectors; fNumSectPerTrack = fpNibbleDescr->numSectors;
fOrder = kSectorOrderPhysical; fOrder = kSectorOrderPhysical;
@ -1246,7 +1246,7 @@ DiskImg::AnalyzeImage(void)
fReadOnly = true; fReadOnly = true;
} }
} else { } else {
//assert(fpNibbleDescr == nil); //assert(fpNibbleDescr == NULL);
fNumSectPerTrack = -1; fNumSectPerTrack = -1;
fOrder = kSectorOrderPhysical; fOrder = kSectorOrderPhysical;
fHasSectors = false; fHasSectors = false;
@ -1674,7 +1674,7 @@ DIError
DiskImg::FormatImage(FSFormat format, const char* volName) DiskImg::FormatImage(FSFormat format, const char* volName)
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
DiskFS* pDiskFS = nil; DiskFS* pDiskFS = NULL;
FSFormat savedFormat; FSFormat savedFormat;
WMSG1(" DI FormatImage '%s'\n", volName); WMSG1(" DI FormatImage '%s'\n", volName);
@ -1690,7 +1690,7 @@ DiskImg::FormatImage(FSFormat format, const char* volName)
pDiskFS = OpenAppropriateDiskFS(false); pDiskFS = OpenAppropriateDiskFS(false);
fFormat = savedFormat; fFormat = savedFormat;
if (pDiskFS == nil) { if (pDiskFS == NULL) {
dierr = kDIErrUnsupportedFSFmt; dierr = kDIErrUnsupportedFSFmt;
goto bail; goto bail;
} }
@ -1744,7 +1744,7 @@ DiskImg::ZeroImage(void)
void void
DiskImg::SetScanProgressCallback(ScanProgressCallback func, void* cookie) DiskImg::SetScanProgressCallback(ScanProgressCallback func, void* cookie)
{ {
if (fpParentImg != nil) { if (fpParentImg != NULL) {
/* unexpected, but perfectly okay */ /* unexpected, but perfectly okay */
DebugBreak(); DebugBreak();
} }
@ -1753,7 +1753,7 @@ DiskImg::SetScanProgressCallback(ScanProgressCallback func, void* cookie)
fScanProgressCookie = cookie; fScanProgressCookie = cookie;
fScanCount = 0; fScanCount = 0;
fScanMsg[0] = '\0'; fScanMsg[0] = '\0';
fScanLastMsgWhen = time(nil); fScanLastMsgWhen = time(NULL);
} }
/* /*
@ -1768,14 +1768,14 @@ DiskImg::UpdateScanProgress(const char* newStr)
bool result = true; bool result = true;
/* search up the tree to find a progress updater */ /* search up the tree to find a progress updater */
while (func == nil) { while (func == NULL) {
pImg = pImg->fpParentImg; pImg = pImg->fpParentImg;
if (pImg == nil) if (pImg == NULL)
return result; // none defined, bail out return result; // none defined, bail out
func = pImg->fpScanProgressCallback; func = pImg->fpScanProgressCallback;
} }
time_t now = time(nil); time_t now = time(NULL);
if (newStr == NULL) { if (newStr == NULL) {
fScanCount++; fScanCount++;
@ -1987,7 +1987,7 @@ DiskImg::ReadTrackSectorSwapped(long track, int sector, void* buf,
di_off_t offset; di_off_t offset;
int newSector = -1; int newSector = -1;
if (buf == nil) if (buf == NULL)
return kDIErrInvalidArg; return kDIErrInvalidArg;
#if 0 // Pre-d13 #if 0 // Pre-d13
@ -2040,7 +2040,7 @@ DiskImg::WriteTrackSector(long track, int sector, const void* buf)
di_off_t offset; di_off_t offset;
int newSector = -1; int newSector = -1;
if (buf == nil) if (buf == NULL)
return kDIErrInvalidArg; return kDIErrInvalidArg;
if (fReadOnly) if (fReadOnly)
return kDIErrAccessDenied; return kDIErrAccessDenied;
@ -2093,7 +2093,7 @@ DiskImg::ReadBlockSwapped(long block, void* buf, SectorOrder imageOrder,
return kDIErrUnsupportedAccess; return kDIErrUnsupportedAccess;
if (block < 0 || block >= fNumBlocks) if (block < 0 || block >= fNumBlocks)
return kDIErrInvalidBlock; return kDIErrInvalidBlock;
if (buf == nil) if (buf == NULL)
return kDIErrInvalidArg; return kDIErrInvalidArg;
DIError dierr; DIError dierr;
@ -2146,7 +2146,7 @@ DiskImg::ReadBlocks(long startBlock, int numBlocks, void* buf)
assert(fHasBlocks); assert(fHasBlocks);
assert(startBlock >= 0); assert(startBlock >= 0);
assert(numBlocks > 0); assert(numBlocks > 0);
assert(buf != nil); assert(buf != NULL);
if (startBlock < 0 || numBlocks + startBlock > GetNumBlocks()) { if (startBlock < 0 || numBlocks + startBlock > GetNumBlocks()) {
assert(false); assert(false);
@ -2201,7 +2201,7 @@ DiskImg::CheckForBadBlocks(long startBlock, int numBlocks)
{ {
int i; int i;
if (fpBadBlockMap == nil) if (fpBadBlockMap == NULL)
return false; return false;
for (i = startBlock; i < startBlock+numBlocks; i++) { for (i = startBlock; i < startBlock+numBlocks; i++) {
@ -2224,7 +2224,7 @@ DiskImg::WriteBlock(long block, const void* buf)
return kDIErrUnsupportedAccess; return kDIErrUnsupportedAccess;
if (block < 0 || block >= fNumBlocks) if (block < 0 || block >= fNumBlocks)
return kDIErrInvalidBlock; return kDIErrInvalidBlock;
if (buf == nil) if (buf == NULL)
return kDIErrInvalidArg; return kDIErrInvalidArg;
if (fReadOnly) if (fReadOnly)
return kDIErrAccessDenied; return kDIErrAccessDenied;
@ -2265,7 +2265,7 @@ DiskImg::WriteBlocks(long startBlock, int numBlocks, const void* buf)
assert(fHasBlocks); assert(fHasBlocks);
assert(startBlock >= 0); assert(startBlock >= 0);
assert(numBlocks > 0); assert(numBlocks > 0);
assert(buf != nil); assert(buf != NULL);
if (startBlock < 0 || numBlocks + startBlock > GetNumBlocks()) { if (startBlock < 0 || numBlocks + startBlock > GetNumBlocks()) {
assert(false); assert(false);
@ -2344,7 +2344,7 @@ DiskImg::CopyBytesIn(const void* buf, di_off_t offset, int size)
DebugBreak(); DebugBreak();
return kDIErrAccessDenied; return kDIErrAccessDenied;
} }
assert(fpDataGFD != nil); // somebody closed the image? assert(fpDataGFD != NULL); // somebody closed the image?
dierr = fpDataGFD->Seek(offset, kSeekSet); dierr = fpDataGFD->Seek(offset, kSeekSet);
if (dierr != kDIErrNone) { if (dierr != kDIErrNone) {
@ -2361,7 +2361,7 @@ DiskImg::CopyBytesIn(const void* buf, di_off_t offset, int size)
/* set the dirty flag here and everywhere above */ /* set the dirty flag here and everywhere above */
DiskImg* pImg = this; DiskImg* pImg = this;
while (pImg != nil) { while (pImg != NULL) {
pImg->fDirty = true; pImg->fDirty = true;
pImg = pImg->fpParentImg; pImg = pImg->fpParentImg;
} }
@ -2379,7 +2379,7 @@ DiskImg::CopyBytesIn(const void* buf, di_off_t offset, int size)
/* /*
* Create a disk image with the specified parameters. * Create a disk image with the specified parameters.
* *
* "storageName" and "pNibbleDescr" may be nil. * "storageName" and "pNibbleDescr" may be NULL.
*/ */
DIError DIError
DiskImg::CreateImage(const char* pathName, const char* storageName, DiskImg::CreateImage(const char* pathName, const char* storageName,
@ -2387,7 +2387,7 @@ DiskImg::CreateImage(const char* pathName, const char* storageName,
const NibbleDescr* pNibbleDescr, SectorOrder order, const NibbleDescr* pNibbleDescr, SectorOrder order,
FSFormat format, long numBlocks, bool skipFormat) FSFormat format, long numBlocks, bool skipFormat)
{ {
assert(fpDataGFD == nil); // should not be open already! assert(fpDataGFD == NULL); // should not be open already!
if (numBlocks <= 0) { if (numBlocks <= 0) {
WMSG1("ERROR: bad numBlocks %ld\n", numBlocks); WMSG1("ERROR: bad numBlocks %ld\n", numBlocks);
@ -2413,7 +2413,7 @@ DiskImg::CreateImage(const char* pathName, const char* storageName,
const NibbleDescr* pNibbleDescr, SectorOrder order, const NibbleDescr* pNibbleDescr, SectorOrder order,
FSFormat format, long numTracks, long numSectPerTrack, bool skipFormat) FSFormat format, long numTracks, long numSectPerTrack, bool skipFormat)
{ {
assert(fpDataGFD == nil); // should not be open already! assert(fpDataGFD == NULL); // should not be open already!
if (numTracks <= 0 || numSectPerTrack == 0) { if (numTracks <= 0 || numSectPerTrack == 0) {
WMSG2("ERROR: bad tracks/sectors %ld/%ld\n", numTracks, numSectPerTrack); WMSG2("ERROR: bad tracks/sectors %ld/%ld\n", numTracks, numSectPerTrack);
@ -2441,7 +2441,7 @@ DiskImg::CreateImage(const char* pathName, const char* storageName,
WMSG0("Sector image w/o sectors, switching to nibble mode\n"); WMSG0("Sector image w/o sectors, switching to nibble mode\n");
fHasNibbles = true; fHasNibbles = true;
fHasSectors = false; fHasSectors = false;
fpNibbleDescr = nil; fpNibbleDescr = NULL;
} }
return CreateImageCommon(pathName, storageName, skipFormat); return CreateImageCommon(pathName, storageName, skipFormat);
@ -2529,7 +2529,7 @@ DiskImg::CreateImageCommon(const char* pathName, const char* storageName,
fpWrapperGFD = pGFDFile; fpWrapperGFD = pGFDFile;
else else
fpOuterGFD = pGFDFile; fpOuterGFD = pGFDFile;
pGFDFile = nil; pGFDFile = NULL;
/* /*
* Step 4: if we have an outer GFD and therefore don't currently have * Step 4: if we have an outer GFD and therefore don't currently have
@ -2551,19 +2551,19 @@ DiskImg::CreateImageCommon(const char* pathName, const char* storageName,
} }
assert(fLength > 0); assert(fLength > 0);
if (fpWrapperGFD == nil) { if (fpWrapperGFD == NULL) {
/* shift GFDs and create a new memory GFD, pre-sized */ /* shift GFDs and create a new memory GFD, pre-sized */
GFDBuffer* pGFDBuffer = new GFDBuffer; GFDBuffer* pGFDBuffer = new GFDBuffer;
/* use fLength as a starting point for buffer size; this may expand */ /* use fLength as a starting point for buffer size; this may expand */
dierr = pGFDBuffer->Open(nil, fLength, true, true, false); dierr = pGFDBuffer->Open(NULL, fLength, true, true, false);
if (dierr != kDIErrNone) { if (dierr != kDIErrNone) {
delete pGFDBuffer; delete pGFDBuffer;
goto bail; goto bail;
} }
fpWrapperGFD = pGFDBuffer; fpWrapperGFD = pGFDBuffer;
pGFDBuffer = nil; pGFDBuffer = NULL;
} }
/* create an fpOuterWrapper struct */ /* create an fpOuterWrapper struct */
@ -2572,14 +2572,14 @@ DiskImg::CreateImageCommon(const char* pathName, const char* storageName,
break; break;
case kOuterFormatGzip: case kOuterFormatGzip:
fpOuterWrapper = new OuterGzip; fpOuterWrapper = new OuterGzip;
if (fpOuterWrapper == nil) { if (fpOuterWrapper == NULL) {
dierr = kDIErrMalloc; dierr = kDIErrMalloc;
goto bail; goto bail;
} }
break; break;
case kOuterFormatZip: case kOuterFormatZip:
fpOuterWrapper = new OuterZip; fpOuterWrapper = new OuterZip;
if (fpOuterWrapper == nil) { if (fpOuterWrapper == NULL) {
dierr = kDIErrMalloc; dierr = kDIErrMalloc;
goto bail; goto bail;
} }
@ -2646,25 +2646,25 @@ DiskImg::CreateImageCommon(const char* pathName, const char* storageName,
} }
break; break;
default: default:
assert(fpImageWrapper == nil); assert(fpImageWrapper == NULL);
break; break;
} }
if (fpImageWrapper == nil) { if (fpImageWrapper == NULL) {
WMSG0(" DI couldn't figure out the file format\n"); WMSG0(" DI couldn't figure out the file format\n");
dierr = kDIErrUnrecognizedFileFmt; dierr = kDIErrUnrecognizedFileFmt;
goto bail; goto bail;
} }
/* create the wrapper, write the header, and create fpDataGFD */ /* create the wrapper, write the header, and create fpDataGFD */
assert(fpDataGFD == nil); assert(fpDataGFD == NULL);
dierr = fpImageWrapper->Create(fLength, fPhysical, fOrder, dierr = fpImageWrapper->Create(fLength, fPhysical, fOrder,
fDOSVolumeNum, fpWrapperGFD, &fWrappedLength, &fpDataGFD); fDOSVolumeNum, fpWrapperGFD, &fWrappedLength, &fpDataGFD);
if (dierr != kDIErrNone) { if (dierr != kDIErrNone) {
WMSG1("ImageWrapper Create failed, err=%d\n", dierr); WMSG1("ImageWrapper Create failed, err=%d\n", dierr);
goto bail; goto bail;
} }
assert(fpDataGFD != nil); assert(fpDataGFD != NULL);
/* /*
* Step 6: "format" fpDataGFD. * Step 6: "format" fpDataGFD.
@ -2695,9 +2695,9 @@ DiskImg::CreateImageCommon(const char* pathName, const char* storageName,
* Quick sanity check... * Quick sanity check...
*/ */
if (fOuterFormat != kOuterFormatNone) { if (fOuterFormat != kOuterFormatNone) {
assert(fpOuterGFD != nil); assert(fpOuterGFD != NULL);
assert(fpWrapperGFD != nil); assert(fpWrapperGFD != NULL);
assert(fpDataGFD != nil); assert(fpDataGFD != NULL);
} }
bail: bail:
@ -2778,12 +2778,12 @@ DiskImg::ValidateCreateFormat(void) const
return kDIErrInvalidCreateReq; return kDIErrInvalidCreateReq;
} }
if (fpNibbleDescr == nil && GetNumSectPerTrack() > 0) { if (fpNibbleDescr == NULL && GetNumSectPerTrack() > 0) {
WMSG0("CreateImage: must provide NibbleDescr for non-sector\n"); WMSG0("CreateImage: must provide NibbleDescr for non-sector\n");
return kDIErrInvalidCreateReq; return kDIErrInvalidCreateReq;
} }
if (fpNibbleDescr != nil && if (fpNibbleDescr != NULL &&
fpNibbleDescr->numSectors != GetNumSectPerTrack()) fpNibbleDescr->numSectors != GetNumSectPerTrack())
{ {
WMSG2("CreateImage: ?? nd->numSectors=%d, GetNumSectPerTrack=%d\n", WMSG2("CreateImage: ?? nd->numSectors=%d, GetNumSectPerTrack=%d\n",
@ -2791,7 +2791,7 @@ DiskImg::ValidateCreateFormat(void) const
return kDIErrInvalidCreateReq; return kDIErrInvalidCreateReq;
} }
if (fpNibbleDescr != nil && ( if (fpNibbleDescr != NULL && (
(fpNibbleDescr->numSectors == 13 && (fpNibbleDescr->numSectors == 13 &&
fpNibbleDescr->encoding != kNibbleEnc53) || fpNibbleDescr->encoding != kNibbleEnc53) ||
(fpNibbleDescr->numSectors == 16 && (fpNibbleDescr->numSectors == 16 &&
@ -2930,14 +2930,14 @@ DiskImg::FormatSectors(GenericFD* pGFD, bool quickFormat) const
(long) fLength - sizeof(sctBuf), dierr); (long) fLength - sizeof(sctBuf), dierr);
goto bail; goto bail;
} }
dierr = pGFD->Write(sctBuf, sizeof(sctBuf), nil); dierr = pGFD->Write(sctBuf, sizeof(sctBuf), NULL);
if (dierr != kDIErrNone) { if (dierr != kDIErrNone) {
WMSG1(" FormatSectors: GFD quick write failed (err=%d)\n", dierr); WMSG1(" FormatSectors: GFD quick write failed (err=%d)\n", dierr);
goto bail; goto bail;
} }
} else { } else {
for (length = fLength ; length > 0; length -= sizeof(sctBuf)) { for (length = fLength ; length > 0; length -= sizeof(sctBuf)) {
dierr = pGFD->Write(sctBuf, sizeof(sctBuf), nil); dierr = pGFD->Write(sctBuf, sizeof(sctBuf), NULL);
if (dierr != kDIErrNone) { if (dierr != kDIErrNone) {
WMSG1(" FormatSectors: GFD write failed (err=%d)\n", dierr); WMSG1(" FormatSectors: GFD write failed (err=%d)\n", dierr);
goto bail; goto bail;
@ -2966,13 +2966,13 @@ DiskImg::FormatBlocks(GenericFD* pGFD) const
assert(fLength > 0 && (fLength & 0x1ff) == 0); assert(fLength > 0 && (fLength & 0x1ff) == 0);
start = time(nil); start = time(NULL);
memset(blkBuf, 0, sizeof(blkBuf)); memset(blkBuf, 0, sizeof(blkBuf));
pGFD->Rewind(); pGFD->Rewind();
for (length = fLength ; length > 0; length -= sizeof(blkBuf)) { for (length = fLength ; length > 0; length -= sizeof(blkBuf)) {
dierr = pGFD->Write(blkBuf, sizeof(blkBuf), nil); dierr = pGFD->Write(blkBuf, sizeof(blkBuf), NULL);
if (dierr != kDIErrNone) { if (dierr != kDIErrNone) {
WMSG1(" FormatBlocks: GFD write failed (err=%d)\n", dierr); WMSG1(" FormatBlocks: GFD write failed (err=%d)\n", dierr);
return dierr; return dierr;
@ -2980,7 +2980,7 @@ DiskImg::FormatBlocks(GenericFD* pGFD) const
} }
assert(length == 0); assert(length == 0);
end = time(nil); end = time(NULL);
WMSG1("FormatBlocks complete, time=%ld\n", end - start); WMSG1("FormatBlocks complete, time=%ld\n", end - start);
return kDIErrNone; return kDIErrNone;
@ -3049,9 +3049,9 @@ DiskImg::AddNote(NoteType type, const char* fmt, ...)
WMSG1("+++ adding note '%s'\n", buf); WMSG1("+++ adding note '%s'\n", buf);
if (fNotes == nil) { if (fNotes == NULL) {
fNotes = new char[len +1]; fNotes = new char[len +1];
if (fNotes == nil) { if (fNotes == NULL) {
WMSG1("Unable to create notes[%d]\n", len+1); WMSG1("Unable to create notes[%d]\n", len+1);
assert(false); assert(false);
return; return;
@ -3060,7 +3060,7 @@ DiskImg::AddNote(NoteType type, const char* fmt, ...)
} else { } else {
int existingLen = strlen(fNotes); int existingLen = strlen(fNotes);
char* newNotes = new char[existingLen + len +1]; char* newNotes = new char[existingLen + len +1];
if (newNotes == nil) { if (newNotes == NULL) {
WMSG1("Unable to create newNotes[%d]\n", existingLen+len+1); WMSG1("Unable to create newNotes[%d]\n", existingLen+len+1);
assert(false); assert(false);
return; return;
@ -3078,7 +3078,7 @@ DiskImg::AddNote(NoteType type, const char* fmt, ...)
const char* const char*
DiskImg::GetNotes(void) const DiskImg::GetNotes(void) const
{ {
if (fNotes == nil) if (fNotes == NULL)
return ""; return "";
else else
return fNotes; return fNotes;
@ -3106,7 +3106,7 @@ DiskImg::GetNibbleTrackOffset(long track) const
/* /*
* Return a new object with the appropriate DiskFS sub-class. * Return a new object with the appropriate DiskFS sub-class.
* *
* If the image hasn't been analyzed, or was analyzed to no avail, "nil" * If the image hasn't been analyzed, or was analyzed to no avail, "NULL"
* is returned unless "allowUnknown" is set to "true". In that case, a * is returned unless "allowUnknown" is set to "true". In that case, a
* DiskFSUnknown is returned. * DiskFSUnknown is returned.
* *
@ -3116,7 +3116,7 @@ DiskImg::GetNibbleTrackOffset(long track) const
DiskFS* DiskFS*
DiskImg::OpenAppropriateDiskFS(bool allowUnknown) DiskImg::OpenAppropriateDiskFS(bool allowUnknown)
{ {
DiskFS* pDiskFS = nil; DiskFS* pDiskFS = NULL;
/* /*
* Create an appropriate DiskFS object. * Create an appropriate DiskFS object.
@ -3335,7 +3335,7 @@ DiskImgLib::DIStrError(DIError dierr)
if (dierr > 0) { if (dierr > 0) {
const char* msg; const char* msg;
msg = strerror(dierr); msg = strerror(dierr);
if (msg != nil) if (msg != NULL)
return msg; return msg;
} }
@ -3347,7 +3347,7 @@ DiskImgLib::DIStrError(DIError dierr)
* to return this. * to return this.
* *
* An easier solution, should this present a problem for someone, would * An easier solution, should this present a problem for someone, would
* be to have the function return nil or "unknown error" when the * be to have the function return NULL or "unknown error" when the
* error value isn't recognized. I'd recommend leaving it as-is for * error value isn't recognized. I'd recommend leaving it as-is for
* debug builds, though, as it's helpful to know *which* error is not * debug builds, though, as it's helpful to know *which* error is not
* recognized. * recognized.

View File

@ -556,7 +556,7 @@ public:
/* /*
* Set up a progress callback to use when scanning a disk volume. Pass * Set up a progress callback to use when scanning a disk volume. Pass
* nil for "func" to disable. * NULL for "func" to disable.
* *
* The callback function is expected to return "true" if all is well. * The callback function is expected to return "true" if all is well.
* If it returns false, kDIErrCancelled will eventually come back. * If it returns false, kDIErrCancelled will eventually come back.
@ -1152,7 +1152,7 @@ public:
* Pass in a full path to normalize, and a buffer to copy the output * Pass in a full path to normalize, and a buffer to copy the output
* into. On entry "pNormalizedBufLen" holds the length of the buffer. * into. On entry "pNormalizedBufLen" holds the length of the buffer.
* On exit, it holds the size of the buffer required to hold the * On exit, it holds the size of the buffer required to hold the
* normalized string. If the buffer is nil or isn't big enough, no part * normalized string. If the buffer is NULL or isn't big enough, no part
* of the normalized path will be copied into the buffer, and a specific * of the normalized path will be copied into the buffer, and a specific
* error (kDIErrDataOverrun) will be returned. * error (kDIErrDataOverrun) will be returned.
*/ */
@ -1232,7 +1232,7 @@ public:
// Return the "bare" volume name. For formats where the volume name // Return the "bare" volume name. For formats where the volume name
// is actually a number (e.g. DOS 3.3), this returns just the number. // is actually a number (e.g. DOS 3.3), this returns just the number.
// For formats without a volume name or number (e.g. CP/M), this returns // For formats without a volume name or number (e.g. CP/M), this returns
// nil, indicating that any attempt to change the volume name will fail. // NULL, indicating that any attempt to change the volume name will fail.
virtual const char* GetBareVolumeName(void) const = 0; virtual const char* GetBareVolumeName(void) const = 0;
// Returns "false" if we only support read-only access to this FS type // Returns "false" if we only support read-only access to this FS type

View File

@ -59,8 +59,6 @@ namespace DiskImgLib {
*/ */
#define NELEM(x) ((int) (sizeof(x) / sizeof(x[0]))) #define NELEM(x) ((int) (sizeof(x) / sizeof(x[0])))
#define nil NULL
#define ErrnoOrGeneric() (errno != 0 ? (DIError) errno : kDIErrGeneric) #define ErrnoOrGeneric() (errno != 0 ? (DIError) errno : kDIErrGeneric)
@ -108,10 +106,10 @@ class CircularBufferAccess {
public: public:
CircularBufferAccess(unsigned char* buf, long len) : CircularBufferAccess(unsigned char* buf, long len) :
fBuf(buf), fLen(len) fBuf(buf), fLen(len)
{ assert(fLen > 0); assert(fBuf != nil); } { assert(fLen > 0); assert(fBuf != NULL); }
CircularBufferAccess(const unsigned char* buf, long len) : CircularBufferAccess(const unsigned char* buf, long len) :
fBuf(const_cast<unsigned char*>(buf)), fLen(len) fBuf(const_cast<unsigned char*>(buf)), fLen(len)
{ assert(fLen > 0); assert(fBuf != nil); } { assert(fLen > 0); assert(fBuf != NULL); }
~CircularBufferAccess(void) {} ~CircularBufferAccess(void) {}
/* /*
@ -254,7 +252,7 @@ public:
fBitPosn = 7; fBitPosn = 7;
fBuf = fBufStart; fBuf = fBufStart;
//fByte = *fBuf++; //fByte = *fBuf++;
if (pWrap != nil) if (pWrap != NULL)
*pWrap = true; *pWrap = true;
} }

View File

@ -375,9 +375,9 @@ DIError
A2FileFAT::Open(A2FileDescr** ppOpenFile, bool readOnly, A2FileFAT::Open(A2FileDescr** ppOpenFile, bool readOnly,
bool rsrcFork /*=false*/) bool rsrcFork /*=false*/)
{ {
A2FDFAT* pOpenFile = nil; A2FDFAT* pOpenFile = NULL;
if (fpOpenFile != nil) if (fpOpenFile != NULL)
return kDIErrAlreadyOpen; return kDIErrAlreadyOpen;
if (rsrcFork) if (rsrcFork)
return kDIErrForkNotFound; return kDIErrForkNotFound;
@ -411,11 +411,11 @@ A2FDFAT::Read(void* buf, size_t len, size_t* pActual)
/* don't allow them to read past the end of the file */ /* don't allow them to read past the end of the file */
if (fOffset + (long)len > pFile->fLength) { if (fOffset + (long)len > pFile->fLength) {
if (pActual == nil) if (pActual == NULL)
return kDIErrDataUnderrun; return kDIErrDataUnderrun;
len = (size_t) (pFile->fLength - fOffset); len = (size_t) (pFile->fLength - fOffset);
} }
if (pActual != nil) if (pActual != NULL)
*pActual = len; *pActual = len;
memcpy(buf, pFile->GetFakeFileBuf(), len); memcpy(buf, pFile->GetFakeFileBuf(), len);

View File

@ -63,7 +63,7 @@ WrapperFDI::UnpackDisk525(GenericFD* pGFD, GenericFD* pNewGFD, int numCyls,
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
unsigned char nibbleBuf[kNibbleBufLen]; unsigned char nibbleBuf[kNibbleBufLen];
unsigned char* inputBuf = nil; unsigned char* inputBuf = NULL;
bool goodTracks[kMaxNibbleTracks525]; bool goodTracks[kMaxNibbleTracks525];
int inputBufLen = -1; int inputBufLen = -1;
int badTracks = 0; int badTracks = 0;
@ -92,7 +92,7 @@ WrapperFDI::UnpackDisk525(GenericFD* pGFD, GenericFD* pNewGFD, int numCyls,
delete[] inputBuf; delete[] inputBuf;
inputBufLen = length256 * 256; inputBufLen = length256 * 256;
inputBuf = new unsigned char[inputBufLen]; inputBuf = new unsigned char[inputBufLen];
if (inputBuf == nil) { if (inputBuf == NULL) {
dierr = kDIErrMalloc; dierr = kDIErrMalloc;
goto bail; goto bail;
} }
@ -229,7 +229,7 @@ WrapperFDI::UnpackDisk35(GenericFD* pGFD, GenericFD* pNewGFD, int numCyls,
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
unsigned char nibbleBuf[kNibbleBufLen]; unsigned char nibbleBuf[kNibbleBufLen];
unsigned char* inputBuf = nil; unsigned char* inputBuf = NULL;
unsigned char outputBuf[kMaxSectors35 * kBlockSize]; // 6KB unsigned char outputBuf[kMaxSectors35 * kBlockSize]; // 6KB
int inputBufLen = -1; int inputBufLen = -1;
int badTracks = 0; int badTracks = 0;
@ -259,7 +259,7 @@ WrapperFDI::UnpackDisk35(GenericFD* pGFD, GenericFD* pNewGFD, int numCyls,
delete[] inputBuf; delete[] inputBuf;
inputBufLen = length256 * 256; inputBufLen = length256 * 256;
inputBuf = new unsigned char[inputBufLen]; inputBuf = new unsigned char[inputBufLen];
if (inputBuf == nil) { if (inputBuf == NULL) {
dierr = kDIErrMalloc; dierr = kDIErrMalloc;
goto bail; goto bail;
} }
@ -503,7 +503,7 @@ WrapperFDI::DecodePulseTrack(const unsigned char* inputBuf, long inputLen,
* Uncompress or endian-swap the pulse streams. * Uncompress or endian-swap the pulse streams.
*/ */
hdr.avgStream = new unsigned long[hdr.numPulses]; hdr.avgStream = new unsigned long[hdr.numPulses];
if (hdr.avgStream == nil) if (hdr.avgStream == NULL)
goto bail; goto bail;
if (!UncompressPulseStream(inputBuf, hdr.avgStreamLen, hdr.avgStream, if (!UncompressPulseStream(inputBuf, hdr.avgStreamLen, hdr.avgStream,
hdr.numPulses, hdr.avgStreamCompression, 4)) hdr.numPulses, hdr.avgStreamCompression, 4))
@ -514,7 +514,7 @@ WrapperFDI::DecodePulseTrack(const unsigned char* inputBuf, long inputLen,
if (hdr.minStreamLen > 0) { if (hdr.minStreamLen > 0) {
hdr.minStream = new unsigned long[hdr.numPulses]; hdr.minStream = new unsigned long[hdr.numPulses];
if (hdr.minStream == nil) if (hdr.minStream == NULL)
goto bail; goto bail;
if (!UncompressPulseStream(inputBuf, hdr.minStreamLen, hdr.minStream, if (!UncompressPulseStream(inputBuf, hdr.minStreamLen, hdr.minStream,
hdr.numPulses, hdr.minStreamCompression, 4)) hdr.numPulses, hdr.minStreamCompression, 4))
@ -550,13 +550,13 @@ WrapperFDI::DecodePulseTrack(const unsigned char* inputBuf, long inputLen,
bail: bail:
/* clean up */ /* clean up */
if (hdr.avgStream != nil) if (hdr.avgStream != NULL)
delete[] hdr.avgStream; delete[] hdr.avgStream;
if (hdr.minStream != nil) if (hdr.minStream != NULL)
delete[] hdr.minStream; delete[] hdr.minStream;
if (hdr.maxStream != nil) if (hdr.maxStream != NULL)
delete[] hdr.maxStream; delete[] hdr.maxStream;
if (hdr.idxStream != nil) if (hdr.idxStream != NULL)
delete[] hdr.idxStream; delete[] hdr.idxStream;
return result; return result;
} }
@ -661,8 +661,8 @@ WrapperFDI::ExpandHuffman(const unsigned char* inputBuf, long inputLen,
// subStreamShift, signExtend, sixteenBits); // subStreamShift, signExtend, sixteenBits);
/* decode the Huffman tree structure */ /* decode the Huffman tree structure */
root.left = nil; root.left = NULL;
root.right = nil; root.right = NULL;
bitMask = 0; bitMask = 0;
inputBuf = HuffExtractTree(inputBuf, &root, &bits, &bitMask); inputBuf = HuffExtractTree(inputBuf, &root, &bits, &bitMask);
@ -689,7 +689,7 @@ WrapperFDI::ExpandHuffman(const unsigned char* inputBuf, long inputLen,
/* chase down the tree until we hit a leaf */ /* chase down the tree until we hit a leaf */
/* (note: nodes have two kids or none) */ /* (note: nodes have two kids or none) */
while (true) { while (true) {
if (pCurrent->left == nil) { if (pCurrent->left == NULL) {
break; break;
} else { } else {
bitMask >>= 1; bitMask >>= 1;
@ -748,8 +748,8 @@ WrapperFDI::HuffExtractTree(const unsigned char* inputBuf, HuffNode* pNode,
//WMSG1(" val=%d\n", val); //WMSG1(" val=%d\n", val);
if (val != 0) { if (val != 0) {
assert(pNode->left == nil); assert(pNode->left == NULL);
assert(pNode->right == nil); assert(pNode->right == NULL);
return inputBuf; return inputBuf;
} else { } else {
pNode->left = new HuffNode; pNode->left = new HuffNode;
@ -767,7 +767,7 @@ WrapperFDI::HuffExtractTree(const unsigned char* inputBuf, HuffNode* pNode,
const unsigned char* const unsigned char*
WrapperFDI::HuffExtractValues16(const unsigned char* inputBuf, HuffNode* pNode) WrapperFDI::HuffExtractValues16(const unsigned char* inputBuf, HuffNode* pNode)
{ {
if (pNode->left == nil) { if (pNode->left == NULL) {
pNode->val = (*inputBuf++) << 8; pNode->val = (*inputBuf++) << 8;
pNode->val |= *inputBuf++; pNode->val |= *inputBuf++;
return inputBuf; return inputBuf;
@ -783,7 +783,7 @@ WrapperFDI::HuffExtractValues16(const unsigned char* inputBuf, HuffNode* pNode)
const unsigned char* const unsigned char*
WrapperFDI::HuffExtractValues8(const unsigned char* inputBuf, HuffNode* pNode) WrapperFDI::HuffExtractValues8(const unsigned char* inputBuf, HuffNode* pNode)
{ {
if (pNode->left == nil) { if (pNode->left == NULL) {
pNode->val = *inputBuf++; pNode->val = *inputBuf++;
return inputBuf; return inputBuf;
} else { } else {
@ -798,7 +798,7 @@ WrapperFDI::HuffExtractValues8(const unsigned char* inputBuf, HuffNode* pNode)
void void
WrapperFDI::HuffFreeNodes(HuffNode* pNode) WrapperFDI::HuffFreeNodes(HuffNode* pNode)
{ {
if (pNode != nil) { if (pNode != NULL) {
HuffFreeNodes(pNode->left); HuffFreeNodes(pNode->left);
HuffFreeNodes(pNode->right); HuffFreeNodes(pNode->right);
delete pNode; delete pNode;
@ -847,7 +847,7 @@ bool
WrapperFDI::ConvertPulseStreamsToNibbles(PulseIndexHeader* pHdr, int bitRate, WrapperFDI::ConvertPulseStreamsToNibbles(PulseIndexHeader* pHdr, int bitRate,
unsigned char* nibbleBuf, long* pNibbleLen) unsigned char* nibbleBuf, long* pNibbleLen)
{ {
unsigned long* fakeIdxStream = nil; unsigned long* fakeIdxStream = NULL;
bool result = false; bool result = false;
int i; int i;
@ -860,7 +860,7 @@ WrapperFDI::ConvertPulseStreamsToNibbles(PulseIndexHeader* pHdr, int bitRate,
unsigned long* idxStream; unsigned long* idxStream;
avgStream = pHdr->avgStream; avgStream = pHdr->avgStream;
if (pHdr->minStream != nil && pHdr->maxStream != nil) { if (pHdr->minStream != NULL && pHdr->maxStream != NULL) {
minStream = pHdr->minStream; minStream = pHdr->minStream;
maxStream = pHdr->maxStream; maxStream = pHdr->maxStream;
@ -874,7 +874,7 @@ WrapperFDI::ConvertPulseStreamsToNibbles(PulseIndexHeader* pHdr, int bitRate,
maxStream = pHdr->avgStream; maxStream = pHdr->avgStream;
} }
if (pHdr->idxStream != nil) if (pHdr->idxStream != NULL)
idxStream = pHdr->idxStream; idxStream = pHdr->idxStream;
else { else {
/* /*
@ -886,7 +886,7 @@ WrapperFDI::ConvertPulseStreamsToNibbles(PulseIndexHeader* pHdr, int bitRate,
WMSG0(" FDI: HEY: using fake index stream\n"); WMSG0(" FDI: HEY: using fake index stream\n");
DebugBreak(); DebugBreak();
fakeIdxStream = new unsigned long[pHdr->numPulses]; fakeIdxStream = new unsigned long[pHdr->numPulses];
if (fakeIdxStream == nil) { if (fakeIdxStream == NULL) {
WMSG0(" FDI: unable to alloc fake idx stream\n"); WMSG0(" FDI: unable to alloc fake idx stream\n");
goto bail; goto bail;
} }

View File

@ -142,8 +142,8 @@ DiskFSFocusDrive::OpenSubVolume(long startBlock, long numBlocks,
const char* name) const char* name)
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
DiskFS* pNewFS = nil; DiskFS* pNewFS = NULL;
DiskImg* pNewImg = nil; DiskImg* pNewImg = NULL;
//bool tweaked = false; //bool tweaked = false;
WMSG2("Adding %ld +%ld\n", startBlock, numBlocks); WMSG2("Adding %ld +%ld\n", startBlock, numBlocks);
@ -164,7 +164,7 @@ DiskFSFocusDrive::OpenSubVolume(long startBlock, long numBlocks,
} }
pNewImg = new DiskImg; pNewImg = new DiskImg;
if (pNewImg == nil) { if (pNewImg == NULL) {
dierr = kDIErrMalloc; dierr = kDIErrMalloc;
goto bail; goto bail;
} }
@ -193,7 +193,7 @@ DiskFSFocusDrive::OpenSubVolume(long startBlock, long numBlocks,
WMSG2(" FocusDriveSub (%ld,%ld): unable to identify filesystem\n", WMSG2(" FocusDriveSub (%ld,%ld): unable to identify filesystem\n",
startBlock, numBlocks); startBlock, numBlocks);
DiskFSUnknown* pUnknownFS = new DiskFSUnknown; DiskFSUnknown* pUnknownFS = new DiskFSUnknown;
if (pUnknownFS == nil) { if (pUnknownFS == NULL) {
dierr = kDIErrInternal; dierr = kDIErrInternal;
goto bail; goto bail;
} }
@ -203,7 +203,7 @@ DiskFSFocusDrive::OpenSubVolume(long startBlock, long numBlocks,
/* open a DiskFS for the sub-image */ /* open a DiskFS for the sub-image */
WMSG2(" FocusDriveSub (%ld,%ld) analyze succeeded!\n", startBlock, numBlocks); WMSG2(" FocusDriveSub (%ld,%ld) analyze succeeded!\n", startBlock, numBlocks);
pNewFS = pNewImg->OpenAppropriateDiskFS(true); pNewFS = pNewImg->OpenAppropriateDiskFS(true);
if (pNewFS == nil) { if (pNewFS == NULL) {
WMSG0(" FocusDriveSub: OpenAppropriateDiskFS failed\n"); WMSG0(" FocusDriveSub: OpenAppropriateDiskFS failed\n");
dierr = kDIErrUnsupportedFSFmt; dierr = kDIErrUnsupportedFSFmt;
goto bail; goto bail;
@ -236,8 +236,8 @@ DiskFSFocusDrive::OpenSubVolume(long startBlock, long numBlocks,
/* add it to the list */ /* add it to the list */
AddSubVolumeToList(pNewImg, pNewFS); AddSubVolumeToList(pNewImg, pNewFS);
pNewImg = nil; pNewImg = NULL;
pNewFS = nil; pNewFS = NULL;
bail: bail:
delete pNewFS; delete pNewFS;
@ -342,8 +342,8 @@ DiskFSFocusDrive::OpenVol(int idx, long startBlock, long numBlocks,
if (dierr != kDIErrNone) { if (dierr != kDIErrNone) {
if (dierr == kDIErrCancelled) if (dierr == kDIErrCancelled)
goto bail; goto bail;
DiskFS* pNewFS = nil; DiskFS* pNewFS = NULL;
DiskImg* pNewImg = nil; DiskImg* pNewImg = NULL;
WMSG1(" FocusDrive failed opening sub-volume %d\n", idx); WMSG1(" FocusDrive failed opening sub-volume %d\n", idx);
dierr = CreatePlaceholder(startBlock, numBlocks, name, NULL, dierr = CreatePlaceholder(startBlock, numBlocks, name, NULL,

View File

@ -19,7 +19,7 @@
* Copy "length" bytes from "pSrc" to "pDst". Both GenericFDs should be * Copy "length" bytes from "pSrc" to "pDst". Both GenericFDs should be
* seeked to their initial positions. * seeked to their initial positions.
* *
* If "pCRC" is non-nil, this computes a CRC32 as it goes, using the zlib * If "pCRC" is non-NULL, this computes a CRC32 as it goes, using the zlib
* library function. * library function.
*/ */
/*static*/ DIError /*static*/ DIError
@ -28,21 +28,21 @@ GenericFD::CopyFile(GenericFD* pDst, GenericFD* pSrc, di_off_t length,
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
const int kCopyBufSize = 32768; const int kCopyBufSize = 32768;
unsigned char* copyBuf = nil; unsigned char* copyBuf = NULL;
int copySize; int copySize;
WMSG1("+++ CopyFile: %ld bytes\n", (long) length); WMSG1("+++ CopyFile: %ld bytes\n", (long) length);
if (pDst == nil || pSrc == nil || length < 0) if (pDst == NULL || pSrc == NULL || length < 0)
return kDIErrInvalidArg; return kDIErrInvalidArg;
if (length == 0) if (length == 0)
return kDIErrNone; return kDIErrNone;
copyBuf = new unsigned char[kCopyBufSize]; copyBuf = new unsigned char[kCopyBufSize];
if (copyBuf == nil) if (copyBuf == NULL)
return kDIErrMalloc; return kDIErrMalloc;
if (pCRC != nil) if (pCRC != NULL)
*pCRC = crc32(0L, Z_NULL, 0); *pCRC = crc32(0L, Z_NULL, 0);
while (length != 0) { while (length != 0) {
@ -54,7 +54,7 @@ GenericFD::CopyFile(GenericFD* pDst, GenericFD* pSrc, di_off_t length,
if (dierr != kDIErrNone) if (dierr != kDIErrNone)
goto bail; goto bail;
if (pCRC != nil) if (pCRC != NULL)
*pCRC = crc32(*pCRC, copyBuf, copySize); *pCRC = crc32(*pCRC, copyBuf, copySize);
dierr = pDst->Write(copyBuf, copySize); dierr = pDst->Write(copyBuf, copySize);
@ -94,9 +94,9 @@ GFDFile::Open(const char* filename, bool readOnly)
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
if (fFp != nil) if (fFp != NULL)
return kDIErrAlreadyOpen; return kDIErrAlreadyOpen;
if (filename == nil) if (filename == NULL)
return kDIErrInvalidArg; return kDIErrInvalidArg;
if (filename[0] == '\0') if (filename[0] == '\0')
return kDIErrInvalidArg; return kDIErrInvalidArg;
@ -106,7 +106,7 @@ GFDFile::Open(const char* filename, bool readOnly)
strcpy(fPathName, filename); strcpy(fPathName, filename);
fFp = fopen(filename, readOnly ? "rb" : "r+b"); fFp = fopen(filename, readOnly ? "rb" : "r+b");
if (fFp == nil) { if (fFp == NULL) {
if (errno == EACCES) if (errno == EACCES)
dierr = kDIErrAccessDenied; dierr = kDIErrAccessDenied;
else else
@ -125,7 +125,7 @@ GFDFile::Read(void* buf, size_t length, size_t* pActual)
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
size_t actual; size_t actual;
if (fFp == nil) if (fFp == NULL)
return kDIErrNotReady; return kDIErrNotReady;
actual = ::fread(buf, 1, length, fFp); actual = ::fread(buf, 1, length, fFp);
if (actual == 0) { if (actual == 0) {
@ -139,7 +139,7 @@ GFDFile::Read(void* buf, size_t length, size_t* pActual)
return kDIErrInternal; return kDIErrInternal;
} }
if (pActual == nil) { if (pActual == NULL) {
if (actual != length) { if (actual != length) {
dierr = ErrnoOrGeneric(); dierr = ErrnoOrGeneric();
WMSG3(" GDFile Read failed on %d bytes (actual=%d, err=%d)\n", WMSG3(" GDFile Read failed on %d bytes (actual=%d, err=%d)\n",
@ -157,11 +157,11 @@ GFDFile::Write(const void* buf, size_t length, size_t* pActual)
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
if (fFp == nil) if (fFp == NULL)
return kDIErrNotReady; return kDIErrNotReady;
if (fReadOnly) if (fReadOnly)
return kDIErrAccessDenied; return kDIErrAccessDenied;
assert(pActual == nil); // not handling this yet assert(pActual == NULL); // not handling this yet
if (::fwrite(buf, length, 1, fFp) != 1) { if (::fwrite(buf, length, 1, fFp) != 1) {
dierr = ErrnoOrGeneric(); dierr = ErrnoOrGeneric();
WMSG2(" GDFile Write failed on %d bytes (err=%d)\n", length, dierr); WMSG2(" GDFile Write failed on %d bytes (err=%d)\n", length, dierr);
@ -177,7 +177,7 @@ GFDFile::Seek(di_off_t offset, DIWhence whence)
//static const long kOneGB = 1024*1024*1024; //static const long kOneGB = 1024*1024*1024;
//static const long kAlmostTwoGB = kOneGB + (kOneGB -1); //static const long kAlmostTwoGB = kOneGB + (kOneGB -1);
if (fFp == nil) if (fFp == NULL)
return kDIErrNotReady; return kDIErrNotReady;
//assert(offset <= kAlmostTwoGB); //assert(offset <= kAlmostTwoGB);
//if (::fseek(fFp, (long) offset, whence) != 0) { //if (::fseek(fFp, (long) offset, whence) != 0) {
@ -195,7 +195,7 @@ GFDFile::Tell(void)
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
di_off_t result; di_off_t result;
if (fFp == nil) if (fFp == NULL)
return kDIErrNotReady; return kDIErrNotReady;
//result = ::ftell(fFp); //result = ::ftell(fFp);
result = ::ftello(fFp); result = ::ftello(fFp);
@ -230,12 +230,12 @@ GFDFile::Truncate(void)
DIError DIError
GFDFile::Close(void) GFDFile::Close(void)
{ {
if (fFp == nil) if (fFp == NULL)
return kDIErrNotReady; return kDIErrNotReady;
WMSG1(" GFDFile closing '%s'\n", fPathName); WMSG1(" GFDFile closing '%s'\n", fPathName);
fclose(fFp); fclose(fFp);
fFp = nil; fFp = NULL;
return kDIErrNone; return kDIErrNone;
} }
@ -248,7 +248,7 @@ GFDFile::Open(const char* filename, bool readOnly)
if (fFd >= 0) if (fFd >= 0)
return kDIErrAlreadyOpen; return kDIErrAlreadyOpen;
if (filename == nil) if (filename == NULL)
return kDIErrInvalidArg; return kDIErrInvalidArg;
if (filename[0] == '\0') if (filename[0] == '\0')
return kDIErrInvalidArg; return kDIErrInvalidArg;
@ -289,7 +289,7 @@ GFDFile::Read(void* buf, size_t length, size_t* pActual)
return dierr; return dierr;
} }
if (pActual == nil) { if (pActual == NULL) {
if (actual != (ssize_t) length) { if (actual != (ssize_t) length) {
WMSG2(" GDFile Read partial (wanted=%d actual=%d)\n", WMSG2(" GDFile Read partial (wanted=%d actual=%d)\n",
length, actual); length, actual);
@ -311,7 +311,7 @@ GFDFile::Write(const void* buf, size_t length, size_t* pActual)
return kDIErrNotReady; return kDIErrNotReady;
if (fReadOnly) if (fReadOnly)
return kDIErrAccessDenied; return kDIErrAccessDenied;
assert(pActual == nil); // not handling partial writes yet assert(pActual == NULL); // not handling partial writes yet
actual = ::write(fFd, buf, length); actual = ::write(fFd, buf, length);
if (actual != (ssize_t) length) { if (actual != (ssize_t) length) {
dierr = ErrnoOrGeneric(); dierr = ErrnoOrGeneric();
@ -414,7 +414,7 @@ DIError
GFDBuffer::Open(void* buffer, di_off_t length, bool doDelete, bool doExpand, GFDBuffer::Open(void* buffer, di_off_t length, bool doDelete, bool doExpand,
bool readOnly) bool readOnly)
{ {
if (fBuffer != nil) if (fBuffer != NULL)
return kDIErrAlreadyOpen; return kDIErrAlreadyOpen;
if (length <= 0) if (length <= 0)
return kDIErrInvalidArg; return kDIErrInvalidArg;
@ -425,10 +425,10 @@ GFDBuffer::Open(void* buffer, di_off_t length, bool doDelete, bool doExpand,
return kDIErrInvalidArg; return kDIErrInvalidArg;
} }
/* if buffer is nil, allocate it ourselves */ /* if buffer is NULL, allocate it ourselves */
if (buffer == nil) { if (buffer == NULL) {
fBuffer = (void*) new char[(int) length]; fBuffer = (void*) new char[(int) length];
if (fBuffer == nil) if (fBuffer == NULL)
return kDIErrMalloc; return kDIErrMalloc;
} else } else
fBuffer = buffer; fBuffer = buffer;
@ -447,13 +447,13 @@ GFDBuffer::Open(void* buffer, di_off_t length, bool doDelete, bool doExpand,
DIError DIError
GFDBuffer::Read(void* buf, size_t length, size_t* pActual) GFDBuffer::Read(void* buf, size_t length, size_t* pActual)
{ {
if (fBuffer == nil) if (fBuffer == NULL)
return kDIErrNotReady; return kDIErrNotReady;
if (length == 0) if (length == 0)
return kDIErrInvalidArg; return kDIErrInvalidArg;
if (fCurrentOffset + (long)length > fLength) { if (fCurrentOffset + (long)length > fLength) {
if (pActual == nil) { if (pActual == NULL) {
WMSG3(" GFDBuffer underrrun off=%ld len=%d flen=%ld\n", WMSG3(" GFDBuffer underrrun off=%ld len=%d flen=%ld\n",
(long) fCurrentOffset, length, (long) fLength); (long) fCurrentOffset, length, (long) fLength);
return kDIErrDataUnderrun; return kDIErrDataUnderrun;
@ -467,7 +467,7 @@ GFDBuffer::Read(void* buf, size_t length, size_t* pActual)
return kDIErrEOF; return kDIErrEOF;
} }
} }
if (pActual != nil) if (pActual != NULL)
*pActual = length; *pActual = length;
memcpy(buf, (const char*)fBuffer + fCurrentOffset, length); memcpy(buf, (const char*)fBuffer + fCurrentOffset, length);
@ -479,9 +479,9 @@ GFDBuffer::Read(void* buf, size_t length, size_t* pActual)
DIError DIError
GFDBuffer::Write(const void* buf, size_t length, size_t* pActual) GFDBuffer::Write(const void* buf, size_t length, size_t* pActual)
{ {
if (fBuffer == nil) if (fBuffer == NULL)
return kDIErrNotReady; return kDIErrNotReady;
assert(pActual == nil); // not handling this yet assert(pActual == NULL); // not handling this yet
if (fCurrentOffset + (long)length > fLength) { if (fCurrentOffset + (long)length > fLength) {
if (!fDoExpand) { if (!fDoExpand) {
WMSG3(" GFDBuffer overrun off=%ld len=%d flen=%ld\n", WMSG3(" GFDBuffer overrun off=%ld len=%d flen=%ld\n",
@ -506,7 +506,7 @@ GFDBuffer::Write(const void* buf, size_t length, size_t* pActual)
WMSG1("Reallocating buffer (new size = %ld)\n", fAllocLength); WMSG1("Reallocating buffer (new size = %ld)\n", fAllocLength);
assert(fAllocLength < kMaxReasonableSize); assert(fAllocLength < kMaxReasonableSize);
char* newBuf = new char[(int) fAllocLength]; char* newBuf = new char[(int) fAllocLength];
if (newBuf == nil) if (newBuf == NULL)
return kDIErrMalloc; return kDIErrMalloc;
memcpy(newBuf, fBuffer, fLength); memcpy(newBuf, fBuffer, fLength);
@ -530,7 +530,7 @@ GFDBuffer::Write(const void* buf, size_t length, size_t* pActual)
DIError DIError
GFDBuffer::Seek(di_off_t offset, DIWhence whence) GFDBuffer::Seek(di_off_t offset, DIWhence whence)
{ {
if (fBuffer == nil) if (fBuffer == NULL)
return kDIErrNotReady; return kDIErrNotReady;
switch (whence) { switch (whence) {
@ -564,7 +564,7 @@ GFDBuffer::Seek(di_off_t offset, DIWhence whence)
di_off_t di_off_t
GFDBuffer::Tell(void) GFDBuffer::Tell(void)
{ {
if (fBuffer == nil) if (fBuffer == NULL)
return (di_off_t) -1; return (di_off_t) -1;
return fCurrentOffset; return fCurrentOffset;
} }
@ -572,7 +572,7 @@ GFDBuffer::Tell(void)
DIError DIError
GFDBuffer::Close(void) GFDBuffer::Close(void)
{ {
if (fBuffer == nil) if (fBuffer == NULL)
return kDIErrNone; return kDIErrNone;
if (fDoDelete) { if (fDoDelete) {
@ -581,7 +581,7 @@ GFDBuffer::Close(void)
} else { } else {
WMSG0(" GFDBuffer closing\n"); WMSG0(" GFDBuffer closing\n");
} }
fBuffer = nil; fBuffer = NULL;
return kDIErrNone; return kDIErrNone;
} }
@ -613,12 +613,12 @@ DIError
GFDWinVolume::Open(const char* deviceName, bool readOnly) GFDWinVolume::Open(const char* deviceName, bool readOnly)
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
HANDLE handle = nil; HANDLE handle = NULL;
//unsigned long kTwoGBBlocks; //unsigned long kTwoGBBlocks;
if (fVolAccess.Ready()) if (fVolAccess.Ready())
return kDIErrAlreadyOpen; return kDIErrAlreadyOpen;
if (deviceName == nil) if (deviceName == NULL)
return kDIErrInvalidArg; return kDIErrInvalidArg;
if (deviceName[0] == '\0') if (deviceName[0] == '\0')
return kDIErrInvalidArg; return kDIErrInvalidArg;
@ -659,7 +659,7 @@ DIError
GFDWinVolume::Read(void* buf, size_t length, size_t* pActual) GFDWinVolume::Read(void* buf, size_t length, size_t* pActual)
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
unsigned char* blkBuf = nil; unsigned char* blkBuf = NULL;
//WMSG2(" GFDWinVolume: reading %ld bytes from offset %ld\n", length, //WMSG2(" GFDWinVolume: reading %ld bytes from offset %ld\n", length,
// fCurrentOffset); // fCurrentOffset);
@ -669,11 +669,11 @@ GFDWinVolume::Read(void* buf, size_t length, size_t* pActual)
// don't allow reading past the end of file // don't allow reading past the end of file
if (fCurrentOffset + (long) length > fVolumeEOF) { if (fCurrentOffset + (long) length > fVolumeEOF) {
if (pActual == nil) if (pActual == NULL)
return kDIErrDataUnderrun; return kDIErrDataUnderrun;
length = (size_t) (fVolumeEOF - fCurrentOffset); length = (size_t) (fVolumeEOF - fCurrentOffset);
} }
if (pActual != nil) if (pActual != NULL)
*pActual = length; *pActual = length;
if (length == 0) if (length == 0)
return kDIErrNone; return kDIErrNone;
@ -743,7 +743,7 @@ DIError
GFDWinVolume::Write(const void* buf, size_t length, size_t* pActual) GFDWinVolume::Write(const void* buf, size_t length, size_t* pActual)
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
unsigned char* blkBuf = nil; unsigned char* blkBuf = NULL;
//WMSG2(" GFDWinVolume: writing %ld bytes at offset %ld\n", length, //WMSG2(" GFDWinVolume: writing %ld bytes at offset %ld\n", length,
// fCurrentOffset); // fCurrentOffset);
@ -755,11 +755,11 @@ GFDWinVolume::Write(const void* buf, size_t length, size_t* pActual)
// don't allow writing past the end of the volume // don't allow writing past the end of the volume
if (fCurrentOffset + (long) length > fVolumeEOF) { if (fCurrentOffset + (long) length > fVolumeEOF) {
if (pActual == nil) if (pActual == NULL)
return kDIErrDataOverrun; return kDIErrDataOverrun;
length = (size_t) (fVolumeEOF - fCurrentOffset); length = (size_t) (fVolumeEOF - fCurrentOffset);
} }
if (pActual != nil) if (pActual != NULL)
*pActual = length; *pActual = length;
if (length == 0) if (length == 0)
return kDIErrNone; return kDIErrNone;

View File

@ -75,7 +75,7 @@ private:
* *
* The Read and Write calls take an optional parameter that allows the caller * The Read and Write calls take an optional parameter that allows the caller
* to see how much data was actually read or written. If the parameter is * to see how much data was actually read or written. If the parameter is
* not specified (or specified as nil), then failure to return the exact * not specified (or specified as NULL), then failure to return the exact
* amount of data requested results an error. * amount of data requested results an error.
* *
* This is not meant to be the end-all of file wrapper classes; in * This is not meant to be the end-all of file wrapper classes; in
@ -83,7 +83,7 @@ private:
* *
* Some libraries, such as NufxLib, require an actual filename to operate * Some libraries, such as NufxLib, require an actual filename to operate
* (bad architecture?). The GetPathName call will return the original * (bad architecture?). The GetPathName call will return the original
* filename if one exists, or nil if there isn't one. (At which point the * filename if one exists, or NULL if there isn't one. (At which point the
* caller has the option of creating a temp file, copying the data into * caller has the option of creating a temp file, copying the data into
* it, and cranking up NufxLib or zlib on that.) * it, and cranking up NufxLib or zlib on that.)
* *
@ -100,9 +100,9 @@ public:
// All sub-classes must provide these, plus a type-specific Open call. // All sub-classes must provide these, plus a type-specific Open call.
virtual DIError Read(void* buf, size_t length, virtual DIError Read(void* buf, size_t length,
size_t* pActual = nil) = 0; size_t* pActual = NULL) = 0;
virtual DIError Write(const void* buf, size_t length, virtual DIError Write(const void* buf, size_t length,
size_t* pActual = nil) = 0; size_t* pActual = NULL) = 0;
virtual DIError Seek(di_off_t offset, DIWhence whence) = 0; virtual DIError Seek(di_off_t offset, DIWhence whence) = 0;
virtual di_off_t Tell(void) = 0; virtual di_off_t Tell(void) = 0;
virtual DIError Truncate(void) = 0; virtual DIError Truncate(void) = 0;
@ -133,7 +133,7 @@ public:
* be seeked to their initial positions. "length" bytes will be copied. * be seeked to their initial positions. "length" bytes will be copied.
*/ */
static DIError CopyFile(GenericFD* pDst, GenericFD* pSrc, di_off_t length, static DIError CopyFile(GenericFD* pDst, GenericFD* pSrc, di_off_t length,
unsigned long* pCRC = nil); unsigned long* pCRC = NULL);
protected: protected:
GenericFD& operator=(const GenericFD&); GenericFD& operator=(const GenericFD&);
@ -145,17 +145,17 @@ protected:
class GFDFile : public GenericFD { class GFDFile : public GenericFD {
public: public:
#ifdef HAVE_FSEEKO #ifdef HAVE_FSEEKO
GFDFile(void) : fPathName(nil), fFp(nil) {} GFDFile(void) : fPathName(NULL), fFp(NULL) {}
#else #else
GFDFile(void) : fPathName(nil), fFd(-1) {} GFDFile(void) : fPathName(NULL), fFd(-1) {}
#endif #endif
virtual ~GFDFile(void) { Close(); delete[] fPathName; } virtual ~GFDFile(void) { Close(); delete[] fPathName; }
virtual DIError Open(const char* filename, bool readOnly); virtual DIError Open(const char* filename, bool readOnly);
virtual DIError Read(void* buf, size_t length, virtual DIError Read(void* buf, size_t length,
size_t* pActual = nil); size_t* pActual = NULL);
virtual DIError Write(const void* buf, size_t length, virtual DIError Write(const void* buf, size_t length,
size_t* pActual = nil); size_t* pActual = NULL);
virtual DIError Seek(di_off_t offset, DIWhence whence); virtual DIError Seek(di_off_t offset, DIWhence whence);
virtual di_off_t Tell(void); virtual di_off_t Tell(void);
virtual DIError Truncate(void); virtual DIError Truncate(void);
@ -175,15 +175,15 @@ private:
#ifdef _WIN32 #ifdef _WIN32
class GFDWinVolume : public GenericFD { class GFDWinVolume : public GenericFD {
public: public:
GFDWinVolume(void) : fPathName(nil), fCurrentOffset(0), fVolumeEOF(-1) GFDWinVolume(void) : fPathName(NULL), fCurrentOffset(0), fVolumeEOF(-1)
{} {}
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);
virtual DIError Read(void* buf, size_t length, virtual DIError Read(void* buf, size_t length,
size_t* pActual = nil); size_t* pActual = NULL);
virtual DIError Write(const void* buf, size_t length, virtual DIError Write(const void* buf, size_t length,
size_t* pActual = nil); size_t* pActual = NULL);
virtual DIError Seek(di_off_t offset, DIWhence whence); virtual DIError Seek(di_off_t offset, DIWhence whence);
virtual di_off_t Tell(void); virtual di_off_t Tell(void);
virtual DIError Truncate(void) { return kDIErrNotSupported; } virtual DIError Truncate(void) { return kDIErrNotSupported; }
@ -203,7 +203,7 @@ private:
class GFDBuffer : public GenericFD { class GFDBuffer : public GenericFD {
public: public:
GFDBuffer(void) : fBuffer(nil) {} GFDBuffer(void) : fBuffer(NULL) {}
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
@ -218,9 +218,9 @@ public:
virtual DIError Open(void* buffer, di_off_t length, bool doDelete, virtual DIError Open(void* buffer, di_off_t length, bool doDelete,
bool doExpand, bool readOnly); bool doExpand, bool readOnly);
virtual DIError Read(void* buf, size_t length, virtual DIError Read(void* buf, size_t length,
size_t* pActual = nil); size_t* pActual = NULL);
virtual DIError Write(const void* buf, size_t length, virtual DIError Write(const void* buf, size_t length,
size_t* pActual = nil); size_t* pActual = NULL);
virtual DIError Seek(di_off_t offset, DIWhence whence); virtual DIError Seek(di_off_t offset, DIWhence whence);
virtual di_off_t Tell(void); virtual di_off_t Tell(void);
virtual DIError Truncate(void) { virtual DIError Truncate(void) {
@ -228,7 +228,7 @@ public:
return kDIErrNone; return kDIErrNone;
} }
virtual DIError Close(void); virtual DIError Close(void);
virtual const char* GetPathName(void) const { return nil; } virtual const char* GetPathName(void) const { return NULL; }
// Back door; try not to use this. // Back door; try not to use this.
void* GetBuffer(void) const { return fBuffer; } void* GetBuffer(void) const { return fBuffer; }
@ -246,18 +246,18 @@ private:
#if 0 #if 0
class GFDEmbedded : public GenericFD { class GFDEmbedded : public GenericFD {
public: public:
GFDEmbedded(void) : fEFD(nil) {} GFDEmbedded(void) : fEFD(NULL) {}
virtual ~GFDEmbedded(void) { Close(); } virtual ~GFDEmbedded(void) { Close(); }
virtual DIError Open(EmbeddedFD* pEFD, bool readOnly); virtual DIError Open(EmbeddedFD* pEFD, bool readOnly);
virtual DIError Read(void* buf, size_t length, virtual DIError Read(void* buf, size_t length,
size_t* pActual = nil); size_t* pActual = NULL);
virtual DIError Write(const void* buf, size_t length, virtual DIError Write(const void* buf, size_t length,
size_t* pActual = nil); size_t* pActual = NULL);
virtual DIError Seek(di_off_t offset, DIWhence whence); virtual DIError Seek(di_off_t offset, DIWhence whence);
virtual di_off_t Tell(void); virtual di_off_t Tell(void);
virtual DIError Close(void); virtual DIError Close(void);
virtual const char* GetPathName(void) const { return nil; } virtual const char* GetPathName(void) const { return NULL; }
private: private:
EmbeddedFD* fEFD; EmbeddedFD* fEFD;
@ -267,11 +267,11 @@ private:
/* pass all requests straight through to another GFD (with offset bias) */ /* pass all requests straight through to another GFD (with offset bias) */
class GFDGFD : public GenericFD { class GFDGFD : public GenericFD {
public: public:
GFDGFD(void) : fpGFD(nil), fOffset(0) {} GFDGFD(void) : fpGFD(NULL), fOffset(0) {}
virtual ~GFDGFD(void) { Close(); } virtual ~GFDGFD(void) { Close(); }
virtual DIError Open(GenericFD* pGFD, di_off_t offset, bool readOnly) { virtual DIError Open(GenericFD* pGFD, di_off_t offset, bool readOnly) {
if (pGFD == nil) if (pGFD == NULL)
return kDIErrInvalidArg; return kDIErrInvalidArg;
if (!readOnly && pGFD->GetReadOnly()) if (!readOnly && pGFD->GetReadOnly())
return kDIErrAccessDenied; // can't convert to read-write return kDIErrAccessDenied; // can't convert to read-write
@ -282,12 +282,12 @@ public:
return kDIErrNone; return kDIErrNone;
} }
virtual DIError Read(void* buf, size_t length, virtual DIError Read(void* buf, size_t length,
size_t* pActual = nil) size_t* pActual = NULL)
{ {
return fpGFD->Read(buf, length, pActual); return fpGFD->Read(buf, length, pActual);
} }
virtual DIError Write(const void* buf, size_t length, virtual DIError Write(const void* buf, size_t length,
size_t* pActual = nil) size_t* pActual = NULL)
{ {
return fpGFD->Write(buf, length, pActual); return fpGFD->Write(buf, length, pActual);
} }
@ -302,7 +302,7 @@ public:
} }
virtual DIError Close(void) { virtual DIError Close(void) {
/* do NOT close underlying descriptor */ /* do NOT close underlying descriptor */
fpGFD = nil; fpGFD = NULL;
return kDIErrNone; return kDIErrNone;
} }
virtual const char* GetPathName(void) const { return fpGFD->GetPathName(); } virtual const char* GetPathName(void) const { return fpGFD->GetPathName(); }

View File

@ -12,7 +12,7 @@
/*static*/ bool Global::fAppInitCalled = false; /*static*/ bool Global::fAppInitCalled = false;
/*static*/ ASPI* Global::fpASPI = nil; /*static*/ ASPI* Global::fpASPI = NULL;
/* global constant */ /* global constant */
const char* DiskImgLib::kASPIDev = "ASPI:"; const char* DiskImgLib::kASPIDev = "ASPI:";
@ -39,7 +39,7 @@ Global::AppInit(void)
HMODULE hModule; HMODULE hModule;
WCHAR fileNameBuf[256]; WCHAR fileNameBuf[256];
hModule = ::GetModuleHandle(L"DiskImg4.dll"); hModule = ::GetModuleHandle(L"DiskImg4.dll");
if (hModule != nil && if (hModule != NULL &&
::GetModuleFileName(hModule, fileNameBuf, ::GetModuleFileName(hModule, fileNameBuf,
sizeof(fileNameBuf) / sizeof(WCHAR)) != 0) sizeof(fileNameBuf) / sizeof(WCHAR)) != 0)
{ {
@ -75,7 +75,7 @@ Global::AppInit(void)
fpASPI = new ASPI; fpASPI = new ASPI;
if (fpASPI->Init() != kDIErrNone) { if (fpASPI->Init() != kDIErrNone) {
delete fpASPI; delete fpASPI;
fpASPI = nil; fpASPI = NULL;
} }
} }
#endif #endif
@ -105,10 +105,10 @@ Global::AppCleanup(void)
* the other. * the other.
*/ */
#ifdef _WIN32 #ifdef _WIN32
/*static*/ bool Global::GetHasSPTI(void) { return !IsWin9x() && fpASPI == nil; } /*static*/ bool Global::GetHasSPTI(void) { return !IsWin9x() && fpASPI == NULL; }
/*static*/ bool Global::GetHasASPI(void) { return fpASPI != nil; } /*static*/ bool Global::GetHasASPI(void) { return fpASPI != NULL; }
/*static*/ unsigned long Global::GetASPIVersion(void) { /*static*/ unsigned long Global::GetASPIVersion(void) {
assert(fpASPI != nil); assert(fpASPI != NULL);
#ifdef WANT_ASPI #ifdef WANT_ASPI
return fpASPI->GetVersion(); return fpASPI->GetVersion();
#else #else
@ -128,11 +128,11 @@ Global::AppCleanup(void)
/*static*/ void /*static*/ void
Global::GetVersion(long* pMajor, long* pMinor, long* pBug) Global::GetVersion(long* pMajor, long* pMinor, long* pBug)
{ {
if (pMajor != nil) if (pMajor != NULL)
*pMajor = kDiskImgVersionMajor; *pMajor = kDiskImgVersionMajor;
if (pMinor != nil) if (pMinor != NULL)
*pMinor = kDiskImgVersionMinor; *pMinor = kDiskImgVersionMinor;
if (pBug != nil) if (pBug != NULL)
*pBug = kDiskImgVersionBug; *pBug = kDiskImgVersionBug;
} }
@ -140,7 +140,7 @@ Global::GetVersion(long* pMajor, long* pMinor, long* pBug)
/* /*
* Pointer to debug message handler function. * Pointer to debug message handler function.
*/ */
/*static*/ Global::DebugMsgHandler Global::gDebugMsgHandler = nil; /*static*/ Global::DebugMsgHandler Global::gDebugMsgHandler = NULL;
/* /*
* Change the debug message handler. The previous handler is returned. * Change the debug message handler. The previous handler is returned.
@ -164,7 +164,7 @@ Global::SetDebugMsgHandler(DebugMsgHandler handler)
/*static*/ void /*static*/ void
Global::PrintDebugMsg(const char* file, int line, const char* fmt, ...) Global::PrintDebugMsg(const char* file, int line, const char* fmt, ...)
{ {
if (gDebugMsgHandler == nil) { if (gDebugMsgHandler == NULL) {
/* /*
* This can happen if the app decides to bail with an exit() * This can happen if the app decides to bail with an exit()
* call. I'm not sure what's zapping the pointer. * call. I'm not sure what's zapping the pointer.

View File

@ -324,8 +324,8 @@ DiskFSGutenberg::GetFileLengths(void)
int tsCount = 0; int tsCount = 0;
unsigned short currentTrack, currentSector; unsigned short currentTrack, currentSector;
pFile = (A2FileGutenberg*) GetNextFile(nil); pFile = (A2FileGutenberg*) GetNextFile(NULL);
while (pFile != nil) { while (pFile != NULL) {
DIError dierr; DIError dierr;
tsCount = 0; tsCount = 0;
currentTrack = pFile->fTrack; currentTrack = pFile->fTrack;
@ -404,7 +404,7 @@ A2FileGutenberg::A2FileGutenberg(DiskFS* pDiskFS) : A2File(pDiskFS)
fLength = -1; fLength = -1;
fSparseLength = -1; fSparseLength = -1;
fpOpenFile = nil; fpOpenFile = NULL;
} }
/* /*
@ -485,7 +485,7 @@ A2FileGutenberg::Open(A2FileDescr** ppOpenFile, bool readOnly,
bool rsrcFork /*=false*/) bool rsrcFork /*=false*/)
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
A2FDGutenberg* pOpenFile = nil; A2FDGutenberg* pOpenFile = NULL;
if (!readOnly) { if (!readOnly) {
if (fpDiskFS->GetDiskImg()->GetReadOnly()) if (fpDiskFS->GetDiskImg()->GetReadOnly())
@ -494,7 +494,7 @@ A2FileGutenberg::Open(A2FileDescr** ppOpenFile, bool readOnly,
return kDIErrBadDiskImage; return kDIErrBadDiskImage;
} }
if (fpOpenFile != nil) { if (fpOpenFile != NULL) {
dierr = kDIErrAlreadyOpen; dierr = kDIErrAlreadyOpen;
goto bail; goto bail;
} }
@ -510,7 +510,7 @@ A2FileGutenberg::Open(A2FileDescr** ppOpenFile, bool readOnly,
fpOpenFile = pOpenFile; // add it to our single-member "open file set" fpOpenFile = pOpenFile; // add it to our single-member "open file set"
*ppOpenFile = pOpenFile; *ppOpenFile = pOpenFile;
pOpenFile = nil; pOpenFile = NULL;
bail: bail:
delete pOpenFile; delete pOpenFile;

View File

@ -226,11 +226,11 @@ DiskFSHFS::LoadVolHeader(void)
time_t when; time_t when;
int isDst; int isDst;
when = time(nil); when = time(NULL);
isDst = localtime(&when)->tm_isdst; isDst = localtime(&when)->tm_isdst;
ptm = gmtime(&when); ptm = gmtime(&when);
if (ptm != nil) { if (ptm != NULL) {
tmWhen = *ptm; // make a copy -- static buffers in time functions tmWhen = *ptm; // make a copy -- static buffers in time functions
tmWhen.tm_isdst = isDst; tmWhen.tm_isdst = isDst;
@ -289,7 +289,7 @@ DiskFSHFS::LoadVolHeader(void)
*/ */
A2FileHFS* pFile; A2FileHFS* pFile;
pFile = new A2FileHFS(this); pFile = new A2FileHFS(this);
if (pFile == nil) { if (pFile == NULL) {
dierr = kDIErrMalloc; dierr = kDIErrMalloc;
goto bail; goto bail;
} }
@ -410,14 +410,14 @@ DiskFSHFS::Initialize(InitMode initMode)
*/ */
fHfsVol = hfs_callback_open(LibHFSCB, this, /*HFS_OPT_NOCACHE |*/ fHfsVol = hfs_callback_open(LibHFSCB, this, /*HFS_OPT_NOCACHE |*/
(fpImg->GetReadOnly() ? HFS_MODE_RDONLY : HFS_MODE_RDWR)); (fpImg->GetReadOnly() ? HFS_MODE_RDONLY : HFS_MODE_RDWR));
if (fHfsVol == nil) { if (fHfsVol == NULL) {
WMSG1("ERROR: hfs_opencallback failed: %s\n", hfs_error); WMSG1("ERROR: hfs_opencallback failed: %s\n", hfs_error);
return kDIErrGeneric; return kDIErrGeneric;
} }
/* volume dir is guaranteed to come first; if not, we need a lookup func */ /* volume dir is guaranteed to come first; if not, we need a lookup func */
A2FileHFS* pVolumeDir; A2FileHFS* pVolumeDir;
pVolumeDir = (A2FileHFS*) GetNextFile(nil); pVolumeDir = (A2FileHFS*) GetNextFile(NULL);
dierr = RecursiveDirAdd(pVolumeDir, ":", 0); dierr = RecursiveDirAdd(pVolumeDir, ":", 0);
if (dierr != kDIErrNone) if (dierr != kDIErrNone)
@ -449,7 +449,7 @@ DiskFSHFS::LibHFSCB(void* vThis, int op, unsigned long arg1, void* arg2)
DiskFSHFS* pThis = (DiskFSHFS*) vThis; DiskFSHFS* pThis = (DiskFSHFS*) vThis;
unsigned long result = (unsigned long) -1; unsigned long result = (unsigned long) -1;
assert(pThis != nil); assert(pThis != NULL);
switch (op) { switch (op) {
case HFS_CB_VOLSIZE: case HFS_CB_VOLSIZE:
@ -458,7 +458,7 @@ DiskFSHFS::LibHFSCB(void* vThis, int op, unsigned long arg1, void* arg2)
break; break;
case HFS_CB_READ: // arg1=block, arg2=buffer case HFS_CB_READ: // arg1=block, arg2=buffer
//WMSG1(" HFSCB read block %lu\n", arg1); //WMSG1(" HFSCB read block %lu\n", arg1);
if (arg1 < pThis->fTotalBlocks && arg2 != nil) { if (arg1 < pThis->fTotalBlocks && arg2 != NULL) {
DIError err = pThis->fpImg->ReadBlock(arg1, arg2); DIError err = pThis->fpImg->ReadBlock(arg1, arg2);
if (err == kDIErrNone) if (err == kDIErrNone)
result = 0; result = 0;
@ -469,7 +469,7 @@ DiskFSHFS::LibHFSCB(void* vThis, int op, unsigned long arg1, void* arg2)
break; break;
case HFS_CB_WRITE: case HFS_CB_WRITE:
WMSG1(" HFSCB write block %lu\n", arg1); WMSG1(" HFSCB write block %lu\n", arg1);
if (arg1 < pThis->fTotalBlocks && arg2 != nil) { if (arg1 < pThis->fTotalBlocks && arg2 != NULL) {
DIError err = pThis->fpImg->WriteBlock(arg1, arg2); DIError err = pThis->fpImg->WriteBlock(arg1, arg2);
if (err == kDIErrNone) if (err == kDIErrNone)
result = 0; result = 0;
@ -500,7 +500,7 @@ DIError
DiskFSHFS::GetFreeSpaceCount(long* pTotalUnits, long* pFreeUnits, DiskFSHFS::GetFreeSpaceCount(long* pTotalUnits, long* pFreeUnits,
int* pUnitSize) const int* pUnitSize) const
{ {
assert(fHfsVol != nil); assert(fHfsVol != NULL);
hfsvolent volEnt; hfsvolent volEnt;
if (hfs_vstat(fHfsVol, &volEnt) != 0) if (hfs_vstat(fHfsVol, &volEnt) != 0)
@ -522,7 +522,7 @@ DiskFSHFS::RecursiveDirAdd(A2File* pParent, const char* basePath, int depth)
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
hfsdir* dir; hfsdir* dir;
hfsdirent dirEntry; hfsdirent dirEntry;
char* pathBuf = nil; char* pathBuf = NULL;
int nameOffset; int nameOffset;
/* if we get too deep, assume it's a loop */ /* if we get too deep, assume it's a loop */
@ -533,7 +533,7 @@ DiskFSHFS::RecursiveDirAdd(A2File* pParent, const char* basePath, int depth)
//WMSG1(" HFS RecursiveDirAdd '%s'\n", basePath); //WMSG1(" HFS RecursiveDirAdd '%s'\n", basePath);
dir = hfs_opendir(fHfsVol, basePath); dir = hfs_opendir(fHfsVol, basePath);
if (dir == nil) { if (dir == NULL) {
printf(" HFS unable to open dir '%s'\n", basePath); printf(" HFS unable to open dir '%s'\n", basePath);
WMSG1(" HFS unable to open dir '%s'\n", basePath); WMSG1(" HFS unable to open dir '%s'\n", basePath);
dierr = kDIErrGeneric; dierr = kDIErrGeneric;
@ -545,7 +545,7 @@ DiskFSHFS::RecursiveDirAdd(A2File* pParent, const char* basePath, int depth)
nameOffset = strlen(basePath) +1; nameOffset = strlen(basePath) +1;
pathBuf = new char[nameOffset + A2FileHFS::kMaxFileName +1]; pathBuf = new char[nameOffset + A2FileHFS::kMaxFileName +1];
if (pathBuf == nil) { if (pathBuf == NULL) {
dierr = kDIErrMalloc; dierr = kDIErrMalloc;
goto bail; goto bail;
} }
@ -564,7 +564,7 @@ DiskFSHFS::RecursiveDirAdd(A2File* pParent, const char* basePath, int depth)
pFile->SetParent(pParent); pFile->SetParent(pParent);
AddFileToList(pFile); AddFileToList(pFile);
if (!fpImg->UpdateScanProgress(nil)) { if (!fpImg->UpdateScanProgress(NULL)) {
WMSG0(" HFS cancelled by user\n"); WMSG0(" HFS cancelled by user\n");
dierr = kDIErrCancelled; dierr = kDIErrCancelled;
goto bail; goto bail;
@ -644,7 +644,7 @@ void A2FileHFS::InitEntry(const hfsdirent* dirEntry)
/*static*/ bool /*static*/ bool
DiskFSHFS::IsValidVolumeName(const char* name) DiskFSHFS::IsValidVolumeName(const char* name)
{ {
if (name == nil) if (name == NULL)
return false; return false;
int len = strlen(name); int len = strlen(name);
@ -666,7 +666,7 @@ DiskFSHFS::IsValidVolumeName(const char* name)
/*static*/ bool /*static*/ bool
DiskFSHFS::IsValidFileName(const char* name) DiskFSHFS::IsValidFileName(const char* name)
{ {
if (name == nil) if (name == NULL)
return false; return false;
int len = strlen(name); int len = strlen(name);
@ -694,7 +694,7 @@ DiskFSHFS::Format(DiskImg* pDiskImg, const char* volName)
return kDIErrInvalidArg; return kDIErrInvalidArg;
/* set fpImg so calls that rely on it will work; we un-set it later */ /* set fpImg so calls that rely on it will work; we un-set it later */
assert(fpImg == nil); assert(fpImg == NULL);
SetDiskImg(pDiskImg); SetDiskImg(pDiskImg);
/* need this for callback function */ /* need this for callback function */
@ -708,7 +708,7 @@ DiskFSHFS::Format(DiskImg* pDiskImg, const char* volName)
// no need to flush; HFS volume is closed // no need to flush; HFS volume is closed
SetDiskImg(nil); // shouldn't really be set by us SetDiskImg(NULL); // shouldn't really be set by us
return kDIErrNone; return kDIErrNone;
} }
@ -726,19 +726,19 @@ DiskFSHFS::NormalizePath(const char* path, char fssep,
char* normalizedBuf, int* pNormalizedBufLen) char* normalizedBuf, int* pNormalizedBufLen)
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
char* normalizedPath = nil; char* normalizedPath = NULL;
int len; int len;
assert(pNormalizedBufLen != nil); assert(pNormalizedBufLen != NULL);
assert(normalizedBuf != nil || *pNormalizedBufLen == 0); assert(normalizedBuf != NULL || *pNormalizedBufLen == 0);
dierr = DoNormalizePath(path, fssep, &normalizedPath); dierr = DoNormalizePath(path, fssep, &normalizedPath);
if (dierr != kDIErrNone) if (dierr != kDIErrNone)
goto bail; goto bail;
assert(normalizedPath != nil); assert(normalizedPath != NULL);
len = strlen(normalizedPath); len = strlen(normalizedPath);
if (normalizedBuf == nil || *pNormalizedBufLen <= len) { if (normalizedBuf == NULL || *pNormalizedBufLen <= len) {
/* too short */ /* too short */
dierr = kDIErrDataOverrun; dierr = kDIErrDataOverrun;
} else { } else {
@ -765,18 +765,18 @@ DiskFSHFS::DoNormalizePath(const char* path, char fssep,
char** pNormalizedPath) char** pNormalizedPath)
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
char* workBuf = nil; char* workBuf = NULL;
char* partBuf = nil; char* partBuf = NULL;
char* outputBuf = nil; char* outputBuf = NULL;
char* start; char* start;
char* end; char* end;
char* outPtr; char* outPtr;
assert(path != nil); assert(path != NULL);
workBuf = new char[strlen(path)+1]; workBuf = new char[strlen(path)+1];
partBuf = new char[strlen(path)+1 +1]; // need +1 for prepending letter partBuf = new char[strlen(path)+1 +1]; // need +1 for prepending letter
outputBuf = new char[strlen(path) * 2]; outputBuf = new char[strlen(path) * 2];
if (workBuf == nil || partBuf == nil || outputBuf == nil) { if (workBuf == NULL || partBuf == NULL || outputBuf == NULL) {
dierr = kDIErrMalloc; dierr = kDIErrMalloc;
goto bail; goto bail;
} }
@ -791,10 +791,10 @@ DiskFSHFS::DoNormalizePath(const char* path, char fssep,
int partIdx; int partIdx;
if (fssep == '\0') { if (fssep == '\0') {
end = nil; end = NULL;
} else { } else {
end = strchr(start, fssep); end = strchr(start, fssep);
if (end != nil) if (end != NULL)
*end = '\0'; *end = '\0';
} }
partIdx = 0; partIdx = 0;
@ -824,7 +824,7 @@ DiskFSHFS::DoNormalizePath(const char* path, char fssep,
if (partIdx > A2FileHFS::kMaxFileName) { if (partIdx > A2FileHFS::kMaxFileName) {
const char* pDot = strrchr(partBuf, '.'); const char* pDot = strrchr(partBuf, '.');
//int DEBUGDOTLEN = pDot - partBuf; //int DEBUGDOTLEN = pDot - partBuf;
if (pDot != nil && partIdx - (pDot-partBuf) <= kMaxExtensionLen) { if (pDot != NULL && partIdx - (pDot-partBuf) <= kMaxExtensionLen) {
int dotLen = partIdx - (pDot-partBuf); int dotLen = partIdx - (pDot-partBuf);
memmove(partBuf + (A2FileProDOS::kMaxFileName - dotLen), memmove(partBuf + (A2FileProDOS::kMaxFileName - dotLen),
pDot, dotLen); // don't use memcpy, move might overlap pDot, dotLen); // don't use memcpy, move might overlap
@ -844,7 +844,7 @@ DiskFSHFS::DoNormalizePath(const char* path, char fssep,
/* /*
* Continue with next segment. * Continue with next segment.
*/ */
if (end == nil) if (end == NULL)
break; break;
start = end+1; start = end+1;
} }
@ -856,7 +856,7 @@ DiskFSHFS::DoNormalizePath(const char* path, char fssep,
assert(*outputBuf != '\0'); assert(*outputBuf != '\0');
*pNormalizedPath = outputBuf; *pNormalizedPath = outputBuf;
outputBuf = nil; outputBuf = NULL;
bail: bail:
delete[] workBuf; delete[] workBuf;
@ -915,13 +915,13 @@ DiskFSHFS::MakeFileNameUnique(const char* pathName, char** pUniqueName)
char* uniqueName; char* uniqueName;
char* fileName; // points inside uniqueName char* fileName; // points inside uniqueName
assert(pathName != nil); assert(pathName != NULL);
assert(pathName[0] == A2FileHFS::kFssep); assert(pathName[0] == A2FileHFS::kFssep);
/* see if it exists */ /* see if it exists */
pFile = GetFileByName(pathName+1); pFile = GetFileByName(pathName+1);
if (pFile == nil) { if (pFile == NULL) {
*pUniqueName = nil; *pUniqueName = NULL;
return kDIErrNone; return kDIErrNone;
} }
@ -930,7 +930,7 @@ DiskFSHFS::MakeFileNameUnique(const char* pathName, char** pUniqueName)
strcpy(uniqueName, pathName); strcpy(uniqueName, pathName);
fileName = strrchr(uniqueName, A2FileHFS::kFssep); fileName = strrchr(uniqueName, A2FileHFS::kFssep);
assert(fileName != nil); assert(fileName != NULL);
fileName++; fileName++;
int nameLen = strlen(fileName); int nameLen = strlen(fileName);
@ -946,7 +946,7 @@ DiskFSHFS::MakeFileNameUnique(const char* pathName, char** pUniqueName)
* do everything we need. * do everything we need.
*/ */
const char* cp = strrchr(fileName, '.'); const char* cp = strrchr(fileName, '.');
if (cp != nil) { if (cp != NULL) {
int tmpOffset = cp - fileName; int tmpOffset = cp - fileName;
if (tmpOffset > 0 && nameLen - tmpOffset <= kMaxExtensionLen) { if (tmpOffset > 0 && nameLen - tmpOffset <= kMaxExtensionLen) {
WMSG1(" HFS (keeping extension '%s')\n", cp); WMSG1(" HFS (keeping extension '%s')\n", cp);
@ -976,7 +976,7 @@ DiskFSHFS::MakeFileNameUnique(const char* pathName, char** pUniqueName)
memcpy(fileName + copyOffset, digitBuf, digitLen); memcpy(fileName + copyOffset, digitBuf, digitLen);
if (dotLen != 0) if (dotLen != 0)
memcpy(fileName + copyOffset + digitLen, dotBuf, dotLen); memcpy(fileName + copyOffset + digitLen, dotBuf, dotLen);
} while (GetFileByName(uniqueName+1) != nil); } while (GetFileByName(uniqueName+1) != NULL);
WMSG1(" HFS converted to unique name: %s\n", uniqueName); WMSG1(" HFS converted to unique name: %s\n", uniqueName);
@ -998,22 +998,22 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile)
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
char typeStr[5], creatorStr[5]; char typeStr[5], creatorStr[5];
char* normalizedPath = nil; char* normalizedPath = NULL;
char* basePath = nil; char* basePath = NULL;
char* fileName = nil; char* fileName = NULL;
char* fullPath = nil; char* fullPath = NULL;
A2FileHFS* pSubdir = nil; A2FileHFS* pSubdir = NULL;
A2FileHFS* pNewFile = nil; A2FileHFS* pNewFile = NULL;
hfsfile* pHfsFile = nil; hfsfile* pHfsFile = NULL;
const bool createUnique = (GetParameter(kParm_CreateUnique) != 0); const bool createUnique = (GetParameter(kParm_CreateUnique) != 0);
assert(fHfsVol != nil); assert(fHfsVol != NULL);
if (fpImg->GetReadOnly()) if (fpImg->GetReadOnly())
return kDIErrAccessDenied; return kDIErrAccessDenied;
assert(pParms != nil); assert(pParms != NULL);
assert(pParms->pathName != nil); assert(pParms->pathName != NULL);
assert(pParms->storageType == A2FileProDOS::kStorageSeedling || assert(pParms->storageType == A2FileProDOS::kStorageSeedling ||
pParms->storageType == A2FileProDOS::kStorageExtended || pParms->storageType == A2FileProDOS::kStorageExtended ||
pParms->storageType == A2FileProDOS::kStorageDirectory); pParms->storageType == A2FileProDOS::kStorageDirectory);
@ -1027,12 +1027,12 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile)
* This must not "sanitize" the path. We need to be working with the * This must not "sanitize" the path. We need to be working with the
* original characters, not the sanitized-for-display versions. * original characters, not the sanitized-for-display versions.
*/ */
assert(pParms->pathName != nil); assert(pParms->pathName != NULL);
dierr = DoNormalizePath(pParms->pathName, pParms->fssep, dierr = DoNormalizePath(pParms->pathName, pParms->fssep,
&normalizedPath); &normalizedPath);
if (dierr != kDIErrNone) if (dierr != kDIErrNone)
goto bail; goto bail;
assert(normalizedPath != nil); assert(normalizedPath != NULL);
/* /*
* The normalized path lacks a leading ':', and might need to * The normalized path lacks a leading ':', and might need to
@ -1042,7 +1042,7 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile)
fullPath[0] = A2FileHFS::kFssep; fullPath[0] = A2FileHFS::kFssep;
strcpy(fullPath+1, normalizedPath); strcpy(fullPath+1, normalizedPath);
delete[] normalizedPath; delete[] normalizedPath;
normalizedPath = nil; normalizedPath = NULL;
/* /*
* Make the name unique within the current directory. This requires * Make the name unique within the current directory. This requires
@ -1056,7 +1056,7 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile)
dierr = MakeFileNameUnique(fullPath, &uniquePath); dierr = MakeFileNameUnique(fullPath, &uniquePath);
if (dierr != kDIErrNone) if (dierr != kDIErrNone)
goto bail; goto bail;
if (uniquePath != nil) { if (uniquePath != NULL) {
delete[] fullPath; delete[] fullPath;
fullPath = uniquePath; fullPath = uniquePath;
} }
@ -1077,9 +1077,9 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile)
*/ */
char* cp; char* cp;
cp = strrchr(fullPath, A2FileHFS::kFssep); cp = strrchr(fullPath, A2FileHFS::kFssep);
assert(cp != nil); assert(cp != NULL);
if (cp == fullPath) { if (cp == fullPath) {
assert(basePath == nil); assert(basePath == NULL);
fileName = new char[strlen(fullPath) +1]; fileName = new char[strlen(fullPath) +1];
strcpy(fileName, fullPath); strcpy(fileName, fullPath);
} else { } else {
@ -1094,12 +1094,12 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile)
WMSG2("SPLIT: '%s' '%s'\n", basePath, fileName); WMSG2("SPLIT: '%s' '%s'\n", basePath, fileName);
assert(fileName != nil); assert(fileName != NULL);
/* /*
* Open the base path. If it doesn't exist, create it recursively. * Open the base path. If it doesn't exist, create it recursively.
*/ */
if (basePath != nil) { if (basePath != NULL) {
WMSG2(" HFS Creating '%s' in '%s'\n", fileName, basePath); WMSG2(" HFS Creating '%s' in '%s'\n", fileName, basePath);
/* /*
* Open the named subdir, creating it if it doesn't exist. We need * Open the named subdir, creating it if it doesn't exist. We need
@ -1107,7 +1107,7 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile)
* linear file list, and that doesn't include the leading ':'. * linear file list, and that doesn't include the leading ':'.
*/ */
pSubdir = (A2FileHFS*)GetFileByName(basePath+1, CompareMacFileNames); pSubdir = (A2FileHFS*)GetFileByName(basePath+1, CompareMacFileNames);
if (pSubdir == nil) { if (pSubdir == NULL) {
WMSG1(" HFS Creating subdir '%s'\n", basePath); WMSG1(" HFS Creating subdir '%s'\n", basePath);
A2File* pNewSub; A2File* pNewSub;
CreateParms newDirParms; CreateParms newDirParms;
@ -1117,11 +1117,11 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile)
newDirParms.fileType = 0; newDirParms.fileType = 0;
newDirParms.auxType = 0; newDirParms.auxType = 0;
newDirParms.access = 0; newDirParms.access = 0;
newDirParms.createWhen = newDirParms.modWhen = time(nil); newDirParms.createWhen = newDirParms.modWhen = time(NULL);
dierr = this->CreateFile(&newDirParms, &pNewSub); dierr = this->CreateFile(&newDirParms, &pNewSub);
if (dierr != kDIErrNone) if (dierr != kDIErrNone)
goto bail; goto bail;
assert(pNewSub != nil); assert(pNewSub != NULL);
pSubdir = (A2FileHFS*) pNewSub; pSubdir = (A2FileHFS*) pNewSub;
} }
@ -1161,7 +1161,7 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile)
basePathLen -= fixedLen+1; basePathLen -= fixedLen+1;
pBaseDir = (A2FileHFS*) pBaseDir->GetParent(); pBaseDir = (A2FileHFS*) pBaseDir->GetParent();
assert(pBaseDir != nil); assert(pBaseDir != NULL);
} }
// check the math; we should be left with the leading ':' // check the math; we should be left with the leading ':'
if (pSubdir->IsVolumeDirectory()) if (pSubdir->IsVolumeDirectory())
@ -1172,11 +1172,11 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile)
/* open the volume directory */ /* open the volume directory */
WMSG1(" HFS Creating '%s' in volume dir\n", fileName); WMSG1(" HFS Creating '%s' in volume dir\n", fileName);
/* volume dir must be first in the list */ /* volume dir must be first in the list */
pSubdir = (A2FileHFS*) GetNextFile(nil); pSubdir = (A2FileHFS*) GetNextFile(NULL);
assert(pSubdir != nil); assert(pSubdir != NULL);
assert(pSubdir->IsVolumeDirectory()); assert(pSubdir->IsVolumeDirectory());
} }
if (pSubdir == nil) { if (pSubdir == NULL) {
WMSG1(" HFS Unable to open subdir '%s'\n", basePath); WMSG1(" HFS Unable to open subdir '%s'\n", basePath);
dierr = kDIErrFileNotFound; dierr = kDIErrFileNotFound;
goto bail; goto bail;
@ -1208,7 +1208,7 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile)
} else { } else {
/* create, and open, the file */ /* create, and open, the file */
pHfsFile = hfs_create(fHfsVol, fullPath, typeStr, creatorStr); pHfsFile = hfs_create(fHfsVol, fullPath, typeStr, creatorStr);
if (pHfsFile == nil) { if (pHfsFile == NULL) {
WMSG1(" HFS create failed: %s\n", hfs_error); WMSG1(" HFS create failed: %s\n", hfs_error);
dierr = kDIErrGeneric; dierr = kDIErrGeneric;
goto bail; goto bail;
@ -1233,7 +1233,7 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile)
(void) hfs_fsetattr(pHfsFile, &dirEnt); (void) hfs_fsetattr(pHfsFile, &dirEnt);
(void) hfs_close(pHfsFile); (void) hfs_close(pHfsFile);
pHfsFile = nil; pHfsFile = NULL;
} }
/* /*
@ -1243,7 +1243,7 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile)
*/ */
pNewFile = new A2FileHFS(this); pNewFile = new A2FileHFS(this);
pNewFile->InitEntry(&dirEnt); pNewFile->InitEntry(&dirEnt);
pNewFile->SetPathName(basePath == nil ? "" : basePath, pNewFile->fFileName); pNewFile->SetPathName(basePath == NULL ? "" : basePath, pNewFile->fFileName);
pNewFile->SetParent(pSubdir); pNewFile->SetParent(pSubdir);
/* /*
@ -1271,7 +1271,7 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile)
pPrevFile = pLastSubdirFile = pSubdir; pPrevFile = pLastSubdirFile = pSubdir;
pNextFile = GetNextFile(pPrevFile); pNextFile = GetNextFile(pPrevFile);
while (pNextFile != nil) { while (pNextFile != NULL) {
if (pNextFile->GetParent() == pNewFile->GetParent()) { if (pNextFile->GetParent() == pNewFile->GetParent()) {
/* in same subdir, compare names */ /* in same subdir, compare names */
if (CompareMacFileNames(pNextFile->GetPathName(), if (CompareMacFileNames(pNextFile->GetPathName(),
@ -1299,7 +1299,7 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile)
//DumpFileList(); //DumpFileList();
*ppNewFile = pNewFile; *ppNewFile = pNewFile;
pNewFile = nil; pNewFile = NULL;
bail: bail:
delete pNewFile; delete pNewFile;
@ -1321,7 +1321,7 @@ DIError
DiskFSHFS::DeleteFile(A2File* pGenericFile) DiskFSHFS::DeleteFile(A2File* pGenericFile)
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
char* pathName = nil; char* pathName = NULL;
if (fpImg->GetReadOnly()) if (fpImg->GetReadOnly())
return kDIErrAccessDenied; return kDIErrAccessDenied;
@ -1378,10 +1378,10 @@ DiskFSHFS::RenameFile(A2File* pGenericFile, const char* newName)
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
A2FileHFS* pFile = (A2FileHFS*) pGenericFile; A2FileHFS* pFile = (A2FileHFS*) pGenericFile;
char* colonOldName = nil; char* colonOldName = NULL;
char* colonNewName = nil; char* colonNewName = NULL;
if (pFile == nil || newName == nil) if (pFile == NULL || newName == NULL)
return kDIErrInvalidArg; return kDIErrInvalidArg;
if (!IsValidFileName(newName)) if (!IsValidFileName(newName))
return kDIErrInvalidArg; return kDIErrInvalidArg;
@ -1396,7 +1396,7 @@ DiskFSHFS::RenameFile(A2File* pGenericFile, const char* newName)
colonOldName = pFile->GetLibHFSPathName(); // adds ':' to start of string colonOldName = pFile->GetLibHFSPathName(); // adds ':' to start of string
lastColon = strrchr(colonOldName, A2FileHFS::kFssep); lastColon = strrchr(colonOldName, A2FileHFS::kFssep);
assert(lastColon != nil); assert(lastColon != NULL);
if (lastColon == colonOldName) { if (lastColon == colonOldName) {
/* in root dir */ /* in root dir */
colonNewName = new char[1 + strlen(newName) +1]; colonNewName = new char[1 + strlen(newName) +1];
@ -1448,7 +1448,7 @@ DiskFSHFS::RenameFile(A2File* pGenericFile, const char* newName)
if (pFile->IsDirectory()) { if (pFile->IsDirectory()) {
/* do all files that come after us */ /* do all files that come after us */
pCur = pFile; pCur = pFile;
while (pCur != nil) { while (pCur != NULL) {
RegeneratePathName((A2FileHFS*) pCur); RegeneratePathName((A2FileHFS*) pCur);
pCur = GetNextFile(pCur); pCur = GetNextFile(pCur);
} }
@ -1478,7 +1478,7 @@ DIError
DiskFSHFS::RegeneratePathName(A2FileHFS* pFile) DiskFSHFS::RegeneratePathName(A2FileHFS* pFile)
{ {
A2FileHFS* pParent; A2FileHFS* pParent;
char* buf = nil; char* buf = NULL;
int len; int len;
/* nothing to do here */ /* nothing to do here */
@ -1496,7 +1496,7 @@ DiskFSHFS::RegeneratePathName(A2FileHFS* pFile)
} }
buf = new char[len+1]; buf = new char[len+1];
if (buf == nil) if (buf == NULL)
return kDIErrMalloc; return kDIErrMalloc;
/* generate the new path name */ /* generate the new path name */
@ -1537,8 +1537,8 @@ DiskFSHFS::RenameVolume(const char* newName)
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
A2FileHFS* pFile; A2FileHFS* pFile;
char* oldNameColon = nil; char* oldNameColon = NULL;
char* newNameColon = nil; char* newNameColon = NULL;
if (!IsValidVolumeName(newName)) if (!IsValidVolumeName(newName))
return kDIErrInvalidArg; return kDIErrInvalidArg;
@ -1546,7 +1546,7 @@ DiskFSHFS::RenameVolume(const char* newName)
return kDIErrAccessDenied; return kDIErrAccessDenied;
/* get file list entry for volume name */ /* get file list entry for volume name */
pFile = (A2FileHFS*) GetNextFile(nil); pFile = (A2FileHFS*) GetNextFile(NULL);
assert(strcmp(pFile->GetFileName(), fVolumeName) == 0); assert(strcmp(pFile->GetFileName(), fVolumeName) == 0);
oldNameColon = new char[strlen(fVolumeName)+2]; oldNameColon = new char[strlen(fVolumeName)+2];
@ -1590,7 +1590,7 @@ DiskFSHFS::SetFileInfo(A2File* pGenericFile, long fileType, long auxType,
if (fpImg->GetReadOnly()) if (fpImg->GetReadOnly())
return kDIErrAccessDenied; return kDIErrAccessDenied;
if (pFile == nil) if (pFile == NULL)
return kDIErrInvalidArg; return kDIErrInvalidArg;
if (pFile->IsDirectory() || pFile->IsVolumeDirectory()) if (pFile->IsDirectory() || pFile->IsVolumeDirectory())
return kDIErrNone; // impossible; just ignore it return kDIErrNone; // impossible; just ignore it
@ -1741,13 +1741,13 @@ long A2FileHFS::GetAuxType(void) const
* Set the full pathname to a combination of the base path and the * Set the full pathname to a combination of the base path and the
* current file's name. * current file's name.
* *
* If we're in the volume directory, pass in "" for the base path (not nil). * If we're in the volume directory, pass in "" for the base path (not NULL).
*/ */
void void
A2FileHFS::SetPathName(const char* basePath, const char* fileName) A2FileHFS::SetPathName(const char* basePath, const char* fileName)
{ {
assert(basePath != nil && fileName != nil); assert(basePath != NULL && fileName != NULL);
if (fPathName != nil) if (fPathName != NULL)
delete[] fPathName; delete[] fPathName;
// strip leading ':' (but treat ":" specially for volume dir entry) // strip leading ':' (but treat ":" specially for volume dir entry)
@ -1845,11 +1845,11 @@ A2FileHFS::Open(A2FileDescr** ppOpenFile, bool readOnly,
bool rsrcFork /*=false*/) bool rsrcFork /*=false*/)
{ {
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
A2FDHFS* pOpenFile = nil; A2FDHFS* pOpenFile = NULL;
hfsfile* pHfsFile; hfsfile* pHfsFile;
char* nameBuf = nil; char* nameBuf = NULL;
if (fpOpenFile != nil) if (fpOpenFile != NULL)
return kDIErrAlreadyOpen; return kDIErrAlreadyOpen;
//if (rsrcFork && fRsrcLength < 0) //if (rsrcFork && fRsrcLength < 0)
// return kDIErrForkNotFound; // return kDIErrForkNotFound;
@ -1899,7 +1899,7 @@ A2FDHFS::Read(void* buf, size_t len, size_t* pActual)
if (result < 0) if (result < 0)
return kDIErrReadFailed; return kDIErrReadFailed;
if (pActual != nil) { if (pActual != NULL) {
*pActual = (size_t) result; *pActual = (size_t) result;
} else if (result != (long) len) { } else if (result != (long) len) {
// short read, can't report it, return error // short read, can't report it, return error
@ -1943,7 +1943,7 @@ A2FDHFS::Write(const void* buf, size_t len, size_t* pActual)
if (result < 0) if (result < 0)
return kDIErrWriteFailed; return kDIErrWriteFailed;
if (pActual != nil) { if (pActual != NULL) {
*pActual = (size_t) result; *pActual = (size_t) result;
} else if (result != (long) len) { } else if (result != (long) len) {
// short write, can't report it, return error // short write, can't report it, return error
@ -2030,7 +2030,7 @@ A2FDHFS::Close(void)
} }
hfs_close(fHfsFile); hfs_close(fHfsFile);
fHfsFile = nil; fHfsFile = NULL;
/* flush changes */ /* flush changes */
if (fModified) { if (fModified) {
@ -2146,7 +2146,7 @@ DiskFSHFS::CreateFakeFile(void)
time_t when = time_t when =
(time_t) (fModifiedDateTime - kDateTimeOffset - fLocalTimeOffset); (time_t) (fModifiedDateTime - kDateTimeOffset - fLocalTimeOffset);
timeStr = ctime(&when); timeStr = ctime(&when);
if (timeStr == nil) { if (timeStr == NULL) {
WMSG2("Invalid date %ld (orig=%ld)\n", when, fModifiedDateTime); WMSG2("Invalid date %ld (orig=%ld)\n", when, fModifiedDateTime);
strcpy(dateBuf, "<no date>"); strcpy(dateBuf, "<no date>");
} else } else
@ -2198,15 +2198,15 @@ DIError
A2FileHFS::Open(A2FileDescr** ppOpenFile, bool readOnly, A2FileHFS::Open(A2FileDescr** ppOpenFile, bool readOnly,
bool rsrcFork /*=false*/) bool rsrcFork /*=false*/)
{ {
A2FDHFS* pOpenFile = nil; A2FDHFS* pOpenFile = NULL;
if (fpOpenFile != nil) if (fpOpenFile != NULL)
return kDIErrAlreadyOpen; return kDIErrAlreadyOpen;
if (rsrcFork && fRsrcLength < 0) if (rsrcFork && fRsrcLength < 0)
return kDIErrForkNotFound; return kDIErrForkNotFound;
assert(readOnly == true); assert(readOnly == true);
pOpenFile = new A2FDHFS(this, nil); pOpenFile = new A2FDHFS(this, NULL);
fpOpenFile = pOpenFile; fpOpenFile = pOpenFile;
*ppOpenFile = pOpenFile; *ppOpenFile = pOpenFile;
@ -2234,11 +2234,11 @@ A2FDHFS::Read(void* buf, size_t len, size_t* pActual)
/* don't allow them to read past the end of the file */ /* don't allow them to read past the end of the file */
if (fOffset + (long)len > pFile->fDataLength) { if (fOffset + (long)len > pFile->fDataLength) {
if (pActual == nil) if (pActual == NULL)
return kDIErrDataUnderrun; return kDIErrDataUnderrun;
len = (size_t) (pFile->fDataLength - fOffset); len = (size_t) (pFile->fDataLength - fOffset);
} }
if (pActual != nil) if (pActual != NULL)
*pActual = len; *pActual = len;
memcpy(buf, pFile->GetFakeFileBuf(), len); memcpy(buf, pFile->GetFakeFileBuf(), len);

Some files were not shown because too many files have changed in this diff Show More