From 8ebb1dd9722aa51c557799c3d368c63d4ceaf488 Mon Sep 17 00:00:00 2001 From: Ryan Prichard Date: Tue, 30 Aug 2022 14:27:35 -0700 Subject: incfs: tolerate either ptrdiff_t or size_t for std::span The out-of-date std::span in external/libcxx currently uses ptrdiff_t as the type of size() and the second ctor argument. The C++20 std::span actually uses size_t for these values instead. Try to accommodate both versions of std::span until libc++ is upgraded. Bug: http://b/175635923 Test: treehugger Change-Id: Idc43f880b6eb21dad79e79fa456847d5865a1ed2 --- services/incremental/BinderIncrementalService.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'services/incremental/BinderIncrementalService.cpp') diff --git a/services/incremental/BinderIncrementalService.cpp b/services/incremental/BinderIncrementalService.cpp index 2f031bfe4f3f..45ca5cd84e39 100644 --- a/services/incremental/BinderIncrementalService.cpp +++ b/services/incremental/BinderIncrementalService.cpp @@ -216,7 +216,10 @@ static std::span toSpan(const ::std::optional<::std::vectordata(), (int)content->size()}; + // TODO(b/175635923): Replace with {content->data(), content->size()} after libc++ is upgraded. + // The type of the second std::span ctor param changed from ptrdiff_t to size_t between the old + // libc++ and the finalized C++20. + return std::span(content->data(), content->size()); } binder::Status BinderIncrementalService::makeFile( -- cgit v1.2.3-59-g8ed1b