Fix some issues identified by static analyzer

Includes "printf format" annotation on debug log function.
This commit is contained in:
Andy McFadden 2014-11-19 14:54:24 -08:00
parent f8017fdee3
commit d60a6dbcfa
40 changed files with 187 additions and 185 deletions

View File

@ -870,7 +870,7 @@ AcuArchive::TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
while (pSelEntry != NULL) { while (pSelEntry != NULL) {
pEntry = (AcuEntry*) pSelEntry->GetEntry(); pEntry = (AcuEntry*) pSelEntry->GetEntry();
LOGI(" Testing '%hs' (offset=%ld)", pEntry->GetDisplayName(), LOGI(" Testing '%ls' (offset=%ld)", pEntry->GetDisplayName(),
pEntry->GetOffset()); pEntry->GetOffset());
SET_PROGRESS_UPDATE2(0, pEntry->GetDisplayName(), NULL); SET_PROGRESS_UPDATE2(0, pEntry->GetDisplayName(), NULL);
@ -883,7 +883,7 @@ AcuArchive::TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
errMsg = "Cancelled."; errMsg = "Cancelled.";
pMsgWnd->MessageBox(errMsg, title, MB_OK); pMsgWnd->MessageBox(errMsg, title, MB_OK);
} else { } else {
errMsg.Format(L"Failed while testing '%hs': %hs.", errMsg.Format(L"Failed while testing '%ls': %hs.",
pEntry->GetPathName(), NuStrError(nerr)); pEntry->GetPathName(), NuStrError(nerr));
ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED); ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED);
} }

View File

