diff --git a/app/ContentList.cpp b/app/ContentList.cpp index 5876546..cf7dcd8 100644 --- a/app/ContentList.cpp +++ b/app/ContentList.cpp @@ -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 diff --git a/app/DiskArchive.cpp b/app/DiskArchive.cpp index d8a1b6e..fcbaf01 100644 --- a/app/DiskArchive.cpp +++ b/app/DiskArchive.cpp @@ -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; } diff --git a/app/RenameEntryDialog.cpp b/app/RenameEntryDialog.cpp index 9a26331..21423c6 100644 --- a/app/RenameEntryDialog.cpp +++ b/app/RenameEntryDialog.cpp @@ -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; diff --git a/diskimg/diskimg.vcxproj b/diskimg/diskimg.vcxproj index 914fe16..49a6579 100644 --- a/diskimg/diskimg.vcxproj +++ b/diskimg/diskimg.vcxproj @@ -72,7 +72,7 @@ true - ..\prebuilt\nufxlib2.lib;..\prebuilt\zdll.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + %(AdditionalDependencies) $(OutDir)$(TargetName)$(TargetExt) false $(OutDir)$(TargetName).pdb diff --git a/util/MyDebug.cpp b/util/MyDebug.cpp index 39b16ba..287040d 100644 --- a/util/MyDebug.cpp +++ b/util/MyDebug.cpp @@ -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) { - if (_CrtDbgReport(_CRT_WARN, file, line, NULL, "%s\n", textBuf) == 1) { - // "retry" button causes a debugger break - _CrtDbgBreak(); - } +#ifdef _DEBUG + if (_CrtDbgReport(_CRT_WARN, file, line, NULL, "%s\n", textBuf) == 1) { + // "retry" button causes a debugger break + _CrtDbgBreak(); } +#endif } diff --git a/util/MyDebug.h b/util/MyDebug.h index e744d1c..c0080f7 100644 --- a/util/MyDebug.h +++ b/util/MyDebug.h @@ -50,7 +50,6 @@ private: FILE* fLogFp; int fPid; - bool fDoCrtDebug; }; extern DebugLog* gDebugLog; // declare and allocate in app