git: b37ebe5a89a3 - main - devel/libdap: Fix build with Clang 13+

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Mon, 11 Jul 2022 13:52:59 UTC
The branch main has been updated by sunpoet:

URL: https://cgit.FreeBSD.org/ports/commit/?id=b37ebe5a89a33125910ddcdce34c31f0d700b2b5

commit b37ebe5a89a33125910ddcdce34c31f0d700b2b5
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2022-07-11 13:49:19 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2022-07-11 13:49:19 +0000

    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(+)

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<size_t>(line_buf_len, strnlen(line, line_buf_len))-1] = '\0'; // erase newline
+         headers.push_back(string(line));
+     }
+