@ -389,7 +389,7 @@ MainWindow::OnActionsAddDisks(void)
if (img.AnalyzeImage() != kDIErrNone) { if (img.AnalyzeImage() != kDIErrNone) {
errMsg.Format(L"The file '%ls' doesn't seem to hold a valid disk image.", errMsg.Format(L"The file '%ls' doesn't seem to hold a valid disk image.",
dlg.GetPathName()); (LPCWSTR) dlg.GetPathName());
MessageBox(errMsg, failed, MB_OK|MB_ICONSTOP); MessageBox(errMsg, failed, MB_OK|MB_ICONSTOP);
goto bail; goto bail;
} }
@ -869,7 +869,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
{ {
extractAs2MG = true; extractAs2MG = true;
} else { } else {
LOGI("Not extracting funky image '%ls' as 2MG (len=%ld)", LOGI("Not extracting funky image '%ls' as 2MG (len=%I64d)",
pEntry->GetPathName(), pEntry->GetUncompressedLen()); pEntry->GetPathName(), pEntry->GetUncompressedLen());
} }
} }
@ -1017,7 +1017,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
/* update the display in case we renamed it */ /* update the display in case we renamed it */
if (outputPath != fpActionProgress->GetFileName()) { if (outputPath != fpActionProgress->GetFileName()) {
LOGI(" Renamed our output, from '%ls' to '%ls'", LOGI(" Renamed our output, from '%ls' to '%ls'",
(LPCTSTR) fpActionProgress->GetFileName(), outputPath); (LPCWSTR) fpActionProgress->GetFileName(), (LPCWSTR) outputPath);
fpActionProgress->SetFileName(outputPath); fpActionProgress->SetFileName(outputPath);
} }
@ -1027,7 +1027,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
fpActionProgress->SetArcName(pathProp.fStoredPathName); fpActionProgress->SetArcName(pathProp.fStoredPathName);
fpActionProgress->SetFileName(outputPath); fpActionProgress->SetFileName(outputPath);
LOGI("Extracting from '%ls' to '%ls'", LOGI("Extracting from '%ls' to '%ls'",
pathProp.fStoredPathName, outputPath); (LPCWSTR) pathProp.fStoredPathName, (LPCWSTR) outputPath);
SET_PROGRESS_BEGIN(); SET_PROGRESS_BEGIN();
/* /*
@ -1049,7 +1049,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
/* update the display in case they renamed the file */ /* update the display in case they renamed the file */
if (outputPath != fpActionProgress->GetFileName()) { if (outputPath != fpActionProgress->GetFileName()) {
LOGI(" Detected rename, from '%ls' to '%ls'", LOGI(" Detected rename, from '%ls' to '%ls'",
(LPCWSTR) fpActionProgress->GetFileName(), outputPath); (LPCWSTR) fpActionProgress->GetFileName(), (LPCWSTR) outputPath);
fpActionProgress->SetFileName(outputPath); fpActionProgress->SetFileName(outputPath);
} }
@ -1083,7 +1083,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
err = header.WriteHeader(fp); err = header.WriteHeader(fp);
if (err != 0) { if (err != 0) {
errMsg.Format(L"Unable to save 2MG file '%ls': %hs\n", errMsg.Format(L"Unable to save 2MG file '%ls': %hs\n",
outputPath, strerror(err)); (LPCWSTR) outputPath, strerror(err));
fpActionProgress->MessageBox(errMsg, failed, fpActionProgress->MessageBox(errMsg, failed,
MB_OK | MB_ICONERROR); MB_OK | MB_ICONERROR);
goto open_file_fail; goto open_file_fail;
@ -1167,7 +1167,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
err = errno; err = errno;
if (err != 0) { if (err != 0) {
errMsg.Format(L"Unable to save reformatted file '%ls': %hs\n", errMsg.Format(L"Unable to save reformatted file '%ls': %hs\n",
outputPath, strerror(err)); (LPCWSTR) outputPath, strerror(err));
fpActionProgress->MessageBox(errMsg, failed, fpActionProgress->MessageBox(errMsg, failed,
MB_OK | MB_ICONERROR); MB_OK | MB_ICONERROR);
writeFailed = true; writeFailed = true;
@ -1180,7 +1180,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
int err = pOutput->GetDIB()->WriteToFile(fp); int err = pOutput->GetDIB()->WriteToFile(fp);
if (err != 0) { if (err != 0) {
errMsg.Format(L"Unable to save bitmap '%ls': %hs\n", errMsg.Format(L"Unable to save bitmap '%ls': %hs\n",
outputPath, strerror(err)); (LPCWSTR) outputPath, strerror(err));
fpActionProgress->MessageBox(errMsg, failed, fpActionProgress->MessageBox(errMsg, failed,
MB_OK | MB_ICONERROR); MB_OK | MB_ICONERROR);
writeFailed = true; writeFailed = true;
@ -1206,7 +1206,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
pOutput->GetTextLen(), &thisConv, &thisConvHA, &lastCR); pOutput->GetTextLen(), &thisConv, &thisConvHA, &lastCR);
if (err != 0) { if (err != 0) {
errMsg.Format(L"Unable to write file '%ls': %hs\n", errMsg.Format(L"Unable to write file '%ls': %hs\n",
outputPath, strerror(err)); (LPCWSTR) outputPath, strerror(err));
fpActionProgress->MessageBox(errMsg, failed, fpActionProgress->MessageBox(errMsg, failed,
MB_OK | MB_ICONERROR); MB_OK | MB_ICONERROR);
writeFailed = true; writeFailed = true;
@ -1231,7 +1231,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
int result; int result;
ASSERT(fpActionProgress != NULL); ASSERT(fpActionProgress != NULL);
LOGI("Extracting '%ls', requesting thisConv=%d, convHA=%d", LOGI("Extracting '%ls', requesting thisConv=%d, convHA=%d",
outputPath, thisConv, convHA); (LPCWSTR) outputPath, thisConv, convHA);
result = pEntry->ExtractThreadToFile(thread, fp, result = pEntry->ExtractThreadToFile(thread, fp,
thisConv, convHA, &msg); thisConv, convHA, &msg);
if (result != IDOK) { if (result != IDOK) {
@ -1241,9 +1241,10 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread,
fpActionProgress->MessageBox(msg, fpActionProgress->MessageBox(msg,
L"CiderPress", MB_OK | MB_ICONEXCLAMATION); L"CiderPress", MB_OK | MB_ICONEXCLAMATION);
} else { } else {
LOGI(" FAILED on '%ls': %ls", outputPath, msg); LOGI(" FAILED on '%ls': %ls",
(LPCWSTR) outputPath, (LPCWSTR) msg);
errMsg.Format(L"Unable to extract file '%ls': %ls\n", errMsg.Format(L"Unable to extract file '%ls': %ls\n",
outputPath, msg); (LPCWSTR) outputPath, (LPCWSTR) msg);
fpActionProgress->MessageBox(errMsg, failed, fpActionProgress->MessageBox(errMsg, failed,
MB_OK | MB_ICONERROR); MB_OK | MB_ICONERROR);
} }
@ -1371,13 +1372,13 @@ bail:
/* part of the output path exists, but isn't a directory */ /* part of the output path exists, but isn't a directory */
msg.Format(L"Unable to create folders for '%ls': part of the path " msg.Format(L"Unable to create folders for '%ls': part of the path "
L"already exists but is not a folder.\n", L"already exists but is not a folder.\n",
*pOutputPath); (LPCWSTR) *pOutputPath);
fpActionProgress->MessageBox(msg, failed, MB_OK | MB_ICONERROR); fpActionProgress->MessageBox(msg, failed, MB_OK | MB_ICONERROR);
return IDCANCEL; return IDCANCEL;
} else if (err == EINVAL) { } else if (err == EINVAL) {
/* invalid argument; assume it's an invalid filename */ /* invalid argument; assume it's an invalid filename */
msg.Format(L"Unable to create file '%ls': invalid filename.\n", msg.Format(L"Unable to create file '%ls': invalid filename.\n",
*pOutputPath); (LPCWSTR) *pOutputPath);
fpActionProgress->MessageBox(msg, failed, MB_OK | MB_ICONERROR); fpActionProgress->MessageBox(msg, failed, MB_OK | MB_ICONERROR);
return IDCANCEL; return IDCANCEL;
} else if (err == kUserCancel) { } else if (err == kUserCancel) {
@ -1386,7 +1387,7 @@ bail:
return IDCANCEL; return IDCANCEL;
} else if (err != 0) { } else if (err != 0) {
msg.Format(L"Unable to create file '%ls': %hs\n", msg.Format(L"Unable to create file '%ls': %hs\n",
*pOutputPath, strerror(err)); (LPCWSTR) *pOutputPath, strerror(err));
fpActionProgress->MessageBox(msg, failed, MB_OK | MB_ICONERROR); fpActionProgress->MessageBox(msg, failed, MB_OK | MB_ICONERROR);
return IDCANCEL; return IDCANCEL;
} }
@ -2028,7 +2029,7 @@ MainWindow::OnActionsConvDisk(void)
fPreferences.SetPrefString(kPrOpenArchiveFolder, saveFolder); fPreferences.SetPrefString(kPrOpenArchiveFolder, saveFolder);
filename = dlg.GetPathName(); filename = dlg.GetPathName();
LOGI(" Will xfer to file '%ls'", filename); LOGI(" Will xfer to file '%ls'", (LPCWSTR) filename);
/* remove file if it already exists */ /* remove file if it already exists */
CString errMsg; CString errMsg;
@ -2181,7 +2182,7 @@ MainWindow::OnActionsConvFile(void)
fPreferences.SetPrefString(kPrOpenArchiveFolder, saveFolder); fPreferences.SetPrefString(kPrOpenArchiveFolder, saveFolder);
filename = dlg.GetPathName(); filename = dlg.GetPathName();
LOGI(" Will xfer to file '%ls'", filename); LOGI(" Will xfer to file '%ls'", (LPCWSTR) filename);
/* remove file if it already exists */ /* remove file if it already exists */
CString errMsg; CString errMsg;
@ -2286,7 +2287,7 @@ MainWindow::OnActionsConvFromWav(void)
fPreferences.SetPrefString(kPrOpenWAVFolder, saveFolder); fPreferences.SetPrefString(kPrOpenWAVFolder, saveFolder);
fileName = fileDlg.GetPathName(); fileName = fileDlg.GetPathName();
LOGI("Opening WAV file '%ls'", fileName); LOGI("Opening WAV file '%ls'", (LPCWSTR) fileName);
dlg.fFileName = fileName; dlg.fFileName = fileName;
// pass in fpOpenArchive? // pass in fpOpenArchive?
@ -2368,7 +2369,7 @@ MainWindow::SaveToArchive(GenericArchive::FileDetails* pDetails,
} }
if (pTargetSubdir != NULL) { if (pTargetSubdir != NULL) {
storagePrefix = pTargetSubdir->GetPathName(); storagePrefix = pTargetSubdir->GetPathName();
LOGI("--- using storagePrefix '%ls'", storagePrefix); LOGD(" using storagePrefix '%ls'", (LPCWSTR) storagePrefix);
} }
if (!storagePrefix.IsEmpty()) { if (!storagePrefix.IsEmpty()) {
CString tmpStr, tmpFileName; CString tmpStr, tmpFileName;
@ -2434,7 +2435,7 @@ MainWindow::OnActionsImportBAS(void)
fPreferences.SetPrefString(kPrAddFileFolder, saveFolder); fPreferences.SetPrefString(kPrAddFileFolder, saveFolder);
fileName = fileDlg.GetPathName(); fileName = fileDlg.GetPathName();
LOGI("Opening TXT file '%ls'", fileName); LOGI("Opening TXT file '%ls'", (LPCWSTR) fileName);
dlg.fFileName = fileName; dlg.fFileName = fileName;
// pass in fpOpenArchive? // pass in fpOpenArchive?

View File

@ -277,7 +277,7 @@ DiskArchiveInfoDialog::FillInVolumeInfo(const DiskFS* pDiskFS)
pWnd = GetDlgItem(IDC_AIDISK_CAPACITY); pWnd = GetDlgItem(IDC_AIDISK_CAPACITY);
GetReducedSize(totalUnits, unitSize, &reducedSize); GetReducedSize(totalUnits, unitSize, &reducedSize);
tmpStr.Format(L"%ld blocks (%ls)", tmpStr.Format(L"%ld blocks (%ls)",
totalUnits, reducedSize); totalUnits, (LPCWSTR) reducedSize);
if (totalUnits != pDiskImg->GetNumBlocks()) { if (totalUnits != pDiskImg->GetNumBlocks()) {
CString tmpStr2; CString tmpStr2;
tmpStr2.Format(L", image has room for %ld blocks", tmpStr2.Format(L", image has room for %ld blocks",
@ -289,7 +289,7 @@ DiskArchiveInfoDialog::FillInVolumeInfo(const DiskFS* pDiskFS)
pWnd = GetDlgItem(IDC_AIDISK_FREESPACE); pWnd = GetDlgItem(IDC_AIDISK_FREESPACE);
GetReducedSize(freeUnits, unitSize, &reducedSize); GetReducedSize(freeUnits, unitSize, &reducedSize);
tmpStr.Format(L"%ld blocks (%ls)", tmpStr.Format(L"%ld blocks (%ls)",
freeUnits, reducedSize); freeUnits, (LPCWSTR) reducedSize);
pWnd->SetWindowText(tmpStr); pWnd->SetWindowText(tmpStr);
} else { } else {
ASSERT(unitSize == DiskImgLib::kSectorSize); ASSERT(unitSize == DiskImgLib::kSectorSize);
@ -297,13 +297,13 @@ DiskArchiveInfoDialog::FillInVolumeInfo(const DiskFS* pDiskFS)
pWnd = GetDlgItem(IDC_AIDISK_CAPACITY); pWnd = GetDlgItem(IDC_AIDISK_CAPACITY);
GetReducedSize(totalUnits, unitSize, &reducedSize); GetReducedSize(totalUnits, unitSize, &reducedSize);
tmpStr.Format(L"%ld sectors (%ls)", tmpStr.Format(L"%ld sectors (%ls)",
totalUnits, reducedSize); totalUnits, (LPCWSTR) reducedSize);
pWnd->SetWindowText(tmpStr); pWnd->SetWindowText(tmpStr);
pWnd = GetDlgItem(IDC_AIDISK_FREESPACE); pWnd = GetDlgItem(IDC_AIDISK_FREESPACE);
GetReducedSize(freeUnits, unitSize, &reducedSize); GetReducedSize(freeUnits, unitSize, &reducedSize);
tmpStr.Format(L"%ld sectors (%ls)", tmpStr.Format(L"%ld sectors (%ls)",
freeUnits, reducedSize); freeUnits, (LPCWSTR) reducedSize);
pWnd->SetWindowText(tmpStr); pWnd->SetWindowText(tmpStr);
} }
} else { } else {
@ -313,7 +313,7 @@ DiskArchiveInfoDialog::FillInVolumeInfo(const DiskFS* pDiskFS)
totalUnits = pDiskImg->GetNumBlocks(); totalUnits = pDiskImg->GetNumBlocks();
GetReducedSize(totalUnits, DiskImgLib::kBlockSize, &reducedSize); GetReducedSize(totalUnits, DiskImgLib::kBlockSize, &reducedSize);
tmpStr.Format(L"%ld blocks (%ls)", tmpStr.Format(L"%ld blocks (%ls)",
totalUnits, reducedSize); totalUnits, (LPCWSTR) reducedSize);
} else if (pDiskImg->GetHasSectors()) { } else if (pDiskImg->GetHasSectors()) {
tmpStr.Format(L"%ld tracks, %d sectors per track", tmpStr.Format(L"%ld tracks, %d sectors per track",
pDiskImg->GetNumTracks(), pDiskImg->GetNumSectPerTrack()); pDiskImg->GetNumTracks(), pDiskImg->GetNumSectPerTrack());

View File

@ -976,7 +976,7 @@ BnyArchive::TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
errMsg = "Cancelled."; errMsg = "Cancelled.";
pMsgWnd->MessageBox(errMsg, title, MB_OK); pMsgWnd->MessageBox(errMsg, title, MB_OK);
} else { } else {
errMsg.Format(L"Failed while testing '%hs': %hs.", errMsg.Format(L"Failed while testing '%ls': %hs.",
pEntry->GetPathName(), NuStrError(nerr)); pEntry->GetPathName(), NuStrError(nerr));
ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED); ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED);
} }

View File

@ -220,8 +220,10 @@ MainWindow::CreateFileList(SelectionSet* pSelSet)
format = pEntry->GetFormatStr(); format = pEntry->GetFormatStr();
length.Format(L"%I64d", (LONGLONG) pEntry->GetUncompressedLen()); length.Format(L"%I64d", (LONGLONG) pEntry->GetUncompressedLen());
tmpStr.Format(L"\"%hs\"\t%hs\t\"%hs\"\t\"%hs\"\t%hs\t%hs\t%hs\r\n", tmpStr.Format(L"\"%ls\"\t%ls\t\"%ls\"\t\"%ls\"\t%ls\t%ls\t%ls\r\n",
fileName, subVol, fileType, auxType, modDate, format, length); (LPCWSTR) fileName, (LPCWSTR) subVol, (LPCWSTR) fileType,
(LPCWSTR) auxType, (LPCWSTR) modDate, (LPCWSTR) format,
(LPCWSTR) length);
fullStr += tmpStr; fullStr += tmpStr;
pSelEntry = pSelSet->IterNext(); pSelEntry = pSelSet->IterNext();

View File

@ -98,7 +98,7 @@ ConfirmOverwriteDialog::OnInitDialog(void)
pWnd = GetDlgItem(IDC_OVWR_EXIST_INFO); pWnd = GetDlgItem(IDC_OVWR_EXIST_INFO);
ASSERT(pWnd != NULL); ASSERT(pWnd != NULL);
FormatDate(fExistingFileModWhen, &dateStr); FormatDate(fExistingFileModWhen, &dateStr);
tmpStr.Format(L"Modified %ls", dateStr); tmpStr.Format(L"Modified %ls", (LPCWSTR) dateStr);
pWnd->SetWindowText(tmpStr); pWnd->SetWindowText(tmpStr);
pWnd = GetDlgItem(IDC_OVWR_NEW_NAME); pWnd = GetDlgItem(IDC_OVWR_NEW_NAME);
@ -108,7 +108,7 @@ ConfirmOverwriteDialog::OnInitDialog(void)
pWnd = GetDlgItem(IDC_OVWR_NEW_INFO); pWnd = GetDlgItem(IDC_OVWR_NEW_INFO);
ASSERT(pWnd != NULL); ASSERT(pWnd != NULL);
FormatDate(fNewFileModWhen, &dateStr); FormatDate(fNewFileModWhen, &dateStr);
tmpStr.Format(L"Modified %ls", dateStr); tmpStr.Format(L"Modified %ls", (LPCWSTR) dateStr);
pWnd->SetWindowText(tmpStr); pWnd->SetWindowText(tmpStr);
pWnd = GetDlgItem(IDC_OVWR_RENAME); pWnd = GetDlgItem(IDC_OVWR_RENAME);

View File

@ -475,7 +475,7 @@ ContentList::MakeAuxTypeDisplayString(const GenericEntry* pEntry, WCHAR* buf)
MakeMacTypeString(pEntry->GetAuxType(), buf); MakeMacTypeString(pEntry->GetAuxType(), buf);
} else { } else {
if (pEntry->GetRecordKind() == GenericEntry::kRecordKindDisk) if (pEntry->GetRecordKind() == GenericEntry::kRecordKindDisk)
wsprintf(buf, L"%dk", pEntry->GetUncompressedLen() / 1024); wsprintf(buf, L"%I64dk", pEntry->GetUncompressedLen() / 1024);
else else
wsprintf(buf, L"$%04lX", pEntry->GetAuxType()); wsprintf(buf, L"$%04lX", pEntry->GetAuxType());
} }
@ -578,14 +578,14 @@ ContentList::OnGetDispInfo(NMHDR* pnmh, LRESULT* pResult)
wcscpy(plvdi->item.pszText, pEntry->GetFormatStr()); wcscpy(plvdi->item.pszText, pEntry->GetFormatStr());
break; break;
case 5: // size case 5: // size
wsprintf(plvdi->item.pszText, L"%ld", pEntry->GetUncompressedLen()); wsprintf(plvdi->item.pszText, L"%I64d", pEntry->GetUncompressedLen());
break; break;
case 6: // ratio case 6: // ratio
int crud; int crud;
MakeRatioDisplayString(pEntry, plvdi->item.pszText, &crud); MakeRatioDisplayString(pEntry, plvdi->item.pszText, &crud);
break; break;
case 7: // packed case 7: // packed
wsprintf(plvdi->item.pszText, L"%ld", pEntry->GetCompressedLen()); wsprintf(plvdi->item.pszText, L"%I64d", pEntry->GetCompressedLen());
break; break;
case 8: // access case 8: // access
WCHAR bitLabels[sizeof(kAccessBits)]; WCHAR bitLabels[sizeof(kAccessBits)];

View File

@ -254,7 +254,7 @@ ConvDiskOptionsDialog::OnCompute(void)
//xferOpts.fUseSparseBlocks = //xferOpts.fUseSparseBlocks =
// pPreferences->GetPrefBool(kPrProDOSUseSparse) != 0; // pPreferences->GetPrefBool(kPrProDOSUseSparse) != 0;
LOGI("New volume name will be '%ls'", fVolName); LOGI("New volume name will be '%ls'", (LPCWSTR) fVolName);
/* /*
* Create a new disk image file. * Create a new disk image file.

View File

@ -106,7 +106,7 @@ DiskEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength,
if (needAlloc) { if (needAlloc) {
dataBuf = new char[(int) len]; dataBuf = new char[(int) len];
if (dataBuf == NULL) { if (dataBuf == NULL) {
pErrMsg->Format(L"ERROR: allocation of %ld bytes failed", len); pErrMsg->Format(L"ERROR: allocation of %I64d bytes failed", len);
goto bail; goto bail;
} }
} else { } else {
@ -922,7 +922,7 @@ DiskArchive::Close(void)
msg.Format(L"Failed while closing disk image: %hs.", msg.Format(L"Failed while closing disk image: %hs.",
DiskImgLib::DIStrError(dierr)); DiskImgLib::DIStrError(dierr));
failed.LoadString(IDS_FAILED); failed.LoadString(IDS_FAILED);
LOGI("During close: %ls", msg); LOGE("During close: %ls", (LPCWSTR) msg);
pMainWin->MessageBox(msg, failed, MB_OK); pMainWin->MessageBox(msg, failed, MB_OK);
} }
@ -2214,9 +2214,9 @@ DiskArchive::AddToAddDataList(FileAddData* pData)
(listKind == FileDetails::kFileKindDataFork || listKind == FileDetails::kFileKindRsrcFork)) (listKind == FileDetails::kFileKindDataFork || listKind == FileDetails::kFileKindRsrcFork))
{ {
/* looks good, hook it in here instead of the list */ /* looks good, hook it in here instead of the list */
LOGI("--- connecting forks of '%ls' and '%ls'", LOGD("--- connecting forks of '%ls' and '%ls'",
pData->GetDetails()->origName, (LPCWSTR) pData->GetDetails()->origName,
pSearch->GetDetails()->origName); (LPCWSTR) pSearch->GetDetails()->origName);
pSearch->SetOtherFork(pData); pSearch->SetOtherFork(pData);
return; return;
} }
@ -2520,13 +2520,13 @@ DiskArchive::RenameSelection(CWnd* pMsgWnd, SelectionSet* pSelSet)
dierr = pDiskFS->RenameFile(pFile, newNameA); dierr = pDiskFS->RenameFile(pFile, newNameA);
if (dierr != kDIErrNone) { if (dierr != kDIErrNone) {
errMsg.Format(L"Unable to rename '%ls' to '%ls': %hs.", errMsg.Format(L"Unable to rename '%ls' to '%ls': %hs.",
pEntry->GetPathName(), renameDlg.fNewName, pEntry->GetPathName(), (LPCWSTR) renameDlg.fNewName,
DiskImgLib::DIStrError(dierr)); DiskImgLib::DIStrError(dierr));
ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED); ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED);
goto bail; goto bail;
} }
LOGI("Rename of '%ls' to '%ls' succeeded", LOGI("Rename of '%ls' to '%ls' succeeded",
pEntry->GetDisplayName(), renameDlg.fNewName); pEntry->GetDisplayName(), (LPCWSTR) renameDlg.fNewName);
} else if (result == IDCANCEL) { } else if (result == IDCANCEL) {
LOGI("Canceling out of remaining renames"); LOGI("Canceling out of remaining renames");
break; break;
@ -2904,7 +2904,7 @@ DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
goto bail; /* abort anything that was pending */ goto bail; /* abort anything that was pending */
} else if (result != IDOK) { } else if (result != IDOK) {
errMsg.Format(L"Failed while extracting '%ls': %ls.", errMsg.Format(L"Failed while extracting '%ls': %ls.",
fixedPathName, extractErrMsg); (LPCWSTR) fixedPathName, (LPCWSTR) extractErrMsg);
ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED); ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED);
goto bail; goto bail;
} }
@ -2945,7 +2945,7 @@ DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet,
goto bail; /* abort anything that was pending */ goto bail; /* abort anything that was pending */
} else if (result != IDOK) { } else if (result != IDOK) {
errMsg.Format(L"Failed while extracting '%ls': %ls.", errMsg.Format(L"Failed while extracting '%ls': %ls.",
fixedPathName, extractErrMsg); (LPCWSTR) fixedPathName, (LPCWSTR) extractErrMsg);
ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED); ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED);
goto bail; goto bail;
} }
@ -3066,7 +3066,7 @@ DiskArchive::XferFile(FileDetails* pDetails, BYTE** pDataBuf,
DIError dierr = kDIErrNone; DIError dierr = kDIErrNone;
LOGI(" XFER: transfer '%ls' (dataLen=%ld rsrcLen=%ld)", LOGI(" XFER: transfer '%ls' (dataLen=%ld rsrcLen=%ld)",
pDetails->storageName, dataLen, rsrcLen); (LPCWSTR) pDetails->storageName, dataLen, rsrcLen);
ASSERT(pDataBuf != NULL); ASSERT(pDataBuf != NULL);
ASSERT(pRsrcBuf != NULL); ASSERT(pRsrcBuf != NULL);
@ -3098,12 +3098,13 @@ DiskArchive::XferFile(FileDetails* pDetails, BYTE** pDataBuf,
long len = dataLen; long len = dataLen;
if (srcIsDOS && !dstIsDOS) { if (srcIsDOS && !dstIsDOS) {
LOGI(" Stripping high ASCII from '%ls'", pDetails->storageName); LOGD(" Stripping high ASCII from '%ls'",
(LPCWSTR) pDetails->storageName);
while (len--) while (len--)
*ucp++ &= 0x7f; *ucp++ &= 0x7f;
} else if (!srcIsDOS && dstIsDOS) { } else if (!srcIsDOS && dstIsDOS) {
LOGI(" Adding high ASCII to '%ls'", pDetails->storageName); LOGD(" Adding high ASCII to '%ls'", (LPCWSTR) pDetails->storageName);
while (len--) { while (len--) {
if (*ucp != '\0') if (*ucp != '\0')
@ -3111,10 +3112,10 @@ DiskArchive::XferFile(FileDetails* pDetails, BYTE** pDataBuf,
ucp++; ucp++;
} }
} else if (srcIsDOS && dstIsDOS) { } else if (srcIsDOS && dstIsDOS) {
LOGI(" --- not altering DOS-to-DOS text '%ls'", LOGD(" --- not altering DOS-to-DOS text '%ls'",
pDetails->storageName); (LPCWSTR) pDetails->storageName);
} else { } else {
LOGI(" --- non-DOS transfer '%ls'", pDetails->storageName); LOGD(" --- non-DOS transfer '%ls'", (LPCWSTR) pDetails->storageName);
} }
} }

View File

@ -925,9 +925,9 @@ SectorFileEditDialog::OnInitDialog(void)
CString title; CString title;
CString rsrcIndic; CString rsrcIndic;
rsrcIndic.LoadString(IDS_INDIC_RSRC); rsrcIndic.LoadString(IDS_INDIC_RSRC);
title.Format(L"Disk Viewer - %hs%ls (%ld bytes)", title.Format(L"Disk Viewer - %hs%ls (%I64d bytes)",
(LPCSTR) fpFile->GetPathName(), // use fpFile version to get case (LPCSTR) fpFile->GetPathName(), // use fpFile version to get case
fOpenRsrcFork ? (LPCWSTR)rsrcIndic : L"", fLength); fOpenRsrcFork ? (LPCWSTR)rsrcIndic : L"", (LONGLONG) fLength);
SetWindowText(title); SetWindowText(title);
return retval; return retval;
@ -1323,9 +1323,9 @@ BlockFileEditDialog::OnInitDialog(void)
CString title; CString title;
CString rsrcIndic; CString rsrcIndic;
rsrcIndic.LoadString(IDS_INDIC_RSRC); rsrcIndic.LoadString(IDS_INDIC_RSRC);
title.Format(L"Disk Viewer - %hs%ls (%ld bytes)", title.Format(L"Disk Viewer - %hs%ls (%I64d bytes)",
(LPCSTR) fpFile->GetPathName(), // use fpFile version to get case (LPCSTR) fpFile->GetPathName(), // use fpFile version to get case
fOpenRsrcFork ? (LPCWSTR)rsrcIndic : L"", fLength); fOpenRsrcFork ? (LPCWSTR)rsrcIndic : L"", (LONGLONG) fLength);
SetWindowText(title); SetWindowText(title);
return retval; return retval;

View File

@ -1043,7 +1043,7 @@ PathProposal::LocalToArchive(const AddFilesDialog* pAddOpts)
WCHAR slashDotDotSlash[5] = L"_.._"; WCHAR slashDotDotSlash[5] = L"_.._";
fStoredPathName = fLocalPathName; fStoredPathName = fLocalPathName;
WCHAR* livePathStr = fStoredPathName.GetBuffer(0); WCHAR* livePathStr = fStoredPathName.GetBuffer(1);
fStoredFssep = kDefaultStoredFssep; fStoredFssep = kDefaultStoredFssep;

View File

@ -1704,7 +1704,7 @@ MainWindow::TmpExtractAndOpen(GenericEntry* pEntry, int threadKind,
CString parameters; CString parameters;
parameters.Format(L"-mode %ls -dispname \"%ls\" -temparc \"%ls\"", parameters.Format(L"-mode %ls -dispname \"%ls\" -temparc \"%ls\"",
modeStr, dispName, nameBuf); modeStr, (LPCWSTR) dispName, nameBuf);
int err; int err;
err = (int) ::ShellExecute(m_hWnd, L"open", err = (int) ::ShellExecute(m_hWnd, L"open",

View File

@ -385,22 +385,22 @@ private:
public: public:
DeleteList(void) { fHead = NULL; } DeleteList(void) { fHead = NULL; }
~DeleteList(void) { ~DeleteList(void) {
LOGI("Processing DeleteList (head=0x%08lx)", fHead); LOGD("Processing DeleteList (head=0x%p)", fHead);
DeleteListNode* pNode = fHead; DeleteListNode* pNode = fHead;
DeleteListNode* pNext; DeleteListNode* pNext;
while (pNode != NULL) { while (pNode != NULL) {
pNext = pNode->fNext; pNext = pNode->fNext;
if (_wunlink(pNode->fName) != 0) { if (_wunlink(pNode->fName) != 0) {
LOGI(" WARNING: delete of '%ls' failed, err=%d", LOGW(" WARNING: delete of '%ls' failed, err=%d",
pNode->fName, errno); (LPCWSTR) pNode->fName, errno);
} else { } else {
LOGI(" Deleted '%ls'", pNode->fName); LOGI(" Deleted '%ls'", (LPCWSTR) pNode->fName);
} }
delete pNode; delete pNode;
pNode = pNext; pNode = pNext;
} }
LOGI("Processing DeleteList completed"); LOGD("Processing DeleteList completed");
} }
void Add(const CString& name) { void Add(const CString& name) {

View File

@ -307,6 +307,7 @@ NufxEntry::FindThreadInfo(int which, NuThread* pRetThread,
pThread = NULL; pThread = NULL;
for (i = 0; i < (int)NuRecordGetNumThreads(pRecord); i++) { for (i = 0; i < (int)NuRecordGetNumThreads(pRecord); i++) {
pThread = NuGetThread(pRecord, i); pThread = NuGetThread(pRecord, i);
assert(pThread != NULL);
if (NuGetThreadID(pThread) == wantedThreadID) if (NuGetThreadID(pThread) == wantedThreadID)
break; break;
} }
@ -317,6 +318,7 @@ NufxEntry::FindThreadInfo(int which, NuThread* pRetThread,
goto bail; goto bail;
} }
assert(pThread != NULL);
memcpy(pRetThread, pThread, sizeof(*pRetThread)); memcpy(pRetThread, pThread, sizeof(*pRetThread));
bail: bail:
@ -1269,7 +1271,7 @@ bail:
NuAbort(fpArchive); // abort anything that didn't get flushed NuAbort(fpArchive); // abort anything that didn't get flushed
NuFreeDataSource(pSource); NuFreeDataSource(pSource);
if (SetCurrentDirectory(curDir) == false) { if (SetCurrentDirectory(curDir) == false) {
errMsg.Format(L"Unable to reset current directory to '%hs'.\n", buf); errMsg.Format(L"Unable to reset current directory to '%ls'.\n", buf);
ShowFailureMsg(fpMsgWnd, errMsg, IDS_FAILED); ShowFailureMsg(fpMsgWnd, errMsg, IDS_FAILED);
// bummer // bummer
} }
@ -2233,7 +2235,7 @@ NufxArchive::XferFile(FileDetails* pDetails, unsigned char** pDataBuf,
CString errMsg; CString errMsg;
LOGI(" NufxArchive::XferFile '%ls'", (LPCWSTR) pDetails->storageName); LOGI(" NufxArchive::XferFile '%ls'", (LPCWSTR) pDetails->storageName);
LOGI(" dataBuf=0x%08lx dataLen=%ld rsrcBuf=0x%08lx rsrcLen=%ld", LOGI(" dataBuf=0x%p dataLen=%ld rsrcBuf=0x%p rsrcLen=%ld",
*pDataBuf, dataLen, *pRsrcBuf, rsrcLen); *pDataBuf, dataLen, *pRsrcBuf, rsrcLen);
ASSERT(pDataBuf != NULL); ASSERT(pDataBuf != NULL);
ASSERT(pRsrcBuf != NULL); ASSERT(pRsrcBuf != NULL);

View File

@ -553,7 +553,7 @@ OpenVolumeDialog::HasPhysicalDriveWin2K(int unit, CString* pRemark)
if (result) { if (result) {
LOGI(" Results for device %02xh", unit); LOGI(" Results for device %02xh", unit);
LOGI(" Cylinders = %I64d", dg.Cylinders); LOGI(" Cylinders = %I64d", dg.Cylinders.QuadPart);
LOGI(" Tracks per cylinder = %ld", (ULONG) dg.TracksPerCylinder); LOGI(" Tracks per cylinder = %ld", (ULONG) dg.TracksPerCylinder);
LOGI(" Sectors per track = %ld", (ULONG) dg.SectorsPerTrack); LOGI(" Sectors per track = %ld", (ULONG) dg.SectorsPerTrack);
LOGI(" Bytes per sector = %ld", (ULONG) dg.BytesPerSector); LOGI(" Bytes per sector = %ld", (ULONG) dg.BytesPerSector);

View File

@ -338,11 +338,11 @@ Preferences::InitTempPath(void)
} }
PathName path(tempPath); PathName path(tempPath);
LOGI("Temp path is '%ls'", tempPath); LOGD("Temp path is '%ls'", (LPCWSTR) tempPath);
path.SFNToLFN(); path.SFNToLFN();
tempPath = path.GetPathName(); tempPath = path.GetPathName();
LOGI("Temp path (long form) is '%ls'", tempPath); LOGD("Temp path (long form) is '%ls'", (LPCWSTR) tempPath);
SetPrefString(kPrTempPath, tempPath); SetPrefString(kPrTempPath, tempPath);

View File

@ -347,18 +347,18 @@ MyRegistry::ConfigureAppIDSubFields(HKEY hAppKey, const WCHAR* descr,
(LPBYTE)(LPCWSTR) openCmd, (LPBYTE)(LPCWSTR) openCmd,
wcslen(openCmd) * sizeof(WCHAR)) == ERROR_SUCCESS) wcslen(openCmd) * sizeof(WCHAR)) == ERROR_SUCCESS)
{ {
LOGI(" Set command to '%ls'", openCmd); LOGI(" Set command to '%ls'", (LPCWSTR) openCmd);
} else { } else {
LOGI(" WARNING: unable to set open cmd '%ls'", openCmd); LOGW(" WARNING: unable to set open cmd '%ls'",
(LPCWSTR) openCmd);
} }
} }
RegCloseKey(hCommandKey);
} }
RegCloseKey(hOpenKey);
} }
RegCloseKey(hShellKey);
} }
RegCloseKey(hCommandKey);
RegCloseKey(hOpenKey);
RegCloseKey(hShellKey);
} }
@ -442,7 +442,7 @@ MyRegistry::GetFileAssoc(int idx, CString* pExt, CString* pHandler,
LOGI("RegQueryValueEx failed on '%ls'", (LPCWSTR) *pExt); LOGI("RegQueryValueEx failed on '%ls'", (LPCWSTR) *pExt);
} }
} else { } else {
LOGI(" RegOpenKeyEx failed on '%ls'", *pExt); LOGW(" RegOpenKeyEx failed on '%ls'", (LPCWSTR) *pExt);
} }
*pOurs = false; *pOurs = false;
@ -492,14 +492,15 @@ MyRegistry::GetAssocAppName(const CString& appID, CString* pCmd) const
*pCmd = cmd; *pCmd = cmd;
result = 0; result = 0;
} else { } else {
LOGI("Unable to open shell\\open\\command for '%ls'", appID); LOGW("Unable to open shell\\open\\command for '%ls'",
(LPCWSTR) appID);
} }
} else { } else {
CString errBuf; CString errBuf;
GetWin32ErrorString(res, &errBuf); GetWin32ErrorString(res, &errBuf);
LOGI("Unable to open AppID key '%ls' (%ls)", LOGW("Unable to open AppID key '%ls' (%ls)",
keyName, (LPCWSTR) errBuf); (LPCWSTR) keyName, (LPCWSTR) errBuf);
} }
RegCloseKey(hAppKey); RegCloseKey(hAppKey);
@ -589,9 +590,9 @@ MyRegistry::GetAssocState(const WCHAR* ext) const
if (IsOurAppID((WCHAR*)buf)) if (IsOurAppID((WCHAR*)buf))
result = true; result = true;
} }
RegCloseKey(hExtKey);
} }
RegCloseKey(hExtKey);
return result; return result;
} }

