diff --git a/app/ACUArchive.cpp b/app/ACUArchive.cpp index 4f9a890..9c6ed3d 100644 --- a/app/ACUArchive.cpp +++ b/app/ACUArchive.cpp @@ -127,13 +127,13 @@ AcuEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength, char* unsqBuf = NULL; long unsqLen = 0; expBuf.SeizeBuffer(&unsqBuf, &unsqLen); - WMSG2("Unsqueezed %ld bytes to %d\n", + LOGI("Unsqueezed %ld bytes to %d", (unsigned long) GetCompressedLen(), unsqLen); if (unsqLen == 0) { // some bonehead squeezed a zero-length file delete[] unsqBuf; ASSERT(*ppText == NULL); - WMSG0("Handling zero-length squeezed file!\n"); + LOGI("Handling zero-length squeezed file!"); if (needAlloc) { *ppText = new char[1]; **ppText = '\0'; @@ -223,7 +223,7 @@ AcuEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv, len = (long) GetUncompressedLen(); if (len == 0) { - WMSG0("Empty fork\n"); + LOGI("Empty fork"); result = IDOK; goto bail; } @@ -260,12 +260,12 @@ AcuEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv, } expBuf.SeizeBuffer(&buf, &uncLen); - WMSG2("Unsqueezed %ld bytes to %d\n", len, uncLen); + LOGI("Unsqueezed %ld bytes to %d", len, uncLen); // some bonehead squeezed a zero-length file if (uncLen == 0) { ASSERT(buf == NULL); - WMSG0("Handling zero-length squeezed file!\n"); + LOGI("Handling zero-length squeezed file!"); result = IDOK; goto bail; } @@ -605,11 +605,11 @@ AcuArchive::ReadMasterHeader(int* pNumEntries) header.unknown1 != 1 || strcmp((char*) header.fZink, "fZink") != 0) { - WMSG0("Not an ACU archive\n"); + LOGI("Not an ACU archive"); return -1; } - WMSG1("Looks like an ACU archive with %d entries\n", header.fileCount); + LOGI("Looks like an ACU archive with %d entries", header.fileCount); *pNumEntries = header.fileCount; return 0; @@ -661,20 +661,20 @@ AcuArchive::ReadFileHeader(AcuFileEntry* pEntry) /* read the filename */ if (pEntry->fileNameLen > kAcuMaxFileName) { - WMSG1("GLITCH: filename is too long (%d bytes)\n", + LOGI("GLITCH: filename is too long (%d bytes)", pEntry->fileNameLen); err = kNuErrGeneric; goto bail; } if (!pEntry->fileNameLen) { - WMSG0("GLITCH: filename missing\n"); + LOGI("GLITCH: filename missing"); err = kNuErrGeneric; goto bail; } /* don't know if this is possible or not */ if (pEntry->storageType == 5) { - WMSG0("HEY: EXTENDED FILE\n"); + LOGI("HEY: EXTENDED FILE"); } err = AcuRead(pEntry->fileName, pEntry->fileNameLen); @@ -702,15 +702,15 @@ AcuArchive::DumpFileHeader(const AcuFileEntry* pEntry) FormatDate(createWhen, &createStr); FormatDate(modWhen, &modStr); - WMSG1(" Header for file '%hs':\n", pEntry->fileName); - WMSG4(" dataStorageLen=%d eof=%d blockCount=%d checksum=0x%04x\n", + LOGI(" Header for file '%hs':", pEntry->fileName); + LOGI(" dataStorageLen=%d eof=%d blockCount=%d checksum=0x%04x", pEntry->dataStorageLen, pEntry->dataEof, pEntry->blockCount, pEntry->dataChecksum); - WMSG4(" fileType=0x%02x auxType=0x%04x storageType=0x%02x access=0x%04x\n", + LOGI(" fileType=0x%02x auxType=0x%04x storageType=0x%02x access=0x%04x", pEntry->fileType, pEntry->auxType, pEntry->storageType, pEntry->access); - WMSG2(" created %ls, modified %ls\n", + LOGI(" created %ls, modified %ls", (LPCWSTR) createStr, (LPCWSTR) modStr); - WMSG2(" fileNameLen=%d headerChecksum=0x%04x\n", + LOGI(" fileNameLen=%d headerChecksum=0x%04x", pEntry->fileNameLen, pEntry->headerChecksum); } @@ -864,13 +864,13 @@ AcuArchive::TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) ASSERT(fFp != NULL); - WMSG1("Testing %d entries\n", pSelSet->GetNumEntries()); + LOGI("Testing %d entries", pSelSet->GetNumEntries()); SelectionEntry* pSelEntry = pSelSet->IterNext(); while (pSelEntry != NULL) { pEntry = (AcuEntry*) pSelEntry->GetEntry(); - WMSG2(" Testing '%hs' (offset=%ld)\n", pEntry->GetDisplayName(), + LOGI(" Testing '%hs' (offset=%ld)", pEntry->GetDisplayName(), pEntry->GetOffset()); SET_PROGRESS_UPDATE2(0, pEntry->GetDisplayName(), NULL); diff --git a/app/ActionProgressDialog.cpp b/app/ActionProgressDialog.cpp index fc55207..de6474e 100644 --- a/app/ActionProgressDialog.cpp +++ b/app/ActionProgressDialog.cpp @@ -23,7 +23,7 @@ ActionProgressDialog::OnInitDialog(void) { CDialog::OnInitDialog(); - WMSG1("Action is %d\n", fAction); + LOGI("Action is %d", fAction); CenterWindow(AfxGetMainWnd()); diff --git a/app/Actions.cpp b/app/Actions.cpp index 83e1817..9384d5e 100644 --- a/app/Actions.cpp +++ b/app/Actions.cpp @@ -101,7 +101,7 @@ MainWindow::HandleView(void) // remember which font they used (sticky pref, not in registry) fPreferences.SetPrefString(kPrViewTextTypeFace, vfd.GetTextTypeFace()); fPreferences.SetPrefLong(kPrViewTextPointSize, vfd.GetTextPointSize()); - WMSG2("Preferences: saving view font %d-point '%ls'\n", + LOGI("Preferences: saving view font %d-point '%ls'", fPreferences.GetPrefLong(kPrViewTextPointSize), fPreferences.GetPrefString(kPrViewTextTypeFace)); } @@ -163,7 +163,7 @@ MainWindow::OnUpdateActionsOpenAsDisk(CCmdUI* pCmdUI) void MainWindow::OnActionsAddFiles(void) { - WMSG0("Add files!\n"); + LOGI("Add files!"); AddFilesDialog addFiles(this); DiskImgLib::A2File* pTargetSubdir = NULL; @@ -263,7 +263,7 @@ MainWindow::OnActionsAddFiles(void) if (result) SuccessBeep(); } else { - WMSG0("SFD bailed with Cancel\n"); + LOGI("SFD bailed with Cancel"); } } void @@ -313,7 +313,7 @@ MainWindow::ChooseAddTarget(DiskImgLib::A2File** ppTargetSubdir, */ DiskArchive* pDiskArchive = (DiskArchive*) fpOpenArchive; - WMSG0("Trying ChooseAddTarget\n"); + LOGI("Trying ChooseAddTarget"); ChooseAddTargetDialog targetDialog(this); targetDialog.fpDiskFS = pDiskArchive->GetDiskFS(); @@ -357,7 +357,7 @@ MainWindow::OnActionsAddDisks(void) CString openFilters, saveFolder; AddFilesDialog addOpts; - WMSG0("Add disks!\n"); + LOGI("Add disks!"); failed.LoadString(IDS_FAILED); @@ -406,23 +406,23 @@ MainWindow::OnActionsAddDisks(void) imf.fFileSource = dlg.GetPathName(); imf.SetQueryDisplayFormat(false); - WMSG2(" On entry, sectord=%d format=%d\n", + LOGI(" On entry, sectord=%d format=%d", imf.fSectorOrder, imf.fFSFormat); if (imf.fFSFormat == DiskImg::kFormatUnknown) imf.fFSFormat = DiskImg::kFormatGenericProDOSOrd; if (imf.DoModal() != IDOK) { - WMSG0("User bailed on IMF dialog\n"); + LOGI("User bailed on IMF dialog"); goto bail; } - WMSG2(" On exit, sectord=%d format=%d\n", + LOGI(" On exit, sectord=%d format=%d", imf.fSectorOrder, imf.fFSFormat); if (imf.fSectorOrder != img.GetSectorOrder() || imf.fFSFormat != img.GetFSFormat()) { - WMSG0("Initial values overridden, forcing img format\n"); + LOGI("Initial values overridden, forcing img format"); dierr = img.OverrideFormat(img.GetPhysicalFormat(), imf.fFSFormat, imf.fSectorOrder); if (dierr != kDIErrNone) { @@ -535,7 +535,7 @@ MainWindow::OnActionsCreateSubdir(void) return; } - WMSG1("Creating subdir in '%ls'\n", pEntry->GetPathName()); + LOGI("Creating subdir in '%ls'", pEntry->GetPathName()); csDialog.fBasePath = pEntry->GetPathName(); csDialog.fpArchive = fpOpenArchive; @@ -544,7 +544,7 @@ MainWindow::OnActionsCreateSubdir(void) if (csDialog.DoModal() != IDOK) return; - WMSG1("Creating '%ls'\n", (LPCWSTR) csDialog.fNewName); + LOGI("Creating '%ls'", (LPCWSTR) csDialog.fNewName); fpOpenArchive->CreateSubdir(this, pEntry, csDialog.fNewName); fpContentList->Reload(); @@ -630,7 +630,7 @@ MainWindow::OnActionsExtract(void) fPreferences.SetPrefBool(kPrExtractStripFolderNames, extOpts.fStripFolderNames != 0); fPreferences.SetPrefBool(kPrExtractOverwriteExisting, extOpts.fOverwriteExisting != 0); - WMSG1("Requested extract path is '%ls'\n", (LPCWSTR) extOpts.fExtractPath); + LOGI("Requested extract path is '%ls'", (LPCWSTR) extOpts.fExtractPath); /* * Create a "selection set" of things to display. @@ -711,7 +711,7 @@ MainWindow::DoBulkExtract(SelectionSet* pSelSet, GenericEntry* pEntry = pSelEntry->GetEntry(); if (pEntry->GetDamaged()) { - WMSG1("Skipping '%ls' due to damage\n", pEntry->GetPathName()); + LOGI("Skipping '%ls' due to damage", pEntry->GetPathName()); continue; } @@ -839,7 +839,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread, else convHA = GenericEntry::kConvertHAOff; - //WMSG2(" DBE initial text conversion: eol=%d ha=%d\n", + //LOGI(" DBE initial text conversion: eol=%d ha=%d", // convEOL, convHA); @@ -869,7 +869,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread, { extractAs2MG = true; } else { - WMSG2("Not extracting funky image '%ls' as 2MG (len=%ld)\n", + LOGI("Not extracting funky image '%ls' as 2MG (len=%ld)", pEntry->GetPathName(), pEntry->GetUncompressedLen()); } } @@ -1016,7 +1016,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread, /* update the display in case we renamed it */ if (outputPath != fpActionProgress->GetFileName()) { - WMSG2(" Renamed our output, from '%ls' to '%ls'\n", + LOGI(" Renamed our output, from '%ls' to '%ls'", (LPCTSTR) fpActionProgress->GetFileName(), outputPath); fpActionProgress->SetFileName(outputPath); } @@ -1026,7 +1026,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread, */ fpActionProgress->SetArcName(pathProp.fStoredPathName); fpActionProgress->SetFileName(outputPath); - WMSG2("Extracting from '%ls' to '%ls'\n", + LOGI("Extracting from '%ls' to '%ls'", pathProp.fStoredPathName, outputPath); SET_PROGRESS_BEGIN(); @@ -1048,7 +1048,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread, /* update the display in case they renamed the file */ if (outputPath != fpActionProgress->GetFileName()) { - WMSG2(" Detected rename, from '%ls' to '%ls'\n", + LOGI(" Detected rename, from '%ls' to '%ls'", (LPCWSTR) fpActionProgress->GetFileName(), outputPath); fpActionProgress->SetFileName(outputPath); } @@ -1109,7 +1109,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread, if (DiskImg::UsesDOSFileStructure(pEntry->GetSourceFS()) && pEntry->GetFileType() == kFileTypeTXT) { - WMSG0("Switching EOLAuto to EOLOn for DOS text file\n"); + LOGI("Switching EOLAuto to EOLOn for DOS text file"); thisConv = GenericEntry::kConvertEOLOn; } } else if (convTextByType) { @@ -1117,7 +1117,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread, if (pEntry->GetFileType() == kFileTypeTXT || pEntry->GetFileType() == kFileTypeSRC) { - WMSG0("Enabling EOL conv for text file\n"); + LOGI("Enabling EOL conv for text file"); thisConv = GenericEntry::kConvertEOLOn; } else { ASSERT(thisConv == GenericEntry::kConvertEOLOff); @@ -1127,7 +1127,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread, (thread == GenericEntry::kRsrcThread || thread == GenericEntry::kDiskImageThread)) { - WMSG0("Disabling EOL conv for resource fork or disk image\n"); + LOGI("Disabling EOL conv for resource fork or disk image"); thisConv = GenericEntry::kConvertEOLOff; } @@ -1159,7 +1159,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread, pOutput->GetOutputKind() == ReformatOutput::kOutputRTF || pOutput->GetOutputKind() == ReformatOutput::kOutputCSV) { - WMSG0(" Writing text, RTF, CSV, or raw\n"); + LOGI(" Writing text, RTF, CSV, or raw"); ASSERT(pOutput->GetTextBuf() != NULL); int err = 0; if (fwrite(pOutput->GetTextBuf(), @@ -1175,7 +1175,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread, SET_PROGRESS_UPDATE(100); } } else if (pOutput->GetOutputKind() == ReformatOutput::kOutputBitmap) { - WMSG0(" Writing bitmap\n"); + LOGI(" Writing bitmap"); ASSERT(pOutput->GetDIB() != NULL); int err = pOutput->GetDIB()->WriteToFile(fp); if (err != 0) { @@ -1196,7 +1196,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread, * We could just send it through to the generic non-reformatter * case, but that would require reading the file twice. */ - WMSG1(" Writing un-reformatted data (%ld bytes)\n", + LOGI(" Writing un-reformatted data (%ld bytes)", pOutput->GetTextLen()); ASSERT(pOutput->GetTextBuf() != NULL); bool lastCR = false; @@ -1216,7 +1216,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread, } else { /* something failed, and we don't have the file */ - WMSG0("How'd we get here?\n"); + LOGI("How'd we get here?"); ASSERT(false); } } else { @@ -1230,7 +1230,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread, CString msg; int result; ASSERT(fpActionProgress != NULL); - WMSG3("Extracting '%ls', requesting thisConv=%d, convHA=%d\n", + LOGI("Extracting '%ls', requesting thisConv=%d, convHA=%d", outputPath, thisConv, convHA); result = pEntry->ExtractThreadToFile(thread, fp, thisConv, convHA, &msg); @@ -1241,7 +1241,7 @@ MainWindow::ExtractEntry(GenericEntry* pEntry, int thread, fpActionProgress->MessageBox(msg, L"CiderPress", MB_OK | MB_ICONEXCLAMATION); } else { - WMSG2(" FAILED on '%ls': %ls\n", outputPath, msg); + LOGI(" FAILED on '%ls': %ls", outputPath, msg); errMsg.Format(L"Unable to extract file '%ls': %ls\n", outputPath, msg); fpActionProgress->MessageBox(errMsg, failed, @@ -1309,10 +1309,10 @@ did_rename: if (*pOverwriteExisting) { do_overwrite: /* delete existing */ - WMSG1(" Deleting existing '%ls'\n", (LPCWSTR) *pOutputPath); + LOGI(" Deleting existing '%ls'", (LPCWSTR) *pOutputPath); if (::_wunlink(*pOutputPath) != 0) { err = errno; - WMSG2(" Failed deleting '%ls', err=%d\n", + LOGI(" Failed deleting '%ls', err=%d", (LPCWSTR)*pOutputPath, err); if (err == ENOENT) { /* user might have removed it while dialog was up */ @@ -1324,7 +1324,7 @@ do_overwrite: } } else if (*pOvwrForAll) { /* never overwrite */ - WMSG1(" Skipping '%ls'\n", (LPCWSTR) *pOutputPath); + LOGI(" Skipping '%ls'", (LPCWSTR) *pOutputPath); goto bail; } else { /* no firm policy, ask the user */ @@ -1382,7 +1382,7 @@ bail: return IDCANCEL; } else if (err == kUserCancel) { /* user elected to cancel */ - WMSG0("Cancelling due to user request\n"); + LOGI("Cancelling due to user request"); return IDCANCEL; } else if (err != 0) { msg.Format(L"Unable to create file '%ls': %hs\n", @@ -1422,7 +1422,7 @@ MainWindow::OnActionsTest(void) selOpts.fFilesToAction = UseSelectionDialog::kActionAll; if (selOpts.DoModal() != IDOK) { - WMSG0("Test cancelled\n"); + LOGI("Test cancelled"); return; } @@ -1510,7 +1510,7 @@ MainWindow::OnActionsDelete(void) delOpts.fFilesToAction = UseSelectionDialog::kActionAll; if (delOpts.DoModal() != IDOK) { - WMSG0("Delete cancelled\n"); + LOGI("Delete cancelled"); return; } #endif @@ -1783,14 +1783,14 @@ MainWindow::OnActionsRenameVolume(void) if (rvDialog.DoModal() != IDOK) return; - //WMSG1("Creating '%s'\n", rvDialog.fNewName); + //LOGI("Creating '%s'", rvDialog.fNewName); /* rename the chosen disk to the specified name */ bool result; result = fpOpenArchive->RenameVolume(this, rvDialog.fpChosenDiskFS, rvDialog.fNewName); if (!result) { - WMSG0("RenameVolume FAILED\n"); + LOGI("RenameVolume FAILED"); /* keep going -- reload just in case something partially happened */ } @@ -1842,7 +1842,7 @@ MainWindow::OnActionsRecompress(void) selOpts.fCompressionType = fPreferences.GetPrefLong(kPrCompressionType); if (selOpts.DoModal() != IDOK) { - WMSG0("Recompress cancelled\n"); + LOGI("Recompress cancelled"); return; } @@ -1965,7 +1965,7 @@ MainWindow::OnActionsConvDisk(void) // fPreferences.GetPrefBool(kPrConvDiskAllocSparse); if (selOpts.DoModal() != IDOK) { - WMSG0("ConvDisk cancelled\n"); + LOGI("ConvDisk cancelled"); return; } @@ -2004,7 +2004,7 @@ MainWindow::OnActionsConvDisk(void) //xferOpts.fUseSparseBlocks = // fPreferences.GetPrefBool(kPrProDOSUseSparse) != 0; - WMSG1("New volume name will be '%ls'\n", (LPCWSTR) selOpts.fVolName); + LOGI("New volume name will be '%ls'", (LPCWSTR) selOpts.fVolName); /* * Create a new disk image. @@ -2019,7 +2019,7 @@ MainWindow::OnActionsConvDisk(void) dlg.m_ofn.lpstrInitialDir = fPreferences.GetPrefString(kPrOpenArchiveFolder); if (dlg.DoModal() != IDOK) { - WMSG0(" User cancelled xfer from image create dialog\n"); + LOGI(" User cancelled xfer from image create dialog"); return; } @@ -2028,7 +2028,7 @@ MainWindow::OnActionsConvDisk(void) fPreferences.SetPrefString(kPrOpenArchiveFolder, saveFolder); filename = dlg.GetPathName(); - WMSG1(" Will xfer to file '%ls'\n", filename); + LOGI(" Will xfer to file '%ls'", filename); /* remove file if it already exists */ CString errMsg; @@ -2117,7 +2117,7 @@ MainWindow::OnActionsConvFile(void) fPreferences.GetPrefBool(kPrConvFileEmptyFolders); if (selOpts.DoModal() != IDOK) { - WMSG0("ConvFile cancelled\n"); + LOGI("ConvFile cancelled"); return; } @@ -2172,7 +2172,7 @@ MainWindow::OnActionsConvFile(void) dlg.m_ofn.lpstrInitialDir = fPreferences.GetPrefString(kPrOpenArchiveFolder); if (dlg.DoModal() != IDOK) { - WMSG0(" User cancelled xfer from archive create dialog\n"); + LOGI(" User cancelled xfer from archive create dialog"); return; } @@ -2181,7 +2181,7 @@ MainWindow::OnActionsConvFile(void) fPreferences.SetPrefString(kPrOpenArchiveFolder, saveFolder); filename = dlg.GetPathName(); - WMSG1(" Will xfer to file '%ls'\n", filename); + LOGI(" Will xfer to file '%ls'", filename); /* remove file if it already exists */ CString errMsg; @@ -2240,7 +2240,7 @@ void MainWindow::OnActionsConvToWav(void) { // do this someday - WMSG0("Convert TO wav\n"); + LOGI("Convert TO wav"); } void MainWindow::OnUpdateActionsConvToWav(CCmdUI* pCmdUI) @@ -2286,7 +2286,7 @@ MainWindow::OnActionsConvFromWav(void) fPreferences.SetPrefString(kPrOpenWAVFolder, saveFolder); fileName = fileDlg.GetPathName(); - WMSG1("Opening WAV file '%ls'\n", fileName); + LOGI("Opening WAV file '%ls'", fileName); dlg.fFileName = fileName; // pass in fpOpenArchive? @@ -2368,7 +2368,7 @@ MainWindow::SaveToArchive(GenericArchive::FileDetails* pDetails, } if (pTargetSubdir != NULL) { storagePrefix = pTargetSubdir->GetPathName(); - WMSG1("--- using storagePrefix '%ls'\n", storagePrefix); + LOGI("--- using storagePrefix '%ls'", storagePrefix); } if (!storagePrefix.IsEmpty()) { CString tmpStr, tmpFileName; @@ -2434,7 +2434,7 @@ MainWindow::OnActionsImportBAS(void) fPreferences.SetPrefString(kPrAddFileFolder, saveFolder); fileName = fileDlg.GetPathName(); - WMSG1("Opening TXT file '%ls'\n", fileName); + LOGI("Opening TXT file '%ls'", fileName); dlg.fFileName = fileName; // pass in fpOpenArchive? @@ -2551,7 +2551,7 @@ MainWindow::GetFilePart(const GenericEntry* pEntry, int whichThread, ASSERT(buf == NULL); } else { /* transfer error message to ReformatHolder buffer */ - WMSG1("Got error message from ExtractThread: '%ls'\n", + LOGI("Got error message from ExtractThread: '%ls'", (LPCWSTR) errMsg); pHolder->SetErrorMsg(part, errMsg); ASSERT(buf == NULL); diff --git a/app/ArchiveInfoDialog.cpp b/app/ArchiveInfoDialog.cpp index 0420949..8cff07f 100644 --- a/app/ArchiveInfoDialog.cpp +++ b/app/ArchiveInfoDialog.cpp @@ -233,7 +233,7 @@ DiskArchiveInfoDialog::OnSubVolSelChange(void) { CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_AIDISK_SUBVOLSEL); ASSERT(pCombo != NULL); - //WMSG1("+++ SELECTION IS NOW %d\n", pCombo->GetCurSel()); + //LOGI("+++ SELECTION IS NOW %d", pCombo->GetCurSel()); const DiskFS* pDiskFS; pDiskFS = (DiskFS*) pCombo->GetItemData(pCombo->GetCurSel()); diff --git a/app/BNYArchive.cpp b/app/BNYArchive.cpp index 7fb3007..044f8a4 100644 --- a/app/BNYArchive.cpp +++ b/app/BNYArchive.cpp @@ -90,12 +90,12 @@ BnyEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength, char* unsqBuf = NULL; long unsqLen = 0; expBuf.SeizeBuffer(&unsqBuf, &unsqLen); - WMSG2("Unsqueezed %ld bytes to %d\n", len, unsqLen); + LOGI("Unsqueezed %ld bytes to %d", len, unsqLen); if (unsqLen == 0) { // some bonehead squeezed a zero-length file delete[] unsqBuf; ASSERT(*ppText == NULL); - WMSG0("Handling zero-length squeezed file!\n"); + LOGI("Handling zero-length squeezed file!"); if (needAlloc) { *ppText = new char[1]; **ppText = '\0'; @@ -185,7 +185,7 @@ BnyEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv, len = (long) GetUncompressedLen(); if (len == 0) { - WMSG0("Empty fork\n"); + LOGI("Empty fork"); result = IDOK; goto bail; } @@ -222,12 +222,12 @@ BnyEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv, } expBuf.SeizeBuffer(&buf, &uncLen); - WMSG2("Unsqueezed %ld bytes to %d\n", len, uncLen); + LOGI("Unsqueezed %ld bytes to %d", len, uncLen); // some bonehead squeezed a zero-length file if (uncLen == 0) { ASSERT(buf == NULL); - WMSG0("Handling zero-length squeezed file!\n"); + LOGI("Handling zero-length squeezed file!"); result = IDOK; goto bail; } @@ -489,7 +489,7 @@ BnyArchive::LoadContents(void) rewind(fFp); nerr = BNYIterate(); - WMSG1("BNYIterate returned %d\n", nerr); + LOGI("BNYIterate returned %d", nerr); return (nerr != kNuErrNone); } @@ -700,7 +700,7 @@ BnyArchive::BNYDecodeHeader(BnyFileEntry* pEntry) if (raw[0] != 0x0a || raw[1] != 0x47 || raw[2] != 0x4c || raw[18] != 0x02) { err = kNuErrBadData; - WMSG0("this doesn't look like a Binary II header\n"); + LOGI("this doesn't look like a Binary II header"); goto bail; } @@ -721,7 +721,7 @@ BnyArchive::BNYDecodeHeader(BnyFileEntry* pEntry) len = raw[23]; if (len > kBNYMaxFileName) { err = kNuErrBadData; - WMSG1("invalid filename length %d\n", len); + LOGI("invalid filename length %d", len); goto bail; } memcpy(pEntry->fileName, &raw[24], len); @@ -732,7 +732,7 @@ BnyArchive::BNYDecodeHeader(BnyFileEntry* pEntry) len = raw[39]; if (len > kBNYMaxNativeName) { err = kNuErrBadData; - WMSG1("invalid filename length %d\n", len); + LOGI("invalid filename length %d", len); goto bail; } memcpy(pEntry->nativeName, &raw[40], len); @@ -830,7 +830,7 @@ BnyArchive::BNYCopyBlocks(BnyFileEntry* pEntry, FILE* outfp) if (outfp != NULL) { if (fwrite(pEntry->blockBuf, toWrite, 1, outfp) != 1) { err = errno ? (NuError) errno : kNuErrFileWrite; - WMSG0("BNY write failed\n"); + LOGI("BNY write failed"); goto bail; } } @@ -840,7 +840,7 @@ BnyArchive::BNYCopyBlocks(BnyFileEntry* pEntry, FILE* outfp) if (bytesLeft) { err = BNYRead(pEntry->blockBuf, kBNYBlockSize); if (err != kNuErrNone) { - WMSG0("BNY read failed\n"); + LOGI("BNY read failed"); goto bail; } } @@ -868,14 +868,14 @@ BnyArchive::BNYIterate(void) while (toFollow) { err = BNYRead(entry.blockBuf, sizeof(entry.blockBuf)); if (err != kNuErrNone) { - WMSG0("failed while reading header\n"); + LOGI("failed while reading header"); goto bail; } err = BNYDecodeHeader(&entry); if (err != kNuErrNone) { if (first) { - WMSG0("not a Binary II archive?\n"); + LOGI("not a Binary II archive?"); } goto bail; } @@ -888,7 +888,7 @@ BnyArchive::BNYIterate(void) if (entry.realEOF != 0) { err = BNYRead(entry.blockBuf, sizeof(entry.blockBuf)); if (err != kNuErrNone) { - WMSG0("failed while reading\n"); + LOGI("failed while reading"); goto bail; } } @@ -913,7 +913,7 @@ BnyArchive::BNYIterate(void) if (nblocks > 1) { err = BNYSeek((nblocks-1) * kBNYBlockSize); if (err != kNuErrNone) { - WMSG0("failed while seeking forward\n"); + LOGI("failed while seeking forward"); goto bail; } } @@ -921,7 +921,7 @@ BnyArchive::BNYIterate(void) if (!first) { if (entry.filesToFollow != toFollow -1) { - WMSG2("WARNING: filesToFollow %d, expected %d\n", + LOGI("WARNING: filesToFollow %d, expected %d", entry.filesToFollow, toFollow -1); } } @@ -932,7 +932,7 @@ BnyArchive::BNYIterate(void) bail: if (err != kNuErrNone) { - WMSG1("--- Iterator returning failure %d\n", err); + LOGI("--- Iterator returning failure %d", err); } return err; } @@ -957,13 +957,13 @@ BnyArchive::TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) ASSERT(fFp != NULL); - WMSG1("Testing %d entries\n", pSelSet->GetNumEntries()); + LOGI("Testing %d entries", pSelSet->GetNumEntries()); SelectionEntry* pSelEntry = pSelSet->IterNext(); while (pSelEntry != NULL) { pEntry = (BnyEntry*) pSelEntry->GetEntry(); - WMSG2(" Testing '%ls' (offset=%ld)\n", pEntry->GetDisplayName(), + LOGI(" Testing '%ls' (offset=%ld)", pEntry->GetDisplayName(), pEntry->GetOffset()); SET_PROGRESS_UPDATE2(0, pEntry->GetDisplayName(), NULL); diff --git a/app/BasicImport.cpp b/app/BasicImport.cpp index e240c46..46bcc5b 100644 --- a/app/BasicImport.cpp +++ b/app/BasicImport.cpp @@ -98,7 +98,7 @@ ImportBASDialog::OnInitDialog(void) CString fileNameOnly(path.GetFileName()); CString ext(fileNameOnly.Right(4)); if (ext.CompareNoCase(L".txt") == 0) { - WMSG1("removing extension from '%ls'\n", (LPCWSTR) fileNameOnly); + LOGI("removing extension from '%ls'", (LPCWSTR) fileNameOnly); fileNameOnly = fileNameOnly.Left(fileNameOnly.GetLength() - 4); } @@ -356,16 +356,16 @@ ImportBASDialog::ProcessBASLine(const char* buf, int len, * Remove the CR, LF, or CRLF from the end of the line. */ if (len > 1 && buf[len-2] == '\r' && buf[len-1] == '\n') { - //WMSG0("removed CRLF\n"); + //LOGI("removed CRLF"); len -= 2; } else if (buf[len-1] == '\r') { - //WMSG0("removed CR\n"); + //LOGI("removed CR"); len--; } else if (buf[len-1] == '\n') { - //WMSG0("removed LF\n"); + //LOGI("removed LF"); len--; } else { - //WMSG0("no EOL marker found\n"); + //LOGI("no EOL marker found"); } if (!len) @@ -402,7 +402,7 @@ ImportBASDialog::ProcessBASLine(const char* buf, int len, } tokenBuf[tokenLen] = '\0'; lineNum = atoi(tokenBuf); - WMSG1("FOUND line %d\n", lineNum); + LOGI("FOUND line %d", lineNum); pOutput->Putc((char) 0xcc); // placeholder pOutput->Putc((char) 0xcc); @@ -483,7 +483,7 @@ ImportBASDialog::ProcessBASLine(const char* buf, int len, for (int j = 0; j < foundLen; j++) GetNextNWC(&buf, &len, &ch); - //WMSG2("TOKEN '%s' (%d)\n", + //LOGI("TOKEN '%s' (%d)", // fBASLookup.GetToken(token), tokenLen); /* special handling for REM or DATA */ @@ -553,7 +553,7 @@ ImportBASDialog::FixBASLinePointers(char* buf, long len, unsigned short addr) if (val == 0) break; if (val != 0xcccc) { - WMSG1("unexpected value 0x%04x found\n", val); + LOGI("unexpected value 0x%04x found", val); return false; } @@ -568,7 +568,7 @@ ImportBASDialog::FixBASLinePointers(char* buf, long len, unsigned short addr) len--; } if (!len) { - WMSG0("ran off the end?\n"); + LOGI("ran off the end?"); return false; } buf++; diff --git a/app/CassImpTargetDialog.cpp b/app/CassImpTargetDialog.cpp index 8ed756c..bcd79df 100644 --- a/app/CassImpTargetDialog.cpp +++ b/app/CassImpTargetDialog.cpp @@ -139,12 +139,12 @@ CassImpTargetDialog::GetStartAddr(void) const long val; if (str[0] == '\0') { - WMSG0(" HEY: blank addr, returning -1\n"); + LOGI(" HEY: blank addr, returning -1"); return -1; } val = wcstoul(aux, &end, 16); if (end != str + wcslen(str)) { - WMSG1(" HEY: found some garbage in addr '%ls', returning -1\n", + LOGI(" HEY: found some garbage in addr '%ls', returning -1", (LPCWSTR) aux); return -1; } diff --git a/app/CassetteDialog.cpp b/app/CassetteDialog.cpp index 1362370..2de395a 100644 --- a/app/CassetteDialog.cpp +++ b/app/CassetteDialog.cpp @@ -295,7 +295,7 @@ CassetteDialog::OnInitDialog(void) { pCombo->SetCurSel(defaultAlg); } else { - WMSG1("GLITCH: invalid defaultAlg in prefs (%d)\n", defaultAlg); + LOGI("GLITCH: invalid defaultAlg in prefs (%d)", defaultAlg); pCombo->SetCurSel(CassetteData::kAlgorithmZero); } fAlgorithm = (CassetteData::Algorithm) defaultAlg; @@ -366,7 +366,7 @@ CassetteDialog::OnDialogReady(UINT, LONG) void CassetteDialog::OnListChange(NMHDR*, LRESULT* pResult) { - WMSG0("List change\n"); + LOGI("List change"); CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_CASSETTE_LIST); CButton* pButton = (CButton*) GetDlgItem(IDC_IMPORT_CHUNK); pButton->EnableWindow(pListView->GetSelectedCount() != 0); @@ -381,7 +381,7 @@ CassetteDialog::OnListChange(NMHDR*, LRESULT* pResult) void CassetteDialog::OnListDblClick(NMHDR* pNotifyStruct, LRESULT* pResult) { - WMSG0("Double click!\n"); + LOGI("Double click!"); CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_CASSETTE_LIST); if (pListView->GetSelectedCount() == 1) @@ -398,7 +398,7 @@ CassetteDialog::OnAlgorithmChange(void) { CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_CASSETTE_ALG); ASSERT(pCombo != NULL); - WMSG1("+++ SELECTION IS NOW %d\n", pCombo->GetCurSel()); + LOGI("+++ SELECTION IS NOW %d", pCombo->GetCurSel()); fAlgorithm = (CassetteData::Algorithm) pCombo->GetCurSel(); AnalyzeWAV(); } @@ -539,7 +539,7 @@ CassetteDialog::AnalyzeWAV(void) } if (idx == 0) { - WMSG0("No Apple II files found\n"); + LOGI("No Apple II files found"); /* that's okay, just show the empty list */ } @@ -634,7 +634,7 @@ CassetteDialog::CassetteData::Scan(SoundFile* pSoundFile, Algorithm alg, byteOffset = *pStartOffset; initialLen = dataLen = pSoundFile->GetDataLen() - byteOffset; sampleStartIndex = byteOffset/bytesPerSample; - WMSG4("CassetteData::Scan(off=%ld / %ld) len=%ld alg=%d\n", + LOGI("CassetteData::Scan(off=%ld / %ld) len=%ld alg=%d", byteOffset, sampleStartIndex, dataLen, alg); pFormat = pSoundFile->GetWaveFormat(); @@ -644,7 +644,7 @@ CassetteDialog::CassetteData::Scan(SoundFile* pSoundFile, Algorithm alg, if (fOutputBuf == NULL) // alloc on first use fOutputBuf = new unsigned char[kMaxFileLen]; if (buf == NULL || sampleBuf == NULL || fOutputBuf == NULL) { - WMSG0("Buffer alloc failed\n"); + LOGI("Buffer alloc failed"); goto bail; } @@ -671,7 +671,7 @@ CassetteDialog::CassetteData::Scan(SoundFile* pSoundFile, Algorithm alg, cc = pSoundFile->ReadData(buf, byteOffset, chunkLen); if (cc < 0) { - WMSG1("ReadData(%d) failed\n", chunkLen); + LOGI("ReadData(%d) failed", chunkLen); goto bail; } @@ -683,7 +683,7 @@ CassetteDialog::CassetteData::Scan(SoundFile* pSoundFile, Algorithm alg, &scanState, &bitVal)) { if (outByteIndex >= kMaxFileLen) { - WMSG0("Cassette data overflow\n"); + LOGI("Cassette data overflow"); scanState.phase = kPhaseEndReached; } else { /* output a bit, shifting until bit 8 lights up */ @@ -713,28 +713,28 @@ CassetteDialog::CassetteData::Scan(SoundFile* pSoundFile, Algorithm alg, case kPhaseScanFor770Start: case kPhaseScanning770: // expected case for trailing part of file - WMSG0("Scan ended while searching for 770\n"); + LOGI("Scan ended while searching for 770"); goto bail; case kPhaseScanForShort0: case kPhaseShort0B: - WMSG0("Scan ended while searching for short 0/0B\n"); + LOGI("Scan ended while searching for short 0/0B"); //DebugBreak(); // unusual goto bail; case kPhaseReadData: - WMSG0("Scan ended while reading data\n"); + LOGI("Scan ended while reading data"); //DebugBreak(); // truncated WAV file? goto bail; case kPhaseEndReached: - WMSG0("Scan found end\n"); + LOGI("Scan found end"); // winner! break; default: - WMSG1("Unknown phase %d\n", scanState.phase); + LOGI("Unknown phase %d", scanState.phase); assert(false); goto bail; } - WMSG3("*** Output %d bytes (bitAcc=0x%02x, checkSum=0x%02x)\n", + LOGI("*** Output %d bytes (bitAcc=0x%02x, checkSum=0x%02x)", outByteIndex, bitAcc, checkSum); if (outByteIndex == 0) { @@ -778,7 +778,7 @@ CassetteDialog::CassetteData::ConvertSamplesToReal(const WAVEFORMATEX* pFormat, if (bitsPerSample == 8) { while (chunkLen > 0) { *sampleBuf++ = (*buf - 128) / 128.0f; - //WMSG3("Sample8(%5d)=%d float=%.3f\n", offset, *buf, *(sampleBuf-1)); + //LOGI("Sample8(%5d)=%d float=%.3f", offset, *buf, *(sampleBuf-1)); //offset++; buf += bps; chunkLen -= bps; @@ -787,7 +787,7 @@ CassetteDialog::CassetteData::ConvertSamplesToReal(const WAVEFORMATEX* pFormat, while (chunkLen > 0) { short sample = *buf | *(buf+1) << 8; *sampleBuf++ = sample / 32768.0f; - //WMSG3("Sample16(%5d)=%d float=%.3f\n", offset, sample, *(sampleBuf-1)); + //LOGI("Sample16(%5d)=%d float=%.3f", offset, sample, *(sampleBuf-1)); //offset++; buf += bps; chunkLen -= bps; @@ -796,7 +796,7 @@ CassetteDialog::CassetteData::ConvertSamplesToReal(const WAVEFORMATEX* pFormat, assert(false); } - //WMSG1("Conv %d\n", bitsPerSample); + //LOGI("Conv %d", bitsPerSample); } /* width of 1/2 cycle in 770Hz lead-in */ @@ -904,7 +904,7 @@ CassetteDialog::CassetteData::ProcessSampleZero(float sample, long sampleIndex, timeDelta = (sampleIndex+bias) - pScanState->lastZeroIndex; halfCycleUsec = timeDelta * pScanState->usecPerSample; - //WMSG3("Zero %6ld: half=%.1fusec full=%.1fusec\n", + //LOGI("Zero %6ld: half=%.1fusec full=%.1fusec", // sampleIndex, halfCycleUsec, // halfCycleUsec + pScanState->halfCycleWidth); @@ -1033,13 +1033,13 @@ CassetteDialog::CassetteData::ProcessSamplePeak(float sample, long sampleIndex, halfCycleUsec = timeDelta * pScanState->usecPerSample; //if (sampleIndex > 584327 && sampleIndex < 590000) { - // WMSG4("Peak %6ld: amp=%.3f height=%.3f peakWidth=%.1fusec\n", + // LOGI("Peak %6ld: amp=%.3f height=%.3f peakWidth=%.1fusec", // sampleIndex-1, pScanState->prevSample, ampDelta, // halfCycleUsec); // ::Sleep(10); //} if (sampleIndex == 32739) - WMSG0("whee\n"); + LOGI("whee"); emitBit = UpdatePhase(pScanState, sampleIndex-1, halfCycleUsec, pBitVal); @@ -1084,7 +1084,7 @@ CassetteDialog::CassetteData::UpdatePhase(ScanState* pScanState, long sampleInde fullCycleUsec > kLeadInHalfWidth*2.0f - kLeadInMaxError*2.0f && fullCycleUsec < kLeadInHalfWidth*2.0f + kLeadInMaxError*2.0f) { - //WMSG1(" scanning 770 at %ld\n", sampleIndex); + //LOGI(" scanning 770 at %ld", sampleIndex); pScanState->phase = kPhaseScanning770; pScanState->num770 = 1; } @@ -1099,12 +1099,12 @@ CassetteDialog::CassetteData::UpdatePhase(ScanState* pScanState, long sampleInde if (pScanState->num770 > kLeadInHalfCycThreshold/2) { /* looks like a solid tone, advance to next phase */ pScanState->phase = kPhaseScanForShort0; - WMSG0(" looking for short 0\n"); + LOGI(" looking for short 0"); } } else if (fullCycleUsec != 0.0f) { /* pattern lost, reset */ if (pScanState->num770 > 5) { - WMSG3(" lost 770 at %ld width=%.1f (count=%ld)\n", + LOGI(" lost 770 at %ld width=%.1f (count=%ld)", sampleIndex, fullCycleUsec, pScanState->num770); } pScanState->phase = kPhaseScanFor770Start; @@ -1116,7 +1116,7 @@ CassetteDialog::CassetteData::UpdatePhase(ScanState* pScanState, long sampleInde if (halfCycleUsec > kShortZeroHalfWidth - kShortZeroMaxError && halfCycleUsec < kShortZeroHalfWidth + kShortZeroMaxError) { - WMSG3(" found short zero (half=%.1f) at %ld after %ld 770s\n", + LOGI(" found short zero (half=%.1f) at %ld after %ld 770s", halfCycleUsec, sampleIndex, pScanState->num770); pScanState->phase = kPhaseShort0B; /* make sure we treat current sample as first half */ @@ -1130,7 +1130,7 @@ CassetteDialog::CassetteData::UpdatePhase(ScanState* pScanState, long sampleInde pScanState->num770++; } else if (fullCycleUsec != 0.0f) { /* full cycle of the wrong size, we've lost it */ - WMSG3(" Lost 770 at %ld width=%.1f (count=%ld)\n", + LOGI(" Lost 770 at %ld width=%.1f (count=%ld)", sampleIndex, fullCycleUsec, pScanState->num770); pScanState->phase = kPhaseScanFor770Start; } @@ -1142,13 +1142,13 @@ CassetteDialog::CassetteData::UpdatePhase(ScanState* pScanState, long sampleInde fullCycleUsec < (kShortZeroHalfWidth + kZeroHalfWidth) + kZeroMaxError*2.0f) { /* as expected */ - WMSG2(" Found 0B %.1f (total %.1f), advancing to 'read data' phase\n", + LOGI(" Found 0B %.1f (total %.1f), advancing to 'read data' phase", halfCycleUsec, fullCycleUsec); pScanState->dataStart = sampleIndex; pScanState->phase = kPhaseReadData; } else { /* must be a false-positive at end of tone */ - WMSG2(" Didn't find post-short-0 value (half=%.1f + %.1f)\n", + LOGI(" Didn't find post-short-0 value (half=%.1f + %.1f)", pScanState->halfCycleWidth, halfCycleUsec); pScanState->phase = kPhaseScanFor770Start; } @@ -1170,7 +1170,7 @@ CassetteDialog::CassetteData::UpdatePhase(ScanState* pScanState, long sampleInde emitBit = true; } else { /* bad cycle, assume end reached */ - WMSG2(" Bad full cycle time %.1f in data at %ld, bailing\n", + LOGI(" Bad full cycle time %.1f in data at %ld, bailing", fullCycleUsec, sampleIndex); pScanState->dataEnd = sampleIndex; pScanState->phase = kPhaseEndReached; diff --git a/app/ChooseAddTargetDialog.cpp b/app/ChooseAddTargetDialog.cpp index 83f6f5c..e33c1f6 100644 --- a/app/ChooseAddTargetDialog.cpp +++ b/app/ChooseAddTargetDialog.cpp @@ -34,14 +34,14 @@ ChooseAddTargetDialog::OnInitDialog(void) fDiskFSTree.fIncludeSubdirs = true; fDiskFSTree.fExpandDepth = -1; if (!fDiskFSTree.BuildTree(fpDiskFS, pTree)) { - WMSG0("Tree load failed!\n"); + LOGI("Tree load failed!"); OnCancel(); } int count = pTree->GetCount(); - WMSG1("ChooseAddTargetDialog tree has %d items\n", count); + LOGI("ChooseAddTargetDialog tree has %d items", count); if (count <= 1) { - WMSG0(" Skipping out of target selection\n"); + LOGI(" Skipping out of target selection"); // adding to root volume of the sole DiskFS fpChosenDiskFS = fpDiskFS; ASSERT(fpChosenSubdir == NULL); diff --git a/app/ChooseDirDialog.cpp b/app/ChooseDirDialog.cpp index 78847ac..9deb0df 100644 --- a/app/ChooseDirDialog.cpp +++ b/app/ChooseDirDialog.cpp @@ -36,7 +36,7 @@ ChooseDirDialog::OnInitDialog(void) /* replace the tree control with a ShellTree */ if (fShellTree.ReplaceDlgCtrl(this, IDC_CHOOSEDIR_TREE) != TRUE) { - WMSG0("WARNING: ShellTree replacement failed\n"); + LOGI("WARNING: ShellTree replacement failed"); ASSERT(false); } @@ -53,7 +53,7 @@ ChooseDirDialog::OnInitDialog(void) fShellTree.TunnelTree(fPathName, &msg); if (!msg.IsEmpty()) { /* failed */ - WMSG2("TunnelTree failed on '%ls' (%ls), using MyComputer instead\n", + LOGI("TunnelTree failed on '%ls' (%ls), using MyComputer instead", (LPCWSTR) fPathName, (LPCWSTR) msg); fShellTree.ExpandMyComputer(); } @@ -72,7 +72,7 @@ ChooseDirDialog::PreTranslateMessage(MSG* pMsg) if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN) { - //WMSG0("RETURN!\n"); + //LOGI("RETURN!"); if (GetFocus() == GetDlgItem(IDC_CHOOSEDIR_PATHEDIT)) { OnExpandTree(); return TRUE; @@ -182,18 +182,18 @@ ChooseDirDialog::OnNewFolder(void) */ if (fShellTree.AddFolderAtSelection(newFolderDlg.fNewFolder)) { CString msg; - WMSG1("Success, tunneling to '%ls'\n", + LOGI("Success, tunneling to '%ls'", (LPCWSTR) newFolderDlg.fNewFullPath); fShellTree.TunnelTree(newFolderDlg.fNewFullPath, &msg); if (!msg.IsEmpty()) { - WMSG1("TunnelTree failed: %ls\n", (LPCWSTR) msg); + LOGI("TunnelTree failed: %ls", (LPCWSTR) msg); } } else { - WMSG0("AddFolderAtSelection FAILED\n"); + LOGI("AddFolderAtSelection FAILED"); ASSERT(false); } } else { - WMSG0("NewFolderDialog returned IDOK but no create\n"); + LOGI("NewFolderDialog returned IDOK but no create"); } } } diff --git a/app/Clipboard.cpp b/app/Clipboard.cpp index de2708c..09d98a0 100644 --- a/app/Clipboard.cpp +++ b/app/Clipboard.cpp @@ -116,7 +116,7 @@ MainWindow::OnEditCopy(void) ShowFailureMsg(this, errStr, IDS_FAILED); goto bail; } - WMSG1("myFormat = %u\n", myFormat); + LOGI("myFormat = %u", myFormat); /* open & empty the clipboard, even if we fail later */ if (OpenClipboard() == false) { @@ -154,12 +154,12 @@ MainWindow::OnEditCopy(void) size_t neededLen = (fileList.GetLength() + 1) * sizeof(WCHAR); hGlobal = ::GlobalAlloc(GHND | GMEM_SHARE, neededLen); if (hGlobal == NULL) { - WMSG1("Failed allocating %d bytes\n", neededLen); + LOGI("Failed allocating %d bytes", neededLen); errStr.LoadString(IDS_CLIPBOARD_ALLOCFAILED); ShowFailureMsg(this, errStr, IDS_FAILED); goto bail; } - WMSG1(" Allocated %ld bytes for file list on clipboard\n", neededLen); + LOGI(" Allocated %ld bytes for file list on clipboard", neededLen); pGlobal = ::GlobalLock(hGlobal); ASSERT(pGlobal != NULL); wcscpy((WCHAR*) pGlobal, fileList); @@ -307,7 +307,7 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet) pEntry = pSelEntry->GetEntry(); ASSERT(pEntry != NULL); - //WMSG1("+++ Examining '%s'\n", pEntry->GetDisplayName()); + //LOGI("+++ Examining '%s'", pEntry->GetDisplayName()); if (pEntry->GetRecordKind() != GenericEntry::kRecordKindVolumeDir) { totalLength += sizeof(FileCollectionEntry); @@ -321,7 +321,7 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet) if (totalLength < 0) { DebugBreak(); - WMSG0("Overflow\n"); // pretty hard to do right now! + LOGI("Overflow"); // pretty hard to do right now! return NULL; } @@ -338,7 +338,7 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet) } #endif - WMSG3("Total length required is %ld + %ld = %ld\n", + LOGI("Total length required is %ld + %ld = %ld", totalLength, priorLength, totalLength+priorLength); if (IsWin9x() && totalLength+priorLength >= kWin98ClipboardMax) { CString errMsg; @@ -357,7 +357,7 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet) CString errMsg; errMsg.Format(L"ERROR: unable to allocate %ld bytes for copy", totalLength); - WMSG1("%ls\n", (LPCWSTR) errMsg); + LOGI("%ls", (LPCWSTR) errMsg); ShowFailureMsg(this, errMsg, IDS_FAILED); goto bail; } @@ -365,7 +365,7 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet) ASSERT(pGlobal != NULL); ASSERT(GlobalSize(hGlobal) >= (DWORD) totalLength); - WMSG3("hGlobal=0x%08lx pGlobal=0x%08lx size=%ld\n", + LOGI("hGlobal=0x%08lx pGlobal=0x%08lx size=%ld", (long) hGlobal, (long) pGlobal, GlobalSize(hGlobal)); /* @@ -400,7 +400,7 @@ MainWindow::CreateFileCollection(SelectionSet* pSelSet) ShowFailureMsg(fpActionProgress, errStr, IDS_MB_APP_NAME); goto bail; } - //WMSG1("remainingLen now %ld\n", remainingLen); + //LOGI("remainingLen now %ld", remainingLen); pSelEntry = pSelSet->IterNext(); } @@ -460,7 +460,7 @@ MainWindow::CopyToCollection(GenericEntry* pEntry, void** pBuf, long* pBufLen) errStr.LoadString(IDS_CLIPBOARD_WRITEFAILURE); if (pEntry->GetRecordKind() == GenericEntry::kRecordKindVolumeDir) { - WMSG0("Not copying volume dir to collection\n"); + LOGI("Not copying volume dir to collection"); return ""; } @@ -549,7 +549,7 @@ MainWindow::CopyToCollection(GenericEntry* pEntry, void** pBuf, long* pBufLen) errStr.LoadString(IDS_CANCELLED); return errStr; } else if (result != IDOK) { - WMSG0("ExtractThreadToBuffer (data) failed\n"); + LOGI("ExtractThreadToBuffer (data) failed"); return errStr; } @@ -571,7 +571,7 @@ MainWindow::CopyToCollection(GenericEntry* pEntry, void** pBuf, long* pBufLen) errStr.LoadString(IDS_CANCELLED); return errStr; } else if (result != IDOK) { - WMSG0("ExtractThreadToBuffer (rsrc) failed\n"); + LOGI("ExtractThreadToBuffer (rsrc) failed"); return errStr; } @@ -699,7 +699,7 @@ MainWindow::DoPaste(bool pasteJunkPaths) ShowFailureMsg(this, errStr, IDS_FAILED); goto bail; } - WMSG1("myFormat = %u\n", myFormat); + LOGI("myFormat = %u", myFormat); if (OpenClipboard() == false) { errStr.LoadString(IDS_CLIPBOARD_OPENFAILED); @@ -708,13 +708,13 @@ MainWindow::DoPaste(bool pasteJunkPaths) } isOpen = true; - WMSG1("Found %d clipboard formats\n", CountClipboardFormats()); + LOGI("Found %d clipboard formats", CountClipboardFormats()); while ((format = EnumClipboardFormats(format)) != 0) { CString tmpStr; tmpStr.Format(L" %u", format); buildStr += tmpStr; } - WMSG1(" %ls\n", (LPCWSTR) buildStr); + LOGI(" %ls", (LPCWSTR) buildStr); #if 0 if (IsClipboardFormatAvailable(CF_HDROP)) { @@ -731,7 +731,7 @@ MainWindow::DoPaste(bool pasteJunkPaths) goto bail; } - WMSG1("+++ total data on clipboard: %ld bytes\n", + LOGI("+++ total data on clipboard: %ld bytes", GetClipboardContentLen()); HGLOBAL hGlobal; @@ -781,7 +781,7 @@ MainWindow::ProcessClipboard(const void* vbuf, long bufLen, bool pasteJunkPaths) * Pull the header out. */ if (bufLen < sizeof(fileColl)) { - WMSG0("Clipboard contents too small!\n"); + LOGI("Clipboard contents too small!"); goto bail; } memcpy(&fileColl, buf, sizeof(fileColl)); @@ -791,13 +791,13 @@ MainWindow::ProcessClipboard(const void* vbuf, long bufLen, bool pasteJunkPaths) * boundaries, which screws up our "bufLen > 0" while condition below. */ if ((long) fileColl.length > bufLen) { - WMSG2("GLITCH: stored len=%ld, clip len=%ld\n", + LOGI("GLITCH: stored len=%ld, clip len=%ld", fileColl.length, bufLen); goto bail; } if (bufLen > (long) fileColl.length) { /* trim off extra */ - WMSG2("NOTE: Windows reports excess length (%ld vs %ld)\n", + LOGI("NOTE: Windows reports excess length (%ld vs %ld)", fileColl.length, bufLen); bufLen = fileColl.length; } @@ -805,7 +805,7 @@ MainWindow::ProcessClipboard(const void* vbuf, long bufLen, bool pasteJunkPaths) buf += sizeof(fileColl); bufLen -= sizeof(fileColl); - WMSG4("FileCollection found: vers=%d off=%d len=%ld count=%ld\n", + LOGI("FileCollection found: vers=%d off=%d len=%ld count=%ld", fileColl.version, fileColl.dataOffset, fileColl.length, fileColl.count); if (fileColl.count == 0) { @@ -830,7 +830,7 @@ MainWindow::ProcessClipboard(const void* vbuf, long bufLen, bool pasteJunkPaths) if (pTargetSubdir != NULL) { storagePrefix = pTargetSubdir->GetPathName(); - WMSG1("--- using storagePrefix '%ls'\n", (LPCWSTR) storagePrefix); + LOGI("--- using storagePrefix '%ls'", (LPCWSTR) storagePrefix); } /* @@ -844,14 +844,14 @@ MainWindow::ProcessClipboard(const void* vbuf, long bufLen, bool pasteJunkPaths) /* * Loop over all files. */ - WMSG1("+++ Starting paste, bufLen=%ld\n", bufLen); + LOGI("+++ Starting paste, bufLen=%ld", bufLen); while (bufLen > 0) { FileCollectionEntry collEnt; CString fileName, processErrStr; /* read the entry info */ if (bufLen < sizeof(collEnt)) { - WMSG2("GLITCH: bufLen=%ld, sizeof(collEnt)=%d\n", + LOGI("GLITCH: bufLen=%ld, sizeof(collEnt)=%d", bufLen, sizeof(collEnt)); ASSERT(false); goto bail; @@ -879,7 +879,7 @@ MainWindow::ProcessClipboard(const void* vbuf, long bufLen, bool pasteJunkPaths) buf += collEnt.fileNameLen; bufLen -= collEnt.fileNameLen; - //WMSG1("+++ pasting '%s'\n", fileName); + //LOGI("+++ pasting '%s'", fileName); /* strip the path (if requested) and prepend the storage prefix */ ASSERT(fileName.GetLength() == collEnt.fileNameLen -1); @@ -972,7 +972,7 @@ MainWindow::ProcessClipboardEntry(const FileCollectionEntry* pCollEnt, CString errMsg; entryKind = (GenericArchive::FileDetails::FileKind) pCollEnt->entryKind; - WMSG2(" Processing '%ls' (%d)\n", pathName, entryKind); + LOGI(" Processing '%ls' (%d)", pathName, entryKind); details.entryKind = entryKind; details.origName = L"Clipboard"; diff --git a/app/ContentList.cpp b/app/ContentList.cpp index 3f91a3c..5876546 100644 --- a/app/ContentList.cpp +++ b/app/ContentList.cpp @@ -28,7 +28,7 @@ END_MESSAGE_MAP() afx_msg BOOL ContentList::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) { - WMSG0("MOUSE WHEEL\n"); + LOGI("MOUSE WHEEL"); return CWnd::OnMouseWheel(nFlags, zDelta, pt); // return TRUE; } @@ -59,7 +59,7 @@ ContentList::PreCreateWindow(CREATESTRUCT& cs) void ContentList::PostNcDestroy(void) { - WMSG0("ContentList PostNcDestroy\n"); + LOGI("ContentList PostNcDestroy"); delete this; } @@ -104,7 +104,7 @@ ContentList::OnCreate(LPCREATESTRUCT lpcs) LoadHeaderImages(); CHeaderCtrl* pHeader = GetHeaderCtrl(); if (pHeader == NULL) - WMSG0("GLITCH: couldn't get header ctrl\n"); + LOGI("GLITCH: couldn't get header ctrl"); ASSERT(pHeader != NULL); pHeader->SetImageList(&fHdrImageList); @@ -133,7 +133,7 @@ ContentList::OnCreate(LPCREATESTRUCT lpcs) void ContentList::OnDestroy(void) { - WMSG0("ContentList OnDestroy\n"); + LOGI("ContentList OnDestroy"); ExportColumnWidths(); CListCtrl::OnDestroy(); @@ -158,7 +158,7 @@ ContentList::OnColumnClick(NMHDR* pnmh, LRESULT* pResult) { NM_LISTVIEW* pnmlv = (NM_LISTVIEW*) pnmh; - WMSG0("OnColumnClick!!\n"); + LOGI("OnColumnClick!!"); if (fpLayout->GetSortColumn() == pnmlv->iSubItem) fpLayout->SetAscending(!fpLayout->GetAscending()); @@ -177,7 +177,7 @@ ContentList::OnColumnClick(NMHDR* pnmh, LRESULT* pResult) void ContentList::ExportColumnWidths(void) { - //WMSG0("ExportColumnWidths\n"); + //LOGI("ExportColumnWidths"); for (int i = 0; i < kNumVisibleColumns; i++) fpLayout->SetColumnWidth(i, GetColumnWidth(i)); } @@ -198,7 +198,7 @@ ContentList::NewColumnWidths(void) int width = fpLayout->GetColumnWidth(i); if (width == ColumnLayout::kWidthDefaulted) { width = GetDefaultWidth(i); - WMSG2("Defaulting width %d to %d\n", i, width); + LOGI("Defaulting width %d to %d", i, width); fpLayout->SetColumnWidth(i, width); } SetColumnWidth(i, width); @@ -238,7 +238,7 @@ ContentList::Invalidate(void) void ContentList::Reload(bool saveSelection) { - WMSG0("Reloading ContentList\n"); + LOGI("Reloading ContentList"); CWaitCursor waitc; // fInvalid = false; @@ -284,7 +284,7 @@ ContentList::GetSelectionSerials(long* pSelCount) long maxCount; maxCount = GetSelectedCount(); - WMSG1("GetSelectionSerials (maxCount=%d)\n", maxCount); + LOGI("GetSelectionSerials (maxCount=%d)", maxCount); if (maxCount > 0) { savedSel = new long[maxCount]; @@ -319,7 +319,7 @@ ContentList::GetSelectionSerials(long* pSelCount) void ContentList::RestoreSelection(const long* savedSel, long selCount) { - WMSG1("RestoreSelection (selCount=%d)\n", selCount); + LOGI("RestoreSelection (selCount=%d)", selCount); if (savedSel == NULL) return; @@ -334,7 +334,7 @@ ContentList::RestoreSelection(const long* savedSel, long selCount) { /* match! */ if (SetItemState(i, LVIS_SELECTED, LVIS_SELECTED) == FALSE) { - WMSG1("WHOA: unable to set selected on item=%d\n", i); + LOGI("WHOA: unable to set selected on item=%d", i); } break; } @@ -528,7 +528,7 @@ ContentList::OnGetDispInfo(NMHDR* pnmh, LRESULT* pResult) return; } - //WMSG0("OnGetDispInfo\n"); + //LOGI("OnGetDispInfo"); if (plvdi->item.mask & LVIF_TEXT) { GenericEntry* pEntry = (GenericEntry*) plvdi->item.lParam; @@ -609,7 +609,7 @@ ContentList::OnGetDispInfo(NMHDR* pnmh, LRESULT* pResult) } //if (plvdi->item.mask & LVIF_IMAGE) { - // WMSG2("IMAGE req item=%d subitem=%d\n", + // LOGI("IMAGE req item=%d subitem=%d", // plvdi->item.iItem, plvdi->item.iSubItem); //} @@ -766,7 +766,7 @@ ContentList::LoadData(void) pEntry = pEntry->GetNext(); } - WMSG3("ContentList got %d entries (%d files + %d unseen directories)\n", + LOGI("ContentList got %d entries (%d files + %d unseen directories)", idx, idx - dirCount, dirCount); return 0; } @@ -835,7 +835,7 @@ ContentList::SetSortIcon(void) if (fpLayout->GetSortColumn() != i) { curItem.fmt &= ~(HDF_IMAGE | HDF_BITMAP_ON_RIGHT); } else { - //WMSG1(" Sorting on %d\n", i); + //LOGI(" Sorting on %d", i); curItem.fmt |= HDF_IMAGE | HDF_BITMAP_ON_RIGHT; if (fpLayout->GetAscending()) curItem.iImage = 0; @@ -866,7 +866,7 @@ ContentList::OnDoubleClick(NMHDR*, LRESULT* pResult) int idx = HitTest(point); if (idx != -1) { CString str = GetItemText(idx, 0); - WMSG1("%ls was double-clicked\n", (LPCWSTR) str); + LOGI("%ls was double-clicked", (LPCWSTR) str); } ((MainWindow*) ::AfxGetMainWnd())->HandleDoubleClick(); @@ -895,7 +895,7 @@ ContentList::OnRightClick(NMHDR*, LRESULT* pResult) int idx = HitTest(point); if (idx != -1) { CString str = GetItemText(idx, 0); - WMSG1("%ls was right-clicked\n", (LPCWSTR) str); + LOGI("%ls was right-clicked", (LPCWSTR) str); //fRightClickItem = idx; #else @@ -922,7 +922,7 @@ ContentList::SelectAll(void) for (i = GetItemCount()-1; i >= 0; i--) { if (!SetItemState(i, LVIS_SELECTED, LVIS_SELECTED)) { - WMSG1("Glitch: SetItemState failed on %d\n", i); + LOGI("Glitch: SetItemState failed on %d", i); } } } @@ -938,7 +938,7 @@ ContentList::InvertSelection(void) for (i = GetItemCount()-1; i >= 0; i--) { oldState = GetItemState(i, LVIS_SELECTED); if (!SetItemState(i, oldState ? 0 : LVIS_SELECTED, LVIS_SELECTED)) { - WMSG1("Glitch: SetItemState failed on %d\n", i); + LOGI("Glitch: SetItemState failed on %d", i); } } } @@ -969,7 +969,7 @@ ContentList::SelectSubdirContents(void) POSITION posn; posn = GetFirstSelectedItemPosition(); if (posn == NULL) { - WMSG0("SelectSubdirContents: nothing is selected\n"); + LOGI("SelectSubdirContents: nothing is selected"); return; } /* mark all selected items with LVIS_CUT */ @@ -996,7 +996,7 @@ ContentList::SelectSubdirContents(void) } // if (!SetItemState(i, oldState ? 0 : LVIS_SELECTED, LVIS_SELECTED)) { -// WMSG1("GLITCH: SetItemState failed on %d\n", i); +// LOGI("GLITCH: SetItemState failed on %d", i); // } } @@ -1014,7 +1014,7 @@ ContentList::SelectSubdirContents(void) void ContentList::SelectSubdir(const WCHAR* displayPrefix) { - WMSG1(" ContentList selecting all in '%ls'\n", displayPrefix); + LOGI(" ContentList selecting all in '%ls'", displayPrefix); int len = wcslen(displayPrefix); for (int i = GetItemCount()-1; i >= 0; i--) { @@ -1047,7 +1047,7 @@ ContentList::FindNext(const WCHAR* str, bool down, bool matchCase, int i, num; bool found = false; - WMSG4("FindNext '%ls' d=%d c=%d w=%d\n", str, down, matchCase, wholeWord); + LOGI("FindNext '%ls' d=%d c=%d w=%d", str, down, matchCase, wholeWord); posn = GetFirstSelectedItemPosition(); num = GetNextSelectedItem(/*ref*/ posn); @@ -1058,7 +1058,7 @@ ContentList::FindNext(const WCHAR* str, bool down, bool matchCase, num = GetItemCount(); } - WMSG1(" starting search from entry %d\n", num); + LOGI(" starting search from entry %d", num); if (down) { for (i = num+1; i < GetItemCount(); i++) { @@ -1089,12 +1089,12 @@ ContentList::FindNext(const WCHAR* str, bool down, bool matchCase, } if (found) { - WMSG1("Found, i=%d\n", i); + LOGI("Found, i=%d", i); ClearSelection(); SetItemState(i, LVIS_SELECTED, LVIS_SELECTED); EnsureVisible(i, false); } else { - WMSG0("Not found\n"); + LOGI("Not found"); MainWindow* pMain = (MainWindow*)::AfxGetMainWnd(); pMain->FailureBeep(); } diff --git a/app/ContentList.h b/app/ContentList.h index 194aa32..13b4cbb 100644 --- a/app/ContentList.h +++ b/app/ContentList.h @@ -90,12 +90,12 @@ private: // implementation relies on the top left pixel color.) void LoadHeaderImages(void) { if (!fHdrImageList.Create(IDB_HDRBAR, 16, 1, CLR_DEFAULT)) - WMSG0("GLITCH: header list create failed\n"); + LOGI("GLITCH: header list create failed"); fHdrImageList.SetBkColor(::GetSysColor(COLOR_BTNFACE)); } void LoadListImages(void) { if (!fListImageList.Create(IDB_LIST_PICS, 16, 1, CLR_DEFAULT)) - WMSG0("GLITCH: list image create failed\n"); + LOGI("GLITCH: list image create failed"); fListImageList.SetBkColor(::GetSysColor(COLOR_WINDOW)); } enum { // defs for IDB_LIST_PICS diff --git a/app/ConvDiskOptionsDialog.cpp b/app/ConvDiskOptionsDialog.cpp index 5f9c036..582428e 100644 --- a/app/ConvDiskOptionsDialog.cpp +++ b/app/ConvDiskOptionsDialog.cpp @@ -106,7 +106,7 @@ ConvDiskOptionsDialog::DoDataExchange(CDataExchange* pDX) void ConvDiskOptionsDialog::OnRadioChangeRange(UINT nID) { - WMSG1("OnChangeRange id=%d\n", nID); + LOGI("OnChangeRange id=%d", nID); CButton* pButton = (CButton*) GetDlgItem(IDC_CONVDISK_SPECIFY); CEdit* pEdit = (CEdit*) GetDlgItem(IDC_CONVDISK_SPECIFY_EDIT); @@ -138,7 +138,7 @@ ConvDiskOptionsDialog::ResetSizeControls(void) CWnd* pWnd; CString spaceReq; - WMSG0("Resetting size controls\n"); + LOGI("Resetting size controls"); spaceReq.Format(IDS_CONVDISK_SPACEREQ, "(unknown)"); pWnd = GetDlgItem(IDC_CONVDISK_SPACEREQ); ASSERT(pWnd != NULL); @@ -164,8 +164,8 @@ ConvDiskOptionsDialog::ResetSizeControls(void) void ConvDiskOptionsDialog::LimitSizeControls(long totalBlocks, long blocksUsed) { - WMSG2("LimitSizeControls %ld %ld\n", totalBlocks, blocksUsed); - WMSG1("Full volume requires %ld bitmap blocks\n", + LOGI("LimitSizeControls %ld %ld", totalBlocks, blocksUsed); + LOGI("Full volume requires %ld bitmap blocks", NewDiskSize::GetNumBitmapBlocks_ProDOS(totalBlocks)); CWnd* pWnd; @@ -254,7 +254,7 @@ ConvDiskOptionsDialog::OnCompute(void) //xferOpts.fUseSparseBlocks = // pPreferences->GetPrefBool(kPrProDOSUseSparse) != 0; - WMSG1("New volume name will be '%ls'\n", fVolName); + LOGI("New volume name will be '%ls'", fVolName); /* * Create a new disk image file. @@ -271,7 +271,7 @@ ConvDiskOptionsDialog::OnCompute(void) ShowFailureMsg(this, errStr, IDS_FAILED); return; } - WMSG1(" Will xfer to file '%ls'\n", nameBuf); + LOGI(" Will xfer to file '%ls'", nameBuf); // annoying -- DiskArchive insists on creating it (void) _wunlink(nameBuf); @@ -311,7 +311,7 @@ ConvDiskOptionsDialog::OnCompute(void) int unitSize; DIError dierr; - WMSG0("SUCCESS\n"); + LOGI("SUCCESS"); pDiskFS = ((DiskArchive*) xferOpts.fTarget)->GetDiskFS(); ASSERT(pDiskFS != NULL); @@ -328,10 +328,10 @@ ConvDiskOptionsDialog::OnCompute(void) LimitSizeControls(totalBlocks, totalBlocks - freeBlocks); } } else if (result == GenericArchive::kXferCancelled) { - WMSG0("CANCEL - cancel button hit\n"); + LOGI("CANCEL - cancel button hit"); ResetSizeControls(); } else { - WMSG1("FAILURE (result=%d)\n", result); + LOGI("FAILURE (result=%d)", result); ResetSizeControls(); } } diff --git a/app/CreateImageDialog.cpp b/app/CreateImageDialog.cpp index e56cb9f..603ecce 100644 --- a/app/CreateImageDialog.cpp +++ b/app/CreateImageDialog.cpp @@ -36,7 +36,7 @@ CreateImageDialog::OnInitDialog(void) { // high bit set in signed short means key is down if (::GetKeyState(VK_SHIFT) < 0) { - WMSG0("Shift key is down, enabling extended options\n"); + LOGI("Shift key is down, enabling extended options"); fExtendedOpts = true; } @@ -224,7 +224,7 @@ CreateImageDialog::OnFormatChangeRange(UINT nID) }; int i; - WMSG1("OnFormatChangeRange id=%d\n", nID); + LOGI("OnFormatChangeRange id=%d", nID); /* reset so 140K is highlighted */ NewDiskSize::EnableButtons_ProDOS(this, 32, 16); @@ -269,7 +269,7 @@ CreateImageDialog::OnFormatChangeRange(UINT nID) void CreateImageDialog::OnSizeChangeRange(UINT nID) { - WMSG1("OnSizeChangeRange id=%d\n", nID); + LOGI("OnSizeChangeRange id=%d", nID); CButton* pButton = (CButton*) GetDlgItem(IDC_CONVDISK_SPECIFY); CEdit* pEdit = (CEdit*) GetDlgItem(IDC_CONVDISK_SPECIFY_EDIT); diff --git a/app/DEFileDialog.cpp b/app/DEFileDialog.cpp index 8e1b8d0..13c2930 100644 --- a/app/DEFileDialog.cpp +++ b/app/DEFileDialog.cpp @@ -51,7 +51,7 @@ DEFileDialog::OnChange(void) CString str; pEdit->GetWindowText(str); - //WMSG2("STR is '%ls' (%d)\n", str, str.GetLength()); + //LOGI("STR is '%ls' (%d)", str, str.GetLength()); CWnd* pWnd = GetDlgItem(IDOK); ASSERT(pWnd != NULL); diff --git a/app/DiskArchive.cpp b/app/DiskArchive.cpp index 71354f1..d8a1b6e 100644 --- a/app/DiskArchive.cpp +++ b/app/DiskArchive.cpp @@ -186,7 +186,7 @@ DiskEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv, len = fpFile->GetDataLength(); if (len == 0) { - WMSG0("Empty fork\n"); + LOGI("Empty fork"); result = IDOK; goto bail; } else if (len < 0) { @@ -376,7 +376,7 @@ DiskEntry::GetFeatureFlag(Feature feature) const } } default: - WMSG1("Unexpected feature flag %d\n", feature); + LOGI("Unexpected feature flag %d", feature); assert(false); return false; } @@ -402,7 +402,7 @@ DiskArchive::AppInit(void) DIError dierr; long major, minor, bug; - WMSG0("Initializing DiskImg library\n"); + LOGI("Initializing DiskImg library"); // set this before initializing, so we can see init debug msgs DiskImgLib::Global::SetDebugMsgHandler(DebugMsgHandler); @@ -464,7 +464,7 @@ DiskArchive::ProgressCallback(DiskImgLib::A2FileDescr* pFile, //::Sleep(10); status = SET_PROGRESS_UPDATE(ComputePercent(current, max)); if (status == IDCANCEL) { - WMSG0("IDCANCEL returned from Main progress updater\n"); + LOGI("IDCANCEL returned from Main progress updater"); return false; } @@ -492,7 +492,7 @@ DiskArchive::ScanProgressCallback(void* cookie, const char* str, int count) cont = SET_PROGRESS_COUNTER_2(fmt, count); if (!cont) { - WMSG0("cancelled\n"); + LOGI("cancelled"); } return cont; @@ -538,7 +538,7 @@ DiskArchive::Open(const WCHAR* filename, bool readOnly, CString* pErrMsg) if (dierr == kDIErrAccessDenied && !readOnly && !isVolume) { // retry file open with read-only set // don't do that for volumes -- assume they know what they want - WMSG0(" Retrying open with read-only set\n"); + LOGI(" Retrying open with read-only set"); fIsReadOnly = readOnly = true; dierr = fDiskImg.OpenImage(filename, PathProposal::kLocalFssep, readOnly); } @@ -572,7 +572,7 @@ DiskArchive::Open(const WCHAR* filename, bool readOnly, CString* pErrMsg) imf.SetAllowGenericFormats(false); if (imf.DoModal() != IDOK) { - WMSG0("User bailed on IMF dialog\n"); + LOGI("User bailed on IMF dialog"); result = kResultCancel; goto bail; } @@ -580,7 +580,7 @@ DiskArchive::Open(const WCHAR* filename, bool readOnly, CString* pErrMsg) if (imf.fSectorOrder != fDiskImg.GetSectorOrder() || imf.fFSFormat != fDiskImg.GetFSFormat()) { - WMSG0("Initial values overridden, forcing img format\n"); + LOGI("Initial values overridden, forcing img format"); dierr = fDiskImg.OverrideFormat(fDiskImg.GetPhysicalFormat(), imf.fFSFormat, imf.fSectorOrder); if (dierr != kDIErrNone) { @@ -795,7 +795,7 @@ DiskArchive::New(const WCHAR* fileName, const void* vOptions) goto bail; } - WMSG4("DiskArchive: new '%ls' %ld %hs in '%ls'\n", + LOGI("DiskArchive: new '%ls' %ld %hs in '%ls'", (LPCWSTR) volName, numBlocks, DiskImg::ToString(pOptions->base.format), fileName); @@ -908,7 +908,7 @@ CString DiskArchive::Close(void) { if (fpPrimaryDiskFS != NULL) { - WMSG0("DiskArchive shutdown closing disk image\n"); + LOGI("DiskArchive shutdown closing disk image"); delete fpPrimaryDiskFS; fpPrimaryDiskFS = NULL; } @@ -922,7 +922,7 @@ DiskArchive::Close(void) msg.Format(L"Failed while closing disk image: %hs.", DiskImgLib::DIStrError(dierr)); failed.LoadString(IDS_FAILED); - WMSG1("During close: %ls\n", msg); + LOGI("During close: %ls", msg); pMainWin->MessageBox(msg, failed, MB_OK); } @@ -996,7 +996,7 @@ DiskArchive::LoadContents(void) { int result; - WMSG0("DiskArchive LoadContents\n"); + LOGI("DiskArchive LoadContents"); ASSERT(fpPrimaryDiskFS != NULL); { @@ -1087,8 +1087,8 @@ DiskArchive::LoadDiskFSContents(DiskFS* pDiskFS, const WCHAR* volName) wantCoerceDOSFilenames = pPreferences->GetPrefBool(kPrCoerceDOSFilenames); - WMSG2("Notes for disk image '%ls':\n%hs", - volName, pDiskFS->GetDiskImg()->GetNotes()); + LOGI("Notes for disk image '%ls':", volName); + LOGI("%hs", pDiskFS->GetDiskImg()->GetNotes()); ASSERT(pDiskFS != NULL); pFile = pDiskFS->GetNextFile(NULL); @@ -1311,9 +1311,9 @@ DiskArchive::BulkAdd(ActionProgressDialog* pActionProgress, WCHAR curDir[MAX_PATH] = L""; bool retVal = false; - WMSG2("Opts: '%ls' typePres=%d\n", (LPCWSTR) pAddOpts->fStoragePrefix, + LOGI("Opts: '%ls' typePres=%d", (LPCWSTR) pAddOpts->fStoragePrefix, pAddOpts->fTypePreservation); - WMSG3(" sub=%d strip=%d ovwr=%d\n", + LOGI(" sub=%d strip=%d ovwr=%d", pAddOpts->fIncludeSubfolders, pAddOpts->fStripFolderNames, pAddOpts->fOverwriteExisting); @@ -1331,7 +1331,7 @@ DiskArchive::BulkAdd(ActionProgressDialog* pActionProgress, * Save the current directory and change to the one from the file dialog. */ const WCHAR* buf = pAddOpts->GetFileNames(); - WMSG2("Selected path = '%ls' (offset=%d)\n", buf, + LOGI("Selected path = '%ls' (offset=%d)", buf, pAddOpts->GetFileNameOffset()); if (GetCurrentDirectory(NELEM(curDir), curDir) == 0) { @@ -1347,7 +1347,7 @@ DiskArchive::BulkAdd(ActionProgressDialog* pActionProgress, buf += pAddOpts->GetFileNameOffset(); while (*buf != '\0') { - WMSG1(" file '%ls'\n", buf); + LOGI(" file '%ls'", buf); /* add the file, calling DoAddFile via the generic AddFile */ nerr = AddFile(pAddOpts, buf, &errMsg); @@ -1440,7 +1440,7 @@ DiskArchive::DoAddFile(const AddFilesDialog* pAddOpts, int neededLen = 64; // reasonable guess char* fsNormalBuf = NULL; // name as it will appear on disk image - WMSG2(" +++ ADD file: orig='%ls' stor='%ls'\n", + LOGI(" +++ ADD file: orig='%ls' stor='%ls'", (LPCWSTR) pDetails->origName, (LPCWSTR) pDetails->storageName); retry: @@ -1491,16 +1491,16 @@ retry: goto retry; } else if (result == kNuOverwrite) { /* delete the existing file immediately */ - WMSG1(" Deleting existing file '%hs'\n", fsNormalBuf); + LOGI(" Deleting existing file '%hs'", fsNormalBuf); dierr = pDiskFS->DeleteFile(pExisting); if (dierr != kDIErrNone) { // Would be nice to show a dialog and explain *why*, but // I'm not sure we have a window here. - WMSG1(" Deletion failed (err=%d)\n", dierr); + LOGI(" Deletion failed (err=%d)", dierr); goto bail; } } else { - WMSG1("GLITCH: bad return %d from HandleReplaceExisting\n",result); + LOGI("GLITCH: bad return %d from HandleReplaceExisting",result); assert(false); nuerr = kNuErrInternal; goto bail; @@ -1518,7 +1518,7 @@ retry: goto bail; } - WMSG1("FSNormalized is '%hs'\n", pAddData->GetFSNormalPath()); + LOGI("FSNormalized is '%hs'", pAddData->GetFSNormalPath()); AddToAddDataList(pAddData); @@ -1564,7 +1564,7 @@ DiskArchive::HandleReplaceExisting(const A2File* pExisting, confOvwr.fNewFileModWhen = srcPath.GetModWhen(); if (confOvwr.DoModal() == IDCANCEL) { - WMSG0("User cancelled out of add-to-diskimg replace-existing\n"); + LOGI("User cancelled out of add-to-diskimg replace-existing"); return kNuAbort; } @@ -1583,7 +1583,7 @@ DiskArchive::HandleReplaceExisting(const A2File* pExisting, * allow the FS normalizer to force the filename to be valid. */ pDetails->storageName = confOvwr.fExistingFile; - WMSG1("Trying rename to '%ls'\n", (LPCWSTR) pDetails->storageName); + LOGI("Trying rename to '%ls'", (LPCWSTR) pDetails->storageName); return kNuRename; } @@ -1618,7 +1618,7 @@ DiskArchive::ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL) long dataLen, rsrcLen; MainWindow* pMainWin = (MainWindow*)::AfxGetMainWnd(); - WMSG0("--- ProcessFileAddData\n"); + LOGI("--- ProcessFileAddData"); /* map the EOL conversion to something we can use */ GenericEntry::ConvertEOL convEOL; @@ -1695,7 +1695,7 @@ DiskArchive::ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL) } } - WMSG2("Adding file '%ls' (%hs)\n", + LOGI("Adding file '%ls' (%hs)", (LPCWSTR) pDetails->storageName, typeStr); ASSERT(pDataDetails != NULL || pRsrcDetails != NULL); @@ -1724,7 +1724,7 @@ DiskArchive::ProcessFileAddData(DiskFS* pDiskFS, int addOptsConvEOL) if (pDataDetails->fileType == kFileTypeTXT || pDataDetails->fileType == kFileTypeSRC) { - WMSG0("Enabling text conversion by type\n"); + LOGI("Enabling text conversion by type"); convEOL = GenericEntry::kConvertEOLOn; } else { convEOL = GenericEntry::kConvertEOLOff; @@ -1871,12 +1871,12 @@ DiskArchive::LoadFile(const WCHAR* pathName, BYTE** pBuf, long* pLen, conv = GenericEntry::DetermineConversion(*pBuf, chunkLen, &eolType, &dummy); - WMSG2("LoadFile DetermineConv returned conv=%d eolType=%d\n", + LOGI("LoadFile DetermineConv returned conv=%d eolType=%d", conv, eolType); if (conv == GenericEntry::kConvertEOLOn && eolType == GenericEntry::kEOLCR) { - WMSG0(" (skipping conversion due to matching eolType)\n"); + LOGI(" (skipping conversion due to matching eolType)"); conv = GenericEntry::kConvertEOLOff; } } @@ -1891,7 +1891,7 @@ DiskArchive::LoadFile(const WCHAR* pathName, BYTE** pBuf, long* pLen, */ if (conv == GenericEntry::kConvertEOLOff) { /* fast path */ - WMSG1(" +++ NOT converting text '%ls'\n", pathName); + LOGI(" +++ NOT converting text '%ls'", pathName); if (fread(*pBuf, fileLen, 1, fp) != 1) { errMsg.Format(L"Unable to read '%ls': %hs.", pathName, strerror(errno)); delete[] *pBuf; @@ -1919,7 +1919,7 @@ DiskArchive::LoadFile(const WCHAR* pathName, BYTE** pBuf, long* pLen, else mask = 0x00; - WMSG2(" +++ Converting text '%ls', mask=0x%02x\n", pathName, mask); + LOGI(" +++ Converting text '%ls', mask=0x%02x", pathName, mask); while (count--) { ic = getc(fp); @@ -2028,7 +2028,7 @@ DiskArchive::AddForksToDisk(DiskFS* pDiskFS, const DiskFS::CreateParms* pParms, dierr = kDIErrNone; // dirs are not made unique goto bail; } else { - WMSG0(" Ignoring subdir create req on non-hierarchic FS\n"); + LOGI(" Ignoring subdir create req on non-hierarchic FS"); goto bail; } } @@ -2041,7 +2041,7 @@ DiskArchive::AddForksToDisk(DiskFS* pDiskFS, const DiskFS::CreateParms* pParms, if (dataLen < 0) { /* this was a resource-fork-only file */ - WMSG1("--- nothing left to write for '%hs'\n", + LOGI("--- nothing left to write for '%hs'", parmCopy.pathName); goto bail; } @@ -2058,7 +2058,7 @@ DiskArchive::AddForksToDisk(DiskFS* pDiskFS, const DiskFS::CreateParms* pParms, parmCopy.fileType == kFileTypeINT || parmCopy.fileType == kFileTypeBAS) { - WMSG0("+++ switching DOS file type to $f2\n"); + LOGI("+++ switching DOS file type to $f2"); parmCopy.fileType = 0xf2; // DOS 'S' file } } @@ -2075,7 +2075,7 @@ DiskArchive::AddForksToDisk(DiskFS* pDiskFS, const DiskFS::CreateParms* pParms, */ dierr = pDiskFS->CreateFile(&parmCopy, &pNewFile); if (dierr != kDIErrNone) { - WMSG1(" CreateFile failed: %hs\n", DiskImgLib::DIStrError(dierr)); + LOGI(" CreateFile failed: %hs", DiskImgLib::DIStrError(dierr)); goto bail; } @@ -2143,7 +2143,7 @@ bail: * erase any subdirectories that were created to contain this file. * Not worth worrying about. */ - WMSG1(" Deleting newly-created file '%hs'\n", parmCopy.pathName); + LOGI(" Deleting newly-created file '%hs'", parmCopy.pathName); (void) pDiskFS->DeleteFile(pNewFile); } return dierr; @@ -2193,7 +2193,7 @@ DiskArchive::AddToAddDataList(FileAddData* pData) * 1000 in almost all cases). */ //if (strcasecmp(pData->GetDetails()->storageName, "system\\finder") == 0) - // WMSG0("whee\n"); + // LOGI("whee"); FileAddData* pSearch = fpAddDataHead; FileDetails::FileKind dataKind, listKind; @@ -2214,7 +2214,7 @@ DiskArchive::AddToAddDataList(FileAddData* pData) (listKind == FileDetails::kFileKindDataFork || listKind == FileDetails::kFileKindRsrcFork)) { /* looks good, hook it in here instead of the list */ - WMSG2("--- connecting forks of '%ls' and '%ls'\n", + LOGI("--- connecting forks of '%ls' and '%ls'", pData->GetDetails()->origName, pSearch->GetDetails()->origName); pSearch->SetOtherFork(pData); @@ -2384,7 +2384,7 @@ DiskArchive::DeleteSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) ASSERT(pEntry != NULL); entryArray[idx++] = pEntry; - WMSG2("Added 0x%08lx '%ls'\n", (long) entryArray[idx-1], + LOGI("Added 0x%08lx '%ls'", (long) entryArray[idx-1], (LPCWSTR) entryArray[idx-1]->GetDisplayName()); pSelEntry = pSelSet->IterNext(); @@ -2419,7 +2419,7 @@ DiskArchive::DeleteSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) goto bail; } - WMSG2(" Deleting '%ls' from '%hs'\n", (LPCWSTR) pEntry->GetPathName(), + LOGI(" Deleting '%ls' from '%hs'", (LPCWSTR) pEntry->GetPathName(), (LPCSTR) pFile->GetDiskFS()->GetVolumeName()); SET_PROGRESS_UPDATE2(0, pEntry->GetPathName(), NULL); @@ -2484,7 +2484,7 @@ DiskArchive::RenameSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) CString errMsg; bool retVal = false; - WMSG1("Renaming %d entries\n", pSelSet->GetNumEntries()); + LOGI("Renaming %d entries", pSelSet->GetNumEntries()); /* * For each item in the selection set, bring up the "rename" dialog, @@ -2500,7 +2500,7 @@ DiskArchive::RenameSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) RenameEntryDialog renameDlg(pMsgWnd); DiskEntry* pEntry = (DiskEntry*) pSelEntry->GetEntry(); - WMSG1(" Renaming '%ls'\n", pEntry->GetPathName()); + LOGI(" Renaming '%ls'", pEntry->GetPathName()); if (!SetRenameFields(pMsgWnd, pEntry, &renameDlg)) break; @@ -2525,14 +2525,14 @@ DiskArchive::RenameSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED); goto bail; } - WMSG2("Rename of '%ls' to '%ls' succeeded\n", + LOGI("Rename of '%ls' to '%ls' succeeded", pEntry->GetDisplayName(), renameDlg.fNewName); } else if (result == IDCANCEL) { - WMSG0("Canceling out of remaining renames\n"); + LOGI("Canceling out of remaining renames"); break; } else { /* 3rd possibility is IDIGNORE, i.e. skip this entry */ - WMSG1("Skipping rename of '%ls'\n", pEntry->GetDisplayName()); + LOGI("Skipping rename of '%ls'", pEntry->GetDisplayName()); } pSelEntry = pSelSet->IterNext(); @@ -2782,7 +2782,7 @@ DiskArchive::SetProps(CWnd* pMsgWnd, GenericEntry* pGenericEntry, DiskImg::FSFormat fsFormat; fsFormat = pFile->GetDiskFS()->GetDiskImg()->GetFSFormat(); if (fsFormat == DiskImg::kFormatDOS32 || fsFormat == DiskImg::kFormatDOS33) { - WMSG0(" (reloading additional fields after DOS SFI)\n"); + LOGI(" (reloading additional fields after DOS SFI)"); pEntry->SetDataForkLen(pFile->GetDataLength()); pEntry->SetCompressedLen(pFile->GetDataSparseLength()); pEntry->SetSuspicious(pFile->GetQuality() == A2File::kQualitySuspicious); @@ -2815,7 +2815,7 @@ GenericArchive::XferStatus DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, ActionProgressDialog* pActionProgress, const XferFileOptions* pXferOpts) { - WMSG0("DiskArchive XferSelection!\n"); + LOGI("DiskArchive XferSelection!"); unsigned char* dataBuf = NULL; unsigned char* rsrcBuf = NULL; FileDetails fileDetails; @@ -2836,7 +2836,7 @@ DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, ASSERT(rsrcBuf == NULL); if (pEntry->GetDamaged()) { - WMSG1(" XFER skipping damaged entry '%ls'\n", + LOGI(" XFER skipping damaged entry '%ls'", pEntry->GetDisplayName()); continue; } @@ -2860,7 +2860,7 @@ DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, if (pEntry->GetRecordKind() == GenericEntry::kRecordKindVolumeDir) { /* this is the volume dir */ - WMSG1(" XFER not transferring volume dir '%ls'\n", + LOGI(" XFER not transferring volume dir '%ls'", (LPCWSTR) fixedPathName); continue; } else if (pEntry->GetRecordKind() == GenericEntry::kRecordKindDirectory) { @@ -2870,7 +2870,7 @@ DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, cmpStr += (char)PathProposal::kDefaultStoredFssep; if (pSelSet->CountMatchingPrefix(cmpStr) == 0) { - WMSG1("FOUND empty dir '%ls'\n", (LPCWSTR) fixedPathName); + LOGI("FOUND empty dir '%ls'", (LPCWSTR) fixedPathName); cmpStr += kEmptyFolderMarker; dataBuf = new unsigned char[1]; dataLen = 0; @@ -2881,16 +2881,16 @@ DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, pEntry->GetAccess() | GenericEntry::kAccessInvisible; goto have_stuff2; } else { - WMSG1("NOT empty dir '%ls'\n", (LPCWSTR) fixedPathName); + LOGI("NOT empty dir '%ls'", (LPCWSTR) fixedPathName); } } - WMSG1(" XFER not transferring directory '%ls'\n", + LOGI(" XFER not transferring directory '%ls'", (LPCWSTR) fixedPathName); continue; } - WMSG3(" Xfer '%ls' (data=%d rsrc=%d)\n", + LOGI(" Xfer '%ls' (data=%d rsrc=%d)", (LPCWSTR) fixedPathName, pEntry->GetHasDataFork(), pEntry->GetHasRsrcFork()); @@ -2899,7 +2899,7 @@ DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, result = pEntry->ExtractThreadToBuffer(GenericEntry::kDataThread, (char**) &dataBuf, &dataLen, &extractErrMsg); if (result == IDCANCEL) { - WMSG0("Cancelled during data extract!\n"); + LOGI("Cancelled during data extract!"); goto bail; /* abort anything that was pending */ } else if (result != IDOK) { errMsg.Format(L"Failed while extracting '%ls': %ls.", @@ -2919,7 +2919,7 @@ DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, long len; unsigned char* ucp; - WMSG1(" Converting DOS text in '%ls'\n", fixedPathName); + LOGI(" Converting DOS text in '%ls'", fixedPathName); for (ucp = dataBuf, len = dataLen; len > 0; len--, ucp++) *ucp = *ucp & 0x7f; } @@ -2930,7 +2930,7 @@ DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, pEntry->GetFSFormat() == DiskImg::kFormatPascal && pEntry->GetFileType() == kFileTypePTX) { - WMSG1("WOULD CONVERT ptx '%ls'\n", fixedPathName); + LOGI("WOULD CONVERT ptx '%ls'", fixedPathName); } #endif @@ -2940,7 +2940,7 @@ DiskArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, result = pEntry->ExtractThreadToBuffer(GenericEntry::kRsrcThread, (char**) &rsrcBuf, &rsrcLen, &extractErrMsg); if (result == IDCANCEL) { - WMSG0("Cancelled during rsrc extract!\n"); + LOGI("Cancelled during rsrc extract!"); goto bail; /* abort anything that was pending */ } else if (result != IDOK) { errMsg.Format(L"Failed while extracting '%ls': %ls.", @@ -2992,7 +2992,7 @@ have_stuff2: errMsg = pXferOpts->fTarget->XferFile(&fileDetails, &dataBuf, dataLen, &rsrcBuf, rsrcLen); if (!errMsg.IsEmpty()) { - WMSG0("XferFile failed!\n"); + LOGI("XferFile failed!"); errMsg.Format(L"Failed while transferring '%ls': %ls.", (LPCWSTR) pEntry->GetDisplayName(), (LPCWSTR) errMsg); ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED); @@ -3029,7 +3029,7 @@ bail: void DiskArchive::XferPrepare(const XferFileOptions* pXferOpts) { - WMSG0("DiskArchive::XferPrepare\n"); + LOGI("DiskArchive::XferPrepare"); //fpPrimaryDiskFS->SetParameter(DiskFS::kParmProDOS_AllowLowerCase, // pXferOpts->fAllowLowerCase); @@ -3064,7 +3064,7 @@ DiskArchive::XferFile(FileDetails* pDetails, BYTE** pDataBuf, CString errMsg; DIError dierr = kDIErrNone; - WMSG3(" XFER: transfer '%ls' (dataLen=%ld rsrcLen=%ld)\n", + LOGI(" XFER: transfer '%ls' (dataLen=%ld rsrcLen=%ld)", pDetails->storageName, dataLen, rsrcLen); ASSERT(pDataBuf != NULL); @@ -3097,12 +3097,12 @@ DiskArchive::XferFile(FileDetails* pDetails, BYTE** pDataBuf, long len = dataLen; if (srcIsDOS && !dstIsDOS) { - WMSG1(" Stripping high ASCII from '%ls'\n", pDetails->storageName); + LOGI(" Stripping high ASCII from '%ls'", pDetails->storageName); while (len--) *ucp++ &= 0x7f; } else if (!srcIsDOS && dstIsDOS) { - WMSG1(" Adding high ASCII to '%ls'\n", pDetails->storageName); + LOGI(" Adding high ASCII to '%ls'", pDetails->storageName); while (len--) { if (*ucp != '\0') @@ -3110,10 +3110,10 @@ DiskArchive::XferFile(FileDetails* pDetails, BYTE** pDataBuf, ucp++; } } else if (srcIsDOS && dstIsDOS) { - WMSG1(" --- not altering DOS-to-DOS text '%ls'\n", + LOGI(" --- not altering DOS-to-DOS text '%ls'", pDetails->storageName); } else { - WMSG1(" --- non-DOS transfer '%ls'\n", pDetails->storageName); + LOGI(" --- non-DOS transfer '%ls'", pDetails->storageName); } } @@ -3150,7 +3150,7 @@ bail: void DiskArchive::XferAbort(CWnd* pMsgWnd) { - WMSG0("DiskArchive::XferAbort\n"); + LOGI("DiskArchive::XferAbort"); InternalReload(pMsgWnd); } @@ -3160,6 +3160,6 @@ DiskArchive::XferAbort(CWnd* pMsgWnd) void DiskArchive::XferFinish(CWnd* pMsgWnd) { - WMSG0("DiskArchive::XferFinish\n"); + LOGI("DiskArchive::XferFinish"); InternalReload(pMsgWnd); } diff --git a/app/DiskConvertDialog.cpp b/app/DiskConvertDialog.cpp index c92ad02..92ab535 100644 --- a/app/DiskConvertDialog.cpp +++ b/app/DiskConvertDialog.cpp @@ -102,7 +102,7 @@ DiskConvertDialog::Init(const DiskImg* pDiskImg) } else if (pDiskImg->GetPhysicalFormat() == DiskImg::kPhysicalFormatNib525_6384) { /* don't currently allow .nb2 output */ - WMSG0(" GLITCH: we don't allow self-convert of .nb2 files\n"); + LOGI(" GLITCH: we don't allow self-convert of .nb2 files"); ASSERT(false); } else { /* this should be impossible */ @@ -260,7 +260,7 @@ DiskConvertDialog::DoDataExchange(CDataExchange* pDX) fExtension += L".gz"; } - WMSG1(" DCD recommending extension '%ls'\n", (LPCWSTR) fExtension); + LOGI(" DCD recommending extension '%ls'", (LPCWSTR) fExtension); } } diff --git a/app/DiskEditDialog.cpp b/app/DiskEditDialog.cpp index f54c98e..19c629f 100644 --- a/app/DiskEditDialog.cpp +++ b/app/DiskEditDialog.cpp @@ -87,7 +87,7 @@ DiskEditDialog::OnInitDialog(void) cf.yHeight = 10 * 20; // point size in twips BOOL cc = pEdit->SetDefaultCharFormat(cf); if (cc == FALSE) { - WMSG0("SetDefaultCharFormat failed?\n"); + LOGI("SetDefaultCharFormat failed?"); ASSERT(FALSE); } @@ -164,7 +164,7 @@ DiskEditDialog::InitNibbleParmList(void) pTable = pDiskImg->GetNibbleDescrTable(&count); if (pTable == NULL || count <= 0) { - WMSG2("WHOOPS: nibble parm got table=0x%08lx, count=%d\n", + LOGI("WHOOPS: nibble parm got table=0x%08lx, count=%d", (long) pTable, count); return; } @@ -175,14 +175,14 @@ DiskEditDialog::InitNibbleParmList(void) if (pCurrent != NULL) { for (i = 0; i < count; i++) { if (memcmp(&pTable[i], pCurrent, sizeof(*pCurrent)) == 0) { - WMSG1(" NibbleParm match on entry %d\n", i); + LOGI(" NibbleParm match on entry %d", i); dflt = i; break; } } if (dflt == -1) { - WMSG0(" GLITCH: no match on nibble descr in table?!\n"); + LOGI(" GLITCH: no match on nibble descr in table?!"); dflt = 0; } } @@ -240,7 +240,7 @@ DiskEditDialog::PreTranslateMessage(MSG* pMsg) if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN) { - //WMSG0("RETURN!\n"); + //LOGI("RETURN!"); LoadData(); return TRUE; } @@ -255,7 +255,7 @@ DiskEditDialog::PreTranslateMessage(MSG* pMsg) BOOL DiskEditDialog::OnHelpInfo(HELPINFO* lpHelpInfo) { - WMSG4("HELP: size=%d contextType=%d ctrlID=0x%x contextID=0x%08lx\n", + LOGI("HELP: size=%d contextType=%d ctrlID=0x%x contextID=0x%08lx", lpHelpInfo->cbSize, lpHelpInfo->iContextType, lpHelpInfo->iCtrlId, lpHelpInfo->dwContextId); @@ -292,7 +292,7 @@ DiskEditDialog::OnHelp(void) void DiskEditDialog::OnDone(void) { - WMSG0("DiskEditDialog OnDone\n"); + LOGI("DiskEditDialog OnDone"); EndDialog(IDOK); } @@ -327,7 +327,7 @@ DiskEditDialog::OnSubVolume(void) subv.Setup(fpDiskFS); if (subv.DoModal() == IDOK) { - WMSG1("SELECTED subv %d\n", subv.fListBoxIndex); + LOGI("SELECTED subv %d", subv.fListBoxIndex); DiskFS::SubVolume* pSubVol = fpDiskFS->GetNextSubVolume(NULL); if (pSubVol == NULL) return; @@ -369,13 +369,13 @@ DiskEditDialog::SetSpinMode(int id, int base) MySpinCtrl* pSpin = (MySpinCtrl*) GetDlgItem(id); if (pSpin == NULL) { // expected behavior in "block" mode for sector button - WMSG1("Couldn't find spin button %d\n", id); + LOGI("Couldn't find spin button %d", id); return; } long val = pSpin->GetPos(); if (val & 0xff000000) { - WMSG0("NOTE: hex transition while value is invalid\n"); + LOGI("NOTE: hex transition while value is invalid"); val = 0; } @@ -386,7 +386,7 @@ DiskEditDialog::SetSpinMode(int id, int base) pSpin->SetBase(base); pSpin->GetBuddy()->SetWindowText(valStr); - WMSG2("Set spin button base to %d val=%d\n", base, val); + LOGI("Set spin button base to %d val=%d", base, val); } /* @@ -610,7 +610,7 @@ DiskEditDialog::OpenFile(const WCHAR* fileName, bool openRsrc, A2File** ppFile, A2File* pFile; A2FileDescr* pOpenFile = NULL; - WMSG2(" OpenFile '%ls' rsrc=%d\n", fileName, openRsrc); + LOGI(" OpenFile '%ls' rsrc=%d", fileName, openRsrc); CStringA fileNameA(fileName); pFile = fpDiskFS->GetFileByName(fileNameA); if (pFile == NULL) { @@ -663,7 +663,7 @@ DiskEditDialog::OnNibbleParms(void) if (sel == CB_ERR) return; - WMSG1(" OnNibbleParms: entry %d now selected\n", sel); + LOGI(" OnNibbleParms: entry %d now selected", sel); const DiskImg::NibbleDescr* pNibbleTable; int count; pNibbleTable = pDiskImg->GetNibbleDescrTable(&count); @@ -755,7 +755,7 @@ SectorEditDialog::OnInitDialog(void) int SectorEditDialog::LoadData(void) { - //WMSG0("SED LoadData\n"); + //LOGI("SED LoadData"); ASSERT(fpDiskFS != NULL); ASSERT(fpDiskFS->GetDiskImg() != NULL); @@ -764,13 +764,13 @@ SectorEditDialog::LoadData(void) if (ReadSpinner(IDC_DISKEDIT_SECTORSPIN, &fSector) != 0) return -1; - WMSG2("LoadData reading t=%d s=%d\n", fTrack, fSector); + LOGI("LoadData reading t=%d s=%d", fTrack, fSector); fAlertMsg = ""; DIError dierr; dierr = fpDiskFS->GetDiskImg()->ReadTrackSector(fTrack, fSector, fSectorData); if (dierr != kDIErrNone) { - WMSG1("SED sector read failed: %hs\n", DiskImgLib::DIStrError(dierr)); + LOGI("SED sector read failed: %hs", DiskImgLib::DIStrError(dierr)); //CString msg; //CString err; //err.LoadString(IDS_ERROR); @@ -945,10 +945,10 @@ SectorFileEditDialog::LoadData(void) ASSERT(fpDiskFS->GetDiskImg() != NULL); DIError dierr; - WMSG1("SFED LoadData reading index=%d\n", fSectorIdx); + LOGI("SFED LoadData reading index=%d", fSectorIdx); #if 0 - WMSG1("LoadData reading offset=%d\n", fOffset); + LOGI("LoadData reading offset=%d", fOffset); size_t actual = 0; dierr = fpFile->Seek(fOffset, EmbeddedFD::kSeekSet); if (dierr == kDIErrNone) { @@ -964,7 +964,7 @@ SectorFileEditDialog::LoadData(void) } if (actual != kSectorSize) { - WMSG1(" SFED partial read of %d bytes\n", actual); + LOGI(" SFED partial read of %d bytes", actual); ASSERT(actual < kSectorSize && actual >= 0); } @@ -996,11 +996,11 @@ SectorFileEditDialog::LoadData(void) return -1; } else { if (fTrack == 0 && fSector == 0) { - WMSG0("LoadData Sparse sector\n"); + LOGI("LoadData Sparse sector"); //FillWithPattern(fSectorData, sizeof(fSectorData), _T("SPARSE ")); fAlertMsg.Format(IDS_DISKEDITMSG_SPARSE, fSectorIdx); } else { - WMSG2("LoadData reading T=%d S=%d\n", fTrack, fSector); + LOGI("LoadData reading T=%d S=%d", fTrack, fSector); dierr = fpDiskFS->GetDiskImg()->ReadTrackSector(fTrack, fSector, fSectorData); @@ -1142,7 +1142,7 @@ BlockEditDialog::OnInitDialog(void) /* give us something to look at */ if (LoadData() != 0) { - WMSG0("WHOOPS: LoadData() failed, but we're in OnInitDialog\n"); + LOGI("WHOOPS: LoadData() failed, but we're in OnInitDialog"); } return TRUE; @@ -1179,20 +1179,20 @@ BlockEditDialog::MoveControl(int id, int deltaX, int deltaY) int BlockEditDialog::LoadData(void) { - //WMSG0("BED LoadData\n"); + //LOGI("BED LoadData"); ASSERT(fpDiskFS != NULL); ASSERT(fpDiskFS->GetDiskImg() != NULL); if (ReadSpinner(IDC_DISKEDIT_TRACKSPIN, &fBlock) != 0) return -1; - WMSG1("LoadData reading block=%d\n", fBlock); + LOGI("LoadData reading block=%d", fBlock); fAlertMsg = ""; DIError dierr; dierr = fpDiskFS->GetDiskImg()->ReadBlock(fBlock, fBlockData); if (dierr != kDIErrNone) { - WMSG1("BED block read failed: %hs\n", DiskImgLib::DIStrError(dierr)); + LOGI("BED block read failed: %hs", DiskImgLib::DIStrError(dierr)); //CString msg; //CString err; //err.LoadString(IDS_ERROR); @@ -1343,10 +1343,10 @@ BlockFileEditDialog::LoadData(void) ASSERT(fpDiskFS->GetDiskImg() != NULL); DIError dierr; - WMSG1("BFED LoadData reading index=%d\n", fBlockIdx); + LOGI("BFED LoadData reading index=%d", fBlockIdx); #if 0 - WMSG1("LoadData reading offset=%d\n", fOffset); + LOGI("LoadData reading offset=%d", fOffset); size_t actual = 0; dierr = fpFile->Seek(fOffset, EmbeddedFD::kSeekSet); if (dierr == kDIErrNone) { @@ -1362,7 +1362,7 @@ BlockFileEditDialog::LoadData(void) } if (actual != kBlockSize) { - WMSG1(" BFED partial read of %d bytes\n", actual); + LOGI(" BFED partial read of %d bytes", actual); ASSERT(actual < kBlockSize && actual >= 0); } @@ -1393,11 +1393,11 @@ BlockFileEditDialog::LoadData(void) return -1; } else { if (fBlock == 0) { - WMSG0("LoadData Sparse block\n"); + LOGI("LoadData Sparse block"); //FillWithPattern(fBlockData, sizeof(fBlockData), _T("SPARSE ")); fAlertMsg.Format(IDS_DISKEDITMSG_SPARSE, fBlockIdx); } else { - WMSG1("LoadData reading B=%d\n", fBlock); + LOGI("LoadData reading B=%d", fBlock); dierr = fpDiskFS->GetDiskImg()->ReadBlock(fBlock, fBlockData); if (dierr != kDIErrNone) { @@ -1572,21 +1572,21 @@ NibbleEditDialog::OnInitDialog(void) int NibbleEditDialog::LoadData(void) { - //WMSG0("BED LoadData\n"); + //LOGI("BED LoadData"); ASSERT(fpDiskFS != NULL); ASSERT(fpDiskFS->GetDiskImg() != NULL); if (ReadSpinner(IDC_DISKEDIT_TRACKSPIN, &fTrack) != 0) return -1; - WMSG1("LoadData reading track=%d\n", fTrack); + LOGI("LoadData reading track=%d", fTrack); fAlertMsg = ""; DIError dierr; dierr = fpDiskFS->GetDiskImg()->ReadNibbleTrack(fTrack, fNibbleData, &fNibbleDataLen); if (dierr != kDIErrNone) { - WMSG1("NED track read failed: %hs\n", DiskImgLib::DIStrError(dierr)); + LOGI("NED track read failed: %hs", DiskImgLib::DIStrError(dierr)); fAlertMsg.LoadString(IDS_DISKEDITMSG_BADTRACK); } diff --git a/app/DiskFSTree.cpp b/app/DiskFSTree.cpp index cad904c..28adaec 100644 --- a/app/DiskFSTree.cpp +++ b/app/DiskFSTree.cpp @@ -70,7 +70,7 @@ DiskFSTree::AddDiskFS(CTreeCtrl* pTree, HTREEITEM parent, tvins.hParent = parent; hLocalRoot = pTree->InsertItem(&tvins); if (hLocalRoot == NULL) { - WMSG0("Tree root InsertItem failed\n"); + LOGI("Tree root InsertItem failed"); return false; } @@ -182,7 +182,7 @@ DiskFSTree::AddSubdir(CTreeCtrl* pTree, HTREEITEM parent, tvins.hParent = parent; hLocalRoot = pTree->InsertItem(&tvins); if (hLocalRoot == NULL) { - WMSG1("Tree insert '%ls' failed\n", tvi.pszText); + LOGI("Tree insert '%ls' failed", tvi.pszText); return NULL; } } diff --git a/app/DiskFSTree.h b/app/DiskFSTree.h index b615936..cabdeee 100644 --- a/app/DiskFSTree.h +++ b/app/DiskFSTree.h @@ -63,7 +63,7 @@ private: void LoadTreeImages(void) { if (!fTreeImageList.Create(IDB_TREE_PICS, 16, 1, CLR_DEFAULT)) - WMSG0("GLITCH: list image create failed\n"); + LOGI("GLITCH: list image create failed"); fTreeImageList.SetBkColor(::GetSysColor(COLOR_WINDOW)); } enum { // defs for IDB_TREE_PICS diff --git a/app/EditAssocDialog.cpp b/app/EditAssocDialog.cpp index e7eedb3..352efef 100644 --- a/app/EditAssocDialog.cpp +++ b/app/EditAssocDialog.cpp @@ -70,7 +70,7 @@ EditAssocDialog::OnInitDialog(void) void EditAssocDialog::Setup(bool loadAssoc) { - WMSG0("Setup!\n"); + LOGI("Setup!"); CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_ASSOCIATION_LIST); ASSERT(pListView != NULL); diff --git a/app/EditPropsDialog.cpp b/app/EditPropsDialog.cpp index fd2d285..047a971 100644 --- a/app/EditPropsDialog.cpp +++ b/app/EditPropsDialog.cpp @@ -142,7 +142,7 @@ EditPropsDialog::OnInitDialog(void) ASSERT(pWnd != NULL); FormatDate(fProps.modWhen, &dateStr); pWnd->SetWindowText(dateStr); - //WMSG2("USING DATE '%ls' from 0x%08lx\n", dateStr, fProps.modWhen); + //LOGI("USING DATE '%ls' from 0x%08lx", dateStr, fProps.modWhen); CEdit* pEdit = (CEdit*) GetDlgItem(IDC_PROPS_AUXTYPE); ASSERT(pEdit != NULL); @@ -409,7 +409,7 @@ EditPropsDialog::UpdateHFSMode(void) if (pButton->GetCheck() == BST_CHECKED) { /* switch to HFS mode */ - WMSG0("Switching to HFS mode\n"); + LOGI("Switching to HFS mode"); //fHFSMode = true; pWnd = GetDlgItem(IDC_PROPS_HFS_FILETYPE); @@ -432,7 +432,7 @@ EditPropsDialog::UpdateHFSMode(void) OnHFSTypeChange(); } else { /* switch to ProDOS mode */ - WMSG0("Switching to ProDOS mode\n"); + LOGI("Switching to ProDOS mode"); //fHFSMode = false; pCombo = (CComboBox*) GetDlgItem(IDC_PROPS_FILETYPE); pCombo->EnableWindow(TRUE); @@ -493,12 +493,12 @@ EditPropsDialog::GetAuxType(void) long val; if (str[0] == '\0') { - WMSG0(" HEY: blank aux type, returning -1\n"); + LOGI(" HEY: blank aux type, returning -1"); return -1; } val = wcstoul(aux, &end, 16); if (end != str + wcslen(str)) { - WMSG1(" HEY: found some garbage in aux type '%ls', returning -1\n", + LOGI(" HEY: found some garbage in aux type '%ls', returning -1", (LPCWSTR) aux); return -1; } diff --git a/app/EnterRegDialog.cpp b/app/EnterRegDialog.cpp index 5c566a4..f1d03a7 100644 --- a/app/EnterRegDialog.cpp +++ b/app/EnterRegDialog.cpp @@ -68,10 +68,10 @@ EnterRegDialog::DoDataExchange(CDataExchange* pDX) if (gMyApp.fRegistry.IsValidRegistrationKey(fUserName, fCompanyName, fRegKey)) { - WMSG3("Correct key entered: '%ls' '%ls' '%ls'\n", + LOGI("Correct key entered: '%ls' '%ls' '%ls'", (LPCTSTR)fUserName, (LPCTSTR)fCompanyName, (LPCTSTR)fRegKey); } else { - WMSG0("Incorrect key entered, rejecting\n"); + LOGI("Incorrect key entered, rejecting"); CString appName, msg; appName.LoadString(IDS_MB_APP_NAME); msg.LoadString(IDS_REG_BAD_ENTRY); diff --git a/app/ExtractOptionsDialog.cpp b/app/ExtractOptionsDialog.cpp index 0edcd4c..5952cfe 100644 --- a/app/ExtractOptionsDialog.cpp +++ b/app/ExtractOptionsDialog.cpp @@ -182,7 +182,7 @@ ExtractOptionsDialog::OnChooseFolder(void) chooseDir.SetPathName(editPath); if (chooseDir.DoModal() == IDOK) { const WCHAR* ccp = chooseDir.GetPathName(); - WMSG1("New extract path chosen = '%ls'\n", ccp); + LOGI("New extract path chosen = '%ls'", ccp); pEditWnd->SetWindowText(ccp); } diff --git a/app/ExtractOptionsDialog.h b/app/ExtractOptionsDialog.h index c004ff9..9fd6b36 100644 --- a/app/ExtractOptionsDialog.h +++ b/app/ExtractOptionsDialog.h @@ -31,7 +31,7 @@ public: fOverwriteExisting = FALSE; } virtual ~ExtractOptionsDialog(void) { - //WMSG0("~ExtractOptionsDialog()\n"); + //LOGI("~ExtractOptionsDialog()"); } CString fExtractPath; diff --git a/app/FileNameConv.cpp b/app/FileNameConv.cpp index eaca537..0876b19 100644 --- a/app/FileNameConv.cpp +++ b/app/FileNameConv.cpp @@ -660,7 +660,7 @@ PathProposal::ArchiveToLocal(void) endp = wcschr(startp, fStoredFssep); if (endp != NULL && endp == startp) { /* zero-length subdir component */ - WMSG1("WARNING: zero-length subdir component in '%ls'\n", startp); + LOGI("WARNING: zero-length subdir component in '%ls'", startp); startp++; continue; } @@ -759,7 +759,7 @@ PathProposal::Win32NormalizeFileName(const WCHAR* srcp, long srcLen, if (wcsnicmp(srcp, *ppcch, 3) == 0 && (srcp[3] == '.' || srcLen == 3)) { - WMSG1("--- fixing '%ls'\n", *ppcch); + LOGI("--- fixing '%ls'", *ppcch); if (fPreservation) { *dstp++ = kForeignIndic; *dstp++ = '0'; @@ -777,7 +777,7 @@ PathProposal::Win32NormalizeFileName(const WCHAR* srcp, long srcLen, if (wcsnicmp(srcp, *ppcch, 4) == 0 && (srcp[4] == '.' || srcLen == 4)) { - WMSG1("--- fixing '%ls'\n", *ppcch); + LOGI("--- fixing '%ls'", *ppcch); if (fPreservation) { *dstp++ = kForeignIndic; *dstp++ = '0'; @@ -992,7 +992,7 @@ PathProposal::AddTypeExtension(const WCHAR* pathBuf, WCHAR* extBuf) } /* if '#' appears in it, don't use it -- it'll confuse us */ - //WMSG2("LOOKING FOR '%c' in '%ls'\n", kPreserveIndic, ccp); + //LOGI("LOOKING FOR '%c' in '%ls'", kPreserveIndic, ccp); const WCHAR* ccp = pWantedExt; while (*ccp != '\0') { if (*ccp == kPreserveIndic) { @@ -1134,7 +1134,7 @@ PathProposal::LocalToArchive(const AddFilesDialog* pAddOpts) if ((livePathStr[0] == '.' && livePathStr[1] == '.') || (wcsstr(livePathStr, slashDotDotSlash) != NULL)) { - WMSG1("Found dot dot in '%ls', keeping only filename\n", livePathStr); + LOGI("Found dot dot in '%ls', keeping only filename", livePathStr); doJunk = true; } @@ -1423,7 +1423,7 @@ PathProposal::StripDiskImageSuffix(WCHAR* pathName) for (i = 0; i < NELEM(diskExt); i++) { if (wcsicmp(pExt+1, diskExt[i]) == 0) { - WMSG2("Dropping '%ls' from '%ls'\n", pExt, pathName); + LOGI("Dropping '%ls' from '%ls'", pExt, pathName); *const_cast(pExt) = '\0'; return; } diff --git a/app/GenericArchive.cpp b/app/GenericArchive.cpp index 33ca0c1..941f163 100644 --- a/app/GenericArchive.cpp +++ b/app/GenericArchive.cpp @@ -220,7 +220,7 @@ GenericEntry::CheckHighASCII(const unsigned char* buffer, isHighASCII = true; while (count--) { if ((*buffer & 0x80) == 0 && *buffer != 0x20 && *buffer != 0x00) { - WMSG1("Flunking CheckHighASCII on 0x%02x\n", *buffer); + LOGI("Flunking CheckHighASCII on 0x%02x", *buffer); isHighASCII = false; break; } @@ -320,10 +320,10 @@ GenericEntry::DetermineConversion(const unsigned char* buffer, long count, */ if (wantConvHA == kConvertHAOn || wantConvHA == kConvertHAAuto) { isHighASCII = CheckHighASCII(buffer, count); - WMSG1(" +++ Determined isHighASCII=%d\n", isHighASCII); + LOGI(" +++ Determined isHighASCII=%d", isHighASCII); } else { isHighASCII = false; - WMSG0(" +++ Not even checking isHighASCII\n"); + LOGI(" +++ Not even checking isHighASCII"); } bufCount = count; @@ -407,10 +407,10 @@ GenericEntry::WriteConvert(FILE* fp, const char* buf, size_t len, { int err = 0; - WMSG2("+++ WriteConvert conv=%d convHA=%d\n", *pConv, *pConvHA); + LOGI("+++ WriteConvert conv=%d convHA=%d", *pConv, *pConvHA); if (len == 0) { - WMSG0("WriteConvert asked to write 0 bytes; returning\n"); + LOGI("WriteConvert asked to write 0 bytes; returning"); return err; } @@ -420,10 +420,10 @@ GenericEntry::WriteConvert(FILE* fp, const char* buf, size_t len, *pConv = DetermineConversion((unsigned char*)buf, len, &sourceType, pConvHA); if (*pConv == kConvertEOLOn && sourceType == kEOLCRLF) { - WMSG0(" Auto-detected text conversion from CRLF; disabling\n"); + LOGI(" Auto-detected text conversion from CRLF; disabling"); *pConv = kConvertEOLOff; } - WMSG2(" Auto-detected EOL conv=%d ha=%d\n", *pConv, *pConvHA); + LOGI(" Auto-detected EOL conv=%d ha=%d", *pConv, *pConvHA); } else if (*pConvHA == kConvertHAAuto) { if (*pConv == kConvertEOLOn) { /* definitely converting EOL, test for high ASCII */ @@ -436,7 +436,7 @@ GenericEntry::WriteConvert(FILE* fp, const char* buf, size_t len, *pConvHA = kConvertHAOff; } } - WMSG2("+++ After auto, conv=%d convHA=%d\n", *pConv, *pConvHA); + LOGI("+++ After auto, conv=%d convHA=%d", *pConv, *pConvHA); ASSERT(*pConv == kConvertEOLOn || *pConv == kConvertEOLOff); ASSERT(*pConvHA == kConvertHAOn || *pConvHA == kConvertHAOff); @@ -444,7 +444,7 @@ GenericEntry::WriteConvert(FILE* fp, const char* buf, size_t len, if (*pConv == kConvertEOLOff) { if (fwrite(buf, len, 1, fp) != 1) { err = errno; - WMSG1("WriteConvert failed, err=%d\n", errno); + LOGI("WriteConvert failed, err=%d", errno); } } else { ASSERT(*pConv == kConvertEOLOn); @@ -510,7 +510,7 @@ GenericArchive::AddEntry(GenericEntry* pEntry) fNumEntries++; //if (fEntryIndex != NULL) { - // WMSG0("Resetting fEntryIndex\n"); + // LOGI("Resetting fEntryIndex"); // delete [] fEntryIndex; // fEntryIndex = NULL; //} @@ -525,7 +525,7 @@ GenericArchive::DeleteEntries(void) GenericEntry* pEntry; GenericEntry* pNext; - WMSG1("Deleting %d archive entries\n", fNumEntries); + LOGI("Deleting %d archive entries", fNumEntries); pEntry = GetEntries(); while (pEntry != NULL) { @@ -549,7 +549,7 @@ GenericArchive::CreateIndex(void) GenericEntry* pEntry; int num; - WMSG1("Creating entry index (%d entries)\n", fNumEntries); + LOGI("Creating entry index (%d entries)", fNumEntries); ASSERT(fNumEntries != 0); @@ -597,7 +597,7 @@ GenericArchive::GenDerivedTempName(const WCHAR* filename) mangle.Delete(idx+1, len-(idx+1)); /* delete out to the end */ mangle += kTmpTemplate; } - WMSG2("GenDerived: passed '%ls' returned '%ls'\n", filename, (LPCWSTR) mangle); + LOGI("GenDerived: passed '%ls' returned '%ls'", filename, (LPCWSTR) mangle); return mangle; } @@ -912,7 +912,7 @@ GenericArchive::Win32AddDirectory(const AddFilesDialog* pAddOpts, ASSERT(pAddOpts != NULL); ASSERT(dirName != NULL); - WMSG1("+++ DESCEND: '%ls'\n", dirName); + LOGI("+++ DESCEND: '%ls'", dirName); dirp = OpenDir(dirName); if (dirp == NULL) { @@ -939,7 +939,7 @@ GenericArchive::Win32AddDirectory(const AddFilesDialog* pAddOpts, len = wcslen(dirName); if (len + wcslen(entry->d_name) +2 > MAX_PATH) { err = kNuErrInternal; - WMSG4("ERROR: Filename exceeds %d bytes: %ls%c%ls", + LOGE("ERROR: Filename exceeds %d bytes: %ls%c%ls", MAX_PATH, dirName, fssep, entry->d_name); goto bail; } @@ -1010,7 +1010,7 @@ GenericArchive::Win32AddFile(const AddFilesDialog* pAddOpts, * filetype and auxtype it has, and whether or not it's actually the * resource fork of another file. */ - WMSG1("+++ ADD '%ls'\n", pathname); + LOGI("+++ ADD '%ls'", pathname); /* * Fill out the "details" structure. The class has an automatic @@ -1099,7 +1099,7 @@ GenericArchive::FileDetails::operator const NuFileDetails() const break; case kFileKindDirectory: default: - WMSG1("Invalid entryKind (%d) for NuFileDetails conversion\n", + LOGI("Invalid entryKind (%d) for NuFileDetails conversion", entryKind); ASSERT(false); details.threadID = 0; // that makes it an old-style comment?! @@ -1196,7 +1196,7 @@ GenericArchive::FileDetails::CopyFields(FileDetails* pDst, void SelectionSet::CreateFromSelection(ContentList* pContentList, int threadMask) { - WMSG1("CreateFromSelection (threadMask=0x%02x)\n", threadMask); + LOGI("CreateFromSelection (threadMask=0x%02x)", threadMask); POSITION posn; posn = pContentList->GetFirstSelectedItemPosition(); @@ -1217,7 +1217,7 @@ SelectionSet::CreateFromSelection(ContentList* pContentList, int threadMask) void SelectionSet::CreateFromAll(ContentList* pContentList, int threadMask) { - WMSG1("CreateFromAll (threadMask=0x%02x)\n", threadMask); + LOGI("CreateFromAll (threadMask=0x%02x)", threadMask); int count = pContentList->GetItemCount(); for (int idx = 0; idx < count; idx++) { @@ -1236,13 +1236,13 @@ SelectionSet::AddToSet(GenericEntry* pEntry, int threadMask) { SelectionEntry* pSelEntry; - //WMSG1(" Sel '%ls'\n", pEntry->GetPathName()); + //LOGI(" Sel '%ls'", pEntry->GetPathName()); if (!(threadMask & GenericEntry::kAllowVolumeDir) && pEntry->GetRecordKind() == GenericEntry::kRecordKindVolumeDir) { /* only include volume dir if specifically requested */ - //WMSG1(" Excluding volume dir '%ls' from set\n", pEntry->GetPathName()); + //LOGI(" Excluding volume dir '%ls' from set", pEntry->GetPathName()); return; } @@ -1250,7 +1250,7 @@ SelectionSet::AddToSet(GenericEntry* pEntry, int threadMask) pEntry->GetRecordKind() == GenericEntry::kRecordKindDirectory) { /* only include directories if specifically requested */ - //WMSG1(" Excluding folder '%ls' from set\n", pEntry->GetPathName()); + //LOGI(" Excluding folder '%ls' from set", pEntry->GetPathName()); return; } @@ -1313,7 +1313,7 @@ SelectionSet::DeleteEntries(void) SelectionEntry* pEntry; SelectionEntry* pNext; - WMSG0("Deleting selection entries\n"); + LOGI("Deleting selection entries"); pEntry = GetEntries(); while (pEntry != NULL) { @@ -1354,11 +1354,11 @@ SelectionSet::Dump(void) { const SelectionEntry* pEntry; - WMSG1("SelectionSet: %d entries\n", fNumEntries); + LOGI("SelectionSet: %d entries", fNumEntries); pEntry = fEntryHead; while (pEntry != NULL) { - WMSG1(" : name='%ls'\n", pEntry->GetEntry()->GetPathName()); + LOGI(" : name='%ls'", pEntry->GetEntry()->GetPathName()); pEntry = pEntry->GetNext(); } } diff --git a/app/GenericArchive.h b/app/GenericArchive.h index a007bb5..b61285a 100644 --- a/app/GenericArchive.h +++ b/app/GenericArchive.h @@ -292,7 +292,7 @@ public: //fEntryIndex = NULL; } virtual ~GenericArchive(void) { - //WMSG0("Deleting GenericArchive\n"); + //LOGI("Deleting GenericArchive"); DeleteEntries(); delete fPathName; } diff --git a/app/ImageFormatDialog.cpp b/app/ImageFormatDialog.cpp index 4d75e13..cf398b4 100644 --- a/app/ImageFormatDialog.cpp +++ b/app/ImageFormatDialog.cpp @@ -230,7 +230,7 @@ ImageFormatDialog::LoadComboBox(int boxID, const ConvTable* pTable, int dflt) if (pTable == gFSFormats && !fAllowGenericFormats && DiskImg::IsGenericFormat((DiskImg::FSFormat)pTable[idx].enumval)) { - WMSG1("LoadComboBox skipping '%ls'\n", pTable[idx].name); + LOGI("LoadComboBox skipping '%ls'", pTable[idx].name); idxShift++; } else { // Note to self: AddString returns the combo box item ID; @@ -246,10 +246,10 @@ ImageFormatDialog::LoadComboBox(int boxID, const ConvTable* pTable, int dflt) } if (current != -1) { - WMSG3(" Set default for %d/%d to %d\n", boxID, dflt, current); + LOGI(" Set default for %d/%d to %d", boxID, dflt, current); pCombo->SetCurSel(current); } else { - WMSG2(" No matching default for %d (%d)\n", boxID, dflt); + LOGI(" No matching default for %d (%d)", boxID, dflt); } } @@ -281,7 +281,7 @@ ImageFormatDialog::ConvComboSel(int boxID, const ConvTable* pTable) ASSERT(enumval == pTable[idx].enumval); } - WMSG3(" Returning ev=%d for %d entry '%ls'\n", + LOGI(" Returning ev=%d for %d entry '%ls'", enumval, boxID, pTable[idx].name); return enumval; diff --git a/app/Main.cpp b/app/Main.cpp index 59e8bc7..cdedd3f 100644 --- a/app/Main.cpp +++ b/app/Main.cpp @@ -248,21 +248,21 @@ MainWindow::MainWindow() */ MainWindow::~MainWindow() { - WMSG0("~MainWindow\n"); + LOGI("~MainWindow"); - //WMSG0("MainWindow destructor\n"); + //LOGI("MainWindow destructor"); CloseArchiveWOControls(); int cc; cc = ::WinHelp(m_hWnd, ::AfxGetApp()->m_pszHelpFilePath, HELP_QUIT, 0); - WMSG1("Turning off WinHelp returned %d\n", cc); + LOGI("Turning off WinHelp returned %d", cc); // free stuff used by print dialog ::GlobalFree(fhDevMode); ::GlobalFree(fhDevNames); fPreferences.SaveToRegistry(); - WMSG0("MainWindow destructor complete\n"); + LOGI("MainWindow destructor complete"); } @@ -293,7 +293,7 @@ MainWindow::GetClientRect(LPRECT lpRect) const fStatusBar.GetWindowRect(&sizeRect); statusBarHeight = sizeRect.bottom - sizeRect.top; - //WMSG2("HEIGHTS = %d/%d\n", toolBarHeight, statusBarHeight); + //LOGI("HEIGHTS = %d/%d", toolBarHeight, statusBarHeight); CFrameWnd::GetClientRect(lpRect); lpRect->top += toolBarHeight; lpRect->bottom -= statusBarHeight; @@ -320,7 +320,7 @@ MainWindow::DoIdle(void) if (width >= 0 && width < ColumnLayout::kMinCol0Width) { /* column is too small, but don't change it until user lets mouse up */ if (::GetAsyncKeyState(VK_LBUTTON) >= 0) { - WMSG0("Resetting column 0 width\n"); + LOGI("Resetting column 0 width"); fPreferences.GetColumnLayout()->SetColumnWidth(0, ColumnLayout::kMinCol0Width); fpContentList->NewColumnWidths(); @@ -375,14 +375,14 @@ MainWindow::ProcessCommandLine(void) if (mangle == NULL) return; - WMSG1("Mangling '%ls'\n", mangle); + LOGI("Mangling '%ls'", mangle); WCHAR* argv[8]; int argc = 8; VectorizeString(mangle, argv, &argc); - WMSG0("Args:\n"); + LOGI("Args:"); for (int i = 0; i < argc; i++) { - WMSG2(" %d '%ls'\n", i, argv[i]); + LOGI(" %d '%ls'", i, argv[i]); } /* @@ -397,7 +397,7 @@ MainWindow::ProcessCommandLine(void) if (argv[i][0] == '-') { if (wcsicmp(argv[i], L"-mode") == 0) { if (i == argc-1) { - WMSG0("WARNING: -mode specified without mode\n"); + LOGI("WARNING: -mode specified without mode"); } else i++; if (wcsicmp(argv[i], kModeNuFX) == 0) @@ -409,11 +409,11 @@ MainWindow::ProcessCommandLine(void) else if (wcsicmp(argv[i], kModeDiskImage) == 0) filterIndex = kFilterIndexDiskImage; else { - WMSG1("WARNING: unrecognized mode '%ls'\n", argv[i]); + LOGI("WARNING: unrecognized mode '%ls'", argv[i]); } } else if (wcsicmp(argv[i], L"-dispname") == 0) { if (i == argc-1) { - WMSG0("WARNING: -dispname specified without name\n"); + LOGI("WARNING: -dispname specified without name"); } else i++; dispName = argv[i]; @@ -421,17 +421,17 @@ MainWindow::ProcessCommandLine(void) temp = true; } else if (wcsicmp(argv[i], L"-install") == 0) { // see MyApp::InitInstance - WMSG0("Got '-install' flag, doing nothing\n"); + LOGI("Got '-install' flag, doing nothing"); } else if (wcsicmp(argv[i], L"-uninstall") == 0) { // see MyApp::InitInstance - WMSG0("Got '-uninstall' flag, doing nothing\n"); + LOGI("Got '-uninstall' flag, doing nothing"); } else { - WMSG1("WARNING: unrecognized flag '%ls'\n", argv[i]); + LOGI("WARNING: unrecognized flag '%ls'", argv[i]); } } else { /* must be the filename */ if (i != argc-1) { - WMSG1("WARNING: ignoring extra arguments (e.g. '%ls')\n", + LOGI("WARNING: ignoring extra arguments (e.g. '%ls')", argv[i+1]); } filename = argv[i]; @@ -439,11 +439,11 @@ MainWindow::ProcessCommandLine(void) } } if (argc != 1 && filename == NULL) { - WMSG0("WARNING: args specified but no filename found\n"); + LOGI("WARNING: args specified but no filename found"); } - WMSG0("Argument handling:\n"); - WMSG3(" index=%d temp=%d filename='%ls'\n", + LOGI("Argument handling:"); + LOGI(" index=%d temp=%d filename='%ls'", filterIndex, temp, filename == NULL ? L"(null)" : filename); if (filename != NULL) { @@ -473,7 +473,7 @@ MainWindow::ProcessCommandLine(void) if (len > 4 && wcsicmp(filename + (len-4), L".tmp") == 0) { fDeleteList.Add(filename); } else { - WMSG1("NOT adding '%ls' to DeleteList -- does not end in '.tmp'\n", + LOGI("NOT adding '%ls' to DeleteList -- does not end in '.tmp'", filename); } } @@ -497,7 +497,7 @@ const int kProgressPane = 1; int MainWindow::OnCreate(LPCREATESTRUCT lpcs) { - WMSG0("Now in OnCreate!\n"); + LOGI("Now in OnCreate!"); if (CFrameWnd::OnCreate(lpcs) == -1) return -1; @@ -547,7 +547,7 @@ MainWindow::OnLateInit(UINT, LONG) appName.LoadString(IDS_MB_APP_NAME); - WMSG0("----- late init begins -----\n"); + LOGI("----- late init begins -----"); /* * Handle all other messages. This gives the framework a chance to dim @@ -593,7 +593,7 @@ MainWindow::OnLateInit(UINT, LONG) MyRegistry::RegStatus regStatus; //regStatus = gMyApp.fRegistry.CheckRegistration(&result); regStatus = MyRegistry::kRegValid; - WMSG1("CheckRegistration returned %d\n", regStatus); + LOGI("CheckRegistration returned %d", regStatus); switch (regStatus) { case MyRegistry::kRegNotSet: case MyRegistry::kRegValid: @@ -602,7 +602,7 @@ MainWindow::OnLateInit(UINT, LONG) case MyRegistry::kRegExpired: case MyRegistry::kRegInvalid: MessageBox(result, appName, MB_OK|MB_ICONINFORMATION); - WMSG0("FORCING REG\n"); + LOGI("FORCING REG"); #if 0 if (EnterRegDialog::GetRegInfo(this) != 0) { result = ""; @@ -647,7 +647,7 @@ fail: BOOL MainWindow::OnQueryEndSession(void) { - WMSG0("Got QueryEndSession\n"); + LOGI("Got QueryEndSession"); return TRUE; } @@ -657,7 +657,7 @@ MainWindow::OnQueryEndSession(void) void MainWindow::OnEndSession(BOOL bEnding) { - WMSG1("Got EndSession (bEnding=%d)\n", bEnding); + LOGI("Got EndSession (bEnding=%d)", bEnding); if (bEnding) { CloseArchiveWOControls(); @@ -738,7 +738,7 @@ MainWindow::OnPaint(void) afx_msg BOOL MainWindow::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) { - WMSG0("MOUSE WHEEL\n"); + LOGI("MOUSE WHEEL"); return FALSE; WPARAM wparam; @@ -760,7 +760,7 @@ void MainWindow::OnSetFocus(CWnd* /*pOldWnd*/) { if (fpContentList != NULL) { - WMSG0("Returning focus to ContentList\n"); + LOGI("Returning focus to ContentList"); fpContentList->SetFocus(); } } @@ -787,7 +787,7 @@ MainWindow::OnHelp(UINT wParam, LONG lParam) HELPINFO* lpHelpInfo = (HELPINFO*) lParam; DWORD context = lpHelpInfo->iCtrlId; - WMSG1("MainWindow OnHelp (context=%d)\n", context); + LOGI("MainWindow OnHelp (context=%d)", context); WinHelp(context, HELP_CONTEXTPOPUP); return TRUE; // yes, we handled it @@ -880,13 +880,13 @@ MainWindow::ApplyNow(PrefsSheet* pPS) { bool mustReload = false; - //WMSG0("APPLY CHANGES\n"); + //LOGI("APPLY CHANGES"); ColumnLayout* pColLayout = fPreferences.GetColumnLayout(); if (pPS->fGeneralPage.fDefaultsPushed) { /* reset all sizes to defaults, then factor in checkboxes */ - WMSG0(" Resetting all widths to defaults\n"); + LOGI(" Resetting all widths to defaults"); /* copy defaults over */ for (int i = 0; i < kNumVisibleColumns; i++) @@ -899,13 +899,13 @@ MainWindow::ApplyNow(PrefsSheet* pPS) pPS->fGeneralPage.fColumn[i]) { /* restore column */ - WMSG1(" Column %d restored\n", i); + LOGI(" Column %d restored", i); pColLayout->SetColumnWidth(i, ColumnLayout::kWidthDefaulted); } else if (pColLayout->GetColumnWidth(i) != 0 && !pPS->fGeneralPage.fColumn[i]) { /* disable column */ - WMSG1(" Column %d hidden\n", i); + LOGI(" Column %d hidden", i); pColLayout->SetColumnWidth(i, 0); } } @@ -919,7 +919,7 @@ MainWindow::ApplyNow(PrefsSheet* pPS) if (fPreferences.GetPrefBool(kPrCoerceDOSFilenames)!= (pPS->fGeneralPage.fCoerceDOSFilenames != 0)) { - WMSG1("DOS filename coercion pref now %d\n", + LOGI("DOS filename coercion pref now %d", pPS->fGeneralPage.fCoerceDOSFilenames); fPreferences.SetPrefBool(kPrCoerceDOSFilenames, pPS->fGeneralPage.fCoerceDOSFilenames != 0); @@ -928,7 +928,7 @@ MainWindow::ApplyNow(PrefsSheet* pPS) if (fPreferences.GetPrefBool(kPrSpacesToUnder) != (pPS->fGeneralPage.fSpacesToUnder != 0)) { - WMSG1("Spaces-to-underscores now %d\n", pPS->fGeneralPage.fSpacesToUnder); + LOGI("Spaces-to-underscores now %d", pPS->fGeneralPage.fSpacesToUnder); fPreferences.SetPrefBool(kPrSpacesToUnder, pPS->fGeneralPage.fSpacesToUnder != 0); mustReload = true; } @@ -936,7 +936,7 @@ MainWindow::ApplyNow(PrefsSheet* pPS) fPreferences.SetPrefBool(kPrBeepOnSuccess, pPS->fGeneralPage.fBeepOnSuccess != 0); if (pPS->fGeneralPage.fOurAssociations != NULL) { - WMSG0("NEW ASSOCIATIONS!\n"); + LOGI("NEW ASSOCIATIONS!"); for (int assoc = 0; assoc < gMyApp.fRegistry.GetNumFileAssocs(); assoc++) { @@ -991,7 +991,7 @@ MainWindow::ApplyNow(PrefsSheet* pPS) fPreferences.SetPrefBool(kPrConvResources, pPS->fFviewPage.fConvResources != 0); fPreferences.SetPrefString(kPrTempPath, pPS->fFilesPage.fTempPath); - WMSG1("--- Temp path now '%ls'\n", fPreferences.GetPrefString(kPrTempPath)); + LOGI("--- Temp path now '%ls'", fPreferences.GetPrefString(kPrTempPath)); fPreferences.SetPrefString(kPrExtViewerExts, pPS->fFilesPage.fExtViewerExts); @@ -1006,7 +1006,7 @@ MainWindow::ApplyNow(PrefsSheet* pPS) fpOpenArchive->PreferencesChanged(); if (mustReload) { - WMSG0("Preferences apply requesting GA/CL reload\n"); + LOGI("Preferences apply requesting GA/CL reload"); if (fpOpenArchive != NULL) fpOpenArchive->Reload(); if (fpContentList != NULL) @@ -1073,7 +1073,7 @@ MainWindow::OnFindDialogMessage(WPARAM wParam, LPARAM lParam) fpContentList->FindNext(fFindLastStr, fFindDown, fFindMatchCase, fFindMatchWholeWord); } else { - WMSG0("Unexpected find dialog activity\n"); + LOGI("Unexpected find dialog activity"); } return 0; @@ -1088,7 +1088,7 @@ MainWindow::OnFindDialogMessage(WPARAM wParam, LPARAM lParam) void MainWindow::OnEditSort(UINT id) { - WMSG1("EDIT SORT %d\n", id); + LOGI("EDIT SORT %d", id); ASSERT(id >= IDM_SORT_PATHNAME && id <= IDM_SORT_ORIGINAL); fPreferences.GetColumnLayout()->SetSortColumn(id - IDM_SORT_PATHNAME); @@ -1157,7 +1157,7 @@ MainWindow::OnHelpAbout(void) AboutDialog dlg(this); result = dlg.DoModal(); - WMSG1("HelpAbout returned %d\n", result); + LOGI("HelpAbout returned %d", result); /* * User could've changed registration. If we're showing the registered @@ -1192,7 +1192,7 @@ MainWindow::OnFileNewArchive(void) fPreferences.SetPrefString(kPrOpenArchiveFolder, saveFolder); filename = dlg.GetPathName(); - WMSG1("NEW FILE '%ls'\n", (LPCWSTR) filename); + LOGI("NEW FILE '%ls'", (LPCWSTR) filename); /* remove file if it already exists */ errMsg = RemoveFile(filename); @@ -1216,7 +1216,7 @@ MainWindow::OnFileNewArchive(void) } bail: - WMSG0("--- OnFileNewArchive done\n"); + LOGI("--- OnFileNewArchive done"); } @@ -1254,7 +1254,7 @@ MainWindow::OnFileOpen(void) dlg.m_ofn.nFilterIndex, dlg.GetReadOnlyPref() != 0); bail: - WMSG0("--- OnFileOpen done\n"); + LOGI("--- OnFileOpen done"); } /* @@ -1263,7 +1263,7 @@ bail: void MainWindow::OnFileOpenVolume(void) { - WMSG0("--- OnFileOpenVolume\n"); + LOGI("--- OnFileOpenVolume"); int result; @@ -1360,7 +1360,7 @@ MainWindow::OnFileClose(void) { CloseArchive(); //SetCPTitle(); - WMSG0("--- OnFileClose done\n"); + LOGI("--- OnFileClose done"); } void MainWindow::OnUpdateFileClose(CCmdUI* pCmdUI) @@ -1392,7 +1392,7 @@ MainWindow::OnFileArchiveInfo(void) pDlg = new AcuArchiveInfoDialog((AcuArchive*) fpOpenArchive, this); break; default: - WMSG1("Unexpected archive type %d\n", fpOpenArchive->GetArchiveKind()); + LOGI("Unexpected archive type %d", fpOpenArchive->GetArchiveKind()); ASSERT(false); return; }; @@ -1526,7 +1526,7 @@ MainWindow::GetSelectedItem(ContentList* pContentList) int num = pContentList->GetNextSelectedItem(/*ref*/ posn); GenericEntry* pEntry = (GenericEntry*) pContentList->GetItemData(num); if (pEntry == NULL) { - WMSG1(" Glitch: couldn't find entry %d\n", num); + LOGI(" Glitch: couldn't find entry %d", num); ASSERT(false); } @@ -1547,7 +1547,7 @@ MainWindow::HandleDoubleClick(void) ASSERT(fpContentList != NULL); if (fpContentList->GetSelectedCount() == 0) { /* nothing selected, they double-clicked outside first column */ - WMSG0("Double-click but nothing selected\n"); + LOGI("Double-click but nothing selected"); return; } if (fpContentList->GetSelectedCount() != 1) { @@ -1563,7 +1563,7 @@ MainWindow::HandleDoubleClick(void) if (pEntry == NULL) return; - WMSG1(" Double-click GOT '%ls'\n", pEntry->GetPathName()); + LOGI(" Double-click GOT '%ls'", pEntry->GetPathName()); const WCHAR* ext; long fileType, auxType; @@ -1594,7 +1594,7 @@ MainWindow::HandleDoubleClick(void) CString extViewerExts; extViewerExts = fPreferences.GetPrefString(kPrExtViewerExts); if (ext != NULL && MatchSemicolonList(extViewerExts, ext+1)) { - WMSG1(" Launching external viewer for '%ls'\n", ext); + LOGI(" Launching external viewer for '%ls'", ext); TmpExtractForExternal(pEntry); handled = true; } else if (pEntry->GetRecordKind() == GenericEntry::kRecordKindFile) { @@ -1604,7 +1604,7 @@ MainWindow::HandleDoubleClick(void) wcsicmp(ext, L".bxy") == 0)) || (fileType == 0xe0 && auxType == 0x8002)) { - WMSG0(" Guessing NuFX\n"); + LOGI(" Guessing NuFX"); TmpExtractAndOpen(pEntry, GenericEntry::kDataThread, kModeNuFX); handled = true; } else @@ -1613,7 +1613,7 @@ MainWindow::HandleDoubleClick(void) wcsicmp(ext, L".bqy") == 0)) || (fileType == 0xe0 && auxType == 0x8000)) { - WMSG0(" Guessing Binary II\n"); + LOGI(" Guessing Binary II"); TmpExtractAndOpen(pEntry, GenericEntry::kDataThread, kModeBinaryII); handled = true; } else @@ -1621,7 +1621,7 @@ MainWindow::HandleDoubleClick(void) wcsicmp(ext, L".acu") == 0)) || (fileType == 0xe0 && auxType == 0x8001)) { - WMSG0(" Guessing ACU\n"); + LOGI(" Guessing ACU"); TmpExtractAndOpen(pEntry, GenericEntry::kDataThread, kModeACU); handled = true; } else @@ -1629,12 +1629,12 @@ MainWindow::HandleDoubleClick(void) pEntry->GetUncompressedLen() == 819284) { /* type is dImg, creator is dCpy, length is 800K + DC stuff */ - WMSG0(" Looks like a disk image\n"); + LOGI(" Looks like a disk image"); TmpExtractAndOpen(pEntry, GenericEntry::kDataThread, kModeDiskImage); handled = true; } } else if (pEntry->GetRecordKind() == GenericEntry::kRecordKindDisk) { - WMSG0(" Opening archived disk image\n"); + LOGI(" Opening archived disk image"); TmpExtractAndOpen(pEntry, GenericEntry::kDiskImageThread, kModeDiskImage); handled = true; } @@ -1679,7 +1679,7 @@ MainWindow::TmpExtractAndOpen(GenericEntry* pEntry, int threadKind, L"CPfile", 0, nameBuf); if (unique == 0) { DWORD dwerr = ::GetLastError(); - WMSG2("GetTempFileName failed on '%ls' (err=%ld)\n", + LOGI("GetTempFileName failed on '%ls' (err=%ld)", fPreferences.GetPrefString(kPrTempPath), dwerr); return dwerr; } @@ -1694,7 +1694,7 @@ MainWindow::TmpExtractAndOpen(GenericEntry* pEntry, int threadKind, fp = _wfopen(nameBuf, L"wb"); if (fp != NULL) { - WMSG2("Extracting to '%ls' (unique=%d)\n", nameBuf, unique); + LOGI("Extracting to '%ls' (unique=%d)", nameBuf, unique); result = pEntry->ExtractThreadToFile(threadKind, fp, GenericEntry::kConvertEOLOff, GenericEntry::kConvertHAOff, &errMsg); @@ -1716,7 +1716,7 @@ MainWindow::TmpExtractAndOpen(GenericEntry* pEntry, int threadKind, ShowFailureMsg(this, msg, IDS_FAILED); } else { /* during dev, "missing DLL" causes false-positive success */ - WMSG0("Successfully launched CiderPress\n"); + LOGI("Successfully launched CiderPress"); mustDelete = false; // up to newly-launched app } } else { @@ -1729,7 +1729,7 @@ MainWindow::TmpExtractAndOpen(GenericEntry* pEntry, int threadKind, } if (mustDelete) { - WMSG1("Deleting '%ls'\n", nameBuf); + LOGI("Deleting '%ls'", nameBuf); _wunlink(nameBuf); } @@ -1767,7 +1767,7 @@ MainWindow::TmpExtractForExternal(GenericEntry* pEntry) L"CPfile", 0, nameBuf); if (unique == 0) { DWORD dwerr = ::GetLastError(); - WMSG2("GetTempFileName failed on '%ls' (err=%ld)\n", + LOGI("GetTempFileName failed on '%ls' (err=%ld)", fPreferences.GetPrefString(kPrTempPath), dwerr); return dwerr; } @@ -1785,7 +1785,7 @@ MainWindow::TmpExtractForExternal(GenericEntry* pEntry) fp = _wfopen(nameBuf, L"wb"); if (fp != NULL) { fDeleteList.Add(nameBuf); // second file created by fopen - WMSG2("Extracting to '%ls' (unique=%d)\n", nameBuf, unique); + LOGI("Extracting to '%ls' (unique=%d)", nameBuf, unique); result = pEntry->ExtractThreadToFile(GenericEntry::kDataThread, fp, GenericEntry::kConvertEOLOff, GenericEntry::kConvertHAOff, &errMsg); @@ -1801,7 +1801,7 @@ MainWindow::TmpExtractForExternal(GenericEntry* pEntry) msg.Format(L"Unable to launch external viewer (err=%d).", err); ShowFailureMsg(this, msg, IDS_FAILED); } else { - WMSG0("Successfully launched external viewer\n"); + LOGI("Successfully launched external viewer"); } } else { ShowFailureMsg(this, errMsg, IDS_FAILED); @@ -1830,7 +1830,7 @@ MainWindow::OnRtClkDefault(void) idx = fpContentList->GetRightClickItem(); ASSERT(idx != -1); - WMSG1("OnRtClkDefault %d\n", idx); + LOGI("OnRtClkDefault %d", idx); fpContentList->ClearRightClickItem(); } @@ -1858,7 +1858,7 @@ MainWindow::SetProgressBegin(void) fpActionProgress->SetProgress(0); else fStatusBar.SetPaneText(kProgressPane, L"--%"); - //WMSG0(" Complete: BEGIN\n"); + //LOGI(" Complete: BEGIN"); /* redraw stuff with the changes */ (void) PeekAndPump(); @@ -1880,11 +1880,11 @@ MainWindow::SetProgressUpdate(int percent, const WCHAR* oldName, WCHAR buf[8]; wsprintf(buf, L"%d%%", percent); fStatusBar.SetPaneText(kProgressPane, buf); - //WMSG1(" Complete: %ls\n", buf); + //LOGI(" Complete: %ls", buf); } if (!PeekAndPump()) { - WMSG0("SetProgressUpdate: shutdown?!\n"); + LOGI("SetProgressUpdate: shutdown?!"); } //EventPause(10); // DEBUG DEBUG @@ -1899,7 +1899,7 @@ MainWindow::SetProgressEnd(void) else fStatusBar.SetPaneText(kProgressPane, L""); // EventPause(100); // DEBUG DEBUG - //WMSG0(" Complete: END\n"); + //LOGI(" Complete: END"); } @@ -1919,7 +1919,7 @@ MainWindow::SetProgressCounter(const WCHAR* str, long val) ASSERT(!IsWindowEnabled()); if (fpProgressCounter != NULL) { - //WMSG2("SetProgressCounter '%ls' %d\n", str, val); + //LOGI("SetProgressCounter '%ls' %d", str, val); CString msg; if (str != NULL) @@ -1936,7 +1936,7 @@ MainWindow::SetProgressCounter(const WCHAR* str, long val) } if (!PeekAndPump()) { - WMSG0("SetProgressCounter: shutdown?!\n"); + LOGI("SetProgressCounter: shutdown?!"); } //EventPause(10); // DEBUG DEBUG @@ -2008,10 +2008,10 @@ MainWindow::PrintAbortProc(HDC hDC, int nCode) pMain->PeekAndPump(); if (pMain->GetAbortPrinting()) { - WMSG0("PrintAbortProc returning FALSE (abort printing)\n"); + LOGI("PrintAbortProc returning FALSE (abort printing)"); return FALSE; } - WMSG0(" PrintAbortProc returning TRUE (continue printing)\n"); + LOGI(" PrintAbortProc returning TRUE (continue printing)"); return TRUE; } @@ -2083,7 +2083,7 @@ MainWindow::LoadArchive(const WCHAR* fileName, const WCHAR* extension, appName.LoadString(IDS_MB_APP_NAME); - WMSG3("LoadArchive: '%ls' ro=%d idx=%d\n", fileName, readOnly, filterIndex); + LOGI("LoadArchive: '%ls' ro=%d idx=%d", fileName, readOnly, filterIndex); /* close any existing archive to avoid weirdness from re-open */ CloseArchive(); @@ -2117,7 +2117,7 @@ try_again: if (filterIndex == kFilterIndexBinaryII) { /* try Binary II and nothing else */ ASSERT(!createFile); - WMSG0(" Trying Binary II\n"); + LOGI(" Trying Binary II"); pOpenArchive = new BnyArchive; openResult = pOpenArchive->Open(fileName, readOnly, &errStr); if (openResult != GenericArchive::kResultSuccess) { @@ -2130,7 +2130,7 @@ try_again: if (filterIndex == kFilterIndexACU) { /* try ACU and nothing else */ ASSERT(!createFile); - WMSG0(" Trying ACU\n"); + LOGI(" Trying ACU"); pOpenArchive = new AcuArchive; openResult = pOpenArchive->Open(fileName, readOnly, &errStr); if (openResult != GenericArchive::kResultSuccess) { @@ -2143,7 +2143,7 @@ try_again: if (filterIndex == kFilterIndexDiskImage) { /* try various disk image formats */ ASSERT(!createFile); - WMSG0(" Trying disk images\n"); + LOGI(" Trying disk images"); pOpenArchive = new DiskArchive; openResult = pOpenArchive->Open(fileName, readOnly, &errStr); @@ -2182,7 +2182,7 @@ try_again: } else if (filterIndex == kFilterIndexNuFX) { /* try NuFX (including its embedded-in-BNY form) */ - WMSG0(" Trying NuFX\n"); + LOGI(" Trying NuFX"); pOpenArchive = new NufxArchive; openResult = pOpenArchive->Open(fileName, readOnly, &errStr); @@ -2233,7 +2233,7 @@ MainWindow::DoOpenVolume(CString drive, bool readOnly) //char filename[4] = "_:\\"; //filename[0] = driveLetter; - WMSG2("FileOpenVolume '%ls' %d\n", (LPCWSTR)drive, readOnly); + LOGI("FileOpenVolume '%ls' %d", (LPCWSTR)drive, readOnly); /* close existing archive */ CloseArchive(); @@ -2295,7 +2295,7 @@ MainWindow::ReopenArchive(void) CString errStr; /* if the open fails we *don't* want to leave the previous content up */ - WMSG3("Reopening '%ls' ro=%d kind=%d\n", + LOGI("Reopening '%ls' ro=%d kind=%d", (LPCWSTR) pathName, readOnly, archiveKind); CloseArchive(); @@ -2324,7 +2324,7 @@ MainWindow::ReopenArchive(void) goto bail; } - WMSG0(" Reopen was successful\n"); + LOGI(" Reopen was successful"); SwitchContentList(pOpenArchive); pOpenArchive = NULL; SetCPTitle(pathName, fpOpenArchive); @@ -2412,7 +2412,7 @@ MainWindow::CloseArchiveWOControls(void) { if (fpOpenArchive != NULL) { //fpOpenArchive->Close(); - WMSG0("Deleting OpenArchive\n"); + LOGI("Deleting OpenArchive"); delete fpOpenArchive; fpOpenArchive = NULL; } @@ -2429,7 +2429,7 @@ MainWindow::CloseArchive(void) // destroy the ContentList if (fpContentList != NULL) { - WMSG0("Destroying ContentList\n"); + LOGI("Destroying ContentList"); fpContentList->DestroyWindow(); // auto-cleanup invokes "delete" fpContentList = NULL; } @@ -2538,7 +2538,7 @@ MainWindow::SuccessBeep(void) const Preferences* pPreferences = GET_PREFERENCES(); if (pPreferences->GetPrefBool(kPrBeepOnSuccess)) { - WMSG0("\n"); + LOGI(""); ::MessageBeep(MB_OK); } } @@ -2552,7 +2552,7 @@ MainWindow::FailureBeep(void) const Preferences* pPreferences = GET_PREFERENCES(); if (pPreferences->GetPrefBool(kPrBeepOnSuccess)) { - WMSG0("\n"); + LOGI(""); ::MessageBeep(MB_ICONEXCLAMATION); // maybe MB_ICONHAND? } } @@ -2571,7 +2571,7 @@ MainWindow::RemoveFile(const WCHAR* fileName) cc = _wunlink(fileName); if (cc < 0 && errno != ENOENT) { int err = errno; - WMSG2("Failed removing file '%ls', errno=%d\n", fileName, err); + LOGI("Failed removing file '%ls', errno=%d", fileName, err); errMsg.Format(L"Unable to remove '%ls': %hs.", fileName, strerror(err)); if (err == EACCES) diff --git a/app/Main.h b/app/Main.h index 8cda2e0..2391866 100644 --- a/app/Main.h +++ b/app/Main.h @@ -385,22 +385,22 @@ private: public: DeleteList(void) { fHead = NULL; } ~DeleteList(void) { - WMSG1("Processing DeleteList (head=0x%08lx)\n", fHead); + LOGI("Processing DeleteList (head=0x%08lx)", fHead); DeleteListNode* pNode = fHead; DeleteListNode* pNext; while (pNode != NULL) { pNext = pNode->fNext; if (_wunlink(pNode->fName) != 0) { - WMSG2(" WARNING: delete of '%ls' failed, err=%d\n", + LOGI(" WARNING: delete of '%ls' failed, err=%d", pNode->fName, errno); } else { - WMSG1(" Deleted '%ls'\n", pNode->fName); + LOGI(" Deleted '%ls'", pNode->fName); } delete pNode; pNode = pNext; } - WMSG0("Processing DeleteList completed\n"); + LOGI("Processing DeleteList completed"); } void Add(const CString& name) { @@ -410,7 +410,7 @@ private: pNode->fNext = fHead; } fHead = pNode; - WMSG1("Delete-on-exit '%ls'\n", (LPCWSTR) name); + LOGI("Delete-on-exit '%ls'", (LPCWSTR) name); } DeleteListNode* fHead; diff --git a/app/MyApp.cpp b/app/MyApp.cpp index 20fa43c..57805d1 100644 --- a/app/MyApp.cpp +++ b/app/MyApp.cpp @@ -30,7 +30,7 @@ MyApp::MyApp(LPCTSTR lpszAppName) : CWinApp(lpszAppName) time_t now = time(NULL); - LOGI("CiderPress v%d.%d.%d%ls started at %.24hs\n", + LOGI("CiderPress v%d.%d.%d%ls started at %.24hs", kAppMajorVersion, kAppMinorVersion, kAppBugVersion, kAppDevString, ctime(&now)); @@ -39,7 +39,7 @@ MyApp::MyApp(LPCTSTR lpszAppName) : CWinApp(lpszAppName) tmpDbgFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); tmpDbgFlag |= _CRTDBG_LEAK_CHECK_DF; _CrtSetDbgFlag(tmpDbgFlag); - WMSG0("Leak detection enabled\n"); + LOGI("Leak detection enabled"); } /* @@ -50,7 +50,7 @@ MyApp::~MyApp(void) DiskArchive::AppCleanup(); NiftyList::AppCleanup(); - WMSG0("SHUTTING DOWN\n\n"); + LOGI("SHUTTING DOWN\n"); delete gDebugLog; } @@ -71,13 +71,13 @@ MyApp::InitInstance(void) m_pMainWnd->ShowWindow(m_nCmdShow); m_pMainWnd->UpdateWindow(); - WMSG0("Happily in InitInstance!\n"); + LOGI("Happily in InitInstance!"); /* find our .EXE file */ //HMODULE hModule = ::GetModuleHandle(NULL); WCHAR buf[MAX_PATH]; if (::GetModuleFileName(NULL /*hModule*/, buf, NELEM(buf)) != 0) { - WMSG1("Module name is '%ls'\n", buf); + LOGI("Module name is '%ls'", buf); fExeFileName = buf; WCHAR* cp = wcsrchr(buf, '\\'); @@ -86,7 +86,7 @@ MyApp::InitInstance(void) else fExeBaseName = fExeFileName.Left(cp - buf +1); } else { - WMSG1("BIG problem: GetModuleFileName failed (err=%ld)\n", + LOGI("BIG problem: GetModuleFileName failed (err=%ld)", ::GetLastError()); } @@ -107,24 +107,24 @@ MyApp::InitInstance(void) free((void*)m_pszProfileName); m_pszProfileName = strdup(buf); - WMSG1("Profile name is '%ls'\n", m_pszProfileName); + LOGI("Profile name is '%ls'", m_pszProfileName); if (!WriteProfileString("SectionOne", "MyEntry", "test")) - WMSG0("WriteProfileString failed\n"); + LOGI("WriteProfileString failed"); #endif SetRegistryKey(fRegistry.GetAppRegistryKey()); - //WMSG1("Registry key is '%ls'\n", m_pszRegistryKey); - //WMSG1("Profile name is '%ls'\n", m_pszProfileName); - WMSG1("Short command line is '%ls'\n", m_lpCmdLine); - //WMSG1("CP app name is '%ls'\n", m_pszAppName); - //WMSG1("CP exe name is '%ls'\n", m_pszExeName); - WMSG1("CP help file is '%ls'\n", m_pszHelpFilePath); - WMSG1("Command line is '%ls'\n", ::GetCommandLine()); + //LOGI("Registry key is '%ls'", m_pszRegistryKey); + //LOGI("Profile name is '%ls'", m_pszProfileName); + LOGI("Short command line is '%ls'", m_lpCmdLine); + //LOGI("CP app name is '%ls'", m_pszAppName); + //LOGI("CP exe name is '%ls'", m_pszExeName); + LOGI("CP help file is '%ls'", m_pszHelpFilePath); + LOGI("Command line is '%ls'", ::GetCommandLine()); //if (!WriteProfileString("SectionOne", "MyEntry", "test")) - // WMSG0("WriteProfileString failed\n"); + // LOGI("WriteProfileString failed"); /* * If we're installing or uninstalling, do what we need to and then @@ -132,11 +132,11 @@ MyApp::InitInstance(void) * incredibly robust Windows environment will take it in stride. */ if (wcscmp(m_lpCmdLine, L"-install") == 0) { - WMSG0("Invoked with INSTALL flag\n"); + LOGI("Invoked with INSTALL flag"); fRegistry.OneTimeInstall(); exit(0); } else if (wcscmp(m_lpCmdLine, L"-uninstall") == 0) { - WMSG0("Invoked with UNINSTALL flag\n"); + LOGI("Invoked with UNINSTALL flag"); fRegistry.OneTimeUninstall(); exit(1); // tell DeployMaster to continue with uninstall } @@ -161,9 +161,9 @@ MyApp::LogModuleLocation(const WCHAR* name) ::GetModuleFileName(hModule, fileNameBuf, NELEM(fileNameBuf)) != 0) { // GetModuleHandle does not increase ref count, so no need to release - WMSG2("Module '%ls' loaded from '%ls'\n", name, fileNameBuf); + LOGI("Module '%ls' loaded from '%ls'", name, fileNameBuf); } else { - WMSG1("Module '%ls' not loaded\n", name); + LOGI("Module '%ls' not loaded", name); } } @@ -176,7 +176,7 @@ MyApp::OnIdle(LONG lCount) BOOL bMore = CWinApp::OnIdle(lCount); //if (lCount == 0) { - // WMSG1("IDLE lcount=%d\n", lCount); + // LOGI("IDLE lcount=%d", lCount); //} /* diff --git a/app/NewDiskSize.cpp b/app/NewDiskSize.cpp index 0c76ff5..68687eb 100644 --- a/app/NewDiskSize.cpp +++ b/app/NewDiskSize.cpp @@ -79,13 +79,13 @@ NewDiskSize::EnableButtons_ProDOS(CDialog* pDialog, long totalBlocks, long usedWithoutBitmap = blocksUsed - GetNumBitmapBlocks_ProDOS(totalBlocks); bool first = true; - WMSG3("EnableButtons_ProDOS total=%ld used=%ld usedw/o=%ld\n", + LOGI("EnableButtons_ProDOS total=%ld used=%ld usedw/o=%ld", totalBlocks, blocksUsed, usedWithoutBitmap); for (int i = 0; i < NELEM(kCtrlMap); i++) { pButton = (CButton*) pDialog->GetDlgItem(kCtrlMap[i].ctrlID); if (pButton == NULL) { - WMSG1("WARNING: couldn't find ctrlID %d\n", kCtrlMap[i].ctrlID); + LOGI("WARNING: couldn't find ctrlID %d", kCtrlMap[i].ctrlID); continue; } @@ -145,7 +145,7 @@ NewDiskSize::UpdateSpecifyEdit(CDialog* pDialog) for (i = 0; i < NELEM(kCtrlMap); i++) { CButton* pButton = (CButton*) pDialog->GetDlgItem(kCtrlMap[i].ctrlID); if (pButton == NULL) { - WMSG1("WARNING: couldn't find ctrlID %d\n", kCtrlMap[i].ctrlID); + LOGI("WARNING: couldn't find ctrlID %d", kCtrlMap[i].ctrlID); continue; } @@ -156,7 +156,7 @@ NewDiskSize::UpdateSpecifyEdit(CDialog* pDialog) } } if (i == NELEM(kCtrlMap)) { - WMSG0("WARNING: couldn't find a checked radio button\n"); + LOGI("WARNING: couldn't find a checked radio button"); return; } diff --git a/app/NewFolderDialog.cpp b/app/NewFolderDialog.cpp index 208a8c9..1788e23 100644 --- a/app/NewFolderDialog.cpp +++ b/app/NewFolderDialog.cpp @@ -53,7 +53,7 @@ NewFolderDialog::DoDataExchange(CDataExchange* pDX) if (fNewFullPath.Right(1) != "\\") fNewFullPath += "\\"; fNewFullPath += fNewFolder; - WMSG1("CREATING '%ls'\n", (LPCWSTR) fNewFullPath); + LOGI("CREATING '%ls'", (LPCWSTR) fNewFullPath); if (!::CreateDirectory(fNewFullPath, NULL)) { /* show the sometimes-bizarre Windows error string */ CString msg, errStr, failed; diff --git a/app/NufxArchive.cpp b/app/NufxArchive.cpp index cf721f7..5630b09 100644 --- a/app/NufxArchive.cpp +++ b/app/NufxArchive.cpp @@ -76,7 +76,7 @@ NufxEntry::ExtractThreadToBuffer(int which, char** ppText, long* pLength, * First check for a length of zero. */ if (actualThreadEOF == 0) { - WMSG0("Empty thread\n"); + LOGI("Empty thread"); if (needAlloc) { *ppText = new char[1]; **ppText = '\0'; @@ -178,7 +178,7 @@ NufxEntry::ExtractThreadToFile(int which, FILE* outfp, ConvertEOL conv, /* we've got the right thread, see if it's empty */ if (actualThreadEOF == 0) { - WMSG0("Empty thread\n"); + LOGI("Empty thread"); result = IDOK; goto bail; } @@ -397,7 +397,7 @@ NufxEntry::AnalyzeRecord(const NuRecord* pRecord) SetHasDataFork(true); SetDataForkLen(pThread->actualThreadEOF); } else { - WMSG0("WARNING: ignoring second disk image / data fork\n"); + LOGI("WARNING: ignoring second disk image / data fork"); } } if (threadID == kNuThreadIDRsrcFork) { @@ -405,7 +405,7 @@ NufxEntry::AnalyzeRecord(const NuRecord* pRecord) SetHasRsrcFork(true); SetRsrcForkLen(pThread->actualThreadEOF); } else { - WMSG0("WARNING: ignoring second data fork\n"); + LOGI("WARNING: ignoring second data fork"); } } if (threadID == kNuThreadIDDiskImage) { @@ -413,7 +413,7 @@ NufxEntry::AnalyzeRecord(const NuRecord* pRecord) SetHasDiskImage(true); SetDataForkLen(pThread->actualThreadEOF); } else { - WMSG0("WARNING: ignoring second disk image / data fork\n"); + LOGI("WARNING: ignoring second disk image / data fork"); } } if (threadID == kNuThreadIDComment) { @@ -470,7 +470,7 @@ NufxArchive::AppInit(void) goto bail; } if (bug != kNuVersionBug) { - WMSG2("Different 'bug' version (built vX.X.%d, dll vX.X.%d)\n", + LOGI("Different 'bug' version (built vX.X.%d, dll vX.X.%d)", kNuVersionBug, bug); } @@ -536,7 +536,7 @@ NufxArchive::NufxErrorMsgHandler(NuArchive* /*pArchive*/, void* vErrorMessage) const NuErrorMessage* pErrorMessage = (const NuErrorMessage*) vErrorMessage; LOG_BASE(pErrorMessage->isDebug ? DebugLog::LOG_DEBUG : DebugLog::LOG_WARNING, - pErrorMessage->file, pErrorMessage->line, " %hs\n", + pErrorMessage->file, pErrorMessage->line, " %hs", pErrorMessage->message); return kNuOK; @@ -584,7 +584,7 @@ NufxArchive::ProgressUpdater(NuArchive* pArchive, void* vpProgress) if (pProgress->state == kNuProgressDone) perc = 100; - //WMSG3("Progress: %d%% '%hs' '%hs'\n", perc, + //LOGI("Progress: %d%% '%hs' '%hs'", perc, // oldName == NULL ? "(null)" : oldName, // newName == NULL ? "(null)" : newName); @@ -595,12 +595,12 @@ NufxArchive::ProgressUpdater(NuArchive* pArchive, void* vpProgress) /* check to see if user hit the "cancel" button on the progress dialog */ if (pProgress->state == kNuProgressAborted) { - WMSG0("(looks like we're aborting)\n"); + LOGI("(looks like we're aborting)"); ASSERT(status == IDCANCEL); } if (status == IDCANCEL) { - WMSG0("Signaling NufxLib to abort\n"); + LOGI("Signaling NufxLib to abort"); return kNuAbort; } else return kNuOK; @@ -623,17 +623,17 @@ NufxArchive::Open(const WCHAR* filename, bool readOnly, CString* pErrMsg) CStringA filenameA(filename); if (!readOnly) { CString tmpname = GenDerivedTempName(filename); - WMSG2("Opening file '%ls' rw (tmp='%ls')\n", filename, (LPCWSTR) tmpname); + LOGI("Opening file '%ls' rw (tmp='%ls')", filename, (LPCWSTR) tmpname); fIsReadOnly = false; CStringA tmpnameA(tmpname); nerr = NuOpenRW(filenameA, tmpnameA, 0, &fpArchive); } if (nerr == kNuErrFileAccessDenied || nerr == EACCES) { - WMSG0("Read-write failed with access denied, trying read-only\n"); + LOGI("Read-write failed with access denied, trying read-only"); readOnly = true; } if (readOnly) { - WMSG1("Opening file '%ls' ro\n", (LPCWSTR) filename); + LOGI("Opening file '%ls' ro", (LPCWSTR) filename); fIsReadOnly = true; nerr = NuOpenRO(filenameA, &fpArchive); } @@ -641,7 +641,7 @@ NufxArchive::Open(const WCHAR* filename, bool readOnly, CString* pErrMsg) errMsg.Format(L"Unable to open '%ls': %hs", filename, NuStrError(nerr)); goto bail; } else { - //WMSG0("FILE OPEN SUCCESS\n"); + //LOGI("FILE OPEN SUCCESS"); } nerr = SetCallbacks(); @@ -682,7 +682,7 @@ NufxArchive::New(const WCHAR* filename, const void* options) ASSERT(options == NULL); CString tmpname = GenDerivedTempName(filename); - WMSG2("Creating file '%ls' (tmp='%ls')\n", filename, (LPCWSTR) tmpname); + LOGI("Creating file '%ls' (tmp='%ls')", filename, (LPCWSTR) tmpname); fIsReadOnly = false; CStringA filenameA(filename); CStringA tmpnameA(tmpname); @@ -691,7 +691,7 @@ NufxArchive::New(const WCHAR* filename, const void* options) retmsg.Format(L"Unable to open '%ls': %hs", filename, NuStrError(nerr)); goto bail; } else { - WMSG0("NEW FILE SUCCESS\n"); + LOGI("NEW FILE SUCCESS"); } @@ -757,10 +757,10 @@ NufxArchive::PreferencesChanged(void) val = pPreferences->GetPrefBool(kPrMimicShrinkIt); nerr = NuSetValue(fpArchive, kNuValueMimicSHK, val); if (nerr != kNuErrNone) { - WMSG2("NuSetValue(kNuValueMimicSHK, %d) failed, err=%d\n", val, nerr); + LOGI("NuSetValue(kNuValueMimicSHK, %d) failed, err=%d", val, nerr); ASSERT(false); } else { - WMSG1("Set MimicShrinkIt to %d\n", val); + LOGI("Set MimicShrinkIt to %d", val); } val = pPreferences->GetPrefBool(kPrReduceSHKErrorChecks); @@ -821,7 +821,7 @@ NufxArchive::LoadContents(void) long counter = 0; NuError result; - WMSG0("NufxArchive LoadContents\n"); + LOGI("NufxArchive LoadContents"); ASSERT(fpArchive != NULL); { @@ -965,7 +965,7 @@ NufxArchive::DateTimeToSeconds(const NuDateTime* pDateTime) * assert won't be present in the shipping version, but it's annoying * during debugging. */ - //WMSG1(" Ignoring funky year %ld\n", year); + //LOGI(" Ignoring funky year %ld", year); return kDateInvalid; } if (pDateTime->month > 11) @@ -1016,9 +1016,9 @@ NufxArchive::BulkAdd(ActionProgressDialog* pActionProgress, WCHAR curDir[MAX_PATH] = L""; bool retVal = false; - WMSG2("Opts: '%ls' typePres=%d\n", (LPCWSTR) pAddOpts->fStoragePrefix, + LOGI("Opts: '%ls' typePres=%d", (LPCWSTR) pAddOpts->fStoragePrefix, pAddOpts->fTypePreservation); - WMSG3(" sub=%d strip=%d ovwr=%d\n", + LOGI(" sub=%d strip=%d ovwr=%d", pAddOpts->fIncludeSubfolders, pAddOpts->fStripFolderNames, pAddOpts->fOverwriteExisting); @@ -1031,7 +1031,7 @@ NufxArchive::BulkAdd(ActionProgressDialog* pActionProgress, fNumAdded = 0; const WCHAR* buf = pAddOpts->GetFileNames(); - WMSG2("Selected path = '%ls' (offset=%d)\n", buf, + LOGI("Selected path = '%ls' (offset=%d)", buf, pAddOpts->GetFileNameOffset()); if (GetCurrentDirectory(NELEM(curDir), curDir) == 0) { @@ -1047,7 +1047,7 @@ NufxArchive::BulkAdd(ActionProgressDialog* pActionProgress, buf += pAddOpts->GetFileNameOffset(); while (*buf != '\0') { - WMSG1(" file '%ls'\n", buf); + LOGI(" file '%ls'", buf); /* this just provides the list of files to NufxLib */ nerr = AddFile(pAddOpts, buf, &errMsg); @@ -1119,11 +1119,11 @@ NufxArchive::AddDisk(ActionProgressDialog* pActionProgress, bool retVal = false; CStringA storageNameA, origNameA; - WMSG2("AddDisk: '%ls' %d\n", pAddOpts->GetFileNames(), + LOGI("AddDisk: '%ls' %d", pAddOpts->GetFileNames(), pAddOpts->GetFileNameOffset()); - WMSG2("Opts: '%ls' type=%d\n", (LPCWSTR) pAddOpts->fStoragePrefix, + LOGI("Opts: '%ls' type=%d", (LPCWSTR) pAddOpts->fStoragePrefix, pAddOpts->fTypePreservation); - WMSG3(" sub=%d strip=%d ovwr=%d\n", + LOGI(" sub=%d strip=%d ovwr=%d", pAddOpts->fIncludeSubfolders, pAddOpts->fStripFolderNames, pAddOpts->fOverwriteExisting); @@ -1144,7 +1144,7 @@ NufxArchive::AddDisk(ActionProgressDialog* pActionProgress, const WCHAR* buf; buf = pAddOpts->GetFileNames(); - WMSG2("Selected path = '%ls' (offset=%d)\n", buf, + LOGI("Selected path = '%ls' (offset=%d)", buf, pAddOpts->GetFileNameOffset()); if (GetCurrentDirectory(NELEM(curDir), curDir) == 0) { @@ -1159,7 +1159,7 @@ NufxArchive::AddDisk(ActionProgressDialog* pActionProgress, } buf += pAddOpts->GetFileNameOffset(); - WMSG1(" file '%ls'\n", buf); + LOGI(" file '%ls'", buf); /* strip off preservation stuff, and ignore it */ pathProp.Init(buf); @@ -1300,7 +1300,7 @@ retry: } else if (err == kNuErrSkipped) { /* "maybe overwrite" UI causes this if user declines */ // fall through with the error - WMSG1("DoAddFile: skipped '%ls'\n", (LPCWSTR) pDetails->origName); + LOGI("DoAddFile: skipped '%ls'", (LPCWSTR) pDetails->origName); } else if (err == kNuErrRecordExists) { AddClashDialog dlg; @@ -1311,11 +1311,11 @@ retry: goto bail_quiet; } if (dlg.fDoRename) { - WMSG1("add clash: rename to '%ls'\n", (LPCWSTR) dlg.fNewName); + LOGD("add clash: rename to '%ls'", (LPCWSTR) dlg.fNewName); pDetails->storageName = dlg.fNewName; goto retry; } else { - WMSG0("add clash: skip"); + LOGD("add clash: skip"); err = kNuErrSkipped; // fall through with error } @@ -1358,7 +1358,7 @@ NufxArchive::AddPrep(CWnd* pMsgWnd, const AddFilesDialog* pAddOpts) nerr = NuSetValue(fpArchive, kNuValueDataCompression, defaultCompression + kNuCompressNone); if (nerr != kNuErrNone) { - WMSG1("GLITCH: unable to set compression type to %d\n", + LOGI("GLITCH: unable to set compression type to %d", defaultCompression); /* keep going */ } @@ -1532,13 +1532,13 @@ NufxArchive::TestSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) ASSERT(fpArchive != NULL); - WMSG1("Testing %d entries\n", pSelSet->GetNumEntries()); + LOGI("Testing %d entries", pSelSet->GetNumEntries()); SelectionEntry* pSelEntry = pSelSet->IterNext(); while (pSelEntry != NULL) { pEntry = (NufxEntry*) pSelEntry->GetEntry(); - WMSG2(" Testing %ld '%ls'\n", pEntry->GetRecordIdx(), + LOGI(" Testing %ld '%ls'", pEntry->GetRecordIdx(), pEntry->GetPathName()); nerr = NuTestRecord(fpArchive, pEntry->GetRecordIdx()); if (nerr != kNuErrNone) { @@ -1589,14 +1589,14 @@ NufxArchive::DeleteSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) ASSERT(fpArchive != NULL); - WMSG1("Deleting %d entries\n", pSelSet->GetNumEntries()); + LOGI("Deleting %d entries", pSelSet->GetNumEntries()); /* mark entries for deletion */ SelectionEntry* pSelEntry = pSelSet->IterNext(); while (pSelEntry != NULL) { pEntry = (NufxEntry*) pSelEntry->GetEntry(); - WMSG2(" Deleting %ld '%ls'\n", pEntry->GetRecordIdx(), + LOGI(" Deleting %ld '%ls'", pEntry->GetRecordIdx(), pEntry->GetPathName()); nerr = NuDeleteRecord(fpArchive, pEntry->GetRecordIdx()); if (nerr != kNuErrNone) { @@ -1647,7 +1647,7 @@ NufxArchive::RenameSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) ASSERT(fpArchive != NULL); - WMSG1("Renaming %d entries\n", pSelSet->GetNumEntries()); + LOGI("Renaming %d entries", pSelSet->GetNumEntries()); /* * Figure out if we're allowed to change the entire path. (This is @@ -1656,7 +1656,7 @@ NufxArchive::RenameSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) long cap = GetCapability(GenericArchive::kCapCanRenameFullPath); bool renameFullPath = (cap != 0); - WMSG1("Rename, fullpath=%d\n", renameFullPath); + LOGI("Rename, fullpath=%d", renameFullPath); /* * For each item in the selection set, bring up the "rename" dialog, @@ -1670,7 +1670,7 @@ NufxArchive::RenameSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) SelectionEntry* pSelEntry = pSelSet->IterNext(); while (pSelEntry != NULL) { NufxEntry* pEntry = (NufxEntry*) pSelEntry->GetEntry(); - WMSG1(" Renaming '%ls'\n", pEntry->GetPathName()); + LOGI(" Renaming '%ls'", pEntry->GetPathName()); RenameEntryDialog renameDlg(pMsgWnd); renameDlg.SetCanRenameFullPath(renameFullPath); @@ -1693,14 +1693,14 @@ NufxArchive::RenameSelection(CWnd* pMsgWnd, SelectionSet* pSelSet) ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED); break; } - WMSG2("Rename of '%ls' to '%ls' succeeded\n", + LOGI("Rename of '%ls' to '%ls' succeeded", pEntry->GetDisplayName(), (LPCWSTR) renameDlg.fNewName); } else if (result == IDCANCEL) { - WMSG0("Canceling out of remaining renames\n"); + LOGI("Canceling out of remaining renames"); break; } else { /* 3rd possibility is IDIGNORE, i.e. skip this entry */ - WMSG1("Skipping rename of '%ls'\n", pEntry->GetDisplayName()); + LOGI("Skipping rename of '%ls'", pEntry->GetDisplayName()); } pSelEntry = pSelSet->IterNext(); @@ -1820,7 +1820,7 @@ NufxArchive::RecompressSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, nerr = NuSetValue(fpArchive, kNuValueDataCompression, pRecompOpts->fCompressionType + kNuCompressNone); if (nerr != kNuErrNone) { - WMSG1("GLITCH: unable to set compression type to %d\n", + LOGI("GLITCH: unable to set compression type to %d", pRecompOpts->fCompressionType); /* keep going */ } @@ -1877,7 +1877,7 @@ NufxArchive::RecompressSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, NuStrError(nerr)); ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED); } else { - WMSG0("Cancelled out of sub-flush/compress\n"); + LOGI("Cancelled out of sub-flush/compress"); } /* see if it got converted to read-only status */ @@ -1911,7 +1911,7 @@ NufxArchive::RecompressSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, NuStrError(nerr)); ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED); } else { - WMSG0("Cancelled out of flush/compress\n"); + LOGI("Cancelled out of flush/compress"); } /* see if it got converted to read-only status */ @@ -1950,7 +1950,7 @@ NufxArchive::RecompressThread(NufxEntry* pEntry, int threadKind, char* buf = NULL; long len = 0; - WMSG2(" Recompressing %ld '%ls'\n", pEntry->GetRecordIdx(), + LOGI(" Recompressing %ld '%ls'", pEntry->GetRecordIdx(), pEntry->GetDisplayName()); /* get a copy of the thread header */ @@ -1964,7 +1964,7 @@ NufxArchive::RecompressThread(NufxEntry* pEntry, int threadKind, /* if it's already in the target format, skip it */ if (thread.thThreadFormat == pRecompOpts->fCompressionType) { - WMSG2("Skipping (fmt=%d) '%ls'\n", + LOGI("Skipping (fmt=%d) '%ls'", pRecompOpts->fCompressionType, pEntry->GetDisplayName()); return true; } @@ -1973,7 +1973,7 @@ NufxArchive::RecompressThread(NufxEntry* pEntry, int threadKind, int result; result = pEntry->ExtractThreadToBuffer(threadKind, &buf, &len, &subErrMsg); if (result == IDCANCEL) { - WMSG0("Cancelled during extract!\n"); + LOGI("Cancelled during extract!"); ASSERT(buf == NULL); goto bail; /* abort anything that was pending */ } else if (result != IDOK) { @@ -1995,7 +1995,7 @@ NufxArchive::RecompressThread(NufxEntry* pEntry, int threadKind, buf = NULL; // data source owns it now /* delete the existing thread */ - //WMSG1("+++ DELETE threadIdx=%d\n", thread.threadIdx); + //LOGI("+++ DELETE threadIdx=%d", thread.threadIdx); nerr = NuDeleteThread(fpArchive, thread.threadIdx); if (nerr != kNuErrNone) { pErrMsg->Format(L"Unable to delete thread %d: %hs", @@ -2004,7 +2004,7 @@ NufxArchive::RecompressThread(NufxEntry* pEntry, int threadKind, } /* mark the new thread for addition */ - //WMSG1("+++ ADD threadID=0x%08lx\n", threadID); + //LOGI("+++ ADD threadID=0x%08lx", threadID); nerr = NuAddThread(fpArchive, pEntry->GetRecordIdx(), threadID, pSource, NULL); if (nerr != kNuErrNone) { @@ -2041,7 +2041,7 @@ GenericArchive::XferStatus NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, ActionProgressDialog* pActionProgress, const XferFileOptions* pXferOpts) { - WMSG0("NufxArchive XferSelection!\n"); + LOGI("NufxArchive XferSelection!"); XferStatus retval = kXferFailed; unsigned char* dataBuf = NULL; unsigned char* rsrcBuf = NULL; @@ -2061,12 +2061,12 @@ NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, /* in case we start handling CRC errors better */ if (pEntry->GetDamaged()) { - WMSG1(" XFER skipping damaged entry '%ls'\n", + LOGI(" XFER skipping damaged entry '%ls'", pEntry->GetDisplayName()); continue; } - WMSG1(" XFER converting '%ls'\n", pEntry->GetDisplayName()); + LOGI(" XFER converting '%ls'", pEntry->GetDisplayName()); fileDetails.storageName = pEntry->GetDisplayName(); fileDetails.fileType = pEntry->GetFileType(); @@ -2104,7 +2104,7 @@ NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, result = pEntry->ExtractThreadToBuffer(GenericEntry::kDataThread, (char**) &dataBuf, &dataLen, &errMsg); if (result == IDCANCEL) { - WMSG0("Cancelled during data extract!\n"); + LOGI("Cancelled during data extract!"); retval = kXferCancelled; goto bail; /* abort anything that was pending */ } else if (result != IDOK) { @@ -2126,7 +2126,7 @@ NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, result = pEntry->ExtractThreadToBuffer(GenericEntry::kDiskImageThread, (char**) &dataBuf, &dataLen, &errMsg); if (result == IDCANCEL) { - WMSG0("Cancelled during data extract!\n"); + LOGI("Cancelled during data extract!"); goto bail; /* abort anything that was pending */ } else if (result != IDOK) { dispMsg.Format(L"Failed while extracting '%ls': %ls.", @@ -2149,7 +2149,7 @@ NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, result = pEntry->ExtractThreadToBuffer(GenericEntry::kRsrcThread, (char**) &rsrcBuf, &rsrcLen, &errMsg); if (result == IDCANCEL) { - WMSG0("Cancelled during rsrc extract!\n"); + LOGI("Cancelled during rsrc extract!"); goto bail; /* abort anything that was pending */ } else if (result != IDOK) { dispMsg.Format(L"Failed while extracting '%ls': %ls.", @@ -2164,7 +2164,7 @@ NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, } if (dataLen < 0 && rsrcLen < 0) { - WMSG1(" XFER: WARNING: nothing worth transferring in '%ls'\n", + LOGI(" XFER: WARNING: nothing worth transferring in '%ls'", pEntry->GetDisplayName()); continue; } @@ -2172,7 +2172,7 @@ NufxArchive::XferSelection(CWnd* pMsgWnd, SelectionSet* pSelSet, errMsg = pXferOpts->fTarget->XferFile(&fileDetails, &dataBuf, dataLen, &rsrcBuf, rsrcLen); if (!errMsg.IsEmpty()) { - WMSG0("XferFile failed!\n"); + LOGI("XferFile failed!"); errMsg.Format(L"Failed while transferring '%ls': %ls.", pEntry->GetDisplayName(), (LPCWSTR) errMsg); ShowFailureMsg(pMsgWnd, errMsg, IDS_FAILED); @@ -2208,7 +2208,7 @@ bail: void NufxArchive::XferPrepare(const XferFileOptions* pXferOpts) { - WMSG0(" NufxArchive::XferPrepare\n"); + LOGI(" NufxArchive::XferPrepare"); (void) NuSetValue(fpArchive, kNuValueAllowDuplicates, true); } @@ -2231,8 +2231,8 @@ NufxArchive::XferFile(FileDetails* pDetails, unsigned char** pDataBuf, NuDataSource* pSource = NULL; CString errMsg; - WMSG1(" NufxArchive::XferFile '%ls'\n", (LPCWSTR) pDetails->storageName); - WMSG4(" dataBuf=0x%08lx dataLen=%ld rsrcBuf=0x%08lx rsrcLen=%ld\n", + LOGI(" NufxArchive::XferFile '%ls'", (LPCWSTR) pDetails->storageName); + LOGI(" dataBuf=0x%08lx dataLen=%ld rsrcBuf=0x%08lx rsrcLen=%ld", *pDataBuf, dataLen, *pRsrcBuf, rsrcLen); ASSERT(pDataBuf != NULL); ASSERT(pRsrcBuf != NULL); @@ -2293,7 +2293,7 @@ NufxArchive::XferFile(FileDetails* pDetails, unsigned char** pDataBuf, pDetails->fileType == kFileTypeTXT && DiskImg::UsesDOSFileStructure(pDetails->fileSysFmt)) { - WMSG1(" Stripping high ASCII from '%ls'\n", + LOGI(" Stripping high ASCII from '%ls'", (LPCWSTR) pDetails->storageName); unsigned char* ucp = *pDataBuf; long len = dataLen; @@ -2369,7 +2369,7 @@ NufxArchive::XferAbort(CWnd* pMsgWnd) NuError nerr; CString errMsg; - WMSG0(" NufxArchive::XferAbort\n"); + LOGI(" NufxArchive::XferAbort"); nerr = NuAbort(fpArchive); if (nerr != kNuErrNone) { @@ -2387,7 +2387,7 @@ NufxArchive::XferFinish(CWnd* pMsgWnd) NuError nerr; CString errMsg; - WMSG0(" NufxArchive::XferFinish\n"); + LOGI(" NufxArchive::XferFinish"); /* actually do the work */ long statusFlags; @@ -2441,7 +2441,7 @@ NufxArchive::GetComment(CWnd* pMsgWnd, const GenericEntry* pGenericEntry, result = pEntry->ExtractThreadToBuffer(GenericEntry::kCommentThread, &buf, &len, &errMsg); if (result != IDOK) { - WMSG1("Failed getting comment: %hs\n", buf); + LOGI("Failed getting comment: %hs", buf); ASSERT(buf == NULL); return false; } @@ -2569,7 +2569,7 @@ NufxArchive::SetComment(CWnd* pMsgWnd, GenericEntry* pGenericEntry, bail: NuFreeDataSource(pSource); if (!retVal) { - WMSG1("FAILED: %ls\n", (LPCWSTR) errMsg); + LOGI("FAILED: %ls", (LPCWSTR) errMsg); NuAbort(fpArchive); } return retVal; @@ -2616,7 +2616,7 @@ NufxArchive::DeleteComment(CWnd* pMsgWnd, GenericEntry* pGenericEntry) bail: if (retVal != 0) { - WMSG1("FAILED: %ls\n", (LPCWSTR) errMsg); + LOGI("FAILED: %ls", (LPCWSTR) errMsg); NuAbort(fpArchive); } return retVal; @@ -2643,12 +2643,12 @@ NufxArchive::SetProps(CWnd* pMsgWnd, GenericEntry* pEntry, const NuRecord* pRecord; NuRecordAttr recordAttr; - WMSG3(" SET fileType=0x%02x auxType=0x%04x access=0x%02x\n", + LOGI(" SET fileType=0x%02x auxType=0x%04x access=0x%02x", pProps->fileType, pProps->auxType, pProps->access); nerr = NuGetRecord(fpArchive, pNufxEntry->GetRecordIdx(), &pRecord); if (nerr != kNuErrNone) { - WMSG2("ERROR: couldn't find recordIdx %ld: %hs\n", + LOGI("ERROR: couldn't find recordIdx %ld: %hs", pNufxEntry->GetRecordIdx(), NuStrError(nerr)); return false; } @@ -2660,7 +2660,7 @@ NufxArchive::SetProps(CWnd* pMsgWnd, GenericEntry* pEntry, nerr = NuSetRecordAttr(fpArchive, pNufxEntry->GetRecordIdx(), &recordAttr); if (nerr != kNuErrNone) { - WMSG2("ERROR: couldn't set recordAttr %ld: %hs\n", + LOGI("ERROR: couldn't set recordAttr %ld: %hs", pNufxEntry->GetRecordIdx(), NuStrError(nerr)); return false; } @@ -2668,7 +2668,7 @@ NufxArchive::SetProps(CWnd* pMsgWnd, GenericEntry* pEntry, long statusFlags; nerr = NuFlush(fpArchive, &statusFlags); if (nerr != kNuErrNone) { - WMSG1("ERROR: NuFlush failed: %hs\n", NuStrError(nerr)); + LOGI("ERROR: NuFlush failed: %hs", NuStrError(nerr)); /* see if it got converted to read-only status */ if (statusFlags & kNuFlushReadOnly) @@ -2676,7 +2676,7 @@ NufxArchive::SetProps(CWnd* pMsgWnd, GenericEntry* pEntry, return false; } - WMSG0("Props set\n"); + LOGI("Props set"); /* do this in lieu of reloading GenericArchive */ pEntry->SetFileType(pProps->fileType); diff --git a/app/NufxArchive.h b/app/NufxArchive.h index 64d1dbf..fda5531 100644 --- a/app/NufxArchive.h +++ b/app/NufxArchive.h @@ -124,7 +124,7 @@ public: private: virtual CString Close(void) { if (fpArchive != NULL) { - WMSG0("Closing archive (aborting any un-flushed changes)\n"); + LOGI("Closing archive (aborting any un-flushed changes)"); NuAbort(fpArchive); NuClose(fpArchive); fpArchive = NULL; diff --git a/app/OpenVolumeDialog.cpp b/app/OpenVolumeDialog.cpp index 21be641..9406a87 100644 --- a/app/OpenVolumeDialog.cpp +++ b/app/OpenVolumeDialog.cpp @@ -62,7 +62,7 @@ OpenVolumeDialog::OnInitDialog(void) if (defaultFilter >= kBoth && defaultFilter <= kPhysical) pCombo->SetCurSel(defaultFilter); else { - WMSG1("GLITCH: invalid defaultFilter in prefs (%d)\n", defaultFilter); + LOGI("GLITCH: invalid defaultFilter in prefs (%d)", defaultFilter); pCombo->SetCurSel(kLogical); } @@ -92,7 +92,7 @@ void OpenVolumeDialog::DoDataExchange(CDataExchange* pDX) { DDX_Check(pDX, IDC_OPENVOL_READONLY, fReadOnly); - WMSG1("DoDataExchange: fReadOnly==%d\n", fReadOnly); + LOGI("DoDataExchange: fReadOnly==%d", fReadOnly); } /* @@ -140,10 +140,10 @@ OpenVolumeDialog::LoadLogicalDriveList(CListCtrl* pListView, int* pItemIndex) drivesAvailable = GetLogicalDrives(); if (drivesAvailable == 0) { - WMSG1("GetLogicalDrives failed, err=0x%08lx\n", drivesAvailable); + LOGI("GetLogicalDrives failed, err=0x%08lx", drivesAvailable); return false; } - WMSG1("GetLogicalDrives returned 0x%08lx\n", drivesAvailable); + LOGI("GetLogicalDrives returned 0x%08lx", drivesAvailable); // SetErrorMode(SEM_FAILCRITICALERRORS) @@ -188,13 +188,13 @@ OpenVolumeDialog::LoadLogicalDriveList(CListCtrl* pListView, int* pItemIndex) // The drive is a RAM disk. break; default: - WMSG1("UNKNOWN DRIVE TYPE %d\n", driveType); + LOGI("UNKNOWN DRIVE TYPE %d", driveType); break; } if (driveType == DRIVE_CDROM && !DiskImgLib::Global::GetHasSPTI()) { /* use "physical" device via ASPI instead */ - WMSG1("Not including CD-ROM '%ls' in logical drive list\n", + LOGI("Not including CD-ROM '%ls' in logical drive list", driveName); continue; } @@ -216,7 +216,7 @@ OpenVolumeDialog::LoadLogicalDriveList(CListCtrl* pListView, int* pItemIndex) } else if (err == ERROR_NOT_READY) { // Win2K: device exists but no media loaded if (isWin9x) { - WMSG1("Not showing drive '%ls': not ready\n", + LOGI("Not showing drive '%ls': not ready", driveName); continue; // safer not to show it } else @@ -225,12 +225,12 @@ OpenVolumeDialog::LoadLogicalDriveList(CListCtrl* pListView, int* pItemIndex) err == ERROR_INVALID_DATA /*Win98*/) { // Win2K/Win98: device letter not in use - WMSG1("GetVolumeInformation '%ls': nothing there\n", + LOGI("GetVolumeInformation '%ls': nothing there", driveName); continue; } else if (err == ERROR_INVALID_PARAMETER) { // Win2K: device is already open - //WMSG1("GetVolumeInformation '%ls': currently open??\n", + //LOGI("GetVolumeInformation '%ls': currently open??", // driveName); errorComment = L"(currently open?)"; //continue; @@ -241,7 +241,7 @@ OpenVolumeDialog::LoadLogicalDriveList(CListCtrl* pListView, int* pItemIndex) // Win98: floppy format not recognzied // --> we don't want to access ProDOS floppies via A: in // Win98, so we skip it here - WMSG1("GetVolumeInformation '%ls': general failure\n", + LOGI("GetVolumeInformation '%ls': general failure", driveName); continue; } else if (err == ERROR_INVALID_FUNCTION) { @@ -251,7 +251,7 @@ OpenVolumeDialog::LoadLogicalDriveList(CListCtrl* pListView, int* pItemIndex) else errorComment = L"(invalid disc?)"; } else { - WMSG2("GetVolumeInformation '%ls' failed: %ld\n", + LOGI("GetVolumeInformation '%ls' failed: %ld", driveName, GetLastError()); continue; } @@ -274,10 +274,10 @@ OpenVolumeDialog::LoadLogicalDriveList(CListCtrl* pListView, int* pItemIndex) pListView->InsertItem(itemIndex, entryName); pListView->SetItemText(itemIndex, 1, entryRemarks); pListView->SetItemData(itemIndex, (DWORD) i + 'A'); -//WMSG1("%%%% added logical %d\n", itemIndex); +//LOGI("%%%% added logical %d", itemIndex); itemIndex++; } else { - WMSG1(" (drive %c not available)\n", i + 'A'); + LOGI(" (drive %c not available)", i + 'A'); } } @@ -317,7 +317,7 @@ OpenVolumeDialog::LoadPhysicalDriveList(CListCtrl* pListView, int* pItemIndex) pListView->InsertItem(itemIndex, driveName); pListView->SetItemText(itemIndex, 1, remark); pListView->SetItemData(itemIndex, (DWORD) i); -//WMSG1("%%%% added floppy %d\n", itemIndex); +//LOGI("%%%% added floppy %d", itemIndex); itemIndex++; } } @@ -331,7 +331,7 @@ OpenVolumeDialog::LoadPhysicalDriveList(CListCtrl* pListView, int* pItemIndex) pListView->InsertItem(itemIndex, driveName); pListView->SetItemText(itemIndex, 1, remark); pListView->SetItemData(itemIndex, (DWORD) i + 128); -//WMSG1("%%%% added HD %d\n", itemIndex); +//LOGI("%%%% added HD %d", itemIndex); itemIndex++; } } @@ -352,7 +352,7 @@ OpenVolumeDialog::LoadPhysicalDriveList(CListCtrl* pListView, int* pItemIndex) } if (DiskImgLib::Global::GetHasASPI()) { - WMSG0("IGNORING ASPI"); + LOGI("IGNORING ASPI"); #if 0 // can we remove this? DIError dierr; DiskImgLib::ASPI* pASPI = DiskImgLib::Global::GetASPI(); @@ -363,7 +363,7 @@ OpenVolumeDialog::LoadPhysicalDriveList(CListCtrl* pListView, int* pItemIndex) ASPI::kDevMaskCDROM | ASPI::kDevMaskHardDrive, &deviceArray, &numDevices); if (dierr == kDIErrNone) { - WMSG1("Adding %d ASPI CD-ROM devices\n", numDevices); + LOGI("Adding %d ASPI CD-ROM devices", numDevices); for (i = 0; i < numDevices; i++) { CString driveName, remark; CString addr, vendor, product; @@ -390,7 +390,7 @@ OpenVolumeDialog::LoadPhysicalDriveList(CListCtrl* pListView, int* pItemIndex) (DWORD) deviceArray[i].GetAdapter() << 16 | (DWORD) deviceArray[i].GetTarget() << 8 | (DWORD) deviceArray[i].GetLun(); - //WMSG2("ADDR for '%s' is 0x%08lx\n", + //LOGI("ADDR for '%s' is 0x%08lx", // (const char*) driveName, aspiAddr); pListView->InsertItem(itemIndex, driveName); @@ -442,7 +442,7 @@ OpenVolumeDialog::HasPhysicalDriveWin9x(int unit, CString* pRemark) handle = CreateFile(L"\\\\.\\vwin32", 0, 0, NULL, OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, NULL); if (handle == INVALID_HANDLE_VALUE) { - WMSG1(" Unable to open vwin32: %ld\n", ::GetLastError()); + LOGI(" Unable to open vwin32: %ld", ::GetLastError()); return false; } @@ -451,7 +451,7 @@ OpenVolumeDialog::HasPhysicalDriveWin9x(int unit, CString* pRemark) reg.reg_EDX = MAKEWORD(unit, 0); // specify driver result = DeviceIoControl(handle, VWIN32_DIOC_DOS_INT13, ®, sizeof(reg), ®, sizeof(reg), &cb, 0); - WMSG3(" DriveReset(drive=0x%02x) result=%d carry=%d\n", + LOGI(" DriveReset(drive=0x%02x) result=%d carry=%d", unit, result, reg.reg_Flags & CARRY_FLAG); #endif @@ -467,9 +467,9 @@ OpenVolumeDialog::HasPhysicalDriveWin9x(int unit, CString* pRemark) if (result == 0 || (reg.reg_Flags & CARRY_FLAG)) { int ah = HIBYTE(reg.reg_EAX); - WMSG4(" DevIoCtrl(unit=%02xh) failed: result=%d lastErr=%d Flags=0x%08lx\n", + LOGI(" DevIoCtrl(unit=%02xh) failed: result=%d lastErr=%d Flags=0x%08lx", unit, result, lastError, reg.reg_Flags); - WMSG3(" AH=%d (EAX=0x%08lx) byte=0x%02x\n", ah, reg.reg_EAX, buf[0]); + LOGI(" AH=%d (EAX=0x%08lx) byte=0x%02x", ah, reg.reg_EAX, buf[0]); if (ah != 1) { // failure code 1 means "invalid parameter", drive doesn't exist // mine returns 128, "timeout", when no disk is in the drive @@ -531,8 +531,8 @@ OpenVolumeDialog::HasPhysicalDriveWin2K(int unit, CString* pRemark) (LPOVERLAPPED) NULL); // synchronous I/O if (result) { diskSize = dge.DiskSize.QuadPart; - WMSG1(" EX results for device %02xh\n", unit); - WMSG2(" Disk size = %I64d (bytes) = %I64d (MB)\n", + LOGI(" EX results for device %02xh", unit); + LOGI(" Disk size = %I64d (bytes) = %I64d (MB)", diskSize, diskSize / (1024*1024)); if (diskSize > 1024*1024*1024) pRemark->Format(L"Size is %.2fGB", @@ -542,7 +542,7 @@ OpenVolumeDialog::HasPhysicalDriveWin2K(int unit, CString* pRemark) (double) diskSize / (1024.0 * 1024.0)); } else { // Win2K shows ERROR_INVALID_FUNCTION or ERROR_NOT_SUPPORTED - WMSG1("IOCTL_DISK_GET_DRIVE_GEOMETRY_EX failed, error was %ld\n", + LOGI("IOCTL_DISK_GET_DRIVE_GEOMETRY_EX failed, error was %ld", GetLastError()); result = ::DeviceIoControl(hDevice, // device to be queried IOCTL_DISK_GET_DRIVE_GEOMETRY, // operation to perform @@ -552,15 +552,15 @@ OpenVolumeDialog::HasPhysicalDriveWin2K(int unit, CString* pRemark) (LPOVERLAPPED) NULL); // synchronous I/O if (result) { - WMSG1(" Results for device %02xh\n", unit); - WMSG1(" Cylinders = %I64d\n", dg.Cylinders); - WMSG1(" Tracks per cylinder = %ld\n", (ULONG) dg.TracksPerCylinder); - WMSG1(" Sectors per track = %ld\n", (ULONG) dg.SectorsPerTrack); - WMSG1(" Bytes per sector = %ld\n", (ULONG) dg.BytesPerSector); + LOGI(" Results for device %02xh", unit); + LOGI(" Cylinders = %I64d", dg.Cylinders); + LOGI(" Tracks per cylinder = %ld", (ULONG) dg.TracksPerCylinder); + LOGI(" Sectors per track = %ld", (ULONG) dg.SectorsPerTrack); + LOGI(" Bytes per sector = %ld", (ULONG) dg.BytesPerSector); diskSize = dg.Cylinders.QuadPart * (ULONG)dg.TracksPerCylinder * (ULONG)dg.SectorsPerTrack * (ULONG)dg.BytesPerSector; - WMSG2("Disk size = %I64d (bytes) = %I64d (MB)\n", diskSize, + LOGI("Disk size = %I64d (bytes) = %I64d (MB)", diskSize, diskSize / (1024 * 1024)); if (diskSize > 1024*1024*1024) pRemark->Format(L"Size is %.2fGB", @@ -576,7 +576,7 @@ OpenVolumeDialog::HasPhysicalDriveWin2K(int unit, CString* pRemark) ::CloseHandle(hDevice); if (!result) { - WMSG1("DeviceIoControl(IOCTL_DISK_GET_DRIVE_GEOMETRY) failed (err=%ld)\n", + LOGI("DeviceIoControl(IOCTL_DISK_GET_DRIVE_GEOMETRY) failed (err=%ld)", err); *pRemark = "Not ready"; } @@ -594,7 +594,7 @@ OpenVolumeDialog::OnListChange(NMHDR*, LRESULT* pResult) CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_VOLUME_LIST); CButton* pButton = (CButton*) GetDlgItem(IDOK); pButton->EnableWindow(pListView->GetSelectedCount() != 0); - //WMSG1("ENABLE %d\n", pListView->GetSelectedCount() != 0); + //LOGI("ENABLE %d", pListView->GetSelectedCount() != 0); *pResult = 0; } @@ -624,7 +624,7 @@ OpenVolumeDialog::OnVolumeFilterSelChange(void) { CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_VOLUME_FILTER); ASSERT(pCombo != NULL); - WMSG1("+++ SELECTION IS NOW %d\n", pCombo->GetCurSel()); + LOGI("+++ SELECTION IS NOW %d", pCombo->GetCurSel()); LoadDriveList(); } @@ -708,7 +708,7 @@ OpenVolumeDialog::OnOK(void) Preferences* pPreferences = GET_PREFERENCES_WR(); CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_VOLUME_FILTER); pPreferences->SetPrefLong(kPrVolumeFilter, pCombo->GetCurSel()); - WMSG1("SETTING PREF TO %ld\n", pCombo->GetCurSel()); + LOGI("SETTING PREF TO %ld", pCombo->GetCurSel()); CDialog::OnOK(); } @@ -738,5 +738,5 @@ OpenVolumeDialog::ForceReadOnly(bool readOnly) const pButton->SetCheck(BST_CHECKED); else pButton->SetCheck(BST_UNCHECKED); - WMSG1("FORCED READ ONLY %d\n", readOnly); + LOGI("FORCED READ ONLY %d", readOnly); } diff --git a/app/Preferences.cpp b/app/Preferences.cpp index 6474ee3..d0d5075 100644 --- a/app/Preferences.cpp +++ b/app/Preferences.cpp @@ -152,7 +152,7 @@ const Preferences::PrefMap Preferences::fPrefMaps[kPrefNumLastEntry] = { */ Preferences::Preferences(void) { - WMSG0("Initializing Preferences\n"); + LOGI("Initializing Preferences"); ScanPrefMaps(); // sanity-check the table memset(fValues, 0, sizeof(fValues)); @@ -327,22 +327,22 @@ Preferences::InitTempPath(void) len = ::GetTempPath(NELEM(buf), buf); if (len == 0) { DWORD err = ::GetLastError(); - WMSG1("GetTempPath failed, err=%d\n", err); + LOGI("GetTempPath failed, err=%d", err); tempPath = kDefaultTempPath; } else if (len >= NELEM(buf)) { /* sheesh! */ - WMSG1("GetTempPath wants a %d-unit buffer\n", len); + LOGI("GetTempPath wants a %d-unit buffer", len); tempPath = kDefaultTempPath; } else { tempPath = buf; } PathName path(tempPath); - WMSG1("Temp path is '%ls'\n", tempPath); + LOGI("Temp path is '%ls'", tempPath); path.SFNToLFN(); tempPath = path.GetPathName(); - WMSG1("Temp path (long form) is '%ls'\n", tempPath); + LOGI("Temp path (long form) is '%ls'", tempPath); SetPrefString(kPrTempPath, tempPath); @@ -375,7 +375,7 @@ Preferences::InitFolders(void) SetPrefString(kPrOpenWAVFolder, buf); } - WMSG1("Default folder is '%ls'\n", GetPrefString(kPrExtractFileFolder)); + LOGI("Default folder is '%ls'", GetPrefString(kPrExtractFileFolder)); } /* @@ -395,13 +395,13 @@ Preferences::GetMyDocuments(CString* pPath) hr = SHGetSpecialFolderLocation(NULL, CSIDL_PERSONAL, &pidl); if (FAILED(hr)) { - WMSG0("WARNING: unable to get CSIDL_PERSONAL\n"); + LOGI("WARNING: unable to get CSIDL_PERSONAL"); goto bail; } result = (Pidl::GetPath(pidl, pPath) != FALSE); if (!result) { - WMSG0("WARNING: unable to convert CSIDL_PERSONAL to path\n"); + LOGI("WARNING: unable to convert CSIDL_PERSONAL to path"); /* fall through with "result" */ } @@ -507,7 +507,7 @@ Preferences::ScanPrefMaps(void) /* scan PrefNum */ for (i = 0; i < kPrefNumLastEntry; i++) { if (fPrefMaps[i].num != i) { - WMSG2("HEY: PrefMaps[%d] has num=%d\n", i, fPrefMaps[i].num); + LOGI("HEY: PrefMaps[%d] has num=%d", i, fPrefMaps[i].num); ASSERT(false); break; } @@ -526,7 +526,7 @@ Preferences::ScanPrefMaps(void) wcsicmp(fPrefMaps[i].registrySection, fPrefMaps[j].registrySection) == 0) { - WMSG4("HEY: PrefMaps[%d] and [%d] both have '%ls'/'%ls'\n", + LOGI("HEY: PrefMaps[%d] and [%d] both have '%ls'/'%ls'", i, j, fPrefMaps[i].registrySection, fPrefMaps[i].registryKey); ASSERT(false); @@ -546,7 +546,7 @@ Preferences::LoadFromRegistry(void) bool bval; long lval; - WMSG0("Loading preferences from registry\n"); + LOGI("Loading preferences from registry"); fColumnLayout.LoadFromRegistry(kColumnSect); @@ -572,7 +572,7 @@ Preferences::LoadFromRegistry(void) GetString(fPrefMaps[i].registrySection, fPrefMaps[i].registryKey, sval)); break; default: - WMSG2("Invalid type %d on num=%d\n", fPrefMaps[i].type, i); + LOGI("Invalid type %d on num=%d", fPrefMaps[i].type, i); ASSERT(false); break; } @@ -587,7 +587,7 @@ Preferences::LoadFromRegistry(void) int Preferences::SaveToRegistry(void) { - WMSG0("Saving preferences to registry\n"); + LOGI("Saving preferences to registry"); fColumnLayout.SaveToRegistry(kColumnSect); @@ -610,7 +610,7 @@ Preferences::SaveToRegistry(void) GetPrefString(fPrefMaps[i].num)); break; default: - WMSG2("Invalid type %d on num=%d\n", fPrefMaps[i].type, i); + LOGI("Invalid type %d on num=%d", fPrefMaps[i].type, i); ASSERT(false); break; } diff --git a/app/PrefsDialog.cpp b/app/PrefsDialog.cpp index 3c309dd..3fb6101 100644 --- a/app/PrefsDialog.cpp +++ b/app/PrefsDialog.cpp @@ -65,7 +65,7 @@ PrefsGeneralPage::OnChangeRange(UINT nID) void PrefsGeneralPage::OnDefaults(void) { - WMSG0("DEFAULTS!\n"); + LOGI("DEFAULTS!"); CButton* pButton; @@ -178,7 +178,7 @@ END_MESSAGE_MAP() BOOL PrefsDiskImagePage::OnInitDialog(void) { - //WMSG0("OnInit!\n"); + //LOGI("OnInit!"); return CPropertyPage::OnInitDialog(); } @@ -188,13 +188,13 @@ PrefsDiskImagePage::OnInitDialog(void) void PrefsDiskImagePage::OnChange(void) { - WMSG0("OnChange\n"); + LOGI("OnChange"); SetModified(TRUE); } //void //PrefsDiskImagePage::OnChangeRange(UINT nID) //{ -// WMSG1("OnChangeRange id=%d\n", nID); +// LOGI("OnChangeRange id=%d", nID); // SetModified(TRUE); //} @@ -326,7 +326,7 @@ PrefsCompressionPage::OnChangeRange(UINT nID) void PrefsCompressionPage::DoDataExchange(CDataExchange* pDX) { - //WMSG0("OnInit comp!\n"); + //LOGI("OnInit comp!"); fReady = true; DDX_Radio(pDX, IDC_DEFC_UNCOMPRESSED, fCompressType); } @@ -372,10 +372,10 @@ END_MESSAGE_MAP() BOOL PrefsFviewPage::OnInitDialog(void) { - //WMSG0("OnInit!\n"); + //LOGI("OnInit!"); CSpinButtonCtrl* pSpin; - //WMSG0("Configuring spin\n"); + //LOGI("Configuring spin"); pSpin = (CSpinButtonCtrl*) GetDlgItem(IDC_PVIEW_SIZE_SPIN); ASSERT(pSpin != NULL); @@ -385,7 +385,7 @@ PrefsFviewPage::OnInitDialog(void) uda.nInc = 64; pSpin->SetRange(1, 32767); pSpin->SetAccel(1, &uda); - WMSG0("OnInit done!\n"); + LOGI("OnInit done!"); return CPropertyPage::OnInitDialog(); } @@ -396,13 +396,13 @@ PrefsFviewPage::OnInitDialog(void) void PrefsFviewPage::OnChange(void) { - WMSG0("OnChange\n"); + LOGI("OnChange"); SetModified(TRUE); } void PrefsFviewPage::OnChangeRange(UINT nID) { - WMSG1("OnChangeRange id=%d\n", nID); + LOGI("OnChangeRange id=%d", nID); SetModified(TRUE); } @@ -547,7 +547,7 @@ PrefsFilesPage::OnChooseFolder(void) chooseDir.SetPathName(editPath); if (chooseDir.DoModal() == IDOK) { const WCHAR* ccp = chooseDir.GetPathName(); - WMSG1("New temp path chosen = '%ls'\n", ccp); + LOGI("New temp path chosen = '%ls'", ccp); pEditWnd->SetWindowText(ccp); @@ -614,7 +614,7 @@ PrefsSheet::PrefsSheet(CWnd* pParentWnd) : BOOL PrefsSheet::OnNcCreate(LPCREATESTRUCT cs) { - //WMSG0("PrefsSheet OnNcCreate\n"); + //LOGI("PrefsSheet OnNcCreate"); BOOL val = CPropertySheet::OnNcCreate(cs); ModifyStyleEx(0, WS_EX_CONTEXTHELP); return val; @@ -634,39 +634,39 @@ PrefsSheet::OnApplyNow(void) BOOL result; if (fGeneralPage.fReady) { - //WMSG0("Apply to general?\n"); + //LOGI("Apply to general?"); result = fGeneralPage.UpdateData(TRUE); if (!result) return; } if (fDiskImagePage.fReady) { - //WMSG0("Apply to disk images?\n"); + //LOGI("Apply to disk images?"); result = fDiskImagePage.UpdateData(TRUE); if (!result) return; } if (fCompressionPage.fReady) { - //WMSG0("Apply to compression?\n"); + //LOGI("Apply to compression?"); result = fCompressionPage.UpdateData(TRUE); if (!result) return; } if (fFviewPage.fReady) { - //WMSG0("Apply to fview?\n"); + //LOGI("Apply to fview?"); result = fFviewPage.UpdateData(TRUE); if (!result) return; } if (fFilesPage.fReady) { - //WMSG0("Apply to fview?\n"); + //LOGI("Apply to fview?"); result = fFilesPage.UpdateData(TRUE); if (!result) return; } /* reset all to "unmodified" state */ - WMSG0("All 'applies' were successful\n"); + LOGI("All 'applies' were successful"); ((MainWindow*) AfxGetMainWnd())->ApplyNow(this); fGeneralPage.SetModified(FALSE); fGeneralPage.fDefaultsPushed = false; @@ -692,7 +692,7 @@ PrefsSheet::OnApplyNow(void) void PrefsSheet::OnIDHelp(void) { - WMSG0("PrefsSheet OnIDHelp\n"); + LOGI("PrefsSheet OnIDHelp"); SendMessage(WM_COMMANDHELP); } @@ -705,7 +705,7 @@ PrefsSheet::OnHelp(UINT wParam, LONG lParam) { HELPINFO* lpHelpInfo = (HELPINFO*) lParam; - WMSG0("PrefsSheet OnHelp\n"); + LOGI("PrefsSheet OnHelp"); DWORD context = lpHelpInfo->iCtrlId; WinHelp(context, HELP_CONTEXTPOPUP); diff --git a/app/Print.cpp b/app/Print.cpp index 9d4936b..20184bb 100644 --- a/app/Print.cpp +++ b/app/Print.cpp @@ -40,7 +40,7 @@ PrintStuff::InitBasics(CDC* pDC) fHorzRes = pDC->GetDeviceCaps(HORZRES); fLogPixelsX = pDC->GetDeviceCaps(LOGPIXELSX); fLogPixelsY = pDC->GetDeviceCaps(LOGPIXELSY); - WMSG4("+++ logPixelsX=%d logPixelsY=%d fHorzRes=%d fVertRes=%d\n", + LOGI("+++ logPixelsX=%d logPixelsY=%d fHorzRes=%d fVertRes=%d", fLogPixelsX, fLogPixelsY, fHorzRes, fVertRes); } @@ -60,7 +60,7 @@ PrintStuff::CreateFontByNumLines(CFont* pFont, int numLines) /* magic fudge factor */ int fudge = reqCharHeight / 24; - WMSG2(" Reducing reqCharHeight from %d to %d\n", + LOGI(" Reducing reqCharHeight from %d to %d", reqCharHeight, reqCharHeight - fudge); reqCharHeight -= fudge; @@ -122,7 +122,7 @@ PrintStuff::TrimString(CString* pStr, int width, bool addOnLeft) } if (!addOnLeft) { - WMSG1("Now trying '%ls'\n", (LPCWSTR) newStr); + LOGI("Now trying '%ls'", (LPCWSTR) newStr); } strWidth = StringWidth(newStr); } @@ -158,7 +158,7 @@ PrintContentList::Setup(CDC* pDC, CWnd* pParent) fCharHeight = metrics.tmHeight + metrics.tmExternalLeading; fLinesPerPage = fVertRes / fCharHeight; - WMSG2("fVertRes=%d, fCharHeight=%d\n", fVertRes, fCharHeight); + LOGI("fVertRes=%d, fCharHeight=%d", fVertRes, fCharHeight); /* set up our slightly reduced lines per page */ ASSERT(fLinesPerPage > kHeaderLines+1); @@ -179,7 +179,7 @@ PrintContentList::CalcNumPages(void) fNumPages = (numLines + fCLLinesPerPage -1) / fCLLinesPerPage; ASSERT(fNumPages > 0); - WMSG3("Using numLines=%d, fNumPages=%d, fCLLinesPerPage=%d\n", + LOGI("Using numLines=%d, fNumPages=%d, fCLLinesPerPage=%d", numLines, fNumPages, fCLLinesPerPage); } @@ -234,7 +234,7 @@ PrintContentList::StartPrint(void) CancelDialog* pPCD = new CancelDialog; bres = pPCD->Create(&pMain->fAbortPrinting, IDD_PRINT_CANCEL, fpParentWnd); if (bres == FALSE) { - WMSG0("WARNING: PrintCancelDialog init failed\n"); + LOGI("WARNING: PrintCancelDialog init failed"); } else { fpDC->SetAbortProc(pMain->PrintAbortProc); } @@ -251,17 +251,17 @@ PrintContentList::StartPrint(void) jobID = fpDC->StartDoc(&di); if (jobID <= 0) { - WMSG0("Got invalid jobID from StartDoc\n"); + LOGI("Got invalid jobID from StartDoc"); goto bail; } - WMSG1("Got jobID=%d\n", jobID); + LOGI("Got jobID=%d", jobID); // do the printing if (DoPrint() != 0) { - WMSG0("Printing was aborted\n"); + LOGI("Printing was aborted"); fpDC->AbortDoc(); } else { - WMSG0("Printing was successful\n"); + LOGI("Printing was successful"); fpDC->EndDoc(); result = 0; } @@ -285,11 +285,11 @@ bail: int PrintContentList::DoPrint(void) { - WMSG2("Printing from page=%d to page=%d\n", fFromPage, fToPage); + LOGI("Printing from page=%d to page=%d", fFromPage, fToPage); for (int page = fFromPage; page <= fToPage; page++) { if (fpDC->StartPage() <= 0) { - WMSG0("StartPage returned <= 0, returning -1\n"); + LOGI("StartPage returned <= 0, returning -1"); return -1; } @@ -303,7 +303,7 @@ PrintContentList::DoPrint(void) if (fpDC->EndPage() <= 0) { - WMSG0("EndPage returned <= 0, returning -1\n"); + LOGI("EndPage returned <= 0, returning -1"); return -1; } } @@ -347,7 +347,7 @@ PrintContentList::DoPrintPage(int page) totalWidth += kColumnWidths[i].width; widthMult = (float) fHorzRes / totalWidth; - WMSG3("totalWidth=%d, fHorzRes=%d, mult=%.3f\n", + LOGI("totalWidth=%d, fHorzRes=%d, mult=%.3f", totalWidth, fHorzRes, widthMult); /* @@ -570,7 +570,7 @@ PrintRichEdit::PrintPrep(FORMATRANGE* pFR) fpDC->GetTextMetrics(&metrics); fCharHeight = metrics.tmHeight + metrics.tmExternalLeading; fpDC->SelectObject(pOldFont); - //WMSG1("CHAR HEIGHT is %d\n", fCharHeight); + //LOGI("CHAR HEIGHT is %d", fCharHeight); /* compute fLeftMargin and fRightMargin */ ComputeMargins(); @@ -598,9 +598,9 @@ PrintRichEdit::PrintPrep(FORMATRANGE* pFR) pFR->rc.left = pFR->rcPage.left + (fLeftMargin * kTwipsPerInch) / fLogPixelsX; pFR->rc.right = pFR->rcPage.right - (fRightMargin * kTwipsPerInch) / fLogPixelsX; - WMSG2("PRINTABLE AREA is %d wide x %d high (twips)\n", + LOGI("PRINTABLE AREA is %d wide x %d high (twips)", pFR->rc.right - pFR->rc.left, pFR->rc.bottom - pFR->rc.top); - WMSG2("FRAME is %d wide x %d high (twips)\n", + LOGI("FRAME is %d wide x %d high (twips)", pFR->rcPage.right - pFR->rcPage.left, pFR->rcPage.bottom - pFR->rcPage.top); pFR->chrg.cpMin = fStartChar; @@ -637,7 +637,7 @@ PrintRichEdit::ComputeMargins(void) char80width = StringWidth(str); fpDC->SelectObject(pOldFont); - //WMSG1("char80 string width=%d\n", char80width); + //LOGI("char80 string width=%d", char80width); /* * If there's not enough room on the page, set the margins to zero. @@ -646,10 +646,10 @@ PrintRichEdit::ComputeMargins(void) */ totalMargin = fHorzRes - char80width; if (totalMargin < 0) { - WMSG0(" Page not wide enough, setting margins to zero\n"); + LOGI(" Page not wide enough, setting margins to zero"); fLeftMargin = fRightMargin = 0; } else if (totalMargin > fLogPixelsX * 2) { - WMSG0(" Page too wide, setting margins to 1 inch\n"); + LOGI(" Page too wide, setting margins to 1 inch"); fLeftMargin = fRightMargin = fLogPixelsX; } else { // try to get leftMargin equal to 1/2" @@ -657,7 +657,7 @@ PrintRichEdit::ComputeMargins(void) if (fLeftMargin > fLogPixelsX / 2) fLeftMargin = fLogPixelsX / 2; fRightMargin = totalMargin - fLeftMargin -1; - WMSG3(" +++ Margins (in %d pixels/inch) are left=%ld right=%ld\n", + LOGI(" +++ Margins (in %d pixels/inch) are left=%ld right=%ld", fLogPixelsX, fLeftMargin, fRightMargin); } } @@ -676,8 +676,8 @@ PrintRichEdit::DoPrint(CRichEditCtrl* pREC, const WCHAR* title, long textLength, textPrinted, lastTextPrinted; int pageNum; - WMSG2("DoPrint: title='%ls' doPrint=%d\n", title, doPrint); - WMSG4(" startChar=%d endChar=%d startPage=%d endPage=%d\n", + LOGI("DoPrint: title='%ls' doPrint=%d", title, doPrint); + LOGI(" startChar=%d endChar=%d startPage=%d endPage=%d", fStartChar, fEndChar, fStartPage, fEndPage); /* @@ -723,7 +723,7 @@ PrintRichEdit::DoPrint(CRichEditCtrl* pREC, const WCHAR* title, #endif extdTextLength = (long)::SendMessage(pREC->m_hWnd, EM_GETTEXTLENGTHEX, (WPARAM) &exLenReq, (LPARAM) NULL); - WMSG2("RichEdit text length: std=%ld extd=%ld\n", + LOGI("RichEdit text length: std=%ld extd=%ld", basicTextLength, extdTextLength); if (fEndChar == -1) { @@ -734,13 +734,13 @@ PrintRichEdit::DoPrint(CRichEditCtrl* pREC, const WCHAR* title, } else textLength = fEndChar - fStartChar; - WMSG1(" +++ starting while loop, textLength=%ld\n", textLength); + LOGI(" +++ starting while loop, textLength=%ld", textLength); pageNum = 0; lastTextPrinted = -1; do { bool skipPage = false; pageNum++; - WMSG1(" +++ while loop: pageNum is %d\n", pageNum); + LOGI(" +++ while loop: pageNum is %d", pageNum); if (fEndPage > 0) { if (pageNum < fStartPage) @@ -771,17 +771,17 @@ PrintRichEdit::DoPrint(CRichEditCtrl* pREC, const WCHAR* title, fpDC->SelectObject(pOldPen); } - //WMSG1(" +++ calling FormatRange(%d)\n", doPrint && !skipPage); + //LOGI(" +++ calling FormatRange(%d)", doPrint && !skipPage); //LogHexDump(&fr, sizeof(fr)); /* print a page full of RichEdit stuff */ textPrinted = pREC->FormatRange(&fr, doPrint && !skipPage); - WMSG1(" +++ returned from FormatRange (textPrinted=%d)\n", + LOGI(" +++ returned from FormatRange (textPrinted=%d)", textPrinted); if (textPrinted <= lastTextPrinted) { /* the earlier StartPage can't be undone, so we'll get an extra blank page at the very end */ - WMSG3("GLITCH: no new text printed (printed=%ld, last=%ld, len=%ld)\n", + LOGI("GLITCH: no new text printed (printed=%ld, last=%ld, len=%ld)", textPrinted, lastTextPrinted, textLength); pageNum--; // fix page count estimator break; @@ -794,7 +794,7 @@ PrintRichEdit::DoPrint(CRichEditCtrl* pREC, const WCHAR* title, if (doPrint && !skipPage) { if (fpDC->EndPage() <= 0) { /* the "cancel" button was hit */ - WMSG0("EndPage returned <= 0 (cancelled)\n"); + LOGI("EndPage returned <= 0 (cancelled)"); fpDC->AbortDoc(); return -1; } @@ -806,9 +806,9 @@ PrintRichEdit::DoPrint(CRichEditCtrl* pREC, const WCHAR* title, } } while (textPrinted < textLength); - //WMSG0(" +++ calling FormatRange(NULL, FALSE)\n"); + //LOGI(" +++ calling FormatRange(NULL, FALSE)"); pREC->FormatRange(NULL, FALSE); - //WMSG0(" +++ returned from final FormatRange\n"); + //LOGI(" +++ returned from final FormatRange"); if (doPrint) fpDC->EndDoc(); @@ -816,7 +816,7 @@ PrintRichEdit::DoPrint(CRichEditCtrl* pREC, const WCHAR* title, if (pNumPages != NULL) *pNumPages = pageNum; - WMSG1("Printing completed (textPrinted=%ld)\n", textPrinted); + LOGI("Printing completed (textPrinted=%ld)", textPrinted); return 0; } diff --git a/app/RecompressOptionsDialog.cpp b/app/RecompressOptionsDialog.cpp index d4ca258..77aab8b 100644 --- a/app/RecompressOptionsDialog.cpp +++ b/app/RecompressOptionsDialog.cpp @@ -87,7 +87,7 @@ RecompressOptionsDialog::DoDataExchange(CDataExchange* pDX) ASSERT(pCombo != NULL); fCompressionType = pCombo->GetItemData(fCompressionIdx); - WMSG2("DDX got type=%d from combo index %d\n", + LOGI("DDX got type=%d from combo index %d", fCompressionType, fCompressionIdx); } diff --git a/app/Registry.cpp b/app/Registry.cpp index f7e9911..f9ac0a2 100644 --- a/app/Registry.cpp +++ b/app/Registry.cpp @@ -122,7 +122,7 @@ void MyRegistry::OneTimeInstall(void) const { /* start by stomping on our appIDs */ - WMSG0(" Removing appIDs\n"); + LOGI(" Removing appIDs"); RegDeleteKeyNT(HKEY_CLASSES_ROOT, kAppIDNuFX); RegDeleteKeyNT(HKEY_CLASSES_ROOT, kAppIDDiskImage); RegDeleteKeyNT(HKEY_CLASSES_ROOT, kAppIDBinaryII); @@ -137,13 +137,13 @@ MyRegistry::OneTimeInstall(void) const res = RegOpenKeyEx(HKEY_CLASSES_ROOT, kFileTypeAssoc[i].ext, 0, KEY_READ, &hExtKey); if (res == ERROR_SUCCESS) { - WMSG1(" Found existing HKCR\\'%ls', leaving alone\n", + LOGI(" Found existing HKCR\\'%ls', leaving alone", kFileTypeAssoc[i].ext); RegCloseKey(hExtKey); } else if (res == ERROR_FILE_NOT_FOUND) { OwnExtension(kFileTypeAssoc[i].ext, kFileTypeAssoc[i].appID); } else { - WMSG2(" Got error %ld opening HKCR\\'%ls', leaving alone\n", + LOGI(" Got error %ld opening HKCR\\'%ls', leaving alone", res, kFileTypeAssoc[i].ext); } } @@ -174,7 +174,7 @@ MyRegistry::OneTimeUninstall(void) const } /* remove our appIDs */ - WMSG0(" Removing appIDs\n"); + LOGI(" Removing appIDs"); RegDeleteKeyNT(HKEY_CLASSES_ROOT, kAppIDNuFX); RegDeleteKeyNT(HKEY_CLASSES_ROOT, kAppIDDiskImage); RegDeleteKeyNT(HKEY_CLASSES_ROOT, kAppIDBinaryII); @@ -232,7 +232,7 @@ MyRegistry::FixBasicSettings(void) const const WCHAR* exeName = gMyApp.GetExeFileName(); ASSERT(exeName != NULL && wcslen(exeName) > 0); - WMSG0("Fixing any missing file type AppID entries in registry\n"); + LOGI("Fixing any missing file type AppID entries in registry"); ConfigureAppID(kAppIDNuFX, L"NuFX Archive (CiderPress)", exeName, 1); ConfigureAppID(kAppIDBinaryII, L"Binary II (CiderPress)", exeName, 2); @@ -246,7 +246,7 @@ void MyRegistry::ConfigureAppID(const WCHAR* appID, const WCHAR* descr, const WCHAR* exeName, int iconIdx) const { - WMSG2(" Configuring '%ls' for '%ls'\n", appID, exeName); + LOGI(" Configuring '%ls' for '%ls'", appID, exeName); HKEY hAppKey = NULL; HKEY hIconKey = NULL; @@ -269,7 +269,7 @@ MyRegistry::ConfigureAppID(const WCHAR* appID, const WCHAR* descr, size = sizeof(buf); // size in bytes res = RegQueryValueEx(hIconKey, L"", NULL, &type, buf, &size); if (res == ERROR_SUCCESS && size > 1) { - WMSG1(" Icon for '%ls' already exists, not altering\n", appID); + LOGI(" Icon for '%ls' already exists, not altering", appID); } else { CString iconStr; iconStr.Format(L"%ls,%d", exeName, iconIdx); @@ -278,18 +278,18 @@ MyRegistry::ConfigureAppID(const WCHAR* appID, const WCHAR* descr, (const BYTE*)(LPCTSTR) iconStr, wcslen(iconStr) * sizeof(WCHAR)) == ERROR_SUCCESS) { - WMSG2(" Set icon for '%ls' to '%ls'\n", appID, + LOGI(" Set icon for '%ls' to '%ls'", appID, (LPCWSTR) iconStr); } else { - WMSG2(" WARNING: unable to set DefaultIcon for '%ls' to '%ls'\n", + LOGI(" WARNING: unable to set DefaultIcon for '%ls' to '%ls'", appID, (LPCWSTR) iconStr); } } } else { - WMSG1("WARNING: couldn't set up DefaultIcon for '%ls'\n", appID); + LOGI("WARNING: couldn't set up DefaultIcon for '%ls'", appID); } } else { - WMSG1("WARNING: couldn't create AppID='%ls'\n", appID); + LOGI("WARNING: couldn't create AppID='%ls'", appID); } RegCloseKey(hIconKey); @@ -315,7 +315,7 @@ MyRegistry::ConfigureAppIDSubFields(HKEY hAppKey, const WCHAR* descr, if (RegSetValueEx(hAppKey, L"", 0, REG_SZ, (const BYTE*) descr, wcslen(descr) * sizeof(WCHAR)) != ERROR_SUCCESS) { - WMSG1(" WARNING: unable to set description to '%ls'\n", descr); + LOGI(" WARNING: unable to set description to '%ls'", descr); } if (RegCreateKeyEx(hAppKey, L"shell", 0, REG_NONE, @@ -338,7 +338,7 @@ MyRegistry::ConfigureAppIDSubFields(HKEY hAppKey, const WCHAR* descr, res = RegQueryValueEx(hCommandKey, L"", NULL, &type, (LPBYTE) buf, &size); if (res == ERROR_SUCCESS && size > 1) { - WMSG1(" Command already exists, not altering ('%ls')\n", buf); + LOGI(" Command already exists, not altering ('%ls')", buf); } else { CString openCmd; @@ -347,9 +347,9 @@ MyRegistry::ConfigureAppIDSubFields(HKEY hAppKey, const WCHAR* descr, (LPBYTE)(LPCWSTR) openCmd, wcslen(openCmd) * sizeof(WCHAR)) == ERROR_SUCCESS) { - WMSG1(" Set command to '%ls'\n", openCmd); + LOGI(" Set command to '%ls'", openCmd); } else { - WMSG1(" WARNING: unable to set open cmd '%ls'\n", openCmd); + LOGI(" WARNING: unable to set open cmd '%ls'", openCmd); } } } @@ -391,10 +391,10 @@ MyRegistry::GetFileAssoc(int idx, CString* pExt, CString* pHandler, HINSTANCE res = FindExecutable(*pExt, "\\", buf); if ((long) res > 32) { - WMSG1("Executable is '%s'\n", buf); + LOGI("Executable is '%s'", buf); *pHandler = buf; } else { - WMSG1("FindExecutable failed (err=%d)\n", res); + LOGI("FindExecutable failed (err=%d)", res); *pHandler = kNoAssociation; } } @@ -433,16 +433,16 @@ MyRegistry::GetFileAssoc(int idx, CString* pExt, CString* pHandler, res = RegQueryValueEx(hExtKey, L"", NULL, &type, (LPBYTE)buf, &size); if (res == ERROR_SUCCESS) { - WMSG1(" Got '%ls'\n", buf); + LOGI(" Got '%ls'", buf); appID = buf; if (GetAssocAppName(appID, pHandler) != 0) *pHandler = appID; } else { - WMSG1("RegQueryValueEx failed on '%ls'\n", (LPCWSTR) *pExt); + LOGI("RegQueryValueEx failed on '%ls'", (LPCWSTR) *pExt); } } else { - WMSG1(" RegOpenKeyEx failed on '%ls'\n", *pExt); + LOGI(" RegOpenKeyEx failed on '%ls'", *pExt); } *pOurs = false; @@ -492,13 +492,13 @@ MyRegistry::GetAssocAppName(const CString& appID, CString* pCmd) const *pCmd = cmd; result = 0; } else { - WMSG1("Unable to open shell\\open\\command for '%ls'\n", appID); + LOGI("Unable to open shell\\open\\command for '%ls'", appID); } } else { CString errBuf; GetWin32ErrorString(res, &errBuf); - WMSG2("Unable to open AppID key '%ls' (%ls)\n", + LOGI("Unable to open AppID key '%ls' (%ls)", keyName, (LPCWSTR) errBuf); } @@ -545,18 +545,18 @@ MyRegistry::SetFileAssoc(int idx, bool wantIt) const ext = kFileTypeAssoc[idx].ext; weOwnIt = GetAssocState(ext); - WMSG3("SetFileAssoc: ext='%ls' own=%d want=%d\n", ext, weOwnIt, wantIt); + LOGI("SetFileAssoc: ext='%ls' own=%d want=%d", ext, weOwnIt, wantIt); if (weOwnIt && !wantIt) { /* reset it */ - WMSG1(" SetFileAssoc: clearing '%ls'\n", ext); + LOGI(" SetFileAssoc: clearing '%ls'", ext); result = DisownExtension(ext); } else if (!weOwnIt && wantIt) { /* take it */ - WMSG1(" SetFileAssoc: taking '%ls'\n", ext); + LOGI(" SetFileAssoc: taking '%ls'", ext); result = OwnExtension(ext, kFileTypeAssoc[idx].appID); } else { - WMSG1(" SetFileAssoc: do nothing with '%ls'\n", ext); + LOGI(" SetFileAssoc: do nothing with '%ls'", ext); /* do nothing */ } @@ -585,7 +585,7 @@ MyRegistry::GetAssocState(const WCHAR* ext) const res = RegQueryValueEx(hExtKey, L"", NULL, &type, (LPBYTE) buf, &size); if (res == ERROR_SUCCESS && type == REG_SZ) { /* compare it to known appID values */ - WMSG2(" Found '%ls', testing '%ls'\n", ext, buf); + LOGI(" Found '%ls', testing '%ls'", ext, buf); if (IsOurAppID((WCHAR*)buf)) result = true; } @@ -611,9 +611,9 @@ MyRegistry::DisownExtension(const WCHAR* ext) const return -1; if (RegDeleteKeyNT(HKEY_CLASSES_ROOT, ext) == ERROR_SUCCESS) { - WMSG1(" HKCR\\%ls subtree deleted\n", ext); + LOGI(" HKCR\\%ls subtree deleted", ext); } else { - WMSG1(" Failed deleting HKCR\\'%ls'\n", ext); + LOGI(" Failed deleting HKCR\\'%ls'", ext); return -1; } @@ -640,11 +640,11 @@ MyRegistry::OwnExtension(const WCHAR* ext, const WCHAR* appID) const /* delete the old key (which might be a hierarchy) */ res = RegDeleteKeyNT(HKEY_CLASSES_ROOT, ext); if (res == ERROR_SUCCESS) { - WMSG1(" HKCR\\%ls subtree deleted\n", ext); + LOGI(" HKCR\\%ls subtree deleted", ext); } else if (res == ERROR_FILE_NOT_FOUND) { - WMSG1(" No HKCR\\%ls subtree to delete\n", ext); + LOGI(" No HKCR\\%ls subtree to delete", ext); } else { - WMSG1(" Failed deleting HKCR\\'%ls'\n", ext); + LOGI(" Failed deleting HKCR\\'%ls'", ext); goto bail; } @@ -656,10 +656,10 @@ MyRegistry::OwnExtension(const WCHAR* ext, const WCHAR* appID) const res = RegSetValueEx(hExtKey, L"", 0, REG_SZ, (LPBYTE) appID, wcslen(appID) * sizeof(WCHAR)); if (res == ERROR_SUCCESS) { - WMSG2(" Set '%ls' to '%ls'\n", ext, appID); + LOGI(" Set '%ls' to '%ls'", ext, appID); result = 0; } else { - WMSG3("Failed setting '%ls' to '%ls' (res=%d)\n", ext, appID, res); + LOGI("Failed setting '%ls' to '%ls' (res=%d)", ext, appID, res); goto bail; } } diff --git a/app/RenameVolumeDialog.cpp b/app/RenameVolumeDialog.cpp index 47f8a7d..e391a8a 100644 --- a/app/RenameVolumeDialog.cpp +++ b/app/RenameVolumeDialog.cpp @@ -42,12 +42,12 @@ RenameVolumeDialog::OnInitDialog(void) fDiskFSTree.fIncludeSubdirs = false; fDiskFSTree.fExpandDepth = -1; if (!fDiskFSTree.BuildTree(pDiskFS, pTree)) { - WMSG0("Tree load failed!\n"); + LOGI("Tree load failed!"); OnCancel(); } int count = pTree->GetCount(); - WMSG1("ChooseAddTargetDialog tree has %d items\n", count); + LOGI("ChooseAddTargetDialog tree has %d items", count); /* select the default text and set the focus */ CEdit* pEdit = (CEdit*) GetDlgItem(IDC_RENAMEVOL_NEW); diff --git a/app/Squeeze.cpp b/app/Squeeze.cpp index 43db1f3..ebf788d 100644 --- a/app/Squeeze.cpp +++ b/app/Squeeze.cpp @@ -159,7 +159,7 @@ UnSqueeze(FILE* fp, unsigned long realEOF, ExpandBuffer* outExp, (!fullSqHeader && compRemaining < 3)) { err = kNuErrBadData; - WMSG0("too short to be valid SQ data\n"); + LOGI("too short to be valid SQ data"); goto bail; } @@ -191,7 +191,7 @@ UnSqueeze(FILE* fp, unsigned long realEOF, ExpandBuffer* outExp, ASSERT(getSize <= kSqBufferSize); err = SQRead(fp, usqState.dataPtr, getSize); if (err != kNuErrNone) { - WMSG1("failed reading compressed data (%ld bytes)\n", getSize); + LOGI("failed reading compressed data (%ld bytes)", getSize); goto bail; } usqState.dataInBuffer += getSize; @@ -216,7 +216,7 @@ UnSqueeze(FILE* fp, unsigned long realEOF, ExpandBuffer* outExp, goto bail; if (magic != kNuSQMagic) { err = kNuErrBadData; - WMSG0("bad magic number in SQ block\n"); + LOGI("bad magic number in SQ block"); goto bail; } @@ -237,7 +237,7 @@ UnSqueeze(FILE* fp, unsigned long realEOF, ExpandBuffer* outExp, goto bail; if (nodeCount < 0 || nodeCount >= kNuSQNumVals) { err = kNuErrBadData; - WMSG1("invalid decode tree in SQ (%d nodes)\n", nodeCount); + LOGI("invalid decode tree in SQ (%d nodes)", nodeCount); goto bail; } usqState.nodeCount = nodeCount; @@ -253,7 +253,7 @@ UnSqueeze(FILE* fp, unsigned long realEOF, ExpandBuffer* outExp, } if (err != kNuErrNone) { err = kNuErrBadData; - WMSG0("SQ data looks truncated at tree\n"); + LOGI("SQ data looks truncated at tree"); goto bail; } @@ -297,12 +297,12 @@ UnSqueeze(FILE* fp, unsigned long realEOF, ExpandBuffer* outExp, getSize = compRemaining; ASSERT(getSize <= kSqBufferSize); - //WMSG2("Reading from offset=%ld (compRem=%ld)\n", + //LOGI("Reading from offset=%ld (compRem=%ld)", // ftell(fp), compRemaining); err = SQRead(fp, usqState.dataPtr + usqState.dataInBuffer, getSize); if (err != kNuErrNone) { - WMSG2("failed reading compressed data (%ld bytes, err=%d)\n", + LOGI("failed reading compressed data (%ld bytes, err=%d)", getSize, err); goto bail; } @@ -318,7 +318,7 @@ UnSqueeze(FILE* fp, unsigned long realEOF, ExpandBuffer* outExp, err = USQDecodeHuffSymbol(&usqState, &val); if (err != kNuErrNone) { - WMSG0("failed decoding huff symbol\n"); + LOGI("failed decoding huff symbol"); goto bail; } @@ -370,7 +370,7 @@ UnSqueeze(FILE* fp, unsigned long realEOF, ExpandBuffer* outExp, if (inrep) { err = kNuErrBadData; - WMSG0("got stop symbol when run length expected\n"); + LOGI("got stop symbol when run length expected"); goto bail; } @@ -378,10 +378,10 @@ UnSqueeze(FILE* fp, unsigned long realEOF, ExpandBuffer* outExp, /* verify the checksum stored in the SQ file */ if (checksum != fileChecksum) { err = kNuErrBadDataCRC; - WMSG2("expected 0x%04x, got 0x%04x (SQ)\n", fileChecksum, checksum); + LOGI("expected 0x%04x, got 0x%04x (SQ)", fileChecksum, checksum); goto bail; } else { - WMSG1("--- SQ checksums match (0x%04x)\n", checksum); + LOGI("--- SQ checksums match (0x%04x)", checksum); } } @@ -391,14 +391,14 @@ UnSqueeze(FILE* fp, unsigned long realEOF, ExpandBuffer* outExp, */ if (compRemaining > kSqBufferSize) { err = kNuErrBadData; - WMSG1("wow: found %ld bytes left over\n", compRemaining); + LOGI("wow: found %ld bytes left over", compRemaining); goto bail; } if (compRemaining) { - WMSG1("+++ slurping up last %ld bytes\n", compRemaining); + LOGI("+++ slurping up last %ld bytes", compRemaining); err = SQRead(fp, tmpBuf, compRemaining); if (err != kNuErrNone) { - WMSG0("failed reading leftovers\n"); + LOGI("failed reading leftovers"); goto bail; } } diff --git a/app/Tools.cpp b/app/Tools.cpp index 137dd40..14ed70e 100644 --- a/app/Tools.cpp +++ b/app/Tools.cpp @@ -57,15 +57,15 @@ MainWindow::TryDiskImgOverride(DiskImg* pImg, const WCHAR* fileSource, imf.fFSFormat = defaultFormat; } - WMSG2(" On entry, sectord=%d format=%d\n", + LOGI(" On entry, sectord=%d format=%d", imf.fSectorOrder, imf.fFSFormat); if (imf.DoModal() != IDOK) { - WMSG0(" User bailed on IMF dialog\n"); + LOGI(" User bailed on IMF dialog"); return IDCANCEL; } - WMSG2(" On exit, sectord=%d format=%d\n", + LOGI(" On exit, sectord=%d format=%d", imf.fSectorOrder, imf.fFSFormat); if (pDisplayFormat != NULL) @@ -73,7 +73,7 @@ MainWindow::TryDiskImgOverride(DiskImg* pImg, const WCHAR* fileSource, if (imf.fSectorOrder != pImg->GetSectorOrder() || imf.fFSFormat != pImg->GetFSFormat()) { - WMSG0("Initial values overridden, forcing img format\n"); + LOGI("Initial values overridden, forcing img format"); DIError dierr; dierr = pImg->OverrideFormat(pImg->GetPhysicalFormat(), imf.fFSFormat, imf.fSectorOrder); @@ -168,12 +168,12 @@ MainWindow::OnToolsDiskEdit(void) loadName = fpOpenArchive->GetPathName(); readOnly = fpOpenArchive->IsReadOnly(); } else { - WMSG1("GLITCH: unexpected fOpenWhat %d\n", diskEditOpen.fOpenWhat); + LOGI("GLITCH: unexpected fOpenWhat %d", diskEditOpen.fOpenWhat); ASSERT(false); goto bail; } - WMSG3("Disk editor what=%d name='%ls' ro=%d\n", + LOGI("Disk editor what=%d name='%ls' ro=%d", diskEditOpen.fOpenWhat, (LPCWSTR) loadName, readOnly); @@ -194,10 +194,10 @@ MainWindow::OnToolsDiskEdit(void) fseek(tmpfp, 0, SEEK_END); length = ftell(tmpfp); rewind(tmpfp); - WMSG1(" PHATBUF %d\n", length); + LOGI(" PHATBUF %d", length); phatbuf = new char[length]; if (fread(phatbuf, length, 1, tmpfp) != 1) - WMSG1("FREAD FAILED %d\n", errno); + LOGI("FREAD FAILED %d", errno); fclose(tmpfp); dierr = img.OpenImage(phatbuf, length, true); #endif @@ -308,7 +308,7 @@ MainWindow::OnToolsDiskEdit(void) DiskFS* pDiskFS; pDiskFS = img.OpenAppropriateDiskFS(true); if (pDiskFS == NULL) { - WMSG0("HEY: OpenAppropriateDiskFS failed!\n"); + LOGI("HEY: OpenAppropriateDiskFS failed!"); goto bail; } @@ -440,11 +440,11 @@ MainWindow::OnToolsDiskConv(void) /* use filename as storageName (exception for DiskCopy42 later) */ storageName = PathName::FilenameOnly(loadName, '\\'); } - WMSG1(" Using '%ls' as storageName\n", (LPCWSTR) storageName); + LOGI(" Using '%ls' as storageName", (LPCWSTR) storageName); /* transfer the DOS volume num, if one was set */ dstImg.SetDOSVolumeNum(srcImg.GetDOSVolumeNum()); - WMSG1("DOS volume number set to %d\n", dstImg.GetDOSVolumeNum()); + LOGI("DOS volume number set to %d", dstImg.GetDOSVolumeNum()); DiskImg::FSFormat origFSFormat; origFSFormat = srcImg.GetFSFormat(); @@ -472,7 +472,7 @@ MainWindow::OnToolsDiskConv(void) */ convDlg.Init(&srcImg); if (convDlg.DoModal() != IDOK) { - WMSG0(" User bailed out of convert dialog\n"); + LOGI(" User bailed out of convert dialog"); goto bail; } @@ -507,7 +507,7 @@ MainWindow::OnToolsDiskConv(void) DiskImg::kNibbleDescrDOS33Std); } } - WMSG2(" NibbleDescr is 0x%08lx (%hs)\n", (long) pNibbleDescr, + LOGI(" NibbleDescr is 0x%08lx (%hs)", (long) pNibbleDescr, pNibbleDescr != NULL ? pNibbleDescr->description : "---"); if (srcImg.GetFileFormat() == DiskImg::kFileFormatTrackStar && @@ -518,7 +518,7 @@ MainWindow::OnToolsDiskConv(void) msg.LoadString(IDS_TRACKSTAR_TO_OTHER_WARNING); appName.LoadString(IDS_MB_APP_NAME); if (MessageBox(msg, appName, MB_OKCANCEL | MB_ICONWARNING) != IDOK) { - WMSG0(" User bailed after trackstar-to-other warning\n"); + LOGI(" User bailed after trackstar-to-other warning"); goto bail; } } else if (srcImg.GetFileFormat() == DiskImg::kFileFormatFDI && @@ -530,7 +530,7 @@ MainWindow::OnToolsDiskConv(void) msg.LoadString(IDS_FDI_TO_OTHER_WARNING); appName.LoadString(IDS_MB_APP_NAME); if (MessageBox(msg, appName, MB_OKCANCEL | MB_ICONWARNING) != IDOK) { - WMSG0(" User bailed after fdi-to-other warning\n"); + LOGI(" User bailed after fdi-to-other warning"); goto bail; } } else if (srcImg.GetHasNibbles() && DiskImg::IsSectorFormat(physicalFormat)) @@ -540,7 +540,7 @@ MainWindow::OnToolsDiskConv(void) msg.LoadString(IDS_NIBBLE_TO_SECTOR_WARNING); appName.LoadString(IDS_MB_APP_NAME); if (MessageBox(msg, appName, MB_OKCANCEL | MB_ICONWARNING) != IDOK) { - WMSG0(" User bailed after nibble-to-sector warning\n"); + LOGI(" User bailed after nibble-to-sector warning"); goto bail; } } else if (srcImg.GetHasNibbles() && @@ -552,7 +552,7 @@ MainWindow::OnToolsDiskConv(void) msg.LoadString(IDS_DIFFERENT_NIBBLE_WARNING); appName.LoadString(IDS_MB_APP_NAME); if (MessageBox(msg, appName, MB_OKCANCEL | MB_ICONWARNING) != IDOK) { - WMSG0(" User bailed after differing-nibbles warning\n"); + LOGI(" User bailed after differing-nibbles warning"); goto bail; } } @@ -565,13 +565,13 @@ MainWindow::OnToolsDiskConv(void) if (origFSFormat == DiskImg::kFormatUNIDOS && fileFormat == DiskImg::kFileFormatDiskCopy42) { - WMSG0(" Switching to DOS sector ordering for UNIDOS/DiskCopy42"); + LOGI(" Switching to DOS sector ordering for UNIDOS/DiskCopy42"); sectorOrder = DiskImg::kSectorOrderDOS; } if (origFSFormat != DiskImg::kFormatProDOS && fileFormat == DiskImg::kFileFormatDiskCopy42) { - WMSG0(" Nuking storage name for non-ProDOS DiskCopy42 image"); + LOGI(" Nuking storage name for non-ProDOS DiskCopy42 image"); storageName = L""; // want to use "-not a mac disk" for non-ProDOS } @@ -593,7 +593,7 @@ MainWindow::OnToolsDiskConv(void) fPreferences.GetPrefString(kPrConvertArchiveFolder); if (saveDlg.DoModal() != IDOK) { - WMSG0(" User bailed out of image save dialog\n"); + LOGI(" User bailed out of image save dialog"); goto bail; } @@ -603,7 +603,7 @@ MainWindow::OnToolsDiskConv(void) saveName = saveDlg.GetPathName(); } - WMSG1("File will be saved to '%ls'\n", (LPCWSTR) saveName); + LOGI("File will be saved to '%ls'", (LPCWSTR) saveName); /* DiskImgLib does not like it if file already exists */ errMsg = RemoveFile(saveName); @@ -754,7 +754,7 @@ MainWindow::OnToolsDiskConv(void) DoneOpenDialog doneOpen(this); if (doneOpen.DoModal() == IDOK) { - WMSG1(" At user request, opening '%ls'\n", (LPCWSTR) saveName); + LOGI(" At user request, opening '%ls'", (LPCWSTR) saveName); DoOpenArchive(saveName, convDlg.fExtension, kFilterIndexDiskImage, false); @@ -845,7 +845,7 @@ MainWindow::DetermineImageSettings(int convertIdx, bool addGzip, break; default: ASSERT(false); - WMSG1(" WHOA: invalid conv type %d\n", convertIdx); + LOGI(" WHOA: invalid conv type %d", convertIdx); return -1; } @@ -898,7 +898,7 @@ MainWindow::CopyDiskImage(DiskImg* pDstImg, DiskImg* pSrcImg, bool bulk, } numTracks = MIN(pSrcImg->GetNumTracks(), pDstImg->GetNumTracks()); - WMSG1("Nibble track copy (%d tracks)\n", numTracks); + LOGI("Nibble track copy (%d tracks)", numTracks); for (int track = 0; track < numTracks; track++) { dierr = pSrcImg->ReadNibbleTrack(track, dataBuf, &trackLen); if (dierr != kDIErrNone) { @@ -938,13 +938,13 @@ MainWindow::CopyDiskImage(DiskImg* pDstImg, DiskImg* pSrcImg, bool bulk, numTracks = MIN(pSrcImg->GetNumTracks(), pDstImg->GetNumTracks()); numSectPerTrack = MIN(pSrcImg->GetNumSectPerTrack(), pDstImg->GetNumSectPerTrack()); - WMSG2("Sector copy (%d tracks / %d sectors)\n", + LOGI("Sector copy (%d tracks / %d sectors)", numTracks, numSectPerTrack); for (int track = 0; track < numTracks; track++) { for (int sector = 0; sector < numSectPerTrack; sector++) { dierr = pSrcImg->ReadTrackSector(track, sector, dataBuf); if (dierr != kDIErrNone) { - WMSG2("Bad sector T=%d S=%d\n", track, sector); + LOGI("Bad sector T=%d S=%d", track, sector); numBadSectors++; dierr = kDIErrNone; memset(dataBuf, 0, 256); @@ -993,7 +993,7 @@ MainWindow::CopyDiskImage(DiskImg* pDstImg, DiskImg* pSrcImg, bool bulk, goto bail; } - WMSG2("--- BLOCK COPY (%ld blocks, %d per)\n", + LOGI("--- BLOCK COPY (%ld blocks, %d per)", numBlocks, blocksPerRead); for (long block = 0; block < numBlocks; ) { long blocksThisTime = blocksPerRead; @@ -1006,7 +1006,7 @@ MainWindow::CopyDiskImage(DiskImg* pDstImg, DiskImg* pSrcImg, bool bulk, /* * Media with errors. Drop to one block per read. */ - WMSG2(" Bad sector encountered at %ld(%ld), slowing\n", + LOGI(" Bad sector encountered at %ld(%ld), slowing", block, blocksThisTime); blocksThisTime = blocksPerRead = 1; continue; // retry this block @@ -1085,7 +1085,7 @@ public: private: void OnOK(void) { - WMSG0("Ignoring BulkConvCancelDialog OnOK\n"); + LOGI("Ignoring BulkConvCancelDialog OnOK"); } MainWindow* GetMainWindow(void) const { @@ -1142,7 +1142,7 @@ MainWindow::OnToolsBulkDiskConv(void) pathName = dlg.GetNextPathName(posn); nameCount++; } - WMSG1("BulkConv got nameCount=%d\n", nameCount); + LOGI("BulkConv got nameCount=%d", nameCount); /* * Choose the target directory. @@ -1165,14 +1165,14 @@ MainWindow::OnToolsBulkDiskConv(void) */ convDlg.Init(nameCount); if (convDlg.DoModal() != IDOK) { - WMSG0(" User bailed out of convert dialog\n"); + LOGI(" User bailed out of convert dialog"); goto bail; } /* initialize cancel dialog, and disable main window */ EnableWindow(FALSE); if (pCancelDialog->Create(this) == FALSE) { - WMSG0("Cancel dialog init failed?!\n"); + LOGI("Cancel dialog init failed?!"); ASSERT(false); goto bail; } @@ -1184,7 +1184,7 @@ MainWindow::OnToolsBulkDiskConv(void) while (posn != NULL) { CString pathName; pathName = dlg.GetNextPathName(posn); - WMSG1(" BulkConv: source path='%ls'\n", (LPCWSTR) pathName); + LOGI(" BulkConv: source path='%ls'", (LPCWSTR) pathName); pCancelDialog->SetCurrentFile(PathName::FilenameOnly(pathName, '\\')); PeekAndPump(); @@ -1290,7 +1290,7 @@ MainWindow::BulkConvertImage(const WCHAR* pathName, const WCHAR* targetDir, /* transfer the DOS volume num, if one was set */ dstImg.SetDOSVolumeNum(srcImg.GetDOSVolumeNum()); - WMSG1("DOS volume number set to %d\n", dstImg.GetDOSVolumeNum()); + LOGI("DOS volume number set to %d", dstImg.GetDOSVolumeNum()); DiskImg::FSFormat origFSFormat; origFSFormat = srcImg.GetFSFormat(); @@ -1341,7 +1341,7 @@ MainWindow::BulkConvertImage(const WCHAR* pathName, const WCHAR* targetDir, DiskImg::kNibbleDescrDOS33Std); } } - WMSG2(" NibbleDescr is 0x%08lx (%hs)\n", (long) pNibbleDescr, + LOGI(" NibbleDescr is 0x%08lx (%hs)", (long) pNibbleDescr, pNibbleDescr != NULL ? pNibbleDescr->description : "---"); /* @@ -1374,7 +1374,7 @@ MainWindow::BulkConvertImage(const WCHAR* pathName, const WCHAR* targetDir, storageName = PathName::FilenameOnly(saveName, '\\'); // grab this for SHK name saveName += '.'; saveName += convDlg.fExtension; - WMSG2(" Bulk converting '%ls' to '%ls'\n", pathName, (LPCWSTR) saveName); + LOGI(" Bulk converting '%ls' to '%ls'", pathName, (LPCWSTR) saveName); /* * If this is a ProDOS volume, use the disk volume name as the default @@ -1394,7 +1394,7 @@ MainWindow::BulkConvertImage(const WCHAR* pathName, const WCHAR* targetDir, if (fileFormat == DiskImg::kFileFormatDiskCopy42) storageName = L""; // want to use "not a mac disk" for non-ProDOS } - WMSG1(" Using '%ls' as storageName\n", (LPCWSTR) storageName); + LOGI(" Using '%ls' as storageName", (LPCWSTR) storageName); /* * If the source is a UNIDOS volume and the target format is DiskCopy 4.2, @@ -1404,7 +1404,7 @@ MainWindow::BulkConvertImage(const WCHAR* pathName, const WCHAR* targetDir, if (origFSFormat == DiskImg::kFormatUNIDOS && fileFormat == DiskImg::kFileFormatDiskCopy42) { - WMSG0(" Switching to DOS sector ordering for UNIDOS/DiskCopy42"); + LOGI(" Switching to DOS sector ordering for UNIDOS/DiskCopy42"); sectorOrder = DiskImg::kSectorOrderDOS; } @@ -1574,7 +1574,7 @@ MainWindow::OnToolsSSTMerge(void) goto bail; if (SSTLoadData(0, &srcImg0, trackBuf, &badCount) != 0) goto bail; - WMSG1("FOUND %ld bad bytes in part 0\n", badCount); + LOGI("FOUND %ld bad bytes in part 0", badCount); if (badCount > kBadCountThreshold) { errMsg.LoadString(IDS_BAD_SST_IMAGE); if (MessageBox(errMsg, appName, MB_OKCANCEL | MB_ICONWARNING) != IDOK) @@ -1586,7 +1586,7 @@ MainWindow::OnToolsSSTMerge(void) goto bail; if (SSTLoadData(1, &srcImg1, trackBuf, &badCount) != 0) goto bail; - WMSG1("FOUND %ld bad bytes in part 1\n", badCount); + LOGI("FOUND %ld bad bytes in part 1", badCount); if (badCount > kBadCountThreshold) { errMsg.LoadString(IDS_BAD_SST_IMAGE); if (MessageBox(errMsg, appName, MB_OKCANCEL | MB_ICONWARNING) != IDOK) @@ -1604,7 +1604,7 @@ MainWindow::OnToolsSSTMerge(void) saveDlg.m_ofn.lpstrTitle = L"Save .NIB disk image as..."; saveDlg.m_ofn.lpstrInitialDir = fPreferences.GetPrefString(kPrOpenArchiveFolder); if (saveDlg.DoModal() != IDOK) { - WMSG0(" User bailed out of image save dialog\n"); + LOGI(" User bailed out of image save dialog"); goto bail; } saveFolder = saveDlg.m_ofn.lpstrFile; @@ -1612,7 +1612,7 @@ MainWindow::OnToolsSSTMerge(void) fPreferences.SetPrefString(kPrOpenArchiveFolder, saveFolder); saveName = saveDlg.GetPathName(); - WMSG1("File will be saved to '%ls'\n", (LPCWSTR) saveName); + LOGI("File will be saved to '%ls'", (LPCWSTR) saveName); /* remove the file if it exists */ errMsg = RemoveFile(saveName); @@ -1650,7 +1650,7 @@ MainWindow::OnToolsSSTMerge(void) DoneOpenDialog doneOpen(this); if (doneOpen.DoModal() == IDOK) { - WMSG1(" At user request, opening '%ls'\n", (LPCWSTR) saveName); + LOGI(" At user request, opening '%ls'", (LPCWSTR) saveName); DoOpenArchive(saveName, L"nib", kFilterIndexDiskImage, false); } @@ -1784,7 +1784,7 @@ MainWindow::SSTLoadData(int seqNum, DiskImg* pDiskImg, BYTE* trackBuf, for (track = 0; track < kSSTNumTracks; track++) { int virtualTrack = track + (seqNum * kSSTNumTracks); bufOffset = SSTGetBufOffset(virtualTrack); - //WMSG3("USING offset=%ld (track=%d / %d)\n", + //LOGI("USING offset=%ld (track=%d / %d)", // bufOffset, track, virtualTrack); if (virtualTrack & 0x01) { @@ -1792,7 +1792,7 @@ MainWindow::SSTLoadData(int seqNum, DiskImg* pDiskImg, BYTE* trackBuf, for (sector = 15; sector >= 4; sector--) { dierr = pDiskImg->ReadTrackSector(track, sector, sctBuf); if (dierr != kDIErrNone) { - WMSG2("ERROR: on track=%d sector=%d\n", + LOGI("ERROR: on track=%d sector=%d", track, sector); return -1; } @@ -1806,7 +1806,7 @@ MainWindow::SSTLoadData(int seqNum, DiskImg* pDiskImg, BYTE* trackBuf, for (sector = 13; sector >= 0; sector--) { dierr = pDiskImg->ReadTrackSector(track, sector, sctBuf); if (dierr != kDIErrNone) { - WMSG2("ERROR: on track=%d sector=%d\n", + LOGI("ERROR: on track=%d sector=%d", track, sector); return -1; } @@ -1923,10 +1923,10 @@ MainWindow::SSTProcessTrackData(unsigned char* trackBuf) if (longest == -1) { - WMSG1("HEY: couldn't find any 0x7f in track %d\n", + LOGI("HEY: couldn't find any 0x7f in track %d", track); } else { - WMSG3("Found run of %d at %d in track %d\n", + LOGI("Found run of %d at %d in track %d", longest, longestStart, track); int bkpt = longestStart + longest; @@ -2173,7 +2173,7 @@ MainWindow::OnToolsDiskImageCreator(void) } break; default: - WMSG1("Invalid fDiskFormatIdx %d from CreateImageDialog\n", + LOGI("Invalid fDiskFormatIdx %d from CreateImageDialog", createDlg.fDiskFormatIdx); ASSERT(false); return; @@ -2205,7 +2205,7 @@ MainWindow::OnToolsDiskImageCreator(void) saveDlg.m_ofn.nFilterIndex = filterIndex; if (saveDlg.DoModal() != IDOK) { - WMSG0(" User cancelled xfer from image create dialog\n"); + LOGI(" User cancelled xfer from image create dialog"); return; } @@ -2214,7 +2214,7 @@ MainWindow::OnToolsDiskImageCreator(void) fPreferences.SetPrefString(kPrOpenArchiveFolder, saveFolder); filename = saveDlg.GetPathName(); - WMSG2(" Will xfer to file '%ls' (filterIndex=%d)\n", + LOGI(" Will xfer to file '%ls' (filterIndex=%d)", (LPCWSTR) filename, saveDlg.m_ofn.nFilterIndex); if (createDlg.fDiskFormatIdx == CreateImageDialog::kFmtDOS32) { @@ -2255,7 +2255,7 @@ MainWindow::OnToolsDiskImageCreator(void) ShowFailureMsg(this, errStr, IDS_FAILED); (void) _wunlink(filename); } else { - WMSG0("Disk image created successfully\n"); + LOGI("Disk image created successfully"); #if 0 SuccessBeep(); @@ -2263,7 +2263,7 @@ MainWindow::OnToolsDiskImageCreator(void) DoneOpenDialog doneOpen(this); if (doneOpen.DoModal() == IDOK) { - WMSG1(" At user request, opening '%ls'\n", filename); + LOGI(" At user request, opening '%ls'", filename); DoOpenArchive(filename, "dsk", kFilterIndexDiskImage, false); } @@ -2309,7 +2309,7 @@ MainWindow::OnToolsEOLScanner(void) saveFolder = saveFolder.Left(fileDlg.m_ofn.nFileOffset); fPreferences.SetPrefString(kPrOpenArchiveFolder, saveFolder); - WMSG1("Scanning '%ls'\n", (LPCWSTR) fileName); + LOGI("Scanning '%ls'", (LPCWSTR) fileName); FILE* fp = _wfopen(fileName, L"rb"); if (fp == NULL) { @@ -2354,7 +2354,7 @@ MainWindow::OnToolsEOLScanner(void) } fclose(fp); - WMSG4("Got CR=%ld LF=%ld CRLF=%ld (numChars=%ld)\n", + LOGI("Got CR=%ld LF=%ld CRLF=%ld (numChars=%ld)", numCR, numLF, numCRLF, numChars); EOLScanDialog output; @@ -2434,7 +2434,7 @@ MainWindow::EditTwoImgProps(const WCHAR* fileName) long totalLength; bool readOnly = false; - WMSG1("EditTwoImgProps '%ls'\n", fileName); + LOGI("EditTwoImgProps '%ls'", fileName); fp = _wfopen(fileName, L"r+b"); if (fp == NULL) { int firstError = errno; @@ -2495,7 +2495,7 @@ MainWindow::EditTwoImgProps(const WCHAR* fileName) } } - WMSG0("2MG success!\n"); + LOGI("2MG success!"); } bail: diff --git a/app/TwoImgPropsDialog.cpp b/app/TwoImgPropsDialog.cpp index e31772a..16b57a4 100644 --- a/app/TwoImgPropsDialog.cpp +++ b/app/TwoImgPropsDialog.cpp @@ -97,7 +97,7 @@ TwoImgPropsDialog::DoDataExchange(CDataExchange* pDX) DDX_Text(pDX, IDC_TWOIMG_COMMENT, comment); DDX_Text(pDX, IDC_TWOIMG_DOSVOLNUM, dosVolNum); - WMSG1("GOT dosVolNum = %d\n", dosVolNum); + LOGI("GOT dosVolNum = %d", dosVolNum); fpHeader->fFlags &= ~(TwoImgHeader::kFlagLocked); if (locked) diff --git a/app/ViewFilesDialog.cpp b/app/ViewFilesDialog.cpp index 3eb9b24..b49c5e5 100644 --- a/app/ViewFilesDialog.cpp +++ b/app/ViewFilesDialog.cpp @@ -49,7 +49,7 @@ END_MESSAGE_MAP() BOOL ViewFilesDialog::OnInitDialog(void) { - WMSG0("Now in VFD OnInitDialog!\n"); + LOGI("Now in VFD OnInitDialog!"); ASSERT(fpSelSet != NULL); @@ -88,7 +88,7 @@ ViewFilesDialog::OnInitDialog(void) long height = pPreferences->GetFileViewerHeight(); CRect fullRect; GetWindowRect(&fullRect); - WMSG2(" VFD pre-size %dx%d\n", fullRect.Width(), fullRect.Height()); + LOGI(" VFD pre-size %dx%d", fullRect.Width(), fullRect.Height()); fullRect.right = fullRect.left + width; fullRect.bottom = fullRect.top + height; MoveWindow(fullRect, FALSE); @@ -98,7 +98,7 @@ ViewFilesDialog::OnInitDialog(void) // the StreamIn call. So don't do this until everything else is ready. CDialog::OnInitDialog(); - WMSG0("VFD OnInitDialog done\n"); + LOGI("VFD OnInitDialog done"); return FALSE; // don't let Windows set the focus } @@ -109,7 +109,7 @@ ViewFilesDialog::OnInitDialog(void) int ViewFilesDialog::OnCreate(LPCREATESTRUCT lpcs) { - WMSG0("VFD OnCreate\n"); + LOGI("VFD OnCreate"); HICON hIcon; hIcon = ::AfxGetApp()->LoadIcon(IDI_FILE_VIEWER); @@ -124,7 +124,7 @@ ViewFilesDialog::OnCreate(LPCREATESTRUCT lpcs) SBS_SIZEBOX | SBS_SIZEBOXBOTTOMRIGHTALIGN | SBS_SIZEGRIP, initRect, this, AFX_IDW_SIZE_BOX); - WMSG0("VFD OnCreate done\n"); + LOGI("VFD OnCreate done"); return 0; } @@ -159,7 +159,7 @@ ViewFilesDialog::OnOK(void) CRect rect; GetWindowRect(&rect); - WMSG2(" VFD size now %dx%d\n", rect.Width(), rect.Height()); + LOGI(" VFD size now %dx%d", rect.Width(), rect.Height()); CDialog::OnOK(); } @@ -193,19 +193,19 @@ ViewFilesDialog::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); - //WMSG2("Dialog: old size %d,%d\n", + //LOGI("Dialog: old size %d,%d", // fLastWinSize.Width(), fLastWinSize.Height()); - WMSG2("Dialog: new size %d,%d\n", cx, cy); + LOGI("Dialog: new size %d,%d", cx, cy); if (fLastWinSize.Width() == cx && fLastWinSize.Height() == cy) { - WMSG0("VFD OnSize: no change\n"); + LOGI("VFD OnSize: no change"); return; } int deltaX, deltaY; deltaX = cx - fLastWinSize.Width(); deltaY = cy - fLastWinSize.Height(); - //WMSG2("Delta is %d,%d\n", deltaX, deltaY); + //LOGI("Delta is %d,%d", deltaX, deltaY); ShiftControls(deltaX, deltaY); @@ -248,7 +248,7 @@ ViewFilesDialog::ShiftControls(int deltaX, int deltaY) hdwp = StretchControl(hdwp, this, IDC_FVIEW_EDITBOX, deltaX, deltaY); hdwp = MoveControl(hdwp, this, IDOK, deltaX, deltaY); if (!EndDeferWindowPos(hdwp)) { - WMSG0("EndDeferWindowPos failed\n"); + LOGI("EndDeferWindowPos failed"); } /* @@ -283,9 +283,9 @@ ViewFilesDialog::DoDataExchange(CDataExchange* pDX) CDialog::DoDataExchange(pDX); if (pDX->m_bSaveAndValidate) { - WMSG0("COPY OUT\n"); + LOGI("COPY OUT"); } else { - WMSG0("COPY IN\n"); + LOGI("COPY IN"); OnFviewNext(); } } @@ -299,13 +299,13 @@ DumpBitmapInfo(HBITMAP hBitmap) gotten = pBitmap->GetObject(sizeof(info), &info); - WMSG2("DumpBitmapInfo: gotten=%d of %d\n", gotten, sizeof(info)); - WMSG1(" bmType = %d\n", info.bmType); - WMSG2(" bmWidth=%d, bmHeight=%d\n", info.bmWidth, info.bmHeight); - WMSG1(" bmWidthBytes=%d\n", info.bmWidthBytes); - WMSG1(" bmPlanes=%d\n", info.bmPlanes); - WMSG1(" bmBitsPixel=%d\n", info.bmBitsPixel); - WMSG1(" bmPits = 0x%08lx\n", info.bmBits); + LOGI("DumpBitmapInfo: gotten=%d of %d", gotten, sizeof(info)); + LOGI(" bmType = %d", info.bmType); + LOGI(" bmWidth=%d, bmHeight=%d", info.bmWidth, info.bmHeight); + LOGI(" bmWidthBytes=%d", info.bmWidthBytes); + LOGI(" bmPlanes=%d", info.bmPlanes); + LOGI(" bmBitsPixel=%d", info.bmBitsPixel); + LOGI(" bmPits = 0x%08lx", info.bmBits); } @@ -419,14 +419,14 @@ ViewFilesDialog::DisplayText(const WCHAR* fileName) hBitmap = fpOutput->GetDIB()->ConvertToDDB(dcScreen.m_hDC); if (hBitmap == NULL) { - WMSG0("ConvertToDDB failed!\n"); + LOGI("ConvertToDDB failed!"); pEdit->SetWindowText(L"Internal error."); errFlg = true; } else { //DumpBitmapInfo(hBitmap); //DumpBitmapInfo(pDib->GetHandle()); - WMSG0("Inserting bitmap\n"); + LOGI("Inserting bitmap"); pEdit->SetWindowText(L""); CImageDataObject::InsertBitmap(fpRichEditOle, hBitmap); @@ -463,7 +463,7 @@ ViewFilesDialog::DisplayText(const WCHAR* fileName) /* make sure the control will hold everything we throw at it */ pEdit->LimitText(textLen+1); - WMSG2("Streaming %ld bytes (kind=%d)\n", + LOGI("Streaming %ld bytes (kind=%d)", textLen, fpOutput->GetOutputKind()); /* clear this early to avoid loading onto yellow */ @@ -481,7 +481,7 @@ ViewFilesDialog::DisplayText(const WCHAR* fileName) es.pfnCallback = RichEditXfer::EditStreamCallback; long count; count = pEdit->StreamIn(streamFormat, es); - WMSG2("StreamIn returned count=%ld dwError=%d\n", count, es.dwError); + LOGI("StreamIn returned count=%ld dwError=%d", count, es.dwError); if (es.dwError != 0) { /* a -16 error can happen if the type is RTF but contents are not */ @@ -496,7 +496,7 @@ ViewFilesDialog::DisplayText(const WCHAR* fileName) es.dwError = 0; count = pEdit->StreamIn(SF_TEXT, es); - WMSG2("Error StreamIn returned count=%ld dwError=%d\n", count, es.dwError); + LOGI("Error StreamIn returned count=%ld dwError=%d", count, es.dwError); errFlg = true; } @@ -570,7 +570,7 @@ ViewFilesDialog::DisplayText(const WCHAR* fileName) long height = pPreferences->GetPrefLong(kPrFileViewerHeight); CRect fullRect; GetWindowRect(&fullRect); - //WMSG2(" VFD pre-size %dx%d\n", fullRect.Width(), fullRect.Height()); + //LOGI(" VFD pre-size %dx%d", fullRect.Width(), fullRect.Height()); fullRect.right = fullRect.left + width; fullRect.bottom = fullRect.top + height; MoveWindow(fullRect, TRUE); @@ -638,7 +638,7 @@ ViewFilesDialog::OnFviewNext(void) int result; if (fBusy) { - WMSG0("BUSY!\n"); + LOGI("BUSY!"); return; } @@ -695,7 +695,7 @@ ViewFilesDialog::OnFviewPrev(void) int result; if (fBusy) { - WMSG0("BUSY!\n"); + LOGI("BUSY!"); return; } @@ -835,7 +835,7 @@ ViewFilesDialog::ReformatPrep(GenericEntry* pEntry) result = pMainWindow->GetFileParts(pEntry, &fpHolder); if (result != 0) { - WMSG0("GetFileParts(prev) failed!\n"); + LOGI("GetFileParts(prev) failed!"); ASSERT(fpHolder == NULL); return -1; } @@ -851,7 +851,7 @@ ViewFilesDialog::ReformatPrep(GenericEntry* pEntry) pEntry->GetFileNameExtensionA()); /* figure out which reformatters apply to this file */ - WMSG0("Testing reformatters\n"); + LOGI("Testing reformatters"); fpHolder->TestApplicability(); return 0; @@ -926,13 +926,13 @@ ViewFilesDialog::ConfigureFormatSel(ReformatHolder::ReformatPart part) ReformatHolder::ReformatID returnID = ReformatHolder::kReformatRaw; CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_FVIEW_FORMATSEL); - WMSG0("--- ConfigureFormatSel\n"); + LOGI("--- ConfigureFormatSel"); //int sel; //sel = pCombo->GetCurSel(); //if (sel != CB_ERR) // prevID = (ReformatHolder::ReformatID) pCombo->GetItemData(sel); - //WMSG1(" prevID = %d\n", prevID); + //LOGI(" prevID = %d", prevID); EnableFormatSelection(TRUE); pCombo->ResetContent(); @@ -971,7 +971,7 @@ ViewFilesDialog::ConfigureFormatSel(ReformatHolder::ReformatPart part) if ((int) applies == testApplies) { /* match! */ CString str; - //WMSG2("MATCH at %d (0x%02x)\n", idIdx, testApplies); + //LOGI("MATCH at %d (0x%02x)", idIdx, testApplies); str.Format(L"%ls", ReformatHolder::GetReformatName( (ReformatHolder::ReformatID) idIdx)); comboIdx = pCombo->AddString(str); @@ -984,7 +984,7 @@ ViewFilesDialog::ConfigureFormatSel(ReformatHolder::ReformatPart part) //if (idIdx == (int) prevID && // applyIdx == ReformatHolder::kApplicAlways) //{ - // WMSG0(" Found 'always' prevID, selecting\n"); + // LOGI(" Found 'always' prevID, selecting"); // pCombo->SetCurSel(comboIdx); //} } @@ -998,7 +998,7 @@ skip: /* return whatever we now have selected */ int sel = pCombo->GetCurSel(); - WMSG1(" At end, sel is %d\n", sel); + LOGI(" At end, sel is %d", sel); if (sel != CB_ERR) returnID = (ReformatHolder::ReformatID) pCombo->GetItemData(sel); @@ -1015,7 +1015,7 @@ ViewFilesDialog::OnFormatSelChange(void) { CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_FVIEW_FORMATSEL); ASSERT(pCombo != NULL); - WMSG1("+++ SELECTION IS NOW %d\n", pCombo->GetCurSel()); + LOGI("+++ SELECTION IS NOW %d", pCombo->GetCurSel()); SelectionEntry* pSelEntry = fpSelSet->IterCurrent(); GenericEntry* pEntry = pSelEntry->GetEntry(); @@ -1053,7 +1053,7 @@ ViewFilesDialog::ForkSelectCommon(ReformatHolder::ReformatPart part) GenericEntry* pEntry; ReformatHolder::ReformatID id; - WMSG1("Switching to file part=%d\n", part); + LOGI("Switching to file part=%d", part); ASSERT(fpHolder != NULL); ASSERT(fpSelSet != NULL); ASSERT(fpSelSet->IterCurrent() != NULL); @@ -1162,7 +1162,7 @@ ViewFilesDialog::OnFviewFont(void) //fontDlg.GetCurrentFont(&logFont); fTypeFace = fontDlg.GetFaceName(); fPointSize = fontDlg.GetSize() / 10; - WMSG2("Now using %d-point '%ls'\n", fPointSize, (LPCWSTR) fTypeFace); + LOGI("Now using %d-point '%ls'", fPointSize, (LPCWSTR) fTypeFace); NewFontSelected(false); } @@ -1229,7 +1229,7 @@ ViewFilesDialog::OnFviewPrint(void) } pre.Setup(&countDC, this); pre.PrintPreflight(&fEditCtrl, &numPages); - WMSG1("Default printer generated %d pages\n", numPages); + LOGI("Default printer generated %d pages", numPages); dlg.m_pd.nToPage = dlg.m_pd.nMaxPage = numPages; } @@ -1242,7 +1242,7 @@ ViewFilesDialog::OnFviewPrint(void) fEditCtrl.GetSel(/*ref*/startChar, /*ref*/endChar); if (endChar != startChar) { - WMSG2("GetSel returned start=%ld end=%ld\n", startChar, endChar); + LOGI("GetSel returned start=%ld end=%ld", startChar, endChar); dlg.m_pd.Flags &= ~(PD_NOSELECTION); } @@ -1329,7 +1329,7 @@ ViewFilesDialog::OnFindDialogMessage(WPARAM wParam, LPARAM lParam) fFindMatchWholeWord = (fpFindDialog->MatchWholeWord() != 0); if (fpFindDialog->IsTerminating()) { - WMSG0("VFD find dialog closing\n"); + LOGI("VFD find dialog closing"); fpFindDialog = NULL; return 0; } @@ -1338,7 +1338,7 @@ ViewFilesDialog::OnFindDialogMessage(WPARAM wParam, LPARAM lParam) fFindLastStr = fpFindDialog->GetFindString(); FindNext(fFindLastStr, fFindDown, fFindMatchCase, fFindMatchWholeWord); } else { - WMSG0("Unexpected find dialog activity\n"); + LOGI("Unexpected find dialog activity"); } return 0; @@ -1352,7 +1352,7 @@ void ViewFilesDialog::FindNext(const WCHAR* str, bool down, bool matchCase, bool wholeWord) { - WMSG4("FindText '%ls' d=%d c=%d w=%d\n", str, down, matchCase, wholeWord); + LOGI("FindText '%ls' d=%d c=%d w=%d", str, down, matchCase, wholeWord); FINDTEXTEX findTextEx = { 0 }; CHARRANGE selChrg; @@ -1365,7 +1365,7 @@ ViewFilesDialog::FindNext(const WCHAR* str, bool down, bool matchCase, flags |= FR_WHOLEWORD; fEditCtrl.GetSel(selChrg); - WMSG2(" selection is %ld,%ld\n", + LOGI(" selection is %ld,%ld", selChrg.cpMin, selChrg.cpMax); if (selChrg.cpMin == selChrg.cpMax) start = selChrg.cpMin; // start at caret @@ -1390,7 +1390,7 @@ ViewFilesDialog::FindNext(const WCHAR* str, bool down, bool matchCase, (LPARAM) &findTextEx); } - WMSG3(" result=%ld min=%ld max=%ld\n", result, + LOGI(" result=%ld min=%ld max=%ld", result, findTextEx.chrgText.cpMin, findTextEx.chrgText.cpMax); if (result != -1) { /* select the text we found */ diff --git a/app/VolumeCopyDialog.cpp b/app/VolumeCopyDialog.cpp index b2ed261..69150d8 100644 --- a/app/VolumeCopyDialog.cpp +++ b/app/VolumeCopyDialog.cpp @@ -48,7 +48,7 @@ public: private: void OnOK(void) { - WMSG0("Ignoring VolumeXferProgressDialog OnOK\n"); + LOGI("Ignoring VolumeXferProgressDialog OnOK"); } MainWindow* GetMainWindow(void) const { @@ -68,7 +68,7 @@ VolumeCopyDialog::OnInitDialog(void) CRect rect; //this->GetWindowRect(&rect); - //WMSG4("RECT is %d, %d, %d, %d\n", rect.left, rect.top, rect.bottom, rect.right); + //LOGI("RECT is %d, %d, %d, %d", rect.left, rect.top, rect.bottom, rect.right); ASSERT(fpDiskImg != NULL); ScanDiskInfo(false); @@ -148,7 +148,7 @@ VolumeCopyDialog::OnCancel(void) void VolumeCopyDialog::Cleanup(void) { - WMSG0(" VolumeCopyDialog is done, cleaning up DiskFS\n"); + LOGI(" VolumeCopyDialog is done, cleaning up DiskFS"); delete fpDiskFS; fpDiskFS = NULL; } @@ -161,7 +161,7 @@ VolumeCopyDialog::OnListChange(NMHDR*, LRESULT* pResult) { //CRect rect; //this->GetWindowRect(&rect); - //WMSG4("RECT is %d, %d, %d, %d\n", rect.left, rect.top, rect.bottom, rect.right); + //LOGI("RECT is %d, %d, %d, %d", rect.left, rect.top, rect.bottom, rect.right); CListCtrl* pListView = (CListCtrl*) GetDlgItem(IDC_VOLUMECOPYSEL_LIST); ASSERT(pListView != NULL); @@ -244,10 +244,10 @@ VolumeCopyDialog::ScanDiskInfo(bool scanTop) */ bool deferDestroy = false; if (!IsWindowVisible() || !IsWindowEnabled()) { - WMSG0(" Deferring destroy on wait dialog\n"); + LOGI(" Deferring destroy on wait dialog"); deferDestroy = true; } else { - WMSG0(" Not deferring destroy on wait dialog\n"); + LOGI(" Not deferring destroy on wait dialog"); } fpWaitDlg = new ExclusiveModelessDialog; @@ -263,7 +263,7 @@ VolumeCopyDialog::ScanDiskInfo(bool scanTop) */ fpDiskFS = fpDiskImg->OpenAppropriateDiskFS(true); if (fpDiskFS == NULL) { - WMSG0("HEY: OpenAppropriateDiskFS failed!\n"); + LOGI("HEY: OpenAppropriateDiskFS failed!"); /* this is fatal, but there's no easy way to die */ /* (could we do a DestroyWindow from here?) */ /* at any rate, with "allowUnknown" set, this shouldn't happen */ @@ -297,7 +297,7 @@ LONG VolumeCopyDialog::OnDialogReady(UINT, LONG) { if (fpWaitDlg != NULL) { - WMSG0("OnDialogReady found active window, destroying\n"); + LOGI("OnDialogReady found active window, destroying"); fpWaitDlg->DestroyWindow(); fpWaitDlg = NULL; } @@ -333,7 +333,7 @@ VolumeCopyDialog::LoadList(void) pSubVolume = fpDiskFS->GetNextSubVolume(NULL); while (pSubVolume != NULL) { if (pSubVolume->GetDiskFS() == NULL) { - WMSG0("WARNING: sub-volume DiskFS is NULL?!\n"); + LOGI("WARNING: sub-volume DiskFS is NULL?!"); assert(false); } else { AddToList(pListView, pSubVolume->GetDiskImg(), @@ -460,7 +460,7 @@ VolumeCopyDialog::OnCopyToFile(void) ShowFailureMsg(this, errMsg, IDS_FAILED); goto bail; } - WMSG2("Logical volume '%ls' has %d 512-byte blocks\n", + LOGI("Logical volume '%ls' has %d 512-byte blocks", (LPCWSTR) srcName, pSrcImg->GetNumBlocks()); /* @@ -478,7 +478,7 @@ VolumeCopyDialog::OnCopyToFile(void) pPreferences->GetPrefString(kPrOpenArchiveFolder); if (saveDlg.DoModal() != IDOK) { - WMSG0(" User bailed out of image save dialog\n"); + LOGI(" User bailed out of image save dialog"); goto bail; } @@ -488,7 +488,7 @@ VolumeCopyDialog::OnCopyToFile(void) saveName = saveDlg.GetPathName(); } - WMSG1("File will be saved to '%ls'\n", (LPCWSTR) saveName); + LOGI("File will be saved to '%ls'", (LPCWSTR) saveName); /* DiskImgLib does not like it if file already exists */ errMsg = pMain->RemoveFile(saveName); @@ -535,7 +535,7 @@ VolumeCopyDialog::OnCopyToFile(void) pProgressDialog = new VolumeXferProgressDialog; EnableWindow(FALSE); if (pProgressDialog->Create(this) == FALSE) { - WMSG0("Progress dialog init failed?!\n"); + LOGI("Progress dialog init failed?!"); ASSERT(false); goto bail; } @@ -579,7 +579,7 @@ VolumeCopyDialog::OnCopyToFile(void) msg.Format(L"Copied %ld blocks in %ld seconds (%.2fKB/sec)", pSrcImg->GetNumBlocks(), endWhen - startWhen, (pSrcImg->GetNumBlocks() / 2.0) / elapsed); - WMSG1("%ls\n", (LPCWSTR) msg); + LOGI("%ls", (LPCWSTR) msg); #ifdef _DEBUG pProgressDialog->MessageBox(msg, L"DEBUG: elapsed time", MB_OK); #endif @@ -599,7 +599,7 @@ bail: dierr = pSrcImg->OverrideFormat(pSrcImg->GetPhysicalFormat(), originalFormat, pSrcImg->GetSectorOrder()); if (dierr != kDIErrNone) { - WMSG1("ERROR: couldn't un-override source image (dierr=%d)\n", dierr); + LOGI("ERROR: couldn't un-override source image (dierr=%d)", dierr); // not much else to do; should be okay } } @@ -714,10 +714,10 @@ VolumeCopyDialog::OnCopyFromFile(void) ShowFailureMsg(this, errMsg, IDS_FAILED); goto bail; } - WMSG2("Source image '%ls' has %d 512-byte blocks\n", + LOGI("Source image '%ls' has %d 512-byte blocks", (LPCWSTR) loadName, srcImg.GetNumBlocks()); - WMSG1("Target volume has %d 512-byte blocks\n", pDstImg->GetNumBlocks()); + LOGI("Target volume has %d 512-byte blocks", pDstImg->GetNumBlocks()); if (srcImg.GetNumBlocks() > pDstImg->GetNumBlocks()) { errMsg.Format(L"Error: the disk image file has %ld blocks, but the" @@ -745,7 +745,7 @@ VolumeCopyDialog::OnCopyFromFile(void) srcImg.GetNumBlocks(), pDstImg->GetNumBlocks()); result = MessageBox(errMsg, warning, MB_OKCANCEL | MB_ICONQUESTION); if (result != IDOK) { - WMSG0("User chickened out of oversized disk copy\n"); + LOGI("User chickened out of oversized disk copy"); goto bail; } isPartial = true; @@ -758,7 +758,7 @@ VolumeCopyDialog::OnCopyFromFile(void) (LPCWSTR) targetName, (LPCWSTR) loadName, (LPCWSTR) targetName); result = MessageBox(errMsg, warning, MB_OKCANCEL | MB_ICONEXCLAMATION); if (result != IDOK) { - WMSG0("User chickened out of disk copy\n"); + LOGI("User chickened out of disk copy"); goto bail; } @@ -782,7 +782,7 @@ VolumeCopyDialog::OnCopyFromFile(void) pProgressDialog = new VolumeXferProgressDialog; EnableWindow(FALSE); if (pProgressDialog->Create(this) == FALSE) { - WMSG0("Progress dialog init failed?!\n"); + LOGI("Progress dialog init failed?!"); ASSERT(false); return; } @@ -834,7 +834,7 @@ VolumeCopyDialog::OnCopyFromFile(void) errMsg.Format(L"Copied %ld blocks in %ld seconds (%.2fKB/sec)", srcImg.GetNumBlocks(), endWhen - startWhen, (srcImg.GetNumBlocks() / 2.0) / elapsed); - WMSG1("%ls\n", (LPCWSTR) errMsg); + LOGI("%ls", (LPCWSTR) errMsg); #ifdef _DEBUG pProgressDialog->MessageBox(errMsg, L"DEBUG: elapsed time", MB_OK); #endif @@ -869,7 +869,7 @@ bail: * handed, but it's reliable. */ if (needReload) { - WMSG0("RELOAD dialog\n"); + LOGI("RELOAD dialog"); ScanDiskInfo(true); // reopens fpDiskFS LoadList(); diff --git a/app/VolumeCopyDialog.h b/app/VolumeCopyDialog.h index de64f2b..0234ee8 100644 --- a/app/VolumeCopyDialog.h +++ b/app/VolumeCopyDialog.h @@ -61,7 +61,7 @@ protected: // before we try to load any header images. void LoadListImages(void) { if (!fListImageList.Create(IDB_VOL_PICS, 16, 1, CLR_DEFAULT)) - WMSG0("GLITCH: list image create failed\n"); + LOGI("GLITCH: list image create failed"); fListImageList.SetBkColor(::GetSysColor(COLOR_WINDOW)); } enum { // defs for IDB_VOL_PICS diff --git a/diskimg/ASPI.cpp b/diskimg/ASPI.cpp index 6a751d3..32bf3d1 100644 --- a/diskimg/ASPI.cpp +++ b/diskimg/ASPI.cpp @@ -38,9 +38,9 @@ ASPI::Init(void) if (fhASPI == NULL) { DWORD lastErr = ::GetLastError(); if (lastErr == ERROR_MOD_NOT_FOUND) { - WMSG1("ASPI DLL '%s' not found\n", kASPIDllName); + LOGI("ASPI DLL '%s' not found", kASPIDllName); } else { - WMSG2("ASPI LoadLibrary(%s) failed (err=%ld)\n", + LOGI("ASPI LoadLibrary(%s) failed (err=%ld)", kASPIDllName, GetLastError()); } return kDIErrGeneric; @@ -50,7 +50,7 @@ ASPI::Init(void) SendASPI32Command = (DWORD(*)(LPSRB))::GetProcAddress(fhASPI, "SendASPI32Command"); GetASPI32DLLVersion = (DWORD(*)(void))::GetProcAddress(fhASPI, "GetASPI32DLLVersion"); if (GetASPI32SupportInfo == NULL || SendASPI32Command == NULL) { - WMSG0("ASPI functions not found in dll\n"); + LOGI("ASPI functions not found in dll"); ::FreeLibrary(fhASPI); fhASPI = NULL; return kDIErrGeneric; @@ -58,13 +58,13 @@ ASPI::Init(void) if (GetASPI32DLLVersion != NULL) { fASPIVersion = GetASPI32DLLVersion(); - WMSG4(" ASPI version is %d.%d.%d.%d\n", + LOGI(" ASPI version is %d.%d.%d.%d", fASPIVersion & 0x0ff, (fASPIVersion >> 8) & 0xff, (fASPIVersion >> 16) & 0xff, (fASPIVersion >> 24) & 0xff); } else { - WMSG0("ASPI WARNING: couldn't find GetASPI32DLLVersion interface\n"); + LOGI("ASPI WARNING: couldn't find GetASPI32DLLVersion interface"); } /* @@ -72,7 +72,7 @@ ASPI::Init(void) */ aspiStatus = GetASPI32SupportInfo(); if (HIBYTE(LOWORD(aspiStatus)) != SS_COMP) { - WMSG1("ASPI loaded but not working (status=%d)\n", + LOGI("ASPI loaded but not working (status=%d)", HIBYTE(LOWORD(aspiStatus))); ::FreeLibrary(fhASPI); fhASPI = NULL; @@ -80,7 +80,7 @@ ASPI::Init(void) } fHostAdapterCount = LOBYTE(LOWORD(aspiStatus)); - WMSG1("ASPI loaded successfully, hostAdapterCount=%d\n", + LOGI("ASPI loaded successfully, hostAdapterCount=%d", fHostAdapterCount); return kDIErrNone; @@ -92,7 +92,7 @@ ASPI::Init(void) ASPI::~ASPI(void) { if (fhASPI != NULL) { - WMSG0("Unloading ASPI DLL\n"); + LOGI("Unloading ASPI DLL"); ::FreeLibrary(fhASPI); fhASPI = NULL; } @@ -118,7 +118,7 @@ ASPI::HostAdapterInquiry(unsigned char adapter, AdapterInfo* pAdapterInfo) result = SendASPI32Command(&req); if (result != SS_COMP) { - WMSG2("ASPI(SC_HA_INQUIRY on %d) failed with result=0x%lx\n", + LOGI("ASPI(SC_HA_INQUIRY on %d) failed with result=0x%lx", adapter, result); return kDIErrASPIFailure; } @@ -328,19 +328,19 @@ ASPI::TestUnitReady(unsigned char adapter, unsigned char target, { // expect pSense->additionalSenseCode to be // kScsiAdSenseNoMediaInDevice; no need to check it really. - WMSG3(" ASPI TestUnitReady: drive %d:%d:%d is NOT ready\n", + LOGI(" ASPI TestUnitReady: drive %d:%d:%d is NOT ready", adapter, target, lun); } else { - WMSG3(" ASPI TestUnitReady failed, status=0x%02x sense=0x%02x ASC=0x%02x\n", + LOGI(" ASPI TestUnitReady failed, status=0x%02x sense=0x%02x ASC=0x%02x", srb.SRB_TargStat, pSense->senseKey, pSense->additionalSenseCode); } *pReady = false; } else { const CDB_SenseData* pSense = (const CDB_SenseData*) srb.SenseArea; - WMSG3(" ASPI TestUnitReady: drive %d:%d:%d is ready\n", + LOGI(" ASPI TestUnitReady: drive %d:%d:%d is ready", adapter, target, lun); - //WMSG3(" status=0x%02x sense=0x%02x ASC=0x%02x\n", + //LOGI(" status=0x%02x sense=0x%02x ASC=0x%02x", // srb.SRB_TargStat, pSense->senseKey, pSense->additionalSenseCode); *pReady = true; } @@ -363,7 +363,7 @@ ASPI::ReadBlocks(unsigned char adapter, unsigned char target, SRB_ExecSCSICmd srb; CDB10* pCDB; - //WMSG3(" ASPI ReadBlocks start=%ld num=%d (size=%d)\n", + //LOGI(" ASPI ReadBlocks start=%ld num=%d (size=%d)", // startBlock, numBlocks, blockSize); assert(sizeof(CDB10) == 10); @@ -405,7 +405,7 @@ ASPI::WriteBlocks(unsigned char adapter, unsigned char target, SRB_ExecSCSICmd srb; CDB10* pCDB; - WMSG3(" ASPI WriteBlocks start=%ld num=%d (size=%d)\n", + LOGI(" ASPI WriteBlocks start=%ld num=%d (size=%d)", startBlock, numBlocks, blockSize); assert(sizeof(CDB10) == 10); @@ -465,7 +465,7 @@ ASPI::ExecSCSICommand(SRB_ExecSCSICmd* pSRB) completionEvent = ::CreateEvent(NULL, FALSE, FALSE, NULL); if (completionEvent == NULL) { - WMSG0("Failed creating a completion event?\n"); + LOGI("Failed creating a completion event?"); return kDIErrGeneric; } @@ -477,16 +477,16 @@ ASPI::ExecSCSICommand(SRB_ExecSCSICmd* pSRB) (void)SendASPI32Command((LPSRB) pSRB); aspiStatus = pSRB->SRB_Status; if (aspiStatus == SS_PENDING) { - //WMSG0(" (waiting for completion)\n"); + //LOGI(" (waiting for completion)"); eventStatus = ::WaitForSingleObject(completionEvent, kTimeout * 1000); ::CloseHandle(completionEvent); if (eventStatus == WAIT_TIMEOUT) { - WMSG0(" ASPI exec timed out!\n"); + LOGI(" ASPI exec timed out!"); return kDIErrSCSIFailure; } else if (eventStatus != WAIT_OBJECT_0) { - WMSG1(" ASPI exec returned weird wait state %ld\n", eventStatus); + LOGI(" ASPI exec returned weird wait state %ld", eventStatus); return kDIErrGeneric; } } @@ -501,14 +501,14 @@ ASPI::ExecSCSICommand(SRB_ExecSCSICmd* pSRB) } else if (aspiStatus == SS_ERR) { const CDB_SenseData* pSense = (const CDB_SenseData*) pSRB->SenseArea; - WMSG4(" ASPI SCSI command 0x%02x failed: scsiStatus=0x%02x" + LOGI(" ASPI SCSI command 0x%02x failed: scsiStatus=0x%02x" " senseKey=0x%02x ASC=0x%02x\n", pSRB->CDBByte[0], pSRB->SRB_TargStat, pSense->senseKey, pSense->additionalSenseCode); return kDIErrSCSIFailure; } else { // SS_ABORTED, SS_ABORT_FAIL, SS_NO_DEVICE, ... - WMSG3(" ASPI failed on command 0x%02x: aspiStatus=%d scsiStatus=%d\n", + LOGI(" ASPI failed on command 0x%02x: aspiStatus=%d scsiStatus=%d", pSRB->CDBByte[0], aspiStatus, pSRB->SRB_TargStat); return kDIErrASPIFailure; } @@ -539,21 +539,21 @@ ASPI::GetAccessibleDevices(int deviceMask, ASPIDevice** ppDeviceArray, if (deviceArray == NULL) return kDIErrMalloc; - WMSG1("ASPI scanning %d host adapters\n", fHostAdapterCount); + LOGI("ASPI scanning %d host adapters", fHostAdapterCount); for (int ha = 0; ha < fHostAdapterCount; ha++) { AdapterInfo adi; dierr = HostAdapterInquiry(ha, &adi); if (dierr != kDIErrNone) { - WMSG1(" ASPI inquiry on %d failed\n", ha); + LOGI(" ASPI inquiry on %d failed", ha); continue; } - WMSG2(" ASPI host adapter %d (SCSI ID=%d)\n", ha, adi.adapterScsiID); - WMSG2(" identifier='%s' managerID='%s'\n", + LOGI(" ASPI host adapter %d (SCSI ID=%d)", ha, adi.adapterScsiID); + LOGI(" identifier='%s' managerID='%s'", adi.identifier, adi.managerID); - WMSG2(" maxTargets=%d bufferAlignment=%d\n", + LOGI(" maxTargets=%d bufferAlignment=%d", adi.maxTargets, adi.bufferAlignment); int maxTargets = adi.maxTargets; @@ -578,12 +578,12 @@ ASPI::GetAccessibleDevices(int deviceMask, ASPIDevice** ppDeviceArray, dierr = DeviceInquiry(ha, targ, lun, &inq); if (dierr != kDIErrNone) { - WMSG2(" ASPI DeviceInquiry for '%s' (type=%d) failed\n", + LOGI(" ASPI DeviceInquiry for '%s' (type=%d) failed", addrString, deviceType); continue; } - WMSG4(" Device %s is %s '%s' '%s'\n", + LOGI(" Device %s is %s '%s' '%s'", addrString, DeviceTypeToString(deviceType), inq.vendorID, inq.productID); @@ -599,14 +599,14 @@ ASPI::GetAccessibleDevices(int deviceMask, ASPIDevice** ppDeviceArray, continue; if (idx >= kMaxAccessibleDrives) { - WMSG0("GLITCH: ran out of places to stuff CD-ROM drives\n"); + LOGI("GLITCH: ran out of places to stuff CD-ROM drives"); assert(false); goto done; } dierr = TestUnitReady(ha, targ, lun, &deviceReady); if (dierr != kDIErrNone) { - WMSG1(" ASPI TestUnitReady for '%s' failed\n", addrString); + LOGI(" ASPI TestUnitReady for '%s' failed", addrString); continue; } diff --git a/diskimg/CFFA.cpp b/diskimg/CFFA.cpp index 98d4d29..61c6d1e 100644 --- a/diskimg/CFFA.cpp +++ b/diskimg/CFFA.cpp @@ -71,7 +71,7 @@ DiskFSCFFA::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, *pFormatFound = DiskImg::kFormatUnknown; } - WMSG1("----- BEGIN CFFA SCAN (fmt=%d) -----\n", *pFormatFound); + LOGI("----- BEGIN CFFA SCAN (fmt=%d) -----", *pFormatFound); startBlock = 0; totalBlocksLeft = totalBlocks; @@ -89,7 +89,7 @@ DiskFSCFFA::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, dierr = OpenSubVolume(pImg, startBlock, maxBlocks, true, &pNewImg, &pNewFS); if (dierr != kDIErrNone) { - WMSG0(" CFFA failed opening sub-volume #1\n"); + LOGI(" CFFA failed opening sub-volume #1"); goto bail; } fsNumBlocks = pNewFS->GetFSNumBlocks(); @@ -98,11 +98,11 @@ DiskFSCFFA::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, if (fsNumBlocks != kEarlyVolExpectedSize && fsNumBlocks != kEarlyVolExpectedSize-1) { - WMSG1(" CFFA found fsNumBlocks=%ld in slot #1\n", fsNumBlocks); + LOGI(" CFFA found fsNumBlocks=%ld in slot #1", fsNumBlocks); dierr = kDIErrFilesystemNotFound; goto bail; } - WMSG0(" CFFA found good volume in slot #1\n"); + LOGI(" CFFA found good volume in slot #1"); startBlock += maxBlocks; totalBlocksLeft -= maxBlocks; @@ -122,7 +122,7 @@ DiskFSCFFA::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, dierr = OpenSubVolume(pImg, startBlock, maxBlocks, true, &pNewImg, &pNewFS); if (dierr != kDIErrNone) { - WMSG0(" CFFA failed opening sub-volume #2\n"); + LOGI(" CFFA failed opening sub-volume #2"); if (maxBlocks < kEarlyVolExpectedSize) goto bail; // otherwise, assume they just didn't format #2, and keep going @@ -134,12 +134,12 @@ DiskFSCFFA::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, if (fsNumBlocks != kEarlyVolExpectedSize && fsNumBlocks != kEarlyVolExpectedSize-1) { - WMSG1(" CFFA found fsNumBlocks=%ld in slot #2\n", fsNumBlocks); + LOGI(" CFFA found fsNumBlocks=%ld in slot #2", fsNumBlocks); dierr = kDIErrFilesystemNotFound; goto bail; } #endif - WMSG0(" CFFA found good volume in slot #2\n"); + LOGI(" CFFA found good volume in slot #2"); } startBlock += maxBlocks; @@ -152,7 +152,7 @@ DiskFSCFFA::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, /* * Skip #3 and #4. */ - WMSG0(" CFFA skipping over slot #3\n"); + LOGI(" CFFA skipping over slot #3"); maxBlocks = kEarlyVolExpectedSize*2; if (maxBlocks > totalBlocksLeft) maxBlocks = totalBlocksLeft; @@ -163,7 +163,7 @@ DiskFSCFFA::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, *pFormatFound = DiskImg::kFormatCFFA4; goto bail; } - WMSG0(" CFFA skipping over slot #4\n"); + LOGI(" CFFA skipping over slot #4"); /* * Partition #5. We know where it starts, but not how large it is. @@ -185,7 +185,7 @@ DiskFSCFFA::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, * Treat it like 4-partition; it'll look like somebody slapped a * 32MB volume into the first 1GB area. */ - WMSG0(" CFFA assuming odd-sized slot #5\n"); + LOGI(" CFFA assuming odd-sized slot #5"); *pFormatFound = DiskImg::kFormatCFFA4; goto bail; } @@ -205,7 +205,7 @@ DiskFSCFFA::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, if (dierr != kDIErrNone) { if (dierr == kDIErrCancelled) goto bail; - WMSG0(" CFFA failed opening large sub-volume #5\n"); + LOGI(" CFFA failed opening large sub-volume #5"); // if we can't get #5, don't bother looking for #6 // (we could try anyway, but it's easier to just skip it) dierr = kDIErrNone; @@ -217,22 +217,22 @@ DiskFSCFFA::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, delete pNewFS; delete pNewImg; if (fsNumBlocks < 2 || fsNumBlocks > maxBlocks) { - WMSG1(" CFFA WARNING: FSNumBlocks #5 reported blocks=%ld\n", + LOGI(" CFFA WARNING: FSNumBlocks #5 reported blocks=%ld", fsNumBlocks); } if (fsNumBlocks == kEarlyVolExpectedSize-1 || fsNumBlocks == kEarlyVolExpectedSize) { - WMSG0(" CFFA #5 is a 32MB volume\n"); + LOGI(" CFFA #5 is a 32MB volume"); // tells us nothing -- could still be 4 or 8, so we keep going maxBlocks = kEarlyVolExpectedSize; } else if (fsNumBlocks > kEarlyVolExpectedSize) { // must be a GS/OS 1GB area - WMSG0(" CFFA #5 is larger than 32MB\n"); + LOGI(" CFFA #5 is larger than 32MB"); *pFormatFound = DiskImg::kFormatCFFA4; goto bail; } else { - WMSG1(" CFFA #5 was unexpectedly small (%ld blocks)\n", fsNumBlocks); + LOGI(" CFFA #5 was unexpectedly small (%ld blocks)", fsNumBlocks); // just stop now *pFormatFound = DiskImg::kFormatCFFA4; goto bail; @@ -242,7 +242,7 @@ DiskFSCFFA::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, totalBlocksLeft -= maxBlocks; if (!totalBlocksLeft) { - WMSG0(" CFFA got 5 volumes\n"); + LOGI(" CFFA got 5 volumes"); *pFormatFound = DiskImg::kFormatCFFA4; goto bail; } @@ -266,7 +266,7 @@ DiskFSCFFA::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, * The difference between C and D/E can *usually* be determined by * opening up a 6th partition in the two expected locations. */ - WMSG0(" CFFA probing 6th slot for 4-vs-8\n"); + LOGI(" CFFA probing 6th slot for 4-vs-8"); /* * Look in two different places. If we find something at the * +32MB mark, assume it's in "8 mode". If we find something at @@ -284,7 +284,7 @@ DiskFSCFFA::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, if (dierr != kDIErrNone) { if (dierr == kDIErrCancelled) goto bail; - WMSG0(" CFFA no vol #6 found at +32MB\n"); + LOGI(" CFFA no vol #6 found at +32MB"); } else { foundSmall = true; delete pNewFS; @@ -302,7 +302,7 @@ DiskFSCFFA::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, if (dierr != kDIErrNone) { if (dierr == kDIErrCancelled) goto bail; - WMSG0(" CFFA no vol #6 found at +1GB\n"); + LOGI(" CFFA no vol #6 found at +1GB"); } else { foundGig = true; delete pNewFS; @@ -313,25 +313,25 @@ DiskFSCFFA::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, dierr = kDIErrNone; if (!foundSmall && !foundGig) { - WMSG0(" CFFA no valid filesystem found in 6th position\n"); + LOGI(" CFFA no valid filesystem found in 6th position"); *pFormatFound = DiskImg::kFormatCFFA4; // don't bother looking for 7 and 8 } else if (foundSmall && foundGig) { - WMSG0(" CFFA WARNING: found valid volumes at +32MB *and* +1GB\n"); + LOGI(" CFFA WARNING: found valid volumes at +32MB *and* +1GB"); // default to 4-partition mode if (*pFormatFound == DiskImg::kFormatUnknown) *pFormatFound = DiskImg::kFormatCFFA4; } else if (foundGig) { - WMSG0(" CFFA found 6th volume at +1GB, assuming 4-mode w/GSOS\n"); + LOGI(" CFFA found 6th volume at +1GB, assuming 4-mode w/GSOS"); if (fsNumBlocks < 2 || fsNumBlocks > kOneGB) { - WMSG1(" CFFA WARNING: FSNumBlocks #6 reported as %ld\n", + LOGI(" CFFA WARNING: FSNumBlocks #6 reported as %ld", fsNumBlocks); } *pFormatFound = DiskImg::kFormatCFFA4; } else if (foundSmall) { - WMSG0(" CFFA found 6th volume at +32MB, assuming 8-mode\n"); + LOGI(" CFFA found 6th volume at +32MB, assuming 8-mode"); if (fsNumBlocks < 2 || fsNumBlocks > kEarlyVolExpectedSize) { - WMSG1(" CFFA WARNING: FSNumBlocks #6 reported as %ld\n", + LOGI(" CFFA WARNING: FSNumBlocks #6 reported as %ld", fsNumBlocks); } *pFormatFound = DiskImg::kFormatCFFA8; @@ -342,7 +342,7 @@ DiskFSCFFA::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, // done! bail: - WMSG2("----- END CFFA SCAN (err=%d format=%d) -----\n", + LOGI("----- END CFFA SCAN (err=%d format=%d) -----", dierr, *pFormatFound); if (dierr == kDIErrNone) { assert(*pFormatFound != DiskImg::kFormatUnknown); @@ -375,33 +375,33 @@ DiskFSCFFA::OpenSubVolume(DiskImg* pImg, long startBlock, long numBlocks, dierr = pNewImg->OpenImage(pImg, startBlock, numBlocks); if (dierr != kDIErrNone) { - WMSG3(" CFFASub: OpenImage(%ld,%ld) failed (err=%d)\n", + LOGI(" CFFASub: OpenImage(%ld,%ld) failed (err=%d)", startBlock, numBlocks, dierr); goto bail; } - //WMSG2(" +++ CFFASub: new image has ro=%d (parent=%d)\n", + //LOGI(" +++ CFFASub: new image has ro=%d (parent=%d)", // pNewImg->GetReadOnly(), pImg->GetReadOnly()); dierr = pNewImg->AnalyzeImage(); if (dierr != kDIErrNone) { - WMSG1(" CFFASub: analysis failed (err=%d)\n", dierr); + LOGI(" CFFASub: analysis failed (err=%d)", dierr); goto bail; } if (pNewImg->GetFSFormat() == DiskImg::kFormatUnknown || pNewImg->GetSectorOrder() == DiskImg::kSectorOrderUnknown) { - WMSG1(" CFFASub: unable to identify filesystem at %ld\n", + LOGI(" CFFASub: unable to identify filesystem at %ld", startBlock); dierr = kDIErrUnsupportedFSFmt; goto bail; } /* open a DiskFS for the sub-image */ - WMSG2(" CFFASub (%ld,%ld) analyze succeeded!\n", startBlock, numBlocks); + LOGI(" CFFASub (%ld,%ld) analyze succeeded!", startBlock, numBlocks); pNewFS = pNewImg->OpenAppropriateDiskFS(); if (pNewFS == NULL) { - WMSG0(" CFFASub: OpenAppropriateDiskFS failed\n"); + LOGI(" CFFASub: OpenAppropriateDiskFS failed"); dierr = kDIErrUnsupportedFSFmt; goto bail; } @@ -421,7 +421,7 @@ DiskFSCFFA::OpenSubVolume(DiskImg* pImg, long startBlock, long numBlocks, initMode = kInitFull; dierr = pNewFS->Initialize(pNewImg, initMode); if (dierr != kDIErrNone) { - WMSG1(" CFFASub: error %d reading list of files from disk\n", dierr); + LOGI(" CFFASub: error %d reading list of files from disk", dierr); goto bail; } @@ -459,7 +459,7 @@ DiskFSCFFA::TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, // make sure we didn't tamper with it assert(*pFormat == DiskImg::kFormatUnknown); - WMSG0(" FS didn't find valid CFFA\n"); + LOGI(" FS didn't find valid CFFA"); return kDIErrFilesystemNotFound; } @@ -472,7 +472,7 @@ DiskFSCFFA::Initialize(void) { DIError dierr = kDIErrNone; - WMSG1("CFFA initializing (scanForSub=%d)\n", fScanForSubVolumes); + LOGI("CFFA initializing (scanForSub=%d)", fScanForSubVolumes); /* seems pointless *not* to, but we just do what we're told */ if (fScanForSubVolumes != kScanSubDisabled) { @@ -504,13 +504,13 @@ DiskFSCFFA::FindSubVolumes(void) blocksLeft = fpImg->GetNumBlocks(); if (fpImg->GetFSFormat() == DiskImg::kFormatCFFA4) { - WMSG0(" CFFA opening 4+2 volumes\n"); + LOGI(" CFFA opening 4+2 volumes"); dierr = AddVolumeSeries(0, 4, kEarlyVolExpectedSize, /*ref*/startBlock, /*ref*/blocksLeft); if (dierr != kDIErrNone) goto bail; - WMSG2(" CFFA after first 4, startBlock=%ld blocksLeft=%ld\n", + LOGI(" CFFA after first 4, startBlock=%ld blocksLeft=%ld", startBlock, blocksLeft); if (blocksLeft > 0) { dierr = AddVolumeSeries(4, 2, kOneGB, /*ref*/startBlock, @@ -519,7 +519,7 @@ DiskFSCFFA::FindSubVolumes(void) goto bail; } } else if (fpImg->GetFSFormat() == DiskImg::kFormatCFFA8) { - WMSG0(" CFFA opening 8 volumes\n"); + LOGI(" CFFA opening 8 volumes"); dierr = AddVolumeSeries(0, 8, kEarlyVolExpectedSize, /*ref*/startBlock, /*ref*/blocksLeft); if (dierr != kDIErrNone) @@ -530,7 +530,7 @@ DiskFSCFFA::FindSubVolumes(void) } if (blocksLeft != 0) { - WMSG1(" CFFA ignoring leftover %ld blocks\n", blocksLeft); + LOGI(" CFFA ignoring leftover %ld blocks", blocksLeft); } bail: @@ -566,21 +566,21 @@ DiskFSCFFA::AddVolumeSeries(int start, int count, long blocksPerVolume, if (dierr != kDIErrNone) { if (dierr == kDIErrCancelled) goto bail; - WMSG1(" CFFA failed opening sub-volume %d (not formatted?)\n", i); + LOGI(" CFFA failed opening sub-volume %d (not formatted?)", i); /* create a fake one to represent the partition */ dierr = CreatePlaceholder(startBlock, maxBlocks, NULL, NULL, &pNewImg, &pNewFS); if (dierr == kDIErrNone) { AddSubVolumeToList(pNewImg, pNewFS); } else { - WMSG3(" CFFA unable to create placeholder (%ld, %ld) (err=%d)\n", + LOGI(" CFFA unable to create placeholder (%ld, %ld) (err=%d)", startBlock, maxBlocks, dierr); goto bail; } } else { fsNumBlocks = pNewFS->GetFSNumBlocks(); if (fsNumBlocks < 2 || fsNumBlocks > blocksPerVolume) { - WMSG2(" CFFA WARNING: FSNumBlocks #%d reported as %ld\n", + LOGI(" CFFA WARNING: FSNumBlocks #%d reported as %ld", i, fsNumBlocks); } AddSubVolumeToList(pNewImg, pNewFS); diff --git a/diskimg/CPM.cpp b/diskimg/CPM.cpp index c4f403b..7410e86 100644 --- a/diskimg/CPM.cpp +++ b/diskimg/CPM.cpp @@ -88,7 +88,7 @@ TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder) dptr += DiskFSCPM::kDirectoryEntryLen; } if (dierr == kDIErrNone) { - WMSG1(" CPM found clean directory, imageOrder=%d\n", imageOrder); + LOGI(" CPM found clean directory, imageOrder=%d", imageOrder); } bail: @@ -109,7 +109,7 @@ DiskFSCPM::TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, if (pImg->GetNumBlocks() == 0 || (pImg->GetNumBlocks() & 0x01) != 0) { - WMSG1(" CPM rejecting image with numBlocks=%ld\n", + LOGI(" CPM rejecting image with numBlocks=%ld", pImg->GetNumBlocks()); return kDIErrFilesystemNotFound; } @@ -128,7 +128,7 @@ DiskFSCPM::TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, } } - WMSG0(" CPM didn't find valid FS\n"); + LOGI(" CPM didn't find valid FS"); return kDIErrFilesystemNotFound; } @@ -218,7 +218,7 @@ DiskFSCPM::ReadCatalog(void) continue; if (fDirEntry[i].userNumber > kMaxUserNumber) { /* skip over volume label, date stamps, etc */ - WMSG1("Skipping entry with userNumber=0x%02x\n", + LOGI("Skipping entry with userNumber=0x%02x", fDirEntry[i].userNumber); } @@ -246,7 +246,7 @@ DiskFSCPM::ReadCatalog(void) continue; for (int j = 0; j < kDirEntryBlockCount; j++) { if (fDirEntry[i].blocks[j] >= maxCpmBlock) { - WMSG2(" CPM invalid block %d in file '%s'\n", + LOGI(" CPM invalid block %d in file '%s'", fDirEntry[i].blocks[j], fDirEntry[i].fileName); //pFile->SetQuality(A2File::kQualityDamaged); fDirEntry[i].badBlockList = true; @@ -324,7 +324,7 @@ DiskFSCPM::ComputeLength(A2FileCPM* pFile) } if (maxExtent < 0 || best < 0) { - WMSG1(" CPM couldn't find existing file '%s'!\n", pFile->fFileName); + LOGI(" CPM couldn't find existing file '%s'!", pFile->fFileName); assert(false); return kDIErrInternal; } @@ -385,13 +385,13 @@ DiskFSCPM::SetBlockUsage(long block, VolumeUsage::ChunkPurpose purpose) VolumeUsage::ChunkState cstate; if (fVolumeUsage.GetChunkState(block, &cstate) != kDIErrNone) { - WMSG1(" CPM ERROR: unable to set state on block %ld\n", block); + LOGI(" CPM ERROR: unable to set state on block %ld", block); return; } if (cstate.isUsed) { cstate.purpose = VolumeUsage::kChunkPurposeConflict; - WMSG1(" CPM conflicting uses for block=%ld\n", block); + LOGI(" CPM conflicting uses for block=%ld", block); } else { cstate.isUsed = true; cstate.isMarkedUsed = true; // no volume bitmap @@ -530,7 +530,7 @@ A2FileCPM::GetBlockList(long* pBlockCount, unsigned char* blockBuf) const /* this entry is part of the file */ for (j = 0; j < DiskFSCPM::kDirEntryBlockCount; j++) { if (fpDirEntry[i].blocks[j] == 0) { - WMSG2(" CPM found sparse block %d/%d\n", i, j); + LOGI(" CPM found sparse block %d/%d", i, j); } blockCount++; @@ -548,11 +548,11 @@ A2FileCPM::GetBlockList(long* pBlockCount, unsigned char* blockBuf) const } if (length > 0) { - WMSG1(" CPM WARNING: can't account for %ld bytes!\n", (long) length); + LOGI(" CPM WARNING: can't account for %ld bytes!", (long) length); //assert(false); } - //WMSG2(" Returning blockCount=%d for '%s'\n", blockCount, + //LOGI(" Returning blockCount=%d for '%s'", blockCount, // fpDirEntry[fDirIdx].fileName); if (pBlockCount != NULL) { assert(blockBuf == NULL || *pBlockCount == blockCount); @@ -568,7 +568,7 @@ A2FileCPM::GetBlockList(long* pBlockCount, unsigned char* blockBuf) const void A2FileCPM::Dump(void) const { - WMSG2("A2FileCPM '%s' length=%ld\n", fFileName, (long) fLength); + LOGI("A2FileCPM '%s' length=%ld", fFileName, (long) fLength); } @@ -584,7 +584,7 @@ A2FileCPM::Dump(void) const DIError A2FDCPM::Read(void* buf, size_t len, size_t* pActual) { - WMSG3(" CP/M reading %d bytes from '%s' (offset=%ld)\n", + LOGI(" CP/M reading %d bytes from '%s' (offset=%ld)", len, fpFile->GetPathName(), (long) fOffset); A2FileCPM* pFile = (A2FileCPM*) fpFile; @@ -638,13 +638,13 @@ A2FDCPM::Read(void* buf, size_t len, size_t* pActual) dierr = fpFile->GetDiskFS()->GetDiskImg()->ReadBlock(prodosBlock, blkBuf); if (dierr != kDIErrNone) { - WMSG1(" CP/M error1 reading file '%s'\n", pFile->fFileName); + LOGI(" CP/M error1 reading file '%s'", pFile->fFileName); return dierr; } dierr = fpFile->GetDiskFS()->GetDiskImg()->ReadBlock(prodosBlock+1, blkBuf + kBlkSize); if (dierr != kDIErrNone) { - WMSG1(" CP/M error2 reading file '%s'\n", pFile->fFileName); + LOGI(" CP/M error2 reading file '%s'", pFile->fFileName); return dierr; } } diff --git a/diskimg/Container.cpp b/diskimg/Container.cpp index 31cb1a6..3e82d02 100644 --- a/diskimg/Container.cpp +++ b/diskimg/Container.cpp @@ -43,11 +43,11 @@ DiskFSContainer::CreatePlaceholder(long startBlock, long numBlocks, DiskFS* pNewFS = NULL; DiskImg* pNewImg = NULL; - WMSG3(" %s/CrPl creating placeholder for %ld +%ld\n", GetDebugName(), + LOGI(" %s/CrPl creating placeholder for %ld +%ld", GetDebugName(), startBlock, numBlocks); if (startBlock > fpImg->GetNumBlocks()) { - WMSG3(" %s/CrPl start block out of range (%ld vs %ld)\n", + LOGI(" %s/CrPl start block out of range (%ld vs %ld)", GetDebugName(), startBlock, fpImg->GetNumBlocks()); return kDIErrBadPartition; } @@ -69,7 +69,7 @@ DiskFSContainer::CreatePlaceholder(long startBlock, long numBlocks, dierr = pNewImg->OpenImage(fpImg, startBlock, numBlocks); if (dierr != kDIErrNone) { - WMSG4(" %s/CrPl: OpenImage(%ld,%ld) failed (err=%d)\n", + LOGI(" %s/CrPl: OpenImage(%ld,%ld) failed (err=%d)", GetDebugName(), startBlock, numBlocks, dierr); goto bail; } @@ -82,14 +82,14 @@ DiskFSContainer::CreatePlaceholder(long startBlock, long numBlocks, */ dierr = pNewImg->AnalyzeImage(); if (dierr != kDIErrNone) { - WMSG2(" %s/CrPl: analysis failed (err=%d)\n", GetDebugName(), dierr); + LOGI(" %s/CrPl: analysis failed (err=%d)", GetDebugName(), dierr); goto bail; } if (pNewImg->GetFSFormat() != DiskImg::kFormatUnknown) { dierr = pNewImg->OverrideFormat(pNewImg->GetPhysicalFormat(), DiskImg::kFormatUnknown, pNewImg->GetSectorOrder()); if (dierr != kDIErrNone) { - WMSG1(" %s/CrPl: unable to override to unknown\n", + LOGI(" %s/CrPl: unable to override to unknown", GetDebugName()); goto bail; } @@ -98,7 +98,7 @@ DiskFSContainer::CreatePlaceholder(long startBlock, long numBlocks, /* open a DiskFS for the sub-image, allowing "unknown" */ pNewFS = pNewImg->OpenAppropriateDiskFS(true); if (pNewFS == NULL) { - WMSG1(" %s/CrPl: OpenAppropriateDiskFS failed\n", GetDebugName()); + LOGI(" %s/CrPl: OpenAppropriateDiskFS failed", GetDebugName()); dierr = kDIErrUnsupportedFSFmt; goto bail; } @@ -106,7 +106,7 @@ DiskFSContainer::CreatePlaceholder(long startBlock, long numBlocks, /* sets the DiskImg ptr (and very little else) */ dierr = pNewFS->Initialize(pNewImg, kInitFull); if (dierr != kDIErrNone) { - WMSG2(" %s/CrPl: init failed (err=%d)\n", GetDebugName(), dierr); + LOGI(" %s/CrPl: init failed (err=%d)", GetDebugName(), dierr); goto bail; } diff --git a/diskimg/DDD.cpp b/diskimg/DDD.cpp index df80efb..aa514e5 100644 --- a/diskimg/DDD.cpp +++ b/diskimg/DDD.cpp @@ -266,7 +266,7 @@ WrapperDDD::PackDisk(GenericFD* pSrcGFD, GenericFD* pWrapperGFD, dierr = pSrcGFD->Read(trackBuf, kTrackLen); if (dierr != kDIErrNone) { - WMSG1(" DDD error during read (err=%d)\n", dierr); + LOGI(" DDD error during read (err=%d)", dierr); goto bail; } @@ -394,7 +394,7 @@ WrapperDDD::ComputeFreqCounts(const unsigned char* trackBuf, } } - //WMSG2("Found run of %d of 0x%02x\n", runLen, *ucp); + //LOGI("Found run of %d of 0x%02x", runLen, *ucp); } else { /* not a run, just update stats */ freqCounts[*ucp]++; @@ -428,10 +428,10 @@ WrapperDDD::ComputeFavorites(unsigned short* freqCounts, freqCounts[bestSym] = 0; } - //WMSG0("FAVORITES: "); + //LOGI("FAVORITES: "); //for (fav = 0; fav < kNumFavorites; fav++) - // WMSG1("%02x\n", favorites[fav]); - //WMSG0("\n"); + // LOGI("%02x", favorites[fav]); + //LOGI(""); } @@ -477,25 +477,25 @@ WrapperDDD::UnpackDisk(GenericFD* pGFD, GenericFD* pNewGFD, val = bitBuffer.GetBits(3); if (val != 0) { - WMSG1(" DDD bits not zero, this isn't a DDD II file (0x%02x)\n", val); + LOGI(" DDD bits not zero, this isn't a DDD II file (0x%02x)", val); dierr = kDIErrGeneric; goto bail; } val = bitBuffer.GetBits(8); *pDiskVolNum = bitBuffer.Reverse(val); - WMSG1(" DDD found disk volume num = %d\n", *pDiskVolNum); + LOGI(" DDD found disk volume num = %d", *pDiskVolNum); int track; for (track = 0; track < kNumTracks; track++) { unsigned char trackBuf[kTrackLen]; if (!UnpackTrack(&bitBuffer, trackBuf)) { - WMSG1(" DDD failed unpacking track %d\n", track); + LOGI(" DDD failed unpacking track %d", track); dierr = kDIErrBadCompressedData; goto bail; } if (bitBuffer.IOFailure()) { - WMSG0(" DDD failure or EOF on input file\n"); + LOGI(" DDD failure or EOF on input file"); dierr = kDIErrBadCompressedData; goto bail; } @@ -522,16 +522,16 @@ WrapperDDD::UnpackDisk(GenericFD* pGFD, GenericFD* pNewGFD, dierr = pGFD->Read(&sctBuf, sizeof(sctBuf), &actual); if (dierr == kDIErrNone) { if (actual > /*kMaxExcessByteCount*/ 256) { - WMSG1(" DDD looks like too much data in input file (%d extra)\n", + LOGI(" DDD looks like too much data in input file (%d extra)", actual); dierr = kDIErrBadCompressedData; goto bail; } else { - WMSG1(" DDD excess bytes (%d) within normal parameters\n", actual); + LOGI(" DDD excess bytes (%d) within normal parameters", actual); } } - WMSG0(" DDD looks like a DDD archive!\n"); + LOGI(" DDD looks like a DDD archive!"); dierr = kDIErrNone; bail: @@ -617,14 +617,14 @@ WrapperDDD::UnpackTrack(BitBuffer* pBitBuffer, unsigned char* trackBuf) rleChar = pBitBuffer->Reverse(val); val = pBitBuffer->GetBits(8); rleCount = pBitBuffer->Reverse(val); - //WMSG2(" DDD found run of %d of 0x%02x\n", rleCount, rleChar); + //LOGI(" DDD found run of %d of 0x%02x", rleCount, rleChar); if (rleCount == 0) rleCount = 256; /* make sure we won't overrun */ if (trackPtr + rleCount > trackBuf + kTrackLen) { - WMSG0(" DDD overrun in RLE\n"); + LOGI(" DDD overrun in RLE"); return false; } while (rleCount--) diff --git a/diskimg/DIUtil.cpp b/diskimg/DIUtil.cpp index d8880af..ebf34b3 100644 --- a/diskimg/DIUtil.cpp +++ b/diskimg/DIUtil.cpp @@ -347,13 +347,13 @@ DiskImgLib::LastErrorToDIError(void) // ERROR_SEM_TIMEOUT seen read bad blocks from floptical under Win2K case ERROR_INVALID_HANDLE: // 6 - WMSG0("HEY: got ERROR_INVALID_HANDLE!\n"); + LOGI("HEY: got ERROR_INVALID_HANDLE!"); return kDIErrInternal; case ERROR_NEGATIVE_SEEK: // 131 - WMSG0("HEY: got ERROR_NEGATIVE_SEEK!\n"); + LOGI("HEY: got ERROR_NEGATIVE_SEEK!"); return kDIErrInternal; default: - WMSG2("LastErrorToDIError: not converting 0x%08lx (%ld)\n", + LOGI("LastErrorToDIError: not converting 0x%08lx (%ld)", lastErr, lastErr); return kDIErrGeneric; } diff --git a/diskimg/DOS33.cpp b/diskimg/DOS33.cpp index d95456f..7f919e3 100644 --- a/diskimg/DOS33.cpp +++ b/diskimg/DOS33.cpp @@ -99,7 +99,7 @@ TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, int* pGoodCount) !(catTrack < numTracks && catSect < numSectors) || 0) { - WMSG1(" DOS header test failed (order=%d)\n", imageOrder); + LOGI(" DOS header test failed (order=%d)", imageOrder); dierr = kDIErrFilesystemNotFound; goto bail; } @@ -122,7 +122,7 @@ TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, int* pGoodCount) if (catTrack == sctBuf[1] && catSect == sctBuf[2] +1) foundGood++; else if (catTrack == sctBuf[1] && catSect == sctBuf[2]) { - WMSG2(" DOS detected self-reference on cat (%d,%d)\n", + LOGI(" DOS detected self-reference on cat (%d,%d)", catTrack, catSect); break; } @@ -133,11 +133,11 @@ TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, int* pGoodCount) if (iterations >= DiskFSDOS33::kMaxCatalogSectors) { /* possible cause: LF->CR conversion screws up link to sector $0a */ dierr = kDIErrDirectoryLoop; - WMSG1(" DOS directory links cause a loop (order=%d)\n", imageOrder); + LOGI(" DOS directory links cause a loop (order=%d)", imageOrder); goto bail; } - WMSG2(" DOS foundGood=%d order=%d\n", foundGood, imageOrder); + LOGI(" DOS foundGood=%d order=%d", foundGood, imageOrder); *pGoodCount = foundGood; bail: @@ -177,7 +177,7 @@ DiskFSDOS33::TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, if (bestCount >= 4 || (leniency == kLeniencyVery && bestCount >= 2)) { - WMSG2(" DOS test: bestCount=%d for order=%d\n", bestCount, bestOrder); + LOGI(" DOS test: bestCount=%d for order=%d", bestCount, bestOrder); assert(bestOrder != DiskImg::kSectorOrderUnknown); *pOrder = bestOrder; *pFormat = DiskImg::kFormatDOS33; @@ -186,7 +186,7 @@ DiskFSDOS33::TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, return kDIErrNone; } - WMSG0(" DOS33 didn't find valid DOS3.2 or DOS3.3\n"); + LOGI(" DOS33 didn't find valid DOS3.2 or DOS3.3"); return kDIErrFilesystemNotFound; } @@ -215,7 +215,7 @@ DiskFSDOS33::Initialize(InitMode initMode) goto bail; if (initMode == kInitHeaderOnly) { - WMSG0(" DOS - headerOnly set, skipping file load\n"); + LOGI(" DOS - headerOnly set, skipping file load"); goto bail; } @@ -271,11 +271,11 @@ DiskFSDOS33::ReadVTOC(void) return kDIErrBadDiskImage; if (fVTOCNumTracks != fpImg->GetNumTracks()) { - WMSG2(" DOS33 warning: VTOC numtracks %d vs %ld\n", + LOGI(" DOS33 warning: VTOC numtracks %d vs %ld", fVTOCNumTracks, fpImg->GetNumTracks()); } if (fVTOCNumSectors != fpImg->GetNumSectPerTrack()) { - WMSG2(" DOS33 warning: VTOC numsect %d vs %d\n", + LOGI(" DOS33 warning: VTOC numsect %d vs %d", fVTOCNumSectors, fpImg->GetNumSectPerTrack()); } @@ -300,7 +300,7 @@ DiskFSDOS33::UpdateVolumeNum(void) else SetDiskVolumeNum(fpImg->GetDOSVolumeNum()); if (fDiskVolumeNum != fVTOCVolumeNumber) { - WMSG2(" NOTE: ignoring VTOC vol (%d) in favor of embedded (%d)\n", + LOGI(" NOTE: ignoring VTOC vol (%d) in favor of embedded (%d)", fVTOCVolumeNumber, fDiskVolumeNum); } } @@ -334,9 +334,9 @@ void DiskFSDOS33::DumpVTOC(void) { - WMSG2("VTOC catalog: track=%d sector=%d\n", + LOGI("VTOC catalog: track=%d sector=%d", fFirstCatTrack, fFirstCatSector); - WMSG3(" volnum=%d numTracks=%d numSects=%d\n", + LOGI(" volnum=%d numTracks=%d numSects=%d", fVTOCVolumeNumber, fVTOCNumTracks, fVTOCNumSectors); } @@ -349,12 +349,12 @@ DiskFSDOS33::SetSectorUsage(long track, long sector, { VolumeUsage::ChunkState cstate; - //WMSG3(" DOS setting usage %d,%d to %d\n", track, sector, purpose); + //LOGI(" DOS setting usage %d,%d to %d", track, sector, purpose); fVolumeUsage.GetChunkState(track, sector, &cstate); if (cstate.isUsed) { cstate.purpose = VolumeUsage::kChunkPurposeConflict; -// WMSG2(" DOS conflicting uses for t=%d s=%d\n", track, sector); +// LOGI(" DOS conflicting uses for t=%d s=%d", track, sector); } else { cstate.isUsed = true; cstate.purpose = purpose; @@ -393,7 +393,7 @@ DiskFSDOS33::ScanVolBitmap(void) if (dierr != kDIErrNone) goto bail; - WMSG0(" map 0123456789abcdef\n"); + LOGI(" map 0123456789abcdef"); int i; for (i = 0; i < kMaxTracks; i++) { @@ -418,7 +418,7 @@ DiskFSDOS33::ScanVolBitmap(void) } val <<= 1; } - WMSG3(" %2d: %s (0x%08lx)\n", i, freemap, origVal); + LOGI(" %2d: %s (0x%08lx)", i, freemap, origVal); } /* we know the VTOC is used, so mark it now */ @@ -539,7 +539,7 @@ DiskFSDOS33::AllocSector(TrackSector* pTS) break; } if (track == numTracks) { - WMSG0("DOS33 AllocSector unable to find empty sector\n"); + LOGI("DOS33 AllocSector unable to find empty sector"); return kDIErrDiskFull; } } @@ -551,7 +551,7 @@ DiskFSDOS33::AllocSector(TrackSector* pTS) sector = numSectPerTrack-1; while (sector >= 0) { if (val & 0x80000000) { - //WMSG2("+++ allocating T=%d S=%d\n", track, sector); + //LOGI("+++ allocating T=%d S=%d", track, sector); SetSectorUseEntry(track, sector, true); break; } @@ -767,7 +767,7 @@ DiskFSDOS33::ReadCatalog(void) { SetSectorUsage(catTrack, catSect, VolumeUsage::kChunkPurposeVolumeDir); - WMSG2(" DOS33 reading catalog sector T=%d S=%d\n", catTrack, catSect); + LOGI(" DOS33 reading catalog sector T=%d S=%d", catTrack, catSect); dierr = fpImg->ReadTrackSector(catTrack, catSect, sctBuf); if (dierr != kDIErrNone) goto bail; @@ -776,7 +776,7 @@ DiskFSDOS33::ReadCatalog(void) * Watch for flaws that the DOS detector allows. */ if (catTrack == sctBuf[0x01] && catSect == sctBuf[0x02]) { - WMSG2(" DOS detected self-reference on cat (%d,%d)\n", + LOGI(" DOS detected self-reference on cat (%d,%d)", catTrack, catSect); break; } @@ -789,7 +789,7 @@ DiskFSDOS33::ReadCatalog(void) if (sctBuf[0x01] >= fpImg->GetNumTracks() || sctBuf[0x02] >= fpImg->GetNumSectPerTrack()) { - WMSG0(" DOS bailing out early on catalog read due to funky T/S\n"); + LOGI(" DOS bailing out early on catalog read due to funky T/S"); break; } @@ -851,7 +851,7 @@ DiskFSDOS33::ProcessCatalogSector(int catTrack, int catSect, case 0x40: pFile->fFileType = A2FileDOS::kTypeB; break; default: /* some odd arrangement of bit flags? */ - WMSG1(" DOS33 peculiar filetype byte 0x%02x\n", pEntry[0x02]); + LOGI(" DOS33 peculiar filetype byte 0x%02x", pEntry[0x02]); pFile->fFileType = A2FileDOS::kTypeUnknown; pFile->SetQuality(A2File::kQualitySuspicious); break; @@ -1008,21 +1008,21 @@ DiskFSDOS33::GetFileLengths(void) DIError dierr; dierr = pFile->LoadTSList(&tsList, &tsCount, &indexList, &indexCount); if (dierr != kDIErrNone) { - WMSG1("DOS failed loading TS list for '%s'\n", + LOGI("DOS failed loading TS list for '%s'", pFile->GetPathName()); pFile->SetQuality(A2File::kQualityDamaged); } else { MarkFileUsage(pFile, tsList, tsCount, indexList, indexCount); dierr = ComputeLength(pFile, tsList, tsCount); if (dierr != kDIErrNone) { - WMSG1("DOS unable to get length for '%s'\n", + LOGI("DOS unable to get length for '%s'", pFile->GetPathName()); pFile->SetQuality(A2File::kQualityDamaged); } } if (pFile->fLengthInSectors != indexCount + tsCount) { - WMSG3("DOS NOTE: file '%s' has len-in-sect=%d but actual=%d\n", + LOGI("DOS NOTE: file '%s' has len-in-sect=%d but actual=%d", pFile->GetPathName(), pFile->fLengthInSectors, indexCount + tsCount); // expected on sparse random-access text files @@ -1102,7 +1102,7 @@ DiskFSDOS33::ComputeLength(A2FileDOS* pFile, const TrackSector* tsList, pFile->fFileType == A2FileDOS::kTypeBinary) { /* read first sector and analyze it */ - //WMSG0(" DOS reading first file sector\n"); + //LOGI(" DOS reading first file sector"); dierr = fpImg->ReadTrackSector(tsList[0].track, tsList[0].sector, sctBuf); if (dierr != kDIErrNone) @@ -1126,12 +1126,12 @@ DiskFSDOS33::ComputeLength(A2FileDOS* pFile, const TrackSector* tsList, strchr(pFile->fFileName, '<') != NULL && strchr(pFile->fFileName, '>') != NULL) { - WMSG2(" DOS found probable DDD archive, tweaking '%s' (lis=%u)\n", + LOGI(" DOS found probable DDD archive, tweaking '%s' (lis=%u)", pFile->GetPathName(), pFile->fLengthInSectors); //dierr = TrimLastSectorDown(pFile, tsBuf, WrapperDDD::kMaxDDDZeroCount); //if (dierr != kDIErrNone) // goto bail; - //WMSG3(" DOS scanned DDD file '%s' to length %ld (tsCount=%d)\n", + //LOGI(" DOS scanned DDD file '%s' to length %ld (tsCount=%d)", // pFile->fFileName, pFile->fLength, pFile->fTSListCount); pFile->fLength = tsCount * kSctSize; pFile->fDataOffset = 0; @@ -1139,7 +1139,7 @@ DiskFSDOS33::ComputeLength(A2FileDOS* pFile, const TrackSector* tsList, /* catch bogus lengths in damaged A/I/B files */ if (pFile->fLength > tsCount * kSctSize) { - WMSG3(" DOS33 capping max len from %ld to %d in '%s'\n", + LOGI(" DOS33 capping max len from %ld to %d in '%s'", (long) pFile->fLength, tsCount * kSctSize, pFile->fFileName); pFile->fLength = tsCount * kSctSize - pFile->fDataOffset; @@ -1163,7 +1163,7 @@ DiskFSDOS33::ComputeLength(A2FileDOS* pFile, const TrackSector* tsList, if (dierr != kDIErrNone) goto bail; - WMSG4(" DOS scanned text file '%s' down to %d+%ld = %ld\n", + LOGI(" DOS scanned text file '%s' down to %d+%ld = %ld", pFile->fFileName, (tsCount-1) * kSctSize, (long)pFile->fLength - (tsCount-1) * kSctSize, @@ -1220,7 +1220,7 @@ DiskFSDOS33::TrimLastSectorUp(A2FileDOS* pFile, TrackSector lastTS) return kDIErrNone; } - //WMSG0(" DOS reading LAST file sector\n"); + //LOGI(" DOS reading LAST file sector"); dierr = fpImg->ReadTrackSector(lastTS.track, lastTS.sector, sctBuf); if (dierr != kDIErrNone) goto bail; @@ -1290,7 +1290,7 @@ DiskFSDOS33::TrimLastSectorDown(A2FileDOS* pFile, unsigned short* tsBuf, unsigned char sctBuf[kSctSize]; int i; - //WMSG0(" DOS reading LAST file sector\n"); + //LOGI(" DOS reading LAST file sector"); dierr = fpImg->ReadTrackSector( pFile->TSTrack(tsBuf[pFile->fTSListCount-1]), pFile->TSSector(tsBuf[pFile->fTSListCount-1]), @@ -1428,14 +1428,14 @@ DiskFSDOS33::Format(DiskImg* pDiskImg, const char* volName) if (pDiskImg->GetNumTracks() < kMinTracks || pDiskImg->GetNumTracks() > kMaxTracks) { - WMSG1(" DOS33 can't format numTracks=%ld\n", pDiskImg->GetNumTracks()); + LOGI(" DOS33 can't format numTracks=%ld", pDiskImg->GetNumTracks()); return kDIErrInvalidArg; } if (pDiskImg->GetNumSectPerTrack() != 13 && pDiskImg->GetNumSectPerTrack() != 16 && pDiskImg->GetNumSectPerTrack() != 32) { - WMSG1(" DOS33 can't format sectors=%d\n", + LOGI(" DOS33 can't format sectors=%d", pDiskImg->GetNumSectPerTrack()); return kDIErrInvalidArg; } @@ -1444,7 +1444,7 @@ DiskFSDOS33::Format(DiskImg* pDiskImg, const char* volName) if (pDiskImg->GetNumSectPerTrack() != 16 && pDiskImg->GetNumSectPerTrack() != 13) { - WMSG1("NOTE: numSectPerTrack = %d, can't write DOS tracks\n", + LOGI("NOTE: numSectPerTrack = %d, can't write DOS tracks", pDiskImg->GetNumSectPerTrack()); return kDIErrInvalidArg; } @@ -1455,7 +1455,7 @@ DiskFSDOS33::Format(DiskImg* pDiskImg, const char* volName) assert(fpImg == NULL); SetDiskImg(pDiskImg); - WMSG1(" DOS33 formatting disk image (sectorOrder=%d)\n", + LOGI(" DOS33 formatting disk image (sectorOrder=%d)", fpImg->GetSectorOrder()); /* write DOS sectors */ @@ -1472,7 +1472,7 @@ DiskFSDOS33::Format(DiskImg* pDiskImg, const char* volName) * to skip it here. */ // dierr = fpImg->ZeroImage(); - WMSG0(" DOS33 (not zeroing blocks)\n"); + LOGI(" DOS33 (not zeroing blocks)"); if (addDOS) { dierr = WriteDOSTracks(pDiskImg->GetNumSectPerTrack()); @@ -1535,7 +1535,7 @@ DiskFSDOS33::Format(DiskImg* pDiskImg, const char* volName) /* check our work, and set some object fields, by reading what we wrote */ dierr = ReadVTOC(); if (dierr != kDIErrNone) { - WMSG1(" GLITCH: couldn't read header we just wrote (err=%d)\n", dierr); + LOGI(" GLITCH: couldn't read header we just wrote (err=%d)", dierr); goto bail; } @@ -1562,7 +1562,7 @@ DiskFSDOS33::WriteDOSTracks(int sectPerTrack) const unsigned char* buf = gDOS33Tracks; if (sectPerTrack == 13) { - WMSG0(" DOS33 writing DOS 3.3 tracks\n"); + LOGI(" DOS33 writing DOS 3.3 tracks"); buf = gDOS32Tracks; for (track = 0; track < 3; track++) { @@ -1574,7 +1574,7 @@ DiskFSDOS33::WriteDOSTracks(int sectPerTrack) } } } else if (sectPerTrack == 16) { - WMSG0(" DOS33 writing DOS 3.3 tracks\n"); + LOGI(" DOS33 writing DOS 3.3 tracks"); buf = gDOS33Tracks; // this should be used for 32-sector disks @@ -1588,7 +1588,7 @@ DiskFSDOS33::WriteDOSTracks(int sectPerTrack) } } } else { - WMSG1(" DOS33 *not* writing DOS tracks to %d-sector disk\n", + LOGI(" DOS33 *not* writing DOS tracks to %d-sector disk", sectPerTrack); assert(false); } @@ -1702,7 +1702,7 @@ DiskFSDOS33::CreateFile(const CreateParms* pParms, A2File** ppNewFile) assert(pParms != NULL); assert(pParms->pathName != NULL); assert(pParms->storageType == A2FileProDOS::kStorageSeedling); - WMSG1(" DOS33 ---v--- CreateFile '%s'\n", pParms->pathName); + LOGI(" DOS33 ---v--- CreateFile '%s'", pParms->pathName); *ppNewFile = NULL; @@ -1718,7 +1718,7 @@ DiskFSDOS33::CreateFile(const CreateParms* pParms, A2File** ppNewFile) MakeFileNameUnique(normalName); } else { if (GetFileByName(normalName) != NULL) { - WMSG1(" DOS33 create: normalized name '%s' already exists\n", + LOGI(" DOS33 create: normalized name '%s' already exists", normalName); dierr = kDIErrFileExists; goto bail; @@ -1756,10 +1756,10 @@ DiskFSDOS33::CreateFile(const CreateParms* pParms, A2File** ppNewFile) */ dierr = GetFreeCatalogEntry(&catSect, &catEntry, sctBuf, &pPrevEntry); if (dierr != kDIErrNone) { - WMSG0("DOS unable to find an empty entry in the catalog\n"); + LOGI("DOS unable to find an empty entry in the catalog"); goto bail; } - WMSG4(" DOS found free catalog entry T=%d S=%d ent=%d prev=0x%08lx\n", + LOGI(" DOS found free catalog entry T=%d S=%d ent=%d prev=0x%08lx", catSect.track, catSect.sector, catEntry, (long) pPrevEntry); /* create the new dir entry at the specified location */ @@ -1852,7 +1852,7 @@ DiskFSDOS33::MakeFileNameUnique(char* fileName) if (GetFileByName(fileName) == NULL) return kDIErrNone; - WMSG1(" DOS found duplicate of '%s', making unique\n", fileName); + LOGI(" DOS found duplicate of '%s', making unique", fileName); int nameLen = strlen(fileName); int dotOffset=0, dotLen=0; @@ -1869,7 +1869,7 @@ DiskFSDOS33::MakeFileNameUnique(char* fileName) if (cp != NULL) { int tmpOffset = cp - fileName; if (tmpOffset > 0 && nameLen - tmpOffset <= kMaxExtensionLen) { - WMSG1(" DOS (keeping extension '%s')\n", cp); + LOGI(" DOS (keeping extension '%s')", cp); assert(strlen(cp) <= kMaxExtensionLen); strcpy(dotBuf, cp); dotOffset = tmpOffset; @@ -1899,7 +1899,7 @@ DiskFSDOS33::MakeFileNameUnique(char* fileName) memcpy(fileName + copyOffset + digitLen, dotBuf, dotLen); } while (GetFileByName(fileName) != NULL); - WMSG1(" DOS converted to unique name: %s\n", fileName); + LOGI(" DOS converted to unique name: %s", fileName); return kDIErrNone; } @@ -1925,7 +1925,7 @@ DiskFSDOS33::GetFreeCatalogEntry(TrackSector* pCatSect, int* pCatEntry, fCatalogSectors[sct].sector == 0) { /* end of list reached */ - WMSG0("DOS catalog is full\n"); + LOGI("DOS catalog is full"); dierr = kDIErrVolumeDirFull; goto bail; } @@ -2053,7 +2053,7 @@ DiskFSDOS33::DeleteFile(A2File* pGenericFile) if (pGenericFile->IsFileOpen()) return kDIErrFileOpen; - WMSG1(" Deleting '%s'\n", pFile->GetPathName()); + LOGI(" Deleting '%s'", pFile->GetPathName()); /* * Update the block usage map. Nothing is permanent until we flush @@ -2065,7 +2065,7 @@ DiskFSDOS33::DeleteFile(A2File* pGenericFile) dierr = pFile->LoadTSList(&tsList, &tsCount, &indexList, &indexCount); if (dierr != kDIErrNone) { - WMSG1("Failed loading TS lists while deleting '%s'\n", + LOGI("Failed loading TS lists while deleting '%s'", pFile->GetPathName()); goto bail; } @@ -2125,7 +2125,7 @@ DiskFSDOS33::FreeTrackSectors(TrackSector* pList, int count) continue; // sparse file if (!GetSectorUseEntry(pList[i].track, pList[i].sector)) { - WMSG2("WARNING: freeing unallocated sector T=%d S=%d\n", + LOGI("WARNING: freeing unallocated sector T=%d S=%d", pList[i].track, pList[i].sector); assert(false); // impossible unless disk is "damaged" } @@ -2159,7 +2159,7 @@ DiskFSDOS33::RenameFile(A2File* pGenericFile, const char* newName) if (!fDiskIsGood) return kDIErrBadDiskImage; - WMSG2(" DOS renaming '%s' to '%s'\n", pFile->GetPathName(), newName); + LOGI(" DOS renaming '%s' to '%s'", pFile->GetPathName(), newName); /* * Update the disk catalog entry. @@ -2221,7 +2221,7 @@ DiskFSDOS33::SetFileInfo(A2File* pGenericFile, long fileType, long auxType, if (fpImg->GetReadOnly()) return kDIErrAccessDenied; - WMSG4("DOS SetFileInfo '%s' type=0x%02lx aux=0x%04lx access=0x%02lx\n", + LOGI("DOS SetFileInfo '%s' type=0x%02lx aux=0x%04lx access=0x%02lx", pFile->GetPathName(), fileType, auxType, accessFlags); /* @@ -2230,13 +2230,13 @@ DiskFSDOS33::SetFileInfo(A2File* pGenericFile, long fileType, long auxType, * the API a little more communicative. */ if (!A2FileDOS::IsValidType(fileType)) { - WMSG0("DOS SetFileInfo invalid file type\n"); + LOGI("DOS SetFileInfo invalid file type"); dierr = kDIErrInvalidArg; goto bail; } if (auxType != pFile->GetAuxType() && fileType != 0x06) { /* this only makes sense for BIN files */ - WMSG0("DOS SetFileInfo aux type mismatch; ignoring\n"); + LOGI("DOS SetFileInfo aux type mismatch; ignoring"); //dierr = kDIErrNotSupported; //goto bail; } @@ -2252,7 +2252,7 @@ DiskFSDOS33::SetFileInfo(A2File* pGenericFile, long fileType, long auxType, unsigned char sctBuf[kSctSize]; unsigned char* pEntry; - WMSG1("Updating file '%s'\n", pFile->GetPathName()); + LOGI("Updating file '%s'", pFile->GetPathName()); dierr = fpImg->ReadTrackSector(pFile->fCatTS.track, pFile->fCatTS.sector, sctBuf); @@ -2302,7 +2302,7 @@ DiskFSDOS33::SetFileInfo(A2File* pGenericFile, long fileType, long auxType, dierr = pFile->LoadTSList(&tsList, &tsCount); if (dierr != kDIErrNone) { - WMSG1(" DOS SFI: unable to load TS list (err=%d)\n", dierr); + LOGI(" DOS SFI: unable to load TS list (err=%d)", dierr); goto bail; } @@ -2312,23 +2312,23 @@ DiskFSDOS33::SetFileInfo(A2File* pGenericFile, long fileType, long auxType, dierr = fpImg->ReadTrackSector(tsList[0].track, tsList[0].sector, sctBuf); if (dierr != kDIErrNone) { - WMSG0("DOS SFI: unable to get first sector of file\n"); + LOGI("DOS SFI: unable to get first sector of file"); goto bail; } if (auxType == pFile->GetAuxType()) { newAuxType = GetShortLE(&sctBuf[0x00]); - WMSG1(" Aux type not changed, extracting from file (0x%04x)\n", + LOGI(" Aux type not changed, extracting from file (0x%04x)", newAuxType); } else { - WMSG1(" Aux type changed (to 0x%04x), changing file\n", + LOGI(" Aux type changed (to 0x%04x), changing file", newAuxType); PutShortLE(&sctBuf[0x00], newAuxType); dierr = fpImg->WriteTrackSector(tsList[0].track, tsList[0].sector, sctBuf); if (dierr != kDIErrNone) { - WMSG0("DOS SFI: unable to write first sector of file\n"); + LOGI("DOS SFI: unable to write first sector of file"); goto bail; } } @@ -2514,7 +2514,7 @@ A2FileDOS::ConvertFileType(long prodosType, di_off_t fileLen) (newType == kTypeInteger || newType == kTypeApplesoft || newType == kTypeBinary)) { - WMSG0(" DOS setting type for large A/I/B file to S\n"); + LOGI(" DOS setting type for large A/I/B file to S"); newType = kTypeS; } @@ -2636,7 +2636,7 @@ A2FileDOS::Open(A2FileDescr** ppOpenFile, bool readOnly, dierr = LoadTSList(&pOpenFile->fTSList, &pOpenFile->fTSCount, &pOpenFile->fIndexList, &pOpenFile->fIndexCount); if (dierr != kDIErrNone) { - WMSG1("DOS33 unable to load TS for '%s' open\n", GetPathName()); + LOGI("DOS33 unable to load TS for '%s' open", GetPathName()); goto bail; } @@ -2659,11 +2659,11 @@ bail: void A2FileDOS::Dump(void) const { - WMSG1("A2FileDOS '%s'\n", fFileName); - WMSG2(" TS T=%-2d S=%-2d\n", fTSListTrack, fTSListSector); - WMSG2(" Cat T=%-2d S=%-2d\n", fCatTS.track, fCatTS.sector); - WMSG3(" type=%d lck=%d slen=%d\n", fFileType, fLocked, fLengthInSectors); - WMSG2(" auxtype=0x%04x length=%ld\n", + LOGI("A2FileDOS '%s'", fFileName); + LOGI(" TS T=%-2d S=%-2d", fTSListTrack, fTSListSector); + LOGI(" Cat T=%-2d S=%-2d", fCatTS.track, fCatTS.sector); + LOGI(" type=%d lck=%d slen=%d", fFileType, fLocked, fLengthInSectors); + LOGI(" auxtype=0x%04x length=%ld", fAuxType, (long) fLength); } @@ -2705,7 +2705,7 @@ A2FileDOS::LoadTSList(TrackSector** pTSList, int* pTSCount, unsigned char sctBuf[kSctSize]; int track, sector, iterations; - WMSG1("--- DOS loading T/S list for '%s'\n", GetPathName()); + LOGI("--- DOS loading T/S list for '%s'", GetPathName()); /* over-alloc for small files to reduce reallocs */ tsAlloc = kMaxTSPairs * kDefaultTSAlloc; @@ -2731,7 +2731,7 @@ A2FileDOS::LoadTSList(TrackSector** pTSList, int* pTSCount, if (track >= pDiskImg->GetNumTracks() || sector >= pDiskImg->GetNumSectPerTrack()) { - WMSG3(" DOS33 invalid initial T/S %d,%d in '%s'\n", track, sector, + LOGI(" DOS33 invalid initial T/S %d,%d in '%s'", track, sector, fFileName); dierr = kDIErrBadFile; goto bail; @@ -2749,7 +2749,7 @@ A2FileDOS::LoadTSList(TrackSector** pTSList, int* pTSCount, * Add the current T/S sector to the index list. */ if (indexCount == indexAlloc) { - WMSG0("+++ expanding index list\n"); + LOGI("+++ expanding index list"); TrackSector* newList; indexAlloc += kDefaultIndexAlloc; newList = new TrackSector[indexAlloc]; @@ -2766,7 +2766,7 @@ A2FileDOS::LoadTSList(TrackSector** pTSList, int* pTSCount, indexCount++; - //WMSG2("+++ scanning T/S at T=%d S=%d\n", track, sector); + //LOGI("+++ scanning T/S at T=%d S=%d", track, sector); dierr = pDiskImg->ReadTrackSector(track, sector, sctBuf); if (dierr != kDIErrNone) goto bail; @@ -2781,13 +2781,13 @@ A2FileDOS::LoadTSList(TrackSector** pTSList, int* pTSCount, sector >= pDiskImg->GetNumSectPerTrack()) { // bogus T/S, mark file as damaged and stop - WMSG3(" DOS33 invalid T/S link %d,%d in '%s'\n", track, sector, + LOGI(" DOS33 invalid T/S link %d,%d in '%s'", track, sector, GetPathName()); dierr = kDIErrBadFile; goto bail; } if ((sectorOffset % kMaxTSPairs) != 0) { - WMSG2(" DOS33 invalid T/S header sector offset %u in '%s'\n", + LOGI(" DOS33 invalid T/S header sector offset %u in '%s'", sectorOffset, GetPathName()); // not fatal, just weird } @@ -2797,7 +2797,7 @@ A2FileDOS::LoadTSList(TrackSector** pTSList, int* pTSCount, * T/S pairs in the list. */ if (tsCount + kMaxTSPairs > tsAlloc) { - WMSG0("+++ expanding ts list\n"); + LOGI("+++ expanding ts list"); TrackSector* newList; tsAlloc += kMaxTSPairs * kDefaultTSAlloc; newList = new TrackSector[tsAlloc]; @@ -2827,7 +2827,7 @@ A2FileDOS::LoadTSList(TrackSector** pTSList, int* pTSCount, /* this was the last one */ if (lastNonZero == -1) { /* this is ALWAYS the case for a newly-created file */ - //WMSG1(" DOS33 odd -- last T/S sector of '%s' was empty\n", + //LOGI(" DOS33 odd -- last T/S sector of '%s' was empty", // GetPathName()); } tsCount += lastNonZero +1; @@ -2898,11 +2898,11 @@ A2FileDOS::ExtractTSPairs(const unsigned char* sctBuf, TrackSector* tsList, sector >= pDiskImg->GetNumSectPerTrack() || (track == 0 && sector != 0))) { - WMSG3(" DOS33 invalid T/S %d,%d in '%s'\n", track, sector, + LOGI(" DOS33 invalid T/S %d,%d in '%s'", track, sector, fFileName); if (i > 0 && tsList[i-1].track == 0 && tsList[i-1].sector == 0) { - WMSG0(" T/S list looks partially valid\n"); + LOGI(" T/S list looks partially valid"); SetQuality(kQualitySuspicious); goto bail; // quit immediately } else { @@ -2938,7 +2938,7 @@ bail: DIError A2FDDOS::Read(void* buf, size_t len, size_t* pActual) { - WMSG3(" DOS reading %d bytes from '%s' (offset=%ld)\n", + LOGI(" DOS reading %d bytes from '%s' (offset=%ld)", len, fpFile->GetPathName(), (long) fOffset); A2FileDOS* pFile = (A2FileDOS*) fpFile; @@ -2975,12 +2975,12 @@ A2FDDOS::Read(void* buf, size_t len, size_t* pActual) if (tsIndex >= fTSCount) { /* should've caught this earlier */ assert(false); - WMSG1(" DOS ran off the end (fTSCount=%d)\n", fTSCount); + LOGI(" DOS ran off the end (fTSCount=%d)", fTSCount); return kDIErrDataUnderrun; } if (fTSList[tsIndex].track == 0 && fTSList[tsIndex].sector == 0) { - //WMSG2(" DOS sparse sector T=%d S=%d\n", + //LOGI(" DOS sparse sector T=%d S=%d", // TSTrack(fTSList[tsIndex]), TSSector(fTSList[tsIndex])); memset(sctBuf, 0, sizeof(sctBuf)); } else { @@ -2989,7 +2989,7 @@ A2FDDOS::Read(void* buf, size_t len, size_t* pActual) fTSList[tsIndex].sector, sctBuf); if (dierr != kDIErrNone) { - WMSG1(" DOS error reading file '%s'\n", pFile->GetPathName()); + LOGI(" DOS error reading file '%s'", pFile->GetPathName()); return dierr; } } @@ -3031,7 +3031,7 @@ A2FDDOS::Write(const void* buf, size_t len, size_t* pActual) DiskFSDOS33* pDiskFS = (DiskFSDOS33*) fpFile->GetDiskFS(); unsigned char sctBuf[kSctSize]; - WMSG2(" DOS Write len=%u %s\n", len, pFile->GetPathName()); + LOGI(" DOS Write len=%u %s", len, pFile->GetPathName()); if (len >= 0x01000000) { // 16MB assert(false); @@ -3307,14 +3307,14 @@ A2FDDOS::Close(void) assert(pFile->fDataOffset > 0); //assert(fOpenEOF < 65536); if (fOpenEOF > 65535) { - WMSG1("WARNING: DOS Close trimming A/I/B file from %ld to 65535\n", + LOGI("WARNING: DOS Close trimming A/I/B file from %ld to 65535", (long) fOpenEOF); fOpenEOF = 65535; } dierr = pDiskFS->GetDiskImg()->ReadTrackSector(fTSList[0].track, fTSList[0].sector, sctBuf); if (dierr != kDIErrNone) { - WMSG0("DOS Close: unable to get first sector of file\n"); + LOGI("DOS Close: unable to get first sector of file"); goto bail; } @@ -3330,7 +3330,7 @@ A2FDDOS::Close(void) dierr = pDiskFS->GetDiskImg()->WriteTrackSector(fTSList[0].track, fTSList[0].sector, sctBuf); if (dierr != kDIErrNone) { - WMSG0("DOS Close: unable to write first sector of file\n"); + LOGI("DOS Close: unable to write first sector of file"); goto bail; } } else if (pFile->fFileType == A2FileDOS::kTypeText) { @@ -3437,11 +3437,11 @@ void A2FDDOS::DumpTSList(void) const { //A2FileDOS* pFile = (A2FileDOS*) fpFile; - WMSG2(" DOS T/S list for '%s' (count=%d)\n", + LOGI(" DOS T/S list for '%s' (count=%d)", ((A2FileDOS*)fpFile)->fFileName, fTSCount); int i; for (i = 0; i <= fTSCount; i++) { - WMSG3(" %3d: T=%-2d S=%d\n", i, fTSList[i].track, fTSList[i].sector); + LOGI(" %3d: T=%-2d S=%d", i, fTSList[i].track, fTSList[i].sector); } } diff --git a/diskimg/DiskFS.cpp b/diskimg/DiskFS.cpp index bec24b2..3a13da2 100644 --- a/diskimg/DiskFS.cpp +++ b/diskimg/DiskFS.cpp @@ -63,10 +63,10 @@ void DiskFS::SetDiskImg(DiskImg* pImg) { if (pImg == NULL && fpImg == NULL) { - WMSG0("SetDiskImg: no-op (both NULL)\n"); + LOGI("SetDiskImg: no-op (both NULL)"); return; } else if (fpImg == pImg) { - WMSG0("SetDiskImg: no-op (old == new)\n"); + LOGI("SetDiskImg: no-op (old == new)"); return; } @@ -283,7 +283,7 @@ DiskFS::DeleteFileFromList(A2File* pFile) } if (pCur == NULL) { - WMSG0("GLITCH: couldn't find element to delete!\n"); + LOGI("GLITCH: couldn't find element to delete!"); assert(false); } } @@ -350,11 +350,11 @@ DiskFS::DumpFileList(void) { A2File* pFile; - WMSG0("DiskFS file list contents:\n"); + LOGI("DiskFS file list contents:"); pFile = GetNextFile(NULL); while (pFile != NULL) { - WMSG1(" %s\n", pFile->GetPathName()); + LOGI(" %s", pFile->GetPathName()); pFile = GetNextFile(pFile); } } @@ -404,18 +404,18 @@ DiskFS::AddSubVolumeToList(DiskImg* pDiskImg, DiskFS* pDiskFS) * Check the arguments. */ if (pDiskImg == NULL || pDiskFS == NULL) { - WMSG2(" DiskFS bogus sub volume ptrs %08lx %08lx\n", + LOGI(" DiskFS bogus sub volume ptrs %08lx %08lx", (long) pDiskImg, (long) pDiskFS); assert(false); return; } if (pDiskImg == fpImg || pDiskFS == this) { - WMSG0(" DiskFS attempt to add self to sub-vol list\n"); + LOGI(" DiskFS attempt to add self to sub-vol list"); assert(false); return; } if (pDiskFS->GetDiskImg() == NULL) { - WMSG0(" DiskFS lacks a DiskImg pointer\n"); + LOGI(" DiskFS lacks a DiskImg pointer"); assert(false); return; } @@ -424,7 +424,7 @@ DiskFS::AddSubVolumeToList(DiskImg* pDiskImg, DiskFS* pDiskFS) if (pSubVol->GetDiskImg() == pDiskImg || pSubVol->GetDiskFS() == pDiskFS) { - WMSG0(" DiskFS multiple adds on diskimg or diskfs\n"); + LOGI(" DiskFS multiple adds on diskimg or diskfs"); assert(false); return; } diff --git a/diskimg/DiskImg.cpp b/diskimg/DiskImg.cpp index a4e737b..d10dc76 100644 --- a/diskimg/DiskImg.cpp +++ b/diskimg/DiskImg.cpp @@ -243,7 +243,7 @@ DiskImg::DiskImg(void) DiskImg::~DiskImg(void) { if (fpDataGFD != NULL) { - WMSG0("~DiskImg closing GenericFD(s)\n"); + LOGI("~DiskImg closing GenericFD(s)"); } (void) CloseImage(); delete[] fpNibbleDescrTable; @@ -287,7 +287,7 @@ DiskImg::SetCustomNibbleDescr(const NibbleDescr* pDescr) fpNibbleDescr = NULL; } else { assert(fpNibbleDescrTable != NULL); - //WMSG2("Overwriting entry %d with new value (special=%d)\n", + //LOGI("Overwriting entry %d with new value (special=%d)", // kNibbleDescrCustom, pDescr->special); fpNibbleDescrTable[kNibbleDescrCustom] = *pDescr; fpNibbleDescr = &fpNibbleDescrTable[kNibbleDescrCustom]; @@ -308,10 +308,10 @@ DiskImg::OpenImage(const char* pathName, char fssep, bool readOnly) bool isWinDevice = false; if (fpDataGFD != NULL) { - WMSG0(" DI already open!\n"); + LOGI(" DI already open!"); return kDIErrAlreadyOpen; } - WMSG3(" DI OpenImage '%s' '%.1s' ro=%d\n", pathName, &fssep, readOnly); + LOGI(" DI OpenImage '%s' '%.1s' ro=%d", pathName, &fssep, readOnly); fReadOnly = readOnly; @@ -389,10 +389,10 @@ DIError DiskImg::OpenImage(const void* buffer, long length, bool readOnly) { if (fpDataGFD != NULL) { - WMSG0(" DI already open!\n"); + LOGI(" DI already open!"); return kDIErrAlreadyOpen; } - WMSG3(" DI OpenImage %08lx %ld ro=%d\n", (long) buffer, length, readOnly); + LOGI(" DI OpenImage %08lx %ld ro=%d", (long) buffer, length, readOnly); DIError dierr; GFDBuffer* pGFDBuffer; @@ -436,10 +436,10 @@ DiskImg::OpenImage(const void* buffer, long length, bool readOnly) DIError DiskImg::OpenImage(DiskImg* pParent, long firstBlock, long numBlocks) { - WMSG3(" DI OpenImage parent=0x%08lx %ld %ld\n", (long) pParent, firstBlock, + LOGI(" DI OpenImage parent=0x%08lx %ld %ld", (long) pParent, firstBlock, numBlocks); if (fpDataGFD != NULL) { - WMSG0(" DI already open!\n"); + LOGI(" DI already open!"); return kDIErrAlreadyOpen; } @@ -484,10 +484,10 @@ DIError DiskImg::OpenImage(DiskImg* pParent, long firstTrack, long firstSector, long numSectors) { - WMSG4(" DI OpenImage parent=0x%08lx %ld %ld %ld\n", (long) pParent, + LOGI(" DI OpenImage parent=0x%08lx %ld %ld %ld", (long) pParent, firstTrack, firstSector, numSectors); if (fpDataGFD != NULL) { - WMSG0(" DI already open!\n"); + LOGI(" DI already open!"); return kDIErrAlreadyOpen; } @@ -569,11 +569,11 @@ DiskImg::CloseImage(void) { DIError dierr; - WMSG1("CloseImage %p\n", this); + LOGI("CloseImage %p", this); /* check for DiskFS objects that still point to us */ if (fDiskFSRefCnt != 0) { - WMSG1("ERROR: CloseImage: fDiskFSRefCnt=%d\n", fDiskFSRefCnt); + LOGI("ERROR: CloseImage: fDiskFSRefCnt=%d", fDiskFSRefCnt); assert(false); //DebugBreak(); } @@ -638,7 +638,7 @@ DiskImg::FlushImage(FlushMode mode) { DIError dierr = kDIErrNone; - WMSG2(" DI FlushImage (dirty=%d mode=%d)\n", fDirty, mode); + LOGI(" DI FlushImage (dirty=%d mode=%d)", fDirty, mode); if (!fDirty) return kDIErrNone; if (fpDataGFD == NULL) { @@ -649,7 +649,7 @@ DiskImg::FlushImage(FlushMode mode) * "dirty" flag is set because CreateImageCommon sets it almost * immediately. */ - WMSG0(" (disk must've failed during creation)\n"); + LOGI(" (disk must've failed during creation)"); fDirty = false; return kDIErrNone; } @@ -658,7 +658,7 @@ DiskImg::FlushImage(FlushMode mode) ((fpImageWrapper != NULL && !fpImageWrapper->HasFastFlush()) || (fpOuterWrapper != NULL && !fpOuterWrapper->HasFastFlush()) )) { - WMSG0("DI fast flush requested, but one or both wrappers are slow\n"); + LOGI("DI fast flush requested, but one or both wrappers are slow"); return kDIErrNone; } @@ -684,12 +684,12 @@ DiskImg::FlushImage(FlushMode mode) * so long as the "Flush" function has it figured out.) */ if (fpWrapperGFD != NULL) { - WMSG2(" DI flushing data changes to wrapper (fLen=%ld fWrapLen=%ld)\n", + LOGI(" DI flushing data changes to wrapper (fLen=%ld fWrapLen=%ld)", (long) fLength, (long) fWrappedLength); dierr = fpImageWrapper->Flush(fpWrapperGFD, fpDataGFD, fLength, &fWrappedLength); if (dierr != kDIErrNone) { - WMSG1(" ERROR: wrapper flush failed (err=%d)\n", dierr); + LOGI(" ERROR: wrapper flush failed (err=%d)", dierr); return dierr; } /* flush the GFD in case it's a Win32 volume with block caching */ @@ -703,13 +703,13 @@ DiskImg::FlushImage(FlushMode mode) * in fpWrapperGFD. */ if (fpOuterWrapper != NULL) { - WMSG1(" DI saving wrapper to outer, fWrapLen=%ld\n", + LOGI(" DI saving wrapper to outer, fWrapLen=%ld", (long) fWrappedLength); assert(fpOuterGFD != NULL); dierr = fpOuterWrapper->Save(fpOuterGFD, fpWrapperGFD, fWrappedLength); if (dierr != kDIErrNone) { - WMSG1(" ERROR: outer save failed (err=%d)\n", dierr); + LOGI(" ERROR: outer save failed (err=%d)", dierr); return dierr; } } @@ -782,7 +782,7 @@ DiskImg::AnalyzeImageFile(const char* pathName, char fssep) } else ext = ""; - WMSG1(" DI AnalyzeImageFile ext='%s'\n", ext); + LOGI(" DI AnalyzeImageFile ext='%s'", ext); /* sanity check: nobody should have configured these yet */ assert(fOuterFormat == kOuterFormatUnknown); @@ -792,7 +792,7 @@ DiskImg::AnalyzeImageFile(const char* pathName, char fssep) fLength = -1; dierr = fpWrapperGFD->Seek(0, kSeekEnd); if (dierr != kDIErrNone) { - WMSG0(" DI Couldn't seek to end of wrapperGFD\n"); + LOGI(" DI Couldn't seek to end of wrapperGFD"); goto bail; } fWrappedLength = fOuterLength = fpWrapperGFD->Tell(); @@ -817,7 +817,7 @@ DiskImg::AnalyzeImageFile(const char* pathName, char fssep) if (strcasecmp(ext, "gz") == 0 && OuterGzip::Test(fpWrapperGFD, fOuterLength) == kDIErrNone) { - WMSG0(" DI found gz outer wrapper\n"); + LOGI(" DI found gz outer wrapper"); fpOuterWrapper = new OuterGzip(); if (fpOuterWrapper == NULL) { @@ -842,14 +842,14 @@ DiskImg::AnalyzeImageFile(const char* pathName, char fssep) ext++; } } - WMSG1(" DI after gz, ext='%s'\n", ext == NULL ? "(NULL)" : ext); + LOGI(" DI after gz, ext='%s'", ext == NULL ? "(NULL)" : ext); } else if (strcasecmp(ext, "zip") == 0) { dierr = OuterZip::Test(fpWrapperGFD, fOuterLength); if (dierr != kDIErrNone) goto bail; - WMSG0(" DI found ZIP outer wrapper\n"); + LOGI(" DI found ZIP outer wrapper"); fpOuterWrapper = new OuterZip(); if (fpOuterWrapper == NULL) { @@ -870,7 +870,7 @@ DiskImg::AnalyzeImageFile(const char* pathName, char fssep) dierr = fpOuterWrapper->Load(fpWrapperGFD, fOuterLength, fReadOnly, &fWrappedLength, &pNewGFD); if (dierr != kDIErrNone) { - WMSG0(" DI outer prep failed\n"); + LOGI(" DI outer prep failed"); /* extensions are "reliable", so failure is unavoidable */ goto bail; } @@ -917,7 +917,7 @@ DiskImg::AnalyzeImageFile(const char* pathName, char fssep) if (dierr2 == kDIErrNone) probableFormat = kFileFormatNuFX; else if (dierr2 == kDIErrFileArchive) { - WMSG0(" AnalyzeImageFile thinks it found a NuFX file archive\n"); + LOGI(" AnalyzeImageFile thinks it found a NuFX file archive"); dierr = dierr2; goto bail; } @@ -970,7 +970,7 @@ DiskImg::AnalyzeImageFile(const char* pathName, char fssep) fOrder = kSectorOrderDOS; else fOrder = kSectorOrderProDOS; // po, dc6 - WMSG1(" DI guessing order is %d by extension\n", fOrder); + LOGI(" DI guessing order is %d by extension", fOrder); } } else if (strcasecmp(ext, "cp-win-vol") == 0) { /* this is a Windows logical volume */ @@ -986,7 +986,7 @@ DiskImg::AnalyzeImageFile(const char* pathName, char fssep) /* * Found a match. Use "probableFormat" to open the file. */ - WMSG1(" DI scored hit on extension '%s'\n", ext); + LOGI(" DI scored hit on extension '%s'", ext); } else { /* * Didn't work. If the file extension was marked "reliable", then @@ -1004,11 +1004,11 @@ DiskImg::AnalyzeImageFile(const char* pathName, char fssep) * be looking at header checksums.) */ if (reliableExt) { - WMSG1(" DI file extension '%s' did not match contents\n", ext); + LOGI(" DI file extension '%s' did not match contents", ext); dierr = kDIErrBadFileFormat; goto bail; } else { - WMSG1(" DI extension '%s' not useful, probing formats\n", ext); + LOGI(" DI extension '%s' not useful, probing formats", ext); dierr = WrapperNuFX::Test(fpWrapperGFD, fWrappedLength); if (dierr == kDIErrNone) { probableFormat = kFileFormatNuFX; @@ -1094,7 +1094,7 @@ gotit: ; } break; default: - WMSG0(" DI couldn't figure out the file format\n"); + LOGI(" DI couldn't figure out the file format"); dierr = kDIErrUnrecognizedFileFmt; break; } @@ -1110,7 +1110,7 @@ gotit: ; } if (dierr != kDIErrNone) { - WMSG1(" DI wrapper prep failed (err=%d)\n", dierr); + LOGI(" DI wrapper prep failed (err=%d)", dierr); goto bail; } @@ -1175,7 +1175,7 @@ DiskImg::AnalyzeImage(void) */ if (IsSectorFormat(fPhysical)) { if (!fLength) { - WMSG0(" DI zero-length disk images not allowed\n"); + LOGI(" DI zero-length disk images not allowed"); return kDIErrOddLength; } @@ -1195,7 +1195,7 @@ DiskImg::AnalyzeImage(void) /* sector pairing effectively cuts #of tracks in half */ if (fSectorPairing) { if ((fNumTracks & 0x01) != 0) { - WMSG0(" DI error: bad attempt at sector pairing\n"); + LOGI(" DI error: bad attempt at sector pairing"); assert(false); fSectorPairing = false; } @@ -1205,7 +1205,7 @@ DiskImg::AnalyzeImage(void) fNumTracks /= 2; } else { if (fSectorPairing) { - WMSG1("GLITCH: sector pairing enabled, but fLength=%ld\n", + LOGI("GLITCH: sector pairing enabled, but fLength=%ld", (long) fLength); return kDIErrOddLength; } @@ -1240,7 +1240,7 @@ DiskImg::AnalyzeImage(void) fOrder = kSectorOrderPhysical; if (!fReadOnly && !fpNibbleDescr->dataVerifyChecksum) { - WMSG0("DI nibbleDescr does not verify data checksum, disabling writes\n"); + LOGI("DI nibbleDescr does not verify data checksum, disabling writes"); AddNote(kNoteInfo, "Sectors use non-standard data checksums; writing disabled."); fReadOnly = true; @@ -1252,7 +1252,7 @@ DiskImg::AnalyzeImage(void) fHasSectors = false; } } else { - WMSG1("Unsupported physical %d\n", fPhysical); + LOGI("Unsupported physical %d", fPhysical); assert(false); return kDIErrGeneric; } @@ -1280,7 +1280,7 @@ DiskImg::AnalyzeImage(void) if (fSectorPairing) { if ((fNumBlocks & 0x01) != 0) { - WMSG0(" DI error: bad attempt at sector pairing (blk)\n"); + LOGI(" DI error: bad attempt at sector pairing (blk)"); assert(false); fSectorPairing = false; } else @@ -1294,7 +1294,7 @@ DiskImg::AnalyzeImage(void) } else if (fHasNibbles) { assert(fNumBlocks == -1); } else { - WMSG0(" DI none of fHasSectors/fHasBlocks/fHasNibbles are set\n"); + LOGI(" DI none of fHasSectors/fHasBlocks/fHasNibbles are set"); assert(false); return kDIErrInternal; } @@ -1305,9 +1305,9 @@ DiskImg::AnalyzeImage(void) */ AnalyzeImageFS(); - WMSG4(" DI AnalyzeImage tracks=%ld sectors=%d blocks=%ld fileSysOrder=%d\n", + LOGI(" DI AnalyzeImage tracks=%ld sectors=%d blocks=%ld fileSysOrder=%d", fNumTracks, fNumSectPerTrack, fNumBlocks, fFileSysOrder); - WMSG3(" hasBlocks=%d hasSectors=%d hasNibbles=%d\n", + LOGI(" hasBlocks=%d hasSectors=%d hasNibbles=%d", fHasBlocks, fHasSectors, fHasNibbles); return kDIErrNone; @@ -1332,15 +1332,15 @@ DiskImg::AnalyzeImageFS(void) if (DiskFSMacPart::TestFS(this, &fOrder, &fFormat, DiskFS::kLeniencyNot) == kDIErrNone) { assert(fFormat == kFormatMacPart); - WMSG1(" DI found MacPart, order=%d\n", fOrder); + LOGI(" DI found MacPart, order=%d", fOrder); } else if (DiskFSMicroDrive::TestFS(this, &fOrder, &fFormat, DiskFS::kLeniencyNot) == kDIErrNone) { assert(fFormat == kFormatMicroDrive); - WMSG1(" DI found MicroDrive, order=%d\n", fOrder); + LOGI(" DI found MicroDrive, order=%d", fOrder); } else if (DiskFSFocusDrive::TestFS(this, &fOrder, &fFormat, DiskFS::kLeniencyNot) == kDIErrNone) { assert(fFormat == kFormatFocusDrive); - WMSG1(" DI found FocusDrive, order=%d\n", fOrder); + LOGI(" DI found FocusDrive, order=%d", fOrder); } else if (DiskFSCFFA::TestFS(this, &fOrder, &fFormat, DiskFS::kLeniencyNot) == kDIErrNone) { // The CFFA format doesn't have a partition map, but we do insist @@ -1349,7 +1349,7 @@ DiskImg::AnalyzeImageFS(void) // for MicroDrive will still look like valid CFFA unless you zero // out the blocks. assert(fFormat == kFormatCFFA4 || fFormat == kFormatCFFA8); - WMSG1(" DI found CFFA, order=%d\n", fOrder); + LOGI(" DI found CFFA, order=%d", fOrder); } else if (DiskFSFAT::TestFS(this, &fOrder, &fFormat, DiskFS::kLeniencyNot) == kDIErrNone) { // This is really just a trap to catch CFFA cards that were formatted @@ -1357,11 +1357,11 @@ DiskImg::AnalyzeImageFS(void) // come before the ProDOS test. It only works on larger volumes, // and can be overridden, so it's pretty safe. assert(fFormat == kFormatMSDOS); - WMSG1(" DI found MSDOS, order=%d\n", fOrder); + LOGI(" DI found MSDOS, order=%d", fOrder); } else if (DiskFSDOS33::TestFS(this, &fOrder, &fFormat, DiskFS::kLeniencyNot) == kDIErrNone) { assert(fFormat == kFormatDOS32 || fFormat == kFormatDOS33); - WMSG1(" DI found DOS3.x, order=%d\n", fOrder); + LOGI(" DI found DOS3.x, order=%d", fOrder); if (fNumSectPerTrack == 13) fFormat = kFormatDOS32; } else if (DiskFSUNIDOS::TestWideFS(this, &fOrder, &fFormat, DiskFS::kLeniencyNot) == kDIErrNone) @@ -1370,48 +1370,48 @@ DiskImg::AnalyzeImageFS(void) assert(fFormat == kFormatDOS33); fNumSectPerTrack = 32; fNumTracks /= 2; - WMSG1(" DI found 'wide' DOS3.3, order=%d\n", fOrder); + LOGI(" DI found 'wide' DOS3.3, order=%d", fOrder); } else if (DiskFSUNIDOS::TestFS(this, &fOrder, &fFormat, DiskFS::kLeniencyNot) == kDIErrNone) { assert(fFormat == kFormatUNIDOS); fNumSectPerTrack = 32; fNumTracks /= 2; - WMSG1(" DI found UNIDOS, order=%d\n", fOrder); + LOGI(" DI found UNIDOS, order=%d", fOrder); } else if (DiskFSOzDOS::TestFS(this, &fOrder, &fFormat, DiskFS::kLeniencyNot) == kDIErrNone) { assert(fFormat == kFormatOzDOS); fNumSectPerTrack = 32; fNumTracks /= 2; - WMSG1(" DI found OzDOS, order=%d\n", fOrder); + LOGI(" DI found OzDOS, order=%d", fOrder); } else if (DiskFSProDOS::TestFS(this, &fOrder, &fFormat, DiskFS::kLeniencyNot) == kDIErrNone) { assert(fFormat == kFormatProDOS); - WMSG1(" DI found ProDOS, order=%d\n", fOrder); + LOGI(" DI found ProDOS, order=%d", fOrder); } else if (DiskFSPascal::TestFS(this, &fOrder, &fFormat, DiskFS::kLeniencyNot) == kDIErrNone) { assert(fFormat == kFormatPascal); - WMSG1(" DI found Pascal, order=%d\n", fOrder); + LOGI(" DI found Pascal, order=%d", fOrder); } else if (DiskFSCPM::TestFS(this, &fOrder, &fFormat, DiskFS::kLeniencyNot) == kDIErrNone) { assert(fFormat == kFormatCPM); - WMSG1(" DI found CP/M, order=%d\n", fOrder); + LOGI(" DI found CP/M, order=%d", fOrder); } else if (DiskFSRDOS::TestFS(this, &fOrder, &fFormat, DiskFS::kLeniencyNot) == kDIErrNone) { assert(fFormat == kFormatRDOS33 || fFormat == kFormatRDOS32 || fFormat == kFormatRDOS3); - WMSG1(" DI found RDOS 3.3, order=%d\n", fOrder); + LOGI(" DI found RDOS 3.3, order=%d", fOrder); } else if (DiskFSHFS::TestFS(this, &fOrder, &fFormat, DiskFS::kLeniencyNot) == kDIErrNone) { assert(fFormat == kFormatMacHFS); - WMSG1(" DI found HFS, order=%d\n", fOrder); + LOGI(" DI found HFS, order=%d", fOrder); } else if (DiskFSGutenberg::TestFS(this, &fOrder, &fFormat, DiskFS::kLeniencyNot) == kDIErrNone) { assert(fFormat == kFormatGutenberg); - WMSG1(" DI found Gutenberg, order=%d\n", fOrder); + LOGI(" DI found Gutenberg, order=%d", fOrder); } else { fFormat = kFormatUnknown; - WMSG1(" DI no recognizeable filesystem found (fOrder=%d)\n", + LOGI(" DI no recognizeable filesystem found (fOrder=%d)", fOrder); } @@ -1438,7 +1438,7 @@ DiskImg::OverrideFormat(PhysicalFormat physical, FSFormat format, SectorOrder newOrder; FSFormat newFormat; - WMSG3(" DI override: physical=%d format=%d order=%d\n", + LOGI(" DI override: physical=%d format=%d order=%d", physical, format, order); if (!IsSectorFormat(physical) && !IsNibbleFormat(physical)) @@ -1450,7 +1450,7 @@ DiskImg::OverrideFormat(PhysicalFormat physical, FSFormat format, /* optimization */ if (physical == fPhysical && format == fFormat && order == fOrder) { - WMSG0(" DI override matches existing, ignoring\n"); + LOGI(" DI override matches existing, ignoring"); return kDIErrNone; } @@ -1526,7 +1526,7 @@ DiskImg::OverrideFormat(PhysicalFormat physical, FSFormat format, } if (dierr != kDIErrNone) { - WMSG0(" DI override failed\n"); + LOGI(" DI override failed"); goto bail; } @@ -1544,7 +1544,7 @@ DiskImg::OverrideFormat(PhysicalFormat physical, FSFormat format, fOrder = newOrder; fFileSysOrder = CalcFSSectorOrder(); - WMSG0(" DI override accepted\n"); + LOGI(" DI override accepted"); bail: return dierr; @@ -1565,7 +1565,7 @@ DiskImg::CalcFSSectorOrder(void) const { /* in the absence of information, just leave it alone */ if (fFormat == kFormatUnknown || fOrder == kSectorOrderUnknown) { - WMSG0(" DI WARNING: FindSectorOrder but format not known\n"); + LOGI(" DI WARNING: FindSectorOrder but format not known"); return fOrder; } @@ -1677,7 +1677,7 @@ DiskImg::FormatImage(FSFormat format, const char* volName) DiskFS* pDiskFS = NULL; FSFormat savedFormat; - WMSG1(" DI FormatImage '%s'\n", volName); + LOGI(" DI FormatImage '%s'", volName); /* * Open a temporary DiskFS for the requested format. We do this via the @@ -1699,7 +1699,7 @@ DiskImg::FormatImage(FSFormat format, const char* volName) if (dierr != kDIErrNone) goto bail; - WMSG0("DI format successful\n"); + LOGI("DI format successful"); fFormat = format; bail: @@ -1723,7 +1723,7 @@ DiskImg::ZeroImage(void) unsigned char blkBuf[kBlockSize]; long block; - WMSG1(" DI ZeroImage (%ld blocks)\n", GetNumBlocks()); + LOGI(" DI ZeroImage (%ld blocks)", GetNumBlocks()); memset(blkBuf, 0, sizeof(blkBuf)); for (block = 0; block < GetNumBlocks(); block++) { @@ -1838,11 +1838,11 @@ DiskImg::CalcSectorAndOffset(long track, int sector, SectorOrder imageOrder, }; if (track < 0 || track >= fNumTracks) { - WMSG1(" DI read invalid track %ld\n", track); + LOGI(" DI read invalid track %ld", track); return kDIErrInvalidTrack; } if (sector < 0 || sector >= fNumSectPerTrack) { - WMSG1(" DI read invalid sector %d\n", sector); + LOGI(" DI read invalid sector %d", sector); return kDIErrInvalidSector; } @@ -1934,7 +1934,7 @@ DiskImg::CalcSectorAndOffset(long track, int sector, SectorOrder imageOrder, offset += newSector * kSectorSize; if (imageOrder != fsOrder) { /* translation expected */ - WMSG2("NOTE: CalcSectorAndOffset for nspt=13 with img=%d fs=%d\n", + LOGI("NOTE: CalcSectorAndOffset for nspt=13 with img=%d fs=%d", imageOrder, fsOrder); } } else { @@ -2007,13 +2007,13 @@ DiskImg::ReadTrackSectorSwapped(long track, int sector, void* buf, if (IsSectorFormat(fPhysical)) { assert(offset+kSectorSize <= fLength); - //WMSG2(" DI t=%d s=%d\n", track, + //LOGI(" DI t=%d s=%d", track, // (offset - track * fNumSectPerTrack * kSectorSize) / kSectorSize); dierr = CopyBytesOut(buf, offset, kSectorSize); } else if (IsNibbleFormat(fPhysical)) { if (imageOrder != kSectorOrderPhysical) { - WMSG2(" NOTE: nibble imageOrder is %d (expected %d)\n", + LOGI(" NOTE: nibble imageOrder is %d (expected %d)", imageOrder, kSectorOrderPhysical); } dierr = ReadNibbleSector(track, newSector, buf, fpNibbleDescr); @@ -2062,13 +2062,13 @@ DiskImg::WriteTrackSector(long track, int sector, const void* buf) if (IsSectorFormat(fPhysical)) { assert(offset+kSectorSize <= fLength); - //WMSG2(" DI t=%d s=%d\n", track, + //LOGI(" DI t=%d s=%d", track, // (offset - track * fNumSectPerTrack * kSectorSize) / kSectorSize); dierr = CopyBytesIn(buf, offset, kSectorSize); } else if (IsNibbleFormat(fPhysical)) { if (fOrder != kSectorOrderPhysical) { - WMSG2(" NOTE: nibble fOrder is %d (expected %d)\n", + LOGI(" NOTE: nibble fOrder is %d (expected %d)", fOrder, kSectorOrderPhysical); } dierr = WriteNibbleSector(track, newSector, buf, fpNibbleDescr); @@ -2118,7 +2118,7 @@ DiskImg::ReadBlockSwapped(long block, void* buf, SectorOrder imageOrder, } else if (fHasBlocks) { /* no sectors, so no swapping; must be linear blocks */ if (imageOrder != fsOrder) { - WMSG2(" DI NOTE: ReadBlockSwapped on non-sector (%d/%d)\n", + LOGI(" DI NOTE: ReadBlockSwapped on non-sector (%d/%d)", imageOrder, fsOrder); } dierr = CopyBytesOut(buf, (di_off_t) block * kBlockSize, kBlockSize); @@ -2167,7 +2167,7 @@ DiskImg::ReadBlocks(long startBlock, int numBlocks, void* buf) * be an issue. */ if (startBlock == 0) { - WMSG0(" ReadBlocks: nonlinear, not trying\n"); + LOGI(" ReadBlocks: nonlinear, not trying"); } while (numBlocks--) { dierr = ReadBlock(startBlock, buf); @@ -2178,7 +2178,7 @@ DiskImg::ReadBlocks(long startBlock, int numBlocks, void* buf) } } else { if (startBlock == 0) { - WMSG0(" ReadBlocks: doing big linear reads\n"); + LOGI(" ReadBlocks: doing big linear reads"); } dierr = CopyBytesOut(buf, (di_off_t) startBlock * kBlockSize, numBlocks * kBlockSize); @@ -2243,7 +2243,7 @@ DiskImg::WriteBlock(long block, const void* buf) } else if (fHasBlocks) { /* no sectors, so no swapping; must be linear blocks */ if (fOrder != fFileSysOrder) { - WMSG2(" DI NOTE: WriteBlock on non-sector (%d/%d)\n", + LOGI(" DI NOTE: WriteBlock on non-sector (%d/%d)", fOrder, fFileSysOrder); } dierr = CopyBytesIn(buf, (di_off_t)block * kBlockSize, kBlockSize); @@ -2280,7 +2280,7 @@ DiskImg::WriteBlocks(long startBlock, int numBlocks, const void* buf) * shouldn't be an issue. */ if (startBlock == 0) { - WMSG0(" WriteBlocks: nonlinear, not trying\n"); + LOGI(" WriteBlocks: nonlinear, not trying"); } while (numBlocks--) { dierr = WriteBlock(startBlock, buf); @@ -2291,7 +2291,7 @@ DiskImg::WriteBlocks(long startBlock, int numBlocks, const void* buf) } } else { if (startBlock == 0) { - WMSG0(" WriteBlocks: doing big linear writes\n"); + LOGI(" WriteBlocks: doing big linear writes"); } dierr = CopyBytesIn(buf, (di_off_t) startBlock * kBlockSize, numBlocks * kBlockSize); @@ -2314,13 +2314,13 @@ DiskImg::CopyBytesOut(void* buf, di_off_t offset, int size) const dierr = fpDataGFD->Seek(offset, kSeekSet); if (dierr != kDIErrNone) { - WMSG2(" DI seek off=%ld failed (err=%d)\n", (long) offset, dierr); + LOGI(" DI seek off=%ld failed (err=%d)", (long) offset, dierr); return dierr; } dierr = fpDataGFD->Read(buf, size); if (dierr != kDIErrNone) { - WMSG3(" DI read off=%ld size=%d failed (err=%d)\n", + LOGI(" DI read off=%ld size=%d failed (err=%d)", (long) offset, size, dierr); return dierr; } @@ -2348,13 +2348,13 @@ DiskImg::CopyBytesIn(const void* buf, di_off_t offset, int size) dierr = fpDataGFD->Seek(offset, kSeekSet); if (dierr != kDIErrNone) { - WMSG2(" DI seek off=%ld failed (err=%d)\n", (long) offset, dierr); + LOGI(" DI seek off=%ld failed (err=%d)", (long) offset, dierr); return dierr; } dierr = fpDataGFD->Write(buf, size); if (dierr != kDIErrNone) { - WMSG3(" DI write off=%ld size=%d failed (err=%d)\n", + LOGI(" DI write off=%ld size=%d failed (err=%d)", (long) offset, size, dierr); return dierr; } @@ -2390,7 +2390,7 @@ DiskImg::CreateImage(const char* pathName, const char* storageName, assert(fpDataGFD == NULL); // should not be open already! if (numBlocks <= 0) { - WMSG1("ERROR: bad numBlocks %ld\n", numBlocks); + LOGI("ERROR: bad numBlocks %ld", numBlocks); assert(false); return kDIErrInvalidCreateReq; } @@ -2416,7 +2416,7 @@ DiskImg::CreateImage(const char* pathName, const char* storageName, assert(fpDataGFD == NULL); // should not be open already! if (numTracks <= 0 || numSectPerTrack == 0) { - WMSG2("ERROR: bad tracks/sectors %ld/%ld\n", numTracks, numSectPerTrack); + LOGI("ERROR: bad tracks/sectors %ld/%ld", numTracks, numSectPerTrack); assert(false); return kDIErrInvalidCreateReq; } @@ -2434,11 +2434,11 @@ DiskImg::CreateImage(const char* pathName, const char* storageName, if (numSectPerTrack < 0) { /* nibble image with non-standard formatting */ if (!IsNibbleFormat(fPhysical)) { - WMSG0("Whoa: expected nibble format here\n"); + LOGI("Whoa: expected nibble format here"); assert(false); return kDIErrInvalidCreateReq; } - WMSG0("Sector image w/o sectors, switching to nibble mode\n"); + LOGI("Sector image w/o sectors, switching to nibble mode"); fHasNibbles = true; fHasSectors = false; fpNibbleDescr = NULL; @@ -2469,14 +2469,14 @@ DiskImg::CreateImageCommon(const char* pathName, const char* storageName, fNumSectPerTrack = 16; fNumTracks = fNumBlocks / 8; } else { - WMSG0("NOTE: sector access to new image not possible\n"); + LOGI("NOTE: sector access to new image not possible"); } } else if (fHasSectors) { if ((fNumSectPerTrack & 0x01) == 0) { fHasBlocks = true; fNumBlocks = (fNumTracks * fNumSectPerTrack) / 2; } else { - WMSG0("NOTE: block access to new image not possible\n"); + LOGI("NOTE: block access to new image not possible"); } } if (fHasSectors && fPhysical != kPhysicalFormatSectors) @@ -2492,7 +2492,7 @@ DiskImg::CreateImageCommon(const char* pathName, const char* storageName, */ dierr = ValidateCreateFormat(); if (dierr != kDIErrNone) { - WMSG0("ERROR: CIC arg validation failed, bailing\n"); + LOGI("ERROR: CIC arg validation failed, bailing"); goto bail; } @@ -2505,12 +2505,12 @@ DiskImg::CreateImageCommon(const char* pathName, const char* storageName, * THOUGHT: should allow creation of an in-memory disk image. This won't * work for NuFX, but will work for pretty much everything else. */ - WMSG1(" CIC: creating '%s'\n", pathName); + LOGI(" CIC: creating '%s'", pathName); int fd; fd = open(pathName, O_CREAT | O_EXCL, 0644); if (fd < 0) { dierr = (DIError) errno; - WMSG2("ERROR: unable to create file '%s' (errno=%d)\n", + LOGI("ERROR: unable to create file '%s' (errno=%d)", pathName, dierr); goto bail; } @@ -2651,7 +2651,7 @@ DiskImg::CreateImageCommon(const char* pathName, const char* storageName, } if (fpImageWrapper == NULL) { - WMSG0(" DI couldn't figure out the file format\n"); + LOGI(" DI couldn't figure out the file format"); dierr = kDIErrUnrecognizedFileFmt; goto bail; } @@ -2661,7 +2661,7 @@ DiskImg::CreateImageCommon(const char* pathName, const char* storageName, dierr = fpImageWrapper->Create(fLength, fPhysical, fOrder, fDOSVolumeNum, fpWrapperGFD, &fWrappedLength, &fpDataGFD); if (dierr != kDIErrNone) { - WMSG1("ImageWrapper Create failed, err=%d\n", dierr); + LOGI("ImageWrapper Create failed, err=%d", dierr); goto bail; } assert(fpDataGFD != NULL); @@ -2682,7 +2682,7 @@ DiskImg::CreateImageCommon(const char* pathName, const char* storageName, assert(!skipFormat); // don't skip low-level nibble formatting! if (fDOSVolumeNum == kVolumeNumNotSet) { fDOSVolumeNum = kDefaultNibbleVolumeNum; - WMSG0(" Using default nibble volume num\n"); + LOGI(" Using default nibble volume num"); } dierr = FormatNibbles(fpDataGFD); // write basic nibble stuff @@ -2722,7 +2722,7 @@ DiskImg::ValidateCreateFormat(void) const */ if (fHasBlocks && fNumBlocks >= 4194304) { // 2GB or larger? if (fFileFormat != kFileFormatUnadorned) { - WMSG0("CreateImage: images >= 2GB can only be unadorned\n"); + LOGI("CreateImage: images >= 2GB can only be unadorned"); return kDIErrInvalidCreateReq; } } @@ -2732,14 +2732,14 @@ DiskImg::ValidateCreateFormat(void) const fOrder == kSectorOrderUnknown || fFormat == kFormatUnknown) { - WMSG0("CreateImage: ambiguous format\n"); + LOGI("CreateImage: ambiguous format"); return kDIErrInvalidCreateReq; } if (fOuterFormat != kOuterFormatNone && fOuterFormat != kOuterFormatGzip && fOuterFormat != kOuterFormatZip) { - WMSG1("CreateImage: unsupported outer format %d\n", fOuterFormat); + LOGI("CreateImage: unsupported outer format %d", fOuterFormat); return kDIErrInvalidCreateReq; } if (fFileFormat != kFileFormatUnadorned && @@ -2751,7 +2751,7 @@ DiskImg::ValidateCreateFormat(void) const fFileFormat != kFileFormatNuFX && fFileFormat != kFileFormatDDD) { - WMSG1("CreateImage: unsupported file format %d\n", fFileFormat); + LOGI("CreateImage: unsupported file format %d", fFileFormat); return kDIErrInvalidCreateReq; } if (fFormat != kFormatGenericPhysicalOrd && @@ -2759,7 +2759,7 @@ DiskImg::ValidateCreateFormat(void) const fFormat != kFormatGenericDOSOrd && fFormat != kFormatGenericCPMOrd) { - WMSG0("CreateImage: may only use 'generic' formats\n"); + LOGI("CreateImage: may only use 'generic' formats"); return kDIErrInvalidCreateReq; } @@ -2768,25 +2768,25 @@ DiskImg::ValidateCreateFormat(void) const */ if (fPhysical != kPhysicalFormatSectors) { if (fOrder != kSectorOrderPhysical) { - WMSG0("CreateImage: nibble images are always 'physical' order\n"); + LOGI("CreateImage: nibble images are always 'physical' order"); return kDIErrInvalidCreateReq; } if (GetHasSectors() == false && GetHasNibbles() == false) { - WMSG2("CreateImage: must set hasSectors(%d) or hasNibbles(%d)\n", + LOGI("CreateImage: must set hasSectors(%d) or hasNibbles(%d)", GetHasSectors(), GetHasNibbles()); return kDIErrInvalidCreateReq; } if (fpNibbleDescr == NULL && GetNumSectPerTrack() > 0) { - WMSG0("CreateImage: must provide NibbleDescr for non-sector\n"); + LOGI("CreateImage: must provide NibbleDescr for non-sector"); return kDIErrInvalidCreateReq; } if (fpNibbleDescr != NULL && fpNibbleDescr->numSectors != GetNumSectPerTrack()) { - WMSG2("CreateImage: ?? nd->numSectors=%d, GetNumSectPerTrack=%d\n", + LOGI("CreateImage: ?? nd->numSectors=%d, GetNumSectPerTrack=%d", fpNibbleDescr->numSectors, GetNumSectPerTrack()); return kDIErrInvalidCreateReq; } @@ -2798,14 +2798,14 @@ DiskImg::ValidateCreateFormat(void) const fpNibbleDescr->encoding != kNibbleEnc62)) ) { - WMSG0("CreateImage: sector count/encoding mismatch\n"); + LOGI("CreateImage: sector count/encoding mismatch"); return kDIErrInvalidCreateReq; } if (GetNumTracks() != kTrackCount525 && !(GetNumTracks() == 40 && fFileFormat == kFileFormatTrackStar)) { - WMSG1("CreateImage: unexpected track count %ld\n", GetNumTracks()); + LOGI("CreateImage: unexpected track count %ld", GetNumTracks()); return kDIErrInvalidCreateReq; } } @@ -2813,7 +2813,7 @@ DiskImg::ValidateCreateFormat(void) const if (fPhysical != kPhysicalFormatSectors && fPhysical != kPhysicalFormatNib525_6656) { - WMSG1("CreateImage: 2MG can't handle physical %d\n", fPhysical); + LOGI("CreateImage: 2MG can't handle physical %d", fPhysical); return kDIErrInvalidCreateReq; } @@ -2821,78 +2821,78 @@ DiskImg::ValidateCreateFormat(void) const (fOrder != kSectorOrderProDOS && fOrder != kSectorOrderDOS)) { - WMSG0("CreateImage: 2MG requires DOS or ProDOS ordering\n"); + LOGI("CreateImage: 2MG requires DOS or ProDOS ordering"); return kDIErrInvalidCreateReq; } } if (fFileFormat == kFileFormatNuFX) { if (fOuterFormat != kOuterFormatNone) { - WMSG0("CreateImage: can't mix NuFX and outer wrapper\n"); + LOGI("CreateImage: can't mix NuFX and outer wrapper"); return kDIErrInvalidCreateReq; } if (fPhysical != kPhysicalFormatSectors) { - WMSG0("CreateImage: NuFX physical must be sectors\n"); + LOGI("CreateImage: NuFX physical must be sectors"); return kDIErrInvalidCreateReq; } if (fOrder != kSectorOrderProDOS) { - WMSG0("CreateImage: NuFX is always ProDOS-order\n"); + LOGI("CreateImage: NuFX is always ProDOS-order"); return kDIErrInvalidCreateReq; } } if (fFileFormat == kFileFormatDiskCopy42) { if (fPhysical != kPhysicalFormatSectors) { - WMSG0("CreateImage: DC42 physical must be sectors\n"); + LOGI("CreateImage: DC42 physical must be sectors"); return kDIErrInvalidCreateReq; } if ((GetHasBlocks() && GetNumBlocks() != 1600) || GetHasSectors() && (GetNumTracks() != 200 || GetNumSectPerTrack() != 16)) { - WMSG0("CreateImage: DC42 only for 800K disks\n"); + LOGI("CreateImage: DC42 only for 800K disks"); return kDIErrInvalidCreateReq; } if (fOrder != kSectorOrderProDOS && fOrder != kSectorOrderDOS) // used for UNIDOS disks?? { - WMSG0("CreateImage: DC42 is always ProDOS or DOS\n"); + LOGI("CreateImage: DC42 is always ProDOS or DOS"); return kDIErrInvalidCreateReq; } } if (fFileFormat == kFileFormatSim2eHDV) { if (fPhysical != kPhysicalFormatSectors) { - WMSG0("CreateImage: Sim2eHDV physical must be sectors\n"); + LOGI("CreateImage: Sim2eHDV physical must be sectors"); return kDIErrInvalidCreateReq; } if (fOrder != kSectorOrderProDOS) { - WMSG0("CreateImage: Sim2eHDV is always ProDOS-order\n"); + LOGI("CreateImage: Sim2eHDV is always ProDOS-order"); return kDIErrInvalidCreateReq; } } if (fFileFormat == kFileFormatTrackStar) { if (fPhysical != kPhysicalFormatNib525_Var) { - WMSG0("CreateImage: TrackStar physical must be var-nibbles\n"); + LOGI("CreateImage: TrackStar physical must be var-nibbles"); return kDIErrInvalidCreateReq; } } if (fFileFormat == kFileFormatFDI) { if (fPhysical != kPhysicalFormatNib525_Var) { - WMSG0("CreateImage: FDI physical must be var-nibbles\n"); + LOGI("CreateImage: FDI physical must be var-nibbles"); return kDIErrInvalidCreateReq; } } if (fFileFormat == kFileFormatDDD) { if (fPhysical != kPhysicalFormatSectors) { - WMSG0("CreateImage: DDD physical must be sectors\n"); + LOGI("CreateImage: DDD physical must be sectors"); return kDIErrInvalidCreateReq; } if (fOrder != kSectorOrderDOS) { - WMSG0("CreateImage: DDD is always DOS-order\n"); + LOGI("CreateImage: DDD is always DOS-order"); return kDIErrInvalidCreateReq; } if (!GetHasSectors() || GetNumTracks() != 35 || GetNumSectPerTrack() != 16) { - WMSG0("CreateImage: DDD is only for 16-sector 35-track disks\n"); + LOGI("CreateImage: DDD is only for 16-sector 35-track disks"); return kDIErrInvalidCreateReq; } } @@ -2926,20 +2926,20 @@ DiskImg::FormatSectors(GenericFD* pGFD, bool quickFormat) const if (quickFormat) { dierr = pGFD->Seek(fLength - sizeof(sctBuf), kSeekSet); if (dierr != kDIErrNone) { - WMSG2(" FormatSectors: GFD seek %ld failed (err=%d)\n", + LOGI(" FormatSectors: GFD seek %ld failed (err=%d)", (long) fLength - sizeof(sctBuf), dierr); goto bail; } dierr = pGFD->Write(sctBuf, sizeof(sctBuf), NULL); if (dierr != kDIErrNone) { - WMSG1(" FormatSectors: GFD quick write failed (err=%d)\n", dierr); + LOGI(" FormatSectors: GFD quick write failed (err=%d)", dierr); goto bail; } } else { for (length = fLength ; length > 0; length -= sizeof(sctBuf)) { dierr = pGFD->Write(sctBuf, sizeof(sctBuf), NULL); if (dierr != kDIErrNone) { - WMSG1(" FormatSectors: GFD write failed (err=%d)\n", dierr); + LOGI(" FormatSectors: GFD write failed (err=%d)", dierr); goto bail; } } @@ -2974,14 +2974,14 @@ DiskImg::FormatBlocks(GenericFD* pGFD) const for (length = fLength ; length > 0; length -= sizeof(blkBuf)) { dierr = pGFD->Write(blkBuf, sizeof(blkBuf), NULL); if (dierr != kDIErrNone) { - WMSG1(" FormatBlocks: GFD write failed (err=%d)\n", dierr); + LOGI(" FormatBlocks: GFD write failed (err=%d)", dierr); return dierr; } } assert(length == 0); end = time(NULL); - WMSG1("FormatBlocks complete, time=%ld\n", end - start); + LOGI("FormatBlocks complete, time=%ld", end - start); return kDIErrNone; } @@ -3047,12 +3047,12 @@ DiskImg::AddNote(NoteType type, const char* fmt, ...) len++; } - WMSG1("+++ adding note '%s'\n", buf); + LOGI("+++ adding note '%s'", buf); if (fNotes == NULL) { fNotes = new char[len +1]; if (fNotes == NULL) { - WMSG1("Unable to create notes[%d]\n", len+1); + LOGI("Unable to create notes[%d]", len+1); assert(false); return; } @@ -3061,7 +3061,7 @@ DiskImg::AddNote(NoteType type, const char* fmt, ...) int existingLen = strlen(fNotes); char* newNotes = new char[existingLen + len +1]; if (newNotes == NULL) { - WMSG1("Unable to create newNotes[%d]\n", existingLen+len+1); + LOGI("Unable to create newNotes[%d]", existingLen+len+1); assert(false); return; } @@ -3170,7 +3170,7 @@ DiskImg::OpenAppropriateDiskFS(bool allowUnknown) break; default: - WMSG1("WARNING: unhandled DiskFS case %d\n", GetFSFormat()); + LOGI("WARNING: unhandled DiskFS case %d", GetFSFormat()); assert(false); /* fall through */ case DiskImg::kFormatGenericPhysicalOrd: diff --git a/diskimg/DiskImgPriv.h b/diskimg/DiskImgPriv.h index d943c90..b9114a6 100644 --- a/diskimg/DiskImgPriv.h +++ b/diskimg/DiskImgPriv.h @@ -39,14 +39,6 @@ namespace DiskImgLib { #define LOGW(format, ...) DLOG_BASE(__FILE__, __LINE__, (format), __VA_ARGS__) #define LOGE(format, ...) DLOG_BASE(__FILE__, __LINE__, (format), __VA_ARGS__) -// TODO: remove these -#define WMSG0(fmt) LOGI(fmt) -#define WMSG1(fmt, arg0) LOGI(fmt, arg0) -#define WMSG2(fmt, arg0, arg1) LOGI(fmt, arg0, arg1) -#define WMSG3(fmt, arg0, arg1, arg2) LOGI(fmt, arg0, arg1, arg2) -#define WMSG4(fmt, arg0, arg1, arg2, arg3) LOGI(fmt, arg0, arg1, arg2, arg3) -#define WMSG5(fmt, arg0, arg1, arg2, arg3, arg4) LOGI(fmt, arg0, arg1, arg2, arg3, arg4) - /* put this in to break on interesting events when built debug */ #if defined(_DEBUG) # define DebugBreak() { assert(false); } @@ -173,7 +165,7 @@ public: void WriteBit(int val) { if (fBuf - fBufStart >= fBufSize) { if (!fOverflow) { - WMSG0("Overran bit output buffer\n"); + LOGI("Overran bit output buffer"); DebugBreak(); fOverflow = true; } diff --git a/diskimg/FAT.cpp b/diskimg/FAT.cpp index 8023ad1..e9a80cd 100644 --- a/diskimg/FAT.cpp +++ b/diskimg/FAT.cpp @@ -216,23 +216,23 @@ DiskFSFAT::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder) bool hasMBR, hasBS; hasMBR = UnpackMBR(blkBuf, &mbr); hasBS = UnpackBootSector(blkBuf, &bs); - WMSG2(" FAT hasMBR=%d hasBS=%d\n", hasMBR, hasBS); + LOGI(" FAT hasMBR=%d hasBS=%d", hasMBR, hasBS); if (!hasMBR && !hasBS) { dierr = kDIErrFilesystemNotFound; goto bail; } if (hasMBR) { - WMSG0(" FAT partition table found:\n"); + LOGI(" FAT partition table found:"); for (int i = 0; i < 4; i++) { - WMSG4(" %d: type=0x%02x start LBA=%-9lu size=%lu\n", + LOGI(" %d: type=0x%02x start LBA=%-9lu size=%lu", i, mbr.parTab[i].type, mbr.parTab[i].startLBA, mbr.parTab[i].size); } } if (hasBS) { - WMSG0(" FAT boot sector found:\n"); - WMSG1(" OEMName is '%.8s'\n", bs.oemName); + LOGI(" FAT boot sector found:"); + LOGI(" OEMName is '%.8s'", bs.oemName); } // looks good! @@ -268,7 +268,7 @@ DiskFSFAT::TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, } } - WMSG0(" FAT didn't find valid FS\n"); + LOGI(" FAT didn't find valid FS"); return kDIErrFilesystemNotFound; } @@ -365,7 +365,7 @@ DiskFSFAT::CreateFakeFile(void) void A2FileFAT::Dump(void) const { - WMSG1("A2FileFAT '%s'\n", fFileName); + LOGI("A2FileFAT '%s'", fFileName); } /* @@ -404,7 +404,7 @@ A2FileFAT::Open(A2FileDescr** ppOpenFile, bool readOnly, DIError A2FDFAT::Read(void* buf, size_t len, size_t* pActual) { - WMSG3(" FAT reading %d bytes from '%s' (offset=%ld)\n", + LOGI(" FAT reading %d bytes from '%s' (offset=%ld)", len, fpFile->GetPathName(), (long) fOffset); A2FileFAT* pFile = (A2FileFAT*) fpFile; diff --git a/diskimg/FDI.cpp b/diskimg/FDI.cpp index 9f1b077..6eb2270 100644 --- a/diskimg/FDI.cpp +++ b/diskimg/FDI.cpp @@ -76,13 +76,13 @@ WrapperFDI::UnpackDisk525(GenericFD* pGFD, GenericFD* pNewGFD, int numCyls, dierr = pGFD->Seek(kMinHeaderLen, kSeekSet); if (dierr != kDIErrNone) { - WMSG1("FDI: track seek failed (offset=%d)\n", kMinHeaderLen); + LOGI("FDI: track seek failed (offset=%d)", kMinHeaderLen); goto bail; } for (trk = 0; trk < numCyls * numHeads; trk++) { GetTrackInfo(trk, &type, &length256); - WMSG5("%2d.%d: t=0x%02x l=%d (%d)\n", trk / numHeads, trk % numHeads, + LOGI("%2d.%d: t=0x%02x l=%d (%d)", trk / numHeads, trk % numHeads, type, length256, length256 * 256); /* if we have data to read, read it */ @@ -130,14 +130,14 @@ WrapperFDI::UnpackDisk525(GenericFD* pGFD, GenericFD* pNewGFD, int numCyls, goodTracks[trk] = true; } if (nibbleLen > kTrackAllocSize) { - WMSG2(" FDI: decoded %ld nibbles, buffer is only %d\n", + LOGI(" FDI: decoded %ld nibbles, buffer is only %d", nibbleLen, kTrackAllocSize); dierr = kDIErrBadRawData; goto bail; } break; default: - WMSG1("FDI: unexpected track type 0x%04x\n", type); + LOGI("FDI: unexpected track type 0x%04x", type); dierr = kDIErrUnsupportedImageFeature; goto bail; } @@ -151,16 +151,16 @@ WrapperFDI::UnpackDisk525(GenericFD* pGFD, GenericFD* pNewGFD, int numCyls, dierr = pNewGFD->Write(nibbleBuf, nibbleLen); if (dierr != kDIErrNone) goto bail; - WMSG2(" FDI: track %d: wrote %ld nibbles\n", trk, nibbleLen); + LOGI(" FDI: track %d: wrote %ld nibbles", trk, nibbleLen); //offset += 256 * length256; //break; // DEBUG DEBUG } - WMSG2(" FDI: %d of %d tracks bad or blank\n", + LOGI(" FDI: %d of %d tracks bad or blank", badTracks, numCyls * numHeads); if (badTracks > (numCyls * numHeads) / 2) { - WMSG0("FDI: too many bad tracks\n"); + LOGI("FDI: too many bad tracks"); dierr = kDIErrBadRawData; goto bail; } @@ -180,7 +180,7 @@ WrapperFDI::UnpackDisk525(GenericFD* pGFD, GenericFD* pNewGFD, int numCyls, } } if (!want40 && trk > kTrackCount525) { - WMSG2(" FDI: no good tracks past %d, reducing from %d\n", + LOGI(" FDI: no good tracks past %d, reducing from %d", kTrackCount525, trk); trk = kTrackCount525; // nothing good out there, roll back } @@ -241,7 +241,7 @@ WrapperFDI::UnpackDisk35(GenericFD* pGFD, GenericFD* pNewGFD, int numCyls, dierr = pGFD->Seek(kMinHeaderLen, kSeekSet); if (dierr != kDIErrNone) { - WMSG1("FDI: track seek failed (offset=%d)\n", kMinHeaderLen); + LOGI("FDI: track seek failed (offset=%d)", kMinHeaderLen); goto bail; } @@ -249,7 +249,7 @@ WrapperFDI::UnpackDisk35(GenericFD* pGFD, GenericFD* pNewGFD, int numCyls, for (trk = 0; trk < numCyls * numHeads; trk++) { GetTrackInfo(trk, &type, &length256); - WMSG5("%2d.%d: t=0x%02x l=%d (%d)\n", trk / numHeads, trk % numHeads, + LOGI("%2d.%d: t=0x%02x l=%d (%d)", trk / numHeads, trk % numHeads, type, length256, length256 * 256); /* if we have data to read, read it */ @@ -295,19 +295,19 @@ WrapperFDI::UnpackDisk35(GenericFD* pGFD, GenericFD* pNewGFD, int numCyls, nibbleLen = kTrackLenNb2525; } if (nibbleLen > kNibbleBufLen) { - WMSG2(" FDI: decoded %ld nibbles, buffer is only %d\n", + LOGI(" FDI: decoded %ld nibbles, buffer is only %d", nibbleLen, kTrackAllocSize); dierr = kDIErrBadRawData; goto bail; } break; default: - WMSG1("FDI: unexpected track type 0x%04x\n", type); + LOGI("FDI: unexpected track type 0x%04x", type); dierr = kDIErrUnsupportedImageFeature; goto bail; } - WMSG2(" FDI: track %d got %ld nibbles\n", trk, nibbleLen); + LOGI(" FDI: track %d got %ld nibbles", trk, nibbleLen); /* fNibbleTrackInfo.offset[trk] = trk * kTrackAllocSize; @@ -328,7 +328,7 @@ WrapperFDI::UnpackDisk35(GenericFD* pGFD, GenericFD* pNewGFD, int numCyls, dierr = pNewGFD->Write(outputBuf, kBlockSize * DiskImg::SectorsPerTrack35(trk / numHeads)); if (dierr != kDIErrNone) { - WMSG2("FDI: failed writing disk blocks (%d * %d)\n", + LOGI("FDI: failed writing disk blocks (%d * %d)", kBlockSize, DiskImg::SectorsPerTrack35(trk / numHeads)); goto bail; } @@ -358,7 +358,7 @@ WrapperFDI::BitRate35(int cyl) else if (cyl <= 79) return 250000; // 590rpm else { - WMSG1(" FDI: invalid 3.5 cylinder %d\n", cyl); + LOGI(" FDI: invalid 3.5 cylinder %d", cyl); return 250000; } } @@ -388,7 +388,7 @@ WrapperFDI::FixBadNibbles(unsigned char* nibbleBuf, long nibbleLen) } if (badCount != 0) { - WMSG1(" FDI: fixed %d bad nibbles\n", badCount); + LOGI(" FDI: fixed %d bad nibbles", badCount); } } @@ -438,7 +438,7 @@ WrapperFDI::GetTrackInfo(int trk, int* pType, int* pLength256) /* raw MFM; for 0xf000, the value in 0n00 holds a bit rate index */ break; default: - WMSG1("Unexpected trackDescr 0x%04x\n", trackDescr); + LOGI("Unexpected trackDescr 0x%04x", trackDescr); *pType = 0x7e; // return an invalid value *pLength256 = 0; break; @@ -486,18 +486,18 @@ WrapperFDI::DecodePulseTrack(const unsigned char* inputBuf, long inputLen, if (hdr.numPulses < 64 || hdr.numPulses > 131072) { /* should be about 40,000 */ - WMSG1(" FDI: bad pulse count %ld in track\n", hdr.numPulses); + LOGI(" FDI: bad pulse count %ld in track", hdr.numPulses); return false; } /* advance past the 16 hdr bytes; now pointing at "average" stream */ inputBuf += kPulseStreamDataOffset; - WMSG1(" pulses: %ld\n", hdr.numPulses); - //WMSG2(" avg: len=%d comp=%d\n", hdr.avgStreamLen, hdr.avgStreamCompression); - //WMSG2(" min: len=%d comp=%d\n", hdr.minStreamLen, hdr.minStreamCompression); - //WMSG2(" max: len=%d comp=%d\n", hdr.maxStreamLen, hdr.maxStreamCompression); - //WMSG2(" idx: len=%d comp=%d\n", hdr.idxStreamLen, hdr.idxStreamCompression); + LOGI(" pulses: %ld", hdr.numPulses); + //LOGI(" avg: len=%d comp=%d", hdr.avgStreamLen, hdr.avgStreamCompression); + //LOGI(" min: len=%d comp=%d", hdr.minStreamLen, hdr.minStreamCompression); + //LOGI(" max: len=%d comp=%d", hdr.maxStreamLen, hdr.maxStreamCompression); + //LOGI(" idx: len=%d comp=%d", hdr.idxStreamLen, hdr.idxStreamCompression); /* * Uncompress or endian-swap the pulse streams. @@ -590,10 +590,10 @@ WrapperFDI::UncompressPulseStream(const unsigned char* inputBuf, long inputLen, if (format == kCompUncompressed) { int i; - WMSG0("NOT TESTED\n"); // remove this when we've tested it + LOGI("NOT TESTED"); // remove this when we've tested it if (inputLen != numPulses * bytesPerPulse) { - WMSG2(" FDI: got unc inputLen=%ld, outputLen=%ld\n", + LOGI(" FDI: got unc inputLen=%ld, outputLen=%ld", inputLen, numPulses * bytesPerPulse); return false; } @@ -611,9 +611,9 @@ WrapperFDI::UncompressPulseStream(const unsigned char* inputBuf, long inputLen, } else if (format == kCompHuffman) { if (!ExpandHuffman(inputBuf, inputLen, outputBuf, numPulses)) return false; - //WMSG0(" FDI: Huffman expansion succeeded\n"); + //LOGI(" FDI: Huffman expansion succeeded"); } else { - WMSG1(" FDI: got weird compression format %d\n", format); + LOGI(" FDI: got weird compression format %d", format); return false; } @@ -646,7 +646,7 @@ WrapperFDI::ExpandHuffman(const unsigned char* inputBuf, long inputLen, while (subStreamShift != 0) { if (inputBuf - origInputBuf >= inputLen) { - WMSG0(" FDI: overran input(1)\n"); + LOGI(" FDI: overran input(1)"); return false; } @@ -657,7 +657,7 @@ WrapperFDI::ExpandHuffman(const unsigned char* inputBuf, long inputLen, bits = *inputBuf++; sixteenBits = (bits & 0x80) != 0; // ignore redundant high-order - //WMSG3(" FDI: shift=%d ext=%d sixt=%d\n", + //LOGI(" FDI: shift=%d ext=%d sixt=%d", // subStreamShift, signExtend, sixteenBits); /* decode the Huffman tree structure */ @@ -666,7 +666,7 @@ WrapperFDI::ExpandHuffman(const unsigned char* inputBuf, long inputLen, bitMask = 0; inputBuf = HuffExtractTree(inputBuf, &root, &bits, &bitMask); - //WMSG1(" after tree: off=%d\n", inputBuf - origInputBuf); + //LOGI(" after tree: off=%d", inputBuf - origInputBuf); /* extract the Huffman node values */ if (sixteenBits) @@ -675,10 +675,10 @@ WrapperFDI::ExpandHuffman(const unsigned char* inputBuf, long inputLen, inputBuf = HuffExtractValues8(inputBuf, &root); if (inputBuf - origInputBuf >= inputLen) { - WMSG0(" FDI: overran input(2)\n"); + LOGI(" FDI: overran input(2)"); return false; } - //WMSG1(" after values: off=%d\n", inputBuf - origInputBuf); + //LOGI(" after values: off=%d", inputBuf - origInputBuf); /* decode the data over all pulses */ bitMask = 0; @@ -720,7 +720,7 @@ WrapperFDI::ExpandHuffman(const unsigned char* inputBuf, long inputLen, } if (inputBuf - origInputBuf != inputLen) { - WMSG2(" FDI: warning: Huffman input %d vs. %ld\n", + LOGI(" FDI: warning: Huffman input %d vs. %ld", inputBuf - origInputBuf, inputLen); return false; } @@ -745,7 +745,7 @@ WrapperFDI::HuffExtractTree(const unsigned char* inputBuf, HuffNode* pNode, val = *pBits & *pBitMask; (*pBitMask) >>= 1; - //WMSG1(" val=%d\n", val); + //LOGI(" val=%d", val); if (val != 0) { assert(pNode->left == NULL); @@ -883,11 +883,11 @@ WrapperFDI::ConvertPulseStreamsToNibbles(PulseIndexHeader* pHdr, int bitRate, * to replicate it here (and probably never test it either). This * assumes that the original was written for a big-endian machine. */ - WMSG0(" FDI: HEY: using fake index stream\n"); + LOGI(" FDI: HEY: using fake index stream"); DebugBreak(); fakeIdxStream = new unsigned long[pHdr->numPulses]; if (fakeIdxStream == NULL) { - WMSG0(" FDI: unable to alloc fake idx stream\n"); + LOGI(" FDI: unable to alloc fake idx stream"); goto bail; } for (i = 1; i < pHdr->numPulses; i++) @@ -961,7 +961,7 @@ WrapperFDI::ConvertPulseStreamsToNibbles(PulseIndexHeader* pHdr, int bitRate, idxStream[i] = sum; } - WMSG4(" FDI: maxIndex=%lu indexOffset=%d totalAvg=%lu weakBits=%d\n", + LOGI(" FDI: maxIndex=%lu indexOffset=%d totalAvg=%lu weakBits=%d", maxIndex, indexOffset, totalAvg, weakBits); /* @@ -977,13 +977,13 @@ WrapperFDI::ConvertPulseStreamsToNibbles(PulseIndexHeader* pHdr, int bitRate, pHdr->numPulses, maxIndex, indexOffset, totalAvg, bitRate, bitBuffer, &bitCount)) { - WMSG0(" FDI: ConvertPulsesToBits() failed\n"); + LOGI(" FDI: ConvertPulsesToBits() failed"); goto bail; } - //WMSG1(" Got %d bits\n", bitCount); + //LOGI(" Got %d bits", bitCount); if (bitCount < 0) { - WMSG0(" FDI: overran output bit buffer\n"); + LOGI(" FDI: overran output bit buffer"); goto bail; } @@ -995,7 +995,7 @@ WrapperFDI::ConvertPulseStreamsToNibbles(PulseIndexHeader* pHdr, int bitRate, */ if (!ConvertBitsToNibbles(bitBuffer, bitCount, nibbleBuf, pNibbleLen)) { - WMSG0(" FDI: ConvertBitsToNibbles() failed\n"); + LOGI(" FDI: ConvertBitsToNibbles() failed"); goto bail; } @@ -1142,7 +1142,7 @@ WrapperFDI::ConvertPulsesToBits(const unsigned long* avgStream, i++; } if (i == numPulses) { - WMSG0(" FDI: no stable and long-enough pulse in track\n"); + LOGI(" FDI: no stable and long-enough pulse in track"); goto bail; } @@ -1263,12 +1263,12 @@ WrapperFDI::ConvertPulsesToBits(const unsigned long* avgStream, if (avgPulse < minPulse || avgPulse > maxPulse) { /* this is bad -- we're out of bounds */ - WMSG3(" FDI: avgPulse out of bounds: avg=%lu min=%lu max=%lu\n", + LOGI(" FDI: avgPulse out of bounds: avg=%lu min=%lu max=%lu", avgPulse, minPulse, maxPulse); } if (avgPulse < refPulse) { /* I guess this is also bad */ - WMSG2(" FDI: avgPulse < refPulse (%lu %lu)\n", + LOGI(" FDI: avgPulse < refPulse (%lu %lu)", avgPulse, refPulse); } pulse += avgPulse - refPulse; @@ -1440,7 +1440,7 @@ WrapperFDI::ConvertPulsesToBits(const unsigned long* avgStream, } *pOutputLen = bitOutput.Finish(); - WMSG1(" FDI: converted pulses to %d bits\n", *pOutputLen); + LOGI(" FDI: converted pulses to %d bits", *pOutputLen); result = true; bail: @@ -1492,7 +1492,7 @@ WrapperFDI::ConvertBitsToNibbles(const unsigned char* bitBuffer, int bitCount, val = (val << 1) | inputBuffer.GetBit(&wrap); if ((val & 0x80) == 0) { // not allowed by GCR encoding, probably garbage between sectors - WMSG0(" FDI: WARNING: more than 2 consecutive zeroes (sync)\n"); + LOGI(" FDI: WARNING: more than 2 consecutive zeroes (sync)"); } } @@ -1508,11 +1508,11 @@ WrapperFDI::ConvertBitsToNibbles(const unsigned char* bitBuffer, int bitCount, if ((val & 0x80) == 0) val = (val << 1) | inputBuffer.GetBit(&wrap); if ((val & 0x80) == 0) { - WMSG0(" FDI: WARNING: more than 2 consecutive zeroes (read)\n"); + LOGI(" FDI: WARNING: more than 2 consecutive zeroes (read)"); } if (nibbleBuf - nibbleBufStart >= outputBufSize) { - WMSG0(" FDI: bits overflowed nibble buffer\n"); + LOGI(" FDI: bits overflowed nibble buffer"); goto bail; } *nibbleBuf++ = val; @@ -1524,11 +1524,11 @@ WrapperFDI::ConvertBitsToNibbles(const unsigned char* bitBuffer, int bitCount, if (inputBuffer.GetBitsConsumed() != bitCount) { /* we dropped some or double-counted some */ - WMSG2(" FDI: WARNING: consumed %d of %d bits\n", + LOGI(" FDI: WARNING: consumed %d of %d bits", inputBuffer.GetBitsConsumed(), bitCount); } - WMSG4(" FDI: consumed %d of %d (first=0x%02x last=0x%02x)\n", + LOGI(" FDI: consumed %d of %d (first=0x%02x last=0x%02x)", inputBuffer.GetBitsConsumed(), bitCount, *nibbleBufStart, *(nibbleBuf-1)); diff --git a/diskimg/FocusDrive.cpp b/diskimg/FocusDrive.cpp index ac5caf1..c67d8b5 100644 --- a/diskimg/FocusDrive.cpp +++ b/diskimg/FocusDrive.cpp @@ -64,20 +64,20 @@ DiskFSFocusDrive::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder) goto bail; if (memcmp(blkBuf, kSignature, kSignatureLen) != 0) { - WMSG0(" FocusDrive partition signature not found in first part block\n"); + LOGI(" FocusDrive partition signature not found in first part block"); dierr = kDIErrFilesystemNotFound; goto bail; } partCount = blkBuf[0x0f]; if (partCount == 0 || partCount > kMaxPartitions) { - WMSG1(" FocusDrive partition count looks bad (%d)\n", partCount); + LOGI(" FocusDrive partition count looks bad (%d)", partCount); dierr = kDIErrFilesystemNotFound; goto bail; } // success! - WMSG1(" Looks like FocusDrive with %d partitions\n", partCount); + LOGI(" Looks like FocusDrive with %d partitions", partCount); bail: return dierr; @@ -126,9 +126,9 @@ DiskFSFocusDrive::DumpPartitionMap(const PartitionMap* pMap) { int i; - WMSG1(" FocusDrive partition map (%d partitions):\n", pMap->partCount); + LOGI(" FocusDrive partition map (%d partitions):", pMap->partCount); for (i = 0; i < pMap->partCount; i++) { - WMSG4(" %2d: %8ld %8ld '%s'\n", i, pMap->entry[i].startBlock, + LOGI(" %2d: %8ld %8ld '%s'", i, pMap->entry[i].startBlock, pMap->entry[i].blockCount, pMap->entry[i].name); } } @@ -146,15 +146,15 @@ DiskFSFocusDrive::OpenSubVolume(long startBlock, long numBlocks, DiskImg* pNewImg = NULL; //bool tweaked = false; - WMSG2("Adding %ld +%ld\n", startBlock, numBlocks); + LOGI("Adding %ld +%ld", startBlock, numBlocks); if (startBlock > fpImg->GetNumBlocks()) { - WMSG2("FocusDrive start block out of range (%ld vs %ld)\n", + LOGI("FocusDrive start block out of range (%ld vs %ld)", startBlock, fpImg->GetNumBlocks()); return kDIErrBadPartition; } if (startBlock + numBlocks > fpImg->GetNumBlocks()) { - WMSG2("FocusDrive partition too large (%ld vs %ld avail)\n", + LOGI("FocusDrive partition too large (%ld vs %ld avail)", numBlocks, fpImg->GetNumBlocks() - startBlock); fpImg->AddNote(DiskImg::kNoteInfo, "Reduced partition from %ld blocks to %ld.\n", @@ -171,18 +171,18 @@ DiskFSFocusDrive::OpenSubVolume(long startBlock, long numBlocks, dierr = pNewImg->OpenImage(fpImg, startBlock, numBlocks); if (dierr != kDIErrNone) { - WMSG3(" FocusDriveSub: OpenImage(%ld,%ld) failed (err=%d)\n", + LOGI(" FocusDriveSub: OpenImage(%ld,%ld) failed (err=%d)", startBlock, numBlocks, dierr); goto bail; } - //WMSG2(" +++ CFFASub: new image has ro=%d (parent=%d)\n", + //LOGI(" +++ CFFASub: new image has ro=%d (parent=%d)", // pNewImg->GetReadOnly(), pImg->GetReadOnly()); /* figure out what the format is */ dierr = pNewImg->AnalyzeImage(); if (dierr != kDIErrNone) { - WMSG1(" FocusDriveSub: analysis failed (err=%d)\n", dierr); + LOGI(" FocusDriveSub: analysis failed (err=%d)", dierr); goto bail; } @@ -190,7 +190,7 @@ DiskFSFocusDrive::OpenSubVolume(long startBlock, long numBlocks, if (pNewImg->GetFSFormat() == DiskImg::kFormatUnknown || pNewImg->GetSectorOrder() == DiskImg::kSectorOrderUnknown) { - WMSG2(" FocusDriveSub (%ld,%ld): unable to identify filesystem\n", + LOGI(" FocusDriveSub (%ld,%ld): unable to identify filesystem", startBlock, numBlocks); DiskFSUnknown* pUnknownFS = new DiskFSUnknown; if (pUnknownFS == NULL) { @@ -201,10 +201,10 @@ DiskFSFocusDrive::OpenSubVolume(long startBlock, long numBlocks, pNewFS = pUnknownFS; } else { /* open a DiskFS for the sub-image */ - WMSG2(" FocusDriveSub (%ld,%ld) analyze succeeded!\n", startBlock, numBlocks); + LOGI(" FocusDriveSub (%ld,%ld) analyze succeeded!", startBlock, numBlocks); pNewFS = pNewImg->OpenAppropriateDiskFS(true); if (pNewFS == NULL) { - WMSG0(" FocusDriveSub: OpenAppropriateDiskFS failed\n"); + LOGI(" FocusDriveSub: OpenAppropriateDiskFS failed"); dierr = kDIErrUnsupportedFSFmt; goto bail; } @@ -230,7 +230,7 @@ DiskFSFocusDrive::OpenSubVolume(long startBlock, long numBlocks, initMode = kInitFull; dierr = pNewFS->Initialize(pNewImg, initMode); if (dierr != kDIErrNone) { - WMSG1(" FocusDriveSub: error %d reading list of files from disk", dierr); + LOGE(" FocusDriveSub: error %d reading list of files from disk", dierr); goto bail; } @@ -264,7 +264,7 @@ DiskFSFocusDrive::TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, return kDIErrNone; } - WMSG0(" FS didn't find valid FocusDrive\n"); + LOGI(" FS didn't find valid FocusDrive"); return kDIErrFilesystemNotFound; } @@ -277,7 +277,7 @@ DiskFSFocusDrive::Initialize(void) { DIError dierr = kDIErrNone; - WMSG1("FocusDrive initializing (scanForSub=%d)\n", fScanForSubVolumes); + LOGI("FocusDrive initializing (scanForSub=%d)", fScanForSubVolumes); /* seems pointless *not* to, but we just do what we're told */ if (fScanForSubVolumes != kScanSubDisabled) { @@ -345,13 +345,13 @@ DiskFSFocusDrive::OpenVol(int idx, long startBlock, long numBlocks, DiskFS* pNewFS = NULL; DiskImg* pNewImg = NULL; - WMSG1(" FocusDrive failed opening sub-volume %d\n", idx); + LOGI(" FocusDrive failed opening sub-volume %d", idx); dierr = CreatePlaceholder(startBlock, numBlocks, name, NULL, &pNewImg, &pNewFS); if (dierr == kDIErrNone) { AddSubVolumeToList(pNewImg, pNewFS); } else { - WMSG1(" FocusDrive unable to create placeholder (err=%d)\n", + LOGI(" FocusDrive unable to create placeholder (err=%d)", dierr); // fall out with error } diff --git a/diskimg/GenericFD.cpp b/diskimg/GenericFD.cpp index a308e1f..88ed5d0 100644 --- a/diskimg/GenericFD.cpp +++ b/diskimg/GenericFD.cpp @@ -31,7 +31,7 @@ GenericFD::CopyFile(GenericFD* pDst, GenericFD* pSrc, di_off_t length, unsigned char* copyBuf = NULL; int copySize; - WMSG1("+++ CopyFile: %ld bytes\n", (long) length); + LOGI("+++ CopyFile: %ld bytes", (long) length); if (pDst == NULL || pSrc == NULL || length < 0) return kDIErrInvalidArg; @@ -111,7 +111,7 @@ GFDFile::Open(const char* filename, bool readOnly) dierr = kDIErrAccessDenied; else dierr = ErrnoOrGeneric(); - WMSG3(" GDFile Open failed opening '%s', ro=%d (err=%d)\n", + LOGI(" GDFile Open failed opening '%s', ro=%d (err=%d)", filename, readOnly, dierr); return dierr; } @@ -135,14 +135,14 @@ GFDFile::Read(void* buf, size_t length, size_t* pActual) dierr = ErrnoOrGeneric(); return dierr; } - WMSG0("MYSTERY FREAD RESULT\n"); + LOGI("MYSTERY FREAD RESULT"); return kDIErrInternal; } if (pActual == NULL) { if (actual != length) { dierr = ErrnoOrGeneric(); - WMSG3(" GDFile Read failed on %d bytes (actual=%d, err=%d)\n", + LOGI(" GDFile Read failed on %d bytes (actual=%d, err=%d)", length, actual, dierr); return dierr; } @@ -164,7 +164,7 @@ GFDFile::Write(const void* buf, size_t length, size_t* pActual) assert(pActual == NULL); // not handling this yet if (::fwrite(buf, length, 1, fFp) != 1) { dierr = ErrnoOrGeneric(); - WMSG2(" GDFile Write failed on %d bytes (err=%d)\n", length, dierr); + LOGI(" GDFile Write failed on %d bytes (err=%d)", length, dierr); return dierr; } return dierr; @@ -183,7 +183,7 @@ GFDFile::Seek(di_off_t offset, DIWhence whence) //if (::fseek(fFp, (long) offset, whence) != 0) { if (::fseeko(fFp, offset, whence) != 0) { dierr = ErrnoOrGeneric(); - WMSG1(" GDFile Seek failed (err=%d)\n", dierr); + LOGI(" GDFile Seek failed (err=%d)", dierr); return dierr; } return dierr; @@ -201,7 +201,7 @@ GFDFile::Tell(void) result = ::ftello(fFp); if (result == -1) { dierr = ErrnoOrGeneric(); - WMSG1(" GDFile Tell failed (err=%d)\n", dierr); + LOGI(" GDFile Tell failed (err=%d)", dierr); return result; } return result; @@ -233,7 +233,7 @@ GFDFile::Close(void) if (fFp == NULL) return kDIErrNotReady; - WMSG1(" GFDFile closing '%s'\n", fPathName); + LOGI(" GFDFile closing '%s'", fPathName); fclose(fFp); fFp = NULL; return kDIErrNone; @@ -263,7 +263,7 @@ GFDFile::Open(const char* filename, bool readOnly) dierr = kDIErrAccessDenied; else dierr = ErrnoOrGeneric(); - WMSG3(" GDFile Open failed opening '%s', ro=%d (err=%d)\n", + LOGI(" GDFile Open failed opening '%s', ro=%d (err=%d)", filename, readOnly, dierr); return dierr; } @@ -284,14 +284,14 @@ GFDFile::Read(void* buf, size_t length, size_t* pActual) return kDIErrEOF; if (actual < 0) { dierr = ErrnoOrGeneric(); - WMSG3(" GDFile Read failed on %d bytes (actual=%d, err=%d)\n", + LOGI(" GDFile Read failed on %d bytes (actual=%d, err=%d)", length, actual, dierr); return dierr; } if (pActual == NULL) { if (actual != (ssize_t) length) { - WMSG2(" GDFile Read partial (wanted=%d actual=%d)\n", + LOGI(" GDFile Read partial (wanted=%d actual=%d)", length, actual); return kDIErrReadFailed; } @@ -315,7 +315,7 @@ GFDFile::Write(const void* buf, size_t length, size_t* pActual) actual = ::write(fFd, buf, length); if (actual != (ssize_t) length) { dierr = ErrnoOrGeneric(); - WMSG3(" GDFile Write failed on %d bytes (actual=%d err=%d)\n", + LOGI(" GDFile Write failed on %d bytes (actual=%d err=%d)", length, actual, dierr); return dierr; } @@ -342,7 +342,7 @@ GFDFile::Seek(di_off_t offset, DIWhence whence) if (newPosn == kFailure) { assert((unsigned long) offset != 0xccccccccUL); // uninitialized data! dierr = ErrnoOrGeneric(); - WMSG3(" GDFile Seek %ld-%lu failed (err=%d)\n", + LOGI(" GDFile Seek %ld-%lu failed (err=%d)", (long) (offset >> 32), (unsigned long) offset, dierr); } return dierr; @@ -365,7 +365,7 @@ GFDFile::Tell(void) if (result == -1) { dierr = ErrnoOrGeneric(); - WMSG1(" GDFile Tell failed (err=%d)\n", dierr); + LOGI(" GDFile Tell failed (err=%d)", dierr); return result; } return result; @@ -396,7 +396,7 @@ GFDFile::Close(void) if (fFd < 0) return kDIErrNotReady; - WMSG1(" GFDFile closing '%s'\n", fPathName); + LOGI(" GFDFile closing '%s'", fPathName); ::close(fFd); fFd = -1; return kDIErrNone; @@ -420,7 +420,7 @@ GFDBuffer::Open(void* buffer, di_off_t length, bool doDelete, bool doExpand, return kDIErrInvalidArg; if (length > kMaxReasonableSize) { // be reasonable - WMSG1(" GFDBuffer refusing to allocate buffer size(long)=%ld bytes\n", + LOGI(" GFDBuffer refusing to allocate buffer size(long)=%ld bytes", (long) length); return kDIErrInvalidArg; } @@ -454,7 +454,7 @@ GFDBuffer::Read(void* buf, size_t length, size_t* pActual) if (fCurrentOffset + (long)length > fLength) { if (pActual == NULL) { - WMSG3(" GFDBuffer underrrun off=%ld len=%d flen=%ld\n", + LOGI(" GFDBuffer underrrun off=%ld len=%d flen=%ld", (long) fCurrentOffset, length, (long) fLength); return kDIErrDataUnderrun; } else { @@ -484,7 +484,7 @@ GFDBuffer::Write(const void* buf, size_t length, size_t* pActual) assert(pActual == NULL); // not handling this yet if (fCurrentOffset + (long)length > fLength) { if (!fDoExpand) { - WMSG3(" GFDBuffer overrun off=%ld len=%d flen=%ld\n", + LOGI(" GFDBuffer overrun off=%ld len=%d flen=%ld", (long) fCurrentOffset, length, (long) fLength); return kDIErrDataOverrun; } @@ -503,7 +503,7 @@ GFDBuffer::Write(const void* buf, size_t length, size_t* pActual) } else { /* does not fit, realloc buffer */ fAllocLength = (long) fCurrentOffset + (long)length + 8*1024; - WMSG1("Reallocating buffer (new size = %ld)\n", fAllocLength); + LOGI("Reallocating buffer (new size = %ld)", fAllocLength); assert(fAllocLength < kMaxReasonableSize); char* newBuf = new char[(int) fAllocLength]; if (newBuf == NULL) @@ -576,10 +576,10 @@ GFDBuffer::Close(void) return kDIErrNone; if (fDoDelete) { - WMSG0(" GFDBuffer closing and deleting\n"); + LOGI(" GFDBuffer closing and deleting"); delete[] (char*) fBuffer; } else { - WMSG0(" GFDBuffer closing\n"); + LOGI(" GFDBuffer closing"); } fBuffer = NULL; @@ -661,7 +661,7 @@ GFDWinVolume::Read(void* buf, size_t length, size_t* pActual) DIError dierr = kDIErrNone; unsigned char* blkBuf = NULL; - //WMSG2(" GFDWinVolume: reading %ld bytes from offset %ld\n", length, + //LOGI(" GFDWinVolume: reading %ld bytes from offset %ld", length, // fCurrentOffset); if (!fVolAccess.Ready()) @@ -705,7 +705,7 @@ GFDWinVolume::Read(void* buf, size_t length, size_t* pActual) if (thisCount > length) thisCount = length; - //WMSG2(" Copying %d bytes from block %d\n", + //LOGI(" Copying %d bytes from block %d", // thisCount, blockIndex); memcpy(buf, blkBuf + bufOffset, thisCount); @@ -745,7 +745,7 @@ GFDWinVolume::Write(const void* buf, size_t length, size_t* pActual) DIError dierr = kDIErrNone; unsigned char* blkBuf = NULL; - //WMSG2(" GFDWinVolume: writing %ld bytes at offset %ld\n", length, + //LOGI(" GFDWinVolume: writing %ld bytes at offset %ld", length, // fCurrentOffset); if (!fVolAccess.Ready()) @@ -791,7 +791,7 @@ GFDWinVolume::Write(const void* buf, size_t length, size_t* pActual) if (thisCount > length) thisCount = length; - //WMSG3(" Copying %d bytes into block %d (off=%d)\n", + //LOGI(" Copying %d bytes into block %d (off=%d)", // thisCount, blockIndex, bufOffset); memcpy(blkBuf + bufOffset, buf, thisCount); @@ -877,7 +877,7 @@ GFDWinVolume::Close(void) if (!fVolAccess.Ready()) return kDIErrNotReady; - WMSG0(" GFDWinVolume closing\n"); + LOGI(" GFDWinVolume closing"); fVolAccess.Close(); return kDIErrNone; } diff --git a/diskimg/Global.cpp b/diskimg/Global.cpp index 9b90672..5e88fd3 100644 --- a/diskimg/Global.cpp +++ b/diskimg/Global.cpp @@ -28,11 +28,11 @@ Global::AppInit(void) long major, minor, bug; if (fAppInitCalled) { - LOGW("DiskImg AppInit already called\n"); + LOGW("DiskImg AppInit already called"); return kDIErrNone; } - LOGI("Initializing DiskImg library v%d.%d.%d\n", + LOGI("Initializing DiskImg library v%d.%d.%d", kDiskImgVersionMajor, kDiskImgVersionMinor, kDiskImgVersionBug); #ifdef _WIN32 @@ -44,9 +44,9 @@ Global::AppInit(void) sizeof(fileNameBuf) / sizeof(WCHAR)) != 0) { // GetModuleHandle does not increase ref count, so no need to release - LOGD("DiskImg DLL loaded from '%ls'\n", fileNameBuf); + LOGD("DiskImg DLL loaded from '%ls'", fileNameBuf); } else { - LOGW("Unable to get DiskImg DLL filename\n"); + LOGW("Unable to get DiskImg DLL filename"); } #endif @@ -60,7 +60,7 @@ Global::AppInit(void) } if (major != kNuVersionMajor || minor < kNuVersionMinor) { - LOGE("Unexpected NufxLib version %ld.%ld.%ld\n", + LOGE("Unexpected NufxLib version %ld.%ld.%ld", major, minor, bug); return kDIErrNufxLibInitFailed; } @@ -79,7 +79,7 @@ Global::AppInit(void) } } #endif - LOGD("DiskImg HasSPTI=%d HasASPI=%d\n", GetHasSPTI(), GetHasASPI()); + LOGD("DiskImg HasSPTI=%d HasASPI=%d", GetHasSPTI(), GetHasASPI()); fAppInitCalled = true; @@ -92,7 +92,7 @@ Global::AppInit(void) /*static*/ DIError Global::AppCleanup(void) { - WMSG0("DiskImgLib cleanup\n"); + LOGI("DiskImgLib cleanup"); delete fpASPI; return kDIErrNone; } diff --git a/diskimg/Gutenberg.cpp b/diskimg/Gutenberg.cpp index e0e50da..7396b8d 100644 --- a/diskimg/Gutenberg.cpp +++ b/diskimg/Gutenberg.cpp @@ -81,7 +81,7 @@ TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, int* pGoodCount) foundGood++; } else if (catTrack >0x80) { - WMSG2(" Gutenberg detected end-of-catalog on cat (%d,%d)\n", + LOGI(" Gutenberg detected end-of-catalog on cat (%d,%d)", catTrack, catSect); break; } @@ -92,11 +92,11 @@ TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, int* pGoodCount) if (iterations >= DiskFSGutenberg::kMaxCatalogSectors) { /* possible cause: LF->CR conversion screws up link to sector $0a */ dierr = kDIErrDirectoryLoop; - WMSG1(" Gutenberg directory links cause a loop (order=%d)\n", imageOrder); + LOGI(" Gutenberg directory links cause a loop (order=%d)", imageOrder); goto bail; } - WMSG2(" Gutenberg foundGood=%d order=%d\n", foundGood, imageOrder); + LOGI(" Gutenberg foundGood=%d order=%d", foundGood, imageOrder); *pGoodCount = foundGood; bail: @@ -136,14 +136,14 @@ DiskFSGutenberg::TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, if (bestCount >= 2 || (leniency == kLeniencyVery && bestCount >= 1)) { - WMSG2(" Gutenberg test: bestCount=%d for order=%d\n", bestCount, bestOrder); + LOGI(" Gutenberg test: bestCount=%d for order=%d", bestCount, bestOrder); assert(bestOrder != DiskImg::kSectorOrderUnknown); *pOrder = bestOrder; *pFormat = DiskImg::kFormatGutenberg; return kDIErrNone; } - WMSG0(" Gutenberg didn't find a valid filesystem.\n"); + LOGI(" Gutenberg didn't find a valid filesystem."); return kDIErrFilesystemNotFound; } @@ -216,7 +216,7 @@ DiskFSGutenberg::ReadCatalog(void) while (catTrack < 35 && catSect < 16 && iterations < kMaxCatalogSectors) { - WMSG2(" Gutenberg reading catalog sector T=%d S=%d\n", catTrack, catSect); + LOGI(" Gutenberg reading catalog sector T=%d S=%d", catTrack, catSect); dierr = fpImg->ReadTrackSector(catTrack, catSect, sctBuf); if (dierr != kDIErrNone) goto bail; @@ -335,7 +335,7 @@ DiskFSGutenberg::GetFileLengths(void) tsCount ++; dierr = fpImg->ReadTrackSector(currentTrack, currentSector, sctBuf); if (dierr != kDIErrNone) { - WMSG1("Gutenberg failed loading track/sector for '%s'\n", + LOGI("Gutenberg failed loading track/sector for '%s'", pFile->GetPathName()); goto bail; } @@ -523,11 +523,11 @@ bail: void A2FileGutenberg::Dump(void) const { - WMSG1("A2FileGutenberg '%s'\n", fFileName); - WMSG2(" TS T=%-2d S=%-2d\n", fTrack, fSector); - WMSG2(" Cat T=%-2d S=%-2d\n", fCatTS.track, fCatTS.sector); - WMSG3(" type=%d lck=%d slen=%d\n", fFileType, fLocked, fLengthInSectors); - WMSG2(" auxtype=0x%04x length=%ld\n", + LOGI("A2FileGutenberg '%s'", fFileName); + LOGI(" TS T=%-2d S=%-2d", fTrack, fSector); + LOGI(" Cat T=%-2d S=%-2d", fCatTS.track, fCatTS.sector); + LOGI(" type=%d lck=%d slen=%d", fFileType, fLocked, fLengthInSectors); + LOGI(" auxtype=0x%04x length=%ld", fAuxType, (long) fLength); } @@ -545,7 +545,7 @@ A2FileGutenberg::Dump(void) const DIError A2FDGutenberg::Read(void* buf, size_t len, size_t* pActual) { - WMSG3(" Gutenberg reading %d bytes from '%s' (offset=%ld)\n", + LOGI(" Gutenberg reading %d bytes from '%s' (offset=%ld)", len, fpFile->GetPathName(), (long) fOffset); A2FileGutenberg* pFile = (A2FileGutenberg*) fpFile; @@ -569,7 +569,7 @@ A2FDGutenberg::Read(void* buf, size_t len, size_t* pActual) currentSector, sctBuf); if (dierr != kDIErrNone) { - WMSG1(" Gutenberg error reading file '%s'\n", pFile->GetPathName()); + LOGI(" Gutenberg error reading file '%s'", pFile->GetPathName()); return dierr; } thisCount = kSctSize - bufOffset; diff --git a/diskimg/HFS.cpp b/diskimg/HFS.cpp index b464d17..c2fad17 100644 --- a/diskimg/HFS.cpp +++ b/diskimg/HFS.cpp @@ -149,13 +149,13 @@ DiskFSHFS::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder) } if ((mdb.drAlBlkSiz & 0x1ff) != 0) { // allocation block size must be a multiple of 512 - WMSG1(" HFS: found allocation block size = %lu, rejecting\n", + LOGI(" HFS: found allocation block size = %lu, rejecting", mdb.drAlBlkSiz); dierr = kDIErrFilesystemNotFound; goto bail; } if (mdb.drVN[0] == 0 || mdb.drVN[0] > kMaxVolumeName) { - WMSG1(" HFS: volume name has len = %d, rejecting\n", mdb.drVN[0]); + LOGI(" HFS: volume name has len = %d, rejecting", mdb.drVN[0]); dierr = kDIErrFilesystemNotFound; goto bail; } @@ -166,7 +166,7 @@ DiskFSHFS::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder) // We're probably trying to open a 1GB volume as if it were only // 32MB. Maybe this is a full HFS partition and we're trying to // see if it's a CFFA image. Whatever the case, we can't do this. - WMSG2("HFS: volume exceeds disk image size (%ld vs %ld)\n", + LOGI("HFS: volume exceeds disk image size (%ld vs %ld)", minBlocks, pImg->GetNumBlocks()); dierr = kDIErrFilesystemNotFound; goto bail; @@ -205,7 +205,7 @@ DiskFSHFS::TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, } } - WMSG0(" HFS didn't find valid FS\n"); + LOGI(" HFS didn't find valid FS"); return kDIErrFilesystemNotFound; } @@ -238,7 +238,7 @@ DiskFSHFS::LoadVolHeader(void) } else fLocalTimeOffset = 0; - WMSG1(" HFS computed local time offset = %.3f hours\n", + LOGI(" HFS computed local time offset = %.3f hours", fLocalTimeOffset / 3600.0); } @@ -308,7 +308,7 @@ DiskFSHFS::LoadVolHeader(void) (time_t) (fModifiedDateTime - kDateTimeOffset) - fLocalTimeOffset; pFile->fAccess = DiskFS::kFileAccessUnlocked; - //WMSG2("GOT *** '%s' '%s'\n", pFile->fFileName, pFile->fPathName); + //LOGI("GOT *** '%s' '%s'", pFile->fFileName, pFile->fPathName); AddFileToList(pFile); @@ -352,18 +352,18 @@ DiskFSHFS::SetVolumeUsageMap(void) void DiskFSHFS::DumpVolHeader(void) { - WMSG0("HFS volume header read:\n"); - WMSG1(" volume name = '%s'\n", fVolumeName); - WMSG4(" total blocks = %ld (allocSize=%ld [x%lu], numAllocs=%lu)\n", + LOGI("HFS volume header read:"); + LOGI(" volume name = '%s'", fVolumeName); + LOGI(" total blocks = %ld (allocSize=%ld [x%lu], numAllocs=%lu)", fTotalBlocks, fAllocationBlockSize, fAllocationBlockSize / kBlkSize, fNumAllocationBlocks); - WMSG2(" num directories=%ld, num files=%ld\n", + LOGI(" num directories=%ld, num files=%ld", fNumDirectories, fNumFiles); time_t when; when = (time_t) (fCreatedDateTime - kDateTimeOffset - fLocalTimeOffset); - WMSG2(" cre date=0x%08lx %.24s\n", fCreatedDateTime, ctime(&when)); + LOGI(" cre date=0x%08lx %.24s", fCreatedDateTime, ctime(&when)); when = (time_t) (fModifiedDateTime - kDateTimeOffset - fLocalTimeOffset); - WMSG2(" mod date=0x%08lx %.24s\n", fModifiedDateTime, ctime(&when)); + LOGI(" mod date=0x%08lx %.24s", fModifiedDateTime, ctime(&when)); } @@ -388,13 +388,13 @@ DiskFSHFS::Initialize(InitMode initMode) DumpVolHeader(); if (initMode == kInitHeaderOnly) { - WMSG0(" HFS - headerOnly set, skipping file load\n"); + LOGI(" HFS - headerOnly set, skipping file load"); goto bail; } sprintf(msg, "Scanning %s", fVolumeName); if (!fpImg->UpdateScanProgress(msg)) { - WMSG0(" HFS cancelled by user\n"); + LOGI(" HFS cancelled by user"); dierr = kDIErrCancelled; goto bail; } @@ -411,7 +411,7 @@ DiskFSHFS::Initialize(InitMode initMode) fHfsVol = hfs_callback_open(LibHFSCB, this, /*HFS_OPT_NOCACHE |*/ (fpImg->GetReadOnly() ? HFS_MODE_RDONLY : HFS_MODE_RDWR)); if (fHfsVol == NULL) { - WMSG1("ERROR: hfs_opencallback failed: %s\n", hfs_error); + LOGI("ERROR: hfs_opencallback failed: %s", hfs_error); return kDIErrGeneric; } @@ -453,34 +453,34 @@ DiskFSHFS::LibHFSCB(void* vThis, int op, unsigned long arg1, void* arg2) switch (op) { case HFS_CB_VOLSIZE: - //WMSG1(" HFSCB vol size = %ld blocks\n", pThis->fTotalBlocks); + //LOGI(" HFSCB vol size = %ld blocks", pThis->fTotalBlocks); result = pThis->fTotalBlocks; break; case HFS_CB_READ: // arg1=block, arg2=buffer - //WMSG1(" HFSCB read block %lu\n", arg1); + //LOGI(" HFSCB read block %lu", arg1); if (arg1 < pThis->fTotalBlocks && arg2 != NULL) { DIError err = pThis->fpImg->ReadBlock(arg1, arg2); if (err == kDIErrNone) result = 0; else { - WMSG1(" HFSCB read %lu failed\n", arg1); + LOGI(" HFSCB read %lu failed", arg1); } } break; case HFS_CB_WRITE: - WMSG1(" HFSCB write block %lu\n", arg1); + LOGI(" HFSCB write block %lu", arg1); if (arg1 < pThis->fTotalBlocks && arg2 != NULL) { DIError err = pThis->fpImg->WriteBlock(arg1, arg2); if (err == kDIErrNone) result = 0; else { - WMSG1(" HFSCB write %lu failed\n", arg1); + LOGI(" HFSCB write %lu failed", arg1); } } break; case HFS_CB_SEEK: // arg1=block, arg2=unused /* just verify that the seek is legal */ - //WMSG1(" HFSCB seek block %lu\n", arg1); + //LOGI(" HFSCB seek block %lu", arg1); if (arg1 < pThis->fTotalBlocks) result = arg1; break; @@ -488,7 +488,7 @@ DiskFSHFS::LibHFSCB(void* vThis, int op, unsigned long arg1, void* arg2) assert(false); } - //WMSG1("--- HFSCB returning %lu\n", result); + //LOGI("--- HFSCB returning %lu", result); return result; } @@ -531,11 +531,11 @@ DiskFSHFS::RecursiveDirAdd(A2File* pParent, const char* basePath, int depth) goto bail; } - //WMSG1(" HFS RecursiveDirAdd '%s'\n", basePath); + //LOGI(" HFS RecursiveDirAdd '%s'", basePath); dir = hfs_opendir(fHfsVol, basePath); if (dir == NULL) { printf(" HFS unable to open dir '%s'\n", basePath); - WMSG1(" HFS unable to open dir '%s'\n", basePath); + LOGI(" HFS unable to open dir '%s'", basePath); dierr = kDIErrGeneric; goto bail; } @@ -565,7 +565,7 @@ DiskFSHFS::RecursiveDirAdd(A2File* pParent, const char* basePath, int depth) AddFileToList(pFile); if (!fpImg->UpdateScanProgress(NULL)) { - WMSG0(" HFS cancelled by user\n"); + LOGI(" HFS cancelled by user"); dierr = kDIErrCancelled; goto bail; } @@ -702,7 +702,7 @@ DiskFSHFS::Format(DiskImg* pDiskImg, const char* volName) // need HFS_OPT_2048 for CD-ROM? if (hfs_callback_format(LibHFSCB, this, 0, volName) != 0) { - WMSG1("hfs_callback_format failed (%s)\n", hfs_error); + LOGI("hfs_callback_format failed (%s)", hfs_error); return kDIErrGeneric; } @@ -833,7 +833,7 @@ DiskFSHFS::DoNormalizePath(const char* path, char fssep, } partBuf[partIdx] = '\0'; - //WMSG2(" HFS Converted component '%s' to '%s'\n", + //LOGI(" HFS Converted component '%s' to '%s'", // origStart, partBuf); if (outPtr != outputBuf) @@ -851,7 +851,7 @@ DiskFSHFS::DoNormalizePath(const char* path, char fssep, *outPtr = '\0'; - WMSG3(" HFS Converted path '%s' to '%s' (fssep='%c')\n", + LOGI(" HFS Converted path '%s' to '%s' (fssep='%c')", path, outputBuf, fssep); assert(*outputBuf != '\0'); @@ -949,7 +949,7 @@ DiskFSHFS::MakeFileNameUnique(const char* pathName, char** pUniqueName) if (cp != NULL) { int tmpOffset = cp - fileName; if (tmpOffset > 0 && nameLen - tmpOffset <= kMaxExtensionLen) { - WMSG1(" HFS (keeping extension '%s')\n", cp); + LOGI(" HFS (keeping extension '%s')", cp); assert(strlen(cp) <= kMaxExtensionLen); strcpy(dotBuf, cp); dotOffset = tmpOffset; @@ -978,7 +978,7 @@ DiskFSHFS::MakeFileNameUnique(const char* pathName, char** pUniqueName) memcpy(fileName + copyOffset + digitLen, dotBuf, dotLen); } while (GetFileByName(uniqueName+1) != NULL); - WMSG1(" HFS converted to unique name: %s\n", uniqueName); + LOGI(" HFS converted to unique name: %s", uniqueName); *pUniqueName = uniqueName; return kDIErrNone; @@ -1018,7 +1018,7 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) pParms->storageType == A2FileProDOS::kStorageExtended || pParms->storageType == A2FileProDOS::kStorageDirectory); // kStorageVolumeDirHeader not allowed -- that's created by Format - WMSG1(" HFS ---v--- CreateFile '%s'\n", pParms->pathName); + LOGI(" HFS ---v--- CreateFile '%s'", pParms->pathName); /* * Normalize the pathname so that all components are HFS-safe @@ -1092,7 +1092,7 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) basePath[dirNameLen] = '\0'; } - WMSG2("SPLIT: '%s' '%s'\n", basePath, fileName); + LOGI("SPLIT: '%s' '%s'", basePath, fileName); assert(fileName != NULL); @@ -1100,7 +1100,7 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) * Open the base path. If it doesn't exist, create it recursively. */ if (basePath != NULL) { - WMSG2(" HFS Creating '%s' in '%s'\n", fileName, basePath); + LOGI(" HFS Creating '%s' in '%s'", fileName, basePath); /* * Open the named subdir, creating it if it doesn't exist. We need * to check basePath+1 because we're comparing against what's in our @@ -1108,7 +1108,7 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) */ pSubdir = (A2FileHFS*)GetFileByName(basePath+1, CompareMacFileNames); if (pSubdir == NULL) { - WMSG1(" HFS Creating subdir '%s'\n", basePath); + LOGI(" HFS Creating subdir '%s'", basePath); A2File* pNewSub; CreateParms newDirParms; newDirParms.pathName = basePath; @@ -1170,14 +1170,14 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) assert(basePathLen == 0); } else { /* open the volume directory */ - WMSG1(" HFS Creating '%s' in volume dir\n", fileName); + LOGI(" HFS Creating '%s' in volume dir", fileName); /* volume dir must be first in the list */ pSubdir = (A2FileHFS*) GetNextFile(NULL); assert(pSubdir != NULL); assert(pSubdir->IsVolumeDirectory()); } if (pSubdir == NULL) { - WMSG1(" HFS Unable to open subdir '%s'\n", basePath); + LOGI(" HFS Unable to open subdir '%s'", basePath); dierr = kDIErrFileNotFound; goto bail; } @@ -1195,12 +1195,12 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) if (pParms->storageType == A2FileProDOS::kStorageDirectory) { /* create the directory */ if (hfs_mkdir(fHfsVol, fullPath) != 0) { - WMSG2(" HFS mkdir '%s' failed: %s\n", fullPath, hfs_error); + LOGI(" HFS mkdir '%s' failed: %s", fullPath, hfs_error); dierr = kDIErrGeneric; goto bail; } if (hfs_stat(fHfsVol, fullPath, &dirEnt) != 0) { - WMSG1(" HFS stat on new dir failed: %s\n", hfs_error); + LOGI(" HFS stat on new dir failed: %s", hfs_error); dierr = kDIErrGeneric; goto bail; } @@ -1209,12 +1209,12 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) /* create, and open, the file */ pHfsFile = hfs_create(fHfsVol, fullPath, typeStr, creatorStr); if (pHfsFile == NULL) { - WMSG1(" HFS create failed: %s\n", hfs_error); + LOGI(" HFS create failed: %s", hfs_error); dierr = kDIErrGeneric; goto bail; } if (hfs_fstat(pHfsFile, &dirEnt) != 0) { - WMSG1(" HFS fstat on new file failed: %s\n", hfs_error); + LOGI(" HFS fstat on new file failed: %s", hfs_error); dierr = kDIErrGeneric; goto bail; } @@ -1279,7 +1279,7 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) { /* passed it; insert new after previous file */ pLastSubdirFile = pPrevFile; - WMSG2(" HFS Found '%s' > cur(%s)\n", pNextFile->GetPathName(), + LOGI(" HFS Found '%s' > cur(%s)", pNextFile->GetPathName(), pNewFile->GetPathName()); break; } @@ -1292,10 +1292,10 @@ DiskFSHFS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) } /* insert us after last file we saw that was part of the same subdir */ - WMSG2(" HFS inserting '%s' after '%s'\n", pNewFile->GetPathName(), + LOGI(" HFS inserting '%s' after '%s'", pNewFile->GetPathName(), pLastSubdirFile->GetPathName()); InsertFileInList(pNewFile, pLastSubdirFile); - //WMSG0("LIST NOW:\n"); + //LOGI("LIST NOW:"); //DumpFileList(); *ppNewFile = pNewFile; @@ -1308,7 +1308,7 @@ bail: delete[] fileName; delete[] fullPath; hfs_flush(fHfsVol); - WMSG1(" HFS ---^--- CreateFile '%s' DONE\n", pParms->pathName); + LOGI(" HFS ---^--- CreateFile '%s' DONE", pParms->pathName); return dierr; } @@ -1332,17 +1332,17 @@ DiskFSHFS::DeleteFile(A2File* pGenericFile) A2FileHFS* pFile = (A2FileHFS*) pGenericFile; pathName = pFile->GetLibHFSPathName(); - WMSG1(" Deleting '%s'\n", pathName); + LOGI(" Deleting '%s'", pathName); if (pFile->IsDirectory()) { if (hfs_rmdir(fHfsVol, pathName) != 0) { - WMSG2(" HFS rmdir failed '%s': '%s'\n", pathName, hfs_error); + LOGI(" HFS rmdir failed '%s': '%s'", pathName, hfs_error); dierr = kDIErrGeneric; goto bail; } } else { if (hfs_delete(fHfsVol, pathName) != 0) { - WMSG2(" HFS delete failed '%s': '%s'\n", pathName, hfs_error); + LOGI(" HFS delete failed '%s': '%s'", pathName, hfs_error); dierr = kDIErrGeneric; goto bail; } @@ -1410,10 +1410,10 @@ DiskFSHFS::RenameFile(A2File* pGenericFile, const char* newName) strcpy(colonNewName+len, newName); } - WMSG2(" HFS renaming '%s' to '%s'\n", colonOldName, colonNewName); + LOGI(" HFS renaming '%s' to '%s'", colonOldName, colonNewName); if (hfs_rename(fHfsVol, colonOldName, colonNewName) != 0) { - WMSG3(" HFS rename('%s','%s') failed: %s\n", + LOGI(" HFS rename('%s','%s') failed: %s", colonOldName, colonNewName, hfs_error); dierr = kDIErrGeneric; goto bail; @@ -1518,7 +1518,7 @@ DiskFSHFS::RegeneratePathName(A2FileHFS* pFile) pParent = (A2FileHFS*) pParent->GetParent(); } - WMSG2("Replacing '%s' with '%s'\n", pFile->GetPathName(), buf); + LOGI("Replacing '%s' with '%s'", pFile->GetPathName(), buf); pFile->SetPathName("", buf); delete[] buf; @@ -1557,7 +1557,7 @@ DiskFSHFS::RenameVolume(const char* newName) strcat(newNameColon, ":"); if (hfs_rename(fHfsVol, oldNameColon, newNameColon) != 0) { - WMSG3(" HFS rename '%s' -> '%s' failed: %s\n", + LOGI(" HFS rename '%s' -> '%s' failed: %s", oldNameColon, newNameColon, hfs_error); dierr = kDIErrGeneric; goto bail; @@ -1598,7 +1598,7 @@ DiskFSHFS::SetFileInfo(A2File* pGenericFile, long fileType, long auxType, colonPath = pFile->GetLibHFSPathName(); if (hfs_stat(fHfsVol, colonPath, &dirEnt) != 0) { - WMSG2(" HFS unable to stat '%s': %s\n", colonPath, hfs_error); + LOGI(" HFS unable to stat '%s': %s", colonPath, hfs_error); dierr = kDIErrGeneric; goto bail; } @@ -1616,12 +1616,12 @@ DiskFSHFS::SetFileInfo(A2File* pGenericFile, long fileType, long auxType, else dirEnt.flags &= ~HFS_ISLOCKED; - WMSG3(" HFS setting '%s' to fdflags=0x%04x flags=0x%04x\n", + LOGI(" HFS setting '%s' to fdflags=0x%04x flags=0x%04x", colonPath, dirEnt.fdflags, dirEnt.flags); - WMSG2(" type=0x%08lx creator=0x%08lx\n", fileType, auxType); + LOGI(" type=0x%08lx creator=0x%08lx", fileType, auxType); if (hfs_setattr(fHfsVol, colonPath, &dirEnt) != 0) { - WMSG2(" HFS setattr '%s' failed: %s\n", colonPath, hfs_error); + LOGI(" HFS setattr '%s' failed: %s", colonPath, hfs_error); dierr = kDIErrGeneric; goto bail; } @@ -1652,7 +1652,7 @@ bail: void A2FileHFS::Dump(void) const { - WMSG1("A2FileHFS '%s'\n", fFileName); + LOGI("A2FileHFS '%s'", fFileName); } /* convert hex to decimal */ @@ -1695,7 +1695,7 @@ long A2FileHFS::GetFileType(void) const digit1 = FromHex((char) (fType >> 24)); digit2 = FromHex((char) (fType >> 16)); if (digit1 < 0 || digit2 < 0) { - WMSG1(" Unexpected: pdos + %08lx\n", fType); + LOGI(" Unexpected: pdos + %08lx", fType); return 0x00; } return digit1 << 4 | digit2; @@ -1859,7 +1859,7 @@ A2FileHFS::Open(A2FileDescr** ppOpenFile, bool readOnly, DiskFSHFS* pDiskFS = (DiskFSHFS*) GetDiskFS(); pHfsFile = hfs_open(pDiskFS->GetHfsVol(), nameBuf); if (pHfsFile == NULL) { - WMSG2(" HFS hfs_open(%s) failed: %s\n", nameBuf, hfs_error); + LOGI(" HFS hfs_open(%s) failed: %s", nameBuf, hfs_error); dierr = kDIErrGeneric; // better value might be in errno goto bail; } @@ -1890,7 +1890,7 @@ A2FDHFS::Read(void* buf, size_t len, size_t* pActual) { long result; - WMSG3(" HFS reading %d bytes from '%s' (offset=%ld)\n", + LOGI(" HFS reading %d bytes from '%s' (offset=%ld)", len, fpFile->GetPathName(), hfs_seek(fHfsFile, 0, HFS_SEEK_CUR)); //A2FileHFS* pFile = (A2FileHFS*) fpFile; @@ -1932,7 +1932,7 @@ A2FDHFS::Write(const void* buf, size_t len, size_t* pActual) { long result; - WMSG3(" HFS writing %d bytes to '%s' (offset=%ld)\n", + LOGI(" HFS writing %d bytes to '%s' (offset=%ld)", len, fpFile->GetPathName(), hfs_seek(fHfsFile, 0, HFS_SEEK_CUR)); fModified = true; // assume something gets changed @@ -2021,10 +2021,10 @@ A2FDHFS::Close(void) pFile->fRsrcLength = dirEnt.u.file.rsize; if (pFile->fRsrcLength == 0) pFile->fRsrcLength = -1; - WMSG2(" HFS close set dataLen=%ld rsrcLen=%ld\n", + LOGI(" HFS close set dataLen=%ld rsrcLen=%ld", (long) pFile->fDataLength, (long) pFile->fRsrcLength); } else { - WMSG1(" HFS Close fstat failed: %s\n", hfs_error); + LOGI(" HFS Close fstat failed: %s", hfs_error); // close it anyway } } @@ -2037,7 +2037,7 @@ A2FDHFS::Close(void) DiskFSHFS* pDiskFS = (DiskFSHFS*) fpFile->GetDiskFS(); if (hfs_flush(pDiskFS->GetHfsVol()) != 0) { - WMSG0("HEY: Close flush failed!\n"); + LOGI("HEY: Close flush failed!"); DebugBreak(); } } @@ -2147,7 +2147,7 @@ DiskFSHFS::CreateFakeFile(void) (time_t) (fModifiedDateTime - kDateTimeOffset - fLocalTimeOffset); timeStr = ctime(&when); if (timeStr == NULL) { - WMSG2("Invalid date %ld (orig=%ld)\n", when, fModifiedDateTime); + LOGI("Invalid date %ld (orig=%ld)", when, fModifiedDateTime); strcpy(dateBuf, ""); } else strncpy(dateBuf, timeStr, sizeof(dateBuf)); @@ -2227,7 +2227,7 @@ A2FileHFS::Open(A2FileDescr** ppOpenFile, bool readOnly, DIError A2FDHFS::Read(void* buf, size_t len, size_t* pActual) { - WMSG3(" HFS reading %d bytes from '%s' (offset=%ld)\n", + LOGI(" HFS reading %d bytes from '%s' (offset=%ld)", len, fpFile->GetPathName(), (long) fOffset); A2FileHFS* pFile = (A2FileHFS*) fpFile; diff --git a/diskimg/ImageWrapper.cpp b/diskimg/ImageWrapper.cpp index 0e35b29..5ef0336 100644 --- a/diskimg/ImageWrapper.cpp +++ b/diskimg/ImageWrapper.cpp @@ -47,7 +47,7 @@ Wrapper2MG::Test(GenericFD* pGFD, di_off_t wrappedLength) { TwoImgHeader header; - WMSG0("Testing for 2MG\n"); + LOGI("Testing for 2MG"); // HEY: should test for wrappedLength > 2GB; if so, skip @@ -55,7 +55,7 @@ Wrapper2MG::Test(GenericFD* pGFD, di_off_t wrappedLength) if (header.ReadHeader(pGFD, (long) wrappedLength) != 0) return kDIErrGeneric; - WMSG0("Looks like valid 2MG\n"); + LOGI("Looks like valid 2MG"); return kDIErrNone; } @@ -71,7 +71,7 @@ Wrapper2MG::Prep(GenericFD* pGFD, di_off_t wrappedLength, bool readOnly, TwoImgHeader header; long offset; - WMSG0("Prepping for 2MG\n"); + LOGI("Prepping for 2MG"); pGFD->Rewind(); if (header.ReadHeader(pGFD, (long) wrappedLength) != 0) return kDIErrGeneric; @@ -90,13 +90,13 @@ Wrapper2MG::Prep(GenericFD* pGFD, di_off_t wrappedLength, bool readOnly, else if (header.fImageFormat == TwoImgHeader::kImageFormatNibble) { *pOrder = DiskImg::kSectorOrderPhysical; if (*pLength == kTrackCount525 * kTrackLenNib525) { - WMSG0(" Prepping for 6656-byte 2MG-NIB\n"); + LOGI(" Prepping for 6656-byte 2MG-NIB"); *pPhysical = DiskImg::kPhysicalFormatNib525_6656; } else if (*pLength == kTrackCount525 * kTrackLenNb2525) { - WMSG0(" Prepping for 6384-byte 2MG-NB2\n"); + LOGI(" Prepping for 6384-byte 2MG-NB2"); *pPhysical = DiskImg::kPhysicalFormatNib525_6384; } else { - WMSG1(" NIB 2MG with length=%ld rejected\n", (long) *pLength); + LOGI(" NIB 2MG with length=%ld rejected", (long) *pLength); return kDIErrOddLength; } } @@ -119,7 +119,7 @@ Wrapper2MG::Create(di_off_t length, DiskImg::PhysicalFormat physical, switch (physical) { case DiskImg::kPhysicalFormatNib525_6656: if (length != kTrackLenNib525 * kTrackCount525) { - WMSG1("Invalid 2MG nibble length %ld\n", (long) length); + LOGI("Invalid 2MG nibble length %ld", (long) length); return kDIErrInvalidArg; } header.InitHeader(TwoImgHeader::kImageFormatNibble, (long) length, @@ -127,7 +127,7 @@ Wrapper2MG::Create(di_off_t length, DiskImg::PhysicalFormat physical, break; case DiskImg::kPhysicalFormatSectors: if ((length % 512) != 0) { - WMSG1("Invalid 2MG length %ld\n", (long) length); + LOGI("Invalid 2MG length %ld", (long) length); return kDIErrInvalidArg; } if (order == DiskImg::kSectorOrderProDOS) @@ -137,16 +137,16 @@ Wrapper2MG::Create(di_off_t length, DiskImg::PhysicalFormat physical, cc = header.InitHeader(TwoImgHeader::kImageFormatDOS, (long) length, (long) length / 512); else { - WMSG1("Invalid 2MG sector order %d\n", order); + LOGI("Invalid 2MG sector order %d", order); return kDIErrInvalidArg; } if (cc != 0) { - WMSG1("TwoImg InitHeader failed (len=%ld)\n", (long) length); + LOGI("TwoImg InitHeader failed (len=%ld)", (long) length); return kDIErrInvalidArg; } break; default: - WMSG1("Invalid 2MG physical %d\n", physical); + LOGI("Invalid 2MG physical %d", physical); return kDIErrInvalidArg; } @@ -155,7 +155,7 @@ Wrapper2MG::Create(di_off_t length, DiskImg::PhysicalFormat physical, cc = header.WriteHeader(pWrapperGFD); if (cc != 0) { - WMSG1("ERROR: 2MG header write failed (cc=%d)\n", cc); + LOGI("ERROR: 2MG header write failed (cc=%d)", cc); return kDIErrGeneric; } @@ -241,7 +241,7 @@ WrapperNuFX::OpenNuFX(const char* pathName, NuArchive** ppArchive, const NuThread* pThread = NULL; int idx; - WMSG1("Opening file '%s' to test for NuFX\n", pathName); + LOGI("Opening file '%s' to test for NuFX", pathName); /* * Open the archive. @@ -249,7 +249,7 @@ WrapperNuFX::OpenNuFX(const char* pathName, NuArchive** ppArchive, if (readOnly) { nerr = NuOpenRO(pathName, &pArchive); if (nerr != kNuErrNone) { - WMSG1(" NuFX unable to open archive (err=%d)\n", nerr); + LOGI(" NuFX unable to open archive (err=%d)", nerr); goto bail; } } else { @@ -263,7 +263,7 @@ WrapperNuFX::OpenNuFX(const char* pathName, NuArchive** ppArchive, nerr = NuOpenRW(pathName, tmpPath, 0, &pArchive); if (nerr != kNuErrNone) { - WMSG1(" NuFX OpenRW failed (nerr=%d)\n", nerr); + LOGI(" NuFX OpenRW failed (nerr=%d)", nerr); nerr = kNuErrGeneric; delete[] tmpPath; goto bail; @@ -275,11 +275,11 @@ WrapperNuFX::OpenNuFX(const char* pathName, NuArchive** ppArchive, nerr = NuGetAttr(pArchive, kNuAttrNumRecords, &attr); if (nerr != kNuErrNone) { - WMSG1(" NuFX unable to get record count (err=%d)\n", nerr); + LOGI(" NuFX unable to get record count (err=%d)", nerr); goto bail; } if (attr != 1) { - WMSG1(" NuFX archive has %ld entries, not disk-only\n", attr); + LOGI(" NuFX archive has %ld entries, not disk-only", attr); nerr = kNuErrGeneric; if (attr > 1) goto file_archive; @@ -290,12 +290,12 @@ WrapperNuFX::OpenNuFX(const char* pathName, NuArchive** ppArchive, /* get the first record */ nerr = NuGetRecordIdxByPosition(pArchive, 0, &recordIdx); if (nerr != kNuErrNone) { - WMSG1(" NuFX unable to get first recordIdx (err=%d)\n", nerr); + LOGI(" NuFX unable to get first recordIdx (err=%d)", nerr); goto bail; } nerr = NuGetRecord(pArchive, recordIdx, &pRecord); if (nerr != kNuErrNone) { - WMSG1(" NuFX unable to get first record (err=%d)\n", nerr); + LOGI(" NuFX unable to get first record (err=%d)", nerr); goto bail; } @@ -307,7 +307,7 @@ WrapperNuFX::OpenNuFX(const char* pathName, NuArchive** ppArchive, break; } if (idx == (int)NuRecordGetNumThreads(pRecord)) { - WMSG0(" NuFX no disk image found in first record\n"); + LOGI(" NuFX no disk image found in first record"); nerr = kNuErrGeneric; goto file_archive; } @@ -319,7 +319,7 @@ WrapperNuFX::OpenNuFX(const char* pathName, NuArchive** ppArchive, */ *pLength = pThread->actualThreadEOF; if (!*pLength) { - WMSG1(" NuFX length of disk image is bad (%ld)\n", *pLength); + LOGI(" NuFX length of disk image is bad (%ld)", *pLength); nerr = kNuErrGeneric; goto bail; } @@ -381,13 +381,13 @@ WrapperNuFX::GetNuFXDiskImage(NuArchive* pArchive, NuThreadIdx threadIdx, err = NuCreateDataSinkForBuffer(true, kNuConvertOff, buf, length, &pDataSink); if (err != kNuErrNone) { - WMSG1(" NuFX: unable to create data sink (err=%d)\n", err); + LOGI(" NuFX: unable to create data sink (err=%d)", err); goto bail; } err = NuExtractThread(pArchive, threadIdx, pDataSink); if (err != kNuErrNone) { - WMSG1(" NuFX: unable to extract thread (err=%d)\n", err); + LOGI(" NuFX: unable to extract thread (err=%d)", err); goto bail; } @@ -398,7 +398,7 @@ WrapperNuFX::GetNuFXDiskImage(NuArchive* pArchive, NuThreadIdx threadIdx, bail: NuFreeDataSink(pDataSink); if (err != kNuErrNone) { - WMSG1(" NuFX GetNuFXDiskImage returning after nuerr=%d\n", err); + LOGI(" NuFX GetNuFXDiskImage returning after nuerr=%d", err); delete buf; } if (err == kNuErrNone) @@ -428,10 +428,10 @@ WrapperNuFX::Test(GenericFD* pGFD, di_off_t wrappedLength) imagePath = pGFD->GetPathName(); if (imagePath == NULL) { - WMSG0("Can't test NuFX on non-file\n"); + LOGI("Can't test NuFX on non-file"); return kDIErrNotSupported; } - WMSG0("Testing for NuFX\n"); + LOGI("Testing for NuFX"); dierr = OpenNuFX(imagePath, &pArchive, &threadIdx, &length, true); if (dierr != kDIErrNone) return dierr; @@ -488,7 +488,7 @@ WrapperNuFX::Prep(GenericFD* pGFD, di_off_t wrappedLength, bool readOnly, *pPhysical = DiskImg::kPhysicalFormatSectors; *pOrder = DiskImg::kSectorOrderProDOS; - WMSG1(" NuFX is ready, threadIdx=%ld\n", threadIdx); + LOGI(" NuFX is ready, threadIdx=%ld", threadIdx); fThreadIdx = threadIdx; bail: @@ -539,7 +539,7 @@ WrapperNuFX::GenTempPath(const char* path) strcpy(cp, kTmpTemplate); - WMSG2(" NuFX GenTempPath '%s' -> '%s'\n", path, tmpPath); + LOGI(" NuFX GenTempPath '%s' -> '%s'", path, tmpPath); return tmpPath; } @@ -585,7 +585,7 @@ WrapperNuFX::Create(di_off_t length, DiskImg::PhysicalFormat physical, nerr = NuOpenRW(imagePath, tmpPath, kNuOpenCreat, &pArchive); if (nerr != kNuErrNone) { - WMSG1(" NuFX OpenRW failed (nerr=%d)\n", nerr); + LOGI(" NuFX OpenRW failed (nerr=%d)", nerr); dierr = kDIErrGeneric; goto bail; } @@ -635,7 +635,7 @@ WrapperNuFX::CloseNuFX(void) nerr = NuClose(fpArchive); if (nerr != kNuErrNone) { - WMSG0("WARNING: NuClose failed\n"); + LOGI("WARNING: NuClose failed"); return kDIErrGeneric; } return kDIErrNone; @@ -666,12 +666,12 @@ WrapperNuFX::Flush(GenericFD* pWrapperGFD, GenericFD* pDataGFD, */ nerr = NuGetRecordIdxByPosition(fpArchive, 0, &recordIdx); if (nerr != kNuErrNone) { - WMSG1(" NuFX unable to get first recordIdx (err=%d)\n", nerr); + LOGI(" NuFX unable to get first recordIdx (err=%d)", nerr); goto bail; } nerr = NuDeleteRecord(fpArchive, recordIdx); if (nerr != kNuErrNone) { - WMSG1(" NuFX unable to delete first record (err=%d)\n", nerr); + LOGI(" NuFX unable to delete first record (err=%d)", nerr); goto bail; } } @@ -681,11 +681,11 @@ WrapperNuFX::Flush(GenericFD* pWrapperGFD, GenericFD* pDataGFD, nerr = NuSetValue(fpArchive, kNuValueDataCompression, fCompressType + kNuCompressNone); if (nerr != kNuErrNone) { - WMSG1("WARNING: unable to set compression to format %d\n", + LOGI("WARNING: unable to set compression to format %d", fCompressType); nerr = kNuErrNone; } else { - WMSG2(" NuFX set compression to %d/%d\n", fCompressType, + LOGI(" NuFX set compression to %d/%d", fCompressType, fCompressType + kNuCompressNone); } @@ -715,7 +715,7 @@ WrapperNuFX::Flush(GenericFD* pWrapperGFD, GenericFD* pDataGFD, */ nerr = NuAddRecord(fpArchive, &fileDetails, &recordIdx); if (nerr != kNuErrNone) { - WMSG1(" NuFX AddRecord failed (nerr=%d)\n", nerr); + LOGI(" NuFX AddRecord failed (nerr=%d)", nerr); goto bail; } @@ -730,7 +730,7 @@ WrapperNuFX::Flush(GenericFD* pWrapperGFD, GenericFD* pDataGFD, (const unsigned char*) ((GFDBuffer*) pDataGFD)->GetBuffer(), 0, (long) dataLen, NULL, &pDataSource); if (nerr != kNuErrNone) { - WMSG1(" NuFX unable to create NufxLib data source (nerr=%d)", nerr); + LOGI(" NuFX unable to create NufxLib data source (nerr=%d)", nerr); goto bail; } @@ -740,11 +740,11 @@ WrapperNuFX::Flush(GenericFD* pWrapperGFD, GenericFD* pDataGFD, nerr = NuAddThread(fpArchive, recordIdx, kNuThreadIDDiskImage, pDataSource, &threadIdx); if (nerr != kNuErrNone) { - WMSG1(" NuFX AddThread failed (nerr=%d)\n", nerr); + LOGI(" NuFX AddThread failed (nerr=%d)", nerr); goto bail; } pDataSource = NULL; // now owned by NufxLib - WMSG2(" NuFX added thread %ld in record %ld, flushing changes\n", + LOGI(" NuFX added thread %ld in record %ld, flushing changes", threadIdx, recordIdx); /* @@ -753,7 +753,7 @@ WrapperNuFX::Flush(GenericFD* pWrapperGFD, GenericFD* pDataGFD, long status; nerr = NuFlush(fpArchive, &status); if (nerr != kNuErrNone) { - WMSG2(" NuFX flush failed (nerr=%d, status=%ld)\n", nerr, status); + LOGI(" NuFX flush failed (nerr=%d, status=%ld)", nerr, status); goto bail; } @@ -807,7 +807,7 @@ WrapperDDD::Test(GenericFD* pGFD, di_off_t wrappedLength) { DIError dierr; GenericFD* pNewGFD = NULL; - WMSG0("Testing for DDD\n"); + LOGI("Testing for DDD"); pGFD->Rewind(); @@ -874,9 +874,9 @@ WrapperDDD::CheckForRuns(GenericFD* pGFD) dierr = pGFD->Read(buf, bufCount); if (dierr != kDIErrNone) goto bail; - //WMSG1(" DDD READ %d bytes\n", bufCount); + //LOGI(" DDD READ %d bytes", bufCount); if (dierr != kDIErrNone) { - WMSG1(" DDD CheckForRuns read failed (err=%d)\n", dierr); + LOGI(" DDD CheckForRuns read failed (err=%d)", dierr); return dierr; } @@ -885,7 +885,7 @@ WrapperDDD::CheckForRuns(GenericFD* pGFD) if (buf[i] == 0 && buf[i] == buf[i-1]) { runLen++; if (runLen == kRunThreshold && buf[i] != 0xff) { - WMSG2(" DDD found run of >= %d of 0x%02x, bailing\n", + LOGI(" DDD found run of >= %d of 0x%02x, bailing", runLen+1, buf[i]); return kDIErrGeneric; } @@ -895,7 +895,7 @@ WrapperDDD::CheckForRuns(GenericFD* pGFD) } } - WMSG0(" DDD CheckForRuns scan complete, no long runs found\n"); + LOGI(" DDD CheckForRuns scan complete, no long runs found"); bail: return dierr; @@ -911,7 +911,7 @@ WrapperDDD::Prep(GenericFD* pGFD, di_off_t wrappedLength, bool readOnly, LinearBitmap** ppBadBlockMap, GenericFD** ppNewGFD) { DIError dierr; - WMSG0("Prepping for DDD\n"); + LOGI("Prepping for DDD"); assert(*ppNewGFD == NULL); @@ -1036,7 +1036,7 @@ WrapperDDD::Flush(GenericFD* pWrapperGFD, GenericFD* pDataGFD, return dierr; *pWrappedLen = pWrapperGFD->Tell(); - WMSG2(" DDD compressed from %d to %ld\n", + LOGI(" DDD compressed from %d to %ld", kNumTracks * kTrackLen, (long) *pWrappedLen); return kDIErrNone; @@ -1079,16 +1079,16 @@ typedef struct DiskImgLib::DC42Header { /*static*/ void WrapperDiskCopy42::DumpHeader(const DC42Header* pHeader) { - WMSG0("--- header contents:\n"); - WMSG1("\tdiskName = '%s'\n", pHeader->diskName); - WMSG2("\tdataSize = %ld (%ldK)\n", pHeader->dataSize, + LOGI("--- header contents:"); + LOGI("\tdiskName = '%s'", pHeader->diskName); + LOGI("\tdataSize = %ld (%ldK)", pHeader->dataSize, pHeader->dataSize / 1024); - WMSG1("\ttagSize = %ld\n", pHeader->tagSize); - WMSG1("\tdataChecksum = 0x%08lx\n", pHeader->dataChecksum); - WMSG1("\ttagChecksum = 0x%08lx\n", pHeader->tagChecksum); - WMSG1("\tdiskFormat = %d\n", pHeader->diskFormat); - WMSG1("\tformatByte = 0x%02x\n", pHeader->formatByte); - WMSG1("\tprivateWord = 0x%04x\n", pHeader->privateWord); + LOGI("\ttagSize = %ld", pHeader->tagSize); + LOGI("\tdataChecksum = 0x%08lx", pHeader->dataChecksum); + LOGI("\ttagChecksum = 0x%08lx", pHeader->tagChecksum); + LOGI("\tdiskFormat = %d", pHeader->diskFormat); + LOGI("\tformatByte = 0x%02x", pHeader->formatByte); + LOGI("\tprivateWord = 0x%04x", pHeader->privateWord); } /* @@ -1195,7 +1195,7 @@ WrapperDiskCopy42::Test(GenericFD* pGFD, di_off_t wrappedLength) { DC42Header header; - WMSG0("Testing for DiskCopy\n"); + LOGI("Testing for DiskCopy"); if (wrappedLength < 800 * 1024 + kDC42DataOffset) return kDIErrGeneric; @@ -1232,7 +1232,7 @@ WrapperDiskCopy42::ComputeChecksum(GenericFD* pGFD, dierr = pGFD->Read(buf, sizeof(buf)); if (dierr != kDIErrNone) { - WMSG2(" DC42 read failed, dataRem=%ld (err=%d)\n", dataRem, dierr); + LOGI(" DC42 read failed, dataRem=%ld (err=%d)", dataRem, dierr); return dierr; } @@ -1266,7 +1266,7 @@ WrapperDiskCopy42::Prep(GenericFD* pGFD, di_off_t wrappedLength, bool readOnly, DIError dierr; DC42Header header; - WMSG0("Prepping for DiskCopy 4.2\n"); + LOGI("Prepping for DiskCopy 4.2"); pGFD->Rewind(); if (ReadHeader(pGFD, &header) != 0) return kDIErrGeneric; @@ -1280,12 +1280,12 @@ WrapperDiskCopy42::Prep(GenericFD* pGFD, di_off_t wrappedLength, bool readOnly, return dierr; if (checksum != header.dataChecksum) { - WMSG2(" DC42 checksum mismatch (got 0x%08lx, expected 0x%08lx)\n", + LOGI(" DC42 checksum mismatch (got 0x%08lx, expected 0x%08lx)", checksum, header.dataChecksum); fBadChecksum = true; //return kDIErrBadChecksum; } else { - WMSG0(" DC42 checksum matches!\n"); + LOGI(" DC42 checksum matches!"); } @@ -1318,7 +1318,7 @@ WrapperDiskCopy42::Create(di_off_t length, DiskImg::PhysicalFormat physical, dierr = WriteHeader(pWrapperGFD, &header); if (dierr != kDIErrNone) { - WMSG1("ERROR: 2MG header write failed (err=%d)\n", dierr); + LOGI("ERROR: 2MG header write failed (err=%d)", dierr); return dierr; } @@ -1345,7 +1345,7 @@ WrapperDiskCopy42::Flush(GenericFD* pWrapperGFD, GenericFD* pDataGFD, dierr = ComputeChecksum(pWrapperGFD, &checksum); if (dierr != kDIErrNone) { - WMSG1(" DC42 failed while computing checksum (err=%d)\n", dierr); + LOGI(" DC42 failed while computing checksum (err=%d)", dierr); goto bail; } @@ -1416,7 +1416,7 @@ WrapperSim2eHDV::Test(GenericFD* pGFD, di_off_t wrappedLength) { char buf[kSim2eHeaderLen]; - WMSG0("Testing for Sim2e HDV\n"); + LOGI("Testing for Sim2e HDV"); if (wrappedLength < 512 || ((wrappedLength - kSim2eHeaderLen) % 4096) != 0) @@ -1467,7 +1467,7 @@ WrapperSim2eHDV::Create(di_off_t length, DiskImg::PhysicalFormat physical, assert(order == DiskImg::kSectorOrderProDOS); if (blocks < 4 || blocks > 65536) { - WMSG1(" Sim2e invalid blocks %ld\n", blocks); + LOGI(" Sim2e invalid blocks %ld", blocks); return kDIErrInvalidArg; } if (blocks == 65536) // 32MB volumes are actually 31.9 @@ -1478,7 +1478,7 @@ WrapperSim2eHDV::Create(di_off_t length, DiskImg::PhysicalFormat physical, header[14] = (unsigned char) ((blocks & 0xff00) >> 8); DIError dierr = pWrapperGFD->Write(header, kSim2eHeaderLen); if (dierr != kDIErrNone) { - WMSG1(" Sim2eHDV header write failed (err=%d)\n", dierr); + LOGI(" Sim2eHDV header write failed (err=%d)", dierr); return dierr; } @@ -1557,7 +1557,7 @@ WrapperSim2eHDV::Flush(GenericFD* pWrapperGFD, GenericFD* pDataGFD, WrapperTrackStar::Test(GenericFD* pGFD, di_off_t wrappedLength) { DIError dierr = kDIErrNone; - WMSG0("Testing for TrackStar\n"); + LOGI("Testing for TrackStar"); int numTracks; /* check the length */ @@ -1568,7 +1568,7 @@ WrapperTrackStar::Test(GenericFD* pGFD, di_off_t wrappedLength) else return kDIErrGeneric; - WMSG1(" Checking for %d-track image\n", numTracks); + LOGI(" Checking for %d-track image", numTracks); /* verify each track */ unsigned char trackBuf[kFileTrackStorageLen]; @@ -1581,7 +1581,7 @@ WrapperTrackStar::Test(GenericFD* pGFD, di_off_t wrappedLength) if (dierr != kDIErrNone) goto bail; } - WMSG0(" TrackStar tracks verified\n"); + LOGI(" TrackStar tracks verified"); bail: return dierr; @@ -1596,13 +1596,13 @@ WrapperTrackStar::VerifyTrack(int track, const unsigned char* trackBuf) unsigned int dataLen; if (trackBuf[0x80] != 0) { - WMSG1(" TrackStar track=%d found nonzero at 129\n", track); + LOGI(" TrackStar track=%d found nonzero at 129", track); return kDIErrGeneric; } dataLen = GetShortLE(trackBuf + 0x19fe); if (dataLen > kMaxTrackLen) { - WMSG3(" TrackStar track=%d len=%d exceeds max (%d)\n", + LOGI(" TrackStar track=%d len=%d exceeds max (%d)", track, dataLen, kMaxTrackLen); return kDIErrGeneric; } @@ -1612,14 +1612,14 @@ WrapperTrackStar::VerifyTrack(int track, const unsigned char* trackBuf) unsigned int i; for (i = 0; i < dataLen; i++) { if ((trackBuf[0x81 + i] & 0x80) == 0) { - WMSG3(" TrackStar track=%d found invalid data 0x%02x at %d\n", + LOGI(" TrackStar track=%d found invalid data 0x%02x at %d", track, trackBuf[0x81+i], i); return kDIErrGeneric; } } if (track == 0) { - WMSG1(" TrackStar msg='%s'\n", trackBuf); + LOGI(" TrackStar msg='%s'", trackBuf); } return kDIErrNone; @@ -1634,7 +1634,7 @@ WrapperTrackStar::Prep(GenericFD* pGFD, di_off_t wrappedLength, bool readOnly, DiskImg::SectorOrder* pOrder, short* pDiskVolNum, LinearBitmap** ppBadBlockMap, GenericFD** ppNewGFD) { - WMSG0("Prepping for TrackStar\n"); + LOGI("Prepping for TrackStar"); DIError dierr = kDIErrNone; if (wrappedLength == kFileTrackStorageLen * 40) @@ -1851,7 +1851,7 @@ WrapperTrackStar::Flush(GenericFD* pWrapperGFD, GenericFD* pDataGFD, trackLen = fNibbleTrackInfo.length[track]; assert(fNibbleTrackInfo.offset[track] == kTrackLenTrackStar525 * track); } else { - WMSG1(" TrackStar faking track %d\n", track); + LOGI(" TrackStar faking track %d", track); memset(dataBuf, 0xff, sizeof(dataBuf)); trackLen = kMaxTrackLen; } @@ -1904,7 +1904,7 @@ WrapperTrackStar::SetNibbleTrackLength(int track, int length) assert(length > 0 && length <= kMaxTrackLen); assert(track < fNibbleTrackInfo.numTracks); - WMSG2(" TrackStar: set length of track %d to %d\n", track, length); + LOGI(" TrackStar: set length of track %d to %d", track, length); fNibbleTrackInfo.length[track] = length; } @@ -1937,7 +1937,7 @@ WrapperFDI::Test(GenericFD* pGFD, di_off_t wrappedLength) unsigned char headerBuf[kMinHeaderLen]; FDIHeader hdr; - WMSG0("Testing for FDI\n"); + LOGI("Testing for FDI"); pGFD->Rewind(); dierr = pGFD->Read(headerBuf, sizeof(headerBuf)); @@ -1946,11 +1946,11 @@ WrapperFDI::Test(GenericFD* pGFD, di_off_t wrappedLength) UnpackHeader(headerBuf, &hdr); if (strcmp(hdr.signature, kFDIMagic) != 0) { - WMSG0("FDI: FDI signature not found\n"); + LOGI("FDI: FDI signature not found"); return kDIErrGeneric; } if (hdr.version < kMinVersion) { - WMSG1("FDI: bad version 0x%.04x\n", hdr.version); + LOGI("FDI: bad version 0x%.04x", hdr.version); return kDIErrGeneric; } @@ -1995,25 +1995,25 @@ WrapperFDI::DumpHeader(const FDIHeader* pHdr) "48", "67", "96", "100", "135", "192" }; - WMSG0(" FDI header contents:\n"); - WMSG1(" signature: '%s'\n", pHdr->signature); - WMSG1(" creator : '%s'\n", pHdr->creator); - WMSG1(" comment : '%s'\n", pHdr->comment); - WMSG2(" version : %d.%d\n", pHdr->version >> 8, pHdr->version & 0xff); - WMSG1(" lastTrack: %d\n", pHdr->lastTrack); - WMSG1(" lastHead : %d\n", pHdr->lastHead); - WMSG2(" type : %d (%s)\n", pHdr->type, + LOGI(" FDI header contents:"); + LOGI(" signature: '%s'", pHdr->signature); + LOGI(" creator : '%s'", pHdr->creator); + LOGI(" comment : '%s'", pHdr->comment); + LOGI(" version : %d.%d", pHdr->version >> 8, pHdr->version & 0xff); + LOGI(" lastTrack: %d", pHdr->lastTrack); + LOGI(" lastHead : %d", pHdr->lastHead); + LOGI(" type : %d (%s)", pHdr->type, (/*pHdr->type >= 0 &&*/ pHdr->type < NELEM(kTypes)) ? kTypes[pHdr->type] : "???"); - WMSG1(" rotSpeed : %drpm\n", pHdr->rotSpeed + 128); - WMSG1(" flags : 0x%02x\n", pHdr->flags); - WMSG2(" tpi : %d (%s)\n", pHdr->tpi, + LOGI(" rotSpeed : %drpm", pHdr->rotSpeed + 128); + LOGI(" flags : 0x%02x", pHdr->flags); + LOGI(" tpi : %d (%s)", pHdr->tpi, (/*pHdr->tpi >= 0 &&*/ pHdr->tpi < NELEM(kTPI)) ? kTPI[pHdr->tpi] : "???"); - WMSG2(" headWidth: %d (%s)\n", pHdr->headWidth, + LOGI(" headWidth: %d (%s)", pHdr->headWidth, (/*pHdr->headWidth >= 0 &&*/ pHdr->headWidth < NELEM(kTPI)) ? kTPI[pHdr->headWidth] : "???"); - WMSG1(" reserved : %d\n", pHdr->reserved); + LOGI(" reserved : %d", pHdr->reserved); } /* @@ -2025,7 +2025,7 @@ WrapperFDI::Prep(GenericFD* pGFD, di_off_t wrappedLength, bool readOnly, DiskImg::SectorOrder* pOrder, short* pDiskVolNum, LinearBitmap** ppBadBlockMap, GenericFD** ppNewGFD) { - WMSG0("Prepping for FDI\n"); + LOGI("Prepping for FDI"); DIError dierr = kDIErrNone; FDIHeader hdr; @@ -2049,15 +2049,15 @@ WrapperFDI::Prep(GenericFD* pGFD, di_off_t wrappedLength, bool readOnly, * have 80 double-sided tracks. */ if (hdr.type == kDiskType525) { - WMSG0("FDI: decoding 5.25\" disk\n"); + LOGI("FDI: decoding 5.25\" disk"); if (hdr.lastHead != 0 || hdr.lastTrack >= kMaxNibbleTracks525 + 10) { - WMSG2("FDI: bad params head=%d ltrack=%d\n", + LOGI("FDI: bad params head=%d ltrack=%d", hdr.lastHead, hdr.lastTrack); dierr = kDIErrUnsupportedImageFeature; goto bail; } if (hdr.lastTrack >= kMaxNibbleTracks525) { - WMSG2("FDI: reducing hdr.lastTrack from %d to %d\n", + LOGI("FDI: reducing hdr.lastTrack from %d to %d", hdr.lastTrack, kMaxNibbleTracks525-1); hdr.lastTrack = kMaxNibbleTracks525-1; } @@ -2075,15 +2075,15 @@ WrapperFDI::Prep(GenericFD* pGFD, di_off_t wrappedLength, bool readOnly, *pPhysical = DiskImg::kPhysicalFormatNib525_Var; *pOrder = DiskImg::kSectorOrderPhysical; } else if (hdr.type == kDiskType35) { - WMSG0("FDI: decoding 3.5\" disk\n"); + LOGI("FDI: decoding 3.5\" disk"); if (hdr.lastHead != 1 || hdr.lastTrack >= kMaxNibbleTracks35 + 10) { - WMSG2("FDI: bad params head=%d ltrack=%d\n", + LOGI("FDI: bad params head=%d ltrack=%d", hdr.lastHead, hdr.lastTrack); dierr = kDIErrUnsupportedImageFeature; goto bail; } if (hdr.lastTrack >= kMaxNibbleTracks35) { - WMSG2("FDI: reducing hdr.lastTrack from %d to %d\n", + LOGI("FDI: reducing hdr.lastTrack from %d to %d", hdr.lastTrack, kMaxNibbleTracks35-1); hdr.lastTrack = kMaxNibbleTracks35-1; } @@ -2101,7 +2101,7 @@ WrapperFDI::Prep(GenericFD* pGFD, di_off_t wrappedLength, bool readOnly, *pPhysical = DiskImg::kPhysicalFormatSectors; *pOrder = DiskImg::kSectorOrderProDOS; } else { - WMSG0("FDI: unsupported disk type\n"); + LOGI("FDI: unsupported disk type"); dierr = kDIErrUnsupportedImageFeature; goto bail; } @@ -2296,7 +2296,7 @@ WrapperFDI::Flush(GenericFD* pWrapperGFD, GenericFD* pDataGFD, trackLen = fNibbleTrackInfo.length[track]; assert(fNibbleTrackInfo.offset[track] == kTrackLenTrackStar525 * track); } else { - WMSG1(" TrackStar faking track %d\n", track); + LOGI(" TrackStar faking track %d", track); memset(dataBuf, 0xff, sizeof(dataBuf)); trackLen = kMaxTrackLen; } @@ -2346,7 +2346,7 @@ WrapperFDI::SetNibbleTrackLength(int track, int length) assert(length > 0 && length <= kMaxTrackLen); assert(track < fNibbleTrackInfo.numTracks); - WMSG2(" FDI: set length of track %d to %d\n", track, length); + LOGI(" FDI: set length of track %d to %d", track, length); fNibbleTrackInfo.length[track] = length; #endif } @@ -2364,7 +2364,7 @@ WrapperFDI::SetNibbleTrackLength(int track, int length) /*static*/ DIError WrapperUnadornedNibble::Test(GenericFD* pGFD, di_off_t wrappedLength) { - WMSG0("Testing for unadorned nibble\n"); + LOGI("Testing for unadorned nibble"); /* test length */ if (wrappedLength != kTrackCount525 * kTrackLenNib525 && @@ -2389,11 +2389,11 @@ WrapperUnadornedNibble::Test(GenericFD* pGFD, di_off_t wrappedLength) */ for (int i = 0; i < kScanSize; i++) { if (buf[i] < 0x80) { - WMSG2(" Disqualifying len=%ld from nibble, byte=0x%02x\n", + LOGI(" Disqualifying len=%ld from nibble, byte=0x%02x", (long) wrappedLength, buf[i]); return kDIErrGeneric; } else if (buf[i] < 0x96) { - WMSG1(" Warning: funky byte 0x%02x in file\n", buf[i]); + LOGI(" Warning: funky byte 0x%02x in file", buf[i]); } } @@ -2409,16 +2409,16 @@ WrapperUnadornedNibble::Prep(GenericFD* pGFD, di_off_t wrappedLength, bool readO DiskImg::SectorOrder* pOrder, short* pDiskVolNum, LinearBitmap** ppBadBlockMap, GenericFD** ppNewGFD) { - WMSG0("Prep for unadorned nibble\n"); + LOGI("Prep for unadorned nibble"); if (wrappedLength == kTrackCount525 * kTrackLenNib525) { - WMSG0(" Prepping for 6656-byte NIB\n"); + LOGI(" Prepping for 6656-byte NIB"); *pPhysical = DiskImg::kPhysicalFormatNib525_6656; } else if (wrappedLength == kTrackCount525 * kTrackLenNb2525) { - WMSG0(" Prepping for 6384-byte NB2\n"); + LOGI(" Prepping for 6384-byte NB2"); *pPhysical = DiskImg::kPhysicalFormatNib525_6384; } else { - WMSG1(" Unexpected wrappedLength %ld for unadorned nibble\n", + LOGI(" Unexpected wrappedLength %ld for unadorned nibble", (long) wrappedLength); assert(false); } @@ -2438,7 +2438,7 @@ WrapperUnadornedNibble::Create(di_off_t length, DiskImg::PhysicalFormat physical DiskImg::SectorOrder order, short dosVolumeNum, GenericFD* pWrapperGFD, di_off_t* pWrappedLength, GenericFD** pDataFD) { - WMSG0("Create unadorned nibble\n"); + LOGI("Create unadorned nibble"); *pWrappedLength = length; *pDataFD = new GFDGFD; @@ -2476,7 +2476,7 @@ WrapperUnadornedNibble::Flush(GenericFD* pWrapperGFD, GenericFD* pDataGFD, /*static*/ DIError WrapperUnadornedSector::Test(GenericFD* pGFD, di_off_t wrappedLength) { - WMSG2("Testing for unadorned sector (wrappedLength=%ld/%lu)\n", + LOGI("Testing for unadorned sector (wrappedLength=%ld/%lu)", (long) (wrappedLength >> 32), (unsigned long) wrappedLength); if (wrappedLength >= 1536 && (wrappedLength % 512) == 0) return kDIErrNone; @@ -2495,7 +2495,7 @@ WrapperUnadornedSector::Prep(GenericFD* pGFD, di_off_t wrappedLength, bool readO DiskImg::SectorOrder* pOrder, short* pDiskVolNum, LinearBitmap** ppBadBlockMap, GenericFD** ppNewGFD) { - WMSG0("Prepping for unadorned sector\n"); + LOGI("Prepping for unadorned sector"); assert(wrappedLength > 0); *pLength = wrappedLength; *pPhysical = DiskImg::kPhysicalFormatSectors; @@ -2513,7 +2513,7 @@ WrapperUnadornedSector::Create(di_off_t length, DiskImg::PhysicalFormat physical DiskImg::SectorOrder order, short dosVolumeNum, GenericFD* pWrapperGFD, di_off_t* pWrappedLength, GenericFD** pDataFD) { - WMSG0("Create unadorned sector\n"); + LOGI("Create unadorned sector"); *pWrappedLength = length; *pDataFD = new GFDGFD; diff --git a/diskimg/MacPart.cpp b/diskimg/MacPart.cpp index f265d3a..0f793b1 100644 --- a/diskimg/MacPart.cpp +++ b/diskimg/MacPart.cpp @@ -99,14 +99,14 @@ DiskFSMacPart::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder) * This is invalid, but it's the way floptical images formatted * by the C.V.Tech format utilities look. */ - WMSG0(" MacPart NOTE: found zeroed-out DDR, continuing anyway\n"); + LOGI(" MacPart NOTE: found zeroed-out DDR, continuing anyway"); } else if (ddr.sbBlkSize == kBlkSize && ddr.sbBlkCount == 0) { /* * This showed up on a disc, so handle it too. */ - WMSG0(" MacPart NOTE: found partially-zeroed-out DDR, continuing\n"); + LOGI(" MacPart NOTE: found partially-zeroed-out DDR, continuing"); } else { - WMSG2(" MacPart found 'ER' signature but blkSize=%d blkCount=%ld\n", + LOGI(" MacPart found 'ER' signature but blkSize=%d blkCount=%ld", ddr.sbBlkSize, ddr.sbBlkCount); dierr = kDIErrFilesystemNotFound; goto bail; @@ -121,13 +121,13 @@ DiskFSMacPart::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder) goto bail; if (GetShortBE(&blkBuf[0x00]) != kPartitionSignature) { - WMSG0(" MacPart partition signature not found in first part block\n"); + LOGI(" MacPart partition signature not found in first part block"); dierr = kDIErrFilesystemNotFound; goto bail; } pmMapBlkCnt = GetLongBE(&blkBuf[0x04]); if (pmMapBlkCnt <= 0 || pmMapBlkCnt > 256) { - WMSG1(" MacPart unreasonable pmMapBlkCnt value %ld\n", + LOGI(" MacPart unreasonable pmMapBlkCnt value %ld", pmMapBlkCnt); dierr = kDIErrFilesystemNotFound; goto bail; @@ -137,7 +137,7 @@ DiskFSMacPart::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder) the format is pretty unambiguous, and we don't care about the order */ // success! - WMSG1(" MacPart partition map block count = %ld\n", pmMapBlkCnt); + LOGI(" MacPart partition map block count = %ld", pmMapBlkCnt); bail: return dierr; @@ -175,12 +175,12 @@ DiskFSMacPart::UnpackDDR(const unsigned char* buf, /*static*/ void DiskFSMacPart::DumpDDR(const DriverDescriptorRecord* pDDR) { - WMSG0(" MacPart driver descriptor record\n"); - WMSG3(" sbSig=0x%04x sbBlkSize=%d sbBlkCount=%ld\n", + LOGI(" MacPart driver descriptor record"); + LOGI(" sbSig=0x%04x sbBlkSize=%d sbBlkCount=%ld", pDDR->sbSig, pDDR->sbBlkSize, pDDR->sbBlkCount); - WMSG4(" sbDevType=%d sbDevId=%d sbData=%ld sbDrvrCount=%d\n", + LOGI(" sbDevType=%d sbDevId=%d sbData=%ld sbDrvrCount=%d", pDDR->sbDevType, pDDR->sbDevId, pDDR->sbData, pDDR->sbDrvrCount); - WMSG4(" (pad=%d) ddBlock=%ld ddSize=%d ddType=%d\n", + LOGI(" (pad=%d) ddBlock=%ld ddSize=%d ddType=%d", pDDR->hiddenPad, pDDR->ddBlock, pDDR->ddSize, pDDR->ddType); } @@ -226,23 +226,23 @@ DiskFSMacPart::UnpackPartitionMap(const unsigned char* buf, /*static*/ void DiskFSMacPart::DumpPartitionMap(long block, const PartitionMap* pMap) { - WMSG1(" MacPart partition map: block=%ld\n", block); - WMSG3(" pmSig=0x%04x (pad=0x%04x) pmMapBlkCnt=%ld\n", + LOGI(" MacPart partition map: block=%ld", block); + LOGI(" pmSig=0x%04x (pad=0x%04x) pmMapBlkCnt=%ld", pMap->pmSig, pMap->pmSigPad, pMap->pmMapBlkCnt); - WMSG2(" pmPartName='%s' pmParType='%s'\n", + LOGI(" pmPartName='%s' pmParType='%s'", pMap->pmPartName, pMap->pmParType); - WMSG2(" pmPyPartStart=%ld pmPartBlkCnt=%ld\n", + LOGI(" pmPyPartStart=%ld pmPartBlkCnt=%ld", pMap->pmPyPartStart, pMap->pmPartBlkCnt); - WMSG2(" pmLgDataStart=%ld pmDataCnt=%ld\n", + LOGI(" pmLgDataStart=%ld pmDataCnt=%ld", pMap->pmLgDataStart, pMap->pmDataCnt); - WMSG1(" pmPartStatus=%ld\n", + LOGI(" pmPartStatus=%ld", pMap->pmPartStatus); - WMSG2(" pmLgBootStart=%ld pmBootSize=%ld\n", + LOGI(" pmLgBootStart=%ld pmBootSize=%ld", pMap->pmLgBootStart, pMap->pmBootSize); - WMSG4(" pmBootAddr=%ld pmBootAddr2=%ld pmBootEntry=%ld pmBootEntry2=%ld\n", + LOGI(" pmBootAddr=%ld pmBootAddr2=%ld pmBootEntry=%ld pmBootEntry2=%ld", pMap->pmBootAddr, pMap->pmBootAddr2, pMap->pmBootEntry, pMap->pmBootEntry2); - WMSG2(" pmBootCksum=%ld pmProcessor='%s'\n", + LOGI(" pmBootCksum=%ld pmProcessor='%s'", pMap->pmBootCksum, pMap->pmProcessor); } @@ -263,16 +263,16 @@ DiskFSMacPart::OpenSubVolume(const PartitionMap* pMap) startBlock = pMap->pmPyPartStart; numBlocks = pMap->pmPartBlkCnt; - WMSG4("Adding '%s' (%s) %ld +%ld\n", + LOGI("Adding '%s' (%s) %ld +%ld", pMap->pmPartName, pMap->pmParType, startBlock, numBlocks); if (startBlock > fpImg->GetNumBlocks()) { - WMSG2("MacPart start block out of range (%ld vs %ld)\n", + LOGI("MacPart start block out of range (%ld vs %ld)", startBlock, fpImg->GetNumBlocks()); return kDIErrBadPartition; } if (startBlock + numBlocks > fpImg->GetNumBlocks()) { - WMSG2("MacPart partition too large (%ld vs %ld avail)\n", + LOGI("MacPart partition too large (%ld vs %ld avail)", numBlocks, fpImg->GetNumBlocks() - startBlock); fpImg->AddNote(DiskImg::kNoteInfo, "Reduced partition '%s' (%s) from %ld blocks to %ld.\n", @@ -302,18 +302,18 @@ DiskFSMacPart::OpenSubVolume(const PartitionMap* pMap) dierr = pNewImg->OpenImage(fpImg, startBlock, numBlocks); if (dierr != kDIErrNone) { - WMSG3(" MacPartSub: OpenImage(%ld,%ld) failed (err=%d)\n", + LOGI(" MacPartSub: OpenImage(%ld,%ld) failed (err=%d)", startBlock, numBlocks, dierr); goto bail; } - //WMSG2(" +++ CFFASub: new image has ro=%d (parent=%d)\n", + //LOGI(" +++ CFFASub: new image has ro=%d (parent=%d)", // pNewImg->GetReadOnly(), pImg->GetReadOnly()); /* the partition is typed; currently no way to give hints to analyzer */ dierr = pNewImg->AnalyzeImage(); if (dierr != kDIErrNone) { - WMSG1(" MacPartSub: analysis failed (err=%d)\n", dierr); + LOGI(" MacPartSub: analysis failed (err=%d)", dierr); goto bail; } @@ -321,7 +321,7 @@ DiskFSMacPart::OpenSubVolume(const PartitionMap* pMap) if (pNewImg->GetFSFormat() == DiskImg::kFormatUnknown || pNewImg->GetSectorOrder() == DiskImg::kSectorOrderUnknown) { - WMSG2(" MacPartSub (%ld,%ld): unable to identify filesystem\n", + LOGI(" MacPartSub (%ld,%ld): unable to identify filesystem", startBlock, numBlocks); DiskFSUnknown* pUnknownFS = new DiskFSUnknown; if (pUnknownFS == NULL) { @@ -334,10 +334,10 @@ DiskFSMacPart::OpenSubVolume(const PartitionMap* pMap) pMap->pmPartName, pMap->pmParType); } else { /* open a DiskFS for the sub-image */ - WMSG2(" MacPartSub (%ld,%ld) analyze succeeded!\n", startBlock, numBlocks); + LOGI(" MacPartSub (%ld,%ld) analyze succeeded!", startBlock, numBlocks); pNewFS = pNewImg->OpenAppropriateDiskFS(true); if (pNewFS == NULL) { - WMSG0(" MacPartSub: OpenAppropriateDiskFS failed\n"); + LOGI(" MacPartSub: OpenAppropriateDiskFS failed"); dierr = kDIErrUnsupportedFSFmt; goto bail; } @@ -362,7 +362,7 @@ DiskFSMacPart::OpenSubVolume(const PartitionMap* pMap) initMode = kInitFull; dierr = pNewFS->Initialize(pNewImg, initMode); if (dierr != kDIErrNone) { - WMSG1(" MacPartSub: error %d reading list of files from disk\n", dierr); + LOGI(" MacPartSub: error %d reading list of files from disk", dierr); goto bail; } @@ -396,7 +396,7 @@ DiskFSMacPart::TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, return kDIErrNone; } - WMSG0(" FS didn't find valid MacPart\n"); + LOGI(" FS didn't find valid MacPart"); return kDIErrFilesystemNotFound; } @@ -409,7 +409,7 @@ DiskFSMacPart::Initialize(void) { DIError dierr = kDIErrNone; - WMSG1("MacPart initializing (scanForSub=%d)\n", fScanForSubVolumes); + LOGI("MacPart initializing (scanForSub=%d)", fScanForSubVolumes); /* seems pointless *not* to, but we just do what we're told */ if (fScanForSubVolumes != kScanSubDisabled) { @@ -460,14 +460,14 @@ DiskFSMacPart::FindSubVolumes(void) goto bail; DiskFS* pNewFS = NULL; DiskImg* pNewImg = NULL; - WMSG1(" MacPart failed opening sub-volume %d\n", i); + LOGI(" MacPart failed opening sub-volume %d", i); dierr = CreatePlaceholder(map.pmPyPartStart, map.pmPartBlkCnt, (const char*)map.pmPartName, (const char*)map.pmParType, &pNewImg, &pNewFS); if (dierr == kDIErrNone) { AddSubVolumeToList(pNewImg, pNewFS); } else { - WMSG1(" MacPart unable to create placeholder (err=%d)\n", + LOGI(" MacPart unable to create placeholder (err=%d)", dierr); break; // something's wrong -- bail out with error } diff --git a/diskimg/MicroDrive.cpp b/diskimg/MicroDrive.cpp index 2dd6992..35c1ef3 100644 --- a/diskimg/MicroDrive.cpp +++ b/diskimg/MicroDrive.cpp @@ -90,7 +90,7 @@ DiskFSMicroDrive::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder) goto bail; if (GetShortLE(&blkBuf[0x00]) != kPartitionSignature) { - WMSG0(" MicroDrive partition signature not found in first part block\n"); + LOGI(" MicroDrive partition signature not found in first part block"); dierr = kDIErrFilesystemNotFound; goto bail; } @@ -100,7 +100,7 @@ DiskFSMicroDrive::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder) if (partCount1 == 0 || partCount1 > kMaxNumParts || partCount2 > kMaxNumParts) { - WMSG2(" MicroDrive unreasonable partCount values %d/%d\n", + LOGI(" MicroDrive unreasonable partCount values %d/%d", partCount1, partCount2); dierr = kDIErrFilesystemNotFound; goto bail; @@ -109,7 +109,7 @@ DiskFSMicroDrive::TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder) /* consider testing other fields */ // success! - WMSG2(" MicroDrive partition map count = %d/%d\n", partCount1, partCount2); + LOGI(" MicroDrive partition map count = %d/%d", partCount1, partCount2); bail: return dierr; @@ -151,25 +151,25 @@ DiskFSMicroDrive::UnpackPartitionMap(const unsigned char* buf, /*static*/ void DiskFSMicroDrive::DumpPartitionMap(const PartitionMap* pMap) { - WMSG0(" MicroDrive partition map:\n"); - WMSG4(" cyls=%d res1=%d heads=%d sects=%d\n", + LOGI(" MicroDrive partition map:"); + LOGI(" cyls=%d res1=%d heads=%d sects=%d", pMap->cylinders, pMap->reserved1, pMap->heads, pMap->sectors); - WMSG3(" res2=%d numPart1=%d numPart2=%d\n", + LOGI(" res2=%d numPart1=%d numPart2=%d", pMap->reserved2, pMap->numPart1, pMap->numPart2); - WMSG1(" romVersion=ROM%02d\n", pMap->romVersion); + LOGI(" romVersion=ROM%02d", pMap->romVersion); int i, parts; parts = pMap->numPart1; assert(parts <= kMaxNumParts); for (i = 0; i < parts; i++) { - WMSG3(" %2d: startLBA=%8ld length=%ld\n", + LOGI(" %2d: startLBA=%8ld length=%ld", i, pMap->partitionStart1[i], pMap->partitionLength1[i]); } parts = pMap->numPart2; assert(parts <= kMaxNumParts); for (i = 0; i < parts; i++) { - WMSG3(" %2d: startLBA=%8ld length=%ld\n", + LOGI(" %2d: startLBA=%8ld length=%ld", i+8, pMap->partitionStart2[i], pMap->partitionLength2[i]); } } @@ -186,15 +186,15 @@ DiskFSMicroDrive::OpenSubVolume(long startBlock, long numBlocks) DiskImg* pNewImg = NULL; //bool tweaked = false; - WMSG2("Adding %ld +%ld\n", startBlock, numBlocks); + LOGI("Adding %ld +%ld", startBlock, numBlocks); if (startBlock > fpImg->GetNumBlocks()) { - WMSG2("MicroDrive start block out of range (%ld vs %ld)\n", + LOGI("MicroDrive start block out of range (%ld vs %ld)", startBlock, fpImg->GetNumBlocks()); return kDIErrBadPartition; } if (startBlock + numBlocks > fpImg->GetNumBlocks()) { - WMSG2("MicroDrive partition too large (%ld vs %ld avail)\n", + LOGI("MicroDrive partition too large (%ld vs %ld avail)", numBlocks, fpImg->GetNumBlocks() - startBlock); fpImg->AddNote(DiskImg::kNoteInfo, "Reduced partition from %ld blocks to %ld.\n", @@ -211,18 +211,18 @@ DiskFSMicroDrive::OpenSubVolume(long startBlock, long numBlocks) dierr = pNewImg->OpenImage(fpImg, startBlock, numBlocks); if (dierr != kDIErrNone) { - WMSG3(" MicroDriveSub: OpenImage(%ld,%ld) failed (err=%d)\n", + LOGI(" MicroDriveSub: OpenImage(%ld,%ld) failed (err=%d)", startBlock, numBlocks, dierr); goto bail; } - //WMSG2(" +++ CFFASub: new image has ro=%d (parent=%d)\n", + //LOGI(" +++ CFFASub: new image has ro=%d (parent=%d)", // pNewImg->GetReadOnly(), pImg->GetReadOnly()); /* figure out what the format is */ dierr = pNewImg->AnalyzeImage(); if (dierr != kDIErrNone) { - WMSG1(" MicroDriveSub: analysis failed (err=%d)\n", dierr); + LOGI(" MicroDriveSub: analysis failed (err=%d)", dierr); goto bail; } @@ -230,7 +230,7 @@ DiskFSMicroDrive::OpenSubVolume(long startBlock, long numBlocks) if (pNewImg->GetFSFormat() == DiskImg::kFormatUnknown || pNewImg->GetSectorOrder() == DiskImg::kSectorOrderUnknown) { - WMSG2(" MicroDriveSub (%ld,%ld): unable to identify filesystem\n", + LOGI(" MicroDriveSub (%ld,%ld): unable to identify filesystem", startBlock, numBlocks); DiskFSUnknown* pUnknownFS = new DiskFSUnknown; if (pUnknownFS == NULL) { @@ -243,10 +243,10 @@ DiskFSMicroDrive::OpenSubVolume(long startBlock, long numBlocks) // pMap->pmPartName, pMap->pmParType); } else { /* open a DiskFS for the sub-image */ - WMSG2(" MicroDriveSub (%ld,%ld) analyze succeeded!\n", startBlock, numBlocks); + LOGI(" MicroDriveSub (%ld,%ld) analyze succeeded!", startBlock, numBlocks); pNewFS = pNewImg->OpenAppropriateDiskFS(true); if (pNewFS == NULL) { - WMSG0(" MicroDriveSub: OpenAppropriateDiskFS failed\n"); + LOGI(" MicroDriveSub: OpenAppropriateDiskFS failed"); dierr = kDIErrUnsupportedFSFmt; goto bail; } @@ -271,7 +271,7 @@ DiskFSMicroDrive::OpenSubVolume(long startBlock, long numBlocks) initMode = kInitFull; dierr = pNewFS->Initialize(pNewImg, initMode); if (dierr != kDIErrNone) { - WMSG1(" MicroDriveSub: error %d reading list of files from disk", dierr); + LOGI(" MicroDriveSub: error %d reading list of files from disk", dierr); goto bail; } @@ -305,7 +305,7 @@ DiskFSMicroDrive::TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, return kDIErrNone; } - WMSG0(" FS didn't find valid MicroDrive\n"); + LOGI(" FS didn't find valid MicroDrive"); return kDIErrFilesystemNotFound; } @@ -318,7 +318,7 @@ DiskFSMicroDrive::Initialize(void) { DIError dierr = kDIErrNone; - WMSG1("MicroDrive initializing (scanForSub=%d)\n", fScanForSubVolumes); + LOGI("MicroDrive initializing (scanForSub=%d)", fScanForSubVolumes); /* seems pointless *not* to, but we just do what we're told */ if (fScanForSubVolumes != kScanSubDisabled) { @@ -387,13 +387,13 @@ DiskFSMicroDrive::OpenVol(int idx, long startBlock, long numBlocks) DiskFS* pNewFS = NULL; DiskImg* pNewImg = NULL; - WMSG1(" MicroDrive failed opening sub-volume %d\n", idx); + LOGI(" MicroDrive failed opening sub-volume %d", idx); dierr = CreatePlaceholder(startBlock, numBlocks, NULL, NULL, &pNewImg, &pNewFS); if (dierr == kDIErrNone) { AddSubVolumeToList(pNewImg, pNewFS); } else { - WMSG1(" MicroDrive unable to create placeholder (err=%d)\n", + LOGI(" MicroDrive unable to create placeholder (err=%d)", dierr); // fall out with error } diff --git a/diskimg/Nibble.cpp b/diskimg/Nibble.cpp index 9fbeb22..7aa834c 100644 --- a/diskimg/Nibble.cpp +++ b/diskimg/Nibble.cpp @@ -106,7 +106,7 @@ DiskImg::FindNibbleSectorStart(const CircularBufferAccess& buffer, int track, &hdrChksum); if (pNibbleDescr->addrVerifyTrack && track != hdrTrack) { - WMSG3(" Track mismatch (T=%d) got T=%d,S=%d\n", + LOGI(" Track mismatch (T=%d) got T=%d,S=%d", track, hdrTrack, hdrSector); continue; } @@ -115,8 +115,8 @@ DiskImg::FindNibbleSectorStart(const CircularBufferAccess& buffer, int track, if ((pNibbleDescr->addrChecksumSeed ^ hdrVol ^ hdrTrack ^ hdrSector ^ hdrChksum) != 0) { - WMSG4(" Addr checksum mismatch (want T=%d,S=%d, got " - "T=%d,S=%d)\n", + LOGW(" Addr checksum mismatch (want T=%d,S=%d, got " + "T=%d,S=%d)", track, sector, hdrTrack, hdrSector); continue; } @@ -127,7 +127,7 @@ DiskImg::FindNibbleSectorStart(const CircularBufferAccess& buffer, int track, int j; for (j = 0; j < pNibbleDescr->addrEpilogVerifyCount; j++) { if (buffer[i+8+j] != pNibbleDescr->addrEpilog[j]) { - //WMSG3(" Bad epilog byte %d (%02x vs %02x)\n", + //LOGI(" Bad epilog byte %d (%02x vs %02x)", // j, buffer[i+8+j], pNibbleDescr->addrEpilog[j]); break; } @@ -136,7 +136,7 @@ DiskImg::FindNibbleSectorStart(const CircularBufferAccess& buffer, int track, continue; #ifdef NIB_VERBOSE_DEBUG - WMSG4(" Good header, T=%d,S=%d (looking for T=%d,S=%d)\n", + LOGI(" Good header, T=%d,S=%d (looking for T=%d,S=%d)", hdrTrack, hdrSector, track, sector); #endif @@ -170,7 +170,7 @@ DiskImg::FindNibbleSectorStart(const CircularBufferAccess& buffer, int track, } #ifdef NIB_VERBOSE_DEBUG - WMSG2(" Couldn't find T=%d,S=%d\n", track, sector); + LOGI(" Couldn't find T=%d,S=%d", track, sector); #endif return -1; } @@ -285,7 +285,7 @@ DiskImg::DecodeNibble62(const CircularBufferAccess& buffer, int idx, chksum ^= decodedVal; if (pNibbleDescr->dataVerifyChecksum && chksum != 0) { - WMSG0(" NIB bad data checksum\n"); + LOGI(" NIB bad data checksum"); return kDIErrBadChecksum; } return kDIErrNone; @@ -384,7 +384,7 @@ DiskImg::DecodeNibble53(const CircularBufferAccess& buffer, int idx, chksum ^= decodedVal; if (pNibbleDescr->dataVerifyChecksum && chksum != 0) { - WMSG1(" NIB bad data checksum (0x%02x)\n", chksum); + LOGI(" NIB bad data checksum (0x%02x)", chksum); return kDIErrBadChecksum; } @@ -537,22 +537,22 @@ DiskImg::DumpNibbleDescr(const NibbleDescr* pNibDescr) const default: encodingStr = "???"; break; } - WMSG1("NibbleDescr '%s':\n", pNibDescr->description); - WMSG1(" Nibble encoding is %s\n", encodingStr); + LOGI("NibbleDescr '%s':", pNibDescr->description); + LOGI(" Nibble encoding is %s", encodingStr); DumpBytes(pNibDescr->addrProlog, sizeof(pNibDescr->addrProlog), outBuf1); DumpBytes(pNibDescr->dataProlog, sizeof(pNibDescr->dataProlog), outBuf2); - WMSG2(" Addr prolog: %s Data prolog: %s\n", outBuf1, outBuf2); + LOGI(" Addr prolog: %s Data prolog: %s", outBuf1, outBuf2); DumpBytes(pNibDescr->addrEpilog, sizeof(pNibDescr->addrEpilog), outBuf1); DumpBytes(pNibDescr->dataEpilog, sizeof(pNibDescr->dataEpilog), outBuf2); - WMSG4(" Addr epilog: %s (%d) Data epilog: %s (%d)\n", + LOGI(" Addr epilog: %s (%d) Data epilog: %s (%d)", outBuf1, pNibDescr->addrEpilogVerifyCount, outBuf2, pNibDescr->dataEpilogVerifyCount); - WMSG2(" Addr checksum: %s Data checksum: %s\n", + LOGI(" Addr checksum: %s Data checksum: %s", VerifyStr(pNibDescr->addrVerifyChecksum), VerifyStr(pNibDescr->dataVerifyChecksum)); - WMSG2(" Addr checksum seed: 0x%02x Data checksum seed: 0x%02x\n", + LOGI(" Addr checksum seed: 0x%02x Data checksum seed: 0x%02x", pNibDescr->addrChecksumSeed, pNibDescr->dataChecksumSeed); - WMSG1(" Addr check track: %s\n", + LOGI(" Addr check track: %s", VerifyStr(pNibDescr->addrVerifyTrack)); } @@ -574,11 +574,11 @@ DiskImg::LoadNibbleTrack(long track, long* pTrackLen) if (track == fNibbleTrackLoaded) { #ifdef NIB_VERBOSE_DEBUG - WMSG1(" DI track %d already loaded\n", track); + LOGI(" DI track %d already loaded", track); #endif return kDIErrNone; } else { - WMSG1(" DI loading track %ld\n", track); + LOGI(" DI loading track %ld", track); } /* invalidate in case we fail with partial read */ @@ -610,7 +610,7 @@ DIError DiskImg::SaveNibbleTrack(void) { if (fNibbleTrackLoaded < 0) { - WMSG0("ERROR: tried to save track without loading it first\n"); + LOGI("ERROR: tried to save track without loading it first"); return kDIErrInternal; } assert(fNibbleTrackBuf != NULL); @@ -641,7 +641,7 @@ DiskImg::TestNibbleTrack(int track, const NibbleDescr* pNibbleDescr, assert(pNibbleDescr != NULL); if (LoadNibbleTrack(track, &trackLen) != kDIErrNone) { - WMSG0(" DI FindNibbleSectorStart: LoadNibbleTrack failed\n"); + LOGI(" DI FindNibbleSectorStart: LoadNibbleTrack failed"); return 0; } @@ -661,7 +661,7 @@ DiskImg::TestNibbleTrack(int track, const NibbleDescr* pNibbleDescr, } } - WMSG3(" Tests on track=%d with '%s' returning count=%d\n", + LOGI(" Tests on track=%d with '%s' returning count=%d", track, pNibbleDescr->description, count); return count; @@ -703,10 +703,10 @@ DiskImg::AnalyzeNibbleData(void) for (i = 0; i < fNumNibbleDescrEntries; i++) { if (fpNibbleDescrTable[i].numSectors == 0) { /* uninitialized "custom" entry */ - WMSG1(" Skipping '%s'\n", fpNibbleDescrTable[i].description); + LOGI(" Skipping '%s'", fpNibbleDescrTable[i].description); continue; } - WMSG1(" Trying '%s'\n", fpNibbleDescrTable[i].description); + LOGI(" Trying '%s'", fpNibbleDescrTable[i].description); goodTracks = 0; good = TestNibbleTrack(1, &fpNibbleDescrTable[i], NULL); @@ -723,7 +723,7 @@ DiskImg::AnalyzeNibbleData(void) goodTracks++; if (goodTracks >= 3) { - WMSG3(" Looks like '%s' (%d-sector), vol=%d\n", + LOGI(" Looks like '%s' (%d-sector), vol=%d", fpNibbleDescrTable[i].description, fpNibbleDescrTable[i].numSectors, protoVol); fpNibbleDescr = &fpNibbleDescrTable[i]; @@ -732,7 +732,7 @@ DiskImg::AnalyzeNibbleData(void) } } if (i == fNumNibbleDescrEntries) { - WMSG0("AnalyzeNibbleData did not find matching NibbleDescr\n"); + LOGI("AnalyzeNibbleData did not find matching NibbleDescr"); return kDIErrBadNibbleSectors; } @@ -752,12 +752,12 @@ DiskImg::ReadNibbleSector(long track, int sector, void* buf, { if (pNibbleDescr == NULL) { /* disk has no recognizable sectors */ - WMSG0(" DI ReadNibbleSector: pNibbleDescr is NULL, returning failure\n"); + LOGI(" DI ReadNibbleSector: pNibbleDescr is NULL, returning failure"); return kDIErrBadNibbleSectors; } if (sector >= pNibbleDescr->numSectors) { /* e.g. trying to read sector 14 on a 13-sector disk */ - WMSG0(" DI ReadNibbleSector: bad sector number request\n"); + LOGI(" DI ReadNibbleSector: bad sector number request"); return kDIErrInvalidSector; } @@ -772,7 +772,7 @@ DiskImg::ReadNibbleSector(long track, int sector, void* buf, dierr = LoadNibbleTrack(track, &trackLen); if (dierr != kDIErrNone) { - WMSG1(" DI ReadNibbleSector: LoadNibbleTrack %ld failed\n", track); + LOGI(" DI ReadNibbleSector: LoadNibbleTrack %ld failed", track); return dierr; } @@ -807,7 +807,7 @@ DiskImg::WriteNibbleSector(long track, int sector, const void* buf, dierr = LoadNibbleTrack(track, &trackLen); if (dierr != kDIErrNone) { - WMSG1(" DI ReadNibbleSector: LoadNibbleTrack %ld failed\n", track); + LOGI(" DI ReadNibbleSector: LoadNibbleTrack %ld failed", track); return dierr; } @@ -821,7 +821,7 @@ DiskImg::WriteNibbleSector(long track, int sector, const void* buf, dierr = SaveNibbleTrack(); if (dierr != kDIErrNone) { - WMSG1(" DI ReadNibbleSector: SaveNibbleTrack %ld failed\n", track); + LOGI(" DI ReadNibbleSector: SaveNibbleTrack %ld failed", track); return dierr; } @@ -841,7 +841,7 @@ DiskImg::ReadNibbleTrack(long track, unsigned char* buf, long* pTrackLen) dierr = LoadNibbleTrack(track, pTrackLen); if (dierr != kDIErrNone) { - WMSG1(" DI ReadNibbleTrack: LoadNibbleTrack %ld failed\n", track); + LOGI(" DI ReadNibbleTrack: LoadNibbleTrack %ld failed", track); return dierr; } @@ -865,12 +865,12 @@ DiskImg::WriteNibbleTrack(long track, const unsigned char* buf, long trackLen) /* load the track to set the "current track" stuff */ dierr = LoadNibbleTrack(track, &oldTrackLen); if (dierr != kDIErrNone) { - WMSG1(" DI WriteNibbleTrack: LoadNibbleTrack %ld failed\n", track); + LOGI(" DI WriteNibbleTrack: LoadNibbleTrack %ld failed", track); return dierr; } if (trackLen > GetNibbleTrackAllocLength()) { - WMSG2("ERROR: tried to write too-long track len (%ld vs %d)\n", + LOGI("ERROR: tried to write too-long track len (%ld vs %d)", trackLen, GetNibbleTrackAllocLength()); return kDIErrInvalidArg; } @@ -882,7 +882,7 @@ DiskImg::WriteNibbleTrack(long track, const unsigned char* buf, long trackLen) dierr = SaveNibbleTrack(); if (dierr != kDIErrNone) { - WMSG1(" DI ReadNibbleSector: SaveNibbleTrack %ld failed\n", track); + LOGI(" DI ReadNibbleSector: SaveNibbleTrack %ld failed", track); return dierr; } @@ -972,7 +972,7 @@ DiskImg::FormatNibbles(GenericFD* pGFD) const * sectors, then write the data to the GFD. */ for (track = 0; track < GetNumTracks(); track++) { - //WMSG1("Formatting track %d\n", track); + //LOGI("Formatting track %d", track); unsigned char* trackPtr = trackBuf; /* diff --git a/diskimg/Nibble35.cpp b/diskimg/Nibble35.cpp index fcb58a2..48f68b5 100644 --- a/diskimg/Nibble35.cpp +++ b/diskimg/Nibble35.cpp @@ -98,7 +98,7 @@ DiskImg::CylHeadSect35ToBlock(int cyl, int head, int sect) block += SectorsPerTrack35(i); block += sect; - //WMSG4("Nib35: c/h/s %d/%d/%d --> block %d\n", cyl, head, sect, block); + //LOGI("Nib35: c/h/s %d/%d/%d --> block %d", cyl, head, sect, block); assert(block >= 0 && block < 1600); return block; } @@ -132,7 +132,7 @@ DiskImg::UnpackNibbleTrack35(const unsigned char* nibbleBuf, assert(sector >= 0 && sector < SectorsPerTrack35(cyl)); if (foundSector[sector]) { - WMSG3("Nib35: WARNING: found two copies of sect %d on cyl=%d head=%d\n", + LOGI("Nib35: WARNING: found two copies of sect %d on cyl=%d head=%d", sector, cyl, head); } else { memset(sectorBuf, 0xa9, sizeof(sectorBuf)); @@ -147,10 +147,10 @@ DiskImg::UnpackNibbleTrack35(const unsigned char* nibbleBuf, calcSum[1] != readSum[1] || calcSum[2] != readSum[2]) { - WMSG2("Nib35: checksum mismatch: 0x%06x vs. 0x%06x\n", + LOGI("Nib35: checksum mismatch: 0x%06x vs. 0x%06x", calcSum[0] << 16 | calcSum[1] << 8 | calcSum[2], readSum[0] << 16 | readSum[1] << 8 | readSum[2]); - WMSG4("Nib35: marking cyl=%d head=%d sect=%d (block=%d)\n", + LOGI("Nib35: marking cyl=%d head=%d sect=%d (block=%d)", cyl, head, sector, CylHeadSect35ToBlock(cyl, head, sector)); pBadBlockMap->Set(CylHeadSect35ToBlock(cyl, head, sector)); @@ -165,7 +165,7 @@ DiskImg::UnpackNibbleTrack35(const unsigned char* nibbleBuf, */ for (i = SectorsPerTrack35(cyl)-1; i >= 0; i--) { if (!foundSector[i]) { - WMSG4("Nib35: didn't find cyl=%d head=%d sect=%d (block=%d)\n", + LOGI("Nib35: didn't find cyl=%d head=%d sect=%d (block=%d)", cyl, head, i, CylHeadSect35ToBlock(cyl, head, i)); pBadBlockMap->Set(CylHeadSect35ToBlock(cyl, head, i)); } @@ -176,7 +176,7 @@ DiskImg::UnpackNibbleTrack35(const unsigned char* nibbleBuf, (head == (cyl & 0x01)) && (i == 1 || i == 7)) { - WMSG4("DEBUG: setting bad %d/%d/%d (%d)\n", + LOGI("DEBUG: setting bad %d/%d/%d (%d)", cyl, head, i, CylHeadSect35ToBlock(cyl, head, i)); pBadBlockMap->Set(CylHeadSect35ToBlock(cyl, head, i)); } @@ -221,23 +221,23 @@ DiskImg::FindNextSector35(const CircularBufferAccess& buffer, int start, format == kInvInvalidValue || checksum == kInvInvalidValue) { - WMSG0("Nib35: garbled address header found\n"); + LOGI("Nib35: garbled address header found"); continue; } - //WMSG5(" Nib35: got addr: track=%2d sect=%2d side=%d format=%d sum=0x%02x\n", + //LOGI(" Nib35: got addr: track=%2d sect=%2d side=%d format=%d sum=0x%02x", // trackNum, sectNum, side, format, checksum); if (side != ((head * 0x20) | (cyl >> 6))) { - WMSG3("Nib35: unexpected value for side: %d on cyl=%d head=%d\n", + LOGI("Nib35: unexpected value for side: %d on cyl=%d head=%d", side, cyl, head); } if (sectNum >= SectorsPerTrack35(cyl)) { - WMSG2("Nib35: invalid value for sector: %d (cyl=%d)\n", + LOGI("Nib35: invalid value for sector: %d (cyl=%d)", sectNum, cyl); continue; } /* format seems to be 0x22 or 0x24 */ if (checksum != (trackNum ^ sectNum ^ side ^ format)) { - WMSG2("Nib35: unexpected checksum: 0x%02x vs. 0x%02x\n", + LOGI("Nib35: unexpected checksum: 0x%02x vs. 0x%02x", checksum, trackNum ^ sectNum ^ side ^ format); continue; } @@ -246,7 +246,7 @@ DiskImg::FindNextSector35(const CircularBufferAccess& buffer, int start, if (buffer[i+8] != kAddrEpilog0 || buffer[i+9] != kAddrEpilog1) { - WMSG0("Nib35: invalid address epilog\n"); + LOGI("Nib35: invalid address epilog"); /* maybe we allow this anyway? */ } @@ -300,7 +300,7 @@ DiskImg::DecodeNibbleSector35(const CircularBufferAccess& buffer, int start, } } if (off == start + kMaxDataReach35) { - WMSG0("nib25: could not find start of data field\n"); + LOGI("nib25: could not find start of data field"); return false; } @@ -323,9 +323,9 @@ DiskImg::DecodeNibbleSector35(const CircularBufferAccess& buffer, int start, nib2 == kInvInvalidValue) { // junk found - WMSG1("Nib25: found invalid disk byte in sector data at %d\n", + LOGI("Nib25: found invalid disk byte in sector data at %d", off - start); - WMSG4(" (one of 0x%02x 0x%02x 0x%02x 0x%02x)\n", + LOGI(" (one of 0x%02x 0x%02x 0x%02x 0x%02x)", buffer[off-4], buffer[off-3], buffer[off-2], buffer[off-1]); return false; //if (twos == kInvInvalidValue) @@ -380,7 +380,7 @@ DiskImg::DecodeNibbleSector35(const CircularBufferAccess& buffer, int start, i++; assert(i < kChunkSize35); - //WMSG2("i = %d, diff=%d\n", i, sectorBuf - sectorBufStart); + //LOGI("i = %d, diff=%d", i, sectorBuf - sectorBufStart); } calcChecksum[0] = chk0; @@ -388,14 +388,14 @@ DiskImg::DecodeNibbleSector35(const CircularBufferAccess& buffer, int start, calcChecksum[2] = chk2; if (!UnpackChecksum35(buffer, off, readChecksum)) { - WMSG0("Nib35: failure reading checksum\n"); + LOGI("Nib35: failure reading checksum"); readChecksum[0] = calcChecksum[0] ^ 0xff; // force a failure return false; } off += 4; // skip past checksum bytes if (buffer[off] != kDataEpilog0 || buffer[off+1] != kDataEpilog1) { - WMSG0("nib25: WARNING: data epilog not found\n"); + LOGI("nib25: WARNING: data epilog not found"); // allow it, if the checksum matches } @@ -420,13 +420,13 @@ DiskImg::DecodeNibbleSector35(const CircularBufferAccess& buffer, int start, val1 = kInvDiskBytes62[buffer[start + i]]; val2 = kInvDiskBytes62[nibBuf[i]]; if ((val1 & 0xfc) != (val2 & 0xfc)) { - WMSG5("Nib35 DEBUG: output differs at byte %d" - " (0x%02x vs 0x%02x / 0x%02x vs 0x%02x)\n", + LOGI("Nib35 DEBUG: output differs at byte %d" + " (0x%02x vs 0x%02x / 0x%02x vs 0x%02x)", i, buffer[start+i], nibBuf[i], val1, val2); } } else { // note: checksum is 699-702 - WMSG3("Nib35 DEBUG: output differs at byte %d (0x%02x vs 0x%02x)\n", + LOGI("Nib35 DEBUG: output differs at byte %d (0x%02x vs 0x%02x)", i, buffer[start+i], nibBuf[i]); } } @@ -460,7 +460,7 @@ DiskImg::UnpackChecksum35(const CircularBufferAccess& buffer, int offset, nib1 == kInvInvalidValue || nib2 == kInvInvalidValue) { - WMSG0("nib25: found invalid disk byte in checksum\n"); + LOGI("nib25: found invalid disk byte in checksum"); return false; } diff --git a/diskimg/OuterWrapper.cpp b/diskimg/OuterWrapper.cpp index 1ac4bef..e3d69e7 100644 --- a/diskimg/OuterWrapper.cpp +++ b/diskimg/OuterWrapper.cpp @@ -41,12 +41,12 @@ OuterGzip::Test(GenericFD* pGFD, di_off_t outerLength) unsigned short magic, magicBuf; const char* imagePath; - WMSG0("Testing for gzip\n"); + LOGI("Testing for gzip"); /* don't need this here, but we will later on */ imagePath = pGFD->GetPathName(); if (imagePath == NULL) { - WMSG0("Can't test gzip on non-file\n"); + LOGI("Can't test gzip on non-file"); return kDIErrNotSupported; } @@ -131,9 +131,9 @@ OuterGzip::ExtractGzipImage(gzFile gzfp, char** pBuf, di_off_t* pLength) */ len = gzread(gzfp, buf + curSize, maxSize - curSize); if (len < 0) { - WMSG1(" ExGZ Call to gzread failed, errno=%d\n", errno); + LOGI(" ExGZ Call to gzread failed, errno=%d", errno); if (curSize == 140*1024 || curSize == 800*1024) { - WMSG0("WARNING: accepting damaged gzip file\n"); + LOGI("WARNING: accepting damaged gzip file"); fWrapperDamaged = true; break; // sleazy, but currently necessary } @@ -145,13 +145,13 @@ OuterGzip::ExtractGzipImage(gzFile gzfp, char** pBuf, di_off_t* pLength) } else if (len < (maxSize - curSize)) { /* we've probably reached the end, but we can't be sure, so let's go around again */ - WMSG2(" ExGZ gzread(%ld) returned %ld, letting it ride\n", + LOGI(" ExGZ gzread(%ld) returned %ld, letting it ride", maxSize - curSize, len); curSize += len; } else { /* update buffer, and grow it if it's not big enough */ curSize += len; - WMSG2(" max=%ld cur=%ld\n", maxSize, curSize); + LOGI(" max=%ld cur=%ld", maxSize, curSize); if (maxSize - curSize < kMinEmpty) { /* not enough room, grow it */ @@ -168,7 +168,7 @@ OuterGzip::ExtractGzipImage(gzFile gzfp, char** pBuf, di_off_t* pLength) newBuf = new char[maxSize]; if (newBuf == NULL) { - WMSG1(" ExGZ failed buffer alloc (%ld)\n", + LOGI(" ExGZ failed buffer alloc (%ld)", maxSize); dierr = kDIErrMalloc; goto bail; @@ -179,17 +179,17 @@ OuterGzip::ExtractGzipImage(gzFile gzfp, char** pBuf, di_off_t* pLength) buf = newBuf; newBuf = NULL; - WMSG1(" ExGZ grew buffer to %ld\n", maxSize); + LOGI(" ExGZ grew buffer to %ld", maxSize); } else { /* don't need to grow buffer yet */ - WMSG3(" ExGZ read %ld bytes, cur=%ld max=%ld\n", + LOGI(" ExGZ read %ld bytes, cur=%ld max=%ld", len, curSize, maxSize); } } assert(curSize < maxSize); if (curSize > kAbsoluteMax) { - WMSG0(" ExGZ excessive size, probably not a disk image\n"); + LOGI(" ExGZ excessive size, probably not a disk image"); dierr = kDIErrTooBig; // close enough goto bail; } @@ -197,7 +197,7 @@ OuterGzip::ExtractGzipImage(gzFile gzfp, char** pBuf, di_off_t* pLength) if (curSize + (1024*1024) < maxSize) { /* shrink it down so it fits */ - WMSG2(" Down-sizing buffer from %ld to %ld\n", maxSize, curSize); + LOGI(" Down-sizing buffer from %ld to %ld", maxSize, curSize); newBuf = new char[curSize]; if (newBuf == NULL) goto bail; @@ -209,7 +209,7 @@ OuterGzip::ExtractGzipImage(gzFile gzfp, char** pBuf, di_off_t* pLength) *pBuf = buf; *pLength = curSize; - WMSG1(" ExGZ final size = %ld\n", curSize); + LOGI(" ExGZ final size = %ld", curSize); buf = NULL; @@ -241,7 +241,7 @@ OuterGzip::Load(GenericFD* pOuterGFD, di_off_t outerLength, bool readOnly, gzfp = gzopen(imagePath, "rb"); // use "readOnly" here if (gzfp == NULL) { // DON'T retry RO -- should be done at higher level? - WMSG1("gzopen failed, errno=%d\n", errno); + LOGI("gzopen failed, errno=%d", errno); dierr = kDIErrGeneric; goto bail; } @@ -293,7 +293,7 @@ OuterGzip::Save(GenericFD* pOuterGFD, GenericFD* pWrapperGFD, const char* imagePath; gzFile gzfp = NULL; - WMSG1(" GZ save (wrapperLen=%ld)\n", (long) wrapperLength); + LOGI(" GZ save (wrapperLen=%ld)", (long) wrapperLength); assert(wrapperLength > 0); /* @@ -307,7 +307,7 @@ OuterGzip::Save(GenericFD* pOuterGFD, GenericFD* pWrapperGFD, gzfp = gzopen(imagePath, "wb"); if (gzfp == NULL) { - WMSG1("gzopen for write failed, errno=%d\n", errno); + LOGI("gzopen for write failed, errno=%d", errno); dierr = kDIErrGeneric; goto bail; } @@ -326,14 +326,14 @@ OuterGzip::Save(GenericFD* pOuterGFD, GenericFD* pWrapperGFD, break; } if (dierr != kDIErrNone) { - WMSG1("Error reading source GFD during gzip save (err=%d)\n",dierr); + LOGI("Error reading source GFD during gzip save (err=%d)",dierr); goto bail; } assert(actual > 0); written = gzwrite(gzfp, buf, actual); if (written == 0) { - WMSG1("Failed writing %d bytes to gzio\n", actual); + LOGI("Failed writing %d bytes to gzio", actual); dierr = kDIErrGeneric; goto bail; } @@ -343,7 +343,7 @@ OuterGzip::Save(GenericFD* pOuterGFD, GenericFD* pWrapperGFD, } assert(wrapperLength == 0); // not expecting any slop - WMSG1(" GZ wrote %ld bytes\n", totalWritten); + LOGI(" GZ wrote %ld bytes", totalWritten); /* * Success! @@ -372,7 +372,7 @@ OuterZip::Test(GenericFD* pGFD, di_off_t outerLength) DIError dierr = kDIErrNone; CentralDirEntry cde; - WMSG0("Testing for zip\n"); + LOGI("Testing for zip"); dierr = ReadCentralDir(pGFD, outerLength, &cde); if (dierr != kDIErrNone) goto bail; @@ -383,7 +383,7 @@ OuterZip::Test(GenericFD* pGFD, di_off_t outerLength) if (cde.fCompressionMethod != kCompressStored && cde.fCompressionMethod != kCompressDeflated) { - WMSG1(" ZIP compression method %d not supported\n", + LOGI(" ZIP compression method %d not supported", cde.fCompressionMethod); dierr = kDIErrGeneric; goto bail; @@ -395,7 +395,7 @@ OuterZip::Test(GenericFD* pGFD, di_off_t outerLength) if (cde.fUncompressedSize < 512 || cde.fUncompressedSize > kMaxUncompressedSize) { - WMSG1(" ZIP uncompressed size %lu is outside range\n", + LOGI(" ZIP uncompressed size %lu is outside range", cde.fUncompressedSize); dierr = kDIErrGeneric; goto bail; @@ -431,7 +431,7 @@ OuterZip::Load(GenericFD* pOuterGFD, di_off_t outerLength, bool readOnly, assert(*pExt == '.'); SetExtension(pExt+1); - WMSG1("OuterZip using extension '%s'\n", GetExtension()); + LOGI("OuterZip using extension '%s'", GetExtension()); } SetStoredFileName((const char*) cde.fFileName); @@ -481,7 +481,7 @@ OuterZip::Save(GenericFD* pOuterGFD, GenericFD* pWrapperGFD, EndOfCentralDir eocd; di_off_t lfhOffset; - WMSG1(" ZIP save (wrapperLen=%ld)\n", (long) wrapperLength); + LOGI(" ZIP save (wrapperLen=%ld)", (long) wrapperLength); assert(wrapperLength > 0); dierr = pOuterGFD->Rewind(); @@ -693,12 +693,12 @@ OuterZip::ReadCentralDir(GenericFD* pGFD, di_off_t outerLength, if (buf[i] == 0x50 && GetLongLE(&buf[i]) == EndOfCentralDir::kSignature) { - WMSG1("+++ Found EOCD at buf+%d\n", i); + LOGI("+++ Found EOCD at buf+%d", i); break; } } if (i < 0) { - WMSG0("+++ EOCD not found, not ZIP\n"); + LOGI("+++ EOCD not found, not ZIP"); dierr = kDIErrGeneric; goto bail; } @@ -712,7 +712,7 @@ OuterZip::ReadCentralDir(GenericFD* pGFD, di_off_t outerLength, if (eocd.fDiskNumber != 0 || eocd.fDiskWithCentralDir != 0 || eocd.fNumEntries != 1 || eocd.fTotalNumEntries != 1) { - WMSG0(" Probable ZIP archive has more than one member\n"); + LOGI(" Probable ZIP archive has more than one member"); dierr = kDIErrFileArchive; goto bail; } @@ -750,12 +750,12 @@ OuterZip::ReadCentralDir(GenericFD* pGFD, di_off_t outerLength, if (dierr != kDIErrNone) goto bail; if (GetLongLE(checkBuf) != EndOfCentralDir::kSignature) { - WMSG0("CDE read check failed\n"); + LOGI("CDE read check failed"); assert(false); dierr = kDIErrGeneric; goto bail; } - WMSG0("+++ CDE read check passed\n"); + LOGI("+++ CDE read check passed"); } bail: @@ -793,12 +793,12 @@ OuterZip::ExtractZipEntry(GenericFD* pOuterGFD, CentralDirEntry* pCDE, lfh.Dump(); /* we should now be pointing at the data */ - WMSG1("File offset is 0x%08lx\n", (long) pOuterGFD->Tell()); + LOGI("File offset is 0x%08lx", (long) pOuterGFD->Tell()); buf = new unsigned char[pCDE->fUncompressedSize]; if (buf == NULL) { /* a very real possibility */ - WMSG1(" ZIP unable to allocate buffer of %lu bytes\n", + LOGI(" ZIP unable to allocate buffer of %lu bytes", pCDE->fUncompressedSize); dierr = kDIErrMalloc; goto bail; @@ -826,9 +826,9 @@ OuterZip::ExtractZipEntry(GenericFD* pOuterGFD, CentralDirEntry* pCDE, crc = crc32(crc, buf, pCDE->fUncompressedSize); if (crc == pCDE->fCRC32) { - WMSG0("+++ ZIP CRCs match\n"); + LOGI("+++ ZIP CRCs match"); } else { - WMSG2("ZIP CRC mismatch: inflated crc32=0x%08lx, stored=0x%08lx\n", + LOGI("ZIP CRC mismatch: inflated crc32=0x%08lx, stored=0x%08lx", crc, pCDE->fCRC32); dierr = kDIErrBadChecksum; goto bail; @@ -888,10 +888,10 @@ OuterZip::InflateGFDToBuffer(GenericFD* pGFD, unsigned long compSize, if (zerr != Z_OK) { dierr = kDIErrInternal; if (zerr == Z_VERSION_ERROR) { - WMSG1("Installed zlib is not compatible with linked version (%s)\n", + LOGI("Installed zlib is not compatible with linked version (%s)", ZLIB_VERSION); } else { - WMSG1("Call to inflateInit2 failed (zerr=%d)\n", zerr); + LOGI("Call to inflateInit2 failed (zerr=%d)", zerr); } goto bail; } @@ -906,12 +906,12 @@ OuterZip::InflateGFDToBuffer(GenericFD* pGFD, unsigned long compSize, if (zstream.avail_in == 0) { getSize = (compRemaining > kReadBufSize) ? kReadBufSize : compRemaining; - WMSG2("+++ reading %ld bytes (%ld left)\n", getSize, + LOGI("+++ reading %ld bytes (%ld left)", getSize, compRemaining); dierr = pGFD->Read(readBuf, getSize); if (dierr != kDIErrNone) { - WMSG0("inflate read failed\n"); + LOGI("inflate read failed"); goto z_bail; } @@ -925,7 +925,7 @@ OuterZip::InflateGFDToBuffer(GenericFD* pGFD, unsigned long compSize, zerr = inflate(&zstream, Z_NO_FLUSH); if (zerr != Z_OK && zerr != Z_STREAM_END) { dierr = kDIErrInternal; - WMSG1("zlib inflate call failed (zerr=%d)\n", zerr); + LOGI("zlib inflate call failed (zerr=%d)", zerr); goto z_bail; } @@ -936,7 +936,7 @@ OuterZip::InflateGFDToBuffer(GenericFD* pGFD, unsigned long compSize, if (zstream.total_out != uncompSize) { dierr = kDIErrBadCompressedData; - WMSG2("Size mismatch on inflated file (%ld vs %ld)\n", + LOGI("Size mismatch on inflated file (%ld vs %ld)", zstream.total_out, uncompSize); goto z_bail; } @@ -963,13 +963,13 @@ OuterZip::GetMSDOSTime(unsigned short* pDate, unsigned short* pTime) ::GetSystemTime(&sysTime); ::SystemTimeToFileTime(&sysTime, &fileTime); ::FileTimeToDosDateTime(&fileTime, pDate, pTime); - //WMSG3("+++ Windows date: %04x %04x %d\n", *pDate, *pTime, + //LOGI("+++ Windows date: %04x %04x %d", *pDate, *pTime, // (*pTime >> 11) & 0x1f); #endif time_t now = time(NULL); DOSTime(now, pDate, pTime); - //WMSG3("+++ Our date : %04x %04x %d\n", *pDate, *pTime, + //LOGI("+++ Our date : %04x %04x %d", *pDate, *pTime, // (*pTime >> 11) & 0x1f); } @@ -1044,10 +1044,10 @@ OuterZip::DeflateGFDToGFD(GenericFD* pDst, GenericFD* pSrc, di_off_t srcLen, if (zerr != Z_OK) { dierr = kDIErrInternal; if (zerr == Z_VERSION_ERROR) { - WMSG1("Installed zlib is not compatible with linked version (%s)\n", + LOGI("Installed zlib is not compatible with linked version (%s)", ZLIB_VERSION); } else { - WMSG1("Call to deflateInit2 failed (zerr=%d)\n", zerr); + LOGI("Call to deflateInit2 failed (zerr=%d)", zerr); } goto bail; } @@ -1064,11 +1064,11 @@ OuterZip::DeflateGFDToGFD(GenericFD* pDst, GenericFD* pSrc, di_off_t srcLen, /* only read if the input is empty */ if (zstream.avail_in == 0 && srcLen) { getSize = (srcLen > kBufSize) ? kBufSize : (long) srcLen; - WMSG1("+++ reading %ld bytes\n", getSize); + LOGI("+++ reading %ld bytes", getSize); dierr = pSrc->Read(inBuf, getSize); if (dierr != kDIErrNone) { - WMSG0("deflate read failed\n"); + LOGI("deflate read failed"); goto z_bail; } @@ -1087,7 +1087,7 @@ OuterZip::DeflateGFDToGFD(GenericFD* pDst, GenericFD* pSrc, di_off_t srcLen, zerr = deflate(&zstream, flush); if (zerr != Z_OK && zerr != Z_STREAM_END) { - WMSG1("zlib deflate call failed (zerr=%d)\n", zerr); + LOGI("zlib deflate call failed (zerr=%d)", zerr); dierr = kDIErrInternal; goto z_bail; } @@ -1096,10 +1096,10 @@ OuterZip::DeflateGFDToGFD(GenericFD* pDst, GenericFD* pSrc, di_off_t srcLen, if (zstream.avail_out == 0 || (zerr == Z_STREAM_END && zstream.avail_out != kBufSize)) { - WMSG1("+++ writing %d bytes\n", zstream.next_out - outBuf); + LOGI("+++ writing %d bytes", zstream.next_out - outBuf); dierr = pDst->Write(outBuf, zstream.next_out - outBuf); if (dierr != kDIErrNone) { - WMSG0("write failed in deflate\n"); + LOGI("write failed in deflate"); goto z_bail; } @@ -1157,7 +1157,7 @@ OuterZip::LocalFileHeader::Read(GenericFD* pGFD) goto bail; if (GetLongLE(&buf[0x00]) != kSignature) { - WMSG0(" ZIP: whoops: didn't find expected signature\n"); + LOGI(" ZIP: whoops: didn't find expected signature"); assert(false); return kDIErrGeneric; } @@ -1247,13 +1247,13 @@ OuterZip::LocalFileHeader::SetFileName(const char* name) fFileNameLength = strlen(name); fFileName = new unsigned char[fFileNameLength+1]; if (fFileName == NULL) { - WMSG1("Malloc failure in SetFileName %u\n", fFileNameLength); + LOGI("Malloc failure in SetFileName %u", fFileNameLength); fFileName = NULL; fFileNameLength = 0; } else { memcpy(fFileName, name, fFileNameLength); fFileName[fFileNameLength] = '\0'; - WMSG1("+++ OuterZip LFH filename set to '%s'\n", fFileName); + LOGI("+++ OuterZip LFH filename set to '%s'", fFileName); } } } @@ -1264,14 +1264,14 @@ OuterZip::LocalFileHeader::SetFileName(const char* name) void OuterZip::LocalFileHeader::Dump(void) const { - WMSG0(" LocalFileHeader contents:\n"); - WMSG3(" versToExt=%u gpBits=0x%04x compression=%u\n", + LOGI(" LocalFileHeader contents:"); + LOGI(" versToExt=%u gpBits=0x%04x compression=%u", fVersionToExtract, fGPBitFlag, fCompressionMethod); - WMSG3(" modTime=0x%04x modDate=0x%04x crc32=0x%08lx\n", + LOGI(" modTime=0x%04x modDate=0x%04x crc32=0x%08lx", fLastModFileTime, fLastModFileDate, fCRC32); - WMSG2(" compressedSize=%lu uncompressedSize=%lu\n", + LOGI(" compressedSize=%lu uncompressedSize=%lu", fCompressedSize, fUncompressedSize); - WMSG2(" filenameLen=%u extraLen=%u\n", + LOGI(" filenameLen=%u extraLen=%u", fFileNameLength, fExtraFieldLength); } @@ -1300,7 +1300,7 @@ OuterZip::CentralDirEntry::Read(GenericFD* pGFD) goto bail; if (GetLongLE(&buf[0x00]) != kSignature) { - WMSG0(" ZIP: whoops: didn't find expected signature\n"); + LOGI(" ZIP: whoops: didn't find expected signature"); assert(false); return kDIErrGeneric; } @@ -1419,13 +1419,13 @@ OuterZip::CentralDirEntry::SetFileName(const char* name) fFileNameLength = strlen(name); fFileName = new unsigned char[fFileNameLength+1]; if (fFileName == NULL) { - WMSG1("Malloc failure in SetFileName %u\n", fFileNameLength); + LOGI("Malloc failure in SetFileName %u", fFileNameLength); fFileName = NULL; fFileNameLength = 0; } else { memcpy(fFileName, name, fFileNameLength); fFileName[fFileNameLength] = '\0'; - WMSG1("+++ OuterZip CDE filename set to '%s'\n", fFileName); + LOGI("+++ OuterZip CDE filename set to '%s'", fFileName); } } } @@ -1437,24 +1437,24 @@ OuterZip::CentralDirEntry::SetFileName(const char* name) void OuterZip::CentralDirEntry::Dump(void) const { - WMSG0(" CentralDirEntry contents:\n"); - WMSG4(" versMadeBy=%u versToExt=%u gpBits=0x%04x compression=%u\n", + LOGI(" CentralDirEntry contents:"); + LOGI(" versMadeBy=%u versToExt=%u gpBits=0x%04x compression=%u", fVersionMadeBy, fVersionToExtract, fGPBitFlag, fCompressionMethod); - WMSG3(" modTime=0x%04x modDate=0x%04x crc32=0x%08lx\n", + LOGI(" modTime=0x%04x modDate=0x%04x crc32=0x%08lx", fLastModFileTime, fLastModFileDate, fCRC32); - WMSG2(" compressedSize=%lu uncompressedSize=%lu\n", + LOGI(" compressedSize=%lu uncompressedSize=%lu", fCompressedSize, fUncompressedSize); - WMSG3(" filenameLen=%u extraLen=%u commentLen=%u\n", + LOGI(" filenameLen=%u extraLen=%u commentLen=%u", fFileNameLength, fExtraFieldLength, fFileCommentLength); - WMSG4(" diskNumStart=%u intAttr=0x%04x extAttr=0x%08lx relOffset=%lu\n", + LOGI(" diskNumStart=%u intAttr=0x%04x extAttr=0x%08lx relOffset=%lu", fDiskNumberStart, fInternalAttrs, fExternalAttrs, fLocalHeaderRelOffset); if (fFileName != NULL) { - WMSG1(" filename: '%s'\n", fFileName); + LOGI(" filename: '%s'", fFileName); } if (fFileComment != NULL) { - WMSG1(" comment: '%s'\n", fFileComment); + LOGI(" comment: '%s'", fFileComment); } } @@ -1475,7 +1475,7 @@ OuterZip::EndOfCentralDir::ReadBuf(const unsigned char* buf, int len) { if (len < kEOCDLen) { /* looks like ZIP file got truncated */ - WMSG2(" Zip EOCD: expected >= %d bytes, found %d\n", + LOGI(" Zip EOCD: expected >= %d bytes, found %d", kEOCDLen, len); return kDIErrBadArchiveStruct; } @@ -1527,9 +1527,9 @@ bail: void OuterZip::EndOfCentralDir::Dump(void) const { - WMSG0(" EndOfCentralDir contents:\n"); - WMSG4(" diskNum=%u diskWCD=%u numEnt=%u totalNumEnt=%u\n", + LOGI(" EndOfCentralDir contents:"); + LOGI(" diskNum=%u diskWCD=%u numEnt=%u totalNumEnt=%u", fDiskNumber, fDiskWithCentralDir, fNumEntries, fTotalNumEntries); - WMSG3(" centDirSize=%lu centDirOff=%lu commentLen=%u\n", + LOGI(" centDirSize=%lu centDirOff=%lu commentLen=%u", fCentralDirSize, fCentralDirOffset, fCommentLen); } diff --git a/diskimg/OzDOS.cpp b/diskimg/OzDOS.cpp index 91ea004..b83f23d 100644 --- a/diskimg/OzDOS.cpp +++ b/diskimg/OzDOS.cpp @@ -86,7 +86,7 @@ TestImageHalf(DiskImg* pImg, int sectorOffset, DiskImg::SectorOrder imageOrder) !(catTrack < numTracks && catSect < numSectors) || 0) { - WMSG1(" OzDOS header test %d failed\n", sectorOffset); + LOGI(" OzDOS header test %d failed", sectorOffset); dierr = kDIErrFilesystemNotFound; goto bail; } @@ -114,7 +114,7 @@ TestImageHalf(DiskImg* pImg, int sectorOffset, DiskImg::SectorOrder imageOrder) } bail_ok: - WMSG3(" OzDOS foundGood=%d off=%d swap=%d\n", foundGood, sectorOffset, + LOGI(" OzDOS foundGood=%d off=%d swap=%d", foundGood, sectorOffset, imageOrder); /* foundGood hits 3 even when swap is wrong */ if (foundGood > 4) @@ -134,12 +134,12 @@ TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder) { DIError dierr; - WMSG1(" OzDOS checking first half (swap=%d)\n", imageOrder); + LOGI(" OzDOS checking first half (swap=%d)", imageOrder); dierr = TestImageHalf(pImg, 0, imageOrder); if (dierr != kDIErrNone) return dierr; - WMSG1(" OzDOS checking second half (swap=%d)\n", imageOrder); + LOGI(" OzDOS checking second half (swap=%d)", imageOrder); dierr = TestImageHalf(pImg, 1, imageOrder); if (dierr != kDIErrNone) return dierr; @@ -161,7 +161,7 @@ DiskFSOzDOS::TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, /* if a value is specified, try that first -- useful for OverrideFormat */ if (*pOrder != DiskImg::kSectorOrderUnknown) { if (TestImage(pImg, *pOrder) == kDIErrNone) { - WMSG0(" OzDOS accepted FirstTry value\n"); + LOGI(" OzDOS accepted FirstTry value"); return kDIErrNone; } } @@ -180,7 +180,7 @@ DiskFSOzDOS::TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, } } - WMSG0(" OzDOS didn't find valid FS\n"); + LOGI(" OzDOS didn't find valid FS"); return kDIErrFilesystemNotFound; } @@ -201,7 +201,7 @@ DiskFS::TestOzWideDOS33(const DiskImg* pImg, DiskImg::SectorOrder* pOrder) /* if a value is specified, try that first -- useful for OverrideFormat */ if (*pOrder != DiskImg::kSectorOrderUnknown) { if (TestImageHalf(pImg, 0, *pOrder) == kDIErrNone) { - WMSG0(" WideDOS accepted FirstTry value\n"); + LOGI(" WideDOS accepted FirstTry value"); return kDIErrNone; } } @@ -213,7 +213,7 @@ DiskFS::TestOzWideDOS33(const DiskImg* pImg, DiskImg::SectorOrder* pOrder) } else if (TestImageHalf(pImg, 0, DiskImg::kSectorOrderPhysical) == kDIErrNone) { *pOrder = DiskImg::kSectorOrderPhysical; } else { - WMSG0(" FS didn't find valid 'wide' DOS3.3\n"); + LOGI(" FS didn't find valid 'wide' DOS3.3"); return kDIErrFilesystemNotFound; } @@ -238,7 +238,7 @@ DiskFSOzDOS::Initialize(void) if (dierr != kDIErrNone) return dierr; } else { - WMSG0(" OzDOS not scanning for sub-volumes\n"); + LOGI(" OzDOS not scanning for sub-volumes"); } SetVolumeUsageMap(); @@ -266,7 +266,7 @@ DiskFSOzDOS::OpenSubVolume(int idx) dierr = pNewImg->OpenImage(fpImg, 0, 0, 2 * kExpectedTracks * kExpectedSectors); if (dierr != kDIErrNone) { - WMSG3(" OzSub: OpenImage(%d,0,%d) failed (err=%d)\n", + LOGI(" OzSub: OpenImage(%d,0,%d) failed (err=%d)", 0, 2 * kExpectedTracks * kExpectedSectors, dierr); goto bail; } @@ -274,26 +274,26 @@ DiskFSOzDOS::OpenSubVolume(int idx) assert(idx == 0 || idx == 1); pNewImg->SetPairedSectors(true, 1-idx); - WMSG1(" OzSub: testing for recognizable volume in idx=%d\n", idx); + LOGI(" OzSub: testing for recognizable volume in idx=%d", idx); dierr = pNewImg->AnalyzeImage(); if (dierr != kDIErrNone) { - WMSG1(" OzSub: analysis failed (err=%d)\n", dierr); + LOGI(" OzSub: analysis failed (err=%d)", dierr); goto bail; } if (pNewImg->GetFSFormat() == DiskImg::kFormatUnknown || pNewImg->GetSectorOrder() == DiskImg::kSectorOrderUnknown) { - WMSG0(" OzSub: unable to identify filesystem\n"); + LOGI(" OzSub: unable to identify filesystem"); dierr = kDIErrUnsupportedFSFmt; goto bail; } /* open a DiskFS for the sub-image */ - WMSG1(" UNISub %d succeeded!\n", idx); + LOGI(" UNISub %d succeeded!", idx); pNewFS = pNewImg->OpenAppropriateDiskFS(); if (pNewFS == NULL) { - WMSG0(" OzSub: OpenAppropriateDiskFS failed\n"); + LOGI(" OzSub: OpenAppropriateDiskFS failed"); dierr = kDIErrUnsupportedFSFmt; goto bail; } @@ -301,7 +301,7 @@ DiskFSOzDOS::OpenSubVolume(int idx) /* load the files from the sub-image */ dierr = pNewFS->Initialize(pNewImg, kInitFull); if (dierr != kDIErrNone) { - WMSG1(" OzSub: error %d reading list of files from disk", dierr); + LOGE(" OzSub: error %d reading list of files from disk", dierr); goto bail; } diff --git a/diskimg/Pascal.cpp b/diskimg/Pascal.cpp index fc72431..0cf8ca5 100644 --- a/diskimg/Pascal.cpp +++ b/diskimg/Pascal.cpp @@ -84,7 +84,7 @@ DiskFSPascal::TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, } } - WMSG0(" Pascal didn't find valid FS\n"); + LOGI(" Pascal didn't find valid FS"); return kDIErrFilesystemNotFound; } @@ -166,7 +166,7 @@ DiskFSPascal::LoadVolHeader(void) if (fTotalBlocks != fpImg->GetNumBlocks()) { // saw this most recently on a 40-track .APP image; not a problem - WMSG2(" Pascal WARNING: total (%u) != img (%ld)\n", + LOGI(" Pascal WARNING: total (%u) != img (%ld)", fTotalBlocks, fpImg->GetNumBlocks()); } @@ -212,18 +212,18 @@ DiskFSPascal::DumpVolHeader(void) { time_t access, dateSet; - WMSG1(" Pascal volume header for '%s'\n", fVolumeName); - WMSG2(" startBlock=%d nextBlock=%d\n", + LOGI(" Pascal volume header for '%s'", fVolumeName); + LOGI(" startBlock=%d nextBlock=%d", fStartBlock, fNextBlock); - WMSG4(" totalBlocks=%d numFiles=%d access=0x%04x dateSet=0x%04x\n", + LOGI(" totalBlocks=%d numFiles=%d access=0x%04x dateSet=0x%04x", fTotalBlocks, fNumFiles, fAccessWhen, fDateSetWhen); access = A2FilePascal::ConvertPascalDate(fAccessWhen); dateSet = A2FilePascal::ConvertPascalDate(fDateSetWhen); - WMSG1(" -->access %.24s\n", ctime(&access)); - WMSG1(" -->dateSet %.24s\n", ctime(&dateSet)); + LOGI(" -->access %.24s", ctime(&access)); + LOGI(" -->dateSet %.24s", ctime(&dateSet)); - //WMSG2("Unconvert access=0x%04x dateSet=0x%04x\n", + //LOGI("Unconvert access=0x%04x dateSet=0x%04x", // A2FilePascal::ConvertPascalDate(access), // A2FilePascal::ConvertPascalDate(dateSet)); } @@ -347,7 +347,7 @@ DiskFSPascal::ProcessCatalog(void) /* check bytesRem before setting length field */ if (pFile->fBytesRemaining > kBlkSize) { - WMSG2(" Pascal found strange bytesRem %u on '%s', trimming\n", + LOGI(" Pascal found strange bytesRem %u on '%s', trimming", pFile->fBytesRemaining, pFile->fFileName); pFile->fBytesRemaining = kBlkSize; pFile->SetQuality(A2File::kQualitySuspicious); @@ -360,23 +360,23 @@ DiskFSPascal::ProcessCatalog(void) * Check values. */ if (pFile->fStartBlock == pFile->fNextBlock) { - WMSG1(" Pascal found zero-block file '%s'\n", pFile->fFileName); + LOGI(" Pascal found zero-block file '%s'", pFile->fFileName); pFile->SetQuality(A2File::kQualityDamaged); } if (pFile->fStartBlock < prevNextBlock) { - WMSG3(" Pascal start of '%s' (%d) overlaps previous end (%d)\n", + LOGI(" Pascal start of '%s' (%d) overlaps previous end (%d)", pFile->fFileName, pFile->fStartBlock, prevNextBlock); pFile->SetQuality(A2File::kQualityDamaged); } if (pFile->fNextBlock > fpImg->GetNumBlocks()) { - WMSG3(" Pascal invalid 'next' block %d (max %ld) '%s'\n", + LOGI(" Pascal invalid 'next' block %d (max %ld) '%s'", pFile->fNextBlock, fpImg->GetNumBlocks(), pFile->fFileName); pFile->fStartBlock = pFile->fNextBlock = 0; pFile->fLength = 0; pFile->SetQuality(A2File::kQualityDamaged); } else if (pFile->fNextBlock > fTotalBlocks) { - WMSG3(" Pascal 'next' block %d exceeds max (%d) '%s'\n", + LOGI(" Pascal 'next' block %d exceeds max (%d) '%s'", pFile->fNextBlock, fTotalBlocks, pFile->fFileName); pFile->SetQuality(A2File::kQualitySuspicious); } @@ -434,7 +434,7 @@ DiskFSPascal::SetBlockUsage(long block, VolumeUsage::ChunkPurpose purpose) fVolumeUsage.GetChunkState(block, &cstate); if (cstate.isUsed) { cstate.purpose = VolumeUsage::kChunkPurposeConflict; - WMSG1(" Pascal conflicting uses for bl=%ld\n", block); + LOGI(" Pascal conflicting uses for bl=%ld", block); } else { cstate.isUsed = true; cstate.isMarkedUsed = true; @@ -513,7 +513,7 @@ DiskFSPascal::Format(DiskImg* pDiskImg, const char* volName) assert(fpImg == NULL); SetDiskImg(pDiskImg); - WMSG0(" Pascal formatting disk image\n"); + LOGI(" Pascal formatting disk image"); /* write ProDOS-style blocks */ dierr = fpImg->OverrideFormat(fpImg->GetPhysicalFormat(), @@ -523,7 +523,7 @@ DiskFSPascal::Format(DiskImg* pDiskImg, const char* volName) formatBlocks = pDiskImg->GetNumBlocks(); if (formatBlocks != 280 && formatBlocks != 1600) { - WMSG1(" Pascal: rejecting format req blocks=%ld\n", formatBlocks); + LOGI(" Pascal: rejecting format req blocks=%ld", formatBlocks); assert(false); return kDIErrInvalidArg; } @@ -533,7 +533,7 @@ DiskFSPascal::Format(DiskImg* pDiskImg, const char* volName) * on new disk images, so there's no need to do it here. */ // dierr = fpImg->ZeroImage(); - WMSG0(" Pascal (not zeroing blocks)\n"); + LOGI(" Pascal (not zeroing blocks)"); /* * Start by writing blocks 0 and 1 (the boot blocks). The file @@ -558,7 +558,7 @@ DiskFSPascal::Format(DiskImg* pDiskImg, const char* volName) PutShortLE(&blkBuf[0x14], 0xa87b); // last date set (Nov 7 1984) dierr = fpImg->WriteBlock(kVolHeaderBlock, blkBuf); if (dierr != kDIErrNone) { - WMSG2(" Format: block %d write failed (err=%d)\n", + LOGI(" Format: block %d write failed (err=%d)", kVolHeaderBlock, dierr); goto bail; } @@ -566,7 +566,7 @@ DiskFSPascal::Format(DiskImg* pDiskImg, const char* volName) /* check our work, and set some object fields, by reading what we wrote */ dierr = LoadVolHeader(); if (dierr != kDIErrNone) { - WMSG1(" GLITCH: couldn't read header we just wrote (err=%d)\n", dierr); + LOGI(" GLITCH: couldn't read header we just wrote (err=%d)", dierr); goto bail; } @@ -738,7 +738,7 @@ DiskFSPascal::WriteBootBlocks(void) else if (fpImg->GetNumBlocks() == 1600) is525 = false; else { - WMSG1(" Pascal boot blocks for blocks=%ld unknown\n", + LOGI(" Pascal boot blocks for blocks=%ld unknown", fpImg->GetNumBlocks()); return kDIErrInternal; } @@ -753,12 +753,12 @@ DiskFSPascal::WriteBootBlocks(void) dierr = fpImg->WriteBlock(0, block0); if (dierr != kDIErrNone) { - WMSG1(" WriteBootBlocks: block0 write failed (err=%d)\n", dierr); + LOGI(" WriteBootBlocks: block0 write failed (err=%d)", dierr); return dierr; } dierr = fpImg->WriteBlock(1, block1); if (dierr != kDIErrNone) { - WMSG1(" WriteBootBlocks: block1 write failed (err=%d)\n", dierr); + LOGI(" WriteBootBlocks: block1 write failed (err=%d)", dierr); return dierr; } @@ -928,13 +928,13 @@ DiskFSPascal::CreateFile(const CreateParms* pParms, A2File** ppNewFile) assert(pParms != NULL); assert(pParms->pathName != NULL); assert(pParms->storageType == A2FileProDOS::kStorageSeedling); - WMSG1(" Pascal ---v--- CreateFile '%s'\n", pParms->pathName); + LOGI(" Pascal ---v--- CreateFile '%s'", pParms->pathName); /* compute maxFiles, which includes the vol dir header */ int maxFiles = ((fNextBlock - kVolHeaderBlock) * kBlkSize) / kDirectoryEntryLen; if (fNumFiles >= maxFiles-1) { - WMSG1("Pascal volume directory full (%d entries)\n", fNumFiles); + LOGI("Pascal volume directory full (%d entries)", fNumFiles); return kDIErrVolumeDirFull; } @@ -952,7 +952,7 @@ DiskFSPascal::CreateFile(const CreateParms* pParms, A2File** ppNewFile) MakeFileNameUnique(normalName); } else { if (GetFileByName(normalName) != NULL) { - WMSG1(" Pascal create: normalized name '%s' already exists\n", + LOGI(" Pascal create: normalized name '%s' already exists", normalName); dierr = kDIErrFileExists; goto bail; @@ -1005,7 +1005,7 @@ DiskFSPascal::CreateFile(const CreateParms* pParms, A2File** ppNewFile) goto bail; if (fNumFiles > prevIdx) { - WMSG1(" Pascal sliding last %d entries down a slot\n", + LOGI(" Pascal sliding last %d entries down a slot", fNumFiles - prevIdx); memmove(fDirectory + (prevIdx+2) * kDirectoryEntryLen, fDirectory + (prevIdx+1) * kDirectoryEntryLen, @@ -1074,7 +1074,7 @@ DiskFSPascal::MakeFileNameUnique(char* fileName) if (GetFileByName(fileName) == NULL) return kDIErrNone; - WMSG1(" Pascal found duplicate of '%s', making unique\n", fileName); + LOGI(" Pascal found duplicate of '%s', making unique", fileName); int nameLen = strlen(fileName); int dotOffset=0, dotLen=0; @@ -1091,7 +1091,7 @@ DiskFSPascal::MakeFileNameUnique(char* fileName) if (cp != NULL) { int tmpOffset = cp - fileName; if (tmpOffset > 0 && nameLen - tmpOffset <= kMaxExtensionLen) { - WMSG1(" Pascal (keeping extension '%s')\n", cp); + LOGI(" Pascal (keeping extension '%s')", cp); assert(strlen(cp) <= kMaxExtensionLen); strcpy(dotBuf, cp); dotOffset = tmpOffset; @@ -1121,7 +1121,7 @@ DiskFSPascal::MakeFileNameUnique(char* fileName) memcpy(fileName + copyOffset + digitLen, dotBuf, dotLen); } while (GetFileByName(fileName) != NULL); - WMSG1(" Pascal converted to unique name: %s\n", fileName); + LOGI(" Pascal converted to unique name: %s", fileName); return kDIErrNone; } @@ -1170,7 +1170,7 @@ DiskFSPascal::FindLargestFreeArea(int *pPrevIdx, A2FilePascal** ppPrevFile) *ppPrevFile = pPrevFile; } - WMSG3("Pascal largest gap after entry %d '%s' (size=%d)\n", + LOGI("Pascal largest gap after entry %d '%s' (size=%d)", maxIndex, *ppPrevFile != NULL ? (*ppPrevFile)->GetPathName() : "(root)", maxGap); @@ -1206,7 +1206,7 @@ DiskFSPascal::DeleteFile(A2File* pGenericFile) if (pGenericFile->IsFileOpen()) return kDIErrFileOpen; - WMSG1(" Pascal deleting '%s'\n", pFile->GetPathName()); + LOGI(" Pascal deleting '%s'", pFile->GetPathName()); dierr = LoadCatalog(); if (dierr != kDIErrNone) @@ -1221,7 +1221,7 @@ DiskFSPascal::DeleteFile(A2File* pGenericFile) dirLen = (fNumFiles+1) * kDirectoryEntryLen; offsetToNextEntry = (pEntry - fDirectory) + kDirectoryEntryLen; if (dirLen == offsetToNextEntry) { - WMSG0("+++ removing last entry\n"); + LOGI("+++ removing last entry"); } else { memmove(pEntry, pEntry+kDirectoryEntryLen, dirLen - offsetToNextEntry); } @@ -1269,7 +1269,7 @@ DiskFSPascal::RenameFile(A2File* pGenericFile, const char* newName) DoNormalizePath(newName, '\0', normalName); - WMSG2(" Pascal renaming '%s' to '%s'\n", pFile->GetPathName(), normalName); + LOGI(" Pascal renaming '%s' to '%s'", pFile->GetPathName(), normalName); dierr = LoadCatalog(); if (dierr != kDIErrNone) @@ -1317,7 +1317,7 @@ DiskFSPascal::SetFileInfo(A2File* pGenericFile, long fileType, long auxType, if (!fDiskIsGood) return kDIErrBadDiskImage; - WMSG2("Pascal SetFileInfo '%s' fileType=0x%04lx\n", + LOGI("Pascal SetFileInfo '%s' fileType=0x%04lx", pFile->GetPathName(), fileType); dierr = LoadCatalog(); @@ -1402,7 +1402,7 @@ DiskFSPascal::FindDirEntry(A2FilePascal* pFile) if (GetShortLE(&ptr[0x00]) == pFile->fStartBlock) { if (memcmp(&ptr[0x07], pFile->fFileName, ptr[0x06]) != 0) { assert(false); - WMSG2("name/block mismatch on '%s' %d\n", + LOGI("name/block mismatch on '%s' %d", pFile->GetPathName(), pFile->fStartBlock); return NULL; } @@ -1437,7 +1437,7 @@ A2FilePascal::GetFileType(void) const case kTypeFoto: return 0x08; // FOT case kTypeSecurdir: return 0xf5; // no idea default: - WMSG1("Pascal WARNING: found invalid file type %d\n", fFileType); + LOGI("Pascal WARNING: found invalid file type %d", fFileType); return 0; } } @@ -1495,7 +1495,7 @@ A2FilePascal::ConvertPascalDate(PascalDate pascalDate) year = (pascalDate >> 9) & 0x7f; if (year == 100) { // ought to mark the file as "suspicious"? - WMSG0("Pascal WARNING: date with year=100\n"); + LOGI("Pascal WARNING: date with year=100"); } if (year < 40) year += 100; @@ -1541,7 +1541,7 @@ A2FilePascal::ConvertPascalDate(time_t unixDate) if (year >= 100) year -= 100; if (year < 0 || year >= 100) { - WMSG2("WHOOPS: got year %lu from %d\n", year, ptm->tm_year); + LOGI("WHOOPS: got year %lu from %d", year, ptm->tm_year); year = 70; } date = year << 9 | (ptm->tm_mon+1) | ptm->tm_mday << 4; @@ -1564,10 +1564,10 @@ A2FilePascal::GetModWhen(void) const void A2FilePascal::Dump(void) const { - WMSG1("A2FilePascal '%s'\n", fFileName); - WMSG3(" start=%d next=%d type=%d\n", + LOGI("A2FilePascal '%s'", fFileName); + LOGI(" start=%d next=%d type=%d", fStartBlock, fNextBlock, fFileType); - WMSG2(" bytesRem=%d modWhen=0x%04x\n", + LOGI(" bytesRem=%d modWhen=0x%04x", fBytesRemaining, fModWhen); } @@ -1617,7 +1617,7 @@ A2FilePascal::Open(A2FileDescr** ppOpenFile, bool readOnly, DIError A2FDPascal::Read(void* buf, size_t len, size_t* pActual) { - WMSG3(" Pascal reading %d bytes from '%s' (offset=%ld)\n", + LOGI(" Pascal reading %d bytes from '%s' (offset=%ld)", len, fpFile->GetPathName(), (long) fOffset); A2FilePascal* pFile = (A2FilePascal*) fpFile; @@ -1647,7 +1647,7 @@ A2FDPascal::Read(void* buf, size_t len, size_t* pActual) dierr = pFile->GetDiskFS()->GetDiskImg()->ReadBlock(block, blkBuf); if (dierr != kDIErrNone) { - WMSG1(" Pascal error reading file '%s'\n", pFile->fFileName); + LOGI(" Pascal error reading file '%s'", pFile->fFileName); return dierr; } thisCount = kBlkSize - bufOffset; @@ -1683,7 +1683,7 @@ A2FDPascal::Write(const void* buf, size_t len, size_t* pActual) unsigned char blkBuf[kBlkSize]; size_t origLen = len; - WMSG2(" DOS Write len=%u %s\n", len, pFile->GetPathName()); + LOGI(" DOS Write len=%u %s", len, pFile->GetPathName()); if (len >= 0x01000000) { // 16MB assert(false); @@ -1708,7 +1708,7 @@ A2FDPascal::Write(const void* buf, size_t len, size_t* pActual) blocksAvail = pNextFile->fStartBlock - pFile->fStartBlock; blocksNeeded = (len + kBlkSize -1) / kBlkSize; - WMSG4("Pascal write '%s' %d bytes: avail=%ld needed=%ld\n", + LOGI("Pascal write '%s' %d bytes: avail=%ld needed=%ld", pFile->GetPathName(), len, blocksAvail, blocksNeeded); if (blocksAvail < blocksNeeded) return kDIErrDiskFull; diff --git a/diskimg/ProDOS.cpp b/diskimg/ProDOS.cpp index db7e934..c2bf9c1 100644 --- a/diskimg/ProDOS.cpp +++ b/diskimg/ProDOS.cpp @@ -123,7 +123,7 @@ DiskFSProDOS::TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, } } - WMSG0(" ProDOS didn't find valid FS\n"); + LOGI(" ProDOS didn't find valid FS"); return kDIErrFilesystemNotFound; } @@ -161,13 +161,13 @@ DiskFSProDOS::Initialize(InitMode initMode) goto bail; if (initMode == kInitHeaderOnly) { - WMSG0(" ProDOS - headerOnly set, skipping file load\n"); + LOGI(" ProDOS - headerOnly set, skipping file load"); goto bail; } sprintf(msg, "Scanning %s", fVolumeName); if (!fpImg->UpdateScanProgress(msg)) { - WMSG0(" ProDOS cancelled by user\n"); + LOGI(" ProDOS cancelled by user"); dierr = kDIErrCancelled; goto bail; } @@ -178,13 +178,13 @@ DiskFSProDOS::Initialize(InitMode initMode) dierr = RecursiveDirAdd(pVolumeDir, kVolHeaderBlock, "", 0); if (dierr != kDIErrNone) { - WMSG0(" ProDOS RecursiveDirAdd failed\n"); + LOGI(" ProDOS RecursiveDirAdd failed"); goto bail; } sprintf(msg, "Processing %s", fVolumeName); if (!fpImg->UpdateScanProgress(msg)) { - WMSG0(" ProDOS cancelled by user\n"); + LOGI(" ProDOS cancelled by user"); dierr = kDIErrCancelled; goto bail; } @@ -195,7 +195,7 @@ DiskFSProDOS::Initialize(InitMode initMode) goto bail; /* this might not be fatal; just means that *some* files are bad */ - WMSG1("WARNING: ScanFileUsage returned err=%d\n", dierr); + LOGI("WARNING: ScanFileUsage returned err=%d", dierr); dierr = kDIErrNone; fpImg->AddNote(DiskImg::kNoteWarning, "Some errors were encountered while scanning files."); @@ -283,7 +283,7 @@ DiskFSProDOS::LoadVolHeader(void) if (fTotalBlocks <= kVolHeaderBlock) { /* incr to min; don't use max, or bitmap count may be too large */ - WMSG1(" ProDOS found tiny fTotalBlocks (%d), increasing to minimum\n", + LOGI(" ProDOS found tiny fTotalBlocks (%d), increasing to minimum", fTotalBlocks); fpImg->AddNote(DiskImg::kNoteWarning, "ProDOS filesystem blockcount (%d) too small, setting to %d.", @@ -292,7 +292,7 @@ DiskFSProDOS::LoadVolHeader(void) fEarlyDamage = true; } else if (fTotalBlocks != fpImg->GetNumBlocks()) { if (fTotalBlocks != 65535 || fpImg->GetNumBlocks() != 65536) { - WMSG2(" ProDOS WARNING: total (%u) != img (%ld)\n", + LOGI(" ProDOS WARNING: total (%u) != img (%ld)", fTotalBlocks, fpImg->GetNumBlocks()); // could AddNote here, but not really necessary } @@ -355,7 +355,7 @@ DiskFSProDOS::LoadVolHeader(void) int foundStorage; foundStorage = (blkBuf[0x04] & 0xf0) >> 4; if (foundStorage != A2FileProDOS::kStorageVolumeDirHeader) { - WMSG1(" ProDOS WARNING: unexpected vol dir file type %d\n", + LOGI(" ProDOS WARNING: unexpected vol dir file type %d", pEntry->storageType); /* keep going */ } @@ -404,20 +404,20 @@ DiskFSProDOS::SetVolumeID(void) void DiskFSProDOS::DumpVolHeader(void) { - WMSG1(" ProDOS volume header for '%s'\n", fVolumeName); - WMSG4(" CreateWhen=0x%08lx access=0x%02x bitmap=%d totalbl=%d\n", + LOGI(" ProDOS volume header for '%s'", fVolumeName); + LOGI(" CreateWhen=0x%08lx access=0x%02x bitmap=%d totalbl=%d", fCreateWhen, fAccess, fBitMapPointer, fTotalBlocks); time_t when; when = A2FileProDOS::ConvertProDate(fCreateWhen); - WMSG1(" CreateWhen is %.24s\n", ctime(&when)); + LOGI(" CreateWhen is %.24s", ctime(&when)); - //WMSG4(" prev=%d next=%d bitmap=%d total=%d\n", + //LOGI(" prev=%d next=%d bitmap=%d total=%d", // fPrevBlock, fNextBlock, fBitMapPointer, fTotalBlocks); - //WMSG2(" create date=0x%08lx access=0x%02x\n", fCreateWhen, fAccess); - //WMSG4(" version=%d minVersion=%d entryLen=%d epb=%d\n", + //LOGI(" create date=0x%08lx access=0x%02x", fCreateWhen, fAccess); + //LOGI(" version=%d minVersion=%d entryLen=%d epb=%d", // fVersion, fMinVersion, fEntryLength, fEntriesPerBlock); - //WMSG1(" volume dir fileCount=%d\n", fFileCount); + //LOGI(" volume dir fileCount=%d", fFileCount); } @@ -517,7 +517,7 @@ DiskFSProDOS::ScanVolBitmap(void) dierr = LoadVolBitmap(); if (dierr != kDIErrNone) { - WMSG1(" ProDOS failed to load volume bitmap (err=%d)\n", dierr); + LOGI(" ProDOS failed to load volume bitmap (err=%d)", dierr); return dierr; } @@ -665,7 +665,7 @@ DiskFSProDOS::ScanForExtraEntries(void) const while (offset < endOffset) { if (fBlockUseMap[offset] != 0) { - WMSG2(" ProDOS found bogus bitmap junk 0x%02x at offset=%d\n", + LOGI(" ProDOS found bogus bitmap junk 0x%02x at offset=%d", fBlockUseMap[offset], offset); return true; } @@ -722,14 +722,14 @@ DiskFSProDOS::AllocBlock(void) assert(!GetBlockUseEntry(block)); SetBlockUseEntry(block, true); if (block == 0 || block == 1) { - WMSG0("PRODOS: GLITCH: rejecting alloc of block 0\n"); + LOGI("PRODOS: GLITCH: rejecting alloc of block 0"); continue; } return block; } } - WMSG0("ProDOS: NOTE: AllocBlock just failed!\n"); + LOGI("ProDOS: NOTE: AllocBlock just failed!"); return -1; } @@ -775,7 +775,7 @@ DiskFSProDOS::SetBlockUsage(long block, VolumeUsage::ChunkPurpose purpose) fVolumeUsage.GetChunkState(block, &cstate); if (cstate.isUsed) { cstate.purpose = VolumeUsage::kChunkPurposeConflict; - WMSG1(" ProDOS conflicting uses for bl=%ld\n", block); + LOGI(" ProDOS conflicting uses for bl=%ld", block); } else { cstate.isUsed = true; cstate.purpose = purpose; @@ -806,7 +806,7 @@ DiskFSProDOS::RecursiveDirAdd(A2File* pParent, unsigned short dirBlock, if (dirBlock < kVolHeaderBlock || dirBlock >= fpImg->GetNumBlocks()) { - WMSG1(" ProDOS ERROR: directory block %u out of range\n", dirBlock); + LOGI(" ProDOS ERROR: directory block %u out of range", dirBlock); dierr = kDIErrInvalidBlock; goto bail; } @@ -831,7 +831,7 @@ DiskFSProDOS::RecursiveDirAdd(A2File* pParent, unsigned short dirBlock, if (dierr != kDIErrNone) goto bail; numEntries = header.fileCount; - //WMSG1(" ProDOS got dir header numEntries = %d\n", numEntries); + //LOGI(" ProDOS got dir header numEntries = %d", numEntries); } /* slurp the entries out of this block */ @@ -844,7 +844,7 @@ DiskFSProDOS::RecursiveDirAdd(A2File* pParent, unsigned short dirBlock, if (dirBlock != 0 && (dirBlock < 2 || dirBlock >= fpImg->GetNumBlocks())) { - WMSG2(" ProDOS ERROR: invalid dir link block %u in base='%s'\n", + LOGI(" ProDOS ERROR: invalid dir link block %u in base='%s'", dirBlock, basePath); dierr = kDIErrInvalidBlock; goto bail; @@ -853,13 +853,13 @@ DiskFSProDOS::RecursiveDirAdd(A2File* pParent, unsigned short dirBlock, iterations++; } if (iterations == kMaxCatalogIterations) { - WMSG0(" ProDOS subdir iteration count exceeded\n"); + LOGI(" ProDOS subdir iteration count exceeded"); dierr = kDIErrDirectoryLoop; goto bail; } if (foundCount != numEntries) { /* not significant; just means somebody isn't updating correctly */ - WMSG3(" ProDOS WARNING: numEntries=%d foundCount=%d in base='%s'\n", + LOGI(" ProDOS WARNING: numEntries=%d foundCount=%d in base='%s'", numEntries, foundCount, basePath); } @@ -896,7 +896,7 @@ DiskFSProDOS::SlurpEntries(A2File* pParent, const DirHeader* pHeader, entriesThisBlock--, idx++, entryBuf += pHeader->entryLength) { if (entryBuf >= blkBuf + kBlkSize) { - WMSG0(" ProDOS whoops, just walked out of dirent buffer\n"); + LOGI(" ProDOS whoops, just walked out of dirent buffer"); return kDIErrBadDirectory; } @@ -922,7 +922,7 @@ DiskFSProDOS::SlurpEntries(A2File* pParent, const DirHeader* pHeader, pFile->SetPathName(basePath, pEntry->fileName); if (pEntry->keyPointer <= kVolHeaderBlock) { - WMSG2("ProDOS invalid key pointer %d on '%s'\n", + LOGI("ProDOS invalid key pointer %d on '%s'", pEntry->keyPointer, pFile->GetPathName()); pFile->SetQuality(A2File::kQualityDamaged); } else @@ -939,7 +939,7 @@ DiskFSProDOS::SlurpEntries(A2File* pParent, const DirHeader* pHeader, (*pCount)++; if (!fpImg->UpdateScanProgress(NULL)) { - WMSG0(" ProDOS cancelled by user\n"); + LOGI(" ProDOS cancelled by user"); dierr = kDIErrCancelled; goto bail; } @@ -976,7 +976,7 @@ DiskFSProDOS::GetDirHeader(const unsigned char* blkBuf, DirHeader* pHeader) if (pHeader->storageType != A2FileProDOS::kStorageSubdirHeader && pHeader->storageType != A2FileProDOS::kStorageVolumeDirHeader) { - WMSG1(" ProDOS WARNING: subdir header has wrong storage type (%d)\n", + LOGI(" ProDOS WARNING: subdir header has wrong storage type (%d)", pHeader->storageType); /* keep going... might be bad idea */ } @@ -997,7 +997,7 @@ DiskFSProDOS::GetDirHeader(const unsigned char* blkBuf, DirHeader* pHeader) if (pHeader->entryLength * pHeader->entriesPerBlock > kBlkSize || pHeader->entryLength * pHeader->entriesPerBlock == 0) { - WMSG2(" ProDOS invalid subdir header: entryLen=%d, entriesPerBlock=%d\n", + LOGI(" ProDOS invalid subdir header: entryLen=%d, entriesPerBlock=%d", pHeader->entryLength, pHeader->entriesPerBlock); return kDIErrBadDirectory; } @@ -1019,7 +1019,7 @@ DiskFSProDOS::ReadExtendedInfo(A2FileProDOS* pFile) dierr = fpImg->ReadBlock(pFile->fDirEntry.keyPointer, blkBuf); if (dierr != kDIErrNone) { - WMSG1(" ProDOS ReadExtendedInfo: unable to read key block %d\n", + LOGI(" ProDOS ReadExtendedInfo: unable to read key block %d", pFile->fDirEntry.keyPointer); goto bail; } @@ -1039,7 +1039,7 @@ DiskFSProDOS::ReadExtendedInfo(A2FileProDOS* pFile) if (pFile->fExtData.keyBlock <= kVolHeaderBlock || pFile->fExtRsrc.keyBlock <= kVolHeaderBlock) { - WMSG2(" ProDOS ReadExtendedInfo: found bad extended key blocks %d/%d\n", + LOGI(" ProDOS ReadExtendedInfo: found bad extended key blocks %d/%d", pFile->fExtData.keyBlock, pFile->fExtRsrc.keyBlock); return kDIErrBadFile; } @@ -1067,7 +1067,7 @@ DiskFSProDOS::ScanFileUsage(void) pFile = (A2FileProDOS*) GetNextFile(NULL); while (pFile != NULL) { if (!fpImg->UpdateScanProgress(NULL)) { - WMSG0(" ProDOS cancelled by user\n"); + LOGI(" ProDOS cancelled by user"); dierr = kDIErrCancelled; goto bail; } @@ -1087,7 +1087,7 @@ DiskFSProDOS::ScanFileUsage(void) &blockCount, &blockList, &indexCount, &indexList); } if (dierr != kDIErrNone) { - WMSG1(" ProDOS skipping scan rsrc '%s'\n", + LOGI(" ProDOS skipping scan rsrc '%s'", pFile->fDirEntry.fileName); pFile->SetQuality(A2File::kQualityDamaged); goto skip; @@ -1096,7 +1096,7 @@ DiskFSProDOS::ScanFileUsage(void) &sparseCount); pFile->fSparseRsrcEof = (di_off_t) pFile->fExtRsrc.eof - sparseCount * kBlkSize; - //WMSG3(" SparseCount %d rsrcEof %d '%s'\n", + //LOGI(" SparseCount %d rsrcEof %d '%s'", // sparseCount, pFile->fSparseRsrcEof, pFile->fDirEntry.fileName); delete[] blockList; blockList = NULL; @@ -1112,7 +1112,7 @@ DiskFSProDOS::ScanFileUsage(void) &blockCount, &blockList, &indexCount, &indexList); } if (dierr != kDIErrNone) { - WMSG1(" ProDOS skipping scan data '%s'\n", + LOGI(" ProDOS skipping scan data '%s'", pFile->fDirEntry.fileName); pFile->SetQuality(A2File::kQualityDamaged); goto skip; @@ -1121,7 +1121,7 @@ DiskFSProDOS::ScanFileUsage(void) &sparseCount); pFile->fSparseDataEof = (di_off_t) pFile->fExtData.eof - sparseCount * kBlkSize; - //WMSG3(" SparseCount %d dataEof %d '%s'\n", + //LOGI(" SparseCount %d dataEof %d '%s'", // sparseCount, pFile->fSparseDataEof, pFile->fDirEntry.fileName); delete[] blockList; blockList = NULL; @@ -1147,7 +1147,7 @@ DiskFSProDOS::ScanFileUsage(void) pFile->fDirEntry.keyPointer, pFile->fDirEntry.eof, &blockCount, &blockList, &indexCount, &indexList); if (dierr != kDIErrNone) { - WMSG1(" ProDOS skipping scan '%s'\n", + LOGI(" ProDOS skipping scan '%s'", pFile->fDirEntry.fileName); pFile->SetQuality(A2File::kQualityDamaged); goto skip; @@ -1156,7 +1156,7 @@ DiskFSProDOS::ScanFileUsage(void) &sparseCount); pFile->fSparseDataEof = (di_off_t) pFile->fDirEntry.eof - sparseCount * kBlkSize; - //WMSG4(" +++ sparseCount=%ld blockCount=%ld sparseDataEof=%ld '%s'\n", + //LOGI(" +++ sparseCount=%ld blockCount=%ld sparseDataEof=%ld '%s'", // sparseCount, blockCount, (long) pFile->fSparseDataEof, // pFile->fDirEntry.fileName); @@ -1165,7 +1165,7 @@ DiskFSProDOS::ScanFileUsage(void) delete[] indexList; indexList = NULL; } else { - WMSG2(" ProDOS found weird storage type %d on '%s', ignoring\n", + LOGI(" ProDOS found weird storage type %d on '%s', ignoring", pFile->fDirEntry.storageType, pFile->fDirEntry.fileName); pFile->SetQuality(A2File::kQualityDamaged); } @@ -1178,7 +1178,7 @@ DiskFSProDOS::ScanFileUsage(void) * here. */ //if (stricmp(pFile->fDirEntry.fileName, "EMPTY.SPARSE.R") == 0) - // WMSG0("wahoo\n"); + // LOGI("wahoo"); if (pFile->fSparseDataEof < 0) pFile->fSparseDataEof = 0; if (pFile->fSparseRsrcEof < 0) @@ -1245,7 +1245,7 @@ DiskFSProDOS::ScanForSubVolumes(void) assert(fTotalBlocks <= fpImg->GetNumBlocks()); if (fTotalBlocks != 1600) { - WMSG1(" ProDOS ScanForSub: not 800K disk (%ld)\n", + LOGI(" ProDOS ScanForSub: not 800K disk (%ld)", fpImg->GetNumBlocks()); return kDIErrNone; // only scan 800K disks } @@ -1264,11 +1264,11 @@ DiskFSProDOS::ScanForSubVolumes(void) } firstBlock = block+1; - WMSG1("MATCH COUNT %d\n", matchCount); + LOGI("MATCH COUNT %d", matchCount); if (matchCount < 35*8) // 280 blocks on 35-track floppy return kDIErrNone; //if (matchCount % 8 != 0) { // must have 4K tracks - // WMSG1(" ProDOS ScanForSub: matchCount %d odd number\n", + // LOGI(" ProDOS ScanForSub: matchCount %d odd number", // matchCount); // return kDIErrNone; //} @@ -1279,7 +1279,7 @@ DiskFSProDOS::ScanForSubVolumes(void) if ((matchCount % 8) == 0 && matchCount <= (50*8)) { // max 50 tracks DiskFS* pNewFS = NULL; DiskImg* pNewImg = NULL; - WMSG0(" Sub #1: looking for single DOS volume\n"); + LOGI(" Sub #1: looking for single DOS volume"); dierr = FindSubVolume(firstBlock, matchCount, &pNewImg, &pNewFS); if (dierr == kDIErrNone) { AddSubVolumeToList(pNewImg, pNewFS); @@ -1301,13 +1301,13 @@ DiskFSProDOS::ScanForSubVolumes(void) bool found = false; count = matchCount / kBlkCount140; - WMSG1(" Sub #2: looking for %d 140K volumes\n", + LOGI(" Sub #2: looking for %d 140K volumes", matchCount / kBlkCount140); for (i = 0; i < count; i++) { DiskFS* pNewFS = NULL; DiskImg* pNewImg = NULL; - WMSG1(" Sub #2: looking for DOS volume at (%d)\n", + LOGI(" Sub #2: looking for DOS volume at (%d)", firstBlock + i * kBlkCount140); dierr = FindSubVolume(firstBlock + i * kBlkCount140, kBlkCount140, &pNewImg, &pNewFS); @@ -1339,13 +1339,13 @@ DiskFSProDOS::ScanForSubVolumes(void) bool found = false; count = 1600 / kBlkCount160; - WMSG1(" Sub #3: looking for %d 160K volumes\n", + LOGI(" Sub #3: looking for %d 160K volumes", matchCount / kBlkCount160); for (i = 0; i < count; i++) { DiskFS* pNewFS = NULL; DiskImg* pNewImg = NULL; - WMSG1(" Sub #3: looking for DOS volume at (%d)\n", + LOGI(" Sub #3: looking for DOS volume at (%d)", i * kBlkCount160); dierr = FindSubVolume(i * kBlkCount160, kBlkCount160, &pNewImg, &pNewFS); @@ -1393,30 +1393,30 @@ DiskFSProDOS::FindSubVolume(long blockStart, long blockCount, dierr = pNewImg->OpenImage(fpImg, blockStart, blockCount); if (dierr != kDIErrNone) { - WMSG3(" Sub: OpenImage(%ld,%ld) failed (err=%d)\n", + LOGI(" Sub: OpenImage(%ld,%ld) failed (err=%d)", blockStart, blockCount, dierr); goto bail; } dierr = pNewImg->AnalyzeImage(); if (dierr != kDIErrNone) { - WMSG1(" Sub: analysis failed (err=%d)\n", dierr); + LOGI(" Sub: analysis failed (err=%d)", dierr); goto bail; } if (pNewImg->GetFSFormat() == DiskImg::kFormatUnknown || pNewImg->GetSectorOrder() == DiskImg::kSectorOrderUnknown) { - WMSG0(" Sub: unable to identify filesystem\n"); + LOGI(" Sub: unable to identify filesystem"); dierr = kDIErrFilesystemNotFound; goto bail; } /* open a DiskFS for the sub-image */ - WMSG0(" Sub DiskImg succeeded, opening DiskFS\n"); + LOGI(" Sub DiskImg succeeded, opening DiskFS"); pNewFS = pNewImg->OpenAppropriateDiskFS(); if (pNewFS == NULL) { - WMSG0(" Sub: OpenAppropriateDiskFS failed\n"); + LOGI(" Sub: OpenAppropriateDiskFS failed"); dierr = kDIErrUnsupportedFSFmt; goto bail; } @@ -1424,7 +1424,7 @@ DiskFSProDOS::FindSubVolume(long blockStart, long blockCount, /* load the files from the sub-image */ dierr = pNewFS->Initialize(pNewImg, kInitFull); if (dierr != kDIErrNone) { - WMSG1(" Sub: error %d reading list of files from disk", dierr); + LOGE(" Sub: error %d reading list of files from disk", dierr); goto bail; } @@ -1485,7 +1485,7 @@ DiskFSProDOS::Format(DiskImg* pDiskImg, const char* volName) assert(fpImg == NULL); SetDiskImg(pDiskImg); - WMSG0(" ProDOS formatting disk image\n"); + LOGI(" ProDOS formatting disk image"); /* write ProDOS blocks */ dierr = fpImg->OverrideFormat(fpImg->GetPhysicalFormat(), @@ -1495,12 +1495,12 @@ DiskFSProDOS::Format(DiskImg* pDiskImg, const char* volName) formatBlocks = pDiskImg->GetNumBlocks(); if (formatBlocks > 65536) { - WMSG1(" ProDOS: rejecting format req blocks=%ld\n", formatBlocks); + LOGI(" ProDOS: rejecting format req blocks=%ld", formatBlocks); assert(false); return kDIErrInvalidArg; } if (formatBlocks == 65536) { - WMSG0(" ProDOS: trimming FS size from 65536 to 65535\n"); + LOGI(" ProDOS: trimming FS size from 65536 to 65535"); formatBlocks = 65535; } @@ -1512,7 +1512,7 @@ DiskFSProDOS::Format(DiskImg* pDiskImg, const char* volName) * to skip it here. */ // dierr = fpImg->ZeroImage(); - WMSG0(" ProDOS (not zeroing blocks)\n"); + LOGI(" ProDOS (not zeroing blocks)"); /* * Start by writing blocks 0 and 1 (the boot blocks). This is done from @@ -1541,7 +1541,7 @@ DiskFSProDOS::Format(DiskImg* pDiskImg, const char* volName) dierr = fpImg->WriteBlock(i, blkBuf); if (dierr != kDIErrNone) { - WMSG2(" Format: block %d write failed (err=%d)\n", i, dierr); + LOGI(" Format: block %d write failed (err=%d)", i, dierr); goto bail; } } @@ -1581,7 +1581,7 @@ DiskFSProDOS::Format(DiskImg* pDiskImg, const char* volName) PutShortLE(&blkBuf[0x29], (unsigned short) formatBlocks); // total_blocks dierr = fpImg->WriteBlock(kVolHeaderBlock, blkBuf); if (dierr != kDIErrNone) { - WMSG2(" Format: block %d write failed (err=%d)\n", + LOGI(" Format: block %d write failed (err=%d)", kVolHeaderBlock, dierr); goto bail; } @@ -1589,7 +1589,7 @@ DiskFSProDOS::Format(DiskImg* pDiskImg, const char* volName) /* check our work, and set some object fields, by reading what we wrote */ dierr = LoadVolHeader(); if (dierr != kDIErrNone) { - WMSG1(" GLITCH: couldn't read header we just wrote (err=%d)\n", dierr); + LOGI(" GLITCH: couldn't read header we just wrote (err=%d)", dierr); goto bail; } @@ -1741,12 +1741,12 @@ DiskFSProDOS::WriteBootBlocks(void) dierr = fpImg->WriteBlock(0, block0); if (dierr != kDIErrNone) { - WMSG1(" WriteBootBlocks: block0 write failed (err=%d)\n", dierr); + LOGI(" WriteBootBlocks: block0 write failed (err=%d)", dierr); return dierr; } dierr = fpImg->WriteBlock(1, block1); if (dierr != kDIErrNone) { - WMSG1(" WriteBootBlocks: block1 write failed (err=%d)\n", dierr); + LOGI(" WriteBootBlocks: block1 write failed (err=%d)", dierr); return dierr; } @@ -1806,7 +1806,7 @@ DiskFSProDOS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) pParms->storageType == A2FileProDOS::kStorageExtended || pParms->storageType == A2FileProDOS::kStorageDirectory); // kStorageVolumeDirHeader not allowed -- that's created by Format - WMSG1(" ProDOS ---v--- CreateFile '%s'\n", pParms->pathName); + LOGI(" ProDOS ---v--- CreateFile '%s'", pParms->pathName); *ppNewFile = NULL; /* @@ -1837,18 +1837,18 @@ DiskFSProDOS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) normalizedPath = NULL; // either fileName or basePath points here now assert(fileName != NULL); - //WMSG2(" ProDOS normalized to '%s':'%s'\n", + //LOGI(" ProDOS normalized to '%s':'%s'", // basePath == NULL ? "" : basePath, fileName); /* * Open the base path. If it doesn't exist, create it recursively. */ if (basePath != NULL) { - WMSG2(" ProDOS Creating '%s' in '%s'\n", fileName, basePath); + LOGI(" ProDOS Creating '%s' in '%s'", fileName, basePath); /* open the named subdir, creating it if it doesn't exist */ pSubdir = (A2FileProDOS*)GetFileByName(basePath); if (pSubdir == NULL) { - WMSG1(" ProDOS Creating subdir '%s'\n", basePath); + LOGI(" ProDOS Creating subdir '%s'", basePath); A2File* pNewSub; CreateParms newDirParms; newDirParms.pathName = basePath; @@ -1911,14 +1911,14 @@ DiskFSProDOS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) assert(basePathLen == -1); } else { /* open the volume directory */ - WMSG1(" ProDOS Creating '%s' in volume dir\n", fileName); + LOGI(" ProDOS Creating '%s' in volume dir", fileName); /* volume dir must be first in the list */ pSubdir = (A2FileProDOS*) GetNextFile(NULL); assert(pSubdir != NULL); assert(pSubdir->IsVolumeDirectory()); } if (pSubdir == NULL) { - WMSG1(" ProDOS Unable to open subdir '%s'\n", basePath); + LOGI(" ProDOS Unable to open subdir '%s'", basePath); dierr = kDIErrFileNotFound; goto bail; } @@ -2055,7 +2055,7 @@ DiskFSProDOS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) */ dierr = pOpenSubdir->Write(subdirBuf, dirLen); if (dierr != kDIErrNone) { - WMSG1(" ProDOS directory write failed (dirLen=%ld)\n", dirLen); + LOGI(" ProDOS directory write failed (dirLen=%ld)", dirLen); goto bail; } @@ -2103,7 +2103,7 @@ DiskFSProDOS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) if (pEntry->storageType == A2FileProDOS::kStorageExtended) { dierr = ReadExtendedInfo(pNewFile); if (dierr != kDIErrNone) { - WMSG0(" ProDOS GLITCH: readback of extended block failed!\n"); + LOGI(" ProDOS GLITCH: readback of extended block failed!"); delete pNewFile; goto bail; } @@ -2133,7 +2133,7 @@ DiskFSProDOS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) if (prevDirEntryPtr == NULL) { /* previous entry is volume or subdir header */ InsertFileInList(pNewFile, pNewFile->GetParent()); - WMSG2("Inserted '%s' after '%s'\n", + LOGI("Inserted '%s' after '%s'", pNewFile->GetPathName(), pNewFile->GetParent()->GetPathName()); } else { /* dig out the key block pointer and find the matching file */ @@ -2151,7 +2151,7 @@ DiskFSProDOS::CreateFile(const CreateParms* pParms, A2File** ppNewFile) InsertFileInList(pNewFile, pPrev); } } -// WMSG0("LIST NOW:\n"); +// LOGI("LIST NOW:"); // DumpFileList(); *ppNewFile = pNewFile; @@ -2166,7 +2166,7 @@ bail: delete[] subdirBuf; delete[] fileName; delete[] basePath; - WMSG1(" ProDOS ---^--- CreateFile '%s' DONE\n", pParms->pathName); + LOGI(" ProDOS ---^--- CreateFile '%s' DONE", pParms->pathName); return dierr; } @@ -2738,7 +2738,7 @@ DiskFSProDOS::DoNormalizePath(const char* path, char fssep, } partBuf[partIdx] = '\0'; - //WMSG2(" ProDOS Converted component '%s' to '%s'\n", + //LOGI(" ProDOS Converted component '%s' to '%s'", // origStart, partBuf); if (outPtr != outputBuf) @@ -2756,7 +2756,7 @@ DiskFSProDOS::DoNormalizePath(const char* path, char fssep, *outPtr = '\0'; - WMSG3(" ProDOS Converted path '%s' to '%s' (fssep='%c')\n", + LOGI(" ProDOS Converted path '%s' to '%s' (fssep='%c')", path, outputBuf, fssep); assert(*outputBuf != '\0'); @@ -2851,7 +2851,7 @@ DiskFSProDOS::AllocDirEntry(A2FileDescr* pOpenSubdir, unsigned char** ppDir, pFile = (A2FileProDOS*) pOpenSubdir->GetFile(); dirLen = (long) pFile->GetDataLength(); if (dirLen < 512 || (dirLen % 512) != 0) { - WMSG2(" ProDOS GLITCH: funky dir EOF %ld (quality=%d)\n", + LOGI(" ProDOS GLITCH: funky dir EOF %ld (quality=%d)", dirLen, pFile->GetQuality()); dierr = kDIErrBadFile; goto bail; @@ -2869,7 +2869,7 @@ DiskFSProDOS::AllocDirEntry(A2FileDescr* pOpenSubdir, unsigned char** ppDir, if (dirBuf[0x23] != kEntryLength || dirBuf[0x24] != kEntriesPerBlock) { - WMSG1(" ProDOS GLITCH: funky entries per block %d\n", dirBuf[0x24]); + LOGI(" ProDOS GLITCH: funky entries per block %d", dirBuf[0x24]); dierr = kDIErrBadDirectory; goto bail; } @@ -2893,7 +2893,7 @@ DiskFSProDOS::AllocDirEntry(A2FileDescr* pOpenSubdir, unsigned char** ppDir, entryIdx++, pDirEntry += kEntryLength) { if ((pDirEntry[0x00] & 0xf0) == 0) { - WMSG1(" ProDOS Found empty dir entry in slot %d\n", entryIdx); + LOGI(" ProDOS Found empty dir entry in slot %d", entryIdx); break; // found one; break out of inner loop } } @@ -2908,7 +2908,7 @@ DiskFSProDOS::AllocDirEntry(A2FileDescr* pOpenSubdir, unsigned char** ppDir, goto bail; } - WMSG0(" ProDOS ran out of directory space, adding another block\n"); + LOGI(" ProDOS ran out of directory space, adding another block"); /* * Request an unused block from the system. Point the "next" pointer @@ -2918,7 +2918,7 @@ DiskFSProDOS::AllocDirEntry(A2FileDescr* pOpenSubdir, unsigned char** ppDir, unsigned char* pBlock; pBlock = dirBuf + 512 * (blockIdx-1); if (pBlock[0x02] != 0) { - WMSG0(" ProDOS GLITCH: adding to block with nonzero next ptr!\n"); + LOGI(" ProDOS GLITCH: adding to block with nonzero next ptr!"); dierr = kDIErrBadDirectory; goto bail; } @@ -3058,7 +3058,7 @@ DiskFSProDOS::MakeFileNameUnique(const unsigned char* dirBuf, long dirLen, if (!NameExistsInDir(dirBuf, dirLen, fileName)) return kDIErrNone; - WMSG1(" ProDOS found duplicate of '%s', making unique\n", fileName); + LOGI(" ProDOS found duplicate of '%s', making unique", fileName); int nameLen = strlen(fileName); int dotOffset=0, dotLen=0; @@ -3080,7 +3080,7 @@ DiskFSProDOS::MakeFileNameUnique(const unsigned char* dirBuf, long dirLen, if (cp != NULL) { int tmpOffset = cp - fileName; if (tmpOffset > 0 && nameLen - tmpOffset <= kMaxExtensionLen) { - WMSG1(" ProDOS (keeping extension '%s')\n", cp); + LOGI(" ProDOS (keeping extension '%s')", cp); assert(strlen(cp) <= kMaxExtensionLen); strcpy(dotBuf, cp); dotOffset = tmpOffset; @@ -3110,7 +3110,7 @@ DiskFSProDOS::MakeFileNameUnique(const unsigned char* dirBuf, long dirLen, memcpy(fileName + copyOffset + digitLen, dotBuf, dotLen); } while (NameExistsInDir(dirBuf, dirLen, fileName)); - WMSG1(" ProDOS converted to unique name: %s\n", fileName); + LOGI(" ProDOS converted to unique name: %s", fileName); return kDIErrNone; } @@ -3192,13 +3192,13 @@ DiskFSProDOS::DeleteFile(A2File* pGenericFile) * ignore the request. */ if (pGenericFile->IsVolumeDirectory()) { - WMSG0("ProDOS not deleting volume directory\n"); + LOGI("ProDOS not deleting volume directory"); return kDIErrNone; } A2FileProDOS* pFile = (A2FileProDOS*) pGenericFile; - WMSG1(" Deleting '%s'\n", pFile->GetPathName()); + LOGI(" Deleting '%s'", pFile->GetPathName()); dierr = LoadVolBitmap(); if (dierr != kDIErrNone) @@ -3256,7 +3256,7 @@ DiskFSProDOS::DeleteFile(A2File* pGenericFile) break; // fall out default: - WMSG1("ProDOS can't delete unknown storage type %d\n", + LOGI("ProDOS can't delete unknown storage type %d", pFile->fDirEntry.storageType); dierr = kDIErrBadDirectory; break; // fall out @@ -3283,14 +3283,14 @@ DiskFSProDOS::DeleteFile(A2File* pGenericFile) pFile->fParentDirIdx < kEntriesPerBlock); dierr = fpImg->ReadBlock(pFile->fParentDirBlock, blkBuf); if (dierr != kDIErrNone) { - WMSG1("ProDOS unable to read directory block %u\n", + LOGI("ProDOS unable to read directory block %u", pFile->fParentDirBlock); goto bail; } ptr = blkBuf + 4 + pFile->fParentDirIdx * kEntryLength; if ((*ptr) >> 4 != pFile->fDirEntry.storageType) { - WMSG2("ProDOS GLITCH: mismatched storage types (%d vs %d)\n", + LOGI("ProDOS GLITCH: mismatched storage types (%d vs %d)", (*ptr) >> 4, pFile->fDirEntry.storageType); assert(false); dierr = kDIErrBadDirectory; @@ -3299,7 +3299,7 @@ DiskFSProDOS::DeleteFile(A2File* pGenericFile) ptr[0x00] = 0; // zap both storage type and name length dierr = fpImg->WriteBlock(pFile->fParentDirBlock, blkBuf); if (dierr != kDIErrNone) { - WMSG1("ProDOS unable to write directory block %u\n", + LOGI("ProDOS unable to write directory block %u", pFile->fParentDirBlock); goto bail; } @@ -3331,7 +3331,7 @@ DiskFSProDOS::DeleteFile(A2File* pGenericFile) assert(pParent->fDirEntry.keyPointer >= kVolHeaderBlock); dierr = fpImg->ReadBlock(pParent->fDirEntry.keyPointer, blkBuf); if (dierr != kDIErrNone) { - WMSG1("ProDOS unable to read parent dir block %u\n", + LOGI("ProDOS unable to read parent dir block %u", pParent->fDirEntry.keyPointer); goto bail; } @@ -3341,7 +3341,7 @@ DiskFSProDOS::DeleteFile(A2File* pGenericFile) if (storageType != A2FileProDOS::kStorageSubdirHeader && storageType != A2FileProDOS::kStorageVolumeDirHeader) { - WMSG1("ProDOS invalid storage type %d in dir header block\n", + LOGI("ProDOS invalid storage type %d in dir header block", storageType); DebugBreak(); dierr = kDIErrBadDirectory; @@ -3353,7 +3353,7 @@ DiskFSProDOS::DeleteFile(A2File* pGenericFile) PutShortLE(&blkBuf[0x25], fileCount); dierr = fpImg->WriteBlock(pParent->fDirEntry.keyPointer, blkBuf); if (dierr != kDIErrNone) { - WMSG1("ProDOS unable to write parent dir block %u\n", + LOGI("ProDOS unable to write parent dir block %u", pParent->fDirEntry.keyPointer); goto bail; } @@ -3381,7 +3381,7 @@ DiskFSProDOS::FreeBlocks(long blockCount, unsigned short* blockList) VolumeUsage::ChunkState cstate; int i; - //WMSG2(" +++ FreeBlocks (blockCount=%d blockList=0x%08lx)\n", + //LOGI(" +++ FreeBlocks (blockCount=%d blockList=0x%08lx)", // blockCount, blockList); assert(blockCount >= 0 && blockCount < 65536); assert(blockList != NULL); @@ -3395,7 +3395,7 @@ DiskFSProDOS::FreeBlocks(long blockCount, unsigned short* blockList) continue; if (!GetBlockUseEntry(blockList[i])) { - WMSG1("WARNING: freeing unallocated block %u\n", blockList[i]); + LOGI("WARNING: freeing unallocated block %u", blockList[i]); assert(false); // impossible unless disk is "damaged" } SetBlockUseEntry(blockList[i], false); @@ -3444,7 +3444,7 @@ DiskFSProDOS::RenameFile(A2File* pGenericFile, const char* newName) if (!fDiskIsGood) return kDIErrBadDiskImage; - WMSG2(" ProDOS renaming '%s' to '%s'\n", pFile->GetPathName(), newName); + LOGI(" ProDOS renaming '%s' to '%s'", pFile->GetPathName(), newName); /* * Check for duplicates. We do this by getting the parent subdir and @@ -3466,7 +3466,7 @@ DiskFSProDOS::RenameFile(A2File* pGenericFile, const char* newName) /* one of our siblings; see if the name matches */ UpperCaseName(upperComp, pCur->GetFileName()); if (strcmp(upperName, upperComp) == 0) { - WMSG0(" ProDOS rename dup found\n"); + LOGI(" ProDOS rename dup found"); return kDIErrFileExists; } } @@ -3525,7 +3525,7 @@ DiskFSProDOS::RenameFile(A2File* pGenericFile, const char* newName) pFile->fParentDirIdx < kEntriesPerBlock); ptr = parentDirBuf + 4 + pFile->fParentDirIdx * kEntryLength; if ((*ptr) >> 4 != pFile->fDirEntry.storageType) { - WMSG2("ProDOS GLITCH: mismatched storage types (%d vs %d)\n", + LOGI("ProDOS GLITCH: mismatched storage types (%d vs %d)", (*ptr) >> 4, pFile->fDirEntry.storageType); assert(false); dierr = kDIErrBadDirectory; @@ -3540,7 +3540,7 @@ DiskFSProDOS::RenameFile(A2File* pGenericFile, const char* newName) if (pFile->IsDirectory()) { ptr = thisDirBuf + 4; if ((*ptr) >> 4 != A2FileProDOS::kStorageSubdirHeader) { - WMSG1("ProDOS GLITCH: bad storage type in subdir header (%d)\n", + LOGI("ProDOS GLITCH: bad storage type in subdir header (%d)", (*ptr) >> 4); assert(false); dierr = kDIErrBadDirectory; @@ -3592,7 +3592,7 @@ DiskFSProDOS::RenameFile(A2File* pGenericFile, const char* newName) RegeneratePathName(pFile); } - WMSG0("Okay!\n"); + LOGI("Okay!"); bail: return dierr; @@ -3650,7 +3650,7 @@ DiskFSProDOS::RegeneratePathName(A2FileProDOS* pFile) pParent = (A2FileProDOS*) pParent->GetParent(); } - WMSG2("Replacing '%s' with '%s'\n", pFile->GetPathName(), buf); + LOGI("Replacing '%s' with '%s'", pFile->GetPathName(), buf); pFile->SetPathName("", buf); delete[] buf; @@ -3690,11 +3690,11 @@ DiskFSProDOS::SetFileInfo(A2File* pGenericFile, long fileType, long auxType, return kDIErrInvalidArg; } if (pFile->IsVolumeDirectory()) { - WMSG0(" ProDOS refusing to change file info for volume dir\n"); + LOGI(" ProDOS refusing to change file info for volume dir"); return kDIErrAccessDenied; // not quite right } - WMSG4("ProDOS changing values for '%s' to 0x%02lx 0x%04lx 0x%02lx\n", + LOGI("ProDOS changing values for '%s' to 0x%02lx 0x%04lx 0x%02lx", pFile->GetPathName(), fileType, auxType, accessFlags); /* load the directory block for this file */ @@ -3709,14 +3709,14 @@ DiskFSProDOS::SetFileInfo(A2File* pGenericFile, long fileType, long auxType, pFile->fParentDirIdx < kEntriesPerBlock); ptr = thisDirBuf + 4 + pFile->fParentDirIdx * kEntryLength; if ((*ptr) >> 4 != pFile->fDirEntry.storageType) { - WMSG2("ProDOS GLITCH: mismatched storage types (%d vs %d)\n", + LOGI("ProDOS GLITCH: mismatched storage types (%d vs %d)", (*ptr) >> 4, pFile->fDirEntry.storageType); assert(false); dierr = kDIErrBadDirectory; goto bail; } if ((size_t) (*ptr & 0x0f) != strlen(pFile->fDirEntry.fileName)) { - WMSG2("ProDOS GLITCH: wrong file? (len=%d vs %d)\n", + LOGI("ProDOS GLITCH: wrong file? (len=%d vs %d)", *ptr & 0x0f, strlen(pFile->fDirEntry.fileName)); assert(false); dierr = kDIErrBadDirectory; @@ -3767,7 +3767,7 @@ DiskFSProDOS::RenameVolume(const char* newName) assert(pFile != NULL); assert(strcmp(pFile->GetFileName(), fVolumeName) == 0); - WMSG2(" ProDOS renaming volume '%s' to '%s'\n", + LOGI(" ProDOS renaming volume '%s' to '%s'", pFile->GetPathName(), newName); /* @@ -3796,7 +3796,7 @@ DiskFSProDOS::RenameVolume(const char* newName) ptr = thisDirBuf + 4; if ((*ptr) >> 4 != A2FileProDOS::kStorageVolumeDirHeader) { - WMSG1("ProDOS GLITCH: bad storage type in voldir header (%d)\n", + LOGI("ProDOS GLITCH: bad storage type in voldir header (%d)", (*ptr) >> 4); assert(false); dierr = kDIErrBadDirectory; @@ -3918,7 +3918,7 @@ A2FileProDOS::ConvertProDate(time_t unixDate) if (year >= 100) year -= 100; if (year < 0 || year >= 128) { - WMSG2("WHOOPS: got year %d from %d\n", year, ptm->tm_year); + LOGI("WHOOPS: got year %d from %d", year, ptm->tm_year); year = 70; } @@ -4042,7 +4042,7 @@ A2FileProDOS::Open(A2FileDescr** ppOpenFile, bool readOnly, DIError dierr = kDIErrNone; A2FDProDOS* pOpenFile = NULL; - WMSG3(" ProDOS Open(ro=%d, rsrc=%d) on '%s'\n", + LOGI(" ProDOS Open(ro=%d, rsrc=%d) on '%s'", readOnly, rsrcFork, fPathName); //Dump(); @@ -4105,13 +4105,13 @@ A2FileProDOS::Open(A2FileDescr** ppOpenFile, bool readOnly, pOpenFile->fOpenBlocksUsed = fDirEntry.blocksUsed; pOpenFile->fOpenStorageType = fDirEntry.storageType; } else { - WMSG1("PrODOS can't open unknown storage type %d\n", + LOGI("PrODOS can't open unknown storage type %d", fDirEntry.storageType); dierr = kDIErrBadDirectory; goto bail; } if (dierr != kDIErrNone) { - WMSG0(" ProDOS open failed\n"); + LOGI(" ProDOS open failed"); goto bail; } @@ -4172,7 +4172,7 @@ A2FileProDOS::LoadBlockList(int storageType, unsigned short keyBlock, * extended key block of a forked file. Bad storage types on other * kinds of files are caught earlier. */ - WMSG2(" ProDOS unexpected storageType %d in '%s'\n", + LOGI(" ProDOS unexpected storageType %d in '%s'", storageType, GetPathName()); return kDIErrNotSupported; } @@ -4246,7 +4246,7 @@ A2FileProDOS::LoadBlockList(int storageType, unsigned short keyBlock, idxBlock = blkBuf[idx] | (unsigned short) blkBuf[idx+256] << 8; if (idxBlock == 0) { /* fully sparse index block */ - //WMSG1(" ProDOS that's seriously sparse (%d)!\n", idx); + //LOGI(" ProDOS that's seriously sparse (%d)!", idx); memset(listPtr, 0, blockCount * sizeof(unsigned short)); if (pIndexBlockList != NULL) { *outIndexPtr++ = idxBlock; @@ -4323,7 +4323,7 @@ A2FileProDOS::ValidateBlockList(const unsigned short* list, long count) if (*list > pImg->GetNumBlocks() || (*list > 0 && *list <= 2)) // not enough, but it'll do { - WMSG2("Invalid block %d in '%s'\n", *list, fDirEntry.fileName); + LOGI("Invalid block %d in '%s'", *list, fDirEntry.fileName); SetQuality(kQualityDamaged); return kDIErrBadFile; } @@ -4333,7 +4333,7 @@ A2FileProDOS::ValidateBlockList(const unsigned short* list, long count) } if (foundBad) { - WMSG1(" --- found out-of-range block in '%s'\n", GetPathName()); + LOGI(" --- found out-of-range block in '%s'", GetPathName()); SetQuality(kQualitySuspicious); } @@ -4359,7 +4359,7 @@ A2FileProDOS::LoadIndexBlock(unsigned short block, unsigned short* list, if (dierr != kDIErrNone) goto bail; - //WMSG1("LOADING 0x%04x\n", block); + //LOGI("LOADING 0x%04x", block); for (i = 0; i < maxCount; i++) { *list++ = blkBuf[i] | (unsigned short) blkBuf[i+256] << 8; } @@ -4404,7 +4404,7 @@ A2FileProDOS::LoadDirectoryBlockList(unsigned short keyBlock, if (keyBlock < 2 || keyBlock >= fpDiskFS->GetDiskImg()->GetNumBlocks()) { - WMSG1(" ProDOS ERROR: directory block %u out of range\n", keyBlock); + LOGI(" ProDOS ERROR: directory block %u out of range", keyBlock); dierr = kDIErrInvalidBlock; goto bail; } @@ -4419,7 +4419,7 @@ A2FileProDOS::LoadDirectoryBlockList(unsigned short keyBlock, iterations++; } if (iterations == kMaxCatalogIterations) { - WMSG0(" ProDOS subdir iteration count exceeded\n"); + LOGI(" ProDOS subdir iteration count exceeded"); dierr = kDIErrDirectoryLoop; goto bail; } @@ -4441,25 +4441,25 @@ bail: void A2FileProDOS::Dump(void) const { - WMSG2(" ProDOS file '%s' (path='%s')\n", + LOGI(" ProDOS file '%s' (path='%s')", fDirEntry.fileName, fPathName); - WMSG3(" fileType=0x%02x auxType=0x%04x storage=%d\n", + LOGI(" fileType=0x%02x auxType=0x%04x storage=%d", fDirEntry.fileType, fDirEntry.auxType, fDirEntry.storageType); - WMSG3(" keyPointer=%d blocksUsed=%d eof=%ld\n", + LOGI(" keyPointer=%d blocksUsed=%d eof=%ld", fDirEntry.keyPointer, fDirEntry.blocksUsed, fDirEntry.eof); - WMSG3(" access=0x%02x create=0x%08lx mod=0x%08lx\n", + LOGI(" access=0x%02x create=0x%08lx mod=0x%08lx", fDirEntry.access, fDirEntry.createWhen, fDirEntry.modWhen); - WMSG3(" version=%d minVersion=%d headerPtr=%d\n", + LOGI(" version=%d minVersion=%d headerPtr=%d", fDirEntry.version, fDirEntry.minVersion, fDirEntry.headerPointer); if (fDirEntry.storageType == kStorageExtended) { - WMSG4(" DATA storage=%d keyBlk=%d blkUsed=%d eof=%ld\n", + LOGI(" DATA storage=%d keyBlk=%d blkUsed=%d eof=%ld", fExtData.storageType, fExtData.keyBlock, fExtData.blocksUsed, fExtData.eof); - WMSG4(" RSRC storage=%d keyBlk=%d blkUsed=%d eof=%ld\n", + LOGI(" RSRC storage=%d keyBlk=%d blkUsed=%d eof=%ld", fExtRsrc.storageType, fExtRsrc.keyBlock, fExtRsrc.blocksUsed, fExtRsrc.eof); } - WMSG2(" * sparseData=%ld sparseRsrc=%ld\n", + LOGI(" * sparseData=%ld sparseRsrc=%ld", (long) fSparseDataEof, (long) fSparseRsrcEof); } @@ -4476,7 +4476,7 @@ A2FileProDOS::Dump(void) const DIError A2FDProDOS::Read(void* buf, size_t len, size_t* pActual) { - WMSG3(" ProDOS reading %d bytes from '%s' (offset=%ld)\n", + LOGI(" ProDOS reading %d bytes from '%s' (offset=%ld)", len, fpFile->GetPathName(), (long) fOffset); //if (fBlockList == NULL) // return kDIErrNotReady; @@ -4509,14 +4509,14 @@ A2FDProDOS::Read(void* buf, size_t len, size_t* pActual) while (len) { if (fBlockList[blockIndex] == 0) { - //WMSG1(" ProDOS sparse index %d\n", blockIndex); + //LOGI(" ProDOS sparse index %d", blockIndex); memset(blkBuf, 0, sizeof(blkBuf)); } else { - //WMSG1(" ProDOS non-sparse index %d\n", blockIndex); + //LOGI(" ProDOS non-sparse index %d", blockIndex); dierr = fpFile->GetDiskFS()->GetDiskImg()->ReadBlock(fBlockList[blockIndex], blkBuf); if (dierr != kDIErrNone) { - WMSG3(" ProDOS error reading block [%ld]=%d of '%s'\n", + LOGI(" ProDOS error reading block [%ld]=%d of '%s'", blockIndex, fBlockList[blockIndex], fpFile->GetPathName()); return dierr; } @@ -4684,7 +4684,7 @@ A2FDProDOS::Write(const void* buf, size_t len, size_t* pActual) } if (newBlock < 0) { - WMSG0(" ProDOS disk full during write!\n"); + LOGI(" ProDOS disk full during write!"); dierr = kDIErrDiskFull; goto bail; } @@ -4742,7 +4742,7 @@ A2FDProDOS::Write(const void* buf, size_t len, size_t* pActual) * seedling form. This can only happen for a completely empty file. */ if (allZero) { - WMSG0("+++ ProDOS storing large but empty file as seedling\n"); + LOGI("+++ ProDOS storing large but empty file as seedling"); /* make sure key block is empty */ memset(blkBuf, 0, sizeof(blkBuf)); dierr = pDiskFS->GetDiskImg()->WriteBlock(keyBlock, blkBuf); @@ -4859,7 +4859,7 @@ A2FDProDOS::WriteDirectory(const void* buf, size_t len, size_t* pActual) { DIError dierr = kDIErrNone; - WMSG2("ProDOS writing %d bytes to directory '%s'\n", + LOGI("ProDOS writing %d bytes to directory '%s'", len, fpFile->GetPathName()); assert(len >= (size_t)kBlkSize); @@ -4888,7 +4888,7 @@ A2FDProDOS::WriteDirectory(const void* buf, size_t len, size_t* pActual) delete[] fBlockList; fBlockList = newBlockList; - WMSG0(" ProDOS updated block list for subdir:\n"); + LOGI(" ProDOS updated block list for subdir:"); DumpBlockList(); } @@ -4902,7 +4902,7 @@ A2FDProDOS::WriteDirectory(const void* buf, size_t len, size_t* pActual) dierr = fpFile->GetDiskFS()->GetDiskImg()->WriteBlock(fBlockList[idx], (unsigned char*)buf + idx * kBlkSize); if (dierr != kDIErrNone) { - WMSG1(" ProDOS failed writing dir, block=%d\n", fBlockList[idx]); + LOGI(" ProDOS failed writing dir, block=%d", fBlockList[idx]); goto bail; } } @@ -5037,7 +5037,7 @@ A2FDProDOS::Close(void) assert(pParentPtr + kEntryLength < blkBuf + kBlkSize); if (toupper(pParentPtr[0x01]) != toupper(pFile->fDirEntry.fileName[0])) { - WMSG0("ProDOS ERROR: parent pointer has wrong entry??\n"); + LOGI("ProDOS ERROR: parent pointer has wrong entry??"); assert(false); dierr = kDIErrInternal; goto bail; @@ -5103,7 +5103,7 @@ A2FDProDOS::Close(void) } // update mod date? - //WMSG1("File '%s' closed\n", pFile->GetPathName()); + //LOGI("File '%s' closed", pFile->GetPathName()); //pFile->Dump(); } @@ -5176,10 +5176,10 @@ A2FDProDOS::DumpBlockList(void) const { long ll; - WMSG1(" ProDOS file block list (count=%ld)\n", fBlockCount); + LOGI(" ProDOS file block list (count=%ld)", fBlockCount); for (ll = 0; ll <= fBlockCount; ll++) { if (fBlockList[ll] != 0) { - WMSG2(" %5ld: 0x%04x\n", ll, fBlockList[ll]); + LOGI(" %5ld: 0x%04x", ll, fBlockList[ll]); } } } diff --git a/diskimg/RDOS.cpp b/diskimg/RDOS.cpp index 086fc9a..705154a 100644 --- a/diskimg/RDOS.cpp +++ b/diskimg/RDOS.cpp @@ -70,7 +70,7 @@ TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, if (dierr != kDIErrNone) goto bail; } else { - WMSG0(" RDOS neither 13 nor 16 sector, bailing\n"); + LOGI(" RDOS neither 13 nor 16 sector, bailing"); goto bail; } @@ -82,7 +82,7 @@ TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, sctBuf[4] == ' '+0x80) || !(sctBuf[25] == 26 || sctBuf[25] == 32)) { - WMSG1(" RDOS no signature found on (%d,0)\n", kCatTrack); + LOGI(" RDOS no signature found on (%d,0)", kCatTrack); dierr = kDIErrGeneric; goto bail; } @@ -141,7 +141,7 @@ TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, goto bail; } - WMSG2(" RDOS found '%s' signature (order=%d)\n", kCompare, imageOrder); + LOGI(" RDOS found '%s' signature (order=%d)", kCompare, imageOrder); } dierr = kDIErrNone; @@ -158,11 +158,11 @@ DiskFSRDOS::TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, DiskImg::FSFormat* pFormat, FSLeniency leniency) { if (!pImg->GetHasSectors()) { - WMSG0(" RDOS - image doesn't have sectors, not trying\n"); + LOGI(" RDOS - image doesn't have sectors, not trying"); return kDIErrFilesystemNotFound; } if (pImg->GetNumTracks() != 35) { - WMSG0(" RDOS - not a 35-track disk, not trying\n"); + LOGI(" RDOS - not a 35-track disk, not trying"); return kDIErrFilesystemNotFound; } DiskImg::FSFormat formatFound; @@ -182,7 +182,7 @@ DiskFSRDOS::TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, } } - WMSG0(" RDOS didn't find valid FS\n"); + LOGI(" RDOS didn't find valid FS"); return kDIErrFilesystemNotFound; } @@ -201,7 +201,7 @@ DiskFSRDOS::TestFS33(DiskImg* pImg, DiskImg::SectorOrder* pOrder, if (dierr != kDIErrNone) return dierr; if (formatFound != DiskImg::kFormatRDOS33) { - WMSG0(" RDOS found RDOS but wrong type\n"); + LOGI(" RDOS found RDOS but wrong type"); return kDIErrFilesystemNotFound; } @@ -222,7 +222,7 @@ DiskFSRDOS::TestFS32(DiskImg* pImg, DiskImg::SectorOrder* pOrder, if (dierr != kDIErrNone) return dierr; if (formatFound != DiskImg::kFormatRDOS32) { - WMSG0(" RDOS found RDOS but wrong type\n"); + LOGI(" RDOS found RDOS but wrong type"); return kDIErrFilesystemNotFound; } @@ -243,7 +243,7 @@ DiskFSRDOS::TestFS3(DiskImg* pImg, DiskImg::SectorOrder* pOrder, if (dierr != kDIErrNone) return dierr; if (formatFound != DiskImg::kFormatRDOS3) { - WMSG0(" RDOS found RDOS but wrong type\n"); + LOGI(" RDOS found RDOS but wrong type"); return kDIErrFilesystemNotFound; } @@ -370,7 +370,7 @@ DiskFSRDOS::ReadCatalog(void) if (pFile->fStartSector + pFile->fNumSectors > fpImg->GetNumTracks() * fOurSectPerTrack) { - WMSG4(" RDOS invalid start/count (%d + %d) (max %ld) '%s'\n", + LOGI(" RDOS invalid start/count (%d + %d) (max %ld) '%s'", pFile->fStartSector, pFile->fNumSectors, fpImg->GetNumBlocks(), pFile->fFileName); pFile->fStartSector = pFile->fNumSectors = 0; @@ -428,7 +428,7 @@ DiskFSRDOS::SetSectorUsage(long track, long sector, fVolumeUsage.GetChunkState(track, sector, &cstate); if (cstate.isUsed) { cstate.purpose = VolumeUsage::kChunkPurposeConflict; - WMSG2(" RDOS conflicting uses for sct=(%ld,%ld)\n", track, sector); + LOGI(" RDOS conflicting uses for sct=(%ld,%ld)", track, sector); } else { cstate.isUsed = true; cstate.isMarkedUsed = true; @@ -470,8 +470,8 @@ A2FileRDOS::GetFileType(void) const void A2FileRDOS::Dump(void) const { - WMSG2("A2FileRDOS '%s' (type=%d)\n", fFileName, fFileType); - WMSG4(" start=%d num=%d len=%d addr=0x%04x\n", + LOGI("A2FileRDOS '%s' (type=%d)", fFileName, fFileType); + LOGI(" start=%d num=%d len=%d addr=0x%04x", fStartSector, fNumSectors, fLength, fLoadAddr); } @@ -550,7 +550,7 @@ A2FileRDOS::Open(A2FileDescr** ppOpenFile, bool readOnly, DIError A2FDRDOS::Read(void* buf, size_t len, size_t* pActual) { - WMSG3(" RDOS reading %d bytes from '%s' (offset=%ld)\n", + LOGI(" RDOS reading %d bytes from '%s' (offset=%ld)", len, fpFile->GetPathName(), (long) fOffset); //if (!fOpen) // return kDIErrNotReady; @@ -588,7 +588,7 @@ A2FDRDOS::Read(void* buf, size_t len, size_t* pActual) dierr = pFile->GetDiskFS()->GetDiskImg()->ReadTrackSector(block / ourSectPerTrack, block % ourSectPerTrack, sctBuf); if (dierr != kDIErrNone) { - WMSG1(" RDOS error reading file '%s'\n", pFile->fFileName); + LOGI(" RDOS error reading file '%s'", pFile->fFileName); return dierr; } thisCount = kSctSize - bufOffset; diff --git a/diskimg/SPTI.cpp b/diskimg/SPTI.cpp index 45fcd1d..715ff04 100644 --- a/diskimg/SPTI.cpp +++ b/diskimg/SPTI.cpp @@ -54,7 +54,7 @@ SPTI::GetDeviceCapacity(HANDLE handle, unsigned long* pLastBlock, if (!status) { DWORD lastError = ::GetLastError(); - WMSG1("DeviceIoControl(SCSI READ CAPACITY) failed, err=%ld\n", + LOGI("DeviceIoControl(SCSI READ CAPACITY) failed, err=%ld", ::GetLastError()); if (lastError == ERROR_IO_DEVICE) // no disc in drive return kDIErrDeviceNotReady; @@ -95,7 +95,7 @@ SPTI::ReadBlocks(HANDLE handle, long startBlock, short numBlocks, assert(numBlocks > 0); assert(buf != NULL); - //WMSG2(" SPTI phys read block (%ld) %d\n", startBlock, numBlocks); + //LOGI(" SPTI phys read block (%ld) %d", startBlock, numBlocks); memset(&sptd, 0, sizeof(sptd)); sptd.Length = sizeof(sptd); // size of struct (+ request-sense buffer) @@ -124,12 +124,12 @@ SPTI::ReadBlocks(HANDLE handle, long startBlock, short numBlocks, &sptd, sizeof(sptd), NULL, 0, &cb, NULL); if (!status) { - WMSG1("DeviceIoControl(SCSI READ(10)) failed, err=%ld\n", + LOGI("DeviceIoControl(SCSI READ(10)) failed, err=%ld", ::GetLastError()); return kDIErrReadFailed; // close enough } if (sptd.ScsiStatus != 0) { - WMSG1("SCSI READ(10) failed, status=%d\n", sptd.ScsiStatus); + LOGI("SCSI READ(10) failed, status=%d", sptd.ScsiStatus); return kDIErrReadFailed; } diff --git a/diskimg/TwoImg.cpp b/diskimg/TwoImg.cpp index 78634fc..67d58d1 100644 --- a/diskimg/TwoImg.cpp +++ b/diskimg/TwoImg.cpp @@ -36,7 +36,7 @@ TwoImgHeader::InitHeader(int imageFormat, long imageSize, long imageBlockCount) if (imageFormat != kImageFormatNibble && imageSize != imageBlockCount * 512) { - WMSG3("2MG InitHeader: bad sizes %d %ld %ld\n", imageFormat, + LOGI("2MG InitHeader: bad sizes %d %ld %ld", imageFormat, imageSize, imageBlockCount); return -1; } @@ -174,11 +174,11 @@ TwoImgHeader::ReadHeader(FILE* fp, long totalLength) if (GetChunk(fp, fCmtOffset - kOurHeaderLen, fCmtLen, (void**) &fComment) != 0) { - WMSG0("Throwing comment away\n"); + LOGI("Throwing comment away"); fCmtLen = 0; fCmtOffset = 0; } else { - WMSG1("Got comment: '%s'\n", fComment); + LOGI("Got comment: '%s'", fComment); } } @@ -189,11 +189,11 @@ TwoImgHeader::ReadHeader(FILE* fp, long totalLength) if (GetChunk(fp, fCreatorOffset - kOurHeaderLen, fCreatorLen, (void**) &fCreatorChunk) != 0) { - WMSG0("Throwing creator chunk away\n"); + LOGI("Throwing creator chunk away"); fCreatorLen = 0; fCreatorOffset = 0; } else { - //WMSG1("Got creator chunk: '%s'\n", fCreatorChunk); + //LOGI("Got creator chunk: '%s'", fCreatorChunk); } } @@ -225,11 +225,11 @@ TwoImgHeader::ReadHeader(GenericFD* pGFD, long totalLength) if (GetChunk(pGFD, fCmtOffset - kOurHeaderLen, fCmtLen, (void**) &fComment) != 0) { - WMSG0("Throwing comment away\n"); + LOGI("Throwing comment away"); fCmtLen = 0; fCmtOffset = 0; } else { - WMSG1("Got comment: '%s'\n", fComment); + LOGI("Got comment: '%s'", fComment); } } @@ -240,11 +240,11 @@ TwoImgHeader::ReadHeader(GenericFD* pGFD, long totalLength) if (GetChunk(pGFD, fCreatorOffset - kOurHeaderLen, fCreatorLen, (void**) &fCreatorChunk) != 0) { - WMSG0("Throwing creator chunk away\n"); + LOGI("Throwing creator chunk away"); fCreatorLen = 0; fCreatorOffset = 0; } else { - //WMSG1("Got creator chunk: '%s'\n", fCreatorChunk); + //LOGI("Got creator chunk: '%s'", fCreatorChunk); } } @@ -267,7 +267,7 @@ TwoImgHeader::GetChunk(GenericFD* pGFD, di_off_t relOffset, long len, /* seek out to chunk and grab it */ dierr = pGFD->Seek(relOffset, kSeekCur); if (dierr != kDIErrNone) { - WMSG0("2MG seek to chunk failed\n"); + LOGI("2MG seek to chunk failed"); return -1; } @@ -276,7 +276,7 @@ TwoImgHeader::GetChunk(GenericFD* pGFD, di_off_t relOffset, long len, dierr = pGFD->Read(*pBuf, len); if (dierr != kDIErrNone) { - WMSG0("2MG chunk read failed\n"); + LOGI("2MG chunk read failed"); delete[] (char*) (*pBuf); *pBuf = NULL; (void) pGFD->Seek(curPos, kSeekSet); @@ -304,11 +304,11 @@ TwoImgHeader::GetChunk(FILE* fp, di_off_t relOffset, long len, /* remember current offset */ curPos = ftell(fp); - WMSG1("Current offset=%ld\n", curPos); + LOGI("Current offset=%ld", curPos); /* seek out to chunk and grab it */ if (fseek(fp, (long) relOffset, SEEK_CUR) == -1) { - WMSG0("2MG seek to chunk failed\n"); + LOGI("2MG seek to chunk failed"); return errno ? errno : -1;; } @@ -317,7 +317,7 @@ TwoImgHeader::GetChunk(FILE* fp, di_off_t relOffset, long len, count = fread(*pBuf, len, 1, fp); if (!count || ferror(fp) || feof(fp)) { - WMSG0("2MG chunk read failed\n"); + LOGI("2MG chunk read failed"); delete[] (char*) (*pBuf); *pBuf = NULL; (void) fseek(fp, curPos, SEEK_SET); @@ -373,12 +373,12 @@ TwoImgHeader::UnpackHeader(const unsigned char* buf, long totalLength) fCreatorStr[4] = '\0'; if (fMagic != kMagic) { - WMSG0("Magic number does not match 2IMG\n"); + LOGI("Magic number does not match 2IMG"); return -1; } if (fVersion > 1) { - WMSG1("ERROR: unsupported version=%d\n", fVersion); + LOGI("ERROR: unsupported version=%d", fVersion); return -1; // bad header until I hear otherwise } @@ -392,7 +392,7 @@ TwoImgHeader::UnpackHeader(const unsigned char* buf, long totalLength) fImageFormat != kImageFormatNibble) { fDataLen = fNumBlocks * kBlockSize; - WMSG1("NOTE: fixing zero dataLen in 'WOOF' image (set to %ld)\n", + LOGI("NOTE: fixing zero dataLen in 'WOOF' image (set to %ld)", fDataLen); } @@ -402,22 +402,22 @@ TwoImgHeader::UnpackHeader(const unsigned char* buf, long totalLength) if (fImageFormat != kImageFormatNibble && fNumBlocks * kBlockSize != fDataLen) { - WMSG2("numBlocks/dataLen mismatch (%ld vs %ld)\n", + LOGI("numBlocks/dataLen mismatch (%ld vs %ld)", fNumBlocks * kBlockSize, fDataLen); return -1; } if (fDataLen + fDataOffset > totalLength) { - WMSG3("Invalid dataLen/offset/fileLength (dl=%ld, off=%ld, tlen=%ld)\n", + LOGI("Invalid dataLen/offset/fileLength (dl=%ld, off=%ld, tlen=%ld)", fDataLen, fDataOffset, totalLength); return -1; } if (fImageFormat < kImageFormatDOS || fImageFormat > kImageFormatNibble) { - WMSG1("Invalid image format %ld\n", fImageFormat); + LOGI("Invalid image format %ld", fImageFormat); return -1; } if (fCmtOffset > 0 && fCmtOffset < fDataOffset + fDataLen) { - WMSG2("2MG comment is inside the data section (off=%ld, data end=%ld)\n", + LOGI("2MG comment is inside the data section (off=%ld, data end=%ld)", fCmtOffset, fDataOffset+fDataLen); DebugBreak(); // ignore the comment @@ -428,7 +428,7 @@ TwoImgHeader::UnpackHeader(const unsigned char* buf, long totalLength) long prevEnd = fDataOffset + fDataLen + fCmtLen; if (fCreatorOffset < prevEnd) { - WMSG2("2MG creator chunk is inside prev data (off=%ld, data end=%ld)\n", + LOGI("2MG creator chunk is inside prev data (off=%ld, data end=%ld)", fCreatorOffset, prevEnd); DebugBreak(); // ignore the creator chunk @@ -480,7 +480,7 @@ TwoImgHeader::WriteHeader(GenericFD* pGFD) const int TwoImgHeader::WriteFooter(FILE* fp) const { - WMSG1("Writing footer at offset=%ld\n", (long) ftell(fp)); + LOGI("Writing footer at offset=%ld", (long) ftell(fp)); if (fCmtLen) { fwrite(fComment, fCmtLen, 1, fp); @@ -501,7 +501,7 @@ TwoImgHeader::WriteFooter(FILE* fp) const int TwoImgHeader::WriteFooter(GenericFD* pGFD) const { - WMSG1("Writing footer at offset=%ld\n", (long) pGFD->Tell()); + LOGI("Writing footer at offset=%ld", (long) pGFD->Tell()); if (fCmtLen) { if (pGFD->Write(fComment, fCmtLen) != kDIErrNone) @@ -553,24 +553,24 @@ TwoImgHeader::PackHeader(unsigned char* buf) const void TwoImgHeader::DumpHeader(void) const { - WMSG0("--- header contents:\n"); - WMSG2("\tmagic = '%s' (0x%08lx)\n", fMagicStr, fMagic); - WMSG2("\tcreator = '%s' (0x%08lx)\n", fCreatorStr, fCreator); - WMSG1("\theaderLen = %d\n", fHeaderLen); - WMSG1("\tversion = %d\n", fVersion); - WMSG1("\timageFormat = %ld\n", fImageFormat); - WMSG1("\tflags = 0x%08lx\n", fFlags); - WMSG1("\t locked = %s\n", + LOGI("--- header contents:"); + LOGI("\tmagic = '%s' (0x%08lx)", fMagicStr, fMagic); + LOGI("\tcreator = '%s' (0x%08lx)", fCreatorStr, fCreator); + LOGI("\theaderLen = %d", fHeaderLen); + LOGI("\tversion = %d", fVersion); + LOGI("\timageFormat = %ld", fImageFormat); + LOGI("\tflags = 0x%08lx", fFlags); + LOGI("\t locked = %s", (fFlags & kFlagLocked) ? "true" : "false"); - WMSG2("\t DOS volume = %s (%ld)\n", + LOGI("\t DOS volume = %s (%ld)", (fFlags & kDOSVolumeSet) ? "true" : "false", fFlags & kDOSVolumeMask); - WMSG1("\tnumBlocks = %ld\n", fNumBlocks); - WMSG1("\tdataOffset = %ld\n", fDataOffset); - WMSG1("\tdataLen = %ld\n", fDataLen); - WMSG1("\tcmtOffset = %ld\n", fCmtOffset); - WMSG1("\tcmtLen = %ld\n", fCmtLen); - WMSG1("\tcreatorOffset = %ld\n", fCreatorOffset); - WMSG1("\tcreatorLen = %ld\n", fCreatorLen); - WMSG0("\n"); + LOGI("\tnumBlocks = %ld", fNumBlocks); + LOGI("\tdataOffset = %ld", fDataOffset); + LOGI("\tdataLen = %ld", fDataLen); + LOGI("\tcmtOffset = %ld", fCmtOffset); + LOGI("\tcmtLen = %ld", fCmtLen); + LOGI("\tcreatorOffset = %ld", fCreatorOffset); + LOGI("\tcreatorLen = %ld", fCreatorLen); + LOGI(""); } diff --git a/diskimg/UNIDOS.cpp b/diskimg/UNIDOS.cpp index d15f725..907d309 100644 --- a/diskimg/UNIDOS.cpp +++ b/diskimg/UNIDOS.cpp @@ -91,7 +91,7 @@ TestImageHalf(DiskImg* pImg, int trackOffset, DiskImg::SectorOrder imageOrder, !(catTrack < numTracks && catSect < numSectors) || 0) { - WMSG0(" UNI/Wide DOS header test failed\n"); + LOGI(" UNI/Wide DOS header test failed"); dierr = kDIErrFilesystemNotFound; goto bail; } @@ -114,7 +114,7 @@ TestImageHalf(DiskImg* pImg, int trackOffset, DiskImg::SectorOrder imageOrder, if (catTrack == sctBuf[1] && catSect == sctBuf[2] +1) foundGood++; else if (catTrack == sctBuf[1] && catSect == sctBuf[2]) { - WMSG2(" WideDOS detected self-reference on cat (%d,%d)\n", + LOGI(" WideDOS detected self-reference on cat (%d,%d)", catTrack, catSect); break; } @@ -125,11 +125,11 @@ TestImageHalf(DiskImg* pImg, int trackOffset, DiskImg::SectorOrder imageOrder, } if (iterations >= DiskFSDOS33::kMaxCatalogSectors) { dierr = kDIErrDirectoryLoop; - WMSG0(" WideDOS directory links cause a loop\n"); + LOGI(" WideDOS directory links cause a loop"); goto bail; } - WMSG3(" WideDOS foundGood=%d off=%d swap=%d\n", foundGood, + LOGI(" WideDOS foundGood=%d off=%d swap=%d", foundGood, trackOffset, imageOrder); *pGoodCount = foundGood; @@ -148,12 +148,12 @@ TestImage(DiskImg* pImg, DiskImg::SectorOrder imageOrder, int* pGoodCount) *pGoodCount = 0; - WMSG1(" UNIDOS checking first half (imageOrder=%d)\n", imageOrder); + LOGI(" UNIDOS checking first half (imageOrder=%d)", imageOrder); dierr = TestImageHalf(pImg, 0, imageOrder, &goodCount1); if (dierr != kDIErrNone) return dierr; - WMSG1(" UNIDOS checking second half (imageOrder=%d)\n", imageOrder); + LOGI(" UNIDOS checking second half (imageOrder=%d)", imageOrder); dierr = TestImageHalf(pImg, kExpectedTracks, imageOrder, &goodCount2); if (dierr != kDIErrNone) return dierr; @@ -200,14 +200,14 @@ DiskFSUNIDOS::TestFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, if (bestCount >= 4 || (leniency == kLeniencyVery && bestCount >= 2)) { - WMSG2(" WideDOS test: bestCount=%d for order=%d\n", bestCount, bestOrder); + LOGI(" WideDOS test: bestCount=%d for order=%d", bestCount, bestOrder); assert(bestOrder != DiskImg::kSectorOrderUnknown); *pOrder = bestOrder; *pFormat = DiskImg::kFormatUNIDOS; return kDIErrNone; } - WMSG0(" UNIDOS didn't find valid FS\n"); + LOGI(" UNIDOS didn't find valid FS"); return kDIErrFilesystemNotFound; } @@ -225,7 +225,7 @@ DiskFSUNIDOS::TestWideFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, { /* only on 400K "disks" */ if (pImg->GetNumBlocks() != kExpectedNumBlocks/2) { - WMSG1(" WideDOS ignoring volume (numBlocks=%ld)\n", + LOGI(" WideDOS ignoring volume (numBlocks=%ld)", pImg->GetNumBlocks()); return kDIErrFilesystemNotFound; } @@ -253,7 +253,7 @@ DiskFSUNIDOS::TestWideFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, if (bestCount >= 4 || (leniency == kLeniencyVery && bestCount >= 2)) { - WMSG2(" UNI/Wide test: bestCount=%d for order=%d\n", bestCount, bestOrder); + LOGI(" UNI/Wide test: bestCount=%d for order=%d", bestCount, bestOrder); assert(bestOrder != DiskImg::kSectorOrderUnknown); *pOrder = bestOrder; *pFormat = DiskImg::kFormatDOS33; @@ -261,7 +261,7 @@ DiskFSUNIDOS::TestWideFS(DiskImg* pImg, DiskImg::SectorOrder* pOrder, return kDIErrNone; } - WMSG0(" UNI/Wide didn't find valid FS\n"); + LOGI(" UNI/Wide didn't find valid FS"); return kDIErrFilesystemNotFound; } @@ -283,7 +283,7 @@ DiskFSUNIDOS::Initialize(void) if (dierr != kDIErrNone) return dierr; } else { - WMSG0(" UNIDOS not scanning for sub-volumes\n"); + LOGI(" UNIDOS not scanning for sub-volumes"); } SetVolumeUsageMap(); @@ -310,30 +310,30 @@ DiskFSUNIDOS::OpenSubVolume(int idx) dierr = pNewImg->OpenImage(fpImg, kExpectedTracks * idx, 0, kExpectedTracks * kExpectedSectors); if (dierr != kDIErrNone) { - WMSG3(" UNISub: OpenImage(%d,0,%d) failed (err=%d)\n", + LOGI(" UNISub: OpenImage(%d,0,%d) failed (err=%d)", kExpectedTracks * idx, kExpectedTracks * kExpectedSectors, dierr); goto bail; } dierr = pNewImg->AnalyzeImage(); if (dierr != kDIErrNone) { - WMSG1(" UNISub: analysis failed (err=%d)\n", dierr); + LOGI(" UNISub: analysis failed (err=%d)", dierr); goto bail; } if (pNewImg->GetFSFormat() == DiskImg::kFormatUnknown || pNewImg->GetSectorOrder() == DiskImg::kSectorOrderUnknown) { - WMSG0(" UNISub: unable to identify filesystem\n"); + LOGI(" UNISub: unable to identify filesystem"); dierr = kDIErrUnsupportedFSFmt; goto bail; } /* open a DiskFS for the sub-image */ - WMSG1(" UNISub %d succeeded!\n", idx); + LOGI(" UNISub %d succeeded!", idx); pNewFS = pNewImg->OpenAppropriateDiskFS(); if (pNewFS == NULL) { - WMSG0(" UNISub: OpenAppropriateDiskFS failed\n"); + LOGI(" UNISub: OpenAppropriateDiskFS failed"); dierr = kDIErrUnsupportedFSFmt; goto bail; } @@ -341,7 +341,7 @@ DiskFSUNIDOS::OpenSubVolume(int idx) /* load the files from the sub-image */ dierr = pNewFS->Initialize(pNewImg, kInitFull); if (dierr != kDIErrNone) { - WMSG1(" UNISub: error %d reading list of files from disk", dierr); + LOGE(" UNISub: error %d reading list of files from disk", dierr); goto bail; } diff --git a/diskimg/VolumeUsage.cpp b/diskimg/VolumeUsage.cpp index 960fceb..e9b3bfa 100644 --- a/diskimg/VolumeUsage.cpp +++ b/diskimg/VolumeUsage.cpp @@ -164,7 +164,7 @@ DiskFS::VolumeUsage::GetActualFreeChunks(void) const } } - WMSG3(" VU total=%ld free=%d funky=%d\n", + LOGI(" VU total=%ld free=%d funky=%d", fTotalChunks, freeCount, funkyCount); return freeCount; @@ -222,11 +222,11 @@ DiskFS::VolumeUsage::Dump(void) const { #define kMapInit "--------------------------------" if (fList == NULL) { - WMSG0(" VU asked to dump empty list?\n"); + LOGI(" VU asked to dump empty list?"); return; } - WMSG1(" VU VolumeUsage dump (%ld free chunks):\n", + LOGI(" VU VolumeUsage dump (%ld free chunks):", GetActualFreeChunks()); if (fByBlocks) { @@ -243,13 +243,13 @@ DiskFS::VolumeUsage::Dump(void) const freemap[block % kEntriesPerLine] = StateToChar(&cstate); if ((block % kEntriesPerLine) == kEntriesPerLine-1) { - WMSG2(" 0x%04x: %s\n", block-(kEntriesPerLine-1), freemap); + LOGI(" 0x%04x: %s", block-(kEntriesPerLine-1), freemap); } } if ((block % kEntriesPerLine) != 0) { memset(freemap + (block % kEntriesPerLine), '-', kEntriesPerLine - (block % kEntriesPerLine)); - WMSG2(" 0x%04x: %s\n", block-(kEntriesPerLine-1), freemap); + LOGI(" 0x%04x: %s", block-(kEntriesPerLine-1), freemap); } } else { ChunkState cstate; @@ -258,11 +258,11 @@ DiskFS::VolumeUsage::Dump(void) const int track, sector; if (fNumSectors > 32) { - WMSG1(" VU too many sectors (%ld)\n", fNumSectors); + LOGI(" VU too many sectors (%ld)", fNumSectors); return; } - WMSG0(" map 0123456789abcdef\n"); + LOGI(" map 0123456789abcdef"); for (track = 0; track < numTracks; track++) { for (sector = 0; sector < fNumSectors; sector++) { @@ -272,7 +272,7 @@ DiskFS::VolumeUsage::Dump(void) const } freemap[sector] = StateToChar(&cstate); } - WMSG2(" %2d: %s\n", track, freemap); + LOGI(" %2d: %s", track, freemap); } } } diff --git a/diskimg/Win32BlockIO.cpp b/diskimg/Win32BlockIO.cpp index c24a904..1389568 100644 --- a/diskimg/Win32BlockIO.cpp +++ b/diskimg/Win32BlockIO.cpp @@ -86,7 +86,7 @@ Win32VolumeAccess::Open(const WCHAR* deviceName, bool readOnly) if (dierr != kDIErrNone) goto bail; } else { - WMSG1(" Win32VA: '%s' isn't the name of a device\n", deviceName); + LOGI(" Win32VA: '%s' isn't the name of a device", deviceName); return kDIErrInternal; } @@ -112,17 +112,17 @@ Win32VolumeAccess::Close(void) { if (fpBlockAccess != NULL) { DIError dierr; - WMSG0(" Win32VolumeAccess closing\n"); + LOGI(" Win32VolumeAccess closing"); dierr = FlushCache(true); if (dierr != kDIErrNone) { - WMSG1("WARNING: Win32VA Close: FlushCache failed (err=%ld)\n", + LOGI("WARNING: Win32VA Close: FlushCache failed (err=%ld)", dierr); // not much we can do } dierr = fpBlockAccess->Close(); if (dierr != kDIErrNone) { - WMSG1("WARNING: Win32VolumeAccess BlockAccess Close failed (err=%ld)\n", + LOGI("WARNING: Win32VolumeAccess BlockAccess Close failed (err=%ld)", dierr); } delete fpBlockAccess; @@ -260,7 +260,7 @@ Win32VolumeAccess::FlushCache(bool purge) { DIError dierr = kDIErrNone; - //WMSG1(" Win32VA: FlushCache (%d)\n", purge); + //LOGI(" Win32VA: FlushCache (%d)", purge); if (fBlockCache.IsDirty()) { long firstBlock; @@ -269,11 +269,11 @@ Win32VolumeAccess::FlushCache(bool purge) fBlockCache.GetCachePointer(&firstBlock, &numBlocks, &buf); - WMSG3("FlushCache writing first=%d num=%d (purge=%d)\n", + LOGI("FlushCache writing first=%d num=%d (purge=%d)", firstBlock, numBlocks, purge); dierr = DoWriteBlocks(firstBlock, numBlocks, buf); if (dierr != kDIErrNone) { - WMSG1(" Win32VA: FlushCache write blocks failed (err=%d)\n", + LOGI(" Win32VA: FlushCache write blocks failed (err=%d)", dierr); goto bail; } @@ -321,11 +321,11 @@ Win32VolumeAccess::BlockAccess::DetectCapacitySPTI(HANDLE handle, if (dierr != kDIErrNone) goto bail; - WMSG3("READ CAPACITY reports lba=%lu blockLen=%lu (total=%lu)\n", + LOGI("READ CAPACITY reports lba=%lu blockLen=%lu (total=%lu)", lba, blockLen, lba*blockLen); if (isCDROM && blockLen != kCDROMSectorSize) { - WMSG1("Unacceptable CD-ROM blockLen=%ld, bailing\n", blockLen); + LOGI("Unacceptable CD-ROM blockLen=%ld, bailing", blockLen); dierr = kDIErrReadFailed; goto bail; } @@ -334,7 +334,7 @@ Win32VolumeAccess::BlockAccess::DetectCapacitySPTI(HANDLE handle, // we need to add one. *pNumBlocks = (blockLen/512) * (lba+1); - WMSG1(" SPTI returning 512-byte block count %ld\n", *pNumBlocks); + LOGI(" SPTI returning 512-byte block count %ld", *pNumBlocks); bail: return dierr; @@ -376,7 +376,7 @@ Win32VolumeAccess::BlockAccess::ScanCapacity(BlockAccess* pThis, long* pNumBlock // Trivial check to make sure *anything* works, and to establish block 0 // as valid in case we have to bin-search. if (!CanReadBlock(pThis, 0)) { - WMSG0(" Win32VolumeAccess: can't read block 0\n"); + LOGI(" Win32VolumeAccess: can't read block 0"); dierr = kDIErrReadFailed; goto bail; } @@ -390,7 +390,7 @@ Win32VolumeAccess::BlockAccess::ScanCapacity(BlockAccess* pThis, long* pNumBlock break; } else { /* we overshot, binary-search backwards */ - WMSG1("OVERSHOT at %ld\n", kTypicalSizes[i]); + LOGI("OVERSHOT at %ld", kTypicalSizes[i]); long good, bad; if (i == 0) good = 0; @@ -419,17 +419,17 @@ Win32VolumeAccess::BlockAccess::ScanCapacity(BlockAccess* pThis, long* pNumBlock totalBlocks = kLargest; } else { /* we never found a good block */ - WMSG0(" Win32VolumeAccess unable to determine size\n"); + LOGI(" Win32VolumeAccess unable to determine size"); dierr = kDIErrReadFailed; goto bail; } } if (totalBlocks > (3 * 1024 * 1024) / BlockAccess::kBlockSize) { - WMSG2(" GFDWinVolume: size is %ld (%.2fMB)\n", + LOGI(" GFDWinVolume: size is %ld (%.2fMB)", totalBlocks, (float) totalBlocks / (2048.0)); } else { - WMSG2(" GFDWinVolume: size is %ld (%.2fKB)\n", + LOGI(" GFDWinVolume: size is %ld (%.2fKB)", totalBlocks, (float) totalBlocks / 2.0); } *pNumBlocks = totalBlocks; @@ -449,10 +449,10 @@ Win32VolumeAccess::BlockAccess::CanReadBlock(BlockAccess* pThis, long blockNum) dierr = pThis->ReadBlocks(blockNum, 1, buf); if (dierr == kDIErrNone) { - WMSG1(" +++ Checked %ld (good)\n", blockNum); + LOGI(" +++ Checked %ld (good)", blockNum); return true; } else { - WMSG1(" +++ Checked %ld (bad)\n", blockNum); + LOGI(" +++ Checked %ld (bad)", blockNum); return false; } } @@ -544,14 +544,14 @@ Win32VolumeAccess::BlockAccess::GetInt13Unit(HANDLE handle, int driveNum, int* p ®, sizeof(reg), ®, sizeof(reg), &cb, 0); if (result == 0) { - WMSG1(" DeviceIoControl(Int21h, 6fh) FAILED (err=%ld)\n", + LOGI(" DeviceIoControl(Int21h, 6fh) FAILED (err=%ld)", GetLastError()); dierr = LastErrorToDIError(); goto bail; } if (reg.reg_Flags & CARRY_FLAG) { - WMSG1(" --- retrying GDMI with alternate device category (ax=%ld)\n", + LOGI(" --- retrying GDMI with alternate device category (ax=%ld)", reg.reg_EAX); reg.reg_EAX = 0x440d; // generic IOCTL reg.reg_EBX = driveNum; @@ -562,22 +562,22 @@ Win32VolumeAccess::BlockAccess::GetInt13Unit(HANDLE handle, int driveNum, int* p ®, sizeof(reg), &cb, 0); } if (result == 0) { - WMSG1(" DeviceIoControl(Int21h, 6fh)(retry) FAILED (err=%ld)\n", + LOGI(" DeviceIoControl(Int21h, 6fh)(retry) FAILED (err=%ld)", GetLastError()); dierr = LastErrorToDIError(); goto bail; } if (reg.reg_Flags & CARRY_FLAG) { - WMSG1(" --- GetDriveMapInfo call (retry) failed (ax=%ld)\n", + LOGI(" --- GetDriveMapInfo call (retry) failed (ax=%ld)", reg.reg_EAX); dierr = kDIErrReadFailed; // close enough goto bail; } - WMSG3(" +++ DriveMapInfo len=%d flags=%d unit=%d\n", + LOGI(" +++ DriveMapInfo len=%d flags=%d unit=%d", driveMapInfo.dmiInfoLength, driveMapInfo.dmiFlags, driveMapInfo.dmiInt13Unit); - WMSG3(" +++ driveMap=0x%08lx RBA=0x%08lx 0x%08lx\n", + LOGI(" +++ driveMap=0x%08lx RBA=0x%08lx 0x%08lx", driveMapInfo.dmiAssociatedDriveMap, driveMapInfo.dmiPartitionStartRBA_hi, driveMapInfo.dmiPartitionStartRBA_lo); @@ -642,7 +642,7 @@ Win32VolumeAccess::BlockAccess::LookupFloppyGeometry(long totalBlocks, break; if (i == NELEM(floppyGeometry)) { - WMSG1( "GetFloppyGeometry: no match for blocks=%ld\n", totalBlocks); + LOGI( "GetFloppyGeometry: no match for blocks=%ld", totalBlocks); return false; } @@ -711,7 +711,7 @@ Win32VolumeAccess::BlockAccess::GetFloppyDriveKind(HANDLE handle, int unitNum, sizeof(reg), ®, sizeof(reg), &cb, 0); if (result == 0 || (reg.reg_Flags & CARRY_FLAG)) { - WMSG3(" GetFloppyKind failed: result=%d flags=0x%04x AH=%d\n", + LOGI(" GetFloppyKind failed: result=%d flags=0x%04x AH=%d", result, reg.reg_Flags, HIBYTE(reg.reg_EAX)); return kDIErrGeneric; } @@ -720,7 +720,7 @@ Win32VolumeAccess::BlockAccess::GetFloppyDriveKind(HANDLE handle, int unitNum, if (bl > 0 && bl < 6) *pKind = (FloppyKind) bl; else { - WMSG1(" GetFloppyKind: unrecognized kind %d\n", bl); + LOGI(" GetFloppyKind: unrecognized kind %d", bl); return kDIErrGeneric; } @@ -759,7 +759,7 @@ Win32VolumeAccess::BlockAccess::ReadBlocksInt13h(HANDLE handle, int unitNum, reg.reg_ECX = MAKEWORD(sector, cylinder); reg.reg_EDX = MAKEWORD(unitNum, head); - //WMSG4(" DIOC Int13h read c=%d h=%d s=%d rc=%d\n", + //LOGI(" DIOC Int13h read c=%d h=%d s=%d rc=%d", // cylinder, head, sector, blockCount); result = DeviceIoControl(handle, VWIN32_DIOC_DOS_INT13, ®, sizeof(reg), ®, sizeof(reg), &cb, 0); @@ -773,11 +773,11 @@ Win32VolumeAccess::BlockAccess::ReadBlocksInt13h(HANDLE handle, int unitNum, { break; } - WMSG1(" DIOC soft read failure, ax=0x%08lx\n", reg.reg_EAX); + LOGI(" DIOC soft read failure, ax=0x%08lx", reg.reg_EAX); } if (!result || (reg.reg_Flags & CARRY_FLAG)) { int ah = HIBYTE(reg.reg_EAX); - WMSG2(" DIOC read failed, result=%d ah=%ld\n", result, ah); + LOGI(" DIOC read failed, result=%d ah=%ld", result, ah); if (ah != 0) return ah; else @@ -812,7 +812,7 @@ Win32VolumeAccess::BlockAccess::ReadBlocksInt13h(HANDLE handle, int unitNum, if (startBlock < 0 || blockCount <= 0) return kDIErrInvalidArg; if (startBlock + blockCount > pGeometry->blockCount) { - WMSG2(" ReadInt13h: invalid request for start=%ld count=%d\n", + LOGI(" ReadInt13h: invalid request for start=%ld count=%d", startBlock, blockCount); return kDIErrReadFailed; } @@ -833,14 +833,14 @@ Win32VolumeAccess::BlockAccess::ReadBlocksInt13h(HANDLE handle, int unitNum, runCount = lastBlockOnTrack - startBlock +1; if (runCount > blockCount) runCount = blockCount; - //WMSG3("R runCount=%d lastBlkOnT=%d start=%d\n", + //LOGI("R runCount=%d lastBlkOnT=%d start=%d", // runCount, lastBlockOnTrack, startBlock); assert(runCount > 0); status = ReadBlocksInt13h(handle, unitNum, cylinder, head, sector, runCount, buf); if (status != 0) { - WMSG1(" DIOC read failed (status=%d)\n", status); + LOGI(" DIOC read failed (status=%d)", status); return kDIErrReadFailed; } @@ -876,7 +876,7 @@ Win32VolumeAccess::BlockAccess::WriteBlocksInt13h(HANDLE handle, int unitNum, reg.reg_ECX = MAKEWORD(sector, cylinder); reg.reg_EDX = MAKEWORD(unitNum, head); - WMSG4(" DIOC Int13h write c=%d h=%d s=%d rc=%d\n", + LOGI(" DIOC Int13h write c=%d h=%d s=%d rc=%d", cylinder, head, sector, blockCount); result = DeviceIoControl(handle, VWIN32_DIOC_DOS_INT13, ®, sizeof(reg), ®, sizeof(reg), &cb, 0); @@ -886,11 +886,11 @@ Win32VolumeAccess::BlockAccess::WriteBlocksInt13h(HANDLE handle, int unitNum, if (HIBYTE(reg.reg_EAX) == kInt13StatusWriteProtected) break; // no point retrying this - WMSG1(" DIOC soft write failure, ax=0x%08lx\n", reg.reg_EAX); + LOGI(" DIOC soft write failure, ax=0x%08lx", reg.reg_EAX); } if (!result || (reg.reg_Flags & CARRY_FLAG)) { int ah = HIBYTE(reg.reg_EAX); - WMSG2(" DIOC write failed, result=%d ah=%ld\n", result, ah); + LOGI(" DIOC write failed, result=%d ah=%ld", result, ah); if (ah != 0) return ah; else @@ -927,7 +927,7 @@ Win32VolumeAccess::BlockAccess::WriteBlocksInt13h(HANDLE handle, int unitNum, if (startBlock < 0 || blockCount <= 0) return kDIErrInvalidArg; if (startBlock + blockCount > pGeometry->blockCount) { - WMSG2(" WriteInt13h: invalid request for start=%ld count=%d\n", + LOGI(" WriteInt13h: invalid request for start=%ld count=%d", startBlock, blockCount); return kDIErrWriteFailed; } @@ -941,14 +941,14 @@ Win32VolumeAccess::BlockAccess::WriteBlocksInt13h(HANDLE handle, int unitNum, runCount = lastBlockOnTrack - startBlock +1; if (runCount > blockCount) runCount = blockCount; - //WMSG3("W runCount=%d lastBlkOnT=%d start=%d\n", + //LOGI("W runCount=%d lastBlkOnT=%d start=%d", // runCount, lastBlockOnTrack, startBlock); assert(runCount > 0); status = WriteBlocksInt13h(handle, unitNum, cylinder, head, sector, runCount, buf); if (status != 0) { - WMSG1(" DIOC write failed (status=%d)\n", status); + LOGI(" DIOC write failed (status=%d)", status); if (status == kInt13StatusWriteProtected) return kDIErrWriteProtected; else @@ -988,7 +988,7 @@ Win32VolumeAccess::BlockAccess::ReadBlocksInt21h(HANDLE handle, int driveNum, reg.reg_EBX = (DWORD)&dio; reg.reg_ECX = 0xFFFF; // use DISKIO struct - WMSG3(" Int25 read start=%d count=%d\n", + LOGI(" Int25 read start=%d count=%d", startBlock, blockCount); result = ::DeviceIoControl(handle, VWIN32_DIOC_DOS_INT25, ®, sizeof(reg), @@ -997,7 +997,7 @@ Win32VolumeAccess::BlockAccess::ReadBlocksInt21h(HANDLE handle, int driveNum, // Determine if the DeviceIoControl call and the read succeeded. result = result && !(reg.reg_Flags & CARRY_FLAG); - WMSG2(" +++ read from block %ld (result=%d)\n", startBlock, result); + LOGI(" +++ read from block %ld (result=%d)", startBlock, result); if (!result) return kDIErrReadFailed; #else @@ -1016,7 +1016,7 @@ Win32VolumeAccess::BlockAccess::ReadBlocksInt21h(HANDLE handle, int driveNum, reg.reg_EDX = driveNum; // Int 21h, fn 7305h drive numbers are 1-based assert(reg.reg_ESI == 0); // read/write flag - WMSG2(" Int21/7305h read start=%d count=%d\n", + LOGI(" Int21/7305h read start=%d count=%d", startBlock, blockCount); result = ::DeviceIoControl(handle, VWIN32_DIOC_DOS_DRIVEINFO, ®, sizeof(reg), @@ -1025,7 +1025,7 @@ Win32VolumeAccess::BlockAccess::ReadBlocksInt21h(HANDLE handle, int driveNum, // Determine if the DeviceIoControl call and the read succeeded. result = result && !(reg.reg_Flags & CARRY_FLAG); - WMSG4(" +++ RB21h %ld %d (result=%d lastError=%ld)\n", + LOGI(" +++ RB21h %ld %d (result=%d lastError=%ld)", startBlock, blockCount, result, GetLastError()); if (!result) return kDIErrReadFailed; @@ -1059,7 +1059,7 @@ Win32VolumeAccess::BlockAccess::WriteBlocksInt21h(HANDLE handle, int driveNum, reg.reg_EDX = driveNum; // Int 21h, fn 7305h drive numbers are 1-based reg.reg_ESI = 0x6001; // write normal data (bit flags) - //WMSG2(" Int21/7305h write start=%d count=%d\n", + //LOGI(" Int21/7305h write start=%d count=%d", // startBlock, blockCount); result = ::DeviceIoControl(handle, VWIN32_DIOC_DOS_DRIVEINFO, ®, sizeof(reg), @@ -1068,7 +1068,7 @@ Win32VolumeAccess::BlockAccess::WriteBlocksInt21h(HANDLE handle, int driveNum, // Determine if the DeviceIoControl call and the read succeeded. result = result && !(reg.reg_Flags & CARRY_FLAG); - WMSG4(" +++ WB21h %ld %d (result=%d lastError=%ld)\n", + LOGI(" +++ WB21h %ld %d (result=%d lastError=%ld)", startBlock, blockCount, result, GetLastError()); if (!result) return kDIErrWriteFailed; @@ -1102,17 +1102,17 @@ Win32VolumeAccess::BlockAccess::ReadBlocksWin2K(HANDLE handle, FILE_BEGIN); if (posn == INVALID_SET_FILE_POINTER) { DWORD lerr = GetLastError(); - WMSG1(" GFDWinVolume ReadBlock: SFP failed (err=%ld)\n", lerr); + LOGI(" GFDWinVolume ReadBlock: SFP failed (err=%ld)", lerr); return LastErrorToDIError(); } - //WMSG2(" ReadFile block start=%d count=%d\n", startBlock, blockCount); + //LOGI(" ReadFile block start=%d count=%d", startBlock, blockCount); BOOL result; result = ::ReadFile(handle, buf, blockCount * kBlockSize, &actual, NULL); if (!result) { DWORD lerr = GetLastError(); - WMSG3(" ReadBlocksWin2K: ReadFile failed (start=%ld count=%d err=%ld)\n", + LOGI(" ReadBlocksWin2K: ReadFile failed (start=%ld count=%d err=%ld)", startBlock, blockCount, lerr); return LastErrorToDIError(); } @@ -1136,7 +1136,7 @@ Win32VolumeAccess::BlockAccess::WriteBlocksWin2K(HANDLE handle, FILE_BEGIN); if (posn == INVALID_SET_FILE_POINTER) { DWORD lerr = GetLastError(); - WMSG2(" GFDWinVolume ReadBlocks: SFP %ld failed (err=%ld)\n", + LOGI(" GFDWinVolume ReadBlocks: SFP %ld failed (err=%ld)", startBlock * kBlockSize, lerr); return LastErrorToDIError(); } @@ -1145,7 +1145,7 @@ Win32VolumeAccess::BlockAccess::WriteBlocksWin2K(HANDLE handle, result = ::WriteFile(handle, buf, blockCount * kBlockSize, &actual, NULL); if (!result) { DWORD lerr = GetLastError(); - WMSG1(" GFDWinVolume WriteBlocks: WriteFile failed (err=%ld)\n", + LOGI(" GFDWinVolume WriteBlocks: WriteFile failed (err=%ld)", lerr); return LastErrorToDIError(); } @@ -1179,14 +1179,14 @@ Win32VolumeAccess::LogicalBlockAccess::Open(const WCHAR* deviceName, bool readOn deviceName[1] != ':' || deviceName[2] != '\\' || deviceName[3] != '\0') { - WMSG1(" LogicalBlockAccess: invalid device name '%s'\n", deviceName); + LOGI(" LogicalBlockAccess: invalid device name '%s'", deviceName); assert(false); dierr = kDIErrInvalidArg; goto bail; } if (deviceName[0] == 'C') { if (readOnly == false) { - WMSG0(" REFUSING WRITE ACCESS TO C:\\ \n"); + LOGI(" REFUSING WRITE ACCESS TO C:\\ "); return kDIErrVWAccessForbidden; } } @@ -1216,7 +1216,7 @@ Win32VolumeAccess::LogicalBlockAccess::Open(const WCHAR* deviceName, bool readOn OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, NULL); if (fHandle == INVALID_HANDLE_VALUE) { DWORD lastError = GetLastError(); - WMSG1(" Win32LVOpen: CreateFile(vwin32) failed (err=%ld)\n", + LOGI(" Win32LVOpen: CreateFile(vwin32) failed (err=%ld)", lastError); dierr = LastErrorToDIError(); goto bail; @@ -1231,14 +1231,14 @@ Win32VolumeAccess::LogicalBlockAccess::Open(const WCHAR* deviceName, bool readOn goto bail; if (int13Unit < 4) { fFloppyUnit = int13Unit; - WMSG2(" Logical volume #%d looks like floppy unit %d\n", + LOGI(" Logical volume #%d looks like floppy unit %d", fDriveNum, fFloppyUnit); } #endif } else { WCHAR device[7] = _T("\\\\.\\_:"); device[4] = deviceName[0]; - WMSG1("Opening '%s'\n", device); + LOGI("Opening '%s'", device); // If we're reading, allow others to write. If we're writing, insist // upon exclusive access to the volume. @@ -1265,7 +1265,7 @@ Win32VolumeAccess::LogicalBlockAccess::Open(const WCHAR* deviceName, bool readOn ::CloseHandle(tmpHandle); } } - WMSG2(" LBAccess Open: CreateFile failed (err=%ld dierr=%d)\n", + LOGI(" LBAccess Open: CreateFile failed (err=%ld dierr=%d)", lastError, dierr); goto bail; } @@ -1277,17 +1277,17 @@ Win32VolumeAccess::LogicalBlockAccess::Open(const WCHAR* deviceName, bool readOn if (fIsCDROM) { assert(Global::GetHasSPTI() || Global::GetHasASPI()); if (Global::GetHasASPI() && (!Global::GetHasSPTI() || kPreferASPI)) { - WMSG0(" LBAccess using ASPI\n"); + LOGI(" LBAccess using ASPI"); fCDBaggage.fUseASPI = true; } else { - WMSG0(" LBAccess using SPTI\n"); + LOGI(" LBAccess using SPTI"); fCDBaggage.fUseASPI = false; } if (fCDBaggage.fUseASPI) { dierr = FindASPIDriveMapping(deviceName[0]); if (dierr != kDIErrNone) { - WMSG0("ERROR: couldn't find ASPI drive mapping\n"); + LOGI("ERROR: couldn't find ASPI drive mapping"); dierr = kDIErrNoASPIMapping; goto bail; } @@ -1333,7 +1333,7 @@ Win32VolumeAccess::LogicalBlockAccess::ReadBlocksCDROM(HANDLE handle, assert(blockCount > 0); assert(buf != NULL); - //WMSG2(" CDROM read block %ld (%ld)\n", startBlock, block); + //LOGI(" CDROM read block %ld (%ld)", startBlock, block); /* alloc sector buffer on first use */ if (fLastSectorCache == NULL) { @@ -1378,7 +1378,7 @@ Win32VolumeAccess::LogicalBlockAccess::ReadBlocksCDROM(HANDLE handle, if (thisNumBlocks > blockCount) thisNumBlocks = blockCount; - //WMSG3(" Small copy (sectIdx=%ld off=%d*512 size=%d*512)\n", + //LOGI(" Small copy (sectIdx=%ld off=%d*512 size=%d*512)", // sectorIndex, sectorOffset, thisNumBlocks); memcpy(buf, fLastSectorCache + sectorOffset * kBlockSize, thisNumBlocks * kBlockSize); @@ -1394,7 +1394,7 @@ Win32VolumeAccess::LogicalBlockAccess::ReadBlocksCDROM(HANDLE handle, int numSectors; numSectors = blockCount / kFactor; // rounds down - //WMSG2(" Big read (sectIdx=%ld numSect=%d)\n", + //LOGI(" Big read (sectIdx=%ld numSect=%d)", // sectorIndex, numSectors); dierr = SPTI::ReadBlocks(handle, sectorIndex, numSectors, kCDROMSectorSize, buf); @@ -1442,7 +1442,7 @@ Win32VolumeAccess::PhysicalBlockAccess::Open(const WCHAR* deviceName, bool readO deviceName[2] != ':' || deviceName[3] != '\\' || deviceName[4] != '\0') { - WMSG1(" PhysicalBlockAccess: invalid device name '%s'\n", deviceName); + LOGI(" PhysicalBlockAccess: invalid device name '%s'", deviceName); assert(false); dierr = kDIErrInvalidArg; goto bail; @@ -1450,28 +1450,28 @@ Win32VolumeAccess::PhysicalBlockAccess::Open(const WCHAR* deviceName, bool readO if (deviceName[0] == '8' && deviceName[1] == '0') { if (!gAllowWritePhys0 && readOnly == false) { - WMSG0(" REFUSING WRITE ACCESS TO 80:\\ \n"); + LOGI(" REFUSING WRITE ACCESS TO 80:\\ "); return kDIErrVWAccessForbidden; } } fInt13Unit = (deviceName[0] - '0') * 16 + deviceName[1] - '0'; if (!fIsWin9x && fInt13Unit < 0x80) { - WMSG0("GLITCH: can't open floppy as physical unit in Win2K\n"); + LOGI("GLITCH: can't open floppy as physical unit in Win2K"); dierr = kDIErrInvalidArg; goto bail; } if (fIsWin9x && fInt13Unit >= 0x80) { - WMSG0("GLITCH: can't access physical HD in Win9x\n"); + LOGI("GLITCH: can't access physical HD in Win9x"); dierr = kDIErrInvalidArg; goto bail; } if ((fInt13Unit >= 0x00 && fInt13Unit < 0x04) || (fInt13Unit >= 0x80 && fInt13Unit < 0x88)) { - WMSG1(" Win32VA/P: opening unit %02xh\n", fInt13Unit); + LOGI(" Win32VA/P: opening unit %02xh", fInt13Unit); } else { - WMSG2("GLITCH: converted '%s' to %02xh\n", deviceName, fInt13Unit); + LOGI("GLITCH: converted '%s' to %02xh", deviceName, fInt13Unit); dierr = kDIErrInternal; goto bail; } @@ -1487,7 +1487,7 @@ Win32VolumeAccess::PhysicalBlockAccess::Open(const WCHAR* deviceName, bool readO OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, NULL); if (fHandle == INVALID_HANDLE_VALUE) { DWORD lastError = GetLastError(); - WMSG1(" Win32VA/PBOpen: CreateFile(vwin32) failed (err=%ld)\n", + LOGI(" Win32VA/PBOpen: CreateFile(vwin32) failed (err=%ld)", lastError); dierr = LastErrorToDIError(); goto bail; @@ -1501,7 +1501,7 @@ Win32VolumeAccess::PhysicalBlockAccess::Open(const WCHAR* deviceName, bool readO WCHAR device[19] = _T("\\\\.\\PhysicalDrive_"); assert(fInt13Unit >= 0x80 && fInt13Unit <= 0x89); device[17] = fInt13Unit - 0x80 + '0'; - WMSG2("Opening '%s' (access=0x%02x)\n", device, access); + LOGI("Opening '%s' (access=0x%02x)", device, access); // If we're reading, allow others to write. If we're writing, insist // upon exclusive access to the volume. @@ -1514,7 +1514,7 @@ Win32VolumeAccess::PhysicalBlockAccess::Open(const WCHAR* deviceName, bool readO if (fHandle == INVALID_HANDLE_VALUE) { DWORD lastError = GetLastError(); dierr = LastErrorToDIError(); - WMSG2(" PBAccess Open: CreateFile failed (err=%ld dierr=%d)\n", + LOGI(" PBAccess Open: CreateFile failed (err=%ld dierr=%d)", lastError, dierr); goto bail; } @@ -1614,13 +1614,13 @@ Win32VolumeAccess::PhysicalBlockAccess::DetectFloppyGeometry(void) goto bail; default: - WMSG1(" Unknown driveKind %d\n", driveKind); + LOGI(" Unknown driveKind %d", driveKind); assert(false); dierr = kDIErrInternal; goto bail; } - WMSG1("PBA: floppy disk appears to be type=%d\n", fFloppyKind); + LOGI("PBA: floppy disk appears to be type=%d", fFloppyKind); fGeometry = floppyGeometry[fFloppyKind].geom; bail: @@ -1638,7 +1638,7 @@ Win32VolumeAccess::PhysicalBlockAccess::FlushBlockDevice(void) if (::FlushFileBuffers(fHandle) == FALSE) { DWORD lastError = GetLastError(); - WMSG1(" Win32VA/PBAFlush: FlushFileBuffers failed (err=%ld)\n", + LOGI(" Win32VA/PBAFlush: FlushFileBuffers failed (err=%ld)", lastError); dierr = LastErrorToDIError(); } @@ -1699,7 +1699,7 @@ Win32VolumeAccess::ASPIBlockAccess::Open(const char* deviceName, bool readOnly) result |= ExtractInt(&cp, &target); result |= ExtractInt(&cp, &lun); if (result != 0) { - WMSG1(" Win32VA couldn't parse '%s'\n", deviceName); + LOGI(" Win32VA couldn't parse '%s'", deviceName); dierr = kDIErrInternal; goto bail; } @@ -1713,7 +1713,7 @@ Win32VolumeAccess::ASPIBlockAccess::Open(const char* deviceName, bool readOnly) if (dierr != kDIErrNone || (deviceType != kScsiDevTypeCDROM && deviceType != kScsiDevTypeDASD)) { - WMSG2(" Win32VA bad GetDeviceType err=%d type=%d\n", + LOGI(" Win32VA bad GetDeviceType err=%d type=%d", dierr, deviceType); dierr = kDIErrInternal; // should not be here at all goto bail; @@ -1723,7 +1723,7 @@ Win32VolumeAccess::ASPIBlockAccess::Open(const char* deviceName, bool readOnly) else fReadOnly = readOnly; - WMSG4(" Win32VA successful 'open' of '%s' on %d:%d:%d\n", + LOGI(" Win32VA successful 'open' of '%s' on %d:%d:%d", deviceName, fAdapter, fTarget, fLun); bail: @@ -1774,13 +1774,13 @@ Win32VolumeAccess::ASPIBlockAccess::DetectCapacity(long* pNumBlocks) if (dierr != kDIErrNone) goto bail; - WMSG3("READ CAPACITY reports lba=%lu blockLen=%lu (total=%lu)\n", + LOGI("READ CAPACITY reports lba=%lu blockLen=%lu (total=%lu)", lba, blockLen, lba*blockLen); fChunkSize = blockLen; if ((blockLen % 512) != 0) { - WMSG1("Unacceptable CD-ROM blockLen=%ld, bailing\n", blockLen); + LOGI("Unacceptable CD-ROM blockLen=%ld, bailing", blockLen); dierr = kDIErrReadFailed; goto bail; } @@ -1789,7 +1789,7 @@ Win32VolumeAccess::ASPIBlockAccess::DetectCapacity(long* pNumBlocks) // we need to add one. *pNumBlocks = (blockLen/512) * (lba+1); - WMSG1(" ASPI returning 512-byte block count %ld\n", *pNumBlocks); + LOGI(" ASPI returning 512-byte block count %ld", *pNumBlocks); bail: return dierr; @@ -1853,7 +1853,7 @@ Win32VolumeAccess::ASPIBlockAccess::ReadBlocks(long startBlock, short blockCount if (thisNumBlocks > blockCount) thisNumBlocks = blockCount; - //WMSG3(" Small copy (chIdx=%ld off=%d*512 size=%d*512)\n", + //LOGI(" Small copy (chIdx=%ld off=%d*512 size=%d*512)", // chunkIndex, chunkOffset, thisNumBlocks); memcpy(buf, fLastChunkCache + chunkOffset * kBlockSize, thisNumBlocks * kBlockSize); @@ -1869,7 +1869,7 @@ Win32VolumeAccess::ASPIBlockAccess::ReadBlocks(long startBlock, short blockCount int numChunks; numChunks = blockCount / kFactor; // rounds down - //WMSG2(" Big read (chIdx=%ld numCh=%d)\n", + //LOGI(" Big read (chIdx=%ld numCh=%d)", // chunkIndex, numChunks); dierr = fpASPI->ReadBlocks(fAdapter, fTarget, fLun, chunkIndex, numChunks, fChunkSize, buf); @@ -1936,7 +1936,7 @@ Win32VolumeAccess::ASPIBlockAccess::WriteBlocks(long startBlock, short blockCoun if (thisNumBlocks > blockCount) thisNumBlocks = blockCount; - WMSG3(" Small copy out (chIdx=%ld off=%d*512 size=%d*512)\n", + LOGI(" Small copy out (chIdx=%ld off=%d*512 size=%d*512)", chunkIndex, chunkOffset, thisNumBlocks); memcpy(fLastChunkCache + chunkOffset * kBlockSize, buf, thisNumBlocks * kBlockSize); @@ -1950,7 +1950,7 @@ Win32VolumeAccess::ASPIBlockAccess::WriteBlocks(long startBlock, short blockCoun int numChunks; numChunks = blockCount / kFactor; // rounds down - WMSG2(" Big write (chIdx=%ld numCh=%d)\n", + LOGI(" Big write (chIdx=%ld numCh=%d)", chunkIndex, numChunks); dierr = fpASPI->WriteBlocks(fAdapter, fTarget, fLun, chunkIndex, numChunks, fChunkSize, buf); @@ -2012,7 +2012,7 @@ CBCache::GetFromCache(long blockNum, void* buf) return kDIErrInternal; } - //WMSG1(" CBCache: getting block %d from cache\n", blockNum); + //LOGI(" CBCache: getting block %d from cache", blockNum); int offset = (blockNum - fFirstBlock) * kBlockSize; assert(offset >= 0); @@ -2065,12 +2065,12 @@ CBCache::PutInCache(long blockNum, const void* buf, bool isDirty) } if (fFirstBlock == kEmpty) { - //WMSG1(" CBCache: starting anew with block %ld\n", blockNum); + //LOGI(" CBCache: starting anew with block %ld", blockNum); fFirstBlock = blockNum; fNumBlocks = 1; blockOffset = 0; } else if (blockNum == fFirstBlock + fNumBlocks) { - //WMSG1(" CBCache: appending block %ld\n", blockNum); + //LOGI(" CBCache: appending block %ld", blockNum); blockOffset = fNumBlocks; fNumBlocks++; } else if (blockNum >= fFirstBlock && blockNum < fFirstBlock + fNumBlocks) { @@ -2083,14 +2083,14 @@ CBCache::PutInCache(long blockNum, const void* buf, bool isDirty) assert(blockOffset < kMaxCachedBlocks); if (fDirty[blockOffset] && !isDirty) { - WMSG1("BUG: CBCache trying to clear dirty flag for block %ld\n", + LOGI("BUG: CBCache trying to clear dirty flag for block %ld", blockNum); assert(false); return kDIErrInternal; } fDirty[blockOffset] = isDirty; - //WMSG2(" CBCache: adding block %d to cache at %d\n", blockNum, blockOffset); + //LOGI(" CBCache: adding block %d to cache at %d", blockNum, blockOffset); int offset = blockOffset * kBlockSize; assert(offset >= 0); @@ -2110,12 +2110,12 @@ CBCache::IsDirty(void) const assert(fNumBlocks > 0); for (int i = 0; i < fNumBlocks; i++) { if (fDirty[i]) { - //WMSG0(" CBCache: dirty blocks found\n"); + //LOGI(" CBCache: dirty blocks found"); return true; } } - //WMSG0(" CBCache: no dirty blocks found\n"); + //LOGI(" CBCache: no dirty blocks found"); return false; } @@ -2157,7 +2157,7 @@ CBCache::Purge(void) if (IsDirty()) { // Should only happen after a write failure causes us to clean up. - WMSG0("HEY: CBCache purging dirty blocks!\n"); + LOGI("HEY: CBCache purging dirty blocks!"); //assert(false); } Scrub(); diff --git a/diskimg/Win32BlockIO.h b/diskimg/Win32BlockIO.h index b7cf301..0bb1844 100644 --- a/diskimg/Win32BlockIO.h +++ b/diskimg/Win32BlockIO.h @@ -242,7 +242,7 @@ private: {} virtual ~LogicalBlockAccess(void) { if (fHandle != NULL) { - //WMSG0("HEY: LogicalBlockAccess: forcing close\n"); + //LOGI("HEY: LogicalBlockAccess: forcing close"); Close(); } delete[] fLastSectorCache; diff --git a/mdc/AboutDlg.cpp b/mdc/AboutDlg.cpp index b168d2b..25d4722 100644 --- a/mdc/AboutDlg.cpp +++ b/mdc/AboutDlg.cpp @@ -49,7 +49,7 @@ BOOL AboutDlg::OnInitDialog() pWnd->GetWindowText(fmt); newText.Format(fmt, kAppMajorVersion, kAppMinorVersion, kAppBugVersion); pWnd->SetWindowText(newText); - WMSG1("STR is '%ls'\n", (LPCWSTR) newText); + LOGI("STR is '%ls'", (LPCWSTR) newText); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE diff --git a/mdc/Main.cpp b/mdc/Main.cpp index 55b2c7e..3afa7eb 100644 --- a/mdc/Main.cpp +++ b/mdc/Main.cpp @@ -70,7 +70,7 @@ MainWindow::~MainWindow() { // int cc; // cc = ::WinHelp(m_hWnd, ::AfxGetApp()->m_pszHelpFilePath, HELP_QUIT, 0); -// WMSG1("Turning off WinHelp returned %d\n", cc); +// LOGI("Turning off WinHelp returned %d", cc); DiskImgLib::Global::AppCleanup(); } @@ -112,7 +112,7 @@ MainWindow::OnHelpAbout(void) AboutDlg dlg(this); result = dlg.DoModal(); - WMSG1("HelpAbout returned %d\n", result); + LOGI("HelpAbout returned %d", result); } @@ -188,7 +188,7 @@ MainWindow::NufxErrorMsgHandler(NuArchive* /*pArchive*/, void* vErrorMessage) const NuErrorMessage* pErrorMessage = (const NuErrorMessage*) vErrorMessage; LOG_BASE(pErrorMessage->isDebug ? DebugLog::LOG_DEBUG : DebugLog::LOG_WARNING, - pErrorMessage->file, pErrorMessage->line, " %hs\n", + pErrorMessage->file, pErrorMessage->line, " %hs", pErrorMessage->message); return kNuOK; @@ -223,7 +223,7 @@ MainWindow::ScanFiles(void) } const WCHAR* buf = chooseFiles.GetFileNames(); - WMSG2("Selected path = '%ls' (offset=%d)\n", buf, + LOGI("Selected path = '%ls' (offset=%d)", buf, chooseFiles.GetFileNameOffset()); /* choose output file */ @@ -239,7 +239,7 @@ MainWindow::ScanFiles(void) } outPath = dlg.GetPathName(); - WMSG1("NEW FILE '%ls'\n", (LPCWSTR) outPath); + LOGI("NEW FILE '%ls'", (LPCWSTR) outPath); scanOpts.outfp = _wfopen(outPath, L"w"); if (scanOpts.outfp == NULL) { @@ -291,7 +291,7 @@ MainWindow::ScanFiles(void) scanOpts.pProgress->fpCancelFlag = &fCancelFlag; fCancelFlag = false; if (scanOpts.pProgress->Create(this) == FALSE) { - WMSG0("WARNING: ProgressDlg init failed\n"); + LOGI("WARNING: ProgressDlg init failed"); ASSERT(false); } else { scanOpts.pProgress->CenterWindow(this); @@ -304,11 +304,11 @@ MainWindow::ScanFiles(void) buf += chooseFiles.GetFileNameOffset(); while (*buf != '\0') { if (Process(buf, &scanOpts, &errMsg) != 0) { - WMSG2("Skipping '%ls': %ls.\n", buf, (LPCWSTR) errMsg); + LOGI("Skipping '%ls': %ls.", buf, (LPCWSTR) errMsg); } if (fCancelFlag) { - WMSG0("CANCELLED by user\n"); + LOGI("CANCELLED by user"); MessageBox(L"Cancelled!", L"MDC", MB_OK); goto bail; } @@ -523,7 +523,7 @@ MainWindow::ProcessDirectory(const WCHAR* dirName, ScanOpts* pScanOpts, ASSERT(dirName != NULL); ASSERT(pErrMsg != NULL); - WMSG1("+++ DESCEND: '%ls'\n", (LPCWSTR) dirName); + LOGI("+++ DESCEND: '%ls'", (LPCWSTR) dirName); dirp = OpenDir(dirName); if (dirp == NULL) { @@ -541,7 +541,7 @@ MainWindow::ProcessDirectory(const WCHAR* dirName, ScanOpts* pScanOpts, len = wcslen(dirName); if (len + wcslen(entry->d_name) + 2 > MAX_PATH) { - WMSG4("ERROR: Filename exceeds %d bytes: %ls%c%ls", + LOGE("ERROR: Filename exceeds %d bytes: %ls%c%ls", MAX_PATH, dirName, fssep, entry->d_name); goto bail; } @@ -818,7 +818,7 @@ MainWindow::LoadDiskFSContents(DiskFS* pDiskFS, const char* volName, if (recordKind == kRecordKindVolumeDir) { /* this is a volume directory */ - WMSG1("Not displaying volume dir '%ls'\n", pFile->GetPathName()); + LOGI("Not displaying volume dir '%ls'", pFile->GetPathName()); continue; } diff --git a/mdc/ProgressDlg.cpp b/mdc/ProgressDlg.cpp index 5b37965..abdd9b1 100644 --- a/mdc/ProgressDlg.cpp +++ b/mdc/ProgressDlg.cpp @@ -70,7 +70,7 @@ ProgressDlg::SetCurrentFile(const WCHAR* fileName) void ProgressDlg::OnCancel() { // TODO: Add extra cleanup here - WMSG0("Cancel button pushed\n"); + LOGI("Cancel button pushed"); ASSERT(fpCancelFlag != NULL); *fpCancelFlag = true; diff --git a/mdc/mdc.cpp b/mdc/mdc.cpp index a5c2d43..61a01d0 100644 --- a/mdc/mdc.cpp +++ b/mdc/mdc.cpp @@ -26,7 +26,7 @@ MyApp::MyApp(LPCTSTR lpszAppName) : CWinApp(lpszAppName) gDebugLog = new DebugLog(L"C:\\src\\mdclog.txt"); time_t now = time(NULL); - LOGI("MDC v%d.%d.%d started at %.24hs\n", + LOGI("MDC v%d.%d.%d started at %.24hs", kAppMajorVersion, kAppMinorVersion, kAppBugVersion, ctime(&now)); @@ -35,7 +35,7 @@ MyApp::MyApp(LPCTSTR lpszAppName) : CWinApp(lpszAppName) tmpDbgFlag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); tmpDbgFlag |= _CRTDBG_LEAK_CHECK_DF; _CrtSetDbgFlag(tmpDbgFlag); - WMSG0("Leak detection enabled\n"); + LOGI("Leak detection enabled"); } /* @@ -43,7 +43,7 @@ MyApp::MyApp(LPCTSTR lpszAppName) : CWinApp(lpszAppName) */ MyApp::~MyApp(void) { - WMSG0("MDC SHUTTING DOWN\n\n"); + LOGI("MDC SHUTTING DOWN"); delete gDebugLog; } diff --git a/reformat/AWGS.cpp b/reformat/AWGS.cpp index f69d5b0..56cd05b 100644 --- a/reformat/AWGS.cpp +++ b/reformat/AWGS.cpp @@ -42,7 +42,7 @@ ReformatAWGS_WP::Process(const ReformatHolder* pHolder, /* must at least have the doc header and globals */ if (srcLen < kMinExpectedLen) { - WMSG0("Too short to be AWGS\n"); + LOGI("Too short to be AWGS"); return -1; } @@ -53,13 +53,13 @@ ReformatAWGS_WP::Process(const ReformatHolder* pHolder, */ val = Get16LE(srcBuf + 0); if (val != kExpectedVersion1 && val != kExpectedVersion2) { - WMSG2("AWGS_WP: unexpected version number (got 0x%04x, wanted 0x%04x)\n", + LOGI("AWGS_WP: unexpected version number (got 0x%04x, wanted 0x%04x)", val, kExpectedVersion1); DebugBreak(); } val = Get16LE(srcBuf + 2); if (val != kDocHeaderLen) { - WMSG2("Unexpected doc header len (got 0x%04x, wanted 0x%04x)\n", + LOGI("Unexpected doc header len (got 0x%04x, wanted 0x%04x)", val, kDocHeaderLen); return -1; } @@ -73,13 +73,13 @@ ReformatAWGS_WP::Process(const ReformatHolder* pHolder, */ val = Get16LE(srcBuf + 0); if (val > kExpectedIntVersion) { - WMSG2("Unexpected internal version number (got %d, expected %d)\n", + LOGI("Unexpected internal version number (got %d, expected %d)", val, kExpectedIntVersion); return -1; } /* date/time are pascal strings */ - WMSG2("File saved at '%.26hs' '%.10s'\n", srcBuf + 6, srcBuf + 32); + LOGI("File saved at '%.26hs' '%.10s'", srcBuf + 6, srcBuf + 32); srcBuf += kWPGlobalsLen; srcLen -= kWPGlobalsLen; @@ -87,18 +87,18 @@ ReformatAWGS_WP::Process(const ReformatHolder* pHolder, /* * Now come the three chunks, in order: main document, header, footer. */ - WMSG0("AWGS_WP: scanning doc\n"); + LOGI("AWGS_WP: scanning doc"); if (!ReadChunk(&srcBuf, &srcLen, &doc)) return -1; - WMSG0("AWGS_WP: scanning header\n"); + LOGI("AWGS_WP: scanning header"); if (!ReadChunk(&srcBuf, &srcLen, &header)) return -1; - WMSG0("AWGS_WP: scanning footer\n"); + LOGI("AWGS_WP: scanning footer"); if (!ReadChunk(&srcBuf, &srcLen, &footer)) return -1; if (srcLen != 0) { - WMSG1("AWGS NOTE: %ld bytes left in file\n", srcLen); + LOGI("AWGS NOTE: %ld bytes left in file", srcLen); } /* @@ -136,7 +136,7 @@ ReformatAWGS_WP::Process(const ReformatHolder* pHolder, RTFSetColor(kColorNone); RTFNewPara(); - WMSG0("AWGS_WP: rendering document\n"); + LOGI("AWGS_WP: rendering document"); PrintChunk(&doc); RTFEnd(); @@ -156,7 +156,7 @@ ReformatAWGS_WP::ReadChunk(const unsigned char** pSrcBuf, long* pSrcLen, pChunk->saveArrayCount = Get16LE(*pSrcBuf); if (pChunk->saveArrayCount == 0) { /* AWGS always has at least 1 paragraph */ - WMSG0("Save array is empty\n"); + LOGI("Save array is empty"); return false; } @@ -169,7 +169,7 @@ ReformatAWGS_WP::ReadChunk(const unsigned char** pSrcBuf, long* pSrcLen, *pSrcBuf += pChunk->saveArrayCount * kSaveArrayEntryLen; *pSrcLen -= pChunk->saveArrayCount * kSaveArrayEntryLen; if (*pSrcLen <= 0) { - WMSG2("SaveArray exceeds file length (count=%d len now %ld)\n", + LOGI("SaveArray exceeds file length (count=%d len now %ld)", pChunk->saveArrayCount, *pSrcLen); return false; } @@ -180,11 +180,11 @@ ReformatAWGS_WP::ReadChunk(const unsigned char** pSrcBuf, long* pSrcLen, */ pChunk->numRulers = GetNumRulers(pChunk->saveArray, pChunk->saveArrayCount); if (*pSrcLen < pChunk->numRulers * kRulerEntryLen) { - WMSG2("Not enough room for rulers (rem=%ld, needed=%ld)\n", + LOGI("Not enough room for rulers (rem=%ld, needed=%ld)", *pSrcLen, pChunk->numRulers * kRulerEntryLen); return false; } - WMSG1("+++ found %d rulers\n", pChunk->numRulers); + LOGI("+++ found %d rulers", pChunk->numRulers); pChunk->rulers = *pSrcBuf; *pSrcBuf += pChunk->numRulers * kRulerEntryLen; @@ -243,7 +243,7 @@ ReformatAWGS_WP::PrintChunk(const Chunk* pChunk) pRuler = pChunk->rulers + sae.rulerNum * kRulerEntryLen; rulerStatusBits = Get16LE(pRuler + 2); } else { - WMSG1("AWGS_WP GLITCH: invalid ruler index %d\n", sae.rulerNum); + LOGI("AWGS_WP GLITCH: invalid ruler index %d", sae.rulerNum); rulerStatusBits = kDefaultStatusBits; } @@ -265,18 +265,18 @@ ReformatAWGS_WP::PrintChunk(const Chunk* pChunk) */ blockPtr = FindTextBlock(pChunk, sae.textBlock); if (blockPtr == NULL) { - WMSG1("AWGS_WP bad textBlock %d\n", sae.textBlock); + LOGI("AWGS_WP bad textBlock %d", sae.textBlock); return; } blockLen = (long) Get32LE(blockPtr); if (blockLen <= 0 || blockLen > 65535) { - WMSG1("AWGS_WP invalid block len %d\n", blockLen); + LOGI("AWGS_WP invalid block len %d", blockLen); return; } blockPtr += 4; if (sae.offset >= blockLen) { - WMSG2("AWGS_WP bad offset: %d, blockLen=%ld\n", + LOGI("AWGS_WP bad offset: %d, blockLen=%ld", sae.offset, blockLen); return; } @@ -323,7 +323,7 @@ ReformatAWGS_WP::PrintParagraph(const unsigned char* ptr, long maxLen) unsigned char uch; if (maxLen < 7) { - WMSG1("AWGS_WP GLITCH: not enough storage for para header (%d)\n", + LOGI("AWGS_WP GLITCH: not enough storage for para header (%d)", maxLen); return 1; // don't return zero or we might loop forever } @@ -341,7 +341,7 @@ ReformatAWGS_WP::PrintParagraph(const unsigned char* ptr, long maxLen) * the size second, because the point size determines whether we * show underline. Set the style last. */ - //WMSG3("+++ Para start: font=0x%04x size=%d style=0x%02x\n", + //LOGI("+++ Para start: font=0x%04x size=%d style=0x%02x", // firstFont, firstSize, firstStyle); RTFSetGSFont(firstFont); RTFSetGSFontSize(firstSize); @@ -400,7 +400,7 @@ ReformatAWGS_WP::PrintParagraph(const unsigned char* ptr, long maxLen) } } - WMSG0("AWGS_WP: WARNING: ran out of data before hitting '\r'\n"); + LOGI("AWGS_WP: WARNING: ran out of data before hitting '\r'"); return ptr - startPtr; } @@ -470,7 +470,7 @@ ReformatAWGS_WP::GetNumTextBlocks(const unsigned char* pSaveArray, /* verify our result */ if (maxPara != maxTextBlock) { - WMSG2("Max para mismatch (%d vs %d)\n", maxPara, maxTextBlock); + LOGI("Max para mismatch (%d vs %d)", maxPara, maxTextBlock); assert(false); } #endif @@ -492,7 +492,7 @@ ReformatAWGS_WP::UnpackSaveArrayEntry(const unsigned char* pSaveArray, pSAE->pixelHeight = Get16LE(pSaveArray + 8); pSAE->numLines = Get16LE(pSaveArray + 10); - //WMSG5("SA: textBlock=%d off=%d attr=%d ruler=%d lines=%d\n", + //LOGI("SA: textBlock=%d off=%d attr=%d ruler=%d lines=%d", // pSAE->textBlock, pSAE->offset, pSAE->attributes, pSAE->rulerNum, // pSAE->numLines); } @@ -510,7 +510,7 @@ ReformatAWGS_WP::SkipTextBlocks(const unsigned char** pSrcBuf, const unsigned char* srcBuf = *pSrcBuf; long srcLen = *pSrcLen; - WMSG1("Scanning %d text blocks\n", textBlockCount); + LOGI("Scanning %d text blocks", textBlockCount); if (srcLen < 4) return false; @@ -520,18 +520,18 @@ ReformatAWGS_WP::SkipTextBlocks(const unsigned char** pSrcBuf, srcBuf += 4; srcLen -= 4; - WMSG2("+++ blockSize=%lu srcLen=%ld\n", blockSize, srcLen); + LOGI("+++ blockSize=%lu srcLen=%ld", blockSize, srcLen); if ((long) blockSize < kMinTextBlockSize) { - WMSG2("Block size too small (%d - %d)\n", + LOGI("Block size too small (%d - %d)", blockSize, Get16LE(srcBuf)); return false; } if ((long) blockSize > srcLen) { - WMSG0("Ran off the end in doc text blocks\n"); + LOGI("Ran off the end in doc text blocks"); return false; } if (Get16LE(srcBuf) != blockSize || Get16LE(srcBuf+2) != blockSize) { - WMSG3("AWGS WARNING: inconsistent block size values (%ld vs %d/%d)\n", + LOGI("AWGS WARNING: inconsistent block size values (%ld vs %d/%d)", blockSize, Get16LE(srcBuf), Get16LE(srcBuf+2)); /* okay to ignore it, so long as everything else works out */ } diff --git a/reformat/AppleWorks.cpp b/reformat/AppleWorks.cpp index 03c3830..4eaddcb 100644 --- a/reformat/AppleWorks.cpp +++ b/reformat/AppleWorks.cpp @@ -65,7 +65,7 @@ ReformatAWP::Process(const ReformatHolder* pHolder, /* expect header plus EOF bytes at least */ if (srcLen <= kFileHeaderSize) { - WMSG0(" AWP truncated?\n"); + LOGI(" AWP truncated?"); goto bail; } @@ -82,12 +82,12 @@ ReformatAWP::Process(const ReformatHolder* pHolder, /* do some quick sanity checks */ if (fFileHeader.seventyNine != kSeventyNine) { - WMSG2("ERROR: expected %d in signature byte, found %d\n", + LOGI("ERROR: expected %d in signature byte, found %d", kSeventyNine, fFileHeader.seventyNine); goto bail; } if (fFileHeader.sfMinVers && fFileHeader.sfMinVers != kSFMinVers30) { - WMSG1("WARNING: unexpected value %d for sfMinVers\n", + LOGI("WARNING: unexpected value %d for sfMinVers", fFileHeader.sfMinVers); /* keep going */ } @@ -108,18 +108,18 @@ ReformatAWP::Process(const ReformatHolder* pHolder, */ while (1) { if (length < 0) { - WMSG0(" AWP truncated file\n"); + LOGI(" AWP truncated file"); goto bail; } lineRecData = Read8(&srcPtr, &length); if (length < 0) { - WMSG0(" AWP truncated file\n"); + LOGI(" AWP truncated file"); goto bail; } lineRecCode = Read8(&srcPtr, &length); if (length < 0) { - WMSG0(" AWP truncated file\n"); + LOGI(" AWP truncated file"); goto bail; } @@ -134,7 +134,7 @@ ReformatAWP::Process(const ReformatHolder* pHolder, if (ProcessLineRecord(lineRecData, lineRecCode, &srcPtr, &length) != 0) { - WMSG0("ProcessLineRecord failed, bailing\n"); + LOGI("ProcessLineRecord failed, bailing"); goto bail; } } @@ -173,7 +173,7 @@ ReformatAWP::ProcessLineRecord(uchar lineRecData, uchar lineRecCode, { int err = 0; - //WMSG2(" AWP line rec <0x%02x><0x%02x>\n", lineRecCode, lineRecData); + //LOGI(" AWP line rec <0x%02x><0x%02x>", lineRecCode, lineRecData); if (lineRecCode == kLineRecordCarriageReturn) { /* ignore the horizontal offset for now */ @@ -281,16 +281,16 @@ ReformatAWP::ProcessLineRecord(uchar lineRecData, uchar lineRecCode, case kLineRecordCommandPageBreakPara: case kLineRecordCommandPageBreakPara256: default: - WMSG2(" AWP cmd <0x%02x><0x%02x>\n", lineRecCode, lineRecData); + LOGI(" AWP cmd <0x%02x><0x%02x>", lineRecCode, lineRecData); break; } } else { /* bad command */ - WMSG2("WARNING: unrecognized code 0x%02x at 0x%08lx\n", lineRecCode, + LOGI("WARNING: unrecognized code 0x%02x at 0x%08lx", lineRecCode, *pSrcPtr); fDocState.softFailures++; if (fDocState.softFailures > kMaxSoftFailures) { - WMSG0("ERROR: too many failures, giving up\n"); + LOGI("ERROR: too many failures, giving up"); err = -1; } } @@ -325,13 +325,13 @@ ReformatAWP::HandleTextRecord(uchar lineRecData, } if (byteCount <= 0) { - WMSG2("WARNING: line %ld: short line (%d)\n", + LOGI("WARNING: line %ld: short line (%d)", fDocState.line, byteCount); /* this is bad, but keep going anyway */ } if ((byteCountPlusCR & ~kCRatEOL) != byteCount) { - WMSG3("WARNING: line %ld: byteCount now %d, offset 3 count %d\n", + LOGI("WARNING: line %ld: byteCount now %d, offset 3 count %d", fDocState.line, byteCount, byteCountPlusCR & ~kCRatEOL); /* not sure why this would legally happen */ } @@ -424,7 +424,7 @@ ReformatAWP::HandleTextRecord(uchar lineRecData, BufPrintf(" "); break; default: - WMSG1(" AWP unhandled special char 0x%02x\n", ic); + LOGI(" AWP unhandled special char 0x%02x", ic); if (fShowEmbeds) { RTFSetColor(kColorBlue); BufPrintf("^"); @@ -503,13 +503,13 @@ ReformatADB::Process(const ReformatHolder* pHolder, /* expect header plus EOF bytes at least */ if (srcLen <= kMinHeaderLen) { - WMSG0(" ADB truncated?\n"); + LOGI(" ADB truncated?"); goto bail; } headerLen = Get16LE(srcPtr); if (headerLen < kMinHeaderLen || headerLen > length) { - WMSG2(" ADB bad headerLen %d, file len is %d\n", headerLen, + LOGI(" ADB bad headerLen %d, file len is %d", headerLen, srcLen); goto bail; } @@ -519,18 +519,18 @@ ReformatADB::Process(const ReformatHolder* pHolder, /* offset +035: #of categories in file */ numCats = *(srcPtr + 35); if (numCats < 1 || numCats > 0x1e) { - WMSG1(" ADB GLITCH: unexpected numCats %d\n", numCats); + LOGI(" ADB GLITCH: unexpected numCats %d", numCats); /* keep going... */ } - WMSG1(" ADB should be %d categories\n", numCats); + LOGI(" ADB should be %d categories", numCats); /* offset +036-037: #of records in file */ numRecs = Get16LE(srcPtr + 36) & 0x7fff; - WMSG1(" ADB should be %d records\n", numRecs); + LOGI(" ADB should be %d records", numRecs); /* offset +038: #of reports in file */ numReports = *(srcPtr + 38); - WMSG1(" ADB should be %d reports\n", numReports); + LOGI(" ADB should be %d reports", numReports); /* dump category names as first record */ const unsigned char* catPtr; @@ -576,9 +576,9 @@ ReformatADB::Process(const ReformatHolder* pHolder, int offsetToData; offsetToData = kOffsetToFirstCatHeader + numCats*kCatHeaderLen + numReports*kReportRecordLen; - WMSG1(" ADB data records begin at offset 0x%08lx\n", offsetToData); + LOGI(" ADB data records begin at offset 0x%08lx", offsetToData); if (offsetToData >= length) { - WMSG1(" ADB GLITCH: offset >= length %ld\n", length); + LOGI(" ADB GLITCH: offset >= length %ld", length); goto bail; } @@ -593,7 +593,7 @@ ReformatADB::Process(const ReformatHolder* pHolder, srcPtr += recordRem; length -= recordRem; if (*(srcPtr-1) != 0xff) { - WMSG1(" ADB GLITCH: first record skipped past 0x%02x\n", + LOGI(" ADB GLITCH: first record skipped past 0x%02x", *(srcPtr-1)); /* keep going, I guess */ } @@ -666,7 +666,7 @@ ReformatADB::Process(const ReformatHolder* pHolder, } catNum--; // don't double-count this category } else { - WMSG1(" ADB GLITCH: invalid ctrl byte 0x%02x\n", ctrl); + LOGI(" ADB GLITCH: invalid ctrl byte 0x%02x", ctrl); break; /* keep going anyway? */ } @@ -682,14 +682,14 @@ ReformatADB::Process(const ReformatHolder* pHolder, /* end of record */ RTFNewPara(); } - WMSG2(" ADB at exit rr=%d numRecs=%d\n", rr, numRecs); + LOGI(" ADB at exit rr=%d numRecs=%d", rr, numRecs); int checkEnd; checkEnd = Read16(&srcPtr, &length); if (checkEnd != 0xffff) { - WMSG1(" ADB GLITCH: last read returned 0x%04x\n", checkEnd); + LOGI(" ADB GLITCH: last read returned 0x%04x", checkEnd); } else { - WMSG0(" ADB found EOF; success\n"); + LOGI(" ADB found EOF; success"); } /* @@ -764,7 +764,7 @@ ReformatASP::Process(const ReformatHolder* pHolder, /* must at least have the header */ if (length < kFileHeaderSize) { - WMSG0(" ADB truncated?\n"); + LOGI(" ADB truncated?"); goto bail; } @@ -774,7 +774,7 @@ ReformatASP::Process(const ReformatHolder* pHolder, aw30flag = false; if (pFileHeader->ssMinVers != 0) aw30flag = true; - WMSG2(" ASP ssMinVers=0x%02x, aw30flag=%d\n", + LOGI(" ASP ssMinVers=0x%02x, aw30flag=%d", pFileHeader->ssMinVers, aw30flag); /* @@ -804,12 +804,12 @@ ReformatASP::Process(const ReformatHolder* pHolder, /* row length or EOF marker */ rowLen = Read16(&srcPtr, &length); if (rowLen == 0xffff) { - WMSG0(" ASP found EOF marker, we're done\n"); + LOGI(" ASP found EOF marker, we're done"); break; } rowNum = Read16(&srcPtr, &length); - //WMSG2(" ASP process row %d (cur=%d)\n", rowNum, currentRow); + //LOGI(" ASP process row %d (cur=%d)", rowNum, currentRow); /* fill out empty rows */ ASSERT(fCurrentRow <= rowNum); @@ -859,7 +859,7 @@ ReformatASP::ProcessRow(int rowNum, const unsigned char** pSrcPtr, first = false; /* read cell entry contents */ if (ctrl > *pLength) { - WMSG2(" ASP GLITCH: cell len exceeds file len (%d %d)\n", + LOGI(" ASP GLITCH: cell len exceeds file len (%d %d)", *pLength, ctrl); break; } @@ -884,7 +884,7 @@ ReformatASP::ProcessRow(int rowNum, const unsigned char** pSrcPtr, break; } else { /* unexpected 0x00 or 0x80 */ - WMSG1(" ASP GLITCH: unexpected ctrl byte 0x%02x\n", ctrl); + LOGI(" ASP GLITCH: unexpected ctrl byte 0x%02x", ctrl); break; } @@ -925,7 +925,7 @@ ReformatASP::ProcessCell(const unsigned char* srcPtr, long cellLength) /* this is a "value label", AW30+ only */ /* skip over cached string result */ if (*srcPtr >= cellLength) { - WMSG0(" ASP GLITCH: invalid value label str len\n"); + LOGI(" ASP GLITCH: invalid value label str len"); BufPrintf("GLITCH"); } else { srcPtr += *srcPtr +1; @@ -938,7 +938,7 @@ ReformatASP::ProcessCell(const unsigned char* srcPtr, long cellLength) //dval = ConvertSANEDouble(srcPtr); /* skip over cached computation result */ if (cellLength <= kSANELen) { - WMSG0(" ASP GLITCH: invalid value formula len\n"); + LOGI(" ASP GLITCH: invalid value formula len"); BufPrintf("GLITCH"); } else { srcPtr += kSANELen; @@ -997,7 +997,7 @@ ReformatASP::PrintToken(const unsigned char** pSrcPtr, long* pLength) token = Read8(pSrcPtr, pLength); if (token < kTokenStart) { - WMSG1(" ASP GLITCH: funky token 0x%02x\n", token); + LOGI(" ASP GLITCH: funky token 0x%02x", token); return; } @@ -1005,7 +1005,7 @@ ReformatASP::PrintToken(const unsigned char** pSrcPtr, long* pLength) if (token == 0xe0 || token == 0xe7) { /* @Error and @NA followed by three zero bytes */ if (*pLength < 3) { - WMSG0(" ASP GLITCH: ran off end processing tokens\n"); + LOGI(" ASP GLITCH: ran off end processing tokens"); return; } *pSrcPtr += 3; @@ -1013,7 +1013,7 @@ ReformatASP::PrintToken(const unsigned char** pSrcPtr, long* pLength) } else if (token == 0xfd) { /* SANE double number */ if (*pLength < 8) { - WMSG0(" ASP GLITCH: not enough left to grab a SANE\n"); + LOGI(" ASP GLITCH: not enough left to grab a SANE"); return; } double dval = ConvertSANEDouble(*pSrcPtr); @@ -1035,7 +1035,7 @@ ReformatASP::PrintToken(const unsigned char** pSrcPtr, long* pLength) int i; i = Read8(pSrcPtr, pLength); if (i > *pLength) { - WMSG0(" ASP GLITCH: string exceeds cell len\n"); + LOGI(" ASP GLITCH: string exceeds cell len"); return; } while (i--) { @@ -1053,7 +1053,7 @@ const char* ReformatASP::PrintCol(int col) { if (col < 0 || col >= 702) { - WMSG1(" ASP can't PrintCol(%d)\n", col); + LOGI(" ASP can't PrintCol(%d)", col); fPrintColBuf[0] = fPrintColBuf[1] = '?'; fPrintColBuf[2] = '\0'; } else if (col < 26) { diff --git a/reformat/Asm.cpp b/reformat/Asm.cpp index 8108400..36edf74 100644 --- a/reformat/Asm.cpp +++ b/reformat/Asm.cpp @@ -87,13 +87,13 @@ ReformatSCAssem::IsSCAssem(const ReformatHolder* pHolder) if (len == 0 || len > srcLen) return false; // should return an error, really if (ptr[len-1] == 0x00) { - WMSG0(" Found 0x00, looks like S-C assembler\n"); + LOGI(" Found 0x00, looks like S-C assembler"); return true; } else if (ptr[len-1] == 0x01) { - WMSG0(" Found 0x01, looks like Integer BASIC\n"); + LOGI(" Found 0x01, looks like Integer BASIC"); return false; } else { - WMSG1(" Got strange value 0x%02x during S-C test\n", ptr[len-1]); + LOGI(" Got strange value 0x%02x during S-C test", ptr[len-1]); return false; // again, should return an error } } @@ -126,7 +126,7 @@ ReformatSCAssem::Process(const ReformatHolder* pHolder, * BASIC program rather than a non-Integer file. */ if (length < 2) { - WMSG0(" SCAssem truncated?\n"); + LOGI(" SCAssem truncated?"); BufPrintf("\r\n"); goto done; } @@ -139,7 +139,7 @@ ReformatSCAssem::Process(const ReformatHolder* pHolder, lineLen = *srcPtr++; length--; if (lineLen == 0) { - WMSG0(" SCAssem found zero-length line?\n"); + LOGI(" SCAssem found zero-length line?"); break; } @@ -162,12 +162,12 @@ ReformatSCAssem::Process(const ReformatHolder* pHolder, while (count--) BufPrintf("%c", ch); } else { - WMSG1(" SCAssem GLITCH: RLE but only %d chars left\n", + LOGI(" SCAssem GLITCH: RLE but only %d chars left", length); BufPrintf("?!?"); } } else { - WMSG1(" SCAssem invalid char 0x%02x\n", *srcPtr); + LOGI(" SCAssem invalid char 0x%02x", *srcPtr); BufPrintf("?"); } @@ -283,7 +283,7 @@ ReformatMerlin::IsMerlin(const ReformatHolder* pHolder) lineCount = spaceLineCount = commentLineCount = 0; while (srcLen--) { if ((*ptr & 0x80) == 0 && (*ptr != 0x20)) { - WMSG1(" Merlin: not, found 0x%02x\n", *ptr); + LOGI(" Merlin: not, found 0x%02x", *ptr); return false; } @@ -307,8 +307,8 @@ ReformatMerlin::IsMerlin(const ReformatHolder* pHolder) if (!lineCount) return false; // don't divide by zero - WMSG1(" Merlin: found %d lines\n", lineCount); - WMSG4(" %d start with spaces (%.3f%%), %d with comments (%.3f%%)\n", + LOGI(" Merlin: found %d lines", lineCount); + LOGI(" %d start with spaces (%.3f%%), %d with comments (%.3f%%)", spaceLineCount, (spaceLineCount * 100.0) / lineCount, commentLineCount, (commentLineCount * 100.0) / lineCount); @@ -531,7 +531,7 @@ ReformatLISA2::Process(const ReformatHolder* pHolder, fUseRTF = false; if (srcLen < 8) { - WMSG0(" LISA truncated?\n"); + LOGI(" LISA truncated?"); goto bail; } @@ -540,10 +540,10 @@ ReformatLISA2::Process(const ReformatHolder* pHolder, version = Read16(&srcPtr, &srcLen); // usually 0x1800; maybe "2.4"? actualLen = Read16(&srcPtr, &srcLen); - WMSG2(" LISA version 0x%04x, len=%d\n", version, actualLen); + LOGI(" LISA version 0x%04x, len=%d", version, actualLen); if (actualLen > srcLen) { - WMSG2(" LISA bad length (len=%ld actual=%ld)\n", srcLen, actualLen); + LOGI(" LISA bad length (len=%ld actual=%ld)", srcLen, actualLen); goto bail; } @@ -552,7 +552,7 @@ ReformatLISA2::Process(const ReformatHolder* pHolder, while (actualLen > 0) { int lineLen = *srcPtr; if (lineLen == 0) { - WMSG1(" LISA bad line len (%ld)\n", lineLen); + LOGI(" LISA bad line len (%ld)", lineLen); break; } else if (lineLen == 255) { // used as end-of-file marker @@ -598,7 +598,7 @@ ReformatLISA2::ProcessLine(const unsigned char* buf) for (int i = 0; i < 8; i++) { uch = *buf; if (uch < 0x20 || uch >= 0x80) { - WMSG1(" LISA funky char 0x%02x in label\n", uch); + LOGI(" LISA funky char 0x%02x in label", uch); break; } else if (uch == 0x20) { doPrint = false; @@ -635,7 +635,7 @@ ReformatLISA2::ProcessLine(const unsigned char* buf) } else if (uch == 0x0d) { // don't output CR to line buf if (len) { - WMSG0("WARNING: got early CR\n"); + LOGI("WARNING: got early CR"); } } else if (mnemonicDone) { // Values >= 0x80 are mnemonics, but we've already seen it. @@ -799,15 +799,15 @@ ReformatLISA3::IsLISA(const ReformatHolder* pHolder) symLen = srcPtr[0x02] | srcPtr[0x03] << 8; if ((symLen & 0x0003) != 0 || symLen > 512*8 || symLen > srcLen) { - WMSG0(" LISA3 bad symLen\n"); + LOGI(" LISA3 bad symLen"); return false; } if (codeLen > srcLen) { - WMSG0(" LISA3 funky codeLen\n"); + LOGI(" LISA3 funky codeLen"); return false; } if (codeLen + symLen + kHeaderLen > srcLen) { - WMSG0(" LISA3 bad combined len\n"); + LOGI(" LISA3 bad combined len"); return false; } @@ -827,7 +827,7 @@ ReformatLISA3::Process(const ReformatHolder* pHolder, int retval = -1; if (srcLen < kHeaderLen+2) { - WMSG0(" LISA3 too short\n"); + LOGI(" LISA3 too short"); goto bail; } @@ -841,15 +841,15 @@ ReformatLISA3::Process(const ReformatHolder* pHolder, printf("codeLen=%d, symLen=%d\n", codeLen, symLen); if ((symLen & 0x0003) != 0 || symLen > 512*8 || symLen > srcLen) { - WMSG0(" LISA3 bad symLen\n"); + LOGI(" LISA3 bad symLen"); goto bail; } if (codeLen > srcLen) { - WMSG0(" LISA3 funky codeLen\n"); + LOGI(" LISA3 funky codeLen"); goto bail; } if (codeLen + symLen + kHeaderLen > srcLen) { - WMSG0(" LISA3 bad combined len\n"); + LOGI(" LISA3 bad combined len"); goto bail; } @@ -861,7 +861,7 @@ ReformatLISA3::Process(const ReformatHolder* pHolder, OutputStart(); PrintSymEntry(ii); OutputFinish(); - WMSG2("%d: %hs\n", ii, GetOutBuf()); + LOGI("%d: %hs", ii, GetOutBuf()); } #endif @@ -951,8 +951,8 @@ ReformatLISA3::Process(const ReformatHolder* pHolder, codePtr += lineLen-1; } - WMSG3("codePtr=%p endPtr=%p numLines=%d\n", codePtr, endPtr, lineNum-1); - WMSG1("extra = %d\n", endPtr - codePtr); + LOGI("codePtr=%p endPtr=%p numLines=%d", codePtr, endPtr, lineNum-1); + LOGI("extra = %d", endPtr - codePtr); SetResultBuffer(pOutput); retval = 0; @@ -1045,7 +1045,7 @@ ConvtOperand: bail: //if (len > 0) - // WMSG1("{LEN=%d}", len); + // LOGI("{LEN=%d}", len); return; } @@ -1320,7 +1320,7 @@ ReformatLISA3::PrintSymEntry(int ent) { if (ent < 0 || ent >= fSymCount) { Output("!BAD SYM!"); - WMSG2("invalid entry %d (max %d)\n", ent, fSymCount); + LOGI("invalid entry %d (max %d)", ent, fSymCount); DebugBreak(); return; } @@ -1466,11 +1466,11 @@ ReformatLISA4::IsLISA(const ReformatHolder* pHolder) symCount = srcPtr[0x04] | srcPtr[0x05] << 8; if (symEnd > srcLen) { - WMSG0(" LISA4 bad symEnd\n"); + LOGI(" LISA4 bad symEnd"); return false; } if (symCount > symEnd) { - WMSG2(" LISA4 funky symCount (count=%d end=%d)\n", + LOGI(" LISA4 funky symCount (count=%d end=%d)", symCount, symEnd); return false;; } @@ -1481,11 +1481,11 @@ ReformatLISA4::IsLISA(const ReformatHolder* pHolder) comTab = srcPtr[0x08]; if (opTab < 1 || adTab < 2 || comTab < 3) { - WMSG0(" LISA4 missing tabs\n"); + LOGI(" LISA4 missing tabs"); return false; } if (opTab >= 128 || adTab >= 128 || comTab >= 128) { - WMSG0(" LISA4 huge tabs\n"); + LOGI(" LISA4 huge tabs"); return false; } @@ -1568,7 +1568,7 @@ ReformatLISA4::Process(const ReformatHolder* pHolder, int retval = -1; if (srcLen < kHeaderLen+2) { - WMSG0(" LISA4 too short\n"); + LOGI(" LISA4 too short"); goto bail; } @@ -1585,17 +1585,17 @@ ReformatLISA4::Process(const ReformatHolder* pHolder, fComTab = srcPtr[0x08]; fCpuType = srcPtr[0x09]; - WMSG3(" LISA4 version = 0x%04x symEnd=%d symCount=%d\n", + LOGI(" LISA4 version = 0x%04x symEnd=%d symCount=%d", version, symEnd, fSymCount); - WMSG4(" LISA4 opTab=%d adTab=%d comTab=%d cpuType=%d\n", + LOGI(" LISA4 opTab=%d adTab=%d comTab=%d cpuType=%d", fOpTab, fAdTab, fComTab, fCpuType); if (symEnd > srcLen) { - WMSG0(" LISA4 bad symEnd\n"); + LOGI(" LISA4 bad symEnd"); goto bail; } if (fSymCount > symEnd) { - WMSG0(" LISA4 funky symCount\n"); + LOGI(" LISA4 funky symCount"); goto bail; } if (fSymCount > 0) { @@ -1611,7 +1611,7 @@ ReformatLISA4::Process(const ReformatHolder* pHolder, symPtr = srcPtr + kHeaderLen; endPtr = srcPtr + symEnd; if (symPtr > endPtr) { - WMSG0(" LISA4 GLITCH: bad symEnd\n"); + LOGI(" LISA4 GLITCH: bad symEnd"); goto bail; } @@ -1627,11 +1627,11 @@ ReformatLISA4::Process(const ReformatHolder* pHolder, symPtr++; } if (symIdx != fSymCount) { - WMSG2(" LISA4 err: symIdx is %d, symCount is %d\n", symIdx, fSymCount); + LOGI(" LISA4 err: symIdx is %d, symCount is %d", symIdx, fSymCount); goto bail; } - WMSG3(" LISA4 symPtr=%p endPtr=%p symIdx=%d\n", symPtr, endPtr, symIdx); + LOGI(" LISA4 symPtr=%p endPtr=%p symIdx=%d", symPtr, endPtr, symIdx); /* * Process source lines. @@ -1718,9 +1718,9 @@ ReformatLISA4::Process(const ReformatHolder* pHolder, codePtr += lineLen-1; } - WMSG3(" LISA4 codePtr=%p endPtr=%p numLines=%d\n", + LOGI(" LISA4 codePtr=%p endPtr=%p numLines=%d", codePtr, endPtr, lineNum-1); - WMSG1(" LISA4 extra = %d\n", endPtr - codePtr); + LOGI(" LISA4 extra = %d", endPtr - codePtr); SetResultBuffer(pOutput); retval = 0; @@ -1804,7 +1804,7 @@ ReformatLISA4::ProcessLine(const unsigned char* codePtr, int len) Output(gMnemonics4[mnemonic]); else { Output("!BAD MNEMONIC!"); - WMSG1(" LISA4 bad mnemonic 0x%02x\n", mnemonic); + LOGI(" LISA4 bad mnemonic 0x%02x", mnemonic); DebugBreak(); } if (mnemonic >= kSS) { diff --git a/reformat/BASIC.cpp b/reformat/BASIC.cpp index 2837b66..71d6ed3 100644 --- a/reformat/BASIC.cpp +++ b/reformat/BASIC.cpp @@ -126,7 +126,7 @@ ReformatApplesoft::Process(const ReformatHolder* pHolder, * BASIC program rather than a non-Applesoft file. */ if (length < 2) { - WMSG0(" BAS truncated?\n"); + LOGI(" BAS truncated?"); //fExpBuf.CreateWorkBuf(); BufPrintf("\r\n"); goto done; @@ -142,7 +142,7 @@ ReformatApplesoft::Process(const ReformatHolder* pHolder, if (nextAddr == 0) { /* ProDOS sticks an extra byte on the end? */ if (length > 1) { - WMSG1(" BAS ended early; len is %d\n", length); + LOGI(" BAS ended early; len is %d", length); } break; } @@ -205,7 +205,7 @@ ReformatApplesoft::Process(const ReformatHolder* pHolder, length--; if (!length) { - WMSG0(" BAS truncated in mid-line\n"); + LOGI(" BAS truncated in mid-line"); break; } @@ -373,7 +373,7 @@ ReformatInteger::Process(const ReformatHolder* pHolder, * BASIC program rather than a non-Integer file. */ if (length < 2) { - WMSG0(" INT truncated?\n"); + LOGI(" INT truncated?"); BufPrintf("\r\n"); goto done; } @@ -388,7 +388,7 @@ ReformatInteger::Process(const ReformatHolder* pHolder, lineLen = *srcPtr++; length--; if (lineLen == 0) { - WMSG0(" INT found zero-length line?\n"); + LOGI(" INT found zero-length line?"); break; } @@ -414,7 +414,7 @@ ReformatInteger::Process(const ReformatHolder* pHolder, length--; } if (*srcPtr != 0x29) { - WMSG0(" INT ended while in a string constant\n"); + LOGI(" INT ended while in a string constant"); break; } BufPrintf("\""); @@ -438,7 +438,7 @@ ReformatInteger::Process(const ReformatHolder* pHolder, } RTFSetColor(kDefaultColor); if (*srcPtr != 0x01) { - WMSG0(" INT ended while in a REM statement\n"); + LOGI(" INT ended while in a REM statement"); break; } } else if (*srcPtr >= 0xb0 && *srcPtr <= 0xb9) { @@ -446,7 +446,7 @@ ReformatInteger::Process(const ReformatHolder* pHolder, srcPtr++; length--; if (length < 2) { - WMSG0(" INT ended while in an integer constant\n"); + LOGI(" INT ended while in an integer constant"); break; } int val; @@ -491,7 +491,7 @@ ReformatInteger::Process(const ReformatHolder* pHolder, length--; } else { /* should not happen */ - WMSG2(" INT unexpected value 0x%02x at byte %d\n", + LOGI(" INT unexpected value 0x%02x at byte %d", *srcPtr, srcPtr - pHolder->GetSourceBuf(part)); /* skip past it and keep trying */ @@ -505,7 +505,7 @@ ReformatInteger::Process(const ReformatHolder* pHolder, /* skip past EOL token */ if (*srcPtr != 0x01 && length > 0) { - WMSG0("bailing\n"); // must've failed during processing + LOGI("bailing"); // must've failed during processing goto bail; } srcPtr++; @@ -643,7 +643,7 @@ ReformatBusiness::Process(const ReformatHolder* pHolder, * BASIC program rather than a non-BASIC file. */ if (length < 2) { - WMSG0(" BA3 truncated?\n"); + LOGI(" BA3 truncated?"); //fExpBuf.CreateWorkBuf(); BufPrintf("\r\n"); goto done; @@ -651,7 +651,7 @@ ReformatBusiness::Process(const ReformatHolder* pHolder, unsigned short fileLength; fileLength = Read16(&srcPtr, &length); - WMSG1(" BA3 internal file length is: %d\n", fileLength); + LOGI(" BA3 internal file length is: %d", fileLength); while (length > 0) { unsigned short increment; @@ -663,11 +663,11 @@ ReformatBusiness::Process(const ReformatHolder* pHolder, bool literalYet = false; increment = Read8(&srcPtr, &length); - WMSG1(" BA3 increment to next line is: %d\n", increment); + LOGI(" BA3 increment to next line is: %d", increment); if (increment == 0) { /* ProDOS sticks an extra byte on the end? */ if (length > 1) { - WMSG1(" BA3 ended early; len is %d\n", length); + LOGI(" BA3 ended early; len is %d", length); } break; } @@ -675,7 +675,7 @@ ReformatBusiness::Process(const ReformatHolder* pHolder, /* print line number */ RTFSetColor(kLineNumColor); lineNum = Read16(&srcPtr, &length); - WMSG1(" BA3 line number: %d\n", lineNum); + LOGI(" BA3 line number: %d", lineNum); BufPrintf(" %u ", lineNum); RTFSetColor(kDefaultColor); @@ -812,7 +812,7 @@ ReformatBusiness::Process(const ReformatHolder* pHolder, length--; if (!length) { - WMSG0(" BA3 truncated in mid-line\n"); + LOGI(" BA3 truncated in mid-line"); break; } diff --git a/reformat/CPMFiles.cpp b/reformat/CPMFiles.cpp index 1cef6bc..909e630 100644 --- a/reformat/CPMFiles.cpp +++ b/reformat/CPMFiles.cpp @@ -74,7 +74,7 @@ ReformatCPMText::Examine(ReformatHolder* pHolder) /* allow, but don't default to, text conversion of ".com" files */ if (strcasecmp(nameExt, ".com") == 0) { - WMSG0("Not reformatting '.com' file as text\n"); + LOGI("Not reformatting '.com' file as text"); goto done; } @@ -93,7 +93,7 @@ ReformatCPMText::Examine(ReformatHolder* pHolder) /* do nothing -- 0x00 is okay if it comes after Ctrl-Z */ } else { if (gIsBinary[*ptr]) { - WMSG2("CP/M found binary char 0x%02x at offset 0x%04x\n", + LOGI("CP/M found binary char 0x%02x at offset 0x%04x", *ptr, ptr - pHolder->GetSourceBuf(ReformatHolder::kPartData)); break; diff --git a/reformat/Directory.cpp b/reformat/Directory.cpp index e7d1dc6..d7047c1 100644 --- a/reformat/Directory.cpp +++ b/reformat/Directory.cpp @@ -43,7 +43,7 @@ ReformatDirectory::Process(const ReformatHolder* pHolder, fUseRTF = false; if (srcLen < 512 || (srcLen % 512) != 0) { - WMSG1("ReformatDirectory: invalid len %d\n", srcLen); + LOGI("ReformatDirectory: invalid len %d", srcLen); return -1; } diff --git a/reformat/Disasm.cpp b/reformat/Disasm.cpp index 05ba419..f0d0611 100644 --- a/reformat/Disasm.cpp +++ b/reformat/Disasm.cpp @@ -1070,13 +1070,13 @@ OMFSegmentHeader::Unpack(const unsigned char* srcBuf, long srcLen, int fileType) { if (srcLen < kHdrMinSize) { - WMSG1("OMF: Too short to be segment (%ld)\n", srcLen); + LOGI("OMF: Too short to be segment (%ld)", srcLen); return false; } fVersion = *(srcBuf + 0x0f); if (fVersion > kMaxVersion) { - WMSG1("OMF: Wrong version number to be OMF (%d)\n", fVersion); + LOGI("OMF: Wrong version number to be OMF (%d)", fVersion); return false; } @@ -1137,7 +1137,7 @@ OMFSegmentHeader::Unpack(const unsigned char* srcBuf, long srcLen, * Special case type=LIB ($B2). */ if (fileType == 0xb2) { - WMSG1("NOTE: switching blockCount=%ld to byte count\n", fBlockCnt); + LOGI("NOTE: switching blockCount=%ld to byte count", fBlockCnt); fByteCnt = fBlockCnt; fBlockCnt = 0; } else { @@ -1176,31 +1176,31 @@ OMFSegmentHeader::Unpack(const unsigned char* srcBuf, long srcLen, /* validate fields */ if (fByteCnt < kHdrMinSize || fByteCnt > (unsigned long) srcLen) { - WMSG3("OMF: Bad value for byteCnt (%ld, srcLen=%ld min=%d)\n", + LOGI("OMF: Bad value for byteCnt (%ld, srcLen=%ld min=%d)", fByteCnt, srcLen, kHdrMinSize); return false; } if (fDispName < 0x24 || fDispName > (srcLen - kLoadNameLen)) { - WMSG2("OMF: Bad value for dispName (%d, srcLen=%ld)\n", + LOGI("OMF: Bad value for dispName (%d, srcLen=%ld)", fDispName, srcLen); return false; } if (fDispData < 0x24 || fDispData > srcLen) { - WMSG2("OMF: Bad value for dispData (%d, srcLen=%ld)\n", + LOGI("OMF: Bad value for dispData (%d, srcLen=%ld)", fDispData, srcLen); return false; } if (fDispData < fDispName + kLoadNameLen) { - WMSG2("OMF: dispData is inside label region (%d / %d)\n", + LOGI("OMF: dispData is inside label region (%d / %d)", fDispData, fDispName); return false; } if (fBankSize != kExpectedBankSize && fBankSize != 0) { - WMSG1("OMF: NOTE: bankSize=%ld\n", fBankSize); + LOGI("OMF: NOTE: bankSize=%ld", fBankSize); /* allowed, just weird */ } if (fNumLen != kExpectedNumLen || fNumSex != 0) { - WMSG2("OMF: WARNING: numLen=%d numSex=%d\n", fNumLen, fNumSex); + LOGI("OMF: WARNING: numLen=%d numSex=%d", fNumLen, fNumSex); /* big endian odd-sized numbers?? keep going, I guess */ } @@ -1221,13 +1221,13 @@ OMFSegmentHeader::Unpack(const unsigned char* srcBuf, long srcLen, segLabelLen = *segName++; memcpy(fSegName, segName, segLabelLen); fSegName[segLabelLen] = '\0'; - WMSG1(" OMF: Pascal segment label '%hs'\n", fSegName); + LOGI(" OMF: Pascal segment label '%hs'", fSegName); } else { /* C-style or non-terminated string */ segLabelLen = fLabLen; memcpy(fSegName, segName, segLabelLen); fSegName[segLabelLen] = '\0'; - WMSG1(" OMF: Std segment label '%hs'\n", fSegName); + LOGI(" OMF: Std segment label '%hs'", fSegName); } fReady = true; @@ -1298,18 +1298,18 @@ OMFSegmentHeader::GetSegmentFlag(SegmentFlag flag) const void OMFSegmentHeader::Dump(void) const { - WMSG0("OMF segment header:\n"); - WMSG3(" segNum=%d loadName='%hs' segName='%hs'\n", + LOGI("OMF segment header:"); + LOGI(" segNum=%d loadName='%hs' segName='%hs'", fSegNum, fLoadName, fSegName); - WMSG4(" blockCnt=%ld byteCnt=%ld resSpc=%ld length=%ld\n", + LOGI(" blockCnt=%ld byteCnt=%ld resSpc=%ld length=%ld", fBlockCnt, fByteCnt, fResSpc, fLength); - WMSG3(" version=%d type=0x%02x kind=0x%04x\n", + LOGI(" version=%d type=0x%02x kind=0x%04x", fVersion, fType, fKind); - WMSG4(" labLen=%d numLen=%d bankSize=%ld lcBank=%d\n", + LOGI(" labLen=%d numLen=%d bankSize=%ld lcBank=%d", fLabLen, fNumLen, fBankSize, fLCBank); - WMSG4(" align=%ld numSex=%d org=%ld tempOrg=%ld\n", + LOGI(" align=%ld numSex=%d org=%ld tempOrg=%ld", fAlign, fNumSex, fOrg, fTempOrg); - WMSG3(" entry=%ld dispName=%d dispData=%d\n", + LOGI(" entry=%ld dispName=%d dispData=%d", fEntry, fDispName, fDispData); } @@ -1353,7 +1353,7 @@ OMFSegment::ProcessNextChunk(void) switch (*fCurPtr) { case kSegOpEND: - WMSG1(" OMF END reached, remaining len = %d\n", + LOGI(" OMF END reached, remaining len = %d", fSegLen - (fCurPtr - fSegBuf)); assert(len == 1); break; @@ -1432,7 +1432,7 @@ OMFSegment::ProcessNextChunk(void) case kSegOpExperimental3: case kSegOpExperimental4: subLen = Get32LE(fCurPtr+1); // assumes fNumLen==4 - WMSG2(" OMF found 'reserved' len=%lu (remLen=%ld)\n", subLen, remLen); + LOGI(" OMF found 'reserved' len=%lu (remLen=%ld)", subLen, remLen); if (subLen > (unsigned long) remLen) return NULL; len += subLen + fNumLen; diff --git a/reformat/DisasmTable.cpp b/reformat/DisasmTable.cpp index 021c423..79ffcde 100644 --- a/reformat/DisasmTable.cpp +++ b/reformat/DisasmTable.cpp @@ -624,7 +624,7 @@ ReformatDisasm65xxx::ValidateOpMap(void) (kOpMap[i].opAndAddr[kCPU65802] != kOpUnknown && kOpMap[i].opAndAddr[kCPU65802] != kOpMap[i].opAndAddr[kCPU65816])) { - WMSG1("OpMap GLITCH: inconsistent values for entry 0x%02x\n", i); + LOGI("OpMap GLITCH: inconsistent values for entry 0x%02x", i); assert(false); return false; } @@ -639,7 +639,7 @@ ReformatDisasm65xxx::ValidateOpMap(void) continue; if (kOpMap[i].opAndAddr[kCPU65816] == kOpMap[j].opAndAddr[kCPU65816]) { - WMSG2("OpMap GLITCH: entries 0x%02x and 0x%02x match\n", i, j); + LOGI("OpMap GLITCH: entries 0x%02x and 0x%02x match", i, j); assert(false); return false; } @@ -758,7 +758,7 @@ bool ReformatDisasm65xxx::ValidateOpCodeDetails(void) { if (NELEM(kOpCodeDetails) != kOpCodeMAX) { - WMSG2("Found %d entries in details, max=%d\n", + LOGI("Found %d entries in details, max=%d", NELEM(kOpCodeDetails), kOpCodeMAX); assert(false); return false; @@ -771,7 +771,7 @@ ReformatDisasm65xxx::ValidateOpCodeDetails(void) if (strcasecmp(kOpCodeDetails[i].mnemonic, kOpCodeDetails[j].mnemonic) == 0) { - WMSG3("OpCodeDetails GLITCH: entries %d and %d match (%hs)\n", + LOGI("OpCodeDetails GLITCH: entries %d and %d match (%hs)", i, j, kOpCodeDetails[i].mnemonic); assert(false); return false; diff --git a/reformat/DoubleHiRes.cpp b/reformat/DoubleHiRes.cpp index 2539b7a..2a88c42 100644 --- a/reformat/DoubleHiRes.cpp +++ b/reformat/DoubleHiRes.cpp @@ -78,7 +78,7 @@ ReformatDHR::Examine(ReformatHolder* pHolder) pHolder->SetApplicPreferred(ReformatHolder::kReformatDHR_Window); break; default: - WMSG1("GLITCH: DHR algorithm %d not recognized\n", dhrAlg); + LOGI("GLITCH: DHR algorithm %d not recognized", dhrAlg); break; } } @@ -110,13 +110,13 @@ ReformatDHR::Process(const ReformatHolder* pHolder, fAlgorithm = kDHRWindow; break; default: - WMSG1("GLITCH: bad id %d\n", id); + LOGI("GLITCH: bad id %d", id); fAlgorithm = kDHRLatched; break; } if (srcLen > kExpectedSize || srcLen < kExpectedSize-8) { - WMSG2(" DHR file is not ~%d bytes long (got %d)\n", + LOGI(" DHR file is not ~%d bytes long (got %d)", kExpectedSize, srcLen); goto bail; } @@ -330,7 +330,7 @@ ReformatDHR::DHRScreenToBitmap(const unsigned char* buf) !bitPtr[idx+2] && !bitPtr[idx+3]) { //if (line == 87 && idx > 200 && idx < 240) { - // WMSG1(" %4d ERASE\n", idx); + // LOGI(" %4d ERASE", idx); //} /*colorBuf[idx] =*/ colorBuf[idx+1] = colorBuf[idx+2] = /*colorBuf[idx+3] =*/ kColorBlack; @@ -371,7 +371,7 @@ ReformatDHR::DHRScreenToBitmap(const unsigned char* buf) for (idx = 0; idx < kPixelsPerLine; idx++, bitPtr++) { //if (line == 98 && idx > 50 && idx < 80) { // if (!(idx % 4)) { - // WMSG2(" idx %3d: bits=0x%02x PPPPCNNN\n", + // LOGI(" idx %3d: bits=0x%02x PPPPCNNN", // idx, whole & 0xff); // } //} @@ -386,7 +386,7 @@ ReformatDHR::DHRScreenToBitmap(const unsigned char* buf) newColor = fColorLookup[(idx+1) & 0x03][(whole & 0xf0) >> 4]; //if (line == 98 && idx > 50 && idx < 80) { - // WMSG4(" idx %3d: old=%-2d new=%-2d (bits=0x%02x)\n", idx, + // LOGI(" idx %3d: old=%-2d new=%-2d (bits=0x%02x)", idx, // oldColor, newColor, whole & 0xff); //} @@ -407,7 +407,7 @@ ReformatDHR::DHRScreenToBitmap(const unsigned char* buf) else if (shift1 == 0 || shift2 == 0 || shift3 == 0) newColor = kColorBlack; //if (line == 98 && idx > 50 && idx < 80) { - // WMSG2(" idx %3d: S new=%-2d\n", idx, newColor); + // LOGI(" idx %3d: S new=%-2d", idx, newColor); //} } @@ -504,7 +504,7 @@ ReformatDHR::DHRScreenToBitmap(const unsigned char* buf) mergePix |= colorBuf1[idx+1] & 0x0c; ASSERT((mergePix & 0xf0) == 0); if (line == 191) { - WMSG3("idx=0x%02x idx+1=0x%02x merge=0x%02x\n", + LOGI("idx=0x%02x idx+1=0x%02x merge=0x%02x", colorBuf1[idx], colorBuf1[idx+1], mergePix); } colorBuf1[idx-1] = colorBuf1[idx] = colorBuf1[idx+1] = diff --git a/reformat/DreamGrafix.cpp b/reformat/DreamGrafix.cpp index 8f8f685..02aa064 100644 --- a/reformat/DreamGrafix.cpp +++ b/reformat/DreamGrafix.cpp @@ -150,7 +150,7 @@ DreamGrafix::ScanDreamGrafix(ReformatHolder* pHolder) fHeight = Reformat::Get16LE(ptr + 2); fWidth = Reformat::Get16LE(ptr + 4); if (fWidth != 320 || fHeight != 200) { - WMSG2("ODD: strange height %dx%x in DG\n", fWidth, fHeight); + LOGI("ODD: strange height %dx%x in DG", fWidth, fHeight); return false; } @@ -195,7 +195,7 @@ DreamGrafix::UnpackDG(const unsigned char* srcBuf, long srcLen, actual = UnpackLZW(srcBuf, srcLen, tmpBuf, expectedLen); if (actual != expectedLen && actual != (expectedLen-512)) { - WMSG2("UnpackLZW expected %d, got %d\n", expectedLen, actual); + LOGI("UnpackLZW expected %d, got %d", expectedLen, actual); free(tmpBuf); return false; } @@ -287,7 +287,7 @@ DreamGrafix::UnpackLZW(const unsigned char* srcBuf, long srcLen, while (true) { if (dstBuf - pOrigDst > dstLen) { - WMSG0("LZW overrun\n"); + LOGI("LZW overrun"); return -1; } diff --git a/reformat/HiRes.cpp b/reformat/HiRes.cpp index 0ad2c8f..ba6e420 100644 --- a/reformat/HiRes.cpp +++ b/reformat/HiRes.cpp @@ -236,7 +236,7 @@ ReformatHiRes::Process(const ReformatHolder* pHolder, fBlackWhite = true; if (srcLen > kExpectedSize+1 || srcLen < kExpectedSize-8) { - WMSG2(" HiRes file is not ~%d bytes long (got %d)\n", + LOGI(" HiRes file is not ~%d bytes long (got %d)", kExpectedSize, srcLen); goto bail; } diff --git a/reformat/MacPaint.cpp b/reformat/MacPaint.cpp index d0c743b..c60bbe4 100644 --- a/reformat/MacPaint.cpp +++ b/reformat/MacPaint.cpp @@ -49,14 +49,14 @@ ReformatMacPaint::Examine(ReformatHolder* pHolder) long version; if (fileLen < kMinSize) { - WMSG2(" MP: not long enough to be MacPaint (%d vs min %d)\n", + LOGI(" MP: not long enough to be MacPaint (%d vs min %d)", fileLen, kMinSize); goto done; } version = Get32BE(ptr); if (strcasecmp(nameExt, ".mac") == 0 && version >= 0 && version <= 3) { - WMSG0(" MP: found w/o MacBinary header\n"); + LOGI(" MP: found w/o MacBinary header"); applies = ReformatHolder::kApplicProbably; goto done; } @@ -65,7 +65,7 @@ ReformatMacPaint::Examine(ReformatHolder* pHolder) if (version >= 0 && version <= 3 && ptr[65] == 'P' && ptr[66] == 'N' && ptr[67] == 'T' && ptr[68] == 'G') { - WMSG0(" MP: found inside MacBinary header\n"); + LOGI(" MP: found inside MacBinary header"); applies = ReformatHolder::kApplicProbably; goto done; } @@ -89,7 +89,7 @@ ReformatMacPaint::Process(const ReformatHolder* pHolder, int retval = -1; if (srcLen < kMinSize || srcLen > kMaxSize) { - WMSG1(" MacPaint file is only %d bytes long\n", srcLen); + LOGI(" MacPaint file is only %d bytes long", srcLen); goto bail; } @@ -132,7 +132,7 @@ ReformatMacPaint::ConvertMacPaint(const unsigned char* srcBuf, long length) { offset = 128; } else { - WMSG0(" MP couldn't determine picture offset!\n"); + LOGI(" MP couldn't determine picture offset!"); goto bail; } @@ -144,7 +144,7 @@ ReformatMacPaint::ConvertMacPaint(const unsigned char* srcBuf, long length) srcBuf += kLeadingJunkCount; length -= offset; length -= kLeadingJunkCount; - WMSG1("Adjusted len is %d\n", length); + LOGI("Adjusted len is %d", length); outBuf = (unsigned char*) pDib->Create(kOutputWidth, kOutputHeight, 1, kNumColors); @@ -175,7 +175,7 @@ ReformatMacPaint::ConvertMacPaint(const unsigned char* srcBuf, long length) break; } if (length != 0) { - WMSG1(" MP found %d unused bytes at end\n", length); + LOGI(" MP found %d unused bytes at end", length); } bail: diff --git a/reformat/NiftyList.cpp b/reformat/NiftyList.cpp index ea645b5..58b6beb 100644 --- a/reformat/NiftyList.cpp +++ b/reformat/NiftyList.cpp @@ -63,14 +63,14 @@ NiftyList::AppInit(const WCHAR* fileName) */ fp = _wfopen(fileName, L"rb"); if (fp == NULL) { - WMSG1("NL Unable to open '%ls'\n", fileName); + LOGI("NL Unable to open '%ls'", fileName); goto bail; } else { - WMSG1("NL Reading '%ls'\n", fileName); + LOGI("NL Reading '%ls'", fileName); } if (fseek(fp, 0, SEEK_END) < 0) { - WMSG0("Seek failed\n"); + LOGI("Seek failed"); goto bail; } fileLen = ftell(fp); @@ -78,12 +78,12 @@ NiftyList::AppInit(const WCHAR* fileName) fFileData = new char[fileLen]; if (fFileData == NULL) { - WMSG1("Failed allocating %d bytes\n", fileLen); + LOGI("Failed allocating %d bytes", fileLen); goto bail; } if (fread(fFileData, fileLen, 1, fp) != 1) { - WMSG1("Failed reading NList.Data (%d bytes)\n", fileLen); + LOGI("Failed reading NList.Data (%d bytes)", fileLen); goto bail; } @@ -113,7 +113,7 @@ NiftyList::AppInit(const WCHAR* fileName) fDataReady = true; result = true; - WMSG0("NL NiftyList data loaded\n"); + LOGI("NL NiftyList data loaded"); bail: if (fp != NULL) @@ -170,7 +170,7 @@ NiftyList::ReadSection(char** ppData, long* pRemLen, DataSet* pSet, while (1) { lineLen = ScanLine(pData, remLen); if (lineLen == 0) { - WMSG1("Failed scanning line, remLen=%ld\n", remLen); + LOGI("Failed scanning line, remLen=%ld", remLen); return false; } if (*pData == '*') { @@ -185,12 +185,12 @@ NiftyList::ReadSection(char** ppData, long* pRemLen, DataSet* pSet, } if (mode == kModeSkip) { - WMSG1(" NL Skipping %d entries in section\n", numLines); + LOGI(" NL Skipping %d entries in section", numLines); *ppData = pData; *pRemLen = remLen; return true; } else { - WMSG1(" NL Found %d entries in section\n", numLines); + LOGI(" NL Found %d entries in section", numLines); } /* @@ -200,7 +200,7 @@ NiftyList::ReadSection(char** ppData, long* pRemLen, DataSet* pSet, pSet->pEntries = new NameValue[numLines]; if (pSet->pEntries == NULL) { - WMSG0("NameValue alloc failed\n"); + LOGI("NameValue alloc failed"); return false; } pSet->numEntries = numLines; @@ -214,7 +214,7 @@ NiftyList::ReadSection(char** ppData, long* pRemLen, DataSet* pSet, while (1) { lineLen = ScanLine(pData, remLen); if (lineLen == 0) { - WMSG1("Failed scanning line(2), remLen=%ld\n", remLen); + LOGI("Failed scanning line(2), remLen=%ld", remLen); return false; } @@ -225,7 +225,7 @@ NiftyList::ReadSection(char** ppData, long* pRemLen, DataSet* pSet, } if (lineLen < 6 || pData[4] != ' ') { - WMSG1("Found garbled line '%.80hs'\n", pData); + LOGI("Found garbled line '%.80hs'", pData); return false; } if (pData[lineLen-2] == '\r' || pData[lineLen-2] == '\n') @@ -233,7 +233,7 @@ NiftyList::ReadSection(char** ppData, long* pRemLen, DataSet* pSet, else if (pData[lineLen-1] == '\r' || pData[lineLen-1] == '\n') pData[lineLen-1] = '\0'; else { - WMSG2("No EOL found on '%.80hs' (%d)\n", pData, lineLen); + LOGI("No EOL found on '%.80hs' (%d)", pData, lineLen); } assert(entry < numLines); @@ -338,10 +338,10 @@ NiftyList::DumpSection(const DataSet& dataSet) { long ent; - WMSG1("Dumping section (count=%ld)\n", dataSet.numEntries); + LOGI("Dumping section (count=%ld)", dataSet.numEntries); for (ent = 0; ent < dataSet.numEntries; ent++) { - WMSG3("%4d: %04x '%hs'\n", + LOGI("%4d: %04x '%hs'", ent, dataSet.pEntries[ent].value, dataSet.pEntries[ent].name); } } diff --git a/reformat/PascalFiles.cpp b/reformat/PascalFiles.cpp index 6486641..2e22480 100644 --- a/reformat/PascalFiles.cpp +++ b/reformat/PascalFiles.cpp @@ -54,7 +54,7 @@ ReformatPascalCode::Process(const ReformatHolder* pHolder, int i; if (srcLen < kSegmentHeaderLen) { - WMSG0(" PCD truncated?\n"); + LOGI(" PCD truncated?"); goto bail; } @@ -243,7 +243,7 @@ ReformatPascalText::Process(const ReformatHolder* pHolder, int retval = -1; if (srcLen < kPTXBlockSize) { - WMSG0(" PTX truncated?\n"); + LOGI(" PTX truncated?"); goto bail; } @@ -290,7 +290,7 @@ ReformatPascalText::ProcessBlock(const unsigned char* srcBuf, long length) while (length) { if (*srcBuf == 0x00) { /* we've reached the end of the data for this block */ - WMSG1(" PTX end of useful block with %d remaining\n", length); + LOGI(" PTX end of useful block with %d remaining", length); /* be paranoid */ bool first = true; @@ -313,12 +313,12 @@ ReformatPascalText::ProcessBlock(const unsigned char* srcBuf, long length) srcBuf++; length--; if (!length) { - WMSG0(" PTX end of block inside DLE\n"); + LOGI(" PTX end of block inside DLE"); goto bail; } indent = *srcBuf - kIndentSub; if (indent < 0) { - WMSG1(" PTX odd indent (raw value %d)\n", *srcBuf); + LOGI(" PTX odd indent (raw value %d)", *srcBuf); indent = 0; /* fix it */ } srcBuf++; @@ -344,7 +344,7 @@ ReformatPascalText::ProcessBlock(const unsigned char* srcBuf, long length) linePtr = lineBuf; while (*srcBuf != 0x0d && length) { if (*srcBuf == 0x00) { - WMSG0(" PTX a null leaked into a line??\n"); + LOGI(" PTX a null leaked into a line??"); /* keep going */ } diff --git a/reformat/PrintShop.cpp b/reformat/PrintShop.cpp index 60db858..c20e6ac 100644 --- a/reformat/PrintShop.cpp +++ b/reformat/PrintShop.cpp @@ -72,12 +72,12 @@ ReformatPrintShop::Process(const ReformatHolder* pHolder, } else if (srcLen == 1716) { pDib = ConvertColor(srcBuf); } else { - WMSG1("PS shouldn't be here (len=%ld)\n", srcLen); + LOGI("PS shouldn't be here (len=%ld)", srcLen); return -1; } if (pDib == NULL) { - WMSG0("DIB creation failed\n"); + LOGI("DIB creation failed"); return -1; } diff --git a/reformat/Reformat.cpp b/reformat/Reformat.cpp index 3d09775..ccf96bd 100644 --- a/reformat/Reformat.cpp +++ b/reformat/Reformat.cpp @@ -314,7 +314,7 @@ ReformatHolder::TestApplicability(void) } if (!fAllow[i]) { if (i != 0) { - WMSG1(" NOTE: Applic %d disallowed\n", i); + LOGI(" NOTE: Applic %d disallowed", i); // did you update ConfigureReformatFromPreferences()? } fApplies[kPartData][i] = kApplicNot; @@ -446,12 +446,12 @@ ReformatHolder::FindBest(ReformatPart part) } if (bestID == kReformatUnknown || bestApply == kApplicNot) { - WMSG0("Did you forget to call TestApplicability?\n"); + LOGI("Did you forget to call TestApplicability?"); assert(false); return kReformatRaw; } - WMSG2("Best is %d at lvl=%d\n", bestID, bestApply); + LOGI("Best is %d at lvl=%d", bestID, bestApply); return bestID; } @@ -469,7 +469,7 @@ ReformatHolder::Apply(ReformatPart part, ReformatID id) if (id <= kReformatUnknown || id >= kReformatMAX || part <= kPartUnknown || part >= kPartMAX) { - WMSG2("Invalid reformat request (part=%d id=%d)\n", part, id); + LOGI("Invalid reformat request (part=%d id=%d)", part, id); assert(false); return NULL; } @@ -590,7 +590,7 @@ ReformatHolder::SetErrorMsg(ReformatPart part, const char* msg) assert(fErrorBuf[part] == NULL); fErrorBuf[part] = strdup(msg); - WMSG2("+++ set error message for part %d to '%hs'\n", part, msg); + LOGI("+++ set error message for part %d to '%hs'", part, msg); } void diff --git a/reformat/Reformat.h b/reformat/Reformat.h index a269fe1..e039318 100644 --- a/reformat/Reformat.h +++ b/reformat/Reformat.h @@ -220,7 +220,7 @@ public: fNameExt = NULL; } ~ReformatHolder(void) { - WMSG0("In ~ReformatHolder\n"); + LOGI("In ~ReformatHolder"); for (int i = 0; i < kPartMAX; i++) { if (i == kPartUnknown) continue; diff --git a/reformat/ReformatBase.cpp b/reformat/ReformatBase.cpp index 36dbcd9..7423617 100644 --- a/reformat/ReformatBase.cpp +++ b/reformat/ReformatBase.cpp @@ -176,7 +176,7 @@ ReformatText::CheckGSCharConv(void) memset(test, 0, sizeof(test)); for (i = 0; i < sizeof(kGSCharConv); i++) { if (test[kGSCharConv[i]] && kGSCharConv[i] != kUnk) { - WMSG3("Character used twice: 0x%02x at %d (0x%02x)\n", + LOGI("Character used twice: 0x%02x at %d (0x%02x)", kGSCharConv[i], i, i+128); assert(false); } @@ -213,7 +213,7 @@ ReformatText::SetResultBuffer(ReformatOutput* pOutput, bool multiFont) * worry about NULL pointers. */ pOutput->SetOutputKind(ReformatOutput::kOutputRaw); - WMSG0("ReformatText returning a null pointer\n"); + LOGI("ReformatText returning a null pointer"); } else { if (fUseRTF) pOutput->SetOutputKind(ReformatOutput::kOutputRTF); @@ -508,14 +508,14 @@ ReformatText::RTFParaJustify(void) void ReformatText::RTFLeftMargin(int margin) { - //WMSG1("+++ Left margin now %d\n", margin); + //LOGI("+++ Left margin now %d", margin); fLeftMargin = margin; RTFSetPara(); } void ReformatText::RTFRightMargin(int margin) { - //WMSG1("+++ Right margin now %d\n", margin); + //LOGI("+++ Right margin now %d", margin); fRightMargin = margin; RTFSetPara(); } @@ -611,7 +611,7 @@ ReformatText::RTFSetGSFont(unsigned short family) newMult = 1.5f; break; default: - WMSG1("Unrecognized font family 0x%04x\n", family); + LOGI("Unrecognized font family 0x%04x", family); RTFSetFont(kFontArial); newMult = 1.0f; break; @@ -939,7 +939,7 @@ ReformatGraphics::UnpackBytes(unsigned char* dst, const unsigned char* src, case 0x00: for (i = 0; i < count; i++) { if (srcLen == 0 || dstRem == 0) { - WMSG2(" SHR unpack overrun1 (srcLen=%ld dstRem=%ld)\n", + LOGI(" SHR unpack overrun1 (srcLen=%ld dstRem=%ld)", srcLen, dstRem); return -1; } @@ -950,17 +950,17 @@ ReformatGraphics::UnpackBytes(unsigned char* dst, const unsigned char* src, break; case 0x40: //if (count != 3 || count != 5 || count != 6 || count != 7) { - // WMSG1(" SHR unpack funky len %d?\n", count); + // LOGI(" SHR unpack funky len %d?", count); //} if (srcLen == 0) { - WMSG0(" SHR unpack underrun2\n"); + LOGI(" SHR unpack underrun2"); return -1; } val = *src++; srcLen--; for (i = 0; i < count; i++) { if (dstRem == 0) { - WMSG3(" SHR unpack overrun2 (srcLen=%d, i=%d of %d)\n", + LOGI(" SHR unpack overrun2 (srcLen=%d, i=%d of %d)", srcLen, i, count); return -1; } @@ -970,7 +970,7 @@ ReformatGraphics::UnpackBytes(unsigned char* dst, const unsigned char* src, break; case 0x80: if (srcLen < 4) { - WMSG0(" SHR unpack underrun3\n"); + LOGI(" SHR unpack underrun3"); return -1; } valSet[0] = *src++; @@ -980,7 +980,7 @@ ReformatGraphics::UnpackBytes(unsigned char* dst, const unsigned char* src, srcLen -= 4; for (i = 0; i < count; i++) { if (dstRem < 4) { - WMSG2(" SHR unpack overrun3 (srcLen=%ld dstRem=%ld)\n", + LOGI(" SHR unpack overrun3 (srcLen=%ld dstRem=%ld)", srcLen, dstRem); return -1; } @@ -993,14 +993,14 @@ ReformatGraphics::UnpackBytes(unsigned char* dst, const unsigned char* src, break; case 0xc0: if (srcLen == 0) { - WMSG0(" SHR unpack underrun4\n"); + LOGI(" SHR unpack underrun4"); return -1; } val = *src++; srcLen--; for (i = 0; i < count; i++) { if (dstRem < 4) { - WMSG3(" SHR unpack overrun4 (srcLen=%ld dstRem=%ld count=%d)\n", + LOGI(" SHR unpack overrun4 (srcLen=%ld dstRem=%ld count=%d)", srcLen, dstRem, count); return -1; } @@ -1021,7 +1021,7 @@ ReformatGraphics::UnpackBytes(unsigned char* dst, const unsigned char* src, /* require that we completely fill the buffer */ if (dstRem != 0) { - WMSG1(" SHR unpack dstRem at %d\n", dstRem); + LOGI(" SHR unpack dstRem at %d", dstRem); return -1; } @@ -1085,7 +1085,7 @@ ReformatGraphics::UnPackBits(const unsigned char** pSrcBuf, long* pSrcLen, } if (pixByte != 72) { /* can happen if we run out of input early */ - WMSG1(" MP unexpected pixByte=%d\n", pixByte); + LOGI(" MP unexpected pixByte=%d", pixByte); /* keep going */ } diff --git a/reformat/ResourceFork.cpp b/reformat/ResourceFork.cpp index c41839b..ee5041f 100644 --- a/reformat/ResourceFork.cpp +++ b/reformat/ResourceFork.cpp @@ -172,7 +172,7 @@ ReformatResourceFork::ReadHeader(const unsigned char* srcBuf, long srcLen, bool* pLittleEndian) { if (srcLen < 128) { - WMSG1("ReformatResource: invalid len %d\n", srcLen); + LOGI("ReformatResource: invalid len %d", srcLen); return false; } @@ -241,12 +241,12 @@ ReformatResourceFork::GetResource(const unsigned char* srcBuf, long srcLen, resID = Get32(indexPtr + 0x02, littleEndian); if (resType == resourceType && resID == resourceID) { - WMSG2("Found resource with type=0x%04x id=0x%04x\n", + LOGI("Found resource with type=0x%04x id=0x%04x", resType, resID); *pResource = srcBuf + Get32(indexPtr + 0x06, littleEndian); *pResourceLen = Get32(indexPtr + 0x0c, littleEndian); if (*pResource + *pResourceLen > srcBuf+srcLen) { - WMSG0(" Bad bounds on resource\n"); + LOGI(" Bad bounds on resource"); DebugBreak(); return false; } @@ -256,7 +256,7 @@ ReformatResourceFork::GetResource(const unsigned char* srcBuf, long srcLen, indexPtr += kRsrcMapEntryLen; } - WMSG2("Resource not found (type=0x%04x id=0x%04x)\n", + LOGI("Resource not found (type=0x%04x id=0x%04x)", resourceType, resourceID); return false; } diff --git a/reformat/Simple.cpp b/reformat/Simple.cpp index be9d6bd..04c0cdf 100644 --- a/reformat/Simple.cpp +++ b/reformat/Simple.cpp @@ -116,7 +116,7 @@ ReformatEOL_HA::Process(const ReformatHolder* pHolder, { fUseRTF = false; - //WMSG0("Reformatting EOL (testing for high-ASCII too)\n"); + //LOGI("Reformatting EOL (testing for high-ASCII too)"); //bool isHighASCII = false; diff --git a/reformat/SuperHiRes.cpp b/reformat/SuperHiRes.cpp index 6fa848f..7b85133 100644 --- a/reformat/SuperHiRes.cpp +++ b/reformat/SuperHiRes.cpp @@ -94,10 +94,10 @@ ReformatSHR::SHRDataToBitmap8(const unsigned char* pPixels, pDib->SetColorTable((RGBQUAD*)fColorTables); /* - WMSG0(" SHR color table 0\n"); + LOGI(" SHR color table 0"); int ii; for (ii = 0; ii < kNumEntriesPerColorTable; ii++) { - WMSG4(" %2d: 0x%02x %02x %02x\n", + LOGI(" %2d: 0x%02x %02x %02x", ii, fColorTables[0][ii].rgbRed, fColorTables[0][ii].rgbGreen, @@ -122,11 +122,11 @@ ReformatSHR::SHRDataToBitmap8(const unsigned char* pPixels, colorTableOffset = (*pSCB & kSCBColorTableMask) * kNumEntriesPerColorTable; if (!line) { - WMSG1(" SHR line 0 mode640=%d\n", mode640); + LOGI(" SHR line 0 mode640=%d", mode640); } if (fillMode) { /* I doubt anyone uses this in still images */ - WMSG0(" SHR FILL MODE!!\n"); + LOGI(" SHR FILL MODE!!"); DebugBreak(); } @@ -265,7 +265,7 @@ ReformatUnpackedSHR::Process(const ReformatHolder* pHolder, int retval = -1; if (pHolder->GetSourceLen(part) != kTotalSize) { - WMSG1(" SHR file is not %d bytes long!\n", kTotalSize); + LOGI(" SHR file is not %d bytes long!", kTotalSize); goto bail; } @@ -336,7 +336,7 @@ ReformatJEQSHR::Process(const ReformatHolder* pHolder, int retval = -1; if (pHolder->GetSourceLen(part) != kExpectedLen) { - WMSG1(" SHR file is not %d bytes long!\n", kTotalSize); + LOGI(" SHR file is not %d bytes long!", kTotalSize); goto bail; } @@ -422,7 +422,7 @@ ReformatPaintworksSHR::Process(const ReformatHolder* pHolder, int i, result; if (pHolder->GetSourceLen(part) < kMinSize) { - WMSG1(" SHR file too short!\n", pHolder->GetSourceLen(part)); + LOGI(" SHR file too short!", pHolder->GetSourceLen(part)); goto bail; } @@ -451,7 +451,7 @@ ReformatPaintworksSHR::Process(const ReformatHolder* pHolder, kPWOutputSize, pHolder->GetSourceLen(part) - kPWDataOffset); if (result != 0) { - WMSG0("WARNING: UnpackBytes wasn't happy\n"); + LOGI("WARNING: UnpackBytes wasn't happy"); #if 0 /* thd282.shk (rev76.2) has a large collection of these */ @@ -526,7 +526,7 @@ ReformatPackedSHR::Process(const ReformatHolder* pHolder, int retval = -1; if (pHolder->GetSourceLen(part) < 4) { - WMSG1(" SHR file too short!\n", pHolder->GetSourceLen(part)); + LOGI(" SHR file too short!", pHolder->GetSourceLen(part)); goto bail; } @@ -536,7 +536,7 @@ ReformatPackedSHR::Process(const ReformatHolder* pHolder, pHolder->GetSourceBuf(part), kTotalSize, pHolder->GetSourceLen(part)) != 0) { - WMSG0(" SHR UnpackBytes failed\n"); + LOGI(" SHR UnpackBytes failed"); goto bail; } @@ -606,7 +606,7 @@ ReformatAPFSHR::Process(const ReformatHolder* pHolder, int retval = -1; if (srcLen < 4) { - WMSG1(" SHR file too short!\n", srcLen); + LOGI(" SHR file too short!", srcLen); goto bail; } @@ -620,7 +620,7 @@ ReformatAPFSHR::Process(const ReformatHolder* pHolder, blockLen = Read32(&srcPtr, &srcLen); if (blockLen > srcLen + 4) { - WMSG2(" APFSHR WARNING: found blockLen=%ld, remaining len=%ld\n", + LOGI(" APFSHR WARNING: found blockLen=%ld, remaining len=%ld", blockLen, srcLen); break; //goto bail; @@ -630,7 +630,7 @@ ReformatAPFSHR::Process(const ReformatHolder* pHolder, nameLen = ::GetPascalString((const char*)srcPtr, srcLen, &blockName); if (nameLen < 0) { - WMSG0(" APFSHR failed getting pascal name, bailing\n"); + LOGI(" APFSHR failed getting pascal name, bailing"); goto bail; } @@ -639,7 +639,7 @@ ReformatAPFSHR::Process(const ReformatHolder* pHolder, dataLen = blockLen - (nameLen+1 + 4); - WMSG4(" APFSHR block='%ls' blockLen=%ld (dataLen=%ld) start=0x%08lx\n", + LOGI(" APFSHR block='%ls' blockLen=%ld (dataLen=%ld) start=0x%08lx", (LPCWSTR) blockName, blockLen, dataLen, srcPtr); if (blockName == "MAIN") { @@ -652,7 +652,7 @@ ReformatAPFSHR::Process(const ReformatHolder* pHolder, } else if (blockName == "NOTE") { UnpackNote(srcPtr, dataLen); } else { - WMSG1(" APFSHR (ignoring segment '%ls')\n", (LPCWSTR) blockName); + LOGI(" APFSHR (ignoring segment '%ls')", (LPCWSTR) blockName); } srcPtr = nextBlock; @@ -719,7 +719,7 @@ ReformatAPFSHR::UnpackMain(const unsigned char* srcPtr, long srcLen) if (srcLen < 256) { /* can't possibly be this small */ - WMSG1(" APFSHR unlikely srcLen %d\n", srcLen); + LOGI(" APFSHR unlikely srcLen %d", srcLen); goto bail; } @@ -729,15 +729,15 @@ ReformatAPFSHR::UnpackMain(const unsigned char* srcPtr, long srcLen) if (fPixelsPerScanLine < 8 || fPixelsPerScanLine > kMaxPixelsPerScan || (fPixelsPerScanLine & 0x01) != 0) { - WMSG1(" APFSHR unsupported pixelsPerScanLine %d\n", + LOGI(" APFSHR unsupported pixelsPerScanLine %d", fPixelsPerScanLine); goto bail; } - WMSG3(" APFSHR masterMode=0x%04x, ppsl=%d, nct=%d\n", + LOGI(" APFSHR masterMode=0x%04x, ppsl=%d, nct=%d", masterMode, fPixelsPerScanLine, numColorTables); if (numColorTables <= 0 || numColorTables > kNumColorTables) { - WMSG1(" APFSHR unexpected numColorTables %d\n", numColorTables); + LOGI(" APFSHR unexpected numColorTables %d", numColorTables); goto bail; } @@ -748,7 +748,7 @@ ReformatAPFSHR::UnpackMain(const unsigned char* srcPtr, long srcLen) int i; for (i = 0; i < numColorTables; i++) { if (srcLen < kColorTableSize) { - WMSG0(" APFSHR ran out while copying color tables\n"); + LOGI(" APFSHR ran out while copying color tables"); goto bail; } @@ -766,7 +766,7 @@ ReformatAPFSHR::UnpackMain(const unsigned char* srcPtr, long srcLen) */ fNumScanLines = Read16(&srcPtr, &srcLen); if (fNumScanLines < 8 || fNumScanLines > kMaxScanLines) { - WMSG1(" APFSHR unsupported numScanLines %d\n", fNumScanLines); + LOGI(" APFSHR unsupported numScanLines %d", fNumScanLines); goto bail; } if ((fPixelsPerScanLine == 320 || fPixelsPerScanLine == 640) && @@ -774,7 +774,7 @@ ReformatAPFSHR::UnpackMain(const unsigned char* srcPtr, long srcLen) { /* standard-sized image, use fScreen */ ASSERT(!fNonStandard); - WMSG0(" Assuming this is a standard, full-width SHR image\n"); + LOGI(" Assuming this is a standard, full-width SHR image"); fPixelBytesPerLine = kPixelBytesPerLine; // 160 fPixelStore = fScreen.pixels; fSCBStore = fScreen.scb; @@ -785,7 +785,7 @@ ReformatAPFSHR::UnpackMain(const unsigned char* srcPtr, long srcLen) } else { /* non-standard image, allocate storage */ fNonStandard = true; - WMSG3(" NOTE: non-standard image size %dx%d, 2-bit-mode=%d\n", + LOGI(" NOTE: non-standard image size %dx%d, 2-bit-mode=%d", fPixelsPerScanLine, fNumScanLines, (masterMode & kSCBNumPixels) != 0); @@ -810,18 +810,18 @@ ReformatAPFSHR::UnpackMain(const unsigned char* srcPtr, long srcLen) fPixelBytesPerLine = ((fPixelBytesPerLine + 7) / 8) * 8; fPixelStore = new unsigned char[fPixelBytesPerLine * fNumScanLines]; if (fPixelStore == NULL) { - WMSG1(" APFSHR ERROR: alloc of %d bytes fPixelStore failed\n", + LOGI(" APFSHR ERROR: alloc of %d bytes fPixelStore failed", fPixelBytesPerLine * fNumScanLines); goto bail; } fSCBStore = new unsigned char[fNumScanLines]; if (fSCBStore == NULL) { - WMSG1(" APFSHR ERROR: alloc of %d bytes fSCBStore failed\n", + LOGI(" APFSHR ERROR: alloc of %d bytes fSCBStore failed", fNumScanLines); goto bail; } } - WMSG3(" APFSHR numScanLines=%d, outputWidth=%d, pixelBytesPerLine=%d\n", + LOGI(" APFSHR numScanLines=%d, outputWidth=%d, pixelBytesPerLine=%d", fNumScanLines, fOutputWidth, fPixelBytesPerLine); /* @@ -836,7 +836,7 @@ ReformatAPFSHR::UnpackMain(const unsigned char* srcPtr, long srcLen) packedDataLen[i] = Read16(&srcPtr, &srcLen); if (packedDataLen[i] > fPixelsPerScanLine) { /* each pixel is 2 or 4 bits, so this is a 2-4x expansion */ - WMSG2(" APFSHR got funky packed len %d for line %d\n", + LOGI(" APFSHR got funky packed len %d for line %d", packedDataLen, i); goto bail; } @@ -845,7 +845,7 @@ ReformatAPFSHR::UnpackMain(const unsigned char* srcPtr, long srcLen) if (mode >> 8 == 0) fSCBStore[i] = (unsigned char)mode; else { - WMSG2(" APFSHR odd mode 0x%04x on line %d\n", mode, i); + LOGI(" APFSHR odd mode 0x%04x on line %d", mode, i); } } @@ -854,13 +854,13 @@ ReformatAPFSHR::UnpackMain(const unsigned char* srcPtr, long srcLen) */ for (i = 0; i < fNumScanLines; i++) { if (srcLen <= 0) { - WMSG0(" APFSHR ran out of data while unpacking pixels\n"); + LOGI(" APFSHR ran out of data while unpacking pixels"); goto bail; } if (UnpackBytes(&fPixelStore[i * fPixelBytesPerLine], srcPtr, fPixelBytesPerLine, packedDataLen[i]) != 0) { - WMSG1(" APFSHR UnpackBytes failed on line %d\n", i); + LOGI(" APFSHR UnpackBytes failed on line %d", i); goto bail; } @@ -892,10 +892,10 @@ ReformatAPFSHR::UnpackMultipal(unsigned char* dstPtr, /* check the size; use (size+2) to factor in 16-bit count */ if (srcLen < kMultipalSize+2) { - WMSG1(" APFSHR got too-small multipal size %ld\n", srcLen); + LOGI(" APFSHR got too-small multipal size %ld", srcLen); return -1; } else if (srcLen > kMultipalSize+2) { - WMSG2(" APFSHR WARNING: oversized multipal (%ld, expected %ld)\n", + LOGI(" APFSHR WARNING: oversized multipal (%ld, expected %ld)", srcLen, kMultipalSize); /* keep going */ } @@ -904,7 +904,7 @@ ReformatAPFSHR::UnpackMultipal(unsigned char* dstPtr, numColorTables = Read16(&srcPtr, &srcLen); if (numColorTables != kNumLines) { /* expecting one palette per line */ - WMSG1(" APFSHR ignoring multipal with %d color tables\n", + LOGI(" APFSHR ignoring multipal with %d color tables", numColorTables); return -1; } @@ -943,7 +943,7 @@ ReformatAPFSHR::UnpackNote(const unsigned char* srcPtr, long srcLen) numChars = Read16(&srcPtr, &srcLen); if (numChars != srcLen) { - WMSG2(" APFSHR note chunk has numChars=%d but dataLen=%ld, bailing\n", + LOGI(" APFSHR note chunk has numChars=%d but dataLen=%ld, bailing", numChars, srcLen); return; } @@ -953,7 +953,7 @@ ReformatAPFSHR::UnpackNote(const unsigned char* srcPtr, long srcLen) str += *srcPtr++; } - WMSG1(" APFSHR note: '%ls'\n", (LPCWSTR) str); + LOGI(" APFSHR note: '%ls'", (LPCWSTR) str); } @@ -1007,7 +1007,7 @@ Reformat3200SHR::Process(const ReformatHolder* pHolder, int retval = -1; if (pHolder->GetSourceLen(part) != kExtTotalSize) { - WMSG1(" SHR file is not %d bytes long!\n", kExtTotalSize); + LOGI(" SHR file is not %d bytes long!", kExtTotalSize); return retval; } @@ -1081,7 +1081,7 @@ Reformat3200SHR::SHR3200ToBitmap24(void) for (int entry = 0; entry < kNumEntriesPerColorTable; entry++) { GSColor(*pClrTable++, &colorLookup[table][entry]); //if (!table) { - // WMSG3(" table %2d entry %2d value=0x%04x\n", + // LOGI(" table %2d entry %2d value=0x%04x", // table, entry, *pClrTable); //} } @@ -1177,12 +1177,12 @@ Reformat3201SHR::Process(const ReformatHolder* pHolder, int retval = -1; if (srcLen < 16 || srcLen > kExtTotalSize) { - WMSG1(" SHR3201 file funky length (%d)\n", srcLen); + LOGI(" SHR3201 file funky length (%d)", srcLen); return retval; } const long* pMagic = (const long*) pHolder->GetSourceBuf(part); if (*pMagic != 0x00d0d0c1) { // "APP\0" - WMSG0(" SHR3201 didn't find magic 'APP'\n"); + LOGI(" SHR3201 didn't find magic 'APP'"); return retval; } srcBuf += 4; diff --git a/reformat/Teach.cpp b/reformat/Teach.cpp index aeda46f..aeb8eae 100644 --- a/reformat/Teach.cpp +++ b/reformat/Teach.cpp @@ -125,7 +125,7 @@ ReformatTeach::Process(const ReformatHolder* pHolder, rsrcBuf = pHolder->GetSourceBuf(ReformatHolder::kPartRsrc); rsrcLen = pHolder->GetSourceLen(ReformatHolder::kPartRsrc); if (dataBuf == NULL || rsrcBuf == NULL || dataLen <= 0 || rsrcLen <= 0) { - WMSG0("Teach reformatter missing one fork of the file\n"); + LOGI("Teach reformatter missing one fork of the file"); return -1; } CheckGSCharConv(); @@ -134,13 +134,13 @@ ReformatTeach::Process(const ReformatHolder* pHolder, if (!ReformatResourceFork::GetResource(rsrcBuf, rsrcLen, 0x8012, 0x0001, &styleBlock, &styleLen)) { - WMSG0("Resource fork of Teach Text file not found\n"); + LOGI("Resource fork of Teach Text file not found"); return -1; } RStyleBlock rStyleBlock; if (!rStyleBlock.Create(styleBlock, styleLen)) { - WMSG0("Unable to unpack rStyleBlock\n"); + LOGI("Unable to unpack rStyleBlock"); return -1; } @@ -162,7 +162,7 @@ ReformatTeach::Process(const ReformatHolder* pHolder, RStyleBlock::TERuler* pRuler = rStyleBlock.GetRuler(0); assert(pRuler != NULL); if (pRuler->GetJustification() != RStyleBlock::TERuler::kJustLeft) { - WMSG0("WARNING: not using left justified Teach text\n"); + LOGI("WARNING: not using left justified Teach text"); /* ignore it */ } @@ -201,7 +201,7 @@ ReformatTeach::Process(const ReformatHolder* pHolder, unsigned char uch; while (numBytes--) { if (!dataLen) { - WMSG1("WARNING: Teach underrun (%ld wanted)\n", numBytes); + LOGI("WARNING: Teach underrun (%ld wanted)", numBytes); break; } uch = *dataBuf; @@ -217,7 +217,7 @@ ReformatTeach::Process(const ReformatHolder* pHolder, } } if (dataLen) { - WMSG1("WARNING: Teach overrun (%ld remain)\n", dataLen); + LOGI("WARNING: Teach overrun (%ld remain)", dataLen); /* no big deal */ } @@ -247,13 +247,13 @@ RStyleBlock::Create(const unsigned char* buf, long len) assert(buf != NULL); if (len < kMinLen) { - WMSG1("Too short to be rStyleBlock (%d)\n", len); + LOGI("Too short to be rStyleBlock (%d)", len); return false; } version = Reformat::Read16(&buf, &len); if (version != kExpectedVersion) { - WMSG1("Bad rStyleBlock version (%d)\n", version); + LOGI("Bad rStyleBlock version (%d)", version); return false; } @@ -261,7 +261,7 @@ RStyleBlock::Create(const unsigned char* buf, long len) partLen = Reformat::Read32(&buf, &len); if (partLen > (unsigned long) (len+8)) { /* not enough to satisfy data + two more counts */ - WMSG2("Invalid part1 length (%d vs %d)\n", partLen, len); + LOGI("Invalid part1 length (%d vs %d)", partLen, len); return false; } @@ -278,11 +278,11 @@ RStyleBlock::Create(const unsigned char* buf, long len) /* extract TEStyles */ partLen = Reformat::Read32(&buf, &len); if (partLen > (unsigned long) (len+4)) { - WMSG2("Invalid part2 length (%d vs %d)\n", partLen, len); + LOGI("Invalid part2 length (%d vs %d)", partLen, len); return false; } if ((partLen % TEStyle::kDataLen) != 0) { - WMSG2("Invalid part2 length (%d mod %d)\n", + LOGI("Invalid part2 length (%d mod %d)", partLen, TEStyle::kDataLen); return false; } @@ -301,7 +301,7 @@ RStyleBlock::Create(const unsigned char* buf, long len) fNumStyleItems = (int) Reformat::Read32(&buf, &len); partLen = fNumStyleItems * StyleItem::kDataLen; if (partLen > (unsigned long) len) { - WMSG2("Invalid part3 length (%d vs %d)\n", partLen, len); + LOGI("Invalid part3 length (%d vs %d)", partLen, len); return false; } @@ -311,7 +311,7 @@ RStyleBlock::Create(const unsigned char* buf, long len) for (i = 0; i < fNumStyleItems; i++) { fpStyleItems[i].Create(buf); if ((fpStyleItems[i].GetOffset() % TEStyle::kDataLen) != 0) { - WMSG2("Invalid offset %d (mod %d)\n", + LOGI("Invalid offset %d (mod %d)", fpStyleItems[i].GetOffset(), TEStyle::kDataLen); return false; } @@ -320,7 +320,7 @@ RStyleBlock::Create(const unsigned char* buf, long len) } if (len != 0) { - WMSG1("WARNING: at end of rStyleBlock, len is %ld\n", len); + LOGI("WARNING: at end of rStyleBlock, len is %ld", len); } return true; @@ -384,11 +384,11 @@ RStyleBlock::TERuler::Create(const unsigned char* buf, long len) } break; default: - WMSG1("Invalid tab type %d\n", fTabType); + LOGI("Invalid tab type %d", fTabType); return -1; } - WMSG2("TERuler consumed %ld bytes (%ld left over)\n", origLen - len, len); + LOGI("TERuler consumed %ld bytes (%ld left over)", origLen - len, len); return origLen - len; } @@ -403,7 +403,7 @@ RStyleBlock::TEStyle::Create(const unsigned char* buf) fBackColor = Reformat::Get16LE(buf + 6); fUserData = Reformat::Get32LE(buf + 8); - WMSG4(" TEStyle: font fam=0x%04x size=%-2d style=0x%02x fore=0x%04x\n", + LOGI(" TEStyle: font fam=0x%04x size=%-2d style=0x%02x fore=0x%04x", GetFontFamily(), GetFontSize(), GetTextStyle(), fForeColor); } @@ -416,5 +416,5 @@ RStyleBlock::StyleItem::Create(const unsigned char* buf) fLength = Reformat::Get32LE(buf); fOffset = Reformat::Get32LE(buf + 4); - WMSG2(" StyleItem: len=%ld off=%ld\n", fLength, fOffset); + LOGI(" StyleItem: len=%ld off=%ld", fLength, fOffset); } diff --git a/util/MyBitmapButton.cpp b/util/MyBitmapButton.cpp index f51853d..e6aa15b 100644 --- a/util/MyBitmapButton.cpp +++ b/util/MyBitmapButton.cpp @@ -38,7 +38,7 @@ MyBitmapButton::ReplaceDlgCtrl(CDialog* pDialog, int buttonID) // pWnd->DestroyWindow(); if (Create(caption, styles, rect, pDialog, buttonID) == FALSE) { - WMSG1("ERROR: unable to replace dialog ctrl (buttonID=%d)\n", + LOGI("ERROR: unable to replace dialog ctrl (buttonID=%d)", buttonID); return FALSE; } @@ -70,7 +70,7 @@ MyBitmapButton::UpdateBitmap(void) HBITMAP hNewBits; if (fBitmapID == -1) { - WMSG0("ERROR: UpdateBitmap called before bitmap set\n"); + LOGI("ERROR: UpdateBitmap called before bitmap set"); ASSERT(false); return; } @@ -78,7 +78,7 @@ MyBitmapButton::UpdateBitmap(void) hNewBits = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(fBitmapID), IMAGE_BITMAP, 0, 0, LR_LOADMAP3DCOLORS); if (hNewBits == NULL) { - WMSG1("WARNING: LoadImage failed (bitID=%d)\n", fBitmapID); + LOGI("WARNING: LoadImage failed (bitID=%d)", fBitmapID); ASSERT(false); return; } @@ -95,6 +95,6 @@ MyBitmapButton::UpdateBitmap(void) void MyBitmapButton::OnSysColorChange(void) { - WMSG1("MyBitmapButton 0x%08lx tracking color change\n", this); + LOGI("MyBitmapButton 0x%08lx tracking color change", this); UpdateBitmap(); } diff --git a/util/MyBitmapButton.h b/util/MyBitmapButton.h index 1c6f83b..7d01ca9 100644 --- a/util/MyBitmapButton.h +++ b/util/MyBitmapButton.h @@ -19,7 +19,7 @@ public: fBitmapID = -1; } virtual ~MyBitmapButton(void) { - //WMSG0("~MyBitmapButton()\n"); + //LOGI("~MyBitmapButton()"); Detach(); // it's not really our window ::DeleteObject(fhBitmap); } diff --git a/util/MyDIBitmap.cpp b/util/MyDIBitmap.cpp index 2c995a8..fe65a93 100644 --- a/util/MyDIBitmap.cpp +++ b/util/MyDIBitmap.cpp @@ -56,7 +56,7 @@ MyDIBitmap::Create(int width, int height, int bitsPerPixel, int colorsUsed, bool dibSection /*=false*/) { if (mhBitmap != NULL || mpPixels != NULL || mpFileBuffer != NULL) { - WMSG0(" DIB GLITCH: already created\n"); + LOGI(" DIB GLITCH: already created"); assert(false); return NULL; } @@ -101,11 +101,11 @@ MyDIBitmap::Create(int width, int height, int bitsPerPixel, int colorsUsed, DWORD err = ::GetLastError(); //CString msg; //GetWin32ErrorString(err, &msg); - //WMSG2(" DIB CreateDIBSection failed (err=%d msg='%ls')\n", + //LOGI(" DIB CreateDIBSection failed (err=%d msg='%ls')", // err, (LPCWSTR) msg); - WMSG1(" DIB CreateDIBSection failed (err=%d)\n", err); + LOGI(" DIB CreateDIBSection failed (err=%d)", err); LogHexDump(&mBitmapInfoHdr, sizeof(BITMAPINFO)); - WMSG1("&mpPixels = 0x%08lx\n", &mpPixels); + LOGI("&mpPixels = 0x%08lx", &mpPixels); DebugBreak(); return NULL; } @@ -140,7 +140,7 @@ MyDIBitmap::Create(int width, int height, int bitsPerPixel, int colorsUsed, assert(mpPixels != NULL); memset(mpPixels, 0, mPitchBytes * mBitmapInfoHdr.biHeight); - //WMSG2("+++ allocated %d bytes for bitmap pixels (mPitchBytes=%d)\n", + //LOGI("+++ allocated %d bytes for bitmap pixels (mPitchBytes=%d)", // mPitchBytes * mBitmapInfoHdr.biHeight, mPitchBytes); return mpPixels; @@ -158,7 +158,7 @@ MyDIBitmap::CreateFromFile(const WCHAR* fileName) fp = _wfopen(fileName, L"rb"); if (fp == NULL) { err = errno ? errno : -1; - WMSG2("Unable to read bitmap from file '%ls' (err=%d)\n", + LOGI("Unable to read bitmap from file '%ls' (err=%d)", fileName, err); return err; } @@ -188,7 +188,7 @@ MyDIBitmap::CreateFromFile(FILE* fp, long len) if (fread(buf, len, 1, fp) != 1) { err = errno ? errno : -1; - WMSG2(" DIB failed reading %ld bytes (err=%d)\n", len, err); + LOGI(" DIB failed reading %ld bytes (err=%d)", len, err); goto bail; } @@ -249,7 +249,7 @@ MyDIBitmap::CreateFromNewBuffer(void* vbuf, long len) { return ImportTGA(vbuf, len); } else { - WMSG2(" DIB invalid bitmap file (type=0x%04x size=%ld)\n", + LOGI(" DIB invalid bitmap file (type=0x%04x size=%ld)", pHeader->bfType, pHeader->bfSize); delete[] vbuf; return -1; @@ -302,7 +302,7 @@ MyDIBitmap::ImportBMP(void* vbuf, long len) mNumColorsUsed = mBitmapInfoHdr.biClrUsed; mPitchBytes = ((mWidth * mBitmapInfoHdr.biBitCount) +7) / 8; mPitchBytes = (mPitchBytes + 3) & ~(0x03); // round up to mult of 4 - //WMSG3(" DIB +++ width=%d bits=%d pitch=%d\n", mWidth, + //LOGI(" DIB +++ width=%d bits=%d pitch=%d", mWidth, // mBitmapInfoHdr.biBitCount, mPitchBytes); /* prepare the color table, if any */ @@ -379,7 +379,7 @@ MyDIBitmap::ImportTGA(void* vbuf, long len) mPitchBytes = ((mWidth * mBitmapInfoHdr.biBitCount) +7) / 8; if ((mPitchBytes & 0x03) != 0) { /* should only be a problem if we try to save to BMP or conv to DIB */ - WMSG1(" DIB WARNING: pitchBytes=%d in TGA may not work\n", + LOGI(" DIB WARNING: pitchBytes=%d in TGA may not work", mPitchBytes); } // mPitchBytes = (mPitchBytes + 3) & ~(0x03); // round up to power of 2 @@ -409,7 +409,7 @@ MyDIBitmap::ImportTGA(void* vbuf, long len) mpPixels = pBits; mpFileBuffer = vbuf; err = 0; - //WMSG1("+++ successfully imported %d-bit TGA\n", mBpp); + //LOGI("+++ successfully imported %d-bit TGA", mBpp); if (mBpp == 32) { /* 32-bit TGA is a full-alpha format */ @@ -437,7 +437,7 @@ MyDIBitmap::ConvertBufToDIBSection(void) assert(mhBitmap == NULL); assert(mpFileBuffer != NULL); - WMSG0(" DIB converting buf to DIB Section\n"); + LOGI(" DIB converting buf to DIB Section"); /* alloc storage */ mpPixels = NULL; @@ -445,9 +445,9 @@ MyDIBitmap::ConvertBufToDIBSection(void) DIB_RGB_COLORS, &mpPixels, NULL, 0); if (mhBitmap == NULL) { DWORD err = ::GetLastError(); - WMSG1(" DIB CreateDIBSection failed (err=%d)\n", err); + LOGI(" DIB CreateDIBSection failed (err=%d)", err); LogHexDump(&mBitmapInfoHdr, sizeof(BITMAPINFO)); - WMSG1("&mpPixels = 0x%08lx\n", &mpPixels); + LOGI("&mpPixels = 0x%08lx", &mpPixels); DebugBreak(); mpPixels = oldPixels; return -1; @@ -492,9 +492,9 @@ MyDIBitmap::CreateFromResource(HINSTANCE hInstance, const WCHAR* rsrc) DWORD err = ::GetLastError(); //CString msg; //GetWin32ErrorString(err, &msg); - //WMSG2(" DIB CreateDIBSection failed (err=%d msg='%ls')\n", + //LOGI(" DIB CreateDIBSection failed (err=%d msg='%ls')", // err, (LPCWSTR) msg); - WMSG1(" DIB LoadImage failed (err=%d)\n", err); + LOGI(" DIB LoadImage failed (err=%d)", err); return NULL; } @@ -539,7 +539,7 @@ MyDIBitmap::CreateFromResource(HINSTANCE hInstance, const WCHAR* rsrc) DWORD err = ::GetLastError(); CString buf; GetWin32ErrorString(err, &buf); - WMSG2(" DIB GetDIBColorTable failed (err=0x%x '%ls')\n", + LOGI(" DIB GetDIBColorTable failed (err=0x%x '%ls')", err, (LPCWSTR) buf); } SelectObject(memDC, oldBits); @@ -554,7 +554,7 @@ MyDIBitmap::CreateFromResource(HINSTANCE hInstance, const WCHAR* rsrc) * tweak mPitchBytes or we'll get garbage. */ if (mPitchBytes & 0x03) { - WMSG1(" DIB altering LoadImage pitchBytes (currently %d)\n", mPitchBytes); + LOGI(" DIB altering LoadImage pitchBytes (currently %d)", mPitchBytes); mPitchBytes = (mPitchBytes + 3) & ~(0x03); } @@ -596,7 +596,7 @@ MyDIBitmap::ClearPixels(void) { assert(mpPixels != NULL); - //WMSG1(" DIB clearing entire bitmap (%d bytes)\n", mPitchBytes * mHeight); + //LOGI(" DIB clearing entire bitmap (%d bytes)", mPitchBytes * mHeight); memset(mpPixels, 0, mPitchBytes * mHeight); } @@ -616,7 +616,7 @@ MyDIBitmap::SetColorTable(const RGBQUAD* pColorTable) * PhotoShop v5.x sets rgbReserved to 1 on every 8th color table * entry on 8-bit images. No idea why. */ - //WMSG2(" DIB warning: bogus color entry %d (res=%d)\n", i, + //LOGI(" DIB warning: bogus color entry %d (res=%d)", i, // pColorTable[i].rgbReserved); //DebugBreak(); } @@ -649,7 +649,7 @@ void MyDIBitmap::SetTransparentColor(const RGBQUAD* pColor) { if (mAlphaType == kAlphaFull) { - WMSG0(" NOTE: switching from full alpha to transparent-color alpha\n"); + LOGI(" NOTE: switching from full alpha to transparent-color alpha"); } mTransparentColor = *(const DWORD*)pColor; mTransparentColor &= ~kAlphaMask; // strip alpha off, want color only @@ -667,11 +667,11 @@ int MyDIBitmap::LookupColor(const RGBQUAD* pRgbQuad) { if (mBpp > 8) { - WMSG1(" DIB LookupColor on %d-bit image\n", mBpp); + LOGI(" DIB LookupColor on %d-bit image", mBpp); return -2; } if (!mColorTableInitialized) { - WMSG0(" DIB can't LookupColor, color table not initialized\n"); + LOGI(" DIB can't LookupColor, color table not initialized"); return -2; } @@ -839,7 +839,7 @@ MyDIBitmap::SetPixelRGBA(int x, int y, const RGBQUAD* pRgbQuad) } else if (mBpp == 8 || mBpp == 4) { int idx = LookupColor(pRgbQuad); if (idx < 0) { - WMSG3(" DIB WARNING: unable to set pixel to (%d,%d,%d)\n", + LOGI(" DIB WARNING: unable to set pixel to (%d,%d,%d)", pRgbQuad->rgbRed, pRgbQuad->rgbGreen, pRgbQuad->rgbBlue); } else { SetPixelIndex(x, (mHeight - y -1), idx); @@ -885,8 +885,8 @@ void MyDIBitmap::SetPixelIndex(int x, int y, int idx) { if (x < 0 || x >= mWidth || y < 0 || y >= mHeight) { - WMSG3("BAD x=%d y=%d idx=%d\n", x, y, idx); - WMSG2(" width=%d height=%d\n", mWidth, mHeight); + LOGI("BAD x=%d y=%d idx=%d", x, y, idx); + LOGI(" width=%d height=%d", mWidth, mHeight); } assert(x >= 0 && x < mWidth && y >= 0 && y < mHeight); y = mHeight - y -1; // upside-down @@ -926,23 +926,23 @@ MyDIBitmap::Blit(MyDIBitmap* pDstBits, const RECT* pDstRect, if (pDstRect->right - pDstRect->left != pSrcRect->right - pSrcRect->left) { - WMSG0("DIB blit: widths differ\n"); + LOGI("DIB blit: widths differ"); return false; } if (pDstRect->bottom - pDstRect->top != pSrcRect->bottom - pSrcRect->top) { - WMSG0("DIB blit: heights differ\n"); + LOGI("DIB blit: heights differ"); return false; } if (pSrcBits->mBpp != pDstBits->mBpp) { - WMSG0("DIB blit: different formats\n"); + LOGI("DIB blit: different formats"); return false; } if (pDstRect->right <= pDstRect->left || pDstRect->bottom <= pDstRect->top) { - WMSG0("DIB blit: poorly formed rect\n"); + LOGI("DIB blit: poorly formed rect"); return false; } @@ -1004,7 +1004,7 @@ MyDIBitmap::ConvertToDDB(HDC dc) const HBITMAP hBitmap = NULL; if (mNumColorsUsed != 0 && !mColorTableInitialized) { - WMSG0(" DIB color table not initialized!\n"); + LOGI(" DIB color table not initialized!"); return NULL; } @@ -1032,14 +1032,14 @@ MyDIBitmap::ConvertToDDB(HDC dc) const */ hBitmap = ::CreateDIBitmap(dc, &mBitmapInfoHdr, 0, NULL, NULL, 0); if (hBitmap == NULL) { - WMSG0(" DIB CreateDIBBitmap failed!\n"); + LOGI(" DIB CreateDIBBitmap failed!"); return NULL; } - WMSG4(" PARM hbit=0x%08lx hgt=%d fpPixels=0x%08lx pNewInfo=0x%08lx\n", + LOGI(" PARM hbit=0x%08lx hgt=%d fpPixels=0x%08lx pNewInfo=0x%08lx", hBitmap, mBitmapInfoHdr.biHeight, fpPixels, pNewInfo); LogHexDump(&mBitmapInfoHdr, sizeof(mBitmapInfoHdr)); - WMSG(" pNewInfo (sz=%d colorTableSize=%d):\n", sizeof(BITMAPINFO), + LOGI(" pNewInfo (sz=%d colorTableSize=%d):\n", sizeof(BITMAPINFO), colorTableSize); LogHexDump(pNewInfo, sizeof(BITMAPINFO) + colorTableSize); @@ -1052,13 +1052,13 @@ MyDIBitmap::ConvertToDDB(HDC dc) const if (count != mBitmapInfoHdr.biHeight) { DWORD err = ::GetLastError(); - WMSG1(" DIB SetDIBits failed, count was %d\n", count); + LOGI(" DIB SetDIBits failed, count was %d", count); ::DeleteObject(hBitmap); hBitmap = NULL; CString msg; GetWin32ErrorString(err, &msg); - WMSG2(" DIB CreateDIBSection failed (err=%d msg='%ls')\n", + LOGI(" DIB CreateDIBSection failed (err=%d msg='%ls')", err, (LPCWSTR) msg); //ASSERT(false); // stop & examine this return NULL; @@ -1070,7 +1070,7 @@ MyDIBitmap::ConvertToDDB(HDC dc) const hBitmap = ::CreateDIBitmap(dc, &mBitmapInfoHdr, CBM_INIT, mpPixels, pNewInfo, DIB_RGB_COLORS); if (hBitmap == NULL) { - WMSG0(" DIB CreateDIBBitmap failed!\n"); + LOGI(" DIB CreateDIBBitmap failed!"); return NULL; } #endif @@ -1095,7 +1095,7 @@ MyDIBitmap::WriteToFile(const WCHAR* fileName) const fp = _wfopen(fileName, L"wb"); if (fp == NULL) { err = errno ? errno : -1; - WMSG2("Unable to open bitmap file '%ls' (err=%d)\n", fileName, err); + LOGI("Unable to open bitmap file '%ls' (err=%d)", fileName, err); return err; } @@ -1135,7 +1135,7 @@ MyDIBitmap::WriteToFile(FILE* fp) const sizeof(RGBQUAD) * mNumColorsUsed; fileHeader.bfSize = fileHeader.bfOffBits + pixelBufSize; - WMSG3(" DIB writing bfOffBits=%d, bfSize=%d, pixelBufSize=%d\n", + LOGI(" DIB writing bfOffBits=%d, bfSize=%d, pixelBufSize=%d", fileHeader.bfOffBits, fileHeader.bfSize, pixelBufSize); if (fwrite(&fileHeader, sizeof(fileHeader), 1, fp) != 1) { @@ -1164,7 +1164,7 @@ MyDIBitmap::WriteToFile(FILE* fp) const /* verify the length; useful for detecting "w" vs "wb" */ if (ftell(fp) - startOffset != (long) fileHeader.bfSize) { - WMSG2("DIB tried to write %ld, wrote %ld (check for \"wb\")\n", + LOGI("DIB tried to write %ld, wrote %ld (check for \"wb\")", fileHeader.bfSize, ftell(fp) - startOffset); assert(false); } diff --git a/util/MyDebug.cpp b/util/MyDebug.cpp index 54da001..39b16ba 100644 --- a/util/MyDebug.cpp +++ b/util/MyDebug.cpp @@ -12,6 +12,11 @@ DebugLog::DebugLog(const WCHAR* logFile) : fLogFp(NULL) { fPid = getpid(); +#ifdef _DEBUG + fDoCrtDebug = true; +#else + fDoCrtDebug = false; +#endif if (logFile == NULL) { return; @@ -52,7 +57,7 @@ DebugLog::~DebugLog() { void DebugLog::Log(LogSeverity severity, const char* file, int line, const char* format, ...) { - if (fLogFp == NULL) { + if (fLogFp == NULL && !fDoCrtDebug) { return; } @@ -61,15 +66,28 @@ void DebugLog::Log(LogSeverity severity, const char* file, int line, severity = LOG_UNKNOWN; } - struct tm tmbuf; - time_t now = time(NULL); - localtime_s(&tmbuf, &now); - va_list argptr; - va_start(argptr, format); + char textBuf[4096]; - // had %05u fPid before; not sure that's useful - fprintf(fLogFp, "%02d:%02d:%02d %c ", tmbuf.tm_hour, - tmbuf.tm_min, tmbuf.tm_sec, kSeverityChars[severity]); - vfprintf(fLogFp, format, argptr); + va_start(argptr, format); + _vsnprintf(textBuf, NELEM(textBuf) - 1, format, argptr); + va_end(argptr); + textBuf[NELEM(textBuf) - 1] = '\0'; + + if (fLogFp) { + struct tm tmbuf; + time_t now = time(NULL); + localtime_s(&tmbuf, &now); + + // also had %05u fPid before; not sure that's useful + fprintf(fLogFp, "%02d:%02d:%02d %c %s\n", tmbuf.tm_hour, + tmbuf.tm_min, tmbuf.tm_sec, kSeverityChars[severity], + textBuf); + } + if (fDoCrtDebug) { + if (_CrtDbgReport(_CRT_WARN, file, line, NULL, "%s\n", textBuf) == 1) { + // "retry" button causes a debugger break + _CrtDbgBreak(); + } + } } diff --git a/util/MyDebug.h b/util/MyDebug.h index 5f6e964..e744d1c 100644 --- a/util/MyDebug.h +++ b/util/MyDebug.h @@ -37,8 +37,8 @@ public: /* * Write a message to the log file. * - * There doesn't seem to be a va_arg form of _CrtDbgReport, just "...", - * so we can't call that from here unless we snprintf to a buffer. + * The format string should not end with a newline. Each log message + * will appear on its own line, possibly with a prefix. */ void Log(LogSeverity severity, const char* file, int line, const char* format, ...); @@ -50,6 +50,7 @@ private: FILE* fLogFp; int fPid; + bool fDoCrtDebug; }; extern DebugLog* gDebugLog; // declare and allocate in app @@ -57,13 +58,7 @@ extern DebugLog* gDebugLog; // declare and allocate in app /* send the message to the log file (if open) and the CRT debug mechanism */ #define LOG_BASE(severity, file, line, format, ...) \ - { \ - gDebugLog->Log((severity), (file), (line), (format), __VA_ARGS__); \ - if (_CrtDbgReport(_CRT_WARN, (file), (line), NULL, (format), \ - __VA_ARGS__) == 1) { \ - _CrtDbgBreak(); \ - } \ - } + { gDebugLog->Log((severity), (file), (line), (format), __VA_ARGS__); } /* * Log macros, with priority specifier. The output will be written to the @@ -87,16 +82,6 @@ extern DebugLog* gDebugLog; // declare and allocate in app #define LOGE(format, ...) \ LOG_BASE(DebugLog::LOG_ERROR, __FILE__, __LINE__, format, __VA_ARGS__) -// TODO: remove these -#define WMSG0(fmt) LOGI(fmt) -#define WMSG1(fmt, arg0) LOGI(fmt, arg0) -#define WMSG2(fmt, arg0, arg1) LOGI(fmt, arg0, arg1) -#define WMSG3(fmt, arg0, arg1, arg2) LOGI(fmt, arg0, arg1, arg2) -#define WMSG4(fmt, arg0, arg1, arg2, arg3) LOGI(fmt, arg0, arg1, \ - arg2, arg3) -#define WMSG5(fmt, arg0, arg1, arg2, arg3, arg4) LOGI(fmt, arg0, \ - arg1, arg2, arg3, arg4) - /* make the memory leak test output more interesting */ #ifdef _DEBUG # define new DEBUG_NEW diff --git a/util/MySpinCtrl.cpp b/util/MySpinCtrl.cpp index 217e828..4fb5d4a 100644 --- a/util/MySpinCtrl.cpp +++ b/util/MySpinCtrl.cpp @@ -110,7 +110,7 @@ MySpinCtrl::SetPos(int nPos) CString buddyStr; if (nPos < fLow || nPos > fHigh) { - //WMSG0(" MSP setpos out of range\n"); + //LOGI(" MSP setpos out of range"); return -1; } @@ -173,7 +173,7 @@ MySpinCtrl::GetRange32(int& lower, int& upper) const { lower = fLow; upper = fHigh; - //WMSG2(" MSP getting lower=%d upper=%d\n", lower, upper); + //LOGI(" MSP getting lower=%d upper=%d", lower, upper); } /* @@ -187,5 +187,5 @@ MySpinCtrl::SetRange32(int nLo, int nHi) fLow = nLo; fHigh = nHi; - //WMSG2(" MSP setting lower=%d upper=%d\n", fLow, fHigh); + //LOGI(" MSP setting lower=%d upper=%d", fLow, fHigh); } diff --git a/util/PathName.cpp b/util/PathName.cpp index 815bb45..c1bdeb7 100644 --- a/util/PathName.cpp +++ b/util/PathName.cpp @@ -149,7 +149,7 @@ PathName::GetFileName(void) const WCHAR* ccp; ccp = FilenameOnly(fPathName, '\\'); if (wcscmp(ccp, str) != 0) { - WMSG2("NOTE: got different filenames '%ls' vs '%ls'\n", + LOGI("NOTE: got different filenames '%ls' vs '%ls'", ccp, (LPCTSTR) str); } } @@ -208,7 +208,7 @@ PathName::GetExtension(void) if ((ccp == NULL && wcslen(fExt) > 0) || (ccp != NULL && wcscmp(ccp, fExt) != 0)) { - WMSG2("NOTE: got different extensions '%ls' vs '%ls'\n", + LOGI("NOTE: got different extensions '%ls' vs '%ls'", ccp, (LPCTSTR) fExt); } } @@ -240,7 +240,7 @@ PathName::SFNToLFN(void) len = GetFullPathName(fPathName, NELEM(buf), buf, &cp); if (len == 0 || len >= sizeof(buf)) return -1; - //WMSG1(" FullPathName='%ls'\n", buf); + //LOGI(" FullPathName='%ls'", buf); if (buf[len-1] == '\\') { hadEndingSlash = true; @@ -269,12 +269,12 @@ PathName::SFNToLFN(void) hFind = ::FindFirstFile(buf, &findFileData); if (hFind == INVALID_HANDLE_VALUE) { DWORD err = ::GetLastError(); - WMSG2("FindFirstFile '%ls' failed, err=%d\n", buf, err); + LOGI("FindFirstFile '%ls' failed, err=%d", buf, err); return -1; } else { FindClose(hFind); } - //WMSG2(" COMPONENT '%ls' [%ls]\n", findFileData.cFileName, + //LOGI(" COMPONENT '%ls' [%ls]", findFileData.cFileName, // findFileData.cAlternateFileName); lfn += findFileData.cFileName; lfn += "\\"; @@ -284,24 +284,24 @@ PathName::SFNToLFN(void) cp++; } - //WMSG1(" Interim name = '%ls'\n", (LPCTSTR) lfn); + //LOGI(" Interim name = '%ls'", (LPCTSTR) lfn); if (*(cp-1) != '\\') { /* there was some stuff after the last '\\'; handle it */ hFind = ::FindFirstFile(buf, &findFileData); if (hFind == INVALID_HANDLE_VALUE) { DWORD err = ::GetLastError(); - WMSG2("FindFirstFile '%ls' failed, err=%d\n", buf, err); + LOGI("FindFirstFile '%ls' failed, err=%d", buf, err); return -1; } else { FindClose(hFind); } - //WMSG2(" COMPONENT2 '%ls' [%ls]\n", findFileData.cFileName, + //LOGI(" COMPONENT2 '%ls' [%ls]", findFileData.cFileName, // findFileData.cAlternateFileName); lfn += findFileData.cFileName; } - //WMSG1(" Almost done = '%ls'\n", (LPCTSTR) lfn); + //LOGI(" Almost done = '%ls'", (LPCTSTR) lfn); if (hadEndingSlash) lfn += "\\"; @@ -338,7 +338,7 @@ bool PathName::Exists(void) { // if (strncmp(fPathName, "\\\\", 2) == 0) { -// WMSG1("Refusing to check for network path '%ls'\n", fPathName); +// LOGI("Refusing to check for network path '%ls'", fPathName); // return false; // } @@ -527,7 +527,7 @@ PathName::SetModWhen(time_t when) struct _utimbuf utbuf; if (when == (time_t) -1 || when == kDateNone || when == kDateInvalid) { - WMSG1("NOTE: not setting invalid date (%ld)\n", when); + LOGI("NOTE: not setting invalid date (%ld)", when); return 0; } @@ -566,7 +566,7 @@ PathName::CreateSubdirIFN(const WCHAR* pathStart, const WCHAR* pathEnd, err = GetFileInfo(tmpBuf, NULL, NULL, &exists, NULL, &isDirectory); if (err != 0) { - WMSG1(" Could not get file info for '%ls'\n", tmpBuf); + LOGI(" Could not get file info for '%ls'", tmpBuf); goto bail; } else if (!exists) { /* dir doesn't exist; move up a level and check parent */ @@ -586,7 +586,7 @@ PathName::CreateSubdirIFN(const WCHAR* pathStart, const WCHAR* pathEnd, } else { /* file does exist, make sure it's a directory */ if (!isDirectory) { - WMSG1("Existing file '%ls' is not a directory\n", tmpBuf); + LOGI("Existing file '%ls' is not a directory", tmpBuf); err = ENOTDIR; goto bail; } diff --git a/util/SelectFilesDialog.cpp b/util/SelectFilesDialog.cpp index 38bd2c3..f89d152 100644 --- a/util/SelectFilesDialog.cpp +++ b/util/SelectFilesDialog.cpp @@ -86,7 +86,7 @@ SelectFilesDialog::OFNHookProc(HWND hDlg, UINT uiMsg, WPARAM wParam, switch (uiMsg) { case WM_INITDIALOG: - WMSG1("WM_INITDIALOG, OFN=0x%08lx\n", lParam); + LOGI("WM_INITDIALOG, OFN=0x%08lx", lParam); SetWindowLong(hDlg, GWL_USERDATA, lParam); break; case WM_NOTIFY: // 0x4e @@ -102,8 +102,8 @@ SelectFilesDialog::OFNHookProc(HWND hDlg, UINT uiMsg, WPARAM wParam, ASSERT(pSFD != NULL); return pSFD->HandleHelp(hDlg, (LPHELPINFO) lParam); default: - //WMSG4("OFNHookProc: hDlg=0x%08lx uiMsg=0x%08lx " - // "wParam=0x%08lx lParam=0x%08lx\n", + //LOGI("OFNHookProc: hDlg=0x%08lx uiMsg=0x%08lx " + // "wParam=0x%08lx lParam=0x%08lx", // hDlg, uiMsg, wParam, lParam); break; } @@ -127,43 +127,43 @@ SelectFilesDialog::HandleNotify(HWND hDlg, LPOFNOTIFY pofn) MyOnInitDone(); return 1; case CDN_SELCHANGE: - WMSG0(" CDN_SELCHANGE\n"); + LOGI(" CDN_SELCHANGE"); MyOnFileNameChange(/*&count*/); //ClearFileName(); return 1; case CDN_FOLDERCHANGE: - WMSG0(" CDN_FOLDERCHANGE\n"); + LOGI(" CDN_FOLDERCHANGE"); break; case CDN_SHAREVIOLATION: - WMSG0(" CDN_SHAREVIOLATION\n"); + LOGI(" CDN_SHAREVIOLATION"); break; case CDN_HELP: - WMSG0(" CDN_HELP!\n"); + LOGI(" CDN_HELP!"); break; case CDN_FILEOK: - WMSG0(" CDN_FILEOK\n"); + LOGI(" CDN_FILEOK"); /* act like they hit the Accept button */ // MyOnFileNameChange(&count); //ClearFileName(); // if (count != 0) { -// WMSG1("Count = %d, accepting CDN_FILEOK\n", count); +// LOGI("Count = %d, accepting CDN_FILEOK", count); // MyOnAccept(); // } else { // OPENFILENAME* pOfn; // pOfn = (OPENFILENAME*) GetWindowLong(hDlg, GWL_USERDATA); -// WMSG1("Count=0, name='%ls'\n", pOfn->lpstrFile); +// LOGI("Count=0, name='%ls'", pOfn->lpstrFile); // } PrepEndDialog(); /* must do this every time, or it fails in funky ways */ SetWindowLong(hDlg, DWL_MSGRESULT, 1); return 1; case CDN_TYPECHANGE: - WMSG0(" CDN_TYPECHANGE\n"); + LOGI(" CDN_TYPECHANGE"); break; case CDN_INCLUDEITEM: - WMSG0(" CDN_INCLUDEITEM\n"); + LOGI(" CDN_INCLUDEITEM"); default: - WMSG2(" HandleNotify, code=%d, pOfn=0x%08lx\n", pofn->hdr.code, pofn); + LOGI(" HandleNotify, code=%d, pOfn=0x%08lx", pofn->hdr.code, pofn); break; } @@ -176,7 +176,7 @@ SelectFilesDialog::HandleNotify(HWND hDlg, LPOFNOTIFY pofn) UINT SelectFilesDialog::HandleCommand(HWND hDlg, WPARAM wParam, LPARAM lParam) { - WMSG2(" HandleCommand wParam=%d lParam=0x%08lx\n", wParam, lParam); + LOGI(" HandleCommand wParam=%d lParam=0x%08lx", wParam, lParam); if ((int) wParam == fAcceptButtonID) { MyOnAccept(); @@ -195,9 +195,9 @@ SelectFilesDialog::HandleCommand(HWND hDlg, WPARAM wParam, LPARAM lParam) UINT SelectFilesDialog::HandleSize(HWND hDlg, UINT nType, int cx, int cy) { - //WMSG3("Dialog: old size %d,%d (ready=%d)\n", + //LOGI("Dialog: old size %d,%d (ready=%d)", // fLastWinSize.Width(), fLastWinSize.Height(), fReady); - //WMSG2("Dialog: new size %d,%d\n", cx, cy); + //LOGI("Dialog: new size %d,%d", cx, cy); // we get called once before we have a chance to initialize if (!fReady) @@ -206,7 +206,7 @@ SelectFilesDialog::HandleSize(HWND hDlg, UINT nType, int cx, int cy) int deltaX, deltaY; deltaX = cx - fLastWinSize.Width(); deltaY = cy - fLastWinSize.Height(); - //WMSG2("Delta is %d,%d\n", deltaX, deltaY); + //LOGI("Delta is %d,%d", deltaX, deltaY); ShiftControls(deltaX, 0 /*deltaY*/); @@ -227,10 +227,10 @@ SelectFilesDialog::HandleHelp(HWND hDlg, LPHELPINFO lpHelpInfo) DWORD context = lpHelpInfo->iCtrlId; BOOL result; - //WMSG1("Handling help with context %ld\n", context); + //LOGI("Handling help with context %ld", context); result = ::WinHelp(pWndMain->m_hWnd, pAppMain->m_pszHelpFilePath, HELP_CONTEXTPOPUP, context); - //WMSG1("SFD WinHelp returned %d\n", result); + //LOGI("SFD WinHelp returned %d", result); return TRUE; // yes, we handled it } @@ -246,7 +246,7 @@ SelectFilesDialog::HandleHelp(HWND hDlg, LPHELPINFO lpHelpInfo) void SelectFilesDialog::MyOnInitDone(void) { - WMSG0("OnInitDone!\n"); + LOGI("OnInitDone!"); CWnd* pParent = GetParent(); CWnd* pWnd; CRect okRect, cancelRect, acceptRect; @@ -265,7 +265,7 @@ SelectFilesDialog::MyOnInitDone(void) pWnd->GetWindowRect(&cancelRect); vertDiff = acceptRect.top - okRect.top; - WMSG2("vertDiff = %d (horizDiff=%d)\n", vertDiff, + LOGI("vertDiff = %d (horizDiff=%d)", vertDiff, acceptRect.left - okRect.left); ShiftControls(0, -vertDiff); @@ -297,10 +297,10 @@ void SelectFilesDialog::ShiftControls(int deltaX, int deltaY) { if (deltaX == 0 && deltaY == 0) { - WMSG0("SFD OnSize: no meaningful change\n"); + LOGI("SFD OnSize: no meaningful change"); return; } else { - WMSG2("ShiftControls x=%d y=%d\n", deltaX, deltaY); + LOGI("ShiftControls x=%d y=%d", deltaX, deltaY); } MoveControl(this, fAcceptButtonID, deltaX, deltaY, false); MoveControl(this, IDCANCEL, deltaX, deltaY, false); @@ -341,18 +341,18 @@ SelectFilesDialog::GetListCtrl(void) void SelectFilesDialog::MyOnFileNameChange(void) { - //WMSG1("OnFileNameChange\n"); + //LOGI("OnFileNameChange"); CListCtrl* pList; pList = (CListCtrl*) GetListCtrl(); if (pList == NULL) { - WMSG0("GLITCH: could not get list control\n"); + LOGI("GLITCH: could not get list control"); return; } ASSERT(pList != NULL); - //WMSG1("Selected count=%d\n", pList->GetSelectedCount()); + //LOGI("Selected count=%d", pList->GetSelectedCount()); //*pCount = pList->GetSelectedCount(); //CWnd* pItem; @@ -367,7 +367,7 @@ SelectFilesDialog::MyOnFileNameChange(void) void SelectFilesDialog::MyOnAccept(void) { - //WMSG0("OnAccept!\n"); + //LOGI("OnAccept!"); PrepEndDialog(); } @@ -386,7 +386,7 @@ SelectFilesDialog::PrepEndDialog(void) // let sub-classes copy data out if (!MyDataExchange(true)) { - WMSG0("MyDataExchange failed!\n"); + LOGI("MyDataExchange failed!"); return false; } @@ -406,14 +406,14 @@ SelectFilesDialog::PrepEndDialog(void) * Fortunately I believe the world is divided into "typers" and * "clickers", and so long as their paths don't cross we're fine. */ - WMSG2("PrepEndDialog: got max=%d off=%d\n", m_ofn.nMaxFile, m_ofn.nFileOffset); + LOGI("PrepEndDialog: got max=%d off=%d", m_ofn.nMaxFile, m_ofn.nFileOffset); if (m_ofn.nFileOffset != 0) { WCHAR* buf = m_ofn.lpstrFile; buf += m_ofn.nFileOffset; while (*buf != '\0') { if (buf > m_ofn.lpstrFile) *(buf-1) = '\\'; - WMSG1(" File '%ls'\n", buf); + LOGI(" File '%ls'", buf); buf += wcslen(buf) +1; } //Sleep(1000); @@ -424,7 +424,7 @@ SelectFilesDialog::PrepEndDialog(void) /* stick a '\' on the very end, so we get double-null action later */ *(m_ofn.lpstrFile + nextSpot) = '\\'; } - WMSG1("Last offset was %d\n", nextSpot); + LOGI("Last offset was %d", nextSpot); #if 0 /* make it clear that they're only getting one */ @@ -446,7 +446,7 @@ SelectFilesDialog::PrepEndDialog(void) */ pList = (CListCtrl*) GetListCtrl(); if (pList == NULL) { - WMSG0("GLITCH: could not get list control\n"); + LOGI("GLITCH: could not get list control"); return false; } ASSERT(pList != NULL); @@ -508,33 +508,33 @@ SelectFilesDialog::PrepEndDialog(void) PathName path(buf); compareName += path.GetFileName(); compareName += L"\\"; - //WMSG1(" Checking name='%ls'\n", compareName); + //LOGI(" Checking name='%ls'", compareName); if (compare && Stristr(tailStr, compareName) != NULL) { - WMSG1(" Matched '%ls', not adding\n", compareName); + LOGI(" Matched '%ls', not adding", compareName); } else { if (compare) { - WMSG1(" No match on '%ls', adding\n", compareName); + LOGI(" No match on '%ls', adding", compareName); } else { - WMSG1(" Found '%ls', adding\n", compareName); + LOGI(" Found '%ls', adding", compareName); } fileNames += path.GetFileName(); fileNames += L"\\"; } } else { /* expected, for things like "Control Panels" or "My Network" */ - WMSG1(" No path for '%ls'\n", + LOGI(" No path for '%ls'", (LPCTSTR) pList->GetItemText(num, 0)); } } if (fileNames.GetLength() >= (int)m_ofn.nMaxFile) { - WMSG0("GLITCH: excessively long file name list\n"); + LOGI("GLITCH: excessively long file name list"); return false; } } - WMSG3("Final result: names at %d, len=%d, str='%ls'\n", + LOGI("Final result: names at %d, len=%d, str='%ls'", fFileNameOffset, wcslen(fileNames), fileNames); /* diff --git a/util/SelectFilesDialog.h b/util/SelectFilesDialog.h index 6bcd8af..809f911 100644 --- a/util/SelectFilesDialog.h +++ b/util/SelectFilesDialog.h @@ -64,7 +64,7 @@ public: ASSERT(len > wcslen(fileNames)); ASSERT(fileNames[len] == '\0'); ASSERT(fileNames[len-1] == '\0'); - WMSG3("SetFileNames '%ls' %d %d\n", fileNames, len, fileNameOffset); + LOGI("SetFileNames '%ls' %d %d", fileNames, len, fileNameOffset); delete[] fFileNames; fFileNames = wcsdup(fileNames); fFileNameOffset = fileNameOffset; @@ -93,7 +93,7 @@ protected: virtual void DestroyItem(CWnd* pDlg, int id) { CWnd* pWnd = pDlg->GetDlgItem(id); if (pWnd == NULL) { - WMSG1("Could not find item %d\n", id); + LOGI("Could not find item %d", id); return; } pWnd->DestroyWindow(); diff --git a/util/ShellTree.cpp b/util/ShellTree.cpp index fad18a9..fbce663 100644 --- a/util/ShellTree.cpp +++ b/util/ShellTree.cpp @@ -92,7 +92,7 @@ ShellTree::PopulateTree(int nFolder) // find the desired special folder hr = SHGetSpecialFolderLocation(m_hWnd, nFolder, &lpi); if (FAILED(hr)) { - WMSG0("BUG: could not find requested special folder\n"); + LOGI("BUG: could not find requested special folder"); goto bail; } @@ -188,10 +188,10 @@ ShellTree::FillTreeView(LPSHELLFOLDER lpsf, LPITEMIDLIST lpifq, { /* DEBUG */ CString name; if (Pidl::GetName(lpsf, lpi, SHGDN_NORMAL, &name)) { - WMSG2(" Checking '%ls' 0x%08lx\n", + LOGI(" Checking '%ls' 0x%08lx", name, ulAttrs); } else { - WMSG1(" Checking 0x%08lx\n", + LOGI(" Checking 0x%08lx", ulAttrs); } } @@ -278,7 +278,7 @@ ShellTree::FillTreeView(LPSHELLFOLDER lpsf, LPITEMIDLIST lpifq, gotOne = true; if (!AddNode(lpsf, lpi, lpifq, ulAttrs, hParent, &hPrev)) { - WMSG0("AddNode failed!\n"); + LOGI("AddNode failed!"); goto Done; } } @@ -297,14 +297,14 @@ ShellTree::FillTreeView(LPSHELLFOLDER lpsf, LPITEMIDLIST lpifq, tvi.hItem = hParent; tvi.mask = TVIF_CHILDREN; if (!GetItem(&tvi)) { - WMSG1("Could not get TV '%ls'\n", name); + LOGI("Could not get TV '%ls'", name); ASSERT(false); } else if (tvi.cChildren) { - WMSG2("Removing child count (%d) from '%ls'\n", + LOGI("Removing child count (%d) from '%ls'", tvi.cChildren, name); tvi.cChildren = 0; if (!SetItem(&tvi)) { - WMSG1("Could not set TV '%ls'\n", name); + LOGI("Could not set TV '%ls'", name); ASSERT(false); } } @@ -322,7 +322,7 @@ Done: if (lpMalloc) lpMalloc->Release(); - //WMSG0("FillTreeView DONE\n"); + //LOGI("FillTreeView DONE"); } /* @@ -350,11 +350,11 @@ ShellTree::AddNode(LPSHELLFOLDER lpsf, LPITEMIDLIST lpi, LPITEMIDLIST lpifq, //Now get the friendly name that we'll put in the treeview. if (!Pidl::GetName(lpsf, lpi, SHGDN_NORMAL, &name)) { - WMSG0("HEY: failed getting friendly name\n"); + LOGI("HEY: failed getting friendly name"); goto bail; // Error - could not get friendly name. } wcscpy_s(szBuff, name); - //WMSG2("AddNode '%ls' ATTR=0x%08lx\n", szBuff, ulAttrs); + //LOGI("AddNode '%ls' ATTR=0x%08lx", szBuff, ulAttrs); lptvid = (TVItemData*)lpMalloc->Alloc(sizeof(TVItemData)); if (!lptvid) @@ -462,7 +462,7 @@ ShellTree::TreeViewCompareProc(LPARAM lparam1, LPARAM lparam2, LPARAM) if (Pidl::GetName(lptvid1->lpsfParent, lptvid1->lpi, SHGDN_NORMAL, buf1) && Pidl::GetName(lptvid2->lpsfParent, lptvid2->lpi, SHGDN_NORMAL, buf2)) { - WMSG3("COMPARING '%s' to '%s' (res=%d)\n", buf1, buf2, + LOGI("COMPARING '%s' to '%s' (res=%d)", buf1, buf2, (short) HRESULT_CODE(hr)); return stricmp(buf1, buf2); } else { @@ -499,7 +499,7 @@ ShellTree::AddFolderAtSelection(const CString& name) CString debugName; HRESULT hr; - WMSG1("AddFolderAtSelection '%ls'\n", name); + LOGI("AddFolderAtSelection '%ls'", name); // Allocate a shell memory object. hr = ::SHGetMalloc(&lpMalloc); @@ -508,7 +508,7 @@ ShellTree::AddFolderAtSelection(const CString& name) hParent = GetSelectedItem(); if (hParent == NULL) { - WMSG0("Nothing selected!\n"); + LOGI("Nothing selected!"); goto bail; } @@ -534,26 +534,26 @@ ShellTree::AddFolderAtSelection(const CString& name) tvi.hItem = hParent; tvi.mask = TVIF_CHILDREN; if (!GetItem(&tvi)) { - WMSG1("Could not get TV '%ls'\n", debugName); + LOGI("Could not get TV '%ls'", debugName); ASSERT(false); } else { HTREEITEM child = GetChildItem(hParent); if (child == NULL && tvi.cChildren) { - WMSG1(" Found unexpanded node, not adding %ls\n", name); + LOGI(" Found unexpanded node, not adding %ls", name); result = TRUE; goto bail; } else if (child == NULL && !tvi.cChildren) { - WMSG1(" Found former leaf node, updating kids in %ls\n", debugName); + LOGI(" Found former leaf node, updating kids in %ls", debugName); tvi.cChildren = 1; if (!SetItem(&tvi)) { - WMSG1("Could not set TV '%ls'\n", debugName); + LOGI("Could not set TV '%ls'", debugName); ASSERT(false); } result = TRUE; goto bail; } else { ASSERT(child != NULL && tvi.cChildren != 0); - WMSG2(" Found expanded branch node '%ls', adding new '%ls'\n", + LOGI(" Found expanded branch node '%ls', adding new '%ls'", debugName, name); } } @@ -566,7 +566,7 @@ ShellTree::AddFolderAtSelection(const CString& name) hr = parentTvid->lpsfParent->BindToObject(parentTvid->lpi, 0, IID_IShellFolder, (LPVOID *)&lpsf); if (FAILED(hr)) { - WMSG0("Glitch: unable to get ShellFolder for selected folder\n"); + LOGI("Glitch: unable to get ShellFolder for selected folder"); goto bail; } @@ -574,7 +574,7 @@ ShellTree::AddFolderAtSelection(const CString& name) hr = lpsf->EnumObjects(hwnd, SHCONTF_FOLDERS | SHCONTF_INCLUDEHIDDEN, &lpe); if (FAILED(hr)) { - WMSG0("Glitch: unable to get enumerator for selected folder\n"); + LOGI("Glitch: unable to get enumerator for selected folder"); goto bail; } @@ -585,7 +585,7 @@ ShellTree::AddFolderAtSelection(const CString& name) if (name.CompareNoCase(pidlName) == 0) { /* match! */ if (!AddNode(lpsf, lpi, parentTvid->lpifq, 0, hParent, &hPrev)) { - WMSG0("AddNode failed!\n"); + LOGI("AddNode failed!"); goto bail; } result = TRUE; @@ -623,7 +623,7 @@ void ShellTree::OnFolderExpanding(NMHDR* pNMHDR, LRESULT* pResult) NM_TREEVIEW* pnmtv = (NM_TREEVIEW*)pNMHDR; if (pnmtv->itemNew.state & TVIS_EXPANDEDONCE) { - WMSG0("Already expanded!\n"); + LOGI("Already expanded!"); return; } @@ -743,9 +743,9 @@ ShellTree::OnFolderSelected(NMHDR* pNMHDR, LRESULT* pResult, } if (bRet) { - WMSG1("Now selected: '%ls'\n", szBuff); + LOGI("Now selected: '%ls'", szBuff); } else { - WMSG0("Now selected: \n"); + LOGI("Now selected: "); } #if 0 @@ -791,7 +791,7 @@ ShellTree::OnDeleteShellItem(NMHDR* pNMHDR, LRESULT* pResult) HRESULT hr; LPMALLOC lpMalloc; - //WMSG0("TVN_DELETEITEM\n"); + //LOGI("TVN_DELETEITEM"); NM_TREEVIEW* pNMTreeView = (NM_TREEVIEW*)pNMHDR; @@ -998,7 +998,7 @@ ShellTree::TunnelTree(CString path, CString* pResultStr) } CString drive = pathName.GetDriveOnly(); - WMSG1("Searching for drive='%ls'\n", drive); + LOGI("Searching for drive='%ls'", drive); HTREEITEM node = FindDrive(myComputer, drive); if (node == NULL) { @@ -1069,7 +1069,7 @@ ShellTree::FindMyComputer(void) hr = desktop->CompareIDs(0, myComputerPidl, pData->lpi); if (SUCCEEDED(hr) && HRESULT_CODE(hr) == 0) { - WMSG1("MATCHED on '%ls'\n", itemText); + LOGI("MATCHED on '%ls'", itemText); result = node; break; } @@ -1077,7 +1077,7 @@ ShellTree::FindMyComputer(void) } if (result != NULL && !ItemHasChildren(result)) { - WMSG0("Glitch: My Computer has no children\n"); + LOGI("Glitch: My Computer has no children"); result = NULL; } @@ -1125,9 +1125,9 @@ ShellTree::FindDrive(HTREEITEM myComputer, const CString& drive) CString itemText = GetItemText(node); itemText.MakeUpper(); - //WMSG2("COMPARING '%ls' vs '%ls'\n", (LPCWSTR) udrive, (LPCWSTR) itemText); + //LOGI("COMPARING '%ls' vs '%ls'", (LPCWSTR) udrive, (LPCWSTR) itemText); if (itemText.Find(udrive) != -1) { - WMSG2("MATCHED '%ls' in '%ls'\n", (LPCWSTR) udrive, (LPCWSTR) itemText); + LOGI("MATCHED '%ls' in '%ls'", (LPCWSTR) udrive, (LPCWSTR) itemText); break; } node = GetNextSiblingItem(node); @@ -1146,7 +1146,7 @@ ShellTree::FindDrive(HTREEITEM myComputer, const CString& drive) HTREEITEM ShellTree::SearchTree(HTREEITEM treeNode, const CString& path) { - WMSG2("SearchTree node=0x%08lx path='%ls'\n", + LOGI("SearchTree node=0x%08lx path='%ls'", treeNode, (LPCTSTR) path); HTREEITEM node; @@ -1176,16 +1176,16 @@ ShellTree::SearchTree(HTREEITEM treeNode, const CString& path) while (node != NULL) { CString itemText = GetItemText(node); - //WMSG2("COMPARE '%s' '%s'\n", start, itemText); + //LOGI("COMPARE '%s' '%s'", start, itemText); if (itemText.CompareNoCase(start) == 0) { - //WMSG2("MATCHED '%s' '%s'\n", itemText, start); + //LOGI("MATCHED '%s' '%s'", itemText, start); break; } node = GetNextSiblingItem(node); } if (node == NULL) { - WMSG2("NOT FOUND '%ls' '%ls'\n", (LPCTSTR) path, start); + LOGI("NOT FOUND '%ls' '%ls'", (LPCTSTR) path, start); break; } @@ -1384,7 +1384,7 @@ bool ShellTree::SearchTree(HTREEITEM treeNode, CSIDL_COMMON_DESKTOPDIRECTORY, FALSE); if( szCompare.Find( folder ) != -1 ) if( szSearchName.Find( szCompare ) == -1 ) { - WMSG1("Magic match on '%s'\n", szCompare); + LOGI("Magic match on '%s'", szCompare); return false; } @@ -1393,7 +1393,7 @@ bool ShellTree::SearchTree(HTREEITEM treeNode, CSIDL_DESKTOPDIRECTORY, FALSE ); if( szCompare.Find( folder ) != -1 ) if( szSearchName.Find( szCompare ) == -1 ) { - WMSG4("MAGIC '%s'='%s' and '%s'='%s'\n", + LOGI("MAGIC '%s'='%s' and '%s'='%s'", szCompare, folder, szSearchName, szCompare); return false; } @@ -1403,7 +1403,7 @@ bool ShellTree::SearchTree(HTREEITEM treeNode, CSIDL_PERSONAL, FALSE ); if( szCompare.Find( folder ) != -1 ) if( szSearchName.Find( szCompare ) == -1 ) { - WMSG1("Magic match on '%s'\n", szCompare); + LOGI("Magic match on '%s'", szCompare); return false; } @@ -1472,7 +1472,7 @@ void ShellTree::TunnelTree(CString szFindPath) szPathHop=drive; do { CString currItem = GetItemText( root ); - WMSG2("Scanning '%s' for drive '%s'\n", currItem, szPathHop); + LOGI("Scanning '%s' for drive '%s'", currItem, szPathHop); if (ItemHasChildren(root)) { Expand(root, TVE_EXPAND); @@ -1483,7 +1483,7 @@ void ShellTree::TunnelTree(CString szFindPath) { // we have a match on the drive; SearchTree will have // left it as the selected item - WMSG1("Tunnel match '%s' in subnode\n", szPathHop); + LOGI("Tunnel match '%s' in subnode", szPathHop); // break down subfolders and search char* p = strtok(dir, delimiter); diff --git a/util/SoundFile.cpp b/util/SoundFile.cpp index 6bfb7be..0fc5de9 100644 --- a/util/SoundFile.cpp +++ b/util/SoundFile.cpp @@ -73,7 +73,7 @@ SoundFile::Create(FILE* fp, long len, bool doClose, CString* pErrMsg) int err = 0; if (mFP != NULL) { - WMSG0("SoundFile object already created\n"); + LOGI("SoundFile object already created"); assert(false); return -1; } @@ -102,7 +102,7 @@ SoundFile::Create(FILE* fp, long len, bool doClose, CString* pErrMsg) fileHeader.fileLen > (unsigned long) len) { *pErrMsg = L"File is not a WAV file"; - WMSG3("Not a valid WAV header (0x%08lx %d 0x%08lx)\n", + LOGI("Not a valid WAV header (0x%08lx %d 0x%08lx)", fileHeader.riff, fileHeader.fileLen, fileHeader.wav); err = -1; goto bail; @@ -154,10 +154,10 @@ SoundFile::Create(FILE* fp, long len, bool doClose, CString* pErrMsg) mSampleStart = ftell(mFP); mSampleLen = chunkLen; - WMSG4("WAV: chan=%d samples/sec=%d avgBPS=%d block=%d\n", + LOGI("WAV: chan=%d samples/sec=%d avgBPS=%d block=%d", mFormat.nChannels, mFormat.nSamplesPerSec, mFormat.nAvgBytesPerSec, mFormat.nBlockAlign); - WMSG3(" bits/sample=%d [start=%d len=%d]\n", mFormat.wBitsPerSample, + LOGI(" bits/sample=%d [start=%d len=%d]", mFormat.wBitsPerSample, mSampleStart, mSampleLen); bail: @@ -181,7 +181,7 @@ SoundFile::SkipToHeader(unsigned long hdrID, unsigned long* pChunkLen) while (true) { if (fread(&chunkHeader, sizeof(chunkHeader), 1, mFP) != 1) { err = errno ? errno : -1; - WMSG1("Failed searching for chunk header 0x%08lx\n", hdrID); + LOGI("Failed searching for chunk header 0x%08lx", hdrID); break; } @@ -193,7 +193,7 @@ SoundFile::SkipToHeader(unsigned long hdrID, unsigned long* pChunkLen) /* didn't match, skip contents */ if (fseek(mFP, chunkHeader.chunkLen, SEEK_CUR) != 0) { err = errno; - WMSG1("Failed seeking past contents of 0x%08lx\n", + LOGI("Failed seeking past contents of 0x%08lx", chunkHeader.chunkLen); break; } @@ -209,7 +209,7 @@ int SoundFile::ReadData(void* buf, long sampleOffset, long len) const { if ((unsigned long)(sampleOffset+len) > mSampleLen) { - WMSG3("ERROR: invalid read request (%d bytes, %d into %d)\n", + LOGI("ERROR: invalid read request (%d bytes, %d into %d)", len, sampleOffset, mSampleLen); return -1; } @@ -219,7 +219,7 @@ SoundFile::ReadData(void* buf, long sampleOffset, long len) const if (fread(buf, len, 1, mFP) != 1) { int err = errno ? errno : -1; - WMSG1("Failed reading %d bytes from sound file\n", len); + LOGI("Failed reading %d bytes from sound file", len); return err; } diff --git a/util/Util.cpp b/util/Util.cpp index 510f50a..038876d 100644 --- a/util/Util.cpp +++ b/util/Util.cpp @@ -73,7 +73,7 @@ RichEditXfer::EditStreamCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG* p pThis->fBuf += copyLen; pThis->fLen -= copyLen; - //WMSG2("ESC: copyLen=%d, now fLen=%d\n", copyLen, pThis->fLen); + //LOGI("ESC: copyLen=%d, now fLen=%d", copyLen, pThis->fLen); bail: *pcb = copyLen; @@ -138,7 +138,7 @@ ExpandBuffer::GrowWorkBuf(void) if (newIncr > kWorkBufMaxIncrement) newIncr = kWorkBufMaxIncrement; - //WMSG3("Extending buffer by %d (count=%d, max=%d)\n", + //LOGI("Extending buffer by %d (count=%d, max=%d)", // newIncr, fWorkCount, fWorkMax); fWorkMax += newIncr; @@ -148,7 +148,7 @@ ExpandBuffer::GrowWorkBuf(void) char* newBuf = new char[fWorkMax]; if (newBuf == NULL) { - WMSG1("ALLOC FAILURE (%ld)\n", fWorkMax); + LOGI("ALLOC FAILURE (%ld)", fWorkMax); ASSERT(false); fWorkMax -= newIncr; // put it back so we don't overrun return -1; @@ -240,7 +240,7 @@ EnableControl(CDialog* pDlg, int id, bool enable) { CWnd* pWnd = pDlg->GetDlgItem(id); if (pWnd == NULL) { - WMSG1("GLITCH: control %d not found in dialog\n", id); + LOGI("GLITCH: control %d not found in dialog", id); ASSERT(false); } else { pWnd->EnableWindow(enable); @@ -448,7 +448,7 @@ GetWin32ErrorString(DWORD err, CString* pStr) ); if (!count) { - WMSG1("FormatMessage on err=0x%08lx failed\n", err); + LOGI("FormatMessage on err=0x%08lx failed", err); pStr->Format(L"system error 0x%08lx.\n", err); } else { *pStr = (LPCTSTR)lpMsgBuf; @@ -519,14 +519,14 @@ GetPascalString(const char* buf, long maxLen, CString* pStr) *pStr = ""; if (len > maxLen) { - WMSG2("Invalid pascal string -- len=%d, maxLen=%d\n", len, maxLen); + LOGI("Invalid pascal string -- len=%d, maxLen=%d", len, maxLen); return -1; } while (len--) { if (*buf == '\0') { /* this suggests that we're not reading a pascal string */ - WMSG0("Found pascal string with '\\0' in it\n"); + LOGI("Found pascal string with '\\0' in it"); return -1; } @@ -550,7 +550,7 @@ LogHexDump(const void* vbuf, long len) char* cp = NULL; int i; - WMSG2(" Memory at 0x%08lx %ld bytes:\n", buf, len); + LOGI(" Memory at 0x%08lx %ld bytes:", buf, len); if (len <= 0) return; @@ -571,7 +571,7 @@ LogHexDump(const void* vbuf, long len) if (skipFirst) { skipFirst = false; } else { - WMSG1(" %hs\n", outBuf); + LOGI(" %hs", outBuf); addr += 16; } sprintf(outBuf, "%08lx: ", addr); @@ -583,7 +583,7 @@ LogHexDump(const void* vbuf, long len) } /* output whatever is left */ - WMSG1(" %hs\n", outBuf); + LOGI(" %hs", outBuf); } /* @@ -711,7 +711,7 @@ VectorizeString(WCHAR* mangle, WCHAR** argv, int* pArgc) if (inWhiteSpace) { /* start of token */ if (idx >= *pArgc) { - //WMSG2("Max #of args (%d) exceeded, ignoring '%ls'\n", + //LOGI("Max #of args (%d) exceeded, ignoring '%ls'", // *pArgc, cp); break; } @@ -731,7 +731,7 @@ VectorizeString(WCHAR* mangle, WCHAR** argv, int* pArgc) } if (inQuote) { - WMSG0("WARNING: ended in quote\n"); + LOGI("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); - //WMSG1(" TOKEN: '%ls'\n", (LPCWSTR) token); + //LOGI(" TOKEN: '%ls'", (LPCWSTR) token); /* these words are left alone */ for (i = 0; i < NELEM(leaveAlone); i++) { if (token.CompareNoCase(leaveAlone[i]) == 0) { - //WMSG1(" Leaving alone '%ls'\n", (LPCWSTR) token); + //LOGI(" 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) { - WMSG2(" Setting '%ls' to '%ls'\n", token, justLikeThis[i]); + LOGI(" Setting '%ls' to '%ls'", 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) { - //WMSG1(" No leading cap for '%ls'\n", token); + //LOGI(" 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()) { - //WMSG1(" Looks like roman numerals '%ls'\n", token); + //LOGI(" Looks like roman numerals '%ls'", token); return; } @@ -820,12 +820,12 @@ InjectLowercase(CString* pStr) //*pStr = "AND PRODOS FOR THE IIGS"; //len = pStr->GetLength(); - //WMSG1("InjectLowercase: '%ls'\n", (LPCWSTR) *pStr); + //LOGI("InjectLowercase: '%ls'", (LPCWSTR) *pStr); for (int i = 0; i < len; i++) { WCHAR ch = pStr->GetAt(i); if (ch >= 'a' && ch <= 'z') { - WMSG1("Found lowercase 0x%04x, skipping InjectLower\n", ch); + LOGI("Found lowercase 0x%04x, skipping InjectLower", ch); return; } } @@ -885,7 +885,7 @@ MatchSemicolonList(const CString set, const CString match) if (wcsnicmp(cp, match, matchLen) == 0 && (cp[matchLen] == ';' || cp[matchLen] == '\0')) { - WMSG2("+++ Found '%ls' at '%ls'\n", (LPCWSTR) match, cp); + LOGI("+++ Found '%ls' at '%ls'", (LPCWSTR) match, cp); return true; } @@ -895,7 +895,7 @@ MatchSemicolonList(const CString set, const CString match) cp++; } - WMSG2("--- No match for '%ls' in '%ls'\n", (LPCWSTR) match, (LPCWSTR) set); + LOGI("--- No match for '%ls' in '%ls'", (LPCWSTR) match, (LPCWSTR) set); return false; } diff --git a/util/Util.h b/util/Util.h index 3c6234b..f79cefa 100644 --- a/util/Util.h +++ b/util/Util.h @@ -49,7 +49,7 @@ public: } virtual ~ExpandBuffer(void) { if (fWorkBuf != NULL) { - WMSG0("ExpandBuffer: fWorkBuf not seized; freeing\n"); + LOGI("ExpandBuffer: fWorkBuf not seized; freeing"); delete[] fWorkBuf; } }