Minor fixes

Fix release build.

Eliminate a few warnings.
This commit is contained in:
Andy McFadden 2014-11-18 14:30:51 -08:00
parent f6647b9978
commit 9a67e7b1d3
6 changed files with 29 additions and 19 deletions

View File

@ -448,7 +448,7 @@ ContentList::MakeMacTypeString(unsigned long val, WCHAR* buf)
/* sanitize */
while (*buf != '\0') {
*buf = DiskImg::MacToASCII(*buf);
*buf = DiskImg::MacToASCII((unsigned char)*buf);
buf++;
}
}
@ -536,7 +536,7 @@ ContentList::OnGetDispInfo(NMHDR* pnmh, LRESULT* pResult)
switch (plvdi->item.iSubItem) {
case 0: // pathname
if (wcslen(pEntry->GetDisplayName()) > plvdi->item.cchTextMax) {
if ((int) wcslen(pEntry->GetDisplayName()) > plvdi->item.cchTextMax) {
// looks like current limit is 264 chars, which we could hit
wcsncpy(plvdi->item.pszText, pEntry->GetDisplayName(),
plvdi->item.cchTextMax);
@ -640,6 +640,16 @@ CompareLONGLONG(LONGLONG u1, LONGLONG u2)
else
return 0;
}
static inline int
CompareTime(time_t t1, time_t t2)
{
if (t1 < t2)
return -1;
else if (t1 > t2)
return 1;
else
return 0;
}
/*
* Static comparison function for list sorting.
@ -687,7 +697,7 @@ ContentList::CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
}
break;
case 3: // mod date
result = CompareUnsignedLong(pEntry1->GetModWhen(),
result = CompareTime(pEntry1->GetModWhen(),
pEntry2->GetModWhen());
break;
case 4: // format

View File

@ -2612,7 +2612,8 @@ DiskArchive::TestPathName(const GenericEntry* pGenericEntry,
{
const DiskEntry* pEntry = (DiskEntry*) pGenericEntry;
DiskImg::FSFormat format;
CStringA pathName, errMsg, newNameA;
CString errMsg, pathName;
CStringA newNameA;
DiskFS* pDiskFS;
if (basePath.IsEmpty()) {
@ -2631,7 +2632,7 @@ DiskArchive::TestPathName(const GenericEntry* pGenericEntry,
CStringA pathNameA(pathName);
existingFile = pDiskFS->GetFileByName(pathNameA);
if (existingFile != NULL && existingFile != pEntry->GetA2File()) {
errMsg = "A file with that name already exists.";
errMsg = L"A file with that name already exists.";
goto bail;
}

View File

@ -93,7 +93,7 @@ RenameEntryDialog::DoDataExchange(CDataExchange* pDX)
if (fFssepStr.IsEmpty())
fFssep = '\0';
else
fFssep = fFssepStr.GetAt(0); // could be '\0', that's okay
fFssep = (char) fFssepStr.GetAt(0); // could be '\0', that's okay
}
return;

View File

@ -72,7 +72,7 @@
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<AdditionalDependencies>..\prebuilt\nufxlib2.lib;..\prebuilt\zdll.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
<SuppressStartupBanner>false</SuppressStartupBanner>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>

View File

@ -12,11 +12,6 @@ DebugLog::DebugLog(const WCHAR* logFile)
: fLogFp(NULL)
{
fPid = getpid();
#ifdef _DEBUG
fDoCrtDebug = true;
#else
fDoCrtDebug = false;
#endif
if (logFile == NULL) {
return;
@ -33,8 +28,10 @@ DebugLog::DebugLog(const WCHAR* logFile)
}
fLogFp = _wfopen(logFile, L"a");
if (fLogFp == NULL) {
#ifdef _DEBUG
_CrtDbgReport(_CRT_WARN, __FILE__, __LINE__, NULL,
"Unable to open %ls: %d\n", logFile, errno);
#endif
} else {
// disable buffering so we don't lose anything if app crashes
setvbuf(fLogFp, NULL, _IONBF, 0);
@ -57,9 +54,12 @@ DebugLog::~DebugLog() {
void DebugLog::Log(LogSeverity severity, const char* file, int line,
const char* format, ...)
{
if (fLogFp == NULL && !fDoCrtDebug) {
#ifndef _DEBUG
if (fLogFp == NULL) {
// nothing to do, don't waste time formatting the string
return;
}
#endif
static const char kSeverityChars[] = "?VDIWE";
if (severity < 0 || severity > sizeof(kSeverityChars) - 1) {
@ -84,10 +84,10 @@ void DebugLog::Log(LogSeverity severity, const char* file, int line,
tmbuf.tm_min, tmbuf.tm_sec, kSeverityChars[severity],
textBuf);
}
if (fDoCrtDebug) {
#ifdef _DEBUG
if (_CrtDbgReport(_CRT_WARN, file, line, NULL, "%s\n", textBuf) == 1) {
// "retry" button causes a debugger break
_CrtDbgBreak();
}
}
#endif
}

View File

@ -50,7 +50,6 @@ private:
FILE* fLogFp;
int fPid;
bool fDoCrtDebug;
};
extern DebugLog* gDebugLog; // declare and allocate in app