Skip to content

Commit

Permalink
devel/libdap: Fix build with Clang 13+
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sunpoet committed Jul 11, 2022
1 parent 1723e3e commit b37ebe5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions 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));
}

0 comments on commit b37ebe5

Please sign in to comment.