Skip to content

Commit 7c2b282

Browse files
committed
use const ref for updateDirEntry
Simpler. Signed-off-by: Rosen Penev <[email protected]>
1 parent 21d994d commit 7c2b282

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/tiffvisitor_int.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,12 +582,12 @@ void TiffEncoder::visitDirectoryNext(TiffDirectory* object) {
582582
// Update type and count in IFD entries, in case they changed
583583
byte* p = object->start() + 2;
584584
for (const auto& component : object->components_) {
585-
p += updateDirEntry(p, byteOrder(), component.get());
585+
p += updateDirEntry(p, byteOrder(), component);
586586
}
587587
}
588588

589-
uint32_t TiffEncoder::updateDirEntry(byte* buf, ByteOrder byteOrder, TiffComponent* pTiffComponent) {
590-
auto pTiffEntry = dynamic_cast<const TiffEntryBase*>(pTiffComponent);
589+
uint32_t TiffEncoder::updateDirEntry(byte* buf, ByteOrder byteOrder, const TiffComponent::UniquePtr& tiffComponent) {
590+
auto pTiffEntry = dynamic_cast<const TiffEntryBase*>(tiffComponent.get());
591591
if (!pTiffEntry)
592592
return 0;
593593
us2Data(buf + 2, pTiffEntry->tiffType(), byteOrder);

src/tiffvisitor_int.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ class TiffEncoder : public TiffVisitor {
495495
entries are encoded. It takes care of type and count changes
496496
and size shrinkage for non-intrusive writing.
497497
*/
498-
static uint32_t updateDirEntry(byte* buf, ByteOrder byteOrder, TiffComponent* pTiffComponent);
498+
static uint32_t updateDirEntry(byte* buf, ByteOrder byteOrder, const TiffComponent::UniquePtr& tiffComponent);
499499
/*!
500500
@brief Check if the tag is an image tag of an existing image. Such
501501
tags are copied from the original image and can't be modified.

0 commit comments

Comments
 (0)