Change "nil" to "NULL"

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

View File

@ -61,11 +61,11 @@
/*
* Extract data from an entry.
*
* 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) {

View File

@ -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 "";
}

View File

@ -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, &reg, &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);
}
}

View File

@ -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);

View File

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

View File

@ -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:

View File

@ -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();

View File

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

View File

@ -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);

View File

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

View File

@ -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());

View File

@ -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) {

View File

@ -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 "";
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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;
}

View File

@ -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)
{}

View File

@ -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();

View File

@ -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;

View File

@ -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()) {

View File

@ -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;
}

View File

@ -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();

View File

@ -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) {}

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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();

View File

@ -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) {}

View File

@ -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());
}

View File

@ -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, "<diskimg> %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;

View File

@ -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) {}

View File

@ -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);

View File

@ -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;

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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;
}

View File

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

View File

@ -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();

View File

@ -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;

View File

@ -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);

View File

@ -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());
}

View File

@ -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) {}

View File

@ -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);

View File

@ -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++) {

View File

@ -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<GenericEntry*>(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();
}

View File

@ -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; }

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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)

View File

@ -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

View File

@ -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;
}

View File

@ -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();

View File

@ -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;

View File

@ -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"";
}

View File

@ -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);

View File

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

View File

@ -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) {

View File

@ -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

View File

@ -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);

View File

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

View File

@ -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);

View File

@ -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) */

View File

@ -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();
}

View File

@ -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",

View File

@ -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;

View File

@ -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();

View File

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

View File

@ -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);

View File

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

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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;
}

View File

@ -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;

View File

@ -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();
/*

View File

@ -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;

View File

@ -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);

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -217,23 +217,23 @@ DiskImgLib::WriteLongBE(GenericFD* pGFD, unsigned long val)
* in. If the fssep is '\0' (as is the case for DOS 3.3), then the entire
* 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;
}

View File

@ -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;
}

View File

@ -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)

View File

@ -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.

View File

@ -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

View File

@ -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<unsigned char*>(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;
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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,

View File

@ -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;

View File

@ -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(); }

View File

@ -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.

View File

@ -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;

View File

@ -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, "<no date>");
} 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);

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