mirror of
https://github.com/Evolution-X/external_piex
synced 2026-01-27 16:24:09 +00:00
Fix build failures and accept clang suggestions
Change-Id: Ib3c71c42c7ac7737bf0185858ef37b322df42167
This commit is contained in:
@@ -41,7 +41,7 @@ constexpr Uuid kUuidPrvw = {0xea, 0xf4, 0x2b, 0x5e, 0x1c, 0x98, 0x4b, 0x88,
|
|||||||
0xb9, 0xfb, 0xb7, 0xdc, 0x40, 0x6e, 0x4d, 0x16};
|
0xb9, 0xfb, 0xb7, 0xdc, 0x40, 0x6e, 0x4d, 0x16};
|
||||||
|
|
||||||
constexpr size_t kTagSize = 4;
|
constexpr size_t kTagSize = 4;
|
||||||
using BoxTag = std::array<std::uint8_t, kTagSize>;
|
using BoxTag = std::array<char, kTagSize>;
|
||||||
|
|
||||||
constexpr BoxTag NewTag(const char s[kTagSize + 1]) {
|
constexpr BoxTag NewTag(const char s[kTagSize + 1]) {
|
||||||
return BoxTag{s[0], s[1], s[2], s[3]};
|
return BoxTag{s[0], s[1], s[2], s[3]};
|
||||||
@@ -232,8 +232,8 @@ Box GetNextBox(StreamInterface* stream, size_t offset) {
|
|||||||
return Box();
|
return Box();
|
||||||
}
|
}
|
||||||
BoxTag tag;
|
BoxTag tag;
|
||||||
Error status =
|
Error status = stream->GetData(offset + sizeof(length_32), kTagSize,
|
||||||
stream->GetData(offset + sizeof(length_32), kTagSize, tag.data());
|
reinterpret_cast<std::uint8_t*>(tag.data()));
|
||||||
if (status != kOk) {
|
if (status != kOk) {
|
||||||
return Box();
|
return Box();
|
||||||
}
|
}
|
||||||
@@ -531,7 +531,7 @@ bool IsImage(StreamInterface* stream, const Image& image) {
|
|||||||
|
|
||||||
Error Cr3GetPreviewData(StreamInterface* stream,
|
Error Cr3GetPreviewData(StreamInterface* stream,
|
||||||
PreviewImageData* preview_image_data) {
|
PreviewImageData* preview_image_data) {
|
||||||
ProcessData data{preview_image_data};
|
ProcessData data{.preview_image_data = preview_image_data};
|
||||||
if (!ProcessStream(stream, kMdatTag, &data)) {
|
if (!ProcessStream(stream, kMdatTag, &data)) {
|
||||||
return kFail;
|
return kFail;
|
||||||
}
|
}
|
||||||
@@ -548,7 +548,7 @@ Error Cr3GetPreviewData(StreamInterface* stream,
|
|||||||
|
|
||||||
bool Cr3GetOrientation(StreamInterface* stream, std::uint32_t* orientation) {
|
bool Cr3GetOrientation(StreamInterface* stream, std::uint32_t* orientation) {
|
||||||
PreviewImageData preview_image_data;
|
PreviewImageData preview_image_data;
|
||||||
ProcessData data{&preview_image_data};
|
ProcessData data{.preview_image_data = &preview_image_data};
|
||||||
if (ProcessStream(stream, kCmt1Tag, &data)) {
|
if (ProcessStream(stream, kCmt1Tag, &data)) {
|
||||||
*orientation = preview_image_data.exif_orientation;
|
*orientation = preview_image_data.exif_orientation;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ namespace {
|
|||||||
|
|
||||||
using tiff_directory::Endian;
|
using tiff_directory::Endian;
|
||||||
using tiff_directory::Rational;
|
using tiff_directory::Rational;
|
||||||
using tiff_directory::SRational;
|
|
||||||
using tiff_directory::SizeOfType;
|
using tiff_directory::SizeOfType;
|
||||||
using tiff_directory::TIFF_TYPE_LONG;
|
using tiff_directory::TIFF_TYPE_LONG;
|
||||||
using tiff_directory::TIFF_TYPE_UNDEFINED;
|
using tiff_directory::TIFF_TYPE_UNDEFINED;
|
||||||
@@ -396,8 +395,8 @@ bool GetImageData(const TiffDirectory& tiff_directory, StreamInterface* stream,
|
|||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
length = static_cast<std::uint32_t>(
|
length = static_cast<std::uint32_t>(std::accumulate(
|
||||||
std::accumulate(strip_byte_counts.begin(), strip_byte_counts.end(), 0));
|
strip_byte_counts.begin(), strip_byte_counts.end(), 0U));
|
||||||
offset = strip_offsets[0];
|
offset = strip_offsets[0];
|
||||||
} else if (tiff_directory.Has(kPanaTagJpegImage)) {
|
} else if (tiff_directory.Has(kPanaTagJpegImage)) {
|
||||||
if (!tiff_directory.GetOffsetAndLength(
|
if (!tiff_directory.GetOffsetAndLength(
|
||||||
@@ -715,13 +714,13 @@ bool TiffParser::Parse(const TagSet& desired_tags,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TiffParser::ParseIfd(const std::uint32_t offset_to_ifd,
|
bool TiffParser::ParseIfd(const std::uint32_t ifd_offset,
|
||||||
const TagSet& desired_tags,
|
const TagSet& desired_tags,
|
||||||
const std::uint16_t max_number_ifds,
|
const std::uint16_t max_number_ifds,
|
||||||
IfdVector* tiff_directory) {
|
IfdVector* tiff_directory) {
|
||||||
std::uint32_t next_ifd_offset;
|
std::uint32_t next_ifd_offset;
|
||||||
TiffDirectory tiff_ifd(static_cast<Endian>(endian_));
|
TiffDirectory tiff_ifd(static_cast<Endian>(endian_));
|
||||||
if (!ParseDirectory(tiff_offset_, offset_to_ifd, endian_, desired_tags,
|
if (!ParseDirectory(tiff_offset_, ifd_offset, endian_, desired_tags,
|
||||||
stream_, &tiff_ifd, &next_ifd_offset) ||
|
stream_, &tiff_ifd, &next_ifd_offset) ||
|
||||||
!ParseSubIfds(tiff_offset_, desired_tags, max_number_ifds, endian_,
|
!ParseSubIfds(tiff_offset_, desired_tags, max_number_ifds, endian_,
|
||||||
stream_, &tiff_ifd)) {
|
stream_, &tiff_ifd)) {
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ class TiffParser {
|
|||||||
// Runs over the Tiff IFD, Exif IFD and subIFDs to get the preview image data.
|
// Runs over the Tiff IFD, Exif IFD and subIFDs to get the preview image data.
|
||||||
// Returns false if something with the Tiff tags is wrong.
|
// Returns false if something with the Tiff tags is wrong.
|
||||||
bool GetPreviewImageData(const TiffContent& tiff_content,
|
bool GetPreviewImageData(const TiffContent& tiff_content,
|
||||||
PreviewImageData* image_metadata);
|
PreviewImageData* preview_image_data);
|
||||||
|
|
||||||
// Returns false if called more that once or something with the Tiff data is
|
// Returns false if called more that once or something with the Tiff data is
|
||||||
// wrong.
|
// wrong.
|
||||||
|
|||||||
Reference in New Issue
Block a user