diff --git a/app/ACUArchive.cpp b/app/ACUArchive.cpp index d1cba20..4f9a890 100644 --- a/app/ACUArchive.cpp +++ b/app/ACUArchive.cpp @@ -61,11 +61,11 @@ /* * 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" * 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[]". * * 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; ExpandBuffer expBuf; - char* dataBuf = nil; + char* dataBuf = NULL; long len; bool needAlloc = true; int result = -1; - ASSERT(fpArchive != nil); - ASSERT(fpArchive->fFp != nil); + ASSERT(fpArchive != NULL); + ASSERT(fpArchive->fFp != NULL); - if (*ppText != nil) + if (*ppText != NULL) needAlloc = false; if (which != kDataThread) { @@ -124,7 +124,7 @@ AcuEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength, goto bail; } - char* unsqBuf = nil; + char* unsqBuf = NULL; long unsqLen = 0; expBuf.SeizeBuffer(&unsqBuf, &unsqLen); WMSG2("Unsqueezed %ld bytes to %d\n", @@ -132,7 +132,7 @@ AcuEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength, if (unsqLen == 0) { // some bonehead squeezed a zero-length file delete[] unsqBuf; - ASSERT(*ppText == nil); + ASSERT(*ppText == NULL); WMSG0("Handling zero-length squeezed file!\n"); if (needAlloc) { *ppText = new char[1]; @@ -161,7 +161,7 @@ AcuEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength, } else { if (needAlloc) { dataBuf = new char[len]; - if (dataBuf == nil) { + if (dataBuf == NULL) { pErrMsg->Format(L"allocation of %ld bytes failed", len); goto bail; } @@ -193,7 +193,7 @@ bail: ASSERT(result == IDCANCEL || !pErrMsg->IsEmpty()); if (needAlloc) { delete[] dataBuf; - ASSERT(*ppText == nil); + ASSERT(*ppText == NULL); } } return result; @@ -264,7 +264,7 @@ AcuEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv, // some bonehead squeezed a zero-length file if (uncLen == 0) { - ASSERT(buf == nil); + ASSERT(buf == NULL); WMSG0("Handling zero-length squeezed file!\n"); result = IDOK; goto bail; @@ -355,7 +355,7 @@ bail: * Test this entry by extracting it. * * 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 AcuEntry::TestEntry(CWnd* pMsgWnd) @@ -380,7 +380,7 @@ AcuEntry::TestEntry(CWnd* pMsgWnd) if (GetSqueezed()) { nerr = UnSqueeze(fpArchive->fFp, (unsigned long) GetCompressedLen(), - nil, false, 0); + NULL, false, 0); if (nerr != kNuErrNone) { errMsg.Format(L"Unsqueeze failed: %hs.", NuStrError(nerr)); ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED); @@ -436,7 +436,7 @@ AcuArchive::Open(const WCHAR* filename, bool readOnly, CString* pErrMsg) errno = 0; fFp = _wfopen(filename, L"rb"); - if (fFp == nil) { + if (fFp == NULL) { errMsg.Format(L"Unable to open %ls: %hs.", filename, strerror(errno)); goto bail; } @@ -528,7 +528,7 @@ AcuArchive::LoadContents(void) NuError nerr; int numEntries; - ASSERT(fFp != nil); + ASSERT(fFp != NULL); rewind(fFp); /* @@ -625,7 +625,7 @@ AcuArchive::ReadFileHeader(AcuFileEntry* pEntry) NuError err = kNuErrNone; unsigned char buf[kAcuEntryHeaderLen]; - ASSERT(pEntry != nil); + ASSERT(pEntry != NULL); err = AcuRead(buf, kAcuEntryHeaderLen); if (err != kNuErrNone) @@ -794,9 +794,9 @@ AcuArchive::AcuRead(void* buf, size_t nbyte) { size_t result; - ASSERT(buf != nil); + ASSERT(buf != NULL); ASSERT(nbyte > 0); - ASSERT(fFp != nil); + ASSERT(fFp != NULL); errno = 0; result = fread(buf, 1, nbyte, fFp); @@ -813,7 +813,7 @@ AcuArchive::AcuRead(void* buf, size_t nbyte) NuError AcuArchive::AcuSeek(long offset) { - ASSERT(fFp != nil); + ASSERT(fFp != NULL); ASSERT(offset > 0); /*DBUG(("--- seeking forward %ld bytes\n", offset));*/ @@ -862,18 +862,18 @@ AcuArchive::TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) CString errMsg; bool retVal = false; - ASSERT(fFp != nil); + ASSERT(fFp != NULL); WMSG1("Testing %d entries\n", pSelSet->GetNumEntries()); SelectionEntry* pSelEntry = pSelSet->IterNext(); - while (pSelEntry != nil) { + while (pSelEntry != NULL) { pEntry = (AcuEntry*) pSelEntry->GetEntry(); WMSG2(" Testing '%hs' (offset=%ld)\n", pEntry->GetDisplayName(), pEntry->GetOffset()); - SET_PROGRESS_UPDATE2(0, pEntry->GetDisplayName(), nil); + SET_PROGRESS_UPDATE2(0, pEntry->GetDisplayName(), NULL); nerr = pEntry->TestEntry(pMsgWnd); if (nerr != kNuErrNone) { diff --git a/app/ACUArchive.h b/app/ACUArchive.h index 6d88a56..ee9c1c2 100644 --- a/app/ACUArchive.h +++ b/app/ACUArchive.h @@ -62,7 +62,7 @@ private: */ class AcuArchive : public GenericArchive { public: - AcuArchive(void) : fIsReadOnly(false), fFp(nil) + AcuArchive(void) : fIsReadOnly(false), fFp(NULL) {} virtual ~AcuArchive(void) { (void) Close(); } @@ -124,9 +124,9 @@ public: private: virtual CString Close(void) { - if (fFp != nil) { + if (fFp != NULL) { fclose(fFp); - fFp = nil; + fFp = NULL; } return ""; } diff --git a/app/AboutDialog.cpp b/app/AboutDialog.cpp index 925d863..7b541ce 100644 --- a/app/AboutDialog.cpp +++ b/app/AboutDialog.cpp @@ -49,7 +49,7 @@ AboutDialog::OnInitDialog(void) /* CiderPress version string */ pStatic = (CStatic*) GetDlgItem(IDC_CIDERPRESS_VERS_TEXT); - ASSERT(pStatic != nil); + ASSERT(pStatic != NULL); pStatic->GetWindowText(tmpStr); newVersion.Format(tmpStr, kAppMajorVersion, kAppMinorVersion, kAppBugVersion, @@ -58,7 +58,7 @@ AboutDialog::OnInitDialog(void) /* grab the static text control with the NufxLib version info */ pStatic = (CStatic*) GetDlgItem(IDC_NUFXLIB_VERS_TEXT); - ASSERT(pStatic != nil); + ASSERT(pStatic != NULL); nerr = NuGetVersion(&major, &minor, &bug, NULL, NULL); ASSERT(nerr == kNuErrNone); @@ -68,7 +68,7 @@ AboutDialog::OnInitDialog(void) /* grab the static text control with the DiskImg version info */ pStatic = (CStatic*) GetDlgItem(IDC_DISKIMG_VERS_TEXT); - ASSERT(pStatic != nil); + ASSERT(pStatic != NULL); DiskImgLib::Global::GetVersion(&major, &minor, &bug); pStatic->GetWindowText(tmpStr); @@ -77,7 +77,7 @@ AboutDialog::OnInitDialog(void) /* set the zlib version */ pStatic = (CStatic*) GetDlgItem(IDC_ZLIB_VERS_TEXT); - ASSERT(pStatic != nil); + ASSERT(pStatic != NULL); pStatic->GetWindowText(tmpStr); CString zlibVersionStr(zlibVersion()); newVersion.Format(tmpStr, zlibVersionStr); @@ -85,7 +85,7 @@ AboutDialog::OnInitDialog(void) /* and, finally, the ASPI version */ pStatic = (CStatic*) GetDlgItem(IDC_ASPI_VERS_TEXT); - ASSERT(pStatic != nil); + ASSERT(pStatic != NULL); if (DiskImgLib::Global::GetHasASPI()) { CString versionStr; DWORD version = DiskImgLib::Global::GetASPIVersion(); @@ -104,7 +104,7 @@ AboutDialog::OnInitDialog(void) //ShowRegistrationInfo(); { CWnd* pWnd = GetDlgItem(IDC_ABOUT_ENTER_REG); - if (pWnd != nil) { + if (pWnd != NULL) { pWnd->EnableWindow(FALSE); pWnd->ShowWindow(FALSE); } @@ -139,11 +139,11 @@ AboutDialog::ShowRegistrationInfo(void) //CWnd* pExpireWnd; pUserWnd = GetDlgItem(IDC_REG_USER_NAME); - ASSERT(pUserWnd != nil); + ASSERT(pUserWnd != NULL); pCompanyWnd = GetDlgItem(IDC_REG_COMPANY_NAME); - ASSERT(pCompanyWnd != nil); + ASSERT(pCompanyWnd != NULL); //pExpireWnd = GetDlgItem(IDC_REG_EXPIRES); - //ASSERT(pExpireWnd != nil); + //ASSERT(pExpireWnd != NULL); if (gMyApp.fRegistry.GetRegistration(&user, &company, ®, &versions, &expire) == 0) @@ -160,7 +160,7 @@ AboutDialog::ShowRegistrationInfo(void) expireWhen = atol(expire); if (expireWhen > 0) { CString expireStr; - time_t now = time(nil); + time_t now = time(NULL); expireStr.Format(IDS_REG_EVAL_REM, ((expireWhen - now) + kDay-1) / kDay); /* leave pUserWnd and pCompanyWnd set to defaults */ @@ -176,7 +176,7 @@ AboutDialog::ShowRegistrationInfo(void) /* remove "Enter Registration" button */ CWnd* pWnd = GetDlgItem(IDC_ABOUT_ENTER_REG); - if (pWnd != nil) { + if (pWnd != NULL) { pWnd->EnableWindow(FALSE); } } diff --git a/app/ActionProgressDialog.cpp b/app/ActionProgressDialog.cpp index 9698975..fc55207 100644 --- a/app/ActionProgressDialog.cpp +++ b/app/ActionProgressDialog.cpp @@ -31,10 +31,10 @@ ActionProgressDialog::OnInitDialog(void) // clear the filename fields pWnd = GetDlgItem(IDC_PROG_ARC_NAME); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->SetWindowText(_T("-")); pWnd = GetDlgItem(IDC_PROG_FILE_NAME); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->SetWindowText(_T("-")); pWnd->SetFocus(); // get the focus off the Cancel button @@ -44,12 +44,12 @@ ActionProgressDialog::OnInitDialog(void) } else if (fAction == kActionRecompress) { CString tmpStr; pWnd = GetDlgItem(IDC_PROG_VERB); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); tmpStr.LoadString(IDS_NOW_EXPANDING); pWnd->SetWindowText(tmpStr); pWnd = GetDlgItem(IDC_PROG_TOFROM); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); tmpStr.LoadString(IDS_NOW_COMPRESSING); pWnd->SetWindowText(tmpStr); } else if (fAction == kActionAdd || fAction == kActionAddDisk || @@ -57,37 +57,37 @@ ActionProgressDialog::OnInitDialog(void) { CString tmpStr; pWnd = GetDlgItem(IDC_PROG_VERB); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); tmpStr.LoadString(IDS_NOW_ADDING); pWnd->SetWindowText(tmpStr); pWnd = GetDlgItem(IDC_PROG_TOFROM); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); tmpStr.LoadString(IDS_ADDING_AS); pWnd->SetWindowText(tmpStr); } else if (fAction == kActionDelete) { CString tmpStr; pWnd = GetDlgItem(IDC_PROG_VERB); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); tmpStr.LoadString(IDS_NOW_DELETING); pWnd->SetWindowText(tmpStr); pWnd = GetDlgItem(IDC_PROG_TOFROM); pWnd->DestroyWindow(); pWnd = GetDlgItem(IDC_PROG_FILE_NAME); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->SetWindowText(_T("")); } else if (fAction == kActionTest) { CString tmpStr; pWnd = GetDlgItem(IDC_PROG_VERB); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); tmpStr.LoadString(IDS_NOW_TESTING); pWnd->SetWindowText(tmpStr); pWnd = GetDlgItem(IDC_PROG_TOFROM); pWnd->DestroyWindow(); pWnd = GetDlgItem(IDC_PROG_FILE_NAME); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->SetWindowText(_T("")); } else { ASSERT(false); @@ -105,7 +105,7 @@ ActionProgressDialog::SetArcName(const WCHAR* str) CString oldStr; CWnd* pWnd = GetDlgItem(IDC_PROG_ARC_NAME); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->GetWindowText(oldStr); if (oldStr != str) pWnd->SetWindowText(str); @@ -117,7 +117,7 @@ ActionProgressDialog::GetFileName(void) CString str; CWnd* pWnd = GetDlgItem(IDC_PROG_FILE_NAME); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->GetWindowText(str); return str; @@ -132,7 +132,7 @@ ActionProgressDialog::SetFileName(const WCHAR* str) CString oldStr; CWnd* pWnd = GetDlgItem(IDC_PROG_FILE_NAME); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->GetWindowText(oldStr); if (oldStr != str) pWnd->SetWindowText(str); diff --git a/app/ActionProgressDialog.h b/app/ActionProgressDialog.h index 561a7bf..353deba 100644 --- a/app/ActionProgressDialog.h +++ b/app/ActionProgressDialog.h @@ -30,8 +30,8 @@ public: ActionProgressDialog(void) { fAction = kActionUnknown; - //fpSelSet = nil; - //fpOptionsDlg = nil; + //fpSelSet = NULL; + //fpOptionsDlg = NULL; fCancel = false; //fResult = 0; } diff --git a/app/Actions.cpp b/app/Actions.cpp index c16b5c0..83e1817 100644 --- a/app/Actions.cpp +++ b/app/Actions.cpp @@ -56,7 +56,7 @@ MainWindow::OnActionsView(void) void MainWindow::OnUpdateActionsView(CCmdUI* pCmdUI) { - pCmdUI->Enable(fpContentList != nil && + pCmdUI->Enable(fpContentList != NULL && fpContentList->GetSelectedCount() > 0); } @@ -73,7 +73,7 @@ MainWindow::OnUpdateActionsView(CCmdUI* pCmdUI) void MainWindow::HandleView(void) { - ASSERT(fpContentList != nil); + ASSERT(fpContentList != NULL); SelectionSet selSet; int threadMask = GenericEntry::kAnyThread | GenericEntry::kAllowDamaged | @@ -96,7 +96,7 @@ MainWindow::HandleView(void) vfd.SetNoWrapText(fPreferences.GetPrefBool(kPrNoWrapText)); vfd.DoModal(); - //fpSelSet = nil; + //fpSelSet = NULL; // remember which font they used (sticky pref, not in registry) fPreferences.SetPrefString(kPrViewTextTypeFace, vfd.GetTextTypeFace()); @@ -122,7 +122,7 @@ MainWindow::HandleView(void) void MainWindow::OnActionsOpenAsDisk(void) { - ASSERT(fpContentList != nil); + ASSERT(fpContentList != NULL); ASSERT(fpContentList->GetSelectedCount() == 1); GenericEntry* pEntry = GetSelectedItem(fpContentList); @@ -137,9 +137,9 @@ MainWindow::OnUpdateActionsOpenAsDisk(CCmdUI* pCmdUI) const int kMinLen = 512 * 7; bool allow = false; - if (fpContentList != nil && fpContentList->GetSelectedCount() == 1) { + if (fpContentList != NULL && fpContentList->GetSelectedCount() == 1) { GenericEntry* pEntry = GetSelectedItem(fpContentList); - if (pEntry != nil) { + if (pEntry != NULL) { if ((pEntry->GetHasDataFork() || pEntry->GetHasDiskImage()) && pEntry->GetUncompressedLen() > kMinLen) { @@ -165,7 +165,7 @@ MainWindow::OnActionsAddFiles(void) { WMSG0("Add files!\n"); AddFilesDialog addFiles(this); - DiskImgLib::A2File* pTargetSubdir = nil; + DiskImgLib::A2File* pTargetSubdir = NULL; /* * 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 * but ProDOS and HFS). */ - if (addFiles.fpTargetDiskFS != nil) { + if (addFiles.fpTargetDiskFS != NULL) { DiskImg::FSFormat format; format = addFiles.fpTargetDiskFS->GetDiskImg()->GetFSFormat(); - if (pTargetSubdir != nil) { + if (pTargetSubdir != NULL) { ASSERT(!pTargetSubdir->IsVolumeDirectory()); addFiles.fStoragePrefix = pTargetSubdir->GetPathName(); } @@ -259,7 +259,7 @@ MainWindow::OnActionsAddFiles(void) fpContentList->Reload(); fpActionProgress->Cleanup(this); - fpActionProgress = nil; + fpActionProgress = NULL; if (result) SuccessBeep(); } else { @@ -269,7 +269,7 @@ MainWindow::OnActionsAddFiles(void) void 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. * * If the volume directory of a disk is chosen, "*ppTargetSubdir" will - * be set to nil. + * be set to NULL. */ bool MainWindow::ChooseAddTarget(DiskImgLib::A2File** ppTargetSubdir, DiskImgLib::DiskFS** ppTargetDiskFS) { - ASSERT(ppTargetSubdir != nil); - ASSERT(ppTargetDiskFS != nil); + ASSERT(ppTargetSubdir != NULL); + ASSERT(ppTargetDiskFS != NULL); - *ppTargetSubdir = nil; - *ppTargetDiskFS = nil; + *ppTargetSubdir = NULL; + *ppTargetDiskFS = NULL; GenericEntry* pEntry = GetSelectedItem(fpContentList); - if (pEntry != nil && + if (pEntry != NULL && (pEntry->GetRecordKind() == GenericEntry::kRecordKindDirectory || pEntry->GetRecordKind() == GenericEntry::kRecordKindVolumeDir)) { @@ -324,12 +324,12 @@ MainWindow::ChooseAddTarget(DiskImgLib::A2File** ppTargetSubdir, *ppTargetDiskFS = targetDialog.fpChosenDiskFS; /* make sure the subdir is part of the diskfs */ - ASSERT(*ppTargetSubdir == nil || + ASSERT(*ppTargetSubdir == NULL || (*ppTargetSubdir)->GetDiskFS() == *ppTargetDiskFS); } - if (*ppTargetSubdir != nil && (*ppTargetSubdir)->IsVolumeDirectory()) - *ppTargetSubdir = nil; + if (*ppTargetSubdir != NULL && (*ppTargetSubdir)->IsVolumeDirectory()) + *ppTargetSubdir = NULL; return true; } @@ -481,7 +481,7 @@ MainWindow::OnActionsAddDisks(void) fpContentList->Reload(); fpActionProgress->Cleanup(this); - fpActionProgress = nil; + fpActionProgress = NULL; if (result) SuccessBeep(); @@ -492,7 +492,7 @@ bail: void MainWindow::OnUpdateActionsAddDisks(CCmdUI* pCmdUI) { - pCmdUI->Enable(fpContentList != nil && !fpOpenArchive->IsReadOnly() && + pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly() && fpOpenArchive->GetCapability(GenericArchive::kCapCanAddDisk)); } @@ -516,12 +516,12 @@ MainWindow::OnActionsCreateSubdir(void) { CreateSubdirDialog csDialog; - ASSERT(fpContentList != nil); - ASSERT(fpOpenArchive != nil); + ASSERT(fpContentList != NULL); + ASSERT(fpOpenArchive != NULL); ASSERT(!fpOpenArchive->IsReadOnly()); GenericEntry* pEntry = GetSelectedItem(fpContentList); - if (pEntry == nil) { + if (pEntry == NULL) { // can happen for no selection or multi-selection; should not be here ASSERT(false); return; @@ -552,14 +552,14 @@ MainWindow::OnActionsCreateSubdir(void) void MainWindow::OnUpdateActionsCreateSubdir(CCmdUI* pCmdUI) { - bool enable = fpContentList != nil && !fpOpenArchive->IsReadOnly() && + bool enable = fpContentList != NULL && !fpOpenArchive->IsReadOnly() && fpContentList->GetSelectedCount() == 1 && fpOpenArchive->GetCapability(GenericArchive::kCapCanCreateSubdir); if (enable) { /* second-level check: make sure it's a subdir */ GenericEntry* pEntry = GetSelectedItem(fpContentList); - if (pEntry == nil) { + if (pEntry == NULL) { ASSERT(false); return; } @@ -586,7 +586,7 @@ MainWindow::OnUpdateActionsCreateSubdir(CCmdUI* pCmdUI) void MainWindow::OnActionsExtract(void) { - ASSERT(fpContentList != nil); + ASSERT(fpContentList != NULL); /* * Ask the user about various options. @@ -664,12 +664,12 @@ MainWindow::OnActionsExtract(void) fpActionProgress->Create(ActionProgressDialog::kActionExtract, this); DoBulkExtract(&selSet, &extOpts); fpActionProgress->Cleanup(this); - fpActionProgress = nil; + fpActionProgress = NULL; } void MainWindow::OnUpdateActionsExtract(CCmdUI* pCmdUI) { - pCmdUI->Enable(fpContentList != nil); + pCmdUI->Enable(fpContentList != NULL); } /* @@ -685,11 +685,11 @@ void MainWindow::DoBulkExtract(SelectionSet* pSelSet, const ExtractOptionsDialog* pExtOpts) { - ReformatHolder* pHolder = nil; + ReformatHolder* pHolder = NULL; bool overwriteExisting, ovwrForAll; - ASSERT(pSelSet != nil); - ASSERT(fpActionProgress != nil); + ASSERT(pSelSet != NULL); + ASSERT(fpActionProgress != NULL); pSelSet->IterReset(); @@ -704,7 +704,7 @@ MainWindow::DoBulkExtract(SelectionSet* pSelSet, PeekAndPump(); pSelEntry = pSelSet->IterNext(); - if (pSelEntry == nil) { + if (pSelEntry == NULL) { SuccessBeep(); break; // out of while (all done!) } @@ -783,7 +783,7 @@ MainWindow::DoBulkExtract(SelectionSet* pSelSet, break; } delete pHolder; - pHolder = nil; + pHolder = NULL; } // if they cancelled, delete the "stray" @@ -793,8 +793,8 @@ MainWindow::DoBulkExtract(SelectionSet* pSelSet, /* * Extract a single entry. * - * If "pHolder" is non-nil, it holds the data from the file, and can be - * used for formatted or non-formatted output. If it's nil, we need to + * 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 NULL, we need to * extract the data ourselves. * * Returns "true" on success, "false" on failure. @@ -849,10 +849,10 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread, failed.LoadString(IDS_FAILED); bool writeFailed = false; bool extractAs2MG = false; - char* reformatText = nil; - MyDIBitmap* reformatDib = nil; + char* reformatText = NULL; + MyDIBitmap* reformatDib = NULL; - ASSERT(pEntry != nil); + ASSERT(pEntry != NULL); /* * 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) == "\\"); CString adjustedExtractPath(pExtOpts->fExtractPath); - if (!pExtOpts->fStripFolderNames && pEntry->GetSubVolName() != nil) { + if (!pExtOpts->fStripFolderNames && pEntry->GetSubVolName() != NULL) { adjustedExtractPath += pEntry->GetSubVolName(); adjustedExtractPath += "\\"; } @@ -917,12 +917,12 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread, outputPath += convNameExtdPlus; - ReformatOutput* pOutput = nil; + ReformatOutput* pOutput = NULL; /* * If requested, try to reformat this file. */ - if (pHolder != nil) { + if (pHolder != NULL) { ReformatHolder::ReformatPart part = ReformatHolder::kPartUnknown; ReformatHolder::ReformatID id; CString title; @@ -952,7 +952,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread, pOutput = pHolder->Apply(part, id); } - if (pOutput != nil) { + if (pOutput != NULL) { /* use output pathname without preservation */ CString tmpPath; bool goodReformat = true; @@ -999,7 +999,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread, outputPath = tmpPath; } else { 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. */ - FILE* fp = nil; + FILE* fp = NULL; int result; result = OpenOutputFile(&outputPath, pathProp, pEntry->GetModWhen(), pOverwriteExisting, pOvwrForAll, &fp); @@ -1053,7 +1053,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread, fpActionProgress->SetFileName(outputPath); } - if (fp == nil) { + if (fp == NULL) { /* looks like they elected to skip extraction of this file */ delete pOutput; return true; @@ -1143,7 +1143,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread, * * (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 * to tweak the progress updater, which already shows 100%. @@ -1160,7 +1160,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread, pOutput->GetOutputKind() == ReformatOutput::kOutputCSV) { WMSG0(" Writing text, RTF, CSV, or raw\n"); - ASSERT(pOutput->GetTextBuf() != nil); + ASSERT(pOutput->GetTextBuf() != NULL); int err = 0; if (fwrite(pOutput->GetTextBuf(), pOutput->GetTextLen(), 1, fp) != 1) @@ -1176,7 +1176,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread, } } else if (pOutput->GetOutputKind() == ReformatOutput::kOutputBitmap) { WMSG0(" Writing bitmap\n"); - ASSERT(pOutput->GetDIB() != nil); + ASSERT(pOutput->GetDIB() != NULL); int err = pOutput->GetDIB()->WriteToFile(fp); if (err != 0) { 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", pOutput->GetTextLen()); - ASSERT(pOutput->GetTextBuf() != nil); + ASSERT(pOutput->GetTextBuf() != NULL); bool lastCR = false; GenericEntry::ConvertHighASCII thisConvHA = convHA; int err; @@ -1229,7 +1229,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread, */ CString msg; int result; - ASSERT(fpActionProgress != nil); + ASSERT(fpActionProgress != NULL); WMSG3("Extracting '%ls', requesting thisConv=%d, convHA=%d\n", outputPath, thisConv, convHA); 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. * 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" * and "*pOvwrForAll" may be updated, and "*pOutputPath" will change if * the user chose to rename the file. @@ -1301,7 +1301,7 @@ MainWindow::OpenOutputFile(CString* pOutputPath, const PathProposal& pathProp, failed.LoadString(IDS_FAILED); - *pFp = nil; + *pFp = NULL; did_rename: PathName path(*pOutputPath); @@ -1361,7 +1361,7 @@ do_overwrite: goto bail; *pFp = _wfopen(*pOutputPath, L"wb"); - if (*pFp == nil) + if (*pFp == NULL) err = errno ? errno : -1; /* fall through with error */ @@ -1407,8 +1407,8 @@ bail: void MainWindow::OnActionsTest(void) { - ASSERT(fpContentList != nil); - ASSERT(fpOpenArchive != nil); + ASSERT(fpContentList != NULL); + ASSERT(fpOpenArchive != NULL); /* * Ask the user about various options. @@ -1461,14 +1461,14 @@ MainWindow::OnActionsTest(void) result = fpOpenArchive->TestSelection(fpActionProgress, &selSet); fpActionProgress->Cleanup(this); - fpActionProgress = nil; + fpActionProgress = NULL; //if (result) // SuccessBeep(); } void MainWindow::OnUpdateActionsTest(CCmdUI* pCmdUI) { - pCmdUI->Enable(fpContentList != nil && fpContentList->GetItemCount() > 0 + pCmdUI->Enable(fpContentList != NULL && fpContentList->GetItemCount() > 0 && fpOpenArchive->GetCapability(GenericArchive::kCapCanTest)); } @@ -1485,8 +1485,8 @@ MainWindow::OnUpdateActionsTest(CCmdUI* pCmdUI) void MainWindow::OnActionsDelete(void) { - ASSERT(fpContentList != nil); - ASSERT(fpOpenArchive != nil); + ASSERT(fpContentList != NULL); + ASSERT(fpOpenArchive != NULL); ASSERT(!fpOpenArchive->IsReadOnly()); /* @@ -1565,7 +1565,7 @@ MainWindow::OnActionsDelete(void) fpContentList->Reload(); fpActionProgress->Cleanup(this); - fpActionProgress = nil; + fpActionProgress = NULL; if (result) SuccessBeep(); @@ -1573,7 +1573,7 @@ MainWindow::OnActionsDelete(void) void MainWindow::OnUpdateActionsDelete(CCmdUI* pCmdUI) { - pCmdUI->Enable(fpContentList != nil && !fpOpenArchive->IsReadOnly() + pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly() && fpContentList->GetSelectedCount() > 0); } @@ -1592,8 +1592,8 @@ MainWindow::OnUpdateActionsDelete(CCmdUI* pCmdUI) void MainWindow::OnActionsRename(void) { - ASSERT(fpContentList != nil); - ASSERT(fpOpenArchive != nil); + ASSERT(fpContentList != NULL); + ASSERT(fpOpenArchive != NULL); ASSERT(!fpOpenArchive->IsReadOnly()); /* @@ -1628,7 +1628,7 @@ MainWindow::OnActionsRename(void) void MainWindow::OnUpdateActionsRename(CCmdUI* pCmdUI) { - pCmdUI->Enable(fpContentList != nil && !fpOpenArchive->IsReadOnly() + pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly() && fpContentList->GetSelectedCount() > 0); } @@ -1645,15 +1645,15 @@ MainWindow::OnUpdateActionsRename(CCmdUI* pCmdUI) void MainWindow::OnActionsEditComment(void) { - ASSERT(fpContentList != nil); - ASSERT(fpOpenArchive != nil); + ASSERT(fpContentList != NULL); + ASSERT(fpOpenArchive != NULL); ASSERT(!fpOpenArchive->IsReadOnly()); EditCommentDialog editDlg(this); CString oldComment; GenericEntry* pEntry = GetSelectedItem(fpContentList); - if (pEntry == nil) { + if (pEntry == NULL) { ASSERT(false); return; } @@ -1690,7 +1690,7 @@ MainWindow::OnActionsEditComment(void) void MainWindow::OnUpdateActionsEditComment(CCmdUI* pCmdUI) { - pCmdUI->Enable(fpContentList != nil && !fpOpenArchive->IsReadOnly() && + pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly() && fpContentList->GetSelectedCount() == 1 && fpOpenArchive->GetCapability(GenericArchive::kCapCanEditComment)); } @@ -1714,14 +1714,14 @@ MainWindow::OnUpdateActionsEditComment(CCmdUI* pCmdUI) void MainWindow::OnActionsEditProps(void) { - ASSERT(fpContentList != nil); - ASSERT(fpOpenArchive != nil); + ASSERT(fpContentList != NULL); + ASSERT(fpOpenArchive != NULL); EditPropsDialog propsDlg(this); CString oldComment; GenericEntry* pEntry = GetSelectedItem(fpContentList); - if (pEntry == nil) { + if (pEntry == NULL) { ASSERT(false); return; } @@ -1745,7 +1745,7 @@ void MainWindow::OnUpdateActionsEditProps(CCmdUI* pCmdUI) { // allow it in read-only mode, so we can view the props - pCmdUI->Enable(fpContentList != nil && + pCmdUI->Enable(fpContentList != NULL && fpContentList->GetSelectedCount() == 1); } @@ -1764,8 +1764,8 @@ MainWindow::OnActionsRenameVolume(void) { RenameVolumeDialog rvDialog; - ASSERT(fpContentList != nil); - ASSERT(fpOpenArchive != nil); + ASSERT(fpContentList != NULL); + ASSERT(fpOpenArchive != NULL); ASSERT(!fpOpenArchive->IsReadOnly()); /* only know how to deal with disk images */ @@ -1777,7 +1777,7 @@ MainWindow::OnActionsRenameVolume(void) DiskImgLib::DiskFS* pDiskFS; pDiskFS = ((DiskArchive*) fpOpenArchive)->GetDiskFS(); - ASSERT(pDiskFS != nil); + ASSERT(pDiskFS != NULL); rvDialog.fpArchive = (DiskArchive*) fpOpenArchive; if (rvDialog.DoModal() != IDOK) @@ -1808,7 +1808,7 @@ MainWindow::OnActionsRenameVolume(void) void MainWindow::OnUpdateActionsRenameVolume(CCmdUI* pCmdUI) { - pCmdUI->Enable(fpContentList != nil && !fpOpenArchive->IsReadOnly() && + pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly() && fpOpenArchive->GetCapability(GenericArchive::kCapCanRenameVolume)); } @@ -1825,8 +1825,8 @@ MainWindow::OnUpdateActionsRenameVolume(CCmdUI* pCmdUI) void MainWindow::OnActionsRecompress(void) { - ASSERT(fpContentList != nil); - ASSERT(fpOpenArchive != nil); + ASSERT(fpContentList != NULL); + ASSERT(fpOpenArchive != NULL); /* * Ask the user about various options. @@ -1886,7 +1886,7 @@ MainWindow::OnActionsRecompress(void) fpContentList->Reload(); fpActionProgress->Cleanup(this); - fpActionProgress = nil; + fpActionProgress = NULL; if (result) { @@ -1908,7 +1908,7 @@ MainWindow::OnActionsRecompress(void) void MainWindow::OnUpdateActionsRecompress(CCmdUI* pCmdUI) { - pCmdUI->Enable(fpContentList != nil && !fpOpenArchive->IsReadOnly() && + pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly() && fpContentList->GetItemCount() > 0 && fpOpenArchive->GetCapability(GenericArchive::kCapCanRecompress)); } @@ -1922,7 +1922,7 @@ MainWindow::CalcTotalSize(LONGLONG* pUncomp, LONGLONG* pComp) const GenericEntry* pEntry = fpOpenArchive->GetEntries(); LONGLONG uncomp = 0, comp = 0; - while (pEntry != nil) { + while (pEntry != NULL) { uncomp += pEntry->GetUncompressedLen(); comp += pEntry->GetCompressedLen(); pEntry = pEntry->GetNext(); @@ -1945,8 +1945,8 @@ MainWindow::CalcTotalSize(LONGLONG* pUncomp, LONGLONG* pComp) const void MainWindow::OnActionsConvDisk(void) { - ASSERT(fpContentList != nil); - ASSERT(fpOpenArchive != nil); + ASSERT(fpContentList != NULL); + ASSERT(fpOpenArchive != NULL); /* * Ask the user about various options. @@ -2065,7 +2065,7 @@ MainWindow::OnActionsConvDisk(void) fpActionProgress, &xferOpts); fpActionProgress->Cleanup(this); - fpActionProgress = nil; + fpActionProgress = NULL; if (result == GenericArchive::kXferOK) SuccessBeep(); @@ -2077,7 +2077,7 @@ void MainWindow::OnUpdateActionsConvDisk(CCmdUI* pCmdUI) { /* right now, only NufxArchive has the Xfer stuff implemented */ - pCmdUI->Enable(fpContentList != nil && + pCmdUI->Enable(fpContentList != NULL && fpContentList->GetItemCount() > 0 && fpOpenArchive->GetArchiveKind() == GenericArchive::kArchiveNuFX); } @@ -2095,8 +2095,8 @@ MainWindow::OnUpdateActionsConvDisk(CCmdUI* pCmdUI) void MainWindow::OnActionsConvFile(void) { - ASSERT(fpContentList != nil); - ASSERT(fpOpenArchive != nil); + ASSERT(fpContentList != NULL); + ASSERT(fpOpenArchive != NULL); /* * Ask the user about various options. @@ -2192,7 +2192,7 @@ MainWindow::OnActionsConvFile(void) } xferOpts.fTarget = new NufxArchive; - errStr = xferOpts.fTarget->New(filename, nil); + errStr = xferOpts.fTarget->New(filename, NULL); if (!errStr.IsEmpty()) { ShowFailureMsg(this, errStr, IDS_FAILED); delete xferOpts.fTarget; @@ -2211,7 +2211,7 @@ MainWindow::OnActionsConvFile(void) fpActionProgress, &xferOpts); fpActionProgress->Cleanup(this); - fpActionProgress = nil; + fpActionProgress = NULL; if (result == GenericArchive::kXferOK) SuccessBeep(); @@ -2221,7 +2221,7 @@ MainWindow::OnActionsConvFile(void) void MainWindow::OnUpdateActionsConvFile(CCmdUI* pCmdUI) { - pCmdUI->Enable(fpContentList != nil && + pCmdUI->Enable(fpContentList != NULL && fpContentList->GetItemCount() > 0 && fpOpenArchive->GetArchiveKind() == GenericArchive::kArchiveDiskImage); } @@ -2247,7 +2247,7 @@ MainWindow::OnUpdateActionsConvToWav(CCmdUI* pCmdUI) { BOOL enable = false; - if (fpContentList != nil && fpContentList->GetSelectedCount() == 1) { + if (fpContentList != NULL && fpContentList->GetSelectedCount() == 1) { /* only BAS, INT, and BIN shorter than 64K */ GenericEntry* pEntry = GetSelectedItem(fpContentList); @@ -2293,7 +2293,7 @@ MainWindow::OnActionsConvFromWav(void) dlg.DoModal(); if (dlg.IsDirty()) { - assert(fpContentList != nil); + assert(fpContentList != NULL); fpContentList->Reload(); } @@ -2303,7 +2303,7 @@ bail: void 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(); GenericArchive* pArchive = pMain->GetOpenArchive(); - DiskImgLib::A2File* pTargetSubdir = nil; + DiskImgLib::A2File* pTargetSubdir = NULL; XferFileOptions xferOpts; CString storagePrefix; - unsigned char* dataBuf = nil; - unsigned char* rsrcBuf = nil; + unsigned char* dataBuf = NULL; + unsigned char* rsrcBuf = NULL; - ASSERT(pArchive != nil); + ASSERT(pArchive != NULL); ASSERT(errMsg.IsEmpty()); /* @@ -2339,7 +2339,7 @@ MainWindow::SaveToArchive(GenericArchive::FileDetails* pDetails, dataBuf = new unsigned char[1]; else dataBuf = new unsigned char[dataLen]; - if (dataBuf == nil) { + if (dataBuf == NULL) { errMsg.Format(L"Unable to allocate %ld bytes", dataLen); goto bail; } @@ -2366,7 +2366,7 @@ MainWindow::SaveToArchive(GenericArchive::FileDetails* pDetails, //details.storageName.Replace(':', '_'); pDetails->fileSysInfo = ':'; } - if (pTargetSubdir != nil) { + if (pTargetSubdir != NULL) { storagePrefix = pTargetSubdir->GetPathName(); WMSG1("--- using storagePrefix '%ls'\n", storagePrefix); } @@ -2441,7 +2441,7 @@ MainWindow::OnActionsImportBAS(void) dlg.DoModal(); if (dlg.IsDirty()) { - assert(fpContentList != nil); + assert(fpContentList != NULL); fpContentList->Reload(); } @@ -2451,7 +2451,7 @@ bail: void 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; CString errMsg; - if (pHolder == nil) + if (pHolder == NULL) return -1; if (pEntry->GetHasDataFork()) @@ -2501,7 +2501,7 @@ MainWindow::GetFilePart(const GenericEntry* pEntry, int whichThread, { CString errMsg; ReformatHolder::ReformatPart part; - char* buf = nil; + char* buf = NULL; long len = 0; di_off_t threadLen; int result; @@ -2542,19 +2542,19 @@ MainWindow::GetFilePart(const GenericEntry* pEntry, int whichThread, if (result == IDOK) { /* on success, ETTB guarantees a buffer, even for zero-len file */ - ASSERT(buf != nil); + ASSERT(buf != NULL); pHolder->SetSourceBuf(part, (unsigned char*) buf, len); } else if (result == IDCANCEL) { /* not expected */ errMsg = L"Cancelled!"; pHolder->SetErrorMsg(part, errMsg); - ASSERT(buf == nil); + ASSERT(buf == NULL); } else { /* transfer error message to ReformatHolder buffer */ WMSG1("Got error message from ExtractThread: '%ls'\n", (LPCWSTR) errMsg); pHolder->SetErrorMsg(part, errMsg); - ASSERT(buf == nil); + ASSERT(buf == NULL); } bail: diff --git a/app/AddClashDialog.cpp b/app/AddClashDialog.cpp index d26524d..ea8a788 100644 --- a/app/AddClashDialog.cpp +++ b/app/AddClashDialog.cpp @@ -25,11 +25,11 @@ AddClashDialog::OnInitDialog(void) CWnd* pWnd; pWnd = GetDlgItem(IDC_CLASH_WINNAME); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->SetWindowText(fWindowsName); pWnd = GetDlgItem(IDC_CLASH_STORAGENAME); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->SetWindowText(fStorageName); return CDialog::OnInitDialog(); diff --git a/app/AddClashDialog.h b/app/AddClashDialog.h index 133fe13..7593a0c 100644 --- a/app/AddClashDialog.h +++ b/app/AddClashDialog.h @@ -14,7 +14,7 @@ */ class AddClashDialog : public CDialog { public: - AddClashDialog(CWnd* pParentWnd = nil) : + AddClashDialog(CWnd* pParentWnd = NULL) : CDialog(IDD_ADD_CLASH, pParentWnd) { fDoRename = false; diff --git a/app/AddFilesDialog.cpp b/app/AddFilesDialog.cpp index 81e6004..81eb86b 100644 --- a/app/AddFilesDialog.cpp +++ b/app/AddFilesDialog.cpp @@ -61,7 +61,7 @@ AddFilesDialog::MyDataExchange(bool saveAndValidate) (GetDlgButtonCheck(this, IDC_ADDFILES_OVERWRITE) == BST_CHECKED); pWnd = GetDlgItem(IDC_ADDFILES_PREFIX); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->GetWindowText(fStoragePrefix); if (!ValidateStoragePrefix()) @@ -93,7 +93,7 @@ AddFilesDialog::MyDataExchange(bool saveAndValidate) fOverwriteExisting != FALSE); pWnd = GetDlgItem(IDC_ADDFILES_PREFIX); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->SetWindowText(fStoragePrefix); if (!fStoragePrefixEnable) pWnd->EnableWindow(FALSE); diff --git a/app/AddFilesDialog.h b/app/AddFilesDialog.h index 2ed5b29..dde1e25 100644 --- a/app/AddFilesDialog.h +++ b/app/AddFilesDialog.h @@ -38,9 +38,9 @@ public: fAcceptButtonID = IDC_SELECT_ACCEPT; - fpTargetDiskFS = nil; - //fpTargetSubdir = nil; - fpDiskImg = nil; + fpTargetDiskFS = NULL; + //fpTargetSubdir = NULL; + fpDiskImg = NULL; } virtual ~AddFilesDialog(void) {} diff --git a/app/ArchiveInfoDialog.cpp b/app/ArchiveInfoDialog.cpp index ec43e18..0420949 100644 --- a/app/ArchiveInfoDialog.cpp +++ b/app/ArchiveInfoDialog.cpp @@ -52,12 +52,12 @@ NufxArchiveInfoDialog::OnInitDialog(void) NuError nerr; time_t when; - ASSERT(fpArchive != nil); + ASSERT(fpArchive != NULL); pNuArchive = fpArchive->GetNuArchivePointer(); - ASSERT(pNuArchive != nil); + ASSERT(pNuArchive != NULL); (void) NuGetMasterHeader(pNuArchive, &pMasterHeader); - ASSERT(pMasterHeader != nil); + ASSERT(pMasterHeader != NULL); pWnd = GetDlgItem(IDC_AI_FILENAME); CString pathName(fpArchive->GetPathName()); @@ -133,12 +133,12 @@ DiskArchiveInfoDialog::OnInitDialog(void) const DiskImg* pDiskImg; const DiskFS* pDiskFS; - ASSERT(fpArchive != nil); + ASSERT(fpArchive != NULL); pDiskImg = fpArchive->GetDiskImg(); - ASSERT(pDiskImg != nil); + ASSERT(pDiskImg != NULL); pDiskFS = fpArchive->GetDiskFS(); - ASSERT(pDiskFS != nil); + ASSERT(pDiskFS != NULL); /* * Volume characteristics. @@ -162,7 +162,7 @@ DiskArchiveInfoDialog::OnInitDialog(void) { CString tmpStr; const DiskImg::NibbleDescr* pNibbleDescr = pDiskImg->GetNibbleDescr(); - if (pNibbleDescr != nil) + if (pNibbleDescr != NULL) tmpStr.Format(L"%hs, layout is \"%hs\"", DiskImg::ToString(physicalFormat), pNibbleDescr->description); else @@ -215,10 +215,10 @@ DiskArchiveInfoDialog::AddSubVolumes(const DiskFS* pDiskFS, const WCHAR* prefix, * Add everything beneath the current level. */ DiskFS::SubVolume* pSubVol; - pSubVol = pDiskFS->GetNextSubVolume(nil); + pSubVol = pDiskFS->GetNextSubVolume(NULL); tmpStr = prefix; tmpStr += L" "; - while (pSubVol != nil) { + while (pSubVol != NULL) { AddSubVolumes(pSubVol->GetDiskFS(), tmpStr, pIdx); pSubVol = pDiskFS->GetNextSubVolume(pSubVol); @@ -232,12 +232,12 @@ void DiskArchiveInfoDialog::OnSubVolSelChange(void) { CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_AIDISK_SUBVOLSEL); - ASSERT(pCombo != nil); + ASSERT(pCombo != NULL); //WMSG1("+++ SELECTION IS NOW %d\n", pCombo->GetCurSel()); const DiskFS* pDiskFS; pDiskFS = (DiskFS*) pCombo->GetItemData(pCombo->GetCurSel()); - ASSERT(pDiskFS != nil); + ASSERT(pDiskFS != NULL); FillInVolumeInfo(pDiskFS); } @@ -402,7 +402,7 @@ BnyArchiveInfoDialog::OnInitDialog(void) CWnd* pWnd; CString tmpStr; - ASSERT(fpArchive != nil); + ASSERT(fpArchive != NULL); pWnd = GetDlgItem(IDC_AI_FILENAME); pWnd->SetWindowText(fpArchive->GetPathName()); @@ -429,7 +429,7 @@ AcuArchiveInfoDialog::OnInitDialog(void) CWnd* pWnd; CString tmpStr; - ASSERT(fpArchive != nil); + ASSERT(fpArchive != NULL); pWnd = GetDlgItem(IDC_AI_FILENAME); pWnd->SetWindowText(fpArchive->GetPathName()); diff --git a/app/BNYArchive.cpp b/app/BNYArchive.cpp index eb70a6c..7fb3007 100644 --- a/app/BNYArchive.cpp +++ b/app/BNYArchive.cpp @@ -24,11 +24,11 @@ /* * 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" * 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[]". * * 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; ExpandBuffer expBuf; - char* dataBuf = nil; + char* dataBuf = NULL; long len; bool needAlloc = true; int result = -1; - ASSERT(fpArchive != nil); - ASSERT(fpArchive->fFp != nil); + ASSERT(fpArchive != NULL); + ASSERT(fpArchive->fFp != NULL); - if (*ppText != nil) + if (*ppText != NULL) needAlloc = false; if (which != kDataThread) { @@ -87,14 +87,14 @@ BnyEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength, goto bail; } - char* unsqBuf = nil; + char* unsqBuf = NULL; long unsqLen = 0; expBuf.SeizeBuffer(&unsqBuf, &unsqLen); WMSG2("Unsqueezed %ld bytes to %d\n", len, unsqLen); if (unsqLen == 0) { // some bonehead squeezed a zero-length file delete[] unsqBuf; - ASSERT(*ppText == nil); + ASSERT(*ppText == NULL); WMSG0("Handling zero-length squeezed file!\n"); if (needAlloc) { *ppText = new char[1]; @@ -123,7 +123,7 @@ BnyEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength, } else { if (needAlloc) { dataBuf = new char[len]; - if (dataBuf == nil) { + if (dataBuf == NULL) { pErrMsg->Format(L"allocation of %ld bytes failed", len); goto bail; } @@ -155,7 +155,7 @@ bail: ASSERT(result == IDCANCEL || !pErrMsg->IsEmpty()); if (needAlloc) { delete[] dataBuf; - ASSERT(*ppText == nil); + ASSERT(*ppText == NULL); } } return result; @@ -226,7 +226,7 @@ BnyEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv, // some bonehead squeezed a zero-length file if (uncLen == 0) { - ASSERT(buf == nil); + ASSERT(buf == NULL); WMSG0("Handling zero-length squeezed file!\n"); result = IDOK; goto bail; @@ -317,7 +317,7 @@ bail: * Test this entry by extracting it. * * 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 BnyEntry::TestEntry(CWnd* pMsgWnd) @@ -342,7 +342,7 @@ BnyEntry::TestEntry(CWnd* pMsgWnd) if (GetSqueezed()) { nerr = UnSqueeze(fpArchive->fFp, (unsigned long) GetUncompressedLen(), - nil, true, kBNYBlockSize); + NULL, true, kBNYBlockSize); if (nerr != kNuErrNone) { errMsg.Format(L"Unsqueeze failed: %hs.", NuStrError(nerr)); ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED); @@ -399,7 +399,7 @@ BnyArchive::Open(const WCHAR* filename, bool readOnly, CString* pErrMsg) errno = 0; fFp = _wfopen(filename, L"rb"); - if (fFp == nil) { + if (fFp == NULL) { errMsg.Format(L"Unable to open %ls: %hs.", filename, strerror(errno)); goto bail; } @@ -485,7 +485,7 @@ BnyArchive::LoadContents(void) { NuError nerr; - ASSERT(fFp != nil); + ASSERT(fFp != NULL); rewind(fFp); nerr = BNYIterate(); @@ -631,9 +631,9 @@ BnyArchive::BNYRead(void* buf, size_t nbyte) { size_t result; - ASSERT(buf != nil); + ASSERT(buf != NULL); ASSERT(nbyte > 0); - ASSERT(fFp != nil); + ASSERT(fFp != NULL); errno = 0; result = fread(buf, 1, nbyte, fFp); @@ -650,7 +650,7 @@ BnyArchive::BNYRead(void* buf, size_t nbyte) NuError BnyArchive::BNYSeek(long offset) { - ASSERT(fFp != nil); + ASSERT(fFp != NULL); ASSERT(offset > 0); /*DBUG(("--- seeking forward %ld bytes\n", offset));*/ @@ -694,7 +694,7 @@ BnyArchive::BNYDecodeHeader(BnyFileEntry* pEntry) uchar* raw; int len; - ASSERT(pEntry != nil); + ASSERT(pEntry != NULL); raw = pEntry->blockBuf; @@ -788,9 +788,9 @@ BNYNormalizePath(BnyFileEntry* pEntry) pathProposal.pRecord = &fakeRecord; pathProposal.pThread = &fakeThread; - pathProposal.newPathname = nil; + pathProposal.newPathname = NULL; pathProposal.newFilenameSeparator = '\0'; - pathProposal.newDataSink = nil; + pathProposal.newDataSink = NULL; /* need the filetype and auxtype for -e/-ee */ fakeRecord.recFileType = pEntry->fileType; @@ -827,7 +827,7 @@ BnyArchive::BNYCopyBlocks(BnyFileEntry* pEntry, FILE* outfp) if (toWrite > kBNYBlockSize) toWrite = kBNYBlockSize; - if (outfp != nil) { + if (outfp != NULL) { if (fwrite(pEntry->blockBuf, toWrite, 1, outfp) != 1) { err = errno ? (NuError) errno : kNuErrFileWrite; WMSG0("BNY write failed\n"); @@ -955,18 +955,18 @@ BnyArchive::TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) CString errMsg; bool retVal = false; - ASSERT(fFp != nil); + ASSERT(fFp != NULL); WMSG1("Testing %d entries\n", pSelSet->GetNumEntries()); SelectionEntry* pSelEntry = pSelSet->IterNext(); - while (pSelEntry != nil) { + while (pSelEntry != NULL) { pEntry = (BnyEntry*) pSelEntry->GetEntry(); WMSG2(" Testing '%ls' (offset=%ld)\n", pEntry->GetDisplayName(), pEntry->GetOffset()); - SET_PROGRESS_UPDATE2(0, pEntry->GetDisplayName(), nil); + SET_PROGRESS_UPDATE2(0, pEntry->GetDisplayName(), NULL); nerr = pEntry->TestEntry(pMsgWnd); if (nerr != kNuErrNone) { diff --git a/app/BNYArchive.h b/app/BNYArchive.h index fc101a3..8cc057e 100644 --- a/app/BNYArchive.h +++ b/app/BNYArchive.h @@ -66,7 +66,7 @@ private: */ class BnyArchive : public GenericArchive { public: - BnyArchive(void) : fIsReadOnly(false), fFp(nil) + BnyArchive(void) : fIsReadOnly(false), fFp(NULL) {} virtual ~BnyArchive(void) { (void) Close(); } @@ -128,9 +128,9 @@ public: private: virtual CString Close(void) { - if (fFp != nil) { + if (fFp != NULL) { fclose(fFp); - fFp = nil; + fFp = NULL; } return ""; } diff --git a/app/BasicImport.cpp b/app/BasicImport.cpp index c9c8d3b..e240c46 100644 --- a/app/BasicImport.cpp +++ b/app/BasicImport.cpp @@ -30,7 +30,7 @@ BASTokenLookup::Init(const char* tokenList, int numTokens, { int i; - ASSERT(tokenList != nil); + ASSERT(tokenList != NULL); ASSERT(numTokens > 0); ASSERT(tokenLen > 0); @@ -131,8 +131,8 @@ ImportBASDialog::ImportBAS(const WCHAR* fileName) FILE* fp = NULL; ExpandBuffer msgs(1024); long fileLen, outLen, count; - char* buf = nil; - char* outBuf = nil; + char* buf = NULL; + char* outBuf = NULL; bool result = false; msgs.Printf("Importing from '%ls'...", fileName); @@ -187,7 +187,7 @@ bail: /* copy our error messages out */ CEdit* pEdit = (CEdit*) GetDlgItem(IDC_IMPORT_BAS_RESULTS); - char* msgBuf = nil; + char* msgBuf = NULL; long msgLen; msgs.SeizeBuffer(&msgBuf, &msgLen); CString msgStr(msgBuf); @@ -599,7 +599,7 @@ ImportBASDialog::FindEOL(const char* buf, long max) { ASSERT(max >= 0); if (max == 0) - return nil; + return NULL; while (max) { if (*buf == '\r' || *buf == '\n') { @@ -639,7 +639,7 @@ ImportBASDialog::GetNextNWC(const char** pBuf, int* pLen, char* pCh) (*pBuf)++; (*pLen)--; - if (ptr == nil) { + if (ptr == NULL) { *pCh = ch; return true; } @@ -678,7 +678,7 @@ void ImportBASDialog::OnOK(void) details.fileType = kFileTypeBAS; details.extraType = 0x0801; details.storageType = DiskFS::kStorageSeedling; - time_t now = time(nil); + time_t now = time(NULL); GenericArchive::UNIXTimeToDateTime(&now, &details.createWhen); GenericArchive::UNIXTimeToDateTime(&now, &details.archiveWhen); GenericArchive::UNIXTimeToDateTime(&now, &details.modWhen); @@ -687,7 +687,7 @@ void ImportBASDialog::OnOK(void) fDirty = true; if (!MainWindow::SaveToArchive(&details, (const unsigned char*) fOutput, - fOutputLen, nil, -1, /*ref*/errMsg, this)) + fOutputLen, NULL, -1, /*ref*/errMsg, this)) { goto bail; } diff --git a/app/BasicImport.h b/app/BasicImport.h index 6d4e6bd..ab5eb0d 100644 --- a/app/BasicImport.h +++ b/app/BasicImport.h @@ -24,7 +24,7 @@ class BASTokenLookup { public: BASTokenLookup(void) - : fTokenPtr(nil), fTokenLen(nil) + : fTokenPtr(NULL), fTokenLen(NULL) {} ~BASTokenLookup(void) { delete[] fTokenPtr; @@ -58,7 +58,7 @@ class ImportBASDialog : public CDialog { public: ImportBASDialog(CWnd* pParentWnd = NULL) : CDialog(IDD_IMPORT_BAS, pParentWnd), fDirty(false), - fOutput(nil), fOutputLen(-1) + fOutput(NULL), fOutputLen(-1) {} virtual ~ImportBASDialog(void) { delete[] fOutput; diff --git a/app/CassImpTargetDialog.cpp b/app/CassImpTargetDialog.cpp index 40a4000..8ed756c 100644 --- a/app/CassImpTargetDialog.cpp +++ b/app/CassImpTargetDialog.cpp @@ -129,7 +129,7 @@ long CassImpTargetDialog::GetStartAddr(void) const { CWnd* pWnd = GetDlgItem(IDC_CASSIMPTARG_BINADDR); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); CString aux; pWnd->GetWindowText(aux); diff --git a/app/CassetteDialog.cpp b/app/CassetteDialog.cpp index 6708173..1362370 100644 --- a/app/CassetteDialog.cpp +++ b/app/CassetteDialog.cpp @@ -288,7 +288,7 @@ CassetteDialog::OnInitDialog(void) /* prep the combo box */ CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_CASSETTE_ALG); - ASSERT(pCombo != nil); + ASSERT(pCombo != NULL); int defaultAlg = pPreferences->GetPrefLong(kPrCassetteAlgorithm); if (defaultAlg > CassetteData::kAlgorithmMIN && defaultAlg < CassetteData::kAlgorithmMAX) @@ -307,7 +307,7 @@ CassetteDialog::OnInitDialog(void) * [icon] Index | Format | Length | Checksum OK */ CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_CASSETTE_LIST); - ASSERT(pListView != nil); + ASSERT(pListView != NULL); ListView_SetExtendedListViewStyleEx(pListView->m_hWnd, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT); @@ -397,7 +397,7 @@ void CassetteDialog::OnAlgorithmChange(void) { CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_CASSETTE_ALG); - ASSERT(pCombo != nil); + ASSERT(pCombo != NULL); WMSG1("+++ SELECTION IS NOW %d\n", pCombo->GetCurSel()); fAlgorithm = (CassetteData::Algorithm) pCombo->GetCurSel(); AnalyzeWAV(); @@ -423,12 +423,12 @@ CassetteDialog::OnImport(void) * Figure out which item they have selected. */ CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_CASSETTE_LIST); - ASSERT(pListView != nil); + ASSERT(pListView != NULL); assert(pListView->GetSelectedCount() == 1); POSITION posn; posn = pListView->GetFirstSelectedItemPosition(); - if (posn == nil) { + if (posn == NULL) { ASSERT(false); return; } @@ -463,7 +463,7 @@ CassetteDialog::OnImport(void) else details.extraType = 0x0000; details.storageType = DiskFS::kStorageSeedling; - time_t now = time(nil); + time_t now = time(NULL); GenericArchive::UNIXTimeToDateTime(&now, &details.createWhen); GenericArchive::UNIXTimeToDateTime(&now, &details.archiveWhen); @@ -471,7 +471,7 @@ CassetteDialog::OnImport(void) fDirty = true; 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; } @@ -558,7 +558,7 @@ CassetteDialog::AddEntry(int idx, CListCtrl* pListCtrl, long* pFileType) const CassetteData* pData = &fDataArray[idx]; const unsigned char* pDataBuf = pData->GetDataBuf(); - ASSERT(pDataBuf != nil); + ASSERT(pDataBuf != NULL); tmpStr.Format(L"%d", idx); pListCtrl->InsertItem(idx, tmpStr); @@ -621,8 +621,8 @@ CassetteDialog::CassetteData::Scan(SoundFile* pSoundFile, Algorithm alg, ScanState scanState; long initialLen, dataLen, chunkLen, byteOffset; long sampleStartIndex; - unsigned char* buf = nil; - float* sampleBuf = nil; + unsigned char* buf = NULL; + float* sampleBuf = NULL; int bytesPerSample; bool result = false; unsigned char checkSum; @@ -641,9 +641,9 @@ CassetteDialog::CassetteData::Scan(SoundFile* pSoundFile, Algorithm alg, buf = new unsigned char[kSampleChunkSize]; sampleBuf = new float[kSampleChunkSize/bytesPerSample]; - if (fOutputBuf == nil) // alloc on first use + if (fOutputBuf == NULL) // alloc on first use fOutputBuf = new unsigned char[kMaxFileLen]; - if (buf == nil || sampleBuf == nil || fOutputBuf == nil) { + if (buf == NULL || sampleBuf == NULL || fOutputBuf == NULL) { WMSG0("Buffer alloc failed\n"); goto bail; } diff --git a/app/CassetteDialog.h b/app/CassetteDialog.h index 9656e37..7e446c3 100644 --- a/app/CassetteDialog.h +++ b/app/CassetteDialog.h @@ -43,7 +43,7 @@ private: */ class CassetteData { public: - CassetteData(void) : fFileType(0x00), fOutputBuf(nil), fOutputLen(-1), + CassetteData(void) : fFileType(0x00), fOutputBuf(NULL), fOutputLen(-1), fStartSample(-1), fEndSample(-1), fChecksum(0x00), fChecksumGood(false) {} diff --git a/app/ChooseAddTargetDialog.cpp b/app/ChooseAddTargetDialog.cpp index 30aff02..83f6f5c 100644 --- a/app/ChooseAddTargetDialog.cpp +++ b/app/ChooseAddTargetDialog.cpp @@ -28,8 +28,8 @@ ChooseAddTargetDialog::OnInitDialog(void) CTreeCtrl* pTree = (CTreeCtrl*) GetDlgItem(IDC_ADD_TARGET_TREE); - ASSERT(fpDiskFS != nil); - ASSERT(pTree != nil); + ASSERT(fpDiskFS != NULL); + ASSERT(pTree != NULL); fDiskFSTree.fIncludeSubdirs = true; fDiskFSTree.fExpandDepth = -1; @@ -44,7 +44,7 @@ ChooseAddTargetDialog::OnInitDialog(void) WMSG0(" Skipping out of target selection\n"); // adding to root volume of the sole DiskFS fpChosenDiskFS = fpDiskFS; - ASSERT(fpChosenSubdir == nil); + ASSERT(fpChosenSubdir == NULL); OnOK(); } @@ -65,12 +65,12 @@ ChooseAddTargetDialog::DoDataExchange(CDataExchange* pDX) appName.LoadString(IDS_MB_APP_NAME); /* shortcut for simple disk images */ - if (pTree->GetCount() == 1 && fpChosenDiskFS != nil) + if (pTree->GetCount() == 1 && fpChosenDiskFS != NULL) return; HTREEITEM selected; selected = pTree->GetSelectedItem(); - if (selected == nil) { + if (selected == NULL) { errMsg = "Please select a disk or subdirectory to add files to."; MessageBox(errMsg, appName, MB_OK); pDX->Fail(); diff --git a/app/ChooseAddTargetDialog.h b/app/ChooseAddTargetDialog.h index c236e47..6348695 100644 --- a/app/ChooseAddTargetDialog.h +++ b/app/ChooseAddTargetDialog.h @@ -22,15 +22,15 @@ public: ChooseAddTargetDialog(CWnd* pParentWnd = NULL) : CDialog(IDD_CHOOSE_ADD_TARGET, pParentWnd) { - fpDiskFS = fpChosenDiskFS = nil; - fpChosenSubdir = nil; + fpDiskFS = fpChosenDiskFS = NULL; + fpChosenSubdir = NULL; } virtual ~ChooseAddTargetDialog(void) {} /* set this before calling DoModal */ 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::A2File* fpChosenSubdir; diff --git a/app/ChooseDirDialog.cpp b/app/ChooseDirDialog.cpp index 4635700..78847ac 100644 --- a/app/ChooseDirDialog.cpp +++ b/app/ChooseDirDialog.cpp @@ -112,7 +112,7 @@ ChooseDirDialog::OnSelChanged(NMHDR* pnmh, LRESULT* pResult) { CString path; CWnd* pWnd = GetDlgItem(IDC_CHOOSEDIR_PATH); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); if (fShellTree.GetFolderPath(&path)) fPathName = path; @@ -122,7 +122,7 @@ ChooseDirDialog::OnSelChanged(NMHDR* pnmh, LRESULT* pResult) // disable the "Select" button when there's no path ready pWnd = GetDlgItem(IDOK); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->EnableWindow(!fPathName.IsEmpty()); // It's confusing to have two different paths showing, so wipe out the @@ -144,7 +144,7 @@ ChooseDirDialog::OnExpandTree(void) CString msg; pWnd = GetDlgItem(IDC_CHOOSEDIR_PATHEDIT); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->GetWindowText(str); if (!str.IsEmpty()) { diff --git a/app/Clipboard.cpp b/app/Clipboard.cpp index 1b33235..de2708c 100644 --- a/app/Clipboard.cpp +++ b/app/Clipboard.cpp @@ -106,7 +106,7 @@ MainWindow::OnEditCopy(void) bool isOpen = false; HGLOBAL hGlobal; LPVOID pGlobal; - unsigned char* buf = nil; + unsigned char* buf = NULL; long bufLen = -1; /* associate a number with the format name */ @@ -153,7 +153,7 @@ MainWindow::OnEditCopy(void) */ size_t neededLen = (fileList.GetLength() + 1) * sizeof(WCHAR); hGlobal = ::GlobalAlloc(GHND | GMEM_SHARE, neededLen); - if (hGlobal == nil) { + if (hGlobal == NULL) { WMSG1("Failed allocating %d bytes\n", neededLen); errStr.LoadString(IDS_CLIPBOARD_ALLOCFAILED); ShowFailureMsg(this, errStr, IDS_FAILED); @@ -161,7 +161,7 @@ MainWindow::OnEditCopy(void) } WMSG1(" Allocated %ld bytes for file list on clipboard\n", neededLen); pGlobal = ::GlobalLock(hGlobal); - ASSERT(pGlobal != nil); + ASSERT(pGlobal != NULL); wcscpy((WCHAR*) pGlobal, fileList); ::GlobalUnlock(hGlobal); @@ -172,7 +172,7 @@ MainWindow::OnEditCopy(void) * files in it. This may fail for any number of reasons. */ hGlobal = CreateFileCollection(&selSet); - if (hGlobal != nil) { + if (hGlobal != NULL) { SetClipboardData(myFormat, hGlobal); // beep annoys me on copy //SuccessBeep(); @@ -184,7 +184,7 @@ bail: void MainWindow::OnUpdateEditCopy(CCmdUI* pCmdUI) { - pCmdUI->Enable(fpContentList != nil && + pCmdUI->Enable(fpContentList != NULL && fpContentList->GetSelectedCount() > 0); } @@ -206,9 +206,9 @@ MainWindow::CreateFileList(SelectionSet* pSelSet) CString fileName, subVol, fileType, auxType, modDate, format, length; pSelEntry = pSelSet->IterNext(); - while (pSelEntry != nil) { + while (pSelEntry != NULL) { pEntry = pSelEntry->GetEntry(); - ASSERT(pEntry != nil); + ASSERT(pEntry != NULL); fileName = DblDblQuote(pEntry->GetPathName()); subVol = pEntry->GetSubVolName(); @@ -269,7 +269,7 @@ MainWindow::GetClipboardContentLen(void) while ((format = EnumClipboardFormats(format)) != 0) { hGlobal = GetClipboardData(format); - ASSERT(hGlobal != nil); + ASSERT(hGlobal != NULL); len += GlobalSize(hGlobal); } @@ -284,8 +284,8 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet) { SelectionEntry* pSelEntry; GenericEntry* pEntry; - HGLOBAL hGlobal = nil; - HGLOBAL hResult = nil; + HGLOBAL hGlobal = NULL; + HGLOBAL hResult = NULL; LPVOID pGlobal; size_t totalLength, numFiles; long priorLength; @@ -303,9 +303,9 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet) */ pSelSet->IterReset(); pSelEntry = pSelSet->IterNext(); - while (pSelEntry != nil) { + while (pSelEntry != NULL) { pEntry = pSelEntry->GetEntry(); - ASSERT(pEntry != nil); + ASSERT(pEntry != NULL); //WMSG1("+++ Examining '%s'\n", pEntry->GetDisplayName()); @@ -322,7 +322,7 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet) if (totalLength < 0) { DebugBreak(); WMSG0("Overflow\n"); // pretty hard to do right now! - return nil; + return NULL; } pSelEntry = pSelSet->IterNext(); @@ -333,7 +333,7 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet) CString msg; msg.Format("totalLength is %ld+%ld = %ld", totalLength, priorLength, totalLength+priorLength); - if (MessageBox(msg, nil, MB_OKCANCEL) == IDCANCEL) + if (MessageBox(msg, NULL, MB_OKCANCEL) == IDCANCEL) goto bail; } #endif @@ -353,7 +353,7 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet) * Create a big buffer to hold it all. */ hGlobal = ::GlobalAlloc(GHND | GMEM_SHARE, totalLength); - if (hGlobal == nil) { + if (hGlobal == NULL) { CString errMsg; errMsg.Format(L"ERROR: unable to allocate %ld bytes for copy", totalLength); @@ -363,7 +363,7 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet) } pGlobal = ::GlobalLock(hGlobal); - ASSERT(pGlobal != nil); + ASSERT(pGlobal != NULL); ASSERT(GlobalSize(hGlobal) >= (DWORD) totalLength); WMSG3("hGlobal=0x%08lx pGlobal=0x%08lx size=%ld\n", (long) hGlobal, (long) pGlobal, GlobalSize(hGlobal)); @@ -371,7 +371,7 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet) /* * Set up a progress dialog to track it. */ - ASSERT(fpActionProgress == nil); + ASSERT(fpActionProgress == NULL); fpActionProgress = new ActionProgressDialog; fpActionProgress->Create(ActionProgressDialog::kActionExtract, this); fpActionProgress->SetFileName(L"Clipboard"); @@ -386,11 +386,11 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet) buf = (unsigned char*) pGlobal + sizeof(FileCollection); pSelSet->IterReset(); pSelEntry = pSelSet->IterNext(); - while (pSelEntry != nil) { + while (pSelEntry != NULL) { CString errStr; pEntry = pSelEntry->GetEntry(); - ASSERT(pEntry != nil); + ASSERT(pEntry != NULL); CString displayName(pEntry->GetDisplayName()); fpActionProgress->SetArcName(displayName); @@ -424,17 +424,17 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet) ::GlobalUnlock(hGlobal); hResult = hGlobal; - hGlobal = nil; + hGlobal = NULL; bail: - if (hGlobal != nil) { - ASSERT(hResult == nil); + if (hGlobal != NULL) { + ASSERT(hResult == NULL); ::GlobalUnlock(hGlobal); ::GlobalFree(hGlobal); } - if (fpActionProgress != nil) { + if (fpActionProgress != NULL) { fpActionProgress->Cleanup(this); - fpActionProgress = nil; + fpActionProgress = NULL; } return hResult; } @@ -634,7 +634,7 @@ MainWindow::OnUpdateEditPaste(CCmdUI* pCmdUI) if (myFormat != 0 && IsClipboardFormatAvailable(myFormat)) dataAvailable = true; - pCmdUI->Enable(fpContentList != nil && !fpOpenArchive->IsReadOnly() && + pCmdUI->Enable(fpContentList != NULL && !fpOpenArchive->IsReadOnly() && dataAvailable); } @@ -688,7 +688,7 @@ MainWindow::DoPaste(bool pasteJunkPaths) UINT myFormat; bool isOpen = false; - if (fpContentList == nil || fpOpenArchive->IsReadOnly()) { + if (fpContentList == NULL || fpOpenArchive->IsReadOnly()) { ASSERT(false); return; } @@ -738,12 +738,12 @@ MainWindow::DoPaste(bool pasteJunkPaths) LPVOID pGlobal; hGlobal = GetClipboardData(myFormat); - if (hGlobal == nil) { + if (hGlobal == NULL) { ASSERT(false); goto bail; } pGlobal = GlobalLock(hGlobal); - ASSERT(pGlobal != nil); + ASSERT(pGlobal != NULL); errStr = ProcessClipboard(pGlobal, GlobalSize(hGlobal), pasteJunkPaths); fpContentList->Reload(); @@ -770,7 +770,7 @@ MainWindow::ProcessClipboard(const void* vbuf, long bufLen, bool pasteJunkPaths) FileCollection fileColl; CString errMsg, storagePrefix; const unsigned char* buf = (const unsigned char*) vbuf; - DiskImgLib::A2File* pTargetSubdir = nil; + DiskImgLib::A2File* pTargetSubdir = NULL; XferFileOptions xferOpts; bool xferPrepped = false; @@ -828,7 +828,7 @@ MainWindow::ProcessClipboard(const void* vbuf, long bufLen, bool pasteJunkPaths) fpOpenArchive->XferPrepare(&xferOpts); xferPrepped = true; - if (pTargetSubdir != nil) { + if (pTargetSubdir != NULL) { storagePrefix = pTargetSubdir->GetPathName(); 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. */ - ASSERT(fpActionProgress == nil); + ASSERT(fpActionProgress == NULL); fpActionProgress = new ActionProgressDialog; fpActionProgress->Create(ActionProgressDialog::kActionAdd, this); fpActionProgress->SetArcName(L"Clipboard data"); @@ -945,9 +945,9 @@ bail: else fpOpenArchive->XferAbort(this); } - if (fpActionProgress != nil) { + if (fpActionProgress != NULL) { fpActionProgress->Cleanup(this); - fpActionProgress = nil; + fpActionProgress = NULL; } return errMsg; } @@ -966,8 +966,8 @@ MainWindow::ProcessClipboardEntry(const FileCollectionEntry* pCollEnt, { GenericArchive::FileDetails::FileKind entryKind; GenericArchive::FileDetails details; - unsigned char* dataBuf = nil; - unsigned char* rsrcBuf = nil; + unsigned char* dataBuf = NULL; + unsigned char* rsrcBuf = NULL; long dataLen, rsrcLen, cmmtLen; CString errMsg; @@ -986,7 +986,7 @@ MainWindow::ProcessClipboardEntry(const FileCollectionEntry* pCollEnt, &details.createWhen); GenericArchive::UNIXTimeToDateTime(&pCollEnt->modWhen, &details.modWhen); - time_t now = time(nil); + time_t now = time(NULL); GenericArchive::UNIXTimeToDateTime(&now, &details.archiveWhen); /* @@ -1036,14 +1036,14 @@ MainWindow::ProcessClipboardEntry(const FileCollectionEntry* pCollEnt, } else { dataLen = pCollEnt->dataLen; dataBuf = new unsigned char[dataLen]; - if (dataBuf == nil) + if (dataBuf == NULL) return "memory allocation failed."; memcpy(dataBuf, buf, dataLen); buf += dataLen; remLen -= dataLen; } } else { - ASSERT(dataBuf == nil); + ASSERT(dataBuf == NULL); dataLen = -1; } @@ -1054,14 +1054,14 @@ MainWindow::ProcessClipboardEntry(const FileCollectionEntry* pCollEnt, } else { rsrcLen = pCollEnt->rsrcLen; rsrcBuf = new unsigned char[rsrcLen]; - if (rsrcBuf == nil) + if (rsrcBuf == NULL) return "Memory allocation failed."; memcpy(rsrcBuf, buf, rsrcLen); buf += rsrcLen; remLen -= rsrcLen; } } else { - ASSERT(rsrcBuf == nil); + ASSERT(rsrcBuf == NULL); rsrcLen = -1; } @@ -1076,7 +1076,7 @@ MainWindow::ProcessClipboardEntry(const FileCollectionEntry* pCollEnt, &rsrcBuf, rsrcLen); delete[] dataBuf; delete[] rsrcBuf; - dataBuf = rsrcBuf = nil; + dataBuf = rsrcBuf = NULL; return errMsg; } diff --git a/app/ConfirmOverwriteDialog.cpp b/app/ConfirmOverwriteDialog.cpp index c3e885d..fc66349 100644 --- a/app/ConfirmOverwriteDialog.cpp +++ b/app/ConfirmOverwriteDialog.cpp @@ -31,7 +31,7 @@ RenameOverwriteDialog::OnInitDialog(void) CWnd* pWnd; pWnd = GetDlgItem(IDC_RENOVWR_SOURCE_NAME); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->SetWindowText(fNewFileSource); return CDialog::OnInitDialog(); @@ -92,27 +92,27 @@ ConfirmOverwriteDialog::OnInitDialog(void) CString tmpStr, dateStr; pWnd = GetDlgItem(IDC_OVWR_EXIST_NAME); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->SetWindowText(fExistingFile); pWnd = GetDlgItem(IDC_OVWR_EXIST_INFO); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); FormatDate(fExistingFileModWhen, &dateStr); tmpStr.Format(L"Modified %ls", dateStr); pWnd->SetWindowText(tmpStr); pWnd = GetDlgItem(IDC_OVWR_NEW_NAME); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->SetWindowText(fNewFileSource); pWnd = GetDlgItem(IDC_OVWR_NEW_INFO); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); FormatDate(fNewFileModWhen, &dateStr); tmpStr.Format(L"Modified %ls", dateStr); pWnd->SetWindowText(tmpStr); pWnd = GetDlgItem(IDC_OVWR_RENAME); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->EnableWindow(fAllowRename); return CDialog::OnInitDialog(); diff --git a/app/ConfirmOverwriteDialog.h b/app/ConfirmOverwriteDialog.h index 7f4284b..4b434b4 100644 --- a/app/ConfirmOverwriteDialog.h +++ b/app/ConfirmOverwriteDialog.h @@ -16,7 +16,7 @@ */ class ConfirmOverwriteDialog : public CDialog { public: - ConfirmOverwriteDialog(CWnd* pParentWnd = nil) : + ConfirmOverwriteDialog(CWnd* pParentWnd = NULL) : CDialog(IDD_CONFIRM_OVERWRITE, pParentWnd) { fResultOverwrite = false; @@ -67,7 +67,7 @@ private: */ class RenameOverwriteDialog : public CDialog { public: - RenameOverwriteDialog(CWnd* pParentWnd = nil) : + RenameOverwriteDialog(CWnd* pParentWnd = NULL) : CDialog(IDD_RENAME_OVERWRITE, pParentWnd) {} ~RenameOverwriteDialog(void) {} diff --git a/app/ContentList.cpp b/app/ContentList.cpp index be10092..3f91a3c 100644 --- a/app/ContentList.cpp +++ b/app/ContentList.cpp @@ -103,7 +103,7 @@ ContentList::OnCreate(LPCREATESTRUCT lpcs) /* add our up/down arrow bitmaps */ LoadHeaderImages(); CHeaderCtrl* pHeader = GetHeaderCtrl(); - if (pHeader == nil) + if (pHeader == NULL) WMSG0("GLITCH: couldn't get header ctrl\n"); ASSERT(pHeader != NULL); pHeader->SetImageList(&fHdrImageList); @@ -244,7 +244,7 @@ ContentList::Reload(bool saveSelection) // fInvalid = false; fpArchive->ClearReloadFlag(); - long* savedSel = nil; + long* savedSel = NULL; long selCount = 0; if (saveSelection) { @@ -260,7 +260,7 @@ ContentList::Reload(bool saveSelection) LoadData(); NewSortOrder(); - if (savedSel != nil) { + if (savedSel != NULL) { /* restore the selection */ RestoreSelection(savedSel, selCount); delete[] savedSel; @@ -280,7 +280,7 @@ ContentList::Reload(bool saveSelection) long* ContentList::GetSelectionSerials(long* pSelCount) { - long* savedSel = nil; + long* savedSel = NULL; long maxCount; maxCount = GetSelectedCount(); @@ -292,10 +292,10 @@ ContentList::GetSelectionSerials(long* pSelCount) POSITION posn; posn = GetFirstSelectedItemPosition(); - ASSERT(posn != nil); - if (posn == nil) - return nil; - while (posn != nil) { + ASSERT(posn != NULL); + if (posn == NULL) + return NULL; + while (posn != NULL) { int num = GetNextSelectedItem(posn); GenericEntry* pEntry = (GenericEntry*) GetItemData(num); @@ -320,7 +320,7 @@ void ContentList::RestoreSelection(const long* savedSel, long selCount) { WMSG1("RestoreSelection (selCount=%d)\n", selCount); - if (savedSel == nil) + if (savedSel == NULL) return; int i, j; @@ -574,7 +574,7 @@ ContentList::OnGetDispInfo(NMHDR* pnmh, LRESULT* pResult) } break; case 4: // format - ASSERT(pEntry->GetFormatStr() != nil); + ASSERT(pEntry->GetFormatStr() != NULL); wcscpy(plvdi->item.pszText, pEntry->GetFormatStr()); break; case 5: // size @@ -739,7 +739,7 @@ ContentList::LoadData(void) DeleteAllItems(); // for Reload case pEntry = fpArchive->GetEntries(); - while (pEntry != nil) { + while (pEntry != NULL) { pEntry->SetIndex(idx); lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; @@ -968,12 +968,12 @@ ContentList::SelectSubdirContents(void) { POSITION posn; posn = GetFirstSelectedItemPosition(); - if (posn == nil) { + if (posn == NULL) { WMSG0("SelectSubdirContents: nothing is selected\n"); return; } /* mark all selected items with LVIS_CUT */ - while (posn != nil) { + while (posn != NULL) { int num = GetNextSelectedItem(/*ref*/ posn); SetItemState(num, LVIS_CUT, LVIS_CUT); } @@ -1002,7 +1002,7 @@ ContentList::SelectSubdirContents(void) /* clear the LVIS_CUT flags */ posn = GetFirstSelectedItemPosition(); - while (posn != nil) { + while (posn != NULL) { int num = GetNextSelectedItem(/*ref*/ posn); SetItemState(num, 0, LVIS_CUT); } @@ -1109,7 +1109,7 @@ ContentList::CompareFindString(int num, const WCHAR* str, bool matchCase, { GenericEntry* pEntry = (GenericEntry*) GetItemData(num); 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) pSubCompare = wcsstr; @@ -1127,7 +1127,7 @@ ContentList::CompareFindString(int num, const WCHAR* str, bool matchCase, match = (*pSubCompare)(start, str); - if (match == nil) + if (match == NULL) break; if ((match == src || *(match-1) == fssep) && (match[strLen] == '\0' || match[strLen] == fssep)) @@ -1138,7 +1138,7 @@ ContentList::CompareFindString(int num, const WCHAR* str, bool matchCase, start++; } } else { - if ((*pSubCompare)(pEntry->GetDisplayName(), str) != nil) + if ((*pSubCompare)(pEntry->GetDisplayName(), str) != NULL) return true; } diff --git a/app/ContentList.h b/app/ContentList.h index 17c9f7e..194aa32 100644 --- a/app/ContentList.h +++ b/app/ContentList.h @@ -35,8 +35,8 @@ class ContentList: public CListCtrl { public: ContentList(GenericArchive* pArchive, ColumnLayout* pLayout) { - ASSERT(pArchive != nil); - ASSERT(pLayout != nil); + ASSERT(pArchive != NULL); + ASSERT(pLayout != NULL); fpArchive = pArchive; fpLayout = pLayout; // fInvalid = false; diff --git a/app/ConvDiskOptionsDialog.cpp b/app/ConvDiskOptionsDialog.cpp index 2b840cd..5f9c036 100644 --- a/app/ConvDiskOptionsDialog.cpp +++ b/app/ConvDiskOptionsDialog.cpp @@ -37,13 +37,13 @@ BOOL ConvDiskOptionsDialog::OnInitDialog(void) { CEdit* pEdit = (CEdit*) GetDlgItem(IDC_CONVDISK_VOLNAME); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); pEdit->SetLimitText(kProDOSVolNameMax); ResetSizeControls(); pEdit = (CEdit*) GetDlgItem(IDC_CONVDISK_SPECIFY_EDIT); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); pEdit->SetLimitText(5); // enough for "65535" pEdit->EnableWindow(FALSE); @@ -141,14 +141,14 @@ ConvDiskOptionsDialog::ResetSizeControls(void) WMSG0("Resetting size controls\n"); spaceReq.Format(IDS_CONVDISK_SPACEREQ, "(unknown)"); pWnd = GetDlgItem(IDC_CONVDISK_SPACEREQ); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->SetWindowText(spaceReq); #if 0 int i; for (i = 0; i < NELEM(gDiskSizes); i++) { pWnd = GetDlgItem(gDiskSizes[i].ctrlID); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->EnableWindow(TRUE); } #endif @@ -177,7 +177,7 @@ ConvDiskOptionsDialog::LimitSizeControls(long totalBlocks, long blocksUsed) spaceReq.Format(IDS_CONVDISK_SPACEREQ, sizeStr); pWnd = GetDlgItem(IDC_CONVDISK_SPACEREQ); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->SetWindowText(spaceReq); NewDiskSize::EnableButtons_ProDOS(this, totalBlocks, blocksUsed); @@ -190,7 +190,7 @@ ConvDiskOptionsDialog::LimitSizeControls(long totalBlocks, long blocksUsed) CButton* pButton; pButton = (CButton*) GetDlgItem(gDiskSizes[i].ctrlID); - ASSERT(pButton != nil); + ASSERT(pButton != NULL); if (usedWithoutBitmap + GetNumBitmapBlocks(gDiskSizes[i].blocks) <= gDiskSizes[i].blocks) { @@ -303,7 +303,7 @@ ConvDiskOptionsDialog::OnCompute(void) result = pMain->GetOpenArchive()->XferSelection(pActionProgress, &selSet, pActionProgress, &xferOpts); pActionProgress->Cleanup(this); - pMain->SetActionProgressDialog(nil); + pMain->SetActionProgressDialog(NULL); if (result == GenericArchive::kXferOK) { DiskFS* pDiskFS; @@ -314,7 +314,7 @@ ConvDiskOptionsDialog::OnCompute(void) WMSG0("SUCCESS\n"); pDiskFS = ((DiskArchive*) xferOpts.fTarget)->GetDiskFS(); - ASSERT(pDiskFS != nil); + ASSERT(pDiskFS != NULL); dierr = pDiskFS->GetFreeSpaceCount(&totalBlocks, &freeBlocks, &unitSize); diff --git a/app/CreateImageDialog.cpp b/app/CreateImageDialog.cpp index 5aa9603..e56cb9f 100644 --- a/app/CreateImageDialog.cpp +++ b/app/CreateImageDialog.cpp @@ -41,23 +41,23 @@ CreateImageDialog::OnInitDialog(void) } CEdit* pEdit = (CEdit*) GetDlgItem(IDC_CREATEFSPRODOS_VOLNAME); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); pEdit->SetLimitText(kProDOSVolNameMax); pEdit = (CEdit*) GetDlgItem(IDC_CREATEFSPASCAL_VOLNAME); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); pEdit->SetLimitText(kPascalVolNameMax); pEdit = (CEdit*) GetDlgItem(IDC_CREATEFSHFS_VOLNAME); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); pEdit->SetLimitText(kHFSVolNameMax); pEdit = (CEdit*) GetDlgItem(IDC_CREATEFSDOS_VOLNUM); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); pEdit->SetLimitText(3); // 3 digit volume number pEdit = (CEdit*) GetDlgItem(IDC_CONVDISK_SPECIFY_EDIT); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); pEdit->EnableWindow(FALSE); return CDialog::OnInitDialog(); @@ -234,7 +234,7 @@ CreateImageDialog::OnFormatChangeRange(UINT nID) for (i = 0; i < NELEM(kDetailControls); i++) { CWnd* pWnd = GetDlgItem(kDetailControls[i]); - if (pWnd != nil) + if (pWnd != NULL) pWnd->EnableWindow(FALSE); } @@ -242,8 +242,8 @@ CreateImageDialog::OnFormatChangeRange(UINT nID) for (i = 0; i < NELEM(kFormatTab); i++) { if (kFormatTab[i].buttonID == nID) { CWnd* pWnd = GetDlgItem(kFormatTab[i].ctrlID); - ASSERT(pWnd != nil); - if (pWnd != nil) + ASSERT(pWnd != NULL); + if (pWnd != NULL) pWnd->EnableWindow(TRUE); } } diff --git a/app/CreateSubdirDialog.cpp b/app/CreateSubdirDialog.cpp index 0a51d71..4bd93ef 100644 --- a/app/CreateSubdirDialog.cpp +++ b/app/CreateSubdirDialog.cpp @@ -27,7 +27,7 @@ CreateSubdirDialog::OnInitDialog(void) /* select the default text and set the focus */ CEdit* pEdit = (CEdit*) GetDlgItem(IDC_CREATESUBDIR_NEW); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); pEdit->SetSel(0, -1); pEdit->SetFocus(); diff --git a/app/CreateSubdirDialog.h b/app/CreateSubdirDialog.h index 0e2ba97..0914e52 100644 --- a/app/CreateSubdirDialog.h +++ b/app/CreateSubdirDialog.h @@ -20,8 +20,8 @@ public: CreateSubdirDialog(CWnd* pParentWnd = NULL) : CDialog(IDD_CREATE_SUBDIR, pParentWnd) { - fpArchive = nil; - fpParentEntry = nil; + fpArchive = NULL; + fpParentEntry = NULL; } virtual ~CreateSubdirDialog(void) {} diff --git a/app/DEFileDialog.cpp b/app/DEFileDialog.cpp index d013867..8e1b8d0 100644 --- a/app/DEFileDialog.cpp +++ b/app/DEFileDialog.cpp @@ -23,7 +23,7 @@ BOOL DEFileDialog::OnInitDialog(void) { CWnd* pWnd = GetDlgItem(IDOK); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->EnableWindow(FALSE); return CDialog::OnInitDialog(); @@ -47,14 +47,14 @@ void DEFileDialog::OnChange(void) { CEdit* pEdit = (CEdit*) GetDlgItem(IDC_DEFILE_FILENAME); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); CString str; pEdit->GetWindowText(str); //WMSG2("STR is '%ls' (%d)\n", str, str.GetLength()); CWnd* pWnd = GetDlgItem(IDOK); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->EnableWindow(!str.IsEmpty()); } diff --git a/app/DiskArchive.cpp b/app/DiskArchive.cpp index e83d4b2..71354f1 100644 --- a/app/DiskArchive.cpp +++ b/app/DiskArchive.cpp @@ -29,11 +29,11 @@ static const char* kEmptyFolderMarker = ".$$EmptyFolder"; /* * 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" * 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[]". * * 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 { DIError dierr; - A2FileDescr* pOpenFile = nil; - char* dataBuf = nil; + A2FileDescr* pOpenFile = NULL; + char* dataBuf = NULL; bool rsrcFork; bool needAlloc = true; int result = -1; - ASSERT(fpFile != nil); - ASSERT(pErrMsg != nil); + ASSERT(fpFile != NULL); + ASSERT(pErrMsg != NULL); *pErrMsg = ""; - if (*ppText != nil) + if (*ppText != NULL) needAlloc = false; if (GetDamaged()) { @@ -101,11 +101,11 @@ DiskEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength, } SET_PROGRESS_BEGIN(); - pOpenFile->SetProgressUpdater(DiskArchive::ProgressCallback, len, nil); + pOpenFile->SetProgressUpdater(DiskArchive::ProgressCallback, len, NULL); if (needAlloc) { dataBuf = new char[(int) len]; - if (dataBuf == nil) { + if (dataBuf == NULL) { pErrMsg->Format(L"ERROR: allocation of %ld bytes failed", len); goto bail; } @@ -135,7 +135,7 @@ DiskEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength, result = IDOK; bail: - if (pOpenFile != nil) + if (pOpenFile != NULL) pOpenFile->Close(); if (result == IDOK) { SET_PROGRESS_END(); @@ -144,7 +144,7 @@ bail: ASSERT(result == IDCANCEL || !pErrMsg->IsEmpty()); if (needAlloc) { delete[] dataBuf; - ASSERT(*ppText == nil); + ASSERT(*ppText == NULL); } } return result; @@ -162,12 +162,12 @@ int DiskEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv, ConvertHighASCII convHA, CString* pErrMsg) const { - A2FileDescr* pOpenFile = nil; + A2FileDescr* pOpenFile = NULL; bool rsrcFork; int result = -1; ASSERT(IDOK != -1 && IDCANCEL != -1); - ASSERT(fpFile != nil); + ASSERT(fpFile != NULL); if (which == kDataThread) rsrcFork = false; @@ -214,7 +214,7 @@ DiskEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv, result = IDOK; bail: - if (pOpenFile != nil) + if (pOpenFile != NULL) pOpenFile->Close(); return result; } @@ -246,7 +246,7 @@ DiskEntry::CopyData(A2FileDescr* pOpenFile, FILE* outfp, ConvertEOL conv, ASSERT(srcLen > 0); // empty files should've been caught earlier SET_PROGRESS_BEGIN(); - pOpenFile->SetProgressUpdater(DiskArchive::ProgressCallback, srcLen, nil); + pOpenFile->SetProgressUpdater(DiskArchive::ProgressCallback, srcLen, NULL); /* * Loop until all data copied. @@ -443,8 +443,8 @@ DiskArchive::AppCleanup(void) /*static*/ void DiskArchive::DebugMsgHandler(const char* file, int line, const char* msg) { - ASSERT(file != nil); - ASSERT(msg != nil); + ASSERT(file != NULL); + ASSERT(msg != NULL); LOG_BASE(DebugLog::LOG_INFO, file, line, " %hs", msg); } @@ -510,11 +510,11 @@ DiskArchive::Open(const WCHAR* filename, bool readOnly, CString* pErrMsg) OpenResult result = kResultUnknown; const Preferences* pPreferences = GET_PREFERENCES(); - ASSERT(fpPrimaryDiskFS == nil); - ASSERT(filename != nil); - //ASSERT(ext != nil); + ASSERT(fpPrimaryDiskFS == NULL); + ASSERT(filename != NULL); + //ASSERT(ext != NULL); - ASSERT(pPreferences != nil); + ASSERT(pPreferences != NULL); fIsReadOnly = readOnly; @@ -603,7 +603,7 @@ DiskArchive::Open(const WCHAR* filename, bool readOnly, CString* pErrMsg) /* create an appropriate DiskFS object */ fpPrimaryDiskFS = fDiskImg.OpenAppropriateDiskFS(); - if (fpPrimaryDiskFS == nil) { + if (fpPrimaryDiskFS == NULL) { /* unknown FS should've been caught above! */ ASSERT(false); result = kResultFailure; @@ -640,8 +640,8 @@ DiskArchive::Open(const WCHAR* filename, bool readOnly, CString* pErrMsg) dierr = fpPrimaryDiskFS->Initialize(&fDiskImg, DiskFS::kInitFull); - fDiskImg.SetScanProgressCallback(nil, nil); - pMain->SetProgressCounterDialog(nil); + fDiskImg.SetScanProgressCallback(NULL, NULL); + pMain->SetProgressCounterDialog(NULL); pProgress->DestroyWindow(); if (dierr != kDIErrNone) { @@ -673,8 +673,8 @@ DiskArchive::Open(const WCHAR* filename, bool readOnly, CString* pErrMsg) const DiskFS::SubVolume* pSubVol; fIsReadOnly = true; - pSubVol = fpPrimaryDiskFS->GetNextSubVolume(nil); - while (pSubVol != nil) { + pSubVol = fpPrimaryDiskFS->GetNextSubVolume(NULL); + while (pSubVol != NULL) { if (pSubVol->GetDiskFS()->GetReadWriteSupported()) { fIsReadOnly = false; break; @@ -708,7 +708,7 @@ bail: if (!errMsg.IsEmpty()) { assert(result == kResultFailure); delete fpPrimaryDiskFS; - fpPrimaryDiskFS = nil; + fpPrimaryDiskFS = NULL; } else { assert(result != kResultFailure); } @@ -735,8 +735,8 @@ DiskArchive::New(const WCHAR* fileName, const void* vOptions) DIError dierr; bool allowLowerCase; - ASSERT(fileName != nil); - ASSERT(pOptions != nil); + ASSERT(fileName != NULL); + ASSERT(pOptions != NULL); allowLowerCase = pPreferences->GetPrefBool(kPrProDOSAllowLower) != 0; @@ -817,22 +817,22 @@ DiskArchive::New(const WCHAR* fileName, const void* vOptions) */ fileNameA = fileName; if (numBlocks > 0) { - dierr = fDiskImg.CreateImage(fileNameA, nil, + dierr = fDiskImg.CreateImage(fileNameA, NULL, DiskImg::kOuterFormatNone, DiskImg::kFileFormatUnadorned, DiskImg::kPhysicalFormatSectors, - nil, + NULL, pOptions->base.sectorOrder, DiskImg::kFormatGenericProDOSOrd, // arg must be generic numBlocks, canSkipFormat); } else { ASSERT(numTracks > 0); - dierr = fDiskImg.CreateImage(fileNameA, nil, + dierr = fDiskImg.CreateImage(fileNameA, NULL, DiskImg::kOuterFormatNone, DiskImg::kFileFormatUnadorned, DiskImg::kPhysicalFormatSectors, - nil, + NULL, pOptions->base.sectorOrder, DiskImg::kFormatGenericProDOSOrd, // arg must be generic numTracks, numSectors, @@ -872,7 +872,7 @@ DiskArchive::New(const WCHAR* fileName, const void* vOptions) goto bail; } fpPrimaryDiskFS = fDiskImg.OpenAppropriateDiskFS(false); - if (fpPrimaryDiskFS == nil) { + if (fpPrimaryDiskFS == NULL) { retmsg = L"Unable to create DiskFS."; goto bail; } @@ -907,10 +907,10 @@ bail: CString DiskArchive::Close(void) { - if (fpPrimaryDiskFS != nil) { + if (fpPrimaryDiskFS != NULL) { WMSG0("DiskArchive shutdown closing disk image\n"); delete fpPrimaryDiskFS; - fpPrimaryDiskFS = nil; + fpPrimaryDiskFS = NULL; } DIError dierr; @@ -945,7 +945,7 @@ DiskArchive::Flush(void) DIError dierr; CWaitCursor waitc; - assert(fpPrimaryDiskFS != nil); + assert(fpPrimaryDiskFS != NULL); dierr = fpPrimaryDiskFS->Flush(DiskImg::kFlushAll); if (dierr != kDIErrNone) { @@ -965,7 +965,7 @@ DiskArchive::Flush(void) bool DiskArchive::IsModified(void) const { - assert(fpPrimaryDiskFS != nil); + assert(fpPrimaryDiskFS != NULL); return fpPrimaryDiskFS->GetDiskImg()->GetDirtyFlag(); } @@ -977,10 +977,10 @@ DiskArchive::IsModified(void) const void DiskArchive::GetDescription(CString* pStr) const { - if (fpPrimaryDiskFS == nil) + if (fpPrimaryDiskFS == NULL) return; - if (fpPrimaryDiskFS->GetVolumeID() != nil) { + if (fpPrimaryDiskFS->GetVolumeID() != NULL) { pStr->Format(L"Disk Image - %hs", fpPrimaryDiskFS->GetVolumeID()); } } @@ -997,7 +997,7 @@ DiskArchive::LoadContents(void) int result; WMSG0("DiskArchive LoadContents\n"); - ASSERT(fpPrimaryDiskFS != nil); + ASSERT(fpPrimaryDiskFS != NULL); { MainWindow* pMain = GET_MAIN_WINDOW(); @@ -1090,11 +1090,11 @@ DiskArchive::LoadDiskFSContents(DiskFS* pDiskFS, const WCHAR* volName) WMSG2("Notes for disk image '%ls':\n%hs", volName, pDiskFS->GetDiskImg()->GetNotes()); - ASSERT(pDiskFS != nil); - pFile = pDiskFS->GetNextFile(nil); - while (pFile != nil) { + ASSERT(pDiskFS != NULL); + pFile = pDiskFS->GetNextFile(NULL); + while (pFile != NULL) { pNewEntry = new DiskEntry(pFile); - if (pNewEntry == nil) + if (pNewEntry == NULL) return -1; 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 * on this, so don't put a ':' in the subvol name or Windows will choke.) */ - pSubVol = pDiskFS->GetNextSubVolume(nil); - while (pSubVol != nil) { + pSubVol = pDiskFS->GetNextSubVolume(NULL); + while (pSubVol != NULL) { CString concatSubVolName; const char* subVolName; int ret; subVolName = pSubVol->GetDiskFS()->GetVolumeName(); - if (subVolName == nil) + if (subVolName == NULL) subVolName = "+++"; // call it *something* if (volName[0] == '\0') @@ -1243,7 +1243,7 @@ DiskArchive::PreferencesChanged(void) { const Preferences* pPreferences = GET_PREFERENCES(); - if (fpPrimaryDiskFS != nil) { + if (fpPrimaryDiskFS != NULL) { fpPrimaryDiskFS->SetParameter(DiskFS::kParmProDOS_AllowLowerCase, pPreferences->GetPrefBool(kPrProDOSAllowLower) != 0); fpPrimaryDiskFS->SetParameter(DiskFS::kParmProDOS_AllocSparse, @@ -1317,7 +1317,7 @@ DiskArchive::BulkAdd(ActionProgressDialog* pActionProgress, pAddOpts->fIncludeSubfolders, pAddOpts->fStripFolderNames, pAddOpts->fOverwriteExisting); - ASSERT(fpAddDataHead == nil); + ASSERT(fpAddDataHead == NULL); /* these reset on every new add */ fOverwriteExisting = false; @@ -1364,7 +1364,7 @@ DiskArchive::BulkAdd(ActionProgressDialog* pActionProgress, buf += wcslen(buf)+1; } - if (fpAddDataHead == nil) { + if (fpAddDataHead == NULL) { CString title; title.LoadString(IDS_MB_APP_NAME); errMsg = L"No files added.\n"; @@ -1438,7 +1438,7 @@ DiskArchive::DoAddFile(const AddFilesDialog* pAddOpts, DIError dierr; 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", (LPCWSTR) pDetails->origName, (LPCWSTR) pDetails->storageName); @@ -1477,7 +1477,7 @@ retry: */ A2File* pExisting; pExisting = pDiskFS->GetFileByName(fsNormalBuf); - if (pExisting != nil) { + if (pExisting != NULL) { NuResult result; result = HandleReplaceExisting(pExisting, pDetails); @@ -1513,7 +1513,7 @@ retry: */ FileAddData* pAddData; pAddData = new FileAddData(pDetails, fsNormalBuf); - if (pAddData == nil) { + if (pAddData == NULL) { nuerr = kNuErrMalloc; goto bail; } @@ -1613,8 +1613,8 @@ DiskArchive::ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL) { CString errMsg; FileAddData* pData; - unsigned char* dataBuf = nil; - unsigned char* rsrcBuf = nil; + unsigned char* dataBuf = NULL; + unsigned char* rsrcBuf = NULL; long dataLen, rsrcLen; MainWindow* pMainWin = (MainWindow*)::AfxGetMainWnd(); @@ -1645,9 +1645,9 @@ DiskArchive::ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL) pData = fpAddDataHead; - while (pData != nil) { - const FileDetails* pDataDetails = nil; - const FileDetails* pRsrcDetails = nil; + while (pData != NULL) { + const FileDetails* pDataDetails = NULL; + const FileDetails* pRsrcDetails = NULL; const FileDetails* pDetails = pData->GetDetails(); const char* typeStr = "????"; // for debug msg only @@ -1671,17 +1671,17 @@ DiskArchive::ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL) return L"internal error"; } - if (pData->GetOtherFork() != nil) { + if (pData->GetOtherFork() != NULL) { pDetails = pData->GetOtherFork()->GetDetails(); typeStr = "both"; switch (pDetails->entryKind) { case FileDetails::kFileKindDataFork: - assert(pDataDetails == nil); + assert(pDataDetails == NULL); pDataDetails = pDetails; break; case FileDetails::kFileKindRsrcFork: - assert(pRsrcDetails == nil); + assert(pRsrcDetails == NULL); pRsrcDetails = pDetails; break; case FileDetails::kFileKindDiskImage: @@ -1697,7 +1697,7 @@ DiskArchive::ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL) WMSG2("Adding file '%ls' (%hs)\n", (LPCWSTR) pDetails->storageName, typeStr); - ASSERT(pDataDetails != nil || pRsrcDetails != nil); + ASSERT(pDataDetails != NULL || pRsrcDetails != NULL); /* * The current implementation of DiskImg/DiskFS requires writing each @@ -1707,7 +1707,7 @@ DiskArchive::ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL) */ DiskFS::CreateParms parms; ConvertFDToCP(pData->GetDetails(), &parms); - if (pRsrcDetails != nil) + if (pRsrcDetails != NULL) parms.storageType = kNuStorageExtended; else parms.storageType = kNuStorageSeedling; @@ -1716,7 +1716,7 @@ DiskArchive::ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL) parms.pathName = pData->GetFSNormalPath(); dataLen = rsrcLen = -1; - if (pDataDetails != nil) { + if (pDataDetails != NULL) { /* figure out text conversion, including high ASCII for DOS */ /* (HA conversion only happens if text conversion happens) */ GenericEntry::ConvertHighASCII convHA; @@ -1740,7 +1740,7 @@ DiskArchive::ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL) if (!errMsg.IsEmpty()) goto bail; } - if (pRsrcDetails != nil) { + if (pRsrcDetails != NULL) { /* no text conversion on resource forks */ errMsg = LoadFile(pRsrcDetails->origName, &rsrcBuf, &rsrcLen, GenericEntry::kConvertEOLOff, GenericEntry::kConvertHAOff); @@ -1764,7 +1764,7 @@ DiskArchive::ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL) } delete[] dataBuf; delete[] rsrcBuf; - dataBuf = rsrcBuf = nil; + dataBuf = rsrcBuf = NULL; pData = pData->GetNext(); } @@ -1803,12 +1803,12 @@ DiskArchive::LoadFile(const WCHAR* pathName, BYTE** pBuf, long* pLen, ASSERT(conv == GenericEntry::kConvertEOLOn || conv == GenericEntry::kConvertEOLOff || conv == GenericEntry::kConvertEOLAuto); - ASSERT(pathName != nil); - ASSERT(pBuf != nil); - ASSERT(pLen != nil); + ASSERT(pathName != NULL); + ASSERT(pBuf != NULL); + ASSERT(pLen != NULL); fp = _wfopen(pathName, L"rb"); - if (fp == nil) { + if (fp == NULL) { errMsg.Format(L"Unable to open '%ls': %hs.", pathName, strerror(errno)); goto bail; @@ -1828,7 +1828,7 @@ DiskArchive::LoadFile(const WCHAR* pathName, BYTE** pBuf, long* pLen, rewind(fp); if (fileLen == 0) { // handle zero-length files - *pBuf = nil; + *pBuf = NULL; *pLen = 0; goto bail; } else if (fileLen > 0x00ffffff) { @@ -1837,7 +1837,7 @@ DiskArchive::LoadFile(const WCHAR* pathName, BYTE** pBuf, long* pLen, } *pBuf = new BYTE[fileLen]; - if (*pBuf == nil) { + if (*pBuf == NULL) { errMsg.Format(L"Unable to allocate %ld bytes for '%ls'.", fileLen, pathName); 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.", pathName, strerror(errno)); delete[] *pBuf; - *pBuf = nil; + *pBuf = NULL; goto bail; } rewind(fp); @@ -1895,7 +1895,7 @@ DiskArchive::LoadFile(const WCHAR* pathName, BYTE** pBuf, long* pLen, if (fread(*pBuf, fileLen, 1, fp) != 1) { errMsg.Format(L"Unable to read '%ls': %hs.", pathName, strerror(errno)); delete[] *pBuf; - *pBuf = nil; + *pBuf = NULL; goto bail; } } else { @@ -1967,8 +1967,8 @@ DiskArchive::AddForksToDisk(DiskFS* pDiskFS, const DiskFS::CreateParms* pParms, const int kFileTypeBIN = 0x06; const int kFileTypeINT = 0xfa; const int kFileTypeBAS = 0xfc; - A2File* pNewFile = nil; - A2FileDescr* pOpenFile = nil; + A2File* pNewFile = NULL; + A2FileDescr* pOpenFile = NULL; DiskFS::CreateParms parmCopy; /* @@ -1998,7 +1998,7 @@ DiskArchive::AddForksToDisk(DiskFS* pDiskFS, const DiskFS::CreateParms* pParms, if (parmCopy.fssep != '\0' && parmCopy.storageType == kNuStorageSeedling) { const char* cp; cp = strrchr(parmCopy.pathName, parmCopy.fssep); - if (cp != nil) { + if (cp != NULL) { if (strcmp(cp+1, kEmptyFolderMarker) == 0 && dataLen == 0) { /* drop the junk on the end */ 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 - * 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 * kinds of zero-length files, because e.g. a zero-length 'B' file * 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 * forks, because DOS 3.3 doesn't have those. */ if (dataLen > 0 || - (dataLen == 0 && pNewFile != nil)) + (dataLen == 0 && pNewFile != NULL)) { - ASSERT(pNewFile != nil); + ASSERT(pNewFile != NULL); unsigned char dummyBuf[1] = { '\0' }; dierr = pNewFile->Open(&pOpenFile, false, false); @@ -2102,27 +2102,27 @@ DiskArchive::AddForksToDisk(DiskFS* pDiskFS, const DiskFS::CreateParms* pParms, goto bail; 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) goto bail; dierr = pOpenFile->Close(); if (dierr != kDIErrNone) goto bail; - pOpenFile = nil; + pOpenFile = NULL; } if (rsrcLen > 0) { - ASSERT(pNewFile != nil); + ASSERT(pNewFile != NULL); dierr = pNewFile->Open(&pOpenFile, false, true); if (dierr != kDIErrNone) goto bail; pOpenFile->SetProgressUpdater(DiskArchive::ProgressCallback, - rsrcLen, nil); + rsrcLen, NULL); dierr = pOpenFile->Write(rsrcBuf, rsrcLen); if (dierr != kDIErrNone) @@ -2131,13 +2131,13 @@ DiskArchive::AddForksToDisk(DiskFS* pDiskFS, const DiskFS::CreateParms* pParms, dierr = pOpenFile->Close(); if (dierr != kDIErrNone) goto bail; - pOpenFile = nil; + pOpenFile = NULL; } bail: - if (pOpenFile != nil) + if (pOpenFile != NULL) pOpenFile->Close(); - if (dierr != kDIErrNone && pNewFile != nil) { + if (dierr != kDIErrNone && pNewFile != NULL) { /* * Clean up the partially-written file. This does not, of course, * erase any subdirectories that were created to contain this file. @@ -2184,8 +2184,8 @@ DiskArchive::ConvertFDToCP(const FileDetails* pDetails, void DiskArchive::AddToAddDataList(FileAddData* pData) { - ASSERT(pData != nil); - ASSERT(pData->GetNext() == nil); + ASSERT(pData != NULL); + ASSERT(pData->GetNext() == NULL); /* * Run through the entire existing list, looking for a match. This is @@ -2198,8 +2198,8 @@ DiskArchive::AddToAddDataList(FileAddData* pData) FileDetails::FileKind dataKind, listKind; dataKind = pData->GetDetails()->entryKind; - while (pSearch != nil) { - if (pSearch->GetOtherFork() == nil && + while (pSearch != NULL) { + if (pSearch->GetOtherFork() == NULL && wcscmp(pSearch->GetDetails()->storageName, pData->GetDetails()->storageName) == 0) { @@ -2225,8 +2225,8 @@ DiskArchive::AddToAddDataList(FileAddData* pData) pSearch = pSearch->GetNext(); } - if (fpAddDataHead == nil) { - assert(fpAddDataTail == nil); + if (fpAddDataHead == NULL) { + assert(fpAddDataTail == NULL); fpAddDataHead = fpAddDataTail = pData; } else { fpAddDataTail->SetNext(pData); @@ -2244,14 +2244,14 @@ DiskArchive::FreeAddDataList(void) FileAddData* pNext; pData = fpAddDataHead; - while (pData != nil) { + while (pData != NULL) { pNext = pData->GetNext(); delete pData->GetOtherFork(); delete pData; pData = pNext; } - fpAddDataHead = fpAddDataTail = nil; + fpAddDataHead = fpAddDataTail = NULL; } @@ -2268,13 +2268,13 @@ bool DiskArchive::CreateSubdir(CWnd* pMsgWnd, GenericEntry* pParentEntry, const WCHAR* newName) { - ASSERT(newName != nil && wcslen(newName) > 0); + ASSERT(newName != NULL && wcslen(newName) > 0); DiskEntry* pEntry = (DiskEntry*) pParentEntry; - ASSERT(pEntry != nil); + ASSERT(pEntry != NULL); A2File* pFile = pEntry->GetA2File(); - ASSERT(pFile != nil); + ASSERT(pFile != NULL); DiskFS* pDiskFS = pFile->GetDiskFS(); - ASSERT(pDiskFS != nil); + ASSERT(pDiskFS != NULL); if (!pFile->IsDirectory()) { ASSERT(false); @@ -2282,10 +2282,10 @@ DiskArchive::CreateSubdir(CWnd* pMsgWnd, GenericEntry* pParentEntry, } DIError dierr; - A2File* pNewFile = nil; + A2File* pNewFile = NULL; DiskFS::CreateParms parms; CStringA pathName; - time_t now = time(nil); + time_t now = time(NULL); /* * Create the full path. @@ -2297,7 +2297,7 @@ DiskArchive::CreateSubdir(CWnd* pMsgWnd, GenericEntry* pParentEntry, pathName += pParentEntry->GetFssep(); pathName += newName; } - ASSERT(wcschr(newName, pParentEntry->GetFssep()) == nil); + ASSERT(wcschr(newName, pParentEntry->GetFssep()) == NULL); /* using NufxLib constants; they match with ProDOS */ memset(&parms, 0, sizeof(parms)); @@ -2379,9 +2379,9 @@ DiskArchive::DeleteSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) int idx = 0; pSelEntry = pSelSet->IterNext(); - while (pSelEntry != nil) { + while (pSelEntry != NULL) { pEntry = (DiskEntry*) pSelEntry->GetEntry(); - ASSERT(pEntry != nil); + ASSERT(pEntry != NULL); entryArray[idx++] = pEntry; 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(), (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, @@ -2447,7 +2447,7 @@ DiskArchive::DeleteSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) * changes we'll need to raise the "reload" flag here, before the * reload, to prevent the ContentList from chasing a bad pointer. */ - pEntry->SetA2File(nil); + pEntry->SetA2File(NULL); } retVal = true; @@ -2496,7 +2496,7 @@ DiskArchive::RenameSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) * sorts of archives (e.g. disk archives). */ SelectionEntry* pSelEntry = pSelSet->IterNext(); - while (pSelEntry != nil) { + while (pSelEntry != NULL) { RenameEntryDialog renameDlg(pMsgWnd); DiskEntry* pEntry = (DiskEntry*) pSelEntry->GetEntry(); @@ -2557,7 +2557,7 @@ DiskArchive::SetRenameFields(CWnd* pMsgWnd, DiskEntry* pEntry, { DiskFS* pDiskFS; - ASSERT(pEntry != nil); + ASSERT(pEntry != NULL); /* * Figure out if we're allowed to change the entire path. (This is @@ -2630,7 +2630,7 @@ DiskArchive::TestPathName(const GenericEntry* pGenericEntry, A2File* existingFile; CStringA pathNameA(pathName); existingFile = pDiskFS->GetFileByName(pathNameA); - if (existingFile != nil && existingFile != pEntry->GetA2File()) { + if (existingFile != NULL && existingFile != pEntry->GetA2File()) { errMsg = "A file with that name already exists."; goto bail; } @@ -2709,8 +2709,8 @@ DiskArchive::TestVolumeName(const DiskFS* pDiskFS, DiskImg::FSFormat format; CString errMsg; - ASSERT(pDiskFS != nil); - ASSERT(newName != nil); + ASSERT(pDiskFS != NULL); + ASSERT(newName != NULL); format = pDiskFS->GetDiskImg()->GetFSFormat(); @@ -2816,8 +2816,8 @@ DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, ActionProgressDialog* pActionProgress, const XferFileOptions* pXferOpts) { WMSG0("DiskArchive XferSelection!\n"); - unsigned char* dataBuf = nil; - unsigned char* rsrcBuf = nil; + unsigned char* dataBuf = NULL; + unsigned char* rsrcBuf = NULL; FileDetails fileDetails; CString errMsg, extractErrMsg, cmpStr; CString fixedPathName; @@ -2826,14 +2826,14 @@ DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, pXferOpts->fTarget->XferPrepare(pXferOpts); SelectionEntry* pSelEntry = pSelSet->IterNext(); - for ( ; pSelEntry != nil; pSelEntry = pSelSet->IterNext()) { + for ( ; pSelEntry != NULL; pSelEntry = pSelSet->IterNext()) { long dataLen=-1, rsrcLen=-1; DiskEntry* pEntry = (DiskEntry*) pSelEntry->GetEntry(); int typeOverride = -1; int result; - ASSERT(dataBuf == nil); - ASSERT(rsrcBuf == nil); + ASSERT(dataBuf == NULL); + ASSERT(rsrcBuf == NULL); if (pEntry->GetDamaged()) { WMSG1(" XFER skipping damaged entry '%ls'\n", @@ -2850,7 +2850,7 @@ DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, fixedPathName = _T("(no filename)"); if (pEntry->GetFSFormat() != DiskImg::kFormatProDOS) fixedPathName.Replace(PathProposal::kDefaultStoredFssep, '.'); - if (pEntry->GetSubVolName() != nil) { + if (pEntry->GetSubVolName() != NULL) { CString tmpStr; tmpStr = pEntry->GetSubVolName(); tmpStr += (char)PathProposal::kDefaultStoredFssep; @@ -2894,7 +2894,7 @@ DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, (LPCWSTR) fixedPathName, pEntry->GetHasDataFork(), pEntry->GetHasRsrcFork()); - dataBuf = nil; + dataBuf = NULL; dataLen = 0; result = pEntry->ExtractThreadToBuffer(GenericEntry::kDataThread, (char**) &dataBuf, &dataLen, &extractErrMsg); @@ -2907,7 +2907,7 @@ DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED); goto bail; } - ASSERT(dataBuf != nil); + ASSERT(dataBuf != NULL); ASSERT(dataLen >= 0); #if 0 @@ -2935,7 +2935,7 @@ DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, #endif if (pEntry->GetHasRsrcFork()) { - rsrcBuf = nil; + rsrcBuf = NULL; rsrcLen = 0; result = pEntry->ExtractThreadToBuffer(GenericEntry::kRsrcThread, (char**) &rsrcBuf, &rsrcLen, &extractErrMsg); @@ -2949,7 +2949,7 @@ DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, goto bail; } } else { - ASSERT(rsrcBuf == nil); + ASSERT(rsrcBuf == NULL); } if (pEntry->GetHasDataFork() && pEntry->GetHasRsrcFork()) @@ -2976,7 +2976,7 @@ have_stuff2: fileDetails.storageType = kNuStorageUnknown; /* let NufxLib deal */ time_t when; - when = time(nil); + when = time(NULL); UNIXTimeToDateTime(&when, &fileDetails.archiveWhen); when = pEntry->GetModWhen(); UNIXTimeToDateTime(&when, &fileDetails.modWhen); @@ -2998,8 +2998,8 @@ have_stuff2: ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED); goto bail; } - ASSERT(dataBuf == nil); - ASSERT(rsrcBuf == nil); + ASSERT(dataBuf == NULL); + ASSERT(rsrcBuf == NULL); if (pActionProgress->SetProgress(100) == IDCANCEL) { retval = kXferCancelled; @@ -3050,7 +3050,7 @@ DiskArchive::XferPrepare(const XferFileOptions* pXferOpts) * * 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 * 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", pDetails->storageName, dataLen, rsrcLen); - ASSERT(pDataBuf != nil); - ASSERT(pRsrcBuf != nil); + ASSERT(pDataBuf != NULL); + ASSERT(pRsrcBuf != NULL); /* fill out CreateParms from FileDetails */ ConvertFDToCP(pDetails, &createParms); - if (fpXferTargetFS == nil) + if (fpXferTargetFS == NULL) pDiskFS = fpPrimaryDiskFS; else pDiskFS = fpXferTargetFS; @@ -3134,9 +3134,9 @@ DiskArchive::XferFile(FileDetails* pDetails, BYTE** pDataBuf, /* clean up */ delete[] *pDataBuf; - *pDataBuf = nil; + *pDataBuf = NULL; delete[] *pRsrcBuf; - *pRsrcBuf = nil; + *pRsrcBuf = NULL; bail: return errMsg; diff --git a/app/DiskArchive.h b/app/DiskArchive.h index d3f5580..b9887c9 100644 --- a/app/DiskArchive.h +++ b/app/DiskArchive.h @@ -35,7 +35,7 @@ public: // return the underlying FS format for this file virtual DiskImg::FSFormat GetFSFormat(void) const { - ASSERT(fpFile != nil); + ASSERT(fpFile != NULL); return fpFile->GetFSFormat(); } @@ -55,8 +55,8 @@ private: */ class DiskArchive : public GenericArchive { public: - DiskArchive(void) : fpPrimaryDiskFS(nil), fIsReadOnly(false), - fpAddDataHead(nil), fpAddDataTail(nil) + DiskArchive(void) : fpPrimaryDiskFS(NULL), fIsReadOnly(false), + fpAddDataHead(NULL), fpAddDataTail(NULL) {} virtual ~DiskArchive(void) { (void) Close(); } @@ -172,8 +172,8 @@ private: fDetails = *pDetails; fFSNormalPath = fsNormalPath; - fpOtherFork = nil; - fpNext = nil; + fpOtherFork = NULL; + fpNext = NULL; } virtual ~FileAddData(void) {} diff --git a/app/DiskConvertDialog.cpp b/app/DiskConvertDialog.cpp index 94ce8a3..c92ad02 100644 --- a/app/DiskConvertDialog.cpp +++ b/app/DiskConvertDialog.cpp @@ -25,7 +25,7 @@ END_MESSAGE_MAP() void DiskConvertDialog::Init(const DiskImg* pDiskImg) { - ASSERT(pDiskImg != nil); + ASSERT(pDiskImg != NULL); const int kMagicNibbles = -1234; bool hasBlocks = pDiskImg->GetHasBlocks(); bool hasSectors = pDiskImg->GetHasSectors(); @@ -275,9 +275,9 @@ void DiskConvertDialog::OnChangeRadio(UINT nID) { CWnd* pGzip = GetDlgItem(IDC_DISKCONV_GZIP); - ASSERT(pGzip != nil); + ASSERT(pGzip != NULL); CButton* pNuFX = (CButton*)GetDlgItem(IDC_DISKCONV_SDK); - ASSERT(pNuFX != nil); + ASSERT(pNuFX != NULL); if (fSizeInBlocks > DiskImgLib::kGzipMax / 512) pGzip->EnableWindow(FALSE); diff --git a/app/DiskEditDialog.cpp b/app/DiskEditDialog.cpp index 471aeb5..f54c98e 100644 --- a/app/DiskEditDialog.cpp +++ b/app/DiskEditDialog.cpp @@ -52,14 +52,14 @@ BOOL DiskEditDialog::OnInitDialog(void) { ASSERT(!fFileName.IsEmpty()); - ASSERT(fpDiskFS != nil); + ASSERT(fpDiskFS != NULL); /* * Disable the write button. */ if (fReadOnly) { CButton* pButton = (CButton*) GetDlgItem(IDC_DISKEDIT_DOWRITE); - ASSERT(pButton != nil); + ASSERT(pButton != NULL); pButton->EnableWindow(FALSE); } @@ -77,7 +77,7 @@ DiskEditDialog::OnInitDialog(void) * Configure the RichEdit control. */ CRichEditCtrl* pEdit = (CRichEditCtrl*) GetDlgItem(IDC_DISKEDIT_EDIT); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); /* set the font to 10-point Courier New */ CHARFORMAT cf; @@ -100,11 +100,11 @@ DiskEditDialog::OnInitDialog(void) * Disable the sub-volume and/or file open buttons if the DiskFS doesn't * have the appropriate stuff inside. */ - if (fpDiskFS->GetNextFile(nil) == nil) { + if (fpDiskFS->GetNextFile(NULL) == NULL) { CWnd* pWnd = GetDlgItem(IDC_DISKEDIT_OPENFILE); pWnd->EnableWindow(FALSE); } - if (fpDiskFS->GetNextSubVolume(nil) == nil) { + if (fpDiskFS->GetNextSubVolume(NULL) == NULL) { CWnd* pWnd = GetDlgItem(IDC_DISKEDIT_SUBVOLUME); pWnd->EnableWindow(FALSE); } @@ -134,7 +134,7 @@ DiskEditDialog::OnInitDialog(void) */ CString title("Disk Viewer - "); title += fFileName; - if (fpDiskFS->GetVolumeID() != nil) { + if (fpDiskFS->GetVolumeID() != NULL) { title += " ("; title += fpDiskFS->GetVolumeID(); title += ")"; @@ -150,12 +150,12 @@ DiskEditDialog::OnInitDialog(void) void DiskEditDialog::InitNibbleParmList(void) { - ASSERT(fpDiskFS != nil); + ASSERT(fpDiskFS != NULL); DiskImg* pDiskImg = fpDiskFS->GetDiskImg(); CComboBox* pCombo; pCombo = (CComboBox*) GetDlgItem(IDC_DISKEDIT_NIBBLE_PARMS); - ASSERT(pCombo != nil); + ASSERT(pCombo != NULL); if (pDiskImg->GetHasNibbles()) { const DiskImg::NibbleDescr* pTable; @@ -163,7 +163,7 @@ DiskEditDialog::InitNibbleParmList(void) int i, 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", (long) pTable, count); return; @@ -172,7 +172,7 @@ DiskEditDialog::InitNibbleParmList(void) /* configure the selection to match the disk analysis */ int dflt = -1; - if (pCurrent != nil) { + if (pCurrent != NULL) { for (i = 0; i < count; i++) { if (memcmp(&pTable[i], pCurrent, sizeof(*pCurrent)) == 0) { WMSG1(" NibbleParm match on entry %d\n", i); @@ -216,7 +216,7 @@ DiskEditDialog::ReplaceSpinCtrl(MySpinCtrl* pNewSpin, int idSpin, int idEdit) DWORD style; pSpin = (CSpinButtonCtrl*)GetDlgItem(idSpin); - if (pSpin == nil) + if (pSpin == NULL) return -1; // pSpin->GetWindowRect(&rect); // ScreenToClient(&rect); @@ -305,7 +305,7 @@ DiskEditDialog::OnHexMode(void) int base; CButton* pButton = (CButton*) GetDlgItem(IDC_DISKEDIT_HEX); - ASSERT(pButton != nil); + ASSERT(pButton != NULL); if (pButton->GetCheck() == 0) base = 10; @@ -328,14 +328,14 @@ DiskEditDialog::OnSubVolume(void) subv.Setup(fpDiskFS); if (subv.DoModal() == IDOK) { WMSG1("SELECTED subv %d\n", subv.fListBoxIndex); - DiskFS::SubVolume* pSubVol = fpDiskFS->GetNextSubVolume(nil); - if (pSubVol == nil) + DiskFS::SubVolume* pSubVol = fpDiskFS->GetNextSubVolume(NULL); + if (pSubVol == NULL) return; while (subv.fListBoxIndex-- > 0) { pSubVol = fpDiskFS->GetNextSubVolume(pSubVol); } - ASSERT(pSubVol != nil); + ASSERT(pSubVol != NULL); BlockEditDialog blockEdit; SectorEditDialog sectorEdit; @@ -367,7 +367,7 @@ DiskEditDialog::SetSpinMode(int id, int base) ASSERT(base == 10 || base == 16); MySpinCtrl* pSpin = (MySpinCtrl*) GetDlgItem(id); - if (pSpin == nil) { + if (pSpin == NULL) { // expected behavior in "block" mode for sector button WMSG1("Couldn't find spin button %d\n", id); return; @@ -399,7 +399,7 @@ int DiskEditDialog::ReadSpinner(int id, long* pVal) { MySpinCtrl* pSpin = (MySpinCtrl*) GetDlgItem(id); - ASSERT(pSpin != nil); + ASSERT(pSpin != NULL); long val = pSpin->GetPos(); if (val & 0xff000000) { @@ -426,7 +426,7 @@ void DiskEditDialog::SetSpinner(int id, long val) { MySpinCtrl* pSpin = (MySpinCtrl*) GetDlgItem(id); - ASSERT(pSpin != nil); + ASSERT(pSpin != NULL); /* sanity check */ int lower, upper; @@ -446,11 +446,11 @@ DiskEditDialog::DisplayData(const BYTE* srcBuf, int size) WCHAR* cp; int i, j; - ASSERT(srcBuf != nil); + ASSERT(srcBuf != NULL); ASSERT(size == kSectorSize || size == kBlockSize); CRichEditCtrl* pEdit = (CRichEditCtrl*)GetDlgItem(IDC_DISKEDIT_EDIT); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); /* * If we have an alert message, show that instead. @@ -523,7 +523,7 @@ DiskEditDialog::DisplayData(const BYTE* srcBuf, int size) void DiskEditDialog::DisplayNibbleData(const unsigned char* srcBuf, int size) { - ASSERT(srcBuf != nil); + ASSERT(srcBuf != NULL); ASSERT(size > 0); ASSERT(fAlertMsg.IsEmpty()); @@ -532,7 +532,7 @@ DiskEditDialog::DisplayNibbleData(const unsigned char* srcBuf, int size) WCHAR* cp; int i; - if (textBuf == nil) + if (textBuf == NULL) return; cp = textBuf; @@ -567,7 +567,7 @@ DiskEditDialog::DisplayNibbleData(const unsigned char* srcBuf, int size) *cp = '\0'; CRichEditCtrl* pEdit = (CRichEditCtrl*)GetDlgItem(IDC_DISKEDIT_EDIT); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); pEdit->SetWindowText(textBuf); /* @@ -599,7 +599,7 @@ DiskEditDialog::DisplayNibbleData(const unsigned char* srcBuf, int size) /* * 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 * its Close function. */ @@ -608,12 +608,12 @@ DiskEditDialog::OpenFile(const WCHAR* fileName, bool openRsrc, A2File** ppFile, A2FileDescr** ppOpenFile) { A2File* pFile; - A2FileDescr* pOpenFile = nil; + A2FileDescr* pOpenFile = NULL; WMSG2(" OpenFile '%ls' rsrc=%d\n", fileName, openRsrc); CStringA fileNameA(fileName); pFile = fpDiskFS->GetFileByName(fileNameA); - if (pFile == nil) { + if (pFile == NULL) { CString msg, failed; msg.Format(IDS_DEFILE_FIND_FAILED, fileName); @@ -653,11 +653,11 @@ DiskEditDialog::OnNibbleParms(void) CComboBox* pCombo; int sel; - ASSERT(pDiskImg != nil); + ASSERT(pDiskImg != NULL); ASSERT(pDiskImg->GetHasNibbles()); pCombo = (CComboBox*) GetDlgItem(IDC_DISKEDIT_NIBBLE_PARMS); - ASSERT(pCombo != nil); + ASSERT(pCombo != NULL); sel = pCombo->GetCurSel(); if (sel == CB_ERR) @@ -721,11 +721,11 @@ SectorEditDialog::OnInitDialog(void) CWnd* pWnd; trackStr.Format(L"Track (%d):", fpDiskFS->GetDiskImg()->GetNumTracks()); pWnd = GetDlgItem(IDC_STEXT_TRACK); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->SetWindowText(trackStr); trackStr.Format(L"Sector (%d):", fpDiskFS->GetDiskImg()->GetNumSectPerTrack()); pWnd = GetDlgItem(IDC_STEXT_SECTOR); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->SetWindowText(trackStr); /* @@ -733,11 +733,11 @@ SectorEditDialog::OnInitDialog(void) */ MySpinCtrl* pSpin; pSpin = (MySpinCtrl*)GetDlgItem(IDC_DISKEDIT_TRACKSPIN); - ASSERT(pSpin != nil); + ASSERT(pSpin != NULL); pSpin->SetRange32(0, fpDiskFS->GetDiskImg()->GetNumTracks()-1); pSpin->SetPos(0); pSpin = (MySpinCtrl*)GetDlgItem(IDC_DISKEDIT_SECTORSPIN); - ASSERT(pSpin != nil); + ASSERT(pSpin != NULL); pSpin->SetRange32(0, fpDiskFS->GetDiskImg()->GetNumSectPerTrack()-1); pSpin->SetPos(0); @@ -756,8 +756,8 @@ int SectorEditDialog::LoadData(void) { //WMSG0("SED LoadData\n"); - ASSERT(fpDiskFS != nil); - ASSERT(fpDiskFS->GetDiskImg() != nil); + ASSERT(fpDiskFS != NULL); + ASSERT(fpDiskFS->GetDiskImg() != NULL); if (ReadSpinner(IDC_DISKEDIT_TRACKSPIN, &fTrack) != 0) return -1; @@ -863,7 +863,7 @@ SectorEditDialog::OnOpenFile(void) if (fileDialog.DoModal() == IDOK) { SectorFileEditDialog fileEdit(this, this); A2File* pFile; - A2FileDescr* pOpenFile = nil; + A2FileDescr* pOpenFile = NULL; DIError dierr; dierr = OpenFile(fileDialog.fName, fileDialog.fOpenRsrcFork != 0, @@ -901,10 +901,10 @@ SectorFileEditDialog::OnInitDialog(void) /* disable direct entry of tracks and sectors */ CWnd* pWnd; pWnd = GetDlgItem(IDC_DISKEDIT_TRACKSPIN); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->EnableWindow(FALSE); pWnd = GetDlgItem(IDC_DISKEDIT_SECTORSPIN); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->EnableWindow(FALSE); /* disallow opening of sub-volumes and files */ @@ -915,10 +915,10 @@ SectorFileEditDialog::OnInitDialog(void) CEdit* pEdit; pEdit = (CEdit*) GetDlgItem(IDC_DISKEDIT_TRACK); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); pEdit->SetReadOnly(TRUE); pEdit = (CEdit*) GetDlgItem(IDC_DISKEDIT_SECTOR); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); pEdit->SetReadOnly(TRUE); /* set the window title */ @@ -941,8 +941,8 @@ SectorFileEditDialog::OnInitDialog(void) int SectorFileEditDialog::LoadData(void) { - ASSERT(fpDiskFS != nil); - ASSERT(fpDiskFS->GetDiskImg() != nil); + ASSERT(fpDiskFS != NULL); + ASSERT(fpDiskFS->GetDiskImg() != NULL); DIError dierr; WMSG1("SFED LoadData reading index=%d\n", fSectorIdx); @@ -1021,15 +1021,15 @@ SectorFileEditDialog::LoadData(void) CWnd* pWnd; pWnd = GetDlgItem(IDC_DISKEDIT_PREV); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->EnableWindow(fSectorIdx > 0); - if (!pWnd->IsWindowEnabled() && GetFocus() == nil) + if (!pWnd->IsWindowEnabled() && GetFocus() == NULL) GetDlgItem(IDC_DISKEDIT_NEXT)->SetFocus(); pWnd = GetDlgItem(IDC_DISKEDIT_NEXT); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->EnableWindow(fSectorIdx+1 < fpOpenFile->GetSectorCount()); - if (!pWnd->IsWindowEnabled() && GetFocus() == nil) + if (!pWnd->IsWindowEnabled() && GetFocus() == NULL) GetDlgItem(IDC_DISKEDIT_PREV)->SetFocus(); DisplayData(); @@ -1096,7 +1096,7 @@ BlockEditDialog::OnInitDialog(void) //blockStr.LoadString(IDS_BLOCK); blockStr.Format(L"Block (%d):", fpDiskFS->GetDiskImg()->GetNumBlocks()); pWnd = GetDlgItem(IDC_STEXT_TRACK); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->SetWindowText(blockStr); /* @@ -1110,7 +1110,7 @@ BlockEditDialog::OnInitDialog(void) MoveWindow(&rect); CRichEditCtrl* pEdit = (CRichEditCtrl*)GetDlgItem(IDC_DISKEDIT_EDIT); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); CRect inner; pEdit->GetRect(&inner); inner.bottom += kStretchHeight; @@ -1136,7 +1136,7 @@ BlockEditDialog::OnInitDialog(void) */ MySpinCtrl* pSpin; pSpin = (MySpinCtrl*)GetDlgItem(IDC_DISKEDIT_TRACKSPIN); - ASSERT(pSpin != nil); + ASSERT(pSpin != NULL); pSpin->SetRange32(0, fpDiskFS->GetDiskImg()->GetNumBlocks()-1); pSpin->SetPos(0); @@ -1160,7 +1160,7 @@ BlockEditDialog::MoveControl(int id, int deltaX, int deltaY) CRect rect; pWnd = GetDlgItem(id); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->GetWindowRect(&rect); ScreenToClient(&rect); @@ -1180,8 +1180,8 @@ int BlockEditDialog::LoadData(void) { //WMSG0("BED LoadData\n"); - ASSERT(fpDiskFS != nil); - ASSERT(fpDiskFS->GetDiskImg() != nil); + ASSERT(fpDiskFS != NULL); + ASSERT(fpDiskFS->GetDiskImg() != NULL); if (ReadSpinner(IDC_DISKEDIT_TRACKSPIN, &fBlock) != 0) return -1; @@ -1246,7 +1246,7 @@ BlockEditDialog::OnReadPrev(void) void BlockEditDialog::OnReadNext(void) { - ASSERT(fpDiskFS != nil); + ASSERT(fpDiskFS != NULL); if (fBlock == fpDiskFS->GetDiskImg()->GetNumBlocks() - 1) return; @@ -1267,7 +1267,7 @@ BlockEditDialog::OnOpenFile(void) if (fileDialog.DoModal() == IDOK) { BlockFileEditDialog fileEdit(this, this); A2File* pFile; - A2FileDescr* pOpenFile = nil; + A2FileDescr* pOpenFile = NULL; DIError dierr; dierr = OpenFile(fileDialog.fName, fileDialog.fOpenRsrcFork != 0, @@ -1305,7 +1305,7 @@ BlockFileEditDialog::OnInitDialog(void) /* disable direct entry of tracks and Blocks */ CWnd* pWnd; pWnd = GetDlgItem(IDC_DISKEDIT_TRACKSPIN); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->EnableWindow(FALSE); /* disallow opening of sub-volumes and files */ @@ -1316,7 +1316,7 @@ BlockFileEditDialog::OnInitDialog(void) CEdit* pEdit; pEdit = (CEdit*) GetDlgItem(IDC_DISKEDIT_TRACK); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); pEdit->SetReadOnly(TRUE); /* set the window title */ @@ -1339,8 +1339,8 @@ BlockFileEditDialog::OnInitDialog(void) int BlockFileEditDialog::LoadData(void) { - ASSERT(fpDiskFS != nil); - ASSERT(fpDiskFS->GetDiskImg() != nil); + ASSERT(fpDiskFS != NULL); + ASSERT(fpDiskFS->GetDiskImg() != NULL); DIError dierr; WMSG1("BFED LoadData reading index=%d\n", fBlockIdx); @@ -1416,15 +1416,15 @@ BlockFileEditDialog::LoadData(void) CWnd* pWnd; pWnd = GetDlgItem(IDC_DISKEDIT_PREV); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->EnableWindow(fBlockIdx > 0); - if (!pWnd->IsWindowEnabled() && GetFocus() == nil) + if (!pWnd->IsWindowEnabled() && GetFocus() == NULL) GetDlgItem(IDC_DISKEDIT_NEXT)->SetFocus(); pWnd = GetDlgItem(IDC_DISKEDIT_NEXT); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->EnableWindow(fBlockIdx+1 < fpOpenFile->GetBlockCount()); - if (!pWnd->IsWindowEnabled() && GetFocus() == nil) + if (!pWnd->IsWindowEnabled() && GetFocus() == NULL) GetDlgItem(IDC_DISKEDIT_PREV)->SetFocus(); DisplayData(); @@ -1489,7 +1489,7 @@ NibbleEditDialog::OnInitDialog(void) CString trackStr; trackStr.Format(L"Track (%d):", fpDiskFS->GetDiskImg()->GetNumTracks()); pWnd = GetDlgItem(IDC_STEXT_TRACK); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->SetWindowText(trackStr); /* @@ -1500,7 +1500,7 @@ NibbleEditDialog::OnInitDialog(void) * device context. */ CRichEditCtrl* pEdit = (CRichEditCtrl*)GetDlgItem(IDC_DISKEDIT_EDIT); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); const int kStretchHeight = 249; CRect rect; @@ -1556,7 +1556,7 @@ NibbleEditDialog::OnInitDialog(void) */ MySpinCtrl* pSpin; pSpin = (MySpinCtrl*)GetDlgItem(IDC_DISKEDIT_TRACKSPIN); - ASSERT(pSpin != nil); + ASSERT(pSpin != NULL); pSpin->SetRange32(0, fpDiskFS->GetDiskImg()->GetNumTracks()-1); pSpin->SetPos(0); @@ -1573,8 +1573,8 @@ int NibbleEditDialog::LoadData(void) { //WMSG0("BED LoadData\n"); - ASSERT(fpDiskFS != nil); - ASSERT(fpDiskFS->GetDiskImg() != nil); + ASSERT(fpDiskFS != NULL); + ASSERT(fpDiskFS->GetDiskImg() != NULL); if (ReadSpinner(IDC_DISKEDIT_TRACKSPIN, &fTrack) != 0) return -1; @@ -1634,7 +1634,7 @@ NibbleEditDialog::OnReadPrev(void) void NibbleEditDialog::OnReadNext(void) { - ASSERT(fpDiskFS != nil); + ASSERT(fpDiskFS != NULL); if (fTrack == fpDiskFS->GetDiskImg()->GetNumTracks() - 1) return; diff --git a/app/DiskEditDialog.h b/app/DiskEditDialog.h index 3b47369..13f912f 100644 --- a/app/DiskEditDialog.h +++ b/app/DiskEditDialog.h @@ -30,7 +30,7 @@ public: CDialog(nIDTemplate, pParentWnd) { fReadOnly = true; - fpDiskFS = nil; + fpDiskFS = NULL; fFileName = ""; fPositionShift = 0; fFirstResize = true; @@ -38,8 +38,8 @@ public: virtual ~DiskEditDialog() {} void Setup(DiskFS* pDiskFS, const WCHAR* fileName) { - ASSERT(pDiskFS != nil); - ASSERT(fileName != nil); + ASSERT(pDiskFS != NULL); + ASSERT(fileName != NULL); fpDiskFS = pDiskFS; fFileName = fileName; } diff --git a/app/DiskEditOpenDialog.cpp b/app/DiskEditOpenDialog.cpp index f4e2f30..669ef91 100644 --- a/app/DiskEditOpenDialog.cpp +++ b/app/DiskEditOpenDialog.cpp @@ -21,7 +21,7 @@ DiskEditOpenDialog::OnInitDialog(void) { if (!fArchiveOpen) { CButton* pButton = (CButton*) GetDlgItem(IDC_DEOW_CURRENT); - ASSERT(pButton != nil); + ASSERT(pButton != NULL); pButton->EnableWindow(FALSE); } diff --git a/app/DiskFSTree.cpp b/app/DiskFSTree.cpp index 063f0eb..cad904c 100644 --- a/app/DiskFSTree.cpp +++ b/app/DiskFSTree.cpp @@ -18,8 +18,8 @@ using namespace DiskImgLib; bool DiskFSTree::BuildTree(DiskFS* pDiskFS, CTreeCtrl* pTree) { - ASSERT(pDiskFS != nil); - ASSERT(pTree != nil); + ASSERT(pDiskFS != NULL); + ASSERT(pTree != NULL); pTree->SetImageList(&fTreeImageList, TVSIL_NORMAL); return AddDiskFS(pTree, TVI_ROOT, pDiskFS, 1); @@ -49,7 +49,7 @@ DiskFSTree::AddDiskFS(CTreeCtrl* pTree, HTREEITEM parent, pTarget = AllocTargetData(); pTarget->kind = kTargetDiskFS; 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; // TODO(xyzzy): need storage for wide-char version tvi.pszText = L"XYZZY-DiskFSTree1"; // pDiskFS->GetVolumeID(); @@ -69,7 +69,7 @@ DiskFSTree::AddDiskFS(CTreeCtrl* pTree, HTREEITEM parent, tvins.hInsertAfter = parent; tvins.hParent = parent; hLocalRoot = pTree->InsertItem(&tvins); - if (hLocalRoot == nil) { + if (hLocalRoot == NULL) { WMSG0("Tree root InsertItem failed\n"); return false; } @@ -77,8 +77,8 @@ DiskFSTree::AddDiskFS(CTreeCtrl* pTree, HTREEITEM parent, /* * Scan for and handle all sub-volumes. */ - pSubVol = pDiskFS->GetNextSubVolume(nil); - while (pSubVol != nil) { + pSubVol = pDiskFS->GetNextSubVolume(NULL); + while (pSubVol != NULL) { if (!AddDiskFS(pTree, hLocalRoot, pSubVol->GetDiskFS(), depth+1)) return false; @@ -96,7 +96,7 @@ DiskFSTree::AddDiskFS(CTreeCtrl* pTree, HTREEITEM parent, if (fIncludeSubdirs && pDiskFS->GetReadWriteSupported() && !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. * * 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. * * 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; 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 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 */ - return nil; + return NULL; } - if (pParentFile == nil) { + if (pParentFile == NULL) { /* * This is the root of the disk. We already have a DiskFS entry for * it, so don't add a new tree item here. @@ -181,20 +181,20 @@ DiskFSTree::AddSubdir(CTreeCtrl* pTree, HTREEITEM parent, tvins.hInsertAfter = parent; tvins.hParent = parent; hLocalRoot = pTree->InsertItem(&tvins); - if (hLocalRoot == nil) { + if (hLocalRoot == NULL) { WMSG1("Tree insert '%ls' failed\n", tvi.pszText); - return nil; + return NULL; } } - while (pFile != nil) { + while (pFile != NULL) { if (pFile->IsDirectory()) { ASSERT(!pFile->IsVolumeDirectory()); if (pFile->GetParent() == pParentFile) { /* this is a subdir of us */ pFile = AddSubdir(pTree, hLocalRoot, pDiskFS, pFile, depth+1); - if (pFile == nil) + if (pFile == NULL) break; // out of while -- disk is done } else { /* not one of our subdirs; pop up a level */ @@ -221,8 +221,8 @@ DiskFSTree::AllocTargetData(void) { TargetData* pNew = new TargetData; - if (pNew == nil) - return nil; + if (pNew == NULL) + return NULL; memset(pNew, 0, sizeof(*pNew)); /* insert it at the head of the list, and update the head pointer */ @@ -244,11 +244,11 @@ DiskFSTree::FreeAllTargetData(void) TargetData* pNext; pTarget = fpTargetData; - while (pTarget != nil) { + while (pTarget != NULL) { pNext = pTarget->pNext; delete pTarget; pTarget = pNext; } - fpTargetData = nil; + fpTargetData = NULL; } diff --git a/app/DiskFSTree.h b/app/DiskFSTree.h index 90753a8..b615936 100644 --- a/app/DiskFSTree.h +++ b/app/DiskFSTree.h @@ -23,8 +23,8 @@ public: fIncludeSubdirs = false; fExpandDepth = 0; - fpDiskFS = nil; - fpTargetData = nil; + fpDiskFS = NULL; + fpTargetData = NULL; LoadTreeImages(); } virtual ~DiskFSTree(void) { FreeAllTargetData(); } diff --git a/app/EditAssocDialog.cpp b/app/EditAssocDialog.cpp index 782d73e..e7eedb3 100644 --- a/app/EditAssocDialog.cpp +++ b/app/EditAssocDialog.cpp @@ -32,7 +32,7 @@ EditAssocDialog::OnInitDialog(void) { CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_ASSOCIATION_LIST); - ASSERT(pListView != nil); + ASSERT(pListView != NULL); //pListView->ModifyStyleEx(0, LVS_EX_CHECKBOXES); ListView_SetExtendedListViewStyleEx(pListView->m_hWnd, LVS_EX_CHECKBOXES, LVS_EX_CHECKBOXES); @@ -49,7 +49,7 @@ EditAssocDialog::OnInitDialog(void) * Initialize this before DDX stuff happens. If the caller didn't * provide a set, load our own. */ - if (fOurAssociations == nil) { + if (fOurAssociations == NULL) { fOurAssociations = new bool[gMyApp.fRegistry.GetNumFileAssocs()]; Setup(true); } else { @@ -73,9 +73,9 @@ EditAssocDialog::Setup(bool loadAssoc) WMSG0("Setup!\n"); CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_ASSOCIATION_LIST); - ASSERT(pListView != nil); + ASSERT(pListView != NULL); - ASSERT(fOurAssociations != nil); + ASSERT(fOurAssociations != NULL); /* two columns */ CRect rect; @@ -115,8 +115,8 @@ EditAssocDialog::DoDataExchange(CDataExchange* pDX) { CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_ASSOCIATION_LIST); - ASSERT(fOurAssociations != nil); - if (fOurAssociations == nil) + ASSERT(fOurAssociations != NULL); + if (fOurAssociations == NULL) return; int num = gMyApp.fRegistry.GetNumFileAssocs(); diff --git a/app/EditAssocDialog.h b/app/EditAssocDialog.h index 3766f74..af10be1 100644 --- a/app/EditAssocDialog.h +++ b/app/EditAssocDialog.h @@ -16,9 +16,9 @@ */ class EditAssocDialog : public CDialog { public: - EditAssocDialog(CWnd* pParentWnd = nil) : + EditAssocDialog(CWnd* pParentWnd = NULL) : CDialog(IDD_ASSOCIATIONS, pParentWnd), - fOurAssociations(nil) + fOurAssociations(NULL) {} virtual ~EditAssocDialog() { delete[] fOurAssociations; diff --git a/app/EditPropsDialog.cpp b/app/EditPropsDialog.cpp index 880ce02..fd2d285 100644 --- a/app/EditPropsDialog.cpp +++ b/app/EditPropsDialog.cpp @@ -83,7 +83,7 @@ EditPropsDialog::OnInitDialog(void) int comboIdx; pCombo = (CComboBox*) GetDlgItem(IDC_PROPS_FILETYPE); - ASSERT(pCombo != nil); + ASSERT(pCombo != NULL); pCombo->InitStorage(256, 256 * 8); @@ -134,18 +134,18 @@ EditPropsDialog::OnInitDialog(void) CString dateStr; pWnd = GetDlgItem(IDC_PROPS_CREATEWHEN); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); FormatDate(fProps.createWhen, &dateStr); pWnd->SetWindowText(dateStr); pWnd = GetDlgItem(IDC_PROPS_MODWHEN); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); FormatDate(fProps.modWhen, &dateStr); pWnd->SetWindowText(dateStr); //WMSG2("USING DATE '%ls' from 0x%08lx\n", dateStr, fProps.modWhen); CEdit* pEdit = (CEdit*) GetDlgItem(IDC_PROPS_AUXTYPE); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); pEdit->SetLimitText(4); // max len of aux type str pEdit = (CEdit*) GetDlgItem(IDC_PROPS_HFS_FILETYPE); pEdit->SetLimitText(4); @@ -359,10 +359,10 @@ EditPropsDialog::OnTypeChange(void) CWnd* pWnd; int fileType, fileTypeIdx; long auxType; - const WCHAR* descr = nil; + const WCHAR* descr = NULL; pCombo = (CComboBox*) GetDlgItem(IDC_PROPS_FILETYPE); - ASSERT(pCombo != nil); + ASSERT(pCombo != NULL); fileTypeIdx = pCombo->GetCurSel(); fileType = pCombo->GetItemData(fileTypeIdx); @@ -373,12 +373,12 @@ EditPropsDialog::OnTypeChange(void) if (auxType < 0) auxType = 0; descr = PathProposal::FileTypeDescription(fileType, auxType); - if (descr == nil) + if (descr == NULL) descr = kUnknownFileType; } pWnd = GetDlgItem(IDC_PROPS_TYPEDESCR); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->SetWindowText(descr); /* DOS aux type only applies to BIN */ @@ -427,7 +427,7 @@ EditPropsDialog::UpdateHFSMode(void) pWnd->EnableWindow(FALSE); pWnd = GetDlgItem(IDC_PROPS_TYPEDESCR); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->SetWindowText(L"(HFS type)"); OnHFSTypeChange(); } else { @@ -483,7 +483,7 @@ long EditPropsDialog::GetAuxType(void) { CWnd* pWnd = GetDlgItem(IDC_PROPS_AUXTYPE); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); CString aux; pWnd->GetWindowText(aux); diff --git a/app/EnterRegDialog.cpp b/app/EnterRegDialog.cpp index 822eaef..5c566a4 100644 --- a/app/EnterRegDialog.cpp +++ b/app/EnterRegDialog.cpp @@ -27,7 +27,7 @@ BOOL EnterRegDialog::OnInitDialog(void) { //CWnd* pWnd = GetDlgItem(IDOK); - //ASSERT(pWnd != nil); + //ASSERT(pWnd != NULL); //pWnd->EnableWindow(false); fMyEdit.ReplaceDlgCtrl(this, IDC_REGENTER_REG); @@ -37,13 +37,13 @@ EnterRegDialog::OnInitDialog(void) straight into the registry */ CEdit* pEdit; pEdit = (CEdit*) GetDlgItem(IDC_REGENTER_USER); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); pEdit->SetLimitText(120); pEdit = (CEdit*) GetDlgItem(IDC_REGENTER_COMPANY); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); pEdit->SetLimitText(120); pEdit = (CEdit*) GetDlgItem(IDC_REGENTER_REG); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); pEdit->SetLimitText(40); return CDialog::OnInitDialog(); @@ -102,28 +102,28 @@ EnterRegDialog::HandleEditChange(int editID, int crcID) * Update the CRC for the modified control. */ pEdit = (CEdit*) GetDlgItem(editID); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); pEdit->GetWindowText(userStr); unsigned short crc; crc = gMyApp.fRegistry.ComputeStringCRC(userStr); userStr.Format("%04X", crc); pWnd = GetDlgItem(crcID); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->SetWindowText(userStr); /* * Update the OK button. */ pEdit = (CEdit*) GetDlgItem(IDC_REGENTER_USER); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); pEdit->GetWindowText(userStr); pEdit = (CEdit*) GetDlgItem(IDC_REGENTER_REG); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); pEdit->GetWindowText(regStr); pWnd = GetDlgItem(IDOK); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->EnableWindow(!userStr.IsEmpty() && !regStr.IsEmpty()); } diff --git a/app/EnterRegDialog.h b/app/EnterRegDialog.h index 868bcaa..3a82937 100644 --- a/app/EnterRegDialog.h +++ b/app/EnterRegDialog.h @@ -19,7 +19,7 @@ */ class EnterRegDialog : public CDialog { public: - EnterRegDialog(CWnd* pParent = nil) : CDialog(IDD_REGISTRATION, pParent) + EnterRegDialog(CWnd* pParent = NULL) : CDialog(IDD_REGISTRATION, pParent) { fDepth = 0; } virtual ~EnterRegDialog(void) {} diff --git a/app/ExtractOptionsDialog.cpp b/app/ExtractOptionsDialog.cpp index f593ea3..0edcd4c 100644 --- a/app/ExtractOptionsDialog.cpp +++ b/app/ExtractOptionsDialog.cpp @@ -39,7 +39,7 @@ ExtractOptionsDialog::OnInitDialog(void) /* grab the radio button with the selection count */ pWnd = GetDlgItem(IDC_EXT_SELECTED); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); /* set the count string using a string table entry */ if (fSelectedCount == 1) { @@ -156,11 +156,11 @@ void ExtractOptionsDialog::OnChangeTextConv(void) { CButton* pButton = (CButton*) GetDlgItem(IDC_EXT_CONVEOLNONE); - ASSERT(pButton != nil); + ASSERT(pButton != NULL); bool convDisabled = (pButton->GetCheck() == BST_CHECKED); CWnd* pWnd = GetDlgItem(IDC_EXT_CONVHIGHASCII); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->EnableWindow(!convDisabled); } @@ -176,7 +176,7 @@ ExtractOptionsDialog::OnChooseFolder(void) /* get the currently-showing text from the edit field */ pEditWnd = GetDlgItem(IDC_EXT_PATH); - ASSERT(pEditWnd != nil); + ASSERT(pEditWnd != NULL); pEditWnd->GetWindowText(editPath); chooseDir.SetPathName(editPath); diff --git a/app/FileNameConv.cpp b/app/FileNameConv.cpp index de2519b..eaca537 100644 --- a/app/FileNameConv.cpp +++ b/app/FileNameConv.cpp @@ -591,7 +591,7 @@ static const struct { /* * 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* 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; pathBuf = fLocalPathName.GetBuffer(newBufLen); - ASSERT(pathBuf != nil); + ASSERT(pathBuf != NULL); startp = fStoredPathName; dstp = pathBuf; @@ -654,17 +654,17 @@ PathProposal::ArchiveToLocal(void) } /* normalize all directory components and the filename component */ - while (startp != nil) { - endp = nil; + while (startp != NULL) { + endp = NULL; if (fStoredFssep != '\0') endp = wcschr(startp, fStoredFssep); - if (endp != nil && endp == startp) { + if (endp != NULL && endp == startp) { /* zero-length subdir component */ WMSG1("WARNING: zero-length subdir component in '%ls'\n", startp); startp++; continue; } - if (endp != nil) { + if (endp != NULL) { /* normalize directory component */ NormalizeDirectoryName(startp, endp - startp, fStoredFssep, &dstp, newBufLen); @@ -692,7 +692,7 @@ PathProposal::ArchiveToLocal(void) ASSERT(wcslen(extBuf) <= kMaxPathGrowth); 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) { WCHAR* lastFssep; lastFssep = wcsrchr(pathBuf, fLocalFssep); - if (lastFssep != nil) { + if (lastFssep != NULL) { ASSERT(*(lastFssep+1) != '\0'); /* should already have been caught*/ memmove(pathBuf, lastFssep+1, (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". */ 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[] = { 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", - nil + NULL }; /* @@ -755,7 +755,7 @@ PathProposal::Win32NormalizeFileName(const WCHAR* srcp, long srcLen, if (srcLen >= 3) { const WCHAR** ppcch; - for (ppcch = gFatReservedNames3; *ppcch != nil; ppcch++) { + for (ppcch = gFatReservedNames3; *ppcch != NULL; ppcch++) { if (wcsnicmp(srcp, *ppcch, 3) == 0 && (srcp[3] == '.' || srcLen == 3)) { @@ -773,7 +773,7 @@ PathProposal::Win32NormalizeFileName(const WCHAR* srcp, long srcLen, if (srcLen >= 4) { const WCHAR** ppcch; - for (ppcch = gFatReservedNames4; *ppcch != nil; ppcch++) { + for (ppcch = gFatReservedNames4; *ppcch != NULL; ppcch++) { if (wcsnicmp(srcp, *ppcch, 4) == 0 && (srcp[4] == '.' || srcLen == 4)) { @@ -798,7 +798,7 @@ PathProposal::Win32NormalizeFileName(const WCHAR* srcp, long srcLen, if (fPreservation) *dstp++ = *srcp; *dstp++ = *srcp++; - } else if (wcschr(kInvalid, *srcp) != nil || + } else if (wcschr(kInvalid, *srcp) != NULL || *srcp < 0x20 || *srcp >= 0x7f) { /* change invalid char to "%2f" or '_' */ @@ -837,11 +837,11 @@ void PathProposal::NormalizeFileName(const WCHAR* srcp, long srcLen, char fssep, WCHAR** pDstp, long dstLen) { - ASSERT(srcp != nil); + ASSERT(srcp != NULL); ASSERT(srcLen > 0); ASSERT(dstLen > srcLen); - ASSERT(pDstp != nil); - ASSERT(*pDstp != nil); + ASSERT(pDstp != NULL); + ASSERT(*pDstp != NULL); #if defined(UNIX_LIKE) UNIXNormalizeFileName(srcp, srcLen, fssep, pDstp, dstLen); @@ -877,8 +877,8 @@ PathProposal::AddPreservationString(const WCHAR* pathBuf, WCHAR* extBuf) { WCHAR* cp; - ASSERT(pathBuf != nil); - ASSERT(extBuf != nil); + ASSERT(pathBuf != NULL); + ASSERT(extBuf != NULL); ASSERT(fPreservation); cp = extBuf + wcslen(extBuf); @@ -914,9 +914,9 @@ PathProposal::AddPreservationString(const WCHAR* pathBuf, WCHAR* extBuf) void PathProposal::AddTypeExtension(const WCHAR* pathBuf, WCHAR* extBuf) { - const WCHAR* pPathExt = nil; - const WCHAR* pWantedExt = nil; - const WCHAR* pTypeExt = nil; + const WCHAR* pPathExt = NULL; + const WCHAR* pWantedExt = NULL; + const WCHAR* pTypeExt = NULL; WCHAR* end; WCHAR* cp; @@ -927,7 +927,7 @@ PathProposal::AddTypeExtension(const WCHAR* pathBuf, WCHAR* extBuf) * Note FindExtension guarantees there's at least one char after '.'. */ pPathExt = PathName::FindExtension(pathBuf, fLocalFssep); - if (pPathExt == nil) { + if (pPathExt == NULL) { /* * There's no extension on the filename. Use the standard * 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) { pTypeExt = FileTypeString(fFileType); if (pTypeExt[0] == '?' || pTypeExt[0] == '$') - pTypeExt = nil; + pTypeExt = NULL; } } else { 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. * If not, use the one from the file type. */ - if (pPathExt != nil) { + if (pPathExt != NULL) { pWantedExt = pPathExt; } else { 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. */ - if (pWantedExt != nil) { - if (extBuf[0] == '\0' && pPathExt != nil && + if (pWantedExt != NULL) { + if (extBuf[0] == '\0' && pPathExt != NULL && wcsicmp(pPathExt, pWantedExt) == 0) { /* don't add an extension that's already there */ - pWantedExt = nil; + pWantedExt = NULL; goto know_ext; } if (wcslen(pWantedExt) >= kMaxExtLen) { /* too long, forget it */ - pWantedExt = nil; + pWantedExt = NULL; goto know_ext; } /* if it's strictly decimal-numeric, don't use it (.1, .2, etc) */ (void) wcstoul(pWantedExt, &end, 10); if (*end == '\0') { - pWantedExt = nil; + pWantedExt = NULL; goto know_ext; } @@ -996,7 +996,7 @@ PathProposal::AddTypeExtension(const WCHAR* pathBuf, WCHAR* extBuf) const WCHAR* ccp = pWantedExt; while (*ccp != '\0') { if (*ccp == kPreserveIndic) { - pWantedExt = nil; + pWantedExt = NULL; goto know_ext; } ccp++; @@ -1005,10 +1005,10 @@ PathProposal::AddTypeExtension(const WCHAR* pathBuf, WCHAR* extBuf) 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 '.'. */ - if (pWantedExt != nil) { + if (pWantedExt != NULL) { *cp++ = kFilenameExtDelim; wcscpy(cp, pWantedExt); //cp += strlen(pWantedExt); @@ -1132,7 +1132,7 @@ PathProposal::LocalToArchive(const AddFilesDialog* pAddOpts) slashDotDotSlash[0] = kLocalFssep; slashDotDotSlash[3] = kLocalFssep; if ((livePathStr[0] == '.' && livePathStr[1] == '.') || - (wcsstr(livePathStr, slashDotDotSlash) != nil)) + (wcsstr(livePathStr, slashDotDotSlash) != NULL)) { WMSG1("Found dot dot in '%ls', keeping only filename\n", livePathStr); doJunk = true; @@ -1151,7 +1151,7 @@ PathProposal::LocalToArchive(const AddFilesDialog* pAddOpts) if (pAddOpts->fStripFolderNames || doJunk) { WCHAR* lastFssep; lastFssep = wcsrchr(livePathStr, kLocalFssep); - if (lastFssep != nil) { + if (lastFssep != NULL) { ASSERT(*(lastFssep+1) != '\0'); /* should already have been caught*/ memmove(livePathStr, lastFssep+1, (wcslen(lastFssep+1)+1) * sizeof(WCHAR)); @@ -1250,10 +1250,10 @@ PathProposal::InterpretExtension(const WCHAR* pathName) { const WCHAR* pExt; - ASSERT(pathName != nil); + ASSERT(pathName != NULL); pExt = PathName::FindExtension(pathName, fLocalFssep); - if (pExt != nil) + if (pExt != NULL) LookupExtension(pExt+1); } @@ -1276,10 +1276,10 @@ PathProposal::ExtractPreservationString(WCHAR* pathname) WCHAR* cp; int digitCount; - ASSERT(pathname != nil); + ASSERT(pathname != NULL); pPreserve = wcsrchr(pathname, kPreserveIndic); - if (pPreserve == nil) + if (pPreserve == NULL) return false; /* count up the #of hex digits */ @@ -1418,7 +1418,7 @@ PathProposal::StripDiskImageSuffix(WCHAR* pathName) int i; pExt = PathName::FindExtension(pathName, fLocalFssep); - if (pExt == nil || pExt == pathName) + if (pExt == NULL || pExt == pathName) return; for (i = 0; i < NELEM(diskExt); i++) { diff --git a/app/GenericArchive.cpp b/app/GenericArchive.cpp index 1b688c2..33ca0c1 100644 --- a/app/GenericArchive.cpp +++ b/app/GenericArchive.cpp @@ -50,11 +50,11 @@ */ GenericEntry::GenericEntry(void) { - fPathName = nil; - fFileName = nil; + fPathName = NULL; + fFileName = NULL; fFssep = '\0'; - fSubVolName = nil; - fDisplayName = nil; + fSubVolName = NULL; + fDisplayName = NULL; fFileType = 0; fAuxType = 0; fAccess = 0; @@ -75,8 +75,8 @@ GenericEntry::GenericEntry(void) fHasNonEmptyComment = false; fIndex = -1; - fpPrev = nil; - fpNext = nil; + fpPrev = NULL; + fpNext = NULL; fDamaged = fSuspicious = false; } @@ -97,15 +97,15 @@ GenericEntry::~GenericEntry(void) void GenericEntry::SetPathName(const WCHAR* path) { - ASSERT(path != nil && wcslen(path) > 0); - if (fPathName != nil) + ASSERT(path != NULL && wcslen(path) > 0); + if (fPathName != NULL) delete fPathName; fPathName = wcsdup(path); // nuke the derived fields - fFileName = nil; - fFileNameExtension = nil; + fFileName = NULL; + fFileNameExtension = NULL; delete[] fDisplayName; - fDisplayName = nil; + fDisplayName = NULL; /* * Warning: to be 100% pedantically correct here, we should NOT do this @@ -120,16 +120,16 @@ GenericEntry::SetPathName(const WCHAR* path) const WCHAR* GenericEntry::GetFileName(void) { - ASSERT(fPathName != nil); - if (fFileName == nil) + ASSERT(fPathName != NULL); + if (fFileName == NULL) fFileName = PathName::FilenameOnly(fPathName, fFssep); return fFileName; } const WCHAR* GenericEntry::GetFileNameExtension(void) { - ASSERT(fPathName != nil); - if (fFileNameExtension == nil) + ASSERT(fPathName != NULL); + if (fFileNameExtension == NULL) fFileNameExtension = PathName::FindExtension(fPathName, fFssep); return fFileNameExtension; } @@ -142,26 +142,26 @@ void GenericEntry::SetSubVolName(const WCHAR* name) { delete[] fSubVolName; - fSubVolName = nil; - if (name != nil) { + fSubVolName = NULL; + if (name != NULL) { fSubVolName = wcsdup(name); } } const WCHAR* GenericEntry::GetDisplayName(void) const { - ASSERT(fPathName != nil); - if (fDisplayName != nil) + ASSERT(fPathName != NULL); + if (fDisplayName != NULL) return fDisplayName; // TODO: hmm... GenericEntry* pThis = const_cast(this); int len = wcslen(fPathName) +1; - if (fSubVolName != nil) + if (fSubVolName != NULL) len += wcslen(fSubVolName) +1; pThis->fDisplayName = new WCHAR[len]; - if (fSubVolName != nil) { + if (fSubVolName != NULL) { WCHAR xtra[2] = { DiskFS::kDIFssep, '\0' }; wcscpy(pThis->fDisplayName, fSubVolName); wcscat(pThis->fDisplayName, xtra); @@ -214,7 +214,7 @@ GenericEntry::CheckHighASCII(const unsigned char* buffer, { bool isHighASCII; - ASSERT(buffer != nil); + ASSERT(buffer != NULL); ASSERT(count != 0); isHighASCII = true; @@ -492,27 +492,27 @@ GenericEntry::WriteConvert(FILE* fp, const char* buf, size_t len, void GenericArchive::AddEntry(GenericEntry* pEntry) { - if (fEntryHead == nil) { - ASSERT(fEntryTail == nil); + if (fEntryHead == NULL) { + ASSERT(fEntryTail == NULL); fEntryHead = pEntry; fEntryTail = pEntry; - ASSERT(pEntry->GetPrev() == nil); - ASSERT(pEntry->GetNext() == nil); + ASSERT(pEntry->GetPrev() == NULL); + ASSERT(pEntry->GetNext() == NULL); } else { - ASSERT(fEntryTail != nil); - ASSERT(pEntry->GetPrev() == nil); + ASSERT(fEntryTail != NULL); + ASSERT(pEntry->GetPrev() == NULL); pEntry->SetPrev(fEntryTail); - ASSERT(fEntryTail->GetNext() == nil); + ASSERT(fEntryTail->GetNext() == NULL); fEntryTail->SetNext(pEntry); fEntryTail = pEntry; } fNumEntries++; - //if (fEntryIndex != nil) { + //if (fEntryIndex != NULL) { // WMSG0("Resetting fEntryIndex\n"); // delete [] fEntryIndex; - // fEntryIndex = nil; + // fEntryIndex = NULL; //} } @@ -528,7 +528,7 @@ GenericArchive::DeleteEntries(void) WMSG1("Deleting %d archive entries\n", fNumEntries); pEntry = GetEntries(); - while (pEntry != nil) { + while (pEntry != NULL) { pNext = pEntry->GetNext(); delete pEntry; pEntry = pNext; @@ -536,7 +536,7 @@ GenericArchive::DeleteEntries(void) //delete [] fEntryIndex; fNumEntries = 0; - fEntryHead = fEntryTail = nil; + fEntryHead = fEntryTail = NULL; } #if 0 @@ -554,12 +554,12 @@ GenericArchive::CreateIndex(void) ASSERT(fNumEntries != 0); fEntryIndex = new GenericEntry*[fNumEntries]; - if (fEntryIndex == nil) + if (fEntryIndex == NULL) return; pEntry = GetEntries(); num = 0; - while (pEntry != nil) { + while (pEntry != NULL) { fEntryIndex[num] = pEntry; pEntry = pEntry->GetNext(); num++; @@ -585,7 +585,7 @@ GenericArchive::GenDerivedTempName(const WCHAR* filename) CString mangle(filename); int idx, len; - ASSERT(filename != nil); + ASSERT(filename != NULL); len = mangle.GetLength(); ASSERT(len > 0); @@ -676,11 +676,11 @@ GenericArchive::UNIXTimeToDateTime(const time_t* pWhen, NuDateTime* pDateTime) { struct tm* ptm; - ASSERT(pWhen != nil); - ASSERT(pDateTime != nil); + ASSERT(pWhen != NULL); + ASSERT(pDateTime != NULL); ptm = localtime(pWhen); - if (ptm == nil) { + if (ptm == NULL) { ASSERT(*pWhen == kDateNone || *pWhen == kDateInvalid); memset(pDateTime, 0, sizeof(*pDateTime)); return; @@ -710,9 +710,9 @@ GenericArchive::GetFileDetails(const AddFilesDialog* pAddOpts, //char* livePathStr; time_t now; - ASSERT(pAddOpts != nil); - ASSERT(pathname != nil); - ASSERT(pDetails != nil); + ASSERT(pAddOpts != NULL); + ASSERT(pathname != NULL); + ASSERT(pDetails != NULL); /* init to defaults */ //pDetails->threadID = kNuThreadIDDataFork; @@ -744,7 +744,7 @@ GenericArchive::GetFileDetails(const AddFilesDialog* pAddOpts, } #endif - now = time(nil); + now = time(NULL); UNIXTimeToDateTime(&now, &pDetails->archiveWhen); UNIXTimeToDateTime(&psb->st_mtime, &pDetails->modWhen); UNIXTimeToDateTime(&psb->st_ctime, &pDetails->createWhen); @@ -817,14 +817,14 @@ static const WCHAR kWildMatchAll[] = L"*.*"; Win32dirent* GenericArchive::OpenDir(const WCHAR* name) { - Win32dirent* dir = nil; - WCHAR* tmpStr = nil; + Win32dirent* dir = NULL; + WCHAR* tmpStr = NULL; WCHAR* cp; WIN32_FIND_DATA fnd; dir = (Win32dirent*) malloc(sizeof(*dir)); tmpStr = (WCHAR*) malloc((wcslen(name) + 2 + wcslen(kWildMatchAll)) * sizeof(WCHAR)); - if (dir == nil || tmpStr == nil) + if (dir == NULL || tmpStr == NULL) goto failed; wcscpy(tmpStr, name); @@ -854,14 +854,14 @@ bail: failed: free(dir); - dir = nil; + dir = NULL; goto bail; } /* * 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* GenericArchive::ReadDir(Win32dirent* dir) @@ -872,7 +872,7 @@ GenericArchive::ReadDir(Win32dirent* dir) WIN32_FIND_DATA fnd; if (!FindNextFile(dir->d_hFindFile, &fnd)) - return nil; + return NULL; wcscpy(dir->d_name, fnd.cFileName); dir->d_attr = (unsigned char) fnd.dwFileAttributes; } @@ -886,7 +886,7 @@ GenericArchive::ReadDir(Win32dirent* dir) void GenericArchive::CloseDir(Win32dirent* dir) { - if (dir == nil) + if (dir == NULL) return; FindClose(dir->d_hFindFile); @@ -903,19 +903,19 @@ GenericArchive::Win32AddDirectory(const AddFilesDialog* pAddOpts, const WCHAR* dirName, CString* pErrMsg) { NuError err = kNuErrNone; - Win32dirent* dirp = nil; + Win32dirent* dirp = NULL; Win32dirent* entry; WCHAR nbuf[MAX_PATH]; /* malloc might be better; this soaks stack */ char fssep; int len; - ASSERT(pAddOpts != nil); - ASSERT(dirName != nil); + ASSERT(pAddOpts != NULL); + ASSERT(dirName != NULL); WMSG1("+++ DESCEND: '%ls'\n", dirName); dirp = OpenDir(dirName); - if (dirp == nil) { + if (dirp == NULL) { if (errno == ENOTDIR) err = kNuErrNotDir; else @@ -928,7 +928,7 @@ GenericArchive::Win32AddDirectory(const AddFilesDialog* pAddOpts, fssep = PathProposal::kLocalFssep; /* 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 */ if (wcscmp(entry->d_name, L".") == 0 || wcscmp(entry->d_name, L"..") == 0) @@ -956,7 +956,7 @@ GenericArchive::Win32AddDirectory(const AddFilesDialog* pAddOpts, } bail: - if (dirp != nil) + if (dirp != NULL) (void)CloseDir(dirp); return err; } @@ -977,8 +977,8 @@ GenericArchive::Win32AddFile(const AddFilesDialog* pAddOpts, FileDetails details; struct _stat sb; - ASSERT(pAddOpts != nil); - ASSERT(pathname != nil); + ASSERT(pAddOpts != NULL); + ASSERT(pathname != NULL); PathName checkPath(pathname); 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 * 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 * from the directory read call and won't have to check it again in * GSOSAddFile. ] @@ -1200,10 +1200,10 @@ SelectionSet::CreateFromSelection(ContentList* pContentList, int threadMask) POSITION posn; posn = pContentList->GetFirstSelectedItemPosition(); - ASSERT(posn != nil); - if (posn == nil) + ASSERT(posn != NULL); + if (posn == NULL) return; - while (posn != nil) { + while (posn != NULL) { int num = pContentList->GetNextSelectedItem(/*ref*/ posn); GenericEntry* pEntry = (GenericEntry*) pContentList->GetItemData(num); @@ -1286,17 +1286,17 @@ SelectionSet::AddToSet(GenericEntry* pEntry, int threadMask) void SelectionSet::AddEntry(SelectionEntry* pEntry) { - if (fEntryHead == nil) { - ASSERT(fEntryTail == nil); + if (fEntryHead == NULL) { + ASSERT(fEntryTail == NULL); fEntryHead = pEntry; fEntryTail = pEntry; - ASSERT(pEntry->GetPrev() == nil); - ASSERT(pEntry->GetNext() == nil); + ASSERT(pEntry->GetPrev() == NULL); + ASSERT(pEntry->GetNext() == NULL); } else { - ASSERT(fEntryTail != nil); - ASSERT(pEntry->GetPrev() == nil); + ASSERT(fEntryTail != NULL); + ASSERT(pEntry->GetPrev() == NULL); pEntry->SetPrev(fEntryTail); - ASSERT(fEntryTail->GetNext() == nil); + ASSERT(fEntryTail->GetNext() == NULL); fEntryTail->SetNext(pEntry); fEntryTail = pEntry; } @@ -1316,7 +1316,7 @@ SelectionSet::DeleteEntries(void) WMSG0("Deleting selection entries\n"); pEntry = GetEntries(); - while (pEntry != nil) { + while (pEntry != NULL) { pNext = pEntry->GetNext(); delete pEntry; pEntry = pNext; @@ -1335,7 +1335,7 @@ SelectionSet::CountMatchingPrefix(const WCHAR* prefix) ASSERT(len > 0); pEntry = GetEntries(); - while (pEntry != nil) { + while (pEntry != NULL) { GenericEntry* pGeneric = pEntry->GetEntry(); if (wcsnicmp(prefix, pGeneric->GetDisplayName(), len) == 0) @@ -1357,7 +1357,7 @@ SelectionSet::Dump(void) WMSG1("SelectionSet: %d entries\n", fNumEntries); pEntry = fEntryHead; - while (pEntry != nil) { + while (pEntry != NULL) { WMSG1(" : name='%ls'\n", pEntry->GetEntry()->GetPathName()); pEntry = pEntry->GetNext(); } diff --git a/app/GenericArchive.h b/app/GenericArchive.h index f14d6ac..a007bb5 100644 --- a/app/GenericArchive.h +++ b/app/GenericArchive.h @@ -52,7 +52,7 @@ typedef struct FileProps { class XferFileOptions { public: XferFileOptions(void) : - fTarget(nil), fPreserveEmptyFolders(false), fpTargetFS(nil) + fTarget(NULL), fPreserveEmptyFolders(false), fpTargetFS(NULL) {} ~XferFileOptions(void) {} @@ -245,7 +245,7 @@ private: const WCHAR* fFileName; // points within fPathName const WCHAR* fFileNameExtension; // points within fPathName 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 long fFileType; long fAuxType; @@ -285,11 +285,11 @@ private: class GenericArchive { public: GenericArchive(void) { - fPathName = nil; + fPathName = NULL; fNumEntries = 0; - fEntryHead = fEntryTail = nil; + fEntryHead = fEntryTail = NULL; fReloadFlag = true; - //fEntryIndex = nil; + //fEntryIndex = NULL; } virtual ~GenericArchive(void) { //WMSG0("Deleting GenericArchive\n"); @@ -305,7 +305,7 @@ public: } //virtual GenericEntry* GetEntry(long num) { // ASSERT(num >= 0 && num < fNumEntries); - // if (fEntryIndex == nil) + // if (fEntryIndex == NULL) // CreateIndex(); // return fEntryIndex[num]; //} @@ -563,10 +563,10 @@ protected: void SetPathName(const WCHAR* pathName) { free(fPathName); - if (pathName != nil) { + if (pathName != NULL) { fPathName = _wcsdup(pathName); } else { - fPathName = nil; + fPathName = NULL; } } @@ -595,7 +595,7 @@ public: //fThreadKind = threadKind; //fFilter = filter; //fReformatName = ""; - fpPrev = fpNext = nil; + fpPrev = fpNext = NULL; } ~SelectionEntry(void) {} @@ -634,7 +634,7 @@ class SelectionSet { public: SelectionSet(void) { fNumEntries = 0; - fEntryHead = fEntryTail = fIterCurrent = nil; + fEntryHead = fEntryTail = fIterCurrent = NULL; } ~SelectionSet(void) { DeleteEntries(); @@ -649,18 +649,18 @@ public: SelectionEntry* GetEntries(void) const { return fEntryHead; } void IterReset(void) { - fIterCurrent = nil; + fIterCurrent = NULL; } // move to the next or previous entry as part of iterating SelectionEntry* IterPrev(void) { - if (fIterCurrent == nil) + if (fIterCurrent == NULL) fIterCurrent = fEntryTail; else fIterCurrent = fIterCurrent->GetPrev(); return fIterCurrent; } SelectionEntry* IterNext(void) { - if (fIterCurrent == nil) + if (fIterCurrent == NULL) fIterCurrent = fEntryHead; else fIterCurrent = fIterCurrent->GetNext(); @@ -670,16 +670,16 @@ public: return fIterCurrent; } bool IterHasPrev(void) const { - if (fIterCurrent == nil) - return fEntryTail != nil; + if (fIterCurrent == NULL) + return fEntryTail != NULL; else - return (fIterCurrent->GetPrev() != nil); + return (fIterCurrent->GetPrev() != NULL); } bool IterHasNext(void) const { - if (fIterCurrent == nil) - return fEntryHead != nil; + if (fIterCurrent == NULL) + return fEntryHead != NULL; else - return (fIterCurrent->GetNext() != nil); + return (fIterCurrent->GetNext() != NULL); } int GetNumEntries(void) const { return fNumEntries; } diff --git a/app/ImageFormatDialog.cpp b/app/ImageFormatDialog.cpp index f7816b6..4d75e13 100644 --- a/app/ImageFormatDialog.cpp +++ b/app/ImageFormatDialog.cpp @@ -44,7 +44,7 @@ static const ConvTable gOuterFormats[] = { { DiskImg::kOuterFormatGzip, L"gzip" }, // { DiskImg::kOuterFormatBzip2, L"bzip2" }, { DiskImg::kOuterFormatZip, L"Zip archive" }, - { kLastEntry, nil } + { kLastEntry, NULL } }; /* DiskImg::FileFormat */ static const ConvTable gFileFormats[] = { @@ -60,7 +60,7 @@ static const ConvTable gFileFormats[] = { { DiskImg::kFileFormatTrackStar, L"TrackStar image" }, { DiskImg::kFileFormatFDI, L"FDI image" }, // { DiskImg::kFileFormatDDDDeluxe, L"DDDDeluxe" }, - { kLastEntry, nil } + { kLastEntry, NULL } }; /* DiskImg::PhysicalFormat */ static const ConvTable gPhysicalFormats[] = { @@ -69,7 +69,7 @@ static const ConvTable gPhysicalFormats[] = { { DiskImg::kPhysicalFormatNib525_6656, L"Raw nibbles (6656-byte)" }, { DiskImg::kPhysicalFormatNib525_6384, L"Raw nibbles (6384-byte)" }, { DiskImg::kPhysicalFormatNib525_Var, L"Raw nibbles (variable len)" }, - { kLastEntry, nil } + { kLastEntry, NULL } }; /* DiskImg::SectorOrder */ static const ConvTable gSectorOrders[] = { @@ -78,7 +78,7 @@ static const ConvTable gSectorOrders[] = { { DiskImg::kSectorOrderDOS, L"DOS sector ordering" }, { DiskImg::kSectorOrderCPM, L"CP/M block ordering" }, { DiskImg::kSectorOrderPhysical, L"Physical sector ordering" }, - { kLastEntry, nil } + { kLastEntry, NULL } }; /* DiskImg::FSFormat */ static const ConvTable gFSFormats[] = { @@ -107,7 +107,7 @@ static const ConvTable gFSFormats[] = { { DiskImg::kFormatRDOS33, L"RDOS 3.3 (16-sector)" }, { DiskImg::kFormatRDOS32, L"RDOS 3.2 (13-sector)" }, { DiskImg::kFormatRDOS3, L"RDOS 3 (cracked 13-sector)" }, - { kLastEntry, nil } + { kLastEntry, NULL } }; @@ -169,24 +169,24 @@ ImageFormatDialog::LoadComboBoxes(void) CButton* pButton; pWnd = GetDlgItem(IDC_DECONF_SOURCE); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->SetWindowText(fFileSource); if (fQueryDisplayFormat) { pButton = (CButton*) GetDlgItem(IDC_DECONF_VIEWASSECTORS); - ASSERT(pButton != nil); + ASSERT(pButton != NULL); pButton->SetCheck(fDisplayFormat == kShowAsSectors); if (!fHasSectors) pButton->EnableWindow(FALSE); pButton = (CButton*) GetDlgItem(IDC_DECONF_VIEWASBLOCKS); - ASSERT(pButton != nil); + ASSERT(pButton != NULL); pButton->SetCheck(fDisplayFormat == kShowAsBlocks); if (!fHasBlocks) pButton->EnableWindow(FALSE); pButton = (CButton*) GetDlgItem(IDC_DECONF_VIEWASNIBBLES); - ASSERT(pButton != nil); + ASSERT(pButton != NULL); pButton->SetCheck(fDisplayFormat == kShowAsNibbles); if (!fHasNibbles) pButton->EnableWindow(FALSE); @@ -222,7 +222,7 @@ ImageFormatDialog::LoadComboBox(int boxID, const ConvTable* pTable, int dflt) int idx, idxShift; pCombo = (CComboBox*) GetDlgItem(boxID); - ASSERT(pCombo != nil); + ASSERT(pCombo != NULL); idx = idxShift = 0; while (pTable[idx].enumval != kLastEntry) { @@ -264,7 +264,7 @@ ImageFormatDialog::ConvComboSel(int boxID, const ConvTable* pTable) int idx, enumval; pCombo = (CComboBox*) GetDlgItem(boxID); - ASSERT(pCombo != nil); + ASSERT(pCombo != NULL); idx = pCombo->GetCurSel(); if (idx < 0) { @@ -298,17 +298,17 @@ ImageFormatDialog::OnOK(void) if (fQueryDisplayFormat) { pButton = (CButton*) GetDlgItem(IDC_DECONF_VIEWASSECTORS); - ASSERT(pButton != nil); + ASSERT(pButton != NULL); if (pButton->GetCheck()) fDisplayFormat = kShowAsSectors; pButton = (CButton*) GetDlgItem(IDC_DECONF_VIEWASBLOCKS); - ASSERT(pButton != nil); + ASSERT(pButton != NULL); if (pButton->GetCheck()) fDisplayFormat = kShowAsBlocks; pButton = (CButton*) GetDlgItem(IDC_DECONF_VIEWASNIBBLES); - ASSERT(pButton != nil); + ASSERT(pButton != NULL); if (pButton->GetCheck()) fDisplayFormat = kShowAsNibbles; } diff --git a/app/Main.cpp b/app/Main.cpp index 64e7d08..59e8bc7 100644 --- a/app/Main.cpp +++ b/app/Main.cpp @@ -199,20 +199,20 @@ MainWindow::MainWindow() { static const WCHAR kAppName[] = L"CiderPress"; - fpContentList = nil; - fpOpenArchive = nil; - //fpSelSet = nil; - fpActionProgress = nil; - fpProgressCounter = nil; - fpFindDialog = nil; + fpContentList = NULL; + fpOpenArchive = NULL; + //fpSelSet = NULL; + fpActionProgress = NULL; + fpProgressCounter = NULL; + fpFindDialog = NULL; fFindDown = true; fFindMatchCase = false; fFindMatchWholeWord = false; fAbortPrinting = false; - fhDevMode = nil; - fhDevNames = nil; + fhDevMode = NULL; + fhDevNames = NULL; fNeedReopen = false; 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 * things back where they're supposed to be. */ - if (fpContentList != nil) { + if (fpContentList != NULL) { /* get the current column 0 width, with current user adjustments */ fpContentList->ExportColumnWidths(); 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 * and it has pending modifications. Remove it if nothing is pending. */ - if (fpOpenArchive != nil) { + if (fpOpenArchive != NULL) { CString title; int len; @@ -368,11 +368,11 @@ MainWindow::ProcessCommandLine(void) * Get the command line and break it down into an argument vector. */ const WCHAR* cmdLine = ::GetCommandLine(); - if (cmdLine == nil || wcslen(cmdLine) == 0) + if (cmdLine == NULL || wcslen(cmdLine) == 0) return; WCHAR* mangle = wcsdup(cmdLine); - if (mangle == nil) + if (mangle == NULL) return; WMSG1("Mangling '%ls'\n", mangle); @@ -388,8 +388,8 @@ MainWindow::ProcessCommandLine(void) /* * Figure out what the arguments are. */ - const WCHAR* filename = nil; - const WCHAR* dispName = nil; + const WCHAR* filename = NULL; + const WCHAR* dispName = NULL; int filterIndex = kFilterIndexGeneric; bool temp = false; @@ -438,15 +438,15 @@ MainWindow::ProcessCommandLine(void) break; } } - if (argc != 1 && filename == nil) { + if (argc != 1 && filename == NULL) { WMSG0("WARNING: args specified but no filename found\n"); } WMSG0("Argument handling:\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); CString ext = path.GetExtension(); @@ -461,7 +461,7 @@ MainWindow::ProcessCommandLine(void) fOpenArchivePathName = path.GetFileName(); else fOpenArchivePathName = filename; - if (dispName != nil) + if (dispName != NULL) fOpenArchivePathName = dispName; SetCPTitle(fOpenArchivePathName, fpOpenArchive); } @@ -716,7 +716,7 @@ MainWindow::OnPaint(void) * If there's no control in the window, fill in the client area with * what looks like an empty MDI client rect. */ - if (fpContentList == nil) { + if (fpContentList == NULL) { DrawEmptyClientArea(&dc, clientRect); } @@ -746,7 +746,7 @@ MainWindow::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) wparam = nFlags | (zDelta << 16); lparam = pt.x | (pt.y << 16); - if (fpContentList != nil) + if (fpContentList != NULL) fpContentList->SendMessage(WM_MOUSEWHEEL, wparam, lparam); return CWnd::OnMouseWheel(nFlags, zDelta, pt); // return TRUE; @@ -759,7 +759,7 @@ MainWindow::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) void MainWindow::OnSetFocus(CWnd* /*pOldWnd*/) { - if (fpContentList != nil) { + if (fpContentList != NULL) { WMSG0("Returning focus to ContentList\n"); fpContentList->SetFocus(); } @@ -804,7 +804,7 @@ MainWindow::OnEditPreferences(void) ColumnLayout* pColLayout = fPreferences.GetColumnLayout(); /* pull any user header tweaks out of list so we can configure prefs */ - if (fpContentList != nil) + if (fpContentList != NULL) fpContentList->ExportColumnWidths(); /* set up PrefsGeneralPage */ @@ -909,7 +909,7 @@ MainWindow::ApplyNow(PrefsSheet* pPS) pColLayout->SetColumnWidth(i, 0); } } - if (fpContentList != nil) + if (fpContentList != NULL) fpContentList->NewColumnWidths(); fPreferences.SetPrefBool(kPrMimicShrinkIt, pPS->fGeneralPage.fMimicShrinkIt != 0); @@ -935,7 +935,7 @@ MainWindow::ApplyNow(PrefsSheet* pPS) fPreferences.SetPrefBool(kPrPasteJunkPaths, pPS->fGeneralPage.fPasteJunkPaths != 0); fPreferences.SetPrefBool(kPrBeepOnSuccess, pPS->fGeneralPage.fBeepOnSuccess != 0); - if (pPS->fGeneralPage.fOurAssociations != nil) { + if (pPS->fGeneralPage.fOurAssociations != NULL) { WMSG0("NEW ASSOCIATIONS!\n"); 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[] pPS->fGeneralPage.fOurAssociations; - pPS->fGeneralPage.fOurAssociations = nil; + pPS->fGeneralPage.fOurAssociations = NULL; } fPreferences.SetPrefBool(kPrQueryImageFormat, pPS->fDiskImagePage.fQueryImageFormat != 0); @@ -1002,14 +1002,14 @@ MainWindow::ApplyNow(PrefsSheet* pPS) // } /* allow open archive to track changes to preferences */ - if (fpOpenArchive != nil) + if (fpOpenArchive != NULL) fpOpenArchive->PreferencesChanged(); if (mustReload) { WMSG0("Preferences apply requesting GA/CL reload\n"); - if (fpOpenArchive != nil) + if (fpOpenArchive != NULL) fpOpenArchive->Reload(); - if (fpContentList != nil) + if (fpContentList != NULL) fpContentList->Reload(); } @@ -1027,7 +1027,7 @@ MainWindow::OnEditFind(void) { DWORD flags = 0; - if (fpFindDialog != nil) + if (fpFindDialog != NULL) return; if (fFindDown) @@ -1048,7 +1048,7 @@ MainWindow::OnEditFind(void) void MainWindow::OnUpdateEditFind(CCmdUI* pCmdUI) { - pCmdUI->Enable(fpOpenArchive != nil); + pCmdUI->Enable(fpOpenArchive != NULL); } /* @@ -1057,14 +1057,14 @@ MainWindow::OnUpdateEditFind(CCmdUI* pCmdUI) LRESULT MainWindow::OnFindDialogMessage(WPARAM wParam, LPARAM lParam) { - assert(fpFindDialog != nil); + assert(fpFindDialog != NULL); fFindDown = (fpFindDialog->SearchDown() != 0); fFindMatchCase = (fpFindDialog->MatchCase() != 0); fFindMatchWholeWord = (fpFindDialog->MatchWholeWord() != 0); if (fpFindDialog->IsTerminating()) { - fpFindDialog = nil; + fpFindDialog = NULL; return 0; } @@ -1093,7 +1093,7 @@ MainWindow::OnEditSort(UINT id) ASSERT(id >= IDM_SORT_PATHNAME && id <= IDM_SORT_ORIGINAL); fPreferences.GetColumnLayout()->SetSortColumn(id - IDM_SORT_PATHNAME); fPreferences.GetColumnLayout()->SetAscending(true); - if (fpContentList != nil) + if (fpContentList != NULL) fpContentList->NewSortOrder(); } void @@ -1163,7 +1163,7 @@ MainWindow::OnHelpAbout(void) * User could've changed registration. If we're showing the registered * user name in the title bar, update it. */ - if (fpOpenArchive == nil) + if (fpOpenArchive == NULL) SetCPTitle(); } @@ -1202,7 +1202,7 @@ MainWindow::OnFileNewArchive(void) } pOpenArchive = new NufxArchive; - errStr = pOpenArchive->New(filename, nil); + errStr = pOpenArchive->New(filename, NULL); if (!errStr.IsEmpty()) { CString failed; failed.LoadString(IDS_FAILED); @@ -1299,7 +1299,7 @@ MainWindow::DoOpenArchive(const WCHAR* pathName, const WCHAR* ext, SetCPTitle(fOpenArchivePathName, fpOpenArchive); } else { /* some failures will close an open archive */ - //if (fpOpenArchive == nil) + //if (fpOpenArchive == NULL) // SetCPTitle(); } } @@ -1318,7 +1318,7 @@ MainWindow::OnFileReopen(void) void MainWindow::OnUpdateFileReopen(CCmdUI* pCmdUI) { - pCmdUI->Enable(fpOpenArchive != nil); + pCmdUI->Enable(fpOpenArchive != NULL); } @@ -1333,7 +1333,7 @@ MainWindow::OnFileSave(void) { CString errMsg; - if (fpOpenArchive == nil) + if (fpOpenArchive == NULL) return; { @@ -1349,7 +1349,7 @@ MainWindow::OnFileSave(void) void MainWindow::OnUpdateFileSave(CCmdUI* pCmdUI) { - pCmdUI->Enable(fpOpenArchive != nil && fpOpenArchive->IsModified()); + pCmdUI->Enable(fpOpenArchive != NULL && fpOpenArchive->IsModified()); } /* @@ -1365,7 +1365,7 @@ MainWindow::OnFileClose(void) void MainWindow::OnUpdateFileClose(CCmdUI* pCmdUI) { - pCmdUI->Enable(fpOpenArchive != nil); + pCmdUI->Enable(fpOpenArchive != NULL); } @@ -1375,8 +1375,8 @@ MainWindow::OnUpdateFileClose(CCmdUI* pCmdUI) void MainWindow::OnFileArchiveInfo(void) { - ArchiveInfoDialog* pDlg = nil; - ASSERT(fpOpenArchive != nil); + ArchiveInfoDialog* pDlg = NULL; + ASSERT(fpOpenArchive != NULL); switch (fpOpenArchive->GetArchiveKind()) { case GenericArchive::kArchiveNuFX: @@ -1404,7 +1404,7 @@ MainWindow::OnFileArchiveInfo(void) void MainWindow::OnUpdateFileArchiveInfo(CCmdUI* pCmdUI) { - pCmdUI->Enable(fpContentList != nil); + pCmdUI->Enable(fpContentList != NULL); } /* @@ -1418,7 +1418,7 @@ MainWindow::OnFilePrint(void) void 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 MainWindow::OnEditSelectAll(void) { - ASSERT(fpContentList != nil); + ASSERT(fpContentList != NULL); fpContentList->SelectAll(); } void MainWindow::OnUpdateEditSelectAll(CCmdUI* pCmdUI) { - pCmdUI->Enable(fpContentList != nil); + pCmdUI->Enable(fpContentList != NULL); } /* @@ -1493,13 +1493,13 @@ MainWindow::OnUpdateEditSelectAll(CCmdUI* pCmdUI) void MainWindow::OnEditInvertSelection(void) { - ASSERT(fpContentList != nil); + ASSERT(fpContentList != NULL); fpContentList->InvertSelection(); } void 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 * 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. */ GenericEntry* MainWindow::GetSelectedItem(ContentList* pContentList) { if (pContentList->GetSelectedCount() != 1) - return nil; + return NULL; POSITION posn; posn = pContentList->GetFirstSelectedItemPosition(); - if (posn == nil) { + if (posn == NULL) { ASSERT(false); - return nil; + return NULL; } int num = pContentList->GetNextSelectedItem(/*ref*/ posn); GenericEntry* pEntry = (GenericEntry*) pContentList->GetItemData(num); - if (pEntry == nil) { + if (pEntry == NULL) { WMSG1(" Glitch: couldn't find entry %d\n", num); ASSERT(false); } @@ -1544,7 +1544,7 @@ MainWindow::HandleDoubleClick(void) { bool handled = false; - ASSERT(fpContentList != nil); + ASSERT(fpContentList != NULL); if (fpContentList->GetSelectedCount() == 0) { /* nothing selected, they double-clicked outside first column */ WMSG0("Double-click but nothing selected\n"); @@ -1560,7 +1560,7 @@ MainWindow::HandleDoubleClick(void) * Find the GenericEntry that corresponds to this item. */ GenericEntry* pEntry = GetSelectedItem(fpContentList); - if (pEntry == nil) + if (pEntry == NULL) return; WMSG1(" Double-click GOT '%ls'\n", pEntry->GetPathName()); @@ -1593,12 +1593,12 @@ MainWindow::HandleDoubleClick(void) */ CString extViewerExts; 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); TmpExtractForExternal(pEntry); handled = true; } else if (pEntry->GetRecordKind() == GenericEntry::kRecordKindFile) { - if ((ext != nil && ( + if ((ext != NULL && ( wcsicmp(ext, L".shk") == 0 || wcsicmp(ext, L".sdk") == 0 || wcsicmp(ext, L".bxy") == 0)) || @@ -1608,7 +1608,7 @@ MainWindow::HandleDoubleClick(void) TmpExtractAndOpen(pEntry, GenericEntry::kDataThread, kModeNuFX); handled = true; } else - if ((ext != nil && ( + if ((ext != NULL && ( wcsicmp(ext, L".bny") == 0 || wcsicmp(ext, L".bqy") == 0)) || (fileType == 0xe0 && auxType == 0x8000)) @@ -1617,7 +1617,7 @@ MainWindow::HandleDoubleClick(void) TmpExtractAndOpen(pEntry, GenericEntry::kDataThread, kModeBinaryII); handled = true; } else - if ((ext != nil && ( + if ((ext != NULL && ( wcsicmp(ext, L".acu") == 0)) || (fileType == 0xe0 && auxType == 0x8001)) { @@ -1693,7 +1693,7 @@ MainWindow::TmpExtractAndOpen(GenericEntry* pEntry, int threadKind, FILE* fp; fp = _wfopen(nameBuf, L"wb"); - if (fp != nil) { + if (fp != NULL) { WMSG2("Extracting to '%ls' (unique=%d)\n", nameBuf, unique); result = pEntry->ExtractThreadToFile(threadKind, fp, GenericEntry::kConvertEOLOff, GenericEntry::kConvertHAOff, @@ -1783,7 +1783,7 @@ MainWindow::TmpExtractForExternal(GenericEntry* pEntry) FILE* fp; fp = _wfopen(nameBuf, L"wb"); - if (fp != nil) { + if (fp != NULL) { fDeleteList.Add(nameBuf); // second file created by fopen WMSG2("Extracting to '%ls' (unique=%d)\n", nameBuf, unique); result = pEntry->ExtractThreadToFile(GenericEntry::kDataThread, fp, @@ -1826,7 +1826,7 @@ MainWindow::OnRtClkDefault(void) { int idx; - ASSERT(fpContentList != nil); + ASSERT(fpContentList != NULL); idx = fpContentList->GetRightClickItem(); ASSERT(idx != -1); @@ -1854,7 +1854,7 @@ MainWindow::OnRtClkDefault(void) void MainWindow::SetProgressBegin(void) { - if (fpActionProgress != nil) + if (fpActionProgress != NULL) fpActionProgress->SetProgress(0); else fStatusBar.SetPaneText(kProgressPane, L"--%"); @@ -1870,11 +1870,11 @@ MainWindow::SetProgressUpdate(int percent, const WCHAR* oldName, { int status = IDOK; - if (fpActionProgress != nil) { + if (fpActionProgress != NULL) { status = fpActionProgress->SetProgress(percent); - if (oldName != nil) + if (oldName != NULL) fpActionProgress->SetArcName(oldName); - if (newName != nil) + if (newName != NULL) fpActionProgress->SetFileName(newName); } else { WCHAR buf[8]; @@ -1894,7 +1894,7 @@ MainWindow::SetProgressUpdate(int percent, const WCHAR* oldName, void MainWindow::SetProgressEnd(void) { - if (fpActionProgress != nil) + if (fpActionProgress != NULL) fpActionProgress->SetProgress(100); else 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 */ ASSERT(!IsWindowEnabled()); - if (fpProgressCounter != nil) { + if (fpProgressCounter != NULL) { //WMSG2("SetProgressCounter '%ls' %d\n", str, val); CString msg; - if (str != nil) + if (str != NULL) fpProgressCounter->SetCounterFormat(str); fpProgressCounter->SetCount((int) val); } else { @@ -1940,7 +1940,7 @@ MainWindow::SetProgressCounter(const WCHAR* str, long val) } //EventPause(10); // DEBUG DEBUG - if (fpProgressCounter != nil) + if (fpProgressCounter != NULL) return !fpProgressCounter->GetCancel(); else return true; @@ -2077,7 +2077,7 @@ MainWindow::LoadArchive(const WCHAR* fileName, const WCHAR* extension, { GenericArchive::OpenResult openResult; int result = -1; - GenericArchive* pOpenArchive = nil; + GenericArchive* pOpenArchive = NULL; int origFilterIndex = filterIndex; CString errStr, appName; @@ -2152,7 +2152,7 @@ try_again: goto bail; } else if (openResult == GenericArchive::kResultFileArchive) { delete pOpenArchive; - pOpenArchive = nil; + pOpenArchive = NULL; if (wcsicmp(extension, L"zip") == 0) { errStr = "ZIP archives with multiple files are not supported."; @@ -2201,11 +2201,11 @@ try_again: SwitchContentList(pOpenArchive); - pOpenArchive = nil; + pOpenArchive = NULL; result = 0; bail: - if (pOpenArchive != nil) { + if (pOpenArchive != NULL) { ASSERT(result != 0); delete pOpenArchive; } @@ -2238,7 +2238,7 @@ MainWindow::DoOpenVolume(CString drive, bool readOnly) /* close existing archive */ CloseArchive(); - GenericArchive* pOpenArchive = nil; + GenericArchive* pOpenArchive = NULL; pOpenArchive = new DiskArchive; { CWaitCursor waitc; @@ -2257,7 +2257,7 @@ MainWindow::DoOpenVolume(CString drive, bool readOnly) // success! SwitchContentList(pOpenArchive); - pOpenArchive = nil; + pOpenArchive = NULL; fOpenArchivePathName = drive; result = 0; @@ -2265,7 +2265,7 @@ MainWindow::DoOpenVolume(CString drive, bool readOnly) SetCPTitle(fOpenArchivePathName, fpOpenArchive); bail: - if (pOpenArchive != nil) { + if (pOpenArchive != NULL) { ASSERT(result != 0); delete pOpenArchive; } @@ -2279,7 +2279,7 @@ bail: void MainWindow::ReopenArchive(void) { - if (fpOpenArchive == nil) { + if (fpOpenArchive == NULL) { ASSERT(false); return; } @@ -2287,7 +2287,7 @@ MainWindow::ReopenArchive(void) /* clear the flag, regardless of success or failure */ fNeedReopen = false; - GenericArchive* pOpenArchive = nil; + GenericArchive* pOpenArchive = NULL; CString pathName = fpOpenArchive->GetPathName(); bool readOnly = fpOpenArchive->IsReadOnly(); GenericArchive::ArchiveKind archiveKind = fpOpenArchive->GetArchiveKind(); @@ -2326,7 +2326,7 @@ MainWindow::ReopenArchive(void) WMSG0(" Reopen was successful\n"); SwitchContentList(pOpenArchive); - pOpenArchive = nil; + pOpenArchive = NULL; SetCPTitle(pathName, fpOpenArchive); bail: @@ -2339,7 +2339,7 @@ bail: bool MainWindow::IsOpenPathName(const WCHAR* path) { - if (fpOpenArchive == nil) + if (fpOpenArchive == NULL) return false; if (wcsicmp(path, fpOpenArchive->GetPathName()) == 0) @@ -2356,7 +2356,7 @@ MainWindow::IsOpenPathName(const WCHAR* path) void MainWindow::SwitchContentList(GenericArchive* pOpenArchive) { - assert(pOpenArchive != nil); + assert(pOpenArchive != NULL); /* * 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 * that before getting this far to avoid confusion.) */ - if (fpOpenArchive != nil) + if (fpOpenArchive != NULL) CloseArchive(); - ASSERT(fpOpenArchive == nil); - ASSERT(fpContentList == nil); + ASSERT(fpOpenArchive == NULL); + ASSERT(fpContentList == NULL); /* * Without this we get an assertion failure in CImageList::Attach if we @@ -2410,11 +2410,11 @@ MainWindow::SwitchContentList(GenericArchive* pOpenArchive) void MainWindow::CloseArchiveWOControls(void) { - if (fpOpenArchive != nil) { + if (fpOpenArchive != NULL) { //fpOpenArchive->Close(); WMSG0("Deleting OpenArchive\n"); delete fpOpenArchive; - fpOpenArchive = nil; + fpOpenArchive = NULL; } } @@ -2428,10 +2428,10 @@ MainWindow::CloseArchive(void) CWaitCursor waitc; // closing large compressed archive can be slow // destroy the ContentList - if (fpContentList != nil) { + if (fpContentList != NULL) { WMSG0("Destroying ContentList\n"); fpContentList->DestroyWindow(); // auto-cleanup invokes "delete" - fpContentList = nil; + fpContentList = NULL; } // destroy the GenericArchive @@ -2452,7 +2452,7 @@ MainWindow::CloseArchive(void) void MainWindow::SetCPTitle(const WCHAR* pathname, GenericArchive* pOpenArchive) { - ASSERT(pathname != nil); + ASSERT(pathname != NULL); CString title; CString appName; CString archiveDescription; @@ -2513,7 +2513,7 @@ MainWindow::GetPrintTitle(void) CString archiveDescription; CString appName; - if (fpOpenArchive == nil) { + if (fpOpenArchive == NULL) { ASSERT(false); return title; } diff --git a/app/Main.h b/app/Main.h index 0af7375..8cda2e0 100644 --- a/app/Main.h +++ b/app/Main.h @@ -374,7 +374,7 @@ private: class DeleteListNode { public: DeleteListNode(const CString& name) : fName(name), - fPrev(nil), fNext(nil) {} + fPrev(NULL), fNext(NULL) {} ~DeleteListNode(void) {} DeleteListNode* fPrev; @@ -383,13 +383,13 @@ private: }; public: - DeleteList(void) { fHead = nil; } + DeleteList(void) { fHead = NULL; } ~DeleteList(void) { WMSG1("Processing DeleteList (head=0x%08lx)\n", fHead); DeleteListNode* pNode = fHead; DeleteListNode* pNext; - while (pNode != nil) { + while (pNode != NULL) { pNext = pNode->fNext; if (_wunlink(pNode->fName) != 0) { WMSG2(" WARNING: delete of '%ls' failed, err=%d\n", @@ -405,7 +405,7 @@ private: void Add(const CString& name) { DeleteListNode* pNode = new DeleteListNode(name); - if (fHead != nil) { + if (fHead != NULL) { fHead->fPrev = pNode; pNode->fNext = fHead; } @@ -424,13 +424,13 @@ private: #define SET_PROGRESS_BEGIN() ((MainWindow*)::AfxGetMainWnd())->SetProgressBegin() #define SET_PROGRESS_UPDATE(perc) \ - ((MainWindow*)::AfxGetMainWnd())->SetProgressUpdate(perc, nil, nil) + ((MainWindow*)::AfxGetMainWnd())->SetProgressUpdate(perc, NULL, NULL) #define SET_PROGRESS_UPDATE2(perc, oldName, newName) \ ((MainWindow*)::AfxGetMainWnd())->SetProgressUpdate(perc, oldName, newName) #define SET_PROGRESS_END() ((MainWindow*)::AfxGetMainWnd())->SetProgressEnd() #define SET_PROGRESS_COUNTER(val) \ - ((MainWindow*)::AfxGetMainWnd())->SetProgressCounter(nil, val) + ((MainWindow*)::AfxGetMainWnd())->SetProgressCounter(NULL, val) #define SET_PROGRESS_COUNTER_2(fmt, val) \ ((MainWindow*)::AfxGetMainWnd())->SetProgressCounter(fmt, val) diff --git a/app/MyApp.cpp b/app/MyApp.cpp index 48716f5..20fa43c 100644 --- a/app/MyApp.cpp +++ b/app/MyApp.cpp @@ -28,7 +28,7 @@ MyApp::MyApp(LPCTSTR lpszAppName) : CWinApp(lpszAppName) { 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", kAppMajorVersion, kAppMinorVersion, kAppBugVersion, @@ -76,12 +76,12 @@ MyApp::InitInstance(void) /* find our .EXE file */ //HMODULE hModule = ::GetModuleHandle(NULL); 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); fExeFileName = buf; WCHAR* cp = wcsrchr(buf, '\\'); - if (cp == nil) + if (cp == NULL) fExeBaseName = L""; else fExeBaseName = fExeFileName.Left(cp - buf +1); @@ -97,7 +97,7 @@ MyApp::InitInstance(void) #if 0 /* find our .INI file by tweaking the EXE path */ char* cp = strrchr(buf, '\\'); - if (cp == nil) + if (cp == NULL) cp = buf; else cp++; @@ -149,7 +149,7 @@ MyApp::InitInstance(void) /* * 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 MyApp::LogModuleLocation(const WCHAR* name) @@ -157,7 +157,7 @@ MyApp::LogModuleLocation(const WCHAR* name) HMODULE hModule; WCHAR fileNameBuf[256]; hModule = ::GetModuleHandle(name); - if (hModule != nil && + if (hModule != NULL && ::GetModuleFileName(hModule, fileNameBuf, NELEM(fileNameBuf)) != 0) { // GetModuleHandle does not increase ref count, so no need to release diff --git a/app/NewDiskSize.cpp b/app/NewDiskSize.cpp index 84314fe..0c76ff5 100644 --- a/app/NewDiskSize.cpp +++ b/app/NewDiskSize.cpp @@ -53,7 +53,7 @@ NewDiskSize::EnableButtons(CDialog* pDialog, BOOL state /*=true*/) for (int i = 0; i < NELEM(kCtrlMap); i++) { pWnd = pDialog->GetDlgItem(kCtrlMap[i].ctrlID); - if (pWnd != nil) + if (pWnd != NULL) pWnd->EnableWindow(state); } } @@ -84,7 +84,7 @@ NewDiskSize::EnableButtons_ProDOS(CDialog* pDialog, long totalBlocks, for (int i = 0; i < NELEM(kCtrlMap); i++) { pButton = (CButton*) pDialog->GetDlgItem(kCtrlMap[i].ctrlID); - if (pButton == nil) { + if (pButton == NULL) { WMSG1("WARNING: couldn't find ctrlID %d\n", kCtrlMap[i].ctrlID); continue; } @@ -137,14 +137,14 @@ NewDiskSize::UpdateSpecifyEdit(CDialog* pDialog) CEdit* pEdit = (CEdit*) pDialog->GetDlgItem(kEditBoxID); int i; - if (pEdit == nil) { + if (pEdit == NULL) { ASSERT(false); return; } for (i = 0; i < NELEM(kCtrlMap); i++) { 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); continue; } diff --git a/app/NewFolderDialog.cpp b/app/NewFolderDialog.cpp index cd54868..208a8c9 100644 --- a/app/NewFolderDialog.cpp +++ b/app/NewFolderDialog.cpp @@ -54,7 +54,7 @@ NewFolderDialog::DoDataExchange(CDataExchange* pDX) fNewFullPath += "\\"; fNewFullPath += fNewFolder; WMSG1("CREATING '%ls'\n", (LPCWSTR) fNewFullPath); - if (!::CreateDirectory(fNewFullPath, nil)) { + if (!::CreateDirectory(fNewFullPath, NULL)) { /* show the sometimes-bizarre Windows error string */ CString msg, errStr, failed; DWORD dwerr = ::GetLastError(); diff --git a/app/NufxArchive.cpp b/app/NufxArchive.cpp index 5b3f4db..cf721f7 100644 --- a/app/NufxArchive.cpp +++ b/app/NufxArchive.cpp @@ -32,11 +32,11 @@ const unsigned char kNufxNoFssep = 0xff; /* * 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 * 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[]". * * 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 { NuError nerr; - char* dataBuf = nil; - NuDataSink* pDataSink = nil; + char* dataBuf = NULL; + NuDataSink* pDataSink = NULL; NuThread thread; unsigned long actualThreadEOF; 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 - if (*ppText != nil) + if (*ppText != NULL) needAlloc = false; FindThreadInfo(which, &thread, pErrMsg); @@ -88,7 +88,7 @@ NufxEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength, if (needAlloc) { dataBuf = new char[actualThreadEOF]; - if (dataBuf == nil) { + if (dataBuf == NULL) { pErrMsg->Format(L"allocation of %ld bytes failed", actualThreadEOF); goto bail; @@ -140,10 +140,10 @@ bail: ASSERT(result == IDCANCEL || !pErrMsg->IsEmpty()); if (needAlloc) { delete[] dataBuf; - ASSERT(*ppText == nil); + ASSERT(*ppText == NULL); } } - if (pDataSink != nil) + if (pDataSink != NULL) NuFreeDataSink(pDataSink); return result; } @@ -160,14 +160,14 @@ int NufxEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv, ConvertHighASCII convHA, CString* pErrMsg) const { - NuDataSink* pDataSink = nil; + NuDataSink* pDataSink = NULL; NuError nerr; NuThread thread; unsigned long actualThreadEOF; NuThreadIdx threadIdx; int result = -1; - ASSERT(outfp != nil); + ASSERT(outfp != NULL); //CString errMsg; FindThreadInfo(which, &thread, pErrMsg); @@ -254,7 +254,7 @@ bail: if (result == IDOK) { SET_PROGRESS_END(); } - if (pDataSink != nil) + if (pDataSink != NULL) NuFreeDataSink(pDataSink); return result; } @@ -304,7 +304,7 @@ NufxEntry::FindThreadInfo(int which, NuThread* pRetThread, } int i; - pThread = nil; + pThread = NULL; for (i = 0; i < (int)NuRecordGetNumThreads(pRecord); i++) { pThread = NuGetThread(pRecord, i); if (NuGetThreadID(pThread) == wantedThreadID) @@ -369,7 +369,7 @@ NufxEntry::AnalyzeRecord(const NuRecord* pRecord) for (idx = 0; idx < pRecord->recTotalThreads; idx++) { pThread = NuGetThread(pRecord, idx); - ASSERT(pThread != nil); + ASSERT(pThread != NULL); threadID = NuMakeThreadID(pThread->thThreadClass, pThread->thThreadKind); @@ -558,14 +558,14 @@ NufxArchive::ProgressUpdater(NuArchive* pArchive, void* vpProgress) const char* newName; int perc; - ASSERT(pProgress != nil); - ASSERT(pMainWin != nil); + ASSERT(pProgress != NULL); + ASSERT(pMainWin != NULL); - ASSERT(pArchive != nil); + ASSERT(pArchive != NULL); (void) NuGetExtraData(pArchive, (void**) &pThis); - ASSERT(pThis != nil); + ASSERT(pThis != NULL); - oldName = newName = nil; + oldName = newName = NULL; if (pProgress->operation == kNuOpAdd) { oldName = pProgress->origPathname; newName = pProgress->pathname; @@ -585,8 +585,8 @@ NufxArchive::ProgressUpdater(NuArchive* pArchive, void* vpProgress) perc = 100; //WMSG3("Progress: %d%% '%hs' '%hs'\n", perc, - // oldName == nil ? "(nil)" : oldName, - // newName == nil ? "(nil)" : newName); + // oldName == NULL ? "(null)" : oldName, + // newName == NULL ? "(null)" : newName); //status = pMainWin->SetProgressUpdate(perc, oldName, newName); CString oldNameW(oldName); @@ -610,7 +610,7 @@ NufxArchive::ProgressUpdater(NuArchive* pArchive, void* vpProgress) /* * 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 NufxArchive::Open(const WCHAR* filename, bool readOnly, CString* pErrMsg) @@ -618,7 +618,7 @@ NufxArchive::Open(const WCHAR* filename, bool readOnly, CString* pErrMsg) NuError nerr; CString errMsg; - ASSERT(fpArchive == nil); + ASSERT(fpArchive == NULL); CStringA filenameA(filename); if (!readOnly) { @@ -678,8 +678,8 @@ NufxArchive::New(const WCHAR* filename, const void* options) NuError nerr; CString retmsg; - ASSERT(fpArchive == nil); - ASSERT(options == nil); + ASSERT(fpArchive == NULL); + ASSERT(options == NULL); CString tmpname = GenDerivedTempName(filename); WMSG2("Creating file '%ls' (tmp='%ls')\n", filename, (LPCWSTR) tmpname); @@ -822,7 +822,7 @@ NufxArchive::LoadContents(void) NuError result; WMSG0("NufxArchive LoadContents\n"); - ASSERT(fpArchive != nil); + ASSERT(fpArchive != NULL); { MainWindow* pMain = GET_MAIN_WINDOW(); @@ -897,8 +897,8 @@ NufxArchive::ContentFunc(NuArchive* pArchive, void* vpRecord) NufxArchive* pThis; NufxEntry* pNewEntry; - ASSERT(pArchive != nil); - ASSERT(vpRecord != nil); + ASSERT(pArchive != NULL); + ASSERT(vpRecord != NULL); NuGetExtraData(pArchive, (void**) &pThis); @@ -1113,8 +1113,8 @@ NufxArchive::AddDisk(ActionProgressDialog* pActionProgress, PathProposal pathProp; PathName pathName; DiskImg* pDiskImg; - NuDataSource* pSource = nil; - unsigned char* diskData = nil; + NuDataSource* pSource = NULL; + unsigned char* diskData = NULL; WCHAR curDir[MAX_PATH] = L"\\"; bool retVal = false; CStringA storageNameA, origNameA; @@ -1128,11 +1128,11 @@ NufxArchive::AddDisk(ActionProgressDialog* pActionProgress, pAddOpts->fOverwriteExisting); pDiskImg = pAddOpts->fpDiskImg; - ASSERT(pDiskImg != nil); + ASSERT(pDiskImg != NULL); /* allocate storage for the entire disk */ diskData = new BYTE[pDiskImg->GetNumBlocks() * kBlockSize]; - if (diskData == nil) { + if (diskData == NULL) { errMsg.Format(L"Unable to allocate %d bytes.", pDiskImg->GetNumBlocks() * kBlockSize); ShowFailureMsg(fpMsgWnd, errMsg, IDS_FAILED); @@ -1183,7 +1183,7 @@ NufxArchive::AddDisk(ActionProgressDialog* pActionProgress, time_t now, then; pathName = buf; - now = time(nil); + now = time(NULL); then = pathName.GetModWhen(); UNIXTimeToDateTime(&now, &details.archiveWhen); UNIXTimeToDateTime(&then, &details.modWhen); @@ -1217,7 +1217,7 @@ NufxArchive::AddDisk(ActionProgressDialog* pActionProgress, /* create a data source for the disk */ nerr = NuCreateDataSourceForBuffer(kNuThreadFormatUncompressed, 0, diskData, 0, pAddOpts->fpDiskImg->GetNumBlocks() * kBlockSize, - nil, &pSource); + NULL, &pSource); if (nerr != kNuErrNone) { errMsg = "Unable to create NufxLib data source."; ShowFailureMsg(fpMsgWnd, errMsg, IDS_FAILED); @@ -1237,13 +1237,13 @@ NufxArchive::AddDisk(ActionProgressDialog* pActionProgress, /* do the compression */ nerr = NuAddThread(fpArchive, recordIdx, kNuThreadIDDiskImage, - pSource, nil); + pSource, NULL); if (nerr != kNuErrNone) { errMsg.Format(L"Failed adding thread: %hs.", NuStrError(nerr)); ShowFailureMsg(fpMsgWnd, errMsg, IDS_FAILED); goto bail; } - pSource = nil; /* NufxLib owns it now */ + pSource = NULL; /* NufxLib owns it now */ /* actually do the work */ long statusFlags; @@ -1344,13 +1344,13 @@ NufxArchive::AddPrep(CWnd* pMsgWnd, const AddFilesDialog* pAddOpts) const Preferences* pPreferences = GET_PREFERENCES(); int defaultCompression; - ASSERT(fpArchive != nil); + ASSERT(fpArchive != NULL); fpMsgWnd = pMsgWnd; - ASSERT(fpMsgWnd != nil); + ASSERT(fpMsgWnd != NULL); fpAddOpts = pAddOpts; - ASSERT(fpAddOpts != nil); + ASSERT(fpAddOpts != NULL); //fBulkProgress = true; @@ -1380,10 +1380,10 @@ NufxArchive::AddPrep(CWnd* pMsgWnd, const AddFilesDialog* pAddOpts) void NufxArchive::AddFinish(void) { - NuSetErrorHandler(fpArchive, nil); + NuSetErrorHandler(fpArchive, NULL); NuSetValue(fpArchive, kNuValueHandleExisting, kNuMaybeOverwrite); - fpMsgWnd = nil; - fpAddOpts = nil; + fpMsgWnd = NULL; + fpAddOpts = NULL; //fBulkProgress = false; } @@ -1398,9 +1398,9 @@ NufxArchive::BulkAddErrorHandler(NuArchive* pArchive, void* vErrorStatus) NufxArchive* pThis; NuResult result; - ASSERT(pArchive != nil); + ASSERT(pArchive != NULL); (void) NuGetExtraData(pArchive, (void**) &pThis); - ASSERT(pThis != nil); + ASSERT(pThis != NULL); ASSERT(pArchive == pThis->fpArchive); /* default action is to abort the current operation */ @@ -1443,8 +1443,8 @@ NufxArchive::HandleReplaceExisting(const NuErrorStatus* pErrorStatus) { NuResult result = kNuOK; - ASSERT(pErrorStatus != nil); - ASSERT(pErrorStatus->pathname != nil); + ASSERT(pErrorStatus != NULL); + ASSERT(pErrorStatus->pathname != NULL); ASSERT(pErrorStatus->canOverwrite); ASSERT(pErrorStatus->canSkip); @@ -1458,7 +1458,7 @@ NufxArchive::HandleReplaceExisting(const NuErrorStatus* pErrorStatus) confOvwr.fExistingFile = pErrorStatus->pRecord->filename; confOvwr.fExistingFileModWhen = DateTimeToSeconds(&pErrorStatus->pRecord->recModWhen); - if (pErrorStatus->origPathname != nil) { + if (pErrorStatus->origPathname != NULL) { confOvwr.fNewFileSource = pErrorStatus->origPathname; PathName checkPath(confOvwr.fNewFileSource); confOvwr.fNewFileModWhen = checkPath.GetModWhen(); @@ -1530,12 +1530,12 @@ NufxArchive::TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) CString errMsg; bool retVal = false; - ASSERT(fpArchive != nil); + ASSERT(fpArchive != NULL); WMSG1("Testing %d entries\n", pSelSet->GetNumEntries()); SelectionEntry* pSelEntry = pSelSet->IterNext(); - while (pSelEntry != nil) { + while (pSelEntry != NULL) { pEntry = (NufxEntry*) pSelEntry->GetEntry(); WMSG2(" Testing %ld '%ls'\n", pEntry->GetRecordIdx(), @@ -1587,13 +1587,13 @@ NufxArchive::DeleteSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) CString errMsg; bool retVal = false; - ASSERT(fpArchive != nil); + ASSERT(fpArchive != NULL); WMSG1("Deleting %d entries\n", pSelSet->GetNumEntries()); /* mark entries for deletion */ SelectionEntry* pSelEntry = pSelSet->IterNext(); - while (pSelEntry != nil) { + while (pSelEntry != NULL) { pEntry = (NufxEntry*) pSelEntry->GetEntry(); WMSG2(" Deleting %ld '%ls'\n", pEntry->GetRecordIdx(), @@ -1645,7 +1645,7 @@ NufxArchive::RenameSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) NuError nerr; bool retVal = false; - ASSERT(fpArchive != nil); + ASSERT(fpArchive != NULL); WMSG1("Renaming %d entries\n", pSelSet->GetNumEntries()); @@ -1668,7 +1668,7 @@ NufxArchive::RenameSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) * sorts of archives (e.g. disk archives). */ SelectionEntry* pSelEntry = pSelSet->IterNext(); - while (pSelEntry != nil) { + while (pSelEntry != NULL) { NufxEntry* pEntry = (NufxEntry*) pSelEntry->GetEntry(); WMSG1(" Renaming '%ls'\n", pEntry->GetPathName()); @@ -1743,7 +1743,7 @@ NufxArchive::TestPathName(const GenericEntry* pGenericEntry, const CString& basePath, const CString& newName, char newFssep) const { CString errMsg; - ASSERT(pGenericEntry != nil); + ASSERT(pGenericEntry != NULL); ASSERT(basePath.IsEmpty()); @@ -1771,7 +1771,7 @@ NufxArchive::TestPathName(const GenericEntry* pGenericEntry, */ GenericEntry* pEntry; pEntry = GetEntries(); - while (pEntry != nil) { + while (pEntry != NULL) { if (pEntry != pGenericEntry && ComparePaths(pEntry->GetPathName(), pEntry->GetFssep(), newName, newFssep) == 0) @@ -1839,8 +1839,8 @@ NufxArchive::RecompressSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, SelectionEntry* pSelEntry = pSelSet->IterNext(); long sizeInMemory = 0; bool result = true; - NufxEntry* pEntry = nil; - for ( ; pSelEntry != nil; pSelEntry = pSelSet->IterNext()) { + NufxEntry* pEntry = NULL; + for ( ; pSelEntry != NULL; pSelEntry = pSelSet->IterNext()) { pEntry = (NufxEntry*) pSelEntry->GetEntry(); /* @@ -1893,7 +1893,7 @@ NufxArchive::RecompressSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, /* handle errors that threw us out of the while loop */ if (!result) { - ASSERT(pEntry != nil); + ASSERT(pEntry != NULL); CString dispStr; dispStr.Format(L"Failed while recompressing '%ls': %ls.", pEntry->GetDisplayName(), (LPCWSTR) errMsg); @@ -1944,10 +1944,10 @@ NufxArchive::RecompressThread(NufxEntry* pEntry, int threadKind, NuThread thread; NuThreadID threadID; NuError nerr; - NuDataSource* pSource = nil; + NuDataSource* pSource = NULL; CString subErrMsg; bool retVal = false; - char* buf = nil; + char* buf = NULL; long len = 0; WMSG2(" Recompressing %ld '%ls'\n", pEntry->GetRecordIdx(), @@ -1974,7 +1974,7 @@ NufxArchive::RecompressThread(NufxEntry* pEntry, int threadKind, result = pEntry->ExtractThreadToBuffer(threadKind, &buf, &len, &subErrMsg); if (result == IDCANCEL) { WMSG0("Cancelled during extract!\n"); - ASSERT(buf == nil); + ASSERT(buf == NULL); goto bail; /* abort anything that was pending */ } else if (result != IDOK) { pErrMsg->Format(L"Failed while extracting '%ls': %ls", @@ -1992,7 +1992,7 @@ NufxArchive::RecompressThread(NufxEntry* pEntry, int threadKind, len); goto bail; } - buf = nil; // data source owns it now + buf = NULL; // data source owns it now /* delete the existing thread */ //WMSG1("+++ DELETE threadIdx=%d\n", thread.threadIdx); @@ -2006,13 +2006,13 @@ NufxArchive::RecompressThread(NufxEntry* pEntry, int threadKind, /* mark the new thread for addition */ //WMSG1("+++ ADD threadID=0x%08lx\n", threadID); nerr = NuAddThread(fpArchive, pEntry->GetRecordIdx(), threadID, - pSource, nil); + pSource, NULL); if (nerr != kNuErrNone) { pErrMsg->Format(L"Unable to add thread type %d: %hs", threadID, NuStrError(nerr)); 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 */ retVal = true; @@ -2043,21 +2043,21 @@ NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, { WMSG0("NufxArchive XferSelection!\n"); XferStatus retval = kXferFailed; - unsigned char* dataBuf = nil; - unsigned char* rsrcBuf = nil; + unsigned char* dataBuf = NULL; + unsigned char* rsrcBuf = NULL; CString errMsg, dispMsg; pXferOpts->fTarget->XferPrepare(pXferOpts); SelectionEntry* pSelEntry = pSelSet->IterNext(); - for ( ; pSelEntry != nil; pSelEntry = pSelSet->IterNext()) { + for ( ; pSelEntry != NULL; pSelEntry = pSelSet->IterNext()) { long dataLen=-1, rsrcLen=-1; NufxEntry* pEntry = (NufxEntry*) pSelEntry->GetEntry(); FileDetails fileDetails; CString errMsg; - ASSERT(dataBuf == nil); - ASSERT(rsrcBuf == nil); + ASSERT(dataBuf == NULL); + ASSERT(rsrcBuf == NULL); /* in case we start handling CRC errors better */ if (pEntry->GetDamaged()) { @@ -2077,7 +2077,7 @@ NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, fileDetails.storageType = kNuStorageSeedling; time_t when; - when = time(nil); + when = time(NULL); UNIXTimeToDateTime(&when, &fileDetails.archiveWhen); when = pEntry->GetModWhen(); UNIXTimeToDateTime(&when, &fileDetails.modWhen); @@ -2099,7 +2099,7 @@ NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, * Found a data thread. */ int result; - dataBuf = nil; + dataBuf = NULL; dataLen = 0; result = pEntry->ExtractThreadToBuffer(GenericEntry::kDataThread, (char**) &dataBuf, &dataLen, &errMsg); @@ -2113,7 +2113,7 @@ NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, ShowFailureMsg(pMsgWnd, dispMsg, IDS_FAILED); goto bail; } - ASSERT(dataBuf != nil); + ASSERT(dataBuf != NULL); ASSERT(dataLen >= 0); } else if (pEntry->GetHasDiskImage()) { @@ -2121,7 +2121,7 @@ NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, * No data thread found. Look for a disk image. */ int result; - dataBuf = nil; + dataBuf = NULL; dataLen = 0; result = pEntry->ExtractThreadToBuffer(GenericEntry::kDiskImageThread, (char**) &dataBuf, &dataLen, &errMsg); @@ -2134,7 +2134,7 @@ NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, ShowFailureMsg(pMsgWnd, dispMsg, IDS_FAILED); goto bail; } - ASSERT(dataBuf != nil); + ASSERT(dataBuf != NULL); ASSERT(dataLen >= 0); } @@ -2144,7 +2144,7 @@ NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, */ if (pEntry->GetHasRsrcFork()) { int result; - rsrcBuf = nil; + rsrcBuf = NULL; rsrcLen = 0; result = pEntry->ExtractThreadToBuffer(GenericEntry::kRsrcThread, (char**) &rsrcBuf, &rsrcLen, &errMsg); @@ -2160,7 +2160,7 @@ NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, fileDetails.storageType = kNuStorageExtended; } else { - ASSERT(rsrcBuf == nil); + ASSERT(rsrcBuf == NULL); } if (dataLen < 0 && rsrcLen < 0) { @@ -2178,8 +2178,8 @@ NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED); goto bail; } - ASSERT(dataBuf == nil); - ASSERT(rsrcBuf == nil); + ASSERT(dataBuf == NULL); + ASSERT(rsrcBuf == NULL); if (pActionProgress->SetProgress(100) == IDCANCEL) { retval = kXferCancelled; @@ -2220,7 +2220,7 @@ NufxArchive::XferPrepare(const XferFileOptions* pXferOpts) * exist. * * 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 NufxArchive::XferFile(FileDetails* pDetails, unsigned char** pDataBuf, @@ -2228,25 +2228,25 @@ NufxArchive::XferFile(FileDetails* pDetails, unsigned char** pDataBuf, { NuError nerr; const int kFileTypeTXT = 0x04; - NuDataSource* pSource = nil; + NuDataSource* pSource = NULL; CString errMsg; WMSG1(" NufxArchive::XferFile '%ls'\n", (LPCWSTR) pDetails->storageName); WMSG4(" dataBuf=0x%08lx dataLen=%ld rsrcBuf=0x%08lx rsrcLen=%ld\n", *pDataBuf, dataLen, *pRsrcBuf, rsrcLen); - ASSERT(pDataBuf != nil); - ASSERT(pRsrcBuf != nil); + ASSERT(pDataBuf != NULL); + ASSERT(pRsrcBuf != NULL); /* NuFX doesn't explicitly store directories */ if (pDetails->entryKind == FileDetails::kFileKindDirectory) { delete[] *pDataBuf; delete[] *pRsrcBuf; - *pDataBuf = *pRsrcBuf = nil; + *pDataBuf = *pRsrcBuf = NULL; goto bail; } 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 */ NuRecordIdx recordIdx; @@ -2286,7 +2286,7 @@ NufxArchive::XferFile(FileDetails* pDetails, unsigned char** pDataBuf, } if (dataLen >= 0) { - ASSERT(*pDataBuf != nil); + ASSERT(*pDataBuf != NULL); /* strip the high ASCII from DOS and RDOS text files */ if (pDetails->entryKind != FileDetails::kFileKindDiskImage && @@ -2310,7 +2310,7 @@ NufxArchive::XferFile(FileDetails* pDetails, unsigned char** pDataBuf, //ShowFailureMsg(fpMsgWnd, errMsg, IDS_FAILED); goto bail; } - *pDataBuf = nil; /* owned by data source */ + *pDataBuf = NULL; /* owned by data source */ /* add the data fork, as a disk image if appropriate */ NuThreadID targetID; @@ -2319,18 +2319,18 @@ NufxArchive::XferFile(FileDetails* pDetails, unsigned char** pDataBuf, else targetID = kNuThreadIDDataFork; - nerr = NuAddThread(fpArchive, recordIdx, targetID, pSource, nil); + nerr = NuAddThread(fpArchive, recordIdx, targetID, pSource, NULL); if (nerr != kNuErrNone) { errMsg.Format(L"Failed adding thread: %hs.", NuStrError(nerr)); //ShowFailureMsg(fpMsgWnd, errMsg, IDS_FAILED); goto bail; } - pSource = nil; /* NufxLib owns it now */ + pSource = NULL; /* NufxLib owns it now */ } /* add the resource fork, if one was provided */ if (rsrcLen >= 0) { - ASSERT(*pRsrcBuf != nil); + ASSERT(*pRsrcBuf != NULL); nerr = NuCreateDataSourceForBuffer(kNuThreadFormatUncompressed, 0, *pRsrcBuf, 0, rsrcLen, ArrayDeleteHandler, &pSource); @@ -2339,17 +2339,17 @@ NufxArchive::XferFile(FileDetails* pDetails, unsigned char** pDataBuf, //ShowFailureMsg(fpMsgWnd, errMsg, IDS_FAILED); goto bail; } - *pRsrcBuf = nil; /* owned by data source */ + *pRsrcBuf = NULL; /* owned by data source */ /* add the data fork */ nerr = NuAddThread(fpArchive, recordIdx, kNuThreadIDRsrcFork, - pSource, nil); + pSource, NULL); if (nerr != kNuErrNone) { errMsg.Format(L"Failed adding thread: %hs.", NuStrError(nerr)); //ShowFailureMsg(fpMsgWnd, errMsg, IDS_FAILED); goto bail; } - pSource = nil; /* NufxLib owns it now */ + pSource = NULL; /* NufxLib owns it now */ } bail: @@ -2436,13 +2436,13 @@ NufxArchive::GetComment(CWnd* pMsgWnd, const GenericEntry* pGenericEntry, ASSERT(pGenericEntry->GetHasComment()); /* use standard extract function to pull comment out */ - buf = nil; + buf = NULL; len = 0; result = pEntry->ExtractThreadToBuffer(GenericEntry::kCommentThread, &buf, &len, &errMsg); if (result != IDOK) { WMSG1("Failed getting comment: %hs\n", buf); - ASSERT(buf == nil); + ASSERT(buf == NULL); return false; } @@ -2487,7 +2487,7 @@ bool NufxArchive::SetComment(CWnd* pMsgWnd, GenericEntry* pGenericEntry, const CString& str) { - NuDataSource* pSource = nil; + NuDataSource* pSource = NULL; NufxEntry* pEntry = (NufxEntry*) pGenericEntry; NuError nerr; bool retVal = false; @@ -2536,7 +2536,7 @@ NufxArchive::SetComment(CWnd* pMsgWnd, GenericEntry* pGenericEntry, /* create a data source to write from */ nerr = NuCreateDataSourceForBuffer(kNuThreadFormatUncompressed, maxLen, (const BYTE*)(LPCSTR)newStr, 0, - newStr.GetLength(), nil, &pSource); + newStr.GetLength(), NULL, &pSource); if (nerr != kNuErrNone) { errMsg.Format(L"Unable to create NufxLib data source (len=%d, maxLen=%d).", newStr.GetLength(), maxLen); @@ -2545,13 +2545,13 @@ NufxArchive::SetComment(CWnd* pMsgWnd, GenericEntry* pGenericEntry, /* add the new thread */ nerr = NuAddThread(fpArchive, pEntry->GetRecordIdx(), - kNuThreadIDComment, pSource, nil); + kNuThreadIDComment, pSource, NULL); if (nerr != kNuErrNone) { errMsg.Format(L"Unable to add comment thread: %hs.", NuStrError(nerr)); goto bail; } - pSource = nil; // nufxlib owns it now + pSource = NULL; // nufxlib owns it now /* flush changes */ long statusFlags; diff --git a/app/NufxArchive.h b/app/NufxArchive.h index ec9c851..64d1dbf 100644 --- a/app/NufxArchive.h +++ b/app/NufxArchive.h @@ -60,12 +60,12 @@ private: class NufxArchive : public GenericArchive { public: NufxArchive(void) : - fpArchive(nil), + fpArchive(NULL), fIsReadOnly(false), fProgressAsRecompress(false), fNumAdded(-1), - fpMsgWnd(nil), - fpAddOpts(nil) + fpMsgWnd(NULL), + fpAddOpts(NULL) {} virtual ~NufxArchive(void) { (void) Close(); } @@ -123,11 +123,11 @@ public: private: virtual CString Close(void) { - if (fpArchive != nil) { + if (fpArchive != NULL) { WMSG0("Closing archive (aborting any un-flushed changes)\n"); NuAbort(fpArchive); NuClose(fpArchive); - fpArchive = nil; + fpArchive = NULL; } return L""; } diff --git a/app/OpenVolumeDialog.cpp b/app/OpenVolumeDialog.cpp index f35d01b..21be641 100644 --- a/app/OpenVolumeDialog.cpp +++ b/app/OpenVolumeDialog.cpp @@ -36,14 +36,14 @@ OpenVolumeDialog::OnInitDialog(void) /* highlight/select entire line, not just filename */ CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_VOLUME_LIST); - ASSERT(pListView != nil); + ASSERT(pListView != NULL); ListView_SetExtendedListViewStyleEx(pListView->m_hWnd, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT); /* disable the OK button until they click on something */ CButton* pButton = (CButton*) GetDlgItem(IDOK); - ASSERT(pButton != nil); + ASSERT(pButton != NULL); pButton->EnableWindow(FALSE); @@ -51,13 +51,13 @@ OpenVolumeDialog::OnInitDialog(void) if (!fAllowROChange) { CButton* pButton; pButton = (CButton*) GetDlgItem(IDC_OPENVOL_READONLY); - ASSERT(pButton != nil); + ASSERT(pButton != NULL); pButton->EnableWindow(FALSE); } /* prep the combo box */ CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_VOLUME_FILTER); - ASSERT(pCombo != nil); + ASSERT(pCombo != NULL); defaultFilter = pPreferences->GetPrefLong(kPrVolumeFilter); if (defaultFilter >= kBoth && defaultFilter <= kPhysical) pCombo->SetCurSel(defaultFilter); @@ -108,9 +108,9 @@ OpenVolumeDialog::LoadDriveList(void) int filterSelection; pListView = (CListCtrl*) GetDlgItem(IDC_VOLUME_LIST); - ASSERT(pListView != nil); + ASSERT(pListView != NULL); pCombo = (CComboBox*) GetDlgItem(IDC_VOLUME_FILTER); - ASSERT(pCombo != nil); + ASSERT(pCombo != NULL); pListView->DeleteAllItems(); @@ -136,7 +136,7 @@ OpenVolumeDialog::LoadLogicalDriveList(CListCtrl* pListView, int* pItemIndex) bool isWin9x = IsWin9x(); int itemIndex = *pItemIndex; - ASSERT(pListView != nil); + ASSERT(pListView != NULL); drivesAvailable = GetLogicalDrives(); if (drivesAvailable == 0) { @@ -157,7 +157,7 @@ OpenVolumeDialog::LoadLogicalDriveList(CListCtrl* pListView, int* pItemIndex) driveName[0] = 'A' + i; unsigned int driveType; - const WCHAR* driveTypeComment = nil; + const WCHAR* driveTypeComment = NULL; BOOL result; driveType = fVolumeInfo[i].driveType = GetDriveType(driveName); @@ -201,7 +201,7 @@ OpenVolumeDialog::LoadLogicalDriveList(CListCtrl* pListView, int* pItemIndex) WCHAR volNameBuf[256]; WCHAR fsNameBuf[64]; - const WCHAR* errorComment = nil; + const WCHAR* errorComment = NULL; //DWORD fsFlags; CString entryName, entryRemarks; @@ -255,17 +255,17 @@ OpenVolumeDialog::LoadLogicalDriveList(CListCtrl* pListView, int* pItemIndex) driveName, GetLastError()); continue; } - ASSERT(errorComment != nil); + ASSERT(errorComment != NULL); entryName.Format(L"(%c:)", 'A' + i); - if (driveTypeComment != nil) + if (driveTypeComment != NULL) entryRemarks.Format(L"%ls - %ls", driveTypeComment, errorComment); else entryRemarks.Format(L"%ls", errorComment); } else { entryName.Format(L"%ls (%c:)", volNameBuf, 'A' + i); - if (driveTypeComment != nil) + if (driveTypeComment != NULL) entryRemarks.Format(L"%ls", driveTypeComment); else entryRemarks = ""; @@ -356,7 +356,7 @@ OpenVolumeDialog::LoadPhysicalDriveList(CListCtrl* pListView, int* pItemIndex) #if 0 // can we remove this? DIError dierr; DiskImgLib::ASPI* pASPI = DiskImgLib::Global::GetASPI(); - ASPIDevice* deviceArray = nil; + ASPIDevice* deviceArray = NULL; int numDevices; dierr = pASPI->GetAccessibleDevices( @@ -419,7 +419,7 @@ OpenVolumeDialog::LoadPhysicalDriveList(CListCtrl* pListView, int* pItemIndex) bool OpenVolumeDialog::HasPhysicalDriveWin9x(int unit, CString* pRemark) { - HANDLE handle = nil; + HANDLE handle = NULL; const int VWIN32_DIOC_DOS_INT13 = 4; const int CARRY_FLAG = 1; BOOL result; @@ -623,7 +623,7 @@ void OpenVolumeDialog::OnVolumeFilterSelChange(void) { CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_VOLUME_FILTER); - ASSERT(pCombo != nil); + ASSERT(pCombo != NULL); WMSG1("+++ SELECTION IS NOW %d\n", pCombo->GetCurSel()); LoadDriveList(); } @@ -638,7 +638,7 @@ OpenVolumeDialog::OnOK(void) * Figure out the (zero-based) drive letter. */ CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_VOLUME_LIST); - ASSERT(pListView != nil); + ASSERT(pListView != NULL); if (pListView->GetSelectedCount() != 1) { CString msg, failed; @@ -650,7 +650,7 @@ OpenVolumeDialog::OnOK(void) POSITION posn; posn = pListView->GetFirstSelectedItemPosition(); - if (posn == nil) { + if (posn == NULL) { ASSERT(false); return; } @@ -732,7 +732,7 @@ void OpenVolumeDialog::ForceReadOnly(bool readOnly) const { CButton* pButton = (CButton*) GetDlgItem(IDC_OPENVOL_READONLY); - ASSERT(pButton != nil); + ASSERT(pButton != NULL); if (readOnly) pButton->SetCheck(BST_CHECKED); diff --git a/app/PasteSpecialDialog.h b/app/PasteSpecialDialog.h index 1867bb4..7228d8f 100644 --- a/app/PasteSpecialDialog.h +++ b/app/PasteSpecialDialog.h @@ -16,7 +16,7 @@ */ class PasteSpecialDialog : public CDialog { public: - PasteSpecialDialog(CWnd* pParentWnd = nil) : + PasteSpecialDialog(CWnd* pParentWnd = NULL) : CDialog(IDD_PASTE_SPECIAL, pParentWnd), fPasteHow(kPastePaths) {} diff --git a/app/Preferences.cpp b/app/Preferences.cpp index 87b3f20..6474ee3 100644 --- a/app/Preferences.cpp +++ b/app/Preferences.cpp @@ -44,7 +44,7 @@ static const WCHAR kMiscSect[] = L"misc"; * index into the table. */ const Preferences::PrefMap Preferences::fPrefMaps[kPrefNumLastEntry] = { - /**/ { kPrefNumUnknown, kPTNone, nil, nil }, + /**/ { kPrefNumUnknown, kPTNone, NULL, NULL }, { kPrAddIncludeSubFolders, kBool, kAddSect, L"include-sub-folders" }, { kPrAddStripFolderNames, kBool, kAddSect, L"strip-folder-names" }, @@ -137,13 +137,13 @@ const Preferences::PrefMap Preferences::fPrefMaps[kPrefNumLastEntry] = { { kPrLastOpenFilterIndex, kLong, kMiscSect, L"open-filter-index" }, - /**/ { kPrefNumLastRegistry, kPTNone, nil, nil }, + /**/ { kPrefNumLastRegistry, kPTNone, NULL, NULL }, - { kPrViewTextTypeFace, kString, nil, nil }, - { kPrViewTextPointSize, kLong, nil, nil }, - { kPrFileViewerWidth, kLong, nil, nil }, - { kPrFileViewerHeight, kLong, nil, nil }, - { kPrDiskImageCreateFormat, kLong, nil, nil }, + { kPrViewTextTypeFace, kString, NULL, NULL }, + { kPrViewTextPointSize, kLong, NULL, NULL }, + { kPrFileViewerWidth, kLong, NULL, NULL }, + { kPrFileViewerHeight, kLong, NULL, NULL }, + { kPrDiskImageCreateFormat, kLong, NULL, NULL }, }; /* @@ -384,16 +384,16 @@ Preferences::InitFolders(void) bool Preferences::GetMyDocuments(CString* pPath) { - LPITEMIDLIST pidl = nil; - LPMALLOC lpMalloc = nil; + LPITEMIDLIST pidl = NULL; + LPMALLOC lpMalloc = NULL; HRESULT hr; bool result = false; hr = ::SHGetMalloc(&lpMalloc); if (FAILED(hr)) - return nil; + return NULL; - hr = SHGetSpecialFolderLocation(nil, CSIDL_PERSONAL, &pidl); + hr = SHGetSpecialFolderLocation(NULL, CSIDL_PERSONAL, &pidl); if (FAILED(hr)) { WMSG0("WARNING: unable to get CSIDL_PERSONAL\n"); goto bail; @@ -463,7 +463,7 @@ const WCHAR* Preferences::GetPrefString(PrefNum num) const { if (!ValidateEntry(num, kString)) - return nil; + return NULL; return (const WCHAR*) fValues[num]; } void @@ -472,8 +472,8 @@ Preferences::SetPrefString(PrefNum num, const WCHAR* str) if (!ValidateEntry(num, kString)) return; free(fValues[num]); - if (str == nil) { - fValues[num] = nil; + if (str == NULL) { + fValues[num] = NULL; } else { fValues[num] = wcsdup(str); } @@ -516,8 +516,8 @@ Preferences::ScanPrefMaps(void) /* look for duplicate strings */ for (i = 0; i < kPrefNumLastEntry; i++) { for (j = i+1; j < kPrefNumLastEntry; j++) { - if (fPrefMaps[i].registryKey == nil || - fPrefMaps[j].registryKey == nil) + if (fPrefMaps[i].registryKey == NULL || + fPrefMaps[j].registryKey == NULL) { continue; } @@ -552,7 +552,7 @@ Preferences::LoadFromRegistry(void) int i; for (i = 0; i < kPrefNumLastRegistry; i++) { - if (fPrefMaps[i].registryKey == nil) + if (fPrefMaps[i].registryKey == NULL) continue; switch (fPrefMaps[i].type) { @@ -593,7 +593,7 @@ Preferences::SaveToRegistry(void) int i; for (i = 0; i < kPrefNumLastRegistry; i++) { - if (fPrefMaps[i].registryKey == nil) + if (fPrefMaps[i].registryKey == NULL) continue; switch (fPrefMaps[i].type) { diff --git a/app/Preferences.h b/app/Preferences.h index 78b9054..039778d 100644 --- a/app/Preferences.h +++ b/app/Preferences.h @@ -11,7 +11,7 @@ * - Add a corresponding entry to Preferences::fPrefMaps, adding a new * section to the registry if appropriate. * - 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 #define APP_PREFERENCES_H diff --git a/app/PrefsDialog.cpp b/app/PrefsDialog.cpp index 6c0ec7c..3c309dd 100644 --- a/app/PrefsDialog.cpp +++ b/app/PrefsDialog.cpp @@ -76,7 +76,7 @@ PrefsGeneralPage::OnDefaults(void) /* assumes that the controls are numbered sequentially */ for (int i = 0; i < kNumVisibleColumns; i++) { pButton = (CButton*) GetDlgItem(IDC_COL_PATHNAME+i); - ASSERT(pButton != nil); + ASSERT(pButton != NULL); pButton->SetCheck(1); // 0=unchecked, 1=checked, 2=indeterminate } @@ -94,13 +94,13 @@ PrefsGeneralPage::OnAssociations(void) EditAssocDialog assocDlg; assocDlg.fOurAssociations = fOurAssociations; - fOurAssociations = nil; + fOurAssociations = NULL; if (assocDlg.DoModal() == IDOK) { // steal the modified associations delete[] fOurAssociations; fOurAssociations = assocDlg.fOurAssociations; - assocDlg.fOurAssociations = nil; + assocDlg.fOurAssociations = NULL; SetModified(TRUE); } } @@ -301,7 +301,7 @@ PrefsCompressionPage::DisableWnd(int id) { CWnd* pWnd; pWnd = GetDlgItem(id); - if (pWnd == nil) { + if (pWnd == NULL) { ASSERT(false); return; } @@ -378,7 +378,7 @@ PrefsFviewPage::OnInitDialog(void) //WMSG0("Configuring spin\n"); pSpin = (CSpinButtonCtrl*) GetDlgItem(IDC_PVIEW_SIZE_SPIN); - ASSERT(pSpin != nil); + ASSERT(pSpin != NULL); UDACCEL uda; uda.nSec = 0; @@ -541,7 +541,7 @@ PrefsFilesPage::OnChooseFolder(void) /* get the currently-showing text from the edit field */ pEditWnd = GetDlgItem(IDC_PREF_TEMP_FOLDER); - ASSERT(pEditWnd != nil); + ASSERT(pEditWnd != NULL); pEditWnd->GetWindowText(editPath); chooseDir.SetPathName(editPath); diff --git a/app/PrefsDialog.h b/app/PrefsDialog.h index fbee91b..181eb69 100644 --- a/app/PrefsDialog.h +++ b/app/PrefsDialog.h @@ -28,7 +28,7 @@ public: fCoerceDOSFilenames(FALSE), fSpacesToUnder(FALSE), fDefaultsPushed(FALSE), - fOurAssociations(nil) + fOurAssociations(NULL) {} virtual ~PrefsGeneralPage(void) { delete[] fOurAssociations; diff --git a/app/Print.cpp b/app/Print.cpp index 46a2040..9d4936b 100644 --- a/app/Print.cpp +++ b/app/Print.cpp @@ -27,8 +27,8 @@ void PrintStuff::InitBasics(CDC* pDC) { - ASSERT(pDC != nil); - ASSERT(fpDC == nil); + ASSERT(pDC != NULL); + ASSERT(fpDC == NULL); fpDC = pDC; @@ -50,9 +50,9 @@ PrintStuff::InitBasics(CDC* pDC) void PrintStuff::CreateFontByNumLines(CFont* pFont, int numLines) { - ASSERT(pFont != nil); + ASSERT(pFont != NULL); ASSERT(numLines > 0); - ASSERT(fpDC != nil); + ASSERT(fpDC != NULL); /* required height */ int reqCharHeight; @@ -172,7 +172,7 @@ void PrintContentList::CalcNumPages(void) { /* set up our local goodies */ - ASSERT(fpContentList != nil); + ASSERT(fpContentList != NULL); int numLines = fpContentList->GetItemCount(); ASSERT(numLines > 0); @@ -270,7 +270,7 @@ bail: // destroy print-cancel dialog and restore main window fpParentWnd->EnableWindow(TRUE); //fpParentWnd->SetActiveWindow(); - if (pPCD != nil) + if (pPCD != NULL) pPCD->DestroyWindow(); return result; @@ -437,7 +437,7 @@ void PrintRichEdit::Setup(CDC* pDC, CWnd* pParent) { /* preflighting can cause this to be initialized twice */ - fpDC = nil; + fpDC = NULL; /* init base class */ InitBasics(pDC); @@ -485,7 +485,7 @@ PrintRichEdit::PrintAll(CRichEditCtrl* pREC, const WCHAR* title) fEndChar = -1; fStartPage = 0; 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; fStartPage = startPage; 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; fStartPage = 0; 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, int* pNumPages, bool doPrint) { - CancelDialog* pPCD = nil; + CancelDialog* pPCD = NULL; MainWindow* pMain = (MainWindow*)::AfxGetMainWnd(); int result; @@ -547,7 +547,7 @@ PrintRichEdit::StartPrint(CRichEditCtrl* pREC, const WCHAR* title, if (doPrint) { fpParentWnd->EnableWindow(TRUE); - if (pPCD != nil) + if (pPCD != NULL) pPCD->DestroyWindow(); } @@ -806,14 +806,14 @@ PrintRichEdit::DoPrint(CRichEditCtrl* pREC, const WCHAR* title, } } while (textPrinted < textLength); - //WMSG0(" +++ calling FormatRange(nil, FALSE)\n"); - pREC->FormatRange(nil, FALSE); + //WMSG0(" +++ calling FormatRange(NULL, FALSE)\n"); + pREC->FormatRange(NULL, FALSE); //WMSG0(" +++ returned from final FormatRange\n"); if (doPrint) fpDC->EndDoc(); - if (pNumPages != nil) + if (pNumPages != NULL) *pNumPages = pageNum; WMSG1("Printing completed (textPrinted=%ld)\n", textPrinted); diff --git a/app/Print.h b/app/Print.h index 7672da0..dbf8e6c 100644 --- a/app/Print.h +++ b/app/Print.h @@ -18,7 +18,7 @@ */ class PrintStuff { protected: - PrintStuff(void) : fpDC(nil) {} + PrintStuff(void) : fpDC(NULL) {} virtual ~PrintStuff(void) {} /* get basic goodies, based on the DC */ @@ -58,7 +58,7 @@ protected: */ class PrintContentList : public PrintStuff { public: - PrintContentList(void) : fpContentList(nil), fCLLinesPerPage(0) {} + PrintContentList(void) : fpContentList(NULL), fCLLinesPerPage(0) {} virtual ~PrintContentList(void) {} /* set the DC and the parent window (for the cancel box) */ @@ -103,7 +103,7 @@ private: */ class PrintRichEdit : public PrintStuff { public: - PrintRichEdit(void) : fInitialized(false), fpParentWnd(nil) {} + PrintRichEdit(void) : fInitialized(false), fpParentWnd(NULL) {} virtual ~PrintRichEdit(void) {} /* set the DC and the parent window (for the cancel box) */ diff --git a/app/ProgressCounterDialog.h b/app/ProgressCounterDialog.h index 902a812..c8f4812 100644 --- a/app/ProgressCounterDialog.h +++ b/app/ProgressCounterDialog.h @@ -31,7 +31,7 @@ public: } /* enable the parent window before we're destroyed */ virtual BOOL DestroyWindow(void) { - if (fpParentWnd != nil) + if (fpParentWnd != NULL) fpParentWnd->EnableWindow(TRUE); return ModelessDialog::DestroyWindow(); } diff --git a/app/RecompressOptionsDialog.cpp b/app/RecompressOptionsDialog.cpp index 44bff0d..d4ca258 100644 --- a/app/RecompressOptionsDialog.cpp +++ b/app/RecompressOptionsDialog.cpp @@ -56,7 +56,7 @@ RecompressOptionsDialog::LoadComboBox(NuThreadFormat fmt) int retIdx = 0; pCombo = (CComboBox*) GetDlgItem(IDC_RECOMP_COMP); - ASSERT(pCombo != nil); + ASSERT(pCombo != NULL); for (idx = comboIdx = 0; idx < NELEM(kComboStrings); idx++) { if (NufxArchive::IsCompressionSupported(kComboStrings[idx].format)) { @@ -84,7 +84,7 @@ RecompressOptionsDialog::DoDataExchange(CDataExchange* pDX) if (pDX->m_bSaveAndValidate) { CComboBox* pCombo; pCombo = (CComboBox*) GetDlgItem(IDC_RECOMP_COMP); - ASSERT(pCombo != nil); + ASSERT(pCombo != NULL); fCompressionType = pCombo->GetItemData(fCompressionIdx); WMSG2("DDX got type=%d from combo index %d\n", diff --git a/app/Registry.cpp b/app/Registry.cpp index d72270e..f7e9911 100644 --- a/app/Registry.cpp +++ b/app/Registry.cpp @@ -230,7 +230,7 @@ void MyRegistry::FixBasicSettings(void) const { 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"); @@ -248,8 +248,8 @@ MyRegistry::ConfigureAppID(const WCHAR* appID, const WCHAR* descr, { WMSG2(" Configuring '%ls' for '%ls'\n", appID, exeName); - HKEY hAppKey = nil; - HKEY hIconKey = nil; + HKEY hAppKey = NULL; + HKEY hIconKey = NULL; DWORD dw; if (RegCreateKeyEx(HKEY_CLASSES_ROOT, appID, 0, REG_NONE, @@ -267,7 +267,7 @@ MyRegistry::ConfigureAppID(const WCHAR* appID, const WCHAR* descr, long res; 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) { WMSG1(" Icon for '%ls' already exists, not altering\n", appID); } else { @@ -307,10 +307,10 @@ MyRegistry::ConfigureAppIDSubFields(HKEY hAppKey, const WCHAR* descr, HKEY hShellKey, hOpenKey, hCommandKey; DWORD dw; - ASSERT(hAppKey != nil); - ASSERT(descr != nil); - ASSERT(exeName != nil); - hShellKey = hOpenKey = hCommandKey = nil; + ASSERT(hAppKey != NULL); + ASSERT(descr != NULL); + ASSERT(exeName != NULL); + hShellKey = hOpenKey = hCommandKey = NULL; if (RegSetValueEx(hAppKey, L"", 0, REG_SZ, (const BYTE*) descr, wcslen(descr) * sizeof(WCHAR)) != ERROR_SUCCESS) @@ -335,7 +335,7 @@ MyRegistry::ConfigureAppIDSubFields(HKEY hAppKey, const WCHAR* descr, long res; size = sizeof(buf); // size in bytes - res = RegQueryValueEx(hCommandKey, L"", nil, &type, (LPBYTE) buf, + res = RegQueryValueEx(hCommandKey, L"", NULL, &type, (LPBYTE) buf, &size); if (res == ERROR_SUCCESS && size > 1) { WMSG1(" Command already exists, not altering ('%ls')\n", buf); @@ -423,7 +423,7 @@ MyRegistry::GetFileAssoc(int idx, CString* pExt, CString* pHandler, *pHandler = ""; CString appID; - HKEY hExtKey = nil; + HKEY hExtKey = NULL; res = RegOpenKeyEx(HKEY_CLASSES_ROOT, *pExt, 0, KEY_READ, &hExtKey); if (res == ERROR_SUCCESS) { @@ -431,7 +431,7 @@ MyRegistry::GetFileAssoc(int idx, CString* pExt, CString* pHandler, DWORD type; 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) { WMSG1(" Got '%ls'\n", buf); appID = buf; @@ -465,7 +465,7 @@ MyRegistry::GetAssocAppName(const CString& appID, CString* pCmd) const { CString keyName; WCHAR buf[260]; - HKEY hAppKey = nil; + HKEY hAppKey = NULL; long res; int result = -1; @@ -476,7 +476,7 @@ MyRegistry::GetAssocAppName(const CString& appID, CString* pCmd) const DWORD type; 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) { CString cmd(buf); int pos; @@ -574,7 +574,7 @@ bool MyRegistry::GetAssocState(const WCHAR* ext) const { WCHAR buf[260]; - HKEY hExtKey = nil; + HKEY hExtKey = NULL; int res; bool result = false; @@ -582,7 +582,7 @@ MyRegistry::GetAssocState(const WCHAR* ext) const if (res == ERROR_SUCCESS) { DWORD type; 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) { /* compare it to known appID values */ WMSG2(" Found '%ls', testing '%ls'\n", ext, buf); @@ -605,9 +605,9 @@ MyRegistry::GetAssocState(const WCHAR* ext) const int MyRegistry::DisownExtension(const WCHAR* ext) const { - ASSERT(ext != nil); + ASSERT(ext != NULL); ASSERT(ext[0] == '.'); - if (ext == nil || wcslen(ext) < 2) + if (ext == NULL || wcslen(ext) < 2) return -1; if (RegDeleteKeyNT(HKEY_CLASSES_ROOT, ext) == ERROR_SUCCESS) { @@ -628,12 +628,12 @@ MyRegistry::DisownExtension(const WCHAR* ext) const int MyRegistry::OwnExtension(const WCHAR* ext, const WCHAR* appID) const { - ASSERT(ext != nil); + ASSERT(ext != NULL); ASSERT(ext[0] == '.'); - if (ext == nil || wcslen(ext) < 2) + if (ext == NULL || wcslen(ext) < 2) return -1; - HKEY hExtKey = nil; + HKEY hExtKey = NULL; DWORD dw; int res, result = -1; diff --git a/app/RenameEntryDialog.cpp b/app/RenameEntryDialog.cpp index ac7c8a2..9a26331 100644 --- a/app/RenameEntryDialog.cpp +++ b/app/RenameEntryDialog.cpp @@ -55,7 +55,7 @@ RenameEntryDialog::OnInitDialog(void) /* select the editable text and set the focus */ pEdit = (CEdit*) GetDlgItem(IDC_RENAME_NEW); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); pEdit->SetSel(0, -1); pEdit->SetFocus(); diff --git a/app/RenameEntryDialog.h b/app/RenameEntryDialog.h index 888658a..ab17dfe 100644 --- a/app/RenameEntryDialog.h +++ b/app/RenameEntryDialog.h @@ -30,8 +30,8 @@ public: { fFssep = '='; //fNewNameLimit = 0; - fpArchive = nil; - fpEntry = nil; + fpArchive = NULL; + fpEntry = NULL; fCanRenameFullPath = false; fCanChangeFssep = false; } diff --git a/app/RenameVolumeDialog.cpp b/app/RenameVolumeDialog.cpp index e3b7c38..47f8a7d 100644 --- a/app/RenameVolumeDialog.cpp +++ b/app/RenameVolumeDialog.cpp @@ -37,7 +37,7 @@ RenameVolumeDialog::OnInitDialog(void) CTreeCtrl* pTree = (CTreeCtrl*) GetDlgItem(IDC_RENAMEVOL_TREE); DiskImgLib::DiskFS* pDiskFS = fpArchive->GetDiskFS(); - ASSERT(pTree != nil); + ASSERT(pTree != NULL); fDiskFSTree.fIncludeSubdirs = false; fDiskFSTree.fExpandDepth = -1; @@ -51,7 +51,7 @@ RenameVolumeDialog::OnInitDialog(void) /* select the default text and set the focus */ CEdit* pEdit = (CEdit*) GetDlgItem(IDC_RENAMEVOL_NEW); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); pEdit->SetSel(0, -1); pEdit->SetFocus(); @@ -84,7 +84,7 @@ RenameVolumeDialog::DoDataExchange(CDataExchange* pDX) HTREEITEM selected; selected = pTree->GetSelectedItem(); - if (selected == nil) { + if (selected == NULL) { errMsg = "Please select a disk to rename."; MessageBox(errMsg, appName, MB_OK); pDX->Fail(); @@ -142,7 +142,7 @@ RenameVolumeDialog::OnSelChanged(NMHDR* pnmh, LRESULT* pResult) CString newText; selected = pTree->GetSelectedItem(); - if (selected != nil) { + if (selected != NULL) { DiskFSTree::TargetData* pTargetData; pTargetData = (DiskFSTree::TargetData*) pTree->GetItemData(selected); if (pTargetData->selectable) { @@ -153,7 +153,7 @@ RenameVolumeDialog::OnSelChanged(NMHDR* pnmh, LRESULT* pResult) } CEdit* pEdit = (CEdit*) GetDlgItem(IDC_RENAMEVOL_NEW); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); pEdit->SetWindowText(newText); pEdit->SetSel(0, -1); diff --git a/app/RenameVolumeDialog.h b/app/RenameVolumeDialog.h index 0b7ed1b..36e0d8b 100644 --- a/app/RenameVolumeDialog.h +++ b/app/RenameVolumeDialog.h @@ -23,7 +23,7 @@ public: RenameVolumeDialog(CWnd* pParentWnd = NULL) : CDialog(IDD_RENAME_VOLUME, pParentWnd) { - fpArchive = nil; + fpArchive = NULL; } virtual ~RenameVolumeDialog(void) {} diff --git a/app/Squeeze.cpp b/app/Squeeze.cpp index 6d61345..43db1f3 100644 --- a/app/Squeeze.cpp +++ b/app/Squeeze.cpp @@ -112,9 +112,9 @@ SQRead(FILE* fp, void* buf, size_t nbyte) { size_t result; - ASSERT(buf != nil); + ASSERT(buf != NULL); ASSERT(nbyte > 0); - ASSERT(fp != nil); + ASSERT(fp != NULL); errno = 0; 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 * 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 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 short nodeCount; int i, inrep; - unsigned char* tmpBuf = nil; + unsigned char* tmpBuf = NULL; unsigned char lastc = 0; tmpBuf = (unsigned char*) malloc(kSqBufferSize); - if (tmpBuf == nil) { + if (tmpBuf == NULL) { err = kNuErrMalloc; goto bail; } @@ -340,9 +340,9 @@ UnSqueeze(FILE* fp, unsigned long realEOF, ExpandBuffer* outExp, val = 2; } while (--val) { - /*if (pCrc != nil) + /*if (pCrc != NULL) *pCrc = Nu_CalcCRC16(*pCrc, &lastc, 1);*/ - if (outExp != nil) + if (outExp != NULL) outExp->Putc(lastc); if (fullSqHeader) { checksum += lastc; @@ -356,9 +356,9 @@ UnSqueeze(FILE* fp, unsigned long realEOF, ExpandBuffer* outExp, inrep = true; } else { lastc = val; - /*if (pCrc != nil) + /*if (pCrc != NULL) *pCrc = Nu_CalcCRC16(*pCrc, &lastc, 1);*/ - if (outExp != nil) + if (outExp != NULL) outExp->Putc(lastc); if (fullSqHeader) { checksum += lastc; @@ -404,7 +404,7 @@ UnSqueeze(FILE* fp, unsigned long realEOF, ExpandBuffer* outExp, } bail: - //if (outfp != nil) + //if (outfp != NULL) // fflush(outfp); free(tmpBuf); return err; diff --git a/app/SubVolumeDialog.cpp b/app/SubVolumeDialog.cpp index a90f94a..5845ce6 100644 --- a/app/SubVolumeDialog.cpp +++ b/app/SubVolumeDialog.cpp @@ -25,18 +25,18 @@ END_MESSAGE_MAP() BOOL SubVolumeDialog::OnInitDialog(void) { - ASSERT(fpDiskFS != nil); + ASSERT(fpDiskFS != NULL); CListBox* pListBox = (CListBox*) GetDlgItem(IDC_SUBV_LIST); - ASSERT(pListBox != nil); + ASSERT(pListBox != NULL); // if (pListBox->SetTabStops(12) != TRUE) { // ASSERT(false); // } - DiskFS::SubVolume* pSubVol = fpDiskFS->GetNextSubVolume(nil); - ASSERT(pSubVol != nil); // shouldn't be here otherwise - while (pSubVol != nil) { + DiskFS::SubVolume* pSubVol = fpDiskFS->GetNextSubVolume(NULL); + ASSERT(pSubVol != NULL); // shouldn't be here otherwise + while (pSubVol != NULL) { CString volumeIdW(pSubVol->GetDiskFS()->GetVolumeID()); pListBox->AddString(volumeIdW); // makes a copy of the string diff --git a/app/Tools.cpp b/app/Tools.cpp index 30d60ba..137dd40 100644 --- a/app/Tools.cpp +++ b/app/Tools.cpp @@ -30,7 +30,7 @@ * Put up the ImageFormatDialog and apply changes to "pImg". * * "*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. * * 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.fFileSource = fileSource; imf.fAllowUnknown = allowUnknown; - if (pDisplayFormat == nil) + if (pDisplayFormat == NULL) imf.SetQueryDisplayFormat(false); /* 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", imf.fSectorOrder, imf.fFSFormat); - if (pDisplayFormat != nil) + if (pDisplayFormat != NULL) *pDisplayFormat = imf.fDisplayFormat; if (imf.fSectorOrder != pImg->GetSectorOrder() || imf.fFSFormat != pImg->GetFSFormat()) @@ -120,7 +120,7 @@ MainWindow::OnToolsDiskEdit(void) failed.LoadString(IDS_FAILED); diskEditOpen.fArchiveOpen = false; - if (fpOpenArchive != nil && + if (fpOpenArchive != NULL && fpOpenArchive->GetArchiveKind() == GenericArchive::kArchiveDiskImage) { diskEditOpen.fArchiveOpen = true; @@ -190,7 +190,7 @@ MainWindow::OnToolsDiskEdit(void) long length; tmpfp = fopen(loadName, "rb"); - ASSERT(tmpfp != nil); + ASSERT(tmpfp != NULL); fseek(tmpfp, 0, SEEK_END); length = ftell(tmpfp); rewind(tmpfp); @@ -307,7 +307,7 @@ MainWindow::OnToolsDiskEdit(void) */ DiskFS* pDiskFS; pDiskFS = img.OpenAppropriateDiskFS(true); - if (pDiskFS == nil) { + if (pDiskFS == NULL) { WMSG0("HEY: OpenAppropriateDiskFS failed!\n"); goto bail; } @@ -413,7 +413,7 @@ MainWindow::OnToolsDiskConv(void) fPreferences.GetPrefBool(kPrQueryImageFormat)) { if (TryDiskImgOverride(&srcImg, loadName, DiskImg::kFormatGenericProDOSOrd, - nil, false, &errMsg) != IDOK) + NULL, false, &errMsg) != IDOK) { goto bail; } @@ -492,7 +492,7 @@ MainWindow::OnToolsDiskConv(void) const DiskImg::NibbleDescr* pNibbleDescr; 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 * 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, - pNibbleDescr != nil ? pNibbleDescr->description : "---"); + pNibbleDescr != NULL ? pNibbleDescr->description : "---"); if (srcImg.GetFileFormat() == DiskImg::kFileFormatTrackStar && fileFormat != DiskImg::kFileFormatTrackStar) @@ -723,7 +723,7 @@ MainWindow::OnToolsDiskConv(void) /* * 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) { errMsg.Format(L"Copy failed: %hs.", DiskImgLib::DIStrError(dierr)); ShowFailureMsg(this, errMsg, IDS_FAILED); @@ -872,7 +872,7 @@ MainWindow::CopyDiskImage(DiskImg* pDstImg, DiskImg* pSrcImg, bool bulk, { DIError dierr = kDIErrNone; CString errMsg; - unsigned char* dataBuf = nil; + unsigned char* dataBuf = NULL; if (pSrcImg->GetHasNibbles() && pDstImg->GetHasNibbles() && pSrcImg->GetPhysicalFormat() == pDstImg->GetPhysicalFormat()) @@ -892,7 +892,7 @@ MainWindow::CopyDiskImage(DiskImg* pDstImg, DiskImg* pSrcImg, bool bulk, int numTracks; dataBuf = new unsigned char[kTrackAllocSize]; - if (dataBuf == nil) { + if (dataBuf == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -930,7 +930,7 @@ MainWindow::CopyDiskImage(DiskImg* pDstImg, DiskImg* pSrcImg, bool bulk, int numBadSectors = 0; dataBuf = new unsigned char[256]; // one sector - if (dataBuf == nil) { + if (dataBuf == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -988,7 +988,7 @@ MainWindow::CopyDiskImage(DiskImg* pDstImg, DiskImg* pSrcImg, bool bulk, blocksPerRead = 64; // 32K per read; max seems to be 64K? dataBuf = new unsigned char[blocksPerRead * 512]; - if (dataBuf == nil) { + if (dataBuf == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -1026,7 +1026,7 @@ MainWindow::CopyDiskImage(DiskImg* pDstImg, DiskImg* pSrcImg, bool bulk, } /* if we have a cancel dialog, keep it lively */ - if (pPCDialog != nil && (block % 18) == 0) { + if (pPCDialog != NULL && (block % 18) == 0) { int status; PeekAndPump(); LONGLONG bigBlock = block; @@ -1077,7 +1077,7 @@ public: void SetCurrentFile(const WCHAR* fileName) { CWnd* pWnd = GetDlgItem(IDC_BULKCONV_PATHNAME); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->SetWindowText(fileName); } @@ -1137,7 +1137,7 @@ MainWindow::OnToolsBulkDiskConv(void) POSITION posn; posn = dlg.GetStartPosition(); nameCount = 0; - while (posn != nil) { + while (posn != NULL) { CString pathName; pathName = dlg.GetNextPathName(posn); nameCount++; @@ -1181,7 +1181,7 @@ MainWindow::OnToolsBulkDiskConv(void) * Loop through all selected files and convert them one at a time. */ posn = dlg.GetStartPosition(); - while (posn != nil) { + while (posn != NULL) { CString pathName; pathName = dlg.GetNextPathName(posn); WMSG1(" BulkConv: source path='%ls'\n", (LPCWSTR) pathName); @@ -1219,7 +1219,7 @@ bail: // restore the main window to prominence EnableWindow(TRUE); //SetActiveWindow(); - if (pCancelDialog != nil) + if (pCancelDialog != NULL) pCancelDialog->DestroyWindow(); delete[] dlg.m_ofn.lpstrFile; @@ -1273,7 +1273,7 @@ MainWindow::BulkConvertImage(const WCHAR* pathName, const WCHAR* targetDir, */ if (srcImg.GetSectorOrder() == DiskImg::kSectorOrderUnknown) { if (TryDiskImgOverride(&srcImg, pathName, DiskImg::kFormatGenericProDOSOrd, - nil, pErrMsg) != IDOK) + NULL, pErrMsg) != IDOK) { *pErrMsg = "Image conversion cancelled."; } @@ -1326,7 +1326,7 @@ MainWindow::BulkConvertImage(const WCHAR* pathName, const WCHAR* targetDir, const DiskImg::NibbleDescr* pNibbleDescr; 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 * 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, - pNibbleDescr != nil ? pNibbleDescr->description : "---"); + pNibbleDescr != NULL ? pNibbleDescr->description : "---"); /* * 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. */ - dierr = CopyDiskImage(&dstImg, &srcImg, true, isPartial, nil); + dierr = CopyDiskImage(&dstImg, &srcImg, true, isPartial, NULL); if (dierr != kDIErrNone) goto bail; @@ -1551,7 +1551,7 @@ MainWindow::OnToolsSSTMerge(void) const int kBadCountThreshold = 3072; DiskImg srcImg0, srcImg1; CString appName, saveName, saveFolder, errMsg; - BYTE* trackBuf = nil; + BYTE* trackBuf = NULL; long badCount; // no need to flush -- can't really open raw SST images @@ -1563,7 +1563,7 @@ MainWindow::OnToolsSSTMerge(void) appName.LoadString(IDS_MB_APP_NAME); trackBuf = new BYTE[kSSTNumTracks * kSSTTrackLen]; - if (trackBuf == nil) + if (trackBuf == NULL) goto bail; /* @@ -1623,7 +1623,7 @@ MainWindow::OnToolsSSTMerge(void) FILE* fp; fp = _wfopen(saveName, L"wb"); - if (fp == nil) { + if (fp == NULL) { errMsg.Format(L"Unable to create '%ls': %hs.", (LPCWSTR) saveName, strerror(errno)); ShowFailureMsg(this, errMsg, IDS_FAILED); @@ -1723,7 +1723,7 @@ MainWindow::SSTOpenImage(int seqNum, DiskImg* pDiskImg) fPreferences.GetPrefBool(kPrQueryImageFormat)) { if (TryDiskImgOverride(pDiskImg, loadName, - DiskImg::kFormatGenericDOSOrd, nil, false, &errMsg) != IDOK) + DiskImg::kFormatGenericDOSOrd, NULL, false, &errMsg) != IDOK) { goto bail; } @@ -1968,7 +1968,7 @@ MainWindow::VolumeCopier(bool openFile) { VolumeCopyDialog copyDlg(this); DiskImg srcImg; - //DiskFS* pDiskFS = nil; + //DiskFS* pDiskFS = NULL; DIError dierr; CString failed, errMsg, msg; CString deviceName; @@ -2060,7 +2060,7 @@ MainWindow::VolumeCopier(bool openFile) fPreferences.GetPrefBool(kPrQueryImageFormat)) { if (TryDiskImgOverride(&srcImg, deviceName, DiskImg::kFormatUnknown, - nil, true, &errMsg) != IDOK) + NULL, true, &errMsg) != IDOK) { goto bail; } @@ -2105,7 +2105,7 @@ void MainWindow::OnToolsDiskImageCreator(void) { CreateImageDialog createDlg(this); - DiskArchive* pNewArchive = nil; + DiskArchive* pNewArchive = NULL; createDlg.fDiskFormatIdx = fPreferences.GetPrefLong(kPrDiskImageCreateFormat); @@ -2312,7 +2312,7 @@ MainWindow::OnToolsEOLScanner(void) WMSG1("Scanning '%ls'\n", (LPCWSTR) fileName); FILE* fp = _wfopen(fileName, L"rb"); - if (fp == nil) { + if (fp == NULL) { errMsg.Format(L"Unable to open '%ls': %hs.", (LPCWSTR) fileName, strerror(errno)); ShowFailureMsg(this, errMsg, IDS_FAILED); @@ -2428,7 +2428,7 @@ MainWindow::EditTwoImgProps(const WCHAR* fileName) { TwoImgPropsDialog dialog; TwoImgHeader header; - FILE* fp = nil; + FILE* fp = NULL; bool dirty = false; CString errMsg; long totalLength; @@ -2436,10 +2436,10 @@ MainWindow::EditTwoImgProps(const WCHAR* fileName) WMSG1("EditTwoImgProps '%ls'\n", fileName); fp = _wfopen(fileName, L"r+b"); - if (fp == nil) { + if (fp == NULL) { int firstError = errno; fp = _wfopen(fileName, L"rb"); - if (fp == nil) { + if (fp == NULL) { errMsg.Format(L"Unable to open '%ls': %hs.", fileName, strerror(firstError)); goto bail; @@ -2499,7 +2499,7 @@ MainWindow::EditTwoImgProps(const WCHAR* fileName) } bail: - if (fp != nil) + if (fp != NULL) fclose(fp); if (!errMsg.IsEmpty()) { ShowFailureMsg(this, errMsg, IDS_FAILED); diff --git a/app/TwoImgPropsDialog.cpp b/app/TwoImgPropsDialog.cpp index a3342c1..e31772a 100644 --- a/app/TwoImgPropsDialog.cpp +++ b/app/TwoImgPropsDialog.cpp @@ -28,7 +28,7 @@ TwoImgPropsDialog::OnInitDialog(void) CEdit* pEdit; CString tmpStr; - ASSERT(fpHeader != nil); + ASSERT(fpHeader != NULL); /* * Set up the static fields. @@ -125,7 +125,7 @@ TwoImgPropsDialog::DoDataExchange(CDataExchange* pDX) CStringA commentA(comment); fpHeader->SetComment(commentA); } else { - fpHeader->SetComment(nil); + fpHeader->SetComment(NULL); } } else { CWnd* pWnd; diff --git a/app/UseSelectionDialog.cpp b/app/UseSelectionDialog.cpp index 916c4e2..c86c481 100644 --- a/app/UseSelectionDialog.cpp +++ b/app/UseSelectionDialog.cpp @@ -33,7 +33,7 @@ UseSelectionDialog::OnInitDialog(void) /* grab the radio button with the selection count */ pWnd = GetDlgItem(IDC_USE_SELECTED); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); /* set the string using a string table entry */ if (fSelectedCount == 1) { @@ -53,12 +53,12 @@ UseSelectionDialog::OnInitDialog(void) SetWindowText(str); pWnd = GetDlgItem(IDC_USE_ALL); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); str.LoadString(fAllID); pWnd->SetWindowText(str); pWnd = GetDlgItem(IDOK); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); str.LoadString(fOkLabelID); pWnd->SetWindowText(str); diff --git a/app/ViewFilesDialog.cpp b/app/ViewFilesDialog.cpp index fa5bb74..3eb9b24 100644 --- a/app/ViewFilesDialog.cpp +++ b/app/ViewFilesDialog.cpp @@ -51,11 +51,11 @@ ViewFilesDialog::OnInitDialog(void) { WMSG0("Now in VFD OnInitDialog!\n"); - ASSERT(fpSelSet != nil); + ASSERT(fpSelSet != NULL); /* delete dummy control and insert our own with modded styles */ CRichEditCtrl* pEdit = (CRichEditCtrl*)GetDlgItem(IDC_FVIEW_EDITBOX); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); CRect rect; pEdit->GetWindowRect(&rect); pEdit->DestroyWindow(); @@ -264,7 +264,7 @@ ViewFilesDialog::ShiftControls(int deltaX, int deltaY) */ CRect rect; CRichEditCtrl* pEdit = (CRichEditCtrl*) GetDlgItem(IDC_FVIEW_EDITBOX); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); //pEdit->GetClientRect(&rect); pEdit->GetWindowRect(&rect); //GetClientRect(&rect); @@ -325,15 +325,15 @@ ViewFilesDialog::DisplayText(const WCHAR* fileName) bool emptyFlg = false; bool editHadFocus = false; - ASSERT(fpOutput != nil); - ASSERT(fileName != nil); + ASSERT(fpOutput != NULL); + ASSERT(fileName != NULL); errFlg = fpOutput->GetOutputKind() == ReformatOutput::kOutputErrorMsg; ASSERT(fpOutput->GetOutputKind() != ReformatOutput::kOutputUnknown); 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] */ pEdit->SetOptions(ECOOP_OR, ECO_SAVESEL); @@ -373,7 +373,7 @@ ViewFilesDialog::DisplayText(const WCHAR* fileName) * holder". */ CWnd* pFocusWnd = GetFocus(); - if (pFocusWnd == nil || pFocusWnd->m_hWnd == pEdit->m_hWnd) { + if (pFocusWnd == NULL || pFocusWnd->m_hWnd == pEdit->m_hWnd) { editHadFocus = true; GetDlgItem(IDOK)->SetFocus(); } @@ -405,20 +405,20 @@ ViewFilesDialog::DisplayText(const WCHAR* fileName) CClientDC dcScreen(this); HBITMAP hBitmap; - if (fpRichEditOle == nil) { + if (fpRichEditOle == NULL) { /* can't do this in OnInitDialog -- m_pWnd isn't initialized */ fpRichEditOle = pEdit->GetIRichEditOle(); - ASSERT(fpRichEditOle != nil); + ASSERT(fpRichEditOle != NULL); } //FILE* fp = fopen("C:/test/output.bmp", "wb"); - //if (fp != nil) { + //if (fp != NULL) { // pDib->WriteToFile(fp); // fclose(fp); //} hBitmap = fpOutput->GetDIB()->ConvertToDDB(dcScreen.m_hDC); - if (hBitmap == nil) { + if (hBitmap == NULL) { WMSG0("ConvertToDDB failed!\n"); pEdit->SetWindowText(L"Internal error."); errFlg = true; @@ -660,16 +660,16 @@ ViewFilesDialog::OnFviewNext(void) // for debugging -- simulate failure result = -1; delete fpHolder; - fpHolder = nil; + fpHolder = NULL; delete fpOutput; - fpOutput = nil; + fpOutput = NULL; } #endif fBusy = false; if (result != 0) { - ASSERT(fpHolder == nil); - ASSERT(fpOutput == nil); + ASSERT(fpHolder == NULL); + ASSERT(fpOutput == NULL); return; } @@ -715,8 +715,8 @@ ViewFilesDialog::OnFviewPrev(void) fBusy = false; if (result != 0) { - ASSERT(fpHolder == nil); - ASSERT(fpOutput == nil); + ASSERT(fpHolder == NULL); + ASSERT(fpOutput == NULL); return; } @@ -737,7 +737,7 @@ ViewFilesDialog::OnFviewPrev(void) * * 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). */ void @@ -748,7 +748,7 @@ ViewFilesDialog::ConfigurePartButtons(const GenericEntry* pEntry) CButton* pDataWnd = (CButton*) GetDlgItem(IDC_FVIEW_DATA); CButton* pRsrcWnd = (CButton*) GetDlgItem(IDC_FVIEW_RSRC); 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 */ if (pDataWnd->GetCheck() == BST_CHECKED && pEntry->GetHasDataFork()) @@ -774,7 +774,7 @@ ViewFilesDialog::ConfigurePartButtons(const GenericEntry* pEntry) pRsrcWnd->SetCheck(BST_UNCHECKED); pCmmtWnd->SetCheck(BST_UNCHECKED); - if (pEntry == nil) { + if (pEntry == NULL) { pDataWnd->EnableWindow(FALSE); pRsrcWnd->EnableWindow(FALSE); pCmmtWnd->EnableWindow(FALSE); @@ -803,7 +803,7 @@ ViewFilesDialog::GetSelectedPart(void) CButton* pDataWnd = (CButton*) GetDlgItem(IDC_FVIEW_DATA); CButton* pRsrcWnd = (CButton*) GetDlgItem(IDC_FVIEW_RSRC); 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) return ReformatHolder::kPartData; @@ -831,12 +831,12 @@ ViewFilesDialog::ReformatPrep(GenericEntry* pEntry) int result; delete fpHolder; - fpHolder = nil; + fpHolder = NULL; result = pMainWindow->GetFileParts(pEntry, &fpHolder); if (result != 0) { WMSG0("GetFileParts(prev) failed!\n"); - ASSERT(fpHolder == nil); + ASSERT(fpHolder == NULL); return -1; } @@ -869,29 +869,29 @@ ViewFilesDialog::Reformat(const GenericEntry* pEntry, CWaitCursor waitc; delete fpOutput; - fpOutput = nil; + fpOutput = NULL; /* run the best one */ fpOutput = fpHolder->Apply(part, id); //bail: - if (fpOutput != nil) { + if (fpOutput != NULL) { // success -- do some sanity checks switch (fpOutput->GetOutputKind()) { case ReformatOutput::kOutputText: case ReformatOutput::kOutputRTF: case ReformatOutput::kOutputCSV: case ReformatOutput::kOutputErrorMsg: - ASSERT(fpOutput->GetTextBuf() != nil); - ASSERT(fpOutput->GetDIB() == nil); + ASSERT(fpOutput->GetTextBuf() != NULL); + ASSERT(fpOutput->GetDIB() == NULL); break; case ReformatOutput::kOutputBitmap: - ASSERT(fpOutput->GetDIB() != nil); - ASSERT(fpOutput->GetTextBuf() == nil); + ASSERT(fpOutput->GetDIB() != NULL); + ASSERT(fpOutput->GetTextBuf() == NULL); break; case ReformatOutput::kOutputRaw: - // text buf might be nil - ASSERT(fpOutput->GetDIB() == nil); + // text buf might be NULL + ASSERT(fpOutput->GetDIB() == NULL); break; } return 0; @@ -1014,7 +1014,7 @@ void ViewFilesDialog::OnFormatSelChange(void) { CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_FVIEW_FORMATSEL); - ASSERT(pCombo != nil); + ASSERT(pCombo != NULL); WMSG1("+++ SELECTION IS NOW %d\n", pCombo->GetCurSel()); SelectionEntry* pSelEntry = fpSelSet->IterCurrent(); @@ -1054,11 +1054,11 @@ ViewFilesDialog::ForkSelectCommon(ReformatHolder::ReformatPart part) ReformatHolder::ReformatID id; WMSG1("Switching to file part=%d\n", part); - ASSERT(fpHolder != nil); - ASSERT(fpSelSet != nil); - ASSERT(fpSelSet->IterCurrent() != nil); + ASSERT(fpHolder != NULL); + ASSERT(fpSelSet != NULL); + ASSERT(fpSelSet->IterCurrent() != NULL); pEntry = fpSelSet->IterCurrent()->GetEntry(); - ASSERT(pEntry != nil); + ASSERT(pEntry != NULL); id = ConfigureFormatSel(part); @@ -1176,7 +1176,7 @@ void ViewFilesDialog::NewFontSelected(bool resetBold) { CRichEditCtrl* pEdit = (CRichEditCtrl*) GetDlgItem(IDC_FVIEW_EDITBOX); - ASSERT(pEdit != nil); + ASSERT(pEdit != NULL); CHARFORMAT cf; cf.cbSize = sizeof(CHARFORMAT); @@ -1291,7 +1291,7 @@ ViewFilesDialog::OnFviewFind(void) { DWORD flags = 0; - if (fpFindDialog != nil) + if (fpFindDialog != NULL) return; if (fFindDown) @@ -1322,7 +1322,7 @@ ViewFilesDialog::OnFviewFind(void) LRESULT ViewFilesDialog::OnFindDialogMessage(WPARAM wParam, LPARAM lParam) { - assert(fpFindDialog != nil); + assert(fpFindDialog != NULL); fFindDown = (fpFindDialog->SearchDown() != 0); fFindMatchCase = (fpFindDialog->MatchCase() != 0); @@ -1330,7 +1330,7 @@ ViewFilesDialog::OnFindDialogMessage(WPARAM wParam, LPARAM lParam) if (fpFindDialog->IsTerminating()) { WMSG0("VFD find dialog closing\n"); - fpFindDialog = nil; + fpFindDialog = NULL; return 0; } diff --git a/app/ViewFilesDialog.h b/app/ViewFilesDialog.h index e80c280..be9a15d 100644 --- a/app/ViewFilesDialog.h +++ b/app/ViewFilesDialog.h @@ -25,18 +25,18 @@ public: ViewFilesDialog(CWnd* pParentWnd = NULL) : CDialog(IDD_FILE_VIEWER, pParentWnd) { - //fpMainWindow = nil; - fpSelSet = nil; - fpHolder = nil; - fpOutput = nil; + //fpMainWindow = NULL; + fpSelSet = NULL; + fpHolder = NULL; + fpOutput = NULL; fTypeFace = ""; fPointSize = 0; fNoWrapText = false; fBusy = false; - fpRichEditOle = nil; + fpRichEditOle = NULL; fFirstResize = false; - fpFindDialog = nil; + fpFindDialog = NULL; fFindDown = false; fFindMatchCase = false; fFindMatchWholeWord = false; diff --git a/app/VolumeCopyDialog.cpp b/app/VolumeCopyDialog.cpp index 00bf690..b2ed261 100644 --- a/app/VolumeCopyDialog.cpp +++ b/app/VolumeCopyDialog.cpp @@ -39,10 +39,10 @@ public: void SetCurrentFiles(const WCHAR* fromName, const WCHAR* toName) { CWnd* pWnd = GetDlgItem(IDC_VOLUMECOPYPROG_FROM); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->SetWindowText(fromName); pWnd = GetDlgItem(IDC_VOLUMECOPYPROG_TO); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->SetWindowText(toName); } @@ -70,7 +70,7 @@ VolumeCopyDialog::OnInitDialog(void) //this->GetWindowRect(&rect); //WMSG4("RECT is %d, %d, %d, %d\n", rect.left, rect.top, rect.bottom, rect.right); - ASSERT(fpDiskImg != nil); + ASSERT(fpDiskImg != NULL); ScanDiskInfo(false); CDialog::OnInitDialog(); // does DDX init @@ -94,7 +94,7 @@ VolumeCopyDialog::OnInitDialog(void) * [icon] Volume name | Format | Size (MB/GB) | Block count */ CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_VOLUMECOPYSEL_LIST); - ASSERT(pListView != nil); + ASSERT(pListView != NULL); ListView_SetExtendedListViewStyleEx(pListView->m_hWnd, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT); @@ -150,7 +150,7 @@ VolumeCopyDialog::Cleanup(void) { WMSG0(" VolumeCopyDialog is done, cleaning up DiskFS\n"); 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); CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_VOLUMECOPYSEL_LIST); - ASSERT(pListView != nil); + ASSERT(pListView != NULL); CButton* pButton; UINT selectedCount; @@ -201,8 +201,8 @@ VolumeCopyDialog::ScanDiskInfo(bool scanTop) DIError dierr; CString errMsg, failed; - assert(fpDiskImg != nil); - assert(fpDiskFS == nil); + assert(fpDiskImg != NULL); + assert(fpDiskFS == NULL); if (scanTop) { DiskImg::FSFormat oldFormat; @@ -224,7 +224,7 @@ VolumeCopyDialog::ScanDiskInfo(bool scanTop) { // ignore them if they hit "cancel" (void) pMain->TryDiskImgOverride(fpDiskImg, fPathName, - DiskImg::kFormatUnknown, nil, true, &errMsg); + DiskImg::kFormatUnknown, NULL, true, &errMsg); if (!errMsg.IsEmpty()) { ShowFailureMsg(this, errMsg, IDS_FAILED); return; @@ -262,7 +262,7 @@ VolumeCopyDialog::ScanDiskInfo(bool scanTop) * the sub-volume info, which is unfortunate since it can be slow. */ fpDiskFS = fpDiskImg->OpenAppropriateDiskFS(true); - if (fpDiskFS == nil) { + if (fpDiskFS == NULL) { WMSG0("HEY: OpenAppropriateDiskFS failed!\n"); /* this is fatal, but there's no easy way to die */ /* (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 = nil; + fpWaitDlg = NULL; } return; @@ -296,10 +296,10 @@ VolumeCopyDialog::ScanDiskInfo(bool scanTop) LONG VolumeCopyDialog::OnDialogReady(UINT, LONG) { - if (fpWaitDlg != nil) { + if (fpWaitDlg != NULL) { WMSG0("OnDialogReady found active window, destroying\n"); fpWaitDlg->DestroyWindow(); - fpWaitDlg = nil; + fpWaitDlg = NULL; } return 0; } @@ -316,13 +316,13 @@ void VolumeCopyDialog::LoadList(void) { CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_VOLUMECOPYSEL_LIST); - ASSERT(pListView != nil); + ASSERT(pListView != NULL); int itemIndex = 0; CString unknown = "(unknown)"; pListView->DeleteAllItems(); - if (fpDiskFS == nil) { + if (fpDiskFS == NULL) { /* can only happen if imported volume is unrecognizeable */ return; } @@ -330,10 +330,10 @@ VolumeCopyDialog::LoadList(void) AddToList(pListView, fpDiskImg, fpDiskFS, &itemIndex); DiskImgLib::DiskFS::SubVolume* pSubVolume; - pSubVolume = fpDiskFS->GetNextSubVolume(nil); - while (pSubVolume != nil) { - if (pSubVolume->GetDiskFS() == nil) { - WMSG0("WARNING: sub-volume DiskFS is nil?!\n"); + pSubVolume = fpDiskFS->GetNextSubVolume(NULL); + while (pSubVolume != NULL) { + if (pSubVolume->GetDiskFS() == NULL) { + WMSG0("WARNING: sub-volume DiskFS is NULL?!\n"); assert(false); } else { AddToList(pListView, pSubVolume->GetDiskImg(), @@ -353,10 +353,10 @@ VolumeCopyDialog::AddToList(CListCtrl* pListView, DiskImg* pDiskImg, CString volName, format, sizeStr, blocksStr; long numBlocks; - assert(pListView != nil); - assert(pDiskImg != nil); - assert(pDiskFS != nil); - assert(pIndex != nil); + assert(pListView != NULL); + assert(pDiskImg != NULL); + assert(pDiskFS != NULL); + assert(pIndex != NULL); numBlocks = pDiskImg->GetNumBlocks(); @@ -391,17 +391,17 @@ bool VolumeCopyDialog::GetSelectedDisk(DiskImg** ppDiskImg, DiskFS** ppDiskFS) { CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_VOLUMECOPYSEL_LIST); - ASSERT(pListView != nil); + ASSERT(pListView != NULL); - ASSERT(ppDiskImg != nil); - ASSERT(ppDiskFS != nil); + ASSERT(ppDiskImg != NULL); + ASSERT(ppDiskFS != NULL); if (pListView->GetSelectedCount() != 1) return false; POSITION posn; posn = pListView->GetFirstSelectedItemPosition(); - if (posn == nil) { + if (posn == NULL) { ASSERT(false); return false; } @@ -409,7 +409,7 @@ VolumeCopyDialog::GetSelectedDisk(DiskImg** ppDiskImg, DiskFS** ppDiskFS) DWORD data = pListView->GetItemData(num); *ppDiskFS = (DiskFS*) data; - assert(*ppDiskFS != nil); + assert(*ppDiskFS != NULL); *ppDiskImg = (*ppDiskFS)->GetDiskImg(); return true; } @@ -431,12 +431,12 @@ VolumeCopyDialog::OnHelp(void) void VolumeCopyDialog::OnCopyToFile(void) { - VolumeXferProgressDialog* pProgressDialog = nil; + VolumeXferProgressDialog* pProgressDialog = NULL; Preferences* pPreferences = GET_PREFERENCES_WR(); MainWindow* pMain = (MainWindow*)::AfxGetMainWnd(); DiskImg::FSFormat originalFormat = DiskImg::kFormatUnknown; - DiskImg* pSrcImg = nil; - DiskFS* pSrcFS = nil; + DiskImg* pSrcImg = NULL; + DiskFS* pSrcFS = NULL; DiskImg dstImg; DIError dierr; CString errMsg, saveName, msg, srcName; @@ -445,8 +445,8 @@ VolumeCopyDialog::OnCopyToFile(void) result = GetSelectedDisk(&pSrcImg, &pSrcFS); if (!result) return; - assert(pSrcImg != nil); - assert(pSrcFS != nil); + assert(pSrcImg != NULL); + assert(pSrcFS != NULL); srcName = pSrcFS->GetVolumeName(); @@ -511,11 +511,11 @@ VolumeCopyDialog::OnCopyToFile(void) CWaitCursor waitc; CStringA saveNameA(saveName); - dierr = dstImg.CreateImage(saveNameA, nil, + dierr = dstImg.CreateImage(saveNameA, NULL, DiskImg::kOuterFormatNone, DiskImg::kFileFormatUnadorned, DiskImg::kPhysicalFormatSectors, - nil, + NULL, DiskImg::kSectorOrderProDOS, DiskImg::kFormatGenericProDOSOrd, dstNumBlocks, @@ -542,7 +542,7 @@ VolumeCopyDialog::OnCopyToFile(void) pProgressDialog->SetCurrentFiles(srcName, saveName); time_t startWhen, endWhen; - startWhen = time(nil); + startWhen = time(NULL); /* * Do the actual block copy. @@ -570,7 +570,7 @@ VolumeCopyDialog::OnCopyToFile(void) } /* put elapsed time in the debug log */ - endWhen = time(nil); + endWhen = time(NULL); float elapsed; if (endWhen == startWhen) elapsed = 1.0; @@ -591,7 +591,7 @@ bail: // restore the dialog window to prominence EnableWindow(TRUE); //SetActiveWindow(); - if (pProgressDialog != nil) + if (pProgressDialog != NULL) pProgressDialog->DestroyWindow(); /* un-override the source disk */ @@ -614,14 +614,14 @@ bail: void VolumeCopyDialog::OnCopyFromFile(void) { - VolumeXferProgressDialog* pProgressDialog = nil; + VolumeXferProgressDialog* pProgressDialog = NULL; Preferences* pPreferences = GET_PREFERENCES_WR(); MainWindow* pMain = (MainWindow*)::AfxGetMainWnd(); //DiskImg::FSFormat originalFormat = DiskImg::kFormatUnknown; CString openFilters; CString loadName, targetName, errMsg, warning; - DiskImg* pDstImg = nil; - DiskFS* pDstFS = nil; + DiskImg* pDstImg = NULL; + DiskFS* pDstFS = NULL; DiskImg srcImg; DIError dierr; int result; @@ -639,7 +639,7 @@ VolumeCopyDialog::OnCopyFromFile(void) if (!result) return; -// if (pDstFS == nil) +// if (pDstFS == NULL) // targetName = "the target volume"; // else targetName = pDstFS->GetVolumeName(); @@ -786,7 +786,7 @@ VolumeCopyDialog::OnCopyFromFile(void) ASSERT(false); return; } -// if (pDstFS == nil) +// if (pDstFS == NULL) // pProgressDialog->SetCurrentFiles(loadName, "target"); // else pProgressDialog->SetCurrentFiles(loadName, targetName); @@ -800,7 +800,7 @@ VolumeCopyDialog::OnCopyFromFile(void) fpDiskFS->Flush(DiskImg::kFlushAll); time_t startWhen, endWhen; - startWhen = time(nil); + startWhen = time(NULL); /* * Do the actual block copy. @@ -825,7 +825,7 @@ VolumeCopyDialog::OnCopyFromFile(void) goto bail; } - endWhen = time(nil); + endWhen = time(NULL); float elapsed; if (endWhen == startWhen) elapsed = 1.0; @@ -849,7 +849,7 @@ VolumeCopyDialog::OnCopyFromFile(void) assert(!fpDiskImg->GetReadOnly()); fpDiskFS->SetAllReadOnly(true); delete fpDiskFS; - fpDiskFS = nil; + fpDiskFS = NULL; assert(fpDiskImg->GetReadOnly()); fpDiskImg->SetReadOnly(false); @@ -857,7 +857,7 @@ bail: // restore the dialog window to prominence EnableWindow(TRUE); //SetActiveWindow(); - if (pProgressDialog != nil) + if (pProgressDialog != NULL) pProgressDialog->DestroyWindow(); /* diff --git a/app/VolumeCopyDialog.h b/app/VolumeCopyDialog.h index c136a8c..de64f2b 100644 --- a/app/VolumeCopyDialog.h +++ b/app/VolumeCopyDialog.h @@ -22,11 +22,11 @@ class VolumeCopyDialog : public CDialog { public: VolumeCopyDialog(CWnd* pParentWnd = NULL) : CDialog(IDD_VOLUMECOPYSEL, pParentWnd), - fpDiskImg(nil), - fpDiskFS(nil), - fpWaitDlg(nil) + fpDiskImg(NULL), + fpDiskFS(NULL), + fpWaitDlg(NULL) {} - ~VolumeCopyDialog(void) { assert(fpDiskFS == nil); } + ~VolumeCopyDialog(void) { assert(fpDiskFS == NULL); } /* disk image to work with; we don't own it */ DiskImgLib::DiskImg* fpDiskImg; diff --git a/diskimg/ASPI.cpp b/diskimg/ASPI.cpp index 35b1a10..6a751d3 100644 --- a/diskimg/ASPI.cpp +++ b/diskimg/ASPI.cpp @@ -35,7 +35,7 @@ ASPI::Init(void) * Try to load the DLL. */ fhASPI = ::LoadLibrary(kASPIDllName); - if (fhASPI == nil) { + if (fhASPI == NULL) { DWORD lastErr = ::GetLastError(); if (lastErr == ERROR_MOD_NOT_FOUND) { WMSG1("ASPI DLL '%s' not found\n", kASPIDllName); @@ -49,14 +49,14 @@ ASPI::Init(void) GetASPI32SupportInfo = (DWORD(*)(void))::GetProcAddress(fhASPI, "GetASPI32SupportInfo"); SendASPI32Command = (DWORD(*)(LPSRB))::GetProcAddress(fhASPI, "SendASPI32Command"); GetASPI32DLLVersion = (DWORD(*)(void))::GetProcAddress(fhASPI, "GetASPI32DLLVersion"); - if (GetASPI32SupportInfo == nil || SendASPI32Command == nil) { + if (GetASPI32SupportInfo == NULL || SendASPI32Command == NULL) { WMSG0("ASPI functions not found in dll\n"); ::FreeLibrary(fhASPI); - fhASPI = nil; + fhASPI = NULL; return kDIErrGeneric; } - if (GetASPI32DLLVersion != nil) { + if (GetASPI32DLLVersion != NULL) { fASPIVersion = GetASPI32DLLVersion(); WMSG4(" ASPI version is %d.%d.%d.%d\n", fASPIVersion & 0x0ff, @@ -75,7 +75,7 @@ ASPI::Init(void) WMSG1("ASPI loaded but not working (status=%d)\n", HIBYTE(LOWORD(aspiStatus))); ::FreeLibrary(fhASPI); - fhASPI = nil; + fhASPI = NULL; return kDIErrASPIFailure; } @@ -91,10 +91,10 @@ ASPI::Init(void) */ ASPI::~ASPI(void) { - if (fhASPI != nil) { + if (fhASPI != NULL) { WMSG0("Unloading ASPI DLL\n"); ::FreeLibrary(fhASPI); - fhASPI = nil; + fhASPI = NULL; } } @@ -150,7 +150,7 @@ ASPI::GetDeviceType(unsigned char adapter, unsigned char target, assert(adapter >= 0 && adapter < kMaxAdapters); assert(target >= 0 && target < kMaxTargets); assert(lun >= 0 && lun < kMaxLuns); - assert(pType != nil); + assert(pType != NULL); memset(&req, 0, sizeof(req)); 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_Flags = 0; //SRB_DIR_IN; srb.SRB_BufLen = 0; - srb.SRB_BufPointer = nil; + srb.SRB_BufPointer = NULL; srb.SRB_SenseLen = SENSE_LEN; srb.SRB_CDBLen = sizeof(*pCDB); @@ -369,7 +369,7 @@ ASPI::ReadBlocks(unsigned char adapter, unsigned char target, assert(sizeof(CDB10) == 10); assert(startBlock >= 0); assert(numBlocks > 0); - assert(buf != nil); + assert(buf != NULL); memset(&srb, 0, sizeof(srb)); srb.SRB_Cmd = SC_EXEC_SCSI_CMD; @@ -411,7 +411,7 @@ ASPI::WriteBlocks(unsigned char adapter, unsigned char target, assert(sizeof(CDB10) == 10); assert(startBlock >= 0); assert(numBlocks > 0); - assert(buf != nil); + assert(buf != NULL); memset(&srb, 0, sizeof(srb)); srb.SRB_Cmd = SC_EXEC_SCSI_CMD; @@ -449,7 +449,7 @@ ASPI::WriteBlocks(unsigned char adapter, unsigned char target, DIError ASPI::ExecSCSICommand(SRB_ExecSCSICmd* pSRB) { - HANDLE completionEvent = nil; + HANDLE completionEvent = NULL; DWORD eventStatus; DWORD aspiStatus; @@ -464,7 +464,7 @@ ASPI::ExecSCSICommand(SRB_ExecSCSICmd* pSRB) pSRB->SRB_Flags |= SRB_EVENT_NOTIFY; completionEvent = ::CreateEvent(NULL, FALSE, FALSE, NULL); - if (completionEvent == nil) { + if (completionEvent == NULL) { WMSG0("Failed creating a completion event?\n"); return kDIErrGeneric; } @@ -527,16 +527,16 @@ ASPI::GetAccessibleDevices(int deviceMask, ASPIDevice** ppDeviceArray, int* pNumDevices) { DIError dierr; - ASPIDevice* deviceArray = nil; + ASPIDevice* deviceArray = NULL; int idx = 0; assert(deviceMask != 0); assert((deviceMask & ~(kDevMaskCDROM | kDevMaskHardDrive)) == 0); - assert(ppDeviceArray != nil); - assert(pNumDevices != nil); + assert(ppDeviceArray != NULL); + assert(pNumDevices != NULL); deviceArray = new ASPIDevice[kMaxAccessibleDrives]; - if (deviceArray == nil) + if (deviceArray == NULL) return kDIErrMalloc; WMSG1("ASPI scanning %d host adapters\n", fHostAdapterCount); diff --git a/diskimg/ASPI.h b/diskimg/ASPI.h index 0ad6b54..a6223c5 100644 --- a/diskimg/ASPI.h +++ b/diskimg/ASPI.h @@ -42,7 +42,7 @@ namespace DiskImgLib { */ class DISKIMG_API ASPIDevice { public: - ASPIDevice(void) : fVendorID(nil), fProductID(nil), + ASPIDevice(void) : fVendorID(NULL), fProductID(NULL), fAdapter(0xff), fTarget(0xff), fLun(0xff), fDeviceReady(false) {} virtual ~ASPIDevice(void) { @@ -57,10 +57,10 @@ public: fAdapter = adapter; fTarget = target; fLun = lun; - assert(fVendorID == nil); + assert(fVendorID == NULL); fVendorID = new char[strlen((const char*)vendor)+1]; strcpy(fVendorID, (const char*)vendor); - assert(fProductID == nil); + assert(fProductID == NULL); fProductID = new char[strlen((const char*)product)+1]; strcpy(fProductID, (const char*)product); fDeviceReady = ready; @@ -101,10 +101,10 @@ private: class DISKIMG_API ASPI { public: ASPI(void) : - fhASPI(nil), - GetASPI32SupportInfo(nil), - SendASPI32Command(nil), - GetASPI32DLLVersion(nil), + fhASPI(NULL), + GetASPI32SupportInfo(NULL), + SendASPI32Command(NULL), + GetASPI32DLLVersion(NULL), fASPIVersion(0), fHostAdapterCount(-1) {} @@ -115,7 +115,7 @@ public: // return the version returned by the loaded DLL DWORD GetVersion(void) const { - assert(fhASPI != nil); + assert(fhASPI != NULL); return fASPIVersion; } diff --git a/diskimg/CFFA.cpp b/diskimg/CFFA.cpp index e1123fe..98d4d29 100644 --- a/diskimg/CFFA.cpp +++ b/diskimg/CFFA.cpp @@ -58,8 +58,8 @@ DiskFSCFFA::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, long totalBlocks = pImg->GetNumBlocks(); long startBlock, maxBlocks, totalBlocksLeft; long fsNumBlocks; - DiskFS* pNewFS = nil; - DiskImg* pNewImg = nil; + DiskFS* pNewFS = NULL; + DiskImg* pNewImg = NULL; //bool fiveIs32MB; assert(totalBlocks > kEarlyVolExpectedSize); @@ -364,11 +364,11 @@ DiskFSCFFA::OpenSubVolume(DiskImg* pImg, long startBlock, long numBlocks, bool scanOnly, DiskImg** ppNewImg, DiskFS** ppNewFS) { DIError dierr = kDIErrNone; - DiskFS* pNewFS = nil; - DiskImg* pNewImg = nil; + DiskFS* pNewFS = NULL; + DiskImg* pNewImg = NULL; pNewImg = new DiskImg; - if (pNewImg == nil) { + if (pNewImg == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -400,7 +400,7 @@ DiskFSCFFA::OpenSubVolume(DiskImg* pImg, long startBlock, long numBlocks, /* open a DiskFS for the sub-image */ WMSG2(" CFFASub (%ld,%ld) analyze succeeded!\n", startBlock, numBlocks); pNewFS = pNewImg->OpenAppropriateDiskFS(); - if (pNewFS == nil) { + if (pNewFS == NULL) { WMSG0(" CFFASub: OpenAppropriateDiskFS failed\n"); dierr = kDIErrUnsupportedFSFmt; goto bail; @@ -547,8 +547,8 @@ DiskFSCFFA::AddVolumeSeries(int start, int count, long blocksPerVolume, long& startBlock, long& totalBlocksLeft) { DIError dierr = kDIErrNone; - DiskFS* pNewFS = nil; - DiskImg* pNewImg = nil; + DiskFS* pNewFS = NULL; + DiskImg* pNewImg = NULL; long maxBlocks, fsNumBlocks; bool scanOnly = false; diff --git a/diskimg/CPM.cpp b/diskimg/CPM.cpp index 979d453..c4f403b 100644 --- a/diskimg/CPM.cpp +++ b/diskimg/CPM.cpp @@ -161,8 +161,8 @@ DiskFSCPM::Initialize(void) fVolumeUsage.Dump(); //A2File* pFile; - //pFile = GetNextFile(nil); - //while (pFile != nil) { + //pFile = GetNextFile(NULL); + //while (pFile != NULL) { // pFile->Dump(); // pFile = GetNextFile(pFile); //} @@ -459,9 +459,9 @@ A2FileCPM::Open(A2FileDescr** ppOpenFile, bool readOnly, bool rsrcFork /*=false*/) { DIError dierr; - A2FDCPM* pOpenFile = nil; + A2FDCPM* pOpenFile = NULL; - if (fpOpenFile != nil) + if (fpOpenFile != NULL) return kDIErrAlreadyOpen; if (rsrcFork) return kDIErrForkNotFound; @@ -470,7 +470,7 @@ A2FileCPM::Open(A2FileDescr** ppOpenFile, bool readOnly, pOpenFile = new A2FDCPM(this); - dierr = GetBlockList(&pOpenFile->fBlockCount, nil); + dierr = GetBlockList(&pOpenFile->fBlockCount, NULL); if (dierr != kDIErrNone) goto bail; @@ -488,7 +488,7 @@ A2FileCPM::Open(A2FileDescr** ppOpenFile, bool readOnly, fpOpenFile = pOpenFile; *ppOpenFile = pOpenFile; - pOpenFile = nil; + pOpenFile = NULL; bail: delete pOpenFile; @@ -500,7 +500,7 @@ bail: * Get the complete block list for a file. This will involve reading * 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. */ DIError @@ -534,7 +534,7 @@ A2FileCPM::GetBlockList(long* pBlockCount, unsigned char* blockBuf) const } blockCount++; - if (blockBuf != nil) { + if (blockBuf != NULL) { long listOffset = j + fpDirEntry[i].extent * DiskFSCPM::kDirEntryBlockCount; 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, // fpDirEntry[fDirIdx].fileName); - if (pBlockCount != nil) { - assert(blockBuf == nil || *pBlockCount == blockCount); + if (pBlockCount != NULL) { + assert(blockBuf == NULL || *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 */ if (fOffset + (long)len > pFile->fLength) { - if (pActual == nil) + if (pActual == NULL) return kDIErrDataUnderrun; len = (size_t) (pFile->fLength - fOffset); } - if (pActual != nil) + if (pActual != NULL) *pActual = len; long incrLen = len; diff --git a/diskimg/Container.cpp b/diskimg/Container.cpp index bd6bdbc..31cb1a6 100644 --- a/diskimg/Container.cpp +++ b/diskimg/Container.cpp @@ -40,8 +40,8 @@ DiskFSContainer::CreatePlaceholder(long startBlock, long numBlocks, DiskImg** ppNewImg, DiskFS** ppNewFS) { DIError dierr = kDIErrNone; - DiskFS* pNewFS = nil; - DiskImg* pNewImg = nil; + DiskFS* pNewFS = NULL; + DiskImg* pNewImg = NULL; WMSG3(" %s/CrPl creating placeholder for %ld +%ld\n", GetDebugName(), startBlock, numBlocks); @@ -53,13 +53,13 @@ DiskFSContainer::CreatePlaceholder(long startBlock, long numBlocks, } pNewImg = new DiskImg; - if (pNewImg == nil) { + if (pNewImg == NULL) { dierr = kDIErrMalloc; goto bail; } - if (partName != nil) { - if (partType != nil) + if (partName != NULL) { + if (partType != NULL) pNewImg->AddNote(DiskImg::kNoteInfo, "Partition name='%s' type='%s'.", partName, partType); else @@ -97,7 +97,7 @@ DiskFSContainer::CreatePlaceholder(long startBlock, long numBlocks, /* open a DiskFS for the sub-image, allowing "unknown" */ pNewFS = pNewImg->OpenAppropriateDiskFS(true); - if (pNewFS == nil) { + if (pNewFS == NULL) { WMSG1(" %s/CrPl: OpenAppropriateDiskFS failed\n", GetDebugName()); dierr = kDIErrUnsupportedFSFmt; goto bail; diff --git a/diskimg/DDD.cpp b/diskimg/DDD.cpp index 6359128..df80efb 100644 --- a/diskimg/DDD.cpp +++ b/diskimg/DDD.cpp @@ -99,7 +99,7 @@ const unsigned long kDDDProSignature = 0xd0bfc903; */ class WrapperDDD::BitBuffer { public: - BitBuffer(void) : fpGFD(nil), fBits(0), fBitCount(0), fIOFailure(false) {} + BitBuffer(void) : fpGFD(NULL), fBits(0), fBitCount(0), fIOFailure(false) {} ~BitBuffer(void) {} void SetFile(GenericFD* pGFD) { fpGFD = pGFD; } @@ -129,7 +129,7 @@ WrapperDDD::BitBuffer::PutBits(unsigned char bits, int numBits) { assert(fBitCount >= 0 && fBitCount < 8); assert(numBits > 0 && numBits <= 8); - assert(fpGFD != nil); + assert(fpGFD != NULL); DIError dierr; @@ -158,7 +158,7 @@ WrapperDDD::BitBuffer::GetBits(int numBits) { assert(fBitCount >= 0 && fBitCount < 8); assert(numBits > 0 && numBits <= 8); - assert(fpGFD != nil); + assert(fpGFD != NULL); DIError dierr; unsigned char retVal; @@ -464,8 +464,8 @@ WrapperDDD::UnpackDisk(GenericFD* pGFD, GenericFD* pNewGFD, unsigned char val; long lbuf; - assert(pGFD != nil); - assert(pNewGFD != nil); + assert(pGFD != NULL); + assert(pNewGFD != NULL); /* read four zeroes to skip the DOS addr/len bytes */ assert(sizeof(lbuf) >= 4); diff --git a/diskimg/DIUtil.cpp b/diskimg/DIUtil.cpp index 1bc181e..d8880af 100644 --- a/diskimg/DIUtil.cpp +++ b/diskimg/DIUtil.cpp @@ -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 * 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* DiskImgLib::FilenameOnly(const char* pathname, char fssep) { const char* retstr; const char* pSlash; - char* tmpStr = nil; + char* tmpStr = NULL; - assert(pathname != nil); + assert(pathname != NULL); if (fssep == '\0') { retstr = pathname; goto bail; } pSlash = strrchr(pathname, fssep); - if (pSlash == nil) { + if (pSlash == NULL) { retstr = pathname; /* whole thing is the filename */ goto bail; } @@ -251,7 +251,7 @@ DiskImgLib::FilenameOnly(const char* pathname, char fssep) tmpStr[strlen(pathname)-1] = '\0'; pSlash = strrchr(tmpStr, fssep); - if (pSlash == nil) { + if (pSlash == NULL) { retstr = pathname; /* just a filename with a '/' after it */ goto bail; } @@ -279,7 +279,7 @@ bail: * An extension is the stuff following the last '.' in the filename. If * 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. * * 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". */ pFilename = FilenameOnly(pathname, fssep); - assert(pFilename != nil); + assert(pFilename != NULL); pExt = strrchr(pFilename, kFilenameExtDelim); /* also check for "/blah/foo.", which doesn't count */ - if (pExt != nil && *(pExt+1) != '\0') + if (pExt != NULL && *(pExt+1) != '\0') return pExt; - return nil; + return NULL; } /* * 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()" */ @@ -317,10 +317,10 @@ DiskImgLib::StrcpyNew(const char* str) { char* newStr; - if (str == nil) - return nil; + if (str == NULL) + return NULL; newStr = new char[strlen(str)+1]; - if (newStr != nil) + if (newStr != NULL) strcpy(newStr, str); return newStr; } diff --git a/diskimg/DOS33.cpp b/diskimg/DOS33.cpp index 1469983..d95456f 100644 --- a/diskimg/DOS33.cpp +++ b/diskimg/DOS33.cpp @@ -237,8 +237,8 @@ DiskFSDOS33::Initialize(InitMode initMode) fVolumeUsage.Dump(); // A2File* pFile; -// pFile = GetNextFile(nil); -// while (pFile != nil) { +// pFile = GetNextFile(NULL); +// while (pFile != NULL) { // pFile->Dump(); // pFile = GetNextFile(pFile); // } @@ -998,13 +998,13 @@ DIError DiskFSDOS33::GetFileLengths(void) { A2FileDOS* pFile; - TrackSector* tsList = nil; - TrackSector* indexList = nil; + TrackSector* tsList = NULL; + TrackSector* indexList = NULL; int tsCount; int indexCount; - pFile = (A2FileDOS*) GetNextFile(nil); - while (pFile != nil) { + pFile = (A2FileDOS*) GetNextFile(NULL); + while (pFile != NULL) { DIError dierr; dierr = pFile->LoadTSList(&tsList, &tsCount, &indexList, &indexCount); if (dierr != kDIErrNone) { @@ -1030,7 +1030,7 @@ DiskFSDOS33::GetFileLengths(void) delete[] tsList; delete[] indexList; - tsList = indexList = nil; + tsList = indexList = NULL; pFile = (A2FileDOS*) GetNextFile(pFile); } @@ -1083,8 +1083,8 @@ DiskFSDOS33::ComputeLength(A2FileDOS* pFile, const TrackSector* tsList, DIError dierr = kDIErrNone; unsigned char sctBuf[kSctSize]; - assert(pFile != nil); - assert(tsList != nil); + assert(pFile != NULL); + assert(tsList != NULL); assert(tsCount >= 0); pFile->fDataOffset = 0; @@ -1123,8 +1123,8 @@ DiskFSDOS33::ComputeLength(A2FileDOS* pFile, const TrackSector* tsList, if (pFile->fFileType == A2FileDOS::kTypeBinary && pFile->fLength == 0 && pFile->fAuxType == 0 && tsCount >= 8 && - strchr(pFile->fFileName, '<') != nil && - strchr(pFile->fFileName, '>') != nil) + strchr(pFile->fFileName, '<') != NULL && + strchr(pFile->fFileName, '>') != NULL) { WMSG2(" DOS found probable DDD archive, tweaking '%s' (lis=%u)\n", pFile->GetPathName(), pFile->fLengthInSectors); @@ -1440,7 +1440,7 @@ DiskFSDOS33::Format(DiskImg* pDiskImg, const char* volName) return kDIErrInvalidArg; } - if (volName != nil && strcmp(volName, "DOS") == 0) { + if (volName != NULL && strcmp(volName, "DOS") == 0) { if (pDiskImg->GetNumSectPerTrack() != 16 && 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 */ - assert(fpImg == nil); + assert(fpImg == NULL); SetDiskImg(pDiskImg); WMSG1(" DOS33 formatting disk image (sectorOrder=%d)\n", @@ -1543,7 +1543,7 @@ DiskFSDOS33::Format(DiskImg* pDiskImg, const char* volName) //ScanVolBitmap(); bail: - SetDiskImg(nil); // shouldn't really be set by us + SetDiskImg(NULL); // shouldn't really be set by us return dierr; } @@ -1639,7 +1639,7 @@ DiskFSDOS33::DoNormalizePath(const char* name, char fssep, char* outBuf) /* throw out leading pathname, if any */ if (fssep != '\0') { cp = strrchr(name, fssep); - if (cp != nil) + if (cp != NULL) name = cp+1; } @@ -1692,19 +1692,19 @@ DiskFSDOS33::CreateFile(const CreateParms* pParms, A2File** ppNewFile) char normalName[A2FileDOS::kMaxFileName+1]; // char storageName[A2FileDOS::kMaxFileName+1]; A2FileDOS::FileType fileType; - A2FileDOS* pNewFile = nil; + A2FileDOS* pNewFile = NULL; if (fpImg->GetReadOnly()) return kDIErrAccessDenied; if (!fDiskIsGood) return kDIErrBadDiskImage; - assert(pParms != nil); - assert(pParms->pathName != nil); + assert(pParms != NULL); + assert(pParms->pathName != NULL); assert(pParms->storageType == A2FileProDOS::kStorageSeedling); WMSG1(" DOS33 ---v--- CreateFile '%s'\n", pParms->pathName); - *ppNewFile = nil; + *ppNewFile = NULL; DoNormalizePath(pParms->pathName, pParms->fssep, normalName); @@ -1717,7 +1717,7 @@ DiskFSDOS33::CreateFile(const CreateParms* pParms, A2File** ppNewFile) if (createUnique) { MakeFileNameUnique(normalName); } else { - if (GetFileByName(normalName) != nil) { + if (GetFileByName(normalName) != NULL) { WMSG1(" DOS33 create: normalized name '%s' already exists\n", normalName); dierr = kDIErrFileExists; @@ -1781,7 +1781,7 @@ DiskFSDOS33::CreateFile(const CreateParms* pParms, A2File** ppNewFile) * Create a new entry for our file list. */ pNewFile = new A2FileDOS(this); - if (pNewFile == nil) { + if (pNewFile == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -1822,7 +1822,7 @@ DiskFSDOS33::CreateFile(const CreateParms* pParms, A2File** ppNewFile) InsertFileInList(pNewFile, pPrevEntry); *ppNewFile = pNewFile; - pNewFile = nil; + pNewFile = NULL; bail: delete pNewFile; @@ -1846,10 +1846,10 @@ bail: DIError DiskFSDOS33::MakeFileNameUnique(char* fileName) { - assert(fileName != nil); + assert(fileName != NULL); assert(strlen(fileName) <= A2FileDOS::kMaxFileName); - if (GetFileByName(fileName) == nil) + if (GetFileByName(fileName) == NULL) return kDIErrNone; WMSG1(" DOS found duplicate of '%s', making unique\n", fileName); @@ -1866,7 +1866,7 @@ DiskFSDOS33::MakeFileNameUnique(char* fileName) * to preserve ".gif", ".c", etc. */ const char* cp = strrchr(fileName, '.'); - if (cp != nil) { + if (cp != NULL) { int tmpOffset = cp - fileName; if (tmpOffset > 0 && nameLen - tmpOffset <= kMaxExtensionLen) { WMSG1(" DOS (keeping extension '%s')\n", cp); @@ -1897,7 +1897,7 @@ DiskFSDOS33::MakeFileNameUnique(char* fileName) memcpy(fileName + copyOffset, digitBuf, digitLen); if (dotLen != 0) memcpy(fileName + copyOffset + digitLen, dotBuf, dotLen); - } while (GetFileByName(fileName) != nil); + } while (GetFileByName(fileName) != NULL); 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 */ - *ppPrevEntry = nil; + *ppPrevEntry = NULL; if (prevEntry >= 0) { - A2FileDOS* pFile = (A2FileDOS*) GetNextFile(nil); - while (pFile != nil) { + A2FileDOS* pFile = (A2FileDOS*) GetNextFile(NULL); + while (pFile != NULL) { if (pFile->fCatTS.track == prevTS.track && pFile->fCatTS.sector == prevTS.sector && pFile->fCatEntryNum == prevEntry) @@ -1987,7 +1987,7 @@ DiskFSDOS33::GetFreeCatalogEntry(TrackSector* pCatSect, int* pCatEntry, } pFile = (A2FileDOS*) GetNextFile(pFile); } - assert(*ppPrevEntry != nil); + assert(*ppPrevEntry != NULL); } } @@ -2035,13 +2035,13 @@ DiskFSDOS33::DeleteFile(A2File* pGenericFile) { DIError dierr = kDIErrNone; A2FileDOS* pFile = (A2FileDOS*) pGenericFile; - TrackSector* tsList = nil; - TrackSector* indexList = nil; + TrackSector* tsList = NULL; + TrackSector* indexList = NULL; int tsCount, indexCount; unsigned char sctBuf[kSctSize]; unsigned char* pEntry; - if (pGenericFile == nil) { + if (pGenericFile == NULL) { assert(false); return kDIErrInvalidArg; } @@ -2150,7 +2150,7 @@ DiskFSDOS33::RenameFile(A2File* pGenericFile, const char* newName) unsigned char sctBuf[kSctSize]; unsigned char* pEntry; - if (pFile == nil || newName == nil) + if (pFile == NULL || newName == NULL) return kDIErrInvalidArg; if (!IsValidFileName(newName)) return kDIErrInvalidArg; @@ -2211,12 +2211,12 @@ DiskFSDOS33::SetFileInfo(A2File* pGenericFile, long fileType, long auxType, { DIError dierr = kDIErrNone; A2FileDOS* pFile = (A2FileDOS*) pGenericFile; - TrackSector* tsList = nil; + TrackSector* tsList = NULL; int tsCount; bool nowLocked; bool typeChanged; - if (pFile == nil) + if (pFile == NULL) return kDIErrInvalidArg; if (fpImg->GetReadOnly()) return kDIErrAccessDenied; @@ -2426,7 +2426,7 @@ A2FileDOS::A2FileDOS(DiskFS* pDiskFS) : A2File(pDiskFS) fLength = -1; fSparseLength = -1; - fpOpenFile = nil; + fpOpenFile = NULL; } /* @@ -2614,7 +2614,7 @@ A2FileDOS::Open(A2FileDescr** ppOpenFile, bool readOnly, bool rsrcFork /*=false*/) { DIError dierr = kDIErrNone; - A2FDDOS* pOpenFile = nil; + A2FDDOS* pOpenFile = NULL; if (!readOnly) { if (fpDiskFS->GetDiskImg()->GetReadOnly()) @@ -2623,7 +2623,7 @@ A2FileDOS::Open(A2FileDescr** ppOpenFile, bool readOnly, return kDIErrBadDiskImage; } - if (fpOpenFile != nil) { + if (fpOpenFile != NULL) { dierr = kDIErrAlreadyOpen; goto bail; } @@ -2646,7 +2646,7 @@ A2FileDOS::Open(A2FileDescr** ppOpenFile, bool readOnly, fpOpenFile = pOpenFile; // add it to our single-member "open file set" *ppOpenFile = pOpenFile; - pOpenFile = nil; + pOpenFile = NULL; bail: delete pOpenFile; @@ -2676,7 +2676,7 @@ A2FileDOS::Dump(void) const * possible for a random-access text file to have a very large number of * 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. * * 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; const int kDefaultTSAlloc = 2; const int kDefaultIndexAlloc = 8; - TrackSector* tsList = nil; - TrackSector* indexList = nil; + TrackSector* tsList = NULL; + TrackSector* indexList = NULL; int tsCount, tsAlloc; int indexCount, indexAlloc; unsigned char sctBuf[kSctSize]; @@ -2716,14 +2716,14 @@ A2FileDOS::LoadTSList(TrackSector** pTSList, int* pTSCount, indexList = new TrackSector[indexAlloc]; indexCount = 0; - if (tsList == nil || indexList == nil) { + if (tsList == NULL || indexList == NULL) { dierr = kDIErrMalloc; goto bail; } - assert(fpDiskFS != nil); + assert(fpDiskFS != NULL); pDiskImg = fpDiskFS->GetDiskImg(); - assert(pDiskImg != nil); + assert(pDiskImg != NULL); /* get the first T/S sector for this file */ track = fTSListTrack; @@ -2753,7 +2753,7 @@ A2FileDOS::LoadTSList(TrackSector** pTSList, int* pTSCount, TrackSector* newList; indexAlloc += kDefaultIndexAlloc; newList = new TrackSector[indexAlloc]; - if (newList == nil) { + if (newList == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -2801,7 +2801,7 @@ A2FileDOS::LoadTSList(TrackSector** pTSList, int* pTSCount, TrackSector* newList; tsAlloc += kMaxTSPairs * kDefaultTSAlloc; newList = new TrackSector[tsAlloc]; - if (newList == nil) { + if (newList == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -2843,12 +2843,12 @@ A2FileDOS::LoadTSList(TrackSector** pTSList, int* pTSCount, *pTSList = tsList; *pTSCount = tsCount; - tsList = nil; + tsList = NULL; - if (pIndexList != nil) { + if (pIndexList != NULL) { *pIndexList = indexList; *pIndexCount = indexCount; - indexList = nil; + indexList = NULL; } 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. */ if (fOffset + (long)len > fOpenEOF) { - if (pActual == nil) + if (pActual == NULL) return kDIErrDataUnderrun; len = (size_t) (fOpenEOF - fOffset); } - if (pActual != nil) + if (pActual != NULL) *pActual = 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(fIndexCount == 1); // must hold for our newly-created files assert(fOpenSectorsUsed == fTSCount + fIndexCount); - assert(buf != nil); + assert(buf != NULL); long actualLen = (long) len + pFile->fDataOffset; long numSectors = (actualLen + kSctSize -1) / kSctSize; @@ -3074,14 +3074,14 @@ A2FDDOS::Write(const void* buf, size_t len, size_t* pActual) firstIndex = fIndexList[0]; delete[] fTSList; delete[] fIndexList; - fTSList = fIndexList = nil; + fTSList = fIndexList = NULL; fTSCount = numSectors; fTSList = new TrackSector[fTSCount]; fIndexCount = (numSectors + kMaxTSPairs -1) / kMaxTSPairs; assert(fIndexCount > 0); fIndexList = new TrackSector[fIndexCount]; - if (fTSList == nil || fIndexList == nil) { + if (fTSList == NULL || fIndexList == NULL) { dierr = kDIErrMalloc; goto bail; } diff --git a/diskimg/DiskFS.cpp b/diskimg/DiskFS.cpp index d687055..bec24b2 100644 --- a/diskimg/DiskFS.cpp +++ b/diskimg/DiskFS.cpp @@ -62,17 +62,17 @@ A2File::ResetQuality(void) void DiskFS::SetDiskImg(DiskImg* pImg) { - if (pImg == nil && fpImg == nil) { - WMSG0("SetDiskImg: no-op (both nil)\n"); + if (pImg == NULL && fpImg == NULL) { + WMSG0("SetDiskImg: no-op (both NULL)\n"); return; } else if (fpImg == pImg) { WMSG0("SetDiskImg: no-op (old == new)\n"); return; } - if (fpImg != nil) + if (fpImg != NULL) fpImg->RemoveDiskFS(this); - if (pImg != nil) + if (pImg != NULL) pImg->AddDiskFS(this); fpImg = pImg; } @@ -83,10 +83,10 @@ DiskFS::SetDiskImg(DiskImg* pImg) DIError DiskFS::Flush(DiskImg::FlushMode mode) { - SubVolume* pSubVol = GetNextSubVolume(nil); + SubVolume* pSubVol = GetNextSubVolume(NULL); DIError dierr; - while (pSubVol != nil) { + while (pSubVol != NULL) { // quick sanity check assert(pSubVol->GetDiskFS()->GetDiskImg() == pSubVol->GetDiskImg()); @@ -98,7 +98,7 @@ DiskFS::Flush(DiskImg::FlushMode mode) pSubVol = GetNextSubVolume(pSubVol); } - assert(fpImg != nil); + assert(fpImg != NULL); return fpImg->FlushImage(mode); } @@ -109,14 +109,14 @@ DiskFS::Flush(DiskImg::FlushMode mode) void DiskFS::SetAllReadOnly(bool val) { - SubVolume* pSubVol = GetNextSubVolume(nil); + SubVolume* pSubVol = GetNextSubVolume(NULL); /* put current volume in read-only mode */ - if (fpImg != nil) + if (fpImg != NULL) fpImg->SetReadOnly(val); /* handle our kids */ - while (pSubVol != nil) { + while (pSubVol != NULL) { // quick sanity check assert(pSubVol->GetDiskFS()->GetDiskImg() == pSubVol->GetDiskImg()); @@ -164,10 +164,10 @@ DiskFS::SetAllReadOnly(bool val) void DiskFS::AddFileToList(A2File* pFile) { - assert(pFile->GetNext() == nil); + assert(pFile->GetNext() == NULL); - if (fpA2Head == nil) { - assert(fpA2Tail == nil); + if (fpA2Head == NULL) { + assert(fpA2Tail == NULL); fpA2Head = fpA2Tail = pFile; } else { pFile->SetPrev(fpA2Tail); @@ -196,13 +196,13 @@ DiskFS::AddFileToList(A2File* pFile) void DiskFS::InsertFileInList(A2File* pFile, A2File* pPrev) { - assert(pFile->GetNext() == nil); + assert(pFile->GetNext() == NULL); - if (fpA2Head == nil) { - assert(pPrev == nil); + if (fpA2Head == NULL) { + assert(pPrev == NULL); fpA2Head = fpA2Tail = pFile; return; - } else if (pPrev == nil) { + } else if (pPrev == NULL) { // create two entries on DOS disk, delete first, add new file pFile->SetNext(fpA2Head); fpA2Head = pFile; @@ -231,17 +231,17 @@ DiskFS::InsertFileInList(A2File* pFile, A2File* pPrev) A2File* DiskFS::SkipSubdir(A2File* pSubdir) { - if (pSubdir->GetNext() == nil) + if (pSubdir->GetNext() == NULL) return pSubdir; // end of list reached -- subdir is empty 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(); - if (pNext == nil) // end of list reached + if (pNext == NULL) // end of list reached return pCur; if (pNext->GetParent() != pSubdir) // end of dir reached @@ -271,7 +271,7 @@ DiskFS::DeleteFileFromList(A2File* pFile) delete pFile; } else { A2File* pCur = fpA2Head; - while (pCur != nil) { + while (pCur != NULL) { if (pCur->GetNext() == pFile) { /* found it */ A2File* pNextNext = pCur->GetNext()->GetNext(); @@ -282,7 +282,7 @@ DiskFS::DeleteFileFromList(A2File* pFile) pCur = pCur->GetNext(); } - if (pCur == nil) { + if (pCur == NULL) { WMSG0("GLITCH: couldn't find element to delete!\n"); assert(false); } @@ -317,7 +317,7 @@ DiskFS::GetFileCount(void) const long count = 0; A2File* pFile = fpA2Head; - while (pFile != nil) { + while (pFile != NULL) { count++; pFile = pFile->GetNext(); } @@ -335,7 +335,7 @@ DiskFS::DeleteFileList(void) A2File* pNext; pFile = fpA2Head; - while (pFile != nil) { + while (pFile != NULL) { pNext = pFile->GetNext(); delete pFile; pFile = pNext; @@ -352,8 +352,8 @@ DiskFS::DumpFileList(void) WMSG0("DiskFS file list contents:\n"); - pFile = GetNextFile(nil); - while (pFile != nil) { + pFile = GetNextFile(NULL); + while (pFile != NULL) { WMSG1(" %s\n", pFile->GetPathName()); pFile = GetNextFile(pFile); } @@ -372,18 +372,18 @@ DiskFS::GetFileByName(const char* fileName, StringCompareFunc func) { A2File* pFile; - if (func == nil) + if (func == NULL) func = ::strcasecmp; - pFile = GetNextFile(nil); - while (pFile != nil) { + pFile = GetNextFile(NULL); + while (pFile != NULL) { if ((*func)(pFile->GetPathName(), fileName) == 0) return pFile; pFile = GetNextFile(pFile); } - return nil; + return NULL; } @@ -403,7 +403,7 @@ DiskFS::AddSubVolumeToList(DiskImg* pDiskImg, DiskFS* pDiskFS) /* * Check the arguments. */ - if (pDiskImg == nil || pDiskFS == nil) { + if (pDiskImg == NULL || pDiskFS == NULL) { WMSG2(" DiskFS bogus sub volume ptrs %08lx %08lx\n", (long) pDiskImg, (long) pDiskFS); assert(false); @@ -414,13 +414,13 @@ DiskFS::AddSubVolumeToList(DiskImg* pDiskImg, DiskFS* pDiskFS) assert(false); return; } - if (pDiskFS->GetDiskImg() == nil) { + if (pDiskFS->GetDiskImg() == NULL) { WMSG0(" DiskFS lacks a DiskImg pointer\n"); assert(false); return; } pSubVol = fpSubVolumeHead; - while (pSubVol != nil) { + while (pSubVol != NULL) { if (pSubVol->GetDiskImg() == pDiskImg || pSubVol->GetDiskFS() == pDiskFS) { @@ -437,13 +437,13 @@ DiskFS::AddSubVolumeToList(DiskImg* pDiskImg, DiskFS* pDiskFS) * Looks good. Add it. */ pSubVol = new SubVolume; - if (pSubVol == nil) + if (pSubVol == NULL) return; pSubVol->Create(pDiskImg, pDiskFS); - if (fpSubVolumeHead == nil) { - assert(fpSubVolumeTail == nil); + if (fpSubVolumeHead == NULL) { + assert(fpSubVolumeTail == NULL); fpSubVolumeHead = fpSubVolumeTail = pSubVol; } else { pSubVol->SetPrev(fpSubVolumeTail); @@ -500,7 +500,7 @@ DiskFS::DeleteSubVolumeList(void) SubVolume* pNext; pSubVol = fpSubVolumeHead; - while (pSubVol != nil) { + while (pSubVol != NULL) { pNext = pSubVol->GetNext(); delete pSubVol; pSubVol = pNext; @@ -529,8 +529,8 @@ DiskFS::SetParameter(DiskFSParameter parm, long val) assert(parm > kParmUnknown && parm < kParmMax); fParmTable[parm] = val; - SubVolume* pSubVol = GetNextSubVolume(nil); - while (pSubVol != nil) { + SubVolume* pSubVol = GetNextSubVolume(NULL); + while (pSubVol != NULL) { pSubVol->GetDiskFS()->SetParameter(parm, val); pSubVol = GetNextSubVolume(pSubVol); } @@ -547,8 +547,8 @@ DiskFS::ScanForDamagedFiles(bool* pDamaged, bool* pSuspicious) *pDamaged = *pSuspicious = false; - pFile = GetNextFile(nil); - while (pFile != nil) { + pFile = GetNextFile(NULL); + while (pFile != NULL) { if (pFile->GetQuality() == A2File::kQualityDamaged) *pDamaged = true; if (pFile->GetQuality() != A2File::kQualityGood) diff --git a/diskimg/DiskImg.cpp b/diskimg/DiskImg.cpp index a66a9cd..a4e737b 100644 --- a/diskimg/DiskImg.cpp +++ b/diskimg/DiskImg.cpp @@ -165,7 +165,7 @@ DiskImg::GetStdNibbleDescr(StdNibbleDescr idx) { if ((int)idx < 0 || (int)idx >= (int) NELEM(kStdNibbleDescrs)) - return nil; + return NULL; return &kStdNibbleDescrs[(int)idx]; } @@ -180,7 +180,7 @@ DiskImg::DiskImg(void) fOuterFormat = kOuterFormatUnknown; fFileFormat = kFileFormatUnknown; fPhysical = kPhysicalFormatUnknown; - fpNibbleDescr = nil; + fpNibbleDescr = NULL; fOrder = kSectorOrderUnknown; fFormat = kFormatUnknown; @@ -188,12 +188,12 @@ DiskImg::DiskImg(void) fSectorPairing = false; fSectorPairOffset = -1; - fpOuterGFD = nil; - fpWrapperGFD = nil; - fpDataGFD = nil; - fpOuterWrapper = nil; - fpImageWrapper = nil; - fpParentImg = nil; + fpOuterGFD = NULL; + fpWrapperGFD = NULL; + fpDataGFD = NULL; + fpOuterWrapper = NULL; + fpImageWrapper = NULL; + fpParentImg = NULL; fDOSVolumeNum = kVolumeNumNotSet; fOuterLength = -1; fWrappedLength = -1; @@ -227,13 +227,13 @@ DiskImg::DiskImg(void) fNumNibbleDescrEntries = NELEM(kStdNibbleDescrs); memcpy(fpNibbleDescrTable, kStdNibbleDescrs, sizeof(kStdNibbleDescrs)); - fNibbleTrackBuf = nil; + fNibbleTrackBuf = NULL; fNibbleTrackLoaded = -1; fNuFXCompressType = kNuThreadFormatLZW2; - fNotes = nil; - fpBadBlockMap = nil; + fNotes = NULL; + fpBadBlockMap = NULL; fDiskFSRefCnt = 0; } @@ -242,7 +242,7 @@ DiskImg::DiskImg(void) */ DiskImg::~DiskImg(void) { - if (fpDataGFD != nil) { + if (fpDataGFD != NULL) { WMSG0("~DiskImg closing GenericFD(s)\n"); } (void) CloseImage(); @@ -252,15 +252,15 @@ DiskImg::~DiskImg(void) delete fpBadBlockMap; /* normally these will be closed, but perhaps not if something failed */ - if (fpOuterGFD != nil) + if (fpOuterGFD != NULL) delete fpOuterGFD; - if (fpWrapperGFD != nil) + if (fpWrapperGFD != NULL) delete fpWrapperGFD; - if (fpDataGFD != nil) + if (fpDataGFD != NULL) delete fpDataGFD; - if (fpOuterWrapper != nil) + if (fpOuterWrapper != NULL) delete fpOuterWrapper; - if (fpImageWrapper != nil) + if (fpImageWrapper != NULL) delete fpImageWrapper; fDiskFSRefCnt = 100; // flag as freed @@ -307,7 +307,7 @@ DiskImg::OpenImage(const char* pathName, char fssep, bool readOnly) DIError dierr = kDIErrNone; bool isWinDevice = false; - if (fpDataGFD != nil) { + if (fpDataGFD != NULL) { WMSG0(" DI already open!\n"); return kDIErrAlreadyOpen; } @@ -367,7 +367,7 @@ DiskImg::OpenImage(const char* pathName, char fssep, bool readOnly) //strcpy(fImageFileName, pathName); fpWrapperGFD = pGFDFile; - pGFDFile = nil; + pGFDFile = NULL; dierr = AnalyzeImageFile(pathName, fssep); if (dierr != kDIErrNone) @@ -375,7 +375,7 @@ DiskImg::OpenImage(const char* pathName, char fssep, bool readOnly) } - assert(fpDataGFD != nil); + assert(fpDataGFD != NULL); bail: return dierr; @@ -388,7 +388,7 @@ bail: DIError DiskImg::OpenImage(const void* buffer, long length, bool readOnly) { - if (fpDataGFD != nil) { + if (fpDataGFD != NULL) { WMSG0(" DI already open!\n"); return kDIErrAlreadyOpen; } @@ -408,13 +408,13 @@ DiskImg::OpenImage(const void* buffer, long length, bool readOnly) } fpWrapperGFD = pGFDBuffer; - pGFDBuffer = nil; + pGFDBuffer = NULL; dierr = AnalyzeImageFile("", '\0'); if (dierr != kDIErrNone) return dierr; - assert(fpDataGFD != nil); + assert(fpDataGFD != NULL); 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, numBlocks); - if (fpDataGFD != nil) { + if (fpDataGFD != NULL) { WMSG0(" DI already open!\n"); return kDIErrAlreadyOpen; } - if (pParent == nil || firstBlock < 0 || numBlocks <= 0 || + if (pParent == NULL || firstBlock < 0 || numBlocks <= 0 || firstBlock + numBlocks > pParent->GetNumBlocks()) { assert(false); @@ -463,7 +463,7 @@ DiskImg::OpenImage(DiskImg* pParent, long firstBlock, long numBlocks) } fpDataGFD = pGFDGFD; - assert(fpWrapperGFD == nil); + assert(fpWrapperGFD == NULL); /* * 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, firstTrack, firstSector, numSectors); - if (fpDataGFD != nil) { + if (fpDataGFD != NULL) { WMSG0(" DI already open!\n"); return kDIErrAlreadyOpen; } - if (pParent == nil) + if (pParent == NULL) return kDIErrInvalidArg; int prntSectPerTrack = pParent->GetNumSectPerTrack(); @@ -517,7 +517,7 @@ DiskImg::OpenImage(DiskImg* pParent, long firstTrack, long firstSector, } fpDataGFD = pGFDGFD; - assert(fpWrapperGFD == nil); + assert(fpWrapperGFD == NULL); /* * 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 * NuFX archive, which must be opened on disk). */ - if (fpDataGFD != nil) { + if (fpDataGFD != NULL) { fpDataGFD->Close(); delete fpDataGFD; - fpDataGFD = nil; + fpDataGFD = NULL; } - if (fpWrapperGFD != nil) { + if (fpWrapperGFD != NULL) { fpWrapperGFD->Close(); delete fpWrapperGFD; - fpWrapperGFD = nil; + fpWrapperGFD = NULL; } - if (fpOuterGFD != nil) { + if (fpOuterGFD != NULL) { fpOuterGFD->Close(); delete fpOuterGFD; - fpOuterGFD = nil; + fpOuterGFD = NULL; } delete fpImageWrapper; - fpImageWrapper = nil; + fpImageWrapper = NULL; delete fpOuterWrapper; - fpOuterWrapper = nil; + fpOuterWrapper = NULL; return dierr; } @@ -641,7 +641,7 @@ DiskImg::FlushImage(FlushMode mode) WMSG2(" DI FlushImage (dirty=%d mode=%d)\n", fDirty, mode); if (!fDirty) return kDIErrNone; - if (fpDataGFD == nil) { + if (fpDataGFD == NULL) { /* * 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 @@ -655,8 +655,8 @@ DiskImg::FlushImage(FlushMode mode) } if (mode == kFlushFastOnly && - ((fpImageWrapper != nil && !fpImageWrapper->HasFastFlush()) || - (fpOuterWrapper != nil && !fpOuterWrapper->HasFastFlush()) )) + ((fpImageWrapper != NULL && !fpImageWrapper->HasFastFlush()) || + (fpOuterWrapper != NULL && !fpOuterWrapper->HasFastFlush()) )) { WMSG0("DI fast flush requested, but one or both wrappers are slow\n"); return kDIErrNone; @@ -680,10 +680,10 @@ DiskImg::FlushImage(FlushMode mode) * rename over the old will close fpWrapperGFD and just access it * 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 - * 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.) */ - if (fpWrapperGFD != nil) { + if (fpWrapperGFD != NULL) { WMSG2(" DI flushing data changes to wrapper (fLen=%ld fWrapLen=%ld)\n", (long) fLength, (long) fWrappedLength); 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 */ dierr = fpWrapperGFD->Flush(); } else { - assert(fpParentImg != nil); + assert(fpParentImg != NULL); } /* * Step 3: if we have an fpOuterGFD, rebuild the file with the data * in fpWrapperGFD. */ - if (fpOuterWrapper != nil) { + if (fpOuterWrapper != NULL) { WMSG1(" DI saving wrapper to outer, fWrapLen=%ld\n", (long) fWrappedLength); - assert(fpOuterGFD != nil); + assert(fpOuterGFD != NULL); dierr = fpOuterWrapper->Save(fpOuterGFD, fpWrapperGFD, fWrappedLength); if (dierr != kDIErrNone) { @@ -755,7 +755,7 @@ DiskImg::FlushImage(FlushMode mode) * fWrappedLength, fOuterLength - set appropriately * 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 - * 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 * for identification of the file "wrapper" * fPhysicalFormat - set to the type of data this holds @@ -773,10 +773,10 @@ DiskImg::AnalyzeImageFile(const char* pathName, char fssep) FileFormat probableFormat; bool reliableExt; const char* ext = FindExtension(pathName, fssep); - char* extBuf = nil; // uses malloc/free + char* extBuf = NULL; // uses malloc/free bool needExtFromOuter = false; - if (ext != nil) { + if (ext != NULL) { assert(*ext == '.'); ext++; } else @@ -820,7 +820,7 @@ DiskImg::AnalyzeImageFile(const char* pathName, char fssep) WMSG0(" DI found gz outer wrapper\n"); fpOuterWrapper = new OuterGzip(); - if (fpOuterWrapper == nil) { + if (fpOuterWrapper == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -829,20 +829,20 @@ DiskImg::AnalyzeImageFile(const char* pathName, char fssep) /* drop the ".gz" and get down to the next extension */ ext = ""; extBuf = strdup(pathName); - if (extBuf != nil) { + if (extBuf != NULL) { char* localExt; localExt = (char*) FindExtension(extBuf, fssep); - if (localExt != nil) + if (localExt != NULL) *localExt = '\0'; localExt = (char*) FindExtension(extBuf, fssep); - if (localExt != nil) { + if (localExt != NULL) { ext = localExt; assert(*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) { dierr = OuterZip::Test(fpWrapperGFD, fOuterLength); @@ -852,7 +852,7 @@ DiskImg::AnalyzeImageFile(const char* pathName, char fssep) WMSG0(" DI found ZIP outer wrapper\n"); fpOuterWrapper = new OuterZip(); - if (fpOuterWrapper == nil) { + if (fpOuterWrapper == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -866,7 +866,7 @@ DiskImg::AnalyzeImageFile(const char* pathName, char fssep) /* finish up outer wrapper stuff */ if (fOuterFormat != kOuterFormatNone) { - GenericFD* pNewGFD = nil; + GenericFD* pNewGFD = NULL; dierr = fpOuterWrapper->Load(fpWrapperGFD, fOuterLength, fReadOnly, &fWrappedLength, &pNewGFD); if (dierr != kDIErrNone) { @@ -887,7 +887,7 @@ DiskImg::AnalyzeImageFile(const char* pathName, char fssep) if (needExtFromOuter) { ext = fpOuterWrapper->GetExtension(); - if (ext == nil) + if (ext == NULL) ext = ""; } } @@ -1098,8 +1098,8 @@ gotit: ; dierr = kDIErrUnrecognizedFileFmt; break; } - if (fpImageWrapper != nil) { - assert(fpDataGFD == nil); + if (fpImageWrapper != NULL) { + assert(fpDataGFD == NULL); dierr = fpImageWrapper->Prep(fpWrapperGFD, fWrappedLength, fReadOnly, &fLength, &fPhysical, &fOrder, &fDOSVolumeNum, &fpBadBlockMap, &fpDataGFD); @@ -1123,7 +1123,7 @@ gotit: ; fFileFormat = probableFormat; assert(fLength >= 0); - assert(fpDataGFD != nil); + assert(fpDataGFD != NULL); assert(fOuterFormat != kOuterFormatUnknown); assert(fFileFormat != kFileFormatUnknown); assert(fPhysical != kPhysicalFormatUnknown); @@ -1157,7 +1157,7 @@ DIError DiskImg::AnalyzeImage(void) { assert(fLength >= 0); - assert(fpDataGFD != nil); + assert(fpDataGFD != NULL); assert(fFileFormat != kFileFormatUnknown); assert(fPhysical != kPhysicalFormatUnknown); assert(fFormat == kFormatUnknown); @@ -1165,7 +1165,7 @@ DiskImg::AnalyzeImage(void) assert(fNumTracks == -1); assert(fNumSectPerTrack == -1); assert(fNumBlocks == -1); - if (fpDataGFD == nil) + if (fpDataGFD == NULL) return kDIErrInternal; /* @@ -1235,7 +1235,7 @@ DiskImg::AnalyzeImage(void) DIError dierr; dierr = AnalyzeNibbleData(); // sets nibbleDescr and DOS vol num if (dierr == kDIErrNone) { - assert(fpNibbleDescr != nil); + assert(fpNibbleDescr != NULL); fNumSectPerTrack = fpNibbleDescr->numSectors; fOrder = kSectorOrderPhysical; @@ -1246,7 +1246,7 @@ DiskImg::AnalyzeImage(void) fReadOnly = true; } } else { - //assert(fpNibbleDescr == nil); + //assert(fpNibbleDescr == NULL); fNumSectPerTrack = -1; fOrder = kSectorOrderPhysical; fHasSectors = false; @@ -1674,7 +1674,7 @@ DIError DiskImg::FormatImage(FSFormat format, const char* volName) { DIError dierr = kDIErrNone; - DiskFS* pDiskFS = nil; + DiskFS* pDiskFS = NULL; FSFormat savedFormat; WMSG1(" DI FormatImage '%s'\n", volName); @@ -1690,7 +1690,7 @@ DiskImg::FormatImage(FSFormat format, const char* volName) pDiskFS = OpenAppropriateDiskFS(false); fFormat = savedFormat; - if (pDiskFS == nil) { + if (pDiskFS == NULL) { dierr = kDIErrUnsupportedFSFmt; goto bail; } @@ -1744,7 +1744,7 @@ DiskImg::ZeroImage(void) void DiskImg::SetScanProgressCallback(ScanProgressCallback func, void* cookie) { - if (fpParentImg != nil) { + if (fpParentImg != NULL) { /* unexpected, but perfectly okay */ DebugBreak(); } @@ -1753,7 +1753,7 @@ DiskImg::SetScanProgressCallback(ScanProgressCallback func, void* cookie) fScanProgressCookie = cookie; fScanCount = 0; fScanMsg[0] = '\0'; - fScanLastMsgWhen = time(nil); + fScanLastMsgWhen = time(NULL); } /* @@ -1768,14 +1768,14 @@ DiskImg::UpdateScanProgress(const char* newStr) bool result = true; /* search up the tree to find a progress updater */ - while (func == nil) { + while (func == NULL) { pImg = pImg->fpParentImg; - if (pImg == nil) + if (pImg == NULL) return result; // none defined, bail out func = pImg->fpScanProgressCallback; } - time_t now = time(nil); + time_t now = time(NULL); if (newStr == NULL) { fScanCount++; @@ -1987,7 +1987,7 @@ DiskImg::ReadTrackSectorSwapped(long track, int sector, void* buf, di_off_t offset; int newSector = -1; - if (buf == nil) + if (buf == NULL) return kDIErrInvalidArg; #if 0 // Pre-d13 @@ -2040,7 +2040,7 @@ DiskImg::WriteTrackSector(long track, int sector, const void* buf) di_off_t offset; int newSector = -1; - if (buf == nil) + if (buf == NULL) return kDIErrInvalidArg; if (fReadOnly) return kDIErrAccessDenied; @@ -2093,7 +2093,7 @@ DiskImg::ReadBlockSwapped(long block, void* buf, SectorOrder imageOrder, return kDIErrUnsupportedAccess; if (block < 0 || block >= fNumBlocks) return kDIErrInvalidBlock; - if (buf == nil) + if (buf == NULL) return kDIErrInvalidArg; DIError dierr; @@ -2146,7 +2146,7 @@ DiskImg::ReadBlocks(long startBlock, int numBlocks, void* buf) assert(fHasBlocks); assert(startBlock >= 0); assert(numBlocks > 0); - assert(buf != nil); + assert(buf != NULL); if (startBlock < 0 || numBlocks + startBlock > GetNumBlocks()) { assert(false); @@ -2201,7 +2201,7 @@ DiskImg::CheckForBadBlocks(long startBlock, int numBlocks) { int i; - if (fpBadBlockMap == nil) + if (fpBadBlockMap == NULL) return false; for (i = startBlock; i < startBlock+numBlocks; i++) { @@ -2224,7 +2224,7 @@ DiskImg::WriteBlock(long block, const void* buf) return kDIErrUnsupportedAccess; if (block < 0 || block >= fNumBlocks) return kDIErrInvalidBlock; - if (buf == nil) + if (buf == NULL) return kDIErrInvalidArg; if (fReadOnly) return kDIErrAccessDenied; @@ -2265,7 +2265,7 @@ DiskImg::WriteBlocks(long startBlock, int numBlocks, const void* buf) assert(fHasBlocks); assert(startBlock >= 0); assert(numBlocks > 0); - assert(buf != nil); + assert(buf != NULL); if (startBlock < 0 || numBlocks + startBlock > GetNumBlocks()) { assert(false); @@ -2344,7 +2344,7 @@ DiskImg::CopyBytesIn(const void* buf, di_off_t offset, int size) DebugBreak(); return kDIErrAccessDenied; } - assert(fpDataGFD != nil); // somebody closed the image? + assert(fpDataGFD != NULL); // somebody closed the image? dierr = fpDataGFD->Seek(offset, kSeekSet); 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 */ DiskImg* pImg = this; - while (pImg != nil) { + while (pImg != NULL) { pImg->fDirty = true; 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. * - * "storageName" and "pNibbleDescr" may be nil. + * "storageName" and "pNibbleDescr" may be NULL. */ DIError 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, 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) { WMSG1("ERROR: bad numBlocks %ld\n", numBlocks); @@ -2413,7 +2413,7 @@ DiskImg::CreateImage(const char* pathName, const char* storageName, const NibbleDescr* pNibbleDescr, SectorOrder order, 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) { 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"); fHasNibbles = true; fHasSectors = false; - fpNibbleDescr = nil; + fpNibbleDescr = NULL; } return CreateImageCommon(pathName, storageName, skipFormat); @@ -2529,7 +2529,7 @@ DiskImg::CreateImageCommon(const char* pathName, const char* storageName, fpWrapperGFD = pGFDFile; else fpOuterGFD = pGFDFile; - pGFDFile = nil; + pGFDFile = NULL; /* * 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); - if (fpWrapperGFD == nil) { + if (fpWrapperGFD == NULL) { /* shift GFDs and create a new memory GFD, pre-sized */ GFDBuffer* pGFDBuffer = new GFDBuffer; /* 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) { delete pGFDBuffer; goto bail; } fpWrapperGFD = pGFDBuffer; - pGFDBuffer = nil; + pGFDBuffer = NULL; } /* create an fpOuterWrapper struct */ @@ -2572,14 +2572,14 @@ DiskImg::CreateImageCommon(const char* pathName, const char* storageName, break; case kOuterFormatGzip: fpOuterWrapper = new OuterGzip; - if (fpOuterWrapper == nil) { + if (fpOuterWrapper == NULL) { dierr = kDIErrMalloc; goto bail; } break; case kOuterFormatZip: fpOuterWrapper = new OuterZip; - if (fpOuterWrapper == nil) { + if (fpOuterWrapper == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -2646,25 +2646,25 @@ DiskImg::CreateImageCommon(const char* pathName, const char* storageName, } break; default: - assert(fpImageWrapper == nil); + assert(fpImageWrapper == NULL); break; } - if (fpImageWrapper == nil) { + if (fpImageWrapper == NULL) { WMSG0(" DI couldn't figure out the file format\n"); dierr = kDIErrUnrecognizedFileFmt; goto bail; } /* create the wrapper, write the header, and create fpDataGFD */ - assert(fpDataGFD == nil); + assert(fpDataGFD == NULL); dierr = fpImageWrapper->Create(fLength, fPhysical, fOrder, fDOSVolumeNum, fpWrapperGFD, &fWrappedLength, &fpDataGFD); if (dierr != kDIErrNone) { WMSG1("ImageWrapper Create failed, err=%d\n", dierr); goto bail; } - assert(fpDataGFD != nil); + assert(fpDataGFD != NULL); /* * Step 6: "format" fpDataGFD. @@ -2695,9 +2695,9 @@ DiskImg::CreateImageCommon(const char* pathName, const char* storageName, * Quick sanity check... */ if (fOuterFormat != kOuterFormatNone) { - assert(fpOuterGFD != nil); - assert(fpWrapperGFD != nil); - assert(fpDataGFD != nil); + assert(fpOuterGFD != NULL); + assert(fpWrapperGFD != NULL); + assert(fpDataGFD != NULL); } bail: @@ -2778,12 +2778,12 @@ DiskImg::ValidateCreateFormat(void) const return kDIErrInvalidCreateReq; } - if (fpNibbleDescr == nil && GetNumSectPerTrack() > 0) { + if (fpNibbleDescr == NULL && GetNumSectPerTrack() > 0) { WMSG0("CreateImage: must provide NibbleDescr for non-sector\n"); return kDIErrInvalidCreateReq; } - if (fpNibbleDescr != nil && + if (fpNibbleDescr != NULL && fpNibbleDescr->numSectors != GetNumSectPerTrack()) { WMSG2("CreateImage: ?? nd->numSectors=%d, GetNumSectPerTrack=%d\n", @@ -2791,7 +2791,7 @@ DiskImg::ValidateCreateFormat(void) const return kDIErrInvalidCreateReq; } - if (fpNibbleDescr != nil && ( + if (fpNibbleDescr != NULL && ( (fpNibbleDescr->numSectors == 13 && fpNibbleDescr->encoding != kNibbleEnc53) || (fpNibbleDescr->numSectors == 16 && @@ -2930,14 +2930,14 @@ DiskImg::FormatSectors(GenericFD* pGFD, bool quickFormat) const (long) fLength - sizeof(sctBuf), dierr); goto bail; } - dierr = pGFD->Write(sctBuf, sizeof(sctBuf), nil); + dierr = pGFD->Write(sctBuf, sizeof(sctBuf), NULL); if (dierr != kDIErrNone) { WMSG1(" FormatSectors: GFD quick write failed (err=%d)\n", dierr); goto bail; } } else { 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) { WMSG1(" FormatSectors: GFD write failed (err=%d)\n", dierr); goto bail; @@ -2966,13 +2966,13 @@ DiskImg::FormatBlocks(GenericFD* pGFD) const assert(fLength > 0 && (fLength & 0x1ff) == 0); - start = time(nil); + start = time(NULL); memset(blkBuf, 0, sizeof(blkBuf)); pGFD->Rewind(); 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) { WMSG1(" FormatBlocks: GFD write failed (err=%d)\n", dierr); return dierr; @@ -2980,7 +2980,7 @@ DiskImg::FormatBlocks(GenericFD* pGFD) const } assert(length == 0); - end = time(nil); + end = time(NULL); WMSG1("FormatBlocks complete, time=%ld\n", end - start); return kDIErrNone; @@ -3049,9 +3049,9 @@ DiskImg::AddNote(NoteType type, const char* fmt, ...) WMSG1("+++ adding note '%s'\n", buf); - if (fNotes == nil) { + if (fNotes == NULL) { fNotes = new char[len +1]; - if (fNotes == nil) { + if (fNotes == NULL) { WMSG1("Unable to create notes[%d]\n", len+1); assert(false); return; @@ -3060,7 +3060,7 @@ DiskImg::AddNote(NoteType type, const char* fmt, ...) } else { int existingLen = strlen(fNotes); char* newNotes = new char[existingLen + len +1]; - if (newNotes == nil) { + if (newNotes == NULL) { WMSG1("Unable to create newNotes[%d]\n", existingLen+len+1); assert(false); return; @@ -3078,7 +3078,7 @@ DiskImg::AddNote(NoteType type, const char* fmt, ...) const char* DiskImg::GetNotes(void) const { - if (fNotes == nil) + if (fNotes == NULL) return ""; else return fNotes; @@ -3106,7 +3106,7 @@ DiskImg::GetNibbleTrackOffset(long track) const /* * 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 * DiskFSUnknown is returned. * @@ -3116,7 +3116,7 @@ DiskImg::GetNibbleTrackOffset(long track) const DiskFS* DiskImg::OpenAppropriateDiskFS(bool allowUnknown) { - DiskFS* pDiskFS = nil; + DiskFS* pDiskFS = NULL; /* * Create an appropriate DiskFS object. @@ -3335,7 +3335,7 @@ DiskImgLib::DIStrError(DIError dierr) if (dierr > 0) { const char* msg; msg = strerror(dierr); - if (msg != nil) + if (msg != NULL) return msg; } @@ -3347,7 +3347,7 @@ DiskImgLib::DIStrError(DIError dierr) * to return this. * * 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 * debug builds, though, as it's helpful to know *which* error is not * recognized. diff --git a/diskimg/DiskImg.h b/diskimg/DiskImg.h index 98fd7a7..45a0734 100644 --- a/diskimg/DiskImg.h +++ b/diskimg/DiskImg.h @@ -556,7 +556,7 @@ public: /* * 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. * 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 * into. On entry "pNormalizedBufLen" holds the length of the buffer. * 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 * error (kDIErrDataOverrun) will be returned. */ @@ -1232,7 +1232,7 @@ public: // 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. // 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; // Returns "false" if we only support read-only access to this FS type diff --git a/diskimg/DiskImgPriv.h b/diskimg/DiskImgPriv.h index cbe3c9c..d943c90 100644 --- a/diskimg/DiskImgPriv.h +++ b/diskimg/DiskImgPriv.h @@ -59,8 +59,6 @@ namespace DiskImgLib { */ #define NELEM(x) ((int) (sizeof(x) / sizeof(x[0]))) -#define nil NULL - #define ErrnoOrGeneric() (errno != 0 ? (DIError) errno : kDIErrGeneric) @@ -108,10 +106,10 @@ class CircularBufferAccess { public: CircularBufferAccess(unsigned char* buf, long len) : fBuf(buf), fLen(len) - { assert(fLen > 0); assert(fBuf != nil); } + { assert(fLen > 0); assert(fBuf != NULL); } CircularBufferAccess(const unsigned char* buf, long len) : fBuf(const_cast(buf)), fLen(len) - { assert(fLen > 0); assert(fBuf != nil); } + { assert(fLen > 0); assert(fBuf != NULL); } ~CircularBufferAccess(void) {} /* @@ -254,7 +252,7 @@ public: fBitPosn = 7; fBuf = fBufStart; //fByte = *fBuf++; - if (pWrap != nil) + if (pWrap != NULL) *pWrap = true; } diff --git a/diskimg/FAT.cpp b/diskimg/FAT.cpp index 6281747..8023ad1 100644 --- a/diskimg/FAT.cpp +++ b/diskimg/FAT.cpp @@ -375,9 +375,9 @@ DIError A2FileFAT::Open(A2FileDescr** ppOpenFile, bool readOnly, bool rsrcFork /*=false*/) { - A2FDFAT* pOpenFile = nil; + A2FDFAT* pOpenFile = NULL; - if (fpOpenFile != nil) + if (fpOpenFile != NULL) return kDIErrAlreadyOpen; if (rsrcFork) 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 */ if (fOffset + (long)len > pFile->fLength) { - if (pActual == nil) + if (pActual == NULL) return kDIErrDataUnderrun; len = (size_t) (pFile->fLength - fOffset); } - if (pActual != nil) + if (pActual != NULL) *pActual = len; memcpy(buf, pFile->GetFakeFileBuf(), len); diff --git a/diskimg/FDI.cpp b/diskimg/FDI.cpp index 14c9ccb..9f1b077 100644 --- a/diskimg/FDI.cpp +++ b/diskimg/FDI.cpp @@ -63,7 +63,7 @@ WrapperFDI::UnpackDisk525(GenericFD* pGFD, GenericFD* pNewGFD, int numCyls, { DIError dierr = kDIErrNone; unsigned char nibbleBuf[kNibbleBufLen]; - unsigned char* inputBuf = nil; + unsigned char* inputBuf = NULL; bool goodTracks[kMaxNibbleTracks525]; int inputBufLen = -1; int badTracks = 0; @@ -92,7 +92,7 @@ WrapperFDI::UnpackDisk525(GenericFD* pGFD, GenericFD* pNewGFD, int numCyls, delete[] inputBuf; inputBufLen = length256 * 256; inputBuf = new unsigned char[inputBufLen]; - if (inputBuf == nil) { + if (inputBuf == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -229,7 +229,7 @@ WrapperFDI::UnpackDisk35(GenericFD* pGFD, GenericFD* pNewGFD, int numCyls, { DIError dierr = kDIErrNone; unsigned char nibbleBuf[kNibbleBufLen]; - unsigned char* inputBuf = nil; + unsigned char* inputBuf = NULL; unsigned char outputBuf[kMaxSectors35 * kBlockSize]; // 6KB int inputBufLen = -1; int badTracks = 0; @@ -259,7 +259,7 @@ WrapperFDI::UnpackDisk35(GenericFD* pGFD, GenericFD* pNewGFD, int numCyls, delete[] inputBuf; inputBufLen = length256 * 256; inputBuf = new unsigned char[inputBufLen]; - if (inputBuf == nil) { + if (inputBuf == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -503,7 +503,7 @@ WrapperFDI::DecodePulseTrack(const unsigned char* inputBuf, long inputLen, * Uncompress or endian-swap the pulse streams. */ hdr.avgStream = new unsigned long[hdr.numPulses]; - if (hdr.avgStream == nil) + if (hdr.avgStream == NULL) goto bail; if (!UncompressPulseStream(inputBuf, hdr.avgStreamLen, hdr.avgStream, hdr.numPulses, hdr.avgStreamCompression, 4)) @@ -514,7 +514,7 @@ WrapperFDI::DecodePulseTrack(const unsigned char* inputBuf, long inputLen, if (hdr.minStreamLen > 0) { hdr.minStream = new unsigned long[hdr.numPulses]; - if (hdr.minStream == nil) + if (hdr.minStream == NULL) goto bail; if (!UncompressPulseStream(inputBuf, hdr.minStreamLen, hdr.minStream, hdr.numPulses, hdr.minStreamCompression, 4)) @@ -550,13 +550,13 @@ WrapperFDI::DecodePulseTrack(const unsigned char* inputBuf, long inputLen, bail: /* clean up */ - if (hdr.avgStream != nil) + if (hdr.avgStream != NULL) delete[] hdr.avgStream; - if (hdr.minStream != nil) + if (hdr.minStream != NULL) delete[] hdr.minStream; - if (hdr.maxStream != nil) + if (hdr.maxStream != NULL) delete[] hdr.maxStream; - if (hdr.idxStream != nil) + if (hdr.idxStream != NULL) delete[] hdr.idxStream; return result; } @@ -661,8 +661,8 @@ WrapperFDI::ExpandHuffman(const unsigned char* inputBuf, long inputLen, // subStreamShift, signExtend, sixteenBits); /* decode the Huffman tree structure */ - root.left = nil; - root.right = nil; + root.left = NULL; + root.right = NULL; bitMask = 0; 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 */ /* (note: nodes have two kids or none) */ while (true) { - if (pCurrent->left == nil) { + if (pCurrent->left == NULL) { break; } else { bitMask >>= 1; @@ -748,8 +748,8 @@ WrapperFDI::HuffExtractTree(const unsigned char* inputBuf, HuffNode* pNode, //WMSG1(" val=%d\n", val); if (val != 0) { - assert(pNode->left == nil); - assert(pNode->right == nil); + assert(pNode->left == NULL); + assert(pNode->right == NULL); return inputBuf; } else { pNode->left = new HuffNode; @@ -767,7 +767,7 @@ WrapperFDI::HuffExtractTree(const unsigned char* inputBuf, HuffNode* pNode, const unsigned char* WrapperFDI::HuffExtractValues16(const unsigned char* inputBuf, HuffNode* pNode) { - if (pNode->left == nil) { + if (pNode->left == NULL) { pNode->val = (*inputBuf++) << 8; pNode->val |= *inputBuf++; return inputBuf; @@ -783,7 +783,7 @@ WrapperFDI::HuffExtractValues16(const unsigned char* inputBuf, HuffNode* pNode) const unsigned char* WrapperFDI::HuffExtractValues8(const unsigned char* inputBuf, HuffNode* pNode) { - if (pNode->left == nil) { + if (pNode->left == NULL) { pNode->val = *inputBuf++; return inputBuf; } else { @@ -798,7 +798,7 @@ WrapperFDI::HuffExtractValues8(const unsigned char* inputBuf, HuffNode* pNode) void WrapperFDI::HuffFreeNodes(HuffNode* pNode) { - if (pNode != nil) { + if (pNode != NULL) { HuffFreeNodes(pNode->left); HuffFreeNodes(pNode->right); delete pNode; @@ -847,7 +847,7 @@ bool WrapperFDI::ConvertPulseStreamsToNibbles(PulseIndexHeader* pHdr, int bitRate, unsigned char* nibbleBuf, long* pNibbleLen) { - unsigned long* fakeIdxStream = nil; + unsigned long* fakeIdxStream = NULL; bool result = false; int i; @@ -860,7 +860,7 @@ WrapperFDI::ConvertPulseStreamsToNibbles(PulseIndexHeader* pHdr, int bitRate, unsigned long* idxStream; avgStream = pHdr->avgStream; - if (pHdr->minStream != nil && pHdr->maxStream != nil) { + if (pHdr->minStream != NULL && pHdr->maxStream != NULL) { minStream = pHdr->minStream; maxStream = pHdr->maxStream; @@ -874,7 +874,7 @@ WrapperFDI::ConvertPulseStreamsToNibbles(PulseIndexHeader* pHdr, int bitRate, maxStream = pHdr->avgStream; } - if (pHdr->idxStream != nil) + if (pHdr->idxStream != NULL) idxStream = pHdr->idxStream; else { /* @@ -886,7 +886,7 @@ WrapperFDI::ConvertPulseStreamsToNibbles(PulseIndexHeader* pHdr, int bitRate, WMSG0(" FDI: HEY: using fake index stream\n"); DebugBreak(); fakeIdxStream = new unsigned long[pHdr->numPulses]; - if (fakeIdxStream == nil) { + if (fakeIdxStream == NULL) { WMSG0(" FDI: unable to alloc fake idx stream\n"); goto bail; } diff --git a/diskimg/FocusDrive.cpp b/diskimg/FocusDrive.cpp index 3737a14..ac5caf1 100644 --- a/diskimg/FocusDrive.cpp +++ b/diskimg/FocusDrive.cpp @@ -142,8 +142,8 @@ DiskFSFocusDrive::OpenSubVolume(long startBlock, long numBlocks, const char* name) { DIError dierr = kDIErrNone; - DiskFS* pNewFS = nil; - DiskImg* pNewImg = nil; + DiskFS* pNewFS = NULL; + DiskImg* pNewImg = NULL; //bool tweaked = false; WMSG2("Adding %ld +%ld\n", startBlock, numBlocks); @@ -164,7 +164,7 @@ DiskFSFocusDrive::OpenSubVolume(long startBlock, long numBlocks, } pNewImg = new DiskImg; - if (pNewImg == nil) { + if (pNewImg == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -193,7 +193,7 @@ DiskFSFocusDrive::OpenSubVolume(long startBlock, long numBlocks, WMSG2(" FocusDriveSub (%ld,%ld): unable to identify filesystem\n", startBlock, numBlocks); DiskFSUnknown* pUnknownFS = new DiskFSUnknown; - if (pUnknownFS == nil) { + if (pUnknownFS == NULL) { dierr = kDIErrInternal; goto bail; } @@ -203,7 +203,7 @@ DiskFSFocusDrive::OpenSubVolume(long startBlock, long numBlocks, /* open a DiskFS for the sub-image */ WMSG2(" FocusDriveSub (%ld,%ld) analyze succeeded!\n", startBlock, numBlocks); pNewFS = pNewImg->OpenAppropriateDiskFS(true); - if (pNewFS == nil) { + if (pNewFS == NULL) { WMSG0(" FocusDriveSub: OpenAppropriateDiskFS failed\n"); dierr = kDIErrUnsupportedFSFmt; goto bail; @@ -236,8 +236,8 @@ DiskFSFocusDrive::OpenSubVolume(long startBlock, long numBlocks, /* add it to the list */ AddSubVolumeToList(pNewImg, pNewFS); - pNewImg = nil; - pNewFS = nil; + pNewImg = NULL; + pNewFS = NULL; bail: delete pNewFS; @@ -342,8 +342,8 @@ DiskFSFocusDrive::OpenVol(int idx, long startBlock, long numBlocks, if (dierr != kDIErrNone) { if (dierr == kDIErrCancelled) goto bail; - DiskFS* pNewFS = nil; - DiskImg* pNewImg = nil; + DiskFS* pNewFS = NULL; + DiskImg* pNewImg = NULL; WMSG1(" FocusDrive failed opening sub-volume %d\n", idx); dierr = CreatePlaceholder(startBlock, numBlocks, name, NULL, diff --git a/diskimg/GenericFD.cpp b/diskimg/GenericFD.cpp index 9590f29..a308e1f 100644 --- a/diskimg/GenericFD.cpp +++ b/diskimg/GenericFD.cpp @@ -19,7 +19,7 @@ * Copy "length" bytes from "pSrc" to "pDst". Both GenericFDs should be * 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. */ /*static*/ DIError @@ -28,21 +28,21 @@ GenericFD::CopyFile(GenericFD* pDst, GenericFD* pSrc, di_off_t length, { DIError dierr = kDIErrNone; const int kCopyBufSize = 32768; - unsigned char* copyBuf = nil; + unsigned char* copyBuf = NULL; int copySize; WMSG1("+++ CopyFile: %ld bytes\n", (long) length); - if (pDst == nil || pSrc == nil || length < 0) + if (pDst == NULL || pSrc == NULL || length < 0) return kDIErrInvalidArg; if (length == 0) return kDIErrNone; copyBuf = new unsigned char[kCopyBufSize]; - if (copyBuf == nil) + if (copyBuf == NULL) return kDIErrMalloc; - if (pCRC != nil) + if (pCRC != NULL) *pCRC = crc32(0L, Z_NULL, 0); while (length != 0) { @@ -54,7 +54,7 @@ GenericFD::CopyFile(GenericFD* pDst, GenericFD* pSrc, di_off_t length, if (dierr != kDIErrNone) goto bail; - if (pCRC != nil) + if (pCRC != NULL) *pCRC = crc32(*pCRC, copyBuf, copySize); dierr = pDst->Write(copyBuf, copySize); @@ -94,9 +94,9 @@ GFDFile::Open(const char* filename, bool readOnly) { DIError dierr = kDIErrNone; - if (fFp != nil) + if (fFp != NULL) return kDIErrAlreadyOpen; - if (filename == nil) + if (filename == NULL) return kDIErrInvalidArg; if (filename[0] == '\0') return kDIErrInvalidArg; @@ -106,7 +106,7 @@ GFDFile::Open(const char* filename, bool readOnly) strcpy(fPathName, filename); fFp = fopen(filename, readOnly ? "rb" : "r+b"); - if (fFp == nil) { + if (fFp == NULL) { if (errno == EACCES) dierr = kDIErrAccessDenied; else @@ -125,7 +125,7 @@ GFDFile::Read(void* buf, size_t length, size_t* pActual) DIError dierr = kDIErrNone; size_t actual; - if (fFp == nil) + if (fFp == NULL) return kDIErrNotReady; actual = ::fread(buf, 1, length, fFp); if (actual == 0) { @@ -139,7 +139,7 @@ GFDFile::Read(void* buf, size_t length, size_t* pActual) return kDIErrInternal; } - if (pActual == nil) { + if (pActual == NULL) { if (actual != length) { dierr = ErrnoOrGeneric(); 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; - if (fFp == nil) + if (fFp == NULL) return kDIErrNotReady; if (fReadOnly) return kDIErrAccessDenied; - assert(pActual == nil); // not handling this yet + assert(pActual == NULL); // not handling this yet if (::fwrite(buf, length, 1, fFp) != 1) { dierr = ErrnoOrGeneric(); 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 kAlmostTwoGB = kOneGB + (kOneGB -1); - if (fFp == nil) + if (fFp == NULL) return kDIErrNotReady; //assert(offset <= kAlmostTwoGB); //if (::fseek(fFp, (long) offset, whence) != 0) { @@ -195,7 +195,7 @@ GFDFile::Tell(void) DIError dierr = kDIErrNone; di_off_t result; - if (fFp == nil) + if (fFp == NULL) return kDIErrNotReady; //result = ::ftell(fFp); result = ::ftello(fFp); @@ -230,12 +230,12 @@ GFDFile::Truncate(void) DIError GFDFile::Close(void) { - if (fFp == nil) + if (fFp == NULL) return kDIErrNotReady; WMSG1(" GFDFile closing '%s'\n", fPathName); fclose(fFp); - fFp = nil; + fFp = NULL; return kDIErrNone; } @@ -248,7 +248,7 @@ GFDFile::Open(const char* filename, bool readOnly) if (fFd >= 0) return kDIErrAlreadyOpen; - if (filename == nil) + if (filename == NULL) return kDIErrInvalidArg; if (filename[0] == '\0') return kDIErrInvalidArg; @@ -289,7 +289,7 @@ GFDFile::Read(void* buf, size_t length, size_t* pActual) return dierr; } - if (pActual == nil) { + if (pActual == NULL) { if (actual != (ssize_t) length) { WMSG2(" GDFile Read partial (wanted=%d actual=%d)\n", length, actual); @@ -311,7 +311,7 @@ GFDFile::Write(const void* buf, size_t length, size_t* pActual) return kDIErrNotReady; if (fReadOnly) return kDIErrAccessDenied; - assert(pActual == nil); // not handling partial writes yet + assert(pActual == NULL); // not handling partial writes yet actual = ::write(fFd, buf, length); if (actual != (ssize_t) length) { dierr = ErrnoOrGeneric(); @@ -414,7 +414,7 @@ DIError GFDBuffer::Open(void* buffer, di_off_t length, bool doDelete, bool doExpand, bool readOnly) { - if (fBuffer != nil) + if (fBuffer != NULL) return kDIErrAlreadyOpen; if (length <= 0) return kDIErrInvalidArg; @@ -425,10 +425,10 @@ GFDBuffer::Open(void* buffer, di_off_t length, bool doDelete, bool doExpand, return kDIErrInvalidArg; } - /* if buffer is nil, allocate it ourselves */ - if (buffer == nil) { + /* if buffer is NULL, allocate it ourselves */ + if (buffer == NULL) { fBuffer = (void*) new char[(int) length]; - if (fBuffer == nil) + if (fBuffer == NULL) return kDIErrMalloc; } else fBuffer = buffer; @@ -447,13 +447,13 @@ GFDBuffer::Open(void* buffer, di_off_t length, bool doDelete, bool doExpand, DIError GFDBuffer::Read(void* buf, size_t length, size_t* pActual) { - if (fBuffer == nil) + if (fBuffer == NULL) return kDIErrNotReady; if (length == 0) return kDIErrInvalidArg; if (fCurrentOffset + (long)length > fLength) { - if (pActual == nil) { + if (pActual == NULL) { WMSG3(" GFDBuffer underrrun off=%ld len=%d flen=%ld\n", (long) fCurrentOffset, length, (long) fLength); return kDIErrDataUnderrun; @@ -467,7 +467,7 @@ GFDBuffer::Read(void* buf, size_t length, size_t* pActual) return kDIErrEOF; } } - if (pActual != nil) + if (pActual != NULL) *pActual = length; memcpy(buf, (const char*)fBuffer + fCurrentOffset, length); @@ -479,9 +479,9 @@ GFDBuffer::Read(void* buf, size_t length, size_t* pActual) DIError GFDBuffer::Write(const void* buf, size_t length, size_t* pActual) { - if (fBuffer == nil) + if (fBuffer == NULL) return kDIErrNotReady; - assert(pActual == nil); // not handling this yet + assert(pActual == NULL); // not handling this yet if (fCurrentOffset + (long)length > fLength) { if (!fDoExpand) { 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); assert(fAllocLength < kMaxReasonableSize); char* newBuf = new char[(int) fAllocLength]; - if (newBuf == nil) + if (newBuf == NULL) return kDIErrMalloc; memcpy(newBuf, fBuffer, fLength); @@ -530,7 +530,7 @@ GFDBuffer::Write(const void* buf, size_t length, size_t* pActual) DIError GFDBuffer::Seek(di_off_t offset, DIWhence whence) { - if (fBuffer == nil) + if (fBuffer == NULL) return kDIErrNotReady; switch (whence) { @@ -564,7 +564,7 @@ GFDBuffer::Seek(di_off_t offset, DIWhence whence) di_off_t GFDBuffer::Tell(void) { - if (fBuffer == nil) + if (fBuffer == NULL) return (di_off_t) -1; return fCurrentOffset; } @@ -572,7 +572,7 @@ GFDBuffer::Tell(void) DIError GFDBuffer::Close(void) { - if (fBuffer == nil) + if (fBuffer == NULL) return kDIErrNone; if (fDoDelete) { @@ -581,7 +581,7 @@ GFDBuffer::Close(void) } else { WMSG0(" GFDBuffer closing\n"); } - fBuffer = nil; + fBuffer = NULL; return kDIErrNone; } @@ -613,12 +613,12 @@ DIError GFDWinVolume::Open(const char* deviceName, bool readOnly) { DIError dierr = kDIErrNone; - HANDLE handle = nil; + HANDLE handle = NULL; //unsigned long kTwoGBBlocks; if (fVolAccess.Ready()) return kDIErrAlreadyOpen; - if (deviceName == nil) + if (deviceName == NULL) return kDIErrInvalidArg; if (deviceName[0] == '\0') return kDIErrInvalidArg; @@ -659,7 +659,7 @@ DIError GFDWinVolume::Read(void* buf, size_t length, size_t* pActual) { DIError dierr = kDIErrNone; - unsigned char* blkBuf = nil; + unsigned char* blkBuf = NULL; //WMSG2(" GFDWinVolume: reading %ld bytes from offset %ld\n", length, // fCurrentOffset); @@ -669,11 +669,11 @@ GFDWinVolume::Read(void* buf, size_t length, size_t* pActual) // don't allow reading past the end of file if (fCurrentOffset + (long) length > fVolumeEOF) { - if (pActual == nil) + if (pActual == NULL) return kDIErrDataUnderrun; length = (size_t) (fVolumeEOF - fCurrentOffset); } - if (pActual != nil) + if (pActual != NULL) *pActual = length; if (length == 0) return kDIErrNone; @@ -743,7 +743,7 @@ DIError GFDWinVolume::Write(const void* buf, size_t length, size_t* pActual) { DIError dierr = kDIErrNone; - unsigned char* blkBuf = nil; + unsigned char* blkBuf = NULL; //WMSG2(" GFDWinVolume: writing %ld bytes at offset %ld\n", length, // 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 if (fCurrentOffset + (long) length > fVolumeEOF) { - if (pActual == nil) + if (pActual == NULL) return kDIErrDataOverrun; length = (size_t) (fVolumeEOF - fCurrentOffset); } - if (pActual != nil) + if (pActual != NULL) *pActual = length; if (length == 0) return kDIErrNone; diff --git a/diskimg/GenericFD.h b/diskimg/GenericFD.h index 6266b0b..a856625 100644 --- a/diskimg/GenericFD.h +++ b/diskimg/GenericFD.h @@ -75,7 +75,7 @@ private: * * 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 - * 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. * * 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 * (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 * 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. 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, - size_t* pActual = nil) = 0; + size_t* pActual = NULL) = 0; virtual DIError Seek(di_off_t offset, DIWhence whence) = 0; virtual di_off_t Tell(void) = 0; virtual DIError Truncate(void) = 0; @@ -133,7 +133,7 @@ public: * be seeked to their initial positions. "length" bytes will be copied. */ static DIError CopyFile(GenericFD* pDst, GenericFD* pSrc, di_off_t length, - unsigned long* pCRC = nil); + unsigned long* pCRC = NULL); protected: GenericFD& operator=(const GenericFD&); @@ -145,17 +145,17 @@ protected: class GFDFile : public GenericFD { public: #ifdef HAVE_FSEEKO - GFDFile(void) : fPathName(nil), fFp(nil) {} + GFDFile(void) : fPathName(NULL), fFp(NULL) {} #else - GFDFile(void) : fPathName(nil), fFd(-1) {} + GFDFile(void) : fPathName(NULL), fFd(-1) {} #endif virtual ~GFDFile(void) { Close(); delete[] fPathName; } virtual DIError Open(const char* filename, bool readOnly); 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, - size_t* pActual = nil); + size_t* pActual = NULL); virtual DIError Seek(di_off_t offset, DIWhence whence); virtual di_off_t Tell(void); virtual DIError Truncate(void); @@ -175,15 +175,15 @@ private: #ifdef _WIN32 class GFDWinVolume : public GenericFD { public: - GFDWinVolume(void) : fPathName(nil), fCurrentOffset(0), fVolumeEOF(-1) + GFDWinVolume(void) : fPathName(NULL), fCurrentOffset(0), fVolumeEOF(-1) {} virtual ~GFDWinVolume(void) { delete[] fPathName; } virtual DIError Open(const char* deviceName, bool readOnly); 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, - size_t* pActual = nil); + size_t* pActual = NULL); virtual DIError Seek(di_off_t offset, DIWhence whence); virtual di_off_t Tell(void); virtual DIError Truncate(void) { return kDIErrNotSupported; } @@ -203,7 +203,7 @@ private: class GFDBuffer : public GenericFD { public: - GFDBuffer(void) : fBuffer(nil) {} + GFDBuffer(void) : fBuffer(NULL) {} virtual ~GFDBuffer(void) { Close(); } // 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, bool doExpand, bool readOnly); 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, - size_t* pActual = nil); + size_t* pActual = NULL); virtual DIError Seek(di_off_t offset, DIWhence whence); virtual di_off_t Tell(void); virtual DIError Truncate(void) { @@ -228,7 +228,7 @@ public: return kDIErrNone; } 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. void* GetBuffer(void) const { return fBuffer; } @@ -246,18 +246,18 @@ private: #if 0 class GFDEmbedded : public GenericFD { public: - GFDEmbedded(void) : fEFD(nil) {} + GFDEmbedded(void) : fEFD(NULL) {} virtual ~GFDEmbedded(void) { Close(); } virtual DIError Open(EmbeddedFD* pEFD, bool readOnly); 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, - size_t* pActual = nil); + size_t* pActual = NULL); virtual DIError Seek(di_off_t offset, DIWhence whence); virtual di_off_t Tell(void); virtual DIError Close(void); - virtual const char* GetPathName(void) const { return nil; } + virtual const char* GetPathName(void) const { return NULL; } private: EmbeddedFD* fEFD; @@ -267,11 +267,11 @@ private: /* pass all requests straight through to another GFD (with offset bias) */ class GFDGFD : public GenericFD { public: - GFDGFD(void) : fpGFD(nil), fOffset(0) {} + GFDGFD(void) : fpGFD(NULL), fOffset(0) {} virtual ~GFDGFD(void) { Close(); } virtual DIError Open(GenericFD* pGFD, di_off_t offset, bool readOnly) { - if (pGFD == nil) + if (pGFD == NULL) return kDIErrInvalidArg; if (!readOnly && pGFD->GetReadOnly()) return kDIErrAccessDenied; // can't convert to read-write @@ -282,12 +282,12 @@ public: return kDIErrNone; } virtual DIError Read(void* buf, size_t length, - size_t* pActual = nil) + size_t* pActual = NULL) { return fpGFD->Read(buf, length, pActual); } virtual DIError Write(const void* buf, size_t length, - size_t* pActual = nil) + size_t* pActual = NULL) { return fpGFD->Write(buf, length, pActual); } @@ -302,7 +302,7 @@ public: } virtual DIError Close(void) { /* do NOT close underlying descriptor */ - fpGFD = nil; + fpGFD = NULL; return kDIErrNone; } virtual const char* GetPathName(void) const { return fpGFD->GetPathName(); } diff --git a/diskimg/Global.cpp b/diskimg/Global.cpp index 61bb1a8..9b90672 100644 --- a/diskimg/Global.cpp +++ b/diskimg/Global.cpp @@ -12,7 +12,7 @@ /*static*/ bool Global::fAppInitCalled = false; -/*static*/ ASPI* Global::fpASPI = nil; +/*static*/ ASPI* Global::fpASPI = NULL; /* global constant */ const char* DiskImgLib::kASPIDev = "ASPI:"; @@ -39,7 +39,7 @@ Global::AppInit(void) HMODULE hModule; WCHAR fileNameBuf[256]; hModule = ::GetModuleHandle(L"DiskImg4.dll"); - if (hModule != nil && + if (hModule != NULL && ::GetModuleFileName(hModule, fileNameBuf, sizeof(fileNameBuf) / sizeof(WCHAR)) != 0) { @@ -75,7 +75,7 @@ Global::AppInit(void) fpASPI = new ASPI; if (fpASPI->Init() != kDIErrNone) { delete fpASPI; - fpASPI = nil; + fpASPI = NULL; } } #endif @@ -105,10 +105,10 @@ Global::AppCleanup(void) * the other. */ #ifdef _WIN32 -/*static*/ bool Global::GetHasSPTI(void) { return !IsWin9x() && fpASPI == nil; } -/*static*/ bool Global::GetHasASPI(void) { return fpASPI != nil; } +/*static*/ bool Global::GetHasSPTI(void) { return !IsWin9x() && fpASPI == NULL; } +/*static*/ bool Global::GetHasASPI(void) { return fpASPI != NULL; } /*static*/ unsigned long Global::GetASPIVersion(void) { - assert(fpASPI != nil); + assert(fpASPI != NULL); #ifdef WANT_ASPI return fpASPI->GetVersion(); #else @@ -128,11 +128,11 @@ Global::AppCleanup(void) /*static*/ void Global::GetVersion(long* pMajor, long* pMinor, long* pBug) { - if (pMajor != nil) + if (pMajor != NULL) *pMajor = kDiskImgVersionMajor; - if (pMinor != nil) + if (pMinor != NULL) *pMinor = kDiskImgVersionMinor; - if (pBug != nil) + if (pBug != NULL) *pBug = kDiskImgVersionBug; } @@ -140,7 +140,7 @@ Global::GetVersion(long* pMajor, long* pMinor, long* pBug) /* * 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. @@ -164,7 +164,7 @@ Global::SetDebugMsgHandler(DebugMsgHandler handler) /*static*/ void 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() * call. I'm not sure what's zapping the pointer. diff --git a/diskimg/Gutenberg.cpp b/diskimg/Gutenberg.cpp index fdae3fd..e0e50da 100644 --- a/diskimg/Gutenberg.cpp +++ b/diskimg/Gutenberg.cpp @@ -324,8 +324,8 @@ DiskFSGutenberg::GetFileLengths(void) int tsCount = 0; unsigned short currentTrack, currentSector; - pFile = (A2FileGutenberg*) GetNextFile(nil); - while (pFile != nil) { + pFile = (A2FileGutenberg*) GetNextFile(NULL); + while (pFile != NULL) { DIError dierr; tsCount = 0; currentTrack = pFile->fTrack; @@ -404,7 +404,7 @@ A2FileGutenberg::A2FileGutenberg(DiskFS* pDiskFS) : A2File(pDiskFS) fLength = -1; fSparseLength = -1; - fpOpenFile = nil; + fpOpenFile = NULL; } /* @@ -485,7 +485,7 @@ A2FileGutenberg::Open(A2FileDescr** ppOpenFile, bool readOnly, bool rsrcFork /*=false*/) { DIError dierr = kDIErrNone; - A2FDGutenberg* pOpenFile = nil; + A2FDGutenberg* pOpenFile = NULL; if (!readOnly) { if (fpDiskFS->GetDiskImg()->GetReadOnly()) @@ -494,7 +494,7 @@ A2FileGutenberg::Open(A2FileDescr** ppOpenFile, bool readOnly, return kDIErrBadDiskImage; } - if (fpOpenFile != nil) { + if (fpOpenFile != NULL) { dierr = kDIErrAlreadyOpen; goto bail; } @@ -510,7 +510,7 @@ A2FileGutenberg::Open(A2FileDescr** ppOpenFile, bool readOnly, fpOpenFile = pOpenFile; // add it to our single-member "open file set" *ppOpenFile = pOpenFile; - pOpenFile = nil; + pOpenFile = NULL; bail: delete pOpenFile; diff --git a/diskimg/HFS.cpp b/diskimg/HFS.cpp index da91f7d..b464d17 100644 --- a/diskimg/HFS.cpp +++ b/diskimg/HFS.cpp @@ -226,11 +226,11 @@ DiskFSHFS::LoadVolHeader(void) time_t when; int isDst; - when = time(nil); + when = time(NULL); isDst = localtime(&when)->tm_isdst; ptm = gmtime(&when); - if (ptm != nil) { + if (ptm != NULL) { tmWhen = *ptm; // make a copy -- static buffers in time functions tmWhen.tm_isdst = isDst; @@ -289,7 +289,7 @@ DiskFSHFS::LoadVolHeader(void) */ A2FileHFS* pFile; pFile = new A2FileHFS(this); - if (pFile == nil) { + if (pFile == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -410,14 +410,14 @@ DiskFSHFS::Initialize(InitMode initMode) */ fHfsVol = hfs_callback_open(LibHFSCB, this, /*HFS_OPT_NOCACHE |*/ (fpImg->GetReadOnly() ? HFS_MODE_RDONLY : HFS_MODE_RDWR)); - if (fHfsVol == nil) { + if (fHfsVol == NULL) { WMSG1("ERROR: hfs_opencallback failed: %s\n", hfs_error); return kDIErrGeneric; } /* volume dir is guaranteed to come first; if not, we need a lookup func */ A2FileHFS* pVolumeDir; - pVolumeDir = (A2FileHFS*) GetNextFile(nil); + pVolumeDir = (A2FileHFS*) GetNextFile(NULL); dierr = RecursiveDirAdd(pVolumeDir, ":", 0); if (dierr != kDIErrNone) @@ -449,7 +449,7 @@ DiskFSHFS::LibHFSCB(void* vThis, int op, unsigned long arg1, void* arg2) DiskFSHFS* pThis = (DiskFSHFS*) vThis; unsigned long result = (unsigned long) -1; - assert(pThis != nil); + assert(pThis != NULL); switch (op) { case HFS_CB_VOLSIZE: @@ -458,7 +458,7 @@ DiskFSHFS::LibHFSCB(void* vThis, int op, unsigned long arg1, void* arg2) break; case HFS_CB_READ: // arg1=block, arg2=buffer //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); if (err == kDIErrNone) result = 0; @@ -469,7 +469,7 @@ DiskFSHFS::LibHFSCB(void* vThis, int op, unsigned long arg1, void* arg2) break; case HFS_CB_WRITE: 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); if (err == kDIErrNone) result = 0; @@ -500,7 +500,7 @@ DIError DiskFSHFS::GetFreeSpaceCount(long* pTotalUnits, long* pFreeUnits, int* pUnitSize) const { - assert(fHfsVol != nil); + assert(fHfsVol != NULL); hfsvolent volEnt; if (hfs_vstat(fHfsVol, &volEnt) != 0) @@ -522,7 +522,7 @@ DiskFSHFS::RecursiveDirAdd(A2File* pParent, const char* basePath, int depth) DIError dierr = kDIErrNone; hfsdir* dir; hfsdirent dirEntry; - char* pathBuf = nil; + char* pathBuf = NULL; int nameOffset; /* 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); dir = hfs_opendir(fHfsVol, basePath); - if (dir == nil) { + if (dir == NULL) { printf(" HFS unable to open dir '%s'\n", basePath); WMSG1(" HFS unable to open dir '%s'\n", basePath); dierr = kDIErrGeneric; @@ -545,7 +545,7 @@ DiskFSHFS::RecursiveDirAdd(A2File* pParent, const char* basePath, int depth) nameOffset = strlen(basePath) +1; pathBuf = new char[nameOffset + A2FileHFS::kMaxFileName +1]; - if (pathBuf == nil) { + if (pathBuf == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -564,7 +564,7 @@ DiskFSHFS::RecursiveDirAdd(A2File* pParent, const char* basePath, int depth) pFile->SetParent(pParent); AddFileToList(pFile); - if (!fpImg->UpdateScanProgress(nil)) { + if (!fpImg->UpdateScanProgress(NULL)) { WMSG0(" HFS cancelled by user\n"); dierr = kDIErrCancelled; goto bail; @@ -644,7 +644,7 @@ void A2FileHFS::InitEntry(const hfsdirent* dirEntry) /*static*/ bool DiskFSHFS::IsValidVolumeName(const char* name) { - if (name == nil) + if (name == NULL) return false; int len = strlen(name); @@ -666,7 +666,7 @@ DiskFSHFS::IsValidVolumeName(const char* name) /*static*/ bool DiskFSHFS::IsValidFileName(const char* name) { - if (name == nil) + if (name == NULL) return false; int len = strlen(name); @@ -694,7 +694,7 @@ DiskFSHFS::Format(DiskImg* pDiskImg, const char* volName) return kDIErrInvalidArg; /* set fpImg so calls that rely on it will work; we un-set it later */ - assert(fpImg == nil); + assert(fpImg == NULL); SetDiskImg(pDiskImg); /* need this for callback function */ @@ -708,7 +708,7 @@ DiskFSHFS::Format(DiskImg* pDiskImg, const char* volName) // 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; } @@ -726,19 +726,19 @@ DiskFSHFS::NormalizePath(const char* path, char fssep, char* normalizedBuf, int* pNormalizedBufLen) { DIError dierr = kDIErrNone; - char* normalizedPath = nil; + char* normalizedPath = NULL; int len; - assert(pNormalizedBufLen != nil); - assert(normalizedBuf != nil || *pNormalizedBufLen == 0); + assert(pNormalizedBufLen != NULL); + assert(normalizedBuf != NULL || *pNormalizedBufLen == 0); dierr = DoNormalizePath(path, fssep, &normalizedPath); if (dierr != kDIErrNone) goto bail; - assert(normalizedPath != nil); + assert(normalizedPath != NULL); len = strlen(normalizedPath); - if (normalizedBuf == nil || *pNormalizedBufLen <= len) { + if (normalizedBuf == NULL || *pNormalizedBufLen <= len) { /* too short */ dierr = kDIErrDataOverrun; } else { @@ -765,18 +765,18 @@ DiskFSHFS::DoNormalizePath(const char* path, char fssep, char** pNormalizedPath) { DIError dierr = kDIErrNone; - char* workBuf = nil; - char* partBuf = nil; - char* outputBuf = nil; + char* workBuf = NULL; + char* partBuf = NULL; + char* outputBuf = NULL; char* start; char* end; char* outPtr; - assert(path != nil); + assert(path != NULL); workBuf = new char[strlen(path)+1]; partBuf = new char[strlen(path)+1 +1]; // need +1 for prepending letter outputBuf = new char[strlen(path) * 2]; - if (workBuf == nil || partBuf == nil || outputBuf == nil) { + if (workBuf == NULL || partBuf == NULL || outputBuf == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -791,10 +791,10 @@ DiskFSHFS::DoNormalizePath(const char* path, char fssep, int partIdx; if (fssep == '\0') { - end = nil; + end = NULL; } else { end = strchr(start, fssep); - if (end != nil) + if (end != NULL) *end = '\0'; } partIdx = 0; @@ -824,7 +824,7 @@ DiskFSHFS::DoNormalizePath(const char* path, char fssep, if (partIdx > A2FileHFS::kMaxFileName) { const char* pDot = strrchr(partBuf, '.'); //int DEBUGDOTLEN = pDot - partBuf; - if (pDot != nil && partIdx - (pDot-partBuf) <= kMaxExtensionLen) { + if (pDot != NULL && partIdx - (pDot-partBuf) <= kMaxExtensionLen) { int dotLen = partIdx - (pDot-partBuf); memmove(partBuf + (A2FileProDOS::kMaxFileName - dotLen), pDot, dotLen); // don't use memcpy, move might overlap @@ -844,7 +844,7 @@ DiskFSHFS::DoNormalizePath(const char* path, char fssep, /* * Continue with next segment. */ - if (end == nil) + if (end == NULL) break; start = end+1; } @@ -856,7 +856,7 @@ DiskFSHFS::DoNormalizePath(const char* path, char fssep, assert(*outputBuf != '\0'); *pNormalizedPath = outputBuf; - outputBuf = nil; + outputBuf = NULL; bail: delete[] workBuf; @@ -915,13 +915,13 @@ DiskFSHFS::MakeFileNameUnique(const char* pathName, char** pUniqueName) char* uniqueName; char* fileName; // points inside uniqueName - assert(pathName != nil); + assert(pathName != NULL); assert(pathName[0] == A2FileHFS::kFssep); /* see if it exists */ pFile = GetFileByName(pathName+1); - if (pFile == nil) { - *pUniqueName = nil; + if (pFile == NULL) { + *pUniqueName = NULL; return kDIErrNone; } @@ -930,7 +930,7 @@ DiskFSHFS::MakeFileNameUnique(const char* pathName, char** pUniqueName) strcpy(uniqueName, pathName); fileName = strrchr(uniqueName, A2FileHFS::kFssep); - assert(fileName != nil); + assert(fileName != NULL); fileName++; int nameLen = strlen(fileName); @@ -946,7 +946,7 @@ DiskFSHFS::MakeFileNameUnique(const char* pathName, char** pUniqueName) * do everything we need. */ const char* cp = strrchr(fileName, '.'); - if (cp != nil) { + if (cp != NULL) { int tmpOffset = cp - fileName; if (tmpOffset > 0 && nameLen - tmpOffset <= kMaxExtensionLen) { WMSG1(" HFS (keeping extension '%s')\n", cp); @@ -976,7 +976,7 @@ DiskFSHFS::MakeFileNameUnique(const char* pathName, char** pUniqueName) memcpy(fileName + copyOffset, digitBuf, digitLen); if (dotLen != 0) 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); @@ -998,22 +998,22 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) { DIError dierr = kDIErrNone; char typeStr[5], creatorStr[5]; - char* normalizedPath = nil; - char* basePath = nil; - char* fileName = nil; - char* fullPath = nil; - A2FileHFS* pSubdir = nil; - A2FileHFS* pNewFile = nil; - hfsfile* pHfsFile = nil; + char* normalizedPath = NULL; + char* basePath = NULL; + char* fileName = NULL; + char* fullPath = NULL; + A2FileHFS* pSubdir = NULL; + A2FileHFS* pNewFile = NULL; + hfsfile* pHfsFile = NULL; const bool createUnique = (GetParameter(kParm_CreateUnique) != 0); - assert(fHfsVol != nil); + assert(fHfsVol != NULL); if (fpImg->GetReadOnly()) return kDIErrAccessDenied; - assert(pParms != nil); - assert(pParms->pathName != nil); + assert(pParms != NULL); + assert(pParms->pathName != NULL); assert(pParms->storageType == A2FileProDOS::kStorageSeedling || pParms->storageType == A2FileProDOS::kStorageExtended || 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 * original characters, not the sanitized-for-display versions. */ - assert(pParms->pathName != nil); + assert(pParms->pathName != NULL); dierr = DoNormalizePath(pParms->pathName, pParms->fssep, &normalizedPath); if (dierr != kDIErrNone) goto bail; - assert(normalizedPath != nil); + assert(normalizedPath != NULL); /* * 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; strcpy(fullPath+1, normalizedPath); delete[] normalizedPath; - normalizedPath = nil; + normalizedPath = NULL; /* * 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); if (dierr != kDIErrNone) goto bail; - if (uniquePath != nil) { + if (uniquePath != NULL) { delete[] fullPath; fullPath = uniquePath; } @@ -1077,9 +1077,9 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) */ char* cp; cp = strrchr(fullPath, A2FileHFS::kFssep); - assert(cp != nil); + assert(cp != NULL); if (cp == fullPath) { - assert(basePath == nil); + assert(basePath == NULL); fileName = new char[strlen(fullPath) +1]; strcpy(fileName, fullPath); } else { @@ -1094,12 +1094,12 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) 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. */ - if (basePath != nil) { + if (basePath != NULL) { WMSG2(" HFS Creating '%s' in '%s'\n", fileName, basePath); /* * 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 ':'. */ pSubdir = (A2FileHFS*)GetFileByName(basePath+1, CompareMacFileNames); - if (pSubdir == nil) { + if (pSubdir == NULL) { WMSG1(" HFS Creating subdir '%s'\n", basePath); A2File* pNewSub; CreateParms newDirParms; @@ -1117,11 +1117,11 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) newDirParms.fileType = 0; newDirParms.auxType = 0; newDirParms.access = 0; - newDirParms.createWhen = newDirParms.modWhen = time(nil); + newDirParms.createWhen = newDirParms.modWhen = time(NULL); dierr = this->CreateFile(&newDirParms, &pNewSub); if (dierr != kDIErrNone) goto bail; - assert(pNewSub != nil); + assert(pNewSub != NULL); pSubdir = (A2FileHFS*) pNewSub; } @@ -1161,7 +1161,7 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) basePathLen -= fixedLen+1; pBaseDir = (A2FileHFS*) pBaseDir->GetParent(); - assert(pBaseDir != nil); + assert(pBaseDir != NULL); } // check the math; we should be left with the leading ':' if (pSubdir->IsVolumeDirectory()) @@ -1172,11 +1172,11 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) /* open the volume directory */ WMSG1(" HFS Creating '%s' in volume dir\n", fileName); /* volume dir must be first in the list */ - pSubdir = (A2FileHFS*) GetNextFile(nil); - assert(pSubdir != nil); + pSubdir = (A2FileHFS*) GetNextFile(NULL); + assert(pSubdir != NULL); assert(pSubdir->IsVolumeDirectory()); } - if (pSubdir == nil) { + if (pSubdir == NULL) { WMSG1(" HFS Unable to open subdir '%s'\n", basePath); dierr = kDIErrFileNotFound; goto bail; @@ -1208,7 +1208,7 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) } else { /* create, and open, the file */ pHfsFile = hfs_create(fHfsVol, fullPath, typeStr, creatorStr); - if (pHfsFile == nil) { + if (pHfsFile == NULL) { WMSG1(" HFS create failed: %s\n", hfs_error); dierr = kDIErrGeneric; goto bail; @@ -1233,7 +1233,7 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) (void) hfs_fsetattr(pHfsFile, &dirEnt); (void) hfs_close(pHfsFile); - pHfsFile = nil; + pHfsFile = NULL; } /* @@ -1243,7 +1243,7 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) */ pNewFile = new A2FileHFS(this); pNewFile->InitEntry(&dirEnt); - pNewFile->SetPathName(basePath == nil ? "" : basePath, pNewFile->fFileName); + pNewFile->SetPathName(basePath == NULL ? "" : basePath, pNewFile->fFileName); pNewFile->SetParent(pSubdir); /* @@ -1271,7 +1271,7 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) pPrevFile = pLastSubdirFile = pSubdir; pNextFile = GetNextFile(pPrevFile); - while (pNextFile != nil) { + while (pNextFile != NULL) { if (pNextFile->GetParent() == pNewFile->GetParent()) { /* in same subdir, compare names */ if (CompareMacFileNames(pNextFile->GetPathName(), @@ -1299,7 +1299,7 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) //DumpFileList(); *ppNewFile = pNewFile; - pNewFile = nil; + pNewFile = NULL; bail: delete pNewFile; @@ -1321,7 +1321,7 @@ DIError DiskFSHFS::DeleteFile(A2File* pGenericFile) { DIError dierr = kDIErrNone; - char* pathName = nil; + char* pathName = NULL; if (fpImg->GetReadOnly()) return kDIErrAccessDenied; @@ -1378,10 +1378,10 @@ DiskFSHFS::RenameFile(A2File* pGenericFile, const char* newName) { DIError dierr = kDIErrNone; A2FileHFS* pFile = (A2FileHFS*) pGenericFile; - char* colonOldName = nil; - char* colonNewName = nil; + char* colonOldName = NULL; + char* colonNewName = NULL; - if (pFile == nil || newName == nil) + if (pFile == NULL || newName == NULL) return kDIErrInvalidArg; if (!IsValidFileName(newName)) return kDIErrInvalidArg; @@ -1396,7 +1396,7 @@ DiskFSHFS::RenameFile(A2File* pGenericFile, const char* newName) colonOldName = pFile->GetLibHFSPathName(); // adds ':' to start of string lastColon = strrchr(colonOldName, A2FileHFS::kFssep); - assert(lastColon != nil); + assert(lastColon != NULL); if (lastColon == colonOldName) { /* in root dir */ colonNewName = new char[1 + strlen(newName) +1]; @@ -1448,7 +1448,7 @@ DiskFSHFS::RenameFile(A2File* pGenericFile, const char* newName) if (pFile->IsDirectory()) { /* do all files that come after us */ pCur = pFile; - while (pCur != nil) { + while (pCur != NULL) { RegeneratePathName((A2FileHFS*) pCur); pCur = GetNextFile(pCur); } @@ -1478,7 +1478,7 @@ DIError DiskFSHFS::RegeneratePathName(A2FileHFS* pFile) { A2FileHFS* pParent; - char* buf = nil; + char* buf = NULL; int len; /* nothing to do here */ @@ -1496,7 +1496,7 @@ DiskFSHFS::RegeneratePathName(A2FileHFS* pFile) } buf = new char[len+1]; - if (buf == nil) + if (buf == NULL) return kDIErrMalloc; /* generate the new path name */ @@ -1537,8 +1537,8 @@ DiskFSHFS::RenameVolume(const char* newName) { DIError dierr = kDIErrNone; A2FileHFS* pFile; - char* oldNameColon = nil; - char* newNameColon = nil; + char* oldNameColon = NULL; + char* newNameColon = NULL; if (!IsValidVolumeName(newName)) return kDIErrInvalidArg; @@ -1546,7 +1546,7 @@ DiskFSHFS::RenameVolume(const char* newName) return kDIErrAccessDenied; /* get file list entry for volume name */ - pFile = (A2FileHFS*) GetNextFile(nil); + pFile = (A2FileHFS*) GetNextFile(NULL); assert(strcmp(pFile->GetFileName(), fVolumeName) == 0); oldNameColon = new char[strlen(fVolumeName)+2]; @@ -1590,7 +1590,7 @@ DiskFSHFS::SetFileInfo(A2File* pGenericFile, long fileType, long auxType, if (fpImg->GetReadOnly()) return kDIErrAccessDenied; - if (pFile == nil) + if (pFile == NULL) return kDIErrInvalidArg; if (pFile->IsDirectory() || pFile->IsVolumeDirectory()) 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 * 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 A2FileHFS::SetPathName(const char* basePath, const char* fileName) { - assert(basePath != nil && fileName != nil); - if (fPathName != nil) + assert(basePath != NULL && fileName != NULL); + if (fPathName != NULL) delete[] fPathName; // strip leading ':' (but treat ":" specially for volume dir entry) @@ -1845,11 +1845,11 @@ A2FileHFS::Open(A2FileDescr** ppOpenFile, bool readOnly, bool rsrcFork /*=false*/) { DIError dierr = kDIErrNone; - A2FDHFS* pOpenFile = nil; + A2FDHFS* pOpenFile = NULL; hfsfile* pHfsFile; - char* nameBuf = nil; + char* nameBuf = NULL; - if (fpOpenFile != nil) + if (fpOpenFile != NULL) return kDIErrAlreadyOpen; //if (rsrcFork && fRsrcLength < 0) // return kDIErrForkNotFound; @@ -1899,7 +1899,7 @@ A2FDHFS::Read(void* buf, size_t len, size_t* pActual) if (result < 0) return kDIErrReadFailed; - if (pActual != nil) { + if (pActual != NULL) { *pActual = (size_t) result; } else if (result != (long) len) { // 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) return kDIErrWriteFailed; - if (pActual != nil) { + if (pActual != NULL) { *pActual = (size_t) result; } else if (result != (long) len) { // short write, can't report it, return error @@ -2030,7 +2030,7 @@ A2FDHFS::Close(void) } hfs_close(fHfsFile); - fHfsFile = nil; + fHfsFile = NULL; /* flush changes */ if (fModified) { @@ -2146,7 +2146,7 @@ DiskFSHFS::CreateFakeFile(void) time_t when = (time_t) (fModifiedDateTime - kDateTimeOffset - fLocalTimeOffset); timeStr = ctime(&when); - if (timeStr == nil) { + if (timeStr == NULL) { WMSG2("Invalid date %ld (orig=%ld)\n", when, fModifiedDateTime); strcpy(dateBuf, ""); } else @@ -2198,15 +2198,15 @@ DIError A2FileHFS::Open(A2FileDescr** ppOpenFile, bool readOnly, bool rsrcFork /*=false*/) { - A2FDHFS* pOpenFile = nil; + A2FDHFS* pOpenFile = NULL; - if (fpOpenFile != nil) + if (fpOpenFile != NULL) return kDIErrAlreadyOpen; if (rsrcFork && fRsrcLength < 0) return kDIErrForkNotFound; assert(readOnly == true); - pOpenFile = new A2FDHFS(this, nil); + pOpenFile = new A2FDHFS(this, NULL); fpOpenFile = 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 */ if (fOffset + (long)len > pFile->fDataLength) { - if (pActual == nil) + if (pActual == NULL) return kDIErrDataUnderrun; len = (size_t) (pFile->fDataLength - fOffset); } - if (pActual != nil) + if (pActual != NULL) *pActual = len; memcpy(buf, pFile->GetFakeFileBuf(), len); diff --git a/diskimg/ImageWrapper.cpp b/diskimg/ImageWrapper.cpp index c2d77bb..0e35b29 100644 --- a/diskimg/ImageWrapper.cpp +++ b/diskimg/ImageWrapper.cpp @@ -234,11 +234,11 @@ WrapperNuFX::OpenNuFX(const char* pathName, NuArchive** ppArchive, NuThreadIdx* pThreadIdx, long* pLength, bool readOnly) { NuError nerr = kNuErrNone; - NuArchive* pArchive = nil; + NuArchive* pArchive = NULL; NuRecordIdx recordIdx; NuAttr attr; const NuRecord* pRecord; - const NuThread* pThread = nil; + const NuThread* pThread = NULL; int idx; WMSG1("Opening file '%s' to test for NuFX\n", pathName); @@ -256,7 +256,7 @@ WrapperNuFX::OpenNuFX(const char* pathName, NuArchive** ppArchive, char* tmpPath; tmpPath = GenTempPath(pathName); - if (tmpPath == nil) { + if (tmpPath == NULL) { nerr = kNuErrInternal; goto bail; } @@ -311,7 +311,7 @@ WrapperNuFX::OpenNuFX(const char* pathName, NuArchive** ppArchive, nerr = kNuErrGeneric; goto file_archive; } - assert(pThread != nil); + assert(pThread != NULL); *pThreadIdx = pThread->threadIdx; /* @@ -329,10 +329,10 @@ WrapperNuFX::OpenNuFX(const char* pathName, NuArchive** ppArchive, */ assert(nerr == kNuErrNone); *ppArchive = pArchive; - pArchive = nil; + pArchive = NULL; bail: - if (pArchive != nil) + if (pArchive != NULL) NuClose(pArchive); if (nerr == kNuErrNone) return kDIErrNone; @@ -342,7 +342,7 @@ bail: return kDIErrGeneric; file_archive: - if (pArchive != nil) + if (pArchive != NULL) NuClose(pArchive); return kDIErrFileArchive; } @@ -367,12 +367,12 @@ WrapperNuFX::GetNuFXDiskImage(NuArchive* pArchive, NuThreadIdx threadIdx, long length, char** ppData) { NuError err; - NuDataSink* pDataSink = nil; - unsigned char* buf = nil; + NuDataSink* pDataSink = NULL; + unsigned char* buf = NULL; assert(length > 0); buf = new unsigned char[length]; - if (buf == nil) + if (buf == NULL) return kDIErrMalloc; /* @@ -421,13 +421,13 @@ bail: WrapperNuFX::Test(GenericFD* pGFD, di_off_t wrappedLength) { DIError dierr; - NuArchive* pArchive = nil; + NuArchive* pArchive = NULL; NuThreadIdx threadIdx; long length; const char* imagePath; imagePath = pGFD->GetPathName(); - if (imagePath == nil) { + if (imagePath == NULL) { WMSG0("Can't test NuFX on non-file\n"); return kDIErrNotSupported; } @@ -437,7 +437,7 @@ WrapperNuFX::Test(GenericFD* pGFD, di_off_t wrappedLength) return dierr; /* success; throw away state in case they don't like us anyway */ - assert(pArchive != nil); + assert(pArchive != NULL); NuClose(pArchive); return kDIErrNone; @@ -454,13 +454,13 @@ WrapperNuFX::Prep(GenericFD* pGFD, di_off_t wrappedLength, bool readOnly, { DIError dierr = kDIErrNone; NuThreadIdx threadIdx; - GFDBuffer* pNewGFD = nil; - char* buf = nil; + GFDBuffer* pNewGFD = NULL; + char* buf = NULL; long length = -1; const char* imagePath; imagePath = pGFD->GetPathName(); - if (imagePath == nil) { + if (imagePath == NULL) { assert(false); // should've been caught in Test return kDIErrNotSupported; } @@ -477,7 +477,7 @@ WrapperNuFX::Prep(GenericFD* pGFD, di_off_t wrappedLength, bool readOnly, dierr = pNewGFD->Open(buf, length, true, false, readOnly); if (dierr != kDIErrNone) goto bail; - buf = nil; // now owned by pNewGFD; + buf = NULL; // now owned by pNewGFD; /* * Success! @@ -494,7 +494,7 @@ WrapperNuFX::Prep(GenericFD* pGFD, di_off_t wrappedLength, bool readOnly, bail: if (dierr != kDIErrNone) { NuClose(fpArchive); - fpArchive = nil; + fpArchive = NULL; delete pNewGFD; delete buf; } @@ -517,12 +517,12 @@ WrapperNuFX::GenTempPath(const char* path) static const char* kTmpTemplate = "DItmp_XXXXXX"; char* tmpPath; - assert(path != nil); + assert(path != NULL); assert(strlen(path) > 0); tmpPath = new char[strlen(path) + 32]; - if (tmpPath == nil) - return nil; + if (tmpPath == NULL) + return NULL; strcpy(tmpPath, path); @@ -562,8 +562,8 @@ WrapperNuFX::Create(di_off_t length, DiskImg::PhysicalFormat physical, DIError dierr = kDIErrNone; NuArchive* pArchive; const char* imagePath; - char* tmpPath = nil; - unsigned char* buf = nil; + char* tmpPath = NULL; + unsigned char* buf = NULL; NuError nerr; /* @@ -571,14 +571,14 @@ WrapperNuFX::Create(di_off_t length, DiskImg::PhysicalFormat physical, * makes pWrapperGFD invalid, but such is life with NufxLib.) */ imagePath = pWrapperGFD->GetPathName(); - if (imagePath == nil) { + if (imagePath == NULL) { assert(false); // must not have an outer wrapper dierr = kDIErrNotSupported; goto bail; } pWrapperGFD->Close(); // don't hold the file open tmpPath = GenTempPath(imagePath); - if (tmpPath == nil) { + if (tmpPath == NULL) { dierr = kDIErrInternal; goto bail; } @@ -595,7 +595,7 @@ WrapperNuFX::Create(di_off_t length, DiskImg::PhysicalFormat physical, */ assert(length > 0); buf = new unsigned char[(int) length]; - if (buf == nil) { + if (buf == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -608,7 +608,7 @@ WrapperNuFX::Create(di_off_t length, DiskImg::PhysicalFormat physical, goto bail; } *pDataFD = pNewGFD; - buf = nil; // now owned by pNewGFD; + buf = NULL; // now owned by pNewGFD; /* * Success! Set misc stuff. @@ -658,7 +658,7 @@ WrapperNuFX::Flush(GenericFD* pWrapperGFD, GenericFD* pDataGFD, NuFileDetails fileDetails; NuRecordIdx recordIdx; NuThreadIdx threadIdx; - NuDataSource* pDataSource = nil; + NuDataSource* pDataSource = NULL; if (fThreadIdx != 0) { /* @@ -694,7 +694,7 @@ WrapperNuFX::Flush(GenericFD* pWrapperGFD, GenericFD* pDataGFD, */ memset(&fileDetails, 0, sizeof(fileDetails)); fileDetails.threadID = kNuThreadIDDiskImage; - if (fStorageName != nil) + if (fStorageName != NULL) fileDetails.storageName = fStorageName; else fileDetails.storageName = "NEW.DISK"; @@ -705,7 +705,7 @@ WrapperNuFX::Flush(GenericFD* pWrapperGFD, GenericFD* pDataGFD, fileDetails.access = kNuAccessUnlocked; time_t now; - now = time(nil); + now = time(NULL); UNIXTimeToDateTime(&now, &fileDetails.archiveWhen); UNIXTimeToDateTime(&now, &fileDetails.modWhen); UNIXTimeToDateTime(&now, &fileDetails.createWhen); @@ -728,7 +728,7 @@ WrapperNuFX::Flush(GenericFD* pWrapperGFD, GenericFD* pDataGFD, */ nerr = NuCreateDataSourceForBuffer(kNuThreadFormatUncompressed, 0, (const unsigned char*) ((GFDBuffer*) pDataGFD)->GetBuffer(), - 0, (long) dataLen, nil, &pDataSource); + 0, (long) dataLen, NULL, &pDataSource); if (nerr != kNuErrNone) { WMSG1(" NuFX unable to create NufxLib data source (nerr=%d)", nerr); goto bail; @@ -743,7 +743,7 @@ WrapperNuFX::Flush(GenericFD* pWrapperGFD, GenericFD* pDataGFD, WMSG1(" NuFX AddThread failed (nerr=%d)\n", nerr); goto bail; } - pDataSource = nil; // now owned by NufxLib + pDataSource = NULL; // now owned by NufxLib WMSG2(" NuFX added thread %ld in record %ld, flushing changes\n", threadIdx, recordIdx); @@ -775,8 +775,8 @@ WrapperNuFX::UNIXTimeToDateTime(const time_t* pWhen, NuDateTime *pDateTime) { struct tm* ptm; - assert(pWhen != nil); - assert(pDateTime != nil); + assert(pWhen != NULL); + assert(pDateTime != NULL); ptm = localtime(pWhen); pDateTime->second = ptm->tm_sec; @@ -806,7 +806,7 @@ WrapperNuFX::UNIXTimeToDateTime(const time_t* pWhen, NuDateTime *pDateTime) WrapperDDD::Test(GenericFD* pGFD, di_off_t wrappedLength) { DIError dierr; - GenericFD* pNewGFD = nil; + GenericFD* pNewGFD = NULL; WMSG0("Testing for DDD\n"); pGFD->Rewind(); @@ -815,7 +815,7 @@ WrapperDDD::Test(GenericFD* pGFD, di_off_t wrappedLength) if (dierr != kDIErrNone) return dierr; - dierr = Unpack(pGFD, &pNewGFD, nil); + dierr = Unpack(pGFD, &pNewGFD, NULL); delete pNewGFD; return dierr; } @@ -913,7 +913,7 @@ WrapperDDD::Prep(GenericFD* pGFD, di_off_t wrappedLength, bool readOnly, DIError dierr; WMSG0("Prepping for DDD\n"); - assert(*ppNewGFD == nil); + assert(*ppNewGFD == NULL); dierr = Unpack(pGFD, ppNewGFD, pDiskVolNum); if (dierr != kDIErrNone) @@ -934,36 +934,36 @@ WrapperDDD::Prep(GenericFD* pGFD, di_off_t wrappedLength, bool readOnly, WrapperDDD::Unpack(GenericFD* pGFD, GenericFD** ppNewGFD, short* pDiskVolNum) { DIError dierr; - GFDBuffer* pNewGFD = nil; - unsigned char* buf = nil; + GFDBuffer* pNewGFD = NULL; + unsigned char* buf = NULL; short diskVolNum; pGFD->Rewind(); buf = new unsigned char[kNumTracks * kTrackLen]; - if (buf == nil) { + if (buf == NULL) { dierr = kDIErrMalloc; goto bail; } pNewGFD = new GFDBuffer; - if (pNewGFD == nil) { + if (pNewGFD == NULL) { dierr = kDIErrMalloc; goto bail; } dierr = pNewGFD->Open(buf, kNumTracks * kTrackLen, true, false, false); if (dierr != kDIErrNone) goto bail; - buf = nil; // now owned by pNewGFD; + buf = NULL; // now owned by pNewGFD; dierr = UnpackDisk(pGFD, pNewGFD, &diskVolNum); if (dierr != kDIErrNone) goto bail; - if (pDiskVolNum != nil) + if (pDiskVolNum != NULL) *pDiskVolNum = diskVolNum; *ppNewGFD = pNewGFD; - pNewGFD = nil; // now owned by caller + pNewGFD = NULL; // now owned by caller bail: delete[] buf; @@ -985,13 +985,13 @@ WrapperDDD::Create(di_off_t length, DiskImg::PhysicalFormat physical, assert(order == DiskImg::kSectorOrderDOS); DIError dierr; - unsigned char* buf = nil; + unsigned char* buf = NULL; /* * Create a blank chunk of memory for the image. */ buf = new unsigned char[(int) length]; - if (buf == nil) { + if (buf == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -1004,7 +1004,7 @@ WrapperDDD::Create(di_off_t length, DiskImg::PhysicalFormat physical, goto bail; } *pDataFD = pNewGFD; - buf = nil; // now owned by pNewGFD; + buf = NULL; // now owned by pNewGFD; // can't set *pWrappedLength yet @@ -1362,10 +1362,10 @@ WrapperDiskCopy42::Flush(GenericFD* pWrapperGFD, GenericFD* pDataGFD, dierr = pWrapperGFD->Seek(kDC42DataOffset + 800*1024, kSeekSet); char* tmpBuf; tmpBuf = new char[kDC42FakeTagLen]; - if (tmpBuf == nil) + if (tmpBuf == NULL) return kDIErrMalloc; memset(tmpBuf, 0, kDC42FakeTagLen); - dierr = pWrapperGFD->Write(tmpBuf, kDC42FakeTagLen, nil); + dierr = pWrapperGFD->Write(tmpBuf, kDC42FakeTagLen, NULL); delete[] tmpBuf; if (dierr != kDIErrNone) goto bail; @@ -1663,19 +1663,19 @@ DIError WrapperTrackStar::Unpack(GenericFD* pGFD, GenericFD** ppNewGFD) { DIError dierr; - GFDBuffer* pNewGFD = nil; - unsigned char* buf = nil; + GFDBuffer* pNewGFD = NULL; + unsigned char* buf = NULL; pGFD->Rewind(); buf = new unsigned char[kTrackStarNumTracks * kTrackAllocSize]; - if (buf == nil) { + if (buf == NULL) { dierr = kDIErrMalloc; goto bail; } pNewGFD = new GFDBuffer; - if (pNewGFD == nil) { + if (pNewGFD == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -1683,14 +1683,14 @@ WrapperTrackStar::Unpack(GenericFD* pGFD, GenericFD** ppNewGFD) true, false, false); if (dierr != kDIErrNone) goto bail; - buf = nil; // now owned by pNewGFD; + buf = NULL; // now owned by pNewGFD; dierr = UnpackDisk(pGFD, pNewGFD); if (dierr != kDIErrNone) goto bail; *ppNewGFD = pNewGFD; - pNewGFD = nil; // now owned by caller + pNewGFD = NULL; // now owned by caller bail: delete[] buf; @@ -1779,7 +1779,7 @@ WrapperTrackStar::Create(di_off_t length, DiskImg::PhysicalFormat physical, assert(order == DiskImg::kSectorOrderPhysical); DIError dierr; - unsigned char* buf = nil; + unsigned char* buf = NULL; int numTracks = (int) (length / kTrackLenTrackStar525); int i; @@ -1799,7 +1799,7 @@ WrapperTrackStar::Create(di_off_t length, DiskImg::PhysicalFormat physical, * Create a blank chunk of memory for the image. */ buf = new unsigned char[(int) length]; - if (buf == nil) { + if (buf == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -1812,7 +1812,7 @@ WrapperTrackStar::Create(di_off_t length, DiskImg::PhysicalFormat physical, goto bail; } *pDataFD = pNewGFD; - buf = nil; // now owned by pNewGFD; + buf = NULL; // now owned by pNewGFD; // can't set *pWrappedLength yet @@ -2118,8 +2118,8 @@ WrapperFDI::Unpack525(GenericFD* pGFD, GenericFD** ppNewGFD, int numCyls, int numHeads) { DIError dierr = kDIErrNone; - GFDBuffer* pNewGFD = nil; - unsigned char* buf = nil; + GFDBuffer* pNewGFD = NULL; + unsigned char* buf = NULL; int numTracks; numTracks = numCyls * numHeads; @@ -2129,13 +2129,13 @@ WrapperFDI::Unpack525(GenericFD* pGFD, GenericFD** ppNewGFD, int numCyls, pGFD->Rewind(); buf = new unsigned char[numTracks * kTrackAllocSize]; - if (buf == nil) { + if (buf == NULL) { dierr = kDIErrMalloc; goto bail; } pNewGFD = new GFDBuffer; - if (pNewGFD == nil) { + if (pNewGFD == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -2143,14 +2143,14 @@ WrapperFDI::Unpack525(GenericFD* pGFD, GenericFD** ppNewGFD, int numCyls, true, false, false); if (dierr != kDIErrNone) goto bail; - buf = nil; // now owned by pNewGFD; + buf = NULL; // now owned by pNewGFD; dierr = UnpackDisk525(pGFD, pNewGFD, numCyls, numHeads); if (dierr != kDIErrNone) goto bail; *ppNewGFD = pNewGFD; - pNewGFD = nil; // now owned by caller + pNewGFD = NULL; // now owned by caller bail: delete[] buf; @@ -2166,29 +2166,29 @@ WrapperFDI::Unpack35(GenericFD* pGFD, GenericFD** ppNewGFD, int numCyls, int numHeads, LinearBitmap** ppBadBlockMap) { DIError dierr = kDIErrNone; - GFDBuffer* pNewGFD = nil; - unsigned char* buf = nil; + GFDBuffer* pNewGFD = NULL; + unsigned char* buf = NULL; pGFD->Rewind(); buf = new unsigned char[800 * 1024]; - if (buf == nil) { + if (buf == NULL) { dierr = kDIErrMalloc; goto bail; } pNewGFD = new GFDBuffer; - if (pNewGFD == nil) { + if (pNewGFD == NULL) { dierr = kDIErrMalloc; goto bail; } dierr = pNewGFD->Open(buf, 800 * 1024, true, false, false); if (dierr != kDIErrNone) goto bail; - buf = nil; // now owned by pNewGFD; + buf = NULL; // now owned by pNewGFD; *ppBadBlockMap = new LinearBitmap(1600); - if (*ppBadBlockMap == nil) { + if (*ppBadBlockMap == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -2198,7 +2198,7 @@ WrapperFDI::Unpack35(GenericFD* pGFD, GenericFD** ppNewGFD, int numCyls, goto bail; *ppNewGFD = pNewGFD; - pNewGFD = nil; // now owned by caller + pNewGFD = NULL; // now owned by caller bail: delete[] buf; @@ -2217,7 +2217,7 @@ WrapperFDI::Create(di_off_t length, DiskImg::PhysicalFormat physical, { DIError dierr = kDIErrGeneric; // not yet #if 0 - unsigned char* buf = nil; + unsigned char* buf = NULL; int numTracks = (int) (length / kTrackLenTrackStar525); int i; @@ -2242,7 +2242,7 @@ WrapperFDI::Create(di_off_t length, DiskImg::PhysicalFormat physical, * Create a blank chunk of memory for the image. */ buf = new unsigned char[(int) length]; - if (buf == nil) { + if (buf == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -2255,7 +2255,7 @@ WrapperFDI::Create(di_off_t length, DiskImg::PhysicalFormat physical, goto bail; } *pDataFD = pNewGFD; - buf = nil; // now owned by pNewGFD; + buf = NULL; // now owned by pNewGFD; // can't set *pWrappedLength yet diff --git a/diskimg/MacPart.cpp b/diskimg/MacPart.cpp index 50c3be9..f265d3a 100644 --- a/diskimg/MacPart.cpp +++ b/diskimg/MacPart.cpp @@ -254,12 +254,12 @@ DIError DiskFSMacPart::OpenSubVolume(const PartitionMap* pMap) { DIError dierr = kDIErrNone; - DiskFS* pNewFS = nil; - DiskImg* pNewImg = nil; + DiskFS* pNewFS = NULL; + DiskImg* pNewImg = NULL; long startBlock, numBlocks; bool tweaked = false; - assert(pMap != nil); + assert(pMap != NULL); startBlock = pMap->pmPyPartStart; numBlocks = pMap->pmPartBlkCnt; @@ -283,7 +283,7 @@ DiskFSMacPart::OpenSubVolume(const PartitionMap* pMap) } pNewImg = new DiskImg; - if (pNewImg == nil) { + if (pNewImg == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -324,7 +324,7 @@ DiskFSMacPart::OpenSubVolume(const PartitionMap* pMap) WMSG2(" MacPartSub (%ld,%ld): unable to identify filesystem\n", startBlock, numBlocks); DiskFSUnknown* pUnknownFS = new DiskFSUnknown; - if (pUnknownFS == nil) { + if (pUnknownFS == NULL) { dierr = kDIErrInternal; goto bail; } @@ -336,7 +336,7 @@ DiskFSMacPart::OpenSubVolume(const PartitionMap* pMap) /* open a DiskFS for the sub-image */ WMSG2(" MacPartSub (%ld,%ld) analyze succeeded!\n", startBlock, numBlocks); pNewFS = pNewImg->OpenAppropriateDiskFS(true); - if (pNewFS == nil) { + if (pNewFS == NULL) { WMSG0(" MacPartSub: OpenAppropriateDiskFS failed\n"); dierr = kDIErrUnsupportedFSFmt; goto bail; @@ -368,8 +368,8 @@ DiskFSMacPart::OpenSubVolume(const PartitionMap* pMap) /* add it to the list */ AddSubVolumeToList(pNewImg, pNewFS); - pNewImg = nil; - pNewFS = nil; + pNewImg = NULL; + pNewFS = NULL; bail: delete pNewFS; @@ -458,8 +458,8 @@ DiskFSMacPart::FindSubVolumes(void) if (dierr != kDIErrNone) { if (dierr == kDIErrCancelled) goto bail; - DiskFS* pNewFS = nil; - DiskImg* pNewImg = nil; + DiskFS* pNewFS = NULL; + DiskImg* pNewImg = NULL; WMSG1(" MacPart failed opening sub-volume %d\n", i); dierr = CreatePlaceholder(map.pmPyPartStart, map.pmPartBlkCnt, (const char*)map.pmPartName, (const char*)map.pmParType, diff --git a/diskimg/MicroDrive.cpp b/diskimg/MicroDrive.cpp index d502344..2dd6992 100644 --- a/diskimg/MicroDrive.cpp +++ b/diskimg/MicroDrive.cpp @@ -182,8 +182,8 @@ DIError DiskFSMicroDrive::OpenSubVolume(long startBlock, long numBlocks) { DIError dierr = kDIErrNone; - DiskFS* pNewFS = nil; - DiskImg* pNewImg = nil; + DiskFS* pNewFS = NULL; + DiskImg* pNewImg = NULL; //bool tweaked = false; WMSG2("Adding %ld +%ld\n", startBlock, numBlocks); @@ -204,7 +204,7 @@ DiskFSMicroDrive::OpenSubVolume(long startBlock, long numBlocks) } pNewImg = new DiskImg; - if (pNewImg == nil) { + if (pNewImg == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -233,7 +233,7 @@ DiskFSMicroDrive::OpenSubVolume(long startBlock, long numBlocks) WMSG2(" MicroDriveSub (%ld,%ld): unable to identify filesystem\n", startBlock, numBlocks); DiskFSUnknown* pUnknownFS = new DiskFSUnknown; - if (pUnknownFS == nil) { + if (pUnknownFS == NULL) { dierr = kDIErrInternal; goto bail; } @@ -245,7 +245,7 @@ DiskFSMicroDrive::OpenSubVolume(long startBlock, long numBlocks) /* open a DiskFS for the sub-image */ WMSG2(" MicroDriveSub (%ld,%ld) analyze succeeded!\n", startBlock, numBlocks); pNewFS = pNewImg->OpenAppropriateDiskFS(true); - if (pNewFS == nil) { + if (pNewFS == NULL) { WMSG0(" MicroDriveSub: OpenAppropriateDiskFS failed\n"); dierr = kDIErrUnsupportedFSFmt; goto bail; @@ -277,8 +277,8 @@ DiskFSMicroDrive::OpenSubVolume(long startBlock, long numBlocks) /* add it to the list */ AddSubVolumeToList(pNewImg, pNewFS); - pNewImg = nil; - pNewFS = nil; + pNewImg = NULL; + pNewFS = NULL; bail: delete pNewFS; @@ -384,8 +384,8 @@ DiskFSMicroDrive::OpenVol(int idx, long startBlock, long numBlocks) if (dierr != kDIErrNone) { if (dierr == kDIErrCancelled) goto bail; - DiskFS* pNewFS = nil; - DiskImg* pNewImg = nil; + DiskFS* pNewFS = NULL; + DiskImg* pNewImg = NULL; WMSG1(" MicroDrive failed opening sub-volume %d\n", idx); dierr = CreatePlaceholder(startBlock, numBlocks, NULL, NULL, diff --git a/diskimg/Nibble.cpp b/diskimg/Nibble.cpp index 651dbf2..9fbeb22 100644 --- a/diskimg/Nibble.cpp +++ b/diskimg/Nibble.cpp @@ -585,9 +585,9 @@ DiskImg::LoadNibbleTrack(long track, long* pTrackLen) fNibbleTrackLoaded = -1; /* alloc track buffer if needed */ - if (fNibbleTrackBuf == nil) { + if (fNibbleTrackBuf == NULL) { fNibbleTrackBuf = new unsigned char[kTrackAllocSize]; - if (fNibbleTrackBuf == nil) + if (fNibbleTrackBuf == NULL) return kDIErrMalloc; } @@ -613,7 +613,7 @@ DiskImg::SaveNibbleTrack(void) WMSG0("ERROR: tried to save track without loading it first\n"); return kDIErrInternal; } - assert(fNibbleTrackBuf != nil); + assert(fNibbleTrackBuf != NULL); DIError dierr = kDIErrNone; long trackLen = GetNibbleTrackLength(fNibbleTrackLoaded); @@ -627,7 +627,7 @@ DiskImg::SaveNibbleTrack(void) /* * Count up the number of readable sectors found on this track, and - * return it. If "pVol" is non-nil, return the volume number from + * return it. If "pVol" is non-NULL, return the volume number from * one of the readable sectors. */ int @@ -638,7 +638,7 @@ DiskImg::TestNibbleTrack(int track, const NibbleDescr* pNibbleDescr, int count = 0; assert(track >= 0 && track < kTrackCount525); - assert(pNibbleDescr != nil); + assert(pNibbleDescr != NULL); if (LoadNibbleTrack(track, &trackLen) != kDIErrNone) { WMSG0(" DI FindNibbleSectorStart: LoadNibbleTrack failed\n"); @@ -652,7 +652,7 @@ DiskImg::TestNibbleTrack(int track, const NibbleDescr* pNibbleDescr, int vol; sectorIdx = FindNibbleSectorStart(buffer, track, i, pNibbleDescr, &vol); if (sectorIdx >= 0) { - if (pVol != nil) + if (pVol != NULL) *pVol = vol; unsigned char sctBuf[256]; @@ -709,16 +709,16 @@ DiskImg::AnalyzeNibbleData(void) WMSG1(" Trying '%s'\n", fpNibbleDescrTable[i].description); goodTracks = 0; - good = TestNibbleTrack(1, &fpNibbleDescrTable[i], nil); + good = TestNibbleTrack(1, &fpNibbleDescrTable[i], NULL); if (good > fpNibbleDescrTable[i].numSectors - 4) goodTracks++; - good = TestNibbleTrack(16, &fpNibbleDescrTable[i], nil); + good = TestNibbleTrack(16, &fpNibbleDescrTable[i], NULL); if (good > fpNibbleDescrTable[i].numSectors - 4) goodTracks++; good = TestNibbleTrack(17, &fpNibbleDescrTable[i], &protoVol); if (good > fpNibbleDescrTable[i].numSectors - 4) goodTracks++; - good = TestNibbleTrack(26, &fpNibbleDescrTable[i], nil); + good = TestNibbleTrack(26, &fpNibbleDescrTable[i], NULL); if (good > fpNibbleDescrTable[i].numSectors - 4) goodTracks++; @@ -750,9 +750,9 @@ DIError DiskImg::ReadNibbleSector(long track, int sector, void* buf, const NibbleDescr* pNibbleDescr) { - if (pNibbleDescr == nil) { + if (pNibbleDescr == NULL) { /* disk has no recognizable sectors */ - WMSG0(" DI ReadNibbleSector: pNibbleDescr is nil, returning failure\n"); + WMSG0(" DI ReadNibbleSector: pNibbleDescr is NULL, returning failure\n"); return kDIErrBadNibbleSectors; } if (sector >= pNibbleDescr->numSectors) { @@ -761,7 +761,7 @@ DiskImg::ReadNibbleSector(long track, int sector, void* buf, return kDIErrInvalidSector; } - assert(pNibbleDescr != nil); + assert(pNibbleDescr != NULL); assert(IsNibbleFormat(fPhysical)); assert(track >= 0 && track < GetNumTracks()); assert(sector >= 0 && sector < pNibbleDescr->numSectors); @@ -795,7 +795,7 @@ DIError DiskImg::WriteNibbleSector(long track, int sector, const void* buf, const NibbleDescr* pNibbleDescr) { - assert(pNibbleDescr != nil); + assert(pNibbleDescr != NULL); assert(IsNibbleFormat(fPhysical)); assert(track >= 0 && track < GetNumTracks()); assert(sector >= 0 && sector < pNibbleDescr->numSectors); @@ -944,7 +944,7 @@ DiskImg::FormatNibbles(GenericFD* pGFD) const assert(fHasSectors); - assert(fpNibbleDescr != nil); + assert(fpNibbleDescr != NULL); assert(fpNibbleDescr->numSectors == GetNumSectPerTrack()); assert(fpNibbleDescr->encoding == kNibbleEnc53 || fpNibbleDescr->encoding == kNibbleEnc62); diff --git a/diskimg/OuterWrapper.cpp b/diskimg/OuterWrapper.cpp index 1cb5992..1ac4bef 100644 --- a/diskimg/OuterWrapper.cpp +++ b/diskimg/OuterWrapper.cpp @@ -45,7 +45,7 @@ OuterGzip::Test(GenericFD* pGFD, di_off_t outerLength) /* don't need this here, but we will later on */ imagePath = pGFD->GetPathName(); - if (imagePath == nil) { + if (imagePath == NULL) { WMSG0("Can't test gzip on non-file\n"); return kDIErrNotSupported; } @@ -91,19 +91,19 @@ OuterGzip::ExtractGzipImage(gzFile gzfp, char** pBuf, di_off_t* pLength) const int kNextSize2 = 1024 * 1024; const int kMaxIncr = 4096 * 1024; const int kAbsoluteMax = kMaxUncompressedSize; - char* buf = nil; - char* newBuf = nil; + char* buf = NULL; + char* newBuf = NULL; long curSize, maxSize; - assert(gzfp != nil); - assert(pBuf != nil); - assert(pLength != nil); + assert(gzfp != NULL); + assert(pBuf != NULL); + assert(pLength != NULL); curSize = 0; maxSize = kStartSize; buf = new char[maxSize]; - if (buf == nil) { + if (buf == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -167,7 +167,7 @@ OuterGzip::ExtractGzipImage(gzFile gzfp, char** pBuf, di_off_t* pLength) } newBuf = new char[maxSize]; - if (newBuf == nil) { + if (newBuf == NULL) { WMSG1(" ExGZ failed buffer alloc (%ld)\n", maxSize); dierr = kDIErrMalloc; @@ -177,7 +177,7 @@ OuterGzip::ExtractGzipImage(gzFile gzfp, char** pBuf, di_off_t* pLength) memcpy(newBuf, buf, curSize); delete[] buf; buf = newBuf; - newBuf = nil; + newBuf = NULL; WMSG1(" ExGZ grew buffer to %ld\n", maxSize); } else { @@ -199,19 +199,19 @@ OuterGzip::ExtractGzipImage(gzFile gzfp, char** pBuf, di_off_t* pLength) /* shrink it down so it fits */ WMSG2(" Down-sizing buffer from %ld to %ld\n", maxSize, curSize); newBuf = new char[curSize]; - if (newBuf == nil) + if (newBuf == NULL) goto bail; memcpy(newBuf, buf, curSize); delete[] buf; buf = newBuf; - newBuf = nil; + newBuf = NULL; } *pBuf = buf; *pLength = curSize; WMSG1(" ExGZ final size = %ld\n", curSize); - buf = nil; + buf = NULL; bail: delete[] buf; @@ -227,20 +227,20 @@ OuterGzip::Load(GenericFD* pOuterGFD, di_off_t outerLength, bool readOnly, di_off_t* pWrapperLength, GenericFD** ppWrapperGFD) { DIError dierr = kDIErrNone; - GFDBuffer* pNewGFD = nil; - char* buf = nil; + GFDBuffer* pNewGFD = NULL; + char* buf = NULL; di_off_t length = -1; const char* imagePath; - gzFile gzfp = nil; + gzFile gzfp = NULL; imagePath = pOuterGFD->GetPathName(); - if (imagePath == nil) { + if (imagePath == NULL) { assert(false); // should've been caught in Test return kDIErrNotSupported; } gzfp = gzopen(imagePath, "rb"); // use "readOnly" here - if (gzfp == nil) { // DON'T retry RO -- should be done at higher level? + if (gzfp == NULL) { // DON'T retry RO -- should be done at higher level? WMSG1("gzopen failed, errno=%d\n", errno); dierr = kDIErrGeneric; goto bail; @@ -258,14 +258,14 @@ OuterGzip::Load(GenericFD* pOuterGFD, di_off_t outerLength, bool readOnly, dierr = pNewGFD->Open(buf, length, true, false, readOnly); if (dierr != kDIErrNone) goto bail; - buf = nil; // now owned by pNewGFD; + buf = NULL; // now owned by pNewGFD; /* * Success! */ assert(dierr == kDIErrNone); *ppWrapperGFD = pNewGFD; - pNewGFD = nil; + pNewGFD = NULL; *pWrapperLength = length; @@ -273,7 +273,7 @@ bail: if (dierr != kDIErrNone) { delete pNewGFD; } - if (gzfp != nil) + if (gzfp != NULL) gzclose(gzfp); return dierr; } @@ -291,7 +291,7 @@ OuterGzip::Save(GenericFD* pOuterGFD, GenericFD* pWrapperGFD, { DIError dierr = kDIErrNone; const char* imagePath; - gzFile gzfp = nil; + gzFile gzfp = NULL; WMSG1(" GZ save (wrapperLen=%ld)\n", (long) wrapperLength); assert(wrapperLength > 0); @@ -300,13 +300,13 @@ OuterGzip::Save(GenericFD* pOuterGFD, GenericFD* pWrapperGFD, * Reopen the file. */ imagePath = pOuterGFD->GetPathName(); - if (imagePath == nil) { + if (imagePath == NULL) { assert(false); // should've been caught long ago return kDIErrNotSupported; } gzfp = gzopen(imagePath, "wb"); - if (gzfp == nil) { + if (gzfp == NULL) { WMSG1("gzopen for write failed, errno=%d\n", errno); dierr = kDIErrGeneric; goto bail; @@ -351,7 +351,7 @@ OuterGzip::Save(GenericFD* pOuterGFD, GenericFD* pWrapperGFD, assert(dierr == kDIErrNone); bail: - if (gzfp != nil) + if (gzfp != NULL) gzclose(gzfp); return dierr; } @@ -415,9 +415,9 @@ OuterZip::Load(GenericFD* pOuterGFD, di_off_t outerLength, bool readOnly, di_off_t* pWrapperLength, GenericFD** ppWrapperGFD) { DIError dierr = kDIErrNone; - GFDBuffer* pNewGFD = nil; + GFDBuffer* pNewGFD = NULL; CentralDirEntry cde; - unsigned char* buf = nil; + unsigned char* buf = NULL; di_off_t length = -1; const char* pExt; @@ -427,7 +427,7 @@ OuterZip::Load(GenericFD* pOuterGFD, di_off_t outerLength, bool readOnly, if (cde.fFileNameLength > 0) { pExt = FindExtension((const char*) cde.fFileName, kZipFssep); - if (pExt != nil) { + if (pExt != NULL) { assert(*pExt == '.'); SetExtension(pExt+1); @@ -449,14 +449,14 @@ OuterZip::Load(GenericFD* pOuterGFD, di_off_t outerLength, bool readOnly, dierr = pNewGFD->Open(buf, length, true, false, readOnly); if (dierr != kDIErrNone) goto bail; - buf = nil; // now owned by pNewGFD; + buf = NULL; // now owned by pNewGFD; /* * Success! */ assert(dierr == kDIErrNone); *ppWrapperGFD = pNewGFD; - pNewGFD = nil; + pNewGFD = NULL; *pWrapperLength = length; @@ -503,7 +503,7 @@ OuterZip::Save(GenericFD* pOuterGFD, GenericFD* pWrapperGFD, * will have set the actual filename, with an extension that matches * the file contents. */ - if (fStoredFileName == nil || fStoredFileName[0] == '\0') + if (fStoredFileName == NULL || fStoredFileName[0] == '\0') SetStoredFileName("disk"); /* @@ -657,7 +657,7 @@ OuterZip::ReadCentralDir(GenericFD* pGFD, di_off_t outerLength, { DIError dierr = kDIErrNone; EndOfCentralDir eocd; - unsigned char* buf = nil; + unsigned char* buf = NULL; di_off_t seekStart; long readAmount; int i; @@ -667,7 +667,7 @@ OuterZip::ReadCentralDir(GenericFD* pGFD, di_off_t outerLength, return kDIErrGeneric; buf = new unsigned char[kMaxEOCDSearch]; - if (buf == nil) { + if (buf == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -774,7 +774,7 @@ OuterZip::ExtractZipEntry(GenericFD* pOuterGFD, CentralDirEntry* pCDE, { DIError dierr = kDIErrNone; LocalFileHeader lfh; - unsigned char* buf = nil; + unsigned char* buf = NULL; /* seek to the start of the local header */ dierr = pOuterGFD->Seek(pCDE->fLocalHeaderRelOffset, kSeekSet); @@ -796,7 +796,7 @@ OuterZip::ExtractZipEntry(GenericFD* pOuterGFD, CentralDirEntry* pCDE, WMSG1("File offset is 0x%08lx\n", (long) pOuterGFD->Tell()); buf = new unsigned char[pCDE->fUncompressedSize]; - if (buf == nil) { + if (buf == NULL) { /* a very real possibility */ WMSG1(" ZIP unable to allocate buffer of %lu bytes\n", pCDE->fUncompressedSize); @@ -837,7 +837,7 @@ OuterZip::ExtractZipEntry(GenericFD* pOuterGFD, CentralDirEntry* pCDE, *pBuf = buf; *pLength = pCDE->fUncompressedSize; - buf = nil; + buf = NULL; bail: delete[] buf; @@ -855,13 +855,13 @@ OuterZip::InflateGFDToBuffer(GenericFD* pGFD, unsigned long compSize, { DIError dierr = kDIErrNone; const unsigned long kReadBufSize = 65536; - unsigned char* readBuf = nil; + unsigned char* readBuf = NULL; z_stream zstream; int zerr; unsigned long compRemaining; readBuf = new unsigned char[kReadBufSize]; - if (readBuf == nil) { + if (readBuf == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -874,7 +874,7 @@ OuterZip::InflateGFDToBuffer(GenericFD* pGFD, unsigned long compSize, zstream.zalloc = Z_NULL; zstream.zfree = Z_NULL; zstream.opaque = Z_NULL; - zstream.next_in = nil; + zstream.next_in = NULL; zstream.avail_in = 0; zstream.next_out = buf; zstream.avail_out = uncompSize; @@ -967,7 +967,7 @@ OuterZip::GetMSDOSTime(unsigned short* pDate, unsigned short* pTime) // (*pTime >> 11) & 0x1f); #endif - time_t now = time(nil); + time_t now = time(NULL); DOSTime(now, pDate, pTime); //WMSG3("+++ Our date : %04x %04x %d\n", *pDate, *pTime, // (*pTime >> 11) & 0x1f); @@ -1010,8 +1010,8 @@ OuterZip::DeflateGFDToGFD(GenericFD* pDst, GenericFD* pSrc, di_off_t srcLen, { DIError dierr = kDIErrNone; const unsigned long kBufSize = 32768; - unsigned char* inBuf = nil; - unsigned char* outBuf = nil; + unsigned char* inBuf = NULL; + unsigned char* outBuf = NULL; z_stream zstream; unsigned long crc; int zerr; @@ -1021,7 +1021,7 @@ OuterZip::DeflateGFDToGFD(GenericFD* pDst, GenericFD* pSrc, di_off_t srcLen, */ inBuf = new unsigned char[kBufSize]; outBuf = new unsigned char[kBufSize]; - if (inBuf == nil || outBuf == nil) { + if (inBuf == NULL || outBuf == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -1033,7 +1033,7 @@ OuterZip::DeflateGFDToGFD(GenericFD* pDst, GenericFD* pSrc, di_off_t srcLen, zstream.zalloc = Z_NULL; zstream.zfree = Z_NULL; zstream.opaque = Z_NULL; - zstream.next_in = nil; + zstream.next_in = NULL; zstream.avail_in = 0; zstream.next_out = outBuf; zstream.avail_out = kBufSize; @@ -1175,9 +1175,9 @@ OuterZip::LocalFileHeader::Read(GenericFD* pGFD) /* grab filename */ if (fFileNameLength != 0) { - assert(fFileName == nil); + assert(fFileName == NULL); fFileName = new unsigned char[fFileNameLength+1]; - if (fFileName == nil) { + if (fFileName == NULL) { dierr = kDIErrMalloc; goto bail; } else { @@ -1240,15 +1240,15 @@ void OuterZip::LocalFileHeader::SetFileName(const char* name) { delete[] fFileName; - fFileName = nil; + fFileName = NULL; fFileNameLength = 0; - if (name != nil) { + if (name != NULL) { fFileNameLength = strlen(name); fFileName = new unsigned char[fFileNameLength+1]; - if (fFileName == nil) { + if (fFileName == NULL) { WMSG1("Malloc failure in SetFileName %u\n", fFileNameLength); - fFileName = nil; + fFileName = NULL; fFileNameLength = 0; } else { memcpy(fFileName, name, fFileNameLength); @@ -1324,9 +1324,9 @@ OuterZip::CentralDirEntry::Read(GenericFD* pGFD) /* grab filename */ if (fFileNameLength != 0) { - assert(fFileName == nil); + assert(fFileName == NULL); fFileName = new unsigned char[fFileNameLength+1]; - if (fFileName == nil) { + if (fFileName == NULL) { dierr = kDIErrMalloc; goto bail; } else { @@ -1344,9 +1344,9 @@ OuterZip::CentralDirEntry::Read(GenericFD* pGFD) /* grab comment, if any */ if (fFileCommentLength != 0) { - assert(fFileComment == nil); + assert(fFileComment == NULL); fFileComment = new unsigned char[fFileCommentLength+1]; - if (fFileComment == nil) { + if (fFileComment == NULL) { dierr = kDIErrMalloc; goto bail; } else { @@ -1412,15 +1412,15 @@ void OuterZip::CentralDirEntry::SetFileName(const char* name) { delete[] fFileName; - fFileName = nil; + fFileName = NULL; fFileNameLength = 0; - if (name != nil) { + if (name != NULL) { fFileNameLength = strlen(name); fFileName = new unsigned char[fFileNameLength+1]; - if (fFileName == nil) { + if (fFileName == NULL) { WMSG1("Malloc failure in SetFileName %u\n", fFileNameLength); - fFileName = nil; + fFileName = NULL; fFileNameLength = 0; } else { memcpy(fFileName, name, fFileNameLength); @@ -1450,10 +1450,10 @@ OuterZip::CentralDirEntry::Dump(void) const fDiskNumberStart, fInternalAttrs, fExternalAttrs, fLocalHeaderRelOffset); - if (fFileName != nil) { + if (fFileName != NULL) { WMSG1(" filename: '%s'\n", fFileName); } - if (fFileComment != nil) { + if (fFileComment != NULL) { WMSG1(" comment: '%s'\n", fFileComment); } } diff --git a/diskimg/OzDOS.cpp b/diskimg/OzDOS.cpp index 1936d8a..91ea004 100644 --- a/diskimg/OzDOS.cpp +++ b/diskimg/OzDOS.cpp @@ -253,11 +253,11 @@ DIError DiskFSOzDOS::OpenSubVolume(int idx) { DIError dierr = kDIErrNone; - DiskFS* pNewFS = nil; - DiskImg* pNewImg = nil; + DiskFS* pNewFS = NULL; + DiskImg* pNewImg = NULL; pNewImg = new DiskImg; - if (pNewImg == nil) { + if (pNewImg == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -292,7 +292,7 @@ DiskFSOzDOS::OpenSubVolume(int idx) /* open a DiskFS for the sub-image */ WMSG1(" UNISub %d succeeded!\n", idx); pNewFS = pNewImg->OpenAppropriateDiskFS(); - if (pNewFS == nil) { + if (pNewFS == NULL) { WMSG0(" OzSub: OpenAppropriateDiskFS failed\n"); dierr = kDIErrUnsupportedFSFmt; goto bail; diff --git a/diskimg/Pascal.cpp b/diskimg/Pascal.cpp index 8f1233f..fc72431 100644 --- a/diskimg/Pascal.cpp +++ b/diskimg/Pascal.cpp @@ -125,8 +125,8 @@ DiskFSPascal::Initialize(void) fVolumeUsage.Dump(); //A2File* pFile; - //pFile = GetNextFile(nil); - //while (pFile != nil) { + //pFile = GetNextFile(NULL); + //while (pFile != NULL) { // pFile->Dump(); // pFile = GetNextFile(pFile); //} @@ -244,7 +244,7 @@ DiskFSPascal::LoadCatalog(void) unsigned char* dirPtr; int block, numBlocks; - assert(fDirectory == nil); + assert(fDirectory == NULL); numBlocks = fNextBlock - kVolHeaderBlock; if (numBlocks <= 0 || numBlocks > kHugeDir) { @@ -253,7 +253,7 @@ DiskFSPascal::LoadCatalog(void) } fDirectory = new unsigned char[kBlkSize * numBlocks]; - if (fDirectory == nil) { + if (fDirectory == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -272,7 +272,7 @@ DiskFSPascal::LoadCatalog(void) bail: if (dierr != kDIErrNone) { delete[] fDirectory; - fDirectory = nil; + fDirectory = NULL; } return dierr; } @@ -287,7 +287,7 @@ DiskFSPascal::SaveCatalog(void) unsigned char* dirPtr; int block, numBlocks; - assert(fDirectory != nil); + assert(fDirectory != NULL); numBlocks = fNextBlock - kVolHeaderBlock; block = kVolHeaderBlock; @@ -312,7 +312,7 @@ void DiskFSPascal::FreeCatalog(void) { delete[] fDirectory; - fDirectory = nil; + fDirectory = NULL; } @@ -412,8 +412,8 @@ DiskFSPascal::ScanFileUsage(void) } A2FilePascal* pFile; - pFile = (A2FilePascal*) GetNextFile(nil); - while (pFile != nil) { + pFile = (A2FilePascal*) GetNextFile(NULL); + while (pFile != NULL) { for (block = pFile->fStartBlock; block < pFile->fNextBlock; block++) SetBlockUsage(block, VolumeUsage::kChunkPurposeUserData); @@ -453,7 +453,7 @@ DiskFSPascal::SetBlockUsage(long block, VolumeUsage::ChunkPurpose purpose) /*static*/ bool DiskFSPascal::IsValidVolumeName(const char* name) { - if (name == nil) { + if (name == NULL) { assert(false); return false; } @@ -474,7 +474,7 @@ DiskFSPascal::IsValidVolumeName(const char* name) /*static*/ bool DiskFSPascal::IsValidFileName(const char* name) { - assert(name != nil); + assert(name != NULL); if (name[0] == '\0') return false; @@ -487,7 +487,7 @@ DiskFSPascal::IsValidFileName(const char* name) return false; //if (*name >= 'a' && *name <= 'z') // no lower case // return false; - if (strchr(kInvalidNameChars, *name) != nil) // filer metacharacters + if (strchr(kInvalidNameChars, *name) != NULL) // filer metacharacters return false; name++; @@ -510,7 +510,7 @@ DiskFSPascal::Format(DiskImg* pDiskImg, const char* volName) return kDIErrInvalidArg; /* set fpImg so calls that rely on it will work; we un-set it later */ - assert(fpImg == nil); + assert(fpImg == NULL); SetDiskImg(pDiskImg); WMSG0(" Pascal formatting disk image\n"); @@ -572,7 +572,7 @@ DiskFSPascal::Format(DiskImg* pDiskImg, const char* volName) bail: - SetDiskImg(nil); // shouldn't really be set by us + SetDiskImg(NULL); // shouldn't really be set by us return dierr; } @@ -817,8 +817,8 @@ DiskFSPascal::GetFreeSpaceCount(long* pTotalUnits, long* pFreeUnits, long freeBlocks = 0; unsigned short prevNextBlock = fNextBlock; - pFile = (A2FilePascal*) GetNextFile(nil); - while (pFile != nil) { + pFile = (A2FilePascal*) GetNextFile(NULL); + while (pFile != NULL) { freeBlocks += pFile->fStartBlock - prevNextBlock; prevNextBlock = pFile->fNextBlock; @@ -875,13 +875,13 @@ DiskFSPascal::DoNormalizePath(const char* name, char fssep, char* outBuf) /* throw out leading pathname, if any */ if (fssep != '\0') { cp = strrchr(name, fssep); - if (cp != nil) + if (cp != NULL) name = cp+1; } while (*name != '\0' && (outp - outBuf) < A2FilePascal::kMaxFileName) { if (*name > 0x20 && *name < 0x7f && - strchr(kInvalidNameChars, *name) == nil) + strchr(kInvalidNameChars, *name) == NULL) { *outp++ = toupper(*name); } @@ -918,15 +918,15 @@ DiskFSPascal::CreateFile(const CreateParms* pParms, A2File** ppNewFile) DIError dierr = kDIErrNone; const bool createUnique = (GetParameter(kParm_CreateUnique) != 0); char normalName[A2FilePascal::kMaxFileName+1]; - A2FilePascal* pNewFile = nil; + A2FilePascal* pNewFile = NULL; if (fpImg->GetReadOnly()) return kDIErrAccessDenied; if (!fDiskIsGood) return kDIErrBadDiskImage; - assert(pParms != nil); - assert(pParms->pathName != nil); + assert(pParms != NULL); + assert(pParms->pathName != NULL); assert(pParms->storageType == A2FileProDOS::kStorageSeedling); WMSG1(" Pascal ---v--- CreateFile '%s'\n", pParms->pathName); @@ -938,7 +938,7 @@ DiskFSPascal::CreateFile(const CreateParms* pParms, A2File** ppNewFile) return kDIErrVolumeDirFull; } - *ppNewFile = nil; + *ppNewFile = NULL; DoNormalizePath(pParms->pathName, pParms->fssep, normalName); @@ -951,7 +951,7 @@ DiskFSPascal::CreateFile(const CreateParms* pParms, A2File** ppNewFile) if (createUnique) { MakeFileNameUnique(normalName); } else { - if (GetFileByName(normalName) != nil) { + if (GetFileByName(normalName) != NULL) { WMSG1(" Pascal create: normalized name '%s' already exists\n", normalName); dierr = kDIErrFileExists; @@ -964,7 +964,7 @@ DiskFSPascal::CreateFile(const CreateParms* pParms, A2File** ppNewFile) * * We get an index pointer and A2File pointer to the previous entry. If * the blank space is at the head of the list, prevIdx will be zero and - * pPrevFile will be nil. + * pPrevFile will be NULL. */ A2FilePascal* pPrevFile; int prevIdx; @@ -979,11 +979,11 @@ DiskFSPascal::CreateFile(const CreateParms* pParms, A2File** ppNewFile) */ time_t now; pNewFile = new A2FilePascal(this); - if (pNewFile == nil) { + if (pNewFile == NULL) { dierr = kDIErrMalloc; goto bail; } - if (pPrevFile == nil) + if (pPrevFile == NULL) pNewFile->fStartBlock = fNextBlock; else pNewFile->fStartBlock = pPrevFile->fNextBlock; @@ -992,7 +992,7 @@ DiskFSPascal::CreateFile(const CreateParms* pParms, A2File** ppNewFile) memset(pNewFile->fFileName, 0, A2FilePascal::kMaxFileName); strcpy(pNewFile->fFileName, normalName); pNewFile->fBytesRemaining = 0; - now = time(nil); + now = time(NULL); pNewFile->fModWhen = A2FilePascal::ConvertPascalDate(now); pNewFile->fLength = 0; @@ -1044,7 +1044,7 @@ DiskFSPascal::CreateFile(const CreateParms* pParms, A2File** ppNewFile) InsertFileInList(pNewFile, pPrevFile); *ppNewFile = pNewFile; - pNewFile = nil; + pNewFile = NULL; bail: delete pNewFile; @@ -1068,10 +1068,10 @@ bail: DIError DiskFSPascal::MakeFileNameUnique(char* fileName) { - assert(fileName != nil); + assert(fileName != NULL); assert(strlen(fileName) <= A2FilePascal::kMaxFileName); - if (GetFileByName(fileName) == nil) + if (GetFileByName(fileName) == NULL) return kDIErrNone; WMSG1(" Pascal found duplicate of '%s', making unique\n", fileName); @@ -1088,7 +1088,7 @@ DiskFSPascal::MakeFileNameUnique(char* fileName) * to preserve ".gif", ".c", etc. */ const char* cp = strrchr(fileName, '.'); - if (cp != nil) { + if (cp != NULL) { int tmpOffset = cp - fileName; if (tmpOffset > 0 && nameLen - tmpOffset <= kMaxExtensionLen) { WMSG1(" Pascal (keeping extension '%s')\n", cp); @@ -1119,7 +1119,7 @@ DiskFSPascal::MakeFileNameUnique(char* fileName) memcpy(fileName + copyOffset, digitBuf, digitLen); if (dotLen != 0) memcpy(fileName + copyOffset + digitLen, dotBuf, dotLen); - } while (GetFileByName(fileName) != nil); + } while (GetFileByName(fileName) != NULL); WMSG1(" Pascal converted to unique name: %s\n", fileName); @@ -1146,10 +1146,10 @@ DiskFSPascal::FindLargestFreeArea(int *pPrevIdx, A2FilePascal** ppPrevFile) maxIndex = -1; maxGap = 0; idx = 0; - *ppPrevFile = pPrevFile = nil; + *ppPrevFile = pPrevFile = NULL; - pFile = (A2FilePascal*) GetNextFile(nil); - while (pFile != nil) { + pFile = (A2FilePascal*) GetNextFile(NULL); + while (pFile != NULL) { gapSize = pFile->fStartBlock - prevNextBlock; if (gapSize > maxGap) { maxGap = gapSize; @@ -1172,7 +1172,7 @@ DiskFSPascal::FindLargestFreeArea(int *pPrevIdx, A2FilePascal** ppPrevFile) WMSG3("Pascal largest gap after entry %d '%s' (size=%d)\n", maxIndex, - *ppPrevFile != nil ? (*ppPrevFile)->GetPathName() : "(root)", + *ppPrevFile != NULL ? (*ppPrevFile)->GetPathName() : "(root)", maxGap); *pPrevIdx = maxIndex; @@ -1194,7 +1194,7 @@ DiskFSPascal::DeleteFile(A2File* pGenericFile) unsigned char* pEntry; int dirLen, offsetToNextEntry; - if (pGenericFile == nil) { + if (pGenericFile == NULL) { assert(false); return kDIErrInvalidArg; } @@ -1213,7 +1213,7 @@ DiskFSPascal::DeleteFile(A2File* pGenericFile) goto bail; pEntry = FindDirEntry(pFile); - if (pEntry == nil) { + if (pEntry == NULL) { assert(false); dierr = kDIErrInternal; goto bail; @@ -1255,7 +1255,7 @@ DiskFSPascal::RenameFile(A2File* pGenericFile, const char* newName) char normalName[A2FilePascal::kMaxFileName+1]; unsigned char* pEntry; - if (pFile == nil || newName == nil) + if (pFile == NULL || newName == NULL) return kDIErrInvalidArg; if (!IsValidFileName(newName)) return kDIErrInvalidArg; @@ -1276,7 +1276,7 @@ DiskFSPascal::RenameFile(A2File* pGenericFile, const char* newName) goto bail; pEntry = FindDirEntry(pFile); - if (pEntry == nil) { + if (pEntry == NULL) { assert(false); dierr = kDIErrInternal; goto bail; @@ -1310,7 +1310,7 @@ DiskFSPascal::SetFileInfo(A2File* pGenericFile, long fileType, long auxType, A2FilePascal* pFile = (A2FilePascal*) pGenericFile; unsigned char* pEntry; - if (pFile == nil) + if (pFile == NULL) return kDIErrInvalidArg; if (fpImg->GetReadOnly()) return kDIErrAccessDenied; @@ -1325,7 +1325,7 @@ DiskFSPascal::SetFileInfo(A2File* pGenericFile, long fileType, long auxType, goto bail; pEntry = FindDirEntry(pFile); - if (pEntry == nil) { + if (pEntry == NULL) { assert(false); dierr = kDIErrInternal; goto bail; @@ -1393,7 +1393,7 @@ DiskFSPascal::FindDirEntry(A2FilePascal* pFile) unsigned char* ptr; int i; - assert(fDirectory != nil); + assert(fDirectory != NULL); ptr = fDirectory; // volume header; first iteration skips over it for (i = 0; i < fNumFiles; i++) { @@ -1404,13 +1404,13 @@ DiskFSPascal::FindDirEntry(A2FilePascal* pFile) assert(false); WMSG2("name/block mismatch on '%s' %d\n", pFile->GetPathName(), pFile->fStartBlock); - return nil; + return NULL; } return ptr; } } - return nil; + return NULL; } @@ -1534,7 +1534,7 @@ A2FilePascal::ConvertPascalDate(time_t unixDate) return 0; ptm = localtime(&unixDate); - if (ptm == nil) + if (ptm == NULL) return 0; // must've been invalid or unspecified year = ptm->tm_year; // years since 1900 @@ -1578,7 +1578,7 @@ DIError A2FilePascal::Open(A2FileDescr** ppOpenFile, bool readOnly, bool rsrcFork /*=false*/) { - A2FDPascal* pOpenFile = nil; + A2FDPascal* pOpenFile = NULL; if (!readOnly) { if (fpDiskFS->GetDiskImg()->GetReadOnly()) @@ -1586,7 +1586,7 @@ A2FilePascal::Open(A2FileDescr** ppOpenFile, bool readOnly, if (fpDiskFS->GetFSDamaged()) return kDIErrBadDiskImage; } - if (fpOpenFile != nil) + if (fpOpenFile != NULL) return kDIErrAlreadyOpen; if (rsrcFork) return kDIErrForkNotFound; @@ -1624,11 +1624,11 @@ A2FDPascal::Read(void* buf, size_t len, size_t* pActual) /* don't allow them to read past the end of the file */ if (fOffset + (long)len > fOpenEOF) { - if (pActual == nil) + if (pActual == NULL) return kDIErrDataUnderrun; len = (size_t) (fOpenEOF - fOffset); } - if (pActual != nil) + if (pActual != NULL) *pActual = len; long incrLen = len; @@ -1693,7 +1693,7 @@ A2FDPascal::Write(const void* buf, size_t len, size_t* pActual) assert(fOffset == 0); // big simplifying assumption assert(fOpenEOF == 0); // another one assert(fOpenBlocksUsed == 1); - assert(buf != nil); + assert(buf != NULL); /* * Verify that there's enough room between this file and the next to @@ -1702,7 +1702,7 @@ A2FDPascal::Write(const void* buf, size_t len, size_t* pActual) long blocksNeeded, blocksAvail; A2FilePascal* pNextFile; pNextFile = (A2FilePascal*) pDiskFS->GetNextFile(pFile); - if (pNextFile == nil) + if (pNextFile == NULL) blocksAvail = pDiskFS->GetTotalBlocks() - pFile->fStartBlock; else blocksAvail = pNextFile->fStartBlock - pFile->fStartBlock; @@ -1823,7 +1823,7 @@ A2FDPascal::Close(void) */ pFile->fLength = fOpenEOF; pFile->fNextBlock = pFile->fStartBlock + (unsigned short) fOpenBlocksUsed; - pFile->fModWhen = A2FilePascal::ConvertPascalDate(time(nil)); + pFile->fModWhen = A2FilePascal::ConvertPascalDate(time(NULL)); /* * Update the "next block" value and the length-in-last-block. We @@ -1832,7 +1832,7 @@ A2FDPascal::Close(void) * somebody created or deleted a file after we were opened. */ pEntry = pDiskFS->FindDirEntry(pFile); - if (pEntry == nil) { + if (pEntry == NULL) { // we deleted an open file? assert(false); dierr = kDIErrInternal; diff --git a/diskimg/ProDOS.cpp b/diskimg/ProDOS.cpp index b89917a..db7e934 100644 --- a/diskimg/ProDOS.cpp +++ b/diskimg/ProDOS.cpp @@ -174,7 +174,7 @@ DiskFSProDOS::Initialize(InitMode initMode) /* volume dir is guaranteed to come first; if not, we need a lookup func */ A2FileProDOS* pVolumeDir; - pVolumeDir = (A2FileProDOS*) GetNextFile(nil); + pVolumeDir = (A2FileProDOS*) GetNextFile(NULL); dierr = RecursiveDirAdd(pVolumeDir, kVolHeaderBlock, "", 0); if (dierr != kDIErrNone) { @@ -211,8 +211,8 @@ DiskFSProDOS::Initialize(InitMode initMode) fVolumeUsage.Dump(); // A2File* pFile; -// pFile = GetNextFile(nil); -// while (pFile != nil) { +// pFile = GetNextFile(NULL); +// while (pFile != NULL) { // pFile->Dump(); // pFile = GetNextFile(pFile); // } @@ -344,7 +344,7 @@ DiskFSProDOS::LoadVolHeader(void) */ A2FileProDOS* pFile; pFile = new A2FileProDOS(this); - if (pFile == nil) { + if (pFile == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -438,7 +438,7 @@ DiskFSProDOS::LoadVolBitmap(void) return kDIErrBadDiskImage; /* should not already be allocated */ - assert(fBlockUseMap == nil); + assert(fBlockUseMap == NULL); delete[] fBlockUseMap; // just in case bitBlock = fBitMapPointer; @@ -447,7 +447,7 @@ DiskFSProDOS::LoadVolBitmap(void) assert(numBlocks > 0); fBlockUseMap = new unsigned char[kBlkSize * numBlocks]; - if (fBlockUseMap == nil) + if (fBlockUseMap == NULL) return kDIErrMalloc; while (numBlocks--) { @@ -455,7 +455,7 @@ DiskFSProDOS::LoadVolBitmap(void) fBlockUseMap + kBlkSize * numBlocks); if (dierr != kDIErrNone) { delete[] fBlockUseMap; - fBlockUseMap = nil; + fBlockUseMap = NULL; return dierr; } } @@ -472,7 +472,7 @@ DiskFSProDOS::SaveVolBitmap(void) DIError dierr = kDIErrNone; int bitBlock, numBlocks; - if (fBlockUseMap == nil) { + if (fBlockUseMap == NULL) { assert(false); return kDIErrNotReady; } @@ -503,7 +503,7 @@ void DiskFSProDOS::FreeVolBitmap(void) { delete[] fBlockUseMap; - fBlockUseMap = nil; + fBlockUseMap = NULL; } /* @@ -521,7 +521,7 @@ DiskFSProDOS::ScanVolBitmap(void) return dierr; } - assert(fBlockUseMap != nil); + assert(fBlockUseMap != NULL); /* mark the boot blocks as system */ SetBlockUsage(0, VolumeUsage::kChunkPurposeSystem); @@ -609,7 +609,7 @@ bool DiskFSProDOS::GetBlockUseEntry(long block) const { assert(block >= 0 && block < fTotalBlocks); - assert(fBlockUseMap != nil); + assert(fBlockUseMap != NULL); int offset; unsigned char mask; @@ -629,7 +629,7 @@ void DiskFSProDOS::SetBlockUseEntry(long block, bool inUse) { assert(block >= 0 && block < fTotalBlocks); - assert(fBlockUseMap != nil); + assert(fBlockUseMap != NULL); if (block == 0 && !inUse) { // shouldn't happen @@ -655,7 +655,7 @@ DiskFSProDOS::SetBlockUseEntry(long block, bool inUse) bool DiskFSProDOS::ScanForExtraEntries(void) const { - assert(fBlockUseMap != nil); + assert(fBlockUseMap != NULL); int offset, endOffset; @@ -684,7 +684,7 @@ DiskFSProDOS::ScanForExtraEntries(void) const long DiskFSProDOS::AllocBlock(void) { - assert(fBlockUseMap != nil); + assert(fBlockUseMap != NULL); #if 0 // whoa... this is REALLY slow /* @@ -906,7 +906,7 @@ DiskFSProDOS::SlurpEntries(A2File* pParent, const DirHeader* pHeader, } pFile = new A2FileProDOS(this); - if (pFile == nil) { + if (pFile == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -938,7 +938,7 @@ DiskFSProDOS::SlurpEntries(A2File* pParent, const DirHeader* pHeader, AddFileToList(pFile); (*pCount)++; - if (!fpImg->UpdateScanProgress(nil)) { + if (!fpImg->UpdateScanProgress(NULL)) { WMSG0(" ProDOS cancelled by user\n"); dierr = kDIErrCancelled; goto bail; @@ -1061,12 +1061,12 @@ DiskFSProDOS::ScanFileUsage(void) DIError dierr = kDIErrNone; A2FileProDOS* pFile; long blockCount, indexCount, sparseCount; - unsigned short* blockList = nil; - unsigned short* indexList = nil; + unsigned short* blockList = NULL; + unsigned short* indexList = NULL; - pFile = (A2FileProDOS*) GetNextFile(nil); - while (pFile != nil) { - if (!fpImg->UpdateScanProgress(nil)) { + pFile = (A2FileProDOS*) GetNextFile(NULL); + while (pFile != NULL) { + if (!fpImg->UpdateScanProgress(NULL)) { WMSG0(" ProDOS cancelled by user\n"); dierr = kDIErrCancelled; goto bail; @@ -1099,9 +1099,9 @@ DiskFSProDOS::ScanFileUsage(void) //WMSG3(" SparseCount %d rsrcEof %d '%s'\n", // sparseCount, pFile->fSparseRsrcEof, pFile->fDirEntry.fileName); delete[] blockList; - blockList = nil; + blockList = NULL; delete[] indexList; - indexList = nil; + indexList = NULL; /* data fork */ if (!A2FileProDOS::IsRegularFile(pFile->fExtRsrc.storageType)) { @@ -1124,9 +1124,9 @@ DiskFSProDOS::ScanFileUsage(void) //WMSG3(" SparseCount %d dataEof %d '%s'\n", // sparseCount, pFile->fSparseDataEof, pFile->fDirEntry.fileName); delete[] blockList; - blockList = nil; + blockList = NULL; delete[] indexList; - indexList = nil; + indexList = NULL; /* mark the extended key block as in-use */ SetBlockUsage(pFile->fDirEntry.keyPointer, @@ -1161,9 +1161,9 @@ DiskFSProDOS::ScanFileUsage(void) // pFile->fDirEntry.fileName); delete[] blockList; - blockList = nil; + blockList = NULL; delete[] indexList; - indexList = nil; + indexList = NULL; } else { WMSG2(" ProDOS found weird storage type %d on '%s', ignoring\n", pFile->fDirEntry.storageType, pFile->fDirEntry.fileName); @@ -1201,9 +1201,9 @@ void DiskFSProDOS::ScanBlockList(long blockCount, unsigned short* blockList, long indexCount, unsigned short* indexList, long* pSparseCount) { - assert(blockList != nil); - assert(indexCount == 0 || indexList != nil); - assert(pSparseCount != nil); + assert(blockList != NULL); + assert(indexCount == 0 || indexList != NULL); + assert(pSparseCount != NULL); *pSparseCount = 0; @@ -1277,8 +1277,8 @@ DiskFSProDOS::ScanForSubVolumes(void) * Try #1: this is a single DOS 3.3 volume (200K or less). */ if ((matchCount % 8) == 0 && matchCount <= (50*8)) { // max 50 tracks - DiskFS* pNewFS = nil; - DiskImg* pNewImg = nil; + DiskFS* pNewFS = NULL; + DiskImg* pNewImg = NULL; WMSG0(" Sub #1: looking for single DOS volume\n"); dierr = FindSubVolume(firstBlock, matchCount, &pNewImg, &pNewFS); if (dierr == kDIErrNone) { @@ -1305,8 +1305,8 @@ DiskFSProDOS::ScanForSubVolumes(void) matchCount / kBlkCount140); for (i = 0; i < count; i++) { - DiskFS* pNewFS = nil; - DiskImg* pNewImg = nil; + DiskFS* pNewFS = NULL; + DiskImg* pNewImg = NULL; WMSG1(" Sub #2: looking for DOS volume at (%d)\n", firstBlock + i * kBlkCount140); dierr = FindSubVolume(firstBlock + i * kBlkCount140, @@ -1343,8 +1343,8 @@ DiskFSProDOS::ScanForSubVolumes(void) matchCount / kBlkCount160); for (i = 0; i < count; i++) { - DiskFS* pNewFS = nil; - DiskImg* pNewImg = nil; + DiskFS* pNewFS = NULL; + DiskImg* pNewImg = NULL; WMSG1(" Sub #3: looking for DOS volume at (%d)\n", i * kBlkCount160); dierr = FindSubVolume(i * kBlkCount160, @@ -1359,8 +1359,8 @@ DiskFSProDOS::ScanForSubVolumes(void) } else { delete pNewFS; delete pNewImg; - pNewFS = nil; - pNewImg = nil; + pNewFS = NULL; + pNewImg = NULL; } } } @@ -1382,11 +1382,11 @@ DiskFSProDOS::FindSubVolume(long blockStart, long blockCount, DiskImg** ppDiskImg, DiskFS** ppDiskFS) { DIError dierr = kDIErrNone; - DiskFS* pNewFS = nil; - DiskImg* pNewImg = nil; + DiskFS* pNewFS = NULL; + DiskImg* pNewImg = NULL; pNewImg = new DiskImg; - if (pNewImg == nil) { + if (pNewImg == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -1415,7 +1415,7 @@ DiskFSProDOS::FindSubVolume(long blockStart, long blockCount, /* open a DiskFS for the sub-image */ WMSG0(" Sub DiskImg succeeded, opening DiskFS\n"); pNewFS = pNewImg->OpenAppropriateDiskFS(); - if (pNewFS == nil) { + if (pNewFS == NULL) { WMSG0(" Sub: OpenAppropriateDiskFS failed\n"); dierr = kDIErrUnsupportedFSFmt; goto bail; @@ -1433,7 +1433,7 @@ bail: delete pNewFS; delete pNewImg; } else { - assert(pNewImg != nil && pNewFS != nil); + assert(pNewImg != NULL && pNewFS != NULL); *ppDiskImg = pNewImg; *ppDiskFS = pNewFS; } @@ -1482,7 +1482,7 @@ DiskFSProDOS::Format(DiskImg* pDiskImg, const char* volName) return kDIErrInvalidArg; /* set fpImg so calls that rely on it will work; we un-set it later */ - assert(fpImg == nil); + assert(fpImg == NULL); SetDiskImg(pDiskImg); WMSG0(" ProDOS formatting disk image\n"); @@ -1550,7 +1550,7 @@ DiskFSProDOS::Format(DiskImg* pDiskImg, const char* volName) unsigned short lcFlags; time_t now; - now = time(nil); + now = time(NULL); /* * Compute the lower-case flags, if desired. The test for "allowLowerCase" @@ -1604,7 +1604,7 @@ DiskFSProDOS::Format(DiskImg* pDiskImg, const char* volName) //ScanVolBitmap(); bail: - SetDiskImg(nil); // shouldn't really be set by us + SetDiskImg(NULL); // shouldn't really be set by us return dierr; } @@ -1783,13 +1783,13 @@ DIError DiskFSProDOS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) { DIError dierr = kDIErrNone; - char* normalizedPath = nil; - char* basePath = nil; - char* fileName = nil; - A2FileProDOS* pSubdir = nil; - A2FileDescr* pOpenSubdir = nil; - A2FileProDOS* pNewFile = nil; - unsigned char* subdirBuf = nil; + char* normalizedPath = NULL; + char* basePath = NULL; + char* fileName = NULL; + A2FileProDOS* pSubdir = NULL; + A2FileDescr* pOpenSubdir = NULL; + A2FileProDOS* pNewFile = NULL; + unsigned char* subdirBuf = NULL; const bool allowLowerCase = (GetParameter(kParmProDOS_AllowLowerCase) != 0); const bool createUnique = (GetParameter(kParm_CreateUnique) != 0); char upperName[A2FileProDOS::kMaxFileName+1]; @@ -1800,33 +1800,33 @@ DiskFSProDOS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) if (!fDiskIsGood) return kDIErrBadDiskImage; - assert(pParms != nil); - assert(pParms->pathName != nil); + assert(pParms != NULL); + assert(pParms->pathName != NULL); assert(pParms->storageType == A2FileProDOS::kStorageSeedling || pParms->storageType == A2FileProDOS::kStorageExtended || pParms->storageType == A2FileProDOS::kStorageDirectory); // kStorageVolumeDirHeader not allowed -- that's created by Format WMSG1(" ProDOS ---v--- CreateFile '%s'\n", pParms->pathName); - *ppNewFile = nil; + *ppNewFile = NULL; /* * Normalize the pathname so that all components are ProDOS-safe * and separated by ':'. */ - assert(pParms->pathName != nil); + assert(pParms->pathName != NULL); dierr = DoNormalizePath(pParms->pathName, pParms->fssep, &normalizedPath); if (dierr != kDIErrNone) goto bail; - assert(normalizedPath != nil); + assert(normalizedPath != NULL); /* * Split the base path and filename apart. */ char* cp; cp = strrchr(normalizedPath, A2FileProDOS::kFssep); - if (cp == nil) { - assert(basePath == nil); + if (cp == NULL) { + assert(basePath == NULL); fileName = normalizedPath; } else { fileName = new char[strlen(cp+1) +1]; @@ -1834,20 +1834,20 @@ DiskFSProDOS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) *cp = '\0'; basePath = normalizedPath; } - normalizedPath = nil; // either fileName or basePath points here now + normalizedPath = NULL; // either fileName or basePath points here now - assert(fileName != nil); + assert(fileName != NULL); //WMSG2(" ProDOS normalized to '%s':'%s'\n", - // basePath == nil ? "" : basePath, fileName); + // basePath == NULL ? "" : basePath, fileName); /* * Open the base path. If it doesn't exist, create it recursively. */ - if (basePath != nil) { + if (basePath != NULL) { WMSG2(" ProDOS Creating '%s' in '%s'\n", fileName, basePath); /* open the named subdir, creating it if it doesn't exist */ pSubdir = (A2FileProDOS*)GetFileByName(basePath); - if (pSubdir == nil) { + if (pSubdir == NULL) { WMSG1(" ProDOS Creating subdir '%s'\n", basePath); A2File* pNewSub; CreateParms newDirParms; @@ -1857,11 +1857,11 @@ DiskFSProDOS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) newDirParms.fileType = kTypeDIR; // 0x0f newDirParms.auxType = 0; newDirParms.access = 0xe3; // unlocked, backup bit set - newDirParms.createWhen = newDirParms.modWhen = time(nil); + newDirParms.createWhen = newDirParms.modWhen = time(NULL); dierr = this->CreateFile(&newDirParms, &pNewSub); if (dierr != kDIErrNone) goto bail; - assert(pNewSub != nil); + assert(pNewSub != NULL); pSubdir = (A2FileProDOS*) pNewSub; } @@ -1902,7 +1902,7 @@ DiskFSProDOS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) basePathLen -= fixedLen+1; pBaseDir = (A2FileProDOS*) pBaseDir->GetParent(); - assert(pBaseDir != nil); + assert(pBaseDir != NULL); } // check the math if (pSubdir->IsVolumeDirectory()) @@ -1913,11 +1913,11 @@ DiskFSProDOS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) /* open the volume directory */ WMSG1(" ProDOS Creating '%s' in volume dir\n", fileName); /* volume dir must be first in the list */ - pSubdir = (A2FileProDOS*) GetNextFile(nil); - assert(pSubdir != nil); + pSubdir = (A2FileProDOS*) GetNextFile(NULL); + assert(pSubdir != NULL); assert(pSubdir->IsVolumeDirectory()); } - if (pSubdir == nil) { + if (pSubdir == NULL) { WMSG1(" ProDOS Unable to open subdir '%s'\n", basePath); dierr = kDIErrFileNotFound; goto bail; @@ -1949,7 +1949,7 @@ DiskFSProDOS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) if (dierr != kDIErrNone) goto bail; - assert(subdirBuf != nil); + assert(subdirBuf != NULL); assert(dirLen > 0); assert(dirKeyBlock > 0); assert(dirEntrySlot >= 0); @@ -2098,7 +2098,7 @@ DiskFSProDOS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) DiskFSProDOS::GenerateLowerCaseName(pNewFile->fDirEntry.fileName, lowerName, pNewFile->fDirEntry.auxType, true); } - pNewFile->SetPathName(basePath == nil ? "" : basePath, lowerName); + pNewFile->SetPathName(basePath == NULL ? "" : basePath, lowerName); if (pEntry->storageType == A2FileProDOS::kStorageExtended) { dierr = ReadExtendedInfo(pNewFile); @@ -2130,7 +2130,7 @@ DiskFSProDOS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) */ unsigned char* prevDirEntryPtr; prevDirEntryPtr = GetPrevDirEntry(subdirBuf, dirEntryPtr); - if (prevDirEntryPtr == nil) { + if (prevDirEntryPtr == NULL) { /* previous entry is volume or subdir header */ InsertFileInList(pNewFile, pNewFile->GetParent()); WMSG2("Inserted '%s' after '%s'\n", @@ -2142,7 +2142,7 @@ DiskFSProDOS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) prevKeyBlock = GetShortLE(&prevDirEntryPtr[0x11]); A2File* pPrev; pPrev = FindFileByKeyBlock(pNewFile->GetParent(), prevKeyBlock); - if (pPrev == nil) { + if (pPrev == NULL) { /* should be impossible! */ assert(false); AddFileToList(pNewFile); @@ -2155,11 +2155,11 @@ DiskFSProDOS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) // DumpFileList(); *ppNewFile = pNewFile; - pNewFile = nil; + pNewFile = NULL; bail: delete pNewFile; - if (pOpenSubdir != nil) + if (pOpenSubdir != NULL) pOpenSubdir->Close(); // writes updated dir entry in parent dir FreeVolBitmap(); delete[] normalizedPath; @@ -2177,7 +2177,7 @@ bail: A2File* DiskFSProDOS::FindFileByKeyBlock(A2File* pStart, unsigned short keyBlock) { - while (pStart != nil) { + while (pStart != NULL) { A2FileProDOS* pPro = (A2FileProDOS*) pStart; if (pPro->fDirEntry.keyPointer == keyBlock) @@ -2186,7 +2186,7 @@ DiskFSProDOS::FindFileByKeyBlock(A2File* pStart, unsigned short keyBlock) pStart = GetNextFile(pStart); } - return nil; + return NULL; } /* @@ -2454,7 +2454,7 @@ DiskFSProDOS::IsValidVolumeName(const char* name) /*static*/ bool DiskFSProDOS::IsValidFileName(const char* name) { - if (name == nil) { + if (name == NULL) { assert(false); return false; } @@ -2604,19 +2604,19 @@ DiskFSProDOS::NormalizePath(const char* path, char fssep, char* normalizedBuf, int* pNormalizedBufLen) { DIError dierr = kDIErrNone; - char* normalizedPath = nil; + char* normalizedPath = NULL; int len; - assert(pNormalizedBufLen != nil); - assert(normalizedBuf != nil || *pNormalizedBufLen == 0); + assert(pNormalizedBufLen != NULL); + assert(normalizedBuf != NULL || *pNormalizedBufLen == 0); dierr = DoNormalizePath(path, fssep, &normalizedPath); if (dierr != kDIErrNone) goto bail; - assert(normalizedPath != nil); + assert(normalizedPath != NULL); len = strlen(normalizedPath); - if (normalizedBuf == nil || *pNormalizedBufLen <= len) { + if (normalizedBuf == NULL || *pNormalizedBufLen <= len) { /* too short */ dierr = kDIErrDataOverrun; } else { @@ -2651,18 +2651,18 @@ DiskFSProDOS::DoNormalizePath(const char* path, char fssep, char** pNormalizedPath) { DIError dierr = kDIErrNone; - char* workBuf = nil; - char* partBuf = nil; - char* outputBuf = nil; + char* workBuf = NULL; + char* partBuf = NULL; + char* outputBuf = NULL; char* start; char* end; char* outPtr; - assert(path != nil); + assert(path != NULL); workBuf = new char[strlen(path)+1]; partBuf = new char[strlen(path)+1 +1]; // need +1 for prepending letter outputBuf = new char[strlen(path) * 2]; - if (workBuf == nil || partBuf == nil || outputBuf == nil) { + if (workBuf == NULL || partBuf == NULL || outputBuf == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -2677,10 +2677,10 @@ DiskFSProDOS::DoNormalizePath(const char* path, char fssep, int partIdx; if (fssep == '\0') { - end = nil; + end = NULL; } else { end = strchr(start, fssep); - if (end != nil) + if (end != NULL) *end = '\0'; } partIdx = 0; @@ -2729,7 +2729,7 @@ DiskFSProDOS::DoNormalizePath(const char* path, char fssep, if (partIdx > A2FileProDOS::kMaxFileName) { const char* pDot = strrchr(partBuf, '.'); //int DEBUGDOTLEN = pDot - partBuf; - if (pDot != nil && partIdx - (pDot-partBuf) <= kMaxExtensionLen) { + if (pDot != NULL && partIdx - (pDot-partBuf) <= kMaxExtensionLen) { int dotLen = partIdx - (pDot-partBuf); memmove(partBuf + (A2FileProDOS::kMaxFileName - dotLen), pDot, dotLen); // don't use memcpy, move might overlap @@ -2749,7 +2749,7 @@ DiskFSProDOS::DoNormalizePath(const char* path, char fssep, /* * Continue with next segment. */ - if (end == nil) + if (end == NULL) break; start = end+1; } @@ -2761,7 +2761,7 @@ DiskFSProDOS::DoNormalizePath(const char* path, char fssep, assert(*outputBuf != '\0'); *pNormalizedPath = outputBuf; - outputBuf = nil; + outputBuf = NULL; bail: delete[] workBuf; @@ -2832,15 +2832,15 @@ DiskFSProDOS::AllocDirEntry(A2FileDescr* pOpenSubdir, unsigned char** ppDir, long* pDirLen, unsigned char** ppDirEntry, unsigned short* pDirKeyBlock, int* pDirEntrySlot, unsigned short* pDirBlock) { - assert(pOpenSubdir != nil); - *ppDirEntry = nil; + assert(pOpenSubdir != NULL); + *ppDirEntry = NULL; *pDirLen = -1; *pDirKeyBlock = 0; *pDirEntrySlot = -1; *pDirBlock = 0; DIError dierr = kDIErrNone; - unsigned char* dirBuf = nil; + unsigned char* dirBuf = NULL; long dirLen; A2FileProDOS* pFile; long newBlock = -1; @@ -2857,7 +2857,7 @@ DiskFSProDOS::AllocDirEntry(A2FileDescr* pOpenSubdir, unsigned char** ppDir, goto bail; } dirBuf = new unsigned char[dirLen]; - if (dirBuf == nil) { + if (dirBuf == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -2883,7 +2883,7 @@ DiskFSProDOS::AllocDirEntry(A2FileDescr* pOpenSubdir, unsigned char** ppDir, int blockIdx; int entryIdx; - pDirEntry = nil; // make the compiler happy + pDirEntry = NULL; // make the compiler happy entryIdx = -1; // make the compiler happy for (blockIdx = 0; blockIdx < dirLen / 512; blockIdx++) { @@ -2935,7 +2935,7 @@ DiskFSProDOS::AllocDirEntry(A2FileDescr* pOpenSubdir, unsigned char** ppDir, * Extend our memory buffer to hold the new entry. */ unsigned char* newSpace = new unsigned char[dirLen + 512]; - if (newSpace == nil) { + if (newSpace == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -2990,7 +2990,7 @@ DiskFSProDOS::AllocDirEntry(A2FileDescr* pOpenSubdir, unsigned char** ppDir, assert(dierr == kDIErrNone); *pDirBlock = (unsigned short) whichBlock; } - dirBuf = nil; + dirBuf = NULL; bail: delete[] dirBuf; @@ -3003,7 +3003,7 @@ bail: * a new entry into the DiskFS linear file list.) * * If the previous entry is the first in the list (i.e. it's a volume or - * subdir header), this returns nil. + * subdir header), this returns NULL. * * This is a little awkward because the directories are chopped up into * 512-byte blocks, with 13 entries per block (which doesn't completely fill @@ -3014,13 +3014,13 @@ bail: unsigned char* DiskFSProDOS::GetPrevDirEntry(unsigned char* buf, unsigned char* ptr) { - assert(buf != nil); - assert(ptr != nil); + assert(buf != NULL); + assert(ptr != NULL); const int kStartOffset = 4; if (ptr == buf + kStartOffset || ptr == buf + kStartOffset + kEntryLength) - return nil; + return NULL; while (ptr - buf > 512) buf += 512; @@ -3049,10 +3049,10 @@ DIError DiskFSProDOS::MakeFileNameUnique(const unsigned char* dirBuf, long dirLen, char* fileName) { - assert(dirBuf != nil); + assert(dirBuf != NULL); assert(dirLen > 0); assert((dirLen % 512) == 0); - assert(fileName != nil); + assert(fileName != NULL); assert(strlen(fileName) <= A2FileProDOS::kMaxFileName); if (!NameExistsInDir(dirBuf, dirLen, fileName)) @@ -3077,7 +3077,7 @@ DiskFSProDOS::MakeFileNameUnique(const unsigned char* dirBuf, long dirLen, * around this, but it's probably not necessary. */ const char* cp = strrchr(fileName, '.'); - if (cp != nil) { + if (cp != NULL) { int tmpOffset = cp - fileName; if (tmpOffset > 0 && nameLen - tmpOffset <= kMaxExtensionLen) { WMSG1(" ProDOS (keeping extension '%s')\n", cp); @@ -3171,10 +3171,10 @@ DiskFSProDOS::DeleteFile(A2File* pGenericFile) DIError dierr = kDIErrNone; long blockCount = -1; long indexCount = -1; - unsigned short* blockList = nil; - unsigned short* indexList = nil; + unsigned short* blockList = NULL; + unsigned short* indexList = NULL; - if (pGenericFile == nil) { + if (pGenericFile == NULL) { assert(false); return kDIErrInvalidArg; } @@ -3215,11 +3215,11 @@ DiskFSProDOS::DeleteFile(A2File* pGenericFile) if (dierr != kDIErrNone) goto bail; FreeBlocks(blockCount, blockList); - if (indexList != nil) // no indices for seedling + if (indexList != NULL) // no indices for seedling FreeBlocks(indexCount, indexList); delete[] blockList; delete[] indexList; - indexList = nil; + indexList = NULL; // handle the key block "manually" blockCount = 1; @@ -3227,7 +3227,7 @@ DiskFSProDOS::DeleteFile(A2File* pGenericFile) blockList[0] = pFile->fDirEntry.keyPointer; FreeBlocks(blockCount, blockList); delete[] blockList; - blockList = nil; + blockList = NULL; dierr = pFile->LoadBlockList( pFile->fExtData.storageType, @@ -3266,7 +3266,7 @@ DiskFSProDOS::DeleteFile(A2File* pGenericFile) goto bail; FreeBlocks(blockCount, blockList); - if (indexList != nil) + if (indexList != NULL) FreeBlocks(indexCount, indexList); /* @@ -3327,7 +3327,7 @@ DiskFSProDOS::DeleteFile(A2File* pGenericFile) unsigned short fileCount; int storageType; pParent = (A2FileProDOS*) pFile->GetParent(); - assert(pParent != nil); + assert(pParent != NULL); assert(pParent->fDirEntry.keyPointer >= kVolHeaderBlock); dierr = fpImg->ReadBlock(pParent->fDirEntry.keyPointer, blkBuf); if (dierr != kDIErrNone) { @@ -3335,7 +3335,7 @@ DiskFSProDOS::DeleteFile(A2File* pGenericFile) pParent->fDirEntry.keyPointer); goto bail; } - ptr = nil; + ptr = NULL; storageType = (blkBuf[0x04] & 0xf0) >> 4; if (storageType != A2FileProDOS::kStorageSubdirHeader && @@ -3384,7 +3384,7 @@ DiskFSProDOS::FreeBlocks(long blockCount, unsigned short* blockList) //WMSG2(" +++ FreeBlocks (blockCount=%d blockList=0x%08lx)\n", // blockCount, blockList); assert(blockCount >= 0 && blockCount < 65536); - assert(blockList != nil); + assert(blockList != NULL); cstate.isUsed = false; cstate.isMarkedUsed = false; @@ -3433,7 +3433,7 @@ DiskFSProDOS::RenameFile(A2File* pGenericFile, const char* newName) char upperName[A2FileProDOS::kMaxFileName+1]; char upperComp[A2FileProDOS::kMaxFileName+1]; - if (pFile == nil || newName == nil) + if (pFile == NULL || newName == NULL) return kDIErrInvalidArg; if (!IsValidFileName(newName)) return kDIErrInvalidArg; @@ -3460,8 +3460,8 @@ DiskFSProDOS::RenameFile(A2File* pGenericFile, const char* newName) UpperCaseName(upperName, newName); pCur = GetNextFile(pParent); - assert(pCur != nil); // at the very least, pFile is in this dir - while (pCur != nil) { + assert(pCur != NULL); // at the very least, pFile is in this dir + while (pCur != NULL) { if (pCur != pFile && pCur->GetParent() == pParent) { /* one of our siblings; see if the name matches */ UpperCaseName(upperComp, pCur->GetFileName()); @@ -3584,7 +3584,7 @@ DiskFSProDOS::RenameFile(A2File* pGenericFile, const char* newName) if (pFile->IsDirectory()) { /* do all files that come after us */ pCur = pFile; - while (pCur != nil) { + while (pCur != NULL) { RegeneratePathName((A2FileProDOS*) pCur); pCur = GetNextFile(pCur); } @@ -3610,7 +3610,7 @@ DIError DiskFSProDOS::RegeneratePathName(A2FileProDOS* pFile) { A2FileProDOS* pParent; - char* buf = nil; + char* buf = NULL; int len; /* nothing to do here */ @@ -3628,7 +3628,7 @@ DiskFSProDOS::RegeneratePathName(A2FileProDOS* pFile) } buf = new char[len+1]; - if (buf == nil) + if (buf == NULL) return kDIErrMalloc; /* generate the new path name */ @@ -3679,7 +3679,7 @@ DiskFSProDOS::SetFileInfo(A2File* pGenericFile, long fileType, long auxType, if (fpImg->GetReadOnly()) return kDIErrAccessDenied; - if (pFile == nil) { + if (pFile == NULL) { assert(false); return kDIErrInvalidArg; } @@ -3763,8 +3763,8 @@ DiskFSProDOS::RenameVolume(const char* newName) if (fpImg->GetReadOnly()) return kDIErrAccessDenied; - pFile = (A2FileProDOS*) GetNextFile(nil); - assert(pFile != nil); + pFile = (A2FileProDOS*) GetNextFile(NULL); + assert(pFile != NULL); assert(strcmp(pFile->GetFileName(), fVolumeName) == 0); WMSG2(" ProDOS renaming volume '%s' to '%s'\n", @@ -3905,7 +3905,7 @@ A2FileProDOS::ConvertProDate(time_t unixDate) return 0; ptm = localtime(&unixDate); - if (ptm == nil) + if (ptm == NULL) return 0; // must've been invalid or unspecified year = ptm->tm_year; @@ -3952,13 +3952,13 @@ A2FileProDOS::GetModWhen(void) const * Set the full pathname to a combination of the base path and the * 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 A2FileProDOS::SetPathName(const char* basePath, const char* fileName) { - assert(basePath != nil && fileName != nil); - if (fPathName != nil) + assert(basePath != NULL && fileName != NULL); + if (fPathName != NULL) delete[] fPathName; int baseLen = strlen(basePath); @@ -4040,7 +4040,7 @@ A2FileProDOS::Open(A2FileDescr** ppOpenFile, bool readOnly, bool rsrcFork /*= false*/) { DIError dierr = kDIErrNone; - A2FDProDOS* pOpenFile = nil; + A2FDProDOS* pOpenFile = NULL; WMSG3(" ProDOS Open(ro=%d, rsrc=%d) on '%s'\n", readOnly, rsrcFork, fPathName); @@ -4053,7 +4053,7 @@ A2FileProDOS::Open(A2FileDescr** ppOpenFile, bool readOnly, return kDIErrBadDiskImage; } - if (fpOpenFile != nil) { + if (fpOpenFile != NULL) { dierr = kDIErrAlreadyOpen; goto bail; } @@ -4063,7 +4063,7 @@ A2FileProDOS::Open(A2FileDescr** ppOpenFile, bool readOnly, } pOpenFile = new A2FDProDOS(this); - if (pOpenFile == nil) + if (pOpenFile == NULL) return kDIErrMalloc; pOpenFile->fOpenRsrcFork = false; @@ -4120,7 +4120,7 @@ A2FileProDOS::Open(A2FileDescr** ppOpenFile, bool readOnly, fpOpenFile = pOpenFile; // add it to our single-member "open file set" *ppOpenFile = pOpenFile; - pOpenFile = nil; + pOpenFile = NULL; bail: delete pOpenFile; @@ -4140,7 +4140,7 @@ bail: * to create space in index blocks to hold it. Thus, a sapling could * hold a file with an EOF of 16MB. * - * If "pIndexBlockCount" and "pIndexBlockList" are non-nil, then we + * If "pIndexBlockCount" and "pIndexBlockList" are non-NULL, then we * also accumulate the list of index blocks and return those as well. * For a Tree-structured file, the first entry in the index list is * the master index block. @@ -4155,14 +4155,14 @@ A2FileProDOS::LoadBlockList(int storageType, unsigned short keyBlock, if (storageType == kStorageDirectory || storageType == kStorageVolumeDirHeader) { - assert(pIndexBlockList == nil && pIndexBlockCount == nil); + assert(pIndexBlockList == NULL && pIndexBlockCount == NULL); return LoadDirectoryBlockList(keyBlock, eof, pBlockCount, pBlockList); } assert(keyBlock != 0); - assert(pBlockCount != nil); - assert(pBlockList != nil); - assert(*pBlockList == nil); + assert(pBlockCount != NULL); + assert(pBlockList != NULL); + assert(*pBlockList == NULL); if (storageType != kStorageSeedling && storageType != kStorageSapling && storageType != kStorageTree) @@ -4178,7 +4178,7 @@ A2FileProDOS::LoadBlockList(int storageType, unsigned short keyBlock, } DIError dierr = kDIErrNone; - unsigned short* list = nil; + unsigned short* list = NULL; long count; assert(eof < 1024*1024*16); @@ -4186,14 +4186,14 @@ A2FileProDOS::LoadBlockList(int storageType, unsigned short keyBlock, if (count == 0) count = 1; list = new unsigned short[count+1]; - if (list == nil) { + if (list == NULL) { dierr = kDIErrMalloc; goto bail; } - if (pIndexBlockList != nil) { - assert(pIndexBlockCount != nil); - assert(*pIndexBlockList == nil); + if (pIndexBlockList != NULL) { + assert(pIndexBlockCount != NULL); + assert(*pIndexBlockList == NULL); } /* this should take care of trailing sparse entries */ @@ -4203,16 +4203,16 @@ A2FileProDOS::LoadBlockList(int storageType, unsigned short keyBlock, if (storageType == kStorageSeedling) { list[0] = keyBlock; - if (pIndexBlockList != nil) { + if (pIndexBlockList != NULL) { *pIndexBlockCount = 0; - *pIndexBlockList = nil; + *pIndexBlockList = NULL; } } else if (storageType == kStorageSapling) { dierr = LoadIndexBlock(keyBlock, list, count); if (dierr != kDIErrNone) goto bail; - if (pIndexBlockList != nil) { + if (pIndexBlockList != NULL) { *pIndexBlockCount = 1; *pIndexBlockList = new unsigned short[1]; **pIndexBlockList = keyBlock; @@ -4220,7 +4220,7 @@ A2FileProDOS::LoadBlockList(int storageType, unsigned short keyBlock, } else if (storageType == kStorageTree) { unsigned char blkBuf[kBlkSize]; unsigned short* listPtr = list; - unsigned short* outIndexPtr = nil; + unsigned short* outIndexPtr = NULL; long countDown = count; int idx = 0; @@ -4228,7 +4228,7 @@ A2FileProDOS::LoadBlockList(int storageType, unsigned short keyBlock, if (dierr != kDIErrNone) goto bail; - if (pIndexBlockList != nil) { + if (pIndexBlockList != NULL) { int numIndices = (count + kMaxBlocksPerIndex-1) / kMaxBlocksPerIndex; numIndices++; // add one for the master index block *pIndexBlockList = new unsigned short[numIndices]; @@ -4248,7 +4248,7 @@ A2FileProDOS::LoadBlockList(int storageType, unsigned short keyBlock, /* fully sparse index block */ //WMSG1(" ProDOS that's seriously sparse (%d)!\n", idx); memset(listPtr, 0, blockCount * sizeof(unsigned short)); - if (pIndexBlockList != nil) { + if (pIndexBlockList != NULL) { *outIndexPtr++ = idxBlock; (*pIndexBlockCount)++; } @@ -4257,7 +4257,7 @@ A2FileProDOS::LoadBlockList(int storageType, unsigned short keyBlock, if (dierr != kDIErrNone) goto bail; - if (pIndexBlockList != nil) { + if (pIndexBlockList != NULL) { *outIndexPtr++ = idxBlock; (*pIndexBlockCount)++; } @@ -4283,11 +4283,11 @@ A2FileProDOS::LoadBlockList(int storageType, unsigned short keyBlock, bail: if (dierr != kDIErrNone) { delete[] list; - assert(*pBlockList == nil); + assert(*pBlockList == NULL); - if (pIndexBlockList != nil && *pIndexBlockList != nil) { + if (pIndexBlockList != NULL && *pIndexBlockList != NULL) { delete[] *pIndexBlockList; - *pIndexBlockList = nil; + *pIndexBlockList = NULL; } } return dierr; @@ -4378,7 +4378,7 @@ A2FileProDOS::LoadDirectoryBlockList(unsigned short keyBlock, { DIError dierr = kDIErrNone; unsigned char blkBuf[kBlkSize]; - unsigned short* list = nil; + unsigned short* list = NULL; unsigned short* listPtr; int iterations; long count; @@ -4388,7 +4388,7 @@ A2FileProDOS::LoadDirectoryBlockList(unsigned short keyBlock, if (count == 0) count = 1; list = new unsigned short[count+1]; - if (list == nil) { + if (list == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -4478,15 +4478,15 @@ A2FDProDOS::Read(void* buf, size_t len, size_t* pActual) { WMSG3(" ProDOS reading %d bytes from '%s' (offset=%ld)\n", len, fpFile->GetPathName(), (long) fOffset); - //if (fBlockList == nil) + //if (fBlockList == NULL) // return kDIErrNotReady; if (fOffset + (long)len > fOpenEOF) { - if (pActual == nil) + if (pActual == NULL) return kDIErrDataUnderrun; len = (long) (fOpenEOF - fOffset); } - if (pActual != nil) + if (pActual != NULL) *pActual = len; // long incrLen = len; @@ -4601,7 +4601,7 @@ A2FDProDOS::Write(const void* buf, size_t len, size_t* pActual) assert(fOffset == 0); // big simplifying assumption assert(fOpenEOF == 0); // another one assert(fOpenBlocksUsed == 1); - assert(buf != nil); + assert(buf != NULL); /* nothing to do for zero-length write; don't even set fModified */ if (len == 0) @@ -4645,7 +4645,7 @@ A2FDProDOS::Write(const void* buf, size_t len, size_t* pActual) assert(fBlockCount > 0); delete[] fBlockList; fBlockList = new unsigned short[fBlockCount+1]; - if (fBlockList == nil) { + if (fBlockList == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -4958,7 +4958,7 @@ A2FDProDOS::Seek(di_off_t offset, DIWhence whence) di_off_t A2FDProDOS::Tell(void) { - //if (fBlockList == nil) + //if (fBlockList == NULL) // return kDIErrNotReady; return fOffset; @@ -5053,7 +5053,7 @@ A2FDProDOS::Close(void) pParentPtr[0x17] = (unsigned char) (newEOF >> 16); } /* don't update the mod date for now */ - //PutLongLE(&pParentPtr[0x21], A2FileProDOS::ConvertProDate(time(nil))); + //PutLongLE(&pParentPtr[0x21], A2FileProDOS::ConvertProDate(time(NULL))); dierr = fpFile->GetDiskFS()->GetDiskImg()->WriteBlock( pFile->fParentDirBlock, blkBuf); @@ -5119,14 +5119,14 @@ bail: long A2FDProDOS::GetSectorCount(void) const { - //if (fBlockList == nil) + //if (fBlockList == NULL) // return kDIErrNotReady; return fBlockCount * 2; } long A2FDProDOS::GetBlockCount(void) const { - //if (fBlockList == nil) + //if (fBlockList == NULL) // return kDIErrNotReady; return fBlockCount; } @@ -5137,7 +5137,7 @@ A2FDProDOS::GetBlockCount(void) const DIError A2FDProDOS::GetStorage(long sectorIdx, long* pTrack, long* pSector) const { - //if (fBlockList == nil) + //if (fBlockList == NULL) // return kDIErrNotReady; long prodosIdx = sectorIdx / 2; if (prodosIdx < 0 || prodosIdx >= fBlockCount) @@ -5156,7 +5156,7 @@ A2FDProDOS::GetStorage(long sectorIdx, long* pTrack, long* pSector) const DIError A2FDProDOS::GetStorage(long blockIdx, long* pBlock) const { - //if (fBlockList == nil) + //if (fBlockList == NULL) // return kDIErrNotReady; if (blockIdx < 0 || blockIdx >= fBlockCount) return kDIErrInvalidIndex; diff --git a/diskimg/RDOS.cpp b/diskimg/RDOS.cpp index 43f7032..086fc9a 100644 --- a/diskimg/RDOS.cpp +++ b/diskimg/RDOS.cpp @@ -298,8 +298,8 @@ DiskFSRDOS::Initialize(void) fVolumeUsage.Dump(); //A2File* pFile; - //pFile = GetNextFile(nil); - //while (pFile != nil) { + //pFile = GetNextFile(NULL); + //while (pFile != NULL) { // pFile->Dump(); // pFile = GetNextFile(pFile); //} @@ -318,12 +318,12 @@ DIError DiskFSRDOS::ReadCatalog(void) { DIError dierr = kDIErrNone; - unsigned char* dir = nil; + unsigned char* dir = NULL; unsigned char* dirPtr; int track, sector; dir = new unsigned char[kSctSize * kNumCatSectors]; - if (dir == nil) { + if (dir == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -397,8 +397,8 @@ DiskFSRDOS::ScanFileUsage(void) int track, sector, block, count; A2FileRDOS* pFile; - pFile = (A2FileRDOS*) GetNextFile(nil); - while (pFile != nil) { + pFile = (A2FileRDOS*) GetNextFile(NULL); + while (pFile != NULL) { block = pFile->fStartSector; count = pFile->fNumSectors; while (count--) { @@ -519,7 +519,7 @@ DIError A2FileRDOS::Open(A2FileDescr** ppOpenFile, bool readOnly, bool rsrcFork /*=false*/) { - if (fpOpenFile != nil) + if (fpOpenFile != NULL) return kDIErrAlreadyOpen; if (rsrcFork) return kDIErrForkNotFound; @@ -532,7 +532,7 @@ A2FileRDOS::Open(A2FileDescr** ppOpenFile, bool readOnly, fpOpenFile = pOpenFile; *ppOpenFile = pOpenFile; - pOpenFile = nil; + pOpenFile = NULL; return kDIErrNone; } @@ -559,11 +559,11 @@ A2FDRDOS::Read(void* buf, size_t len, size_t* pActual) /* don't allow them to read past the end of the file */ if (fOffset + (long)len > pFile->fLength) { - if (pActual == nil) + if (pActual == NULL) return kDIErrDataUnderrun; len = (size_t) (pFile->fLength - fOffset); } - if (pActual != nil) + if (pActual != NULL) *pActual = len; long incrLen = len; diff --git a/diskimg/SPTI.cpp b/diskimg/SPTI.cpp index 1ee30ce..45fcd1d 100644 --- a/diskimg/SPTI.cpp +++ b/diskimg/SPTI.cpp @@ -93,7 +93,7 @@ SPTI::ReadBlocks(HANDLE handle, long startBlock, short numBlocks, assert(startBlock >= 0); assert(numBlocks > 0); - assert(buf != nil); + assert(buf != NULL); //WMSG2(" SPTI phys read block (%ld) %d\n", startBlock, numBlocks); diff --git a/diskimg/TwoImg.cpp b/diskimg/TwoImg.cpp index e926f1d..78634fc 100644 --- a/diskimg/TwoImg.cpp +++ b/diskimg/TwoImg.cpp @@ -41,7 +41,7 @@ TwoImgHeader::InitHeader(int imageFormat, long imageSize, long imageBlockCount) return -1; } - assert(fComment == nil); + assert(fComment == NULL); //memcpy(fMagic, kMagic, 4); //memcpy(fCreator, kCreator, 4); @@ -95,16 +95,16 @@ void TwoImgHeader::SetComment(const char* comment) { delete[] fComment; - if (comment == nil) { - fComment = nil; + if (comment == NULL) { + fComment = NULL; } else { fComment = new char[strlen(comment)+1]; - if (fComment != nil) + if (fComment != NULL) strcpy(fComment, comment); // else throw alloc failure } - if (fComment == nil) { + if (fComment == NULL) { fCmtLen = 0; fCmtOffset = 0; if (fCreatorOffset > 0) @@ -126,16 +126,16 @@ TwoImgHeader::SetCreatorChunk(const void* chunk, long len) assert(len >= 0); delete[] fCreatorChunk; - if (chunk == nil || len == 0) { - fCreatorChunk = nil; + if (chunk == NULL || len == 0) { + fCreatorChunk = NULL; } else { fCreatorChunk = new char[len]; - if (fCreatorChunk != nil) + if (fCreatorChunk != NULL) memcpy(fCreatorChunk, chunk, len); // else throw alloc failure } - if (fCreatorChunk == nil) { + if (fCreatorChunk == NULL) { fCreatorLen = 0; fCreatorOffset = 0; } else { @@ -271,14 +271,14 @@ TwoImgHeader::GetChunk(GenericFD* pGFD, di_off_t relOffset, long len, return -1; } - assert(*pBuf == nil); + assert(*pBuf == NULL); *pBuf = new char[len+1]; // one extra, for null termination dierr = pGFD->Read(*pBuf, len); if (dierr != kDIErrNone) { WMSG0("2MG chunk read failed\n"); delete[] (char*) (*pBuf); - *pBuf = nil; + *pBuf = NULL; (void) pGFD->Seek(curPos, kSeekSet); return -1; } @@ -312,14 +312,14 @@ TwoImgHeader::GetChunk(FILE* fp, di_off_t relOffset, long len, return errno ? errno : -1;; } - assert(*pBuf == nil); + assert(*pBuf == NULL); *pBuf = new char[len+1]; // one extra, for null termination count = fread(*pBuf, len, 1, fp); if (!count || ferror(fp) || feof(fp)) { WMSG0("2MG chunk read failed\n"); delete[] (char*) (*pBuf); - *pBuf = nil; + *pBuf = NULL; (void) fseek(fp, curPos, SEEK_SET); clearerr(fp); return errno ? errno : -1;; diff --git a/diskimg/UNIDOS.cpp b/diskimg/UNIDOS.cpp index d2a0c5a..d15f725 100644 --- a/diskimg/UNIDOS.cpp +++ b/diskimg/UNIDOS.cpp @@ -298,11 +298,11 @@ DIError DiskFSUNIDOS::OpenSubVolume(int idx) { DIError dierr = kDIErrNone; - DiskFS* pNewFS = nil; - DiskImg* pNewImg = nil; + DiskFS* pNewFS = NULL; + DiskImg* pNewImg = NULL; pNewImg = new DiskImg; - if (pNewImg == nil) { + if (pNewImg == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -332,7 +332,7 @@ DiskFSUNIDOS::OpenSubVolume(int idx) /* open a DiskFS for the sub-image */ WMSG1(" UNISub %d succeeded!\n", idx); pNewFS = pNewImg->OpenAppropriateDiskFS(); - if (pNewFS == nil) { + if (pNewFS == NULL) { WMSG0(" UNISub: OpenAppropriateDiskFS failed\n"); dierr = kDIErrUnsupportedFSFmt; goto bail; diff --git a/diskimg/VolumeUsage.cpp b/diskimg/VolumeUsage.cpp index 41f91b9..960fceb 100644 --- a/diskimg/VolumeUsage.cpp +++ b/diskimg/VolumeUsage.cpp @@ -24,7 +24,7 @@ DiskFS::VolumeUsage::Create(long numBlocks) fTotalChunks = numBlocks; fListSize = numBlocks; fList = new unsigned char[fListSize]; - if (fList == nil) + if (fList == NULL) return kDIErrMalloc; memset(fList, 0, fListSize); @@ -47,7 +47,7 @@ DiskFS::VolumeUsage::Create(long numTracks, long numSectors) fTotalChunks = count; fListSize = count; fList = new unsigned char[fListSize]; - if (fList == nil) + if (fList == NULL) return kDIErrMalloc; memset(fList, 0, fListSize); @@ -78,7 +78,7 @@ DiskFS::VolumeUsage::GetChunkState(long track, long sector, DIError DiskFS::VolumeUsage::GetChunkStateIdx(int idx, ChunkState* pState) const { - if (fList == nil || idx < 0 || idx >= fListSize) { + if (fList == NULL || idx < 0 || idx >= fListSize) { assert(false); return kDIErrInvalidArg; } @@ -114,7 +114,7 @@ DiskFS::VolumeUsage::SetChunkState(long track, long sector, DIError DiskFS::VolumeUsage::SetChunkStateIdx(int idx, const ChunkState* pState) { - if (fList == nil || idx < 0 || idx >= fListSize) { + if (fList == NULL || idx < 0 || idx >= fListSize) { assert(false); return kDIErrInvalidArg; } @@ -221,7 +221,7 @@ void DiskFS::VolumeUsage::Dump(void) const { #define kMapInit "--------------------------------" - if (fList == nil) { + if (fList == NULL) { WMSG0(" VU asked to dump empty list?\n"); return; } diff --git a/diskimg/Win32BlockIO.cpp b/diskimg/Win32BlockIO.cpp index f45dc98..c24a904 100644 --- a/diskimg/Win32BlockIO.cpp +++ b/diskimg/Win32BlockIO.cpp @@ -48,9 +48,9 @@ Win32VolumeAccess::Open(const WCHAR* deviceName, bool readOnly) { DIError dierr = kDIErrNone; - assert(deviceName != nil); + assert(deviceName != NULL); - if (fpBlockAccess != nil) { + if (fpBlockAccess != NULL) { assert(false); return kDIErrAlreadyOpen; } @@ -58,7 +58,7 @@ Win32VolumeAccess::Open(const WCHAR* deviceName, bool readOnly) #ifdef WANT_ASPI if (strncmp(deviceName, kASPIDev, strlen(kASPIDev)) == 0) { fpBlockAccess = new ASPIBlockAccess; - if (fpBlockAccess == nil) { + if (fpBlockAccess == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -69,7 +69,7 @@ Win32VolumeAccess::Open(const WCHAR* deviceName, bool readOnly) #endif if (deviceName[0] >= 'A' && deviceName[0] <= 'Z') { fpBlockAccess = new LogicalBlockAccess; - if (fpBlockAccess == nil) { + if (fpBlockAccess == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -78,7 +78,7 @@ Win32VolumeAccess::Open(const WCHAR* deviceName, bool readOnly) goto bail; } else if (deviceName[0] >= '0' && deviceName[0] <= '9') { fpBlockAccess = new PhysicalBlockAccess; - if (fpBlockAccess == nil) { + if (fpBlockAccess == NULL) { dierr = kDIErrMalloc; goto bail; } @@ -99,7 +99,7 @@ Win32VolumeAccess::Open(const WCHAR* deviceName, bool readOnly) bail: if (dierr != kDIErrNone) { delete fpBlockAccess; - fpBlockAccess = nil; + fpBlockAccess = NULL; } return dierr; } @@ -110,7 +110,7 @@ bail: void Win32VolumeAccess::Close(void) { - if (fpBlockAccess != nil) { + if (fpBlockAccess != NULL) { DIError dierr; WMSG0(" Win32VolumeAccess closing\n"); @@ -126,7 +126,7 @@ Win32VolumeAccess::Close(void) dierr); } delete fpBlockAccess; - fpBlockAccess = nil; + fpBlockAccess = NULL; } } @@ -150,8 +150,8 @@ Win32VolumeAccess::ReadBlocks(long startBlock, short blockCount, assert(startBlock >= 0); assert(blockCount > 0); - assert(buf != nil); - assert(fpBlockAccess != nil); + assert(buf != NULL); + assert(fpBlockAccess != NULL); if (blockCount == 1) { if (fBlockCache.IsBlockInCache(startBlock)) { @@ -207,7 +207,7 @@ Win32VolumeAccess::WriteBlocks(long startBlock, short blockCount, assert(startBlock >= 0); assert(blockCount > 0); - assert(buf != nil); + assert(buf != NULL); if (blockCount == 1) { /* is this block already in the cache? */ @@ -527,9 +527,9 @@ Win32VolumeAccess::BlockAccess::GetInt13Unit(HANDLE handle, int driveNum, int* p const int kDeviceCategory1 = 0x08; // for older stuff const int kDeviceCategory2 = 0x48; // for FAT32 - assert(handle != nil); + assert(handle != NULL); assert(driveNum > 0 && driveNum <= kNumLogicalVolumes); - assert(pInt13Unit != nil); + assert(pInt13Unit != NULL); *pInt13Unit = -1; @@ -604,7 +604,7 @@ bail: * * Returns "true" if the geometry is known, "false" otherwise. When "true" * is returned, "*pNumTracks", "*pNumHeads", and "*pNumSectors" will receive - * values if the pointers are non-nil. + * values if the pointers are non-NULL. */ /*static*/ bool Win32VolumeAccess::BlockAccess::LookupFloppyGeometry(long totalBlocks, @@ -681,13 +681,13 @@ Win32VolumeAccess::BlockAccess::BlockToCylinderHeadSector(long blockNum, lastBlockOnTrack = blockNum + (pGeometry->numSectors - sector -1); - if (pCylinder != nil) + if (pCylinder != NULL) *pCylinder = cylinder; - if (pHead != nil) + if (pHead != NULL) *pHead = head; - if (pSector != nil) + if (pSector != NULL) *pSector = sector+1; - if (pLastBlockOnTrack != nil) + if (pLastBlockOnTrack != NULL) *pLastBlockOnTrack = lastBlockOnTrack; return true; @@ -1109,7 +1109,7 @@ Win32VolumeAccess::BlockAccess::ReadBlocksWin2K(HANDLE handle, //WMSG2(" ReadFile block start=%d count=%d\n", startBlock, blockCount); BOOL result; - result = ::ReadFile(handle, buf, blockCount * kBlockSize, &actual, nil); + result = ::ReadFile(handle, buf, blockCount * kBlockSize, &actual, NULL); if (!result) { DWORD lerr = GetLastError(); WMSG3(" ReadBlocksWin2K: ReadFile failed (start=%ld count=%d err=%ld)\n", @@ -1132,7 +1132,7 @@ Win32VolumeAccess::BlockAccess::WriteBlocksWin2K(HANDLE handle, { DWORD posn, actual; - posn = ::SetFilePointer(handle, startBlock * kBlockSize, nil, + posn = ::SetFilePointer(handle, startBlock * kBlockSize, NULL, FILE_BEGIN); if (posn == INVALID_SET_FILE_POINTER) { DWORD lerr = GetLastError(); @@ -1142,7 +1142,7 @@ Win32VolumeAccess::BlockAccess::WriteBlocksWin2K(HANDLE handle, } BOOL result; - result = ::WriteFile(handle, buf, blockCount * kBlockSize, &actual, nil); + result = ::WriteFile(handle, buf, blockCount * kBlockSize, &actual, NULL); if (!result) { DWORD lerr = GetLastError(); WMSG1(" GFDWinVolume WriteBlocks: WriteFile failed (err=%ld)\n", @@ -1171,7 +1171,7 @@ Win32VolumeAccess::LogicalBlockAccess::Open(const WCHAR* deviceName, bool readOn DIError dierr = kDIErrNone; const bool kPreferASPI = true; - assert(fHandle == nil); + assert(fHandle == NULL); fIsCDROM = false; fDriveNum = -1; @@ -1271,7 +1271,7 @@ Win32VolumeAccess::LogicalBlockAccess::Open(const WCHAR* deviceName, bool readOn } } - assert(fHandle != nil && fHandle != INVALID_HANDLE_VALUE); + assert(fHandle != NULL && fHandle != INVALID_HANDLE_VALUE); #if 0 if (fIsCDROM) { @@ -1297,9 +1297,9 @@ Win32VolumeAccess::LogicalBlockAccess::Open(const WCHAR* deviceName, bool readOn bail: if (dierr != kDIErrNone) { - if (fHandle != nil && fHandle != INVALID_HANDLE_VALUE) + if (fHandle != NULL && fHandle != INVALID_HANDLE_VALUE) ::CloseHandle(fHandle); - fHandle = nil; + fHandle = NULL; } return dierr; } @@ -1310,9 +1310,9 @@ bail: DIError Win32VolumeAccess::LogicalBlockAccess::Close(void) { - if (fHandle != nil) { + if (fHandle != NULL) { ::CloseHandle(fHandle); - fHandle = nil; + fHandle = NULL; } return kDIErrNone; } @@ -1328,17 +1328,17 @@ Win32VolumeAccess::LogicalBlockAccess::ReadBlocksCDROM(HANDLE handle, #ifdef HAVE_WINDOWS_CDROM DIError dierr; - assert(handle != nil); + assert(handle != NULL); assert(startBlock >= 0); assert(blockCount > 0); - assert(buf != nil); + assert(buf != NULL); //WMSG2(" CDROM read block %ld (%ld)\n", startBlock, block); /* alloc sector buffer on first use */ - if (fLastSectorCache == nil) { + if (fLastSectorCache == NULL) { fLastSectorCache = new unsigned char[kCDROMSectorSize]; - if (fLastSectorCache == nil) + if (fLastSectorCache == NULL) return kDIErrMalloc; assert(fLastSectorNum == -1); } @@ -1431,7 +1431,7 @@ Win32VolumeAccess::PhysicalBlockAccess::Open(const WCHAR* deviceName, bool readO DIError dierr = kDIErrNone; // initialize all local state - assert(fHandle == nil); + assert(fHandle == NULL); fInt13Unit = -1; fFloppyKind = kFloppyUnknown; memset(&fGeometry, 0, sizeof(fGeometry)); @@ -1520,13 +1520,13 @@ Win32VolumeAccess::PhysicalBlockAccess::Open(const WCHAR* deviceName, bool readO } } - assert(fHandle != nil && fHandle != INVALID_HANDLE_VALUE); + assert(fHandle != NULL && fHandle != INVALID_HANDLE_VALUE); bail: if (dierr != kDIErrNone) { - if (fHandle != nil && fHandle != INVALID_HANDLE_VALUE) + if (fHandle != NULL && fHandle != INVALID_HANDLE_VALUE) ::CloseHandle(fHandle); - fHandle = nil; + fHandle = NULL; } return dierr; @@ -1652,9 +1652,9 @@ Win32VolumeAccess::PhysicalBlockAccess::FlushBlockDevice(void) DIError Win32VolumeAccess::PhysicalBlockAccess::Close(void) { - if (fHandle != nil) { + if (fHandle != NULL) { ::CloseHandle(fHandle); - fHandle = nil; + fHandle = NULL; } return kDIErrNone; } @@ -1676,11 +1676,11 @@ Win32VolumeAccess::ASPIBlockAccess::Open(const char* deviceName, bool readOnly) { DIError dierr = kDIErrNone; - if (fpASPI != nil) + if (fpASPI != NULL) return kDIErrAlreadyOpen; fpASPI = Global::GetASPI(); - if (fpASPI == nil) + if (fpASPI == NULL) return kDIErrASPIFailure; if (strncmp(deviceName, kASPIDev, strlen(kASPIDev)) != 0) { @@ -1728,7 +1728,7 @@ Win32VolumeAccess::ASPIBlockAccess::Open(const char* deviceName, bool readOnly) bail: if (dierr != kDIErrNone) - fpASPI = nil; + fpASPI = NULL; return dierr; } @@ -1741,17 +1741,17 @@ bail: int Win32VolumeAccess::ASPIBlockAccess::ExtractInt(const char** pStr, int* pResult) { - char* end = nil; + char* end = NULL; - if (*pStr == nil) { + if (*pStr == NULL) { assert(false); return -1; } *pResult = (int) strtol(*pStr, &end, 10); - if (end == nil) - *pStr = nil; + if (end == NULL) + *pStr = NULL; else *pStr = end+1; @@ -1812,9 +1812,9 @@ Win32VolumeAccess::ASPIBlockAccess::ReadBlocks(long startBlock, short blockCount assert((fChunkSize % kBlockSize) == 0); /* alloc chunk buffer on first use */ - if (fLastChunkCache == nil) { + if (fLastChunkCache == NULL) { fLastChunkCache = new unsigned char[fChunkSize]; - if (fLastChunkCache == nil) + if (fLastChunkCache == NULL) return kDIErrMalloc; assert(fLastChunkNum == -1); } @@ -1973,7 +1973,7 @@ Win32VolumeAccess::ASPIBlockAccess::WriteBlocks(long startBlock, short blockCoun DIError Win32VolumeAccess::ASPIBlockAccess::Close(void) { - fpASPI = nil; + fpASPI = NULL; return kDIErrNone; } #endif diff --git a/diskimg/Win32BlockIO.h b/diskimg/Win32BlockIO.h index 25cc82e..b7cf301 100644 --- a/diskimg/Win32BlockIO.h +++ b/diskimg/Win32BlockIO.h @@ -238,7 +238,7 @@ private: class LogicalBlockAccess : public BlockAccess { public: LogicalBlockAccess(void) : fHandle(NULL), fIsCDROM(false), - fDriveNum(-1), fLastSectorCache(nil), fLastSectorNum(-1) + fDriveNum(-1), fLastSectorCache(NULL), fLastSectorNum(-1) {} virtual ~LogicalBlockAccess(void) { if (fHandle != NULL) { @@ -357,9 +357,9 @@ private: */ class ASPIBlockAccess : public BlockAccess { public: - ASPIBlockAccess(void) : fpASPI(nil), + ASPIBlockAccess(void) : fpASPI(NULL), fAdapter(0xff), fTarget(0xff), fLun(0xff), fReadOnly(false), - fLastChunkCache(nil), fLastChunkNum(-1), fChunkSize(-1) + fLastChunkCache(NULL), fLastChunkNum(-1), fChunkSize(-1) {} virtual ~ASPIBlockAccess(void) { delete[] fLastChunkCache; } diff --git a/mdc/AboutDlg.cpp b/mdc/AboutDlg.cpp index ce6cfb4..b168d2b 100644 --- a/mdc/AboutDlg.cpp +++ b/mdc/AboutDlg.cpp @@ -43,7 +43,7 @@ BOOL AboutDlg::OnInitDialog() // TODO: Add extra initialization here CWnd* pWnd = GetDlgItem(IDC_ABOUT_VERS); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); CString fmt, newText; pWnd->GetWindowText(fmt); diff --git a/mdc/Main.cpp b/mdc/Main.cpp index 55ca3b0..55b2c7e 100644 --- a/mdc/Main.cpp +++ b/mdc/Main.cpp @@ -173,8 +173,8 @@ MainWindow::PeekAndPump(void) /*static*/ void MainWindow::DebugMsgHandler(const char* file, int line, const char* msg) { - ASSERT(file != nil); - ASSERT(msg != nil); + ASSERT(file != NULL); + ASSERT(msg != NULL); LOG_BASE(DebugLog::LOG_INFO, file, line, " %hs", msg); } @@ -242,7 +242,7 @@ MainWindow::ScanFiles(void) WMSG1("NEW FILE '%ls'\n", (LPCWSTR) outPath); scanOpts.outfp = _wfopen(outPath, L"w"); - if (scanOpts.outfp == nil) { + if (scanOpts.outfp == NULL) { ShowFailureMsg(this, "Unable to open output file", IDS_FAILED); goto bail; } @@ -276,7 +276,7 @@ MainWindow::ScanFiles(void) doResetDir = true; time_t now; - now = time(nil); + now = time(NULL); fprintf(scanOpts.outfp, "Run started at %.24hs in '%ls'\n\n", ctime(&now), buf); @@ -286,7 +286,7 @@ MainWindow::ScanFiles(void) /* create a modeless dialog with a cancel button */ scanOpts.pProgress = new ProgressDlg; - if (scanOpts.pProgress == nil) + if (scanOpts.pProgress == NULL) goto bail; scanOpts.pProgress->fpCancelFlag = &fCancelFlag; fCancelFlag = false; @@ -298,7 +298,7 @@ MainWindow::ScanFiles(void) } time_t start, end; - start = time(nil); + start = time(NULL); /* start cranking */ buf += chooseFiles.GetFileNameOffset(); @@ -315,7 +315,7 @@ MainWindow::ScanFiles(void) buf += wcslen(buf)+1; } - end = time(nil); + end = time(NULL); fprintf(scanOpts.outfp, "\nScan completed in %ld seconds.\n", end - start); @@ -337,7 +337,7 @@ MainWindow::ScanFiles(void) } bail: - if (scanOpts.outfp != nil) + if (scanOpts.outfp != NULL) fclose(scanOpts.outfp); if (doResetDir && SetCurrentDirectory(curDir) == false) { @@ -349,7 +349,7 @@ bail: // restore the main window EnableWindow(TRUE); - if (scanOpts.pProgress != nil) + if (scanOpts.pProgress != NULL) scanOpts.pProgress->DestroyWindow(); SetWindowText(L"MDC"); @@ -375,15 +375,15 @@ static const WCHAR kWildMatchAll[] = L"*.*"; Win32dirent* MainWindow::OpenDir(const WCHAR* name) { - Win32dirent* dir = nil; - WCHAR* tmpStr = nil; + Win32dirent* dir = NULL; + WCHAR* tmpStr = NULL; WCHAR* cp; WIN32_FIND_DATA fnd; dir = (Win32dirent*) malloc(sizeof(*dir)); tmpStr = (WCHAR*) malloc((wcslen(name) + wcslen(kWildMatchAll) + 2) * sizeof(WCHAR)); - if (dir == nil || tmpStr == nil) + if (dir == NULL || tmpStr == NULL) goto failed; wcscpy(tmpStr, name); @@ -413,14 +413,14 @@ bail: failed: free(dir); - dir = nil; + dir = NULL; goto bail; } /* * 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* MainWindow::ReadDir(Win32dirent* dir) @@ -431,7 +431,7 @@ MainWindow::ReadDir(Win32dirent* dir) WIN32_FIND_DATA fnd; if (!FindNextFile(dir->d_hFindFile, &fnd)) - return nil; + return NULL; wcscpy(dir->d_name, fnd.cFileName); dir->d_attr = (unsigned char) fnd.dwFileAttributes; } @@ -445,7 +445,7 @@ MainWindow::ReadDir(Win32dirent* dir) void MainWindow::CloseDir(Win32dirent* dir) { - if (dir == nil) + if (dir == NULL) return; FindClose(dir->d_hFindFile); @@ -469,8 +469,8 @@ MainWindow::Process(const WCHAR* pathname, ScanOpts* pScanOpts, if (fCancelFlag) return -1; - ASSERT(pathname != nil); - ASSERT(pErrMsg != nil); + ASSERT(pathname != NULL); + ASSERT(pErrMsg != NULL); PathName checkPath(pathname); int ierr = checkPath.CheckFileStatus(&sb, &exists, &isReadable, &isDir); @@ -513,20 +513,20 @@ int MainWindow::ProcessDirectory(const WCHAR* dirName, ScanOpts* pScanOpts, CString* pErrMsg) { - Win32dirent* dirp = nil; + Win32dirent* dirp = NULL; Win32dirent* entry; WCHAR nbuf[MAX_PATH]; /* malloc might be better; this soaks stack */ WCHAR fssep; int len; int result = -1; - ASSERT(dirName != nil); - ASSERT(pErrMsg != nil); + ASSERT(dirName != NULL); + ASSERT(pErrMsg != NULL); WMSG1("+++ DESCEND: '%ls'\n", (LPCWSTR) dirName); dirp = OpenDir(dirName); - if (dirp == nil) { + if (dirp == NULL) { pErrMsg->Format(L"Failed on '%ls': %hs", dirName, strerror(errno)); goto bail; } @@ -534,7 +534,7 @@ MainWindow::ProcessDirectory(const WCHAR* dirName, ScanOpts* pScanOpts, fssep = kLocalFssep; /* 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 */ if (wcscmp(entry->d_name, L".") == 0 || wcscmp(entry->d_name, L"..") == 0) continue; @@ -561,7 +561,7 @@ MainWindow::ProcessDirectory(const WCHAR* dirName, ScanOpts* pScanOpts, result = 0; bail: - if (dirp != nil) + if (dirp != NULL) (void)CloseDir(dirp); return result; } @@ -575,14 +575,14 @@ bail: int MainWindow::ScanDiskImage(const WCHAR* pathName, ScanOpts* pScanOpts) { - ASSERT(pathName != nil); - ASSERT(pScanOpts != nil); - ASSERT(pScanOpts->outfp != nil); + ASSERT(pathName != NULL); + ASSERT(pScanOpts != NULL); + ASSERT(pScanOpts->outfp != NULL); DIError dierr; CString errMsg; DiskImg diskImg; - DiskFS* pDiskFS = nil; + DiskFS* pDiskFS = NULL; PathName path(pathName); CString ext = path.GetExtension(); @@ -628,7 +628,7 @@ MainWindow::ScanDiskImage(const WCHAR* pathName, ScanOpts* pScanOpts) /* create an appropriate DiskFS object */ pDiskFS = diskImg.OpenAppropriateDiskFS(); - if (pDiskFS == nil) { + if (pDiskFS == NULL) { /* unknown FS should've been caught above! */ ASSERT(false); errMsg.Format(L"Format of '%ls' not recognized.", pathName); @@ -803,12 +803,12 @@ MainWindow::LoadDiskFSContents(DiskFS* pDiskFS, const char* volName, ScanOpts* pScanOpts) { static const char* kBlankFileName = ""; - DiskFS::SubVolume* pSubVol = nil; + DiskFS::SubVolume* pSubVol = NULL; A2File* pFile; - ASSERT(pDiskFS != nil); - pFile = pDiskFS->GetNextFile(nil); - for ( ; pFile != nil; pFile = pDiskFS->GetNextFile(pFile)) { + ASSERT(pDiskFS != NULL); + pFile = pDiskFS->GetNextFile(NULL); + for ( ; pFile != NULL; pFile = pDiskFS->GetNextFile(pFile)) { CStringA subVolName, dispName; RecordKind recordKind; LONGLONG totalLen, totalCompLen; @@ -827,7 +827,7 @@ MainWindow::LoadDiskFSContents(DiskFS* pDiskFS, const char* volName, subVolName.Format("_%hs", volName); const char* ccp = pFile->GetPathName(); - ASSERT(ccp != nil); + ASSERT(ccp != NULL); if (strlen(ccp) == 0) ccp = kBlankFileName; @@ -1005,13 +1005,13 @@ MainWindow::LoadDiskFSContents(DiskFS* pDiskFS, const char* volName, /* * Load all sub-volumes. */ - pSubVol = pDiskFS->GetNextSubVolume(nil); - while (pSubVol != nil) { + pSubVol = pDiskFS->GetNextSubVolume(NULL); + while (pSubVol != NULL) { const char* subVolName; int ret; subVolName = pSubVol->GetDiskFS()->GetVolumeName(); - if (subVolName == nil) + if (subVolName == NULL) subVolName = "+++"; // could probably do better than this ret = LoadDiskFSContents(pSubVol->GetDiskFS(), subVolName, pScanOpts); diff --git a/mdc/ProgressDlg.cpp b/mdc/ProgressDlg.cpp index 11bf1cd..5b37965 100644 --- a/mdc/ProgressDlg.cpp +++ b/mdc/ProgressDlg.cpp @@ -27,7 +27,7 @@ ProgressDlg::ProgressDlg(CWnd* pParent /*=NULL*/) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT - fpCancelFlag = nil; + fpCancelFlag = NULL; } #endif @@ -63,7 +63,7 @@ void ProgressDlg::SetCurrentFile(const WCHAR* fileName) { CWnd* pWnd = GetDlgItem(IDC_PROGRESS_FILENAME); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->SetWindowText(fileName); } @@ -71,7 +71,7 @@ void ProgressDlg::OnCancel() { // TODO: Add extra cleanup here WMSG0("Cancel button pushed\n"); - ASSERT(fpCancelFlag != nil); + ASSERT(fpCancelFlag != NULL); *fpCancelFlag = true; //CDialog::OnCancel(); diff --git a/mdc/mdc.cpp b/mdc/mdc.cpp index b13d49e..a5c2d43 100644 --- a/mdc/mdc.cpp +++ b/mdc/mdc.cpp @@ -25,7 +25,7 @@ MyApp::MyApp(LPCTSTR lpszAppName) : CWinApp(lpszAppName) // TODO: make the log file configurable gDebugLog = new DebugLog(L"C:\\src\\mdclog.txt"); - time_t now = time(nil); + time_t now = time(NULL); LOGI("MDC v%d.%d.%d started at %.24hs\n", kAppMajorVersion, kAppMinorVersion, kAppBugVersion, ctime(&now)); diff --git a/reformat/AWGS.cpp b/reformat/AWGS.cpp index ef49d8f..f69d5b0 100644 --- a/reformat/AWGS.cpp +++ b/reformat/AWGS.cpp @@ -264,7 +264,7 @@ ReformatAWGS_WP::PrintChunk(const Chunk* pChunk) * small (e.g. 7 for a 16K doc). */ blockPtr = FindTextBlock(pChunk, sae.textBlock); - if (blockPtr == nil) { + if (blockPtr == NULL) { WMSG1("AWGS_WP bad textBlock %d\n", sae.textBlock); return; } diff --git a/reformat/Asm.cpp b/reformat/Asm.cpp index 114452b..8108400 100644 --- a/reformat/Asm.cpp +++ b/reformat/Asm.cpp @@ -958,7 +958,7 @@ ReformatLISA3::Process(const ReformatHolder* pHolder, retval = 0; bail: - fSymTab = nil; + fSymTab = NULL; return retval; } @@ -1600,7 +1600,7 @@ ReformatLISA4::Process(const ReformatHolder* pHolder, } if (fSymCount > 0) { fSymTab = new const unsigned char*[fSymCount]; - if (fSymTab == nil) + if (fSymTab == NULL) goto bail; } @@ -1727,7 +1727,7 @@ ReformatLISA4::Process(const ReformatHolder* pHolder, bail: delete[] fSymTab; - fSymTab = nil; + fSymTab = NULL; return retval; } diff --git a/reformat/Asm.h b/reformat/Asm.h index 34ab509..16088b0 100644 --- a/reformat/Asm.h +++ b/reformat/Asm.h @@ -129,7 +129,7 @@ private: */ class ReformatLISA3 : public ReformatAsm { public: - ReformatLISA3(void) : fSymTab(nil) {} + ReformatLISA3(void) : fSymTab(NULL) {} virtual ~ReformatLISA3(void) {} virtual void Examine(ReformatHolder* pHolder); @@ -197,7 +197,7 @@ private: */ class ReformatLISA4 : public ReformatAsm { public: - ReformatLISA4(void) : fSymTab(nil) {} + ReformatLISA4(void) : fSymTab(NULL) {} virtual ~ReformatLISA4(void) { delete[] fSymTab; } virtual void Examine(ReformatHolder* pHolder); diff --git a/reformat/Disasm.cpp b/reformat/Disasm.cpp index b277269..05ba419 100644 --- a/reformat/Disasm.cpp +++ b/reformat/Disasm.cpp @@ -236,7 +236,7 @@ ReformatDisasm65xxx::OutputMonitor8(const unsigned char* srcBuf, long srcLen, const char* callName; callName = NiftyList::LookupP8MLI(srcBuf[3]); - if (callName == nil) + if (callName == NULL) callName = "(Unknown P8 MLI)"; PrintMonitor8Line(opCode, addrMode, addr, srcBuf, bytesUsed, callName); BufPrintf("%04X- %02X $%02X", @@ -253,9 +253,9 @@ ReformatDisasm65xxx::OutputMonitor8(const unsigned char* srcBuf, long srcLen, memset(tmpBuf, 0, kMaxByteConsumption); memcpy(tmpBuf, srcBuf, srcLen); - PrintMonitor8Line(opCode, addrMode, addr, tmpBuf, bytesUsed, nil); + PrintMonitor8Line(opCode, addrMode, addr, tmpBuf, bytesUsed, NULL); } else { - PrintMonitor8Line(opCode, addrMode, addr, srcBuf, bytesUsed, nil); + PrintMonitor8Line(opCode, addrMode, addr, srcBuf, bytesUsed, NULL); } @@ -340,7 +340,7 @@ ReformatDisasm65xxx::PrintMonitor8Line(OpCode opCode, AddrMode addrMode, case kAddrAbs: cp += sprintf(cp, " $%02X%02X", byte2, byte1); - if (comment == nil) + if (comment == NULL) comment = NiftyList::Lookup00Addr(byte1 | byte2 << 8); break; case kAddrAbsIndexX: @@ -386,7 +386,7 @@ ReformatDisasm65xxx::PrintMonitor8Line(OpCode opCode, AddrMode addrMode, } assert(strlen(cp)+1 < sizeof(lineBuf)); - if (comment == nil) + if (comment == NULL) BufPrintf("%s", lineBuf); else BufPrintf("%s %s", lineBuf, comment); @@ -422,7 +422,7 @@ ReformatDisasm65xxx::OutputMonitor16(const unsigned char* srcBuf, long srcLen, if (Bank(addr) == 0 && IsP8Call(srcBuf, srcLen)) { /* print and skip P8 inline call stuff */ callName = NiftyList::LookupP8MLI(srcBuf[3]); - if (callName == nil) + if (callName == NULL) callName = "(Unknown P8 MLI)"; PrintMonitor16Line(opCode, addrMode, addr, srcBuf, bytesUsed, callName); BufPrintf("00/%04X: %02X %02X", @@ -461,9 +461,9 @@ ReformatDisasm65xxx::OutputMonitor16(const unsigned char* srcBuf, long srcLen, memset(tmpBuf, 0, kMaxByteConsumption); memcpy(tmpBuf, srcBuf, srcLen); - PrintMonitor16Line(opCode, addrMode, addr, tmpBuf, bytesUsed, nil); + PrintMonitor16Line(opCode, addrMode, addr, tmpBuf, bytesUsed, NULL); } else { - PrintMonitor16Line(opCode, addrMode, addr, srcBuf, bytesUsed, nil); + PrintMonitor16Line(opCode, addrMode, addr, srcBuf, bytesUsed, NULL); } return bytesUsed; @@ -568,7 +568,7 @@ ReformatDisasm65xxx::PrintMonitor16Line(OpCode opCode, AddrMode addrMode, case kAddrAbs: cp += sprintf(cp, " %02X%02X", byte2, byte1); - if (comment == nil && Bank(addr) == 0) + if (comment == NULL && Bank(addr) == 0) comment = NiftyList::Lookup00Addr(byte1 | byte2 << 8); break; case kAddrAbsIndexX: @@ -594,7 +594,7 @@ ReformatDisasm65xxx::PrintMonitor16Line(OpCode opCode, AddrMode addrMode, break; case kAddrAbsLong: cp += sprintf(cp, " %02X%02X%02X", byte3, byte2, byte1); - if (comment == nil) { + if (comment == NULL) { if (byte3 == 0x00) comment = NiftyList::Lookup00Addr(byte1 | byte2 << 8); else if (byte3 == 0x01) @@ -648,7 +648,7 @@ ReformatDisasm65xxx::PrintMonitor16Line(OpCode opCode, AddrMode addrMode, } assert(strlen(cp)+1 < sizeof(lineBuf)); - if (comment == nil) + if (comment == NULL) BufPrintf("%s", lineBuf); else { if (srcLen < 4) @@ -1011,8 +1011,8 @@ ReformatDisasm16::PrintSegment(const OMFSegmentHeader* pSegHdr, unsigned long subLen; int offset = 0; - assert(pSegHdr != nil); - assert(srcBuf != nil); + assert(pSegHdr != NULL); + assert(srcBuf != NULL); assert(srcLen > 0); srcBuf += pSegHdr->GetDispData(); @@ -1039,7 +1039,7 @@ ReformatDisasm16::PrintSegment(const OMFSegmentHeader* pSegHdr, do { ptr = seg.ProcessNextChunk(); - if (ptr == nil) { + if (ptr == NULL) { BufPrintf("!!! bogus OMF values encountered\r\n"); return; } @@ -1337,7 +1337,7 @@ OMFSegment::Setup(const OMFSegmentHeader* pSegHdr, const unsigned char* srcBuf, /* * Process the next chunk from the segment. * - * Returns a pointer to the start of the chunk, or "nil" if we've encountered + * Returns a pointer to the start of the chunk, or "NULL" if we've encountered * some bogus condition (e.g. running off the end). */ const unsigned char* @@ -1434,7 +1434,7 @@ OMFSegment::ProcessNextChunk(void) subLen = Get32LE(fCurPtr+1); // assumes fNumLen==4 WMSG2(" OMF found 'reserved' len=%lu (remLen=%ld)\n", subLen, remLen); if (subLen > (unsigned long) remLen) - return nil; + return NULL; len += subLen + fNumLen; break; default: diff --git a/reformat/Disasm.h b/reformat/Disasm.h index a00b134..4610517 100644 --- a/reformat/Disasm.h +++ b/reformat/Disasm.h @@ -305,7 +305,7 @@ private: */ class OMFSegment { public: - OMFSegment(void) : fSegBuf(nil), fSegLen(-1), fCurPtr(nil), + OMFSegment(void) : fSegBuf(NULL), fSegLen(-1), fCurPtr(NULL), fNumLen(-1), fLabLen(-1) {} virtual ~OMFSegment(void) {} diff --git a/reformat/DoubleHiRes.cpp b/reformat/DoubleHiRes.cpp index fcf9fe3..2539b7a 100644 --- a/reformat/DoubleHiRes.cpp +++ b/reformat/DoubleHiRes.cpp @@ -126,7 +126,7 @@ ReformatDHR::Process(const ReformatHolder* pHolder, InitColorLookup(); pDib = DHRScreenToBitmap(srcBuf); - if (pDib == nil) + if (pDib == NULL) goto bail; SetResultBuffer(pOutput, pDib); @@ -214,14 +214,14 @@ ReformatDHR::DHRScreenToBitmap(const unsigned char* buf) ASSERT(kOutputWidth == kPixelsPerLine); - if (pDib == nil) + if (pDib == NULL) goto bail; outBuf = (unsigned char*) pDib->Create(kOutputWidth, kOutputHeight, 4, kNumColors); - if (outBuf == nil) { + if (outBuf == NULL) { delete pDib; - pDib = nil; + pDib = NULL; goto bail; } pDib->SetColorTable(colorConv); diff --git a/reformat/DreamGrafix.cpp b/reformat/DreamGrafix.cpp index 78afce8..8f8f685 100644 --- a/reformat/DreamGrafix.cpp +++ b/reformat/DreamGrafix.cpp @@ -47,7 +47,7 @@ ReformatDG256SHR::Process(const ReformatHolder* pHolder, if (fDG.UnpackDG(srcBuf, srcLen, &fScreen, NULL)) { MyDIBitmap* pDib = SHRScreenToBitmap8(&fScreen); - if (pDib != nil) { + if (pDib != NULL) { SetResultBuffer(pOutput, pDib); retval = 0; } @@ -92,7 +92,7 @@ ReformatDG3200SHR::Process(const ReformatHolder* pHolder, if (fDG.UnpackDG(srcBuf, srcLen, &fScreen, fExtColorTable)) { MyDIBitmap* pDib = SHR3200ToBitmap24(); - if (pDib != nil) { + if (pDib != NULL) { SetResultBuffer(pOutput, pDib); retval = 0; } diff --git a/reformat/HiRes.cpp b/reformat/HiRes.cpp index 534d2df..0ad2c8f 100644 --- a/reformat/HiRes.cpp +++ b/reformat/HiRes.cpp @@ -244,7 +244,7 @@ ReformatHiRes::Process(const ReformatHolder* pHolder, InitLineOffset(fLineOffset); pDib = HiResScreenToBitmap(srcBuf); - if (pDib == nil) + if (pDib == NULL) goto bail; SetResultBuffer(pOutput, pDib); @@ -265,7 +265,7 @@ ReformatHiRes::InitLineOffset(int* pOffsetBuf) long offset; int line; - ASSERT(pOffsetBuf != nil); + ASSERT(pOffsetBuf != NULL); for (line = 0; line < kNumLines; line++) { offset = (line & 0x07) << 10 | (line & 0x38) << 4 | @@ -316,14 +316,14 @@ ReformatHiRes::HiResScreenToBitmap(const unsigned char* buf) ASSERT(kOutputWidth == 2*kPixelsPerLine); - if (pDib == nil) + if (pDib == NULL) goto bail; outBuf = (unsigned char*) pDib->Create(kOutputWidth, kOutputHeight, 4, kNumColors); - if (outBuf == nil) { + if (outBuf == NULL) { delete pDib; - pDib = nil; + pDib = NULL; goto bail; } pDib->SetColorTable(colorConv); diff --git a/reformat/MacPaint.cpp b/reformat/MacPaint.cpp index a5bcaff..d0c743b 100644 --- a/reformat/MacPaint.cpp +++ b/reformat/MacPaint.cpp @@ -94,7 +94,7 @@ ReformatMacPaint::Process(const ReformatHolder* pHolder, } pDib = ConvertMacPaint(srcBuf, srcLen); - if (pDib == nil) + if (pDib == NULL) goto bail; SetResultBuffer(pOutput, pDib); @@ -113,7 +113,7 @@ bail: MyDIBitmap* ReformatMacPaint::ConvertMacPaint(const unsigned char* srcBuf, long length) { - MyDIBitmap* pDib = nil; + MyDIBitmap* pDib = NULL; unsigned char* outBuf; static const RGBQUAD colorConv[2] = { /* blue, green, red, reserved */ @@ -137,7 +137,7 @@ ReformatMacPaint::ConvertMacPaint(const unsigned char* srcBuf, long length) } pDib = new MyDIBitmap; - if (pDib == nil) + if (pDib == NULL) goto bail; srcBuf += offset; @@ -148,9 +148,9 @@ ReformatMacPaint::ConvertMacPaint(const unsigned char* srcBuf, long length) outBuf = (unsigned char*) pDib->Create(kOutputWidth, kOutputHeight, 1, kNumColors); - if (outBuf == nil) { + if (outBuf == NULL) { delete pDib; - pDib = nil; + pDib = NULL; goto bail; } pDib->SetColorTable(colorConv); diff --git a/reformat/NiftyList.cpp b/reformat/NiftyList.cpp index e3225c3..ea645b5 100644 --- a/reformat/NiftyList.cpp +++ b/reformat/NiftyList.cpp @@ -44,7 +44,7 @@ /*static*/ NiftyList::DataSet NiftyList::f00Addrs = { 0 }; /*static*/ NiftyList::DataSet NiftyList::f01Vectors = { 0 }; -/*static*/ char* NiftyList::fFileData = nil; +/*static*/ char* NiftyList::fFileData = NULL; /*static*/ bool NiftyList::fDataReady = false; /* @@ -53,7 +53,7 @@ /*static*/ bool NiftyList::AppInit(const WCHAR* fileName) { - FILE* fp = nil; + FILE* fp = NULL; long fileLen; char* pData; bool result = false; @@ -62,7 +62,7 @@ NiftyList::AppInit(const WCHAR* fileName) * Open the NList.Data file and load the contents into memory. */ fp = _wfopen(fileName, L"rb"); - if (fp == nil) { + if (fp == NULL) { WMSG1("NL Unable to open '%ls'\n", fileName); goto bail; } else { @@ -77,7 +77,7 @@ NiftyList::AppInit(const WCHAR* fileName) rewind(fp); fFileData = new char[fileLen]; - if (fFileData == nil) { + if (fFileData == NULL) { WMSG1("Failed allocating %d bytes\n", fileLen); goto bail; } @@ -97,7 +97,7 @@ NiftyList::AppInit(const WCHAR* fileName) goto bail; if (!ReadSection(&pData, &fileLen, &fSystemTools, kModeNormal)) goto bail; - if (!ReadSection(&pData, &fileLen, nil, kModeSkip)) // user tools + if (!ReadSection(&pData, &fileLen, NULL, kModeSkip)) // user tools goto bail; if (!ReadSection(&pData, &fileLen, &fE1Vectors, kModeNormal)) goto bail; @@ -116,7 +116,7 @@ NiftyList::AppInit(const WCHAR* fileName) WMSG0("NL NiftyList data loaded\n"); bail: - if (fp != nil) + if (fp != NULL) fclose(fp); return result; } @@ -152,11 +152,11 @@ NiftyList::AppCleanup(void) NiftyList::ReadSection(char** ppData, long* pRemLen, DataSet* pSet, LoadMode mode) { - assert(ppData != nil); - assert(pRemLen != nil); - assert(*ppData != nil); + assert(ppData != NULL); + assert(pRemLen != NULL); + assert(*ppData != NULL); assert(*pRemLen > 0); - assert(pSet != nil || mode == kModeSkip); + assert(pSet != NULL || mode == kModeSkip); assert(mode == kModeNormal || mode == kModeSkip); char* pData = *ppData; @@ -196,10 +196,10 @@ NiftyList::ReadSection(char** ppData, long* pRemLen, DataSet* pSet, /* * Allocate storage for the lookup array. */ - assert(pSet->numEntries == 0 && pSet->pEntries == nil); + assert(pSet->numEntries == 0 && pSet->pEntries == NULL); pSet->pEntries = new NameValue[numLines]; - if (pSet->pEntries == nil) { + if (pSet->pEntries == NULL) { WMSG0("NameValue alloc failed\n"); return false; } @@ -348,7 +348,7 @@ NiftyList::DumpSection(const DataSet& dataSet) /* - * Look up a value in the specified table. Returns the name, or "nil" if + * Look up a value in the specified table. Returns the name, or "NULL" if * not found. * * This uses a binary search, so the entries must be in sorted order. @@ -374,5 +374,5 @@ NiftyList::Lookup(const DataSet& dataSet, unsigned short key) return dataSet.pEntries[mid].name; } - return nil; + return NULL; } diff --git a/reformat/PascalFiles.cpp b/reformat/PascalFiles.cpp index 7d2a8be..6486641 100644 --- a/reformat/PascalFiles.cpp +++ b/reformat/PascalFiles.cpp @@ -280,7 +280,7 @@ bail: void ReformatPascalText::ProcessBlock(const unsigned char* srcBuf, long length) { - ASSERT(srcBuf != nil); + ASSERT(srcBuf != NULL); ASSERT(length > 0 && length <= kPTXBlockSize); char lineBuf[kPTXBlockSize+1]; diff --git a/reformat/PrintShop.cpp b/reformat/PrintShop.cpp index a10579d..60db858 100644 --- a/reformat/PrintShop.cpp +++ b/reformat/PrintShop.cpp @@ -63,7 +63,7 @@ ReformatPrintShop::Process(const ReformatHolder* pHolder, ReformatHolder::ReformatID id, ReformatHolder::ReformatPart part, ReformatOutput* pOutput) { - MyDIBitmap* pDib = nil; + MyDIBitmap* pDib = NULL; const unsigned char* srcBuf = pHolder->GetSourceBuf(part); long srcLen = pHolder->GetSourceLen(part); @@ -76,7 +76,7 @@ ReformatPrintShop::Process(const ReformatHolder* pHolder, return -1; } - if (pDib == nil) { + if (pDib == NULL) { WMSG0("DIB creation failed\n"); return -1; } @@ -103,8 +103,8 @@ ReformatPrintShop::ConvertBW(const unsigned char* srcBuf) int pitch; int x, y; - if (pDib == nil) - return nil; + if (pDib == NULL) + return NULL; RGBQUAD colorConv[2]; colorConv[0].rgbRed = colorConv[0].rgbGreen = colorConv[0].rgbBlue = 255; @@ -112,9 +112,9 @@ ReformatPrintShop::ConvertBW(const unsigned char* srcBuf) colorConv[0].rgbReserved = colorConv[1].rgbReserved = 0; outBuf = (unsigned char*) pDib->Create(kWidth, kHeight, 1, 2); - if (outBuf == nil) { + if (outBuf == NULL) { delete pDib; - pDib = nil; + pDib = NULL; goto bail; } pDib->SetColorTable(colorConv); @@ -167,13 +167,13 @@ ReformatPrintShop::ConvertColor(const unsigned char* srcBuf) { 0x00, 0x00, 0x00 }, // 111 black }; - if (pDib == nil) - return nil; + if (pDib == NULL) + return NULL; outBuf = (unsigned char*) pDib->Create(kWidth, kHeight, 4, 8); - if (outBuf == nil) { + if (outBuf == NULL) { delete pDib; - pDib = nil; + pDib = NULL; goto bail; } pDib->SetColorTable(kColorConv); diff --git a/reformat/Reformat.cpp b/reformat/Reformat.cpp index f437b5a..3d09775 100644 --- a/reformat/Reformat.cpp +++ b/reformat/Reformat.cpp @@ -34,7 +34,7 @@ /*static*/ Reformat* ReformatHolder::GetReformatInstance(ReformatID id) { - Reformat* pReformat = nil; + Reformat* pReformat = NULL; switch (id) { case kReformatTextEOL_HA: pReformat = new ReformatEOL_HA; break; @@ -105,7 +105,7 @@ ReformatHolder::GetReformatInstance(ReformatID id) /*static*/ const WCHAR* ReformatHolder::GetReformatName(ReformatID id) { - const WCHAR* descr = nil; + const WCHAR* descr = NULL; switch (id) { case kReformatTextEOL_HA: @@ -279,8 +279,8 @@ ReformatHolder::SetSourceAttributes(long fileType, long auxType, fAuxType = auxType; fSourceFormat = sourceFormat; - assert(fNameExt == nil); - if (nameExt == nil) { + assert(fNameExt == NULL); + if (nameExt == NULL) { fNameExt = new char[1]; fNameExt[0] = '\0'; } else { @@ -330,7 +330,7 @@ ReformatHolder::TestApplicability(void) * than creating a separate table of pointers to static functions. */ pReformat = GetReformatInstance((ReformatID) i); - assert(pReformat != nil); + assert(pReformat != NULL); pReformat->Examine(this); delete pReformat; } @@ -430,7 +430,7 @@ ReformatHolder::FindBest(ReformatPart part) int i; /* if the source couldn't be loaded, just return "raw" */ - if (fErrorBuf[part] != nil) + if (fErrorBuf[part] != NULL) return kReformatRaw; /* @@ -471,21 +471,21 @@ ReformatHolder::Apply(ReformatPart part, ReformatID id) { WMSG2("Invalid reformat request (part=%d id=%d)\n", part, id); assert(false); - return nil; + return NULL; } /* create a place for the output */ pOutput = new ReformatOutput; - if (pOutput == nil) { + if (pOutput == NULL) { assert(false); - return nil; // alloc failure + return NULL; // alloc failure } /* * If the caller was unable to fill our source buffer, they will have * supplied us with an error message. Return that instead of the data. */ - if (fErrorBuf[part] != nil) { + if (fErrorBuf[part] != NULL) { pOutput->SetTextBuf(fErrorBuf[part], strlen(fErrorBuf[part]), false); pOutput->SetOutputKind(ReformatOutput::kOutputErrorMsg); pOutput->SetFormatDescr(L"Error Message"); @@ -502,7 +502,7 @@ ReformatHolder::Apply(ReformatPart part, ReformatID id) /* create an instance of a reformatter */ pReformat = GetReformatInstance(id); - assert(pReformat != nil); + assert(pReformat != NULL); result = pReformat->Process(this, id, part, pOutput); delete pReformat; @@ -512,7 +512,7 @@ ReformatHolder::Apply(ReformatPart part, ReformatID id) * This commonly happens on zero-length files. The chosen reformatter * rejects it, returns -1, and we return the source buffer. Since even * zero-length files are guaranteed to have some sort of allocated - * buffer, "pOutput" never points at nil. Unless, of course, a text + * buffer, "pOutput" never points at NULL. Unless, of course, a text * reformatter produces no output but still returns "success". */ if (result < 0) { @@ -533,7 +533,7 @@ ReformatHolder::GetSourceBuf(ReformatPart part) const { if (part <= kPartUnknown || part >= kPartMAX) { assert(false); - return nil; + return NULL; } return fSourceBuf[part]; @@ -547,7 +547,7 @@ ReformatHolder::GetSourceLen(ReformatPart part) const { if (part <= kPartUnknown || part >= kPartMAX) { assert(false); - return nil; + return NULL; } return fSourceLen[part]; @@ -570,7 +570,7 @@ ReformatHolder::SetSourceBuf(ReformatPart part, unsigned char* buf, assert(false); return; } - assert(buf != nil); + assert(buf != NULL); assert(len >= 0); fSourceBuf[part] = buf; @@ -585,9 +585,9 @@ ReformatHolder::SetSourceBuf(ReformatPart part, unsigned char* buf, void ReformatHolder::SetErrorMsg(ReformatPart part, const char* msg) { - assert(msg != nil && *msg != '\0'); + assert(msg != NULL && *msg != '\0'); assert(part > kPartUnknown && part < kPartMAX); - assert(fErrorBuf[part] == nil); + assert(fErrorBuf[part] == NULL); fErrorBuf[part] = strdup(msg); WMSG2("+++ set error message for part %d to '%hs'\n", part, msg); diff --git a/reformat/Reformat.h b/reformat/Reformat.h index 0ddaf16..a269fe1 100644 --- a/reformat/Reformat.h +++ b/reformat/Reformat.h @@ -205,9 +205,9 @@ public: continue; for (i = 0; i < kReformatMAX; i++) fApplies[part][i] = kApplicUnknown; - fSourceBuf[part] = nil; - fSourceLen[part] = nil; - fErrorBuf[part] = nil; + fSourceBuf[part] = NULL; + fSourceLen[part] = NULL; + fErrorBuf[part] = NULL; } for (i = 0; i < kReformatMAX; i++) { fAllow[i] = false; @@ -217,7 +217,7 @@ public: fFileType = fAuxType = 0; fSourceFormat = kSourceFormatGeneric; - fNameExt = nil; + fNameExt = NULL; } ~ReformatHolder(void) { WMSG0("In ~ReformatHolder\n"); @@ -350,7 +350,7 @@ private: long fFileType; long fAuxType; SourceFormat fSourceFormat; - char* fNameExt; // guaranteed non-nil + char* fNameExt; // guaranteed non-NULL /* input goes here */ unsigned char* fSourceBuf[kPartMAX]; @@ -380,10 +380,10 @@ public: //fOutputID fOutputFormatDescr(L"(none)"), fMultipleFonts(false), - fTextBuf(nil), + fTextBuf(NULL), fTextLen(-1), fDoDeleteText(true), - fpDIB(nil) + fpDIB(NULL) {} virtual ~ReformatOutput(void) { if (fDoDeleteText) @@ -415,14 +415,14 @@ public: // TODO: split into two different functions, one takes const char* and // doesn't delete, the other char* and does delete void SetTextBuf(char* buf, long len, bool doDelete) { - assert(fTextBuf == nil); + assert(fTextBuf == NULL); fTextBuf = buf; fTextLen = len; fDoDeleteText = doDelete; } void SetDIB(MyDIBitmap* pDIB) { - ASSERT(fpDIB == nil); + ASSERT(fpDIB == NULL); fpDIB = pDIB; } @@ -435,7 +435,7 @@ private: /* output RTF uses multiple fonts, so ignore font change request */ bool fMultipleFonts; - /* storage; either fTextBuf or fpDIB will be nil */ + /* storage; either fTextBuf or fpDIB will be NULL */ char* fTextBuf; long fTextLen; bool fDoDeleteText; @@ -474,7 +474,7 @@ public: } static const char* Lookup00Addr(unsigned short addr) { //if (addr < 0xc000) - // return nil; // ignore Davex Bxxx values + // return NULL; // ignore Davex Bxxx values return Lookup(f00Addrs, addr); } static const char* Lookup01Vector(unsigned short addr) { diff --git a/reformat/ReformatBase.cpp b/reformat/ReformatBase.cpp index 4da5a54..36dbcd9 100644 --- a/reformat/ReformatBase.cpp +++ b/reformat/ReformatBase.cpp @@ -90,7 +90,7 @@ const int kUnk = 0x3f; // for unmappable chars, use '?' 0xba, // 0xbc o underbar (masculine ordinal) [using raised o] kUnk, // 0xbd omega (Ohm) 0xe6, // 0xbe merged ae - 0xf8, // 0xbf o + slash (lower-case nil?) + 0xf8, // 0xbf o + slash (lower-case NULL?) 0xbf, // 0xc0 upside-down question mark 0xa1, // 0xc1 upside-down exclamation point 0xac, // 0xc2 rotated L ("not" sign) @@ -199,7 +199,7 @@ ReformatText::SetResultBuffer(ReformatOutput* pOutput, bool multiFont) fExpBuf.SeizeBuffer(&buf, &len); pOutput->SetTextBuf(buf, len, true); - if (pOutput->GetTextBuf() == nil) { + if (pOutput->GetTextBuf() == NULL) { /* * Force "raw" mode if there's no output. This can happen if we, * say, try to format an empty file as a hex dump. We never @@ -210,7 +210,7 @@ ReformatText::SetResultBuffer(ReformatOutput* pOutput, bool multiFont) * it's possible the length will be zero, we promise that there'll * be a buffer there. I'm not sure it's important to do this, * but it does reduce the #of situations in which we have to - * worry about nil pointers. + * worry about NULL pointers. */ pOutput->SetOutputKind(ReformatOutput::kOutputRaw); WMSG0("ReformatText returning a null pointer\n"); @@ -767,7 +767,7 @@ ReformatText::BufHexDump(const unsigned char* srcBuf, long srcLen) char chBuf[17]; int i, remLen; - ASSERT(srcBuf != nil); + ASSERT(srcBuf != NULL); ASSERT(srcLen >= 0); chBuf[16] = '\0'; @@ -897,8 +897,8 @@ ReformatGraphics::InitPalette(void) void ReformatGraphics::SetResultBuffer(ReformatOutput* pOutput, MyDIBitmap* pDib) { - ASSERT(pOutput != nil); - ASSERT(pDib != nil); + ASSERT(pOutput != NULL); + ASSERT(pDib != NULL); pOutput->SetOutputKind(ReformatOutput::kOutputBitmap); pOutput->SetDIB(pDib); } diff --git a/reformat/SuperHiRes.cpp b/reformat/SuperHiRes.cpp index 65cdaa5..6fa848f 100644 --- a/reformat/SuperHiRes.cpp +++ b/reformat/SuperHiRes.cpp @@ -65,7 +65,7 @@ ReformatSHR::SHRDataToBitmap8(const unsigned char* pPixels, unsigned char* outBuf; int line; - if (pDib == nil) + if (pDib == NULL) goto bail; /* @@ -74,9 +74,9 @@ ReformatSHR::SHRDataToBitmap8(const unsigned char* pPixels, */ outBuf = (unsigned char*) pDib->Create(outputWidth, outputHeight, 8, kNumColorTables * kNumEntriesPerColorTable); - if (outBuf == nil) { + if (outBuf == NULL) { delete pDib; - pDib = nil; + pDib = NULL; goto bail; } @@ -274,7 +274,7 @@ ReformatUnpackedSHR::Process(const ReformatHolder* pHolder, memcpy(&fScreen, pHolder->GetSourceBuf(part), sizeof(fScreen)); pDib = SHRScreenToBitmap8(&fScreen); - if (pDib == nil) + if (pDib == NULL) goto bail; SetResultBuffer(pOutput, pDib); @@ -347,7 +347,7 @@ ReformatJEQSHR::Process(const ReformatHolder* pHolder, memcpy(&fScreen.colorTable, srcBuf + 0x7e00, 32); pDib = SHRScreenToBitmap8(&fScreen); - if (pDib == nil) + if (pDib == NULL) goto bail; SetResultBuffer(pOutput, pDib); @@ -417,7 +417,7 @@ ReformatPaintworksSHR::Process(const ReformatHolder* pHolder, const int kPWDataOffset = 0x222; unsigned char scb[kPWOutputLines]; unsigned char colorTable[kNumEntriesPerColorTable * kColorTableEntrySize]; - unsigned char* unpackBuf = nil; + unsigned char* unpackBuf = NULL; int retval = -1; int i, result; @@ -442,7 +442,7 @@ ReformatPaintworksSHR::Process(const ReformatHolder* pHolder, * have 396 lines and only recognizes that many. */ unpackBuf = new unsigned char[kPWOutputSize]; - if (unpackBuf == nil) + if (unpackBuf == NULL) goto bail; memset(unpackBuf, 0, sizeof(unpackBuf)); // in case we fall short @@ -461,7 +461,7 @@ ReformatPaintworksSHR::Process(const ReformatHolder* pHolder, pHolder->GetSourceLen(part)) == 0) { pDib = SHRScreenToBitmap8(&fScreen); - if (pDib == nil) + if (pDib == NULL) goto bail; goto gotit; } @@ -472,7 +472,7 @@ ReformatPaintworksSHR::Process(const ReformatHolder* pHolder, scb[i] = 0; // 320 mode pDib = SHRDataToBitmap8(unpackBuf, scb, colorTable, kPixelBytesPerLine, kPWOutputLines, kOutputWidth, kPWOutputLines * 2); - if (pDib == nil) + if (pDib == NULL) goto bail; //gotit: @@ -541,7 +541,7 @@ ReformatPackedSHR::Process(const ReformatHolder* pHolder, } pDib = SHRScreenToBitmap8(&fScreen); - if (pDib == nil) + if (pDib == NULL) goto bail; SetResultBuffer(pOutput, pDib); @@ -674,7 +674,7 @@ ReformatAPFSHR::Process(const ReformatHolder* pHolder, } else { pDib = SHRScreenToBitmap8(&fScreen); } - if (pDib == nil) + if (pDib == NULL) goto bail; SetResultBuffer(pOutput, pDib); @@ -714,7 +714,7 @@ ReformatAPFSHR::UnpackMain(const unsigned char* srcPtr, long srcLen) const int kColorTableSize = kNumEntriesPerColorTable * kColorTableEntrySize; unsigned short masterMode; int numColorTables; - int* packedDataLen = nil; + int* packedDataLen = NULL; int retval = -1; if (srcLen < 256) { @@ -809,13 +809,13 @@ ReformatAPFSHR::UnpackMain(const unsigned char* srcPtr, long srcLen) */ fPixelBytesPerLine = ((fPixelBytesPerLine + 7) / 8) * 8; fPixelStore = new unsigned char[fPixelBytesPerLine * fNumScanLines]; - if (fPixelStore == nil) { + if (fPixelStore == NULL) { WMSG1(" APFSHR ERROR: alloc of %d bytes fPixelStore failed\n", fPixelBytesPerLine * fNumScanLines); goto bail; } fSCBStore = new unsigned char[fNumScanLines]; - if (fSCBStore == nil) { + if (fSCBStore == NULL) { WMSG1(" APFSHR ERROR: alloc of %d bytes fSCBStore failed\n", fNumScanLines); goto bail; @@ -828,7 +828,7 @@ ReformatAPFSHR::UnpackMain(const unsigned char* srcPtr, long srcLen) * Get the per-scanline data. */ packedDataLen = new int[fNumScanLines]; - if (packedDataLen == nil) + if (packedDataLen == NULL) goto bail; for (i = 0; i < fNumScanLines; i++) { unsigned short mode; @@ -1034,7 +1034,7 @@ Reformat3200SHR::Process(const ReformatHolder* pHolder, } pDib = SHR3200ToBitmap24(); - if (pDib == nil) + if (pDib == NULL) goto bail; SetResultBuffer(pOutput, pDib); @@ -1058,16 +1058,16 @@ Reformat3200SHR::SHR3200ToBitmap24(void) RGBTRIPLE* rgbBuf; const unsigned char* pPixels = fScreen.pixels; - if (pDib == nil) + if (pDib == NULL) goto bail; /* * Set up a DIB to hold the data. */ rgbBuf = (RGBTRIPLE*) pDib->Create(kOutputWidth, kOutputHeight, 24, 0); - if (rgbBuf == nil) { + if (rgbBuf == NULL) { delete pDib; - pDib = nil; + pDib = NULL; goto bail; } @@ -1173,7 +1173,7 @@ Reformat3201SHR::Process(const ReformatHolder* pHolder, const unsigned char* srcBuf = pHolder->GetSourceBuf(part); long srcLen = pHolder->GetSourceLen(part); long length = srcLen; - unsigned char* tmpBuf = nil; + unsigned char* tmpBuf = NULL; int retval = -1; if (srcLen < 16 || srcLen > kExtTotalSize) { @@ -1214,7 +1214,7 @@ Reformat3201SHR::Process(const ReformatHolder* pHolder, goto bail; pDib = SHR3200ToBitmap24(); - if (pDib == nil) + if (pDib == NULL) goto bail; SetResultBuffer(pOutput, pDib); diff --git a/reformat/SuperHiRes.h b/reformat/SuperHiRes.h index da3a09d..54f5c44 100644 --- a/reformat/SuperHiRes.h +++ b/reformat/SuperHiRes.h @@ -157,12 +157,12 @@ private: */ class ReformatAPFSHR : public ReformatSHR { public: - ReformatAPFSHR(void) : fNonStandard(false), fPixelStore(nil), - fSCBStore(nil) {} + ReformatAPFSHR(void) : fNonStandard(false), fPixelStore(NULL), + fSCBStore(NULL) {} virtual ~ReformatAPFSHR(void) { - if (fPixelStore != nil && fPixelStore != fScreen.pixels) + if (fPixelStore != NULL && fPixelStore != fScreen.pixels) delete[] fPixelStore; - if (fSCBStore != nil && fSCBStore != fScreen.scb) + if (fSCBStore != NULL && fSCBStore != fScreen.scb) delete[] fSCBStore; } diff --git a/reformat/Teach.cpp b/reformat/Teach.cpp index 16cb99d..aeda46f 100644 --- a/reformat/Teach.cpp +++ b/reformat/Teach.cpp @@ -124,7 +124,7 @@ ReformatTeach::Process(const ReformatHolder* pHolder, dataLen = pHolder->GetSourceLen(ReformatHolder::kPartData); rsrcBuf = pHolder->GetSourceBuf(ReformatHolder::kPartRsrc); rsrcLen = pHolder->GetSourceLen(ReformatHolder::kPartRsrc); - if (dataBuf == nil || rsrcBuf == nil || dataLen <= 0 || rsrcLen <= 0) { + if (dataBuf == NULL || rsrcBuf == NULL || dataLen <= 0 || rsrcLen <= 0) { WMSG0("Teach reformatter missing one fork of the file\n"); return -1; } @@ -160,7 +160,7 @@ ReformatTeach::Process(const ReformatHolder* pHolder, * anyway. */ RStyleBlock::TERuler* pRuler = rStyleBlock.GetRuler(0); - assert(pRuler != nil); + assert(pRuler != NULL); if (pRuler->GetJustification() != RStyleBlock::TERuler::kJustLeft) { WMSG0("WARNING: not using left justified Teach text\n"); /* ignore it */ @@ -173,7 +173,7 @@ ReformatTeach::Process(const ReformatHolder* pHolder, /* set up the style */ pStyleItem = rStyleBlock.GetStyleItem(style); - assert(pStyleItem != nil); + assert(pStyleItem != NULL); if (pStyleItem->GetLength() == RStyleBlock::StyleItem::kUnusedItem) continue; numBytes = pStyleItem->GetLength(); @@ -245,7 +245,7 @@ RStyleBlock::Create(const unsigned char* buf, long len) unsigned long partLen; int i; - assert(buf != nil); + assert(buf != NULL); if (len < kMinLen) { WMSG1("Too short to be rStyleBlock (%d)\n", len); return false; @@ -267,7 +267,7 @@ RStyleBlock::Create(const unsigned char* buf, long len) fNumRulers = 1; fpRulers = new TERuler[fNumRulers]; - if (fpRulers == nil) + if (fpRulers == NULL) return false; if (fpRulers->Create(buf, partLen) <= 0) return false; @@ -289,7 +289,7 @@ RStyleBlock::Create(const unsigned char* buf, long len) fNumStyles = partLen / TEStyle::kDataLen; fpStyles = new TEStyle[fNumStyles]; - if (fpStyles == nil) + if (fpStyles == NULL) return false; for (i = 0; i < fNumStyles; i++) { fpStyles[i].Create(buf); @@ -306,7 +306,7 @@ RStyleBlock::Create(const unsigned char* buf, long len) } fpStyleItems = new StyleItem[fNumStyleItems]; - if (fpStyleItems == nil) + if (fpStyleItems == NULL) return false; for (i = 0; i < fNumStyleItems; i++) { fpStyleItems[i].Create(buf); diff --git a/reformat/Teach.h b/reformat/Teach.h index 924ce57..6e99c0c 100644 --- a/reformat/Teach.h +++ b/reformat/Teach.h @@ -51,7 +51,7 @@ private: */ class RStyleBlock { public: - RStyleBlock(void) : fpRulers(nil), fpStyles(nil), fpStyleItems(nil) {} + RStyleBlock(void) : fpRulers(NULL), fpStyles(NULL), fpStyleItems(NULL) {} virtual ~RStyleBlock(void) { delete[] fpRulers; delete[] fpStyles; diff --git a/util/FaddenStd.h b/util/FaddenStd.h index 259ee44..877c5a2 100644 --- a/util/FaddenStd.h +++ b/util/FaddenStd.h @@ -19,9 +19,6 @@ _TYPE(const _TYPE&); \ _TYPE& operator= (const _TYPE&); -// TODO: nuke this -#define nil NULL - // Windows equivalents #define strcasecmp stricmp #define strncasecmp strnicmp diff --git a/util/Modeless.h b/util/Modeless.h index 45e595e..fa5b203 100644 --- a/util/Modeless.h +++ b/util/Modeless.h @@ -63,13 +63,13 @@ private: */ class ExclusiveModelessDialog : public ModelessDialog { public: - ExclusiveModelessDialog(void) : fpParentWnd(nil) {} + ExclusiveModelessDialog(void) : fpParentWnd(NULL) {} virtual ~ExclusiveModelessDialog(void) {}; /* disable the parent window before we're created */ BOOL Create(int dialogID, CWnd* pParentWnd = NULL) { - ASSERT(pParentWnd != nil); // else what's the point? - if (pParentWnd != nil) { + ASSERT(pParentWnd != NULL); // else what's the point? + if (pParentWnd != NULL) { fpParentWnd = pParentWnd; fpParentWnd->EnableWindow(FALSE); } @@ -78,7 +78,7 @@ public: /* enable the parent window before we're destroyed */ virtual BOOL DestroyWindow(void) { - if (fpParentWnd != nil) + if (fpParentWnd != NULL) fpParentWnd->EnableWindow(TRUE); return ModelessDialog::DestroyWindow(); } diff --git a/util/MyBitmapButton.cpp b/util/MyBitmapButton.cpp index 77f42d6..f51853d 100644 --- a/util/MyBitmapButton.cpp +++ b/util/MyBitmapButton.cpp @@ -24,7 +24,7 @@ BOOL MyBitmapButton::ReplaceDlgCtrl(CDialog* pDialog, int buttonID) { CWnd* pWnd = pDialog->GetDlgItem(buttonID); - if (pWnd == nil) + if (pWnd == NULL) return FALSE; #if 0 @@ -77,7 +77,7 @@ MyBitmapButton::UpdateBitmap(void) hNewBits = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(fBitmapID), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS); - if (hNewBits == nil) { + if (hNewBits == NULL) { WMSG1("WARNING: LoadImage failed (bitID=%d)\n", fBitmapID); ASSERT(false); return; diff --git a/util/MyBitmapButton.h b/util/MyBitmapButton.h index 5ac5710..1c6f83b 100644 --- a/util/MyBitmapButton.h +++ b/util/MyBitmapButton.h @@ -15,7 +15,7 @@ class MyBitmapButton : public CButton { public: MyBitmapButton(void) { - fhBitmap = nil; + fhBitmap = NULL; fBitmapID = -1; } virtual ~MyBitmapButton(void) { diff --git a/util/MyDIBitmap.cpp b/util/MyDIBitmap.cpp index 1aa3bca..2c995a8 100644 --- a/util/MyDIBitmap.cpp +++ b/util/MyDIBitmap.cpp @@ -35,7 +35,7 @@ */ MyDIBitmap::~MyDIBitmap(void) { - if (mhBitmap != nil) + if (mhBitmap != NULL) ::DeleteObject(mhBitmap); delete[] mpFileBuffer; delete[] mpColorTable; @@ -49,16 +49,16 @@ MyDIBitmap::~MyDIBitmap(void) * We probably don't need to allocate DIB storage here. We can do most * operations ourselves, in local memory, and only convert when needed. * - * Returns a pointer to the pixel storage on success, or nil on failure. + * Returns a pointer to the pixel storage on success, or NULL on failure. */ void* MyDIBitmap::Create(int width, int height, int bitsPerPixel, int colorsUsed, bool dibSection /*=false*/) { - if (mhBitmap != nil || mpPixels != nil || mpFileBuffer != nil) { + if (mhBitmap != NULL || mpPixels != NULL || mpFileBuffer != NULL) { WMSG0(" DIB GLITCH: already created\n"); assert(false); - return nil; + return NULL; } assert(width > 0 && height > 0); @@ -87,17 +87,17 @@ MyDIBitmap::Create(int width, int height, int bitsPerPixel, int colorsUsed, mNumColorsUsed = colorsUsed; if (colorsUsed) { mpColorTable = new RGBQUAD[colorsUsed]; - if (mpColorTable == nil) - return nil; + if (mpColorTable == NULL) + return NULL; } if (dibSection) { /* * Create an actual blank DIB section. */ - mhBitmap = ::CreateDIBSection(nil, (BITMAPINFO*) &mBitmapInfoHdr, - DIB_RGB_COLORS, &mpPixels, nil, 0); - if (mhBitmap == nil) { + mhBitmap = ::CreateDIBSection(NULL, (BITMAPINFO*) &mBitmapInfoHdr, + DIB_RGB_COLORS, &mpPixels, NULL, 0); + if (mhBitmap == NULL) { DWORD err = ::GetLastError(); //CString msg; //GetWin32ErrorString(err, &msg); @@ -107,7 +107,7 @@ MyDIBitmap::Create(int width, int height, int bitsPerPixel, int colorsUsed, LogHexDump(&mBitmapInfoHdr, sizeof(BITMAPINFO)); WMSG1("&mpPixels = 0x%08lx\n", &mpPixels); DebugBreak(); - return nil; + return NULL; } /* @@ -118,7 +118,7 @@ MyDIBitmap::Create(int width, int height, int bitsPerPixel, int colorsUsed, /* or GetObject(hBitmap, sizeof(DIBSECTION), &dibsection) */ gotten = ::GetObject(mhBitmap, sizeof(info), &info); if (gotten != sizeof(info)) - return nil; + return NULL; mPitchBytes = info.bmWidthBytes; } else { /* @@ -137,7 +137,7 @@ MyDIBitmap::Create(int width, int height, int bitsPerPixel, int colorsUsed, mBpp = bitsPerPixel; /* clear the bitmap, possibly not needed for DIB section */ - assert(mpPixels != nil); + assert(mpPixels != NULL); memset(mpPixels, 0, mPitchBytes * mBitmapInfoHdr.biHeight); //WMSG2("+++ allocated %d bytes for bitmap pixels (mPitchBytes=%d)\n", @@ -152,11 +152,11 @@ MyDIBitmap::Create(int width, int height, int bitsPerPixel, int colorsUsed, int MyDIBitmap::CreateFromFile(const WCHAR* fileName) { - FILE* fp = nil; + FILE* fp = NULL; int err; fp = _wfopen(fileName, L"rb"); - if (fp == nil) { + if (fp == NULL) { err = errno ? errno : -1; WMSG2("Unable to read bitmap from file '%ls' (err=%d)\n", fileName, err); @@ -179,11 +179,11 @@ MyDIBitmap::CreateFromFile(const WCHAR* fileName) int MyDIBitmap::CreateFromFile(FILE* fp, long len) { - void* buf = nil; + void* buf = NULL; int err = -1; buf = new unsigned char[len]; - if (buf == nil) + if (buf == NULL) return err; if (fread(buf, len, 1, fp) != 1) { @@ -213,7 +213,7 @@ MyDIBitmap::CreateFromBuffer(void* buf, long len, bool doDelete) return CreateFromNewBuffer(buf, len); } else { void* newBuf = new unsigned char[len]; - if (newBuf == nil) + if (newBuf == NULL) return -1; memcpy(newBuf, buf, len); @@ -237,7 +237,7 @@ MyDIBitmap::CreateFromNewBuffer(void* vbuf, long len) BITMAPFILEHEADER* pHeader = (BITMAPFILEHEADER*) vbuf; unsigned char* buf = (unsigned char*) vbuf; - assert(pHeader != nil); + assert(pHeader != NULL); assert(len > 0); if (len > 16 && pHeader->bfType == kBMPMagic && (long) pHeader->bfSize == len) @@ -312,7 +312,7 @@ MyDIBitmap::ImportBMP(void* vbuf, long len) mBitmapInfoHdr.biClrUsed = mNumColorsUsed; } mpColorTable = new RGBQUAD[mNumColorsUsed]; - if (mpColorTable == nil) + if (mpColorTable == NULL) goto bail; SetColorTable(pInfo->bmiColors); } @@ -434,16 +434,16 @@ MyDIBitmap::ConvertBufToDIBSection(void) { void* oldPixels = mpPixels; - assert(mhBitmap == nil); - assert(mpFileBuffer != nil); + assert(mhBitmap == NULL); + assert(mpFileBuffer != NULL); WMSG0(" DIB converting buf to DIB Section\n"); /* alloc storage */ - mpPixels = nil; - mhBitmap = ::CreateDIBSection(nil, (BITMAPINFO*) &mBitmapInfoHdr, - DIB_RGB_COLORS, &mpPixels, nil, 0); - if (mhBitmap == nil) { + mpPixels = NULL; + mhBitmap = ::CreateDIBSection(NULL, (BITMAPINFO*) &mBitmapInfoHdr, + DIB_RGB_COLORS, &mpPixels, NULL, 0); + if (mhBitmap == NULL) { DWORD err = ::GetLastError(); WMSG1(" DIB CreateDIBSection failed (err=%d)\n", err); LogHexDump(&mBitmapInfoHdr, sizeof(BITMAPINFO)); @@ -452,7 +452,7 @@ MyDIBitmap::ConvertBufToDIBSection(void) mpPixels = oldPixels; return -1; } - assert(mpPixels != nil); + assert(mpPixels != NULL); /* * This shouldn't be necessary; I don't think a DIB section uses a @@ -464,7 +464,7 @@ MyDIBitmap::ConvertBufToDIBSection(void) // or GetObject(hBitmap, sizeof(DIBSECTION), &dibsection) gotten = ::GetObject(mhBitmap, sizeof(info), &info); if (gotten != sizeof(info)) - return nil; + return NULL; assert(mPitchBytes == info.bmWidthBytes); //mPitchBytes = info.bmWidthBytes; @@ -473,7 +473,7 @@ MyDIBitmap::ConvertBufToDIBSection(void) /* throw out the old storage */ delete[] mpFileBuffer; - mpFileBuffer = nil; + mpFileBuffer = NULL; return 0; } @@ -488,14 +488,14 @@ MyDIBitmap::CreateFromResource(HINSTANCE hInstance, const WCHAR* rsrc) { mhBitmap = (HBITMAP) ::LoadImage(hInstance, rsrc, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_CREATEDIBSECTION); - if (mhBitmap == nil) { + if (mhBitmap == NULL) { DWORD err = ::GetLastError(); //CString msg; //GetWin32ErrorString(err, &msg); //WMSG2(" DIB CreateDIBSection failed (err=%d msg='%ls')\n", // err, (LPCWSTR) msg); WMSG1(" DIB LoadImage failed (err=%d)\n", err); - return nil; + return NULL; } /* @@ -505,7 +505,7 @@ MyDIBitmap::CreateFromResource(HINSTANCE hInstance, const WCHAR* rsrc) int gotten; gotten = ::GetObject(mhBitmap, sizeof(info), &info); if (gotten != sizeof(info)) - return nil; + return NULL; mPitchBytes = info.dsBm.bmWidthBytes; mWidth = info.dsBm.bmWidth; mHeight = info.dsBm.bmHeight; @@ -517,7 +517,7 @@ MyDIBitmap::CreateFromResource(HINSTANCE hInstance, const WCHAR* rsrc) if (mNumColorsUsed == 0) mNumColorsUsed = 1 << mBpp; mpColorTable = new RGBQUAD[mNumColorsUsed]; - if (mpColorTable == nil) + if (mpColorTable == NULL) goto bail; // should reset mpPixels? /* @@ -530,8 +530,8 @@ MyDIBitmap::CreateFromResource(HINSTANCE hInstance, const WCHAR* rsrc) HGDIOBJ oldBits; int count; - tmpDC = GetDC(nil); - assert(tmpDC != nil); + tmpDC = GetDC(NULL); + assert(tmpDC != NULL); memDC = CreateCompatibleDC(tmpDC); oldBits = SelectObject(memDC, mhBitmap); count = GetDIBColorTable(memDC, 0, mNumColorsUsed, mpColorTable); @@ -544,7 +544,7 @@ MyDIBitmap::CreateFromResource(HINSTANCE hInstance, const WCHAR* rsrc) } SelectObject(memDC, oldBits); DeleteDC(memDC); - ReleaseDC(nil, tmpDC); + ReleaseDC(NULL, tmpDC); } /* @@ -559,7 +559,7 @@ MyDIBitmap::CreateFromResource(HINSTANCE hInstance, const WCHAR* rsrc) } bail: - assert(mpPixels != nil); + assert(mpPixels != NULL); return mpPixels; } #if 0 // this might be a better way?? @@ -594,7 +594,7 @@ bail: void MyDIBitmap::ClearPixels(void) { - assert(mpPixels != nil); + assert(mpPixels != NULL); //WMSG1(" DIB clearing entire bitmap (%d bytes)\n", mPitchBytes * mHeight); memset(mpPixels, 0, mPitchBytes * mHeight); @@ -607,7 +607,7 @@ MyDIBitmap::ClearPixels(void) void MyDIBitmap::SetColorTable(const RGBQUAD* pColorTable) { - assert(pColorTable != nil); + assert(pColorTable != NULL); /* scan for junk */ for (int i = 0; i < mNumColorsUsed; i++) { @@ -752,7 +752,7 @@ MyDIBitmap::GetPixelRGBA(int x, int y, RGBQUAD* pRgbQuad) const idx = *ptr; *pRgbQuad = mpColorTable[idx]; } else if (mBpp == 4) { - assert(mpColorTable != nil); + assert(mpColorTable != NULL); unsigned char* ptr = (unsigned char*) mpPixels; int idx; @@ -996,16 +996,16 @@ MyDIBitmap::Blit(MyDIBitmap* pDstBits, const RECT* pDstRect, * Since we're just supplying pointers to various pieces of data, there's no * need for us to have a DIB section. * - * Returns nil on failure. + * Returns NULL on failure. */ HBITMAP MyDIBitmap::ConvertToDDB(HDC dc) const { - HBITMAP hBitmap = nil; + HBITMAP hBitmap = NULL; if (mNumColorsUsed != 0 && !mColorTableInitialized) { WMSG0(" DIB color table not initialized!\n"); - return nil; + return NULL; } /* @@ -1015,12 +1015,12 @@ MyDIBitmap::ConvertToDDB(HDC dc) const * (We slightly over-allocate here, because the size of the BITMAPINFO * struct actually includes the first color entry.) */ - BITMAPINFO* pNewInfo = nil; + BITMAPINFO* pNewInfo = NULL; int colorTableSize = sizeof(RGBQUAD) * mNumColorsUsed; pNewInfo = (BITMAPINFO*) new unsigned char[sizeof(BITMAPINFO) + colorTableSize]; - if (pNewInfo == nil) - return nil; + if (pNewInfo == NULL) + return NULL; pNewInfo->bmiHeader = mBitmapInfoHdr; if (colorTableSize != 0) @@ -1030,10 +1030,10 @@ MyDIBitmap::ConvertToDDB(HDC dc) const /* * Create storage. */ - hBitmap = ::CreateDIBitmap(dc, &mBitmapInfoHdr, 0, nil, nil, 0); - if (hBitmap == nil) { + hBitmap = ::CreateDIBitmap(dc, &mBitmapInfoHdr, 0, NULL, NULL, 0); + if (hBitmap == NULL) { WMSG0(" DIB CreateDIBBitmap failed!\n"); - return nil; + return NULL; } WMSG4(" PARM hbit=0x%08lx hgt=%d fpPixels=0x%08lx pNewInfo=0x%08lx\n", @@ -1046,7 +1046,7 @@ MyDIBitmap::ConvertToDDB(HDC dc) const /* * Transfer the bits. */ - int count = ::SetDIBits(nil, hBitmap, 0, mBitmapInfoHdr.biHeight, + int count = ::SetDIBits(NULL, hBitmap, 0, mBitmapInfoHdr.biHeight, mpPixels, pNewInfo, DIB_RGB_COLORS); if (count != mBitmapInfoHdr.biHeight) { @@ -1054,14 +1054,14 @@ MyDIBitmap::ConvertToDDB(HDC dc) const WMSG1(" DIB SetDIBits failed, count was %d\n", count); ::DeleteObject(hBitmap); - hBitmap = nil; + hBitmap = NULL; CString msg; GetWin32ErrorString(err, &msg); WMSG2(" DIB CreateDIBSection failed (err=%d msg='%ls')\n", err, (LPCWSTR) msg); //ASSERT(false); // stop & examine this - return nil; + return NULL; } #else /* @@ -1069,9 +1069,9 @@ MyDIBitmap::ConvertToDDB(HDC dc) const */ hBitmap = ::CreateDIBitmap(dc, &mBitmapInfoHdr, CBM_INIT, mpPixels, pNewInfo, DIB_RGB_COLORS); - if (hBitmap == nil) { + if (hBitmap == NULL) { WMSG0(" DIB CreateDIBBitmap failed!\n"); - return nil; + return NULL; } #endif @@ -1087,13 +1087,13 @@ MyDIBitmap::ConvertToDDB(HDC dc) const int MyDIBitmap::WriteToFile(const WCHAR* fileName) const { - FILE* fp = nil; + FILE* fp = NULL; int err; - assert(fileName != nil); + assert(fileName != NULL); fp = _wfopen(fileName, L"wb"); - if (fp == nil) { + if (fp == NULL) { err = errno ? errno : -1; WMSG2("Unable to open bitmap file '%ls' (err=%d)\n", fileName, err); return err; @@ -1119,7 +1119,7 @@ MyDIBitmap::WriteToFile(FILE* fp) const long startOffset; int result = -1; - assert(fp != nil); + assert(fp != NULL); startOffset = ftell(fp); @@ -1147,7 +1147,7 @@ MyDIBitmap::WriteToFile(FILE* fp) const goto bail; } if (mNumColorsUsed != 0) { - assert(mpColorTable != nil); + assert(mpColorTable != NULL); if (fwrite(mpColorTable, sizeof(RGBQUAD) * mNumColorsUsed, 1, fp) != 1) { result = errno ? errno : -1; diff --git a/util/MyDIBitmap.h b/util/MyDIBitmap.h index 06fb209..0f77740 100644 --- a/util/MyDIBitmap.h +++ b/util/MyDIBitmap.h @@ -43,16 +43,16 @@ public: enum { kAlphaMask = 0xff000000 }; // alpha byte in an ARGB DWORD MyDIBitmap(void) : - mhBitmap(nil), - mpFileBuffer(nil), + mhBitmap(NULL), + mpFileBuffer(NULL), mWidth(-1), mHeight(-1), mBpp(-1), mPitchBytes(0), mNumColorsUsed(0), - mpColorTable(nil), + mpColorTable(NULL), mColorTableInitialized(false), - mpPixels(nil), + mpPixels(NULL), mAlphaType(kAlphaOpaque), mTransparentColor(0) { @@ -118,7 +118,7 @@ public: // Return the DIB handle; keep in mind that this HBITMAP is different // from a DDB HBITMAP, and many calls that take an HBITMAP will fail. HBITMAP GetHandle(void) { - if (mhBitmap == nil && mpFileBuffer != nil) + if (mhBitmap == NULL && mpFileBuffer != NULL) ConvertBufToDIBSection(); return mhBitmap; } @@ -158,7 +158,7 @@ private: int CreateFromNewBuffer(void* vbuf, long len); BITMAPINFOHEADER mBitmapInfoHdr; - /* either mhBitmap or mpFileContents will be non-nil, but not both */ + /* either mhBitmap or mpFileContents will be non-NULL, but not both */ HBITMAP mhBitmap; // DIB section handle, not DDB void* mpFileBuffer; // buffer with contents of .BMP int mWidth; diff --git a/util/MyDebug.cpp b/util/MyDebug.cpp index d10eb23..54da001 100644 --- a/util/MyDebug.cpp +++ b/util/MyDebug.cpp @@ -27,12 +27,12 @@ DebugLog::DebugLog(const WCHAR* logFile) _wunlink(logFile); } fLogFp = _wfopen(logFile, L"a"); - if (fLogFp == nil) { + if (fLogFp == NULL) { _CrtDbgReport(_CRT_WARN, __FILE__, __LINE__, NULL, "Unable to open %ls: %d\n", logFile, errno); } else { // disable buffering so we don't lose anything if app crashes - setvbuf(fLogFp, nil, _IONBF, 0); + setvbuf(fLogFp, NULL, _IONBF, 0); fprintf(fLogFp, "\n"); if (when > 0) { diff --git a/util/MyEdit.cpp b/util/MyEdit.cpp index ab765f9..a0bee2c 100644 --- a/util/MyEdit.cpp +++ b/util/MyEdit.cpp @@ -22,7 +22,7 @@ BOOL MyEdit::ReplaceDlgCtrl(CDialog* pDialog, int editID) { CWnd* pWnd = pDialog->GetDlgItem(editID); - if (pWnd == nil) + if (pWnd == NULL) return FALSE; /* latch on to their window handle */ diff --git a/util/MySpinCtrl.cpp b/util/MySpinCtrl.cpp index d8e725d..217e828 100644 --- a/util/MySpinCtrl.cpp +++ b/util/MySpinCtrl.cpp @@ -67,7 +67,7 @@ MySpinCtrl::OnDeltaPos(NMHDR* pNMHDR, LRESULT* pResult) NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR; /* grab value from buddy ctrl */ - ASSERT(GetBuddy() != nil); + ASSERT(GetBuddy() != NULL); CString buddyStr; GetBuddy()->GetWindowText(buddyStr); diff --git a/util/PathName.cpp b/util/PathName.cpp index 75e0a3b..815bb45 100644 --- a/util/PathName.cpp +++ b/util/PathName.cpp @@ -43,23 +43,23 @@ * in. If the fssep is '\0' (as is the case for DOS 3.3), then the entire * pathname is returned. * - * Always returns a pointer to a string; never returns nil. + * Always returns a pointer to a string; never returns NULL. */ const WCHAR* PathName::FilenameOnly(const WCHAR* pathname, WCHAR fssep) { const WCHAR* retstr; const WCHAR* pSlash; - WCHAR* tmpStr = nil; + WCHAR* tmpStr = NULL; - ASSERT(pathname != nil); + ASSERT(pathname != NULL); if (fssep == '\0') { retstr = pathname; goto bail; } pSlash = wcsrchr(pathname, fssep); // strrchr - if (pSlash == nil) { + if (pSlash == NULL) { retstr = pathname; /* whole thing is the filename */ goto bail; } @@ -77,7 +77,7 @@ PathName::FilenameOnly(const WCHAR* pathname, WCHAR fssep) tmpStr[wcslen(pathname)-1] = '\0'; pSlash = wcsrchr(tmpStr, fssep); - if (pSlash == nil) { + if (pSlash == NULL) { retstr = pathname; /* just a filename with a '/' after it */ goto bail; } @@ -105,7 +105,7 @@ bail: * An extension is the stuff following the last '.' in the filename. If * 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. * * We guarantee that there is at least one character after the '.'. @@ -121,14 +121,14 @@ PathName::FindExtension(const WCHAR* pathname, WCHAR fssep) * about "/foo.bar/file". */ pFilename = FilenameOnly(pathname, fssep); - ASSERT(pFilename != nil); + ASSERT(pFilename != NULL); pExt = wcsrchr(pFilename, kFilenameExtDelim); /* also check for "/blah/foo.", which doesn't count */ - if (pExt != nil && *(pExt+1) != '\0') + if (pExt != NULL && *(pExt+1) != '\0') return pExt; - return nil; + return NULL; } @@ -205,8 +205,8 @@ PathName::GetExtension(void) { const WCHAR* ccp; ccp = FindExtension(fPathName, '\\'); - if ((ccp == nil && wcslen(fExt) > 0) || - (ccp != nil && wcscmp(ccp, fExt) != 0)) + if ((ccp == NULL && wcslen(fExt) > 0) || + (ccp != NULL && wcscmp(ccp, fExt) != 0)) { WMSG2("NOTE: got different extensions '%ls' vs '%ls'\n", ccp, (LPCTSTR) fExt); @@ -417,7 +417,7 @@ PathName::Mkdir(const WCHAR* dir) { int err = 0; - ASSERT(dir != nil); + ASSERT(dir != NULL); if (_wmkdir(dir) < 0) err = errno ? errno : -1; @@ -428,7 +428,7 @@ PathName::Mkdir(const WCHAR* dir) /* * Determine if a file exists, and if so whether or not it's a directory. * - * Set fields you're not interested in to nil. + * Set fields you're not interested in to NULL. * * On success, returns 0 and fields are set appropriately. On failure, * returns nonzero and result values are undefined. @@ -450,36 +450,36 @@ PathName::GetFileInfo(const WCHAR* pathname, struct _stat* psb, // int cc2 = access(pathname, 0); //} - if (pModWhen != nil) + if (pModWhen != NULL) *pModWhen = (time_t) -1; - if (pExists != nil) + if (pExists != NULL) *pExists = false; - if (pIsReadable != nil) + if (pIsReadable != NULL) *pIsReadable = false; - if (pIsDirectory != nil) + if (pIsDirectory != NULL) *pIsDirectory = false; cc = _wstat(pathname, &sbuf); - if (psb != nil) + if (psb != NULL) *psb = sbuf; if (cc != 0) { if (errno == ENOENT) { - if (pExists != nil) + if (pExists != NULL) *pExists = false; return 0; } else return errno; } - if (pExists != nil) + if (pExists != NULL) *pExists = true; - if (pIsDirectory != nil && S_ISDIR(sbuf.st_mode)) + if (pIsDirectory != NULL && S_ISDIR(sbuf.st_mode)) *pIsDirectory = true; - if (pModWhen != nil) + if (pModWhen != NULL) *pModWhen = sbuf.st_mtime; - if (pIsReadable != nil) { + if (pIsReadable != NULL) { /* * Test if we can read this file. How do we do that? The easy but * slow way is to call access(2), the harder way is to figure out @@ -501,7 +501,7 @@ int PathName::CheckFileStatus(struct _stat* psb, bool* pExists, bool* pIsReadable, bool* pIsDir) { - return GetFileInfo(fPathName, psb, nil, pExists, pIsReadable, pIsDir); + return GetFileInfo(fPathName, psb, NULL, pExists, pIsReadable, pIsDir); } /* @@ -512,7 +512,7 @@ PathName::GetModWhen(void) { time_t when; - if (GetFileInfo(fPathName, nil, &when, nil, nil, nil) != 0) + if (GetFileInfo(fPathName, NULL, &when, NULL, NULL, NULL) != 0) return (time_t) -1; return when; @@ -552,26 +552,26 @@ PathName::CreateSubdirIFN(const WCHAR* pathStart, const WCHAR* pathEnd, WCHAR fssep) { int err = 0; - WCHAR* tmpBuf = nil; + WCHAR* tmpBuf = NULL; bool isDirectory; bool exists; - ASSERT(pathStart != nil); - ASSERT(pathEnd != nil); + ASSERT(pathStart != NULL); + ASSERT(pathEnd != NULL); ASSERT(fssep != '\0'); /* pathStart might have whole path, but we only want up to "pathEnd" */ tmpBuf = wcsdup(pathStart); tmpBuf[pathEnd - pathStart +1] = '\0'; - err = GetFileInfo(tmpBuf, nil, nil, &exists, nil, &isDirectory); + err = GetFileInfo(tmpBuf, NULL, NULL, &exists, NULL, &isDirectory); if (err != 0) { WMSG1(" Could not get file info for '%ls'\n", tmpBuf); goto bail; } else if (!exists) { /* dir doesn't exist; move up a level and check parent */ pathEnd = wcsrchr(tmpBuf, fssep); - if (pathEnd != nil) { + if (pathEnd != NULL) { pathEnd--; ASSERT(pathEnd >= tmpBuf); err = CreateSubdirIFN(tmpBuf, pathEnd, fssep); @@ -632,7 +632,7 @@ PathName::CreatePathIFN(void) } pathEnd = wcsrchr(pathStart, fFssep); - if (pathEnd == nil) { + if (pathEnd == NULL) { /* no subdirectory components found */ goto bail; } diff --git a/util/ProgressCancelDialog.h b/util/ProgressCancelDialog.h index 7a5d61c..503d261 100644 --- a/util/ProgressCancelDialog.h +++ b/util/ProgressCancelDialog.h @@ -42,7 +42,7 @@ public: ASSERT(newVal >= 0 && newVal <= kProgressResolution); CProgressCtrl* pProgress = (CProgressCtrl*) GetDlgItem(fProgressID); - if (pProgress != nil) { + if (pProgress != NULL) { /* would be nice to only set the range once */ pProgress->SetRange(0, kProgressResolution); pProgress->SetPos(newVal); @@ -63,7 +63,7 @@ private: ASSERT(fProgressID != 0); CProgressCtrl* pProgress = (CProgressCtrl*) GetDlgItem(fProgressID); - ASSERT(pProgress != nil); + ASSERT(pProgress != NULL); /* for some reason this doesn't work if I do it here */ //pProgress->SetRange(0, kProgressResolution); diff --git a/util/SelectFilesDialog.cpp b/util/SelectFilesDialog.cpp index 8ddb00d..38bd2c3 100644 --- a/util/SelectFilesDialog.cpp +++ b/util/SelectFilesDialog.cpp @@ -74,13 +74,13 @@ SelectFilesDialog::OFNHookProc(HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam) { OPENFILENAME* pOfn; - SelectFilesDialog* pSFD = nil; + SelectFilesDialog* pSFD = NULL; pOfn = (OPENFILENAME*) GetWindowLong(hDlg, GWL_USERDATA); - if (pOfn != nil) { + if (pOfn != NULL) { pSFD = (SelectFilesDialog*) pOfn->lCustData; /* allow our "this" pointer to play with the window */ /* [does not seem to cause double-frees on cleanup] */ - if (pSFD->m_hWnd == nil) + if (pSFD->m_hWnd == NULL) pSFD->m_hWnd = hDlg; } @@ -90,16 +90,16 @@ SelectFilesDialog::OFNHookProc(HWND hDlg, UINT uiMsg, WPARAM wParam, SetWindowLong(hDlg, GWL_USERDATA, lParam); break; case WM_NOTIFY: // 0x4e - ASSERT(pSFD != nil); + ASSERT(pSFD != NULL); return pSFD->HandleNotify(hDlg, (LPOFNOTIFY)lParam); case WM_COMMAND: - ASSERT(pSFD != nil); + ASSERT(pSFD != NULL); return pSFD->HandleCommand(hDlg, wParam, lParam); case WM_SIZE: - ASSERT(pSFD != nil); + ASSERT(pSFD != NULL); return pSFD->HandleSize(hDlg, wParam, LOWORD(lParam), HIWORD(lParam)); case WM_HELP: - ASSERT(pSFD != nil); + ASSERT(pSFD != NULL); return pSFD->HandleHelp(hDlg, (LPHELPINFO) lParam); default: //WMSG4("OFNHookProc: hDlg=0x%08lx uiMsg=0x%08lx " @@ -252,16 +252,16 @@ SelectFilesDialog::MyOnInitDone(void) CRect okRect, cancelRect, acceptRect; int vertDiff; - ASSERT(pParent != nil); + ASSERT(pParent != NULL); pWnd = GetDlgItem(fAcceptButtonID); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->GetWindowRect(&acceptRect); pWnd = pParent->GetDlgItem(IDOK); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->GetWindowRect(&okRect); pWnd = pParent->GetDlgItem(IDCANCEL); - ASSERT(pWnd != nil); + ASSERT(pWnd != NULL); pWnd->GetWindowRect(&cancelRect); vertDiff = acceptRect.top - okRect.top; @@ -314,7 +314,7 @@ SelectFilesDialog::ShiftControls(int deltaX, int deltaY) /* * Get the list view control out of the common file dialog. * - * Returns "nil" if it can't find it. + * Returns "NULL" if it can't find it. */ CWnd* SelectFilesDialog::GetListCtrl(void) @@ -324,13 +324,13 @@ SelectFilesDialog::GetListCtrl(void) /* our dialog is a child; get our parent, then grab the shellview */ pItem = GetParent()->GetDlgItem(lst2); - ASSERT(pItem != nil); - if (pItem == nil) - return nil; + ASSERT(pItem != NULL); + if (pItem == NULL) + return NULL; /* pull the listview out of the shellview */ pList = pItem->GetDlgItem( 1); - ASSERT(pList != nil); + ASSERT(pList != NULL); return pList; } @@ -346,18 +346,18 @@ SelectFilesDialog::MyOnFileNameChange(void) CListCtrl* pList; pList = (CListCtrl*) GetListCtrl(); - if (pList == nil) { + if (pList == NULL) { WMSG0("GLITCH: could not get list control\n"); return; } - ASSERT(pList != nil); + ASSERT(pList != NULL); //WMSG1("Selected count=%d\n", pList->GetSelectedCount()); //*pCount = pList->GetSelectedCount(); //CWnd* pItem; //pItem = GetDlgItem(IDC_SELECT_ACCEPT); - //ASSERT(pItem != nil); + //ASSERT(pItem != NULL); //pItem->EnableWindow(*pCount != 0); } @@ -445,11 +445,11 @@ SelectFilesDialog::PrepEndDialog(void) * Now merge in the selected files. */ pList = (CListCtrl*) GetListCtrl(); - if (pList == nil) { + if (pList == NULL) { WMSG0("GLITCH: could not get list control\n"); return false; } - ASSERT(pList != nil); + ASSERT(pList != NULL); CString fileNames; @@ -485,12 +485,12 @@ SelectFilesDialog::PrepEndDialog(void) POSITION posn; posn = pList->GetFirstSelectedItemPosition(); - if (posn == nil) { + if (posn == NULL) { /* shouldn't happen -- Accept button should be dimmed */ ASSERT(false); return false; } - while (posn != nil) { + while (posn != NULL) { /* do this every time, because "fileNames" can be reallocated */ const WCHAR* tailStr = fileNames; tailStr += fFileNameOffset-1; @@ -510,7 +510,7 @@ SelectFilesDialog::PrepEndDialog(void) compareName += L"\\"; //WMSG1(" Checking name='%ls'\n", compareName); - if (compare && Stristr(tailStr, compareName) != nil) { + if (compare && Stristr(tailStr, compareName) != NULL) { WMSG1(" Matched '%ls', not adding\n", compareName); } else { if (compare) { @@ -584,6 +584,6 @@ void SelectFilesDialog::ClearFileName(void) { CWnd* pWnd = GetParent()->GetDlgItem(edt1); - if (pWnd != nil) + if (pWnd != NULL) pWnd->SetWindowText(L""); } diff --git a/util/SelectFilesDialog.h b/util/SelectFilesDialog.h index a6eb7eb..6bcd8af 100644 --- a/util/SelectFilesDialog.h +++ b/util/SelectFilesDialog.h @@ -92,7 +92,7 @@ protected: virtual void ShiftControls(int deltaX, int deltaY); virtual void DestroyItem(CWnd* pDlg, int id) { CWnd* pWnd = pDlg->GetDlgItem(id); - if (pWnd == nil) { + if (pWnd == NULL) { WMSG1("Could not find item %d\n", id); return; } diff --git a/util/ShellTree.cpp b/util/ShellTree.cpp index f89391a..fad18a9 100644 --- a/util/ShellTree.cpp +++ b/util/ShellTree.cpp @@ -35,7 +35,7 @@ BOOL ShellTree::ReplaceDlgCtrl(CDialog* pDialog, int treeID) { CWnd* pWnd = pDialog->GetDlgItem(treeID); - if (pWnd == nil) + if (pWnd == NULL) return FALSE; #if 0 @@ -63,10 +63,10 @@ ShellTree::ReplaceDlgCtrl(CDialog* pDialog, int treeID) BOOL ShellTree::PopulateTree(int nFolder) { - LPSHELLFOLDER lpsf = nil, lpsf2 = nil; - LPITEMIDLIST lpi = nil; + LPSHELLFOLDER lpsf = NULL, lpsf2 = NULL; + LPITEMIDLIST lpi = NULL; TV_SORTCB tvscb; - LPMALLOC lpMalloc = nil; + LPMALLOC lpMalloc = NULL; HRESULT hr; BOOL retval = FALSE; @@ -86,8 +86,8 @@ ShellTree::PopulateTree(int nFolder) if (nFolder == CSIDL_DESKTOP) { // already done lpsf2 = lpsf; - lpsf = nil; - ASSERT(lpi == nil); + lpsf = NULL; + ASSERT(lpi == NULL); } else { // find the desired special folder hr = SHGetSpecialFolderLocation(m_hWnd, nFolder, &lpi); @@ -112,9 +112,9 @@ ShellTree::PopulateTree(int nFolder) SortChildrenCB(&tvscb); bail: - if (lpsf != nil) + if (lpsf != NULL) lpsf->Release(); - if (lpsf != nil) + if (lpsf != NULL) lpsf2->Release(); lpMalloc->Free(lpi); @@ -129,7 +129,7 @@ ShellTree::ExpandMyComputer(void) { HTREEITEM hItem; hItem = FindMyComputer(); - if (hItem == nil) + if (hItem == NULL) hItem = GetRootItem(); Expand(hItem, TVE_EXPAND); Select(hItem, TVGN_CARET); @@ -257,7 +257,7 @@ ShellTree::FillTreeView(LPSHELLFOLDER lpsf, LPITEMIDLIST lpifq, * seem to screen out all the bad ones. */ - if (lpifq == nil) { + if (lpifq == NULL) { /* dealing with stuff at the root level */ goodOne = ( (ulAttrs & SFGAO_FOLDER) && (ulAttrs & SFGAO_HASSUBFOLDER) && @@ -336,11 +336,11 @@ ShellTree::AddNode(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi, LPITEMIDLIST lpifq, { TVITEM tvi; TVINSERTSTRUCT tvins; - LPITEMIDLIST lpifqThisItem = nil; - TVItemData* lptvid = nil; + LPITEMIDLIST lpifqThisItem = NULL; + TVItemData* lptvid = NULL; WCHAR szBuff[MAX_PATH]; CString name; - LPMALLOC lpMalloc = nil; + LPMALLOC lpMalloc = NULL; HRESULT hr; BOOL result = FALSE; @@ -382,7 +382,7 @@ ShellTree::AddNode(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi, LPITEMIDLIST lpifq, // Done with lipfqThisItem. lptvid->lpifq = lpifqThisItem; - lpifqThisItem = nil; + lpifqThisItem = NULL; // Put in a copy of the relative PIDL. lptvid->lpi = Pidl::CopyITEMID(lpMalloc, lpi); @@ -393,7 +393,7 @@ ShellTree::AddNode(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi, LPITEMIDLIST lpifq, // Done with lptvid. tvi.lParam = (LPARAM)lptvid; - lptvid = nil; + lptvid = NULL; // Populate the TreeView Insert Struct // The item is the one filled above. @@ -486,15 +486,15 @@ ShellTree::TreeViewCompareProc(LPARAM lparam1, LPARAM lparam2, LPARAM) BOOL ShellTree::AddFolderAtSelection(const CString& name) { - LPSHELLFOLDER lpsf = nil; - LPITEMIDLIST lpi = nil; + LPSHELLFOLDER lpsf = NULL; + LPITEMIDLIST lpi = NULL; HTREEITEM hParent; - LPMALLOC lpMalloc = nil; - LPENUMIDLIST lpe = nil; + LPMALLOC lpMalloc = NULL; + LPENUMIDLIST lpe = NULL; const TVItemData* parentTvid; - TVItemData* newTvid = nil; + TVItemData* newTvid = NULL; HWND hwnd = ::GetParent(m_hWnd); - HTREEITEM hPrev = nil; + HTREEITEM hPrev = NULL; BOOL result = false; CString debugName; HRESULT hr; @@ -507,7 +507,7 @@ ShellTree::AddFolderAtSelection(const CString& name) return FALSE; hParent = GetSelectedItem(); - if (hParent == nil) { + if (hParent == NULL) { WMSG0("Nothing selected!\n"); goto bail; } @@ -538,11 +538,11 @@ ShellTree::AddFolderAtSelection(const CString& name) ASSERT(false); } else { HTREEITEM child = GetChildItem(hParent); - if (child == nil && tvi.cChildren) { + if (child == NULL && tvi.cChildren) { WMSG1(" Found unexpanded node, not adding %ls\n", name); result = TRUE; goto bail; - } else if (child == nil && !tvi.cChildren) { + } else if (child == NULL && !tvi.cChildren) { WMSG1(" Found former leaf node, updating kids in %ls\n", debugName); tvi.cChildren = 1; if (!SetItem(&tvi)) { @@ -552,7 +552,7 @@ ShellTree::AddFolderAtSelection(const CString& name) result = TRUE; goto bail; } else { - ASSERT(child != nil && tvi.cChildren != 0); + ASSERT(child != NULL && tvi.cChildren != 0); WMSG2(" Found expanded branch node '%ls', adding new '%ls'\n", debugName, name); } @@ -560,7 +560,7 @@ ShellTree::AddFolderAtSelection(const CString& name) parentTvid = (TVItemData*)GetItemData(hParent); - ASSERT(parentTvid != nil); + ASSERT(parentTvid != NULL); // Get a handle to the ShellFolder for the currently selected node. hr = parentTvid->lpsfParent->BindToObject(parentTvid->lpi, @@ -579,7 +579,7 @@ ShellTree::AddFolderAtSelection(const CString& name) } // Enumerate throught the list of folder and non-folder objects. - while (S_OK == lpe->Next(1, &lpi, nil)) { + while (S_OK == lpe->Next(1, &lpi, NULL)) { CString pidlName; if (Pidl::GetName(lpsf, lpi, SHGDN_NORMAL, &pidlName)) { if (name.CompareNoCase(pidlName) == 0) { @@ -594,15 +594,15 @@ ShellTree::AddFolderAtSelection(const CString& name) } lpMalloc->Free(lpi); //Free the pidl that the shell gave us. - lpi = nil; + lpi = NULL; } bail: - if (lpi != nil) + if (lpi != NULL) lpMalloc->Free(lpi); - if (lpsf != nil) + if (lpsf != NULL) lpsf->Release(); - if (lpe != nil) + if (lpe != NULL) lpe->Release(); lpMalloc->Release(); return result; @@ -992,7 +992,7 @@ ShellTree::TunnelTree(CString path, CString* pResultStr) * it for the drive letter. */ HTREEITEM myComputer = FindMyComputer(); - if (myComputer == nil) { + if (myComputer == NULL) { *pResultStr = L"Unable to locate My Computer in tree."; return; } @@ -1001,7 +1001,7 @@ ShellTree::TunnelTree(CString path, CString* pResultStr) WMSG1("Searching for drive='%ls'\n", drive); HTREEITEM node = FindDrive(myComputer, drive); - if (node == nil) { + if (node == NULL) { /* unexpected -- couldn't find the drive */ pResultStr->Format(L"Unable to find drive %ls.", drive); return; @@ -1014,7 +1014,7 @@ ShellTree::TunnelTree(CString path, CString* pResultStr) */ node = SearchTree(node, pathName.GetPathOnly()); - if (node == nil) { + if (node == NULL) { /* unexpected -- file doesn't exist */ pResultStr->Format(L"Unable to find file '%ls'.", (LPCWSTR) pathName.GetPathOnly()); @@ -1036,36 +1036,36 @@ ShellTree::TunnelTree(CString path, CString* pResultStr) * If it moved, or if we started the tree somewhere other than right at * the desktop, we'd have to recursively search the tree. * - * Returns a handle to the tree item, or nil if My Computer wasn't found + * Returns a handle to the tree item, or NULL if My Computer wasn't found * or didn't have any children. */ HTREEITEM ShellTree::FindMyComputer(void) { - LPSHELLFOLDER desktop = nil; - LPITEMIDLIST myComputerPidl = nil; - LPMALLOC lpMalloc = nil; + LPSHELLFOLDER desktop = NULL; + LPITEMIDLIST myComputerPidl = NULL; + LPMALLOC lpMalloc = NULL; HTREEITEM node; - HTREEITEM result = nil; + HTREEITEM result = NULL; HRESULT hr; hr = ::SHGetMalloc(&lpMalloc); if (FAILED(hr)) - return nil; + return NULL; hr = SHGetDesktopFolder(&desktop); if (FAILED(hr)) goto bail; - hr = SHGetSpecialFolderLocation(nil, CSIDL_DRIVES, &myComputerPidl); + hr = SHGetSpecialFolderLocation(NULL, CSIDL_DRIVES, &myComputerPidl); if (FAILED(hr)) goto bail; node = GetRootItem(); - while (node != nil) { + while (node != NULL) { CString itemText = GetItemText(node); TVItemData* pData = (TVItemData*) GetItemData(node); - ASSERT(pData != nil); + ASSERT(pData != NULL); hr = desktop->CompareIDs(0, myComputerPidl, pData->lpi); if (SUCCEEDED(hr) && HRESULT_CODE(hr) == 0) { @@ -1076,13 +1076,13 @@ ShellTree::FindMyComputer(void) node = GetNextSiblingItem(node); } - if (result != nil && !ItemHasChildren(result)) { + if (result != NULL && !ItemHasChildren(result)) { WMSG0("Glitch: My Computer has no children\n"); - result = nil; + result = NULL; } bail: - if (desktop != nil) + if (desktop != NULL) desktop->Release(); lpMalloc->Free(myComputerPidl); lpMalloc->Release(); @@ -1094,7 +1094,7 @@ bail: * corresponding to the requested drive (which should be of the form * "C:"). * - * Returns a pointer to the drive's node on success, or nil on failure. + * Returns a pointer to the drive's node on success, or NULL on failure. */ HTREEITEM ShellTree::FindDrive(HTREEITEM myComputer, const CString& drive) @@ -1106,9 +1106,9 @@ ShellTree::FindDrive(HTREEITEM myComputer, const CString& drive) HTREEITEM node; node = GetChildItem(myComputer); - if (node == nil) { + if (node == NULL) { ASSERT(false); // we verified My Computer has kids earlier - return nil; + return NULL; } /* @@ -1121,7 +1121,7 @@ ShellTree::FindDrive(HTREEITEM myComputer, const CString& drive) */ udrive = drive; udrive.MakeUpper(); - while (node != nil) { + while (node != NULL) { CString itemText = GetItemText(node); itemText.MakeUpper(); @@ -1156,8 +1156,8 @@ ShellTree::SearchTree(HTREEITEM treeNode, const CString& path) /* make a copy of "path" that we can mess with */ start = mangle.GetBuffer(0); - if (start == nil || *start != '\\' || *(start + wcslen(start)-1) != '\\') - return nil; + if (start == NULL || *start != '\\' || *(start + wcslen(start)-1) != '\\') + return NULL; start++; node = treeNode; @@ -1167,13 +1167,13 @@ ShellTree::SearchTree(HTREEITEM treeNode, const CString& path) node = GetChildItem(node); end = wcschr(start, '\\'); - if (end == nil) { + if (end == NULL) { ASSERT(false); - return nil; + return NULL; } *end = '\0'; - while (node != nil) { + while (node != NULL) { CString itemText = GetItemText(node); //WMSG2("COMPARE '%s' '%s'\n", start, itemText); @@ -1184,7 +1184,7 @@ ShellTree::SearchTree(HTREEITEM treeNode, const CString& path) node = GetNextSiblingItem(node); } - if (node == nil) { + if (node == NULL) { WMSG2("NOT FOUND '%ls' '%ls'\n", (LPCTSTR) path, start); break; } @@ -1509,7 +1509,7 @@ void ShellTree::TunnelTree(CString szFindPath) #if 0 // quick test -LPMALLOC g_pMalloc = nil; +LPMALLOC g_pMalloc = NULL; // Main_OnBrowse - browses for a program folder. // hwnd - handle to the application's main window. @@ -1523,7 +1523,7 @@ void Main_OnBrowse(HWND hwnd) LPITEMIDLIST pidlPrograms; // PIDL for Programs folder LPITEMIDLIST pidlBrowse; // PIDL selected by user - if (g_pMalloc == nil) + if (g_pMalloc == NULL) ::SHGetMalloc(&g_pMalloc); // Allocate a buffer to receive browse information. diff --git a/util/SoundFile.cpp b/util/SoundFile.cpp index 87b4647..6bfb7be 100644 --- a/util/SoundFile.cpp +++ b/util/SoundFile.cpp @@ -38,11 +38,11 @@ MakeFourCC(unsigned char c0, unsigned char c1, unsigned char c2, int SoundFile::Create(const WCHAR* fileName, CString* pErrMsg) { - FILE* fp = nil; + FILE* fp = NULL; long fileLen; fp = _wfopen(fileName, L"rb"); - if (fp == nil) { + if (fp == NULL) { int err = errno; pErrMsg->Format(L"Unable to open '%ls'", fileName); return err; @@ -72,12 +72,12 @@ SoundFile::Create(FILE* fp, long len, bool doClose, CString* pErrMsg) unsigned long chunkLen; int err = 0; - if (mFP != nil) { + if (mFP != NULL) { WMSG0("SoundFile object already created\n"); assert(false); return -1; } - if (fp == nil) + if (fp == NULL) return -1; if (len < kWAVMinSize) { *pErrMsg = L"File is too short to be WAV"; diff --git a/util/SoundFile.h b/util/SoundFile.h index 6f55fbd..95e6727 100644 --- a/util/SoundFile.h +++ b/util/SoundFile.h @@ -28,7 +28,7 @@ class SoundFile { public: SoundFile(void) : - mFP(nil), + mFP(NULL), mDoClose(false), mFileStart(0), mSampleStart(-1), @@ -37,7 +37,7 @@ public: memset(&mFormat, 0, sizeof(mFormat)); } virtual ~SoundFile(void) { - if (mDoClose && mFP != nil) + if (mDoClose && mFP != NULL) fclose(mFP); } @@ -61,7 +61,7 @@ public: /* returns the #of bytes per sample (all channels) */ int GetBPS(void) const { - ASSERT(mFP != nil); + ASSERT(mFP != NULL); return ((mFormat.wBitsPerSample+7)/8) * mFormat.nChannels; } diff --git a/util/Util.cpp b/util/Util.cpp index 56a0c2f..510f50a 100644 --- a/util/Util.cpp +++ b/util/Util.cpp @@ -55,10 +55,10 @@ RichEditXfer::EditStreamCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG* p { RichEditXfer* pThis = (RichEditXfer*) dwCookie; - ASSERT(dwCookie != nil); - ASSERT(pbBuff != nil); + ASSERT(dwCookie != NULL); + ASSERT(pbBuff != NULL); ASSERT(cb != 0); - ASSERT(pcb != nil); + ASSERT(pcb != NULL); long copyLen = pThis->fLen; if (copyLen > cb) @@ -93,7 +93,7 @@ bail: int ExpandBuffer::CreateWorkBuf(void) { - if (fWorkBuf != nil) { + if (fWorkBuf != NULL) { ASSERT(fWorkMax > 0); return 0; } @@ -101,7 +101,7 @@ ExpandBuffer::CreateWorkBuf(void) assert(fInitialSize > 0); fWorkBuf = new char[fInitialSize]; - if (fWorkBuf == nil) + if (fWorkBuf == NULL) return -1; fWorkCount = 0; @@ -120,7 +120,7 @@ ExpandBuffer::SeizeBuffer(char** ppBuf, long* pLen) *ppBuf = fWorkBuf; *pLen = fWorkCount; - fWorkBuf = nil; + fWorkBuf = NULL; fWorkCount = 0; fWorkMax = 0; } @@ -147,7 +147,7 @@ ExpandBuffer::GrowWorkBuf(void) // ASSERT(fWorkMax < 1024*1024*24); char* newBuf = new char[fWorkMax]; - if (newBuf == nil) { + if (newBuf == NULL) { WMSG1("ALLOC FAILURE (%ld)\n", fWorkMax); ASSERT(false); fWorkMax -= newIncr; // put it back so we don't overrun @@ -167,7 +167,7 @@ ExpandBuffer::GrowWorkBuf(void) void ExpandBuffer::Write(const unsigned char* buf, long len) { - if (fWorkBuf == nil) + if (fWorkBuf == NULL) CreateWorkBuf(); while (fWorkCount + len >= fWorkMax) { if (GrowWorkBuf() != 0) @@ -195,14 +195,14 @@ ExpandBuffer::Printf(const char* format, ...) { va_list args; - ASSERT(format != nil); + ASSERT(format != NULL); - if (fWorkBuf == nil) + if (fWorkBuf == NULL) CreateWorkBuf(); va_start(args, format); - if (format != nil) { + if (format != NULL) { int count; count = _vsnprintf(fWorkBuf + fWorkCount, fWorkMax - fWorkCount, format, args); @@ -239,7 +239,7 @@ void EnableControl(CDialog* pDlg, int id, bool enable) { CWnd* pWnd = pDlg->GetDlgItem(id); - if (pWnd == nil) { + if (pWnd == NULL) { WMSG1("GLITCH: control %d not found in dialog\n", id); ASSERT(false); } else { @@ -258,8 +258,8 @@ MoveControl(CDialog* pDlg, int id, int deltaX, int deltaY, bool redraw) CRect rect; pWnd = pDlg->GetDlgItem(id); - ASSERT(pWnd != nil); - if (pWnd == nil) + ASSERT(pWnd != NULL); + if (pWnd == NULL) return; pWnd->GetWindowRect(&rect); @@ -281,8 +281,8 @@ StretchControl(CDialog* pDlg, int id, int deltaX, int deltaY, bool redraw) CRect rect; pWnd = pDlg->GetDlgItem(id); - ASSERT(pWnd != nil); - if (pWnd == nil) + ASSERT(pWnd != NULL); + if (pWnd == NULL) return; pWnd->GetWindowRect(&rect); @@ -315,8 +315,8 @@ MoveControl(HDWP hdwp, CDialog* pDlg, int id, int deltaX, int deltaY, CRect rect; pWnd = pDlg->GetDlgItem(id); - ASSERT(pWnd != nil); - if (pWnd == nil) + ASSERT(pWnd != NULL); + if (pWnd == NULL) return hdwp; pWnd->GetWindowRect(&rect); @@ -325,7 +325,7 @@ MoveControl(HDWP hdwp, CDialog* pDlg, int id, int deltaX, int deltaY, rect.right += deltaX; rect.top += deltaY; rect.bottom += deltaY; - hdwp = DeferWindowPos(hdwp, pWnd->m_hWnd, nil, rect.left, rect.top, + hdwp = DeferWindowPos(hdwp, pWnd->m_hWnd, NULL, rect.left, rect.top, rect.Width(), rect.Height(), 0); return hdwp; @@ -342,15 +342,15 @@ StretchControl(HDWP hdwp, CDialog* pDlg, int id, int deltaX, int deltaY, CRect rect; pWnd = pDlg->GetDlgItem(id); - ASSERT(pWnd != nil); - if (pWnd == nil) + ASSERT(pWnd != NULL); + if (pWnd == NULL) return hdwp; pWnd->GetWindowRect(&rect); pDlg->ScreenToClient(&rect); rect.right += deltaX; rect.bottom += deltaY; - hdwp = DeferWindowPos(hdwp, pWnd->m_hWnd, nil, rect.left, rect.top, + hdwp = DeferWindowPos(hdwp, pWnd->m_hWnd, NULL, rect.left, rect.top, rect.Width(), rect.Height(), 0); return hdwp; @@ -367,8 +367,8 @@ MoveStretchControl(HDWP hdwp, CDialog* pDlg, int id, int moveX, int moveY, CRect rect; pWnd = pDlg->GetDlgItem(id); - ASSERT(pWnd != nil); - if (pWnd == nil) + ASSERT(pWnd != NULL); + if (pWnd == NULL) return hdwp; pWnd->GetWindowRect(&rect); @@ -379,7 +379,7 @@ MoveStretchControl(HDWP hdwp, CDialog* pDlg, int id, int moveX, int moveY, rect.bottom += moveY; rect.right += stretchX; rect.bottom += stretchY; - hdwp = DeferWindowPos(hdwp, pWnd->m_hWnd, nil, rect.left, rect.top, + hdwp = DeferWindowPos(hdwp, pWnd->m_hWnd, NULL, rect.left, rect.top, rect.Width(), rect.Height(), 0); return hdwp; @@ -393,8 +393,8 @@ GetDlgButtonCheck(CWnd* pWnd, int id) { CButton* pButton; pButton = (CButton*) pWnd->GetDlgItem(id); - ASSERT(pButton != nil); - if (pButton == nil) + ASSERT(pButton != NULL); + if (pButton == NULL) return -1; return pButton->GetCheck(); } @@ -403,8 +403,8 @@ SetDlgButtonCheck(CWnd* pWnd, int id, int checkVal) { CButton* pButton; pButton = (CButton*) pWnd->GetDlgItem(id); - ASSERT(pButton != nil); - if (pButton == nil) + ASSERT(pButton != NULL); + if (pButton == NULL) return; pButton->SetCheck(checkVal); } @@ -547,7 +547,7 @@ LogHexDump(const void* vbuf, long len) char outBuf[10 + 16*3 +1 +8]; // addr: 00 11 22 ... + 8 bytes slop bool skipFirst; long addr; - char* cp = nil; + char* cp = NULL; int i; WMSG2(" Memory at 0x%08lx %ld bytes:\n", buf, len); @@ -836,7 +836,7 @@ InjectLowercase(CString* pStr) WCHAR ch; do { ch = pStr->GetAt(startPos); - if (wcschr(kGapChars, ch) == nil) + if (wcschr(kGapChars, ch) == NULL) break; startPos++; } while (startPos < len); @@ -847,7 +847,7 @@ InjectLowercase(CString* pStr) endPos = startPos + 1; while (endPos < len) { ch = pStr->GetAt(endPos); - if (wcschr(kGapChars, ch) != nil) + if (wcschr(kGapChars, ch) != NULL) break; endPos++; } @@ -903,17 +903,17 @@ MatchSemicolonList(const CString set, const CString match) /* * 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. */ char* StrcpyNew(const char* str) { char* newStr; - if (str == nil) - return nil; + if (str == NULL) + return NULL; newStr = new char[strlen(str)+1]; - if (newStr != nil) + if (newStr != NULL) strcpy(newStr, str); return newStr; } diff --git a/util/Util.h b/util/Util.h index b7da485..3c6234b 100644 --- a/util/Util.h +++ b/util/Util.h @@ -44,11 +44,11 @@ public: ExpandBuffer(long initialSize = 65536) { ASSERT(initialSize > 0); fInitialSize = initialSize; - fWorkBuf = nil; + fWorkBuf = NULL; fWorkCount = fWorkMax = 0; } virtual ~ExpandBuffer(void) { - if (fWorkBuf != nil) { + if (fWorkBuf != NULL) { WMSG0("ExpandBuffer: fWorkBuf not seized; freeing\n"); delete[] fWorkBuf; } @@ -57,7 +57,7 @@ public: void Reset(void) { delete[] fWorkBuf; - fWorkBuf = nil; + fWorkBuf = NULL; fWorkCount = fWorkMax = 0; }