Add CheckedLoadString
The static analyzer was annoyed that the return value from calls to CString::LoadString() was being ignored. This adds a wrapper function that checks the value and logs a failure message if the string can't be found.
This commit is contained in:
parent
9a7283fa49
commit
d42b9c6dc0
|
@ -763,7 +763,7 @@ bool AcuArchive::TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
|
|||
if (nerr != kNuErrNone) {
|
||||
if (nerr == kNuErrAborted) {
|
||||
CString title;
|
||||
title.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&title, IDS_MB_APP_NAME);
|
||||
errMsg = "Cancelled.";
|
||||
pMsgWnd->MessageBox(errMsg, title, MB_OK);
|
||||
} else {
|
||||
|
|
|
@ -87,7 +87,7 @@ BOOL AboutDialog::OnInitDialog(void)
|
|||
pStatic->GetWindowText(tmpStr);
|
||||
newVersion.Format(tmpStr, versionStr);
|
||||
} else {
|
||||
newVersion.LoadString(IDS_ASPI_NOT_LOADED);
|
||||
CheckedLoadString(&newVersion, IDS_ASPI_NOT_LOADED);
|
||||
}
|
||||
pStatic->SetWindowText(newVersion);
|
||||
|
||||
|
|
|
@ -41,12 +41,12 @@ BOOL ActionProgressDialog::OnInitDialog(void)
|
|||
CString tmpStr;
|
||||
pWnd = GetDlgItem(IDC_PROG_VERB);
|
||||
ASSERT(pWnd != NULL);
|
||||
tmpStr.LoadString(IDS_NOW_EXPANDING);
|
||||
CheckedLoadString(&tmpStr, IDS_NOW_EXPANDING);
|
||||
pWnd->SetWindowText(tmpStr);
|
||||
|
||||
pWnd = GetDlgItem(IDC_PROG_TOFROM);
|
||||
ASSERT(pWnd != NULL);
|
||||
tmpStr.LoadString(IDS_NOW_COMPRESSING);
|
||||
CheckedLoadString(&tmpStr, IDS_NOW_COMPRESSING);
|
||||
pWnd->SetWindowText(tmpStr);
|
||||
} else if (fAction == kActionAdd || fAction == kActionAddDisk ||
|
||||
fAction == kActionConvFile || fAction == kActionConvDisk)
|
||||
|
@ -54,18 +54,18 @@ BOOL ActionProgressDialog::OnInitDialog(void)
|
|||
CString tmpStr;
|
||||
pWnd = GetDlgItem(IDC_PROG_VERB);
|
||||
ASSERT(pWnd != NULL);
|
||||
tmpStr.LoadString(IDS_NOW_ADDING);
|
||||
CheckedLoadString(&tmpStr, IDS_NOW_ADDING);
|
||||
pWnd->SetWindowText(tmpStr);
|
||||
|
||||
pWnd = GetDlgItem(IDC_PROG_TOFROM);
|
||||
ASSERT(pWnd != NULL);
|
||||
tmpStr.LoadString(IDS_ADDING_AS);
|
||||
CheckedLoadString(&tmpStr, IDS_ADDING_AS);
|
||||
pWnd->SetWindowText(tmpStr);
|
||||
} else if (fAction == kActionDelete) {
|
||||
CString tmpStr;
|
||||
pWnd = GetDlgItem(IDC_PROG_VERB);
|
||||
ASSERT(pWnd != NULL);
|
||||
tmpStr.LoadString(IDS_NOW_DELETING);
|
||||
CheckedLoadString(&tmpStr, IDS_NOW_DELETING);
|
||||
pWnd->SetWindowText(tmpStr);
|
||||
|
||||
pWnd = GetDlgItem(IDC_PROG_TOFROM);
|
||||
|
@ -77,7 +77,7 @@ BOOL ActionProgressDialog::OnInitDialog(void)
|
|||
CString tmpStr;
|
||||
pWnd = GetDlgItem(IDC_PROG_VERB);
|
||||
ASSERT(pWnd != NULL);
|
||||
tmpStr.LoadString(IDS_NOW_TESTING);
|
||||
CheckedLoadString(&tmpStr, IDS_NOW_TESTING);
|
||||
pWnd->SetWindowText(tmpStr);
|
||||
|
||||
pWnd = GetDlgItem(IDC_PROG_TOFROM);
|
||||
|
|
|
@ -305,7 +305,7 @@ void MainWindow::OnActionsAddDisks(void)
|
|||
|
||||
LOGI("Add disks!");
|
||||
|
||||
failed.LoadString(IDS_FAILED);
|
||||
CheckedLoadString(&failed, IDS_FAILED);
|
||||
|
||||
openFilters = kOpenDiskImage;
|
||||
openFilters += kOpenAll;
|
||||
|
@ -763,7 +763,7 @@ bool MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
|
|||
ReformatHolder holder;
|
||||
CString outputPath;
|
||||
CString failed, errMsg;
|
||||
failed.LoadString(IDS_FAILED);
|
||||
CheckedLoadString(&failed, IDS_FAILED);
|
||||
bool writeFailed = false;
|
||||
bool extractAs2MG = false;
|
||||
char* reformatText = NULL;
|
||||
|
@ -1154,7 +1154,7 @@ bool MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
|
|||
if (result != IDOK) {
|
||||
if (result == IDCANCEL) {
|
||||
CString msg;
|
||||
msg.LoadString(IDS_OPERATION_CANCELLED);
|
||||
CheckedLoadString(&msg, IDS_OPERATION_CANCELLED);
|
||||
fpActionProgress->MessageBox(msg,
|
||||
L"CiderPress", MB_OK | MB_ICONEXCLAMATION);
|
||||
} else {
|
||||
|
@ -1198,7 +1198,7 @@ int MainWindow::OpenOutputFile(CString* pOutputPath, const PathProposal& pathPro
|
|||
CString msg;
|
||||
int err = 0;
|
||||
|
||||
failed.LoadString(IDS_FAILED);
|
||||
CheckedLoadString(&failed, IDS_FAILED);
|
||||
|
||||
*pFp = NULL;
|
||||
|
||||
|
@ -1441,7 +1441,7 @@ void MainWindow::OnActionsDelete(void)
|
|||
|
||||
CString appName, msg;
|
||||
|
||||
appName.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
||||
msg.Format(L"Delete %d file%ls?", selSet.GetNumEntries(),
|
||||
selSet.GetNumEntries() == 1 ? L"" : L"s");
|
||||
if (MessageBox(msg, appName, MB_OKCANCEL | MB_ICONQUESTION) != IDOK)
|
||||
|
@ -1541,8 +1541,8 @@ void MainWindow::OnActionsEditComment(void)
|
|||
CString question, title;
|
||||
int result;
|
||||
|
||||
question.LoadString(IDS_NO_COMMENT_ADD);
|
||||
title.LoadString(IDS_EDIT_COMMENT);
|
||||
CheckedLoadString(&question, IDS_NO_COMMENT_ADD);
|
||||
CheckedLoadString(&title, IDS_EDIT_COMMENT);
|
||||
result = MessageBox(question, title, MB_OKCANCEL | MB_ICONQUESTION);
|
||||
if (result == IDCANCEL)
|
||||
return;
|
||||
|
@ -1753,7 +1753,7 @@ void MainWindow::OnActionsRecompress(void)
|
|||
CalcTotalSize(&afterUncomp, &afterComp);
|
||||
ASSERT(beforeUncomp == afterUncomp);
|
||||
|
||||
appName.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
||||
msg.Format(L"Total uncompressed size of all files:\t%.1fK\r\n"
|
||||
L"Total size before recompress:\t\t%.1fK\r\n"
|
||||
L"Total size after recompress:\t\t%.1fK\r\n"
|
||||
|
|
|
@ -862,7 +862,7 @@ bool BnyArchive::TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
|
|||
if (nerr != kNuErrNone) {
|
||||
if (nerr == kNuErrAborted) {
|
||||
CString title;
|
||||
title.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&title, IDS_MB_APP_NAME);
|
||||
errMsg = "Cancelled.";
|
||||
pMsgWnd->MessageBox(errMsg, title, MB_OK);
|
||||
} else {
|
||||
|
|
|
@ -607,7 +607,7 @@ void ImportBASDialog::OnOK(void)
|
|||
pEdit->GetWindowText(fileName);
|
||||
if (fileName.IsEmpty()) {
|
||||
CString appName;
|
||||
appName.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
||||
|
||||
MessageBox(L"You must specify a filename.",
|
||||
appName, MB_OK);
|
||||
|
|
|
@ -48,7 +48,7 @@ void CassImpTargetDialog::DoDataExchange(CDataExchange* pDX)
|
|||
|
||||
if (pDX->m_bSaveAndValidate) {
|
||||
CString appName;
|
||||
appName.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
||||
|
||||
if (fFileTypeIndex == kTypeBIN) {
|
||||
if (GetStartAddr() < 0) {
|
||||
|
|
|
@ -55,7 +55,7 @@ void ChooseAddTargetDialog::DoDataExchange(CDataExchange* pDX)
|
|||
if (pDX->m_bSaveAndValidate) {
|
||||
CTreeCtrl* pTree = (CTreeCtrl*) GetDlgItem(IDC_ADD_TARGET_TREE);
|
||||
CString errMsg, appName;
|
||||
appName.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
||||
|
||||
/* shortcut for simple disk images */
|
||||
if (pTree->GetCount() == 1 && fpChosenDiskFS != NULL)
|
||||
|
|
|
@ -109,7 +109,7 @@ void ChooseDirDialog::OnExpandTree(void)
|
|||
fShellTree.TunnelTree(str, &msg);
|
||||
if (!msg.IsEmpty()) {
|
||||
CString failed;
|
||||
failed.LoadString(IDS_FAILED);
|
||||
CheckedLoadString(&failed, IDS_FAILED);
|
||||
MessageBox(msg, failed, MB_OK | MB_ICONERROR);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ void MainWindow::OnEditCopy(void)
|
|||
/* associate a number with the format name */
|
||||
myFormat = RegisterClipboardFormat(kClipboardFmtName);
|
||||
if (myFormat == 0) {
|
||||
errStr.LoadString(IDS_CLIPBOARD_REGFAILED);
|
||||
CheckedLoadString(&errStr, IDS_CLIPBOARD_REGFAILED);
|
||||
ShowFailureMsg(this, errStr, IDS_FAILED);
|
||||
goto bail;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ void MainWindow::OnEditCopy(void)
|
|||
|
||||
/* open & empty the clipboard, even if we fail later */
|
||||
if (OpenClipboard() == false) {
|
||||
errStr.LoadString(IDS_CLIPBOARD_OPENFAILED);
|
||||
CheckedLoadString(&errStr, IDS_CLIPBOARD_OPENFAILED);
|
||||
ShowFailureMsg(this, errStr, IDS_FAILED);
|
||||
goto bail;
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ void MainWindow::OnEditCopy(void)
|
|||
selSet.CreateFromSelection(fpContentList,
|
||||
GenericEntry::kAnyThread | GenericEntry::kAllowDirectory);
|
||||
if (selSet.GetNumEntries() == 0) {
|
||||
errStr.LoadString(IDS_CLIPBOARD_NOITEMS);
|
||||
CheckedLoadString(&errStr, IDS_CLIPBOARD_NOITEMS);
|
||||
MessageBox(errStr, L"No match", MB_OK | MB_ICONEXCLAMATION);
|
||||
goto bail;
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ void MainWindow::OnEditCopy(void)
|
|||
hGlobal = ::GlobalAlloc(GHND | GMEM_SHARE, neededLen);
|
||||
if (hGlobal == NULL) {
|
||||
LOGI("Failed allocating %d bytes", neededLen);
|
||||
errStr.LoadString(IDS_CLIPBOARD_ALLOCFAILED);
|
||||
CheckedLoadString(&errStr, IDS_CLIPBOARD_ALLOCFAILED);
|
||||
ShowFailureMsg(this, errStr, IDS_FAILED);
|
||||
goto bail;
|
||||
}
|
||||
|
@ -428,7 +428,7 @@ CString MainWindow::CopyToCollection(GenericEntry* pEntry, void** pBuf,
|
|||
uint8_t* buf = (uint8_t*) *pBuf;
|
||||
long remLen = *pBufLen;
|
||||
|
||||
errStr.LoadString(IDS_CLIPBOARD_WRITEFAILURE);
|
||||
CheckedLoadString(&errStr, IDS_CLIPBOARD_WRITEFAILURE);
|
||||
|
||||
if (pEntry->GetRecordKind() == GenericEntry::kRecordKindVolumeDir) {
|
||||
LOGI("Not copying volume dir to collection");
|
||||
|
@ -518,7 +518,7 @@ CString MainWindow::CopyToCollection(GenericEntry* pEntry, void** pBuf,
|
|||
result = pEntry->ExtractThreadToBuffer(which, &bufCopy, &lenCopy,
|
||||
&extractErrStr);
|
||||
if (result == IDCANCEL) {
|
||||
errStr.LoadString(IDS_CANCELLED);
|
||||
CheckedLoadString(&errStr, IDS_CANCELLED);
|
||||
return errStr;
|
||||
} else if (result != IDOK) {
|
||||
LOGW("ExtractThreadToBuffer (data) failed: %ls",
|
||||
|
@ -542,7 +542,7 @@ CString MainWindow::CopyToCollection(GenericEntry* pEntry, void** pBuf,
|
|||
result = pEntry->ExtractThreadToBuffer(which, &bufCopy, &lenCopy,
|
||||
&extractErrStr);
|
||||
if (result == IDCANCEL) {
|
||||
errStr.LoadString(IDS_CANCELLED);
|
||||
CheckedLoadString(&errStr, IDS_CANCELLED);
|
||||
return errStr;
|
||||
} else if (result != IDOK) {
|
||||
LOGI("ExtractThreadToBuffer (rsrc) failed: %ls",
|
||||
|
@ -655,14 +655,14 @@ void MainWindow::DoPaste(bool pasteJunkPaths)
|
|||
|
||||
myFormat = RegisterClipboardFormat(kClipboardFmtName);
|
||||
if (myFormat == 0) {
|
||||
errStr.LoadString(IDS_CLIPBOARD_REGFAILED);
|
||||
CheckedLoadString(&errStr, IDS_CLIPBOARD_REGFAILED);
|
||||
ShowFailureMsg(this, errStr, IDS_FAILED);
|
||||
goto bail;
|
||||
}
|
||||
LOGI("myFormat = %u", myFormat);
|
||||
|
||||
if (OpenClipboard() == false) {
|
||||
errStr.LoadString(IDS_CLIPBOARD_OPENFAILED);
|
||||
CheckedLoadString(&errStr, IDS_CLIPBOARD_OPENFAILED);
|
||||
ShowFailureMsg(this, errStr, IDS_FAILED);
|
||||
goto bail;;
|
||||
}
|
||||
|
@ -686,7 +686,7 @@ void MainWindow::DoPaste(bool pasteJunkPaths)
|
|||
|
||||
/* impossible unless OnUpdateEditPaste was bypassed */
|
||||
if (!IsClipboardFormatAvailable(myFormat)) {
|
||||
errStr.LoadString(IDS_CLIPBOARD_NOTFOUND);
|
||||
CheckedLoadString(&errStr, IDS_CLIPBOARD_NOTFOUND);
|
||||
ShowFailureMsg(this, errStr, IDS_FAILED);
|
||||
goto bail;
|
||||
}
|
||||
|
@ -730,7 +730,7 @@ CString MainWindow::ProcessClipboard(const void* vbuf, long bufLen,
|
|||
bool xferPrepped = false;
|
||||
|
||||
/* set a standard error message */
|
||||
errMsg.LoadString(IDS_CLIPBOARD_READFAILURE);
|
||||
CheckedLoadString(&errMsg, IDS_CLIPBOARD_READFAILURE);
|
||||
|
||||
/*
|
||||
* Pull the header out.
|
||||
|
|
|
@ -72,14 +72,15 @@ void ConvDiskOptionsDialog::DoDataExchange(CDataExchange* pDX)
|
|||
if (fVolName.IsEmpty() || fVolName.GetLength() > kProDOSVolNameMax) {
|
||||
errMsg = "You must specify a volume name 1-15 characters long.";
|
||||
} else {
|
||||
if (!IsValidVolumeName_ProDOS(fVolName))
|
||||
errMsg.LoadString(IDS_VALID_VOLNAME_PRODOS);
|
||||
if (!IsValidVolumeName_ProDOS(fVolName)) {
|
||||
CheckedLoadString(&errMsg, IDS_VALID_VOLNAME_PRODOS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!errMsg.IsEmpty()) {
|
||||
CString appName;
|
||||
appName.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
||||
MessageBox(errMsg, appName, MB_OK);
|
||||
pDX->Fail();
|
||||
}
|
||||
|
|
|
@ -82,13 +82,15 @@ void CreateImageDialog::DoDataExchange(CDataExchange* pDX)
|
|||
if (fDiskFormatIdx == kFmtDOS32) {
|
||||
CString tmpStr;
|
||||
tmpStr.Format(L"%d", fDOSVolumeNum);
|
||||
if (!IsValidVolumeName_DOS(tmpStr))
|
||||
errMsg.LoadString(IDS_VALID_VOLNAME_DOS);
|
||||
if (!IsValidVolumeName_DOS(tmpStr)) {
|
||||
CheckedLoadString(&errMsg, IDS_VALID_VOLNAME_DOS);
|
||||
}
|
||||
} else if (fDiskFormatIdx == kFmtDOS33) {
|
||||
CString tmpStr;
|
||||
tmpStr.Format(L"%d", fDOSVolumeNum);
|
||||
if (!IsValidVolumeName_DOS(tmpStr))
|
||||
errMsg.LoadString(IDS_VALID_VOLNAME_DOS);
|
||||
if (!IsValidVolumeName_DOS(tmpStr)) {
|
||||
CheckedLoadString(&errMsg, IDS_VALID_VOLNAME_DOS);
|
||||
}
|
||||
|
||||
// only needed in "extended" mode -- this stuff is too painful to
|
||||
// inflict on the average user
|
||||
|
@ -115,8 +117,9 @@ void CreateImageDialog::DoDataExchange(CDataExchange* pDX)
|
|||
{
|
||||
errMsg = L"You must specify a volume name 1-15 characters long.";
|
||||
} else {
|
||||
if (!IsValidVolumeName_ProDOS(fVolName_ProDOS))
|
||||
errMsg.LoadString(IDS_VALID_VOLNAME_PRODOS);
|
||||
if (!IsValidVolumeName_ProDOS(fVolName_ProDOS)) {
|
||||
CheckedLoadString(&errMsg, IDS_VALID_VOLNAME_PRODOS);
|
||||
}
|
||||
}
|
||||
} else if (fDiskFormatIdx == kFmtPascal) {
|
||||
if (fVolName_Pascal.IsEmpty() ||
|
||||
|
@ -124,8 +127,9 @@ void CreateImageDialog::DoDataExchange(CDataExchange* pDX)
|
|||
{
|
||||
errMsg = L"You must specify a volume name 1-7 characters long.";
|
||||
} else {
|
||||
if (!IsValidVolumeName_Pascal(fVolName_Pascal))
|
||||
errMsg.LoadString(IDS_VALID_VOLNAME_PASCAL);
|
||||
if (!IsValidVolumeName_Pascal(fVolName_Pascal)) {
|
||||
CheckedLoadString(&errMsg, IDS_VALID_VOLNAME_PASCAL);
|
||||
}
|
||||
}
|
||||
} else if (fDiskFormatIdx == kFmtHFS) {
|
||||
if (fNumBlocks < 1600 || fNumBlocks > 4194303) {
|
||||
|
@ -136,8 +140,9 @@ void CreateImageDialog::DoDataExchange(CDataExchange* pDX)
|
|||
{
|
||||
errMsg = L"You must specify a volume name 1-27 characters long.";
|
||||
} else {
|
||||
if (!IsValidVolumeName_HFS(fVolName_HFS))
|
||||
errMsg.LoadString(IDS_VALID_VOLNAME_HFS);
|
||||
if (!IsValidVolumeName_HFS(fVolName_HFS)) {
|
||||
CheckedLoadString(&errMsg, IDS_VALID_VOLNAME_HFS);
|
||||
}
|
||||
}
|
||||
} else if (fDiskFormatIdx == kFmtBlank) {
|
||||
if (fNumBlocks < 1 || fNumBlocks > kMaxBlankBlocks)
|
||||
|
@ -152,7 +157,7 @@ void CreateImageDialog::DoDataExchange(CDataExchange* pDX)
|
|||
|
||||
if (!errMsg.IsEmpty()) {
|
||||
CString appName;
|
||||
appName.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
||||
MessageBox(errMsg, appName, MB_OK);
|
||||
pDX->Fail();
|
||||
}
|
||||
|
|
|
@ -34,8 +34,7 @@ void CreateSubdirDialog::DoDataExchange(CDataExchange* pDX)
|
|||
{
|
||||
CString msg, failed;
|
||||
|
||||
msg = "";
|
||||
failed.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&failed, IDS_MB_APP_NAME);
|
||||
|
||||
/* put fNewName last so it gets the focus after failure */
|
||||
DDX_Text(pDX, IDC_CREATESUBDIR_BASE, fBasePath);
|
||||
|
@ -44,7 +43,7 @@ void CreateSubdirDialog::DoDataExchange(CDataExchange* pDX)
|
|||
/* validate the path field */
|
||||
if (pDX->m_bSaveAndValidate) {
|
||||
if (fNewName.IsEmpty()) {
|
||||
msg = "You must specify a new name.";
|
||||
msg = L"You must specify a new name.";
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
|
@ -845,7 +845,7 @@ CString DiskArchive::Close(void)
|
|||
|
||||
msg.Format(L"Failed while closing disk image: %hs.",
|
||||
DiskImgLib::DIStrError(dierr));
|
||||
failed.LoadString(IDS_FAILED);
|
||||
CheckedLoadString(&failed, IDS_FAILED);
|
||||
LOGE("During close: %ls", (LPCWSTR) msg);
|
||||
|
||||
pMainWin->MessageBox(msg, failed, MB_OK);
|
||||
|
@ -1215,7 +1215,7 @@ bool DiskArchive::BulkAdd(ActionProgressDialog* pActionProgress,
|
|||
|
||||
if (fpAddDataHead == NULL) {
|
||||
CString title;
|
||||
title.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&title, IDS_MB_APP_NAME);
|
||||
errMsg = L"No files added.\n";
|
||||
pActionProgress->MessageBox(errMsg, title, MB_OK | MB_ICONWARNING);
|
||||
} else {
|
||||
|
@ -2399,20 +2399,20 @@ CString DiskArchive::TestPathName(const GenericEntry* pGenericEntry,
|
|||
switch (format) {
|
||||
case DiskImg::kFormatProDOS:
|
||||
if (!DiskFSProDOS::IsValidFileName(newNameA))
|
||||
errMsg.LoadString(IDS_VALID_FILENAME_PRODOS);
|
||||
CheckedLoadString(&errMsg, IDS_VALID_FILENAME_PRODOS);
|
||||
break;
|
||||
case DiskImg::kFormatDOS33:
|
||||
case DiskImg::kFormatDOS32:
|
||||
if (!DiskFSDOS33::IsValidFileName(newNameA))
|
||||
errMsg.LoadString(IDS_VALID_FILENAME_DOS);
|
||||
CheckedLoadString(&errMsg, IDS_VALID_FILENAME_DOS);
|
||||
break;
|
||||
case DiskImg::kFormatPascal:
|
||||
if (!DiskFSPascal::IsValidFileName(newNameA))
|
||||
errMsg.LoadString(IDS_VALID_FILENAME_PASCAL);
|
||||
CheckedLoadString(&errMsg, IDS_VALID_FILENAME_PASCAL);
|
||||
break;
|
||||
case DiskImg::kFormatMacHFS:
|
||||
if (!DiskFSHFS::IsValidFileName(newNameA))
|
||||
errMsg.LoadString(IDS_VALID_FILENAME_HFS);
|
||||
CheckedLoadString(&errMsg, IDS_VALID_FILENAME_HFS);
|
||||
break;
|
||||
default:
|
||||
errMsg = L"Not supported by TestPathName!";
|
||||
|
@ -2468,23 +2468,24 @@ CString DiskArchive::TestVolumeName(const DiskFS* pDiskFS,
|
|||
switch (format) {
|
||||
case DiskImg::kFormatProDOS:
|
||||
if (!DiskFSProDOS::IsValidVolumeName(newNameA))
|
||||
errMsg.LoadString(IDS_VALID_VOLNAME_PRODOS);
|
||||
CheckedLoadString(&errMsg, IDS_VALID_VOLNAME_PRODOS);
|
||||
break;
|
||||
case DiskImg::kFormatDOS33:
|
||||
case DiskImg::kFormatDOS32:
|
||||
if (!DiskFSDOS33::IsValidVolumeName(newNameA))
|
||||
errMsg.LoadString(IDS_VALID_VOLNAME_DOS);
|
||||
CheckedLoadString(&errMsg, IDS_VALID_VOLNAME_DOS);
|
||||
break;
|
||||
case DiskImg::kFormatPascal:
|
||||
if (!DiskFSPascal::IsValidVolumeName(newNameA))
|
||||
errMsg.LoadString(IDS_VALID_VOLNAME_PASCAL);
|
||||
CheckedLoadString(&errMsg, IDS_VALID_VOLNAME_PASCAL);
|
||||
break;
|
||||
case DiskImg::kFormatMacHFS:
|
||||
if (!DiskFSHFS::IsValidVolumeName(newNameA))
|
||||
errMsg.LoadString(IDS_VALID_VOLNAME_HFS);
|
||||
CheckedLoadString(&errMsg, IDS_VALID_VOLNAME_HFS);
|
||||
break;
|
||||
default:
|
||||
errMsg = L"Not supported by TestVolumeName!";
|
||||
break;
|
||||
}
|
||||
|
||||
return errMsg;
|
||||
|
|
|
@ -48,7 +48,7 @@ void DiskConvertDialog::Init(const DiskImg* pDiskImg)
|
|||
fConvertIdx = kConvProDOSRaw;
|
||||
} else if (diskSizeInSectors == 35*16) {
|
||||
/* 140K disk image */
|
||||
fDiskDescription.LoadString(IDS_CDESC_140K);
|
||||
CheckedLoadString(&fDiskDescription, IDS_CDESC_140K);
|
||||
fAllowUnadornedDOS = true;
|
||||
fAllowUnadornedProDOS = true;
|
||||
fAllowProDOS2MG = true;
|
||||
|
@ -66,7 +66,7 @@ void DiskConvertDialog::Init(const DiskImg* pDiskImg)
|
|||
pDiskImg->GetFileFormat() == DiskImg::kFileFormatFDI))
|
||||
{
|
||||
/* 40-track TrackStar or FDI image; allow conversion to 35-track formats */
|
||||
fDiskDescription.LoadString(IDS_CDESC_40TRACK);
|
||||
CheckedLoadString(&fDiskDescription, IDS_CDESC_40TRACK);
|
||||
ASSERT(pDiskImg->GetHasBlocks());
|
||||
fAllowUnadornedDOS = true;
|
||||
fAllowUnadornedProDOS = true;
|
||||
|
@ -79,13 +79,13 @@ void DiskConvertDialog::Init(const DiskImg* pDiskImg)
|
|||
fConvertIdx = kConvDOSRaw;
|
||||
} else if (diskSizeInSectors == 35*13) {
|
||||
/* 13-sector 5.25" floppy */
|
||||
fDiskDescription.LoadString(IDS_CDEC_140K_13);
|
||||
CheckedLoadString(&fDiskDescription, IDS_CDEC_140K_13);
|
||||
fAllowUnadornedNibble = true;
|
||||
fAllowD13 = true;
|
||||
fConvertIdx = kConvNibbleRaw;
|
||||
} else if (diskSizeInSectors == kMagicNibbles) {
|
||||
/* blob of nibbles with no recognizable format; allow self-convert */
|
||||
fDiskDescription.LoadString(IDS_CDEC_RAWNIB);
|
||||
CheckedLoadString(&fDiskDescription, IDS_CDEC_RAWNIB);
|
||||
if (pDiskImg->GetPhysicalFormat() == DiskImg::kPhysicalFormatNib525_6656)
|
||||
{
|
||||
fAllowUnadornedNibble = true;
|
||||
|
@ -105,7 +105,7 @@ void DiskConvertDialog::Init(const DiskImg* pDiskImg)
|
|||
}
|
||||
} else if (diskSizeInSectors == 3200) {
|
||||
/* 800K disk image */
|
||||
fDiskDescription.LoadString(IDS_CDESC_800K);
|
||||
CheckedLoadString(&fDiskDescription, IDS_CDESC_800K);
|
||||
fAllowUnadornedDOS = true;
|
||||
fAllowUnadornedProDOS = true;
|
||||
fAllowProDOS2MG = true;
|
||||
|
|
|
@ -322,9 +322,9 @@ int DiskEditDialog::ReadSpinner(int id, long* pVal)
|
|||
long val = pSpin->GetPos();
|
||||
if (val & 0xff000000) {
|
||||
/* error */
|
||||
CString msg;
|
||||
CString err;
|
||||
err.LoadString(IDS_ERROR);
|
||||
CString msg, err;
|
||||
|
||||
CheckedLoadString(&err, IDS_ERROR);
|
||||
int lower, upper;
|
||||
pSpin->GetRange32(lower, upper);
|
||||
msg.Format(L"Please enter a value between %d and %d (0x%x and 0x%x).",
|
||||
|
@ -514,7 +514,7 @@ DIError DiskEditDialog::OpenFile(const WCHAR* fileName, bool openRsrc,
|
|||
CString msg, failed;
|
||||
|
||||
msg.Format(IDS_DEFILE_FIND_FAILED, fileName);
|
||||
failed.LoadString(IDS_FAILED);
|
||||
CheckedLoadString(&failed, IDS_FAILED);
|
||||
MessageBox(msg, failed, MB_OK | MB_ICONSTOP);
|
||||
return kDIErrFileNotFound;
|
||||
}
|
||||
|
@ -526,7 +526,7 @@ DIError DiskEditDialog::OpenFile(const WCHAR* fileName, bool openRsrc,
|
|||
|
||||
msg.Format(IDS_DEFILE_OPEN_FAILED, fileName,
|
||||
DiskImgLib::DIStrError(dierr));
|
||||
failed.LoadString(IDS_FAILED);
|
||||
CheckedLoadString(&failed, IDS_FAILED);
|
||||
MessageBox(msg, failed, MB_OK | MB_ICONSTOP);
|
||||
return dierr;
|
||||
}
|
||||
|
@ -656,7 +656,7 @@ int SectorEditDialog::LoadData(void)
|
|||
//err.LoadString(IDS_ERROR);
|
||||
//msg.Format(IDS_DISKEDIT_NOREADTS, fTrack, fSector);
|
||||
//MessageBox(msg, err, MB_OK|MB_ICONSTOP);
|
||||
fAlertMsg.LoadString(IDS_DISKEDITMSG_BADSECTOR);
|
||||
CheckedLoadString(&fAlertMsg, IDS_DISKEDITMSG_BADSECTOR);
|
||||
//return -1;
|
||||
}
|
||||
|
||||
|
@ -778,7 +778,7 @@ BOOL SectorFileEditDialog::OnInitDialog(void)
|
|||
/* set the window title */
|
||||
CString title;
|
||||
CString rsrcIndic;
|
||||
rsrcIndic.LoadString(IDS_INDIC_RSRC);
|
||||
CheckedLoadString(&rsrcIndic, IDS_INDIC_RSRC);
|
||||
title.Format(L"Disk Viewer - %hs%ls (%I64d bytes)",
|
||||
(LPCSTR) fpFile->GetPathName(), // use fpFile version to get case
|
||||
fOpenRsrcFork ? (LPCWSTR)rsrcIndic : L"", (LONGLONG) fLength);
|
||||
|
@ -833,13 +833,13 @@ int SectorFileEditDialog::LoadData(void)
|
|||
if (dierr == kDIErrInvalidIndex && fSectorIdx == 0) {
|
||||
// no first sector; should only happen on CP/M
|
||||
//FillWithPattern(fSectorData, sizeof(fSectorData), _T("EMPTY "));
|
||||
fAlertMsg.LoadString(IDS_DISKEDITMSG_EMPTY);
|
||||
CheckedLoadString(&fAlertMsg, IDS_DISKEDITMSG_EMPTY);
|
||||
} else if (dierr != kDIErrNone) {
|
||||
CString msg, failed;
|
||||
failed.LoadString(IDS_FAILED);
|
||||
CheckedLoadString(&failed, IDS_FAILED);
|
||||
msg.Format(IDS_DISKEDIT_FIRDFAILED, DiskImgLib::DIStrError(dierr));
|
||||
MessageBox(msg, failed, MB_OK);
|
||||
fAlertMsg.LoadString(IDS_FAILED);
|
||||
CheckedLoadString(&fAlertMsg, IDS_FAILED);
|
||||
// TO DO: mark contents as invalid, so editing fails
|
||||
return -1;
|
||||
} else {
|
||||
|
@ -858,7 +858,7 @@ int SectorFileEditDialog::LoadData(void)
|
|||
//err.LoadString(IDS_ERROR);
|
||||
//msg.Format(IDS_DISKEDIT_NOREADTS, fTrack, fSector);
|
||||
//MessageBox(msg, err, MB_OK|MB_ICONSTOP);
|
||||
fAlertMsg.LoadString(IDS_DISKEDITMSG_BADSECTOR);
|
||||
CheckedLoadString(&fAlertMsg, IDS_DISKEDITMSG_BADSECTOR);
|
||||
//return -1;
|
||||
}
|
||||
}
|
||||
|
@ -1033,7 +1033,7 @@ int BlockEditDialog::LoadData(void)
|
|||
//err.LoadString(IDS_ERROR);
|
||||
//msg.Format(IDS_DISKEDIT_NOREADBLOCK, fBlock);
|
||||
//MessageBox(msg, err, MB_OK|MB_ICONSTOP);
|
||||
fAlertMsg.LoadString(IDS_DISKEDITMSG_BADBLOCK);
|
||||
CheckedLoadString(&fAlertMsg, IDS_DISKEDITMSG_BADBLOCK);
|
||||
//return -1;
|
||||
}
|
||||
|
||||
|
@ -1132,7 +1132,7 @@ BOOL BlockFileEditDialog::OnInitDialog(void)
|
|||
/* set the window title */
|
||||
CString title;
|
||||
CString rsrcIndic;
|
||||
rsrcIndic.LoadString(IDS_INDIC_RSRC);
|
||||
CheckedLoadString(&rsrcIndic, IDS_INDIC_RSRC);
|
||||
title.Format(L"Disk Viewer - %hs%ls (%I64d bytes)",
|
||||
(LPCSTR) fpFile->GetPathName(), // use fpFile version to get case
|
||||
fOpenRsrcFork ? (LPCWSTR)rsrcIndic : L"", (LONGLONG) fLength);
|
||||
|
@ -1186,13 +1186,13 @@ int BlockFileEditDialog::LoadData(void)
|
|||
if (dierr == kDIErrInvalidIndex && fBlockIdx == 0) {
|
||||
// no first sector; should only happen on CP/M
|
||||
//FillWithPattern(fBlockData, sizeof(fBlockData), _T("EMPTY "));
|
||||
fAlertMsg.LoadString(IDS_DISKEDITMSG_EMPTY);
|
||||
CheckedLoadString(&fAlertMsg, IDS_DISKEDITMSG_EMPTY);
|
||||
} else if (dierr != kDIErrNone) {
|
||||
CString msg, failed;
|
||||
failed.LoadString(IDS_FAILED);
|
||||
CheckedLoadString(&failed, IDS_FAILED);
|
||||
msg.Format(IDS_DISKEDIT_FIRDFAILED, DiskImgLib::DIStrError(dierr));
|
||||
MessageBox(msg, failed, MB_OK);
|
||||
fAlertMsg.LoadString(IDS_FAILED);
|
||||
CheckedLoadString(&fAlertMsg, IDS_FAILED);
|
||||
// TO DO: mark contents as invalid, so editing fails
|
||||
return -1;
|
||||
} else {
|
||||
|
@ -1210,7 +1210,7 @@ int BlockFileEditDialog::LoadData(void)
|
|||
//err.LoadString(IDS_ERROR);
|
||||
//msg.Format(IDS_DISKEDIT_NOREADBLOCK, fBlock);
|
||||
//MessageBox(msg, err, MB_OK|MB_ICONSTOP);
|
||||
fAlertMsg.LoadString(IDS_DISKEDITMSG_BADBLOCK);
|
||||
CheckedLoadString(&fAlertMsg, IDS_DISKEDITMSG_BADBLOCK);
|
||||
//return -1;
|
||||
}
|
||||
}
|
||||
|
@ -1374,7 +1374,7 @@ int NibbleEditDialog::LoadData(void)
|
|||
&fNibbleDataLen);
|
||||
if (dierr != kDIErrNone) {
|
||||
LOGI("NED track read failed: %hs", DiskImgLib::DIStrError(dierr));
|
||||
fAlertMsg.LoadString(IDS_DISKEDITMSG_BADTRACK);
|
||||
CheckedLoadString(&fAlertMsg, IDS_DISKEDITMSG_BADTRACK);
|
||||
}
|
||||
|
||||
DisplayData();
|
||||
|
|
|
@ -39,8 +39,8 @@ void EditCommentDialog::OnDelete(void)
|
|||
CString question, title;
|
||||
int result;
|
||||
|
||||
title.LoadString(IDS_EDIT_COMMENT);
|
||||
question.LoadString(IDS_DEL_COMMENT_OK);
|
||||
CheckedLoadString(&title, IDS_EDIT_COMMENT);
|
||||
CheckedLoadString(&question, IDS_DEL_COMMENT_OK);
|
||||
result = MessageBox(question, title, MB_OKCANCEL | MB_ICONQUESTION);
|
||||
if (result == IDCANCEL)
|
||||
return;
|
||||
|
|
|
@ -199,7 +199,7 @@ void EditPropsDialog::DoDataExchange(CDataExchange* pDX)
|
|||
CButton *pButton;
|
||||
bool typeChanged = false;
|
||||
|
||||
appName.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
||||
|
||||
pButton = (CButton*) GetDlgItem(IDC_PROPS_HFS_MODE);
|
||||
if (pButton->GetCheck() == BST_CHECKED) {
|
||||
|
@ -264,7 +264,7 @@ void EditPropsDialog::DoDataExchange(CDataExchange* pDX)
|
|||
CString msg;
|
||||
int result;
|
||||
|
||||
msg.LoadString(IDS_PROPS_DOS_TYPE_CHANGE);
|
||||
CheckedLoadString(&msg, IDS_PROPS_DOS_TYPE_CHANGE);
|
||||
result = MessageBox(msg, appName, MB_ICONQUESTION|MB_OKCANCEL);
|
||||
if (result != IDOK) {
|
||||
pDX->Fail();
|
||||
|
|
|
@ -38,10 +38,10 @@ BOOL ExtractOptionsDialog::OnInitDialog(void)
|
|||
|
||||
/* set the count string using a string table entry */
|
||||
if (fSelectedCount == 1) {
|
||||
countFmt.LoadString(IDS_EXT_SELECTED_COUNT);
|
||||
CheckedLoadString(&countFmt, IDS_EXT_SELECTED_COUNT);
|
||||
pWnd->SetWindowText(countFmt);
|
||||
} else {
|
||||
countFmt.LoadString(IDS_EXT_SELECTED_COUNTS_FMT);
|
||||
CheckedLoadString(&countFmt, IDS_EXT_SELECTED_COUNTS_FMT);
|
||||
selStr.Format((LPCWSTR) countFmt, fSelectedCount);
|
||||
pWnd->SetWindowText(selStr);
|
||||
|
||||
|
|
16
app/Main.cpp
16
app/Main.cpp
|
@ -520,7 +520,7 @@ LONG MainWindow::OnLateInit(UINT, LONG)
|
|||
CString appName;
|
||||
CString niftyListFile;
|
||||
|
||||
appName.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
||||
|
||||
LOGI("----- late init begins -----");
|
||||
|
||||
|
@ -1114,7 +1114,7 @@ void MainWindow::OnFileNewArchive(void)
|
|||
errStr = pOpenArchive->New(filename, NULL);
|
||||
if (!errStr.IsEmpty()) {
|
||||
CString failed;
|
||||
failed.LoadString(IDS_FAILED);
|
||||
CheckedLoadString(&failed, IDS_FAILED);
|
||||
MessageBox(errStr, failed, MB_ICONERROR);
|
||||
|
||||
delete pOpenArchive;
|
||||
|
@ -1317,7 +1317,7 @@ void MainWindow::PrintListing(const ContentList* pContentList)
|
|||
return;
|
||||
if (dc.Attach(dlg.GetPrinterDC()) != TRUE) {
|
||||
CString msg;
|
||||
msg.LoadString(IDS_PRINTER_NOT_USABLE);
|
||||
CheckedLoadString(&msg, IDS_PRINTER_NOT_USABLE);
|
||||
ShowFailureMsg(this, msg, IDS_FAILED);
|
||||
return;
|
||||
}
|
||||
|
@ -1829,7 +1829,7 @@ int MainWindow::LoadArchive(const WCHAR* fileName, const WCHAR* extension,
|
|||
int origFilterIndex = filterIndex;
|
||||
CString errStr, appName;
|
||||
|
||||
appName.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
||||
|
||||
LOGI("LoadArchive: '%ls' ro=%d idx=%d", fileName, readOnly, filterIndex);
|
||||
|
||||
|
@ -2159,7 +2159,7 @@ void MainWindow::SetCPTitle(const WCHAR* pathname, GenericArchive* pOpenArchive)
|
|||
CString appName;
|
||||
CString archiveDescription;
|
||||
|
||||
appName.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
||||
|
||||
pOpenArchive->GetDescription(&archiveDescription);
|
||||
title.Format(L"%ls - %ls (%ls)", (LPCWSTR) appName, pathname,
|
||||
|
@ -2167,7 +2167,7 @@ void MainWindow::SetCPTitle(const WCHAR* pathname, GenericArchive* pOpenArchive)
|
|||
|
||||
if (fpOpenArchive->IsReadOnly()) {
|
||||
CString readOnly;
|
||||
readOnly.LoadString(IDS_READONLY);
|
||||
CheckedLoadString(&readOnly, IDS_READONLY);
|
||||
title += L" ";
|
||||
title += readOnly;
|
||||
}
|
||||
|
@ -2195,7 +2195,7 @@ void MainWindow::SetCPTitle(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
appName.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
||||
title = appName + regName;
|
||||
SetWindowText(title);
|
||||
}
|
||||
|
@ -2211,7 +2211,7 @@ CString MainWindow::GetPrintTitle(void)
|
|||
return title;
|
||||
}
|
||||
|
||||
appName.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
||||
|
||||
fpOpenArchive->GetDescription(&archiveDescription);
|
||||
title.Format(L"%ls - %ls (%ls)", (LPCWSTR) appName,
|
||||
|
|
|
@ -56,7 +56,7 @@ void NewFolderDialog::DoDataExchange(CDataExchange* pDX)
|
|||
GetWin32ErrorString(dwerr, &errStr);
|
||||
msg.Format(L"Unable to create folder '%ls': %ls",
|
||||
(LPCWSTR) fNewFolder, (LPCWSTR) errStr);
|
||||
failed.LoadString(IDS_FAILED);
|
||||
CheckedLoadString(&failed, IDS_FAILED);
|
||||
MessageBox(msg, failed, MB_OK | MB_ICONERROR);
|
||||
pDX->Fail();
|
||||
} else {
|
||||
|
|
|
@ -933,7 +933,7 @@ bool NufxArchive::BulkAdd(ActionProgressDialog* pActionProgress,
|
|||
if (nerr != kNuErrNone) {
|
||||
if (errMsg.IsEmpty())
|
||||
errMsg.Format(L"Failed while adding file '%ls': %hs.",
|
||||
name, NuStrError(nerr));
|
||||
(LPCWSTR) name, NuStrError(nerr));
|
||||
if (nerr != kNuErrAborted) {
|
||||
ShowFailureMsg(fpMsgWnd, errMsg, IDS_FAILED);
|
||||
}
|
||||
|
@ -1086,7 +1086,7 @@ bool NufxArchive::AddDisk(ActionProgressDialog* pActionProgress,
|
|||
}
|
||||
if (numBadBlocks > 0) {
|
||||
CString appName, msg;
|
||||
appName.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
||||
msg.Format(L"Skipped %ld unreadable block%ls.", numBadBlocks,
|
||||
numBadBlocks == 1 ? L"" : L"s");
|
||||
fpMsgWnd->MessageBox(msg, appName, MB_OK | MB_ICONWARNING);
|
||||
|
@ -1388,7 +1388,7 @@ bool NufxArchive::TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
|
|||
if (nerr != kNuErrNone) {
|
||||
if (nerr == kNuErrAborted) {
|
||||
CString title;
|
||||
title.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&title, IDS_MB_APP_NAME);
|
||||
errMsg = "Cancelled.";
|
||||
pMsgWnd->MessageBox(errMsg, title, MB_OK);
|
||||
} else {
|
||||
|
|
|
@ -594,8 +594,8 @@ void OpenVolumeDialog::OnOK(void)
|
|||
|
||||
if (pListView->GetSelectedCount() != 1) {
|
||||
CString msg, failed;
|
||||
failed.LoadString(IDS_FAILED);
|
||||
msg.LoadString(IDS_VOLUME_SELECT_ONE);
|
||||
CheckedLoadString(&failed, IDS_FAILED);
|
||||
CheckedLoadString(&msg, IDS_VOLUME_SELECT_ONE);
|
||||
MessageBox(msg, failed, MB_OK);
|
||||
return;
|
||||
}
|
||||
|
@ -653,8 +653,8 @@ void OpenVolumeDialog::OnOK(void)
|
|||
if (formatID != 0) {
|
||||
CString msg, notAllowed;
|
||||
|
||||
notAllowed.LoadString(IDS_NOT_ALLOWED);
|
||||
msg.LoadString(formatID);
|
||||
CheckedLoadString(¬Allowed, IDS_NOT_ALLOWED);
|
||||
CheckedLoadString(&msg, formatID);
|
||||
MessageBox(msg, notAllowed, MB_OK);
|
||||
} else {
|
||||
Preferences* pPreferences = GET_PREFERENCES_WR();
|
||||
|
|
|
@ -385,7 +385,7 @@ void PrefsFilesPage::DoDataExchange(CDataExchange* pDX)
|
|||
if (pDX->m_bSaveAndValidate) {
|
||||
if (fTempPath.IsEmpty()) {
|
||||
CString appName;
|
||||
appName.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
||||
MessageBox(L"You must specify a path for temp files",
|
||||
appName, MB_OK);
|
||||
pDX->Fail();
|
||||
|
|
|
@ -209,7 +209,7 @@ int PrintContentList::StartPrint(void)
|
|||
|
||||
// set up the print job
|
||||
CString printTitle;
|
||||
printTitle.LoadString(IDS_PRINT_CL_JOB_TITLE);
|
||||
CheckedLoadString(&printTitle, IDS_PRINT_CL_JOB_TITLE);
|
||||
DOCINFO di;
|
||||
::ZeroMemory(&di, sizeof(DOCINFO));
|
||||
di.cbSize = sizeof(DOCINFO);
|
||||
|
|
|
@ -58,7 +58,7 @@ void RenameEntryDialog::DoDataExchange(CDataExchange* pDX)
|
|||
{
|
||||
CString msg, failed;
|
||||
|
||||
failed.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&failed, IDS_MB_APP_NAME);
|
||||
|
||||
/* fNewName must come last, or the focus will be set on the wrong field
|
||||
when we return after failure */
|
||||
|
|
|
@ -48,7 +48,7 @@ void RenameVolumeDialog::DoDataExchange(CDataExchange* pDX)
|
|||
CString msg, failed;
|
||||
//DiskImgLib::DiskFS* pDiskFS = fpArchive->GetDiskFS();
|
||||
|
||||
failed.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&failed, IDS_MB_APP_NAME);
|
||||
|
||||
/* put fNewName last so it gets the focus after failure */
|
||||
DDX_Text(pDX, IDC_RENAMEVOL_NEW, fNewName);
|
||||
|
@ -60,7 +60,7 @@ void RenameVolumeDialog::DoDataExchange(CDataExchange* pDX)
|
|||
*/
|
||||
CTreeCtrl* pTree = (CTreeCtrl*) GetDlgItem(IDC_RENAMEVOL_TREE);
|
||||
CString errMsg, appName;
|
||||
appName.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
||||
|
||||
HTREEITEM selected;
|
||||
selected = pTree->GetSelectedItem();
|
||||
|
|
|
@ -102,7 +102,7 @@ void MainWindow::OnToolsDiskEdit(void)
|
|||
/* flush current archive in case that's what we're planning to edit */
|
||||
OnFileSave();
|
||||
|
||||
failed.LoadString(IDS_FAILED);
|
||||
CheckedLoadString(&failed, IDS_FAILED);
|
||||
|
||||
diskEditOpen.fArchiveOpen = false;
|
||||
if (fpOpenArchive != NULL &&
|
||||
|
@ -499,8 +499,8 @@ void MainWindow::OnToolsDiskConv(void)
|
|||
{
|
||||
/* converting from TrackStar to anything else */
|
||||
CString msg, appName;
|
||||
msg.LoadString(IDS_TRACKSTAR_TO_OTHER_WARNING);
|
||||
appName.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&msg, IDS_TRACKSTAR_TO_OTHER_WARNING);
|
||||
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
||||
if (MessageBox(msg, appName, MB_OKCANCEL | MB_ICONWARNING) != IDOK) {
|
||||
LOGI(" User bailed after trackstar-to-other warning");
|
||||
goto bail;
|
||||
|
@ -511,8 +511,8 @@ void MainWindow::OnToolsDiskConv(void)
|
|||
{
|
||||
/* converting from 5.25" FDI to anything but TrackStar */
|
||||
CString msg, appName;
|
||||
msg.LoadString(IDS_FDI_TO_OTHER_WARNING);
|
||||
appName.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&msg, IDS_FDI_TO_OTHER_WARNING);
|
||||
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
||||
if (MessageBox(msg, appName, MB_OKCANCEL | MB_ICONWARNING) != IDOK) {
|
||||
LOGI(" User bailed after fdi-to-other warning");
|
||||
goto bail;
|
||||
|
@ -521,8 +521,8 @@ void MainWindow::OnToolsDiskConv(void)
|
|||
{
|
||||
/* converting from nibble to non-nibble format */
|
||||
CString msg, appName;
|
||||
msg.LoadString(IDS_NIBBLE_TO_SECTOR_WARNING);
|
||||
appName.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&msg, IDS_NIBBLE_TO_SECTOR_WARNING);
|
||||
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
||||
if (MessageBox(msg, appName, MB_OKCANCEL | MB_ICONWARNING) != IDOK) {
|
||||
LOGI(" User bailed after nibble-to-sector warning");
|
||||
goto bail;
|
||||
|
@ -533,8 +533,8 @@ void MainWindow::OnToolsDiskConv(void)
|
|||
{
|
||||
/* converting between differing nibble formats */
|
||||
CString msg, appName;
|
||||
msg.LoadString(IDS_DIFFERENT_NIBBLE_WARNING);
|
||||
appName.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&msg, IDS_DIFFERENT_NIBBLE_WARNING);
|
||||
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
||||
if (MessageBox(msg, appName, MB_OKCANCEL | MB_ICONWARNING) != IDOK) {
|
||||
LOGI(" User bailed after differing-nibbles warning");
|
||||
goto bail;
|
||||
|
@ -935,7 +935,7 @@ DIError MainWindow::CopyDiskImage(DiskImg* pDstImg, DiskImg* pSrcImg, bool bulk,
|
|||
|
||||
if (!bulk && numBadSectors != 0) {
|
||||
CString appName;
|
||||
appName.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
||||
errMsg.Format(L"Skipped %ld unreadable sector%ls.", numBadSectors,
|
||||
numBadSectors == 1 ? L"" : L"s");
|
||||
MessageBox(errMsg, appName, MB_OK | MB_ICONWARNING);
|
||||
|
@ -1017,7 +1017,7 @@ DIError MainWindow::CopyDiskImage(DiskImg* pDstImg, DiskImg* pSrcImg, bool bulk,
|
|||
|
||||
if (!bulk && numBadBlocks != 0) {
|
||||
CString appName;
|
||||
appName.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
||||
errMsg.Format(L"Skipped %ld unreadable block%ls.", numBadBlocks,
|
||||
numBadBlocks == 1 ? L"" : L"s");
|
||||
MessageBox(errMsg, appName, MB_OK | MB_ICONWARNING);
|
||||
|
@ -1168,7 +1168,7 @@ void MainWindow::OnToolsBulkDiskConv(void)
|
|||
CString failed;
|
||||
int res;
|
||||
|
||||
failed.LoadString(IDS_FAILED);
|
||||
CheckedLoadString(&failed, IDS_FAILED);
|
||||
errMsg += "\n\nSource file: ";
|
||||
errMsg += pathName;
|
||||
errMsg += "\n\nClick OK to skip this and continue, or Cancel to "
|
||||
|
@ -1521,7 +1521,7 @@ void MainWindow::OnToolsSSTMerge(void)
|
|||
OFN_OVERWRITEPROMPT|OFN_NOREADONLYRETURN|OFN_HIDEREADONLY,
|
||||
L"All Files (*.*)|*.*||", this);
|
||||
|
||||
appName.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
||||
|
||||
trackBuf = new uint8_t[kSSTNumTracks * kSSTTrackLen];
|
||||
if (trackBuf == NULL)
|
||||
|
@ -1537,7 +1537,7 @@ void MainWindow::OnToolsSSTMerge(void)
|
|||
goto bail;
|
||||
LOGI("FOUND %ld bad bytes in part 0", badCount);
|
||||
if (badCount > kBadCountThreshold) {
|
||||
errMsg.LoadString(IDS_BAD_SST_IMAGE);
|
||||
CheckedLoadString(&errMsg, IDS_BAD_SST_IMAGE);
|
||||
if (MessageBox(errMsg, appName, MB_OKCANCEL | MB_ICONWARNING) != IDOK)
|
||||
goto bail;
|
||||
}
|
||||
|
@ -1549,7 +1549,7 @@ void MainWindow::OnToolsSSTMerge(void)
|
|||
goto bail;
|
||||
LOGI("FOUND %ld bad bytes in part 1", badCount);
|
||||
if (badCount > kBadCountThreshold) {
|
||||
errMsg.LoadString(IDS_BAD_SST_IMAGE);
|
||||
CheckedLoadString(&errMsg, IDS_BAD_SST_IMAGE);
|
||||
if (MessageBox(errMsg, appName, MB_OKCANCEL | MB_ICONWARNING) != IDOK)
|
||||
goto bail;
|
||||
}
|
||||
|
@ -1892,7 +1892,7 @@ void MainWindow::VolumeCopier(bool openFile)
|
|||
/* flush current archive in case that's what we're planning to edit */
|
||||
OnFileSave();
|
||||
|
||||
failed.LoadString(IDS_FAILED);
|
||||
CheckedLoadString(&failed, IDS_FAILED);
|
||||
|
||||
if (!openFile) {
|
||||
/*
|
||||
|
|
|
@ -100,8 +100,8 @@ void TwoImgPropsDialog::DoDataExchange(CDataExchange* pDX)
|
|||
|
||||
CString appStr, errMsg;
|
||||
if (dosVolNum < 1 || dosVolNum > 254) {
|
||||
appStr.LoadString(IDS_MB_APP_NAME);
|
||||
errMsg.LoadString(IDS_VALID_VOLNAME_DOS);
|
||||
CheckedLoadString(&appStr, IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&errMsg, IDS_VALID_VOLNAME_DOS);
|
||||
MessageBox(errMsg, appStr, MB_OK);
|
||||
pDX->Fail();
|
||||
} else {
|
||||
|
|
|
@ -26,10 +26,10 @@ BOOL UseSelectionDialog::OnInitDialog(void)
|
|||
|
||||
/* set the string using a string table entry */
|
||||
if (fSelectedCount == 1) {
|
||||
str.LoadString(fSelCountID);
|
||||
CheckedLoadString(&str, fSelCountID);
|
||||
pWnd->SetWindowText(str);
|
||||
} else {
|
||||
str.LoadString(fSelCountsID);
|
||||
CheckedLoadString(&str, fSelCountsID);
|
||||
selStr.Format((LPCWSTR) str, fSelectedCount);
|
||||
pWnd->SetWindowText(selStr);
|
||||
|
||||
|
@ -38,17 +38,17 @@ BOOL UseSelectionDialog::OnInitDialog(void)
|
|||
}
|
||||
|
||||
/* set the other strings */
|
||||
str.LoadString(fTitleID);
|
||||
CheckedLoadString(&str, fTitleID);
|
||||
SetWindowText(str);
|
||||
|
||||
pWnd = GetDlgItem(IDC_USE_ALL);
|
||||
ASSERT(pWnd != NULL);
|
||||
str.LoadString(fAllID);
|
||||
CheckedLoadString(&str, fAllID);
|
||||
pWnd->SetWindowText(str);
|
||||
|
||||
pWnd = GetDlgItem(IDOK);
|
||||
ASSERT(pWnd != NULL);
|
||||
str.LoadString(fOkLabelID);
|
||||
CheckedLoadString(&str, fOkLabelID);
|
||||
pWnd->SetWindowText(str);
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -1122,7 +1122,7 @@ void ViewFilesDialog::OnFviewPrint(void)
|
|||
*/
|
||||
if (dc.Attach(dlg.GetPrinterDC()) != TRUE) {
|
||||
CString msg;
|
||||
msg.LoadString(IDS_PRINTER_NOT_USABLE);
|
||||
CheckedLoadString(&msg, IDS_PRINTER_NOT_USABLE);
|
||||
ShowFailureMsg(this, msg, IDS_FAILED);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -265,7 +265,7 @@ void VolumeCopyDialog::ScanDiskInfo(bool scanTop)
|
|||
dierr = fpDiskFS->Initialize(fpDiskImg, DiskFS::kInitFull);
|
||||
if (dierr != kDIErrNone) {
|
||||
CString appName, msg;
|
||||
appName.LoadString(IDS_MB_APP_NAME);
|
||||
CheckedLoadString(&appName, IDS_MB_APP_NAME);
|
||||
msg.Format(L"Warning: error during disk scan: %hs.",
|
||||
DiskImgLib::DIStrError(dierr));
|
||||
fpWaitDlg->MessageBox(msg, appName, MB_OK | MB_ICONEXCLAMATION);
|
||||
|
@ -501,7 +501,7 @@ void VolumeCopyDialog::OnCopyToFile(void)
|
|||
dierr = pMain->CopyDiskImage(&dstImg, pSrcImg, false, false, pProgressDialog);
|
||||
if (dierr != kDIErrNone) {
|
||||
if (dierr == kDIErrCancelled) {
|
||||
errMsg.LoadString(IDS_OPERATION_CANCELLED);
|
||||
CheckedLoadString(&errMsg, IDS_OPERATION_CANCELLED);
|
||||
ShowFailureMsg(pProgressDialog, errMsg, IDS_CANCELLED);
|
||||
// remove the partially-written file
|
||||
dstImg.CloseImage();
|
||||
|
@ -573,7 +573,7 @@ void VolumeCopyDialog::OnCopyFromFile(void)
|
|||
bool needReload = false;
|
||||
bool isPartial = false;
|
||||
|
||||
warning.LoadString(IDS_WARNING);
|
||||
CheckedLoadString(&warning, IDS_WARNING);
|
||||
|
||||
/*
|
||||
* Get the DiskImg and DiskFS pointers for the selected partition out of
|
||||
|
@ -683,7 +683,7 @@ void VolumeCopyDialog::OnCopyFromFile(void)
|
|||
}
|
||||
|
||||
if (srcImg.GetNumBlocks() != pDstImg->GetNumBlocks()) {
|
||||
errMsg.LoadString(IDS_WARNING);
|
||||
//errMsg.LoadString(IDS_WARNING);
|
||||
errMsg.Format(L"The disk image file has %ld blocks, but the target"
|
||||
L" volume holds %ld blocks. The leftover space may be"
|
||||
L" wasted, and non-ProDOS volumes may not be identified"
|
||||
|
@ -697,7 +697,7 @@ void VolumeCopyDialog::OnCopyFromFile(void)
|
|||
isPartial = true;
|
||||
}
|
||||
|
||||
errMsg.LoadString(IDS_WARNING); // TODO: what does this accomplish?
|
||||
//errMsg.LoadString(IDS_WARNING);
|
||||
errMsg.Format(L"You are about to overwrite volume %ls with the"
|
||||
L" contents of '%ls'. This will destroy all data on"
|
||||
L" %ls. Are you sure you wish to continue?",
|
||||
|
@ -755,7 +755,7 @@ void VolumeCopyDialog::OnCopyFromFile(void)
|
|||
pProgressDialog);
|
||||
if (dierr != kDIErrNone) {
|
||||
if (dierr == kDIErrCancelled) {
|
||||
errMsg.LoadString(IDS_OPERATION_CANCELLED);
|
||||
CheckedLoadString(&errMsg, IDS_OPERATION_CANCELLED);
|
||||
ShowFailureMsg(pProgressDialog, errMsg, IDS_CANCELLED);
|
||||
} else {
|
||||
errMsg.Format(L"Copy failed: %hs.", DiskImgLib::DIStrError(dierr));
|
||||
|
|
|
@ -95,7 +95,7 @@ void MainWindow::OnFileScan(void)
|
|||
{
|
||||
if (0) {
|
||||
CString msg;
|
||||
msg.LoadString(IDS_MUST_REGISTER);
|
||||
CheckedLoadString(&msg, IDS_MUST_REGISTER);
|
||||
ShowFailureMsg(this, msg, IDS_APP_TITLE);
|
||||
} else {
|
||||
ScanFiles();
|
||||
|
@ -274,7 +274,7 @@ void MainWindow::ScanFiles(void)
|
|||
CString doneMsg = L"Processing completed.";
|
||||
CString appName;
|
||||
|
||||
appName.LoadString(IDS_APP_TITLE);
|
||||
CheckedLoadString(&appName, IDS_APP_TITLE);
|
||||
scanOpts.pProgress->MessageBox(doneMsg, appName, MB_OK|MB_ICONINFORMATION);
|
||||
}
|
||||
|
||||
|
|
|
@ -390,7 +390,7 @@ void ShowFailureMsg(CWnd* pWnd, const CString& msg, int titleStrID)
|
|||
{
|
||||
CString failed;
|
||||
|
||||
failed.LoadString(titleStrID);
|
||||
CheckedLoadString(&failed, titleStrID);
|
||||
pWnd->MessageBox(msg, failed, MB_OK | MB_ICONERROR);
|
||||
}
|
||||
|
||||
|
@ -409,6 +409,14 @@ bool IsWin9x(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
void CheckedLoadString(CString* pString, UINT nID)
|
||||
{
|
||||
if (!pString->LoadString(nID)) {
|
||||
LOGW("WARNING: failed to load string %u", nID);
|
||||
*pString = L"!Internal failure!";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ===========================================================================
|
||||
|
|
|
@ -187,6 +187,11 @@ void ShowFailureMsg(CWnd* pWnd, const CString& msg, int titleStrID);
|
|||
*/
|
||||
bool IsWin9x(void);
|
||||
|
||||
/*
|
||||
* Wrapper for CString::LoadString that checks the return value and logs a
|
||||
* complaint if the load fails.
|
||||
*/
|
||||
void CheckedLoadString(CString* pString, UINT nID);
|
||||
|
||||
/*
|
||||
* ====================================
|
||||
|
|
Loading…
Reference in New Issue