From be476f9a9cb8188916e34e21014c5d131cd04b8d Mon Sep 17 00:00:00 2001 From: Andrea Odetti Date: Sat, 7 Sep 2019 18:51:07 +0100 Subject: [PATCH] Fix a couple of issues around std::string. Signed-off-by: Andrea Odetti --- source/Applewin.cpp | 2 +- source/Debugger/Debug.cpp | 2 +- source/DiskImage.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/Applewin.cpp b/source/Applewin.cpp index 0937b330..08186357 100644 --- a/source/Applewin.cpp +++ b/source/Applewin.cpp @@ -483,7 +483,7 @@ void GetProgramDirectory(void) { if ((g_sProgramDir[loop] == TEXT('\\')) || (g_sProgramDir[loop] == TEXT(':'))) { - g_sProgramDir.resize(loop); // this reduces the size + g_sProgramDir.resize(loop + 1); // this reduces the size break; } } diff --git a/source/Debugger/Debug.cpp b/source/Debugger/Debug.cpp index 6ef443a9..c5ddc306 100644 --- a/source/Debugger/Debug.cpp +++ b/source/Debugger/Debug.cpp @@ -2024,7 +2024,7 @@ Update_t CmdTraceFile (int nArgs) } else { - std::string sFileName;; + std::string sFileName; if (nArgs) sFileName = g_aArgs[1].sArg; diff --git a/source/DiskImage.cpp b/source/DiskImage.cpp index e47a42a2..bc286b3e 100644 --- a/source/DiskImage.cpp +++ b/source/DiskImage.cpp @@ -49,7 +49,7 @@ ImageError_e ImageOpen( const std::string & pszImageFilename, if (bExpectFloppy && sg_DiskImageHelper.GetWorkBuffer() == NULL) return eIMAGE_ERROR_BAD_POINTER; - if (! (ppImageInfo && pWriteProtected)) + if (!(!pszImageFilename.empty() && ppImageInfo && pWriteProtected)) return eIMAGE_ERROR_BAD_POINTER; // CREATE A RECORD FOR THE FILE