diff --git a/app/ACUArchive.cpp b/app/ACUArchive.cpp index 9c6ed3d..18708dc 100644 --- a/app/ACUArchive.cpp +++ b/app/ACUArchive.cpp @@ -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); } diff --git a/app/Actions.cpp b/app/Actions.cpp index 9384d5e..20f4a0f 100644 --- a/app/Actions.cpp +++ b/app/Actions.cpp @@ -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? diff --git a/app/ArchiveInfoDialog.cpp b/app/ArchiveInfoDialog.cpp index 8cff07f..9bc4ed1 100644 --- a/app/ArchiveInfoDialog.cpp +++ b/app/ArchiveInfoDialog.cpp @@ -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()); diff --git a/app/BNYArchive.cpp b/app/BNYArchive.cpp index 21eb701..702503a 100644 --- a/app/BNYArchive.cpp +++ b/app/BNYArchive.cpp @@ -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); } diff --git a/app/Clipboard.cpp b/app/Clipboard.cpp index 09d98a0..78099bc 100644 --- a/app/Clipboard.cpp +++ b/app/Clipboard.cpp @@ -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(); diff --git a/app/ConfirmOverwriteDialog.cpp b/app/ConfirmOverwriteDialog.cpp index fc66349..92d89f6 100644 --- a/app/ConfirmOverwriteDialog.cpp +++ b/app/ConfirmOverwriteDialog.cpp @@ -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); diff --git a/app/ContentList.cpp b/app/ContentList.cpp index cf7dcd8..24020b1 100644 --- a/app/ContentList.cpp +++ b/app/ContentList.cpp @@ -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)]; diff --git a/app/ConvDiskOptionsDialog.cpp b/app/ConvDiskOptionsDialog.cpp index 582428e..87c9e2c 100644 --- a/app/ConvDiskOptionsDialog.cpp +++ b/app/ConvDiskOptionsDialog.cpp @@ -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. diff --git a/app/DiskArchive.cpp b/app/DiskArchive.cpp index fcbaf01..8d0bd6c 100644 --- a/app/DiskArchive.cpp +++ b/app/DiskArchive.cpp @@ -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); } } diff --git a/app/DiskEditDialog.cpp b/app/DiskEditDialog.cpp index 19c629f..66fdf87 100644 --- a/app/DiskEditDialog.cpp +++ b/app/DiskEditDialog.cpp @@ -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; diff --git a/app/FileNameConv.cpp b/app/FileNameConv.cpp index 0876b19..39ebc73 100644 --- a/app/FileNameConv.cpp +++ b/app/FileNameConv.cpp @@ -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; diff --git a/app/Main.cpp b/app/Main.cpp index cdedd3f..e8246ae 100644 --- a/app/Main.cpp +++ b/app/Main.cpp @@ -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", diff --git a/app/Main.h b/app/Main.h index 2391866..d484bfb 100644 --- a/app/Main.h +++ b/app/Main.h @@ -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) { diff --git a/app/NufxArchive.cpp b/app/NufxArchive.cpp index afe8ffd..80005c7 100644 --- a/app/NufxArchive.cpp +++ b/app/NufxArchive.cpp @@ -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); diff --git a/app/OpenVolumeDialog.cpp b/app/OpenVolumeDialog.cpp index 9406a87..bc3d9e3 100644 --- a/app/OpenVolumeDialog.cpp +++ b/app/OpenVolumeDialog.cpp @@ -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); diff --git a/app/Preferences.cpp b/app/Preferences.cpp index d0d5075..273bc8d 100644 --- a/app/Preferences.cpp +++ b/app/Preferences.cpp @@ -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); diff --git a/app/Registry.cpp b/app/Registry.cpp index f9ac0a2..ecfc55d 100644 --- a/app/Registry.cpp +++ b/app/Registry.cpp @@ -347,18 +347,18 @@ 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); } - - 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; } diff --git a/app/Tools.cpp b/app/Tools.cpp index 14ed70e..c695999 100644 --- a/app/Tools.cpp +++ b/app/Tools.cpp @@ -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 { diff --git a/app/ViewFilesDialog.cpp b/app/ViewFilesDialog.cpp index b49c5e5..499cb14 100644 --- a/app/ViewFilesDialog.cpp +++ b/app/ViewFilesDialog.cpp @@ -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); } diff --git a/app/VolumeCopyDialog.cpp b/app/VolumeCopyDialog.cpp index 69150d8..afb8ec1 100644 --- a/app/VolumeCopyDialog.cpp +++ b/app/VolumeCopyDialog.cpp @@ -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 diff --git a/diskimg/DiskImg.cpp b/diskimg/DiskImg.cpp index d10dc76..b842126 100644 --- a/diskimg/DiskImg.cpp +++ b/diskimg/DiskImg.cpp @@ -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) { diff --git a/diskimg/ImageWrapper.cpp b/diskimg/ImageWrapper.cpp index 5ef0336..1ed4025 100644 --- a/diskimg/ImageWrapper.cpp +++ b/diskimg/ImageWrapper.cpp @@ -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; diff --git a/diskimg/ProDOS.cpp b/diskimg/ProDOS.cpp index c2bf9c1..c14b2fa 100644 --- a/diskimg/ProDOS.cpp +++ b/diskimg/ProDOS.cpp @@ -4431,7 +4431,7 @@ A2FileProDOS::LoadDirectoryBlockList(unsigned short keyBlock, bail: if (dierr != kDIErrNone) - delete list; + delete[] list; return dierr; } diff --git a/mdc/Main.cpp b/mdc/Main.cpp index 3afa7eb..4b0cb28 100644 --- a/mdc/Main.cpp +++ b/mdc/Main.cpp @@ -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, " %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"); } diff --git a/mdc/mdc.rc b/mdc/mdc.rc index c8946c5..b514611 100644 --- a/mdc/mdc.rc +++ b/mdc/mdc.rc @@ -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 ///////////////////////////////////////////////////////////////////////////// diff --git a/mdc/resource.h b/mdc/resource.h index fecbe8a..35c17f8 100644 --- a/mdc/resource.h +++ b/mdc/resource.h @@ -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 diff --git a/reformat/AppleWorks.cpp b/reformat/AppleWorks.cpp index 4eaddcb..9ba2bec 100644 --- a/reformat/AppleWorks.cpp +++ b/reformat/AppleWorks.cpp @@ -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; } } diff --git a/reformat/Asm.cpp b/reformat/Asm.cpp index d187685..5b7e9d9 100644 --- a/reformat/Asm.cpp +++ b/reformat/Asm.cpp @@ -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); diff --git a/reformat/DreamGrafix.cpp b/reformat/DreamGrafix.cpp index 02aa064..51bc533 100644 --- a/reformat/DreamGrafix.cpp +++ b/reformat/DreamGrafix.cpp @@ -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; } diff --git a/reformat/SuperHiRes.cpp b/reformat/SuperHiRes.cpp index 7b85133..361133f 100644 --- a/reformat/SuperHiRes.cpp +++ b/reformat/SuperHiRes.cpp @@ -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; } diff --git a/util/ImageDataObject.h b/util/ImageDataObject.h index e98246b..e9af2ba 100644 --- a/util/ImageDataObject.h +++ b/util/ImageDataObject.h @@ -77,6 +77,7 @@ public: if (--m_ulRefCnt == 0) { delete this; + return 0; } return m_ulRefCnt; diff --git a/util/MyBitmapButton.cpp b/util/MyBitmapButton.cpp index e6aa15b..95af688 100644 --- a/util/MyBitmapButton.cpp +++ b/util/MyBitmapButton.cpp @@ -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(); } diff --git a/util/MyDIBitmap.cpp b/util/MyDIBitmap.cpp index fe65a93..8eb4c61 100644 --- a/util/MyDIBitmap.cpp +++ b/util/MyDIBitmap.cpp @@ -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; diff --git a/util/MyDebug.cpp b/util/MyDebug.cpp index c1b6603..f79684d 100644 --- a/util/MyDebug.cpp +++ b/util/MyDebug.cpp @@ -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) { diff --git a/util/MyDebug.h b/util/MyDebug.h index 615ae42..20fe2da 100644 --- a/util/MyDebug.h +++ b/util/MyDebug.h @@ -11,6 +11,7 @@ #include "PathName.h" #include "FaddenStd.h" +#include /* * 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) diff --git a/util/PathName.cpp b/util/PathName.cpp index c1bdeb7..8ba42f7 100644 --- a/util/PathName.cpp +++ b/util/PathName.cpp @@ -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++; diff --git a/util/Pidl.cpp b/util/Pidl.cpp index a259bae..59aca07 100644 --- a/util/Pidl.cpp +++ b/util/Pidl.cpp @@ -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); diff --git a/util/SelectFilesDialog.cpp b/util/SelectFilesDialog.cpp index f89d152..7b9bd92 100644 --- a/util/SelectFilesDialog.cpp +++ b/util/SelectFilesDialog.cpp @@ -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 diff --git a/util/ShellTree.cpp b/util/ShellTree.cpp index fbce663..feb0b2f 100644 --- a/util/ShellTree.cpp +++ b/util/ShellTree.cpp @@ -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 0x%08lx", - ulAttrs); + LOGD(" Checking 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); diff --git a/util/Util.cpp b/util/Util.cpp index 05da83f..c32d918 100644 --- a/util/Util.cpp +++ b/util/Util.cpp @@ -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; }