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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -254,7 +254,7 @@ ConvDiskOptionsDialog::OnCompute(void)
//xferOpts.fUseSparseBlocks =
// 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.

View File

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

View File

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

View File

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

View File

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

View File

@ -307,6 +307,7 @@ NufxEntry::FindThreadInfo(int which, NuThread* pRetThread,
pThread = NULL;
for (i = 0; i < (int)NuRecordGetNumThreads(pRecord); i++) {
pThread = NuGetThread(pRecord, i);
assert(pThread != NULL);
if (NuGetThreadID(pThread) == wantedThreadID)
break;
}
@ -317,6 +318,7 @@ NufxEntry::FindThreadInfo(int which, NuThread* pRetThread,
goto bail;
}
assert(pThread != NULL);
memcpy(pRetThread, pThread, sizeof(*pRetThread));
bail:
@ -1269,7 +1271,7 @@ bail:
NuAbort(fpArchive); // abort anything that didn't get flushed
NuFreeDataSource(pSource);
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);
// bummer
}
@ -2233,7 +2235,7 @@ NufxArchive::XferFile(FileDetails* pDetails, unsigned char** pDataBuf,
CString errMsg;
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);
ASSERT(pDataBuf != NULL);
ASSERT(pRsrcBuf != NULL);

View File

@ -553,7 +553,7 @@ OpenVolumeDialog::HasPhysicalDriveWin2K(int unit, CString* pRemark)
if (result) {
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(" Sectors per track = %ld", (ULONG) dg.SectorsPerTrack);
LOGI(" Bytes per sector = %ld", (ULONG) dg.BytesPerSector);

View File

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

View File

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

View File

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

View File

@ -305,7 +305,7 @@ DumpBitmapInfo(HBITMAP hBitmap)
LOGI(" bmWidthBytes=%d", info.bmWidthBytes);
LOGI(" bmPlanes=%d", info.bmPlanes);
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
elapsed = (float) (endWhen - startWhen);
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);
LOGI("%ls", (LPCWSTR) msg);
#ifdef _DEBUG
@ -832,7 +832,7 @@ VolumeCopyDialog::OnCopyFromFile(void)
else
elapsed = (float) (endWhen - startWhen);
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);
LOGI("%ls", (LPCWSTR) errMsg);
#ifdef _DEBUG

View File

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

View File

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

View File

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

View File

