From 360228eabfed55c68869bf984ef33b08e33a941c Mon Sep 17 00:00:00 2001 From: Erik Partridge Date: Tue, 26 Jun 2018 03:40:12 -0400 Subject: [PATCH 1/4] Fix the std::transform bug (#56) https://stackoverflow.com/questions/16792456/no-matching-function-for-call-to-transform This is a fix for using toupper and tolower with std::transform --- src/inja.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/inja.hpp b/src/inja.hpp index 518246a..c5705d9 100644 --- a/src/inja.hpp +++ b/src/inja.hpp @@ -396,12 +396,12 @@ public: switch (element.function) { case Parsed::Function::Upper: { std::string str = eval_expression(element.args[0], data); - std::transform(str.begin(), str.end(), str.begin(), toupper); + std::transform(str.begin(), str.end(), str.begin(), ::toupper); return str; } case Parsed::Function::Lower: { std::string str = eval_expression(element.args[0], data); - std::transform(str.begin(), str.end(), str.begin(), tolower); + std::transform(str.begin(), str.end(), str.begin(), ::tolower); return str; } case Parsed::Function::Range: { From a06207b64bce162837946e41796e8658364f539d Mon Sep 17 00:00:00 2001 From: Tian Jin Date: Wed, 25 Jul 2018 01:44:54 -0400 Subject: [PATCH 2/4] Update CMakeLists.txt (#58) --- test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 862ca41..fcb93d4 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -56,7 +56,7 @@ endif() add_custom_command( TARGET ${UNITTEST_TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory - ${CMAKE_SOURCE_DIR}/test/data + ${CMAKE_CURRENT_SOURCE_DIR}/test/data ${CMAKE_CURRENT_BINARY_DIR}/data ) ## From 4eaeb2b1820d5399fe706bc7f756c428bf6e2706 Mon Sep 17 00:00:00 2001 From: Tian Jin Date: Fri, 27 Jul 2018 07:35:47 -0400 Subject: [PATCH 3/4] Update CMakeLists.txt (#59) --- test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index fcb93d4..3e7ba91 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -56,7 +56,7 @@ endif() add_custom_command( TARGET ${UNITTEST_TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory - ${CMAKE_CURRENT_SOURCE_DIR}/test/data + ${CMAKE_CURRENT_SOURCE_DIR}/data ${CMAKE_CURRENT_BINARY_DIR}/data ) ## From 6afdf700cba636550ac8014b414f213c53af8470 Mon Sep 17 00:00:00 2001 From: pantor Date: Thu, 9 Aug 2018 12:41:56 +0200 Subject: [PATCH 4/4] Fix division by zero warning (#61) --- src/inja.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/inja.hpp b/src/inja.hpp index c5705d9..df9ccad 100644 --- a/src/inja.hpp +++ b/src/inja.hpp @@ -435,7 +435,7 @@ public: case Parsed::Function::DivisibleBy: { const int number = eval_expression(element.args[0], data); const int divisor = eval_expression(element.args[1], data); - return (number % divisor == 0); + return (divisor != 0) && (number % divisor == 0); } case Parsed::Function::Odd: { const int number = eval_expression(element.args[0], data);