View File

@ -165,6 +165,7 @@ MainWindow::OnToolsDiskEdit(void)
readOnly = (dlg.fReadOnly != 0); readOnly = (dlg.fReadOnly != 0);
} else if (diskEditOpen.fOpenWhat == DiskEditOpenDialog::kOpenCurrent) { } else if (diskEditOpen.fOpenWhat == DiskEditOpenDialog::kOpenCurrent) {
// get values from currently open archive // get values from currently open archive
assert(fpOpenArchive != NULL);
loadName = fpOpenArchive->GetPathName(); loadName = fpOpenArchive->GetPathName();
readOnly = fpOpenArchive->IsReadOnly(); readOnly = fpOpenArchive->IsReadOnly();
} else { } else {

View File

@ -305,7 +305,7 @@ DumpBitmapInfo(HBITMAP hBitmap)
LOGI(" bmWidthBytes=%d", info.bmWidthBytes); LOGI(" bmWidthBytes=%d", info.bmWidthBytes);
LOGI(" bmPlanes=%d", info.bmPlanes); LOGI(" bmPlanes=%d", info.bmPlanes);
LOGI(" bmBitsPixel=%d", info.bmBitsPixel); LOGI(" bmBitsPixel=%d", info.bmBitsPixel);
LOGI(" bmPits = 0x%08lx", info.bmBits); LOGI(" bmPits = 0x%p", info.bmBits);
} }

