mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
auto& -> const auto&; bool status -> bool status_ok
This commit is contained in:
parent
9eb518c57a
commit
316828a219
|
@ -171,8 +171,8 @@ absl::Status LibTIFFMain(const std::string& srcfile) {
|
|||
|
||||
TiffSapiSandbox sandbox(srcfile);
|
||||
|
||||
bool pixel_status = true;
|
||||
bool cluster_status = true;
|
||||
bool pixel_status_ok = true;
|
||||
bool cluster_status_ok = true;
|
||||
// initialize sapi vars after constructing TiffSapiSandbox
|
||||
sapi::v::UShort h;
|
||||
sapi::v::UShort v;
|
||||
|
@ -226,10 +226,10 @@ absl::Status LibTIFFMain(const std::string& srcfile) {
|
|||
if (status = CheckCluster(id, buffer_, data); !status.ok()) {
|
||||
LOG(ERROR) << "CheckCluster failed:\n" << status.ToString();
|
||||
}
|
||||
cluster_status &= status.ok();
|
||||
cluster_status_ok &= status.ok();
|
||||
}
|
||||
|
||||
if (!cluster_status) {
|
||||
if (!cluster_status_ok) {
|
||||
return absl::InternalError("One or more clusters failed the check");
|
||||
}
|
||||
|
||||
|
@ -262,7 +262,7 @@ absl::Status LibTIFFMain(const std::string& srcfile) {
|
|||
if (status = CheckRgbPixel(id, data, buffer2_); !status.ok()) {
|
||||
LOG(ERROR) << "CheckRgbPixel failed:\n" << status.ToString();
|
||||
}
|
||||
pixel_status &= status.ok();
|
||||
pixel_status_ok &= status.ok();
|
||||
}
|
||||
|
||||
SAPI_RETURN_IF_ERROR(api.TIFFClose(&tif));
|
||||
|
@ -290,12 +290,12 @@ absl::Status LibTIFFMain(const std::string& srcfile) {
|
|||
if (status = CheckRgbaPixel(id, data, rgba_buffer_); !status.ok()) {
|
||||
LOG(ERROR) << "CheckRgbaPixel failed:\n" << status.ToString();
|
||||
}
|
||||
pixel_status &= status.ok();
|
||||
pixel_status_ok &= status.ok();
|
||||
}
|
||||
|
||||
SAPI_RETURN_IF_ERROR(api.TIFFClose(&tif2));
|
||||
|
||||
if (!pixel_status) {
|
||||
if (!pixel_status_ok) {
|
||||
return absl::InternalError("wrong encoding");
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ TEST(SandboxTest, LongTag) {
|
|||
EXPECT_THAT(status_or_int.value(), IsTrue())
|
||||
<< "Can't set PhotometricInterpretation tag";
|
||||
|
||||
for (auto& tag : kLongTags) {
|
||||
for (const auto& tag : kLongTags) {
|
||||
status_or_int = api.TIFFSetFieldU1(&tif, tag.tag, tag.value);
|
||||
ASSERT_THAT(status_or_int, IsOk()) << "TIFFSetFieldUShort1 fatal error";
|
||||
EXPECT_THAT(status_or_int.value(), IsTrue()) << "Can't set tag " << tag.tag;
|
||||
|
@ -125,7 +125,7 @@ TEST(SandboxTest, LongTag) {
|
|||
CheckLongField(api, tif2, TIFFTAG_IMAGELENGTH, kLength);
|
||||
CheckLongField(api, tif2, TIFFTAG_ROWSPERSTRIP, kRowsPerStrip);
|
||||
|
||||
for (auto& tag : kLongTags) {
|
||||
for (const auto& tag : kLongTags) {
|
||||
CheckLongField(api, tif2, tag.tag, tag.value);
|
||||
}
|
||||
|
||||
|
|
|
@ -123,13 +123,13 @@ TEST(SandboxTest, ShortTag) {
|
|||
EXPECT_THAT(status_or_int.value(), IsTrue())
|
||||
<< "Can't set PhotometricInterpretation tag";
|
||||
|
||||
for (auto& tag : kShortSingleTags) {
|
||||
for (const auto& tag : kShortSingleTags) {
|
||||
status_or_int = api.TIFFSetFieldUShort1(&tif, tag.tag, tag.value);
|
||||
ASSERT_THAT(status_or_int, IsOk()) << "TIFFSetFieldUShort1 fatal error";
|
||||
EXPECT_THAT(status_or_int.value(), IsTrue()) << "Can't set tag " << tag.tag;
|
||||
}
|
||||
|
||||
for (auto& tag : kShortPairedTags) {
|
||||
for (const auto& tag : kShortPairedTags) {
|
||||
status_or_int =
|
||||
api.TIFFSetFieldUShort2(&tif, tag.tag, tag.values[0], tag.values[1]);
|
||||
ASSERT_THAT(status_or_int, IsOk()) << "TIFFSetFieldUShort2 fatal error";
|
||||
|
@ -158,11 +158,11 @@ TEST(SandboxTest, ShortTag) {
|
|||
CheckLongField(api, tif2, TIFFTAG_ROWSPERSTRIP, kRowsPerStrip);
|
||||
CheckShortField(api, tif2, TIFFTAG_PLANARCONFIG, kPlanarConfig);
|
||||
|
||||
for (auto& tag : kShortSingleTags) {
|
||||
for (const auto& tag : kShortSingleTags) {
|
||||
CheckShortField(api, tif2, tag.tag, tag.value);
|
||||
}
|
||||
|
||||
for (auto& tag : kShortPairedTags) {
|
||||
for (const auto& tag : kShortPairedTags) {
|
||||
CheckShortPairedField(api, tif2, tag.tag, tag.values);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user