From 41a29ac623101618aaf358ab17ac1b7fdc1feffe Mon Sep 17 00:00:00 2001 From: OSAMU WATANABE Date: Thu, 13 Jun 2024 18:38:10 +0900 Subject: [PATCH] Fix CMakeLists.txt and image_class.hpp --- CMakeLists.txt | 6 +++--- source/apps/imgcmp/image_class.hpp | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b71523..b3de7a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,9 @@ else() endif() enable_language(CXX) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + ############################################################ # Parse version file # credit: https://stackoverflow.com/a/47084079 and OpenJPH project https://github.com/aous72/OpenJPH @@ -185,9 +188,6 @@ endif() # add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/source/thirdparty/highway # EXCLUDE_FROM_ALL) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) - # INSTALL related settings set(CMAKE_SKIP_BUILD_RPATH FALSE) set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) diff --git a/source/apps/imgcmp/image_class.hpp b/source/apps/imgcmp/image_class.hpp index 2df8d16..c4e71ea 100644 --- a/source/apps/imgcmp/image_class.hpp +++ b/source/apps/imgcmp/image_class.hpp @@ -112,6 +112,7 @@ class image { int read_pnmpgx(const char *name) { constexpr char SP = ' '; constexpr char LF = '\n'; + constexpr char CR = 13; FILE *fp = fopen(name, "rb"); if (fp == nullptr) { @@ -222,7 +223,7 @@ class image { } } // read numerical value - while (c != SP && c != LF) { + while (c != SP && c != LF && c != CR) { val *= 10; val += c - '0'; c = fgetc(fp);