Convert WSMG to LOG

Mostly a bulk conversion of debug messages, primarily with sed:

 sed -e 's/\(WMSG[0-9]\)\(.*\)\(\\n"\)/LOGI\2"/'

This removes the '\n' from the end of the log messages, and sets
them all to "info" severity.

We want to prefix each line with file/line and/or a timestamp,
so it doesn't make sense to have a partial line, and there's no
value in embedding the '\n' in every string.
This commit is contained in:
Andy McFadden 2014-11-18 13:05:15 -08:00
parent bf5e2bce50
commit f6647b9978
122 changed files with 2523 additions and 2528 deletions

View File

@ -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);

View File

@ -23,7 +23,7 @@ ActionProgressDialog::OnInitDialog(void)
{
CDialog::OnInitDialog();
WMSG1("Action is %d\n", fAction);
LOGI("Action is %d", fAction);
CenterWindow(AfxGetMainWnd());

View File

@ -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);

View File

@ -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());

View File

@ -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);

View File

@ -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++;

View File

@ -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;
}

View File

@ -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;

View File

@ -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);

View File

@ -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");
}
}
}

View File

@ -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";

View File

@ -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();
}

View File

@ -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

View File

@ -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();
}
}

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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;
}
}

View File

@ -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

View File

@ -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);

View File

@ -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;
}

View File

@ -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);

View File

@ -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);
}

View File

@ -31,7 +31,7 @@ public:
fOverwriteExisting = FALSE;
}
virtual ~ExtractOptionsDialog(void) {
//WMSG0("~ExtractOptionsDialog()\n");
//LOGI("~ExtractOptionsDialog()");
}
CString fExtractPath;

View File

@ -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<WCHAR*>(pExt) = '\0';
return;
}

View File

@ -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();
}
}

View File

@ -292,7 +292,7 @@ public:
//fEntryIndex = NULL;
}
virtual ~GenericArchive(void) {
//WMSG0("Deleting GenericArchive\n");
//LOGI("Deleting GenericArchive");
DeleteEntries();
delete fPathName;
}

View File

@ -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;

View File

@ -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("<happy-beep>\n");
LOGI("<happy-beep>");
::MessageBeep(MB_OK);
}
}
@ -2552,7 +2552,7 @@ MainWindow::FailureBeep(void)
const Preferences* pPreferences = GET_PREFERENCES();
if (pPreferences->GetPrefBool(kPrBeepOnSuccess)) {
WMSG0("<failure-beep>\n");
LOGI("<failure-beep>");
::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)

View File

@ -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;

View File

@ -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);
//}
/*

View File

@ -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;
}

View File

@ -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;

View File

@ -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, "<nufxlib> %hs\n",
pErrorMessage->file, pErrorMessage->line, "<nufxlib> %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);

View File

@ -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;

View File

@ -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, &reg,
sizeof(reg), &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);
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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:

View File

@ -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)

View File

@ -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 */

View File

@ -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();

View File

@ -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

View File

@ -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;
}

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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--)

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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:

View File

@ -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;
}

View File

@ -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;

View File

@ -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));

View File

@ -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
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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, "<no date>");
} 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;

View File

@ -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;

View File

@ -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
}

View File

@ -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
}

View File

@ -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;
/*

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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;

File diff suppressed because it is too large Load Diff

View File

@ -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;

View File

@ -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;
}

View File

@ -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("");
}

View File

@ -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;
}

View File

@ -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);
}
}
}

View File

@ -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
&reg, sizeof(reg),
&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
&reg, 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), &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, &reg,
sizeof(reg), &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, &reg,
sizeof(reg), &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,
&reg, 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,
&reg, 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,
&reg, 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();

View File

@ -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;

View File

@ -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

View File

@ -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, "<nufxlib> %hs\n",
pErrorMessage->file, pErrorMessage->line, "<nufxlib> %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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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 */
}

View File

@ -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) {

View File

@ -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) {

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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] =

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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:

View File

@ -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);
}
}

Some files were not shown because too many files have changed in this diff Show More