@ -187,7 +187,7 @@ MainWindow::NufxErrorMsgHandler(NuArchive* /*pArchive*/, void* 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->message);
@ -317,7 +317,7 @@ MainWindow::ScanFiles(void)
}
end = time(NULL);
fprintf(scanOpts.outfp, "\nScan completed in %ld seconds.\n",
end - start);
(long) (end - start));
{
SetWindowText(L"MDC Done!");
@ -818,7 +818,7 @@ MainWindow::LoadDiskFSContents(DiskFS* pDiskFS, const char* volName,
if (recordKind == kRecordKindVolumeDir) {
/* this is a volume directory */
LOGI("Not displaying volume dir '%ls'", pFile->GetPathName());
LOGI("Not displaying volume dir '%hs'", pFile->GetPathName());
continue;
}
@ -869,7 +869,7 @@ MainWindow::LoadDiskFSContents(DiskFS* pDiskFS, const char* volName,
pFile->GetAuxType());
break;
case kRecordKindDisk:
sprintf(tmpbuf, "%ldk", totalLen / 1024);
sprintf(tmpbuf, "%I64dk", totalLen / 1024);
fprintf(pScanOpts->outfp, "Disk %-6hs ", tmpbuf);
break;
case kRecordKindFile:
@ -940,7 +940,7 @@ MainWindow::LoadDiskFSContents(DiskFS* pDiskFS, const char* volName,
FormatDate(kDateNone, &date);
else
FormatDate(pFile->GetModWhen(), &date);
fprintf(pScanOpts->outfp, "%-15s ", (LPCTSTR) date);
fprintf(pScanOpts->outfp, "%-15ls ", (LPCWSTR) date);
const char* fmtStr;
switch (pFile->GetFSFormat()) {
@ -997,7 +997,7 @@ MainWindow::LoadDiskFSContents(DiskFS* pDiskFS, const char* volName,
if (!totalLen && totalCompLen)
fprintf(pScanOpts->outfp, " ????"); /* weird */
else
fprintf(pScanOpts->outfp, "%8ld", totalLen);
fprintf(pScanOpts->outfp, "%8I64d", totalLen);
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"
@ -16,13 +16,11 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#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
// remains consistent on all systems.
IDI_MDC ICON DISCARDABLE "mdc.ICO"
IDI_MDC ICON "mdc.ICO"
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDC_MDC MENU DISCARDABLE
IDC_MDC MENU
BEGIN
POPUP "&File"
BEGIN
@ -58,7 +56,7 @@ END
// Accelerator
//
IDC_MDC ACCELERATORS MOVEABLE PURE
IDC_MDC ACCELERATORS
BEGIN
"?", IDM_ABOUT, ASCII, ALT
"/", IDM_ABOUT, ASCII, ALT
@ -70,35 +68,31 @@ END
// Dialog
//
IDD_ABOUTBOX DIALOG DISCARDABLE 22, 17, 156, 111
STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
IDD_ABOUTBOX DIALOG 22, 17, 156, 111
STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
CAPTION "About"
FONT 10, "MS Sans Serif"
BEGIN
ICON IDI_MDC,IDC_MYICON,7,7,20,20
LTEXT "MDC version %d.%d.%d",IDC_ABOUT_VERS,33,7,116,8,
SS_NOPREFIX
LTEXT "Copyright © 2009 by CiderPress project authors.\rAll Rights Reserved.",
IDC_STATIC,7,31,142,19
LTEXT "MDC version %d.%d.%d",IDC_ABOUT_VERS,33,7,116,8,SS_NOPREFIX
LTEXT "Copyright © 2009 by CiderPress project authors.\rAll Rights Reserved.",IDC_STATIC,7,31,142,19
DEFPUSHBUTTON "OK",IDOK,53,90,50,14
LTEXT "This utility scans Apple II disk images and creates formatted listings of the files in them.",
IDC_STATIC,7,58,142,26
LTEXT "This utility scans Apple II disk images and creates formatted listings of the files in them.",IDC_STATIC,7,58,142,26
LTEXT "Multi-Disk Catalog",IDC_STATIC,33,15,55,8
END
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
BEGIN
LTEXT "",1119,0,0,272,87,NOT WS_GROUP,WS_EX_STATICEDGE
PUSHBUTTON "&Accept",IDC_SELECT_ACCEPT,220,88,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.",
IDC_CHOOSEFILES_STATIC1,7,104,199,17
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
END
IDD_PROGRESS DIALOG DISCARDABLE 0, 0, 250, 66
STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION
IDD_PROGRESS DIALOG 0, 0, 250, 66
STYLE DS_SETFONT | DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION
CAPTION "Progress..."
FONT 8, "MS Sans Serif"
BEGIN
@ -114,7 +108,7 @@ END
// TEXTINCLUDE
//
2 TEXTINCLUDE DISCARDABLE
2 TEXTINCLUDE
BEGIN
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""afxres.h""\r\n"
@ -123,13 +117,13 @@ BEGIN
"\0"
END
3 TEXTINCLUDE DISCARDABLE
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
1 TEXTINCLUDE DISCARDABLE
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
@ -143,7 +137,7 @@ END
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
GUIDELINES DESIGNINFO
BEGIN
IDD_ABOUTBOX, DIALOG
BEGIN
@ -176,7 +170,7 @@ END
// String Table
//
STRINGTABLE DISCARDABLE
STRINGTABLE
BEGIN
IDS_APP_TITLE "MDC"
IDC_MDC "MDC"
@ -184,13 +178,13 @@ BEGIN
IDS_FAILED "Failed"
END
STRINGTABLE DISCARDABLE
STRINGTABLE
BEGIN
IDM_FILE_SCAN "Select disk images to scan"
IDM_HELP_WEBSITE "Visit the CiderPress web site\nGo to web site"
END
#endif // English (U.S.) resources
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////

View File

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

View File

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

View File

@ -951,7 +951,7 @@ ReformatLISA3::Process(const ReformatHolder* pHolder,
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);
SetResultBuffer(pOutput);
@ -1631,7 +1631,7 @@ ReformatLISA4::Process(const ReformatHolder* pHolder,
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.
@ -1718,7 +1718,7 @@ ReformatLISA4::Process(const ReformatHolder* pHolder,
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);
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);
if (actual != expectedLen && actual != (expectedLen-512)) {
LOGI("UnpackLZW expected %d, got %d", expectedLen, actual);
free(tmpBuf);
delete[] tmpBuf;
return false;
}
@ -221,7 +221,7 @@ DreamGrafix::UnpackDG(const unsigned char* srcBuf, long srcLen,
}
}
free(tmpBuf);
delete[] tmpBuf;
return true;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -317,7 +317,7 @@ CString
PathName::GetDescription()
{
CString szTypeName;
SHFILEINFO sfi;
SHFILEINFO sfi = { 0 };
SHGetFileInfo(fPathName, 0, &sfi, sizeof(SHFILEINFO), SHGFI_TYPENAME);
@ -527,7 +527,7 @@ PathName::SetModWhen(time_t when)
struct _utimbuf utbuf;
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;
}
@ -616,7 +616,7 @@ PathName::CreatePathIFN(void)
ASSERT(fFssep != '\0');
pathStart = pathName.GetBuffer(0);
pathStart = pathName.GetBuffer(1);
/* BAD: network paths begin with "\\", not a drive letter */
// if (pathStart[0] == fFssep)
// pathStart++;

View File

@ -197,7 +197,7 @@ Pidl::GetFullyQualPidl(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi)
WCHAR pathBuf[MAX_PATH];
LPSHELLFOLDER lpsfDeskTop;
LPITEMIDLIST lpifq;
ULONG ulEaten, ulAttribs;
ULONG ulAttribs = 0;
HRESULT hr;
if (!GetName(lpsf, lpi, SHGDN_FORPARSING, &name))
@ -213,7 +213,7 @@ Pidl::GetFullyQualPidl(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi)
wcscpy_s(pathBuf, name);
hr = lpsfDeskTop->ParseDisplayName(NULL, NULL, pathBuf,
&ulEaten, &lpifq, &ulAttribs);
NULL, &lpifq, &ulAttribs);
lpsfDeskTop->Release();
@ -345,7 +345,7 @@ Pidl::DoTheMenuThing(HWND hwnd, LPSHELLFOLDER lpsfParent,
int
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
SHGetFileInfo((LPCWSTR)lpi, 0, &sfi, sizeof(SHFILEINFO), uFlags);

View File

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

View File

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

View File

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