diff --git a/oss-internship-2020/guetzli/BUILD.bazel b/oss-internship-2020/guetzli/BUILD.bazel index b00b12e..f4b4271 100644 --- a/oss-internship-2020/guetzli/BUILD.bazel +++ b/oss-internship-2020/guetzli/BUILD.bazel @@ -24,6 +24,7 @@ cc_library( srcs = ["guetzli_entry_points.cc"], hdrs = ["guetzli_entry_points.h"], deps = [ + "@com_google_absl//absl/status:statusor", "@com_google_sandboxed_api//sandboxed_api:lenval_core", "@com_google_sandboxed_api//sandboxed_api:vars", "@guetzli//:guetzli_lib", @@ -53,9 +54,7 @@ sapi_library( cc_binary( name = "guetzli_sandboxed", srcs = ["guetzli_sandboxed.cc"], - deps = [ - ":guetzli_sapi", - ], + deps = [":guetzli_sapi"], ) cc_test( diff --git a/oss-internship-2020/guetzli/WORKSPACE b/oss-internship-2020/guetzli/WORKSPACE.bazel similarity index 100% rename from oss-internship-2020/guetzli/WORKSPACE rename to oss-internship-2020/guetzli/WORKSPACE.bazel diff --git a/oss-internship-2020/guetzli/guetzli_entry_points.cc b/oss-internship-2020/guetzli/guetzli_entry_points.cc index 8de94b6..98ae384 100644 --- a/oss-internship-2020/guetzli/guetzli_entry_points.cc +++ b/oss-internship-2020/guetzli/guetzli_entry_points.cc @@ -25,8 +25,8 @@ #include "guetzli/jpeg_data_reader.h" #include "guetzli/quality.h" #include "png.h" // NOLINT(build/include) +#include "absl/status/statusor.h" #include "sandboxed_api/sandbox2/util/fileops.h" -#include "sandboxed_api/util/statusor.h" namespace { @@ -51,7 +51,7 @@ sapi::LenValStruct CreateLenValFromData(const void* data, size_t size) { return {size, new_data}; } -sapi::StatusOr ReadFromFd(int fd) { +absl::StatusOr ReadFromFd(int fd) { struct stat file_data; int status = fstat(fd, &file_data); @@ -70,9 +70,9 @@ sapi::StatusOr ReadFromFd(int fd) { return result; } -sapi::StatusOr PrepareDataForProcessing( +absl::StatusOr PrepareDataForProcessing( const ProcessingParams& processing_params) { - sapi::StatusOr input = ReadFromFd(processing_params.remote_fd); + absl::StatusOr input = ReadFromFd(processing_params.remote_fd); if (!input.ok()) { return input.status(); @@ -96,7 +96,7 @@ inline uint8_t BlendOnBlack(const uint8_t val, const uint8_t alpha) { } // Modified version of ReadPNG from original guetzli.cc -sapi::StatusOr ReadPNG(const std::string& data) { +absl::StatusOr ReadPNG(const std::string& data) { std::vector rgb; int xsize, ysize; png_structp png_ptr = diff --git a/oss-internship-2020/guetzli/guetzli_sandboxed.cc b/oss-internship-2020/guetzli/guetzli_sandboxed.cc index 944a572..0e064c7 100644 --- a/oss-internship-2020/guetzli/guetzli_sandboxed.cc +++ b/oss-internship-2020/guetzli/guetzli_sandboxed.cc @@ -17,7 +17,6 @@ #include "guetzli_transaction.h" // NOLINT(build/include) #include "sandboxed_api/sandbox2/util/fileops.h" -#include "sandboxed_api/util/statusor.h" namespace { diff --git a/oss-internship-2020/guetzli/guetzli_sapi_test.cc b/oss-internship-2020/guetzli/guetzli_sapi_test.cc index cd8bc91..b275036 100644 --- a/oss-internship-2020/guetzli/guetzli_sapi_test.cc +++ b/oss-internship-2020/guetzli/guetzli_sapi_test.cc @@ -83,7 +83,7 @@ TEST_F(GuetzliSapiTest, ProcessRGB) { *processing_params.mutable_data() = { in_fd.GetRemoteFd(), 0, kDefaultQualityTarget, kDefaultMemlimitMb}; sapi::v::LenVal output(0); - sapi::StatusOr processing_result = + absl::StatusOr processing_result = api_->ProcessRgb(processing_params.PtrBefore(), output.PtrBoth()); ASSERT_TRUE(processing_result.value_or(false)) << "Error processing rgb data"; std::string reference_data = @@ -108,7 +108,7 @@ TEST_F(GuetzliSapiTest, ProcessJpeg) { *processing_params.mutable_data() = { in_fd.GetRemoteFd(), 0, kDefaultQualityTarget, kDefaultMemlimitMb}; sapi::v::LenVal output(0); - sapi::StatusOr processing_result = + absl::StatusOr processing_result = api_->ProcessJpeg(processing_params.PtrBefore(), output.PtrBoth()); ASSERT_TRUE(processing_result.value_or(false)) << "Error processing jpg data"; std::string reference_data = diff --git a/oss-internship-2020/guetzli/guetzli_transaction.cc b/oss-internship-2020/guetzli/guetzli_transaction.cc index 2bd6e8a..d3bc1bd 100644 --- a/oss-internship-2020/guetzli/guetzli_transaction.cc +++ b/oss-internship-2020/guetzli/guetzli_transaction.cc @@ -99,7 +99,7 @@ absl::Status GuetzliTransaction::LinkOutFile(int out_fd) const { return absl::OkStatus(); } -sapi::StatusOr GuetzliTransaction::GetImageTypeFromFd(int fd) const { +absl::StatusOr GuetzliTransaction::GetImageTypeFromFd(int fd) const { static const unsigned char kPNGMagicBytes[] = { 0x89, 'P', 'N', 'G', '\r', '\n', 0x1a, '\n', }; diff --git a/oss-internship-2020/guetzli/guetzli_transaction.h b/oss-internship-2020/guetzli/guetzli_transaction.h index 2996908..2cda32d 100644 --- a/oss-internship-2020/guetzli/guetzli_transaction.h +++ b/oss-internship-2020/guetzli/guetzli_transaction.h @@ -48,7 +48,7 @@ class GuetzliTransaction : public sapi::Transaction { absl::Status Main() final; absl::Status LinkOutFile(int out_fd) const; - sapi::StatusOr GetImageTypeFromFd(int fd) const; + absl::StatusOr GetImageTypeFromFd(int fd) const; const TransactionParams params_; ImageType image_type_ = ImageType::kJpeg;