mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Automated Code Change
PiperOrigin-RevId: 614571272 Change-Id: Idb1f52d5f27238949feb1dff03bfaaa0c50de678
This commit is contained in:
parent
d33fe262b9
commit
3990ff23f4
|
@ -51,7 +51,6 @@ absl::Status RasterToGTiffProcessor::Main() {
|
||||||
sapi::v::RemotePtr driver_ptr(driver.value());
|
sapi::v::RemotePtr driver_ptr(driver.value());
|
||||||
|
|
||||||
sapi::v::ConstCStr out_file_full_path_ptr(out_file_full_path_.c_str());
|
sapi::v::ConstCStr out_file_full_path_ptr(out_file_full_path_.c_str());
|
||||||
sapi::v::NullPtr create_options;
|
|
||||||
|
|
||||||
GDALDataType type = data_.bands.size() > 0
|
GDALDataType type = data_.bands.size() > 0
|
||||||
? static_cast<GDALDataType>(data_.bands[0].data_type)
|
? static_cast<GDALDataType>(data_.bands[0].data_type)
|
||||||
|
@ -61,7 +60,7 @@ absl::Status RasterToGTiffProcessor::Main() {
|
||||||
absl::StatusOr<GDALDatasetH> dataset,
|
absl::StatusOr<GDALDatasetH> dataset,
|
||||||
api.GDALCreate(&driver_ptr, out_file_full_path_ptr.PtrBefore(),
|
api.GDALCreate(&driver_ptr, out_file_full_path_ptr.PtrBefore(),
|
||||||
data_.width, data_.height, data_.bands.size(), type,
|
data_.width, data_.height, data_.bands.size(), type,
|
||||||
&create_options));
|
nullptr));
|
||||||
|
|
||||||
TRANSACTION_FAIL_IF_NOT(dataset.value(), "Error creating dataset");
|
TRANSACTION_FAIL_IF_NOT(dataset.value(), "Error creating dataset");
|
||||||
sapi::v::RemotePtr dataset_ptr(dataset.value());
|
sapi::v::RemotePtr dataset_ptr(dataset.value());
|
||||||
|
|
|
@ -44,10 +44,9 @@ absl::Status LibPNGMain(const std::string& infile, const std::string& outfile) {
|
||||||
|
|
||||||
sapi::v::Array<uint8_t> buffer(PNG_IMAGE_SIZE(*image.mutable_data()));
|
sapi::v::Array<uint8_t> buffer(PNG_IMAGE_SIZE(*image.mutable_data()));
|
||||||
|
|
||||||
sapi::v::NullPtr null = sapi::v::NullPtr();
|
SAPI_ASSIGN_OR_RETURN(
|
||||||
SAPI_ASSIGN_OR_RETURN(result,
|
result, api.png_image_finish_read(image.PtrBoth(), nullptr,
|
||||||
api.png_image_finish_read(image.PtrBoth(), &null,
|
buffer.PtrBoth(), 0, nullptr));
|
||||||
buffer.PtrBoth(), 0, &null));
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return absl::InternalError(
|
return absl::InternalError(
|
||||||
absl::StrCat("finish read error: ", image.mutable_data()->message));
|
absl::StrCat("finish read error: ", image.mutable_data()->message));
|
||||||
|
@ -55,7 +54,7 @@ absl::Status LibPNGMain(const std::string& infile, const std::string& outfile) {
|
||||||
|
|
||||||
SAPI_ASSIGN_OR_RETURN(result, api.png_image_write_to_file(
|
SAPI_ASSIGN_OR_RETURN(result, api.png_image_write_to_file(
|
||||||
image.PtrBoth(), outfile_var.PtrBefore(), 0,
|
image.PtrBoth(), outfile_var.PtrBefore(), 0,
|
||||||
buffer.PtrBoth(), 0, &null));
|
buffer.PtrBoth(), 0, nullptr));
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return absl::InternalError(
|
return absl::InternalError(
|
||||||
absl::StrCat("write error: ", image.mutable_data()->message));
|
absl::StrCat("write error: ", image.mutable_data()->message));
|
||||||
|
|
|
@ -64,9 +64,8 @@ TEST(SandboxTest, ReadWrite) {
|
||||||
<< "image version changed";
|
<< "image version changed";
|
||||||
|
|
||||||
sapi::v::Array<uint8_t> buffer(PNG_IMAGE_SIZE(*image.mutable_data()));
|
sapi::v::Array<uint8_t> buffer(PNG_IMAGE_SIZE(*image.mutable_data()));
|
||||||
sapi::v::NullPtr null = sapi::v::NullPtr();
|
status_or_int = api.png_image_finish_read(image.PtrBoth(), nullptr,
|
||||||
status_or_int = api.png_image_finish_read(image.PtrBoth(), &null,
|
buffer.PtrBoth(), 0, nullptr);
|
||||||
buffer.PtrBoth(), 0, &null);
|
|
||||||
ASSERT_THAT(status_or_int, IsOk())
|
ASSERT_THAT(status_or_int, IsOk())
|
||||||
<< "fatal error when invoking png_image_finish_read";
|
<< "fatal error when invoking png_image_finish_read";
|
||||||
ASSERT_THAT(status_or_int.value(), IsTrue())
|
ASSERT_THAT(status_or_int.value(), IsTrue())
|
||||||
|
@ -76,8 +75,9 @@ TEST(SandboxTest, ReadWrite) {
|
||||||
ASSERT_THAT(image.mutable_data()->format, Eq(PNG_FORMAT_RGBA))
|
ASSERT_THAT(image.mutable_data()->format, Eq(PNG_FORMAT_RGBA))
|
||||||
<< "image format changed";
|
<< "image format changed";
|
||||||
|
|
||||||
status_or_int = api.png_image_write_to_file(
|
status_or_int =
|
||||||
image.PtrBoth(), outfile_var.PtrBefore(), 0, buffer.PtrBoth(), 0, &null);
|
api.png_image_write_to_file(image.PtrBoth(), outfile_var.PtrBefore(), 0,
|
||||||
|
buffer.PtrBoth(), 0, nullptr);
|
||||||
ASSERT_THAT(status_or_int, IsOk())
|
ASSERT_THAT(status_or_int, IsOk())
|
||||||
<< "fatal error when invoking png_image_write_to_file";
|
<< "fatal error when invoking png_image_write_to_file";
|
||||||
ASSERT_THAT(status_or_int.value(), IsTrue())
|
ASSERT_THAT(status_or_int.value(), IsTrue())
|
||||||
|
|
|
@ -86,8 +86,7 @@ absl::Status IdleBasic() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close idler
|
// Close idler
|
||||||
sapi::v::NullPtr null_ptr;
|
SAPI_RETURN_IF_ERROR(api.sapi_uv_close(&idler, nullptr));
|
||||||
SAPI_RETURN_IF_ERROR(api.sapi_uv_close(&idler, &null_ptr));
|
|
||||||
|
|
||||||
// Close loop
|
// Close loop
|
||||||
SAPI_ASSIGN_OR_RETURN(return_code, api.sapi_uv_loop_close(&loop));
|
SAPI_ASSIGN_OR_RETURN(return_code, api.sapi_uv_loop_close(&loop));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user