From 316828a21915dbf1e3b276da8aabb195dcb4c7ae Mon Sep 17 00:00:00 2001 From: Alexandra Latysheva Date: Mon, 19 Oct 2020 10:36:47 +0000 Subject: [PATCH] auto& -> const auto&; bool status -> bool status_ok --- .../libtiff/example/main_sandboxed.cc | 14 +++++++------- oss-internship-2020/libtiff/test/long_tag.cc | 4 ++-- oss-internship-2020/libtiff/test/short_tag.cc | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/oss-internship-2020/libtiff/example/main_sandboxed.cc b/oss-internship-2020/libtiff/example/main_sandboxed.cc index 0dec1ff..5ab32cc 100644 --- a/oss-internship-2020/libtiff/example/main_sandboxed.cc +++ b/oss-internship-2020/libtiff/example/main_sandboxed.cc @@ -171,8 +171,8 @@ absl::Status LibTIFFMain(const std::string& srcfile) { TiffSapiSandbox sandbox(srcfile); - bool pixel_status = true; - bool cluster_status = true; + bool pixel_status_ok = true; + bool cluster_status_ok = true; // initialize sapi vars after constructing TiffSapiSandbox sapi::v::UShort h; sapi::v::UShort v; @@ -226,10 +226,10 @@ absl::Status LibTIFFMain(const std::string& srcfile) { if (status = CheckCluster(id, buffer_, data); !status.ok()) { LOG(ERROR) << "CheckCluster failed:\n" << status.ToString(); } - cluster_status &= status.ok(); + cluster_status_ok &= status.ok(); } - if (!cluster_status) { + if (!cluster_status_ok) { return absl::InternalError("One or more clusters failed the check"); } @@ -262,7 +262,7 @@ absl::Status LibTIFFMain(const std::string& srcfile) { if (status = CheckRgbPixel(id, data, buffer2_); !status.ok()) { LOG(ERROR) << "CheckRgbPixel failed:\n" << status.ToString(); } - pixel_status &= status.ok(); + pixel_status_ok &= status.ok(); } SAPI_RETURN_IF_ERROR(api.TIFFClose(&tif)); @@ -290,12 +290,12 @@ absl::Status LibTIFFMain(const std::string& srcfile) { if (status = CheckRgbaPixel(id, data, rgba_buffer_); !status.ok()) { LOG(ERROR) << "CheckRgbaPixel failed:\n" << status.ToString(); } - pixel_status &= status.ok(); + pixel_status_ok &= status.ok(); } SAPI_RETURN_IF_ERROR(api.TIFFClose(&tif2)); - if (!pixel_status) { + if (!pixel_status_ok) { return absl::InternalError("wrong encoding"); } diff --git a/oss-internship-2020/libtiff/test/long_tag.cc b/oss-internship-2020/libtiff/test/long_tag.cc index fc1b644..1c7d75d 100644 --- a/oss-internship-2020/libtiff/test/long_tag.cc +++ b/oss-internship-2020/libtiff/test/long_tag.cc @@ -101,7 +101,7 @@ TEST(SandboxTest, LongTag) { EXPECT_THAT(status_or_int.value(), IsTrue()) << "Can't set PhotometricInterpretation tag"; - for (auto& tag : kLongTags) { + for (const auto& tag : kLongTags) { status_or_int = api.TIFFSetFieldU1(&tif, tag.tag, tag.value); ASSERT_THAT(status_or_int, IsOk()) << "TIFFSetFieldUShort1 fatal error"; EXPECT_THAT(status_or_int.value(), IsTrue()) << "Can't set tag " << tag.tag; @@ -125,7 +125,7 @@ TEST(SandboxTest, LongTag) { CheckLongField(api, tif2, TIFFTAG_IMAGELENGTH, kLength); CheckLongField(api, tif2, TIFFTAG_ROWSPERSTRIP, kRowsPerStrip); - for (auto& tag : kLongTags) { + for (const auto& tag : kLongTags) { CheckLongField(api, tif2, tag.tag, tag.value); } diff --git a/oss-internship-2020/libtiff/test/short_tag.cc b/oss-internship-2020/libtiff/test/short_tag.cc index 5620ec5..7f1c0d6 100644 --- a/oss-internship-2020/libtiff/test/short_tag.cc +++ b/oss-internship-2020/libtiff/test/short_tag.cc @@ -123,13 +123,13 @@ TEST(SandboxTest, ShortTag) { EXPECT_THAT(status_or_int.value(), IsTrue()) << "Can't set PhotometricInterpretation tag"; - for (auto& tag : kShortSingleTags) { + for (const auto& tag : kShortSingleTags) { status_or_int = api.TIFFSetFieldUShort1(&tif, tag.tag, tag.value); ASSERT_THAT(status_or_int, IsOk()) << "TIFFSetFieldUShort1 fatal error"; EXPECT_THAT(status_or_int.value(), IsTrue()) << "Can't set tag " << tag.tag; } - for (auto& tag : kShortPairedTags) { + for (const auto& tag : kShortPairedTags) { status_or_int = api.TIFFSetFieldUShort2(&tif, tag.tag, tag.values[0], tag.values[1]); ASSERT_THAT(status_or_int, IsOk()) << "TIFFSetFieldUShort2 fatal error"; @@ -158,11 +158,11 @@ TEST(SandboxTest, ShortTag) { CheckLongField(api, tif2, TIFFTAG_ROWSPERSTRIP, kRowsPerStrip); CheckShortField(api, tif2, TIFFTAG_PLANARCONFIG, kPlanarConfig); - for (auto& tag : kShortSingleTags) { + for (const auto& tag : kShortSingleTags) { CheckShortField(api, tif2, tag.tag, tag.value); } - for (auto& tag : kShortPairedTags) { + for (const auto& tag : kShortPairedTags) { CheckShortPairedField(api, tif2, tag.tag, tag.values); }