View File

@ -577,7 +577,7 @@ VolumeCopyDialog::OnCopyToFile(void)
else else
elapsed = (float) (endWhen - startWhen); elapsed = (float) (endWhen - startWhen);
msg.Format(L"Copied %ld blocks in %ld seconds (%.2fKB/sec)", msg.Format(L"Copied %ld blocks in %ld seconds (%.2fKB/sec)",
pSrcImg->GetNumBlocks(), endWhen - startWhen, pSrcImg->GetNumBlocks(), (long) (endWhen - startWhen),
(pSrcImg->GetNumBlocks() / 2.0) / elapsed); (pSrcImg->GetNumBlocks() / 2.0) / elapsed);
LOGI("%ls", (LPCWSTR) msg); LOGI("%ls", (LPCWSTR) msg);
#ifdef _DEBUG #ifdef _DEBUG
@ -832,7 +832,7 @@ VolumeCopyDialog::OnCopyFromFile(void)
else else
elapsed = (float) (endWhen - startWhen); elapsed = (float) (endWhen - startWhen);
errMsg.Format(L"Copied %ld blocks in %ld seconds (%.2fKB/sec)", errMsg.Format(L"Copied %ld blocks in %ld seconds (%.2fKB/sec)",
srcImg.GetNumBlocks(), endWhen - startWhen, srcImg.GetNumBlocks(), (long) (endWhen - startWhen),
(srcImg.GetNumBlocks() / 2.0) / elapsed); (srcImg.GetNumBlocks() / 2.0) / elapsed);
LOGI("%ls", (LPCWSTR) errMsg); LOGI("%ls", (LPCWSTR) errMsg);
#ifdef _DEBUG #ifdef _DEBUG

