You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ab...@apache.org on 2020/09/14 10:42:37 UTC
[nifi-minifi-cpp] 02/07: MINIFICPP-1341 Fix libc++ compilation
errors
This is an automated email from the ASF dual-hosted git repository.
aboda pushed a commit to branch MINIFICPP-1348-RC1
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git
commit 5322b3ad79d8c3de9c2a8f7a7fb5a6e167808cdc
Author: Ferenc Gerlits <fg...@gmail.com>
AuthorDate: Thu Sep 3 18:46:06 2020 +0200
MINIFICPP-1341 Fix libc++ compilation errors
In libc++ milliseconds::rep is long long, unlike in libstdc++ where it is long.
Although these are both signed 64-bit numbers, they are different types,
and some code in minifi is not able to handle long long.
Signed-off-by: Marton Szasz <sz...@gmail.com>
Co-authored-by: Márton Szász <sz...@gmail.com>
---
extensions/expression-language/Expression.cpp | 4 +++-
extensions/standard-processors/processors/TailFile.cpp | 9 ++++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/extensions/expression-language/Expression.cpp b/extensions/expression-language/Expression.cpp
index f20ba95..1cb218f 100644
--- a/extensions/expression-language/Expression.cpp
+++ b/extensions/expression-language/Expression.cpp
@@ -632,7 +632,9 @@ Value expr_toDate(const std::vector<Value> &args) {
#endif // EXPRESSION_LANGUAGE_USE_DATE
Value expr_now(const std::vector<Value> &args) {
- return Value(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count());
+ using namespace std::chrono;
+ int64_t unix_time_ms{duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count()};
+ return Value(unix_time_ms);
}
Value expr_unescapeCsv(const std::vector<Value> &args) {
diff --git a/extensions/standard-processors/processors/TailFile.cpp b/extensions/standard-processors/processors/TailFile.cpp
index 913fb59..efa7549 100644
--- a/extensions/standard-processors/processors/TailFile.cpp
+++ b/extensions/standard-processors/processors/TailFile.cpp
@@ -364,7 +364,14 @@ void TailFile::onSchedule(const std::shared_ptr<core::ProcessContext> &context,
context->getProperty(RecursiveLookup.getName(), recursive_lookup_);
- context->getProperty(LookupFrequency.getName(), lookup_frequency_);
+ // NOTE:
+ // context->getProperty(LookupFrequency.getName(), lookup_frequency_);
+ // is incorrect, as std::chrono::milliseconds::rep is unspecified, and may not be supported by getProperty()
+ // (e.g. in clang/libc++, this underlying type is long long)
+ int64_t lookup_frequency;
+ if (context->getProperty(LookupFrequency.getName(), lookup_frequency)) {
+ lookup_frequency_ = std::chrono::milliseconds{lookup_frequency};
+ }
recoverState(context);