Skip to content

Commit

Permalink
use reference to work around MSVC bug
Browse files Browse the repository at this point in the history
Signed-off-by: Rosen Penev <rosenp@gmail.com>
  • Loading branch information
neheb committed Sep 25, 2022
1 parent 640b0fb commit 84f566b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/tiffcomposite_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ TiffIfdMakernote::TiffIfdMakernote(uint16_t tag, IfdId group, IfdId mnGroup, MnH
TiffComponent(tag, group), pHeader_(pHeader), ifd_(tag, mnGroup, hasNext) {
}

TiffBinaryArray::TiffBinaryArray(uint16_t tag, IfdId group, const ArrayCfg* arrayCfg, const ArrayDef* arrayDef,
TiffBinaryArray::TiffBinaryArray(uint16_t tag, IfdId group, const ArrayCfg& arrayCfg, const ArrayDef* arrayDef,
int defSize) :
TiffEntryBase(tag, group, arrayCfg->elTiffType_), arrayCfg_(arrayCfg), arrayDef_(arrayDef), defSize_(defSize) {
TiffEntryBase(tag, group, arrayCfg.elTiffType_), arrayCfg_(&arrayCfg), arrayDef_(arrayDef), defSize_(defSize) {
}

TiffBinaryArray::TiffBinaryArray(uint16_t tag, IfdId group, const ArraySet* arraySet, int setSize,
Expand Down
10 changes: 5 additions & 5 deletions src/tiffcomposite_int.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@ class TiffBinaryArray : public TiffEntryBase {
//! @name Creators
//@{
//! Constructor
TiffBinaryArray(uint16_t tag, IfdId group, const ArrayCfg* arrayCfg, const ArrayDef* arrayDef, int defSize);
TiffBinaryArray(uint16_t tag, IfdId group, const ArrayCfg& arrayCfg, const ArrayDef* arrayDef, int defSize);
//! Constructor for a complex binary array
TiffBinaryArray(uint16_t tag, IfdId group, const ArraySet* arraySet, int setSize, CfgSelFct cfgSelFct);
//! Virtual destructor
Expand Down Expand Up @@ -1534,15 +1534,15 @@ TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group) {
}

//! Function to create and initialize a new binary array entry
template <const ArrayCfg* arrayCfg, int N, const ArrayDef arrayDef[N]>
template <const ArrayCfg& arrayCfg, int N, const ArrayDef arrayDef[N]>
TiffComponent::UniquePtr newTiffBinaryArray0(uint16_t tag, IfdId group) {
return std::make_unique<TiffBinaryArray>(tag, group, &(*arrayCfg), &(*arrayDef), N);
return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, &(*arrayDef), N);
}

//! Function to create and initialize a new simple binary array entry
template <const ArrayCfg* arrayCfg>
template <const ArrayCfg& arrayCfg>
TiffComponent::UniquePtr newTiffBinaryArray1(uint16_t tag, IfdId group) {
return std::make_unique<TiffBinaryArray>(tag, group, &(*arrayCfg), nullptr, 0);
return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, nullptr, 0);
}

//! Function to create and initialize a new complex binary array entry
Expand Down
4 changes: 2 additions & 2 deletions src/tiffimage_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include <iostream>

// Shortcuts for the newTiffBinaryArray templates.
#define EXV_BINARY_ARRAY(arrayCfg, arrayDef) (newTiffBinaryArray0<&(arrayCfg), std::size(arrayDef), arrayDef>)
#define EXV_SIMPLE_BINARY_ARRAY(arrayCfg) (newTiffBinaryArray1<&(arrayCfg)>)
#define EXV_BINARY_ARRAY(arrayCfg, arrayDef) (newTiffBinaryArray0<arrayCfg, std::size(arrayDef), arrayDef>)
#define EXV_SIMPLE_BINARY_ARRAY(arrayCfg) (newTiffBinaryArray1<arrayCfg>)
#define EXV_COMPLEX_BINARY_ARRAY(arraySet, cfgSelFct) (newTiffBinaryArray2<arraySet, std::size(arraySet), cfgSelFct>)

namespace Exiv2::Internal {
Expand Down

0 comments on commit 84f566b

Please sign in to comment.