Compare commits
2 Commits
64ed644f73
...
3990ff23f4
Author | SHA1 | Date |
---|---|---|
Oliver Kunz | 3990ff23f4 | |
Oliver Kunz | d33fe262b9 |
|
@ -23,7 +23,7 @@
|
|||
absl::Status BrotliDecoder::InitStructs() {
|
||||
SAPI_ASSIGN_OR_RETURN(
|
||||
BrotliDecoderState * state,
|
||||
api_.BrotliDecoderCreateInstance(&null_ptr_, &null_ptr_, &null_ptr_));
|
||||
api_.BrotliDecoderCreateInstance(nullptr, nullptr, nullptr));
|
||||
|
||||
state_.SetRemote(state);
|
||||
|
||||
|
@ -84,12 +84,11 @@ absl::StatusOr<BrotliDecoderResult> BrotliDecoder::Decompress(
|
|||
|
||||
sapi::v::IntBase<size_t> sapi_avilable_out(0);
|
||||
|
||||
SAPI_ASSIGN_OR_RETURN(
|
||||
BrotliDecoderResult ret,
|
||||
api_.BrotliDecoderDecompressStream(
|
||||
state_.PtrNone(), sapi_size_in.PtrBefore(),
|
||||
sapi_opaque_buf_in.PtrBefore(), sapi_avilable_out.PtrBefore(),
|
||||
&null_ptr_, &null_ptr_));
|
||||
SAPI_ASSIGN_OR_RETURN(BrotliDecoderResult ret,
|
||||
api_.BrotliDecoderDecompressStream(
|
||||
state_.PtrNone(), sapi_size_in.PtrBefore(),
|
||||
sapi_opaque_buf_in.PtrBefore(),
|
||||
sapi_avilable_out.PtrBefore(), nullptr, nullptr));
|
||||
|
||||
// Ignore output error, as we didn't provide any buffer.
|
||||
if (ret == BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT) {
|
||||
|
|
|
@ -44,7 +44,6 @@ class BrotliDecoder {
|
|||
BrotliApi api_;
|
||||
absl::Status status;
|
||||
sapi::v::GenericPtr state_;
|
||||
sapi::v::NullPtr null_ptr_;
|
||||
};
|
||||
|
||||
#endif // CONTRIB_BROTLI_UTILS_UTILS_BROTLI_DEC_H_
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
absl::Status BrotliEncoder::InitStructs() {
|
||||
SAPI_ASSIGN_OR_RETURN(
|
||||
BrotliEncoderState * state,
|
||||
api_.BrotliEncoderCreateInstance(&null_ptr_, &null_ptr_, &null_ptr_));
|
||||
api_.BrotliEncoderCreateInstance(nullptr, nullptr, nullptr));
|
||||
|
||||
state_.SetRemote(state);
|
||||
|
||||
|
@ -84,11 +84,11 @@ absl::Status BrotliEncoder::Compress(std::vector<uint8_t>& buf_in,
|
|||
|
||||
sapi::v::IntBase<size_t> sapi_avilable_out(0);
|
||||
|
||||
SAPI_ASSIGN_OR_RETURN(
|
||||
bool ret, api_.BrotliEncoderCompressStream(
|
||||
state_.PtrNone(), op, sapi_size_in.PtrBefore(),
|
||||
sapi_opaque_buf_in.PtrBefore(),
|
||||
sapi_avilable_out.PtrBefore(), &null_ptr_, &null_ptr_));
|
||||
SAPI_ASSIGN_OR_RETURN(bool ret,
|
||||
api_.BrotliEncoderCompressStream(
|
||||
state_.PtrNone(), op, sapi_size_in.PtrBefore(),
|
||||
sapi_opaque_buf_in.PtrBefore(),
|
||||
sapi_avilable_out.PtrBefore(), nullptr, nullptr));
|
||||
if (!ret) {
|
||||
return absl::UnavailableError("Unable to compress input");
|
||||
}
|
||||
|
|
|
@ -45,7 +45,6 @@ class BrotliEncoder {
|
|||
BrotliApi api_;
|
||||
absl::Status status;
|
||||
sapi::v::GenericPtr state_;
|
||||
sapi::v::NullPtr null_ptr_;
|
||||
};
|
||||
|
||||
#endif // CONTRIB_BROTLI_UTILS_UTILS_BROTLI_ENC_H_
|
||||
|
|
|
@ -51,7 +51,6 @@ absl::Status RasterToGTiffProcessor::Main() {
|
|||
sapi::v::RemotePtr driver_ptr(driver.value());
|
||||
|
||||
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
|
||||
? static_cast<GDALDataType>(data_.bands[0].data_type)
|
||||
|
@ -61,7 +60,7 @@ absl::Status RasterToGTiffProcessor::Main() {
|
|||
absl::StatusOr<GDALDatasetH> dataset,
|
||||
api.GDALCreate(&driver_ptr, out_file_full_path_ptr.PtrBefore(),
|
||||
data_.width, data_.height, data_.bands.size(), type,
|
||||
&create_options));
|
||||
nullptr));
|
||||
|
||||
TRANSACTION_FAIL_IF_NOT(dataset.value(), "Error creating dataset");
|
||||
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::NullPtr null = sapi::v::NullPtr();
|
||||
SAPI_ASSIGN_OR_RETURN(result,
|
||||
api.png_image_finish_read(image.PtrBoth(), &null,
|
||||
buffer.PtrBoth(), 0, &null));
|
||||
SAPI_ASSIGN_OR_RETURN(
|
||||
result, api.png_image_finish_read(image.PtrBoth(), nullptr,
|
||||
buffer.PtrBoth(), 0, nullptr));
|
||||
if (!result) {
|
||||
return absl::InternalError(
|
||||
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(
|
||||
image.PtrBoth(), outfile_var.PtrBefore(), 0,
|
||||
buffer.PtrBoth(), 0, &null));
|
||||
buffer.PtrBoth(), 0, nullptr));
|
||||
if (!result) {
|
||||
return absl::InternalError(
|
||||
absl::StrCat("write error: ", image.mutable_data()->message));
|
||||
|
|
|
@ -64,9 +64,8 @@ TEST(SandboxTest, ReadWrite) {
|
|||
<< "image version changed";
|
||||
|
||||
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(), &null,
|
||||
buffer.PtrBoth(), 0, &null);
|
||||
status_or_int = api.png_image_finish_read(image.PtrBoth(), nullptr,
|
||||
buffer.PtrBoth(), 0, nullptr);
|
||||
ASSERT_THAT(status_or_int, IsOk())
|
||||
<< "fatal error when invoking png_image_finish_read";
|
||||
ASSERT_THAT(status_or_int.value(), IsTrue())
|
||||
|
@ -76,8 +75,9 @@ TEST(SandboxTest, ReadWrite) {
|
|||
ASSERT_THAT(image.mutable_data()->format, Eq(PNG_FORMAT_RGBA))
|
||||
<< "image format changed";
|
||||
|
||||
status_or_int = api.png_image_write_to_file(
|
||||
image.PtrBoth(), outfile_var.PtrBefore(), 0, buffer.PtrBoth(), 0, &null);
|
||||
status_or_int =
|
||||
api.png_image_write_to_file(image.PtrBoth(), outfile_var.PtrBefore(), 0,
|
||||
buffer.PtrBoth(), 0, nullptr);
|
||||
ASSERT_THAT(status_or_int, IsOk())
|
||||
<< "fatal error when invoking png_image_write_to_file";
|
||||
ASSERT_THAT(status_or_int.value(), IsTrue())
|
||||
|
|
|
@ -86,8 +86,7 @@ absl::Status IdleBasic() {
|
|||
}
|
||||
|
||||
// Close idler
|
||||
sapi::v::NullPtr null_ptr;
|
||||
SAPI_RETURN_IF_ERROR(api.sapi_uv_close(&idler, &null_ptr));
|
||||
SAPI_RETURN_IF_ERROR(api.sapi_uv_close(&idler, nullptr));
|
||||
|
||||
// Close loop
|
||||
SAPI_ASSIGN_OR_RETURN(return_code, api.sapi_uv_loop_close(&loop));
|
||||
|
|
Loading…
Reference in New Issue