From 0375131677cc32a24352f205d05c730690c55af6 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Fri, 8 Oct 2021 09:13:13 +0900 Subject: Imported Upstream version 3.10.3 --- Source/CMakeVersion.cmake | 2 +- Source/CursesDialog/cmCursesMainForm.cxx | 2 +- Source/cmQtAutoGenerators.cxx | 20 +++++++++++++------- 3 files changed, 15 insertions(+), 9 deletions(-) (limited to 'Source') diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index c262bddee..9367e480f 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 10) -set(CMake_VERSION_PATCH 2) +set(CMake_VERSION_PATCH 3) #set(CMake_VERSION_RC 0) diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index dbd024da6..4a9dc473c 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -475,7 +475,7 @@ void cmCursesMainForm::UpdateStatusBar(const char* message) strncpy(bar + curFieldLen + 2, help, width - curFieldLen - 2); if (curFieldLen + helpLen + 2 < width) { memset(bar + curFieldLen + helpLen + 2, ' ', - width - curFieldLen + helpLen + 2); + width - (curFieldLen + helpLen + 2)); } } } diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index a9c9b9d36..f91ebb23e 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -80,15 +80,21 @@ static bool ReadFile(std::string& content, std::string const& filename, std::size_t const length = cmSystemTools::FileLength(filename); cmsys::ifstream ifs(filename.c_str(), (std::ios::in | std::ios::binary)); if (ifs) { - content.resize(length); - ifs.read(&content.front(), content.size()); - if (ifs) { - success = true; + if (length > 0) { + content.resize(length); + ifs.read(&content.front(), content.size()); + if (ifs) { + success = true; + } else { + content.clear(); + if (error != nullptr) { + error->append("Reading from the file failed."); + } + } } else { + // Readable but empty file content.clear(); - if (error != nullptr) { - error->append("Reading from the file failed."); - } + success = true; } } else if (error != nullptr) { error->append("Opening the file for reading failed."); -- cgit v1.2.3