View File

@ -569,7 +569,7 @@ DiskImg::CloseImage(void)
{ {
DIError dierr; DIError dierr;
LOGI("CloseImage %p", this); LOGI("CloseImage 0x%p", this);
/* check for DiskFS objects that still point to us */ /* check for DiskFS objects that still point to us */
if (fDiskFSRefCnt != 0) { if (fDiskFSRefCnt != 0) {

View File

@ -399,7 +399,7 @@ bail:
NuFreeDataSink(pDataSink); NuFreeDataSink(pDataSink);
if (err != kNuErrNone) { if (err != kNuErrNone) {
LOGI(" NuFX GetNuFXDiskImage returning after nuerr=%d", err); LOGI(" NuFX GetNuFXDiskImage returning after nuerr=%d", err);
delete buf; delete[] buf;
} }
if (err == kNuErrNone) if (err == kNuErrNone)
return kDIErrNone; return kDIErrNone;

View File

@ -4431,7 +4431,7 @@ A2FileProDOS::LoadDirectoryBlockList(unsigned short keyBlock,
bail: bail:
if (dierr != kDIErrNone) if (dierr != kDIErrNone)
delete list; delete[] list;
return dierr; return dierr;
} }

View File

@ -187,7 +187,7 @@ MainWindow::NufxErrorMsgHandler(NuArchive* /*pArchive*/, void* vErrorMessage)
{ {
const NuErrorMessage* pErrorMessage = (const NuErrorMessage*) vErrorMessage; const NuErrorMessage* pErrorMessage = (const NuErrorMessage*) vErrorMessage;
LOG_BASE(pErrorMessage->isDebug ? DebugLog::LOG_DEBUG : DebugLog::LOG_WARNING, LOG_BASE(pErrorMessage->isDebug ? DebugLog::LOG_DEBUG : DebugLog::LOG_WARN,
pErrorMessage->file, pErrorMessage->line, "<nufxlib> %hs", pErrorMessage->file, pErrorMessage->line, "<nufxlib> %hs",
pErrorMessage->message); pErrorMessage->message);
@ -317,7 +317,7 @@ MainWindow::ScanFiles(void)
} }
end = time(NULL); end = time(NULL);
fprintf(scanOpts.outfp, "\nScan completed in %ld seconds.\n", fprintf(scanOpts.outfp, "\nScan completed in %ld seconds.\n",
end - start); (long) (end - start));
{ {
SetWindowText(L"MDC Done!"); SetWindowText(L"MDC Done!");
@ -818,7 +818,7 @@ MainWindow::LoadDiskFSContents(DiskFS* pDiskFS, const char* volName,
if (recordKind == kRecordKindVolumeDir) { if (recordKind == kRecordKindVolumeDir) {
/* this is a volume directory */ /* this is a volume directory */
LOGI("Not displaying volume dir '%ls'", pFile->GetPathName()); LOGI("Not displaying volume dir '%hs'", pFile->GetPathName());
continue; continue;
} }
@ -869,7 +869,7 @@ MainWindow::LoadDiskFSContents(DiskFS* pDiskFS, const char* volName,
pFile->GetAuxType()); pFile->GetAuxType());
break; break;
case kRecordKindDisk: case kRecordKindDisk:
sprintf(tmpbuf, "%ldk", totalLen / 1024); sprintf(tmpbuf, "%I64dk", totalLen / 1024);
fprintf(pScanOpts->outfp, "Disk %-6hs ", tmpbuf); fprintf(pScanOpts->outfp, "Disk %-6hs ", tmpbuf);
break; break;
case kRecordKindFile: case kRecordKindFile:
@ -940,7 +940,7 @@ MainWindow::LoadDiskFSContents(DiskFS* pDiskFS, const char* volName,
FormatDate(kDateNone, &date); FormatDate(kDateNone, &date);
else else
FormatDate(pFile->GetModWhen(), &date); FormatDate(pFile->GetModWhen(), &date);
fprintf(pScanOpts->outfp, "%-15s ", (LPCTSTR) date); fprintf(pScanOpts->outfp, "%-15ls ", (LPCWSTR) date);
const char* fmtStr; const char* fmtStr;
switch (pFile->GetFSFormat()) { switch (pFile->GetFSFormat()) {
@ -997,7 +997,7 @@ MainWindow::LoadDiskFSContents(DiskFS* pDiskFS, const char* volName,
if (!totalLen && totalCompLen) if (!totalLen && totalCompLen)
fprintf(pScanOpts->outfp, " ????"); /* weird */ fprintf(pScanOpts->outfp, " ????"); /* weird */
else else
fprintf(pScanOpts->outfp, "%8ld", totalLen); fprintf(pScanOpts->outfp, "%8I64d", totalLen);
fprintf(pScanOpts->outfp, "\n"); fprintf(pScanOpts->outfp, "\n");
} }

View File

@ -1,4 +1,4 @@
//Microsoft Developer Studio generated resource script. // Microsoft Visual C++ generated resource script.
// //
#include "resource.h" #include "resource.h"
@ -16,13 +16,11 @@
#undef APSTUDIO_READONLY_SYMBOLS #undef APSTUDIO_READONLY_SYMBOLS
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources // English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252) #pragma code_page(1252)
#endif //_WIN32
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
@ -31,14 +29,14 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// Icon with lowest ID value placed first to ensure application icon // Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems. // remains consistent on all systems.
IDI_MDC ICON DISCARDABLE "mdc.ICO" IDI_MDC ICON "mdc.ICO"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Menu // Menu
// //
IDC_MDC MENU DISCARDABLE IDC_MDC MENU
BEGIN BEGIN
POPUP "&File" POPUP "&File"
BEGIN BEGIN
@ -58,7 +56,7 @@ END
// Accelerator // Accelerator
// //
IDC_MDC ACCELERATORS MOVEABLE PURE IDC_MDC ACCELERATORS
BEGIN BEGIN
"?", IDM_ABOUT, ASCII, ALT "?", IDM_ABOUT, ASCII, ALT
"/", IDM_ABOUT, ASCII, ALT "/", IDM_ABOUT, ASCII, ALT
@ -70,35 +68,31 @@ END
// Dialog // Dialog
// //
IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 156, 111 IDD_ABOUTBOX DIALOG 22, 17, 156, 111
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
CAPTION "About" CAPTION "About"
FONT 10, "MS Sans Serif" FONT 10, "MS Sans Serif"
BEGIN BEGIN
ICON IDI_MDC,IDC_MYICON,7,7,20,20 ICON IDI_MDC,IDC_MYICON,7,7,20,20
LTEXT "MDC version %d.%d.%d",IDC_ABOUT_VERS,33,7,116,8, LTEXT "MDC version %d.%d.%d",IDC_ABOUT_VERS,33,7,116,8,SS_NOPREFIX
SS_NOPREFIX LTEXT "Copyright © 2009 by CiderPress project authors.\rAll Rights Reserved.",IDC_STATIC,7,31,142,19
LTEXT "Copyright © 2009 by CiderPress project authors.\rAll Rights Reserved.",
IDC_STATIC,7,31,142,19
DEFPUSHBUTTON "OK",IDOK,53,90,50,14 DEFPUSHBUTTON "OK",IDOK,53,90,50,14
LTEXT "This utility scans Apple II disk images and creates formatted listings of the files in them.", LTEXT "This utility scans Apple II disk images and creates formatted listings of the files in them.",IDC_STATIC,7,58,142,26
IDC_STATIC,7,58,142,26
LTEXT "Multi-Disk Catalog",IDC_STATIC,33,15,55,8 LTEXT "Multi-Disk Catalog",IDC_STATIC,33,15,55,8
END END
IDD_CHOOSE_FILES DIALOGEX 0, 0, 272, 131 IDD_CHOOSE_FILES DIALOGEX 0, 0, 272, 131
STYLE DS_3DLOOK | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS STYLE DS_SETFONT | DS_3DLOOK | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS
FONT 8, "MS Sans Serif", 0, 0, 0x1 FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN BEGIN
LTEXT "",1119,0,0,272,87,NOT WS_GROUP,WS_EX_STATICEDGE LTEXT "",1119,0,0,272,87,NOT WS_GROUP,WS_EX_STATICEDGE
PUSHBUTTON "&Accept",IDC_SELECT_ACCEPT,220,88,50,14 PUSHBUTTON "&Accept",IDC_SELECT_ACCEPT,220,88,50,14
PUSHBUTTON "Cancel",IDCANCEL,220,107,50,14 PUSHBUTTON "Cancel",IDCANCEL,220,107,50,14
LTEXT "Select the disk images to scan. If you select a folder, all files in that folder will be processed.", LTEXT "Select the disk images to scan. If you select a folder, all files in that folder will be processed.",IDC_CHOOSEFILES_STATIC1,7,104,199,17
IDC_CHOOSEFILES_STATIC1,7,104,199,17
END END
IDD_PROGRESS DIALOG DISCARDABLE 0, 0, 250, 66 IDD_PROGRESS DIALOG 0, 0, 250, 66
STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION
CAPTION "Progress..." CAPTION "Progress..."
FONT 8, "MS Sans Serif" FONT 8, "MS Sans Serif"
BEGIN BEGIN
@ -114,7 +108,7 @@ END
// TEXTINCLUDE // TEXTINCLUDE
// //
2 TEXTINCLUDE DISCARDABLE 2 TEXTINCLUDE
BEGIN BEGIN
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n" "#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""afxres.h""\r\n" "#include ""afxres.h""\r\n"
@ -123,13 +117,13 @@ BEGIN
"\0" "\0"
END END
3 TEXTINCLUDE DISCARDABLE 3 TEXTINCLUDE
BEGIN BEGIN
"\r\n" "\r\n"
"\0" "\0"
END END
1 TEXTINCLUDE DISCARDABLE 1 TEXTINCLUDE
BEGIN BEGIN
"resource.h\0" "resource.h\0"
END END
@ -143,7 +137,7 @@ END
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE GUIDELINES DESIGNINFO
BEGIN BEGIN
IDD_ABOUTBOX, DIALOG IDD_ABOUTBOX, DIALOG
BEGIN BEGIN
@ -176,7 +170,7 @@ END
// String Table // String Table
// //
STRINGTABLE DISCARDABLE STRINGTABLE
BEGIN BEGIN
IDS_APP_TITLE "MDC" IDS_APP_TITLE "MDC"
IDC_MDC "MDC" IDC_MDC "MDC"
@ -184,13 +178,13 @@ BEGIN
IDS_FAILED "Failed" IDS_FAILED "Failed"
END END
STRINGTABLE DISCARDABLE STRINGTABLE
BEGIN BEGIN
IDM_FILE_SCAN "Select disk images to scan" IDM_FILE_SCAN "Select disk images to scan"
IDM_HELP_WEBSITE "Visit the CiderPress web site\nGo to web site" IDM_HELP_WEBSITE "Visit the CiderPress web site\nGo to web site"
END END
#endif // English (U.S.) resources #endif // English (United States) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View File

@ -1,5 +1,5 @@
//{{NO_DEPENDENCIES}} //{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file. // Microsoft Visual C++ generated include file.
// Used by mdc.rc // Used by mdc.rc
// //
#define IDC_MYICON 2 #define IDC_MYICON 2

View File

@ -281,16 +281,16 @@ ReformatAWP::ProcessLineRecord(uchar lineRecData, uchar lineRecCode,
case kLineRecordCommandPageBreakPara: case kLineRecordCommandPageBreakPara:
case kLineRecordCommandPageBreakPara256: case kLineRecordCommandPageBreakPara256:
default: default:
LOGI(" AWP cmd <0x%02x><0x%02x>", lineRecCode, lineRecData); LOGD(" AWP cmd <0x%02x><0x%02x>", lineRecCode, lineRecData);
break; break;
} }
} else { } else {
/* bad command */ /* bad command */
LOGI("WARNING: unrecognized code 0x%02x at 0x%08lx", lineRecCode, LOGW("WARNING: unrecognized code 0x%02x at 0x%p", lineRecCode,
*pSrcPtr); *pSrcPtr);
fDocState.softFailures++; fDocState.softFailures++;
if (fDocState.softFailures > kMaxSoftFailures) { if (fDocState.softFailures > kMaxSoftFailures) {
LOGI("ERROR: too many failures, giving up"); LOGE("ERROR: too many failures, giving up");
err = -1; err = -1;
} }
} }

View File

@ -951,7 +951,7 @@ ReformatLISA3::Process(const ReformatHolder* pHolder,
codePtr += lineLen-1; codePtr += lineLen-1;
} }
LOGI("codePtr=%p endPtr=%p numLines=%d", codePtr, endPtr, lineNum-1); LOGI("codePtr=0x%p endPtr=%p numLines=%d", codePtr, endPtr, lineNum-1);
LOGI("extra = %d", endPtr - codePtr); LOGI("extra = %d", endPtr - codePtr);
SetResultBuffer(pOutput); SetResultBuffer(pOutput);
@ -1631,7 +1631,7 @@ ReformatLISA4::Process(const ReformatHolder* pHolder,
goto bail; goto bail;
} }
LOGI(" LISA4 symPtr=%p endPtr=%p symIdx=%d", symPtr, endPtr, symIdx); LOGI(" LISA4 symPtr=0x%p endPtr=0x%p symIdx=%d", symPtr, endPtr, symIdx);
/* /*
* Process source lines. * Process source lines.
@ -1718,7 +1718,7 @@ ReformatLISA4::Process(const ReformatHolder* pHolder,
codePtr += lineLen-1; codePtr += lineLen-1;
} }
LOGI(" LISA4 codePtr=%p endPtr=%p numLines=%d", LOGI(" LISA4 codePtr=0x%p endPtr=0x%p numLines=%d",
codePtr, endPtr, lineNum-1); codePtr, endPtr, lineNum-1);
LOGI(" LISA4 extra = %d", endPtr - codePtr); LOGI(" LISA4 extra = %d", endPtr - codePtr);

View File

@ -196,7 +196,7 @@ DreamGrafix::UnpackDG(const unsigned char* srcBuf, long srcLen,
actual = UnpackLZW(srcBuf, srcLen, tmpBuf, expectedLen); actual = UnpackLZW(srcBuf, srcLen, tmpBuf, expectedLen);
if (actual != expectedLen && actual != (expectedLen-512)) { if (actual != expectedLen && actual != (expectedLen-512)) {
LOGI("UnpackLZW expected %d, got %d", expectedLen, actual); LOGI("UnpackLZW expected %d, got %d", expectedLen, actual);
free(tmpBuf); delete[] tmpBuf;
return false; return false;
} }
@ -221,7 +221,7 @@ DreamGrafix::UnpackDG(const unsigned char* srcBuf, long srcLen,
} }
} }
free(tmpBuf); delete[] tmpBuf;
return true; return true;
} }

View File

@ -422,7 +422,7 @@ ReformatPaintworksSHR::Process(const ReformatHolder* pHolder,
int i, result; int i, result;
if (pHolder->GetSourceLen(part) < kMinSize) { if (pHolder->GetSourceLen(part) < kMinSize) {
LOGI(" SHR file too short!", pHolder->GetSourceLen(part)); LOGW(" SHR file too short (%ld)", pHolder->GetSourceLen(part));
goto bail; goto bail;
} }
@ -526,7 +526,7 @@ ReformatPackedSHR::Process(const ReformatHolder* pHolder,
int retval = -1; int retval = -1;
if (pHolder->GetSourceLen(part) < 4) { if (pHolder->GetSourceLen(part) < 4) {
LOGI(" SHR file too short!", pHolder->GetSourceLen(part)); LOGW(" SHR file too short (%ld)", pHolder->GetSourceLen(part));
goto bail; goto bail;
} }
@ -536,7 +536,7 @@ ReformatPackedSHR::Process(const ReformatHolder* pHolder,
pHolder->GetSourceBuf(part), kTotalSize, pHolder->GetSourceBuf(part), kTotalSize,
pHolder->GetSourceLen(part)) != 0) pHolder->GetSourceLen(part)) != 0)
{ {
LOGI(" SHR UnpackBytes failed"); LOGW(" SHR UnpackBytes failed");
goto bail; goto bail;
} }
@ -606,7 +606,7 @@ ReformatAPFSHR::Process(const ReformatHolder* pHolder,
int retval = -1; int retval = -1;
if (srcLen < 4) { if (srcLen < 4) {
LOGI(" SHR file too short!", srcLen); LOGW(" SHR file too short (%ld)", srcLen);
goto bail; goto bail;
} }
@ -639,7 +639,7 @@ ReformatAPFSHR::Process(const ReformatHolder* pHolder,
dataLen = blockLen - (nameLen+1 + 4); dataLen = blockLen - (nameLen+1 + 4);
LOGI(" APFSHR block='%ls' blockLen=%ld (dataLen=%ld) start=0x%08lx", LOGI(" APFSHR block='%ls' blockLen=%ld (dataLen=%ld) start=0x%p",
(LPCWSTR) blockName, blockLen, dataLen, srcPtr); (LPCWSTR) blockName, blockLen, dataLen, srcPtr);
if (blockName == "MAIN") { if (blockName == "MAIN") {
@ -837,7 +837,7 @@ ReformatAPFSHR::UnpackMain(const unsigned char* srcPtr, long srcLen)
if (packedDataLen[i] > fPixelsPerScanLine) { if (packedDataLen[i] > fPixelsPerScanLine) {
/* each pixel is 2 or 4 bits, so this is a 2-4x expansion */ /* each pixel is 2 or 4 bits, so this is a 2-4x expansion */
LOGI(" APFSHR got funky packed len %d for line %d", LOGI(" APFSHR got funky packed len %d for line %d",
packedDataLen, i); packedDataLen[i], i);
goto bail; goto bail;
} }

