git: 7d44e70bf6a7 - main - databases/tiledb: Fix build on i386

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Sun, 07 May 2023 16:12:56 UTC
The branch main has been updated by sunpoet:

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

commit 7d44e70bf6a7996f92b8b8deb92280f8b580612f
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2023-05-07 16:03:08 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2023-05-07 16:03:08 +0000

    databases/tiledb: Fix build on i386
    
    /wrkdirs/usr/ports/databases/tiledb/work/TileDB-2.15.2/tiledb/sm/fragment/fragment_metadata.cc:1721:18: error: non-constant-expression cannot be narrowed from type 'unsigned long long' to 'std::basic_string_view::size_type' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
        return {min, size};
                     ^~~~
    /wrkdirs/usr/ports/databases/tiledb/work/TileDB-2.15.2/tiledb/sm/fragment/fragment_metadata.cc:1721:18: note: insert an explicit cast to silence this issue
        return {min, size};
                     ^~~~
                     static_cast<size_type>( )
    /wrkdirs/usr/ports/databases/tiledb/work/TileDB-2.15.2/tiledb/sm/fragment/fragment_metadata.cc:1725:38: error: non-constant-expression cannot be narrowed from type 'uint64_t' (aka 'unsigned long long') to 'std::basic_string_view::size_type' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
        return {static_cast<char*>(min), size};
                                         ^~~~
    /wrkdirs/usr/ports/databases/tiledb/work/TileDB-2.15.2/tiledb/sm/fragment/fragment_metadata.cc:1725:38: note: insert an explicit cast to silence this issue
        return {static_cast<char*>(min), size};
                                         ^~~~
                                         static_cast<size_type>( )
    /wrkdirs/usr/ports/databases/tiledb/work/TileDB-2.15.2/tiledb/sm/fragment/fragment_metadata.cc:1794:18: error: non-constant-expression cannot be narrowed from type 'unsigned long long' to 'std::basic_string_view::size_type' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
        return {max, size};
                     ^~~~
    /wrkdirs/usr/ports/databases/tiledb/work/TileDB-2.15.2/tiledb/sm/fragment/fragment_metadata.cc:1794:18: note: insert an explicit cast to silence this issue
        return {max, size};
                     ^~~~
                     static_cast<size_type>( )
    /wrkdirs/usr/ports/databases/tiledb/work/TileDB-2.15.2/tiledb/sm/fragment/fragment_metadata.cc:1798:38: error: non-constant-expression cannot be narrowed from type 'uint64_t' (aka 'unsigned long long') to 'std::basic_string_view::size_type' (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
        return {static_cast<char*>(max), size};
                                         ^~~~
    /wrkdirs/usr/ports/databases/tiledb/work/TileDB-2.15.2/tiledb/sm/fragment/fragment_metadata.cc:1798:38: note: insert an explicit cast to silence this issue
        return {static_cast<char*>(max), size};
                                         ^~~~
                                         static_cast<size_type>( )
    4 errors generated.
    
    Reference:      https://pkg-status.freebsd.org/beefy17/data/main-i386-default/pdf5b273c8e36_s83d5725005/logs/tiledb-2.15.2.log
---
 .../patch-tiledb-sm-fragment-fragment_metadata.cc  | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/databases/tiledb/files/patch-tiledb-sm-fragment-fragment_metadata.cc b/databases/tiledb/files/patch-tiledb-sm-fragment-fragment_metadata.cc
new file mode 100644
index 000000000000..390321055ebe
--- /dev/null
+++ b/databases/tiledb/files/patch-tiledb-sm-fragment-fragment_metadata.cc
@@ -0,0 +1,30 @@
+--- tiledb/sm/fragment/fragment_metadata.cc.orig	2023-04-26 01:28:54 UTC
++++ tiledb/sm/fragment/fragment_metadata.cc
+@@ -1718,11 +1718,11 @@ std::string_view FragmentMetadata::get_tile_min_as<std
+                     tile_min_var_buffer_[idx].size() - min_offset :
+                     offsets[tile_idx + 1] - min_offset;
+     char* min = &tile_min_var_buffer_[idx][min_offset];
+-    return {min, size};
++    return {min, (std::size_t) size};
+   } else {
+     auto size = array_schema_->cell_size(name);
+     void* min = &tile_min_buffer_[idx][tile_idx * size];
+-    return {static_cast<char*>(min), size};
++    return {static_cast<char*>(min), (std::size_t) size};
+   }
+ }
+ 
+@@ -1791,11 +1791,11 @@ std::string_view FragmentMetadata::get_tile_max_as<std
+                     tile_max_var_buffer_[idx].size() - max_offset :
+                     offsets[tile_idx + 1] - max_offset;
+     char* max = &tile_max_var_buffer_[idx][max_offset];
+-    return {max, size};
++    return {max, (std::size_t) size};
+   } else {
+     auto size = array_schema_->cell_size(name);
+     void* max = &tile_max_buffer_[idx][tile_idx * size];
+-    return {static_cast<char*>(max), size};
++    return {static_cast<char*>(max), (std::size_t) size};
+   }
+ }
+