From b37ebe5a89a33125910ddcdce34c31f0d700b2b5 Mon Sep 17 00:00:00 2001 From: Po-Chuan Hsieh Date: Mon, 11 Jul 2022 21:49:19 +0800 Subject: devel/libdap: Fix build with Clang 13+ HTTPCache.cc:1034:14: error: no matching function for call to 'min' line[min(line_buf_len, strnlen(line, line_buf_len))-1] = '\0'; // erase newline ^~~ /usr/include/c++/v1/__algorithm/min.h:40:1: note: candidate template ignored: deduced conflicting types for parameter '_Tp' ('unsigned long' vs. 'size_t' (aka 'unsigned int')) min(const _Tp& __a, const _Tp& __b) ^ /usr/include/c++/v1/__algorithm/min.h:51:1: note: candidate template ignored: could not match 'initializer_list<_Tp>' against 'unsigned long' min(initializer_list<_Tp> __t, _Compare __comp) ^ /usr/include/c++/v1/__algorithm/min.h:61:1: note: candidate function template not viable: requires single argument '__t', but 2 arguments were provided min(initializer_list<_Tp> __t) ^ /usr/include/c++/v1/__algorithm/min.h:31:1: note: candidate function template not viable: requires 3 arguments, but 2 were provided min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ 1 error generated. Reported by: pkg-fallout --- devel/libdap/files/patch-HTTPCache.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 devel/libdap/files/patch-HTTPCache.cc diff --git a/devel/libdap/files/patch-HTTPCache.cc b/devel/libdap/files/patch-HTTPCache.cc new file mode 100644 index 000000000000..25ab6db3b000 --- /dev/null +++ b/devel/libdap/files/patch-HTTPCache.cc @@ -0,0 +1,11 @@ +--- HTTPCache.cc.orig 2022-03-16 11:02:01 UTC ++++ HTTPCache.cc +@@ -1031,7 +1031,7 @@ HTTPCache::read_metadata(const string &cachename, vect + const unsigned long line_buf_len = 1024; + char line[line_buf_len]; + while (!feof(md) && fgets(line, line_buf_len, md)) { +- line[min(line_buf_len, strnlen(line, line_buf_len))-1] = '\0'; // erase newline ++ line[min(line_buf_len, strnlen(line, line_buf_len))-1] = '\0'; // erase newline + headers.push_back(string(line)); + } + -- cgit v1.2.3