View File

@ -77,6 +77,7 @@ public:
if (--m_ulRefCnt == 0) if (--m_ulRefCnt == 0)
{ {
delete this; delete this;
return 0;
} }
return m_ulRefCnt; return m_ulRefCnt;

View File

@ -95,6 +95,6 @@ MyBitmapButton::UpdateBitmap(void)
void void
MyBitmapButton::OnSysColorChange(void) MyBitmapButton::OnSysColorChange(void)
{ {
LOGI("MyBitmapButton 0x%08lx tracking color change", this); LOGD("MyBitmapButton 0x%p tracking color change", this);
UpdateBitmap(); UpdateBitmap();
} }

View File

@ -103,9 +103,9 @@ MyDIBitmap::Create(int width, int height, int bitsPerPixel, int colorsUsed,
//GetWin32ErrorString(err, &msg); //GetWin32ErrorString(err, &msg);
//LOGI(" DIB CreateDIBSection failed (err=%d msg='%ls')", //LOGI(" DIB CreateDIBSection failed (err=%d msg='%ls')",
// err, (LPCWSTR) msg); // err, (LPCWSTR) msg);
LOGI(" DIB CreateDIBSection failed (err=%d)", err); LOGE(" DIB CreateDIBSection failed (err=%d)", err);
LogHexDump(&mBitmapInfoHdr, sizeof(BITMAPINFO)); LogHexDump(&mBitmapInfoHdr, sizeof(BITMAPINFO));
LOGI("&mpPixels = 0x%08lx", &mpPixels); LOGI(" &mpPixels = 0x%p", &mpPixels);
DebugBreak(); DebugBreak();
return NULL; return NULL;
} }
@ -447,7 +447,7 @@ MyDIBitmap::ConvertBufToDIBSection(void)
DWORD err = ::GetLastError(); DWORD err = ::GetLastError();
LOGI(" DIB CreateDIBSection failed (err=%d)", err); LOGI(" DIB CreateDIBSection failed (err=%d)", err);
LogHexDump(&mBitmapInfoHdr, sizeof(BITMAPINFO)); LogHexDump(&mBitmapInfoHdr, sizeof(BITMAPINFO));
LOGI("&mpPixels = 0x%08lx", &mpPixels); LOGI(" &mpPixels = 0x%p", &mpPixels);
DebugBreak(); DebugBreak();
mpPixels = oldPixels; mpPixels = oldPixels;
return -1; return -1;

