diff --git a/oss-internship-2020/libtiff/example/main_sandboxed.cc b/oss-internship-2020/libtiff/example/main_sandboxed.cc index 472431b..451dc3a 100644 --- a/oss-internship-2020/libtiff/example/main_sandboxed.cc +++ b/oss-internship-2020/libtiff/example/main_sandboxed.cc @@ -43,13 +43,12 @@ absl::Status CheckCluster(int cluster, const sapi::v::Array& buffer, } // the image is split on 6-bit clusters because it has YCbCr color format - return absl::InternalError( - absl::StrCat("Cluster ", cluster, " did not match expected results.\n", - "Expect: ", expected_cluster[0], "\t", expected_cluster[1], - "\t", expected_cluster[2], "\t", expected_cluster[3], "\t", - expected_cluster[4], "\t", expected_cluster[5], "\n", - "Got: ", target[0], "\t", target[1], "\t", target[2], "\t", - target[3], "\t", target[4], "\t", target[5], "\n")); + return absl::InternalError(absl::StrCat( + "Cluster ", cluster, " did not match expected results.\n", "Expect: ", + expected_cluster[0], "\t", expected_cluster[1], "\t", expected_cluster[2], + "\t", expected_cluster[3], "\t", expected_cluster[4], "\t", + expected_cluster[5], "\n", "Got: ", target[0], "\t", target[1], "\t", + target[2], "\t", target[3], "\t", target[4], "\t", target[5], "\n")); } absl::Status CheckRgbPixel(int pixel, int min_red, int max_red, int min_green, @@ -98,8 +97,9 @@ absl::Status CheckRgbaPixel(int pixel, int min_red, int max_red, int min_green, "Pixel ", pixel, " did not match expected results.\n", "Got R=", TIFFGetR(rgba), " (expected ", min_red, "..=", max_red, "), G=", TIFFGetG(rgba), " (expected ", min_green, "..=", max_green, - "), B=", TIFFGetB(rgba), " (expected ", min_blue, "..=", max_blue, "), A=", - TIFFGetA(rgba), " (expected ", min_alpha, "..=", max_alpha, ")\n")); + "), B=", TIFFGetB(rgba), " (expected ", min_blue, "..=", max_blue, + "), A=", TIFFGetA(rgba), " (expected ", min_alpha, "..=", max_alpha, + ")\n")); } } // namespace @@ -114,10 +114,11 @@ std::string GetFilePath(const std::string filename) { std::string project_path; if (find == std::string::npos) { - LOG(ERROR) << "Something went wrong: CWD don't contain build dir. " - << "Please run tests from build dir or send project dir as a " - << "parameter: ./sandboxed /absolute/path/to/project/dir .\n" - << "Falling back to using current working directory as root dir.\n"; + LOG(ERROR) + << "Something went wrong: CWD don't contain build dir. " + << "Please run tests from build dir or send project dir as a " + << "parameter: ./sandboxed /absolute/path/to/project/dir .\n" + << "Falling back to using current working directory as root dir.\n"; project_path = cwd; } else { project_path = cwd.substr(0, find); @@ -166,14 +167,14 @@ absl::Status LibTIFFMain(const std::string& srcfile) { SAPI_ASSIGN_OR_RETURN(tsize_t sz, api.TIFFTileSize(&tif)); if (sz != 24576) { - return absl::InternalError( - absl::StrCat("tiles are ", sz, " bytes\n")); + return absl::InternalError(absl::StrCat("tiles are ", sz, " bytes\n")); } sapi::v::Array buffer_(sz); // Read a tile in decompressed form, but still YCbCr subsampled SAPI_ASSIGN_OR_RETURN( - tsize_t new_sz, api.TIFFReadEncodedTile(&tif, kRawTileNumber, buffer_.PtrBoth(), sz)); + tsize_t new_sz, + api.TIFFReadEncodedTile(&tif, kRawTileNumber, buffer_.PtrBoth(), sz)); if (new_sz != sz) { return absl::InternalError(absl::StrCat( "Did not get expected result code from TIFFReadEncodedTile(): ", @@ -209,18 +210,18 @@ absl::Status LibTIFFMain(const std::string& srcfile) { SAPI_ASSIGN_OR_RETURN(sz, api.TIFFTileSize(&tif)); if (sz != 128 * 128 * 3) { - return absl::InternalError( - absl::StrCat("tiles are ", sz, " bytes")); + return absl::InternalError(absl::StrCat("tiles are ", sz, " bytes")); } sapi::v::Array buffer2_(sz); SAPI_ASSIGN_OR_RETURN( - new_sz, api.TIFFReadEncodedTile(&tif, kRawTileNumber, buffer2_.PtrBoth(), sz)); + new_sz, + api.TIFFReadEncodedTile(&tif, kRawTileNumber, buffer2_.PtrBoth(), sz)); if (new_sz != sz) { return absl::InternalError(absl::StrCat( - "Did not get expected result code from TIFFReadEncodedTile(): ", - new_sz, " instead of ", sz)); + "Did not get expected result code from TIFFReadEncodedTile(): ", new_sz, + " instead of ", sz)); } pixel_status = true; diff --git a/oss-internship-2020/libtiff/short_test.tif9veSQm b/oss-internship-2020/libtiff/short_test.tif9veSQm deleted file mode 100644 index a423608..0000000 Binary files a/oss-internship-2020/libtiff/short_test.tif9veSQm and /dev/null differ diff --git a/oss-internship-2020/libtiff/test/defer_strile_writing.cc b/oss-internship-2020/libtiff/test/defer_strile_writing.cc index 02957b4..36a59b5 100644 --- a/oss-internship-2020/libtiff/test/defer_strile_writing.cc +++ b/oss-internship-2020/libtiff/test/defer_strile_writing.cc @@ -209,10 +209,11 @@ void TestWriting(const char* mode, int tiled, int height) { for (int i = 0; i < (height + 15) / 16; ++i) { std::array tilebuffer; tilebuffer.fill(i); - sapi::v::Array tilebuffer_(tilebuffer.data(), kTileBufferSize); + sapi::v::Array tilebuffer_(tilebuffer.data(), + kTileBufferSize); - status_or_int = - api.TIFFWriteEncodedTile(&tif, i, tilebuffer_.PtrBoth(), kTileBufferSize); + status_or_int = api.TIFFWriteEncodedTile(&tif, i, tilebuffer_.PtrBoth(), + kTileBufferSize); ASSERT_THAT(status_or_int, IsOk()) << "TIFFWriteEncodedTile fatal error"; EXPECT_THAT(status_or_int.value(), Eq(kTileBufferSize)) << "line " << i << ": expected " << kTileBufferSize << ", got " @@ -249,9 +250,10 @@ void TestWriting(const char* mode, int tiled, int height) { unsigned char expected_c = (unsigned char)i; tilebuffer.fill(0); - sapi::v::Array tilebuffer_(tilebuffer.data(), kTileBufferSize); - status_or_long = - api.TIFFReadEncodedTile(&tif2, i, tilebuffer_.PtrBoth(), kTileBufferSize); + sapi::v::Array tilebuffer_(tilebuffer.data(), + kTileBufferSize); + status_or_long = api.TIFFReadEncodedTile( + &tif2, i, tilebuffer_.PtrBoth(), kTileBufferSize); ASSERT_THAT(status_or_long, IsOk()) << "TIFFReadEncodedTile fatal error"; EXPECT_THAT(status_or_long.value(), Eq(kTileBufferSize)) diff --git a/oss-internship-2020/libtiff/test/long_tag.cc b/oss-internship-2020/libtiff/test/long_tag.cc index 396add3..4c9f3e2 100644 --- a/oss-internship-2020/libtiff/test/long_tag.cc +++ b/oss-internship-2020/libtiff/test/long_tag.cc @@ -74,7 +74,8 @@ TEST(SandboxTest, LongTag) { ASSERT_THAT(status_or_int, IsOk()) << "TIFFSetFieldU1 fatal error"; EXPECT_THAT(status_or_int.value(), IsTrue()) << "Can't set BitsPerSample tag"; - status_or_int = api.TIFFSetFieldU1(&tif, TIFFTAG_SAMPLESPERPIXEL, kSamplePerPixel); + status_or_int = + api.TIFFSetFieldU1(&tif, TIFFTAG_SAMPLESPERPIXEL, kSamplePerPixel); ASSERT_THAT(status_or_int, IsOk()) << "TIFFSetFieldU1 fatal error"; EXPECT_THAT(status_or_int.value(), IsTrue()) << "Can't set SamplesPerPixel tag"; diff --git a/oss-internship-2020/libtiff/test/raw_decode.cc b/oss-internship-2020/libtiff/test/raw_decode.cc index 20e655d..b8c3a06 100644 --- a/oss-internship-2020/libtiff/test/raw_decode.cc +++ b/oss-internship-2020/libtiff/test/raw_decode.cc @@ -103,11 +103,12 @@ bool CheckRgbaPixel(int pixel, int min_red, int max_red, int min_green, EXPECT_THAT(comp, IsFalse()) << "Pixel " << pixel << " did not match expected results.\n" - << "Got R=" << TIFFGetR(rgba) << " (expected " << min_red << "..=" - << max_red << "), G=" << TIFFGetG(rgba) << " (expected " << min_green - << "..=" << max_green << "), B=" << TIFFGetB(rgba) << " (expected " - << min_blue << "..=" << max_blue << "), A=" << TIFFGetA(rgba) - << " (expected " << min_alpha << "..=" << max_alpha << ")"; + << "Got R=" << TIFFGetR(rgba) << " (expected " << min_red + << "..=" << max_red << "), G=" << TIFFGetG(rgba) << " (expected " + << min_green << "..=" << max_green << "), B=" << TIFFGetB(rgba) + << " (expected " << min_blue << "..=" << max_blue + << "), A=" << TIFFGetA(rgba) << " (expected " << min_alpha + << "..=" << max_alpha << ")"; return comp; } diff --git a/oss-internship-2020/libtiff/test/short_tag.cc b/oss-internship-2020/libtiff/test/short_tag.cc index 5451cd1..1d93b56 100644 --- a/oss-internship-2020/libtiff/test/short_tag.cc +++ b/oss-internship-2020/libtiff/test/short_tag.cc @@ -95,7 +95,8 @@ TEST(SandboxTest, ShortTag) { ASSERT_THAT(status_or_int, IsOk()) << "TIFFSetFieldUShort1 fatal error"; EXPECT_THAT(status_or_int.value(), IsTrue()) << "Can't set BitsPerSample tag"; - status_or_int = api.TIFFSetFieldUShort1(&tif, TIFFTAG_SAMPLESPERPIXEL, kSamplePerPixel); + status_or_int = + api.TIFFSetFieldUShort1(&tif, TIFFTAG_SAMPLESPERPIXEL, kSamplePerPixel); ASSERT_THAT(status_or_int, IsOk()) << "TIFFSetFieldUShort1 fatal error"; EXPECT_THAT(status_or_int.value(), IsTrue()) << "Can't set SamplesPerPixel tag";