Fix some static analyzer quibbles

This commit is contained in:
Andy McFadden 2014-12-02 17:55:19 -08:00
parent b2cd857031
commit 2f136fd5ab
6 changed files with 14 additions and 10 deletions

View File

@ -333,7 +333,7 @@ void DiskFSFAT::CreateFakeFile(void)
capacity = fTotalBlocks;
memset(buf, 0, sizeof(buf));
snprintf(buf, NELEM(buf), kFormatMsg,
snprintf(buf, NELEM(buf)-1, kFormatMsg,
fVolumeName,
capacity,
(double) capacity / 2048.0);

View File

@ -228,7 +228,7 @@ void MainWindow::ScanFiles(void)
time_t now;
now = time(NULL);
fprintf(scanOpts.outfp,
"Run started at %.24hs in '%ls'\n\n", ctime(&now), newDir);
"Run started at %.24hs in '%ls'\n\n", ctime(&now), (LPCWSTR) newDir);
/* obstruct input to the main window */
EnableWindow(FALSE);

View File

@ -128,15 +128,15 @@ void ReformatDirectory::PrintDirEntries(const uint8_t* srcBuf,
else if (pDirEntry[0x10] == 0x04) // txt
auxTypeStr.Format("R=%5d", auxType);
BufPrintf("%c%-15s %-3s %6d %16s %16s %8d %s\r\n",
BufPrintf("%c%-15s %-3ls %6d %16s %16s %8d %s\r\n",
lockedFlag,
fileName,
PathProposal::FileTypeString(pDirEntry[0x10]),
pDirEntry[0x13] | pDirEntry[0x14] << 8,
modStr,
createStr,
(LPCSTR) modStr,
(LPCSTR) createStr,
pDirEntry[0x15] | pDirEntry[0x16] << 8 | pDirEntry[0x17] << 16,
auxTypeStr);
(LPCSTR) auxTypeStr);
}
}
}

View File

@ -874,7 +874,7 @@ bool ReformatDisasm16::OutputOMF(const uint8_t* srcBuf, long srcLen,
int segmentNumber = 1;
BufPrintf(";\r\n");
BufPrintf("; OMF segment summary:\r\n", segmentNumber);
BufPrintf("; OMF segment summary:\r\n");
BufPrintf(";\r\n");
/* pass #1: print a preview */

View File

@ -52,6 +52,10 @@ void SelectFilesDialog2::OnFolderChange()
LOGW("Can't get folder ID list, len is %d", len);
} else {
LPCITEMIDLIST pidlFolder = (LPCITEMIDLIST) CoTaskMemAlloc(len);
if (pidlFolder == NULL) {
LOGE("Unable to allocate %d bytes", len);
return;
}
len = pParent->SendMessage(CDM_GETFOLDERIDLIST, len,
(LPARAM) pidlFolder);
ASSERT(len > 0); // should fail earlier, or not at all
@ -426,7 +430,7 @@ int SelectFilesDialog2::ParseFileNames(const CString& str)
ASSERT(pSFD != NULL);
return pSFD->HandleHelp(hDlg, (LPHELPINFO) lParam);
default:
LOGV("OFNHookProc: hDlg=0x%08lx uiMsg=0x%08lx "
LOGV("OFNHookProc: hDlg=0x%p uiMsg=0x%08lx "
"wParam=0x%08lx lParam=0x%08lx",
hDlg, uiMsg, wParam, lParam);
break;

View File

@ -656,7 +656,7 @@ static void DowncaseSubstring(CString* pStr, int startPos, int endPos,
if (prevWasSpace) {
for (i = 0; i < NELEM(shortWords); i++) {
if (token.CompareNoCase(shortWords[i]) == 0) {
LOGV(" No leading cap for '%ls'", token);
LOGV(" No leading cap for '%ls'", (LPCWSTR) token);
firstCap = false;
break;
}
@ -666,7 +666,7 @@ static void DowncaseSubstring(CString* pStr, int startPos, int endPos,
/* check for roman numerals; we leave those capitalized */
CString romanTest = token.SpanIncluding(L"IVX");
if (romanTest.GetLength() == token.GetLength()) {
LOGV(" Looks like roman numerals '%ls'", token);
LOGV(" Looks like roman numerals '%ls'", (LPCWSTR) token);
return;
}