View File

@ -52,7 +52,7 @@ DebugLog::~DebugLog() {
} }
void DebugLog::Log(LogSeverity severity, const char* file, int line, void DebugLog::Log(LogSeverity severity, const char* file, int line,
const char* format, ...) _Printf_format_string_ const char* format, ...)
{ {
#ifndef _DEBUG #ifndef _DEBUG
if (fLogFp == NULL) { if (fLogFp == NULL) {

View File

@ -11,6 +11,7 @@
#include "PathName.h" #include "PathName.h"
#include "FaddenStd.h" #include "FaddenStd.h"
#include <sal.h>
/* /*
* Debug log output. * Debug log output.
@ -41,7 +42,7 @@ public:
* will appear on its own line, possibly with a prefix. * will appear on its own line, possibly with a prefix.
*/ */
void Log(LogSeverity severity, const char* file, int line, void Log(LogSeverity severity, const char* file, int line,
const char* format, ...); _Printf_format_string_ const char* format, ...);
private: private:
DECLARE_COPY_AND_OPEQ(DebugLog) DECLARE_COPY_AND_OPEQ(DebugLog)

View File

@ -317,7 +317,7 @@ CString
PathName::GetDescription() PathName::GetDescription()
{ {
CString szTypeName; CString szTypeName;
SHFILEINFO sfi; SHFILEINFO sfi = { 0 };
SHGetFileInfo(fPathName, 0, &sfi, sizeof(SHFILEINFO), SHGFI_TYPENAME); SHGetFileInfo(fPathName, 0, &sfi, sizeof(SHFILEINFO), SHGFI_TYPENAME);
@ -527,7 +527,7 @@ PathName::SetModWhen(time_t when)
struct _utimbuf utbuf; struct _utimbuf utbuf;
if (when == (time_t) -1 || when == kDateNone || when == kDateInvalid) { if (when == (time_t) -1 || when == kDateNone || when == kDateInvalid) {
LOGI("NOTE: not setting invalid date (%ld)", when); LOGI("NOTE: not setting invalid date (%I64d)", (long long) when);
return 0; return 0;
} }
@ -616,7 +616,7 @@ PathName::CreatePathIFN(void)
ASSERT(fFssep != '\0'); ASSERT(fFssep != '\0');
pathStart = pathName.GetBuffer(0); pathStart = pathName.GetBuffer(1);
/* BAD: network paths begin with "\\", not a drive letter */ /* BAD: network paths begin with "\\", not a drive letter */
// if (pathStart[0] == fFssep) // if (pathStart[0] == fFssep)
// pathStart++; // pathStart++;

View File

@ -197,7 +197,7 @@ Pidl::GetFullyQualPidl(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi)
WCHAR pathBuf[MAX_PATH]; WCHAR pathBuf[MAX_PATH];
LPSHELLFOLDER lpsfDeskTop; LPSHELLFOLDER lpsfDeskTop;
LPITEMIDLIST lpifq; LPITEMIDLIST lpifq;
ULONG ulEaten, ulAttribs; ULONG ulAttribs = 0;
HRESULT hr; HRESULT hr;
if (!GetName(lpsf, lpi, SHGDN_FORPARSING, &name)) if (!GetName(lpsf, lpi, SHGDN_FORPARSING, &name))
@ -213,7 +213,7 @@ Pidl::GetFullyQualPidl(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi)
wcscpy_s(pathBuf, name); wcscpy_s(pathBuf, name);
hr = lpsfDeskTop->ParseDisplayName(NULL, NULL, pathBuf, hr = lpsfDeskTop->ParseDisplayName(NULL, NULL, pathBuf,
&ulEaten, &lpifq, &ulAttribs); NULL, &lpifq, &ulAttribs);
lpsfDeskTop->Release(); lpsfDeskTop->Release();
@ -345,7 +345,7 @@ Pidl::DoTheMenuThing(HWND hwnd, LPSHELLFOLDER lpsfParent,
int int
Pidl::GetItemIcon(LPITEMIDLIST lpi, UINT uFlags) Pidl::GetItemIcon(LPITEMIDLIST lpi, UINT uFlags)
{ {
SHFILEINFO sfi; SHFILEINFO sfi = { 0 };
uFlags |= SHGFI_PIDL; // we're passing a PIDL, not a pathname, in 1st arg uFlags |= SHGFI_PIDL; // we're passing a PIDL, not a pathname, in 1st arg
SHGetFileInfo((LPCWSTR)lpi, 0, &sfi, sizeof(SHFILEINFO), uFlags); SHGetFileInfo((LPCWSTR)lpi, 0, &sfi, sizeof(SHFILEINFO), uFlags);

View File

@ -163,7 +163,7 @@ SelectFilesDialog::HandleNotify(HWND hDlg, LPOFNOTIFY pofn)
case CDN_INCLUDEITEM: case CDN_INCLUDEITEM:
LOGI(" CDN_INCLUDEITEM"); LOGI(" CDN_INCLUDEITEM");
default: default:
LOGI(" HandleNotify, code=%d, pOfn=0x%08lx", pofn->hdr.code, pofn); LOGI(" HandleNotify, code=%d, pOfn=0x%p", pofn->hdr.code, pofn);
break; break;
} }
@ -511,12 +511,12 @@ SelectFilesDialog::PrepEndDialog(void)
//LOGI(" Checking name='%ls'", compareName); //LOGI(" Checking name='%ls'", compareName);
if (compare && Stristr(tailStr, compareName) != NULL) { if (compare && Stristr(tailStr, compareName) != NULL) {
LOGI(" Matched '%ls', not adding", compareName); LOGI(" Matched '%ls', not adding", (LPCWSTR) compareName);
} else { } else {
if (compare) { if (compare) {
LOGI(" No match on '%ls', adding", compareName); LOGI(" No match on '%ls', adding", (LPCWSTR) compareName);
} else { } else {
LOGI(" Found '%ls', adding", compareName); LOGI(" Found '%ls', adding", (LPCWSTR) compareName);
} }
fileNames += path.GetFileName(); fileNames += path.GetFileName();
fileNames += L"\\"; fileNames += L"\\";
@ -524,18 +524,18 @@ SelectFilesDialog::PrepEndDialog(void)
} else { } else {
/* expected, for things like "Control Panels" or "My Network" */ /* expected, for things like "Control Panels" or "My Network" */
LOGI(" No path for '%ls'", LOGI(" No path for '%ls'",
(LPCTSTR) pList->GetItemText(num, 0)); (LPCWSTR) pList->GetItemText(num, 0));
} }
} }
if (fileNames.GetLength() >= (int)m_ofn.nMaxFile) { if (fileNames.GetLength() >= (int)m_ofn.nMaxFile) {
LOGI("GLITCH: excessively long file name list"); LOGW("GLITCH: excessively long file name list");
return false; return false;
} }
} }
LOGI("Final result: names at %d, len=%d, str='%ls'", LOGI("Final result: names at %d, len=%d, str='%ls'",
fFileNameOffset, wcslen(fileNames), fileNames); fFileNameOffset, wcslen(fileNames), (LPCWSTR) fileNames);
/* /*
* Null-terminate with extreme prejudice. Every filename should be * Null-terminate with extreme prejudice. Every filename should be

View File

@ -188,11 +188,9 @@ ShellTree::FillTreeView(LPSHELLFOLDER lpsf, LPITEMIDLIST lpifq,
{ /* DEBUG */ { /* DEBUG */
CString name; CString name;
if (Pidl::GetName(lpsf, lpi, SHGDN_NORMAL, &name)) { if (Pidl::GetName(lpsf, lpi, SHGDN_NORMAL, &name)) {
LOGI(" Checking '%ls' 0x%08lx", LOGD(" Checking '%ls' %08lx", (LPCWSTR) name, ulAttrs);
name, ulAttrs);
} else { } else {
LOGI(" Checking <no-name> 0x%08lx", LOGD(" Checking <no-name> 0x%08lx", ulAttrs);
ulAttrs);
} }
} }
#endif #endif
@ -297,14 +295,14 @@ ShellTree::FillTreeView(LPSHELLFOLDER lpsf, LPITEMIDLIST lpifq,
tvi.hItem = hParent; tvi.hItem = hParent;
tvi.mask = TVIF_CHILDREN; tvi.mask = TVIF_CHILDREN;
if (!GetItem(&tvi)) { if (!GetItem(&tvi)) {
LOGI("Could not get TV '%ls'", name); LOGW("Could not get TV '%ls'", (LPCWSTR) name);
ASSERT(false); ASSERT(false);
} else if (tvi.cChildren) { } else if (tvi.cChildren) {
LOGI("Removing child count (%d) from '%ls'", LOGI("Removing child count (%d) from '%ls'",
tvi.cChildren, name); tvi.cChildren, (LPCWSTR) name);
tvi.cChildren = 0; tvi.cChildren = 0;
if (!SetItem(&tvi)) { if (!SetItem(&tvi)) {
LOGI("Could not set TV '%ls'", name); LOGW("Could not set TV '%ls'", (LPCWSTR) name);
ASSERT(false); ASSERT(false);
} }
} }
@ -499,7 +497,7 @@ ShellTree::AddFolderAtSelection(const CString& name)
CString debugName; CString debugName;
HRESULT hr; HRESULT hr;
LOGI("AddFolderAtSelection '%ls'", name); LOGI("AddFolderAtSelection '%ls'", (LPCWSTR) name);
// Allocate a shell memory object. // Allocate a shell memory object.
hr = ::SHGetMalloc(&lpMalloc); hr = ::SHGetMalloc(&lpMalloc);
@ -534,27 +532,28 @@ ShellTree::AddFolderAtSelection(const CString& name)
tvi.hItem = hParent; tvi.hItem = hParent;
tvi.mask = TVIF_CHILDREN; tvi.mask = TVIF_CHILDREN;
if (!GetItem(&tvi)) { if (!GetItem(&tvi)) {
LOGI("Could not get TV '%ls'", debugName); LOGW("Could not get TV '%ls'", (LPCWSTR) debugName);
ASSERT(false); ASSERT(false);
} else { } else {
HTREEITEM child = GetChildItem(hParent); HTREEITEM child = GetChildItem(hParent);
if (child == NULL && tvi.cChildren) { if (child == NULL && tvi.cChildren) {
LOGI(" Found unexpanded node, not adding %ls", name); LOGD(" Found unexpanded node, not adding %ls", (LPCWSTR) name);
result = TRUE; result = TRUE;
goto bail; goto bail;
} else if (child == NULL && !tvi.cChildren) { } else if (child == NULL && !tvi.cChildren) {
LOGI(" Found former leaf node, updating kids in %ls", debugName); LOGD(" Found former leaf node, updating kids in %ls",
(LPCWSTR) debugName);
tvi.cChildren = 1; tvi.cChildren = 1;
if (!SetItem(&tvi)) { if (!SetItem(&tvi)) {
LOGI("Could not set TV '%ls'", debugName); LOGW("Could not set TV '%ls'", (LPCWSTR) debugName);
ASSERT(false); ASSERT(false);
} }
result = TRUE; result = TRUE;
goto bail; goto bail;
} else { } else {
ASSERT(child != NULL && tvi.cChildren != 0); ASSERT(child != NULL && tvi.cChildren != 0);
LOGI(" Found expanded branch node '%ls', adding new '%ls'", LOGD(" Found expanded branch node '%ls', adding new '%ls'",
debugName, name); (LPCWSTR) debugName, (LPCWSTR) name);
} }
} }
@ -566,7 +565,7 @@ ShellTree::AddFolderAtSelection(const CString& name)
hr = parentTvid->lpsfParent->BindToObject(parentTvid->lpi, hr = parentTvid->lpsfParent->BindToObject(parentTvid->lpi,
0, IID_IShellFolder, (LPVOID *)&lpsf); 0, IID_IShellFolder, (LPVOID *)&lpsf);
if (FAILED(hr)) { if (FAILED(hr)) {
LOGI("Glitch: unable to get ShellFolder for selected folder"); LOGW("Glitch: unable to get ShellFolder for selected folder");
goto bail; goto bail;
} }
@ -574,7 +573,7 @@ ShellTree::AddFolderAtSelection(const CString& name)
hr = lpsf->EnumObjects(hwnd, SHCONTF_FOLDERS | SHCONTF_INCLUDEHIDDEN, hr = lpsf->EnumObjects(hwnd, SHCONTF_FOLDERS | SHCONTF_INCLUDEHIDDEN,
&lpe); &lpe);
if (FAILED(hr)) { if (FAILED(hr)) {
LOGI("Glitch: unable to get enumerator for selected folder"); LOGW("Glitch: unable to get enumerator for selected folder");
goto bail; goto bail;
} }
@ -821,7 +820,7 @@ ShellTree::EnableImages()
{ {
// Get the handle to the system image list, for our icons // Get the handle to the system image list, for our icons
HIMAGELIST hImageList; HIMAGELIST hImageList;
SHFILEINFO sfi; SHFILEINFO sfi = { 0 };
hImageList = (HIMAGELIST)SHGetFileInfo(L"C:\\", hImageList = (HIMAGELIST)SHGetFileInfo(L"C:\\",
0, &sfi, sizeof(SHFILEINFO), 0, &sfi, sizeof(SHFILEINFO),
@ -998,12 +997,12 @@ ShellTree::TunnelTree(CString path, CString* pResultStr)
} }
CString drive = pathName.GetDriveOnly(); CString drive = pathName.GetDriveOnly();
LOGI("Searching for drive='%ls'", drive); LOGI("Searching for drive='%ls'", (LPCWSTR) drive);
HTREEITEM node = FindDrive(myComputer, drive); HTREEITEM node = FindDrive(myComputer, drive);
if (node == NULL) { if (node == NULL) {
/* unexpected -- couldn't find the drive */ /* unexpected -- couldn't find the drive */
pResultStr->Format(L"Unable to find drive %ls.", drive); pResultStr->Format(L"Unable to find drive %ls.", (LPCWSTR) drive);
return; return;
} }
@ -1069,7 +1068,7 @@ ShellTree::FindMyComputer(void)
hr = desktop->CompareIDs(0, myComputerPidl, pData->lpi); hr = desktop->CompareIDs(0, myComputerPidl, pData->lpi);
if (SUCCEEDED(hr) && HRESULT_CODE(hr) == 0) { if (SUCCEEDED(hr) && HRESULT_CODE(hr) == 0) {
LOGI("MATCHED on '%ls'", itemText); LOGD("MATCHED on '%ls'", (LPCWSTR) itemText);
result = node; result = node;
break; break;
} }
@ -1077,7 +1076,7 @@ ShellTree::FindMyComputer(void)
} }
if (result != NULL && !ItemHasChildren(result)) { if (result != NULL && !ItemHasChildren(result)) {
LOGI("Glitch: My Computer has no children"); LOGW("Glitch: My Computer has no children");
result = NULL; result = NULL;
} }
@ -1146,8 +1145,7 @@ ShellTree::FindDrive(HTREEITEM myComputer, const CString& drive)
HTREEITEM HTREEITEM
ShellTree::SearchTree(HTREEITEM treeNode, const CString& path) ShellTree::SearchTree(HTREEITEM treeNode, const CString& path)
{ {
LOGI("SearchTree node=0x%08lx path='%ls'", LOGI("SearchTree node=0x%p path='%ls'", treeNode, (LPCWSTR) path);
treeNode, (LPCTSTR) path);
HTREEITEM node; HTREEITEM node;
CString mangle(path); CString mangle(path);

View File

@ -546,16 +546,16 @@ LogHexDump(const void* vbuf, long len)
const unsigned char* buf = (const unsigned char*) vbuf; const unsigned char* buf = (const unsigned char*) vbuf;
char outBuf[10 + 16*3 +1 +8]; // addr: 00 11 22 ... + 8 bytes slop char outBuf[10 + 16*3 +1 +8]; // addr: 00 11 22 ... + 8 bytes slop
bool skipFirst; bool skipFirst;
long addr; uintptr_t addr;
char* cp = NULL; char* cp = NULL;
int i; int i;
LOGI(" Memory at 0x%08lx %ld bytes:", buf, len); LOGI(" Memory at 0x%p %ld bytes:", buf, len);
if (len <= 0) if (len <= 0)
return; return;
addr = (int)buf & ~0x0f; addr = (uintptr_t)buf & ~0x0f;
if (addr != (int) buf) { if (addr != (uintptr_t) buf) {
sprintf(outBuf, "%08lx: ", addr); sprintf(outBuf, "%08lx: ", addr);
for (i = addr; i < (int) buf; i++) for (i = addr; i < (int) buf; i++)
strcat(outBuf, " "); strcat(outBuf, " ");
@ -566,7 +566,7 @@ LogHexDump(const void* vbuf, long len)
} }
while (len--) { while (len--) {
if (((int) buf & 0x0f) == 0) { if (((uintptr_t) buf & 0x0f) == 0) {
/* output the old, start a new line */ /* output the old, start a new line */
if (skipFirst) { if (skipFirst) {
skipFirst = false; skipFirst = false;
@ -731,7 +731,7 @@ VectorizeString(WCHAR* mangle, WCHAR** argv, int* pArgc)
} }
if (inQuote) { if (inQuote) {
LOGI("WARNING: ended in quote"); LOGW("WARNING: ended in quote");
} }
*pArgc = idx; *pArgc = idx;
@ -760,12 +760,12 @@ DowncaseSubstring(CString* pStr, int startPos, int endPos,
int i; int i;
token = pStr->Mid(startPos, endPos - startPos); token = pStr->Mid(startPos, endPos - startPos);
//LOGI(" TOKEN: '%ls'", (LPCWSTR) token); LOGV(" TOKEN: '%ls'", (LPCWSTR) token);
/* these words are left alone */ /* these words are left alone */
for (i = 0; i < NELEM(leaveAlone); i++) { for (i = 0; i < NELEM(leaveAlone); i++) {
if (token.CompareNoCase(leaveAlone[i]) == 0) { if (token.CompareNoCase(leaveAlone[i]) == 0) {
//LOGI(" Leaving alone '%ls'", (LPCWSTR) token); LOGV(" Leaving alone '%ls'", (LPCWSTR) token);
return; return;
} }
} }
@ -773,7 +773,7 @@ DowncaseSubstring(CString* pStr, int startPos, int endPos,
/* words with specific capitalization */ /* words with specific capitalization */
for (i = 0; i < NELEM(justLikeThis); i++) { for (i = 0; i < NELEM(justLikeThis); i++) {
if (token.CompareNoCase(justLikeThis[i]) == 0) { if (token.CompareNoCase(justLikeThis[i]) == 0) {
LOGI(" Setting '%ls' to '%ls'", token, justLikeThis[i]); LOGI(" Setting '%ls' to '%ls'", (LPCWSTR) token, justLikeThis[i]);
for (int j = startPos; j < endPos; j++) for (int j = startPos; j < endPos; j++)
pStr->SetAt(j, justLikeThis[i][j - startPos]); pStr->SetAt(j, justLikeThis[i][j - startPos]);
return; return;
@ -784,7 +784,7 @@ DowncaseSubstring(CString* pStr, int startPos, int endPos,
if (prevWasSpace) { if (prevWasSpace) {
for (i = 0; i < NELEM(shortWords); i++) { for (i = 0; i < NELEM(shortWords); i++) {
if (token.CompareNoCase(shortWords[i]) == 0) { if (token.CompareNoCase(shortWords[i]) == 0) {
//LOGI(" No leading cap for '%ls'", token); LOGV(" No leading cap for '%ls'", token);
firstCap = false; firstCap = false;
break; break;
} }
@ -794,7 +794,7 @@ DowncaseSubstring(CString* pStr, int startPos, int endPos,
/* check for roman numerals; we leave those capitalized */ /* check for roman numerals; we leave those capitalized */
CString romanTest = token.SpanIncluding(L"IVX"); CString romanTest = token.SpanIncluding(L"IVX");
if (romanTest.GetLength() == token.GetLength()) { if (romanTest.GetLength() == token.GetLength()) {
//LOGI(" Looks like roman numerals '%ls'", token); LOGV(" Looks like roman numerals '%ls'", token);
return; return;
} }