From 4872ba6569b27cb18f393c79272e62df41a51f80 Mon Sep 17 00:00:00 2001 From: Christian Blichmann Date: Thu, 9 Jun 2022 02:03:19 -0700 Subject: [PATCH] libraw: Fix left-over from cleanup Our internal builds do not build the `contrib/` sandboxes, so I didn't notice the failing libraw build :-/ PiperOrigin-RevId: 453868469 Change-Id: Ic084b066197ace6f52c3e7ed541a811c501d20b1 --- contrib/libraw/CMakeLists.txt | 2 +- contrib/libraw/example/CMakeLists.txt | 3 ++- contrib/libraw/test/CMakeLists.txt | 3 ++- contrib/libraw/utils/utils_libraw.cc | 8 ++++---- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/contrib/libraw/CMakeLists.txt b/contrib/libraw/CMakeLists.txt index 63aae6e..d7cc84a 100644 --- a/contrib/libraw/CMakeLists.txt +++ b/contrib/libraw/CMakeLists.txt @@ -28,7 +28,7 @@ if (NOT TARGET sapi::sapi) EXCLUDE_FROM_ALL) endif() -FetchContent_Declare( libraw +FetchContent_Declare(libraw GIT_REPOSITORY https://github.com/LibRaw/LibRaw.git GIT_TAG a077aac05190530f22af4254a1e31745876d007f # 2022-06-03 ) diff --git a/contrib/libraw/example/CMakeLists.txt b/contrib/libraw/example/CMakeLists.txt index eed3c6c..35cebbb 100644 --- a/contrib/libraw/example/CMakeLists.txt +++ b/contrib/libraw/example/CMakeLists.txt @@ -17,7 +17,8 @@ add_executable(sapi_minilibraw ../utils/utils_libraw.cc ) target_link_libraries(sapi_minilibraw - PRIVATE sapi_libraw + PRIVATE absl::strings + sapi_contrib::libraw sapi::logging sapi::sapi ) diff --git a/contrib/libraw/test/CMakeLists.txt b/contrib/libraw/test/CMakeLists.txt index d9bb61f..d37a8b4 100644 --- a/contrib/libraw/test/CMakeLists.txt +++ b/contrib/libraw/test/CMakeLists.txt @@ -17,7 +17,8 @@ add_executable(sapi_libraw_test ../utils/utils_libraw.cc ) target_link_libraries(sapi_libraw_test PRIVATE - sapi_libraw + absl::strings + sapi_contrib::libraw sapi::test_main sapi::temp_file ) diff --git a/contrib/libraw/utils/utils_libraw.cc b/contrib/libraw/utils/utils_libraw.cc index 756b376..7597f39 100644 --- a/contrib/libraw/utils/utils_libraw.cc +++ b/contrib/libraw/utils/utils_libraw.cc @@ -14,6 +14,7 @@ #include "contrib/libraw/utils/utils_libraw.h" +#include "absl/strings/str_cat.h" #include "contrib/libraw/sandboxed.h" absl::Status LibRaw::InitLibRaw() { @@ -124,10 +125,9 @@ absl::StatusOr LibRaw::GetRawWidth() { absl::StatusOr LibRaw::GetCBlack(int channel) { SAPI_RETURN_IF_ERROR(CheckIsInit()); - if (channel < 0 || >= LIBRAW_CBLACK_SIZE) { - return absl::OutOfRangeError(absl::string_view( - std::to_string(channel) + " is out of range for array with size " + - std::to_string(LIBRAW_CBLACK_SIZE))); + if (channel < 0 || channel >= LIBRAW_CBLACK_SIZE) { + return absl::OutOfRangeError(absl::StrCat( + channel, " is out of range for array with size ", LIBRAW_CBLACK_SIZE)); } return GetImgData().color.cblack[channel];