Remove deprecated sapi::StatusOr<> forward declaration

PiperOrigin-RevId: 399663835
Change-Id: I92255a68e50a3b9130d3e222a2e353ee2e599c18
This commit is contained in:
Christian Blichmann 2021-09-29 05:38:41 -07:00 committed by Copybara-Service
parent f6d9e7fd7c
commit 90d1867026
10 changed files with 20 additions and 72 deletions

View File

@ -153,9 +153,9 @@ int main(int argc, char** argv) {
// initialize sapi vars after constructing TiffSapiSandbox // initialize sapi vars after constructing TiffSapiSandbox
sapi::v::UShort h, v; sapi::v::UShort h, v;
sapi::StatusOr<TIFF*> status_or_tif; absl::StatusOr<TIFF*> status_or_tif;
sapi::StatusOr<int> status_or_int; absl::StatusOr<int> status_or_int;
sapi::StatusOr<tmsize_t> status_or_long; absl::StatusOr<tmsize_t> status_or_long;
auto status = sandbox.Init(); auto status = sandbox.Init();
if (!status.ok()) { if (!status.ok()) {

View File

@ -27,7 +27,7 @@ namespace {
void CheckShortField(TiffApi& api, sapi::v::RemotePtr& tif, const ttag_t field, void CheckShortField(TiffApi& api, sapi::v::RemotePtr& tif, const ttag_t field,
const uint16_t value) { const uint16_t value) {
sapi::v::UShort tmp(123); sapi::v::UShort tmp(123);
sapi::StatusOr<int> status_or_int; absl::StatusOr<int> status_or_int;
status_or_int = api.TIFFGetField1(&tif, field, tmp.PtrBoth()); status_or_int = api.TIFFGetField1(&tif, field, tmp.PtrBoth());
ASSERT_THAT(status_or_int, IsOk()) << "TIFFGetField1 fatal error"; ASSERT_THAT(status_or_int, IsOk()) << "TIFFGetField1 fatal error";
@ -42,7 +42,7 @@ void CheckShortPairedField(TiffApi& api, sapi::v::RemotePtr& tif,
const std::array<uint16_t, 2>& values) { const std::array<uint16_t, 2>& values) {
sapi::v::UShort tmp0(123); sapi::v::UShort tmp0(123);
sapi::v::UShort tmp1(456); sapi::v::UShort tmp1(456);
sapi::StatusOr<int> status_or_int; absl::StatusOr<int> status_or_int;
status_or_int = status_or_int =
api.TIFFGetField2(&tif, field, tmp0.PtrBoth(), tmp1.PtrBoth()); api.TIFFGetField2(&tif, field, tmp0.PtrBoth(), tmp1.PtrBoth());
@ -58,7 +58,7 @@ void CheckShortPairedField(TiffApi& api, sapi::v::RemotePtr& tif,
void CheckLongField(TiffApi& api, sapi::v::RemotePtr& tif, const ttag_t field, void CheckLongField(TiffApi& api, sapi::v::RemotePtr& tif, const ttag_t field,
const uint32_t value) { const uint32_t value) {
sapi::v::UInt tmp(123); sapi::v::UInt tmp(123);
sapi::StatusOr<int> status_or_int; absl::StatusOr<int> status_or_int;
status_or_int = api.TIFFGetField1(&tif, field, tmp.PtrBoth()); status_or_int = api.TIFFGetField1(&tif, field, tmp.PtrBoth());
ASSERT_THAT(status_or_int, IsOk()) << "TIFFGetField1 fatal error"; ASSERT_THAT(status_or_int, IsOk()) << "TIFFGetField1 fatal error";

View File

@ -49,16 +49,16 @@ constexpr int kRowsPerStrip = 1;
constexpr int kSamplePerPixel = 1; constexpr int kSamplePerPixel = 1;
void TestWriting(const char* mode, int tiled, int height) { void TestWriting(const char* mode, int tiled, int height) {
sapi::StatusOr<std::string> status_or_path = absl::StatusOr<std::string> status_or_path =
sandbox2::CreateNamedTempFileAndClose("defer_strile_writing.tif"); sandbox2::CreateNamedTempFileAndClose("defer_strile_writing.tif");
ASSERT_THAT(status_or_path, IsOk()) << "Could not create temp file"; ASSERT_THAT(status_or_path, IsOk()) << "Could not create temp file";
std::string srcfile = sandbox2::file::JoinPath( std::string srcfile = sandbox2::file::JoinPath(
sandbox2::file_util::fileops::GetCWD(), status_or_path.value()); sandbox2::file_util::fileops::GetCWD(), status_or_path.value());
sapi::StatusOr<int> status_or_int; absl::StatusOr<int> status_or_int;
sapi::StatusOr<int64_t> status_or_long; absl::StatusOr<int64_t> status_or_long;
sapi::StatusOr<TIFF*> status_or_tif; absl::StatusOr<TIFF*> status_or_tif;
TiffSapiSandbox sandbox("", srcfile); TiffSapiSandbox sandbox("", srcfile);
ASSERT_THAT(sandbox.Init(), IsOk()) << "Couldn't initialize Sandboxed API"; ASSERT_THAT(sandbox.Init(), IsOk()) << "Couldn't initialize Sandboxed API";

View File

@ -48,7 +48,7 @@ constexpr int kBps = 8;
constexpr int kRowsPerStrip = 1; constexpr int kRowsPerStrip = 1;
TEST(SandboxTest, LongTag) { TEST(SandboxTest, LongTag) {
sapi::StatusOr<std::string> status_or_path = absl::StatusOr<std::string> status_or_path =
sandbox2::CreateNamedTempFileAndClose("long_test.tif"); sandbox2::CreateNamedTempFileAndClose("long_test.tif");
ASSERT_THAT(status_or_path, IsOk()) << "Could not create temp file"; ASSERT_THAT(status_or_path, IsOk()) << "Could not create temp file";
@ -61,8 +61,8 @@ TEST(SandboxTest, LongTag) {
std::array<uint8_t, SPP> buffer = {0, 127, 255}; std::array<uint8_t, SPP> buffer = {0, 127, 255};
sapi::v::Array<uint8_t> buffer_(buffer.data(), SPP); sapi::v::Array<uint8_t> buffer_(buffer.data(), SPP);
sapi::StatusOr<int> status_or_int; absl::StatusOr<int> status_or_int;
sapi::StatusOr<TIFF*> status_or_tif; absl::StatusOr<TIFF*> status_or_tif;
TiffApi api(&sandbox); TiffApi api(&sandbox);
sapi::v::ConstCStr srcfile_var(srcfile.c_str()); sapi::v::ConstCStr srcfile_var(srcfile.c_str());

View File

@ -111,9 +111,9 @@ TEST(SandboxTest, RawDecode) {
tsize_t sz; tsize_t sz;
unsigned int pixel_status = 0; unsigned int pixel_status = 0;
sapi::v::UShort h, v; sapi::v::UShort h, v;
sapi::StatusOr<TIFF> status_or_tif; absl::StatusOr<TIFF> status_or_tif;
sapi::StatusOr<int> status_or_int; absl::StatusOr<int> status_or_int;
sapi::StatusOr<tmsize_t> status_or_long; absl::StatusOr<tmsize_t> status_or_long;
TiffApi api(&sandbox); TiffApi api(&sandbox);
sapi::v::ConstCStr srcfile_var(srcfile.c_str()); sapi::v::ConstCStr srcfile_var(srcfile.c_str());

View File

@ -70,7 +70,7 @@ constexpr std::array<PairedTag, 4> kShortPairedTags = {
{TIFFTAG_YCBCRSUBSAMPLING, {2, 1}}}; {TIFFTAG_YCBCRSUBSAMPLING, {2, 1}}};
TEST(SandboxTest, ShortTag) { TEST(SandboxTest, ShortTag) {
sapi::StatusOr<std::string> status_or_path = absl::StatusOr<std::string> status_or_path =
sandbox2::CreateNamedTempFileAndClose("short_test.tif"); sandbox2::CreateNamedTempFileAndClose("short_test.tif");
ASSERT_THAT(status_or_path, IsOk()) << "Could not create temp file"; ASSERT_THAT(status_or_path, IsOk()) << "Could not create temp file";
@ -83,8 +83,8 @@ TEST(SandboxTest, ShortTag) {
std::array<uint8_t, kSamplePerPixel> buffer = {0, 127, 255}; std::array<uint8_t, kSamplePerPixel> buffer = {0, 127, 255};
sapi::v::Array<uint8_t> buffer_(buffer.data(), kSamplePerPixel); sapi::v::Array<uint8_t> buffer_(buffer.data(), kSamplePerPixel);
sapi::StatusOr<int> status_or_int; absl::StatusOr<int> status_or_int;
sapi::StatusOr<TIFF*> status_or_tif; absl::StatusOr<TIFF*> status_or_tif;
TiffApi api(&sandbox); TiffApi api(&sandbox);
sapi::v::ConstCStr srcfile_var(srcfile.c_str()); sapi::v::ConstCStr srcfile_var(srcfile.c_str());

View File

@ -69,7 +69,7 @@ by default.*
n = 64, status OK, `pffft_transform` generates error n = 64, status OK, `pffft_transform` generates error
n > 64, status not OK n > 64, status not OK
Problem on initialising `sapi::StatusOr<PFFFT_Setup *> s;` the memory that stays Problem on initialising `absl::StatusOr<PFFFT_Setup *> s;` the memory that stays
for s is not the same with the address passed in `pffft_transform` function. for s is not the same with the address passed in `pffft_transform` function.
(`sapi::v::GenericPtr` - to be changed) (`sapi::v::GenericPtr` - to be changed)

View File

@ -163,17 +163,6 @@ cc_library(
], ],
) )
cc_library(
name = "statusor",
hdrs = ["statusor.h"],
deprecation = "Migrate to `absl::StatusOr<T>`",
visibility = ["//visibility:public"],
deps = [
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/status:statusor",
],
)
# gMock matchers for absl::Status and absl::StatusOr<T> and a gUnit printer # gMock matchers for absl::Status and absl::StatusOr<T> and a gUnit printer
# extension. Adapted from the version in Asylo. # extension. Adapted from the version in Asylo.
cc_library( cc_library(

View File

@ -121,18 +121,6 @@ target_link_libraries(sapi_util_status
PUBLIC sapi::status_proto PUBLIC sapi::status_proto
) )
# sandboxed_api/util:statusor
add_library(sapi_util_statusor ${SAPI_LIB_TYPE}
statusor.h
)
add_library(sapi::statusor ALIAS sapi_util_statusor)
target_link_libraries(sapi_util_statusor PRIVATE
absl::core_headers
absl::status
absl::statusor
sapi::base
)
# sandboxed_api/util:strerror # sandboxed_api/util:strerror
add_library(sapi_util_strerror ${SAPI_LIB_TYPE} add_library(sapi_util_strerror ${SAPI_LIB_TYPE}
strerror.cc strerror.cc

View File

@ -1,29 +0,0 @@
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef THIRD_PARTY_SAPI_UTIL_STATUSOR_H_
#define THIRD_PARTY_SAPI_UTIL_STATUSOR_H_
#include "absl/base/attributes.h"
#include "absl/status/statusor.h"
namespace sapi {
template <typename T>
using StatusOr ABSL_DEPRECATED("Use absl::StatusOr instead") =
absl::StatusOr<T>;
} // namespace sapi
#endif // THIRD_PARTY_SAPI_UTIL_STATUSOR_H_